mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-04-15 05:32:21 +00:00
BlankState: Analysis view more blanks
- Better handling of a NULL ride for most of the analysis charts - Don't show activity editor if no data rows to edit
This commit is contained in:
@@ -234,8 +234,8 @@ CriticalPowerWindow::newRideAdded(RideItem *here)
|
||||
void
|
||||
CriticalPowerWindow::rideSelected()
|
||||
{
|
||||
if (!amVisible())
|
||||
return;
|
||||
if (!amVisible()) return;
|
||||
|
||||
currentRide = myRideItem;
|
||||
if (currentRide) {
|
||||
cpintPlot->calculate(currentRide);
|
||||
@@ -244,6 +244,10 @@ CriticalPowerWindow::rideSelected()
|
||||
picker->setRubberBandPen(GColor(CPLOTTRACKER));
|
||||
cpintSetCPButton->setEnabled(cpintPlot->cp > 0);
|
||||
rCpintSetCPButton->setEnabled(cpintPlot->cp > 0);
|
||||
|
||||
setIsBlank(false);
|
||||
} else if (!rangemode) {
|
||||
setIsBlank(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -66,9 +66,14 @@ GoogleMapControl::GoogleMapControl(MainWindow *mw) : GcChartWindow(mw), main(mw)
|
||||
void
|
||||
GoogleMapControl::rideSelected()
|
||||
{
|
||||
// skip display if data drawn or invalid
|
||||
if (myRideItem == NULL || !amVisible()) return;
|
||||
RideItem * ride = myRideItem;
|
||||
|
||||
// set/unset blank then decide what to do next
|
||||
if (!ride || !ride->ride() || !ride->ride()->dataPoints().count()) setIsBlank(true);
|
||||
else setIsBlank(false);
|
||||
|
||||
// skip display if data already drawn or invalid
|
||||
if (myRideItem == NULL || !amVisible()) return;
|
||||
if (ride == current || !ride || !ride->ride()) return;
|
||||
else current = ride;
|
||||
|
||||
|
||||
@@ -19,14 +19,14 @@
|
||||
#include "MetadataWindow.h"
|
||||
|
||||
MetadataWindow::MetadataWindow(MainWindow *mainWindow) :
|
||||
GcWindow(mainWindow), mainWindow(mainWindow)
|
||||
GcChartWindow(mainWindow), mainWindow(mainWindow)
|
||||
{
|
||||
setInstanceName("Metadata Window");
|
||||
setControls(NULL);
|
||||
setRideItem(NULL);
|
||||
setContentsMargins(0,0,0,0);
|
||||
|
||||
QVBoxLayout *vlayout = new QVBoxLayout(this);
|
||||
QVBoxLayout *vlayout = new QVBoxLayout;
|
||||
vlayout->setSpacing(0);
|
||||
rideMetadata = new RideMetadata(mainWindow);
|
||||
QFont font;
|
||||
@@ -34,6 +34,7 @@ MetadataWindow::MetadataWindow(MainWindow *mainWindow) :
|
||||
rideMetadata->setFont(font);
|
||||
rideMetadata->setContentsMargins(0,0,0,0);
|
||||
vlayout->addWidget(rideMetadata);
|
||||
setChartLayout(vlayout);
|
||||
|
||||
connect(this, SIGNAL(rideItemChanged(RideItem*)), this, SLOT(rideItemChanged()));
|
||||
}
|
||||
@@ -42,4 +43,6 @@ void
|
||||
MetadataWindow::rideItemChanged()
|
||||
{
|
||||
rideMetadata->setProperty("ride", property("ride"));
|
||||
if (myRideItem) setIsBlank(false);
|
||||
else setIsBlank(true);
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
class MainWindow;
|
||||
|
||||
class MetadataWindow : public GcWindow
|
||||
class MetadataWindow : public GcChartWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
G_OBJECT
|
||||
|
||||
@@ -204,9 +204,6 @@ PfPvWindow::rideSelected()
|
||||
|
||||
|
||||
RideItem *ride = myRideItem;
|
||||
if (ride == current)
|
||||
return;
|
||||
|
||||
if (!ride || !ride->ride() || !ride->ride()->isDataPresent(RideFile::watts) || !ride->ride()->isDataPresent(RideFile::cad)) {
|
||||
setIsBlank(true);
|
||||
current = NULL;
|
||||
@@ -216,6 +213,8 @@ PfPvWindow::rideSelected()
|
||||
setIsBlank(false);
|
||||
}
|
||||
|
||||
if (ride == current) return;
|
||||
|
||||
pfPvPlot->setData(ride);
|
||||
|
||||
current = ride;
|
||||
|
||||
@@ -53,14 +53,15 @@ static void secsMsecs(double value, int &secs, int &msecs)
|
||||
msecs = round((value - secs) * 100) * 10;
|
||||
}
|
||||
|
||||
RideEditor::RideEditor(MainWindow *main) : GcWindow(main), data(NULL), ride(NULL), main(main), inLUW(false), colMapper(NULL)
|
||||
RideEditor::RideEditor(MainWindow *main) : GcChartWindow(main), data(NULL), ride(NULL), main(main), inLUW(false), colMapper(NULL)
|
||||
{
|
||||
setInstanceName("Ride Editor");
|
||||
setControls(NULL);
|
||||
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout(this);
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
||||
mainLayout->setSpacing(0);
|
||||
mainLayout->setContentsMargins(2,0,2,2);
|
||||
setChartLayout(mainLayout);
|
||||
|
||||
//Left in the code to display a title, but
|
||||
//its a waste of screen estate, maybe uncomment
|
||||
@@ -702,13 +703,10 @@ void
|
||||
RideEditor::delRow()
|
||||
{
|
||||
// run through the selected rows and zap them
|
||||
bool changed = false;
|
||||
QList<QModelIndex> selection = table->selectionModel()->selection().indexes();
|
||||
|
||||
if (selection.count() > 0) {
|
||||
|
||||
changed = true;
|
||||
|
||||
// delete from table - we do in one hit since row-by-row is VERY slow
|
||||
ride->ride()->command->startLUW("Delete Rows");
|
||||
model->removeRows(selection[0].row(),
|
||||
@@ -722,13 +720,10 @@ void
|
||||
RideEditor::delColumn()
|
||||
{
|
||||
// run through the selected columns and "zap" them
|
||||
bool changed = false;
|
||||
QList<QModelIndex> selection = table->selectionModel()->selection().indexes();
|
||||
|
||||
if (selection.count() > 0) {
|
||||
|
||||
changed = true;
|
||||
|
||||
// Delete each column by its SeriesType
|
||||
ride->ride()->command->startLUW("Delete Columns");
|
||||
for(int column = selection.first().column(),
|
||||
@@ -918,12 +913,9 @@ RideEditor::pasteSpecial()
|
||||
void
|
||||
RideEditor::clear()
|
||||
{
|
||||
bool changed = false;
|
||||
|
||||
// Set the selected cells to zero
|
||||
ride->ride()->command->startLUW("Clear cells");
|
||||
foreach (QModelIndex current, table->selectionModel()->selection().indexes()) {
|
||||
changed = true;
|
||||
setModelValue(current.row(), current.column(), (double)0.0);
|
||||
}
|
||||
ride->ride()->command->endLUW();
|
||||
@@ -1146,14 +1138,17 @@ RideEditor::rideSelected()
|
||||
anomalyTool->hide();
|
||||
|
||||
RideItem *current = myRideItem;
|
||||
if (!current || !current->ride()) {
|
||||
if (!current || !current->ride() || !current->ride()->dataPoints().count()) {
|
||||
model->setRide(NULL);
|
||||
if (data) {
|
||||
delete data;
|
||||
data = NULL;
|
||||
}
|
||||
setIsBlank(true);
|
||||
findTool->rideSelected();
|
||||
return;
|
||||
} else {
|
||||
setIsBlank(false);
|
||||
}
|
||||
|
||||
ride = current;
|
||||
|
||||
@@ -34,7 +34,7 @@ class FindDialog;
|
||||
class AnomalyDialog;
|
||||
class PasteSpecialDialog;
|
||||
|
||||
class RideEditor : public GcWindow
|
||||
class RideEditor : public GcChartWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
G_OBJECT
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#include <math.h>
|
||||
|
||||
RideSummaryWindow::RideSummaryWindow(MainWindow *mainWindow, bool ridesummary) :
|
||||
GcWindow(mainWindow), mainWindow(mainWindow), ridesummary(ridesummary), useCustom(false), useToToday(false)
|
||||
GcChartWindow(mainWindow), mainWindow(mainWindow), ridesummary(ridesummary), useCustom(false), useToToday(false)
|
||||
{
|
||||
setInstanceName("Ride Summary Window");
|
||||
setRideItem(NULL);
|
||||
@@ -90,7 +90,7 @@ RideSummaryWindow::RideSummaryWindow(MainWindow *mainWindow, bool ridesummary) :
|
||||
connect(dateSetting, SIGNAL(useStandardRange()), this, SLOT(useStandardRange()));
|
||||
|
||||
}
|
||||
setLayout(vlayout);
|
||||
setChartLayout(vlayout);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -111,7 +111,10 @@ RideSummaryWindow::rideItemChanged()
|
||||
if (_connected) { // in case it was set to null!
|
||||
connect (_connected, SIGNAL(rideMetadataChanged()), this, SLOT(metadataChanged()));
|
||||
// and now refresh
|
||||
setIsBlank(false);
|
||||
refresh();
|
||||
} else {
|
||||
setIsBlank(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include "SummaryMetrics.h"
|
||||
|
||||
|
||||
class RideSummaryWindow : public GcWindow
|
||||
class RideSummaryWindow : public GcChartWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
G_OBJECT
|
||||
|
||||
Reference in New Issue
Block a user