mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 03:40:05 +00:00 
			
		
		
		
	Add open URL dialog to add a placefile
This commit is contained in:
		
							parent
							
								
									4c685e5abb
								
							
						
					
					
						commit
						157500e20a
					
				
					 5 changed files with 292 additions and 0 deletions
				
			
		|  | @ -1,6 +1,9 @@ | |||
| #include "placefile_settings_widget.hpp" | ||||
| #include "ui_placefile_settings_widget.h" | ||||
| 
 | ||||
| #include <scwx/qt/ui/open_url_dialog.hpp> | ||||
| #include <scwx/util/logger.hpp> | ||||
| 
 | ||||
| namespace scwx | ||||
| { | ||||
| namespace qt | ||||
|  | @ -8,6 +11,9 @@ namespace qt | |||
| namespace ui | ||||
| { | ||||
| 
 | ||||
| static const std::string logPrefix_ = "scwx::qt::ui::placefile_settings_widget"; | ||||
| static const auto        logger_    = scwx::util::Logger::Create(logPrefix_); | ||||
| 
 | ||||
| class PlacefileSettingsWidgetImpl | ||||
| { | ||||
| public: | ||||
|  | @ -17,7 +23,10 @@ public: | |||
|    } | ||||
|    ~PlacefileSettingsWidgetImpl() = default; | ||||
| 
 | ||||
|    void ConnectSignals(); | ||||
| 
 | ||||
|    PlacefileSettingsWidget* self_; | ||||
|    OpenUrlDialog*           openUrlDialog_ {nullptr}; | ||||
| }; | ||||
| 
 | ||||
| PlacefileSettingsWidget::PlacefileSettingsWidget(QWidget* parent) : | ||||
|  | @ -26,6 +35,10 @@ PlacefileSettingsWidget::PlacefileSettingsWidget(QWidget* parent) : | |||
|     ui(new Ui::PlacefileSettingsWidget) | ||||
| { | ||||
|    ui->setupUi(this); | ||||
| 
 | ||||
|    p->openUrlDialog_ = new OpenUrlDialog("Add Placefile", this); | ||||
| 
 | ||||
|    p->ConnectSignals(); | ||||
| } | ||||
| 
 | ||||
| PlacefileSettingsWidget::~PlacefileSettingsWidget() | ||||
|  | @ -33,6 +46,21 @@ PlacefileSettingsWidget::~PlacefileSettingsWidget() | |||
|    delete ui; | ||||
| } | ||||
| 
 | ||||
| void PlacefileSettingsWidgetImpl::ConnectSignals() | ||||
| { | ||||
|    QObject::connect(self_->ui->addButton, | ||||
|                     &QPushButton::clicked, | ||||
|                     self_, | ||||
|                     [this]() { openUrlDialog_->open(); }); | ||||
| 
 | ||||
|    QObject::connect( | ||||
|       openUrlDialog_, | ||||
|       &OpenUrlDialog::accepted, | ||||
|       self_, | ||||
|       [this]() | ||||
|       { logger_->info("Add URL: {}", openUrlDialog_->url().toStdString()); }); | ||||
| } | ||||
| 
 | ||||
| } // namespace ui
 | ||||
| } // namespace qt
 | ||||
| } // namespace scwx
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat