diff --git a/src/TomahawkApp.cpp b/src/TomahawkApp.cpp index 6243e11b5..1588ff886 100644 --- a/src/TomahawkApp.cpp +++ b/src/TomahawkApp.cpp @@ -290,6 +290,16 @@ TomahawkApp::init() PlaylistUpdaterInterface::registerUpdaterFactory( new XspfUpdaterFactory ); PlaylistUpdaterInterface::registerUpdaterFactory( new SpotifyUpdaterFactory ); + // Following work-around/fix taken from Clementine rev. 13e13ccd9a95 and courtesy of David Sansome + // A bug in Qt means the wheel_scroll_lines setting gets ignored and replaced + // with the default value of 3 in QApplicationPrivate::initialize. + { + QSettings qt_settings(QSettings::UserScope, "Trolltech"); + qt_settings.beginGroup("Qt"); + QApplication::setWheelScrollLines( + qt_settings.value("wheelScrollLines", QApplication::wheelScrollLines()).toInt()); + } + #ifndef ENABLE_HEADLESS // Make sure to init GAM in the gui thread GlobalActionManager::instance(); diff --git a/src/libtomahawk/AtticaManager.cpp b/src/libtomahawk/AtticaManager.cpp index 99479690c..ffed903a6 100644 --- a/src/libtomahawk/AtticaManager.cpp +++ b/src/libtomahawk/AtticaManager.cpp @@ -39,6 +39,52 @@ using namespace Attica; AtticaManager* AtticaManager::s_instance = 0; +class BinaryInstallerHelper : public QObject +{ + Q_OBJECT +public: + explicit BinaryInstallerHelper( const QString& resolverId, AtticaManager* manager) + : QObject( manager ) + , m_manager( QWeakPointer< AtticaManager >( manager ) ) + , m_resolverId( resolverId ) + { + Q_ASSERT( !m_resolverId.isEmpty() ); + Q_ASSERT( !m_manager.isNull() ); + } + + virtual ~BinaryInstallerHelper() {} + +public slots: + void extractSucceeded( const QString& path ) + { + if ( m_manager.isNull() ) + return; + + + + m_manager.data()->m_resolverStates[ m_resolverId ].state = AtticaManager::Installed; + TomahawkSettingsGui::instanceGui()->setAtticaResolverStates( m_manager.data()->m_resolverStates ); + emit m_manager.data()->resolverInstalled( m_resolverId ); + emit m_manager.data()->resolverStateChanged( m_resolverId ); + + deleteLater(); + } + void extractFailed() + { + if ( m_manager.isNull() ) + return; + + m_manager.data()->resolverInstallationFailed( m_resolverId ); + + deleteLater(); + } + +private: + QString m_resolverId; + QWeakPointer m_manager; +}; + + AtticaManager::AtticaManager( QObject* parent ) : QObject( parent ) , m_resolverJobsLoaded( 0 ) @@ -532,7 +578,7 @@ AtticaManager::payloadFetched() return; } - TomahawkUtils::extractBinaryResolver( f.fileName(), resolverId, 0 ); + TomahawkUtils::extractBinaryResolver( f.fileName(), new BinaryInstallerHelper( resolverId, this ) ); } else { @@ -650,3 +696,5 @@ AtticaManager::doResolverRemove( const QString& id ) const TomahawkUtils::removeDirectory( resolverDir.absolutePath() ); } + +#include "AtticaManager.moc" \ No newline at end of file diff --git a/src/libtomahawk/AtticaManager.h b/src/libtomahawk/AtticaManager.h index c5bf607a2..7add543d9 100644 --- a/src/libtomahawk/AtticaManager.h +++ b/src/libtomahawk/AtticaManager.h @@ -32,6 +32,7 @@ #include #include +class BinaryInstallerHelper; class DLLEXPORT AtticaManager : public QObject { @@ -139,6 +140,8 @@ private: QMap< QString, Tomahawk::Accounts::Account* > m_customAccounts; static AtticaManager* s_instance; + + friend class ::BinaryInstallerHelper; }; class DLLEXPORT CustomAtticaAccount : public Tomahawk::Accounts::Account diff --git a/src/libtomahawk/utils/TomahawkUtils.cpp b/src/libtomahawk/utils/TomahawkUtils.cpp index 9d5049ada..c5533d599 100644 --- a/src/libtomahawk/utils/TomahawkUtils.cpp +++ b/src/libtomahawk/utils/TomahawkUtils.cpp @@ -845,7 +845,7 @@ unzipFileInFolder( const QString &zipFileName, const QDir &folder ) void -extractBinaryResolver( const QString& zipFilename, const QString& resolverId, QObject* ) +extractBinaryResolver( const QString& zipFilename, QObject* ) { #if !defined(Q_OS_MAC) && !defined (Q_OS_WIN) Q_ASSERT( false ); diff --git a/src/libtomahawk/utils/TomahawkUtils.h b/src/libtomahawk/utils/TomahawkUtils.h index 7a4d5c1af..27350e3e1 100644 --- a/src/libtomahawk/utils/TomahawkUtils.h +++ b/src/libtomahawk/utils/TomahawkUtils.h @@ -115,7 +115,7 @@ namespace TomahawkUtils QStringList m_noProxyHosts; QNetworkProxy m_proxy; }; - + DLLEXPORT QString appFriendlyVersion(); @@ -138,7 +138,7 @@ namespace TomahawkUtils DLLEXPORT QString md5( const QByteArray& data ); DLLEXPORT bool removeDirectory( const QString& dir ); - + DLLEXPORT bool verifyFile( const QString& filePath, const QString& signature ); DLLEXPORT QString extractScriptPayload( const QString& filename, const QString& resolverId ); DLLEXPORT bool unzipFileInFolder( const QString& zipFileName, const QDir& folder ); @@ -146,7 +146,7 @@ namespace TomahawkUtils // Extracting may be asynchronous, pass in a receiver object with the following slots: // extractSucceeded( const QString& path ) and extractFailed() to be notified/ - DLLEXPORT void extractBinaryResolver( const QString& zipFilename, const QString& resolverId, QObject* receiver ); + DLLEXPORT void extractBinaryResolver( const QString& zipFilename, QObject* receiver ); // Used by the above, not exported void copyWithAuthentication( const QString& srcFile, const QDir dest, QObject* receiver );