mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 07:00:06 +00:00 
			
		
		
		
	Add reset buttons to settings dialog
This commit is contained in:
		
							parent
							
								
									7522162095
								
							
						
					
					
						commit
						463acd6b94
					
				
					 4 changed files with 99 additions and 19 deletions
				
			
		
							
								
								
									
										1
									
								
								scwx-qt/res/icons/font-awesome-6/rotate-left-solid.svg
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								scwx-qt/res/icons/font-awesome-6/rotate-left-solid.svg
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1 @@ | ||||||
|  | <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Pro 6.2.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. --><path d="M48.5 224H40c-13.3 0-24-10.7-24-24V72c0-9.7 5.8-18.5 14.8-22.2s19.3-1.7 26.2 5.2L98.6 96.6c87.6-86.5 228.7-86.2 315.8 1c87.5 87.5 87.5 229.3 0 316.8s-229.3 87.5-316.8 0c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0c62.5 62.5 163.8 62.5 226.3 0s62.5-163.8 0-226.3c-62.2-62.2-162.7-62.5-225.3-1L185 183c6.9 6.9 8.9 17.2 5.2 26.2s-12.5 14.8-22.2 14.8H48.5z"/></svg> | ||||||
| After Width: | Height: | Size: 600 B | 
|  | @ -19,6 +19,7 @@ | ||||||
|         <file>res/icons/font-awesome-6/forward-step-solid.svg</file> |         <file>res/icons/font-awesome-6/forward-step-solid.svg</file> | ||||||
|         <file>res/icons/font-awesome-6/gears-solid.svg</file> |         <file>res/icons/font-awesome-6/gears-solid.svg</file> | ||||||
|         <file>res/icons/font-awesome-6/palette-solid.svg</file> |         <file>res/icons/font-awesome-6/palette-solid.svg</file> | ||||||
|  |         <file>res/icons/font-awesome-6/rotate-left-solid.svg</file> | ||||||
|         <file>res/icons/font-awesome-6/sliders-solid.svg</file> |         <file>res/icons/font-awesome-6/sliders-solid.svg</file> | ||||||
|         <file>res/icons/font-awesome-6/square-minus-regular.svg</file> |         <file>res/icons/font-awesome-6/square-minus-regular.svg</file> | ||||||
|         <file>res/icons/font-awesome-6/square-plus-regular.svg</file> |         <file>res/icons/font-awesome-6/square-plus-regular.svg</file> | ||||||
|  |  | ||||||
|  | @ -36,7 +36,7 @@ static const std::array<std::pair<std::string, std::string>, 17> | ||||||
|                       std::pair {"STP", "STP"}, |                       std::pair {"STP", "STP"}, | ||||||
|                       std::pair {"STPIN", "STPIN"}, |                       std::pair {"STPIN", "STPIN"}, | ||||||
|                       std::pair {"VIL", "VIL"}, |                       std::pair {"VIL", "VIL"}, | ||||||
|                       std::pair {"?", "Default"}}; |                       std::pair {"???", "Default"}}; | ||||||
| 
 | 
 | ||||||
| class SettingsDialogImpl | class SettingsDialogImpl | ||||||
| { | { | ||||||
|  | @ -44,6 +44,7 @@ public: | ||||||
|    explicit SettingsDialogImpl(SettingsDialog* self) : self_ {self} {} |    explicit SettingsDialogImpl(SettingsDialog* self) : self_ {self} {} | ||||||
|    ~SettingsDialogImpl() = default; |    ~SettingsDialogImpl() = default; | ||||||
| 
 | 
 | ||||||
|  |    void SetupGeneralTab(); | ||||||
|    void SetupPalettesColorTablesTab(); |    void SetupPalettesColorTablesTab(); | ||||||
|    void SetupPalettesAlertsTab(); |    void SetupPalettesAlertsTab(); | ||||||
| 
 | 
 | ||||||
|  | @ -57,6 +58,9 @@ SettingsDialog::SettingsDialog(QWidget* parent) : | ||||||
| { | { | ||||||
|    ui->setupUi(this); |    ui->setupUi(this); | ||||||
| 
 | 
 | ||||||
|  |    // General
 | ||||||
|  |    p->SetupGeneralTab(); | ||||||
|  | 
 | ||||||
|    // Palettes > Color Tables
 |    // Palettes > Color Tables
 | ||||||
|    p->SetupPalettesColorTablesTab(); |    p->SetupPalettesColorTablesTab(); | ||||||
| 
 | 
 | ||||||
|  | @ -74,6 +78,14 @@ SettingsDialog::~SettingsDialog() | ||||||
|    delete ui; |    delete ui; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | void SettingsDialogImpl::SetupGeneralTab() | ||||||
|  | { | ||||||
|  |    self_->ui->resetRadarSiteButton->setVisible(false); | ||||||
|  |    self_->ui->resetGridWidthButton->setVisible(false); | ||||||
|  |    self_->ui->resetGridHeightButton->setVisible(false); | ||||||
|  |    self_->ui->resetMapboxApiKeyButton->setVisible(false); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| void SettingsDialogImpl::SetupPalettesColorTablesTab() | void SettingsDialogImpl::SetupPalettesColorTablesTab() | ||||||
| { | { | ||||||
|    // Palettes > Color Tables
 |    // Palettes > Color Tables
 | ||||||
|  | @ -83,10 +95,17 @@ void SettingsDialogImpl::SetupPalettesColorTablesTab() | ||||||
|    int colorTableRow = 0; |    int colorTableRow = 0; | ||||||
|    for (auto& colorTableType : kColorTableTypes_) |    for (auto& colorTableType : kColorTableTypes_) | ||||||
|    { |    { | ||||||
|  |       QToolButton* resetButton = new QToolButton(self_); | ||||||
|  | 
 | ||||||
|  |       resetButton->setIcon( | ||||||
|  |          QIcon {":/res/icons/font-awesome-6/rotate-left-solid.svg"}); | ||||||
|  |       resetButton->setVisible(false); | ||||||
|  | 
 | ||||||
|       colorTableLayout->addWidget( |       colorTableLayout->addWidget( | ||||||
|          new QLabel(colorTableType.second.c_str(), self_), colorTableRow, 0); |          new QLabel(colorTableType.second.c_str(), self_), colorTableRow, 0); | ||||||
|       colorTableLayout->addWidget(new QLineEdit(self_), colorTableRow, 1); |       colorTableLayout->addWidget(new QLineEdit(self_), colorTableRow, 1); | ||||||
|       colorTableLayout->addWidget(new QToolButton(self_), colorTableRow, 2); |       colorTableLayout->addWidget(new QToolButton(self_), colorTableRow, 2); | ||||||
|  |       colorTableLayout->addWidget(resetButton, colorTableRow, 3); | ||||||
|       ++colorTableRow; |       ++colorTableRow; | ||||||
|    } |    } | ||||||
| } | } | ||||||
|  | @ -119,6 +138,7 @@ void SettingsDialogImpl::SetupPalettesAlertsTab() | ||||||
| 
 | 
 | ||||||
|       QToolButton* activeButton   = new QToolButton(self_); |       QToolButton* activeButton   = new QToolButton(self_); | ||||||
|       QToolButton* inactiveButton = new QToolButton(self_); |       QToolButton* inactiveButton = new QToolButton(self_); | ||||||
|  |       QToolButton* resetButton    = new QToolButton(self_); | ||||||
| 
 | 
 | ||||||
|       activeFrame->setMinimumWidth(24); |       activeFrame->setMinimumWidth(24); | ||||||
|       inactiveFrame->setMinimumWidth(24); |       inactiveFrame->setMinimumWidth(24); | ||||||
|  | @ -127,6 +147,10 @@ void SettingsDialogImpl::SetupPalettesAlertsTab() | ||||||
|          QIcon {":/res/icons/font-awesome-6/palette-solid.svg"}); |          QIcon {":/res/icons/font-awesome-6/palette-solid.svg"}); | ||||||
|       inactiveButton->setIcon( |       inactiveButton->setIcon( | ||||||
|          QIcon {":/res/icons/font-awesome-6/palette-solid.svg"}); |          QIcon {":/res/icons/font-awesome-6/palette-solid.svg"}); | ||||||
|  |       resetButton->setIcon( | ||||||
|  |          QIcon {":/res/icons/font-awesome-6/rotate-left-solid.svg"}); | ||||||
|  | 
 | ||||||
|  |       resetButton->setVisible(false); | ||||||
| 
 | 
 | ||||||
|       alertsLayout->addWidget( |       alertsLayout->addWidget( | ||||||
|          new QLabel(QObject::tr(awips::GetPhenomenonText(phenomenon).c_str()), |          new QLabel(QObject::tr(awips::GetPhenomenonText(phenomenon).c_str()), | ||||||
|  | @ -139,6 +163,7 @@ void SettingsDialogImpl::SetupPalettesAlertsTab() | ||||||
|       alertsLayout->addWidget(inactiveFrame, alertsRow, 4); |       alertsLayout->addWidget(inactiveFrame, alertsRow, 4); | ||||||
|       alertsLayout->addWidget(new QLineEdit(self_), alertsRow, 5); |       alertsLayout->addWidget(new QLineEdit(self_), alertsRow, 5); | ||||||
|       alertsLayout->addWidget(inactiveButton, alertsRow, 6); |       alertsLayout->addWidget(inactiveButton, alertsRow, 6); | ||||||
|  |       alertsLayout->addWidget(resetButton, alertsRow, 7); | ||||||
|       ++alertsRow; |       ++alertsRow; | ||||||
|    } |    } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -84,7 +84,7 @@ | ||||||
|          </sizepolicy> |          </sizepolicy> | ||||||
|         </property> |         </property> | ||||||
|         <property name="currentIndex"> |         <property name="currentIndex"> | ||||||
|          <number>1</number> |          <number>0</number> | ||||||
|         </property> |         </property> | ||||||
|         <widget class="QWidget" name="general"> |         <widget class="QWidget" name="general"> | ||||||
|          <layout class="QVBoxLayout" name="verticalLayout_2"> |          <layout class="QVBoxLayout" name="verticalLayout_2"> | ||||||
|  | @ -96,7 +96,7 @@ | ||||||
|             <property name="frameShadow"> |             <property name="frameShadow"> | ||||||
|              <enum>QFrame::Raised</enum> |              <enum>QFrame::Raised</enum> | ||||||
|             </property> |             </property> | ||||||
|             <layout class="QFormLayout" name="formLayout"> |             <layout class="QGridLayout" name="gridLayout_4"> | ||||||
|              <property name="leftMargin"> |              <property name="leftMargin"> | ||||||
|               <number>0</number> |               <number>0</number> | ||||||
|              </property> |              </property> | ||||||
|  | @ -116,19 +116,6 @@ | ||||||
|                </property> |                </property> | ||||||
|               </widget> |               </widget> | ||||||
|              </item> |              </item> | ||||||
|              <item row="0" column="1"> |  | ||||||
|               <widget class="QComboBox" name="radarSiteComboBox"/> |  | ||||||
|              </item> |  | ||||||
|              <item row="1" column="0"> |  | ||||||
|               <widget class="QLabel" name="label_2"> |  | ||||||
|                <property name="text"> |  | ||||||
|                 <string>Grid Width</string> |  | ||||||
|                </property> |  | ||||||
|               </widget> |  | ||||||
|              </item> |  | ||||||
|              <item row="1" column="1"> |  | ||||||
|               <widget class="QSpinBox" name="gridWidthSpinBox"/> |  | ||||||
|              </item> |  | ||||||
|              <item row="2" column="0"> |              <item row="2" column="0"> | ||||||
|               <widget class="QLabel" name="label_3"> |               <widget class="QLabel" name="label_3"> | ||||||
|                <property name="text"> |                <property name="text"> | ||||||
|  | @ -139,6 +126,59 @@ | ||||||
|              <item row="2" column="1"> |              <item row="2" column="1"> | ||||||
|               <widget class="QSpinBox" name="gridHeightSpinBox"/> |               <widget class="QSpinBox" name="gridHeightSpinBox"/> | ||||||
|              </item> |              </item> | ||||||
|  |              <item row="1" column="2"> | ||||||
|  |               <widget class="QToolButton" name="resetGridWidthButton"> | ||||||
|  |                <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="1"> | ||||||
|  |               <widget class="QLineEdit" name="mapboxApiKeyLineEdit"/> | ||||||
|  |              </item> | ||||||
|  |              <item row="3" column="2"> | ||||||
|  |               <widget class="QToolButton" name="resetMapboxApiKeyButton"> | ||||||
|  |                <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="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> | ||||||
|  |              <item row="1" column="1"> | ||||||
|  |               <widget class="QSpinBox" name="gridWidthSpinBox"/> | ||||||
|  |              </item> | ||||||
|  |              <item row="0" column="1"> | ||||||
|  |               <widget class="QComboBox" name="radarSiteComboBox"/> | ||||||
|  |              </item> | ||||||
|  |              <item row="2" column="2"> | ||||||
|  |               <widget class="QToolButton" name="resetGridHeightButton"> | ||||||
|  |                <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="0"> |              <item row="3" column="0"> | ||||||
|               <widget class="QLabel" name="label_4"> |               <widget class="QLabel" name="label_4"> | ||||||
|                <property name="text"> |                <property name="text"> | ||||||
|  | @ -146,8 +186,12 @@ | ||||||
|                </property> |                </property> | ||||||
|               </widget> |               </widget> | ||||||
|              </item> |              </item> | ||||||
|              <item row="3" column="1"> |              <item row="1" column="0"> | ||||||
|               <widget class="QLineEdit" name="mapboxApiKeyLineEdit"/> |               <widget class="QLabel" name="label_2"> | ||||||
|  |                <property name="text"> | ||||||
|  |                 <string>Grid Width</string> | ||||||
|  |                </property> | ||||||
|  |               </widget> | ||||||
|              </item> |              </item> | ||||||
|             </layout> |             </layout> | ||||||
|            </widget> |            </widget> | ||||||
|  | @ -179,7 +223,7 @@ | ||||||
|           <item row="0" column="0"> |           <item row="0" column="0"> | ||||||
|            <widget class="QTabWidget" name="tabWidget"> |            <widget class="QTabWidget" name="tabWidget"> | ||||||
|             <property name="currentIndex"> |             <property name="currentIndex"> | ||||||
|              <number>1</number> |              <number>0</number> | ||||||
|             </property> |             </property> | ||||||
|             <widget class="QWidget" name="tab"> |             <widget class="QWidget" name="tab"> | ||||||
|              <attribute name="title"> |              <attribute name="title"> | ||||||
|  | @ -284,6 +328,15 @@ | ||||||
|     </widget> |     </widget> | ||||||
|    </item> |    </item> | ||||||
|   </layout> |   </layout> | ||||||
|  |   <action name="actionReset"> | ||||||
|  |    <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> | ||||||
|  |    <property name="text"> | ||||||
|  |     <string>Reset</string> | ||||||
|  |    </property> | ||||||
|  |   </action> | ||||||
|  </widget> |  </widget> | ||||||
|  <resources> |  <resources> | ||||||
|   <include location="../../../../scwx-qt.qrc"/> |   <include location="../../../../scwx-qt.qrc"/> | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat