Refactor Qt types to avoid namespace conflict

This commit is contained in:
Dan Paulat 2022-10-13 07:12:37 -05:00
parent 78f57698f6
commit e98bca9d5d
6 changed files with 12 additions and 13 deletions

View file

@ -38,7 +38,6 @@ set(SRC_EXE_MAIN source/scwx/qt/main/main.cpp)
set(HDR_MAIN source/scwx/qt/main/main_window.hpp)
set(SRC_MAIN source/scwx/qt/main/main_window.cpp)
set(UI_MAIN source/scwx/qt/main/main_window.ui)
set(HDR_COMMON source/scwx/qt/common/types.hpp)
set(HDR_CONFIG source/scwx/qt/config/radar_site.hpp)
set(SRC_CONFIG source/scwx/qt/config/radar_site.cpp)
set(SRC_EXTERNAL source/scwx/qt/external/stb_rect_pack.cpp)
@ -102,7 +101,8 @@ set(HDR_SETTINGS source/scwx/qt/settings/general_settings.hpp
set(SRC_SETTINGS source/scwx/qt/settings/general_settings.cpp
source/scwx/qt/settings/map_settings.cpp
source/scwx/qt/settings/palette_settings.cpp)
set(HDR_TYPES source/scwx/qt/types/radar_product_record.hpp
set(HDR_TYPES source/scwx/qt/types/qt_types.hpp
source/scwx/qt/types/radar_product_record.hpp
source/scwx/qt/types/text_event_key.hpp)
set(SRC_TYPES source/scwx/qt/types/radar_product_record.cpp
source/scwx/qt/types/text_event_key.cpp)
@ -160,7 +160,6 @@ set(TS_FILES ts/scwx_en_US.ts)
set(PROJECT_SOURCES ${HDR_MAIN}
${SRC_MAIN}
${HDR_COMMON}
${HDR_CONFIG}
${SRC_CONFIG}
${SRC_EXTERNAL}
@ -197,7 +196,6 @@ set(EXECUTABLE_SOURCES ${SRC_EXE_MAIN})
source_group("Header Files\\main" FILES ${HDR_MAIN})
source_group("Source Files\\main" FILES ${SRC_MAIN})
source_group("Header Files\\common" FILES ${HDR_COMMON})
source_group("Header Files\\config" FILES ${HDR_CONFIG})
source_group("Source Files\\config" FILES ${SRC_CONFIG})
source_group("Source Files\\external" FILES ${SRC_EXTERNAL})

View file

@ -9,6 +9,7 @@
#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/types/qt_types.hpp>
#include <scwx/qt/ui/flow_layout.hpp>
#include <scwx/qt/ui/level2_products_widget.hpp>
#include <scwx/qt/ui/level2_settings_widget.hpp>
@ -80,7 +81,7 @@ public:
settings_.setCacheDatabaseMaximumSize(20 * 1024 * 1024);
alertProxyModel_->setSourceModel(alertModel_.get());
alertProxyModel_->setSortRole(Qt::UserRole); // TODO
alertProxyModel_->setSortRole(types::SortRole);
alertProxyModel_->setFilterCaseSensitivity(Qt::CaseInsensitive);
alertProxyModel_->setFilterKeyColumn(-1);
}

View file

@ -1,5 +1,5 @@
#include <scwx/qt/model/alert_model.hpp>
#include <scwx/qt/common/types.hpp>
#include <scwx/qt/types/qt_types.hpp>
#include <scwx/common/geographic.hpp>
#include <scwx/util/logger.hpp>
@ -68,7 +68,7 @@ QVariant AlertModel::data(const QModelIndex& index, int role) const
{
if (index.isValid() && index.row() >= 0 &&
index.row() < p->textEventKeys_.size() &&
(role == Qt::DisplayRole || role == common::SortRole))
(role == Qt::DisplayRole || role == types::SortRole))
{
const auto& textEventKey = p->textEventKeys_.at(index.row());

View file

@ -1,6 +1,6 @@
#include <scwx/qt/model/radar_site_model.hpp>
#include <scwx/qt/common/types.hpp>
#include <scwx/qt/config/radar_site.hpp>
#include <scwx/qt/types/qt_types.hpp>
#include <scwx/common/geographic.hpp>
#include <scwx/util/logger.hpp>
@ -63,7 +63,7 @@ QVariant RadarSiteModel::data(const QModelIndex& index, int role) const
{
if (index.isValid() && index.row() >= 0 &&
index.row() < p->radarSites_.size() &&
(role == Qt::DisplayRole || role == common::SortRole))
(role == Qt::DisplayRole || role == types::SortRole))
{
const auto& site = p->radarSites_.at(index.row());

View file

@ -6,7 +6,7 @@ namespace scwx
{
namespace qt
{
namespace common
namespace types
{
enum ItemDataRole
@ -14,6 +14,6 @@ enum ItemDataRole
SortRole = Qt::UserRole
};
} // namespace common
} // namespace types
} // namespace qt
} // namespace scwx

View file

@ -1,8 +1,8 @@
#include "radar_site_dialog.hpp"
#include "./ui_radar_site_dialog.h"
#include <scwx/qt/common/types.hpp>
#include <scwx/qt/model/radar_site_model.hpp>
#include <scwx/qt/types/qt_types.hpp>
#include <scwx/common/geographic.hpp>
#include <scwx/util/logger.hpp>
@ -31,7 +31,7 @@ public:
selectedRadarSite_ {"?"}
{
proxyModel_->setSourceModel(radarSiteModel_);
proxyModel_->setSortRole(common::SortRole);
proxyModel_->setSortRole(types::SortRole);
proxyModel_->setFilterCaseSensitivity(Qt::CaseInsensitive);
proxyModel_->setFilterKeyColumn(-1);
}