Commit 6cbf5205 authored by Lasse Holmstedt's avatar Lasse Holmstedt
Browse files

Added functionality to hide all sidebars in bauhaus

Alt+0 does this now, the command is overridden.

Reviewed-by: kkoehne
parent e112c6a9
......@@ -39,7 +39,7 @@ namespace Internal {
DesignModeContext::DesignModeContext(DesignModeWidget *widget) : IContext(widget),
m_widget(widget)
{
Core::UniqueIDManager *uuidManager =Core::UniqueIDManager::instance();
Core::UniqueIDManager *uuidManager = Core::UniqueIDManager::instance();
m_context << uuidManager->uniqueIdentifier(Constants::C_FORMEDITOR)
<< uuidManager->uniqueIdentifier(Constants::C_QT_QUICK_TOOLS_MENU);
}
......
......@@ -133,6 +133,8 @@ DesignModeWidget::DesignModeWidget(QWidget *parent) :
m_mainSplitter(0),
m_leftSideBar(0),
m_rightSideBar(0),
m_isDisabled(false),
m_showSidebars(true),
m_initStatus(NotInitialized),
m_warningWidget(0)
{
......@@ -150,6 +152,8 @@ DesignModeWidget::DesignModeWidget(QWidget *parent) :
connect(m_pasteAction, SIGNAL(triggered()), this, SLOT(paste()));
m_selectAllAction = new Utils::ParameterAction(tr("Select &All"), tr("Select All \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
connect(m_selectAllAction, SIGNAL(triggered()), this, SLOT(selectAll()));
m_hideSidebarsAction = new QAction(tr("Toggle Full Screen"), this);
connect(m_hideSidebarsAction, SIGNAL(triggered()), this, SLOT(toggleSidebars()));
Core::ModeManager *modeManager = Core::ModeManager::instance();
Core::IMode *designmode = modeManager->mode(Core::Constants::MODE_DESIGN);
......@@ -159,7 +163,23 @@ DesignModeWidget::DesignModeWidget(QWidget *parent) :
DesignModeWidget::~DesignModeWidget()
{
};
}
void DesignModeWidget::toggleSidebars()
{
if (m_initStatus == Initializing)
return;
m_showSidebars = !m_showSidebars;
if (m_leftSideBar)
m_leftSideBar->setVisible(m_showSidebars);
if (m_rightSideBar)
m_rightSideBar->setVisible(m_showSidebars);
if (!m_statesEditorWidget.isNull())
m_statesEditorWidget->setVisible(m_showSidebars);
}
void DesignModeWidget::showEditor(Core::IEditor *editor)
{
......@@ -273,6 +293,11 @@ QAction *DesignModeWidget::selectAllAction() const
return m_selectAllAction;
}
QAction *DesignModeWidget::hideSidebarsAction() const
{
return m_hideSidebarsAction;
}
void DesignModeWidget::readSettings()
{
QSettings *settings = Core::ICore::instance()->settings();
......
......@@ -114,6 +114,7 @@ public:
QAction *copyAction() const;
QAction *pasteAction() const;
QAction *selectAllAction() const;
QAction *hideSidebarsAction() const;
void readSettings();
void saveSettings();
......@@ -130,7 +131,7 @@ private slots:
void paste();
void selectAll();
void closeCurrentEditor();
void toggleSidebars();
void undoAvailable(bool isAvailable);
void redoAvailable(bool isAvailable);
......@@ -157,6 +158,7 @@ private:
QAction *m_copyAction;
QAction *m_pasteAction;
QAction *m_selectAllAction;
QAction *m_hideSidebarsAction;
QWeakPointer<ItemLibrary> m_itemLibrary;
QWeakPointer<NavigatorView> m_navigator;
......@@ -180,6 +182,7 @@ private:
Core::MiniSplitter *m_outputPlaceholderSplitter;
bool m_isDisabled;
bool m_showSidebars;
enum InitializeStatus { NotInitialized, Initializing, Initialized };
InitializeStatus m_initStatus;
......
......@@ -223,6 +223,12 @@ void BauhausPlugin::createDesignModeWidget()
command->setDefaultKeySequence(QKeySequence::SelectAll);
editMenu->addAction(command, Core::Constants::G_EDIT_SELECTALL);
Core::UniqueIDManager *uuidManager = Core::UniqueIDManager::instance();
actionManager->command(Core::Constants::TOGGLE_SIDEBAR);
command = actionManager->registerAction(m_mainWidget->hideSidebarsAction(),
Core::Constants::TOGGLE_SIDEBAR,
QList<int> () << uuidManager->uniqueIdentifier(Constants::C_FORMEDITOR));
#ifdef Q_OS_MACX
// add second shortcut to trigger delete
QAction *deleteAction = new QAction(m_mainWidget);
......
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