diff --git a/scwx-qt/source/scwx/qt/ui/settings_dialog.cpp b/scwx-qt/source/scwx/qt/ui/settings_dialog.cpp index b7053c0c..2a87e5c2 100644 --- a/scwx-qt/source/scwx/qt/ui/settings_dialog.cpp +++ b/scwx-qt/source/scwx/qt/ui/settings_dialog.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -129,6 +130,8 @@ public: &mapTilerApiKey_, &theme_, &defaultAlertAction_, + &clockFormat_, + &defaultTimeZone_, &antiAliasingEnabled_, &showMapAttribution_, &showMapLogo_, @@ -220,6 +223,8 @@ public: settings::SettingsInterface mapboxApiKey_ {}; settings::SettingsInterface mapTilerApiKey_ {}; settings::SettingsInterface defaultAlertAction_ {}; + settings::SettingsInterface clockFormat_ {}; + settings::SettingsInterface defaultTimeZone_ {}; settings::SettingsInterface theme_ {}; settings::SettingsInterface antiAliasingEnabled_ {}; settings::SettingsInterface showMapAttribution_ {}; @@ -590,23 +595,9 @@ void SettingsDialogImpl::SetupGeneralTab() defaultAlertAction_.SetSettingsVariable( generalSettings.default_alert_action()); defaultAlertAction_.SetMapFromValueFunction( - [](const std::string& text) -> std::string - { - for (types::AlertAction alertAction : types::AlertActionIterator()) - { - const std::string alertActionName = - types::GetAlertActionName(alertAction); - - if (boost::iequals(text, alertActionName)) - { - // Return alert action label - return alertActionName; - } - } - - // Alert action label not found, return unknown - return "?"; - }); + SCWX_ENUM_MAP_FROM_VALUE(types::AlertAction, + types::AlertActionIterator(), + types::GetAlertActionName)); defaultAlertAction_.SetMapToValueFunction( [](std::string text) -> std::string { @@ -617,6 +608,48 @@ void SettingsDialogImpl::SetupGeneralTab() defaultAlertAction_.SetEditWidget(self_->ui->defaultAlertActionComboBox); defaultAlertAction_.SetResetButton(self_->ui->resetDefaultAlertActionButton); + for (const auto& clockFormat : types::ClockFormatIterator()) + { + self_->ui->clockFormatComboBox->addItem( + QString::fromStdString(types::GetClockFormatName(clockFormat))); + } + + clockFormat_.SetSettingsVariable(generalSettings.clock_format()); + clockFormat_.SetMapFromValueFunction( + SCWX_ENUM_MAP_FROM_VALUE(types::ClockFormat, + types::ClockFormatIterator(), + types::GetClockFormatName)); + clockFormat_.SetMapToValueFunction( + [](std::string text) -> std::string + { + // Convert label to lower case and return + boost::to_lower(text); + return text; + }); + clockFormat_.SetEditWidget(self_->ui->clockFormatComboBox); + clockFormat_.SetResetButton(self_->ui->resetClockFormatButton); + + for (const auto& timeZone : types::DefaultTimeZoneIterator()) + { + self_->ui->defaultTimeZoneComboBox->addItem( + QString::fromStdString(types::GetDefaultTimeZoneName(timeZone))); + } + + defaultTimeZone_.SetSettingsVariable(generalSettings.default_time_zone()); + defaultTimeZone_.SetMapFromValueFunction( + SCWX_ENUM_MAP_FROM_VALUE(types::DefaultTimeZone, + types::DefaultTimeZoneIterator(), + types::GetDefaultTimeZoneName)); + defaultTimeZone_.SetMapToValueFunction( + [](std::string text) -> std::string + { + // Convert label to lower case and return + boost::to_lower(text); + return text; + }); + defaultTimeZone_.SetEditWidget(self_->ui->defaultTimeZoneComboBox); + defaultTimeZone_.SetResetButton(self_->ui->resetDefaultTimeZoneButton); + antiAliasingEnabled_.SetSettingsVariable( generalSettings.anti_aliasing_enabled()); antiAliasingEnabled_.SetEditWidget(self_->ui->antiAliasingEnabledCheckBox); diff --git a/scwx-qt/source/scwx/qt/ui/settings_dialog.ui b/scwx-qt/source/scwx/qt/ui/settings_dialog.ui index 35f8fcad..7b026bc3 100644 --- a/scwx-qt/source/scwx/qt/ui/settings_dialog.ui +++ b/scwx-qt/source/scwx/qt/ui/settings_dialog.ui @@ -129,8 +129,18 @@ 0 - - + + + + Default Alert Action + + + + + + + + ... @@ -140,46 +150,8 @@ - - - - ... - - - - - - - Map Provider - - - - - - - - - - Grid Height - - - - - - - - - - - - - ... - - - - :/res/icons/font-awesome-6/rotate-left-solid.svg:/res/icons/font-awesome-6/rotate-left-solid.svg - - + + @@ -188,6 +160,13 @@ + + + + Default Time Zone + + + @@ -195,10 +174,17 @@ - - + + - Default Alert Action + Theme + + + + + + + Map Provider @@ -209,34 +195,6 @@ - - - - Default Radar Site - - - - - - - QLineEdit::Password - - - - - - - - - - ... - - - - :/res/icons/font-awesome-6/rotate-left-solid.svg:/res/icons/font-awesome-6/rotate-left-solid.svg - - - @@ -251,10 +209,25 @@ - - + + - Mapbox API Key + ... + + + + :/res/icons/font-awesome-6/rotate-left-solid.svg:/res/icons/font-awesome-6/rotate-left-solid.svg + + + + + + + ... + + + + :/res/icons/font-awesome-6/rotate-left-solid.svg:/res/icons/font-awesome-6/rotate-left-solid.svg @@ -269,8 +242,21 @@ - - + + + + Clock Format + + + + + + + + + + + ... @@ -280,6 +266,23 @@ + + + + + + + Default Radar Site + + + + + + + Mapbox API Key + + + @@ -291,18 +294,57 @@ - - + + - Theme + Grid Height - - + + + + ... + + + + :/res/icons/font-awesome-6/rotate-left-solid.svg:/res/icons/font-awesome-6/rotate-left-solid.svg + + - - + + + + ... + + + + + + + QLineEdit::Password + + + + + + + + + + + + + ... + + + + :/res/icons/font-awesome-6/rotate-left-solid.svg:/res/icons/font-awesome-6/rotate-left-solid.svg + + + + + ... @@ -387,7 +429,7 @@ 0 0 - 66 + 63 18