| 31 | #include "ui/widgets/VersionSelectWidget.h" |
| 32 | |
| 33 | class InstallLoaderPage : public VersionSelectWidget, public BasePage { |
| 34 | Q_OBJECT |
| 35 | public: |
| 36 | InstallLoaderPage(const QString& id, const QString& iconName, const QString& name, const Version& oldestVersion, PackProfile* profile) |
| 37 | : VersionSelectWidget(nullptr), uid(id), iconName(iconName), name(name) |
| 38 | { |
| 39 | const QString minecraftVersion = profile->getComponentVersion("net.minecraft"); |
| 40 | setEmptyString(tr("No versions are currently available for Minecraft %1").arg(minecraftVersion)); |
| 41 | setExactIfPresentFilter(BaseVersionList::ParentVersionRole, minecraftVersion); |
| 42 | |
| 43 | if (oldestVersion != Version() && Version(minecraftVersion) < oldestVersion) |
| 44 | setExactFilter(BaseVersionList::ParentVersionRole, "AAA"); |
| 45 | |
| 46 | if (const QString currentVersion = profile->getComponentVersion(id); !currentVersion.isNull()) |
| 47 | setCurrentVersion(currentVersion); |
| 48 | } |
| 49 | |
| 50 | QString id() const override { return uid; } |
| 51 | QString displayName() const override { return name; } |
| 52 | QIcon icon() const override { return QIcon::fromTheme(iconName); } |
| 53 | |