# HG changeset patch # User Chris Cannam # Date 1579869793 0 # Node ID 7e70382e6ecee1d9e19cc22432cf94d634380cd2 # Parent 91154a38759907ccb7e9e3066ce6eb21df5f9e8a Render dark splash in dark mode (on platforms where OSReportsDarkThemeActive() works, i.e. only Windows at present - can't base this on actual UI colours as we haven't created the UI yet) diff -r 91154a387599 -r 7e70382e6ece main/SVSplash.cpp --- a/main/SVSplash.cpp Fri Jan 24 12:42:20 2020 +0000 +++ b/main/SVSplash.cpp Fri Jan 24 12:43:13 2020 +0000 @@ -21,6 +21,8 @@ #include #include +#include "system/System.h" + #include #include @@ -29,8 +31,10 @@ SVSplash::SVSplash() { setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint); + + bool darkTheme = OSReportsDarkThemeActive(); - QPixmap *p1 = new QPixmap(":icons/scalable/sv-splash.png"); + QPixmap *p1 = new QPixmap(QString(":icons/scalable/sv-splash.png")); int w = p1->width(), h = p1->height(); QScreen *screen = QApplication::primaryScreen(); @@ -41,10 +45,11 @@ int sw = w, sh = h; - if (widthMultiple > 2.5 || dpratio > 1.0) { + if (widthMultiple > 2.5 || dpratio > 1.0 || darkTheme) { // Hi-dpi either via pixel doubling or simply via lots of - // pixels + // pixels - or dark theme splash, for which we only have an + // svg version double factor = widthMultiple / 2.5; if (factor < 1.0) factor = 1.0; @@ -58,8 +63,12 @@ // cerr << "pixmap size = " << m_pixmap->width() << " * " // << m_pixmap->height() << endl; - m_pixmap->fill(Qt::red); - QSvgRenderer renderer(QString(":icons/scalable/sv-splash.svg")); + m_pixmap->fill(Qt::white); + QString filename = "sv-splash"; + if (darkTheme) { + filename = "sv-splash-dark"; + } + QSvgRenderer renderer(QString(":icons/scalable/%1.svg").arg(filename)); QPainter painter(m_pixmap); renderer.render(&painter); painter.end(); @@ -97,7 +106,7 @@ painter->drawPixmap(rect(), *m_pixmap, m_pixmap->rect()); QString text = QString("v%1").arg(SV_VERSION); - painter->setPen(Qt::black); + painter->setPen(OSReportsDarkThemeActive() ? Qt::white : Qt::black); painter->drawText (width() - painter->fontMetrics().width(text) - (width()/50), (width()/70) + painter->fontMetrics().ascent(),