Commit aeb88710 authored by Lasse Holmstedt's avatar Lasse Holmstedt
Browse files

Added menu entries for hiding and showing left/right bauhaus sidebars

parent 73f1a307
......@@ -156,7 +156,10 @@ DesignModeWidget::DesignModeWidget(QWidget *parent) :
connect(m_hideSidebarsAction, SIGNAL(triggered()), this, SLOT(toggleSidebars()));
m_restoreDefaultViewAction = new QAction(tr("&Restore Default View"), this);
connect(m_restoreDefaultViewAction, SIGNAL(triggered()), SLOT(restoreDefaultView()));
m_toggleLeftSidebarAction = new QAction(tr("Toggle &Left Sidebar"), this);
connect(m_toggleLeftSidebarAction, SIGNAL(triggered()), SLOT(toggleLeftSidebar()));
m_toggleRightSidebarAction = new QAction(tr("Toggle &Right Sidebar"), this);
connect(m_toggleRightSidebarAction, SIGNAL(triggered()), SLOT(toggleRightSidebar()));
Core::ModeManager *modeManager = Core::ModeManager::instance();
Core::IMode *designmode = modeManager->mode(Core::Constants::MODE_DESIGN);
......@@ -179,6 +182,18 @@ void DesignModeWidget::restoreDefaultView()
m_rightSideBar->show();
}
void DesignModeWidget::toggleLeftSidebar()
{
if (m_leftSideBar)
m_leftSideBar->setVisible(!m_leftSideBar->isVisible());
}
void DesignModeWidget::toggleRightSidebar()
{
if (m_rightSideBar)
m_rightSideBar->setVisible(!m_rightSideBar->isVisible());
}
void DesignModeWidget::toggleSidebars()
{
if (m_initStatus == Initializing)
......@@ -312,6 +327,17 @@ QAction *DesignModeWidget::hideSidebarsAction() const
return m_hideSidebarsAction;
}
QAction *DesignModeWidget::toggleLeftSidebarAction() const
{
return m_toggleLeftSidebarAction;
}
QAction *DesignModeWidget::toggleRightSidebarAction() const
{
return m_toggleRightSidebarAction;
}
QAction *DesignModeWidget::restoreDefaultViewAction() const
{
return m_restoreDefaultViewAction;
......
......@@ -116,6 +116,8 @@ public:
QAction *pasteAction() const;
QAction *selectAllAction() const;
QAction *hideSidebarsAction() const;
QAction *toggleLeftSidebarAction() const;
QAction *toggleRightSidebarAction() const;
QAction *restoreDefaultViewAction() const;
void readSettings();
......@@ -134,6 +136,8 @@ private slots:
void selectAll();
void closeCurrentEditor();
void toggleSidebars();
void toggleLeftSidebar();
void toggleRightSidebar();
void restoreDefaultView();
void undoAvailable(bool isAvailable);
void redoAvailable(bool isAvailable);
......@@ -165,6 +169,8 @@ private:
QAction *m_selectAllAction;
QAction *m_hideSidebarsAction;
QAction *m_restoreDefaultViewAction;
QAction *m_toggleLeftSidebarAction;
QAction *m_toggleRightSidebarAction;
QWeakPointer<ItemLibrary> m_itemLibrary;
QWeakPointer<NavigatorView> m_navigator;
......
......@@ -45,6 +45,8 @@ const char * const C_QT_QUICK_TOOLS_MENU = "QmlDesigner::ToolsMenu";
// actions
const char * const SWITCH_TEXT_DESIGN = "QmlDesigner.SwitchTextDesign";
const char * const RESTORE_DEFAULT_VIEW = "QmlDesigner.RestoreDefaultView";
const char * const TOGGLE_LEFT_SIDEBAR = "QmlDesigner.ToggleLeftSideBar";
const char * const TOGGLE_RIGHT_SIDEBAR = "QmlDesigner.ToggleRightSideBar";
// mode
const char * const DESIGN_MODE_NAME = "Design";
......
......@@ -224,15 +224,26 @@ void BauhausPlugin::createDesignModeWidget()
editMenu->addAction(command, Core::Constants::G_EDIT_SELECTALL);
Core::UniqueIDManager *uuidManager = Core::UniqueIDManager::instance();
Core::ActionContainer *viewsMenu = actionManager->actionContainer(Core::Constants::M_WINDOW_VIEWS);
command = actionManager->registerAction(m_mainWidget->hideSidebarsAction(),
Core::Constants::TOGGLE_SIDEBAR,
QList<int> () << uuidManager->uniqueIdentifier(Constants::C_FORMEDITOR));
command->setAttribute(Core::Command::CA_Hide);
viewsMenu->addAction(command);
Core::ActionContainer *viewsMenu = actionManager->actionContainer(Core::Constants::M_WINDOW_VIEWS);
command = actionManager->registerAction(m_mainWidget->restoreDefaultViewAction(),
Constants::RESTORE_DEFAULT_VIEW,
command = actionManager->registerAction(m_mainWidget->toggleLeftSidebarAction(),
Constants::TOGGLE_LEFT_SIDEBAR,
QList<int> () << uuidManager->uniqueIdentifier(Constants::C_FORMEDITOR));
command->setAttribute(Core::Command::CA_Hide);
command->setDefaultKeySequence(QKeySequence("Ctrl+Alt+0"));
viewsMenu->addAction(command);
command = actionManager->registerAction(m_mainWidget->toggleRightSidebarAction(),
Constants::TOGGLE_RIGHT_SIDEBAR,
QList<int> () << uuidManager->uniqueIdentifier(Constants::C_FORMEDITOR));
command->setAttribute(Core::Command::CA_Hide);
command->setDefaultKeySequence(QKeySequence("Ctrl+Alt+Shift+0"));
viewsMenu->addAction(command);
#ifdef Q_OS_MACX
......
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