From a9a0b65358b3799746fa9c8e1aa879e0b59ef526 Mon Sep 17 00:00:00 2001 From: Andrew Date: Mon, 18 Nov 2013 12:58:03 -0600 Subject: Implement loading accounts from list. --- logic/auth/MojangAccount.h | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'logic/auth') diff --git a/logic/auth/MojangAccount.h b/logic/auth/MojangAccount.h index a38cb8f7..35261d65 100644 --- a/logic/auth/MojangAccount.h +++ b/logic/auth/MojangAccount.h @@ -18,9 +18,16 @@ #include #include #include +#include #include +class MojangAccount; + +typedef std::shared_ptr 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 MojangAccountPtr; -Q_DECLARE_METATYPE(MojangAccountPtr) - -- cgit v1.2.3