mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 01:00:05 +00:00 
			
		
		
		
	Refactor Alert Dock Widget to its own class
This commit is contained in:
		
							parent
							
								
									1c5e0d51b7
								
							
						
					
					
						commit
						f8021b00bf
					
				
					 6 changed files with 323 additions and 132 deletions
				
			
		|  | @ -106,17 +106,20 @@ set(HDR_TYPES source/scwx/qt/types/qt_types.hpp | ||||||
|               source/scwx/qt/types/text_event_key.hpp) |               source/scwx/qt/types/text_event_key.hpp) | ||||||
| set(SRC_TYPES source/scwx/qt/types/radar_product_record.cpp | set(SRC_TYPES source/scwx/qt/types/radar_product_record.cpp | ||||||
|               source/scwx/qt/types/text_event_key.cpp) |               source/scwx/qt/types/text_event_key.cpp) | ||||||
| set(HDR_UI source/scwx/qt/ui/flow_layout.hpp | set(HDR_UI source/scwx/qt/ui/alert_dock_widget.hpp | ||||||
|  |            source/scwx/qt/ui/flow_layout.hpp | ||||||
|            source/scwx/qt/ui/level2_products_widget.hpp |            source/scwx/qt/ui/level2_products_widget.hpp | ||||||
|            source/scwx/qt/ui/level2_settings_widget.hpp |            source/scwx/qt/ui/level2_settings_widget.hpp | ||||||
|            source/scwx/qt/ui/level3_products_widget.hpp |            source/scwx/qt/ui/level3_products_widget.hpp | ||||||
|            source/scwx/qt/ui/radar_site_dialog.hpp) |            source/scwx/qt/ui/radar_site_dialog.hpp) | ||||||
| set(SRC_UI source/scwx/qt/ui/flow_layout.cpp | set(SRC_UI source/scwx/qt/ui/alert_dock_widget.cpp | ||||||
|  |            source/scwx/qt/ui/flow_layout.cpp | ||||||
|            source/scwx/qt/ui/level2_products_widget.cpp |            source/scwx/qt/ui/level2_products_widget.cpp | ||||||
|            source/scwx/qt/ui/level2_settings_widget.cpp |            source/scwx/qt/ui/level2_settings_widget.cpp | ||||||
|            source/scwx/qt/ui/level3_products_widget.cpp |            source/scwx/qt/ui/level3_products_widget.cpp | ||||||
|            source/scwx/qt/ui/radar_site_dialog.cpp) |            source/scwx/qt/ui/radar_site_dialog.cpp) | ||||||
| set(UI_UI  source/scwx/qt/ui/radar_site_dialog.ui) | set(UI_UI  source/scwx/qt/ui/alert_dock_widget.ui | ||||||
|  |            source/scwx/qt/ui/radar_site_dialog.ui) | ||||||
| set(HDR_UTIL source/scwx/qt/util/font.hpp | set(HDR_UTIL source/scwx/qt/util/font.hpp | ||||||
|              source/scwx/qt/util/font_buffer.hpp |              source/scwx/qt/util/font_buffer.hpp | ||||||
|              source/scwx/qt/util/json.hpp |              source/scwx/qt/util/json.hpp | ||||||
|  |  | ||||||
|  | @ -7,9 +7,8 @@ | ||||||
| #include <scwx/qt/manager/settings_manager.hpp> | #include <scwx/qt/manager/settings_manager.hpp> | ||||||
| #include <scwx/qt/manager/text_event_manager.hpp> | #include <scwx/qt/manager/text_event_manager.hpp> | ||||||
| #include <scwx/qt/map/map_widget.hpp> | #include <scwx/qt/map/map_widget.hpp> | ||||||
| #include <scwx/qt/model/alert_model.hpp> |  | ||||||
| #include <scwx/qt/model/radar_product_model.hpp> | #include <scwx/qt/model/radar_product_model.hpp> | ||||||
| #include <scwx/qt/types/qt_types.hpp> | #include <scwx/qt/ui/alert_dock_widget.hpp> | ||||||
| #include <scwx/qt/ui/flow_layout.hpp> | #include <scwx/qt/ui/flow_layout.hpp> | ||||||
| #include <scwx/qt/ui/level2_products_widget.hpp> | #include <scwx/qt/ui/level2_products_widget.hpp> | ||||||
| #include <scwx/qt/ui/level2_settings_widget.hpp> | #include <scwx/qt/ui/level2_settings_widget.hpp> | ||||||
|  | @ -22,7 +21,6 @@ | ||||||
| 
 | 
 | ||||||
| #include <QFileDialog> | #include <QFileDialog> | ||||||
| #include <QMessageBox> | #include <QMessageBox> | ||||||
| #include <QSortFilterProxyModel> |  | ||||||
| #include <QSplitter> | #include <QSplitter> | ||||||
| #include <QStandardPaths> | #include <QStandardPaths> | ||||||
| #include <QToolButton> | #include <QToolButton> | ||||||
|  | @ -48,9 +46,8 @@ public: | ||||||
|        activeMap_ {nullptr}, |        activeMap_ {nullptr}, | ||||||
|        level2ProductsWidget_ {nullptr}, |        level2ProductsWidget_ {nullptr}, | ||||||
|        level2SettingsWidget_ {nullptr}, |        level2SettingsWidget_ {nullptr}, | ||||||
|  |        alertDockWidget_ {nullptr}, | ||||||
|        radarSiteDialog_ {nullptr}, |        radarSiteDialog_ {nullptr}, | ||||||
|        alertModel_ {std::make_unique<model::AlertModel>()}, |  | ||||||
|        alertProxyModel_ {std::make_unique<QSortFilterProxyModel>()}, |  | ||||||
|        radarProductModel_ {nullptr}, |        radarProductModel_ {nullptr}, | ||||||
|        maps_ {}, |        maps_ {}, | ||||||
|        elevationCuts_ {}, |        elevationCuts_ {}, | ||||||
|  | @ -79,15 +76,11 @@ public: | ||||||
|       settings_.setApiKey(QString {mapboxApiKey.c_str()}); |       settings_.setApiKey(QString {mapboxApiKey.c_str()}); | ||||||
|       settings_.setCacheDatabasePath(QString {cacheDbPath.c_str()}); |       settings_.setCacheDatabasePath(QString {cacheDbPath.c_str()}); | ||||||
|       settings_.setCacheDatabaseMaximumSize(20 * 1024 * 1024); |       settings_.setCacheDatabaseMaximumSize(20 * 1024 * 1024); | ||||||
| 
 |  | ||||||
|       alertProxyModel_->setSourceModel(alertModel_.get()); |  | ||||||
|       alertProxyModel_->setSortRole(types::SortRole); |  | ||||||
|       alertProxyModel_->setFilterCaseSensitivity(Qt::CaseInsensitive); |  | ||||||
|       alertProxyModel_->setFilterKeyColumn(-1); |  | ||||||
|    } |    } | ||||||
|    ~MainWindowImpl() = default; |    ~MainWindowImpl() = default; | ||||||
| 
 | 
 | ||||||
|    void ConfigureMapLayout(); |    void ConfigureMapLayout(); | ||||||
|  |    void ConnectAlertSignals(); | ||||||
|    void ConnectMapSignals(); |    void ConnectMapSignals(); | ||||||
|    void ConnectOtherSignals(); |    void ConnectOtherSignals(); | ||||||
|    void HandleFocusChange(QWidget* focused); |    void HandleFocusChange(QWidget* focused); | ||||||
|  | @ -114,10 +107,9 @@ public: | ||||||
| 
 | 
 | ||||||
|    ui::Level3ProductsWidget* level3ProductsWidget_; |    ui::Level3ProductsWidget* level3ProductsWidget_; | ||||||
| 
 | 
 | ||||||
|  |    ui::AlertDockWidget* alertDockWidget_; | ||||||
|    ui::RadarSiteDialog* radarSiteDialog_; |    ui::RadarSiteDialog* radarSiteDialog_; | ||||||
| 
 | 
 | ||||||
|    std::unique_ptr<model::AlertModel>        alertModel_; |  | ||||||
|    std::unique_ptr<QSortFilterProxyModel>    alertProxyModel_; |  | ||||||
|    std::unique_ptr<model::RadarProductModel> radarProductModel_; |    std::unique_ptr<model::RadarProductModel> radarProductModel_; | ||||||
| 
 | 
 | ||||||
|    std::vector<map::MapWidget*> maps_; |    std::vector<map::MapWidget*> maps_; | ||||||
|  | @ -148,6 +140,11 @@ MainWindow::MainWindow(QWidget* parent) : | ||||||
|    ui->vcpValueLabel->setVisible(false); |    ui->vcpValueLabel->setVisible(false); | ||||||
|    ui->vcpDescriptionLabel->setVisible(false); |    ui->vcpDescriptionLabel->setVisible(false); | ||||||
| 
 | 
 | ||||||
|  |    // Configure Alert Dock
 | ||||||
|  |    p->alertDockWidget_ = new ui::AlertDockWidget(this); | ||||||
|  |    p->alertDockWidget_->setVisible(false); | ||||||
|  |    addDockWidget(Qt::BottomDockWidgetArea, p->alertDockWidget_); | ||||||
|  | 
 | ||||||
|    // Configure Menu
 |    // Configure Menu
 | ||||||
|    ui->menuView->insertAction(ui->actionRadarToolbox, |    ui->menuView->insertAction(ui->actionRadarToolbox, | ||||||
|                               ui->radarToolboxDock->toggleViewAction()); |                               ui->radarToolboxDock->toggleViewAction()); | ||||||
|  | @ -161,8 +158,8 @@ MainWindow::MainWindow(QWidget* parent) : | ||||||
|    ui->actionResourceExplorer->setVisible(false); |    ui->actionResourceExplorer->setVisible(false); | ||||||
| 
 | 
 | ||||||
|    ui->menuView->insertAction(ui->actionAlerts, |    ui->menuView->insertAction(ui->actionAlerts, | ||||||
|                               ui->alertDock->toggleViewAction()); |                               p->alertDockWidget_->toggleViewAction()); | ||||||
|    ui->alertDock->toggleViewAction()->setText(tr("&Alerts")); |    p->alertDockWidget_->toggleViewAction()->setText(tr("&Alerts")); | ||||||
|    ui->actionAlerts->setVisible(false); |    ui->actionAlerts->setVisible(false); | ||||||
| 
 | 
 | ||||||
|    // Configure Resource Explorer Dock
 |    // Configure Resource Explorer Dock
 | ||||||
|  | @ -171,13 +168,6 @@ MainWindow::MainWindow(QWidget* parent) : | ||||||
|    p->radarProductModel_ = std::make_unique<model::RadarProductModel>(); |    p->radarProductModel_ = std::make_unique<model::RadarProductModel>(); | ||||||
|    ui->resourceTreeView->setModel(p->radarProductModel_->model()); |    ui->resourceTreeView->setModel(p->radarProductModel_->model()); | ||||||
| 
 | 
 | ||||||
|    // Configure Alert Dock
 |  | ||||||
|    ui->alertDock->setVisible(false); |  | ||||||
| 
 |  | ||||||
|    ui->alertView->setModel(p->alertProxyModel_.get()); |  | ||||||
| 
 |  | ||||||
|    ui->alertSettings->addAction(ui->actionActiveAlerts); |  | ||||||
| 
 |  | ||||||
|    // Configure Map
 |    // Configure Map
 | ||||||
|    p->ConfigureMapLayout(); |    p->ConfigureMapLayout(); | ||||||
| 
 | 
 | ||||||
|  | @ -475,19 +465,10 @@ void MainWindowImpl::ConnectOtherSignals() | ||||||
|            &ui::Level2SettingsWidget::ElevationSelected, |            &ui::Level2SettingsWidget::ElevationSelected, | ||||||
|            mainWindow_, |            mainWindow_, | ||||||
|            [&](float elevation) { SelectElevation(activeMap_, elevation); }); |            [&](float elevation) { SelectElevation(activeMap_, elevation); }); | ||||||
|    connect(mainWindow_->ui->alertFilter, |  | ||||||
|            &QLineEdit::textChanged, |  | ||||||
|            alertProxyModel_.get(), |  | ||||||
|            &QSortFilterProxyModel::setFilterWildcard); |  | ||||||
|    connect(mainWindow_, |    connect(mainWindow_, | ||||||
|            &MainWindow::ActiveMapMoved, |            &MainWindow::ActiveMapMoved, | ||||||
|            alertModel_.get(), |            alertDockWidget_, | ||||||
|            &model::AlertModel::HandleMapUpdate, |            &ui::AlertDockWidget::HandleMapUpdate, | ||||||
|            Qt::QueuedConnection); |  | ||||||
|    connect(&manager::TextEventManager::Instance(), |  | ||||||
|            &manager::TextEventManager::AlertUpdated, |  | ||||||
|            alertModel_.get(), |  | ||||||
|            &model::AlertModel::HandleAlert, |  | ||||||
|            Qt::QueuedConnection); |            Qt::QueuedConnection); | ||||||
|    connect(mainWindow_, |    connect(mainWindow_, | ||||||
|            &MainWindow::ActiveMapMoved, |            &MainWindow::ActiveMapMoved, | ||||||
|  |  | ||||||
|  | @ -307,95 +307,6 @@ | ||||||
|     </layout> |     </layout> | ||||||
|    </widget> |    </widget> | ||||||
|   </widget> |   </widget> | ||||||
|   <widget class="QDockWidget" name="alertDock"> |  | ||||||
|    <property name="windowTitle"> |  | ||||||
|     <string>Alerts</string> |  | ||||||
|    </property> |  | ||||||
|    <attribute name="dockWidgetArea"> |  | ||||||
|     <number>8</number> |  | ||||||
|    </attribute> |  | ||||||
|    <widget class="QWidget" name="radarDockContents"> |  | ||||||
|     <layout class="QVBoxLayout" name="verticalLayout_5"> |  | ||||||
|      <item> |  | ||||||
|       <widget class="QTreeView" name="alertView"> |  | ||||||
|        <property name="alternatingRowColors"> |  | ||||||
|         <bool>true</bool> |  | ||||||
|        </property> |  | ||||||
|        <property name="indentation"> |  | ||||||
|         <number>0</number> |  | ||||||
|        </property> |  | ||||||
|        <property name="sortingEnabled"> |  | ||||||
|         <bool>true</bool> |  | ||||||
|        </property> |  | ||||||
|       </widget> |  | ||||||
|      </item> |  | ||||||
|      <item> |  | ||||||
|       <widget class="QFrame" name="frame_2"> |  | ||||||
|        <property name="frameShape"> |  | ||||||
|         <enum>QFrame::StyledPanel</enum> |  | ||||||
|        </property> |  | ||||||
|        <property name="frameShadow"> |  | ||||||
|         <enum>QFrame::Raised</enum> |  | ||||||
|        </property> |  | ||||||
|        <layout class="QHBoxLayout" name="horizontalLayout_2"> |  | ||||||
|         <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> |  | ||||||
|          <widget class="QLineEdit" name="alertFilter"> |  | ||||||
|           <property name="placeholderText"> |  | ||||||
|            <string>Filter</string> |  | ||||||
|           </property> |  | ||||||
|           <property name="clearButtonEnabled"> |  | ||||||
|            <bool>true</bool> |  | ||||||
|           </property> |  | ||||||
|          </widget> |  | ||||||
|         </item> |  | ||||||
|         <item> |  | ||||||
|          <spacer name="horizontalSpacer_2"> |  | ||||||
|           <property name="orientation"> |  | ||||||
|            <enum>Qt::Horizontal</enum> |  | ||||||
|           </property> |  | ||||||
|           <property name="sizeHint" stdset="0"> |  | ||||||
|            <size> |  | ||||||
|             <width>40</width> |  | ||||||
|             <height>20</height> |  | ||||||
|            </size> |  | ||||||
|           </property> |  | ||||||
|          </spacer> |  | ||||||
|         </item> |  | ||||||
|         <item> |  | ||||||
|          <widget class="QToolButton" name="alertSettings"> |  | ||||||
|           <property name="toolTip"> |  | ||||||
|            <string>Settings</string> |  | ||||||
|           </property> |  | ||||||
|           <property name="text"> |  | ||||||
|            <string>...</string> |  | ||||||
|           </property> |  | ||||||
|           <property name="icon"> |  | ||||||
|            <iconset resource="../../../../scwx-qt.qrc"> |  | ||||||
|             <normaloff>:/res/icons/font-awesome-6/sliders-solid.svg</normaloff>:/res/icons/font-awesome-6/sliders-solid.svg</iconset> |  | ||||||
|           </property> |  | ||||||
|           <property name="popupMode"> |  | ||||||
|            <enum>QToolButton::InstantPopup</enum> |  | ||||||
|           </property> |  | ||||||
|          </widget> |  | ||||||
|         </item> |  | ||||||
|        </layout> |  | ||||||
|       </widget> |  | ||||||
|      </item> |  | ||||||
|     </layout> |  | ||||||
|    </widget> |  | ||||||
|   </widget> |  | ||||||
|   <action name="actionExit"> |   <action name="actionExit"> | ||||||
|    <property name="text"> |    <property name="text"> | ||||||
|     <string>E&xit</string> |     <string>E&xit</string> | ||||||
|  | @ -431,14 +342,6 @@ | ||||||
|     <string>&Alerts</string> |     <string>&Alerts</string> | ||||||
|    </property> |    </property> | ||||||
|   </action> |   </action> | ||||||
|   <action name="actionActiveAlerts"> |  | ||||||
|    <property name="checkable"> |  | ||||||
|     <bool>true</bool> |  | ||||||
|    </property> |  | ||||||
|    <property name="text"> |  | ||||||
|     <string>&Active Alerts</string> |  | ||||||
|    </property> |  | ||||||
|   </action> |  | ||||||
|  </widget> |  </widget> | ||||||
|  <resources> |  <resources> | ||||||
|   <include location="../../../../scwx-qt.qrc"/> |   <include location="../../../../scwx-qt.qrc"/> | ||||||
|  |  | ||||||
							
								
								
									
										139
									
								
								scwx-qt/source/scwx/qt/ui/alert_dock_widget.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										139
									
								
								scwx-qt/source/scwx/qt/ui/alert_dock_widget.cpp
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,139 @@ | ||||||
|  | #include "alert_dock_widget.hpp" | ||||||
|  | #include "ui_alert_dock_widget.h" | ||||||
|  | 
 | ||||||
|  | #include <scwx/qt/manager/text_event_manager.hpp> | ||||||
|  | #include <scwx/qt/model/alert_model.hpp> | ||||||
|  | #include <scwx/qt/types/qt_types.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
|  | 
 | ||||||
|  | #include <QSortFilterProxyModel> | ||||||
|  | 
 | ||||||
|  | namespace scwx | ||||||
|  | { | ||||||
|  | namespace qt | ||||||
|  | { | ||||||
|  | namespace ui | ||||||
|  | { | ||||||
|  | 
 | ||||||
|  | static const std::string logPrefix_ = "scwx::qt::ui::alert_dock_widget"; | ||||||
|  | static const auto        logger_    = scwx::util::Logger::Create(logPrefix_); | ||||||
|  | 
 | ||||||
|  | class AlertDockWidgetImpl : QObject | ||||||
|  | { | ||||||
|  |    Q_OBJECT | ||||||
|  | public: | ||||||
|  |    explicit AlertDockWidgetImpl(AlertDockWidget* self) : | ||||||
|  |        self_ {self}, | ||||||
|  |        alertModel_ {std::make_unique<model::AlertModel>()}, | ||||||
|  |        proxyModel_ {std::make_unique<QSortFilterProxyModel>()}, | ||||||
|  |        mapPosition_ {}, | ||||||
|  |        mapUpdateDeferred_ {false} | ||||||
|  |    { | ||||||
|  |       proxyModel_->setSourceModel(alertModel_.get()); | ||||||
|  |       proxyModel_->setSortRole(types::SortRole); | ||||||
|  |       proxyModel_->setFilterCaseSensitivity(Qt::CaseInsensitive); | ||||||
|  |       proxyModel_->setFilterKeyColumn(-1); | ||||||
|  |    } | ||||||
|  |    ~AlertDockWidgetImpl() = default; | ||||||
|  | 
 | ||||||
|  |    void ConnectSignals(); | ||||||
|  | 
 | ||||||
|  |    AlertDockWidget*                       self_; | ||||||
|  |    std::unique_ptr<model::AlertModel>     alertModel_; | ||||||
|  |    std::unique_ptr<QSortFilterProxyModel> proxyModel_; | ||||||
|  | 
 | ||||||
|  |    scwx::common::Coordinate mapPosition_; | ||||||
|  |    bool                     mapUpdateDeferred_; | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | AlertDockWidget::AlertDockWidget(QWidget* parent) : | ||||||
|  |     QDockWidget(parent), | ||||||
|  |     p {std::make_unique<AlertDockWidgetImpl>(this)}, | ||||||
|  |     ui(new Ui::AlertDockWidget) | ||||||
|  | { | ||||||
|  |    ui->setupUi(this); | ||||||
|  | 
 | ||||||
|  |    ui->alertView->setModel(p->proxyModel_.get()); | ||||||
|  | 
 | ||||||
|  |    ui->alertSettings->addAction(ui->actionActiveAlerts); | ||||||
|  | 
 | ||||||
|  |    p->ConnectSignals(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | AlertDockWidget::~AlertDockWidget() | ||||||
|  | { | ||||||
|  |    delete ui; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void AlertDockWidget::showEvent(QShowEvent* event) | ||||||
|  | { | ||||||
|  |    if (p->mapUpdateDeferred_) | ||||||
|  |    { | ||||||
|  |       p->alertModel_->HandleMapUpdate(p->mapPosition_.latitude_, | ||||||
|  |                                       p->mapPosition_.longitude_); | ||||||
|  |       p->mapUpdateDeferred_ = false; | ||||||
|  |    } | ||||||
|  | 
 | ||||||
|  |    QDockWidget::showEvent(event); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void AlertDockWidget::HandleMapUpdate(double latitude, double longitude) | ||||||
|  | { | ||||||
|  |    p->mapPosition_ = {latitude, longitude}; | ||||||
|  | 
 | ||||||
|  |    if (isVisible()) | ||||||
|  |    { | ||||||
|  |       p->alertModel_->HandleMapUpdate(latitude, longitude); | ||||||
|  |    } | ||||||
|  |    else | ||||||
|  |    { | ||||||
|  |       p->mapUpdateDeferred_ = true; | ||||||
|  |    } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void AlertDockWidgetImpl::ConnectSignals() | ||||||
|  | { | ||||||
|  |    connect(self_->ui->alertFilter, | ||||||
|  |            &QLineEdit::textChanged, | ||||||
|  |            proxyModel_.get(), | ||||||
|  |            &QSortFilterProxyModel::setFilterWildcard); | ||||||
|  |    connect(&manager::TextEventManager::Instance(), | ||||||
|  |            &manager::TextEventManager::AlertUpdated, | ||||||
|  |            alertModel_.get(), | ||||||
|  |            &model::AlertModel::HandleAlert, | ||||||
|  |            Qt::QueuedConnection); | ||||||
|  |    connect(self_->ui->alertView->selectionModel(), | ||||||
|  |            &QItemSelectionModel::selectionChanged, | ||||||
|  |            this, | ||||||
|  |            [=](const QItemSelection& selected, const QItemSelection& deselected) | ||||||
|  |            { | ||||||
|  |               if (selected.size() == 0 && deselected.size() == 0) | ||||||
|  |               { | ||||||
|  |                  // Items which stay selected but change their index are not
 | ||||||
|  |                  // included in selected and deselected. Thus, this signal might
 | ||||||
|  |                  // be emitted with both selected and deselected empty, if only
 | ||||||
|  |                  // the indices of selected items change.
 | ||||||
|  |                  return; | ||||||
|  |               } | ||||||
|  |            }); | ||||||
|  |    connect(self_->ui->alertViewButton, | ||||||
|  |            &QPushButton::clicked, | ||||||
|  |            this, | ||||||
|  |            []() | ||||||
|  |            { | ||||||
|  |               // TODO: View alert
 | ||||||
|  |            }); | ||||||
|  |    connect(self_->ui->alertGoButton, | ||||||
|  |            &QPushButton::clicked, | ||||||
|  |            this, | ||||||
|  |            []() | ||||||
|  |            { | ||||||
|  |               // TODO: Go to alert
 | ||||||
|  |            }); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | #include "alert_dock_widget.moc" | ||||||
|  | 
 | ||||||
|  | } // namespace ui
 | ||||||
|  | } // namespace qt
 | ||||||
|  | } // namespace scwx
 | ||||||
							
								
								
									
										41
									
								
								scwx-qt/source/scwx/qt/ui/alert_dock_widget.hpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								scwx-qt/source/scwx/qt/ui/alert_dock_widget.hpp
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,41 @@ | ||||||
|  | #pragma once | ||||||
|  | 
 | ||||||
|  | #include <QDockWidget> | ||||||
|  | 
 | ||||||
|  | namespace Ui | ||||||
|  | { | ||||||
|  | class AlertDockWidget; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | namespace scwx | ||||||
|  | { | ||||||
|  | namespace qt | ||||||
|  | { | ||||||
|  | namespace ui | ||||||
|  | { | ||||||
|  | 
 | ||||||
|  | class AlertDockWidgetImpl; | ||||||
|  | 
 | ||||||
|  | class AlertDockWidget : public QDockWidget | ||||||
|  | { | ||||||
|  |    Q_OBJECT | ||||||
|  | 
 | ||||||
|  | public: | ||||||
|  |    explicit AlertDockWidget(QWidget* parent = nullptr); | ||||||
|  |    ~AlertDockWidget(); | ||||||
|  | 
 | ||||||
|  | protected: | ||||||
|  |    void showEvent(QShowEvent*) override; | ||||||
|  | 
 | ||||||
|  | public slots: | ||||||
|  |    void HandleMapUpdate(double latitude, double longitude); | ||||||
|  | 
 | ||||||
|  | private: | ||||||
|  |    friend class AlertDockWidgetImpl; | ||||||
|  |    std::unique_ptr<AlertDockWidgetImpl> p; | ||||||
|  |    Ui::AlertDockWidget*                 ui; | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | } // namespace ui
 | ||||||
|  | } // namespace qt
 | ||||||
|  | } // namespace scwx
 | ||||||
							
								
								
									
										124
									
								
								scwx-qt/source/scwx/qt/ui/alert_dock_widget.ui
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										124
									
								
								scwx-qt/source/scwx/qt/ui/alert_dock_widget.ui
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,124 @@ | ||||||
|  | <?xml version="1.0" encoding="UTF-8"?> | ||||||
|  | <ui version="4.0"> | ||||||
|  |  <class>AlertDockWidget</class> | ||||||
|  |  <widget class="QDockWidget" name="AlertDockWidget"> | ||||||
|  |   <property name="geometry"> | ||||||
|  |    <rect> | ||||||
|  |     <x>0</x> | ||||||
|  |     <y>0</y> | ||||||
|  |     <width>400</width> | ||||||
|  |     <height>300</height> | ||||||
|  |    </rect> | ||||||
|  |   </property> | ||||||
|  |   <property name="windowTitle"> | ||||||
|  |    <string>Alerts</string> | ||||||
|  |   </property> | ||||||
|  |   <widget class="QWidget" name="dockWidgetContents"> | ||||||
|  |    <layout class="QVBoxLayout" name="verticalLayout"> | ||||||
|  |     <item> | ||||||
|  |      <widget class="QTreeView" name="alertView"> | ||||||
|  |       <property name="alternatingRowColors"> | ||||||
|  |        <bool>true</bool> | ||||||
|  |       </property> | ||||||
|  |       <property name="indentation"> | ||||||
|  |        <number>0</number> | ||||||
|  |       </property> | ||||||
|  |       <property name="sortingEnabled"> | ||||||
|  |        <bool>true</bool> | ||||||
|  |       </property> | ||||||
|  |      </widget> | ||||||
|  |     </item> | ||||||
|  |     <item> | ||||||
|  |      <widget class="QFrame" name="frame_2"> | ||||||
|  |       <property name="frameShape"> | ||||||
|  |        <enum>QFrame::StyledPanel</enum> | ||||||
|  |       </property> | ||||||
|  |       <property name="frameShadow"> | ||||||
|  |        <enum>QFrame::Raised</enum> | ||||||
|  |       </property> | ||||||
|  |       <layout class="QHBoxLayout" name="horizontalLayout_2"> | ||||||
|  |        <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> | ||||||
|  |         <widget class="QLineEdit" name="alertFilter"> | ||||||
|  |          <property name="placeholderText"> | ||||||
|  |           <string>Filter</string> | ||||||
|  |          </property> | ||||||
|  |          <property name="clearButtonEnabled"> | ||||||
|  |           <bool>true</bool> | ||||||
|  |          </property> | ||||||
|  |         </widget> | ||||||
|  |        </item> | ||||||
|  |        <item> | ||||||
|  |         <spacer name="horizontalSpacer_2"> | ||||||
|  |          <property name="orientation"> | ||||||
|  |           <enum>Qt::Horizontal</enum> | ||||||
|  |          </property> | ||||||
|  |          <property name="sizeHint" stdset="0"> | ||||||
|  |           <size> | ||||||
|  |            <width>40</width> | ||||||
|  |            <height>20</height> | ||||||
|  |           </size> | ||||||
|  |          </property> | ||||||
|  |         </spacer> | ||||||
|  |        </item> | ||||||
|  |        <item> | ||||||
|  |         <widget class="QToolButton" name="alertSettings"> | ||||||
|  |          <property name="toolTip"> | ||||||
|  |           <string>Settings</string> | ||||||
|  |          </property> | ||||||
|  |          <property name="text"> | ||||||
|  |           <string>...</string> | ||||||
|  |          </property> | ||||||
|  |          <property name="icon"> | ||||||
|  |           <iconset resource="../../../../scwx-qt.qrc"> | ||||||
|  |            <normaloff>:/res/icons/font-awesome-6/sliders-solid.svg</normaloff>:/res/icons/font-awesome-6/sliders-solid.svg</iconset> | ||||||
|  |          </property> | ||||||
|  |          <property name="popupMode"> | ||||||
|  |           <enum>QToolButton::InstantPopup</enum> | ||||||
|  |          </property> | ||||||
|  |         </widget> | ||||||
|  |        </item> | ||||||
|  |        <item> | ||||||
|  |         <widget class="QPushButton" name="alertViewButton"> | ||||||
|  |          <property name="text"> | ||||||
|  |           <string>&View</string> | ||||||
|  |          </property> | ||||||
|  |         </widget> | ||||||
|  |        </item> | ||||||
|  |        <item> | ||||||
|  |         <widget class="QPushButton" name="alertGoButton"> | ||||||
|  |          <property name="text"> | ||||||
|  |           <string>&Go</string> | ||||||
|  |          </property> | ||||||
|  |         </widget> | ||||||
|  |        </item> | ||||||
|  |       </layout> | ||||||
|  |      </widget> | ||||||
|  |     </item> | ||||||
|  |    </layout> | ||||||
|  |   </widget> | ||||||
|  |   <action name="actionActiveAlerts"> | ||||||
|  |    <property name="checkable"> | ||||||
|  |     <bool>true</bool> | ||||||
|  |    </property> | ||||||
|  |    <property name="text"> | ||||||
|  |     <string>&Active Alerts</string> | ||||||
|  |    </property> | ||||||
|  |   </action> | ||||||
|  |  </widget> | ||||||
|  |  <resources> | ||||||
|  |   <include location="../../../../scwx-qt.qrc"/> | ||||||
|  |  </resources> | ||||||
|  |  <connections/> | ||||||
|  | </ui> | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat