1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-14 01:54:07 +02:00

Added Splash widget support.

This commit is contained in:
Teo Mrnjavac
2014-01-15 16:00:30 +01:00
parent bfcb60bd2a
commit fbed11a93d
8 changed files with 135 additions and 0 deletions

View File

@@ -168,5 +168,6 @@
<file>data/www/css/font-awesome.css</file> <file>data/www/css/font-awesome.css</file>
<file>data/www/css/style.css</file> <file>data/www/css/style.css</file>
<file>data/www/js/html5shim.js</file> <file>data/www/js/html5shim.js</file>
<file>data/images/splash.svg</file>
</qresource> </qresource>
</RCC> </RCC>

View File

@@ -222,6 +222,7 @@ Tomahawk::DatabaseImpl::updateSchema( int oldVersion )
} }
else // update in place! run the proper upgrade script else // update in place! run the proper upgrade script
{ {
emit schemaUpdateStarted();
int cur = oldVersion; int cur = oldVersion;
m_db.transaction(); m_db.transaction();
while ( cur < CURRENT_SCHEMA_VERSION ) while ( cur < CURRENT_SCHEMA_VERSION )
@@ -251,6 +252,7 @@ Tomahawk::DatabaseImpl::updateSchema( int oldVersion )
} }
m_db.commit(); m_db.commit();
tLog() << "DB Upgrade successful!"; tLog() << "DB Upgrade successful!";
emit schemaUpdateDone();
return true; return true;
} }
} }

View File

@@ -86,6 +86,8 @@ public:
signals: signals:
void indexReady(); void indexReady();
void schemaUpdateStarted();
void schemaUpdateDone();
private: private:
DatabaseImpl( const QString& dbname, bool internal ); DatabaseImpl( const QString& dbname, bool internal );

View File

@@ -66,6 +66,7 @@ SET( tomahawkSourcesGui ${tomahawkSourcesGui}
widgets/AccountsPopupWidget.cpp widgets/AccountsPopupWidget.cpp
widgets/AccountsToolButton.cpp widgets/AccountsToolButton.cpp
widgets/SlideSwitchButton.cpp widgets/SlideSwitchButton.cpp
widgets/SplashWidget.cpp
widgets/UnstyledFrame.cpp widgets/UnstyledFrame.cpp
) )

View File

@@ -69,6 +69,7 @@
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/TomahawkUtilsGui.h" #include "utils/TomahawkUtilsGui.h"
#include "utils/TomahawkCache.h" #include "utils/TomahawkCache.h"
#include "widgets/SplashWidget.h"
#ifndef ENABLE_HEADLESS #ifndef ENABLE_HEADLESS
#include "resolvers/JSResolver.h" #include "resolvers/JSResolver.h"
@@ -148,6 +149,7 @@ TomahawkApp::TomahawkApp( int& argc, char *argv[] )
, m_mainwindow( 0 ) , m_mainwindow( 0 )
#endif #endif
, m_headless( false ) , m_headless( false )
, m_splashWidget( 0 )
{ {
if ( arguments().contains( "--help" ) || arguments().contains( "-h" ) ) if ( arguments().contains( "--help" ) || arguments().contains( "-h" ) )
{ {
@@ -181,6 +183,9 @@ TomahawkApp::init()
setWindowIcon( QIcon( RESPATH "icons/tomahawk-icon-128x128.png" ) ); setWindowIcon( QIcon( RESPATH "icons/tomahawk-icon-128x128.png" ) );
setQuitOnLastWindowClosed( false ); setQuitOnLastWindowClosed( false );
if ( arguments().contains( "--splash" ) )
startSplashWidget( "Splash screen test" );
QFont f = font(); QFont f = font();
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
f.setPointSize( f.pointSize() - 2 ); f.setPointSize( f.pointSize() - 2 );
@@ -472,6 +477,12 @@ TomahawkApp::initDatabase()
tDebug( LOGEXTRA ) << "Using database:" << dbpath; tDebug( LOGEXTRA ) << "Using database:" << dbpath;
m_database = QPointer<Tomahawk::Database>( new Tomahawk::Database( dbpath, this ) ); m_database = QPointer<Tomahawk::Database>( 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(); 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 void
TomahawkApp::ipDetectionFailed( QNetworkReply::NetworkError error, QString errorString ) TomahawkApp::ipDetectionFailed( QNetworkReply::NetworkError error, QString errorString )
{ {

View File

@@ -45,6 +45,7 @@ class Servent;
class SipHandler; class SipHandler;
class TomahawkSettings; class TomahawkSettings;
class AudioControls; class AudioControls;
class SplashWidget;
namespace Tomahawk namespace Tomahawk
{ {
@@ -114,6 +115,10 @@ private slots:
void spotifyApiCheckFinished(); void spotifyApiCheckFinished();
void onInfoSystemReady(); void onInfoSystemReady();
void startSplashWidget( const QString& initialMessage = QString() );
void updateSplashWidgetMessage( const QString& message );
void killSplashWidget();
void ipDetectionFailed( QNetworkReply::NetworkError error, QString errorString ); void ipDetectionFailed( QNetworkReply::NetworkError error, QString errorString );
private: private:
@@ -145,6 +150,8 @@ private:
#endif #endif
QPointer<PlaydarApi> playdarApi; QPointer<PlaydarApi> playdarApi;
SplashWidget* m_splashWidget;
bool m_headless; bool m_headless;
}; };

View File

@@ -0,0 +1,47 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2014, Teo Mrnjavac <teo@kde.org>
*
* 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 <http://www.gnu.org/licenses/>.
*/
#include "SplashWidget.h"
#include "utils/TomahawkUtilsGui.h"
#include "utils/ImageRegistry.h"
#include "utils/DpiScaler.h"
#include <QBoxLayout>
#include <QLabel>
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 );
}

View File

@@ -0,0 +1,34 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2014, Teo Mrnjavac <teo@kde.org>
*
* 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 <http://www.gnu.org/licenses/>.
*/
#ifndef SPLASHWIDGET_H
#define SPLASHWIDGET_H
#include <QSplashScreen>
class SplashWidget : public QSplashScreen
{
Q_OBJECT
public:
explicit SplashWidget();
void showMessage( const QString& message );
};
#endif // SPLASHWIDGET_H