diff --git a/doc/design/Training Themes v1.1.odt b/doc/design/Training Themes v1.1.odt new file mode 100644 index 000000000..732255903 Binary files /dev/null and b/doc/design/Training Themes v1.1.odt differ diff --git a/src/Gui/GcWindowRegistry.cpp b/src/Gui/GcWindowRegistry.cpp index 790da8f30..1dae04276 100644 --- a/src/Gui/GcWindowRegistry.cpp +++ b/src/Gui/GcWindowRegistry.cpp @@ -60,6 +60,7 @@ #ifdef GC_WANT_R #include "RChart.h" #endif +#include "PlanningWindow.h" // Not until v4.0 //#include "RouteWindow.h" @@ -75,12 +76,13 @@ GcWindowRegistry* GcWindows; void GcWindowRegistry::initialize() { - static GcWindowRegistry GcWindowsInit[31] = { + static GcWindowRegistry GcWindowsInit[32] = { // name GcWinID { VIEW_HOME|VIEW_DIARY, tr("Metric Trends"),GcWindowTypes::LTM }, { VIEW_HOME|VIEW_DIARY, tr("Collection TreeMap"),GcWindowTypes::TreeMap }, //{ VIEW_HOME, tr("Weekly Summary"),GcWindowTypes::WeeklySummary },// DEPRECATED { VIEW_HOME|VIEW_DIARY, tr("Critical Mean Maximal"),GcWindowTypes::CriticalPowerSummary }, + { VIEW_HOME, tr("Training Plan"),GcWindowTypes::SeasonPlan }, //{ VIEW_HOME|VIEW_DIARY, tr("Performance Manager"),GcWindowTypes::PerformanceManager }, { VIEW_ANALYSIS|VIEW_INTERVAL, tr("Activity Summary"),GcWindowTypes::RideSummary }, { VIEW_ANALYSIS, tr("Details"),GcWindowTypes::MetadataWindow }, @@ -237,6 +239,7 @@ GcWindowRegistry::newGcWindow(GcWinID id, Context *context) #else case GcWindowTypes::RouteSegment: returning = new GcChartWindow(context); break; #endif + case GcWindowTypes::SeasonPlan: returning = new PlanningWindow(context); break; default: return NULL; break; } if (returning) returning->setProperty("type", QVariant::fromValue(id)); diff --git a/src/Gui/GcWindowRegistry.h b/src/Gui/GcWindowRegistry.h index 8d4635d5b..863874d66 100644 --- a/src/Gui/GcWindowRegistry.h +++ b/src/Gui/GcWindowRegistry.h @@ -65,7 +65,8 @@ enum gcwinid { WorkoutWindow = 36, RideMapWindow = 37, RConsole = 38, - RConsoleSeason = 39 + RConsoleSeason = 39, + SeasonPlan = 40 }; }; typedef enum GcWindowTypes::gcwinid GcWinID; diff --git a/src/Planning/PlanningWindow.cpp b/src/Planning/PlanningWindow.cpp new file mode 100644 index 000000000..9678777aa --- /dev/null +++ b/src/Planning/PlanningWindow.cpp @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2016 Mark Liversedge (liversedge@gmail.com) + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., 51 + * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#include "PlanningWindow.h" + +PlanningWindow::PlanningWindow(Context *context) : + GcChartWindow(context), context(context) +{ + setContentsMargins(0,0,0,0); + setProperty("color", GColor(CTRENDPLOTBACKGROUND)); + + setControls(NULL); + + QVBoxLayout *main = new QVBoxLayout; + setChartLayout(main); + + connect(context, SIGNAL(configChanged(qint32)), this, SLOT(configChanged(qint32))); + + // set the widgets etc + configChanged(CONFIG_APPEARANCE); +} + +void +PlanningWindow::resizeEvent(QResizeEvent *) +{ + // TBC +} + +void +PlanningWindow::configChanged(qint32) +{ + setProperty("color", GColor(CTRENDPLOTBACKGROUND)); + + // text edit colors + QPalette palette; + palette.setColor(QPalette::Window, GColor(CTRAINPLOTBACKGROUND)); + palette.setColor(QPalette::Background, GColor(CTRAINPLOTBACKGROUND)); + + // only change base if moved away from white plots + // which is a Mac thing +#ifndef Q_OS_MAC + if (GColor(CTRENDPLOTBACKGROUND) != Qt::white) +#endif + { + //palette.setColor(QPalette::Base, GCColor::alternateColor(GColor(CTRAINPLOTBACKGROUND))); + palette.setColor(QPalette::Base, GColor(CTRAINPLOTBACKGROUND)); + palette.setColor(QPalette::Window, GColor(CTRAINPLOTBACKGROUND)); + } + +#ifndef Q_OS_MAC // the scrollers appear when needed on Mac, we'll keep that + //code->setStyleSheet(TabView::ourStyleSheet()); +#endif + + palette.setColor(QPalette::WindowText, GCColor::invertColor(GColor(CTRAINPLOTBACKGROUND))); + palette.setColor(QPalette::Text, GCColor::invertColor(GColor(CTRAINPLOTBACKGROUND))); + //code->setPalette(palette); + repaint(); +} + +bool +PlanningWindow::eventFilter(QObject *obj, QEvent *event) +{ + bool returning = false; + + // we only filter out keyboard shortcuts for undo redo etc + // in the qwkcode editor, anything else is of no interest. + if (event->type() == QEvent::KeyPress) { + + // we care about cmd / ctrl + Qt::KeyboardModifiers kmod = static_cast(event)->modifiers(); + bool ctrl = (kmod & Qt::ControlModifier) != 0; + + switch(static_cast(event)->key()) { + + case Qt::Key_Y: + if (ctrl) { + //workout->redo(); + returning = true; // we grab all key events + } + break; + + case Qt::Key_Z: + if (ctrl) { + //workout->undo(); + returning=true; + } + break; + + } + + } + return returning; +} diff --git a/src/Planning/PlanningWindow.h b/src/Planning/PlanningWindow.h new file mode 100644 index 000000000..836493728 --- /dev/null +++ b/src/Planning/PlanningWindow.h @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2016 Mark Liversedge (liversedge@gmail.com) + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., 51 + * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef _GC_PlanningWindow_h +#define _GC_PlanningWindow_h 1 + +// basics +#include "GoldenCheetah.h" +#include "Settings.h" +#include "Units.h" +#include "Colors.h" +#include "Context.h" + +// trends view +#include "Season.h" // for data series types +#include "TabView.h" // stylesheet for scroller + +// qt +#include + +class PlanningWindow : public GcChartWindow +{ + Q_OBJECT + + public: + + PlanningWindow(Context *context); + + + public slots: + + // trap signals + void configChanged(qint32); + + // show hide toolbar if too small + void resizeEvent(QResizeEvent * event); + + protected: + bool eventFilter(QObject *obj, QEvent *event); + + private: + + Context *context; + +}; + +#endif // _GC_PlanningWindow_h diff --git a/src/gcconfig.pri.in b/src/gcconfig.pri.in index 2cb0b141b..668485d86 100644 --- a/src/gcconfig.pri.in +++ b/src/gcconfig.pri.in @@ -285,5 +285,3 @@ DEFINES += GC_VIDEO_NONE # dont add any video playback support #DEFINES +=GC_CLOUD_DB_BASIC_AUTH= #DEFINES +=GC_CLOUD_DB_APP_NAME= #CloudDB = active - - diff --git a/src/src.pro b/src/src.pro index c40b9b601..4e1ac9036 100644 --- a/src/src.pro +++ b/src/src.pro @@ -79,7 +79,7 @@ lessThan(QT_MAJOR_VERSION, 5) { ###======================================================================= ### Directory Structure - Split into subdirs to be more manageable ###======================================================================= -INCLUDEPATH += ./ANT ./Train ./FileIO ./Cloud ./Charts ./Metrics ./Gui ./Core ./R +INCLUDEPATH += ./ANT ./Train ./FileIO ./Cloud ./Charts ./Metrics ./Gui ./Core ./R ./Planning ###======================================================================= @@ -694,6 +694,9 @@ HEADERS += Metrics/CPSolver.h Metrics/ExtendedCriticalPower.h Metrics/HrZones.h Metrics/PMCData.h Metrics/RideMetadata.h Metrics/RideMetric.h Metrics/SpecialFields.h Metrics/Statistic.h \ Metrics/UserMetricParser.h Metrics/UserMetricSettings.h Metrics/VDOTCalculator.h Metrics/WPrime.h Metrics/Zones.h +## Planning and Compliance +HEADERS += Planning/PlanningWindow.h + # contrib HEADERS += ../qtsolutions/codeeditor/codeeditor.h ../qtsolutions/json/mvjson.h ../qtsolutions/qwtcurve/qwt_plot_gapped_curve.h \ ../qxt/src/qxtspanslider.h ../qxt/src/qxtspanslider_p.h ../qxt/src/qxtstringspinbox.h ../qzip/zipreader.h \ @@ -780,6 +783,9 @@ SOURCES += Metrics/aBikeScore.cpp Metrics/aCoggan.cpp Metrics/AerobicDecoupling. Metrics/TimeInZone.cpp Metrics/TRIMPPoints.cpp Metrics/UserMetric.cpp Metrics/UserMetricParser.cpp Metrics/VDOTCalculator.cpp \ Metrics/VDOT.cpp Metrics/WattsPerKilogram.cpp Metrics/WPrime.cpp Metrics/Zones.cpp +## Planning and Compliance +SOURCES += Planning/PlanningWindow.cpp + ## Contributed solutions SOURCES += ../qtsolutions/codeeditor/codeeditor.cpp ../qtsolutions/json/mvjson.cpp ../qtsolutions/qwtcurve/qwt_plot_gapped_curve.cpp \ ../qxt/src/qxtspanslider.cpp ../qxt/src/qxtstringspinbox.cpp ../qzip/zip.cpp