UI Nits: GcChartWindow for CriticalPowerWindow and ModelWindow

This commit is contained in:
Damien
2013-01-28 22:46:53 +01:00
parent 6a39678b26
commit 204dbe3f48
4 changed files with 32 additions and 44 deletions

View File

@@ -34,36 +34,14 @@
#include <QXmlSimpleReader>
CriticalPowerWindow::CriticalPowerWindow(const QDir &home, MainWindow *parent, bool rangemode) :
GcWindow(parent), _dateRange("{00000000-0000-0000-0000-000000000001}"), home(home), mainWindow(parent), currentRide(NULL), rangemode(rangemode), stale(true), useCustom(false), useToToday(false)
GcChartWindow(parent), _dateRange("{00000000-0000-0000-0000-000000000001}"), home(home), mainWindow(parent), currentRide(NULL), rangemode(rangemode), stale(true), useCustom(false), useToToday(false)
{
setInstanceName("Critical Power Window");
// 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("QWidget { background-color: rgba(100%, 100%, 100%, 100%); }");
revealControls->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
revealAnim = new QPropertyAnimation(revealControls, "pos");
revealAnim->setDuration(500);
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);
@@ -76,11 +54,7 @@ CriticalPowerWindow::CriticalPowerWindow(const QDir &home, MainWindow *parent, b
revealLayout->addWidget(rCpintSetCPButton);
revealLayout->addStretch();
revealControls->setLayout(revealLayout);
// hide them initially
revealControls->hide();
setRevealLayout(revealLayout);
// main plot area
QVBoxLayout *vlayout = new QVBoxLayout;
@@ -196,12 +170,7 @@ CriticalPowerWindow::CriticalPowerWindow(const QDir &home, MainWindow *parent, b
picker->setStateMachine(new QwtPickerDragPointMachine);
picker->setRubberBandPen(GColor(CPLOTTRACKER));
mainLayout->addLayout(vlayout, 0, 0);
mainLayout->addWidget(pickerControls, 0, 0, Qt::AlignTop | Qt::AlignRight);
mainLayout->addWidget(revealControls,0,0, Qt::AlignTop);
pickerControls->raise();
revealControls->raise();
setLayout(mainLayout);
setChartLayout(vlayout);
connect(picker, SIGNAL(moved(const QPoint &)), SLOT(pickerMoved(const QPoint &)));
//connect(cpintTimeValue, SIGNAL(editingFinished()), this, SLOT(cpintTimeValueEntered()));

View File

@@ -31,7 +31,7 @@ class MainWindow;
class RideItem;
class QwtPlotPicker;
class CriticalPowerWindow : public GcWindow
class CriticalPowerWindow : public GcChartWindow
{
Q_OBJECT
G_OBJECT
@@ -60,8 +60,6 @@ class CriticalPowerWindow : public GcWindow
// reveal
bool hasReveal() { return true; }
void reveal() { revealControls->show(); revealAnim->start(); }
void unreveal() { unrevealAnim->start(); revealControls->hide(); }
void deleteCpiFile(QString filename);
@@ -127,8 +125,6 @@ class CriticalPowerWindow : public GcWindow
private:
// reveal controls
QWidget *revealControls;
QPropertyAnimation *revealAnim, *unrevealAnim;
QPushButton *rCpintSetCPButton;
void updateCpint(double minutes);

View File

@@ -45,7 +45,7 @@ ModelWindow::addStandardChannels(QComboBox *box)
}
ModelWindow::ModelWindow(MainWindow *parent, const QDir &home) :
GcWindow(parent), home(home), main(parent), ride(NULL), current(NULL)
GcChartWindow(parent), home(home), main(parent), ride(NULL), current(NULL)
{
setInstanceName("3D Window");
@@ -57,6 +57,24 @@ ModelWindow::ModelWindow(MainWindow *parent, const QDir &home) :
nodata = new QLabel(tr("No data or bin size too large."), this);
nodata->hide();
//
// reveal controls
//
rpresetLabel = new QLabel(tr("Analyse"), this);
rpresetValues = new QComboBox;
fillPresets(rpresetValues);
rpresetValues->setCurrentIndex(1);
// layout reveal controls
QHBoxLayout *r = new QHBoxLayout;
r->setSpacing(4);
r->setContentsMargins(0,0,0,0);
r->addStretch();
r->addWidget(rpresetLabel);
r->addWidget(rpresetValues);
r->addStretch();
setRevealLayout(r);
// the plot widget
QHBoxLayout *mainLayout = new QHBoxLayout;
modelPlot= new ModelPlot(main, NULL);
@@ -68,7 +86,7 @@ ModelWindow::ModelWindow(MainWindow *parent, const QDir &home) :
mainLayout->addWidget(zpane);
mainLayout->addWidget(modelPlot);
mainLayout->addWidget(nodata);
setLayout(mainLayout);
setChartLayout(mainLayout);
// preset Values
presetLabel = new QLabel(tr("Analyse"), this);

View File

@@ -46,7 +46,7 @@ class ModelSettings
};
class ModelWindow : public GcWindow
class ModelWindow : public GcChartWindow
{
Q_OBJECT
G_OBJECT
@@ -67,6 +67,9 @@ class ModelWindow : public GcWindow
ModelWindow(MainWindow *, const QDir &);
// reveal
bool hasReveal() { return true; }
// set/get properties
int preset() const { return presetValues->currentIndex(); }
void setPreset(int x) { presetValues->setCurrentIndex(x); }
@@ -132,10 +135,12 @@ class ModelWindow : public GcWindow
*yLabel,
*zLabel,
*colorLabel,
*binLabel;
*binLabel,
*rpresetLabel;
// top of screen selectors
QComboBox *presetValues;
QComboBox *presetValues,
*rpresetValues;
// bottom selectors
QComboBox *xSelector,