mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 17:20:06 +00:00 
			
		
		
		
	Latitude/longitude text boxes are controlled by position manager when method is track
This commit is contained in:
		
							parent
							
								
									c03884c2c0
								
							
						
					
					
						commit
						ac92b53a36
					
				
					 1 changed files with 48 additions and 0 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/position_manager.hpp> | ||||
| #include <scwx/qt/manager/settings_manager.hpp> | ||||
| #include <scwx/qt/map/map_provider.hpp> | ||||
| #include <scwx/qt/settings/audio_settings.hpp> | ||||
|  | @ -28,6 +29,7 @@ | |||
| #include <QFileDialog> | ||||
| #include <QFontDatabase> | ||||
| #include <QFontDialog> | ||||
| #include <QGeoPositionInfo> | ||||
| #include <QStandardItemModel> | ||||
| #include <QToolButton> | ||||
| 
 | ||||
|  | @ -194,6 +196,9 @@ public: | |||
| 
 | ||||
|    types::FontCategory selectedFontCategory_ {types::FontCategory::Unknown}; | ||||
| 
 | ||||
|    std::shared_ptr<manager::PositionManager> positionManager_ { | ||||
|       manager::PositionManager::Instance()}; | ||||
| 
 | ||||
|    settings::SettingsInterface<std::string>  defaultRadarSite_ {}; | ||||
|    settings::SettingsInterface<std::int64_t> gridWidth_ {}; | ||||
|    settings::SettingsInterface<std::int64_t> gridHeight_ {}; | ||||
|  | @ -802,6 +807,27 @@ void SettingsDialogImpl::SetupPalettesAlertsTab() | |||
| 
 | ||||
| void SettingsDialogImpl::SetupAudioTab() | ||||
| { | ||||
|    QObject::connect(self_->ui->alertAudioLocationMethodComboBox, | ||||
|                     &QComboBox::currentTextChanged, | ||||
|                     self_, | ||||
|                     [this](const QString& text) | ||||
|                     { | ||||
|                        types::LocationMethod locationMethod = | ||||
|                           types::GetLocationMethod(text.toStdString()); | ||||
| 
 | ||||
|                        bool coordinateEntryEnabled = | ||||
|                           locationMethod == types::LocationMethod::Fixed; | ||||
| 
 | ||||
|                        self_->ui->alertAudioLatitudeSpinBox->setEnabled( | ||||
|                           coordinateEntryEnabled); | ||||
|                        self_->ui->alertAudioLongitudeSpinBox->setEnabled( | ||||
|                           coordinateEntryEnabled); | ||||
|                        self_->ui->resetAlertAudioLatitudeButton->setEnabled( | ||||
|                           coordinateEntryEnabled); | ||||
|                        self_->ui->resetAlertAudioLongitudeButton->setEnabled( | ||||
|                           coordinateEntryEnabled); | ||||
|                     }); | ||||
| 
 | ||||
|    settings::AudioSettings& audioSettings = settings::AudioSettings::Instance(); | ||||
| 
 | ||||
|    for (const auto& locationMethod : types::LocationMethodIterator()) | ||||
|  | @ -862,6 +888,28 @@ void SettingsDialogImpl::SetupAudioTab() | |||
|          audioSettings.alert_enabled(phenomenon)); | ||||
|       alertAudioEnabled.SetEditWidget(alertAudioCheckbox); | ||||
|    } | ||||
| 
 | ||||
|    QObject::connect( | ||||
|       positionManager_.get(), | ||||
|       &manager::PositionManager::PositionUpdated, | ||||
|       self_, | ||||
|       [this](const QGeoPositionInfo& info) | ||||
|       { | ||||
|          settings::AudioSettings& audioSettings = | ||||
|             settings::AudioSettings::Instance(); | ||||
| 
 | ||||
|          if (info.isValid() && | ||||
|              types::GetLocationMethod( | ||||
|                 audioSettings.alert_location_method().GetValue()) == | ||||
|                 types::LocationMethod::Track) | ||||
|          { | ||||
|             QGeoCoordinate coordinate = info.coordinate(); | ||||
|             self_->ui->alertAudioLatitudeSpinBox->setValue( | ||||
|                coordinate.latitude()); | ||||
|             self_->ui->alertAudioLongitudeSpinBox->setValue( | ||||
|                coordinate.longitude()); | ||||
|          } | ||||
|       }); | ||||
| } | ||||
| 
 | ||||
| void SettingsDialogImpl::SetupTextTab() | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat