mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 09:30:05 +00:00 
			
		
		
		
	Add option to open text event products
This commit is contained in:
		
							parent
							
								
									cc82c5b102
								
							
						
					
					
						commit
						bf73b540f4
					
				
					 3 changed files with 54 additions and 11 deletions
				
			
		|  | @ -5,6 +5,7 @@ | ||||||
| 
 | 
 | ||||||
| #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/map/map_widget.hpp> | #include <scwx/qt/map/map_widget.hpp> | ||||||
| #include <scwx/qt/model/radar_product_model.hpp> | #include <scwx/qt/model/radar_product_model.hpp> | ||||||
| #include <scwx/qt/ui/flow_layout.hpp> | #include <scwx/qt/ui/flow_layout.hpp> | ||||||
|  | @ -201,7 +202,7 @@ void MainWindow::showEvent(QShowEvent* event) | ||||||
|    resizeDocks({ui->radarToolboxDock}, {150}, Qt::Horizontal); |    resizeDocks({ui->radarToolboxDock}, {150}, Qt::Horizontal); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void MainWindow::on_actionOpen_triggered() | void MainWindow::on_actionOpenNexrad_triggered() | ||||||
| { | { | ||||||
|    static const std::string nexradFilter = "NEXRAD Products (*)"; |    static const std::string nexradFilter = "NEXRAD Products (*)"; | ||||||
| 
 | 
 | ||||||
|  | @ -264,6 +265,38 @@ void MainWindow::on_actionOpen_triggered() | ||||||
|    dialog->open(); |    dialog->open(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | void MainWindow::on_actionOpenTextEvent_triggered() | ||||||
|  | { | ||||||
|  |    static const std::string textFilter = "Text Event Products (*.txt)"; | ||||||
|  |    static const std::string allFilter  = "All Files (*)"; | ||||||
|  | 
 | ||||||
|  |    QFileDialog* dialog = new QFileDialog(this); | ||||||
|  | 
 | ||||||
|  |    dialog->setFileMode(QFileDialog::ExistingFile); | ||||||
|  |    dialog->setNameFilters({tr(textFilter.c_str()), tr(allFilter.c_str())}); | ||||||
|  |    dialog->setAttribute(Qt::WA_DeleteOnClose); | ||||||
|  | 
 | ||||||
|  |    // Make sure the parent window properly repaints on close
 | ||||||
|  |    connect( | ||||||
|  |       dialog, | ||||||
|  |       &QFileDialog::finished, | ||||||
|  |       this, | ||||||
|  |       [=]() { update(); }, | ||||||
|  |       Qt::QueuedConnection); | ||||||
|  | 
 | ||||||
|  |    connect(dialog, | ||||||
|  |            &QFileDialog::fileSelected, | ||||||
|  |            this, | ||||||
|  |            [=](const QString& file) | ||||||
|  |            { | ||||||
|  |               logger_->info("Selected: {}", file.toStdString()); | ||||||
|  |               manager::TextEventManager::Instance().LoadFile( | ||||||
|  |                  file.toStdString()); | ||||||
|  |            }); | ||||||
|  | 
 | ||||||
|  |    dialog->open(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| void MainWindow::on_actionExit_triggered() | void MainWindow::on_actionExit_triggered() | ||||||
| { | { | ||||||
|    close(); |    close(); | ||||||
|  |  | ||||||
|  | @ -32,7 +32,8 @@ signals: | ||||||
|    void ActiveMapMoved(double latitude, double longitude); |    void ActiveMapMoved(double latitude, double longitude); | ||||||
| 
 | 
 | ||||||
| private slots: | private slots: | ||||||
|    void on_actionOpen_triggered(); |    void on_actionOpenNexrad_triggered(); | ||||||
|  |    void on_actionOpenTextEvent_triggered(); | ||||||
|    void on_actionExit_triggered(); |    void on_actionExit_triggered(); | ||||||
|    void on_radarSiteSelectButton_clicked(); |    void on_radarSiteSelectButton_clicked(); | ||||||
|    void on_resourceTreeCollapseAllButton_clicked(); |    void on_resourceTreeCollapseAllButton_clicked(); | ||||||
|  |  | ||||||
|  | @ -42,7 +42,14 @@ | ||||||
|     <property name="title"> |     <property name="title"> | ||||||
|      <string>&File</string> |      <string>&File</string> | ||||||
|     </property> |     </property> | ||||||
|     <addaction name="actionOpen"/> |     <widget class="QMenu" name="menu_Open"> | ||||||
|  |      <property name="title"> | ||||||
|  |       <string>&Open</string> | ||||||
|  |      </property> | ||||||
|  |      <addaction name="actionOpenNexrad"/> | ||||||
|  |      <addaction name="actionOpenTextEvent"/> | ||||||
|  |     </widget> | ||||||
|  |     <addaction name="menu_Open"/> | ||||||
|     <addaction name="separator"/> |     <addaction name="separator"/> | ||||||
|     <addaction name="actionExit"/> |     <addaction name="actionExit"/> | ||||||
|    </widget> |    </widget> | ||||||
|  | @ -309,14 +316,6 @@ | ||||||
|     <string>About &Supercell Wx...</string> |     <string>About &Supercell Wx...</string> | ||||||
|    </property> |    </property> | ||||||
|   </action> |   </action> | ||||||
|   <action name="actionOpen"> |  | ||||||
|    <property name="text"> |  | ||||||
|     <string>&Open...</string> |  | ||||||
|    </property> |  | ||||||
|    <property name="shortcut"> |  | ||||||
|     <string>Ctrl+O</string> |  | ||||||
|    </property> |  | ||||||
|   </action> |  | ||||||
|   <action name="actionRadarToolbox"> |   <action name="actionRadarToolbox"> | ||||||
|    <property name="text"> |    <property name="text"> | ||||||
|     <string>Radar Toolbox</string> |     <string>Radar Toolbox</string> | ||||||
|  | @ -327,6 +326,16 @@ | ||||||
|     <string>&Resource Explorer</string> |     <string>&Resource Explorer</string> | ||||||
|    </property> |    </property> | ||||||
|   </action> |   </action> | ||||||
|  |   <action name="actionOpenNexrad"> | ||||||
|  |    <property name="text"> | ||||||
|  |     <string>&NEXRAD Product...</string> | ||||||
|  |    </property> | ||||||
|  |   </action> | ||||||
|  |   <action name="actionOpenTextEvent"> | ||||||
|  |    <property name="text"> | ||||||
|  |     <string>Text &Event Product...</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