diff --git a/src/config.cc b/src/config.cc index 6843b5d6..5e411a13 100644 --- a/src/config.cc +++ b/src/config.cc @@ -1107,6 +1107,11 @@ Class load() if ( !mainWindowGeometry.isNull() ) c.mainWindowGeometry = QByteArray::fromBase64( mainWindowGeometry.toElement().text().toLatin1() ); + QDomNode mainWindowMaximized = root.namedItem( "mainWindowMaximized" ); + + if ( !mainWindowMaximized.isNull() ) + c.mainWindowMaximized = ( mainWindowMaximized.toElement().text() == "1" ); + QDomNode dictInfoGeometry = root.namedItem( "dictInfoGeometry" ); if ( !dictInfoGeometry.isNull() ) @@ -2095,6 +2100,10 @@ void save( Class const & c ) opt.appendChild( dd.createTextNode( QString::fromLatin1( c.mainWindowGeometry.toBase64() ) ) ); root.appendChild( opt ); + opt = dd.createElement( "mainWindowMaximized" ); + opt.appendChild( dd.createTextNode( c.mainWindowMaximized ? "1" : "0" ) ); + root.appendChild( opt ); + opt = dd.createElement( "dictInfoGeometry" ); opt.appendChild( dd.createTextNode( QString::fromLatin1( c.dictInfoGeometry.toBase64() ) ) ); root.appendChild( opt ); diff --git a/src/config.hh b/src/config.hh index 7680e50c..fcc365aa 100644 --- a/src/config.hh +++ b/src/config.hh @@ -866,6 +866,7 @@ struct Class QByteArray mainWindowState; // Binary state saved by QMainWindow QByteArray mainWindowGeometry; // Geometry saved by QMainWindow + bool mainWindowMaximized = false; MutedDictionaries mutedDictionaries; // Disabled via dictionary bar MutedDictionaries popupMutedDictionaries; // Disabled via dictionary bar in popup diff --git a/src/ui/mainwindow.cc b/src/ui/mainwindow.cc index 40a8690e..ec87c785 100644 --- a/src/ui/mainwindow.cc +++ b/src/ui/mainwindow.cc @@ -746,6 +746,10 @@ MainWindow::MainWindow( Config::Class & cfg_ ): if ( cfg.mainWindowGeometry.size() ) restoreGeometry( cfg.mainWindowGeometry ); + if ( cfg.mainWindowMaximized ) { + showMaximized(); + } + #if defined( Q_OS_LINUX ) #if ( QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 ) ) defaultInterfaceStyle = QApplication::style()->name(); @@ -1214,6 +1218,7 @@ void MainWindow::commitData() // Save MainWindow state and geometry cfg.mainWindowState = saveState(); cfg.mainWindowGeometry = saveGeometry(); + cfg.mainWindowMaximized = isMaximized(); // Save popup window state and geometry if ( scanPopup )