mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 17:20:06 +00:00 
			
		
		
		
	Enable loading of placefiles via the UI
This commit is contained in:
		
							parent
							
								
									f70de26a2d
								
							
						
					
					
						commit
						bfe62301b2
					
				
					 3 changed files with 32 additions and 0 deletions
				
			
		|  | @ -5,6 +5,7 @@ | ||||||
| 
 | 
 | ||||||
| #include <scwx/qt/main/application.hpp> | #include <scwx/qt/main/application.hpp> | ||||||
| #include <scwx/qt/main/versions.hpp> | #include <scwx/qt/main/versions.hpp> | ||||||
|  | #include <scwx/qt/manager/placefile_manager.hpp> | ||||||
| #include <scwx/qt/manager/radar_product_manager.hpp> | #include <scwx/qt/manager/radar_product_manager.hpp> | ||||||
| #include <scwx/qt/manager/settings_manager.hpp> | #include <scwx/qt/manager/settings_manager.hpp> | ||||||
| #include <scwx/qt/manager/text_event_manager.hpp> | #include <scwx/qt/manager/text_event_manager.hpp> | ||||||
|  | @ -79,6 +80,7 @@ public: | ||||||
|        settingsDialog_ {nullptr}, |        settingsDialog_ {nullptr}, | ||||||
|        updateDialog_ {nullptr}, |        updateDialog_ {nullptr}, | ||||||
|        radarProductModel_ {nullptr}, |        radarProductModel_ {nullptr}, | ||||||
|  |        placefileManager_ {manager::PlacefileManager::Instance()}, | ||||||
|        textEventManager_ {manager::TextEventManager::Instance()}, |        textEventManager_ {manager::TextEventManager::Instance()}, | ||||||
|        timelineManager_ {manager::TimelineManager::Instance()}, |        timelineManager_ {manager::TimelineManager::Instance()}, | ||||||
|        updateManager_ {manager::UpdateManager::Instance()}, |        updateManager_ {manager::UpdateManager::Instance()}, | ||||||
|  | @ -169,6 +171,7 @@ public: | ||||||
|    ui::UpdateDialog*        updateDialog_; |    ui::UpdateDialog*        updateDialog_; | ||||||
| 
 | 
 | ||||||
|    std::unique_ptr<model::RadarProductModel>  radarProductModel_; |    std::unique_ptr<model::RadarProductModel>  radarProductModel_; | ||||||
|  |    std::shared_ptr<manager::PlacefileManager> placefileManager_; | ||||||
|    std::shared_ptr<manager::TextEventManager> textEventManager_; |    std::shared_ptr<manager::TextEventManager> textEventManager_; | ||||||
|    std::shared_ptr<manager::TimelineManager>  timelineManager_; |    std::shared_ptr<manager::TimelineManager>  timelineManager_; | ||||||
|    std::shared_ptr<manager::UpdateManager>    updateManager_; |    std::shared_ptr<manager::UpdateManager>    updateManager_; | ||||||
|  | @ -398,6 +401,28 @@ void MainWindow::on_actionOpenNexrad_triggered() | ||||||
|    dialog->open(); |    dialog->open(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | void MainWindow::on_actionOpenPlacefile_triggered() | ||||||
|  | { | ||||||
|  |    static const std::string placefileFilter = "Placefiles (*)"; | ||||||
|  | 
 | ||||||
|  |    QFileDialog* dialog = new QFileDialog(this); | ||||||
|  | 
 | ||||||
|  |    dialog->setFileMode(QFileDialog::ExistingFile); | ||||||
|  |    dialog->setNameFilter(tr(placefileFilter.c_str())); | ||||||
|  |    dialog->setAttribute(Qt::WA_DeleteOnClose); | ||||||
|  | 
 | ||||||
|  |    connect(dialog, | ||||||
|  |            &QFileDialog::fileSelected, | ||||||
|  |            this, | ||||||
|  |            [this](const QString& file) | ||||||
|  |            { | ||||||
|  |               logger_->info("Selected: {}", file.toStdString()); | ||||||
|  |               p->placefileManager_->LoadFile(file.toStdString()); | ||||||
|  |            }); | ||||||
|  | 
 | ||||||
|  |    dialog->open(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| void MainWindow::on_actionOpenTextEvent_triggered() | void MainWindow::on_actionOpenTextEvent_triggered() | ||||||
| { | { | ||||||
|    static const std::string textFilter = "Text Event Products (*.txt)"; |    static const std::string textFilter = "Text Event Products (*.txt)"; | ||||||
|  |  | ||||||
|  | @ -33,6 +33,7 @@ signals: | ||||||
| 
 | 
 | ||||||
| private slots: | private slots: | ||||||
|    void on_actionOpenNexrad_triggered(); |    void on_actionOpenNexrad_triggered(); | ||||||
|  |    void on_actionOpenPlacefile_triggered(); | ||||||
|    void on_actionOpenTextEvent_triggered(); |    void on_actionOpenTextEvent_triggered(); | ||||||
|    void on_actionSettings_triggered(); |    void on_actionSettings_triggered(); | ||||||
|    void on_actionExit_triggered(); |    void on_actionExit_triggered(); | ||||||
|  |  | ||||||
|  | @ -51,6 +51,7 @@ | ||||||
|       <string>&Open</string> |       <string>&Open</string> | ||||||
|      </property> |      </property> | ||||||
|      <addaction name="actionOpenNexrad"/> |      <addaction name="actionOpenNexrad"/> | ||||||
|  |      <addaction name="actionOpenPlacefile"/> | ||||||
|      <addaction name="actionOpenTextEvent"/> |      <addaction name="actionOpenTextEvent"/> | ||||||
|     </widget> |     </widget> | ||||||
|     <addaction name="menu_Open"/> |     <addaction name="menu_Open"/> | ||||||
|  | @ -415,6 +416,11 @@ | ||||||
|     <string>&Check for Updates</string> |     <string>&Check for Updates</string> | ||||||
|    </property> |    </property> | ||||||
|   </action> |   </action> | ||||||
|  |   <action name="actionOpenPlacefile"> | ||||||
|  |    <property name="text"> | ||||||
|  |     <string>&Placefile...</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