Add Endurance Index to CP overlay

.. for power and w/kg
This commit is contained in:
Mark Liversedge
2014-06-17 21:40:26 +01:00
parent 74ad5e1ec7
commit e69176c5ae
4 changed files with 25 additions and 1 deletions

View File

@@ -411,6 +411,11 @@ CPPlot::plotModel()
cpw->pmaxRank->setText(tr("n/a"));
}
// Endurance Index
if (pdModel->hasWPrime() && pdModel->WPrime() && pdModel->hasCP() && pdModel->CP()) {
cpw->eiValue->setText(QString("%1").arg(pdModel->WPrime() / pdModel->CP(), 0, 'f', 0));
}
} else {
//WPrime
@@ -450,6 +455,12 @@ CPPlot::plotModel()
cpw->pmaxValue->setText(tr("n/a"));
cpw->pmaxRank->setText(tr("n/a"));
}
// Endurance Index
if (pdModel->hasWPrime() && pdModel->WPrime() && pdModel->hasCP() && pdModel->CP()) {
cpw->eiValue->setText(QString("%1").arg(pdModel->WPrime() / pdModel->CP(), 0, 'f', 0));
}
}
}
}

View File

@@ -353,6 +353,8 @@ CriticalPowerWindow::CriticalPowerWindow(const QDir &home, Context *context, boo
ftpTitle = new QLabel(tr("FTP"), this);
ftpValue = new QLabel(tr("0 w"), this);
ftpRank = new QLabel(tr("n/a"), this);
eiTitle = new QLabel(tr("Endurance Index"), this);
eiValue = new QLabel(tr("n/a"), this);
// autofill
titleBlank->setAutoFillBackground(true);
@@ -370,6 +372,8 @@ CriticalPowerWindow::CriticalPowerWindow(const QDir &home, Context *context, boo
ftpTitle->setAutoFillBackground(true);
ftpValue->setAutoFillBackground(true);
ftpRank->setAutoFillBackground(true);
eiTitle->setAutoFillBackground(true);
eiValue->setAutoFillBackground(true);
// align all centered
titleBlank->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
@@ -387,6 +391,8 @@ CriticalPowerWindow::CriticalPowerWindow(const QDir &home, Context *context, boo
ftpTitle->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
ftpValue->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
ftpRank->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
eiTitle->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
eiValue->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
// add to grid
gridLayout->addWidget(titleBlank, 0, 0);
@@ -404,6 +410,8 @@ CriticalPowerWindow::CriticalPowerWindow(const QDir &home, Context *context, boo
gridLayout->addWidget(ftpTitle, 4, 0);
gridLayout->addWidget(ftpValue, 4, 1);
gridLayout->addWidget(ftpRank, 4, 2);
gridLayout->addWidget(eiTitle, 5, 0);
gridLayout->addWidget(eiValue, 5, 1);
addHelper(QString(tr("CP Model")), helper);
@@ -512,6 +520,8 @@ CriticalPowerWindow::configChanged()
ftpTitle->setFont(font);
ftpValue->setFont(font);
ftpRank->setFont(font);
eiTitle->setFont(font);
eiValue->setFont(font);
helper->setPalette(palette);
titleBlank->setPalette(palette);
@@ -529,6 +539,8 @@ CriticalPowerWindow::configChanged()
ftpTitle->setPalette(palette);
ftpValue->setPalette(whitepalette);
ftpRank->setPalette(whitepalette);
eiTitle->setPalette(palette);
eiValue->setPalette(whitepalette);
QPen gridPen(GColor(CPLOTGRID));
grid->setPen(gridPen);

View File

@@ -287,6 +287,7 @@ class CriticalPowerWindow : public GcChartWindow
QLabel *cpTitle, *cpValue, *cpRank;
QLabel *ftpTitle, *ftpValue, *ftpRank;
QLabel *pmaxTitle, *pmaxValue, *pmaxRank;
QLabel *eiTitle, *eiValue;
void addSeries();
Seasons *seasons;

View File

@@ -38,7 +38,7 @@ GcOverlayWidget::GcOverlayWidget(Context *context, QWidget *parent) : QWidget(pa
setAttribute(Qt::WA_TranslucentBackground);
setMouseTracking(true);
setFocusPolicy(Qt::ClickFocus);
setMinimumSize(200,200);
setMinimumSize(250,200);
setFocus();
mode = none;
initial = true;