mirror of
https://github.com/clementine-player/Clementine
synced 2024-12-15 18:58:55 +01:00
Remember maximized state between calls to hide() and show() on window managers that don't do it for us. Fixes issue #215
This commit is contained in:
parent
b418141aa0
commit
56bb697d06
@ -101,7 +101,8 @@ MainWindow::MainWindow(QNetworkAccessManager* network, Engine::Type engine, QWid
|
||||
equalizer_(new Equalizer),
|
||||
playlist_menu_(new QMenu(this)),
|
||||
library_sort_model_(new QSortFilterProxyModel(this)),
|
||||
track_position_timer_(new QTimer(this))
|
||||
track_position_timer_(new QTimer(this)),
|
||||
was_maximized_(false)
|
||||
{
|
||||
ui_.setupUi(this);
|
||||
#ifndef Q_OS_DARWIN
|
||||
@ -625,7 +626,16 @@ void MainWindow::closeEvent(QCloseEvent* event) {
|
||||
|
||||
void MainWindow::SetHiddenInTray(bool hidden) {
|
||||
settings_.setValue("hidden", hidden);
|
||||
setVisible(!hidden);
|
||||
|
||||
if (hidden) {
|
||||
was_maximized_ = isMaximized();
|
||||
hide();
|
||||
} else {
|
||||
if (was_maximized_)
|
||||
showMaximized();
|
||||
else
|
||||
show();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::ClearLibraryFilter() {
|
||||
|
@ -168,6 +168,8 @@ class MainWindow : public QMainWindow {
|
||||
|
||||
QTimer* track_position_timer_;
|
||||
QSettings settings_;
|
||||
|
||||
bool was_maximized_;
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
||||
|
Loading…
Reference in New Issue
Block a user