mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 01:50:06 +00:00 
			
		
		
		
	save alert dock's visibility on exit
This commit is contained in:
		
							parent
							
								
									ef6494f4c3
								
							
						
					
					
						commit
						3ab18392b3
					
				
					 4 changed files with 24 additions and 4 deletions
				
			
		|  | @ -279,7 +279,6 @@ MainWindow::MainWindow(QWidget* parent) : | ||||||
| 
 | 
 | ||||||
|    // Configure Alert Dock
 |    // Configure Alert Dock
 | ||||||
|    p->alertDockWidget_ = new ui::AlertDockWidget(this); |    p->alertDockWidget_ = new ui::AlertDockWidget(this); | ||||||
|    p->alertDockWidget_->setVisible(false); |  | ||||||
|    addDockWidget(Qt::BottomDockWidgetArea, p->alertDockWidget_); |    addDockWidget(Qt::BottomDockWidgetArea, p->alertDockWidget_); | ||||||
| 
 | 
 | ||||||
|    // GPS Info Dialog
 |    // GPS Info Dialog
 | ||||||
|  | @ -294,7 +293,6 @@ MainWindow::MainWindow(QWidget* parent) : | ||||||
|    ui->menuView->insertAction(ui->actionAlerts, |    ui->menuView->insertAction(ui->actionAlerts, | ||||||
|                               p->alertDockWidget_->toggleViewAction()); |                               p->alertDockWidget_->toggleViewAction()); | ||||||
|    p->alertDockWidget_->toggleViewAction()->setText(tr("&Alerts")); |    p->alertDockWidget_->toggleViewAction()->setText(tr("&Alerts")); | ||||||
|    ui->actionAlerts->setVisible(false); |  | ||||||
| 
 | 
 | ||||||
|    ui->menuDebug->menuAction()->setVisible( |    ui->menuDebug->menuAction()->setVisible( | ||||||
|       settings::GeneralSettings::Instance().debug_enabled().GetValue()); |       settings::GeneralSettings::Instance().debug_enabled().GetValue()); | ||||||
|  | @ -803,6 +801,7 @@ void MainWindowImpl::ConfigureUiSettings() | ||||||
|    mapSettingsGroup_->SetExpanded( |    mapSettingsGroup_->SetExpanded( | ||||||
|       uiSettings.map_settings_expanded().GetValue()); |       uiSettings.map_settings_expanded().GetValue()); | ||||||
|    timelineGroup_->SetExpanded(uiSettings.timeline_expanded().GetValue()); |    timelineGroup_->SetExpanded(uiSettings.timeline_expanded().GetValue()); | ||||||
|  |    alertDockWidget_->setVisible(uiSettings.alert_dock_visible().GetValue()); | ||||||
| 
 | 
 | ||||||
|    connect(level2ProductsGroup_, |    connect(level2ProductsGroup_, | ||||||
|            &ui::CollapsibleGroup::StateChanged, |            &ui::CollapsibleGroup::StateChanged, | ||||||
|  |  | ||||||
|  | @ -19,6 +19,7 @@ public: | ||||||
|       level3ProductsExpanded_.SetDefault(true); |       level3ProductsExpanded_.SetDefault(true); | ||||||
|       mapSettingsExpanded_.SetDefault(true); |       mapSettingsExpanded_.SetDefault(true); | ||||||
|       timelineExpanded_.SetDefault(true); |       timelineExpanded_.SetDefault(true); | ||||||
|  |       alertDockVisible_.SetDefault(false); | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|    ~UiSettingsImpl() {} |    ~UiSettingsImpl() {} | ||||||
|  | @ -28,6 +29,7 @@ public: | ||||||
|    SettingsVariable<bool> level3ProductsExpanded_ {"level3_products_expanded"}; |    SettingsVariable<bool> level3ProductsExpanded_ {"level3_products_expanded"}; | ||||||
|    SettingsVariable<bool> mapSettingsExpanded_ {"map_settings_expanded"}; |    SettingsVariable<bool> mapSettingsExpanded_ {"map_settings_expanded"}; | ||||||
|    SettingsVariable<bool> timelineExpanded_ {"timeline_expanded"}; |    SettingsVariable<bool> timelineExpanded_ {"timeline_expanded"}; | ||||||
|  |    SettingsVariable<bool> alertDockVisible_ {"alert_dock_visible"}; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| UiSettings::UiSettings() : | UiSettings::UiSettings() : | ||||||
|  | @ -37,7 +39,8 @@ UiSettings::UiSettings() : | ||||||
|                       &p->level2SettingsExpanded_, |                       &p->level2SettingsExpanded_, | ||||||
|                       &p->level3ProductsExpanded_, |                       &p->level3ProductsExpanded_, | ||||||
|                       &p->mapSettingsExpanded_, |                       &p->mapSettingsExpanded_, | ||||||
|                       &p->timelineExpanded_}); |                       &p->timelineExpanded_, | ||||||
|  |                       &p->alertDockVisible_}); | ||||||
|    SetDefaults(); |    SetDefaults(); | ||||||
| } | } | ||||||
| UiSettings::~UiSettings() = default; | UiSettings::~UiSettings() = default; | ||||||
|  | @ -70,6 +73,11 @@ SettingsVariable<bool>& UiSettings::timeline_expanded() const | ||||||
|    return p->timelineExpanded_; |    return p->timelineExpanded_; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | SettingsVariable<bool>& UiSettings::alert_dock_visible() const | ||||||
|  | { | ||||||
|  |    return p->alertDockVisible_; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| bool UiSettings::Shutdown() | bool UiSettings::Shutdown() | ||||||
| { | { | ||||||
|    bool dataChanged = false; |    bool dataChanged = false; | ||||||
|  | @ -80,6 +88,7 @@ bool UiSettings::Shutdown() | ||||||
|    dataChanged |= p->level3ProductsExpanded_.Commit(); |    dataChanged |= p->level3ProductsExpanded_.Commit(); | ||||||
|    dataChanged |= p->mapSettingsExpanded_.Commit(); |    dataChanged |= p->mapSettingsExpanded_.Commit(); | ||||||
|    dataChanged |= p->timelineExpanded_.Commit(); |    dataChanged |= p->timelineExpanded_.Commit(); | ||||||
|  |    dataChanged |= p->alertDockVisible_.Commit(); | ||||||
| 
 | 
 | ||||||
|    return dataChanged; |    return dataChanged; | ||||||
| } | } | ||||||
|  | @ -96,7 +105,8 @@ bool operator==(const UiSettings& lhs, const UiSettings& rhs) | ||||||
|            lhs.p->level2SettingsExpanded_ == rhs.p->level2SettingsExpanded_ && |            lhs.p->level2SettingsExpanded_ == rhs.p->level2SettingsExpanded_ && | ||||||
|            lhs.p->level3ProductsExpanded_ == rhs.p->level3ProductsExpanded_ && |            lhs.p->level3ProductsExpanded_ == rhs.p->level3ProductsExpanded_ && | ||||||
|            lhs.p->mapSettingsExpanded_ == rhs.p->mapSettingsExpanded_ && |            lhs.p->mapSettingsExpanded_ == rhs.p->mapSettingsExpanded_ && | ||||||
|            lhs.p->timelineExpanded_ == rhs.p->timelineExpanded_); |            lhs.p->timelineExpanded_ == rhs.p->timelineExpanded_ && | ||||||
|  |            lhs.p->alertDockVisible_ == rhs.p->alertDockVisible_); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| } // namespace settings
 | } // namespace settings
 | ||||||
|  |  | ||||||
|  | @ -32,6 +32,7 @@ public: | ||||||
|    SettingsVariable<bool>& level3_products_expanded() const; |    SettingsVariable<bool>& level3_products_expanded() const; | ||||||
|    SettingsVariable<bool>& map_settings_expanded() const; |    SettingsVariable<bool>& map_settings_expanded() const; | ||||||
|    SettingsVariable<bool>& timeline_expanded() const; |    SettingsVariable<bool>& timeline_expanded() const; | ||||||
|  |    SettingsVariable<bool>& alert_dock_visible() const; | ||||||
| 
 | 
 | ||||||
|    bool Shutdown(); |    bool Shutdown(); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -5,6 +5,7 @@ | ||||||
| #include <scwx/qt/model/alert_model.hpp> | #include <scwx/qt/model/alert_model.hpp> | ||||||
| #include <scwx/qt/model/alert_proxy_model.hpp> | #include <scwx/qt/model/alert_proxy_model.hpp> | ||||||
| #include <scwx/qt/settings/general_settings.hpp> | #include <scwx/qt/settings/general_settings.hpp> | ||||||
|  | #include <scwx/qt/settings/ui_settings.hpp> | ||||||
| #include <scwx/qt/types/alert_types.hpp> | #include <scwx/qt/types/alert_types.hpp> | ||||||
| #include <scwx/qt/types/qt_types.hpp> | #include <scwx/qt/types/qt_types.hpp> | ||||||
| #include <scwx/qt/ui/alert_dialog.hpp> | #include <scwx/qt/ui/alert_dialog.hpp> | ||||||
|  | @ -81,6 +82,15 @@ AlertDockWidget::AlertDockWidget(QWidget* parent) : | ||||||
| 
 | 
 | ||||||
|    // Check Active Alerts and trigger signal
 |    // Check Active Alerts and trigger signal
 | ||||||
|    ui->actionActiveAlerts->setChecked(true); |    ui->actionActiveAlerts->setChecked(true); | ||||||
|  | 
 | ||||||
|  |    // Update setting on visiblity change.
 | ||||||
|  |    connect(toggleViewAction(), | ||||||
|  |            &QAction::triggered, | ||||||
|  |            this, | ||||||
|  |            [](bool checked) { | ||||||
|  |               settings::UiSettings::Instance().alert_dock_visible().StageValue( | ||||||
|  |                  checked); | ||||||
|  |            }); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| AlertDockWidget::~AlertDockWidget() | AlertDockWidget::~AlertDockWidget() | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 AdenKoperczak
						AdenKoperczak