CResourceTableModel: Make use of in-class initializers where applicable

This commit is contained in:
Lioncash 2020-06-28 05:26:06 -04:00
parent f386b22e07
commit 5d230811e8
2 changed files with 20 additions and 22 deletions

View File

@ -2,10 +2,8 @@
#include "CResourceBrowser.h" #include "CResourceBrowser.h"
#include "CResourceMimeData.h" #include "CResourceMimeData.h"
CResourceTableModel::CResourceTableModel(CResourceBrowser *pBrowser, QObject *pParent /*= 0*/) CResourceTableModel::CResourceTableModel(CResourceBrowser *pBrowser, QObject *pParent)
: QAbstractTableModel(pParent) : QAbstractTableModel(pParent)
, mpCurrentDir(nullptr)
, mIsDisplayingUserEntryList(false)
{ {
connect(pBrowser, SIGNAL(ResourceCreated(CResourceEntry*)), this, SLOT(CheckAddResource(CResourceEntry*))); connect(pBrowser, SIGNAL(ResourceCreated(CResourceEntry*)), this, SLOT(CheckAddResource(CResourceEntry*)));
connect(pBrowser, SIGNAL(ResourceAboutToBeDeleted(CResourceEntry*)), this, SLOT(CheckRemoveResource(CResourceEntry*))); connect(pBrowser, SIGNAL(ResourceAboutToBeDeleted(CResourceEntry*)), this, SLOT(CheckRemoveResource(CResourceEntry*)));

View File

@ -13,27 +13,27 @@ class CResourceTableModel : public QAbstractTableModel
{ {
Q_OBJECT Q_OBJECT
CVirtualDirectory *mpCurrentDir; CVirtualDirectory *mpCurrentDir = nullptr;
QList<CVirtualDirectory*> mDirectories; QList<CVirtualDirectory*> mDirectories;
QList<CResourceEntry*> mEntries; QList<CResourceEntry*> mEntries;
QString mModelDescription; QString mModelDescription;
bool mIsAssetListMode; bool mIsAssetListMode = false;
bool mIsDisplayingUserEntryList; bool mIsDisplayingUserEntryList = false;
public: public:
CResourceTableModel(CResourceBrowser *pBrowser, QObject *pParent = 0); explicit CResourceTableModel(CResourceBrowser *pBrowser, QObject *pParent = nullptr);
// Interface // Interface
int rowCount(const QModelIndex& /*rkParent*/) const; int rowCount(const QModelIndex& /*rkParent*/) const override;
int columnCount(const QModelIndex& /*rkParent*/) const; int columnCount(const QModelIndex& /*rkParent*/) const override;
QVariant data(const QModelIndex& rkIndex, int Role) const; QVariant data(const QModelIndex& rkIndex, int Role) const override;
Qt::ItemFlags flags(const QModelIndex& rkIndex) const; Qt::ItemFlags flags(const QModelIndex& rkIndex) const override;
bool canDropMimeData(const QMimeData *pkData, Qt::DropAction Action, int Row, int Column, const QModelIndex& rkParent) const; bool canDropMimeData(const QMimeData *pkData, Qt::DropAction Action, int Row, int Column, const QModelIndex& rkParent) const override;
bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent); bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override;
QMimeData* mimeData(const QModelIndexList& rkIndexes) const; QMimeData* mimeData(const QModelIndexList& rkIndexes) const override;
Qt::DropActions supportedDragActions() const; Qt::DropActions supportedDragActions() const override;
Qt::DropActions supportedDropActions() const; Qt::DropActions supportedDropActions() const override;
// Functionality // Functionality
QModelIndex GetIndexForEntry(CResourceEntry *pEntry) const; QModelIndex GetIndexForEntry(CResourceEntry *pEntry) const;
@ -50,12 +50,12 @@ protected:
public: public:
// Accessors // Accessors
inline uint32 NumDirectories() const { return mDirectories.size(); } uint32 NumDirectories() const { return mDirectories.size(); }
inline uint32 NumResources() const { return mEntries.size(); } uint32 NumResources() const { return mEntries.size(); }
inline CVirtualDirectory* CurrentDir() const { return mpCurrentDir; } CVirtualDirectory* CurrentDir() const { return mpCurrentDir; }
inline bool IsDisplayingAssetList() const { return mIsAssetListMode; } bool IsDisplayingAssetList() const { return mIsAssetListMode; }
inline bool IsDisplayingUserEntryList() const { return mIsDisplayingUserEntryList; } bool IsDisplayingUserEntryList() const { return mIsDisplayingUserEntryList; }
inline QString ModelDescription() const { return mModelDescription; } QString ModelDescription() const { return mModelDescription; }
public slots: public slots:
void RefreshAllIndices(); void RefreshAllIndices();