feat:unlocked versions page

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
Trial97
2023-07-09 22:47:38 +03:00
parent 67d473aab7
commit 159f14c076
2 changed files with 139 additions and 231 deletions

View File

@ -46,38 +46,27 @@
#include "minecraft/PackProfile.h"
#include "ui/pages/BasePage.h"
namespace Ui
{
namespace Ui {
class VersionPage;
}
class VersionPage : public QMainWindow, public BasePage
{
class VersionPage : public QMainWindow, public BasePage {
Q_OBJECT
public:
explicit VersionPage(MinecraftInstance *inst, QWidget *parent = 0);
public:
explicit VersionPage(MinecraftInstance* inst, QWidget* parent = 0);
virtual ~VersionPage();
virtual QString displayName() const override
{
return tr("Version");
}
virtual QString displayName() const override { return tr("Version"); }
virtual QIcon icon() const override;
virtual QString id() const override
{
return "version";
}
virtual QString helpPage() const override
{
return "Instance-Version";
}
virtual QString id() const override { return "version"; }
virtual QString helpPage() const override { return "Instance-Version"; }
virtual bool shouldDisplay() const override;
void retranslate() override;
void openedImpl() override;
void closedImpl() override;
private slots:
private slots:
void on_actionChange_version_triggered();
void on_actionInstall_Forge_triggered();
void on_actionInstall_Fabric_triggered();
@ -103,36 +92,34 @@ private slots:
void updateVersionControls();
private:
private:
ComponentPtr current();
int currentRow();
void updateButtons(int row = -1);
void preselect(int row = 0);
int doUpdate();
protected:
QMenu * createPopupMenu() override;
protected:
QMenu* createPopupMenu() override;
/// FIXME: this shouldn't be necessary!
bool reloadPackProfile();
private:
Ui::VersionPage *ui;
QSortFilterProxyModel *m_filterModel;
private:
Ui::VersionPage* ui;
QSortFilterProxyModel* m_filterModel;
std::shared_ptr<PackProfile> m_profile;
MinecraftInstance *m_inst;
MinecraftInstance* m_inst;
int currentIdx = 0;
bool controlsEnabled = false;
std::shared_ptr<Setting> m_wide_bar_setting = nullptr;
public slots:
void versionCurrent(const QModelIndex &current, const QModelIndex &previous);
public slots:
void versionCurrent(const QModelIndex& current, const QModelIndex& previous);
private slots:
void updateRunningStatus(bool running);
private slots:
void onGameUpdateError(QString error);
void packageCurrent(const QModelIndex &current, const QModelIndex &previous);
void showContextMenu(const QPoint &pos);
void onFilterTextChanged(const QString & newContents);
void packageCurrent(const QModelIndex& current, const QModelIndex& previous);
void showContextMenu(const QPoint& pos);
void onFilterTextChanged(const QString& newContents);
};