CResourceBrowser: Make use of in-class initializers where applicable

This commit is contained in:
Lioncash 2020-06-28 05:04:21 -04:00
parent 8ae17a9f1b
commit 071bdf4d2f
2 changed files with 26 additions and 37 deletions

View File

@ -24,15 +24,7 @@
CResourceBrowser::CResourceBrowser(QWidget *pParent) CResourceBrowser::CResourceBrowser(QWidget *pParent)
: QWidget(pParent) : QWidget(pParent)
, mpUI(new Ui::CResourceBrowser) , mpUI(std::make_unique<Ui::CResourceBrowser>())
, mpSelectedEntry(nullptr)
, mpStore(nullptr)
, mpSelectedDir(nullptr)
, mEditorStore(false)
, mAssetListMode(false)
, mSearching(false)
, mpAddMenu(nullptr)
, mpInspectedEntry(nullptr)
{ {
mpUI->setupUi(this); mpUI->setupUi(this);
setEnabled(false); setEnabled(false);
@ -168,10 +160,7 @@ CResourceBrowser::CResourceBrowser(QWidget *pParent)
connect(gpEdApp, SIGNAL(ActiveProjectChanged(CGameProject*)), this, SLOT(UpdateStore())); connect(gpEdApp, SIGNAL(ActiveProjectChanged(CGameProject*)), this, SLOT(UpdateStore()));
} }
CResourceBrowser::~CResourceBrowser() CResourceBrowser::~CResourceBrowser() = default;
{
delete mpUI;
}
void CResourceBrowser::SetActiveDirectory(CVirtualDirectory *pDir) void CResourceBrowser::SetActiveDirectory(CVirtualDirectory *pDir)
{ {

View File

@ -19,25 +19,25 @@ class CResourceBrowser;
class CResourceBrowser : public QWidget class CResourceBrowser : public QWidget
{ {
Q_OBJECT Q_OBJECT
Ui::CResourceBrowser *mpUI; std::unique_ptr<Ui::CResourceBrowser> mpUI;
CResourceEntry *mpSelectedEntry; CResourceEntry *mpSelectedEntry = nullptr;
CResourceStore *mpStore; CResourceStore *mpStore = nullptr;
CResourceTableModel *mpModel; CResourceTableModel *mpModel = nullptr;
CResourceProxyModel *mpProxyModel; CResourceProxyModel *mpProxyModel = nullptr;
CResourceBrowserDelegate *mpDelegate; CResourceBrowserDelegate *mpDelegate = nullptr;
CVirtualDirectory *mpSelectedDir; CVirtualDirectory *mpSelectedDir = nullptr;
CVirtualDirectoryModel *mpDirectoryModel; CVirtualDirectoryModel *mpDirectoryModel = nullptr;
bool mEditorStore; bool mEditorStore = false;
bool mAssetListMode; bool mAssetListMode = false;
bool mSearching; bool mSearching = false;
// Add Menu // Add Menu
QMenu *mpAddMenu; QMenu *mpAddMenu = nullptr;
// Type Filter // Type Filter
QWidget *mpFilterBoxesContainerWidget; QWidget *mpFilterBoxesContainerWidget = nullptr;
QVBoxLayout *mpFilterBoxesLayout; QVBoxLayout *mpFilterBoxesLayout = nullptr;
QCheckBox *mpFilterAllBox; QCheckBox *mpFilterAllBox = nullptr;
QFont mFilterBoxFont; QFont mFilterBoxFont;
struct SResourceType struct SResourceType
@ -49,15 +49,15 @@ class CResourceBrowser : public QWidget
// Undo/Redo // Undo/Redo
QUndoStack mUndoStack; QUndoStack mUndoStack;
QAction *mpUndoAction; QAction *mpUndoAction = nullptr;
QAction *mpRedoAction; QAction *mpRedoAction = nullptr;
QWidget *mpActionContainerWidget; QWidget *mpActionContainerWidget = nullptr;
// Misc // Misc
CResourceEntry *mpInspectedEntry; // Entry being "inspected" (viewing dependencies/referencers, etc) CResourceEntry *mpInspectedEntry = nullptr; // Entry being "inspected" (viewing dependencies/referencers, etc)
public: public:
explicit CResourceBrowser(QWidget *pParent = 0); explicit CResourceBrowser(QWidget *pParent = nullptr);
~CResourceBrowser(); ~CResourceBrowser();
void SetActiveDirectory(CVirtualDirectory *pDir); void SetActiveDirectory(CVirtualDirectory *pDir);
@ -81,11 +81,11 @@ public:
bool eventFilter(QObject *pWatched, QEvent *pEvent); bool eventFilter(QObject *pWatched, QEvent *pEvent);
// Accessors // Accessors
inline CResourceStore* CurrentStore() const { return mpStore; } CResourceStore* CurrentStore() const { return mpStore; }
inline CResourceEntry* SelectedEntry() const { return mpSelectedEntry; } CResourceEntry* SelectedEntry() const { return mpSelectedEntry; }
inline bool InAssetListMode() const { return mAssetListMode || mSearching || mpModel->IsDisplayingUserEntryList(); } bool InAssetListMode() const { return mAssetListMode || mSearching || mpModel->IsDisplayingUserEntryList(); }
inline void SetInspectedEntry(CResourceEntry *pEntry) { mpInspectedEntry = pEntry; } void SetInspectedEntry(CResourceEntry *pEntry) { mpInspectedEntry = pEntry; }
public slots: public slots:
void RefreshResources(); void RefreshResources();