diff --git a/resources.qrc b/resources.qrc
index 30b751ba5..12ae87d59 100644
--- a/resources.qrc
+++ b/resources.qrc
@@ -168,5 +168,6 @@
data/www/css/font-awesome.css
data/www/css/style.css
data/www/js/html5shim.js
+ data/images/splash.svg
diff --git a/src/libtomahawk/database/DatabaseImpl.cpp b/src/libtomahawk/database/DatabaseImpl.cpp
index 6c3f0d5bd..e7cdbe1ab 100644
--- a/src/libtomahawk/database/DatabaseImpl.cpp
+++ b/src/libtomahawk/database/DatabaseImpl.cpp
@@ -222,6 +222,7 @@ Tomahawk::DatabaseImpl::updateSchema( int oldVersion )
}
else // update in place! run the proper upgrade script
{
+ emit schemaUpdateStarted();
int cur = oldVersion;
m_db.transaction();
while ( cur < CURRENT_SCHEMA_VERSION )
@@ -251,6 +252,7 @@ Tomahawk::DatabaseImpl::updateSchema( int oldVersion )
}
m_db.commit();
tLog() << "DB Upgrade successful!";
+ emit schemaUpdateDone();
return true;
}
}
diff --git a/src/libtomahawk/database/DatabaseImpl.h b/src/libtomahawk/database/DatabaseImpl.h
index b830f7614..c845c6114 100644
--- a/src/libtomahawk/database/DatabaseImpl.h
+++ b/src/libtomahawk/database/DatabaseImpl.h
@@ -86,6 +86,8 @@ public:
signals:
void indexReady();
+ void schemaUpdateStarted();
+ void schemaUpdateDone();
private:
DatabaseImpl( const QString& dbname, bool internal );
diff --git a/src/tomahawk/CMakeLists.txt b/src/tomahawk/CMakeLists.txt
index 1d18ea3e1..ba1127c30 100644
--- a/src/tomahawk/CMakeLists.txt
+++ b/src/tomahawk/CMakeLists.txt
@@ -66,6 +66,7 @@ SET( tomahawkSourcesGui ${tomahawkSourcesGui}
widgets/AccountsPopupWidget.cpp
widgets/AccountsToolButton.cpp
widgets/SlideSwitchButton.cpp
+ widgets/SplashWidget.cpp
widgets/UnstyledFrame.cpp
)
diff --git a/src/tomahawk/TomahawkApp.cpp b/src/tomahawk/TomahawkApp.cpp
index 2bceb5939..ef06245b9 100644
--- a/src/tomahawk/TomahawkApp.cpp
+++ b/src/tomahawk/TomahawkApp.cpp
@@ -69,6 +69,7 @@
#include "utils/Logger.h"
#include "utils/TomahawkUtilsGui.h"
#include "utils/TomahawkCache.h"
+#include "widgets/SplashWidget.h"
#ifndef ENABLE_HEADLESS
#include "resolvers/JSResolver.h"
@@ -148,6 +149,7 @@ TomahawkApp::TomahawkApp( int& argc, char *argv[] )
, m_mainwindow( 0 )
#endif
, m_headless( false )
+ , m_splashWidget( 0 )
{
if ( arguments().contains( "--help" ) || arguments().contains( "-h" ) )
{
@@ -181,6 +183,9 @@ TomahawkApp::init()
setWindowIcon( QIcon( RESPATH "icons/tomahawk-icon-128x128.png" ) );
setQuitOnLastWindowClosed( false );
+ if ( arguments().contains( "--splash" ) )
+ startSplashWidget( "Splash screen test" );
+
QFont f = font();
#ifdef Q_OS_MAC
f.setPointSize( f.pointSize() - 2 );
@@ -472,6 +477,12 @@ TomahawkApp::initDatabase()
tDebug( LOGEXTRA ) << "Using database:" << dbpath;
m_database = QPointer( new Tomahawk::Database( dbpath, this ) );
+
+ connect( m_database->impl(), SIGNAL( schemaUpdateStarted() ),
+ this, SLOT( startSplashWidget() ) );
+ connect( m_database->impl(), SIGNAL( schemaUpdateDone() ),
+ this, SLOT( killSplashWidget() ) );
+
Pipeline::instance()->databaseReady();
}
@@ -682,6 +693,36 @@ TomahawkApp::onInfoSystemReady()
}
+void
+TomahawkApp::startSplashWidget( const QString& initialMessage )
+{
+ tDebug() << Q_FUNC_INFO;
+ m_splashWidget = new SplashWidget();
+ m_splashWidget->showMessage( initialMessage );
+ m_splashWidget->show();
+}
+
+
+void
+TomahawkApp::updateSplashWidgetMessage( const QString& message )
+{
+
+}
+
+
+void
+TomahawkApp::killSplashWidget()
+{
+ tDebug() << Q_FUNC_INFO;
+ if ( m_splashWidget )
+ {
+ m_splashWidget->finish( mainWindow() );
+ m_splashWidget->deleteLater();
+ }
+ m_splashWidget = 0;
+}
+
+
void
TomahawkApp::ipDetectionFailed( QNetworkReply::NetworkError error, QString errorString )
{
diff --git a/src/tomahawk/TomahawkApp.h b/src/tomahawk/TomahawkApp.h
index 535861798..f58cb0811 100644
--- a/src/tomahawk/TomahawkApp.h
+++ b/src/tomahawk/TomahawkApp.h
@@ -45,6 +45,7 @@ class Servent;
class SipHandler;
class TomahawkSettings;
class AudioControls;
+class SplashWidget;
namespace Tomahawk
{
@@ -114,6 +115,10 @@ private slots:
void spotifyApiCheckFinished();
void onInfoSystemReady();
+ void startSplashWidget( const QString& initialMessage = QString() );
+ void updateSplashWidgetMessage( const QString& message );
+ void killSplashWidget();
+
void ipDetectionFailed( QNetworkReply::NetworkError error, QString errorString );
private:
@@ -145,6 +150,8 @@ private:
#endif
QPointer playdarApi;
+ SplashWidget* m_splashWidget;
+
bool m_headless;
};
diff --git a/src/tomahawk/widgets/SplashWidget.cpp b/src/tomahawk/widgets/SplashWidget.cpp
new file mode 100644
index 000000000..e5ff45bd7
--- /dev/null
+++ b/src/tomahawk/widgets/SplashWidget.cpp
@@ -0,0 +1,47 @@
+/* === This file is part of Tomahawk Player - ===
+ *
+ * Copyright 2014, Teo Mrnjavac
+ *
+ * Tomahawk is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Tomahawk is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Tomahawk. If not, see .
+ */
+
+#include "SplashWidget.h"
+
+#include "utils/TomahawkUtilsGui.h"
+#include "utils/ImageRegistry.h"
+#include "utils/DpiScaler.h"
+
+#include
+#include
+
+SplashWidget::SplashWidget()
+ : QSplashScreen()
+{
+ setPixmap( ImageRegistry::instance()->pixmap( RESPATH "images/splash.svg",
+ TomahawkUtils::DpiScaler::scaled( this, QSize( 304, 333 ) ) ) );
+
+ QFont font = this->font();
+
+ font.setPointSize( 9 );
+ font.setBold( true );
+ font.setFamily( "Titillium Web" );
+ setFont( font );
+}
+
+
+void
+SplashWidget::showMessage( const QString& message )
+{
+ QSplashScreen::showMessage( message + "\n\n", Qt::AlignBottom | Qt::AlignHCenter );
+}
diff --git a/src/tomahawk/widgets/SplashWidget.h b/src/tomahawk/widgets/SplashWidget.h
new file mode 100644
index 000000000..3b61cc438
--- /dev/null
+++ b/src/tomahawk/widgets/SplashWidget.h
@@ -0,0 +1,34 @@
+/* === This file is part of Tomahawk Player - ===
+ *
+ * Copyright 2014, Teo Mrnjavac
+ *
+ * Tomahawk is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Tomahawk is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Tomahawk. If not, see .
+ */
+
+#ifndef SPLASHWIDGET_H
+#define SPLASHWIDGET_H
+
+#include
+
+class SplashWidget : public QSplashScreen
+{
+ Q_OBJECT
+public:
+ explicit SplashWidget();
+
+ void showMessage( const QString& message );
+
+};
+
+#endif // SPLASHWIDGET_H