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())
57 m_loadingTextLabel->setStyleSheet(QStringLiteral(
"QLabel { color: #fff; background-color: transparent; }"));
61 m_brandingSvg =
new QSvgWidget(QStringLiteral(
":/krita-branding.svgz"), lblSplash);
62 m_bannerSvg =
new QSvgWidget(QStringLiteral(
":/splash/banner.svg"), lblSplash);
67 m_artCreditsLabel->setStyleSheet(QStringLiteral(
"QLabel { color: #fff; background-color: transparent; font: 10pt; }"));
75 connect(bnClose, SIGNAL(clicked()),
this, SLOT(close()));
76 chkShowAtStartup->hide();
79 KConfigGroup cfg( KSharedConfig::openConfig(),
"SplashScreen");
80 bool hideSplash = cfg.readEntry(
"HideSplashAfterStartup",
false);
81 chkShowAtStartup->setChecked(hideSplash);
83 connect(lblRecent, SIGNAL(linkActivated(QString)), SLOT(
linkClicked(QString)));
84 connect(&
m_timer, SIGNAL(timeout()), SLOT(raise()));
96 constexpr int SPLASH_HEIGHT_LOADING = 480;
97 constexpr int SPLASH_HEIGHT_ABOUT = 320;
101 splashHeight = SPLASH_HEIGHT_ABOUT;
103 splashHeight = SPLASH_HEIGHT_LOADING;
105 const int bannerHeight = splashHeight * 0.16875;
106 const int marginTop = splashHeight * 0.05;
107 const int marginRight = splashHeight * 0.1;
109 QString splashName = QStringLiteral(
":/splash/0.png");
110 QString splashArtist = QStringLiteral(
"Tyson Tan");
113 QDate currentDate = QDate::currentDate();
114 if (currentDate > QDate(currentDate.year(), 12, 4) ||
115 currentDate < QDate(currentDate.year(), 1, 9)) {
116 splashName = QStringLiteral(
":/splash/1.png");
117 splashArtist = QStringLiteral(
"???");
121 QPixmap img(splashName);
123 if (img.isNull() || img.height() == 0)
return;
126 const int height = splashHeight;
127 const int width = height * img.width() / img.height();
129 setFixedWidth(width);
130 setFixedHeight(height);
131 lblSplash->setFixedWidth(width);
132 lblSplash->setFixedHeight(height);
135 const int pixelWidth = width * devicePixelRatioF();
136 const int pixelHeight = height * devicePixelRatioF();
137 img = img.scaled(pixelWidth, pixelHeight, Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation);
138 img.setDevicePixelRatio(devicePixelRatioF());
139 lblSplash->setPixmap(img);
155 if (splashArtist.isEmpty()) {
158 m_artCreditsLabel->setText(i18nc(
"splash image credit",
"Artwork by: %1", splashArtist));
165 setFixedSize(sizeHint());
179 KConfigGroup cfg2( KSharedConfig::openConfig(),
"RecentFiles");
182 QString recent = i18n(
"<html>"
185 "<p><b><span style=\" color:%1;\">Recent Files</span></b></p>", color);
190 QFontMetrics metrics(lblRecent->font());
193 path = cfg2.readPathEntry(QString(
"File%1").arg(i), QString());
194 if (!path.isEmpty()) {
195 QString name = cfg2.readPathEntry(QString(
"Name%1").arg(i), QString());
197 if (name.isEmpty()) {
198 name = url.fileName();
201 name = metrics.elidedText(name, Qt::ElideMiddle, lblRecent->width());
203 if (!url.isLocalFile() || QFile::exists(url.toLocalFile())) {
204 recentfiles.insert(0, QString(
"<p><a href=\"%1\"><span style=\"color:%3;\">%2</span></a></p>").arg(path).arg(name).arg(color));
209 }
while (!path.isEmpty() || i <= 8);
211 recent += recentfiles.join(
"\n");
214 lblRecent->setText(recent);
222 lblLinksText <<
"<html>"
224 <<
"<body><table style=\"width:100%\" cellpadding=\"30\"><tr><td>"
225 << i18n(
"<p><span style=\" color:%1;\"><b>Using Krita</b></span></p>",color);
232 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)
233 << i18n(
"<p><a href=\"https://krita.org/\"><span style=\" text-decoration: underline; color:%1;\">Krita Website</span></a></p>",color);
237 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)
238 << i18n(
"<p><a href=\"https://docs.krita.org/\"><span style=\" text-decoration: underline; color:%1;\">Manual</span></a></p>",color)
240 << i18n(
"<p><span style=\" color:%1;\"><b>Coding Krita</b></span></p>",color)
241 << i18n(
"<p><a href=\"https://krita-artists.org\"><span style=\" text-decoration: underline; color:%1;\">User Community</span></a></p>",color)
242 << i18n(
"<p><a href=\"https://invent.kde.org/graphics/krita\"><span style=\" text-decoration: underline; color:%1;\">Source Code</span></a></p>",color)
243 << 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)
244 << i18n(
"<p><a href=\"https://scripting.krita.org/lessons/introduction\"><span style=\" text-decoration: underline; color:%1;\">Scripting School</span></a></p>",color)
245 <<
"</td></tr></table></body>"
249 lblLinks->setTextFormat(Qt::RichText);
250 lblLinks->setText(lblLinksText.join(
""));
252 filesLayout->setContentsMargins(10,10,10,10);
253 actionControlsLayout->setContentsMargins(5,5,5,5);
257 filesLayout->setContentsMargins(0,0,0,0);
258 actionControlsLayout->setContentsMargins(0,0,0,0);
261 lblLinks->setVisible(
show);
307 if (!this->parentWidget()) {
309 QWindow *windowHandle = this->windowHandle();
310 QScreen *screen = windowHandle ? windowHandle->screen() :
nullptr;
311 if (windowHandle && !screen) {
318 windowHandle->setScreen(QApplication::primaryScreen());
321 screen = QApplication::primaryScreen();
326 QRect r(QPoint(), size());
327 move(screen->availableGeometry().center() - r.center());