-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lbchronorace.hpp
140 lines (112 loc) · 4.49 KB
/
lbchronorace.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
/*****************************************************************************
* Copyright (C) 2021 by Lorenzo Buzzi ([email protected]) *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
*****************************************************************************/
#ifndef LBCHRONORACE_H
#define LBCHRONORACE_H
#include <QGuiApplication>
#include <QMainWindow>
#include <QDir>
#include <QScopedPointer>
#include <QRegularExpression>
#include "ui_chronorace.h"
#include "chronoracetable.hpp"
#include "chronoracedata.hpp"
#include "chronoracetimings.hpp"
#include "compsexdelegate.hpp"
#include "clubdelegate.hpp"
#include "rankingtypedelegate.hpp"
#include "rankingcatsdelegate.hpp"
#include "cattypedelegate.hpp"
#include "timingstatusdelegate.hpp"
#ifndef LBCHRONORACE_NAME
#error "LBCHRONORACE_NAME not set"
#endif
#ifndef LBCHRONORACE_VERSION
#error "LBCHRONORACE_VERSION not set"
#endif
constexpr char LBCHRONORACE_STARTLIST_DEFAULT[] = "startlist.csv";
constexpr char LBCHRONORACE_TEAMLIST_DEFAULT[] = "teamlist.csv";
constexpr char LBCHRONORACE_TIMINGS_DEFAULT[] = "timings.csv";
constexpr char LBCHRONORACE_RANKINGS_DEFAULT[] = "rankings.csv";
constexpr char LBCHRONORACE_CATEGORIES_DEFAULT[] = "categories.csv";
constexpr uint LBCHRONORACE_BIN_FMT_v1 = 1u;
constexpr uint LBCHRONORACE_BIN_FMT_v2 = 2u;
constexpr uint LBCHRONORACE_BIN_FMT_v3 = 3u;
constexpr uint LBCHRONORACE_BIN_FMT_v4 = 4u;
#define LBCHRONORACE_BIN_FMT LBCHRONORACE_BIN_FMT_v4
class LBChronoRace : public QMainWindow
{
Q_OBJECT
public:
explicit LBChronoRace(QWidget *parent = Q_NULLPTR, QGuiApplication const *app = Q_NULLPTR);
static QDir lastSelectedPath;
static uint binFormat;
static QRegularExpression csvFilter;
public slots:
void initialize();
void show(); //NOSONAR
void resizeDialogs(QScreen const *screen);
void setCounterTeams(int count) const;
void setCounterCompetitors(int count) const;
void setCounterRankings(int count) const;
void setCounterCategories(int count) const;
void setCounterTimings(int count) const;
void appendInfoMessage(QString const &message) const;
void appendErrorMessage(QString const &message) const;
private:
QScopedPointer<Ui::LBChronoRace> ui { new Ui::LBChronoRace };
QString raceDataFileName { "" };
QString startListFileName;
QString timingsFileName;
QString rankingsFileName;
QString categoriesFileName;
QString teamsFileName;
ChronoRaceData raceInfo;
ChronoRaceTable startListTable;
ChronoRaceTable teamsTable;
ChronoRaceTable rankingsTable;
ChronoRaceTable categoriesTable;
ChronoRaceTable timingsTable;
ChronoRaceTimings timings;
CompetitorSexDelegate sexDelegate;
ClubDelegate clubDelegate;
RankingTypeDelegate rankingTypeDelegate;
RankingCategoriesDelegate rankingCatsDelegate;
CategoryTypeDelegate categoryTypeDelegate;
TimingStatusDelegate timingStatusDelegate;
bool loadRaceFile(QString const &fileName);
private slots:
void actionAbout();
void actionAboutQt();
void loadRace();
void saveRace();
void saveRaceAs();
void setEncoding();
void encodingSelector(int idx) const;
void formatSelector(int idx) const;
void makeStartList();
void makeRankings();
void importStartList();
void importRankingsList();
void importCategoriesList();
void importTimingsList();
void exportStartList();
void exportTeamList();
void exportRankingsList();
void exportCategoriesList();
void exportTimingsList();
};
#endif // LBCHRONORACE_H