mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 07:50: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/settings_manager.hpp> | ||||
| #include <scwx/qt/manager/text_event_manager.hpp> | ||||
| #include <scwx/qt/map/map_widget.hpp> | ||||
| #include <scwx/qt/model/radar_product_model.hpp> | ||||
| #include <scwx/qt/ui/flow_layout.hpp> | ||||
|  | @ -201,7 +202,7 @@ void MainWindow::showEvent(QShowEvent* event) | |||
|    resizeDocks({ui->radarToolboxDock}, {150}, Qt::Horizontal); | ||||
| } | ||||
| 
 | ||||
| void MainWindow::on_actionOpen_triggered() | ||||
| void MainWindow::on_actionOpenNexrad_triggered() | ||||
| { | ||||
|    static const std::string nexradFilter = "NEXRAD Products (*)"; | ||||
| 
 | ||||
|  | @ -264,6 +265,38 @@ void MainWindow::on_actionOpen_triggered() | |||
|    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() | ||||
| { | ||||
|    close(); | ||||
|  |  | |||
|  | @ -32,7 +32,8 @@ signals: | |||
|    void ActiveMapMoved(double latitude, double longitude); | ||||
| 
 | ||||
| private slots: | ||||
|    void on_actionOpen_triggered(); | ||||
|    void on_actionOpenNexrad_triggered(); | ||||
|    void on_actionOpenTextEvent_triggered(); | ||||
|    void on_actionExit_triggered(); | ||||
|    void on_radarSiteSelectButton_clicked(); | ||||
|    void on_resourceTreeCollapseAllButton_clicked(); | ||||
|  |  | |||
|  | @ -42,7 +42,14 @@ | |||
|     <property name="title"> | ||||
|      <string>&File</string> | ||||
|     </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="actionExit"/> | ||||
|    </widget> | ||||
|  | @ -309,14 +316,6 @@ | |||
|     <string>About &Supercell Wx...</string> | ||||
|    </property> | ||||
|   </action> | ||||
|   <action name="actionOpen"> | ||||
|    <property name="text"> | ||||
|     <string>&Open...</string> | ||||
|    </property> | ||||
|    <property name="shortcut"> | ||||
|     <string>Ctrl+O</string> | ||||
|    </property> | ||||
|   </action> | ||||
|   <action name="actionRadarToolbox"> | ||||
|    <property name="text"> | ||||
|     <string>Radar Toolbox</string> | ||||
|  | @ -327,6 +326,16 @@ | |||
|     <string>&Resource Explorer</string> | ||||
|    </property> | ||||
|   </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> | ||||
|  <resources> | ||||
|   <include location="../../../../scwx-qt.qrc"/> | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat