mirror of
https://github.com/lubosz/overte.git
synced 2025-04-16 15:30:11 +02:00
Added a define to ensure the build works without qxmpp.
This commit is contained in:
parent
fe2f9f5253
commit
52c8ccb698
6 changed files with 45 additions and 9 deletions
|
@ -67,10 +67,6 @@ endforeach(EXTERNAL_SOURCE_SUBDIR)
|
|||
|
||||
find_package(Qt5 COMPONENTS Core Gui Multimedia Network OpenGL Script Svg WebKit WebKitWidgets Xml UiTools)
|
||||
|
||||
find_package(Qxmpp REQUIRED)
|
||||
add_definitions(-DQXMPP_STATIC)
|
||||
include_directories(SYSTEM ${QXMPP_INCLUDE_DIR})
|
||||
|
||||
# grab the ui files in resources/ui
|
||||
file (GLOB_RECURSE QT_UI_FILES ui/*.ui)
|
||||
# have qt5 wrap them and generate the appropriate header files
|
||||
|
@ -132,6 +128,7 @@ find_package(LibOVR)
|
|||
find_package(Sixense)
|
||||
find_package(Visage)
|
||||
find_package(ZLIB)
|
||||
find_package(Qxmpp)
|
||||
|
||||
# include the Sixense library for Razer Hydra if available
|
||||
if (SIXENSE_FOUND AND NOT DISABLE_SIXENSE)
|
||||
|
@ -171,6 +168,14 @@ if (LIBOVR_FOUND AND NOT DISABLE_LIBOVR)
|
|||
target_link_libraries(${TARGET_NAME} "${LIBOVR_LIBRARIES}")
|
||||
endif (LIBOVR_FOUND AND NOT DISABLE_LIBOVR)
|
||||
|
||||
# and with qxmpp for chat
|
||||
if (QXMPP_FOUND AND NOT DISABLE_QXMPP)
|
||||
add_definitions(-DHAVE_QXMPP -DQXMPP_STATIC)
|
||||
include_directories(SYSTEM ${QXMPP_INCLUDE_DIR})
|
||||
|
||||
target_link_libraries(${TARGET_NAME} "${QXMPP_LIBRARY}")
|
||||
endif (QXMPP_FOUND AND NOT DISABLE_QXMPP)
|
||||
|
||||
# include headers for interface and InterfaceConfig.
|
||||
include_directories("${PROJECT_SOURCE_DIR}/src" "${PROJECT_BINARY_DIR}/includes")
|
||||
|
||||
|
@ -182,7 +187,6 @@ target_link_libraries(
|
|||
${TARGET_NAME}
|
||||
"${FACESHIFT_LIBRARIES}"
|
||||
"${ZLIB_LIBRARIES}"
|
||||
"${QXMPP_LIBRARY}"
|
||||
Qt5::Core Qt5::Gui Qt5::Multimedia Qt5::Network Qt5::OpenGL
|
||||
Qt5::Script Qt5::Svg Qt5::WebKit Qt5::WebKitWidgets Qt5::Xml Qt5::UiTools
|
||||
)
|
||||
|
|
|
@ -164,10 +164,14 @@ Menu::Menu() :
|
|||
addActionToQMenuAndActionHash(toolsMenu, MenuOption::FstUploader, 0, Application::getInstance(), SLOT(uploadFST()));
|
||||
|
||||
_chatAction = addActionToQMenuAndActionHash(toolsMenu, MenuOption::Chat, 0, this, SLOT(showChat()));
|
||||
#ifdef HAVE_QXMPP
|
||||
const QXmppClient& xmppClient = XmppClient::getInstance().getXMPPClient();
|
||||
toggleChat();
|
||||
connect(&xmppClient, SIGNAL(connected()), this, SLOT(toggleChat()));
|
||||
connect(&xmppClient, SIGNAL(disconnected()), this, SLOT(toggleChat()));
|
||||
#else
|
||||
_chatAction->setEnabled(false);
|
||||
#endif
|
||||
|
||||
QMenu* viewMenu = addMenu("View");
|
||||
|
||||
|
@ -1046,10 +1050,12 @@ void Menu::showChat() {
|
|||
}
|
||||
|
||||
void Menu::toggleChat() {
|
||||
#ifdef HAVE_QXMPP
|
||||
_chatAction->setEnabled(XmppClient::getInstance().getXMPPClient().isConnected());
|
||||
if (!_chatAction->isEnabled() && _chatWindow) {
|
||||
_chatWindow->close();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void Menu::audioMuteToggled() {
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
// Copyright (c) 2013 High Fidelity, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#ifdef HAVE_QXMPP
|
||||
|
||||
#include <AccountManager.h>
|
||||
|
||||
#include "XmppClient.h"
|
||||
|
@ -63,3 +65,5 @@ XmppClient::XmppClient(const XmppClient& other) {
|
|||
void XmppClient::operator =(XmppClient const& other) {
|
||||
Q_UNUSED(other);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
// Copyright (c) 2013 High Fidelity, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#ifdef HAVE_QXMPP
|
||||
|
||||
#ifndef __interface__XmppClient__
|
||||
#define __interface__XmppClient__
|
||||
|
||||
|
@ -41,3 +43,5 @@ private:
|
|||
};
|
||||
|
||||
#endif // __interface__XmppClient__
|
||||
|
||||
#endif
|
||||
|
|
|
@ -40,7 +40,7 @@ ChatWindow::ChatWindow() :
|
|||
ui->messagePlainTextEdit->installEventFilter(this);
|
||||
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
#ifdef HAVE_QXMPP
|
||||
const QXmppClient& xmppClient = XmppClient::getInstance().getXMPPClient();
|
||||
if (xmppClient.isConnected()) {
|
||||
participantsChanged();
|
||||
|
@ -56,16 +56,18 @@ ChatWindow::ChatWindow() :
|
|||
connect(&xmppClient, SIGNAL(connected()), this, SLOT(connected()));
|
||||
}
|
||||
connect(&xmppClient, SIGNAL(messageReceived(QXmppMessage)), this, SLOT(messageReceived(QXmppMessage)));
|
||||
#endif
|
||||
}
|
||||
|
||||
ChatWindow::~ChatWindow() {
|
||||
#ifdef HAVE_QXMPP
|
||||
const QXmppClient& xmppClient = XmppClient::getInstance().getXMPPClient();
|
||||
disconnect(&xmppClient, SIGNAL(connected()), this, SLOT(connected()));
|
||||
disconnect(&xmppClient, SIGNAL(messageReceived(QXmppMessage)), this, SLOT(messageReceived(QXmppMessage)));
|
||||
|
||||
const QXmppMucRoom* publicChatRoom = XmppClient::getInstance().getPublicChatRoom();
|
||||
disconnect(publicChatRoom, SIGNAL(participantsChanged()), this, SLOT(participantsChanged()));
|
||||
|
||||
#endif
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
@ -80,12 +82,14 @@ bool ChatWindow::eventFilter(QObject* sender, QEvent* event) {
|
|||
(keyEvent->modifiers() & Qt::ShiftModifier) == 0) {
|
||||
QString messageText = ui->messagePlainTextEdit->document()->toPlainText().trimmed();
|
||||
if (!messageText.isEmpty()) {
|
||||
#ifdef HAVE_QXMPP
|
||||
const QXmppMucRoom* publicChatRoom = XmppClient::getInstance().getPublicChatRoom();
|
||||
QXmppMessage message;
|
||||
message.setTo(publicChatRoom->jid());
|
||||
message.setType(QXmppMessage::GroupChat);
|
||||
message.setBody(messageText);
|
||||
XmppClient::getInstance().getXMPPClient().sendPacket(message);
|
||||
#endif
|
||||
ui->messagePlainTextEdit->document()->clear();
|
||||
}
|
||||
return true;
|
||||
|
@ -93,10 +97,12 @@ bool ChatWindow::eventFilter(QObject* sender, QEvent* event) {
|
|||
return false;
|
||||
}
|
||||
|
||||
#ifdef HAVE_QXMPP
|
||||
QString ChatWindow::getParticipantName(const QString& participant) {
|
||||
const QXmppMucRoom* publicChatRoom = XmppClient::getInstance().getPublicChatRoom();
|
||||
return participant.right(participant.count() - 1 - publicChatRoom->jid().count());
|
||||
}
|
||||
#endif
|
||||
|
||||
void ChatWindow::addTimeStamp() {
|
||||
QTimeSpan timePassed = QDateTime::currentDateTime() - lastMessageStamp;
|
||||
|
@ -133,10 +139,10 @@ void ChatWindow::connected() {
|
|||
ui->usersWidget->show();
|
||||
ui->messagesScrollArea->show();
|
||||
ui->messagePlainTextEdit->show();
|
||||
|
||||
#ifdef HAVE_QXMPP
|
||||
const QXmppMucRoom* publicChatRoom = XmppClient::getInstance().getPublicChatRoom();
|
||||
connect(publicChatRoom, SIGNAL(participantsChanged()), this, SLOT(participantsChanged()));
|
||||
|
||||
#endif
|
||||
startTimerForTimeStamps();
|
||||
}
|
||||
|
||||
|
@ -146,6 +152,8 @@ void ChatWindow::timeout() {
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_QXMPP
|
||||
|
||||
void ChatWindow::error(QXmppClient::Error error) {
|
||||
ui->connectingToXMPPLabel->setText(QString::number(error));
|
||||
}
|
||||
|
@ -200,3 +208,5 @@ void ChatWindow::messageReceived(const QXmppMessage& message) {
|
|||
lastMessageStamp = QDateTime::currentDateTime();
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -15,9 +15,13 @@
|
|||
|
||||
#include <Application.h>
|
||||
|
||||
#ifdef HAVE_QXMPP
|
||||
|
||||
#include <QXmppClient.h>
|
||||
#include <QXmppMessage.h>
|
||||
|
||||
#endif
|
||||
|
||||
namespace Ui {
|
||||
class ChatWindow;
|
||||
}
|
||||
|
@ -33,7 +37,9 @@ protected:
|
|||
bool eventFilter(QObject* sender, QEvent* event);
|
||||
|
||||
private:
|
||||
#ifdef HAVE_QXMPP
|
||||
QString getParticipantName(const QString& participant);
|
||||
#endif
|
||||
void startTimerForTimeStamps();
|
||||
void addTimeStamp();
|
||||
|
||||
|
@ -44,9 +50,11 @@ private:
|
|||
private slots:
|
||||
void connected();
|
||||
void timeout();
|
||||
#ifdef HAVE_QXMPP
|
||||
void error(QXmppClient::Error error);
|
||||
void participantsChanged();
|
||||
void messageReceived(const QXmppMessage& message);
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif /* defined(__interface__ChatWindow__) */
|
||||
|
|
Loading…
Reference in a new issue