Merge pull request #1003 from openscad/configure-window-reorder

Add option to disable window reordering by removing the dock window title bar
master
Marius Kintel 2014-11-05 21:28:13 +04:00
commit 92389b8589
5 changed files with 54 additions and 6 deletions

View File

@ -67,6 +67,9 @@ public:
QAction *actionRecentFile[UIUtils::maxRecentFiles];
QMap<QString, QString> 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<MainWindow*> *windows;
char const * afterCompileSlot;

View File

@ -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());
}

View File

@ -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;

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>852</width>
<height>550</height>
<height>554</height>
</rect>
</property>
<property name="sizePolicy">
@ -27,7 +27,7 @@
<item>
<widget class="QStackedWidget" name="stackedWidget">
<property name="currentIndex">
<number>3</number>
<number>4</number>
</property>
<widget class="QWidget" name="page3DView">
<layout class="QVBoxLayout" name="verticalLayout_4">
@ -547,8 +547,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>832</width>
<height>420</height>
<width>100</width>
<height>30</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_10">
@ -685,10 +685,17 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="reorderCheckBox">
<property name="text">
<string>Enable docking of Editor and Console in different places</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="undockCheckBox">
<property name="text">
<string>Enable undocking of Editor and Console</string>
<string>Enable undocking of Editor and Console to separate windows</string>
</property>
</widget>
</item>

View File

@ -172,12 +172,16 @@ settings_valueList(const QString &key, const QList<int> &defaultList = QList<int
bool MainWindow::mdiMode = false;
bool MainWindow::undockMode = false;
bool MainWindow::reorderMode = false;
MainWindow::MainWindow(const QString &filename)
: root_inst("group"), library_info_dialog(NULL), font_list_dialog(NULL), tempFile(NULL), progresswidget(NULL)
{
setupUi(this);
editorDockTitleWidget = new QWidget();
consoleDockTitleWidget = new QWidget();
this->editorDock->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;