XPlor/app/splashscreen.h

51 lines
1.1 KiB
C
Raw Normal View History

#ifndef SPLASHSCREEN_H
#define SPLASHSCREEN_H
#include <QSplashScreen>
#include <QLabel>
#include <QProgressBar>
#include <QColor>
#include <QMouseEvent>
#include <QKeyEvent>
class SplashScreen : public QSplashScreen
{
Q_OBJECT
public:
explicit SplashScreen(QWidget *parent = nullptr);
void setStatus(const QString &message);
void setProgress(int value, int max = 100);
void setWaitForInteraction(bool wait);
void finish(QWidget *mainWindow);
protected:
void drawContents(QPainter *painter) override;
void mousePressEvent(QMouseEvent *event) override;
void keyPressEvent(QKeyEvent *event) override;
private:
void loadThemeColors();
QString mStatus;
int mProgress = 0;
int mProgressMax = 100;
bool mWaitForInteraction = false;
bool mInteractionReceived = false;
QWidget *mPendingMainWindow = nullptr;
// Theme colors
QColor mPrimaryColor;
QColor mBgColor;
QColor mPanelColor;
QColor mTextColor;
QColor mTextColorMuted;
QColor mBorderColor;
static constexpr int WIDTH = 480;
static constexpr int HEIGHT = 300;
};
#endif // SPLASHSCREEN_H