diff --git a/scwx-qt/source/scwx/qt/main/main_window.cpp b/scwx-qt/source/scwx/qt/main/main_window.cpp index 225f439b..a92e3791 100644 --- a/scwx-qt/source/scwx/qt/main/main_window.cpp +++ b/scwx-qt/source/scwx/qt/main/main_window.cpp @@ -5,6 +5,7 @@ #include #include +#include #include #include #include @@ -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 radarProductModel_; + std::shared_ptr placefileManager_; std::shared_ptr textEventManager_; std::shared_ptr timelineManager_; std::shared_ptr 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)"; diff --git a/scwx-qt/source/scwx/qt/main/main_window.hpp b/scwx-qt/source/scwx/qt/main/main_window.hpp index 6ed96aba..3261355e 100644 --- a/scwx-qt/source/scwx/qt/main/main_window.hpp +++ b/scwx-qt/source/scwx/qt/main/main_window.hpp @@ -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(); diff --git a/scwx-qt/source/scwx/qt/main/main_window.ui b/scwx-qt/source/scwx/qt/main/main_window.ui index 369c8d28..8cf8ce5b 100644 --- a/scwx-qt/source/scwx/qt/main/main_window.ui +++ b/scwx-qt/source/scwx/qt/main/main_window.ui @@ -51,6 +51,7 @@ &Open + @@ -415,6 +416,11 @@ &Check for Updates + + + &Placefile... + +