mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 21:10:04 +00:00
Add clock format and default time zone to settings dialog
This commit is contained in:
parent
2a0ab9ad93
commit
bb287dad9c
2 changed files with 178 additions and 103 deletions
|
|
@ -19,6 +19,7 @@
|
|||
#include <scwx/qt/types/location_types.hpp>
|
||||
#include <scwx/qt/types/qt_types.hpp>
|
||||
#include <scwx/qt/types/text_types.hpp>
|
||||
#include <scwx/qt/types/time_types.hpp>
|
||||
#include <scwx/qt/ui/county_dialog.hpp>
|
||||
#include <scwx/qt/ui/radar_site_dialog.hpp>
|
||||
#include <scwx/qt/util/color.hpp>
|
||||
|
|
@ -129,6 +130,8 @@ public:
|
|||
&mapTilerApiKey_,
|
||||
&theme_,
|
||||
&defaultAlertAction_,
|
||||
&clockFormat_,
|
||||
&defaultTimeZone_,
|
||||
&antiAliasingEnabled_,
|
||||
&showMapAttribution_,
|
||||
&showMapLogo_,
|
||||
|
|
@ -220,6 +223,8 @@ public:
|
|||
settings::SettingsInterface<std::string> mapboxApiKey_ {};
|
||||
settings::SettingsInterface<std::string> mapTilerApiKey_ {};
|
||||
settings::SettingsInterface<std::string> defaultAlertAction_ {};
|
||||
settings::SettingsInterface<std::string> clockFormat_ {};
|
||||
settings::SettingsInterface<std::string> defaultTimeZone_ {};
|
||||
settings::SettingsInterface<std::string> theme_ {};
|
||||
settings::SettingsInterface<bool> antiAliasingEnabled_ {};
|
||||
settings::SettingsInterface<bool> 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);
|
||||
|
|
|
|||
|
|
@ -129,8 +129,18 @@
|
|||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="5" column="4">
|
||||
<widget class="QToolButton" name="resetMapProviderButton">
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="defaultAlertActionLabel">
|
||||
<property name="text">
|
||||
<string>Default Alert Action</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QComboBox" name="themeComboBox"/>
|
||||
</item>
|
||||
<item row="0" column="4">
|
||||
<widget class="QToolButton" name="resetThemeButton">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
|
|
@ -140,46 +150,8 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QToolButton" name="radarSiteSelectButton">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Map Provider</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QComboBox" name="radarSiteComboBox"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Grid Height</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QSpinBox" name="gridHeightSpinBox"/>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QSpinBox" name="gridWidthSpinBox"/>
|
||||
</item>
|
||||
<item row="1" column="4">
|
||||
<widget class="QToolButton" name="resetRadarSiteButton">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../../scwx-qt.qrc">
|
||||
<normaloff>:/res/icons/font-awesome-6/rotate-left-solid.svg</normaloff>:/res/icons/font-awesome-6/rotate-left-solid.svg</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
<item row="8" column="2">
|
||||
<widget class="QComboBox" name="defaultAlertActionComboBox"/>
|
||||
</item>
|
||||
<item row="6" column="2">
|
||||
<widget class="QLineEdit" name="mapboxApiKeyLineEdit">
|
||||
|
|
@ -188,6 +160,13 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<widget class="QLabel" name="label_21">
|
||||
<property name="text">
|
||||
<string>Default Time Zone</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
|
|
@ -195,10 +174,17 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="defaultAlertActionLabel">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Default Alert Action</string>
|
||||
<string>Theme</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Map Provider</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
@ -209,34 +195,6 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Default Radar Site</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="2">
|
||||
<widget class="QLineEdit" name="mapTilerApiKeyLineEdit">
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="2">
|
||||
<widget class="QComboBox" name="defaultAlertActionComboBox"/>
|
||||
</item>
|
||||
<item row="7" column="4">
|
||||
<widget class="QToolButton" name="resetMapTilerApiKeyButton">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../../scwx-qt.qrc">
|
||||
<normaloff>:/res/icons/font-awesome-6/rotate-left-solid.svg</normaloff>:/res/icons/font-awesome-6/rotate-left-solid.svg</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="4">
|
||||
<widget class="QToolButton" name="resetGridHeightButton">
|
||||
<property name="text">
|
||||
|
|
@ -251,10 +209,25 @@
|
|||
<item row="5" column="2">
|
||||
<widget class="QComboBox" name="mapProviderComboBox"/>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<item row="7" column="4">
|
||||
<widget class="QToolButton" name="resetMapTilerApiKeyButton">
|
||||
<property name="text">
|
||||
<string>Mapbox API Key</string>
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../../scwx-qt.qrc">
|
||||
<normaloff>:/res/icons/font-awesome-6/rotate-left-solid.svg</normaloff>:/res/icons/font-awesome-6/rotate-left-solid.svg</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="4">
|
||||
<widget class="QToolButton" name="resetMapProviderButton">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../../scwx-qt.qrc">
|
||||
<normaloff>:/res/icons/font-awesome-6/rotate-left-solid.svg</normaloff>:/res/icons/font-awesome-6/rotate-left-solid.svg</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
@ -269,8 +242,21 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="4">
|
||||
<widget class="QToolButton" name="resetDefaultAlertActionButton">
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="label_20">
|
||||
<property name="text">
|
||||
<string>Clock Format</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QSpinBox" name="gridWidthSpinBox"/>
|
||||
</item>
|
||||
<item row="9" column="2">
|
||||
<widget class="QComboBox" name="clockFormatComboBox"/>
|
||||
</item>
|
||||
<item row="1" column="4">
|
||||
<widget class="QToolButton" name="resetRadarSiteButton">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
|
|
@ -280,6 +266,23 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QComboBox" name="radarSiteComboBox"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Default Radar Site</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Mapbox API Key</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="4">
|
||||
<widget class="QToolButton" name="resetMapboxApiKeyButton">
|
||||
<property name="text">
|
||||
|
|
@ -291,18 +294,57 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Theme</string>
|
||||
<string>Grid Height</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QComboBox" name="themeComboBox"/>
|
||||
<item row="8" column="4">
|
||||
<widget class="QToolButton" name="resetDefaultAlertActionButton">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../../scwx-qt.qrc">
|
||||
<normaloff>:/res/icons/font-awesome-6/rotate-left-solid.svg</normaloff>:/res/icons/font-awesome-6/rotate-left-solid.svg</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="4">
|
||||
<widget class="QToolButton" name="resetThemeButton">
|
||||
<item row="1" column="3">
|
||||
<widget class="QToolButton" name="radarSiteSelectButton">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="2">
|
||||
<widget class="QLineEdit" name="mapTilerApiKeyLineEdit">
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QSpinBox" name="gridHeightSpinBox"/>
|
||||
</item>
|
||||
<item row="10" column="2">
|
||||
<widget class="QComboBox" name="defaultTimeZoneComboBox"/>
|
||||
</item>
|
||||
<item row="9" column="4">
|
||||
<widget class="QToolButton" name="resetClockFormatButton">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../../scwx-qt.qrc">
|
||||
<normaloff>:/res/icons/font-awesome-6/rotate-left-solid.svg</normaloff>:/res/icons/font-awesome-6/rotate-left-solid.svg</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="4">
|
||||
<widget class="QToolButton" name="resetDefaultTimeZoneButton">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
|
|
@ -387,7 +429,7 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>66</width>
|
||||
<width>63</width>
|
||||
<height>18</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue