mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 22:10:05 +00:00
Initial settings dialog content
This commit is contained in:
parent
7a430da807
commit
65fd47968a
8 changed files with 418 additions and 26 deletions
|
|
@ -16,6 +16,7 @@
|
|||
#include <scwx/qt/ui/level2_settings_widget.hpp>
|
||||
#include <scwx/qt/ui/level3_products_widget.hpp>
|
||||
#include <scwx/qt/ui/radar_site_dialog.hpp>
|
||||
#include <scwx/qt/ui/settings_dialog.hpp>
|
||||
#include <scwx/common/characters.hpp>
|
||||
#include <scwx/common/products.hpp>
|
||||
#include <scwx/common/vcp.hpp>
|
||||
|
|
@ -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<model::RadarProductModel> radarProductModel_;
|
||||
std::shared_ptr<manager::TextEventManager> 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();
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -51,6 +51,8 @@
|
|||
</widget>
|
||||
<addaction name="menu_Open"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionSettings"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionExit"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuHelp">
|
||||
|
|
@ -354,6 +356,11 @@
|
|||
<string>&ImGui Debug</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSettings">
|
||||
<property name="text">
|
||||
<string>&Settings</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../../../../scwx-qt.qrc"/>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,10 @@
|
|||
#include "settings_dialog.hpp"
|
||||
#include "ui_settings_dialog.h"
|
||||
|
||||
#include <scwx/awips/phenomenon.hpp>
|
||||
|
||||
#include <QToolButton>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
|
|
@ -8,19 +12,61 @@ namespace qt
|
|||
namespace ui
|
||||
{
|
||||
|
||||
static const std::array<awips::Phenomenon, 5> kAlertPhenomena_ {
|
||||
awips::Phenomenon::FlashFlood,
|
||||
awips::Phenomenon::Marine,
|
||||
awips::Phenomenon::SevereThunderstorm,
|
||||
awips::Phenomenon::SnowSquall,
|
||||
awips::Phenomenon::Tornado};
|
||||
|
||||
static const std::array<std::pair<std::string, std::string>, 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<SettingsDialogImpl>()},
|
||||
p {std::make_unique<SettingsDialogImpl>(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<QGridLayout*>(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<QGridLayout*>(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
|
||||
|
|
|
|||
|
|
@ -1,39 +1,293 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<author/>
|
||||
<comment/>
|
||||
<exportmacro/>
|
||||
<class>SettingsDialog</class>
|
||||
<widget class="QDialog" name="SettingsDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
<width>650</width>
|
||||
<height>500</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
<string>Settings</string>
|
||||
</property>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>240</y>
|
||||
<width>341</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QListWidget" name="listWidget">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="sizeAdjustPolicy">
|
||||
<enum>QAbstractScrollArea::AdjustToContents</enum>
|
||||
</property>
|
||||
<property name="resizeMode">
|
||||
<enum>QListView::Adjust</enum>
|
||||
</property>
|
||||
<property name="viewMode">
|
||||
<enum>QListView::ListMode</enum>
|
||||
</property>
|
||||
<property name="uniformItemSizes">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>General</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../../scwx-qt.qrc">
|
||||
<normaloff>:/res/icons/font-awesome-6/gears-solid.svg</normaloff>:/res/icons/font-awesome-6/gears-solid.svg</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Palettes</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../../scwx-qt.qrc">
|
||||
<normaloff>:/res/icons/font-awesome-6/palette-solid.svg</normaloff>:/res/icons/font-awesome-6/palette-solid.svg</iconset>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QStackedWidget" name="stackedWidget">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="general">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QFrame" name="frame_2">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Default Radar Site</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="radarSiteComboBox"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Grid Width</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="gridWidthSpinBox"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Grid Height</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QSpinBox" name="gridHeightSpinBox"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Mapbox API Key</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="mapboxApiKeyLineEdit"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="debugEnabledCheckBox">
|
||||
<property name="text">
|
||||
<string>Debug Enabled</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="palettes">
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab">
|
||||
<attribute name="title">
|
||||
<string>Color Tables</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QScrollArea" name="scrollArea">
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="colorTableContents">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>489</width>
|
||||
<height>382</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0">
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_2">
|
||||
<attribute name="title">
|
||||
<string>Alerts</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QFrame" name="alertsFrame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_5">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>239</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<pixmapfunction/>
|
||||
<resources/>
|
||||
<resources>
|
||||
<include location="../../../../scwx-qt.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue