mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 00:40: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
				
			
		|  | @ -36,7 +36,7 @@ static const std::array<std::pair<std::string, std::string>, 17> | |||
|                       std::pair {"STP", "STP"}, | ||||
|                       std::pair {"STPIN", "STPIN"}, | ||||
|                       std::pair {"VIL", "VIL"}, | ||||
|                       std::pair {"?", "Default"}}; | ||||
|                       std::pair {"???", "Default"}}; | ||||
| 
 | ||||
| class SettingsDialogImpl | ||||
| { | ||||
|  | @ -44,6 +44,7 @@ public: | |||
|    explicit SettingsDialogImpl(SettingsDialog* self) : self_ {self} {} | ||||
|    ~SettingsDialogImpl() = default; | ||||
| 
 | ||||
|    void SetupGeneralTab(); | ||||
|    void SetupPalettesColorTablesTab(); | ||||
|    void SetupPalettesAlertsTab(); | ||||
| 
 | ||||
|  | @ -57,6 +58,9 @@ SettingsDialog::SettingsDialog(QWidget* parent) : | |||
| { | ||||
|    ui->setupUi(this); | ||||
| 
 | ||||
|    // General
 | ||||
|    p->SetupGeneralTab(); | ||||
| 
 | ||||
|    // Palettes > Color Tables
 | ||||
|    p->SetupPalettesColorTablesTab(); | ||||
| 
 | ||||
|  | @ -74,6 +78,14 @@ SettingsDialog::~SettingsDialog() | |||
|    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() | ||||
| { | ||||
|    // Palettes > Color Tables
 | ||||
|  | @ -83,10 +95,17 @@ void SettingsDialogImpl::SetupPalettesColorTablesTab() | |||
|    int colorTableRow = 0; | ||||
|    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( | ||||
|          new QLabel(colorTableType.second.c_str(), self_), colorTableRow, 0); | ||||
|       colorTableLayout->addWidget(new QLineEdit(self_), colorTableRow, 1); | ||||
|       colorTableLayout->addWidget(new QToolButton(self_), colorTableRow, 2); | ||||
|       colorTableLayout->addWidget(resetButton, colorTableRow, 3); | ||||
|       ++colorTableRow; | ||||
|    } | ||||
| } | ||||
|  | @ -119,6 +138,7 @@ void SettingsDialogImpl::SetupPalettesAlertsTab() | |||
| 
 | ||||
|       QToolButton* activeButton   = new QToolButton(self_); | ||||
|       QToolButton* inactiveButton = new QToolButton(self_); | ||||
|       QToolButton* resetButton    = new QToolButton(self_); | ||||
| 
 | ||||
|       activeFrame->setMinimumWidth(24); | ||||
|       inactiveFrame->setMinimumWidth(24); | ||||
|  | @ -127,6 +147,10 @@ void SettingsDialogImpl::SetupPalettesAlertsTab() | |||
|          QIcon {":/res/icons/font-awesome-6/palette-solid.svg"}); | ||||
|       inactiveButton->setIcon( | ||||
|          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( | ||||
|          new QLabel(QObject::tr(awips::GetPhenomenonText(phenomenon).c_str()), | ||||
|  | @ -139,6 +163,7 @@ void SettingsDialogImpl::SetupPalettesAlertsTab() | |||
|       alertsLayout->addWidget(inactiveFrame, alertsRow, 4); | ||||
|       alertsLayout->addWidget(new QLineEdit(self_), alertsRow, 5); | ||||
|       alertsLayout->addWidget(inactiveButton, alertsRow, 6); | ||||
|       alertsLayout->addWidget(resetButton, alertsRow, 7); | ||||
|       ++alertsRow; | ||||
|    } | ||||
| } | ||||
|  |  | |||
|  | @ -84,7 +84,7 @@ | |||
|          </sizepolicy> | ||||
|         </property> | ||||
|         <property name="currentIndex"> | ||||
|          <number>1</number> | ||||
|          <number>0</number> | ||||
|         </property> | ||||
|         <widget class="QWidget" name="general"> | ||||
|          <layout class="QVBoxLayout" name="verticalLayout_2"> | ||||
|  | @ -96,7 +96,7 @@ | |||
|             <property name="frameShadow"> | ||||
|              <enum>QFrame::Raised</enum> | ||||
|             </property> | ||||
|             <layout class="QFormLayout" name="formLayout"> | ||||
|             <layout class="QGridLayout" name="gridLayout_4"> | ||||
|              <property name="leftMargin"> | ||||
|               <number>0</number> | ||||
|              </property> | ||||
|  | @ -116,19 +116,6 @@ | |||
|                </property> | ||||
|               </widget> | ||||
|              </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"> | ||||
|               <widget class="QLabel" name="label_3"> | ||||
|                <property name="text"> | ||||
|  | @ -139,6 +126,59 @@ | |||
|              <item row="2" column="1"> | ||||
|               <widget class="QSpinBox" name="gridHeightSpinBox"/> | ||||
|              </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"> | ||||
|               <widget class="QLabel" name="label_4"> | ||||
|                <property name="text"> | ||||
|  | @ -146,8 +186,12 @@ | |||
|                </property> | ||||
|               </widget> | ||||
|              </item> | ||||
|              <item row="3" column="1"> | ||||
|               <widget class="QLineEdit" name="mapboxApiKeyLineEdit"/> | ||||
|              <item row="1" column="0"> | ||||
|               <widget class="QLabel" name="label_2"> | ||||
|                <property name="text"> | ||||
|                 <string>Grid Width</string> | ||||
|                </property> | ||||
|               </widget> | ||||
|              </item> | ||||
|             </layout> | ||||
|            </widget> | ||||
|  | @ -179,7 +223,7 @@ | |||
|           <item row="0" column="0"> | ||||
|            <widget class="QTabWidget" name="tabWidget"> | ||||
|             <property name="currentIndex"> | ||||
|              <number>1</number> | ||||
|              <number>0</number> | ||||
|             </property> | ||||
|             <widget class="QWidget" name="tab"> | ||||
|              <attribute name="title"> | ||||
|  | @ -284,6 +328,15 @@ | |||
|     </widget> | ||||
|    </item> | ||||
|   </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> | ||||
|  <resources> | ||||
|   <include location="../../../../scwx-qt.qrc"/> | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat