From ee55c97b408f27c66165fc77f1a6ac5d06c8bb2b Mon Sep 17 00:00:00 2001 From: Mark Liversedge Date: Fri, 21 Mar 2014 12:38:11 +0000 Subject: [PATCH] Fix CP chart reveal controls on QT5 .. and also remove the yucky labels on the chart in readiness for a CP model widget to overlay and move about the chart. --- src/CpintPlot.cpp | 3 ++- src/CpintPlot.h | 2 +- src/CriticalPowerWindow.cpp | 24 +++++++++++++----------- src/CriticalPowerWindow.h | 2 +- src/GcWindowRegistry.cpp | 2 +- src/HomeWindow.cpp | 3 ++- 6 files changed, 20 insertions(+), 16 deletions(-) diff --git a/src/CpintPlot.cpp b/src/CpintPlot.cpp index 01c7a7752..b6a28af1d 100644 --- a/src/CpintPlot.cpp +++ b/src/CpintPlot.cpp @@ -42,7 +42,8 @@ #include // for std::lower_bound -CpintPlot::CpintPlot(Context *context, QString p, const Zones *zones, bool rangemode) : +CpintPlot::CpintPlot(QWidget *parent, Context *context, QString p, const Zones *zones, bool rangemode) : + QwtPlot(parent), path(p), thisCurve(NULL), CPCurve(NULL), diff --git a/src/CpintPlot.h b/src/CpintPlot.h index 9c7d00b97..1c4c200cb 100644 --- a/src/CpintPlot.h +++ b/src/CpintPlot.h @@ -88,7 +88,7 @@ class CpintPlot : public QwtPlot public: - CpintPlot(Context *, QString path, const Zones *zones, bool rangemode); + CpintPlot(QWidget *parent, Context *, QString path, const Zones *zones, bool rangemode); const QwtPlotCurve *getThisCurve() const { return thisCurve; } const QwtPlotCurve *getCPCurve() const { return CPCurve; } diff --git a/src/CriticalPowerWindow.cpp b/src/CriticalPowerWindow.cpp index ca32b0897..b9583d133 100644 --- a/src/CriticalPowerWindow.cpp +++ b/src/CriticalPowerWindow.cpp @@ -52,8 +52,10 @@ CriticalPowerWindow::CriticalPowerWindow(const QDir &home, Context *context, boo QHBoxLayout *revealLayout = new QHBoxLayout; revealLayout->setContentsMargins(0,0,0,0); - rPercent = new QCheckBox(tr("Percentage of Best")); - rHeat = new QCheckBox("Show Heat"); + rPercent = new QCheckBox(this); + rPercent->setText(tr("Percentage of Best")); + rHeat = new QCheckBox(this); + rHeat->setText(tr("Show Heat")); QVBoxLayout *checks = new QVBoxLayout; checks->addStretch(); @@ -70,15 +72,14 @@ CriticalPowerWindow::CriticalPowerWindow(const QDir &home, Context *context, boo // // main plot area // - QVBoxLayout *vlayout = new QVBoxLayout; - cpintPlot = new CpintPlot(context, home.path(), context->athlete->zones(), rangemode); - vlayout->addWidget(cpintPlot); - - QGridLayout *mainLayout = new QGridLayout(); - mainLayout->addLayout(vlayout, 0, 0); + QVBoxLayout *mainLayout = new QVBoxLayout(); setChartLayout(mainLayout); + cpintPlot = new CpintPlot(this, context, home.path(), context->athlete->zones(), rangemode); + mainLayout->addWidget(cpintPlot); + +#if 0 // // picker - on chart controls/display // @@ -125,7 +126,7 @@ CriticalPowerWindow::CriticalPowerWindow(const QDir &home, Context *context, boo } pcl->addRow(cpintAllLabel, cpintAllValue); pcl->addRow(cpintCPLabel, cpintCPValue); - +#endif // // Chart settings @@ -133,7 +134,6 @@ CriticalPowerWindow::CriticalPowerWindow(const QDir &home, Context *context, boo // controls widget and layout QTabWidget *settingsTabs = new QTabWidget(this); - mainLayout->addWidget(settingsTabs); QWidget *settingsWidget = new QWidget(this); settingsWidget->setContentsMargins(0,0,0,0); @@ -1019,7 +1019,7 @@ CriticalPowerWindow::updateCpint(double minutes) label = QString("%1 %2").arg(value).arg(units); else label = tr("no data"); - cpintTodayValue->setText(label); + //XXXcpintTodayValue->setText(label); } // cp line @@ -1057,6 +1057,7 @@ CriticalPowerWindow::updateCpint(double minutes) void CriticalPowerWindow::cpintTimeValueEntered() { + return; //XXX double minutes = str_to_interval(cpintTimeValue->text()) / 60.0; updateCpint(minutes); } @@ -1064,6 +1065,7 @@ CriticalPowerWindow::cpintTimeValueEntered() void CriticalPowerWindow::pickerMoved(const QPoint &pos) { + return; //XXX double minutes = cpintPlot->invTransform(QwtPlot::xBottom, pos.x()); cpintTimeValue->setText(interval_to_str(60.0*minutes)); updateCpint(minutes); diff --git a/src/CriticalPowerWindow.h b/src/CriticalPowerWindow.h index a2be501e1..4d93d60aa 100644 --- a/src/CriticalPowerWindow.h +++ b/src/CriticalPowerWindow.h @@ -78,7 +78,7 @@ class CriticalPowerWindow : public GcChartWindow public: - CriticalPowerWindow(const QDir &home, Context *context, bool range = false); + CriticalPowerWindow(const QDir &home, Context *context, bool range); // compare is supported bool isCompare() const { diff --git a/src/GcWindowRegistry.cpp b/src/GcWindowRegistry.cpp index 9e40b3abb..3c12d565c 100644 --- a/src/GcWindowRegistry.cpp +++ b/src/GcWindowRegistry.cpp @@ -135,7 +135,7 @@ GcWindowRegistry::newGcWindow(GcWinID id, Context *context) switch(id) { case GcWindowTypes::Aerolab: returning = new AerolabWindow(context); break; case GcWindowTypes::AllPlot: returning = new AllPlotWindow(context); break; - case GcWindowTypes::CriticalPower: returning = new CriticalPowerWindow(context->athlete->home, context); break; + case GcWindowTypes::CriticalPower: returning = new CriticalPowerWindow(context->athlete->home, context, false); break; case GcWindowTypes::CriticalPowerSummary: returning = new CriticalPowerWindow(context->athlete->home, context, true); break; #ifdef GC_HAVE_ICAL case GcWindowTypes::Diary: returning = new DiaryWindow(context); break; diff --git a/src/HomeWindow.cpp b/src/HomeWindow.cpp index 765573b48..54263cc69 100644 --- a/src/HomeWindow.cpp +++ b/src/HomeWindow.cpp @@ -756,7 +756,8 @@ HomeWindow::eventFilter(QObject *object, QEvent *e) } } - //if (e->type() == 2) qDebug()<type(); + // useful for tracking events across the charts + //qDebug()<type(); // we watch the mouse when // dropping charts, to update