aboutsummaryrefslogtreecommitdiff
path: root/launcher/ui/pages/instance/TexturePackPage.h
diff options
context:
space:
mode:
authorflow <thiagodonato300@gmail.com>2022-03-11 18:03:21 -0300
committerflow <flowlnlnln@gmail.com>2022-06-14 07:04:31 -0300
commitd394235ee0040b061504ae50daaea10d3c80500c (patch)
tree6eb46235d22e7c9c9f9e52d11003945982b11e23 /launcher/ui/pages/instance/TexturePackPage.h
parent349fc4143d4c83c50aa6340bbe7dc537a6fbf949 (diff)
downloadPrismLauncher-d394235ee0040b061504ae50daaea10d3c80500c.tar.gz
PrismLauncher-d394235ee0040b061504ae50daaea10d3c80500c.tar.bz2
PrismLauncher-d394235ee0040b061504ae50daaea10d3c80500c.zip
refactor: Create a more clear hierarchy for some instance pages
Previously, the Shaders, Texture packs and Resource packs tabs had as parent the ModFolderPage, making it so that making changes only to the Mods page would require checking the id of the page for the correct one. This was hackish and error-prone. Now, those pages all inherit from a single class, ExternalResourcesPage, that handles the basic behaviour of all of them, while allowing for individual modification in code. This is still not a clear separation, since internally, all those resources are derived from Mods, so for now there's still some awkward common code :/
Diffstat (limited to 'launcher/ui/pages/instance/TexturePackPage.h')
-rw-r--r--launcher/ui/pages/instance/TexturePackPage.h18
1 files changed, 11 insertions, 7 deletions
diff --git a/launcher/ui/pages/instance/TexturePackPage.h b/launcher/ui/pages/instance/TexturePackPage.h
index e8cefe6e..f550a5bc 100644
--- a/launcher/ui/pages/instance/TexturePackPage.h
+++ b/launcher/ui/pages/instance/TexturePackPage.h
@@ -35,23 +35,27 @@
#pragma once
-#include "ModFolderPage.h"
-#include "ui_ModFolderPage.h"
+#include "ExternalResourcesPage.h"
+#include "ui_ExternalResourcesPage.h"
-class TexturePackPage : public ModFolderPage
+class TexturePackPage : public ExternalResourcesPage
{
Q_OBJECT
public:
explicit TexturePackPage(MinecraftInstance *instance, QWidget *parent = 0)
- : ModFolderPage(instance, instance->texturePackList(), "texturepacks", "resourcepacks",
- tr("Texture packs"), "Texture-packs", parent)
+ : ExternalResourcesPage(instance, instance->texturePackList(), parent)
{
- ui->actionView_configs->setVisible(false);
+ ui->actionViewConfigs->setVisible(false);
}
virtual ~TexturePackPage() {}
+ QString displayName() const override { return tr("Texture packs"); }
+ QIcon icon() const override { return APPLICATION->getThemedIcon("resourcepacks"); }
+ QString id() const override { return "texturepacks"; }
+ QString helpPage() const override { return "Texture-packs"; }
+
virtual bool shouldDisplay() const override
{
- return m_inst->traits().contains("texturepacks");
+ return m_instance->traits().contains("texturepacks");
}
};