mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 23:00:04 +00:00
Refining radar toolbox layout. Tool box is not a good use of the available space.
This commit is contained in:
parent
e76ac3bc36
commit
1aa9a9c0f0
4 changed files with 258 additions and 125 deletions
|
|
@ -25,7 +25,10 @@ class MainWindowImpl : public QObject
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit MainWindowImpl(MainWindow* mainWindow) :
|
explicit MainWindowImpl(MainWindow* mainWindow) :
|
||||||
mainWindow_ {mainWindow}, map_ {nullptr}, elevationCuts_ {}
|
mainWindow_ {mainWindow},
|
||||||
|
map_ {nullptr},
|
||||||
|
elevationCuts_ {},
|
||||||
|
resizeElevationButtons_ {false}
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
~MainWindowImpl() = default;
|
~MainWindowImpl() = default;
|
||||||
|
|
@ -38,6 +41,8 @@ public:
|
||||||
map::MapWidget* map_;
|
map::MapWidget* map_;
|
||||||
|
|
||||||
std::vector<float> elevationCuts_;
|
std::vector<float> elevationCuts_;
|
||||||
|
|
||||||
|
bool resizeElevationButtons_;
|
||||||
};
|
};
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget* parent) :
|
MainWindow::MainWindow(QWidget* parent) :
|
||||||
|
|
@ -57,7 +62,8 @@ MainWindow::MainWindow(QWidget* parent) :
|
||||||
|
|
||||||
// Add Level 2 Products
|
// Add Level 2 Products
|
||||||
QLayout* level2Layout = new ui::FlowLayout();
|
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())
|
for (common::Level2Product product : common::Level2ProductIterator())
|
||||||
{
|
{
|
||||||
|
|
@ -74,7 +80,10 @@ MainWindow::MainWindow(QWidget* parent) :
|
||||||
}
|
}
|
||||||
|
|
||||||
QLayout* elevationLayout = new ui::FlowLayout();
|
QLayout* elevationLayout = new ui::FlowLayout();
|
||||||
ui->elevationSettings->setLayout(elevationLayout);
|
ui->elevationGroupBox->setLayout(elevationLayout);
|
||||||
|
|
||||||
|
ui->settingsGroupBox->setVisible(false);
|
||||||
|
ui->declutterCheckbox->setVisible(false);
|
||||||
|
|
||||||
p->InitializeConnections();
|
p->InitializeConnections();
|
||||||
}
|
}
|
||||||
|
|
@ -84,30 +93,63 @@ MainWindow::~MainWindow()
|
||||||
delete ui;
|
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<QToolButton*>())
|
||||||
|
{
|
||||||
|
elevationCutMaxWidth =
|
||||||
|
std::max(elevationCutMaxWidth, widget->width());
|
||||||
|
}
|
||||||
|
for (QToolButton* widget :
|
||||||
|
ui->elevationGroupBox->findChildren<QToolButton*>())
|
||||||
|
{
|
||||||
|
widget->setMinimumWidth(elevationCutMaxWidth);
|
||||||
|
}
|
||||||
|
|
||||||
|
p->resizeElevationButtons_ = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return QMainWindow::event(event);
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::showEvent(QShowEvent* event)
|
void MainWindow::showEvent(QShowEvent* event)
|
||||||
{
|
{
|
||||||
QMainWindow::showEvent(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
|
// Set each level 2 product's tool button to the same size
|
||||||
int level2MaxWidth = 0;
|
int level2MaxWidth = 0;
|
||||||
for (QWidget* widget : ui->level2Products->findChildren<QWidget*>())
|
for (QToolButton* widget :
|
||||||
|
ui->level2ProductFrame->findChildren<QToolButton*>())
|
||||||
{
|
{
|
||||||
level2MaxWidth = std::max(level2MaxWidth, widget->width());
|
level2MaxWidth = std::max(level2MaxWidth, widget->width());
|
||||||
}
|
}
|
||||||
for (QWidget* widget : ui->level2Products->findChildren<QWidget*>())
|
for (QToolButton* widget :
|
||||||
|
ui->level2ProductFrame->findChildren<QToolButton*>())
|
||||||
{
|
{
|
||||||
widget->setMinimumWidth(level2MaxWidth);
|
widget->setMinimumWidth(level2MaxWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set each elevation cut's tool button to the same size
|
||||||
|
int elevationCutMaxWidth = 0;
|
||||||
|
for (QToolButton* widget :
|
||||||
|
ui->elevationGroupBox->findChildren<QToolButton*>())
|
||||||
|
{
|
||||||
|
elevationCutMaxWidth = std::max(elevationCutMaxWidth, widget->width());
|
||||||
|
}
|
||||||
|
for (QToolButton* widget :
|
||||||
|
ui->elevationGroupBox->findChildren<QToolButton*>())
|
||||||
|
{
|
||||||
|
widget->setMinimumWidth(elevationCutMaxWidth);
|
||||||
|
}
|
||||||
|
|
||||||
resizeDocks({ui->radarToolboxDock}, {150}, Qt::Horizontal);
|
resizeDocks({ui->radarToolboxDock}, {150}, Qt::Horizontal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -129,7 +171,7 @@ void MainWindowImpl::SelectRadarProduct(common::Level2Product product)
|
||||||
<< logPrefix_ << "Selecting Level 2 radar product: " << productName;
|
<< logPrefix_ << "Selecting Level 2 radar product: " << productName;
|
||||||
|
|
||||||
for (QToolButton* toolButton :
|
for (QToolButton* toolButton :
|
||||||
mainWindow_->ui->level2Products->findChildren<QToolButton*>())
|
mainWindow_->ui->level2ProductFrame->findChildren<QToolButton*>())
|
||||||
{
|
{
|
||||||
if (toolButton->text().toStdString() == productName)
|
if (toolButton->text().toStdString() == productName)
|
||||||
{
|
{
|
||||||
|
|
@ -157,12 +199,12 @@ void MainWindowImpl::UpdateRadarProductSettings(map::MapWidget* mapWidget)
|
||||||
}
|
}
|
||||||
|
|
||||||
for (QToolButton* toolButton :
|
for (QToolButton* toolButton :
|
||||||
mainWindow_->ui->elevationSettings->findChildren<QToolButton*>())
|
mainWindow_->ui->elevationGroupBox->findChildren<QToolButton*>())
|
||||||
{
|
{
|
||||||
delete toolButton;
|
delete toolButton;
|
||||||
}
|
}
|
||||||
|
|
||||||
QLayout* layout = mainWindow_->ui->elevationSettings->layout();
|
QLayout* layout = mainWindow_->ui->elevationGroupBox->layout();
|
||||||
|
|
||||||
// Create elevation cut tool buttons
|
// Create elevation cut tool buttons
|
||||||
for (float elevationCut : elevationCuts)
|
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<QToolButton*>())
|
|
||||||
{
|
|
||||||
elevationCutMaxWidth = std::max(elevationCutMaxWidth, widget->width());
|
|
||||||
}
|
|
||||||
for (QToolButton* widget :
|
|
||||||
mainWindow_->ui->elevationSettings->findChildren<QToolButton*>())
|
|
||||||
{
|
|
||||||
widget->setMinimumWidth(elevationCutMaxWidth);
|
|
||||||
}
|
|
||||||
|
|
||||||
elevationCuts_ = elevationCuts;
|
elevationCuts_ = elevationCuts;
|
||||||
|
resizeElevationButtons_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace main
|
} // namespace main
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ public:
|
||||||
MainWindow(QWidget* parent = nullptr);
|
MainWindow(QWidget* parent = nullptr);
|
||||||
~MainWindow();
|
~MainWindow();
|
||||||
|
|
||||||
|
bool event(QEvent* event) override;
|
||||||
void showEvent(QShowEvent* event) override;
|
void showEvent(QShowEvent* event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
|
|
@ -62,78 +62,160 @@
|
||||||
<number>2</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QToolBox" name="radarToolbox">
|
<widget class="QFrame" name="radarInfoFrame">
|
||||||
<widget class="QWidget" name="radarSitesPage">
|
<property name="frameShape">
|
||||||
<attribute name="label">
|
<enum>QFrame::StyledPanel</enum>
|
||||||
<string>Radar Sites</string>
|
|
||||||
</attribute>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
|
||||||
<item>
|
|
||||||
<widget class="QTableWidget" name="tableWidget"/>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="radarSitesSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Raised</enum>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout" columnstretch="0,1,0">
|
||||||
|
<item row="0" column="2">
|
||||||
|
<widget class="QToolButton" name="radarSiteSelectButton">
|
||||||
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>20</width>
|
<width>16777215</width>
|
||||||
<height>40</height>
|
<height>13</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
<property name="text">
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1" colspan="2">
|
||||||
|
<widget class="QLabel" name="radarLocationLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">St. Louis, MO</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="vcpLabel">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Volume Coverage Pattern</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>VCP</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLabel" name="radarSiteValueLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">KLSX</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="radarSiteLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Radar Site</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1" colspan="2">
|
||||||
|
<widget class="QLabel" name="vcpDescriptionLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Clear Air Mode</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1" colspan="2">
|
||||||
|
<widget class="QLabel" name="vcpValueLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">35</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="radarProductsPage">
|
</item>
|
||||||
<attribute name="label">
|
|
||||||
<string>Radar Products</string>
|
|
||||||
</attribute>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="level2Products">
|
<widget class="QGroupBox" name="radarProductGroupBox">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
|
<string>Radar Products</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="level2Label">
|
||||||
|
<property name="text">
|
||||||
<string>Level 2</string>
|
<string>Level 2</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="radarProductsSpacer">
|
<widget class="QWidget" name="level2ProductFrame" native="true"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QFrame" name="frame">
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::StyledPanel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Raised</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="Line" name="level2Separator">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
</widget>
|
||||||
<size>
|
</item>
|
||||||
<width>20</width>
|
<item>
|
||||||
<height>40</height>
|
<widget class="QLabel" name="level3Label">
|
||||||
</size>
|
<property name="text">
|
||||||
|
<string>Level 3</string>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QFrame" name="level3ProductFrame">
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::StyledPanel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Raised</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="productSettingsPage">
|
</item>
|
||||||
<attribute name="label">
|
|
||||||
<string>Product Settings</string>
|
|
||||||
</attribute>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="elevationSettings">
|
<widget class="QGroupBox" name="elevationGroupBox">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Elevation</string>
|
<string>Elevation</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="productSettingsSpacer">
|
<widget class="QGroupBox" name="settingsGroupBox">
|
||||||
|
<property name="title">
|
||||||
|
<string>Settings</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="declutterCheckbox">
|
||||||
|
<property name="text">
|
||||||
|
<string>Declutter</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="radarToolboxSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>20</width>
|
<width>20</width>
|
||||||
<height>40</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
|
|
@ -141,10 +223,6 @@
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
|
|
|
||||||
|
|
@ -14,27 +14,57 @@
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../source/scwx/qt/main/main_window.ui" line="68"/>
|
<location filename="../source/scwx/qt/main/main_window.ui" line="82"/>
|
||||||
<source>Radar Sites</source>
|
<source>...</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../source/scwx/qt/main/main_window.ui" line="91"/>
|
<location filename="../source/scwx/qt/main/main_window.ui" line="170"/>
|
||||||
|
<source>Level 3</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../source/scwx/qt/main/main_window.ui" line="197"/>
|
||||||
|
<source>Settings</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../source/scwx/qt/main/main_window.ui" line="203"/>
|
||||||
|
<source>Declutter</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../source/scwx/qt/main/main_window.ui" line="113"/>
|
||||||
|
<source>Radar Site</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../source/scwx/qt/main/main_window.ui" line="96"/>
|
||||||
|
<source>Volume Coverage Pattern</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../source/scwx/qt/main/main_window.ui" line="99"/>
|
||||||
|
<source>VCP</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../source/scwx/qt/main/main_window.ui" line="120"/>
|
||||||
|
<source>Clear Air Mode</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../source/scwx/qt/main/main_window.ui" line="137"/>
|
||||||
<source>Radar Products</source>
|
<source>Radar Products</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../source/scwx/qt/main/main_window.ui" line="97"/>
|
<location filename="../source/scwx/qt/main/main_window.ui" line="143"/>
|
||||||
<source>Level 2</source>
|
<source>Level 2</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../source/scwx/qt/main/main_window.ui" line="118"/>
|
<location filename="../source/scwx/qt/main/main_window.ui" line="190"/>
|
||||||
<source>Product Settings</source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../source/scwx/qt/main/main_window.ui" line="124"/>
|
|
||||||
<source>Elevation</source>
|
<source>Elevation</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue