mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 21:10:04 +00:00
commit
475460ff84
6 changed files with 57 additions and 6 deletions
|
|
@ -279,7 +279,6 @@ MainWindow::MainWindow(QWidget* parent) :
|
|||
|
||||
// Configure Alert Dock
|
||||
p->alertDockWidget_ = new ui::AlertDockWidget(this);
|
||||
p->alertDockWidget_->setVisible(false);
|
||||
addDockWidget(Qt::BottomDockWidgetArea, p->alertDockWidget_);
|
||||
|
||||
// GPS Info Dialog
|
||||
|
|
@ -444,8 +443,37 @@ void MainWindow::keyReleaseEvent(QKeyEvent* ev)
|
|||
void MainWindow::showEvent(QShowEvent* event)
|
||||
{
|
||||
QMainWindow::showEvent(event);
|
||||
auto& uiSettings = settings::UiSettings::Instance();
|
||||
|
||||
resizeDocks({ui->radarToolboxDock}, {194}, Qt::Horizontal);
|
||||
// restore the geometry state
|
||||
std::string uiGeometry = uiSettings.main_ui_geometry().GetValue();
|
||||
restoreGeometry(
|
||||
QByteArray::fromBase64(QByteArray::fromStdString(uiGeometry)));
|
||||
|
||||
// restore the UI state
|
||||
std::string uiState = uiSettings.main_ui_state().GetValue();
|
||||
|
||||
bool restored =
|
||||
restoreState(QByteArray::fromBase64(QByteArray::fromStdString(uiState)));
|
||||
if (!restored)
|
||||
{
|
||||
resizeDocks({ui->radarToolboxDock}, {194}, Qt::Horizontal);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::closeEvent(QCloseEvent* event)
|
||||
{
|
||||
auto& uiSettings = settings::UiSettings::Instance();
|
||||
|
||||
// save the UI geometry
|
||||
QByteArray uiGeometry = saveGeometry().toBase64();
|
||||
uiSettings.main_ui_geometry().StageValue(uiGeometry.data());
|
||||
|
||||
// save the UI state
|
||||
QByteArray uiState = saveState().toBase64();
|
||||
uiSettings.main_ui_state().StageValue(uiState.data());
|
||||
|
||||
QMainWindow::closeEvent(event);
|
||||
}
|
||||
|
||||
void MainWindow::on_actionOpenNexrad_triggered()
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ public:
|
|||
void keyPressEvent(QKeyEvent* ev) override final;
|
||||
void keyReleaseEvent(QKeyEvent* ev) override final;
|
||||
void showEvent(QShowEvent* event) override;
|
||||
void closeEvent(QCloseEvent *event) override;
|
||||
|
||||
signals:
|
||||
void ActiveMapMoved(double latitude, double longitude);
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ public:
|
|||
* @return true if the staged value was committed, false if no staged value
|
||||
* is present.
|
||||
*/
|
||||
bool Commit();
|
||||
bool Commit() override;
|
||||
|
||||
/**
|
||||
* Clears the staged value of the settings variable.
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@ public:
|
|||
level3ProductsExpanded_.SetDefault(true);
|
||||
mapSettingsExpanded_.SetDefault(true);
|
||||
timelineExpanded_.SetDefault(true);
|
||||
mainUIState_.SetDefault("");
|
||||
mainUIGeometry_.SetDefault("");
|
||||
}
|
||||
|
||||
~UiSettingsImpl() {}
|
||||
|
|
@ -28,6 +30,8 @@ public:
|
|||
SettingsVariable<bool> level3ProductsExpanded_ {"level3_products_expanded"};
|
||||
SettingsVariable<bool> mapSettingsExpanded_ {"map_settings_expanded"};
|
||||
SettingsVariable<bool> timelineExpanded_ {"timeline_expanded"};
|
||||
SettingsVariable<std::string> mainUIState_ {"main_ui_state"};
|
||||
SettingsVariable<std::string> mainUIGeometry_ {"main_ui_geometry"};
|
||||
};
|
||||
|
||||
UiSettings::UiSettings() :
|
||||
|
|
@ -37,7 +41,9 @@ UiSettings::UiSettings() :
|
|||
&p->level2SettingsExpanded_,
|
||||
&p->level3ProductsExpanded_,
|
||||
&p->mapSettingsExpanded_,
|
||||
&p->timelineExpanded_});
|
||||
&p->timelineExpanded_,
|
||||
&p->mainUIState_,
|
||||
&p->mainUIGeometry_});
|
||||
SetDefaults();
|
||||
}
|
||||
UiSettings::~UiSettings() = default;
|
||||
|
|
@ -70,6 +76,16 @@ SettingsVariable<bool>& UiSettings::timeline_expanded() const
|
|||
return p->timelineExpanded_;
|
||||
}
|
||||
|
||||
SettingsVariable<std::string>& UiSettings::main_ui_state() const
|
||||
{
|
||||
return p->mainUIState_;
|
||||
}
|
||||
|
||||
SettingsVariable<std::string>& UiSettings::main_ui_geometry() const
|
||||
{
|
||||
return p->mainUIGeometry_;
|
||||
}
|
||||
|
||||
bool UiSettings::Shutdown()
|
||||
{
|
||||
bool dataChanged = false;
|
||||
|
|
@ -80,6 +96,8 @@ bool UiSettings::Shutdown()
|
|||
dataChanged |= p->level3ProductsExpanded_.Commit();
|
||||
dataChanged |= p->mapSettingsExpanded_.Commit();
|
||||
dataChanged |= p->timelineExpanded_.Commit();
|
||||
dataChanged |= p->mainUIState_.Commit();
|
||||
dataChanged |= p->mainUIGeometry_.Commit();
|
||||
|
||||
return dataChanged;
|
||||
}
|
||||
|
|
@ -96,7 +114,9 @@ bool operator==(const UiSettings& lhs, const UiSettings& rhs)
|
|||
lhs.p->level2SettingsExpanded_ == rhs.p->level2SettingsExpanded_ &&
|
||||
lhs.p->level3ProductsExpanded_ == rhs.p->level3ProductsExpanded_ &&
|
||||
lhs.p->mapSettingsExpanded_ == rhs.p->mapSettingsExpanded_ &&
|
||||
lhs.p->timelineExpanded_ == rhs.p->timelineExpanded_);
|
||||
lhs.p->timelineExpanded_ == rhs.p->timelineExpanded_ &&
|
||||
lhs.p->mainUIState_ == rhs.p->mainUIState_ &&
|
||||
lhs.p->mainUIGeometry_ == rhs.p->mainUIGeometry_);
|
||||
}
|
||||
|
||||
} // namespace settings
|
||||
|
|
|
|||
|
|
@ -32,6 +32,8 @@ public:
|
|||
SettingsVariable<bool>& level3_products_expanded() const;
|
||||
SettingsVariable<bool>& map_settings_expanded() const;
|
||||
SettingsVariable<bool>& timeline_expanded() const;
|
||||
SettingsVariable<std::string>& main_ui_state() const;
|
||||
SettingsVariable<std::string>& main_ui_geometry() const;
|
||||
|
||||
bool Shutdown();
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 5a91ded677d4032b0de9370ed767a16708c0ecff
|
||||
Subproject commit 20a1ca1752499222d33869e37148321936ca6354
|
||||
Loading…
Add table
Add a link
Reference in a new issue