diff options
Diffstat (limited to 'src/model/MedalWinner.h')
-rw-r--r-- | src/model/MedalWinner.h | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/model/MedalWinner.h b/src/model/MedalWinner.h index 45d1ee8..10d08bd 100644 --- a/src/model/MedalWinner.h +++ b/src/model/MedalWinner.h @@ -4,7 +4,6 @@ #include "Competitor.h" #include <QMap> #include <QJsonObject> -#include <stdexcept> #include <QAbstractListModel> @@ -17,16 +16,17 @@ class MedalWinner : public Competitor { Q_PROPERTY(int bronze READ m_bronze NOTIFY nBronze) public: - MedalWinner() : Competitor(), m_gold(0), m_silver(0), m_bronze(0) {} - MedalWinner(const MedalWinner &medalWinner) : Competitor(medalWinner), - m_gold(medalWinner.m_gold), m_silver(medalWinner.m_silver), m_bronze(medalWinner.m_bronze) {} - MedalWinner(const QJsonObject &competitor) : Competitor(competitor) { - if (!competitor.contains("medals")) throw invalid_argument("Competitor has no medals."); - QJsonObject medals = competitor["medals"].toObject(); - setMedals(medals); - } + explicit MedalWinner(Competitor *parent) : Competitor(parent) {} + + bool setMedalWinner(const QJsonObject &competitor); + void setMedalWinner(const MedalWinner &competitor); bool setMedals(const QJsonObject &medals); + + void setGold(int gold) { this->m_gold = gold; } + void setSilver(int silver) { this->m_silver = silver; } + void setBronze(int bronze) { this->m_bronze = bronze; } + int getGold() { return m_gold; } int getSilver() { return m_silver; } int getBronze() { return m_bronze; } |