mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-14 16:39:57 +00:00
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:
@@ -19,7 +19,10 @@
|
||||
#include "ModelPlot.h"
|
||||
#include "ModelWindow.h"
|
||||
#include "IntervalItem.h"
|
||||
#include "MainWindow.h"
|
||||
#include "RideItem.h"
|
||||
#include "Context.h"
|
||||
#include "Context.h"
|
||||
#include "Athlete.h"
|
||||
#include "Settings.h"
|
||||
#include "Zones.h"
|
||||
#include "Colors.h"
|
||||
@@ -314,7 +317,7 @@ ModelDataProvider::ModelDataProvider (BasicModelPlot &plot, ModelSettings *setti
|
||||
{
|
||||
// get application settings
|
||||
cranklength = appsettings->value(NULL, GC_CRANKLENGTH, 0.0).toDouble() / 1000.0;
|
||||
useMetricUnits = plot.main->athlete->useMetricUnits;
|
||||
useMetricUnits = plot.context->athlete->useMetricUnits;
|
||||
|
||||
// if there are no settings or incomplete settings
|
||||
// create a null data plot
|
||||
@@ -794,7 +797,7 @@ ModelDataProvider::ModelDataProvider (BasicModelPlot &plot, ModelSettings *setti
|
||||
*
|
||||
*----------------------------------------------------------------------*/
|
||||
|
||||
BasicModelPlot::BasicModelPlot(MainWindow *parent, ModelSettings *settings) : main(parent)
|
||||
BasicModelPlot::BasicModelPlot(Context *context, ModelSettings *settings) : context(context)
|
||||
{
|
||||
diag_=0;
|
||||
currentStyle = STYLE_BAR;
|
||||
@@ -990,7 +993,7 @@ BasicModelPlot::resetViewPoint()
|
||||
* MODEL PLOT
|
||||
* Nothing special - just a framed BasicModelPlot
|
||||
*----------------------------------------------------------------------*/
|
||||
ModelPlot::ModelPlot(MainWindow *parent, ModelSettings *settings) : QFrame(parent), main(parent)
|
||||
ModelPlot::ModelPlot(Context *context, ModelSettings *settings) : QFrame(context->mainWindow), context(context)
|
||||
{
|
||||
// the distinction between a model plot and a basic model plot
|
||||
// is only to provide a frame for the qwt3d plot (it looks odd
|
||||
@@ -1006,7 +1009,7 @@ ModelPlot::ModelPlot(MainWindow *parent, ModelSettings *settings) : QFrame(paren
|
||||
layout->setContentsMargins(2,2,2,2);
|
||||
setLayout(layout);
|
||||
|
||||
connect(main->context, SIGNAL(configChanged()), basicModelPlot, SLOT(configChanged()));
|
||||
connect(context, SIGNAL(configChanged()), basicModelPlot, SLOT(configChanged()));
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user