Skip to content

Commit

Permalink
Remove resource explorer
Browse files Browse the repository at this point in the history
  • Loading branch information
dpaulat committed Nov 5, 2023
1 parent bb2d3a9 commit ce426ba
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 335 deletions.
2 changes: 0 additions & 2 deletions scwx-qt/scwx-qt.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
93 changes: 0 additions & 93 deletions scwx-qt/source/scwx/qt/main/main_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -84,7 +83,6 @@ class MainWindowImpl : public QObject
radarSiteDialog_ {nullptr},
settingsDialog_ {nullptr},
updateDialog_ {nullptr},
radarProductModel_ {nullptr},
placefileManager_ {manager::PlacefileManager::Instance()},
textEventManager_ {manager::TextEventManager::Instance()},
timelineManager_ {manager::TimelineManager::Instance()},
Expand Down Expand Up @@ -175,7 +173,6 @@ class MainWindowImpl : public QObject
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_;
Expand Down Expand Up @@ -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"));
Expand All @@ -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();

Expand Down Expand Up @@ -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();
Expand Down
3 changes: 0 additions & 3 deletions scwx-qt/source/scwx/qt/main/main_window.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
80 changes: 0 additions & 80 deletions scwx-qt/source/scwx/qt/main/main_window.ui
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@
<string>&amp;View</string>
</property>
<addaction name="actionRadarToolbox"/>
<addaction name="actionResourceExplorer"/>
<addaction name="actionAlerts"/>
</widget>
<widget class="QMenu" name="menuDebug">
Expand Down Expand Up @@ -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&amp;xit</string>
Expand All @@ -357,11 +282,6 @@
<string>Radar &amp;Toolbox</string>
</property>
</action>
<action name="actionResourceExplorer">
<property name="text">
<string>&amp;Resource Explorer</string>
</property>
</action>
<action name="actionOpenNexrad">
<property name="text">
<string>&amp;NEXRAD Product...</string>
Expand Down
127 changes: 0 additions & 127 deletions scwx-qt/source/scwx/qt/model/radar_product_model.cpp

This file was deleted.

Loading

0 comments on commit ce426ba

Please sign in to comment.