Implement loading accounts from list.

This commit is contained in:
Andrew
2013-11-18 12:58:03 -06:00
parent cdca530139
commit a9a0b65358
7 changed files with 141 additions and 7 deletions

View File

@ -18,9 +18,16 @@
#include <QObject>
#include <QString>
#include <QList>
#include <QJsonObject>
#include <memory>
class MojangAccount;
typedef std::shared_ptr<MojangAccount> MojangAccountPtr;
Q_DECLARE_METATYPE(MojangAccountPtr)
/**
* Class that represents a profile within someone's Mojang account.
*
@ -71,6 +78,16 @@ public:
*/
MojangAccount(const MojangAccount& other, QObject* parent);
/**
* Loads a MojangAccount from the given JSON object.
*/
static MojangAccountPtr loadFromJson(const QJsonObject& json);
/**
* Saves a MojangAccount to a JSON object and returns it.
*/
QJsonObject saveToJson();
/**
* This MojangAccount's username. May be an email address if the account is migrated.
@ -130,6 +147,3 @@ protected:
ProfileList m_profiles; // List of available profiles.
};
typedef std::shared_ptr<MojangAccount> MojangAccountPtr;
Q_DECLARE_METATYPE(MojangAccountPtr)