mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-24 04:24:09 +00:00
Save popup window configuration without it destroying
This commit is contained in:
parent
2ff7e4e6d0
commit
d65a1f7869
|
@ -1022,10 +1022,10 @@ void MainWindow::addGlobalActionsToDialog( QDialog * dialog )
|
|||
|
||||
void MainWindow::commitData( QSessionManager & )
|
||||
{
|
||||
commitData( true );
|
||||
commitData();
|
||||
}
|
||||
|
||||
void MainWindow::commitData( bool init_popup )
|
||||
void MainWindow::commitData()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -1033,9 +1033,10 @@ void MainWindow::commitData( bool init_popup )
|
|||
cfg.mainWindowState = saveState( 1 );
|
||||
cfg.mainWindowGeometry = saveGeometry();
|
||||
|
||||
// Close the popup, so it would save its geometry to config
|
||||
// Save popup window state and geometry
|
||||
|
||||
scanPopup.reset();
|
||||
if( scanPopup.get() )
|
||||
scanPopup->saveConfigData();
|
||||
|
||||
// Save any changes in last chosen groups etc
|
||||
try
|
||||
|
@ -1052,10 +1053,6 @@ void MainWindow::commitData( bool init_popup )
|
|||
|
||||
// Save favorites
|
||||
ui.favoritesPaneWidget->saveData();
|
||||
|
||||
// Reinit popup window if necessary (when called from session manager)
|
||||
if( init_popup )
|
||||
makeScanPopup();
|
||||
}
|
||||
catch( std::exception & e )
|
||||
{
|
||||
|
@ -1187,7 +1184,7 @@ void MainWindow::closeEvent( QCloseEvent * ev )
|
|||
|
||||
void MainWindow::quitApp()
|
||||
{
|
||||
commitData( false );
|
||||
commitData();
|
||||
qApp->quit();
|
||||
}
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ private:
|
|||
void addGlobalAction( QAction * action, const char * slot );
|
||||
void addGlobalActionsToDialog( QDialog * dialog );
|
||||
|
||||
void commitData( bool init_popup );
|
||||
void commitData();
|
||||
|
||||
QSystemTrayIcon * trayIcon;
|
||||
|
||||
|
|
15
scanpopup.cc
15
scanpopup.cc
|
@ -310,11 +310,7 @@ ScanPopup::ScanPopup( QWidget * parent,
|
|||
|
||||
ScanPopup::~ScanPopup()
|
||||
{
|
||||
// Save state, geometry and pin status
|
||||
cfg.popupWindowState = saveState( 1 );
|
||||
cfg.popupWindowGeometry = saveGeometry();
|
||||
cfg.pinPopupWindow = ui.pinButton->isChecked();
|
||||
cfg.popupWindowAlwaysOnTop = ui.onTopButton->isChecked();
|
||||
saveConfigData();
|
||||
|
||||
disableScanning();
|
||||
|
||||
|
@ -324,6 +320,15 @@ ScanPopup::~ScanPopup()
|
|||
#endif
|
||||
}
|
||||
|
||||
void ScanPopup::saveConfigData()
|
||||
{
|
||||
// Save state, geometry and pin status
|
||||
cfg.popupWindowState = saveState( 1 );
|
||||
cfg.popupWindowGeometry = saveGeometry();
|
||||
cfg.pinPopupWindow = ui.pinButton->isChecked();
|
||||
cfg.popupWindowAlwaysOnTop = ui.onTopButton->isChecked();
|
||||
}
|
||||
|
||||
void ScanPopup::enableScanning()
|
||||
{
|
||||
if ( !isScanningEnabled )
|
||||
|
|
|
@ -52,6 +52,8 @@ public:
|
|||
|
||||
void setDictionaryIconSize();
|
||||
|
||||
void saveConfigData();
|
||||
|
||||
signals:
|
||||
|
||||
/// Forwarded from the dictionary bar, so that main window could act on this.
|
||||
|
|
Loading…
Reference in a new issue