mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-12-03 15:34:06 +00:00
fix: restore maximize geometry (#1013)
* fix: restore maximize geometry * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
1f362142ab
commit
cd560f85fd
|
@ -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 );
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 )
|
||||
|
|
Loading…
Reference in a new issue