1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-22 16:59:58 +01:00

Merge branch 'binaryghns' of github.com:lfranchi/tomahawk into binaryghns

This commit is contained in:
Leo Franchi 2012-05-13 20:50:02 -04:00
commit eeaba8309d
5 changed files with 66 additions and 5 deletions

View File

@ -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();

View File

@ -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<AtticaManager> 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"

View File

@ -32,6 +32,7 @@
#include <attica/providermanager.h>
#include <attica/content.h>
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

View File

@ -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 );

View File

@ -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 );