mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 18:42:58 +02:00
Moved chat out of Menu
Move into DialogsManager Done moving dialogs out of Menu!!!
This commit is contained in:
parent
c600a3b0b3
commit
90c3c7955a
4 changed files with 61 additions and 57 deletions
|
@ -197,20 +197,9 @@ Menu::Menu() {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_QXMPP
|
#ifdef HAVE_QXMPP
|
||||||
_chatAction = addActionToQMenuAndActionHash(toolsMenu,
|
addActionToQMenuAndActionHash(toolsMenu, MenuOption::Chat, Qt::Key_Backslash,
|
||||||
MenuOption::Chat,
|
dialogsManager.data(), SLOT(showChat()));
|
||||||
Qt::Key_Backslash,
|
dialogsManager->setupChat();
|
||||||
this,
|
|
||||||
SLOT(showChat()));
|
|
||||||
|
|
||||||
const QXmppClient& xmppClient = XmppClient::getInstance().getXMPPClient();
|
|
||||||
toggleChat();
|
|
||||||
connect(&xmppClient, &QXmppClient::connected, this, &Menu::toggleChat);
|
|
||||||
connect(&xmppClient, &QXmppClient::disconnected, this, &Menu::toggleChat);
|
|
||||||
|
|
||||||
QDir::setCurrent(PathUtils::resourcesPath());
|
|
||||||
// init chat window to listen chat
|
|
||||||
_chatWindow = new ChatWindow(Application::getInstance()->getWindow());
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
addActionToQMenuAndActionHash(toolsMenu,
|
addActionToQMenuAndActionHash(toolsMenu,
|
||||||
|
@ -1180,44 +1169,10 @@ void Menu::displayNameLocationResponse(const QString& errorString) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Menu::showChat() {
|
|
||||||
if (AccountManager::getInstance().isLoggedIn()) {
|
|
||||||
QMainWindow* mainWindow = Application::getInstance()->getWindow();
|
|
||||||
if (!_chatWindow) {
|
|
||||||
_chatWindow = new ChatWindow(mainWindow);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_chatWindow->isHidden()) {
|
|
||||||
_chatWindow->show();
|
|
||||||
}
|
|
||||||
_chatWindow->raise();
|
|
||||||
_chatWindow->activateWindow();
|
|
||||||
_chatWindow->setFocus();
|
|
||||||
} else {
|
|
||||||
Application::getInstance()->getTrayIcon()->showMessage("Interface", "You need to login to be able to chat with others on this domain.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Menu::loadRSSDKFile() {
|
void Menu::loadRSSDKFile() {
|
||||||
RealSense::getInstance()->loadRSSDKFile();
|
RealSense::getInstance()->loadRSSDKFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Menu::toggleChat() {
|
|
||||||
#ifdef HAVE_QXMPP
|
|
||||||
_chatAction->setEnabled(XmppClient::getInstance().getXMPPClient().isConnected());
|
|
||||||
if (!_chatAction->isEnabled() && _chatWindow && AccountManager::getInstance().isLoggedIn()) {
|
|
||||||
if (_chatWindow->isHidden()) {
|
|
||||||
_chatWindow->show();
|
|
||||||
_chatWindow->raise();
|
|
||||||
_chatWindow->activateWindow();
|
|
||||||
_chatWindow->setFocus();
|
|
||||||
} else {
|
|
||||||
_chatWindow->hide();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void Menu::audioMuteToggled() {
|
void Menu::audioMuteToggled() {
|
||||||
QAction *muteAction = _actionHash.value(MenuOption::MuteAudio);
|
QAction *muteAction = _actionHash.value(MenuOption::MuteAudio);
|
||||||
if (muteAction) {
|
if (muteAction) {
|
||||||
|
|
|
@ -159,8 +159,6 @@ private slots:
|
||||||
void bumpSettings();
|
void bumpSettings();
|
||||||
void changePrivateKey();
|
void changePrivateKey();
|
||||||
void runTests();
|
void runTests();
|
||||||
void showChat();
|
|
||||||
void toggleChat();
|
|
||||||
void audioMuteToggled();
|
void audioMuteToggled();
|
||||||
void displayNameLocationResponse(const QString& errorString);
|
void displayNameLocationResponse(const QString& errorString);
|
||||||
void changeVSync();
|
void changeVSync();
|
||||||
|
@ -170,9 +168,7 @@ private:
|
||||||
#if defined(Q_OS_MAC) || defined(Q_OS_WIN)
|
#if defined(Q_OS_MAC) || defined(Q_OS_WIN)
|
||||||
SpeechRecognizer _speechRecognizer;
|
SpeechRecognizer _speechRecognizer;
|
||||||
#endif
|
#endif
|
||||||
QPointer<ChatWindow> _chatWindow;
|
|
||||||
|
|
||||||
QAction* _chatAction = nullptr;
|
|
||||||
QString _snapshotsLocation;
|
QString _snapshotsLocation;
|
||||||
QString _scriptsLocation;
|
QString _scriptsLocation;
|
||||||
QByteArray _walletPrivateKey;
|
QByteArray _walletPrivateKey;
|
||||||
|
|
|
@ -9,8 +9,11 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#include <AccountManager.h>
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
#include <MainWindow.h>
|
#include <MainWindow.h>
|
||||||
|
#include <PathUtils.h>
|
||||||
|
#include <XmppClient.h>
|
||||||
|
|
||||||
#include "AddressBarDialog.h"
|
#include "AddressBarDialog.h"
|
||||||
#include "AnimationsDialog.h"
|
#include "AnimationsDialog.h"
|
||||||
|
@ -160,6 +163,51 @@ void DialogsManager::showScriptEditor() {
|
||||||
_scriptEditor->raise();
|
_scriptEditor->raise();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DialogsManager::setupChat() {
|
||||||
|
const QXmppClient& xmppClient = XmppClient::getInstance().getXMPPClient();
|
||||||
|
connect(&xmppClient, &QXmppClient::connected, this, &DialogsManager::toggleChat);
|
||||||
|
connect(&xmppClient, &QXmppClient::disconnected, this, &DialogsManager::toggleChat);
|
||||||
|
|
||||||
|
QDir::setCurrent(PathUtils::resourcesPath());
|
||||||
|
// init chat window to listen chat
|
||||||
|
maybeCreateDialog(_chatWindow);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DialogsManager::showChat() {
|
||||||
|
if (AccountManager::getInstance().isLoggedIn()) {
|
||||||
|
maybeCreateDialog(_chatWindow);
|
||||||
|
|
||||||
|
if (_chatWindow->isHidden()) {
|
||||||
|
_chatWindow->show();
|
||||||
|
}
|
||||||
|
_chatWindow->raise();
|
||||||
|
_chatWindow->activateWindow();
|
||||||
|
_chatWindow->setFocus();
|
||||||
|
} else {
|
||||||
|
qApp->getTrayIcon()->showMessage("Interface",
|
||||||
|
"You need to login to be able to chat with others on this domain.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DialogsManager::toggleChat() {
|
||||||
|
#ifdef HAVE_QXMPP
|
||||||
|
QAction* chatAction = Menu::getInstance()->getActionForOption(MenuOption::Login);
|
||||||
|
Q_CHECK_PTR(chatAction);
|
||||||
|
|
||||||
|
chatAction->setEnabled(XmppClient::getInstance().getXMPPClient().isConnected());
|
||||||
|
if (!chatAction->isEnabled() && _chatWindow && AccountManager::getInstance().isLoggedIn()) {
|
||||||
|
if (_chatWindow->isHidden()) {
|
||||||
|
_chatWindow->show();
|
||||||
|
_chatWindow->raise();
|
||||||
|
_chatWindow->activateWindow();
|
||||||
|
_chatWindow->setFocus();
|
||||||
|
} else {
|
||||||
|
_chatWindow->hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -16,17 +16,19 @@
|
||||||
|
|
||||||
#include <DependencyManager.h>
|
#include <DependencyManager.h>
|
||||||
|
|
||||||
|
class QAction;
|
||||||
|
|
||||||
class DialogsManager : public QObject, public Dependency {
|
class DialogsManager : public QObject, public Dependency {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
SINGLETON_DEPENDENCY
|
SINGLETON_DEPENDENCY
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QPointer<OctreeStatsDialog> getOctreeStatsDialog() { return _octreeStatsDialog; }
|
QPointer<BandwidthDialog> getBandwidthDialog() const { return _bandwidthDialog; }
|
||||||
|
QPointer<HMDToolsDialog> getHMDToolsDialog() const { return _hmdToolsDialog; }
|
||||||
|
QPointer<LodToolsDialog> getLodToolsDialog() const { return _lodToolsDialog; }
|
||||||
|
QPointer<OctreeStatsDialog> getOctreeStatsDialog() const { return _octreeStatsDialog; }
|
||||||
|
|
||||||
|
void setupChat();
|
||||||
BandwidthDialog* getBandwidthDialog() const { return _bandwidthDialog; }
|
|
||||||
LodToolsDialog* getLodToolsDialog() const { return _lodToolsDialog; }
|
|
||||||
HMDToolsDialog* getHMDToolsDialog() const { return _hmdToolsDialog; }
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void toggleAddressBar();
|
void toggleAddressBar();
|
||||||
|
@ -43,10 +45,12 @@ public slots:
|
||||||
void showMetavoxelEditor();
|
void showMetavoxelEditor();
|
||||||
void showMetavoxelNetworkSimulator();
|
void showMetavoxelNetworkSimulator();
|
||||||
void showScriptEditor();
|
void showScriptEditor();
|
||||||
|
void showChat();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void toggleToolWindow();
|
void toggleToolWindow();
|
||||||
void hmdToolsClosed();
|
void hmdToolsClosed();
|
||||||
|
void toggleChat();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DialogsManager() {}
|
DialogsManager() {}
|
||||||
|
@ -70,6 +74,7 @@ private:
|
||||||
QPointer<AttachmentsDialog> _attachmentsDialog;
|
QPointer<AttachmentsDialog> _attachmentsDialog;
|
||||||
QPointer<BandwidthDialog> _bandwidthDialog;
|
QPointer<BandwidthDialog> _bandwidthDialog;
|
||||||
QPointer<CachesSizeDialog> _cachesSizeDialog;
|
QPointer<CachesSizeDialog> _cachesSizeDialog;
|
||||||
|
QPointer<ChatWindow> _chatWindow;
|
||||||
QPointer<HMDToolsDialog> _hmdToolsDialog;
|
QPointer<HMDToolsDialog> _hmdToolsDialog;
|
||||||
QPointer<LodToolsDialog> _lodToolsDialog;
|
QPointer<LodToolsDialog> _lodToolsDialog;
|
||||||
QPointer<LoginDialog> _loginDialog;
|
QPointer<LoginDialog> _loginDialog;
|
||||||
|
|
Loading…
Reference in a new issue