mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-13 16:18:42 +00:00
Visual cue for filter
.. by highlighting chart title too if a filter is being applied. This is important to warn users that the data being plotted is adjusted to the search/filter (either globally or in the chart settings).
This commit is contained in:
@@ -36,7 +36,7 @@
|
||||
#include <QXmlSimpleReader>
|
||||
|
||||
CriticalPowerWindow::CriticalPowerWindow(const QDir &home, MainWindow *parent, bool rangemode) :
|
||||
GcChartWindow(parent), _dateRange("{00000000-0000-0000-0000-000000000001}"), home(home), mainWindow(parent), currentRide(NULL), rangemode(rangemode), stale(true), useCustom(false), useToToday(false)
|
||||
GcChartWindow(parent), _dateRange("{00000000-0000-0000-0000-000000000001}"), home(home), mainWindow(parent), currentRide(NULL), rangemode(rangemode), isfiltered(false), stale(true), useCustom(false), useToToday(false)
|
||||
{
|
||||
setInstanceName("Critical Power Window");
|
||||
|
||||
@@ -239,6 +239,7 @@ CriticalPowerWindow::forceReplot()
|
||||
// rideSelected is easiest way
|
||||
if (amVisible()) rideSelected();
|
||||
}
|
||||
repaint();
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -71,6 +71,7 @@ class CriticalPowerWindow : public GcChartWindow
|
||||
|
||||
#ifdef GC_HAVE_LUCENE
|
||||
// filter
|
||||
bool isFiltered() const { return (searchBox->isFiltered() || mainWindow->isfiltered); }
|
||||
QString filter() const { return searchBox->filter(); }
|
||||
void setFilter(QString x) { searchBox->setFilter(x); }
|
||||
#endif
|
||||
@@ -162,6 +163,7 @@ class CriticalPowerWindow : public GcChartWindow
|
||||
#endif
|
||||
|
||||
bool rangemode;
|
||||
bool isfiltered;
|
||||
QDate cfrom, cto;
|
||||
bool stale;
|
||||
bool useCustom;
|
||||
|
||||
@@ -53,6 +53,10 @@ class DiaryWindow : public GcWindow
|
||||
int view() const { return 0; /* viewMode->currentIndex(); */ }
|
||||
void setView(int /* x */ ) { /* viewMode->setCurrentIndex(x); */ }
|
||||
|
||||
#ifdef GC_HAVE_LUCENE
|
||||
bool isFiltered() const { return mainWindow->isfiltered; }
|
||||
#endif
|
||||
|
||||
public slots:
|
||||
void rideSelected();
|
||||
void configChanged();
|
||||
|
||||
@@ -283,6 +283,14 @@ GcWindow::paintEvent(QPaintEvent * /*event*/)
|
||||
painter.setPen(fgColor);
|
||||
painter.drawText(bar, heading, Qt::AlignVCenter | Qt::AlignCenter);
|
||||
|
||||
if (isFiltered()) {
|
||||
// overlay in highlight color
|
||||
QColor over = GColor(CCALCURRENT);
|
||||
over.setAlpha(220);
|
||||
painter.setPen(over);
|
||||
painter.drawText(bar, heading, Qt::AlignVCenter | Qt::AlignCenter);
|
||||
}
|
||||
|
||||
// border
|
||||
painter.setBrush(Qt::NoBrush);
|
||||
if (underMouse()) {
|
||||
|
||||
@@ -171,6 +171,9 @@ public:
|
||||
virtual void unreveal() {}
|
||||
bool revealed;
|
||||
|
||||
// is filtered?
|
||||
virtual bool isFiltered() const { return false;}
|
||||
|
||||
// for sorting... we look at x
|
||||
bool operator< (GcWindow right) const { return geometry().x() < right.geometry().x(); }
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ HistogramWindow::HistogramWindow(MainWindow *mainWindow, bool rangemode) : GcCha
|
||||
|
||||
#ifdef GC_HAVE_LUCENE
|
||||
// search filter box
|
||||
isFiltered = false;
|
||||
isfiltered = false;
|
||||
searchBox = new SearchFilterBox(this, mainWindow);
|
||||
connect(searchBox, SIGNAL(searchClear()), this, SLOT(clearFilter()));
|
||||
connect(searchBox, SIGNAL(searchResults(QStringList)), this, SLOT(setFilter(QStringList)));
|
||||
@@ -840,7 +840,7 @@ HistogramWindow::updateChart()
|
||||
// plotting a data series, so refresh the ridefilecache
|
||||
|
||||
#ifdef GC_HAVE_LUCENE
|
||||
source = new RideFileCache(mainWindow, use.from, use.to, isFiltered, files);
|
||||
source = new RideFileCache(mainWindow, use.from, use.to, isfiltered, files);
|
||||
#else
|
||||
source = new RideFileCache(mainWindow, use.from, use.to);
|
||||
#endif
|
||||
@@ -884,7 +884,7 @@ HistogramWindow::updateChart()
|
||||
powerHist->setSeries(RideFile::none);
|
||||
powerHist->setDelta(getDelta());
|
||||
powerHist->setDigits(getDigits());
|
||||
powerHist->setData(results, totalMetric(), distMetric(), isFiltered, files);
|
||||
powerHist->setData(results, totalMetric(), distMetric(), isfiltered, files);
|
||||
powerHist->setColor(colorButton->getColor());
|
||||
|
||||
}
|
||||
@@ -922,19 +922,21 @@ HistogramWindow::updateChart()
|
||||
void
|
||||
HistogramWindow::clearFilter()
|
||||
{
|
||||
isFiltered = false;
|
||||
isfiltered = false;
|
||||
files.clear();
|
||||
stale = true;
|
||||
updateChart();
|
||||
repaint();
|
||||
}
|
||||
|
||||
void
|
||||
HistogramWindow::setFilter(QStringList list)
|
||||
{
|
||||
isFiltered = true;
|
||||
isfiltered = true;
|
||||
files = list;
|
||||
stale = true;
|
||||
updateChart();
|
||||
repaint();
|
||||
}
|
||||
|
||||
double
|
||||
|
||||
@@ -86,6 +86,8 @@ class HistogramWindow : public GcChartWindow
|
||||
bool zoned() const { return showInZones->isChecked(); }
|
||||
void setZoned(bool x) { return showInZones->setChecked(x); }
|
||||
#ifdef GC_HAVE_LUCENE
|
||||
bool isFiltered() const { if (rangemode) return (isfiltered || mainWindow->isfiltered);
|
||||
else return false; }
|
||||
QString filter() const { return searchBox->filter(); }
|
||||
void setFilter(QString x) { searchBox->setFilter(x); }
|
||||
#endif
|
||||
@@ -190,7 +192,7 @@ class HistogramWindow : public GcChartWindow
|
||||
bool interval;
|
||||
#ifdef GC_HAVE_LUCENE
|
||||
SearchFilterBox *searchBox;
|
||||
bool isFiltered;
|
||||
bool isfiltered;
|
||||
QStringList files;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -221,6 +221,7 @@ LTMWindow::refresh()
|
||||
measures.clear(); // clear any old data
|
||||
measures = main->metricDB->getAllMeasuresFor(settings.start, settings.end);
|
||||
refreshPlot();
|
||||
repaint(); // title changes color when filters change
|
||||
dirty = false;
|
||||
} else {
|
||||
dirty = true;
|
||||
|
||||
@@ -108,8 +108,13 @@ class LTMWindow : public GcChartWindow
|
||||
~LTMWindow();
|
||||
LTMToolTip *toolTip() { return picker; }
|
||||
|
||||
// reveal
|
||||
// reveal / filters
|
||||
bool hasReveal() { return true; }
|
||||
#ifdef GC_HAVE_LUCENE
|
||||
bool isFiltered() const { return (ltmTool->isFiltered() || main->isfiltered); }
|
||||
#else
|
||||
bool isFiltered() const { return ;}
|
||||
#endif
|
||||
|
||||
// used by children
|
||||
MainWindow *main;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
|
||||
PerformanceManagerWindow::PerformanceManagerWindow(MainWindow *mainWindow) :
|
||||
GcWindow(mainWindow), mainWindow(mainWindow), active(false)
|
||||
GcWindow(mainWindow), mainWindow(mainWindow), active(false), isfiltered(false)
|
||||
{
|
||||
setInstanceName("PM Window");
|
||||
setControls(NULL);
|
||||
@@ -111,6 +111,7 @@ PerformanceManagerWindow::PerformanceManagerWindow(MainWindow *mainWindow) :
|
||||
connect(mainWindow, SIGNAL(configChanged()), perfplot, SLOT(configUpdate()));
|
||||
connect(mainWindow, SIGNAL(rideAdded(RideItem*)), this, SLOT(replot()));
|
||||
connect(mainWindow, SIGNAL(rideDeleted(RideItem*)), this, SLOT(replot()));
|
||||
connect(mainWindow, SIGNAL(filterChanged(QStringList&)), this, SLOT(filterChanged(QStringList&)));
|
||||
//connect(mainWindow, SIGNAL(rideSelected()), this, SLOT(rideSelected()));
|
||||
connect(this, SIGNAL(rideItemChanged(RideItem*)), this, SLOT(rideSelected()));
|
||||
}
|
||||
@@ -121,6 +122,18 @@ PerformanceManagerWindow::~PerformanceManagerWindow()
|
||||
delete sc;
|
||||
}
|
||||
|
||||
#ifdef GC_HAVE_LUCENE
|
||||
void
|
||||
PerformanceManagerWindow::filterChanged(QStringList &list)
|
||||
{
|
||||
filter = list;
|
||||
isfiltered = mainWindow->isfiltered;
|
||||
days = 0; // force it
|
||||
replot();
|
||||
repaint();
|
||||
}
|
||||
#endif
|
||||
|
||||
void PerformanceManagerWindow::configChanged()
|
||||
{
|
||||
if (active) {
|
||||
@@ -195,8 +208,11 @@ void PerformanceManagerWindow::replot()
|
||||
endTime,
|
||||
(appsettings->cvalue(mainWindow->cyclist, GC_STS_DAYS,7)).toInt(),
|
||||
(appsettings->cvalue(mainWindow->cyclist, GC_LTS_DAYS,42)).toInt());
|
||||
|
||||
#ifdef GC_HAVE_LUCENE
|
||||
sc->calculateStress(mainWindow,home.absolutePath(),newMetric,isfiltered,filter);
|
||||
#else
|
||||
sc->calculateStress(mainWindow,home.absolutePath(),newMetric);
|
||||
#endif
|
||||
|
||||
perfplot->setStressCalculator(sc);
|
||||
|
||||
@@ -241,6 +257,7 @@ void PerformanceManagerWindow::replot()
|
||||
}
|
||||
perfplot->plot();
|
||||
}
|
||||
repaint();
|
||||
}
|
||||
|
||||
// performance manager picker callback
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#ifndef _GC_PerformanceManagerWindow_h
|
||||
#define _GC_PerformanceManagerWindow_h 1
|
||||
#include "GoldenCheetah.h"
|
||||
#include "MainWindow.h"
|
||||
|
||||
#include <QtGui>
|
||||
#include <QSlider>
|
||||
@@ -29,7 +30,6 @@
|
||||
|
||||
|
||||
class AllPlot;
|
||||
class MainWindow;
|
||||
class QwtPlotPanner;
|
||||
class QwtPlotZoomer;
|
||||
class QSlider;
|
||||
@@ -53,6 +53,10 @@ class PerformanceManagerWindow : public GcWindow
|
||||
int scheme() const { return metricCombo->currentIndex(); }
|
||||
void setScheme(int x) const { metricCombo->setCurrentIndex(x); }
|
||||
|
||||
#ifdef GC_HAVE_LUCENE
|
||||
bool isFiltered() const { return isfiltered; }
|
||||
#endif
|
||||
|
||||
public slots:
|
||||
|
||||
void PMpickerMoved(const QPoint &pos);
|
||||
@@ -62,6 +66,10 @@ class PerformanceManagerWindow : public GcWindow
|
||||
void metricChanged();
|
||||
void rideSelected();
|
||||
|
||||
#ifdef GC_HAVE_LUCENE
|
||||
void filterChanged(QStringList&);
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
||||
int days, count;
|
||||
@@ -83,6 +91,8 @@ class PerformanceManagerWindow : public GcWindow
|
||||
QSharedPointer<QSettings> settings;
|
||||
|
||||
void setPMSliderDates();
|
||||
QStringList filter;
|
||||
bool isfiltered;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -69,6 +69,8 @@ class RideSummaryWindow : public GcChartWindow
|
||||
int prevN() { return dateSetting->prevN(); }
|
||||
void setPrevN(int x) { dateSetting->setPrevN(x); }
|
||||
#ifdef GC_HAVE_LUCENE
|
||||
bool isFiltered() const { if (!ridesummary) return (filtered || mainWindow->isfiltered);
|
||||
else return false; }
|
||||
// filter
|
||||
QString filter() const { return ridesummary ? "" : searchBox->filter(); }
|
||||
void setFilter(QString x) { if (!ridesummary) searchBox->setFilter(x); }
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include <QDebug>
|
||||
|
||||
SearchBox::SearchBox(MainWindow *main, QWidget *parent)
|
||||
: QLineEdit(parent), main(main)
|
||||
: QLineEdit(parent), main(main), filtered(false)
|
||||
{
|
||||
setFixedHeight(21);
|
||||
//clear button
|
||||
@@ -164,6 +164,7 @@ void SearchBox::searchSubmit()
|
||||
{
|
||||
// return hit / key pressed
|
||||
if (text() != "") {
|
||||
filtered = true;
|
||||
mode == Search ? submitQuery(text()) : submitFilter(text());
|
||||
}
|
||||
}
|
||||
@@ -171,6 +172,7 @@ void SearchBox::searchSubmit()
|
||||
void SearchBox::clearClicked()
|
||||
{
|
||||
setText("");
|
||||
filtered = false;
|
||||
//mode == Search ? clearQuery() : clearFilter();
|
||||
setGood();
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ public:
|
||||
void setMode(SearchBoxMode mode);
|
||||
void setText(QString);
|
||||
SearchBoxMode getMode() { return mode; }
|
||||
bool isFiltered() const { return filtered; }
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *);
|
||||
@@ -78,6 +79,7 @@ signals:
|
||||
|
||||
private:
|
||||
MainWindow *main;
|
||||
bool filtered;
|
||||
QToolButton *clearButton, *searchButton, *toolButton;
|
||||
QMenu *dropMenu;
|
||||
SearchBoxMode mode;
|
||||
|
||||
@@ -35,6 +35,7 @@ public:
|
||||
|
||||
QString filter();
|
||||
void setFilter(QString); // filter:text or search:text
|
||||
bool isFiltered() const { return searchbox->isFiltered(); }
|
||||
|
||||
private slots:
|
||||
|
||||
|
||||
@@ -237,6 +237,7 @@ TreeMapWindow::refresh()
|
||||
|
||||
refreshPlot();
|
||||
}
|
||||
repaint(); // get title repainted
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -66,6 +66,9 @@ class TreeMapWindow : public GcWindow
|
||||
TreeMapWindow(MainWindow *, bool, const QDir &);
|
||||
~TreeMapWindow();
|
||||
|
||||
#ifdef GC_HAVE_LUCENE
|
||||
bool isFiltered() const { return main->isfiltered; }
|
||||
#endif
|
||||
QString f1() const { return field1->currentText(); }
|
||||
void setf1(QString x) const { field1->setCurrentIndex(field1->findText(x)); }
|
||||
QString f2() const { return field2->currentText(); }
|
||||
|
||||
Reference in New Issue
Block a user