mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 16:30:05 +00:00
Connecting Radar Product Manager creation to Radar Product Model
This commit is contained in:
parent
98f8bab79a
commit
4c4c93cad1
6 changed files with 98 additions and 10 deletions
|
|
@ -50,9 +50,11 @@ set(HDR_GL_DRAW source/scwx/qt/gl/draw/draw_item.hpp
|
|||
set(SRC_GL_DRAW source/scwx/qt/gl/draw/draw_item.cpp
|
||||
source/scwx/qt/gl/draw/rectangle.cpp)
|
||||
set(HDR_MANAGER source/scwx/qt/manager/radar_product_manager.hpp
|
||||
source/scwx/qt/manager/radar_product_manager_notifier.hpp
|
||||
source/scwx/qt/manager/resource_manager.hpp
|
||||
source/scwx/qt/manager/settings_manager.hpp)
|
||||
set(SRC_MANAGER source/scwx/qt/manager/radar_product_manager.cpp
|
||||
source/scwx/qt/manager/radar_product_manager_notifier.cpp
|
||||
source/scwx/qt/manager/resource_manager.cpp
|
||||
source/scwx/qt/manager/settings_manager.cpp)
|
||||
set(HDR_MAP source/scwx/qt/map/color_table_layer.hpp
|
||||
|
|
|
|||
|
|
@ -124,8 +124,6 @@ MainWindow::MainWindow(QWidget* parent) :
|
|||
ui->vcpValueLabel->setVisible(false);
|
||||
ui->vcpDescriptionLabel->setVisible(false);
|
||||
|
||||
p->ConfigureMapLayout();
|
||||
|
||||
// Configure Menu
|
||||
ui->menuView->insertAction(ui->actionRadarToolbox,
|
||||
ui->radarToolboxDock->toggleViewAction());
|
||||
|
|
@ -143,6 +141,9 @@ MainWindow::MainWindow(QWidget* parent) :
|
|||
|
||||
ui->resourceTreeView->setModel(new model::RadarProductModel());
|
||||
|
||||
// Configure Map
|
||||
p->ConfigureMapLayout();
|
||||
|
||||
// Add Level 2 Products
|
||||
p->level2ProductsWidget_ = new ui::Level2ProductsWidget(this);
|
||||
ui->radarProductGroupBox->layout()->replaceWidget(ui->level2ProductFrame,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#include <scwx/qt/manager/radar_product_manager.hpp>
|
||||
#include <scwx/qt/manager/radar_product_manager_notifier.hpp>
|
||||
#include <scwx/common/constants.hpp>
|
||||
#include <scwx/provider/nexrad_data_provider_factory.hpp>
|
||||
#include <scwx/util/logger.hpp>
|
||||
|
|
@ -943,6 +944,8 @@ RadarProductManager::Instance(const std::string& radarSite)
|
|||
{
|
||||
instanceMap_[radarSite] =
|
||||
std::make_shared<RadarProductManager>(radarSite);
|
||||
emit RadarProductManagerNotifier::Instance().RadarProductManagerCreated(
|
||||
radarSite);
|
||||
}
|
||||
|
||||
return instanceMap_[radarSite];
|
||||
|
|
|
|||
|
|
@ -0,0 +1,34 @@
|
|||
#include <scwx/qt/manager/radar_product_manager_notifier.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace manager
|
||||
{
|
||||
|
||||
static const std::string logPrefix_ =
|
||||
"scwx::qt::manager::radar_product_manager_notifier";
|
||||
|
||||
class RadarProductManagerNotifierImpl
|
||||
{
|
||||
public:
|
||||
explicit RadarProductManagerNotifierImpl() {}
|
||||
~RadarProductManagerNotifierImpl() {}
|
||||
};
|
||||
|
||||
RadarProductManagerNotifier::RadarProductManagerNotifier() :
|
||||
p(std::make_unique<RadarProductManagerNotifierImpl>())
|
||||
{
|
||||
}
|
||||
RadarProductManagerNotifier::~RadarProductManagerNotifier() = default;
|
||||
|
||||
RadarProductManagerNotifier& RadarProductManagerNotifier::Instance()
|
||||
{
|
||||
static RadarProductManagerNotifier instance_ {};
|
||||
return instance_;
|
||||
}
|
||||
|
||||
} // namespace manager
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <QObject>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace manager
|
||||
{
|
||||
|
||||
class RadarProductManagerNotifierImpl;
|
||||
|
||||
class RadarProductManagerNotifier : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit RadarProductManagerNotifier();
|
||||
~RadarProductManagerNotifier();
|
||||
|
||||
static RadarProductManagerNotifier& Instance();
|
||||
|
||||
signals:
|
||||
void RadarProductManagerCreated(const std::string& radarSite);
|
||||
|
||||
private:
|
||||
std::unique_ptr<RadarProductManagerNotifierImpl> p;
|
||||
};
|
||||
|
||||
} // namespace manager
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
#include <scwx/qt/model/radar_product_model.hpp>
|
||||
#include <scwx/qt/manager/radar_product_manager_notifier.hpp>
|
||||
#include <scwx/util/logger.hpp>
|
||||
|
||||
namespace scwx
|
||||
|
|
@ -11,16 +12,12 @@ namespace model
|
|||
static const std::string logPrefix_ = "scwx::qt::model::radar_product_model";
|
||||
static const auto logger_ = scwx::util::Logger::Create(logPrefix_);
|
||||
|
||||
class RadarProductModelImpl
|
||||
class RadarProductModelImpl : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit RadarProductModelImpl() :
|
||||
rootItem_ {std::make_shared<TreeItem>(
|
||||
std::vector<QVariant> {QObject::tr("Name"), QObject::tr("Info")})}
|
||||
{
|
||||
rootItem_->AppendChild(new TreeItem(
|
||||
std::vector<QVariant> {QObject::tr("MyItem"), QObject::tr("Data")}));
|
||||
}
|
||||
explicit RadarProductModelImpl();
|
||||
~RadarProductModelImpl() = default;
|
||||
|
||||
std::shared_ptr<TreeItem> rootItem_;
|
||||
|
|
@ -37,6 +34,22 @@ const std::shared_ptr<TreeItem> RadarProductModel::root_item() const
|
|||
return p->rootItem_;
|
||||
}
|
||||
|
||||
RadarProductModelImpl::RadarProductModelImpl() :
|
||||
rootItem_ {std::make_shared<TreeItem>(
|
||||
std::vector<QVariant> {QObject::tr("Name"), QObject::tr("Info")})}
|
||||
{
|
||||
connect(&manager::RadarProductManagerNotifier::Instance(),
|
||||
&manager::RadarProductManagerNotifier::RadarProductManagerCreated,
|
||||
this,
|
||||
[=](const std::string& radarSite)
|
||||
{
|
||||
rootItem_->AppendChild(new TreeItem(
|
||||
std::vector<QVariant> {QString::fromStdString(radarSite)}));
|
||||
});
|
||||
}
|
||||
|
||||
#include "radar_product_model.moc"
|
||||
|
||||
} // namespace model
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue