From 4f12d941f949bb8b8c1d043ac34772c5c80f1b89 Mon Sep 17 00:00:00 2001 From: Steru Date: Thu, 15 Aug 2024 21:00:18 +0200 Subject: Added pragma once to headers and notify to Q Params. --- src/api/OlympicsAPI.h | 7 +------ src/model/Competitor.h | 17 ++++++----------- src/model/CompetitorWithResults.h | 16 ++++++---------- src/model/MedalWinner.h | 12 ++++-------- src/model/Sport.h | 5 +---- 5 files changed, 18 insertions(+), 39 deletions(-) (limited to 'src') diff --git a/src/api/OlympicsAPI.h b/src/api/OlympicsAPI.h index f1168b6..a301cf8 100644 --- a/src/api/OlympicsAPI.h +++ b/src/api/OlympicsAPI.h @@ -1,7 +1,5 @@ -#ifndef ITAT_CHALLANGE_OLYMPICS_OLYMPICSAPI_H -#define ITAT_CHALLANGE_OLYMPICS_OLYMPICSAPI_H - +#pragma once #define API_LINK "https://sph-s-api.olympics.com/summer/schedules/api/ENG/schedule/discipline/" @@ -72,6 +70,3 @@ public: string getDisciplineShort(Disciplines sport); }; - - -#endif //ITAT_CHALLANGE_OLYMPICS_OLYMPICSAPI_H diff --git a/src/model/Competitor.h b/src/model/Competitor.h index e5b0251..51fc3b1 100644 --- a/src/model/Competitor.h +++ b/src/model/Competitor.h @@ -1,12 +1,10 @@ -#ifndef ITAT_CHALLANGE_OLYMPICS_COMPETITOR_H -#define ITAT_CHALLANGE_OLYMPICS_COMPETITOR_H +#pragma once #include #include #include #include -#include using namespace std; @@ -14,15 +12,15 @@ class Competitor { Q_OBJECT - Q_PROPERTY(int code READ code) - Q_PROPERTY(QString name READ name) - Q_PROPERTY(QString noc READ noc) + Q_PROPERTY(int code READ code NOTIFY nCode) + Q_PROPERTY(QString name READ name NOTIFY nName) + Q_PROPERTY(QString noc READ noc NOTIFY nNoc) public: Competitor() { this->code = 0; - this->name = "na"; - this->noc = "---"; + this->name = ""; + this->noc = ""; } Competitor(const Competitor &competitor) { @@ -58,6 +56,3 @@ private: QString noc; }; - - -#endif //ITAT_CHALLANGE_OLYMPICS_COMPETITOR_H diff --git a/src/model/CompetitorWithResults.h b/src/model/CompetitorWithResults.h index f57b773..a58023f 100644 --- a/src/model/CompetitorWithResults.h +++ b/src/model/CompetitorWithResults.h @@ -1,6 +1,5 @@ -#ifndef ITAT_CHALLANGE_OLYMPICS_COMPETITORWITHRESULTS_H -#define ITAT_CHALLANGE_OLYMPICS_COMPETITORWITHRESULTS_H +#pragma once #include "Competitor.h" #include @@ -13,14 +12,14 @@ class CompetitorWithResults : public Competitor { Q_OBJECT - Q_PROPERTY(QString mark READ mark) - Q_PROPERTY(QString medalType READ medalType) - Q_PROPERTY(QString statistic READ statistic WRITE setStatistic) + Q_PROPERTY(QString mark READ mark NOTIFY nMark) + Q_PROPERTY(QString medalType READ medalType NOTIFY nMedalType) + Q_PROPERTY(QString statistic READ statistic NOTIFY nStatistic) public: CompetitorWithResults() : Competitor() { - this->mark = "-"; - this->medalType = "-"; + this->mark = ""; + this->medalType = ""; } CompetitorWithResults(const CompetitorWithResults &competitor) : Competitor(competitor) { @@ -49,6 +48,3 @@ private: QString statistic; }; - - -#endif //ITAT_CHALLANGE_OLYMPICS_COMPETITORWITHRESULTS_H diff --git a/src/model/MedalWinner.h b/src/model/MedalWinner.h index 99ca1a3..7f17449 100644 --- a/src/model/MedalWinner.h +++ b/src/model/MedalWinner.h @@ -1,6 +1,5 @@ -#ifndef ITAT_CHALLANGE_OLYMPICS_MEDALWINNER_H -#define ITAT_CHALLANGE_OLYMPICS_MEDALWINNER_H +#pragma once #include "Competitor.h" #include @@ -12,9 +11,9 @@ class MedalWinner : public Competitor { Q_OBJECT - Q_PROPERTY(int gold READ gold) - Q_PROPERTY(int silver READ silver) - Q_PROPERTY(int bronze READ bronze) + Q_PROPERTY(int gold READ gold NOTIFY nGold) + Q_PROPERTY(int silver READ silver NOTIFY nSilver) + Q_PROPERTY(int bronze READ bronze NOTIFY nBronze) public: MedalWinner() : Competitor() { @@ -46,6 +45,3 @@ private: int gold, silver, bronze; }; - - -#endif //ITAT_CHALLANGE_OLYMPICS_MEDALWINNER_H diff --git a/src/model/Sport.h b/src/model/Sport.h index 2ca83a3..c5d1c66 100644 --- a/src/model/Sport.h +++ b/src/model/Sport.h @@ -1,5 +1,4 @@ -#ifndef ITAT_CHALLANGE_OLYMPICS_SPORT_H -#define ITAT_CHALLANGE_OLYMPICS_SPORT_H +#pragma once #include "MedalWinner.h" #include "CompetitorWithResults.h" @@ -126,5 +125,3 @@ private: float calcRelativeStat(QString ref, QString val); }; - -#endif -- cgit v1.2.3