diff --git a/scwx-qt/source/scwx/qt/main/main_window.cpp b/scwx-qt/source/scwx/qt/main/main_window.cpp index a990dc65..11191a1a 100644 --- a/scwx-qt/source/scwx/qt/main/main_window.cpp +++ b/scwx-qt/source/scwx/qt/main/main_window.cpp @@ -25,7 +25,10 @@ class MainWindowImpl : public QObject public: explicit MainWindowImpl(MainWindow* mainWindow) : - mainWindow_ {mainWindow}, map_ {nullptr}, elevationCuts_ {} + mainWindow_ {mainWindow}, + map_ {nullptr}, + elevationCuts_ {}, + resizeElevationButtons_ {false} { } ~MainWindowImpl() = default; @@ -38,6 +41,8 @@ public: map::MapWidget* map_; std::vector elevationCuts_; + + bool resizeElevationButtons_; }; MainWindow::MainWindow(QWidget* parent) : @@ -57,7 +62,8 @@ MainWindow::MainWindow(QWidget* parent) : // Add Level 2 Products QLayout* level2Layout = new ui::FlowLayout(); - ui->level2Products->setLayout(level2Layout); + level2Layout->setContentsMargins(0, 0, 0, 0); + ui->level2ProductFrame->setLayout(level2Layout); for (common::Level2Product product : common::Level2ProductIterator()) { @@ -74,7 +80,10 @@ MainWindow::MainWindow(QWidget* parent) : } QLayout* elevationLayout = new ui::FlowLayout(); - ui->elevationSettings->setLayout(elevationLayout); + ui->elevationGroupBox->setLayout(elevationLayout); + + ui->settingsGroupBox->setVisible(false); + ui->declutterCheckbox->setVisible(false); p->InitializeConnections(); } @@ -84,30 +93,63 @@ MainWindow::~MainWindow() delete ui; } +bool MainWindow::event(QEvent* event) +{ + if (event->type() == QEvent::Type::Paint) + { + if (p->resizeElevationButtons_) + { + // Set each elevation cut's tool button to the same size + int elevationCutMaxWidth = 0; + for (QToolButton* widget : + ui->elevationGroupBox->findChildren()) + { + elevationCutMaxWidth = + std::max(elevationCutMaxWidth, widget->width()); + } + for (QToolButton* widget : + ui->elevationGroupBox->findChildren()) + { + widget->setMinimumWidth(elevationCutMaxWidth); + } + + p->resizeElevationButtons_ = false; + } + } + + return QMainWindow::event(event); +} + void MainWindow::showEvent(QShowEvent* event) { QMainWindow::showEvent(event); - // Cycle through each item in the toolbox to render - QToolBox* toolbox = ui->radarToolbox; - int currentIndex = toolbox->currentIndex(); - for (int i = 0; i < toolbox->count(); i++) - { - toolbox->setCurrentIndex(i); - } - toolbox->setCurrentIndex(currentIndex); - // Set each level 2 product's tool button to the same size int level2MaxWidth = 0; - for (QWidget* widget : ui->level2Products->findChildren()) + for (QToolButton* widget : + ui->level2ProductFrame->findChildren()) { level2MaxWidth = std::max(level2MaxWidth, widget->width()); } - for (QWidget* widget : ui->level2Products->findChildren()) + for (QToolButton* widget : + ui->level2ProductFrame->findChildren()) { widget->setMinimumWidth(level2MaxWidth); } + // Set each elevation cut's tool button to the same size + int elevationCutMaxWidth = 0; + for (QToolButton* widget : + ui->elevationGroupBox->findChildren()) + { + elevationCutMaxWidth = std::max(elevationCutMaxWidth, widget->width()); + } + for (QToolButton* widget : + ui->elevationGroupBox->findChildren()) + { + widget->setMinimumWidth(elevationCutMaxWidth); + } + resizeDocks({ui->radarToolboxDock}, {150}, Qt::Horizontal); } @@ -129,7 +171,7 @@ void MainWindowImpl::SelectRadarProduct(common::Level2Product product) << logPrefix_ << "Selecting Level 2 radar product: " << productName; for (QToolButton* toolButton : - mainWindow_->ui->level2Products->findChildren()) + mainWindow_->ui->level2ProductFrame->findChildren()) { if (toolButton->text().toStdString() == productName) { @@ -157,12 +199,12 @@ void MainWindowImpl::UpdateRadarProductSettings(map::MapWidget* mapWidget) } for (QToolButton* toolButton : - mainWindow_->ui->elevationSettings->findChildren()) + mainWindow_->ui->elevationGroupBox->findChildren()) { delete toolButton; } - QLayout* layout = mainWindow_->ui->elevationSettings->layout(); + QLayout* layout = mainWindow_->ui->elevationGroupBox->layout(); // Create elevation cut tool buttons for (float elevationCut : elevationCuts) @@ -177,26 +219,8 @@ void MainWindowImpl::UpdateRadarProductSettings(map::MapWidget* mapWidget) }); } - // Update toolbox active item to render - QToolBox* toolbox = mainWindow_->ui->radarToolbox; - int currentIndex = toolbox->currentIndex(); - toolbox->setCurrentWidget(mainWindow_->ui->productSettingsPage); - toolbox->setCurrentIndex(currentIndex); - - // Set each elevation cut's tool button to the same size - int elevationCutMaxWidth = 0; - for (QToolButton* widget : - mainWindow_->ui->elevationSettings->findChildren()) - { - elevationCutMaxWidth = std::max(elevationCutMaxWidth, widget->width()); - } - for (QToolButton* widget : - mainWindow_->ui->elevationSettings->findChildren()) - { - widget->setMinimumWidth(elevationCutMaxWidth); - } - - elevationCuts_ = elevationCuts; + elevationCuts_ = elevationCuts; + resizeElevationButtons_ = true; } } // namespace main diff --git a/scwx-qt/source/scwx/qt/main/main_window.hpp b/scwx-qt/source/scwx/qt/main/main_window.hpp index 7510ca9a..868dfd60 100644 --- a/scwx-qt/source/scwx/qt/main/main_window.hpp +++ b/scwx-qt/source/scwx/qt/main/main_window.hpp @@ -26,6 +26,7 @@ public: MainWindow(QWidget* parent = nullptr); ~MainWindow(); + bool event(QEvent* event) override; void showEvent(QShowEvent* event) override; private: diff --git a/scwx-qt/source/scwx/qt/main/main_window.ui b/scwx-qt/source/scwx/qt/main/main_window.ui index 2a34fcf9..0095d26e 100644 --- a/scwx-qt/source/scwx/qt/main/main_window.ui +++ b/scwx-qt/source/scwx/qt/main/main_window.ui @@ -62,86 +62,164 @@ 2 - - - - Radar Sites - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - Radar Products - - - - - - Level 2 - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - Product Settings - - - - - - Elevation - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + + 16777215 + 13 + + + + ... + + + + + + + St. Louis, MO + + + + + + + Volume Coverage Pattern + + + VCP + + + + + + + KLSX + + + + + + + Radar Site + + + + + + + Clear Air Mode + + + + + + + 35 + + + + + + + + Radar Products + + + + + + Level 2 + + + + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + + Qt::Horizontal + + + + + + + Level 3 + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + + + + + Elevation + + + + + + + Settings + + + + + + Declutter + + + + + + + + + + Qt::Vertical + + + + 20 + 0 + + + + diff --git a/scwx-qt/ts/scwx_en_US.ts b/scwx-qt/ts/scwx_en_US.ts index 0a994763..2d150155 100644 --- a/scwx-qt/ts/scwx_en_US.ts +++ b/scwx-qt/ts/scwx_en_US.ts @@ -14,27 +14,57 @@ - - Radar Sites + + ... - + + Level 3 + + + + + Settings + + + + + Declutter + + + + + Radar Site + + + + + Volume Coverage Pattern + + + + + VCP + + + + + Clear Air Mode + + + + Radar Products - + Level 2 - - Product Settings - - - - + Elevation