mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 17:00:05 +00:00 
			
		
		
		
	save radar toolbox dock's visibility on exit
This commit is contained in:
		
							parent
							
								
									3ab18392b3
								
							
						
					
					
						commit
						3789845a36
					
				
					 3 changed files with 31 additions and 3 deletions
				
			
		|  | @ -277,9 +277,12 @@ MainWindow::MainWindow(QWidget* parent) : | ||||||
| 
 | 
 | ||||||
|    ui->radarSitePresetsButton->setVisible(!radarSitePresets.empty()); |    ui->radarSitePresetsButton->setVisible(!radarSitePresets.empty()); | ||||||
| 
 | 
 | ||||||
|  |    auto& uiSettings = settings::UiSettings::Instance(); | ||||||
|    // Configure Alert Dock
 |    // Configure Alert Dock
 | ||||||
|  |    bool alertDockVisible_ = uiSettings.alert_dock_visible().GetValue(); | ||||||
|    p->alertDockWidget_ = new ui::AlertDockWidget(this); |    p->alertDockWidget_ = new ui::AlertDockWidget(this); | ||||||
|    addDockWidget(Qt::BottomDockWidgetArea, p->alertDockWidget_); |    addDockWidget(Qt::BottomDockWidgetArea, p->alertDockWidget_); | ||||||
|  |    p->alertDockWidget_->setVisible(alertDockVisible_); | ||||||
| 
 | 
 | ||||||
|    // GPS Info Dialog
 |    // GPS Info Dialog
 | ||||||
|    p->gpsInfoDialog_ = new ui::GpsInfoDialog(this); |    p->gpsInfoDialog_ = new ui::GpsInfoDialog(this); | ||||||
|  | @ -289,10 +292,24 @@ MainWindow::MainWindow(QWidget* parent) : | ||||||
|                               ui->radarToolboxDock->toggleViewAction()); |                               ui->radarToolboxDock->toggleViewAction()); | ||||||
|    ui->radarToolboxDock->toggleViewAction()->setText(tr("Radar &Toolbox")); |    ui->radarToolboxDock->toggleViewAction()->setText(tr("Radar &Toolbox")); | ||||||
|    ui->actionRadarToolbox->setVisible(false); |    ui->actionRadarToolbox->setVisible(false); | ||||||
|  |    ui->radarToolboxDock->setVisible( | ||||||
|  |       uiSettings.radar_toolbox_dock_visible().GetValue()); | ||||||
|  | 
 | ||||||
|  |    // Update dock setting on visiblity change.
 | ||||||
|  |    connect(ui->radarToolboxDock->toggleViewAction(), | ||||||
|  |            &QAction::triggered, | ||||||
|  |            this, | ||||||
|  |            [](bool checked) | ||||||
|  |            { | ||||||
|  |               settings::UiSettings::Instance() | ||||||
|  |                  .radar_toolbox_dock_visible() | ||||||
|  |                  .StageValue(checked); | ||||||
|  |            }); | ||||||
| 
 | 
 | ||||||
|    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()); | ||||||
|  | @ -801,7 +818,6 @@ 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, | ||||||
|  |  | ||||||
|  | @ -20,6 +20,7 @@ public: | ||||||
|       mapSettingsExpanded_.SetDefault(true); |       mapSettingsExpanded_.SetDefault(true); | ||||||
|       timelineExpanded_.SetDefault(true); |       timelineExpanded_.SetDefault(true); | ||||||
|       alertDockVisible_.SetDefault(false); |       alertDockVisible_.SetDefault(false); | ||||||
|  |       radarToolboxDockVisible_.SetDefault(true); | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|    ~UiSettingsImpl() {} |    ~UiSettingsImpl() {} | ||||||
|  | @ -30,6 +31,7 @@ public: | ||||||
|    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"}; |    SettingsVariable<bool> alertDockVisible_ {"alert_dock_visible"}; | ||||||
|  |    SettingsVariable<bool> radarToolboxDockVisible_ {"radar_toolbox_dock_visible"}; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| UiSettings::UiSettings() : | UiSettings::UiSettings() : | ||||||
|  | @ -40,7 +42,8 @@ UiSettings::UiSettings() : | ||||||
|                       &p->level3ProductsExpanded_, |                       &p->level3ProductsExpanded_, | ||||||
|                       &p->mapSettingsExpanded_, |                       &p->mapSettingsExpanded_, | ||||||
|                       &p->timelineExpanded_, |                       &p->timelineExpanded_, | ||||||
|                       &p->alertDockVisible_}); |                       &p->alertDockVisible_, | ||||||
|  |                       &p->radarToolboxDockVisible_}); | ||||||
|    SetDefaults(); |    SetDefaults(); | ||||||
| } | } | ||||||
| UiSettings::~UiSettings() = default; | UiSettings::~UiSettings() = default; | ||||||
|  | @ -78,6 +81,12 @@ SettingsVariable<bool>& UiSettings::alert_dock_visible() const | ||||||
|    return p->alertDockVisible_; |    return p->alertDockVisible_; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | SettingsVariable<bool>& UiSettings::radar_toolbox_dock_visible() const | ||||||
|  | { | ||||||
|  |    return p->radarToolboxDockVisible_; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| bool UiSettings::Shutdown() | bool UiSettings::Shutdown() | ||||||
| { | { | ||||||
|    bool dataChanged = false; |    bool dataChanged = false; | ||||||
|  | @ -89,6 +98,7 @@ bool UiSettings::Shutdown() | ||||||
|    dataChanged |= p->mapSettingsExpanded_.Commit(); |    dataChanged |= p->mapSettingsExpanded_.Commit(); | ||||||
|    dataChanged |= p->timelineExpanded_.Commit(); |    dataChanged |= p->timelineExpanded_.Commit(); | ||||||
|    dataChanged |= p->alertDockVisible_.Commit(); |    dataChanged |= p->alertDockVisible_.Commit(); | ||||||
|  |    dataChanged |= p->radarToolboxDockVisible_.Commit(); | ||||||
| 
 | 
 | ||||||
|    return dataChanged; |    return dataChanged; | ||||||
| } | } | ||||||
|  | @ -106,7 +116,8 @@ bool operator==(const UiSettings& lhs, const UiSettings& rhs) | ||||||
|            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_); |            lhs.p->alertDockVisible_ == rhs.p->alertDockVisible_ && | ||||||
|  |            lhs.p->radarToolboxDockVisible_ == rhs.p->radarToolboxDockVisible_); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| } // namespace settings
 | } // namespace settings
 | ||||||
|  |  | ||||||
|  | @ -33,6 +33,7 @@ public: | ||||||
|    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; |    SettingsVariable<bool>& alert_dock_visible() const; | ||||||
|  |    SettingsVariable<bool>& radar_toolbox_dock_visible() const; | ||||||
| 
 | 
 | ||||||
|    bool Shutdown(); |    bool Shutdown(); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 AdenKoperczak
						AdenKoperczak