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
10namespace gsplash {
11
12inline constexpr char GSPLASHENVIRONMENT[] = "GSPLASH";
13inline constexpr char NOSPLASHIMAGESELECTED[] = "NOSPLASHIMAGESELECTED";
14
15// exit codes: 190s
16inline constexpr int ERR_NOSPLASHENVFOUND = 191;
17
23inline constexpr char GSPLASH_LOGGER[] = "gsplash";
24inline constexpr char GSPLASH_TIME_OPTION[] = "splash_time";
25inline constexpr char GSPLASH_SCALE_OPTION[] = "splash_scale";
26
48 goptions.defineOption(GVariable(gsplash::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::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
78class GSplash : public GBase<GSplash> {
79public:
95 static std::unique_ptr<GSplash>
96 create(const std::shared_ptr<GOptions>& gopts,
97 const std::string& imageName = "gemcArchitecture",
98 double splashTime = -1.0);
99
109 void message(const std::string& msg);
110
122 void messageAfter(int delay, const std::string& msg);
123
132 void finish(QWidget* callingWindow) const;
133
134private:
144 GSplash(const std::shared_ptr<GOptions>& gopts,
145 const std::string& imageName,
146 double splashTime);
147
153 std::unique_ptr<QSplashScreen> splash;
154 double splash_time = 0.0;
155
156};
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
GOptions defineOptions()
Namespace utilities for the GSplash module.
Definition gsplash.h:46
constexpr char NOSPLASHIMAGESELECTED[]
Definition gsplash.h:13
constexpr char GSPLASH_TIME_OPTION[]
Definition gsplash.h:24
constexpr char GSPLASH_LOGGER[]
Default logger name used by this module.
Definition gsplash.h:23
constexpr int ERR_NOSPLASHENVFOUND
Definition gsplash.h:16
constexpr char GSPLASH_SCALE_OPTION[]
Definition gsplash.h:25
constexpr char GSPLASHENVIRONMENT[]
Definition gsplash.h:12