Calendar Chart now honours colour preferences

.. think that is the last of all the charts now done.
This commit is contained in:
Mark Liversedge
2014-06-08 11:37:01 +01:00
parent eedfc24b9e
commit ff918167b5
2 changed files with 37 additions and 4 deletions

View File

@@ -21,6 +21,7 @@
#include "RideMetadata.h"
#include "Athlete.h"
#include "Context.h"
#include "TabView.h"
DiaryWindow::DiaryWindow(Context *context) :
GcWindow(context), context(context), active(false)
@@ -89,6 +90,9 @@ DiaryWindow::DiaryWindow(Context *context) :
connect(context, SIGNAL(configChanged()), this, SLOT(configChanged()));
connect(next, SIGNAL(clicked()), this, SLOT(nextClicked()));
connect(prev, SIGNAL(clicked()), this, SLOT(prevClicked()));
// get colors sorted
configChanged();
}
void
@@ -96,6 +100,34 @@ DiaryWindow::configChanged()
{
// get config
fieldDefinitions = context->athlete->rideMetadata()->getFields();
// change colors to reflect preferences
setProperty("color", GColor(CPLOTBACKGROUND));
QPalette palette;
palette.setBrush(QPalette::Window, QBrush(GColor(CPLOTBACKGROUND)));
palette.setBrush(QPalette::Background, QBrush(GColor(CPLOTBACKGROUND)));
palette.setBrush(QPalette::Base, QBrush(GColor(CPLOTBACKGROUND)));
palette.setColor(QPalette::WindowText, GCColor::invertColor(GColor(CPLOTBACKGROUND)));
palette.setColor(QPalette::Text, GCColor::invertColor(GColor(CPLOTBACKGROUND)));
palette.setColor(QPalette::Normal, QPalette::Window, GCColor::invertColor(GColor(CPLOTBACKGROUND)));
setPalette(palette);
monthlyView->setPalette(palette);
monthlyView->setStyleSheet(QString("QTableView QTableCornerButton::section { background-color: %1; color: %2; border: %1 }")
.arg(GColor(CPLOTBACKGROUND).name())
.arg(GCColor::invertColor(GColor(CPLOTBACKGROUND)).name()));
monthlyView->horizontalHeader()->setStyleSheet(QString("QHeaderView::section { background-color: %1; color: %2; border: 0px }")
.arg(GColor(CPLOTBACKGROUND).name())
.arg(GCColor::invertColor(GColor(CPLOTBACKGROUND)).name()));
monthlyView->verticalHeader()->setStyleSheet(QString("QHeaderView::section { background-color: %1; color: %2; border: 0px }")
.arg(GColor(CPLOTBACKGROUND).name())
.arg(GCColor::invertColor(GColor(CPLOTBACKGROUND)).name()));
#ifndef Q_OS_MAC
monthlyView->verticalScrollBar()->setStyleSheet(TabView::ourStyleSheet());
monthlyView->horizontalScrollBar()->setStyleSheet(TabView::ourStyleSheet());
#endif
title->setStyleSheet(QString("background: %1; color: %2;").arg(GColor(CPLOTBACKGROUND).name())
.arg(GColor(CPLOTMARKER).name()));
}
void

View File

@@ -306,16 +306,16 @@ public:
if (date(proxyIndex) == QDate::currentDate())
return GColor(CCALTODAY);
if (date(proxyIndex).month() == month)
return GColor(CCALCELL);
return GColor(CPLOTBACKGROUND);
else
return GColor(CCALHEAD);
return GColor(CPLOTBACKGROUND).darker(200);
break;
case HeaderColorRole: // what color for the cell heading
if (date(proxyIndex).month() == month)
return GColor(CCALHEAD);
return GColor(CPLOTBACKGROUND);
else
return GColor(CCALHEAD).darker(200);
return GColor(CPLOTBACKGROUND).darker(200);
break;
case FilenamesRole:
@@ -485,6 +485,7 @@ class GcCalendarDelegate : public QItemDelegate
// date...
QString datestring = index.data(GcCalendarModel::DateStringRole).toString();
QTextOption textOption(Qt::AlignRight);
painter->setPen(GCColor::invertColor(hg));
painter->drawText(hd, datestring, textOption);
// text