diff options
| author | Chris Bessent <lost.dragonist@gmail.com> | 2020-01-06 05:17:01 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-01-06 05:17:01 -0700 |
| commit | dfa600996c49c1b23dca884c963dc917bd9cfc0a (patch) | |
| tree | c6def4277cc962822d0dcde71fa9148e050f693f /src/apiuseraccount.cpp | |
| parent | e69078e2399a88bda7bb9ffae7a3d57db9a4e9cf (diff) | |
| parent | d1a788dfad341b32235abc25c2ba1645f8be1ace (diff) | |
Merge pull request #954 from ModOrganizer2/Develop
Stage for release 2.2.2
Diffstat (limited to 'src/apiuseraccount.cpp')
| -rw-r--r-- | src/apiuseraccount.cpp | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/src/apiuseraccount.cpp b/src/apiuseraccount.cpp index b901e41a..976dd488 100644 --- a/src/apiuseraccount.cpp +++ b/src/apiuseraccount.cpp @@ -1,10 +1,37 @@ #include "apiuseraccount.h" +QString localizedUserAccountType(APIUserAccountTypes t) +{ + switch (t) + { + case APIUserAccountTypes::Regular: + return QObject::tr("Regular"); + + case APIUserAccountTypes::Premium: + return QObject::tr("Premium"); + + case APIUserAccountTypes::None: // fall-through + default: + return QObject::tr("None"); + } +} + + APIUserAccount::APIUserAccount() : m_type(APIUserAccountTypes::None) { } +bool APIUserAccount::isValid() const +{ + return !m_key.isEmpty(); +} + +const QString& APIUserAccount::apiKey() const +{ + return m_key; +} + const QString& APIUserAccount::id() const { return m_id; @@ -25,6 +52,12 @@ const APILimits& APIUserAccount::limits() const return m_limits; } +APIUserAccount& APIUserAccount::apiKey(const QString& key) +{ + m_key = key; + return *this; +} + APIUserAccount& APIUserAccount::id(const QString& id) { m_id = id; @@ -63,5 +96,5 @@ bool APIUserAccount::shouldThrottle() const bool APIUserAccount::exhausted() const { - return (remainingRequests() <= 0); + return isValid() && (remainingRequests() <= 0); } |
