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