Ride editor and tools

A new tab 'Editor' for manually editing ride file data points and
associated menu options under 'Tools' for fixing spikes, gaps, GPS
errors and adjusting torque values. A revert to saved ride option
is also included to 'undo' all changes.

The ride editor supports undo/redo as well as cut and paste and
"paste special" (to append points or swap columns/overwrite
selected data series). The editor also supports search and will
automatically highlight anomalous data.

When a file is saved, the changes are recorded in a new metadata
special field called "Change History" which can be added as a
Textbox in the metadata config.

The data processors can be run manually or automatically when a
ride is opened - these are configured on the ride data tab in
the config pane.

Significant changes have been introduced in the codebase, the most
significant of which are; a RideFileCommand class for modifying
ride data has been introduced (as a member of RideFile) and the
RideItem class is now a QObject as well as QTreeWidgetItem to
enable signalling. The Ride Editor uses a RideFileTableModel that
can be re-used in other parts of the code. LTMoutliers class has been
introduced in support of anomaly detection in the editor (which
highlights anomalies with a wiggly red line).

Fixes #103.
This commit is contained in:
Mark Liversedge
2010-07-17 14:33:39 +01:00
parent 8569f812a6
commit cd3bbc4e64
41 changed files with 5314 additions and 54 deletions

View File

@@ -16,6 +16,7 @@
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <QTreeWidgetItem>
#include "RideItem.h"
#include "RideMetric.h"
#include "RideFile.h"
@@ -27,7 +28,7 @@
RideItem::RideItem(int type,
QString path, QString fileName, const QDateTime &dateTime,
const Zones *zones, QString notesFileName, MainWindow *main) :
QTreeWidgetItem(type), ride_(NULL), main(main), isdirty(false), path(path), fileName(fileName),
QTreeWidgetItem(type), ride_(NULL), main(main), isdirty(false), isedit(false), path(path), fileName(fileName),
dateTime(dateTime), zones(zones), notesFileName(notesFileName)
{
setText(0, dateTime.toString("ddd"));
@@ -44,11 +45,43 @@ RideFile *RideItem::ride()
// open the ride file
QFile file(path + "/" + fileName);
ride_ = RideFileFactory::instance().openRideFile(file, errors_);
setDirty(false); // we're gonna use on-disk so by
// definition it is clean - but do it *after*
// we read the file since it will almost
// certainly be referenced by consuming widgets
// stay aware of state changes to our ride
// MainWindow saves and RideFileCommand modifies
connect(ride_, SIGNAL(modified()), this, SLOT(modified()));
connect(ride_, SIGNAL(saved()), this, SLOT(saved()));
connect(ride_, SIGNAL(reverted()), this, SLOT(reverted()));
return ride_;
}
void
RideItem::modified()
{
setDirty(true);
}
void
RideItem::saved()
{
setDirty(false);
}
void
RideItem::reverted()
{
setDirty(false);
}
void
RideItem::setDirty(bool val)
{
if (isdirty == val) return; // np change
isdirty = val;
if (isdirty == true) {
@@ -60,6 +93,8 @@ RideItem::setDirty(bool val)
setFont(i, current);
}
main->notifyRideDirty();
} else {
// show ride in normal on the list view
@@ -68,6 +103,8 @@ RideItem::setDirty(bool val)
current.setWeight(QFont::Normal);
setFont(i, current);
}
main->notifyRideClean();
}
}