mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-24 00:14:06 +00:00
Revert "opt: remove wasMaximized logic of mainwindow" (#1664)
* Revert "opt: remove wasMaximized logic of mainwindow"
This reverts commit 99c221c854
.
* [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
93ca284bad
commit
0c4483ae02
|
@ -165,6 +165,7 @@ MainWindow::MainWindow( Config::Class & cfg_ ):
|
||||||
audioPlayerFactory( cfg.preferences ),
|
audioPlayerFactory( cfg.preferences ),
|
||||||
wordFinder( this ),
|
wordFinder( this ),
|
||||||
wordListSelChanged( false ),
|
wordListSelChanged( false ),
|
||||||
|
wasMaximized( false ),
|
||||||
headwordsDlg( nullptr ),
|
headwordsDlg( nullptr ),
|
||||||
ftsIndexing( dictionaries ),
|
ftsIndexing( dictionaries ),
|
||||||
ftsDlg( nullptr ),
|
ftsDlg( nullptr ),
|
||||||
|
@ -871,6 +872,8 @@ MainWindow::MainWindow( Config::Class & cfg_ ):
|
||||||
mainStatusBar->showMessage( tr( "Accessibility API is not enabled" ), 10000, QPixmap( ":/icons/error.svg" ) );
|
mainStatusBar->showMessage( tr( "Accessibility API is not enabled" ), 10000, QPixmap( ":/icons/error.svg" ) );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
wasMaximized = isMaximized();
|
||||||
|
|
||||||
history.setSaveInterval( cfg.preferences.historyStoreInterval );
|
history.setSaveInterval( cfg.preferences.historyStoreInterval );
|
||||||
#ifndef Q_OS_MACOS
|
#ifndef Q_OS_MACOS
|
||||||
ui.centralWidget->grabGesture( Gestures::GDPinchGestureType );
|
ui.centralWidget->grabGesture( Gestures::GDPinchGestureType );
|
||||||
|
@ -2494,6 +2497,11 @@ bool MainWindow::eventFilter( QObject * obj, QEvent * ev )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( obj == this && ev->type() == QEvent::WindowStateChange ) {
|
||||||
|
auto stev = dynamic_cast< QWindowStateChangeEvent * >( ev );
|
||||||
|
wasMaximized = ( stev->oldState() == Qt::WindowMaximized && isMinimized() );
|
||||||
|
}
|
||||||
|
|
||||||
if ( ev->type() == QEvent::MouseButtonPress ) {
|
if ( ev->type() == QEvent::MouseButtonPress ) {
|
||||||
auto event = dynamic_cast< QMouseEvent * >( ev );
|
auto event = dynamic_cast< QMouseEvent * >( ev );
|
||||||
|
|
||||||
|
@ -2751,6 +2759,15 @@ void MainWindow::toggleMainWindow( bool onlyShow )
|
||||||
raise();
|
raise();
|
||||||
shown = true;
|
shown = true;
|
||||||
}
|
}
|
||||||
|
else if ( isMinimized() ) {
|
||||||
|
if ( wasMaximized )
|
||||||
|
showMaximized();
|
||||||
|
else
|
||||||
|
showNormal();
|
||||||
|
activateWindow();
|
||||||
|
raise();
|
||||||
|
shown = true;
|
||||||
|
}
|
||||||
else if ( !isActiveWindow() ) {
|
else if ( !isActiveWindow() ) {
|
||||||
activateWindow();
|
activateWindow();
|
||||||
if ( cfg.preferences.raiseWindowOnSearch ) {
|
if ( cfg.preferences.raiseWindowOnSearch ) {
|
||||||
|
|
|
@ -158,6 +158,8 @@ private:
|
||||||
|
|
||||||
bool wordListSelChanged;
|
bool wordListSelChanged;
|
||||||
|
|
||||||
|
bool wasMaximized; // Window state before minimization
|
||||||
|
|
||||||
QPrinter & getPrinter(); // Creates a printer if it's not there and returns it
|
QPrinter & getPrinter(); // Creates a printer if it's not there and returns it
|
||||||
|
|
||||||
DictHeadwords * headwordsDlg;
|
DictHeadwords * headwordsDlg;
|
||||||
|
|
Loading…
Reference in a new issue