UI Nits: GcChartWindow for PfPvWindow and HrPwWindow

This commit is contained in:
Damien
2013-01-28 21:38:28 +01:00
parent b3f3974998
commit 260d0965e8
5 changed files with 17 additions and 81 deletions

View File

@@ -724,6 +724,8 @@ GcChartWindow::GcChartWindow(QWidget *parent) : GcWindow(parent) {
_unrevealTimer = new QTimer();
connect(_unrevealTimer, SIGNAL(timeout()), this, SLOT(hideRevealControls()));
_revealControls->hide();
_mainLayout->addWidget(_revealControls,0,0, Qt::AlignTop);
_mainWidget->setLayout(_mainLayout);
}

View File

@@ -31,43 +31,20 @@
// tooltip
HrPwWindow::HrPwWindow(MainWindow *mainWindow) :
GcWindow(mainWindow), mainWindow(mainWindow), current(NULL)
GcChartWindow(mainWindow), mainWindow(mainWindow), current(NULL)
{
setControls(NULL);
setInstanceName("HrPw");
// Main layout
QGridLayout *mainLayout = new QGridLayout(this);
mainLayout->setContentsMargins(2,2,2,2);
//
// reveal controls widget
//
// reveal widget
revealControls = new QWidget(this);
revealControls->setFixedHeight(50);
revealControls->setStyleSheet("background-color: rgba(100%, 100%, 100%, 100%)");
revealControls->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
revealAnim = new QPropertyAnimation(revealControls, "pos");
revealAnim->setDuration(500);
revealAnim->setEasingCurve(QEasingCurve(QEasingCurve::InSine));
revealAnim->setKeyValueAt(0,QPoint(2,-50));
revealAnim->setKeyValueAt(0.5,QPoint(2,15));
revealAnim->setKeyValueAt(1,QPoint(2,20));
unrevealAnim = new QPropertyAnimation(revealControls, "pos");
unrevealAnim->setDuration(500);
unrevealAnim->setKeyValueAt(0,QPoint(2,20));
unrevealAnim->setKeyValueAt(0.5,QPoint(2,15));
unrevealAnim->setKeyValueAt(1,QPoint(2,-50));
// reveal controls
rDelay = new QLabel(tr("HR Delay"), revealControls);
rDelayEdit = new QLineEdit(revealControls);
rDelay = new QLabel(tr("HR Delay"));
rDelayEdit = new QLineEdit();
rDelayEdit->setFixedWidth(30);
rDelaySlider = new QSlider(Qt::Horizontal, revealControls);
rDelaySlider = new QSlider(Qt::Horizontal);
rDelaySlider->setTickPosition(QSlider::TicksBelow);
rDelaySlider->setTickInterval(10);
rDelaySlider->setMinimum(1);
@@ -75,10 +52,10 @@ HrPwWindow::HrPwWindow(MainWindow *mainWindow) :
rDelayEdit->setValidator(new QIntValidator(rDelaySlider->minimum(),
rDelaySlider->maximum(),
rDelayEdit));
rSmooth = new QLabel(tr("Smooth"), revealControls);
rSmoothEdit = new QLineEdit(revealControls);
rSmooth = new QLabel(tr("Smooth"));
rSmoothEdit = new QLineEdit();
rSmoothEdit->setFixedWidth(30);
rSmoothSlider = new QSlider(Qt::Horizontal, revealControls);
rSmoothSlider = new QSlider(Qt::Horizontal);
rSmoothSlider->setTickPosition(QSlider::TicksBelow);
rSmoothSlider->setTickInterval(50);
rSmoothSlider->setMinimum(1);
@@ -100,10 +77,7 @@ HrPwWindow::HrPwWindow(MainWindow *mainWindow) :
r->addWidget(rSmoothEdit);
r->addWidget(rSmoothSlider);
r->addStretch();
revealControls->setLayout(r);
// hide them initially
revealControls->hide();
setRevealLayout(r);
//
// Chart layout
@@ -143,10 +117,7 @@ HrPwWindow::HrPwWindow(MainWindow *mainWindow) :
vlayout->addWidget(smallPlot);
vlayout->setStretch(1, 20);
mainLayout->addLayout(vlayout,0,0);
mainLayout->addWidget(revealControls,0,0, Qt::AlignTop);
revealControls->raise();
setLayout(mainLayout);
setChartLayout(vlayout);
//
// the controls

View File

@@ -34,7 +34,7 @@ class QSlider;
#include "LTMWindow.h" // for tooltip/canvaspicker
class HrPwWindow : public GcWindow
class HrPwWindow : public GcChartWindow
{
Q_OBJECT
G_OBJECT
@@ -61,8 +61,6 @@ class HrPwWindow : public GcWindow
// reveal
bool hasReveal() { return true; }
void reveal() { revealControls->show(); revealAnim->start(); }
void unreveal() { unrevealAnim->start(); revealControls->hide(); }
int smooth;
@@ -101,8 +99,6 @@ class HrPwWindow : public GcWindow
private:
// reveal controls
QWidget *revealControls;
QPropertyAnimation *revealAnim, *unrevealAnim;
QLabel *rSmooth;
QSlider *rSmoothSlider;
QLineEdit *rSmoothEdit;

View File

@@ -25,7 +25,7 @@
#include <QtGui>
PfPvWindow::PfPvWindow(MainWindow *mainWindow) :
GcWindow(mainWindow), mainWindow(mainWindow), current(NULL)
GcChartWindow(mainWindow), mainWindow(mainWindow), current(NULL)
{
setInstanceName("Pf/Pv Window");
@@ -33,38 +33,15 @@ PfPvWindow::PfPvWindow(MainWindow *mainWindow) :
QVBoxLayout *cl = new QVBoxLayout(c);
setControls(c);
// Main layout
QGridLayout *mainLayout = new QGridLayout(this);
mainLayout->setContentsMargins(2,2,2,2);
//
// reveal controls widget
//
// reveal widget
revealControls = new QWidget(this);
revealControls->setFixedHeight(50);
revealControls->setStyleSheet("background-color: rgba(100%, 100%, 100%, 100%)");
revealControls->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
revealAnim = new QPropertyAnimation(revealControls, "pos");
revealAnim->setDuration(500);
revealAnim->setEasingCurve(QEasingCurve(QEasingCurve::InSine));
revealAnim->setKeyValueAt(0,QPoint(2,-50));
revealAnim->setKeyValueAt(0.5,QPoint(2,15));
revealAnim->setKeyValueAt(1,QPoint(2,20));
unrevealAnim = new QPropertyAnimation(revealControls, "pos");
unrevealAnim->setDuration(500);
unrevealAnim->setKeyValueAt(0,QPoint(2,20));
unrevealAnim->setKeyValueAt(0.5,QPoint(2,15));
unrevealAnim->setKeyValueAt(1,QPoint(2,-50));
// layout reveal controls
QHBoxLayout *revealLayout = new QHBoxLayout;
revealLayout->setContentsMargins(0,0,0,0);
rShade = new QCheckBox(tr("Shade zones"), revealControls);
rShade = new QCheckBox(tr("Shade zones"));
if (appsettings->value(this, GC_SHADEZONES, true).toBool() == true)
rShade->setCheckState(Qt::Checked);
else
@@ -88,20 +65,14 @@ PfPvWindow::PfPvWindow(MainWindow *mainWindow) :
revealLayout->addLayout(checks);
revealLayout->addStretch();
revealControls->setLayout(revealLayout);
// hide them initially
revealControls->hide();
setRevealLayout(revealLayout);
// the plot
QVBoxLayout *vlayout = new QVBoxLayout;
pfPvPlot = new PfPvPlot(mainWindow);
vlayout->addWidget(pfPvPlot);
mainLayout->addLayout(vlayout,0,0);
mainLayout->addWidget(revealControls,0,0, Qt::AlignTop);
revealControls->raise();
setLayout(mainLayout);
setChartLayout(vlayout);
// allow zooming
pfpvZoomer = new QwtPlotZoomer(pfPvPlot->canvas());

View File

@@ -27,7 +27,7 @@ class MainWindow;
class PfPvPlot;
class RideItem;
class PfPvWindow : public GcWindow
class PfPvWindow : public GcChartWindow
{
Q_OBJECT
G_OBJECT
@@ -45,8 +45,6 @@ class PfPvWindow : public GcWindow
// reveal
bool hasReveal() { return true; }
void reveal() { revealControls->show(); revealAnim->start(); }
void unreveal() { unrevealAnim->start(); revealControls->hide(); }
// get/set properties
QString watts() const { return qaCPValue->text(); }
@@ -84,7 +82,6 @@ class PfPvWindow : public GcWindow
MainWindow *mainWindow;
PfPvPlot *pfPvPlot;
QPropertyAnimation *revealAnim, *unrevealAnim;
QwtPlotZoomer *pfpvZoomer;
QCheckBox *shadeZonesPfPvCheckBox;
QCheckBox *mergeIntervalPfPvCheckBox;
@@ -96,7 +93,6 @@ class PfPvWindow : public GcWindow
private:
// reveal controls
QWidget *revealControls;
QCheckBox *rShade, *rMergeInterval, *rFrameInterval;
};