mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-04-15 05:32:21 +00:00
Make toolbar color configurable
Not generally useful but allows one to make the toolbar menu and titlebar match for a more pleasing general effect. Most users will not use this I imagine and use the default window colors.
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
#include <QDir>
|
||||
#include "Settings.h"
|
||||
|
||||
static Colors ColorList[56] = {
|
||||
static Colors ColorList[57] = {
|
||||
{ "Plot Background", "COLORPLOTBACKGROUND", Qt::white },
|
||||
{ "Ride Plot Background", "COLORRIDEPLOTBACKGROUND", Qt::black },
|
||||
{ "Plot Thumbnail Background", "COLORPLOTTHUMBNAIL", Qt::gray },
|
||||
@@ -78,6 +78,7 @@ static Colors ColorList[56] = {
|
||||
{ "Pop Up Windows Foreground", "CPOPUPTEXT", Qt::white },
|
||||
{ "Chart Bar Unselected", "CTILEBAR", Qt::gray },
|
||||
{ "Chart Bar Selected", "CTILEBARSELECT", Qt::yellow },
|
||||
{ "ToolBar Background", "CTOOLBAR", Qt::white },
|
||||
{ "", "", QColor(0,0,0) },
|
||||
};
|
||||
|
||||
@@ -111,6 +112,12 @@ GCColor::readConfig()
|
||||
ColorList[i].color = QColor(rgb[0].toInt(),
|
||||
rgb[1].toInt(),
|
||||
rgb[2].toInt());
|
||||
} else {
|
||||
// set sensible defaults for any not set...
|
||||
if (ColorList[i].name == "CTOOLBAR") {
|
||||
QPalette def;
|
||||
ColorList[i].color = def.color(QPalette::Window);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,5 +107,6 @@ class GCColor : public QObject
|
||||
#define CPOPUPTEXT 52
|
||||
#define CTILEBAR 53
|
||||
#define CTILEBARSELECT 54
|
||||
#define CTOOLBAR 55
|
||||
|
||||
#endif
|
||||
|
||||
@@ -175,6 +175,12 @@ MainWindow::MainWindow(const QDir &home) :
|
||||
#ifndef Q_OS_MAC
|
||||
toolbar->setContentsMargins(0,0,0,0);
|
||||
toolbar->setAutoFillBackground(true);
|
||||
QPalette pal;
|
||||
//pal.setColor(QPalette::Button, QColor(60,59,55));
|
||||
pal.setColor(QPalette::Window, GColor(CTOOLBAR));
|
||||
pal.setColor(QPalette::Button, GColor(CTOOLBAR));
|
||||
toolbar->setPalette(pal);
|
||||
toolbar->setMovable(false);
|
||||
#else
|
||||
QIcon tickIcon(":images/toolbar/main/tick.png");
|
||||
QPushButton *showControls = new QPushButton(tickIcon, "", this);
|
||||
@@ -1547,6 +1553,14 @@ MainWindow::notifyConfigChanged()
|
||||
QMessageBox::warning(this, tr("Reading HR Zones File"), hrzones_->warningString());
|
||||
}
|
||||
|
||||
// update the toolbar color if not Mac
|
||||
#ifndef Q_OS_MAC
|
||||
QPalette pal;
|
||||
pal.setColor(QPalette::Window, GColor(CTOOLBAR));
|
||||
pal.setColor(QPalette::Button, GColor(CTOOLBAR));
|
||||
toolbar->setPalette(pal);
|
||||
#endif
|
||||
|
||||
// now tell everyone else
|
||||
configChanged();
|
||||
}
|
||||
|
||||
@@ -24,9 +24,15 @@ MetadataWindow::MetadataWindow(MainWindow *mainWindow) :
|
||||
setInstanceName("Metadata Window");
|
||||
setControls(NULL);
|
||||
setRideItem(NULL);
|
||||
setContentsMargins(0,0,0,0);
|
||||
|
||||
QVBoxLayout *vlayout = new QVBoxLayout(this);
|
||||
vlayout->setSpacing(0);
|
||||
rideMetadata = new RideMetadata(mainWindow);
|
||||
QFont font;
|
||||
font.setPointSize(font.pointSize()-2);
|
||||
rideMetadata->setFont(font);
|
||||
rideMetadata->setContentsMargins(0,0,0,0);
|
||||
vlayout->addWidget(rideMetadata);
|
||||
|
||||
connect(this, SIGNAL(rideItemChanged(RideItem*)), this, SLOT(rideItemChanged()));
|
||||
|
||||
@@ -38,7 +38,7 @@ RideMetadata::RideMetadata(MainWindow *parent) : QWidget(parent), main(parent)
|
||||
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout(this);
|
||||
mainLayout->setSpacing(0);
|
||||
mainLayout->setContentsMargins(10,10,10,10);
|
||||
mainLayout->setContentsMargins(0,0,0,0);
|
||||
|
||||
QPalette palette;
|
||||
palette.setBrush(QPalette::Background, Qt::NoBrush);
|
||||
|
||||
Reference in New Issue
Block a user