mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 03:50:05 +00:00 
			
		
		
		
	Add a label to the location marker settings widget to indicate the existance of hotkeys for adding/editing location markers
This commit is contained in:
		
							parent
							
								
									4bd749d976
								
							
						
					
					
						commit
						c3d39e2571
					
				
					 2 changed files with 51 additions and 10 deletions
				
			
		|  | @ -3,17 +3,15 @@ | ||||||
| 
 | 
 | ||||||
| #include <scwx/qt/manager/marker_manager.hpp> | #include <scwx/qt/manager/marker_manager.hpp> | ||||||
| #include <scwx/qt/model/marker_model.hpp> | #include <scwx/qt/model/marker_model.hpp> | ||||||
|  | #include <scwx/qt/settings/hotkey_settings.hpp> | ||||||
|  | #include <scwx/qt/types/hotkey_types.hpp> | ||||||
| #include <scwx/qt/types/qt_types.hpp> | #include <scwx/qt/types/qt_types.hpp> | ||||||
| #include <scwx/qt/ui/edit_marker_dialog.hpp> | #include <scwx/qt/ui/edit_marker_dialog.hpp> | ||||||
| #include <scwx/util/logger.hpp> | #include <scwx/util/logger.hpp> | ||||||
| 
 | 
 | ||||||
| #include <QSortFilterProxyModel> | #include <QSortFilterProxyModel> | ||||||
| 
 | 
 | ||||||
| namespace scwx | namespace scwx::qt::ui | ||||||
| { |  | ||||||
| namespace qt |  | ||||||
| { |  | ||||||
| namespace ui |  | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = "scwx::qt::ui::marker_settings_widget"; | static const std::string logPrefix_ = "scwx::qt::ui::marker_settings_widget"; | ||||||
|  | @ -34,6 +32,7 @@ public: | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|    void ConnectSignals(); |    void ConnectSignals(); | ||||||
|  |    void UpdateHotkeyLabel(); | ||||||
| 
 | 
 | ||||||
|    MarkerSettingsWidget*                   self_; |    MarkerSettingsWidget*                   self_; | ||||||
|    model::MarkerModel*                     markerModel_; |    model::MarkerModel*                     markerModel_; | ||||||
|  | @ -41,9 +40,9 @@ public: | ||||||
|    std::shared_ptr<manager::MarkerManager> markerManager_ { |    std::shared_ptr<manager::MarkerManager> markerManager_ { | ||||||
|       manager::MarkerManager::Instance()}; |       manager::MarkerManager::Instance()}; | ||||||
|    std::shared_ptr<ui::EditMarkerDialog> editMarkerDialog_ {nullptr}; |    std::shared_ptr<ui::EditMarkerDialog> editMarkerDialog_ {nullptr}; | ||||||
|  |    boost::signals2::scoped_connection    hotkeyConnection_; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| MarkerSettingsWidget::MarkerSettingsWidget(QWidget* parent) : | MarkerSettingsWidget::MarkerSettingsWidget(QWidget* parent) : | ||||||
|     QFrame(parent), |     QFrame(parent), | ||||||
|     p {std::make_unique<MarkerSettingsWidgetImpl>(this)}, |     p {std::make_unique<MarkerSettingsWidgetImpl>(this)}, | ||||||
|  | @ -53,6 +52,7 @@ MarkerSettingsWidget::MarkerSettingsWidget(QWidget* parent) : | ||||||
| 
 | 
 | ||||||
|    ui->removeButton->setEnabled(false); |    ui->removeButton->setEnabled(false); | ||||||
|    ui->markerView->setModel(p->proxyModel_); |    ui->markerView->setModel(p->proxyModel_); | ||||||
|  |    p->UpdateHotkeyLabel(); | ||||||
| 
 | 
 | ||||||
|    p->editMarkerDialog_ = std::make_shared<ui::EditMarkerDialog>(this); |    p->editMarkerDialog_ = std::make_shared<ui::EditMarkerDialog>(this); | ||||||
| 
 | 
 | ||||||
|  | @ -128,8 +128,22 @@ void MarkerSettingsWidgetImpl::ConnectSignals() | ||||||
|                        editMarkerDialog_->setup(id.toULongLong()); |                        editMarkerDialog_->setup(id.toULongLong()); | ||||||
|                        editMarkerDialog_->show(); |                        editMarkerDialog_->show(); | ||||||
|                     }); |                     }); | ||||||
|  |    hotkeyConnection_ = settings::HotkeySettings::Instance() | ||||||
|  |                           .hotkey(types::Hotkey::AddLocationMarker) | ||||||
|  |                           .changed_signal() | ||||||
|  |                           .connect([this]() { UpdateHotkeyLabel(); }); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| } // namespace ui
 | void MarkerSettingsWidgetImpl::UpdateHotkeyLabel() | ||||||
| } // namespace qt
 | { | ||||||
| } // namespace scwx
 |    self_->ui->hotkeyLabel->setText( | ||||||
|  |       fmt::format( | ||||||
|  |          "A Location Marker can be placed at the location under the cursor by " | ||||||
|  |          "pressing \"{}\" and edited by right clicking it on the map.", | ||||||
|  |          settings::HotkeySettings::Instance() | ||||||
|  |             .hotkey(types::Hotkey::AddLocationMarker) | ||||||
|  |             .GetValue()) | ||||||
|  |          .c_str()); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | } // namespace scwx::qt::ui
 | ||||||
|  |  | ||||||
|  | @ -14,6 +14,33 @@ | ||||||
|    <string>Frame</string> |    <string>Frame</string> | ||||||
|   </property> |   </property> | ||||||
|   <layout class="QVBoxLayout" name="verticalLayout"> |   <layout class="QVBoxLayout" name="verticalLayout"> | ||||||
|  |    <property name="spacing"> | ||||||
|  |     <number>0</number> | ||||||
|  |    </property> | ||||||
|  |    <item> | ||||||
|  |     <widget class="QLabel" name="hotkeyLabel"> | ||||||
|  |      <property name="sizePolicy"> | ||||||
|  |       <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> | ||||||
|  |        <horstretch>0</horstretch> | ||||||
|  |        <verstretch>0</verstretch> | ||||||
|  |       </sizepolicy> | ||||||
|  |      </property> | ||||||
|  |      <property name="font"> | ||||||
|  |       <font> | ||||||
|  |        <pointsize>9</pointsize> | ||||||
|  |       </font> | ||||||
|  |      </property> | ||||||
|  |      <property name="frameShape"> | ||||||
|  |       <enum>QFrame::Shape::NoFrame</enum> | ||||||
|  |      </property> | ||||||
|  |      <property name="text"> | ||||||
|  |       <string/> | ||||||
|  |      </property> | ||||||
|  |      <property name="textFormat"> | ||||||
|  |       <enum>Qt::TextFormat::PlainText</enum> | ||||||
|  |      </property> | ||||||
|  |     </widget> | ||||||
|  |    </item> | ||||||
|    <item> |    <item> | ||||||
|     <widget class="QTreeView" name="markerView"> |     <widget class="QTreeView" name="markerView"> | ||||||
|      <property name="alternatingRowColors"> |      <property name="alternatingRowColors"> | ||||||
|  | @ -34,7 +61,7 @@ | ||||||
|        <number>0</number> |        <number>0</number> | ||||||
|       </property> |       </property> | ||||||
|       <property name="topMargin"> |       <property name="topMargin"> | ||||||
|        <number>0</number> |        <number>6</number> | ||||||
|       </property> |       </property> | ||||||
|       <property name="rightMargin"> |       <property name="rightMargin"> | ||||||
|        <number>0</number> |        <number>0</number> | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 AdenKoperczak
						AdenKoperczak