mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-11-04 15:00:05 +00:00 
			
		
		
		
	Add button for setting default radar products
This commit is contained in:
		
							parent
							
								
									443f5a3615
								
							
						
					
					
						commit
						ac3c986568
					
				
					 3 changed files with 86 additions and 52 deletions
				
			
		| 
						 | 
				
			
			@ -267,6 +267,7 @@ MainWindow::MainWindow(QWidget* parent) :
 | 
			
		|||
   ui->vcpLabel->setVisible(false);
 | 
			
		||||
   ui->vcpValueLabel->setVisible(false);
 | 
			
		||||
   ui->vcpDescriptionLabel->setVisible(false);
 | 
			
		||||
   ui->saveRadarProductsButton->setVisible(true);
 | 
			
		||||
 | 
			
		||||
   p->radarSitePresetsMenu_ = new QMenu(this);
 | 
			
		||||
   ui->radarSitePresetsButton->setMenu(p->radarSitePresetsMenu_);
 | 
			
		||||
| 
						 | 
				
			
			@ -326,6 +327,8 @@ MainWindow::MainWindow(QWidget* parent) :
 | 
			
		|||
      ui->smoothRadarDataCheckBox);
 | 
			
		||||
   p->mapSettingsGroup_->GetContentsLayout()->addWidget(
 | 
			
		||||
      ui->trackLocationCheckBox);
 | 
			
		||||
   p->mapSettingsGroup_->GetContentsLayout()->addWidget(
 | 
			
		||||
      ui->saveRadarProductsButton);
 | 
			
		||||
   ui->radarToolboxScrollAreaContents->layout()->replaceWidget(
 | 
			
		||||
      ui->mapSettingsGroupBox, p->mapSettingsGroup_);
 | 
			
		||||
   ui->mapSettingsGroupBox->setVisible(false);
 | 
			
		||||
| 
						 | 
				
			
			@ -1124,6 +1127,22 @@ void MainWindowImpl::ConnectOtherSignals()
 | 
			
		|||
              // Turn on location tracking
 | 
			
		||||
              positionManager_->TrackLocation(trackingEnabled);
 | 
			
		||||
           });
 | 
			
		||||
   connect(mainWindow_->ui->saveRadarProductsButton,
 | 
			
		||||
           &QAbstractButton::clicked,
 | 
			
		||||
           mainWindow_,
 | 
			
		||||
           [this]()
 | 
			
		||||
           {
 | 
			
		||||
              auto& mapSettings = settings::MapSettings::Instance();
 | 
			
		||||
              for (std::size_t i = 0; i < maps_.size(); i++)
 | 
			
		||||
              {
 | 
			
		||||
                 const auto& map = maps_.at(i);
 | 
			
		||||
                 mapSettings.radar_product_group(i).StageValue(
 | 
			
		||||
                    common::GetRadarProductGroupName(
 | 
			
		||||
                       map->GetRadarProductGroup()));
 | 
			
		||||
                 mapSettings.radar_product(i).StageValue(
 | 
			
		||||
                    map->GetRadarProductName());
 | 
			
		||||
              }
 | 
			
		||||
           });
 | 
			
		||||
   connect(level2ProductsWidget_,
 | 
			
		||||
           &ui::Level2ProductsWidget::RadarProductSelected,
 | 
			
		||||
           mainWindow_,
 | 
			
		||||
| 
						 | 
				
			
			@ -1509,6 +1528,8 @@ void MainWindowImpl::UpdateRadarProductSettings()
 | 
			
		|||
void MainWindowImpl::UpdateRadarSite()
 | 
			
		||||
{
 | 
			
		||||
   std::shared_ptr<config::RadarSite> radarSite = activeMap_->GetRadarSite();
 | 
			
		||||
   const std::string                  homeRadarSite =
 | 
			
		||||
      settings::GeneralSettings::Instance().default_radar_site().GetValue();
 | 
			
		||||
 | 
			
		||||
   if (radarSite != nullptr)
 | 
			
		||||
   {
 | 
			
		||||
| 
						 | 
				
			
			@ -1523,6 +1544,9 @@ void MainWindowImpl::UpdateRadarSite()
 | 
			
		|||
         radarSite->location_name().c_str());
 | 
			
		||||
 | 
			
		||||
      timelineManager_->SetRadarSite(radarSite->id());
 | 
			
		||||
 | 
			
		||||
      mainWindow_->ui->saveRadarProductsButton->setVisible(
 | 
			
		||||
            radarSite->id() == homeRadarSite);
 | 
			
		||||
   }
 | 
			
		||||
   else
 | 
			
		||||
   {
 | 
			
		||||
| 
						 | 
				
			
			@ -1530,6 +1554,7 @@ void MainWindowImpl::UpdateRadarSite()
 | 
			
		|||
 | 
			
		||||
      mainWindow_->ui->radarSiteValueLabel->setVisible(false);
 | 
			
		||||
      mainWindow_->ui->radarLocationLabel->setVisible(false);
 | 
			
		||||
      mainWindow_->ui->saveRadarProductsButton->setVisible(false);
 | 
			
		||||
 | 
			
		||||
      timelineManager_->SetRadarSite("?");
 | 
			
		||||
   }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -155,8 +155,8 @@
 | 
			
		|||
         <rect>
 | 
			
		||||
          <x>0</x>
 | 
			
		||||
          <y>0</y>
 | 
			
		||||
          <width>190</width>
 | 
			
		||||
          <height>680</height>
 | 
			
		||||
          <width>205</width>
 | 
			
		||||
          <height>701</height>
 | 
			
		||||
         </rect>
 | 
			
		||||
        </property>
 | 
			
		||||
        <layout class="QVBoxLayout" name="verticalLayout_6">
 | 
			
		||||
| 
						 | 
				
			
			@ -181,32 +181,24 @@
 | 
			
		|||
            <enum>QFrame::Shadow::Raised</enum>
 | 
			
		||||
           </property>
 | 
			
		||||
           <layout class="QGridLayout" name="gridLayout" columnstretch="0,0,0,0,0">
 | 
			
		||||
            <item row="0" column="2">
 | 
			
		||||
             <widget class="QLabel" name="radarSiteValueLabel">
 | 
			
		||||
              <property name="sizePolicy">
 | 
			
		||||
               <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
 | 
			
		||||
                <horstretch>0</horstretch>
 | 
			
		||||
                <verstretch>0</verstretch>
 | 
			
		||||
               </sizepolicy>
 | 
			
		||||
              </property>
 | 
			
		||||
            <item row="3" column="2" colspan="3">
 | 
			
		||||
             <widget class="QLabel" name="vcpValueLabel">
 | 
			
		||||
              <property name="text">
 | 
			
		||||
               <string notr="true">KLSX</string>
 | 
			
		||||
               <string notr="true">35</string>
 | 
			
		||||
              </property>
 | 
			
		||||
             </widget>
 | 
			
		||||
            </item>
 | 
			
		||||
            <item row="3" column="0" colspan="2">
 | 
			
		||||
             <widget class="QLabel" name="vcpLabel">
 | 
			
		||||
              <property name="sizePolicy">
 | 
			
		||||
               <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
 | 
			
		||||
                <horstretch>0</horstretch>
 | 
			
		||||
                <verstretch>0</verstretch>
 | 
			
		||||
               </sizepolicy>
 | 
			
		||||
              </property>
 | 
			
		||||
              <property name="toolTip">
 | 
			
		||||
               <string>Volume Coverage Pattern</string>
 | 
			
		||||
              </property>
 | 
			
		||||
            <item row="4" column="2" colspan="3">
 | 
			
		||||
             <widget class="QLabel" name="vcpDescriptionLabel">
 | 
			
		||||
              <property name="text">
 | 
			
		||||
               <string>VCP</string>
 | 
			
		||||
               <string>Clear Air Mode</string>
 | 
			
		||||
              </property>
 | 
			
		||||
             </widget>
 | 
			
		||||
            </item>
 | 
			
		||||
            <item row="1" column="2" colspan="3">
 | 
			
		||||
             <widget class="QLabel" name="radarLocationLabel">
 | 
			
		||||
              <property name="text">
 | 
			
		||||
               <string notr="true">St. Louis, MO</string>
 | 
			
		||||
              </property>
 | 
			
		||||
             </widget>
 | 
			
		||||
            </item>
 | 
			
		||||
| 
						 | 
				
			
			@ -271,34 +263,6 @@
 | 
			
		|||
              </layout>
 | 
			
		||||
             </widget>
 | 
			
		||||
            </item>
 | 
			
		||||
            <item row="0" column="0" colspan="2">
 | 
			
		||||
             <widget class="QLabel" name="radarSiteLabel">
 | 
			
		||||
              <property name="text">
 | 
			
		||||
               <string>Radar Site</string>
 | 
			
		||||
              </property>
 | 
			
		||||
             </widget>
 | 
			
		||||
            </item>
 | 
			
		||||
            <item row="1" column="2" colspan="3">
 | 
			
		||||
             <widget class="QLabel" name="radarLocationLabel">
 | 
			
		||||
              <property name="text">
 | 
			
		||||
               <string notr="true">St. Louis, MO</string>
 | 
			
		||||
              </property>
 | 
			
		||||
             </widget>
 | 
			
		||||
            </item>
 | 
			
		||||
            <item row="3" column="2" colspan="3">
 | 
			
		||||
             <widget class="QLabel" name="vcpValueLabel">
 | 
			
		||||
              <property name="text">
 | 
			
		||||
               <string notr="true">35</string>
 | 
			
		||||
              </property>
 | 
			
		||||
             </widget>
 | 
			
		||||
            </item>
 | 
			
		||||
            <item row="4" column="2" colspan="3">
 | 
			
		||||
             <widget class="QLabel" name="vcpDescriptionLabel">
 | 
			
		||||
              <property name="text">
 | 
			
		||||
               <string>Clear Air Mode</string>
 | 
			
		||||
              </property>
 | 
			
		||||
             </widget>
 | 
			
		||||
            </item>
 | 
			
		||||
            <item row="0" column="3">
 | 
			
		||||
             <widget class="QToolButton" name="radarSiteSelectButton">
 | 
			
		||||
              <property name="maximumSize">
 | 
			
		||||
| 
						 | 
				
			
			@ -312,6 +276,42 @@
 | 
			
		|||
              </property>
 | 
			
		||||
             </widget>
 | 
			
		||||
            </item>
 | 
			
		||||
            <item row="3" column="0" colspan="2">
 | 
			
		||||
             <widget class="QLabel" name="vcpLabel">
 | 
			
		||||
              <property name="sizePolicy">
 | 
			
		||||
               <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
 | 
			
		||||
                <horstretch>0</horstretch>
 | 
			
		||||
                <verstretch>0</verstretch>
 | 
			
		||||
               </sizepolicy>
 | 
			
		||||
              </property>
 | 
			
		||||
              <property name="toolTip">
 | 
			
		||||
               <string>Volume Coverage Pattern</string>
 | 
			
		||||
              </property>
 | 
			
		||||
              <property name="text">
 | 
			
		||||
               <string>VCP</string>
 | 
			
		||||
              </property>
 | 
			
		||||
             </widget>
 | 
			
		||||
            </item>
 | 
			
		||||
            <item row="0" column="0" colspan="2">
 | 
			
		||||
             <widget class="QLabel" name="radarSiteLabel">
 | 
			
		||||
              <property name="text">
 | 
			
		||||
               <string>Radar Site</string>
 | 
			
		||||
              </property>
 | 
			
		||||
             </widget>
 | 
			
		||||
            </item>
 | 
			
		||||
            <item row="0" column="2">
 | 
			
		||||
             <widget class="QLabel" name="radarSiteValueLabel">
 | 
			
		||||
              <property name="sizePolicy">
 | 
			
		||||
               <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
 | 
			
		||||
                <horstretch>0</horstretch>
 | 
			
		||||
                <verstretch>0</verstretch>
 | 
			
		||||
               </sizepolicy>
 | 
			
		||||
              </property>
 | 
			
		||||
              <property name="text">
 | 
			
		||||
               <string notr="true">KLSX</string>
 | 
			
		||||
              </property>
 | 
			
		||||
             </widget>
 | 
			
		||||
            </item>
 | 
			
		||||
           </layout>
 | 
			
		||||
          </widget>
 | 
			
		||||
         </item>
 | 
			
		||||
| 
						 | 
				
			
			@ -345,6 +345,13 @@
 | 
			
		|||
              </property>
 | 
			
		||||
             </widget>
 | 
			
		||||
            </item>
 | 
			
		||||
            <item>
 | 
			
		||||
             <widget class="QPushButton" name="saveRadarProductsButton">
 | 
			
		||||
              <property name="text">
 | 
			
		||||
               <string>Set As Default Products</string>
 | 
			
		||||
              </property>
 | 
			
		||||
             </widget>
 | 
			
		||||
            </item>
 | 
			
		||||
           </layout>
 | 
			
		||||
          </widget>
 | 
			
		||||
         </item>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -76,7 +76,7 @@ public:
 | 
			
		|||
            {
 | 
			
		||||
               common::RadarProductGroup radarProductGroup =
 | 
			
		||||
                  common::GetRadarProductGroup(
 | 
			
		||||
                     map_.at(i).radarProductGroup_.GetValue());
 | 
			
		||||
                     map_.at(i).radarProductGroup_.GetStagedOrValue());
 | 
			
		||||
 | 
			
		||||
               if (radarProductGroup == common::RadarProductGroup::Level2)
 | 
			
		||||
               {
 | 
			
		||||
| 
						 | 
				
			
			@ -193,6 +193,8 @@ bool MapSettings::Shutdown()
 | 
			
		|||
 | 
			
		||||
      dataChanged |= mapRecordSettings.mapStyle_.Commit();
 | 
			
		||||
      dataChanged |= mapRecordSettings.smoothingEnabled_.Commit();
 | 
			
		||||
      dataChanged |= mapRecordSettings.radarProductGroup_.Commit();
 | 
			
		||||
      dataChanged |= mapRecordSettings.radarProduct_.Commit();
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   return dataChanged;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue