Refactor MainWindow Part 2 of 5

Decoupled classes from MainWindow to reference Context
and Athlete (and introduced a couple of new headers).

We no longer pass around a MainWindow pointer to children
but pass a context instead.

There are still a few pieces left in MainWindow that need
to move to a better place;
    * Setting/clearing filter selection
    * Working with Intervals
    * Adding/Deleting Rides
    * Save on Exit

As mentioned previously there are lots of other parts to
this refactor left to do;
    * break MainWindow Gui elements into Toolbar and Views

    * migrate from RideItem and Ridelist to ActivityCollection
      and Activity classes that are not tied into gui elements.

    * introduce Application Context and AthleteCollection
This commit is contained in:
Mark Liversedge
2013-07-10 13:57:30 +01:00
parent e256783f73
commit 0fcbbe1b77
235 changed files with 2196 additions and 1948 deletions

View File

@@ -17,6 +17,7 @@
*/
#include "PwxRideFile.h"
#include "Athlete.h"
#include "Settings.h"
#include <QDomDocument>
#include <QVector>
@@ -297,7 +298,7 @@ PwxFileReader::PwxFromDomDoc(QDomDocument doc, QStringList &errors) const
}
bool
PwxFileReader::writeRideFile(MainWindow *main, const RideFile *ride, QFile &file) const
PwxFileReader::writeRideFile(Context *context, const RideFile *ride, QFile &file) const
{
QDomText text; // used all over
QDomDocument doc;
@@ -320,7 +321,7 @@ PwxFileReader::writeRideFile(MainWindow *main, const RideFile *ride, QFile &file
// athlete details
QDomElement athlete = doc.createElement("athlete");
QDomElement name = doc.createElement("name");
text = doc.createTextNode(main->athlete->cyclist); name.appendChild(text);
text = doc.createTextNode(context->athlete->cyclist); name.appendChild(text);
athlete.appendChild(name);
double cyclistweight = ride->getTag("Weight", "0.0").toDouble();
if (cyclistweight) {