Commit c17b540f authored by hjk's avatar hjk

Re-introduce option to toggle FancyMainWindow auto-hiding

This reverts commit 1541fbd2
in parts. The title bars can now always be shown (the same
state as the old "Unlocked" state) or not always be shown
(the previously "new" behavior).

The default is now "Always shown". Hopefully that makes hiding
the titlebars a conscious (usually one-time) activity
that's not forgotten.

Change-Id: Id31fb193b2eb6376000c845d4a61194e2ed33129
Reviewed-by: default avatarLeena Miettinen <riitta-leena.miettinen@digia.com>
Reviewed-by: default avatarEike Ziller <eike.ziller@digia.com>
parent ab34b23e
This diff is collapsed.
......@@ -40,7 +40,7 @@ QT_END_NAMESPACE
namespace Utils {
class FancyMainWindowPrivate;
struct FancyMainWindowPrivate;
class QTCREATOR_UTILS_EXPORT FancyMainWindow : public QMainWindow
{
......@@ -63,27 +63,33 @@ public:
void restoreSettings(const QHash<QString, QVariant> &settings);
// Additional context menu actions
QAction *menuSeparator() const;
QAction *menuSeparator1() const;
QAction *autoHideTitleBarsAction() const;
QAction *menuSeparator2() const;
QAction *resetLayoutAction() const;
// Overwritten to add locked/reset.
void addDockActionsToMenu(QMenu *menu);
QDockWidget *toolBarDockWidget() const;
void setToolBarDockWidget(QDockWidget *dock);
void setDockActionsVisible(bool v);
bool titleBarsAlwaysVisible() const;
signals:
// Emitted by resetLayoutAction(). Connect to a slot
// restoring the default layout.
void resetLayout();
public slots:
void setDockActionsVisible(bool v);
protected:
void hideEvent(QHideEvent *event);
void showEvent(QShowEvent *event);
void contextMenuEvent(QContextMenuEvent *event);
private slots:
void onDockActionTriggered();
private:
void handleVisibilityChanged(bool visible);
......
......@@ -290,10 +290,18 @@ void AnalyzerManagerPrivate::delayedInit()
// Populate Windows->Views menu with standard actions.
Context analyzerContext(C_ANALYZEMODE);
ActionContainer *viewsMenu = Core::ActionManager::actionContainer(Id(M_WINDOW_VIEWS));
Command *cmd = Core::ActionManager::registerAction(m_mainWindow->menuSeparator(),
Command *cmd = Core::ActionManager::registerAction(m_mainWindow->menuSeparator1(),
"Analyzer.Views.Separator1", analyzerContext);
cmd->setAttribute(Command::CA_Hide);
viewsMenu->addAction(cmd, G_DEFAULT_THREE);
cmd = Core::ActionManager::registerAction(m_mainWindow->autoHideTitleBarsAction(),
"Analyzer.Views.AutoHideTitleBars", analyzerContext);
cmd->setAttribute(Command::CA_Hide);
viewsMenu->addAction(cmd, G_DEFAULT_THREE);
cmd = Core::ActionManager::registerAction(m_mainWindow->menuSeparator2(),
"Analyzer.Views.Separator2", analyzerContext);
cmd->setAttribute(Command::CA_Hide);
viewsMenu->addAction(cmd, G_DEFAULT_THREE);
cmd = Core::ActionManager::registerAction(m_mainWindow->resetLayoutAction(),
"Analyzer.Views.ResetSimple", analyzerContext);
cmd->setAttribute(Command::CA_Hide);
......
......@@ -314,8 +314,16 @@ void DebuggerMainWindowPrivate::createViewsMenuItems()
cmd->setAttribute(Command::CA_Hide);
m_viewsMenu->addAction(cmd, Core::Constants::G_DEFAULT_THREE);
cmd = Core::ActionManager::registerAction(q->menuSeparator(),
"Debugger.Views.Separator", debugcontext);
cmd = Core::ActionManager::registerAction(q->menuSeparator1(),
"Debugger.Views.Separator1", debugcontext);
cmd->setAttribute(Command::CA_Hide);
m_viewsMenu->addAction(cmd, Core::Constants::G_DEFAULT_THREE);
cmd = Core::ActionManager::registerAction(q->autoHideTitleBarsAction(),
"Debugger.Views.AutoHideTitleBars", debugcontext);
cmd->setAttribute(Command::CA_Hide);
m_viewsMenu->addAction(cmd, Core::Constants::G_DEFAULT_THREE);
cmd = Core::ActionManager::registerAction(q->menuSeparator2(),
"Debugger.Views.Separator2", debugcontext);
cmd->setAttribute(Command::CA_Hide);
m_viewsMenu->addAction(cmd, Core::Constants::G_DEFAULT_THREE);
}
......@@ -436,6 +444,8 @@ QWidget *DebuggerMainWindow::createContents(IMode *mode)
setDockNestingEnabled(true);
connect(this, SIGNAL(resetLayout()),
d, SLOT(resetDebuggerLayout()));
connect(autoHideTitleBarsAction(), SIGNAL(triggered()),
d, SLOT(updateDockWidgetSettings()));
QBoxLayout *editorHolderLayout = new QVBoxLayout;
editorHolderLayout->setMargin(0);
......
......@@ -2570,6 +2570,7 @@ void DebuggerPluginPrivate::createNewDock(QWidget *widget)
{
QDockWidget *dockWidget =
m_mainWindow->createDockWidget(CppLanguage, widget);
dockWidget->setWindowTitle(widget->windowTitle());
dockWidget->setFeatures(QDockWidget::DockWidgetClosable);
dockWidget->show();
}
......
......@@ -349,8 +349,14 @@ void FormEditorData::setupViewActions()
addDockViewAction(viewMenu, ActionEditorSubWindow, m_contexts,
tr("Action Editor"), "FormEditor.ActionEditor");
// Reset
Command *cmd = addToolAction(m_editorWidget->menuSeparator(), m_contexts, "FormEditor.SeparatorReset", viewMenu);
// Lock/Reset
Command *cmd = addToolAction(m_editorWidget->menuSeparator1(), m_contexts, "FormEditor.SeparatorLock", viewMenu);
cmd->setAttribute(Command::CA_Hide);
cmd = addToolAction(m_editorWidget->autoHideTitleBarsAction(), m_contexts, "FormEditor.Locked", viewMenu);
cmd->setAttribute(Command::CA_Hide);
cmd = addToolAction(m_editorWidget->menuSeparator2(), m_contexts, "FormEditor.SeparatorReset", viewMenu);
cmd->setAttribute(Command::CA_Hide);
cmd = addToolAction(m_editorWidget->resetLayoutAction(), m_contexts, "FormEditor.ResetToDefaultLayout", viewMenu);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment