diff --git a/scwx-qt/res/icons/font-awesome-6/gears-solid.svg b/scwx-qt/res/icons/font-awesome-6/gears-solid.svg new file mode 100644 index 00000000..2b205e64 --- /dev/null +++ b/scwx-qt/res/icons/font-awesome-6/gears-solid.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/scwx-qt/res/icons/font-awesome-6/palette-solid.svg b/scwx-qt/res/icons/font-awesome-6/palette-solid.svg new file mode 100644 index 00000000..0f797deb --- /dev/null +++ b/scwx-qt/res/icons/font-awesome-6/palette-solid.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/scwx-qt/scwx-qt.qrc b/scwx-qt/scwx-qt.qrc index c99d8b8f..c26450cc 100644 --- a/scwx-qt/scwx-qt.qrc +++ b/scwx-qt/scwx-qt.qrc @@ -17,6 +17,8 @@ res/icons/font-awesome-6/angle-right-solid.svg res/icons/font-awesome-6/backward-step-solid.svg res/icons/font-awesome-6/forward-step-solid.svg + res/icons/font-awesome-6/gears-solid.svg + res/icons/font-awesome-6/palette-solid.svg res/icons/font-awesome-6/sliders-solid.svg res/icons/font-awesome-6/square-minus-regular.svg res/icons/font-awesome-6/square-plus-regular.svg diff --git a/scwx-qt/source/scwx/qt/main/main_window.cpp b/scwx-qt/source/scwx/qt/main/main_window.cpp index bad516f9..6c51e615 100644 --- a/scwx-qt/source/scwx/qt/main/main_window.cpp +++ b/scwx-qt/source/scwx/qt/main/main_window.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -52,6 +53,7 @@ public: alertDockWidget_ {nullptr}, imGuiDebugDialog_ {nullptr}, radarSiteDialog_ {nullptr}, + settingsDialog_ {nullptr}, radarProductModel_ {nullptr}, textEventManager_ {manager::TextEventManager::Instance()}, maps_ {}, @@ -114,6 +116,7 @@ public: ui::AlertDockWidget* alertDockWidget_; ui::ImGuiDebugDialog* imGuiDebugDialog_; ui::RadarSiteDialog* radarSiteDialog_; + ui::SettingsDialog* settingsDialog_; std::unique_ptr radarProductModel_; std::shared_ptr textEventManager_; @@ -183,6 +186,9 @@ MainWindow::MainWindow(QWidget* parent) : // Radar Site Dialog p->radarSiteDialog_ = new ui::RadarSiteDialog(this); + // Settings Dialog + p->settingsDialog_ = new ui::SettingsDialog(this); + // Add Level 2 Products p->level2ProductsWidget_ = new ui::Level2ProductsWidget(this); ui->radarProductGroupBox->layout()->replaceWidget(ui->level2ProductFrame, @@ -327,6 +333,11 @@ void MainWindow::on_actionOpenTextEvent_triggered() dialog->open(); } +void MainWindow::on_actionSettings_triggered() +{ + p->settingsDialog_->show(); +} + void MainWindow::on_actionExit_triggered() { close(); diff --git a/scwx-qt/source/scwx/qt/main/main_window.hpp b/scwx-qt/source/scwx/qt/main/main_window.hpp index 3bcebe8d..6c217381 100644 --- a/scwx-qt/source/scwx/qt/main/main_window.hpp +++ b/scwx-qt/source/scwx/qt/main/main_window.hpp @@ -34,6 +34,7 @@ signals: private slots: void on_actionOpenNexrad_triggered(); void on_actionOpenTextEvent_triggered(); + void on_actionSettings_triggered(); void on_actionExit_triggered(); void on_actionImGuiDebug_triggered(); void on_radarSiteSelectButton_clicked(); diff --git a/scwx-qt/source/scwx/qt/main/main_window.ui b/scwx-qt/source/scwx/qt/main/main_window.ui index 706dbae7..8cc56c0a 100644 --- a/scwx-qt/source/scwx/qt/main/main_window.ui +++ b/scwx-qt/source/scwx/qt/main/main_window.ui @@ -51,6 +51,8 @@ + + @@ -354,6 +356,11 @@ &ImGui Debug + + + &Settings + + diff --git a/scwx-qt/source/scwx/qt/ui/settings_dialog.cpp b/scwx-qt/source/scwx/qt/ui/settings_dialog.cpp index debcc980..d93523be 100644 --- a/scwx-qt/source/scwx/qt/ui/settings_dialog.cpp +++ b/scwx-qt/source/scwx/qt/ui/settings_dialog.cpp @@ -1,6 +1,10 @@ #include "settings_dialog.hpp" #include "ui_settings_dialog.h" +#include + +#include + namespace scwx { namespace qt @@ -8,19 +12,61 @@ namespace qt namespace ui { +static const std::array kAlertPhenomena_ { + awips::Phenomenon::FlashFlood, + awips::Phenomenon::Marine, + awips::Phenomenon::SevereThunderstorm, + awips::Phenomenon::SnowSquall, + awips::Phenomenon::Tornado}; + +static const std::array, 17> + kColorTableTypes_ {std::pair {"BR", "BR"}, + std::pair {"BV", "BV"}, + std::pair {"SW", "SW"}, + std::pair {"ZDR", "ZDR"}, + std::pair {"PHI2", "PHI2"}, + std::pair {"CC", "CC"}, + std::pair {"DOD", "DOD"}, + std::pair {"DSD", "DSD"}, + std::pair {"ET", "ET"}, + std::pair {"OHP", "OHP"}, + std::pair {"OHPIN", "OHPIN"}, + std::pair {"PHI3", "PHI3"}, + std::pair {"SRV", "SRV"}, + std::pair {"STP", "STP"}, + std::pair {"STPIN", "STPIN"}, + std::pair {"VIL", "VIL"}, + std::pair {"?", "Default"}}; + class SettingsDialogImpl { public: - explicit SettingsDialogImpl() {} + explicit SettingsDialogImpl(SettingsDialog* self) : self_ {self} {} ~SettingsDialogImpl() = default; + + void SetupPalettesColorTablesTab(); + void SetupPalettesAlertsTab(); + + SettingsDialog* self_; }; SettingsDialog::SettingsDialog(QWidget* parent) : QDialog(parent), - p {std::make_unique()}, + p {std::make_unique(this)}, ui(new Ui::SettingsDialog) { ui->setupUi(this); + + // Palettes > Color Tables + p->SetupPalettesColorTablesTab(); + + // Palettes > Alerts + p->SetupPalettesAlertsTab(); + + connect(ui->listWidget, + &QListWidget::currentRowChanged, + ui->stackedWidget, + &QStackedWidget::setCurrentIndex); } SettingsDialog::~SettingsDialog() @@ -28,6 +74,75 @@ SettingsDialog::~SettingsDialog() delete ui; } +void SettingsDialogImpl::SetupPalettesColorTablesTab() +{ + // Palettes > Color Tables + QGridLayout* colorTableLayout = + reinterpret_cast(self_->ui->colorTableContents->layout()); + + int colorTableRow = 0; + for (auto& colorTableType : kColorTableTypes_) + { + colorTableLayout->addWidget( + new QLabel(colorTableType.second.c_str(), self_), colorTableRow, 0); + colorTableLayout->addWidget(new QLineEdit(self_), colorTableRow, 1); + colorTableLayout->addWidget(new QToolButton(self_), colorTableRow, 2); + ++colorTableRow; + } +} + +void SettingsDialogImpl::SetupPalettesAlertsTab() +{ + // Palettes > Alerts + QGridLayout* alertsLayout = + reinterpret_cast(self_->ui->alertsFrame->layout()); + + QLabel* phenomenonLabel = new QLabel(QObject::tr("Phenomenon"), self_); + QLabel* activeLabel = new QLabel(QObject::tr("Active"), self_); + QLabel* inactiveLabel = new QLabel(QObject::tr("Inactive"), self_); + + QFont boldFont; + boldFont.setBold(true); + phenomenonLabel->setFont(boldFont); + activeLabel->setFont(boldFont); + inactiveLabel->setFont(boldFont); + + alertsLayout->addWidget(phenomenonLabel, 0, 0); + alertsLayout->addWidget(activeLabel, 0, 1, 1, 3); + alertsLayout->addWidget(inactiveLabel, 0, 4, 1, 3); + + int alertsRow = 1; + for (auto& phenomenon : kAlertPhenomena_) + { + QFrame* activeFrame = new QFrame(self_); + QFrame* inactiveFrame = new QFrame(self_); + + QToolButton* activeButton = new QToolButton(self_); + QToolButton* inactiveButton = new QToolButton(self_); + + activeFrame->setMinimumWidth(24); + inactiveFrame->setMinimumWidth(24); + + activeButton->setIcon( + QIcon {":/res/icons/font-awesome-6/palette-solid.svg"}); + inactiveButton->setIcon( + QIcon {":/res/icons/font-awesome-6/palette-solid.svg"}); + + alertsLayout->addWidget( + new QLabel(QObject::tr(awips::GetPhenomenonText(phenomenon).c_str()), + self_), + alertsRow, + 0); + alertsLayout->addWidget(activeFrame, alertsRow, 1); + alertsLayout->addWidget(new QLineEdit(self_), alertsRow, 2); + alertsLayout->addWidget(activeButton, alertsRow, 3); + alertsLayout->addWidget(inactiveFrame, alertsRow, 4); + alertsLayout->addWidget(new QLineEdit(self_), alertsRow, 5); + alertsLayout->addWidget(inactiveButton, alertsRow, 6); + ++alertsRow; + } +} + } // namespace ui } // namespace qt } // namespace scwx diff --git a/scwx-qt/source/scwx/qt/ui/settings_dialog.ui b/scwx-qt/source/scwx/qt/ui/settings_dialog.ui index 9b639187..f1bb166c 100644 --- a/scwx-qt/source/scwx/qt/ui/settings_dialog.ui +++ b/scwx-qt/source/scwx/qt/ui/settings_dialog.ui @@ -1,39 +1,293 @@ + - - - SettingsDialog 0 0 - 400 - 300 + 650 + 500 - Dialog + Settings - - - - 30 - 240 - 341 - 32 - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + QAbstractScrollArea::AdjustToContents + + + QListView::Adjust + + + QListView::ListMode + + + true + + + + General + + + + :/res/icons/font-awesome-6/gears-solid.svg:/res/icons/font-awesome-6/gears-solid.svg + + + + + Palettes + + + + :/res/icons/font-awesome-6/palette-solid.svg:/res/icons/font-awesome-6/palette-solid.svg + + + + + + + + + 0 + 0 + + + + 1 + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Default Radar Site + + + + + + + + + + Grid Width + + + + + + + + + + Grid Height + + + + + + + + + + Mapbox API Key + + + + + + + + + + + + + Debug Enabled + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + 1 + + + + Color Tables + + + + + + true + + + + + 0 + 0 + 489 + 382 + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + Alerts + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + + + Qt::Vertical + + + + 20 + 239 + + + + + + + + + + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + - - + + + buttonBox