Add dedicated Placefile Manager dialog separate from settings

This commit is contained in:
Dan Paulat 2023-10-10 22:33:23 -05:00
parent 4a92f11d00
commit f2addd29e6
11 changed files with 215 additions and 41 deletions

View file

@ -0,0 +1,45 @@
#include "placefile_dialog.hpp"
#include "ui_placefile_dialog.h"
#include <scwx/qt/ui/placefile_settings_widget.hpp>
#include <scwx/util/logger.hpp>
namespace scwx
{
namespace qt
{
namespace ui
{
static const std::string logPrefix_ = "scwx::qt::ui::placefile_dialog";
static const auto logger_ = scwx::util::Logger::Create(logPrefix_);
class PlacefileDialogImpl
{
public:
explicit PlacefileDialogImpl() {}
~PlacefileDialogImpl() = default;
PlacefileSettingsWidget* placefileSettingsWidget_ {nullptr};
};
PlacefileDialog::PlacefileDialog(QWidget* parent) :
QDialog(parent),
p {std::make_unique<PlacefileDialogImpl>()},
ui(new Ui::PlacefileDialog)
{
ui->setupUi(this);
p->placefileSettingsWidget_ = new PlacefileSettingsWidget(this);
p->placefileSettingsWidget_->layout()->setContentsMargins(0, 0, 0, 0);
ui->contentsFrame->layout()->addWidget(p->placefileSettingsWidget_);
}
PlacefileDialog::~PlacefileDialog()
{
delete ui;
}
} // namespace ui
} // namespace qt
} // namespace scwx

View file

@ -0,0 +1,35 @@
#pragma once
#include <QDialog>
namespace Ui
{
class PlacefileDialog;
}
namespace scwx
{
namespace qt
{
namespace ui
{
class PlacefileDialogImpl;
class PlacefileDialog : public QDialog
{
Q_OBJECT
public:
explicit PlacefileDialog(QWidget* parent = nullptr);
~PlacefileDialog();
private:
friend class PlacefileDialogImpl;
std::unique_ptr<PlacefileDialogImpl> p;
Ui::PlacefileDialog* 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>PlacefileDialog</class>
<widget class="QDialog" name="PlacefileDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>700</width>
<height>600</height>
</rect>
</property>
<property name="windowTitle">
<string>Placefile Manager</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QFrame" name="contentsFrame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_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>
</layout>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Close</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>PlacefileDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>PlacefileDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View file

@ -13,7 +13,6 @@
#include <scwx/qt/types/alert_types.hpp>
#include <scwx/qt/types/font_types.hpp>
#include <scwx/qt/types/text_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>
@ -135,7 +134,6 @@ public:
void SetupGeneralTab();
void SetupPalettesColorTablesTab();
void SetupPalettesAlertsTab();
void SetupPlacefilesTab();
void SetupTextTab();
void ShowColorDialog(QLineEdit* lineEdit, QFrame* frame = nullptr);
@ -162,10 +160,9 @@ public:
RadarSiteLabel(std::shared_ptr<config::RadarSite>& radarSite);
static void SetBackgroundColor(const std::string& value, QFrame* frame);
SettingsDialog* self_;
PlacefileSettingsWidget* placefileSettingsWidget_ {nullptr};
RadarSiteDialog* radarSiteDialog_;
QFontDialog* fontDialog_;
SettingsDialog* self_;
RadarSiteDialog* radarSiteDialog_;
QFontDialog* fontDialog_;
QStandardItemModel* fontCategoryModel_;
@ -226,9 +223,6 @@ SettingsDialog::SettingsDialog(QWidget* parent) :
// Text
p->SetupTextTab();
// Placefiles
p->SetupPlacefilesTab();
p->ConnectSignals();
}
@ -735,12 +729,6 @@ void SettingsDialogImpl::SetupPalettesAlertsTab()
}
}
void SettingsDialogImpl::SetupPlacefilesTab()
{
placefileSettingsWidget_ = new PlacefileSettingsWidget(self_);
self_->ui->placefiles->layout()->addWidget(placefileSettingsWidget_);
}
void SettingsDialogImpl::SetupTextTab()
{
settings::TextSettings& textSettings = settings::TextSettings::Instance();

View file

@ -82,15 +82,6 @@
<normaloff>:/res/icons/font-awesome-6/font-solid.svg</normaloff>:/res/icons/font-awesome-6/font-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>
@ -350,7 +341,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>481</width>
<width>512</width>
<height>382</height>
</rect>
</property>
@ -704,22 +695,6 @@
</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>