mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-04-13 04:21:51 +02:00
* Merged stable changes to master.
This commit is contained in:
commit
16fd65667f
@ -7,9 +7,15 @@ Version 0.1.0:
|
||||
music collection.
|
||||
|
||||
Version 0.0.3:
|
||||
* Fix crashes in Twitter authentication. For reals now.
|
||||
* Fix crashes in Twitter authentication.
|
||||
* Properly honor the chosen port number if a static host and port are
|
||||
marked as preferred.
|
||||
* Don't automatically try to resolve all incoming playback logs. This
|
||||
speeds up importing sources a lot.
|
||||
* Faster painting of playlists with lots of unresolved tracks.
|
||||
* The tomahawk:// protocol handler works on Windows now.
|
||||
* Fixed launching Tomahawk from Installer with administrative permissions.
|
||||
* Prefer local results when results' score is equal.
|
||||
|
||||
Version 0.0.2:
|
||||
* Don't reconnect to Jabber if the settings dialog is closed successfully
|
||||
|
@ -4,12 +4,12 @@
|
||||
; Some installer script options (comment-out options not required)
|
||||
;-----------------------------------------------------------------------------
|
||||
;!define OPTION_LICENSE_AGREEMENT
|
||||
;!define OPTION_UAC_PLUGIN_ENHANCED
|
||||
!define OPTION_UAC_PLUGIN_ENHANCED
|
||||
!define OPTION_SECTION_SC_START_MENU
|
||||
!define OPTION_SECTION_SC_DESKTOP
|
||||
!define OPTION_SECTION_SC_QUICK_LAUNCH
|
||||
!define OPTION_FINISHPAGE
|
||||
!define OPTION_FINISHPAGE_LAUNCHER
|
||||
;!define OPTION_FINISHPAGE_LAUNCHER
|
||||
!define OPTION_FINISHPAGE_RELEASE_NOTES
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
@ -58,17 +58,10 @@ InstType Full
|
||||
InstType Minimal
|
||||
CRCCheck On
|
||||
SetCompressor /SOLID lzma
|
||||
RequestExecutionLevel user ;Now using the UAC plugin.
|
||||
ReserveFile tomahawk.ini
|
||||
ReserveFile "${NSISDIR}\Plugins\InstallOptions.dll"
|
||||
|
||||
;The UAC plugin provides an elevated user.
|
||||
;Otherwise request admin level here.
|
||||
!ifdef OPTION_UAC_PLUGIN_ENHANCED
|
||||
RequestExecutionLevel user
|
||||
!else
|
||||
RequestExecutionLevel admin
|
||||
!endif
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
; Include some required header files.
|
||||
;-----------------------------------------------------------------------------
|
||||
@ -79,9 +72,7 @@ ReserveFile "${NSISDIR}\Plugins\InstallOptions.dll"
|
||||
!include Memento.nsh ;Remember user selections.
|
||||
!include WinVer.nsh ;Windows version detection.
|
||||
!include WordFunc.nsh ;Used by VersionCompare macro function.
|
||||
!ifdef OPTION_UAC_PLUGIN_ENHANCED
|
||||
!include UAC.nsh ;Used by the UAC elevation to install as user or admin.
|
||||
!endif
|
||||
!include UAC.nsh ;Used by the UAC elevation to install as user or admin.
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
; Memento selections stored in registry.
|
||||
@ -146,18 +137,12 @@ UninstPage custom un.UnPageUserAppData un.UnPageUserAppDataLeave
|
||||
##############################################################################
|
||||
|
||||
Function LaunchTomahawk
|
||||
!ifdef OPTION_UAC_PLUGIN_ENHANCED
|
||||
${UAC.CallFunctionAsUser} LaunchTomahawkAsUser
|
||||
!else
|
||||
Exec "$INSTDIR\tomahawk.exe"
|
||||
!endif
|
||||
${UAC.CallFunctionAsUser} LaunchTomahawkAsUser
|
||||
FunctionEnd
|
||||
|
||||
!ifdef OPTION_UAC_PLUGIN_ENHANCED
|
||||
Function LaunchTomahawkAsUser
|
||||
Exec "$INSTDIR\tomahawk.exe"
|
||||
FunctionEnd
|
||||
!endif
|
||||
|
||||
##############################################################################
|
||||
# #
|
||||
@ -189,14 +174,9 @@ FunctionEnd
|
||||
no_process_${processName}_to_end:
|
||||
!macroend
|
||||
|
||||
!macro EnsureTomahawkShutdown un
|
||||
Function ${un}EnsureTomahawkShutdown
|
||||
!insertmacro CheckAndConfirmEndProcess "tomahawk.exe"
|
||||
FunctionEnd
|
||||
!macroend
|
||||
|
||||
!insertmacro EnsureTomahawkShutdown ""
|
||||
!insertmacro EnsureTomahawkShutdown "un."
|
||||
Function EnsureTomahawkShutdown
|
||||
!insertmacro CheckAndConfirmEndProcess "tomahawk.exe"
|
||||
FunctionEnd
|
||||
|
||||
##############################################################################
|
||||
# #
|
||||
@ -265,12 +245,10 @@ Function PageLeaveReinstall
|
||||
Delete $R1
|
||||
RMDir $INSTDIR
|
||||
no_remove_uninstaller:
|
||||
StrCmp $R0 "2" +2 0
|
||||
StrCmp $R0 "2" 0 +3
|
||||
UAC::Unload
|
||||
Quit
|
||||
BringToFront
|
||||
!ifdef OPTION_UAC_PLUGIN_ENHANCED
|
||||
UAC::Unload
|
||||
Quit
|
||||
!endif
|
||||
reinst_done:
|
||||
FunctionEnd
|
||||
|
||||
@ -385,7 +363,7 @@ SectionGroup "Shortcuts"
|
||||
CreateShortCut "$SMPROGRAMS\Tomahawk\LICENSE.lnk" "$INSTDIR\LICENSE.txt"
|
||||
CreateShortCut "$SMPROGRAMS\Tomahawk\Tomahawk.lnk" "$INSTDIR\tomahawk.exe"
|
||||
CreateShortCut "$SMPROGRAMS\Tomahawk\Release notes.lnk" "$INSTDIR\NOTES.txt"
|
||||
CreateShortCut "$SMPROGRAMS\Tomahawk\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
|
||||
CreateShortCut "$SMPROGRAMS\Tomahawk\Uninstall.lnk" "$INSTDIR\uninstall.exe"
|
||||
SetShellVarContext current
|
||||
${MementoSectionEnd}
|
||||
!endif
|
||||
@ -429,7 +407,7 @@ Section -post
|
||||
SetDetailsPrint textonly
|
||||
DetailPrint "Writing Uninstaller"
|
||||
SetDetailsPrint listonly
|
||||
WriteUninstaller $INSTDIR\Uninstall.exe
|
||||
WriteUninstaller $INSTDIR\uninstall.exe
|
||||
|
||||
;Registry keys required for installer version handling and uninstaller.
|
||||
SetDetailsPrint textonly
|
||||
@ -573,27 +551,25 @@ Function .onInit
|
||||
|
||||
${MementoSectionRestore}
|
||||
|
||||
!ifdef OPTION_UAC_PLUGIN_ENHANCED
|
||||
UAC_Elevate:
|
||||
UAC::RunElevated
|
||||
StrCmp 1223 $0 UAC_ElevationAborted ; UAC dialog aborted by user?
|
||||
StrCmp 0 $0 0 UAC_Err ; Error?
|
||||
StrCmp 1 $1 0 UAC_Success ;Are we the real deal or just the wrapper?
|
||||
Quit
|
||||
UAC_Elevate:
|
||||
UAC::RunElevated
|
||||
StrCmp 1223 $0 UAC_ElevationAborted ; UAC dialog aborted by user?
|
||||
StrCmp 0 $0 0 UAC_Err ; Error?
|
||||
StrCmp 1 $1 0 UAC_Success ;Are we the real deal or just the wrapper?
|
||||
Quit
|
||||
|
||||
UAC_Err:
|
||||
MessageBox MB_ICONSTOP "Unable to elevate, error $0"
|
||||
Abort
|
||||
UAC_Err:
|
||||
MessageBox MB_ICONSTOP "Unable to elevate, error $0"
|
||||
Abort
|
||||
|
||||
UAC_ElevationAborted:
|
||||
Abort
|
||||
UAC_ElevationAborted:
|
||||
Abort
|
||||
|
||||
UAC_Success:
|
||||
StrCmp 1 $3 +4 ;Admin?
|
||||
StrCmp 3 $1 0 UAC_ElevationAborted ;Try again?
|
||||
MessageBox MB_ICONSTOP "This installer requires admin access, try again"
|
||||
goto UAC_Elevate
|
||||
!endif
|
||||
UAC_Success:
|
||||
StrCmp 1 $3 +4 ;Admin?
|
||||
StrCmp 3 $1 0 UAC_ElevationAborted ;Try again?
|
||||
MessageBox MB_ICONSTOP "This installer requires admin access, try again"
|
||||
goto UAC_Elevate
|
||||
|
||||
;Prevent multiple instances.
|
||||
System::Call 'kernel32::CreateMutexA(i 0, i 0, t "tomahawkInstaller") i .r1 ?e'
|
||||
@ -615,15 +591,11 @@ FunctionEnd
|
||||
|
||||
Function .onInstSuccess
|
||||
${MementoSectionSave}
|
||||
!ifdef OPTION_UAC_PLUGIN_ENHANCED
|
||||
UAC::Unload ;Must call unload!
|
||||
!endif
|
||||
UAC::Unload ;Must call unload!
|
||||
FunctionEnd
|
||||
|
||||
Function .onInstFailed
|
||||
!ifdef OPTION_UAC_PLUGIN_ENHANCED
|
||||
UAC::Unload ;Must call unload!
|
||||
!endif
|
||||
UAC::Unload ;Must call unload!
|
||||
FunctionEnd
|
||||
|
||||
##############################################################################
|
||||
@ -633,27 +605,25 @@ FunctionEnd
|
||||
##############################################################################
|
||||
|
||||
Function un.onInit
|
||||
!ifdef OPTION_UAC_PLUGIN_ENHANCED
|
||||
UAC_Elevate:
|
||||
UAC::RunElevated
|
||||
StrCmp 1223 $0 UAC_ElevationAborted ; UAC dialog aborted by user?
|
||||
StrCmp 0 $0 0 UAC_Err ; Error?
|
||||
StrCmp 1 $1 0 UAC_Success ;Are we the real deal or just the wrapper?
|
||||
Quit
|
||||
UAC_Elevate:
|
||||
UAC::RunElevated
|
||||
StrCmp 1223 $0 UAC_ElevationAborted ; UAC dialog aborted by user?
|
||||
StrCmp 0 $0 0 UAC_Err ; Error?
|
||||
StrCmp 1 $1 0 UAC_Success ;Are we the real deal or just the wrapper?
|
||||
Quit
|
||||
|
||||
UAC_Err:
|
||||
MessageBox MB_ICONSTOP "Unable to elevate, error $0"
|
||||
Abort
|
||||
UAC_Err:
|
||||
MessageBox MB_ICONSTOP "Unable to elevate, error $0"
|
||||
Abort
|
||||
|
||||
UAC_ElevationAborted:
|
||||
Abort
|
||||
UAC_ElevationAborted:
|
||||
Abort
|
||||
|
||||
UAC_Success:
|
||||
StrCmp 1 $3 +4 ;Admin?
|
||||
StrCmp 3 $1 0 UAC_ElevationAborted ;Try again?
|
||||
MessageBox MB_ICONSTOP "This uninstaller requires admin access, try again"
|
||||
goto UAC_Elevate
|
||||
!endif
|
||||
UAC_Success:
|
||||
StrCmp 1 $3 +4 ;Admin?
|
||||
StrCmp 3 $1 0 UAC_ElevationAborted ;Try again?
|
||||
MessageBox MB_ICONSTOP "This uninstaller requires admin access, try again"
|
||||
goto UAC_Elevate
|
||||
|
||||
;Prevent multiple instances.
|
||||
System::Call 'kernel32::CreateMutexA(i 0, i 0, t "tomahawkUninstaller") i .r1 ?e'
|
||||
@ -664,13 +634,9 @@ Function un.onInit
|
||||
FunctionEnd
|
||||
|
||||
Function un.onUnInstSuccess
|
||||
!ifdef OPTION_UAC_PLUGIN_ENHANCED
|
||||
UAC::Unload ;Must call unload!
|
||||
!endif
|
||||
UAC::Unload ;Must call unload!
|
||||
FunctionEnd
|
||||
|
||||
Function un.onUnInstFailed
|
||||
!ifdef OPTION_UAC_PLUGIN_ENHANCED
|
||||
UAC::Unload ;Must call unload!
|
||||
!endif
|
||||
UAC::Unload ;Must call unload!
|
||||
FunctionEnd
|
||||
|
@ -52,9 +52,9 @@ DatabaseCommand_LoadDynamicPlaylist::exec( DatabaseImpl* dbi )
|
||||
QList< QVariantMap > controls;
|
||||
QString playlist_guid;
|
||||
qDebug() << "Loading controls..." << revisionGuid();
|
||||
qDebug() << "SELECT playlist_revision.playlist, controls, plmode, pltype "
|
||||
"FROM dynamic_playlist_revision, playlist_revision "
|
||||
"WHERE dynamic_playlist_revision.guid = "<< revisionGuid() << " AND playlist_revision.guid = dynamic_playlist_revision.guid";
|
||||
// qDebug() << "SELECT playlist_revision.playlist, controls, plmode, pltype "
|
||||
// "FROM dynamic_playlist_revision, playlist_revision "
|
||||
// "WHERE dynamic_playlist_revision.guid = "<< revisionGuid() << " AND playlist_revision.guid = dynamic_playlist_revision.guid";
|
||||
if( controlsQuery.first() )
|
||||
{
|
||||
playlist_guid = controlsQuery.value( 0 ).toString();
|
||||
|
@ -45,7 +45,7 @@ DatabaseCommand_LoadPlaylistEntries::generateEntries( DatabaseImpl* dbi )
|
||||
query_entries.bindValue( ":guid", m_revguid );
|
||||
query_entries.exec();
|
||||
|
||||
qDebug() << "trying to load entries:" << m_revguid;
|
||||
// qDebug() << "trying to load entries:" << m_revguid;
|
||||
QString prevrev;
|
||||
QJson::Parser parser; bool ok;
|
||||
|
||||
@ -55,7 +55,6 @@ DatabaseCommand_LoadPlaylistEntries::generateEntries( DatabaseImpl* dbi )
|
||||
QVariant v = parser.parse( query_entries.value(0).toByteArray(), &ok );
|
||||
Q_ASSERT( ok && v.type() == QVariant::List ); //TODO
|
||||
m_guids = v.toStringList();
|
||||
// qDebug() << "Entries:" << guids;
|
||||
|
||||
QString inclause = QString("('%1')").arg(m_guids.join("', '"));
|
||||
|
||||
@ -115,5 +114,5 @@ DatabaseCommand_LoadPlaylistEntries::generateEntries( DatabaseImpl* dbi )
|
||||
m_islatest = query_entries_old.value( 1 ).toBool();
|
||||
}
|
||||
|
||||
qDebug() << Q_FUNC_INFO << "entrymap:" << m_entrymap;
|
||||
// qDebug() << Q_FUNC_INFO << "entrymap:" << m_entrymap;
|
||||
}
|
||||
|
@ -62,16 +62,12 @@ Connection::Connection( Servent* parent )
|
||||
|
||||
Connection::~Connection()
|
||||
{
|
||||
qDebug() << "DTOR connection (super)" << id() << thread();
|
||||
qDebug() << "DTOR connection (super)" << id() << thread() << m_sock.isNull();
|
||||
if( !m_sock.isNull() )
|
||||
{
|
||||
qDebug() << "deleteLatering sock" << m_sock;
|
||||
// qDebug() << "deleteLatering sock" << m_sock;
|
||||
m_sock->deleteLater();
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << "no valid sock to delete";
|
||||
}
|
||||
|
||||
delete m_statstimer;
|
||||
}
|
||||
@ -118,7 +114,7 @@ Connection::setFirstMessage( msg_ptr m )
|
||||
void
|
||||
Connection::shutdown( bool waitUntilSentAll )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << waitUntilSentAll;
|
||||
qDebug() << Q_FUNC_INFO << waitUntilSentAll << id();
|
||||
if ( m_do_shutdown )
|
||||
{
|
||||
//qDebug() << id() << " already shutting down";
|
||||
@ -128,7 +124,7 @@ Connection::shutdown( bool waitUntilSentAll )
|
||||
m_do_shutdown = true;
|
||||
if ( !waitUntilSentAll )
|
||||
{
|
||||
qDebug() << "Shutting down immediately " << id();
|
||||
// qDebug() << "Shutting down immediately " << id();
|
||||
actualShutdown();
|
||||
}
|
||||
else
|
||||
@ -146,10 +142,9 @@ Connection::shutdown( bool waitUntilSentAll )
|
||||
void
|
||||
Connection::actualShutdown()
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
qDebug() << Q_FUNC_INFO << m_actually_shutting_down << id();
|
||||
if( m_actually_shutting_down )
|
||||
{
|
||||
qDebug() << "(already actually shutting down)";
|
||||
return;
|
||||
}
|
||||
m_actually_shutting_down = true;
|
||||
@ -159,7 +154,7 @@ Connection::actualShutdown()
|
||||
m_sock->disconnectFromHost();
|
||||
}
|
||||
|
||||
qDebug() << "EMITTING finished()";
|
||||
// qDebug() << "EMITTING finished()";
|
||||
emit finished();
|
||||
}
|
||||
|
||||
|
@ -75,6 +75,13 @@ ControlConnection::setup()
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << id() << name();
|
||||
|
||||
if ( !m_source.isNull() )
|
||||
{
|
||||
qDebug() << "This source seems to be online already.";
|
||||
Q_ASSERT( false );
|
||||
return;
|
||||
}
|
||||
|
||||
QString friendlyName;
|
||||
if ( Servent::isIPWhitelisted( m_sock->peerAddress() ) )
|
||||
{
|
||||
@ -85,7 +92,7 @@ ControlConnection::setup()
|
||||
}
|
||||
else
|
||||
friendlyName = name();
|
||||
|
||||
|
||||
// setup source and remote collection for this peer
|
||||
m_source = SourceList::instance()->get( id(), friendlyName );
|
||||
m_source->setControlConnection( this );
|
||||
|
@ -75,7 +75,7 @@ DBSyncConnection::~DBSyncConnection()
|
||||
void
|
||||
DBSyncConnection::idleTimeout()
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << "*************";
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
shutdown( true );
|
||||
}
|
||||
|
||||
@ -87,11 +87,6 @@ DBSyncConnection::changeState( State newstate )
|
||||
m_state = newstate;
|
||||
qDebug() << "DBSYNC State changed from" << s << "to" << newstate;
|
||||
emit stateChanged( newstate, s, "" );
|
||||
|
||||
if ( newstate == SYNCED )
|
||||
{
|
||||
qDebug() << "Synced :)";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -197,7 +192,7 @@ DBSyncConnection::handleMsg( msg_ptr msg )
|
||||
msg->is( Msg::DBOP ) &&
|
||||
msg->payload() == "ok" )
|
||||
{
|
||||
qDebug() << "No ops to apply, we are synced.";
|
||||
// qDebug() << "No ops to apply, we are synced.";
|
||||
changeState( SYNCED );
|
||||
// calc the collection stats, to updates the "X tracks" in the sidebar etc
|
||||
// this is done automatically if you run a dbcmd to add files.
|
||||
|
@ -102,7 +102,7 @@ Pipeline::resolve( const QList<query_ptr>& qlist, bool prioritized )
|
||||
int i = 0;
|
||||
foreach( const query_ptr& q, qlist )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << (qlonglong)q.data() << q->toString();
|
||||
// qDebug() << Q_FUNC_INFO << (qlonglong)q.data() << q->toString();
|
||||
if ( !m_qids.contains( q->id() ) )
|
||||
{
|
||||
m_qids.insert( q->id(), q );
|
||||
@ -189,7 +189,7 @@ Pipeline::reportResults( QID qid, const QList< result_ptr >& results )
|
||||
if ( decQIDState( q ) == 0 )
|
||||
{
|
||||
// All resolvers have reported back their results for this query now
|
||||
qDebug() << "Finished resolving:" << q->toString();
|
||||
qDebug() << "Finished resolving:" << q->toString() << q->numResults();
|
||||
|
||||
if ( !q->solved() )
|
||||
q->onResolvingFinished();
|
||||
@ -216,7 +216,7 @@ Pipeline::shuntNext()
|
||||
return;
|
||||
}
|
||||
|
||||
qDebug() << Q_FUNC_INFO << m_qidsState.count();
|
||||
// qDebug() << Q_FUNC_INFO << m_qidsState.count();
|
||||
// Check if we are ready to dispatch more queries
|
||||
if ( m_qidsState.count() >= CONCURRENT_QUERIES )
|
||||
return;
|
||||
@ -246,8 +246,8 @@ Pipeline::shunt( const query_ptr& q )
|
||||
|
||||
if ( q->solved() )
|
||||
{
|
||||
qDebug() << "Query solved, pipeline aborted:" << q->toString()
|
||||
<< "numresults:" << q->results().length();
|
||||
// qDebug() << "Query solved, pipeline aborted:" << q->toString()
|
||||
// << "numresults:" << q->results().length();
|
||||
|
||||
QList< result_ptr > rl;
|
||||
reportResults( q->id(), rl );
|
||||
@ -275,7 +275,7 @@ Pipeline::shunt( const query_ptr& q )
|
||||
lasttimeout = r->timeout();
|
||||
|
||||
// resolvers aren't allowed to block in this call:
|
||||
qDebug() << "Dispatching to resolver" << r->name();
|
||||
qDebug() << "Dispatching to resolver" << r->name() << q->toString();
|
||||
|
||||
thisResolver = i;
|
||||
r->resolve( q );
|
||||
@ -291,7 +291,7 @@ Pipeline::shunt( const query_ptr& q )
|
||||
if ( thisResolver < m_resolvers.count() )
|
||||
{
|
||||
incQIDState( q );
|
||||
qDebug() << "Shunting in" << lasttimeout << "ms, q:" << q->toString();
|
||||
// qDebug() << "Shunting in" << lasttimeout << "ms, q:" << q->toString();
|
||||
new FuncTimeout( lasttimeout, boost::bind( &Pipeline::shunt, this, q ) );
|
||||
}
|
||||
}
|
||||
@ -329,7 +329,7 @@ Pipeline::incQIDState( const Tomahawk::query_ptr& query )
|
||||
state = m_qidsState.value( query->id() ) + 1;
|
||||
}
|
||||
|
||||
qDebug() << Q_FUNC_INFO << "inserting to qidsstate:" << query->id() << state;
|
||||
// qDebug() << Q_FUNC_INFO << "inserting to qidsstate:" << query->id() << state;
|
||||
m_qidsState.insert( query->id(), state );
|
||||
|
||||
return state;
|
||||
@ -344,12 +344,12 @@ Pipeline::decQIDState( const Tomahawk::query_ptr& query )
|
||||
int state = m_qidsState.value( query->id() ) - 1;
|
||||
if ( state )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << "replacing" << query->id() << state;
|
||||
// qDebug() << Q_FUNC_INFO << "replacing" << query->id() << state;
|
||||
m_qidsState.insert( query->id(), state );
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << "removing" << query->id() << state;
|
||||
// qDebug() << Q_FUNC_INFO << "removing" << query->id() << state;
|
||||
m_qidsState.remove( query->id() );
|
||||
}
|
||||
|
||||
|
@ -112,7 +112,7 @@ Playlist::Playlist( const source_ptr& src,
|
||||
, m_lastmodified( lastmod )
|
||||
, m_shared( shared )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << "1";
|
||||
// qDebug() << Q_FUNC_INFO << "1";
|
||||
init();
|
||||
}
|
||||
|
||||
|
@ -253,8 +253,8 @@ DynamicPlaylist::reportCreated( const Tomahawk::dynplaylist_ptr& self )
|
||||
Q_ASSERT( !author().isNull() );
|
||||
Q_ASSERT( !author()->collection().isNull() );
|
||||
// will emit Collection::playlistCreated(...)
|
||||
qDebug() << "Creating dynplaylist belonging to:" << author().data() << author().isNull();
|
||||
qDebug() << "REPORTING DYNAMIC PLAYLIST CREATED:" << this << author()->friendlyName();
|
||||
// qDebug() << "Creating dynplaylist belonging to:" << author().data() << author().isNull();
|
||||
// qDebug() << "REPORTING DYNAMIC PLAYLIST CREATED:" << this << author()->friendlyName();
|
||||
author()->collection()->addDynamicPlaylist( self );
|
||||
}
|
||||
|
||||
@ -431,7 +431,7 @@ QList< dyncontrol_ptr > DynamicPlaylist::variantsToControl( const QList< QVarian
|
||||
QList<dyncontrol_ptr> realControls;
|
||||
foreach( QVariantMap controlV, controlsV ) {
|
||||
dyncontrol_ptr control = GeneratorFactory::createControl( controlV.value( "type" ).toString(), controlV.value( "selectedType" ).toString() );
|
||||
qDebug() << "CReating control with data:" << controlV;
|
||||
qDebug() << "Creating control with data:" << controlV;
|
||||
QJson::QObjectHelper::qvariant2qobject( controlV, control.data() );
|
||||
realControls << control;
|
||||
}
|
||||
|
@ -72,14 +72,21 @@ PlaylistItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& opti
|
||||
if ( !item || item->query().isNull() )
|
||||
return;
|
||||
|
||||
float opacity = 0.0;
|
||||
painter->save();
|
||||
if ( item->query()->results().count() )
|
||||
painter->setOpacity( item->query()->results().at( 0 )->score() );
|
||||
else
|
||||
painter->setOpacity( 0.0 );
|
||||
opacity = item->query()->results().first()->score();
|
||||
|
||||
if ( painter->opacity() < 0.3 )
|
||||
painter->setOpacity( 0.3 );
|
||||
QColor textcol, bgcol;
|
||||
textcol = option.palette.color( QPalette::Foreground );
|
||||
bgcol = option.palette.color( QPalette::Background );
|
||||
|
||||
opacity = qMax( (float)0.3, opacity );
|
||||
int r = textcol.red(), g = textcol.green(), b = textcol.blue();
|
||||
r = opacity * r + ( 1 - opacity ) * bgcol.red();
|
||||
g = opacity * g + ( 1 - opacity ) * bgcol.green();
|
||||
b = opacity * b + ( 1 - opacity ) * bgcol.blue();
|
||||
textcol = QColor( r, g, b );
|
||||
|
||||
if ( item->isPlaying() )
|
||||
{
|
||||
@ -113,7 +120,14 @@ PlaylistItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& opti
|
||||
}
|
||||
else
|
||||
{
|
||||
QStyledItemDelegate::paint( painter, option, index );
|
||||
if ( const QStyleOptionViewItem *vioption = qstyleoption_cast<const QStyleOptionViewItem *>(&option))
|
||||
{
|
||||
QStyleOptionViewItemV4 o( *vioption );
|
||||
o.palette.setColor( QPalette::Text, textcol );
|
||||
QStyledItemDelegate::paint( painter, o, index );
|
||||
}
|
||||
else
|
||||
QStyledItemDelegate::paint( painter, option, index );
|
||||
}
|
||||
|
||||
painter->restore();
|
||||
|
@ -63,7 +63,7 @@ Query::addResults( const QList< Tomahawk::result_ptr >& newresults )
|
||||
{
|
||||
bool becameSolved = false;
|
||||
{
|
||||
// QMutexLocker lock( &m_mut );
|
||||
QMutexLocker lock( &m_mutex );
|
||||
m_results.append( newresults );
|
||||
qStableSort( m_results.begin(), m_results.end(), Query::resultSorter );
|
||||
|
||||
@ -101,7 +101,7 @@ void
|
||||
Query::removeResult( const Tomahawk::result_ptr& result )
|
||||
{
|
||||
{
|
||||
// QMutexLocker lock( &m_mut );
|
||||
QMutexLocker lock( &m_mutex );
|
||||
m_results.removeAll( result );
|
||||
}
|
||||
|
||||
@ -121,7 +121,7 @@ Query::onResolvingFinished()
|
||||
QList< result_ptr >
|
||||
Query::results() const
|
||||
{
|
||||
// QMutexLocker lock( &m_mut );
|
||||
QMutexLocker lock( &m_mutex );
|
||||
return m_results;
|
||||
}
|
||||
|
||||
@ -129,7 +129,7 @@ Query::results() const
|
||||
unsigned int
|
||||
Query::numResults() const
|
||||
{
|
||||
// QMutexLocker lock( &m_mut );
|
||||
QMutexLocker lock( &m_mutex );
|
||||
return m_results.length();
|
||||
}
|
||||
|
||||
@ -149,7 +149,18 @@ Query::id() const
|
||||
bool
|
||||
Query::resultSorter( const result_ptr& left, const result_ptr& right )
|
||||
{
|
||||
return left->score() > right->score();
|
||||
const float ls = left->score();
|
||||
const float rs = right->score();
|
||||
|
||||
if ( ls == rs )
|
||||
{
|
||||
if ( !left->collection().isNull() && left->collection()->source()->isLocal() )
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
return ls > rs;
|
||||
}
|
||||
|
||||
|
||||
|
@ -116,6 +116,8 @@ private:
|
||||
QString m_track;
|
||||
int m_duration;
|
||||
QString m_resultHint;
|
||||
|
||||
mutable QMutex m_mutex;
|
||||
};
|
||||
|
||||
}; //ns
|
||||
|
@ -30,7 +30,7 @@
|
||||
using namespace Tomahawk;
|
||||
|
||||
|
||||
Source::Source( int id, const QString &username )
|
||||
Source::Source( int id, const QString& username )
|
||||
: QObject()
|
||||
, m_isLocal( false )
|
||||
, m_online( false )
|
||||
@ -38,7 +38,7 @@ Source::Source( int id, const QString &username )
|
||||
, m_id( id )
|
||||
, m_cc( 0 )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
qDebug() << Q_FUNC_INFO << id << username;
|
||||
|
||||
if ( id == 0 )
|
||||
{
|
||||
@ -146,6 +146,7 @@ Source::setOnline()
|
||||
{
|
||||
if ( m_online )
|
||||
return;
|
||||
m_online = true;
|
||||
|
||||
// ensure username is in the database
|
||||
DatabaseCommand_addSource* cmd = new DatabaseCommand_addSource( m_username, m_friendlyname );
|
||||
@ -153,7 +154,6 @@ Source::setOnline()
|
||||
SLOT( dbLoaded( unsigned int, const QString& ) ) );
|
||||
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>(cmd) );
|
||||
|
||||
m_online = true;
|
||||
emit online();
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ AnimatedSplitter::hide( int index, bool animate )
|
||||
|
||||
emit hidden( w );
|
||||
w->setMinimumHeight( minHeight );
|
||||
qDebug() << "animating to:" << w->height() << "from" << minHeight;
|
||||
// qDebug() << "animating to:" << w->height() << "from" << minHeight;
|
||||
|
||||
m_animateForward = false;
|
||||
if ( animate )
|
||||
|
@ -17,6 +17,8 @@
|
||||
*/
|
||||
|
||||
#include "tomahawk/tomahawkapp.h"
|
||||
|
||||
#include "kdsingleapplicationguard/kdsingleapplicationguard.h"
|
||||
#include <QTranslator>
|
||||
|
||||
#ifdef Q_WS_MAC
|
||||
@ -25,9 +27,7 @@
|
||||
static pascal OSErr appleEventHandler( const AppleEvent*, AppleEvent*, long );
|
||||
#endif
|
||||
|
||||
#include <exception>
|
||||
|
||||
#include "kdsingleapplicationguard/kdsingleapplicationguard.h"
|
||||
|
||||
int
|
||||
main( int argc, char *argv[] )
|
||||
{
|
||||
@ -39,7 +39,6 @@ main( int argc, char *argv[] )
|
||||
// used for url handler
|
||||
AEEventHandlerUPP h = AEEventHandlerUPP( appleEventHandler );
|
||||
AEInstallEventHandler( 'GURL', 'GURL', h, 0, false );
|
||||
|
||||
#endif
|
||||
|
||||
TomahawkApp a( argc, argv );
|
||||
@ -52,9 +51,9 @@ main( int argc, char *argv[] )
|
||||
translator.load( QString( ":/lang/tomahawk_" ) + locale );
|
||||
a.installTranslator( &translator );
|
||||
return a.exec();
|
||||
|
||||
}
|
||||
|
||||
|
||||
#ifdef Q_WS_MAC
|
||||
static pascal OSErr
|
||||
appleEventHandler( const AppleEvent* e, AppleEvent*, long )
|
||||
|
@ -163,8 +163,6 @@ MusicScanner::startScan()
|
||||
DatabaseCommand_DirMtimes* cmd = new DatabaseCommand_DirMtimes( TomahawkSettings::instance()->scannerPaths() );
|
||||
connect( cmd, SIGNAL( done( QMap<QString, unsigned int> ) ),
|
||||
SLOT( setMtimes( QMap<QString, unsigned int> ) ) );
|
||||
connect( cmd, SIGNAL( done( QMap<QString, unsigned int> ) ),
|
||||
SLOT( scan() ) );
|
||||
|
||||
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>(cmd) );
|
||||
}
|
||||
@ -173,7 +171,9 @@ MusicScanner::startScan()
|
||||
void
|
||||
MusicScanner::setMtimes( const QMap<QString, unsigned int>& m )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << m.count();
|
||||
m_dirmtimes = m;
|
||||
scan();
|
||||
}
|
||||
|
||||
|
||||
|
@ -32,81 +32,11 @@ QtScriptResolver::QtScriptResolver( const QString& scriptPath )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << scriptPath;
|
||||
|
||||
m_thread = new ScriptThread( scriptPath, this );
|
||||
connect( m_thread, SIGNAL( engineFound( QString, unsigned int, unsigned int, unsigned int ) ),
|
||||
SLOT( onEngineFound( QString, unsigned int, unsigned int, unsigned int ) ) );
|
||||
|
||||
m_thread->start();
|
||||
|
||||
connect( this, SIGNAL( destroyed( QObject* ) ), m_thread, SLOT( deleteLater() ) );
|
||||
}
|
||||
|
||||
|
||||
QtScriptResolver::~QtScriptResolver()
|
||||
{
|
||||
Tomahawk::Pipeline::instance()->removeResolver( this );
|
||||
delete m_thread;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
QtScriptResolver::resolve( const Tomahawk::query_ptr& query )
|
||||
{
|
||||
m_thread->resolve( query );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
QtScriptResolver::onEngineFound( const QString& name, unsigned int weight, unsigned int timeout, unsigned int preference )
|
||||
{
|
||||
m_name = name;
|
||||
m_weight = weight;
|
||||
m_timeout = timeout;
|
||||
m_preference = preference;
|
||||
|
||||
qDebug() << "QTSCRIPT" << filePath() << "READY," << endl
|
||||
<< "name" << m_name << endl
|
||||
<< "weight" << m_weight << endl
|
||||
<< "timeout" << m_timeout << endl
|
||||
<< "preference" << m_preference;
|
||||
|
||||
m_ready = true;
|
||||
Tomahawk::Pipeline::instance()->addResolver( this );
|
||||
}
|
||||
|
||||
|
||||
ScriptThread::ScriptThread( const QString& scriptPath, QtScriptResolver* parent )
|
||||
: QThread()
|
||||
, m_parent( parent )
|
||||
, m_scriptPath( scriptPath )
|
||||
{
|
||||
moveToThread( this );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ScriptThread::resolve( const Tomahawk::query_ptr& query )
|
||||
{
|
||||
m_engine->resolve( query );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ScriptThread::run()
|
||||
{
|
||||
QTimer::singleShot( 0, this, SLOT( initEngine() ) );
|
||||
exec();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ScriptThread::initEngine()
|
||||
{
|
||||
m_engine = new ScriptEngine( m_parent, this );
|
||||
QFile scriptFile( m_scriptPath );
|
||||
m_engine = new ScriptEngine( this );
|
||||
QFile scriptFile( scriptPath );
|
||||
if ( !scriptFile.open( QIODevice::ReadOnly ) )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << "Failed loading JavaScript resolver:" << m_scriptPath;
|
||||
qDebug() << Q_FUNC_INFO << "Failed loading JavaScript resolver:" << scriptPath;
|
||||
deleteLater();
|
||||
return;
|
||||
}
|
||||
@ -115,42 +45,39 @@ ScriptThread::initEngine()
|
||||
m_engine->mainFrame()->evaluateJavaScript( scriptFile.readAll() );
|
||||
scriptFile.close();
|
||||
|
||||
QString name;
|
||||
unsigned int weight, preference, timeout;
|
||||
QVariantMap m = m_engine->mainFrame()->evaluateJavaScript( "getSettings();" ).toMap();
|
||||
name = m.value( "name" ).toString();
|
||||
weight = m.value( "weight", 0 ).toUInt();
|
||||
timeout = m.value( "timeout", 25 ).toUInt() * 1000;
|
||||
preference = m.value( "preference", 0 ).toUInt();
|
||||
m_name = m.value( "name" ).toString();
|
||||
m_weight = m.value( "weight", 0 ).toUInt();
|
||||
m_timeout = m.value( "timeout", 25 ).toUInt() * 1000;
|
||||
m_preference = m.value( "preference", 0 ).toUInt();
|
||||
|
||||
qDebug() << Q_FUNC_INFO << name << weight << timeout << preference;
|
||||
emit engineFound( name, weight, timeout, preference );
|
||||
qDebug() << Q_FUNC_INFO << m_name << m_weight << m_timeout << m_preference;
|
||||
|
||||
m_ready = true;
|
||||
Tomahawk::Pipeline::instance()->addResolver( this );
|
||||
}
|
||||
|
||||
|
||||
QtScriptResolver::~QtScriptResolver()
|
||||
{
|
||||
Tomahawk::Pipeline::instance()->removeResolver( this );
|
||||
delete m_engine;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ScriptEngine::resolve( const Tomahawk::query_ptr& query )
|
||||
QtScriptResolver::resolve( const Tomahawk::query_ptr& query )
|
||||
{
|
||||
if ( QThread::currentThread() != thread() )
|
||||
{
|
||||
// qDebug() << "Reinvoking in correct thread:" << Q_FUNC_INFO;
|
||||
QMetaObject::invokeMethod( this, "resolve",
|
||||
Qt::QueuedConnection,
|
||||
Q_ARG(Tomahawk::query_ptr, query)
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
qDebug() << Q_FUNC_INFO << query->toString();
|
||||
QString eval = QString( "resolve( '%1', '%2', '%3', '%4' );" )
|
||||
.arg( query->id().replace( "'", "\\'" ) )
|
||||
.arg( query->artist().replace( "'", "\\'" ) )
|
||||
.arg( query->album().replace( "'", "\\'" ) )
|
||||
.arg( query->track().replace( "'", "\\'" ) );
|
||||
.arg( query->id().replace( "'", "\\'" ) )
|
||||
.arg( query->artist().replace( "'", "\\'" ) )
|
||||
.arg( query->album().replace( "'", "\\'" ) )
|
||||
.arg( query->track().replace( "'", "\\'" ) );
|
||||
|
||||
QList< Tomahawk::result_ptr > results;
|
||||
|
||||
QVariantMap m = mainFrame()->evaluateJavaScript( eval ).toMap();
|
||||
QVariantMap m = m_engine->mainFrame()->evaluateJavaScript( eval ).toMap();
|
||||
qDebug() << "JavaScript Result:" << m;
|
||||
|
||||
const QString qid = query->id();
|
||||
@ -169,9 +96,9 @@ ScriptEngine::resolve( const Tomahawk::query_ptr& query )
|
||||
rp->setBitrate( m.value( "bitrate" ).toUInt() );
|
||||
rp->setUrl( m.value( "url" ).toString() );
|
||||
rp->setSize( m.value( "size" ).toUInt() );
|
||||
rp->setScore( m.value( "score" ).toFloat() * ( (float)m_resolver->weight() / 100.0 ) );
|
||||
rp->setScore( m.value( "score" ).toFloat() * ( (float)weight() / 100.0 ) );
|
||||
rp->setRID( uuid() );
|
||||
rp->setFriendlySource( m_resolver->name() );
|
||||
rp->setFriendlySource( name() );
|
||||
|
||||
if ( m.contains( "year" ) )
|
||||
{
|
||||
|
@ -30,7 +30,6 @@
|
||||
#include <QtWebKit/QWebPage>
|
||||
#include <QtWebKit/QWebFrame>
|
||||
|
||||
class ScriptThread;
|
||||
class QtScriptResolver;
|
||||
|
||||
class ScriptEngine : public QWebPage
|
||||
@ -38,18 +37,16 @@ class ScriptEngine : public QWebPage
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ScriptEngine( QtScriptResolver* resolver, ScriptThread* parent )
|
||||
: QWebPage( (QObject*)parent )
|
||||
explicit ScriptEngine( QtScriptResolver* parent )
|
||||
: QWebPage( (QObject*) parent )
|
||||
, m_parent( parent )
|
||||
, m_resolver( resolver )
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
public slots:
|
||||
void resolve( const Tomahawk::query_ptr& query );
|
||||
|
||||
bool shouldInterruptJavaScript()
|
||||
{
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -57,32 +54,7 @@ protected:
|
||||
{ qDebug() << "JAVASCRIPT ERROR:" << message << lineNumber << sourceID; }
|
||||
|
||||
private:
|
||||
ScriptThread* m_parent;
|
||||
QtScriptResolver* m_resolver;
|
||||
};
|
||||
|
||||
|
||||
class ScriptThread : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ScriptThread( const QString& scriptPath, QtScriptResolver* parent );
|
||||
|
||||
void run();
|
||||
|
||||
virtual void resolve( const Tomahawk::query_ptr& query );
|
||||
|
||||
signals:
|
||||
void engineFound( const QString& name, unsigned int weight, unsigned int timeout, unsigned int preference );
|
||||
|
||||
private slots:
|
||||
void initEngine();
|
||||
|
||||
private:
|
||||
ScriptEngine* m_engine;
|
||||
QtScriptResolver* m_parent;
|
||||
QString m_scriptPath;
|
||||
};
|
||||
|
||||
|
||||
@ -106,11 +78,8 @@ public slots:
|
||||
signals:
|
||||
void finished();
|
||||
|
||||
private slots:
|
||||
void onEngineFound( const QString& name, unsigned int weight, unsigned int timeout, unsigned int preference );
|
||||
|
||||
private:
|
||||
ScriptThread* m_thread;
|
||||
ScriptEngine* m_engine;
|
||||
|
||||
QString m_name;
|
||||
unsigned int m_weight, m_preference, m_timeout;
|
||||
|
@ -54,7 +54,7 @@ Jabber_p::Jabber_p( const QString& jid, const QString& password, const QString&
|
||||
|
||||
if( m_jid.resource().find( "tomahawk" ) == std::string::npos )
|
||||
{
|
||||
qDebug() << "!!! Setting your resource to 'tomahawk' prior to logging in to jabber";
|
||||
// qDebug() << "!!! Setting your resource to 'tomahawk' prior to logging in to jabber";
|
||||
m_jid.setResource( QString( "tomahawk%1" ).arg( qrand() ).toStdString() );
|
||||
}
|
||||
|
||||
@ -230,8 +230,8 @@ Jabber_p::sendMsg( const QString& to, const QString& msg )
|
||||
{
|
||||
if ( QThread::currentThread() != thread() )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << "invoking in correct thread, not"
|
||||
<< QThread::currentThread();
|
||||
// qDebug() << Q_FUNC_INFO << "invoking in correct thread, not"
|
||||
// << QThread::currentThread();
|
||||
|
||||
QMetaObject::invokeMethod( this, "sendMsg",
|
||||
Qt::QueuedConnection,
|
||||
@ -297,7 +297,7 @@ Jabber_p::addContact( const QString& jid, const QString& msg )
|
||||
void
|
||||
Jabber_p::onConnect()
|
||||
{
|
||||
qDebug() << "Connected to the XMPP server";
|
||||
qDebug() << "Connected to the XMPP server" << m_jid.full().c_str();
|
||||
// update jid resource, servers like gtalk use resource binding and may
|
||||
// have changed our requested /resource
|
||||
if ( m_client->resource() != m_jid.resource() )
|
||||
@ -307,7 +307,6 @@ Jabber_p::onConnect()
|
||||
emit jidChanged( jidstr );
|
||||
}
|
||||
|
||||
qDebug() << "Connected as:" << m_jid.full().c_str();
|
||||
emit connected();
|
||||
}
|
||||
|
||||
@ -536,7 +535,7 @@ gloox::Roster::const_iterator it = roster.begin();
|
||||
for ( ; it != roster.end(); ++it )
|
||||
{
|
||||
if ( (*it).second->subscription() != gloox::S10nBoth ) continue;
|
||||
qDebug() << (*it).second->jid().c_str() << (*it).second->name().c_str();
|
||||
// qDebug() << (*it).second->jid().c_str() << (*it).second->name().c_str();
|
||||
//printf("JID: %s\n", (*it).second->jid().c_str());
|
||||
}
|
||||
|
||||
@ -559,8 +558,6 @@ Jabber_p::handlePresence( const gloox::Presence& presence )
|
||||
gloox::JID jid = presence.from();
|
||||
QString fulljid( jid.full().c_str() );
|
||||
|
||||
qDebug() << "* handleRosterPresence" << fulljid << presence.subtype();
|
||||
|
||||
if( jid == m_jid )
|
||||
return;
|
||||
|
||||
@ -582,6 +579,7 @@ Jabber_p::handlePresence( const gloox::Presence& presence )
|
||||
return;
|
||||
}
|
||||
|
||||
qDebug() << "* handleRosterPresence" << fulljid << presence.subtype();
|
||||
//qDebug() << "handling presence for resource of" << res;
|
||||
|
||||
//qDebug() << Q_FUNC_INFO << "jid:" << QString::fromStdString(item.jid())
|
||||
|
@ -81,6 +81,9 @@ ofstream logfile;
|
||||
|
||||
void TomahawkLogHandler( QtMsgType type, const char *msg )
|
||||
{
|
||||
static QMutex s_mutex;
|
||||
|
||||
QMutexLocker locker( &s_mutex );
|
||||
switch( type )
|
||||
{
|
||||
case QtDebugMsg:
|
||||
|
Loading…
x
Reference in New Issue
Block a user