gsplash
Loading...
Searching...
No Matches
gsplash.h
Go to the documentation of this file.
1#pragma once
2
3// gemc
4#include <gemc/gbase/gbase.h>
5
6// Qt
7#include <QtWidgets>
8#include <QTimer>
9
10#define GSPLASHENVIRONMENT "GSPLASH"
11#define NOSPLASHIMAGESELECTED "NOSPLASHIMAGESELECTED"
12
13// exit codes: 190s
14#define ERR_NOSPLASHENVFOUND 191
15
21constexpr const char* GSPLASH_LOGGER = "gsplash";
22constexpr const char* GSPLASH_TIME_OPTION = "splash_time";
23constexpr const char* GSPLASH_SCALE_OPTION = "splash_scale";
24
29namespace gsplash {
30
47 goptions.defineOption(GVariable(GSPLASH_TIME_OPTION, -1.0, "splash display time in seconds"),
48 "Minimum time in seconds to keep the splash image visible before closing it. "
49 "A negative value uses the application default.");
50 goptions.defineOption(GVariable(GSPLASH_SCALE_OPTION, 0.5, "splash image scale factor"),
51 "Scale factor applied to the splash image before display. "
52 "Use 1.0 for the image's original size.");
53 return goptions;
54}
55
56} // namespace gsplash
57
58
78class GSplash : public GBase<GSplash> {
79public:
94 static std::unique_ptr<GSplash>
95 create(const std::shared_ptr<GOptions>& gopts,
96 const std::string& imageName = "gemcArchitecture",
97 double splashTime = -1.0);
98
108 void message(const std::string& msg);
109
121 void messageAfter(int delay, const std::string& msg);
122
131 void finish(QWidget* callingWindow) const;
132
133private:
143 GSplash(const std::shared_ptr<GOptions>& gopts,
144 const std::string& imageName,
145 double splashTime);
146
152 std::unique_ptr<QSplashScreen> splash;
153 double splash_time = 0.0;
154
155};
Splash screen utility for GUI runs.
Definition gsplash.h:78
void finish(QWidget *callingWindow) const
Finishes the splash screen and returns focus to the calling window.
Definition gsplash.cc:121
static std::unique_ptr< GSplash > create(const std::shared_ptr< GOptions > &gopts, const std::string &imageName="gemcArchitecture", double splashTime=-1.0)
Factory method for creating a GSplash instance.
Definition gsplash.cc:65
void message(const std::string &msg)
Displays a message on the splash screen immediately.
Definition gsplash.cc:151
void messageAfter(int delay, const std::string &msg)
Displays a message on the splash screen after a delay.
Definition gsplash.cc:138
constexpr const char * GSPLASH_SCALE_OPTION
Definition gsplash.h:23
constexpr const char * GSPLASH_LOGGER
Default logger name used by this module.
Definition gsplash.h:21
constexpr const char * GSPLASH_TIME_OPTION
Definition gsplash.h:22
Namespace utilities for the GSplash module.
Definition gsplash.h:29
GOptions defineOptions()
Defines the module options for GSplash.
Definition gsplash.h:45