CPoiMapSidebar: Make use of in-class initializers where applicable

This commit is contained in:
Lioncash 2020-06-28 04:34:12 -04:00
parent 9a157ed58d
commit 49c5947731
2 changed files with 15 additions and 22 deletions

View File

@ -12,17 +12,14 @@
#include <QMouseEvent> #include <QMouseEvent>
#include <QMessageBox> #include <QMessageBox>
const CColor CPoiMapSidebar::skNormalColor(0.137255f, 0.184314f, 0.776471f, 0.5f); constexpr CColor skNormalColor(0.137255f, 0.184314f, 0.776471f, 0.5f);
const CColor CPoiMapSidebar::skImportantColor(0.721569f, 0.066667f, 0.066667f, 0.5f); constexpr CColor skImportantColor(0.721569f, 0.066667f, 0.066667f, 0.5f);
const CColor CPoiMapSidebar::skHoverColor(0.047059f, 0.2f, 0.003922f, 0.5f); constexpr CColor skHoverColor(0.047059f, 0.2f, 0.003922f, 0.5f);
CPoiMapSidebar::CPoiMapSidebar(CWorldEditor *pEditor) CPoiMapSidebar::CPoiMapSidebar(CWorldEditor *pEditor)
: CWorldEditorSidebar(pEditor) : CWorldEditorSidebar(pEditor)
, ui(new Ui::CPoiMapSidebar) , ui(std::make_unique<Ui::CPoiMapSidebar>())
, mSourceModel(pEditor, this) , mSourceModel(pEditor, this)
, mHighlightMode(EHighlightMode::HighlightSelected)
, mPickType(EPickType::NotPicking)
, mpHoverModel(nullptr)
{ {
mModel.setSourceModel(&mSourceModel); mModel.setSourceModel(&mSourceModel);
mModel.sort(0); mModel.sort(0);
@ -46,10 +43,7 @@ CPoiMapSidebar::CPoiMapSidebar(CWorldEditor *pEditor)
connect(ui->RemovePoiButton, SIGNAL(clicked()), this, SLOT(OnRemovePoiButtonClicked())); connect(ui->RemovePoiButton, SIGNAL(clicked()), this, SLOT(OnRemovePoiButtonClicked()));
} }
CPoiMapSidebar::~CPoiMapSidebar() CPoiMapSidebar::~CPoiMapSidebar() = default;
{
delete ui;
}
void CPoiMapSidebar::SidebarOpen() void CPoiMapSidebar::SidebarOpen()
{ {

View File

@ -9,6 +9,8 @@
#include <QMainWindow> #include <QMainWindow>
#include <QSortFilterProxyModel> #include <QSortFilterProxyModel>
#include <memory>
namespace Ui { namespace Ui {
class CPoiMapSidebar; class CPoiMapSidebar;
} }
@ -16,7 +18,7 @@ class CPoiMapSidebar;
class CPoiMapSidebar : public CWorldEditorSidebar class CPoiMapSidebar : public CWorldEditorSidebar
{ {
Q_OBJECT Q_OBJECT
Ui::CPoiMapSidebar *ui; std::unique_ptr<Ui::CPoiMapSidebar> ui;
public: public:
enum class EHighlightMode enum class EHighlightMode
@ -38,20 +40,17 @@ public:
private: private:
CPoiMapModel mSourceModel; CPoiMapModel mSourceModel;
QSortFilterProxyModel mModel; QSortFilterProxyModel mModel;
EHighlightMode mHighlightMode; EHighlightMode mHighlightMode{EHighlightMode::HighlightSelected};
EPickType mPickType; EPickType mPickType{EPickType::NotPicking};
CModelNode *mpHoverModel; CModelNode *mpHoverModel = nullptr;
static const CColor skNormalColor;
static const CColor skImportantColor;
static const CColor skHoverColor;
public: public:
explicit CPoiMapSidebar(CWorldEditor *pEditor); explicit CPoiMapSidebar(CWorldEditor *pEditor);
~CPoiMapSidebar(); ~CPoiMapSidebar() override;
void SidebarOpen();
void SidebarClose(); void SidebarOpen() override;
void SidebarClose() override;
void HighlightPoiModels(const QModelIndex& rkIndex); void HighlightPoiModels(const QModelIndex& rkIndex);
void UnhighlightPoiModels(const QModelIndex& rkIndex); void UnhighlightPoiModels(const QModelIndex& rkIndex);
void HighlightModel(const QModelIndex& rkIndex, CModelNode *pNode); void HighlightModel(const QModelIndex& rkIndex, CModelNode *pNode);