mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-09-22 11:51:39 +02:00
Compare commits
1 Commits
things
...
scriptolle
Author | SHA1 | Date | |
---|---|---|---|
|
27924c81fd |
@@ -403,7 +403,7 @@ if( WIN32 )
|
||||
endif( WIN32 )
|
||||
|
||||
if( WIN32 OR APPLE )
|
||||
macro_optional_find_package(LibsnoreQt5 0.6.0 QUIET)
|
||||
macro_optional_find_package(LibsnoreQt5 0.5.70 QUIET)
|
||||
macro_log_feature(LibsnoreQt5_FOUND "Libsnore" "Library for notifications" "https://projects.kde.org/projects/playground/libs/snorenotify" FALSE "" "")
|
||||
endif()
|
||||
|
||||
|
@@ -18,10 +18,11 @@
|
||||
!ifndef MINGW_ROOT
|
||||
!define MINGW_ROOT "/usr/i686-w64-mingw32/sys-root/mingw"
|
||||
!endif
|
||||
!define APPLICATION_NAME "@CPACK_PACKAGE_NAME@"
|
||||
!define TARGET_NAME "@CPACK_PACKAGE_TARGET_NAME@"
|
||||
|
||||
!define APPLICATION_NAME "Tomahawk"
|
||||
!define TARGET_NAME "tomahawk"
|
||||
;define app id needed for Windows 8 notifications
|
||||
!define AppUserModelId "@TOMAHAWK_APPLICATION_PACKAGE_NAME@"
|
||||
!define AppUserModelId @TOMAHAWK_APPLICATION_PACKAGE_NAME@
|
||||
|
||||
!define MINGW_BIN "${MINGW_ROOT}/bin"
|
||||
!define MINGW_LIB "${MINGW_ROOT}/lib"
|
||||
@@ -346,108 +347,105 @@ Section "${APPLICATION_NAME}" SEC_TOMAHAWK_PLAYER
|
||||
File "${QT_DLL_PATH}\icudata56.dll"
|
||||
File "${QT_DLL_PATH}\icui18n56.dll"
|
||||
|
||||
;SQLite driver
|
||||
SetOutPath "$INSTDIR\sqldrivers"
|
||||
File "${SQLITE_DLL_PATH}\qsqlite.dll"
|
||||
SetOutPath "$INSTDIR"
|
||||
File "${MINGW_BIN}\libsqlite3-0.dll"
|
||||
;SQLite driver
|
||||
SetOutPath "$INSTDIR\sqldrivers"
|
||||
File "${SQLITE_DLL_PATH}\qsqlite.dll"
|
||||
SetOutPath "$INSTDIR"
|
||||
File "${MINGW_BIN}\libsqlite3-0.dll"
|
||||
|
||||
;Qt platform plugins
|
||||
SetOutPath "$INSTDIR\platforms"
|
||||
File "${MINGW_LIB}/qt5/plugins/platforms/qwindows.dll"
|
||||
SetOutPath "$INSTDIR"
|
||||
;Qt platform plugins
|
||||
SetOutPath "$INSTDIR\platforms"
|
||||
File "${MINGW_LIB}/qt5/plugins/platforms/qwindows.dll"
|
||||
SetOutPath "$INSTDIR"
|
||||
|
||||
;Image plugins
|
||||
SetOutPath "$INSTDIR\imageformats"
|
||||
File "${IMAGEFORMATS_DLL_PATH}\qgif.dll"
|
||||
File "${IMAGEFORMATS_DLL_PATH}\qjpeg.dll"
|
||||
File "${IMAGEFORMATS_DLL_PATH}\qsvg.dll"
|
||||
SetOutPath "$INSTDIR"
|
||||
;Image plugins
|
||||
SetOutPath "$INSTDIR\imageformats"
|
||||
File "${IMAGEFORMATS_DLL_PATH}\qgif.dll"
|
||||
File "${IMAGEFORMATS_DLL_PATH}\qjpeg.dll"
|
||||
File "${IMAGEFORMATS_DLL_PATH}\qsvg.dll"
|
||||
SetOutPath "$INSTDIR"
|
||||
|
||||
;Qt qml plugins
|
||||
SetOutPath "$INSTDIR\QtQuick.2"
|
||||
File /r /x *.debug "${QT_QML_PATH}\QtQuick.2\*"
|
||||
SetOutPath "$INSTDIR\QtQuick\Window.2"
|
||||
File /r /x *.debug "${QT_QML_PATH}\QtQuick\Window.2\*"
|
||||
SetOutPath "$INSTDIR"
|
||||
;Qt qml plugins
|
||||
SetOutPath "$INSTDIR\QtQuick.2"
|
||||
File /r /x *.debug "${QT_QML_PATH}\QtQuick.2\*"
|
||||
SetOutPath "$INSTDIR\QtQuick\Window.2"
|
||||
File /r /x *.debug "${QT_QML_PATH}\QtQuick\Window.2\*"
|
||||
SetOutPath "$INSTDIR"
|
||||
|
||||
;Cygwin/c++ stuff
|
||||
File "${MINGW_BIN}\libgcc_s_sjlj-1.dll"
|
||||
File "${MINGW_BIN}\libstdc++-6.dll"
|
||||
;Cygwin/c++ stuff
|
||||
File "${MINGW_BIN}\libgcc_s_sjlj-1.dll"
|
||||
File "${MINGW_BIN}\libstdc++-6.dll"
|
||||
|
||||
;VLC
|
||||
File "${VLC_BIN}\libvlc.dll"
|
||||
File "${VLC_BIN}\libvlccore.dll"
|
||||
SetOutPath "$INSTDIR\plugins"
|
||||
File /r "${VLC_PLUGIN_PATH}\*.dll"
|
||||
SetOutPath "$INSTDIR"
|
||||
;VLC
|
||||
File "${VLC_BIN}\libvlc.dll"
|
||||
File "${VLC_BIN}\libvlccore.dll"
|
||||
SetOutPath "$INSTDIR\plugins"
|
||||
File /r "${VLC_PLUGIN_PATH}\*.dll"
|
||||
SetOutPath "$INSTDIR"
|
||||
|
||||
; Other
|
||||
File "${MINGW_BIN}\libtag.dll"
|
||||
File "${MINGW_BIN}\libpng16-16.dll"
|
||||
File "${MINGW_BIN}\libjpeg-8.dll"
|
||||
File "${MINGW_BIN}\zlib1.dll"
|
||||
File "${MINGW_BIN}\libfreetype-6.dll"
|
||||
File "${MINGW_BIN}\libglib-2.0-0.dll"
|
||||
File "${MINGW_BIN}\libharfbuzz-0.dll"
|
||||
; Other
|
||||
File "${MINGW_BIN}\libtag.dll"
|
||||
File "${MINGW_BIN}\libpng16-16.dll"
|
||||
File "${MINGW_BIN}\libjpeg-8.dll"
|
||||
File "${MINGW_BIN}\zlib1.dll"
|
||||
File "${MINGW_BIN}\libfreetype-6.dll"
|
||||
File "${MINGW_BIN}\libglib-2.0-0.dll"
|
||||
File "${MINGW_BIN}\libharfbuzz-0.dll"
|
||||
|
||||
; ANGLE
|
||||
File "${MINGW_BIN}\D3DCompiler_43.dll"
|
||||
File "${MINGW_BIN}\libechonest5.dll"
|
||||
File "${MINGW_BIN}\liblastfm5.dll"
|
||||
File "${MINGW_BIN}\libquazip5.dll"
|
||||
File "${MINGW_BIN}\libqt5keychain.dll"
|
||||
|
||||
File "${MINGW_BIN}\libechonest5.dll"
|
||||
File "${MINGW_BIN}\liblastfm5.dll"
|
||||
File "${MINGW_BIN}\libquazip5.dll"
|
||||
File "${MINGW_BIN}\libqt5keychain.dll"
|
||||
; GnuTLS
|
||||
File "${MINGW_BIN}\libgnutls-28.dll"
|
||||
File "${MINGW_BIN}\libtasn1-6.dll"
|
||||
File "${MINGW_BIN}\libgmp-10.dll"
|
||||
File "${MINGW_BIN}\libhogweed-2-4.dll"
|
||||
File "${MINGW_BIN}\libintl-8.dll"
|
||||
File "${MINGW_BIN}\libnettle-4-6.dll"
|
||||
File "${MINGW_BIN}\libp11-kit-0.dll"
|
||||
File "${MINGW_BIN}\libffi-6.dll"
|
||||
|
||||
; GnuTLS
|
||||
File "${MINGW_BIN}\libgnutls-28.dll"
|
||||
File "${MINGW_BIN}\libtasn1-6.dll"
|
||||
File "${MINGW_BIN}\libgmp-10.dll"
|
||||
File "${MINGW_BIN}\libhogweed-4-1.dll"
|
||||
File "${MINGW_BIN}\libintl-8.dll"
|
||||
File "${MINGW_BIN}\libnettle-6-1.dll"
|
||||
File "${MINGW_BIN}\libp11-kit-0.dll"
|
||||
File "${MINGW_BIN}\libffi-6.dll"
|
||||
; Snorenotify
|
||||
File "${MINGW_BIN}\SnoreToast.exe"
|
||||
File "${MINGW_BIN}\libsnore-qt5.dll"
|
||||
File "${MINGW_BIN}\libsnoresettings-qt5.dll"
|
||||
File "${MINGW_BIN}\snoresettings.exe"
|
||||
File "${MINGW_LIB}\plugins\libsnore-qt5\libsnore_backend_growl.dll"
|
||||
File "${MINGW_LIB}\plugins\libsnore-qt5\libsnore_settings_backend_growl.dll"
|
||||
File "${MINGW_LIB}\plugins\libsnore-qt5\libsnore_backend_snarl.dll"
|
||||
File "${MINGW_LIB}\plugins\libsnore-qt5\libsnore_settings_backend_snarl.dll"
|
||||
File "${MINGW_LIB}\plugins\libsnore-qt5\libsnore_backend_snore.dll"
|
||||
File "${MINGW_LIB}\plugins\libsnore-qt5\libsnore_settings_backend_snore.dll"
|
||||
File "${MINGW_LIB}\plugins\libsnore-qt5\libsnore_backend_windowstoast.dll"
|
||||
|
||||
; Snorenotify
|
||||
File "${MINGW_BIN}\SnoreToast.exe"
|
||||
File "${MINGW_BIN}\libsnore-qt5.dll"
|
||||
File "${MINGW_BIN}\libsnoresettings-qt5.dll"
|
||||
File "${MINGW_BIN}\snoresettings.exe"
|
||||
File "${MINGW_LIB}\plugins\libsnore-qt5\libsnore_backend_growl.dll"
|
||||
File "${MINGW_LIB}\plugins\libsnore-qt5\libsnore_settings_backend_growl.dll"
|
||||
File "${MINGW_LIB}\plugins\libsnore-qt5\libsnore_backend_snarl.dll"
|
||||
File "${MINGW_LIB}\plugins\libsnore-qt5\libsnore_settings_backend_snarl.dll"
|
||||
File "${MINGW_LIB}\plugins\libsnore-qt5\libsnore_backend_snore.dll"
|
||||
File "${MINGW_LIB}\plugins\libsnore-qt5\libsnore_settings_backend_snore.dll"
|
||||
File "${MINGW_LIB}\plugins\libsnore-qt5\libsnore_backend_windowstoast.dll"
|
||||
|
||||
; Snoregrowl
|
||||
File "${MINGW_BIN}\libsnoregrowl++.dll"
|
||||
File "${MINGW_BIN}\libsnoregrowl.dll"
|
||||
; Snoregrowl
|
||||
File "${MINGW_BIN}\libsnoregrowl++.dll"
|
||||
File "${MINGW_BIN}\libsnoregrowl.dll"
|
||||
|
||||
; Jabber
|
||||
File "${MINGW_BIN}\libjreen-qt5.dll"
|
||||
File "${MINGW_BIN}\libidn-11.dll"
|
||||
File "${MINGW_BIN}\libgsasl-7.dll"
|
||||
File "${MINGW_BIN}\libqca-qt5.dll"
|
||||
SetOutPath "$INSTDIR\crypto"
|
||||
File "${MINGW_LIB}\qca-qt5\crypto\libqca-ossl.dll"
|
||||
SetOutPath "$INSTDIR"
|
||||
File "${MINGW_BIN}\libssl-10.dll"
|
||||
File "${MINGW_BIN}\libcrypto-10.dll"
|
||||
File "${MINGW_BIN}\libjreen-qt5.dll"
|
||||
File "${MINGW_BIN}\libidn-11.dll"
|
||||
File "${MINGW_BIN}\libgsasl-7.dll"
|
||||
File "${MINGW_BIN}\libqca-qt5.dll"
|
||||
SetOutPath "$INSTDIR\crypto"
|
||||
File "${MINGW_LIB}\qca-qt5\crypto\libqca-ossl.dll"
|
||||
SetOutPath "$INSTDIR"
|
||||
File "${MINGW_BIN}\libssl-10.dll"
|
||||
File "${MINGW_BIN}\libcrypto-10.dll"
|
||||
|
||||
; LucenePlusPlus
|
||||
File "${MINGW_BIN}\liblucene++.dll"
|
||||
File "${MINGW_BIN}\libboost_system-mt.dll"
|
||||
File "${MINGW_BIN}\libboost_filesystem-mt.dll"
|
||||
File "${MINGW_BIN}\libboost_iostreams-mt.dll"
|
||||
File "${MINGW_BIN}\libboost_regex-mt.dll"
|
||||
File "${MINGW_BIN}\libboost_thread-mt.dll"
|
||||
File "${MINGW_BIN}\libbz2-1.dll"
|
||||
; LucenePlusPlus
|
||||
File "${MINGW_BIN}\liblucene++.dll"
|
||||
File "${MINGW_BIN}\libboost_system-mt.dll"
|
||||
File "${MINGW_BIN}\libboost_filesystem-mt.dll"
|
||||
File "${MINGW_BIN}\libboost_iostreams-mt.dll"
|
||||
File "${MINGW_BIN}\libboost_regex-mt.dll"
|
||||
File "${MINGW_BIN}\libboost_thread-mt.dll"
|
||||
File "${MINGW_BIN}\libbz2-1.dll"
|
||||
|
||||
File "${MINGW_BIN}\libqtsparkle-qt5.dll"
|
||||
File "${MINGW_BIN}\libKF5Attica.dll"
|
||||
File "${MINGW_BIN}\libqtsparkle-qt5.dll"
|
||||
File "${MINGW_BIN}\libKF5Attica.dll"
|
||||
SectionEnd
|
||||
|
||||
SectionGroup "Shortcuts"
|
||||
|
@@ -2,7 +2,7 @@ INCLUDE( InstallRequiredSystemLibraries )
|
||||
|
||||
SET( CPACK_PACKAGE_CONTACT "Dominik Schmidt <domme@tomahawk-player.org>" )
|
||||
|
||||
SET( CPACK_PACKAGE_FILE_NAME "${TOMAHAWK_TARGET_NAME}-${TOMAHAWK_VERSION}" ) # Package file name without extension. Also a directory of installer cmake-2.5.0-Linux-i686
|
||||
SET( CPACK_PACKAGE_FILE_NAME "${TOMAHAWK_APPLICATION_NAME}-${TOMAHAWK_VERSION}" ) # Package file name without extension. Also a directory of installer cmake-2.5.0-Linux-i686
|
||||
|
||||
# CPACK_GENERATOR CPack generator to be used STGZ;TGZ;TZ
|
||||
# CPACK_INCLUDE_TOPLEVEL_DIRECTORY Controls whether CPack adds a top-level directory, usually of the form ProjectName-Version-OS, to the top of package tree. 0 to disable, 1 to enable
|
||||
@@ -13,9 +13,7 @@ SET( CPACK_PACKAGE_DESCRIPTION_SUMMARY ${TOMAHAWK_DESCRIPTION_SUMMARY} ) # Des
|
||||
SET( CPACK_PACKAGE_INSTALL_DIRECTORY ${TOMAHAWK_APPLICATION_NAME} ) # Installation directory on the target system -> C:\Program Files\fellody
|
||||
SET( CPACK_PACKAGE_INSTALL_REGISTRY_KEY ${TOMAHAWK_APPLICATION_NAME} ) # Registry key used when installing this project CMake 2.5.0
|
||||
SET( CPACK_PACKAGE_NAME ${TOMAHAWK_APPLICATION_NAME} ) # Package name, defaults to the project name
|
||||
SET( CPACK_PACKAGE_TARGET_NAME ${TOMAHAWK_TARGET_NAME} ) # Used to build library and executable names
|
||||
SET( CPACK_PACKAGE_VENDOR ${TOMAHAWK_ORGANIZATION_NAME} ) # Package vendor name
|
||||
SET( TOMAHAWK_APPLICATION_PACKAGE_NAME ${TOMAHAWK_APPLICATION_PACKAGE_NAME} )
|
||||
SET( CPACK_PACKAGE_VERSION_MAJOR ${TOMAHAWK_VERSION_MAJOR} )
|
||||
SET( CPACK_PACKAGE_VERSION_MINOR ${TOMAHAWK_VERSION_MINOR} )
|
||||
SET( CPACK_PACKAGE_VERSION_PATCH ${TOMAHAWK_VERSION_PATCH} )
|
||||
|
@@ -273,29 +273,19 @@ Tomahawk.Resolver = {
|
||||
getStreamUrl: function (params) {
|
||||
return params;
|
||||
},
|
||||
resolve: function() {
|
||||
},
|
||||
_adapter_resolve: function (params) {
|
||||
return RSVP.Promise.resolve(this.resolve(params)).then(function (results) {
|
||||
if(Array.isArray(results)) {
|
||||
return {
|
||||
'tracks': results
|
||||
};
|
||||
}
|
||||
|
||||
return results;
|
||||
return {
|
||||
'tracks': results
|
||||
};
|
||||
});
|
||||
},
|
||||
|
||||
_adapter_search: function (params) {
|
||||
return RSVP.Promise.resolve(this.search(params)).then(function (results) {
|
||||
if(Array.isArray(results)) {
|
||||
return {
|
||||
'tracks': results
|
||||
};
|
||||
}
|
||||
|
||||
return results;
|
||||
return {
|
||||
'tracks': results
|
||||
};
|
||||
});
|
||||
},
|
||||
|
||||
|
@@ -24,6 +24,13 @@ include_directories(
|
||||
|
||||
add_definitions(-D_WEBSOCKETPP_CPP11_STL_)
|
||||
|
||||
if(APPLE)
|
||||
# http://stackoverflow.com/questions/7226753/osx-lion-xcode-4-1-how-do-i-setup-a-c0x-project/7236451#7236451
|
||||
add_definitions(-std=c++11 -stdlib=libc++ -U__STRICT_ANSI__)
|
||||
set(PLATFORM_SPECIFIC_LINK_LIBRARIES "/usr/lib/libc++.dylib")
|
||||
else()
|
||||
add_definitions(-std=c++0x)
|
||||
endif()
|
||||
|
||||
tomahawk_add_plugin(hatchet
|
||||
TYPE account
|
||||
|
@@ -69,13 +69,6 @@ Tomahawk::InfoSystem::XmppInfoPlugin::init()
|
||||
}
|
||||
|
||||
|
||||
const QString
|
||||
Tomahawk::InfoSystem::XmppInfoPlugin::friendlyName() const
|
||||
{
|
||||
return "xmpp";
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Tomahawk::InfoSystem::XmppInfoPlugin::pushInfo( Tomahawk::InfoSystem::InfoPushData pushData )
|
||||
{
|
||||
|
@@ -38,8 +38,6 @@ namespace Tomahawk {
|
||||
XmppInfoPlugin(XmppSipPlugin* parent);
|
||||
virtual ~XmppInfoPlugin();
|
||||
|
||||
const QString friendlyName() const override;
|
||||
|
||||
signals:
|
||||
void publishTune( QUrl url, Tomahawk::InfoSystem::InfoStringHash trackInfo );
|
||||
|
||||
|
@@ -194,9 +194,9 @@ InfoSystem::InfoPluginPtr
|
||||
XmppSipPlugin::infoPlugin()
|
||||
{
|
||||
if ( m_infoPlugin.isNull() )
|
||||
m_infoPlugin = QSharedPointer< Tomahawk::InfoSystem::XmppInfoPlugin >( new Tomahawk::InfoSystem::XmppInfoPlugin( this ) );
|
||||
m_infoPlugin = QPointer< Tomahawk::InfoSystem::XmppInfoPlugin >( new Tomahawk::InfoSystem::XmppInfoPlugin( this ) );
|
||||
|
||||
return m_infoPlugin;
|
||||
return InfoSystem::InfoPluginPtr( m_infoPlugin.data() );
|
||||
}
|
||||
|
||||
|
||||
@@ -285,7 +285,7 @@ XmppSipPlugin::onConnect()
|
||||
// load XmppInfoPlugin
|
||||
if ( infoPlugin() && Tomahawk::InfoSystem::InfoSystem::instance()->workerThread() )
|
||||
{
|
||||
infoPlugin()->moveToThread( Tomahawk::InfoSystem::InfoSystem::instance()->workerThread().data() );
|
||||
infoPlugin().data()->moveToThread( Tomahawk::InfoSystem::InfoSystem::instance()->workerThread().data() );
|
||||
Tomahawk::InfoSystem::InfoSystem::instance()->addInfoPlugin( infoPlugin() );
|
||||
}
|
||||
|
||||
@@ -359,6 +359,7 @@ XmppSipPlugin::onDisconnect( Jreen::Client::DisconnectReason reason )
|
||||
if ( !m_infoPlugin.isNull() )
|
||||
{
|
||||
Tomahawk::InfoSystem::InfoSystem::instance()->removeInfoPlugin( infoPlugin() );
|
||||
delete m_infoPlugin;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -128,7 +128,7 @@ private:
|
||||
int m_currentPort;
|
||||
QString m_currentResource;
|
||||
|
||||
QSharedPointer< Tomahawk::InfoSystem::XmppInfoPlugin > m_infoPlugin;
|
||||
QPointer< Tomahawk::InfoSystem::XmppInfoPlugin > m_infoPlugin;
|
||||
Tomahawk::Accounts::Account::ConnectionState m_state;
|
||||
|
||||
// sort out
|
||||
|
@@ -34,7 +34,7 @@ public:
|
||||
* Creates a Playdar HTTP interface
|
||||
* @param ha Address to listen on
|
||||
* @param port Port to listen on with HTTP
|
||||
* @param sport Port to listen on with HTTPS
|
||||
* @param sport Pot to listen on with HTTPS
|
||||
* @param parent
|
||||
*/
|
||||
explicit PlaydarApi( QHostAddress ha, qint16 port, qint16 sport, QObject *parent = 0 );
|
||||
|
@@ -67,7 +67,7 @@ AtticaManager::AtticaManager( QObject* parent )
|
||||
connect( &m_manager, SIGNAL( providerAdded( Attica::Provider ) ), this, SLOT( providerAdded( Attica::Provider ) ) );
|
||||
|
||||
// resolvers
|
||||
// m_manager.addProviderFile( QUrl( "http://v09.bakery.tomahawk-player.org/resolvers/providers.xml" ) );
|
||||
// m_manager.addProviderFile( QUrl( "http://bakery.tomahawk-player.org/resolvers/providers.xml" ) );
|
||||
|
||||
const QString url = QString( "%1/resolvers/providers.xml?version=%2" ).arg( hostname() ).arg( TomahawkUtils::appFriendlyVersion() );
|
||||
QNetworkReply* reply = Tomahawk::Utils::nam()->get( QNetworkRequest( QUrl( url ) ) );
|
||||
@@ -116,7 +116,7 @@ AtticaManager::fetchMissingIcons()
|
||||
QString
|
||||
AtticaManager::hostname() const
|
||||
{
|
||||
return "http://v09.bakery.tomahawk-player.org";
|
||||
return "http://bakery.tomahawk-player.org";
|
||||
}
|
||||
|
||||
|
||||
|
@@ -37,7 +37,6 @@ set( libGuiSources
|
||||
jobview/ErrorStatusMessage.cpp
|
||||
jobview/IndexingJobItem.cpp
|
||||
jobview/InboxJobItem.cpp
|
||||
jobview/ScriptErrorStatusMessage.cpp
|
||||
|
||||
playlist/InboxModel.cpp
|
||||
playlist/InboxView.cpp
|
||||
@@ -418,7 +417,7 @@ include_directories(
|
||||
${Boost_INCLUDE_DIR}
|
||||
|
||||
${LIBPORTFWD_INCLUDE_DIR}
|
||||
${QUAZIP_INCLUDE_DIRS}
|
||||
${QUAZIP_INCLUDE_DIR}
|
||||
${QTKEYCHAIN_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
|
@@ -263,14 +263,9 @@ bool
|
||||
DropJob::validateLocalFiles(const QString &paths, const QString &suffix)
|
||||
{
|
||||
QStringList filePaths = paths.split( QRegExp( "\\s+" ), QString::SkipEmptyParts );
|
||||
QStringList::iterator it = filePaths.begin();
|
||||
while ( it != filePaths.end() )
|
||||
{
|
||||
for ( QStringList::iterator it = filePaths.begin(); it != filePaths.end(); ++it )
|
||||
if ( !validateLocalFile( *it, suffix ) )
|
||||
it = filePaths.erase( it );
|
||||
else
|
||||
++it;
|
||||
}
|
||||
filePaths.erase( it );
|
||||
return !filePaths.isEmpty();
|
||||
}
|
||||
|
||||
|
@@ -595,8 +595,8 @@ Pipeline::shunt( const query_ptr& q )
|
||||
// we get here if we disable a resolver while a query is resolving
|
||||
// OR we are just out of resolvers while query is still resolving
|
||||
|
||||
// since we seem to at least tried to kick off all of the resolvers,
|
||||
// remove the '.keep' entry
|
||||
//since we seem to at least tried to kick off all of the resolvers,
|
||||
//remove the '.keep' entry
|
||||
decQIDState( q, nullptr );
|
||||
return;
|
||||
}
|
||||
|
@@ -403,17 +403,12 @@ Query::resultSorter( const result_ptr& left, const result_ptr& right )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if ( left->isPreview() != right->isPreview() )
|
||||
if ( !right->isPreview() )
|
||||
{
|
||||
return !left->isPreview();
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( left->resolvedBy() != nullptr && right->resolvedBy() != nullptr )
|
||||
{
|
||||
return left->resolvedBy()->weight() > right->resolvedBy()->weight();
|
||||
}
|
||||
|
||||
return left->id() > right->id();
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( left->isPreview() != right->isPreview() )
|
||||
@@ -641,11 +636,6 @@ Query::howSimilar( const Tomahawk::result_ptr& r )
|
||||
qTrackname = queryTrack()->trackSortname();
|
||||
}
|
||||
|
||||
//Cleanup symbols for minor naming differences
|
||||
qArtistname.remove(QRegExp(QString::fromUtf8("[-`~!@#$%^&*()_—+=|:;<>«»,.?/{}\'\"\\[\\]\\\\]")));
|
||||
qTrackname.remove(QRegExp(QString::fromUtf8("[-`~!@#$%^&*()_—+=|:;<>«»,.?/{}\'\"\\[\\]\\\\]")));
|
||||
qAlbumname.remove(QRegExp(QString::fromUtf8("[-`~!@#$%^&*()_—+=|:;<>«»,.?/{}\'\"\\[\\]\\\\]")));
|
||||
|
||||
// normal edit distance
|
||||
const int artdist = TomahawkUtils::levenshtein( qArtistname, rArtistname );
|
||||
const int trkdist = TomahawkUtils::levenshtein( qTrackname, rTrackname );
|
||||
|
@@ -132,8 +132,6 @@ Result::deleteLater()
|
||||
void
|
||||
Result::onResolverRemoved( Tomahawk::Resolver* resolver )
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
if ( m_resolver.data() == resolver )
|
||||
{
|
||||
m_resolver = 0;
|
||||
@@ -145,8 +143,6 @@ Result::onResolverRemoved( Tomahawk::Resolver* resolver )
|
||||
collection_ptr
|
||||
Result::resolvedByCollection() const
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
return m_collection;
|
||||
}
|
||||
|
||||
@@ -154,8 +150,6 @@ Result::resolvedByCollection() const
|
||||
QString
|
||||
Result::url() const
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
return m_url;
|
||||
}
|
||||
|
||||
@@ -163,8 +157,6 @@ Result::url() const
|
||||
bool
|
||||
Result::checked() const
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
return m_checked;
|
||||
}
|
||||
|
||||
@@ -172,8 +164,6 @@ Result::checked() const
|
||||
bool
|
||||
Result::isPreview() const
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
return m_isPreview;
|
||||
}
|
||||
|
||||
@@ -181,8 +171,6 @@ Result::isPreview() const
|
||||
QString
|
||||
Result::mimetype() const
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
return m_mimetype;
|
||||
}
|
||||
|
||||
@@ -190,8 +178,6 @@ Result::mimetype() const
|
||||
RID
|
||||
Result::id() const
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
if ( m_rid.isEmpty() )
|
||||
m_rid = uuid();
|
||||
|
||||
@@ -208,8 +194,6 @@ Result::isOnline() const
|
||||
}
|
||||
else
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
return !m_resolver.isNull();
|
||||
}
|
||||
}
|
||||
@@ -230,26 +214,24 @@ Result::playable() const
|
||||
QVariant
|
||||
Result::toVariant() const
|
||||
{
|
||||
track_ptr t = track();
|
||||
|
||||
QVariantMap m;
|
||||
m.insert( "artist", t->artist() );
|
||||
m.insert( "album", t->album() );
|
||||
m.insert( "track", t->track() );
|
||||
m.insert( "artist", m_track->artist() );
|
||||
m.insert( "album", m_track->album() );
|
||||
m.insert( "track", m_track->track() );
|
||||
m.insert( "source", friendlySource() );
|
||||
m.insert( "mimetype", mimetype() );
|
||||
m.insert( "size", size() );
|
||||
m.insert( "bitrate", bitrate() );
|
||||
m.insert( "duration", t->duration() );
|
||||
m.insert( "duration", m_track->duration() );
|
||||
// m.insert( "score", score() );
|
||||
m.insert( "sid", id() );
|
||||
m.insert( "discnumber", t->discnumber() );
|
||||
m.insert( "albumpos", t->albumpos() );
|
||||
m.insert( "discnumber", m_track->discnumber() );
|
||||
m.insert( "albumpos", m_track->albumpos() );
|
||||
m.insert( "preview", isPreview() );
|
||||
m.insert( "purchaseUrl", purchaseUrl() );
|
||||
|
||||
if ( !t->composer().isEmpty() )
|
||||
m.insert( "composer", t->composer() );
|
||||
if ( !m_track->composer().isEmpty() )
|
||||
m.insert( "composer", m_track->composer() );
|
||||
|
||||
return m;
|
||||
}
|
||||
@@ -258,25 +240,20 @@ Result::toVariant() const
|
||||
QString
|
||||
Result::toString() const
|
||||
{
|
||||
m_mutex.lock();
|
||||
track_ptr track = m_track;
|
||||
QString url = m_url;
|
||||
m_mutex.unlock();
|
||||
|
||||
if ( track )
|
||||
if ( m_track )
|
||||
{
|
||||
return QString( "Result(%1) %2 - %3%4 (%5)" )
|
||||
.arg( id() )
|
||||
.arg( track->artist() )
|
||||
.arg( track->track() )
|
||||
.arg( track->album().isEmpty() ? QString() : QString( " on %1" ).arg( track->album() ) )
|
||||
.arg( url );
|
||||
.arg( m_track->artist() )
|
||||
.arg( m_track->track() )
|
||||
.arg( m_track->album().isEmpty() ? QString() : QString( " on %1" ).arg( m_track->album() ) )
|
||||
.arg( m_url );
|
||||
}
|
||||
else
|
||||
{
|
||||
return QString( "Result(%1) (%2)" )
|
||||
.arg( id() )
|
||||
.arg( url );
|
||||
.arg( m_url );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -284,8 +261,6 @@ Result::toString() const
|
||||
Tomahawk::query_ptr
|
||||
Result::toQuery()
|
||||
{
|
||||
QMutexLocker l( &m_mutex );
|
||||
|
||||
if ( m_query.isNull() )
|
||||
{
|
||||
query_ptr query = Tomahawk::Query::get( m_track );
|
||||
@@ -295,15 +270,12 @@ Result::toQuery()
|
||||
m_query = query->weakRef();
|
||||
|
||||
QList<Tomahawk::result_ptr> rl;
|
||||
rl << m_ownRef.toStrongRef();
|
||||
m_mutex.unlock();
|
||||
rl << weakRef().toStrongRef();
|
||||
query->addResults( rl );
|
||||
m_mutex.lock();
|
||||
query->setResolveFinished( true );
|
||||
return query;
|
||||
}
|
||||
|
||||
|
||||
return m_query.toStrongRef();
|
||||
}
|
||||
|
||||
@@ -325,10 +297,7 @@ Result::onOffline()
|
||||
void
|
||||
Result::setResolvedByCollection( const Tomahawk::collection_ptr& collection , bool emitOnlineEvents )
|
||||
{
|
||||
m_mutex.lock();
|
||||
m_collection = collection;
|
||||
m_mutex.unlock();
|
||||
|
||||
if ( emitOnlineEvents )
|
||||
{
|
||||
Q_ASSERT( !collection.isNull() );
|
||||
@@ -342,8 +311,6 @@ Result::setResolvedByCollection( const Tomahawk::collection_ptr& collection , bo
|
||||
void
|
||||
Result::setFriendlySource( const QString& s )
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
m_friendlySource = s;
|
||||
}
|
||||
|
||||
@@ -351,8 +318,6 @@ Result::setFriendlySource( const QString& s )
|
||||
void
|
||||
Result::setPreview( bool isPreview )
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
m_isPreview = isPreview;
|
||||
}
|
||||
|
||||
@@ -360,8 +325,6 @@ Result::setPreview( bool isPreview )
|
||||
void
|
||||
Result::setPurchaseUrl( const QString& u )
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
m_purchaseUrl = u;
|
||||
}
|
||||
|
||||
@@ -369,8 +332,6 @@ Result::setPurchaseUrl( const QString& u )
|
||||
void
|
||||
Result::setLinkUrl( const QString& u )
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
m_linkUrl = u;
|
||||
}
|
||||
|
||||
@@ -378,8 +339,6 @@ Result::setLinkUrl( const QString& u )
|
||||
void
|
||||
Result::setChecked( bool checked )
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
m_checked = checked;
|
||||
}
|
||||
|
||||
@@ -387,8 +346,6 @@ Result::setChecked( bool checked )
|
||||
void
|
||||
Result::setMimetype( const QString& mimetype )
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
m_mimetype = mimetype;
|
||||
}
|
||||
|
||||
@@ -396,8 +353,6 @@ Result::setMimetype( const QString& mimetype )
|
||||
void
|
||||
Result::setBitrate( unsigned int bitrate )
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
m_bitrate = bitrate;
|
||||
}
|
||||
|
||||
@@ -405,8 +360,6 @@ Result::setBitrate( unsigned int bitrate )
|
||||
void
|
||||
Result::setSize( unsigned int size )
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
m_size = size;
|
||||
}
|
||||
|
||||
@@ -414,8 +367,6 @@ Result::setSize( unsigned int size )
|
||||
void
|
||||
Result::setModificationTime( unsigned int modtime )
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
m_modtime = modtime;
|
||||
}
|
||||
|
||||
@@ -423,8 +374,6 @@ Result::setModificationTime( unsigned int modtime )
|
||||
void
|
||||
Result::setTrack( const track_ptr& track )
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
m_track = track;
|
||||
}
|
||||
|
||||
@@ -432,8 +381,6 @@ Result::setTrack( const track_ptr& track )
|
||||
unsigned int
|
||||
Result::fileId() const
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
return m_fileId;
|
||||
}
|
||||
|
||||
@@ -443,8 +390,6 @@ Result::friendlySource() const
|
||||
{
|
||||
if ( resolvedByCollection().isNull() )
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
return m_friendlySource;
|
||||
}
|
||||
else
|
||||
@@ -455,8 +400,6 @@ Result::friendlySource() const
|
||||
QString
|
||||
Result::purchaseUrl() const
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
return m_purchaseUrl;
|
||||
}
|
||||
|
||||
@@ -464,8 +407,6 @@ Result::purchaseUrl() const
|
||||
QString
|
||||
Result::linkUrl() const
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
return m_linkUrl;
|
||||
}
|
||||
|
||||
@@ -475,8 +416,6 @@ Result::sourceIcon( TomahawkUtils::ImageMode style, const QSize& desiredSize ) c
|
||||
{
|
||||
if ( resolvedByCollection().isNull() )
|
||||
{
|
||||
//QMutexLocker lock( &m_mutex );
|
||||
|
||||
const ExternalResolver* resolver = qobject_cast< ExternalResolver* >( m_resolver.data() );
|
||||
if ( !resolver )
|
||||
{
|
||||
@@ -527,8 +466,6 @@ Result::sourceIcon( TomahawkUtils::ImageMode style, const QSize& desiredSize ) c
|
||||
unsigned int
|
||||
Result::bitrate() const
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
return m_bitrate;
|
||||
}
|
||||
|
||||
@@ -536,8 +473,6 @@ Result::bitrate() const
|
||||
unsigned int
|
||||
Result::size() const
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
return m_size;
|
||||
}
|
||||
|
||||
@@ -545,8 +480,6 @@ Result::size() const
|
||||
unsigned int
|
||||
Result::modificationTime() const
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
return m_modtime;
|
||||
}
|
||||
|
||||
@@ -554,8 +487,6 @@ Result::modificationTime() const
|
||||
void
|
||||
Result::setFileId( unsigned int id )
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
m_fileId = id;
|
||||
}
|
||||
|
||||
@@ -563,8 +494,6 @@ Result::setFileId( unsigned int id )
|
||||
Tomahawk::Resolver*
|
||||
Result::resolvedBy() const
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
if ( !m_collection.isNull() )
|
||||
return m_collection.data();
|
||||
|
||||
@@ -575,16 +504,12 @@ Result::resolvedBy() const
|
||||
void
|
||||
Result::setResolvedByResolver( Tomahawk::Resolver* resolver )
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
m_resolver = QPointer< Tomahawk::Resolver >( resolver );
|
||||
}
|
||||
|
||||
|
||||
QPointer< Resolver > Result::resolvedByResolver() const
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
return m_resolver;
|
||||
}
|
||||
|
||||
@@ -600,29 +525,16 @@ Result::doneEditing()
|
||||
track_ptr
|
||||
Result::track() const
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
return m_track;
|
||||
}
|
||||
|
||||
|
||||
QList< DownloadFormat >
|
||||
Result::downloadFormats() const
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
return m_formats;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Result::setDownloadFormats( const QList<DownloadFormat>& formats )
|
||||
{
|
||||
if ( formats.isEmpty() )
|
||||
return;
|
||||
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
m_formats.clear();
|
||||
foreach ( const DownloadFormat& format, formats )
|
||||
{
|
||||
@@ -650,7 +562,7 @@ Result::setDownloadFormats( const QList<DownloadFormat>& formats )
|
||||
void
|
||||
Result::onSettingsChanged()
|
||||
{
|
||||
if ( TomahawkSettings::instance()->downloadsPreferredFormat().toLower() != downloadFormats().first().extension.toLower() )
|
||||
if ( TomahawkSettings::instance()->downloadsPreferredFormat().toLower() != m_formats.first().extension.toLower() )
|
||||
{
|
||||
setDownloadFormats( downloadFormats() );
|
||||
emit updated();
|
||||
@@ -687,8 +599,6 @@ Result::onDownloadJobStateChanged( DownloadJob::TrackState newState, DownloadJob
|
||||
QWeakPointer<Result>
|
||||
Result::weakRef()
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
return m_ownRef;
|
||||
}
|
||||
|
||||
@@ -696,7 +606,5 @@ Result::weakRef()
|
||||
void
|
||||
Result::setWeakRef( QWeakPointer<Result> weakRef )
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
m_ownRef = weakRef;
|
||||
}
|
||||
|
@@ -31,7 +31,6 @@
|
||||
#include <QPixmap>
|
||||
#include <QPointer>
|
||||
#include <QVariant>
|
||||
#include <QMutex>
|
||||
|
||||
class MetadataEditor;
|
||||
|
||||
@@ -132,7 +131,7 @@ public:
|
||||
|
||||
track_ptr track() const;
|
||||
|
||||
QList< DownloadFormat > downloadFormats() const;
|
||||
QList<DownloadFormat> downloadFormats() const { return m_formats; }
|
||||
void setDownloadFormats( const QList<DownloadFormat>& formats );
|
||||
|
||||
downloadjob_ptr downloadJob() const { return m_downloadJob; }
|
||||
@@ -162,8 +161,6 @@ private:
|
||||
explicit Result( const QString& url, const Tomahawk::track_ptr& track );
|
||||
explicit Result();
|
||||
|
||||
mutable QMutex m_mutex;
|
||||
|
||||
mutable RID m_rid;
|
||||
collection_wptr m_collection;
|
||||
QPointer< Tomahawk::Resolver > m_resolver;
|
||||
|
@@ -253,7 +253,7 @@ namespace Tomahawk
|
||||
typedef QHash< QString, QString > InfoStringHash;
|
||||
typedef QPair< QVariantMap, QVariant > PushInfoPair;
|
||||
|
||||
typedef QSharedPointer< InfoPlugin > InfoPluginPtr;
|
||||
typedef QPointer< InfoPlugin > InfoPluginPtr;
|
||||
}
|
||||
|
||||
namespace Network
|
||||
|
@@ -79,7 +79,7 @@ ResolverAccountFactory::createFromPath( const QString& path )
|
||||
}
|
||||
|
||||
|
||||
ResolverAccount*
|
||||
Account*
|
||||
ResolverAccountFactory::createFromPath( const QString& path, const QString& factory, bool isAttica )
|
||||
{
|
||||
qDebug() << "Creating ResolverAccount from path:" << path << "is attica" << isAttica;
|
||||
@@ -110,8 +110,57 @@ ResolverAccountFactory::createFromPath( const QString& path, const QString& fact
|
||||
|
||||
if ( pathInfo.suffix() == "axe" )
|
||||
{
|
||||
if ( !installAxe( realPath, configuration ) )
|
||||
QString uniqueName = uuid();
|
||||
QDir dir( TomahawkUtils::extractScriptPayload( pathInfo.filePath(),
|
||||
uniqueName,
|
||||
MANUALRESOLVERS_DIR ) );
|
||||
if ( !( dir.exists() && dir.isReadable() ) ) //decompression fubar
|
||||
{
|
||||
displayError( tr( "Resolver installation error: cannot open bundle." ) );
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ( !dir.cd( "content" ) ) //more fubar
|
||||
{
|
||||
displayError( tr( "Resolver installation error: incomplete bundle." ) );
|
||||
return 0;
|
||||
}
|
||||
|
||||
QString metadataFilePath = dir.absoluteFilePath( "metadata.json" );
|
||||
configuration = metadataFromJsonFile( metadataFilePath );
|
||||
|
||||
configuration[ "bundleDir" ] = uniqueName;
|
||||
|
||||
if ( !configuration[ "pluginName" ].isNull() && !configuration[ "pluginName" ].toString().isEmpty() )
|
||||
{
|
||||
dir.cdUp();
|
||||
if ( !dir.cdUp() ) //we're in MANUALRESOLVERS_DIR
|
||||
return 0;
|
||||
|
||||
QString name = configuration[ "pluginName" ].toString();
|
||||
|
||||
QString namePath = dir.absoluteFilePath( name );
|
||||
QFileInfo npI( namePath );
|
||||
|
||||
if ( npI.exists() && npI.isDir() )
|
||||
{
|
||||
TomahawkUtils::removeDirectory( namePath );
|
||||
}
|
||||
|
||||
dir.rename( uniqueName, name );
|
||||
|
||||
configuration[ "bundleDir" ] = name;
|
||||
|
||||
if ( !dir.cd( QString( "%1/content" ).arg( name ) ) ) //should work if it worked once
|
||||
return 0;
|
||||
}
|
||||
|
||||
expandPaths( dir, configuration );
|
||||
|
||||
realPath = configuration[ "path" ].toString();
|
||||
if ( realPath.isEmpty() )
|
||||
{
|
||||
displayError( tr( "Resolver installation error: bad metadata in bundle." ) );
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -172,71 +221,6 @@ ResolverAccountFactory::createFromPath( const QString& path, const QString& fact
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
ResolverAccountFactory::installAxe( QString& realPath, QVariantHash& configuration )
|
||||
{
|
||||
const QFileInfo pathInfo( realPath );
|
||||
QString uniqueName = uuid();
|
||||
QDir dir( TomahawkUtils::extractScriptPayload( pathInfo.filePath(),
|
||||
uniqueName,
|
||||
MANUALRESOLVERS_DIR ) );
|
||||
if ( !( dir.exists() && dir.isReadable() ) ) //decompression fubar
|
||||
{
|
||||
JobStatusView::instance()->model()->addJob( new ErrorStatusMessage(
|
||||
tr( "Resolver installation error: cannot open bundle." ) ) );
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ( !dir.cd( "content" ) ) //more fubar
|
||||
{
|
||||
JobStatusView::instance()->model()->addJob( new ErrorStatusMessage(
|
||||
tr( "Resolver installation error: incomplete bundle." ) ) );
|
||||
return 0;
|
||||
}
|
||||
|
||||
QString metadataFilePath = dir.absoluteFilePath( "metadata.json" );
|
||||
configuration = metadataFromJsonFile( metadataFilePath );
|
||||
|
||||
configuration[ "bundleDir" ] = uniqueName;
|
||||
|
||||
if ( !configuration[ "pluginName" ].isNull() && !configuration[ "pluginName" ].toString().isEmpty() )
|
||||
{
|
||||
dir.cdUp();
|
||||
if ( !dir.cdUp() ) //we're in MANUALRESOLVERS_DIR
|
||||
return 0;
|
||||
|
||||
QString name = configuration[ "pluginName" ].toString();
|
||||
|
||||
QString namePath = dir.absoluteFilePath( name );
|
||||
QFileInfo npI( namePath );
|
||||
|
||||
if ( npI.exists() && npI.isDir() )
|
||||
{
|
||||
TomahawkUtils::removeDirectory( namePath );
|
||||
}
|
||||
|
||||
dir.rename( uniqueName, name );
|
||||
|
||||
configuration[ "bundleDir" ] = name;
|
||||
|
||||
if ( !dir.cd( QString( "%1/content" ).arg( name ) ) ) //should work if it worked once
|
||||
return 0;
|
||||
}
|
||||
|
||||
expandPaths( dir, configuration );
|
||||
|
||||
realPath = configuration[ "path" ].toString();
|
||||
if ( realPath.isEmpty() )
|
||||
{
|
||||
JobStatusView::instance()->model()->addJob( new ErrorStatusMessage(
|
||||
tr( "Resolver installation error: bad metadata in bundle." ) ) );
|
||||
return 0;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
QVariantHash
|
||||
ResolverAccountFactory::metadataFromJsonFile( const QString& path )
|
||||
{
|
||||
@@ -533,8 +517,7 @@ ResolverAccount::removeBundle()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ResolverAccount::testConfig()
|
||||
void ResolverAccount::testConfig()
|
||||
{
|
||||
// HACK: move to JSAccount once we have that properly
|
||||
JSResolver* resolver = qobject_cast< Tomahawk::JSResolver* >( m_resolver );
|
||||
@@ -552,13 +535,6 @@ ResolverAccount::testConfig()
|
||||
}
|
||||
|
||||
|
||||
ExternalResolverGui*
|
||||
ResolverAccount::resolver() const
|
||||
{
|
||||
return m_resolver;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ResolverAccount::onTestConfig( const QVariantMap& result )
|
||||
{
|
||||
|
@@ -33,8 +33,6 @@ class ExternalResolverGui;
|
||||
|
||||
namespace Accounts {
|
||||
|
||||
class ResolverAccount;
|
||||
|
||||
class DLLEXPORT ResolverAccountFactory : public AccountFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -55,10 +53,7 @@ public:
|
||||
Account* createFromPath( const QString& path ) override;
|
||||
|
||||
// Internal use
|
||||
static ResolverAccount* createFromPath( const QString& path, const QString& factoryId, bool isAttica );
|
||||
// YES, non const parameters!
|
||||
static bool installAxe( QString& realPath, QVariantHash& configuration );
|
||||
|
||||
static Account* createFromPath( const QString& path, const QString& factoryId, bool isAttica );
|
||||
|
||||
private:
|
||||
static void displayError( const QString& error );
|
||||
@@ -106,8 +101,6 @@ public:
|
||||
|
||||
void testConfig() override;
|
||||
|
||||
ExternalResolverGui* resolver() const;
|
||||
|
||||
private slots:
|
||||
void resolverChanged();
|
||||
void onTestConfig( const QVariantMap& result );
|
||||
|
@@ -71,7 +71,7 @@ LastFmAccount::LastFmAccount( const QString& accountId )
|
||||
|
||||
if ( infoPlugin() && Tomahawk::InfoSystem::InfoSystem::instance()->workerThread() )
|
||||
{
|
||||
infoPlugin()->moveToThread( Tomahawk::InfoSystem::InfoSystem::instance()->workerThread().data() );
|
||||
infoPlugin().data()->moveToThread( Tomahawk::InfoSystem::InfoSystem::instance()->workerThread().data() );
|
||||
Tomahawk::InfoSystem::InfoSystem::instance()->addInfoPlugin( infoPlugin() );
|
||||
}
|
||||
}
|
||||
@@ -82,6 +82,7 @@ LastFmAccount::~LastFmAccount()
|
||||
if ( m_infoPlugin )
|
||||
{
|
||||
Tomahawk::InfoSystem::InfoSystem::instance()->removeInfoPlugin( infoPlugin() );
|
||||
delete m_infoPlugin;
|
||||
}
|
||||
|
||||
delete m_resolver.data();
|
||||
@@ -167,11 +168,9 @@ InfoPluginPtr
|
||||
LastFmAccount::infoPlugin()
|
||||
{
|
||||
if ( m_infoPlugin.isNull() )
|
||||
{
|
||||
m_infoPlugin = QSharedPointer< LastFmInfoPlugin>( new LastFmInfoPlugin( this ) );
|
||||
}
|
||||
m_infoPlugin = QPointer< LastFmInfoPlugin >( new LastFmInfoPlugin( this ) );
|
||||
|
||||
return m_infoPlugin;
|
||||
return InfoPluginPtr( m_infoPlugin.data() );
|
||||
}
|
||||
|
||||
bool
|
||||
|
@@ -105,7 +105,7 @@ private:
|
||||
void hookupResolver();
|
||||
|
||||
QPointer<Tomahawk::ExternalResolverGui> m_resolver;
|
||||
QSharedPointer<Tomahawk::InfoSystem::LastFmInfoPlugin> m_infoPlugin;
|
||||
QPointer<Tomahawk::InfoSystem::LastFmInfoPlugin> m_infoPlugin;
|
||||
QPointer<LastFmConfig> m_configWidget;
|
||||
};
|
||||
|
||||
|
@@ -116,12 +116,6 @@ SpotifyAccount::~SpotifyAccount()
|
||||
{
|
||||
clearUser();
|
||||
|
||||
if ( m_infoPlugin )
|
||||
{
|
||||
Tomahawk::InfoSystem::InfoSystem::instance()->removeInfoPlugin( infoPlugin() );
|
||||
}
|
||||
|
||||
|
||||
if ( m_spotifyResolver.isNull() )
|
||||
return;
|
||||
|
||||
@@ -141,7 +135,7 @@ SpotifyAccount::init()
|
||||
|
||||
if ( infoPlugin() && Tomahawk::InfoSystem::InfoSystem::instance()->workerThread() )
|
||||
{
|
||||
infoPlugin()->moveToThread( Tomahawk::InfoSystem::InfoSystem::instance()->workerThread().data() );
|
||||
infoPlugin().data()->moveToThread( Tomahawk::InfoSystem::InfoSystem::instance()->workerThread().data() );
|
||||
Tomahawk::InfoSystem::InfoSystem::instance()->addInfoPlugin( infoPlugin() );
|
||||
}
|
||||
|
||||
@@ -372,10 +366,10 @@ SpotifyAccount::infoPlugin()
|
||||
{
|
||||
if ( m_infoPlugin.isNull() )
|
||||
{
|
||||
m_infoPlugin = QSharedPointer< InfoSystem::SpotifyInfoPlugin >( new InfoSystem::SpotifyInfoPlugin( this ) );
|
||||
m_infoPlugin = QPointer< InfoSystem::SpotifyInfoPlugin >( new InfoSystem::SpotifyInfoPlugin( this ) );
|
||||
}
|
||||
|
||||
return m_infoPlugin;
|
||||
return InfoSystem::InfoPluginPtr( m_infoPlugin.data() );
|
||||
}
|
||||
|
||||
|
||||
|
@@ -170,7 +170,7 @@ private:
|
||||
QPointer<SpotifyAccountConfig> m_configWidget;
|
||||
QPointer<QWidget> m_aboutWidget;
|
||||
QPointer<ScriptResolver> m_spotifyResolver;
|
||||
QSharedPointer< InfoSystem::SpotifyInfoPlugin > m_infoPlugin;
|
||||
QPointer< InfoSystem::SpotifyInfoPlugin > m_infoPlugin;
|
||||
|
||||
QMap<QString, QPair<QObject*, QString> > m_qidToSlotMap;
|
||||
QMap<QString, QVariant > m_qidToExtraData;
|
||||
|
@@ -277,7 +277,7 @@ SpotifyAccountConfig::showLoggedIn()
|
||||
m_ui->verticalLayout->insertWidget( 1, m_loggedInUser, 0, Qt::AlignCenter );
|
||||
}
|
||||
|
||||
qDebug() << "Showing logged in with username:" << m_verifiedUsername;
|
||||
qDebug() << "Showing logged in withuserame:" << m_verifiedUsername;
|
||||
m_loggedInUser->show();
|
||||
m_loggedInUser->setText( tr( "Logged in as %1" ).arg( m_verifiedUsername ) );
|
||||
|
||||
|
@@ -669,7 +669,7 @@ AudioEngine::performLoadIODevice( const result_ptr& result, const QString& url )
|
||||
|
||||
|
||||
void
|
||||
AudioEngine::performLoadTrack( const Tomahawk::result_ptr result, const QString& url, QSharedPointer< QIODevice > io )
|
||||
AudioEngine::performLoadTrack( const Tomahawk::result_ptr result, const QString url, QSharedPointer< QIODevice > io )
|
||||
{
|
||||
if ( QThread::currentThread() != thread() )
|
||||
{
|
||||
|
@@ -186,7 +186,7 @@ private slots:
|
||||
|
||||
|
||||
void performLoadIODevice( const Tomahawk::result_ptr& result, const QString& url ); //only call from loadTrack kthxbi
|
||||
void performLoadTrack( const Tomahawk::result_ptr result, const QString& url, QSharedPointer< QIODevice > io ); //only call from loadTrack or performLoadIODevice kthxbi
|
||||
void performLoadTrack( const Tomahawk::result_ptr result, const QString url, QSharedPointer< QIODevice > io ); //only call from loadTrack or performLoadIODevice kthxbi
|
||||
void loadPreviousTrack();
|
||||
void loadNextTrack();
|
||||
|
||||
|
@@ -277,8 +277,8 @@ InfoSystem::addInfoPlugin( Tomahawk::InfoSystem::InfoPluginPtr plugin )
|
||||
|
||||
if ( plugin.data()->thread() != m_infoSystemWorkerThreadController->worker()->thread() )
|
||||
{
|
||||
tLog() << Q_FUNC_INFO << "The object must be moved to the worker thread first, see InfoSystem::workerThread(): " << plugin->friendlyName();
|
||||
Q_ASSERT( false );
|
||||
tDebug() << Q_FUNC_INFO << "The object must be moved to the worker thread first, see InfoSystem::workerThread()";
|
||||
return;
|
||||
}
|
||||
|
||||
|
@@ -58,7 +58,13 @@ InfoSystemWorker::InfoSystemWorker()
|
||||
|
||||
InfoSystemWorker::~InfoSystemWorker()
|
||||
{
|
||||
tDebug() << Q_FUNC_INFO;
|
||||
tDebug() << Q_FUNC_INFO << " beginning";
|
||||
Q_FOREACH( InfoPluginPtr plugin, m_plugins )
|
||||
{
|
||||
if( plugin )
|
||||
delete plugin.data();
|
||||
}
|
||||
tDebug() << Q_FUNC_INFO << " finished";
|
||||
}
|
||||
|
||||
|
||||
@@ -130,6 +136,29 @@ InfoSystemWorker::addInfoPlugin( Tomahawk::InfoSystem::InfoPluginPtr plugin )
|
||||
|
||||
emit updatedSupportedGetTypes( QSet< InfoType >::fromList( m_infoGetMap.keys() ) );
|
||||
emit updatedSupportedPushTypes( QSet< InfoType >::fromList( m_infoPushMap.keys() ) );
|
||||
|
||||
connect( plugin.data(), SIGNAL( destroyed( QObject* ) ), SLOT( onInfoPluginDeleted() ) );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
InfoSystemWorker::onInfoPluginDeleted()
|
||||
{
|
||||
foreach( const InfoPluginPtr& plugin, m_plugins )
|
||||
{
|
||||
if ( plugin.isNull() )
|
||||
{
|
||||
m_plugins.removeOne( plugin );
|
||||
foreach( InfoType type, m_infoGetMap.keys() )
|
||||
{
|
||||
m_infoGetMap[type].removeOne( plugin );
|
||||
}
|
||||
foreach( InfoType type, m_infoPushMap.keys() )
|
||||
{
|
||||
m_infoPushMap[type].removeOne( plugin );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@@ -72,6 +72,7 @@ public slots:
|
||||
|
||||
private slots:
|
||||
void checkTimeoutsTimerFired();
|
||||
void onInfoPluginDeleted();
|
||||
|
||||
private:
|
||||
void registerInfoTypes( const InfoPluginPtr &plugin, const QSet< InfoType > &getTypes, const QSet< InfoType > &pushTypes );
|
||||
|
@@ -33,12 +33,6 @@ JobStatusItem::~JobStatusItem()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
JobStatusItem::activated()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
JobStatusItem::allowMultiLine() const
|
||||
{
|
||||
|
@@ -53,8 +53,6 @@ public:
|
||||
virtual QString mainText() const = 0;
|
||||
virtual QString rightColumnText() const { return QString(); };
|
||||
|
||||
virtual void activated();
|
||||
|
||||
/**
|
||||
* If collapse item is true, sending multiple items of the same type will "collapse" them into one
|
||||
* instead of showing each individually. In this case, the right column from the item will be ignored
|
||||
|
@@ -118,7 +118,6 @@ JobStatusView::setModel( JobStatusSortModel* m )
|
||||
connect( m_view->model(), SIGNAL( customDelegateJobInserted( int, JobStatusItem* ) ), this, SLOT( customDelegateJobInserted( int, JobStatusItem* ) ) );
|
||||
connect( m_view->model(), SIGNAL( customDelegateJobRemoved( int ) ), this, SLOT( customDelegateJobRemoved( int ) ) );
|
||||
connect( m_view->model(), SIGNAL( refreshDelegates() ), this, SLOT( refreshDelegates() ) );
|
||||
connect( m_view, SIGNAL( activated( QModelIndex ) ), this, SLOT( onItemActivated( QModelIndex ) ) );
|
||||
|
||||
foreach ( const QPointer<JobStatusItem> item, s_jobItems )
|
||||
{
|
||||
@@ -185,21 +184,6 @@ JobStatusView::refreshDelegates()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
JobStatusView::onItemActivated( const QModelIndex& index )
|
||||
{
|
||||
QVariant itemVar = index.data( JobStatusModel::JobDataRole );
|
||||
if ( !itemVar.canConvert< JobStatusItem* >() || !itemVar.value< JobStatusItem* >() )
|
||||
{
|
||||
tLog() << Q_FUNC_INFO << "unable to fetch JobStatusItem*";
|
||||
return;
|
||||
}
|
||||
|
||||
JobStatusItem* item = itemVar.value< JobStatusItem* >();
|
||||
item->activated();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
JobStatusView::checkCount()
|
||||
{
|
||||
|
@@ -59,7 +59,6 @@ private slots:
|
||||
void customDelegateJobInserted( int row, JobStatusItem* item );
|
||||
void customDelegateJobRemoved( int row );
|
||||
void refreshDelegates();
|
||||
void onItemActivated( const QModelIndex& index );
|
||||
|
||||
private:
|
||||
QListView* m_view;
|
||||
|
@@ -1,37 +0,0 @@
|
||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||
*
|
||||
* Copyright 2016, Dominik Schmidt <domme@tomahawk-player.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 "ScriptErrorStatusMessage.h"
|
||||
#include "../utils/Logger.h"
|
||||
|
||||
ScriptErrorStatusMessage::ScriptErrorStatusMessage( const QString& message, Tomahawk::ScriptAccount* account )
|
||||
: ErrorStatusMessage( tr( "Script Error: %1" ).arg( message ) )
|
||||
, m_account( account )
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ScriptErrorStatusMessage::activated()
|
||||
{
|
||||
if ( m_account.isNull() )
|
||||
return;
|
||||
|
||||
tDebug() << "ScriptErrorStatusMessage clicked: " << mainText() << m_account->name();
|
||||
m_account->showDebugger();
|
||||
}
|
||||
|
@@ -1,39 +0,0 @@
|
||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||
*
|
||||
* Copyright 2016, Dominik Schmidt <domme@tomahawk-player.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 SCRIPTERRORSTATUSMESSAGE_H
|
||||
#define SCRIPTERRORSTATUSMESSAGE_H
|
||||
|
||||
#include "ErrorStatusMessage.h"
|
||||
#include "../resolvers/ScriptAccount.h"
|
||||
|
||||
#include "DllMacro.h"
|
||||
|
||||
class DLLEXPORT ScriptErrorStatusMessage : public ErrorStatusMessage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ScriptErrorStatusMessage( const QString& scriptErrorMessage, Tomahawk::ScriptAccount* );
|
||||
|
||||
void activated() override;
|
||||
|
||||
private:
|
||||
QPointer< Tomahawk::ScriptAccount > m_account;
|
||||
};
|
||||
|
||||
#endif // SCRIPTERRORSTATUSMESSAGE_H
|
@@ -118,10 +118,6 @@ ColumnView::setModel( QAbstractItemModel* model )
|
||||
void
|
||||
ColumnView::setTreeModel( TreeModel* model )
|
||||
{
|
||||
// HACK: without setting a new preview widget, the old preview widget is shown in the first column while loading the artists.
|
||||
m_previewWidget = new ColumnViewPreviewWidget( this );
|
||||
setPreviewWidget( m_previewWidget );
|
||||
|
||||
m_model = model;
|
||||
|
||||
if ( m_proxyModel )
|
||||
|
@@ -96,10 +96,8 @@ ContextView::ContextView( QWidget* parent, const QString& caption )
|
||||
|
||||
connect( m_captionLabel, SIGNAL( clicked() ), SIGNAL( closeClicked() ) );
|
||||
connect( m_trackView, SIGNAL( querySelected( Tomahawk::query_ptr ) ), SLOT( onQuerySelected( Tomahawk::query_ptr ) ) );
|
||||
connect( m_trackView, SIGNAL( modelChanged() ), SLOT( onModelChanged() ) );
|
||||
connect( m_trackView, SIGNAL( querySelected( Tomahawk::query_ptr ) ), m_detailView, SLOT( setQuery( Tomahawk::query_ptr ) ) );
|
||||
connect( m_detailView, SIGNAL( downloadAll() ), SLOT( onDownloadAll() ) );
|
||||
connect( m_detailView, SIGNAL( downloadCancel() ), SLOT( onDownloadCancel() ) );
|
||||
connect( m_trackView, SIGNAL( modelChanged() ), SLOT( onModelChanged() ) );
|
||||
|
||||
TomahawkUtils::fixMargins( this );
|
||||
}
|
||||
|
@@ -20,15 +20,11 @@
|
||||
#include "GridItemDelegate.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QDesktopServices>
|
||||
#include <QPainter>
|
||||
#include <QAbstractItemView>
|
||||
#include <QMouseEvent>
|
||||
#include <QTimeLine>
|
||||
|
||||
#include "DownloadManager.h"
|
||||
#include "DownloadJob.h"
|
||||
|
||||
#include "Artist.h"
|
||||
#include "Query.h"
|
||||
#include "Result.h"
|
||||
@@ -39,14 +35,12 @@
|
||||
#include "playlist/PlayableItem.h"
|
||||
#include "playlist/PlayableProxyModel.h"
|
||||
#include "widgets/HoverControls.h"
|
||||
#include "widgets/DropDownButton.h"
|
||||
#include "widgets/ImageButton.h"
|
||||
#include "utils/TomahawkStyle.h"
|
||||
#include "utils/TomahawkUtilsGui.h"
|
||||
#include "utils/PixmapDelegateFader.h"
|
||||
#include "utils/Closure.h"
|
||||
#include "utils/AnimatedSpinner.h"
|
||||
#include "utils/WebPopup.h"
|
||||
#include "utils/DpiScaler.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
@@ -61,7 +55,6 @@ GridItemDelegate::GridItemDelegate( QAbstractItemView* parent, PlayableProxyMode
|
||||
, m_model( proxy )
|
||||
, m_itemWidth( 0 )
|
||||
, m_showPosition( false )
|
||||
, m_showBuyButtons( false )
|
||||
, m_wordWrapping( false )
|
||||
, m_margin( TomahawkUtils::DpiScaler::scaledY( parent, 32 ) )
|
||||
{
|
||||
@@ -100,8 +93,7 @@ GridItemDelegate::sizeHint( const QStyleOptionViewItem& option, const QModelInde
|
||||
if ( !m_wordWrapping )
|
||||
return QSize( m_itemWidth, m_itemWidth + fm.height() + m_margin * 0.8 );
|
||||
|
||||
const int buyButtonHeight = m_showBuyButtons ? 40 : 0;
|
||||
return QSize( m_itemWidth, m_itemWidth + fm.height() + fms.height() + buyButtonHeight + m_margin * 0.8 );
|
||||
return QSize( m_itemWidth, m_itemWidth + fm.height() + fms.height() + m_margin * 0.8 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -283,11 +275,6 @@ GridItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option,
|
||||
painter->setFont( f );
|
||||
}
|
||||
|
||||
if ( m_showBuyButtons && !item->query().isNull() )
|
||||
{
|
||||
textRect.adjust( 0, 0, 0, -40 );
|
||||
}
|
||||
|
||||
to.setAlignment( Qt::AlignLeft | Qt::AlignTop );
|
||||
text = painter->fontMetrics().elidedText( top, Qt::ElideRight, textRect.width() - m_margin / 4 );
|
||||
painter->drawText( textRect, text, to );
|
||||
@@ -299,7 +286,6 @@ GridItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option,
|
||||
}
|
||||
painter->restore();
|
||||
|
||||
painter->save();
|
||||
painter->setOpacity( 0.6 );
|
||||
painter->setFont( m_smallFont );
|
||||
|
||||
@@ -318,48 +304,6 @@ GridItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option,
|
||||
|
||||
// Calculate rect of artist on-hover button click area
|
||||
m_artistNameRects[ index ] = painter->fontMetrics().boundingRect( textRect, Qt::AlignLeft | Qt::AlignBottom, text );
|
||||
painter->restore();
|
||||
|
||||
if ( m_showBuyButtons && !item->query().isNull() )
|
||||
{
|
||||
QRect r = textRect;
|
||||
r.setY( textRect.y() + textRect.height() + 8 );
|
||||
r.setHeight( 32 );
|
||||
m_buyButtonRects[ index ] = r;
|
||||
|
||||
QString text;
|
||||
if ( item->result() &&
|
||||
( ( !item->result()->downloadFormats().isEmpty() && !DownloadManager::instance()->localFileForDownload( item->result()->downloadFormats().first().url.toString() ).isEmpty() ) ||
|
||||
( item->result()->downloadJob() && item->result()->downloadJob()->state() == DownloadJob::Finished ) ) )
|
||||
{
|
||||
text = tr( "View in Finder" );
|
||||
}
|
||||
else if ( item->query() && item->query()->numResults( true ) && !item->query()->results().first()->downloadFormats().isEmpty() )
|
||||
{
|
||||
text = tr( "Download %1" ).arg( item->query()->results().first()->downloadFormats().first().extension.toUpper() );
|
||||
}
|
||||
else if ( item->query()->numResults( true ) && !item->query()->results().first()->purchaseUrl().isEmpty() )
|
||||
{
|
||||
text = tr( "Buy" );
|
||||
}
|
||||
|
||||
if ( !item->result() || !item->result()->downloadJob() )
|
||||
{
|
||||
if ( !text.isEmpty() )
|
||||
DropDownButton::drawPrimitive( painter, r, text, m_hoveringOverBuyButton == index, false );
|
||||
}
|
||||
else
|
||||
{
|
||||
painter->setPen( TomahawkStyle::PLAYLIST_PROGRESS_FOREGROUND.darker() );
|
||||
painter->setBrush( TomahawkStyle::PLAYLIST_PROGRESS_BACKGROUND );
|
||||
painter->drawRect( r.adjusted( 2, 2, -2, -2 ) );
|
||||
painter->setPen( TomahawkStyle::PLAYLIST_PROGRESS_FOREGROUND );
|
||||
painter->setBrush( TomahawkStyle::PLAYLIST_PROGRESS_FOREGROUND );
|
||||
QRect fillp = r.adjusted( 3, 3, -3, -3 );
|
||||
fillp.setWidth( float(fillp.width()) * ( float(item->result()->downloadJob()->progressPercentage()) / 100.0 ) );
|
||||
painter->drawRect( fillp );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
painter->restore();
|
||||
@@ -418,7 +362,6 @@ GridItemDelegate::editorEvent( QEvent* event, QAbstractItemModel* model, const Q
|
||||
const QMouseEvent* ev = static_cast< QMouseEvent* >( event );
|
||||
bool hoveringArtist = false;
|
||||
bool hoveringAlbum = false;
|
||||
bool hoveringBuyButton = false;
|
||||
if ( m_artistNameRects.contains( index ) )
|
||||
{
|
||||
const QRect artistNameRect = m_artistNameRects[ index ];
|
||||
@@ -429,11 +372,6 @@ GridItemDelegate::editorEvent( QEvent* event, QAbstractItemModel* model, const Q
|
||||
const QRect albumNameRect = m_albumNameRects[ index ];
|
||||
hoveringAlbum = albumNameRect.contains( ev->pos() );
|
||||
}
|
||||
if ( m_buyButtonRects.contains( index ) )
|
||||
{
|
||||
const QRect buyButtonRect = m_buyButtonRects[ index ];
|
||||
hoveringBuyButton = buyButtonRect.contains( ev->pos() );
|
||||
}
|
||||
|
||||
QRect coverRect = m_view->visualRect( index );
|
||||
coverRect.setHeight( coverRect.width() );
|
||||
@@ -441,7 +379,7 @@ GridItemDelegate::editorEvent( QEvent* event, QAbstractItemModel* model, const Q
|
||||
|
||||
if ( event->type() == QEvent::MouseMove )
|
||||
{
|
||||
if ( hoveringArtist || hoveringAlbum || hoveringBuyButton )
|
||||
if ( hoveringArtist || hoveringAlbum )
|
||||
m_view->setCursor( Qt::PointingHandCursor );
|
||||
else
|
||||
m_view->setCursor( Qt::ArrowCursor );
|
||||
@@ -497,17 +435,6 @@ GridItemDelegate::editorEvent( QEvent* event, QAbstractItemModel* model, const Q
|
||||
|
||||
emit updateIndex( index );
|
||||
}
|
||||
if ( m_hoveringOverBuyButton != index || ( !hoveringBuyButton && m_hoveringOverBuyButton.isValid() ) )
|
||||
{
|
||||
emit updateIndex( m_hoveringOverBuyButton );
|
||||
|
||||
if ( hoveringBuyButton )
|
||||
m_hoveringOverBuyButton = index;
|
||||
else
|
||||
m_hoveringOverBuyButton = QPersistentModelIndex();
|
||||
|
||||
emit updateIndex( index );
|
||||
}
|
||||
|
||||
if ( m_hoverIndex != index || !hoveringCover )
|
||||
{
|
||||
@@ -617,27 +544,6 @@ GridItemDelegate::editorEvent( QEvent* event, QAbstractItemModel* model, const Q
|
||||
}
|
||||
}
|
||||
|
||||
if ( hoveringBuyButton )
|
||||
{
|
||||
if ( event->type() == QEvent::MouseButtonRelease )
|
||||
{
|
||||
PlayableItem* item = m_model->sourceModel()->itemFromIndex( m_model->mapToSource( index ) );
|
||||
if ( !item )
|
||||
return false;
|
||||
|
||||
if ( item->query() && item->query()->numResults( true ) && !item->query()->results().first()->downloadFormats().isEmpty() )
|
||||
{
|
||||
m_view->edit( index );
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
WebPopup* popup = new WebPopup( item->query()->results().first()->purchaseUrl(), QSize( 400, 800 ) );
|
||||
connect( item->query()->results().first().data(), SIGNAL( destroyed() ), popup, SLOT( close() ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -649,7 +555,6 @@ GridItemDelegate::modelChanged()
|
||||
m_albumNameRects.clear();
|
||||
m_hoveringOverArtist = QPersistentModelIndex();
|
||||
m_hoveringOverAlbum = QPersistentModelIndex();
|
||||
m_hoveringOverBuyButton = QPersistentModelIndex();
|
||||
m_hoverIndex = QPersistentModelIndex();
|
||||
|
||||
clearButtons();
|
||||
@@ -782,10 +687,6 @@ GridItemDelegate::resetHoverIndex()
|
||||
idx = m_hoveringOverAlbum;
|
||||
m_hoveringOverAlbum = QPersistentModelIndex();
|
||||
doUpdateIndex( idx );
|
||||
|
||||
idx = m_hoveringOverBuyButton;
|
||||
m_hoveringOverBuyButton = QPersistentModelIndex();
|
||||
doUpdateIndex( idx );
|
||||
}
|
||||
|
||||
|
||||
@@ -857,97 +758,3 @@ GridItemDelegate::eventFilter( QObject* obj, QEvent* event )
|
||||
else
|
||||
return QObject::eventFilter( obj, event );
|
||||
}
|
||||
|
||||
|
||||
QWidget*
|
||||
GridItemDelegate::createEditor( QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index ) const
|
||||
{
|
||||
PlayableItem* item = m_model->itemFromIndex( m_model->mapToSource( index ) );
|
||||
Q_ASSERT( item );
|
||||
|
||||
if ( item->result() && !item->result()->downloadFormats().isEmpty() &&
|
||||
!DownloadManager::instance()->localFileForDownload( item->result()->downloadFormats().first().url.toString() ).isEmpty() )
|
||||
{
|
||||
QDesktopServices::openUrl( QUrl::fromLocalFile( QFileInfo( DownloadManager::instance()->localFileForDownload( item->result()->downloadFormats().first().url.toString() ) ).absolutePath() ) );
|
||||
}
|
||||
else if ( item->result() && item->result()->downloadJob() && item->result()->downloadJob()->state() == DownloadJob::Finished )
|
||||
{
|
||||
QDesktopServices::openUrl( QUrl::fromLocalFile( QFileInfo( item->result()->downloadJob()->localFile() ).absolutePath() ) );
|
||||
}
|
||||
else if ( item->result() &&
|
||||
!item->result()->downloadFormats().isEmpty() && !item->result()->downloadJob() )
|
||||
{
|
||||
QStringList formats;
|
||||
foreach ( const DownloadFormat& format, item->result()->downloadFormats() )
|
||||
{
|
||||
formats << tr( "Download %1" ).arg( format.extension.toUpper() );
|
||||
}
|
||||
|
||||
DropDownButton* editor = new DropDownButton( parent );
|
||||
editor->addItems( formats );
|
||||
|
||||
NewClosure( editor, SIGNAL( clicked() ),
|
||||
const_cast<GridItemDelegate*>(this), SLOT( addDownloadJob( const QModelIndex&, QWidget* ) ), index, (QWidget*)editor );
|
||||
|
||||
NewClosure( editor, SIGNAL( activated( int ) ),
|
||||
const_cast<GridItemDelegate*>(this), SLOT( addDownloadJob( const QModelIndex&, QWidget* ) ), index, (QWidget*)editor );
|
||||
return editor;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
GridItemDelegate::addDownloadJob( const QModelIndex& index, QWidget* editor )
|
||||
{
|
||||
PlayableItem* item = m_model->itemFromIndex( m_model->mapToSource( index ) );
|
||||
Q_ASSERT( item );
|
||||
|
||||
m_view->closePersistentEditor( index );
|
||||
|
||||
DropDownButton* cb = static_cast< DropDownButton* >(editor);
|
||||
if ( !item->result()->downloadFormats().isEmpty() )
|
||||
DownloadManager::instance()->addJob( item->result()->toDownloadJob( item->result()->downloadFormats().at( cb->currentIndex() ) ) );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
GridItemDelegate::closeEditor( const QModelIndex& index, QWidget* editor )
|
||||
{
|
||||
PlayableItem* item = m_model->itemFromIndex( m_model->mapToSource( index ) );
|
||||
Q_ASSERT( item );
|
||||
|
||||
m_view->closePersistentEditor( index );
|
||||
|
||||
DropDownButton* cb = static_cast< DropDownButton* >(editor);
|
||||
editor->deleteLater();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
GridItemDelegate::updateEditorGeometry( QWidget* editor, const QStyleOptionViewItem& option, const QModelIndex& index ) const
|
||||
{
|
||||
QStyledItemDelegate::updateEditorGeometry( editor, option, index );
|
||||
|
||||
DropDownButton* comboBox = static_cast<DropDownButton*>(editor);
|
||||
comboBox->resize( option.rect.size() - QSize( 8, 0 ) );
|
||||
comboBox->move( option.rect.x() + 4, option.rect.y() );
|
||||
|
||||
if ( m_downloadDropDownRects.contains( index ) )
|
||||
{
|
||||
editor->setGeometry( m_downloadDropDownRects.value( index ) );
|
||||
}
|
||||
|
||||
if ( !comboBox->property( "shownPopup" ).toBool() )
|
||||
{
|
||||
comboBox->showPopup();
|
||||
comboBox->setProperty( "shownPopup", true );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
GridItemDelegate::setModelData( QWidget* editor, QAbstractItemModel* model, const QModelIndex& index ) const
|
||||
{
|
||||
}
|
||||
|
@@ -48,7 +48,6 @@ public:
|
||||
|
||||
QSize itemSize() const;
|
||||
void setItemWidth( int width ) { m_itemWidth = width; }
|
||||
void setShowBuyButtons( bool enabled ) { m_showBuyButtons = enabled; }
|
||||
|
||||
public slots:
|
||||
void resetHoverIndex();
|
||||
@@ -62,10 +61,6 @@ protected:
|
||||
bool editorEvent( QEvent* event, QAbstractItemModel* model, const QStyleOptionViewItem& option, const QModelIndex& index );
|
||||
bool eventFilter( QObject* obj, QEvent* event );
|
||||
|
||||
QWidget* createEditor( QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index ) const;
|
||||
void updateEditorGeometry( QWidget* editor, const QStyleOptionViewItem& option, const QModelIndex& index ) const;
|
||||
void setModelData( QWidget* editor, QAbstractItemModel* model, const QModelIndex& index ) const;
|
||||
|
||||
signals:
|
||||
void updateIndex( const QModelIndex& idx );
|
||||
|
||||
@@ -87,9 +82,6 @@ private slots:
|
||||
void fadingFrameChanged( const QPersistentModelIndex& );
|
||||
void fadingFrameFinished( const QPersistentModelIndex& );
|
||||
|
||||
void closeEditor( const QModelIndex& index, QWidget* editor );
|
||||
void addDownloadJob( const QModelIndex& index, QWidget* editor );
|
||||
|
||||
private:
|
||||
QTimeLine* createTimeline( QTimeLine::Direction direction, int startFrame = 0 );
|
||||
void clearButtons();
|
||||
@@ -98,19 +90,15 @@ private:
|
||||
PlayableProxyModel* m_model;
|
||||
int m_itemWidth;
|
||||
bool m_showPosition;
|
||||
bool m_showBuyButtons;
|
||||
bool m_wordWrapping;
|
||||
|
||||
mutable QHash< QPersistentModelIndex, QRect > m_artistNameRects;
|
||||
mutable QHash< QPersistentModelIndex, QRect > m_albumNameRects;
|
||||
mutable QHash< QPersistentModelIndex, QRect > m_buyButtonRects;
|
||||
mutable QHash< QPersistentModelIndex, QRect > m_downloadDropDownRects;
|
||||
mutable QHash< QPersistentModelIndex, QSharedPointer< Tomahawk::PixmapDelegateFader > > m_covers;
|
||||
|
||||
QPersistentModelIndex m_hoverIndex;
|
||||
QPersistentModelIndex m_hoveringOverArtist;
|
||||
QPersistentModelIndex m_hoveringOverAlbum;
|
||||
QPersistentModelIndex m_hoveringOverBuyButton;
|
||||
|
||||
mutable QHash< QPersistentModelIndex, QWidget* > m_spinner;
|
||||
mutable QHash< QPersistentModelIndex, HoverControls* > m_hoverControls;
|
||||
|
@@ -255,8 +255,6 @@ void GridView::wheelEvent( QWheelEvent* e )
|
||||
// ^ scroll step is 1/8 of the estimated row height
|
||||
|
||||
QListView::wheelEvent( e );
|
||||
|
||||
m_delegate->resetHoverIndex();
|
||||
}
|
||||
|
||||
|
||||
|
@@ -1027,7 +1027,7 @@ PlayableModel::appendAlbums( const QList< Tomahawk::album_ptr >& albums )
|
||||
void
|
||||
PlayableModel::appendAlbums( const Tomahawk::collection_ptr& collection )
|
||||
{
|
||||
startLoading();
|
||||
emit loadingStarted();
|
||||
insertAlbums( collection, rowCount( QModelIndex() ) );
|
||||
}
|
||||
|
||||
@@ -1042,7 +1042,7 @@ PlayableModel::appendQueries( const QList< Tomahawk::query_ptr >& queries )
|
||||
void
|
||||
PlayableModel::appendTracks( const QList< Tomahawk::track_ptr >& tracks, const QList< Tomahawk::PlaybackLog >& logs )
|
||||
{
|
||||
startLoading();
|
||||
emit loadingStarted();
|
||||
QList< Tomahawk::query_ptr > queries;
|
||||
foreach ( const track_ptr& track, tracks )
|
||||
{
|
||||
@@ -1056,7 +1056,7 @@ PlayableModel::appendTracks( const QList< Tomahawk::track_ptr >& tracks, const Q
|
||||
void
|
||||
PlayableModel::appendTracks( const Tomahawk::collection_ptr& collection )
|
||||
{
|
||||
startLoading();
|
||||
emit loadingStarted();
|
||||
insertTracks( collection, rowCount( QModelIndex() ) );
|
||||
}
|
||||
|
||||
|
@@ -23,7 +23,6 @@
|
||||
#include <QAbstractTextDocumentLayout>
|
||||
#include <QApplication>
|
||||
#include <QDateTime>
|
||||
#include <QDesktopServices>
|
||||
#include <QMouseEvent>
|
||||
#include <QPainter>
|
||||
#include <QDesktopServices>
|
||||
@@ -52,7 +51,6 @@
|
||||
#include "utils/Closure.h"
|
||||
#include "utils/TomahawkStyle.h"
|
||||
#include "utils/TomahawkUtilsGui.h"
|
||||
#include "utils/WebPopup.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
using namespace Tomahawk;
|
||||
@@ -125,16 +123,16 @@ PlaylistItemDelegate::createEditor( QWidget* parent, const QStyleOptionViewItem&
|
||||
PlayableItem* item = m_model->itemFromIndex( m_model->mapToSource( index ) );
|
||||
Q_ASSERT( item );
|
||||
|
||||
if ( /*index.column() == PlayableModel::Download &&*/ item->result() && !item->result()->downloadFormats().isEmpty() &&
|
||||
if ( index.column() == PlayableModel::Download && item->result() && !item->result()->downloadFormats().isEmpty() &&
|
||||
!DownloadManager::instance()->localFileForDownload( item->result()->downloadFormats().first().url.toString() ).isEmpty() )
|
||||
{
|
||||
QDesktopServices::openUrl( QUrl::fromLocalFile( QFileInfo( DownloadManager::instance()->localFileForDownload( item->result()->downloadFormats().first().url.toString() ) ).absolutePath() ) );
|
||||
}
|
||||
else if ( /*index.column() == PlayableModel::Download &&*/ item->result() && item->result()->downloadJob() && item->result()->downloadJob()->state() == DownloadJob::Finished )
|
||||
else if ( index.column() == PlayableModel::Download && item->result() && item->result()->downloadJob() && item->result()->downloadJob()->state() == DownloadJob::Finished )
|
||||
{
|
||||
QDesktopServices::openUrl( QUrl::fromLocalFile( QFileInfo( item->result()->downloadJob()->localFile() ).absolutePath() ) );
|
||||
}
|
||||
else if ( /*index.column() == PlayableModel::Download &&*/ item->result() &&
|
||||
else if ( index.column() == PlayableModel::Download && item->result() &&
|
||||
!item->result()->downloadFormats().isEmpty() && !item->result()->downloadJob() )
|
||||
{
|
||||
QStringList formats;
|
||||
@@ -194,14 +192,9 @@ PlaylistItemDelegate::updateEditorGeometry( QWidget* editor, const QStyleOptionV
|
||||
comboBox->resize( option.rect.size() - QSize( 8, 0 ) );
|
||||
comboBox->move( option.rect.x() + 4, option.rect.y() );
|
||||
|
||||
if ( m_downloadDropDownRects.contains( index ) )
|
||||
{
|
||||
editor->setGeometry( m_downloadDropDownRects.value( index ) );
|
||||
}
|
||||
|
||||
if ( !comboBox->property( "shownPopup" ).toBool() )
|
||||
{
|
||||
comboBox->showPopup();
|
||||
// comboBox->showPopup();
|
||||
comboBox->setProperty( "shownPopup", true );
|
||||
}
|
||||
}
|
||||
@@ -298,8 +291,7 @@ PlaylistItemDelegate::paintDetailed( QPainter* painter, const QStyleOptionViewIt
|
||||
}
|
||||
else if ( !item->result()->downloadJob() )
|
||||
{
|
||||
DropDownButton::drawPrimitive( painter, optc.rect, optc.currentText, hoveringOver() == index, true );
|
||||
|
||||
DropDownButton::drawPrimitive( painter, optc.rect, optc.currentText );
|
||||
/* QApplication::style()->drawComplexControl( QStyle::CC_ComboBox, &optc, painter, 0 );
|
||||
optc.rect.adjust( 4, 0, 0, 0 );
|
||||
QApplication::style()->drawControl( QStyle::CE_ComboBoxLabel, &optc, painter, 0 );*/
|
||||
@@ -612,7 +604,6 @@ QRect
|
||||
PlaylistItemDelegate::drawTrack( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index, const QRect& rect, PlayableItem* item ) const
|
||||
{
|
||||
const track_ptr track = item->query()->track();
|
||||
const bool hasOnlineResults = ( item->query()->numResults( true ) > 0 );
|
||||
|
||||
painter->save();
|
||||
painter->setRenderHint( QPainter::TextAntialiasing );
|
||||
@@ -639,87 +630,21 @@ PlaylistItemDelegate::drawTrack( QPainter* painter, const QStyleOptionViewItem&
|
||||
|
||||
QRect numberRect = QRect( r.x(), r.y(), numberWidth, r.height() );
|
||||
QRect extraRect = QRect( r.x() + r.width() - durationWidth, r.y(), durationWidth, r.height() );
|
||||
QRect stateRect = extraRect.adjusted( 0, 0, 0, 0 );
|
||||
|
||||
if ( option.state & QStyle::State_Selected || hoveringOver() == index )
|
||||
QRect stateRect;
|
||||
if ( option.state & QStyle::State_Selected || hoveringOver() == index )
|
||||
{
|
||||
int h = extraRect.height() / 3;
|
||||
|
||||
if ( track->loved() )
|
||||
{
|
||||
painter->save();
|
||||
painter->setOpacity( 0.5 );
|
||||
QRect r = stateRect.adjusted( -16, extraRect.height() / 2 - h / 2, 0, 0 );
|
||||
r.setHeight( h );
|
||||
r.setWidth( r.height() );
|
||||
painter->drawPixmap( r, ImageRegistry::instance()->pixmap( RESPATH "images/love.svg", r.size() ) );
|
||||
painter->restore();
|
||||
int h = extraRect.height() / 3;
|
||||
stateRect = extraRect.adjusted( -16, extraRect.height() / 2 - h / 2, 0, 0 );
|
||||
stateRect.setHeight( h );
|
||||
stateRect.setWidth( stateRect.height() );
|
||||
painter->drawPixmap( stateRect, ImageRegistry::instance()->pixmap( RESPATH "images/love.svg", stateRect.size() ) );
|
||||
|
||||
stateWidth += r.width() + 16;
|
||||
}
|
||||
|
||||
if ( hasOnlineResults && !item->query()->results().first()->purchaseUrl().isEmpty() )
|
||||
{
|
||||
QRect r = stateRect.adjusted( -stateWidth -144, 6, 0, -6 );
|
||||
r.setWidth( 144 );
|
||||
DropDownButton::drawPrimitive( painter, r, tr( "Buy" ), m_hoveringOverBuyButton == index, false );
|
||||
|
||||
m_buyButtonRects[ index ] = r;
|
||||
|
||||
stateWidth += r.width() + 16;
|
||||
stateWidth = stateRect.width() + 16;
|
||||
}
|
||||
}
|
||||
|
||||
if ( hasOnlineResults && !item->query()->results().first()->downloadFormats().isEmpty() )
|
||||
{
|
||||
painter->save();
|
||||
QStyleOptionComboBox optc;
|
||||
optc.rect = stateRect.adjusted( -stateWidth -144, 6, 0, -6 );
|
||||
optc.rect.setWidth( 144 );
|
||||
m_downloadDropDownRects[ index ] = optc.rect;
|
||||
stateWidth += optc.rect.width() + 16;
|
||||
optc.editable = false;
|
||||
optc.currentText = tr( "Download %1" ).arg( item->query()->results().first()->downloadFormats().first().extension.toUpper() );
|
||||
optc.palette = m_view->palette();
|
||||
|
||||
if ( option.state & QStyle::State_Selected && option.state & QStyle::State_Active )
|
||||
optc.state = QStyle::State_Active | QStyle::State_Selected | QStyle::State_Enabled;
|
||||
else
|
||||
optc.state = QStyle::State_Active | QStyle::State_Enabled;
|
||||
|
||||
if ( !DownloadManager::instance()->localFileForDownload( item->query()->results().first()->downloadFormats().first().url.toString() ).isEmpty() )
|
||||
{
|
||||
painter->setPen( optc.palette.text().color() );
|
||||
const QString text = painter->fontMetrics().elidedText( tr( "View in Finder" ), Qt::ElideRight, optc.rect.width() - 3 );
|
||||
painter->drawText( optc.rect, text, QTextOption( Qt::AlignCenter ) );
|
||||
}
|
||||
else if ( !item->query()->results().first()->downloadJob() )
|
||||
{
|
||||
DropDownButton::drawPrimitive( painter, optc.rect, optc.currentText, hoveringOver() == index, true );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( item->query()->results().first()->downloadJob()->state() == DownloadJob::Finished )
|
||||
{
|
||||
painter->setPen( optc.palette.text().color() );
|
||||
const QString text = painter->fontMetrics().elidedText( tr( "View in Finder" ), Qt::ElideRight, optc.rect.width() - 3 );
|
||||
painter->drawText( optc.rect, text, QTextOption( Qt::AlignCenter ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
painter->setPen( TomahawkStyle::PLAYLIST_PROGRESS_FOREGROUND.darker() );
|
||||
painter->setBrush( TomahawkStyle::PLAYLIST_PROGRESS_BACKGROUND );
|
||||
painter->drawRect( optc.rect.adjusted( 2, 2, -2, -2 ) );
|
||||
painter->setPen( TomahawkStyle::PLAYLIST_PROGRESS_FOREGROUND );
|
||||
painter->setBrush( TomahawkStyle::PLAYLIST_PROGRESS_FOREGROUND );
|
||||
QRect fillp = optc.rect.adjusted( 3, 3, -3, -3 );
|
||||
fillp.setWidth( float(fillp.width()) * ( float(item->query()->results().first()->downloadJob()->progressPercentage()) / 100.0 ) );
|
||||
painter->drawRect( fillp );
|
||||
}
|
||||
}
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
const int remWidth = r.width() - numberWidth - durationWidth;
|
||||
|
||||
QRect titleRect = QRect( numberRect.x() + numberRect.width(), r.y(), (double)remWidth * 0.5, r.height() );
|
||||
@@ -783,7 +708,6 @@ PlaylistItemDelegate::drawTrack( QPainter* painter, const QStyleOptionViewItem&
|
||||
|
||||
int h = extraRect.height() / 2;
|
||||
QRect playIconRect = extraRect.adjusted( extraRect.width() - h - 8, h / 2, -8, -h / 2 );
|
||||
playIconRect.setWidth( playIconRect.height() );
|
||||
painter->drawPixmap( playIconRect, ImageRegistry::instance()->pixmap( RESPATH "images/play.svg", playIconRect.size() ) );
|
||||
|
||||
double duration = (double)AudioEngine::instance()->currentTrackTotalTime();
|
||||
@@ -835,11 +759,8 @@ PlaylistItemDelegate::editorEvent( QEvent* event, QAbstractItemModel* model, con
|
||||
bool hoveringArtist = false;
|
||||
bool hoveringInfo = false;
|
||||
bool hoveringLove = false;
|
||||
bool hoveringBuy = false;
|
||||
bool hoveringDownloadDropDown = false;
|
||||
Tomahawk::source_ptr hoveredAvatar;
|
||||
QRect hoveredAvatarRect;
|
||||
|
||||
if ( m_infoButtonRects.contains( index ) )
|
||||
{
|
||||
const QRect infoRect = m_infoButtonRects[ index ];
|
||||
@@ -858,18 +779,6 @@ PlaylistItemDelegate::editorEvent( QEvent* event, QAbstractItemModel* model, con
|
||||
const QMouseEvent* ev = static_cast< QMouseEvent* >( event );
|
||||
hoveringLove = loveRect.contains( ev->pos() );
|
||||
}
|
||||
if ( m_buyButtonRects.contains( index ) )
|
||||
{
|
||||
const QRect buyRect = m_buyButtonRects[ index ];
|
||||
const QMouseEvent* ev = static_cast< QMouseEvent* >( event );
|
||||
hoveringBuy = buyRect.contains( ev->pos() );
|
||||
}
|
||||
if ( m_downloadDropDownRects.contains( index ) )
|
||||
{
|
||||
const QRect downloadDropDownRect = m_downloadDropDownRects[ index ];
|
||||
const QMouseEvent* ev = static_cast< QMouseEvent* >( event );
|
||||
hoveringDownloadDropDown = downloadDropDownRect.contains( ev->pos() );
|
||||
}
|
||||
if ( m_avatarBoxRects.contains( index ) )
|
||||
{
|
||||
const QMouseEvent* ev = static_cast< QMouseEvent* >( event );
|
||||
@@ -887,7 +796,7 @@ PlaylistItemDelegate::editorEvent( QEvent* event, QAbstractItemModel* model, con
|
||||
|
||||
if ( event->type() == QEvent::MouseMove )
|
||||
{
|
||||
if ( hoveringInfo || hoveringLove || hoveringArtist || hoveringBuy )
|
||||
if ( hoveringInfo || hoveringLove || hoveringArtist )
|
||||
m_view->setCursor( Qt::PointingHandCursor );
|
||||
else
|
||||
m_view->setCursor( Qt::ArrowCursor );
|
||||
@@ -911,23 +820,6 @@ PlaylistItemDelegate::editorEvent( QEvent* event, QAbstractItemModel* model, con
|
||||
emit updateIndex( m_hoveringOverArtist );
|
||||
m_hoveringOverArtist = QModelIndex();
|
||||
}
|
||||
if ( hoveringBuy && m_hoveringOverBuyButton != index )
|
||||
{
|
||||
QPersistentModelIndex ti = m_hoveringOverBuyButton;
|
||||
m_hoveringOverBuyButton = index;
|
||||
|
||||
PlayableItem* item = m_model->sourceModel()->itemFromIndex( m_model->mapToSource( ti ) );
|
||||
item->requestRepaint();
|
||||
emit updateIndex( m_hoveringOverBuyButton );
|
||||
}
|
||||
if ( !hoveringBuy && m_hoveringOverBuyButton.isValid() )
|
||||
{
|
||||
QPersistentModelIndex ti = m_hoveringOverBuyButton;
|
||||
m_hoveringOverBuyButton = QModelIndex();
|
||||
|
||||
PlayableItem* item = m_model->sourceModel()->itemFromIndex( m_model->mapToSource( ti ) );
|
||||
item->requestRepaint();
|
||||
}
|
||||
|
||||
if ( m_hoveringOver != index )
|
||||
{
|
||||
@@ -957,11 +849,6 @@ PlaylistItemDelegate::editorEvent( QEvent* event, QAbstractItemModel* model, con
|
||||
{
|
||||
item->query()->queryTrack()->setLoved( !item->query()->queryTrack()->loved() );
|
||||
}
|
||||
else if ( hoveringBuy )
|
||||
{
|
||||
WebPopup* popup = new WebPopup( item->query()->results().first()->purchaseUrl(), QSize( 400, 800 ) );
|
||||
connect( item->query()->results().first().data(), SIGNAL( destroyed() ), popup, SLOT( close() ) );
|
||||
}
|
||||
else if ( hoveringInfo )
|
||||
{
|
||||
if ( m_model->style() == PlayableProxyModel::SingleColumn )
|
||||
@@ -996,7 +883,7 @@ PlaylistItemDelegate::editorEvent( QEvent* event, QAbstractItemModel* model, con
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( ( m_view->proxyModel()->style() == PlayableProxyModel::Locker && index.column() == PlayableModel::Download ) || hoveringDownloadDropDown )
|
||||
else if ( m_view->proxyModel()->style() == PlayableProxyModel::Locker && index.column() == PlayableModel::Download )
|
||||
{
|
||||
m_model->sourceModel()->setAllColumnsEditable( true );
|
||||
m_view->edit( index );
|
||||
@@ -1015,17 +902,15 @@ PlaylistItemDelegate::editorEvent( QEvent* event, QAbstractItemModel* model, con
|
||||
void
|
||||
PlaylistItemDelegate::resetHoverIndex()
|
||||
{
|
||||
if ( !m_model || !m_hoveringOver.isValid() )
|
||||
if ( !m_model )
|
||||
return;
|
||||
|
||||
QPersistentModelIndex idx = m_hoveringOver;
|
||||
|
||||
m_hoveringOver = QModelIndex();
|
||||
m_hoveringOverArtist = QModelIndex();
|
||||
m_hoveringOverBuyButton = QModelIndex();
|
||||
m_infoButtonRects.clear();
|
||||
m_loveButtonRects.clear();
|
||||
m_buyButtonRects.clear();
|
||||
m_artistNameRects.clear();
|
||||
|
||||
QModelIndex itemIdx = m_model->mapToSource( idx );
|
||||
@@ -1037,6 +922,7 @@ PlaylistItemDelegate::resetHoverIndex()
|
||||
}
|
||||
|
||||
emit updateIndex( idx );
|
||||
m_view->repaint();
|
||||
}
|
||||
|
||||
|
||||
|
@@ -116,13 +116,10 @@ private:
|
||||
mutable QHash< QPersistentModelIndex, QSharedPointer< Tomahawk::PixmapDelegateFader > > m_pixmaps;
|
||||
mutable QHash< QPersistentModelIndex, QRect > m_infoButtonRects;
|
||||
mutable QHash< QPersistentModelIndex, QRect > m_loveButtonRects;
|
||||
mutable QHash< QPersistentModelIndex, QRect > m_buyButtonRects;
|
||||
mutable QHash< QPersistentModelIndex, QRect > m_downloadDropDownRects;
|
||||
mutable QHash< QPersistentModelIndex, QRect > m_artistNameRects;
|
||||
mutable QHash< QPersistentModelIndex, QHash< Tomahawk::source_ptr, QRect > > m_avatarBoxRects;
|
||||
QPersistentModelIndex m_hoveringOver;
|
||||
QPersistentModelIndex m_hoveringOverArtist;
|
||||
QPersistentModelIndex m_hoveringOverBuyButton;
|
||||
mutable QPersistentModelIndex m_nowPlaying;
|
||||
|
||||
TrackView* m_view;
|
||||
|
@@ -19,7 +19,6 @@
|
||||
#include "TrackDetailView.h"
|
||||
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
#include <QScrollArea>
|
||||
#include <QSizePolicy>
|
||||
#include <QVBoxLayout>
|
||||
@@ -36,7 +35,6 @@
|
||||
#include "utils/ImageRegistry.h"
|
||||
#include "utils/TomahawkUtilsGui.h"
|
||||
#include "utils/Closure.h"
|
||||
#include "utils/WebPopup.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
using namespace Tomahawk;
|
||||
@@ -44,7 +42,6 @@ using namespace Tomahawk;
|
||||
TrackDetailView::TrackDetailView( QWidget* parent )
|
||||
: QWidget( parent )
|
||||
, DpiScaler( this )
|
||||
, m_buyButtonVisible( false )
|
||||
{
|
||||
setFixedWidth( scaledX( 200 ) );
|
||||
setContentsMargins( 0, 0, 0, 0 );
|
||||
@@ -121,21 +118,11 @@ TrackDetailView::TrackDetailView( QWidget* parent )
|
||||
TomahawkStyle::styleScrollBar( m_resultsScrollArea->verticalScrollBar() );
|
||||
m_resultsScrollArea->hide();
|
||||
|
||||
m_buyButton = new QPushButton;
|
||||
m_buyButton->setStyleSheet( "QPushButton:hover { font-size: 12px; color: #ffffff; background: #000000; border-style: solid; border-radius: 0px; border-width: 2px; border-color: #2b2b2b; }"
|
||||
"QPushButton { font-size: 12px; color: #ffffff; background-color: #000000; border-style: solid; border-radius: 0px; border-width: 0px; }" );
|
||||
m_buyButton->setMinimumHeight( 30 );
|
||||
m_buyButton->setText( tr( "Buy Album" ) );
|
||||
m_buyButton->setVisible( false );
|
||||
connect( m_buyButton, SIGNAL( clicked() ), SLOT( onBuyButtonClicked() ) );
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout;
|
||||
TomahawkUtils::unmarginLayout( layout );
|
||||
layout->addWidget( m_playableCover );
|
||||
layout->addSpacerItem( new QSpacerItem( 0, 8, QSizePolicy::Minimum, QSizePolicy::Fixed ) );
|
||||
layout->addWidget( m_nameLabel );
|
||||
layout->addSpacerItem( new QSpacerItem( 0, 4, QSizePolicy::Minimum, QSizePolicy::Fixed ) );
|
||||
layout->addWidget( m_buyButton );
|
||||
layout->addWidget( m_dateLabel );
|
||||
layout->addWidget( m_infoBox );
|
||||
layout->addSpacerItem( new QSpacerItem( 0, 32, QSizePolicy::Minimum, QSizePolicy::Fixed ) );
|
||||
@@ -147,9 +134,6 @@ TrackDetailView::TrackDetailView( QWidget* parent )
|
||||
|
||||
setLayout( layout );
|
||||
setQuery( query_ptr() );
|
||||
|
||||
connect( DownloadManager::instance(), SIGNAL( stateChanged( DownloadManager::DownloadManagerState, DownloadManager::DownloadManagerState ) ),
|
||||
SLOT( onDownloadManagerStateChanged( DownloadManager::DownloadManagerState, DownloadManager::DownloadManagerState ) ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -170,10 +154,6 @@ TrackDetailView::setQuery( const Tomahawk::query_ptr& query )
|
||||
{
|
||||
if ( m_query )
|
||||
{
|
||||
if ( m_query->track()->albumPtr() && !m_query->track()->albumPtr()->name().isEmpty() )
|
||||
{
|
||||
disconnect( m_query->track()->albumPtr().data(), SIGNAL( updated() ), this, SLOT( onAlbumUpdated() ) );
|
||||
}
|
||||
disconnect( m_query->track().data(), SIGNAL( updated() ), this, SLOT( onCoverUpdated() ) );
|
||||
disconnect( m_query->track().data(), SIGNAL( socialActionsLoaded() ), this, SLOT( onSocialActionsLoaded() ) );
|
||||
disconnect( m_query.data(), SIGNAL( resultsChanged() ), this, SLOT( onResultsChanged() ) );
|
||||
@@ -184,7 +164,6 @@ TrackDetailView::setQuery( const Tomahawk::query_ptr& query )
|
||||
onResultsChanged();
|
||||
setSocialActions();
|
||||
onCoverUpdated();
|
||||
onAlbumUpdated();
|
||||
|
||||
if ( !query )
|
||||
{
|
||||
@@ -195,85 +174,20 @@ TrackDetailView::setQuery( const Tomahawk::query_ptr& query )
|
||||
|
||||
m_dateLabel->setText( tr( "Unknown Release-Date" ) );
|
||||
|
||||
connect( m_query->track().data(), SIGNAL( updated() ), SLOT( onCoverUpdated() ) );
|
||||
connect( m_query->track().data(), SIGNAL( socialActionsLoaded() ), SLOT( onSocialActionsLoaded() ) );
|
||||
connect( m_query.data(), SIGNAL( resultsChanged() ), SLOT( onResultsChanged() ) );
|
||||
connect( m_query.data(), SIGNAL( resultsChanged() ), SLOT( onAlbumUpdated() ) );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TrackDetailView::onAlbumUpdated()
|
||||
{
|
||||
if ( !m_query )
|
||||
return;
|
||||
|
||||
if ( m_query->track()->albumPtr() && !m_query->track()->albumPtr()->name().isEmpty() )
|
||||
{
|
||||
m_nameLabel->setType( QueryLabel::Album );
|
||||
m_nameLabel->setAlbum( m_query->track()->albumPtr() );
|
||||
|
||||
connect( m_query->track()->albumPtr().data(), SIGNAL( updated() ), SLOT( onAlbumUpdated() ), Qt::UniqueConnection );
|
||||
|
||||
if ( m_buyButtonVisible )
|
||||
{
|
||||
if ( m_query->track()->albumPtr()->purchased() )
|
||||
{
|
||||
m_buyButton->setText( tr( "Download Album" ) );
|
||||
m_buyButton->setVisible( true );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_buyButton->setText( tr( "Buy Album" ) );
|
||||
m_buyButton->setVisible( !m_query->track()->albumPtr()->purchaseUrl().isEmpty() );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_nameLabel->setType( QueryLabel::Artist );
|
||||
m_nameLabel->setArtist( m_query->track()->artistPtr() );
|
||||
m_buyButton->setVisible( false );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TrackDetailView::onBuyButtonClicked()
|
||||
{
|
||||
if ( DownloadManager::instance()->state() == DownloadManager::Running )
|
||||
{
|
||||
emit downloadCancel();
|
||||
return;
|
||||
}
|
||||
|
||||
if ( m_query && m_query->track()->albumPtr() )
|
||||
{
|
||||
if ( m_query->track()->albumPtr()->purchased() )
|
||||
{
|
||||
emit downloadAll();
|
||||
}
|
||||
else
|
||||
{
|
||||
WebPopup* popup = new WebPopup( m_query->track()->albumPtr()->purchaseUrl(), QSize( 400, 800 ) );
|
||||
connect( m_query->track()->albumPtr().data(), SIGNAL( destroyed() ), popup, SLOT( close() ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TrackDetailView::onDownloadManagerStateChanged( DownloadManager::DownloadManagerState newState, DownloadManager::DownloadManagerState oldState )
|
||||
{
|
||||
tDebug() << Q_FUNC_INFO;
|
||||
if ( newState == DownloadManager::Running )
|
||||
{
|
||||
m_buyButton->setText( tr( "Cancel Download" ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
onAlbumUpdated();
|
||||
}
|
||||
connect( m_query->track().data(), SIGNAL( updated() ), SLOT( onCoverUpdated() ) );
|
||||
connect( m_query->track().data(), SIGNAL( socialActionsLoaded() ), SLOT( onSocialActionsLoaded() ) );
|
||||
connect( m_query.data(), SIGNAL( resultsChanged() ), SLOT( onResultsChanged() ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -390,10 +304,3 @@ TrackDetailView::onResultsChanged()
|
||||
m_resultsScrollArea->hide();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TrackDetailView::setBuyButtonVisible( bool visible )
|
||||
{
|
||||
m_buyButtonVisible = visible;
|
||||
}
|
||||
|
@@ -23,7 +23,6 @@
|
||||
|
||||
#include "Query.h"
|
||||
#include "utils/DpiScaler.h"
|
||||
#include "DownloadManager.h"
|
||||
#include "DllMacro.h"
|
||||
|
||||
class QLabel;
|
||||
@@ -31,7 +30,6 @@ class CaptionLabel;
|
||||
class PlayableCover;
|
||||
class QueryLabel;
|
||||
class QScrollArea;
|
||||
class QPushButton;
|
||||
|
||||
class DLLEXPORT TrackDetailView : public QWidget, private TomahawkUtils::DpiScaler
|
||||
{
|
||||
@@ -41,29 +39,21 @@ public:
|
||||
explicit TrackDetailView( QWidget* parent = 0 );
|
||||
~TrackDetailView();
|
||||
|
||||
void setBuyButtonVisible( bool visible );
|
||||
|
||||
public slots:
|
||||
virtual void setQuery( const Tomahawk::query_ptr& query );
|
||||
void setPlaylistInterface( const Tomahawk::playlistinterface_ptr& playlistInterface );
|
||||
|
||||
signals:
|
||||
void downloadAll();
|
||||
void downloadCancel();
|
||||
|
||||
protected:
|
||||
|
||||
protected slots:
|
||||
|
||||
private slots:
|
||||
void onAlbumUpdated();
|
||||
void onCoverUpdated();
|
||||
void onSocialActionsLoaded();
|
||||
void onResultsChanged();
|
||||
|
||||
void onBuyButtonClicked();
|
||||
void onDownloadManagerStateChanged( DownloadManager::DownloadManagerState newState, DownloadManager::DownloadManagerState oldState );
|
||||
|
||||
private:
|
||||
void setSocialActions();
|
||||
|
||||
@@ -75,8 +65,6 @@ private:
|
||||
QLabel* m_lovedIcon;
|
||||
QLabel* m_lovedLabel;
|
||||
CaptionLabel* m_resultsBoxLabel;
|
||||
QPushButton* m_buyButton;
|
||||
bool m_buyButtonVisible;
|
||||
|
||||
QWidget* m_infoBox;
|
||||
QWidget* m_resultsBox;
|
||||
|
@@ -23,9 +23,7 @@
|
||||
#include "PlayableModel.h"
|
||||
#include "PlayableProxyModel.h"
|
||||
#include "PlayableItem.h"
|
||||
#include "DownloadManager.h"
|
||||
#include "DropJob.h"
|
||||
#include "Result.h"
|
||||
#include "Source.h"
|
||||
#include "TomahawkSettings.h"
|
||||
#include "audio/AudioEngine.h"
|
||||
@@ -689,6 +687,7 @@ TrackView::wheelEvent( QWheelEvent* event )
|
||||
QTreeView::wheelEvent( event );
|
||||
|
||||
m_delegate->resetHoverIndex();
|
||||
repaint();
|
||||
}
|
||||
|
||||
|
||||
@@ -775,44 +774,6 @@ TrackView::onCustomContextMenu( const QPoint& pos )
|
||||
m_contextMenu->setSupportedActions( m_contextMenu->supportedActions() | ContextMenu::ActionMarkListened
|
||||
| ContextMenu::ActionDelete );
|
||||
|
||||
if ( proxyModel()->style() != PlayableProxyModel::Collection )
|
||||
{
|
||||
bool allDownloaded = true;
|
||||
bool noneDownloadable = true;
|
||||
bool downloadable = false;
|
||||
foreach ( const QModelIndex& index, selectedIndexes() )
|
||||
{
|
||||
if ( index.column() )
|
||||
continue;
|
||||
|
||||
PlayableItem* item = proxyModel()->itemFromIndex( proxyModel()->mapToSource( index ) );
|
||||
|
||||
if( item->query()->results().isEmpty() )
|
||||
continue;
|
||||
|
||||
downloadable = !item->query()->results().first()->downloadFormats().isEmpty();
|
||||
if ( downloadable )
|
||||
{
|
||||
noneDownloadable = false;
|
||||
}
|
||||
|
||||
if ( downloadable && DownloadManager::instance()->localFileForDownload( item->query()->results().first()->downloadFormats().first().url.toString() ).isEmpty() )
|
||||
{
|
||||
allDownloaded = false;
|
||||
}
|
||||
|
||||
if ( !allDownloaded || !noneDownloadable )
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !allDownloaded || !noneDownloadable )
|
||||
{
|
||||
m_contextMenu->setSupportedActions( m_contextMenu->supportedActions() | ContextMenu::ActionDownload );
|
||||
}
|
||||
}
|
||||
|
||||
QList<query_ptr> queries;
|
||||
foreach ( const QModelIndex& index, selectedIndexes() )
|
||||
{
|
||||
@@ -844,10 +805,6 @@ TrackView::onMenuTriggered( int action )
|
||||
deleteSelectedItems();
|
||||
break;
|
||||
|
||||
case ContextMenu::ActionDownload:
|
||||
downloadSelectedItems();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -923,30 +880,6 @@ TrackView::deleteSelectedItems()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TrackView::downloadSelectedItems()
|
||||
{
|
||||
foreach ( const QModelIndex& index, selectedIndexes() )
|
||||
{
|
||||
if ( index.column() )
|
||||
continue;
|
||||
|
||||
PlayableItem* item = proxyModel()->itemFromIndex( proxyModel()->mapToSource( index ) );
|
||||
|
||||
if ( !item )
|
||||
continue;
|
||||
|
||||
if ( item->query()->results().isEmpty() || item->query()->results().first()->downloadFormats().isEmpty() )
|
||||
continue;
|
||||
|
||||
if ( !DownloadManager::instance()->localFileForDownload( item->query()->results().first()->downloadFormats().first().url.toString() ).isEmpty() )
|
||||
continue;
|
||||
|
||||
DownloadManager::instance()->addJob( item->result()->toDownloadJob( item->result()->downloadFormats().first() ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TrackView::verifySize()
|
||||
{
|
||||
|
@@ -89,7 +89,6 @@ public:
|
||||
public slots:
|
||||
virtual void onItemActivated( const QModelIndex& index );
|
||||
|
||||
virtual void downloadSelectedItems();
|
||||
virtual void deleteSelectedItems();
|
||||
|
||||
void playItem();
|
||||
|
@@ -67,14 +67,6 @@ JSAccount::scriptPluginFactory( const QString& type, const scriptobject_ptr& obj
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
JSAccount::showDebugger()
|
||||
{
|
||||
tLog() << Q_FUNC_INFO << name() << "Show debugger";
|
||||
m_engine->showWebInspector();
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
JSAccount::serializeQVariantMap( const QVariantMap& map )
|
||||
{
|
||||
|
@@ -69,8 +69,6 @@ public:
|
||||
void setResolver( JSResolver* resolver );
|
||||
void scriptPluginFactory( const QString& type, const scriptobject_ptr& object ) override;
|
||||
|
||||
void showDebugger() override;
|
||||
|
||||
static QString serializeQVariantMap(const QVariantMap& map);
|
||||
|
||||
void reportNativeScriptJobResult( int resultId, const QVariantMap& result ) override;
|
||||
|
@@ -541,6 +541,7 @@ void
|
||||
JSResolver::resolve( const Tomahawk::query_ptr& query )
|
||||
{
|
||||
ScriptJob* job = scriptAccount()->resolve( scriptObject(), query, "resolver" );
|
||||
|
||||
connect( job, SIGNAL( done( QVariantMap ) ), SLOT( onResolveRequestDone( QVariantMap ) ) );
|
||||
|
||||
job->start();
|
||||
@@ -562,24 +563,15 @@ JSResolver::onResolveRequestDone( const QVariantMap& data )
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( !data.value( "artists" ).isNull() )
|
||||
{
|
||||
QList< artist_ptr > artists = scriptAccount()->parseArtistVariantList( data.value( "artists" ).toList() );
|
||||
Tomahawk::Pipeline::instance()->reportArtists( qid, artists );
|
||||
}
|
||||
|
||||
if ( !data.value( "albums" ).isNull() )
|
||||
{
|
||||
QList< album_ptr > albums = scriptAccount()->parseAlbumVariantList( data.value( "albums" ).toList() );
|
||||
Tomahawk::Pipeline::instance()->reportAlbums( qid, albums );
|
||||
}
|
||||
|
||||
QList< Tomahawk::result_ptr > results = scriptAccount()->parseResultVariantList( data.value( "tracks" ).toList() );
|
||||
|
||||
foreach( const result_ptr& result, results )
|
||||
{
|
||||
result->setResolvedByResolver( this );
|
||||
result->setFriendlySource( name() );
|
||||
}
|
||||
|
||||
Tomahawk::Pipeline::instance()->reportResults( qid, this, results );
|
||||
}
|
||||
|
||||
|
@@ -32,8 +32,6 @@
|
||||
#include "ScriptInfoPlugin.h"
|
||||
|
||||
// TODO:
|
||||
#include "../Artist.h"
|
||||
#include "../Album.h"
|
||||
#include "../Result.h"
|
||||
#include "../Track.h"
|
||||
#include <QTime>
|
||||
@@ -203,10 +201,6 @@ ScriptAccount::unregisterScriptPlugin( const QString& type, const QString& objec
|
||||
{
|
||||
m_infoPluginFactory->unregisterPlugin( object );
|
||||
}
|
||||
else if( type == "linkParser" )
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
else
|
||||
{
|
||||
tLog() << "This plugin type is not handled by Tomahawk or simply cannot be removed yet";
|
||||
@@ -237,10 +231,6 @@ ScriptAccount::scriptPluginFactory( const QString& type, const scriptobject_ptr&
|
||||
ScriptLinkGeneratorPlugin* lgp = new ScriptLinkGeneratorPlugin( object );
|
||||
Utils::LinkGenerator::instance()->addPlugin( lgp );
|
||||
}
|
||||
else if( type == "linkParser" )
|
||||
{
|
||||
tLog() << "Plugin registered linkParser, which is not implemented yet. UrlLookup won't work";
|
||||
}
|
||||
else if ( type == "infoPlugin" )
|
||||
{
|
||||
m_infoPluginFactory->registerPlugin( object, this );
|
||||
@@ -257,12 +247,6 @@ ScriptAccount::scriptPluginFactory( const QString& type, const scriptobject_ptr&
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ScriptAccount::showDebugger()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ScriptAccount::onJobDeleted( const QString& jobId )
|
||||
{
|
||||
@@ -270,67 +254,15 @@ ScriptAccount::onJobDeleted( const QString& jobId )
|
||||
}
|
||||
|
||||
|
||||
QList< Tomahawk::artist_ptr >
|
||||
ScriptAccount::parseArtistVariantList( const QVariantList& artistList )
|
||||
{
|
||||
QList< Tomahawk::artist_ptr > artists;
|
||||
|
||||
QString artist;
|
||||
foreach( const QVariant& a, artistList )
|
||||
{
|
||||
artist = a.toString().trimmed();
|
||||
if ( artist.isEmpty() )
|
||||
continue;
|
||||
|
||||
artists << Tomahawk::Artist::get( artist );
|
||||
}
|
||||
|
||||
return artists;
|
||||
}
|
||||
|
||||
|
||||
QList< Tomahawk::album_ptr >
|
||||
ScriptAccount::parseAlbumVariantList( const QVariantList& albumList )
|
||||
{
|
||||
QList< Tomahawk::album_ptr > albums;
|
||||
|
||||
QString artistString;
|
||||
QString albumString;
|
||||
foreach( const QVariant& av, albumList )
|
||||
{
|
||||
QVariantMap m = av.toMap();
|
||||
|
||||
artistString = m.value( "artist" ).toString().trimmed();
|
||||
albumString = m.value( "album" ).toString().trimmed();
|
||||
if ( artistString.isEmpty() || albumString.isEmpty() )
|
||||
continue;
|
||||
|
||||
albums << Tomahawk::Album::get( Tomahawk::Artist::get( artistString ), albumString );
|
||||
}
|
||||
|
||||
return albums;
|
||||
}
|
||||
|
||||
|
||||
QList< Tomahawk::result_ptr >
|
||||
ScriptAccount::parseResultVariantList( const QVariantList& reslist )
|
||||
{
|
||||
QList< Tomahawk::result_ptr > results;
|
||||
|
||||
|
||||
foreach( const QVariant& rv, reslist )
|
||||
{
|
||||
QVariantMap m = rv.toMap();
|
||||
|
||||
const QString artistString = m.value("artist").toString().trimmed();
|
||||
const QString trackString = m.value("track").toString().trimmed();
|
||||
|
||||
if ( artistString.isEmpty() || trackString.isEmpty() )
|
||||
{
|
||||
tLog() << Q_FUNC_INFO << "Could not parse Track" << m;
|
||||
continue;
|
||||
}
|
||||
|
||||
int duration = m.value( "duration", 0 ).toInt();
|
||||
if ( duration <= 0 && m.contains( "durationString" ) )
|
||||
{
|
||||
@@ -338,8 +270,8 @@ ScriptAccount::parseResultVariantList( const QVariantList& reslist )
|
||||
duration = time.secsTo( QTime( 0, 0 ) ) * -1;
|
||||
}
|
||||
|
||||
Tomahawk::track_ptr track = Tomahawk::Track::get( artistString,
|
||||
trackString,
|
||||
Tomahawk::track_ptr track = Tomahawk::Track::get( m.value( "artist" ).toString(),
|
||||
m.value( "track" ).toString(),
|
||||
m.value( "album" ).toString(),
|
||||
m.value( "albumArtist" ).toString(),
|
||||
duration,
|
||||
@@ -370,17 +302,11 @@ ScriptAccount::parseResultVariantList( const QVariantList& reslist )
|
||||
// rp->track()->setAttributes( attr );
|
||||
}
|
||||
|
||||
|
||||
QString mimetype = m.value( "mimetype" ).toString();
|
||||
if ( mimetype.isEmpty() )
|
||||
rp->setMimetype( m.value( "mimetype" ).toString() );
|
||||
if ( rp->mimetype().isEmpty() )
|
||||
{
|
||||
mimetype = TomahawkUtils::extensionToMimetype( m.value( "extension" ).toString() );
|
||||
}
|
||||
Q_ASSERT( !mimetype.isEmpty() );
|
||||
|
||||
if ( !mimetype.isEmpty() )
|
||||
{
|
||||
rp->setMimetype( mimetype );
|
||||
rp->setMimetype( TomahawkUtils::extensionToMimetype( m.value( "extension" ).toString() ) );
|
||||
Q_ASSERT( !rp->mimetype().isEmpty() );
|
||||
}
|
||||
|
||||
rp->setFriendlySource( name() );
|
||||
|
@@ -76,11 +76,7 @@ public:
|
||||
|
||||
virtual void scriptPluginFactory( const QString& type, const scriptobject_ptr& object );
|
||||
|
||||
virtual void showDebugger();
|
||||
|
||||
// helpers
|
||||
QList< Tomahawk::artist_ptr > parseArtistVariantList( const QVariantList& artistList );
|
||||
QList< Tomahawk::album_ptr > parseAlbumVariantList( const QVariantList& albumList );
|
||||
QList< Tomahawk::result_ptr > parseResultVariantList( const QVariantList& reslist );
|
||||
ScriptJob* resolve( const scriptobject_ptr& scriptObject, const query_ptr& query, const QString& resolveType );
|
||||
|
||||
|
@@ -21,7 +21,7 @@
|
||||
|
||||
#include "ScriptEngine.h"
|
||||
|
||||
#include "jobview/ScriptErrorStatusMessage.h"
|
||||
#include "jobview/ErrorStatusMessage.h"
|
||||
#include "jobview/JobStatusModel.h"
|
||||
#include "jobview/JobStatusView.h"
|
||||
#include "utils/Logger.h"
|
||||
@@ -51,13 +51,13 @@ ScriptEngine::ScriptEngine( JSAccount* parent )
|
||||
settings()->setAttribute( QWebSettings::LocalContentCanAccessRemoteUrls, true );
|
||||
settings()->setOfflineStorageDefaultQuota(100 * 1024 * 1024 /* 100 Mb */);
|
||||
settings()->setOfflineWebApplicationCacheQuota(100 * 1024 * 1024 /* 100 Mb */);
|
||||
settings()->setAttribute( QWebSettings::DeveloperExtrasEnabled, true );
|
||||
|
||||
// HACK
|
||||
QStringList cmdArgs = QCoreApplication::instance()->arguments();
|
||||
int position = cmdArgs.indexOf( "--show-inspector" ) + 1;
|
||||
if ( position > 0 && !cmdArgs.at( position ).isEmpty() && parent->name().contains( cmdArgs.at( position ), Qt::CaseInsensitive ) ) {
|
||||
QMetaObject::invokeMethod( this, "showWebInspector", Qt::QueuedConnection );
|
||||
settings()->setAttribute( QWebSettings::DeveloperExtrasEnabled, true );
|
||||
QMetaObject::invokeMethod( this, "initWebInspector", Qt::QueuedConnection );
|
||||
}
|
||||
|
||||
// Tomahawk is not a user agent
|
||||
@@ -74,13 +74,24 @@ ScriptEngine::ScriptEngine( JSAccount* parent )
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ScriptEngine::initWebInspector()
|
||||
{
|
||||
m_webInspector.reset( new QWebInspector() );
|
||||
m_webInspector->setPage( this );
|
||||
m_webInspector->setMinimumWidth( 800 );
|
||||
m_webInspector->setMinimumHeight( 600 );
|
||||
m_webInspector->show();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ScriptEngine::javaScriptConsoleMessage( const QString& message, int lineNumber, const QString& sourceID )
|
||||
{
|
||||
tLog() << "JAVASCRIPT:" << QString( "%1:%2" ).arg( m_scriptPath ).arg( lineNumber ) << message << sourceID;
|
||||
#ifdef QT_DEBUG
|
||||
QFileInfo scriptPath( m_scriptPath );
|
||||
JobStatusView::instance()->model()->addJob( new ScriptErrorStatusMessage( tr( "%1:%2 %3" ).arg( scriptPath.fileName() ).arg( lineNumber ).arg( message ), m_parent ) );
|
||||
JobStatusView::instance()->model()->addJob( new ErrorStatusMessage( tr( "Resolver Error: %1:%2 %3" ).arg( scriptPath.fileName() ).arg( lineNumber ).arg( message ) ) );
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -99,7 +110,7 @@ ScriptEngine::sslErrorHandler( QNetworkReply* qnr, const QList<QSslError>& errli
|
||||
|
||||
QMessageBox question( TomahawkUtils::tomahawkWindow() );
|
||||
question.setWindowTitle( tr( "SSL Error" ) );
|
||||
question.setText( tr( "You have asked %applicationName to connect securely to <b>%1</b>, but we can't confirm that your connection is secure:<br><br>"
|
||||
question.setText( tr( "You have asked Tomahawk to connect securely to <b>%1</b>, but we can't confirm that your connection is secure:<br><br>"
|
||||
"<b>%2</b><br><br>"
|
||||
"Do you want to trust this connection?" )
|
||||
.arg( qnr->url().host() )
|
||||
@@ -137,21 +148,6 @@ ScriptEngine::setScriptPath( const QString& scriptPath )
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ScriptEngine::showWebInspector()
|
||||
{
|
||||
if ( m_webInspector.isNull() )
|
||||
{
|
||||
m_webInspector.reset( new QWebInspector() );
|
||||
m_webInspector->setPage( this );
|
||||
m_webInspector->setMinimumWidth( 800 );
|
||||
m_webInspector->setMinimumHeight( 600 );
|
||||
}
|
||||
|
||||
m_webInspector->show();
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
ScriptEngine::shouldInterruptJavaScript()
|
||||
{
|
||||
|
@@ -49,13 +49,13 @@ public:
|
||||
|
||||
public slots:
|
||||
bool shouldInterruptJavaScript();
|
||||
void showWebInspector();
|
||||
|
||||
protected:
|
||||
virtual void javaScriptConsoleMessage( const QString& message, int lineNumber, const QString& sourceID );
|
||||
|
||||
private slots:
|
||||
void sslErrorHandler( QNetworkReply* qnr, const QList<QSslError>& errlist );
|
||||
void initWebInspector();
|
||||
|
||||
private:
|
||||
JSAccount* m_parent;
|
||||
|
@@ -25,14 +25,14 @@ using namespace Tomahawk;
|
||||
void
|
||||
ScriptInfoPluginFactory::addPlugin( const QSharedPointer< ScriptInfoPlugin >& infoPlugin ) const
|
||||
{
|
||||
Tomahawk::InfoSystem::InfoSystem::instance()->addInfoPlugin( infoPlugin );
|
||||
Tomahawk::InfoSystem::InfoSystem::instance()->addInfoPlugin( infoPlugin.data() );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ScriptInfoPluginFactory::removePlugin( const QSharedPointer< ScriptInfoPlugin >& infoPlugin ) const
|
||||
{
|
||||
Tomahawk::InfoSystem::InfoSystem::instance()->removeInfoPlugin( infoPlugin );
|
||||
Tomahawk::InfoSystem::InfoSystem::instance()->removeInfoPlugin( infoPlugin.data() );
|
||||
}
|
||||
|
||||
|
||||
@@ -42,10 +42,10 @@ ScriptInfoPluginFactory::createPlugin( const scriptobject_ptr& object, ScriptAcc
|
||||
// create infoplugin instance
|
||||
ScriptInfoPlugin* scriptInfoPlugin = new ScriptInfoPlugin( object, scriptAccount->name() );
|
||||
|
||||
QSharedPointer< ScriptInfoPlugin > infoPlugin( scriptInfoPlugin );
|
||||
Tomahawk::InfoSystem::InfoPluginPtr infoPlugin( scriptInfoPlugin );
|
||||
|
||||
// move it to infosystem thread
|
||||
infoPlugin->moveToThread( Tomahawk::InfoSystem::InfoSystem::instance()->workerThread().data() );
|
||||
|
||||
return infoPlugin;
|
||||
return QSharedPointer< ScriptInfoPlugin >( scriptInfoPlugin );
|
||||
}
|
||||
|
@@ -24,7 +24,6 @@
|
||||
#include "PluginLoader_p.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "TomahawkVersion.h"
|
||||
|
||||
#include "utils/Logger.h"
|
||||
|
||||
@@ -154,7 +153,7 @@ PluginLoader::pluginFilenames( const QString& name ) const
|
||||
QStringList fileNames;
|
||||
foreach( const QString& extension, extensions )
|
||||
{
|
||||
fileNames << QString("lib" TOMAHAWK_TARGET_NAME "_%1_%2.%3")
|
||||
fileNames << QString("libtomahawk_%1_%2.%3")
|
||||
.arg( d_ptr->type )
|
||||
.arg( name )
|
||||
.arg( extension );
|
||||
@@ -175,8 +174,12 @@ PluginLoader::pluginPaths( const QString& name ) const
|
||||
tDebug() << Q_FUNC_INFO << "Checking directory for" << type << "plugins:" << pluginDir.absolutePath();
|
||||
foreach ( QString fileName, pluginDir.entryList( pluginFilenames( name ), QDir::Files ) )
|
||||
{
|
||||
const QString path = pluginDir.absoluteFilePath( fileName );
|
||||
paths << path;
|
||||
//TODO: do we really need to check this?!
|
||||
if ( fileName.startsWith( QString( "libtomahawk_%1" ).arg( type ) ) )
|
||||
{
|
||||
const QString path = pluginDir.absoluteFilePath( fileName );
|
||||
paths << path;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -211,19 +211,11 @@ TomahawkStyle::styleScrollBar( QScrollBar* scrollBar )
|
||||
void
|
||||
TomahawkStyle::loadFonts()
|
||||
{
|
||||
#ifdef Q_OS_MAC
|
||||
QDir dir( QCoreApplication::applicationDirPath() + "/../Resources/Fonts" );
|
||||
#else
|
||||
QDir dir( ":/data/fonts" );
|
||||
#endif
|
||||
foreach ( const QString& fileName, dir.entryList() )
|
||||
{
|
||||
tDebug( LOGVERBOSE ) << "Trying to add font resource:" << dir.absolutePath() << fileName;
|
||||
#ifdef Q_OS_MAC
|
||||
const int id = QFontDatabase::addApplicationFont( dir.absolutePath() + "/" + fileName );
|
||||
#else
|
||||
tDebug( LOGVERBOSE ) << "Trying to add font resource:" << fileName;
|
||||
const int id = QFontDatabase::addApplicationFont( ":/data/fonts/" + fileName );
|
||||
#endif
|
||||
if ( id >= 0 )
|
||||
{
|
||||
tDebug( LOGVERBOSE ) << "Added font:" << id << QFontDatabase::applicationFontFamilies( id ).first();
|
||||
|
@@ -102,7 +102,6 @@ namespace TomahawkStyle
|
||||
|
||||
static const QColor PLAYLIST_BUTTON_BACKGROUND = QColor( "#111111" );
|
||||
static const QColor PLAYLIST_BUTTON_FOREGROUND = QColor( "#ffffff" );
|
||||
static const QColor PLAYLIST_BUTTON_HOVER_BACKGROUND = QColor( "#111111" );
|
||||
|
||||
static const QColor PLAYLIST_PROGRESS_BACKGROUND = QColor( "#ffffff" );
|
||||
static const QColor PLAYLIST_PROGRESS_FOREGROUND = QColor( "#E61878" );
|
||||
|
@@ -320,11 +320,11 @@ filesizeToString( unsigned int size )
|
||||
|
||||
if ( mb )
|
||||
{
|
||||
return QString( "%1.%2 MB" ).arg( mb ).arg( int( ( kb % 1024 ) / 102.4 ) );
|
||||
return QString( "%1.%2 Mb" ).arg( mb ).arg( int( ( kb % 1024 ) / 102.4 ) );
|
||||
}
|
||||
else if ( kb )
|
||||
{
|
||||
return QString( "%1 KB" ).arg( kb );
|
||||
return QString( "%1 Kb" ).arg( kb );
|
||||
}
|
||||
else
|
||||
return QString::number( size );
|
||||
|
@@ -29,7 +29,6 @@
|
||||
#include "Source.h"
|
||||
#include "MetaPlaylistInterface.h"
|
||||
#include "playlist/TrackView.h"
|
||||
#include "playlist/TrackDetailView.h"
|
||||
#include "widgets/BasicHeader.h"
|
||||
|
||||
#include "database/DatabaseCommand_AllTracks.h"
|
||||
@@ -59,7 +58,6 @@ AlbumInfoWidget::AlbumInfoWidget( const Tomahawk::album_ptr& album, QWidget* par
|
||||
m_tracksModel->setMode( Mixed );
|
||||
|
||||
// We need to set the model on the view before loading the playlist, so spinners & co are connected
|
||||
ui->albumView->trackDetailView()->setBuyButtonVisible( true );
|
||||
ui->albumView->trackView()->setPlayableModel( m_tracksModel );
|
||||
ui->albumView->setCaption( tr( "Album Details" ) );
|
||||
|
||||
@@ -188,4 +186,4 @@ AlbumInfoWidget::pixmap() const
|
||||
return Tomahawk::ViewPage::pixmap();
|
||||
else
|
||||
return m_pixmap;
|
||||
}
|
||||
}
|
||||
|
@@ -107,7 +107,6 @@ ArtistInfoWidget::ArtistInfoWidget( const Tomahawk::artist_ptr& artist, QWidget*
|
||||
ui->topHits->setItemWidth( scaledX( 140 ) );
|
||||
ui->topHits->proxyModel()->setHideDupeItems( true );
|
||||
ui->topHits->delegate()->setWordWrapping( true );
|
||||
ui->topHits->delegate()->setShowBuyButtons( true );
|
||||
ui->topHits->setFixedHeight( ui->topHits->itemSize().height() + ui->topHits->spacing() * 2 );
|
||||
|
||||
m_topHitsModel = new PlayableModel( ui->topHits );
|
||||
|
@@ -20,7 +20,6 @@
|
||||
#include "CollectionViewPage.h"
|
||||
|
||||
#include <QRadioButton>
|
||||
#include <QPushButton>
|
||||
#include <QStackedWidget>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
@@ -33,6 +32,7 @@
|
||||
#include "playlist/GridView.h"
|
||||
#include "playlist/PlayableProxyModelPlaylistInterface.h"
|
||||
#include "resolvers/ScriptCollection.h"
|
||||
#include "DownloadManager.h"
|
||||
#include "TomahawkSettings.h"
|
||||
#include "utils/ImageRegistry.h"
|
||||
#include "utils/TomahawkStyle.h"
|
||||
@@ -58,7 +58,6 @@ CollectionViewPage::CollectionViewPage( const Tomahawk::collection_ptr& collecti
|
||||
qRegisterMetaType< CollectionViewPageMode >( "CollectionViewPageMode" );
|
||||
|
||||
m_header->setBackground( ImageRegistry::instance()->pixmap( RESPATH "images/collection_background.png", QSize( 0, 0 ) ), false );
|
||||
|
||||
setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::DefaultCollection, TomahawkUtils::Original, QSize( 256, 256 ) ) );
|
||||
|
||||
m_columnView->proxyModel()->setStyle( PlayableProxyModel::SingleColumn );
|
||||
@@ -79,9 +78,8 @@ CollectionViewPage::CollectionViewPage( const Tomahawk::collection_ptr& collecti
|
||||
m_trackView->setColumnHidden( trackViewProxyModel->mapSourceColumnToColumn( PlayableModel::Score ), true );
|
||||
m_trackView->setColumnHidden( trackViewProxyModel->mapSourceColumnToColumn( PlayableModel::Bitrate ), true );
|
||||
|
||||
|
||||
m_trackView->setGuid( QString( "trackview/flat" ) );
|
||||
m_trackView->setSortingEnabled( true );
|
||||
m_trackView->sortByColumn( 0, Qt::AscendingOrder );
|
||||
|
||||
{
|
||||
m_albumView->setAutoResize( false );
|
||||
@@ -132,11 +130,8 @@ CollectionViewPage::CollectionViewPage( const Tomahawk::collection_ptr& collecti
|
||||
|
||||
if ( collection->backendType() == Collection::ScriptCollectionType )
|
||||
{
|
||||
m_downloadAllButton = m_header->addButton( tr( "Download All" ) );
|
||||
connect( m_downloadAllButton, SIGNAL( clicked() ), SLOT( onDownloadAll() ) );
|
||||
|
||||
connect( DownloadManager::instance(), SIGNAL( stateChanged( DownloadManager::DownloadManagerState, DownloadManager::DownloadManagerState ) ),
|
||||
SLOT( onDownloadManagerStateChanged( DownloadManager::DownloadManagerState, DownloadManager::DownloadManagerState ) ) );
|
||||
QAbstractButton* downloadButton = m_header->addButton( tr( "Download All" ) );
|
||||
connect( downloadButton, SIGNAL( clicked() ), SLOT( onDownloadAll() ) );
|
||||
|
||||
m_header->setRefreshVisible( true );
|
||||
connect( m_header, SIGNAL( refresh() ), SLOT( onCollectionChanged() ) );
|
||||
@@ -205,6 +200,8 @@ CollectionViewPage::setFlatModel( PlayableModel* model )
|
||||
|
||||
m_flatModel = model;
|
||||
m_trackView->setPlayableModel( model );
|
||||
m_trackView->setSortingEnabled( true );
|
||||
m_trackView->sortByColumn( 0, Qt::AscendingOrder );
|
||||
|
||||
if ( oldModel )
|
||||
{
|
||||
@@ -392,8 +389,6 @@ CollectionViewPage::restoreViewMode()
|
||||
} else {
|
||||
setCurrentMode( mode );
|
||||
}
|
||||
|
||||
onCollectionChanged();
|
||||
}
|
||||
|
||||
|
||||
@@ -450,40 +445,14 @@ CollectionViewPage::onCollectionChanged()
|
||||
void
|
||||
CollectionViewPage::onDownloadAll()
|
||||
{
|
||||
if ( DownloadManager::instance()->state() == DownloadManager::Running )
|
||||
for ( int i = 0; i < m_flatModel->rowCount( QModelIndex() ); i++ )
|
||||
{
|
||||
DownloadManager::instance()->cancelAll();
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( int i = 0; i < m_trackView->proxyModel()->rowCount( QModelIndex() ); i++ )
|
||||
{
|
||||
PlayableItem* item = m_trackView->proxyModel()->itemFromIndex( m_trackView->proxyModel()->mapToSource( m_trackView->proxyModel()->index( i, 0, QModelIndex() ) ) );
|
||||
if ( !item )
|
||||
continue;
|
||||
PlayableItem* item = m_flatModel->itemFromIndex( m_flatModel->index( i, 0, QModelIndex() ) );
|
||||
if ( !item )
|
||||
continue;
|
||||
|
||||
QList< DownloadFormat > formats = item->query()->results().first()->downloadFormats();
|
||||
if ( formats.isEmpty() || !DownloadManager::instance()->localFileForDownload( formats.first().url.toString() ).isEmpty() )
|
||||
continue;
|
||||
|
||||
if ( !item->result()->downloadFormats().isEmpty() )
|
||||
DownloadManager::instance()->addJob( item->result()->toDownloadJob( item->result()->downloadFormats().first() ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CollectionViewPage::onDownloadManagerStateChanged( DownloadManager::DownloadManagerState newState, DownloadManager::DownloadManagerState oldState )
|
||||
{
|
||||
tDebug() << Q_FUNC_INFO;
|
||||
if ( newState == DownloadManager::Running )
|
||||
{
|
||||
m_downloadAllButton->setText( tr( "Cancel Download" ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_downloadAllButton->setText( tr( "Download All" ) );
|
||||
if ( !item->result()->downloadFormats().isEmpty() )
|
||||
DownloadManager::instance()->addJob( item->result()->toDownloadJob( item->result()->downloadFormats().first() ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -498,14 +467,5 @@ CollectionViewPage::isTemporaryPage() const
|
||||
bool
|
||||
CollectionViewPage::isBeingPlayed() const
|
||||
{
|
||||
if ( !playlistInterface() )
|
||||
return false;
|
||||
|
||||
if ( playlistInterface() == AudioEngine::instance()->currentTrackPlaylist() )
|
||||
return true;
|
||||
|
||||
if ( playlistInterface()->hasChildInterface( AudioEngine::instance()->currentTrackPlaylist() ) )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
return m_playlistInterface->hasChildInterface( AudioEngine::instance()->currentTrackPlaylist() );
|
||||
}
|
||||
|
@@ -22,10 +22,8 @@
|
||||
|
||||
#include "ViewPage.h"
|
||||
#include "PlaylistInterface.h"
|
||||
#include "DownloadManager.h"
|
||||
#include "DllMacro.h"
|
||||
|
||||
class QPushButton;
|
||||
class QStackedWidget;
|
||||
|
||||
class GridView;
|
||||
@@ -85,12 +83,10 @@ private slots:
|
||||
void onCollectionChanged();
|
||||
|
||||
void onDownloadAll();
|
||||
void onDownloadManagerStateChanged( DownloadManager::DownloadManagerState newState, DownloadManager::DownloadManagerState oldState );
|
||||
|
||||
private:
|
||||
FilterHeader* m_header;
|
||||
QPixmap m_pixmap;
|
||||
QPushButton* m_downloadAllButton;
|
||||
|
||||
ColumnView* m_columnView;
|
||||
TrackView* m_trackView;
|
||||
|
@@ -100,7 +100,6 @@ SearchWidget::SearchWidget( const QString& search, QWidget* parent )
|
||||
ui->tracks->setItemWidth( TomahawkUtils::DpiScaler::scaledX( this, 140 ) );
|
||||
// ui->tracks->proxyModel()->setHideDupeItems( true );
|
||||
ui->tracks->delegate()->setWordWrapping( true );
|
||||
ui->tracks->delegate()->setShowBuyButtons( true );
|
||||
ui->tracks->setFixedHeight( ui->tracks->itemSize().height() + ui->tracks->spacing() * 2 );
|
||||
|
||||
m_resultsModel = new PlayableModel( ui->tracks );
|
||||
@@ -373,18 +372,13 @@ SearchWidget::onAlbumsFound( const QList<Tomahawk::album_ptr>& albums )
|
||||
|
||||
int distance = TomahawkUtils::levenshtein( m_search, album->name() );
|
||||
int maxlen = qMax( m_search.length(), album->name().length() );
|
||||
float scoreAlbum = (float)( maxlen - distance ) / maxlen;
|
||||
float score = (float)( maxlen - distance ) / maxlen;
|
||||
|
||||
distance = TomahawkUtils::levenshtein( m_search, album->artist()->name() );
|
||||
maxlen = qMax( m_search.length(), album->artist()->name().length() );
|
||||
float scoreArtist = (float)( maxlen - distance ) / maxlen;
|
||||
|
||||
float scoreMax = qMax( scoreAlbum, scoreArtist );
|
||||
if ( scoreMax <= 0.1 )
|
||||
if ( score <= 0.1 )
|
||||
continue;
|
||||
|
||||
m_albums.insert( album, scoreMax );
|
||||
// tDebug() << Q_FUNC_INFO << "found album:" << album->name() << "scoreMax:" << scoreMax;
|
||||
m_albums.insert( album, score );
|
||||
// tDebug() << Q_FUNC_INFO << "found album:" << album->name() << "score:" << score;
|
||||
}
|
||||
|
||||
// updateAlbums();
|
||||
|
@@ -132,16 +132,10 @@ BasicHeader::setPixmap( const QPixmap& pixmap, bool tinted )
|
||||
}
|
||||
|
||||
|
||||
QPushButton*
|
||||
QAbstractButton*
|
||||
BasicHeader::addButton( const QString& text )
|
||||
{
|
||||
QPushButton* button = new QPushButton( this );
|
||||
|
||||
button->setStyleSheet( "QPushButton:hover { font-size: 12px; color: #2b2b2b; background: #f8f8f8; border-style: solid; border-radius: 0px; border-width: 2px; border-color: #2b2b2b; }"
|
||||
"QPushButton { font-size: 12px; color: #ffffff; background-color: #000000; border-style: solid; border-radius: 0px; border-width: 0px; }" );
|
||||
button->setMinimumHeight( 30 );
|
||||
button->setMinimumWidth( 132 );
|
||||
|
||||
button->setText( text );
|
||||
|
||||
ui->horizontalLayout->addSpacing( 8 );
|
||||
|
@@ -26,7 +26,6 @@
|
||||
#include "widgets/BackgroundWidget.h"
|
||||
#include "DllMacro.h"
|
||||
|
||||
class QPushButton;
|
||||
class QLabel;
|
||||
class ElidedLabel;
|
||||
class QPaintEvent;
|
||||
@@ -41,7 +40,7 @@ public:
|
||||
|
||||
QScopedPointer<Ui::HeaderWidget> ui;
|
||||
|
||||
QPushButton* addButton( const QString& text );
|
||||
QAbstractButton* addButton( const QString& text );
|
||||
|
||||
public slots:
|
||||
virtual void setCaption( const QString& s );
|
||||
|
@@ -32,9 +32,7 @@ using namespace Tomahawk;
|
||||
|
||||
DropDownButton::DropDownButton( QWidget* parent )
|
||||
: QComboBox( parent )
|
||||
, m_hovering( false )
|
||||
{
|
||||
setAttribute( Qt::WA_Hover, true );
|
||||
}
|
||||
|
||||
|
||||
@@ -48,59 +46,44 @@ DropDownButton::paintEvent( QPaintEvent* event )
|
||||
{
|
||||
// QComboBox::paintEvent( event );
|
||||
QPainter p( this );
|
||||
|
||||
setupPainter( &p );
|
||||
|
||||
drawPrimitive( &p, contentsRect(), currentText(), m_hovering, true );
|
||||
drawPrimitive( &p, contentsRect(), currentText() );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DropDownButton::drawPrimitive( QPainter* p, const QRect& rect, const QString& text, bool hovering, bool itemsAvailable )
|
||||
DropDownButton::drawPrimitive( QPainter* p, const QRect& rect, const QString& text )
|
||||
{
|
||||
p->save();
|
||||
|
||||
setupPainter( p );
|
||||
|
||||
p->setRenderHint( QPainter::TextAntialiasing );
|
||||
QRect r = rect.adjusted( 2, 2, -2, -2 );
|
||||
|
||||
QColor bgColor = hovering ? TomahawkStyle::PLAYLIST_BUTTON_HOVER_BACKGROUND : TomahawkStyle::PLAYLIST_BUTTON_BACKGROUND;
|
||||
|
||||
p->setOpacity( 1.0 );
|
||||
p->setPen( bgColor );
|
||||
p->setBrush( bgColor );
|
||||
p->setPen( TomahawkStyle::PLAYLIST_BUTTON_BACKGROUND.darker() );
|
||||
p->setBrush( TomahawkStyle::PLAYLIST_BUTTON_BACKGROUND );
|
||||
p->drawRect( r );
|
||||
|
||||
// paint divider
|
||||
p->setPen( TomahawkStyle::PLAYLIST_BUTTON_FOREGROUND );
|
||||
|
||||
int dropdownWidth = 0;
|
||||
p->drawLine( QPoint( r.right() - 24, r.top() + 3 ), QPoint( r.right() - 24, r.bottom() - 3 ) );
|
||||
|
||||
if ( itemsAvailable )
|
||||
{
|
||||
// paint divider
|
||||
p->drawLine( QPoint( r.right() - 24, r.top() + 3 ), QPoint( r.right() - 24, r.bottom() - 3 ) );
|
||||
|
||||
// paint drop-down arrow
|
||||
p->save();
|
||||
QPainterPath dropPath;
|
||||
dropPath.moveTo( QPointF( r.right() - 14, float(r.top()) + float(r.height()) * 0.5 - 1.5 ) );
|
||||
QPointF currentPosition = dropPath.currentPosition();
|
||||
dropPath.lineTo( currentPosition.x() + 6, currentPosition.y() );
|
||||
dropPath.lineTo( currentPosition.x() + 3, currentPosition.y() + 3 );
|
||||
dropPath.closeSubpath();
|
||||
p->setPen( TomahawkStyle::PLAYLIST_BUTTON_FOREGROUND );
|
||||
p->setBrush( TomahawkStyle::PLAYLIST_BUTTON_FOREGROUND );
|
||||
p->setRenderHint( QPainter::Antialiasing, false );
|
||||
p->drawPath( dropPath );
|
||||
p->restore();
|
||||
|
||||
dropdownWidth = 24;
|
||||
}
|
||||
// paint drop-down arrow
|
||||
p->save();
|
||||
QPainterPath dropPath;
|
||||
dropPath.moveTo( QPointF( r.right() - 14, float(r.top()) + float(r.height()) * 0.5 - 1.5 ) );
|
||||
QPointF currentPosition = dropPath.currentPosition();
|
||||
dropPath.lineTo( currentPosition.x() + 6, currentPosition.y() );
|
||||
dropPath.lineTo( currentPosition.x() + 3, currentPosition.y() + 3 );
|
||||
dropPath.closeSubpath();
|
||||
p->setPen( TomahawkStyle::PLAYLIST_BUTTON_FOREGROUND );
|
||||
p->setBrush( TomahawkStyle::PLAYLIST_BUTTON_FOREGROUND );
|
||||
p->setRenderHint( QPainter::Antialiasing, false );
|
||||
p->drawPath( dropPath );
|
||||
p->restore();
|
||||
|
||||
// paint label
|
||||
const QFontMetrics fm( p->font() );
|
||||
r.adjust( 0, 0, -dropdownWidth, 0 ); // center-align left of the divider
|
||||
p->drawText( r, Qt::AlignCenter, fm.elidedText( text.toUpper(), Qt::ElideRight, r.width() ) );
|
||||
r.adjust( 0, 0, -24, 0 ); // center-align left of the divider
|
||||
p->drawText( r, Qt::AlignCenter, fm.elidedText( text, Qt::ElideRight, r.width() ) );
|
||||
|
||||
p->restore();
|
||||
}
|
||||
@@ -118,29 +101,3 @@ DropDownButton::mousePressEvent( QMouseEvent* event )
|
||||
event->accept();
|
||||
emit clicked();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DropDownButton::enterEvent( QEvent * event )
|
||||
{
|
||||
m_hovering = true;
|
||||
QWidget::enterEvent(event);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DropDownButton::leaveEvent( QEvent* event )
|
||||
{
|
||||
m_hovering = false;
|
||||
QWidget::leaveEvent(event);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DropDownButton::setupPainter( QPainter* p )
|
||||
{
|
||||
QFont f = p->font();
|
||||
f.setPointSize( TomahawkUtils::defaultFontSize() - 1 );
|
||||
f.setBold( true );
|
||||
p->setFont( f );
|
||||
}
|
||||
|
@@ -32,7 +32,7 @@ public:
|
||||
explicit DropDownButton( QWidget* parent = 0 );
|
||||
virtual ~DropDownButton();
|
||||
|
||||
static void drawPrimitive( QPainter* p, const QRect& rect, const QString& text, bool hovering, bool itemsAvailable );
|
||||
static void drawPrimitive( QPainter* p, const QRect& rect, const QString& text );
|
||||
|
||||
public slots:
|
||||
|
||||
@@ -42,15 +42,10 @@ signals:
|
||||
protected:
|
||||
void paintEvent( QPaintEvent* event );
|
||||
void mousePressEvent( QMouseEvent* event );
|
||||
void enterEvent( QEvent* event );
|
||||
void leaveEvent( QEvent* event );
|
||||
|
||||
private slots:
|
||||
|
||||
private:
|
||||
static void setupPainter( QPainter* p );
|
||||
|
||||
bool m_hovering;
|
||||
};
|
||||
|
||||
#endif // DROPDOWNBUTTON_H
|
||||
|
@@ -1,3 +1,5 @@
|
||||
SET( TOMAHAWK_LIBRARIES tomahawklib )
|
||||
|
||||
SET( OS_SPECIFIC_LINK_LIBRARIES
|
||||
${OS_SPECIFIC_LINK_LIBRARIES}
|
||||
${COREAUDIO_LIBRARY}
|
||||
|
@@ -1,3 +1,5 @@
|
||||
set(TOMAHAWK_APPLICATION_TARGET "tomahawk-bin")
|
||||
|
||||
include( ECMAddAppIcon )
|
||||
|
||||
# SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" )
|
||||
@@ -7,8 +9,6 @@ IF( NOT CMAKE_BUILD_TYPE STREQUAL "Release" AND NOT CMAKE_BUILD_TYPE STREQUAL "R
|
||||
MESSAGE( "Building in debug mode, enabling all debug updates" )
|
||||
ENDIF()
|
||||
|
||||
set(TOMAHAWK_APPLICATION_TARGET ${TOMAHAWK_TARGET_NAME}-bin)
|
||||
|
||||
# build plugins
|
||||
# use glob, but hardcoded list for now:
|
||||
#FILE( GLOB plugindirs "src/plugins/*" )
|
||||
@@ -154,18 +154,19 @@ else()
|
||||
ecm_add_app_icon(tomahawkSources ICONS ${TOMAHAWK_ICONS})
|
||||
endif()
|
||||
|
||||
|
||||
qt_add_resources( RC_SRCS "../../resources.qrc" )
|
||||
|
||||
SET( final_src ${final_src} ${tomahawkUI_H} ${tomahawkMoc} ${tomahawkSources} ${RC_SRCS} )
|
||||
|
||||
if(APPLE OR WIN32)
|
||||
set(TOMAHAWK_RUNTIME_OUTPUT_NAME "${TOMAHAWK_APPLICATION_NAME}")
|
||||
if(APPLE)
|
||||
set(TOMAHAWK_RUNTIME_OUTPUT_NAME "Tomahawk")
|
||||
else()
|
||||
set(TOMAHAWK_RUNTIME_OUTPUT_NAME "${TOMAHAWK_TARGET_NAME}")
|
||||
set(TOMAHAWK_RUNTIME_OUTPUT_NAME "tomahawk")
|
||||
endif()
|
||||
|
||||
ADD_EXECUTABLE( ${TOMAHAWK_APPLICATION_TARGET} WIN32 MACOSX_BUNDLE ${final_src} )
|
||||
SET_TARGET_PROPERTIES( ${TOMAHAWK_APPLICATION_TARGET}
|
||||
SET_TARGET_PROPERTIES(${TOMAHAWK_APPLICATION_TARGET}
|
||||
PROPERTIES
|
||||
AUTOMOC TRUE
|
||||
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_BINARY_DIR}/Info.plist"
|
||||
@@ -209,7 +210,8 @@ TARGET_LINK_LIBRARIES( ${TOMAHAWK_APPLICATION_TARGET}
|
||||
IF( APPLE )
|
||||
IF( HAVE_SPARKLE )
|
||||
MESSAGE("Sparkle Found, installing framekwork in bundle")
|
||||
INSTALL(DIRECTORY "${SPARKLE}/Versions/Current/Resources" DESTINATION "${CMAKE_BINARY_DIR}/${TOMAHAWK_APPLICATION_NAME}.app/Contents/Frameworks/Sparkle.framework")
|
||||
INSTALL(DIRECTORY "${SPARKLE}/Versions/Current/Resources" DESTINATION "${CMAKE_BINARY_DIR}/Tomahawk.app/Contents/Frameworks/Sparkle.framework")
|
||||
|
||||
ENDIF( HAVE_SPARKLE )
|
||||
ENDIF( APPLE )
|
||||
|
||||
|
@@ -608,14 +608,14 @@ TomahawkApp::initSIP()
|
||||
void
|
||||
TomahawkApp::onShutdownDelayed()
|
||||
{
|
||||
QProgressDialog* d = new QProgressDialog( tr( "%applicationName is updating the database. Please wait, this may take a minute!" ), QString(),
|
||||
QProgressDialog* d = new QProgressDialog( tr( "Tomahawk is updating the database. Please wait, this may take a minute!" ), QString(),
|
||||
0, 0, 0, Qt::Tool
|
||||
| Qt::WindowTitleHint
|
||||
| Qt::CustomizeWindowHint );
|
||||
d->setModal( true );
|
||||
d->setAutoClose( false );
|
||||
d->setAutoReset( false );
|
||||
d->setWindowTitle( tr( "%applicationName" ) );
|
||||
d->setWindowTitle( tr( "Tomahawk" ) );
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
d->setAttribute( Qt::WA_MacAlwaysShowToolWindow );
|
||||
@@ -642,7 +642,7 @@ TomahawkApp::onInfoSystemReady()
|
||||
{
|
||||
tDebug() << "Init MainWindow.";
|
||||
m_mainwindow = new TomahawkWindow();
|
||||
m_mainwindow->setWindowTitle( tr( "%applicationName" ) );
|
||||
m_mainwindow->setWindowTitle( "Tomahawk" );
|
||||
m_mainwindow->setObjectName( "TH_Main_Window" );
|
||||
if ( !arguments().contains( "--hide" ) )
|
||||
{
|
||||
|
@@ -67,15 +67,13 @@ TomahawkTrayIcon::TomahawkTrayIcon( QObject* parent )
|
||||
m_contextMenu->addSeparator();
|
||||
m_contextMenu->addAction( ac->getAction( "previousTrack" ) );
|
||||
m_contextMenu->addAction( ac->getAction( "nextTrack" ) );
|
||||
/*
|
||||
m_contextMenu->addSeparator();
|
||||
m_contextMenu->addAction( ActionCollection::instance()->getAction( "togglePrivacy" ) );
|
||||
*/
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
// On mac you can close the windows while leaving the app open. We then need a way to show the main window again
|
||||
m_contextMenu->addSeparator();
|
||||
m_showWindowAction = m_contextMenu->addAction( tr( "Hide %applicationName Window" ) );
|
||||
m_showWindowAction = m_contextMenu->addAction( tr( "Hide Tomahawk Window" ) );
|
||||
m_showWindowAction->setData( true );
|
||||
connect( m_showWindowAction, SIGNAL( triggered() ), this, SLOT( showWindow() ) );
|
||||
|
||||
@@ -114,12 +112,12 @@ TomahawkTrayIcon::setShowHideWindow( bool show )
|
||||
{
|
||||
if ( show )
|
||||
{
|
||||
m_showWindowAction->setText( tr( "Hide %applicationName Window" ) );
|
||||
m_showWindowAction->setText( tr( "Hide Tomahawk Window" ) );
|
||||
m_showWindowAction->setData( show );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_showWindowAction->setText( tr( "Show %applicationName Window" ) );
|
||||
m_showWindowAction->setText( tr( "Show Tomahawk Window" ) );
|
||||
}
|
||||
|
||||
m_showWindowAction->setData( show );
|
||||
|
@@ -84,8 +84,6 @@
|
||||
#include "dialogs/LoadPlaylistDialog.h"
|
||||
#include "utils/ImageRegistry.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "utils/GuiHelpers.h"
|
||||
#include "libtomahawk/widgets/ImageButton.h"
|
||||
|
||||
#include "config.h"
|
||||
|
||||
@@ -1271,11 +1269,11 @@ TomahawkWindow::showAboutTomahawk()
|
||||
QString head, desc;
|
||||
|
||||
#ifdef QT_DEBUG
|
||||
head = tr( "<h2><b>%applicationName %1<br/>(%2)</h2>" )
|
||||
head = tr( "<h2><b>Tomahawk %1<br/>(%2)</h2>" )
|
||||
.arg( TomahawkUtils::appFriendlyVersion() )
|
||||
.arg( qApp->applicationVersion() );
|
||||
#else
|
||||
head = tr( "<h2><b>%applicationName %1</h2>" )
|
||||
head = tr( "<h2><b>Tomahawk %1</h2>" )
|
||||
.arg( TomahawkUtils::appFriendlyVersion() );
|
||||
#endif
|
||||
|
||||
@@ -1287,7 +1285,7 @@ TomahawkWindow::showAboutTomahawk()
|
||||
.arg( copyright )
|
||||
.arg( thanksto );
|
||||
|
||||
QMessageBox::about( this, tr( "About %applicationName" ), head + desc );
|
||||
QMessageBox::about( this, tr( "About Tomahawk" ), head + desc );
|
||||
}
|
||||
|
||||
|
||||
|
@@ -11,7 +11,7 @@
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>%applicationName</string>
|
||||
<string>Tomahawk</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralWidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
|
@@ -68,7 +68,7 @@ DiagnosticsDialog::updateLogView()
|
||||
{
|
||||
QString log;
|
||||
|
||||
log.append( QString( "%applicationName DIAGNOSTICS LOG -%1 \n\n" ).arg( QDateTime::currentDateTime().toString() ) );
|
||||
log.append( QString( "TOMAHAWK DIAGNOSTICS LOG -%1 \n\n" ).arg( QDateTime::currentDateTime().toString() ) );
|
||||
log.append( "TOMAHAWK-VERSION: " TOMAHAWK_VERSION "\n" );
|
||||
log.append( "PLATFORM: " TOMAHAWK_SYSTEM "\n");
|
||||
log.append( QString( "DBID: %1\n\n" ).arg( Tomahawk::Database::instance()->impl()->dbid() ) );
|
||||
|
@@ -17,7 +17,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>%applicationName Diagnostics</string>
|
||||
<string>Tomahawk Diagnostics</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="margin">
|
||||
|
@@ -59,8 +59,6 @@
|
||||
#include "jobview/ErrorStatusMessage.h"
|
||||
#include "utils/NetworkAccessManager.h"
|
||||
#include "utils/NetworkProxyFactory.h"
|
||||
#include "resolvers/JSAccount.h"
|
||||
#include "resolvers/JSResolver.h"
|
||||
|
||||
#include <QDesktopServices>
|
||||
#include <QFileDialog>
|
||||
@@ -70,7 +68,6 @@
|
||||
#include <QVBoxLayout>
|
||||
#include <QSizeGrip>
|
||||
#include <QToolBar>
|
||||
#include <QMenu>
|
||||
|
||||
using namespace Tomahawk;
|
||||
using namespace Accounts;
|
||||
@@ -90,7 +87,6 @@ SettingsDialog::SettingsDialog(QObject *parent )
|
||||
, m_restartRequired( false )
|
||||
, m_accountModel( 0 )
|
||||
, m_sipSpinner( 0 )
|
||||
, m_contextMenu( 0 )
|
||||
{
|
||||
m_accountsWidget->setFont( TomahawkUtils::systemFont() );
|
||||
m_collectionWidget->setFont( TomahawkUtils::systemFont() );
|
||||
@@ -148,12 +144,6 @@ SettingsDialog::SettingsDialog(QObject *parent )
|
||||
m_accountsWidgetUi->accountsView->setVerticalScrollMode( QAbstractItemView::ScrollPerPixel );
|
||||
m_accountsWidgetUi->accountsView->setMouseTracking( true );
|
||||
|
||||
m_contextMenu = new QMenu( m_accountsWidgetUi->accountsView );
|
||||
m_contextMenu->setFont( TomahawkUtils::systemFont() );
|
||||
connect( m_accountsWidgetUi->accountsView, SIGNAL( customContextMenuRequested( QPoint ) ), SLOT( onCustomContextMenu( QPoint ) ) );
|
||||
QAction* showDebuggerAction = m_contextMenu->addAction( tr( "Open Account &Debugger..." ) );
|
||||
connect( showDebuggerAction, SIGNAL( triggered(bool) ), SLOT( onShowDebuggerForSelectedAccount() ) );
|
||||
|
||||
connect( accountDelegate, SIGNAL( openConfig( Tomahawk::Accounts::Account* ) ), SLOT( openAccountConfig( Tomahawk::Accounts::Account* ) ) );
|
||||
connect( accountDelegate, SIGNAL( openConfig( Tomahawk::Accounts::AccountFactory* ) ), SLOT( openAccountFactoryConfig( Tomahawk::Accounts::AccountFactory* ) ) );
|
||||
connect( accountDelegate, SIGNAL( update( QModelIndex ) ), m_accountsWidgetUi->accountsView, SLOT( update( QModelIndex ) ) );
|
||||
@@ -267,20 +257,20 @@ SettingsDialog::SettingsDialog(QObject *parent )
|
||||
// #endif
|
||||
|
||||
m_dialog->addTab( m_accountsWidget, TomahawkUtils::defaultPixmap( TomahawkUtils::AccountSettings ),
|
||||
tr( "Plug-Ins" ), tr( "Configure the accounts and services used by %applicationName "
|
||||
tr( "Plug-Ins" ), tr( "Configure the accounts and services used by Tomahawk "
|
||||
"to search and retrieve music, find your friends and "
|
||||
"update your status." ) );
|
||||
|
||||
m_dialog->addTab( m_collectionWidget, TomahawkUtils::defaultPixmap( TomahawkUtils::MusicSettings ),
|
||||
tr( "Collection" ), tr( "Manage how %applicationName finds music on your computer." ) );
|
||||
tr( "Collection" ), tr( "Manage how Tomahawk finds music on your computer." ) );
|
||||
|
||||
m_dialog->addTab( m_advancedWidget, TomahawkUtils::defaultPixmap( TomahawkUtils::AdvancedSettings ),
|
||||
tr( "Advanced" ), tr( "Configure %applicationName advanced settings, including "
|
||||
tr( "Advanced" ), tr( "Configure Tomahawk's advanced settings, including "
|
||||
"network connectivity settings, browser interaction "
|
||||
"and more." ) );
|
||||
|
||||
m_dialog->addTab( m_downloadsWidget, TomahawkUtils::defaultPixmap( TomahawkUtils::DownloadsSettings ),
|
||||
tr( "Downloads" ), tr( "Configure %applicationName's integrated download manager." ) );
|
||||
tr( "Downloads" ), tr( "Configure Tomahawk's integrated download manager." ) );
|
||||
|
||||
m_dialog->setCurrentIndex( 0 );
|
||||
|
||||
@@ -333,7 +323,7 @@ SettingsDialog::saveSettings()
|
||||
s->sync();
|
||||
|
||||
if ( m_restartRequired )
|
||||
QMessageBox::information( 0, tr( "Information" ), tr( "Some changed settings will not take effect until %applicationName is restarted" ) );
|
||||
QMessageBox::information( 0, tr( "Information" ), tr( "Some changed settings will not take effect until Tomahawk is restarted" ) );
|
||||
|
||||
// m_collectionWidgetUi->dirTree->cleanup();
|
||||
|
||||
@@ -390,34 +380,6 @@ SettingsDialog::onRejected()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SettingsDialog::onCustomContextMenu( const QPoint& point )
|
||||
{
|
||||
QModelIndex index = m_accountsWidgetUi->accountsView->indexAt( point );
|
||||
if ( !index.isValid() )
|
||||
return;
|
||||
|
||||
// HACK until there is a proper ScriptAccount
|
||||
ResolverAccount* account = qobject_cast< ResolverAccount* >( m_accountProxy->data( index, AccountModel::AccountData ).value< Tomahawk::Accounts::Account* >() );
|
||||
if ( !account )
|
||||
return;
|
||||
Tomahawk::JSResolver* jsResolver = qobject_cast< Tomahawk::JSResolver* >( account->resolver() );
|
||||
if ( !jsResolver )
|
||||
return;
|
||||
|
||||
m_contextMenu->exec( m_accountsWidgetUi->accountsView->mapToGlobal( point ) );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SettingsDialog::onShowDebuggerForSelectedAccount()
|
||||
{
|
||||
ResolverAccount* account = m_accountProxy->data( m_accountsWidgetUi->accountsView->currentIndex(), AccountModel::AccountData ).value< ResolverAccount* >();
|
||||
Tomahawk::JSResolver* jsResolver = qobject_cast< Tomahawk::JSResolver* >( account->resolver() );
|
||||
jsResolver->scriptAccount()->showDebugger();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SettingsDialog::changeEvent( QEvent *e )
|
||||
{
|
||||
@@ -586,9 +548,9 @@ SettingsDialog::openAccountConfig( Account* account, bool showDelete )
|
||||
void
|
||||
SettingsDialog::installFromFile()
|
||||
{
|
||||
const QString resolver = QFileDialog::getOpenFileName( m_accountsWidget, tr( "Install plug-in from file" ),
|
||||
const QString resolver = QFileDialog::getOpenFileName( m_accountsWidget, tr( "Install resolver from file" ),
|
||||
TomahawkSettings::instance()->scriptDefaultPath(),
|
||||
tr( "%applicationName Plug-Ins (*.axe *.js);;"
|
||||
tr( "Tomahawk Resolvers (*.axe *.js);;"
|
||||
"All files (*)" ),
|
||||
0,
|
||||
QFileDialog::ReadOnly );
|
||||
|
@@ -37,7 +37,6 @@ class SipPlugin;
|
||||
class ResolversModel;
|
||||
class QNetworkReply;
|
||||
class QToolbarTabDialog;
|
||||
class QMenu;
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
@@ -131,9 +130,6 @@ private slots:
|
||||
void saveSettings();
|
||||
void onRejected();
|
||||
|
||||
void onCustomContextMenu( const QPoint& point );
|
||||
void onShowDebuggerForSelectedAccount();
|
||||
|
||||
private:
|
||||
Ui_Settings_Accounts* m_accountsWidgetUi;
|
||||
QWidget* m_accountsWidget;
|
||||
@@ -156,7 +152,6 @@ private:
|
||||
Tomahawk::Accounts::AccountModelFilterProxy* m_accountProxy;
|
||||
QHash<QString, QString> m_downloadsFormats;
|
||||
AnimatedSpinner* m_sipSpinner;
|
||||
QMenu* m_contextMenu;
|
||||
};
|
||||
|
||||
#endif // SETTINGSDIALOG_H
|
||||
|
@@ -177,7 +177,7 @@
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Allow web browsers to interact with %applicationName (recommended)</string>
|
||||
<string>Allow web browsers to interact with Tomahawk (recommended)</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
@@ -190,7 +190,7 @@
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Allow other computers to interact with %applicationName (not recommended yet)</string>
|
||||
<string>Allow other computers to interact with Tomahawk (not recommended yet)</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
@@ -203,7 +203,7 @@
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Send %applicationName Crash Reports</string>
|
||||
<string>Send Tomahawk Crash Reports</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
|
@@ -50,7 +50,7 @@
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Due to the unique way %applicationName works, your music files must at least have Artist & Title metadata/ID3 tags to be added to your Collection.</string>
|
||||
<string>Due to the unique way Tomahawk works, your music files must at least have Artist & Title metadata/ID3 tags to be added to your Collection.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
|
@@ -211,7 +211,7 @@
|
||||
#ifdef HAVE_SPARKLE
|
||||
- (void)updater:(SUUpdater *)updater willInstallUpdate:(SUAppcastItem *)update
|
||||
{
|
||||
// tLog() << "NSApp in willInstallUpdate, deleting Phonon objects";
|
||||
tLog() << "NSApp in willInstallUpdate, deleting Phonon objects";
|
||||
AudioEngine::instance()->stop();
|
||||
delete AudioEngine::instance();
|
||||
}
|
||||
|
@@ -41,7 +41,6 @@
|
||||
#endif
|
||||
|
||||
#ifdef WITH_CRASHREPORTER
|
||||
#include "TomahawkVersion.h"
|
||||
#include "libcrashreporter-handler/Handler.h"
|
||||
#endif
|
||||
|
||||
@@ -172,6 +171,10 @@ main( int argc, char *argv[] )
|
||||
// This must go before QApplication initialisation.
|
||||
Tomahawk::macMain();
|
||||
|
||||
// Fixes focus issue with NSSearchField, see QTBUG-11401
|
||||
// code taken from clementine:main.cpp:336
|
||||
QCoreApplication::setAttribute( Qt::AA_NativeWindows, true );
|
||||
|
||||
// used for url handler
|
||||
AEEventHandlerUPP h = AEEventHandlerUPP( appleEventHandler );
|
||||
AEInstallEventHandler( 'GURL', 'GURL', h, 0, false );
|
||||
@@ -187,7 +190,7 @@ main( int argc, char *argv[] )
|
||||
TomahawkApp a( argc, argv );
|
||||
|
||||
#ifdef WITH_CRASHREPORTER
|
||||
CrashReporter::Handler* handler = new CrashReporter::Handler( QDir::tempPath(), !TomahawkUtils::headless(), TOMAHAWK_TARGET_NAME "_crash_reporter" );
|
||||
CrashReporter::Handler* handler = new CrashReporter::Handler( QDir::tempPath(), !TomahawkUtils::headless(), "tomahawk_crash_reporter" );
|
||||
#endif
|
||||
|
||||
// MUST register StateHash ****before*** initing TomahawkSettingsGui as constructor of settings does upgrade before Gui subclass registers type
|
||||
|
@@ -1,21 +1,40 @@
|
||||
set(TOMAHAWK_TOOL_DB_LIST_ARTISTS_TARGET ${TOMAHAWK_TARGET_NAME}-db-list-artists)
|
||||
|
||||
set( tomahawk_db_list_artists_src
|
||||
listartists.cpp
|
||||
)
|
||||
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
add_executable( ${TOMAHAWK_TOOL_DB_LIST_ARTISTS_TARGET} WIN32 MACOSX_BUNDLE
|
||||
add_executable( tomahawk_db_list_artists_bin WIN32 MACOSX_BUNDLE
|
||||
${tomahawk_db_list_artists_src} )
|
||||
set_target_properties( ${TOMAHAWK_TOOL_DB_LIST_ARTISTS_TARGET}
|
||||
set_target_properties( tomahawk_db_list_artists_bin
|
||||
PROPERTIES
|
||||
AUTOMOC TRUE
|
||||
RUNTIME_OUTPUT_NAME tomahawk-db-list-artists
|
||||
)
|
||||
target_link_libraries( ${TOMAHAWK_TOOL_DB_LIST_ARTISTS_TARGET}
|
||||
target_link_libraries( tomahawk_db_list_artists_bin
|
||||
${TOMAHAWK_LIBRARIES}
|
||||
)
|
||||
|
||||
qt5_use_modules(${TOMAHAWK_TOOL_DB_LIST_ARTISTS_TARGET} Core)
|
||||
install( TARGETS ${TOMAHAWK_TOOL_DB_LIST_ARTISTS_TARGET} BUNDLE DESTINATION . RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} )
|
||||
qt5_use_modules(tomahawk_db_list_artists_bin Core)
|
||||
install( TARGETS tomahawk_db_list_artists_bin BUNDLE DESTINATION . RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} )
|
||||
|
||||
set( tomahawk_db_fuzzysearch_src
|
||||
fuzzysearch.cpp
|
||||
)
|
||||
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
add_executable( tomahawk_db_fuzzysearch_bin WIN32 MACOSX_BUNDLE
|
||||
${tomahawk_db_fuzzysearch_src} )
|
||||
set_target_properties( tomahawk_db_fuzzysearch_bin
|
||||
PROPERTIES
|
||||
AUTOMOC TRUE
|
||||
RUNTIME_OUTPUT_NAME tomahawk-db-fuzzysearch
|
||||
)
|
||||
target_link_libraries( tomahawk_db_fuzzysearch_bin
|
||||
${TOMAHAWK_LIBRARIES}
|
||||
)
|
||||
|
||||
qt5_use_modules(tomahawk_db_list_artists_bin Core)
|
||||
install( TARGETS tomahawk_db_list_artists_bin BUNDLE DESTINATION . RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} )
|
||||
|
||||
|
@@ -1,19 +1,17 @@
|
||||
set(TOMAHAWK_TOOL_MUSICSCAN_TARGET ${TOMAHAWK_TARGET_NAME}-musicscan)
|
||||
|
||||
set( tomahawk_test_musicscan_src
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable( ${TOMAHAWK_TOOL_MUSICSCAN_TARGET} WIN32 MACOSX_BUNDLE
|
||||
add_executable( tomahawk_test_musicscan_bin WIN32 MACOSX_BUNDLE
|
||||
${tomahawk_test_musicscan_src} )
|
||||
set_target_properties( ${TOMAHAWK_TOOL_MUSICSCAN_TARGET}
|
||||
set_target_properties( tomahawk_test_musicscan_bin
|
||||
PROPERTIES
|
||||
AUTOMOC TRUE
|
||||
RUNTIME_OUTPUT_NAME tomahawk-test-musicscan
|
||||
)
|
||||
|
||||
target_link_libraries( ${TOMAHAWK_TOOL_MUSICSCAN_TARGET}
|
||||
target_link_libraries( tomahawk_test_musicscan_bin
|
||||
${TOMAHAWK_LIBRARIES}
|
||||
)
|
||||
|
||||
qt5_use_modules(${TOMAHAWK_TOOL_MUSICSCAN_TARGET} Core Gui Network Widgets)
|
||||
install( TARGETS ${TOMAHAWK_TOOL_MUSICSCAN_TARGET} BUNDLE DESTINATION . RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} )
|
||||
qt5_use_modules(tomahawk_test_musicscan_bin Core Gui Network Widgets)
|
||||
install( TARGETS tomahawk_test_musicscan_bin BUNDLE DESTINATION . RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} )
|
||||
|
@@ -6,5 +6,5 @@ tomahawk_add_plugin(charts
|
||||
UI
|
||||
ChartsWidget.ui
|
||||
LINK_LIBRARIES
|
||||
${TOMAHAWK_WIDGETS_LIBRARIES}
|
||||
tomahawk-widgets
|
||||
)
|
||||
|
@@ -6,5 +6,5 @@ tomahawk_add_plugin(dashboard
|
||||
UI
|
||||
DashboardWidget.ui
|
||||
LINK_LIBRARIES
|
||||
${TOMAHAWK_WIDGETS_LIBRARIES}
|
||||
tomahawk-widgets
|
||||
)
|
||||
|
@@ -6,5 +6,5 @@ tomahawk_add_plugin(newreleases
|
||||
UI
|
||||
NewReleasesWidget.ui
|
||||
LINK_LIBRARIES
|
||||
${TOMAHAWK_WIDGETS_LIBRARIES}
|
||||
tomahawk-widgets
|
||||
)
|
||||
|
@@ -6,5 +6,5 @@ tomahawk_add_plugin(whatsnew_0_8
|
||||
UI
|
||||
WhatsNewWidget_0_8.ui
|
||||
LINK_LIBRARIES
|
||||
${TOMAHAWK_WIDGETS_LIBRARIES}
|
||||
tomahawk-widgets
|
||||
)
|
||||
|
Reference in New Issue
Block a user