Store pre-maximised state, so that when size is restored after starting
maximised it is restored to the correct size.
This commit is contained in:
committed by
Craig Drummond
parent
ad7ba2332e
commit
15923cb9ab
@@ -542,14 +542,17 @@ void MainWindow::init()
|
||||
} else {
|
||||
if (expandInterfaceAction->isChecked()) {
|
||||
if (!expandedSize.isEmpty()) {
|
||||
if (expandedSize.width()>1) {
|
||||
if (!Settings::self()->maximized() && expandedSize.width()>1) {
|
||||
resize(expandedSize);
|
||||
expandOrCollapse(false);
|
||||
} else {
|
||||
// Issue #1137 Under Windows, Cantata does not restore maximixed correctly if context is in sidebar
|
||||
resize(defaultSize);
|
||||
resize(expandedSize.width()>1 ? expandedSize : defaultSize);
|
||||
// Issue #1137 Under Windows, Cantata does not restore maximized correctly if context is in sidebar
|
||||
// ...so, set maximized after shown
|
||||
QTimer::singleShot(0, this, SLOT(showMaximized()));
|
||||
expandedSize=defaultSize;
|
||||
if (expandedSize.width()<=1) {
|
||||
expandedSize=defaultSize;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -863,8 +866,10 @@ MainWindow::~MainWindow()
|
||||
Settings::self()->saveShowFullScreen(fullScreenAction->isChecked());
|
||||
if (!fullScreenAction->isChecked()) {
|
||||
if (expandInterfaceAction->isChecked()) {
|
||||
Settings::self()->saveMainWindowSize(isMaximized() ? QSize(1, 1) : size());
|
||||
Settings::self()->saveMaximized(isMaximized());
|
||||
Settings::self()->saveMainWindowSize(isMaximized() ? previousSize : size());
|
||||
} else {
|
||||
Settings::self()->saveMaximized(false);
|
||||
Settings::self()->saveMainWindowSize(expandedSize);
|
||||
}
|
||||
Settings::self()->saveMainWindowCollapsedSize(expandInterfaceAction->isChecked() ? collapsedSize : size());
|
||||
@@ -1048,6 +1053,12 @@ void MainWindow::closeEvent(QCloseEvent *event)
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
previousSize=event->oldSize();
|
||||
QMainWindow::resizeEvent(event);
|
||||
}
|
||||
|
||||
void MainWindow::playQueueItemsSelected(bool s)
|
||||
{
|
||||
int rc=playQueue->model() ? playQueue->model()->rowCount() : 0;
|
||||
|
||||
@@ -120,6 +120,7 @@ protected:
|
||||
void showEvent(QShowEvent *event);
|
||||
#endif
|
||||
void closeEvent(QCloseEvent *event);
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
|
||||
private:
|
||||
#ifdef Q_OS_MAC
|
||||
@@ -319,6 +320,7 @@ private:
|
||||
QPoint lastPos;
|
||||
QSize expandedSize;
|
||||
QSize collapsedSize;
|
||||
QSize previousSize;
|
||||
Song current;
|
||||
Page *currentPage;
|
||||
Action *showPlayQueueAction;
|
||||
|
||||
@@ -246,6 +246,11 @@ QSize Settings::mainWindowCollapsedSize()
|
||||
return cfg.get("mainWindowCollapsedSize", QSize());
|
||||
}
|
||||
|
||||
bool Settings::maximized()
|
||||
{
|
||||
return cfg.get("maximized", false);
|
||||
}
|
||||
|
||||
bool Settings::useSystemTray()
|
||||
{
|
||||
return cfg.get("useSystemTray", false);
|
||||
@@ -740,6 +745,11 @@ void Settings::saveMainWindowSize(const QSize &v)
|
||||
cfg.set("mainWindowSize", v);
|
||||
}
|
||||
|
||||
void Settings::saveMaximized(bool v)
|
||||
{
|
||||
cfg.set("maximized", v);
|
||||
}
|
||||
|
||||
void Settings::saveMainWindowCollapsedSize(const QSize &v)
|
||||
{
|
||||
if (v.width()>16 && v.height()>16) {
|
||||
|
||||
@@ -54,6 +54,7 @@ public:
|
||||
bool splitterAutoHide();
|
||||
QSize mainWindowSize();
|
||||
QSize mainWindowCollapsedSize();
|
||||
bool maximized();
|
||||
bool useSystemTray();
|
||||
bool minimiseOnClose();
|
||||
bool showPopups();
|
||||
@@ -154,6 +155,7 @@ public:
|
||||
void saveSplitterAutoHide(bool v);
|
||||
void saveMainWindowSize(const QSize &v);
|
||||
void saveMainWindowCollapsedSize(const QSize &v);
|
||||
void saveMaximized(bool v);
|
||||
void saveUseSystemTray(bool v);
|
||||
void saveMinimiseOnClose(bool v);
|
||||
void saveShowPopups(bool v);
|
||||
|
||||
Reference in New Issue
Block a user