Move map or view alert on alert double click based on settings

This commit is contained in:
Dan Paulat 2023-05-02 22:54:46 -05:00
parent 061bc8837f
commit 3451faf161

View file

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