diff --git a/src/AllPlotWindow.cpp b/src/AllPlotWindow.cpp index be246459d..952600180 100644 --- a/src/AllPlotWindow.cpp +++ b/src/AllPlotWindow.cpp @@ -459,6 +459,7 @@ AllPlotWindow::AllPlotWindow(Context *context) : connect(context->athlete, SIGNAL(zonesChanged()), this, SLOT(zonesChanged())); connect(context, SIGNAL(intervalsChanged()), this, SLOT(intervalsChanged())); connect(context, SIGNAL(intervalZoom(IntervalItem*)), this, SLOT(zoomInterval(IntervalItem*))); + connect(context, SIGNAL(zoomOut()), this, SLOT(zoomOut())); connect(context, SIGNAL(intervalSelected()), this, SLOT(intervalSelected())); connect(context, SIGNAL(rideDeleted(RideItem*)), this, SLOT(rideDeleted(RideItem*))); @@ -944,6 +945,16 @@ AllPlotWindow::setAllPlotWidgets(RideItem *ride) } } +void +AllPlotWindow::zoomOut() +{ + // set them to maximums to avoid overlapping + // when we set them below, daft but works + spanSlider->setLowerValue(spanSlider->minimum()); + spanSlider->setUpperValue(spanSlider->maximum()); + zoomChanged(); +} + void AllPlotWindow::zoomInterval(IntervalItem *which) { diff --git a/src/AllPlotWindow.h b/src/AllPlotWindow.h index ab468f9b8..59321145a 100644 --- a/src/AllPlotWindow.h +++ b/src/AllPlotWindow.h @@ -140,6 +140,7 @@ class AllPlotWindow : public GcChartWindow // trap widget signals void zoomChanged(); + void zoomOut(); void zoomInterval(IntervalItem *); void moveLeft(); void moveRight(); diff --git a/src/AnalysisSidebar.cpp b/src/AnalysisSidebar.cpp index 00c822c73..7b7f10970 100644 --- a/src/AnalysisSidebar.cpp +++ b/src/AnalysisSidebar.cpp @@ -260,11 +260,8 @@ AnalysisSidebar::intervalPopup() RideItem *rideItem = (RideItem *)context->athlete->treeWidget->selectedItems().first(); if (rideItem != NULL && rideItem->ride() && rideItem->ride()->dataPoints().count()) { - //QAction *actFindPeak = new QAction(tr("Find Peak Intervals"), intervalItem); QAction *actFindBest = new QAction(tr("Find Intervals..."), intervalItem); - //connect(actFindPeak, SIGNAL(triggered(void)), this, SLOT(findPowerPeaks(void))); connect(actFindBest, SIGNAL(triggered(void)), this, SLOT(addIntervals(void))); - //menu.addAction(actFindPeak); menu.addAction(actFindBest); // sort but only if 2 or more intervals @@ -277,6 +274,9 @@ AnalysisSidebar::intervalPopup() if (context->athlete->intervalWidget->selectedItems().count()) menu.addSeparator(); } + QAction *actZoomOut = new QAction(tr("Zoom out"), intervalItem); + connect(actZoomOut, SIGNAL(triggered(void)), this, SLOT(zoomOut(void))); + menu.addAction(actZoomOut); if (context->athlete->intervalWidget->selectedItems().count() == 1) { @@ -318,15 +318,18 @@ AnalysisSidebar::showIntervalMenu(const QPoint &pos) QAction *actEditInt = new QAction(tr("Edit interval"), context->athlete->intervalWidget); QAction *actDeleteInt = new QAction(tr("Delete interval"), context->athlete->intervalWidget); + QAction *actZoomOut = new QAction(tr("Zoom Out"), context->athlete->intervalWidget); QAction *actZoomInt = new QAction(tr("Zoom to interval"), context->athlete->intervalWidget); QAction *actFrontInt = new QAction(tr("Bring to Front"), context->athlete->intervalWidget); QAction *actBackInt = new QAction(tr("Send to back"), context->athlete->intervalWidget); connect(actEditInt, SIGNAL(triggered(void)), this, SLOT(editInterval(void))); connect(actDeleteInt, SIGNAL(triggered(void)), this, SLOT(deleteInterval(void))); + connect(actZoomOut, SIGNAL(triggered(void)), this, SLOT(zoomOut(void))); connect(actZoomInt, SIGNAL(triggered(void)), this, SLOT(zoomInterval(void))); connect(actFrontInt, SIGNAL(triggered(void)), this, SLOT(frontInterval(void))); connect(actBackInt, SIGNAL(triggered(void)), this, SLOT(backInterval(void))); + menu.addAction(actZoomOut); menu.addAction(actZoomInt); menu.addAction(actEditInt); menu.addAction(actDeleteInt); @@ -562,6 +565,12 @@ AnalysisSidebar::zoomIntervalSelected() } } +void +AnalysisSidebar::zoomOut() +{ + context->notifyZoomOut(); // only really used by ride plot +} + void AnalysisSidebar::zoomInterval() { // zoom into this interval on allPlot diff --git a/src/AnalysisSidebar.h b/src/AnalysisSidebar.h index 5cc70c8f5..d01ea91b9 100644 --- a/src/AnalysisSidebar.h +++ b/src/AnalysisSidebar.h @@ -73,6 +73,7 @@ class AnalysisSidebar : public QWidget void editIntervalSelected(); // from menu popup void deleteIntervalSelected(void); // from menu popup void zoomIntervalSelected(void); // from menu popup + void zoomOut(); void frontInterval(); void backInterval(); diff --git a/src/Context.h b/src/Context.h index f51f86d2d..3fb6c6166 100644 --- a/src/Context.h +++ b/src/Context.h @@ -91,6 +91,7 @@ class Context : public QObject void notifyRideAdded(RideItem *x) { ride=x; rideAdded(x); } void notifyRideDeleted(RideItem *x) { ride=x; rideDeleted(x); } void notifyIntervalZoom(IntervalItem*x) { emit intervalZoom(x); } + void notifyZoomOut() { emit zoomOut(); } void notifyIntervalSelected() { intervalSelected(); } void notifyIntervalsChanged() { emit intervalsChanged(); } void notifyRideClean() { rideClean(ride); } @@ -109,6 +110,7 @@ class Context : public QObject void intervalSelected(); void intervalsChanged(); void intervalZoom(IntervalItem*); + void zoomOut(); void rideDirty(RideItem*); void rideClean(RideItem*); diff --git a/src/ReferenceLineDialog.cpp b/src/ReferenceLineDialog.cpp index 1824d4ed5..aa0ec3297 100644 --- a/src/ReferenceLineDialog.cpp +++ b/src/ReferenceLineDialog.cpp @@ -21,8 +21,8 @@ #include "Context.h" #include "RideItem.h" -ReferenceLineDialog::ReferenceLineDialog(AllPlot *parent, Context *context) : - parent(parent), context(context), axis(-1) +ReferenceLineDialog::ReferenceLineDialog(AllPlot *parent, Context *context, bool allowDelete) : + parent(parent), context(context), allowDelete(allowDelete), axis(-1) { setAttribute(Qt::WA_DeleteOnClose); setWindowTitle(tr("Add Reference")); @@ -47,6 +47,9 @@ ReferenceLineDialog::ReferenceLineDialog(AllPlot *parent, Context *context) : buttonLayout->addWidget(cancelButton); mainLayout->addLayout(buttonLayout); + // below that line we will show the existing references + // so they can be deleted + connect(addButton, SIGNAL(clicked()), this, SLOT(addClicked())); connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancelClicked())); } diff --git a/src/ReferenceLineDialog.h b/src/ReferenceLineDialog.h index 92e099d0e..ea5e5d8b1 100644 --- a/src/ReferenceLineDialog.h +++ b/src/ReferenceLineDialog.h @@ -33,7 +33,7 @@ class ReferenceLineDialog : public QDialog public: - ReferenceLineDialog(AllPlot *parent, Context *context); + ReferenceLineDialog(AllPlot *parent, Context *context, bool allowDelete=false); void setValueForAxis(double value, int axis); @@ -44,6 +44,7 @@ class ReferenceLineDialog : public QDialog private: AllPlot *parent; Context *context; + bool allowDelete; QLineEdit *refValue; QLabel *refUnit;