1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-09-13 07:24:15 +02:00

Compare commits

..

19 Commits
vsxu ... 0.3.1

Author SHA1 Message Date
Leo Franchi
9a81ce8b89 Add 0.3.1 fixes to Changelog 2011-11-13 14:07:37 -05:00
Christian Muehlhaeuser
c805d283d4 * Updated ChangeLog and bumped version to 0.3.1. 2011-11-13 19:25:53 +01:00
Christian Muehlhaeuser
03379f361c * Force an index update after 0.3.1 upgrade. 2011-11-13 19:19:36 +01:00
Christian Muehlhaeuser
c671c0e898 * 'Fixed' Windows shutdown crash. 2011-11-13 19:19:25 +01:00
Christian Muehlhaeuser
edaf49b4c5 * Fixed creating index when there is only a local source. 2011-11-13 19:19:02 +01:00
Christian Muehlhaeuser
682903b0cb * Prevent watch for changes interfering with running scan. 2011-11-13 19:18:49 +01:00
Dominik Schmidt
53f7f599d5 Update ChangeLog 2011-11-13 17:31:16 +01:00
Dominik Schmidt
cc669fc20f Remove unneccessary toString conversion 2011-11-13 17:26:43 +01:00
Dominik Schmidt
4e7496a38a Search for *_tomahawkresolver in CMAKE_INSTALL_LIBEXECDIR 2011-11-13 15:40:39 +01:00
Leo Franchi
5842cdceee Only do setenv on linux, that's theonly time we'll have unity anyway
(cherry picked from commit 09a7d790ad)
2011-11-12 10:04:31 -05:00
Leo Franchi
b7e0be8d9d Hide red latch headphones on local source if the source you are latched on to goes offline
(cherry picked from commit d49a43709d)
2011-11-12 10:04:25 -05:00
Leo Franchi
a203b60cbb Add Unity systray hack from Clementine.
(cherry picked from commit 96fe10cc9f)
2011-11-12 10:04:20 -05:00
Leo Franchi
2be08af321 Draw the author name as well as avatar in recent playlists
(cherry picked from commit 2a27cbde0d)
2011-11-12 10:04:12 -05:00
Leo Franchi
ad4c229a6b Don't show in global menu in unity. Thanks davidsansome :)
(cherry picked from commit 1f10444d5c)
2011-11-12 10:04:06 -05:00
Leo Franchi
b2e0206e34 Be a bit more resilient in setting the playlist to rename after creating
(cherry picked from commit 1bb8ff97d4)
2011-11-12 10:04:00 -05:00
Leo Franchi
743ae013ea Don't select a temp item when deleting it
(cherry picked from commit 518546b525)
2011-11-12 10:03:54 -05:00
Leo Franchi
767cf7c1b9 Hide warning
(cherry picked from commit 17e1003714)
2011-11-12 10:03:47 -05:00
Leo Franchi
6be94ab81c Stop the timer on new track starting
(cherry picked from commit 3c024ab7ac)
2011-11-12 10:02:03 -05:00
Leo Franchi
b1ed304a61 Fix crash on Sparkle update when binary is replaced.
(cherry picked from commit f9b5bda925)
2011-11-11 11:04:30 -05:00
403 changed files with 6201 additions and 29869 deletions

3
.gitmodules vendored Normal file
View File

@@ -0,0 +1,3 @@
[submodule "thirdparty/jreen"]
path = thirdparty/jreen
url = git://github.com/euroelessar/jreen.git

View File

@@ -16,7 +16,7 @@ SET( TOMAHAWK_DESCRIPTION_SUMMARY "The social media player" )
SET( TOMAHAWK_VERSION_MAJOR 0 ) SET( TOMAHAWK_VERSION_MAJOR 0 )
SET( TOMAHAWK_VERSION_MINOR 3 ) SET( TOMAHAWK_VERSION_MINOR 3 )
SET( TOMAHAWK_VERSION_PATCH 99 ) SET( TOMAHAWK_VERSION_PATCH 1 )
#SET( TOMAHAWK_VERSION_RC 0 ) #SET( TOMAHAWK_VERSION_RC 0 )
@@ -24,7 +24,6 @@ SET( TOMAHAWK_VERSION_PATCH 99 )
# build options # build options
option(BUILD_GUI "Build Tomahawk with GUI" ON) option(BUILD_GUI "Build Tomahawk with GUI" ON)
option(BUILD_RELEASE "Generate TOMAHAWK_VERSION without GIT info" OFF) option(BUILD_RELEASE "Generate TOMAHAWK_VERSION without GIT info" OFF)
option(LEGACY_KDE_INTEGRATION "Install tomahawk.protocol file, deprecated since 4.6.0" OFF)
# generate version string # generate version string
@@ -55,9 +54,6 @@ SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" )
SET( CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" ) SET( CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" )
SET( CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" ) SET( CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" )
# make predefined install dirs available everywhere
INCLUDE(GNUInstallDirs)
# installer creation # installer creation
INCLUDE( TomahawkCPack.cmake ) INCLUDE( TomahawkCPack.cmake )
@@ -112,16 +108,7 @@ macro_optional_find_package(LibAttica)
macro_log_feature(LIBATTICA_FOUND "libattica" "Provides support for automatic fetching and managing of resolvers from the tomahawk website" "https://projects.kde.org/projects/kdesupport/attica" FALSE "" "") macro_log_feature(LIBATTICA_FOUND "libattica" "Provides support for automatic fetching and managing of resolvers from the tomahawk website" "https://projects.kde.org/projects/kdesupport/attica" FALSE "" "")
macro_optional_find_package(QuaZip) macro_optional_find_package(QuaZip)
macro_log_feature(QuaZip_FOUND "QuaZip" "Provides support for extracting downloaded resolvers automatically." "http://quazip.sourceforge.net/" FALSE "" "") macro_log_feature(QuaZip_FOUND "QuaZip" "Provides support for extracting downloaded resolvers autmatically. Will build internal copy instead." "http://quazip.sourceforge.net/" FALSE "" "")
macro_optional_find_package(Jreen)
macro_log_feature(LIBJREEN_FOUND "Jreen" "Qt XMPP Library" "https://github.com/euroelessar/jreen" FALSE "" "Jreen is needed for the Jabber SIP plugin.\n")
macro_optional_find_package(QTweetLib)
macro_log_feature(QTWEETLIB_FOUND "QTweetLib" "Qt Twitter Library" "https://github.com/minimoog/QTweetLib" FALSE "" "QTweetLib is needed for the Twitter SIP plugin.\n")
macro_optional_find_package(VSXu)
macro_log_feature(VSXU_FOUND "VSXu" "Vovoid VSXu Ultra" "https://www.vsxu.com" FALSE "" "VSXu is needed for some really cool music visualization.\n")
IF( NOT QuaZip_FOUND ) IF( NOT QuaZip_FOUND )
add_subdirectory( ${CMAKE_SOURCE_DIR}/src/libtomahawk/thirdparty/quazip ) add_subdirectory( ${CMAKE_SOURCE_DIR}/src/libtomahawk/thirdparty/quazip )
@@ -129,7 +116,6 @@ IF( NOT QuaZip_FOUND )
SET( QuaZip_LIBRARY quazip ) SET( QuaZip_LIBRARY quazip )
SET( QuaZip_LIBRARIES ${QuaZip_LIBRARY} ) SET( QuaZip_LIBRARIES ${QuaZip_LIBRARY} )
SET( QuaZip_FOUND true ) SET( QuaZip_FOUND true )
macro_log_feature(QuaZip_FOUND "QuaZip" "Provides support for extracting downloaded resolvers automatically. Building internal copy" "http://quazip.sourceforge.net/" FALSE "" "")
# copy headers to build/quazip so we can use proper includes inside the code # copy headers to build/quazip so we can use proper includes inside the code
FILE( COPY ${CMAKE_SOURCE_DIR}/src/libtomahawk/thirdparty/quazip/quazip/ DESTINATION ${CMAKE_BINARY_DIR}/libtomahawk/thirdparty/quazip ) FILE( COPY ${CMAKE_SOURCE_DIR}/src/libtomahawk/thirdparty/quazip/quazip/ DESTINATION ${CMAKE_BINARY_DIR}/libtomahawk/thirdparty/quazip )
@@ -142,17 +128,29 @@ ENDIF()
set(LIBLASTFM_FOUND true) set(LIBLASTFM_FOUND true)
#### submodules start #### submodules start
# automatically init submodules here, don't delete this code we may add submodules again
# this installs headers and such and should really be handled in a separate package by packagers # this installs headers and such and should really be handled in a separate package by packagers
IF( INTERNAL_JREEN )
IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.gitmodules)
EXECUTE_PROCESS(COMMAND git submodule init WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} )
EXECUTE_PROCESS(COMMAND git submodule update WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} )
ENDIF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.gitmodules)
ENDIF()
# IF( FALSE ) IF( INTERNAL_JREEN )
# IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.gitmodules) ADD_SUBDIRECTORY( ${THIRDPARTY_DIR}/jreen )
# EXECUTE_PROCESS(COMMAND git submodule init WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) SET( LIBJREEN_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/thirdparty/jreen/include )
# EXECUTE_PROCESS(COMMAND git submodule update WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) SET( LIBJREEN_LIBRARY jreen )
# ENDIF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.gitmodules) SET( LIBJREEN_LIBRARIES ${LIBJREEN_LIBRARY} )
# ENDIF() SET( LIBJREEN_FOUND true )
MESSAGE(STATUS "INTERNAL libjreen: ${LIBJREEN_INCLUDE_DIR}, ${LIBJREEN_LIBRARY}")
ELSE( INTERNAL_JREEN )
macro_optional_find_package(Jreen)
ENDIF( INTERNAL_JREEN )
macro_log_feature(LIBJREEN_FOUND "Jreen" "Qt XMPP Library" "https://github.com/euroelessar/jreen" FALSE "" "Jreen is needed for the Jabber SIP plugin. \n\n Use -DINTERNAL_JREEN=ON to build the git submodule inside Tomahawk \n Be aware this installs a full jreen with headers and everything!\n")
macro_optional_find_package(QTweetLib)
macro_log_feature(QTWEETLIB_FOUND "QTweetLib" "Qt Twitter Library" "https://github.com/minimoog/QTweetLib" FALSE "" "QTweetLib is needed for the Twitter SIP plugin.\n")
#### submodules end #### submodules end
### libportfwd ### libportfwd
@@ -213,9 +211,4 @@ ADD_SUBDIRECTORY( src/libtomahawk )
SET( TOMAHAWK_LIBRARIES tomahawklib ) SET( TOMAHAWK_LIBRARIES tomahawklib )
ADD_SUBDIRECTORY( src ) ADD_SUBDIRECTORY( src )
ADD_SUBDIRECTORY( admin ) ADD_SUBDIRECTORY( admin )
ADD_SUBDIRECTORY( src/breakpad/CrashReporter )
IF( BUILD_GUI )
IF( NOT DISABLE_CRASHREPORTER )
ADD_SUBDIRECTORY( src/breakpad/CrashReporter )
ENDIF()
ENDIF()

View File

@@ -2,7 +2,6 @@
# This module looks for clucene (http://clucene.sf.net) support # This module looks for clucene (http://clucene.sf.net) support
# It will define the following values # It will define the following values
# #
# CLUCENE_INCLUDE_DIRS = CLUCENE_INCLUDE_DIR + CLUCENE_LIBRARY_DIR
# CLUCENE_INCLUDE_DIR = where CLucene/StdHeader.h can be found # CLUCENE_INCLUDE_DIR = where CLucene/StdHeader.h can be found
# CLUCENE_LIBRARY_DIR = where CLucene/clucene-config.h can be found # CLUCENE_LIBRARY_DIR = where CLucene/clucene-config.h can be found
# CLUCENE_LIBRARIES = the libraries to link against CLucene # CLUCENE_LIBRARIES = the libraries to link against CLucene
@@ -18,7 +17,6 @@ FIND_PACKAGE(CLuceneUnstable)
IF(CLUCENEUNSTABLE_FOUND) IF(CLUCENEUNSTABLE_FOUND)
SET(CLucene_FOUND TRUE) SET(CLucene_FOUND TRUE)
SET(CLUCENE_INCLUDE_DIR ${CLUCENE_UNSTABLE_INCLUDE_DIRS}) SET(CLUCENE_INCLUDE_DIR ${CLUCENE_UNSTABLE_INCLUDE_DIRS})
SET(CLUCENE_INCLUDE_DIRS ${CLUCENE_INCLUDE_DIR})
SET(CLUCENE_LIBRARIES ${CLUCENE_UNSTABLE_LIBS}) SET(CLUCENE_LIBRARIES ${CLUCENE_UNSTABLE_LIBS})
#MESSAGE(FATAL_ERROR NARF) #MESSAGE(FATAL_ERROR NARF)
@@ -108,9 +106,7 @@ ENDIF (CLUCENE_LIBRARY_DIR)
IF(CLUCENE_INCLUDE_DIR AND CLUCENE_LIBRARIES AND CLUCENE_LIBRARY_DIR AND CLUCENE_GOOD_VERSION) IF(CLUCENE_INCLUDE_DIR AND CLUCENE_LIBRARIES AND CLUCENE_LIBRARY_DIR AND CLUCENE_GOOD_VERSION)
SET(CLucene_FOUND TRUE) SET(CLucene_FOUND TRUE)
SET(CLUCENE_INCLUDE_DIRS ${CLUCENE_LIBRARY_DIR} ${CLUCENE_INCLUDE_DIR})
ENDIF(CLUCENE_INCLUDE_DIR AND CLUCENE_LIBRARIES AND CLUCENE_LIBRARY_DIR AND CLUCENE_GOOD_VERSION) ENDIF(CLUCENE_INCLUDE_DIR AND CLUCENE_LIBRARIES AND CLUCENE_LIBRARY_DIR AND CLUCENE_GOOD_VERSION)
ENDIF(CLUCENEUNSTABLE_FOUND) ENDIF(CLUCENEUNSTABLE_FOUND)
IF(CLucene_FOUND) IF(CLucene_FOUND)
@@ -124,8 +120,7 @@ ELSE(CLucene_FOUND)
ENDIF(CLucene_FOUND) ENDIF(CLucene_FOUND)
MARK_AS_ADVANCED( MARK_AS_ADVANCED(
CLUCENE_INCLUDE_DIRS CLUCENE_INCLUDE_DIR
CLUCENE_INCLUDE_DIR CLUCENE_LIBRARY_DIR
CLUCENE_LIBRARY_DIR
CLUCENE_LIBRARIES CLUCENE_LIBRARIES
) )

View File

@@ -1,48 +0,0 @@
# Find VSXU - JSON handling library for Qt
#
# This module defines
# VSXU_FOUND - whether the qsjon library was found
# VSXU_LIBRARIES - the vsxu library
# VSXU_INCLUDE_DIRS - the include path of the vsxu library
#
if (VSXU_INCLUDE_DIRS AND VSXU_LIBRARIES)
# Already in cache
set (VSXU_FOUND TRUE)
else (VSXU_INCLUDE_DIRS AND VSXU_LIBRARIES)
if (NOT WIN32)
# use pkg-config to get the values of VSXU_INCLUDE_DIRS
# and VSXU_LIBRARY_DIRS to add as hints to the find commands.
include (FindPkgConfig)
pkg_check_modules (VSXU REQUIRED libvsxu)
endif (NOT WIN32)
find_library (VSXU_LIBRARIES
NAMES
libvsxu_engine
PATHS
${VSXU_LIBRARY_DIRS}
${LIB_INSTALL_DIR}
${KDE4_LIB_DIR}
)
find_path (VSXU_INCLUDE_DIRS
NAMES
vsxu_platform.h
PATHS
${VSXU_INCLUDE_DIRS}
${INCLUDE_INSTALL_DIR}
${KDE4_INCLUDE_DIR}
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(VSXu DEFAULT_MSG VSXU_LIBRARIES VSXU_INCLUDE_DIRS)
if ( UNIX AND NOT APPLE )
set ( VSXU_LIBRARIES "${VSXU_LIBRARIES} ${VSXU_LDFLAGS}" CACHE INTERNAL "")
endif ()
endif (VSXU_INCLUDE_DIRS AND VSXU_LIBRARIES)

View File

@@ -1,182 +0,0 @@
# - Define GNU standard installation directories
# Provides install directory variables as defined for GNU software:
# http://www.gnu.org/prep/standards/html_node/Directory-Variables.html
# Inclusion of this module defines the following variables:
# CMAKE_INSTALL_<dir> - destination for files of a given type
# CMAKE_INSTALL_FULL_<dir> - corresponding absolute path
# where <dir> is one of:
# BINDIR - user executables (bin)
# SBINDIR - system admin executables (sbin)
# LIBEXECDIR - program executables (libexec)
# SYSCONFDIR - read-only single-machine data (etc)
# SHAREDSTATEDIR - modifiable architecture-independent data (com)
# LOCALSTATEDIR - modifiable single-machine data (var)
# LIBDIR - object code libraries (lib or lib64)
# INCLUDEDIR - C header files (include)
# OLDINCLUDEDIR - C header files for non-gcc (/usr/include)
# DATAROOTDIR - read-only architecture-independent data root (share)
# DATADIR - read-only architecture-independent data (DATAROOTDIR)
# INFODIR - info documentation (DATAROOTDIR/info)
# LOCALEDIR - locale-dependent data (DATAROOTDIR/locale)
# MANDIR - man documentation (DATAROOTDIR/man)
# DOCDIR - documentation root (DATAROOTDIR/doc/PROJECT_NAME)
# Each CMAKE_INSTALL_<dir> value may be passed to the DESTINATION options of
# install() commands for the corresponding file type. If the includer does
# not define a value the above-shown default will be used and the value will
# appear in the cache for editing by the user.
# Each CMAKE_INSTALL_FULL_<dir> value contains an absolute path constructed
# from the corresponding destination by prepending (if necessary) the value
# of CMAKE_INSTALL_PREFIX.
#=============================================================================
# Copyright 2011 Nikita Krupen'ko <krnekit@gmail.com>
# Copyright 2011 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
# Installation directories
#
if(NOT DEFINED CMAKE_INSTALL_BINDIR)
set(CMAKE_INSTALL_BINDIR "bin" CACHE PATH "user executables (bin)")
endif()
if(NOT DEFINED CMAKE_INSTALL_SBINDIR)
set(CMAKE_INSTALL_SBINDIR "sbin" CACHE PATH "system admin executables (sbin)")
endif()
if(NOT DEFINED CMAKE_INSTALL_LIBEXECDIR)
set(CMAKE_INSTALL_LIBEXECDIR "libexec" CACHE PATH "program executables (libexec)")
endif()
if(NOT DEFINED CMAKE_INSTALL_SYSCONFDIR)
set(CMAKE_INSTALL_SYSCONFDIR "etc" CACHE PATH "read-only single-machine data (etc)")
endif()
if(NOT DEFINED CMAKE_INSTALL_SHAREDSTATEDIR)
set(CMAKE_INSTALL_SHAREDSTATEDIR "com" CACHE PATH "modifiable architecture-independent data (com)")
endif()
if(NOT DEFINED CMAKE_INSTALL_LOCALSTATEDIR)
set(CMAKE_INSTALL_LOCALSTATEDIR "var" CACHE PATH "modifiable single-machine data (var)")
endif()
if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
set(_LIBDIR_DEFAULT "lib")
# Override this default 'lib' with 'lib64' iff:
# - we are on Linux system but NOT cross-compiling
# - we are NOT on debian
# - we are on a 64 bits system
# reason is: amd64 ABI: http://www.x86-64.org/documentation/abi.pdf
# Note that the future of multi-arch handling may be even
# more complicated than that: http://wiki.debian.org/Multiarch
if(CMAKE_SYSTEM_NAME MATCHES "Linux"
AND NOT CMAKE_CROSSCOMPILING
AND NOT EXISTS "/etc/debian_version")
if(NOT DEFINED CMAKE_SIZEOF_VOID_P)
message(AUTHOR_WARNING
"Unable to determine default CMAKE_INSTALL_LIBDIR directory because no target architecture is known. "
"Please enable at least one language before including GNUInstallDirs.")
else()
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
set(_LIBDIR_DEFAULT "lib64")
endif()
endif()
endif()
set(CMAKE_INSTALL_LIBDIR "${_LIBDIR_DEFAULT}" CACHE PATH "object code libraries (${_LIBDIR_DEFAULT})")
endif()
if(NOT DEFINED CMAKE_INSTALL_INCLUDEDIR)
set(CMAKE_INSTALL_INCLUDEDIR "include" CACHE PATH "C header files (include)")
endif()
if(NOT DEFINED CMAKE_INSTALL_OLDINCLUDEDIR)
set(CMAKE_INSTALL_OLDINCLUDEDIR "/usr/include" CACHE PATH "C header files for non-gcc (/usr/include)")
endif()
if(NOT DEFINED CMAKE_INSTALL_DATAROOTDIR)
set(CMAKE_INSTALL_DATAROOTDIR "share" CACHE PATH "read-only architecture-independent data root (share)")
endif()
#-----------------------------------------------------------------------------
# Values whose defaults are relative to DATAROOTDIR. Store empty values in
# the cache and store the defaults in local variables if the cache values are
# not set explicitly. This auto-updates the defaults as DATAROOTDIR changes.
if(NOT CMAKE_INSTALL_DATADIR)
set(CMAKE_INSTALL_DATADIR "" CACHE PATH "read-only architecture-independent data (DATAROOTDIR)")
set(CMAKE_INSTALL_DATADIR "${CMAKE_INSTALL_DATAROOTDIR}")
endif()
if(NOT CMAKE_INSTALL_INFODIR)
set(CMAKE_INSTALL_INFODIR "" CACHE PATH "info documentation (DATAROOTDIR/info)")
set(CMAKE_INSTALL_INFODIR "${CMAKE_INSTALL_DATAROOTDIR}/info")
endif()
if(NOT CMAKE_INSTALL_LOCALEDIR)
set(CMAKE_INSTALL_LOCALEDIR "" CACHE PATH "locale-dependent data (DATAROOTDIR/locale)")
set(CMAKE_INSTALL_LOCALEDIR "${CMAKE_INSTALL_DATAROOTDIR}/locale")
endif()
if(NOT CMAKE_INSTALL_MANDIR)
set(CMAKE_INSTALL_MANDIR "" CACHE PATH "man documentation (DATAROOTDIR/man)")
set(CMAKE_INSTALL_MANDIR "${CMAKE_INSTALL_DATAROOTDIR}/man")
endif()
if(NOT CMAKE_INSTALL_DOCDIR)
set(CMAKE_INSTALL_DOCDIR "" CACHE PATH "documentation root (DATAROOTDIR/doc/PROJECT_NAME)")
set(CMAKE_INSTALL_DOCDIR "${CMAKE_INSTALL_DATAROOTDIR}/doc/${PROJECT_NAME}")
endif()
#-----------------------------------------------------------------------------
mark_as_advanced(
CMAKE_INSTALL_BINDIR
CMAKE_INSTALL_SBINDIR
CMAKE_INSTALL_LIBEXECDIR
CMAKE_INSTALL_SYSCONFDIR
CMAKE_INSTALL_SHAREDSTATEDIR
CMAKE_INSTALL_LOCALSTATEDIR
CMAKE_INSTALL_LIBDIR
CMAKE_INSTALL_INCLUDEDIR
CMAKE_INSTALL_OLDINCLUDEDIR
CMAKE_INSTALL_DATAROOTDIR
CMAKE_INSTALL_DATADIR
CMAKE_INSTALL_INFODIR
CMAKE_INSTALL_LOCALEDIR
CMAKE_INSTALL_MANDIR
CMAKE_INSTALL_DOCDIR
)
# Result directories
#
foreach(dir
BINDIR
SBINDIR
LIBEXECDIR
SYSCONFDIR
SHAREDSTATEDIR
LOCALSTATEDIR
LIBDIR
INCLUDEDIR
OLDINCLUDEDIR
DATAROOTDIR
DATADIR
INFODIR
LOCALEDIR
MANDIR
DOCDIR
)
if(NOT IS_ABSOLUTE ${CMAKE_INSTALL_${dir}})
set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_${dir}}")
else()
set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_${dir}}")
endif()
endforeach()

View File

@@ -273,7 +273,7 @@ Section "Tomahawk Player" SEC_TOMAHAWK_PLAYER
;Main executable. ;Main executable.
File "${INSTALL_PATH}\bin\tomahawk.exe" File "${INSTALL_PATH}\bin\tomahawk.exe"
File "${INSTALL_PATH}\bin\tomahawk_crash_reporter.exe" File "${INSTALL_PATH}\bin\CrashReporter.exe"
File "${INSTALL_PATH}\bin\libtomahawk_breakpad.dll" File "${INSTALL_PATH}\bin\libtomahawk_breakpad.dll"
File "${INSTALL_PATH}\bin\libqxtweb-standalone.dll" File "${INSTALL_PATH}\bin\libqxtweb-standalone.dll"
@@ -287,7 +287,7 @@ Section "Tomahawk Player" SEC_TOMAHAWK_PLAYER
;Main executable. ;Main executable.
File "${BUILD_PATH}\tomahawk.exe" File "${BUILD_PATH}\tomahawk.exe"
File "${BUILD_PATH}\tomahawk_crash_reporter.exe" File "${BUILD_PATH}\CrashReporter.exe"
File "${BUILD_PATH}\libtomahawk_breakpad.dll" File "${BUILD_PATH}\libtomahawk_breakpad.dll"
File "${BUILD_PATH}\libtomahawklib.dll" File "${BUILD_PATH}\libtomahawklib.dll"
@@ -329,6 +329,12 @@ Section "Tomahawk Player" SEC_TOMAHAWK_PLAYER
File "${MING_BIN}\libstdc++-6.dll" File "${MING_BIN}\libstdc++-6.dll"
;Phonon stuff ;Phonon stuff
;Fix the phonon build to not use Dbus
File "${QT_DLL_PATH}\QtDbus4.dll"
File "${MING_BIN}\libdbus-1-3.dll"
File "${MING_BIN}\dbus-daemon.exe"
File "${VLC_BIN}\libphonon.dll" File "${VLC_BIN}\libphonon.dll"
SetOutPath "$INSTDIR\phonon_backend" SetOutPath "$INSTDIR\phonon_backend"
File "${VLC_BIN}\phonon_backend\phonon_vlc.dll" File "${VLC_BIN}\phonon_backend\phonon_vlc.dll"
@@ -341,6 +347,12 @@ Section "Tomahawk Player" SEC_TOMAHAWK_PLAYER
SetOutPath "$INSTDIR\plugins" SetOutPath "$INSTDIR\plugins"
File /r "${VLC_PLUGIN_PATH}\*.dll" File /r "${VLC_PLUGIN_PATH}\*.dll"
SetOutPath "$INSTDIR" SetOutPath "$INSTDIR"
File "${MING_BIN}\libmad-0.dll" ; MP3
File "${MING_BIN}\libFLAC-8.dll" ; FLAC
File "${MING_BIN}\libogg-0.dll" ; OGG, FLAC
File "${MING_BIN}\libvorbis-0.dll" ; OGG
File "${MING_BIN}\libvorbisenc-2.dll" ; OGG
; Other ; Other
File "${MING_BIN}\libqjson.dll" File "${MING_BIN}\libqjson.dll"
@@ -455,8 +467,7 @@ Section -post
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tomahawk" "NoRepair" "1" WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tomahawk" "NoRepair" "1"
; Register tomahawk:// protocol handler ; Register tomahawk:// protocol handler
WriteRegStr HKCR "tomahawk" "" "URL:Tomahawk Protocol" WriteRegStr HKCR "tomahawk" "" "URL: Tomahawk Protocol"
WriteRegStr HKCR "tomahawk" "URL Protocol" ""
WriteRegStr HKCR "tomahawk\DefaultIcon" "" $INSTDIR\tomahawk.exe,1 WriteRegStr HKCR "tomahawk\DefaultIcon" "" $INSTDIR\tomahawk.exe,1
WriteRegStr HKCR "tomahawk\shell" "" "open" WriteRegStr HKCR "tomahawk\shell" "" "open"
WriteRegStr HKCR "tomahawk\shell\open\command" "" '"$INSTDIR\tomahawk.exe" "%1"' WriteRegStr HKCR "tomahawk\shell\open\command" "" '"$INSTDIR\tomahawk.exe" "%1"'

View File

@@ -1,40 +1,3 @@
Version 0.3.3:
* Automatically load Super Collection tracks when no official release
information is available.
* Fixed stations not fetching new tracks under certain circumstances.
* Fixed Footnotes not always updating when selecting a new track.
* Added support for ow.ly, fb.me, itun.es and tinyurl.com URL shorteners.
* Fixed playback issues with non-latin filenames on Windows.
* Fixed tomahawk:// protocol not working properly on Windows.
* Fixed dupe menu entry appearing on OS X.
* Fixed invisible sidebar items on Linux.
Version 0.3.2:
* Improved syncing process, it's faster and more reliable now.
* Fixed UPnP issues.
* Fixed not updating collections and views after a collection changes.
* Fixed not showing a source's proper name at all times.
* Improved music scanner reliability.
* Fixed various labels not being painted in the right color when selected.
* Support .oga (ogg mimetype) files.
* Fixed stuck Now Playing indicator icon.
* Fixed sidebar width of settings dialog on Windows.
* Fixed not always showing delete icon on hovered temporary pages.
* Fixed inability to select externally mounted drives.
* Fixed bug where speaker would be stuck next to a playlist.
* Fixed bug where first startup would show a loading spinner in the
Dashboard's "Recent Additions" forever.
* Automatically upgrade resolvers when an update is found.
* Fixed last played track of a friend never expiring.
* Fixed parsing of rdio tracks.
* Changed steering mechanism in stations to be user-friendlier.
* Fixed loading biographies of artist names with special characters.
* Fixed behaviour of dropping Spotify playlists on the sidebar.
* Fixed hard to read source-name in the audio control area on OS X.
* Fixed crashes when playing Grooveshark tracks.
* Fixed bug where clicking the latch button would flicker and unlatch.
* Fixed Jabber accounts not connecting properly when proxy is in use.
Version 0.3.1: Version 0.3.1:
* Fixed not resolving to local files. * Fixed not resolving to local files.
* Fixed shutdown crash on Windows. * Fixed shutdown crash on Windows.
@@ -63,7 +26,7 @@ Version 0.3.0:
* Added YouTube resolver. * Added YouTube resolver.
* Fixed bug where going offline then online would not re-connect to many * Fixed bug where going offline then online would not re-connect to many
peers. peers.
* Added support for auto-updating live XSPF playlists. * Added support for auto-updating live XSPF playlists.
* Don't show an age of 41 years for tracks that have no age information. * Don't show an age of 41 years for tracks that have no age information.
* Show config UI for resolvers that have them as soon as you add them. * Show config UI for resolvers that have them as soon as you add them.
* Add support for Echo Nest Personal Catalogs and User Radio. Synchronize * Add support for Echo Nest Personal Catalogs and User Radio. Synchronize
@@ -79,7 +42,7 @@ Version 0.3.0:
* Added new job status view in the bottom of the source list that displays * Added new job status view in the bottom of the source list that displays
current jobs such as resolving, parsing playlists, and loading from current jobs such as resolving, parsing playlists, and loading from
database. database.
* Parse and convert a Spotify playlist URL when dropped anywhere on the * Parse and convert a Spotify playlist url when dropped anywhere on the
sidebar. sidebar.
* Convert resolvers to use asynchronous calls to avoid blocking Tomahawk's * Convert resolvers to use asynchronous calls to avoid blocking Tomahawk's
UI, greatly increasing responsiveness of Tomahawk while resolving. UI, greatly increasing responsiveness of Tomahawk while resolving.

2
README
View File

@@ -39,7 +39,7 @@ Dependencies
The following dependencies are optional, but recommended: The following dependencies are optional, but recommended:
Attica 0.2.0 - ftp://ftp.kde.org/pub/kde/stable/attica/ Attica 0.2.0 - ftp://ftp.kde.org/pub/kde/stable/attica/
Jreen 1.0.1 - https://github.com/euroelessar/jreen jreen (Git) - https://github.com/euroelessar/jreen
QTweetLib 0.3.0 - https://github.com/minimoog/QTweetLib QTweetLib 0.3.0 - https://github.com/minimoog/QTweetLib
Third party libraries that we ship with our source: Third party libraries that we ship with our source:

View File

@@ -250,7 +250,7 @@ frameworks_dir = os.path.join(bundle_dir, 'Contents', 'Frameworks')
commands.append(['mkdir', '-p', frameworks_dir]) commands.append(['mkdir', '-p', frameworks_dir])
resources_dir = os.path.join(bundle_dir, 'Contents', 'Resources') resources_dir = os.path.join(bundle_dir, 'Contents', 'Resources')
commands.append(['mkdir', '-p', resources_dir]) commands.append(['mkdir', '-p', resources_dir])
plugins_dir = os.path.join(bundle_dir, 'Contents', 'plugins') plugins_dir = os.path.join(bundle_dir, 'Contents', 'PlugIns')
binary = os.path.join(bundle_dir, 'Contents', 'MacOS', bundle_name) binary = os.path.join(bundle_dir, 'Contents', 'MacOS', bundle_name)
fixed_libraries = [] fixed_libraries = []
@@ -502,9 +502,9 @@ except:
print 'Failed to find spotify resolver' print 'Failed to find spotify resolver'
try: try:
FixPlugin('tomahawk_crash_reporter', '../MacOS') FixPlugin('CrashReporter', '../MacOS')
except: except:
print 'Failed to find tomahawk_crash_reporter' print 'Failed to find CrashReporter'
for plugin in QT_PLUGINS: for plugin in QT_PLUGINS:
FixPlugin(FindQtPlugin(plugin), os.path.dirname(plugin)) FixPlugin(FindQtPlugin(plugin), os.path.dirname(plugin))

View File

@@ -4,9 +4,8 @@ Version=1.0
Name=Tomahawk Name=Tomahawk
GenericName=Music Player GenericName=Music Player
TryExec=tomahawk TryExec=tomahawk
Exec=tomahawk %u Exec=tomahawk
Comment=Tomahawk - Social Music Player Comment=Tomahawk - Social Music Player
Icon=tomahawk Icon=tomahawk
Terminal=false Terminal=false
Categories=Qt;AudioVideo;Audio;Player; Categories=Qt;AudioVideo;Audio;Player;
MimeType=x-scheme-handler/tomahawk;

View File

@@ -1,31 +1,22 @@
#!/bin/bash #!/bin/bash
mkdir -p vlc/
if [ "$1" = "-c" ] ; then
echo "Continuing last download.."
rm -rvf vlc/prefix/
else
echo "Remove old vlc dir..." echo "Remove old vlc dir..."
rm -rvf vlc/*
fi
mkdir -p vlc/
cd vlc/ cd vlc/
echo "Download phonon archive..." #rm -vf vlc-*.7z
#rm -rf vlc/
echo "Download specified binary..."
#wget -c "http://downloads.sourceforge.net/project/vlc/1.1.9/win32/vlc-1.1.9-win32.7z?r=http%3A%2F%2Fwww.videolan.org%2Fvlc%2Fdownload-windows.html&ts=1306272584&use_mirror=leaseweb" #wget -c "http://downloads.sourceforge.net/project/vlc/1.1.9/win32/vlc-1.1.9-win32.7z?r=http%3A%2F%2Fwww.videolan.org%2Fvlc%2Fdownload-windows.html&ts=1306272584&use_mirror=leaseweb"
#wget -c "http://download.tomahawk-player.org/tomahawk-vlc-0.1.zip" #wget -c "http://download.tomahawk-player.org/tomahawk-vlc-0.1.zip"
#wget -c http://people.videolan.org/~jb/phonon/phonon-vlc-last.7z wget -c http://people.videolan.org/~jb/phonon/phonon-vlc-last.7z
wget -c http://people.videolan.org/~jb/phonon/phonon_phonon-vlc_20111128.7z
echo "Extract binary..." echo "Extract binary..."
7z x phonon*.7z 7z x phonon-vlc-last.7z
#mv -v vlc-*/ vlc/ #mv -v vlc-*/ vlc/
#unzip tomahawk-vlc-0.1.zip #unzip tomahawk-vlc-0.1.zip
echo "Download phonon_vlc_no_video.dll..."
wget -c http://people.videolan.org/~jb/phonon/phonon_vlc_no_video.dll
cp -v phonon_vlc_no_video.dll prefix/bin/phonon_backend/phonon_vlc.dll
echo "Strip unneeded plugins from vlc/plugins..." echo "Strip unneeded plugins from vlc/plugins..."
cd prefix/bin/plugins cd prefix/bin/plugins
rm -rvf libold* libvcd* libdvd* liblibass* libx264* libschroe* liblibmpeg2* \ rm -rvf libold* libvcd* libdvd* liblibass* libx264* libschroe* liblibmpeg2* \

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -2,7 +2,7 @@
// if run in phantomjs add fake Tomahawk environment // if run in phantomjs add fake Tomahawk environment
if(window.Tomahawk === undefined) if(window.Tomahawk === undefined)
{ {
// alert("PHANTOMJS ENVIRONMENT"); alert("PHANTOMJS ENVIRONMENT");
var Tomahawk = { var Tomahawk = {
fakeEnv: function() fakeEnv: function()
{ {

View File

@@ -1,4 +1,4 @@
-- Script to migate from db version 26 to 27 -- Script to migate from db version 6 to 27
-- Nothing to do -- Nothing to do
CREATE TABLE IF NOT EXISTS collection_attributes ( CREATE TABLE IF NOT EXISTS collection_attributes (

View File

@@ -1,7 +0,0 @@
-- Script to migate from db version 27 to 28.
-- Added albumartist and discnumber to file_join
ALTER TABLE file_join ADD COLUMN composer INTEGER REFERENCES artist(id) ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED;
ALTER TABLE file_join ADD COLUMN discnumber INTEGER;
UPDATE settings SET v = '28' WHERE k == 'schema_version';

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,9 +1,5 @@
<!DOCTYPE RCC><RCC version="1.0"> <!DOCTYPE RCC><RCC version="1.0">
<qresource prefix="/lang"> <qresource prefix="/lang">
<file>tomahawk_en.qm</file>
<file>tomahawk_de.qm</file> <file>tomahawk_de.qm</file>
<file>tomahawk_sv.qm</file>
<file>tomahawk_es.qm</file>
<file>tomahawk_pt_BR.qm</file>
</qresource> </qresource>
</RCC> </RCC>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -98,7 +98,6 @@
<file>data/images/track-icon-22x22.png</file> <file>data/images/track-icon-22x22.png</file>
<file>data/images/track-icon-32x32.png</file> <file>data/images/track-icon-32x32.png</file>
<file>data/images/track-icon-16x16.png</file> <file>data/images/track-icon-16x16.png</file>
<file>data/images/apply-check.png</file>
<file>data/stylesheets/topbar-radiobuttons.css</file> <file>data/stylesheets/topbar-radiobuttons.css</file>
<file>data/icons/tomahawk-icon-16x16.png</file> <file>data/icons/tomahawk-icon-16x16.png</file>
<file>data/icons/tomahawk-icon-32x32.png</file> <file>data/icons/tomahawk-icon-32x32.png</file>
@@ -128,11 +127,8 @@
<file>data/images/headphones.png</file> <file>data/images/headphones.png</file>
<file>data/images/headphones-off.png</file> <file>data/images/headphones-off.png</file>
<file>data/images/headphones-sidebar.png</file> <file>data/images/headphones-sidebar.png</file>
<file>data/images/closed-padlock.png</file>
<file>data/images/open-padlock.png</file>
<file>data/images/headphones-bigger.png</file> <file>data/images/headphones-bigger.png</file>
<file>data/images/no-album-no-case.png</file> <file>data/images/no-album-no-case.png</file>
<file>data/images/rdio.png</file> <file>data/images/rdio.png</file>
<file>data/sql/dbmigrate-27_to_28.sql</file>
</qresource> </qresource>
</RCC> </RCC>

View File

@@ -2,9 +2,9 @@ FILE( GLOB _icons "${CMAKE_SOURCE_DIR}/data/icons/tomahawk-icon-*.png" )
FOREACH( _file ${_icons} ) FOREACH( _file ${_icons} )
STRING( REPLACE "${CMAKE_SOURCE_DIR}/data/icons/tomahawk-icon-" "" _res ${_file} ) STRING( REPLACE "${CMAKE_SOURCE_DIR}/data/icons/tomahawk-icon-" "" _res ${_file} )
STRING( REPLACE ".png" "" _res ${_res} ) STRING( REPLACE ".png" "" _res ${_res} )
INSTALL( FILES ${_file} RENAME tomahawk.png DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/${_res}/apps ) INSTALL( FILES ${_file} RENAME tomahawk.png DESTINATION share/icons/hicolor/${_res}/apps )
ENDFOREACH( _file ) ENDFOREACH( _file )
INSTALL( FILES ${CMAKE_SOURCE_DIR}/data/icons/tomahawk-icon.svg RENAME tomahawk.svg DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/scalable/apps ) INSTALL( FILES ${CMAKE_SOURCE_DIR}/data/icons/tomahawk-icon.svg RENAME tomahawk.svg DESTINATION share/icons/hicolor/scalable/apps )
INSTALL( FILES ${CMAKE_SOURCE_DIR}/admin/unix/tomahawk.desktop DESTINATION ${CMAKE_INSTALL_DATADIR}/applications ) INSTALL( FILES ${CMAKE_SOURCE_DIR}/admin/unix/tomahawk.desktop DESTINATION share/applications )

View File

@@ -13,8 +13,6 @@ SET( QT_USE_QTNETWORK TRUE )
SET( QT_USE_QTXML TRUE ) SET( QT_USE_QTXML TRUE )
SET( QT_USE_QTWEBKIT TRUE ) SET( QT_USE_QTWEBKIT TRUE )
add_definitions( -DQT_SHAREDPOINTER_TRACK_POINTERS )
INCLUDE( ${QT_USE_FILE} ) INCLUDE( ${QT_USE_FILE} )
INCLUDE( AddAppIconMacro ) INCLUDE( AddAppIconMacro )
@@ -60,13 +58,11 @@ SET( tomahawkSourcesGui ${tomahawkSourcesGui}
sourcetree/sourcedelegate.cpp sourcetree/sourcedelegate.cpp
sourcetree/animationhelper.cpp sourcetree/animationhelper.cpp
sourcetree/items/sourcetreeitem.cpp sourcetree/items/sourcetreeitem.cpp
sourcetree/items/sourceitem.cpp sourcetree/items/collectionitem.cpp
sourcetree/items/playlistitems.cpp sourcetree/items/playlistitems.cpp
sourcetree/items/categoryitems.cpp sourcetree/items/categoryitems.cpp
sourcetree/items/genericpageitems.cpp sourcetree/items/genericpageitems.cpp
sourcetree/items/temporarypageitem.cpp sourcetree/items/temporarypageitem.cpp
sourcetree/items/groupitem.cpp
sourcetree/items/historyitem.cpp
breakpad/BreakPad.cpp breakpad/BreakPad.cpp
@@ -101,8 +97,8 @@ IF(LIBLASTFM_FOUND)
ENDIF(LIBLASTFM_FOUND) ENDIF(LIBLASTFM_FOUND)
IF(LIBATTICA_FOUND) IF(LIBATTICA_FOUND)
SET( tomahawkSourcesGui ${tomahawkSourcesGui} GetNewStuffDialog.cpp GetNewStuffDelegate.cpp GetNewStuffModel.cpp ) SET( tomahawkSources ${tomahawkSources} GetNewStuffDialog.cpp GetNewStuffDelegate.cpp GetNewStuffModel.cpp )
SET( tomahawkHeadersGui ${tomahawkHeadersGui} GetNewStuffDialog.h GetNewStuffDelegate.h GetNewStuffModel.h ) SET( tomahawkHeaders ${tomahawkHeaders} GetNewStuffDialog.h GetNewStuffDelegate.h GetNewStuffModel.h )
INCLUDE_DIRECTORIES( ${LIBATTICA_INCLUDE_DIR} ) INCLUDE_DIRECTORIES( ${LIBATTICA_INCLUDE_DIR} )
ENDIF(LIBATTICA_FOUND) ENDIF(LIBATTICA_FOUND)
@@ -114,13 +110,11 @@ SET( tomahawkHeadersGui ${tomahawkHeadersGui}
sourcetree/sourcedelegate.h sourcetree/sourcedelegate.h
sourcetree/animationhelper.h sourcetree/animationhelper.h
sourcetree/items/sourcetreeitem.h sourcetree/items/sourcetreeitem.h
sourcetree/items/sourceitem.h sourcetree/items/collectionitem.h
sourcetree/items/playlistitems.h sourcetree/items/playlistitems.h
sourcetree/items/categoryitems.h sourcetree/items/categoryitems.h
sourcetree/items/genericpageitems.h sourcetree/items/genericpageitems.h
sourcetree/items/temporarypageitem.h sourcetree/items/temporarypageitem.h
sourcetree/items/groupitem.h
sourcetree/items/historyitem.h
tomahawktrayicon.h tomahawktrayicon.h
audiocontrols.h audiocontrols.h
@@ -178,10 +172,10 @@ INCLUDE_DIRECTORIES(
SET( OS_SPECIFIC_LINK_LIBRARIES "" ) SET( OS_SPECIFIC_LINK_LIBRARIES "" )
IF( WIN32 ) IF( WIN32 )
INCLUDE( "CMakeLists.win32.cmake" ) INCLUDE( "CMakeLists.win32.txt" )
ENDIF( WIN32 ) ENDIF( WIN32 )
IF( UNIX ) IF( UNIX )
INCLUDE( "CMakeLists.unix.cmake" ) INCLUDE( "CMakeLists.unix.txt" )
ENDIF( UNIX ) ENDIF( UNIX )
IF( APPLE ) IF( APPLE )
@@ -206,7 +200,10 @@ IF(QCA2_FOUND)
INCLUDE_DIRECTORIES( ${QCA2_INCLUDE_DIR} ) INCLUDE_DIRECTORIES( ${QCA2_INCLUDE_DIR} )
ENDIF(QCA2_FOUND) ENDIF(QCA2_FOUND)
INCLUDE(GNUInstallDirs) kde4_add_app_icon( tomahawkSources "${CMAKE_SOURCE_DIR}/data/icons/tomahawk-icon-*.png" )
qt4_add_resources( RC_SRCS "../resources.qrc" )
qt4_wrap_cpp( tomahawkMoc ${tomahawkHeaders} )
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
${CMAKE_CURRENT_BINARY_DIR}/config.h) ${CMAKE_CURRENT_BINARY_DIR}/config.h)
@@ -214,17 +211,13 @@ include( ${CMAKE_SOURCE_DIR}/lang/translations.cmake )
SET( final_src ${final_src} ${tomahawkMoc} ${tomahawkSources} ${tomahawkHeaders} ${trans_outfile}) SET( final_src ${final_src} ${tomahawkMoc} ${tomahawkSources} ${tomahawkHeaders} ${trans_outfile})
IF( BUILD_GUI ) IF( "${gui}" STREQUAL "no" )
LIST(APPEND tomahawkHeaders ${tomahawkHeadersGui}) ELSE()
LIST(APPEND tomahawkSources ${tomahawkSourcesGui})
qt4_wrap_ui( tomahawkUI_H ${tomahawkUI} ) qt4_wrap_ui( tomahawkUI_H ${tomahawkUI} )
qt4_wrap_cpp( tomahawkMocGui ${tomahawkHeadersGui} )
SET( final_src ${final_src} ${tomahawkUI_H} ${tomahawkMocGui} ${tomahawkSourcesGui} ${RC_SRCS} )
ENDIF() ENDIF()
kde4_add_app_icon( tomahawkSources "${CMAKE_SOURCE_DIR}/data/icons/tomahawk-icon-*.png" )
qt4_add_resources( RC_SRCS "../resources.qrc" )
qt4_wrap_cpp( tomahawkMoc ${tomahawkHeaders} )
SET( final_src ${final_src} ${tomahawkUI_H} ${tomahawkMoc} ${tomahawkSources} ${RC_SRCS} )
IF( UNIX AND NOT APPLE ) IF( UNIX AND NOT APPLE )
ADD_EXECUTABLE( tomahawk ${final_src} ) ADD_EXECUTABLE( tomahawk ${final_src} )
ENDIF( UNIX AND NOT APPLE ) ENDIF( UNIX AND NOT APPLE )
@@ -272,12 +265,12 @@ IF( APPLE )
ENDIF(HAVE_SPARKLE) ENDIF(HAVE_SPARKLE)
ENDIF( APPLE ) ENDIF( APPLE )
INSTALL( TARGETS tomahawk BUNDLE DESTINATION . RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) INSTALL( TARGETS tomahawk BUNDLE DESTINATION . RUNTIME DESTINATION bin )
IF( UNIX AND NOT APPLE AND KDE4_INSTALLED AND LEGACY_KDE_INTEGRATION ) #install protocol file IF( UNIX AND NOT APPLE AND KDE4_INSTALLED ) #install protocol file
FILE( READ ${CMAKE_SOURCE_DIR}/admin/unix/tomahawk.protocol protocol ) FILE( READ ${CMAKE_SOURCE_DIR}/admin/unix/tomahawk.protocol protocol )
STRING( REPLACE "/path/to/binary" # match this STRING( REPLACE "/path/to/binary" # match this
"${CMAKE_INSTALL_FULL_BINDIR}/tomahawk" # this is linux (kde) so pretty safe I think "${CMAKE_INSTALL_PREFIX}/bin/tomahawk" # this is linux (kde) so pretty safe I think
edited_protocol # save in this variable edited_protocol # save in this variable
"${protocol}" # from the contents of this var "${protocol}" # from the contents of this var
) )
@@ -285,7 +278,7 @@ IF( UNIX AND NOT APPLE AND KDE4_INSTALLED AND LEGACY_KDE_INTEGRATION ) #install
IF( ${SERVICES_INSTALL_DIR} ) IF( ${SERVICES_INSTALL_DIR} )
SET( PROTOCOL_INSTALL_DIR ${SERVICES_INSTALL_DIR} ) SET( PROTOCOL_INSTALL_DIR ${SERVICES_INSTALL_DIR} )
ELSE() ELSE()
SET( PROTOCOL_INSTALL_DIR "${CMAKE_INSTALL_FULL_DATADIR}/kde4/services" ) SET( PROTOCOL_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share/kde4/services" )
ENDIF() ENDIF()
INSTALL( FILES ${CMAKE_BINARY_DIR}/tomahawk.protocol DESTINATION ${PROTOCOL_INSTALL_DIR} ) INSTALL( FILES ${CMAKE_BINARY_DIR}/tomahawk.protocol DESTINATION ${PROTOCOL_INSTALL_DIR} )
ENDIF() ENDIF()

View File

@@ -7,9 +7,9 @@ ADD_DEFINITIONS( -fPIC )
SET( QXTWEB_LIBRARIES qxtweb-standalone ) SET( QXTWEB_LIBRARIES qxtweb-standalone )
IF( APPLE ) IF( APPLE )
INCLUDE( "CMakeLists.osx.cmake" ) INCLUDE( "CMakeLists.osx.txt" )
ENDIF( APPLE ) ENDIF( APPLE )
IF( UNIX AND NOT APPLE ) IF( UNIX AND NOT APPLE )
INCLUDE( "CMakeLists.linux.cmake" ) INCLUDE( "CMakeLists.linux.txt" )
ENDIF( UNIX AND NOT APPLE ) ENDIF( UNIX AND NOT APPLE )

View File

@@ -22,7 +22,7 @@
#include "GetNewStuffDelegate.h" #include "GetNewStuffDelegate.h"
#include "GetNewStuffModel.h" #include "GetNewStuffModel.h"
GetNewStuffDialog::GetNewStuffDialog( QWidget* parent, Qt::WindowFlags f ) GetNewStuffDialog::GetNewStuffDialog( QWidget *parent, Qt::WindowFlags f )
: QDialog( parent, f ) : QDialog( parent, f )
, ui( new Ui::GetNewStuffDialog ) , ui( new Ui::GetNewStuffDialog )
, m_model( new GetNewStuffModel( this ) ) , m_model( new GetNewStuffModel( this ) )
@@ -37,16 +37,15 @@ GetNewStuffDialog::GetNewStuffDialog( QWidget* parent, Qt::WindowFlags f )
ui->listView->setMouseTracking( true ); ui->listView->setMouseTracking( true );
setMinimumSize( 560, 350 );
#ifdef Q_WS_MAC #ifdef Q_WS_MAC
setMaximumSize( 560, 350 ); setMinimumSize( 510, 350 );
setMaximumSize( 510, 350 );
setSizeGripEnabled( false ); setSizeGripEnabled( false );
ui->listView->setAttribute( Qt::WA_MacShowFocusRect, false ); ui->listView->setAttribute( Qt::WA_MacShowFocusRect, false );
#endif #endif
}
}
GetNewStuffDialog::~GetNewStuffDialog() GetNewStuffDialog::~GetNewStuffDialog()
{ {

View File

@@ -34,6 +34,9 @@ LoadXSPFDialog::LoadXSPFDialog( QWidget* parent, Qt::WindowFlags f )
m_ui->verticalLayout->setSpacing( 0 ); m_ui->verticalLayout->setSpacing( 0 );
#endif #endif
connect( m_ui->buttonBox, SIGNAL( accepted() ), SLOT( accept() ) );
connect( m_ui->buttonBox, SIGNAL( rejected() ), SLOT( reject() ) );
connect( m_ui->navigateButton, SIGNAL( clicked( bool ) ), this, SLOT( getLocalFile() ) ); connect( m_ui->navigateButton, SIGNAL( clicked( bool ) ), this, SLOT( getLocalFile() ) );
} }
@@ -44,7 +47,7 @@ LoadXSPFDialog::~LoadXSPFDialog()
void void
LoadXSPFDialog::getLocalFile() LoadXSPFDialog::getLocalFile()
{ {
QString url = QFileDialog::getOpenFileName( this, tr( "Load XSPF File" ), QDir::homePath(), tr( "XSPF Files (*.xspf)" ) ); QString url = QFileDialog::getOpenFileName( this, tr( "Load XSPF File" ), QDir::homePath(), ".xspf" );
m_ui->lineEdit->setText( url ); m_ui->lineEdit->setText( url );
} }

View File

@@ -19,13 +19,14 @@
#include "audiocontrols.h" #include "audiocontrols.h"
#include "ui_audiocontrols.h" #include "ui_audiocontrols.h"
#include <QtNetwork/QNetworkReply> #include <QNetworkReply>
#include <QtGui/QDropEvent> #include <QDropEvent>
#include <QtGui/QMouseEvent> #include <QMouseEvent>
#include "audio/audioengine.h" #include "audio/audioengine.h"
#include "playlist/playlistview.h" #include "playlist/playlistview.h"
#include "database/database.h" #include "database/database.h"
#include "database/databasecommand_socialaction.h"
#include "widgets/imagebutton.h" #include "widgets/imagebutton.h"
#include "utils/tomahawkutils.h" #include "utils/tomahawkutils.h"
#include "utils/logger.h" #include "utils/logger.h"
@@ -36,13 +37,14 @@
using namespace Tomahawk; using namespace Tomahawk;
static QString s_acInfoIdentifier = QString( "AUDIOCONTROLS" );
AudioControls::AudioControls( QWidget* parent ) AudioControls::AudioControls( QWidget* parent )
: QWidget( parent ) : QWidget( parent )
, ui( new Ui::AudioControls ) , ui( new Ui::AudioControls )
, m_repeatMode( PlaylistInterface::NoRepeat ) , m_repeatMode( PlaylistInterface::NoRepeat )
, m_shuffled( false ) , m_shuffled( false )
, m_lastSliderCheck( 0 )
{ {
ui->setupUi( this ); ui->setupUi( this );
setAcceptDrops( true ); setAcceptDrops( true );
@@ -84,25 +86,16 @@ AudioControls::AudioControls( QWidget* parent )
ui->loveButton->setPixmap( RESPATH "images/not-loved.png" ); ui->loveButton->setPixmap( RESPATH "images/not-loved.png" );
ui->loveButton->setCheckable( true ); ui->loveButton->setCheckable( true );
#ifdef Q_WS_MAC
ui->ownerLabel->setForegroundRole( QPalette::Text );
#else
ui->ownerLabel->setForegroundRole( QPalette::Dark ); ui->ownerLabel->setForegroundRole( QPalette::Dark );
#endif
ui->metaDataArea->setStyleSheet( "QWidget#metaDataArea {\nborder-width: 4px;\nborder-image: url(" RESPATH "images/now-playing-panel.png) 4 4 4 4 stretch stretch; }" ); ui->metaDataArea->setStyleSheet( "QWidget#metaDataArea {\nborder-width: 4px;\nborder-image: url(" RESPATH "images/now-playing-panel.png) 4 4 4 4 stretch stretch; }" );
ui->seekSlider->setEnabled( true ); ui->seekSlider->setEnabled( true );
ui->volumeSlider->setRange( 0, 100 ); ui->volumeSlider->setRange( 0, 100 );
ui->volumeSlider->setValue( AudioEngine::instance()->volume() ); ui->volumeSlider->setValue( AudioEngine::instance()->volume() );
m_phononTickCheckTimer.setSingleShot( true );
m_sliderTimeLine.setCurveShape( QTimeLine::LinearCurve ); m_sliderTimeLine.setCurveShape( QTimeLine::LinearCurve );
ui->seekSlider->setTimeLine( &m_sliderTimeLine ); ui->seekSlider->setTimeLine( &m_sliderTimeLine );
m_defaultCover = QPixmap( RESPATH "images/no-album-no-case.png" ).scaled( ui->coverImage->size(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation );
connect( &m_phononTickCheckTimer, SIGNAL( timeout() ), SLOT( phononTickCheckTimeout() ) );
connect( &m_sliderTimeLine, SIGNAL( frameChanged( int ) ), ui->seekSlider, SLOT( setValue( int ) ) ); connect( &m_sliderTimeLine, SIGNAL( frameChanged( int ) ), ui->seekSlider, SLOT( setValue( int ) ) );
connect( ui->seekSlider, SIGNAL( valueChanged( int ) ), AudioEngine::instance(), SLOT( seek( int ) ) ); connect( ui->seekSlider, SIGNAL( valueChanged( int ) ), AudioEngine::instance(), SLOT( seek( int ) ) );
@@ -114,8 +107,8 @@ AudioControls::AudioControls( QWidget* parent )
connect( ui->volumeLowButton, SIGNAL( clicked() ), AudioEngine::instance(), SLOT( lowerVolume() ) ); connect( ui->volumeLowButton, SIGNAL( clicked() ), AudioEngine::instance(), SLOT( lowerVolume() ) );
connect( ui->volumeHighButton, SIGNAL( clicked() ), AudioEngine::instance(), SLOT( raiseVolume() ) ); connect( ui->volumeHighButton, SIGNAL( clicked() ), AudioEngine::instance(), SLOT( raiseVolume() ) );
connect( ui->playPauseButton, SIGNAL( clicked() ), SIGNAL( playPressed() ) ); connect( ui->playPauseButton, SIGNAL( clicked() ), this, SIGNAL( playPressed() ) );
connect( ui->pauseButton, SIGNAL( clicked() ), SIGNAL( pausePressed() ) ); connect( ui->pauseButton, SIGNAL( clicked() ), this, SIGNAL( pausePressed() ) );
connect( ui->repeatButton, SIGNAL( clicked() ), SLOT( onRepeatClicked() ) ); connect( ui->repeatButton, SIGNAL( clicked() ), SLOT( onRepeatClicked() ) );
connect( ui->shuffleButton, SIGNAL( clicked() ), SLOT( onShuffleClicked() ) ); connect( ui->shuffleButton, SIGNAL( clicked() ), SLOT( onShuffleClicked() ) );
@@ -135,6 +128,15 @@ AudioControls::AudioControls( QWidget* parent )
connect( AudioEngine::instance(), SIGNAL( timerMilliSeconds( qint64 ) ), SLOT( onPlaybackTimer( qint64 ) ) ); connect( AudioEngine::instance(), SIGNAL( timerMilliSeconds( qint64 ) ), SLOT( onPlaybackTimer( qint64 ) ) );
connect( AudioEngine::instance(), SIGNAL( volumeChanged( int ) ), SLOT( onVolumeChanged( int ) ) ); connect( AudioEngine::instance(), SIGNAL( volumeChanged( int ) ), SLOT( onVolumeChanged( int ) ) );
m_defaultCover = QPixmap( RESPATH "images/no-album-no-case.png" )
.scaled( ui->coverImage->size(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation );
connect( Tomahawk::InfoSystem::InfoSystem::instance(),
SIGNAL( info( Tomahawk::InfoSystem::InfoRequestData, QVariant ) ),
SLOT( infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData, QVariant ) ) );
connect( Tomahawk::InfoSystem::InfoSystem::instance(), SIGNAL( finished( QString ) ), SLOT( infoSystemFinished( QString ) ) );
ui->buttonAreaLayout->setSpacing( 0 ); ui->buttonAreaLayout->setSpacing( 0 );
ui->stackedLayout->setSpacing( 0 ); ui->stackedLayout->setSpacing( 0 );
ui->stackedLayout->setContentsMargins( 0, 0, 0, 0 ); ui->stackedLayout->setContentsMargins( 0, 0, 0, 0 );
@@ -169,13 +171,6 @@ AudioControls::changeEvent( QEvent* e )
} }
void
AudioControls::phononTickCheckTimeout()
{
onPlaybackTimer( m_lastSliderCheck );
}
void void
AudioControls::onVolumeChanged( int volume ) AudioControls::onVolumeChanged( int volume )
{ {
@@ -188,6 +183,8 @@ AudioControls::onVolumeChanged( int volume )
void void
AudioControls::onPlaybackStarted( const Tomahawk::result_ptr& result ) AudioControls::onPlaybackStarted( const Tomahawk::result_ptr& result )
{ {
tDebug( LOGEXTRA ) << Q_FUNC_INFO;
if ( result.isNull() ) if ( result.isNull() )
return; return;
@@ -202,8 +199,6 @@ AudioControls::onPlaybackStarted( const Tomahawk::result_ptr& result )
ui->seekSlider->setRange( 0, duration ); ui->seekSlider->setRange( 0, duration );
ui->seekSlider->setValue( 0 ); ui->seekSlider->setValue( 0 );
m_phononTickCheckTimer.stop();
m_sliderTimeLine.stop(); m_sliderTimeLine.stop();
m_sliderTimeLine.setDuration( duration ); m_sliderTimeLine.setDuration( duration );
m_sliderTimeLine.setFrameRange( 0, duration ); m_sliderTimeLine.setFrameRange( 0, duration );
@@ -212,92 +207,105 @@ AudioControls::onPlaybackStarted( const Tomahawk::result_ptr& result )
ui->seekSlider->setVisible( true ); ui->seekSlider->setVisible( true );
m_noTimeChange = false; Tomahawk::InfoSystem::InfoStringHash trackInfo;
m_lastSliderCheck = 0; trackInfo["artist"] = result->artist()->name();
trackInfo["album"] = result->album()->name();
Tomahawk::InfoSystem::InfoRequestData requestData;
requestData.caller = s_acInfoIdentifier;
requestData.type = Tomahawk::InfoSystem::InfoAlbumCoverArt;
requestData.input = QVariant::fromValue< Tomahawk::InfoSystem::InfoStringHash >( trackInfo );
requestData.customData = QVariantMap();
Tomahawk::InfoSystem::InfoSystem::instance()->getInfo( requestData );
}
void
AudioControls::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output )
{
if ( requestData.caller != s_acInfoIdentifier || requestData.type != Tomahawk::InfoSystem::InfoAlbumCoverArt )
{
return;
}
if ( m_currentTrack.isNull() )
{
tLog() << "Current track is null when trying to apply fetched cover art";
return;
}
if ( !output.canConvert< QVariantMap >() )
{
tDebug( LOGINFO ) << "Cannot convert fetched art from a QByteArray";
return;
}
QVariantMap returnedData = output.value< QVariantMap >();
const QByteArray ba = returnedData["imgbytes"].toByteArray();
if ( ba.length() )
{
QPixmap pm;
pm.loadFromData( ba );
if ( pm.isNull() )
ui->coverImage->setPixmap( m_defaultCover );
else
ui->coverImage->setPixmap( pm.scaled( ui->coverImage->size(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation ) );
}
}
void
AudioControls::infoSystemFinished( QString target )
{
Q_UNUSED( target );
} }
void void
AudioControls::onPlaybackLoading( const Tomahawk::result_ptr& result ) AudioControls::onPlaybackLoading( const Tomahawk::result_ptr& result )
{ {
if ( !m_currentTrack.isNull() ) tDebug( LOGEXTRA ) << Q_FUNC_INFO;
{
disconnect( m_currentTrack->album().data(), SIGNAL( updated() ), this, SLOT( onAlbumCoverUpdated() ) );
disconnect( m_currentTrack->toQuery().data(), SIGNAL( socialActionsLoaded() ), this, SLOT( onSocialActionsLoaded() ) );
}
m_currentTrack = result; m_currentTrack = result;
connect( m_currentTrack->album().data(), SIGNAL( updated() ), SLOT( onAlbumCoverUpdated() ) );
connect( m_currentTrack->toQuery().data(), SIGNAL( socialActionsLoaded() ), SLOT( onSocialActionsLoaded() ) );
ui->artistTrackLabel->setResult( result ); ui->artistTrackLabel->setResult( result );
ui->albumLabel->setResult( result ); ui->albumLabel->setResult( result );
ui->ownerLabel->setText( result->friendlySource() ); ui->ownerLabel->setText( result->friendlySource() );
ui->coverImage->setPixmap( m_defaultCover );
const QString duration = TomahawkUtils::timeToString( result.data()->duration() );
ui->timeLabel->setFixedWidth( ui->timeLabel->fontMetrics().width( QString( duration.length(), QChar( '0' ) ) ) );
ui->timeLabel->setText( TomahawkUtils::timeToString( 0 ) ); ui->timeLabel->setText( TomahawkUtils::timeToString( 0 ) );
ui->timeLeftLabel->setFixedWidth( ui->timeLeftLabel->fontMetrics().width( QString( duration.length() + 1, QChar( '0' ) ) ) ); ui->timeLeftLabel->setText( "-" + TomahawkUtils::timeToString( result.data()->duration() ) );
ui->timeLeftLabel->setText( "-" + duration );
ui->stackedLayout->setCurrentWidget( ui->pauseButton ); ui->stackedLayout->setCurrentWidget( ui->pauseButton );
ui->loveButton->setEnabled( true ); ui->loveButton->setEnabled( true );
ui->loveButton->setVisible( true ); ui->loveButton->setVisible( true );
setAlbumCover(); result->loadSocialActions();
setSocialActions();
connect( result.data(), SIGNAL( socialActionsLoaded() ), this, SLOT( socialActionsLoaded() ) );
} }
void void
AudioControls::onAlbumCoverUpdated() AudioControls::socialActionsLoaded()
{ {
Album* album = qobject_cast< Album* >( sender() ); Result* r = qobject_cast< Result* >( sender() );
if ( !album || album != m_currentTrack->album().data() ) Q_ASSERT( r );
return;
setAlbumCover(); if ( m_currentTrack.data() == r )
}
void
AudioControls::setAlbumCover()
{
if ( !m_currentTrack->album()->cover().isNull() )
{ {
QPixmap cover; if ( m_currentTrack->loved() )
cover.loadFromData( m_currentTrack->album()->cover() ); {
ui->coverImage->setPixmap( cover.scaled( ui->coverImage->size(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation ) ); ui->loveButton->setPixmap( RESPATH "images/loved.png" );
} ui->loveButton->setChecked( true );
else }
ui->coverImage->setPixmap( m_defaultCover ); else
} {
ui->loveButton->setPixmap( RESPATH "images/not-loved.png" );
ui->loveButton->setChecked( false );
void }
AudioControls::onSocialActionsLoaded()
{
Query* query = qobject_cast< Query* >( sender() );
if ( !query || query != m_currentTrack->toQuery().data() )
return;
setSocialActions();
}
void
AudioControls::setSocialActions()
{
if ( m_currentTrack->toQuery()->loved() )
{
ui->loveButton->setPixmap( RESPATH "images/loved.png" );
ui->loveButton->setChecked( true );
}
else
{
ui->loveButton->setPixmap( RESPATH "images/not-loved.png" );
ui->loveButton->setChecked( false );
} }
} }
@@ -310,7 +318,6 @@ AudioControls::onPlaybackPaused()
m_sliderTimeLine.setPaused( true ); m_sliderTimeLine.setPaused( true );
} }
void void
AudioControls::onPlaybackResumed() AudioControls::onPlaybackResumed()
{ {
@@ -327,7 +334,6 @@ AudioControls::onPlaybackSeeked( qint64 msec )
tDebug( LOGEXTRA ) << Q_FUNC_INFO << " setting current timer to " << msec; tDebug( LOGEXTRA ) << Q_FUNC_INFO << " setting current timer to " << msec;
m_sliderTimeLine.setPaused( true ); m_sliderTimeLine.setPaused( true );
m_sliderTimeLine.setCurrentTime( msec ); m_sliderTimeLine.setCurrentTime( msec );
m_lastSliderCheck = msec;
m_seekMsecs = msec; m_seekMsecs = msec;
} }
@@ -357,54 +363,28 @@ AudioControls::onPlaybackStopped()
void void
AudioControls::onPlaybackTimer( qint64 msElapsed ) AudioControls::onPlaybackTimer( qint64 msElapsed )
{ {
//tDebug( LOGEXTRA ) << Q_FUNC_INFO << "msElapsed =" << msElapsed << "and timer current time =" << m_sliderTimeLine.currentTime() << "and m_seekMsecs =" << m_seekMsecs; //tDebug( LOGEXTRA ) << Q_FUNC_INFO << " msElapsed = " << msElapsed << " and timer current time = " << m_sliderTimeLine.currentTime() << " and m_seekMsecs = " << m_seekMsecs;
if ( msElapsed > 0 && msElapsed != m_lastSliderCheck && m_seekMsecs == -1 && msElapsed - 500 < m_lastSliderCheck )
return;
m_lastSliderCheck = msElapsed;
if ( m_currentTrack.isNull() ) if ( m_currentTrack.isNull() )
{
m_sliderTimeLine.stop();
return; return;
}
ui->seekSlider->blockSignals( true ); ui->seekSlider->blockSignals( true );
if ( sender() != &m_phononTickCheckTimer )
m_phononTickCheckTimer.start( 1000 );
const int seconds = msElapsed / 1000; const int seconds = msElapsed / 1000;
ui->timeLabel->setText( TomahawkUtils::timeToString( seconds ) ); ui->timeLabel->setText( TomahawkUtils::timeToString( seconds ) );
ui->timeLeftLabel->setText( "-" + TomahawkUtils::timeToString( m_currentTrack->duration() - seconds ) ); ui->timeLeftLabel->setText( "-" + TomahawkUtils::timeToString( m_currentTrack->duration() - seconds ) );
if ( m_noTimeChange ) if ( m_sliderTimeLine.currentTime() > msElapsed || m_seekMsecs != -1 )
{
if ( m_sliderTimeLine.currentTime() != msElapsed )
{
m_sliderTimeLine.setPaused( true );
m_noTimeChange = false;
m_sliderTimeLine.setCurrentTime( msElapsed );
m_seekMsecs = -1;
m_sliderTimeLine.resume();
}
}
else if ( m_sliderTimeLine.currentTime() >= msElapsed || m_seekMsecs != -1 )
{ {
m_sliderTimeLine.setPaused( true ); m_sliderTimeLine.setPaused( true );
m_noTimeChange = false;
if ( m_sliderTimeLine.currentTime() == msElapsed )
m_noTimeChange = true;
m_sliderTimeLine.setCurrentTime( msElapsed ); m_sliderTimeLine.setCurrentTime( msElapsed );
m_seekMsecs = -1; m_seekMsecs = -1;
if ( AudioEngine::instance()->state() != AudioEngine::Paused && sender() != &m_phononTickCheckTimer ) if ( AudioEngine::instance()->state() != AudioEngine::Paused )
m_sliderTimeLine.resume(); m_sliderTimeLine.resume();
} }
else if ( m_sliderTimeLine.duration() > msElapsed && m_sliderTimeLine.state() == QTimeLine::NotRunning && AudioEngine::instance()->state() == AudioEngine::Playing ) else if ( m_sliderTimeLine.duration() > msElapsed && m_sliderTimeLine.state() == QTimeLine::NotRunning )
{ {
ui->seekSlider->setEnabled( AudioEngine::instance()->canSeek() ); ui->seekSlider->setEnabled( AudioEngine::instance()->canSeek() );
m_sliderTimeLine.start(); m_sliderTimeLine.resume();
} }
else if ( m_sliderTimeLine.state() == QTimeLine::Paused && AudioEngine::instance()->state() != AudioEngine::Paused ) else if ( m_sliderTimeLine.state() == QTimeLine::Paused && AudioEngine::instance()->state() != AudioEngine::Paused )
{ {
@@ -587,17 +567,30 @@ AudioControls::droppedTracks( QList< query_ptr > tracks )
void void
AudioControls::onLoveButtonClicked( bool checked ) AudioControls::onLoveButtonClicked( bool checked )
{ {
Tomahawk::InfoSystem::InfoStringHash trackInfo;
trackInfo["title"] = m_currentTrack->track();
trackInfo["artist"] = m_currentTrack->artist()->name();
trackInfo["album"] = m_currentTrack->album()->name();
if ( checked ) if ( checked )
{ {
ui->loveButton->setPixmap( RESPATH "images/loved.png" ); Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo(
s_acInfoIdentifier, Tomahawk::InfoSystem::InfoLove,
QVariant::fromValue< Tomahawk::InfoSystem::InfoStringHash >( trackInfo ) );
m_currentTrack->toQuery()->setLoved( true ); DatabaseCommand_SocialAction* cmd = new DatabaseCommand_SocialAction( m_currentTrack, QString( "Love" ), QString( "true") );
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>(cmd) );
ui->loveButton->setPixmap( RESPATH "images/loved.png" );
} }
else else
{ {
ui->loveButton->setPixmap( RESPATH "images/not-loved.png" ); Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo(
s_acInfoIdentifier, Tomahawk::InfoSystem::InfoUnLove,
QVariant::fromValue< Tomahawk::InfoSystem::InfoStringHash >( trackInfo ) );
m_currentTrack->toQuery()->setLoved( false ); DatabaseCommand_SocialAction* cmd = new DatabaseCommand_SocialAction( m_currentTrack, QString( "Love" ), QString( "false" ) );
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>(cmd) );
ui->loveButton->setPixmap( RESPATH "images/not-loved.png" );
} }
} }

View File

@@ -19,12 +19,12 @@
#ifndef AUDIOCONTROLS_H #ifndef AUDIOCONTROLS_H
#define AUDIOCONTROLS_H #define AUDIOCONTROLS_H
#include <QtGui/QWidget> #include <QWidget>
#include <QtCore/QTimer> #include <QTimeLine>
#include <QtCore/QTimeLine>
#include "result.h" #include "result.h"
#include "playlistinterface.h" #include "playlistinterface.h"
#include "infosystem/infosystem.h"
#include "query.h" #include "query.h"
class QDropEvent; class QDropEvent;
@@ -51,7 +51,7 @@ signals:
public slots: public slots:
void onRepeatModeChanged( Tomahawk::PlaylistInterface::RepeatMode mode ); void onRepeatModeChanged( Tomahawk::PlaylistInterface::RepeatMode mode );
void onShuffleModeChanged( bool enabled ); void onShuffleModeChanged( bool enabled );
protected: protected:
void changeEvent( QEvent* e ); void changeEvent( QEvent* e );
void dragEnterEvent ( QDragEnterEvent* ); void dragEnterEvent ( QDragEnterEvent* );
@@ -59,8 +59,6 @@ protected:
void dropEvent ( QDropEvent* ); void dropEvent ( QDropEvent* );
private slots: private slots:
void phononTickCheckTimeout();
void onPlaybackStarted( const Tomahawk::result_ptr& result ); void onPlaybackStarted( const Tomahawk::result_ptr& result );
void onPlaybackLoading( const Tomahawk::result_ptr& result ); void onPlaybackLoading( const Tomahawk::result_ptr& result );
void onPlaybackPaused(); void onPlaybackPaused();
@@ -79,16 +77,14 @@ private slots:
void onTrackClicked(); void onTrackClicked();
void onLoveButtonClicked( bool ); void onLoveButtonClicked( bool );
void onAlbumCoverUpdated(); void infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output );
void infoSystemFinished( QString target );
void droppedTracks( QList<Tomahawk::query_ptr> ); void droppedTracks( QList<Tomahawk::query_ptr> );
void onSocialActionsLoaded(); void socialActionsLoaded();
private: private:
void setAlbumCover();
void setSocialActions();
Ui::AudioControls *ui; Ui::AudioControls *ui;
QPixmap m_defaultCover; QPixmap m_defaultCover;
@@ -97,11 +93,8 @@ private:
Tomahawk::PlaylistInterface::RepeatMode m_repeatMode; Tomahawk::PlaylistInterface::RepeatMode m_repeatMode;
bool m_shuffled; bool m_shuffled;
QTimer m_phononTickCheckTimer;
QTimeLine m_sliderTimeLine; QTimeLine m_sliderTimeLine;
qint64 m_seekMsecs; qint64 m_seekMsecs;
qint64 m_lastSliderCheck;
bool m_noTimeChange;
}; };
#endif // AUDIOCONTROLS_H #endif // AUDIOCONTROLS_H

View File

@@ -28,6 +28,9 @@
<height>80</height> <height>80</height>
</size> </size>
</property> </property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_4"> <layout class="QHBoxLayout" name="horizontalLayout_4">
<property name="topMargin"> <property name="topMargin">
<number>0</number> <number>0</number>
@@ -161,6 +164,9 @@
<height>58</height> <height>58</height>
</size> </size>
</property> </property>
<property name="text">
<string>TextLabel</string>
</property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignCenter</set> <set>Qt::AlignCenter</set>
</property> </property>
@@ -345,9 +351,6 @@
<property name="text"> <property name="text">
<string>Time</string> <string>Time</string>
</property> </property>
<property name="alignment">
<set>Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@@ -374,9 +377,6 @@
<property name="text"> <property name="text">
<string>Time Left</string> <string>Time Left</string>
</property> </property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignVCenter</set>
</property>
</widget> </widget>
</item> </item>
</layout> </layout>

View File

@@ -18,17 +18,11 @@
#include "BreakPad.h" #include "BreakPad.h"
#include "config.h"
#include "utils/logger.h"
#include <QCoreApplication> #include <QCoreApplication>
#include <QString> #include <QString>
#include <QFileInfo>
#include <string.h> #include <string.h>
#define CRASH_REPORTER_BINARY "tomahawk_crash_reporter" #define CRASH_REPORTER_BINARY "CrashReporter"
bool s_active = true;
#ifndef WIN32 #ifndef WIN32
#include <unistd.h> #include <unistd.h>
@@ -44,10 +38,8 @@ LaunchUploader( const char* dump_dir, const char* minidump_id, void* that, bool
return false; return false;
const char* crashReporter = static_cast<BreakPad*>(that)->crashReporter(); const char* crashReporter = static_cast<BreakPad*>(that)->crashReporter();
if ( !s_active || strlen( crashReporter ) == 0 )
return false;
pid_t pid = fork(); pid_t pid = fork();
if ( pid == -1 ) // fork failed if ( pid == -1 ) // fork failed
return false; return false;
if ( pid == 0 ) if ( pid == 0 )
@@ -71,25 +63,14 @@ LaunchUploader( const char* dump_dir, const char* minidump_id, void* that, bool
} }
BreakPad::BreakPad( const QString& path, bool active ) BreakPad::BreakPad( const QString& path )
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX
: google_breakpad::ExceptionHandler( path.toStdString(), 0, LaunchUploader, this, true ) : google_breakpad::ExceptionHandler( path.toStdString(), 0, LaunchUploader, this, true )
#else #else
: google_breakpad::ExceptionHandler( path.toStdString(), 0, LaunchUploader, this, true, 0 ) : google_breakpad::ExceptionHandler( path.toStdString(), 0, LaunchUploader, this, true, 0 )
#endif #endif
{ {
s_active = active; QString reporter = QString( "%1/%2" ).arg( qApp->applicationDirPath() ).arg( CRASH_REPORTER_BINARY );
QString reporter;
QString localReporter = QString( "%1/%2" ).arg( qApp->applicationDirPath() ).arg( CRASH_REPORTER_BINARY );
QString globalReporter = QString( "%1/%2" ).arg( CMAKE_INSTALL_FULL_LIBEXECDIR ).arg( CRASH_REPORTER_BINARY );
if ( QFileInfo( localReporter ).exists() )
reporter = localReporter;
else if ( QFileInfo( globalReporter ).exists() )
reporter = globalReporter;
else
tLog() << "Could not find \"" CRASH_REPORTER_BINARY "\" in \"" CMAKE_INSTALL_FULL_LIBEXECDIR "\" or application path";
char* creporter; char* creporter;
std::string sreporter = reporter.toStdString(); std::string sreporter = reporter.toStdString();
@@ -145,7 +126,7 @@ LaunchUploader( const wchar_t* dump_dir, const wchar_t* minidump_id, void* that,
si.wShowWindow = SW_SHOWNORMAL; si.wShowWindow = SW_SHOWNORMAL;
ZeroMemory( &pi, sizeof(pi) ); ZeroMemory( &pi, sizeof(pi) );
if ( CreateProcess( NULL, command, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi ) ) if (CreateProcess( NULL, command, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi))
{ {
CloseHandle( pi.hProcess ); CloseHandle( pi.hProcess );
CloseHandle( pi.hThread ); CloseHandle( pi.hThread );
@@ -156,24 +137,9 @@ LaunchUploader( const wchar_t* dump_dir, const wchar_t* minidump_id, void* that,
} }
BreakPad::BreakPad( const QString& path, bool active ) BreakPad::BreakPad( const QString& path )
: google_breakpad::ExceptionHandler( path.toStdWString(), 0, LaunchUploader, this, true ) : google_breakpad::ExceptionHandler( path.toStdWString(), 0, LaunchUploader, this, true )
{ {
s_active = active;
} }
#endif // WIN32 #endif // WIN32
void
BreakPad::setActive( bool enabled )
{
s_active = enabled;
}
bool
BreakPad::isActive()
{
return s_active;
}

View File

@@ -32,14 +32,11 @@ class BreakPad : public google_breakpad::ExceptionHandler
const char* m_crashReporter; // again, const char[] const char* m_crashReporter; // again, const char[]
public: public:
BreakPad( const QString& dump_write_dirpath, bool active ); BreakPad( const QString &dump_write_dirpath );
~BreakPad() ~BreakPad()
{} {}
static void setActive( bool enabled );
static bool isActive();
void setProductName( const char* s ) { m_productName = s; }; void setProductName( const char* s ) { m_productName = s; };
const char* productName() const { return m_productName; } const char* productName() const { return m_productName; }

View File

@@ -1,10 +1,8 @@
PROJECT( CrashReporter ) PROJECT( CrashReporter )
FIND_PACKAGE( Qt4 REQUIRED ) FIND_PACKAGE( Qt4 REQUIRED )
SET( QT_USE_QTNETWORK TRUE ) SET( QT_USE_QTNETWORK TRUE )
SET( crashreporter_SOURCES main.cpp CrashReporter.cpp ) SET( crashreporter_SOURCES main.cpp CrashReporter.cpp )
SET( crashreporter_HEADERS CrashReporter.h ) SET( crashreporter_HEADERS CrashReporter.h )
SET( crashreporter_UI CrashReporter.ui ) SET( crashreporter_UI CrashReporter.ui )
@@ -18,8 +16,5 @@ INCLUDE( ${QT_USE_FILE} )
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/src ../../libtomahawk ) INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/src ../../libtomahawk )
ADD_DEFINITIONS( ${QT_DEFINITIONS} ) ADD_DEFINITIONS( ${QT_DEFINITIONS} )
ADD_EXECUTABLE( tomahawk_crash_reporter WIN32 ${crashreporter_SOURCES} ${crashreporter_HEADERS_MOC} ${crashreporter_UI_HEADERS} ${crashreporter_RC_RCC} ) ADD_EXECUTABLE( CrashReporter WIN32 ${crashreporter_SOURCES} ${crashreporter_HEADERS_MOC} ${crashreporter_UI_HEADERS} ${crashreporter_RC_RCC} )
TARGET_LINK_LIBRARIES( tomahawk_crash_reporter ${QT_LIBRARIES} tomahawklib ) TARGET_LINK_LIBRARIES( CrashReporter ${QT_LIBRARIES} tomahawklib )
INCLUDE(GNUInstallDirs)
install(TARGETS tomahawk_crash_reporter RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_LIBEXECDIR})

View File

@@ -9,7 +9,7 @@
#cmakedefine DEBUG_BUILD #cmakedefine DEBUG_BUILD
#define CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" #define CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}"
#define CMAKE_INSTALL_FULL_LIBEXECDIR "${CMAKE_INSTALL_FULL_LIBEXECDIR}" #define CMAKE_INSTALL_LIBEXECDIR "${CMAKE_INSTALL_LIBEXECDIR}"
#define CMAKE_SYSTEM "${CMAKE_SYSTEM}" #define CMAKE_SYSTEM "${CMAKE_SYSTEM}"
#cmakedefine LION #cmakedefine LION

View File

@@ -1,6 +1,6 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> === /* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
* *
* Copyright 2010-2011, Leo Franchi <lfranchi@kde.org> * Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* *
* Tomahawk is free software: you can redistribute it and/or modify * Tomahawk is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -52,8 +52,7 @@ public:
setMinimumSize( sizeHint() ); setMinimumSize( sizeHint() );
setMaximumSize( sizeHint() ); // to remove the resize grip on osx this is the only way setMaximumSize( sizeHint() ); // to remove the resize grip on osx this is the only way
if( conf->metaObject()->indexOfSignal( "sizeHintChanged()" ) > -1 ) connect( conf, SIGNAL( sizeHintChanged() ), this, SLOT( updateSizeHint() ) );
connect( conf, SIGNAL( sizeHintChanged() ), this, SLOT( updateSizeHint() ) );
#else #else
m_widget->setVisible( true ); m_widget->setVisible( true );
#endif #endif

View File

@@ -22,7 +22,7 @@
#ifdef ENABLE_HEADLESS #ifdef ENABLE_HEADLESS
#define TOMAHAWK_APPLICATION QCoreApplication #define TOMAHAWK_APPLICATION QCoreApplication
#include <QCoreApplication> #include <QApplication>
#else #else

View File

@@ -19,7 +19,7 @@
#include "AtticaManager.h" #include "AtticaManager.h"
#include "utils/tomahawkutils.h" #include "utils/tomahawkutils.h"
#include "TomahawkSettingsGui.h" #include "tomahawksettings.h"
#include "pipeline.h" #include "pipeline.h"
#include <attica/downloaditem.h> #include <attica/downloaditem.h>
@@ -44,9 +44,7 @@ AtticaManager::AtticaManager( QObject* parent )
connect( &m_manager, SIGNAL( providerAdded( Attica::Provider ) ), this, SLOT( providerAdded( Attica::Provider ) ) ); connect( &m_manager, SIGNAL( providerAdded( Attica::Provider ) ), this, SLOT( providerAdded( Attica::Provider ) ) );
// resolvers // resolvers
m_manager.addProviderFile( QUrl( "http://bakery.tomahawk-player.org/resolvers/providers.xml" ) ); m_manager.addProviderFile( QUrl( "http://bakery.tomahawk-player.org:10480/resolvers/providers.xml" ) );
qRegisterMetaType< Attica::Content >( "Attica::Content" );
} }
@@ -151,7 +149,6 @@ AtticaManager::pathFromId( const QString& resolverId ) const
return m_resolverStates.value( resolverId ).scriptPath; return m_resolverStates.value( resolverId ).scriptPath;
} }
void void
AtticaManager::uploadRating( const Content& c ) AtticaManager::uploadRating( const Content& c )
{ {
@@ -168,7 +165,7 @@ AtticaManager::uploadRating( const Content& c )
} }
} }
TomahawkSettingsGui::instanceGui()->setAtticaResolverStates( m_resolverStates ); TomahawkSettings::instance()->setAtticaResolverStates( m_resolverStates );
PostJob* job = m_resolverProvider.voteForContent( c.id(), (uint)c.rating() ); PostJob* job = m_resolverProvider.voteForContent( c.id(), (uint)c.rating() );
connect( job, SIGNAL( finished( Attica::BaseJob* ) ), job, SLOT( deleteLater() ) ); connect( job, SIGNAL( finished( Attica::BaseJob* ) ), job, SLOT( deleteLater() ) );
@@ -178,7 +175,6 @@ AtticaManager::uploadRating( const Content& c )
emit resolverStateChanged( c.id() ); emit resolverStateChanged( c.id() );
} }
bool bool
AtticaManager::userHasRated( const Content& c ) const AtticaManager::userHasRated( const Content& c ) const
{ {
@@ -206,7 +202,7 @@ AtticaManager::resolversList( BaseJob* j )
ListJob< Content >* job = static_cast< ListJob< Content >* >( j ); ListJob< Content >* job = static_cast< ListJob< Content >* >( j );
m_resolvers = job->itemList(); m_resolvers = job->itemList();
m_resolverStates = TomahawkSettingsGui::instanceGui()->atticaResolverStates(); m_resolverStates = TomahawkSettings::instance()->atticaResolverStates();
// load icon cache from disk, and fetch any we are missing // load icon cache from disk, and fetch any we are missing
loadPixmapsFromCache(); loadPixmapsFromCache();
@@ -249,7 +245,6 @@ AtticaManager::resolverIconFetched()
m_resolverStates[ resolverId ].pixmap = icon; m_resolverStates[ resolverId ].pixmap = icon;
} }
void void
AtticaManager::syncServerData() AtticaManager::syncServerData()
{ {
@@ -276,16 +271,62 @@ AtticaManager::syncServerData()
if ( ( r.state == Installed || r.state == NeedsUpgrade ) && if ( ( r.state == Installed || r.state == NeedsUpgrade ) &&
!upstream.version().isEmpty() ) !upstream.version().isEmpty() )
{ {
if ( TomahawkUtils::newerVersion( r.version, upstream.version() ) ) if ( newerVersion( r.version, upstream.version() ) )
{ {
m_resolverStates[ id ].state = NeedsUpgrade; m_resolverStates[ id ].state = NeedsUpgrade;
QMetaObject::invokeMethod( this, "upgradeResolver", Qt::QueuedConnection, Q_ARG( Attica::Content, upstream ) );
} }
} }
} }
} }
} }
bool
AtticaManager::newerVersion( const QString& older, const QString& newer ) const
{
// Dumb version comparison. Expects two strings, X.Y and Z.V. Returns true if Z > v || Z == V && V > Y
// DOES NOT support X.Y.Z version strings
if ( older.isEmpty() || newer.isEmpty() )
return false;
QPair<int, int> oldVer, newVer;
QStringList parts = older.split( "." );
if ( parts.size() == 1 )
{
oldVer.first = parts[ 0 ].toInt();
oldVer.second = 0;
}
else if ( parts.size() == 2 )
{
oldVer.first = parts[ 0 ].toInt();
oldVer.second = parts[ 1 ].toInt();;
}
else
return false;
parts = newer.split( "." );
if ( parts.size() == 1 )
{
newVer.first = parts[ 0 ].toInt();
newVer.second = 0;
}
else if ( parts.size() == 2 )
{
newVer.first = parts[ 0 ].toInt();
newVer.second = parts[ 1 ].toInt();;
}
else
return false;
// Do the comparison
if ( newVer.first > oldVer.first )
return true;
if ( newVer.first == oldVer.first &&
newVer.second > oldVer.second )
return true;
return false;
}
void void
AtticaManager::installResolver( const Content& resolver ) AtticaManager::installResolver( const Content& resolver )
@@ -306,7 +347,6 @@ AtticaManager::installResolver( const Content& resolver )
job->start(); job->start();
} }
void void
AtticaManager::upgradeResolver( const Content& resolver ) AtticaManager::upgradeResolver( const Content& resolver )
{ {
@@ -375,7 +415,7 @@ AtticaManager::payloadFetched()
// Do the install / add to tomahawk // Do the install / add to tomahawk
Tomahawk::Pipeline::instance()->addScriptResolver( resolverPath, true ); Tomahawk::Pipeline::instance()->addScriptResolver( resolverPath, true );
m_resolverStates[ resolverId ].state = Installed; m_resolverStates[ resolverId ].state = Installed;
TomahawkSettingsGui::instanceGui()->setAtticaResolverStates( m_resolverStates ); TomahawkSettings::instance()->setAtticaResolverStates( m_resolverStates );
emit resolverInstalled( resolverId ); emit resolverInstalled( resolverId );
emit resolverStateChanged( resolverId ); emit resolverStateChanged( resolverId );
} }
@@ -471,7 +511,7 @@ AtticaManager::uninstallResolver( const QString& pathToResolver )
if ( resolver.id() == atticaId ) // this is the one if ( resolver.id() == atticaId ) // this is the one
{ {
m_resolverStates[ atticaId ].state = Uninstalled; m_resolverStates[ atticaId ].state = Uninstalled;
TomahawkSettingsGui::instanceGui()->setAtticaResolverState( atticaId, Uninstalled ); TomahawkSettings::instance()->setAtticaResolverState( atticaId, Uninstalled );
doResolverRemove( atticaId ); doResolverRemove( atticaId );
} }
@@ -489,7 +529,7 @@ AtticaManager::uninstallResolver( const Content& resolver )
emit resolverStateChanged( resolver.id() ); emit resolverStateChanged( resolver.id() );
m_resolverStates[ resolver.id() ].state = Uninstalled; m_resolverStates[ resolver.id() ].state = Uninstalled;
TomahawkSettingsGui::instanceGui()->setAtticaResolverState( resolver.id(), Uninstalled ); TomahawkSettings::instance()->setAtticaResolverState( resolver.id(), Uninstalled );
} }
Tomahawk::Pipeline::instance()->removeScriptResolver( pathFromId( resolver.id() ) ); Tomahawk::Pipeline::instance()->removeScriptResolver( pathFromId( resolver.id() ) );

View File

@@ -83,6 +83,8 @@ public:
ResolverState resolverState( const Attica::Content& resolver ) const; ResolverState resolverState( const Attica::Content& resolver ) const;
QPixmap iconForResolver( const Attica::Content& id ); // Looks up in icon cache QPixmap iconForResolver( const Attica::Content& id ); // Looks up in icon cache
void installResolver( const Attica::Content& resolver );
void upgradeResolver( const Attica::Content& resolver );
void uninstallResolver( const Attica::Content& resolver ); void uninstallResolver( const Attica::Content& resolver );
void uninstallResolver( const QString& pathToResolver ); void uninstallResolver( const QString& pathToResolver );
QString pathFromId( const QString& resolverId ) const; QString pathFromId( const QString& resolverId ) const;
@@ -90,9 +92,6 @@ public:
void uploadRating( const Attica::Content& c ); void uploadRating( const Attica::Content& c );
bool userHasRated( const Attica::Content& c ) const; bool userHasRated( const Attica::Content& c ) const;
public slots:
void installResolver( const Attica::Content& resolver );
void upgradeResolver( const Attica::Content& resolver );
signals: signals:
void resolversReloaded( const Attica::Content::List& resolvers ); void resolversReloaded( const Attica::Content::List& resolvers );
@@ -112,6 +111,7 @@ private slots:
void resolverIconFetched(); void resolverIconFetched();
void syncServerData(); void syncServerData();
bool newerVersion( const QString& older, const QString& newer ) const;
private: private:
QString extractPayload( const QString& filename, const QString& resolverId ) const; QString extractPayload( const QString& filename, const QString& resolverId ) const;
@@ -127,8 +127,4 @@ private:
static AtticaManager* s_instance; static AtticaManager* s_instance;
}; };
#ifdef LIBATTICA_FOUND
Q_DECLARE_METATYPE( Attica::Content );
#endif
#endif // ATTICAMANAGER_H #endif // ATTICAMANAGER_H

View File

@@ -6,293 +6,11 @@ SET( QT_USE_QTNETWORK TRUE )
SET( QT_USE_QTXML TRUE ) SET( QT_USE_QTXML TRUE )
SET( QT_USE_QTUITOOLS TRUE ) SET( QT_USE_QTUITOOLS TRUE )
IF(VSXU_FOUND)
SET( QT_USE_QTOPENGL TRUE )
ENDIF(VSXU_FOUND)
include( ${QT_USE_FILE} ) include( ${QT_USE_FILE} )
add_definitions( ${QT_DEFINITIONS} ) add_definitions( ${QT_DEFINITIONS} )
add_definitions( -DQT_SHARED ) add_definitions( -DQT_SHARED )
add_definitions( -DDLLEXPORT_PRO ) add_definitions( -DDLLEXPORT_PRO )
add_definitions( -DQT_SHAREDPOINTER_TRACK_POINTERS )
set( libGuiSources
actioncollection.cpp
contextmenu.cpp
dropjob.cpp
globalactionmanager.cpp
viewpage.cpp
viewmanager.cpp
LatchManager.cpp
TomahawkSettingsGui.cpp
context/ContextPage.cpp
context/ContextWidget.cpp
context/pages/TopTracksContext.cpp
context/pages/RelatedArtistsContext.cpp
context/pages/WikipediaContext.cpp
context/pages/WebContext.cpp
jobview/JobStatusView.cpp
jobview/JobStatusModel.cpp
jobview/JobStatusDelegate.cpp
jobview/PipelineStatusItem.cpp
jobview/TransferStatusItem.cpp
jobview/LatchedStatusItem.cpp
infobar/infobar.cpp
playlist/treemodel.cpp
playlist/treeproxymodel.cpp
playlist/treeproxymodelplaylistinterface.cpp
playlist/treeheader.cpp
playlist/treeitemdelegate.cpp
playlist/collectionproxymodel.cpp
playlist/collectionproxymodelplaylistinterface.cpp
playlist/collectionflatmodel.cpp
playlist/collectionview.cpp
playlist/playlistmodel.cpp
playlist/playlistproxymodel.cpp
playlist/playlistproxymodelplaylistinterface.cpp
playlist/playlistview.cpp
playlist/playlistitemdelegate.cpp
playlist/queueproxymodel.cpp
playlist/queueproxymodelplaylistinterface.cpp
playlist/queueview.cpp
playlist/trackmodel.cpp
playlist/trackmodelitem.cpp
playlist/trackproxymodel.cpp
playlist/trackproxymodelplaylistinterface.cpp
playlist/trackview.cpp
playlist/trackheader.cpp
playlist/treemodelitem.cpp
playlist/albumitem.cpp
playlist/albummodel.cpp
playlist/albumproxymodel.cpp
playlist/albumproxymodelplaylistinterface.cpp
playlist/albumitemdelegate.cpp
playlist/albumview.cpp
playlist/artistview.cpp
playlist/customplaylistview.cpp
playlist/ViewHeader.cpp
playlist/dynamic/DynamicPlaylist.cpp
playlist/dynamic/DynamicView.cpp
playlist/dynamic/DynamicModel.cpp
playlist/dynamic/echonest/EchonestGenerator.cpp
playlist/dynamic/echonest/EchonestControl.cpp
playlist/dynamic/echonest/EchonestSteerer.cpp
playlist/dynamic/widgets/DynamicWidget.cpp
playlist/dynamic/widgets/DynamicControlWrapper.cpp
playlist/dynamic/widgets/DynamicControlList.cpp
playlist/dynamic/widgets/ReadOrWriteWidget.cpp
playlist/dynamic/widgets/MiscControlWidgets.cpp
playlist/dynamic/widgets/CollapsibleControls.cpp
playlist/dynamic/widgets/DynamicSetupWidget.cpp
playlist/dynamic/widgets/LoadingSpinner.cpp
playlist/topbar/topbar.cpp
playlist/topbar/clearbutton.cpp
playlist/topbar/searchlineedit.cpp
playlist/topbar/lineedit.cpp
playlist/topbar/searchbutton.cpp
ExternalResolverGui.cpp
resolvers/scriptresolver.cpp
resolvers/qtscriptresolver.cpp
sip/SipModel.cpp
utils/widgetdragfilter.cpp
utils/xspfgenerator.cpp
utils/jspfloader.cpp
utils/spotifyparser.cpp
utils/m3uloader.cpp
utils/itunesparser.cpp
utils/rdioparser.cpp
utils/shortenedlinkparser.cpp
utils/stylehelper.cpp
utils/dropjobnotifier.cpp
utils/proxystyle.cpp
utils/tomahawkutilsgui.cpp
widgets/checkdirtree.cpp
widgets/querylabel.cpp
widgets/imagebutton.cpp
widgets/animatedsplitter.cpp
widgets/elidedlabel.cpp
widgets/newplaylistwidget.cpp
widgets/searchwidget.cpp
widgets/SeekSlider.cpp
widgets/playlisttypeselectordlg.cpp
widgets/welcomewidget.cpp
widgets/whatshotwidget.cpp
widgets/ChartDataLoader.cpp
widgets/RecentlyPlayedPlaylistsModel.cpp
widgets/RecentPlaylistsModel.cpp
widgets/OverlayButton.cpp
widgets/overlaywidget.cpp
widgets/HeaderLabel.cpp
widgets/HeaderWidget.cpp
widgets/combobox.cpp
widgets/ToggleButton.cpp
widgets/SocialPlaylistWidget.cpp
widgets/infowidgets/sourceinfowidget.cpp
widgets/infowidgets/ArtistInfoWidget.cpp
widgets/infowidgets/AlbumInfoWidget.cpp
widgets/Breadcrumb.cpp
widgets/BreadcrumbButton.cpp
)
IF(QCA2_FOUND)
set( libGuiSources ${libGuiSources} utils/groovesharkparser.cpp )
ENDIF(QCA2_FOUND)
IF(VSXU_FOUND)
set(libGuiSources ${libGuiSources} nowplaying/VSXuWidget.cpp nowplaying/nowplayingpage.cpp)
ENDIF(VSXU_FOUND)
set( libGuiHeaders
actioncollection.h
contextmenu.h
dropjob.h
viewmanager.h
globalactionmanager.h
LatchManager.h
TomahawkSettingsGui.h
context/ContextPage.h
context/ContextWidget.h
context/pages/TopTracksContext.h
context/pages/RelatedArtistsContext.h
context/pages/WikipediaContext.h
context/pages/WebContext.h
infobar/infobar.h
playlist/topbar/topbar.h
playlist/topbar/clearbutton.h
playlist/topbar/searchlineedit.h
playlist/topbar/lineedit.h
playlist/topbar/lineedit_p.h
playlist/topbar/searchbutton.h
playlist/treemodel.h
playlist/treeproxymodel.h
playlist/treeproxymodelplaylistinterface.h
playlist/treeheader.h
playlist/treeitemdelegate.h
playlist/collectionproxymodel.h
playlist/collectionproxymodelplaylistinterface.h
playlist/collectionflatmodel.h
playlist/collectionview.h
playlist/playlistmodel.h
playlist/playlistproxymodel.h
playlist/playlistproxymodelplaylistinterface.h
playlist/playlistview.h
playlist/playlistitemdelegate.h
playlist/queueproxymodel.h
playlist/queueproxymodelplaylistinterface.h
playlist/queueview.h
playlist/trackmodel.h
playlist/trackmodelitem.h
playlist/trackproxymodel.h
playlist/trackproxymodelplaylistinterface.h
playlist/trackview.h
playlist/trackheader.h
playlist/treemodelitem.h
playlist/albumitem.h
playlist/albummodel.h
playlist/albumproxymodel.h
playlist/albumproxymodelplaylistinterface.h
playlist/albumitemdelegate.h
playlist/albumview.h
playlist/artistview.h
playlist/customplaylistview.h
playlist/ViewHeader.h
playlist/dynamic/DynamicPlaylist.h
playlist/dynamic/GeneratorInterface.h
playlist/dynamic/DynamicView.h
playlist/dynamic/DynamicModel.h
playlist/dynamic/echonest/EchonestGenerator.h
playlist/dynamic/echonest/EchonestControl.h
playlist/dynamic/echonest/EchonestSteerer.h
playlist/dynamic/widgets/DynamicWidget.h
playlist/dynamic/widgets/DynamicControlWrapper.h
playlist/dynamic/widgets/DynamicControlList.h
playlist/dynamic/widgets/ReadOrWriteWidget.h
playlist/dynamic/widgets/MiscControlWidgets.h
playlist/dynamic/widgets/CollapsibleControls.h
playlist/dynamic/widgets/DynamicSetupWidget.h
playlist/dynamic/widgets/LoadingSpinner.h
ExternalResolverGui.h
resolvers/scriptresolver.h
resolvers/qtscriptresolver.h
sip/SipModel.h
utils/widgetdragfilter.h
utils/xspfgenerator.h
utils/jspfloader.h
utils/spotifyparser.h
utils/m3uloader.h
utils/itunesparser.h
utils/rdioparser.h
utils/shortenedlinkparser.h
utils/dropjobnotifier.h
widgets/checkdirtree.h
widgets/querylabel.h
widgets/animatedcounterlabel.h
widgets/imagebutton.h
widgets/animatedsplitter.h
widgets/elidedlabel.h
widgets/newplaylistwidget.h
widgets/searchwidget.h
widgets/SeekSlider.h
widgets/playlisttypeselectordlg.h
widgets/welcomewidget.h
widgets/whatshotwidget.h
widgets/whatshotwidget_p.h
widgets/ChartDataLoader.h
widgets/RecentlyPlayedPlaylistsModel.h
widgets/RecentPlaylistsModel.h
widgets/OverlayButton.h
widgets/overlaywidget.h
widgets/HeaderLabel.h
widgets/HeaderWidget.h
widgets/combobox.h
widgets/ToggleButton.h
widgets/SocialPlaylistWidget.h
widgets/infowidgets/sourceinfowidget.h
widgets/infowidgets/ArtistInfoWidget.h
widgets/infowidgets/ArtistInfoWidget_p.h
widgets/infowidgets/AlbumInfoWidget.h
widgets/Breadcrumb.h
widgets/BreadcrumbButton.h
jobview/JobStatusView.h
jobview/JobStatusModel.h
jobview/JobStatusDelegate.h
jobview/JobStatusItem.h
jobview/PipelineStatusItem.h
jobview/TransferStatusItem.h
jobview/LatchedStatusItem.h
thirdparty/Qocoa/qsearchfield.h
)
IF(QCA2_FOUND)
set( libGuiHeaders ${libGuiHeaders} utils/groovesharkparser.h )
ENDIF(QCA2_FOUND)
IF(VSXU_FOUND)
set( libGuiHeaders ${libGuiHeaders} nowplaying/VSXuWidget.h nowplaying/nowplayingpage.h)
ENDIF(VSXU_FOUND)
set( libSources set( libSources
tomahawksettings.cpp tomahawksettings.cpp
@@ -300,29 +18,39 @@ set( libSources
pipeline.cpp pipeline.cpp
aclsystem.cpp aclsystem.cpp
actioncollection.cpp
artist.cpp artist.cpp
artistplaylistinterface.cpp
album.cpp album.cpp
albumplaylistinterface.cpp
collection.cpp collection.cpp
playlist.cpp playlist.cpp
playlistplaylistinterface.cpp
resolver.cpp resolver.cpp
ExternalResolver.cpp
query.cpp query.cpp
result.cpp result.cpp
source.cpp source.cpp
sourceplaylistinterface.cpp sourceplaylistinterface.cpp
viewpage.cpp
viewmanager.cpp
globalactionmanager.cpp
contextmenu.cpp
dropjob.cpp
playlistinterface.cpp playlistinterface.cpp
LatchManager.cpp
EchonestCatalogSynchronizer.cpp EchonestCatalogSynchronizer.cpp
sip/SipPlugin.cpp sip/SipPlugin.cpp
sip/SipHandler.cpp sip/SipHandler.cpp
sip/SipModel.cpp
sip/sipinfo.cpp sip/sipinfo.cpp
audio/audioengine.cpp audio/audioengine.cpp
context/ContextPage.cpp
context/ContextWidget.cpp
context/pages/TopTracksContext.cpp
context/pages/RelatedArtistsContext.cpp
context/pages/WikipediaContext.cpp
context/pages/WebContext.cpp
database/database.cpp database/database.cpp
database/fuzzyindex.cpp database/fuzzyindex.cpp
@@ -376,10 +104,11 @@ set( libSources
database/databasecommand_settrackattributes.cpp database/databasecommand_settrackattributes.cpp
database/database.cpp database/database.cpp
infosystem/infosystem.cpp infobar/infobar.cpp
infosystem/infosystemcache.cpp
infosystem/infosystemworker.cpp
infosystem/infosystemcache.cpp
infosystem/infosystem.cpp
infosystem/infosystemworker.cpp
infosystem/infoplugins/generic/echonestplugin.cpp infosystem/infoplugins/generic/echonestplugin.cpp
infosystem/infoplugins/generic/lastfmplugin.cpp infosystem/infoplugins/generic/lastfmplugin.cpp
infosystem/infoplugins/generic/chartsplugin.cpp infosystem/infoplugins/generic/chartsplugin.cpp
@@ -389,6 +118,66 @@ set( libSources
infosystem/infoplugins/generic/musicbrainzPlugin.cpp infosystem/infoplugins/generic/musicbrainzPlugin.cpp
infosystem/infoplugins/generic/RoviPlugin.cpp infosystem/infoplugins/generic/RoviPlugin.cpp
playlist/treemodel.cpp
playlist/treeproxymodel.cpp
playlist/treeheader.cpp
playlist/treeitemdelegate.cpp
playlist/collectionproxymodel.cpp
playlist/collectionflatmodel.cpp
playlist/collectionview.cpp
playlist/playlistmodel.cpp
playlist/playlistproxymodel.cpp
playlist/playlistview.cpp
playlist/playlistitemdelegate.cpp
playlist/queueproxymodel.cpp
playlist/queueview.cpp
playlist/trackmodel.cpp
playlist/trackmodelitem.cpp
playlist/trackproxymodel.cpp
playlist/trackview.cpp
playlist/trackheader.cpp
playlist/treemodelitem.cpp
playlist/albumitem.cpp
playlist/albummodel.cpp
playlist/albumproxymodel.cpp
playlist/albumitemdelegate.cpp
playlist/albumview.cpp
playlist/artistview.cpp
playlist/customplaylistview.cpp
playlist/ViewHeader.cpp
playlist/PlaylistUpdaterInterface.cpp
playlist/XspfUpdater.cpp
playlist/topbar/topbar.cpp
playlist/topbar/clearbutton.cpp
playlist/topbar/searchlineedit.cpp
playlist/topbar/lineedit.cpp
playlist/topbar/searchbutton.cpp
playlist/dynamic/DynamicPlaylist.cpp
playlist/dynamic/DynamicControl.cpp
playlist/dynamic/GeneratorFactory.cpp
playlist/dynamic/GeneratorInterface.cpp
playlist/dynamic/DynamicView.cpp
playlist/dynamic/DynamicModel.cpp
playlist/dynamic/DynamicPlaylistRevision.cpp
playlist/dynamic/echonest/EchonestGenerator.cpp
playlist/dynamic/echonest/EchonestControl.cpp
playlist/dynamic/echonest/EchonestSteerer.cpp
playlist/dynamic/widgets/DynamicWidget.cpp
playlist/dynamic/widgets/DynamicControlWrapper.cpp
playlist/dynamic/widgets/DynamicControlList.cpp
playlist/dynamic/widgets/ReadOrWriteWidget.cpp
playlist/dynamic/widgets/MiscControlWidgets.cpp
playlist/dynamic/widgets/CollapsibleControls.cpp
playlist/dynamic/widgets/DynamicSetupWidget.cpp
playlist/dynamic/widgets/LoadingSpinner.cpp
playlist/dynamic/database/DatabaseControl.cpp
playlist/dynamic/database/DatabaseGenerator.cpp
resolvers/scriptresolver.cpp
resolvers/qtscriptresolver.cpp
network/bufferiodevice.cpp network/bufferiodevice.cpp
network/msgprocessor.cpp network/msgprocessor.cpp
network/streamconnection.cpp network/streamconnection.cpp
@@ -399,28 +188,53 @@ set( libSources
network/connection.cpp network/connection.cpp
network/controlconnection.cpp network/controlconnection.cpp
playlist/PlaylistUpdaterInterface.cpp
playlist/dynamic/DynamicPlaylist.cpp
playlist/dynamic/GeneratorFactory.cpp
playlist/dynamic/GeneratorInterface.cpp
playlist/dynamic/DynamicPlaylistRevision.cpp
playlist/XspfUpdater.cpp
playlist/dynamic/database/DatabaseGenerator.cpp
playlist/dynamic/database/DatabaseControl.cpp
playlist/dynamic/DynamicControl.cpp
taghandlers/tag.cpp
taghandlers/apetag.cpp
taghandlers/asftag.cpp
taghandlers/id3v1tag.cpp
taghandlers/id3v2tag.cpp
taghandlers/mp4tag.cpp
taghandlers/oggtag.cpp
utils/tomahawkutils.cpp utils/tomahawkutils.cpp
utils/logger.cpp utils/logger.cpp
utils/qnr_iodevicestream.cpp utils/proxystyle.cpp
utils/widgetdragfilter.cpp
utils/xspfloader.cpp utils/xspfloader.cpp
utils/xspfgenerator.cpp
utils/jspfloader.cpp
utils/spotifyparser.cpp
utils/itunesparser.cpp
utils/rdioparser.cpp
utils/shortenedlinkparser.cpp
utils/stylehelper.cpp
utils/qnr_iodevicestream.cpp
utils/dropjobnotifier.cpp
widgets/checkdirtree.cpp
widgets/querylabel.cpp
widgets/imagebutton.cpp
widgets/animatedsplitter.cpp
widgets/elidedlabel.cpp
widgets/newplaylistwidget.cpp
widgets/searchwidget.cpp
widgets/SeekSlider.cpp
widgets/playlisttypeselectordlg.cpp
widgets/welcomewidget.cpp
widgets/whatshotwidget.cpp
widgets/RecentlyPlayedPlaylistsModel.cpp
widgets/RecentPlaylistsModel.cpp
widgets/OverlayButton.cpp
widgets/overlaywidget.cpp
widgets/HeaderLabel.cpp
widgets/HeaderWidget.cpp
widgets/combobox.cpp
widgets/ToggleButton.cpp
widgets/SocialPlaylistWidget.cpp
widgets/infowidgets/sourceinfowidget.cpp
widgets/infowidgets/ArtistInfoWidget.cpp
widgets/infowidgets/AlbumInfoWidget.cpp
widgets/Breadcrumb.cpp
widgets/BreadcrumbButton.cpp
jobview/JobStatusView.cpp
jobview/JobStatusModel.cpp
jobview/JobStatusDelegate.cpp
jobview/PipelineStatusItem.cpp
jobview/TransferStatusItem.cpp
jobview/LatchedStatusItem.cpp
thirdparty/kdsingleapplicationguard/kdsingleapplicationguard.cpp thirdparty/kdsingleapplicationguard/kdsingleapplicationguard.cpp
thirdparty/kdsingleapplicationguard/kdsharedmemorylocker.cpp thirdparty/kdsingleapplicationguard/kdsharedmemorylocker.cpp
@@ -434,34 +248,41 @@ set( libHeaders
pipeline.h pipeline.h
functimeout.h functimeout.h
playlistinterface.h
aclsystem.h aclsystem.h
actioncollection.h
collection.h collection.h
query.h query.h
resolver.h resolver.h
ExternalResolver.h
result.h result.h
source.h source.h
sourceplaylistinterface.h sourceplaylistinterface.h
viewmanager.h
globalactionmanager.h
contextmenu.h
dropjob.h
AtticaManager.h
LatchManager.h
artist.h artist.h
artistplaylistinterface.h
album.h album.h
albumplaylistinterface.h
playlist.h playlist.h
playlistplaylistinterface.h
viewpage.h
EchonestCatalogSynchronizer.h EchonestCatalogSynchronizer.h
sip/SipPlugin.h sip/SipPlugin.h
sip/SipHandler.h sip/SipHandler.h
sip/SipModel.h
sip/sipinfo.h sip/sipinfo.h
audio/audioengine.h audio/audioengine.h
context/ContextPage.h
context/ContextWidget.h
context/pages/TopTracksContext.h
context/pages/RelatedArtistsContext.h
context/pages/WikipediaContext.h
context/pages/WebContext.h
database/database.h database/database.h
database/fuzzyindex.h database/fuzzyindex.h
database/databaseworker.h database/databaseworker.h
@@ -513,11 +334,11 @@ set( libHeaders
database/databasecommand_trackattributes.h database/databasecommand_trackattributes.h
database/databasecommand_settrackattributes.h database/databasecommand_settrackattributes.h
infosystem/infosystem.h infobar/infobar.h
infosystem/infosystem.h infosystem/infosystem.h
infosystem/infosystemworker.h infosystem/infosystemworker.h
infosystem/infosystemcache.h infosystem/infosystemcache.h
infosystem/infoplugins/generic/echonestplugin.h infosystem/infoplugins/generic/echonestplugin.h
infosystem/infoplugins/generic/lastfmplugin.h infosystem/infoplugins/generic/lastfmplugin.h
infosystem/infoplugins/generic/chartsplugin.h infosystem/infoplugins/generic/chartsplugin.h
@@ -537,32 +358,123 @@ set( libHeaders
network/controlconnection.h network/controlconnection.h
network/portfwdthread.h network/portfwdthread.h
playlist/treemodel.h
playlist/treeproxymodel.h
playlist/treeheader.h
playlist/treeitemdelegate.h
playlist/collectionproxymodel.h
playlist/collectionflatmodel.h
playlist/collectionview.h
playlist/playlistmodel.h
playlist/playlistproxymodel.h
playlist/playlistview.h
playlist/playlistitemdelegate.h
playlist/queueproxymodel.h
playlist/queueview.h
playlist/trackmodel.h
playlist/trackmodelitem.h
playlist/trackproxymodel.h
playlist/trackview.h
playlist/trackheader.h
playlist/treemodelitem.h
playlist/albumitem.h
playlist/albummodel.h
playlist/albumproxymodel.h
playlist/albumitemdelegate.h
playlist/albumview.h
playlist/artistview.h
playlist/customplaylistview.h
playlist/ViewHeader.h
playlist/PlaylistUpdaterInterface.h playlist/PlaylistUpdaterInterface.h
playlist/dynamic/DynamicPlaylist.h
playlist/dynamic/GeneratorInterface.h
playlist/dynamic/GeneratorFactory.h
playlist/XspfUpdater.h playlist/XspfUpdater.h
playlist/dynamic/database/DatabaseGenerator.h
playlist/dynamic/database/DatabaseControl.h playlist/topbar/topbar.h
playlist/topbar/clearbutton.h
playlist/topbar/searchlineedit.h
playlist/topbar/lineedit.h
playlist/topbar/lineedit_p.h
playlist/topbar/searchbutton.h
playlist/dynamic/DynamicPlaylist.h
playlist/dynamic/DynamicControl.h playlist/dynamic/DynamicControl.h
playlist/dynamic/GeneratorInterface.h
playlist/dynamic/DynamicView.h
playlist/dynamic/DynamicModel.h
playlist/dynamic/echonest/EchonestGenerator.h
playlist/dynamic/echonest/EchonestControl.h
playlist/dynamic/echonest/EchonestSteerer.h
playlist/dynamic/widgets/DynamicWidget.h
playlist/dynamic/widgets/DynamicControlWrapper.h
playlist/dynamic/widgets/DynamicControlList.h
playlist/dynamic/widgets/ReadOrWriteWidget.h
playlist/dynamic/widgets/MiscControlWidgets.h
playlist/dynamic/widgets/CollapsibleControls.h
playlist/dynamic/widgets/DynamicSetupWidget.h
playlist/dynamic/widgets/LoadingSpinner.h
playlist/dynamic/database/DatabaseControl.h
playlist/dynamic/database/DatabaseGenerator.h
resolvers/scriptresolver.h
resolvers/qtscriptresolver.h
utils/widgetdragfilter.h
utils/xspfloader.h
utils/xspfgenerator.h
utils/jspfloader.h
utils/spotifyparser.h
utils/itunesparser.h
utils/rdioparser.h
utils/shortenedlinkparser.h
utils/qnr_iodevicestream.h
utils/dropjobnotifier.h
widgets/checkdirtree.h
widgets/querylabel.h
widgets/animatedcounterlabel.h
widgets/imagebutton.h
widgets/animatedsplitter.h
widgets/elidedlabel.h
widgets/newplaylistwidget.h
widgets/searchwidget.h
widgets/SeekSlider.h
widgets/playlisttypeselectordlg.h
widgets/welcomewidget.h
widgets/whatshotwidget.h
widgets/RecentlyPlayedPlaylistsModel.h
widgets/RecentPlaylistsModel.h
widgets/OverlayButton.h
widgets/overlaywidget.h
widgets/HeaderLabel.h
widgets/HeaderWidget.h
widgets/combobox.h
widgets/ToggleButton.h
widgets/SocialPlaylistWidget.h
widgets/infowidgets/sourceinfowidget.h
widgets/infowidgets/ArtistInfoWidget.h
widgets/infowidgets/ArtistInfoWidget_p.h
widgets/infowidgets/AlbumInfoWidget.h
widgets/Breadcrumb.h
widgets/BreadcrumbButton.h
jobview/JobStatusView.h
jobview/JobStatusModel.h
jobview/JobStatusDelegate.h
jobview/JobStatusItem.h
jobview/PipelineStatusItem.h
jobview/TransferStatusItem.h
jobview/LatchedStatusItem.h
thirdparty/kdsingleapplicationguard/kdsingleapplicationguard.h thirdparty/kdsingleapplicationguard/kdsingleapplicationguard.h
thirdparty/Qocoa/qsearchfield.h
utils/tomahawkutilsgui.h
utils/xspfloader.h
utils/qnr_iodevicestream.h
) )
set( libHeaders_NoMOC set( libHeaders_NoMOC
viewpage.h
infosystem/infoplugins/unix/imageconverter.h infosystem/infoplugins/unix/imageconverter.h
taghandlers/tag.h playlist/dynamic/GeneratorInterface.h
taghandlers/apetag.h playlist/dynamic/GeneratorFactory.h
taghandlers/asftag.h
taghandlers/id3v1tag.h
taghandlers/id3v2tag.h
taghandlers/mp4tag.h
taghandlers/oggtag.h
utils/tomahawkutils.h utils/tomahawkutils.h
) )
@@ -589,7 +501,7 @@ include_directories( . ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/.
${QJSON_INCLUDE_DIR} ${QJSON_INCLUDE_DIR}
${LIBECHONEST_INCLUDE_DIR} ${LIBECHONEST_INCLUDE_DIR}
${LIBECHONEST_INCLUDE_DIR}/.. ${LIBECHONEST_INCLUDE_DIR}/..
${CLUCENE_INCLUDE_DIRS} ${CLUCENE_INCLUDE_DIR}
${PHONON_INCLUDES} ${PHONON_INCLUDES}
${CMAKE_BINARY_DIR}/thirdparty/liblastfm2/src ${CMAKE_BINARY_DIR}/thirdparty/liblastfm2/src
@@ -604,25 +516,21 @@ IF(QCA2_FOUND)
INCLUDE_DIRECTORIES( ${QCA2_INCLUDE_DIR} ) INCLUDE_DIRECTORIES( ${QCA2_INCLUDE_DIR} )
ENDIF(QCA2_FOUND) ENDIF(QCA2_FOUND)
IF(VSXU_FOUND)
INCLUDE_DIRECTORIES(${VSXU_INCLUDE_DIRS})
ENDIF(VSXU_FOUND)
IF(LIBATTICA_FOUND) IF(LIBATTICA_FOUND)
SET( libGuiSources ${libGuiSources} AtticaManager.cpp ) SET( libSources ${libSources} AtticaManager.cpp )
SET( libGuiHeaders ${libGuiHeaders} AtticaManager.h ) SET( libHeaders ${libHeaders} AtticaManager.h )
INCLUDE_DIRECTORIES( ${LIBATTICA_INCLUDE_DIR} ) INCLUDE_DIRECTORIES( ${LIBATTICA_INCLUDE_DIR} )
ENDIF(LIBATTICA_FOUND) ENDIF(LIBATTICA_FOUND)
IF( UNIX AND NOT APPLE ) IF( UNIX AND NOT APPLE )
LIST(APPEND libGuiSources SET( libSources ${libSources}
infosystem/infoplugins/unix/mprispluginrootadaptor.cpp infosystem/infoplugins/unix/mprispluginrootadaptor.cpp
infosystem/infoplugins/unix/mprispluginplayeradaptor.cpp infosystem/infoplugins/unix/mprispluginplayeradaptor.cpp
infosystem/infoplugins/unix/mprisplugin.cpp infosystem/infoplugins/unix/mprisplugin.cpp
infosystem/infoplugins/unix/fdonotifyplugin.cpp infosystem/infoplugins/unix/fdonotifyplugin.cpp
infosystem/infoplugins/unix/imageconverter.cpp ) infosystem/infoplugins/unix/imageconverter.cpp )
LIST(APPEND libGuiHeaders SET( libHeaders ${libHeaders}
infosystem/infoplugins/unix/mprispluginrootadaptor.h infosystem/infoplugins/unix/mprispluginrootadaptor.h
infosystem/infoplugins/unix/mprispluginplayeradaptor.h infosystem/infoplugins/unix/mprispluginplayeradaptor.h
infosystem/infoplugins/unix/mprisplugin.h infosystem/infoplugins/unix/mprisplugin.h
@@ -645,7 +553,6 @@ IF( WIN32 )
"dsound.dll" "dsound.dll"
"winmm.dll" "winmm.dll"
"advapi32.dll" "advapi32.dll"
"shlwapi.dll"
) )
ENDIF( WIN32 ) ENDIF( WIN32 )
@@ -677,18 +584,13 @@ IF( APPLE )
/System/Library/Frameworks/AppKit.framework /System/Library/Frameworks/AppKit.framework
) )
ELSE( APPLE ) ELSE( APPLE )
SET( libGuiSources ${libGuiSources} thirdparty/Qocoa/qsearchfield.cpp ) SET( libSources ${libSources} thirdparty/Qocoa/qsearchfield.cpp )
ENDIF( APPLE ) ENDIF( APPLE )
IF(LIBLASTFM_FOUND) IF(LIBLASTFM_FOUND)
SET(LINK_LIBRARIES ${LINK_LIBRARIES} tomahawk_lastfm2 ) SET(LINK_LIBRARIES ${LINK_LIBRARIES} tomahawk_lastfm2 )
ENDIF(LIBLASTFM_FOUND) ENDIF(LIBLASTFM_FOUND)
IF(BUILD_GUI)
LIST(APPEND libSources ${libGuiSources} )
LIST(APPEND libHeaders ${libGuiHeaders} )
ENDIF()
qt4_wrap_ui( libUI_H ${libUI} ) qt4_wrap_ui( libUI_H ${libUI} )
qt4_wrap_cpp( libMoc ${libHeaders} ) qt4_wrap_cpp( libMoc ${libHeaders} )
@@ -700,10 +602,6 @@ IF(QCA2_FOUND)
SET(LINK_LIBRARIES ${LINK_LIBRARIES} ${QCA2_LIBRARIES} ) SET(LINK_LIBRARIES ${LINK_LIBRARIES} ${QCA2_LIBRARIES} )
ENDIF(QCA2_FOUND) ENDIF(QCA2_FOUND)
IF(VSXU_FOUND)
SET(LINK_LIBRARIES ${LINK_LIBRARIES} ${VSXU_LIBRARIES})
ENDIF(VSXU_FOUND)
IF(LIBATTICA_FOUND) IF(LIBATTICA_FOUND)
SET( LINK_LIBRARIES ${LINK_LIBRARIES} ${LIBATTICA_LIBRARIES} ${QuaZip_LIBRARIES} ) SET( LINK_LIBRARIES ${LINK_LIBRARIES} ${LIBATTICA_LIBRARIES} ${QuaZip_LIBRARIES} )
ENDIF(LIBATTICA_FOUND) ENDIF(LIBATTICA_FOUND)
@@ -718,14 +616,15 @@ TARGET_LINK_LIBRARIES( tomahawklib
${TAGLIB_LIBRARIES} ${TAGLIB_LIBRARIES}
${CLUCENE_LIBRARIES} ${CLUCENE_LIBRARIES}
${LIBECHONEST_LIBRARY} ${LIBECHONEST_LIBRARY}
${QT_LIBRARIES} #This should do as long as we use ${SET (QT_USE_QTXYZ TRUE)} ${QT_QTUITOOLS_LIBRARY}
${QT_LIBRARIES}
${OS_SPECIFIC_LINK_LIBRARIES} ${OS_SPECIFIC_LINK_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT} ${CMAKE_THREAD_LIBS_INIT}
${LINK_LIBRARIES} ${LINK_LIBRARIES}
) )
INSTALL( TARGETS tomahawklib INSTALL( TARGETS tomahawklib
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} RUNTIME DESTINATION bin
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} LIBRARY DESTINATION lib${LIB_SUFFIX}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION lib${LIB_SUFFIX}
) )

View File

@@ -342,6 +342,7 @@ EchonestCatalogSynchronizer::tracksRemoved( const QList< unsigned int >& trackId
foreach ( unsigned int id, trackIds ) foreach ( unsigned int id, trackIds )
{ {
tDebug() << "Deleting item with id:" << id;
Echonest::CatalogUpdateEntry e( Echonest::CatalogTypes::Delete ); Echonest::CatalogUpdateEntry e( Echonest::CatalogTypes::Delete );
e.setItemId( QString::number( id ).toLatin1() ); e.setItemId( QString::number( id ).toLatin1() );
entries.append( e ); entries.append( e );

View File

@@ -1,27 +0,0 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@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 "ExternalResolver.h"
#include "utils/logger.h"
Tomahawk::ExternalResolver::ErrorState
Tomahawk::ExternalResolver::error() const
{
return NoError;
}

View File

@@ -1,78 +0,0 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@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 EXTERNALRESOLVER_H
#define EXTERNALRESOLVER_H
#include "query.h"
#include "dllmacro.h"
#include "resolver.h"
#include <QObject>
class QWidget;
namespace Tomahawk
{
/**
* Generic resolver object, used to manage a resolver that Tomahawk knows about
*
* You *must* start() a resolver after creating an ExternalResolver in order to use it,
* otherwise it will not do anything.
*/
class DLLEXPORT ExternalResolver : public Resolver
{
Q_OBJECT
public:
enum ErrorState {
NoError,
FileNotFound,
FailedToLoad
};
ExternalResolver( const QString& filePath ) { m_filePath = filePath; }
virtual QString filePath() const { return m_filePath; }
virtual void saveConfig() = 0;
virtual void reload() {} // Reloads from file (especially useful to check if file now exists)
virtual ErrorState error() const;
virtual bool running() const = 0;
public slots:
virtual void start() = 0;
virtual void stop() = 0;
signals:
void changed(); // if config widget was added/removed
protected:
void setFilePath( const QString& path ) { m_filePath = path; }
private:
QString m_filePath;
};
}; //ns
#endif // EXTERNALESOLVER_H

View File

@@ -1,124 +0,0 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@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 "ExternalResolverGui.h"
#include <QMetaProperty>
#include <QBuffer>
#include <QDir>
#include <QtGui/QIcon>
#include <QtGui/QWidget>
#include <QUiLoader>
#include "utils/logger.h"
Tomahawk::ExternalResolverGui::ExternalResolverGui(const QString& filePath)
: Tomahawk::ExternalResolver(filePath)
{
}
QVariant
Tomahawk::ExternalResolverGui::configMsgFromWidget( QWidget* w )
{
if( !w )
return QVariant();
// generate a qvariantmap of all the widgets in the hierarchy, and for each one include the list of properties and values
QVariantMap widgetMap;
addChildProperties( w, widgetMap );
// qDebug() << "Generated widget variant:" << widgetMap;
return widgetMap;
}
void
Tomahawk::ExternalResolverGui::addChildProperties( QObject* widget, QVariantMap& m )
{
// recursively add all properties of this widget to the map, then repeat on all children.
// bare QWidgets are boring---so skip them! They have no input that the user can set.
if( !widget || !widget->isWidgetType() )
return;
if( qstrcmp( widget->metaObject()->className(), "QWidget" ) != 0 )
{
// qDebug() << "Adding properties for this:" << widget->metaObject()->className();
// add this widget's properties
QVariantMap props;
for( int i = 0; i < widget->metaObject()->propertyCount(); i++ )
{
QString prop = widget->metaObject()->property( i ).name();
QVariant val = widget->property( prop.toLatin1() );
// clean up for QJson....
if( val.canConvert< QPixmap >() || val.canConvert< QImage >() || val.canConvert< QIcon >() )
continue;
props[ prop ] = val.toString();
// qDebug() << QString( "%1: %2" ).arg( prop ).arg( props[ prop ].toString() );
}
m[ widget->objectName() ] = props;
}
// and recurse
foreach( QObject* child, widget->children() )
addChildProperties( child, m );
}
QWidget*
Tomahawk::ExternalResolverGui::widgetFromData( QByteArray& data, QWidget* parent )
{
if( data.isEmpty() )
return 0;
QUiLoader l;
QBuffer b( &data );
QWidget* w = l.load( &b, parent );
return w;
}
QByteArray
Tomahawk::ExternalResolverGui::fixDataImagePaths( const QByteArray& data, bool compressed, const QVariantMap& images )
{
// with a list of images and image data, write each to a temp file, replace the path in the .ui file with the temp file path
QString uiFile = QString::fromUtf8( data );
foreach( const QString& filename, images.keys() )
{
if( !uiFile.contains( filename ) ) // make sure the image is used
continue;
QString fullPath = QDir::tempPath() + "/" + filename;
QFile imgF( fullPath );
if( !imgF.open( QIODevice::WriteOnly ) )
{
qWarning() << "Failed to write to temporary image in UI file:" << filename << fullPath;
continue;
}
QByteArray data = images[ filename ].toByteArray();
// qDebug() << "expanding data:" << data << compressed;
data = compressed ? qUncompress( QByteArray::fromBase64( data ) ) : QByteArray::fromBase64( data );
imgF.write( data );
imgF.close();
// replace the path to the image with the real path
uiFile.replace( filename, fullPath );
}
return uiFile.toUtf8();
}

View File

@@ -1,55 +0,0 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@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 EXTERNALRESOLVERGUI_H
#define EXTERNALRESOLVERGUI_H
#include "ExternalResolver.h"
#include "dllmacro.h"
class QWidget;
namespace Tomahawk
{
/**
* Generic resolver object, used to manage a resolver that Tomahawk knows about
*
* You *must* start() a resolver after creating an ExternalResolver in order to use it,
* otherwise it will not do anything.
*/
class DLLEXPORT ExternalResolverGui : public ExternalResolver
{
Q_OBJECT
public:
ExternalResolverGui( const QString& filePath );
virtual QWidget* configUI() const = 0;
protected:
QWidget* widgetFromData( QByteArray& data, QWidget* parent = 0 );
QVariant configMsgFromWidget( QWidget* w );
QByteArray fixDataImagePaths( const QByteArray& data, bool compressed, const QVariantMap& images );
private:
void addChildProperties( QObject* parent, QVariantMap& m );
};
}; //ns
#endif // RESOLVER_H

View File

@@ -22,7 +22,8 @@
#include "audio/audioengine.h" #include "audio/audioengine.h"
#include "database/database.h" #include "database/database.h"
#include <QtGui/QAction> #include <QtCore/QStateMachine>
#include <QtCore/QState>
#include "sourcelist.h" #include "sourcelist.h"
#include "database/databasecommand_socialaction.h" #include "database/databasecommand_socialaction.h"
#include "sourceplaylistinterface.h" #include "sourceplaylistinterface.h"
@@ -33,7 +34,7 @@ LatchManager::LatchManager( QObject* parent )
: QObject( parent ) : QObject( parent )
, m_state( NotLatched ) , m_state( NotLatched )
{ {
connect( AudioEngine::instance(), SIGNAL( playlistChanged( Tomahawk::playlistinterface_ptr ) ), this, SLOT( playlistChanged( Tomahawk::playlistinterface_ptr ) ) ); connect( AudioEngine::instance(), SIGNAL( playlistChanged( Tomahawk::PlaylistInterface* ) ), this, SLOT( playlistChanged( Tomahawk::PlaylistInterface* ) ) );
} }
LatchManager::~LatchManager() LatchManager::~LatchManager()
@@ -57,11 +58,11 @@ LatchManager::latchRequest( const source_ptr& source )
m_state = Latching; m_state = Latching;
m_waitingForLatch = source; m_waitingForLatch = source;
AudioEngine::instance()->playItem( source->playlistInterface(), source->playlistInterface()->nextItem() ); AudioEngine::instance()->playItem( source->getPlaylistInterface().data(), source->getPlaylistInterface()->nextItem() );
} }
void void
LatchManager::playlistChanged( Tomahawk::playlistinterface_ptr ) LatchManager::playlistChanged( PlaylistInterface* )
{ {
// If we were latched on and changed, send the listening along stop // If we were latched on and changed, send the listening along stop
if ( m_latchedOnTo.isNull() ) if ( m_latchedOnTo.isNull() )
@@ -70,7 +71,7 @@ LatchManager::playlistChanged( Tomahawk::playlistinterface_ptr )
return; // Neither latched on nor waiting to be latched on, no-op return; // Neither latched on nor waiting to be latched on, no-op
m_latchedOnTo = m_waitingForLatch; m_latchedOnTo = m_waitingForLatch;
m_latchedInterface = m_waitingForLatch->playlistInterface(); m_latchedInterface = m_waitingForLatch->getPlaylistInterface();
m_waitingForLatch.clear(); m_waitingForLatch.clear();
m_state = Latched; m_state = Latched;
@@ -81,9 +82,7 @@ LatchManager::playlistChanged( Tomahawk::playlistinterface_ptr )
cmd->setTimestamp( QDateTime::currentDateTime().toTime_t() ); cmd->setTimestamp( QDateTime::currentDateTime().toTime_t() );
Database::instance()->enqueue( QSharedPointer< DatabaseCommand >( cmd ) ); Database::instance()->enqueue( QSharedPointer< DatabaseCommand >( cmd ) );
QAction *latchOnAction = ActionCollection::instance()->getAction( "latchOn" ); ActionCollection::instance()->getAction( "latchOn" )->setText( tr( "&Catch Up" ) );
latchOnAction->setText( tr( "&Catch Up" ) );
latchOnAction->setIcon( QIcon() );
// If not, then keep waiting // If not, then keep waiting
return; return;
@@ -109,7 +108,7 @@ LatchManager::playlistChanged( Tomahawk::playlistinterface_ptr )
m_latchedInterface.clear(); m_latchedInterface.clear();
// call ourselves to hit the "create latch" condition // call ourselves to hit the "create latch" condition
playlistChanged( Tomahawk::playlistinterface_ptr() ); playlistChanged( 0 );
return; return;
} }
m_latchedOnTo.clear(); m_latchedOnTo.clear();
@@ -118,9 +117,7 @@ LatchManager::playlistChanged( Tomahawk::playlistinterface_ptr )
m_state = NotLatched; m_state = NotLatched;
QAction *latchOnAction = ActionCollection::instance()->getAction( "latchOn" ); ActionCollection::instance()->getAction( "latchOn" )->setText( tr( "&Listen Along" ) );
latchOnAction->setText( tr( "&Listen Along" ) );
latchOnAction->setIcon( QIcon( RESPATH "images/headphones-sidebar.png" ) );
} }
@@ -131,27 +128,12 @@ LatchManager::catchUpRequest()
AudioEngine::instance()->next(); AudioEngine::instance()->next();
} }
void void
LatchManager::unlatchRequest( const source_ptr& source ) LatchManager::unlatchRequest( const source_ptr& source )
{ {
Q_UNUSED( source ); Q_UNUSED( source );
AudioEngine::instance()->stop(); AudioEngine::instance()->stop();
AudioEngine::instance()->setPlaylist( Tomahawk::playlistinterface_ptr() ); AudioEngine::instance()->setPlaylist( 0 );
QAction *latchOnAction = ActionCollection::instance()->getAction( "latchOn" ); ActionCollection::instance()->getAction( "latchOn" )->setText( tr( "&Listen Along" ) );
latchOnAction->setText( tr( "&Listen Along" ) );
latchOnAction->setIcon( QIcon( RESPATH "images/headphones-sidebar.png" ) );
}
void
LatchManager::latchModeChangeRequest( const Tomahawk::source_ptr& source, bool realtime )
{
if ( !isLatched( source ) )
return;
source->playlistInterface()->setLatchMode( realtime ? Tomahawk::PlaylistInterface::RealTime : Tomahawk::PlaylistInterface::StayOnSong );
if ( realtime )
catchUpRequest();
} }

View File

@@ -43,11 +43,10 @@ public slots:
void latchRequest( const Tomahawk::source_ptr& source ); void latchRequest( const Tomahawk::source_ptr& source );
void unlatchRequest( const Tomahawk::source_ptr& source ); void unlatchRequest( const Tomahawk::source_ptr& source );
void catchUpRequest(); void catchUpRequest();
void latchModeChangeRequest( const Tomahawk::source_ptr& source, bool realtime );
private slots: private slots:
void playlistChanged( Tomahawk::playlistinterface_ptr );
void playlistChanged( Tomahawk::PlaylistInterface* );
private: private:
enum State { enum State {
NotLatched = 0, NotLatched = 0,

View File

@@ -1,140 +0,0 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@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 "TomahawkSettingsGui.h"
#include <QDesktopServices>
#include "settingsdialog.h"
// #include <QDir>
//
// #include "sip/SipHandler.h"
// #include "playlistinterface.h"
//
// #include "utils/logger.h"
// #include "utils/tomahawkutils.h"
//
// #include "database/databasecommand_updatesearchindex.h"
// #include "database/database.h"
#define VERSION 5
using namespace Tomahawk;
inline QDataStream& operator<<(QDataStream& out, const AtticaManager::StateHash& states)
{
out << VERSION;
out << (quint32)states.count();
foreach( const QString& key, states.keys() )
{
AtticaManager::Resolver resolver = states[ key ];
out << key << resolver.version << resolver.scriptPath << (qint32)resolver.state << resolver.userRating;
}
return out;
}
inline QDataStream& operator>>(QDataStream& in, AtticaManager::StateHash& states)
{
quint32 count = 0, version = 0;
in >> version;
in >> count;
for ( uint i = 0; i < count; i++ )
{
QString key, version, scriptPath;
qint32 state, userRating;
in >> key;
in >> version;
in >> scriptPath;
in >> state;
in >> userRating;
states[ key ] = AtticaManager::Resolver( version, scriptPath, userRating, (AtticaManager::ResolverState)state );
}
return in;
}
TomahawkSettingsGui*
TomahawkSettingsGui::instanceGui()
{
return qobject_cast< TomahawkSettingsGui* >(TomahawkSettings::instance());
}
TomahawkSettingsGui::TomahawkSettingsGui( QObject* parent )
: TomahawkSettings( parent )
{
qRegisterMetaType< AtticaManager::StateHash >( "AtticaManager::StateHash" );
qRegisterMetaTypeStreamOperators<AtticaManager::StateHash>("AtticaManager::StateHash");
}
TomahawkSettingsGui::~TomahawkSettingsGui()
{
}
QString
TomahawkSettingsGui::storageCacheLocation() const
{
return QDesktopServices::storageLocation( QDesktopServices::CacheLocation ) + "/InfoSystemCache/";
}
QStringList
TomahawkSettingsGui::scannerPaths() const
{
QString musicLocation;
musicLocation = QDesktopServices::storageLocation( QDesktopServices::MusicLocation );
return value( "scanner/paths", musicLocation ).toStringList();
}
void
TomahawkSettingsGui::setAtticaResolverState( const QString& resolver, AtticaManager::ResolverState state )
{
AtticaManager::StateHash resolvers = value( "script/atticaresolverstates" ).value< AtticaManager::StateHash >();
AtticaManager::Resolver r = resolvers.value( resolver );
r.state = state;
resolvers.insert( resolver, r );
setValue( "script/atticaresolverstates", QVariant::fromValue< AtticaManager::StateHash >( resolvers ) );
sync();
}
AtticaManager::StateHash
TomahawkSettingsGui::atticaResolverStates() const
{
return value( "script/atticaresolverstates" ).value< AtticaManager::StateHash >();
}
void
TomahawkSettingsGui::setAtticaResolverStates( const AtticaManager::StateHash states )
{
setValue( "script/atticaresolverstates", QVariant::fromValue< AtticaManager::StateHash >( states ) );
}
void
TomahawkSettingsGui::removeAtticaResolverState ( const QString& resolver )
{
AtticaManager::StateHash resolvers = value( "script/atticaresolverstates" ).value< AtticaManager::StateHash >();
resolvers.remove( resolver );
setValue( "script/atticaresolverstates", QVariant::fromValue< AtticaManager::StateHash >( resolvers ) );
}

View File

@@ -1,55 +0,0 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@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 TOMAHAWK_SETTINGS_GUI_H
#define TOMAHAWK_SETTINGS_GUI_H
#include "tomahawksettings.h"
#include "AtticaManager.h"
#include <QSettings>
#include "dllmacro.h"
/**
* Convenience wrapper around QSettings for tomahawk-specific config
*/
class DLLEXPORT TomahawkSettingsGui : public TomahawkSettings
{
Q_OBJECT
public:
static TomahawkSettingsGui* instanceGui();
explicit TomahawkSettingsGui( QObject* parent = 0 );
virtual ~TomahawkSettingsGui();
virtual QString storageCacheLocation() const;
virtual QStringList scannerPaths() const;
AtticaManager::StateHash atticaResolverStates() const;
void setAtticaResolverStates( const AtticaManager::StateHash states );
void setAtticaResolverState( const QString& resolver, AtticaManager::ResolverState state );
void removeAtticaResolverState( const QString& resolver );
};
Q_DECLARE_METATYPE(AtticaManager::StateHash);
#endif

View File

@@ -17,9 +17,8 @@
*/ */
#include "actioncollection.h" #include "actioncollection.h"
#include "tomahawksettings.h" #include <tomahawksettings.h>
#include "audio/audioengine.h" #include <utils/tomahawkutils.h>
#include "utils/tomahawkutils.h"
ActionCollection* ActionCollection::s_instance = 0; ActionCollection* ActionCollection::s_instance = 0;
ActionCollection* ActionCollection::instance() ActionCollection* ActionCollection::instance()
@@ -39,39 +38,14 @@ ActionCollection::ActionCollection( QObject *parent )
void void
ActionCollection::initActions() ActionCollection::initActions()
{ {
QAction *latchOn = new QAction( tr( "&Listen Along" ), this ); m_actionCollection[ "latchOn" ] = new QAction( tr( "&Listen Along" ), this );
latchOn->setIcon( QIcon( RESPATH "images/headphones-sidebar.png" ) ); m_actionCollection[ "latchOff" ] = new QAction( tr( "&Stop Listening Along" ), this );
m_actionCollection[ "latchOn" ] = latchOn;
QAction *latchOff = new QAction( tr( "Stop &Listening Along" ), this );
latchOff->setIcon( QIcon( RESPATH "images/headphones-off.png" ) );
m_actionCollection[ "latchOff" ] = latchOff;
QAction *realtimeFollowingAlong = new QAction( tr( "&Follow in real-time" ), this );
realtimeFollowingAlong->setCheckable( true );
m_actionCollection[ "realtimeFollowingAlong" ] = realtimeFollowingAlong;
bool isPublic = TomahawkSettings::instance()->privateListeningMode() == TomahawkSettings::PublicListening; bool isPublic = TomahawkSettings::instance()->privateListeningMode() == TomahawkSettings::PublicListening;
QAction *privacyToggle = new QAction( ( isPublic ? tr( "&Listen Privately" ) : tr( "&Listen Publicly" ) ), this ); QAction *privacyToggle = new QAction( tr( QString( isPublic ? "&Listen Privately" : "&Listen Publicly" ).toAscii().constData() ), this );
privacyToggle->setIcon( QIcon( RESPATH "images/private-listening.png" ) ); privacyToggle->setIcon( QIcon( RESPATH "images/private-listening.png" ) );
privacyToggle->setIconVisibleInMenu( isPublic ); privacyToggle->setIconVisibleInMenu( isPublic );
m_actionCollection[ "togglePrivacy" ] = privacyToggle; m_actionCollection[ "togglePrivacy" ] = privacyToggle;
connect( m_actionCollection[ "togglePrivacy" ], SIGNAL( triggered() ), SLOT( togglePrivateListeningMode() ), Qt::UniqueConnection );
m_actionCollection[ "loadPlaylist" ] = new QAction( tr( "&Load Playlist" ), this );
m_actionCollection[ "renamePlaylist" ] = new QAction( tr( "&Rename Playlist" ), this );
m_actionCollection[ "copyPlaylist" ] = new QAction( tr( "&Copy Playlist Link" ), this );
m_actionCollection[ "playPause" ] = new QAction( tr( "&Play" ), this );
m_actionCollection[ "stop" ] = new QAction( tr( "&Stop" ), this );
m_actionCollection[ "previousTrack" ] = new QAction( tr( "&Previous Track" ), this );
m_actionCollection[ "nextTrack" ] = new QAction( tr( "&Next Track" ), this );
m_actionCollection[ "quit" ] = new QAction( tr( "&Quit" ), this );
// connect actions to AudioEngine
AudioEngine *ae = AudioEngine::instance();
connect( m_actionCollection[ "playPause" ], SIGNAL( triggered() ), ae, SLOT( playPause() ), Qt::UniqueConnection );
connect( m_actionCollection[ "stop" ], SIGNAL( triggered() ), ae, SLOT( stop() ), Qt::UniqueConnection );
connect( m_actionCollection[ "previousTrack" ], SIGNAL( triggered() ), ae, SLOT( previous() ), Qt::UniqueConnection );
connect( m_actionCollection[ "nextTrack" ], SIGNAL( triggered() ), ae, SLOT( next() ), Qt::UniqueConnection );
} }
@@ -88,21 +62,3 @@ ActionCollection::getAction( const QString& name )
{ {
return m_actionCollection.contains( name ) ? m_actionCollection[ name ] : 0; return m_actionCollection.contains( name ) ? m_actionCollection[ name ] : 0;
} }
void
ActionCollection::togglePrivateListeningMode()
{
tDebug() << Q_FUNC_INFO;
if ( TomahawkSettings::instance()->privateListeningMode() == TomahawkSettings::PublicListening )
TomahawkSettings::instance()->setPrivateListeningMode( TomahawkSettings::FullyPrivate );
else
TomahawkSettings::instance()->setPrivateListeningMode( TomahawkSettings::PublicListening );
QAction *privacyToggle = m_actionCollection[ "togglePrivacy" ];
bool isPublic = TomahawkSettings::instance()->privateListeningMode() == TomahawkSettings::PublicListening;
privacyToggle->setText( ( isPublic ? tr( "&Listen Privately" ) : tr( "&Listen Publicly" ) ) );
privacyToggle->setIconVisibleInMenu( isPublic );
emit privacyModeChanged();
}

View File

@@ -23,10 +23,11 @@
#include <QtGui/QAction> #include <QtGui/QAction>
class DLLEXPORT ActionCollection : public QObject class DLLEXPORT ActionCollection : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
static ActionCollection* instance(); static ActionCollection* instance();
@@ -34,15 +35,9 @@ public:
~ActionCollection(); ~ActionCollection();
void initActions(); void initActions();
QAction* getAction( const QString& name ); QAction* getAction( const QString &name );
public slots:
void togglePrivateListeningMode();
signals:
void privacyModeChanged();
private: private:
static ActionCollection* s_instance; static ActionCollection* s_instance;

View File

@@ -19,7 +19,6 @@
#include "album.h" #include "album.h"
#include "artist.h" #include "artist.h"
#include "albumplaylistinterface.h"
#include "database/database.h" #include "database/database.h"
#include "database/databaseimpl.h" #include "database/databaseimpl.h"
#include "database/databasecommand_alltracks.h" #include "database/databasecommand_alltracks.h"
@@ -29,11 +28,8 @@
using namespace Tomahawk; using namespace Tomahawk;
Album::Album() {}
Album::~Album() Album::~Album() {}
{
}
album_ptr album_ptr
Album::get( const Tomahawk::artist_ptr& artist, const QString& name, bool autoCreate ) Album::get( const Tomahawk::artist_ptr& artist, const QString& name, bool autoCreate )
@@ -67,91 +63,80 @@ Album::get( unsigned int id, const QString& name, const Tomahawk::artist_ptr& ar
Album::Album( unsigned int id, const QString& name, const Tomahawk::artist_ptr& artist ) Album::Album( unsigned int id, const QString& name, const Tomahawk::artist_ptr& artist )
: QObject() : PlaylistInterface( this )
, m_id( id ) , m_id( id )
, m_name( name ) , m_name( name )
, m_artist( artist ) , m_artist( artist )
, m_infoLoaded( false ) , m_currentItem( 0 )
, m_currentTrack( 0 )
{ {
connect( Tomahawk::InfoSystem::InfoSystem::instance(),
SIGNAL( info( Tomahawk::InfoSystem::InfoRequestData, QVariant ) ),
SLOT( infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData, QVariant ) ) );
} }
void void
Album::onTracksAdded( const QList<Tomahawk::query_ptr>& tracks ) Album::onTracksAdded( const QList<Tomahawk::query_ptr>& tracks )
{ {
Tomahawk::AlbumPlaylistInterface* api = dynamic_cast< Tomahawk::AlbumPlaylistInterface* >( playlistInterface().data() ); qDebug() << Q_FUNC_INFO;
if ( api )
api->addQueries( tracks );
m_queries << tracks;
emit tracksAdded( tracks ); emit tracksAdded( tracks );
} }
Tomahawk::result_ptr
Album::siblingItem( int itemsAway )
{
int p = m_currentTrack;
p += itemsAway;
if ( p < 0 )
return Tomahawk::result_ptr();
if ( p >= m_queries.count() )
return Tomahawk::result_ptr();
m_currentTrack = p;
m_currentItem = m_queries.at( p )->results().first();
return m_currentItem;
}
result_ptr
Album::currentItem() const
{
return m_currentItem;
}
bool
Album::hasNextItem()
{
int p = m_currentTrack;
p++;
if ( p < 0 || p >= m_queries.count() )
return false;
return true;
}
artist_ptr artist_ptr
Album::artist() const Album::artist() const
{ {
return m_artist; return m_artist;
} }
QList<Tomahawk::query_ptr>
QByteArray Album::tracks()
Album::cover() const
{ {
if ( !m_infoLoaded ) if ( m_queries.isEmpty() )
{ {
m_uuid = uuid(); DatabaseCommand_AllTracks* cmd = new DatabaseCommand_AllTracks();
cmd->setAlbum( this );
cmd->setSortOrder( DatabaseCommand_AllTracks::AlbumPosition );
Tomahawk::InfoSystem::InfoStringHash trackInfo; connect( cmd, SIGNAL( tracks( QList<Tomahawk::query_ptr>, QVariant ) ),
trackInfo["artist"] = artist()->name(); SLOT( onTracksAdded( QList<Tomahawk::query_ptr> ) ) );
trackInfo["album"] = name();
Tomahawk::InfoSystem::InfoRequestData requestData; Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( cmd ) );
requestData.caller = m_uuid;
requestData.type = Tomahawk::InfoSystem::InfoAlbumCoverArt;
requestData.input = QVariant::fromValue< Tomahawk::InfoSystem::InfoStringHash >( trackInfo );
requestData.customData = QVariantMap();
Tomahawk::InfoSystem::InfoSystem::instance()->getInfo( requestData );
} }
return m_cover; return m_queries;
}
void
Album::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output )
{
if ( requestData.caller != m_uuid ||
requestData.type != Tomahawk::InfoSystem::InfoAlbumCoverArt )
{
return;
}
m_infoLoaded = true;
if ( !output.isNull() && output.isValid() )
{
QVariantMap returnedData = output.value< QVariantMap >();
const QByteArray ba = returnedData["imgbytes"].toByteArray();
if ( ba.length() )
{
m_cover = ba;
}
}
emit updated();
}
Tomahawk::playlistinterface_ptr
Album::playlistInterface()
{
if ( m_playlistInterface.isNull() )
{
m_playlistInterface = Tomahawk::playlistinterface_ptr( new Tomahawk::AlbumPlaylistInterface( this ) );
}
return m_playlistInterface;
} }

View File

@@ -19,18 +19,17 @@
#ifndef TOMAHAWKALBUM_H #ifndef TOMAHAWKALBUM_H
#define TOMAHAWKALBUM_H #define TOMAHAWKALBUM_H
#include <QtCore/QObject> #include <QObject>
#include <QtCore/QSharedPointer> #include <QSharedPointer>
#include "typedefs.h" #include "typedefs.h"
#include "playlistinterface.h" #include "playlistinterface.h"
#include "dllmacro.h" #include "dllmacro.h"
#include "infosystem/infosystem.h"
namespace Tomahawk namespace Tomahawk
{ {
class DLLEXPORT Album : public QObject class DLLEXPORT Album : public QObject, public PlaylistInterface
{ {
Q_OBJECT Q_OBJECT
@@ -38,39 +37,56 @@ public:
static album_ptr get( const Tomahawk::artist_ptr& artist, const QString& name, bool autoCreate = false ); static album_ptr get( const Tomahawk::artist_ptr& artist, const QString& name, bool autoCreate = false );
static album_ptr get( unsigned int id, const QString& name, const Tomahawk::artist_ptr& artist ); static album_ptr get( unsigned int id, const QString& name, const Tomahawk::artist_ptr& artist );
explicit Album( unsigned int id, const QString& name, const Tomahawk::artist_ptr& artist ); Album( unsigned int id, const QString& name, const Tomahawk::artist_ptr& artist );
virtual ~Album(); ~Album();
unsigned int id() const { return m_id; } unsigned int id() const { return m_id; }
QString name() const { return m_name; } QString name() const { return m_name; }
artist_ptr artist() const; artist_ptr artist() const;
QByteArray cover() const;
bool infoLoaded() const { return m_infoLoaded; }
Tomahawk::playlistinterface_ptr playlistInterface(); QList<Tomahawk::query_ptr> tracks();
virtual int trackCount() const { return m_queries.count(); }
virtual int unfilteredTrackCount() const { return m_queries.count(); }
virtual Tomahawk::result_ptr siblingItem( int itemsAway );
virtual bool hasNextItem();
virtual Tomahawk::result_ptr currentItem() const;
virtual PlaylistInterface::RepeatMode repeatMode() const { return PlaylistInterface::NoRepeat; }
virtual bool shuffled() const { return false; }
virtual void setRepeatMode( PlaylistInterface::RepeatMode ) {}
virtual void setShuffled( bool ) {}
virtual void setFilter( const QString& /*pattern*/ ) {}
signals: signals:
void repeatModeChanged( PlaylistInterface::RepeatMode mode );
void shuffleModeChanged( bool enabled );
void tracksAdded( const QList<Tomahawk::query_ptr>& tracks ); void tracksAdded( const QList<Tomahawk::query_ptr>& tracks );
void updated(); void trackCountChanged( unsigned int tracks );
void sourceTrackCountChanged( unsigned int tracks );
void nextTrackReady();
private slots: private slots:
void onTracksAdded( const QList<Tomahawk::query_ptr>& tracks ); void onTracksAdded( const QList<Tomahawk::query_ptr>& tracks );
void infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output );
private: private:
Q_DISABLE_COPY( Album ) Album();
unsigned int m_id; unsigned int m_id;
QString m_name; QString m_name;
artist_ptr m_artist;
QByteArray m_cover;
bool m_infoLoaded;
mutable QString m_uuid;
Tomahawk::playlistinterface_ptr m_playlistInterface; artist_ptr m_artist;
QList<Tomahawk::query_ptr> m_queries;
result_ptr m_currentItem;
unsigned int m_currentTrack;
}; };
} // ns }; // ns
#endif #endif

View File

@@ -1,109 +0,0 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@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 "albumplaylistinterface.h"
#include "artist.h"
#include "database/database.h"
#include "database/databaseimpl.h"
#include "database/databasecommand_alltracks.h"
#include "query.h"
#include "utils/logger.h"
using namespace Tomahawk;
AlbumPlaylistInterface::AlbumPlaylistInterface() {}
AlbumPlaylistInterface::AlbumPlaylistInterface( Tomahawk::Album *album )
: Tomahawk::PlaylistInterface()
, m_currentItem( 0 )
, m_currentTrack( 0 )
, m_album( QWeakPointer< Tomahawk::Album >( album ) )
{
}
AlbumPlaylistInterface::~AlbumPlaylistInterface()
{
m_album.clear();
}
Tomahawk::result_ptr
AlbumPlaylistInterface::siblingItem( int itemsAway )
{
int p = m_currentTrack;
p += itemsAway;
if ( p < 0 )
return Tomahawk::result_ptr();
if ( p >= m_queries.count() )
return Tomahawk::result_ptr();
m_currentTrack = p;
m_currentItem = m_queries.at( p )->results().first();
return m_currentItem;
}
result_ptr
AlbumPlaylistInterface::currentItem() const
{
return m_currentItem;
}
bool
AlbumPlaylistInterface::hasNextItem()
{
int p = m_currentTrack;
p++;
if ( p < 0 || p >= m_queries.count() )
return false;
return true;
}
QList< Tomahawk::query_ptr >
AlbumPlaylistInterface::tracks()
{
if ( m_queries.isEmpty() && m_album )
{
DatabaseCommand_AllTracks* cmd = new DatabaseCommand_AllTracks();
cmd->setAlbum( m_album );
cmd->setSortOrder( DatabaseCommand_AllTracks::AlbumPosition );
//this takes discnumber into account as well
connect( cmd, SIGNAL( tracks( QList<Tomahawk::query_ptr>, QVariant ) ),
m_album.data(), SLOT( onTracksAdded( QList<Tomahawk::query_ptr> ) ) );
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( cmd ) );
}
return m_queries;
}
void
AlbumPlaylistInterface::addQueries( const QList< query_ptr >& tracks )
{
m_queries << tracks;
}

View File

@@ -1,83 +0,0 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@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 TOMAHAWKALBUMPLAYLISTINTERFACE_H
#define TOMAHAWKALBUMPLAYLISTINTERFACE_H
#include <QtCore/QObject>
#include <QtCore/QSharedPointer>
#include "album.h"
#include "typedefs.h"
#include "playlistinterface.h"
#include "dllmacro.h"
namespace Tomahawk
{
class DLLEXPORT AlbumPlaylistInterface : public Tomahawk::PlaylistInterface
{
Q_OBJECT
public:
AlbumPlaylistInterface( Tomahawk::Album *album );
virtual ~AlbumPlaylistInterface();
QList<Tomahawk::query_ptr> tracks();
virtual int trackCount() const { return m_queries.count(); }
virtual int unfilteredTrackCount() const { return m_queries.count(); }
virtual Tomahawk::result_ptr siblingItem( int itemsAway );
virtual bool hasNextItem();
virtual Tomahawk::result_ptr currentItem() const;
virtual PlaylistInterface::RepeatMode repeatMode() const { return PlaylistInterface::NoRepeat; }
virtual bool shuffled() const { return false; }
virtual void setRepeatMode( PlaylistInterface::RepeatMode ) {}
virtual void setShuffled( bool ) {}
virtual void setFilter( const QString& /*pattern*/ ) {}
virtual void addQueries( const QList<Tomahawk::query_ptr>& tracks );
signals:
void repeatModeChanged( Tomahawk::PlaylistInterface::RepeatMode mode );
void shuffleModeChanged( bool enabled );
void trackCountChanged( unsigned int tracks );
void sourceTrackCountChanged( unsigned int tracks );
void nextTrackReady();
private:
Q_DISABLE_COPY( AlbumPlaylistInterface )
AlbumPlaylistInterface();
QList< Tomahawk::query_ptr > m_queries;
result_ptr m_currentItem;
unsigned int m_currentTrack;
QWeakPointer< Tomahawk::Album > m_album;
};
}; // ns
#endif

View File

@@ -18,10 +18,10 @@
#include "artist.h" #include "artist.h"
#include "artistplaylistinterface.h"
#include "collection.h" #include "collection.h"
#include "database/database.h" #include "database/database.h"
#include "database/databaseimpl.h" #include "database/databaseimpl.h"
#include "database/databasecommand_alltracks.h"
#include "query.h" #include "query.h"
#include "utils/logger.h" #include "utils/logger.h"
@@ -29,6 +29,11 @@
using namespace Tomahawk; using namespace Tomahawk;
Artist::Artist()
{
}
Artist::~Artist() Artist::~Artist()
{ {
} }
@@ -66,83 +71,76 @@ Artist::get( unsigned int id, const QString& name )
Artist::Artist( unsigned int id, const QString& name ) Artist::Artist( unsigned int id, const QString& name )
: QObject() : PlaylistInterface( this )
, m_id( id ) , m_id( id )
, m_name( name ) , m_name( name )
, m_infoLoaded( false ) , m_currentItem( 0 )
, m_currentTrack( 0 )
{ {
m_sortname = DatabaseImpl::sortname( name, true ); m_sortname = DatabaseImpl::sortname( name, true );
connect( Tomahawk::InfoSystem::InfoSystem::instance(),
SIGNAL( info( Tomahawk::InfoSystem::InfoRequestData, QVariant ) ),
SLOT( infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData, QVariant ) ) );
} }
void void
Artist::onTracksAdded( const QList<Tomahawk::query_ptr>& tracks ) Artist::onTracksAdded( const QList<Tomahawk::query_ptr>& tracks )
{ {
Tomahawk::ArtistPlaylistInterface* api = dynamic_cast< Tomahawk::ArtistPlaylistInterface* >( playlistInterface().data() ); qDebug() << Q_FUNC_INFO;
if ( api )
api->addQueries( tracks ); m_queries << tracks;
emit tracksAdded( tracks ); emit tracksAdded( tracks );
} }
QByteArray Tomahawk::result_ptr
Artist::cover() const Artist::siblingItem( int itemsAway )
{ {
if ( !m_infoLoaded ) int p = m_currentTrack;
{ p += itemsAway;
m_uuid = uuid();
Tomahawk::InfoSystem::InfoStringHash trackInfo; if ( p < 0 )
trackInfo["artist"] = name(); return Tomahawk::result_ptr();
Tomahawk::InfoSystem::InfoRequestData requestData; if ( p >= m_queries.count() )
requestData.caller = m_uuid; return Tomahawk::result_ptr();
requestData.type = Tomahawk::InfoSystem::InfoArtistImages;
requestData.input = QVariant::fromValue< Tomahawk::InfoSystem::InfoStringHash >( trackInfo );
requestData.customData = QVariantMap();
Tomahawk::InfoSystem::InfoSystem::instance()->getInfo( requestData ); m_currentTrack = p;
} m_currentItem = m_queries.at( p )->results().first();
return m_currentItem;
return m_cover;
} }
void bool
Artist::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output ) Artist::hasNextItem()
{ {
if ( requestData.caller != m_uuid || int p = m_currentTrack;
requestData.type != Tomahawk::InfoSystem::InfoArtistImages ) p++;
{ if ( p < 0 || p >= m_queries.count() )
return; return false;
}
m_infoLoaded = true; return true;
if ( !output.isNull() && output.isValid() ) }
{
QVariantMap returnedData = output.value< QVariantMap >();
const QByteArray ba = returnedData["imgbytes"].toByteArray();
if ( ba.length() )
{
m_cover = ba;
}
}
emit updated(); result_ptr
Artist::currentItem() const
{
return m_currentItem;
} }
Tomahawk::playlistinterface_ptr QList<Tomahawk::query_ptr>
Artist::playlistInterface() Artist::tracks()
{ {
if ( m_playlistInterface.isNull() ) if ( m_queries.isEmpty() )
{ {
m_playlistInterface = Tomahawk::playlistinterface_ptr( new Tomahawk::ArtistPlaylistInterface( this ) ); DatabaseCommand_AllTracks* cmd = new DatabaseCommand_AllTracks();
cmd->setArtist( this );
cmd->setSortOrder( DatabaseCommand_AllTracks::Album );
connect( cmd, SIGNAL( tracks( QList<Tomahawk::query_ptr>, QVariant ) ),
SLOT( onTracksAdded( QList<Tomahawk::query_ptr> ) ) );
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( cmd ) );
} }
return m_playlistInterface; return m_queries;
} }

View File

@@ -19,57 +19,75 @@
#ifndef TOMAHAWKARTIST_H #ifndef TOMAHAWKARTIST_H
#define TOMAHAWKARTIST_H #define TOMAHAWKARTIST_H
#include <QtCore/QObject> #include <QObject>
#include <QtCore/QSharedPointer> #include <QSharedPointer>
#include "typedefs.h" #include "typedefs.h"
#include "playlistinterface.h"
#include "dllmacro.h" #include "dllmacro.h"
#include "infosystem/infosystem.h"
namespace Tomahawk namespace Tomahawk
{ {
class DLLEXPORT Artist : public QObject class DLLEXPORT Artist : public QObject, public PlaylistInterface
{ {
Q_OBJECT Q_OBJECT
public: public:
static artist_ptr get( const QString& name, bool autoCreate = false ); static artist_ptr get( const QString& name, bool autoCreate = false );
static artist_ptr get( unsigned int id, const QString& name ); static artist_ptr get( unsigned int id, const QString& name );
Artist( unsigned int id, const QString& name );
explicit Artist( unsigned int id, const QString& name ); Artist();
virtual ~Artist(); virtual ~Artist();
unsigned int id() const { return m_id; } unsigned int id() const { return m_id; }
QString name() const { return m_name; } QString name() const { return m_name; }
QString sortname() const { return m_sortname; } QString sortname() const { return m_sortname; }
QByteArray cover() const;
bool infoLoaded() const { return m_infoLoaded; }
Tomahawk::playlistinterface_ptr playlistInterface(); virtual QList<Tomahawk::query_ptr> tracks();
virtual int trackCount() const { return 0; }
virtual int unfilteredTrackCount() const { return m_queries.count(); }
virtual Tomahawk::result_ptr siblingItem( int itemsAway );
virtual bool hasNextItem();
virtual Tomahawk::result_ptr currentItem() const;
virtual PlaylistInterface::RepeatMode repeatMode() const { return PlaylistInterface::NoRepeat; }
virtual bool shuffled() const { return false; }
virtual void setRepeatMode( PlaylistInterface::RepeatMode ) {}
virtual void setShuffled( bool ) {}
virtual void setFilter( const QString& /*pattern*/ ) {}
signals: signals:
void repeatModeChanged( PlaylistInterface::RepeatMode mode );
void shuffleModeChanged( bool enabled );
void tracksAdded( const QList<Tomahawk::query_ptr>& tracks ); void tracksAdded( const QList<Tomahawk::query_ptr>& tracks );
void updated(); void trackCountChanged( unsigned int tracks );
void sourceTrackCountChanged( unsigned int tracks );
void nextTrackReady();
private slots: private slots:
void onTracksAdded( const QList<Tomahawk::query_ptr>& tracks ); void onTracksAdded( const QList<Tomahawk::query_ptr>& tracks );
void infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output );
private: private:
Q_DISABLE_COPY( Artist ) Q_DISABLE_COPY(Artist)
unsigned int m_id; unsigned int m_id;
QString m_name; QString m_name;
QString m_sortname; QString m_sortname;
QByteArray m_cover;
bool m_infoLoaded;
mutable QString m_uuid;
Tomahawk::playlistinterface_ptr m_playlistInterface; QList<Tomahawk::query_ptr> m_queries;
result_ptr m_currentItem;
unsigned int m_currentTrack;
}; };
} // ns }; // ns
#endif #endif

View File

@@ -1,106 +0,0 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@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 "artistplaylistinterface.h"
#include "artist.h"
#include "collection.h"
#include "query.h"
#include "database/database.h"
#include "database/databasecommand_alltracks.h"
#include "utils/logger.h"
using namespace Tomahawk;
ArtistPlaylistInterface::ArtistPlaylistInterface( Tomahawk::Artist *artist )
: Tomahawk::PlaylistInterface()
, m_currentItem( 0 )
, m_currentTrack( 0 )
, m_artist( QWeakPointer< Tomahawk::Artist >( artist ) )
{
}
ArtistPlaylistInterface::~ArtistPlaylistInterface()
{
m_artist.clear();
}
Tomahawk::result_ptr
ArtistPlaylistInterface::siblingItem( int itemsAway )
{
int p = m_currentTrack;
p += itemsAway;
if ( p < 0 )
return Tomahawk::result_ptr();
if ( p >= m_queries.count() )
return Tomahawk::result_ptr();
m_currentTrack = p;
m_currentItem = m_queries.at( p )->results().first();
return m_currentItem;
}
bool
ArtistPlaylistInterface::hasNextItem()
{
int p = m_currentTrack;
p++;
if ( p < 0 || p >= m_queries.count() )
return false;
return true;
}
result_ptr
ArtistPlaylistInterface::currentItem() const
{
return m_currentItem;
}
QList<Tomahawk::query_ptr>
ArtistPlaylistInterface::tracks()
{
if ( m_queries.isEmpty() && m_artist )
{
DatabaseCommand_AllTracks* cmd = new DatabaseCommand_AllTracks();
cmd->setArtist( m_artist );
cmd->setSortOrder( DatabaseCommand_AllTracks::Album );
connect( cmd, SIGNAL( tracks( QList<Tomahawk::query_ptr>, QVariant ) ),
SLOT( onTracksAdded( QList<Tomahawk::query_ptr> ) ) );
Database::instance()->enqueue( QSharedPointer< DatabaseCommand >( cmd ) );
}
return m_queries;
}
void
ArtistPlaylistInterface::addQueries( const QList< query_ptr >& tracks )
{
m_queries << tracks;
}

View File

@@ -1,73 +0,0 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@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 TOMAHAWKARTISTPLAYLISTINTERFACE_H
#define TOMAHAWKARTISTPLAYLISTINTERFACE_H
#include <QtCore/QObject>
#include <QtCore/QSharedPointer>
#include "artist.h"
#include "typedefs.h"
#include "playlistinterface.h"
#include "dllmacro.h"
namespace Tomahawk
{
class DLLEXPORT ArtistPlaylistInterface : public Tomahawk::PlaylistInterface
{
Q_OBJECT
public:
ArtistPlaylistInterface( Tomahawk::Artist *artist );
virtual ~ArtistPlaylistInterface();
virtual QList<Tomahawk::query_ptr> tracks();
virtual int trackCount() const { return 0; }
virtual int unfilteredTrackCount() const { return m_queries.count(); }
virtual Tomahawk::result_ptr siblingItem( int itemsAway );
virtual bool hasNextItem();
virtual Tomahawk::result_ptr currentItem() const;
virtual PlaylistInterface::RepeatMode repeatMode() const { return PlaylistInterface::NoRepeat; }
virtual bool shuffled() const { return false; }
virtual void setRepeatMode( PlaylistInterface::RepeatMode ) {}
virtual void setShuffled( bool ) {}
virtual void setFilter( const QString& /*pattern*/ ) {}
virtual void addQueries( const QList<Tomahawk::query_ptr>& tracks );
private:
Q_DISABLE_COPY( ArtistPlaylistInterface )
QList< Tomahawk::query_ptr > m_queries;
result_ptr m_currentItem;
unsigned int m_currentTrack;
QWeakPointer< Tomahawk::Artist > m_artist;
};
}; // ns
#endif

View File

@@ -18,18 +18,19 @@
#include "audioengine.h" #include "audioengine.h"
#include <QtCore/QUrl> #include <QUrl>
#include <QtNetwork/QNetworkReply> #include <QNetworkReply>
#include "playlistinterface.h" #include "playlistinterface.h"
#include "sourceplaylistinterface.h" #include "sourceplaylistinterface.h"
#include "tomahawksettings.h" #include "tomahawksettings.h"
#include "actioncollection.h"
#include "database/database.h" #include "database/database.h"
#include "database/databasecommand_logplayback.h" #include "database/databasecommand_logplayback.h"
#include "network/servent.h" #include "network/servent.h"
#include "utils/qnr_iodevicestream.h" #include "utils/qnr_iodevicestream.h"
#include "headlesscheck.h" #include "headlesscheck.h"
#include "infosystem/infosystem.h"
#include "album.h" #include "album.h"
#include "utils/logger.h" #include "utils/logger.h"
@@ -51,10 +52,12 @@ AudioEngine::instance()
AudioEngine::AudioEngine() AudioEngine::AudioEngine()
: QObject() : QObject()
, m_isPlayingHttp( false )
, m_queue( 0 ) , m_queue( 0 )
, m_timeElapsed( 0 ) , m_timeElapsed( 0 )
, m_expectStop( false ) , m_expectStop( false )
, m_waitingOnNewTrack( false ) , m_waitingOnNewTrack( false )
, m_infoSystemConnected( false )
, m_state( Stopped ) , m_state( Stopped )
{ {
s_instance = this; s_instance = this;
@@ -72,9 +75,12 @@ AudioEngine::AudioEngine()
connect( m_mediaObject, SIGNAL( tick( qint64 ) ), SLOT( timerTriggered( qint64 ) ) ); connect( m_mediaObject, SIGNAL( tick( qint64 ) ), SLOT( timerTriggered( qint64 ) ) );
connect( m_mediaObject, SIGNAL( aboutToFinish() ), SLOT( onAboutToFinish() ) ); connect( m_mediaObject, SIGNAL( aboutToFinish() ), SLOT( onAboutToFinish() ) );
connect( m_audioOutput, SIGNAL( volumeChanged( qreal ) ), SLOT( onVolumeChanged( qreal ) ) ); connect( m_audioOutput, SIGNAL( volumeChanged( qreal ) ), this, SLOT( onVolumeChanged( qreal ) ) );
connect( this, SIGNAL( sendWaitingNotification() ), SLOT( sendWaitingNotificationSlot() ), Qt::QueuedConnection ); #ifndef TOMAHAWK_HEADLESS
tDebug() << Q_FUNC_INFO << "Connecting privacy toggle";
connect( ActionCollection::instance()->getAction( "togglePrivacy" ), SIGNAL( triggered( bool ) ), this, SLOT( togglePrivateListeningMode() ) );
#endif
onVolumeChanged( m_audioOutput->volume() ); onVolumeChanged( m_audioOutput->volume() );
@@ -161,8 +167,6 @@ void
AudioEngine::stop() AudioEngine::stop()
{ {
tDebug( LOGEXTRA ) << Q_FUNC_INFO; tDebug( LOGEXTRA ) << Q_FUNC_INFO;
emit stopped();
if ( isStopped() ) if ( isStopped() )
return; return;
@@ -174,17 +178,20 @@ AudioEngine::stop()
if ( !m_currentTrack.isNull() ) if ( !m_currentTrack.isNull() )
emit timerPercentage( ( (double)m_timeElapsed / (double)m_currentTrack->duration() ) * 100.0 ); emit timerPercentage( ( (double)m_timeElapsed / (double)m_currentTrack->duration() ) * 100.0 );
emit stopped();
setCurrentTrack( Tomahawk::result_ptr() ); setCurrentTrack( Tomahawk::result_ptr() );
Tomahawk::InfoSystem::InfoTypeMap map; Tomahawk::InfoSystem::InfoTypeMap map;
map[ Tomahawk::InfoSystem::InfoNowStopped ] = QVariant(); map[ Tomahawk::InfoSystem::InfoNowStopped ] = QVariant();
if ( m_waitingOnNewTrack ) if ( m_waitingOnNewTrack )
emit sendWaitingNotification(); {
sendWaitingNotification();
}
else if ( TomahawkSettings::instance()->verboseNotifications() ) else if ( TomahawkSettings::instance()->verboseNotifications() )
{ {
QVariantMap stopInfo; QVariantMap stopInfo;
stopInfo["message"] = tr( "Tomahawk is stopped." ); stopInfo["message"] = QString( "Tomahawk is stopped." );
map[ Tomahawk::InfoSystem::InfoNotifyUser ] = QVariant::fromValue< QVariantMap >( stopInfo ); map[ Tomahawk::InfoSystem::InfoNotifyUser ] = QVariant::fromValue< QVariantMap >( stopInfo );
} }
@@ -227,12 +234,12 @@ AudioEngine::canGoNext()
m_playlist.data()->skipRestrictions() == PlaylistInterface::NoSkipForwards ) m_playlist.data()->skipRestrictions() == PlaylistInterface::NoSkipForwards )
return false; return false;
if ( !m_currentTrack.isNull() && !m_playlist->hasNextItem() && if ( !m_currentTrack.isNull() && !m_playlist.data()->hasNextItem() &&
( m_playlist->currentItem().isNull() || ( m_currentTrack->id() == m_playlist->currentItem()->id() ) ) ) ( m_playlist.data()->currentItem().isNull() || ( m_currentTrack->id() == m_playlist.data()->currentItem()->id() ) ) )
{ {
//For instance, when doing a catch-up while listening along, but the person //For instance, when doing a catch-up while listening along, but the person
//you're following hasn't started a new track yet...don't do anything //you're following hasn't started a new track yet...don't do anything
tDebug( LOGEXTRA ) << Q_FUNC_INFO << "catch up, but same track or can't move on because don't have next track or it wasn't resolved"; tDebug( LOGEXTRA ) << Q_FUNC_INFO << "catch up";
return false; return false;
} }
@@ -310,13 +317,8 @@ AudioEngine::mute()
void void
AudioEngine::sendWaitingNotificationSlot() const AudioEngine::sendWaitingNotification() const
{ {
tDebug( LOGVERBOSE ) << Q_FUNC_INFO;
//since it's async, after this is triggered our result could come in, so don't show the popup in that case
if ( !m_playlist.isNull() && m_playlist->hasNextItem() )
return;
QVariantMap retryInfo; QVariantMap retryInfo;
retryInfo["message"] = QString( "The current track could not be resolved. Tomahawk will pick back up with the next resolvable track from this source." ); retryInfo["message"] = QString( "The current track could not be resolved. Tomahawk will pick back up with the next resolvable track from this source." );
Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo( Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo(
@@ -328,38 +330,62 @@ AudioEngine::sendWaitingNotificationSlot() const
void void
AudioEngine::sendNowPlayingNotification() AudioEngine::sendNowPlayingNotification()
{ {
if ( m_currentTrack->album().isNull() || m_currentTrack->album()->infoLoaded() ) tDebug( LOGEXTRA ) << Q_FUNC_INFO;
onNowPlayingInfoReady();
else if ( ! m_infoSystemConnected )
{ {
connect( m_currentTrack->album().data(), SIGNAL( updated() ), SLOT( onNowPlayingInfoReady() ), Qt::UniqueConnection ); connect( Tomahawk::InfoSystem::InfoSystem::instance(),
m_currentTrack->album()->cover(); SIGNAL( info( Tomahawk::InfoSystem::InfoRequestData, QVariant ) ),
SLOT( infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData, QVariant ) ) );
connect( Tomahawk::InfoSystem::InfoSystem::instance(), SIGNAL( finished( QString ) ), SLOT( infoSystemFinished( QString ) ) );
m_infoSystemConnected = true;
} }
Tomahawk::InfoSystem::InfoStringHash trackInfo;
trackInfo["artist"] = m_currentTrack->album()->artist()->name();
trackInfo["album"] = m_currentTrack->album()->name();
Tomahawk::InfoSystem::InfoRequestData requestData;
requestData.caller = s_aeInfoIdentifier;
requestData.type = Tomahawk::InfoSystem::InfoAlbumCoverArt;
requestData.input = QVariant::fromValue< Tomahawk::InfoSystem::InfoStringHash >( trackInfo );
requestData.customData = QVariantMap();
Tomahawk::InfoSystem::InfoSystem::instance()->getInfo( requestData );
} }
void void
AudioEngine::onNowPlayingInfoReady() AudioEngine::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output )
{ {
if ( requestData.caller != s_aeInfoIdentifier ||
requestData.type != Tomahawk::InfoSystem::InfoAlbumCoverArt )
{
return;
}
if ( m_currentTrack.isNull() || if ( m_currentTrack.isNull() ||
m_currentTrack->track().isNull() || m_currentTrack->track().isNull() ||
m_currentTrack->artist().isNull() ) m_currentTrack->artist().isNull() )
return; return;
if ( !m_currentTrack->album().isNull() && sender() && m_currentTrack->album().data() != sender() )
return;
QVariantMap playInfo; QVariantMap playInfo;
playInfo["message"] = tr( "Tomahawk is playing \"%1\" by %2%3." ) playInfo["message"] = tr( "Tomahawk is playing \"%1\" by %2%3." )
.arg( m_currentTrack->track() ) .arg( m_currentTrack->track() )
.arg( m_currentTrack->artist()->name() ) .arg( m_currentTrack->artist()->name() )
.arg( m_currentTrack->album().isNull() ? QString() : QString( " %1" ).arg( tr( "on album %1" ).arg( m_currentTrack->album()->name() ) ) ); .arg( m_currentTrack->album().isNull() ? QString() : tr( " on album %1" ).arg( m_currentTrack->album()->name() ) );
if ( !output.isNull() && output.isValid() )
if ( !m_currentTrack->album().isNull() )
{ {
QImage cover; QVariantMap returnedData = output.value< QVariantMap >();
cover.loadFromData( m_currentTrack->album()->cover() ); const QByteArray ba = returnedData["imgbytes"].toByteArray();
playInfo["image"] = QVariant( cover ); if ( ba.length() )
{
QPixmap pm;
pm.loadFromData( ba );
playInfo["image"] = QVariant( pm.toImage() );
}
} }
Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo( Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo(
@@ -368,6 +394,32 @@ AudioEngine::onNowPlayingInfoReady()
} }
void
AudioEngine::infoSystemFinished( QString caller )
{
Q_UNUSED( caller );
}
void
AudioEngine::togglePrivateListeningMode()
{
tDebug() << Q_FUNC_INFO;
if ( TomahawkSettings::instance()->privateListeningMode() == TomahawkSettings::PublicListening )
TomahawkSettings::instance()->setPrivateListeningMode( TomahawkSettings::FullyPrivate );
else
TomahawkSettings::instance()->setPrivateListeningMode( TomahawkSettings::PublicListening );
#ifndef TOMAHAWK_HEADLESS
QAction *privacyToggle = ActionCollection::instance()->getAction( "togglePrivacy" );
bool isPublic = TomahawkSettings::instance()->privateListeningMode() == TomahawkSettings::PublicListening;
privacyToggle->setText( tr( QString( isPublic ? "&Listen Privately" : "&Listen Publicly" ).toAscii().constData() ) );
privacyToggle->setIconVisibleInMenu( isPublic );
#endif
}
bool bool
AudioEngine::loadTrack( const Tomahawk::result_ptr& result ) AudioEngine::loadTrack( const Tomahawk::result_ptr& result )
{ {
@@ -398,6 +450,9 @@ AudioEngine::loadTrack( const Tomahawk::result_ptr& result )
tLog() << "Starting new song:" << m_currentTrack->url(); tLog() << "Starting new song:" << m_currentTrack->url();
emit loading( m_currentTrack ); emit loading( m_currentTrack );
if ( QNetworkReply* qnr_io = qobject_cast< QNetworkReply* >( io.data() ) )
connect( qnr_io, SIGNAL( error( QNetworkReply::NetworkError ) ), this, SLOT( ioStreamError( QNetworkReply::NetworkError ) ) );
if ( !isHttpResult( m_currentTrack->url() ) && !isLocalResult( m_currentTrack->url() ) ) if ( !isHttpResult( m_currentTrack->url() ) && !isLocalResult( m_currentTrack->url() ) )
{ {
if ( QNetworkReply* qnr_io = qobject_cast< QNetworkReply* >( io.data() ) ) if ( QNetworkReply* qnr_io = qobject_cast< QNetworkReply* >( io.data() ) )
@@ -405,6 +460,7 @@ AudioEngine::loadTrack( const Tomahawk::result_ptr& result )
else else
m_mediaObject->setCurrentSource( io.data() ); m_mediaObject->setCurrentSource( io.data() );
m_mediaObject->currentSource().setAutoDelete( false ); m_mediaObject->currentSource().setAutoDelete( false );
m_isPlayingHttp = false;
} }
else else
{ {
@@ -425,11 +481,11 @@ AudioEngine::loadTrack( const Tomahawk::result_ptr& result )
if ( furl.startsWith( "file://" ) ) if ( furl.startsWith( "file://" ) )
furl = furl.right( furl.length() - 7 ); furl = furl.right( furl.length() - 7 );
#endif #endif
tLog( LOGVERBOSE ) << "Passing to Phonon:" << furl << furl.toLatin1();
m_mediaObject->setCurrentSource( furl ); m_mediaObject->setCurrentSource( furl );
} }
m_mediaObject->currentSource().setAutoDelete( true ); m_mediaObject->currentSource().setAutoDelete( true );
m_isPlayingHttp = true;
} }
if ( !m_input.isNull() ) if ( !m_input.isNull() )
@@ -442,8 +498,8 @@ AudioEngine::loadTrack( const Tomahawk::result_ptr& result )
emit started( m_currentTrack ); emit started( m_currentTrack );
if ( TomahawkSettings::instance()->verboseNotifications() ) if ( TomahawkSettings::instance()->verboseNotifications() )
sendNowPlayingNotification(); sendNowPlayingNotification();
if ( TomahawkSettings::instance()->privateListeningMode() != TomahawkSettings::FullyPrivate ) if ( TomahawkSettings::instance()->privateListeningMode() != TomahawkSettings::FullyPrivate )
{ {
DatabaseCommand_LogPlayback* cmd = new DatabaseCommand_LogPlayback( m_currentTrack, DatabaseCommand_LogPlayback::Started ); DatabaseCommand_LogPlayback* cmd = new DatabaseCommand_LogPlayback( m_currentTrack, DatabaseCommand_LogPlayback::Started );
@@ -527,7 +583,7 @@ AudioEngine::loadNextTrack()
void void
AudioEngine::playItem( Tomahawk::playlistinterface_ptr playlist, const Tomahawk::result_ptr& result ) AudioEngine::playItem( Tomahawk::PlaylistInterface* playlist, const Tomahawk::result_ptr& result )
{ {
tDebug( LOGEXTRA ) << Q_FUNC_INFO << ( result.isNull() ? QString() : result->url() ); tDebug( LOGEXTRA ) << Q_FUNC_INFO << ( result.isNull() ? QString() : result->url() );
@@ -535,7 +591,7 @@ AudioEngine::playItem( Tomahawk::playlistinterface_ptr playlist, const Tomahawk:
m_playlist.data()->reset(); m_playlist.data()->reset();
setPlaylist( playlist ); setPlaylist( playlist );
m_currentTrackPlaylist = playlist; m_currentTrackPlaylist = playlist->getSharedPointer();
if ( !result.isNull() ) if ( !result.isNull() )
loadTrack( result ); loadTrack( result );
@@ -543,24 +599,26 @@ AudioEngine::playItem( Tomahawk::playlistinterface_ptr playlist, const Tomahawk:
{ {
m_waitingOnNewTrack = true; m_waitingOnNewTrack = true;
if ( isStopped() ) if ( isStopped() )
emit sendWaitingNotification(); sendWaitingNotification();
else else
stop(); stop();
} }
} }
void
AudioEngine::ioStreamError( QNetworkReply::NetworkError error )
{
if ( error != QNetworkReply::NoError )
{
if ( canGoNext() )
loadNextTrack();
}
}
void void
AudioEngine::onPlaylistNextTrackReady() AudioEngine::playlistNextTrackReady()
{ {
// If in real-time and you have a few seconds left, you're probably lagging -- finish it up
if ( m_playlist && m_playlist->latchMode() == PlaylistInterface::RealTime && ( m_waitingOnNewTrack || m_currentTrack.isNull() || m_currentTrack->id() == 0 || ( currentTrackTotalTime() - currentTime() > 6000 ) ) )
{
m_waitingOnNewTrack = false;
loadNextTrack();
return;
}
if ( !m_waitingOnNewTrack ) if ( !m_waitingOnNewTrack )
return; return;
@@ -585,9 +643,6 @@ AudioEngine::onStateChanged( Phonon::State newState, Phonon::State oldState )
if ( newState == Phonon::ErrorState ) if ( newState == Phonon::ErrorState )
{ {
tLog() << "Phonon Error:" << m_mediaObject->errorString() << m_mediaObject->errorType(); tLog() << "Phonon Error:" << m_mediaObject->errorString() << m_mediaObject->errorType();
emit error( UnknownError );
stop();
return; return;
} }
if ( newState == Phonon::PlayingState ) if ( newState == Phonon::PlayingState )
@@ -659,26 +714,26 @@ AudioEngine::timerTriggered( qint64 time )
void void
AudioEngine::setPlaylist( Tomahawk::playlistinterface_ptr playlist ) AudioEngine::setPlaylist( PlaylistInterface* playlist )
{ {
if ( !m_playlist.isNull() ) if ( !m_playlist.isNull() )
{ {
if ( m_playlist.data() && m_playlist.data()->retryMode() == PlaylistInterface::Retry ) if ( m_playlist.data()->object() && m_playlist.data()->retryMode() == PlaylistInterface::Retry )
disconnect( m_playlist.data(), SIGNAL( nextTrackReady() ) ); disconnect( m_playlist.data()->object(), SIGNAL( nextTrackReady() ) );
m_playlist.data()->reset(); m_playlist.data()->reset();
} }
if ( playlist.isNull() ) if ( !playlist )
{ {
m_playlist.clear(); m_playlist.clear();
emit playlistChanged( playlist ); emit playlistChanged( playlist );
return; return;
} }
m_playlist = playlist; m_playlist = playlist->getSharedPointer();
if ( !m_playlist.isNull() && m_playlist.data() && m_playlist.data()->retryMode() == PlaylistInterface::Retry ) if ( m_playlist.data()->object() && m_playlist.data()->retryMode() == PlaylistInterface::Retry )
connect( m_playlist.data(), SIGNAL( nextTrackReady() ), SLOT( onPlaylistNextTrackReady() ) ); connect( m_playlist.data()->object(), SIGNAL( nextTrackReady() ), SLOT( playlistNextTrackReady() ) );
emit playlistChanged( playlist ); emit playlistChanged( playlist );
} }

View File

@@ -19,28 +19,34 @@
#ifndef AUDIOENGINE_H #ifndef AUDIOENGINE_H
#define AUDIOENGINE_H #define AUDIOENGINE_H
#include <QtCore/QObject> #include <QObject>
#include <QtCore/QTimer> #include <QTimer>
#include <QNetworkReply>
#include <phonon/MediaObject> #include <phonon/MediaObject>
#include <phonon/AudioOutput> #include <phonon/AudioOutput>
#include <phonon/BackendCapabilities> #include <phonon/BackendCapabilities>
#include "infosystem/infosystem.h"
#include "result.h" #include "result.h"
#include "typedefs.h" #include "typedefs.h"
#include "playlistinterface.h"
#include "dllmacro.h" #include "dllmacro.h"
#define AUDIO_VOLUME_STEP 5 #define AUDIO_VOLUME_STEP 5
namespace Tomahawk
{
class PlaylistInterface;
}
class DLLEXPORT AudioEngine : public QObject class DLLEXPORT AudioEngine : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
enum AudioErrorCode { StreamReadError, AudioDeviceError, DecodeError, UnknownError }; enum AudioErrorCode { StreamReadError, AudioDeviceError, DecodeError };
enum AudioState { Stopped, Playing, Paused }; enum AudioState { Stopped, Playing, Paused };
static AudioEngine* instance(); static AudioEngine* instance();
@@ -57,10 +63,10 @@ public:
bool isStopped() const { return m_state == Stopped; } bool isStopped() const { return m_state == Stopped; }
/* Returns the PlaylistInterface of the currently playing track. Note: This might be different to the current playlist! */ /* Returns the PlaylistInterface of the currently playing track. Note: This might be different to the current playlist! */
Tomahawk::playlistinterface_ptr currentTrackPlaylist() const { return m_currentTrackPlaylist; } Tomahawk::PlaylistInterface* currentTrackPlaylist() const { return m_currentTrackPlaylist.data(); }
/* Returns the PlaylistInterface of the current playlist. Note: The currently playing track might still be from a different playlist! */ /* Returns the PlaylistInterface of the current playlist. Note: The currently playing track might still be from a different playlist! */
Tomahawk::playlistinterface_ptr playlist() const { return m_playlist; } Tomahawk::PlaylistInterface* playlist() const { return m_playlist.data(); }
Tomahawk::result_ptr currentTrack() const { return m_currentTrack; } Tomahawk::result_ptr currentTrack() const { return m_currentTrack; }
@@ -85,11 +91,19 @@ public slots:
void setVolume( int percentage ); void setVolume( int percentage );
void lowerVolume() { setVolume( volume() - AUDIO_VOLUME_STEP ); } void lowerVolume() { setVolume( volume() - AUDIO_VOLUME_STEP ); }
void raiseVolume() { setVolume( volume() + AUDIO_VOLUME_STEP ); } void raiseVolume() { setVolume( volume() + AUDIO_VOLUME_STEP ); }
void onVolumeChanged( qreal volume ) { emit volumeChanged( volume * 100 ); }
void mute(); void mute();
void playItem( Tomahawk::playlistinterface_ptr playlist, const Tomahawk::result_ptr& result ); void playItem( Tomahawk::PlaylistInterface* playlist, const Tomahawk::result_ptr& result );
void setPlaylist( Tomahawk::playlistinterface_ptr playlist ); void setPlaylist( Tomahawk::PlaylistInterface* playlist );
void setQueue( Tomahawk::playlistinterface_ptr queue ) { m_queue = queue; } void setQueue( Tomahawk::PlaylistInterface* queue ) { m_queue = queue; }
void playlistNextTrackReady();
void infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output );
void infoSystemFinished( QString caller );
void togglePrivateListeningMode();
signals: signals:
void loading( const Tomahawk::result_ptr& track ); void loading( const Tomahawk::result_ptr& track );
@@ -108,11 +122,9 @@ signals:
void timerSeconds( unsigned int secondsElapsed ); void timerSeconds( unsigned int secondsElapsed );
void timerPercentage( unsigned int percentage ); void timerPercentage( unsigned int percentage );
void playlistChanged( Tomahawk::playlistinterface_ptr playlist ); void playlistChanged( Tomahawk::PlaylistInterface* playlist );
void error( AudioEngine::AudioErrorCode errorCode ); void error( AudioErrorCode errorCode );
void sendWaitingNotification();
private slots: private slots:
bool loadTrack( const Tomahawk::result_ptr& result ); bool loadTrack( const Tomahawk::result_ptr& result );
@@ -121,30 +133,28 @@ private slots:
void onAboutToFinish(); void onAboutToFinish();
void onStateChanged( Phonon::State newState, Phonon::State oldState ); void onStateChanged( Phonon::State newState, Phonon::State oldState );
void onVolumeChanged( qreal volume ) { emit volumeChanged( volume * 100 ); }
void timerTriggered( qint64 time ); void timerTriggered( qint64 time );
void setCurrentTrack( const Tomahawk::result_ptr& result ); void setCurrentTrack( const Tomahawk::result_ptr& result );
void onNowPlayingInfoReady();
void onPlaylistNextTrackReady();
void sendWaitingNotificationSlot() const;
void ioStreamError( QNetworkReply::NetworkError );
private: private:
void setState( AudioState state ); void setState( AudioState state );
bool isHttpResult( const QString& ) const; bool isHttpResult( const QString& ) const;
bool isLocalResult( const QString& ) const; bool isLocalResult( const QString& ) const;
void sendWaitingNotification() const;
void sendNowPlayingNotification(); void sendNowPlayingNotification();
bool m_isPlayingHttp;
QSharedPointer<QIODevice> m_input; QSharedPointer<QIODevice> m_input;
Tomahawk::result_ptr m_currentTrack; Tomahawk::result_ptr m_currentTrack;
Tomahawk::result_ptr m_lastTrack; Tomahawk::result_ptr m_lastTrack;
Tomahawk::playlistinterface_ptr m_playlist; QWeakPointer< Tomahawk::PlaylistInterface > m_playlist;
Tomahawk::playlistinterface_ptr m_currentTrackPlaylist; QWeakPointer< Tomahawk::PlaylistInterface > m_currentTrackPlaylist;
Tomahawk::playlistinterface_ptr m_queue; Tomahawk::PlaylistInterface* m_queue;
Phonon::MediaObject* m_mediaObject; Phonon::MediaObject* m_mediaObject;
Phonon::AudioOutput* m_audioOutput; Phonon::AudioOutput* m_audioOutput;
@@ -152,6 +162,7 @@ private:
unsigned int m_timeElapsed; unsigned int m_timeElapsed;
bool m_expectStop; bool m_expectStop;
bool m_waitingOnNewTrack; bool m_waitingOnNewTrack;
bool m_infoSystemConnected;
mutable QStringList m_supportedMimeTypes; mutable QStringList m_supportedMimeTypes;
AudioState m_state; AudioState m_state;

View File

@@ -33,12 +33,10 @@ Collection::Collection( const source_ptr& source, const QString& name, QObject*
: QObject( parent ) : QObject( parent )
, m_name( name ) , m_name( name )
, m_lastmodified( 0 ) , m_lastmodified( 0 )
, m_changed( false ) , m_isLoaded( false )
, m_source( source ) , m_source( source )
{ {
qDebug() << Q_FUNC_INFO << name << source->friendlyName(); qDebug() << Q_FUNC_INFO << name << source->friendlyName();
connect( source.data(), SIGNAL( synced() ), SLOT( onSynced() ) );
} }
@@ -149,24 +147,24 @@ Collection::deleteStation( const dynplaylist_ptr& s )
} }
Tomahawk::playlist_ptr playlist_ptr
Collection::playlist( const QString& guid ) Collection::playlist( const QString& guid )
{ {
return m_playlists.value( guid, Tomahawk::playlist_ptr() ); return m_playlists.value( guid, playlist_ptr() );
} }
Tomahawk::dynplaylist_ptr dynplaylist_ptr
Collection::autoPlaylist( const QString& guid ) Collection::autoPlaylist( const QString& guid )
{ {
return m_autoplaylists.value( guid, Tomahawk::dynplaylist_ptr() ); return m_autoplaylists.value( guid, dynplaylist_ptr() );
} }
Tomahawk::dynplaylist_ptr dynplaylist_ptr
Collection::station( const QString& guid ) Collection::station( const QString& guid )
{ {
return m_stations.value( guid, Tomahawk::dynplaylist_ptr() ); return m_stations.value( guid, dynplaylist_ptr() );
} }
@@ -211,32 +209,20 @@ Collection::setStations( const QList< dynplaylist_ptr >& stations )
void void
Collection::setTracks( const QList<unsigned int>& ids ) Collection::setTracks( const QList<unsigned int>& ids )
{ {
tDebug() << Q_FUNC_INFO << ids.count() << name(); qDebug() << Q_FUNC_INFO << ids.count() << name();
m_changed = true;
emit tracksAdded( ids ); emit tracksAdded( ids );
emit changed();
} }
void void
Collection::delTracks( const QList<unsigned int>& ids ) Collection::delTracks( const QList<unsigned int>& ids )
{ {
tDebug() << Q_FUNC_INFO << ids.count() << name(); qDebug() << Q_FUNC_INFO << ids.count() << name();
m_changed = true;
emit tracksRemoved( ids ); emit tracksRemoved( ids );
} emit changed();
void
Collection::onSynced()
{
tDebug() << Q_FUNC_INFO << m_changed;
if ( m_changed )
{
m_changed = false;
emit changed();
}
} }

View File

@@ -49,6 +49,8 @@ public:
Collection( const source_ptr& source, const QString& name, QObject* parent = 0 ); Collection( const source_ptr& source, const QString& name, QObject* parent = 0 );
virtual ~Collection(); virtual ~Collection();
virtual void setLoaded() { m_isLoaded = true; }
virtual bool isLoaded() const { return m_isLoaded; }
virtual QString name() const; virtual QString name() const;
virtual void loadPlaylists() { qDebug() << Q_FUNC_INFO; } virtual void loadPlaylists() { qDebug() << Q_FUNC_INFO; }
@@ -105,11 +107,8 @@ protected:
QString m_name; QString m_name;
unsigned int m_lastmodified; // unix time of last change to collection unsigned int m_lastmodified; // unix time of last change to collection
private slots:
void onSynced();
private: private:
bool m_changed; bool m_isLoaded;
source_ptr m_source; source_ptr m_source;
QHash< QString, Tomahawk::playlist_ptr > m_playlists; QHash< QString, Tomahawk::playlist_ptr > m_playlists;

View File

@@ -43,7 +43,7 @@ public:
virtual ~ContextPage() {} virtual ~ContextPage() {}
virtual QGraphicsWidget* widget() = 0; virtual QGraphicsWidget* widget() = 0;
virtual Tomahawk::playlistinterface_ptr playlistInterface() const = 0; virtual Tomahawk::PlaylistInterface* playlistInterface() const = 0;
virtual QString title() const = 0; virtual QString title() const = 0;
virtual QString description() const = 0; virtual QString description() const = 0;
@@ -52,9 +52,7 @@ public:
virtual bool jumpToCurrentTrack() = 0; virtual bool jumpToCurrentTrack() = 0;
public slots: public slots:
virtual void setArtist( const Tomahawk::artist_ptr& artist ) { Q_UNUSED( artist ); } virtual void setQuery( const Tomahawk::query_ptr& query ) = 0;
virtual void setAlbum( const Tomahawk::album_ptr& album ) { Q_UNUSED( album ); }
virtual void setQuery( const Tomahawk::query_ptr& query ) { Q_UNUSED( query ); }
signals: signals:
void nameChanged( const QString& ); void nameChanged( const QString& );

View File

@@ -33,7 +33,6 @@
#include "playlist/treemodel.h" #include "playlist/treemodel.h"
#include "utils/stylehelper.h" #include "utils/stylehelper.h"
#include "utils/tomahawkutilsgui.h"
#define ANIMATION_TIME 450 #define ANIMATION_TIME 450
#define SLIDE_TIME 350 #define SLIDE_TIME 350
@@ -94,7 +93,6 @@ ContextWidget::ContextWidget( QWidget* parent )
setAutoFillBackground( true ); setAutoFillBackground( true );
setFixedHeight( m_minHeight ); setFixedHeight( m_minHeight );
ensurePolished();
QPalette pal = palette(); QPalette pal = palette();
pal.setBrush( QPalette::Window, StyleHelper::headerLowerColor() ); pal.setBrush( QPalette::Window, StyleHelper::headerLowerColor() );
setPalette( pal ); setPalette( pal );
@@ -115,22 +113,6 @@ ContextWidget::~ContextWidget()
} }
void
ContextWidget::changeEvent( QEvent* e )
{
QWidget::changeEvent( e );
switch ( e->type() )
{
case QEvent::LanguageChange:
ui->retranslateUi( this );
break;
default:
break;
}
}
void void
ContextWidget::layoutViews( bool animate ) ContextWidget::layoutViews( bool animate )
{ {
@@ -230,44 +212,6 @@ ContextWidget::fadeOut( bool animate )
} }
void
ContextWidget::setArtist( const Tomahawk::artist_ptr& artist )
{
if ( artist.isNull() )
return;
m_artist = artist;
if ( height() > m_minHeight )
{
foreach ( ContextProxyPage* proxy, m_pages )
{
proxy->page()->setArtist( artist );
}
layoutViews( true );
}
}
void
ContextWidget::setAlbum( const Tomahawk::album_ptr& album )
{
if ( album.isNull() )
return;
m_album = album;
if ( height() > m_minHeight )
{
foreach ( ContextProxyPage* proxy, m_pages )
{
proxy->page()->setAlbum( album );
}
layoutViews( true );
}
}
void void
ContextWidget::setQuery( const Tomahawk::query_ptr& query, bool force ) ContextWidget::setQuery( const Tomahawk::query_ptr& query, bool force )
{ {
@@ -331,8 +275,6 @@ ContextWidget::onAnimationFinished()
fadeOut( false ); fadeOut( false );
m_scene->setSceneRect( ui->contextView->viewport()->rect() ); m_scene->setSceneRect( ui->contextView->viewport()->rect() );
layoutViews( false ); layoutViews( false );
setArtist( m_artist );
setAlbum( m_album );
setQuery( m_query, true ); setQuery( m_query, true );
ui->toggleButton->setText( tr( "Hide Footnotes" ) ); ui->toggleButton->setText( tr( "Hide Footnotes" ) );

View File

@@ -50,8 +50,6 @@ public:
~ContextWidget(); ~ContextWidget();
public slots: public slots:
void setArtist( const Tomahawk::artist_ptr& artist );
void setAlbum( const Tomahawk::album_ptr& album );
void setQuery( const Tomahawk::query_ptr& query, bool force = false ); void setQuery( const Tomahawk::query_ptr& query, bool force = false );
void toggleSize(); void toggleSize();
@@ -65,7 +63,6 @@ private slots:
protected: protected:
void paintEvent( QPaintEvent* e ); void paintEvent( QPaintEvent* e );
void resizeEvent( QResizeEvent* e ); void resizeEvent( QResizeEvent* e );
void changeEvent( QEvent* e );
private: private:
void fadeOut( bool animate ); void fadeOut( bool animate );
@@ -84,8 +81,6 @@ private:
int m_currentView; int m_currentView;
Tomahawk::artist_ptr m_artist;
Tomahawk::album_ptr m_album;
Tomahawk::query_ptr m_query; Tomahawk::query_ptr m_query;
bool m_visible; bool m_visible;
}; };

View File

@@ -32,7 +32,6 @@ RelatedArtistsContext::RelatedArtistsContext()
{ {
m_relatedView = new ArtistView(); m_relatedView = new ArtistView();
m_relatedView->setGuid( "RelatedArtistsContext" ); m_relatedView->setGuid( "RelatedArtistsContext" );
m_relatedView->setUpdatesContextView( false );
m_relatedModel = new TreeModel( m_relatedView ); m_relatedModel = new TreeModel( m_relatedView );
m_relatedModel->setColumnStyle( TreeModel::TrackOnly ); m_relatedModel->setColumnStyle( TreeModel::TrackOnly );
m_relatedView->setTreeModel( m_relatedModel ); m_relatedView->setTreeModel( m_relatedModel );
@@ -59,17 +58,15 @@ RelatedArtistsContext::~RelatedArtistsContext()
void void
RelatedArtistsContext::setArtist( const Tomahawk::artist_ptr& artist ) RelatedArtistsContext::setQuery( const Tomahawk::query_ptr& query )
{ {
if ( artist.isNull() ) if ( !m_query.isNull() && query->artist() == m_query->artist() )
return;
if ( !m_artist.isNull() && m_artist->name() == artist->name() )
return; return;
m_artist = artist; m_query = query;
Tomahawk::InfoSystem::InfoStringHash artistInfo; Tomahawk::InfoSystem::InfoStringHash artistInfo;
artistInfo["artist"] = artist->name(); artistInfo["artist"] = query->artist();
Tomahawk::InfoSystem::InfoRequestData requestData; Tomahawk::InfoSystem::InfoRequestData requestData;
requestData.caller = m_infoId; requestData.caller = m_infoId;
@@ -81,26 +78,6 @@ RelatedArtistsContext::setArtist( const Tomahawk::artist_ptr& artist )
} }
void
RelatedArtistsContext::setQuery( const Tomahawk::query_ptr& query )
{
if ( query.isNull() )
return;
setArtist( Artist::get( query->artist(), false ) );
}
void
RelatedArtistsContext::setAlbum( const Tomahawk::album_ptr& album )
{
if ( album.isNull() )
return;
setArtist( album->artist() );
}
void void
RelatedArtistsContext::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output ) RelatedArtistsContext::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output )
{ {
@@ -112,9 +89,9 @@ RelatedArtistsContext::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData req
if ( output.canConvert< QVariantMap >() ) if ( output.canConvert< QVariantMap >() )
{ {
if ( trackInfo["artist"] != m_artist->name() ) if ( trackInfo["artist"] != m_query->artist() )
{ {
qDebug() << "Returned info was for:" << trackInfo["artist"] << "- was looking for:" << m_artist->name(); qDebug() << "Returned info was for:" << trackInfo["artist"] << "- was looking for:" << m_query->artist();
return; return;
} }
} }

View File

@@ -23,8 +23,6 @@
#include "dllmacro.h" #include "dllmacro.h"
#include "artist.h"
#include "album.h"
#include "query.h" #include "query.h"
#include "context/ContextPage.h" #include "context/ContextPage.h"
#include "infosystem/infosystem.h" #include "infosystem/infosystem.h"
@@ -42,7 +40,7 @@ public:
virtual QGraphicsWidget* widget() { return m_proxy; } virtual QGraphicsWidget* widget() { return m_proxy; }
virtual Tomahawk::playlistinterface_ptr playlistInterface() const { return Tomahawk::playlistinterface_ptr(); } virtual Tomahawk::PlaylistInterface* playlistInterface() const { return 0; }
virtual QString title() const { return tr( "Related Artists" ); } virtual QString title() const { return tr( "Related Artists" ); }
virtual QString description() const { return QString(); } virtual QString description() const { return QString(); }
@@ -50,8 +48,6 @@ public:
virtual bool jumpToCurrentTrack() { return false; } virtual bool jumpToCurrentTrack() { return false; }
public slots: public slots:
virtual void setArtist( const Tomahawk::artist_ptr& artist );
virtual void setAlbum( const Tomahawk::album_ptr& album );
virtual void setQuery( const Tomahawk::query_ptr& query ); virtual void setQuery( const Tomahawk::query_ptr& query );
private slots: private slots:
@@ -65,7 +61,7 @@ private:
QGraphicsProxyWidget* m_proxy; QGraphicsProxyWidget* m_proxy;
QString m_infoId; QString m_infoId;
Tomahawk::artist_ptr m_artist; Tomahawk::query_ptr m_query;
}; };
#endif // RELATEDARTISTSCONTEXT_H #endif // RELATEDARTISTSCONTEXT_H

View File

@@ -58,17 +58,15 @@ TopTracksContext::~TopTracksContext()
void void
TopTracksContext::setArtist( const Tomahawk::artist_ptr& artist ) TopTracksContext::setQuery( const Tomahawk::query_ptr& query )
{ {
if ( artist.isNull() ) if ( !m_query.isNull() && query->artist() == m_query->artist() )
return;
if ( !m_artist.isNull() && m_artist->name() == artist->name() )
return; return;
m_artist = artist; m_query = query;
Tomahawk::InfoSystem::InfoStringHash artistInfo; Tomahawk::InfoSystem::InfoStringHash artistInfo;
artistInfo["artist"] = artist->name(); artistInfo["artist"] = query->artist();
Tomahawk::InfoSystem::InfoRequestData requestData; Tomahawk::InfoSystem::InfoRequestData requestData;
requestData.caller = m_infoId; requestData.caller = m_infoId;
@@ -80,26 +78,6 @@ TopTracksContext::setArtist( const Tomahawk::artist_ptr& artist )
} }
void
TopTracksContext::setAlbum( const Tomahawk::album_ptr& album )
{
if ( album.isNull() )
return;
setArtist( album->artist() );
}
void
TopTracksContext::setQuery( const Tomahawk::query_ptr& query )
{
if ( query.isNull() )
return;
setArtist( Artist::get( query->artist(), false ) );
}
void void
TopTracksContext::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output ) TopTracksContext::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output )
{ {
@@ -111,9 +89,9 @@ TopTracksContext::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestD
if ( output.canConvert< QVariantMap >() ) if ( output.canConvert< QVariantMap >() )
{ {
if ( trackInfo["artist"] != m_artist->name() ) if ( trackInfo["artist"] != m_query->artist() )
{ {
qDebug() << "Returned info was for:" << trackInfo["artist"] << "- was looking for:" << m_artist->name(); qDebug() << "Returned info was for:" << trackInfo["artist"] << "- was looking for:" << m_query->artist();
return; return;
} }
} }
@@ -129,7 +107,7 @@ TopTracksContext::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestD
int i = 0; int i = 0;
foreach ( const QString& track, tracks ) foreach ( const QString& track, tracks )
{ {
query_ptr query = Query::get( m_artist->name(), track, QString(), uuid() ); query_ptr query = Query::get( m_query->artist(), track, QString(), uuid() );
m_topHitsModel->append( query ); m_topHitsModel->append( query );
if ( ++i == 15 ) if ( ++i == 15 )

View File

@@ -23,8 +23,6 @@
#include "dllmacro.h" #include "dllmacro.h"
#include "artist.h"
#include "album.h"
#include "query.h" #include "query.h"
#include "context/ContextPage.h" #include "context/ContextPage.h"
#include "infosystem/infosystem.h" #include "infosystem/infosystem.h"
@@ -42,7 +40,7 @@ public:
virtual QGraphicsWidget* widget() { return m_proxy; } virtual QGraphicsWidget* widget() { return m_proxy; }
virtual Tomahawk::playlistinterface_ptr playlistInterface() const { return Tomahawk::playlistinterface_ptr(); } virtual Tomahawk::PlaylistInterface* playlistInterface() const { return 0; }
virtual QString title() const { return tr( "Top Hits" ); } virtual QString title() const { return tr( "Top Hits" ); }
virtual QString description() const { return QString(); } virtual QString description() const { return QString(); }
@@ -50,8 +48,6 @@ public:
virtual bool jumpToCurrentTrack() { return false; } virtual bool jumpToCurrentTrack() { return false; }
public slots: public slots:
virtual void setArtist( const Tomahawk::artist_ptr& artist );
virtual void setAlbum( const Tomahawk::album_ptr& album );
virtual void setQuery( const Tomahawk::query_ptr& query ); virtual void setQuery( const Tomahawk::query_ptr& query );
private slots: private slots:
@@ -65,7 +61,7 @@ private:
QGraphicsProxyWidget* m_proxy; QGraphicsProxyWidget* m_proxy;
QString m_infoId; QString m_infoId;
Tomahawk::artist_ptr m_artist; Tomahawk::query_ptr m_query;
}; };
#endif // TOPTRACKSCONTEXT_H #endif // TOPTRACKSCONTEXT_H

View File

@@ -21,70 +21,23 @@
using namespace Tomahawk; using namespace Tomahawk;
void
WikipediaContext::setArtist( const Tomahawk::artist_ptr& artist )
{
if ( artist.isNull() )
return;
if ( !m_artist.isNull() && m_artist->name() == artist->name() )
return;
m_artist = artist;
QString lang = QLocale::system().name().split("_").first();
webView()->load( QString( "http://%1.wikipedia.org/w/index.php?useformat=mobile&title=%2" ).arg( lang ).arg( m_artist->name() ) );
}
void
WikipediaContext::setAlbum( const Tomahawk::album_ptr& album )
{
if ( album.isNull() )
return;
setArtist( album->artist() );
}
void void
WikipediaContext::setQuery( const Tomahawk::query_ptr& query ) WikipediaContext::setQuery( const Tomahawk::query_ptr& query )
{ {
if ( query.isNull() ) if ( !m_query.isNull() && query->artist() == m_query->artist() )
return; return;
setArtist( Artist::get( query->artist(), false ) ); m_query = query;
} webView()->load( QString( "http://en.wikipedia.org/w/index.php?useformat=mobile&title=%1" ).arg( query->artist() ) );
void
LastfmContext::setArtist( const Tomahawk::artist_ptr& artist )
{
if ( artist.isNull() )
return;
if ( !m_artist.isNull() && m_artist->name() == artist->name() )
return;
m_artist = artist;
webView()->load( QString( "http://last.fm/music/%1" ).arg( m_artist->name() ) );
}
void
LastfmContext::setAlbum( const Tomahawk::album_ptr& album )
{
if ( album.isNull() )
return;
setArtist( album->artist() );
} }
void void
LastfmContext::setQuery( const Tomahawk::query_ptr& query ) LastfmContext::setQuery( const Tomahawk::query_ptr& query )
{ {
if ( query.isNull() ) if ( !m_query.isNull() && query->artist() == m_query->artist() )
return; return;
setArtist( Artist::get( query->artist(), false ) ); m_query = query;
webView()->load( QString( "http://last.fm/music/%1" ).arg( query->artist() ) );
} }

View File

@@ -23,8 +23,6 @@
#include "dllmacro.h" #include "dllmacro.h"
#include "artist.h"
#include "album.h"
#include "query.h" #include "query.h"
#include "WebContext.h" #include "WebContext.h"
@@ -36,7 +34,7 @@ public:
WikipediaContext() : WebContext() {} WikipediaContext() : WebContext() {}
~WikipediaContext() {} ~WikipediaContext() {}
virtual Tomahawk::playlistinterface_ptr playlistInterface() const { return Tomahawk::playlistinterface_ptr(); } virtual Tomahawk::PlaylistInterface* playlistInterface() const { return 0; }
virtual QString title() const { return tr( "Wikipedia" ); } virtual QString title() const { return tr( "Wikipedia" ); }
virtual QString description() const { return QString(); } virtual QString description() const { return QString(); }
@@ -44,12 +42,10 @@ public:
virtual bool jumpToCurrentTrack() { return false; } virtual bool jumpToCurrentTrack() { return false; }
public slots: public slots:
virtual void setArtist( const Tomahawk::artist_ptr& artist );
virtual void setAlbum( const Tomahawk::album_ptr& album );
virtual void setQuery( const Tomahawk::query_ptr& query ); virtual void setQuery( const Tomahawk::query_ptr& query );
private: private:
Tomahawk::artist_ptr m_artist; Tomahawk::query_ptr m_query;
}; };
@@ -61,7 +57,7 @@ public:
LastfmContext() : WebContext() {} LastfmContext() : WebContext() {}
~LastfmContext() {} ~LastfmContext() {}
virtual Tomahawk::playlistinterface_ptr playlistInterface() const { return Tomahawk::playlistinterface_ptr(); } virtual Tomahawk::PlaylistInterface* playlistInterface() const { return 0; }
virtual QString title() const { return tr( "Last.fm" ); } virtual QString title() const { return tr( "Last.fm" ); }
virtual QString description() const { return QString(); } virtual QString description() const { return QString(); }
@@ -69,12 +65,10 @@ public:
virtual bool jumpToCurrentTrack() { return false; } virtual bool jumpToCurrentTrack() { return false; }
public slots: public slots:
virtual void setArtist( const Tomahawk::artist_ptr& artist );
virtual void setAlbum( const Tomahawk::album_ptr& album );
virtual void setQuery( const Tomahawk::query_ptr& query ); virtual void setQuery( const Tomahawk::query_ptr& query );
private: private:
Tomahawk::artist_ptr m_artist; Tomahawk::query_ptr m_query;
}; };
#endif // WIKIPEDIACONTEXT_H #endif // WIKIPEDIACONTEXT_H

View File

@@ -32,19 +32,15 @@ using namespace Tomahawk;
ContextMenu::ContextMenu( QWidget* parent ) ContextMenu::ContextMenu( QWidget* parent )
: QMenu( parent ) : QMenu( parent )
, m_loveAction( 0 )
{ {
m_sigmap = new QSignalMapper( this ); m_sigmap = new QSignalMapper( this );
connect( m_sigmap, SIGNAL( mapped( int ) ), SLOT( onTriggered( int ) ) ); connect( m_sigmap, SIGNAL( mapped( int ) ), SLOT( onTriggered( int ) ) );
m_supportedActions = ActionPlay | ActionQueue | ActionCopyLink | ActionLove; m_supportedActions = ActionPlay | ActionQueue | ActionCopyLink;
} }
ContextMenu::~ContextMenu() ContextMenu::~ContextMenu()
{ {}
}
void void
ContextMenu::clear() ContextMenu::clear()
@@ -54,22 +50,23 @@ ContextMenu::clear()
m_queries.clear(); m_queries.clear();
m_albums.clear(); m_albums.clear();
m_artists.clear(); m_artists.clear();
}
}
unsigned int unsigned int
ContextMenu::itemCount() const ContextMenu::itemCount() const
{ {
return m_queries.count() + m_artists.count() + m_albums.count(); return m_queries.count() + m_artists.count() + m_albums.count();
} }
void void
ContextMenu::setQueries( const QList<Tomahawk::query_ptr>& queries ) ContextMenu::setQueries( const QList<Tomahawk::query_ptr>& queries )
{ {
if ( queries.isEmpty() ) if ( queries.isEmpty() )
return; return;
QMenu::clear(); QMenu::clear();
m_queries.clear(); m_queries.clear();
m_queries << queries; m_queries << queries;
@@ -82,25 +79,19 @@ ContextMenu::setQueries( const QList<Tomahawk::query_ptr>& queries )
addSeparator(); addSeparator();
if ( m_supportedActions & ActionLove && itemCount() == 1 )
{
m_loveAction = addAction( tr( "&Love" ) );
m_sigmap->setMapping( m_loveAction, ActionLove );
connect( queries.first().data(), SIGNAL( socialActionsLoaded() ), SLOT( onSocialActionsLoaded() ) );
onSocialActionsLoaded();
}
if ( m_supportedActions & ActionCopyLink && itemCount() == 1 ) if ( m_supportedActions & ActionCopyLink && itemCount() == 1 )
m_sigmap->setMapping( addAction( tr( "&Copy Track Link" ) ), ActionCopyLink ); m_sigmap->setMapping( addAction( tr( "Copy Track &Link" ) ), ActionCopyLink );
addSeparator(); addSeparator();
if ( m_supportedActions & ActionDelete ) if ( m_supportedActions & ActionDelete )
m_sigmap->setMapping( addAction( queries.count() > 1 ? tr( "&Delete Items" ) : tr( "&Delete Item" ) ), ActionDelete ); m_sigmap->setMapping( addAction( queries.count() > 1 ? tr( "&Delete Items" ) : tr( "&Delete Item" ) ), ActionDelete );
foreach ( QAction* action, actions() ) foreach ( QAction* action, actions() )
{ {
connect( action, SIGNAL( triggered() ), m_sigmap, SLOT( map() ) ); connect( action, SIGNAL( triggered() ), m_sigmap, SLOT( map() ) );
} }
} }
@@ -116,6 +107,7 @@ ContextMenu::setQuery( const Tomahawk::query_ptr& query )
} }
void void
ContextMenu::setAlbums( const QList<Tomahawk::album_ptr>& albums ) ContextMenu::setAlbums( const QList<Tomahawk::album_ptr>& albums )
{ {
@@ -127,7 +119,7 @@ ContextMenu::setAlbums( const QList<Tomahawk::album_ptr>& albums )
m_albums << albums; m_albums << albums;
if ( m_supportedActions & ActionPlay && itemCount() == 1 ) if ( m_supportedActions & ActionPlay && itemCount() == 1 )
m_sigmap->setMapping( addAction( tr( "Show &Album page" ) ), ActionPlay ); m_sigmap->setMapping( addAction( tr( "&Play" ) ), ActionPlay );
if ( m_supportedActions & ActionQueue ) if ( m_supportedActions & ActionQueue )
m_sigmap->setMapping( addAction( tr( "Add to &Queue" ) ), ActionQueue ); m_sigmap->setMapping( addAction( tr( "Add to &Queue" ) ), ActionQueue );
@@ -166,7 +158,7 @@ ContextMenu::setArtists( const QList<Tomahawk::artist_ptr>& artists )
m_artists << artists; m_artists << artists;
if ( m_supportedActions & ActionPlay && itemCount() == 1 ) if ( m_supportedActions & ActionPlay && itemCount() == 1 )
m_sigmap->setMapping( addAction( tr( "Show &Artist page" ) ), ActionPlay ); m_sigmap->setMapping( addAction( tr( "&Play" ) ), ActionPlay );
if ( m_supportedActions & ActionQueue ) if ( m_supportedActions & ActionQueue )
m_sigmap->setMapping( addAction( tr( "Add to &Queue" ) ), ActionQueue ); m_sigmap->setMapping( addAction( tr( "Add to &Queue" ) ), ActionQueue );
@@ -193,7 +185,6 @@ ContextMenu::setArtist( const Tomahawk::artist_ptr& artist )
setArtists( artists ); setArtists( artists );
} }
void void
ContextMenu::onTriggered( int action ) ContextMenu::onTriggered( int action )
{ {
@@ -207,10 +198,6 @@ ContextMenu::onTriggered( int action )
copyLink(); copyLink();
break; break;
case ActionLove:
m_queries.first()->setLoved( !m_queries.first()->loved() );
break;
default: default:
emit triggered( action ); emit triggered( action );
} }
@@ -218,8 +205,7 @@ ContextMenu::onTriggered( int action )
void void ContextMenu::addToQueue()
ContextMenu::addToQueue()
{ {
foreach ( const query_ptr& query, m_queries ) foreach ( const query_ptr& query, m_queries )
{ {
@@ -246,19 +232,3 @@ ContextMenu::copyLink()
GlobalActionManager::instance()->copyToClipboard( m_queries.first() ); GlobalActionManager::instance()->copyToClipboard( m_queries.first() );
} }
} }
void
ContextMenu::onSocialActionsLoaded()
{
if ( m_queries.first()->loved() )
{
m_loveAction->setText( tr( "Un-&Love" ) );
m_loveAction->setIcon( QIcon( RESPATH "images/not-loved.png" ) );
}
else
{
m_loveAction->setText( tr( "&Love" ) );
m_loveAction->setIcon( QIcon( RESPATH "images/loved.png" ) );
}
}

View File

@@ -19,8 +19,8 @@
#ifndef CONTEXTMENU_H #ifndef CONTEXTMENU_H
#define CONTEXTMENU_H #define CONTEXTMENU_H
#include <QtCore/QSignalMapper> #include <QSignalMapper>
#include <QtGui/QMenu> #include <QMenu>
#include "typedefs.h" #include "typedefs.h"
#include "dllmacro.h" #include "dllmacro.h"
@@ -38,8 +38,8 @@ public:
ActionPlay = 1, ActionPlay = 1,
ActionQueue = 2, ActionQueue = 2,
ActionDelete = 4, ActionDelete = 4,
ActionCopyLink = 8, ActionCopyLink = 8
ActionLove = 16
}; };
explicit ContextMenu( QWidget* parent = 0 ); explicit ContextMenu( QWidget* parent = 0 );
@@ -69,14 +69,10 @@ private slots:
void copyLink(); void copyLink();
void addToQueue(); void addToQueue();
void onSocialActionsLoaded();
private: private:
QSignalMapper* m_sigmap; QSignalMapper* m_sigmap;
int m_supportedActions; int m_supportedActions;
QAction* m_loveAction;
QList<Tomahawk::query_ptr> m_queries; QList<Tomahawk::query_ptr> m_queries;
QList<Tomahawk::artist_ptr> m_artists; QList<Tomahawk::artist_ptr> m_artists;
QList<Tomahawk::album_ptr> m_albums; QList<Tomahawk::album_ptr> m_albums;

View File

@@ -73,15 +73,7 @@ Database::loadIndex()
void void
Database::enqueue( const QList< QSharedPointer<DatabaseCommand> >& lc ) Database::enqueue( QSharedPointer<DatabaseCommand> lc )
{
qDebug() << "Enqueueing" << lc.count() << "commands to rw thread";
m_workerRW->enqueue( lc );
}
void
Database::enqueue( const QSharedPointer<DatabaseCommand>& lc )
{ {
if ( lc->doesMutates() ) if ( lc->doesMutates() )
{ {

View File

@@ -66,8 +66,7 @@ signals:
void newJobRW( QSharedPointer<DatabaseCommand> ); void newJobRW( QSharedPointer<DatabaseCommand> );
public slots: public slots:
void enqueue( const QSharedPointer<DatabaseCommand>& lc ); void enqueue( QSharedPointer<DatabaseCommand> lc );
void enqueue( const QList< QSharedPointer<DatabaseCommand> >& lc );
private slots: private slots:
void setIsReadyTrue() { m_ready = true; } void setIsReadyTrue() { m_ready = true; }

View File

@@ -69,8 +69,22 @@ DatabaseCollection::loadStations()
connect( cmd, SIGNAL( stationLoaded( Tomahawk::source_ptr, QVariantList ) ), connect( cmd, SIGNAL( stationLoaded( Tomahawk::source_ptr, QVariantList ) ),
SLOT( stationCreated( const Tomahawk::source_ptr&, const QVariantList& ) ) ); SLOT( stationCreated( const Tomahawk::source_ptr&, const QVariantList& ) ) );
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( cmd ) );}
/*void
DatabaseCollection::loadTracks()
{
qDebug() << Q_FUNC_INFO << source()->userName();
setLoaded();
DatabaseCommand_AllTracks* cmd = new DatabaseCommand_AllTracks( source()->collection() );
connect( cmd, SIGNAL( tracks( QList<Tomahawk::query_ptr>, QVariant ) ),
SLOT( setTracks( QList<Tomahawk::query_ptr> ) ) );
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( cmd ) ); Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( cmd ) );
} }*/
void void
@@ -129,8 +143,19 @@ DatabaseCollection::stations()
} }
void /*QList< Tomahawk::query_ptr >
DatabaseCollection::autoPlaylistCreated( const source_ptr& source, const QVariantList& data ) DatabaseCollection::tracks()
{
if ( !isLoaded() )
{
loadTracks();
}
return Collection::tracks();
}*/
void DatabaseCollection::autoPlaylistCreated( const source_ptr& source, const QVariantList& data )
{ {
dynplaylist_ptr p( new DynamicPlaylist( source, //src dynplaylist_ptr p( new DynamicPlaylist( source, //src
data[0].toString(), //current rev data[0].toString(), //current rev
@@ -147,8 +172,7 @@ DatabaseCollection::autoPlaylistCreated( const source_ptr& source, const QVarian
} }
void void DatabaseCollection::stationCreated( const source_ptr& source, const QVariantList& data )
DatabaseCollection::stationCreated( const source_ptr& source, const QVariantList& data )
{ {
dynplaylist_ptr p( new DynamicPlaylist( source, //src dynplaylist_ptr p( new DynamicPlaylist( source, //src
data[0].toString(), //current rev data[0].toString(), //current rev

View File

@@ -80,14 +80,12 @@ DatabaseCommand::setSource( const Tomahawk::source_ptr& s )
m_source = s; m_source = s;
} }
const Tomahawk::source_ptr& const Tomahawk::source_ptr&
DatabaseCommand::source() const DatabaseCommand::source() const
{ {
return m_source; return m_source;
} }
DatabaseCommand* DatabaseCommand*
DatabaseCommand::factory( const QVariant& op, const source_ptr& source ) DatabaseCommand::factory( const QVariant& op, const source_ptr& source )
{ {
@@ -141,8 +139,7 @@ DatabaseCommand::factory( const QVariant& op, const source_ptr& source )
cmd->setSource( source ); cmd->setSource( source );
QJson::QObjectHelper::qvariant2qobject( op.toMap(), cmd ); QJson::QObjectHelper::qvariant2qobject( op.toMap(), cmd );
return cmd; return cmd;
} } else if( name == "createdynamicplaylist" )
else if( name == "createdynamicplaylist" )
{ {
DatabaseCommand_CreateDynamicPlaylist * cmd = new DatabaseCommand_CreateDynamicPlaylist; DatabaseCommand_CreateDynamicPlaylist * cmd = new DatabaseCommand_CreateDynamicPlaylist;
cmd->setSource( source ); cmd->setSource( source );
@@ -186,7 +183,7 @@ DatabaseCommand::factory( const QVariant& op, const source_ptr& source )
return cmd; return cmd;
} }
qDebug() << "Unknown database command" << name; qDebug() << "ERROR in" << Q_FUNC_INFO << name;
// Q_ASSERT( false ); // Q_ASSERT( false );
return NULL; return NULL;
} }

View File

@@ -70,7 +70,6 @@ public:
const Tomahawk::source_ptr& source() const; const Tomahawk::source_ptr& source() const;
virtual bool loggable() const { return false; } virtual bool loggable() const { return false; }
virtual bool groupable() const { return false; }
virtual bool singletonCmd() const { return false; } virtual bool singletonCmd() const { return false; }
virtual bool localOnly() const { return false; } virtual bool localOnly() const { return false; }

View File

@@ -24,6 +24,7 @@
#include "album.h" #include "album.h"
#include "collection.h" #include "collection.h"
#include "database/database.h" #include "database/database.h"
#include "databasecommand_collectionstats.h"
#include "databaseimpl.h" #include "databaseimpl.h"
#include "network/dbsyncconnection.h" #include "network/dbsyncconnection.h"
#include "network/servent.h" #include "network/servent.h"
@@ -55,17 +56,32 @@ DatabaseCommand_AddFiles::files() const
void void
DatabaseCommand_AddFiles::postCommitHook() DatabaseCommand_AddFiles::postCommitHook()
{ {
if ( source().isNull() || source()->collection().isNull() )
{
qDebug() << "Source has gone offline, not emitting to GUI.";
return;
}
// make the collection object emit its tracksAdded signal, so the // make the collection object emit its tracksAdded signal, so the
// collection browser will update/fade in etc. // collection browser will update/fade in etc.
Collection* coll = source()->collection().data(); Collection* coll = source()->collection().data();
connect( this, SIGNAL( notify( QList<unsigned int> ) ), connect( this, SIGNAL( notify( QList<unsigned int> ) ),
coll, SLOT( setTracks( QList<unsigned int> ) ), Qt::QueuedConnection ); coll, SLOT( setTracks( QList<unsigned int> ) ),
Qt::QueuedConnection );
emit notify( m_ids ); emit notify( m_ids );
if ( source()->isLocal() ) if ( source()->isLocal() )
{
Servent::instance()->triggerDBSync(); Servent::instance()->triggerDBSync();
// Re-calculate local db stats
DatabaseCommand_CollectionStats* cmd = new DatabaseCommand_CollectionStats( SourceList::instance()->getLocal() );
connect( cmd, SIGNAL( done( QVariantMap ) ),
SourceList::instance()->getLocal().data(), SLOT( setStats( QVariantMap ) ), Qt::QueuedConnection );
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( cmd ) );
}
} }
@@ -78,23 +94,24 @@ DatabaseCommand_AddFiles::exec( DatabaseImpl* dbi )
TomahawkSqlQuery query_file = dbi->newquery(); TomahawkSqlQuery query_file = dbi->newquery();
TomahawkSqlQuery query_filejoin = dbi->newquery(); TomahawkSqlQuery query_filejoin = dbi->newquery();
TomahawkSqlQuery query_trackattr = dbi->newquery(); TomahawkSqlQuery query_trackattr = dbi->newquery();
TomahawkSqlQuery query_file_del = dbi->newquery();
query_file.prepare( "INSERT INTO file(source, url, size, mtime, md5, mimetype, duration, bitrate) VALUES (?, ?, ?, ?, ?, ?, ?, ?)" ); query_file.prepare( "INSERT INTO file(source, url, size, mtime, md5, mimetype, duration, bitrate) VALUES (?, ?, ?, ?, ?, ?, ?, ?)" );
query_filejoin.prepare( "INSERT INTO file_join(file, artist, album, track, albumpos, composer, discnumber) VALUES (?, ?, ?, ?, ?, ?, ?)" ); query_filejoin.prepare( "INSERT INTO file_join(file, artist, album, track, albumpos) VALUES (?, ?, ?, ?, ?)" );
query_trackattr.prepare( "INSERT INTO track_attributes(id, k, v) VALUES (?, ?, ?)" ); query_trackattr.prepare( "INSERT INTO track_attributes(id, k, v) VALUES (?, ?, ?)" );
query_file_del.prepare( QString( "DELETE FROM file WHERE source %1 AND url = ?" )
.arg( source()->isLocal() ? "IS NULL" : QString( "= %1" ).arg( source()->id() ) ) );
int added = 0; int added = 0;
QVariant srcid = source()->isLocal() ? QVariant( QVariant::Int ) : source()->id(); QVariant srcid = source()->isLocal() ? QVariant( QVariant::Int ) : source()->id();
qDebug() << "Adding" << m_files.length() << "files to db for source" << srcid; qDebug() << "Adding" << m_files.length() << "files to db for source" << srcid;
QList<QVariant>::iterator it; QList<QVariant>::iterator it;
for ( it = m_files.begin(); it != m_files.end(); ++it ) for( it = m_files.begin(); it != m_files.end(); ++it )
{ {
QVariant& v = *it; QVariant& v = *it;
QVariantMap m = v.toMap(); QVariantMap m = v.toMap();
int fileid = 0, artistid = 0, albumid = 0, trackid = 0, composerid = 0;
QString url = m.value( "url" ).toString(); QString url = m.value( "url" ).toString();
int mtime = m.value( "mtime" ).toInt(); int mtime = m.value( "mtime" ).toInt();
uint size = m.value( "size" ).toUInt(); uint size = m.value( "size" ).toUInt();
@@ -106,10 +123,12 @@ DatabaseCommand_AddFiles::exec( DatabaseImpl* dbi )
QString album = m.value( "album" ).toString(); QString album = m.value( "album" ).toString();
QString track = m.value( "track" ).toString(); QString track = m.value( "track" ).toString();
uint albumpos = m.value( "albumpos" ).toUInt(); uint albumpos = m.value( "albumpos" ).toUInt();
QString composer = m.value( "composer" ).toString();
uint discnumber = m.value( "discnumber" ).toUInt();
int year = m.value( "year" ).toInt(); int year = m.value( "year" ).toInt();
int fileid = 0, artistid = 0, albumid = 0, trackid = 0;
query_file_del.bindValue( 0, url );
query_file_del.exec();
query_file.bindValue( 0, srcid ); query_file.bindValue( 0, srcid );
query_file.bindValue( 1, url ); query_file.bindValue( 1, url );
query_file.bindValue( 2, size ); query_file.bindValue( 2, size );
@@ -118,17 +137,28 @@ DatabaseCommand_AddFiles::exec( DatabaseImpl* dbi )
query_file.bindValue( 5, mimetype ); query_file.bindValue( 5, mimetype );
query_file.bindValue( 6, duration ); query_file.bindValue( 6, duration );
query_file.bindValue( 7, bitrate ); query_file.bindValue( 7, bitrate );
query_file.exec(); if( !query_file.exec() )
{
if ( added % 1000 == 0 ) qDebug() << "Failed to insert to file:"
qDebug() << "Inserted" << added; << query_file.lastError().databaseText()
<< query_file.lastError().driverText()
<< query_file.boundValues();
continue;
}
else
{
if( added % 1000 == 0 )
qDebug() << "Inserted" << added;
}
// get internal IDs for art/alb/trk // get internal IDs for art/alb/trk
fileid = query_file.lastInsertId().toInt(); fileid = query_file.lastInsertId().toInt();
m.insert( "id", fileid ); m.insert( "id", fileid );
// this is the qvariant(map) the remote will get // this is the qvariant(map) the remote will get
v = m; v = m;
if( !source()->isLocal() )
url = QString( "servent://%1\t%2" ).arg( source()->userName() ).arg( url );
artistid = dbi->artistId( artist, true ); artistid = dbi->artistId( artist, true );
if ( artistid < 1 ) if ( artistid < 1 )
continue; continue;
@@ -137,17 +167,12 @@ DatabaseCommand_AddFiles::exec( DatabaseImpl* dbi )
continue; continue;
albumid = dbi->albumId( artistid, album, true ); albumid = dbi->albumId( artistid, album, true );
if( !composer.trimmed().isEmpty() )
composerid = dbi->artistId( composer, true );
// Now add the association // Now add the association
query_filejoin.bindValue( 0, fileid ); query_filejoin.bindValue( 0, fileid );
query_filejoin.bindValue( 1, artistid ); query_filejoin.bindValue( 1, artistid );
query_filejoin.bindValue( 2, albumid > 0 ? albumid : QVariant( QVariant::Int ) ); query_filejoin.bindValue( 2, albumid > 0 ? albumid : QVariant( QVariant::Int ) );
query_filejoin.bindValue( 3, trackid ); query_filejoin.bindValue( 3, trackid );
query_filejoin.bindValue( 4, albumpos ); query_filejoin.bindValue( 4, albumpos );
query_filejoin.bindValue( 5, composerid > 0 ? composerid : QVariant( QVariant::Int ) );
query_filejoin.bindValue( 6, discnumber );
if ( !query_filejoin.exec() ) if ( !query_filejoin.exec() )
{ {
qDebug() << "Error inserting into file_join table"; qDebug() << "Error inserting into file_join table";
@@ -159,6 +184,33 @@ DatabaseCommand_AddFiles::exec( DatabaseImpl* dbi )
query_trackattr.bindValue( 2, year ); query_trackattr.bindValue( 2, year );
query_trackattr.exec(); query_trackattr.exec();
/* QVariantMap attr;
Tomahawk::query_ptr query = Tomahawk::Query::get( artist, track, album );
attr["releaseyear"] = m.value( "year" );
Tomahawk::artist_ptr artistptr = Tomahawk::Artist::get( artistid, artist );
Tomahawk::album_ptr albumptr = Tomahawk::Album::get( albumid, album, artistptr );
Tomahawk::result_ptr result = Tomahawk::Result::get( url );
result->setModificationTime( mtime );
result->setSize( size );
result->setMimetype( mimetype );
result->setDuration( duration );
result->setBitrate( bitrate );
result->setArtist( artistptr );
result->setAlbum( albumptr );
result->setTrack( track );
result->setAlbumPos( albumpos );
result->setAttributes( attr );
result->setCollection( source()->collection() );
result->setScore( 1.0 );
result->setId( trackid );
QList<Tomahawk::result_ptr> results;
results << result;
query->addResults( results );
m_queries << query;*/
m_ids << fileid; m_ids << fileid;
added++; added++;
} }
@@ -167,6 +219,6 @@ DatabaseCommand_AddFiles::exec( DatabaseImpl* dbi )
if ( added ) if ( added )
source()->updateIndexWhenSynced(); source()->updateIndexWhenSynced();
tDebug() << "Committing" << added << "tracks..."; qDebug() << "Committing" << added << "tracks...";
emit done( m_files, source()->collection() ); emit done( m_files, source()->collection() );
} }

View File

@@ -35,21 +35,20 @@ DatabaseCommand_addSource::DatabaseCommand_addSource( const QString& username, c
void void
DatabaseCommand_addSource::exec( DatabaseImpl* dbi ) DatabaseCommand_addSource::exec( DatabaseImpl* dbi )
{ {
Q_ASSERT( !m_fname.isEmpty() );
TomahawkSqlQuery query = dbi->newquery(); TomahawkSqlQuery query = dbi->newquery();
query.prepare( "SELECT id FROM source WHERE name = ?" ); query.prepare( "SELECT id, friendlyname FROM source WHERE name = ?" );
query.addBindValue( m_username ); query.addBindValue( m_username );
query.exec(); query.exec();
if ( query.next() ) if ( query.next() )
{ {
unsigned int id = query.value( 0 ).toInt(); unsigned int id = query.value( 0 ).toInt();
QString fname = query.value( 1 ).toString();
query.prepare( "UPDATE source SET isonline = 'true', friendlyname = ? WHERE id = ?" ); query.prepare( "UPDATE source SET isonline = 'true', friendlyname = ? WHERE id = ?" );
query.addBindValue( m_fname ); query.addBindValue( m_fname );
query.addBindValue( id ); query.addBindValue( id );
query.exec(); query.exec();
emit done( id, m_fname ); emit done( id, fname );
return; return;
} }
@@ -60,7 +59,7 @@ DatabaseCommand_addSource::exec( DatabaseImpl* dbi )
query.exec(); query.exec();
unsigned int id = query.lastInsertId().toUInt(); unsigned int id = query.lastInsertId().toUInt();
tDebug() << "Inserted new source to DB, id:" << id << "friendlyname" << m_username; qDebug() << "Inserted new source to DB, id:" << id << " friendlyname" << m_username;
emit done( id, m_fname ); emit done( id, m_fname );
} }

View File

@@ -23,7 +23,6 @@
#include <QVariantMap> #include <QVariantMap>
#include "artist.h" #include "artist.h"
#include "collection.h"
#include "typedefs.h" #include "typedefs.h"
#include "databasecommand.h" #include "databasecommand.h"

View File

@@ -40,7 +40,7 @@ DatabaseCommand_AllTracks::exec( DatabaseImpl* dbi )
break; break;
case Album: case Album:
m_orderToken = "album.name, file_join.discnumber, file_join.albumpos"; m_orderToken = "album.name, file_join.albumpos";
break; break;
case ModificationTime: case ModificationTime:
@@ -48,7 +48,7 @@ DatabaseCommand_AllTracks::exec( DatabaseImpl* dbi )
break; break;
case AlbumPosition: case AlbumPosition:
m_orderToken = "file_join.discnumber, file_join.albumpos"; m_orderToken = "file_join.albumpos";
break; break;
} }
@@ -60,7 +60,7 @@ DatabaseCommand_AllTracks::exec( DatabaseImpl* dbi )
{ {
if ( m_album->id() == 0 ) if ( m_album->id() == 0 )
{ {
m_artist = m_album->artist(); m_artist = m_album->artist().data();
albumToken = QString( "AND album.id IS NULL" ); albumToken = QString( "AND album.id IS NULL" );
} }
else else
@@ -68,15 +68,11 @@ DatabaseCommand_AllTracks::exec( DatabaseImpl* dbi )
} }
QString sql = QString( QString sql = QString(
"SELECT file.id, artist.name, album.name, track.name, composer.name, file.size, " //0 "SELECT file.id, artist.name, album.name, track.name, file.size, "
"file.duration, file.bitrate, file.url, file.source, file.mtime, " //6 "file.duration, file.bitrate, file.url, file.source, file.mtime, file.mimetype, file_join.albumpos, artist.id, album.id, track.id "
"file.mimetype, file_join.discnumber, file_join.albumpos, artist.id, " //11
"album.id, track.id, composer.id " //15
"FROM file, artist, track, file_join " "FROM file, artist, track, file_join "
"LEFT OUTER JOIN album " "LEFT OUTER JOIN album "
"ON file_join.album = album.id " "ON file_join.album = album.id "
"LEFT OUTER JOIN artist AS composer "
"ON file_join.composer = composer.id "
"WHERE file.id = file_join.file " "WHERE file.id = file_join.file "
"AND file_join.artist = artist.id " "AND file_join.artist = artist.id "
"AND file_join.track = track.id " "AND file_join.track = track.id "
@@ -96,15 +92,15 @@ DatabaseCommand_AllTracks::exec( DatabaseImpl* dbi )
while( query.next() ) while( query.next() )
{ {
Tomahawk::source_ptr s; Tomahawk::source_ptr s;
QString url = query.value( 8 ).toString(); QString url = query.value( 7 ).toString();
if ( query.value( 9 ).toUInt() == 0 ) if ( query.value( 8 ).toUInt() == 0 )
{ {
s = SourceList::instance()->getLocal(); s = SourceList::instance()->getLocal();
} }
else else
{ {
s = SourceList::instance()->get( query.value( 9 ).toUInt() ); s = SourceList::instance()->get( query.value( 8 ).toUInt() );
if ( s.isNull() ) if ( s.isNull() )
{ {
Q_ASSERT( false ); Q_ASSERT( false );
@@ -114,30 +110,26 @@ DatabaseCommand_AllTracks::exec( DatabaseImpl* dbi )
url = QString( "servent://%1\t%2" ).arg( s->userName() ).arg( url ); url = QString( "servent://%1\t%2" ).arg( s->userName() ).arg( url );
} }
QString artist, track, album, composer; QString artist, track, album;
artist = query.value( 1 ).toString(); artist = query.value( 1 ).toString();
album = query.value( 2 ).toString(); album = query.value( 2 ).toString();
track = query.value( 3 ).toString(); track = query.value( 3 ).toString();
composer = query.value( 4 ).toString();
Tomahawk::result_ptr result = Tomahawk::Result::get( url ); Tomahawk::result_ptr result = Tomahawk::Result::get( url );
Tomahawk::query_ptr qry = Tomahawk::Query::get( artist, track, album ); Tomahawk::query_ptr qry = Tomahawk::Query::get( artist, track, album );
Tomahawk::artist_ptr artistptr = Tomahawk::Artist::get( query.value( 14 ).toUInt(), artist ); Tomahawk::artist_ptr artistptr = Tomahawk::Artist::get( query.value( 12 ).toUInt(), artist );
Tomahawk::artist_ptr composerptr = Tomahawk::Artist::get( query.value( 17 ).toUInt(), composer ); Tomahawk::album_ptr albumptr = Tomahawk::Album::get( query.value( 13 ).toUInt(), album, artistptr );
Tomahawk::album_ptr albumptr = Tomahawk::Album::get( query.value( 15 ).toUInt(), album, artistptr );
result->setTrackId( query.value( 16 ).toUInt() ); result->setTrackId( query.value( 14 ).toUInt() );
result->setArtist( artistptr ); result->setArtist( artistptr );
result->setAlbum( albumptr ); result->setAlbum( albumptr );
result->setTrack( query.value( 3 ).toString() ); result->setTrack( query.value( 3 ).toString() );
result->setComposer( composerptr ); result->setSize( query.value( 4 ).toUInt() );
result->setSize( query.value( 5 ).toUInt() ); result->setDuration( query.value( 5 ).toUInt() );
result->setDuration( query.value( 6 ).toUInt() ); result->setBitrate( query.value( 6 ).toUInt() );
result->setBitrate( query.value( 7 ).toUInt() ); result->setModificationTime( query.value( 9 ).toUInt() );
result->setModificationTime( query.value( 10 ).toUInt() ); result->setMimetype( query.value( 10 ).toString() );
result->setMimetype( query.value( 11 ).toString() ); result->setAlbumPos( query.value( 11 ).toUInt() );
result->setDiscNumber( query.value( 12 ).toUInt() );
result->setAlbumPos( query.value( 13 ).toUInt() );
result->setScore( 1.0 ); result->setScore( 1.0 );
result->setCollection( s->collection() ); result->setCollection( s->collection() );

View File

@@ -26,8 +26,6 @@
#include "collection.h" #include "collection.h"
#include "typedefs.h" #include "typedefs.h"
#include "query.h" #include "query.h"
#include "artist.h"
#include "album.h"
#include "dllmacro.h" #include "dllmacro.h"
@@ -57,8 +55,8 @@ public:
virtual bool doesMutates() const { return false; } virtual bool doesMutates() const { return false; }
virtual QString commandname() const { return "alltracks"; } virtual QString commandname() const { return "alltracks"; }
void setArtist( const Tomahawk::artist_ptr& artist ) { m_artist = artist; } void setArtist( Tomahawk::Artist* artist ) { m_artist = artist; }
void setAlbum( const Tomahawk::album_ptr& album ) { m_album = album; } void setAlbum( Tomahawk::Album* album ) { m_album = album; }
void setLimit( unsigned int amount ) { m_amount = amount; } void setLimit( unsigned int amount ) { m_amount = amount; }
void setSortOrder( DatabaseCommand_AllTracks::SortOrder order ) { m_sortOrder = order; } void setSortOrder( DatabaseCommand_AllTracks::SortOrder order ) { m_sortOrder = order; }
@@ -71,8 +69,8 @@ signals:
private: private:
Tomahawk::collection_ptr m_collection; Tomahawk::collection_ptr m_collection;
Tomahawk::artist_ptr m_artist; Tomahawk::Artist* m_artist;
Tomahawk::album_ptr m_album; Tomahawk::Album* m_album;
unsigned int m_amount; unsigned int m_amount;
DatabaseCommand_AllTracks::SortOrder m_sortOrder; DatabaseCommand_AllTracks::SortOrder m_sortOrder;

View File

@@ -1,6 +1,6 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> === /* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
* *
* Copyright 2010-2011, Leo Franchi <lfranchi@kde.org> * Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* *
* Tomahawk is free software: you can redistribute it and/or modify * Tomahawk is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -28,13 +28,10 @@
#include "dynamic/GeneratorInterface.h" #include "dynamic/GeneratorInterface.h"
#include "source.h" #include "source.h"
#include "viewmanager.h"
#include "network/servent.h" #include "network/servent.h"
#include "utils/logger.h" #include "utils/logger.h"
#ifndef ENABLE_HEADLESS
#include "viewmanager.h"
#endif
using namespace Tomahawk; using namespace Tomahawk;
@@ -114,13 +111,11 @@ DatabaseCommand_CreateDynamicPlaylist::postCommitHook()
qDebug() << Q_FUNC_INFO << "..reporting.."; qDebug() << Q_FUNC_INFO << "..reporting..";
if( m_playlist.isNull() ) { if( m_playlist.isNull() ) {
source_ptr src = source(); source_ptr src = source();
#ifndef ENABLE_HEADLESS
QMetaObject::invokeMethod( ViewManager::instance(), QMetaObject::invokeMethod( ViewManager::instance(),
"createDynamicPlaylist", "createDynamicPlaylist",
Qt::BlockingQueuedConnection, Qt::BlockingQueuedConnection,
QGenericArgument( "Tomahawk::source_ptr", (const void*)&src ), QGenericArgument( "Tomahawk::source_ptr", (const void*)&src ),
Q_ARG( QVariant, m_v ) ); Q_ARG( QVariant, m_v ) );
#endif
} else { } else {
m_playlist->reportCreated( m_playlist ); m_playlist->reportCreated( m_playlist );
} }

View File

@@ -1,6 +1,6 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> === /* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
* *
* Copyright 2010-2011, Leo Franchi <lfranchi@kde.org> * Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* *
* Tomahawk is free software: you can redistribute it and/or modify * Tomahawk is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View File

@@ -21,15 +21,12 @@
#include <QSqlQuery> #include <QSqlQuery>
#include "source.h" #include "source.h"
#include "viewmanager.h"
#include "databaseimpl.h" #include "databaseimpl.h"
#include "tomahawksqlquery.h" #include "tomahawksqlquery.h"
#include "network/servent.h" #include "network/servent.h"
#include "utils/logger.h" #include "utils/logger.h"
#ifndef ENABLE_HEADLESS
#include "viewmanager.h"
#endif
using namespace Tomahawk; using namespace Tomahawk;
@@ -82,13 +79,11 @@ DatabaseCommand_CreatePlaylist::postCommitHook()
if ( m_playlist.isNull() ) if ( m_playlist.isNull() )
{ {
source_ptr src = source(); source_ptr src = source();
#ifndef ENABLE_HEADLESS
QMetaObject::invokeMethod( ViewManager::instance(), QMetaObject::invokeMethod( ViewManager::instance(),
"createPlaylist", "createPlaylist",
Qt::BlockingQueuedConnection, Qt::BlockingQueuedConnection,
QGenericArgument( "Tomahawk::source_ptr", (const void*)&src ), QGenericArgument( "Tomahawk::source_ptr", (const void*)&src ),
Q_ARG( QVariant, m_v ) ); Q_ARG( QVariant, m_v ) );
#endif
} }
else else
{ {

View File

@@ -18,14 +18,15 @@
#include "databasecommand_deletefiles.h" #include "databasecommand_deletefiles.h"
#include <QtSql/QSqlQuery> #include <QSqlQuery>
#include "artist.h" #include "artist.h"
#include "album.h" #include "album.h"
#include "collection.h" #include "collection.h"
#include "source.h" #include "source.h"
#include "database/database.h" #include "database/database.h"
#include "database/databaseimpl.h" #include "databasecommand_collectionstats.h"
#include "databaseimpl.h"
#include "network/servent.h" #include "network/servent.h"
#include "utils/logger.h" #include "utils/logger.h"
#include "utils/tomahawkutils.h" #include "utils/tomahawkutils.h"
@@ -37,7 +38,7 @@ using namespace Tomahawk;
void void
DatabaseCommand_DeleteFiles::postCommitHook() DatabaseCommand_DeleteFiles::postCommitHook()
{ {
if ( !m_idList.count() ) if ( !m_files.count() )
return; return;
// make the collection object emit its tracksAdded signal, so the // make the collection object emit its tracksAdded signal, so the
@@ -47,10 +48,13 @@ DatabaseCommand_DeleteFiles::postCommitHook()
connect( this, SIGNAL( notify( QList<unsigned int> ) ), connect( this, SIGNAL( notify( QList<unsigned int> ) ),
coll, SLOT( delTracks( QList<unsigned int> ) ), Qt::QueuedConnection ); coll, SLOT( delTracks( QList<unsigned int> ) ), Qt::QueuedConnection );
tDebug() << "Notifying of deleted tracks:" << m_idList.size() << "from source" << source()->id(); tDebug() << "Notifying of deleted tracks:" << m_ids.size() << "from source" << source()->id();
emit notify( m_idList ); QList<unsigned int> ids;
foreach ( QVariant id, m_ids )
ids << id.toUInt();
emit notify( ids );
if ( source()->isLocal() ) if( source()->isLocal() )
Servent::instance()->triggerDBSync(); Servent::instance()->triggerDBSync();
} }
@@ -60,80 +64,113 @@ DatabaseCommand_DeleteFiles::exec( DatabaseImpl* dbi )
{ {
Q_ASSERT( !source().isNull() ); Q_ASSERT( !source().isNull() );
int srcid = source()->isLocal() ? 0 : source()->id(); QVariant srcid = source()->isLocal() ? QVariant( QVariant::Int ) : source()->id();
TomahawkSqlQuery delquery = dbi->newquery(); TomahawkSqlQuery delquery = dbi->newquery();
QString lastPath;
if ( m_deleteAll ) if ( source()->isLocal() )
{
TomahawkSqlQuery dirquery = dbi->newquery();
dirquery.prepare( QString( "SELECT id FROM file WHERE source %1" )
.arg( source()->isLocal() ? "IS NULL" : QString( "= %1" ).arg( source()->id() ) ) );
dirquery.exec();
while ( dirquery.next() )
m_idList << dirquery.value( 0 ).toUInt();
}
else if ( source()->isLocal() )
{ {
if ( m_dir.path() != QString( "." ) ) if ( m_dir.path() != QString( "." ) )
{ {
tDebug() << "Deleting" << m_dir.path() << "from db for localsource" << srcid; tDebug() << "Deleting" << m_dir.path() << "from db for localsource" << srcid;
TomahawkSqlQuery dirquery = dbi->newquery(); TomahawkSqlQuery dirquery = dbi->newquery();
QString path( "file://" + m_dir.canonicalPath() + "/%" ); QString path( "file://" + m_dir.canonicalPath() + "/%" );
dirquery.prepare( QString( "SELECT id FROM file WHERE source IS NULL AND url LIKE '%1'" ).arg( TomahawkUtils::sqlEscape( path ) ) ); dirquery.prepare( QString( "SELECT id, url FROM file WHERE source IS NULL AND url LIKE '%1'" ).arg( TomahawkUtils::sqlEscape( path ) ) );
dirquery.exec(); dirquery.exec();
while ( dirquery.next() ) while ( dirquery.next() )
{ {
m_ids << dirquery.value( 0 ); QFileInfo fi( dirquery.value( 1 ).toString().mid( 7 ) ); // remove file://
m_idList << dirquery.value( 0 ).toUInt(); if ( fi.canonicalPath() != m_dir.canonicalPath() )
{
if ( lastPath != fi.canonicalPath() )
tDebug() << "Skipping subdir:" << fi.canonicalPath();
lastPath = fi.canonicalPath();
continue;
}
m_files << dirquery.value( 1 ).toString();
m_ids << dirquery.value( 0 ).toUInt();
} }
} }
else if ( !m_ids.isEmpty() ) else if ( !m_ids.isEmpty() )
{ {
tDebug() << Q_FUNC_INFO << "deleting given ids"; tDebug() << Q_FUNC_INFO << "deleting given ids";
foreach ( const QVariant& id, m_ids ) TomahawkSqlQuery dirquery = dbi->newquery();
m_idList << id.toUInt();
QString idstring;
foreach( const QVariant& id, m_ids )
idstring.append( id.toString() + ", " );
idstring.chop( 2 ); //remove the trailing ", "
dirquery.prepare( QString( "SELECT id, url FROM file WHERE source IS NULL AND id IN ( %1 )" ).arg( idstring ) );
dirquery.exec();
while ( dirquery.next() )
{
m_files << dirquery.value( 1 ).toString();
}
} }
else if ( m_deleteAll )
{
TomahawkSqlQuery dirquery = dbi->newquery();
dirquery.prepare( QString( "SELECT id, url FROM file WHERE source IS NULL" ) );
dirquery.exec();
while ( dirquery.next() )
{
m_ids << dirquery.value( 0 ).toString();
m_files << dirquery.value( 1 ).toString();
}
}
}
else
{
if ( m_deleteAll )
{
TomahawkSqlQuery dirquery = dbi->newquery();
dirquery.prepare( QString( "SELECT url FROM file WHERE source = %1" ).arg( source()->id() ) );
dirquery.exec();
while ( dirquery.next() )
m_ids << dirquery.value( 0 ).toString();
}
foreach( const QVariant& id, m_ids )
m_files << QString( "servent://%1\t%2" ).arg( source()->userName() ).arg( id.toString() );
} }
if ( m_deleteAll ) if ( m_deleteAll )
{ {
delquery.prepare( QString( "DELETE FROM file WHERE source %1" ) if ( !m_ids.isEmpty() )
.arg( source()->isLocal() ? "IS NULL" : QString( "= %1" ).arg( source()->id() ) ) ); {
delquery.exec(); delquery.prepare( QString( "DELETE FROM file WHERE source %1" )
.arg( source()->isLocal() ? "IS NULL" : QString( "= %1" ).arg( source()->id() ) ) );
delquery.exec();
}
} }
else if ( !m_ids.isEmpty() ) else if ( !m_ids.isEmpty() )
{ {
delquery.prepare( QString( "DELETE FROM file WHERE source %1 AND %2 IN ( ? )" )
.arg( source()->isLocal() ? "IS NULL" : QString( "= %1" ).arg( source()->id() ) )
.arg( source()->isLocal() ? "id" : "url" ) );
QString idstring; QString idstring;
foreach ( const QVariant& id, m_ids ) foreach( const QVariant& id, m_ids )
idstring.append( id.toString() + ", " ); idstring.append( id.toString() + ", " );
idstring.chop( 2 ); //remove the trailing ", " idstring.chop( 2 ); //remove the trailing ", "
if ( !source()->isLocal() ) delquery.prepare( QString( "DELETE FROM file WHERE source %1 AND %2 IN ( %3 )" )
{
delquery.prepare( QString( "SELECT id FROM file WHERE source = %1 AND url IN ( %2 )" )
.arg( source()->id() )
.arg( idstring ) );
delquery.exec();
idstring = QString();
while ( delquery.next() )
{
idstring.append( delquery.value( 0 ).toString() + ", " );
m_idList << delquery.value( 0 ).toUInt();
}
idstring.chop( 2 ); //remove the trailing ", "
}
delquery.prepare( QString( "DELETE FROM file WHERE source %1 AND id IN ( %2 )" )
.arg( source()->isLocal() ? "IS NULL" : QString( "= %1" ).arg( source()->id() ) ) .arg( source()->isLocal() ? "IS NULL" : QString( "= %1" ).arg( source()->id() ) )
.arg( source()->isLocal() ? "id" : "url" )
.arg( idstring ) ); .arg( idstring ) );
delquery.exec(); delquery.exec();
} }
if ( m_idList.count() ) emit done( m_files, source()->collection() );
source()->updateIndexWhenSynced();
emit done( m_idList, source()->collection() );
} }

View File

@@ -19,9 +19,9 @@
#ifndef DATABASECOMMAND_DELETEFILES_H #ifndef DATABASECOMMAND_DELETEFILES_H
#define DATABASECOMMAND_DELETEFILES_H #define DATABASECOMMAND_DELETEFILES_H
#include <QtCore/QObject> #include <QObject>
#include <QtCore/QDir> #include <QDir>
#include <QtCore/QVariantMap> #include <QVariantMap>
#include "database/databasecommandloggable.h" #include "database/databasecommandloggable.h"
#include "typedefs.h" #include "typedefs.h"
@@ -64,7 +64,6 @@ public:
virtual void exec( DatabaseImpl* ); virtual void exec( DatabaseImpl* );
virtual bool doesMutates() const { return true; } virtual bool doesMutates() const { return true; }
virtual bool localOnly() const { return false; } virtual bool localOnly() const { return false; }
virtual bool groupable() const { return true; }
virtual void postCommitHook(); virtual void postCommitHook();
QVariantList ids() const { return m_ids; } QVariantList ids() const { return m_ids; }
@@ -74,13 +73,13 @@ public:
void setDeleteAll( const bool deleteAll ) { m_deleteAll = deleteAll; } void setDeleteAll( const bool deleteAll ) { m_deleteAll = deleteAll; }
signals: signals:
void done( const QList<unsigned int>&, const Tomahawk::collection_ptr& ); void done( const QStringList&, const Tomahawk::collection_ptr& );
void notify( const QList<unsigned int>& ids ); void notify( const QList<unsigned int>& ids );
private: private:
QStringList m_files;
QDir m_dir; QDir m_dir;
QVariantList m_ids; QVariantList m_ids;
QList<unsigned int> m_idList;
bool m_deleteAll; bool m_deleteAll;
}; };

View File

@@ -40,8 +40,8 @@ DatabaseCommand_FileMtimes::execSelect( DatabaseImpl* dbi )
TomahawkSqlQuery query = dbi->newquery(); TomahawkSqlQuery query = dbi->newquery();
if( m_prefix.isEmpty() && m_prefixes.isEmpty() ) if( m_prefix.isEmpty() && m_prefixes.isEmpty() )
{ {
QString limit( m_checkonly ? QString( "LIMIT 1" ) : QString() ); QString limit( m_checkonly ? QString( " LIMIT 1" ) : QString() );
query.exec( QString( "SELECT url, id, mtime FROM file WHERE source IS NULL %1" ).arg( limit ) ); query.exec( QString( "SELECT url, id, mtime FROM file WHERE source IS NULL%1" ).arg( limit ) );
while( query.next() ) while( query.next() )
{ {
QMap< unsigned int, unsigned int > map; QMap< unsigned int, unsigned int > map;

View File

@@ -19,11 +19,10 @@
#include "databasecommand_genericselect.h" #include "databasecommand_genericselect.h"
#include "databaseimpl.h" #include "databaseimpl.h"
#include "sourcelist.h"
#include "artist.h"
#include "album.h"
#include "pipeline.h"
#include "utils/logger.h" #include "utils/logger.h"
#include <sourcelist.h>
#include <artist.h>
#include <album.h>
using namespace Tomahawk; using namespace Tomahawk;
@@ -64,6 +63,7 @@ DatabaseCommand_GenericSelect::exec( DatabaseImpl* dbi )
while( query.next() ) while( query.next() )
{ {
QStringList rawRow; QStringList rawRow;
int count = 0; int count = 0;
while ( query.value( count ).isValid() ) while ( query.value( count ).isValid() )
@@ -90,16 +90,15 @@ DatabaseCommand_GenericSelect::exec( DatabaseImpl* dbi )
track = query.value( 0 ).toString(); track = query.value( 0 ).toString();
artist = query.value( 1 ).toString(); artist = query.value( 1 ).toString();
qry = Tomahawk::Query::get( artist, track, QString() );
} qry = Tomahawk::Query::get( artist, track, QString(), uuid(), true ); // Only auto-resolve non-local results
else if ( m_queryType == Artist ) } else if ( m_queryType == Artist )
{ {
int artistId = query.value( 0 ).toInt(); int artistId = query.value( 0 ).toInt();
QString artistName = query.value( 1 ).toString(); QString artistName = query.value( 1 ).toString();
artist = Tomahawk::Artist::get( artistId, artistName ); artist = Tomahawk::Artist::get( artistId, artistName );
} } else if ( m_queryType == Album )
else if ( m_queryType == Album )
{ {
int albumId = query.value( 0 ).toInt(); int albumId = query.value( 0 ).toInt();
QString albumName = query.value( 1 ).toString(); QString albumName = query.value( 1 ).toString();
@@ -123,14 +122,12 @@ DatabaseCommand_GenericSelect::exec( DatabaseImpl* dbi )
if ( !extraData.isEmpty() ) if ( !extraData.isEmpty() )
qry->setProperty( "data", extraData ); qry->setProperty( "data", extraData );
queries << qry; queries << qry;
} } else if ( m_queryType == Artist )
else if ( m_queryType == Artist )
{ {
if ( !extraData.isEmpty() ) if ( !extraData.isEmpty() )
artist->setProperty( "data", extraData ); artist->setProperty( "data", extraData );
arts << artist; arts << artist;
} } else if ( m_queryType == Album )
else if ( m_queryType == Album )
{ {
if ( !extraData.isEmpty() ) if ( !extraData.isEmpty() )
album->setProperty( "data", extraData ); album->setProperty( "data", extraData );

View File

@@ -100,7 +100,7 @@ DatabaseCommand_LoadDynamicPlaylistEntries::exec( DatabaseImpl* dbi )
if( mode == OnDemand ) if( mode == OnDemand )
{ {
// Q_ASSERT( m_entrymap.isEmpty() ); // ondemand should have no entry Q_ASSERT( m_entrymap.isEmpty() ); // ondemand should have no entry
emit done( revisionGuid(), m_islatest, type, controls, true ); emit done( revisionGuid(), m_islatest, type, controls, true );
} }

View File

@@ -31,6 +31,7 @@ using namespace Tomahawk;
void void
DatabaseCommand_LoadPlaylistEntries::exec( DatabaseImpl* dbi ) DatabaseCommand_LoadPlaylistEntries::exec( DatabaseImpl* dbi )
{ {
// qDebug() << "Loading playlist entries for revision" << m_revguid;
generateEntries( dbi ); generateEntries( dbi );
emit done( m_revguid, m_guids, m_oldentries, m_islatest, m_entrymap, true ); emit done( m_revguid, m_guids, m_oldentries, m_islatest, m_entrymap, true );
@@ -41,38 +42,40 @@ void
DatabaseCommand_LoadPlaylistEntries::generateEntries( DatabaseImpl* dbi ) DatabaseCommand_LoadPlaylistEntries::generateEntries( DatabaseImpl* dbi )
{ {
TomahawkSqlQuery query_entries = dbi->newquery(); TomahawkSqlQuery query_entries = dbi->newquery();
query_entries.prepare( "SELECT entries, playlist, author, timestamp, previous_revision " query_entries.prepare("SELECT entries, playlist, author, timestamp, previous_revision "
"FROM playlist_revision " "FROM playlist_revision "
"WHERE guid = :guid" ); "WHERE guid = :guid");
query_entries.bindValue( ":guid", m_revguid ); query_entries.bindValue( ":guid", m_revguid );
query_entries.exec(); query_entries.exec();
tLog( LOGVERBOSE ) << "trying to load playlist entries for guid:" << m_revguid; // qDebug() << "trying to load entries:" << m_revguid;
QString prevrev; QString prevrev;
QJson::Parser parser; bool ok; QJson::Parser parser; bool ok;
if ( query_entries.next() ) if( query_entries.next() )
{ {
// entries should be a list of strings: // entries should be a list of strings:
QVariant v = parser.parse( query_entries.value( 0 ).toByteArray(), &ok ); QVariant v = parser.parse( query_entries.value(0).toByteArray(), &ok );
Q_ASSERT( ok && v.type() == QVariant::List ); //TODO Q_ASSERT( ok && v.type() == QVariant::List ); //TODO
m_guids = v.toStringList(); m_guids = v.toStringList();
QString inclause = QString( "('%1')" ).arg( m_guids.join( "', '" ) );
QString inclause = QString("('%1')").arg(m_guids.join("', '"));
TomahawkSqlQuery query = dbi->newquery(); TomahawkSqlQuery query = dbi->newquery();
QString sql = QString( "SELECT guid, trackname, artistname, albumname, annotation, " QString sql = QString("SELECT guid, trackname, artistname, albumname, annotation, "
"duration, addedon, addedby, result_hint " "duration, addedon, addedby, result_hint "
"FROM playlist_item " "FROM playlist_item "
"WHERE guid IN %1" ).arg( inclause ); "WHERE guid IN %1").arg( inclause );
//qDebug() << sql;
query.exec( sql ); query.exec( sql );
while ( query.next() ) while( query.next() )
{ {
plentry_ptr e( new PlaylistEntry ); plentry_ptr e( new PlaylistEntry );
e->setGuid( query.value( 0 ).toString() ); e->setGuid( query.value( 0 ).toString() );
e->setAnnotation( query.value( 4 ).toString() ); e->setAnnotation( query.value( 4 ).toString() );
e->setDuration( query.value( 5 ).toUInt() ); e->setDuration( query.value( 5 ).toUInt() );
e->setLastmodified( 0 ); // TODO e->lastmodified = query.value( 6 ).toInt(); e->setLastmodified( 0 ); // TODO e->lastmodified = query.value(6).toInt();
e->setResultHint( query.value( 8 ).toString() ); e->setResultHint( query.value( 8 ).toString() );
Tomahawk::query_ptr q = Tomahawk::Query::get( query.value( 2 ).toString(), query.value( 1 ).toString(), query.value( 3 ).toString() ); Tomahawk::query_ptr q = Tomahawk::Query::get( query.value( 2 ).toString(), query.value( 1 ).toString(), query.value( 3 ).toString() );
@@ -83,13 +86,14 @@ DatabaseCommand_LoadPlaylistEntries::generateEntries( DatabaseImpl* dbi )
} }
prevrev = query_entries.value( 4 ).toString(); prevrev = query_entries.value( 4 ).toString();
} }
else else
{ {
// qDebug() << "Playlist has no current revision data"; // qDebug() << "Playlist has no current revision data";
} }
if ( prevrev.length() ) if( prevrev.length() )
{ {
TomahawkSqlQuery query_entries_old = dbi->newquery(); TomahawkSqlQuery query_entries_old = dbi->newquery();
query_entries_old.prepare( "SELECT entries, " query_entries_old.prepare( "SELECT entries, "
@@ -101,7 +105,7 @@ DatabaseCommand_LoadPlaylistEntries::generateEntries( DatabaseImpl* dbi )
query_entries_old.addBindValue( prevrev ); query_entries_old.addBindValue( prevrev );
query_entries_old.exec(); query_entries_old.exec();
if ( !query_entries_old.next() ) if( !query_entries_old.next() )
{ {
return; return;
Q_ASSERT( false ); Q_ASSERT( false );

View File

@@ -39,11 +39,13 @@ DatabaseCommand_LoadSocialActions::exec( DatabaseImpl* dbi )
QVariant srcid = source()->isLocal() ? QVariant( QVariant::Int ) : source()->id(); QVariant srcid = source()->isLocal() ? QVariant( QVariant::Int ) : source()->id();
int artid = dbi->artistId( m_artist, false ); bool autoCreate = false;
int artid = dbi->artistId( m_artist, autoCreate );
if( artid < 1 ) if( artid < 1 )
return; return;
int trkid = dbi->trackId( artid, m_track, false ); autoCreate = false; // artistId overwrites autoCreate (reference)
int trkid = dbi->trackId( artid, m_track, autoCreate );
if( trkid < 1 ) if( trkid < 1 )
return; return;
@@ -70,6 +72,6 @@ DatabaseCommand_LoadSocialActions::exec( DatabaseImpl* dbi )
allSocialActions.append( action ); allSocialActions.append( action );
} }
m_query->setAllSocialActions( allSocialActions ); m_result->setAllSocialActions( allSocialActions );
} }

View File

@@ -56,17 +56,17 @@ public:
/** /**
* \brief Overloaded constructor for DatabaseCommand_LoadSocialAction. * \brief Overloaded constructor for DatabaseCommand_LoadSocialAction.
* \param result A Tomahawk Query object. * \param result Pointer to a Tomahawk::Result.
* \param parent Parent class. * \param parent Parent class.
* *
* Constructor which creates a new database command for loading all social actions. * Constructor which creates a new database command for loading all social actions.
*/ */
explicit DatabaseCommand_LoadSocialActions( const Tomahawk::query_ptr& query, QObject* parent = 0 ) explicit DatabaseCommand_LoadSocialActions( Tomahawk::Result* result, QObject* parent = 0 )
: DatabaseCommand( parent ), m_query( query ) : DatabaseCommand( parent ), m_result( result )
{ {
setSource( SourceList::instance()->getLocal() ); setSource( SourceList::instance()->getLocal() );
setArtist( query->artist() ); setArtist( result->artist()->name() );
setTrack( query->track() ); setTrack( result->track() );
} }
/** /**
@@ -125,7 +125,7 @@ signals:
void done( QList< Tomahawk::SocialAction >& allSocialActions ); void done( QList< Tomahawk::SocialAction >& allSocialActions );
private: private:
Tomahawk::query_ptr m_query; Tomahawk::Result* m_result;
QString m_artist; QString m_artist;
QString m_track; QString m_track;

Some files were not shown because too many files have changed in this diff Show More