swift
Loading...
Searching...
No Matches
splashscreen.cpp
1// SPDX-FileCopyrightText: Copyright (C) 2018 swift Project Community / Contributors
2// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3
4#include "splashscreen.h"
5
6#include <QPainter>
7#include <QtMath>
8
9using namespace swift::misc;
10
11namespace swift::gui
12{
14 {
15 const int height = qFloor(pixmap.height() * 1.2);
16 const int width = pixmap.width();
17 QPixmap splash(pixmap.width(), height);
18 splash.fill(Qt::transparent);
19
20 QPainter painter(&splash);
21 painter.drawPixmap(0, 0, pixmap);
22
23 const int statusbar_height = qFloor((height - pixmap.height()) / 2.0);
24 QPixmap statusbar(width, statusbar_height);
25 statusbar.fill(QColor(200, 200, 200));
26 painter.drawPixmap(0, height - statusbar_height, statusbar);
27
28 this->setPixmap(splash);
29 this->setFont(font);
30 }
31
33 {
34 if (msg.isEmpty())
35 {
36 return;
37 }
39 }
40} // namespace swift::gui
void showStatusMessage(const QString &msg)
Show status message.
CSplashScreen(const QPixmap &pixmap, const QFont &font)
Ctor.
GUI related classes.
Free functions in swift::misc.
void drawPixmap(const QPoint &point, const QPixmap &pixmap)
void fill(const QColor &color)
const QPixmap pixmap() const const
void setPixmap(const QPixmap &pixmap)
void showMessage(const QString &message, int alignment, const QColor &color)
bool isEmpty() const const
AlignHCenter
transparent