mirror of
https://github.com/Armored-Dragon/overte.git
synced 2025-03-11 16:13:16 +01:00
Moved more dialogs out of Menu
All moved into DialogsManager
This commit is contained in:
parent
05edbd68bf
commit
afadb0b48c
10 changed files with 72 additions and 68 deletions
|
@ -175,12 +175,14 @@ Menu::Menu() {
|
|||
addActionToQMenuAndActionHash(editMenu,
|
||||
MenuOption::Preferences,
|
||||
Qt::CTRL | Qt::Key_Comma,
|
||||
this,
|
||||
dialogsManager.data(),
|
||||
SLOT(editPreferences()),
|
||||
QAction::PreferencesRole);
|
||||
|
||||
addActionToQMenuAndActionHash(editMenu, MenuOption::Attachments, 0, this, SLOT(editAttachments()));
|
||||
addActionToQMenuAndActionHash(editMenu, MenuOption::Animations, 0, this, SLOT(editAnimations()));
|
||||
addActionToQMenuAndActionHash(editMenu, MenuOption::Attachments, 0,
|
||||
dialogsManager.data(), SLOT(editAttachments()));
|
||||
addActionToQMenuAndActionHash(editMenu, MenuOption::Animations, 0,
|
||||
dialogsManager.data(), SLOT(editAnimations()));
|
||||
|
||||
QMenu* toolsMenu = addMenu("Tools");
|
||||
addActionToQMenuAndActionHash(toolsMenu, MenuOption::MetavoxelEditor, 0, this, SLOT(showMetavoxelEditor()));
|
||||
|
@ -454,7 +456,8 @@ Menu::Menu() {
|
|||
false,
|
||||
&UserActivityLogger::getInstance(),
|
||||
SLOT(disable(bool)));
|
||||
addActionToQMenuAndActionHash(networkMenu, MenuOption::CachesSize, 0, this, SLOT(cachesSizeDialog()));
|
||||
addActionToQMenuAndActionHash(networkMenu, MenuOption::CachesSize, 0,
|
||||
dialogsManager.data(), SLOT(cachesSizeDialog()));
|
||||
|
||||
addActionToQMenuAndActionHash(developerMenu, MenuOption::WalletPrivateKey, 0, this, SLOT(changePrivateKey()));
|
||||
|
||||
|
@ -1113,33 +1116,6 @@ void sendFakeEnterEvent() {
|
|||
|
||||
const float DIALOG_RATIO_OF_WINDOW = 0.30f;
|
||||
|
||||
void Menu::editPreferences() {
|
||||
if (!_preferencesDialog) {
|
||||
_preferencesDialog = new PreferencesDialog();
|
||||
_preferencesDialog->show();
|
||||
} else {
|
||||
_preferencesDialog->close();
|
||||
}
|
||||
}
|
||||
|
||||
void Menu::editAttachments() {
|
||||
if (!_attachmentsDialog) {
|
||||
_attachmentsDialog = new AttachmentsDialog();
|
||||
_attachmentsDialog->show();
|
||||
} else {
|
||||
_attachmentsDialog->close();
|
||||
}
|
||||
}
|
||||
|
||||
void Menu::editAnimations() {
|
||||
if (!_animationsDialog) {
|
||||
_animationsDialog = new AnimationsDialog();
|
||||
_animationsDialog->show();
|
||||
} else {
|
||||
_animationsDialog->close();
|
||||
}
|
||||
}
|
||||
|
||||
void Menu::toggleSixense(bool shouldEnable) {
|
||||
SixenseManager& sixenseManager = SixenseManager::getInstance();
|
||||
|
||||
|
@ -1289,19 +1265,6 @@ void Menu::audioMuteToggled() {
|
|||
}
|
||||
}
|
||||
|
||||
void Menu::cachesSizeDialog() {
|
||||
qDebug() << "Caches size:" << _cachesSizeDialog.isNull();
|
||||
if (!_cachesSizeDialog) {
|
||||
_cachesSizeDialog = new CachesSizeDialog(DependencyManager::get<GLCanvas>().data());
|
||||
connect(_cachesSizeDialog, SIGNAL(closed()), _cachesSizeDialog, SLOT(deleteLater()));
|
||||
_cachesSizeDialog->show();
|
||||
if (_hmdToolsDialog) {
|
||||
_hmdToolsDialog->watchWindow(_cachesSizeDialog->windowHandle());
|
||||
}
|
||||
}
|
||||
_cachesSizeDialog->raise();
|
||||
}
|
||||
|
||||
void Menu::lodTools() {
|
||||
if (!_lodToolsDialog) {
|
||||
_lodToolsDialog = new LodToolsDialog(DependencyManager::get<GLCanvas>().data());
|
||||
|
|
|
@ -153,7 +153,6 @@ signals:
|
|||
|
||||
public slots:
|
||||
void bandwidthDetails();
|
||||
void cachesSizeDialog();
|
||||
void lodTools();
|
||||
void hmdTools(bool showTools);
|
||||
void copyAddress();
|
||||
|
@ -165,9 +164,6 @@ private slots:
|
|||
void aboutApp();
|
||||
void showEditEntitiesHelp();
|
||||
void bumpSettings();
|
||||
void editPreferences();
|
||||
void editAttachments();
|
||||
void editAnimations();
|
||||
void changePrivateKey();
|
||||
void hmdToolsClosed();
|
||||
void runTests();
|
||||
|
@ -187,13 +183,9 @@ private:
|
|||
SpeechRecognizer _speechRecognizer;
|
||||
#endif
|
||||
|
||||
QPointer<AnimationsDialog> _animationsDialog;
|
||||
QPointer<AttachmentsDialog> _attachmentsDialog;
|
||||
QPointer<BandwidthDialog> _bandwidthDialog;
|
||||
QPointer<CachesSizeDialog> _cachesSizeDialog;
|
||||
QPointer<HMDToolsDialog> _hmdToolsDialog;
|
||||
QPointer<LodToolsDialog> _lodToolsDialog;
|
||||
QPointer<PreferencesDialog> _preferencesDialog;
|
||||
|
||||
QPointer<MetavoxelEditor> _MetavoxelEditor;
|
||||
QPointer<MetavoxelNetworkSimulator> _metavoxelNetworkSimulator;
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
#include "Application.h"
|
||||
#include "MainWindow.h"
|
||||
|
||||
AnimationsDialog::AnimationsDialog() :
|
||||
QDialog(Application::getInstance()->getWindow()) {
|
||||
AnimationsDialog::AnimationsDialog(QWidget* parent) :
|
||||
QDialog(parent) {
|
||||
|
||||
setWindowTitle("Edit Animations");
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
|
|
@ -30,7 +30,7 @@ class AnimationsDialog : public QDialog {
|
|||
|
||||
public:
|
||||
|
||||
AnimationsDialog();
|
||||
AnimationsDialog(QWidget* parent = nullptr);
|
||||
|
||||
virtual void setVisible(bool visible);
|
||||
|
||||
|
|
|
@ -22,8 +22,8 @@
|
|||
#include "AttachmentsDialog.h"
|
||||
#include "MainWindow.h"
|
||||
|
||||
AttachmentsDialog::AttachmentsDialog() :
|
||||
QDialog(Application::getInstance()->getWindow()) {
|
||||
AttachmentsDialog::AttachmentsDialog(QWidget* parent) :
|
||||
QDialog(parent) {
|
||||
|
||||
setWindowTitle("Edit Attachments");
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
|
|
@ -27,8 +27,7 @@ class AttachmentsDialog : public QDialog {
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
AttachmentsDialog();
|
||||
AttachmentsDialog(QWidget* parent = nullptr);
|
||||
|
||||
virtual void setVisible(bool visible);
|
||||
|
||||
|
|
|
@ -13,8 +13,12 @@
|
|||
#include <MainWindow.h>
|
||||
|
||||
#include "AddressBarDialog.h"
|
||||
#include "AnimationsDialog.h"
|
||||
#include "AttachmentsDialog.h"
|
||||
#include "CachesSizeDialog.h"
|
||||
#include "LoginDialog.h"
|
||||
#include "OctreeStatsDialog.h"
|
||||
#include "PreferencesDialog.h"
|
||||
|
||||
#include "DialogsManager.h"
|
||||
|
||||
|
@ -50,3 +54,46 @@ void DialogsManager::octreeStatsDetails() {
|
|||
_octreeStatsDialog->raise();
|
||||
}
|
||||
|
||||
void DialogsManager::cachesSizeDialog() {
|
||||
qDebug() << "Caches size:" << _cachesSizeDialog.isNull();
|
||||
if (!_cachesSizeDialog) {
|
||||
maybeCreateDialog(_cachesSizeDialog);
|
||||
|
||||
connect(_cachesSizeDialog, SIGNAL(closed()), _cachesSizeDialog, SLOT(deleteLater()));
|
||||
_cachesSizeDialog->show();
|
||||
|
||||
//TODO: wire hmdToolsDialog once moved
|
||||
// if (_hmdToolsDialog) {
|
||||
// _hmdToolsDialog->watchWindow(_cachesSizeDialog->windowHandle());
|
||||
// }
|
||||
}
|
||||
_cachesSizeDialog->raise();
|
||||
}
|
||||
|
||||
void DialogsManager::editPreferences() {
|
||||
if (!_preferencesDialog) {
|
||||
maybeCreateDialog(_preferencesDialog);
|
||||
_preferencesDialog->show();
|
||||
} else {
|
||||
_preferencesDialog->close();
|
||||
}
|
||||
}
|
||||
|
||||
void DialogsManager::editAttachments() {
|
||||
if (!_attachmentsDialog) {
|
||||
maybeCreateDialog(_attachmentsDialog);
|
||||
_attachmentsDialog->show();
|
||||
} else {
|
||||
_attachmentsDialog->close();
|
||||
}
|
||||
}
|
||||
|
||||
void DialogsManager::editAnimations() {
|
||||
if (!_animationsDialog) {
|
||||
maybeCreateDialog(_animationsDialog);
|
||||
_animationsDialog->show();
|
||||
} else {
|
||||
_animationsDialog->close();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -16,10 +16,6 @@
|
|||
|
||||
#include <DependencyManager.h>
|
||||
|
||||
class AddressBarDialog;
|
||||
class LoginDialog;
|
||||
class OctreeStatsDialog;
|
||||
|
||||
class DialogsManager : public QObject, public Dependency {
|
||||
Q_OBJECT
|
||||
SINGLETON_DEPENDENCY
|
||||
|
@ -29,11 +25,13 @@ public:
|
|||
|
||||
public slots:
|
||||
void toggleAddressBar();
|
||||
|
||||
void toggleLoginDialog();
|
||||
void showLoginDialog();
|
||||
|
||||
void octreeStatsDetails();
|
||||
void cachesSizeDialog();
|
||||
void editPreferences();
|
||||
void editAttachments();
|
||||
void editAnimations();
|
||||
|
||||
private:
|
||||
DialogsManager() {}
|
||||
|
@ -48,6 +46,11 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
QPointer<AnimationsDialog> _animationsDialog;
|
||||
QPointer<AttachmentsDialog> _attachmentsDialog;
|
||||
QPointer<CachesSizeDialog> _cachesSizeDialog;
|
||||
QPointer<PreferencesDialog> _preferencesDialog;
|
||||
|
||||
QPointer<AddressBarDialog> _addressBarDialog;
|
||||
QPointer<LoginDialog> _loginDialog;
|
||||
QPointer<OctreeStatsDialog> _octreeStatsDialog;
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
|
||||
const int PREFERENCES_HEIGHT_PADDING = 20;
|
||||
|
||||
PreferencesDialog::PreferencesDialog() :
|
||||
QDialog(Application::getInstance()->getWindow()) {
|
||||
PreferencesDialog::PreferencesDialog(QWidget* parent) :
|
||||
QDialog(parent) {
|
||||
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ class PreferencesDialog : public QDialog {
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PreferencesDialog();
|
||||
PreferencesDialog(QWidget* parent = nullptr);
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent* resizeEvent);
|
||||
|
|
Loading…
Reference in a new issue