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

View File

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