diff --git a/src/TabView.h b/src/TabView.h index a8845b8dd..0b6fed364 100644 --- a/src/TabView.h +++ b/src/TabView.h @@ -143,21 +143,34 @@ public: QSplitter(orientation, parent), orientation(orientation), name(name), tabView(parent), showForDrag(false) { setAcceptDrops(true); qRegisterMetaType("hpos"); - toggle=NULL; + clearbutton=toggle=NULL; } protected: QSplitterHandle *createHandle() { - return new GcSplitterHandle(name, orientation, NULL, NULL, newtoggle(), this); + return new GcSplitterHandle(name, orientation, newclear(), NULL, newtoggle(), this); } int handleWidth() { return 23; }; + QPushButton *newclear() { + if (clearbutton) delete clearbutton; // we only need one! + clearbutton = new QPushButton("Clear", this); + clearbutton->setCheckable(true); + clearbutton->setChecked(false); + clearbutton->setFixedWidth(60); + clearbutton->setFixedHeight(20); + clearbutton->setFocusPolicy(Qt::NoFocus); + connect(clearbutton, SIGNAL(clicked()), this, SLOT(clearClicked())); + + return clearbutton; + } QPushButton *newtoggle() { if (toggle) delete toggle; // we only need one! toggle = new QPushButton("OFF", this); toggle->setCheckable(true); toggle->setChecked(false); toggle->setFixedWidth(40); + toggle->setFixedHeight(20); toggle->setFocusPolicy(Qt::NoFocus); connect(toggle, SIGNAL(clicked()), this, SLOT(toggled())); @@ -219,6 +232,7 @@ public: signals: void compareChanged(bool); + void compareClear(); public slots: void toggled() { @@ -237,12 +251,17 @@ public slots: // we started compare mode emit compareChanged(toggle->isChecked()); } + + void clearClicked() { + emit compareClear(); + } + private: Qt::Orientation orientation; QString name; TabView *tabView; bool showForDrag; - QPushButton *toggle; + QPushButton *toggle, *clearbutton; }; #endif // _GC_TabView_h diff --git a/src/Views.cpp b/src/Views.cpp index 94e1ccc18..c6402877e 100644 --- a/src/Views.cpp +++ b/src/Views.cpp @@ -39,6 +39,7 @@ AnalysisView::AnalysisView(Context *context, QStackedWidget *controls) : TabView setBottom(new ComparePane(context, this, ComparePane::interval)); connect(bottomSplitter(), SIGNAL(compareChanged(bool)), this, SLOT(compareChanged(bool))); + connect(bottomSplitter(), SIGNAL(compareClear()), bottom(), SLOT(clear())); } RideNavigator *AnalysisView::rideNavigator() @@ -138,6 +139,7 @@ HomeView::HomeView(Context *context, QStackedWidget *controls) : TabView(context connect(s, SIGNAL(dateRangeChanged(DateRange)), this, SLOT(dateRangeChanged(DateRange))); connect(this, SIGNAL(onSelectionChanged()), this, SLOT(justSelected())); connect(bottomSplitter(), SIGNAL(compareChanged(bool)), this, SLOT(compareChanged(bool))); + connect(bottomSplitter(), SIGNAL(compareClear()), bottom(), SLOT(clear())); } HomeView::~HomeView() diff --git a/src/Views.h b/src/Views.h index 306ac6c18..94df60fa9 100644 --- a/src/Views.h +++ b/src/Views.h @@ -101,7 +101,6 @@ class HomeView : public TabView void justSelected(); void dateRangeChanged(DateRange); void compareChanged(bool); - }; #endif // _GC_Views_h