37 QGraphicsDropShadowEffect *effect =
new QGraphicsDropShadowEffect(widget);
38 effect->setBlurRadius(4);
39 effect->setOffset(0.5);
40 effect->setColor(QColor(0, 0, 0, 255));
41 widget->setGraphicsEffect(effect);
45 : QWidget(parent, Qt::SplashScreen | Qt::FramelessWindowHint | f)
47 , m_versionHtml(qApp->applicationVersion().toHtmlEscaped())
55 m_loadingTextLabel->setStyleSheet(QStringLiteral(
"QLabel { color: #fff; background-color: transparent; }"));
59 m_brandingSvg =
new QSvgWidget(QStringLiteral(
":/krita-branding.svgz"), lblSplash);
60 m_bannerSvg =
new QSvgWidget(QStringLiteral(
":/splash/banner.svg"), lblSplash);
65 m_artCreditsLabel->setStyleSheet(QStringLiteral(
"QLabel { color: #fff; background-color: transparent; font: 10pt; }"));
73 connect(bnClose, SIGNAL(clicked()),
this, SLOT(close()));
74 chkShowAtStartup->hide();
77 KConfigGroup cfg( KSharedConfig::openConfig(),
"SplashScreen");
78 bool hideSplash = cfg.readEntry(
"HideSplashAfterStartup",
false);
79 chkShowAtStartup->setChecked(hideSplash);
94 constexpr int SPLASH_HEIGHT_LOADING = 480;
95 constexpr int SPLASH_HEIGHT_ABOUT = 320;
99 splashHeight = SPLASH_HEIGHT_ABOUT;
101 splashHeight = SPLASH_HEIGHT_LOADING;
103 const int bannerHeight = splashHeight * 0.16875;
104 const int marginTop = splashHeight * 0.05;
105 const int marginRight = splashHeight * 0.1;
107 QString splashName = QStringLiteral(
":/splash/0.png");
108 QString splashArtist = QStringLiteral(
"Tyson Tan");
111 QDate currentDate = QDate::currentDate();
112 if (currentDate > QDate(currentDate.year(), 12, 4) ||
113 currentDate < QDate(currentDate.year(), 1, 9)) {
114 splashName = QStringLiteral(
":/splash/1.png");
115 splashArtist = QStringLiteral(
"???");
119 QPixmap img(splashName);
121 if (img.isNull() || img.height() == 0)
return;
124 const int height = splashHeight;
125 const int width = height * img.width() / img.height();
127 setFixedWidth(width);
128 setFixedHeight(height);
129 lblSplash->setFixedWidth(width);
130 lblSplash->setFixedHeight(height);
133 const int pixelWidth = width * devicePixelRatioF();
134 const int pixelHeight = height * devicePixelRatioF();
135 img = img.scaled(pixelWidth, pixelHeight, Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation);
136 img.setDevicePixelRatio(devicePixelRatioF());
137 lblSplash->setPixmap(img);
153 if (splashArtist.isEmpty()) {
156 m_artCreditsLabel->setText(i18nc(
"splash image credit",
"Artwork by: %1", splashArtist));
163 setFixedSize(sizeHint());
177 KConfigGroup cfg2( KSharedConfig::openConfig(),
"RecentFiles");
180 QString recent = i18n(
"<html>"
183 "<p><b><span style=\" color:%1;\">Recent Files</span></b></p>", color);
188 QFontMetrics metrics(lblRecent->font());
191 path = cfg2.readPathEntry(QString(
"File%1").arg(i), QString());
192 if (!path.isEmpty()) {
193 QString name = cfg2.readPathEntry(QString(
"Name%1").arg(i), QString());
195 if (name.isEmpty()) {
196 name = url.fileName();
199 name = metrics.elidedText(name, Qt::ElideMiddle, lblRecent->width());
201 if (!url.isLocalFile() || QFile::exists(url.toLocalFile())) {
202 recentfiles.insert(0, QString(
"<p><a href=\"%1\"><span style=\"color:%3;\">%2</span></a></p>").arg(path).arg(name).arg(color));
207 }
while (!path.isEmpty() || i <= 8);
209 recent += recentfiles.join(
"\n");
212 lblRecent->setText(recent);
220 lblLinksText <<
"<html>"
222 <<
"<body><table style=\"width:100%\" cellpadding=\"30\"><tr><td>"
223 << i18n(
"<p><span style=\" color:%1;\"><b>Using Krita</b></span></p>",color);
230 lblLinksText << i18n(
"<p><a href=\"https://krita.org/support-us/\"><span style=\" text-decoration: underline; color:%1;\">Support Krita's Development!</span></a></p>",color)
231 << i18n(
"<p><a href=\"https://krita.org/\"><span style=\" text-decoration: underline; color:%1;\">Krita Website</span></a></p>",color);
235 lblLinksText << i18n(
"<p><a href=\"https://docs.krita.org/en/user_manual/getting_started.html\"><span style=\" text-decoration: underline; color:%1;\">Getting Started</span></a></p>",color)
236 << i18n(
"<p><a href=\"https://docs.krita.org/\"><span style=\" text-decoration: underline; color:%1;\">Manual</span></a></p>",color)
238 << i18n(
"<p><span style=\" color:%1;\"><b>Coding Krita</b></span></p>",color)
239 << i18n(
"<p><a href=\"https://krita-artists.org\"><span style=\" text-decoration: underline; color:%1;\">User Community</span></a></p>",color)
240 << i18n(
"<p><a href=\"https://invent.kde.org/graphics/krita\"><span style=\" text-decoration: underline; color:%1;\">Source Code</span></a></p>",color)
241 << i18n(
"<p><a href=\"https://api.kde.org/krita/html/classKrita.html\"><span style=\" text-decoration: underline; color:%1;\">Scripting API</span></a></p>",color)
242 << i18n(
"<p><a href=\"https://scripting.krita.org/lessons/introduction\"><span style=\" text-decoration: underline; color:%1;\">Scripting School</span></a></p>",color)
243 <<
"</td></tr></table></body>"
247 lblLinks->setTextFormat(Qt::RichText);
248 lblLinks->setText(lblLinksText.join(
""));
250 filesLayout->setContentsMargins(10,10,10,10);
251 actionControlsLayout->setContentsMargins(5,5,5,5);
255 filesLayout->setContentsMargins(0,0,0,0);
256 actionControlsLayout->setContentsMargins(0,0,0,0);
259 lblLinks->setVisible(
show);
305 if (!this->parentWidget()) {
307 QWindow *windowHandle = this->windowHandle();
308 QScreen *screen = windowHandle ? windowHandle->screen() :
nullptr;
309 if (windowHandle && !screen) {
316 windowHandle->setScreen(QApplication::primaryScreen());
319 screen = QApplication::primaryScreen();
324 QRect r(QPoint(), size());
325 move(screen->availableGeometry().center() - r.center());