diff options
author | Jan Dalheimer <jan@dalheimer.de> | 2014-01-24 18:12:02 +0100 |
---|---|---|
committer | Jan Dalheimer <jan@dalheimer.de> | 2014-01-24 18:12:02 +0100 |
commit | 7d5787025aa5cebf6778f71e79f248f10b8541c9 (patch) | |
tree | bb80eb6a4e313b19da00a9ad8d0e1248aaa50212 /logic/OneSixVersion.h | |
parent | 156bc8f27656c115bf1b023cd4ebc5f629df3887 (diff) | |
download | MultiMC-7d5787025aa5cebf6778f71e79f248f10b8541c9.tar MultiMC-7d5787025aa5cebf6778f71e79f248f10b8541c9.tar.gz MultiMC-7d5787025aa5cebf6778f71e79f248f10b8541c9.tar.lz MultiMC-7d5787025aa5cebf6778f71e79f248f10b8541c9.tar.xz MultiMC-7d5787025aa5cebf6778f71e79f248f10b8541c9.zip |
Change naming from Derp -> OneSix until the new instance type supports legacy
Diffstat (limited to 'logic/OneSixVersion.h')
-rw-r--r-- | logic/OneSixVersion.h | 45 |
1 files changed, 27 insertions, 18 deletions
diff --git a/logic/OneSixVersion.h b/logic/OneSixVersion.h index e8f744aa..00afd010 100644 --- a/logic/OneSixVersion.h +++ b/logic/OneSixVersion.h @@ -14,15 +14,23 @@ */ #pragma once -#include <QtCore> + +#include <QAbstractListModel> + +#include <QString> +#include <QList> #include <memory> -class DerpLibrary; +#include "OneSixLibrary.h" + +class OneSixInstance; -class DerpVersion : public QAbstractListModel +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 int rowCount(const QModelIndex &parent = QModelIndex()) const; virtual QVariant headerData(int section, Qt::Orientation orientation, @@ -30,24 +38,19 @@ public: virtual int columnCount(const QModelIndex &parent) const; virtual Qt::ItemFlags flags(const QModelIndex &index) const; - // serialization/deserialization -public: - bool toOriginalFile(); - static std::shared_ptr<DerpVersion> fromJson(QJsonObject root); - static std::shared_ptr<DerpVersion> fromFile(QString filepath); + bool reload(QWidget *widgetParent); + void clear(); + + void dump() const; public: - QList<std::shared_ptr<DerpLibrary>> getActiveNormalLibs(); - QList<std::shared_ptr<DerpLibrary>> getActiveNativeLibs(); - // called when something starts/stops messing with the object - // FIXME: these are ugly in every possible way. - void externalUpdateStart(); - void externalUpdateFinish(); + QList<std::shared_ptr<OneSixLibrary>> getActiveNormalLibs(); + QList<std::shared_ptr<OneSixLibrary>> getActiveNativeLibs(); + + 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 @@ -81,7 +84,7 @@ public: QString mainClass; /// the list of libs - both active and inactive, native and java - QList<std::shared_ptr<DerpLibrary>> libraries; + QList<std::shared_ptr<OneSixLibrary>> libraries; /* FIXME: add support for those rules here? Looks like a pile of quick hacks to me though. @@ -103,4 +106,10 @@ public: } */ // QList<Rule> rules; + +private: + OneSixInstance *m_instance; }; + +QDebug operator<<(QDebug &dbg, const OneSixVersion *version); +QDebug operator<<(QDebug &dbg, const OneSixLibrary *library); |