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
48 goptions.defineOption(GVariable(GSPLASH_TIME_OPTION, -1.0, "splash display time in seconds"),
49 "Minimum time in seconds to keep the splash image visible before closing it. "
50 "A negative value uses the application default.");
51 goptions.defineOption(GVariable(GSPLASH_SCALE_OPTION, 0.5, "splash image scale factor"),
52 "Scale factor applied to the splash image before display. "
53 "Use 1.0 for the image's original size.");
54 return goptions;
55}
56
57} // namespace gsplash
58
59
79class GSplash : public GBase<GSplash> {
80public:
96 static std::unique_ptr<GSplash>
97 create(const std::shared_ptr<GOptions>& gopts,
98 const std::string& imageName = "gemcArchitecture",
99 double splashTime = -1.0);
100
110 void message(const std::string& msg);
111
123 void messageAfter(int delay, const std::string& msg);
124
133 void finish(QWidget* callingWindow) const;
134
135private:
145 GSplash(const std::shared_ptr<GOptions>& gopts,
146 const std::string& imageName,
147 double splashTime);
148
154 std::unique_ptr<QSplashScreen> splash;
155 double splash_time = 0.0;
156
157};
GBase(const std::shared_ptr< GOptions > &gopt, std::string logger_name="")
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:46