Reinstate Lap button

Recent mods to move the realtime controls to the toolbar
managed to lose the Lap function. This patch reinstates it.

Fixes #514.
This commit is contained in:
Mark Liversedge
2011-11-14 22:18:31 +00:00
parent 7e60a930ee
commit 18a0b27cc4
4 changed files with 25 additions and 9 deletions

View File

@@ -151,6 +151,16 @@ TrainTool::TrainTool(MainWindow *parent, const QDir &home) : GcWindow(parent), h
forward->setStyleSheet("background-color: rgba( 255, 255, 255, 0% ); border: 0px;");
toolbuttons->addWidget(forward);
QIcon lapIcon(":images/oxygen/lap.png");
QPushButton *lap = new QPushButton(lapIcon, "", this);
lap->setFocusPolicy(Qt::NoFocus);
lap->setIconSize(QSize(20,20));
lap->setAutoFillBackground(false);
lap->setAutoDefault(false);
lap->setFlat(true);
lap->setStyleSheet("background-color: rgba( 255, 255, 255, 0% ); border: 0px;");
toolbuttons->addWidget(lap);
intensitySlider = new QSlider(Qt::Horizontal, this);
intensitySlider->setAutoFillBackground(false);
intensitySlider->setFocusPolicy(Qt::NoFocus);
@@ -191,6 +201,7 @@ TrainTool::TrainTool(MainWindow *parent, const QDir &home) : GcWindow(parent), h
connect(stop, SIGNAL(clicked()), this, SLOT(Stop()));
connect(forward, SIGNAL(clicked()), this, SLOT(FFwd()));
connect(rewind, SIGNAL(clicked()), this, SLOT(Rewind()));
connect(lap, SIGNAL(clicked()), this, SLOT(newLap()));
connect(intensitySlider, SIGNAL(valueChanged(int)), this, SLOT(adjustIntensity()));
// not used but kept in case re-instated in the future
@@ -887,17 +898,21 @@ void TrainTool::guiUpdate() // refreshes the telemetry
// can be called from the controller - when user presses "Lap" button
void TrainTool::newLap()
{
displayLap++;
if (deviceController == NULL) return;
pwrcount = 0;
cadcount = 0;
hrcount = 0;
spdcount = 0;
if ((status&RT_RUNNING) == RT_RUNNING) {
displayLap++;
lap_time.restart();
lap_elapsed_msec = 0;
pwrcount = 0;
cadcount = 0;
hrcount = 0;
spdcount = 0;
main->notifyNewLap();
lap_time.restart();
lap_elapsed_msec = 0;
main->notifyNewLap();
}
}
// can be called from the controller

View File

@@ -97,7 +97,6 @@ class TrainTool : public GcWindow
// was realtimewindow,merged into tool
// update charts/dials and manage controller
void updateData(RealtimeData &); // to update telemetry by push devices
void newLap(); // start new Lap!
void nextDisplayMode(); // show next display mode
void setDeviceController(); // based upon selected device
void setStreamController(); // based upon selected device
@@ -135,6 +134,7 @@ class TrainTool : public GcWindow
void FFwdLap(); // jump forward to next Lap marker
void Higher(); // set load/gradient higher
void Lower(); // set load/gradient higher
void newLap(); // start new Lap!
// Timed actions
void guiUpdate(); // refreshes the telemetry

View File

@@ -74,6 +74,7 @@
<file>images/oxygen/stop.png</file>
<file>images/oxygen/ffwd.png</file>
<file>images/oxygen/rewind.png</file>
<file>images/oxygen/lap.png</file>
<file>images/toolbar/close-icon.png</file>
<file>images/toolbar/save.png</file>
<file>images/toolbar/search.png</file>

BIN
src/images/oxygen/lap.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB