Connecting Radar Product Manager creation to Radar Product Model

This commit is contained in:
Dan Paulat 2022-09-19 23:46:15 -05:00
parent 98f8bab79a
commit 4c4c93cad1
6 changed files with 98 additions and 10 deletions

View file

@ -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