mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 20:30:05 +00:00
Move map or view alert on alert double click based on settings
This commit is contained in:
parent
061bc8837f
commit
3451faf161
1 changed files with 35 additions and 0 deletions
|
|
@ -1,9 +1,11 @@
|
|||
#include "alert_dock_widget.hpp"
|
||||
#include "ui_alert_dock_widget.h"
|
||||
|
||||
#include <scwx/qt/manager/settings_manager.hpp>
|
||||
#include <scwx/qt/manager/text_event_manager.hpp>
|
||||
#include <scwx/qt/model/alert_model.hpp>
|
||||
#include <scwx/qt/model/alert_proxy_model.hpp>
|
||||
#include <scwx/qt/types/alert_types.hpp>
|
||||
#include <scwx/qt/types/qt_types.hpp>
|
||||
#include <scwx/qt/ui/alert_dialog.hpp>
|
||||
#include <scwx/util/logger.hpp>
|
||||
|
|
@ -165,6 +167,39 @@ void AlertDockWidgetImpl::ConnectSignals()
|
|||
|
||||
logger_->debug("Selected: {}", selectedAlertKey_.ToString());
|
||||
});
|
||||
connect(self_->ui->alertView,
|
||||
&QTreeView::doubleClicked,
|
||||
this,
|
||||
[this](const QModelIndex& /* index */)
|
||||
{
|
||||
// If an item is selected
|
||||
if (selectedAlertKey_ != types::TextEventKey {})
|
||||
{
|
||||
types::AlertAction alertAction = types::GetAlertAction(
|
||||
manager::SettingsManager::general_settings()
|
||||
.default_alert_action()
|
||||
.GetValue());
|
||||
|
||||
switch (alertAction)
|
||||
{
|
||||
case types::AlertAction::Go:
|
||||
// Move map
|
||||
emit self_->MoveMap(selectedAlertCentroid_.latitude_,
|
||||
selectedAlertCentroid_.longitude_);
|
||||
break;
|
||||
|
||||
case types::AlertAction::View:
|
||||
// View alert
|
||||
alertDialog_->SelectAlert(selectedAlertKey_);
|
||||
alertDialog_->show();
|
||||
break;
|
||||
|
||||
default:
|
||||
// Do nothing
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
connect(self_->ui->alertViewButton,
|
||||
&QPushButton::clicked,
|
||||
this,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue