Add placefile settings initial layout

This commit is contained in:
Dan Paulat 2023-07-22 14:15:56 -05:00
parent ae1bca3602
commit 4c685e5abb
8 changed files with 207 additions and 4 deletions

View file

@ -0,0 +1,38 @@
#include "placefile_settings_widget.hpp"
#include "ui_placefile_settings_widget.h"
namespace scwx
{
namespace qt
{
namespace ui
{
class PlacefileSettingsWidgetImpl
{
public:
explicit PlacefileSettingsWidgetImpl(PlacefileSettingsWidget* self) :
self_ {self}
{
}
~PlacefileSettingsWidgetImpl() = default;
PlacefileSettingsWidget* self_;
};
PlacefileSettingsWidget::PlacefileSettingsWidget(QWidget* parent) :
QFrame(parent),
p {std::make_unique<PlacefileSettingsWidgetImpl>(this)},
ui(new Ui::PlacefileSettingsWidget)
{
ui->setupUi(this);
}
PlacefileSettingsWidget::~PlacefileSettingsWidget()
{
delete ui;
}
} // namespace ui
} // namespace qt
} // namespace scwx

View file

@ -0,0 +1,35 @@
#pragma once
#include <QFrame>
namespace Ui
{
class PlacefileSettingsWidget;
}
namespace scwx
{
namespace qt
{
namespace ui
{
class PlacefileSettingsWidgetImpl;
class PlacefileSettingsWidget : public QFrame
{
Q_OBJECT
public:
explicit PlacefileSettingsWidget(QWidget* parent = nullptr);
~PlacefileSettingsWidget();
private:
friend class PlacefileSettingsWidgetImpl;
std::unique_ptr<PlacefileSettingsWidgetImpl> p;
Ui::PlacefileSettingsWidget* ui;
};
} // namespace ui
} // namespace qt
} // namespace scwx

View file

@ -0,0 +1,88 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>PlacefileSettingsWidget</class>
<widget class="QFrame" name="PlacefileSettingsWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Frame</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTreeView" name="placefileView"/>
</item>
<item>
<widget class="QFrame" name="buttonFrame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<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="QLineEdit" name="placefileFilter">
<property name="placeholderText">
<string>Filter</string>
</property>
<property name="clearButtonEnabled">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="addButton">
<property name="text">
<string>&amp;Add</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="removeButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>&amp;Remove</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View file

@ -8,6 +8,7 @@
#include <scwx/qt/map/map_provider.hpp>
#include <scwx/qt/settings/settings_interface.hpp>
#include <scwx/qt/types/alert_types.hpp>
#include <scwx/qt/ui/placefile_settings_widget.hpp>
#include <scwx/qt/ui/radar_site_dialog.hpp>
#include <scwx/qt/util/color.hpp>
#include <scwx/qt/util/file.hpp>
@ -115,6 +116,7 @@ public:
void SetupGeneralTab();
void SetupPalettesColorTablesTab();
void SetupPalettesAlertsTab();
void SetupPlacefilesTab();
void ShowColorDialog(QLineEdit* lineEdit, QFrame* frame = nullptr);
void UpdateRadarDialogLocation(const std::string& id);
@ -136,8 +138,9 @@ public:
RadarSiteLabel(std::shared_ptr<config::RadarSite>& radarSite);
static void SetBackgroundColor(const std::string& value, QFrame* frame);
SettingsDialog* self_;
RadarSiteDialog* radarSiteDialog_;
SettingsDialog* self_;
PlacefileSettingsWidget* placefileSettingsWidget_;
RadarSiteDialog* radarSiteDialog_;
settings::SettingsInterface<std::string> defaultRadarSite_ {};
settings::SettingsInterface<std::vector<std::int64_t>> fontSizes_ {};
@ -178,6 +181,9 @@ SettingsDialog::SettingsDialog(QWidget* parent) :
// Palettes > Alerts
p->SetupPalettesAlertsTab();
// Placefiles
p->SetupPlacefilesTab();
p->ConnectSignals();
}
@ -618,6 +624,12 @@ void SettingsDialogImpl::SetupPalettesAlertsTab()
}
}
void SettingsDialogImpl::SetupPlacefilesTab()
{
placefileSettingsWidget_ = new PlacefileSettingsWidget(self_);
self_->ui->placefiles->layout()->addWidget(placefileSettingsWidget_);
}
QImage SettingsDialogImpl::GenerateColorTableImage(
std::shared_ptr<common::ColorTable> colorTable,
std::uint16_t min,

View file

@ -73,6 +73,15 @@
<normaloff>:/res/icons/font-awesome-6/palette-solid.svg</normaloff>:/res/icons/font-awesome-6/palette-solid.svg</iconset>
</property>
</item>
<item>
<property name="text">
<string>Placefiles</string>
</property>
<property name="icon">
<iconset resource="../../../../scwx-qt.qrc">
<normaloff>:/res/icons/font-awesome-6/earth-americas-solid.svg</normaloff>:/res/icons/font-awesome-6/earth-americas-solid.svg</iconset>
</property>
</item>
</widget>
</item>
<item>
@ -338,8 +347,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>66</width>
<height>18</height>
<width>481</width>
<height>382</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_3">
@ -410,6 +419,22 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="placefiles">
<layout class="QVBoxLayout" name="verticalLayout_4">
<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>
</widget>
</item>
</layout>