mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 19:50:05 +00:00
parent
8f4325f61a
commit
f33d8c0aba
6 changed files with 151 additions and 2 deletions
|
|
@ -32,6 +32,24 @@ static const std::unordered_map<types::Hotkey, QKeySequence> kDefaultHotkeys_ {
|
|||
QKeySequence {Qt::Key::Key_BracketLeft}},
|
||||
{types::Hotkey::ProductTiltIncrease,
|
||||
QKeySequence {Qt::Key::Key_BracketRight}},
|
||||
{types::Hotkey::SelectLevel2Ref, QKeySequence {Qt::Key::Key_F1}},
|
||||
{types::Hotkey::SelectLevel2Vel, QKeySequence {Qt::Key::Key_F2}},
|
||||
{types::Hotkey::SelectLevel2SW, QKeySequence {Qt::Key::Key_F3}},
|
||||
{types::Hotkey::SelectLevel2ZDR, QKeySequence {Qt::Key::Key_F4}},
|
||||
{types::Hotkey::SelectLevel2Phi, QKeySequence {Qt::Key::Key_F5}},
|
||||
{types::Hotkey::SelectLevel2Rho, QKeySequence {Qt::Key::Key_F6}},
|
||||
{types::Hotkey::SelectLevel2CFP, QKeySequence {Qt::Key::Key_F7}},
|
||||
{types::Hotkey::SelectLevel3Ref, QKeySequence {Qt::Key::Key_QuoteLeft}},
|
||||
{types::Hotkey::SelectLevel3Vel, QKeySequence {Qt::Key::Key_1}},
|
||||
{types::Hotkey::SelectLevel3SRM, QKeySequence {Qt::Key::Key_2}},
|
||||
{types::Hotkey::SelectLevel3SW, QKeySequence {Qt::Key::Key_3}},
|
||||
{types::Hotkey::SelectLevel3ZDR, QKeySequence {Qt::Key::Key_4}},
|
||||
{types::Hotkey::SelectLevel3KDP, QKeySequence {Qt::Key::Key_5}},
|
||||
{types::Hotkey::SelectLevel3CC, QKeySequence {Qt::Key::Key_6}},
|
||||
{types::Hotkey::SelectLevel3VIL, QKeySequence {Qt::Key::Key_7}},
|
||||
{types::Hotkey::SelectLevel3ET, QKeySequence {Qt::Key::Key_8}},
|
||||
{types::Hotkey::SelectLevel3HC, QKeySequence {Qt::Key::Key_9}},
|
||||
{types::Hotkey::SelectLevel3Acc, QKeySequence {Qt::Key::Key_0}},
|
||||
{types::Hotkey::TimelineStepBegin,
|
||||
QKeySequence {QKeyCombination {Qt::KeyboardModifier::ControlModifier,
|
||||
Qt::Key::Key_Left}}},
|
||||
|
|
|
|||
|
|
@ -26,6 +26,24 @@ static const std::unordered_map<Hotkey, std::string> hotkeyShortName_ {
|
|||
{Hotkey::MapZoomOut, "map_zoom_out"},
|
||||
{Hotkey::ProductTiltDecrease, "product_tilt_decrease"},
|
||||
{Hotkey::ProductTiltIncrease, "product_tilt_increase"},
|
||||
{Hotkey::SelectLevel2Ref, "select_l2_ref"},
|
||||
{Hotkey::SelectLevel2Vel, "select_l2_vel"},
|
||||
{Hotkey::SelectLevel2SW, "select_l2_sw"},
|
||||
{Hotkey::SelectLevel2ZDR, "select_l2_zdr"},
|
||||
{Hotkey::SelectLevel2Phi, "select_l2_phi"},
|
||||
{Hotkey::SelectLevel2Rho, "select_l2_rho"},
|
||||
{Hotkey::SelectLevel2CFP, "select_l2_cfp"},
|
||||
{Hotkey::SelectLevel3Ref, "select_l3_ref"},
|
||||
{Hotkey::SelectLevel3Vel, "select_l3_vel"},
|
||||
{Hotkey::SelectLevel3SRM, "select_l3_srm"},
|
||||
{Hotkey::SelectLevel3SW, "select_l3_sw"},
|
||||
{Hotkey::SelectLevel3ZDR, "select_l3_zdr"},
|
||||
{Hotkey::SelectLevel3KDP, "select_l3_kdp"},
|
||||
{Hotkey::SelectLevel3CC, "select_l3_cc"},
|
||||
{Hotkey::SelectLevel3VIL, "select_l3_vil"},
|
||||
{Hotkey::SelectLevel3ET, "select_l3_et"},
|
||||
{Hotkey::SelectLevel3HC, "select_l3_hc"},
|
||||
{Hotkey::SelectLevel3Acc, "select_l3_acc"},
|
||||
{Hotkey::TimelineStepBegin, "timeline_step_begin"},
|
||||
{Hotkey::TimelineStepBack, "timeline_step_back"},
|
||||
{Hotkey::TimelinePlay, "timeline_play"},
|
||||
|
|
@ -47,6 +65,24 @@ static const std::unordered_map<Hotkey, std::string> hotkeyLongName_ {
|
|||
{Hotkey::MapZoomOut, "Map Zoom Out"},
|
||||
{Hotkey::ProductTiltDecrease, "Product Tilt Decrease"},
|
||||
{Hotkey::ProductTiltIncrease, "Product Tilt Increase"},
|
||||
{Hotkey::SelectLevel2Ref, "Select L2 REF"},
|
||||
{Hotkey::SelectLevel2Vel, "Select L2 VEL"},
|
||||
{Hotkey::SelectLevel2SW, "Select L2 SW"},
|
||||
{Hotkey::SelectLevel2ZDR, "Select L2 ZDR"},
|
||||
{Hotkey::SelectLevel2Phi, "Select L2 PHI"},
|
||||
{Hotkey::SelectLevel2Rho, "Select L2 RHO"},
|
||||
{Hotkey::SelectLevel2CFP, "Select L2 CFP"},
|
||||
{Hotkey::SelectLevel3Ref, "Select L3 REF"},
|
||||
{Hotkey::SelectLevel3Vel, "Select L3 VEL"},
|
||||
{Hotkey::SelectLevel3SRM, "Select L3 SRM"},
|
||||
{Hotkey::SelectLevel3SW, "Select L3 SW"},
|
||||
{Hotkey::SelectLevel3ZDR, "Select L3 ZDR"},
|
||||
{Hotkey::SelectLevel3KDP, "Select L3 KDP"},
|
||||
{Hotkey::SelectLevel3CC, "Select L3 CC"},
|
||||
{Hotkey::SelectLevel3VIL, "Select L3 VIL"},
|
||||
{Hotkey::SelectLevel3ET, "Select L3 ET"},
|
||||
{Hotkey::SelectLevel3HC, "Select L3 HC"},
|
||||
{Hotkey::SelectLevel3Acc, "Select L3 ACC"},
|
||||
{Hotkey::TimelineStepBegin, "Timeline Step Begin"},
|
||||
{Hotkey::TimelineStepBack, "Timeline Step Back"},
|
||||
{Hotkey::TimelinePlay, "Timeline Play/Pause"},
|
||||
|
|
|
|||
|
|
@ -26,6 +26,24 @@ enum class Hotkey
|
|||
MapZoomOut,
|
||||
ProductTiltDecrease,
|
||||
ProductTiltIncrease,
|
||||
SelectLevel2Ref,
|
||||
SelectLevel2Vel,
|
||||
SelectLevel2SW,
|
||||
SelectLevel2ZDR,
|
||||
SelectLevel2Phi,
|
||||
SelectLevel2Rho,
|
||||
SelectLevel2CFP,
|
||||
SelectLevel3Ref,
|
||||
SelectLevel3Vel,
|
||||
SelectLevel3SRM,
|
||||
SelectLevel3SW,
|
||||
SelectLevel3ZDR,
|
||||
SelectLevel3KDP,
|
||||
SelectLevel3CC,
|
||||
SelectLevel3VIL,
|
||||
SelectLevel3ET,
|
||||
SelectLevel3HC,
|
||||
SelectLevel3Acc,
|
||||
TimelineStepBegin,
|
||||
TimelineStepBack,
|
||||
TimelinePlay,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
#include <scwx/qt/ui/level2_products_widget.hpp>
|
||||
#include <scwx/qt/ui/flow_layout.hpp>
|
||||
#include <scwx/qt/manager/hotkey_manager.hpp>
|
||||
#include <scwx/util/logger.hpp>
|
||||
|
||||
#include <execution>
|
||||
|
|
@ -16,6 +17,20 @@ namespace ui
|
|||
static const std::string logPrefix_ = "scwx::qt::ui::level2_products_widget";
|
||||
static const auto logger_ = util::Logger::Create(logPrefix_);
|
||||
|
||||
static const std::unordered_map<types::Hotkey, common::Level2Product>
|
||||
kHotkeyProductMap_ {
|
||||
{types::Hotkey::SelectLevel2Ref, common::Level2Product::Reflectivity},
|
||||
{types::Hotkey::SelectLevel2Vel, common::Level2Product::Velocity},
|
||||
{types::Hotkey::SelectLevel2SW, common::Level2Product::SpectrumWidth},
|
||||
{types::Hotkey::SelectLevel2ZDR,
|
||||
common::Level2Product::DifferentialReflectivity},
|
||||
{types::Hotkey::SelectLevel2Phi,
|
||||
common::Level2Product::DifferentialPhase},
|
||||
{types::Hotkey::SelectLevel2Rho,
|
||||
common::Level2Product::CorrelationCoefficient},
|
||||
{types::Hotkey::SelectLevel2CFP,
|
||||
common::Level2Product::ClutterFilterPowerRemoved}};
|
||||
|
||||
class Level2ProductsWidgetImpl : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
|
@ -40,10 +55,16 @@ public:
|
|||
&QToolButton::clicked,
|
||||
this,
|
||||
[=, this]() { SelectProduct(product); });
|
||||
|
||||
QObject::connect(hotkeyManager_.get(),
|
||||
&manager::HotkeyManager::HotkeyPressed,
|
||||
this,
|
||||
&Level2ProductsWidgetImpl::HandleHotkeyPressed);
|
||||
}
|
||||
}
|
||||
~Level2ProductsWidgetImpl() = default;
|
||||
|
||||
void HandleHotkeyPressed(types::Hotkey hotkey, bool isAutoRepeat);
|
||||
void NormalizeProductButtons();
|
||||
void SelectProduct(common::Level2Product product);
|
||||
void UpdateProductSelection(common::Level2Product product);
|
||||
|
|
@ -51,6 +72,9 @@ public:
|
|||
Level2ProductsWidget* self_;
|
||||
QLayout* layout_;
|
||||
std::list<QToolButton*> productButtons_;
|
||||
|
||||
std::shared_ptr<manager::HotkeyManager> hotkeyManager_ {
|
||||
manager::HotkeyManager::Instance()};
|
||||
};
|
||||
|
||||
Level2ProductsWidget::Level2ProductsWidget(QWidget* parent) :
|
||||
|
|
@ -67,6 +91,25 @@ void Level2ProductsWidget::showEvent(QShowEvent* event)
|
|||
p->NormalizeProductButtons();
|
||||
}
|
||||
|
||||
void Level2ProductsWidgetImpl::HandleHotkeyPressed(types::Hotkey hotkey,
|
||||
bool isAutoRepeat)
|
||||
{
|
||||
auto productIt = kHotkeyProductMap_.find(hotkey);
|
||||
|
||||
if (productIt == kHotkeyProductMap_.cend())
|
||||
{
|
||||
// Not handling this hotkey
|
||||
return;
|
||||
}
|
||||
|
||||
logger_->trace("Handling hotkey: {}, repeat: {}",
|
||||
types::GetHotkeyShortName(hotkey),
|
||||
isAutoRepeat);
|
||||
|
||||
// Select product category hotkey
|
||||
SelectProduct(productIt->second);
|
||||
}
|
||||
|
||||
void Level2ProductsWidgetImpl::NormalizeProductButtons()
|
||||
{
|
||||
int level2MaxWidth = 0;
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include <execution>
|
||||
#include <shared_mutex>
|
||||
#include <unordered_map>
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QMenu>
|
||||
|
|
@ -23,6 +24,29 @@ namespace ui
|
|||
static const std::string logPrefix_ = "scwx::qt::ui::level3_products_widget";
|
||||
static const auto logger_ = util::Logger::Create(logPrefix_);
|
||||
|
||||
static const std::unordered_map<types::Hotkey, common::Level3ProductCategory>
|
||||
kHotkeyProductCategoryMap_ {
|
||||
{types::Hotkey::SelectLevel3Ref,
|
||||
common::Level3ProductCategory::Reflectivity},
|
||||
{types::Hotkey::SelectLevel3Vel, common::Level3ProductCategory::Velocity},
|
||||
{types::Hotkey::SelectLevel3SRM,
|
||||
common::Level3ProductCategory::StormRelativeVelocity},
|
||||
{types::Hotkey::SelectLevel3SW,
|
||||
common::Level3ProductCategory::SpectrumWidth},
|
||||
{types::Hotkey::SelectLevel3ZDR,
|
||||
common::Level3ProductCategory::DifferentialReflectivity},
|
||||
{types::Hotkey::SelectLevel3KDP,
|
||||
common::Level3ProductCategory::SpecificDifferentialPhase},
|
||||
{types::Hotkey::SelectLevel3CC,
|
||||
common::Level3ProductCategory::CorrelationCoefficient},
|
||||
{types::Hotkey::SelectLevel3VIL,
|
||||
common::Level3ProductCategory::VerticallyIntegratedLiquid},
|
||||
{types::Hotkey::SelectLevel3ET, common::Level3ProductCategory::EchoTops},
|
||||
{types::Hotkey::SelectLevel3HC,
|
||||
common::Level3ProductCategory::HydrometeorClassification},
|
||||
{types::Hotkey::SelectLevel3Acc,
|
||||
common::Level3ProductCategory::PrecipitationAccumulation}};
|
||||
|
||||
class Level3ProductsWidgetImpl : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
|
@ -183,7 +207,10 @@ void Level3ProductsWidget::showEvent(QShowEvent* event)
|
|||
void Level3ProductsWidgetImpl::HandleHotkeyPressed(types::Hotkey hotkey,
|
||||
bool isAutoRepeat)
|
||||
{
|
||||
if (hotkey != types::Hotkey::ProductTiltDecrease &&
|
||||
auto productCategoryIt = kHotkeyProductCategoryMap_.find(hotkey);
|
||||
|
||||
if (productCategoryIt == kHotkeyProductCategoryMap_.cend() &&
|
||||
hotkey != types::Hotkey::ProductTiltDecrease &&
|
||||
hotkey != types::Hotkey::ProductTiltIncrease)
|
||||
{
|
||||
// Not handling this hotkey
|
||||
|
|
@ -194,6 +221,13 @@ void Level3ProductsWidgetImpl::HandleHotkeyPressed(types::Hotkey hotkey,
|
|||
types::GetHotkeyShortName(hotkey),
|
||||
isAutoRepeat);
|
||||
|
||||
if (productCategoryIt != kHotkeyProductCategoryMap_.cend())
|
||||
{
|
||||
// Select product category hotkey
|
||||
SelectProductCategory(productCategoryIt->second);
|
||||
return;
|
||||
}
|
||||
|
||||
std::string currentAwipsId = currentAwipsId_;
|
||||
QAction* currentProductTiltAction = currentProductTiltAction_;
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 35e3e40d63bc020dfdc50c438c700c368fdf32fc
|
||||
Subproject commit 6fe42c4f776ced46f0f808109d0d773ffc2255e3
|
||||
Loading…
Add table
Add a link
Reference in a new issue