Commit 30373284 authored by mae's avatar mae
Browse files

unmaximize output panes with Escape (when they lose focus)

parent c09a8e4f
......@@ -843,7 +843,11 @@ void MainWindow::setFocusToEditor()
editor->widget()->setFocus();
bool focusWasAlreadyInEditor = (focusWidget && focusWidget == qApp->focusWidget());
if (focusWasAlreadyInEditor) {
if (!focusWasAlreadyInEditor) {
if (OutputPanePlaceHolder::getCurrent() &&
OutputPanePlaceHolder::getCurrent()->isVisible())
OutputPanePlaceHolder::getCurrent()->unmaximize();
} else {
bool stuffVisible =
(FindToolBarPlaceHolder::getCurrent() &&
FindToolBarPlaceHolder::getCurrent()->isVisible())
......
......@@ -147,6 +147,16 @@ void OutputPanePlaceHolder::maximizeOrMinimize(bool maximize)
}
bool OutputPanePlaceHolder::isMaximized() const
{
return OutputPaneManager::instance()->isMaximized();
}
void OutputPanePlaceHolder::unmaximize()
{
if (OutputPaneManager::instance()->isMaximized())
OutputPaneManager::instance()->slotMinMax();
}
////
// OutputPaneManager
......@@ -405,6 +415,10 @@ void OutputPaneManager::shortcutTriggered()
}
}
bool OutputPaneManager::isMaximized()const
{
return m_minMaxButton->arrowType() == Qt::DownArrow;
}
void OutputPaneManager::slotMinMax()
{
......
......@@ -66,12 +66,15 @@ public:
void setCloseable(bool b);
bool closeable();
static OutputPanePlaceHolder *getCurrent() { return m_current; }
inline bool canMaximizeOrMinimize() const { return m_splitter != 0; }
void maximizeOrMinimize(bool maximize);
void unmaximize();
bool isMaximized() const;
private slots:
void currentModeChanged(Core::IMode *);
private:
inline bool canMaximizeOrMinimize() const { return m_splitter != 0; }
void maximizeOrMinimize(bool maximize);
Core::IMode *m_mode;
QSplitter *m_splitter;
bool m_closeable;
......@@ -92,6 +95,8 @@ public:
QWidget *buttonsWidget();
void updateStatusButtons(bool visible);
bool isMaximized()const;
public slots:
void slotHide();
void slotNext();
......
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