diff --git a/src/MainWindow.h b/src/MainWindow.h index 7b976f82..4506a3d3 100644 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -67,6 +67,9 @@ public: QAction *actionRecentFile[UIUtils::maxRecentFiles]; QMap knownFileExtensions; + QWidget *editorDockTitleWidget; + QWidget *consoleDockTitleWidget; + QString editortype; bool useScintilla; @@ -81,6 +84,7 @@ private slots: void updateTVal(); void updateMdiMode(bool mdi); void updateUndockMode(bool undockMode); + void updateReorderMode(bool reorderMode); void setFileName(const QString &filename); void setFont(const QString &family, uint size); void setColorScheme(const QString &cs); @@ -235,6 +239,7 @@ private: static void report_func(const class AbstractNode*, void *vp, int mark); static bool mdiMode; static bool undockMode; + static bool reorderMode; static QSet *windows; char const * afterCompileSlot; diff --git a/src/Preferences.cc b/src/Preferences.cc index a48314ea..ac6d3e6e 100644 --- a/src/Preferences.cc +++ b/src/Preferences.cc @@ -103,6 +103,7 @@ Preferences::Preferences(QWidget *parent) : QMainWindow(parent) this->defaultmap["advanced/forceGoldfeather"] = false; this->defaultmap["advanced/mdi"] = true; this->defaultmap["advanced/undockableWindows"] = false; + this->defaultmap["advanced/reorderWindows"] = true; this->defaultmap["launcher/showOnStartup"] = true; // Toolbar @@ -321,6 +322,18 @@ Preferences::on_mdiCheckBox_toggled(bool state) emit updateMdiMode(state); } +void +Preferences::on_reorderCheckBox_toggled(bool state) +{ + if (!state) { + undockCheckBox->setChecked(false); + } + undockCheckBox->setEnabled(state); + QSettings settings; + settings.setValue("advanced/reorderWindows", state); + emit updateReorderMode(state); +} + void Preferences::on_undockCheckBox_toggled(bool state) { @@ -467,7 +480,9 @@ void Preferences::updateGUI() this->opencsgLimitEdit->setText(getValue("advanced/openCSGLimit").toString()); this->forceGoldfeatherBox->setChecked(getValue("advanced/forceGoldfeather").toBool()); this->mdiCheckBox->setChecked(getValue("advanced/mdi").toBool()); + this->reorderCheckBox->setChecked(getValue("advanced/reorderWindows").toBool()); this->undockCheckBox->setChecked(getValue("advanced/undockableWindows").toBool()); + this->undockCheckBox->setEnabled(this->reorderCheckBox->isChecked()); this->launcherBox->setChecked(getValue("launcher/showOnStartup").toBool()); } diff --git a/src/Preferences.h b/src/Preferences.h index 881814e2..bfa7d144 100644 --- a/src/Preferences.h +++ b/src/Preferences.h @@ -33,6 +33,7 @@ public slots: void on_updateCheckBox_toggled(bool); void on_snapshotCheckBox_toggled(bool); void on_mdiCheckBox_toggled(bool); + void on_reorderCheckBox_toggled(bool); void on_undockCheckBox_toggled(bool); void on_checkNowButton_clicked(); void on_launcherBox_toggled(bool); @@ -41,7 +42,8 @@ public slots: signals: void requestRedraw() const; void updateMdiMode(bool mdi) const; - void updateUndockMode(bool mdi) const; + void updateUndockMode(bool undockMode) const; + void updateReorderMode(bool undockMode) const; void fontChanged(const QString &family, uint size) const; void colorSchemeChanged(const QString &scheme) const; void openCSGSettingsChanged() const; diff --git a/src/Preferences.ui b/src/Preferences.ui index 9828bc33..0988b3c4 100644 --- a/src/Preferences.ui +++ b/src/Preferences.ui @@ -7,7 +7,7 @@ 0 0 852 - 550 + 554 @@ -27,7 +27,7 @@ - 3 + 4 @@ -547,8 +547,8 @@ 0 0 - 832 - 420 + 100 + 30 @@ -685,10 +685,17 @@ + + + + Enable docking of Editor and Console in different places + + + - Enable undocking of Editor and Console + Enable undocking of Editor and Console to separate windows diff --git a/src/mainwin.cc b/src/mainwin.cc index 223e7727..715be8cb 100644 --- a/src/mainwin.cc +++ b/src/mainwin.cc @@ -172,12 +172,16 @@ settings_valueList(const QString &key, const QList &defaultList = QListeditorDock->setConfigKey("view/hideEditor"); this->editorDock->setAction(this->viewActionHideEditor); this->consoleDock->setConfigKey("view/hideConsole"); @@ -422,6 +426,7 @@ MainWindow::MainWindow(const QString &filename) connect(Preferences::inst(), SIGNAL(requestRedraw()), this->qglview, SLOT(updateGL())); connect(Preferences::inst(), SIGNAL(updateMdiMode(bool)), this, SLOT(updateMdiMode(bool))); + connect(Preferences::inst(), SIGNAL(updateReorderMode(bool)), this, SLOT(updateReorderMode(bool))); connect(Preferences::inst(), SIGNAL(updateUndockMode(bool)), this, SLOT(updateUndockMode(bool))); connect(Preferences::inst(), SIGNAL(fontChanged(const QString&,uint)), editor, SLOT(initFont(const QString&,uint))); @@ -619,6 +624,7 @@ void MainWindow::loadViewSettings(){ hideToolbars(); updateMdiMode(settings.value("advanced/mdi").toBool()); updateUndockMode(settings.value("advanced/undockableWindows").toBool()); + updateReorderMode(settings.value("advanced/reorderWindows").toBool()); } void MainWindow::loadDesignSettings() @@ -647,11 +653,24 @@ void MainWindow::updateUndockMode(bool undockMode) editorDock->setFeatures(editorDock->features() | QDockWidget::DockWidgetFloatable); consoleDock->setFeatures(consoleDock->features() | QDockWidget::DockWidgetFloatable); } else { + if (editorDock->isFloating()) { + editorDock->setFloating(false); + } editorDock->setFeatures(editorDock->features() & ~QDockWidget::DockWidgetFloatable); + if (consoleDock->isFloating()) { + consoleDock->setFloating(false); + } consoleDock->setFeatures(consoleDock->features() & ~QDockWidget::DockWidgetFloatable); } } +void MainWindow::updateReorderMode(bool reorderMode) +{ + MainWindow::reorderMode = reorderMode; + editorDock->setTitleBarWidget(reorderMode ? 0 : editorDockTitleWidget); + consoleDock->setTitleBarWidget(reorderMode ? 0 : consoleDockTitleWidget); +} + MainWindow::~MainWindow() { if (root_module) delete root_module;