Workout Controls for Train View

Fixes broken controls on train view, so we can now start stop
with the sidebar hidden and also adjust the settings for the
realtime dials on the layout.

Will need to think about saving the properties of the controls
to use last used settings.

Fixes #439.
This commit is contained in:
Mark Liversedge
2011-09-01 20:59:03 +01:00
parent 9a097980c1
commit df6a44ca83
6 changed files with 60 additions and 58 deletions

View File

@@ -73,6 +73,7 @@ GcWindowRegistry GcWindows[] = {
{ "Ride Collection TreeMap",GcWindowTypes::TreeMap },
{ "Weekly Summary",GcWindowTypes::WeeklySummary },
{ "Video Player",GcWindowTypes::VideoPlayer },
{ "Realtime Controls", GcWindowTypes::RealtimeControls },
{ "Realtime Dial",GcWindowTypes::DialWindow },
{ "Realtime Plot",GcWindowTypes::RealtimePlot },
{ "Workout Plot",GcWindowTypes::WorkoutPlot },
@@ -117,6 +118,7 @@ GcWindowRegistry::newGcWindow(GcWinID id, MainWindow *main) //XXX mainWindow wil
#endif
case GcWindowTypes::DialWindow: returning = new DialWindow(main); break;
case GcWindowTypes::MetadataWindow: returning = new MetadataWindow(main); break;
case GcWindowTypes::RealtimeControls: returning = new TrainTool(main, main->home); break;
case GcWindowTypes::RealtimePlot: returning = new RealtimePlotWindow(main); break;
case GcWindowTypes::WorkoutPlot: returning = new WorkoutPlotWindow(main); break;
case GcWindowTypes::BingMap: returning = new BingMap(main); break;

View File

@@ -51,7 +51,8 @@ enum gcwinid {
MetadataWindow = 23,
RealtimePlot = 24,
WorkoutPlot = 25,
BingMap = 26
BingMap = 26,
RealtimeControls = 27
};
};
typedef enum GcWindowTypes::gcwinid GcWinID;

View File

@@ -394,7 +394,7 @@ MainWindow::MainWindow(const QDir &home) :
// TRAIN WINDOW & CONTROLS
trainWindow = new HomeWindow(this, "train", "Training");
trainWindow->controls()->hide();
trainControls->addWidget(new TrainTool(this, this->home));
trainControls->addWidget(trainWindow->controls());
// ANALYSIS WINDOW & CONTRAOLS
analWindow = new HomeWindow(this, "analysis", "Analysis");

View File

@@ -35,16 +35,24 @@
#include "NullController.h"
TrainTool::TrainTool(MainWindow *parent, const QDir &home) : QWidget(parent), home(home), main(parent)
TrainTool::TrainTool(MainWindow *parent, const QDir &home) : GcWindow(parent), home(home), main(parent)
{
QVBoxLayout *mainLayout = new QVBoxLayout(this);
setInstanceName("Train Controls");
mainLayout->setSpacing(0);
mainLayout->setContentsMargins(0,0,0,0);
QWidget *c = new QWidget;
QVBoxLayout *cl = new QVBoxLayout(c);
setControls(c);
QVBoxLayout *mainLayout = new QVBoxLayout(this);
setLayout(mainLayout);
cl->setSpacing(0);
cl->setContentsMargins(0,0,0,0);
//setLineWidth(1);
//setMidLineWidth(0);
//setFrameStyle(QFrame::Plain | QFrame::Sunken);
mainLayout->setSpacing(0);
setContentsMargins(0,0,0,0);
@@ -81,10 +89,12 @@ TrainTool::TrainTool(MainWindow *parent, const QDir &home) : QWidget(parent), ho
buttonPanel = new QFrame;
buttonPanel->setLineWidth(1);
buttonPanel->setFrameStyle(QFrame::Box | QFrame::Raised);
buttonPanel->setFrameStyle(QFrame::NoFrame);
buttonPanel->setContentsMargins(0,0,0,0);
QVBoxLayout *panel = new QVBoxLayout;
panel->setSpacing(0);
QHBoxLayout *buttons = new QHBoxLayout;
buttons->setSpacing(0);
startButton = new QPushButton(tr("Start"), this);
startButton->setMaximumHeight(100);
pauseButton = new QPushButton(tr("Pause"), this);
@@ -101,6 +111,7 @@ TrainTool::TrainTool(MainWindow *parent, const QDir &home) : QWidget(parent), ho
panel->addWidget(recordSelector);
buttonPanel->setLayout(panel);
buttonPanel->setFixedHeight(90);
mainLayout->addWidget(buttonPanel);
trainSplitter = new QSplitter;
trainSplitter->setOrientation(Qt::Vertical);
@@ -108,15 +119,10 @@ TrainTool::TrainTool(MainWindow *parent, const QDir &home) : QWidget(parent), ho
trainSplitter->setLineWidth(0);
trainSplitter->setMidLineWidth(0);
mainLayout->addWidget(trainSplitter);
trainSplitter->addWidget(buttonPanel);
trainSplitter->setCollapsible(0, false);
cl->addWidget(trainSplitter);
trainSplitter->addWidget(deviceTree);
trainSplitter->setCollapsible(1, true);
trainSplitter->addWidget(serverTree);
trainSplitter->setCollapsible(2, true);
trainSplitter->addWidget(workoutTree);
trainSplitter->setCollapsible(3, true);
// handle config changes
connect(serverTree,SIGNAL(itemSelectionChanged()), this, SLOT(serverTreeWidgetSelectionChanged()));

View File

@@ -66,7 +66,7 @@ class NullController;
class RealtimePlot;
class RealtimeData;
class TrainTool : public QWidget
class TrainTool : public GcWindow
{
Q_OBJECT
G_OBJECT

View File

@@ -1,34 +1,46 @@
<layout name="train">
<chart id="25" name="RT Plot" title="Workout" >
<layout name="train" style="2">
<chart id="27" name="Train Controls" title="Controls" >
<property name="instanceName" type="QString" value="Train Controls" />
<property name="title" type="QString" value="Controls" />
<property name="subtitle" type="QString" value="" />
<property name="widthFactor" type="double" value="3.1254" />
<property name="heightFactor" type="double" value="4.91904" />
<property name="resizable" type="bool" value="1" />
</chart>
<chart id="25" name="RT Plot" title="Workout Plot" >
<property name="instanceName" type="QString" value="RT Plot" />
<property name="title" type="QString" value="Workout" />
<property name="widthFactor" type="double" value="1.69427" />
<property name="heightFactor" type="double" value="5.24068" />
<property name="title" type="QString" value="Workout Plot" />
<property name="subtitle" type="QString" value="" />
<property name="widthFactor" type="double" value="1.50215" />
<property name="heightFactor" type="double" value="4.92038" />
<property name="resizable" type="bool" value="1" />
</chart>
<chart id="24" name="RT Plot" title="Realtime" >
<property name="instanceName" type="QString" value="RT Plot" />
<property name="title" type="QString" value="Realtime" />
<property name="subtitle" type="QString" value="" />
<property name="widthFactor" type="double" value="1.00045" />
<property name="heightFactor" type="double" value="1.44235" />
<property name="resizable" type="bool" value="1" />
</chart>
<chart id="22" name="Dial" title="Time" >
<property name="instanceName" type="QString" value="Dial" />
<property name="title" type="QString" value="Time" />
<property name="widthFactor" type="double" value="2.43816" />
<property name="heightFactor" type="double" value="5.03571" />
<property name="subtitle" type="QString" value="" />
<property name="widthFactor" type="double" value="2.98653" />
<property name="heightFactor" type="double" value="8.25536" />
<property name="resizable" type="bool" value="1" />
<property name="showInstant" type="bool" value="0" />
<property name="avgType" type="int" value="4" />
<property name="showInstant" type="bool" value="1" />
<property name="avgType" type="int" value="0" />
<property name="dataSeries" type="int" value="1" />
<property name="style" type="int" value="42092544" />
</chart>
<chart id="24" name="RT Plot" title="Performance" >
<property name="instanceName" type="QString" value="RT Plot" />
<property name="title" type="QString" value="Performance" />
<property name="widthFactor" type="double" value="1" />
<property name="heightFactor" type="double" value="1.54422" />
<property name="resizable" type="bool" value="1" />
<property name="style" type="int" value="0" />
</chart>
<chart id="22" name="Dial" title="Power" >
<property name="instanceName" type="QString" value="Dial" />
<property name="title" type="QString" value="Power" />
<property name="widthFactor" type="double" value="6" />
<property name="heightFactor" type="double" value="6" />
<property name="subtitle" type="QString" value="" />
<property name="widthFactor" type="double" value="6.2459" />
<property name="heightFactor" type="double" value="7.99266" />
<property name="resizable" type="bool" value="1" />
<property name="showInstant" type="bool" value="1" />
<property name="avgType" type="int" value="32634" />
@@ -38,8 +50,9 @@
<chart id="22" name="Dial" title="Cadence" >
<property name="instanceName" type="QString" value="Dial" />
<property name="title" type="QString" value="Cadence" />
<property name="subtitle" type="QString" value="" />
<property name="widthFactor" type="double" value="6" />
<property name="heightFactor" type="double" value="6" />
<property name="heightFactor" type="double" value="8.19063" />
<property name="resizable" type="bool" value="1" />
<property name="showInstant" type="bool" value="1" />
<property name="avgType" type="int" value="0" />
@@ -49,8 +62,9 @@
<chart id="22" name="Dial" title="Heartrate" >
<property name="instanceName" type="QString" value="Dial" />
<property name="title" type="QString" value="Heartrate" />
<property name="subtitle" type="QString" value="" />
<property name="widthFactor" type="double" value="6" />
<property name="heightFactor" type="double" value="6" />
<property name="heightFactor" type="double" value="8.16092" />
<property name="resizable" type="bool" value="1" />
<property name="showInstant" type="bool" value="1" />
<property name="avgType" type="int" value="27263016" />
@@ -60,34 +74,13 @@
<chart id="22" name="Dial" title="Speed" >
<property name="instanceName" type="QString" value="Dial" />
<property name="title" type="QString" value="Speed" />
<property name="subtitle" type="QString" value="" />
<property name="widthFactor" type="double" value="6" />
<property name="heightFactor" type="double" value="6" />
<property name="heightFactor" type="double" value="8.35294" />
<property name="resizable" type="bool" value="1" />
<property name="showInstant" type="bool" value="1" />
<property name="avgType" type="int" value="507" />
<property name="dataSeries" type="int" value="5" />
<property name="style" type="int" value="616" />
</chart>
<chart id="22" name="Dial" title="Energy" >
<property name="instanceName" type="QString" value="Dial" />
<property name="title" type="QString" value="Energy" />
<property name="widthFactor" type="double" value="6" />
<property name="heightFactor" type="double" value="6" />
<property name="resizable" type="bool" value="1" />
<property name="showInstant" type="bool" value="1" />
<property name="avgType" type="int" value="0" />
<property name="dataSeries" type="int" value="11" />
<property name="style" type="int" value="68510928" />
</chart>
<chart id="22" name="Dial" title="BikeScore" >
<property name="instanceName" type="QString" value="Dial" />
<property name="title" type="QString" value="BikeScore" />
<property name="widthFactor" type="double" value="6" />
<property name="heightFactor" type="double" value="6" />
<property name="resizable" type="bool" value="1" />
<property name="showInstant" type="bool" value="0" />
<property name="avgType" type="int" value="0" />
<property name="dataSeries" type="int" value="9" />
<property name="style" type="int" value="3072" />
</chart>
</layout>