forked from qt-creator/qt-creator
Unmaximizing output pane should restore previous size.
It was resetting to the default instead. Task-number: QTCREATORBUG-4849 Change-Id: Ibe3acf7045dd051cca3bff94888b155e00fec81b Reviewed-on: http://codereview.qt.nokia.com/954 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
This commit is contained in:
@@ -48,12 +48,12 @@ struct OutputPanePlaceHolderPrivate {
|
|||||||
|
|
||||||
Core::IMode *m_mode;
|
Core::IMode *m_mode;
|
||||||
QSplitter *m_splitter;
|
QSplitter *m_splitter;
|
||||||
bool m_closeable;
|
int m_lastNonMaxSize;
|
||||||
static OutputPanePlaceHolder* m_current;
|
static OutputPanePlaceHolder* m_current;
|
||||||
};
|
};
|
||||||
|
|
||||||
OutputPanePlaceHolderPrivate::OutputPanePlaceHolderPrivate(Core::IMode *mode, QSplitter *parent) :
|
OutputPanePlaceHolderPrivate::OutputPanePlaceHolderPrivate(Core::IMode *mode, QSplitter *parent) :
|
||||||
m_mode(mode), m_splitter(parent), m_closeable(true)
|
m_mode(mode), m_splitter(parent), m_lastNonMaxSize(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,16 +85,6 @@ OutputPanePlaceHolder::~OutputPanePlaceHolder()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutputPanePlaceHolder::setCloseable(bool b)
|
|
||||||
{
|
|
||||||
d->m_closeable = b;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool OutputPanePlaceHolder::closeable()
|
|
||||||
{
|
|
||||||
return d->m_closeable;
|
|
||||||
}
|
|
||||||
|
|
||||||
void OutputPanePlaceHolder::currentModeChanged(Core::IMode *mode)
|
void OutputPanePlaceHolder::currentModeChanged(Core::IMode *mode)
|
||||||
{
|
{
|
||||||
if (d->m_current == this) {
|
if (d->m_current == this) {
|
||||||
@@ -110,7 +100,6 @@ void OutputPanePlaceHolder::currentModeChanged(Core::IMode *mode)
|
|||||||
layout()->addWidget(om);
|
layout()->addWidget(om);
|
||||||
om->show();
|
om->show();
|
||||||
om->updateStatusButtons(isVisible());
|
om->updateStatusButtons(isVisible());
|
||||||
om->setCloseable(d->m_closeable);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,6 +114,7 @@ void OutputPanePlaceHolder::maximizeOrMinimize(bool maximize)
|
|||||||
QList<int> sizes = d->m_splitter->sizes();
|
QList<int> sizes = d->m_splitter->sizes();
|
||||||
|
|
||||||
if (maximize) {
|
if (maximize) {
|
||||||
|
d->m_lastNonMaxSize = sizes[idx];
|
||||||
int sum = 0;
|
int sum = 0;
|
||||||
foreach(int s, sizes)
|
foreach(int s, sizes)
|
||||||
sum += s;
|
sum += s;
|
||||||
@@ -133,7 +123,7 @@ void OutputPanePlaceHolder::maximizeOrMinimize(bool maximize)
|
|||||||
}
|
}
|
||||||
sizes[idx] = sum - (sizes.count()-1) * 32;
|
sizes[idx] = sum - (sizes.count()-1) * 32;
|
||||||
} else {
|
} else {
|
||||||
int target = sizeHint().height();
|
int target = d->m_lastNonMaxSize > 0 ? d->m_lastNonMaxSize : sizeHint().height();
|
||||||
int space = sizes[idx] - target;
|
int space = sizes[idx] - target;
|
||||||
if (space > 0) {
|
if (space > 0) {
|
||||||
for (int i = 0; i < sizes.count(); ++i) {
|
for (int i = 0; i < sizes.count(); ++i) {
|
||||||
|
@@ -60,8 +60,6 @@ public:
|
|||||||
explicit OutputPanePlaceHolder(Core::IMode *mode, QSplitter *parent = 0);
|
explicit OutputPanePlaceHolder(Core::IMode *mode, QSplitter *parent = 0);
|
||||||
~OutputPanePlaceHolder();
|
~OutputPanePlaceHolder();
|
||||||
|
|
||||||
void setCloseable(bool b);
|
|
||||||
bool closeable();
|
|
||||||
static OutputPanePlaceHolder *getCurrent();
|
static OutputPanePlaceHolder *getCurrent();
|
||||||
static bool isCurrentVisible();
|
static bool isCurrentVisible();
|
||||||
|
|
||||||
|
@@ -349,8 +349,7 @@ void OutputPaneManager::buttonTriggered()
|
|||||||
int idx = it.key();
|
int idx = it.key();
|
||||||
|
|
||||||
if (m_widgetComboBox->itemData(m_widgetComboBox->currentIndex()).toInt() == idx &&
|
if (m_widgetComboBox->itemData(m_widgetComboBox->currentIndex()).toInt() == idx &&
|
||||||
OutputPanePlaceHolder::isCurrentVisible()
|
OutputPanePlaceHolder::isCurrentVisible()) {
|
||||||
&& OutputPanePlaceHolder::getCurrent()->closeable()) {
|
|
||||||
// we should toggle and the page is already visible and we are actually closeable
|
// we should toggle and the page is already visible and we are actually closeable
|
||||||
slotHide();
|
slotHide();
|
||||||
} else {
|
} else {
|
||||||
@@ -464,16 +463,6 @@ void OutputPaneManager::togglePage(bool focus)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutputPaneManager::setCloseable(bool b)
|
|
||||||
{
|
|
||||||
m_closeButton->setVisible(b);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool OutputPaneManager::closeable()
|
|
||||||
{
|
|
||||||
return m_closeButton->isVisibleTo(m_closeButton->parentWidget());
|
|
||||||
}
|
|
||||||
|
|
||||||
void OutputPaneManager::focusInEvent(QFocusEvent *e)
|
void OutputPaneManager::focusInEvent(QFocusEvent *e)
|
||||||
{
|
{
|
||||||
if (m_outputWidgetPane->currentWidget())
|
if (m_outputWidgetPane->currentWidget())
|
||||||
|
@@ -62,8 +62,6 @@ class OutputPaneManager : public QWidget
|
|||||||
public:
|
public:
|
||||||
void init();
|
void init();
|
||||||
static OutputPaneManager *instance();
|
static OutputPaneManager *instance();
|
||||||
void setCloseable(bool b);
|
|
||||||
bool closeable();
|
|
||||||
QWidget *buttonsWidget();
|
QWidget *buttonsWidget();
|
||||||
void updateStatusButtons(bool visible);
|
void updateStatusButtons(bool visible);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user