mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 20:40:04 +00:00
added full unit support for radius field, implemented such that future fields needing units can be done easily
This commit is contained in:
parent
c53836e91a
commit
146055fb99
7 changed files with 103 additions and 24 deletions
|
|
@ -14,12 +14,14 @@
|
|||
#include <scwx/qt/settings/palette_settings.hpp>
|
||||
#include <scwx/qt/settings/settings_interface.hpp>
|
||||
#include <scwx/qt/settings/text_settings.hpp>
|
||||
#include <scwx/qt/settings/unit_settings.hpp>
|
||||
#include <scwx/qt/types/alert_types.hpp>
|
||||
#include <scwx/qt/types/font_types.hpp>
|
||||
#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/types/unit_types.hpp>
|
||||
#include <scwx/qt/ui/county_dialog.hpp>
|
||||
#include <scwx/qt/ui/radar_site_dialog.hpp>
|
||||
#include <scwx/qt/ui/serial_port_dialog.hpp>
|
||||
|
|
@ -999,6 +1001,23 @@ void SettingsDialogImpl::SetupAudioTab()
|
|||
alertAudioRadius_.SetEditWidget(self_->ui->alertAudioRadiusSpinBox);
|
||||
alertAudioRadius_.SetResetButton(
|
||||
self_->ui->resetAlertAudioRadiusButton);
|
||||
alertAudioRadius_.SetUnitLabel(self_->ui->alertAudioRadiusUnitsLabel);
|
||||
|
||||
auto alertAudioRadiusUpdateUnits = [this](const std::string& newValue)
|
||||
{
|
||||
types::DistanceUnits radiusUnits =
|
||||
types::GetDistanceUnitsFromName(newValue);
|
||||
double radiusScale = types::GetDistanceUnitsScale(radiusUnits);
|
||||
std::string abbreviation =
|
||||
types::GetDistanceUnitsAbbreviation(radiusUnits);
|
||||
|
||||
alertAudioRadius_.SetUnit(radiusScale, abbreviation);
|
||||
};
|
||||
settings::UnitSettings::Instance()
|
||||
.distance_units()
|
||||
.RegisterValueStagedCallback(alertAudioRadiusUpdateUnits);
|
||||
alertAudioRadiusUpdateUnits(
|
||||
settings::UnitSettings::Instance().distance_units().GetValue());
|
||||
|
||||
auto& alertAudioPhenomena = types::GetAlertAudioPhenomena();
|
||||
auto alertAudioLayout =
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@
|
|||
</sizepolicy>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>3</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="general">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
|
|
@ -135,9 +135,9 @@
|
|||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>-113</y>
|
||||
<width>511</width>
|
||||
<height>669</height>
|
||||
<y>0</y>
|
||||
<width>270</width>
|
||||
<height>647</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
|
|
@ -610,8 +610,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>98</width>
|
||||
<height>28</height>
|
||||
<width>80</width>
|
||||
<height>18</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
|
|
@ -883,7 +883,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_28">
|
||||
<widget class="QLabel" name="alertAudioRadiusLabel">
|
||||
<property name="text">
|
||||
<string>Radius</string>
|
||||
</property>
|
||||
|
|
@ -892,7 +892,7 @@
|
|||
<item row="4" column="1" colspan="2">
|
||||
<widget class="QDoubleSpinBox" name="alertAudioRadiusSpinBox">
|
||||
<property name="decimals">
|
||||
<number>4</number>
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>0.000000000000000</double>
|
||||
|
|
@ -916,6 +916,13 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="3">
|
||||
<widget class="QLabel" name="alertAudioRadiusUnitsLabel">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue