Enable loading of placefiles via the UI

This commit is contained in:
Dan Paulat 2023-07-18 23:32:05 -05:00
parent f70de26a2d
commit bfe62301b2
3 changed files with 32 additions and 0 deletions

View file

@ -5,6 +5,7 @@
#include <scwx/qt/main/application.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/settings_manager.hpp>
#include <scwx/qt/manager/text_event_manager.hpp>
@ -79,6 +80,7 @@ public:
settingsDialog_ {nullptr},
updateDialog_ {nullptr},
radarProductModel_ {nullptr},
placefileManager_ {manager::PlacefileManager::Instance()},
textEventManager_ {manager::TextEventManager::Instance()},
timelineManager_ {manager::TimelineManager::Instance()},
updateManager_ {manager::UpdateManager::Instance()},
@ -169,6 +171,7 @@ public:
ui::UpdateDialog* updateDialog_;
std::unique_ptr<model::RadarProductModel> radarProductModel_;
std::shared_ptr<manager::PlacefileManager> placefileManager_;
std::shared_ptr<manager::TextEventManager> textEventManager_;
std::shared_ptr<manager::TimelineManager> timelineManager_;
std::shared_ptr<manager::UpdateManager> updateManager_;
@ -398,6 +401,28 @@ void MainWindow::on_actionOpenNexrad_triggered()
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()
{
static const std::string textFilter = "Text Event Products (*.txt)";

View file

@ -33,6 +33,7 @@ signals:
private slots:
void on_actionOpenNexrad_triggered();
void on_actionOpenPlacefile_triggered();
void on_actionOpenTextEvent_triggered();
void on_actionSettings_triggered();
void on_actionExit_triggered();

View file

@ -51,6 +51,7 @@
<string>&amp;Open</string>
</property>
<addaction name="actionOpenNexrad"/>
<addaction name="actionOpenPlacefile"/>
<addaction name="actionOpenTextEvent"/>
</widget>
<addaction name="menu_Open"/>
@ -415,6 +416,11 @@
<string>&amp;Check for Updates</string>
</property>
</action>
<action name="actionOpenPlacefile">
<property name="text">
<string>&amp;Placefile...</string>
</property>
</action>
</widget>
<resources>
<include location="../../../../scwx-qt.qrc"/>