mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-13 08:08:42 +00:00
Distinguish planned activities in navigator
Reused the inactivated isRun logic to display planned activities on a darker background. Part 1 of #4670
This commit is contained in:
@@ -76,7 +76,7 @@ RideCacheModel::data(const QModelIndex &index, int role) const
|
|||||||
case 2 : return item->dateTime;
|
case 2 : return item->dateTime;
|
||||||
case 3 : return item->present;
|
case 3 : return item->present;
|
||||||
case 4 : return item->color.name();
|
case 4 : return item->color.name();
|
||||||
case 5 : return item->isRun;
|
case 5 : return item->planned;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
@@ -196,7 +196,7 @@ RideCacheModel::configChanged(qint32)
|
|||||||
// 2 QDateTime dateTime;
|
// 2 QDateTime dateTime;
|
||||||
// 3 QString present;
|
// 3 QString present;
|
||||||
// 4 QColor color;
|
// 4 QColor color;
|
||||||
// 5 bool isRun;
|
// 5 bool planned;
|
||||||
|
|
||||||
columns_ = 5 + factory->metricCount() + metadata.count();
|
columns_ = 5 + factory->metricCount() + metadata.count();
|
||||||
headings_.clear();
|
headings_.clear();
|
||||||
@@ -209,7 +209,7 @@ RideCacheModel::configChanged(qint32)
|
|||||||
case 2 : headings_<< QString("ride_date"); break;
|
case 2 : headings_<< QString("ride_date"); break;
|
||||||
case 3 : headings_<< QString("Data"); break;
|
case 3 : headings_<< QString("Data"); break;
|
||||||
case 4 : headings_<< QString("color"); break;
|
case 4 : headings_<< QString("color"); break;
|
||||||
case 5 : headings_<< QString("isRun"); break;
|
case 5 : headings_<< QString("planned"); break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1095,7 +1095,7 @@ void NavigatorCellDelegate::paint(QPainter *painter, const QStyleOptionViewItem
|
|||||||
bool hover = false; //disable this, its annoying option.state & QStyle::State_MouseOver;
|
bool hover = false; //disable this, its annoying option.state & QStyle::State_MouseOver;
|
||||||
bool selected = option.state & QStyle::State_Selected;
|
bool selected = option.state & QStyle::State_Selected;
|
||||||
bool focus = option.state & QStyle::State_HasFocus;
|
bool focus = option.state & QStyle::State_HasFocus;
|
||||||
//bool isRun = rideNavigator->tableView->model()->data(index, Qt::UserRole+2).toBool();
|
bool planned = rideNavigator->tableView->model()->data(index, Qt::UserRole+2).toBool();
|
||||||
|
|
||||||
// format the cell depending upon what it is...
|
// format the cell depending upon what it is...
|
||||||
QString columnName = rideNavigator->tableView->model()->headerData(index.column(), Qt::Horizontal).toString();
|
QString columnName = rideNavigator->tableView->model()->headerData(index.column(), Qt::Horizontal).toString();
|
||||||
@@ -1158,11 +1158,11 @@ void NavigatorCellDelegate::paint(QPainter *painter, const QStyleOptionViewItem
|
|||||||
// basic background
|
// basic background
|
||||||
QBrush background = QBrush(GColor(CPLOTBACKGROUND));
|
QBrush background = QBrush(GColor(CPLOTBACKGROUND));
|
||||||
|
|
||||||
// runs are darker
|
// planned activities are darker
|
||||||
//if (isRun) {
|
if (planned) {
|
||||||
//background.setColor(background.color().darker(150));
|
background.setColor(background.color().darker(150));
|
||||||
//userColor = userColor.darker(150);
|
userColor = userColor.darker(150);
|
||||||
//}
|
}
|
||||||
|
|
||||||
if (columnName != "*") {
|
if (columnName != "*") {
|
||||||
|
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ private:
|
|||||||
int calendarText;
|
int calendarText;
|
||||||
int colorColumn;
|
int colorColumn;
|
||||||
int fileIndex;
|
int fileIndex;
|
||||||
int isRunIndex;
|
int plannedIndex;
|
||||||
int tempIndex;
|
int tempIndex;
|
||||||
int dateColumn;
|
int dateColumn;
|
||||||
|
|
||||||
@@ -110,15 +110,15 @@ public:
|
|||||||
calendarText = -1;
|
calendarText = -1;
|
||||||
colorColumn = -1;
|
colorColumn = -1;
|
||||||
fileIndex = -1;
|
fileIndex = -1;
|
||||||
isRunIndex = -1;
|
plannedIndex = -1;
|
||||||
tempIndex = -1;
|
tempIndex = -1;
|
||||||
for(int i=0; i<model->columnCount(); i++) {
|
for(int i=0; i<model->columnCount(); i++) {
|
||||||
|
|
||||||
if (model->headerData(i, Qt::Horizontal, Qt::DisplayRole).toString() == "average_temp") {
|
if (model->headerData(i, Qt::Horizontal, Qt::DisplayRole).toString() == "average_temp") {
|
||||||
tempIndex = i;
|
tempIndex = i;
|
||||||
}
|
}
|
||||||
if (model->headerData(i, Qt::Horizontal, Qt::DisplayRole).toString() == "isRun") {
|
if (model->headerData(i, Qt::Horizontal, Qt::DisplayRole).toString() == "planned") {
|
||||||
isRunIndex = i;
|
plannedIndex = i;
|
||||||
}
|
}
|
||||||
if (model->headerData(i, Qt::Horizontal, Qt::DisplayRole).toString() == "filename" ||
|
if (model->headerData(i, Qt::Horizontal, Qt::DisplayRole).toString() == "filename" ||
|
||||||
model->headerData(i, Qt::Horizontal, Qt::DisplayRole).toString() == tr("File")) {
|
model->headerData(i, Qt::Horizontal, Qt::DisplayRole).toString() == tr("File")) {
|
||||||
@@ -342,17 +342,17 @@ public:
|
|||||||
|
|
||||||
} else if (role == (Qt::UserRole+2)) { // isRUN ?
|
} else if (role == (Qt::UserRole+2)) { // isRUN ?
|
||||||
|
|
||||||
if (isRunIndex != -1 && proxyIndex.internalPointer()) {
|
if (plannedIndex != -1 && proxyIndex.internalPointer()) {
|
||||||
|
|
||||||
bool isRun = false;
|
bool planned = false;
|
||||||
|
|
||||||
// hideous code, sorry
|
// hideous code, sorry
|
||||||
int groupNo = ((QModelIndex*)proxyIndex.internalPointer())->row();
|
int groupNo = ((QModelIndex*)proxyIndex.internalPointer())->row();
|
||||||
if (groupNo < 0 || groupNo >= groups.count() || proxyIndex.column() == 0)
|
if (groupNo < 0 || groupNo >= groups.count() || proxyIndex.column() == 0)
|
||||||
returning = false;
|
returning = false;
|
||||||
else isRun = sourceModel()->data(sourceModel()->index(groupToSourceRow.value(groups[groupNo])->at(proxyIndex.row()), isRunIndex)).toBool();
|
else planned = sourceModel()->data(sourceModel()->index(groupToSourceRow.value(groups[groupNo])->at(proxyIndex.row()), plannedIndex)).toBool();
|
||||||
|
|
||||||
returning = isRun;
|
returning = planned;
|
||||||
} else {
|
} else {
|
||||||
returning = false;
|
returning = false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user