From 79efd4181bdb232d922a468e64d8a5bbc6612f46 Mon Sep 17 00:00:00 2001 From: Mark Liversedge Date: Tue, 13 Nov 2012 15:22:38 +0000 Subject: [PATCH] UI Nits: Reinstate drop shadow option But NOT for win32 and ONLY on the sidebar and tabwidget (for performance reasons). Since most users prefer the tabbed look anyway this should be ok. Performance of the graphicseffect has improved remarkably in the 2 years since we tried it before. Worth experimenting with since it adds a bit of polish to the look and feel. Users turn it on and off in options, it is off by default. --- src/GoldenCheetah.cpp | 1 - src/HomeWindow.cpp | 9 +++++++++ src/MainWindow.cpp | 9 +++++++++ src/Pages.cpp | 6 ++++++ src/Pages.h | 1 + src/Settings.h | 2 +- 6 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/GoldenCheetah.cpp b/src/GoldenCheetah.cpp index 7f5b08cd0..4a2df2270 100644 --- a/src/GoldenCheetah.cpp +++ b/src/GoldenCheetah.cpp @@ -24,7 +24,6 @@ #include #include #include -#include QWidget *GcWindow::controls() const { diff --git a/src/HomeWindow.cpp b/src/HomeWindow.cpp index 37282868b..10f192759 100644 --- a/src/HomeWindow.cpp +++ b/src/HomeWindow.cpp @@ -217,6 +217,15 @@ HomeWindow::HomeWindow(MainWindow *mainWindow, QString name, QString /* windowti // watch drop operations //setMouseTracking(true); installEventFilter(this); + +#ifndef WIN32 + // add a drop shadow to the window + if (appsettings->value(this, GC_DROPSHADOWS, false).toBool() == true) { + QGraphicsDropShadowEffect *dropShadow = new QGraphicsDropShadowEffect(this); + dropShadow->setBlurRadius(10); + tabbed->setGraphicsEffect(dropShadow); + } +#endif } HomeWindow::~HomeWindow() diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 071473bef..ac823a15d 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -100,6 +100,7 @@ #include #include #include +#include #include #include #include @@ -534,6 +535,14 @@ MainWindow::MainWindow(const QDir &home) : toolBox->setContentsMargins(0,0,0,0); toolBox->layout()->setSpacing(0); +#ifndef WIN32 + // add a drop shadow to the window + if (appsettings->value(this, GC_DROPSHADOWS, false).toBool() == true) { + QGraphicsDropShadowEffect *dropShadow = new QGraphicsDropShadowEffect(this); + dropShadow->setBlurRadius(10); + toolBox->setGraphicsEffect(dropShadow); + } +#endif // CONTAINERS FOR TOOLBOX masterControls = new QStackedWidget(this); masterControls->setFrameStyle(QFrame::Plain | QFrame::NoFrame); diff --git a/src/Pages.cpp b/src/Pages.cpp index 34cc638d8..ad385d11d 100644 --- a/src/Pages.cpp +++ b/src/Pages.cpp @@ -1100,6 +1100,8 @@ ColorsPage::ColorsPage(QWidget *parent) : QWidget(parent) shadeZones->setChecked(appsettings->value(this, GC_SHADEZONES, true).toBool()); antiAliased = new QCheckBox; antiAliased->setChecked(appsettings->value(this, GC_ANTIALIAS, false).toBool()); + dropShadows = new QCheckBox; + dropShadows->setChecked(appsettings->value(this, GC_DROPSHADOWS, false).toBool()); lineWidth = new QDoubleSpinBox; lineWidth->setMaximum(5); lineWidth->setMinimum(0.5); @@ -1110,6 +1112,7 @@ ColorsPage::ColorsPage(QWidget *parent) : QWidget(parent) QLabel *lineWidthLabel = new QLabel(tr("Line Width")); QLabel *antialiasLabel = new QLabel(tr("Antialias" )); QLabel *shadeZonesLabel = new QLabel(tr("Shade Zones" )); + QLabel *dropShadowsLabel = new QLabel(tr("Drop Shadows" )); QLabel *defaultLabel = new QLabel(tr("Default")); QLabel *titlesLabel = new QLabel(tr("Title" )); @@ -1194,9 +1197,11 @@ ColorsPage::ColorsPage(QWidget *parent) : QWidget(parent) grid->addWidget(lineWidthLabel, 0,3); grid->addWidget(antialiasLabel, 1,3); grid->addWidget(shadeZonesLabel, 2,3); + grid->addWidget(dropShadowsLabel, 3,3); grid->addWidget(lineWidth, 0,4, Qt::AlignVCenter|Qt::AlignLeft); grid->addWidget(antiAliased, 1,4, Qt::AlignVCenter|Qt::AlignLeft); grid->addWidget(shadeZones, 2,4, Qt::AlignVCenter|Qt::AlignLeft); + grid->addWidget(dropShadows, 3,4, Qt::AlignVCenter|Qt::AlignLeft); grid->addWidget(reset, 5,4, Qt::AlignVCenter|Qt::AlignRight); grid->addWidget(defaultLabel, 0,0); @@ -1264,6 +1269,7 @@ ColorsPage::saveClicked() appsettings->setValue(GC_LINEWIDTH, lineWidth->value()); appsettings->setValue(GC_ANTIALIAS, antiAliased->isChecked()); appsettings->setValue(GC_SHADEZONES, shadeZones->isChecked()); + appsettings->setValue(GC_DROPSHADOWS, dropShadows->isChecked()); // run down and get the current colors and save for (int i=0; colorSet[i].name != ""; i++) { diff --git a/src/Pages.h b/src/Pages.h index 572c65c1e..3f0158ad6 100644 --- a/src/Pages.h +++ b/src/Pages.h @@ -398,6 +398,7 @@ class ColorsPage : public QWidget // General stuff QCheckBox *antiAliased; QCheckBox *shadeZones; + QCheckBox *dropShadows; QDoubleSpinBox *lineWidth; // Fonts diff --git a/src/Settings.h b/src/Settings.h index abfb83445..ba12cc9b0 100644 --- a/src/Settings.h +++ b/src/Settings.h @@ -77,7 +77,7 @@ #define GC_LTM_SPLITTER_SIZES "ltmwindow/splitterSizes" #define GC_LINEWIDTH "linewidth" #define GC_ANTIALIAS "antialias" -#define GC_DROPSHADOW "dropshadow" +#define GC_DROPSHADOWS "dropshadow" #define GC_SHADEZONES "shadezones" #define GC_PROXYTYPE "proxy/type" #define GC_PROXYHOST "proxy/host"