Compare commits
588 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
5afce9327f | ||
|
db413b2049 | ||
|
646d2fbfd3 | ||
|
dcb46877f0 | ||
|
985b54d84d | ||
|
c6ca3d8660 | ||
|
a104e92471 | ||
|
1929804541 | ||
|
a564b3b272 | ||
|
d083528ad5 | ||
|
4d63a9462d | ||
|
5a64886b7c | ||
|
76986e8908 | ||
|
9a9a7148af | ||
|
aec7a0b140 | ||
|
eff42af593 | ||
|
ad2b54ad90 | ||
|
4e316a48ea | ||
|
87863ae7e2 | ||
|
5e439b990f | ||
|
5dcf426cdf | ||
|
5b6c4560ae | ||
|
fec670f27c | ||
|
fb13ccd285 | ||
|
b3b70cea82 | ||
|
f84d08e011 | ||
|
9c5966000c | ||
|
79bfdec895 | ||
|
9f5215302c | ||
|
73d7ba03f5 | ||
|
d623bbefc2 | ||
|
907dad95e1 | ||
|
565217a53a | ||
|
bee6485475 | ||
|
ace18dfa1f | ||
|
95f1162b6e | ||
|
e5bdd2242f | ||
|
deb0eb819c | ||
|
04864c7d79 | ||
|
43c4daa4e3 | ||
|
fc95cee6ce | ||
|
fff8fbfe80 | ||
|
eec8b76de0 | ||
|
68f03dbd13 | ||
|
753e1b3c90 | ||
|
e828dadec8 | ||
|
6e929986cb | ||
|
e1b086e3a4 | ||
|
27147a0140 | ||
|
66836ae0bd | ||
|
6342e6a9f8 | ||
|
042ccbe730 | ||
|
6c6411561b | ||
|
18e3669911 | ||
|
240517b0cd | ||
|
fab36b2262 | ||
|
dd74ce04e6 | ||
|
e3a43e8ca6 | ||
|
c401ea0d91 | ||
|
2d03b8aea0 | ||
|
178aed9174 | ||
|
6552deca61 | ||
|
89009c09be | ||
|
34672c7bed | ||
|
3caeb4642a | ||
|
80b0eacfed | ||
|
aa078e86e5 | ||
|
9daf0a6089 | ||
|
6dead5e7e1 | ||
|
335868ea95 | ||
|
fc45646205 | ||
|
dbd466d3ed | ||
|
292d8c9530 | ||
|
6b68598d1d | ||
|
0d9e248dac | ||
|
46a86fe6a5 | ||
|
a56ca4ddfc | ||
|
6483c55749 | ||
|
5a56a3e060 | ||
|
585f32c4d8 | ||
|
9ea311526c | ||
|
1342fdb9a7 | ||
|
2cc4fccd66 | ||
|
a2d0899285 | ||
|
06cc52744d | ||
|
df758aa3f8 | ||
|
f79ed86b57 | ||
|
c9b0c92450 | ||
|
57d1c29d35 | ||
|
cdf7c11b29 | ||
|
be7b5babe9 | ||
|
f7f2c51d4e | ||
|
4889ed6a33 | ||
|
3557686681 | ||
|
58dfc54e00 | ||
|
bddbc7a194 | ||
|
33e0116e4b | ||
|
b07f498516 | ||
|
c77be81e5b | ||
|
11cf2c78d8 | ||
|
77bcc7c7aa | ||
|
5b97802104 | ||
|
25ec5cb432 | ||
|
8b4b4a8f0c | ||
|
6448cebec6 | ||
|
191ee259d4 | ||
|
dc364726c0 | ||
|
6ac0f68224 | ||
|
3c3078f9f8 | ||
|
b994befc58 | ||
|
56cf0239da | ||
|
69d75362b3 | ||
|
8db9c79e57 | ||
|
e9ee617d94 | ||
|
c9c6534af5 | ||
|
1b9767995b | ||
|
1c561ba7a9 | ||
|
52baebc899 | ||
|
63c029554a | ||
|
3900dd27d2 | ||
|
e9fb17dadb | ||
|
56c2f86381 | ||
|
a8440c72e4 | ||
|
cbb5bac075 | ||
|
b7f1f56f77 | ||
|
9fe17cf6f5 | ||
|
d641f06e6d | ||
|
7668f04c0c | ||
|
a73d1cd342 | ||
|
35c4a29cbe | ||
|
f6e00fbb86 | ||
|
3f9503364c | ||
|
36b2a585f9 | ||
|
42220a8c95 | ||
|
1ac4efa88a | ||
|
cfe42d10ea | ||
|
6ad9e820e3 | ||
|
47a403a9c8 | ||
|
b2fc0935a4 | ||
|
a04d384ac4 | ||
|
325bb0bf8f | ||
|
c2a79d4cbf | ||
|
b17b8356ad | ||
|
a41b174851 | ||
|
458d32ed7c | ||
|
a0383b6664 | ||
|
9b1fc4cd24 | ||
|
2a27ef88f6 | ||
|
d1ecf6d748 | ||
|
396b5cd6e0 | ||
|
55e7d6383b | ||
|
dbcbffb6c4 | ||
|
6b51872c3e | ||
|
79d8b081d7 | ||
|
165276912f | ||
|
413052bf8e | ||
|
46fd72920c | ||
|
399b835436 | ||
|
9f76cdf486 | ||
|
881bf5dd9d | ||
|
8bb9661960 | ||
|
a1c69b0b43 | ||
|
5083849514 | ||
|
8d75ba4d64 | ||
|
b54b7f6455 | ||
|
488eb387cb | ||
|
99143f6148 | ||
|
1d4320afea | ||
|
d9c3162146 | ||
|
4a1b021753 | ||
|
3418d5295b | ||
|
bf30dc37a2 | ||
|
6ed4902e00 | ||
|
e3f6e61900 | ||
|
c9b1daeba7 | ||
|
52531e9125 | ||
|
72b6252ab5 | ||
|
95f3ead710 | ||
|
07a9486e4d | ||
|
7efceebb1c | ||
|
47529ee4d8 | ||
|
6fdc49b6e5 | ||
|
78ad724bac | ||
|
fad6768955 | ||
|
03384c4e19 | ||
|
63e59e7e27 | ||
|
b768e84afe | ||
|
8fdddb501f | ||
|
f6d00be6c1 | ||
|
783893f750 | ||
|
ff9074421a | ||
|
5a719f39bd | ||
|
39a40ce372 | ||
|
fdb13a1f78 | ||
|
9f99108701 | ||
|
1e022bf627 | ||
|
354dad71d9 | ||
|
ea7dc6e057 | ||
|
c9ceb5f813 | ||
|
576c66133e | ||
|
0c704d2928 | ||
|
d611bad383 | ||
|
3c2139ebeb | ||
|
081102fee4 | ||
|
c68772c9b5 | ||
|
68c421e00e | ||
|
93722665af | ||
|
b8a38f7eda | ||
|
06374586e0 | ||
|
a7fd04e1f3 | ||
|
9661a38c10 | ||
|
47e9f27199 | ||
|
4e59f1dc12 | ||
|
68b146e560 | ||
|
b06d50be98 | ||
|
cc6a7fd5c5 | ||
|
0488aa10f8 | ||
|
7dcd6e8edc | ||
|
11c6d4cdca | ||
|
60b746c430 | ||
|
1f2cc33364 | ||
|
5d215b1326 | ||
|
46723bf9d3 | ||
|
36789637a2 | ||
|
6e669fe530 | ||
|
90c1a4ec51 | ||
|
3e7b2b72cf | ||
|
de5df30941 | ||
|
f5764906d6 | ||
|
f6dce6181e | ||
|
ba74c22663 | ||
|
14fd0424a1 | ||
|
4d7945291e | ||
|
2eabaa0195 | ||
|
7ffe53b745 | ||
|
ff9a033e1e | ||
|
ef41c80eb1 | ||
|
25a67447d3 | ||
|
9242a7c942 | ||
|
7cd51a6108 | ||
|
82a2ff900b | ||
|
d6a533527e | ||
|
758d65e018 | ||
|
1ccc368195 | ||
|
7abc185586 | ||
|
4bf4cdda7b | ||
|
5fcb7e637a | ||
|
ad9cf93f28 | ||
|
c0c43441c1 | ||
|
dc79dfe403 | ||
|
ef5af2c7d8 | ||
|
d4e82d8c94 | ||
|
4f3ae14dbf | ||
|
3655a2b537 | ||
|
014c6e7344 | ||
|
bea98a5e30 | ||
|
aff87e936a | ||
|
5f0200b151 | ||
|
f1fb4a2ed8 | ||
|
20d1c2a5cc | ||
|
9c8a9e0c52 | ||
|
b72863a1ff | ||
|
2c3bf472bc | ||
|
05c0f3e2d3 | ||
|
8abf965447 | ||
|
0460f6f776 | ||
|
2ea2b57d92 | ||
|
9fe40f0682 | ||
|
f81db381be | ||
|
9320d2f9c2 | ||
|
1639d617f7 | ||
|
4341256594 | ||
|
584c4446b5 | ||
|
424ac7a1d5 | ||
|
9bc38282e9 | ||
|
9011e4977e | ||
|
4c2c4b7c6d | ||
|
a6a362944a | ||
|
a059cc2e18 | ||
|
9a13d475a6 | ||
|
1a240911f5 | ||
|
a4f65cbcc2 | ||
|
073cbbaad5 | ||
|
4c8fa37d0e | ||
|
038daffab7 | ||
|
bd893995c3 | ||
|
9634d3230f | ||
|
01d6a22f92 | ||
|
b3c144b4bf | ||
|
3875f0b693 | ||
|
cf4d0fe465 | ||
|
06ac5cffb6 | ||
|
3987ce7690 | ||
|
c4c74d84dc | ||
|
79c283b181 | ||
|
2e25337cc1 | ||
|
e989bc1652 | ||
|
a8810e90c1 | ||
|
daca5fa107 | ||
|
d3fbbf778a | ||
|
44cbcd434e | ||
|
9e80ef8aca | ||
|
52cb7cebd9 | ||
|
54c203982f | ||
|
c3e8420b57 | ||
|
d59ffc55b1 | ||
|
f32de6bece | ||
|
4f4406ffb1 | ||
|
6064b2029e | ||
|
31fb398b37 | ||
|
3b8deef8c5 | ||
|
075a5a0f14 | ||
|
2a96048b7c | ||
|
ce13d7fed5 | ||
|
8ffbebb2b6 | ||
|
ce60d46fa6 | ||
|
93a31146b1 | ||
|
d22bccd9fb | ||
|
3430535774 | ||
|
3c3c1414fe | ||
|
64d220d9c5 | ||
|
41e908bb34 | ||
|
94b7ff59d5 | ||
|
0ea928ade7 | ||
|
d1db5441df | ||
|
45f7cd2938 | ||
|
41b3ebf4e4 | ||
|
330efc5833 | ||
|
6f4a26220d | ||
|
919644d07a | ||
|
30cabb304c | ||
|
b80230c962 | ||
|
e8563b119b | ||
|
83051cd554 | ||
|
cfce10fbec | ||
|
09087e2a8e | ||
|
3520a7d0d8 | ||
|
7b4d08a7f5 | ||
|
7e6b543a70 | ||
|
41c79b931f | ||
|
477202aa47 | ||
|
ff0d9a9837 | ||
|
2c83807efc | ||
|
3517726d92 | ||
|
a00ea52b0b | ||
|
e4b11807f2 | ||
|
7b521b0690 | ||
|
8f14777831 | ||
|
ef3246db9c | ||
|
7726302103 | ||
|
2b85536625 | ||
|
2bfa77c1ff | ||
|
9d4974b174 | ||
|
eaf9d806d1 | ||
|
152b07d816 | ||
|
441fa10add | ||
|
261149287c | ||
|
80320fcf4e | ||
|
de6c80f04d | ||
|
a4891bc64d | ||
|
13ecdb04ee | ||
|
633dddf281 | ||
|
8941036105 | ||
|
f46d0803be | ||
|
eec1e56dda | ||
|
324f8a9515 | ||
|
793babcd12 | ||
|
8fb15633d3 | ||
|
4b77b9525f | ||
|
eff08a7cbd | ||
|
6c8550bf64 | ||
|
29239e08d3 | ||
|
34677a9c85 | ||
|
66914824af | ||
|
08f6970303 | ||
|
4878784ebe | ||
|
7984d38628 | ||
|
b5ab183504 | ||
|
91f8ab27ee | ||
|
7c9fc46caa | ||
|
48d07a679b | ||
|
f4d1bc8dfb | ||
|
5c380b0b8c | ||
|
9787e3bc08 | ||
|
5e15808508 | ||
|
9a4d4cc409 | ||
|
fd936617d7 | ||
|
ef02bd8fae | ||
|
ffe30498cb | ||
|
2585467f0a | ||
|
68cf583e4b | ||
|
e2336b595d | ||
|
5911b51d05 | ||
|
9e23315972 | ||
|
e536157a4f | ||
|
c850fa3520 | ||
|
a8b655fef8 | ||
|
3ed443456a | ||
|
0a46febf36 | ||
|
956243e570 | ||
|
b86c0f5c5e | ||
|
7b96505d27 | ||
|
ba80899ee5 | ||
|
f9b18a9c26 | ||
|
ed306b00f0 | ||
|
f38f6b2eed | ||
|
5929adfa57 | ||
|
758bb74603 | ||
|
7d33ca1dec | ||
|
953a9d2f71 | ||
|
c90f0efad2 | ||
|
e4ad727a6f | ||
|
97e69f9dcc | ||
|
e5086f5b49 | ||
|
c5236b897e | ||
|
383ae37ce5 | ||
|
cd753265a1 | ||
|
9a0b3409d9 | ||
|
8d620363b7 | ||
|
1db24d9c01 | ||
|
ccd485290e | ||
|
9f0b412626 | ||
|
31945b9017 | ||
|
11a6f419aa | ||
|
5f8b56ff85 | ||
|
fc5bf30a79 | ||
|
8cff1f7b76 | ||
|
86860b6da3 | ||
|
1d3d7738ae | ||
|
f3f1c2d814 | ||
|
e63eef8faf | ||
|
cb3a4cf66b | ||
|
cf771ae94b | ||
|
1b09361c51 | ||
|
6172ef3df4 | ||
|
a0cda5cce6 | ||
|
445d6ca84c | ||
|
2be3ebd90b | ||
|
8a9c8278e2 | ||
|
7c66269ac1 | ||
|
30dcf3cebb | ||
|
f5d2251312 | ||
|
004ea967ad | ||
|
55ab72ee76 | ||
|
54b8def06a | ||
|
778f352c0f | ||
|
34fab0f210 | ||
|
ddfe32eec3 | ||
|
cf678ce89f | ||
|
4cbcbd2cda | ||
|
8cba2c4727 | ||
|
24d524f558 | ||
|
f060b6fd6b | ||
|
2a98857af1 | ||
|
147364de84 | ||
|
9b895034df | ||
|
ef575c4d6d | ||
|
31a67ecd42 | ||
|
5bc0a496ed | ||
|
38a7051bba | ||
|
b5167db7a3 | ||
|
b62dd8e96a | ||
|
f023bb2bc7 | ||
|
8a4e75e8fb | ||
|
7197040026 | ||
|
c9bf8eb349 | ||
|
0fba1504f0 | ||
|
1347736ead | ||
|
360748dd0b | ||
|
18a3f15101 | ||
|
eba1505e1d | ||
|
0f21cde318 | ||
|
1c1b6ea940 | ||
|
4f55c6aa9a | ||
|
83d48c99aa | ||
|
40248965be | ||
|
584fc8a1b6 | ||
|
3d0421b0a6 | ||
|
633ade23fc | ||
|
f6d377275b | ||
|
5053c3cc7a | ||
|
eb03e2c912 | ||
|
699a6583b2 | ||
|
a760577924 | ||
|
5e40409ed9 | ||
|
7eb361f514 | ||
|
3a500a6303 | ||
|
de48898d34 | ||
|
6b23a58678 | ||
|
d650ea45b5 | ||
|
3f139addc3 | ||
|
8488eac070 | ||
|
1a338aa602 | ||
|
118b074aa3 | ||
|
4f46ba3e61 | ||
|
2bba9ba000 | ||
|
4c2bb1dd28 | ||
|
8849577f82 | ||
|
cef3f3ef0d | ||
|
0dda262c18 | ||
|
eb7845092a | ||
|
24bf86fc37 | ||
|
ea7e641bdd | ||
|
0f3ba435d9 | ||
|
d199fe5ff0 | ||
|
c63e56712e | ||
|
a14b3cf49a | ||
|
14f75a0f8c | ||
|
52df44c40c | ||
|
0fb232216c | ||
|
0449557ab2 | ||
|
00e4faa690 | ||
|
9e354b4392 | ||
|
743bffc9a6 | ||
|
23d30e6197 | ||
|
302bdd4c6d | ||
|
3a53f96119 | ||
|
42f5ef4bc9 | ||
|
e7df308d2a | ||
|
c533778f3b | ||
|
8defaa6be5 | ||
|
fe97fbe977 | ||
|
96d8d8b2b2 | ||
|
115c618fc2 | ||
|
46793bbf99 | ||
|
ed11593b16 | ||
|
7cc4632761 | ||
|
362f8fc622 | ||
|
708668ea0a | ||
|
80e1946fa4 | ||
|
85d70f3408 | ||
|
b9537802e3 | ||
|
0c0a2ea55c | ||
|
ca14fbf0aa | ||
|
9f1ec0ce93 | ||
|
9a3cc63700 | ||
|
9aaadad95b | ||
|
3bf6682fce | ||
|
9f009f5979 | ||
|
cb072fcf2c | ||
|
5a94949b94 | ||
|
589202bde7 | ||
|
6dd12f1940 | ||
|
c5a50849ec | ||
|
6a68a1aa1d | ||
|
aaa2417e74 | ||
|
add5308bc3 | ||
|
b431c34d5f | ||
|
4ba59c07f9 | ||
|
681521e5a5 | ||
|
8731665257 | ||
|
e406fb90a9 | ||
|
5dabdd73a1 | ||
|
179d84c39b | ||
|
e5636a446e | ||
|
27c7b3fc17 | ||
|
7e35961874 | ||
|
c0688dfc1f | ||
|
f6078403e0 | ||
|
0569ee0f1a | ||
|
7badddb99c | ||
|
d0e0d53ee7 | ||
|
6e176c77a6 | ||
|
ba8cfc3e91 | ||
|
2f97ff63f3 | ||
|
641759c362 | ||
|
ae938cf04c | ||
|
8f13fcdda6 | ||
|
29bca56e56 | ||
|
297b230669 | ||
|
1c6c52056f | ||
|
25bb7bd547 | ||
|
8c175b88c5 | ||
|
85c7cb4186 | ||
|
09a7d790ad | ||
|
d49a43709d | ||
|
96fe10cc9f | ||
|
8626678d23 | ||
|
2a27cbde0d | ||
|
1f10444d5c | ||
|
1bb8ff97d4 | ||
|
518546b525 | ||
|
17e1003714 | ||
|
011ece182f | ||
|
8e742a06d9 | ||
|
3c024ab7ac | ||
|
f216a0fe82 | ||
|
f9b5bda925 |
3
.gitmodules
vendored
@@ -1,3 +0,0 @@
|
||||
[submodule "thirdparty/jreen"]
|
||||
path = thirdparty/jreen
|
||||
url = git://github.com/euroelessar/jreen.git
|
@@ -15,15 +15,18 @@ SET( TOMAHAWK_APPLICATION_NAME "Tomahawk" )
|
||||
SET( TOMAHAWK_DESCRIPTION_SUMMARY "The social media player" )
|
||||
|
||||
SET( TOMAHAWK_VERSION_MAJOR 0 )
|
||||
SET( TOMAHAWK_VERSION_MINOR 3 )
|
||||
SET( TOMAHAWK_VERSION_PATCH 0 )
|
||||
SET( TOMAHAWK_VERSION_MINOR 4 )
|
||||
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
|
||||
|
||||
@@ -54,6 +57,9 @@ 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 )
|
||||
|
||||
@@ -68,7 +74,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" )
|
||||
LIST(APPEND NEEDED_QT4_COMPONENTS "QtGui" "QtWebkit" "QtUiTools" )
|
||||
ENDIF()
|
||||
|
||||
IF( BUILD_GUI AND UNIX AND NOT APPLE )
|
||||
@@ -76,7 +82,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 \n the qtwebkit-devel package is installed as well")
|
||||
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_optional_find_package(Phonon 4.5.0)
|
||||
macro_log_feature(PHONON_FOUND "Phonon" "The Phonon multimedia library" "http://phonon.kde.org" TRUE "" "")
|
||||
@@ -108,7 +114,14 @@ macro_optional_find_package(LibAttica)
|
||||
macro_log_feature(LIBATTICA_FOUND "libattica" "Provides support for automatic fetching and managing of resolvers from the tomahawk website" "https://projects.kde.org/projects/kdesupport/attica" FALSE "" "")
|
||||
|
||||
macro_optional_find_package(QuaZip)
|
||||
macro_log_feature(QuaZip_FOUND "QuaZip" "Provides support for extracting downloaded resolvers autmatically. Will build internal copy instead." "http://quazip.sourceforge.net/" FALSE "" "")
|
||||
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 )
|
||||
@@ -116,6 +129,7 @@ IF( NOT QuaZip_FOUND )
|
||||
SET( QuaZip_LIBRARY quazip )
|
||||
SET( QuaZip_LIBRARIES ${QuaZip_LIBRARY} )
|
||||
SET( QuaZip_FOUND true )
|
||||
macro_log_feature(QuaZip_FOUND "QuaZip" "Provides support for extracting downloaded resolvers automatically. Building internal copy" "http://quazip.sourceforge.net/" FALSE "" "")
|
||||
|
||||
# copy headers to build/quazip so we can use proper includes inside the code
|
||||
FILE( COPY ${CMAKE_SOURCE_DIR}/src/libtomahawk/thirdparty/quazip/quazip/ DESTINATION ${CMAKE_BINARY_DIR}/libtomahawk/thirdparty/quazip )
|
||||
@@ -128,29 +142,17 @@ 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( 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")
|
||||
# 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()
|
||||
|
||||
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
|
||||
@@ -211,4 +213,9 @@ ADD_SUBDIRECTORY( src/libtomahawk )
|
||||
SET( TOMAHAWK_LIBRARIES tomahawklib )
|
||||
ADD_SUBDIRECTORY( src )
|
||||
ADD_SUBDIRECTORY( admin )
|
||||
ADD_SUBDIRECTORY( src/breakpad/CrashReporter )
|
||||
|
||||
IF( BUILD_GUI )
|
||||
IF( NOT DISABLE_CRASHREPORTER )
|
||||
ADD_SUBDIRECTORY( src/breakpad/CrashReporter )
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
@@ -2,6 +2,7 @@
|
||||
# This module looks for clucene (http://clucene.sf.net) support
|
||||
# It will define the following values
|
||||
#
|
||||
# CLUCENE_INCLUDE_DIRS = CLUCENE_INCLUDE_DIR + CLUCENE_LIBRARY_DIR
|
||||
# CLUCENE_INCLUDE_DIR = where CLucene/StdHeader.h can be found
|
||||
# CLUCENE_LIBRARY_DIR = where CLucene/clucene-config.h can be found
|
||||
# CLUCENE_LIBRARIES = the libraries to link against CLucene
|
||||
@@ -17,6 +18,7 @@ FIND_PACKAGE(CLuceneUnstable)
|
||||
IF(CLUCENEUNSTABLE_FOUND)
|
||||
SET(CLucene_FOUND TRUE)
|
||||
SET(CLUCENE_INCLUDE_DIR ${CLUCENE_UNSTABLE_INCLUDE_DIRS})
|
||||
SET(CLUCENE_INCLUDE_DIRS ${CLUCENE_INCLUDE_DIR})
|
||||
SET(CLUCENE_LIBRARIES ${CLUCENE_UNSTABLE_LIBS})
|
||||
|
||||
#MESSAGE(FATAL_ERROR NARF)
|
||||
@@ -106,7 +108,9 @@ ENDIF (CLUCENE_LIBRARY_DIR)
|
||||
|
||||
IF(CLUCENE_INCLUDE_DIR AND CLUCENE_LIBRARIES AND CLUCENE_LIBRARY_DIR AND CLUCENE_GOOD_VERSION)
|
||||
SET(CLucene_FOUND TRUE)
|
||||
SET(CLUCENE_INCLUDE_DIRS ${CLUCENE_LIBRARY_DIR} ${CLUCENE_INCLUDE_DIR})
|
||||
ENDIF(CLUCENE_INCLUDE_DIR AND CLUCENE_LIBRARIES AND CLUCENE_LIBRARY_DIR AND CLUCENE_GOOD_VERSION)
|
||||
|
||||
ENDIF(CLUCENEUNSTABLE_FOUND)
|
||||
|
||||
IF(CLucene_FOUND)
|
||||
@@ -120,7 +124,8 @@ ELSE(CLucene_FOUND)
|
||||
ENDIF(CLucene_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
CLUCENE_INCLUDE_DIR
|
||||
CLUCENE_LIBRARY_DIR
|
||||
CLUCENE_INCLUDE_DIRS
|
||||
CLUCENE_INCLUDE_DIR
|
||||
CLUCENE_LIBRARY_DIR
|
||||
CLUCENE_LIBRARIES
|
||||
)
|
||||
|
@@ -56,7 +56,7 @@ ELSE()
|
||||
include(FindLibraryWithDebug)
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_path(TAGLIB_CFLAGS
|
||||
find_path(TAGLIB_INCLUDES
|
||||
NAMES
|
||||
tag.h
|
||||
PATH_SUFFIXES taglib
|
||||
|
182
CMakeModules/GNUInstallDirs.cmake
Normal file
@@ -0,0 +1,182 @@
|
||||
# - Define GNU standard installation directories
|
||||
# Provides install directory variables as defined for GNU software:
|
||||
# http://www.gnu.org/prep/standards/html_node/Directory-Variables.html
|
||||
# Inclusion of this module defines the following variables:
|
||||
# CMAKE_INSTALL_<dir> - destination for files of a given type
|
||||
# CMAKE_INSTALL_FULL_<dir> - corresponding absolute path
|
||||
# where <dir> is one of:
|
||||
# BINDIR - user executables (bin)
|
||||
# SBINDIR - system admin executables (sbin)
|
||||
# LIBEXECDIR - program executables (libexec)
|
||||
# SYSCONFDIR - read-only single-machine data (etc)
|
||||
# SHAREDSTATEDIR - modifiable architecture-independent data (com)
|
||||
# LOCALSTATEDIR - modifiable single-machine data (var)
|
||||
# LIBDIR - object code libraries (lib or lib64)
|
||||
# INCLUDEDIR - C header files (include)
|
||||
# OLDINCLUDEDIR - C header files for non-gcc (/usr/include)
|
||||
# DATAROOTDIR - read-only architecture-independent data root (share)
|
||||
# DATADIR - read-only architecture-independent data (DATAROOTDIR)
|
||||
# INFODIR - info documentation (DATAROOTDIR/info)
|
||||
# LOCALEDIR - locale-dependent data (DATAROOTDIR/locale)
|
||||
# MANDIR - man documentation (DATAROOTDIR/man)
|
||||
# DOCDIR - documentation root (DATAROOTDIR/doc/PROJECT_NAME)
|
||||
# Each CMAKE_INSTALL_<dir> value may be passed to the DESTINATION options of
|
||||
# install() commands for the corresponding file type. If the includer does
|
||||
# not define a value the above-shown default will be used and the value will
|
||||
# appear in the cache for editing by the user.
|
||||
# Each CMAKE_INSTALL_FULL_<dir> value contains an absolute path constructed
|
||||
# from the corresponding destination by prepending (if necessary) the value
|
||||
# of CMAKE_INSTALL_PREFIX.
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2011 Nikita Krupen'ko <krnekit@gmail.com>
|
||||
# Copyright 2011 Kitware, Inc.
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# (To distribute this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
# Installation directories
|
||||
#
|
||||
if(NOT DEFINED CMAKE_INSTALL_BINDIR)
|
||||
set(CMAKE_INSTALL_BINDIR "bin" CACHE PATH "user executables (bin)")
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED CMAKE_INSTALL_SBINDIR)
|
||||
set(CMAKE_INSTALL_SBINDIR "sbin" CACHE PATH "system admin executables (sbin)")
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED CMAKE_INSTALL_LIBEXECDIR)
|
||||
set(CMAKE_INSTALL_LIBEXECDIR "libexec" CACHE PATH "program executables (libexec)")
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED CMAKE_INSTALL_SYSCONFDIR)
|
||||
set(CMAKE_INSTALL_SYSCONFDIR "etc" CACHE PATH "read-only single-machine data (etc)")
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED CMAKE_INSTALL_SHAREDSTATEDIR)
|
||||
set(CMAKE_INSTALL_SHAREDSTATEDIR "com" CACHE PATH "modifiable architecture-independent data (com)")
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED CMAKE_INSTALL_LOCALSTATEDIR)
|
||||
set(CMAKE_INSTALL_LOCALSTATEDIR "var" CACHE PATH "modifiable single-machine data (var)")
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
|
||||
set(_LIBDIR_DEFAULT "lib")
|
||||
# Override this default 'lib' with 'lib64' iff:
|
||||
# - we are on Linux system but NOT cross-compiling
|
||||
# - we are NOT on debian
|
||||
# - we are on a 64 bits system
|
||||
# reason is: amd64 ABI: http://www.x86-64.org/documentation/abi.pdf
|
||||
# Note that the future of multi-arch handling may be even
|
||||
# more complicated than that: http://wiki.debian.org/Multiarch
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "Linux"
|
||||
AND NOT CMAKE_CROSSCOMPILING
|
||||
AND NOT EXISTS "/etc/debian_version")
|
||||
if(NOT DEFINED CMAKE_SIZEOF_VOID_P)
|
||||
message(AUTHOR_WARNING
|
||||
"Unable to determine default CMAKE_INSTALL_LIBDIR directory because no target architecture is known. "
|
||||
"Please enable at least one language before including GNUInstallDirs.")
|
||||
else()
|
||||
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
|
||||
set(_LIBDIR_DEFAULT "lib64")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
set(CMAKE_INSTALL_LIBDIR "${_LIBDIR_DEFAULT}" CACHE PATH "object code libraries (${_LIBDIR_DEFAULT})")
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED CMAKE_INSTALL_INCLUDEDIR)
|
||||
set(CMAKE_INSTALL_INCLUDEDIR "include" CACHE PATH "C header files (include)")
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED CMAKE_INSTALL_OLDINCLUDEDIR)
|
||||
set(CMAKE_INSTALL_OLDINCLUDEDIR "/usr/include" CACHE PATH "C header files for non-gcc (/usr/include)")
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED CMAKE_INSTALL_DATAROOTDIR)
|
||||
set(CMAKE_INSTALL_DATAROOTDIR "share" CACHE PATH "read-only architecture-independent data root (share)")
|
||||
endif()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Values whose defaults are relative to DATAROOTDIR. Store empty values in
|
||||
# the cache and store the defaults in local variables if the cache values are
|
||||
# not set explicitly. This auto-updates the defaults as DATAROOTDIR changes.
|
||||
|
||||
if(NOT CMAKE_INSTALL_DATADIR)
|
||||
set(CMAKE_INSTALL_DATADIR "" CACHE PATH "read-only architecture-independent data (DATAROOTDIR)")
|
||||
set(CMAKE_INSTALL_DATADIR "${CMAKE_INSTALL_DATAROOTDIR}")
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_INSTALL_INFODIR)
|
||||
set(CMAKE_INSTALL_INFODIR "" CACHE PATH "info documentation (DATAROOTDIR/info)")
|
||||
set(CMAKE_INSTALL_INFODIR "${CMAKE_INSTALL_DATAROOTDIR}/info")
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_INSTALL_LOCALEDIR)
|
||||
set(CMAKE_INSTALL_LOCALEDIR "" CACHE PATH "locale-dependent data (DATAROOTDIR/locale)")
|
||||
set(CMAKE_INSTALL_LOCALEDIR "${CMAKE_INSTALL_DATAROOTDIR}/locale")
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_INSTALL_MANDIR)
|
||||
set(CMAKE_INSTALL_MANDIR "" CACHE PATH "man documentation (DATAROOTDIR/man)")
|
||||
set(CMAKE_INSTALL_MANDIR "${CMAKE_INSTALL_DATAROOTDIR}/man")
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_INSTALL_DOCDIR)
|
||||
set(CMAKE_INSTALL_DOCDIR "" CACHE PATH "documentation root (DATAROOTDIR/doc/PROJECT_NAME)")
|
||||
set(CMAKE_INSTALL_DOCDIR "${CMAKE_INSTALL_DATAROOTDIR}/doc/${PROJECT_NAME}")
|
||||
endif()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
mark_as_advanced(
|
||||
CMAKE_INSTALL_BINDIR
|
||||
CMAKE_INSTALL_SBINDIR
|
||||
CMAKE_INSTALL_LIBEXECDIR
|
||||
CMAKE_INSTALL_SYSCONFDIR
|
||||
CMAKE_INSTALL_SHAREDSTATEDIR
|
||||
CMAKE_INSTALL_LOCALSTATEDIR
|
||||
CMAKE_INSTALL_LIBDIR
|
||||
CMAKE_INSTALL_INCLUDEDIR
|
||||
CMAKE_INSTALL_OLDINCLUDEDIR
|
||||
CMAKE_INSTALL_DATAROOTDIR
|
||||
CMAKE_INSTALL_DATADIR
|
||||
CMAKE_INSTALL_INFODIR
|
||||
CMAKE_INSTALL_LOCALEDIR
|
||||
CMAKE_INSTALL_MANDIR
|
||||
CMAKE_INSTALL_DOCDIR
|
||||
)
|
||||
|
||||
# Result directories
|
||||
#
|
||||
foreach(dir
|
||||
BINDIR
|
||||
SBINDIR
|
||||
LIBEXECDIR
|
||||
SYSCONFDIR
|
||||
SHAREDSTATEDIR
|
||||
LOCALSTATEDIR
|
||||
LIBDIR
|
||||
INCLUDEDIR
|
||||
OLDINCLUDEDIR
|
||||
DATAROOTDIR
|
||||
DATADIR
|
||||
INFODIR
|
||||
LOCALEDIR
|
||||
MANDIR
|
||||
DOCDIR
|
||||
)
|
||||
if(NOT IS_ABSOLUTE ${CMAKE_INSTALL_${dir}})
|
||||
set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_${dir}}")
|
||||
else()
|
||||
set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_${dir}}")
|
||||
endif()
|
||||
endforeach()
|
@@ -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\prefix" ; SIC! ^
|
||||
!define VLC_BIN "${VLC_PATH}\bin"
|
||||
!define VLC_PATH "${SOURCE_PATH}\admin\win\vlc\" ; SIC! ^
|
||||
!define VLC_BIN "${VLC_PATH}"
|
||||
!define VLC_PLUGIN_PATH "${VLC_BIN}\plugins"
|
||||
|
||||
!define NSI_PATH "${SOURCE_PATH}/admin/win/nsi"
|
||||
@@ -273,13 +273,12 @@ Section "Tomahawk Player" SEC_TOMAHAWK_PLAYER
|
||||
;Main executable.
|
||||
File "${INSTALL_PATH}\bin\tomahawk.exe"
|
||||
|
||||
File "${INSTALL_PATH}\bin\CrashReporter.exe"
|
||||
File "${INSTALL_PATH}\bin\tomahawk_crash_reporter.exe"
|
||||
File "${INSTALL_PATH}\bin\libtomahawk_breakpad.dll"
|
||||
|
||||
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
|
||||
@@ -287,14 +286,13 @@ Section "Tomahawk Player" SEC_TOMAHAWK_PLAYER
|
||||
;Main executable.
|
||||
File "${BUILD_PATH}\tomahawk.exe"
|
||||
|
||||
File "${BUILD_PATH}\CrashReporter.exe"
|
||||
File "${BUILD_PATH}\tomahawk_crash_reporter.exe"
|
||||
File "${BUILD_PATH}\libtomahawk_breakpad.dll"
|
||||
|
||||
File "${BUILD_PATH}\libtomahawklib.dll"
|
||||
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
|
||||
|
||||
@@ -307,8 +305,10 @@ 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}\QtXml4.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"
|
||||
|
||||
;SQLite driver
|
||||
SetOutPath "$INSTDIR\sqldrivers"
|
||||
@@ -329,30 +329,17 @@ Section "Tomahawk Player" SEC_TOMAHAWK_PLAYER
|
||||
File "${MING_BIN}\libstdc++-6.dll"
|
||||
|
||||
;Phonon stuff
|
||||
|
||||
;Fix the phonon build to not use Dbus
|
||||
File "${QT_DLL_PATH}\QtDbus4.dll"
|
||||
File "${MING_BIN}\libdbus-1-3.dll"
|
||||
File "${MING_BIN}\dbus-daemon.exe"
|
||||
|
||||
File "${VLC_BIN}\libphonon.dll"
|
||||
File "${MING_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"
|
||||
@@ -363,6 +350,7 @@ 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"
|
||||
@@ -467,7 +455,8 @@ 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:Tomahawk Protocol"
|
||||
WriteRegStr HKCR "tomahawk" "URL Protocol" ""
|
||||
WriteRegStr HKCR "tomahawk\DefaultIcon" "" $INSTDIR\tomahawk.exe,1
|
||||
WriteRegStr HKCR "tomahawk\shell" "" "open"
|
||||
WriteRegStr HKCR "tomahawk\shell\open\command" "" '"$INSTDIR\tomahawk.exe" "%1"'
|
||||
|
108
ChangeLog
@@ -1,3 +1,109 @@
|
||||
Version 0.4.2:
|
||||
* Fix ZeroConf protocol showing IP addresses instead of host names.
|
||||
Sometimes. Full fix coming later.
|
||||
* 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.
|
||||
* Fixed not updating collections and views after a collection changes.
|
||||
* Fixed not showing a source's proper name at all times.
|
||||
* Improved music scanner reliability.
|
||||
* Fixed various labels not being painted in the right color when selected.
|
||||
* Support .oga (ogg mimetype) files.
|
||||
* Fixed stuck Now Playing indicator icon.
|
||||
* Fixed sidebar width of settings dialog on Windows.
|
||||
* Fixed not always showing delete icon on hovered temporary pages.
|
||||
* Fixed inability to select externally mounted drives.
|
||||
* Fixed bug where speaker would be stuck next to a playlist.
|
||||
* Fixed bug where first startup would show a loading spinner in the
|
||||
Dashboard's "Recent Additions" forever.
|
||||
* Automatically upgrade resolvers when an update is found.
|
||||
* Fixed last played track of a friend never expiring.
|
||||
* Fixed parsing of rdio tracks.
|
||||
* Changed steering mechanism in stations to be user-friendlier.
|
||||
* Fixed loading biographies of artist names with special characters.
|
||||
* Fixed behaviour of dropping Spotify playlists on the sidebar.
|
||||
* Fixed hard to read source-name in the audio control area on OS X.
|
||||
* Fixed crashes when playing Grooveshark tracks.
|
||||
* Fixed bug where clicking the latch button would flicker and unlatch.
|
||||
* Fixed Jabber accounts not connecting properly when proxy is in use.
|
||||
|
||||
Version 0.3.1:
|
||||
* Fixed not resolving to local files.
|
||||
* Fixed shutdown crash on Windows.
|
||||
* Support more widget types in Javascript resolver configs.
|
||||
* Fixed bug where red headphone would be visible on My Collection
|
||||
when listened along to source went offline.
|
||||
* Draw author name as well as avatar in recently played playlists.
|
||||
* Fixed Tomahawk integration in Unity.
|
||||
* Fixed incorrect item selected in source tree when deleting temporary
|
||||
pages.
|
||||
* Fixed currently played label disappearing after 10 minutes regardless
|
||||
of length of track.
|
||||
* Fixed crash on Sparkle upgrade on OS X.
|
||||
|
||||
Version 0.3.0:
|
||||
* Make artist names in the album view clickable.
|
||||
* Don't start playing if a tomahawk:// link was clicked while Tomahawk
|
||||
@@ -28,7 +134,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
@@ -39,13 +39,13 @@ Dependencies
|
||||
The following dependencies are optional, but recommended:
|
||||
|
||||
Attica 0.2.0 - ftp://ftp.kde.org/pub/kde/stable/attica/
|
||||
jreen (Git) - https://github.com/euroelessar/jreen
|
||||
QTweetLib 0.3.0 - https://github.com/minimoog/QTweetLib
|
||||
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
|
||||
|
||||
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!
|
||||
|
@@ -491,7 +491,7 @@ def FindVLCPlugin(name):
|
||||
FixBinary(binary)
|
||||
|
||||
for plugin in VLC_PLUGINS:
|
||||
FixVLCPlugin(FindVLCPlugin(plugin), '.')
|
||||
FixVLCPlugin(FindVLCPlugin(plugin), '../Frameworks/vlc/plugins')
|
||||
|
||||
for plugin in TOMAHAWK_PLUGINS:
|
||||
FixPlugin(plugin, '../MacOS')
|
||||
@@ -502,9 +502,9 @@ except:
|
||||
print 'Failed to find spotify resolver'
|
||||
|
||||
try:
|
||||
FixPlugin('CrashReporter', '../MacOS')
|
||||
FixPlugin('tomahawk_crash_reporter', '../MacOS')
|
||||
except:
|
||||
print 'Failed to find CrashReporter'
|
||||
print 'Failed to find tomahawk_crash_reporter'
|
||||
|
||||
for plugin in QT_PLUGINS:
|
||||
FixPlugin(FindQtPlugin(plugin), os.path.dirname(plugin))
|
||||
|
@@ -4,8 +4,9 @@ Version=1.0
|
||||
Name=Tomahawk
|
||||
GenericName=Music Player
|
||||
TryExec=tomahawk
|
||||
Exec=tomahawk
|
||||
Exec=tomahawk %u
|
||||
Comment=Tomahawk - Social Music Player
|
||||
Icon=tomahawk
|
||||
Terminal=false
|
||||
Categories=Qt;AudioVideo;Audio;Player;
|
||||
MimeType=x-scheme-handler/tomahawk;
|
||||
|
@@ -3,9 +3,12 @@ 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
|
||||
@@ -15,13 +18,6 @@ SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
|
||||
|
||||
|
||||
# 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)
|
||||
|
||||
# configure qt variables
|
||||
SET(QT_LIBRARY_DIR /usr/${MINGW_PREFIX}/bin)
|
||||
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})
|
@@ -1,42 +1,52 @@
|
||||
#!/bin/bash
|
||||
echo "Remove old vlc dir..."
|
||||
|
||||
mkdir -p vlc/
|
||||
cd vlc/
|
||||
if [ "$1" = "-c" ] ; then
|
||||
echo "Continuing last download.."
|
||||
rm -rvf vlc/
|
||||
else
|
||||
echo "Update archive..."
|
||||
fi
|
||||
|
||||
#rm -vf vlc-*.7z
|
||||
#rm -rf vlc/
|
||||
rm -rvf vlc/
|
||||
|
||||
echo "Download specified binary..."
|
||||
#wget -c "http://downloads.sourceforge.net/project/vlc/1.1.9/win32/vlc-1.1.9-win32.7z?r=http%3A%2F%2Fwww.videolan.org%2Fvlc%2Fdownload-windows.html&ts=1306272584&use_mirror=leaseweb"
|
||||
#wget -c "http://download.tomahawk-player.org/tomahawk-vlc-0.1.zip"
|
||||
wget -c http://people.videolan.org/~jb/phonon/phonon-vlc-last.7z
|
||||
|
||||
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 "Extract binary..."
|
||||
7z x phonon-vlc-last.7z
|
||||
#mv -v vlc-*/ vlc/
|
||||
#unzip tomahawk-vlc-0.1.zip
|
||||
# 7z x phonon*.7z
|
||||
# mv -v vlc-*/ vlc/
|
||||
# unzip tomahawk-vlc-0.1.zip
|
||||
tar xvjf pvlc.tar.bz2
|
||||
|
||||
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 "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
|
||||
|
||||
|
||||
# this is for vlc-1.2
|
||||
|
BIN
data/images/apply-check.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
data/images/closed-padlock.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
data/images/grooveshark.png
Normal file
After Width: | Height: | Size: 69 KiB |
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 7.1 KiB |
Before Width: | Height: | Size: 91 KiB After Width: | Height: | Size: 12 KiB |
BIN
data/images/open-padlock.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
data/images/process-stop.png
Normal file
After Width: | Height: | Size: 5.1 KiB |
@@ -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()
|
||||
{
|
||||
|
@@ -1,4 +1,4 @@
|
||||
-- Script to migate from db version 6 to 27
|
||||
-- Script to migate from db version 26 to 27
|
||||
-- Nothing to do
|
||||
|
||||
CREATE TABLE IF NOT EXISTS collection_attributes (
|
||||
|
7
data/sql/dbmigrate-27_to_28.sql
Normal file
@@ -0,0 +1,7 @@
|
||||
-- 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';
|
3541
lang/tomahawk_bg.ts
Normal file
3344
lang/tomahawk_de.ts
3541
lang/tomahawk_en.ts
Normal file
3532
lang/tomahawk_es.ts
Normal file
@@ -1,5 +1,11 @@
|
||||
<!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>
|
||||
|
3530
lang/tomahawk_pl.ts
Normal file
3530
lang/tomahawk_pt_BR.ts
Normal file
3515
lang/tomahawk_sv.ts
Normal file
@@ -98,6 +98,7 @@
|
||||
<file>data/images/track-icon-22x22.png</file>
|
||||
<file>data/images/track-icon-32x32.png</file>
|
||||
<file>data/images/track-icon-16x16.png</file>
|
||||
<file>data/images/apply-check.png</file>
|
||||
<file>data/stylesheets/topbar-radiobuttons.css</file>
|
||||
<file>data/icons/tomahawk-icon-16x16.png</file>
|
||||
<file>data/icons/tomahawk-icon-32x32.png</file>
|
||||
@@ -127,8 +128,13 @@
|
||||
<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>
|
||||
|
@@ -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 share/icons/hicolor/${_res}/apps )
|
||||
INSTALL( FILES ${_file} RENAME tomahawk.png DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/${_res}/apps )
|
||||
ENDFOREACH( _file )
|
||||
|
||||
INSTALL( FILES ${CMAKE_SOURCE_DIR}/data/icons/tomahawk-icon.svg RENAME tomahawk.svg DESTINATION share/icons/hicolor/scalable/apps )
|
||||
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}/admin/unix/tomahawk.desktop DESTINATION share/applications )
|
||||
INSTALL( FILES ${CMAKE_SOURCE_DIR}/admin/unix/tomahawk.desktop DESTINATION ${CMAKE_INSTALL_DATADIR}/applications )
|
@@ -58,4 +58,7 @@ 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)
|
@@ -13,6 +13,8 @@ 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 )
|
||||
|
||||
@@ -40,6 +42,7 @@ SET( tomahawkSources ${tomahawkSources}
|
||||
musicscanner.cpp
|
||||
shortcuthandler.cpp
|
||||
scanmanager.cpp
|
||||
ubuntuunityhack.cpp
|
||||
tomahawkapp.cpp
|
||||
main.cpp
|
||||
)
|
||||
@@ -57,11 +60,13 @@ SET( tomahawkSourcesGui ${tomahawkSourcesGui}
|
||||
sourcetree/sourcedelegate.cpp
|
||||
sourcetree/animationhelper.cpp
|
||||
sourcetree/items/sourcetreeitem.cpp
|
||||
sourcetree/items/collectionitem.cpp
|
||||
sourcetree/items/sourceitem.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
|
||||
|
||||
@@ -85,6 +90,7 @@ SET( tomahawkHeaders ${tomahawkHeaders}
|
||||
|
||||
musicscanner.h
|
||||
scanmanager.h
|
||||
ubuntuunityhack.h
|
||||
shortcuthandler.h
|
||||
)
|
||||
|
||||
@@ -95,8 +101,8 @@ IF(LIBLASTFM_FOUND)
|
||||
ENDIF(LIBLASTFM_FOUND)
|
||||
|
||||
IF(LIBATTICA_FOUND)
|
||||
SET( tomahawkSources ${tomahawkSources} GetNewStuffDialog.cpp GetNewStuffDelegate.cpp GetNewStuffModel.cpp )
|
||||
SET( tomahawkHeaders ${tomahawkHeaders} GetNewStuffDialog.h GetNewStuffDelegate.h GetNewStuffModel.h )
|
||||
SET( tomahawkSourcesGui ${tomahawkSourcesGui} GetNewStuffDialog.cpp GetNewStuffDelegate.cpp GetNewStuffModel.cpp )
|
||||
SET( tomahawkHeadersGui ${tomahawkHeadersGui} GetNewStuffDialog.h GetNewStuffDelegate.h GetNewStuffModel.h )
|
||||
INCLUDE_DIRECTORIES( ${LIBATTICA_INCLUDE_DIR} )
|
||||
ENDIF(LIBATTICA_FOUND)
|
||||
|
||||
@@ -108,11 +114,13 @@ SET( tomahawkHeadersGui ${tomahawkHeadersGui}
|
||||
sourcetree/sourcedelegate.h
|
||||
sourcetree/animationhelper.h
|
||||
sourcetree/items/sourcetreeitem.h
|
||||
sourcetree/items/collectionitem.h
|
||||
sourcetree/items/sourceitem.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
|
||||
@@ -170,10 +178,10 @@ INCLUDE_DIRECTORIES(
|
||||
SET( OS_SPECIFIC_LINK_LIBRARIES "" )
|
||||
|
||||
IF( WIN32 )
|
||||
INCLUDE( "CMakeLists.win32.txt" )
|
||||
INCLUDE( "CMakeLists.win32.cmake" )
|
||||
ENDIF( WIN32 )
|
||||
IF( UNIX )
|
||||
INCLUDE( "CMakeLists.unix.txt" )
|
||||
INCLUDE( "CMakeLists.unix.cmake" )
|
||||
ENDIF( UNIX )
|
||||
|
||||
IF( APPLE )
|
||||
@@ -198,10 +206,7 @@ IF(QCA2_FOUND)
|
||||
INCLUDE_DIRECTORIES( ${QCA2_INCLUDE_DIR} )
|
||||
ENDIF(QCA2_FOUND)
|
||||
|
||||
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} )
|
||||
|
||||
INCLUDE(GNUInstallDirs)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/config.h)
|
||||
|
||||
@@ -209,13 +214,17 @@ include( ${CMAKE_SOURCE_DIR}/lang/translations.cmake )
|
||||
|
||||
SET( final_src ${final_src} ${tomahawkMoc} ${tomahawkSources} ${tomahawkHeaders} ${trans_outfile})
|
||||
|
||||
IF( "${gui}" STREQUAL "no" )
|
||||
ELSE()
|
||||
IF( BUILD_GUI )
|
||||
LIST(APPEND tomahawkHeaders ${tomahawkHeadersGui})
|
||||
LIST(APPEND tomahawkSources ${tomahawkSourcesGui})
|
||||
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 )
|
||||
@@ -263,12 +272,12 @@ IF( APPLE )
|
||||
ENDIF(HAVE_SPARKLE)
|
||||
ENDIF( APPLE )
|
||||
|
||||
INSTALL( TARGETS tomahawk BUNDLE DESTINATION . RUNTIME DESTINATION bin )
|
||||
INSTALL( TARGETS tomahawk BUNDLE DESTINATION . RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} )
|
||||
|
||||
IF( UNIX AND NOT APPLE AND KDE4_INSTALLED ) #install protocol file
|
||||
IF( UNIX AND NOT APPLE AND KDE4_INSTALLED AND LEGACY_KDE_INTEGRATION ) #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
|
||||
"${CMAKE_INSTALL_FULL_BINDIR}/tomahawk" # this is linux (kde) so pretty safe I think
|
||||
edited_protocol # save in this variable
|
||||
"${protocol}" # from the contents of this var
|
||||
)
|
||||
@@ -276,7 +285,7 @@ IF( UNIX AND NOT APPLE AND KDE4_INSTALLED ) #install protocol file
|
||||
IF( ${SERVICES_INSTALL_DIR} )
|
||||
SET( PROTOCOL_INSTALL_DIR ${SERVICES_INSTALL_DIR} )
|
||||
ELSE()
|
||||
SET( PROTOCOL_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share/kde4/services" )
|
||||
SET( PROTOCOL_INSTALL_DIR "${CMAKE_INSTALL_FULL_DATADIR}/kde4/services" )
|
||||
ENDIF()
|
||||
INSTALL( FILES ${CMAKE_BINARY_DIR}/tomahawk.protocol DESTINATION ${PROTOCOL_INSTALL_DIR} )
|
||||
ENDIF()
|
||||
|
@@ -7,9 +7,9 @@ ADD_DEFINITIONS( -fPIC )
|
||||
SET( QXTWEB_LIBRARIES qxtweb-standalone )
|
||||
|
||||
IF( APPLE )
|
||||
INCLUDE( "CMakeLists.osx.txt" )
|
||||
INCLUDE( "CMakeLists.osx.cmake" )
|
||||
ENDIF( APPLE )
|
||||
|
||||
IF( UNIX AND NOT APPLE )
|
||||
INCLUDE( "CMakeLists.linux.txt" )
|
||||
INCLUDE( "CMakeLists.linux.cmake" )
|
||||
ENDIF( UNIX AND NOT APPLE )
|
@@ -22,7 +22,7 @@
|
||||
#include "GetNewStuffDelegate.h"
|
||||
#include "GetNewStuffModel.h"
|
||||
|
||||
GetNewStuffDialog::GetNewStuffDialog( QWidget *parent, Qt::WindowFlags f )
|
||||
GetNewStuffDialog::GetNewStuffDialog( QWidget* parent, Qt::WindowFlags f )
|
||||
: QDialog( parent, f )
|
||||
, ui( new Ui::GetNewStuffDialog )
|
||||
, m_model( new GetNewStuffModel( this ) )
|
||||
@@ -37,16 +37,17 @@ GetNewStuffDialog::GetNewStuffDialog( QWidget *parent, Qt::WindowFlags f )
|
||||
|
||||
ui->listView->setMouseTracking( true );
|
||||
|
||||
setMinimumSize( 560, 350 );
|
||||
|
||||
#ifdef Q_WS_MAC
|
||||
setMinimumSize( 510, 350 );
|
||||
setMaximumSize( 510, 350 );
|
||||
setMaximumSize( 560, 350 );
|
||||
setSizeGripEnabled( false );
|
||||
|
||||
ui->listView->setAttribute( Qt::WA_MacShowFocusRect, false );
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
GetNewStuffDialog::~GetNewStuffDialog()
|
||||
{
|
||||
delete ui;
|
||||
|
@@ -34,9 +34,6 @@ LoadXSPFDialog::LoadXSPFDialog( QWidget* parent, Qt::WindowFlags f )
|
||||
m_ui->verticalLayout->setSpacing( 0 );
|
||||
#endif
|
||||
|
||||
connect( m_ui->buttonBox, SIGNAL( accepted() ), SLOT( accept() ) );
|
||||
connect( m_ui->buttonBox, SIGNAL( rejected() ), SLOT( reject() ) );
|
||||
|
||||
connect( m_ui->navigateButton, SIGNAL( clicked( bool ) ), this, SLOT( getLocalFile() ) );
|
||||
}
|
||||
|
||||
@@ -47,7 +44,7 @@ LoadXSPFDialog::~LoadXSPFDialog()
|
||||
void
|
||||
LoadXSPFDialog::getLocalFile()
|
||||
{
|
||||
QString url = QFileDialog::getOpenFileName( this, tr( "Load XSPF File" ), QDir::homePath(), ".xspf" );
|
||||
QString url = QFileDialog::getOpenFileName( this, tr( "Load XSPF File" ), QDir::homePath(), tr( "XSPF Files (*.xspf)" ) );
|
||||
m_ui->lineEdit->setText( url );
|
||||
}
|
||||
|
||||
|
@@ -19,14 +19,13 @@
|
||||
#include "audiocontrols.h"
|
||||
#include "ui_audiocontrols.h"
|
||||
|
||||
#include <QNetworkReply>
|
||||
#include <QDropEvent>
|
||||
#include <QMouseEvent>
|
||||
#include <QtNetwork/QNetworkReply>
|
||||
#include <QtGui/QDropEvent>
|
||||
#include <QtGui/QMouseEvent>
|
||||
|
||||
#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"
|
||||
@@ -37,14 +36,13 @@
|
||||
|
||||
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 );
|
||||
@@ -86,16 +84,21 @@ AudioControls::AudioControls( QWidget* parent )
|
||||
ui->loveButton->setPixmap( RESPATH "images/not-loved.png" );
|
||||
ui->loveButton->setCheckable( true );
|
||||
|
||||
#ifdef Q_WS_MAC
|
||||
ui->ownerLabel->setForegroundRole( QPalette::Text );
|
||||
#else
|
||||
ui->ownerLabel->setForegroundRole( QPalette::Dark );
|
||||
#endif
|
||||
ui->metaDataArea->setStyleSheet( "QWidget#metaDataArea {\nborder-width: 4px;\nborder-image: url(" RESPATH "images/now-playing-panel.png) 4 4 4 4 stretch stretch; }" );
|
||||
|
||||
ui->seekSlider->setEnabled( true );
|
||||
ui->seekSlider->setTimeLine( &m_sliderTimeLine );
|
||||
ui->volumeSlider->setRange( 0, 100 );
|
||||
ui->volumeSlider->setValue( AudioEngine::instance()->volume() );
|
||||
|
||||
m_sliderTimeLine.setCurveShape( QTimeLine::LinearCurve );
|
||||
ui->seekSlider->setTimeLine( &m_sliderTimeLine );
|
||||
m_phononTickCheckTimer.setSingleShot( true );
|
||||
|
||||
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 ) ) );
|
||||
@@ -107,8 +110,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() ), this, SIGNAL( playPressed() ) );
|
||||
connect( ui->pauseButton, SIGNAL( clicked() ), this, SIGNAL( pausePressed() ) );
|
||||
connect( ui->playPauseButton, SIGNAL( clicked() ), SIGNAL( playPressed() ) );
|
||||
connect( ui->pauseButton, SIGNAL( clicked() ), SIGNAL( pausePressed() ) );
|
||||
|
||||
connect( ui->repeatButton, SIGNAL( clicked() ), SLOT( onRepeatClicked() ) );
|
||||
connect( ui->shuffleButton, SIGNAL( clicked() ), SLOT( onShuffleClicked() ) );
|
||||
@@ -128,15 +131,6 @@ 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 );
|
||||
@@ -171,6 +165,13 @@ AudioControls::changeEvent( QEvent* e )
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
AudioControls::phononTickCheckTimeout()
|
||||
{
|
||||
onPlaybackTimer( m_lastSliderCheck );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
AudioControls::onVolumeChanged( int volume )
|
||||
{
|
||||
@@ -183,8 +184,6 @@ AudioControls::onVolumeChanged( int volume )
|
||||
void
|
||||
AudioControls::onPlaybackStarted( const Tomahawk::result_ptr& result )
|
||||
{
|
||||
tDebug( LOGEXTRA ) << Q_FUNC_INFO;
|
||||
|
||||
if ( result.isNull() )
|
||||
return;
|
||||
|
||||
@@ -198,114 +197,115 @@ 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 );
|
||||
m_sliderTimeLine.setFrameRange( 0, duration );
|
||||
m_sliderTimeLine.setCurveShape( QTimeLine::LinearCurve );
|
||||
m_sliderTimeLine.setCurrentTime( 0 );
|
||||
m_seekMsecs = -1;
|
||||
|
||||
|
||||
ui->seekSlider->setVisible( true );
|
||||
|
||||
Tomahawk::InfoSystem::InfoStringHash trackInfo;
|
||||
trackInfo["artist"] = result->artist()->name();
|
||||
trackInfo["album"] = result->album()->name();
|
||||
int updateRate = (double)1000 / ( (double)ui->seekSlider->contentsRect().width() / (double)( duration / 1000 ) );
|
||||
m_sliderTimeLine.setUpdateInterval( qBound( 40, updateRate, 500 ) );
|
||||
|
||||
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 );
|
||||
m_noTimeChange = false;
|
||||
m_lastSliderCheck = 0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
AudioControls::onPlaybackLoading( const Tomahawk::result_ptr& result )
|
||||
{
|
||||
tDebug( LOGEXTRA ) << Q_FUNC_INFO;
|
||||
if ( !m_currentTrack.isNull() )
|
||||
{
|
||||
disconnect( m_currentTrack->album().data(), SIGNAL( updated() ), this, SLOT( onAlbumCoverUpdated() ) );
|
||||
disconnect( m_currentTrack->toQuery().data(), SIGNAL( socialActionsLoaded() ), this, SLOT( onSocialActionsLoaded() ) );
|
||||
}
|
||||
|
||||
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->setText( "-" + TomahawkUtils::timeToString( result.data()->duration() ) );
|
||||
ui->timeLeftLabel->setFixedWidth( ui->timeLeftLabel->fontMetrics().width( QString( duration.length() + 1, QChar( '0' ) ) ) );
|
||||
ui->timeLeftLabel->setText( "-" + duration );
|
||||
m_lastTextSecondShown = 0;
|
||||
|
||||
ui->stackedLayout->setCurrentWidget( ui->pauseButton );
|
||||
|
||||
ui->loveButton->setEnabled( true );
|
||||
ui->loveButton->setVisible( true );
|
||||
|
||||
result->loadSocialActions();
|
||||
|
||||
connect( result.data(), SIGNAL( socialActionsLoaded() ), this, SLOT( socialActionsLoaded() ) );
|
||||
setAlbumCover();
|
||||
setSocialActions();
|
||||
}
|
||||
|
||||
void
|
||||
AudioControls::socialActionsLoaded()
|
||||
{
|
||||
Result* r = qobject_cast< Result* >( sender() );
|
||||
Q_ASSERT( r );
|
||||
|
||||
if ( m_currentTrack.data() == r )
|
||||
void
|
||||
AudioControls::onAlbumCoverUpdated()
|
||||
{
|
||||
Album* album = qobject_cast< Album* >( sender() );
|
||||
if ( !album || album != m_currentTrack->album().data() )
|
||||
return;
|
||||
|
||||
setAlbumCover();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
AudioControls::setAlbumCover()
|
||||
{
|
||||
if ( !m_currentTrack->album()->cover( ui->coverImage->size() ).isNull() )
|
||||
{
|
||||
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 );
|
||||
}
|
||||
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 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -318,6 +318,7 @@ AudioControls::onPlaybackPaused()
|
||||
m_sliderTimeLine.setPaused( true );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
AudioControls::onPlaybackResumed()
|
||||
{
|
||||
@@ -334,6 +335,7 @@ 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;
|
||||
}
|
||||
|
||||
@@ -363,32 +365,61 @@ AudioControls::onPlaybackStopped()
|
||||
void
|
||||
AudioControls::onPlaybackTimer( qint64 msElapsed )
|
||||
{
|
||||
//tDebug( LOGEXTRA ) << Q_FUNC_INFO << " msElapsed = " << msElapsed << " and timer current time = " << m_sliderTimeLine.currentTime() << " and m_seekMsecs = " << m_seekMsecs;
|
||||
if ( m_currentTrack.isNull() )
|
||||
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;
|
||||
|
||||
if ( m_currentTrack.isNull() )
|
||||
{
|
||||
m_sliderTimeLine.stop();
|
||||
return;
|
||||
}
|
||||
|
||||
ui->seekSlider->blockSignals( true );
|
||||
|
||||
const int seconds = msElapsed / 1000;
|
||||
ui->timeLabel->setText( TomahawkUtils::timeToString( seconds ) );
|
||||
ui->timeLeftLabel->setText( "-" + TomahawkUtils::timeToString( m_currentTrack->duration() - seconds ) );
|
||||
|
||||
if ( m_sliderTimeLine.currentTime() > msElapsed || m_seekMsecs != -1 )
|
||||
if ( sender() != &m_phononTickCheckTimer )
|
||||
m_phononTickCheckTimer.start( 1000 );
|
||||
|
||||
int currentTime = m_sliderTimeLine.currentTime();
|
||||
if ( m_noTimeChange )
|
||||
{
|
||||
if ( 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 )
|
||||
{
|
||||
m_sliderTimeLine.setPaused( true );
|
||||
|
||||
m_noTimeChange = false;
|
||||
if ( currentTime == msElapsed )
|
||||
m_noTimeChange = true;
|
||||
|
||||
m_sliderTimeLine.setCurrentTime( msElapsed );
|
||||
m_seekMsecs = -1;
|
||||
if ( AudioEngine::instance()->state() != AudioEngine::Paused )
|
||||
if ( AudioEngine::instance()->state() != AudioEngine::Paused && sender() != &m_phononTickCheckTimer )
|
||||
m_sliderTimeLine.resume();
|
||||
}
|
||||
else if ( m_sliderTimeLine.duration() > msElapsed && m_sliderTimeLine.state() == QTimeLine::NotRunning )
|
||||
else if ( m_sliderTimeLine.duration() > msElapsed && m_sliderTimeLine.state() == QTimeLine::NotRunning && AudioEngine::instance()->state() == AudioEngine::Playing )
|
||||
{
|
||||
ui->seekSlider->setEnabled( AudioEngine::instance()->canSeek() );
|
||||
m_sliderTimeLine.resume();
|
||||
m_sliderTimeLine.start();
|
||||
}
|
||||
else if ( m_sliderTimeLine.state() == QTimeLine::Paused && AudioEngine::instance()->state() != AudioEngine::Paused )
|
||||
{
|
||||
ui->seekSlider->setEnabled( AudioEngine::instance()->canSeek() );
|
||||
m_sliderTimeLine.resume();
|
||||
}
|
||||
|
||||
@@ -567,30 +598,17 @@ 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 )
|
||||
{
|
||||
Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo(
|
||||
s_acInfoIdentifier, Tomahawk::InfoSystem::InfoLove,
|
||||
QVariant::fromValue< Tomahawk::InfoSystem::InfoStringHash >( trackInfo ) );
|
||||
|
||||
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" );
|
||||
|
||||
m_currentTrack->toQuery()->setLoved( true );
|
||||
}
|
||||
else
|
||||
{
|
||||
Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo(
|
||||
s_acInfoIdentifier, Tomahawk::InfoSystem::InfoUnLove,
|
||||
QVariant::fromValue< Tomahawk::InfoSystem::InfoStringHash >( trackInfo ) );
|
||||
|
||||
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" );
|
||||
|
||||
m_currentTrack->toQuery()->setLoved( false );
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -19,12 +19,12 @@
|
||||
#ifndef AUDIOCONTROLS_H
|
||||
#define AUDIOCONTROLS_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QTimeLine>
|
||||
#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,6 +59,8 @@ protected:
|
||||
void dropEvent ( QDropEvent* );
|
||||
|
||||
private slots:
|
||||
void phononTickCheckTimeout();
|
||||
|
||||
void onPlaybackStarted( const Tomahawk::result_ptr& result );
|
||||
void onPlaybackLoading( const Tomahawk::result_ptr& result );
|
||||
void onPlaybackPaused();
|
||||
@@ -77,24 +79,28 @@ private slots:
|
||||
void onTrackClicked();
|
||||
void onLoveButtonClicked( bool );
|
||||
|
||||
void infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output );
|
||||
void infoSystemFinished( QString target );
|
||||
void onAlbumCoverUpdated();
|
||||
|
||||
void droppedTracks( QList<Tomahawk::query_ptr> );
|
||||
|
||||
void socialActionsLoaded();
|
||||
void onSocialActionsLoaded();
|
||||
|
||||
private:
|
||||
Ui::AudioControls *ui;
|
||||
void setAlbumCover();
|
||||
void setSocialActions();
|
||||
|
||||
QPixmap m_defaultCover;
|
||||
Ui::AudioControls *ui;
|
||||
|
||||
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
|
||||
|
@@ -28,9 +28,6 @@
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
@@ -164,9 +161,6 @@
|
||||
<height>58</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
@@ -351,6 +345,9 @@
|
||||
<property name="text">
|
||||
<string>Time</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@@ -377,6 +374,9 @@
|
||||
<property name="text">
|
||||
<string>Time Left</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
@@ -18,11 +18,17 @@
|
||||
|
||||
#include "BreakPad.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "utils/logger.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QString>
|
||||
#include <QFileInfo>
|
||||
#include <string.h>
|
||||
|
||||
#define CRASH_REPORTER_BINARY "CrashReporter"
|
||||
#define CRASH_REPORTER_BINARY "tomahawk_crash_reporter"
|
||||
|
||||
bool s_active = true;
|
||||
|
||||
#ifndef WIN32
|
||||
#include <unistd.h>
|
||||
@@ -38,8 +44,10 @@ LaunchUploader( const char* dump_dir, const char* minidump_id, void* that, bool
|
||||
return false;
|
||||
|
||||
const char* crashReporter = static_cast<BreakPad*>(that)->crashReporter();
|
||||
pid_t pid = fork();
|
||||
if ( !s_active || strlen( crashReporter ) == 0 )
|
||||
return false;
|
||||
|
||||
pid_t pid = fork();
|
||||
if ( pid == -1 ) // fork failed
|
||||
return false;
|
||||
if ( pid == 0 )
|
||||
@@ -63,14 +71,25 @@ LaunchUploader( const char* dump_dir, const char* minidump_id, void* that, bool
|
||||
}
|
||||
|
||||
|
||||
BreakPad::BreakPad( const QString& path )
|
||||
BreakPad::BreakPad( const QString& path, bool active )
|
||||
#ifdef Q_OS_LINUX
|
||||
: google_breakpad::ExceptionHandler( path.toStdString(), 0, LaunchUploader, this, true )
|
||||
#else
|
||||
: google_breakpad::ExceptionHandler( path.toStdString(), 0, LaunchUploader, this, true, 0 )
|
||||
#endif
|
||||
{
|
||||
QString reporter = QString( "%1/%2" ).arg( qApp->applicationDirPath() ).arg( CRASH_REPORTER_BINARY );
|
||||
s_active = 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 );
|
||||
|
||||
if ( QFileInfo( localReporter ).exists() )
|
||||
reporter = localReporter;
|
||||
else if ( QFileInfo( globalReporter ).exists() )
|
||||
reporter = globalReporter;
|
||||
else
|
||||
tLog() << "Could not find \"" CRASH_REPORTER_BINARY "\" in \"" CMAKE_INSTALL_FULL_LIBEXECDIR "\" or application path";
|
||||
|
||||
char* creporter;
|
||||
std::string sreporter = reporter.toStdString();
|
||||
@@ -126,7 +145,7 @@ LaunchUploader( const wchar_t* dump_dir, const wchar_t* minidump_id, void* that,
|
||||
si.wShowWindow = SW_SHOWNORMAL;
|
||||
ZeroMemory( &pi, sizeof(pi) );
|
||||
|
||||
if (CreateProcess( NULL, command, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi))
|
||||
if ( CreateProcess( NULL, command, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi ) )
|
||||
{
|
||||
CloseHandle( pi.hProcess );
|
||||
CloseHandle( pi.hThread );
|
||||
@@ -137,9 +156,24 @@ LaunchUploader( const wchar_t* dump_dir, const wchar_t* minidump_id, void* that,
|
||||
}
|
||||
|
||||
|
||||
BreakPad::BreakPad( const QString& path )
|
||||
BreakPad::BreakPad( const QString& path, bool active )
|
||||
: google_breakpad::ExceptionHandler( path.toStdWString(), 0, LaunchUploader, this, true )
|
||||
{
|
||||
s_active = active;
|
||||
}
|
||||
|
||||
#endif // WIN32
|
||||
|
||||
|
||||
void
|
||||
BreakPad::setActive( bool enabled )
|
||||
{
|
||||
s_active = enabled;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
BreakPad::isActive()
|
||||
{
|
||||
return s_active;
|
||||
}
|
||||
|
@@ -32,11 +32,14 @@ class BreakPad : public google_breakpad::ExceptionHandler
|
||||
const char* m_crashReporter; // again, const char[]
|
||||
|
||||
public:
|
||||
BreakPad( const QString &dump_write_dirpath );
|
||||
BreakPad( const QString& dump_write_dirpath, bool active );
|
||||
|
||||
~BreakPad()
|
||||
{}
|
||||
|
||||
static void setActive( bool enabled );
|
||||
static bool isActive();
|
||||
|
||||
void setProductName( const char* s ) { m_productName = s; };
|
||||
const char* productName() const { return m_productName; }
|
||||
|
||||
|
@@ -1,8 +1,10 @@
|
||||
PROJECT( CrashReporter )
|
||||
|
||||
|
||||
FIND_PACKAGE( Qt4 REQUIRED )
|
||||
SET( QT_USE_QTNETWORK TRUE )
|
||||
|
||||
|
||||
SET( crashreporter_SOURCES main.cpp CrashReporter.cpp )
|
||||
SET( crashreporter_HEADERS CrashReporter.h )
|
||||
SET( crashreporter_UI CrashReporter.ui )
|
||||
@@ -16,5 +18,7 @@ INCLUDE( ${QT_USE_FILE} )
|
||||
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/src ../../libtomahawk )
|
||||
ADD_DEFINITIONS( ${QT_DEFINITIONS} )
|
||||
|
||||
ADD_EXECUTABLE( CrashReporter WIN32 ${crashreporter_SOURCES} ${crashreporter_HEADERS_MOC} ${crashreporter_UI_HEADERS} ${crashreporter_RC_RCC} )
|
||||
TARGET_LINK_LIBRARIES( CrashReporter ${QT_LIBRARIES} tomahawklib )
|
||||
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 )
|
||||
|
||||
install(TARGETS tomahawk_crash_reporter RUNTIME DESTINATION ${CMAKE_INSTALL_LIBEXECDIR})
|
||||
|
@@ -9,6 +9,7 @@
|
||||
#cmakedefine DEBUG_BUILD
|
||||
|
||||
#define CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}"
|
||||
#define CMAKE_INSTALL_FULL_LIBEXECDIR "${CMAKE_INSTALL_FULL_LIBEXECDIR}"
|
||||
#define CMAKE_SYSTEM "${CMAKE_SYSTEM}"
|
||||
|
||||
#cmakedefine LION
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||
*
|
||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||
* Copyright 2010-2011, Leo Franchi <lfranchi@kde.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,7 +52,8 @@ public:
|
||||
setMinimumSize( sizeHint() );
|
||||
setMaximumSize( sizeHint() ); // to remove the resize grip on osx this is the only way
|
||||
|
||||
connect( conf, SIGNAL( sizeHintChanged() ), this, SLOT( updateSizeHint() ) );
|
||||
if( conf->metaObject()->indexOfSignal( "sizeHintChanged()" ) > -1 )
|
||||
connect( conf, SIGNAL( sizeHintChanged() ), this, SLOT( updateSizeHint() ) );
|
||||
#else
|
||||
m_widget->setVisible( true );
|
||||
#endif
|
||||
|
@@ -22,7 +22,7 @@
|
||||
#ifdef ENABLE_HEADLESS
|
||||
|
||||
#define TOMAHAWK_APPLICATION QCoreApplication
|
||||
#include <QApplication>
|
||||
#include <QCoreApplication>
|
||||
|
||||
#else
|
||||
|
||||
|
@@ -19,7 +19,7 @@
|
||||
#include "AtticaManager.h"
|
||||
|
||||
#include "utils/tomahawkutils.h"
|
||||
#include "tomahawksettings.h"
|
||||
#include "TomahawkSettingsGui.h"
|
||||
#include "pipeline.h"
|
||||
|
||||
#include <attica/downloaditem.h>
|
||||
@@ -44,7 +44,9 @@ 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:10480/resolvers/providers.xml" ) );
|
||||
m_manager.addProviderFile( QUrl( "http://bakery.tomahawk-player.org/resolvers/providers.xml" ) );
|
||||
|
||||
qRegisterMetaType< Attica::Content >( "Attica::Content" );
|
||||
}
|
||||
|
||||
|
||||
@@ -74,7 +76,10 @@ AtticaManager::loadPixmapsFromCache()
|
||||
}
|
||||
|
||||
QPixmap* icon = new QPixmap( cacheDir.absoluteFilePath( file ) );
|
||||
m_resolverStates[ info.baseName() ].pixmap = icon;
|
||||
if ( !icon->isNull() )
|
||||
{
|
||||
m_resolverStates[ info.baseName() ].pixmap = icon;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,14 +96,21 @@ AtticaManager::savePixmapsToCache()
|
||||
|
||||
foreach( const QString& id, m_resolverStates.keys() )
|
||||
{
|
||||
if ( !m_resolverStates[ id ].pixmap )
|
||||
if ( !m_resolverStates[ id ].pixmap || !m_resolverStates[ id ].pixmapDirty )
|
||||
continue;
|
||||
|
||||
const QString filename = cacheDir.absoluteFilePath( QString( "%1.png" ).arg( id ) );
|
||||
if ( !m_resolverStates[ id ].pixmap->save( filename ) )
|
||||
QFile f( filename );
|
||||
if ( !f.open( QIODevice::WriteOnly ) )
|
||||
{
|
||||
tLog() << "Failed to open cache file for writing:" << filename;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( !m_resolverStates[ id ].pixmap->save( &f ) )
|
||||
{
|
||||
tLog() << "Failed to save pixmap into opened file for writing:" << filename;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -149,6 +161,7 @@ AtticaManager::pathFromId( const QString& resolverId ) const
|
||||
return m_resolverStates.value( resolverId ).scriptPath;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
AtticaManager::uploadRating( const Content& c )
|
||||
{
|
||||
@@ -165,7 +178,7 @@ AtticaManager::uploadRating( const Content& c )
|
||||
}
|
||||
}
|
||||
|
||||
TomahawkSettings::instance()->setAtticaResolverStates( m_resolverStates );
|
||||
TomahawkSettingsGui::instanceGui()->setAtticaResolverStates( m_resolverStates );
|
||||
|
||||
PostJob* job = m_resolverProvider.voteForContent( c.id(), (uint)c.rating() );
|
||||
connect( job, SIGNAL( finished( Attica::BaseJob* ) ), job, SLOT( deleteLater() ) );
|
||||
@@ -175,6 +188,7 @@ AtticaManager::uploadRating( const Content& c )
|
||||
emit resolverStateChanged( c.id() );
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
AtticaManager::userHasRated( const Content& c ) const
|
||||
{
|
||||
@@ -202,7 +216,7 @@ AtticaManager::resolversList( BaseJob* j )
|
||||
ListJob< Content >* job = static_cast< ListJob< Content >* >( j );
|
||||
|
||||
m_resolvers = job->itemList();
|
||||
m_resolverStates = TomahawkSettings::instance()->atticaResolverStates();
|
||||
m_resolverStates = TomahawkSettingsGui::instanceGui()->atticaResolverStates();
|
||||
|
||||
// load icon cache from disk, and fetch any we are missing
|
||||
loadPixmapsFromCache();
|
||||
@@ -243,8 +257,10 @@ AtticaManager::resolverIconFetched()
|
||||
QPixmap* icon = new QPixmap;
|
||||
icon->loadFromData( data );
|
||||
m_resolverStates[ resolverId ].pixmap = icon;
|
||||
m_resolverStates[ resolverId ].pixmapDirty = true;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
AtticaManager::syncServerData()
|
||||
{
|
||||
@@ -271,65 +287,19 @@ AtticaManager::syncServerData()
|
||||
if ( ( r.state == Installed || r.state == NeedsUpgrade ) &&
|
||||
!upstream.version().isEmpty() )
|
||||
{
|
||||
if ( newerVersion( r.version, upstream.version() ) )
|
||||
if ( TomahawkUtils::newerVersion( r.version, upstream.version() ) )
|
||||
{
|
||||
m_resolverStates[ id ].state = NeedsUpgrade;
|
||||
QMetaObject::invokeMethod( this, "upgradeResolver", Qt::QueuedConnection, Q_ARG( Attica::Content, upstream ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
AtticaManager::newerVersion( const QString& older, const QString& newer ) const
|
||||
{
|
||||
// Dumb version comparison. Expects two strings, X.Y and Z.V. Returns true if Z > v || Z == V && V > Y
|
||||
// DOES NOT support X.Y.Z version strings
|
||||
if ( older.isEmpty() || newer.isEmpty() )
|
||||
return false;
|
||||
|
||||
QPair<int, int> oldVer, newVer;
|
||||
QStringList parts = older.split( "." );
|
||||
|
||||
if ( parts.size() == 1 )
|
||||
{
|
||||
oldVer.first = parts[ 0 ].toInt();
|
||||
oldVer.second = 0;
|
||||
}
|
||||
else if ( parts.size() == 2 )
|
||||
{
|
||||
oldVer.first = parts[ 0 ].toInt();
|
||||
oldVer.second = parts[ 1 ].toInt();;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
|
||||
parts = newer.split( "." );
|
||||
if ( parts.size() == 1 )
|
||||
{
|
||||
newVer.first = parts[ 0 ].toInt();
|
||||
newVer.second = 0;
|
||||
}
|
||||
else if ( parts.size() == 2 )
|
||||
{
|
||||
newVer.first = parts[ 0 ].toInt();
|
||||
newVer.second = parts[ 1 ].toInt();;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
|
||||
// Do the comparison
|
||||
if ( newVer.first > oldVer.first )
|
||||
return true;
|
||||
if ( newVer.first == oldVer.first &&
|
||||
newVer.second > oldVer.second )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
AtticaManager::installResolver( const Content& resolver )
|
||||
AtticaManager::installResolver( const Content& resolver, bool autoEnable )
|
||||
{
|
||||
Q_ASSERT( !resolver.id().isNull() );
|
||||
|
||||
@@ -343,10 +313,12 @@ AtticaManager::installResolver( const Content& resolver )
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
AtticaManager::upgradeResolver( const Content& resolver )
|
||||
{
|
||||
@@ -356,11 +328,12 @@ 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 );
|
||||
installResolver( resolver, enabled );
|
||||
}
|
||||
|
||||
|
||||
@@ -377,6 +350,7 @@ 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
|
||||
{
|
||||
@@ -412,10 +386,12 @@ 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, true );
|
||||
Tomahawk::Pipeline::instance()->addScriptResolver( resolverPath, autoEnable );
|
||||
m_resolverStates[ resolverId ].state = Installed;
|
||||
TomahawkSettings::instance()->setAtticaResolverStates( m_resolverStates );
|
||||
TomahawkSettingsGui::instanceGui()->setAtticaResolverStates( m_resolverStates );
|
||||
emit resolverInstalled( resolverId );
|
||||
emit resolverStateChanged( resolverId );
|
||||
}
|
||||
@@ -511,7 +487,7 @@ AtticaManager::uninstallResolver( const QString& pathToResolver )
|
||||
if ( resolver.id() == atticaId ) // this is the one
|
||||
{
|
||||
m_resolverStates[ atticaId ].state = Uninstalled;
|
||||
TomahawkSettings::instance()->setAtticaResolverState( atticaId, Uninstalled );
|
||||
TomahawkSettingsGui::instanceGui()->setAtticaResolverState( atticaId, Uninstalled );
|
||||
|
||||
doResolverRemove( atticaId );
|
||||
}
|
||||
@@ -529,7 +505,7 @@ AtticaManager::uninstallResolver( const Content& resolver )
|
||||
emit resolverStateChanged( resolver.id() );
|
||||
|
||||
m_resolverStates[ resolver.id() ].state = Uninstalled;
|
||||
TomahawkSettings::instance()->setAtticaResolverState( resolver.id(), Uninstalled );
|
||||
TomahawkSettingsGui::instanceGui()->setAtticaResolverState( resolver.id(), Uninstalled );
|
||||
}
|
||||
|
||||
Tomahawk::Pipeline::instance()->removeScriptResolver( pathFromId( resolver.id() ) );
|
||||
|
@@ -52,9 +52,12 @@ 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 ) {}
|
||||
Resolver() : userRating( -1 ), state( Uninstalled ), pixmap( 0 ) {}
|
||||
: version( v ), scriptPath( path ), userRating( userR ), state( s ), pixmap( 0 ), pixmapDirty( false ) {}
|
||||
Resolver() : userRating( -1 ), state( Uninstalled ), pixmap( 0 ), pixmapDirty( false ) {}
|
||||
};
|
||||
|
||||
typedef QHash< QString, AtticaManager::Resolver > StateHash;
|
||||
@@ -83,8 +86,6 @@ public:
|
||||
ResolverState resolverState( const Attica::Content& resolver ) const;
|
||||
QPixmap iconForResolver( const Attica::Content& id ); // Looks up in icon cache
|
||||
|
||||
void installResolver( const Attica::Content& resolver );
|
||||
void upgradeResolver( const Attica::Content& resolver );
|
||||
void uninstallResolver( const Attica::Content& resolver );
|
||||
void uninstallResolver( const QString& pathToResolver );
|
||||
QString pathFromId( const QString& resolverId ) const;
|
||||
@@ -92,6 +93,9 @@ public:
|
||||
void uploadRating( const Attica::Content& c );
|
||||
bool userHasRated( const Attica::Content& c ) const;
|
||||
|
||||
public slots:
|
||||
void installResolver( const Attica::Content& resolver, bool autoEnable = true );
|
||||
void upgradeResolver( const Attica::Content& resolver );
|
||||
|
||||
signals:
|
||||
void resolversReloaded( const Attica::Content::List& resolvers );
|
||||
@@ -111,7 +115,6 @@ private slots:
|
||||
void resolverIconFetched();
|
||||
|
||||
void syncServerData();
|
||||
bool newerVersion( const QString& older, const QString& newer ) const;
|
||||
|
||||
private:
|
||||
QString extractPayload( const QString& filename, const QString& resolverId ) const;
|
||||
@@ -127,4 +130,8 @@ private:
|
||||
static AtticaManager* s_instance;
|
||||
};
|
||||
|
||||
#ifdef LIBATTICA_FOUND
|
||||
Q_DECLARE_METATYPE( Attica::Content );
|
||||
#endif
|
||||
|
||||
#endif // ATTICAMANAGER_H
|
||||
|
@@ -11,39 +11,19 @@ include( ${QT_USE_FILE} )
|
||||
add_definitions( ${QT_DEFINITIONS} )
|
||||
add_definitions( -DQT_SHARED )
|
||||
add_definitions( -DDLLEXPORT_PRO )
|
||||
add_definitions( -DQT_SHAREDPOINTER_TRACK_POINTERS )
|
||||
|
||||
set( libSources
|
||||
tomahawksettings.cpp
|
||||
sourcelist.cpp
|
||||
pipeline.cpp
|
||||
|
||||
aclsystem.cpp
|
||||
set( libGuiSources
|
||||
actioncollection.cpp
|
||||
artist.cpp
|
||||
album.cpp
|
||||
collection.cpp
|
||||
playlist.cpp
|
||||
resolver.cpp
|
||||
query.cpp
|
||||
result.cpp
|
||||
source.cpp
|
||||
sourceplaylistinterface.cpp
|
||||
viewpage.cpp
|
||||
viewmanager.cpp
|
||||
globalactionmanager.cpp
|
||||
|
||||
contextmenu.cpp
|
||||
dropjob.cpp
|
||||
playlistinterface.cpp
|
||||
globalactionmanager.cpp
|
||||
viewpage.cpp
|
||||
viewmanager.cpp
|
||||
LatchManager.cpp
|
||||
|
||||
EchonestCatalogSynchronizer.cpp
|
||||
|
||||
sip/SipPlugin.cpp
|
||||
sip/SipHandler.cpp
|
||||
sip/SipModel.cpp
|
||||
sip/sipinfo.cpp
|
||||
|
||||
audio/audioengine.cpp
|
||||
TomahawkSettingsGui.cpp
|
||||
|
||||
context/ContextPage.cpp
|
||||
context/ContextWidget.cpp
|
||||
@@ -52,6 +32,294 @@ set( libSources
|
||||
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
|
||||
sourcelist.cpp
|
||||
pipeline.cpp
|
||||
|
||||
aclsystem.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
|
||||
playlistinterface.cpp
|
||||
|
||||
EchonestCatalogSynchronizer.cpp
|
||||
|
||||
sip/SipPlugin.cpp
|
||||
sip/SipHandler.cpp
|
||||
sip/sipinfo.cpp
|
||||
|
||||
audio/audioengine.cpp
|
||||
|
||||
|
||||
database/database.cpp
|
||||
database/fuzzyindex.cpp
|
||||
database/databasecollection.cpp
|
||||
@@ -104,11 +372,10 @@ set( libSources
|
||||
database/databasecommand_settrackattributes.cpp
|
||||
database/database.cpp
|
||||
|
||||
infobar/infobar.cpp
|
||||
|
||||
infosystem/infosystemcache.cpp
|
||||
infosystem/infosystem.cpp
|
||||
infosystem/infosystemcache.cpp
|
||||
infosystem/infosystemworker.cpp
|
||||
|
||||
infosystem/infoplugins/generic/echonestplugin.cpp
|
||||
infosystem/infoplugins/generic/lastfmplugin.cpp
|
||||
infosystem/infoplugins/generic/chartsplugin.cpp
|
||||
@@ -118,66 +385,6 @@ 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
|
||||
@@ -188,53 +395,28 @@ 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/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
|
||||
utils/xspfloader.cpp
|
||||
|
||||
thirdparty/kdsingleapplicationguard/kdsingleapplicationguard.cpp
|
||||
thirdparty/kdsingleapplicationguard/kdsharedmemorylocker.cpp
|
||||
@@ -248,41 +430,34 @@ 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
|
||||
@@ -334,11 +509,11 @@ set( libHeaders
|
||||
database/databasecommand_trackattributes.h
|
||||
database/databasecommand_settrackattributes.h
|
||||
|
||||
infobar/infobar.h
|
||||
|
||||
infosystem/infosystem.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
|
||||
@@ -358,123 +533,32 @@ 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/XspfUpdater.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/GeneratorFactory.h
|
||||
playlist/XspfUpdater.h
|
||||
playlist/dynamic/database/DatabaseGenerator.h
|
||||
|
||||
resolvers/scriptresolver.h
|
||||
resolvers/qtscriptresolver.h
|
||||
|
||||
utils/widgetdragfilter.h
|
||||
utils/xspfloader.h
|
||||
utils/xspfgenerator.h
|
||||
utils/jspfloader.h
|
||||
utils/spotifyparser.h
|
||||
utils/itunesparser.h
|
||||
utils/rdioparser.h
|
||||
utils/shortenedlinkparser.h
|
||||
utils/qnr_iodevicestream.h
|
||||
utils/dropjobnotifier.h
|
||||
|
||||
widgets/checkdirtree.h
|
||||
widgets/querylabel.h
|
||||
widgets/animatedcounterlabel.h
|
||||
widgets/imagebutton.h
|
||||
widgets/animatedsplitter.h
|
||||
widgets/elidedlabel.h
|
||||
widgets/newplaylistwidget.h
|
||||
widgets/searchwidget.h
|
||||
widgets/SeekSlider.h
|
||||
widgets/playlisttypeselectordlg.h
|
||||
widgets/welcomewidget.h
|
||||
widgets/whatshotwidget.h
|
||||
widgets/RecentlyPlayedPlaylistsModel.h
|
||||
widgets/RecentPlaylistsModel.h
|
||||
widgets/OverlayButton.h
|
||||
widgets/overlaywidget.h
|
||||
widgets/HeaderLabel.h
|
||||
widgets/HeaderWidget.h
|
||||
widgets/combobox.h
|
||||
widgets/ToggleButton.h
|
||||
widgets/SocialPlaylistWidget.h
|
||||
widgets/infowidgets/sourceinfowidget.h
|
||||
widgets/infowidgets/ArtistInfoWidget.h
|
||||
widgets/infowidgets/ArtistInfoWidget_p.h
|
||||
widgets/infowidgets/AlbumInfoWidget.h
|
||||
widgets/Breadcrumb.h
|
||||
widgets/BreadcrumbButton.h
|
||||
|
||||
jobview/JobStatusView.h
|
||||
jobview/JobStatusModel.h
|
||||
jobview/JobStatusDelegate.h
|
||||
jobview/JobStatusItem.h
|
||||
jobview/PipelineStatusItem.h
|
||||
jobview/TransferStatusItem.h
|
||||
jobview/LatchedStatusItem.h
|
||||
playlist/dynamic/database/DatabaseControl.h
|
||||
playlist/dynamic/DynamicControl.h
|
||||
|
||||
thirdparty/kdsingleapplicationguard/kdsingleapplicationguard.h
|
||||
thirdparty/Qocoa/qsearchfield.h
|
||||
|
||||
utils/tomahawkutilsgui.h
|
||||
utils/xspfloader.h
|
||||
utils/qnr_iodevicestream.h
|
||||
)
|
||||
|
||||
set( libHeaders_NoMOC
|
||||
viewpage.h
|
||||
|
||||
infosystem/infoplugins/unix/imageconverter.h
|
||||
|
||||
playlist/dynamic/GeneratorInterface.h
|
||||
playlist/dynamic/GeneratorFactory.h
|
||||
taghandlers/tag.h
|
||||
taghandlers/apetag.h
|
||||
taghandlers/asftag.h
|
||||
taghandlers/id3v1tag.h
|
||||
taghandlers/id3v2tag.h
|
||||
taghandlers/mp4tag.h
|
||||
taghandlers/oggtag.h
|
||||
|
||||
utils/tomahawkutils.h
|
||||
)
|
||||
@@ -501,7 +585,7 @@ include_directories( . ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/.
|
||||
${QJSON_INCLUDE_DIR}
|
||||
${LIBECHONEST_INCLUDE_DIR}
|
||||
${LIBECHONEST_INCLUDE_DIR}/..
|
||||
${CLUCENE_INCLUDE_DIR}
|
||||
${CLUCENE_INCLUDE_DIRS}
|
||||
${PHONON_INCLUDES}
|
||||
${CMAKE_BINARY_DIR}/thirdparty/liblastfm2/src
|
||||
|
||||
@@ -517,20 +601,20 @@ IF(QCA2_FOUND)
|
||||
ENDIF(QCA2_FOUND)
|
||||
|
||||
IF(LIBATTICA_FOUND)
|
||||
SET( libSources ${libSources} AtticaManager.cpp )
|
||||
SET( libHeaders ${libHeaders} AtticaManager.h )
|
||||
SET( libGuiSources ${libGuiSources} AtticaManager.cpp )
|
||||
SET( libGuiHeaders ${libGuiHeaders} AtticaManager.h )
|
||||
INCLUDE_DIRECTORIES( ${LIBATTICA_INCLUDE_DIR} )
|
||||
ENDIF(LIBATTICA_FOUND)
|
||||
|
||||
IF( UNIX AND NOT APPLE )
|
||||
SET( libSources ${libSources}
|
||||
LIST(APPEND libGuiSources
|
||||
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 )
|
||||
|
||||
SET( libHeaders ${libHeaders}
|
||||
LIST(APPEND libGuiHeaders
|
||||
infosystem/infoplugins/unix/mprispluginrootadaptor.h
|
||||
infosystem/infoplugins/unix/mprispluginplayeradaptor.h
|
||||
infosystem/infoplugins/unix/mprisplugin.h
|
||||
@@ -553,6 +637,7 @@ IF( WIN32 )
|
||||
"dsound.dll"
|
||||
"winmm.dll"
|
||||
"advapi32.dll"
|
||||
"shlwapi.dll"
|
||||
)
|
||||
ENDIF( WIN32 )
|
||||
|
||||
@@ -569,6 +654,8 @@ 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 )
|
||||
@@ -584,13 +671,18 @@ IF( APPLE )
|
||||
/System/Library/Frameworks/AppKit.framework
|
||||
)
|
||||
ELSE( APPLE )
|
||||
SET( libSources ${libSources} thirdparty/Qocoa/qsearchfield.cpp )
|
||||
SET( libGuiSources ${libGuiSources} 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} )
|
||||
|
||||
@@ -616,15 +708,17 @@ TARGET_LINK_LIBRARIES( tomahawklib
|
||||
${TAGLIB_LIBRARIES}
|
||||
${CLUCENE_LIBRARIES}
|
||||
${LIBECHONEST_LIBRARY}
|
||||
${QT_QTSQL_LIBRARY}
|
||||
${QT_QTUITOOLS_LIBRARY}
|
||||
${QT_LIBRARIES}
|
||||
${QT_QTGUI_LIBRARY}
|
||||
${QT_QTSCRIPT_LIBRARY}
|
||||
${OS_SPECIFIC_LINK_LIBRARIES}
|
||||
${CMAKE_THREAD_LIBS_INIT}
|
||||
${LINK_LIBRARIES}
|
||||
)
|
||||
|
||||
INSTALL( TARGETS tomahawklib
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION lib${LIB_SUFFIX}
|
||||
ARCHIVE DESTINATION lib${LIB_SUFFIX}
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
)
|
||||
|
@@ -342,7 +342,6 @@ 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 );
|
||||
|
27
src/libtomahawk/ExternalResolver.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
/* === 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;
|
||||
}
|
78
src/libtomahawk/ExternalResolver.h
Normal file
@@ -0,0 +1,78 @@
|
||||
/* === 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
|
124
src/libtomahawk/ExternalResolverGui.cpp
Normal file
@@ -0,0 +1,124 @@
|
||||
/* === 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();
|
||||
}
|
55
src/libtomahawk/ExternalResolverGui.h
Normal file
@@ -0,0 +1,55 @@
|
||||
/* === 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
|
@@ -22,8 +22,7 @@
|
||||
#include "audio/audioengine.h"
|
||||
#include "database/database.h"
|
||||
|
||||
#include <QtCore/QStateMachine>
|
||||
#include <QtCore/QState>
|
||||
#include <QtGui/QAction>
|
||||
#include "sourcelist.h"
|
||||
#include "database/databasecommand_socialaction.h"
|
||||
#include "sourceplaylistinterface.h"
|
||||
@@ -34,7 +33,7 @@ LatchManager::LatchManager( QObject* parent )
|
||||
: QObject( parent )
|
||||
, m_state( NotLatched )
|
||||
{
|
||||
connect( AudioEngine::instance(), SIGNAL( playlistChanged( Tomahawk::PlaylistInterface* ) ), this, SLOT( playlistChanged( Tomahawk::PlaylistInterface* ) ) );
|
||||
connect( AudioEngine::instance(), SIGNAL( playlistChanged( Tomahawk::playlistinterface_ptr ) ), this, SLOT( playlistChanged( Tomahawk::playlistinterface_ptr ) ) );
|
||||
}
|
||||
|
||||
LatchManager::~LatchManager()
|
||||
@@ -58,11 +57,11 @@ LatchManager::latchRequest( const source_ptr& source )
|
||||
|
||||
m_state = Latching;
|
||||
m_waitingForLatch = source;
|
||||
AudioEngine::instance()->playItem( source->getPlaylistInterface().data(), source->getPlaylistInterface()->nextItem() );
|
||||
AudioEngine::instance()->playItem( source->playlistInterface(), source->playlistInterface()->nextItem() );
|
||||
}
|
||||
|
||||
void
|
||||
LatchManager::playlistChanged( PlaylistInterface* )
|
||||
LatchManager::playlistChanged( Tomahawk::playlistinterface_ptr )
|
||||
{
|
||||
// If we were latched on and changed, send the listening along stop
|
||||
if ( m_latchedOnTo.isNull() )
|
||||
@@ -71,7 +70,7 @@ LatchManager::playlistChanged( PlaylistInterface* )
|
||||
return; // Neither latched on nor waiting to be latched on, no-op
|
||||
|
||||
m_latchedOnTo = m_waitingForLatch;
|
||||
m_latchedInterface = m_waitingForLatch->getPlaylistInterface();
|
||||
m_latchedInterface = m_waitingForLatch->playlistInterface();
|
||||
m_waitingForLatch.clear();
|
||||
m_state = Latched;
|
||||
|
||||
@@ -82,7 +81,9 @@ LatchManager::playlistChanged( PlaylistInterface* )
|
||||
cmd->setTimestamp( QDateTime::currentDateTime().toTime_t() );
|
||||
Database::instance()->enqueue( QSharedPointer< DatabaseCommand >( cmd ) );
|
||||
|
||||
ActionCollection::instance()->getAction( "latchOn" )->setText( tr( "&Catch Up" ) );
|
||||
QAction *latchOnAction = ActionCollection::instance()->getAction( "latchOn" );
|
||||
latchOnAction->setText( tr( "&Catch Up" ) );
|
||||
latchOnAction->setIcon( QIcon() );
|
||||
|
||||
// If not, then keep waiting
|
||||
return;
|
||||
@@ -108,7 +109,7 @@ LatchManager::playlistChanged( PlaylistInterface* )
|
||||
m_latchedInterface.clear();
|
||||
|
||||
// call ourselves to hit the "create latch" condition
|
||||
playlistChanged( 0 );
|
||||
playlistChanged( Tomahawk::playlistinterface_ptr() );
|
||||
return;
|
||||
}
|
||||
m_latchedOnTo.clear();
|
||||
@@ -117,7 +118,9 @@ LatchManager::playlistChanged( PlaylistInterface* )
|
||||
|
||||
m_state = NotLatched;
|
||||
|
||||
ActionCollection::instance()->getAction( "latchOn" )->setText( tr( "&Listen Along" ) );
|
||||
QAction *latchOnAction = ActionCollection::instance()->getAction( "latchOn" );
|
||||
latchOnAction->setText( tr( "&Listen Along" ) );
|
||||
latchOnAction->setIcon( QIcon( RESPATH "images/headphones-sidebar.png" ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -128,12 +131,27 @@ LatchManager::catchUpRequest()
|
||||
AudioEngine::instance()->next();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
LatchManager::unlatchRequest( const source_ptr& source )
|
||||
{
|
||||
Q_UNUSED( source );
|
||||
AudioEngine::instance()->stop();
|
||||
AudioEngine::instance()->setPlaylist( 0 );
|
||||
AudioEngine::instance()->setPlaylist( Tomahawk::playlistinterface_ptr() );
|
||||
|
||||
ActionCollection::instance()->getAction( "latchOn" )->setText( tr( "&Listen Along" ) );
|
||||
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();
|
||||
}
|
||||
|
@@ -43,10 +43,11 @@ 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* );
|
||||
void playlistChanged( Tomahawk::playlistinterface_ptr );
|
||||
|
||||
private:
|
||||
enum State {
|
||||
NotLatched = 0,
|
||||
|
140
src/libtomahawk/TomahawkSettingsGui.cpp
Normal file
@@ -0,0 +1,140 @@
|
||||
/* === 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 ) );
|
||||
}
|
55
src/libtomahawk/TomahawkSettingsGui.h
Normal file
@@ -0,0 +1,55 @@
|
||||
/* === 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
|
@@ -17,8 +17,9 @@
|
||||
*/
|
||||
|
||||
#include "actioncollection.h"
|
||||
#include <tomahawksettings.h>
|
||||
#include <utils/tomahawkutils.h>
|
||||
#include "tomahawksettings.h"
|
||||
#include "audio/audioengine.h"
|
||||
#include "utils/tomahawkutils.h"
|
||||
|
||||
ActionCollection* ActionCollection::s_instance = 0;
|
||||
ActionCollection* ActionCollection::instance()
|
||||
@@ -38,14 +39,39 @@ ActionCollection::ActionCollection( QObject *parent )
|
||||
void
|
||||
ActionCollection::initActions()
|
||||
{
|
||||
m_actionCollection[ "latchOn" ] = new QAction( tr( "&Listen Along" ), this );
|
||||
m_actionCollection[ "latchOff" ] = new QAction( tr( "&Stop Listening Along" ), this );
|
||||
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;
|
||||
|
||||
bool isPublic = TomahawkSettings::instance()->privateListeningMode() == TomahawkSettings::PublicListening;
|
||||
QAction *privacyToggle = new QAction( tr( QString( isPublic ? "&Listen Privately" : "&Listen Publicly" ).toAscii().constData() ), this );
|
||||
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 );
|
||||
}
|
||||
|
||||
|
||||
@@ -62,3 +88,21 @@ 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();
|
||||
}
|
||||
|
@@ -23,11 +23,10 @@
|
||||
|
||||
#include <QtGui/QAction>
|
||||
|
||||
|
||||
class DLLEXPORT ActionCollection : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
public:
|
||||
static ActionCollection* instance();
|
||||
|
||||
@@ -35,9 +34,15 @@ public:
|
||||
~ActionCollection();
|
||||
|
||||
void initActions();
|
||||
|
||||
QAction* getAction( const QString &name );
|
||||
|
||||
|
||||
QAction* getAction( const QString& name );
|
||||
|
||||
public slots:
|
||||
void togglePrivateListeningMode();
|
||||
|
||||
signals:
|
||||
void privacyModeChanged();
|
||||
|
||||
private:
|
||||
static ActionCollection* s_instance;
|
||||
|
||||
|
@@ -19,21 +19,28 @@
|
||||
#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() {}
|
||||
Album::~Album() {}
|
||||
|
||||
Album::~Album()
|
||||
{
|
||||
delete m_cover;
|
||||
}
|
||||
|
||||
|
||||
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();
|
||||
@@ -54,7 +61,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 ) );
|
||||
album_ptr a = album_ptr( new Album( id, name, artist ), &QObject::deleteLater );
|
||||
if ( id > 0 )
|
||||
s_albums.insert( id, a );
|
||||
|
||||
@@ -63,80 +70,118 @@ 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 )
|
||||
: PlaylistInterface( this )
|
||||
: QObject()
|
||||
, m_id( id )
|
||||
, m_name( name )
|
||||
, m_artist( artist )
|
||||
, m_currentItem( 0 )
|
||||
, m_currentTrack( 0 )
|
||||
, m_cover( 0 )
|
||||
, m_infoLoaded( false )
|
||||
{
|
||||
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 )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
Tomahawk::AlbumPlaylistInterface* api = dynamic_cast< Tomahawk::AlbumPlaylistInterface* >( playlistInterface().data() );
|
||||
if ( api )
|
||||
api->addQueries( tracks );
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
QList<Tomahawk::query_ptr>
|
||||
Album::tracks()
|
||||
|
||||
#ifndef ENABLE_HEADLESS
|
||||
QPixmap
|
||||
Album::cover( const QSize& size, bool forceLoad ) const
|
||||
{
|
||||
if ( m_queries.isEmpty() )
|
||||
if ( !m_infoLoaded )
|
||||
{
|
||||
DatabaseCommand_AllTracks* cmd = new DatabaseCommand_AllTracks();
|
||||
cmd->setAlbum( this );
|
||||
cmd->setSortOrder( DatabaseCommand_AllTracks::AlbumPosition );
|
||||
if ( !forceLoad )
|
||||
return QPixmap();
|
||||
m_uuid = uuid();
|
||||
|
||||
connect( cmd, SIGNAL( tracks( QList<Tomahawk::query_ptr>, QVariant ) ),
|
||||
SLOT( onTracksAdded( QList<Tomahawk::query_ptr> ) ) );
|
||||
Tomahawk::InfoSystem::InfoStringHash trackInfo;
|
||||
trackInfo["artist"] = artist()->name();
|
||||
trackInfo["album"] = name();
|
||||
|
||||
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( cmd ) );
|
||||
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 );
|
||||
}
|
||||
|
||||
return m_queries;
|
||||
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;
|
||||
}
|
||||
|
@@ -19,17 +19,23 @@
|
||||
#ifndef TOMAHAWKALBUM_H
|
||||
#define TOMAHAWKALBUM_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QSharedPointer>
|
||||
#include "config.h"
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QSharedPointer>
|
||||
#ifndef ENABLE_HEADLESS
|
||||
#include <QtGui/QPixmap>
|
||||
#endif
|
||||
|
||||
#include "typedefs.h"
|
||||
#include "playlistinterface.h"
|
||||
#include "dllmacro.h"
|
||||
#include "infosystem/infosystem.h"
|
||||
|
||||
namespace Tomahawk
|
||||
{
|
||||
|
||||
class DLLEXPORT Album : public QObject, public PlaylistInterface
|
||||
class DLLEXPORT Album : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -37,56 +43,44 @@ 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 );
|
||||
|
||||
Album( unsigned int id, const QString& name, const Tomahawk::artist_ptr& artist );
|
||||
~Album();
|
||||
explicit Album( unsigned int id, const QString& name, const Tomahawk::artist_ptr& artist );
|
||||
virtual ~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; }
|
||||
|
||||
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*/ ) {}
|
||||
Tomahawk::playlistinterface_ptr playlistInterface();
|
||||
|
||||
signals:
|
||||
void repeatModeChanged( PlaylistInterface::RepeatMode mode );
|
||||
void shuffleModeChanged( bool enabled );
|
||||
|
||||
void tracksAdded( const QList<Tomahawk::query_ptr>& tracks );
|
||||
void trackCountChanged( unsigned int tracks );
|
||||
void sourceTrackCountChanged( unsigned int tracks );
|
||||
|
||||
void nextTrackReady();
|
||||
void updated();
|
||||
|
||||
private slots:
|
||||
void onTracksAdded( const QList<Tomahawk::query_ptr>& tracks );
|
||||
|
||||
void infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output );
|
||||
|
||||
private:
|
||||
Album();
|
||||
Q_DISABLE_COPY( Album )
|
||||
|
||||
unsigned int m_id;
|
||||
QString m_name;
|
||||
|
||||
artist_ptr m_artist;
|
||||
QList<Tomahawk::query_ptr> m_queries;
|
||||
result_ptr m_currentItem;
|
||||
unsigned int m_currentTrack;
|
||||
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;
|
||||
};
|
||||
|
||||
}; // ns
|
||||
} // ns
|
||||
|
||||
#endif
|
||||
|
109
src/libtomahawk/albumplaylistinterface.cpp
Normal file
@@ -0,0 +1,109 @@
|
||||
/* === 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;
|
||||
}
|
82
src/libtomahawk/albumplaylistinterface.h
Normal file
@@ -0,0 +1,82 @@
|
||||
/* === 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
|
@@ -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,19 +29,18 @@
|
||||
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();
|
||||
@@ -62,7 +61,7 @@ Artist::get( unsigned int id, const QString& name )
|
||||
return s_artists.value( id );
|
||||
}
|
||||
|
||||
artist_ptr a = artist_ptr( new Artist( id, name ) );
|
||||
artist_ptr a = artist_ptr( new Artist( id, name ), &QObject::deleteLater );
|
||||
if ( id > 0 )
|
||||
s_artists.insert( id, a );
|
||||
|
||||
@@ -71,76 +70,110 @@ Artist::get( unsigned int id, const QString& name )
|
||||
|
||||
|
||||
Artist::Artist( unsigned int id, const QString& name )
|
||||
: PlaylistInterface( this )
|
||||
: QObject()
|
||||
, m_id( id )
|
||||
, m_name( name )
|
||||
, m_currentItem( 0 )
|
||||
, m_currentTrack( 0 )
|
||||
, m_cover( 0 )
|
||||
, m_infoLoaded( false )
|
||||
{
|
||||
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 )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
|
||||
m_queries << tracks;
|
||||
Tomahawk::ArtistPlaylistInterface* api = dynamic_cast< Tomahawk::ArtistPlaylistInterface* >( playlistInterface().data() );
|
||||
if ( api )
|
||||
api->addQueries( tracks );
|
||||
emit tracksAdded( tracks );
|
||||
}
|
||||
|
||||
|
||||
Tomahawk::result_ptr
|
||||
Artist::siblingItem( int itemsAway )
|
||||
#ifndef ENABLE_HEADLESS
|
||||
QPixmap
|
||||
Artist::cover( const QSize& size, bool forceLoad ) const
|
||||
{
|
||||
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
|
||||
Artist::hasNextItem()
|
||||
{
|
||||
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() )
|
||||
if ( !m_infoLoaded )
|
||||
{
|
||||
DatabaseCommand_AllTracks* cmd = new DatabaseCommand_AllTracks();
|
||||
cmd->setArtist( this );
|
||||
cmd->setSortOrder( DatabaseCommand_AllTracks::Album );
|
||||
if ( !forceLoad )
|
||||
return QPixmap();
|
||||
m_uuid = uuid();
|
||||
|
||||
connect( cmd, SIGNAL( tracks( QList<Tomahawk::query_ptr>, QVariant ) ),
|
||||
SLOT( onTracksAdded( QList<Tomahawk::query_ptr> ) ) );
|
||||
Tomahawk::InfoSystem::InfoStringHash trackInfo;
|
||||
trackInfo["artist"] = name();
|
||||
|
||||
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( cmd ) );
|
||||
Tomahawk::InfoSystem::InfoRequestData requestData;
|
||||
requestData.caller = m_uuid;
|
||||
requestData.type = Tomahawk::InfoSystem::InfoArtistImages;
|
||||
requestData.input = QVariant::fromValue< Tomahawk::InfoSystem::InfoStringHash >( trackInfo );
|
||||
requestData.customData = QVariantMap();
|
||||
|
||||
Tomahawk::InfoSystem::InfoSystem::instance()->getInfo( requestData );
|
||||
}
|
||||
|
||||
return m_queries;
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
Tomahawk::playlistinterface_ptr
|
||||
Artist::playlistInterface()
|
||||
{
|
||||
if ( m_playlistInterface.isNull() )
|
||||
{
|
||||
m_playlistInterface = Tomahawk::playlistinterface_ptr( new Tomahawk::ArtistPlaylistInterface( this ) );
|
||||
}
|
||||
|
||||
return m_playlistInterface;
|
||||
}
|
||||
|
@@ -19,75 +19,67 @@
|
||||
#ifndef TOMAHAWKARTIST_H
|
||||
#define TOMAHAWKARTIST_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QSharedPointer>
|
||||
#include "config.h"
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QSharedPointer>
|
||||
#ifndef ENABLE_HEADLESS
|
||||
#include <QtGui/QPixmap>
|
||||
#endif
|
||||
|
||||
#include "typedefs.h"
|
||||
#include "playlistinterface.h"
|
||||
#include "dllmacro.h"
|
||||
#include "infosystem/infosystem.h"
|
||||
|
||||
namespace Tomahawk
|
||||
{
|
||||
|
||||
class DLLEXPORT Artist : public QObject, public PlaylistInterface
|
||||
class DLLEXPORT Artist : public QObject
|
||||
{
|
||||
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 );
|
||||
|
||||
Artist();
|
||||
explicit Artist( unsigned int id, const QString& name );
|
||||
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; }
|
||||
|
||||
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*/ ) {}
|
||||
Tomahawk::playlistinterface_ptr playlistInterface();
|
||||
|
||||
signals:
|
||||
void repeatModeChanged( PlaylistInterface::RepeatMode mode );
|
||||
void shuffleModeChanged( bool enabled );
|
||||
|
||||
void tracksAdded( const QList<Tomahawk::query_ptr>& tracks );
|
||||
void trackCountChanged( unsigned int tracks );
|
||||
void sourceTrackCountChanged( unsigned int tracks );
|
||||
|
||||
void nextTrackReady();
|
||||
void updated();
|
||||
|
||||
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;
|
||||
|
||||
QList<Tomahawk::query_ptr> m_queries;
|
||||
result_ptr m_currentItem;
|
||||
unsigned int m_currentTrack;
|
||||
mutable QHash< int, QPixmap > m_coverCache;
|
||||
|
||||
Tomahawk::playlistinterface_ptr m_playlistInterface;
|
||||
};
|
||||
|
||||
}; // ns
|
||||
} // ns
|
||||
|
||||
#endif
|
||||
|
106
src/libtomahawk/artistplaylistinterface.cpp
Normal file
@@ -0,0 +1,106 @@
|
||||
/* === 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;
|
||||
}
|
73
src/libtomahawk/artistplaylistinterface.h
Normal file
@@ -0,0 +1,73 @@
|
||||
/* === 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
|
@@ -18,19 +18,20 @@
|
||||
|
||||
#include "audioengine.h"
|
||||
|
||||
#include <QUrl>
|
||||
#include <QNetworkReply>
|
||||
#include "config.h"
|
||||
|
||||
#include <QtCore/QUrl>
|
||||
#include <QtNetwork/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"
|
||||
@@ -52,12 +53,10 @@ 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;
|
||||
@@ -75,12 +74,9 @@ AudioEngine::AudioEngine()
|
||||
connect( m_mediaObject, SIGNAL( tick( qint64 ) ), SLOT( timerTriggered( qint64 ) ) );
|
||||
connect( m_mediaObject, SIGNAL( aboutToFinish() ), SLOT( onAboutToFinish() ) );
|
||||
|
||||
connect( m_audioOutput, SIGNAL( volumeChanged( qreal ) ), this, SLOT( onVolumeChanged( qreal ) ) );
|
||||
connect( m_audioOutput, SIGNAL( volumeChanged( qreal ) ), SLOT( onVolumeChanged( qreal ) ) );
|
||||
|
||||
#ifndef TOMAHAWK_HEADLESS
|
||||
tDebug() << Q_FUNC_INFO << "Connecting privacy toggle";
|
||||
connect( ActionCollection::instance()->getAction( "togglePrivacy" ), SIGNAL( triggered( bool ) ), this, SLOT( togglePrivateListeningMode() ) );
|
||||
#endif
|
||||
connect( this, SIGNAL( sendWaitingNotification() ), SLOT( sendWaitingNotificationSlot() ), Qt::QueuedConnection );
|
||||
|
||||
onVolumeChanged( m_audioOutput->volume() );
|
||||
|
||||
@@ -135,8 +131,11 @@ AudioEngine::play()
|
||||
|
||||
if ( isPaused() )
|
||||
{
|
||||
setVolume( m_volume );
|
||||
m_mediaObject->play();
|
||||
setVolume( m_volume );
|
||||
emit resumed();
|
||||
|
||||
Tomahawk::InfoSystem::InfoStringHash trackInfo;
|
||||
|
||||
trackInfo["title"] = m_currentTrack->track();
|
||||
@@ -156,6 +155,7 @@ AudioEngine::pause()
|
||||
{
|
||||
tDebug( LOGEXTRA ) << Q_FUNC_INFO;
|
||||
|
||||
m_volume = volume();
|
||||
m_mediaObject->pause();
|
||||
emit paused();
|
||||
|
||||
@@ -167,6 +167,8 @@ void
|
||||
AudioEngine::stop()
|
||||
{
|
||||
tDebug( LOGEXTRA ) << Q_FUNC_INFO;
|
||||
|
||||
emit stopped();
|
||||
if ( isStopped() )
|
||||
return;
|
||||
|
||||
@@ -178,20 +180,17 @@ 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 )
|
||||
{
|
||||
sendWaitingNotification();
|
||||
}
|
||||
emit sendWaitingNotification();
|
||||
else if ( TomahawkSettings::instance()->verboseNotifications() )
|
||||
{
|
||||
QVariantMap stopInfo;
|
||||
stopInfo["message"] = QString( "Tomahawk is stopped." );
|
||||
stopInfo["message"] = tr( "Tomahawk is stopped." );
|
||||
map[ Tomahawk::InfoSystem::InfoNotifyUser ] = QVariant::fromValue< QVariantMap >( stopInfo );
|
||||
}
|
||||
|
||||
@@ -234,12 +233,12 @@ AudioEngine::canGoNext()
|
||||
m_playlist.data()->skipRestrictions() == PlaylistInterface::NoSkipForwards )
|
||||
return false;
|
||||
|
||||
if ( !m_currentTrack.isNull() && !m_playlist.data()->hasNextItem() &&
|
||||
( m_playlist.data()->currentItem().isNull() || ( m_currentTrack->id() == m_playlist.data()->currentItem()->id() ) ) )
|
||||
if ( !m_currentTrack.isNull() && !m_playlist->hasNextItem() &&
|
||||
( m_playlist->currentItem().isNull() || ( m_currentTrack->id() == m_playlist->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";
|
||||
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";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -317,8 +316,13 @@ AudioEngine::mute()
|
||||
|
||||
|
||||
void
|
||||
AudioEngine::sendWaitingNotification() const
|
||||
AudioEngine::sendWaitingNotificationSlot() 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(
|
||||
@@ -330,62 +334,42 @@ AudioEngine::sendWaitingNotification() const
|
||||
void
|
||||
AudioEngine::sendNowPlayingNotification()
|
||||
{
|
||||
tDebug( LOGEXTRA ) << Q_FUNC_INFO;
|
||||
|
||||
if ( ! m_infoSystemConnected )
|
||||
#ifndef ENABLE_HEADLESS
|
||||
if ( m_currentTrack->album().isNull() || m_currentTrack->album()->infoLoaded() )
|
||||
onNowPlayingInfoReady();
|
||||
else
|
||||
{
|
||||
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;
|
||||
connect( m_currentTrack->album().data(), SIGNAL( updated() ), SLOT( onNowPlayingInfoReady() ), Qt::UniqueConnection );
|
||||
m_currentTrack->album()->cover( QSize( 0, 0 ) );
|
||||
}
|
||||
|
||||
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 );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
AudioEngine::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output )
|
||||
AudioEngine::onNowPlayingInfoReady()
|
||||
{
|
||||
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() : tr( " on album %1" ).arg( m_currentTrack->album()->name() ) );
|
||||
if ( !output.isNull() && output.isValid() )
|
||||
.arg( m_currentTrack->album().isNull() ? QString() : QString( " %1" ).arg( tr( "on album %1" ).arg( m_currentTrack->album()->name() ) ) );
|
||||
|
||||
if ( !m_currentTrack->album().isNull() )
|
||||
{
|
||||
QVariantMap returnedData = output.value< QVariantMap >();
|
||||
const QByteArray ba = returnedData["imgbytes"].toByteArray();
|
||||
if ( ba.length() )
|
||||
{
|
||||
QPixmap pm;
|
||||
pm.loadFromData( ba );
|
||||
playInfo["image"] = QVariant( pm.toImage() );
|
||||
}
|
||||
#ifndef ENABLE_HEADLESS
|
||||
QImage cover;
|
||||
cover = m_currentTrack->album()->cover( QSize( 0, 0 ) ).toImage();
|
||||
playInfo["image"] = QVariant( cover );
|
||||
#endif
|
||||
}
|
||||
|
||||
Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo(
|
||||
@@ -394,32 +378,6 @@ AudioEngine::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData,
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
AudioEngine::infoSystemFinished( QString caller )
|
||||
{
|
||||
Q_UNUSED( caller );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
AudioEngine::togglePrivateListeningMode()
|
||||
{
|
||||
tDebug() << Q_FUNC_INFO;
|
||||
if ( TomahawkSettings::instance()->privateListeningMode() == TomahawkSettings::PublicListening )
|
||||
TomahawkSettings::instance()->setPrivateListeningMode( TomahawkSettings::FullyPrivate );
|
||||
else
|
||||
TomahawkSettings::instance()->setPrivateListeningMode( TomahawkSettings::PublicListening );
|
||||
|
||||
#ifndef TOMAHAWK_HEADLESS
|
||||
QAction *privacyToggle = ActionCollection::instance()->getAction( "togglePrivacy" );
|
||||
bool isPublic = TomahawkSettings::instance()->privateListeningMode() == TomahawkSettings::PublicListening;
|
||||
privacyToggle->setText( tr( QString( isPublic ? "&Listen Privately" : "&Listen Publicly" ).toAscii().constData() ) );
|
||||
privacyToggle->setIconVisibleInMenu( isPublic );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool
|
||||
AudioEngine::loadTrack( const Tomahawk::result_ptr& result )
|
||||
{
|
||||
@@ -450,9 +408,6 @@ AudioEngine::loadTrack( const Tomahawk::result_ptr& result )
|
||||
tLog() << "Starting new song:" << m_currentTrack->url();
|
||||
emit loading( m_currentTrack );
|
||||
|
||||
if ( QNetworkReply* qnr_io = qobject_cast< QNetworkReply* >( io.data() ) )
|
||||
connect( qnr_io, SIGNAL( error( QNetworkReply::NetworkError ) ), this, SLOT( ioStreamError( QNetworkReply::NetworkError ) ) );
|
||||
|
||||
if ( !isHttpResult( m_currentTrack->url() ) && !isLocalResult( m_currentTrack->url() ) )
|
||||
{
|
||||
if ( QNetworkReply* qnr_io = qobject_cast< QNetworkReply* >( io.data() ) )
|
||||
@@ -460,7 +415,6 @@ AudioEngine::loadTrack( const Tomahawk::result_ptr& result )
|
||||
else
|
||||
m_mediaObject->setCurrentSource( io.data() );
|
||||
m_mediaObject->currentSource().setAutoDelete( false );
|
||||
m_isPlayingHttp = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -481,11 +435,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() )
|
||||
@@ -498,8 +452,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 );
|
||||
@@ -583,7 +537,7 @@ AudioEngine::loadNextTrack()
|
||||
|
||||
|
||||
void
|
||||
AudioEngine::playItem( Tomahawk::PlaylistInterface* playlist, const Tomahawk::result_ptr& result )
|
||||
AudioEngine::playItem( Tomahawk::playlistinterface_ptr playlist, const Tomahawk::result_ptr& result )
|
||||
{
|
||||
tDebug( LOGEXTRA ) << Q_FUNC_INFO << ( result.isNull() ? QString() : result->url() );
|
||||
|
||||
@@ -591,7 +545,7 @@ AudioEngine::playItem( Tomahawk::PlaylistInterface* playlist, const Tomahawk::re
|
||||
m_playlist.data()->reset();
|
||||
|
||||
setPlaylist( playlist );
|
||||
m_currentTrackPlaylist = playlist->getSharedPointer();
|
||||
m_currentTrackPlaylist = playlist;
|
||||
|
||||
if ( !result.isNull() )
|
||||
loadTrack( result );
|
||||
@@ -599,26 +553,24 @@ AudioEngine::playItem( Tomahawk::PlaylistInterface* playlist, const Tomahawk::re
|
||||
{
|
||||
m_waitingOnNewTrack = true;
|
||||
if ( isStopped() )
|
||||
sendWaitingNotification();
|
||||
emit sendWaitingNotification();
|
||||
else
|
||||
stop();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
AudioEngine::ioStreamError( QNetworkReply::NetworkError error )
|
||||
AudioEngine::onPlaylistNextTrackReady()
|
||||
{
|
||||
if ( error != QNetworkReply::NoError )
|
||||
// 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 ) ) )
|
||||
{
|
||||
if ( canGoNext() )
|
||||
loadNextTrack();
|
||||
m_waitingOnNewTrack = false;
|
||||
loadNextTrack();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
AudioEngine::playlistNextTrackReady()
|
||||
{
|
||||
if ( !m_waitingOnNewTrack )
|
||||
return;
|
||||
|
||||
@@ -642,7 +594,10 @@ 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 )
|
||||
@@ -714,26 +669,26 @@ AudioEngine::timerTriggered( qint64 time )
|
||||
|
||||
|
||||
void
|
||||
AudioEngine::setPlaylist( PlaylistInterface* playlist )
|
||||
AudioEngine::setPlaylist( Tomahawk::playlistinterface_ptr playlist )
|
||||
{
|
||||
if ( !m_playlist.isNull() )
|
||||
{
|
||||
if ( m_playlist.data()->object() && m_playlist.data()->retryMode() == PlaylistInterface::Retry )
|
||||
disconnect( m_playlist.data()->object(), SIGNAL( nextTrackReady() ) );
|
||||
if ( m_playlist.data() && m_playlist.data()->retryMode() == PlaylistInterface::Retry )
|
||||
disconnect( m_playlist.data(), SIGNAL( nextTrackReady() ) );
|
||||
m_playlist.data()->reset();
|
||||
}
|
||||
|
||||
if ( !playlist )
|
||||
if ( playlist.isNull() )
|
||||
{
|
||||
m_playlist.clear();
|
||||
emit playlistChanged( playlist );
|
||||
return;
|
||||
}
|
||||
|
||||
m_playlist = playlist->getSharedPointer();
|
||||
m_playlist = playlist;
|
||||
|
||||
if ( m_playlist.data()->object() && m_playlist.data()->retryMode() == PlaylistInterface::Retry )
|
||||
connect( m_playlist.data()->object(), SIGNAL( nextTrackReady() ), SLOT( playlistNextTrackReady() ) );
|
||||
if ( !m_playlist.isNull() && m_playlist.data() && m_playlist.data()->retryMode() == PlaylistInterface::Retry )
|
||||
connect( m_playlist.data(), SIGNAL( nextTrackReady() ), SLOT( onPlaylistNextTrackReady() ) );
|
||||
|
||||
emit playlistChanged( playlist );
|
||||
}
|
||||
|
@@ -19,34 +19,28 @@
|
||||
#ifndef AUDIOENGINE_H
|
||||
#define AUDIOENGINE_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QTimer>
|
||||
#include <QNetworkReply>
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/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 };
|
||||
enum AudioErrorCode { StreamReadError, AudioDeviceError, DecodeError, UnknownError };
|
||||
enum AudioState { Stopped, Playing, Paused };
|
||||
|
||||
static AudioEngine* instance();
|
||||
@@ -63,10 +57,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* currentTrackPlaylist() const { return m_currentTrackPlaylist.data(); }
|
||||
Tomahawk::playlistinterface_ptr currentTrackPlaylist() const { return m_currentTrackPlaylist; }
|
||||
|
||||
/* Returns the PlaylistInterface of the current playlist. Note: The currently playing track might still be from a different playlist! */
|
||||
Tomahawk::PlaylistInterface* playlist() const { return m_playlist.data(); }
|
||||
Tomahawk::playlistinterface_ptr playlist() const { return m_playlist; }
|
||||
|
||||
Tomahawk::result_ptr currentTrack() const { return m_currentTrack; }
|
||||
|
||||
@@ -91,19 +85,11 @@ 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* 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();
|
||||
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; }
|
||||
|
||||
signals:
|
||||
void loading( const Tomahawk::result_ptr& track );
|
||||
@@ -122,9 +108,11 @@ signals:
|
||||
void timerSeconds( unsigned int secondsElapsed );
|
||||
void timerPercentage( unsigned int percentage );
|
||||
|
||||
void playlistChanged( Tomahawk::PlaylistInterface* playlist );
|
||||
void playlistChanged( Tomahawk::playlistinterface_ptr playlist );
|
||||
|
||||
void error( AudioErrorCode errorCode );
|
||||
void error( AudioEngine::AudioErrorCode errorCode );
|
||||
|
||||
void sendWaitingNotification();
|
||||
|
||||
private slots:
|
||||
bool loadTrack( const Tomahawk::result_ptr& result );
|
||||
@@ -133,28 +121,30 @@ 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;
|
||||
|
||||
void ioStreamError( QNetworkReply::NetworkError );
|
||||
private:
|
||||
void setState( AudioState state );
|
||||
|
||||
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;
|
||||
QWeakPointer< Tomahawk::PlaylistInterface > m_playlist;
|
||||
QWeakPointer< Tomahawk::PlaylistInterface > m_currentTrackPlaylist;
|
||||
Tomahawk::PlaylistInterface* m_queue;
|
||||
Tomahawk::playlistinterface_ptr m_playlist;
|
||||
Tomahawk::playlistinterface_ptr m_currentTrackPlaylist;
|
||||
Tomahawk::playlistinterface_ptr m_queue;
|
||||
|
||||
Phonon::MediaObject* m_mediaObject;
|
||||
Phonon::AudioOutput* m_audioOutput;
|
||||
@@ -162,10 +152,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;
|
||||
};
|
||||
|
@@ -33,10 +33,12 @@ Collection::Collection( const source_ptr& source, const QString& name, QObject*
|
||||
: QObject( parent )
|
||||
, m_name( name )
|
||||
, m_lastmodified( 0 )
|
||||
, m_isLoaded( false )
|
||||
, m_changed( false )
|
||||
, m_source( source )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << name << source->friendlyName();
|
||||
|
||||
connect( source.data(), SIGNAL( synced() ), SLOT( onSynced() ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -147,24 +149,24 @@ Collection::deleteStation( const dynplaylist_ptr& s )
|
||||
}
|
||||
|
||||
|
||||
playlist_ptr
|
||||
Tomahawk::playlist_ptr
|
||||
Collection::playlist( const QString& guid )
|
||||
{
|
||||
return m_playlists.value( guid, playlist_ptr() );
|
||||
return m_playlists.value( guid, Tomahawk::playlist_ptr() );
|
||||
}
|
||||
|
||||
|
||||
dynplaylist_ptr
|
||||
Tomahawk::dynplaylist_ptr
|
||||
Collection::autoPlaylist( const QString& guid )
|
||||
{
|
||||
return m_autoplaylists.value( guid, dynplaylist_ptr() );
|
||||
return m_autoplaylists.value( guid, Tomahawk::dynplaylist_ptr() );
|
||||
}
|
||||
|
||||
|
||||
dynplaylist_ptr
|
||||
Tomahawk::dynplaylist_ptr
|
||||
Collection::station( const QString& guid )
|
||||
{
|
||||
return m_stations.value( guid, dynplaylist_ptr() );
|
||||
return m_stations.value( guid, Tomahawk::dynplaylist_ptr() );
|
||||
}
|
||||
|
||||
|
||||
@@ -209,20 +211,32 @@ Collection::setStations( const QList< dynplaylist_ptr >& stations )
|
||||
void
|
||||
Collection::setTracks( const QList<unsigned int>& ids )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << ids.count() << name();
|
||||
tDebug() << Q_FUNC_INFO << ids.count() << name();
|
||||
|
||||
m_changed = true;
|
||||
emit tracksAdded( ids );
|
||||
emit changed();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Collection::delTracks( const QList<unsigned int>& ids )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << ids.count() << name();
|
||||
tDebug() << Q_FUNC_INFO << ids.count() << name();
|
||||
|
||||
m_changed = true;
|
||||
emit tracksRemoved( ids );
|
||||
emit changed();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Collection::onSynced()
|
||||
{
|
||||
tDebug() << Q_FUNC_INFO << m_changed;
|
||||
if ( m_changed )
|
||||
{
|
||||
m_changed = false;
|
||||
emit changed();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@@ -49,8 +49,6 @@ public:
|
||||
Collection( const source_ptr& source, const QString& name, QObject* parent = 0 );
|
||||
virtual ~Collection();
|
||||
|
||||
virtual void setLoaded() { m_isLoaded = true; }
|
||||
virtual bool isLoaded() const { return m_isLoaded; }
|
||||
virtual QString name() const;
|
||||
|
||||
virtual void loadPlaylists() { qDebug() << Q_FUNC_INFO; }
|
||||
@@ -107,8 +105,11 @@ protected:
|
||||
QString m_name;
|
||||
unsigned int m_lastmodified; // unix time of last change to collection
|
||||
|
||||
private slots:
|
||||
void onSynced();
|
||||
|
||||
private:
|
||||
bool m_isLoaded;
|
||||
bool m_changed;
|
||||
|
||||
source_ptr m_source;
|
||||
QHash< QString, Tomahawk::playlist_ptr > m_playlists;
|
||||
|
@@ -43,7 +43,7 @@ public:
|
||||
virtual ~ContextPage() {}
|
||||
|
||||
virtual QGraphicsWidget* widget() = 0;
|
||||
virtual Tomahawk::PlaylistInterface* playlistInterface() const = 0;
|
||||
virtual Tomahawk::playlistinterface_ptr playlistInterface() const = 0;
|
||||
|
||||
virtual QString title() const = 0;
|
||||
virtual QString description() const = 0;
|
||||
@@ -52,7 +52,9 @@ public:
|
||||
virtual bool jumpToCurrentTrack() = 0;
|
||||
|
||||
public slots:
|
||||
virtual void setQuery( const Tomahawk::query_ptr& query ) = 0;
|
||||
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 ); }
|
||||
|
||||
signals:
|
||||
void nameChanged( const QString& );
|
||||
|
@@ -33,6 +33,7 @@
|
||||
#include "playlist/treemodel.h"
|
||||
|
||||
#include "utils/stylehelper.h"
|
||||
#include "utils/tomahawkutilsgui.h"
|
||||
|
||||
#define ANIMATION_TIME 450
|
||||
#define SLIDE_TIME 350
|
||||
@@ -93,6 +94,7 @@ ContextWidget::ContextWidget( QWidget* parent )
|
||||
setAutoFillBackground( true );
|
||||
setFixedHeight( m_minHeight );
|
||||
|
||||
ensurePolished();
|
||||
QPalette pal = palette();
|
||||
pal.setBrush( QPalette::Window, StyleHelper::headerLowerColor() );
|
||||
setPalette( pal );
|
||||
@@ -113,6 +115,22 @@ 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 )
|
||||
{
|
||||
@@ -212,6 +230,44 @@ 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 )
|
||||
{
|
||||
@@ -275,6 +331,8 @@ 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" ) );
|
||||
|
@@ -50,6 +50,8 @@ 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();
|
||||
@@ -63,6 +65,7 @@ private slots:
|
||||
protected:
|
||||
void paintEvent( QPaintEvent* e );
|
||||
void resizeEvent( QResizeEvent* e );
|
||||
void changeEvent( QEvent* e );
|
||||
|
||||
private:
|
||||
void fadeOut( bool animate );
|
||||
@@ -81,6 +84,8 @@ private:
|
||||
|
||||
int m_currentView;
|
||||
|
||||
Tomahawk::artist_ptr m_artist;
|
||||
Tomahawk::album_ptr m_album;
|
||||
Tomahawk::query_ptr m_query;
|
||||
bool m_visible;
|
||||
};
|
||||
|
@@ -32,10 +32,13 @@ 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 ) );
|
||||
@@ -58,15 +61,17 @@ RelatedArtistsContext::~RelatedArtistsContext()
|
||||
|
||||
|
||||
void
|
||||
RelatedArtistsContext::setQuery( const Tomahawk::query_ptr& query )
|
||||
RelatedArtistsContext::setArtist( const Tomahawk::artist_ptr& artist )
|
||||
{
|
||||
if ( !m_query.isNull() && query->artist() == m_query->artist() )
|
||||
if ( artist.isNull() )
|
||||
return;
|
||||
if ( !m_artist.isNull() && m_artist->name() == artist->name() )
|
||||
return;
|
||||
|
||||
m_query = query;
|
||||
m_artist = artist;
|
||||
|
||||
Tomahawk::InfoSystem::InfoStringHash artistInfo;
|
||||
artistInfo["artist"] = query->artist();
|
||||
artistInfo["artist"] = artist->name();
|
||||
|
||||
Tomahawk::InfoSystem::InfoRequestData requestData;
|
||||
requestData.caller = m_infoId;
|
||||
@@ -78,6 +83,26 @@ RelatedArtistsContext::setQuery( const Tomahawk::query_ptr& query )
|
||||
}
|
||||
|
||||
|
||||
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 )
|
||||
{
|
||||
@@ -89,9 +114,9 @@ RelatedArtistsContext::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData req
|
||||
|
||||
if ( output.canConvert< QVariantMap >() )
|
||||
{
|
||||
if ( trackInfo["artist"] != m_query->artist() )
|
||||
if ( trackInfo["artist"] != m_artist->name() )
|
||||
{
|
||||
qDebug() << "Returned info was for:" << trackInfo["artist"] << "- was looking for:" << m_query->artist();
|
||||
qDebug() << "Returned info was for:" << trackInfo["artist"] << "- was looking for:" << m_artist->name();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@@ -23,6 +23,8 @@
|
||||
|
||||
#include "dllmacro.h"
|
||||
|
||||
#include "artist.h"
|
||||
#include "album.h"
|
||||
#include "query.h"
|
||||
#include "context/ContextPage.h"
|
||||
#include "infosystem/infosystem.h"
|
||||
@@ -40,7 +42,7 @@ public:
|
||||
|
||||
virtual QGraphicsWidget* widget() { return m_proxy; }
|
||||
|
||||
virtual Tomahawk::PlaylistInterface* playlistInterface() const { return 0; }
|
||||
virtual Tomahawk::playlistinterface_ptr playlistInterface() const { return Tomahawk::playlistinterface_ptr(); }
|
||||
|
||||
virtual QString title() const { return tr( "Related Artists" ); }
|
||||
virtual QString description() const { return QString(); }
|
||||
@@ -48,6 +50,8 @@ 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:
|
||||
@@ -61,7 +65,7 @@ private:
|
||||
QGraphicsProxyWidget* m_proxy;
|
||||
|
||||
QString m_infoId;
|
||||
Tomahawk::query_ptr m_query;
|
||||
Tomahawk::artist_ptr m_artist;
|
||||
};
|
||||
|
||||
#endif // RELATEDARTISTSCONTEXT_H
|
||||
|
@@ -58,15 +58,17 @@ TopTracksContext::~TopTracksContext()
|
||||
|
||||
|
||||
void
|
||||
TopTracksContext::setQuery( const Tomahawk::query_ptr& query )
|
||||
TopTracksContext::setArtist( const Tomahawk::artist_ptr& artist )
|
||||
{
|
||||
if ( !m_query.isNull() && query->artist() == m_query->artist() )
|
||||
if ( artist.isNull() )
|
||||
return;
|
||||
if ( !m_artist.isNull() && m_artist->name() == artist->name() )
|
||||
return;
|
||||
|
||||
m_query = query;
|
||||
m_artist = artist;
|
||||
|
||||
Tomahawk::InfoSystem::InfoStringHash artistInfo;
|
||||
artistInfo["artist"] = query->artist();
|
||||
artistInfo["artist"] = artist->name();
|
||||
|
||||
Tomahawk::InfoSystem::InfoRequestData requestData;
|
||||
requestData.caller = m_infoId;
|
||||
@@ -78,6 +80,26 @@ TopTracksContext::setQuery( const Tomahawk::query_ptr& query )
|
||||
}
|
||||
|
||||
|
||||
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 )
|
||||
{
|
||||
@@ -89,9 +111,9 @@ TopTracksContext::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestD
|
||||
|
||||
if ( output.canConvert< QVariantMap >() )
|
||||
{
|
||||
if ( trackInfo["artist"] != m_query->artist() )
|
||||
if ( trackInfo["artist"] != m_artist->name() )
|
||||
{
|
||||
qDebug() << "Returned info was for:" << trackInfo["artist"] << "- was looking for:" << m_query->artist();
|
||||
qDebug() << "Returned info was for:" << trackInfo["artist"] << "- was looking for:" << m_artist->name();
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -107,7 +129,7 @@ TopTracksContext::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestD
|
||||
int i = 0;
|
||||
foreach ( const QString& track, tracks )
|
||||
{
|
||||
query_ptr query = Query::get( m_query->artist(), track, QString(), uuid() );
|
||||
query_ptr query = Query::get( m_artist->name(), track, QString(), uuid() );
|
||||
m_topHitsModel->append( query );
|
||||
|
||||
if ( ++i == 15 )
|
||||
|
@@ -23,6 +23,8 @@
|
||||
|
||||
#include "dllmacro.h"
|
||||
|
||||
#include "artist.h"
|
||||
#include "album.h"
|
||||
#include "query.h"
|
||||
#include "context/ContextPage.h"
|
||||
#include "infosystem/infosystem.h"
|
||||
@@ -40,7 +42,7 @@ public:
|
||||
|
||||
virtual QGraphicsWidget* widget() { return m_proxy; }
|
||||
|
||||
virtual Tomahawk::PlaylistInterface* playlistInterface() const { return 0; }
|
||||
virtual Tomahawk::playlistinterface_ptr playlistInterface() const { return Tomahawk::playlistinterface_ptr(); }
|
||||
|
||||
virtual QString title() const { return tr( "Top Hits" ); }
|
||||
virtual QString description() const { return QString(); }
|
||||
@@ -48,6 +50,8 @@ 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:
|
||||
@@ -61,7 +65,7 @@ private:
|
||||
QGraphicsProxyWidget* m_proxy;
|
||||
|
||||
QString m_infoId;
|
||||
Tomahawk::query_ptr m_query;
|
||||
Tomahawk::artist_ptr m_artist;
|
||||
};
|
||||
|
||||
#endif // TOPTRACKSCONTEXT_H
|
||||
|
@@ -22,22 +22,69 @@ using namespace Tomahawk;
|
||||
|
||||
|
||||
void
|
||||
WikipediaContext::setQuery( const Tomahawk::query_ptr& query )
|
||||
WikipediaContext::setArtist( const Tomahawk::artist_ptr& artist )
|
||||
{
|
||||
if ( !m_query.isNull() && query->artist() == m_query->artist() )
|
||||
if ( artist.isNull() )
|
||||
return;
|
||||
if ( !m_artist.isNull() && m_artist->name() == artist->name() )
|
||||
return;
|
||||
|
||||
m_query = query;
|
||||
webView()->load( QString( "http://en.wikipedia.org/w/index.php?useformat=mobile&title=%1" ).arg( query->artist() ) );
|
||||
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() )
|
||||
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() );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
LastfmContext::setQuery( const Tomahawk::query_ptr& query )
|
||||
{
|
||||
if ( !m_query.isNull() && query->artist() == m_query->artist() )
|
||||
if ( query.isNull() )
|
||||
return;
|
||||
|
||||
m_query = query;
|
||||
webView()->load( QString( "http://last.fm/music/%1" ).arg( query->artist() ) );
|
||||
setArtist( Artist::get( query->artist(), false ) );
|
||||
}
|
||||
|
@@ -23,6 +23,8 @@
|
||||
|
||||
#include "dllmacro.h"
|
||||
|
||||
#include "artist.h"
|
||||
#include "album.h"
|
||||
#include "query.h"
|
||||
#include "WebContext.h"
|
||||
|
||||
@@ -34,7 +36,7 @@ public:
|
||||
WikipediaContext() : WebContext() {}
|
||||
~WikipediaContext() {}
|
||||
|
||||
virtual Tomahawk::PlaylistInterface* playlistInterface() const { return 0; }
|
||||
virtual Tomahawk::playlistinterface_ptr playlistInterface() const { return Tomahawk::playlistinterface_ptr(); }
|
||||
|
||||
virtual QString title() const { return tr( "Wikipedia" ); }
|
||||
virtual QString description() const { return QString(); }
|
||||
@@ -42,10 +44,12 @@ 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::query_ptr m_query;
|
||||
Tomahawk::artist_ptr m_artist;
|
||||
};
|
||||
|
||||
|
||||
@@ -57,7 +61,7 @@ public:
|
||||
LastfmContext() : WebContext() {}
|
||||
~LastfmContext() {}
|
||||
|
||||
virtual Tomahawk::PlaylistInterface* playlistInterface() const { return 0; }
|
||||
virtual Tomahawk::playlistinterface_ptr playlistInterface() const { return Tomahawk::playlistinterface_ptr(); }
|
||||
|
||||
virtual QString title() const { return tr( "Last.fm" ); }
|
||||
virtual QString description() const { return QString(); }
|
||||
@@ -65,10 +69,12 @@ 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::query_ptr m_query;
|
||||
Tomahawk::artist_ptr m_artist;
|
||||
};
|
||||
|
||||
#endif // WIKIPEDIACONTEXT_H
|
||||
|
@@ -32,15 +32,19 @@ 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;
|
||||
m_supportedActions = ActionPlay | ActionQueue | ActionCopyLink | ActionLove;
|
||||
}
|
||||
|
||||
|
||||
ContextMenu::~ContextMenu()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ContextMenu::clear()
|
||||
@@ -50,23 +54,22 @@ 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;
|
||||
@@ -79,19 +82,26 @@ 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() ) );
|
||||
}
|
||||
}
|
||||
@@ -107,7 +117,6 @@ ContextMenu::setQuery( const Tomahawk::query_ptr& query )
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
ContextMenu::setAlbums( const QList<Tomahawk::album_ptr>& albums )
|
||||
{
|
||||
@@ -119,7 +128,7 @@ ContextMenu::setAlbums( const QList<Tomahawk::album_ptr>& albums )
|
||||
m_albums << albums;
|
||||
|
||||
if ( m_supportedActions & ActionPlay && itemCount() == 1 )
|
||||
m_sigmap->setMapping( addAction( tr( "&Play" ) ), ActionPlay );
|
||||
m_sigmap->setMapping( addAction( tr( "Show &Album page" ) ), ActionPlay );
|
||||
|
||||
if ( m_supportedActions & ActionQueue )
|
||||
m_sigmap->setMapping( addAction( tr( "Add to &Queue" ) ), ActionQueue );
|
||||
@@ -158,7 +167,7 @@ ContextMenu::setArtists( const QList<Tomahawk::artist_ptr>& artists )
|
||||
m_artists << artists;
|
||||
|
||||
if ( m_supportedActions & ActionPlay && itemCount() == 1 )
|
||||
m_sigmap->setMapping( addAction( tr( "&Play" ) ), ActionPlay );
|
||||
m_sigmap->setMapping( addAction( tr( "Show &Artist page" ) ), ActionPlay );
|
||||
|
||||
if ( m_supportedActions & ActionQueue )
|
||||
m_sigmap->setMapping( addAction( tr( "Add to &Queue" ) ), ActionQueue );
|
||||
@@ -185,6 +194,7 @@ ContextMenu::setArtist( const Tomahawk::artist_ptr& artist )
|
||||
setArtists( artists );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ContextMenu::onTriggered( int action )
|
||||
{
|
||||
@@ -198,6 +208,10 @@ ContextMenu::onTriggered( int action )
|
||||
copyLink();
|
||||
break;
|
||||
|
||||
case ActionLove:
|
||||
m_queries.first()->setLoved( !m_queries.first()->loved() );
|
||||
break;
|
||||
|
||||
default:
|
||||
emit triggered( action );
|
||||
}
|
||||
@@ -205,7 +219,8 @@ ContextMenu::onTriggered( int action )
|
||||
|
||||
|
||||
|
||||
void ContextMenu::addToQueue()
|
||||
void
|
||||
ContextMenu::addToQueue()
|
||||
{
|
||||
foreach ( const query_ptr& query, m_queries )
|
||||
{
|
||||
@@ -232,3 +247,19 @@ 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" ) );
|
||||
}
|
||||
}
|
||||
|
@@ -19,8 +19,8 @@
|
||||
#ifndef CONTEXTMENU_H
|
||||
#define CONTEXTMENU_H
|
||||
|
||||
#include <QSignalMapper>
|
||||
#include <QMenu>
|
||||
#include <QtCore/QSignalMapper>
|
||||
#include <QtGui/QMenu>
|
||||
|
||||
#include "typedefs.h"
|
||||
#include "dllmacro.h"
|
||||
@@ -38,8 +38,8 @@ public:
|
||||
ActionPlay = 1,
|
||||
ActionQueue = 2,
|
||||
ActionDelete = 4,
|
||||
ActionCopyLink = 8
|
||||
|
||||
ActionCopyLink = 8,
|
||||
ActionLove = 16
|
||||
};
|
||||
|
||||
explicit ContextMenu( QWidget* parent = 0 );
|
||||
@@ -69,10 +69,14 @@ 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;
|
||||
|
@@ -73,7 +73,15 @@ Database::loadIndex()
|
||||
|
||||
|
||||
void
|
||||
Database::enqueue( QSharedPointer<DatabaseCommand> lc )
|
||||
Database::enqueue( const QList< QSharedPointer<DatabaseCommand> >& lc )
|
||||
{
|
||||
qDebug() << "Enqueueing" << lc.count() << "commands to rw thread";
|
||||
m_workerRW->enqueue( lc );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Database::enqueue( const QSharedPointer<DatabaseCommand>& lc )
|
||||
{
|
||||
if ( lc->doesMutates() )
|
||||
{
|
||||
|
@@ -66,7 +66,8 @@ signals:
|
||||
void newJobRW( QSharedPointer<DatabaseCommand> );
|
||||
|
||||
public slots:
|
||||
void enqueue( QSharedPointer<DatabaseCommand> lc );
|
||||
void enqueue( const QSharedPointer<DatabaseCommand>& lc );
|
||||
void enqueue( const QList< QSharedPointer<DatabaseCommand> >& lc );
|
||||
|
||||
private slots:
|
||||
void setIsReadyTrue() { m_ready = true; }
|
||||
|
@@ -69,22 +69,8 @@ DatabaseCollection::loadStations()
|
||||
connect( cmd, SIGNAL( stationLoaded( Tomahawk::source_ptr, QVariantList ) ),
|
||||
SLOT( stationCreated( const Tomahawk::source_ptr&, const QVariantList& ) ) );
|
||||
|
||||
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( cmd ) );}
|
||||
|
||||
|
||||
/*void
|
||||
DatabaseCollection::loadTracks()
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << source()->userName();
|
||||
|
||||
setLoaded();
|
||||
DatabaseCommand_AllTracks* cmd = new DatabaseCommand_AllTracks( source()->collection() );
|
||||
|
||||
connect( cmd, SIGNAL( tracks( QList<Tomahawk::query_ptr>, QVariant ) ),
|
||||
SLOT( setTracks( QList<Tomahawk::query_ptr> ) ) );
|
||||
|
||||
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( cmd ) );
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
@@ -143,19 +129,8 @@ DatabaseCollection::stations()
|
||||
}
|
||||
|
||||
|
||||
/*QList< Tomahawk::query_ptr >
|
||||
DatabaseCollection::tracks()
|
||||
{
|
||||
if ( !isLoaded() )
|
||||
{
|
||||
loadTracks();
|
||||
}
|
||||
|
||||
return Collection::tracks();
|
||||
}*/
|
||||
|
||||
|
||||
void DatabaseCollection::autoPlaylistCreated( const source_ptr& source, const QVariantList& data )
|
||||
void
|
||||
DatabaseCollection::autoPlaylistCreated( const source_ptr& source, const QVariantList& data )
|
||||
{
|
||||
dynplaylist_ptr p( new DynamicPlaylist( source, //src
|
||||
data[0].toString(), //current rev
|
||||
@@ -167,12 +142,13 @@ void DatabaseCollection::autoPlaylistCreated( const source_ptr& source, const QV
|
||||
static_cast<GeneratorMode>(data[6].toInt()), // dynamic mode
|
||||
data[7].toBool(), //shared
|
||||
data[8].toInt(), //lastmod
|
||||
data[9].toString() ) ); //GUID
|
||||
data[9].toString() ), &QObject::deleteLater ); //GUID
|
||||
addAutoPlaylist( p );
|
||||
}
|
||||
|
||||
|
||||
void DatabaseCollection::stationCreated( const source_ptr& source, const QVariantList& data )
|
||||
void
|
||||
DatabaseCollection::stationCreated( const source_ptr& source, const QVariantList& data )
|
||||
{
|
||||
dynplaylist_ptr p( new DynamicPlaylist( source, //src
|
||||
data[0].toString(), //current rev
|
||||
@@ -184,7 +160,7 @@ void DatabaseCollection::stationCreated( 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() ) ); //GUID
|
||||
data[9].toString() ), &QObject::deleteLater ); //GUID
|
||||
addStation( p );
|
||||
}
|
||||
|
||||
|
@@ -80,12 +80,14 @@ DatabaseCommand::setSource( const Tomahawk::source_ptr& s )
|
||||
m_source = s;
|
||||
}
|
||||
|
||||
|
||||
const Tomahawk::source_ptr&
|
||||
DatabaseCommand::source() const
|
||||
{
|
||||
return m_source;
|
||||
}
|
||||
|
||||
|
||||
DatabaseCommand*
|
||||
DatabaseCommand::factory( const QVariant& op, const source_ptr& source )
|
||||
{
|
||||
@@ -139,7 +141,8 @@ DatabaseCommand::factory( const QVariant& op, const source_ptr& source )
|
||||
cmd->setSource( source );
|
||||
QJson::QObjectHelper::qvariant2qobject( op.toMap(), cmd );
|
||||
return cmd;
|
||||
} else if( name == "createdynamicplaylist" )
|
||||
}
|
||||
else if( name == "createdynamicplaylist" )
|
||||
{
|
||||
DatabaseCommand_CreateDynamicPlaylist * cmd = new DatabaseCommand_CreateDynamicPlaylist;
|
||||
cmd->setSource( source );
|
||||
@@ -183,7 +186,7 @@ DatabaseCommand::factory( const QVariant& op, const source_ptr& source )
|
||||
return cmd;
|
||||
}
|
||||
|
||||
qDebug() << "ERROR in" << Q_FUNC_INFO << name;
|
||||
qDebug() << "Unknown database command" << name;
|
||||
// Q_ASSERT( false );
|
||||
return NULL;
|
||||
}
|
||||
|
@@ -70,6 +70,7 @@ public:
|
||||
const Tomahawk::source_ptr& source() const;
|
||||
|
||||
virtual bool loggable() const { return false; }
|
||||
virtual bool groupable() const { return false; }
|
||||
virtual bool singletonCmd() const { return false; }
|
||||
virtual bool localOnly() const { return false; }
|
||||
|
||||
|
@@ -24,7 +24,6 @@
|
||||
#include "album.h"
|
||||
#include "collection.h"
|
||||
#include "database/database.h"
|
||||
#include "databasecommand_collectionstats.h"
|
||||
#include "databaseimpl.h"
|
||||
#include "network/dbsyncconnection.h"
|
||||
#include "network/servent.h"
|
||||
@@ -56,32 +55,17 @@ 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 );
|
||||
|
||||
if ( source()->isLocal() )
|
||||
{
|
||||
Servent::instance()->triggerDBSync();
|
||||
|
||||
// Re-calculate local db stats
|
||||
DatabaseCommand_CollectionStats* cmd = new DatabaseCommand_CollectionStats( SourceList::instance()->getLocal() );
|
||||
connect( cmd, SIGNAL( done( QVariantMap ) ),
|
||||
SourceList::instance()->getLocal().data(), SLOT( setStats( QVariantMap ) ), Qt::QueuedConnection );
|
||||
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( cmd ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -94,24 +78,23 @@ 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) VALUES (?, ?, ?, ?, ?)" );
|
||||
query_filejoin.prepare( "INSERT INTO file_join(file, artist, album, track, albumpos, composer, discnumber) 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();
|
||||
@@ -123,12 +106,10 @@ 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 );
|
||||
@@ -137,28 +118,17 @@ DatabaseCommand_AddFiles::exec( DatabaseImpl* dbi )
|
||||
query_file.bindValue( 5, mimetype );
|
||||
query_file.bindValue( 6, duration );
|
||||
query_file.bindValue( 7, bitrate );
|
||||
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;
|
||||
}
|
||||
query_file.exec();
|
||||
|
||||
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;
|
||||
@@ -167,12 +137,17 @@ 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";
|
||||
@@ -184,33 +159,6 @@ 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++;
|
||||
}
|
||||
@@ -219,6 +167,6 @@ DatabaseCommand_AddFiles::exec( DatabaseImpl* dbi )
|
||||
if ( added )
|
||||
source()->updateIndexWhenSynced();
|
||||
|
||||
qDebug() << "Committing" << added << "tracks...";
|
||||
tDebug() << "Committing" << added << "tracks...";
|
||||
emit done( m_files, source()->collection() );
|
||||
}
|
||||
|
@@ -35,20 +35,21 @@ DatabaseCommand_addSource::DatabaseCommand_addSource( const QString& username, c
|
||||
void
|
||||
DatabaseCommand_addSource::exec( DatabaseImpl* dbi )
|
||||
{
|
||||
Q_ASSERT( !m_fname.isEmpty() );
|
||||
|
||||
TomahawkSqlQuery query = dbi->newquery();
|
||||
query.prepare( "SELECT id, friendlyname FROM source WHERE name = ?" );
|
||||
query.prepare( "SELECT id FROM source WHERE name = ?" );
|
||||
query.addBindValue( m_username );
|
||||
query.exec();
|
||||
|
||||
if ( query.next() )
|
||||
{
|
||||
unsigned int id = query.value( 0 ).toInt();
|
||||
QString fname = query.value( 1 ).toString();
|
||||
query.prepare( "UPDATE source SET isonline = 'true', friendlyname = ? WHERE id = ?" );
|
||||
query.addBindValue( m_fname );
|
||||
query.addBindValue( id );
|
||||
query.exec();
|
||||
emit done( id, fname );
|
||||
emit done( id, m_fname );
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -59,7 +60,7 @@ DatabaseCommand_addSource::exec( DatabaseImpl* dbi )
|
||||
query.exec();
|
||||
|
||||
unsigned int id = query.lastInsertId().toUInt();
|
||||
qDebug() << "Inserted new source to DB, id:" << id << " friendlyname" << m_username;
|
||||
tDebug() << "Inserted new source to DB, id:" << id << "friendlyname" << m_username;
|
||||
|
||||
emit done( id, m_fname );
|
||||
}
|
||||
|
@@ -23,6 +23,7 @@
|
||||
#include <QVariantMap>
|
||||
|
||||
#include "artist.h"
|
||||
#include "collection.h"
|
||||
#include "typedefs.h"
|
||||
#include "databasecommand.h"
|
||||
|
||||
|
@@ -40,7 +40,7 @@ DatabaseCommand_AllTracks::exec( DatabaseImpl* dbi )
|
||||
break;
|
||||
|
||||
case Album:
|
||||
m_orderToken = "album.name, file_join.albumpos";
|
||||
m_orderToken = "album.name, file_join.discnumber, file_join.albumpos";
|
||||
break;
|
||||
|
||||
case ModificationTime:
|
||||
@@ -48,7 +48,7 @@ DatabaseCommand_AllTracks::exec( DatabaseImpl* dbi )
|
||||
break;
|
||||
|
||||
case AlbumPosition:
|
||||
m_orderToken = "file_join.albumpos";
|
||||
m_orderToken = "file_join.discnumber, file_join.albumpos";
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ DatabaseCommand_AllTracks::exec( DatabaseImpl* dbi )
|
||||
{
|
||||
if ( m_album->id() == 0 )
|
||||
{
|
||||
m_artist = m_album->artist().data();
|
||||
m_artist = m_album->artist();
|
||||
albumToken = QString( "AND album.id IS NULL" );
|
||||
}
|
||||
else
|
||||
@@ -68,11 +68,15 @@ DatabaseCommand_AllTracks::exec( DatabaseImpl* dbi )
|
||||
}
|
||||
|
||||
QString sql = QString(
|
||||
"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 "
|
||||
"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
|
||||
"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 "
|
||||
@@ -92,15 +96,15 @@ DatabaseCommand_AllTracks::exec( DatabaseImpl* dbi )
|
||||
while( query.next() )
|
||||
{
|
||||
Tomahawk::source_ptr s;
|
||||
QString url = query.value( 7 ).toString();
|
||||
QString url = query.value( 8 ).toString();
|
||||
|
||||
if ( query.value( 8 ).toUInt() == 0 )
|
||||
if ( query.value( 9 ).toUInt() == 0 )
|
||||
{
|
||||
s = SourceList::instance()->getLocal();
|
||||
}
|
||||
else
|
||||
{
|
||||
s = SourceList::instance()->get( query.value( 8 ).toUInt() );
|
||||
s = SourceList::instance()->get( query.value( 9 ).toUInt() );
|
||||
if ( s.isNull() )
|
||||
{
|
||||
Q_ASSERT( false );
|
||||
@@ -110,26 +114,30 @@ DatabaseCommand_AllTracks::exec( DatabaseImpl* dbi )
|
||||
url = QString( "servent://%1\t%2" ).arg( s->userName() ).arg( url );
|
||||
}
|
||||
|
||||
QString artist, track, album;
|
||||
QString artist, track, album, composer;
|
||||
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( 12 ).toUInt(), artist );
|
||||
Tomahawk::album_ptr albumptr = Tomahawk::Album::get( query.value( 13 ).toUInt(), album, artistptr );
|
||||
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 );
|
||||
|
||||
result->setTrackId( query.value( 14 ).toUInt() );
|
||||
result->setTrackId( query.value( 16 ).toUInt() );
|
||||
result->setArtist( artistptr );
|
||||
result->setAlbum( albumptr );
|
||||
result->setTrack( query.value( 3 ).toString() );
|
||||
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->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->setScore( 1.0 );
|
||||
result->setCollection( s->collection() );
|
||||
|
||||
|
@@ -26,6 +26,8 @@
|
||||
#include "collection.h"
|
||||
#include "typedefs.h"
|
||||
#include "query.h"
|
||||
#include "artist.h"
|
||||
#include "album.h"
|
||||
|
||||
#include "dllmacro.h"
|
||||
|
||||
@@ -55,8 +57,8 @@ public:
|
||||
virtual bool doesMutates() const { return false; }
|
||||
virtual QString commandname() const { return "alltracks"; }
|
||||
|
||||
void setArtist( Tomahawk::Artist* artist ) { m_artist = artist; }
|
||||
void setAlbum( Tomahawk::Album* album ) { m_album = album; }
|
||||
void setArtist( const Tomahawk::artist_ptr& artist ) { m_artist = artist; }
|
||||
void setAlbum( const Tomahawk::album_ptr& album ) { m_album = album; }
|
||||
|
||||
void setLimit( unsigned int amount ) { m_amount = amount; }
|
||||
void setSortOrder( DatabaseCommand_AllTracks::SortOrder order ) { m_sortOrder = order; }
|
||||
@@ -69,8 +71,8 @@ signals:
|
||||
private:
|
||||
Tomahawk::collection_ptr m_collection;
|
||||
|
||||
Tomahawk::Artist* m_artist;
|
||||
Tomahawk::Album* m_album;
|
||||
Tomahawk::artist_ptr m_artist;
|
||||
Tomahawk::album_ptr m_album;
|
||||
|
||||
unsigned int m_amount;
|
||||
DatabaseCommand_AllTracks::SortOrder m_sortOrder;
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||
*
|
||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||
* Copyright 2010-2011, Leo Franchi <lfranchi@kde.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,10 +28,13 @@
|
||||
#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;
|
||||
|
||||
|
||||
@@ -111,11 +114,13 @@ 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 );
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||
*
|
||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||
* Copyright 2010-2011, Leo Franchi <lfranchi@kde.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
|
||||
|
@@ -21,12 +21,15 @@
|
||||
#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;
|
||||
|
||||
|
||||
@@ -79,11 +82,13 @@ 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
|
||||
{
|
||||
|
@@ -18,15 +18,14 @@
|
||||
|
||||
#include "databasecommand_deletefiles.h"
|
||||
|
||||
#include <QSqlQuery>
|
||||
#include <QtSql/QSqlQuery>
|
||||
|
||||
#include "artist.h"
|
||||
#include "album.h"
|
||||
#include "collection.h"
|
||||
#include "source.h"
|
||||
#include "database/database.h"
|
||||
#include "databasecommand_collectionstats.h"
|
||||
#include "databaseimpl.h"
|
||||
#include "database/databaseimpl.h"
|
||||
#include "network/servent.h"
|
||||
#include "utils/logger.h"
|
||||
#include "utils/tomahawkutils.h"
|
||||
@@ -38,7 +37,7 @@ using namespace Tomahawk;
|
||||
void
|
||||
DatabaseCommand_DeleteFiles::postCommitHook()
|
||||
{
|
||||
if ( !m_files.count() )
|
||||
if ( !m_idList.count() )
|
||||
return;
|
||||
|
||||
// make the collection object emit its tracksAdded signal, so the
|
||||
@@ -48,13 +47,10 @@ DatabaseCommand_DeleteFiles::postCommitHook()
|
||||
connect( this, SIGNAL( notify( QList<unsigned int> ) ),
|
||||
coll, SLOT( delTracks( QList<unsigned int> ) ), Qt::QueuedConnection );
|
||||
|
||||
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 );
|
||||
tDebug() << "Notifying of deleted tracks:" << m_idList.size() << "from source" << source()->id();
|
||||
emit notify( m_idList );
|
||||
|
||||
if( source()->isLocal() )
|
||||
if ( source()->isLocal() )
|
||||
Servent::instance()->triggerDBSync();
|
||||
}
|
||||
|
||||
@@ -64,113 +60,80 @@ DatabaseCommand_DeleteFiles::exec( DatabaseImpl* dbi )
|
||||
{
|
||||
Q_ASSERT( !source().isNull() );
|
||||
|
||||
QVariant srcid = source()->isLocal() ? QVariant( QVariant::Int ) : source()->id();
|
||||
int srcid = source()->isLocal() ? 0 : source()->id();
|
||||
TomahawkSqlQuery delquery = dbi->newquery();
|
||||
QString lastPath;
|
||||
|
||||
if ( source()->isLocal() )
|
||||
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 ( 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, url FROM file WHERE source IS NULL AND url LIKE '%1'" ).arg( TomahawkUtils::sqlEscape( path ) ) );
|
||||
dirquery.prepare( QString( "SELECT id FROM file WHERE source IS NULL AND url LIKE '%1'" ).arg( TomahawkUtils::sqlEscape( path ) ) );
|
||||
dirquery.exec();
|
||||
|
||||
while ( dirquery.next() )
|
||||
{
|
||||
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();
|
||||
m_ids << dirquery.value( 0 );
|
||||
m_idList << dirquery.value( 0 ).toUInt();
|
||||
}
|
||||
}
|
||||
else if ( !m_ids.isEmpty() )
|
||||
{
|
||||
tDebug() << Q_FUNC_INFO << "deleting given ids";
|
||||
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();
|
||||
}
|
||||
foreach ( const QVariant& id, m_ids )
|
||||
m_idList << id.toUInt();
|
||||
}
|
||||
else if ( m_deleteAll )
|
||||
{
|
||||
TomahawkSqlQuery dirquery = dbi->newquery();
|
||||
|
||||
dirquery.prepare( QString( "SELECT id, url FROM file WHERE source IS NULL" ) );
|
||||
|
||||
dirquery.exec();
|
||||
while ( dirquery.next() )
|
||||
{
|
||||
m_ids << dirquery.value( 0 ).toString();
|
||||
m_files << dirquery.value( 1 ).toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( m_deleteAll )
|
||||
{
|
||||
TomahawkSqlQuery dirquery = dbi->newquery();
|
||||
|
||||
dirquery.prepare( QString( "SELECT url FROM file WHERE source = %1" ).arg( source()->id() ) );
|
||||
dirquery.exec();
|
||||
|
||||
while ( dirquery.next() )
|
||||
m_ids << dirquery.value( 0 ).toString();
|
||||
}
|
||||
|
||||
foreach( const QVariant& id, m_ids )
|
||||
m_files << QString( "servent://%1\t%2" ).arg( source()->userName() ).arg( id.toString() );
|
||||
}
|
||||
|
||||
if ( m_deleteAll )
|
||||
{
|
||||
if ( !m_ids.isEmpty() )
|
||||
{
|
||||
delquery.prepare( QString( "DELETE FROM file WHERE source %1" )
|
||||
.arg( source()->isLocal() ? "IS NULL" : QString( "= %1" ).arg( source()->id() ) ) );
|
||||
|
||||
delquery.exec();
|
||||
}
|
||||
delquery.prepare( QString( "DELETE FROM file WHERE source %1" )
|
||||
.arg( source()->isLocal() ? "IS NULL" : QString( "= %1" ).arg( source()->id() ) ) );
|
||||
delquery.exec();
|
||||
}
|
||||
else if ( !m_ids.isEmpty() )
|
||||
{
|
||||
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 ", "
|
||||
|
||||
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 ) );
|
||||
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 )" )
|
||||
.arg( source()->isLocal() ? "IS NULL" : QString( "= %1" ).arg( source()->id() ) )
|
||||
.arg( idstring ) );
|
||||
delquery.exec();
|
||||
}
|
||||
|
||||
emit done( m_files, source()->collection() );
|
||||
if ( m_idList.count() )
|
||||
source()->updateIndexWhenSynced();
|
||||
|
||||
emit done( m_idList, source()->collection() );
|
||||
}
|
||||
|