diff --git a/krita/kis_splash_screen.cpp b/krita/kis_splash_screen.cpp index 664babc385e6659cf8c03221c9ef353f2edc4105..efc9c6808ef39375cda3cb7944f7649e294c83b8 100644 --- a/krita/kis_splash_screen.cpp +++ b/krita/kis_splash_screen.cpp @@ -17,8 +17,73 @@ */ #include "kis_splash_screen.h" -KisSplashScreen::KisSplashScreen(QWidget *parent) : - QWidget(parent) +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +KisSplashScreen::KisSplashScreen(const QString &version, const QPixmap &pixmap, QWidget *parent, Qt::WindowFlags f) + : QWidget(parent, Qt::SplashScreen | Qt::FramelessWindowHint | f) + , version(version) + , pixmap(pixmap) { setupUi(this); + + lblSplash->setPixmap(pixmap); + bnClose->hide(); + connect(bnClose, SIGNAL(clicked()), this, SLOT(close())); + chkShowAtStartup->hide(); + connect(chkShowAtStartup, SIGNAL(toggled(bool)), this, SLOT(toggleShowAtStartup(bool))); + + KConfigGroup cfg(KGlobal::config(), "SplashScreen"); + bool hideSplash = cfg.readEntry("HideSplashAfterStartup", false); + chkShowAtStartup->setChecked(hideSplash); + + lblLinks->setTextFormat(Qt::RichText); + lblLinks->setText("" + "" + "" + "

Links

" + "

Donations

" + "

Shop

" + "

Getting Started

" + "

Website

" + "

Commercial Support

" + "

User Community

" + "

Source Code

" + "

Get Krita on Steam

" + "" + ""); + + lblVersion->setText(i18n("Version: %1", version)); +} + + +void KisSplashScreen::repaint() +{ + QWidget::repaint(); + QApplication::flush(); +} + +void KisSplashScreen::show() +{ + QRect r(QPoint(), sizeHint()); + resize(r.size()); + move(QApplication::desktop()->screenGeometry().center() - r.center()); + if (isVisible()) { + repaint(); + } + +} + +void KisSplashScreen::toggleShowAtStartup(bool toggle) +{ + KConfigGroup cfg(KGlobal::config(), "SplashScreen"); + cfg.writeEntry("HideSplashAfterStartup", toggle); } diff --git a/krita/kis_splash_screen.h b/krita/kis_splash_screen.h index 58f973b79d85bcc7047b1847090d4465295a5810..e465564a57def9dcdd976138805372c0a45acd07 100644 --- a/krita/kis_splash_screen.h +++ b/krita/kis_splash_screen.h @@ -21,16 +21,25 @@ #include #include "ui_wdgsplash.h" +class QPixmap; + class KisSplashScreen : public QWidget, public Ui::WdgSplash { Q_OBJECT public: - explicit KisSplashScreen(QWidget *parent = 0); + explicit KisSplashScreen(const QString &version, const QPixmap &pixmap, QWidget *parent = 0, Qt::WindowFlags f = 0); + + void repaint(); + + void show(); -signals: +private slots: -public slots: + void toggleShowAtStartup(bool toggle); +private: + QString version; + QPixmap pixmap; }; #endif // KIS_SPLASH_SCREEN_H diff --git a/krita/main.cc b/krita/main.cc index ea52ca6d374fc9dca1a32ff600b34b1ab5803904..15d4fd021f6baaa20aaad94491bce43d799f67f5 100644 --- a/krita/main.cc +++ b/krita/main.cc @@ -97,7 +97,7 @@ extern "C" KDE_EXPORT int kdemain(int argc, char **argv) // then create the pixmap from an xpm: we cannot get the // location of our datadir before we've started our components, // so use an xpm. - QWidget *splash = new KisSplashScreen(); + QWidget *splash = new KisSplashScreen(aboutData->version(), QPixmap(splash_screen_xpm)); app.setSplashScreen(splash); if (!app.start()) { diff --git a/krita/wdgsplash.ui b/krita/wdgsplash.ui index 312df249f60143d8377974aab686316e63a9d183..426739c05176562150beffe9ef161005e1ff2929 100644 --- a/krita/wdgsplash.ui +++ b/krita/wdgsplash.ui @@ -7,7 +7,7 @@ 0 0 440 - 525 + 571 @@ -16,43 +16,6 @@ 0 - - - - - - - 40 - 40 - 40 - - - - - - - - - 40 - 40 - 40 - - - - - - - - - 250 - 250 - 250 - - - - - - Form @@ -69,7 +32,7 @@ true - + 0 0 @@ -77,7 +40,7 @@ 440 - 0 + 286 @@ -94,7 +57,13 @@ - Version 2.8.1 (d73aa83) + TextLabel + + + Qt::AlignCenter + + + 4 @@ -107,7 +76,7 @@ 10 - 20 + 0 @@ -115,7 +84,7 @@ - <html><head/><body><p align="center">Links</p><p><a href="http://krita.org/support-krita#general"><span style=" text-decoration: underline; color:#006e28;">Donations</span></a></p><p><a href="http://www.zazzle.com/kritashop"><span style=" text-decoration: underline; color:#006e28;">Shop</span></a></p><p><a href="http://krita.org/resources"><span style=" text-decoration: underline; color:#006e28;">Getting Started</span></a></p><p><a href="http://krita.org"><span style=" text-decoration: underline; color:#006e28;">Website</span></a></p><p><a href="http://kritastudio.com"><span style=" text-decoration: underline; color:#006e28;">Commercial Support</span></a></p><p><a href="http://forum.kde.org/viewforum.php?f=136"><span style=" text-decoration: underline; color:#006e28;">User Community</span></a></p><p><a href="https://projects.kde.org/projects/calligra"><span style=" text-decoration: underline; color:#006e28;">Source Code</span></a></p></body></html> + <html><head/><body><p align="center"><span style=" font-weight:600;">Links</span></p><p><a href="http://krita.org/support-krita#general"><span style=" text-decoration: underline; color:#006e28;">Donations</span></a></p><p><a href="http://www.zazzle.com/kritashop"><span style=" text-decoration: underline; color:#006e28;">Shop</span></a></p><p><a href="http://krita.org/resources"><span style=" text-decoration: underline; color:#006e28;">Getting Started</span></a></p><p><a href="http://krita.org"><span style=" text-decoration: underline; color:#006e28;">Website</span></a></p><p><a href="http://kritastudio.com"><span style=" text-decoration: underline; color:#006e28;">Commercial Support</span></a></p><p><a href="http://forum.kde.org/viewforum.php?f=136"><span style=" text-decoration: underline; color:#006e28;">User Community</span></a></p><p><a href="https://projects.kde.org/projects/calligra"><span style=" text-decoration: underline; color:#006e28;">Source Code</span></a></p><p><a href="http://store.steampowered.com/app/280680/"><span style=" text-decoration: underline; color:#006e28;">Get Krita on Steam</span></a></p></body></html> Qt::RichText @@ -131,7 +100,7 @@ - Recent files + <html><head/><body><p align="center"><span style=" font-weight:600;">Recent files</span></p></body></html> Qt::RichText @@ -146,6 +115,42 @@ + + + + 4 + + + 2 + + + 4 + + + 10 + + + + + + 0 + 0 + + + + Hide after startup. + + + + + + + &Close + + + + + diff --git a/libs/main/KoApplication.cpp b/libs/main/KoApplication.cpp index 4428fc26ea78343c818c43b66e46610dadd0c0f4..865fd02f59ed67fec143491cfe842e86ca7a04fb 100644 --- a/libs/main/KoApplication.cpp +++ b/libs/main/KoApplication.cpp @@ -46,6 +46,9 @@ #include #include #include +#include +#include +#include #if KDE_IS_VERSION(4,6,0) #include @@ -66,6 +69,9 @@ #include #endif + +#include + KoApplication* KoApplication::KoApp = 0; namespace { @@ -93,9 +99,27 @@ public: ~ResetStarting() { if (m_splash) { - m_splash->hide(); - delete m_splash; - m_splash = 0; + + KConfigGroup cfg(KGlobal::config(), "SplashScreen"); + bool hideSplash = cfg.readEntry("HideSplashAfterStartup", false); + + if (hideSplash) { + m_splash->hide(); + } + else { + m_splash->setWindowFlags(Qt::Dialog | Qt::FramelessWindowHint); + m_splash->setWindowModality(Qt::ApplicationModal); + m_splash->setParent(qApp->activeWindow()); + QRect r(QPoint(), m_splash->size()); + m_splash->move(QApplication::desktop()->screenGeometry().center() - r.center()); + m_splash->show(); + foreach(QObject *o, m_splash->children()) { + QWidget *w = qobject_cast(o); + if (w && w->isHidden()) { + w->setVisible(true); + } + } + } } } @@ -223,7 +247,7 @@ bool KoApplication::start() if (d->splashScreen) { d->splashScreen->show(); - //d->splashScreen->showMessage("."); + d->splashScreen->repaint(); } ResetStarting resetStarting(d->splashScreen); // remove the splash when done @@ -581,6 +605,13 @@ QList KoApplication::partList() const return d->partList; } +void KoApplication::removeSplash() +{ + d->splashScreen->hide(); + delete d->splashScreen; + d->splashScreen = 0; +} + QStringList KoApplication::mimeFilter(KoFilterManager::Direction direction) const { KoDocumentEntry entry = KoDocumentEntry::queryByMimeType(d->nativeMimeType); diff --git a/libs/main/KoApplication.h b/libs/main/KoApplication.h index bac760bba9496db4218ba4c19281293c11d33199..071997f2797f45e111f97babc971efd83d05a5d3 100644 --- a/libs/main/KoApplication.h +++ b/libs/main/KoApplication.h @@ -87,6 +87,11 @@ public: QList partList() const; + /** + * Remove the splash dialog + */ + void removeSplash(); + /** * return a list of mimetypes this application supports. */