mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-14 08:38:45 +00:00
Move isclean from MainWindow to Athlete
.. rather unfortunate use of English as it leads to athlete->isclean == false :)
This commit is contained in:
@@ -47,6 +47,7 @@ Athlete::Athlete(Context *context, const QDir &home)
|
||||
this->context = context;
|
||||
context->athlete = this;
|
||||
cyclist = home.dirName();
|
||||
isclean = false;
|
||||
|
||||
// metric / non-metric
|
||||
QVariant unit = appsettings->cvalue(cyclist, GC_UNIT);
|
||||
|
||||
@@ -60,6 +60,7 @@ class Athlete : public QObject
|
||||
Zones *zones_;
|
||||
HrZones *hrzones_;
|
||||
void setCriticalPower(int cp);
|
||||
bool isclean;
|
||||
QSqlDatabase db;
|
||||
MetricAggregator *metricDB;
|
||||
RideMetadata *rideMetadata_;
|
||||
|
||||
@@ -146,7 +146,7 @@ QList<MainWindow *> mainwindows; // keep track of all the MainWindows we have op
|
||||
QDesktopWidget *desktop = NULL;
|
||||
|
||||
MainWindow::MainWindow(const QDir &home) :
|
||||
session(0), isclean(false), init(false), isfiltered(false), groupByMapper(NULL)
|
||||
session(0), init(false), isfiltered(false), groupByMapper(NULL)
|
||||
{
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
|
||||
@@ -147,7 +147,6 @@ class MainWindow : public QMainWindow
|
||||
// state data
|
||||
SpecialFields specialFields;
|
||||
int session;
|
||||
bool isclean;
|
||||
bool init; // we built children (i.e. didn't quit at upgrade)
|
||||
|
||||
// global filters
|
||||
|
||||
@@ -72,7 +72,7 @@ void MetricAggregator::refreshMetrics()
|
||||
void MetricAggregator::refreshMetrics(QDateTime forceAfterThisDate)
|
||||
{
|
||||
// only if we have established a connection to the database
|
||||
if (dbaccess == NULL || context->mainWindow->isclean==true) return;
|
||||
if (dbaccess == NULL || context->athlete->isclean==true) return;
|
||||
|
||||
// first check db structure is still up to date
|
||||
// this is because metadata.xml may add new fields
|
||||
@@ -215,7 +215,7 @@ void MetricAggregator::refreshMetrics(QDateTime forceAfterThisDate)
|
||||
context->athlete->lucene->optimise();
|
||||
#endif
|
||||
#endif
|
||||
context->mainWindow->isclean = true;
|
||||
context->athlete->isclean = true;
|
||||
|
||||
// stop logging
|
||||
out << "SIGNAL DATA CHANGED: " << QDateTime::currentDateTime().toString() + "\r\n";
|
||||
@@ -240,7 +240,7 @@ void MetricAggregator::addRide(RideItem*ride)
|
||||
}
|
||||
|
||||
void MetricAggregator::update() {
|
||||
context->mainWindow->isclean = false;
|
||||
context->athlete->isclean = false;
|
||||
refreshMetrics();
|
||||
}
|
||||
|
||||
@@ -346,7 +346,7 @@ MetricAggregator::getAllMetricsFor(DateRange dr)
|
||||
QList<SummaryMetrics>
|
||||
MetricAggregator::getAllMetricsFor(QDateTime start, QDateTime end)
|
||||
{
|
||||
if (context->mainWindow->isclean == false) refreshMetrics(); // get them up-to-date
|
||||
if (context->athlete->isclean == false) refreshMetrics(); // get them up-to-date
|
||||
|
||||
QList<SummaryMetrics> empty;
|
||||
|
||||
@@ -367,7 +367,7 @@ MetricAggregator::getAllMetricsFor(QDateTime start, QDateTime end)
|
||||
SummaryMetrics
|
||||
MetricAggregator::getAllMetricsFor(QString filename)
|
||||
{
|
||||
if (context->mainWindow->isclean == false) refreshMetrics(); // get them up-to-date
|
||||
if (context->athlete->isclean == false) refreshMetrics(); // get them up-to-date
|
||||
|
||||
SummaryMetrics results;
|
||||
QColor color; // ignored for now...
|
||||
@@ -408,7 +408,7 @@ MetricAggregator::getAllMeasuresFor(QDateTime start, QDateTime end)
|
||||
SummaryMetrics
|
||||
MetricAggregator::getRideMetrics(QString filename)
|
||||
{
|
||||
if (context->mainWindow->isclean == false) refreshMetrics(); // get them up-to-date
|
||||
if (context->athlete->isclean == false) refreshMetrics(); // get them up-to-date
|
||||
|
||||
SummaryMetrics empty;
|
||||
|
||||
|
||||
@@ -700,7 +700,7 @@ RideImportWizard::abortClicked()
|
||||
|
||||
if (label == tr("Abort")) {
|
||||
hide();
|
||||
context->mainWindow->isclean = false;
|
||||
context->athlete->isclean = false;
|
||||
context->athlete->metricDB->refreshMetrics();
|
||||
aborted=true; // terminated. I'll be back.
|
||||
return;
|
||||
@@ -709,7 +709,7 @@ RideImportWizard::abortClicked()
|
||||
if (label == tr("Finish")) {
|
||||
// phew. our work is done. -- lets force an update stats...
|
||||
hide();
|
||||
context->mainWindow->isclean = false;
|
||||
context->athlete->isclean = false;
|
||||
context->athlete->metricDB->refreshMetrics();
|
||||
done(0);
|
||||
return;
|
||||
|
||||
@@ -93,7 +93,7 @@ WithingsDownload::downloadFinished(QNetworkReply *reply)
|
||||
QMessageBox::information(context->mainWindow, tr("Withings Data Download"), status);
|
||||
|
||||
if (!olderDate.isNull()) {
|
||||
context->mainWindow->isclean = false;
|
||||
context->athlete->isclean = false;
|
||||
context->athlete->metricDB->refreshMetrics(olderDate);
|
||||
}
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user