Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge remote branch 'origin/master' into jreen-tpqt4-comp

Conflicts:
	CMakeLists.txt
	src/sip/jreen/jabber_p.cpp
	src/tomahawkapp.cpp
  • Loading branch information...
commit 5610abfcde7ef34cef83dfb7ec7ee87b9752f5a9 2 parents 3254e60 + 7f570c3
@dschmidt dschmidt authored
Showing with 4,924 additions and 1,890 deletions.
  1. +20 −11 CMakeLists.txt
  2. +16 −4 ChangeLog
  3. +13 −91 README
  4. +2 −2 admin/mac/Info.plist
  5. +1 −1  admin/unix/tomahawk.protocol
  6. +1 −1  admin/win/nsi/revision.txt
  7. +1 −1  admin/win/nsi/tomahawk.nsi
  8. BIN  data/images/configure.png
  9. +11 −0 data/sql/dbmigrate-22_to_23.sql
  10. +14 −11 include/tomahawk/tomahawkapp.h
  11. +2 −0  resources.qrc
  12. +8 −5 src/CMakeLists.osx.txt
  13. +16 −15 src/CMakeLists.txt
  14. +26 −58 src/audiocontrols.cpp
  15. +4 −5 src/audiocontrols.h
  16. +0 −144 src/infosystem/infosystemcache.cpp
  17. +42 −8 src/libtomahawk/CMakeLists.txt
  18. +2 −2 src/libtomahawk/album.cpp
  19. +1 −1  src/libtomahawk/album.h
  20. +2 −2 src/libtomahawk/artist.cpp
  21. +1 −1  src/libtomahawk/artist.h
  22. +24 −12 src/libtomahawk/audio/audioengine.cpp
  23. +64 −0 src/libtomahawk/audio/dummytranscode.cpp
  24. +63 −0 src/libtomahawk/audio/dummytranscode.h
  25. +2 −0  src/libtomahawk/audio/flactranscode.cpp
  26. +6 −0 src/libtomahawk/audio/vorbistranscode.cpp
  27. +1 −1  src/libtomahawk/database/database.h
  28. +12 −11 src/libtomahawk/database/databasecollection.cpp
  29. +8 −2 src/libtomahawk/database/databasecommand.h
  30. +88 −19 src/libtomahawk/database/databasecommand_allalbums.cpp
  31. +10 −4 src/libtomahawk/database/databasecommand_allalbums.h
  32. +68 −0 src/libtomahawk/database/databasecommand_allartists.cpp
  33. +69 −0 src/libtomahawk/database/databasecommand_allartists.h
  34. +16 −6 src/libtomahawk/database/databasecommand_alltracks.cpp
  35. +2 −2 src/libtomahawk/database/databasecommand_alltracks.h
  36. +6 −22 src/libtomahawk/database/databasecommand_createdynamicplaylist.cpp
  37. +20 −8 src/libtomahawk/database/databasecommand_createplaylist.cpp
  38. +8 −8 src/libtomahawk/database/databasecommand_deletefiles.cpp
  39. +2 −2 src/libtomahawk/database/databasecommand_dirmtimes.cpp
  40. +11 −10 src/libtomahawk/database/databasecommand_loadalldynamicplaylists.cpp
  41. +3 −2 src/libtomahawk/database/databasecommand_loadallplaylists.cpp
  42. +3 −1 src/libtomahawk/database/databasecommand_loadops.h
  43. +1 −1  src/libtomahawk/database/databasecommand_loadplaylistentries.h
  44. +1 −0  src/libtomahawk/database/databasecommand_modifyplaylist.cpp
  45. +76 −19 src/libtomahawk/database/databaseimpl.cpp
  46. +5 −3 src/libtomahawk/database/databaseimpl.h
  47. +3 −0  src/libtomahawk/database/databaseworker.cpp
  48. +1 −1  src/libtomahawk/database/fuzzyindex.cpp
  49. +9 −8 src/libtomahawk/database/schema.sql
  50. +4 −5 src/libtomahawk/database/schema.sql.h
  51. +7 −3 src/libtomahawk/functimeout.h
  52. +12 −12 src/{ → libtomahawk}/infosystem/infoplugins/echonestplugin.cpp
  53. +7 −7 src/{ → libtomahawk}/infosystem/infoplugins/echonestplugin.h
  54. +171 −47 src/{ → libtomahawk}/infosystem/infoplugins/lastfmplugin.cpp
  55. +17 −9 src/{ → libtomahawk}/infosystem/infoplugins/lastfmplugin.h
  56. +4 −4 src/{ → libtomahawk}/infosystem/infoplugins/musixmatchplugin.cpp
  57. +7 −6 src/{ → libtomahawk}/infosystem/infoplugins/musixmatchplugin.h
  58. +27 −17 src/{ → libtomahawk}/infosystem/infosystem.cpp
  59. +40 −30 {include/tomahawk → src/libtomahawk/infosystem}/infosystem.h
  60. +216 −0 src/libtomahawk/infosystem/infosystemcache.cpp
  61. +15 −12 src/{ → libtomahawk}/infosystem/infosystemcache.h
  62. +118 −113 src/libtomahawk/kdsingleapplicationguard/kdsingleapplicationguard.cpp
  63. +3 −0  src/libtomahawk/network/bufferiodevice.cpp
  64. +1 −0  src/libtomahawk/network/controlconnection.cpp
  65. +2 −0  src/libtomahawk/network/remotecollection.cpp
  66. +29 −17 src/libtomahawk/network/servent.cpp
  67. +3 −3 src/libtomahawk/network/streamconnection.cpp
  68. +5 −5 src/libtomahawk/pipeline.cpp
  69. +36 −32 src/libtomahawk/playlist.cpp
  70. +10 −4 src/libtomahawk/playlist.h
  71. +7 −6 src/libtomahawk/playlist/albummodel.cpp
  72. +5 −5 src/libtomahawk/playlist/albummodel.h
  73. +11 −4 src/libtomahawk/playlist/albumproxymodel.cpp
  74. +2 −1  src/libtomahawk/playlist/albumproxymodel.h
  75. +13 −2 src/libtomahawk/playlist/albumview.cpp
  76. +2 −1  src/libtomahawk/playlist/albumview.h
  77. +234 −0 src/libtomahawk/playlist/artistview.cpp
  78. +90 −0 src/libtomahawk/playlist/artistview.h
  79. +2 −2 src/libtomahawk/playlist/collectionflatmodel.cpp
  80. +1 −1  src/libtomahawk/playlist/collectionflatmodel.h
  81. +0 −286 src/libtomahawk/playlist/collectionmodel.cpp
  82. +0 −86 src/libtomahawk/playlist/collectionmodel.h
  83. +0 −6 src/libtomahawk/playlist/collectionproxymodel.cpp
  84. +11 −2 src/libtomahawk/playlist/collectionview.cpp
  85. +2 −1  src/libtomahawk/playlist/collectionview.h
  86. +2 −2 src/libtomahawk/playlist/dynamic/DynamicControl.h
  87. +5 −1 src/libtomahawk/playlist/dynamic/DynamicModel.cpp
  88. +1 −1  src/libtomahawk/playlist/dynamic/DynamicModel.h
  89. +93 −92 src/libtomahawk/playlist/dynamic/DynamicPlaylist.cpp
  90. +31 −30 src/libtomahawk/playlist/dynamic/DynamicPlaylist.h
  91. +27 −27 src/libtomahawk/playlist/dynamic/DynamicView.cpp
  92. +1 −1  src/libtomahawk/playlist/dynamic/DynamicView.h
  93. +2 −0  src/libtomahawk/playlist/dynamic/GeneratorFactory.h
  94. +1 −0  src/libtomahawk/playlist/dynamic/GeneratorInterface.cpp
  95. +2 −2 src/libtomahawk/playlist/dynamic/GeneratorInterface.h
  96. +1 −1  src/libtomahawk/playlist/dynamic/widgets/DynamicSetupWidget.cpp
  97. +3 −1 src/libtomahawk/playlist/dynamic/widgets/DynamicWidget.cpp
  98. +1 −0  src/libtomahawk/playlist/dynamic/widgets/LoadingSpinner.cpp
  99. +8 −13 src/libtomahawk/playlist/playlistitemdelegate.cpp
  100. +46 −19 src/libtomahawk/playlist/playlistmanager.cpp
  101. +6 −2 src/libtomahawk/playlist/playlistmanager.h
  102. +2 −1  src/libtomahawk/playlist/playlistmodel.cpp
  103. +15 −6 src/libtomahawk/playlist/playlistview.cpp
  104. +2 −1  src/libtomahawk/playlist/playlistview.h
  105. +6 −8 src/libtomahawk/playlist/topbar/topbar.cpp
  106. +2 −15 src/libtomahawk/playlist/trackmodel.cpp
  107. +2 −2 src/libtomahawk/playlist/trackmodel.h
  108. +7 −18 src/libtomahawk/playlist/trackmodelitem.cpp
  109. +0 −3  src/libtomahawk/playlist/trackmodelitem.h
  110. +14 −7 src/libtomahawk/playlist/trackproxymodel.cpp
  111. +2 −1  src/libtomahawk/playlist/trackproxymodel.h
  112. +13 −2 src/libtomahawk/playlist/trackview.cpp
  113. +3 −2 src/libtomahawk/playlist/trackview.h
  114. +145 −0 src/libtomahawk/playlist/treeheader.cpp
  115. +61 −0 src/libtomahawk/playlist/treeheader.h
  116. +119 −0 src/libtomahawk/playlist/treeitemdelegate.cpp
  117. +46 −0 src/libtomahawk/playlist/treeitemdelegate.h
  118. +592 −0 src/libtomahawk/playlist/treemodel.cpp
  119. +134 −0 src/libtomahawk/playlist/treemodel.h
  120. +134 −0 src/libtomahawk/playlist/treemodelitem.cpp
  121. +69 −0 src/libtomahawk/playlist/treemodelitem.h
  122. +164 −0 src/libtomahawk/playlist/treeproxymodel.cpp
  123. +81 −0 src/libtomahawk/playlist/treeproxymodel.h
  124. +28 −21 src/libtomahawk/query.cpp
  125. +116 −0 src/libtomahawk/resolver.cpp
  126. +12 −5 src/libtomahawk/resolver.h
  127. +13 −1 src/libtomahawk/source.cpp
  128. +4 −4 src/libtomahawk/source.h
  129. +28 −12 src/libtomahawk/tomahawksettings.cpp
  130. +27 −24 src/libtomahawk/tomahawksettings.h
  131. +1 −0  src/libtomahawk/utils/querylabel.cpp
  132. +17 −3 src/libtomahawk/utils/tomahawkutils.cpp
  133. +5 −3 src/libtomahawk/utils/tomahawkutils.h
  134. +2 −2 src/libtomahawk/utils/xspfloader.cpp
  135. +1 −1  src/libtomahawk/utils/xspfloader.h
  136. +2 −0  src/libtomahawk/viewpage.h
  137. +3 −3 src/libtomahawk/widgets/newplaylistwidget.cpp
  138. +1 −0  src/libtomahawk/widgets/overlaywidget.cpp
  139. +3 −1 src/libtomahawk/widgets/welcomewidget.cpp
  140. +6 −1 src/main.cpp
  141. +21 −17 src/musicscanner.cpp
  142. +1 −1  src/musicscanner.h
  143. +176 −0 src/resolverconfigdelegate.cpp
  144. +42 −0 src/resolverconfigdelegate.h
  145. +68 −0 src/resolverconfigwrapper.h
  146. +2 −3 src/resolvers/qtscriptresolver.cpp
  147. +4 −3 src/resolvers/qtscriptresolver.h
  148. +53 −9 src/resolvers/scriptresolver.cpp
  149. +7 −1 src/resolvers/scriptresolver.h
  150. +154 −0 src/resolversmodel.cpp
  151. +55 −0 src/resolversmodel.h
  152. +28 −42 src/scanmanager.cpp
  153. +1 −2  src/scanmanager.h
  154. +38 −22 src/scrobbler.cpp
  155. +6 −6 src/scrobbler.h
  156. +46 −34 src/settingsdialog.cpp
  157. +6 −3 src/settingsdialog.h
  158. +7 −29 src/settingsdialog.ui
  159. +12 −2 src/sip/jabber/jabber_p.cpp
  160. +1 −1  src/sip/jreen/jabber_p.cpp
  161. +1 −1  src/sip/twitter/CMakeLists.txt
  162. +2 −0  src/sip/twitter/twitter.cpp
  163. +5 −0 src/sip/twitter/twitter.h
  164. +1 −0  src/sip/twitter/twitterconfigwidget.cpp
  165. +5 −8 src/sip/zeroconf/zeroconf.cpp
  166. +6 −1 src/sip/zeroconf/zeroconf.h
  167. +38 −10 src/sourcetree/sourcesmodel.cpp
  168. +9 −5 src/sourcetree/sourcesmodel.h
  169. +3 −2 src/sourcetree/sourcesproxymodel.cpp
  170. +1 −1  src/sourcetree/sourcesproxymodel.h
  171. +4 −2 src/sourcetree/sourcetreeview.cpp
  172. +5 −6 src/sourcetree/sourcetreeview.h
  173. +53 −45 src/tomahawkapp.cpp
  174. +10 −12 src/tomahawkwindow.cpp
  175. +8 −4 src/web/api_v1.cpp
  176. +2 −3 src/web/api_v1.h
  177. +29 −30 src/xmppbot/xmppbot.cpp
  178. +9 −9 src/xmppbot/xmppbot.h
  179. +2 −0  thirdparty/alsa-playback/CMakeLists.txt
  180. +2 −0  thirdparty/jdns/CMakeLists.txt
  181. +2 −1  thirdparty/liblastfm2/src/scrobble/Audioscrobbler.cpp
  182. +2 −2 thirdparty/liblastfm2/src/types/Track.cpp
  183. +2 −0  thirdparty/libportfwd/CMakeLists.txt
  184. +4 −0 thirdparty/qxt/qxtweb-standalone/CMakeLists.txt
View
31 CMakeLists.txt
@@ -1,6 +1,10 @@
PROJECT( tomahawk )
CMAKE_MINIMUM_REQUIRED( VERSION 2.8 )
+IF( ${CMAKE_VERSION} VERSION_GREATER 2.8.3 )
+ CMAKE_POLICY(SET CMP0017 NEW)
+ENDIF( ${CMAKE_VERSION} VERSION_GREATER 2.8.3 )
+
###
### Tomahawk application info
###
@@ -49,35 +53,39 @@ macro_log_feature(TAGLIB_FOUND "TagLib" "Audio Meta-Data Library" "http://develo
# we need pthreads too
find_package(Threads)
+find_package(KDE4)
+IF(KDE4_FOUND)
+ #KDE4 adds and removes some compiler flags that we don't like
+ STRING( REPLACE "-std=iso9899:1990" "" CLEAN_C_FLAGS ${CMAKE_C_FLAGS} )
+ SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions" )
+ELSE()
+ SET( CLEAN_C_FLAGS ${CMAKE_C_FLAGS} )
+ENDIF()
+
include( CheckTagLibFileName )
check_taglib_filename( COMPLEX_TAGLIB_FILENAME )
# optional
macro_optional_find_package(Jreen)
IF( NOT LIBJREEN_FOUND )
+ SET( CMAKE_C_FLAGS ${CLEAN_C_FLAGS} )
ADD_SUBDIRECTORY( thirdparty/jreen )
SET( LIBJREEN_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/thirdparty/jreen/include )
IF( UNIX AND NOT APPLE )
SET( LIBJREEN_LIBRARY ${CMAKE_CURRENT_BINARY_DIR}/thirdparty/jreen/libjreen.so )
ENDIF( UNIX AND NOT APPLE )
IF( WIN32 )
- SET( LIBJREEN_LIBRARY ${CMAKE_CURRENT_BINARY_DIR}/thirdparty/jreen/libjreen.dll )
+ SET( LIBJREEN_LIBRARY ${CMAKE_CURRENT_BINARY_DIR}/thirdparty/jreen/libjreen.dll )
ENDIF( WIN32 )
SET( LIBJREEN_FOUND true )
MESSAGE(STATUS "Internal libjreen: ${LIBJREEN_INCLUDE_DIR}, ${LIBJREEN_LIBRARY}")
ENDIF( NOT LIBJREEN_FOUND )
+
IF( WIN32 )
find_library(QTSPARKLE_LIBRARIES qtsparkle)
ENDIF( WIN32 )
-macro_log_feature(JREEN_FOUND "Jreen" "Qt XMPP library" "http://gitorious.org/jreen" FALSE "" "Jreen is needed for the alternative/new Jabber SIP plugin. Built automatically inside Tomahawk, if not installed systemwide and ENABLE_JREEN is true")
-
-macro_optional_find_package(Gloox 1.0)
-IF( ENABLE_JREEN )
- set( GLOOX_FOUND false )
-ENDIF( ENABLE_JREEN)
-macro_log_feature(GLOOX_FOUND "Gloox" "A portable high-level Jabber/XMPP library for C++" "http://camaya.net/gloox" FALSE "" "Gloox is needed for the Jabber SIP plugin and the XMPP-Bot")
#show dep log
macro_display_feature_log()
MESSAGE("WARNING!")
@@ -94,9 +102,10 @@ CONFIGURE_FILE(
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
-ADD_CUSTOM_TARGET(uninstall
- "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
-
+# KDE4 defines an uninstall target for us automatically
+IF( NOT KDE4_FOUND )
+ ADD_CUSTOM_TARGET(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
+ENDIF()
IF( NOT APPLE )
# Make linking as strict on linux as it is on osx. Then we don't break linking on mac so often
View
20 ChangeLog
@@ -1,12 +1,24 @@
Version 0.1.0:
+ * Resolvers can now be enabled and disabled, and some can be configured
+ directly in Tomahawk.
+ * Browse and play collections in our snappy tree-view, which also shows
+ images for artists and albums.
* Watch folders for changes and automatically update your collection. This
is on by default; you can turn it off on the Local Music tab in the
- settings dialog. Note that this triggers only on files or folders being
+ settings dialog. Note that this triggers only on files or folders being
added to or removed from folders; it is not watch individual files as
most OSes can't support enough file watches to handle a normal-sized
music collection.
+Version 0.0.4:
+ * Fixed crash that could occur when playing a track from a browser.
+ * Fixed a crash situation caused by sources going on- or offline.
+
Version 0.0.3:
+ * Show spinner while resolving playlists.
+ * Go back to previous page visible when deleting a playlist.
+ * Fixed issue where automatic playlists and station summaries were not
+ updated in the playlist header.
* Fixed an issue which caused duplicate items when rescanning.
* Revert change introduced in 0.0.2 causing Twitter protocol to not try
to reconnect to a peer if it couldn't connect the first time the plugin
@@ -17,9 +29,10 @@ Version 0.0.3:
* Don't automatically try to resolve all incoming playback logs. This
speeds up importing sources a lot.
* Faster painting of playlists with lots of unresolved tracks.
- * The tomahawk:// protocol handler works on Windows now.
- * Fixed launching Tomahawk from Windows installer with admin privileges.
* Prefer local results when results' score is equal.
+ * (Windows) The tomahawk:// protocol handler works on Windows now.
+ * (Windows) Fixed launching Tomahawk from Windows installer with admin privileges.
+ * (Windows) Prevent launching a second instance on Windows.
Version 0.0.2:
* Don't reconnect to Jabber if the settings dialog is closed successfully
@@ -35,7 +48,6 @@ Version 0.0.2:
the Tomahawk XMPP presence.
* Incompatible change: Twitter SIP protocol has changed slightly. 0.0.1
clients will not be able to talk to newer clients.
- * Hopefully fixed crashes during Twitter authentication.
* Don't let long playlist or summary names force a large Tomahawk window.
* Tomahawk now asks you to authorize new contacts.
View
104 README
@@ -1,82 +1,23 @@
-Quickstart on Ubuntu
---------------------
-
- $ sudo apt-get install build-essential cmake libtag1c2a libtag1-dev libqt4-dev libqt4-sql-sqlite \
- libvorbis-dev libmad0-dev libflac++-dev libasound2-dev libboost-dev zlib1g-dev \
- libgnutls-dev pkg-config
-
-
-Gloox 1.0 (XMPP library)
-------------------------
- On Ubuntu 10.10 (and higher):
- $ sudo apt-get install libgloox-dev
-
- Otherwise see: http://camaya.net/glooxdownload
- You need to build gloox 1.0 from source, Ubuntu 10.04 only packages version 0.9.
-
- Download and unpack tarball:
- $ ./configure --without-openssl --with-gnutls --without-libidn --with-zlib --without-examples --without-tests
- $ CXXFLAGS=-fPIC make
- $ sudo make install
-
-QJson (Qt JSON library)
------------------------
- On Ubuntu 10.04 (and higher):
- $ sudo apt-get install libqjson-dev
-
- Otherwise see: http://sourceforge.net/projects/qjson/files/ (developed using version 0.7.1)
-
- Download and unpack tarball:
- $ ./configure && make
- $ sudo make install
-
-libEchonest 1.1.4
----------------
- See: http://projects.kde.org/projects/playground/libs/libechonest/
+Compiling Tomahawk
+------------------
- Download and unpack tarball:
$ mkdir build && cd build
$ cmake ..
$ make
- $ sudo make install
-CLucene 0.9.23
----------------
- See: http://clucene.sourceforge.net/download.shtml
-
- Clone from git and build CLucene:
- $ git clone git://clucene.git.sourceforge.net/gitroot/clucene/clucene
- $ cd clucene && mkdir build && cd build
- $ cmake ..
- $ make
- $ sudo make install
-
-
-Quickstart on OS X
-------------------
-
- Install homebrew
- $ ruby -e "$(curl -fsSL https://gist.github.com/raw/323731/install_homebrew.rb)"
- $ brew install cmake qt qjson gloox libmad libvorbis flac taglib boost
-
- Install libEchnoest & CLucene as per the above instructions.
+ Start the application on Linux:
+ $ ./tomahawk
+ Start the application on OS X:
+ $ open tomahawk.app
- If liblastfm gives problems, do the below:
- $ brew edit liblastfm
- Change the url to https://github.com/davidsansome/liblastfm/tarball/0.3.1
- $ brew install liblastfm
- Copy the md5 hash it returns.
- $ brew edit liblastfm
- Replace the md5 hash with the new one you copied.
- $ brew install liblastfm
+Detailed building instructions for Ubuntu
+-----------------------------------------
+ See: http://wiki.tomahawk-player.org/mediawiki/index.php/Building_Ubuntu_Binary_on_Maverick_(10.10)
-Now compile Tomahawk
---------------------
- $ mkdir build && cd build
- $ cmake ..
- $ make
- $ ./tomahawk
+Detailed building instructions for OS X
+---------------------------------------
+ See: http://wiki.tomahawk-player.org/mediawiki/index.php/Building_OS_X_Application_Bundle_on_Snow_Leopard_(10.6)
Dependencies
@@ -85,7 +26,7 @@ Dependencies
CMake 2.8.0 http://www.cmake.org/
Qt 4.7.0 http://qt.nokia.com/
QJson 0.7.1 http://qjson.sourceforge.net/
- Gloox 1.0 (0.9.x will fail) http://camaya.net/gloox/
+ Gloox 1.0 http://camaya.net/gloox/
SQLite 3.6.22 http://www.sqlite.org/
TagLib 1.6.2 http://developer.kde.org/~wheeler/taglib.html
Boost 1.3x http://www.boost.org/
@@ -102,23 +43,4 @@ Dependencies
MiniUPnP http://miniupnp.free.fr/
liblastfm 0.4.0 http://github.com/jonocole/liblastfm/
-
-To build the app:
------------------
- $ mkdir build && cd build
- $ cmake ..
- $ make
-
-To run the app:
----------------
- Only run the next two commands if you installed any of the dependencies from source on Linux.
- $ export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
- $ sudo ldconfig -v
-
- Start the application on Linux:
- $ ./tomahawk
-
- Start the application on OS X:
- $ open tomahawk.app
-
Enjoy!
View
4 admin/mac/Info.plist
@@ -13,9 +13,9 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleVersion</key>
- <string>0.0.2.0</string>
+ <string>TOMAHAWK_VERSION</string>
<key>CFBundleShortVersionString</key>
- <string>0.0.2</string>
+ <string>TOMAHAWK_VERSION</string>
<key>CFBundleSignature</key>
<string>tomahawk</string>
<key>CFBundleIconFile</key>
View
2  admin/unix/tomahawk.protocol
@@ -1,5 +1,5 @@
[Protocol]
-exec=/home/leo/kde/tomahawk/build/tomahawk "%u"
+exec=/path/to/binary "%u"
protocol=tomahawk
input=none
output=none
View
2  admin/win/nsi/revision.txt
@@ -1 +1 @@
-100
+103
View
2  admin/win/nsi/tomahawk.nsi
@@ -9,7 +9,7 @@
!define OPTION_SECTION_SC_DESKTOP
!define OPTION_SECTION_SC_QUICK_LAUNCH
!define OPTION_FINISHPAGE
-;!define OPTION_FINISHPAGE_LAUNCHER
+!define OPTION_FINISHPAGE_LAUNCHER
!define OPTION_FINISHPAGE_RELEASE_NOTES
;-----------------------------------------------------------------------------
View
BIN  data/images/configure.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
11 data/sql/dbmigrate-22_to_23.sql
@@ -0,0 +1,11 @@
+-- Script to migate from db version 22 to 23.
+-- Only change in this version is that playlists gained a createdOn date.
+-- Set all playlists to created to now.
+--
+-- Separate each command with %%
+
+ALTER TABLE playlist ADD COLUMN createdOn INTEGER NOT NULL DEFAULT 0;
+
+UPDATE playlist SET createdOn = strftime( '%s','now' );
+
+UPDATE settings SET v = '23' WHERE k == 'schema_version';
View
25 include/tomahawk/tomahawkapp.h
@@ -1,5 +1,5 @@
/* === 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
@@ -44,6 +44,7 @@
class AudioEngine;
class Database;
+class ScanManager;
class SipHandler;
class TomahawkSettings;
class XMPPBot;
@@ -78,10 +79,10 @@ Q_OBJECT
TomahawkApp( int& argc, char *argv[] );
virtual ~TomahawkApp();
+ void init();
static TomahawkApp* instance();
SipHandler* sipHandler() { return m_sipHandler; }
- Tomahawk::InfoSystem::InfoSystem* infoSystem() { return m_infoSystem; }
XMPPBot* xmppBot() { return m_xmppBot; }
#ifndef TOMAHAWK_HEADLESS
@@ -89,8 +90,9 @@ Q_OBJECT
TomahawkWindow* mainWindow() const { return m_mainwindow; }
#endif
- void addScriptResolver( const QString& scriptPath );
- void removeScriptResolver( const QString& scriptPath );
+ void enableScriptResolver( const QString& scriptPath );
+ void disableScriptResolver( const QString& scriptPath );
+ Tomahawk::ExternalResolver* resolverForPath( const QString& scriptPath );
// PlatformInterface
virtual void activate();
@@ -98,10 +100,10 @@ Q_OBJECT
// because QApplication::arguments() is expensive
bool scrubFriendlyName() const { return m_scrubFriendlyName; }
-
+
public slots:
void instanceStarted( KDSingleApplicationGuard::Instance );
-
+
private slots:
void setupSIP();
@@ -115,30 +117,31 @@ private slots:
void startHTTP();
QList<Tomahawk::collection_ptr> m_collections;
- QList<Tomahawk::ExternalResolver*> m_scriptResolvers;
+ QHash<QString, Tomahawk::ExternalResolver*> m_scriptResolvers;
Database* m_database;
+ ScanManager *m_scanManager;
AudioEngine* m_audioEngine;
SipHandler* m_sipHandler;
Servent* m_servent;
+ Tomahawk::InfoSystem::InfoSystem* m_infoSystem;
XMPPBot* m_xmppBot;
Tomahawk::ShortcutHandler* m_shortcutHandler;
bool m_scrubFriendlyName;
-
+
#ifdef LIBLASTFM_FOUND
Scrobbler* m_scrobbler;
#endif
#ifndef TOMAHAWK_HEADLESS
TomahawkWindow* m_mainwindow;
-#endif
+#endif
bool m_headless;
- Tomahawk::InfoSystem::InfoSystem* m_infoSystem;
-
QxtHttpServerConnector m_connector;
QxtHttpSessionManager m_session;
};
#endif // TOMAHAWKAPP_H
+
View
2  resources.qrc
@@ -74,6 +74,7 @@
<file>./data/images/back.png</file>
<file>./data/images/forward.png</file>
<file>./data/images/music-icon.png</file>
+<file>./data/images/configure.png</file>
<file>./data/topbar-radiobuttons.css</file>
<file>./data/icons/tomahawk-icon-16x16.png</file>
<file>./data/icons/tomahawk-icon-32x32.png</file>
@@ -87,5 +88,6 @@
<file>./data/www/auth.html</file>
<file>./data/www/auth.na.html</file>
<file>./data/www/tomahawk_banner_small.png</file>
+<file>./data/sql/dbmigrate-22_to_23.sql</file>
</qresource>
</RCC>
View
13 src/CMakeLists.osx.txt
@@ -35,15 +35,18 @@ if (APPLE)
# Use two different sparkle update tracks for debug and release
# We have to change the URL in the Info.plist file :-/
+ FILE(READ ${CMAKE_SOURCE_DIR}/admin/mac/Info.plist plist)
+ STRING( REPLACE "TOMAHAWK_VERSION"
+ ${VERSION}
+ edited_plist # save in this variable
+ "${plist}" # from the contents of this var
+ )
IF( NOT CMAKE_BUILD_TYPE STREQUAL "Release" )
- FILE(READ ${CMAKE_SOURCE_DIR}/admin/mac/Info.plist plist)
STRING( REPLACE "http://download.tomahawk-player.org/sparkle" # match this
"http://download.tomahawk-player.org/sparkle-debug" #replace with debug url
edited_plist # save in this variable
- "${plist}" # from the contents of this var
+ "${edited_plist}" # from the contents of this var
)
- FILE( WRITE ${CMAKE_BINARY_DIR}/Info.plist "${edited_plist}" )
- ELSE() # Just copy the release one
- FILE( COPY ${CMAKE_SOURCE_DIR}/admin/mac/Info.plist DESTINATION ${CMAKE_BINARY_DIR} )
ENDIF()
+ FILE( WRITE ${CMAKE_BINARY_DIR}/Info.plist "${edited_plist}" )
endif (APPLE)
View
31 src/CMakeLists.txt
@@ -34,12 +34,6 @@ ENDIF()
SET( tomahawkSources ${tomahawkSources}
sip/SipHandler.cpp
- infosystem/infosystemcache.cpp
- infosystem/infosystem.cpp
- infosystem/infoplugins/echonestplugin.cpp
- infosystem/infoplugins/lastfmplugin.cpp
- infosystem/infoplugins/musixmatchplugin.cpp
-
web/api_v1.cpp
resolvers/scriptresolver.cpp
@@ -69,20 +63,16 @@ SET( tomahawkSourcesGui ${tomahawkSourcesGui}
tomahawktrayicon.cpp
audiocontrols.cpp
settingsdialog.cpp
+ resolverconfigdelegate.cpp
+ resolversmodel.cpp
tomahawkwindow.cpp
)
SET( tomahawkHeaders ${tomahawkHeaders}
"${TOMAHAWK_INC_DIR}/tomahawk/tomahawkapp.h"
- "${TOMAHAWK_INC_DIR}/tomahawk/infosystem.h"
sip/SipHandler.h
- infosystem/infosystemcache.h
- infosystem/infoplugins/echonestplugin.h
- infosystem/infoplugins/lastfmplugin.h
- infosystem/infoplugins/musixmatchplugin.h
-
web/api_v1.h
resolvers/scriptresolver.h
@@ -111,6 +101,9 @@ SET( tomahawkHeadersGui ${tomahawkHeadersGui}
tomahawktrayicon.h
audiocontrols.h
settingsdialog.h
+ resolverconfigdelegate.h
+ resolversmodel.h
+ resolverconfigwrapper.h
tomahawkwindow.h
)
@@ -124,7 +117,7 @@ SET( tomahawkUI ${tomahawkUI}
)
INCLUDE_DIRECTORIES(
- .
+ .
${TOMAHAWK_INC_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_BINARY_DIR}/thirdparty/liblastfm2/src
@@ -137,8 +130,6 @@ INCLUDE_DIRECTORIES(
topbar
utils
libtomahawk
- libtomahawk/utils
- infosystem
mac
${THIRDPARTY_DIR}/alsa-playback
@@ -245,4 +236,14 @@ ENDIF( APPLE )
INSTALL( TARGETS tomahawk BUNDLE DESTINATION . RUNTIME DESTINATION bin )
+IF(KDE4_FOUND) #install protocol file
+ FILE(READ ${CMAKE_SOURCE_DIR}/admin/unix/tomahawk.protocol protocol)
+ STRING( REPLACE "/path/to/binary" # match this
+ "${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
+ )
+ FILE( WRITE ${CMAKE_BINARY_DIR}/tomahawk.protocol "${edited_protocol}" )
+ INSTALL( FILES ${CMAKE_BINARY_DIR}/tomahawk.protocol DESTINATION ${SERVICES_INSTALL_DIR} )
+ENDIF()
#INCLUDE( "CPack.txt" )
View
84 src/audiocontrols.cpp
@@ -21,7 +21,6 @@
#include <QNetworkReply>
-#include "tomahawk/tomahawkapp.h"
#include "audio/audioengine.h"
#include "playlist/playlistmanager.h"
#include "utils/imagebutton.h"
@@ -29,9 +28,8 @@
#include "album.h"
-#define LASTFM_DEFAULT_COVER "http://cdn.last.fm/flatness/catalogue/noimage"
+static QString s_acInfoIdentifier = QString( "AUDIOCONTROLS" );
-static QString s_infoIdentifier = QString("AUDIOCONTROLS");
AudioControls::AudioControls( QWidget* parent )
: QWidget( parent )
@@ -45,11 +43,11 @@ AudioControls::AudioControls( QWidget* parent )
QFont font( ui->artistTrackLabel->font() );
font.setPixelSize( 12 );
-
+
#ifdef Q_WS_MAC
font.setPointSize( font.pointSize() - 2 );
#endif
-
+
ui->artistTrackLabel->setFont( font );
ui->artistTrackLabel->setElideMode( Qt::ElideMiddle );
ui->artistTrackLabel->setType( QueryLabel::ArtistAndTrack );
@@ -144,10 +142,10 @@ 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() ), 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() ) );
@@ -167,11 +165,11 @@ AudioControls::AudioControls( QWidget* parent )
m_defaultCover = QPixmap( RESPATH "images/no-album-art-placeholder.png" )
.scaled( ui->coverImage->size(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation );
- connect( TomahawkApp::instance()->infoSystem(),
+ connect( Tomahawk::InfoSystem::InfoSystem::instance(),
SIGNAL( info( QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, Tomahawk::InfoSystem::InfoCustomData ) ),
SLOT( infoSystemInfo( QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, Tomahawk::InfoSystem::InfoCustomData ) ) );
-
- connect( TomahawkApp::instance()->infoSystem(), SIGNAL( finished( QString ) ), SLOT( infoSystemFinished( QString ) ) );
+
+ connect( Tomahawk::InfoSystem::InfoSystem::instance(), SIGNAL( finished( QString ) ), SLOT( infoSystemFinished( QString ) ) );
onPlaybackStopped(); // initial state
}
@@ -209,68 +207,35 @@ AudioControls::onVolumeChanged( int volume )
void
-AudioControls::onCoverArtDownloaded()
-{
- if ( m_currentTrack.isNull() )
- return;
-
- QNetworkReply* reply = qobject_cast<QNetworkReply*>( sender() );
- QUrl redir = reply->attribute( QNetworkRequest::RedirectionTargetAttribute ).toUrl();
- if ( redir.isEmpty() )
- {
- const QByteArray ba = reply->readAll();
- if ( ba.length() )
- {
- QPixmap pm;
- pm.loadFromData( ba );
-
- if ( pm.isNull() || reply->url().toString().startsWith( LASTFM_DEFAULT_COVER ) )
- ui->coverImage->setPixmap( m_defaultCover );
- else
- ui->coverImage->setPixmap( pm.scaled( ui->coverImage->size(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation ) );
- }
- }
- else
- {
- // Follow HTTP redirect
- QNetworkRequest req( redir );
- QNetworkReply* reply = TomahawkUtils::nam()->get( req );
- connect( reply, SIGNAL( finished() ), SLOT( onCoverArtDownloaded() ) );
- }
-
- reply->deleteLater();
-}
-
-
-void
AudioControls::onPlaybackStarted( const Tomahawk::result_ptr& result )
{
qDebug() << Q_FUNC_INFO;
onPlaybackLoading( result );
- QString artistName = result->artist()->name();
- QString albumName = result->album()->name();
-
Tomahawk::InfoSystem::InfoCustomData trackInfo;
-
trackInfo["artist"] = QVariant::fromValue< QString >( result->artist()->name() );
trackInfo["album"] = QVariant::fromValue< QString >( result->album()->name() );
- TomahawkApp::instance()->infoSystem()->getInfo(
- s_infoIdentifier, Tomahawk::InfoSystem::InfoAlbumCoverArt,
+
+ Tomahawk::InfoSystem::InfoSystem::instance()->getInfo(
+ s_acInfoIdentifier, Tomahawk::InfoSystem::InfoAlbumCoverArt,
QVariant::fromValue< Tomahawk::InfoSystem::InfoCustomData >( trackInfo ), Tomahawk::InfoSystem::InfoCustomData() );
}
+
void
AudioControls::infoSystemInfo( QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, QVariant output, Tomahawk::InfoSystem::InfoCustomData customData )
{
- qDebug() << Q_FUNC_INFO;
- if ( caller != s_infoIdentifier || type != Tomahawk::InfoSystem::InfoAlbumCoverArt )
+ Q_UNUSED( input );
+ Q_UNUSED( customData );
+
+ qDebug() << Q_FUNC_INFO << caller << type << s_acInfoIdentifier << Tomahawk::InfoSystem::InfoAlbumCoverArt;
+ if ( caller != s_acInfoIdentifier || type != Tomahawk::InfoSystem::InfoAlbumCoverArt )
{
- qDebug() << "info of wrong type or not with our identifier";
+ qDebug() << "Info of wrong type or not with our identifier";
return;
}
-
+
if ( m_currentTrack.isNull() )
{
qDebug() << "Current track is null when trying to apply fetched cover art";
@@ -281,7 +246,7 @@ AudioControls::infoSystemInfo( QString caller, Tomahawk::InfoSystem::InfoType ty
{
qDebug() << "Cannot convert fetched art from a QByteArray";
return;
- }
+ }
Tomahawk::InfoSystem::InfoCustomData returnedData = output.value< Tomahawk::InfoSystem::InfoCustomData >();
const QByteArray ba = returnedData["imgbytes"].toByteArray();
@@ -290,19 +255,22 @@ AudioControls::infoSystemInfo( QString caller, Tomahawk::InfoSystem::InfoType ty
QPixmap pm;
pm.loadFromData( ba );
- if ( pm.isNull() || returnedData["url"].toString().startsWith( LASTFM_DEFAULT_COVER ) )
+ 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 );
qDebug() << Q_FUNC_INFO;
}
+
void
AudioControls::onPlaybackLoading( const Tomahawk::result_ptr& result )
{
@@ -356,7 +324,7 @@ AudioControls::onPlaybackResumed()
ui->pauseButton->setVisible( true );
ui->pauseButton->setEnabled( true );
ui->playPauseButton->setVisible( false );
- ui->playPauseButton->setEnabled( false );
+ ui->playPauseButton->setEnabled( false );
}
View
9 src/audiocontrols.h
@@ -23,7 +23,7 @@
#include "result.h"
#include "playlistinterface.h"
-#include "tomahawk/infosystem.h"
+#include "infosystem/infosystem.h"
namespace Ui
{
@@ -41,12 +41,10 @@ Q_OBJECT
signals:
void playPressed();
void pausePressed();
-
+
public slots:
void onRepeatModeChanged( PlaylistInterface::RepeatMode mode );
void onShuffleModeChanged( bool enabled );
- void infoSystemInfo( QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, QVariant output, Tomahawk::InfoSystem::InfoCustomData customData );
- void infoSystemFinished( QString target );
protected:
void changeEvent( QEvent* e );
@@ -68,7 +66,8 @@ private slots:
void onAlbumClicked();
void onTrackClicked();
- void onCoverArtDownloaded();
+ void infoSystemInfo( QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, QVariant output, Tomahawk::InfoSystem::InfoCustomData customData );
+ void infoSystemFinished( QString target );
private:
Ui::AudioControls *ui;
View
144 src/infosystem/infosystemcache.cpp
@@ -1,144 +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 <QtDebug>
-#include <QDesktopServices>
-#include <QDir>
-#include <QSettings>
-
-#include "infosystemcache.h"
-
-
-namespace Tomahawk
-{
-
-namespace InfoSystem
-{
-
-
-InfoSystemCache::InfoSystemCache( QObject* parent )
- : QObject(parent)
-{
- qDebug() << Q_FUNC_INFO;
- QString cacheBaseDir = QDesktopServices::storageLocation( QDesktopServices::CacheLocation );
- for( int i = 0; i <= InfoNoInfo; i++ )
- {
- InfoType type = (InfoType)(i);
- if( m_dirtySet.contains( type ) && m_dataCache.contains( type ) )
- {
- QString cacheDir = cacheBaseDir + QString::number( i );
- QDir dir( cacheDir );
- if( dir.exists() && QFile::exists( QString( cacheDir + '/' + QString::number( i ) ) ) )
- loadCache( type, QString( cacheDir + '/' + QString::number( i ) ) );
- }
- }
-}
-
-
-InfoSystemCache::~InfoSystemCache()
-{
- qDebug() << Q_FUNC_INFO;
- qDebug() << "Saving infosystemcache to disk";
- QString cacheBaseDir = QDesktopServices::storageLocation( QDesktopServices::CacheLocation );
- for( int i = 0; i <= InfoNoInfo; i++ )
- {
- InfoType type = (InfoType)(i);
- if( m_dirtySet.contains( type ) && m_dataCache.contains( type ) )
- {
- QString cacheDir = cacheBaseDir + QString::number( i );
- saveCache( type, cacheDir );
- }
- }
-}
-
-
-void
-InfoSystemCache::getCachedInfoSlot( Tomahawk::InfoSystem::InfoCacheCriteria criteria, QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, Tomahawk::InfoSystem::InfoCustomData customData )
-{
- qDebug() << Q_FUNC_INFO;
- if( !m_dataCache.contains( type ) || !m_dataCache[type].contains( criteria ) )
- {
- emit notInCache( criteria, caller, type, input, customData );
- return;
- }
-
- emit info( caller, type, input, m_dataCache[type][criteria], customData );
-}
-
-
-void
-InfoSystemCache::updateCacheSlot( Tomahawk::InfoSystem::InfoCacheCriteria criteria, Tomahawk::InfoSystem::InfoType type, QVariant output )
-{
- qDebug() << Q_FUNC_INFO;
- QHash< InfoCacheCriteria, QVariant > typedatacache;
- QHash< InfoCacheCriteria, QDateTime > typetimecache;
- typedatacache[criteria] = output;
- typetimecache[criteria] = QDateTime::currentDateTimeUtc();
- m_dataCache[type] = typedatacache;
- m_timeCache[type] = typetimecache;
- m_dirtySet.insert( type );
-}
-
-
-void
-InfoSystemCache::loadCache( InfoType type, const QString &cacheDir )
-{
- qDebug() << Q_FUNC_INFO;
-}
-
-
-void
-InfoSystemCache::saveCache( InfoType type, const QString &cacheDir )
-{
- qDebug() << Q_FUNC_INFO;
- QDir dir( cacheDir );
- if( !dir.exists( cacheDir ) )
- {
- qDebug() << "Creating cache directory " << cacheDir;
- if( !dir.mkpath( cacheDir ) )
- {
- qDebug() << "Failed to create cache dir! Bailing...";
- return;
- }
- }
-
- QSettings cacheFile( QString( cacheDir + '/' + QString::number( (int)type ) ), QSettings::IniFormat );
-
- foreach( InfoCacheCriteria criteria, m_dataCache[type].keys() )
- {
- cacheFile.beginGroup( "type_" + QString::number( type ) );
- cacheFile.beginWriteArray( "criteria" );
- QStringList keys = criteria.keys();
- for( int i = 0; i < criteria.size(); i++ )
- {
- cacheFile.setArrayIndex( i );
- cacheFile.setValue( keys.at( i ), criteria[keys.at( i )] );
- }
- cacheFile.endArray();
- cacheFile.setValue( "data", m_dataCache[type][criteria] );
- cacheFile.setValue( "time", m_timeCache[type][criteria] );
- cacheFile.endGroup();
- }
-
- m_dirtySet.remove( type );
-}
-
-
-} //namespace InfoSystem
-
-} //namespace Tomahawk
View
50 src/libtomahawk/CMakeLists.txt
@@ -4,6 +4,7 @@ SET( QT_USE_QTGUI TRUE )
SET( QT_USE_QTSQL TRUE )
SET( QT_USE_QTNETWORK TRUE )
SET( QT_USE_QTXML TRUE )
+SET(QT_USE_QTUITOOLS TRUE)
include( ${QT_USE_FILE} )
@@ -21,6 +22,7 @@ set( libSources
album.cpp
collection.cpp
playlist.cpp
+ resolver.cpp
query.cpp
result.cpp
source.cpp
@@ -29,6 +31,7 @@ set( libSources
sip/SipPlugin.cpp
audio/madtranscode.cpp
+ audio/dummytranscode.cpp
audio/vorbistranscode.cpp
audio/flactranscode.cpp
audio/audioengine.cpp
@@ -42,6 +45,7 @@ set( libSources
database/databasecommand.cpp
database/databasecommandloggable.cpp
database/databasecommand_resolve.cpp
+ database/databasecommand_allartists.cpp
database/databasecommand_allalbums.cpp
database/databasecommand_alltracks.cpp
database/databasecommand_addfiles.cpp
@@ -73,7 +77,16 @@ set( libSources
database/databasecommand_clientauthvalid.cpp
database/database.cpp
- playlist/collectionmodel.cpp
+ infosystem/infosystemcache.cpp
+ infosystem/infosystem.cpp
+ infosystem/infoplugins/echonestplugin.cpp
+ infosystem/infoplugins/lastfmplugin.cpp
+ infosystem/infoplugins/musixmatchplugin.cpp
+
+ playlist/treemodel.cpp
+ playlist/treeproxymodel.cpp
+ playlist/treeheader.cpp
+ playlist/treeitemdelegate.cpp
playlist/collectionproxymodel.cpp
playlist/collectionflatmodel.cpp
playlist/collectionview.cpp
@@ -89,15 +102,17 @@ set( libSources
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/topbar/topbar.cpp
- playlist/topbar/clearbutton.cpp
- playlist/topbar/searchlineedit.cpp
+ playlist/topbar/clearbutton.cpp
+ playlist/topbar/searchlineedit.cpp
playlist/topbar/lineedit.cpp
playlist/topbar/searchbutton.cpp
@@ -175,6 +190,7 @@ set( libHeaders
audio/transcodeinterface.h
audio/madtranscode.h
+ audio/dummytranscode.h
audio/vorbistranscode.h
audio/flactranscode.h
audio/audioengine.h
@@ -187,6 +203,7 @@ set( libHeaders
database/databasecommand.h
database/databasecommandloggable.h
database/databasecommand_resolve.h
+ database/databasecommand_allartists.h
database/databasecommand_allalbums.h
database/databasecommand_alltracks.h
database/databasecommand_addfiles.h
@@ -217,6 +234,12 @@ set( libHeaders
database/databasecommand_addclientauth.h
database/databasecommand_clientauthvalid.h
+ infosystem/infosystem.h
+ infosystem/infosystemcache.h
+ infosystem/infoplugins/echonestplugin.h
+ infosystem/infoplugins/lastfmplugin.h
+ infosystem/infoplugins/musixmatchplugin.h
+
network/bufferiodevice.h
network/msgprocessor.h
network/remotecollection.h
@@ -227,7 +250,10 @@ set( libHeaders
network/controlconnection.h
network/portfwdthread.h
- playlist/collectionmodel.h
+ playlist/treemodel.h
+ playlist/treeproxymodel.h
+ playlist/treeheader.h
+ playlist/treeitemdelegate.h
playlist/collectionproxymodel.h
playlist/collectionflatmodel.h
playlist/collectionview.h
@@ -243,15 +269,17 @@ set( libHeaders
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/topbar/topbar.h
playlist/topbar/clearbutton.h
- playlist/topbar/searchlineedit.h
+ playlist/topbar/searchlineedit.h
playlist/topbar/lineedit.h
playlist/topbar/lineedit_p.h
playlist/topbar/searchbutton.h
@@ -297,8 +325,8 @@ set( libHeaders
kdsingleapplicationguard/kdlockedsharedmemorypointer.h
)
-set( libHeaders_NoMOC
- playlist/dynamic/GeneratorInterface.h
+set( libHeaders_NoMOC
+ playlist/dynamic/GeneratorInterface.h
)
set( libUI ${libUI}
widgets/newplaylistwidget.ui
@@ -316,9 +344,9 @@ include_directories( . ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/.
${LIBECHONEST_INCLUDE_DIR}/..
${CLUCENE_INCLUDE_DIR}
${CLUCENE_LIBRARY_DIR}
+ ${CMAKE_BINARY_DIR}/thirdparty/liblastfm2/src
../../include
- ../network
playlist
${THIRDPARTY_DIR}/libportfwd/include
@@ -329,6 +357,7 @@ include_directories( . ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/.
${THIRDPARTY_DIR}/jdns/jdns
${THIRDPARTY_DIR}/jdns/jdnsshared
${THIRDPARTY_DIR}/qtweetlib/qtweetlib/src
+ ${CMAKE_BINARY_DIR}/thirdparty/liblastfm2/src
)
@@ -379,6 +408,10 @@ IF( UNIX AND NOT APPLE )
)
ENDIF( UNIX AND NOT APPLE )
+IF(LIBLASTFM_FOUND)
+ SET(LINK_LIBRARIES ${LINK_LIBRARIES} tomahawk_lastfm2 )
+ENDIF(LIBLASTFM_FOUND)
+
qt4_wrap_ui( libUI_H ${libUI} )
qt4_wrap_cpp( libMoc ${libHeaders} )
@@ -407,6 +440,7 @@ target_link_libraries( tomahawklib
${QT_LIBRARIES}
${OS_SPECIFIC_LINK_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
+ ${LINK_LIBRARIES}
)
INSTALL( TARGETS tomahawklib DESTINATION lib${LIB_SUFFIX} )
View
4 src/libtomahawk/album.cpp
@@ -1,5 +1,5 @@
/* === 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
@@ -93,7 +93,7 @@ Album::tracks()
cmd->setAlbum( this );
cmd->setSortOrder( DatabaseCommand_AllTracks::AlbumPosition );
- connect( cmd, SIGNAL( tracks( QList<Tomahawk::query_ptr> ) ),
+ connect( cmd, SIGNAL( tracks( QList<Tomahawk::query_ptr>, QVariant ) ),
SLOT( onTracksAdded( QList<Tomahawk::query_ptr> ) ) );
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( cmd ) );
View
2  src/libtomahawk/album.h
@@ -58,7 +58,7 @@ Q_OBJECT
virtual void setRepeatMode( PlaylistInterface::RepeatMode ) {}
virtual void setShuffled( bool ) {}
- virtual void setFilter( const QString& pattern ) {}
+ virtual void setFilter( const QString& /*pattern*/ ) {}
signals:
void repeatModeChanged( PlaylistInterface::RepeatMode mode );
View
4 src/libtomahawk/artist.cpp
@@ -1,5 +1,5 @@
/* === 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
@@ -95,7 +95,7 @@ Artist::tracks()
cmd->setArtist( this );
cmd->setSortOrder( DatabaseCommand_AllTracks::Album );
- connect( cmd, SIGNAL( tracks( QList<Tomahawk::query_ptr> ) ),
+ connect( cmd, SIGNAL( tracks( QList<Tomahawk::query_ptr>, QVariant ) ),
SLOT( onTracksAdded( QList<Tomahawk::query_ptr> ) ) );
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( cmd ) );
View
2  src/libtomahawk/artist.h
@@ -58,7 +58,7 @@ Q_OBJECT
virtual void setRepeatMode( PlaylistInterface::RepeatMode ) {}
virtual void setShuffled( bool ) {}
- virtual void setFilter( const QString& pattern ) {}
+ virtual void setFilter( const QString& /*pattern*/ ) {}
signals:
void repeatModeChanged( PlaylistInterface::RepeatMode mode );
View
36 src/libtomahawk/audio/audioengine.cpp
@@ -1,5 +1,5 @@
/* === 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
@@ -28,6 +28,7 @@
#include "network/servent.h"
#include "madtranscode.h"
+#include "dummytranscode.h"
#ifndef NO_OGG
#include "vorbistranscode.h"
#endif
@@ -228,12 +229,15 @@ AudioEngine::loadTrack( const Tomahawk::result_ptr& result )
qDebug() << "Starting new song from url:" << m_currentTrack->url();
emit loading( m_currentTrack );
+ qDebug() << "input is:" << m_input.isNull();
if ( !m_input.isNull() )
{
m_input->close();
m_input.clear();
}
+ if( !m_lastTrack.isNull() ) qDebug() << "LAST TRACK:" << m_lastTrack->mimetype();
+ qDebug() << "LOADING SONG:" << m_currentTrack->mimetype();
if ( m_lastTrack.isNull() || ( m_currentTrack->mimetype() != m_lastTrack->mimetype() ) )
{
if ( !m_transcode.isNull() )
@@ -241,7 +245,10 @@ AudioEngine::loadTrack( const Tomahawk::result_ptr& result )
m_transcode.clear();
}
- if ( m_currentTrack->mimetype() == "audio/mpeg" )
+ if ( m_currentTrack->mimetype() == "audio/basic" )
+ {
+ m_transcode = QSharedPointer<TranscodeInterface>(new DummyTranscode());
+ } else if ( m_currentTrack->mimetype() == "audio/mpeg" )
{
m_transcode = QSharedPointer<TranscodeInterface>(new MADTranscode());
}
@@ -428,8 +435,10 @@ AudioEngine::setCurrentTrack( const Tomahawk::result_ptr& result )
void
AudioEngine::onDownloadProgress( qint64 recv, qint64 total )
{
- if ( ( recv > 1024 * 32 ) || recv > total )
+ if ( ( recv > 1024 * 32 ) || recv > total )
m_readReady = true;
+
+// qDebug() << "Got onDownloadProgress from reading http stream, received enough?" << m_readReady << "(" << recv << "> 1024 * 32 and" << recv << "<" << total << ")";
}
@@ -454,28 +463,30 @@ void
AudioEngine::loop()
{
m_i++;
- //if( m_i % 500 == 0 ) qDebug() << Q_FUNC_INFO << thread();
+// if( m_i % 500 == 0 ) qDebug() << Q_FUNC_INFO << thread();
{
QMutexLocker lock( &m_mutex );
-/* if ( m_i % 200 == 0 )
- {
- if ( !m_input.isNull() )
- qDebug() << "Outer audio loop" << m_input->bytesAvailable() << m_audio->needData();
- }*/
+// if ( m_i % 200 == 0 )
+// {
+// if ( !m_input.isNull() )
+// qDebug() << "Outer audio loop" << m_input->bytesAvailable() << m_audio->needData();
+// }
if ( m_i % 10 == 0 && m_audio->isPlaying() )
m_audio->triggerTimers();
+// qDebug() << !m_transcode.isNull() << !m_input.isNull() << m_audio->needData() << !m_audio->isPaused();
+// if( !m_input.isNull() ) qDebug() << "INPUT has bytes:" << m_input->bytesAvailable();
if( !m_transcode.isNull() &&
!m_input.isNull() &&
m_input->bytesAvailable() &&
m_audio->needData() &&
!m_audio->isPaused() )
{
- //if ( m_i % 50 == 0 )
- // qDebug() << "Inner audio loop";
+// if ( m_i % 50 == 0 )
+// qDebug() << "Inner audio loop";
if ( m_transcode->needData() > 0 )
{
@@ -498,11 +509,12 @@ AudioEngine::loop()
// are we cleanly at the end of a track, and ready for the next one?
if ( !m_input.isNull() &&
m_input->atEnd() &&
- m_readReady &&
+ m_readReady &&
!m_input->bytesAvailable() &&
!m_audio->haveData() &&
!m_audio->isPaused() )
{
+ qDebug() << !m_input.isNull() << m_input->atEnd() << m_readReady << !m_input->bytesAvailable() << !m_audio->haveData() << !m_audio->isPaused();
qDebug() << "Starting next track then";
loadNextTrack();
// will need data immediately:
View
64 src/libtomahawk/audio/dummytranscode.cpp
@@ -0,0 +1,64 @@
+/* === 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 "dummytranscode.h"
+
+#include <QDebug>
+
+DummyTranscode::DummyTranscode()
+ : m_init( false )
+{
+ qDebug() << Q_FUNC_INFO;
+}
+
+
+DummyTranscode::~DummyTranscode()
+{
+ qDebug() << Q_FUNC_INFO;
+}
+
+
+void
+DummyTranscode::processData( const QByteArray &buffer, bool finish )
+{
+ Q_UNUSED( finish );
+ m_buffer.append( buffer );
+// qDebug() << "DUMMYTRANSCODING:" << buffer.size();
+
+ if( !m_init && m_buffer.size() >= 16364 ) {
+ m_init = true;
+ emit streamInitialized( 44100, 2 );
+ }
+}
+
+
+void
+DummyTranscode::onSeek( int seconds )
+{
+ Q_UNUSED( seconds );
+ m_buffer.clear();
+}
+
+
+void
+DummyTranscode::clearBuffers()
+{
+ m_buffer.clear();
+ m_init = false;
+}
+
View
63 src/libtomahawk/audio/dummytranscode.h
@@ -0,0 +1,63 @@
+/*
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) 2011 Leo Franchi <leo@kdab.com>
+
+ This program 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.
+
+ This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#ifndef DUMMYTRANSCODE_H
+#define DUMMYTRANSCODE_H
+
+#include "audio/transcodeinterface.h"
+#include "dllmacro.h"
+
+#define _BUFFER_PREFERRED 32768
+
+class DLLEXPORT DummyTranscode : public TranscodeInterface
+{
+ Q_OBJECT
+
+public:
+ DummyTranscode();
+ virtual ~DummyTranscode();
+
+ const QStringList supportedTypes() const { QStringList l; l << "audio/basic"; return l; }
+
+ int needData() { return true; } // always eats data
+ bool haveData() { return !m_buffer.isEmpty(); }
+
+ unsigned int preferredDataSize() { return _BUFFER_PREFERRED; }
+
+ QByteArray data() { QByteArray b = m_buffer; m_buffer.clear(); return b; }
+
+ virtual void setBufferCapacity( int bytes ) { m_bufferCapacity = bytes; }
+ int bufferSize() { return m_buffer.size(); }
+
+public slots:
+ virtual void clearBuffers();
+ virtual void onSeek( int seconds );
+ virtual void processData( const QByteArray& data, bool finish );
+
+signals:
+ void streamInitialized( long sampleRate, int channels );
+ void timeChanged( int seconds );
+
+private:
+ QByteArray m_buffer;
+ int m_bufferCapacity;
+ bool m_init;
+};
+
+#endif // DUMMYTRANSCODE_H
View
2  src/libtomahawk/audio/flactranscode.cpp
@@ -39,6 +39,7 @@ FLACTranscode::~FLACTranscode()
void
FLACTranscode::onSeek( int seconds )
{
+ Q_UNUSED( seconds );
QMutexLocker locker( &m_mutex );
m_buffer.clear();
@@ -120,6 +121,7 @@ FLACTranscode::write_callback( const ::FLAC__Frame *frame, const FLAC__int32 *co
::FLAC__StreamDecoderSeekStatus
FLACTranscode::seek_callback(FLAC__uint64 absolute_byte_offset)
{
+ Q_UNUSED( absolute_byte_offset );
return FLAC__STREAM_DECODER_SEEK_STATUS_UNSUPPORTED;
}
View
6 src/libtomahawk/audio/vorbistranscode.cpp
@@ -39,6 +39,9 @@ vorbis_read( void* data_ptr, size_t byteSize, size_t sizeToRead, void* data_src
int
vorbis_seek( void* data_src, ogg_int64_t offset, int origin )
{
+ Q_UNUSED( data_src );
+ Q_UNUSED( offset );
+ Q_UNUSED( origin );
return -1;
}
@@ -46,6 +49,7 @@ vorbis_seek( void* data_src, ogg_int64_t offset, int origin )
int
vorbis_close( void* data_src )
{
+ Q_UNUSED( data_src );
// done ;-)
return 0;
}
@@ -54,6 +58,7 @@ vorbis_close( void* data_src )
long
vorbis_tell( void* data_src )
{
+ Q_UNUSED( data_src );
return -1;
}
@@ -74,6 +79,7 @@ VorbisTranscode::~VorbisTranscode()
void
VorbisTranscode::onSeek( int seconds )
{
+ Q_UNUSED( seconds );
QMutexLocker locker( &m_mutex );
m_buffer.clear();
View
2  src/libtomahawk/database/database.h
@@ -49,7 +49,7 @@ Q_OBJECT
~Database();
QString dbid() const;
- const bool indexReady() const { return m_indexReady; }
+ bool indexReady() const { return m_indexReady; }
void loadIndex();
View
23 src/libtomahawk/database/databasecollection.cpp
@@ -1,5 +1,5 @@
/* === 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
@@ -52,10 +52,10 @@ DatabaseCollection::loadDynamicPlaylists()
{
qDebug() << Q_FUNC_INFO;
DatabaseCommand_LoadAllDynamicPlaylists* cmd = new DatabaseCommand_LoadAllDynamicPlaylists( source() );
-
+
connect( cmd, SIGNAL( playlistLoaded( Tomahawk::source_ptr, QVariantList ) ),
SLOT( dynamicPlaylistCreated( const Tomahawk::source_ptr&, const QVariantList& ) ) );
-
+
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( cmd ) );
}
@@ -68,7 +68,7 @@ DatabaseCollection::loadTracks()
setLoaded();
DatabaseCommand_AllTracks* cmd = new DatabaseCommand_AllTracks( source()->collection() );
- connect( cmd, SIGNAL( tracks( QList<Tomahawk::query_ptr> ) ),
+ connect( cmd, SIGNAL( tracks( QList<Tomahawk::query_ptr>, QVariant ) ),
SLOT( setTracks( QList<Tomahawk::query_ptr> ) ) );
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( cmd ) );
@@ -112,12 +112,12 @@ DatabaseCollection::playlists()
QList< dynplaylist_ptr > DatabaseCollection::dynamicPlaylists()
{
qDebug() << Q_FUNC_INFO;
-
+
if ( Collection::dynamicPlaylists().isEmpty() )
{
loadDynamicPlaylists();
}
-
+
return Collection::dynamicPlaylists();
}
@@ -143,11 +143,12 @@ void DatabaseCollection::dynamicPlaylistCreated( const source_ptr& source, const
data[1].toString(), //title
data[2].toString(), //info
data[3].toString(), //creator
- data[4].toString(), // dynamic type
- static_cast<GeneratorMode>(data[5].toInt()), // dynamic mode
- data[6].toBool(), //shared
- data[7].toInt(), //lastmod
- data[8].toString() ) ); //GUID
+ data[4].toUInt(), // createdOn
+ data[5].toString(), // dynamic type
+ static_cast<GeneratorMode>(data[6].toInt()), // dynamic mode
+ data[7].toBool(), //shared
+ data[8].toInt(), //lastmod
+ data[9].toString() ) ); //GUID
addDynamicPlaylist( p );
}
View
10 src/libtomahawk/database/databasecommand.h
@@ -1,5 +1,5 @@
/* === 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
@@ -48,6 +48,7 @@ Q_PROPERTY( QString guid READ guid WRITE setGuid )
explicit DatabaseCommand( const Tomahawk::source_ptr& src, QObject* parent = 0 );
DatabaseCommand( const DatabaseCommand &other )
+ : QObject( other.parent() )
{
}
@@ -59,7 +60,7 @@ Q_PROPERTY( QString guid READ guid WRITE setGuid )
// if i make this pure virtual, i get compile errors in qmetatype.h.
// we need Q_DECLARE_METATYPE to use in queued sig/slot connections.
- virtual void exec( DatabaseImpl* lib ) { Q_ASSERT( false ); }
+ virtual void exec( DatabaseImpl* /*lib*/ ) { Q_ASSERT( false ); }
void _exec( DatabaseImpl* lib );
@@ -75,6 +76,9 @@ Q_PROPERTY( QString guid READ guid WRITE setGuid )
virtual bool singletonCmd() const { return false; }
virtual bool localOnly() const { return false; }
+ virtual QVariant data() const { return m_data; }
+ virtual void setData( const QVariant& data ) { m_data = data; }
+
QString guid() const
{
if( m_guid.isEmpty() )
@@ -97,6 +101,8 @@ Q_PROPERTY( QString guid READ guid WRITE setGuid )
State m_state;
Tomahawk::source_ptr m_source;
mutable QString m_guid;
+
+ QVariant m_data;
};
Q_DECLARE_METATYPE( DatabaseCommand )
View
107 src/libtomahawk/database/databasecommand_allalbums.cpp
@@ -1,5 +1,5 @@
/* === 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
@@ -22,14 +22,69 @@
#include "databaseimpl.h"
+
void
-DatabaseCommand_AllAlbums::exec( DatabaseImpl* dbi )
+DatabaseCommand_AllAlbums::execForArtist( DatabaseImpl* dbi )
{
- Q_ASSERT( !m_collection->source().isNull() );
+ TomahawkSqlQuery query = dbi->newquery();
+ QList<Tomahawk::album_ptr> al;
+ QString orderToken, sourceToken;
+ switch ( m_sortOrder )
+ {
+ case 0:
+ break;
+
+ case ModificationTime:
+ orderToken = "file.mtime";
+ }
+
+ if ( !m_collection.isNull() )
+ sourceToken = QString( "AND file.source %1 " ).arg( m_collection->source()->isLocal() ? "IS NULL" : QString( "= %1" ).arg( m_collection->source()->id() ) );
+
+ QString sql = QString(
+ "SELECT DISTINCT album.id, album.name "
+ "FROM file, file_join "
+ "LEFT OUTER JOIN album "
+ "ON file_join.album = album.id "
+ "WHERE file.id = file_join.file "
+ "AND file_join.artist = %1 "
+ "%2 "
+ "%3 %4 %5"
+ ).arg( m_artist->id() )
+ .arg( sourceToken )
+ .arg( m_sortOrder > 0 ? QString( "ORDER BY %1" ).arg( orderToken ) : QString() )
+ .arg( m_sortDescending ? "DESC" : QString() )
+ .arg( m_amount > 0 ? QString( "LIMIT 0, %1" ).arg( m_amount ) : QString() );
+
+ query.prepare( sql );
+ query.exec();
+
+ while( query.next() )
+ {
+ unsigned int albumId = query.value( 0 ).toUInt();
+ QString albumName = query.value( 1 ).toString();
+ if ( query.value( 0 ).isNull() )
+ {
+ albumName = tr( "Unknown" );
+ }
+
+ Tomahawk::album_ptr album = Tomahawk::Album::get( albumId, albumName, m_artist );
+ al << album;
+ }
+
+ if ( al.count() )
+ emit albums( al, data() );
+ emit done();
+}
+
+
+void
+DatabaseCommand_AllAlbums::execForCollection( DatabaseImpl* dbi )
+{
TomahawkSqlQuery query = dbi->newquery();
QList<Tomahawk::album_ptr> al;
- QString m_orderToken;
+ QString orderToken;
switch ( m_sortOrder )
{
@@ -37,22 +92,22 @@ DatabaseCommand_AllAlbums::exec( DatabaseImpl* dbi )
break;
case ModificationTime:
- m_orderToken = "file.mtime";
+ orderToken = "file.mtime";
}
QString sql = QString(
- "SELECT DISTINCT album.id, album.name, album.artist, artist.name "
- "FROM album, file, file_join "
- "LEFT OUTER JOIN artist "
- "ON album.artist = artist.id "
- "WHERE file.id = file_join.file "
- "AND file_join.album = album.id "
- "AND file.source %1 "
- "%2 %3 %4"
- ).arg( m_collection->source()->isLocal() ? "IS NULL" : QString( "= %1" ).arg( m_collection->source()->id() ) )
- .arg( m_sortOrder > 0 ? QString( "ORDER BY %1" ).arg( m_orderToken ) : QString() )
- .arg( m_sortDescending ? "DESC" : QString() )
- .arg( m_amount > 0 ? QString( "LIMIT 0, %1" ).arg( m_amount ) : QString() );
+ "SELECT DISTINCT album.id, album.name, album.artist, artist.name "
+ "FROM album, file, file_join "
+ "LEFT OUTER JOIN artist "
+ "ON album.artist = artist.id "
+ "WHERE file.id = file_join.file "
+ "AND file_join.album = album.id "
+ "AND file.source %1 "
+ "%2 %3 %4"
+ ).arg( m_collection->source()->isLocal() ? "IS NULL" : QString( "= %1" ).arg( m_collection->source()->id() ) )
+ .arg( m_sortOrder > 0 ? QString( "ORDER BY %1" ).arg( orderToken ) : QString() )
+ .arg( m_sortDescending ? "DESC" : QString() )
+ .arg( m_amount > 0 ? QString( "LIMIT 0, %1" ).arg( m_amount ) : QString() );
query.prepare( sql );
query.exec();
@@ -66,6 +121,20 @@ DatabaseCommand_AllAlbums::exec( DatabaseImpl* dbi )
}
if ( al.count() )
- emit albums( al, m_collection );
- emit done( m_collection );
+ emit albums( al, data() );
+ emit done();
+}
+
+
+void
+DatabaseCommand_AllAlbums::exec( DatabaseImpl* dbi )
+{
+ if ( !m_artist.isNull() )
+ {
+ execForArtist( dbi );
+ }
+ else
+ {
+ execForCollection( dbi );
+ }
}
View
14 src/libtomahawk/database/databasecommand_allalbums.h
@@ -1,5 +1,5 @@
/* === 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
@@ -38,9 +38,10 @@ Q_OBJECT
ModificationTime = 1
};
- explicit DatabaseCommand_AllAlbums( const Tomahawk::collection_ptr& collection, QObject* parent = 0 )
+ explicit DatabaseCommand_AllAlbums( const Tomahawk::collection_ptr& collection, const Tomahawk::artist_ptr& artist = Tomahawk::artist_ptr(), QObject* parent = 0 )
: DatabaseCommand( parent )
, m_collection( collection )
+ , m_artist( artist )
, m_amount( 0 )
, m_sortOrder( DatabaseCommand_AllAlbums::None )
, m_sortDescending( false )
@@ -51,16 +52,21 @@ Q_OBJECT
virtual bool doesMutates() const { return false; }
virtual QString commandname() const { return "allalbums"; }
+ void execForCollection( DatabaseImpl* );
+ void execForArtist( DatabaseImpl* );
+
void setLimit( unsigned int amount ) { m_amount = amount; }
void setSortOrder( DatabaseCommand_AllAlbums::SortOrder order ) { m_sortOrder = order; }
void setSortDescending( bool descending ) { m_sortDescending = descending; }
signals:
- void albums( const QList<Tomahawk::album_ptr>&, const Tomahawk::collection_ptr& );
- void done( const Tomahawk::collection_ptr& );
+ void albums( const QList<Tomahawk::album_ptr>&, const QVariant& data );
+ void done();
private:
Tomahawk::collection_ptr m_collection;
+ Tomahawk::artist_ptr m_artist;
+
unsigned int m_amount;
DatabaseCommand_AllAlbums::SortOrder m_sortOrder;
bool m_sortDescending;
View
68 src/libtomahawk/database/databasecommand_allartists.cpp
@@ -0,0 +1,68 @@
+/* === 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 "databasecommand_allartists.h"
+
+#include <QSqlQuery>
+
+#include "databaseimpl.h"
+
+void
+DatabaseCommand_AllArtists::exec( DatabaseImpl* dbi )
+{
+ TomahawkSqlQuery query = dbi->newquery();
+ QList<Tomahawk::artist_ptr> al;
+ QString orderToken, sourceToken;
+
+ switch ( m_sortOrder )
+ {
+ case 0:
+ break;
+
+ case ModificationTime:
+ orderToken = "file.mtime";
+ }
+
+ if ( !m_collection.isNull() )
+ sourceToken = QString( "AND file.source %1 " ).arg( m_collection->source()->isLocal() ? "IS NULL" : QString( "= %1" ).arg( m_collection->source()->id() ) );
+
+ QString sql = QString(
+ "SELECT DISTINCT artist.id, artist.name "
+ "FROM artist, file, file_join "
+ "WHERE file.id = file_join.file "
+ "AND file_join.artist = artist.id "
+ "%1 %2 %3 %4"
+ ).arg( sourceToken )
+ .arg( m_sortOrder > 0 ? QString( "ORDER BY %1" ).arg( orderToken ) : QString() )
+ .arg( m_sortDescending ? "DESC" : QString() )
+ .arg( m_amount > 0 ? QString( "LIMIT 0, %1" ).arg( m_amount ) : QString() );
+
+ query.prepare( sql );
+ query.exec();
+
+ while( query.next() )
+ {
+ Tomahawk::artist_ptr artist = Tomahawk::Artist::get( query.value( 0 ).toUInt(), query.value( 1 ).toString() );
+
+ al << artist;
+ }
+
+ if ( al.count() )
+ emit artists( al );
+ emit done();
+}
View
69 src/libtomahawk/database/databasecommand_allartists.h
@@ -0,0 +1,69 @@
+/* === 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 DATABASECOMMAND_ALLARTISTS_H
+#define DATABASECOMMAND_ALLARTISTS_H
+
+#include <QObject>
+#include <QVariantMap>
+
+#include "databasecommand.h"
+#include "album.h"
+#include "collection.h"
+#include "typedefs.h"
+
+#include "dllmacro.h"
+
+class DLLEXPORT DatabaseCommand_AllArtists : public DatabaseCommand
+{
+Q_OBJECT
+public:
+ enum SortOrder {
+ None = 0,
+ ModificationTime = 1
+ };
+
+ explicit DatabaseCommand_AllArtists( const Tomahawk::collection_ptr& collection = Tomahawk::collection_ptr(), QObject* parent = 0 )
+ : DatabaseCommand( parent )
+ , m_collection( collection )
+ , m_amount( 0 )
+ , m_sortOrder( DatabaseCommand_AllArtists::None )
+ , m_sortDescending( false )
+ {}
+
+ virtual void exec( DatabaseImpl* );
+
+ virtual bool doesMutates() const { return false; }
+ virtual QString commandname() const { return "allartists"; }
+
+ void setLimit( unsigned int amount ) { m_amount = amount; }
+ void setSortOrder( DatabaseCommand_AllArtists::SortOrder order ) { m_sortOrder = order; }
+ void setSortDescending( bool descending ) { m_sortDescending = descending; }
+
+signals:
+ void artists( const QList<Tomahawk::artist_ptr>& );
+ void done();
+
+private:
+ Tomahawk::collection_ptr m_collection;
+ unsigned int m_amount;
+ DatabaseCommand_AllArtists::SortOrder m_sortOrder;
+ bool m_sortDescending;
+};
+
+#endif // DATABASECOMMAND_ALLARTISTS_H
View
22 src/libtomahawk/database/databasecommand_alltracks.cpp
@@ -1,5 +1,5 @@
/* === 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
@@ -51,10 +51,21 @@ DatabaseCommand_AllTracks::exec( DatabaseImpl* dbi )
break;
}
-
if ( !m_collection.isNull() )
sourceToken = QString( "AND file.source %1" ).arg( m_collection->source()->isLocal() ? "IS NULL" : QString( "= %1" ).arg( m_collection->so