mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 21:40:05 +00:00
Remove resource explorer
This commit is contained in:
parent
bb2d3a92ad
commit
ce426bacc9
6 changed files with 0 additions and 335 deletions
|
|
@ -122,7 +122,6 @@ set(HDR_MODEL source/scwx/qt/model/alert_model.hpp
|
|||
source/scwx/qt/model/imgui_context_model.hpp
|
||||
source/scwx/qt/model/layer_model.hpp
|
||||
source/scwx/qt/model/placefile_model.hpp
|
||||
source/scwx/qt/model/radar_product_model.hpp
|
||||
source/scwx/qt/model/radar_site_model.hpp
|
||||
source/scwx/qt/model/tree_item.hpp
|
||||
source/scwx/qt/model/tree_model.hpp)
|
||||
|
|
@ -131,7 +130,6 @@ set(SRC_MODEL source/scwx/qt/model/alert_model.cpp
|
|||
source/scwx/qt/model/imgui_context_model.cpp
|
||||
source/scwx/qt/model/layer_model.cpp
|
||||
source/scwx/qt/model/placefile_model.cpp
|
||||
source/scwx/qt/model/radar_product_model.cpp
|
||||
source/scwx/qt/model/radar_site_model.cpp
|
||||
source/scwx/qt/model/tree_item.cpp
|
||||
source/scwx/qt/model/tree_model.cpp)
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@
|
|||
#include <scwx/qt/manager/update_manager.hpp>
|
||||
#include <scwx/qt/map/map_provider.hpp>
|
||||
#include <scwx/qt/map/map_widget.hpp>
|
||||
#include <scwx/qt/model/radar_product_model.hpp>
|
||||
#include <scwx/qt/settings/general_settings.hpp>
|
||||
#include <scwx/qt/settings/map_settings.hpp>
|
||||
#include <scwx/qt/settings/ui_settings.hpp>
|
||||
|
|
@ -84,7 +83,6 @@ public:
|
|||
radarSiteDialog_ {nullptr},
|
||||
settingsDialog_ {nullptr},
|
||||
updateDialog_ {nullptr},
|
||||
radarProductModel_ {nullptr},
|
||||
placefileManager_ {manager::PlacefileManager::Instance()},
|
||||
textEventManager_ {manager::TextEventManager::Instance()},
|
||||
timelineManager_ {manager::TimelineManager::Instance()},
|
||||
|
|
@ -175,7 +173,6 @@ public:
|
|||
ui::SettingsDialog* settingsDialog_;
|
||||
ui::UpdateDialog* updateDialog_;
|
||||
|
||||
std::unique_ptr<model::RadarProductModel> radarProductModel_;
|
||||
std::shared_ptr<manager::PlacefileManager> placefileManager_;
|
||||
std::shared_ptr<manager::TextEventManager> textEventManager_;
|
||||
std::shared_ptr<manager::TimelineManager> timelineManager_;
|
||||
|
|
@ -222,13 +219,6 @@ MainWindow::MainWindow(QWidget* parent) :
|
|||
ui->radarToolboxDock->toggleViewAction()->setText(tr("Radar &Toolbox"));
|
||||
ui->actionRadarToolbox->setVisible(false);
|
||||
|
||||
ui->menuView->insertAction(ui->actionResourceExplorer,
|
||||
ui->resourceExplorerDock->toggleViewAction());
|
||||
ui->resourceExplorerDock->toggleViewAction()->setText(
|
||||
tr("&Resource Explorer"));
|
||||
ui->actionResourceExplorer->setVisible(false);
|
||||
ui->resourceExplorerDock->toggleViewAction()->setVisible(false);
|
||||
|
||||
ui->menuView->insertAction(ui->actionAlerts,
|
||||
p->alertDockWidget_->toggleViewAction());
|
||||
p->alertDockWidget_->toggleViewAction()->setText(tr("&Alerts"));
|
||||
|
|
@ -237,12 +227,6 @@ MainWindow::MainWindow(QWidget* parent) :
|
|||
ui->menuDebug->menuAction()->setVisible(
|
||||
settings::GeneralSettings::Instance().debug_enabled().GetValue());
|
||||
|
||||
// Configure Resource Explorer Dock
|
||||
ui->resourceExplorerDock->setVisible(false);
|
||||
|
||||
p->radarProductModel_ = std::make_unique<model::RadarProductModel>();
|
||||
ui->resourceTreeView->setModel(p->radarProductModel_->model());
|
||||
|
||||
// Configure Map
|
||||
p->ConfigureMapLayout();
|
||||
|
||||
|
|
@ -529,83 +513,6 @@ void MainWindow::on_radarSiteSelectButton_clicked()
|
|||
p->radarSiteDialog_->show();
|
||||
}
|
||||
|
||||
void MainWindow::on_resourceTreeCollapseAllButton_clicked()
|
||||
{
|
||||
ui->resourceTreeView->collapseAll();
|
||||
}
|
||||
|
||||
void MainWindow::on_resourceTreeExpandAllButton_clicked()
|
||||
{
|
||||
ui->resourceTreeView->expandAll();
|
||||
}
|
||||
|
||||
void MainWindow::on_resourceTreeView_doubleClicked(const QModelIndex& index)
|
||||
{
|
||||
std::string selectedString {index.data().toString().toStdString()};
|
||||
std::chrono::system_clock::time_point time {};
|
||||
|
||||
logger_->debug("Selecting resource: {}",
|
||||
index.data().toString().toStdString());
|
||||
|
||||
static const std::string timeFormat {"%Y-%m-%d %H:%M:%S"};
|
||||
|
||||
using namespace std::chrono;
|
||||
|
||||
#if !defined(_MSC_VER)
|
||||
using namespace date;
|
||||
#endif
|
||||
|
||||
std::istringstream in {selectedString};
|
||||
in >> parse(timeFormat, time);
|
||||
|
||||
if (in.fail())
|
||||
{
|
||||
// Not a time string, ignore double-click
|
||||
return;
|
||||
}
|
||||
|
||||
QModelIndex parent1 = index.parent();
|
||||
QModelIndex parent2 = parent1.parent();
|
||||
QModelIndex parent3 = parent2.parent();
|
||||
|
||||
std::string radarSite {};
|
||||
std::string groupName {};
|
||||
std::string product {};
|
||||
|
||||
if (!parent2.isValid())
|
||||
{
|
||||
// A time entry should be at the third or fourth level
|
||||
logger_->error("Unexpected resource data");
|
||||
return;
|
||||
}
|
||||
|
||||
if (parent3.isValid())
|
||||
{
|
||||
// Level 3 Product
|
||||
radarSite = parent3.data().toString().toStdString();
|
||||
groupName = parent2.data().toString().toStdString();
|
||||
product = parent1.data().toString().toStdString();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Level 2 Product
|
||||
radarSite = parent2.data().toString().toStdString();
|
||||
groupName = parent1.data().toString().toStdString();
|
||||
// No product index
|
||||
}
|
||||
|
||||
common::RadarProductGroup group = common::GetRadarProductGroup(groupName);
|
||||
|
||||
// Update radar site if different from currently selected
|
||||
if (p->activeMap_->GetRadarSite()->id() != radarSite)
|
||||
{
|
||||
p->activeMap_->SelectRadarSite(radarSite);
|
||||
}
|
||||
|
||||
// Select the updated radar product
|
||||
p->activeMap_->SelectRadarProduct(group, product, 0, time);
|
||||
}
|
||||
|
||||
void MainWindowImpl::AsyncSetup()
|
||||
{
|
||||
auto& generalSettings = settings::GeneralSettings::Instance();
|
||||
|
|
|
|||
|
|
@ -47,9 +47,6 @@ private slots:
|
|||
void on_actionCheckForUpdates_triggered();
|
||||
void on_actionAboutSupercellWx_triggered();
|
||||
void on_radarSiteSelectButton_clicked();
|
||||
void on_resourceTreeCollapseAllButton_clicked();
|
||||
void on_resourceTreeExpandAllButton_clicked();
|
||||
void on_resourceTreeView_doubleClicked(const QModelIndex& index);
|
||||
|
||||
private:
|
||||
std::unique_ptr<MainWindowImpl> p;
|
||||
|
|
|
|||
|
|
@ -76,7 +76,6 @@
|
|||
<string>&View</string>
|
||||
</property>
|
||||
<addaction name="actionRadarToolbox"/>
|
||||
<addaction name="actionResourceExplorer"/>
|
||||
<addaction name="actionAlerts"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuDebug">
|
||||
|
|
@ -268,80 +267,6 @@
|
|||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QDockWidget" name="resourceExplorerDock">
|
||||
<property name="windowTitle">
|
||||
<string>Resource Explorer</string>
|
||||
</property>
|
||||
<attribute name="dockWidgetArea">
|
||||
<number>2</number>
|
||||
</attribute>
|
||||
<widget class="QWidget" name="dockWidgetContents">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<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>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>193</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="resourceTreeExpandAllButton">
|
||||
<property name="toolTip">
|
||||
<string>Expand All</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../../scwx-qt.qrc">
|
||||
<normaloff>:/res/icons/font-awesome-6/square-plus-regular.svg</normaloff>:/res/icons/font-awesome-6/square-plus-regular.svg</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="resourceTreeCollapseAllButton">
|
||||
<property name="toolTip">
|
||||
<string>Collapse All</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../../scwx-qt.qrc">
|
||||
<normaloff>:/res/icons/font-awesome-6/square-minus-regular.svg</normaloff>:/res/icons/font-awesome-6/square-minus-regular.svg</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTreeView" name="resourceTreeView"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<action name="actionExit">
|
||||
<property name="text">
|
||||
<string>E&xit</string>
|
||||
|
|
@ -357,11 +282,6 @@
|
|||
<string>Radar &Toolbox</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionResourceExplorer">
|
||||
<property name="text">
|
||||
<string>&Resource Explorer</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionOpenNexrad">
|
||||
<property name="text">
|
||||
<string>&NEXRAD Product...</string>
|
||||
|
|
|
|||
|
|
@ -1,127 +0,0 @@
|
|||
#include <scwx/qt/model/radar_product_model.hpp>
|
||||
#include <scwx/qt/model/tree_model.hpp>
|
||||
#include <scwx/qt/manager/radar_product_manager.hpp>
|
||||
#include <scwx/qt/manager/radar_product_manager_notifier.hpp>
|
||||
#include <scwx/util/logger.hpp>
|
||||
#include <scwx/util/time.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace model
|
||||
{
|
||||
|
||||
static const std::string logPrefix_ = "scwx::qt::model::radar_product_model";
|
||||
static const auto logger_ = scwx::util::Logger::Create(logPrefix_);
|
||||
|
||||
class RadarProductModelImpl : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit RadarProductModelImpl(RadarProductModel* self);
|
||||
~RadarProductModelImpl() = default;
|
||||
|
||||
RadarProductModel* self_;
|
||||
std::unique_ptr<TreeModel> model_;
|
||||
};
|
||||
|
||||
RadarProductModel::RadarProductModel() :
|
||||
p(std::make_unique<RadarProductModelImpl>(this))
|
||||
{
|
||||
}
|
||||
RadarProductModel::~RadarProductModel() = default;
|
||||
|
||||
QAbstractItemModel* RadarProductModel::model()
|
||||
{
|
||||
return p->model_.get();
|
||||
}
|
||||
|
||||
RadarProductModelImpl::RadarProductModelImpl(RadarProductModel* self) :
|
||||
self_ {self},
|
||||
model_ {std::make_unique<TreeModel>(
|
||||
std::vector<QVariant> {QObject::tr("Product")})}
|
||||
{
|
||||
connect(
|
||||
&manager::RadarProductManagerNotifier::Instance(),
|
||||
&manager::RadarProductManagerNotifier::RadarProductManagerCreated,
|
||||
this,
|
||||
[this](const std::string& radarSite)
|
||||
{
|
||||
logger_->debug("Adding radar site: {}", radarSite);
|
||||
|
||||
const QString radarSiteName {QString::fromStdString(radarSite)};
|
||||
|
||||
// Find existing radar site item (e.g., KLSX, KEAX)
|
||||
TreeItem* radarSiteItem =
|
||||
model_->root_item()->FindChild(0, radarSiteName);
|
||||
|
||||
if (radarSiteItem == nullptr)
|
||||
{
|
||||
radarSiteItem = new TreeItem({radarSiteName});
|
||||
model_->AppendRow(model_->root_item(), radarSiteItem);
|
||||
}
|
||||
|
||||
connect(
|
||||
manager::RadarProductManager::Instance(radarSite).get(),
|
||||
&manager::RadarProductManager::NewDataAvailable,
|
||||
this,
|
||||
[=, this](common::RadarProductGroup group,
|
||||
const std::string& product,
|
||||
std::chrono::system_clock::time_point latestTime)
|
||||
{
|
||||
const QString groupName {QString::fromStdString(
|
||||
common::GetRadarProductGroupName(group))};
|
||||
|
||||
// Find existing group item (e.g., Level 2, Level 3)
|
||||
TreeItem* groupItem = radarSiteItem->FindChild(0, groupName);
|
||||
|
||||
if (groupItem == nullptr)
|
||||
{
|
||||
// Existing group item was not found, create it
|
||||
groupItem = new TreeItem({groupName});
|
||||
model_->AppendRow(radarSiteItem, groupItem);
|
||||
}
|
||||
|
||||
TreeItem* productItem = nullptr;
|
||||
|
||||
if (group == common::RadarProductGroup::Level2)
|
||||
{
|
||||
// Level 2 items are not separated by product
|
||||
productItem = groupItem;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Find existing product item (e.g., N0B, N0Q)
|
||||
const QString productName {QString::fromStdString(product)};
|
||||
productItem = groupItem->FindChild(0, productName);
|
||||
|
||||
if (productItem == nullptr)
|
||||
{
|
||||
// Existing product item was not found, create it
|
||||
productItem = new TreeItem({productName});
|
||||
model_->AppendRow(groupItem, productItem);
|
||||
}
|
||||
}
|
||||
|
||||
// Find existing time item (e.g., 2023-04-10 10:11:12)
|
||||
const QString timeString =
|
||||
QString::fromStdString(util::TimeString(latestTime));
|
||||
TreeItem* timeItem = productItem->FindChild(0, timeString);
|
||||
|
||||
if (timeItem == nullptr)
|
||||
{
|
||||
// Create leaf item for product time
|
||||
model_->AppendRow(productItem, new TreeItem {timeString});
|
||||
}
|
||||
},
|
||||
Qt::QueuedConnection);
|
||||
});
|
||||
}
|
||||
|
||||
#include "radar_product_model.moc"
|
||||
|
||||
} // namespace model
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include <QAbstractItemModel>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace model
|
||||
{
|
||||
|
||||
class RadarProductModelImpl;
|
||||
|
||||
class RadarProductModel
|
||||
{
|
||||
public:
|
||||
explicit RadarProductModel();
|
||||
~RadarProductModel();
|
||||
|
||||
QAbstractItemModel* model();
|
||||
|
||||
private:
|
||||
std::unique_ptr<RadarProductModelImpl> p;
|
||||
|
||||
friend class RadarProductModelImpl;
|
||||
};
|
||||
|
||||
} // namespace model
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
Loading…
Add table
Add a link
Reference in a new issue