mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-04-15 05:32:21 +00:00
Overview Tweaks
.. getting ready to add config/view modes
This commit is contained in:
@@ -198,6 +198,7 @@ GcWindow::GcWindow()
|
||||
setMouseTracking(true);
|
||||
setProperty("color", GColor(CPLOTBACKGROUND));
|
||||
setProperty("nomenu", false);
|
||||
showtitle = true;
|
||||
menu = NULL;
|
||||
|
||||
// make sure its underneath the toggle button
|
||||
@@ -230,6 +231,7 @@ GcWindow::GcWindow(Context *context) : QFrame(context->mainWindow), dragState(No
|
||||
setControls(NULL);
|
||||
setRideItem(NULL);
|
||||
setTitle("");
|
||||
showtitle=true;
|
||||
setContentsMargins(0,0,0,0);
|
||||
setResizable(false);
|
||||
setMouseTracking(true);
|
||||
@@ -309,27 +311,29 @@ GcWindow::paintEvent(QPaintEvent * /*event*/)
|
||||
QString title = property("title").toString();
|
||||
QString heading = subtitle != "" ? subtitle : title;
|
||||
|
||||
// pen color needs to contrast to background color
|
||||
QColor bgColor = property("color").value<QColor>();
|
||||
QColor fgColor = GCColor::invertColor(bgColor); // return the contrasting color
|
||||
if (showtitle) {
|
||||
// pen color needs to contrast to background color
|
||||
QColor bgColor = property("color").value<QColor>();
|
||||
QColor fgColor = GCColor::invertColor(bgColor); // return the contrasting color
|
||||
|
||||
painter.setPen(fgColor);
|
||||
painter.drawText(bar, heading, Qt::AlignVCenter | Qt::AlignCenter);
|
||||
|
||||
if (isCompare()) {
|
||||
// overlay in highlight color
|
||||
QColor over = QColor(Qt::red);
|
||||
over.setAlpha(220);
|
||||
painter.setPen(over);
|
||||
painter.setPen(fgColor);
|
||||
painter.drawText(bar, heading, Qt::AlignVCenter | Qt::AlignCenter);
|
||||
}
|
||||
|
||||
if (isFiltered()) {
|
||||
// overlay in highlight color
|
||||
QColor over = GColor(CCALCURRENT);
|
||||
over.setAlpha(220);
|
||||
painter.setPen(over);
|
||||
painter.drawText(bar, heading, Qt::AlignVCenter | Qt::AlignCenter);
|
||||
if (isCompare()) {
|
||||
// overlay in highlight color
|
||||
QColor over = QColor(Qt::red);
|
||||
over.setAlpha(220);
|
||||
painter.setPen(over);
|
||||
painter.drawText(bar, heading, Qt::AlignVCenter | Qt::AlignCenter);
|
||||
}
|
||||
|
||||
if (isFiltered()) {
|
||||
// overlay in highlight color
|
||||
QColor over = GColor(CCALCURRENT);
|
||||
over.setAlpha(220);
|
||||
painter.setPen(over);
|
||||
painter.drawText(bar, heading, Qt::AlignVCenter | Qt::AlignCenter);
|
||||
}
|
||||
}
|
||||
|
||||
// border
|
||||
|
||||
@@ -88,6 +88,7 @@ private:
|
||||
|
||||
QWidget *_controls;
|
||||
|
||||
bool showtitle;
|
||||
QString _title;
|
||||
QString _subtitle;
|
||||
//QString _instanceName;
|
||||
@@ -148,7 +149,7 @@ public:
|
||||
|
||||
void setTitle(QString x);
|
||||
QString title() const;
|
||||
|
||||
void setShowTitle(bool x) { showtitle=x; }
|
||||
|
||||
void setRideItem(RideItem *);
|
||||
RideItem *rideItem() const;
|
||||
|
||||
@@ -28,7 +28,7 @@ OverviewWindow::OverviewWindow(Context *context) :
|
||||
{
|
||||
setContentsMargins(0,0,0,0);
|
||||
setProperty("color", GColor(COVERVIEWBACKGROUND));
|
||||
|
||||
setShowTitle(false);
|
||||
setControls(NULL);
|
||||
|
||||
QHBoxLayout *main = new QHBoxLayout;
|
||||
@@ -407,6 +407,14 @@ OverviewWindow::eventFilter(QObject *, QEvent *event)
|
||||
}
|
||||
break;
|
||||
|
||||
case Qt::Key_Home:
|
||||
scrollTo(0);
|
||||
break;
|
||||
|
||||
case Qt::Key_End:
|
||||
scrollTo(scene->sceneRect().bottom());
|
||||
break;
|
||||
|
||||
case Qt::Key_PageDown:
|
||||
scrollTo(_viewY + view->sceneRect().height());
|
||||
break;
|
||||
|
||||
@@ -79,7 +79,7 @@ class Card : public QGraphicsWidget
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) {
|
||||
painter->setBrush(brush);
|
||||
QPainterPath path;
|
||||
path.addRoundedRect(QRectF(0,0,geometry().width(),geometry().height()), ROWHEIGHT/6, ROWHEIGHT/6);
|
||||
path.addRoundedRect(QRectF(0,0,geometry().width(),geometry().height()), ROWHEIGHT/5, ROWHEIGHT/5);
|
||||
painter->setPen(Qt::NoPen);
|
||||
painter->fillPath(path, brush.color());
|
||||
painter->drawPath(path);
|
||||
|
||||
Reference in New Issue
Block a user