429 changes: 88 additions & 341 deletions src/Charts/HomeWindow.cpp → src/Charts/Perspective.cpp

Large diffs are not rendered by default.

68 changes: 33 additions & 35 deletions src/Charts/HomeWindow.h → src/Charts/Perspective.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,21 @@

class ChartBar;
class LTMSettings;
class TabView;
class ViewParser;

class HomeWindow : public GcWindow
class Perspective : public GcWindow
{
Q_OBJECT
G_OBJECT

friend ::TabView;
friend ::ViewParser;

public:

HomeWindow(Context *, QString name, QString title);
~HomeWindow();
Perspective(Context *, QString title, int type);
~Perspective();

void resetLayout();
void importChart(QMap<QString,QString> properties, bool select);
Expand Down Expand Up @@ -93,10 +98,6 @@ class HomeWindow : public GcWindow
void closeWindow(GcWindow*);
void showControls();

// save / restore window state
void saveState();
void restoreState(bool useDefault = false);

//notifiction that been made visible
void selected();

Expand All @@ -116,13 +117,16 @@ class HomeWindow : public GcWindow

protected:
Context *context;
QString name;
bool active; // ignore gui signals when changing views
GcChartWindow *clicked; // keep track of selected charts
bool dropPending;

// what are we?
int type;
QString view;

// top bar
QLabel *title;
QString title;
QLineEdit *titleEdit;

QComboBox *styleSelector;
Expand All @@ -145,9 +149,7 @@ class HomeWindow : public GcWindow
QList<GcChartWindow*> charts;
int chartCursor;

bool loaded;

void translateChartTitles(QList<GcChartWindow*> charts);
static void translateChartTitles(QList<GcChartWindow*> charts);
};

// setup the chart
Expand Down Expand Up @@ -181,29 +183,6 @@ class GcWindowDialog : public QDialog
QDoubleSpinBox *height, *width;
};

class ViewParser : public QXmlDefaultHandler
{

public:
ViewParser(Context *context) : style(2), context(context) {}

// the results!
QList<GcChartWindow*> charts;
int style;

// unmarshall
bool startDocument();
bool endDocument();
bool endElement( const QString&, const QString&, const QString &qName );
bool startElement( const QString&, const QString&, const QString &name, const QXmlAttributes &attrs );
bool characters( const QString& str );

protected:
Context *context;
GcChartWindow *chart;

};

class ImportChartDialog : public QDialog
{
Q_OBJECT
Expand All @@ -225,4 +204,23 @@ class ImportChartDialog : public QDialog

};

class AddPerspectiveDialog : public QDialog
{
Q_OBJECT

public:
AddPerspectiveDialog(Context *context, QString &name);

protected:
QLineEdit *nameEdit;
QPushButton *add, *cancel;

public slots:
void addClicked();
void cancelClicked();

private:
Context *context;
QString &name;
};
#endif // _GC_HomeWindow_h
2 changes: 1 addition & 1 deletion src/Charts/UserChart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1110,7 +1110,7 @@ EditUserSeriesDialog::EditUserSeriesDialog(Context *context, bool rangemode, Gen
SpecialFields sp;

// get sorted list
QStringList names = context->tab->rideNavigator()->logicalHeadings;
QStringList names = context->rideNavigator->logicalHeadings;

// start with just a list of functions
list = DataFilter::builtins(context);
Expand Down
4 changes: 3 additions & 1 deletion src/Core/Context.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ class GlobalContext : public QObject

};

class RideNavigator;
class Context : public QObject
{
Q_OBJECT;
Expand All @@ -124,8 +125,9 @@ class Context : public QObject
const RideItem *currentRideItem() { return ride; }
DateRange currentDateRange() { return dr_; }

// current selections
// current selections and widgetry
MainWindow * const mainWindow;
RideNavigator *rideNavigator;
Tab *tab;
Athlete *athlete;
RideItem *ride; // the currently selected ride
Expand Down
2 changes: 1 addition & 1 deletion src/Core/UserData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ EditUserDataDialog::EditUserDataDialog(Context *context, UserData *here) :
SpecialFields sp;

// get sorted list
QStringList names = context->tab->rideNavigator()->logicalHeadings;
QStringList names = context->rideNavigator->logicalHeadings;

// start with just a list of functions
list = DataFilter::builtins(context);
Expand Down
2 changes: 1 addition & 1 deletion src/Gui/AnalysisSidebar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ AnalysisSidebar::AnalysisSidebar(Context *context) : QWidget(context->mainWindow
calendarWidget->setWhatsThis(helpCalendar->getWhatsThisText(HelpWhatsThis::SideBarRidesView_Calendar));

// Activity History
rideNavigator = new RideNavigator(context, true);
context->rideNavigator = rideNavigator = new RideNavigator(context, true);
rideNavigator->showMore(false);
groupByMapper = NULL;

Expand Down
2 changes: 1 addition & 1 deletion src/Gui/EditUserMetricDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ EditUserMetricDialog::EditUserMetricDialog(QWidget *parent, Context *context, Us
SpecialFields sp;

// get sorted list
QStringList names = context->tab->rideNavigator()->logicalHeadings;
QStringList names = context->rideNavigator->logicalHeadings;

// start with just a list of functions
list = DataFilter::builtins(context);
Expand Down
2 changes: 1 addition & 1 deletion src/Gui/LTMSidebar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include "HelpWhatsThis.h"

#include "GcWindowRegistry.h" // for GcWinID types
#include "HomeWindow.h" // for GcWindowDialog
#include "Perspective.h" // for GcWindowDialog
#include "LTMWindow.h" // for LTMWindow::settings()
#include "LTMChartParser.h" // for LTMChartParser::serialize && ChartTreeView

Expand Down
74 changes: 62 additions & 12 deletions src/Gui/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
#include "GcToolBar.h"
#include "NewSideBar.h"
#include "HelpWindow.h"
#include "HomeWindow.h"
#include "Perspective.h"
#if !defined(Q_OS_MAC)
#include "QTFullScreen.h" // not mac!
#endif
Expand Down Expand Up @@ -133,7 +133,7 @@ MainWindow::MainWindow(const QDir &home)
*--------------------------------------------------------------------*/
setAttribute(Qt::WA_DeleteOnClose);
mainwindows.append(this); // add us to the list of open windows
init = false;
pactive = init = false;

// create a splash to keep user informed on first load
// first one in middle of display, not middle of window
Expand Down Expand Up @@ -952,7 +952,7 @@ MainWindow::exportChartToCloudDB()
{
// upload the current chart selected to the chart db
// called from the sidebar menu
HomeWindow *page=currentTab->view(currentTab->currentView())->page();
Perspective *page=currentTab->view(currentTab->currentView())->page();
if (page->currentStyle == 0 && page->currentChart())
page->currentChart()->exportChartToCloudDB();
}
Expand Down Expand Up @@ -1271,42 +1271,42 @@ MainWindow::selectAthlete()
void
MainWindow::selectAnalysis()
{
currentTab->analysisView->setPerspectives(perspectiveSelector);
viewStack->setCurrentIndex(1);
sidebar->setItemSelected(3, true);
currentTab->selectView(1);
currentTab->analysisView->setPerspectives(perspectiveSelector);
perspectiveSelector->show();
setToolButtons();
}

void
MainWindow::selectTrain()
{
currentTab->trainView->setPerspectives(perspectiveSelector);
viewStack->setCurrentIndex(1);
sidebar->setItemSelected(5, true);
currentTab->selectView(3);
currentTab->trainView->setPerspectives(perspectiveSelector);
perspectiveSelector->show();
setToolButtons();
}

void
MainWindow::selectDiary()
{
currentTab->diaryView->setPerspectives(perspectiveSelector);
viewStack->setCurrentIndex(1);
currentTab->selectView(2);
currentTab->diaryView->setPerspectives(perspectiveSelector);
perspectiveSelector->show();
setToolButtons();
}

void
MainWindow::selectHome()
{
currentTab->homeView->setPerspectives(perspectiveSelector);
viewStack->setCurrentIndex(1);
sidebar->setItemSelected(2, true);
currentTab->selectView(0);
currentTab->homeView->setPerspectives(perspectiveSelector);
perspectiveSelector->show();
setToolButtons();
}
Expand Down Expand Up @@ -1366,14 +1366,64 @@ MainWindow::setToolButtons()
void
MainWindow::perspectiveSelected(int index)
{
if (pactive) return;

// set the perspective for the current view
int view = currentTab->currentView();

TabView *current = NULL;
switch (view) {
case 0: currentTab->homeView->perspectiveSelected(index); break;
case 1: currentTab->diaryView->perspectiveSelected(index); break;
case 2: currentTab->analysisView->perspectiveSelected(index); break;
case 3: currentTab->trainView->perspectiveSelected(index); break;
case 0: current = currentTab->homeView; break;
case 1: current = currentTab->analysisView; break;
case 2: current = currentTab->diaryView; break;
case 3: current = currentTab->trainView; break;
}

// which perspective is currently being shown?
int prior = current->pages_.indexOf(current->page_);

if (index < current->pages_.count()) {

// a perspectives was selected
switch (view) {
case 0: current->perspectiveSelected(index); break;
case 1: current->perspectiveSelected(index); break;
case 2: current->perspectiveSelected(index); break;
case 3: current->perspectiveSelected(index); break;
}

} else {

// manage or add perspectives selected
pactive = true;

// set the combo back to where it was
perspectiveSelector->setCurrentIndex(prior);

// now open dialog etc
switch (index - current->pages_.count()) {
case 1 : // add perspectives
{
QString name;
AddPerspectiveDialog *dialog= new AddPerspectiveDialog(currentTab->context, name);
int ret= dialog->exec();
delete dialog;
if (ret == QDialog::Accepted && name != "") {

// add...
current->addPerspective(name);
current->setPerspectives(perspectiveSelector);

// and select remember pactive is true, so we do the heavy lifting here
perspectiveSelector->setCurrentIndex(current->pages_.count()-1);
current->perspectiveSelected(perspectiveSelector->currentIndex());
}
}
break;
case 2 : // manage perspectives
// XXX todo
break;
}
pactive = false;
}
}

Expand Down
1 change: 1 addition & 0 deletions src/Gui/MainWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ class MainWindow : public QMainWindow
#endif

QComboBox *perspectiveSelector;
bool pactive; // when programmatically manipulating selector
SearchFilterBox *searchBox;

// Not on Mac so use other types
Expand Down
4 changes: 2 additions & 2 deletions src/Gui/SearchBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ SearchBox::configChanged(qint32)
list << "NA";

// get sorted list
QStringList names = context->tab->rideNavigator()->logicalHeadings;
QStringList names = context->rideNavigator->logicalHeadings;
std::sort(names.begin(), names.end(), insensitiveLessThan);

foreach(QString name, names) {
Expand Down Expand Up @@ -375,7 +375,7 @@ void SearchBox::runMenu(QAction *x)

} else if (x->text() == tr("Column Chooser")) {

ColumnChooser *selector = new ColumnChooser(context->tab->rideNavigator()->logicalHeadings);
ColumnChooser *selector = new ColumnChooser(context->rideNavigator->logicalHeadings);
selector->show();

} else {
Expand Down
55 changes: 20 additions & 35 deletions src/Gui/Tab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,41 +50,47 @@ Tab::Tab(Context *context) : QWidget(context->mainWindow), context(context), nos
masterControls->setCurrentIndex(0);
masterControls->setContentsMargins(0,0,0,0);

// Home
homeControls = new QStackedWidget(this);
homeControls->setFrameStyle(QFrame::Plain | QFrame::NoFrame);
homeControls->setContentsMargins(0,0,0,0);
masterControls->addWidget(homeControls);
homeView = new HomeView(context, homeControls);
views->addWidget(homeView);

// Analysis
// Analysis - created first as sidebar is used elsewhere (yuk)
analysisControls = new QStackedWidget(this);
analysisControls->setFrameStyle(QFrame::Plain | QFrame::NoFrame);
analysisControls->setCurrentIndex(0);
analysisControls->setContentsMargins(0,0,0,0);
masterControls->addWidget(analysisControls);
analysisView = new AnalysisView(context, analysisControls);
views->addWidget(analysisView);

// Home
homeControls = new QStackedWidget(this);
homeControls->setFrameStyle(QFrame::Plain | QFrame::NoFrame);
homeControls->setContentsMargins(0,0,0,0);
homeView = new HomeView(context, homeControls);

// Diary
diaryControls = new QStackedWidget(this);
diaryControls->setFrameStyle(QFrame::Plain | QFrame::NoFrame);
diaryControls->setCurrentIndex(0);
diaryControls->setContentsMargins(0,0,0,0);
masterControls->addWidget(diaryControls);
diaryView = new DiaryView(context, diaryControls);
views->addWidget(diaryView);

// Train
trainControls = new QStackedWidget(this);
trainControls->setFrameStyle(QFrame::Plain | QFrame::NoFrame);
trainControls->setCurrentIndex(0);
trainControls->setContentsMargins(0,0,0,0);
masterControls->addWidget(trainControls);
trainView = new TrainView(context, trainControls);

// although the views are created with analysis created first
// we add them to the views and master controls in the old
// order to make sure we select the right stack index
// when switching views
views->addWidget(homeView);
views->addWidget(analysisView);
views->addWidget(diaryView);
views->addWidget(trainView);

masterControls->addWidget(homeControls);
masterControls->addWidget(analysisControls);
masterControls->addWidget(diaryControls);
masterControls->addWidget(trainControls);

// the dialog box for the chart settings
chartSettings = new ChartSettings(this, masterControls);
chartSettings->setMaximumWidth(650);
Expand All @@ -100,21 +106,6 @@ Tab::Tab(Context *context) : QWidget(context->mainWindow), context(context), nos
// cpx aggregate cache check
connect(context,SIGNAL(rideSelected(RideItem*)), this, SLOT(rideSelected(RideItem*)));

// selects the latest ride in the list:
// first skipping those in the future
QDateTime now = QDateTime::currentDateTime();
for (int i=context->athlete->rideCache->rides().count(); i>0; --i) {
if (context->athlete->rideCache->rides()[i-1]->dateTime <= now) {
context->athlete->selectRideFile(context->athlete->rideCache->rides()[i-1]->fileName);
break;
}
}

// otherwise just the latest
if (context->currentRideItem() == NULL && context->athlete->rideCache->rides().count() != 0) {
context->athlete->selectRideFile(context->athlete->rideCache->rides().last()->fileName);
}

noswitch = false; // we only let it happen when we're initialised
init = true;
}
Expand All @@ -129,12 +120,6 @@ Tab::~Tab()
delete nav;
}

RideNavigator *
Tab::rideNavigator()
{
return analysisView->rideNavigator();
}

void
Tab::close()
{
Expand Down
1 change: 0 additions & 1 deletion src/Gui/Tab.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ class Tab: public QWidget
TabView *view(int index);

NavigationModel *nav; // back/forward for this tab
RideNavigator *rideNavigator(); // to get logical headings

protected:

Expand Down
458 changes: 437 additions & 21 deletions src/Gui/TabView.cpp

Large diffs are not rendered by default.

52 changes: 44 additions & 8 deletions src/Gui/TabView.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <QMetaObject>
#include <QStackedWidget>

#include "HomeWindow.h"
#include "Perspective.h"
#include "Colors.h"
#include "GcSideBarItem.h"
#include "GcWindowRegistry.h"
Expand All @@ -44,6 +44,8 @@ class TabView : public QWidget
Q_PROPERTY(bool tiled READ isTiled WRITE setTiled USER true)
Q_PROPERTY(bool selected READ isSelected WRITE setSelected USER true) // make this last always

friend class ::MainWindow;

public:

TabView(Context *context, int type);
Expand All @@ -53,8 +55,8 @@ class TabView : public QWidget
// add the widgets to the view
void setSidebar(QWidget *sidebar);
QWidget *sidebar() { return sidebar_; }
void setPage(HomeWindow *page);
HomeWindow *page() { return page_;}
void setPages(QStackedWidget *pages);
Perspective *page() { return page_;}
void setBlank(BlankStatePage *blank);
BlankStatePage *blank() { return blank_; }
void setBottom(QWidget *bottom);
Expand All @@ -69,10 +71,16 @@ class TabView : public QWidget
void setTiled(bool x) { _tiled=x; tileModeChanged(); }
bool isTiled() const { return _tiled; }

// set perspective
// load/save perspectives
void restoreState(bool useDefault = false);
void saveState();

void setPerspectives(QComboBox *perspectiveSelector); // set the combobox when view selected
void perspectiveSelected(int index); // combobox selections changed because the user selected a perspective

// add a new perspective
void addPerspective(QString);

// bottom
void dragEvent(bool); // showbottom on drag event
void setShowBottom(bool x);
Expand All @@ -88,8 +96,6 @@ class TabView : public QWidget
void setSelected(bool x) { _selected=x; selectionChanged(); }
bool isSelected() const { return _selected; }

void saveState() { if (page_) page_->saveState(); }

int viewType() { return type; }

void importChart(QMap<QString,QString>properties, bool select) { page_->importChart(properties, select); }
Expand Down Expand Up @@ -151,15 +157,45 @@ class TabView : public QWidget
QPropertyAnimation *anim;
QWidget *sidebar_;
QWidget *bottom_;
HomeWindow *page_; // currently selected page
QList<HomeWindow> pages_;

Perspective *page_; // currently selected page
QList<Perspective *> pages_;

// the perspectives are stacked- charts and their associatated controls
QStackedWidget *pstack, *cstack;
BlankStatePage *blank_;

bool loaded;

private slots:
void onIdle();
void onActive();
};

// reads in perspectives
class ViewParser : public QXmlDefaultHandler
{

public:
ViewParser(Context *context) : style(2), context(context) {}

// the results!
QList<Perspective*> perspectives;
int style;

// unmarshall
bool startDocument();
bool endDocument();
bool endElement( const QString&, const QString&, const QString &qName );
bool startElement( const QString&, const QString&, const QString &name, const QXmlAttributes &attrs );
bool characters( const QString& str );

protected:
Context *context;
GcChartWindow *chart;
Perspective *page; // current

};
// we make our own view splitter for the bespoke handle
class ViewSplitter : public QSplitter
{
Expand Down
63 changes: 41 additions & 22 deletions src/Gui/Views.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,19 @@ extern QDesktopWidget *desktop;
AnalysisView::AnalysisView(Context *context, QStackedWidget *controls) : TabView(context, VIEW_ANALYSIS)
{
analSidebar = new AnalysisSidebar(context);
hw = new HomeWindow(context, "analysis", "Activities");
controls->addWidget(hw->controls());
controls->setCurrentIndex(0);
BlankStateAnalysisPage *b = new BlankStateAnalysisPage(context);

setSidebar(analSidebar);
setPage(hw);

// perspectives are stacked
pstack = new QStackedWidget(this);
setPages(pstack);

// each perspective has a stack of controls
cstack = new QStackedWidget(this);
controls->addWidget(cstack);
controls->setCurrentIndex(0);

setBlank(b);
setBottom(new ComparePane(context, this, ComparePane::interval));

Expand All @@ -51,7 +57,7 @@ AnalysisView::AnalysisView(Context *context, QStackedWidget *controls) : TabView

RideNavigator *AnalysisView::rideNavigator()
{
return analSidebar->rideNavigator;
return context->rideNavigator;
}

AnalysisView::~AnalysisView()
Expand Down Expand Up @@ -96,13 +102,17 @@ AnalysisView::isBlank()
DiaryView::DiaryView(Context *context, QStackedWidget *controls) : TabView(context, VIEW_DIARY)
{
diarySidebar = new DiarySidebar(context);
hw = new HomeWindow(context, "diary", "Diary");
controls->addWidget(hw->controls());
controls->setCurrentIndex(0);
BlankStateDiaryPage *b = new BlankStateDiaryPage(context);

setSidebar(diarySidebar);
setPage(hw);

// each perspective has a stack of controls
cstack = new QStackedWidget(this);
controls->addWidget(cstack);
controls->setCurrentIndex(0);

pstack = new QStackedWidget(this);
setPages(pstack);
setBlank(b);

setSidebarEnabled(appsettings->value(this, GC_SETTINGS_MAIN_SIDEBAR "diary", true).toBool());
Expand All @@ -119,15 +129,17 @@ DiaryView::~DiaryView()
void
DiaryView::setRide(RideItem*ride)
{
static_cast<DiarySidebar*>(sidebar())->setRide(ride);
page()->setProperty("ride", QVariant::fromValue<RideItem*>(dynamic_cast<RideItem*>(ride)));
if (loaded) {
static_cast<DiarySidebar*>(sidebar())->setRide(ride);
page()->setProperty("ride", QVariant::fromValue<RideItem*>(dynamic_cast<RideItem*>(ride)));
}
}

void
DiaryView::dateRangeChanged(DateRange dr)
{
//context->notifyDateRangeChanged(dr); // diary view deprecated and not part of navigation model
page()->setProperty("dateRange", QVariant::fromValue<DateRange>(dr));
if (loaded) page()->setProperty("dateRange", QVariant::fromValue<DateRange>(dr));
}

bool
Expand All @@ -140,13 +152,17 @@ DiaryView::isBlank()
HomeView::HomeView(Context *context, QStackedWidget *controls) : TabView(context, VIEW_HOME)
{
sidebar = new LTMSidebar(context);
hw = new HomeWindow(context, "home", "Trends");
controls->addWidget(hw->controls());
controls->setCurrentIndex(0);
BlankStateHomePage *b = new BlankStateHomePage(context);

setSidebar(sidebar);
setPage(hw);

// each perspective has a stack of controls
cstack = new QStackedWidget(this);
controls->addWidget(cstack);
controls->setCurrentIndex(0);

pstack = new QStackedWidget(this);
setPages(pstack);
setBlank(b);
setBottom(new ComparePane(context, this, ComparePane::season));

Expand Down Expand Up @@ -176,7 +192,7 @@ HomeView::dateRangeChanged(DateRange dr)
{
emit dateChanged(dr);
context->notifyDateRangeChanged(dr);
page()->setProperty("dateRange", QVariant::fromValue<DateRange>(dr));
if (loaded) page()->setProperty("dateRange", QVariant::fromValue<DateRange>(dr));
}
bool
HomeView::isBlank()
Expand All @@ -198,14 +214,17 @@ TrainView::TrainView(Context *context, QStackedWidget *controls) : TabView(conte
{
trainTool = new TrainSidebar(context);
trainTool->hide();

hw = new HomeWindow(context, "train", "train");
controls->addWidget(hw->controls());
controls->setCurrentIndex(0);
BlankStateTrainPage *b = new BlankStateTrainPage(context);

setSidebar(trainTool->controls());
setPage(hw);

// each perspective has a stack of controls
cstack = new QStackedWidget(this);
controls->addWidget(cstack);
controls->setCurrentIndex(0);

pstack = new QStackedWidget(this);
setPages(pstack);
setBlank(b);

trainBottom = new TrainBottom(trainTool, this);
Expand Down
8 changes: 4 additions & 4 deletions src/Gui/Views.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class AnalysisView : public TabView

private:
AnalysisSidebar *analSidebar;
HomeWindow *hw;
Perspective *hw;

};

Expand All @@ -70,7 +70,7 @@ class DiaryView : public TabView

private:
DiarySidebar *diarySidebar;
HomeWindow *hw;
Perspective *hw;

};

Expand All @@ -93,7 +93,7 @@ class TrainView : public TabView

TrainSidebar *trainTool;
TrainBottom *trainBottom;
HomeWindow *hw;
Perspective *hw;

private slots:
void onAutoHideChanged(bool enabled);
Expand All @@ -110,7 +110,7 @@ class HomeView : public TabView
~HomeView();

LTMSidebar *sidebar;
HomeWindow *hw;
Perspective *hw;

signals:
void dateChanged(DateRange);
Expand Down
2 changes: 2 additions & 0 deletions src/Python/SIP/Bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1044,6 +1044,8 @@ Bindings::activityMetrics(RideItem* item) const
PyObject* dict = PyDict_New();
if (dict == NULL) return dict;

if (item == NULL) return NULL;

const RideMetricFactory &factory = RideMetricFactory::instance();

//
Expand Down
8 changes: 4 additions & 4 deletions src/src.pro
Original file line number Diff line number Diff line change
Expand Up @@ -687,11 +687,11 @@ HEADERS += ANT/ANTChannel.h ANT/ANT.h ANT/ANTlocalController.h ANT/ANTLogger.h
HEADERS += Charts/Aerolab.h Charts/AerolabWindow.h Charts/AllPlot.h Charts/AllPlotInterval.h Charts/AllPlotSlopeCurve.h \
Charts/AllPlotWindow.h Charts/BlankState.h Charts/ChartBar.h Charts/ChartSettings.h \
Charts/CpPlotCurve.h Charts/CPPlot.h Charts/CriticalPowerWindow.h Charts/DaysScaleDraw.h Charts/ExhaustionDialog.h Charts/GcOverlayWidget.h \
Charts/GcPane.h Charts/GoldenCheetah.h Charts/HistogramWindow.h Charts/HomeWindow.h \
Charts/GcPane.h Charts/GoldenCheetah.h Charts/HistogramWindow.h \
Charts/HrPwPlot.h Charts/HrPwWindow.h Charts/IndendPlotMarker.h Charts/IntervalSummaryWindow.h Charts/LogTimeScaleDraw.h \
Charts/LTMCanvasPicker.h Charts/LTMChartParser.h Charts/LTMOutliers.h Charts/LTMPlot.h Charts/LTMPopup.h \
Charts/LTMSettings.h Charts/LTMTool.h Charts/LTMTrend2.h Charts/LTMTrend.h Charts/LTMWindow.h \
Charts/MetadataWindow.h Charts/MUPlot.h Charts/MUPool.h Charts/MUWidget.h Charts/PfPvPlot.h Charts/PfPvWindow.h \
Charts/MetadataWindow.h Charts/MUPlot.h Charts/MUPool.h Charts/MUWidget.h Charts/PfPvPlot.h Charts/PfPvWindow.h Charts/Perspective.h \
Charts/PowerHist.h Charts/ReferenceLineDialog.h Charts/RideEditor.h Charts/RideMapWindow.h Charts/RideSummaryWindow.h \
Charts/ScatterPlot.h Charts/ScatterWindow.h Charts/SmallPlot.h Charts/SummaryWindow.h Charts/TreeMapPlot.h \
Charts/TreeMapWindow.h Charts/ZoneScaleDraw.h
Expand Down Expand Up @@ -784,11 +784,11 @@ SOURCES += ANT/ANTChannel.cpp ANT/ANT.cpp ANT/ANTlocalController.cpp ANT/ANTLogg
SOURCES += Charts/Aerolab.cpp Charts/AerolabWindow.cpp Charts/AllPlot.cpp Charts/AllPlotInterval.cpp Charts/AllPlotSlopeCurve.cpp \
Charts/AllPlotWindow.cpp Charts/BlankState.cpp Charts/ChartBar.cpp Charts/ChartSettings.cpp \
Charts/CPPlot.cpp Charts/CpPlotCurve.cpp Charts/CriticalPowerWindow.cpp Charts/ExhaustionDialog.cpp Charts/GcOverlayWidget.cpp Charts/GcPane.cpp \
Charts/GoldenCheetah.cpp Charts/HistogramWindow.cpp Charts/HomeWindow.cpp Charts/HrPwPlot.cpp \
Charts/GoldenCheetah.cpp Charts/HistogramWindow.cpp Charts/HrPwPlot.cpp \
Charts/HrPwWindow.cpp Charts/IndendPlotMarker.cpp Charts/IntervalSummaryWindow.cpp Charts/LogTimeScaleDraw.cpp \
Charts/LTMCanvasPicker.cpp Charts/LTMChartParser.cpp Charts/LTMOutliers.cpp Charts/LTMPlot.cpp Charts/LTMPopup.cpp \
Charts/LTMSettings.cpp Charts/LTMTool.cpp Charts/LTMTrend.cpp Charts/LTMWindow.cpp \
Charts/MetadataWindow.cpp Charts/MUPlot.cpp Charts/MUWidget.cpp Charts/PfPvPlot.cpp Charts/PfPvWindow.cpp \
Charts/MetadataWindow.cpp Charts/MUPlot.cpp Charts/MUWidget.cpp Charts/PfPvPlot.cpp Charts/PfPvWindow.cpp Charts/Perspective.cpp \
Charts/PowerHist.cpp Charts/ReferenceLineDialog.cpp Charts/RideEditor.cpp Charts/RideMapWindow.cpp Charts/RideSummaryWindow.cpp \
Charts/ScatterPlot.cpp Charts/ScatterWindow.cpp Charts/SmallPlot.cpp Charts/SummaryWindow.cpp Charts/TreeMapPlot.cpp \
Charts/TreeMapWindow.cpp
Expand Down