2
2
* Copyright (c) 2009 Justin F. Knotzke (jknotzke@shampoo.ca)
4
4
* This program is free software; you can redistribute it and/or modify it
5
5
* under the terms of the GNU General Public License as published by the Free
6
6
* Software Foundation; either version 2 of the License, or (at your option)
9
9
* This program is distributed in the hope that it will be useful, but WITHOUT
10
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14
14
* You should have received a copy of the GNU General Public License along
15
15
* with this program; if not, write to the Free Software Foundation, Inc., 51
16
16
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
43
48
// check the db structure is up to date
44
49
void checkDBVersion();
46
54
// create and drop connections
47
55
DBAccess(MainWindow *main, QDir home);
50
// Create/Delete Records
51
bool importRide(SummaryMetrics *summaryMetrics, RideFile *ride, unsigned long, bool);
58
// Create/Delete Metrics
59
bool importRide(SummaryMetrics *summaryMetrics, RideFile *ride, QColor color, unsigned long, bool);
52
60
bool deleteRide(QString);
62
// Create/Delete Measures
63
bool importMeasure(SummaryMetrics *summaryMetrics);
66
QList<SummaryMetrics> getAllMetricsFor(QDateTime start, QDateTime end);
67
QList<SummaryMetrics> getAllMetricsFor(DateRange dr) {
68
return getAllMetricsFor(QDateTime(dr.from,QTime(0,0,0)), QDateTime(dr.to, QTime(23,59,59)));
71
bool getRide(QString filename, SummaryMetrics &metrics, QColor&color);
72
QList<SummaryMetrics> getAllMeasuresFor(QDateTime start, QDateTime end);
73
QList<SummaryMetrics> getAllMeasuresFor(DateRange dr) {
74
return getAllMeasuresFor(QDateTime(dr.from,QTime(0,0,0)), QDateTime(dr.to, QTime(23,59,59)));
77
SummaryMetrics getRideMetrics(QString filename); // for a filename
55
79
QList<QDateTime> getAllDates();
56
QList<SummaryMetrics> getAllMetricsFor(QDateTime start, QDateTime end);
57
80
QList<Season> getAllSeasons();
62
85
QSqlDatabase dbconn;
89
QList<FieldDefinition> mfieldDefinitions;
90
QList<KeywordDefinition> mkeywordDefinitions; //NOTE: not used in measures.xml
65
93
typedef QHash<QString,RideMetric*> MetricMap;
67
95
bool createDatabase();
68
96
void closeConnection();
69
97
bool createMetricsTable();
70
98
bool dropMetricTable();
99
bool createMeasuresTable();
100
bool dropMeasuresTable();
72
101
void initDatabase(QDir home);