diff options
author | flow <flowlnlnln@gmail.com> | 2022-08-10 14:48:34 -0300 |
---|---|---|
committer | flow <flowlnlnln@gmail.com> | 2022-08-20 10:47:58 -0300 |
commit | 97a74d5c1f00a11d331a41b16690f7202fe102a3 (patch) | |
tree | e49ff4b05f4ac241a2df4920f3c6b4832bc0d252 /launcher/ui/pages/instance/ExternalResourcesPage.h | |
parent | 256f8094f5fed85ff9136e8d0b9c9677d7b9e9db (diff) | |
download | PrismLauncher-97a74d5c1f00a11d331a41b16690f7202fe102a3.tar.gz PrismLauncher-97a74d5c1f00a11d331a41b16690f7202fe102a3.tar.bz2 PrismLauncher-97a74d5c1f00a11d331a41b16690f7202fe102a3.zip |
refactor: adapt rest of the codebase to the new resource model
In order to access the ModFolderModel from the ModFolderPage, i created
a new m_model for the correct type, shadowing the m_model of type
ResourceFolderModel. This creates two shared_ptr references to the same object,
but since they will have the same lifetime, it doesn't generate a memory
leak.
Signed-off-by: flow <flowlnlnln@gmail.com>
Diffstat (limited to 'launcher/ui/pages/instance/ExternalResourcesPage.h')
-rw-r--r-- | launcher/ui/pages/instance/ExternalResourcesPage.h | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/launcher/ui/pages/instance/ExternalResourcesPage.h b/launcher/ui/pages/instance/ExternalResourcesPage.h index ff294678..280f1542 100644 --- a/launcher/ui/pages/instance/ExternalResourcesPage.h +++ b/launcher/ui/pages/instance/ExternalResourcesPage.h @@ -7,7 +7,7 @@ #include "minecraft/MinecraftInstance.h" #include "ui/pages/BasePage.h" -class ModFolderModel; +class ResourceFolderModel; namespace Ui { class ExternalResourcesPage; @@ -19,8 +19,7 @@ class ExternalResourcesPage : public QMainWindow, public BasePage { Q_OBJECT public: - // FIXME: Switch to different model (or change the name of this one) - explicit ExternalResourcesPage(BaseInstance* instance, std::shared_ptr<ModFolderModel> model, QWidget* parent = nullptr); + explicit ExternalResourcesPage(BaseInstance* instance, std::shared_ptr<ResourceFolderModel> model, QWidget* parent = nullptr); virtual ~ExternalResourcesPage(); virtual QString displayName() const override = 0; @@ -41,18 +40,20 @@ class ExternalResourcesPage : public QMainWindow, public BasePage { QMenu* createPopupMenu() override; public slots: - void current(const QModelIndex& current, const QModelIndex& previous); + bool current(const QModelIndex& current, const QModelIndex& previous); + + virtual bool onSelectionChanged(const QModelIndex& current, const QModelIndex& previous); protected slots: - void itemActivated(const QModelIndex& index); + virtual void itemActivated(const QModelIndex& index) {}; void filterTextChanged(const QString& newContents); virtual void runningStateChanged(bool running); virtual void addItem(); virtual void removeItem(); - virtual void enableItem(); - virtual void disableItem(); + virtual void enableItem() {}; + virtual void disableItem() {}; virtual void viewFolder(); virtual void viewConfigs(); @@ -63,7 +64,7 @@ class ExternalResourcesPage : public QMainWindow, public BasePage { BaseInstance* m_instance = nullptr; Ui::ExternalResourcesPage* ui = nullptr; - std::shared_ptr<ModFolderModel> m_model; + std::shared_ptr<ResourceFolderModel> m_model; QSortFilterProxyModel* m_filterModel = nullptr; QString m_fileSelectionFilter; |