summaryrefslogtreecommitdiff
path: root/src/model/MedalWinner.h
diff options
context:
space:
mode:
authorSteru <jerrydream111@gmail.com>2024-08-16 15:39:05 +0200
committerSteru <jerrydream111@gmail.com>2024-08-16 23:53:31 +0200
commitb825a98d95dd9fa432a161d95eb6454536e01af4 (patch)
tree4a55a4f3907d8843cf56eabcbda6629266499123 /src/model/MedalWinner.h
parentb869b8983656b12f9dee59439acfb6b3db647b72 (diff)
Fixed constructors.
Diffstat (limited to 'src/model/MedalWinner.h')
-rw-r--r--src/model/MedalWinner.h18
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; }