17 #include "../version.h" 20 #include <QApplication> 22 #include <QSvgRenderer> 24 #include "system/System.h" 33 setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint);
35 bool darkTheme = OSReportsDarkThemeActive();
37 QPixmap *p1 =
new QPixmap(QString(
":icons/scalable/sv-splash.png"));
39 int w = p1->width(), h = p1->height();
40 QScreen *screen = QApplication::primaryScreen();
41 QRect desk = screen->availableGeometry();
43 double dpratio = devicePixelRatio();
44 double widthMultiple = double(desk.width()) /
double(w);
48 if (widthMultiple > 2.5 || dpratio > 1.0 || darkTheme) {
54 double factor = widthMultiple / 2.5;
55 if (factor < 1.0) factor = 1.0;
56 sw = int(floor(w * factor));
57 sh = int(floor(h * factor));
60 m_pixmap =
new QPixmap(
int(floor(sw * dpratio)),
61 int(floor(sh * dpratio)));
66 m_pixmap->fill(Qt::white);
67 QString filename =
"sv-splash";
69 filename =
"sv-splash-dark";
71 QSvgRenderer renderer(QString(
":icons/scalable/%1.svg").arg(filename));
72 QPainter painter(m_pixmap);
73 renderer.render(&painter);
83 setGeometry(desk.x() + desk.width()/2 - sw/2,
84 desk.y() + desk.height()/2 - sh/2,
105 #pragma GCC diagnostic ignored "-Wdeprecated-declarations" 107 painter->drawPixmap(rect(), *m_pixmap, m_pixmap->rect());
108 QString text = QString(
"v%1").arg(SV_VERSION);
109 painter->setPen(OSReportsDarkThemeActive() ? Qt::white : Qt::black);
111 (width() - painter->fontMetrics().width(text) - (width()/50),
112 (width()/70) + painter->fontMetrics().ascent(),
void finishSplash(QWidget *)
void drawContents(QPainter *) override