mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 01:50:06 +00:00 
			
		
		
		
	Add tooltip method to settings
This commit is contained in:
		
							parent
							
								
									9ea3ed47a6
								
							
						
					
					
						commit
						23740d2601
					
				
					 9 changed files with 194 additions and 23 deletions
				
			
		|  | @ -9,6 +9,7 @@ | |||
| #include <scwx/qt/settings/settings_interface.hpp> | ||||
| #include <scwx/qt/settings/text_settings.hpp> | ||||
| #include <scwx/qt/types/alert_types.hpp> | ||||
| #include <scwx/qt/types/text_types.hpp> | ||||
| #include <scwx/qt/ui/placefile_settings_widget.hpp> | ||||
| #include <scwx/qt/ui/radar_site_dialog.hpp> | ||||
| #include <scwx/qt/util/color.hpp> | ||||
|  | @ -94,7 +95,8 @@ public: | |||
|           &defaultAlertAction_, | ||||
|           &updateNotificationsEnabled_, | ||||
|           &debugEnabled_, | ||||
|           &hoverTextWrap_}} | ||||
|           &hoverTextWrap_, | ||||
|           &tooltipMethod_}} | ||||
|    { | ||||
|       // Configure default alert phenomena colors
 | ||||
|       auto& paletteSettings = manager::SettingsManager::palette_settings(); | ||||
|  | @ -166,6 +168,7 @@ public: | |||
|       inactiveAlertColors_ {}; | ||||
| 
 | ||||
|    settings::SettingsInterface<std::int64_t> hoverTextWrap_ {}; | ||||
|    settings::SettingsInterface<std::string>  tooltipMethod_ {}; | ||||
| 
 | ||||
|    std::vector<settings::SettingsInterfaceBase*> settings_; | ||||
| }; | ||||
|  | @ -645,6 +648,42 @@ void SettingsDialogImpl::SetupTextTab() | |||
|    hoverTextWrap_.SetSettingsVariable(textSettings.hover_text_wrap()); | ||||
|    hoverTextWrap_.SetEditWidget(self_->ui->hoverTextWrapSpinBox); | ||||
|    hoverTextWrap_.SetResetButton(self_->ui->resetHoverTextWrapButton); | ||||
| 
 | ||||
|    for (const auto& tooltipMethod : types::TooltipMethodIterator()) | ||||
|    { | ||||
|       self_->ui->tooltipMethodComboBox->addItem( | ||||
|          QString::fromStdString(types::GetTooltipMethodName(tooltipMethod))); | ||||
|    } | ||||
| 
 | ||||
|    tooltipMethod_.SetSettingsVariable(textSettings.tooltip_method()); | ||||
|    tooltipMethod_.SetMapFromValueFunction( | ||||
|       [](const std::string& text) -> std::string | ||||
|       { | ||||
|          for (types::TooltipMethod tooltipMethod : | ||||
|               types::TooltipMethodIterator()) | ||||
|          { | ||||
|             const std::string tooltipMethodName = | ||||
|                types::GetTooltipMethodName(tooltipMethod); | ||||
| 
 | ||||
|             if (boost::iequals(text, tooltipMethodName)) | ||||
|             { | ||||
|                // Return tooltip method label
 | ||||
|                return tooltipMethodName; | ||||
|             } | ||||
|          } | ||||
| 
 | ||||
|          // Tooltip method label not found, return unknown
 | ||||
|          return "?"; | ||||
|       }); | ||||
|    tooltipMethod_.SetMapToValueFunction( | ||||
|       [](std::string text) -> std::string | ||||
|       { | ||||
|          // Convert label to lower case and return
 | ||||
|          boost::to_lower(text); | ||||
|          return text; | ||||
|       }); | ||||
|    tooltipMethod_.SetEditWidget(self_->ui->tooltipMethodComboBox); | ||||
|    tooltipMethod_.SetResetButton(self_->ui->resetTooltipMethodButton); | ||||
| } | ||||
| 
 | ||||
| QImage SettingsDialogImpl::GenerateColorTableImage( | ||||
|  |  | |||
|  | @ -459,21 +459,21 @@ | |||
|              <property name="bottomMargin"> | ||||
|               <number>0</number> | ||||
|              </property> | ||||
|              <item row="0" column="0"> | ||||
|              <item row="1" column="0"> | ||||
|               <widget class="QLabel" name="label_8"> | ||||
|                <property name="text"> | ||||
|                 <string>Hover text character wrap (0 to disable)</string> | ||||
|                </property> | ||||
|               </widget> | ||||
|              </item> | ||||
|              <item row="0" column="1"> | ||||
|              <item row="1" column="1"> | ||||
|               <widget class="QSpinBox" name="hoverTextWrapSpinBox"> | ||||
|                <property name="maximum"> | ||||
|                 <number>999</number> | ||||
|                </property> | ||||
|               </widget> | ||||
|              </item> | ||||
|              <item row="0" column="2"> | ||||
|              <item row="1" column="2"> | ||||
|               <widget class="QToolButton" name="resetHoverTextWrapButton"> | ||||
|                <property name="text"> | ||||
|                 <string>...</string> | ||||
|  | @ -484,6 +484,27 @@ | |||
|                </property> | ||||
|               </widget> | ||||
|              </item> | ||||
|              <item row="0" column="0"> | ||||
|               <widget class="QLabel" name="label_9"> | ||||
|                <property name="text"> | ||||
|                 <string>Tooltip Method</string> | ||||
|                </property> | ||||
|               </widget> | ||||
|              </item> | ||||
|              <item row="0" column="1"> | ||||
|               <widget class="QComboBox" name="tooltipMethodComboBox"/> | ||||
|              </item> | ||||
|              <item row="0" column="2"> | ||||
|               <widget class="QToolButton" name="resetTooltipMethodButton"> | ||||
|                <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> | ||||
|             </layout> | ||||
|            </widget> | ||||
|           </item> | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat