diff options
author | Petr Mrázek <peterix@gmail.com> | 2014-02-01 19:37:16 +0100 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2014-02-01 19:37:16 +0100 |
commit | 1936bd181f57a554ce0dd757ffe9419100eb47f4 (patch) | |
tree | a22660979335746b930c88f353b4e29f1bbe9a2a /logic/OneSixVersion.h | |
parent | b4b6091372310f4a811180cffde3ea5611881e6c (diff) | |
parent | 8637cce4333aaf56a231d5fab866b0e770436783 (diff) | |
download | PrismLauncher-1936bd181f57a554ce0dd757ffe9419100eb47f4.tar.gz PrismLauncher-1936bd181f57a554ce0dd757ffe9419100eb47f4.tar.bz2 PrismLauncher-1936bd181f57a554ce0dd757ffe9419100eb47f4.zip |
Merge branch 'feature_derpstances' of https://github.com/02JanDal/MultiMC5 into feature_derpstances
Conflicts:
gui/dialogs/OneSixModEditDialog.cpp
logic/OneSixUpdate.cpp
Diffstat (limited to 'logic/OneSixVersion.h')
-rw-r--r-- | logic/OneSixVersion.h | 60 |
1 files changed, 44 insertions, 16 deletions
diff --git a/logic/OneSixVersion.h b/logic/OneSixVersion.h index 036f3d53..d7a6684d 100644 --- a/logic/OneSixVersion.h +++ b/logic/OneSixVersion.h @@ -14,40 +14,48 @@ */ #pragma once -#include <QtCore> + +#include <QAbstractListModel> + +#include <QString> +#include <QList> #include <memory> -class OneSixLibrary; +#include "OneSixLibrary.h" + +class OneSixInstance; class OneSixVersion : public QAbstractListModel { - // Things required to implement the Qt list model + Q_OBJECT public: + explicit OneSixVersion(OneSixInstance *instance, QObject *parent = 0); + virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; + virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const; virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; - virtual QVariant headerData(int section, Qt::Orientation orientation, - int role = Qt::DisplayRole) const; virtual int columnCount(const QModelIndex &parent) const; virtual Qt::ItemFlags flags(const QModelIndex &index) const; - // serialization/deserialization -public: - bool toOriginalFile(); - static std::shared_ptr<OneSixVersion> fromJson(QJsonObject root); - static std::shared_ptr<OneSixVersion> fromFile(QString filepath); + bool reload(QWidget *widgetParent, const bool excludeCustom = false); + void clear(); + + void dump() const; + + bool canRemove(const int index) const; + +public +slots: + bool remove(const int index); public: QList<std::shared_ptr<OneSixLibrary>> getActiveNormalLibs(); QList<std::shared_ptr<OneSixLibrary>> getActiveNativeLibs(); - // called when something starts/stops messing with the object - // FIXME: these are ugly in every possible way. - void externalUpdateStart(); - void externalUpdateFinish(); + + static std::shared_ptr<OneSixVersion> fromJson(const QJsonObject &obj); // data members public: - /// file this was read from. blank, if none - QString original_file; /// the ID - determines which jar to use! ACTUALLY IMPORTANT! QString id; /// Last updated time - as a string @@ -76,6 +84,10 @@ public: */ int minimumLauncherVersion = 0xDEADBEEF; /** + * A list of all tweaker classes + */ + QStringList tweakers; + /** * The main class to load first */ QString mainClass; @@ -103,4 +115,20 @@ public: } */ // QList<Rule> rules; + + struct VersionFile + { + QString name; + QString id; + QString version; + QString mcVersion; + QString filename; + }; + QList<VersionFile> versionFiles; + +private: + OneSixInstance *m_instance; }; + +QDebug operator<<(QDebug &dbg, const OneSixVersion *version); +QDebug operator<<(QDebug &dbg, const OneSixLibrary *library); |