1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-04 21:27:58 +02: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
5 changed files with 66 additions and 5 deletions

View File

@@ -290,6 +290,16 @@ TomahawkApp::init()
PlaylistUpdaterInterface::registerUpdaterFactory( new XspfUpdaterFactory ); PlaylistUpdaterInterface::registerUpdaterFactory( new XspfUpdaterFactory );
PlaylistUpdaterInterface::registerUpdaterFactory( new SpotifyUpdaterFactory ); 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 #ifndef ENABLE_HEADLESS
// Make sure to init GAM in the gui thread // Make sure to init GAM in the gui thread
GlobalActionManager::instance(); GlobalActionManager::instance();

View File

@@ -39,6 +39,52 @@ using namespace Attica;
AtticaManager* AtticaManager::s_instance = 0; 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 ) AtticaManager::AtticaManager( QObject* parent )
: QObject( parent ) : QObject( parent )
, m_resolverJobsLoaded( 0 ) , m_resolverJobsLoaded( 0 )
@@ -532,7 +578,7 @@ AtticaManager::payloadFetched()
return; return;
} }
TomahawkUtils::extractBinaryResolver( f.fileName(), resolverId, 0 ); TomahawkUtils::extractBinaryResolver( f.fileName(), new BinaryInstallerHelper( resolverId, this ) );
} }
else else
{ {
@@ -650,3 +696,5 @@ AtticaManager::doResolverRemove( const QString& id ) const
TomahawkUtils::removeDirectory( resolverDir.absolutePath() ); TomahawkUtils::removeDirectory( resolverDir.absolutePath() );
} }
#include "AtticaManager.moc"

View File

@@ -32,6 +32,7 @@
#include <attica/providermanager.h> #include <attica/providermanager.h>
#include <attica/content.h> #include <attica/content.h>
class BinaryInstallerHelper;
class DLLEXPORT AtticaManager : public QObject class DLLEXPORT AtticaManager : public QObject
{ {
@@ -139,6 +140,8 @@ private:
QMap< QString, Tomahawk::Accounts::Account* > m_customAccounts; QMap< QString, Tomahawk::Accounts::Account* > m_customAccounts;
static AtticaManager* s_instance; static AtticaManager* s_instance;
friend class ::BinaryInstallerHelper;
}; };
class DLLEXPORT CustomAtticaAccount : public Tomahawk::Accounts::Account class DLLEXPORT CustomAtticaAccount : public Tomahawk::Accounts::Account

View File

@@ -845,7 +845,7 @@ unzipFileInFolder( const QString &zipFileName, const QDir &folder )
void void
extractBinaryResolver( const QString& zipFilename, const QString& resolverId, QObject* ) extractBinaryResolver( const QString& zipFilename, QObject* )
{ {
#if !defined(Q_OS_MAC) && !defined (Q_OS_WIN) #if !defined(Q_OS_MAC) && !defined (Q_OS_WIN)
Q_ASSERT( false ); Q_ASSERT( false );

View File

@@ -146,7 +146,7 @@ namespace TomahawkUtils
// Extracting may be asynchronous, pass in a receiver object with the following slots: // Extracting may be asynchronous, pass in a receiver object with the following slots:
// extractSucceeded( const QString& path ) and extractFailed() to be notified/ // 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 // Used by the above, not exported
void copyWithAuthentication( const QString& srcFile, const QDir dest, QObject* receiver ); void copyWithAuthentication( const QString& srcFile, const QDir dest, QObject* receiver );