mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 00:00:04 +00:00 
			
		
		
		
	Add alert audio sound to settings dialog
This commit is contained in:
		
							parent
							
								
									a495cf1b3b
								
							
						
					
					
						commit
						2345855a97
					
				
					 6 changed files with 128 additions and 39 deletions
				
			
		|  | @ -4,6 +4,7 @@ | |||
| #include <scwx/awips/phenomenon.hpp> | ||||
| #include <scwx/common/color_table.hpp> | ||||
| #include <scwx/qt/config/radar_site.hpp> | ||||
| #include <scwx/qt/manager/media_manager.hpp> | ||||
| #include <scwx/qt/manager/position_manager.hpp> | ||||
| #include <scwx/qt/manager/settings_manager.hpp> | ||||
| #include <scwx/qt/map/map_provider.hpp> | ||||
|  | @ -126,6 +127,7 @@ public: | |||
|           &antiAliasingEnabled_, | ||||
|           &updateNotificationsEnabled_, | ||||
|           &debugEnabled_, | ||||
|           &alertAudioSoundFile_, | ||||
|           &alertAudioLocationMethod_, | ||||
|           &alertAudioLatitude_, | ||||
|           &alertAudioLongitude_, | ||||
|  | @ -196,6 +198,8 @@ public: | |||
| 
 | ||||
|    types::FontCategory selectedFontCategory_ {types::FontCategory::Unknown}; | ||||
| 
 | ||||
|    std::shared_ptr<manager::MediaManager> mediaManager_ { | ||||
|       manager::MediaManager::Instance()}; | ||||
|    std::shared_ptr<manager::PositionManager> positionManager_ { | ||||
|       manager::PositionManager::Instance()}; | ||||
| 
 | ||||
|  | @ -220,6 +224,7 @@ public: | |||
|                       settings::SettingsInterface<std::string>> | ||||
|       inactiveAlertColors_ {}; | ||||
| 
 | ||||
|    settings::SettingsInterface<std::string> alertAudioSoundFile_ {}; | ||||
|    settings::SettingsInterface<std::string> alertAudioLocationMethod_ {}; | ||||
|    settings::SettingsInterface<double>      alertAudioLatitude_ {}; | ||||
|    settings::SettingsInterface<double>      alertAudioLongitude_ {}; | ||||
|  | @ -309,6 +314,20 @@ void SettingsDialogImpl::ConnectSignals() | |||
|       [this](const std::string& newValue) | ||||
|       { UpdateRadarDialogLocation(newValue); }); | ||||
| 
 | ||||
|    QObject::connect( | ||||
|       self_->ui->alertAudioSoundTestButton, | ||||
|       &QAbstractButton::clicked, | ||||
|       self_, | ||||
|       [this]() | ||||
|       { | ||||
|          mediaManager_->Play( | ||||
|             self_->ui->alertAudioSoundLineEdit->text().toStdString()); | ||||
|       }); | ||||
|    QObject::connect(self_->ui->alertAudioSoundStopButton, | ||||
|                     &QAbstractButton::clicked, | ||||
|                     self_, | ||||
|                     [this]() { mediaManager_->Stop(); }); | ||||
| 
 | ||||
|    QObject::connect( | ||||
|       self_->ui->fontListView->selectionModel(), | ||||
|       &QItemSelectionModel::selectionChanged, | ||||
|  | @ -830,6 +849,10 @@ void SettingsDialogImpl::SetupAudioTab() | |||
| 
 | ||||
|    settings::AudioSettings& audioSettings = settings::AudioSettings::Instance(); | ||||
| 
 | ||||
|    alertAudioSoundFile_.SetSettingsVariable(audioSettings.alert_sound_file()); | ||||
|    alertAudioSoundFile_.SetEditWidget(self_->ui->alertAudioSoundLineEdit); | ||||
|    alertAudioSoundFile_.SetResetButton(self_->ui->resetAlertAudioSoundButton); | ||||
| 
 | ||||
|    for (const auto& locationMethod : types::LocationMethodIterator()) | ||||
|    { | ||||
|       self_->ui->alertAudioLocationMethodComboBox->addItem( | ||||
|  |  | |||
|  | @ -453,14 +453,14 @@ | |||
|               <string>Alerts</string> | ||||
|              </property> | ||||
|              <layout class="QGridLayout" name="gridLayout_10"> | ||||
|               <item row="1" column="0"> | ||||
|               <item row="2" column="0"> | ||||
|                <widget class="QLabel" name="label_14"> | ||||
|                 <property name="text"> | ||||
|                  <string>Latitude</string> | ||||
|                 </property> | ||||
|                </widget> | ||||
|               </item> | ||||
|               <item row="1" column="1"> | ||||
|               <item row="2" column="2"> | ||||
|                <widget class="QDoubleSpinBox" name="alertAudioLatitudeSpinBox"> | ||||
|                 <property name="decimals"> | ||||
|                  <number>4</number> | ||||
|  | @ -476,36 +476,7 @@ | |||
|                 </property> | ||||
|                </widget> | ||||
|               </item> | ||||
|               <item row="1" column="2"> | ||||
|                <widget class="QToolButton" name="resetAlertAudioLatitudeButton"> | ||||
|                 <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="2" column="0"> | ||||
|                <widget class="QLabel" name="label_16"> | ||||
|                 <property name="text"> | ||||
|                  <string>Longitude</string> | ||||
|                 </property> | ||||
|                </widget> | ||||
|               </item> | ||||
|               <item row="2" column="2"> | ||||
|                <widget class="QToolButton" name="resetAlertAudioLongitudeButton"> | ||||
|                 <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="2"> | ||||
|               <item row="1" column="6"> | ||||
|                <widget class="QToolButton" name="resetAlertAudioLocationMethodButton"> | ||||
|                 <property name="text"> | ||||
|                  <string>...</string> | ||||
|  | @ -516,14 +487,28 @@ | |||
|                 </property> | ||||
|                </widget> | ||||
|               </item> | ||||
|               <item row="0" column="0"> | ||||
|               <item row="3" column="0"> | ||||
|                <widget class="QLabel" name="label_16"> | ||||
|                 <property name="text"> | ||||
|                  <string>Longitude</string> | ||||
|                 </property> | ||||
|                </widget> | ||||
|               </item> | ||||
|               <item row="0" column="3"> | ||||
|                <widget class="QToolButton" name="alertAudioSoundSelectButton"> | ||||
|                 <property name="text"> | ||||
|                  <string>...</string> | ||||
|                 </property> | ||||
|                </widget> | ||||
|               </item> | ||||
|               <item row="1" column="0"> | ||||
|                <widget class="QLabel" name="label_12"> | ||||
|                 <property name="text"> | ||||
|                  <string>Location Method</string> | ||||
|                 </property> | ||||
|                </widget> | ||||
|               </item> | ||||
|               <item row="2" column="1"> | ||||
|               <item row="3" column="2"> | ||||
|                <widget class="QDoubleSpinBox" name="alertAudioLongitudeSpinBox"> | ||||
|                 <property name="decimals"> | ||||
|                  <number>4</number> | ||||
|  | @ -539,7 +524,58 @@ | |||
|                 </property> | ||||
|                </widget> | ||||
|               </item> | ||||
|               <item row="0" column="1"> | ||||
|               <item row="3" column="6"> | ||||
|                <widget class="QToolButton" name="resetAlertAudioLongitudeButton"> | ||||
|                 <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="2" column="6"> | ||||
|                <widget class="QToolButton" name="resetAlertAudioLatitudeButton"> | ||||
|                 <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="2"> | ||||
|                <widget class="QLineEdit" name="alertAudioSoundLineEdit"/> | ||||
|               </item> | ||||
|               <item row="0" column="6"> | ||||
|                <widget class="QToolButton" name="resetAlertAudioSoundButton"> | ||||
|                 <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="alertAudioSoundTestButton"> | ||||
|                 <property name="icon"> | ||||
|                  <iconset resource="../../../../scwx-qt.qrc"> | ||||
|                   <normaloff>:/res/icons/font-awesome-6/play-solid.svg</normaloff>:/res/icons/font-awesome-6/play-solid.svg</iconset> | ||||
|                 </property> | ||||
|                </widget> | ||||
|               </item> | ||||
|               <item row="0" column="0"> | ||||
|                <widget class="QLabel" name="label_17"> | ||||
|                 <property name="text"> | ||||
|                  <string>Sound</string> | ||||
|                 </property> | ||||
|                </widget> | ||||
|               </item> | ||||
|               <item row="1" column="2"> | ||||
|                <widget class="QComboBox" name="alertAudioLocationMethodComboBox"> | ||||
|                 <property name="sizePolicy"> | ||||
|                  <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> | ||||
|  | @ -549,6 +585,14 @@ | |||
|                 </property> | ||||
|                </widget> | ||||
|               </item> | ||||
|               <item row="0" column="5"> | ||||
|                <widget class="QToolButton" name="alertAudioSoundStopButton"> | ||||
|                 <property name="icon"> | ||||
|                  <iconset resource="../../../../scwx-qt.qrc"> | ||||
|                   <normaloff>:/res/icons/font-awesome-6/stop-solid.svg</normaloff>:/res/icons/font-awesome-6/stop-solid.svg</iconset> | ||||
|                 </property> | ||||
|                </widget> | ||||
|               </item> | ||||
|              </layout> | ||||
|             </widget> | ||||
|            </item> | ||||
|  | @ -560,7 +604,7 @@ | |||
|              <property name="sizeHint" stdset="0"> | ||||
|               <size> | ||||
|                <width>20</width> | ||||
|                <height>309</height> | ||||
|                <height>281</height> | ||||
|               </size> | ||||
|              </property> | ||||
|             </spacer> | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat