MCPcopy Index your code
hub / github.com/NetHack/NetHack / qt_Splash

Method qt_Splash

win/Qt/qt_bind.cpp:124–173  ·  view source on GitHub ↗

before the game windows have been rendered, display a small, centered window showing a flying red dragon ridden by someone wielding a lance, with caption "Loading..."

Source from the content-addressed store, hash-verified

122// window showing a flying red dragon ridden by someone wielding a lance,
123// with caption "Loading..."
124void
125NetHackQtBind::qt_Splash()
126{
127 QPixmap pm("nhsplash.xpm"); // load splash image from a file in HACKDIR
128 if (!pm.isNull()) {
129 splash = new QFrame(NULL, (Qt::FramelessWindowHint
130 | Qt::X11BypassWindowManagerHint
131 | Qt::WindowStaysOnTopHint));
132 QVBoxLayout *vb = new QVBoxLayout(splash);
133 QLabel *lsplash = new QLabel(splash);
134 vb->addWidget(lsplash);
135 lsplash->setAlignment(Qt::AlignCenter);
136 lsplash->setPixmap(pm);
137 lsplash->setFixedSize(pm.size());
138 //lsplash->setMask(pm.mask());
139 QLabel *capt = new QLabel("Loading...", splash);
140 vb->addWidget(capt);
141 capt->setAlignment(Qt::AlignCenter);
142
143#if QT_VERSION < 0x060000
144 QSize screensize = QApplication::desktop()->size();
145#else
146 QSize screensize = splash->screen()->size();
147#endif
148 splash->move((screensize.width() - pm.width()) / 2,
149 (screensize.height() - pm.height()) / 2);
150 //splash->setGeometry(0,0,100,100);
151 if (qt_compact_mode) {
152 splash->showMaximized();
153 } else {
154#if __cplusplus >= 202002L
155 splash->setFrameStyle(static_cast<int>(QFrame::WinPanel)
156 | static_cast<int>(QFrame::Raised));
157#else
158 splash->setFrameStyle(QFrame::WinPanel | QFrame::Raised);
159#endif
160 splash->setLineWidth(10);
161 splash->adjustSize();
162 splash->show();
163 }
164
165 // force content refresh outside event loop
166 splash->repaint();
167 lsplash->repaint();
168 capt->repaint();
169 qApp->processEvents();
170 } else {
171 splash = 0; // caller has already done this...
172 }
173}
174
175void NetHackQtBind::qt_init_nhwindows(int *argc, char **argv)
176{

Callers

nothing calls this directly

Calls 4

repaintMethod · 0.60
widthMethod · 0.45
heightMethod · 0.45
showMethod · 0.45

Tested by

no test coverage detected