1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-09-09 05:30:52 +02:00

Compare commits

..

124 Commits
0.4.2 ... 0.3.2

Author SHA1 Message Date
Christian Muehlhaeuser
a05972e9ce * Fixed merge. 2011-11-24 02:47:15 +01:00
Christian Muehlhaeuser
5157e13ba1 * Updated ChangeLog. 2011-11-24 01:48:58 +01:00
Christian Muehlhaeuser
9f97afc148 * Updated ChangeLog. 2011-11-24 01:47:48 +01:00
Christian Muehlhaeuser
8b1b0091c6 * Updated ChangeLog. 2011-11-24 01:46:42 +01:00
Christian Muehlhaeuser
3e9aee3687 * Use default locale if translation can't be found. 2011-11-24 01:35:10 +01:00
Christian Muehlhaeuser
48bb0a82f9 * Disable UbuntuUnityHack until it's working properly. 2011-11-24 01:35:03 +01:00
Christian Muehlhaeuser
1efdf38085 * Disable german translation for 0.3.2 release. Needs be updated. 2011-11-24 01:20:01 +01:00
Christian Muehlhaeuser
3e4f4d2f38 * Updated verison to 0.3.2. 2011-11-23 23:31:02 +01:00
Jason Herskowitz
a2f870f2b8 Update changelog 2011-11-23 23:26:35 +01:00
Christian Muehlhaeuser
2ac167d438 * Support .oga files (ogg mimetype). 2011-11-23 23:26:21 +01:00
Christian Muehlhaeuser
c218695a3d * Prevent stuck now playing indicator. 2011-11-23 23:26:13 +01:00
Christian Muehlhaeuser
fae5f1dbbe * Should hopefully fix Windows SettingsDialog. 2011-11-23 23:25:57 +01:00
Christian Muehlhaeuser
54d29cc05d * Try fixing SettingsDialog on Windows. 2011-11-23 23:25:45 +01:00
Christian Muehlhaeuser
5aea02def2 * Forgot to rename crash reporter in one more place. 2011-11-23 23:25:35 +01:00
Christian Muehlhaeuser
368aa20b75 * Updated new crash reporter binary name in release scripts. 2011-11-23 23:25:26 +01:00
Christian Muehlhaeuser
d2a07f2b6c * Call ensurePolished before creating buttons in SettingsDialog. 2011-11-23 23:25:08 +01:00
Christian Muehlhaeuser
14253a9c66 * DRY: Cleaned up DropJob / ShortenedLinkParser & handling spoti.fi urls now. 2011-11-23 23:25:02 +01:00
Christian Muehlhaeuser
6881f4218a * Moved charts & spotify parser to port 80. 2011-11-23 23:23:57 +01:00
Christian Muehlhaeuser
17badb972e * Prevented over-zealous assert in PlaylistModel. 2011-11-23 23:23:50 +01:00
Christian Muehlhaeuser
2ea09dd60d * Merged version check. 2011-11-23 23:22:00 +01:00
Christian Muehlhaeuser
87f7b6b2c6 * Made sure we don't duplicate connections in WelcomeWidget. 2011-11-23 23:15:52 +01:00
Christian Muehlhaeuser
01986a4129 * Use the proper color for selected playlist items on the Dashboard. 2011-11-23 23:15:43 +01:00
Christian Muehlhaeuser
2b404b517f * Use the proper highlight color for painting hovered artist names in the AlbumItemDelegate. 2011-11-23 23:15:32 +01:00
Christian Muehlhaeuser
b21b2d10f7 * Update SourceInfoWidget when collection changes. 2011-11-23 23:15:22 +01:00
Christian Muehlhaeuser
04deaba788 * Less furious logging. 2011-11-23 23:15:10 +01:00
Christian Muehlhaeuser
5cabc62733 * Update recent additions on welcome page whenever a collection changes. 2011-11-23 23:15:02 +01:00
Kuba Serafinowski
01c6c3f0b6 moar strings to translate! 2011-11-23 23:14:42 +01:00
Kuba Serafinowski
b1a5cd4dcb remove unneeded strings 2011-11-23 23:14:28 +01:00
Kuba Serafinowski
58f78725db tiny typo fix 2011-11-23 23:14:11 +01:00
Jeff Mitchell
4210e8eab8 Hopefully fix a case where the seek slider travels on when Phonon is
buffering
2011-11-23 23:13:49 +01:00
Thierry Goeckel
115492d1cc Enhance version upgrading to include a third point. 2011-11-23 23:13:21 +01:00
Leo Franchi
edadbb0c95 Fix loading XSPFs with spaces in their name. 2011-11-23 23:13:11 +01:00
Christian Muehlhaeuser
6c67dfcab7 * Revert back to using system locale. 2011-11-23 23:12:50 +01:00
Christian Muehlhaeuser
b9453ab77b * Add a default english translation. Fallback to 'en' if locale is set to 'C'. 2011-11-23 23:12:39 +01:00
Christian Muehlhaeuser
9507ffdd86 * Fixed translation issue in TomahawkUtils. 2011-11-23 23:12:26 +01:00
Christian Muehlhaeuser
ff768954f6 * Fixed window title in AudioControls. 2011-11-23 23:12:17 +01:00
Christian Muehlhaeuser
15729bb66a * Increased size of Get-New-Resolvers dialog. 2011-11-23 23:12:01 +01:00
Christian Muehlhaeuser
41f46aaeea * Cleanup scanner if there were no new and no obsolete tracks found. 2011-11-23 23:11:53 +01:00
Christian Muehlhaeuser
9e0d884f80 * Merge musicscanner changes into stable. 2011-11-23 23:11:16 +01:00
Christian Muehlhaeuser
d34491b85f * Re-enable grouping of dynamic playlist revisions. 2011-11-23 23:10:34 +01:00
Christian Muehlhaeuser
45070fb4e1 * Remove bottom label of steering controls. Changes now take effect on clicking the apply button. 2011-11-23 23:10:27 +01:00
Christian Muehlhaeuser
18612b48d3 * Don't remove current index when restarting a track by activating it directly.
* Don't create new playlist revisions for a list that doesn't belong to you.
2011-11-23 23:10:18 +01:00
Christian Muehlhaeuser
a38c0a544d * Fixed crashing on playing from queue. 2011-11-23 23:10:06 +01:00
Christian Muehlhaeuser
d38c9730fb * Merge into stable. 2011-11-23 23:09:32 +01:00
Christian Muehlhaeuser
d25320833c * Merged into stable. 2011-11-23 23:06:02 +01:00
Christian Muehlhaeuser
d38600dd6a * Don't overwrite friendlyname with an empty one. 2011-11-23 23:05:23 +01:00
Christian Muehlhaeuser
6fa48587e1 * Assert on empty friendlynames. 2011-11-23 23:05:12 +01:00
Leo Franchi
8da0f3e9a3 * Merged into stable. 2011-11-23 23:04:58 +01:00
Kilian Lackhove
ab402c0867 fix xspf import QFileDialog filter 2011-11-23 23:00:43 +01:00
Kuba Serafinowski
545a915439 fix TWK-583 for jabber too 2011-11-23 23:00:31 +01:00
Kuba Serafinowski
d026902d91 fix for TWK-583 2011-11-23 23:00:25 +01:00
Hugo Lindström
ff72157c5f Fix for broken compile 2011-11-23 23:00:05 +01:00
Christian Muehlhaeuser
faab306dbe * Merged friendlyname fixes. 2011-11-23 22:59:57 +01:00
Christian Muehlhaeuser
57fef9f3f2 * Fixed WelcomeWidget. 2011-11-23 22:57:44 +01:00
Leo Franchi
89fac77951 Fix one compile error 2011-11-23 22:57:36 +01:00
Christian Muehlhaeuser
ef02e9b4ac * Refactored Track-, Collection-, PlaylistModel. 2011-11-23 22:57:24 +01:00
Leo Franchi
99b09c1faa Increment job count when creating a new xspf job 2011-11-23 22:55:17 +01:00
Kuba Serafinowski
d66e86f5c6 make the string extract with lupdate 2011-11-23 22:54:59 +01:00
Kuba Serafinowski
9bd46984e0 match the text with buttons in the dialog 2011-11-23 22:54:51 +01:00
Hugo Lindström
3992392245 * Merge appending XSPFs. 2011-11-23 22:54:32 +01:00
Hugo Lindström
198e92bc2c Fix for local xspf dropjob, also allow remotes 2011-11-23 22:53:22 +01:00
Kuba Serafinowski
2f899eed2a fix misleading cmake message 2011-11-23 22:52:49 +01:00
Jeff Mitchell
8cdd4bdea3 Do the connection name fixing in a different way; always end up with a
QHostAddress.
2011-11-23 22:52:39 +01:00
Jeff Mitchell
3d53b0c251 Remove some debugging 2011-11-23 22:52:23 +01:00
Jeff Mitchell
0ac9512eb9 Lots of debug and half the fixes for fixing hostnames 2011-11-23 22:52:15 +01:00
Jeff Mitchell
3f0ac7c666 * Merge application proxy factory. 2011-11-23 22:52:13 +01:00
Christian Muehlhaeuser
faf7d00fdd * Fixed TWK-579: Proper default width for the sidebar. 2011-11-23 22:50:32 +01:00
Christian Muehlhaeuser
b31abb0979 * This should fix sources being stuck in 'Parsing'. 2011-11-23 22:50:25 +01:00
Thierry Göckel
f2009cf99b Fix returning of external IP address for some routers. 2011-11-23 22:49:29 +01:00
Hugo Lindström
0d97a47cc5 Add cache for all charts. Later on move spotify and hypem to charts api. 2011-11-23 22:49:17 +01:00
Hugo Lindström
7db6beb896 Adding cache for charts 2011-11-23 22:48:54 +01:00
Christian Muehlhaeuser
e56a629ad7 * Fixed negative time values showing up in GUI. 2011-11-23 22:48:28 +01:00
Christian Muehlhaeuser
ef918bbbcf * Make SetPlaylistRevision DBCmds groupable. 2011-11-23 22:48:13 +01:00
Christian Muehlhaeuser
60911ab887 * Set stats for the right collection. 2011-11-23 22:47:49 +01:00
Christian Muehlhaeuser
e10a96ecd5 * Merged groupable db-commands. 2011-11-23 22:47:17 +01:00
Christian Muehlhaeuser
e99973925a * Merged improved collection syncing. 2011-11-23 22:45:52 +01:00
Dominik Schmidt
949c6f6341 Unbreak FindCLucene for Fedora 16 and openSUSE Factory. 2011-11-23 06:35:39 +01:00
Dominik Schmidt
e041723ffc Install CrashReporter 2011-11-23 06:07:54 +01:00
Christian Muehlhaeuser
89919928da * Look for CrashReporter in local and global dirs. 2011-11-23 05:49:34 +01:00
Leo Franchi
d4fc504f3d Add a 0.3.2 changelog 2011-11-20 22:52:11 -05:00
Leo Franchi
05924b8deb TWK-531: Show (-) on new item after deleting an item 2011-11-20 22:43:20 -05:00
Leo Franchi
6d4aa50596 Clear upcoming station tracks when steering, and re-fetch two 2011-11-20 22:43:08 -05:00
Leo Franchi
7ee2755617 use QFileSystemModel instead of deprecated QDirModel, and show /Volumes on mac 2011-11-20 22:43:00 -05:00
Leo Franchi
35406ceb5a Use plugins/ instead of PlugIns/ as vlc hard-codes it internally. 2011-11-20 22:42:52 -05:00
Leo Franchi
9efb536e55 Show tooltip with full text in job view 2011-11-20 22:42:30 -05:00
Leo Franchi
b8d27f1811 Make clicking back to current track work on dashboard, charts, and artist/album pages 2011-11-20 22:42:23 -05:00
Leo Franchi
0939ba0705 Don't show speaker next to a playlist if not paused or playing 2011-11-20 22:42:03 -05:00
Leo Franchi
3788bc7cbf Always clear spinner when no albums found to load in albumview 2011-11-20 22:41:52 -05:00
Leo Franchi
54723abc07 Only show JS errors in tomahawk debug builds 2011-11-20 22:41:36 -05:00
Leo Franchi
900f57437f Put delcaration in ifdef 2011-11-20 22:40:51 -05:00
Leo Franchi
300c9d5d68 Automatically upgrade resolvers 2011-11-20 22:40:44 -05:00
Leo Franchi
96c9996284 Set the timer with track duration calculated in 2011-11-17 09:49:43 -05:00
Leo Franchi
8a15bcaa66 fix rdio track loading 2011-11-17 09:49:16 -05:00
Leo Franchi
d17d67869c Add an "apply steering" button to make it clearer how to steer
Remove some super spammy debug
2011-11-17 09:49:11 -05:00
Leo Franchi
c491f33ce4 Manually replace + with " " as QUrl::queryItems doesn't do it for us... 2011-11-17 09:49:06 -05:00
Leo Franchi
1dee5c809c Don't hook up signals twice for loading xspf 2011-11-17 09:49:00 -05:00
Leo Franchi
924ede61b4 Make surer to show playlist once loaded 2011-11-17 09:48:52 -05:00
Leo Franchi
0d64d9c42d Don't show drop indicator for playlists in sidebar and always create new ones 2011-11-17 09:48:44 -05:00
Leo Franchi
6b6fb909cd Make source visible in audiocontrols on os x 2011-11-17 09:48:35 -05:00
Leo Franchi
b51ff46085 Don't create QNRs for null urls, let audioengine handle it properly 2011-11-17 09:48:07 -05:00
Leo Franchi
46ec23990f Revert "Skip to next track if we have a QNR and it emits a failed signal"
This reverts commit 9418fd0fb8.
2011-11-17 09:47:59 -05:00
Jeff Mitchell
eb46feac2c Handle the worker/cache threads better in InfoSystem, and re-enable
deletion on shutdown, so we can test in windows nightlies.
2011-11-16 20:19:13 -05:00
Leo Franchi
2c206f4193 Shrink font for playlist author 2011-11-14 18:07:56 -05:00
Leo Franchi
c1bd19b35b Don't accept button press events as well as release when handling latches 2011-11-14 18:06:58 -05:00
Jeff Mitchell
370154cc46 hacky fix for Jreen needing the application proxy set. Really we need to
get them to accept their own QNAM
2011-11-14 18:06:50 -05:00
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
397 changed files with 7271 additions and 34398 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

@@ -15,18 +15,15 @@ SET( TOMAHAWK_APPLICATION_NAME "Tomahawk" )
SET( TOMAHAWK_DESCRIPTION_SUMMARY "The social media player" )
SET( TOMAHAWK_VERSION_MAJOR 0 )
SET( TOMAHAWK_VERSION_MINOR 4 )
SET( TOMAHAWK_VERSION_MINOR 3 )
SET( TOMAHAWK_VERSION_PATCH 2 )
#SET( TOMAHAWK_VERSION_RC 0 )
# enforce proper symbol exporting on all platforms
add_definitions( "-fvisibility=hidden" )
# build options
option(BUILD_GUI "Build Tomahawk with GUI" ON)
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
@@ -57,9 +54,6 @@ SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" )
SET( CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" )
SET( CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" )
# make predefined install dirs available everywhere
INCLUDE(GNUInstallDirs)
# installer creation
INCLUDE( TomahawkCPack.cmake )
@@ -74,7 +68,7 @@ IF( NOT BUILD_GUI )
MESSAGE( STATUS "Building Tomahawk ${TOMAHAWK_VERSION} in HEADLESS mode ***" )
ELSE()
MESSAGE( STATUS "Building Tomahawk ${TOMAHAWK_VERSION} full GUI version ***" )
LIST(APPEND NEEDED_QT4_COMPONENTS "QtGui" "QtWebkit" "QtUiTools" )
LIST(APPEND NEEDED_QT4_COMPONENTS "QtGui" "QtWebkit" )
ENDIF()
IF( BUILD_GUI AND UNIX AND NOT APPLE )
@@ -82,7 +76,7 @@ IF( BUILD_GUI AND UNIX AND NOT APPLE )
ENDIF()
macro_optional_find_package(Qt4 4.7.0 COMPONENTS ${NEEDED_QT4_COMPONENTS} )
macro_log_feature(QT4_FOUND "Qt" "A cross-platform application and UI framework" "http://qt.nokia.com" TRUE "" "If you see this, although libqt4-devel is installed, check whether the \n qtwebkit-devel package and whatever contains QtUiTools is installed too")
macro_log_feature(QT4_FOUND "Qt" "A cross-platform application and UI framework" "http://qt.nokia.com" TRUE "" "If you see this, although libqt4-devel is installed, check whether \n the qtwebkit-devel package is installed as well")
macro_optional_find_package(Phonon 4.5.0)
macro_log_feature(PHONON_FOUND "Phonon" "The Phonon multimedia library" "http://phonon.kde.org" TRUE "" "")
@@ -116,13 +110,6 @@ macro_log_feature(LIBATTICA_FOUND "libattica" "Provides support for automatic fe
macro_optional_find_package(QuaZip)
macro_log_feature(QuaZip_FOUND "QuaZip" "Provides support for extracting downloaded resolvers automatically." "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")
IF( NOT QuaZip_FOUND )
add_subdirectory( ${CMAKE_SOURCE_DIR}/src/libtomahawk/thirdparty/quazip )
SET( QuaZip_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/libtomahawk/thirdparty/quazip )
@@ -142,17 +129,29 @@ ENDIF()
set(LIBLASTFM_FOUND true)
#### 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
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(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( INTERNAL_JREEN )
ADD_SUBDIRECTORY( ${THIRDPARTY_DIR}/jreen )
SET( LIBJREEN_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/thirdparty/jreen/include )
SET( LIBJREEN_LIBRARY jreen )
SET( LIBJREEN_LIBRARIES ${LIBJREEN_LIBRARY} )
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
### libportfwd
@@ -214,8 +213,6 @@ SET( TOMAHAWK_LIBRARIES tomahawklib )
ADD_SUBDIRECTORY( src )
ADD_SUBDIRECTORY( admin )
IF( BUILD_GUI )
IF( NOT DISABLE_CRASHREPORTER )
ADD_SUBDIRECTORY( src/breakpad/CrashReporter )
ENDIF()
IF( NOT DISABLE_CRASHREPORTER )
ADD_SUBDIRECTORY( src/breakpad/CrashReporter )
ENDIF()

View File

@@ -56,7 +56,7 @@ ELSE()
include(FindLibraryWithDebug)
include(FindPackageHandleStandardArgs)
find_path(TAGLIB_INCLUDES
find_path(TAGLIB_CFLAGS
NAMES
tag.h
PATH_SUFFIXES taglib

View File

@@ -28,8 +28,8 @@
; We use official release plugins
; mingw32-vlc from obs misses a lot and has even broken ones probably
!define VLC_PATH "${SOURCE_PATH}\admin\win\vlc\" ; SIC! ^
!define VLC_BIN "${VLC_PATH}"
!define VLC_PATH "${SOURCE_PATH}\admin\win\vlc\prefix" ; SIC! ^
!define VLC_BIN "${VLC_PATH}\bin"
!define VLC_PLUGIN_PATH "${VLC_BIN}\plugins"
!define NSI_PATH "${SOURCE_PATH}/admin/win/nsi"
@@ -279,6 +279,7 @@ Section "Tomahawk Player" SEC_TOMAHAWK_PLAYER
File "${INSTALL_PATH}\bin\libqxtweb-standalone.dll"
File "${INSTALL_PATH}\bin\libtomahawk_portfwd.dll"
File "${INSTALL_PATH}\bin\libtomahawk_lastfm2.dll"
File "${INSTALL_PATH}\bin\libquazip.dll"
File "${INSTALL_PATH}\bin\libtomahawklib.dll"
File "${INSTALL_PATH}\lib\libtomahawk_sip*.dll"
!endif
@@ -293,6 +294,7 @@ Section "Tomahawk Player" SEC_TOMAHAWK_PLAYER
File "${BUILD_PATH}\libqxtweb-standalone.dll"
File "${BUILD_PATH}\libtomahawk_portfwd.dll"
File "${BUILD_PATH}\libtomahawk_lastfm2.dll"
File "${BUILD_PATH}\libquazip.dll"
File "${BUILD_PATH}\libtomahawk_sip*.dll"
!endif
@@ -305,10 +307,8 @@ Section "Tomahawk Player" SEC_TOMAHAWK_PLAYER
File "${QT_DLL_PATH}\QtGui4.dll"
File "${QT_DLL_PATH}\QtNetwork4.dll"
File "${QT_DLL_PATH}\QtSql4.dll"
File "${QT_DLL_PATH}\QtScript4.dll"
File "${QT_DLL_PATH}\QtUiTools4.dll"
File "${QT_DLL_PATH}\QtWebKit4.dll"
File "${QT_DLL_PATH}\QtXml4.dll"
File "${QT_DLL_PATH}\QtWebKit4.dll"
;SQLite driver
SetOutPath "$INSTDIR\sqldrivers"
@@ -329,17 +329,30 @@ Section "Tomahawk Player" SEC_TOMAHAWK_PLAYER
File "${MING_BIN}\libstdc++-6.dll"
;Phonon stuff
File "${MING_BIN}\libphonon.dll"
;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"
SetOutPath "$INSTDIR\phonon_backend"
File "${VLC_BIN}\phonon_backend\phonon_vlc.dll"
SetOutPath "$INSTDIR"
;VLC
;SetOutPath "$INSTDIR\phonon_backend"
File "${VLC_BIN}\libvlc.dll"
File "${VLC_BIN}\libvlccore.dll"
SetOutPath "$INSTDIR\plugins"
File /r "${VLC_PLUGIN_PATH}\*.dll"
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
File "${MING_BIN}\libqjson.dll"
@@ -350,7 +363,6 @@ Section "Tomahawk Player" SEC_TOMAHAWK_PLAYER
File "${MING_BIN}\libechonest.dll"
File "${MING_BIN}\libQTweetLib.dll"
File "${MING_BIN}\libquazip.dll"
; Jabber
File "${MING_BIN}\libjreen.dll"
@@ -455,8 +467,7 @@ Section -post
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tomahawk" "NoRepair" "1"
; Register tomahawk:// protocol handler
WriteRegStr HKCR "tomahawk" "" "URL:Tomahawk Protocol"
WriteRegStr HKCR "tomahawk" "URL Protocol" ""
WriteRegStr HKCR "tomahawk" "" "URL: Tomahawk Protocol"
WriteRegStr HKCR "tomahawk\DefaultIcon" "" $INSTDIR\tomahawk.exe,1
WriteRegStr HKCR "tomahawk\shell" "" "open"
WriteRegStr HKCR "tomahawk\shell\open\command" "" '"$INSTDIR\tomahawk.exe" "%1"'

View File

@@ -1,67 +1,3 @@
Version 0.4.2:
* Updated translations for various languages.
* Resuming playback restores correct volume settings.
* Reduced CPU usage during playback.
* Fixed not starting up due to case sensitivity issue on OS X.
* Fixed volume issue (too quiet) on Windows.
Version 0.4.1:
* Fixed various crashes.
* Fixed issues with auto-updating XSPF playlists.
* Double-clicking a playlist starts playing it.
* Resolvers can now return disc number and album position for results.
* Fixed sorting playlists by track number.
* Fixed issues with changing proxy.
* Fixed Twitter authentication issues.
* Fixed Grooveshark support on Windows.
Version 0.4.0:
* Added visual notification for database indexing job.
* Fixed icons not appearing in resolvers list.
* Fixed various UI glitches and stray error messages in stations.
* Fixed bug where album page would resolve bottom-to-top.
* Fixed bug where Footnotes would not update when changing selected album in Album View.
* Fixed dragging albums and artists from charts, album, and artist views.
* Fixed bug where filter text would be one step behind filter value.
* Fixed bug where resolvers would enable themselves after auto-updating.
* Fixed occasional crash when dropping tracks onto New Station item.
* Added jump-to-current-track support for search results page.
* Fixed non-resolving tracks when dragging from album view.
* Fixed fetching album covers for albums with special characters.
* Show errors and continue gracefully when resolved audio is not available.
* Fixed various crashes on exit.
* Added basic command-line options for playback control.
* Bumped up web api timeouts to allow web clients to finish resolving.
* Added filename suggestion when exporting a playlist.
* Cleaned up highlighting of artist names in album view.
* Cleaned up alignment of playlist items.
* Fixed potential crash when searching.
* Added support for disc number.
* Added SoundCloudWall.com charts.
* Added ability to "lock on" to a user when listening along, to skip along.
* Fixed bug where loved tracks would be refreshed much too often.
* Fixed some font size issues.
* Sped up Tomahawk startup by moving chart loading into a separate thread.
* Added support for parsing Grooveshark and Tinysong tracks and playlists.
* Reorganized sidebar to follow more logical item groupings.
* Added artist and album results to global searches.
* Fixed style and contrast issues when using GTK styles.
* Fixed paths to artwork when using MPRIS2 interface.
* Fixed out of sync Show/Hide menu items on OS X when hidden with cmd-h.
* Fixed /Volumes directory not showing up on OS X.
* Fixed startup crash on OS X.
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.
@@ -116,7 +52,7 @@ Version 0.3.0:
* Added YouTube resolver.
* Fixed bug where going offline then online would not re-connect to many
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.
* 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
@@ -132,7 +68,7 @@ Version 0.3.0:
* Added new job status view in the bottom of the source list that displays
current jobs such as resolving, parsing playlists, and loading from
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.
* Convert resolvers to use asynchronous calls to avoid blocking Tomahawk's
UI, greatly increasing responsiveness of Tomahawk while resolving.

6
README
View File

@@ -39,13 +39,13 @@ Dependencies
The following dependencies are optional, but recommended:
Attica 0.2.0 - ftp://ftp.kde.org/pub/kde/stable/attica/
QuaZip 0.4.3 - http://quazip.sourceforge.net/
Jreen 1.0.3 - https://github.com/euroelessar/jreen
QTweetLib 0.5.0 - https://github.com/minimoog/QTweetLib
jreen (Git) - https://github.com/euroelessar/jreen
QTweetLib 0.3.0 - https://github.com/minimoog/QTweetLib
Third party libraries that we ship with our source:
MiniUPnP 1.6 - http://miniupnp.free.fr/
liblastfm 0.4.0 - http://github.com/jonocole/liblastfm/
QuaZip 0.4.3 - http://quazip.sourceforge.net/
Enjoy!

View File

@@ -250,7 +250,7 @@ frameworks_dir = os.path.join(bundle_dir, 'Contents', 'Frameworks')
commands.append(['mkdir', '-p', frameworks_dir])
resources_dir = os.path.join(bundle_dir, 'Contents', 'Resources')
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)
fixed_libraries = []
@@ -491,7 +491,7 @@ def FindVLCPlugin(name):
FixBinary(binary)
for plugin in VLC_PLUGINS:
FixVLCPlugin(FindVLCPlugin(plugin), '../Frameworks/vlc/plugins')
FixVLCPlugin(FindVLCPlugin(plugin), '.')
for plugin in TOMAHAWK_PLUGINS:
FixPlugin(plugin, '../MacOS')

View File

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

View File

@@ -3,12 +3,9 @@ SET(MINGW_PREFIX "i686-w64-mingw32")
# this one is important
SET(CMAKE_SYSTEM_NAME Windows)
# specify the cross compiler
SET(CMAKE_C_COMPILER ccache ${MINGW_PREFIX}-gcc)
SET(CMAKE_C_FLAGS "-fno-keep-inline-dllexport")
SET(CMAKE_CXX_COMPILER ccache ${MINGW_PREFIX}-g++)
SET(CMAKE_CXX_FLAGS ${CMAKE_C_FLAGS})
SET(CMAKE_RC_COMPILER /usr/bin/${MINGW_PREFIX}-windres)
# where is the target environment containing libraries
@@ -18,6 +15,13 @@ SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# configure qt variables
SET(QT_LIBRARY_DIR /usr/${MINGW_PREFIX}/bin)
# libs with broken find modules
SET(TAGLIB_FOUND true)
SET(TAGLIB_LIBRARIES ${CMAKE_FIND_ROOT_PATH}/lib/libtag.dll.a)
SET(TAGLIB_INCLUDES ${CMAKE_FIND_ROOT_PATH}/include/taglib)
SET(QT_PLUGINS_DIR ${CMAKE_FIND_ROOT_PATH}/lib/qt4/plugins/)
SET(QT_QTUITOOLS_LIBRARY_RELEASE ${CMAKE_FIND_ROOT_PATH}/lib/libQtUiTools.a)
SET(QT_QTUITOOLS_LIBRARY_DEBUG ${CMAKE_FIND_ROOT_PATH}/lib/libQtUiToolsd.a)
SET(QT_QTUITOOLS_LIBRARY ${QT_QTUITOOLS_LIBRARY_RELEASE})

View File

@@ -1,52 +1,42 @@
#!/bin/bash
echo "Remove old vlc dir..."
if [ "$1" = "-c" ] ; then
echo "Continuing last download.."
rm -rvf vlc/
else
echo "Update archive..."
fi
mkdir -p vlc/
cd vlc/
rm -rvf vlc/
#rm -vf vlc-*.7z
#rm -rf vlc/
echo "Download phonon archive..."
# 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://people.videolan.org/~jb/phonon/phonon-vlc-last.7z
# wget -c http://people.videolan.org/~jb/phonon/phonon_phonon-vlc_20111128.7z
wget -c http://download.tomahawk-player.org/test/pvlc.tar.bz2
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://download.tomahawk-player.org/tomahawk-vlc-0.1.zip"
wget -c http://people.videolan.org/~jb/phonon/phonon-vlc-last.7z
echo "Extract binary..."
# 7z x phonon*.7z
# mv -v vlc-*/ vlc/
# unzip tomahawk-vlc-0.1.zip
tar xvjf pvlc.tar.bz2
7z x phonon-vlc-last.7z
#mv -v vlc-*/ vlc/
#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..."
# cd prefix/bin/plugins
# rm -rvf libold* libvcd* libdvd* liblibass* libx264* libschroe* liblibmpeg2* \
# libstream_out_* libmjpeg_plugin* libh264_plugin* libzvbi_plugin* lib*sub* \
# *qt4* *skins2* libaccess_bd_plugin.dll \
# libaudiobargraph_* libball_plugin.dll \
# libdirac_plugin.dll \
# libgnutls_plugin.dll \
# libcaca_plugin.dll \
# libfreetype_plugin.dll \
# libaccess_output_shout_plugin.dll \
# libremoteosd_plugin.dll \
# libsdl_image_plugin.dll \
# libvout_sdl_plugin.dll \
# libpng_plugin.dll \
# libgoom_plugin.dll \
# libatmo_plugin.dll \
# libmux_ts_plugin.dll \
# libkate_plugin.dll \
# libtaglib_plugin.dll
echo "Strip unneeded plugins from vlc/plugins..."
cd prefix/bin/plugins
rm -rvf libold* libvcd* libdvd* liblibass* libx264* libschroe* liblibmpeg2* \
libstream_out_* libmjpeg_plugin* libh264_plugin* libzvbi_plugin* lib*sub* \
*qt4* *skins2* libaccess_bd_plugin.dll \
libaudiobargraph_* libball_plugin.dll \
libdirac_plugin.dll \
libgnutls_plugin.dll \
libcaca_plugin.dll \
libfreetype_plugin.dll \
libaccess_output_shout_plugin.dll \
libremoteosd_plugin.dll \
libsdl_image_plugin.dll \
libvout_sdl_plugin.dll \
libpng_plugin.dll \
libgoom_plugin.dll \
libatmo_plugin.dll \
libmux_ts_plugin.dll \
libkate_plugin.dll \
libtaglib_plugin.dll
# this is for vlc-1.2

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 69 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: 15 KiB

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

View File

@@ -2,7 +2,7 @@
// if run in phantomjs add fake Tomahawk environment
if(window.Tomahawk === undefined)
{
// alert("PHANTOMJS ENVIRONMENT");
alert("PHANTOMJS ENVIRONMENT");
var Tomahawk = {
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
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

File diff suppressed because it is too large Load Diff

View File

@@ -1,11 +1,5 @@
<!DOCTYPE RCC><RCC version="1.0">
<qresource prefix="/lang">
<file>tomahawk_en.qm</file>
<file>tomahawk_de.qm</file>
<file>tomahawk_sv.qm</file>
<file>tomahawk_es.qm</file>
<file>tomahawk_bg.qm</file>
<file>tomahawk_pl.qm</file>
<file>tomahawk_pt_BR.qm</file>
</qresource>
</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

@@ -128,13 +128,8 @@
<file>data/images/headphones.png</file>
<file>data/images/headphones-off.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/no-album-no-case.png</file>
<file>data/images/rdio.png</file>
<file>data/images/grooveshark.png</file>
<file>data/sql/dbmigrate-27_to_28.sql</file>
<file>data/images/process-stop.png</file>
</qresource>
</RCC>

View File

@@ -2,9 +2,9 @@ FILE( GLOB _icons "${CMAKE_SOURCE_DIR}/data/icons/tomahawk-icon-*.png" )
FOREACH( _file ${_icons} )
STRING( REPLACE "${CMAKE_SOURCE_DIR}/data/icons/tomahawk-icon-" "" _res ${_file} )
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 )
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

@@ -58,7 +58,4 @@ if (APPLE)
FILE(COPY ${CMAKE_SOURCE_DIR}/admin/mac/sparkle_pub.pem
DESTINATION "${CMAKE_BINARY_DIR}/tomahawk.app/Contents/Resources")
FILE(COPY /usr/bin/SetFile DESTINATION "${CMAKE_BINARY_DIR}/tomahawk.app/Contents/MacOS")
FILE(COPY /usr/bin/GetFileInfo DESTINATION "${CMAKE_BINARY_DIR}/tomahawk.app/Contents/MacOS")
endif (APPLE)

View File

@@ -13,8 +13,6 @@ SET( QT_USE_QTNETWORK TRUE )
SET( QT_USE_QTXML TRUE )
SET( QT_USE_QTWEBKIT TRUE )
add_definitions( -DQT_SHAREDPOINTER_TRACK_POINTERS )
INCLUDE( ${QT_USE_FILE} )
INCLUDE( AddAppIconMacro )
@@ -60,13 +58,11 @@ SET( tomahawkSourcesGui ${tomahawkSourcesGui}
sourcetree/sourcedelegate.cpp
sourcetree/animationhelper.cpp
sourcetree/items/sourcetreeitem.cpp
sourcetree/items/sourceitem.cpp
sourcetree/items/collectionitem.cpp
sourcetree/items/playlistitems.cpp
sourcetree/items/categoryitems.cpp
sourcetree/items/genericpageitems.cpp
sourcetree/items/temporarypageitem.cpp
sourcetree/items/groupitem.cpp
sourcetree/items/historyitem.cpp
breakpad/BreakPad.cpp
@@ -101,8 +97,8 @@ IF(LIBLASTFM_FOUND)
ENDIF(LIBLASTFM_FOUND)
IF(LIBATTICA_FOUND)
SET( tomahawkSourcesGui ${tomahawkSourcesGui} GetNewStuffDialog.cpp GetNewStuffDelegate.cpp GetNewStuffModel.cpp )
SET( tomahawkHeadersGui ${tomahawkHeadersGui} GetNewStuffDialog.h GetNewStuffDelegate.h GetNewStuffModel.h )
SET( tomahawkSources ${tomahawkSources} GetNewStuffDialog.cpp GetNewStuffDelegate.cpp GetNewStuffModel.cpp )
SET( tomahawkHeaders ${tomahawkHeaders} GetNewStuffDialog.h GetNewStuffDelegate.h GetNewStuffModel.h )
INCLUDE_DIRECTORIES( ${LIBATTICA_INCLUDE_DIR} )
ENDIF(LIBATTICA_FOUND)
@@ -114,13 +110,11 @@ SET( tomahawkHeadersGui ${tomahawkHeadersGui}
sourcetree/sourcedelegate.h
sourcetree/animationhelper.h
sourcetree/items/sourcetreeitem.h
sourcetree/items/sourceitem.h
sourcetree/items/collectionitem.h
sourcetree/items/playlistitems.h
sourcetree/items/categoryitems.h
sourcetree/items/genericpageitems.h
sourcetree/items/temporarypageitem.h
sourcetree/items/groupitem.h
sourcetree/items/historyitem.h
tomahawktrayicon.h
audiocontrols.h
@@ -178,10 +172,10 @@ INCLUDE_DIRECTORIES(
SET( OS_SPECIFIC_LINK_LIBRARIES "" )
IF( WIN32 )
INCLUDE( "CMakeLists.win32.cmake" )
INCLUDE( "CMakeLists.win32.txt" )
ENDIF( WIN32 )
IF( UNIX )
INCLUDE( "CMakeLists.unix.cmake" )
INCLUDE( "CMakeLists.unix.txt" )
ENDIF( UNIX )
IF( APPLE )
@@ -206,7 +200,10 @@ IF(QCA2_FOUND)
INCLUDE_DIRECTORIES( ${QCA2_INCLUDE_DIR} )
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
${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})
IF( BUILD_GUI )
LIST(APPEND tomahawkHeaders ${tomahawkHeadersGui})
LIST(APPEND tomahawkSources ${tomahawkSourcesGui})
IF( "${gui}" STREQUAL "no" )
ELSE()
qt4_wrap_ui( tomahawkUI_H ${tomahawkUI} )
qt4_wrap_cpp( tomahawkMocGui ${tomahawkHeadersGui} )
SET( final_src ${final_src} ${tomahawkUI_H} ${tomahawkMocGui} ${tomahawkSourcesGui} ${RC_SRCS} )
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 )
ADD_EXECUTABLE( tomahawk ${final_src} )
ENDIF( UNIX AND NOT APPLE )
@@ -272,12 +265,12 @@ IF( APPLE )
ENDIF(HAVE_SPARKLE)
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 )
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
"${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} )
SET( PROTOCOL_INSTALL_DIR ${SERVICES_INSTALL_DIR} )
ELSE()
SET( PROTOCOL_INSTALL_DIR "${CMAKE_INSTALL_FULL_DATADIR}/kde4/services" )
SET( PROTOCOL_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share/kde4/services" )
ENDIF()
INSTALL( FILES ${CMAKE_BINARY_DIR}/tomahawk.protocol DESTINATION ${PROTOCOL_INSTALL_DIR} )
ENDIF()

View File

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

View File

@@ -26,6 +26,7 @@
#include "audio/audioengine.h"
#include "playlist/playlistview.h"
#include "database/database.h"
#include "database/databasecommand_socialaction.h"
#include "widgets/imagebutton.h"
#include "utils/tomahawkutils.h"
#include "utils/logger.h"
@@ -36,13 +37,14 @@
using namespace Tomahawk;
static QString s_acInfoIdentifier = QString( "AUDIOCONTROLS" );
AudioControls::AudioControls( QWidget* parent )
: QWidget( parent )
, ui( new Ui::AudioControls )
, m_repeatMode( PlaylistInterface::NoRepeat )
, m_shuffled( false )
, m_lastSliderCheck( 0 )
{
ui->setupUi( this );
setAcceptDrops( true );
@@ -92,13 +94,12 @@ AudioControls::AudioControls( QWidget* parent )
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->setTimeLine( &m_sliderTimeLine );
ui->volumeSlider->setRange( 0, 100 );
ui->volumeSlider->setValue( AudioEngine::instance()->volume() );
m_phononTickCheckTimer.setSingleShot( true );
m_sliderTimeLine.setCurveShape( QTimeLine::LinearCurve );
ui->seekSlider->setTimeLine( &m_sliderTimeLine );
connect( &m_phononTickCheckTimer, SIGNAL( timeout() ), SLOT( phononTickCheckTimeout() ) );
connect( &m_sliderTimeLine, SIGNAL( frameChanged( int ) ), ui->seekSlider, SLOT( setValue( int ) ) );
connect( ui->seekSlider, SIGNAL( valueChanged( int ) ), AudioEngine::instance(), SLOT( seek( int ) ) );
@@ -110,8 +111,8 @@ AudioControls::AudioControls( QWidget* parent )
connect( ui->volumeLowButton, SIGNAL( clicked() ), AudioEngine::instance(), SLOT( lowerVolume() ) );
connect( ui->volumeHighButton, SIGNAL( clicked() ), AudioEngine::instance(), SLOT( raiseVolume() ) );
connect( ui->playPauseButton, SIGNAL( clicked() ), SIGNAL( playPressed() ) );
connect( ui->pauseButton, SIGNAL( clicked() ), SIGNAL( pausePressed() ) );
connect( ui->playPauseButton, SIGNAL( clicked() ), this, SIGNAL( playPressed() ) );
connect( ui->pauseButton, SIGNAL( clicked() ), this, SIGNAL( pausePressed() ) );
connect( ui->repeatButton, SIGNAL( clicked() ), SLOT( onRepeatClicked() ) );
connect( ui->shuffleButton, SIGNAL( clicked() ), SLOT( onShuffleClicked() ) );
@@ -131,6 +132,15 @@ AudioControls::AudioControls( QWidget* parent )
connect( AudioEngine::instance(), SIGNAL( timerMilliSeconds( qint64 ) ), SLOT( onPlaybackTimer( qint64 ) ) );
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->stackedLayout->setSpacing( 0 );
ui->stackedLayout->setContentsMargins( 0, 0, 0, 0 );
@@ -165,13 +175,6 @@ AudioControls::changeEvent( QEvent* e )
}
void
AudioControls::phononTickCheckTimeout()
{
onPlaybackTimer( m_lastSliderCheck );
}
void
AudioControls::onVolumeChanged( int volume )
{
@@ -184,6 +187,8 @@ AudioControls::onVolumeChanged( int volume )
void
AudioControls::onPlaybackStarted( const Tomahawk::result_ptr& result )
{
tDebug( LOGEXTRA ) << Q_FUNC_INFO;
if ( result.isNull() )
return;
@@ -197,9 +202,6 @@ AudioControls::onPlaybackStarted( const Tomahawk::result_ptr& result )
ui->seekSlider->setRange( 0, duration );
ui->seekSlider->setValue( 0 );
ui->seekSlider->setEnabled( AudioEngine::instance()->canSeek() );
m_phononTickCheckTimer.stop();
m_sliderTimeLine.stop();
m_sliderTimeLine.setDuration( duration );
@@ -209,102 +211,107 @@ AudioControls::onPlaybackStarted( const Tomahawk::result_ptr& result )
ui->seekSlider->setVisible( true );
int updateRate = (double)1000 / ( (double)ui->seekSlider->contentsRect().width() / (double)( duration / 1000 ) );
m_sliderTimeLine.setUpdateInterval( qBound( 40, updateRate, 500 ) );
m_noTimeChange = false;
m_lastSliderCheck = 0;
Tomahawk::InfoSystem::InfoStringHash trackInfo;
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
AudioControls::onPlaybackLoading( const Tomahawk::result_ptr& result )
{
if ( !m_currentTrack.isNull() )
{
disconnect( m_currentTrack->album().data(), SIGNAL( updated() ), this, SLOT( onAlbumCoverUpdated() ) );
disconnect( m_currentTrack->toQuery().data(), SIGNAL( socialActionsLoaded() ), this, SLOT( onSocialActionsLoaded() ) );
}
tDebug( LOGEXTRA ) << Q_FUNC_INFO;
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->albumLabel->setResult( result );
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->timeLeftLabel->setFixedWidth( ui->timeLeftLabel->fontMetrics().width( QString( duration.length() + 1, QChar( '0' ) ) ) );
ui->timeLeftLabel->setText( "-" + duration );
m_lastTextSecondShown = 0;
ui->timeLeftLabel->setText( "-" + TomahawkUtils::timeToString( result.data()->duration() ) );
ui->stackedLayout->setCurrentWidget( ui->pauseButton );
ui->loveButton->setEnabled( true );
ui->loveButton->setVisible( true );
setAlbumCover();
setSocialActions();
result->loadSocialActions();
connect( result.data(), SIGNAL( socialActionsLoaded() ), this, SLOT( socialActionsLoaded() ) );
}
void
AudioControls::onAlbumCoverUpdated()
AudioControls::socialActionsLoaded()
{
Album* album = qobject_cast< Album* >( sender() );
if ( !album || album != m_currentTrack->album().data() )
return;
Result* r = qobject_cast< Result* >( sender() );
Q_ASSERT( r );
setAlbumCover();
}
void
AudioControls::setAlbumCover()
{
if ( !m_currentTrack->album()->cover( ui->coverImage->size() ).isNull() )
if ( m_currentTrack.data() == r )
{
QPixmap cover;
cover = m_currentTrack->album()->cover( ui->coverImage->size() );
ui->coverImage->setPixmap( cover );
}
else
ui->coverImage->setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::DefaultAlbumCover, TomahawkUtils::ScaledCover, ui->coverImage->size() ) );
}
void
AudioControls::onSocialActionsLoaded()
{
Query* query = qobject_cast< Query* >( sender() );
if ( !query || !m_currentTrack || query != m_currentTrack->toQuery().data() )
return;
query_ptr currentQuery = m_currentTrack->toQuery();
if ( query->artist() == currentQuery->artist() &&
query->track() == currentQuery->track() &&
query->album() == currentQuery->album() )
{
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 );
if ( m_currentTrack->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 );
}
}
}
@@ -317,7 +324,6 @@ AudioControls::onPlaybackPaused()
m_sliderTimeLine.setPaused( true );
}
void
AudioControls::onPlaybackResumed()
{
@@ -334,7 +340,6 @@ AudioControls::onPlaybackSeeked( qint64 msec )
tDebug( LOGEXTRA ) << Q_FUNC_INFO << " setting current timer to " << msec;
m_sliderTimeLine.setPaused( true );
m_sliderTimeLine.setCurrentTime( msec );
m_lastSliderCheck = msec;
m_seekMsecs = msec;
}
@@ -364,61 +369,45 @@ AudioControls::onPlaybackStopped()
void
AudioControls::onPlaybackTimer( qint64 msElapsed )
{
const int seconds = msElapsed / 1000;
if ( seconds != m_lastTextSecondShown && !m_currentTrack.isNull() )
{
ui->timeLabel->setText( TomahawkUtils::timeToString( seconds ) );
ui->timeLeftLabel->setText( "-" + TomahawkUtils::timeToString( m_currentTrack->duration() - seconds ) );
m_lastTextSecondShown = seconds;
}
//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;
//tDebug( LOGEXTRA ) << Q_FUNC_INFO << " msElapsed = " << msElapsed << " and timer current time = " << m_sliderTimeLine.currentTime() << " and m_seekMsecs = " << m_seekMsecs;
if ( m_currentTrack.isNull() )
{
m_sliderTimeLine.stop();
return;
}
ui->seekSlider->blockSignals( true );
if ( sender() != &m_phononTickCheckTimer )
m_phononTickCheckTimer.start( 1000 );
int currentTime = m_sliderTimeLine.currentTime();
const int seconds = msElapsed / 1000;
ui->timeLabel->setText( TomahawkUtils::timeToString( seconds ) );
ui->timeLeftLabel->setText( "-" + TomahawkUtils::timeToString( m_currentTrack->duration() - seconds ) );
if ( m_noTimeChange )
{
if ( currentTime != msElapsed )
if ( m_sliderTimeLine.currentTime() != msElapsed )
{
m_sliderTimeLine.setPaused( true );
m_noTimeChange = false;
m_sliderTimeLine.setCurrentTime( msElapsed );
m_seekMsecs = -1;
m_sliderTimeLine.resume();
}
}
else if ( currentTime >= msElapsed || m_seekMsecs != -1 )
else if ( m_sliderTimeLine.currentTime() >= msElapsed || m_seekMsecs != -1 )
{
m_sliderTimeLine.setPaused( true );
m_noTimeChange = false;
if ( currentTime == msElapsed )
if ( m_sliderTimeLine.currentTime() == msElapsed )
m_noTimeChange = true;
m_sliderTimeLine.setCurrentTime( msElapsed );
m_seekMsecs = -1;
if ( AudioEngine::instance()->state() != AudioEngine::Paused && sender() != &m_phononTickCheckTimer )
if ( AudioEngine::instance()->state() != AudioEngine::Paused )
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 )
{
m_sliderTimeLine.start();
ui->seekSlider->setEnabled( AudioEngine::instance()->canSeek() );
m_sliderTimeLine.resume();
}
else if ( m_sliderTimeLine.state() == QTimeLine::Paused && AudioEngine::instance()->state() != AudioEngine::Paused )
{
ui->seekSlider->setEnabled( AudioEngine::instance()->canSeek() );
m_sliderTimeLine.resume();
}
@@ -597,17 +586,30 @@ AudioControls::droppedTracks( QList< query_ptr > tracks )
void
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 )
{
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
{
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

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

View File

@@ -345,9 +345,6 @@
<property name="text">
<string>Time</string>
</property>
<property name="alignment">
<set>Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
@@ -374,9 +371,6 @@
<property name="text">
<string>Time Left</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>

View File

@@ -82,14 +82,14 @@ BreakPad::BreakPad( const QString& path, bool active )
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 );
QString globalReporter = QString( "%1/%2" ).arg( CMAKE_INSTALL_PREFIX "/" CMAKE_INSTALL_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";
tLog() << "Could not find \"" CRASH_REPORTER_BINARY "\" in \"" CMAKE_INSTALL_PREFIX "/" CMAKE_INSTALL_LIBEXECDIR "\" or application path";
char* creporter;
std::string sreporter = reporter.toStdString();

View File

@@ -21,4 +21,5 @@ ADD_DEFINITIONS( ${QT_DEFINITIONS} )
ADD_EXECUTABLE( tomahawk_crash_reporter WIN32 ${crashreporter_SOURCES} ${crashreporter_HEADERS_MOC} ${crashreporter_UI_HEADERS} ${crashreporter_RC_RCC} )
TARGET_LINK_LIBRARIES( tomahawk_crash_reporter ${QT_LIBRARIES} tomahawklib )
INCLUDE(GNUInstallDirs)
install(TARGETS tomahawk_crash_reporter RUNTIME DESTINATION ${CMAKE_INSTALL_LIBEXECDIR})

View File

@@ -9,7 +9,7 @@
#cmakedefine DEBUG_BUILD
#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}"
#cmakedefine LION

View File

@@ -1,6 +1,6 @@
/* === 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
* it under the terms of the GNU General Public License as published by
@@ -52,8 +52,7 @@ public:
setMinimumSize( sizeHint() );
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
m_widget->setVisible( true );
#endif

View File

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

View File

@@ -19,7 +19,7 @@
#include "AtticaManager.h"
#include "utils/tomahawkutils.h"
#include "TomahawkSettingsGui.h"
#include "tomahawksettings.h"
#include "pipeline.h"
#include <attica/downloaditem.h>
@@ -44,7 +44,7 @@ AtticaManager::AtticaManager( QObject* parent )
connect( &m_manager, SIGNAL( providerAdded( Attica::Provider ) ), this, SLOT( providerAdded( Attica::Provider ) ) );
// 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" );
}
@@ -76,10 +76,7 @@ AtticaManager::loadPixmapsFromCache()
}
QPixmap* icon = new QPixmap( cacheDir.absoluteFilePath( file ) );
if ( !icon->isNull() )
{
m_resolverStates[ info.baseName() ].pixmap = icon;
}
m_resolverStates[ info.baseName() ].pixmap = icon;
}
}
@@ -96,21 +93,14 @@ AtticaManager::savePixmapsToCache()
foreach( const QString& id, m_resolverStates.keys() )
{
if ( !m_resolverStates[ id ].pixmap || !m_resolverStates[ id ].pixmapDirty )
if ( !m_resolverStates[ id ].pixmap )
continue;
const QString filename = cacheDir.absoluteFilePath( QString( "%1.png" ).arg( id ) );
QFile f( filename );
if ( !f.open( QIODevice::WriteOnly ) )
if ( !m_resolverStates[ id ].pixmap->save( filename ) )
{
tLog() << "Failed to open cache file for writing:" << filename;
}
else
{
if ( !m_resolverStates[ id ].pixmap->save( &f ) )
{
tLog() << "Failed to save pixmap into opened file for writing:" << filename;
}
continue;
}
}
}
@@ -178,7 +168,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() );
connect( job, SIGNAL( finished( Attica::BaseJob* ) ), job, SLOT( deleteLater() ) );
@@ -216,7 +206,7 @@ AtticaManager::resolversList( BaseJob* j )
ListJob< Content >* job = static_cast< ListJob< Content >* >( j );
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
loadPixmapsFromCache();
@@ -257,7 +247,6 @@ AtticaManager::resolverIconFetched()
QPixmap* icon = new QPixmap;
icon->loadFromData( data );
m_resolverStates[ resolverId ].pixmap = icon;
m_resolverStates[ resolverId ].pixmapDirty = true;
}
@@ -299,7 +288,7 @@ AtticaManager::syncServerData()
void
AtticaManager::installResolver( const Content& resolver, bool autoEnable )
AtticaManager::installResolver( const Content& resolver )
{
Q_ASSERT( !resolver.id().isNull() );
@@ -313,7 +302,6 @@ AtticaManager::installResolver( const Content& resolver, bool autoEnable )
ItemJob< DownloadItem >* job = m_resolverProvider.downloadLink( resolver.id() );
connect( job, SIGNAL( finished( Attica::BaseJob* ) ), this, SLOT( resolverDownloadFinished( Attica::BaseJob* ) ) );
job->setProperty( "resolverId", resolver.id() );
job->setProperty( "autoEnable", autoEnable );
job->start();
}
@@ -328,12 +316,11 @@ AtticaManager::upgradeResolver( const Content& resolver )
if ( !m_resolverStates.contains( resolver.id() ) || m_resolverStates[ resolver.id() ].state != NeedsUpgrade )
return;
const bool enabled = TomahawkSettings::instance()->enabledScriptResolvers().contains( m_resolverStates[ resolver.id() ].scriptPath );
m_resolverStates[ resolver.id() ].state = Upgrading;
emit resolverStateChanged( resolver.id() );
uninstallResolver( resolver );
installResolver( resolver, enabled );
installResolver( resolver );
}
@@ -350,7 +337,6 @@ AtticaManager::resolverDownloadFinished ( BaseJob* j )
QNetworkReply* reply = TomahawkUtils::nam()->get( QNetworkRequest( url ) );
connect( reply, SIGNAL( finished() ), this, SLOT( payloadFetched() ) );
reply->setProperty( "resolverId", job->property( "resolverId" ) );
reply->setProperty( "autoEnable", job->property( "autoEnable" ) );
}
else
{
@@ -386,12 +372,10 @@ AtticaManager::payloadFetched()
// update with absolute, not relative, path
m_resolverStates[ resolverId ].scriptPath = resolverPath;
const bool autoEnable = reply->property( "autoEnable" ).toBool();
// Do the install / add to tomahawk
Tomahawk::Pipeline::instance()->addScriptResolver( resolverPath, autoEnable );
Tomahawk::Pipeline::instance()->addScriptResolver( resolverPath, true );
m_resolverStates[ resolverId ].state = Installed;
TomahawkSettingsGui::instanceGui()->setAtticaResolverStates( m_resolverStates );
TomahawkSettings::instance()->setAtticaResolverStates( m_resolverStates );
emit resolverInstalled( resolverId );
emit resolverStateChanged( resolverId );
}
@@ -487,7 +471,7 @@ AtticaManager::uninstallResolver( const QString& pathToResolver )
if ( resolver.id() == atticaId ) // this is the one
{
m_resolverStates[ atticaId ].state = Uninstalled;
TomahawkSettingsGui::instanceGui()->setAtticaResolverState( atticaId, Uninstalled );
TomahawkSettings::instance()->setAtticaResolverState( atticaId, Uninstalled );
doResolverRemove( atticaId );
}
@@ -505,7 +489,7 @@ AtticaManager::uninstallResolver( const Content& resolver )
emit resolverStateChanged( resolver.id() );
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() ) );

View File

@@ -52,12 +52,9 @@ public:
ResolverState state;
QPixmap* pixmap;
// internal
bool pixmapDirty;
Resolver( const QString& v, const QString& path, int userR, ResolverState s )
: version( v ), scriptPath( path ), userRating( userR ), state( s ), pixmap( 0 ), pixmapDirty( false ) {}
Resolver() : userRating( -1 ), state( Uninstalled ), pixmap( 0 ), pixmapDirty( false ) {}
: version( v ), scriptPath( path ), userRating( userR ), state( s ), pixmap( 0 ) {}
Resolver() : userRating( -1 ), state( Uninstalled ), pixmap( 0 ) {}
};
typedef QHash< QString, AtticaManager::Resolver > StateHash;
@@ -94,7 +91,7 @@ public:
bool userHasRated( const Attica::Content& c ) const;
public slots:
void installResolver( const Attica::Content& resolver, bool autoEnable = true );
void installResolver( const Attica::Content& resolver );
void upgradeResolver( const Attica::Content& resolver );
signals:

View File

@@ -11,284 +11,6 @@ include( ${QT_USE_FILE} )
add_definitions( ${QT_DEFINITIONS} )
add_definitions( -DQT_SHARED )
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
jobview/ErrorStatusMessage.cpp
jobview/IndexingJobItem.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
utils/closure.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)
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
utils/closure.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
jobview/ErrorStatusMessage.h
jobview/IndexingJobItem.h
thirdparty/Qocoa/qsearchfield.h
)
IF(QCA2_FOUND)
set( libGuiHeaders ${libGuiHeaders} utils/groovesharkparser.h )
ENDIF(QCA2_FOUND)
set( libSources
tomahawksettings.cpp
@@ -296,29 +18,39 @@ set( libSources
pipeline.cpp
aclsystem.cpp
actioncollection.cpp
artist.cpp
artistplaylistinterface.cpp
album.cpp
albumplaylistinterface.cpp
collection.cpp
playlist.cpp
playlistplaylistinterface.cpp
resolver.cpp
ExternalResolver.cpp
query.cpp
result.cpp
source.cpp
sourceplaylistinterface.cpp
viewpage.cpp
viewmanager.cpp
globalactionmanager.cpp
contextmenu.cpp
dropjob.cpp
playlistinterface.cpp
LatchManager.cpp
EchonestCatalogSynchronizer.cpp
sip/SipPlugin.cpp
sip/SipHandler.cpp
sip/SipModel.cpp
sip/sipinfo.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/fuzzyindex.cpp
@@ -372,10 +104,11 @@ set( libSources
database/databasecommand_settrackattributes.cpp
database/database.cpp
infosystem/infosystem.cpp
infosystem/infosystemcache.cpp
infosystem/infosystemworker.cpp
infobar/infobar.cpp
infosystem/infosystemcache.cpp
infosystem/infosystem.cpp
infosystem/infosystemworker.cpp
infosystem/infoplugins/generic/echonestplugin.cpp
infosystem/infoplugins/generic/lastfmplugin.cpp
infosystem/infoplugins/generic/chartsplugin.cpp
@@ -385,6 +118,66 @@ set( libSources
infosystem/infoplugins/generic/musicbrainzPlugin.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/msgprocessor.cpp
network/streamconnection.cpp
@@ -395,28 +188,53 @@ set( libSources
network/connection.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/logger.cpp
utils/qnr_iodevicestream.cpp
utils/proxystyle.cpp
utils/widgetdragfilter.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/kdsharedmemorylocker.cpp
@@ -430,34 +248,41 @@ set( libHeaders
pipeline.h
functimeout.h
playlistinterface.h
aclsystem.h
actioncollection.h
collection.h
query.h
resolver.h
ExternalResolver.h
result.h
source.h
sourceplaylistinterface.h
viewmanager.h
globalactionmanager.h
contextmenu.h
dropjob.h
AtticaManager.h
LatchManager.h
artist.h
artistplaylistinterface.h
album.h
albumplaylistinterface.h
playlist.h
playlistplaylistinterface.h
viewpage.h
EchonestCatalogSynchronizer.h
sip/SipPlugin.h
sip/SipHandler.h
sip/SipModel.h
sip/sipinfo.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/fuzzyindex.h
database/databaseworker.h
@@ -509,11 +334,11 @@ set( libHeaders
database/databasecommand_trackattributes.h
database/databasecommand_settrackattributes.h
infosystem/infosystem.h
infobar/infobar.h
infosystem/infosystem.h
infosystem/infosystemworker.h
infosystem/infosystemcache.h
infosystem/infoplugins/generic/echonestplugin.h
infosystem/infoplugins/generic/lastfmplugin.h
infosystem/infoplugins/generic/chartsplugin.h
@@ -533,32 +358,124 @@ set( libHeaders
network/controlconnection.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/dynamic/DynamicPlaylist.h
playlist/dynamic/GeneratorInterface.h
playlist/dynamic/GeneratorFactory.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/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/whatshotwidget_p.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
utils/tomahawkutilsgui.h
utils/xspfloader.h
utils/qnr_iodevicestream.h
thirdparty/Qocoa/qsearchfield.h
)
set( libHeaders_NoMOC
viewpage.h
infosystem/infoplugins/unix/imageconverter.h
taghandlers/tag.h
taghandlers/apetag.h
taghandlers/asftag.h
taghandlers/id3v1tag.h
taghandlers/id3v2tag.h
taghandlers/mp4tag.h
taghandlers/oggtag.h
playlist/dynamic/GeneratorInterface.h
playlist/dynamic/GeneratorFactory.h
utils/tomahawkutils.h
)
@@ -601,20 +518,20 @@ IF(QCA2_FOUND)
ENDIF(QCA2_FOUND)
IF(LIBATTICA_FOUND)
SET( libGuiSources ${libGuiSources} AtticaManager.cpp )
SET( libGuiHeaders ${libGuiHeaders} AtticaManager.h )
SET( libSources ${libSources} AtticaManager.cpp )
SET( libHeaders ${libHeaders} AtticaManager.h )
INCLUDE_DIRECTORIES( ${LIBATTICA_INCLUDE_DIR} )
ENDIF(LIBATTICA_FOUND)
IF( UNIX AND NOT APPLE )
LIST(APPEND libGuiSources
SET( libSources ${libSources}
infosystem/infoplugins/unix/mprispluginrootadaptor.cpp
infosystem/infoplugins/unix/mprispluginplayeradaptor.cpp
infosystem/infoplugins/unix/mprisplugin.cpp
infosystem/infoplugins/unix/fdonotifyplugin.cpp
infosystem/infoplugins/unix/imageconverter.cpp )
LIST(APPEND libGuiHeaders
SET( libHeaders ${libHeaders}
infosystem/infoplugins/unix/mprispluginrootadaptor.h
infosystem/infoplugins/unix/mprispluginplayeradaptor.h
infosystem/infoplugins/unix/mprisplugin.h
@@ -637,7 +554,6 @@ IF( WIN32 )
"dsound.dll"
"winmm.dll"
"advapi32.dll"
"shlwapi.dll"
)
ENDIF( WIN32 )
@@ -654,8 +570,6 @@ IF( APPLE )
utils/tomahawkutils_mac.mm
thirdparty/Qocoa/qsearchfield_mac.mm )
SET_SOURCE_FILES_PROPERTIES(utils/tomahawkutils_mac.mm PROPERTIES COMPILE_FLAGS "-fvisibility=default")
SET( libHeaders ${libHeaders}
infosystem/infoplugins/mac/adium.h
infosystem/infoplugins/mac/adiumplugin.h )
@@ -671,18 +585,13 @@ IF( APPLE )
/System/Library/Frameworks/AppKit.framework
)
ELSE( APPLE )
SET( libGuiSources ${libGuiSources} thirdparty/Qocoa/qsearchfield.cpp )
SET( libSources ${libSources} thirdparty/Qocoa/qsearchfield.cpp )
ENDIF( APPLE )
IF(LIBLASTFM_FOUND)
SET(LINK_LIBRARIES ${LINK_LIBRARIES} tomahawk_lastfm2 )
ENDIF(LIBLASTFM_FOUND)
IF(BUILD_GUI)
LIST(APPEND libSources ${libGuiSources} )
LIST(APPEND libHeaders ${libGuiHeaders} )
ENDIF()
qt4_wrap_ui( libUI_H ${libUI} )
qt4_wrap_cpp( libMoc ${libHeaders} )
@@ -708,17 +617,15 @@ TARGET_LINK_LIBRARIES( tomahawklib
${TAGLIB_LIBRARIES}
${CLUCENE_LIBRARIES}
${LIBECHONEST_LIBRARY}
${QT_QTSQL_LIBRARY}
${QT_QTUITOOLS_LIBRARY}
${QT_QTGUI_LIBRARY}
${QT_QTSCRIPT_LIBRARY}
${QT_LIBRARIES}
${OS_SPECIFIC_LINK_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
${LINK_LIBRARIES}
)
INSTALL( TARGETS tomahawklib
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib${LIB_SUFFIX}
ARCHIVE DESTINATION lib${LIB_SUFFIX}
)

View File

@@ -342,6 +342,7 @@ EchonestCatalogSynchronizer::tracksRemoved( const QList< unsigned int >& trackId
foreach ( unsigned int id, trackIds )
{
tDebug() << "Deleting item with id:" << id;
Echonest::CatalogUpdateEntry e( Echonest::CatalogTypes::Delete );
e.setItemId( QString::number( id ).toLatin1() );
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 "database/database.h"
#include <QtGui/QAction>
#include <QtCore/QStateMachine>
#include <QtCore/QState>
#include "sourcelist.h"
#include "database/databasecommand_socialaction.h"
#include "sourceplaylistinterface.h"
@@ -33,7 +34,7 @@ LatchManager::LatchManager( QObject* parent )
: QObject( parent )
, 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()
@@ -57,11 +58,11 @@ LatchManager::latchRequest( const source_ptr& source )
m_state = Latching;
m_waitingForLatch = source;
AudioEngine::instance()->playItem( source->playlistInterface(), source->playlistInterface()->nextItem() );
AudioEngine::instance()->playItem( source->getPlaylistInterface().data(), source->getPlaylistInterface()->nextItem() );
}
void
LatchManager::playlistChanged( Tomahawk::playlistinterface_ptr )
LatchManager::playlistChanged( PlaylistInterface* )
{
// If we were latched on and changed, send the listening along stop
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
m_latchedOnTo = m_waitingForLatch;
m_latchedInterface = m_waitingForLatch->playlistInterface();
m_latchedInterface = m_waitingForLatch->getPlaylistInterface();
m_waitingForLatch.clear();
m_state = Latched;
@@ -81,9 +82,7 @@ LatchManager::playlistChanged( Tomahawk::playlistinterface_ptr )
cmd->setTimestamp( QDateTime::currentDateTime().toTime_t() );
Database::instance()->enqueue( QSharedPointer< DatabaseCommand >( cmd ) );
QAction *latchOnAction = ActionCollection::instance()->getAction( "latchOn" );
latchOnAction->setText( tr( "&Catch Up" ) );
latchOnAction->setIcon( QIcon() );
ActionCollection::instance()->getAction( "latchOn" )->setText( tr( "&Catch Up" ) );
// If not, then keep waiting
return;
@@ -109,7 +108,7 @@ LatchManager::playlistChanged( Tomahawk::playlistinterface_ptr )
m_latchedInterface.clear();
// call ourselves to hit the "create latch" condition
playlistChanged( Tomahawk::playlistinterface_ptr() );
playlistChanged( 0 );
return;
}
m_latchedOnTo.clear();
@@ -118,9 +117,7 @@ LatchManager::playlistChanged( Tomahawk::playlistinterface_ptr )
m_state = NotLatched;
QAction *latchOnAction = ActionCollection::instance()->getAction( "latchOn" );
latchOnAction->setText( tr( "&Listen Along" ) );
latchOnAction->setIcon( QIcon( RESPATH "images/headphones-sidebar.png" ) );
ActionCollection::instance()->getAction( "latchOn" )->setText( tr( "&Listen Along" ) );
}
@@ -131,27 +128,12 @@ LatchManager::catchUpRequest()
AudioEngine::instance()->next();
}
void
LatchManager::unlatchRequest( const source_ptr& source )
{
Q_UNUSED( source );
AudioEngine::instance()->stop();
AudioEngine::instance()->setPlaylist( Tomahawk::playlistinterface_ptr() );
AudioEngine::instance()->setPlaylist( 0 );
QAction *latchOnAction = ActionCollection::instance()->getAction( "latchOn" );
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();
ActionCollection::instance()->getAction( "latchOn" )->setText( tr( "&Listen Along" ) );
}

View File

@@ -43,11 +43,10 @@ public slots:
void latchRequest( const Tomahawk::source_ptr& source );
void unlatchRequest( const Tomahawk::source_ptr& source );
void catchUpRequest();
void latchModeChangeRequest( const Tomahawk::source_ptr& source, bool realtime );
private slots:
void playlistChanged( Tomahawk::playlistinterface_ptr );
void playlistChanged( Tomahawk::PlaylistInterface* );
private:
enum State {
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 "tomahawksettings.h"
#include "audio/audioengine.h"
#include "utils/tomahawkutils.h"
#include <tomahawksettings.h>
#include <utils/tomahawkutils.h>
ActionCollection* ActionCollection::s_instance = 0;
ActionCollection* ActionCollection::instance()
@@ -39,39 +38,14 @@ ActionCollection::ActionCollection( QObject *parent )
void
ActionCollection::initActions()
{
QAction *latchOn = new QAction( tr( "&Listen Along" ), this );
latchOn->setIcon( QIcon( RESPATH "images/headphones-sidebar.png" ) );
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;
m_actionCollection[ "latchOn" ] = new QAction( tr( "&Listen Along" ), this );
m_actionCollection[ "latchOff" ] = new QAction( tr( "&Stop Listening Along" ), this );
bool isPublic = TomahawkSettings::instance()->privateListeningMode() == TomahawkSettings::PublicListening;
QAction *privacyToggle = new QAction( ( isPublic ? tr( "&Listen Privately" ) : tr( "&Listen Publicly" ) ), this );
privacyToggle->setIcon( QIcon( RESPATH "images/private-listening.png" ) );
privacyToggle->setIconVisibleInMenu( isPublic );
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;
}
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>
class DLLEXPORT ActionCollection : public QObject
{
Q_OBJECT
public:
static ActionCollection* instance();
@@ -34,15 +35,9 @@ public:
~ActionCollection();
void initActions();
QAction* getAction( const QString& name );
public slots:
void togglePrivateListeningMode();
signals:
void privacyModeChanged();
QAction* getAction( const QString &name );
private:
static ActionCollection* s_instance;

View File

@@ -19,28 +19,21 @@
#include "album.h"
#include "artist.h"
#include "albumplaylistinterface.h"
#include "database/database.h"
#include "database/databaseimpl.h"
#include "database/databasecommand_alltracks.h"
#include "query.h"
#include "utils/logger.h"
using namespace Tomahawk;
Album::~Album()
{
delete m_cover;
}
Album::Album() {}
Album::~Album() {}
album_ptr
Album::get( const Tomahawk::artist_ptr& artist, const QString& name, bool autoCreate )
{
if ( !Database::instance() || !Database::instance()->impl() )
return album_ptr();
int albid = Database::instance()->impl()->albumId( artist->id(), name, autoCreate );
if ( albid < 1 && autoCreate )
return album_ptr();
@@ -61,7 +54,7 @@ Album::get( unsigned int id, const QString& name, const Tomahawk::artist_ptr& ar
return s_albums.value( id );
}
album_ptr a = album_ptr( new Album( id, name, artist ), &QObject::deleteLater );
album_ptr a = album_ptr( new Album( id, name, artist ) );
if ( id > 0 )
s_albums.insert( id, a );
@@ -70,118 +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 )
: QObject()
: PlaylistInterface( this )
, m_id( id )
, m_name( name )
, m_artist( artist )
, m_cover( 0 )
, 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
Album::onTracksAdded( const QList<Tomahawk::query_ptr>& tracks )
{
Tomahawk::AlbumPlaylistInterface* api = dynamic_cast< Tomahawk::AlbumPlaylistInterface* >( playlistInterface().data() );
if ( api )
api->addQueries( tracks );
qDebug() << Q_FUNC_INFO;
m_queries << 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
Album::artist() const
{
return m_artist;
}
#ifndef ENABLE_HEADLESS
QPixmap
Album::cover( const QSize& size, bool forceLoad ) const
QList<Tomahawk::query_ptr>
Album::tracks()
{
if ( !m_infoLoaded )
if ( m_queries.isEmpty() )
{
if ( !forceLoad )
return QPixmap();
m_uuid = uuid();
DatabaseCommand_AllTracks* cmd = new DatabaseCommand_AllTracks();
cmd->setAlbum( this );
cmd->setSortOrder( DatabaseCommand_AllTracks::AlbumPosition );
Tomahawk::InfoSystem::InfoStringHash trackInfo;
trackInfo["artist"] = artist()->name();
trackInfo["album"] = name();
connect( cmd, SIGNAL( tracks( QList<Tomahawk::query_ptr>, QVariant ) ),
SLOT( onTracksAdded( QList<Tomahawk::query_ptr> ) ) );
Tomahawk::InfoSystem::InfoRequestData requestData;
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 );
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( cmd ) );
}
if ( !m_cover && !m_coverBuffer.isEmpty() )
{
m_cover = new QPixmap();
m_cover->loadFromData( m_coverBuffer );
}
if ( m_cover && !m_cover->isNull() && !size.isEmpty() )
{
if ( m_coverCache.contains( size.width() ) )
{
return m_coverCache.value( size.width() );
}
QPixmap scaledCover;
scaledCover = m_cover->scaled( size, Qt::KeepAspectRatio, Qt::SmoothTransformation );
m_coverCache.insert( size.width(), scaledCover );
return scaledCover;
}
if ( m_cover )
return *m_cover;
else
return QPixmap();
}
#endif
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_coverBuffer = ba;
}
}
emit updated();
}
Tomahawk::playlistinterface_ptr
Album::playlistInterface()
{
if ( m_playlistInterface.isNull() )
{
m_playlistInterface = Tomahawk::playlistinterface_ptr( new Tomahawk::AlbumPlaylistInterface( this ) );
}
return m_playlistInterface;
return m_queries;
}

View File

@@ -19,23 +19,17 @@
#ifndef TOMAHAWKALBUM_H
#define TOMAHAWKALBUM_H
#include "config.h"
#include <QtCore/QObject>
#include <QtCore/QSharedPointer>
#ifndef ENABLE_HEADLESS
#include <QtGui/QPixmap>
#endif
#include <QObject>
#include <QSharedPointer>
#include "typedefs.h"
#include "playlistinterface.h"
#include "dllmacro.h"
#include "infosystem/infosystem.h"
namespace Tomahawk
{
class DLLEXPORT Album : public QObject
class DLLEXPORT Album : public QObject, public PlaylistInterface
{
Q_OBJECT
@@ -43,44 +37,56 @@ public:
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 );
explicit Album( unsigned int id, const QString& name, const Tomahawk::artist_ptr& artist );
virtual ~Album();
Album( unsigned int id, const QString& name, const Tomahawk::artist_ptr& artist );
~Album();
unsigned int id() const { return m_id; }
QString name() const { return m_name; }
artist_ptr artist() const;
#ifndef ENABLE_HEADLESS
QPixmap cover( const QSize& size, bool forceLoad = true ) const;
#endif
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:
void repeatModeChanged( PlaylistInterface::RepeatMode mode );
void shuffleModeChanged( bool enabled );
void tracksAdded( const QList<Tomahawk::query_ptr>& tracks );
void updated();
void trackCountChanged( unsigned int tracks );
void sourceTrackCountChanged( unsigned int tracks );
void nextTrackReady();
private slots:
void onTracksAdded( const QList<Tomahawk::query_ptr>& tracks );
void infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output );
private:
Q_DISABLE_COPY( Album )
Album();
unsigned int m_id;
QString m_name;
artist_ptr m_artist;
QByteArray m_coverBuffer;
mutable QPixmap* m_cover;
bool m_infoLoaded;
mutable QString m_uuid;
mutable QHash< int, QPixmap > m_coverCache;
Tomahawk::playlistinterface_ptr m_playlistInterface;
QList<Tomahawk::query_ptr> m_queries;
result_ptr m_currentItem;
unsigned int m_currentTrack;
};
} // ns
}; // ns
#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,82 +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:
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 "artistplaylistinterface.h"
#include "collection.h"
#include "database/database.h"
#include "database/databaseimpl.h"
#include "database/databasecommand_alltracks.h"
#include "query.h"
#include "utils/logger.h"
@@ -29,18 +29,19 @@
using namespace Tomahawk;
Artist::Artist()
{
}
Artist::~Artist()
{
delete m_cover;
}
artist_ptr
Artist::get( const QString& name, bool autoCreate )
{
if ( !Database::instance() || !Database::instance()->impl() )
return artist_ptr();
int artid = Database::instance()->impl()->artistId( name, autoCreate );
if ( artid < 1 && autoCreate )
return artist_ptr();
@@ -61,7 +62,7 @@ Artist::get( unsigned int id, const QString& name )
return s_artists.value( id );
}
artist_ptr a = artist_ptr( new Artist( id, name ), &QObject::deleteLater );
artist_ptr a = artist_ptr( new Artist( id, name ) );
if ( id > 0 )
s_artists.insert( id, a );
@@ -70,110 +71,76 @@ Artist::get( unsigned int id, const QString& name )
Artist::Artist( unsigned int id, const QString& name )
: QObject()
: PlaylistInterface( this )
, m_id( id )
, m_name( name )
, m_cover( 0 )
, m_infoLoaded( false )
, m_currentItem( 0 )
, m_currentTrack( 0 )
{
m_sortname = DatabaseImpl::sortname( name, true );
connect( Tomahawk::InfoSystem::InfoSystem::instance(),
SIGNAL( info( Tomahawk::InfoSystem::InfoRequestData, QVariant ) ),
SLOT( infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData, QVariant ) ) );
}
void
Artist::onTracksAdded( const QList<Tomahawk::query_ptr>& tracks )
{
Tomahawk::ArtistPlaylistInterface* api = dynamic_cast< Tomahawk::ArtistPlaylistInterface* >( playlistInterface().data() );
if ( api )
api->addQueries( tracks );
qDebug() << Q_FUNC_INFO;
m_queries << tracks;
emit tracksAdded( tracks );
}
#ifndef ENABLE_HEADLESS
QPixmap
Artist::cover( const QSize& size, bool forceLoad ) const
Tomahawk::result_ptr
Artist::siblingItem( int itemsAway )
{
if ( !m_infoLoaded )
{
if ( !forceLoad )
return QPixmap();
m_uuid = uuid();
int p = m_currentTrack;
p += itemsAway;
Tomahawk::InfoSystem::InfoStringHash trackInfo;
trackInfo["artist"] = name();
if ( p < 0 )
return Tomahawk::result_ptr();
Tomahawk::InfoSystem::InfoRequestData requestData;
requestData.caller = m_uuid;
requestData.type = Tomahawk::InfoSystem::InfoArtistImages;
requestData.input = QVariant::fromValue< Tomahawk::InfoSystem::InfoStringHash >( trackInfo );
requestData.customData = QVariantMap();
if ( p >= m_queries.count() )
return Tomahawk::result_ptr();
Tomahawk::InfoSystem::InfoSystem::instance()->getInfo( requestData );
}
if ( !m_cover && !m_coverBuffer.isEmpty() )
{
m_cover = new QPixmap();
m_cover->loadFromData( m_coverBuffer );
}
if ( m_cover && !m_cover->isNull() && !size.isEmpty() )
{
if ( m_coverCache.contains( size.width() ) )
{
return m_coverCache.value( size.width() );
}
QPixmap scaledCover;
scaledCover = m_cover->scaled( size, Qt::KeepAspectRatio, Qt::SmoothTransformation );
m_coverCache.insert( size.width(), scaledCover );
return scaledCover;
}
if ( m_cover )
return *m_cover;
else
return QPixmap();
}
#endif
void
Artist::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output )
{
if ( requestData.caller != m_uuid ||
requestData.type != Tomahawk::InfoSystem::InfoArtistImages )
{
return;
}
m_infoLoaded = true;
if ( !output.isNull() && output.isValid() )
{
QVariantMap returnedData = output.value< QVariantMap >();
const QByteArray ba = returnedData["imgbytes"].toByteArray();
if ( ba.length() )
{
m_coverBuffer = ba;
}
}
emit updated();
m_currentTrack = p;
m_currentItem = m_queries.at( p )->results().first();
return m_currentItem;
}
Tomahawk::playlistinterface_ptr
Artist::playlistInterface()
bool
Artist::hasNextItem()
{
if ( m_playlistInterface.isNull() )
int p = m_currentTrack;
p++;
if ( p < 0 || p >= m_queries.count() )
return false;
return true;
}
result_ptr
Artist::currentItem() const
{
return m_currentItem;
}
QList<Tomahawk::query_ptr>
Artist::tracks()
{
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,67 +19,75 @@
#ifndef TOMAHAWKARTIST_H
#define TOMAHAWKARTIST_H
#include "config.h"
#include <QtCore/QObject>
#include <QtCore/QSharedPointer>
#ifndef ENABLE_HEADLESS
#include <QtGui/QPixmap>
#endif
#include <QObject>
#include <QSharedPointer>
#include "typedefs.h"
#include "playlistinterface.h"
#include "dllmacro.h"
#include "infosystem/infosystem.h"
namespace Tomahawk
{
class DLLEXPORT Artist : public QObject
class DLLEXPORT Artist : public QObject, public PlaylistInterface
{
Q_OBJECT
public:
static artist_ptr get( const QString& name, bool autoCreate = false );
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();
unsigned int id() const { return m_id; }
QString name() const { return m_name; }
QString sortname() const { return m_sortname; }
#ifndef ENABLE_HEADLESS
QPixmap cover( const QSize& size, bool forceLoad = true ) const;
#endif
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:
void repeatModeChanged( PlaylistInterface::RepeatMode mode );
void shuffleModeChanged( bool enabled );
void tracksAdded( const QList<Tomahawk::query_ptr>& tracks );
void updated();
void trackCountChanged( unsigned int tracks );
void sourceTrackCountChanged( unsigned int tracks );
void nextTrackReady();
private slots:
void onTracksAdded( const QList<Tomahawk::query_ptr>& tracks );
void infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output );
private:
Q_DISABLE_COPY( Artist )
Q_DISABLE_COPY(Artist)
unsigned int m_id;
QString m_name;
QString m_sortname;
QByteArray m_coverBuffer;
mutable QPixmap* m_cover;
bool m_infoLoaded;
mutable QString m_uuid;
mutable QHash< int, QPixmap > m_coverCache;
Tomahawk::playlistinterface_ptr m_playlistInterface;
QList<Tomahawk::query_ptr> m_queries;
result_ptr m_currentItem;
unsigned int m_currentTrack;
};
} // ns
}; // ns
#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 ) ),
m_artist.data(), 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,20 +18,19 @@
#include "audioengine.h"
#include "config.h"
#include <QtCore/QUrl>
#include <QtNetwork/QNetworkReply>
#include <QUrl>
#include <QNetworkReply>
#include "playlistinterface.h"
#include "sourceplaylistinterface.h"
#include "tomahawksettings.h"
#include "actioncollection.h"
#include "database/database.h"
#include "database/databasecommand_logplayback.h"
#include "network/servent.h"
#include "utils/qnr_iodevicestream.h"
#include "headlesscheck.h"
#include "infosystem/infosystem.h"
#include "album.h"
#include "utils/logger.h"
@@ -53,10 +52,12 @@ AudioEngine::instance()
AudioEngine::AudioEngine()
: QObject()
, m_isPlayingHttp( false )
, m_queue( 0 )
, m_timeElapsed( 0 )
, m_expectStop( false )
, m_waitingOnNewTrack( false )
, m_infoSystemConnected( false )
, m_state( Stopped )
{
s_instance = this;
@@ -74,9 +75,12 @@ AudioEngine::AudioEngine()
connect( m_mediaObject, SIGNAL( tick( qint64 ) ), SLOT( timerTriggered( qint64 ) ) );
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() );
@@ -131,11 +135,8 @@ AudioEngine::play()
if ( isPaused() )
{
setVolume( m_volume );
m_mediaObject->play();
setVolume( m_volume );
emit resumed();
Tomahawk::InfoSystem::InfoStringHash trackInfo;
trackInfo["title"] = m_currentTrack->track();
@@ -155,7 +156,6 @@ AudioEngine::pause()
{
tDebug( LOGEXTRA ) << Q_FUNC_INFO;
m_volume = volume();
m_mediaObject->pause();
emit paused();
@@ -167,8 +167,6 @@ void
AudioEngine::stop()
{
tDebug( LOGEXTRA ) << Q_FUNC_INFO;
emit stopped();
if ( isStopped() )
return;
@@ -180,17 +178,20 @@ AudioEngine::stop()
if ( !m_currentTrack.isNull() )
emit timerPercentage( ( (double)m_timeElapsed / (double)m_currentTrack->duration() ) * 100.0 );
emit stopped();
setCurrentTrack( Tomahawk::result_ptr() );
Tomahawk::InfoSystem::InfoTypeMap map;
map[ Tomahawk::InfoSystem::InfoNowStopped ] = QVariant();
if ( m_waitingOnNewTrack )
emit sendWaitingNotification();
{
sendWaitingNotification();
}
else if ( TomahawkSettings::instance()->verboseNotifications() )
{
QVariantMap stopInfo;
stopInfo["message"] = tr( "Tomahawk is stopped." );
stopInfo["message"] = QString( "Tomahawk is stopped." );
map[ Tomahawk::InfoSystem::InfoNotifyUser ] = QVariant::fromValue< QVariantMap >( stopInfo );
}
@@ -233,12 +234,12 @@ AudioEngine::canGoNext()
m_playlist.data()->skipRestrictions() == PlaylistInterface::NoSkipForwards )
return false;
if ( !m_currentTrack.isNull() && !m_playlist->hasNextItem() &&
( m_playlist->currentItem().isNull() || ( m_currentTrack->id() == m_playlist->currentItem()->id() ) ) )
if ( !m_currentTrack.isNull() && !m_playlist.data()->hasNextItem() &&
( 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
//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;
}
@@ -316,13 +317,8 @@ AudioEngine::mute()
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;
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(
@@ -334,42 +330,62 @@ AudioEngine::sendWaitingNotificationSlot() const
void
AudioEngine::sendNowPlayingNotification()
{
#ifndef ENABLE_HEADLESS
if ( m_currentTrack->album().isNull() || m_currentTrack->album()->infoLoaded() )
onNowPlayingInfoReady();
else
tDebug( LOGEXTRA ) << Q_FUNC_INFO;
if ( ! m_infoSystemConnected )
{
connect( m_currentTrack->album().data(), SIGNAL( updated() ), SLOT( onNowPlayingInfoReady() ), Qt::UniqueConnection );
m_currentTrack->album()->cover( QSize( 0, 0 ) );
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 ) ) );
m_infoSystemConnected = true;
}
#endif
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
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() ||
m_currentTrack->track().isNull() ||
m_currentTrack->artist().isNull() )
return;
if ( !m_currentTrack->album().isNull() && sender() && m_currentTrack->album().data() != sender() )
return;
QVariantMap playInfo;
playInfo["message"] = tr( "Tomahawk is playing \"%1\" by %2%3." )
.arg( m_currentTrack->track() )
.arg( m_currentTrack->artist()->name() )
.arg( m_currentTrack->album().isNull() ? QString() : QString( " %1" ).arg( tr( "on album %1" ).arg( m_currentTrack->album()->name() ) ) );
if ( !m_currentTrack->album().isNull() )
.arg( m_currentTrack->album().isNull() ? QString() : tr( " on album %1" ).arg( m_currentTrack->album()->name() ) );
if ( !output.isNull() && output.isValid() )
{
#ifndef ENABLE_HEADLESS
QImage cover;
cover = m_currentTrack->album()->cover( QSize( 0, 0 ) ).toImage();
playInfo["image"] = QVariant( cover );
#endif
QVariantMap returnedData = output.value< QVariantMap >();
const QByteArray ba = returnedData["imgbytes"].toByteArray();
if ( ba.length() )
{
QPixmap pm;
pm.loadFromData( ba );
playInfo["image"] = QVariant( pm.toImage() );
}
}
Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo(
@@ -378,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( ( isPublic ? tr( "&Listen Privately" ) : tr( "&Listen Publicly" ) ) );
privacyToggle->setIconVisibleInMenu( isPublic );
#endif
}
bool
AudioEngine::loadTrack( const Tomahawk::result_ptr& result )
{
@@ -415,6 +457,7 @@ AudioEngine::loadTrack( const Tomahawk::result_ptr& result )
else
m_mediaObject->setCurrentSource( io.data() );
m_mediaObject->currentSource().setAutoDelete( false );
m_isPlayingHttp = false;
}
else
{
@@ -435,11 +478,11 @@ AudioEngine::loadTrack( const Tomahawk::result_ptr& result )
if ( furl.startsWith( "file://" ) )
furl = furl.right( furl.length() - 7 );
#endif
tLog( LOGVERBOSE ) << "Passing to Phonon:" << furl << furl.toLatin1();
m_mediaObject->setCurrentSource( furl );
}
m_mediaObject->currentSource().setAutoDelete( true );
m_isPlayingHttp = true;
}
if ( !m_input.isNull() )
@@ -452,8 +495,8 @@ AudioEngine::loadTrack( const Tomahawk::result_ptr& result )
emit started( m_currentTrack );
if ( TomahawkSettings::instance()->verboseNotifications() )
sendNowPlayingNotification();
sendNowPlayingNotification();
if ( TomahawkSettings::instance()->privateListeningMode() != TomahawkSettings::FullyPrivate )
{
DatabaseCommand_LogPlayback* cmd = new DatabaseCommand_LogPlayback( m_currentTrack, DatabaseCommand_LogPlayback::Started );
@@ -537,7 +580,7 @@ AudioEngine::loadNextTrack()
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() );
@@ -545,7 +588,7 @@ AudioEngine::playItem( Tomahawk::playlistinterface_ptr playlist, const Tomahawk:
m_playlist.data()->reset();
setPlaylist( playlist );
m_currentTrackPlaylist = playlist;
m_currentTrackPlaylist = playlist->getSharedPointer();
if ( !result.isNull() )
loadTrack( result );
@@ -553,7 +596,7 @@ AudioEngine::playItem( Tomahawk::playlistinterface_ptr playlist, const Tomahawk:
{
m_waitingOnNewTrack = true;
if ( isStopped() )
emit sendWaitingNotification();
sendWaitingNotification();
else
stop();
}
@@ -561,16 +604,8 @@ AudioEngine::playItem( Tomahawk::playlistinterface_ptr playlist, const Tomahawk:
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 )
return;
@@ -594,10 +629,7 @@ AudioEngine::onStateChanged( Phonon::State newState, Phonon::State oldState )
if ( newState == Phonon::ErrorState )
{
stop();
tLog() << "Phonon Error:" << m_mediaObject->errorString() << m_mediaObject->errorType();
emit error( UnknownError );
return;
}
if ( newState == Phonon::PlayingState )
@@ -669,26 +701,26 @@ AudioEngine::timerTriggered( qint64 time )
void
AudioEngine::setPlaylist( Tomahawk::playlistinterface_ptr playlist )
AudioEngine::setPlaylist( PlaylistInterface* playlist )
{
if ( !m_playlist.isNull() )
{
if ( m_playlist.data() && m_playlist.data()->retryMode() == PlaylistInterface::Retry )
disconnect( m_playlist.data(), SIGNAL( nextTrackReady() ) );
if ( m_playlist.data()->object() && m_playlist.data()->retryMode() == PlaylistInterface::Retry )
disconnect( m_playlist.data()->object(), SIGNAL( nextTrackReady() ) );
m_playlist.data()->reset();
}
if ( playlist.isNull() )
if ( !playlist )
{
m_playlist.clear();
emit playlistChanged( playlist );
return;
}
m_playlist = playlist;
m_playlist = playlist->getSharedPointer();
if ( !m_playlist.isNull() && m_playlist.data() && m_playlist.data()->retryMode() == PlaylistInterface::Retry )
connect( m_playlist.data(), SIGNAL( nextTrackReady() ), SLOT( onPlaylistNextTrackReady() ) );
if ( m_playlist.data()->object() && m_playlist.data()->retryMode() == PlaylistInterface::Retry )
connect( m_playlist.data()->object(), SIGNAL( nextTrackReady() ), SLOT( playlistNextTrackReady() ) );
emit playlistChanged( playlist );
}

View File

@@ -19,28 +19,33 @@
#ifndef AUDIOENGINE_H
#define AUDIOENGINE_H
#include <QtCore/QObject>
#include <QtCore/QTimer>
#include <QObject>
#include <QTimer>
#include <phonon/MediaObject>
#include <phonon/AudioOutput>
#include <phonon/BackendCapabilities>
#include "infosystem/infosystem.h"
#include "result.h"
#include "typedefs.h"
#include "playlistinterface.h"
#include "dllmacro.h"
#define AUDIO_VOLUME_STEP 5
namespace Tomahawk
{
class PlaylistInterface;
}
class DLLEXPORT AudioEngine : public QObject
{
Q_OBJECT
public:
enum AudioErrorCode { StreamReadError, AudioDeviceError, DecodeError, UnknownError };
enum AudioErrorCode { StreamReadError, AudioDeviceError, DecodeError };
enum AudioState { Stopped, Playing, Paused };
static AudioEngine* instance();
@@ -57,10 +62,10 @@ public:
bool isStopped() const { return m_state == Stopped; }
/* 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! */
Tomahawk::playlistinterface_ptr playlist() const { return m_playlist; }
Tomahawk::PlaylistInterface* playlist() const { return m_playlist.data(); }
Tomahawk::result_ptr currentTrack() const { return m_currentTrack; }
@@ -85,11 +90,19 @@ public slots:
void setVolume( int percentage );
void lowerVolume() { setVolume( volume() - AUDIO_VOLUME_STEP ); }
void raiseVolume() { setVolume( volume() + AUDIO_VOLUME_STEP ); }
void onVolumeChanged( qreal volume ) { emit volumeChanged( volume * 100 ); }
void mute();
void playItem( Tomahawk::playlistinterface_ptr playlist, const Tomahawk::result_ptr& result );
void setPlaylist( Tomahawk::playlistinterface_ptr playlist );
void setQueue( Tomahawk::playlistinterface_ptr queue ) { m_queue = queue; }
void playItem( Tomahawk::PlaylistInterface* playlist, const Tomahawk::result_ptr& result );
void setPlaylist( Tomahawk::PlaylistInterface* playlist );
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:
void loading( const Tomahawk::result_ptr& track );
@@ -108,11 +121,9 @@ signals:
void timerSeconds( unsigned int secondsElapsed );
void timerPercentage( unsigned int percentage );
void playlistChanged( Tomahawk::playlistinterface_ptr playlist );
void playlistChanged( Tomahawk::PlaylistInterface* playlist );
void error( AudioEngine::AudioErrorCode errorCode );
void sendWaitingNotification();
void error( AudioErrorCode errorCode );
private slots:
bool loadTrack( const Tomahawk::result_ptr& result );
@@ -121,14 +132,9 @@ private slots:
void onAboutToFinish();
void onStateChanged( Phonon::State newState, Phonon::State oldState );
void onVolumeChanged( qreal volume ) { emit volumeChanged( volume * 100 ); }
void timerTriggered( qint64 time );
void setCurrentTrack( const Tomahawk::result_ptr& result );
void onNowPlayingInfoReady();
void onPlaylistNextTrackReady();
void sendWaitingNotificationSlot() const;
private:
void setState( AudioState state );
@@ -136,15 +142,17 @@ private:
bool isHttpResult( const QString& ) const;
bool isLocalResult( const QString& ) const;
void sendWaitingNotification() const;
void sendNowPlayingNotification();
bool m_isPlayingHttp;
QSharedPointer<QIODevice> m_input;
Tomahawk::result_ptr m_currentTrack;
Tomahawk::result_ptr m_lastTrack;
Tomahawk::playlistinterface_ptr m_playlist;
Tomahawk::playlistinterface_ptr m_currentTrackPlaylist;
Tomahawk::playlistinterface_ptr m_queue;
QWeakPointer< Tomahawk::PlaylistInterface > m_playlist;
QWeakPointer< Tomahawk::PlaylistInterface > m_currentTrackPlaylist;
Tomahawk::PlaylistInterface* m_queue;
Phonon::MediaObject* m_mediaObject;
Phonon::AudioOutput* m_audioOutput;
@@ -152,10 +160,10 @@ private:
unsigned int m_timeElapsed;
bool m_expectStop;
bool m_waitingOnNewTrack;
bool m_infoSystemConnected;
mutable QStringList m_supportedMimeTypes;
AudioState m_state;
unsigned int m_volume;
static AudioEngine* s_instance;
};

View File

@@ -149,24 +149,24 @@ Collection::deleteStation( const dynplaylist_ptr& s )
}
Tomahawk::playlist_ptr
playlist_ptr
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 )
{
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 )
{
return m_stations.value( guid, Tomahawk::dynplaylist_ptr() );
return m_stations.value( guid, dynplaylist_ptr() );
}
@@ -211,7 +211,7 @@ Collection::setStations( const QList< dynplaylist_ptr >& stations )
void
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 );
@@ -221,7 +221,7 @@ Collection::setTracks( const QList<unsigned int>& ids )
void
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 );
@@ -231,7 +231,6 @@ Collection::delTracks( const QList<unsigned int>& ids )
void
Collection::onSynced()
{
tDebug() << Q_FUNC_INFO << m_changed;
if ( m_changed )
{
m_changed = false;

View File

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

View File

@@ -33,7 +33,6 @@
#include "playlist/treemodel.h"
#include "utils/stylehelper.h"
#include "utils/tomahawkutilsgui.h"
#define ANIMATION_TIME 450
#define SLIDE_TIME 350
@@ -94,7 +93,6 @@ ContextWidget::ContextWidget( QWidget* parent )
setAutoFillBackground( true );
setFixedHeight( m_minHeight );
ensurePolished();
QPalette pal = palette();
pal.setBrush( QPalette::Window, StyleHelper::headerLowerColor() );
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
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
ContextWidget::setQuery( const Tomahawk::query_ptr& query, bool force )
{
@@ -331,8 +275,6 @@ ContextWidget::onAnimationFinished()
fadeOut( false );
m_scene->setSceneRect( ui->contextView->viewport()->rect() );
layoutViews( false );
setArtist( m_artist );
setAlbum( m_album );
setQuery( m_query, true );
ui->toggleButton->setText( tr( "Hide Footnotes" ) );

View File

@@ -50,8 +50,6 @@ public:
~ContextWidget();
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 toggleSize();
@@ -65,7 +63,6 @@ private slots:
protected:
void paintEvent( QPaintEvent* e );
void resizeEvent( QResizeEvent* e );
void changeEvent( QEvent* e );
private:
void fadeOut( bool animate );
@@ -84,8 +81,6 @@ private:
int m_currentView;
Tomahawk::artist_ptr m_artist;
Tomahawk::album_ptr m_album;
Tomahawk::query_ptr m_query;
bool m_visible;
};

View File

@@ -32,13 +32,10 @@ RelatedArtistsContext::RelatedArtistsContext()
{
m_relatedView = new ArtistView();
m_relatedView->setGuid( "RelatedArtistsContext" );
m_relatedView->setUpdatesContextView( false );
m_relatedModel = new TreeModel( m_relatedView );
m_relatedModel->setColumnStyle( TreeModel::TrackOnly );
m_relatedView->setTreeModel( m_relatedModel );
m_relatedView->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
m_relatedView->setSortingEnabled( false );
m_relatedView->proxyModel()->sort( -1 );
QPalette pal = m_relatedView->palette();
pal.setColor( QPalette::Window, QColor( 0, 0, 0, 0 ) );
@@ -61,17 +58,15 @@ RelatedArtistsContext::~RelatedArtistsContext()
void
RelatedArtistsContext::setArtist( const Tomahawk::artist_ptr& artist )
RelatedArtistsContext::setQuery( const Tomahawk::query_ptr& query )
{
if ( artist.isNull() )
return;
if ( !m_artist.isNull() && m_artist->name() == artist->name() )
if ( !m_query.isNull() && query->artist() == m_query->artist() )
return;
m_artist = artist;
m_query = query;
Tomahawk::InfoSystem::InfoStringHash artistInfo;
artistInfo["artist"] = artist->name();
artistInfo["artist"] = query->artist();
Tomahawk::InfoSystem::InfoRequestData requestData;
requestData.caller = m_infoId;
@@ -83,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
RelatedArtistsContext::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output )
{
@@ -114,9 +89,9 @@ RelatedArtistsContext::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData req
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;
}
}

View File

@@ -23,8 +23,6 @@
#include "dllmacro.h"
#include "artist.h"
#include "album.h"
#include "query.h"
#include "context/ContextPage.h"
#include "infosystem/infosystem.h"
@@ -42,7 +40,7 @@ public:
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 description() const { return QString(); }
@@ -50,8 +48,6 @@ public:
virtual bool jumpToCurrentTrack() { return false; }
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 );
private slots:
@@ -65,7 +61,7 @@ private:
QGraphicsProxyWidget* m_proxy;
QString m_infoId;
Tomahawk::artist_ptr m_artist;
Tomahawk::query_ptr m_query;
};
#endif // RELATEDARTISTSCONTEXT_H

View File

@@ -58,17 +58,15 @@ TopTracksContext::~TopTracksContext()
void
TopTracksContext::setArtist( const Tomahawk::artist_ptr& artist )
TopTracksContext::setQuery( const Tomahawk::query_ptr& query )
{
if ( artist.isNull() )
return;
if ( !m_artist.isNull() && m_artist->name() == artist->name() )
if ( !m_query.isNull() && query->artist() == m_query->artist() )
return;
m_artist = artist;
m_query = query;
Tomahawk::InfoSystem::InfoStringHash artistInfo;
artistInfo["artist"] = artist->name();
artistInfo["artist"] = query->artist();
Tomahawk::InfoSystem::InfoRequestData requestData;
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
TopTracksContext::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output )
{
@@ -111,9 +89,9 @@ TopTracksContext::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestD
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;
}
}
@@ -129,7 +107,7 @@ TopTracksContext::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestD
int i = 0;
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 );
if ( ++i == 15 )

View File

@@ -23,8 +23,6 @@
#include "dllmacro.h"
#include "artist.h"
#include "album.h"
#include "query.h"
#include "context/ContextPage.h"
#include "infosystem/infosystem.h"
@@ -42,7 +40,7 @@ public:
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 description() const { return QString(); }
@@ -50,8 +48,6 @@ public:
virtual bool jumpToCurrentTrack() { return false; }
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 );
private slots:
@@ -65,7 +61,7 @@ private:
QGraphicsProxyWidget* m_proxy;
QString m_infoId;
Tomahawk::artist_ptr m_artist;
Tomahawk::query_ptr m_query;
};
#endif // TOPTRACKSCONTEXT_H

View File

@@ -21,70 +21,23 @@
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
WikipediaContext::setQuery( const Tomahawk::query_ptr& query )
{
if ( query.isNull() )
if ( !m_query.isNull() && query->artist() == m_query->artist() )
return;
setArtist( Artist::get( query->artist(), false ) );
}
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() );
m_query = query;
webView()->load( QString( "http://en.wikipedia.org/w/index.php?useformat=mobile&title=%1" ).arg( query->artist() ) );
}
void
LastfmContext::setQuery( const Tomahawk::query_ptr& query )
{
if ( query.isNull() )
if ( !m_query.isNull() && query->artist() == m_query->artist() )
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 "artist.h"
#include "album.h"
#include "query.h"
#include "WebContext.h"
@@ -36,7 +34,7 @@ public:
WikipediaContext() : WebContext() {}
~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 description() const { return QString(); }
@@ -44,12 +42,10 @@ public:
virtual bool jumpToCurrentTrack() { return false; }
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 );
private:
Tomahawk::artist_ptr m_artist;
Tomahawk::query_ptr m_query;
};
@@ -61,7 +57,7 @@ public:
LastfmContext() : WebContext() {}
~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 description() const { return QString(); }
@@ -69,12 +65,10 @@ public:
virtual bool jumpToCurrentTrack() { return false; }
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 );
private:
Tomahawk::artist_ptr m_artist;
Tomahawk::query_ptr m_query;
};
#endif // WIKIPEDIACONTEXT_H

View File

@@ -32,19 +32,15 @@ using namespace Tomahawk;
ContextMenu::ContextMenu( QWidget* parent )
: QMenu( parent )
, m_loveAction( 0 )
{
m_sigmap = new QSignalMapper( this );
connect( m_sigmap, SIGNAL( mapped( int ) ), SLOT( onTriggered( int ) ) );
m_supportedActions = ActionPlay | ActionQueue | ActionCopyLink | ActionLove;
m_supportedActions = ActionPlay | ActionQueue | ActionCopyLink;
}
ContextMenu::~ContextMenu()
{
}
{}
void
ContextMenu::clear()
@@ -54,22 +50,23 @@ ContextMenu::clear()
m_queries.clear();
m_albums.clear();
m_artists.clear();
}
}
unsigned int
ContextMenu::itemCount() const
{
return m_queries.count() + m_artists.count() + m_albums.count();
return m_queries.count() + m_artists.count() + m_albums.count();
}
void
ContextMenu::setQueries( const QList<Tomahawk::query_ptr>& queries )
{
if ( queries.isEmpty() )
return;
QMenu::clear();
m_queries.clear();
m_queries << queries;
@@ -82,26 +79,19 @@ ContextMenu::setQueries( const QList<Tomahawk::query_ptr>& queries )
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() ) );
m_queries.first()->loadSocialActions();
onSocialActionsLoaded();
}
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();
if ( m_supportedActions & ActionDelete )
m_sigmap->setMapping( addAction( queries.count() > 1 ? tr( "&Delete Items" ) : tr( "&Delete Item" ) ), ActionDelete );
foreach ( QAction* action, actions() )
{
connect( action, SIGNAL( triggered() ), m_sigmap, SLOT( map() ) );
}
}
@@ -117,6 +107,7 @@ ContextMenu::setQuery( const Tomahawk::query_ptr& query )
}
void
ContextMenu::setAlbums( const QList<Tomahawk::album_ptr>& albums )
{
@@ -128,7 +119,7 @@ ContextMenu::setAlbums( const QList<Tomahawk::album_ptr>& albums )
m_albums << albums;
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 )
m_sigmap->setMapping( addAction( tr( "Add to &Queue" ) ), ActionQueue );
@@ -167,7 +158,7 @@ ContextMenu::setArtists( const QList<Tomahawk::artist_ptr>& artists )
m_artists << artists;
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 )
m_sigmap->setMapping( addAction( tr( "Add to &Queue" ) ), ActionQueue );
@@ -194,7 +185,6 @@ ContextMenu::setArtist( const Tomahawk::artist_ptr& artist )
setArtists( artists );
}
void
ContextMenu::onTriggered( int action )
{
@@ -208,10 +198,6 @@ ContextMenu::onTriggered( int action )
copyLink();
break;
case ActionLove:
m_queries.first()->setLoved( !m_queries.first()->loved() );
break;
default:
emit triggered( action );
}
@@ -219,8 +205,7 @@ ContextMenu::onTriggered( int action )
void
ContextMenu::addToQueue()
void ContextMenu::addToQueue()
{
foreach ( const query_ptr& query, m_queries )
{
@@ -247,19 +232,3 @@ ContextMenu::copyLink()
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
#define CONTEXTMENU_H
#include <QtCore/QSignalMapper>
#include <QtGui/QMenu>
#include <QSignalMapper>
#include <QMenu>
#include "typedefs.h"
#include "dllmacro.h"
@@ -38,8 +38,8 @@ public:
ActionPlay = 1,
ActionQueue = 2,
ActionDelete = 4,
ActionCopyLink = 8,
ActionLove = 16
ActionCopyLink = 8
};
explicit ContextMenu( QWidget* parent = 0 );
@@ -69,14 +69,10 @@ private slots:
void copyLink();
void addToQueue();
void onSocialActionsLoaded();
private:
QSignalMapper* m_sigmap;
int m_supportedActions;
QAction* m_loveAction;
QList<Tomahawk::query_ptr> m_queries;
QList<Tomahawk::artist_ptr> m_artists;
QList<Tomahawk::album_ptr> m_albums;

View File

@@ -142,7 +142,7 @@ DatabaseCollection::autoPlaylistCreated( const source_ptr& source, const QVarian
static_cast<GeneratorMode>(data[6].toInt()), // dynamic mode
data[7].toBool(), //shared
data[8].toInt(), //lastmod
data[9].toString() ), &QObject::deleteLater ); //GUID
data[9].toString() ) ); //GUID
addAutoPlaylist( p );
}
@@ -160,7 +160,7 @@ DatabaseCollection::stationCreated( const source_ptr& source, const QVariantList
static_cast<GeneratorMode>(data[6].toInt()), // dynamic mode
data[7].toBool(), //shared
data[8].toInt(), //lastmod
data[9].toString() ), &QObject::deleteLater ); //GUID
data[9].toString() ) ); //GUID
addStation( p );
}

View File

@@ -55,12 +55,19 @@ DatabaseCommand_AddFiles::files() const
void
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
// collection browser will update/fade in etc.
Collection* coll = source()->collection().data();
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 );
@@ -78,23 +85,24 @@ DatabaseCommand_AddFiles::exec( DatabaseImpl* dbi )
TomahawkSqlQuery query_file = dbi->newquery();
TomahawkSqlQuery query_filejoin = 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_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_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;
QVariant srcid = source()->isLocal() ? QVariant( QVariant::Int ) : source()->id();
qDebug() << "Adding" << m_files.length() << "files to db for source" << srcid;
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;
QVariantMap m = v.toMap();
int fileid = 0, artistid = 0, albumid = 0, trackid = 0, composerid = 0;
QString url = m.value( "url" ).toString();
int mtime = m.value( "mtime" ).toInt();
uint size = m.value( "size" ).toUInt();
@@ -106,10 +114,12 @@ DatabaseCommand_AddFiles::exec( DatabaseImpl* dbi )
QString album = m.value( "album" ).toString();
QString track = m.value( "track" ).toString();
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 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( 1, url );
query_file.bindValue( 2, size );
@@ -118,17 +128,28 @@ DatabaseCommand_AddFiles::exec( DatabaseImpl* dbi )
query_file.bindValue( 5, mimetype );
query_file.bindValue( 6, duration );
query_file.bindValue( 7, bitrate );
query_file.exec();
if ( added % 1000 == 0 )
qDebug() << "Inserted" << added;
if( !query_file.exec() )
{
qDebug() << "Failed to insert to file:"
<< 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
fileid = query_file.lastInsertId().toInt();
m.insert( "id", fileid );
// this is the qvariant(map) the remote will get
v = m;
if( !source()->isLocal() )
url = QString( "servent://%1\t%2" ).arg( source()->userName() ).arg( url );
artistid = dbi->artistId( artist, true );
if ( artistid < 1 )
continue;
@@ -137,17 +158,12 @@ DatabaseCommand_AddFiles::exec( DatabaseImpl* dbi )
continue;
albumid = dbi->albumId( artistid, album, true );
if( !composer.trimmed().isEmpty() )
composerid = dbi->artistId( composer, true );
// Now add the association
query_filejoin.bindValue( 0, fileid );
query_filejoin.bindValue( 1, artistid );
query_filejoin.bindValue( 2, albumid > 0 ? albumid : QVariant( QVariant::Int ) );
query_filejoin.bindValue( 3, trackid );
query_filejoin.bindValue( 4, albumpos );
query_filejoin.bindValue( 5, composerid > 0 ? composerid : QVariant( QVariant::Int ) );
query_filejoin.bindValue( 6, discnumber );
if ( !query_filejoin.exec() )
{
qDebug() << "Error inserting into file_join table";
@@ -159,6 +175,33 @@ DatabaseCommand_AddFiles::exec( DatabaseImpl* dbi )
query_trackattr.bindValue( 2, year );
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;
added++;
}
@@ -167,6 +210,6 @@ DatabaseCommand_AddFiles::exec( DatabaseImpl* dbi )
if ( added )
source()->updateIndexWhenSynced();
tDebug() << "Committing" << added << "tracks...";
qDebug() << "Committing" << added << "tracks...";
emit done( m_files, source()->collection() );
}

View File

@@ -60,7 +60,7 @@ DatabaseCommand_addSource::exec( DatabaseImpl* dbi )
query.exec();
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 );
}

View File

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

View File

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

View File

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

View File

@@ -1,6 +1,6 @@
/* === 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
* it under the terms of the GNU General Public License as published by
@@ -28,13 +28,10 @@
#include "dynamic/GeneratorInterface.h"
#include "source.h"
#include "viewmanager.h"
#include "network/servent.h"
#include "utils/logger.h"
#ifndef ENABLE_HEADLESS
#include "viewmanager.h"
#endif
using namespace Tomahawk;
@@ -114,13 +111,11 @@ DatabaseCommand_CreateDynamicPlaylist::postCommitHook()
qDebug() << Q_FUNC_INFO << "..reporting..";
if( m_playlist.isNull() ) {
source_ptr src = source();
#ifndef ENABLE_HEADLESS
QMetaObject::invokeMethod( ViewManager::instance(),
"createDynamicPlaylist",
Qt::BlockingQueuedConnection,
QGenericArgument( "Tomahawk::source_ptr", (const void*)&src ),
Q_ARG( QVariant, m_v ) );
#endif
} else {
m_playlist->reportCreated( m_playlist );
}

View File

@@ -1,6 +1,6 @@
/* === 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
* it under the terms of the GNU General Public License as published by

View File

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

View File

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

View File

@@ -19,9 +19,9 @@
#ifndef DATABASECOMMAND_DELETEFILES_H
#define DATABASECOMMAND_DELETEFILES_H
#include <QtCore/QObject>
#include <QtCore/QDir>
#include <QtCore/QVariantMap>
#include <QObject>
#include <QDir>
#include <QVariantMap>
#include "database/databasecommandloggable.h"
#include "typedefs.h"
@@ -74,13 +74,13 @@ public:
void setDeleteAll( const bool deleteAll ) { m_deleteAll = deleteAll; }
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 );
private:
QStringList m_files;
QDir m_dir;
QVariantList m_ids;
QList<unsigned int> m_idList;
bool m_deleteAll;
};

View File

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

View File

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

View File

@@ -71,7 +71,7 @@ DatabaseCommand_LoadAllPlaylists::exec( DatabaseImpl* dbi )
query.value(5).toBool(), //shared
query.value(4).toInt(), //lastmod
query.value(0).toString() //GUID
), &QObject::deleteLater );
) );
plists.append( p );
}

View File

@@ -31,6 +31,7 @@ using namespace Tomahawk;
void
DatabaseCommand_LoadPlaylistEntries::exec( DatabaseImpl* dbi )
{
// qDebug() << "Loading playlist entries for revision" << m_revguid;
generateEntries( dbi );
emit done( m_revguid, m_guids, m_oldentries, m_islatest, m_entrymap, true );
@@ -41,38 +42,40 @@ void
DatabaseCommand_LoadPlaylistEntries::generateEntries( DatabaseImpl* dbi )
{
TomahawkSqlQuery query_entries = dbi->newquery();
query_entries.prepare( "SELECT entries, playlist, author, timestamp, previous_revision "
"FROM playlist_revision "
"WHERE guid = :guid" );
query_entries.prepare("SELECT entries, playlist, author, timestamp, previous_revision "
"FROM playlist_revision "
"WHERE guid = :guid");
query_entries.bindValue( ":guid", m_revguid );
query_entries.exec();
tLog( LOGVERBOSE ) << "trying to load playlist entries for guid:" << m_revguid;
// qDebug() << "trying to load entries:" << m_revguid;
QString prevrev;
QJson::Parser parser; bool ok;
if ( query_entries.next() )
if( query_entries.next() )
{
// 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
m_guids = v.toStringList();
QString inclause = QString( "('%1')" ).arg( m_guids.join( "', '" ) );
QString inclause = QString("('%1')").arg(m_guids.join("', '"));
TomahawkSqlQuery query = dbi->newquery();
QString sql = QString( "SELECT guid, trackname, artistname, albumname, annotation, "
"duration, addedon, addedby, result_hint "
"FROM playlist_item "
"WHERE guid IN %1" ).arg( inclause );
QString sql = QString("SELECT guid, trackname, artistname, albumname, annotation, "
"duration, addedon, addedby, result_hint "
"FROM playlist_item "
"WHERE guid IN %1").arg( inclause );
//qDebug() << sql;
query.exec( sql );
while ( query.next() )
while( query.next() )
{
plentry_ptr e( new PlaylistEntry );
e->setGuid( query.value( 0 ).toString() );
e->setAnnotation( query.value( 4 ).toString() );
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() );
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();
}
else
{
// qDebug() << "Playlist has no current revision data";
}
if ( prevrev.length() )
if( prevrev.length() )
{
TomahawkSqlQuery query_entries_old = dbi->newquery();
query_entries_old.prepare( "SELECT entries, "
@@ -101,7 +105,7 @@ DatabaseCommand_LoadPlaylistEntries::generateEntries( DatabaseImpl* dbi )
query_entries_old.addBindValue( prevrev );
query_entries_old.exec();
if ( !query_entries_old.next() )
if( !query_entries_old.next() )
{
return;
Q_ASSERT( false );

View File

@@ -39,11 +39,13 @@ DatabaseCommand_LoadSocialActions::exec( DatabaseImpl* dbi )
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 )
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 )
return;
@@ -70,6 +72,6 @@ DatabaseCommand_LoadSocialActions::exec( DatabaseImpl* dbi )
allSocialActions.append( action );
}
m_query->setAllSocialActions( allSocialActions );
m_result->setAllSocialActions( allSocialActions );
}

View File

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

View File

@@ -65,7 +65,7 @@ DatabaseCommand_PlaybackHistory::exec( DatabaseImpl* dbi )
if ( query_track.next() )
{
Tomahawk::query_ptr q = Tomahawk::Query::get( query_track.value( 1 ).toString(), query_track.value( 0 ).toString(), QString() );
Tomahawk::query_ptr q = Tomahawk::Query::get( query_track.value( 1 ).toString(), query_track.value( 0 ).toString(), QString(), uuid() );
if ( query.value( 3 ).toUInt() == 0 )
{
@@ -80,6 +80,8 @@ DatabaseCommand_PlaybackHistory::exec( DatabaseImpl* dbi )
}
}
qDebug() << Q_FUNC_INFO << ql.length();
if ( ql.count() )
emit tracks( ql );
}

View File

@@ -20,7 +20,6 @@
#include "artist.h"
#include "album.h"
#include "pipeline.h"
#include "sourcelist.h"
#include "utils/logger.h"
@@ -31,14 +30,10 @@ DatabaseCommand_Resolve::DatabaseCommand_Resolve( const query_ptr& query )
: DatabaseCommand()
, m_query( query )
{
Q_ASSERT( Pipeline::instance()->isRunning() );
}
DatabaseCommand_Resolve::~DatabaseCommand_Resolve()
{
}
{}
void
DatabaseCommand_Resolve::exec( DatabaseImpl* lib )
@@ -55,6 +50,9 @@ DatabaseCommand_Resolve::exec( DatabaseImpl* lib )
qDebug() << "Using result-hint to speed up resolving:" << m_query->resultHint();
Tomahawk::result_ptr result = lib->resultFromHint( m_query );
/* qDebug() << "Result null:" << result.isNull();
* qDebug() << "Collection null:" << result->collection().isNull();
* qDebug() << "Source null:" << result->collection()->source().isNull();*/
if ( !result.isNull() && !result->collection().isNull() && result->collection()->source()->isOnline() )
{
QList<Tomahawk::result_ptr> res;
@@ -78,9 +76,11 @@ DatabaseCommand_Resolve::resolve( DatabaseImpl* lib )
typedef QPair<int, float> scorepair_t;
// STEP 1
QList< QPair<int, float> > tracks = lib->search( m_query );
QList< QPair<int, float> > artists = lib->searchTable( "artist", m_query->artist(), 10 );
QList< QPair<int, float> > tracks = lib->searchTable( "track", m_query->track(), 10 );
QList< QPair<int, float> > albums = lib->searchTable( "album", m_query->album(), 10 );
if ( tracks.length() == 0 )
if ( artists.length() == 0 || tracks.length() == 0 )
{
qDebug() << "No candidates found in first pass, aborting resolve" << m_query->artist() << m_query->track();
emit results( m_query->id(), res );
@@ -90,33 +90,32 @@ DatabaseCommand_Resolve::resolve( DatabaseImpl* lib )
// STEP 2
TomahawkSqlQuery files_query = lib->newquery();
QStringList trksl;
QStringList artsl, trksl;
for ( int k = 0; k < artists.count(); k++ )
artsl.append( QString::number( artists.at( k ).first ) );
for ( int k = 0; k < tracks.count(); k++ )
trksl.append( QString::number( tracks.at( k ).first ) );
QString artsToken = QString( "file_join.artist IN (%1)" ).arg( artsl.join( "," ) );
QString trksToken = QString( "file_join.track IN (%1)" ).arg( trksl.join( "," ) );
QString sql = QString( "SELECT "
"url, mtime, size, md5, mimetype, duration, bitrate, " //0
"file_join.artist, file_join.album, file_join.track, " //7
"file_join.composer, file_join.discnumber, " //10
"artist.name as artname, " //12
"album.name as albname, " //13
"track.name as trkname, " //14
"composer.name as cmpname, " //15
"file.source, " //16
"file_join.albumpos, " //17
"artist.id as artid, " //18
"album.id as albid, " //19
"composer.id as cmpid " //20
"url, mtime, size, md5, mimetype, duration, bitrate, file_join.artist, file_join.album, file_join.track, "
"artist.name as artname, "
"album.name as albname, "
"track.name as trkname, "
"file.source, "
"file_join.albumpos, "
"artist.id as artid, "
"album.id as albid "
"FROM file, file_join, artist, track "
"LEFT JOIN album ON album.id = file_join.album "
"LEFT JOIN artist AS composer ON composer.id = file_join.composer "
"WHERE "
"artist.id = file_join.artist AND "
"track.id = file_join.track AND "
"file.id = file_join.file AND "
"(%1)" )
"(%1 AND %2)" )
.arg( artsToken )
.arg( trksToken );
files_query.prepare( sql );
@@ -127,34 +126,25 @@ DatabaseCommand_Resolve::resolve( DatabaseImpl* lib )
source_ptr s;
QString url = files_query.value( 0 ).toString();
if ( files_query.value( 16 ).toUInt() == 0 )
if ( files_query.value( 13 ).toUInt() == 0 )
{
s = SourceList::instance()->getLocal();
}
else
{
s = SourceList::instance()->get( files_query.value( 16 ).toUInt() );
if ( s.isNull() )
s = SourceList::instance()->get( files_query.value( 13 ).toUInt() );
if( s.isNull() )
{
qDebug() << "Could not find source" << files_query.value( 16 ).toUInt();
qDebug() << "Could not find source" << files_query.value( 13 ).toUInt();
continue;
}
url = QString( "servent://%1\t%2" ).arg( s->userName() ).arg( url );
}
bool cached = Tomahawk::Result::isCached( url );
Tomahawk::result_ptr result = Tomahawk::Result::get( url );
if ( cached )
{
qDebug() << "Result already cached:" << result->toString();
res << result;
continue;
}
Tomahawk::artist_ptr artist = Tomahawk::Artist::get( files_query.value( 18 ).toUInt(), files_query.value( 12 ).toString() );
Tomahawk::album_ptr album = Tomahawk::Album::get( files_query.value( 19 ).toUInt(), files_query.value( 13 ).toString(), artist );
Tomahawk::artist_ptr composer = Tomahawk::Artist::get( files_query.value( 20 ).toUInt(), files_query.value( 15 ).toString() );
Tomahawk::artist_ptr artist = Tomahawk::Artist::get( files_query.value( 15 ).toUInt(), files_query.value( 10 ).toString() );
Tomahawk::album_ptr album = Tomahawk::Album::get( files_query.value( 16 ).toUInt(), files_query.value( 11 ).toString(), artist );
result->setModificationTime( files_query.value( 1 ).toUInt() );
result->setSize( files_query.value( 2 ).toUInt() );
@@ -162,12 +152,10 @@ DatabaseCommand_Resolve::resolve( DatabaseImpl* lib )
result->setDuration( files_query.value( 5 ).toUInt() );
result->setBitrate( files_query.value( 6 ).toUInt() );
result->setArtist( artist );
result->setComposer( composer );
result->setAlbum( album );
result->setDiscNumber( files_query.value( 11 ).toUInt() );
result->setTrack( files_query.value( 14 ).toString() );
result->setTrack( files_query.value( 12 ).toString() );
result->setRID( uuid() );
result->setAlbumPos( files_query.value( 17 ).toUInt() );
result->setAlbumPos( files_query.value( 14 ).toUInt() );
result->setTrackId( files_query.value( 9 ).toUInt() );
TomahawkSqlQuery attrQuery = lib->newquery();
@@ -183,7 +171,6 @@ DatabaseCommand_Resolve::resolve( DatabaseImpl* lib )
result->setAttributes( attr );
result->setCollection( s->collection() );
res << result;
}
@@ -198,31 +185,13 @@ DatabaseCommand_Resolve::fullTextResolve( DatabaseImpl* lib )
typedef QPair<int, float> scorepair_t;
// STEP 1
QList< QPair<int, float> > trackPairs = lib->search( m_query );
QList< QPair<int, float> > albumPairs = lib->searchAlbum( m_query, 20 );
QList< QPair<int, float> > artists = lib->searchTable( "artist", m_query->fullTextQuery(), 10 );
QList< QPair<int, float> > tracks = lib->searchTable( "track", m_query->fullTextQuery(), 10 );
QList< QPair<int, float> > albums = lib->searchTable( "album", m_query->fullTextQuery(), 10 );
foreach ( const scorepair_t& albumPair, albumPairs )
if ( artists.length() == 0 && tracks.length() == 0 && albums.length() == 0 )
{
TomahawkSqlQuery query = lib->newquery();
QString sql = QString( "SELECT album.name, artist.id, artist.name FROM album, artist WHERE artist.id = album.artist AND album.id = %1" ).arg( albumPair.first );
query.prepare( sql );
query.exec();
QList<Tomahawk::album_ptr> albumList;
while ( query.next() )
{
Tomahawk::artist_ptr artist = Tomahawk::Artist::get( query.value( 1 ).toUInt(), query.value( 2 ).toString() );
Tomahawk::album_ptr album = Tomahawk::Album::get( albumPair.first, query.value( 0 ).toString(), artist );
albumList << album;
}
emit albums( m_query->id(), albumList );
}
if ( trackPairs.length() == 0 )
{
qDebug() << "No candidates found in first pass, aborting resolve" << m_query->fullTextQuery();
qDebug() << "No candidates found in first pass, aborting resolve" << m_query->artist() << m_query->track();
emit results( m_query->id(), res );
return;
}
@@ -230,70 +199,63 @@ DatabaseCommand_Resolve::fullTextResolve( DatabaseImpl* lib )
// STEP 2
TomahawkSqlQuery files_query = lib->newquery();
QStringList trksl;
for ( int k = 0; k < trackPairs.count(); k++ )
trksl.append( QString::number( trackPairs.at( k ).first ) );
QStringList artsl, trksl, albsl;
for ( int k = 0; k < artists.count(); k++ )
artsl.append( QString::number( artists.at( k ).first ) );
for ( int k = 0; k < tracks.count(); k++ )
trksl.append( QString::number( tracks.at( k ).first ) );
for ( int k = 0; k < albums.count(); k++ )
albsl.append( QString::number( albums.at( k ).first ) );
QString artsToken = QString( "file_join.artist IN (%1)" ).arg( artsl.join( "," ) );
QString trksToken = QString( "file_join.track IN (%1)" ).arg( trksl.join( "," ) );
QString albsToken = QString( "file_join.album IN (%1)" ).arg( albsl.join( "," ) );
QString sql = QString( "SELECT "
"url, mtime, size, md5, mimetype, duration, bitrate, " //0
"file_join.artist, file_join.album, file_join.track, " //7
"file_join.composer, file_join.discnumber, " //10
"artist.name as artname, " //12
"album.name as albname, " //13
"track.name as trkname, " //14
"composer.name as cmpname, " //15
"file.source, " //16
"file_join.albumpos, " //17
"artist.id as artid, " //18
"album.id as albid, " //19
"composer.id as cmpid " //20
"url, mtime, size, md5, mimetype, duration, bitrate, file_join.artist, file_join.album, file_join.track, "
"artist.name as artname, "
"album.name as albname, "
"track.name as trkname, "
"file.source, "
"file_join.albumpos, "
"artist.id as artid, "
"album.id as albid "
"FROM file, file_join, artist, track "
"LEFT JOIN album ON album.id = file_join.album "
"LEFT JOIN artist AS composer ON composer.id = file_join.composer "
"WHERE "
"artist.id = file_join.artist AND "
"track.id = file_join.track AND "
"file.id = file_join.file AND "
"%1" )
.arg( trksl.length() > 0 ? trksToken : QString( "0" ) );
.arg( tracks.length() > 0 ? trksToken : QString( "0" ) );
files_query.prepare( sql );
files_query.exec();
while ( files_query.next() )
while( files_query.next() )
{
source_ptr s;
QString url = files_query.value( 0 ).toString();
if ( files_query.value( 16 ).toUInt() == 0 )
if ( files_query.value( 13 ).toUInt() == 0 )
{
s = SourceList::instance()->getLocal();
}
else
{
s = SourceList::instance()->get( files_query.value( 16 ).toUInt() );
if ( s.isNull() )
s = SourceList::instance()->get( files_query.value( 13 ).toUInt() );
if( s.isNull() )
{
qDebug() << "Could not find source" << files_query.value( 16 ).toUInt();
qDebug() << "Could not find source" << files_query.value( 13 ).toUInt();
continue;
}
url = QString( "servent://%1\t%2" ).arg( s->userName() ).arg( url );
}
bool cached = Tomahawk::Result::isCached( url );
Tomahawk::result_ptr result = Tomahawk::Result::get( url );
if ( cached )
{
qDebug() << "Result already cached:" << result->toString();
res << result;
continue;
}
Tomahawk::artist_ptr artist = Tomahawk::Artist::get( files_query.value( 18 ).toUInt(), files_query.value( 12 ).toString() );
Tomahawk::album_ptr album = Tomahawk::Album::get( files_query.value( 19 ).toUInt(), files_query.value( 13 ).toString(), artist );
Tomahawk::artist_ptr composer = Tomahawk::Artist::get( files_query.value( 20 ).toUInt(), files_query.value( 15 ).toString() );
Tomahawk::artist_ptr artist = Tomahawk::Artist::get( files_query.value( 15 ).toUInt(), files_query.value( 10 ).toString() );
Tomahawk::album_ptr album = Tomahawk::Album::get( files_query.value( 16 ).toUInt(), files_query.value( 11 ).toString(), artist );
result->setModificationTime( files_query.value( 1 ).toUInt() );
result->setSize( files_query.value( 2 ).toUInt() );
@@ -301,19 +263,18 @@ DatabaseCommand_Resolve::fullTextResolve( DatabaseImpl* lib )
result->setDuration( files_query.value( 5 ).toUInt() );
result->setBitrate( files_query.value( 6 ).toUInt() );
result->setArtist( artist );
result->setComposer( composer );
result->setAlbum( album );
result->setDiscNumber( files_query.value( 11 ).toUInt() );
result->setTrack( files_query.value( 14 ).toString() );
result->setTrack( files_query.value( 12 ).toString() );
result->setRID( uuid() );
result->setAlbumPos( files_query.value( 17 ).toUInt() );
result->setAlbumPos( files_query.value( 14 ).toUInt() );
result->setTrackId( files_query.value( 9 ).toUInt() );
result->setYear( files_query.value( 17 ).toUInt() );
for ( int k = 0; k < trackPairs.count(); k++ )
for ( int k = 0; k < tracks.count(); k++ )
{
if ( trackPairs.at( k ).first == (int)result->trackId() )
if ( tracks.at( k ).first == (int)result->trackId() )
{
result->setScore( trackPairs.at( k ).second );
result->setScore( tracks.at( k ).second );
break;
}
}
@@ -330,8 +291,8 @@ DatabaseCommand_Resolve::fullTextResolve( DatabaseImpl* lib )
}
result->setAttributes( attr );
result->setCollection( s->collection() );
result->setCollection( s->collection() );
res << result;
}

View File

@@ -22,8 +22,6 @@
#include "databasecommand.h"
#include "databaseimpl.h"
#include "result.h"
#include "artist.h"
#include "album.h"
#include <QVariant>
@@ -43,8 +41,8 @@ public:
signals:
void results( Tomahawk::QID qid, QList<Tomahawk::result_ptr> results );
void albums( Tomahawk::QID qid, QList<Tomahawk::album_ptr> albums );
void artists( Tomahawk::QID qid, QList<Tomahawk::artist_ptr> artists );
public slots:
private:
DatabaseCommand_Resolve();

View File

@@ -61,20 +61,20 @@ public:
/**
* \brief Overloaded constructor for DatabaseCommand_SocialAction.
* \param query A Tomahawk Query object.
* \param result Pointer to a Tomahawk::Result.
* \param action Name of the social action to be written to the database.
* \param comment Comment associated with this social action.
* \param parent Parent class.
*
* Constructor which creates a new database command for the specified social action.
*/
explicit DatabaseCommand_SocialAction( const Tomahawk::query_ptr& query, QString action, QString comment = "", QObject* parent = 0 )
: DatabaseCommandLoggable( parent ), m_query( query ), m_action( action )
explicit DatabaseCommand_SocialAction( const Tomahawk::result_ptr& result, QString action, QString comment="", QObject* parent = 0 )
: DatabaseCommandLoggable( parent ), m_result( result ), m_action( action )
{
setSource( SourceList::instance()->getLocal() );
setArtist( query->artist() );
setTrack( query->track() );
setArtist( result->artist()->name() );
setTrack( result->track() );
setComment( comment );
setTimestamp( QDateTime::currentDateTime().toTime_t() );
}
@@ -173,7 +173,7 @@ public:
virtual bool groupable() const { return true; }
private:
Tomahawk::query_ptr m_query;
Tomahawk::result_ptr m_result;
QString m_artist;
QString m_track;

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