Compare commits
1 Commits
qtkeychain
...
twitterfix
Author | SHA1 | Date | |
---|---|---|---|
|
37ca79aa61 |
@@ -25,7 +25,6 @@ option(BUILD_GUI "Build Tomahawk with GUI" ON)
|
||||
option(BUILD_RELEASE "Generate TOMAHAWK_VERSION without GIT info" OFF)
|
||||
option(WITH_BREAKPAD "Build with breakpad integration" ON)
|
||||
option(WITH_CRASHREPORTER "Build with CrashReporter" ON)
|
||||
option(WITH_BINARY_ATTICA "Enable support for downloading binary resolvers automatically" ON)
|
||||
option(LEGACY_KDE_INTEGRATION "Install tomahawk.protocol file, deprecated since 4.6.0" OFF)
|
||||
|
||||
IF( CMAKE_SYSTEM_PROCESSOR MATCHES "arm" )
|
||||
@@ -159,17 +158,6 @@ SET( LIBPORTFWD_LIBRARY tomahawk_portfwd )
|
||||
SET( LIBPORTFWD_LIBRARIES ${LIBPORTFWD_LIBRARY} )
|
||||
ADD_SUBDIRECTORY( ${THIRDPARTY_DIR}/libportfwd )
|
||||
|
||||
### qtkeychain
|
||||
SET( QTKEYCHAIN_INCLUDE_DIRS ${THIRDPARTY_DIR}/qtkeychain )
|
||||
SET( QTKEYCHAIN_LIBRARY qtkeychain )
|
||||
SET( QTKEYCHAIN_LIBRARIES ${QTKEYCHAIN_LIBRARY} )
|
||||
ADD_SUBDIRECTORY( ${THIRDPARTY_DIR}/qtkeychain/qtkeychain )
|
||||
|
||||
if( NOT QTKEYCHAIN_INCLUDE_DIRS OR NOT QTKEYCHAIN_LIBRARIES )
|
||||
macro_optional_find_package(QtKeychain)
|
||||
macro_log_feature(QTKEYCHAIN_FOUND "QtKeychain" "Provides support for secure password storage" "https://github.com/frankosterfeld/qtkeychain" TRUE "" "")
|
||||
endif()
|
||||
|
||||
# we need pthreads too
|
||||
#macro_optional_find_package(Threads)
|
||||
#macro_log_feature(THREADS_FOUND "Threads" "Threading Library" "" TRUE "" "Platform specific library for threading")
|
||||
|
23
CMakeModules/FindGloox.cmake
Normal file
@@ -0,0 +1,23 @@
|
||||
# - Try to find GLOOX
|
||||
# Find GLOOX headers, libraries and the answer to all questions.
|
||||
#
|
||||
# GLOOX_FOUND True if gloox got found
|
||||
# GLOOX_INCLUDE_DIR Location of gloox headers
|
||||
# GLOOX_LIBRARIES List of libaries to use gloox
|
||||
#
|
||||
# Copyright (c) 2009 Nigmatullin Ruslan <euroelessar@gmail.com>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the New
|
||||
# BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
#
|
||||
|
||||
FIND_PATH( GLOOX_INCLUDE_DIR "gloox/gloox.h" )
|
||||
FIND_LIBRARY( GLOOX_LIBRARIES gloox )
|
||||
|
||||
if( GLOOX_LIBRARIES AND GLOOX_INCLUDE_DIR )
|
||||
message( STATUS "Found gloox: ${GLOOX_LIBRARIES}" )
|
||||
set( GLOOX_FOUND 1 )
|
||||
else( GLOOX_LIBRARIES AND GLOOX_INCLUDE_DIR )
|
||||
message( STATUS "Could NOT find gloox" )
|
||||
endif( GLOOX_LIBRARIES AND GLOOX_INCLUDE_DIR )
|
@@ -30,6 +30,7 @@ ENDIF()
|
||||
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Jreen
|
||||
REQUIRED_VARS JREEN_LIBRARIES JREEN_INCLUDE_DIR)
|
||||
REQUIRED_VARS JREEN_LIBRARIES JREEN_INCLUDE_DIR
|
||||
VERSION_VAR PC_JREEN_VERSION)
|
||||
|
||||
MARK_AS_ADVANCED(JREEN_INCLUDE_DIR JREEN_LIBRARIES)
|
||||
|
34
ChangeLog
@@ -1,32 +1,12 @@
|
||||
Version 0.5.0:
|
||||
* Priortize resolution of a track on double-click
|
||||
* New Tomahawk logo and icon
|
||||
* Spotify Resolver shipped with Tomahawk and installable via new Preferences interface
|
||||
* Sync select playlists (and updates) with Spotify
|
||||
* Support .aiff (AIFF mimetype) files
|
||||
* Cleaned up Diagnostics window
|
||||
* Don't show non-resolved tracks as Recently Played
|
||||
* Added "Stop playback after this track" context menu items
|
||||
* Double-clicking on a playlist name (in the sidebar) will play the playlist
|
||||
* You can now import your entire Last.fm playback history into Tomahawk
|
||||
* Related Artists now sorted by relatedness
|
||||
* Support for multimedia keys (Play, Pause, Next etc.) on Windows & Linux
|
||||
* When listening privately scrobbling to Last.fm and Adium is now disabled
|
||||
* Added a toolbar with page back / forward buttons and the global search
|
||||
* New grid view with direct playback controls (Charts, Album Page, Artist Page, Track Page)
|
||||
* New Releases (by Genre) pages added
|
||||
* Add social sharing widget in Now Playing Controls
|
||||
* Added a track page showing a song's lyrics and other similar tracks
|
||||
* Selecting Track name in Now Playing now brings you to Track page
|
||||
* Added "Stop playback after this track" context menu items.
|
||||
* You can now import your entire Last.fm playback history into Tomahawk.
|
||||
* Support for multimedia keys (Play, Pause, Next etc.) on Windows & Linux.
|
||||
* When listening privately scrobbling to Last.fm is now disabled.
|
||||
* Added a toolbar with page back / forward buttons and the global search.
|
||||
* New grid view with direct playback controls.
|
||||
* Added a track page showing a song's lyrics and other similar tracks.
|
||||
* Separate Loved Tracks and Recently Played views per source.
|
||||
* Added animated spinner where needed
|
||||
* Some new sidebar icons
|
||||
* Support Transifex for localization and add translations for Arabic, French, Bulgarian, Catalan, Spanish (Castillian), and more.
|
||||
* New Context Menu items (Love, Add to Queue, etc.)
|
||||
* Fading album art
|
||||
* New Account and Plug-in Preferences/Management Interface
|
||||
* Fix XSPF auto-updating
|
||||
|
||||
|
||||
Version 0.4.2:
|
||||
* Fix ZeroConf protocol showing IP addresses instead of host names.
|
||||
|
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 68 KiB |
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 260 KiB After Width: | Height: | Size: 45 KiB |
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 1.0 MiB After Width: | Height: | Size: 110 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 6.9 KiB |
@@ -1,80 +1,304 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
version="1.1"
|
||||
id="Layer_1"
|
||||
x="0px"
|
||||
y="0px"
|
||||
width="606.2478"
|
||||
height="595.49866"
|
||||
viewBox="0 0 606.24779 595.49863"
|
||||
enable-background="new 0 0 841.89 595.28"
|
||||
xml:space="preserve"
|
||||
inkscape:version="0.48.2 r9819"
|
||||
sodipodi:docname="tomahawk-icon.svg"><metadata
|
||||
id="metadata15"><rdf:RDF><cc:Work
|
||||
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
|
||||
id="defs13" /><sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1440"
|
||||
inkscape:window-height="794"
|
||||
id="namedview11"
|
||||
showgrid="false"
|
||||
inkscape:zoom="1"
|
||||
inkscape:cx="431.12548"
|
||||
inkscape:cy="336.94553"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="0"
|
||||
inkscape:current-layer="Layer_1"
|
||||
inkscape:snap-page="false"
|
||||
fit-margin-top="0"
|
||||
fit-margin-left="0"
|
||||
fit-margin-right="0"
|
||||
fit-margin-bottom="0"><sodipodi:guide
|
||||
position="-3.5728101e-05,-1.501866e-05"
|
||||
orientation="0,841.89001"
|
||||
id="guide2994" /><sodipodi:guide
|
||||
position="841.88997,-1.501866e-05"
|
||||
orientation="-595.28003,0"
|
||||
id="guide2996" /><sodipodi:guide
|
||||
position="841.88997,595.28001"
|
||||
orientation="0,-841.89001"
|
||||
id="guide2998" /><sodipodi:guide
|
||||
position="-3.5728101e-05,595.28001"
|
||||
orientation="595.28003,0"
|
||||
id="guide3000" /></sodipodi:namedview>
|
||||
<g
|
||||
id="g3"
|
||||
transform="matrix(7.3080643,0,0,7.1790074,-2773.1692,-1839.0104)">
|
||||
<g
|
||||
id="g5">
|
||||
<path
|
||||
d="m 420.947,265.168 c -17.911,0 -32.477,14.565 -32.477,32.472 0,17.906 14.565,32.476 32.477,32.476 2.568,0 5.06,-0.318 7.459,-0.888 v -28.011 l -22.338,15.806 c -0.198,0.135 -0.444,0.213 -0.681,0.213 -0.184,0 -0.372,-0.039 -0.541,-0.136 -0.396,-0.202 -0.642,-0.608 -0.642,-1.043 v -37.053 c 0,-0.435 0.246,-0.845 0.642,-1.053 0.396,-0.193 0.864,-0.159 1.222,0.092 l 22.338,15.807 v -16.028 h 0.951 8.945 v 47.234 c 9.076,-5.764 15.121,-15.888 15.121,-27.417 10e-4,-17.905 -14.569,-32.471 -32.476,-32.471 z"
|
||||
id="path7"
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:none" />
|
||||
<path
|
||||
d="m 420.947,256.165 c -22.874,0 -41.48,18.606 -41.48,41.475 0,22.87 18.606,41.475 41.48,41.475 22.869,0 41.476,-18.605 41.476,-41.475 0,-22.869 -18.607,-41.475 -41.476,-41.475 z m 17.356,68.892 v -47.234 h -8.945 -0.951 v 16.028 l -22.338,-15.807 c -0.357,-0.251 -0.826,-0.285 -1.222,-0.092 -0.396,0.208 -0.642,0.618 -0.642,1.053 v 37.053 c 0,0.435 0.246,0.841 0.642,1.043 0.169,0.097 0.357,0.136 0.541,0.136 0.236,0 0.482,-0.078 0.681,-0.213 l 22.338,-15.806 v 28.011 c -2.399,0.569 -4.891,0.888 -7.459,0.888 -17.911,0 -32.477,-14.57 -32.477,-32.476 0,-17.906 14.565,-32.472 32.477,-32.472 17.906,0 32.477,14.565 32.477,32.472 -0.001,11.528 -6.046,21.652 -15.122,27.416 z"
|
||||
id="path9"
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:#e63e30" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 15.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
width="600px" height="600px" viewBox="0 0 600 600" enable-background="new 0 0 600 600" xml:space="preserve">
|
||||
<path fill="#010101" d="M543.773,253.359c0-49.962-19.305-86.572-54.194-104.54C477.84,71.133,405.027,13.418,316.568,13.418
|
||||
c-86.917,0-159.483,56.481-172.605,132.58c-38.049,16.818-59.889,55.24-59.889,107.361c0,27.029,7.188,51.824,20.321,71.749
|
||||
c-1.816,1.565-3.444,3.282-4.77,5.239c0,0,2.582,2.359,3.689,3.373c-4.262,2.123-8.22,4.322-11.555,6.67
|
||||
c0,0,3.021,7.355,5.896,14.353c-11.991,9.688-21.312,18.92-27.553,27.51c0,0,1.611,1.789,2.011,2.225
|
||||
c-12.354,9.158-22.133,18.205-28.528,27.021c0,0,6.927,7.35,12.408,13.166c-17.824,28.76-43.348,74.85-43.348,102.988
|
||||
c0,3.278,0.346,6.315,1.093,9.053c1.764,6.443,5.752,11.438,11.229,14.059c15.255,7.312,39.646-6.362,72.589-40.434
|
||||
c-0.828,8.287-1.457,16.662-1.457,24.736c0,16.805,2.266,32.069,8.77,41.25c4.887,6.895,10.898,9.067,15.084,9.682
|
||||
c6.723,0.99,26.375,3.797,57.992-61.295c2.678,0.705,5.421,1.178,8.235,1.178c8.798,0,17.065-3.424,23.287-9.639
|
||||
c4.284-4.287,7.133-9.584,8.562-15.312c7.516-2.129,14.555-6.701,20.779-13.19c19.562,24.86,44.779,37.643,75.38,37.643
|
||||
c7.317,0,14.474-0.754,21.281-2.242c0.392-0.073,2.555-0.623,2.555-0.623l0.62-0.166c23.05-5.823,42.463-20.409,58-43.254
|
||||
c7.2,9.23,15.731,15.994,24.849,19.457c1.141,6.658,4.226,12.808,9.102,17.691c6.22,6.213,14.487,9.639,23.288,9.639
|
||||
c8.798,0,17.063-3.426,23.285-9.639c6.221-6.229,9.647-14.494,9.647-23.293c0-8.797-3.429-17.066-9.647-23.293
|
||||
c-2.988-2.988-6.478-5.297-10.248-6.924c0.275-2.947,0.611-5.849,0.611-9.009c0-10.028-1.398-20.979-4.19-31.897
|
||||
c-1.196-4.672-2.757-8.746-4.513-12.568c2.84-6.467,4.807-13.268,4.807-20.426c0-7.316-1.74-14.422-4.706-21.01
|
||||
C509.263,358.345,543.773,313.068,543.773,253.359z M451.232,150.998c-33.396-54.619-88.048-93.359-134.569-85.472
|
||||
c-49.022-7.864-102.775,30.64-135.326,85.018c-2.646,0.208-5.276,0.497-7.875,0.88c8.694-54.414,69.431-111.108,143.107-111.108
|
||||
c74.113,0,135.142,57.197,143.271,112.08C457.013,151.799,454.137,151.348,451.232,150.998z"/>
|
||||
<path fill="#010101" stroke="#FFFFFF" stroke-width="4.8437" d="M110.937,367.38c-72.03,93.07-97.843,163.349-81.865,170.996
|
||||
c15.97,7.654,74.912-46.055,139.701-143.287c45.751-68.647,60.797-94.43,45.68-95.922l20.614-43.357l-10.687-6.644l-33.91,33.371
|
||||
C179.323,272.615,166.073,296.146,110.937,367.38z"/>
|
||||
<path fill="#010101" stroke="#FFFFFF" stroke-width="4.8437" d="M140.932,379.755c-39.101,113.041-39.738,189.89-20.813,192.654
|
||||
c18.912,2.787,59.039-67.617,89.306-182.603c21.383-81.178,27.257-111.029,11.438-108l5.133-48.806l-13.207-3.354l-22.192,42.936
|
||||
C175.736,266.142,170.865,293.244,140.932,379.755z"/>
|
||||
<circle fill="none" stroke="#010101" stroke-width="4.8437" cx="410.28" cy="388.832" r="37.801"/>
|
||||
<path fill="#ED2224" stroke="#010101" stroke-width="4.8437" d="M475.237,157.792c-7.115-73.197-76.231-130.645-160.495-130.645
|
||||
c-83.402,0-152.009,56.27-160.306,128.393c-39.811,13.607-58.455,52.219-58.455,97.818c0,56.946,34.681,103.108,89.925,103.108
|
||||
c35.784,0,67.089-19.432,84.771-48.551c14.01,3.533,28.776,5.463,44.064,5.463c13.16,0,25.934-1.438,38.173-4.076
|
||||
c17.966,28.357,49.108,47.164,84.604,47.164c55.665,0,90.696-46.162,90.696-103.108
|
||||
C528.218,210.073,512.209,173.073,475.237,157.792z M314.742,274.908c-10.501,0-20.723-0.878-30.584-2.506
|
||||
c1.125-6.177,1.778-12.527,1.778-19.043c0-56.941-44.786-103.104-100.03-103.104c-4.858,0-9.597,0.478-14.271,1.169
|
||||
c8.692-54.414,69.43-111.108,143.105-111.108c74.113,0,135.144,57.197,143.27,112.08c-6.617-1.398-13.473-2.141-20.49-2.141
|
||||
c-55.675,0-100.801,46.163-100.801,103.104c0,6.852,0.687,13.536,1.931,20.013C330.872,274.364,322.888,274.908,314.742,274.908z"/>
|
||||
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="-1087.6663" y1="191.4385" x2="-992.1917" y2="191.4385" gradientTransform="matrix(-0.3782 -0.8348 1.083 -0.4907 -423.9551 -476.2263)">
|
||||
<stop offset="0" style="stop-color:#010101"/>
|
||||
<stop offset="0.2606" style="stop-color:#3E221C"/>
|
||||
<stop offset="0.7732" style="stop-color:#B03126"/>
|
||||
<stop offset="1" style="stop-color:#ED2224"/>
|
||||
</linearGradient>
|
||||
<path fill="url(#SVGID_1_)" d="M153.69,260.35c31.322-14.19,65.739-18.887,77.129,6.254c11.391,25.14-4.763,57.026-36.091,71.214
|
||||
c-31.323,14.192-65.948,5.311-77.338-19.83C106,292.849,122.366,274.543,153.69,260.35z"/>
|
||||
<linearGradient id="SVGID_2_" gradientUnits="userSpaceOnUse" x1="-1275.886" y1="215.5034" x2="-1180.4114" y2="215.5034" gradientTransform="matrix(-0.9008 -0.3607 0.555 -1.386 -752.6548 131.7681)">
|
||||
<stop offset="0" style="stop-color:#B11F24"/>
|
||||
<stop offset="0.1017" style="stop-color:#B62024"/>
|
||||
<stop offset="1" style="stop-color:#ED2224"/>
|
||||
</linearGradient>
|
||||
<path fill="url(#SVGID_2_)" d="M427.738,265.165c16.043-40.085,41.342-74.985,68.475-64.122
|
||||
c27.121,10.86,36.109,52.165,20.056,92.248c-16.053,40.089-51.062,63.773-78.189,52.912
|
||||
C410.95,335.343,411.683,305.253,427.738,265.165z"/>
|
||||
<path fill="#010101" stroke="#010101" stroke-width="4.8437" d="M448.219,425.226c7.774,30.396,3.98,62.357-14.521,62.357
|
||||
c-16.301,0-34.904-17.332-42.675-47.732c-7.777-30.399,4.243-75.016,14.521-62.364C423.584,399.707,440.442,394.826,448.219,425.226
|
||||
z"/>
|
||||
<linearGradient id="SVGID_3_" gradientUnits="userSpaceOnUse" x1="-639.5422" y1="548.502" x2="-691.4051" y2="458.673" gradientTransform="matrix(0.9868 0.0515 0.0515 0.7987 840.2104 72.6462)">
|
||||
<stop offset="0" style="stop-color:#5B3E1D"/>
|
||||
<stop offset="0.1121" style="stop-color:#42301B"/>
|
||||
<stop offset="0.2377" style="stop-color:#2E2316"/>
|
||||
<stop offset="0.3753" style="stop-color:#1D1710"/>
|
||||
<stop offset="0.5292" style="stop-color:#0E0C08"/>
|
||||
<stop offset="0.7122" style="stop-color:#030302"/>
|
||||
<stop offset="1" style="stop-color:#000000"/>
|
||||
</linearGradient>
|
||||
<path fill="url(#SVGID_3_)" stroke="#010101" stroke-width="4.8437" d="M184.076,437.859c-6.111,23.875,1.745,46.508,17.54,50.549
|
||||
c15.79,4.039,33.552-12.045,39.658-35.924c6.101-23.882-9.153-57.129-24.947-61.17C200.537,387.275,190.178,413.972,184.076,437.859
|
||||
z"/>
|
||||
<path fill="#010101" stroke="#010101" stroke-width="4.8437" d="M314.837,65.525c72.757-12.333,165.505,89.311,165.505,187.528
|
||||
c0,98.213-74.307,162.833-165.707,162.833"/>
|
||||
<linearGradient id="SVGID_4_" gradientUnits="userSpaceOnUse" x1="-664.3811" y1="374.0068" x2="-500.546" y2="90.2362" gradientTransform="matrix(1 0 0 1 858.79 0.3506)">
|
||||
<stop offset="0" style="stop-color:#000000"/>
|
||||
<stop offset="1" style="stop-color:#5B3E1D"/>
|
||||
</linearGradient>
|
||||
<path fill="url(#SVGID_4_)" stroke="#010101" stroke-width="4.8437" d="M314.635,415.888c-91.402,0-165.299-64.619-165.299-162.833
|
||||
c0-98.218,88.615-199.862,165.5-187.528"/>
|
||||
<linearGradient id="SVGID_5_" gradientUnits="userSpaceOnUse" x1="-760.302" y1="-37.9087" x2="-639.3506" y2="-247.4027" gradientTransform="matrix(-0.6092 0.7802 -0.4118 -0.3216 -240.6183 671.6459)">
|
||||
<stop offset="0" style="stop-color:#8B654B"/>
|
||||
<stop offset="1" style="stop-color:#000000"/>
|
||||
</linearGradient>
|
||||
<path fill="url(#SVGID_5_)" d="M169.611,266.578c-27.578-21.539-16.863-81.354,23.935-133.604
|
||||
c40.804-52.245,93.81-72.894,126.21-59.689c26.672,10.864,14.476,85.434-26.326,137.681
|
||||
C252.63,263.215,197.193,288.112,169.611,266.578z"/>
|
||||
<circle fill="#010101" cx="214.367" cy="388.832" r="34.682"/>
|
||||
<g>
|
||||
<path fill="#F4DFED" d="M131.831,427.708c-23.973,79.734-18.741,132.268-9.011,135.459c10.854,3.564,43.561-47.223,60.839-128.324
|
||||
c12.189-57.264,11.729-83.75,0.009-81.625l3.505-31.108l-8.899-2.435l-14.271,32.445
|
||||
C152.554,347.564,150.184,366.689,131.831,427.708z"/>
|
||||
|
||||
<linearGradient id="SVGID_6_" gradientUnits="userSpaceOnUse" x1="-710.6404" y1="319.3252" x2="-710.6405" y2="562.8164" gradientTransform="matrix(1 0 0 1 858.79 0.3506)">
|
||||
<stop offset="0" style="stop-color:#571A54"/>
|
||||
<stop offset="0.2641" style="stop-color:#7C5378"/>
|
||||
<stop offset="0.528" style="stop-color:#A78AA3"/>
|
||||
<stop offset="0.7459" style="stop-color:#CDBCCB"/>
|
||||
<stop offset="0.9095" style="stop-color:#EAE1E8"/>
|
||||
<stop offset="1" style="stop-color:#F9F3F8"/>
|
||||
</linearGradient>
|
||||
<path fill="url(#SVGID_6_)" d="M146.41,479.117l-22.914,19.186l35.325-65.182l4.683-17.371c0,0,3.1-26.758-24.228,14.713
|
||||
c16.962-56.432,32.317-62.998,32.317-62.998l11.402-46.658l-4.725-1.131l-14.702,30.23c-11.429-4.588-13.859,14.521-32.392,75.483
|
||||
c-24.226,79.656-20.501,124.087-8.358,137.777L146.41,479.117z"/>
|
||||
|
||||
<linearGradient id="SVGID_7_" gradientUnits="userSpaceOnUse" x1="-789.3508" y1="444.1797" x2="-821.2424" y2="531.975" gradientTransform="matrix(0.9399 -0.3414 0.3414 0.9399 754.2939 -277.891)">
|
||||
<stop offset="0" style="stop-color:#802986"/>
|
||||
<stop offset="0.2641" style="stop-color:#9D66A2"/>
|
||||
<stop offset="0.528" style="stop-color:#BE9BC2"/>
|
||||
<stop offset="0.7459" style="stop-color:#DBC8DE"/>
|
||||
<stop offset="0.9095" style="stop-color:#F0E6F1"/>
|
||||
<stop offset="1" style="stop-color:#F9F3F8"/>
|
||||
</linearGradient>
|
||||
<path fill="url(#SVGID_7_)" d="M147.332,501.478l31.839-92.399c0,0,6.608,60.69-7.474,93.406
|
||||
c1.438-44.879-2.328-36.951-9.176-25.257C159.71,482.031,147.332,501.478,147.332,501.478z"/>
|
||||
|
||||
<linearGradient id="SVGID_8_" gradientUnits="userSpaceOnUse" x1="-764.8928" y1="411.2344" x2="-797.3259" y2="500.5203" gradientTransform="matrix(0.9399 -0.3414 0.3414 0.9399 754.2939 -277.891)">
|
||||
<stop offset="0" style="stop-color:#802986"/>
|
||||
<stop offset="0.2641" style="stop-color:#9D66A2"/>
|
||||
<stop offset="0.528" style="stop-color:#BE9BC2"/>
|
||||
<stop offset="0.7459" style="stop-color:#DBC8DE"/>
|
||||
<stop offset="0.9095" style="stop-color:#F0E6F1"/>
|
||||
<stop offset="1" style="stop-color:#F9F3F8"/>
|
||||
</linearGradient>
|
||||
<path fill="url(#SVGID_8_)" d="M156.286,463.716l38.825-93.953c0,0,2.251,62.279-11.831,94.992
|
||||
c-0.298-44.25-5.388-28.09-8.538-23.508C165.662,454.416,156.286,463.716,156.286,463.716z"/>
|
||||
|
||||
<linearGradient id="SVGID_9_" gradientUnits="userSpaceOnUse" x1="-872.7551" y1="422.8174" x2="-924.3751" y2="475.0038" gradientTransform="matrix(0.711 -0.7032 0.7032 0.711 517.3177 -556.6326)">
|
||||
<stop offset="0" style="stop-color:#571A54"/>
|
||||
<stop offset="0.2641" style="stop-color:#7C5378"/>
|
||||
<stop offset="0.528" style="stop-color:#A78AA3"/>
|
||||
<stop offset="0.7459" style="stop-color:#CDBCCB"/>
|
||||
<stop offset="0.9095" style="stop-color:#EAE1E8"/>
|
||||
<stop offset="1" style="stop-color:#F9F3F8"/>
|
||||
</linearGradient>
|
||||
<path fill="url(#SVGID_9_)" d="M180.916,431.115l9.787-73.404c0,0,18.589,43.111,16.428,71.426
|
||||
c-11.771-30.424-13.671-21.049-17.576-14.961C187.396,417.539,180.916,431.115,180.916,431.115z"/>
|
||||
<path fill="#1E3D73" d="M174.914,335.556L158.76,362.31l-23.24,76.646c0,0,1.211-8.172,1.788-15.883l-18.783,50.772
|
||||
c0,0,8.386-31.227,3.607-28.383c-4.775,2.84,4.227-21.91-23.102,13.73c5.316-18.517,20.495-39.511,33.324-54.9
|
||||
c-2.172,0.473-7.102,4.787-18.388,18.373c4.381-15.232,14.956-32.934,25.357-47.898c-1.159-2.682-5.151-3.889-21.234,5.224
|
||||
C134.366,356.718,174.914,335.556,174.914,335.556z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#F4DFED" d="M94.453,401.164c-49.752,66.752-62.779,117.912-54.719,124.242c8.987,7.059,57.062-29.513,100.989-99.847
|
||||
c31.011-49.655,39.62-74.709,27.879-76.713l13.916-28.053l-7.539-5.318l-24.483,25.623
|
||||
C141.291,332.912,132.531,350.072,94.453,401.164z"/>
|
||||
<path fill="#656B84" d="M90.603,454.464l-28.088,10.205l55.456-49.201l10.331-14.729c0,0,12.047-24.097-27.796,5.559
|
||||
c35.213-47.256,51.892-48.182,51.892-48.182l26.641-39.957l-4.058-2.683l-24.133,23.4c-9.179-8.223-17.989,8.91-56.226,59.885
|
||||
c-49.96,66.601-61.634,109.635-54.889,126.646L90.603,454.464z"/>
|
||||
|
||||
<linearGradient id="SVGID_10_" gradientUnits="userSpaceOnUse" x1="-752.551" y1="484.6816" x2="-736.7991" y2="395.3488" gradientTransform="matrix(1 0 0 1 858.79 0.3506)">
|
||||
<stop offset="0" style="stop-color:#571A54"/>
|
||||
<stop offset="0.2641" style="stop-color:#7C5378"/>
|
||||
<stop offset="0.528" style="stop-color:#A78AA3"/>
|
||||
<stop offset="0.7459" style="stop-color:#CDBCCB"/>
|
||||
<stop offset="0.9095" style="stop-color:#EAE1E8"/>
|
||||
<stop offset="1" style="stop-color:#F9F3F8"/>
|
||||
</linearGradient>
|
||||
<path fill="url(#SVGID_10_)" d="M83.829,475.791l61.476-75.98c0,0-14.509,59.306-38.916,85.248
|
||||
c16.678-41.694,12.058-33.366,0-26.873C101.491,460.822,83.829,475.791,83.829,475.791z"/>
|
||||
|
||||
<linearGradient id="SVGID_11_" gradientUnits="userSpaceOnUse" x1="-727.8064" y1="453.3486" x2="-711.9149" y2="363.2233" gradientTransform="matrix(1 0 0 1 858.79 0.3506)">
|
||||
<stop offset="0" style="stop-color:#571A54"/>
|
||||
<stop offset="0.2641" style="stop-color:#7C5378"/>
|
||||
<stop offset="0.528" style="stop-color:#A78AA3"/>
|
||||
<stop offset="0.7459" style="stop-color:#CDBCCB"/>
|
||||
<stop offset="0.9095" style="stop-color:#EAE1E8"/>
|
||||
<stop offset="1" style="stop-color:#F9F3F8"/>
|
||||
</linearGradient>
|
||||
<path fill="url(#SVGID_11_)" d="M105.143,443.357l68.562-75.052c0,0-19.143,59.297-43.551,85.248
|
||||
c14.824-41.7,10.567-27.994,0-25.022C124.802,430.041,105.143,443.357,105.143,443.357z"/>
|
||||
<path fill="#656B84" d="M139.423,421.125l34.262-65.654c0,0,2.748,46.867-8.945,72.74c-0.676-32.615-3.041-28.432-11.413-20.061
|
||||
C150.5,410.974,139.423,421.125,139.423,421.125z"/>
|
||||
<path fill="#656B84" d="M166.408,329.255l-24.322,19.631l-48.011,64.111c0,0,3.931-7.273,7.104-14.322L66.185,439.99
|
||||
c0,0,18.552-26.484,13.089-25.449c-5.464,1.041,11.451-19.148-26.399,5.02c11.313-15.588,32.751-30.137,50.064-40.227
|
||||
c-2.205-0.299-8.316,2.076-23.552,10.988c9.312-12.818,25.302-25.842,40.183-36.357c-0.175-2.918-3.515-5.416-21.74-2.346
|
||||
C121.065,335.3,166.408,329.255,166.408,329.255z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#D9AF82" d="M315.05,115.063c-50.514,0-83.218,15.021-109.641,64.839c-2.502,4.713-0.23,14.337-2.796,19.152
|
||||
c-13.845,26.007-37.089,48.236-37.089,71.707c0,34.335,19.1,65.637,42.505,89.296c12.185,71.646,34.7,151.595,104.339,151.595"/>
|
||||
<path fill="#010101" d="M203.271,178.766c-1.521,2.855-1.59,6.774-1.656,10.562c-0.062,3.283-0.123,6.677-1.14,8.588
|
||||
c-4.537,8.519-10.146,16.707-15.577,24.624c-11.21,16.353-21.797,31.798-21.797,48.221c0,30.307,15.166,62.38,42.666,90.412
|
||||
c12.578,73.607,36.113,150.479,106.6,150.479v-1.547c-67.084,0-89.722-78.556-101.95-150.453l-0.127-0.748l-0.54-0.549
|
||||
c-26.957-27.257-41.805-58.361-41.805-87.594c0-14.923,10.174-29.766,20.949-45.482c5.501-8.027,11.19-16.327,15.855-25.087
|
||||
c1.562-2.935,1.638-6.92,1.707-10.773c0.059-3.221,0.118-6.551,1.088-8.381c24.258-45.734,54.398-65.974,107.503-65.974v-2.422
|
||||
C259.849,112.641,228.506,131.181,203.271,178.766z"/>
|
||||
</g>
|
||||
<path fill="#8B654B" d="M312.368,511.65c72.045,0,92.163-79.949,104.338-151.595c23.405-23.657,42.514-54.959,42.514-89.296
|
||||
c0-37.004-22.588-49.51-38.609-77.154c-5.681-9.798-1.496-24.634-8.084-33.382c-26.905-35.728-53.772-45.162-97.477-45.162"/>
|
||||
<ellipse fill="#D9AF82" cx="313.792" cy="343.947" rx="21.906" ry="68.144"/>
|
||||
<path fill="#8B654B" d="M342.916,373.455c0,7.812-14.979,12.535-27.273,12.535c-12.293,0-27.81-4.736-27.81-12.549
|
||||
c3.432-3.433,15.246,4.885,27.544,4.885C334.789,378.326,342.916,312.496,342.916,373.455z"/>
|
||||
<path fill="#D9AF82" d="M335.697,435.216c0,37.637-9.81,68.832-21.91,68.832c-12.096,0-21.899-31.195-21.899-68.832
|
||||
c0-37.639,9.882-50.258,21.977-50.258C325.962,384.958,335.697,397.578,335.697,435.216z"/>
|
||||
<path opacity="0.36" fill="#8A644B" enable-background="new " d="M328.365,281.605c-1.826,24.682-14.186-7.573-34.757,20.975
|
||||
c-8.672,12.025-23.23,10.877-38.845,10.877c-39.61,0-66.544-26.031-67.859-38.869c-2.517-24.557,29.024-39.586,71.464-39.586
|
||||
C297.028,235.002,329.255,269.622,328.365,281.605z"/>
|
||||
<linearGradient id="SVGID_12_" gradientUnits="userSpaceOnUse" x1="-644.0354" y1="340.7031" x2="-568.3508" y2="340.7031" gradientTransform="matrix(1 0 0 1 858.79 0.3506)">
|
||||
<stop offset="0" style="stop-color:#D9AF82"/>
|
||||
<stop offset="0.0786" style="stop-color:#DFB791"/>
|
||||
<stop offset="0.2053" style="stop-color:#E7C1A5"/>
|
||||
<stop offset="0.345" style="stop-color:#EDC9B5"/>
|
||||
<stop offset="0.5023" style="stop-color:#F1CFC0"/>
|
||||
<stop offset="0.6917" style="stop-color:#F4D3C7"/>
|
||||
<stop offset="1" style="stop-color:#F5D4C9"/>
|
||||
</linearGradient>
|
||||
<path opacity="0.36" fill="url(#SVGID_12_)" enable-background="new " d="M272.246,361.529
|
||||
c-28.722,19.461-56.346-24.299-57.491-43.314c15.913,13.822,62.032,18.457,75.685-2.516L272.246,361.529z"/>
|
||||
<path opacity="0.36" fill="#8A644B" enable-background="new " d="M313.706,461.212c-38.167,0-61.229-13.68-61.229-31.629
|
||||
c0-6.049,15.649-24.078,37.318-49.365c5.952-3.699,7.464,10.037,14.958,4.73C331.61,392.044,328.318,461.212,313.706,461.212z"/>
|
||||
<g>
|
||||
<path fill="#8A644B" d="M260.464,472.117c8.341,23.938,32.817,36.465,52.688,36.465v-4.844
|
||||
C294.99,503.738,268.056,493.921,260.464,472.117L260.464,472.117z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#8A644B" d="M180.954,271.658c0,21.359,5.388,36.679,27.101,48.222c0.587,1.121,7.021,13.387,7.021,13.387
|
||||
c8.916,16.375,19.021,34.939,19.021,54.406h4.844c0-20.699-10.416-39.84-19.612-56.725l-7.586-14.455l-0.709-0.426
|
||||
C190.51,305.4,180.954,291.289,180.954,271.658L180.954,271.658z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#010101" d="M208.814,230.649l-0.104-0.97c-3.106-15.25-3.226-33.651-0.312-49.217l-4.764-0.889
|
||||
C200.613,195.722,205.583,214.815,208.814,230.649z"/>
|
||||
</g>
|
||||
<linearGradient id="SVGID_13_" gradientUnits="userSpaceOnUse" x1="-667.7327" y1="310.1709" x2="-407.218" y2="310.1709" gradientTransform="matrix(1 0 0 1 858.79 0.3506)">
|
||||
<stop offset="0" style="stop-color:#5B3E1D"/>
|
||||
<stop offset="1" style="stop-color:#010101"/>
|
||||
</linearGradient>
|
||||
<path fill="url(#SVGID_13_)" d="M423.943,199.054c-3.983-11.059-0.737-20.853-8.062-31.231
|
||||
c-19.885-28.185-51.07-56.271-108.998-52.618l5.214,140.363c0,0-122.733-25.589-121.021,15.935c0.229,5.387,40.188,2.88,63.46,4.428
|
||||
c-26.092,4.566-32.185,5.898-32.185,8.838c0,6.206,21.861,0.683,25.106,2.467c4.978,2.739-43.139,7.052-34.351,8.757
|
||||
c10.057,1.951,44.474,3.086,57.442,3.086c28.931,0,41.077-25.413,41.077-4.485c7.348,27.894,14.739,59.239,13.974,69.882
|
||||
c-1.477,20.661-19.62,20.188-19.62,20.188l5.089,24.285c-8.557,0.438-6.245-1.324-13.85-0.549c-14.429,0-32.354,13.03-32.354,16.055
|
||||
l39.989,0.434c0,0-29.081,13.771-22.977,22.931c4.765,7.143,20.316,13.377,31.093,13.424c0,0,3.271,8.549,3.271,22.352
|
||||
c0,13.812-4.035,22.564-4.035,22.564c46.171,0,67.49-49.035,80.324-118.445c6.083-32.877,20.018-58.104,36.034-71.658
|
||||
c15.742-13.319,23.008-26.64,23.008-52.07C451.577,249.847,443.574,230.354,423.943,199.054z"/>
|
||||
<path fill="#D9AF82" d="M325.395,252.416l-13.297,4.328c0,0-65.85-96.356-46.493-121.312c12.682-16.357,24.609-18.136,40.046-19.238
|
||||
c13.519-0.965,21.294,16.525,27.302,24.271C350.375,162.927,325.395,252.416,325.395,252.416z"/>
|
||||
<linearGradient id="SVGID_14_" gradientUnits="userSpaceOnUse" x1="-629.0159" y1="50.6562" x2="-540.175" y2="50.6562" gradientTransform="matrix(0.676 0.6564 -0.9247 0.9523 711.8302 511.1852)">
|
||||
<stop offset="0" style="stop-color:#FFFFFF"/>
|
||||
<stop offset="0.0769" style="stop-color:#F4E9DD"/>
|
||||
<stop offset="0.1814" style="stop-color:#EBD6BF"/>
|
||||
<stop offset="0.2951" style="stop-color:#E5C7A8"/>
|
||||
<stop offset="0.419" style="stop-color:#DFBC96"/>
|
||||
<stop offset="0.5585" style="stop-color:#DCB58B"/>
|
||||
<stop offset="0.7265" style="stop-color:#DAB084"/>
|
||||
<stop offset="1" style="stop-color:#D9AF82"/>
|
||||
</linearGradient>
|
||||
<path fill="url(#SVGID_14_)" d="M305.253,199.27c-26.745,27.542-70.168,41.961-81.281,24.357
|
||||
c-14.515-22.972-12.896-47.545,13.854-75.082c26.74-27.547,64.922-33.847,85.28-14.081
|
||||
C343.464,154.233,332.003,171.726,305.253,199.27z"/>
|
||||
<linearGradient id="SVGID_15_" gradientUnits="userSpaceOnUse" x1="-617.7107" y1="401.4551" x2="-617.7107" y2="317.8633" gradientTransform="matrix(1 0 0 1 858.79 0.3506)">
|
||||
<stop offset="0" style="stop-color:#D9AF82"/>
|
||||
<stop offset="0.1127" style="stop-color:#BD936E"/>
|
||||
<stop offset="0.2679" style="stop-color:#A57C5E"/>
|
||||
<stop offset="0.4437" style="stop-color:#966E53"/>
|
||||
<stop offset="0.6554" style="stop-color:#8D664D"/>
|
||||
<stop offset="1" style="stop-color:#8A644B"/>
|
||||
</linearGradient>
|
||||
<path fill="url(#SVGID_15_)" d="M272.246,361.529c0,46.272-35.419,42.799-45.104,36.896c0-45.752-17.229-80.211-17.229-80.211
|
||||
S249.882,354.22,272.246,361.529z"/>
|
||||
<linearGradient id="SVGID_16_" gradientUnits="userSpaceOnUse" x1="-925.8547" y1="344.666" x2="-972.7458" y2="361.7328" gradientTransform="matrix(-1 0 0 1 -562.3931 0.3506)">
|
||||
<stop offset="0" style="stop-color:#382815"/>
|
||||
<stop offset="0.4081" style="stop-color:#553E2B"/>
|
||||
<stop offset="1" style="stop-color:#8B654B"/>
|
||||
</linearGradient>
|
||||
<path fill="url(#SVGID_16_)" d="M359.338,356.349c0,46.271,21.506,44.033,31.073,44.033c7.488-45.135,35.671-81.516,35.671-81.516
|
||||
S381.703,349.044,359.338,356.349z"/>
|
||||
<path fill="none" stroke="#010101" stroke-width="4.8437" d="M173.934,294.978"/>
|
||||
<g>
|
||||
<path fill="#010101" d="M311.507,115.089c53.106,0,83.247,20.214,107.505,65.948c0.902,1.702,0.902,4.883,0.902,7.96
|
||||
c-0.005,4.146-0.005,8.432,2.029,11.419c16.157,23.757,31.934,48.809,31.934,70.969c0,32.38-12.817,62.458-37.073,86.969
|
||||
l-0.541,0.551l-0.13,0.748c-12.222,71.897-36.672,150.451-103.765,150.451v1.518c70.499,0,95.847-76.844,108.416-150.455
|
||||
c24.803-25.336,37.937-56.355,37.937-89.781c0-23.537-16.19-49.311-32.774-73.694c-1.151-1.698-1.19-5.061-1.19-8.37
|
||||
c0-0.109,0.004-0.537,0.004-0.646c0-3.567-0.041-7.221-1.471-9.91C398.053,131.18,366.71,112.64,311.51,112.64v2.449H311.507
|
||||
L311.507,115.089z"/>
|
||||
</g>
|
||||
<polygon fill="#010101" points="339.974,84.79 334.59,115.675 300.608,113.719 312.435,66.413 "/>
|
||||
<circle fill="#010101" stroke="#010101" stroke-width="4.8437" cx="452.06" cy="492.948" r="19.204"/>
|
||||
<g>
|
||||
|
||||
<linearGradient id="SVGID_17_" gradientUnits="userSpaceOnUse" x1="-749.6116" y1="335.9512" x2="-687.9983" y2="335.9512" gradientTransform="matrix(1 0 0 1 858.79 0.3506)">
|
||||
<stop offset="0" style="stop-color:#571A54"/>
|
||||
<stop offset="0.2641" style="stop-color:#7C5378"/>
|
||||
<stop offset="0.528" style="stop-color:#A78AA3"/>
|
||||
<stop offset="0.7459" style="stop-color:#CDBCCB"/>
|
||||
<stop offset="0.9095" style="stop-color:#EAE1E8"/>
|
||||
<stop offset="1" style="stop-color:#F9F3F8"/>
|
||||
</linearGradient>
|
||||
<path fill="url(#SVGID_17_)" d="M109.178,338.035c9.592-7.824,34.694,4.861,34.833,4.861l26.78-8.396
|
||||
C170.211,334.501,120.246,321.648,109.178,338.035z"/>
|
||||
</g>
|
||||
<linearGradient id="SVGID_18_" gradientUnits="userSpaceOnUse" x1="-1081.0227" y1="320.6133" x2="-1063.3801" y2="320.6133" gradientTransform="matrix(-0.0113 -0.7169 1.2476 -0.0198 -98.6661 -397.1379)">
|
||||
<stop offset="0" style="stop-color:#D9AF82"/>
|
||||
<stop offset="0.0786" style="stop-color:#DFB791"/>
|
||||
<stop offset="0.2053" style="stop-color:#E7C1A5"/>
|
||||
<stop offset="0.345" style="stop-color:#EDC9B5"/>
|
||||
<stop offset="0.5023" style="stop-color:#F1CFC0"/>
|
||||
<stop offset="0.6917" style="stop-color:#F4D3C7"/>
|
||||
<stop offset="1" style="stop-color:#F5D4C9"/>
|
||||
</linearGradient>
|
||||
<path opacity="0.36" fill="url(#SVGID_18_)" enable-background="new " d="M313.352,358.851c6.074-0.1,11.045,2.654,11.102,6.15
|
||||
c0.06,3.49-4.829,6.398-10.907,6.498c-6.076,0.1-11.045-2.658-11.105-6.154C302.388,361.853,307.269,358.947,313.352,358.851z"/>
|
||||
<path fill="#483218" d="M397.109,309.378c15.699-3.76,26.445-18.402,20.099-27.063c-38.738,19.354-75.295,11.369-85.529,9.147
|
||||
C368.014,309.492,371.117,315.595,397.109,309.378z"/>
|
||||
<path fill="#B4B4B4" d="M310.92,73.714c-38.372,0-93.116,22.758-117.549,74.944c-6.089,12.999-6.656,32.87,0.64,45.014
|
||||
c0,0,18.604-81.43,108.229-86.494"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 5.1 KiB |
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 1.0 MiB |
@@ -43,8 +43,8 @@
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<a href="http://www.tomahawk-player.org" title="Tomahawk - Powered by Playdar" id="head">
|
||||
<img alt="Tomahawk - Powered by Playdar" src="/staticdata/tomahawk_auth_logo.png" width="200" height="30">
|
||||
<a href="http://www.playdar.org/" title="Tomahawk - Powered by Playdar" id="head">
|
||||
<img alt="Tomahawk - Powered by Playdar" src="/staticdata/tomahawk_auth_logo.png" width="196" height="45"/>
|
||||
</a>
|
||||
|
||||
<div id="content">
|
||||
|
@@ -32,8 +32,8 @@
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<a href="http://www.tomahawk-player.org" title="Tomahawk - Powered by Playdar" id="head">
|
||||
<img alt="Tomahawk - Powered by Playdar" src="/staticdata/tomahawk_auth_logo.png" width="200" height="30">
|
||||
<a href="http://www.gettomahawk.com/" title="Tomahawk - Powered by Playdar" id="head">
|
||||
<img alt="Tomahawk - Powered by Playdar" src="/staticdata/tomahawk_auth_logo.png" width="196" height="45"/>
|
||||
</a>
|
||||
|
||||
<div id="content">
|
||||
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 6.8 KiB |
1780
lang/tomahawk_ar.ts
1028
lang/tomahawk_fr.ts
@@ -10,6 +10,5 @@
|
||||
<file>tomahawk_es.qm</file>
|
||||
<file>tomahawk_sv.qm</file>
|
||||
<file>tomahawk_ja.qm</file>
|
||||
<file>tomahawk_ar.qm</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
1024
lang/tomahawk_ja.ts
@@ -141,7 +141,6 @@
|
||||
<file>data/images/process-stop.png</file>
|
||||
<file>data/icons/tomahawk-icon-128x128-grayscale.png</file>
|
||||
<file>data/images/collection.png</file>
|
||||
<file>data/misc/tomahawk_pubkey.pem</file>
|
||||
<file>data/images/track-icon-sidebar.png</file>
|
||||
<file>data/misc/tomahawk_pubkey.pem</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
@@ -59,6 +59,7 @@ AccountDelegate::AccountDelegate( QObject* parent )
|
||||
, m_accountRowHeight( -1 )
|
||||
, m_model( 0 )
|
||||
{
|
||||
|
||||
m_defaultCover.load( RESPATH "images/sipplugin-online.png" );
|
||||
m_ratingStarPositive.load( RESPATH "images/starred.png" );
|
||||
m_ratingStarNegative.load( RESPATH "images/star-unstarred.png" );
|
||||
@@ -270,7 +271,7 @@ AccountDelegate::paint ( QPainter* painter, const QStyleOptionViewItem& option,
|
||||
}
|
||||
else if ( canDelete )
|
||||
{
|
||||
const QString btnText = tr( "Remove" );
|
||||
const QString btnText = tr( "Remove Account" );
|
||||
const int btnWidth = installMetrics.width( btnText ) + 2*PADDING;
|
||||
QRect btnRect;
|
||||
|
||||
@@ -280,10 +281,7 @@ AccountDelegate::paint ( QPainter* painter, const QStyleOptionViewItem& option,
|
||||
btnRect = QRect( opt.rect.right() - PADDING - btnWidth, center - ( installMetrics.height() + 4 ) / 2, btnWidth, installMetrics.height() + 2*PADDING );
|
||||
|
||||
#ifdef Q_WS_MAC
|
||||
btnRect.adjust( -4, 0, 4, 0 );
|
||||
|
||||
if ( hasConfigWrench )
|
||||
btnRect.moveTop( btnRect.top() + 2 );
|
||||
btnRect.adjust( -4, 2, 4, -2 );
|
||||
#endif
|
||||
leftEdge = btnRect.left();
|
||||
m_cachedButtonRects[ index ] = btnRect;
|
||||
@@ -388,7 +386,7 @@ AccountDelegate::paint ( QPainter* painter, const QStyleOptionViewItem& option,
|
||||
const int countW = painter->fontMetrics().width( count );
|
||||
const QRect countRect( runningEdge + 50, starsTop, countW, painter->fontMetrics().height() );
|
||||
count = painter->fontMetrics().elidedText( count, Qt::ElideRight, rightEdge - PADDING - countRect.left() );
|
||||
painter->drawText( countRect, Qt::AlignLeft, count );
|
||||
painter->drawText( countRect, Qt::AlignLeft | Qt::TextWordWrap, count );
|
||||
// runningEdge = authorRect.x();
|
||||
}
|
||||
|
||||
@@ -604,7 +602,6 @@ AccountDelegate::drawStatus( QPainter* painter, const QPointF& rightTopEdge, Acc
|
||||
{
|
||||
QPixmap p;
|
||||
QString statusText;
|
||||
|
||||
const Account::ConnectionState state = acct->connectionState();
|
||||
if ( state == Account::Connected )
|
||||
{
|
||||
@@ -728,6 +725,7 @@ void
|
||||
AccountDelegate::doneInstalling ( const QPersistentModelIndex& idx )
|
||||
{
|
||||
qDebug() << "STOP INSTALLING:" << idx.data( Qt::DisplayRole ).toString();
|
||||
Q_ASSERT( m_loadingSpinners.contains( idx ) );
|
||||
if ( !m_loadingSpinners.contains( idx ) )
|
||||
return;
|
||||
|
@@ -19,7 +19,6 @@
|
||||
#ifndef ACCOUNTDELEGATE_H
|
||||
#define ACCOUNTDELEGATE_H
|
||||
|
||||
#include "DllMacro.h"
|
||||
#include <QStyledItemDelegate>
|
||||
#include "accounts/AccountModel.h"
|
||||
|
||||
@@ -32,7 +31,7 @@ namespace Accounts
|
||||
|
||||
class Account;
|
||||
|
||||
class DLLEXPORT AccountDelegate : public QStyledItemDelegate
|
||||
class AccountDelegate : public QStyledItemDelegate
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
@@ -20,7 +20,7 @@
|
||||
|
||||
#include "accounts/Account.h"
|
||||
#include "accounts/AccountManager.h"
|
||||
#include "utils/GuiHelpers.h"
|
||||
#include "GuiHelpers.h"
|
||||
#include "AccountFactoryWrapperDelegate.h"
|
||||
#include "DelegateConfigWrapper.h"
|
||||
#include "ui_AccountFactoryWrapper.h"
|
@@ -19,8 +19,6 @@
|
||||
#ifndef ACCOUNTFACTORYWRAPPER_H
|
||||
#define ACCOUNTFACTORYWRAPPER_H
|
||||
|
||||
#include "DllMacro.h"
|
||||
|
||||
#include <QDialog>
|
||||
#include <QModelIndex>
|
||||
|
||||
@@ -35,7 +33,7 @@ class Account;
|
||||
class Ui_AccountFactoryWrapper;
|
||||
|
||||
// class AccountFactoryWrapper_
|
||||
class DLLEXPORT AccountFactoryWrapper : public QDialog
|
||||
class AccountFactoryWrapper : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
@@ -28,14 +28,13 @@
|
||||
#include "playlist/PlaylistView.h"
|
||||
#include "database/Database.h"
|
||||
#include "widgets/ImageButton.h"
|
||||
#include "utils/TomahawkUtilsGui.h"
|
||||
#include "utils/TomahawkUtils.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "Album.h"
|
||||
#include "DropJob.h"
|
||||
#include "SocialWidget.h"
|
||||
#include "GlobalActionManager.h"
|
||||
#include "ViewManager.h"
|
||||
#include "Source.h"
|
||||
|
||||
using namespace Tomahawk;
|
||||
|
||||
|
@@ -68,13 +68,27 @@ SET( tomahawkSourcesGui ${tomahawkSourcesGui}
|
||||
sourcetree/items/GroupItem.cpp
|
||||
sourcetree/items/HistoryItem.cpp
|
||||
|
||||
utils/GuiHelpers.cpp
|
||||
|
||||
accounts/lastfm/LastFmAccount.cpp
|
||||
accounts/lastfm/LastFmConfig.cpp
|
||||
accounts/lastfm/LastFmInfoPlugin.cpp
|
||||
|
||||
accounts/spotify/SpotifyAccount.cpp
|
||||
accounts/spotify/SpotifyAccountConfig.cpp
|
||||
accounts/spotify/SpotifyPlaylistUpdater.cpp
|
||||
|
||||
TomahawkTrayIcon.cpp
|
||||
AudioControls.cpp
|
||||
SettingsDialog.cpp
|
||||
DiagnosticsDialog.cpp
|
||||
AccountDelegate.cpp
|
||||
SettingsListDelegate.cpp
|
||||
DelegateConfigWrapper.cpp
|
||||
TomahawkWindow.cpp
|
||||
LoadXSPFDialog.cpp
|
||||
AccountFactoryWrapper.cpp
|
||||
AccountFactoryWrapperDelegate.cpp
|
||||
SocialWidget.cpp
|
||||
)
|
||||
|
||||
@@ -88,8 +102,12 @@ SET( tomahawkUI ${tomahawkUI}
|
||||
StackedSettingsDialog.ui
|
||||
ProxyDialog.ui
|
||||
|
||||
accounts/lastfm/LastFmConfig.ui
|
||||
accounts/spotify/SpotifyAccountConfig.ui
|
||||
|
||||
AudioControls.ui
|
||||
LoadXSPFDialog.ui
|
||||
AccountFactoryWrapper.ui
|
||||
SocialWidget.ui
|
||||
)
|
||||
|
||||
@@ -104,6 +122,7 @@ INCLUDE_DIRECTORIES(
|
||||
network
|
||||
sourcetree
|
||||
topbar
|
||||
utils
|
||||
libtomahawk
|
||||
mac
|
||||
|
||||
@@ -135,6 +154,11 @@ IF( APPLE )
|
||||
SET( tomahawkSources ${tomahawkSources} mac/TomahawkApp_Mac.mm mac/MacShortcutHandler.cpp )
|
||||
ENDIF( APPLE )
|
||||
|
||||
IF(GLOOX_FOUND)
|
||||
INCLUDE_DIRECTORIES( ${GLOOX_INCLUDE_DIR} )
|
||||
SET( tomahawkSources ${tomahawkSources} xmppbot/XmppBot.cpp )
|
||||
ENDIF(GLOOX_FOUND)
|
||||
|
||||
ADD_SUBDIRECTORY( accounts )
|
||||
ADD_SUBDIRECTORY( infoplugins )
|
||||
|
||||
@@ -183,6 +207,9 @@ SET(LINK_LIBRARIES "")
|
||||
IF(LIBLASTFM_FOUND)
|
||||
SET(LINK_LIBRARIES ${LINK_LIBRARIES} tomahawk_lastfm2 )
|
||||
ENDIF(LIBLASTFM_FOUND)
|
||||
IF(GLOOX_FOUND)
|
||||
SET(LINK_LIBRARIES ${LINK_LIBRARIES} ${GLOOX_LIBRARIES} )
|
||||
ENDIF(GLOOX_FOUND)
|
||||
IF(QCA2_FOUND)
|
||||
SET(LINK_LIBRARIES ${LINK_LIBRARIES} ${QCA2_LIBRARIES} )
|
||||
ENDIF(QCA2_FOUND)
|
||||
|
@@ -19,10 +19,9 @@
|
||||
|
||||
#cmakedefine WITH_BREAKPAD
|
||||
#cmakedefine WITH_CRASHREPORTER
|
||||
#cmakedefine WITH_BINARY_ATTICA
|
||||
|
||||
|
||||
#cmakedefine LIBLASTFM_FOUND
|
||||
#cmakedefine GLOOX_FOUND
|
||||
#cmakedefine QCA2_FOUND
|
||||
|
||||
#endif // CONFIG_H_IN
|
||||
|
@@ -124,9 +124,12 @@ DelegateConfigWrapper::rejected()
|
||||
void
|
||||
DelegateConfigWrapper::updateSizeHint()
|
||||
{
|
||||
hide();
|
||||
setSizeGripEnabled( false );
|
||||
setMinimumSize( sizeHint() );
|
||||
setMaximumSize( sizeHint() );
|
||||
|
||||
show();
|
||||
}
|
||||
|
||||
|
@@ -26,13 +26,11 @@
|
||||
#include "network/Servent.h"
|
||||
#include "SourceList.h"
|
||||
|
||||
#include <QLabel>
|
||||
#include <QTextEdit>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QPushButton>
|
||||
#include <QApplication>
|
||||
#include <QClipboard>
|
||||
#include <QDebug>
|
||||
|
||||
#include "utils/Logger.h"
|
||||
#include "sip/SipHandler.h"
|
||||
@@ -44,17 +42,14 @@ DiagnosticsDialog::DiagnosticsDialog( QWidget *parent )
|
||||
{
|
||||
ui->setupUi( this );
|
||||
|
||||
connect( ui->updateButton, SIGNAL( clicked() ), this, SLOT( updateLogView() ) );
|
||||
connect( ui->clipboardButton, SIGNAL( clicked() ), this, SLOT( copyToClipboard() ) );
|
||||
connect( ui->buttonBox, SIGNAL( rejected() ), this, SLOT( reject() ) );
|
||||
|
||||
ui->scrollAreaWidgetContents->setLayout( new QVBoxLayout() );
|
||||
|
||||
updateLogView();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DiagnosticsDialog::updateLogView()
|
||||
void DiagnosticsDialog::updateLogView()
|
||||
{
|
||||
QString log;
|
||||
|
||||
@@ -64,11 +59,16 @@ DiagnosticsDialog::updateLogView()
|
||||
);
|
||||
|
||||
// network
|
||||
log.append( "TOMAHAWK-VERSION: " TOMAHAWK_VERSION "\n\n" );
|
||||
log.append(
|
||||
"TOMAHAWK-VERSION: " TOMAHAWK_VERSION "\n\n\n"
|
||||
);
|
||||
|
||||
// network
|
||||
log.append( "NETWORK:\n General:\n" );
|
||||
if ( Servent::instance()->visibleExternally() )
|
||||
log.append(
|
||||
"NETWORK:\n"
|
||||
" General:\n"
|
||||
);
|
||||
if( Servent::instance()->visibleExternally() )
|
||||
{
|
||||
log.append(
|
||||
QString(
|
||||
@@ -83,13 +83,17 @@ DiagnosticsDialog::updateLogView()
|
||||
}
|
||||
else
|
||||
{
|
||||
log.append( " visible: false" );
|
||||
log.append(
|
||||
QString(
|
||||
" visible: false"
|
||||
)
|
||||
);
|
||||
}
|
||||
log.append("\n\n");
|
||||
|
||||
|
||||
ui->scrollAreaWidgetContents->layout()->addWidget( new QLabel( log, this ) );
|
||||
// Peers / Accounts, TODO
|
||||
ui->scrollAreaWidgetContents->layout()->addWidget( new QLabel( "ACCOUNTS:\n", this ) );
|
||||
|
||||
log.append("ACCOUNTS:\n");
|
||||
const QList< Tomahawk::source_ptr > sources = SourceList::instance()->sources( true );
|
||||
const QList< Tomahawk::Accounts::Account* > accounts = Tomahawk::Accounts::AccountManager::instance()->accounts( Tomahawk::Accounts::SipType );
|
||||
foreach ( Tomahawk::Accounts::Account* account, accounts )
|
||||
@@ -98,104 +102,6 @@ DiagnosticsDialog::updateLogView()
|
||||
if ( !account || !account->sipPlugin() )
|
||||
continue;
|
||||
|
||||
connect( account, SIGNAL( connectionStateChanged( Tomahawk::Accounts::Account::ConnectionState ) ),
|
||||
SLOT( onAccountConnectionStateChanged( Tomahawk::Accounts::Account::ConnectionState ) ) );
|
||||
connect( account, SIGNAL( error( int, QString ) ),
|
||||
SLOT( onAccountError( int, QString ) ) );
|
||||
|
||||
connect( account->sipPlugin(), SIGNAL( peerOnline( QString ) ), SLOT( onPeerOnline( QString ) ) );
|
||||
connect( account->sipPlugin(), SIGNAL( peerOffline( QString ) ), SLOT( onPeerOffline( QString ) ) );
|
||||
connect( account->sipPlugin(), SIGNAL( sipInfoReceived( QString, SipInfo ) ), SLOT( onSipInfoReceived( QString, SipInfo ) ) );
|
||||
connect( account->sipPlugin(), SIGNAL( softwareVersionReceived( QString, QString ) ), SLOT( onSoftwareVersionReceived( QString, QString ) ) );
|
||||
|
||||
QLabel* accountInfoLabel = new QLabel( this );
|
||||
ui->scrollAreaWidgetContents->layout()->addWidget( accountInfoLabel );
|
||||
m_accountDescriptionStore.insert( account, accountInfoLabel );
|
||||
|
||||
updateAccountLabel( account );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DiagnosticsDialog::copyToClipboard()
|
||||
{
|
||||
QString log;
|
||||
foreach ( QLabel* label, m_accountDescriptionStore.values() )
|
||||
{
|
||||
log += label->text() + "\n\n";
|
||||
}
|
||||
|
||||
QApplication::clipboard()->setText( log );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DiagnosticsDialog::onAccountConnectionStateChanged( Tomahawk::Accounts::Account::ConnectionState /* state */ )
|
||||
{
|
||||
Tomahawk::Accounts::Account* account = qobject_cast< Tomahawk::Accounts::Account* >( sender() );
|
||||
Q_ASSERT( account );
|
||||
|
||||
updateAccountLabel( account );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DiagnosticsDialog::onAccountError( int /* errorId */ , QString /* errorString */ )
|
||||
{
|
||||
Tomahawk::Accounts::Account* account = qobject_cast< Tomahawk::Accounts::Account* >( sender() );
|
||||
Q_ASSERT( account );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DiagnosticsDialog::onPeerOnline( const QString& )
|
||||
{
|
||||
Tomahawk::Accounts::Account* account = qobject_cast< SipPlugin* >( sender() )->account();
|
||||
Q_ASSERT( account );
|
||||
|
||||
updateAccountLabel( account );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DiagnosticsDialog::onPeerOffline( const QString& )
|
||||
{
|
||||
Tomahawk::Accounts::Account* account = qobject_cast< SipPlugin* >( sender() )->account();
|
||||
Q_ASSERT( account );
|
||||
|
||||
updateAccountLabel( account );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DiagnosticsDialog::onSipInfoReceived( const QString& /* peerId */ , const SipInfo& /* info */ )
|
||||
{
|
||||
Tomahawk::Accounts::Account* account = qobject_cast< SipPlugin* >( sender() )->account();
|
||||
Q_ASSERT( account );
|
||||
|
||||
updateAccountLabel( account );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DiagnosticsDialog::onSoftwareVersionReceived( const QString& /* peerId */ , const QString& /* versionString */ )
|
||||
{
|
||||
Tomahawk::Accounts::Account* account = qobject_cast< SipPlugin* >( sender() )->account();
|
||||
Q_ASSERT( account );
|
||||
|
||||
updateAccountLabel( account );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DiagnosticsDialog::updateAccountLabel( Tomahawk::Accounts::Account* account )
|
||||
{
|
||||
QLabel* accountInfoLabel = m_accountDescriptionStore.value( account );
|
||||
|
||||
if ( accountInfoLabel )
|
||||
{
|
||||
QString accountInfo;
|
||||
QString stateString;
|
||||
switch( account->connectionState() )
|
||||
{
|
||||
@@ -212,7 +118,7 @@ DiagnosticsDialog::updateAccountLabel( Tomahawk::Accounts::Account* account )
|
||||
case Tomahawk::Accounts::Account::Disconnecting:
|
||||
stateString = "Disconnecting";
|
||||
}
|
||||
accountInfo.append(
|
||||
log.append(
|
||||
QString( " %2 (%1): %3 (%4)\n" )
|
||||
.arg( account->accountServiceName() )
|
||||
.arg( account->sipPlugin()->friendlyName() )
|
||||
@@ -220,43 +126,55 @@ DiagnosticsDialog::updateAccountLabel( Tomahawk::Accounts::Account* account )
|
||||
.arg( stateString )
|
||||
);
|
||||
|
||||
foreach( const QString& peerId, account->sipPlugin()->peersOnline() )
|
||||
foreach( const QString &peerId, account->sipPlugin()->peersOnline() )
|
||||
{
|
||||
/* enable this again, when we check the Source.has this peerId
|
||||
bool connected = false;
|
||||
Q_FOREACH( const Tomahawk::source_ptr &source, sources )
|
||||
{
|
||||
if( source->controlConnection() )
|
||||
{
|
||||
connected = true;
|
||||
break;
|
||||
}
|
||||
}*/
|
||||
|
||||
QString versionString = SipHandler::instance()->versionString( peerId );
|
||||
SipInfo sipInfo = SipHandler::instance()->sipInfo( peerId );
|
||||
if ( !sipInfo.isValid() )
|
||||
{
|
||||
accountInfo.append(
|
||||
if( !sipInfo.isValid() )
|
||||
log.append(
|
||||
QString(" %1: %2 %3" /*"(%4)"*/ "\n")
|
||||
.arg( peerId )
|
||||
.arg( "sipinfo invalid" )
|
||||
.arg( versionString )
|
||||
// .arg( connected ? "connected" : "not connected")
|
||||
);
|
||||
}
|
||||
else if ( sipInfo.isVisible() )
|
||||
{
|
||||
accountInfo.append(
|
||||
else if( sipInfo.isVisible() )
|
||||
log.append(
|
||||
QString(" %1: %2:%3 %4" /*" (%5)"*/ "\n")
|
||||
.arg( peerId )
|
||||
.arg( sipInfo.host().hostName() )
|
||||
.arg( sipInfo.port() )
|
||||
.arg( versionString )
|
||||
// .arg( connected ? "connected" : "not connected")
|
||||
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
accountInfo.append(
|
||||
log.append(
|
||||
QString(" %1: visible: false %2" /*" (%3)"*/ "\n")
|
||||
.arg( peerId )
|
||||
.arg( versionString )
|
||||
// .arg( connected ? "connected" : "not connected")
|
||||
|
||||
);
|
||||
}
|
||||
}
|
||||
accountInfo.append( "\n" );
|
||||
|
||||
accountInfoLabel->setText( accountInfo );
|
||||
log.append("\n");
|
||||
}
|
||||
}
|
||||
ui->logView->setPlainText(log);
|
||||
}
|
||||
|
||||
void DiagnosticsDialog::copyToClipboard()
|
||||
{
|
||||
QApplication::clipboard()->setText( ui->logView->toPlainText() );
|
||||
}
|
||||
|
||||
|
@@ -19,15 +19,7 @@
|
||||
#ifndef DIGANOSTICSDIALOG_H
|
||||
#define DIAGNOSTICSDIALOG_H
|
||||
|
||||
#include "accounts/Account.h"
|
||||
|
||||
#include <QDialog>
|
||||
#include <QMap>
|
||||
|
||||
|
||||
class QLabel;
|
||||
|
||||
class SipInfo;
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
@@ -45,19 +37,8 @@ public:
|
||||
private slots:
|
||||
void updateLogView();
|
||||
void copyToClipboard();
|
||||
|
||||
void onAccountConnectionStateChanged( Tomahawk::Accounts::Account::ConnectionState state );
|
||||
void onAccountError( int errorId, QString errorString );
|
||||
void onPeerOnline( const QString& );
|
||||
void onPeerOffline( const QString& );
|
||||
void onSipInfoReceived( const QString& peerId, const SipInfo& info );
|
||||
void onSoftwareVersionReceived( const QString& peerId, const QString& versionString );
|
||||
|
||||
void updateAccountLabel( Tomahawk::Accounts::Account* );
|
||||
private:
|
||||
|
||||
QMap< Tomahawk::Accounts::Account*, QLabel* > m_accountDescriptionStore;
|
||||
|
||||
Ui::DiagnosticsDialog* ui;
|
||||
};
|
||||
|
||||
|
@@ -26,26 +26,19 @@
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QScrollArea" name="scrollArea">
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>708</width>
|
||||
<height>386</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QTextEdit" name="logView"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="updateButton">
|
||||
<property name="text">
|
||||
<string>Update</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="clipboardButton">
|
||||
<property name="text">
|
||||
|
@@ -106,17 +106,15 @@ MusicScanner::MusicScanner( const QStringList& dirs, quint32 bs )
|
||||
, m_batchsize( bs )
|
||||
, m_dirListerThreadController( 0 )
|
||||
{
|
||||
m_ext2mime.insert( "mp3", TomahawkUtils::extensionToMimetype( "mp3" ) );
|
||||
m_ext2mime.insert( "ogg", TomahawkUtils::extensionToMimetype( "ogg" ) );
|
||||
m_ext2mime.insert( "oga", TomahawkUtils::extensionToMimetype( "oga" ) );
|
||||
m_ext2mime.insert( "mpc", TomahawkUtils::extensionToMimetype( "mpc" ) );
|
||||
m_ext2mime.insert( "wma", TomahawkUtils::extensionToMimetype( "wma" ) );
|
||||
m_ext2mime.insert( "aac", TomahawkUtils::extensionToMimetype( "aac" ) );
|
||||
m_ext2mime.insert( "m4a", TomahawkUtils::extensionToMimetype( "m4a" ) );
|
||||
m_ext2mime.insert( "mp4", TomahawkUtils::extensionToMimetype( "mp4" ) );
|
||||
m_ext2mime.insert( "mp3", TomahawkUtils::extensionToMimetype( "mp3" ) );
|
||||
m_ext2mime.insert( "ogg", TomahawkUtils::extensionToMimetype( "ogg" ) );
|
||||
m_ext2mime.insert( "oga", TomahawkUtils::extensionToMimetype( "oga" ) );
|
||||
m_ext2mime.insert( "mpc", TomahawkUtils::extensionToMimetype( "mpc" ) );
|
||||
m_ext2mime.insert( "wma", TomahawkUtils::extensionToMimetype( "wma" ) );
|
||||
m_ext2mime.insert( "aac", TomahawkUtils::extensionToMimetype( "aac" ) );
|
||||
m_ext2mime.insert( "m4a", TomahawkUtils::extensionToMimetype( "m4a" ) );
|
||||
m_ext2mime.insert( "mp4", TomahawkUtils::extensionToMimetype( "mp4" ) );
|
||||
m_ext2mime.insert( "flac", TomahawkUtils::extensionToMimetype( "flac" ) );
|
||||
m_ext2mime.insert( "aiff", TomahawkUtils::extensionToMimetype( "aiff" ) );
|
||||
m_ext2mime.insert( "aif", TomahawkUtils::extensionToMimetype( "aif" ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -201,16 +199,18 @@ MusicScanner::listerFinished()
|
||||
foreach( const QString& key, m_filemtimes.keys() )
|
||||
m_filesToDelete << m_filemtimes[ key ].keys().first();
|
||||
|
||||
tDebug( LOGINFO ) << "Scanning complete, saving to database. ( deleted" << m_filesToDelete.count() << "- scanned" << m_scanned << "- skipped" << m_skipped << ")";
|
||||
tDebug( LOGEXTRA ) << "Skipped the following files (no tags / no valid audio):";
|
||||
foreach ( const QString& s, m_skippedFiles )
|
||||
tDebug( LOGEXTRA ) << s;
|
||||
tDebug() << "Lister finished: to delete:" << m_filesToDelete;
|
||||
|
||||
if ( m_filesToDelete.length() || m_scannedfiles.length() )
|
||||
{
|
||||
commitBatch( m_scannedfiles, m_filesToDelete );
|
||||
m_scannedfiles.clear();
|
||||
m_filesToDelete.clear();
|
||||
|
||||
tDebug( LOGINFO ) << "Scanning complete, saving to database. ( scanned" << m_scanned << "skipped" << m_skipped << ")";
|
||||
tDebug( LOGEXTRA ) << "Skipped the following files (no tags / no valid audio):";
|
||||
foreach ( const QString& s, m_skippedFiles )
|
||||
tDebug( LOGEXTRA ) << s;
|
||||
}
|
||||
else
|
||||
cleanup();
|
||||
@@ -335,8 +335,9 @@ MusicScanner::readFile( const QFileInfo& fi )
|
||||
|
||||
int bitrate = 0;
|
||||
int duration = 0;
|
||||
|
||||
|
||||
Tag *tag = Tag::fromFile( f );
|
||||
|
||||
if ( f.audioProperties() )
|
||||
{
|
||||
TagLib::AudioProperties *properties = f.audioProperties();
|
||||
@@ -344,14 +345,10 @@ MusicScanner::readFile( const QFileInfo& fi )
|
||||
bitrate = properties->bitrate();
|
||||
}
|
||||
|
||||
QString artist, album, track;
|
||||
if ( tag )
|
||||
{
|
||||
artist = tag->artist().trimmed();
|
||||
album = tag->album().trimmed();
|
||||
track = tag->title().trimmed();
|
||||
}
|
||||
if ( !tag || artist.isEmpty() || track.isEmpty() )
|
||||
QString artist = tag->artist().trimmed();
|
||||
QString album = tag->album().trimmed();
|
||||
QString track = tag->title().trimmed();
|
||||
if ( artist.isEmpty() || track.isEmpty() )
|
||||
{
|
||||
// FIXME: do some clever filename guessing
|
||||
m_skippedFiles << fi.canonicalFilePath();
|
||||
|
117
src/PipelineStatusView.cpp
Normal file
@@ -0,0 +1,117 @@
|
||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||
*
|
||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||
* Copyright 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
|
||||
* 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 "JobStatusView.h"
|
||||
|
||||
#include <QHeaderView>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "libtomahawk/Pipeline.h"
|
||||
|
||||
#include "utils/Logger.h"
|
||||
|
||||
using namespace Tomahawk;
|
||||
|
||||
|
||||
JobStatusView::JobStatusView( AnimatedSplitter* parent )
|
||||
: AnimatedWidget( parent )
|
||||
, m_parent( parent )
|
||||
{
|
||||
setHiddenSize( QSize( 0, 0 ) );
|
||||
setLayout( new QVBoxLayout() );
|
||||
m_tree = new QTreeWidget( this );
|
||||
|
||||
layout()->setMargin( 0 );
|
||||
layout()->addWidget( m_tree );
|
||||
|
||||
QStringList headers;
|
||||
headers << tr( "Searching For" ) << tr( "Pending" );
|
||||
m_tree->setHeaderLabels( headers );
|
||||
|
||||
m_tree->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
|
||||
m_tree->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Ignored );
|
||||
m_tree->setColumnCount( 2 );
|
||||
m_tree->setColumnWidth( 0, 200 );
|
||||
m_tree->setColumnWidth( 1, 50 );
|
||||
|
||||
m_tree->header()->setStretchLastSection( true );
|
||||
m_tree->setRootIsDecorated( false );
|
||||
|
||||
m_tree->setFrameShape( QFrame::NoFrame );
|
||||
m_tree->setAttribute( Qt::WA_MacShowFocusRect, 0 );
|
||||
|
||||
new QTreeWidgetItem( m_tree );
|
||||
|
||||
connect( Pipeline::instance(), SIGNAL( resolving( Tomahawk::query_ptr ) ), SLOT( onPipelineUpdate( Tomahawk::query_ptr ) ) );
|
||||
connect( Pipeline::instance(), SIGNAL( idle() ), SLOT( onPipelineUpdate() ) );
|
||||
|
||||
#ifndef Q_WS_WIN
|
||||
QFont f = font();
|
||||
f.setPointSize( f.pointSize() - 1 );
|
||||
setFont( f );
|
||||
#endif
|
||||
|
||||
#ifdef Q_WS_MAC
|
||||
f.setPointSize( f.pointSize() - 2 );
|
||||
setFont( f );
|
||||
#endif
|
||||
|
||||
onPipelineUpdate();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
JobStatusView::onPipelineUpdate( const query_ptr& query )
|
||||
{
|
||||
QTreeWidgetItem* ti = m_tree->invisibleRootItem()->child( 0 );
|
||||
|
||||
if ( Pipeline::instance()->activeQueryCount() && !query.isNull() )
|
||||
{
|
||||
ti->setText( 0, QString( "%1 - %2" ).arg( query->artist() ).arg( query->track() ) );
|
||||
ti->setText( 1, QString( "%1" ).arg( Pipeline::instance()->activeQueryCount() + Pipeline::instance()->pendingQueryCount() ) );
|
||||
|
||||
if ( isHidden() )
|
||||
emit showWidget();
|
||||
}
|
||||
else
|
||||
{
|
||||
ti->setText( 0, tr( "Idle" ) );
|
||||
ti->setText( 1, QString( "None" ) );
|
||||
|
||||
if ( !isHidden() )
|
||||
emit hideWidget();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
QSize
|
||||
JobStatusView::sizeHint() const
|
||||
{
|
||||
unsigned int y = 0;
|
||||
y += m_tree->header()->height();
|
||||
y += m_tree->contentsMargins().top() + m_tree->contentsMargins().bottom();
|
||||
|
||||
if ( m_tree->invisibleRootItem()->childCount() )
|
||||
{
|
||||
unsigned int rowheight = m_tree->sizeHintForRow( 0 );
|
||||
y += rowheight * m_tree->invisibleRootItem()->childCount() + 2;
|
||||
}
|
||||
|
||||
return QSize( 0, y );
|
||||
}
|
51
src/PipelineStatusView.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||
*
|
||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||
* Copyright 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
|
||||
* 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 JOBSTATUSVIEW_H
|
||||
#define JOBSTATUSVIEW_H
|
||||
|
||||
#include <QTreeWidget>
|
||||
|
||||
#include "Typedefs.h"
|
||||
#include "widgets/AnimatedSplitter.h"
|
||||
#include "Query.h"
|
||||
|
||||
class StreamConnection;
|
||||
|
||||
class JobStatusView : public AnimatedWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit JobStatusView( AnimatedSplitter* parent );
|
||||
virtual ~JobStatusView()
|
||||
{
|
||||
}
|
||||
|
||||
QSize sizeHint() const;
|
||||
|
||||
private slots:
|
||||
void onPipelineUpdate( const Tomahawk::query_ptr& query = Tomahawk::query_ptr() );
|
||||
|
||||
private:
|
||||
QTreeView* m_tree;
|
||||
AnimatedSplitter* m_parent;
|
||||
};
|
||||
|
||||
#endif // JOBSTATUSVIEW_H
|
@@ -44,8 +44,8 @@ Scrobbler::Scrobbler( QObject* parent )
|
||||
SLOT( engineTick( unsigned int ) ), Qt::QueuedConnection );
|
||||
|
||||
connect( Tomahawk::InfoSystem::InfoSystem::instance(),
|
||||
SIGNAL( info( Tomahawk::InfoSystem::InfoRequestData, QVariant ) ),
|
||||
SLOT( infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData, QVariant ) ) );
|
||||
SIGNAL( info( Tomahawk::InfoSystem::InfoRequestData, QVariant ) ),
|
||||
SLOT( infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData, QVariant ) ) );
|
||||
|
||||
connect( AudioEngine::instance(), SIGNAL( started( const Tomahawk::result_ptr& ) ),
|
||||
SLOT( trackStarted( const Tomahawk::result_ptr& ) ), Qt::QueuedConnection );
|
||||
@@ -72,13 +72,16 @@ void
|
||||
Scrobbler::trackStarted( const Tomahawk::result_ptr& track )
|
||||
{
|
||||
Q_ASSERT( QThread::currentThread() == thread() );
|
||||
// qDebug() << Q_FUNC_INFO;
|
||||
|
||||
if ( m_reachedScrobblePoint )
|
||||
if( m_reachedScrobblePoint )
|
||||
{
|
||||
m_reachedScrobblePoint = false;
|
||||
scrobble();
|
||||
}
|
||||
|
||||
QVariantMap playInfo;
|
||||
|
||||
Tomahawk::InfoSystem::InfoStringHash trackInfo;
|
||||
trackInfo["title"] = track->track();
|
||||
trackInfo["artist"] = track->artist()->name();
|
||||
@@ -86,7 +89,6 @@ Scrobbler::trackStarted( const Tomahawk::result_ptr& track )
|
||||
trackInfo["duration"] = QString::number( track->duration() );
|
||||
trackInfo["albumpos"] = QString::number( track->albumpos() );
|
||||
|
||||
QVariantMap playInfo;
|
||||
playInfo["trackinfo"] = QVariant::fromValue< Tomahawk::InfoSystem::InfoStringHash >( trackInfo );
|
||||
playInfo["private"] = TomahawkSettings::instance()->privateListeningMode();
|
||||
|
||||
@@ -124,7 +126,7 @@ Scrobbler::trackStopped()
|
||||
{
|
||||
Q_ASSERT( QThread::currentThread() == thread() );
|
||||
|
||||
if ( m_reachedScrobblePoint )
|
||||
if( m_reachedScrobblePoint )
|
||||
{
|
||||
m_reachedScrobblePoint = false;
|
||||
scrobble();
|
||||
|
@@ -32,16 +32,16 @@
|
||||
#include "AtticaManager.h"
|
||||
#include "TomahawkApp.h"
|
||||
#include "TomahawkSettings.h"
|
||||
#include "accounts/DelegateConfigWrapper.h"
|
||||
#include "DelegateConfigWrapper.h"
|
||||
#include "MusicScanner.h"
|
||||
#include "Pipeline.h"
|
||||
#include "Resolver.h"
|
||||
#include "ExternalResolverGui.h"
|
||||
#include "utils/TomahawkUtilsGui.h"
|
||||
#include "utils/GuiHelpers.h"
|
||||
#include "GuiHelpers.h"
|
||||
#include "ScanManager.h"
|
||||
#include "SettingsListDelegate.h"
|
||||
#include "accounts/AccountDelegate.h"
|
||||
#include "AccountDelegate.h"
|
||||
#include "database/Database.h"
|
||||
#include "network/Servent.h"
|
||||
#include "utils/AnimatedSpinner.h"
|
||||
@@ -51,7 +51,7 @@
|
||||
#include <accounts/AccountModelFilterProxy.h>
|
||||
#include <accounts/ResolverAccount.h>
|
||||
#include "utils/Logger.h"
|
||||
#include "accounts/AccountFactoryWrapper.h"
|
||||
#include "AccountFactoryWrapper.h"
|
||||
#include "accounts/spotify/SpotifyAccount.h"
|
||||
|
||||
#include "ui_ProxyDialog.h"
|
||||
|
@@ -29,7 +29,6 @@
|
||||
#include <QtNetwork/QNetworkReply>
|
||||
#include <QtCore/QFile>
|
||||
#include <QtCore/QFileInfo>
|
||||
#include <QTranslator>
|
||||
|
||||
#include "Artist.h"
|
||||
#include "Album.h"
|
||||
@@ -84,6 +83,11 @@
|
||||
#include <TomahawkSettingsGui.h>
|
||||
#endif
|
||||
|
||||
// should go to a plugin actually
|
||||
#ifdef GLOOX_FOUND
|
||||
#include "xmppbot/XmppBot.h"
|
||||
#endif
|
||||
|
||||
#ifdef Q_WS_MAC
|
||||
#include "mac/MacShortcutHandler.h"
|
||||
|
||||
@@ -130,29 +134,6 @@ TomahawkApp::TomahawkApp( int& argc, char *argv[] )
|
||||
setApplicationVersion( QLatin1String( TOMAHAWK_VERSION ) );
|
||||
|
||||
registerMetaTypes();
|
||||
installTranslator();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TomahawkApp::installTranslator()
|
||||
{
|
||||
QString locale = QLocale::system().name();
|
||||
if ( locale == "C" )
|
||||
locale = "en";
|
||||
|
||||
QTranslator* translator = new QTranslator( this );
|
||||
if ( translator->load( QString( ":/lang/tomahawk_" ) + locale ) )
|
||||
{
|
||||
tDebug() << "Using system locale:" << locale;
|
||||
}
|
||||
else
|
||||
{
|
||||
tDebug() << "Using default locale, system locale one not found:" << locale;
|
||||
translator->load( QString( ":/lang/tomahawk_en" ) );
|
||||
}
|
||||
|
||||
TOMAHAWK_APPLICATION::installTranslator( translator );
|
||||
}
|
||||
|
||||
|
||||
@@ -328,9 +309,9 @@ TomahawkApp::init()
|
||||
connect( r, SIGNAL( finished() ), this, SLOT( spotifyApiCheckFinished() ) );
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
#ifdef Q_WS_MAC
|
||||
// Make sure to do this after main window is inited
|
||||
Tomahawk::enableFullscreen( m_mainwindow );
|
||||
Tomahawk::enableFullscreen();
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -445,7 +426,6 @@ TomahawkApp::registerMetaTypes()
|
||||
qRegisterMetaType<Tomahawk::ModelMode>("Tomahawk::ModelMode");
|
||||
|
||||
// Extra definition for namespaced-versions of signals/slots required
|
||||
qRegisterMetaType< Tomahawk::Resolver* >("Tomahawk::Resolver*");
|
||||
qRegisterMetaType< Tomahawk::source_ptr >("Tomahawk::source_ptr");
|
||||
qRegisterMetaType< Tomahawk::collection_ptr >("Tomahawk::collection_ptr");
|
||||
qRegisterMetaType< Tomahawk::result_ptr >("Tomahawk::result_ptr");
|
||||
@@ -613,6 +593,10 @@ TomahawkApp::initSIP()
|
||||
//FIXME: jabber autoconnect is really more, now that there is sip -- should be renamed and/or split out of jabber-specific settings
|
||||
if ( !arguments().contains( "--nosip" ) )
|
||||
{
|
||||
#ifdef GLOOX_FOUND
|
||||
m_xmppBot = QWeakPointer<XMPPBot>( new XMPPBot( this ) );
|
||||
#endif
|
||||
|
||||
tDebug( LOGINFO ) << "Connecting SIP classes";
|
||||
Accounts::AccountManager::instance()->initSIP();
|
||||
}
|
||||
|
@@ -115,7 +115,6 @@ private slots:
|
||||
void accountManagerReady();
|
||||
|
||||
private:
|
||||
void installTranslator();
|
||||
void registerMetaTypes();
|
||||
|
||||
void printHelp();
|
||||
|
@@ -40,14 +40,8 @@ TomahawkTrayIcon::TomahawkTrayIcon( QObject* parent )
|
||||
, m_currentAnimationFrame( 0 )
|
||||
, m_showWindowAction( 0 )
|
||||
, m_stopContinueAfterTrackAction( 0 )
|
||||
, m_loveTrackAction( 0 )
|
||||
{
|
||||
#ifdef Q_WS_MAC
|
||||
QIcon icon( RESPATH "icons/tomahawk-icon-128x128-grayscale.png" );
|
||||
#else
|
||||
QIcon icon( RESPATH "icons/tomahawk-icon-128x128.png" );
|
||||
#endif
|
||||
|
||||
setIcon( icon );
|
||||
|
||||
refreshToolTip();
|
||||
@@ -55,14 +49,12 @@ TomahawkTrayIcon::TomahawkTrayIcon( QObject* parent )
|
||||
m_contextMenu = new QMenu();
|
||||
setContextMenu( m_contextMenu );
|
||||
|
||||
m_loveTrackAction = new QAction( this );
|
||||
m_stopContinueAfterTrackAction = new QAction( this );
|
||||
onStopContinueAfterTrackChanged();
|
||||
|
||||
ActionCollection *ac = ActionCollection::instance();
|
||||
m_contextMenu->addAction( ac->getAction( "playPause" ) );
|
||||
m_contextMenu->addAction( ac->getAction( "stop" ) );
|
||||
m_contextMenu->addSeparator();
|
||||
m_contextMenu->addAction( m_loveTrackAction );
|
||||
m_contextMenu->addAction( m_stopContinueAfterTrackAction );
|
||||
m_contextMenu->addSeparator();
|
||||
m_contextMenu->addAction( ac->getAction( "previousTrack" ) );
|
||||
@@ -70,6 +62,8 @@ TomahawkTrayIcon::TomahawkTrayIcon( QObject* parent )
|
||||
m_contextMenu->addSeparator();
|
||||
m_contextMenu->addAction( ActionCollection::instance()->getAction( "togglePrivacy" ) );
|
||||
|
||||
connect( m_stopContinueAfterTrackAction, SIGNAL( triggered() ), SLOT( stopContinueAfterTrackActionTriggered() ) );
|
||||
|
||||
#ifdef Q_WS_MAC
|
||||
// On mac you can close the windows while leaving the app open. We then need a way to show the main window again
|
||||
m_contextMenu->addSeparator();
|
||||
@@ -83,9 +77,6 @@ TomahawkTrayIcon::TomahawkTrayIcon( QObject* parent )
|
||||
m_contextMenu->addSeparator();
|
||||
m_contextMenu->addAction( ac->getAction( "quit" ) );
|
||||
|
||||
connect( m_loveTrackAction, SIGNAL( triggered() ), SLOT( loveTrackTriggered() ) );
|
||||
connect( m_stopContinueAfterTrackAction, SIGNAL( triggered() ), SLOT( stopContinueAfterTrackActionTriggered() ) );
|
||||
|
||||
connect( AudioEngine::instance(), SIGNAL( loading( Tomahawk::result_ptr ) ), SLOT( setResult( Tomahawk::result_ptr ) ) );
|
||||
connect( AudioEngine::instance(), SIGNAL( started( Tomahawk::result_ptr ) ), SLOT( onPlay() ) );
|
||||
connect( AudioEngine::instance(), SIGNAL( resumed() ), SLOT( onResume() ) );
|
||||
@@ -96,7 +87,6 @@ TomahawkTrayIcon::TomahawkTrayIcon( QObject* parent )
|
||||
connect( &m_animationTimer, SIGNAL( timeout() ), SLOT( onAnimationTimer() ) );
|
||||
connect( this, SIGNAL( activated( QSystemTrayIcon::ActivationReason ) ), SLOT( onActivated( QSystemTrayIcon::ActivationReason ) ) );
|
||||
|
||||
onStop();
|
||||
show();
|
||||
}
|
||||
|
||||
@@ -156,29 +146,8 @@ TomahawkTrayIcon::menuAboutToShow()
|
||||
void
|
||||
TomahawkTrayIcon::setResult( const Tomahawk::result_ptr& result )
|
||||
{
|
||||
if ( m_currentTrack )
|
||||
{
|
||||
disconnect( m_currentTrack->toQuery().data(), SIGNAL( socialActionsLoaded() ), this, SLOT( onSocialActionsLoaded() ) );
|
||||
}
|
||||
|
||||
m_currentTrack = result;
|
||||
refreshToolTip();
|
||||
|
||||
if ( result )
|
||||
connect( result->toQuery().data(), SIGNAL( socialActionsLoaded() ), SLOT( onSocialActionsLoaded() ), Qt::UniqueConnection );
|
||||
|
||||
onSocialActionsLoaded();
|
||||
onStopContinueAfterTrackChanged();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TomahawkTrayIcon::onStopContinueAfterTrackChanged()
|
||||
{
|
||||
if ( m_currentTrack && m_currentTrack->toQuery()->equals( AudioEngine::instance()->stopAfterTrack() ) )
|
||||
m_stopContinueAfterTrackAction->setText( tr( "&Continue Playback after current Track" ) );
|
||||
else
|
||||
m_stopContinueAfterTrackAction->setText( tr( "&Stop Playback after current Track" ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -266,20 +235,16 @@ TomahawkTrayIcon::onPause()
|
||||
void
|
||||
TomahawkTrayIcon::onPlay()
|
||||
{
|
||||
m_loveTrackAction->setEnabled( true );
|
||||
m_stopContinueAfterTrackAction->setEnabled( true );
|
||||
|
||||
onResume();
|
||||
onStopContinueAfterTrackChanged();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TomahawkTrayIcon::onStop()
|
||||
{
|
||||
m_loveTrackAction->setEnabled( false );
|
||||
m_stopContinueAfterTrackAction->setEnabled( false );
|
||||
|
||||
setResult( Tomahawk::result_ptr() );
|
||||
onPause();
|
||||
}
|
||||
|
||||
@@ -292,41 +257,26 @@ TomahawkTrayIcon::onResume()
|
||||
|
||||
|
||||
void
|
||||
TomahawkTrayIcon::loveTrackTriggered()
|
||||
TomahawkTrayIcon::onStopContinueAfterTrackChanged()
|
||||
{
|
||||
if ( !m_currentTrack )
|
||||
return;
|
||||
|
||||
m_currentTrack->toQuery()->setLoved( !m_currentTrack->toQuery()->loved() );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TomahawkTrayIcon::stopContinueAfterTrackActionTriggered()
|
||||
{
|
||||
if ( !m_currentTrack )
|
||||
return;
|
||||
|
||||
if ( !m_currentTrack->toQuery()->equals( AudioEngine::instance()->stopAfterTrack() ) )
|
||||
AudioEngine::instance()->setStopAfterTrack( m_currentTrack->toQuery() );
|
||||
else
|
||||
AudioEngine::instance()->setStopAfterTrack( Tomahawk::query_ptr() );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TomahawkTrayIcon::onSocialActionsLoaded()
|
||||
{
|
||||
m_loveTrackAction->setText( tr( "&Love" ) );
|
||||
m_loveTrackAction->setIcon( QIcon( RESPATH "images/loved.png" ) );
|
||||
|
||||
if ( !m_currentTrack )
|
||||
return;
|
||||
|
||||
if ( m_currentTrack->toQuery()->loved() )
|
||||
if ( !AudioEngine::instance()->currentTrack().isNull() )
|
||||
{
|
||||
m_loveTrackAction->setText( tr( "Un-&Love" ) );
|
||||
m_loveTrackAction->setIcon( QIcon( RESPATH "images/not-loved.png" ) );
|
||||
if ( AudioEngine::instance()->currentTrack()->toQuery()->equals( AudioEngine::instance()->stopAfterTrack() ) )
|
||||
m_stopContinueAfterTrackAction->setText( tr( "&Continue Playback after current Track" ) );
|
||||
else
|
||||
m_stopContinueAfterTrackAction->setText( tr( "&Stop Playback after current Track" ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void TomahawkTrayIcon::stopContinueAfterTrackActionTriggered()
|
||||
{
|
||||
if ( !AudioEngine::instance()->currentTrack().isNull() )
|
||||
{
|
||||
if ( !AudioEngine::instance()->currentTrack()->toQuery()->equals( AudioEngine::instance()->stopAfterTrack() ) )
|
||||
AudioEngine::instance()->setStopAfterTrack( AudioEngine::instance()->currentTrack()->toQuery() );
|
||||
else
|
||||
AudioEngine::instance()->setStopAfterTrack( Tomahawk::query_ptr() );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -352,3 +302,4 @@ TomahawkTrayIcon::event( QEvent* e )
|
||||
|
||||
return QSystemTrayIcon::event( e );
|
||||
}
|
||||
|
||||
|
@@ -49,13 +49,10 @@ private slots:
|
||||
void onStop();
|
||||
void onResume();
|
||||
|
||||
void onSocialActionsLoaded();
|
||||
void onStopContinueAfterTrackChanged();
|
||||
void stopContinueAfterTrackActionTriggered();
|
||||
void loveTrackTriggered();
|
||||
|
||||
void menuAboutToShow();
|
||||
|
||||
private:
|
||||
void refreshToolTip();
|
||||
~TomahawkTrayIcon();
|
||||
@@ -70,7 +67,6 @@ private:
|
||||
|
||||
QAction* m_showWindowAction;
|
||||
QAction* m_stopContinueAfterTrackAction;
|
||||
QAction* m_loveTrackAction;
|
||||
};
|
||||
|
||||
#endif // TOMAHAWK_TRAYICON_H
|
||||
|
@@ -35,12 +35,14 @@
|
||||
#include <QTimer>
|
||||
#include <QToolBar>
|
||||
|
||||
#include "Playlist.h"
|
||||
#include "Query.h"
|
||||
#include "Artist.h"
|
||||
#include "ViewManager.h"
|
||||
#include "accounts/AccountManager.h"
|
||||
#include "sourcetree/SourceTreeView.h"
|
||||
#include "network/Servent.h"
|
||||
#include "utils/TomahawkUtilsGui.h"
|
||||
#include "utils/ProxyStyle.h"
|
||||
#include "utils/WidgetDragFilter.h"
|
||||
#include "widgets/AnimatedSplitter.h"
|
||||
#include "widgets/NewPlaylistWidget.h"
|
||||
#include "widgets/SearchWidget.h"
|
||||
@@ -50,31 +52,27 @@
|
||||
#include "playlist/PlaylistModel.h"
|
||||
#include "playlist/PlaylistView.h"
|
||||
#include "playlist/QueueView.h"
|
||||
#include "jobview/JobStatusView.h"
|
||||
#include "jobview/JobStatusModel.h"
|
||||
#include "jobview/ErrorStatusMessage.h"
|
||||
#include "jobview/JobStatusModel.h"
|
||||
|
||||
#include "Playlist.h"
|
||||
#include "Query.h"
|
||||
#include "Artist.h"
|
||||
#include "ViewManager.h"
|
||||
#include "ActionCollection.h"
|
||||
#include "AudioControls.h"
|
||||
#include "SettingsDialog.h"
|
||||
#include "DiagnosticsDialog.h"
|
||||
#include "TomahawkSettings.h"
|
||||
#include "SourceList.h"
|
||||
#include "jobview/JobStatusView.h"
|
||||
#include "jobview/JobStatusModel.h"
|
||||
#include "jobview/ErrorStatusMessage.h"
|
||||
#include "TomahawkTrayIcon.h"
|
||||
#include "ScanManager.h"
|
||||
#include "TomahawkApp.h"
|
||||
#include "LoadXSPFDialog.h"
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
#include <qtsparkle/Updater>
|
||||
#endif
|
||||
|
||||
#include "utils/Logger.h"
|
||||
#include "jobview/JobStatusModel.h"
|
||||
#include "LoadXSPFDialog.h"
|
||||
#include <ActionCollection.h>
|
||||
|
||||
using namespace Tomahawk;
|
||||
using namespace Accounts;
|
||||
@@ -120,8 +118,6 @@ TomahawkWindow::TomahawkWindow( QWidget* parent )
|
||||
|
||||
// set initial state
|
||||
onAccountDisconnected();
|
||||
audioStopped();
|
||||
|
||||
vm->setQueue( m_queueView );
|
||||
vm->showWelcomePage();
|
||||
}
|
||||
@@ -195,7 +191,7 @@ TomahawkWindow::applyPlatformTweaks()
|
||||
if ( !QString( qApp->style()->metaObject()->className() ).toLower().contains( "qtcurve" ) )
|
||||
qApp->setStyle( new ProxyStyle() );
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
#ifdef Q_WS_MAC
|
||||
setUnifiedTitleAndToolBarOnMac( true );
|
||||
delete ui->hline1;
|
||||
delete ui->hline2;
|
||||
@@ -215,12 +211,7 @@ TomahawkWindow::setupToolBar()
|
||||
toolbar->setFloatable( false );
|
||||
toolbar->setIconSize( QSize( 22, 22 ) );
|
||||
toolbar->setToolButtonStyle( Qt::ToolButtonIconOnly );
|
||||
toolbar->setStyleSheet( "border-bottom: 0px" );
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
toolbar->installEventFilter( new WidgetDragFilter( toolbar ) );
|
||||
#endif
|
||||
|
||||
|
||||
m_backAction = toolbar->addAction( QIcon( RESPATH "images/back.png" ), tr( "Back" ), ViewManager::instance(), SLOT( historyBack() ) );
|
||||
m_backAction->setToolTip( tr( "Go back one page" ) );
|
||||
m_forwardAction = toolbar->addAction( QIcon( RESPATH "images/forward.png" ), tr( "Forward" ), ViewManager::instance(), SLOT( historyForward() ) );
|
||||
@@ -260,6 +251,10 @@ TomahawkWindow::setupSideBar()
|
||||
jobsView->setModel( m_jobsModel );
|
||||
|
||||
m_queueView = new QueueView( m_sidebar );
|
||||
m_queueModel = new PlaylistModel( m_queueView );
|
||||
m_queueModel->setStyle( PlaylistModel::Short );
|
||||
m_queueView->queue()->setPlaylistModel( m_queueModel );
|
||||
m_queueView->queue()->playlistModel()->setReadOnly( false );
|
||||
AudioEngine::instance()->setQueue( m_queueView->queue()->proxyModel()->playlistInterface() );
|
||||
|
||||
m_sidebar->addWidget( m_sourcetree );
|
||||
@@ -276,7 +271,7 @@ TomahawkWindow::setupSideBar()
|
||||
sidebarWidget->layout()->setContentsMargins( 0, 0, 0, 0 );
|
||||
sidebarWidget->layout()->setMargin( 0 );
|
||||
|
||||
#ifndef Q_OS_MAC
|
||||
#ifndef Q_WS_MAC
|
||||
sidebarWidget->layout()->setSpacing( 0 );
|
||||
#endif
|
||||
|
||||
@@ -291,11 +286,11 @@ TomahawkWindow::setupSideBar()
|
||||
void
|
||||
TomahawkWindow::setupUpdateCheck()
|
||||
{
|
||||
#ifndef Q_OS_MAC
|
||||
#ifndef Q_WS_MAC
|
||||
ui->menu_Help->insertSeparator( ui->actionAboutTomahawk );
|
||||
#endif
|
||||
|
||||
#if defined( Q_OS_MAC ) && defined( HAVE_SPARKLE )
|
||||
#if defined( Q_WS_MAC ) && defined( HAVE_SPARKLE )
|
||||
QAction* checkForUpdates = ui->menu_Help->addAction( tr( "Check For Updates..." ) );
|
||||
checkForUpdates->setMenuRole( QAction::ApplicationSpecificRole );
|
||||
connect( checkForUpdates, SIGNAL( triggered( bool ) ), SLOT( checkForUpdates() ) );
|
||||
@@ -333,7 +328,7 @@ TomahawkWindow::setupSignals()
|
||||
connect( AudioEngine::instance(), SIGNAL( loading( const Tomahawk::result_ptr& ) ), SLOT( onPlaybackLoading( const Tomahawk::result_ptr& ) ) );
|
||||
connect( AudioEngine::instance(), SIGNAL( started( Tomahawk::result_ptr ) ), SLOT( audioStarted() ) );
|
||||
connect( AudioEngine::instance(), SIGNAL( resumed()), SLOT( audioStarted() ) );
|
||||
connect( AudioEngine::instance(), SIGNAL( paused() ), SLOT( audioPaused() ) );
|
||||
connect( AudioEngine::instance(), SIGNAL( paused() ), SLOT( audioStopped() ) );
|
||||
connect( AudioEngine::instance(), SIGNAL( stopped() ), SLOT( audioStopped() ) );
|
||||
|
||||
// <Menu Items>
|
||||
@@ -354,7 +349,7 @@ TomahawkWindow::setupSignals()
|
||||
connect( ui->actionNext, SIGNAL( triggered() ), AudioEngine::instance(), SLOT( next() ) );
|
||||
connect( ui->actionPrevious, SIGNAL( triggered() ), AudioEngine::instance(), SLOT( previous() ) );
|
||||
|
||||
#if defined( Q_OS_MAC )
|
||||
#if defined( Q_WS_MAC )
|
||||
connect( ui->actionMinimize, SIGNAL( triggered() ), SLOT( minimize() ) );
|
||||
connect( ui->actionZoom, SIGNAL( triggered() ), SLOT( maximize() ) );
|
||||
#else
|
||||
@@ -403,7 +398,7 @@ TomahawkWindow::changeEvent( QEvent* e )
|
||||
void
|
||||
TomahawkWindow::closeEvent( QCloseEvent* e )
|
||||
{
|
||||
#ifndef Q_OS_MAC
|
||||
#ifndef Q_WS_MAC
|
||||
if ( e->spontaneous() && QSystemTrayIcon::isSystemTrayAvailable() )
|
||||
{
|
||||
hide();
|
||||
@@ -423,7 +418,7 @@ TomahawkWindow::showEvent( QShowEvent* e )
|
||||
{
|
||||
QMainWindow::showEvent( e );
|
||||
|
||||
#if defined( Q_OS_MAC )
|
||||
#if defined( Q_WS_MAC )
|
||||
ui->actionMinimize->setDisabled( false );
|
||||
ui->actionZoom->setDisabled( false );
|
||||
#endif
|
||||
@@ -435,7 +430,7 @@ TomahawkWindow::hideEvent( QHideEvent* e )
|
||||
{
|
||||
QMainWindow::hideEvent( e );
|
||||
|
||||
#if defined( Q_OS_MAC )
|
||||
#if defined( Q_WS_MAC )
|
||||
ui->actionMinimize->setDisabled( true );
|
||||
ui->actionZoom->setDisabled( true );
|
||||
#endif
|
||||
@@ -446,7 +441,7 @@ void
|
||||
TomahawkWindow::keyPressEvent( QKeyEvent* e )
|
||||
{
|
||||
bool accept = true;
|
||||
#if ! defined ( Q_OS_MAC )
|
||||
#if ! defined ( Q_WS_MAC )
|
||||
#define KEY_PRESSED Q_FUNC_INFO << "Multimedia Key Pressed:"
|
||||
switch( e->key() )
|
||||
{
|
||||
@@ -594,25 +589,11 @@ TomahawkWindow::showOfflineSources()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TomahawkWindow::fullScreenEntered()
|
||||
{
|
||||
statusBar()->setSizeGripEnabled( false );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TomahawkWindow::fullScreenExited()
|
||||
{
|
||||
statusBar()->setSizeGripEnabled( true );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TomahawkWindow::loadSpiff()
|
||||
{
|
||||
LoadXSPFDialog* diag = new LoadXSPFDialog( this, Qt::Sheet );
|
||||
#ifdef Q_OS_MAC
|
||||
#ifdef Q_WS_MAC
|
||||
connect( diag, SIGNAL( finished( int ) ), this, SLOT( loadXspfFinished( int ) ) );
|
||||
diag->show();
|
||||
#else
|
||||
@@ -698,18 +679,18 @@ TomahawkWindow::onAudioEngineError( AudioEngine::AudioErrorCode /* error */ )
|
||||
void
|
||||
TomahawkWindow::createAutomaticPlaylist( QString playlistName )
|
||||
{
|
||||
if ( playlistName.isEmpty() )
|
||||
QString name = playlistName;
|
||||
|
||||
if ( name.isEmpty() )
|
||||
return;
|
||||
|
||||
source_ptr author = SourceList::instance()->getLocal();
|
||||
QString id = uuid();
|
||||
QString info = ""; // FIXME
|
||||
QString creator = "someone"; // FIXME
|
||||
|
||||
dynplaylist_ptr playlist = DynamicPlaylist::create( author, id, playlistName, info, creator, Static, false );
|
||||
dynplaylist_ptr playlist = DynamicPlaylist::create( author, id, name, info, creator, Static, false );
|
||||
playlist->setMode( Static );
|
||||
playlist->createNewRevision( uuid(), playlist->currentrevision(), playlist->type(), playlist->generator()->controls(), playlist->entries() );
|
||||
|
||||
ViewManager::instance()->show( playlist );
|
||||
}
|
||||
|
||||
@@ -717,36 +698,18 @@ TomahawkWindow::createAutomaticPlaylist( QString playlistName )
|
||||
void
|
||||
TomahawkWindow::createStation()
|
||||
{
|
||||
QString title = tr( "Station" );
|
||||
bool ok;
|
||||
QString playlistName = QInputDialog( this, Qt::Sheet ).getText( this, tr( "Create New Station" ), tr( "Name:" ), QLineEdit::Normal, title, &ok );
|
||||
if ( !ok )
|
||||
QString name = QInputDialog::getText( this, tr( "Create New Station" ), tr( "Name:" ), QLineEdit::Normal, tr( "New Station" ), &ok );
|
||||
if ( !ok || name.isEmpty() )
|
||||
return;
|
||||
|
||||
if ( playlistName.isEmpty() || playlistName == title )
|
||||
{
|
||||
QList< dynplaylist_ptr > pls = SourceList::instance()->getLocal()->collection()->stations();
|
||||
QStringList titles;
|
||||
foreach ( const playlist_ptr& pl, pls )
|
||||
titles << pl->title();
|
||||
|
||||
playlistName = title;
|
||||
int i = 2;
|
||||
while ( titles.contains( playlistName ) )
|
||||
{
|
||||
playlistName = QString( "%1 (%2)" ).arg( title ).arg( i++ );
|
||||
}
|
||||
}
|
||||
|
||||
source_ptr author = SourceList::instance()->getLocal();
|
||||
QString id = uuid();
|
||||
QString info = ""; // FIXME
|
||||
QString creator = "someone"; // FIXME
|
||||
|
||||
dynplaylist_ptr playlist = DynamicPlaylist::create( author, id, playlistName, info, creator, OnDemand, false );
|
||||
dynplaylist_ptr playlist = DynamicPlaylist::create( author, id, name, info, creator, OnDemand, false );
|
||||
playlist->setMode( OnDemand );
|
||||
playlist->createNewRevision( uuid(), playlist->currentrevision(), playlist->type(), playlist->generator()->controls() );
|
||||
|
||||
ViewManager::instance()->show( playlist );
|
||||
}
|
||||
|
||||
@@ -755,12 +718,11 @@ void
|
||||
TomahawkWindow::createPlaylist()
|
||||
{
|
||||
PlaylistTypeSelectorDlg* playlistSelectorDlg = new PlaylistTypeSelectorDlg( TomahawkApp::instance()->mainWindow(), Qt::Sheet );
|
||||
|
||||
#ifndef Q_OS_MAC
|
||||
#ifndef Q_WS_MAC
|
||||
playlistSelectorDlg->setModal( true );
|
||||
#endif
|
||||
connect( playlistSelectorDlg, SIGNAL( finished( int ) ), this, SLOT( playlistCreateDialogFinished( int ) ) );
|
||||
|
||||
connect( playlistSelectorDlg, SIGNAL( finished( int ) ), SLOT( playlistCreateDialogFinished( int ) ) );
|
||||
playlistSelectorDlg->show();
|
||||
}
|
||||
|
||||
@@ -772,50 +734,17 @@ TomahawkWindow::playlistCreateDialogFinished( int ret )
|
||||
Q_ASSERT( playlistSelectorDlg );
|
||||
|
||||
QString playlistName = playlistSelectorDlg->playlistName();
|
||||
if ( playlistName.isEmpty() )
|
||||
playlistName = tr( "New Playlist" );
|
||||
|
||||
if ( !playlistSelectorDlg->playlistTypeIsAuto() && ret )
|
||||
{
|
||||
if ( playlistName.isEmpty() )
|
||||
{
|
||||
QList< playlist_ptr > pls = SourceList::instance()->getLocal()->collection()->playlists();
|
||||
QStringList titles;
|
||||
foreach ( const playlist_ptr& pl, pls )
|
||||
titles << pl->title();
|
||||
|
||||
QString title = tr( "Playlist" );
|
||||
playlistName = title;
|
||||
int i = 2;
|
||||
while ( titles.contains( playlistName ) )
|
||||
{
|
||||
playlistName = QString( "%1 (%2)" ).arg( title ).arg( i++ );
|
||||
}
|
||||
}
|
||||
if ( !playlistSelectorDlg->playlistTypeIsAuto() && ret ) {
|
||||
|
||||
playlist_ptr playlist = Tomahawk::Playlist::create( SourceList::instance()->getLocal(), uuid(), playlistName, "", "", false, QList< query_ptr>() );
|
||||
ViewManager::instance()->show( playlist );
|
||||
}
|
||||
else if ( playlistSelectorDlg->playlistTypeIsAuto() && ret )
|
||||
{
|
||||
} else if ( playlistSelectorDlg->playlistTypeIsAuto() && ret ) {
|
||||
// create Auto Playlist
|
||||
if ( playlistName.isEmpty() )
|
||||
{
|
||||
QList< dynplaylist_ptr > pls = SourceList::instance()->getLocal()->collection()->autoPlaylists();
|
||||
QStringList titles;
|
||||
foreach ( const dynplaylist_ptr& pl, pls )
|
||||
titles << pl->title();
|
||||
|
||||
QString title = tr( "Automatic Playlist" );
|
||||
playlistName = title;
|
||||
int i = 2;
|
||||
while ( titles.contains( playlistName ) )
|
||||
{
|
||||
playlistName = QString( "%1 (%2)" ).arg( title ).arg( i++ );
|
||||
}
|
||||
}
|
||||
|
||||
createAutomaticPlaylist( playlistName );
|
||||
}
|
||||
|
||||
playlistSelectorDlg->deleteLater();
|
||||
}
|
||||
|
||||
@@ -824,27 +753,21 @@ void
|
||||
TomahawkWindow::audioStarted()
|
||||
{
|
||||
m_audioRetryCounter = 0;
|
||||
|
||||
ui->actionPlay->setText( tr( "Pause" ) );
|
||||
ActionCollection::instance()->getAction( "stop" )->setEnabled( true );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TomahawkWindow::audioPaused()
|
||||
{
|
||||
ui->actionPlay->setText( tr( "Play" ) );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TomahawkWindow::audioStopped()
|
||||
{
|
||||
audioPaused();
|
||||
ActionCollection::instance()->getAction( "stop" )->setEnabled( false );
|
||||
ui->actionPlay->setText( tr( "Play" ) );
|
||||
|
||||
m_currentTrack = result_ptr();
|
||||
setWindowTitle( m_windowTitle );
|
||||
tDebug() << Q_FUNC_INFO << AudioEngine::instance()->isStopped();
|
||||
if ( AudioEngine::instance()->isStopped() )
|
||||
{
|
||||
m_currentTrack = result_ptr();
|
||||
setWindowTitle( m_windowTitle );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -924,13 +847,8 @@ TomahawkWindow::showAboutTomahawk()
|
||||
.arg( TomahawkUtils::appFriendlyVersion() );
|
||||
#endif
|
||||
|
||||
const QString copyright( tr( "Copyright 2010 - 2012" ) );
|
||||
const QString thanksto( tr( "Thanks to:" ) );
|
||||
|
||||
desc = QString( "%1<br/>Christian Muehlhaeuser <muesli@tomahawk-player.org><br/><br/>"
|
||||
"%2 Leo Franchi, Jeff Mitchell, Dominik Schmidt, Jason Herskowitz, Alejandro Wainzinger, Hugo Lindström, Syd Lawrence, Michael Zanetti, Harald Sitter, Steve Robertson" )
|
||||
.arg( copyright )
|
||||
.arg( thanksto );
|
||||
desc = tr( "Copyright 2010 - 2012<br/>Christian Muehlhaeuser <muesli@tomahawk-player.org><br/><br/>"
|
||||
"Thanks to: Leo Franchi, Jeff Mitchell, Dominik Schmidt, Jason Herskowitz, Alejandro Wainzinger, Hugo Lindström, Michael Zanetti, Harald Sitter and Steve Robertson" );
|
||||
|
||||
QMessageBox::about( this, tr( "About Tomahawk" ), head + desc );
|
||||
}
|
||||
@@ -939,7 +857,7 @@ TomahawkWindow::showAboutTomahawk()
|
||||
void
|
||||
TomahawkWindow::checkForUpdates()
|
||||
{
|
||||
#ifdef Q_OS_MAC
|
||||
#ifdef Q_WS_MAC
|
||||
Tomahawk::checkForUpdates();
|
||||
#endif
|
||||
}
|
||||
|
@@ -88,9 +88,6 @@ public slots:
|
||||
void pluginMenuRemoved(QMenu*);
|
||||
void showOfflineSources();
|
||||
|
||||
void fullScreenEntered();
|
||||
void fullScreenExited();
|
||||
|
||||
private slots:
|
||||
void onAccountAdded( Tomahawk::Accounts::Account* account );
|
||||
void onAccountConnected();
|
||||
@@ -110,7 +107,6 @@ private slots:
|
||||
void onPlaybackLoading( const Tomahawk::result_ptr& result );
|
||||
|
||||
void audioStarted();
|
||||
void audioPaused();
|
||||
void audioStopped();
|
||||
|
||||
void showAboutTomahawk();
|
||||
@@ -148,6 +144,7 @@ private:
|
||||
SourceTreeView* m_sourcetree;
|
||||
QPushButton* m_statusButton;
|
||||
QPushButton* m_queueButton;
|
||||
PlaylistModel* m_queueModel;
|
||||
QueueView* m_queueView;
|
||||
AnimatedSplitter* m_sidebar;
|
||||
JobStatusModel* m_jobsModel;
|
||||
|
@@ -55,8 +55,6 @@ LastFmAccountFactory::icon() const
|
||||
LastFmAccount::LastFmAccount( const QString& accountId )
|
||||
: CustomAtticaAccount( accountId )
|
||||
{
|
||||
connect( this, SIGNAL( credentialsLoaded( QVariantHash ) ), this, SLOT( onCredentialsLoaded( QVariantHash ) ) );
|
||||
|
||||
setAccountFriendlyName( "Last.Fm" );
|
||||
m_icon.load( RESPATH "images/lastfm-icon.png" );
|
||||
|
||||
@@ -77,6 +75,7 @@ LastFmAccount::LastFmAccount( const QString& accountId )
|
||||
{
|
||||
infoPlugin().data()->moveToThread( Tomahawk::InfoSystem::InfoSystem::instance()->workerThread().data() );
|
||||
Tomahawk::InfoSystem::InfoSystem::instance()->addInfoPlugin( infoPlugin() );
|
||||
QMetaObject::invokeMethod( infoPlugin().data(), "init", Qt::QueuedConnection );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,7 +153,7 @@ LastFmAccount::configurationWidget()
|
||||
Account::ConnectionState
|
||||
LastFmAccount::connectionState() const
|
||||
{
|
||||
return ( !m_resolver.isNull() && m_resolver.data()->running() ) ? Account::Connected : Account::Disconnected;
|
||||
return (!m_resolver.isNull() && m_resolver.data()->running()) ? Account::Connected : Account::Disconnected;
|
||||
}
|
||||
|
||||
|
||||
@@ -191,66 +190,57 @@ LastFmAccount::saveConfig()
|
||||
setScrobble( m_configWidget.data()->scrobble() );
|
||||
}
|
||||
|
||||
saveCredentials( m_credentials );
|
||||
}
|
||||
sync();
|
||||
|
||||
|
||||
void
|
||||
LastFmAccount::onCredentialsLoaded(const QVariantHash &credentials)
|
||||
{
|
||||
m_credentials = credentials;
|
||||
if ( !m_infoPlugin.isNull() )
|
||||
m_infoPlugin.data()->settingsChanged();
|
||||
if ( m_infoPlugin )
|
||||
QTimer::singleShot( 0, m_infoPlugin.data(), SLOT( settingsChanged() ) );
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
LastFmAccount::password() const
|
||||
{
|
||||
return m_credentials.value( "password" ).toString();
|
||||
return credentials().value( "password" ).toString();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
LastFmAccount::setPassword( const QString& password, bool immediate )
|
||||
LastFmAccount::setPassword( const QString& password )
|
||||
{
|
||||
m_credentials[ "password" ] = password;
|
||||
|
||||
if ( immediate )
|
||||
saveCredentials( m_credentials );
|
||||
QVariantHash creds = credentials();
|
||||
creds[ "password" ] = password;
|
||||
setCredentials( creds );
|
||||
}
|
||||
|
||||
QString
|
||||
LastFmAccount::sessionKey() const
|
||||
{
|
||||
return m_credentials.value( "sessionkey" ).toString();
|
||||
return credentials().value( "sessionkey" ).toString();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
LastFmAccount::setSessionKey( const QString& sessionkey, bool immediate )
|
||||
LastFmAccount::setSessionKey( const QString& sessionkey )
|
||||
{
|
||||
m_credentials[ "sessionkey" ] = sessionkey;
|
||||
|
||||
if ( immediate )
|
||||
saveCredentials( m_credentials );
|
||||
QVariantHash creds = credentials();
|
||||
creds[ "sessionkey" ] = sessionkey;
|
||||
setCredentials( creds );
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
LastFmAccount::username() const
|
||||
{
|
||||
return m_credentials.value( "username" ).toString();
|
||||
return credentials().value( "username" ).toString();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
LastFmAccount::setUsername( const QString& username, bool immediate )
|
||||
LastFmAccount::setUsername( const QString& username )
|
||||
{
|
||||
m_credentials[ "username" ] = username;
|
||||
|
||||
if ( immediate )
|
||||
saveCredentials( m_credentials );
|
||||
QVariantHash creds = credentials();
|
||||
creds[ "username" ] = username;
|
||||
setCredentials( creds );
|
||||
}
|
||||
|
||||
|
||||
@@ -299,7 +289,7 @@ LastFmAccount::hookupResolver()
|
||||
|
||||
const AtticaManager::Resolver data = AtticaManager::instance()->resolverData( res.id() );
|
||||
|
||||
m_resolver = QWeakPointer< ExternalResolverGui >( qobject_cast< ExternalResolverGui* >( Pipeline::instance()->addScriptResolver( data.scriptPath ) ) );
|
||||
m_resolver = QWeakPointer< ExternalResolverGui >( qobject_cast< ExternalResolverGui* >( Pipeline::instance()->addScriptResolver( data.scriptPath, enabled() ) ) );
|
||||
connect( m_resolver.data(), SIGNAL( changed() ), this, SLOT( resolverChanged() ) );
|
||||
}
|
||||
|
@@ -21,7 +21,6 @@
|
||||
|
||||
#include "accounts/Account.h"
|
||||
#include "AtticaManager.h"
|
||||
#include "DllMacro.h"
|
||||
|
||||
#include <attica/content.h>
|
||||
|
||||
@@ -38,7 +37,7 @@ namespace Accounts {
|
||||
|
||||
class LastFmConfig;
|
||||
|
||||
class DLLEXPORT LastFmAccountFactory : public AccountFactory
|
||||
class LastFmAccountFactory : public AccountFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@@ -58,11 +57,11 @@ private:
|
||||
};
|
||||
|
||||
/**
|
||||
* Last.Fm account is special. It is both an attica resolver *and* a InfoPlugin. We always want the infoplugin,
|
||||
* 3.Last.Fm account is special. It is both an attica resolver *and* a InfoPlugin. We always want the infoplugin,
|
||||
* but the user can install the attica resolver on-demand. So we take care of both there.
|
||||
*
|
||||
*/
|
||||
class DLLEXPORT LastFmAccount : public CustomAtticaAccount
|
||||
class LastFmAccount : public CustomAtticaAccount
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@@ -84,11 +83,11 @@ public:
|
||||
virtual void saveConfig();
|
||||
|
||||
QString username() const;
|
||||
void setUsername( const QString&, bool immediate = false );
|
||||
void setUsername( const QString& );
|
||||
QString password() const;
|
||||
void setPassword( const QString&, bool immediate = false );
|
||||
void setPassword( const QString& );
|
||||
QString sessionKey() const;
|
||||
void setSessionKey( const QString&, bool immediate = false );
|
||||
void setSessionKey( const QString& );
|
||||
bool scrobble() const;
|
||||
void setScrobble( bool scrobble );
|
||||
|
||||
@@ -100,18 +99,12 @@ private slots:
|
||||
void resolverInstalled( const QString& resolverId );
|
||||
|
||||
void resolverChanged();
|
||||
|
||||
void onCredentialsLoaded( const QVariantHash& credentials );
|
||||
|
||||
private:
|
||||
void hookupResolver();
|
||||
|
||||
QWeakPointer<Tomahawk::ExternalResolverGui> m_resolver;
|
||||
QWeakPointer<Tomahawk::InfoSystem::LastFmInfoPlugin> m_infoPlugin;
|
||||
QWeakPointer<LastFmConfig> m_configWidget;
|
||||
|
||||
QVariantHash m_credentials;
|
||||
|
||||
QPixmap m_icon;
|
||||
};
|
||||
|
@@ -40,10 +40,14 @@ LastFmConfig::LastFmConfig( LastFmAccount* account )
|
||||
m_ui = new Ui_LastFmConfig;
|
||||
m_ui->setupUi( this );
|
||||
|
||||
connect( m_ui->testLogin, SIGNAL( clicked( bool ) ), this, SLOT( testLogin() ) );
|
||||
m_ui->progressBar->hide();
|
||||
|
||||
connect( m_ui->username, SIGNAL( textChanged( QString ) ), this, SLOT( enableButton() ) );
|
||||
connect( m_ui->password, SIGNAL( textChanged( QString ) ), this, SLOT( enableButton() ) );
|
||||
m_ui->username->setText( m_account->username() );
|
||||
m_ui->password->setText( m_account->password() );
|
||||
m_ui->enable->setChecked( m_account->scrobble() );
|
||||
|
||||
connect( m_ui->testLogin, SIGNAL( clicked( bool ) ), SLOT( testLogin() ) );
|
||||
connect( m_ui->importHistory, SIGNAL( clicked( bool ) ), SLOT( loadHistory() ) );
|
||||
|
||||
connect( m_ui->username, SIGNAL( textChanged( QString ) ), SLOT( enableButton() ) );
|
||||
connect( m_ui->password, SIGNAL( textChanged( QString ) ), SLOT( enableButton() ) );
|
||||
@@ -64,15 +68,6 @@ LastFmConfig::scrobble() const
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
LastFmConfig::loadFromConfig()
|
||||
{
|
||||
m_ui->username->setText( m_account->username() );
|
||||
m_ui->password->setText( m_account->password() );
|
||||
m_ui->enable->setChecked( m_account->scrobble() );
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
LastFmConfig::username() const
|
||||
{
|
||||
@@ -124,8 +119,6 @@ LastFmConfig::loadHistory()
|
||||
m_ui->importHistory->setEnabled( false );
|
||||
m_ui->progressBar->show();
|
||||
|
||||
emit sizeHintChanged();
|
||||
|
||||
QNetworkReply* reply = lastfm::User( m_ui->username->text().toLower() ).getRecentTracks( 200, m_page );
|
||||
connect( reply, SIGNAL( finished() ), SLOT( onHistoryLoaded() ) );
|
||||
}
|
||||
@@ -237,10 +230,3 @@ LastFmConfig::onLastFmFinished()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
LastFmConfig::showEvent(QShowEvent* event)
|
||||
{
|
||||
loadFromConfig();
|
||||
}
|
@@ -38,15 +38,10 @@ public:
|
||||
QString username() const;
|
||||
QString password() const;
|
||||
bool scrobble() const;
|
||||
|
||||
void loadFromConfig();
|
||||
|
||||
public slots:
|
||||
void testLogin();
|
||||
void onLastFmFinished();
|
||||
|
||||
protected:
|
||||
void showEvent( QShowEvent* event );
|
||||
|
||||
private slots:
|
||||
void enableButton();
|
||||
@@ -54,9 +49,6 @@ private slots:
|
||||
void loadHistory();
|
||||
void onHistoryLoaded();
|
||||
|
||||
signals:
|
||||
void sizeHintChanged();
|
||||
|
||||
private:
|
||||
LastFmAccount* m_account;
|
||||
Ui_LastFmConfig* m_ui;
|
@@ -212,11 +212,6 @@ LastFmInfoPlugin::scrobble()
|
||||
return;
|
||||
|
||||
tLog() << Q_FUNC_INFO << "Scrobbling now:" << m_track.toString();
|
||||
|
||||
// FIXME: workaround for the duration-less dilandau (and others) tracks
|
||||
if ( m_track.duration() == 0 )
|
||||
m_track.setDuration( 31 );
|
||||
|
||||
m_scrobbler->cache( m_track );
|
||||
m_scrobbler->submit();
|
||||
}
|
||||
@@ -853,7 +848,7 @@ LastFmInfoPlugin::settingsChanged()
|
||||
m_scrobbler = 0;
|
||||
}
|
||||
|
||||
m_account.data()->setSessionKey( QString(), true );
|
||||
m_account.data()->setSessionKey( QString() );
|
||||
createScrobbler();
|
||||
}
|
||||
}
|
||||
@@ -876,13 +871,13 @@ LastFmInfoPlugin::onAuthenticated()
|
||||
if ( lfm.children( "error" ).size() > 0 )
|
||||
{
|
||||
tLog() << "Error from authenticating with Last.fm service:" << lfm.text();
|
||||
m_account.data()->setSessionKey( QString(), true );
|
||||
m_account.data()->setSessionKey( QByteArray() );
|
||||
}
|
||||
else
|
||||
{
|
||||
lastfm::ws::SessionKey = lfm[ "session" ][ "key" ].text();
|
||||
|
||||
m_account.data()->setSessionKey( lastfm::ws::SessionKey, true );
|
||||
m_account.data()->setSessionKey( lastfm::ws::SessionKey.toLatin1() );
|
||||
|
||||
// qDebug() << "Got session key from last.fm";
|
||||
if ( m_account.data()->scrobble() )
|
@@ -22,7 +22,6 @@
|
||||
|
||||
#include "infosystem/InfoSystem.h"
|
||||
#include "infosystem/InfoSystemWorker.h"
|
||||
#include "DllMacro.h"
|
||||
|
||||
#include <lastfm/Track>
|
||||
#include <lastfm/Audioscrobbler>
|
||||
@@ -43,7 +42,7 @@ namespace Accounts
|
||||
namespace InfoSystem
|
||||
{
|
||||
|
||||
class DLLEXPORT LastFmInfoPlugin : public InfoPlugin
|
||||
class LastFmInfoPlugin : public InfoPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -52,6 +51,7 @@ public:
|
||||
virtual ~LastFmInfoPlugin();
|
||||
|
||||
public slots:
|
||||
void init();
|
||||
void settingsChanged();
|
||||
|
||||
void onAuthenticated();
|
||||
@@ -63,7 +63,6 @@ public slots:
|
||||
void similarTracksReturned();
|
||||
|
||||
protected slots:
|
||||
virtual void init();
|
||||
virtual void getInfo( Tomahawk::InfoSystem::InfoRequestData requestData );
|
||||
virtual void notInCacheSlot( Tomahawk::InfoSystem::InfoStringHash criteria, Tomahawk::InfoSystem::InfoRequestData requestData );
|
||||
|
@@ -88,20 +88,12 @@ SpotifyAccount::SpotifyAccount( const QString& accountId )
|
||||
SpotifyAccount::~SpotifyAccount()
|
||||
{
|
||||
clearUser();
|
||||
|
||||
if ( m_spotifyResolver.isNull() )
|
||||
return;
|
||||
|
||||
Pipeline::instance()->removeScriptResolver( m_spotifyResolver.data()->filePath() );
|
||||
delete m_spotifyResolver.data();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SpotifyAccount::init()
|
||||
{
|
||||
connect( this, SIGNAL( credentialsLoaded( QVariantHash ) ), this, SLOT( onCredentialsLoaded( QVariantHash ) ) );
|
||||
|
||||
setAccountFriendlyName( "Spotify" );
|
||||
setAccountServiceName( "spotify" );
|
||||
|
||||
@@ -167,7 +159,7 @@ SpotifyAccount::hookupResolver()
|
||||
}
|
||||
|
||||
qDebug() << "Starting spotify resolver with path:" << path;
|
||||
m_spotifyResolver = QWeakPointer< ScriptResolver >( qobject_cast< ScriptResolver* >( Pipeline::instance()->addScriptResolver( path ) ) );
|
||||
m_spotifyResolver = QWeakPointer< ScriptResolver >( qobject_cast< ScriptResolver* >( Pipeline::instance()->addScriptResolver( path, enabled() ) ) );
|
||||
|
||||
connect( m_spotifyResolver.data(), SIGNAL( changed() ), this, SLOT( resolverChanged() ) );
|
||||
connect( m_spotifyResolver.data(), SIGNAL( customMessage( QString,QVariantMap ) ), this, SLOT( resolverMessage( QString, QVariantMap ) ) );
|
||||
@@ -184,22 +176,6 @@ SpotifyAccount::hookupResolver()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SpotifyAccount::onCredentialsLoaded( const QVariantHash &credentials )
|
||||
{
|
||||
m_credentials = credentials;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SpotifyAccount::setCredentials(const QVariantHash &creds)
|
||||
{
|
||||
m_credentials = creds;
|
||||
|
||||
saveCredentials( creds );
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
SpotifyAccount::checkForResolver()
|
||||
{
|
||||
@@ -210,9 +186,6 @@ SpotifyAccount::checkForResolver()
|
||||
#elif defined(Q_OS_WIN)
|
||||
QDir appDataDir = TomahawkUtils::appDataDir();
|
||||
return appDataDir.exists( QString( "atticaresolvers/%1/spotify_tomahawkresolver.exe" ).arg( s_resolverId ) );
|
||||
#elif defined(Q_OS_LINUX)
|
||||
QDir appDataDir = TomahawkUtils::appDataDir();
|
||||
return appDataDir.exists( QString( "atticaresolvers/%1/spotify_tomahawkresolver" ).arg( s_resolverId ) );
|
||||
#endif
|
||||
|
||||
return false;
|
||||
@@ -337,7 +310,6 @@ SpotifyAccount::setManualResolverPath( const QString &resolverPath )
|
||||
if ( !m_spotifyResolver.isNull() )
|
||||
{
|
||||
// replace
|
||||
AccountManager::instance()->disableAccount( this );
|
||||
NewClosure( m_spotifyResolver.data(), SIGNAL( destroyed() ), this, SLOT( hookupAfterDeletion( bool ) ), true );
|
||||
m_spotifyResolver.data()->deleteLater();
|
||||
}
|
||||
@@ -366,16 +338,13 @@ SpotifyAccount::aboutToShow( QAction* action, const playlist_ptr& playlist )
|
||||
|
||||
// If it's not being synced, allow the option to sync
|
||||
bool found = false;
|
||||
bool manuallyDisabled = false;
|
||||
QList<PlaylistUpdaterInterface*> updaters = playlist->updaters();
|
||||
foreach ( PlaylistUpdaterInterface* updater, updaters )
|
||||
{
|
||||
if ( SpotifyPlaylistUpdater* spotifyUpdater = qobject_cast< SpotifyPlaylistUpdater* >( updater ) )
|
||||
{
|
||||
found = true;
|
||||
if ( !spotifyUpdater->sync() )
|
||||
manuallyDisabled = true;
|
||||
|
||||
if ( spotifyUpdater->sync() )
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -383,10 +352,6 @@ SpotifyAccount::aboutToShow( QAction* action, const playlist_ptr& playlist )
|
||||
{
|
||||
action->setText( tr( "Sync with Spotify" ) );
|
||||
}
|
||||
else if ( manuallyDisabled )
|
||||
{
|
||||
action->setText( tr( "Re-enable syncing with Spotify" ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
action->setText( tr( "Stop syncing with Spotify" ) );
|
||||
@@ -473,12 +438,14 @@ SpotifyAccount::resolverMessage( const QString &msgType, const QVariantMap &msg
|
||||
{
|
||||
if ( msgType == "credentials" )
|
||||
{
|
||||
m_credentials[ "username" ] = msg.value( "username" );
|
||||
m_credentials[ "password" ] = msg.value( "password" );
|
||||
m_credentials[ "highQuality" ] = msg.value( "highQuality" );
|
||||
saveCredentials( m_credentials );
|
||||
QVariantHash creds = credentials();
|
||||
|
||||
qDebug() << "Set creds:" << m_credentials.value( "username" ) << m_credentials.value( "password" ) << msg.value( "username" ) << msg.value( "password" );
|
||||
creds[ "username" ] = msg.value( "username" );
|
||||
creds[ "password" ] = msg.value( "password" );
|
||||
creds[ "highQuality" ] = msg.value( "highQuality" );
|
||||
setCredentials( creds );
|
||||
|
||||
qDebug() << "Set creds:" << creds.value( "username" ) << creds.value( "password" ) << msg.value( "username" ) << msg.value( "password" );
|
||||
|
||||
QVariantHash config = configuration();
|
||||
config[ "hasMigrated" ] = true;
|
||||
@@ -629,10 +596,12 @@ SpotifyAccount::resolverMessage( const QString &msgType, const QVariantMap &msg
|
||||
}
|
||||
else if ( msgType == "loginResponse" )
|
||||
{
|
||||
m_credentials[ "username" ] = msg.value( "username" ).toString();
|
||||
m_credentials[ "password" ] = msg.value( "password" ).toString();
|
||||
m_credentials[ "highQuality" ] = msg.value( "highQuality" ).toString();
|
||||
saveCredentials( m_credentials );
|
||||
QVariantHash creds = credentials();
|
||||
creds[ "username" ] = msg.value( "username" ).toString();
|
||||
creds[ "password" ] = msg.value( "password" ).toString();
|
||||
creds[ "highQuality" ] = msg.value( "highQuality" ).toString();
|
||||
setCredentials( creds );
|
||||
sync();
|
||||
|
||||
const bool success = msg.value( "success" ).toBool();
|
||||
|
||||
@@ -739,14 +708,15 @@ SpotifyAccount::saveConfig()
|
||||
if ( m_configWidget.isNull() )
|
||||
return;
|
||||
|
||||
if ( m_credentials.value( "username" ).toString() != m_configWidget.data()->username() ||
|
||||
m_credentials.value( "password" ).toString() != m_configWidget.data()->password() ||
|
||||
m_credentials.value( "highQuality" ).toBool() != m_configWidget.data()->highQuality() )
|
||||
QVariantHash creds = credentials();
|
||||
if ( creds.value( "username" ).toString() != m_configWidget.data()->username() ||
|
||||
creds.value( "password" ).toString() != m_configWidget.data()->password() ||
|
||||
creds.value( "highQuality" ).toBool() != m_configWidget.data()->highQuality() )
|
||||
{
|
||||
m_credentials[ "username" ] = m_configWidget.data()->username();
|
||||
m_credentials[ "password" ] = m_configWidget.data()->password();
|
||||
m_credentials[ "highQuality" ] = m_configWidget.data()->highQuality();
|
||||
saveCredentials( m_credentials );
|
||||
creds[ "username" ] = m_configWidget.data()->username();
|
||||
creds[ "password" ] = m_configWidget.data()->password();
|
||||
creds[ "highQuality" ] = m_configWidget.data()->highQuality();
|
||||
setCredentials( creds );
|
||||
|
||||
}
|
||||
|
||||
@@ -835,8 +805,7 @@ SpotifyAccount::startPlaylistSyncWithPlaylist( const QString& msgType, const QVa
|
||||
*/
|
||||
if ( m_updaters.contains( id ) )
|
||||
{
|
||||
//Q_ASSERT( m_updaters[ id ]->sync() == false ); /// Should have been unchecked/off before, but might not be if the user
|
||||
// changed spotify resolver meanwhile, so allow it for now
|
||||
Q_ASSERT( m_updaters[ id ]->sync() == false ); /// Should have been unchecked/off before
|
||||
m_updaters[ id ]->setSync( true );
|
||||
// m_updaters[ id ]->
|
||||
// TODO
|
@@ -26,7 +26,6 @@
|
||||
#include "Playlist.h"
|
||||
#include "utils/TomahawkUtils.h"
|
||||
#include "utils/SmartPointerList.h"
|
||||
#include "DllMacro.h"
|
||||
|
||||
class QAction;
|
||||
class SpotifyPlaylistUpdater;
|
||||
@@ -52,7 +51,7 @@ struct SpotifyPlaylistInfo {
|
||||
};
|
||||
|
||||
|
||||
class DLLEXPORT SpotifyAccountFactory : public AccountFactory
|
||||
class SpotifyAccountFactory : public AccountFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@@ -70,7 +69,7 @@ public:
|
||||
|
||||
};
|
||||
|
||||
class DLLEXPORT SpotifyAccount : public CustomAtticaAccount
|
||||
class SpotifyAccount : public CustomAtticaAccount
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@@ -102,17 +101,12 @@ public:
|
||||
|
||||
void setManualResolverPath( const QString& resolverPath );
|
||||
|
||||
QVariantHash credentials() const { return m_credentials; }
|
||||
void setCredentials( const QVariantHash& creds );
|
||||
|
||||
public slots:
|
||||
void aboutToShow( QAction* action, const Tomahawk::playlist_ptr& playlist );
|
||||
void syncActionTriggered( bool );
|
||||
void atticaLoaded(Attica::Content::List);
|
||||
|
||||
private slots:
|
||||
void onCredentialsLoaded( const QVariantHash& credentials );
|
||||
|
||||
void resolverChanged();
|
||||
void resolverInstalled( const QString& resolverId );
|
||||
|
||||
@@ -148,8 +142,6 @@ private:
|
||||
QWeakPointer<QWidget> m_aboutWidget;
|
||||
QWeakPointer<ScriptResolver> m_spotifyResolver;
|
||||
|
||||
QVariantHash m_credentials;
|
||||
|
||||
QMap<QString, QPair<QObject*, QString> > m_qidToSlotMap;
|
||||
|
||||
// List of synced spotify playlists in config UI
|
||||
@@ -167,6 +159,6 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
Q_DECLARE_METATYPE( Tomahawk::Accounts::SpotifyPlaylistInfo* )
|
||||
Q_DECLARE_METATYPE( Tomahawk::Accounts::SpotifyPlaylistInfo* );
|
||||
|
||||
#endif // SpotifyAccount_H
|
@@ -21,7 +21,6 @@
|
||||
|
||||
#include "playlist/PlaylistUpdaterInterface.h"
|
||||
#include "utils/Closure.h"
|
||||
#include "DllMacro.h"
|
||||
|
||||
#include <QQueue>
|
||||
#include <QVariant>
|
||||
@@ -32,7 +31,7 @@ namespace Accounts {
|
||||
}
|
||||
}
|
||||
|
||||
class DLLEXPORT SpotifyPlaylistUpdater : public Tomahawk::PlaylistUpdaterInterface
|
||||
class SpotifyPlaylistUpdater : public Tomahawk::PlaylistUpdaterInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -107,7 +106,7 @@ private:
|
||||
};
|
||||
|
||||
|
||||
class DLLEXPORT SpotifyUpdaterFactory : public Tomahawk::PlaylistUpdaterFactory
|
||||
class SpotifyUpdaterFactory : public Tomahawk::PlaylistUpdaterFactory
|
||||
{
|
||||
public:
|
||||
SpotifyUpdaterFactory() {}
|
@@ -53,8 +53,6 @@ TwitterAccount::TwitterAccount( const QString &accountId )
|
||||
setAccountServiceName( "Twitter" );
|
||||
setTypes( AccountTypes( StatusPushType | SipType ) );
|
||||
|
||||
connect( this, SIGNAL( credentialsLoaded( QVariantHash ) ), this, SLOT( onCredentialsLoaded( QVariantHash ) ) );
|
||||
|
||||
qDebug() << "Got cached peers:" << configuration() << configuration()[ "cachedpeers" ];
|
||||
|
||||
m_configWidget = QWeakPointer< TwitterConfigWidget >( new TwitterConfigWidget( this, 0 ) );
|
||||
@@ -75,41 +73,13 @@ TwitterAccount::configDialogAuthedSignalSlot( bool authed )
|
||||
{
|
||||
tDebug() << Q_FUNC_INFO;
|
||||
m_isAuthenticated = authed;
|
||||
if ( !m_credentials[ "username" ].toString().isEmpty() )
|
||||
setAccountFriendlyName( QString( "@%1" ).arg( m_credentials[ "username" ].toString() ) );
|
||||
if ( !credentials()[ "username" ].toString().isEmpty() )
|
||||
setAccountFriendlyName( QString( "@%1" ).arg( credentials()[ "username" ].toString() ) );
|
||||
syncConfig();
|
||||
emit configurationChanged();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TwitterAccount::onCredentialsLoaded( const QVariantHash &credentials )
|
||||
{
|
||||
// Credentials loaded
|
||||
bool reload = false;
|
||||
if ( !credentials[ "oauthtoken" ].toString().isEmpty() && !credentials[ "oauthtokensecret" ].toString().isEmpty() &&
|
||||
( m_credentials[ "oauthtoken" ] != credentials[ "oauthtoken"] || m_credentials[ "oauthtokensecret" ] != credentials[ "oauthtokensecret" ] ) )
|
||||
reload = true;
|
||||
|
||||
m_credentials = credentials;
|
||||
|
||||
if ( reload && enabled() )
|
||||
{
|
||||
qDebug() << "Twitter account got async load of credentials, authenticating now!";
|
||||
authenticate();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TwitterAccount::setCredentials( const QVariantHash &credentials )
|
||||
{
|
||||
m_credentials = credentials;
|
||||
|
||||
saveCredentials( credentials );
|
||||
}
|
||||
|
||||
|
||||
Account::ConnectionState
|
||||
TwitterAccount::connectionState() const
|
||||
{
|
||||
@@ -160,6 +130,7 @@ TwitterAccount::authenticateSlot()
|
||||
{
|
||||
infoPlugin().data()->moveToThread( Tomahawk::InfoSystem::InfoSystem::instance()->workerThread().data() );
|
||||
Tomahawk::InfoSystem::InfoSystem::instance()->addInfoPlugin( infoPlugin() );
|
||||
QMetaObject::invokeMethod( infoPlugin().data(), "init", Qt::QueuedConnection );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,9 +140,9 @@ TwitterAccount::authenticateSlot()
|
||||
return;
|
||||
}
|
||||
|
||||
tDebug() << Q_FUNC_INFO << "credentials: " << m_credentials.keys();
|
||||
tDebug() << Q_FUNC_INFO << "credentials: " << credentials().keys();
|
||||
|
||||
if ( m_credentials[ "oauthtoken" ].toString().isEmpty() || m_credentials[ "oauthtokensecret" ].toString().isEmpty() )
|
||||
if ( credentials()[ "oauthtoken" ].toString().isEmpty() || credentials()[ "oauthtokensecret" ].toString().isEmpty() )
|
||||
{
|
||||
tDebug() << Q_FUNC_INFO << "TwitterSipPlugin has empty Twitter credentials; not connecting";
|
||||
return;
|
||||
@@ -221,8 +192,8 @@ TwitterAccount::refreshTwitterAuth()
|
||||
if( m_twitterAuth.isNull() )
|
||||
return false;
|
||||
|
||||
m_twitterAuth.data()->setOAuthToken( m_credentials[ "oauthtoken" ].toString().toLatin1() );
|
||||
m_twitterAuth.data()->setOAuthTokenSecret( m_credentials[ "oauthtokensecret" ].toString().toLatin1() );
|
||||
m_twitterAuth.data()->setOAuthToken( credentials()[ "oauthtoken" ].toString().toLatin1() );
|
||||
m_twitterAuth.data()->setOAuthTokenSecret( credentials()[ "oauthtokensecret" ].toString().toLatin1() );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@@ -79,16 +79,11 @@ public:
|
||||
bool refreshTwitterAuth();
|
||||
TomahawkOAuthTwitter* twitterAuth() const { return m_twitterAuth.data(); }
|
||||
|
||||
QVariantHash credentials() const { return m_credentials; }
|
||||
void setCredentials( const QVariantHash& creds );
|
||||
|
||||
signals:
|
||||
void nowAuthenticated( const QWeakPointer< TomahawkOAuthTwitter >&, const QTweetUser &user );
|
||||
void nowDeauthenticated();
|
||||
|
||||
private slots:
|
||||
void onCredentialsLoaded( const QVariantHash& credentials );
|
||||
|
||||
void authenticateSlot();
|
||||
void configDialogAuthedSignalSlot( bool authed );
|
||||
void connectAuthVerifyReply( const QTweetUser &user );
|
||||
@@ -97,7 +92,6 @@ private:
|
||||
QIcon m_icon;
|
||||
bool m_isAuthenticated;
|
||||
bool m_isAuthenticating;
|
||||
QVariantHash m_credentials;
|
||||
QWeakPointer< TomahawkOAuthTwitter > m_twitterAuth;
|
||||
QWeakPointer< TwitterConfigWidget > m_configWidget;
|
||||
QWeakPointer< TwitterSipPlugin > m_twitterSipPlugin;
|
||||
|
@@ -58,17 +58,6 @@ TwitterConfigWidget::TwitterConfigWidget( TwitterAccount* account, QWidget *pare
|
||||
m_ui->twitterTweetComboBox->setCurrentIndex( 0 );
|
||||
m_ui->twitterTweetGotTomahawkButton->setText( tr( "Tweet!" ) );
|
||||
|
||||
}
|
||||
|
||||
TwitterConfigWidget::~TwitterConfigWidget()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TwitterConfigWidget::loadConfig()
|
||||
{
|
||||
QVariantHash credentials = m_account->credentials();
|
||||
|
||||
if ( credentials[ "oauthtoken" ].toString().isEmpty() ||
|
||||
@@ -90,8 +79,13 @@ TwitterConfigWidget::loadConfig()
|
||||
|
||||
emit twitterAuthed( true );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
TwitterConfigWidget::~TwitterConfigWidget()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
void
|
||||
TwitterConfigWidget::authDeauthTwitter()
|
||||
@@ -165,7 +159,11 @@ void
|
||||
TwitterConfigWidget::deauthenticateTwitter()
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
m_account->setCredentials( QVariantHash() );
|
||||
QVariantHash credentials = m_account->credentials();
|
||||
credentials[ "oauthtoken" ] = QString();
|
||||
credentials[ "oauthtokensecret" ] = QString();
|
||||
credentials[ "username" ] = QString();
|
||||
m_account->setCredentials( credentials );
|
||||
|
||||
m_ui->twitterStatusLabel->setText(tr("Status: No saved credentials"));
|
||||
m_ui->twitterAuthenticateButton->setText( tr( "Authenticate" ) );
|
||||
@@ -234,7 +232,7 @@ TwitterConfigWidget::postGotTomahawkStatusAuthVerifyReply( const QTweetUser &use
|
||||
return;
|
||||
}
|
||||
TomahawkOAuthTwitter *twitAuth = new TomahawkOAuthTwitter( TomahawkUtils::nam(), this );
|
||||
const QVariantHash credentials = m_account->credentials();
|
||||
QVariantHash credentials = m_account->credentials();
|
||||
twitAuth->setOAuthToken( credentials[ "oauthtoken" ].toString().toLatin1() );
|
||||
twitAuth->setOAuthTokenSecret( credentials[ "oauthtokensecret" ].toString().toLatin1() );
|
||||
if ( m_postGTtype != "Direct Message" )
|
||||
@@ -293,14 +291,6 @@ TwitterConfigWidget::postGotTomahawkStatusUpdateError( QTweetNetBase::ErrorCode
|
||||
QMessageBox::critical( this, tr("Tweetin' Error"), tr("There was an error posting your status -- sorry!") );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TwitterConfigWidget::showEvent(QShowEvent* event)
|
||||
{
|
||||
loadConfig();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@@ -50,17 +50,11 @@ class ACCOUNTDLLEXPORT TwitterConfigWidget : public QWidget
|
||||
public:
|
||||
explicit TwitterConfigWidget( TwitterAccount* account = 0, QWidget *parent = 0 );
|
||||
virtual ~TwitterConfigWidget();
|
||||
|
||||
void loadConfig();
|
||||
|
||||
signals:
|
||||
void twitterAuthed( bool authed );
|
||||
|
||||
void sizeHintChanged();
|
||||
|
||||
protected:
|
||||
void showEvent( QShowEvent* event );
|
||||
|
||||
|
||||
private slots:
|
||||
void authDeauthTwitter();
|
||||
|
@@ -44,6 +44,7 @@ namespace Tomahawk {
|
||||
virtual ~TwitterInfoPlugin();
|
||||
|
||||
public slots:
|
||||
void init();
|
||||
void notInCacheSlot( const Tomahawk::InfoSystem::InfoStringHash criteria, Tomahawk::InfoSystem::InfoRequestData requestData )
|
||||
{
|
||||
Q_UNUSED( criteria );
|
||||
@@ -51,7 +52,6 @@ namespace Tomahawk {
|
||||
}
|
||||
|
||||
protected slots:
|
||||
void init();
|
||||
void pushInfo( Tomahawk::InfoSystem::InfoPushData pushData );
|
||||
void getInfo( Tomahawk::InfoSystem::InfoRequestData requestData )
|
||||
{
|
||||
|
@@ -137,8 +137,8 @@ TwitterSipPlugin::disconnectPlugin()
|
||||
m_checkTimer.stop();
|
||||
m_connectTimer.stop();
|
||||
m_dmPollTimer.stop();
|
||||
if( !m_friendsTimeline.isNull() )
|
||||
delete m_friendsTimeline.data();
|
||||
if( !m_homeTimeline.isNull() )
|
||||
delete m_homeTimeline.data();
|
||||
if( !m_mentions.isNull() )
|
||||
delete m_mentions.data();
|
||||
if( !m_directMessages.isNull() )
|
||||
@@ -167,12 +167,12 @@ TwitterSipPlugin::accountAuthenticated( const QWeakPointer< TomahawkOAuthTwitter
|
||||
|
||||
m_cachedTwitterAuth = twitterAuth;
|
||||
|
||||
m_friendsTimeline = QWeakPointer<QTweetFriendsTimeline>( new QTweetFriendsTimeline( m_cachedTwitterAuth.data(), this ) );
|
||||
m_homeTimeline = QWeakPointer<QTweetHomeTimeline>( new QTweetHomeTimeline( m_cachedTwitterAuth.data(), this ) );
|
||||
m_mentions = QWeakPointer<QTweetMentions>( new QTweetMentions( m_cachedTwitterAuth.data(), this ) );
|
||||
m_directMessages = QWeakPointer<QTweetDirectMessages>( new QTweetDirectMessages( m_cachedTwitterAuth.data(), this ) );
|
||||
m_directMessageNew = QWeakPointer<QTweetDirectMessageNew>( new QTweetDirectMessageNew( m_cachedTwitterAuth.data(), this ) );
|
||||
m_directMessageDestroy = QWeakPointer<QTweetDirectMessageDestroy>( new QTweetDirectMessageDestroy( m_cachedTwitterAuth.data(), this ) );
|
||||
connect( m_friendsTimeline.data(), SIGNAL( parsedStatuses(const QList< QTweetStatus > &) ), SLOT( friendsTimelineStatuses(const QList<QTweetStatus> &) ) );
|
||||
connect( m_homeTimeline.data(), SIGNAL( parsedStatuses(const QList< QTweetStatus > &) ), SLOT( friendsTimelineStatuses(const QList<QTweetStatus> &) ) );
|
||||
connect( m_mentions.data(), SIGNAL( parsedStatuses(const QList< QTweetStatus > &) ), SLOT( mentionsStatuses(const QList<QTweetStatus> &) ) );
|
||||
connect( m_directMessages.data(), SIGNAL( parsedDirectMessages(const QList<QTweetDMStatus> &)), SLOT( directMessages(const QList<QTweetDMStatus> &) ) );
|
||||
connect( m_directMessageNew.data(), SIGNAL( parsedDirectMessage(const QTweetDMStatus &)), SLOT( directMessagePosted(const QTweetDMStatus &) ) );
|
||||
@@ -203,8 +203,8 @@ TwitterSipPlugin::checkTimerFired()
|
||||
|
||||
qDebug() << "TwitterSipPlugin looking at friends timeline since id " << m_cachedFriendsSinceId;
|
||||
|
||||
if ( !m_friendsTimeline.isNull() )
|
||||
m_friendsTimeline.data()->fetch( m_cachedFriendsSinceId, 0, 800 );
|
||||
if ( !m_homeTimeline.isNull() )
|
||||
m_homeTimeline.data()->fetch( m_cachedFriendsSinceId, 0, 800 );
|
||||
|
||||
if ( m_cachedMentionsSinceId == 0 )
|
||||
m_cachedMentionsSinceId = m_configuration[ "cachedmentionssinceid" ].toLongLong();
|
||||
|
@@ -27,10 +27,10 @@
|
||||
|
||||
#include <QTweetLib/qtweetuser.h>
|
||||
#include <QTweetLib/qtweetnetbase.h>
|
||||
#include <QTweetLib/qtweetfriendstimeline.h>
|
||||
#include <QTweetLib/qtweetdirectmessages.h>
|
||||
#include <QTweetLib/qtweetdirectmessagenew.h>
|
||||
#include <QTweetLib/qtweetdirectmessagedestroy.h>
|
||||
#include <QTweetLib/qtweethometimeline.h>
|
||||
#include <QTweetLib/qtweetmentions.h>
|
||||
#include <QTweetLib/qtweetdmstatus.h>
|
||||
|
||||
@@ -104,7 +104,7 @@ private:
|
||||
|
||||
QWeakPointer< TomahawkOAuthTwitter > m_cachedTwitterAuth;
|
||||
|
||||
QWeakPointer< QTweetFriendsTimeline > m_friendsTimeline;
|
||||
QWeakPointer< QTweetHomeTimeline > m_homeTimeline;
|
||||
QWeakPointer< QTweetMentions > m_mentions;
|
||||
QWeakPointer< QTweetDirectMessages > m_directMessages;
|
||||
QWeakPointer< QTweetDirectMessageNew > m_directMessageNew;
|
||||
|
@@ -40,10 +40,7 @@ XmppAccountFactory::createAccount( const QString& accountId )
|
||||
|
||||
XmppAccount::XmppAccount( const QString &accountId )
|
||||
: Account( accountId )
|
||||
, m_credentialsLoading( true )
|
||||
{
|
||||
connect( this, SIGNAL( credentialsLoaded( QVariantHash ) ), this, SLOT( onCredentialsLoaded( QVariantHash ) ) );
|
||||
|
||||
setAccountServiceName( "Jabber (XMPP)" );
|
||||
setTypes( SipType );
|
||||
|
||||
@@ -60,7 +57,7 @@ XmppAccount::~XmppAccount()
|
||||
void
|
||||
XmppAccount::authenticate()
|
||||
{
|
||||
if ( connectionState() != Account::Connected && !m_credentialsLoading )
|
||||
if ( connectionState() != Account::Connected )
|
||||
sipPlugin()->connectPlugin();
|
||||
}
|
||||
|
||||
@@ -93,25 +90,6 @@ XmppAccount::saveConfig()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
XmppAccount::onCredentialsLoaded( const QVariantHash& credentials )
|
||||
{
|
||||
m_credentials = credentials;
|
||||
m_credentialsLoading = false;
|
||||
if ( !m_xmppSipPlugin.isNull() )
|
||||
m_xmppSipPlugin.data()->configurationChanged();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
XmppAccount::setCredentials( const QVariantHash &credentials )
|
||||
{
|
||||
m_credentials = credentials;
|
||||
|
||||
saveCredentials( credentials );
|
||||
}
|
||||
|
||||
|
||||
InfoSystem::InfoPluginPtr
|
||||
XmppAccount::infoPlugin()
|
||||
{
|
||||
|
@@ -77,21 +77,12 @@ public:
|
||||
QWidget* aclWidget() { return 0; }
|
||||
void saveConfig();
|
||||
|
||||
QVariantHash credentials() const { return m_credentials; }
|
||||
void setCredentials( const QVariantHash& credentials );
|
||||
|
||||
virtual Tomahawk::Accounts::Account::ConnectionState connectionState() const;
|
||||
|
||||
private slots:
|
||||
void onCredentialsLoaded( const QVariantHash& credentials );
|
||||
|
||||
protected:
|
||||
QWeakPointer< QWidget > m_configWidget; // so the google wrapper can change the config dialog a bit
|
||||
QWeakPointer< XmppSipPlugin > m_xmppSipPlugin;
|
||||
QWeakPointer< Tomahawk::InfoSystem::XmppInfoPlugin > m_xmppInfoPlugin;
|
||||
|
||||
QVariantHash m_credentials;
|
||||
bool m_credentialsLoading;
|
||||
};
|
||||
|
||||
};
|
||||
|
@@ -38,9 +38,14 @@ XmppConfigWidget::XmppConfigWidget( XmppAccount* account, QWidget *parent ) :
|
||||
m_account( account )
|
||||
{
|
||||
m_ui->setupUi( this );
|
||||
|
||||
m_ui->xmppUsername->setText( account->credentials().contains( "username" ) ? account->credentials()[ "username" ].toString() : QString() );
|
||||
m_ui->xmppPassword->setText( account->credentials().contains( "password" ) ? account->credentials()[ "password" ].toString() : QString() );
|
||||
m_ui->xmppServer->setText( account->configuration().contains( "server" ) ? account->configuration()[ "server" ].toString() : QString() );
|
||||
m_ui->xmppPort->setValue( account->configuration().contains( "port" ) ? account->configuration()[ "port" ].toInt() : 5222 );
|
||||
m_ui->xmppPublishTracksCheckbox->setChecked( account->configuration().contains( "publishtracks" ) ? account->configuration()[ "publishtracks" ].toBool() : true);
|
||||
m_ui->xmppEnforceSecureCheckbox->setChecked( account->configuration().contains( "enforcesecure" ) ? account->configuration()[ "enforcesecure" ].toBool() : false);
|
||||
m_ui->jidExistsLabel->hide();
|
||||
|
||||
loadFromConfig();
|
||||
|
||||
connect( m_ui->xmppUsername, SIGNAL( textChanged( QString ) ), SLOT( onCheckJidExists( QString ) ) );
|
||||
}
|
||||
@@ -65,52 +70,27 @@ XmppConfigWidget::saveConfig()
|
||||
configuration[ "enforcesecure"] = m_ui->xmppEnforceSecureCheckbox->isChecked();
|
||||
|
||||
m_account->setAccountFriendlyName( m_ui->xmppUsername->text() );
|
||||
m_account->setCredentials( credentials );
|
||||
m_account->setConfiguration( configuration);
|
||||
m_account->sync();
|
||||
|
||||
m_account->setCredentials( credentials );
|
||||
|
||||
static_cast< XmppSipPlugin* >( m_account->sipPlugin() )->checkSettings();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
XmppConfigWidget::showEvent(QShowEvent* event)
|
||||
{
|
||||
loadFromConfig();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
XmppConfigWidget::loadFromConfig()
|
||||
{
|
||||
m_ui->xmppUsername->setText( m_account->credentials().contains( "username" ) ? m_account->credentials()[ "username" ].toString() : QString() );
|
||||
m_ui->xmppPassword->setText( m_account->credentials().contains( "password" ) ? m_account->credentials()[ "password" ].toString() : QString() );
|
||||
m_ui->xmppServer->setText( m_account->configuration().contains( "server" ) ? m_account->configuration()[ "server" ].toString() : QString() );
|
||||
m_ui->xmppPort->setValue( m_account->configuration().contains( "port" ) ? m_account->configuration()[ "port" ].toInt() : 5222 );
|
||||
m_ui->xmppPublishTracksCheckbox->setChecked( m_account->configuration().contains( "publishtracks" ) ? m_account->configuration()[ "publishtracks" ].toBool() : true);
|
||||
m_ui->xmppEnforceSecureCheckbox->setChecked( m_account->configuration().contains( "enforcesecure" ) ? m_account->configuration()[ "enforcesecure" ].toBool() : false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
XmppConfigWidget::onCheckJidExists( QString jid )
|
||||
{
|
||||
const QList< Tomahawk::Accounts::Account* > accounts = Tomahawk::Accounts::AccountManager::instance()->accounts( Tomahawk::Accounts::SipType );
|
||||
QList< Tomahawk::Accounts::Account* > accounts = Tomahawk::Accounts::AccountManager::instance()->accounts( Tomahawk::Accounts::SipType );
|
||||
foreach( Tomahawk::Accounts::Account* account, accounts )
|
||||
{
|
||||
if ( account->accountId() == m_account->accountId() )
|
||||
continue;
|
||||
XmppAccount* xmppAccount = qobject_cast< XmppAccount* >( account );
|
||||
if ( !xmppAccount )
|
||||
continue;
|
||||
|
||||
// Check if any other xmpp account already uses the given name/settings
|
||||
QString savedUsername = xmppAccount->credentials()[ "username" ].toString();
|
||||
QStringList savedSplitUsername = xmppAccount->credentials()[ "username" ].toString().split("@");
|
||||
QString savedServer = xmppAccount->configuration()[ "server" ].toString();
|
||||
int savedPort = xmppAccount->configuration()[ "port" ].toInt();
|
||||
QString savedUsername = account->credentials()[ "username" ].toString();
|
||||
QStringList savedSplitUsername = account->credentials()[ "username" ].toString().split("@");
|
||||
QString savedServer = account->configuration()[ "server" ].toString();
|
||||
int savedPort = account->configuration()[ "port" ].toInt();
|
||||
|
||||
if ( ( savedUsername == jid || savedSplitUsername.contains( jid ) ) &&
|
||||
savedServer == m_ui->xmppServer->text() &&
|
||||
|
@@ -48,15 +48,10 @@ public:
|
||||
virtual ~XmppConfigWidget();
|
||||
|
||||
void saveConfig();
|
||||
|
||||
void loadFromConfig();
|
||||
|
||||
signals:
|
||||
void dataError( bool exists );
|
||||
|
||||
protected:
|
||||
void showEvent( QShowEvent* event );
|
||||
|
||||
private slots:
|
||||
void onCheckJidExists( QString jid );
|
||||
|
||||
|
@@ -42,10 +42,10 @@ namespace Tomahawk {
|
||||
void publishTune( QUrl url, Tomahawk::InfoSystem::InfoStringHash trackInfo );
|
||||
|
||||
public slots:
|
||||
void init();
|
||||
void notInCacheSlot( const Tomahawk::InfoSystem::InfoStringHash criteria, Tomahawk::InfoSystem::InfoRequestData requestData );
|
||||
|
||||
protected slots:
|
||||
void init();
|
||||
void pushInfo( Tomahawk::InfoSystem::InfoPushData pushData );
|
||||
void getInfo( Tomahawk::InfoSystem::InfoRequestData requestData );
|
||||
|
||||
|
@@ -43,7 +43,7 @@ GoogleWrapperFactory::icon() const
|
||||
return QPixmap( ":/gmail-logo.png" );
|
||||
}
|
||||
|
||||
GoogleWrapperSip::GoogleWrapperSip( GoogleWrapper *account )
|
||||
GoogleWrapperSip::GoogleWrapperSip( Account* account )
|
||||
: XmppSipPlugin( account )
|
||||
{
|
||||
|
||||
|
@@ -44,13 +44,11 @@ public:
|
||||
virtual Account* createAccount( const QString& pluginId );
|
||||
};
|
||||
|
||||
class GoogleWrapper;
|
||||
|
||||
class ACCOUNTDLLEXPORT GoogleWrapperSip : public XmppSipPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
GoogleWrapperSip( Tomahawk::Accounts::GoogleWrapper* account );
|
||||
GoogleWrapperSip( Tomahawk::Accounts::Account* account );
|
||||
virtual ~GoogleWrapperSip();
|
||||
|
||||
public slots:
|
||||
|
@@ -33,51 +33,47 @@
|
||||
#include "utils/Logger.h"
|
||||
|
||||
|
||||
AvatarManager::AvatarManager( Jreen::Client* client )
|
||||
: m_cacheDir( TomahawkUtils::appDataDir().absolutePath().append( "/jreen/" ) )
|
||||
AvatarManager::AvatarManager(Jreen::Client *client) :
|
||||
m_cacheDir(TomahawkUtils::appDataDir().absolutePath().append("/jreen/"))
|
||||
{
|
||||
m_client = client;
|
||||
|
||||
m_cachedAvatars = m_cacheDir.entryList();
|
||||
|
||||
connect( m_client, SIGNAL( serverFeaturesReceived( QSet<QString> ) ), SLOT( onNewConnection() ) );
|
||||
connect( m_client, SIGNAL( presenceReceived( Jreen::Presence ) ), SLOT( onNewPresence( Jreen::Presence ) ) );
|
||||
connect( m_client, SIGNAL( iqReceived( Jreen::IQ ) ), SLOT( onNewIq( Jreen::IQ ) ) );
|
||||
connect(m_client, SIGNAL(serverFeaturesReceived(QSet<QString>)), SLOT(onNewConnection()));
|
||||
connect(m_client, SIGNAL(presenceReceived(Jreen::Presence)), SLOT(onNewPresence(Jreen::Presence)));
|
||||
connect(m_client, SIGNAL(iqReceived(Jreen::IQ)), SLOT(onNewIq(Jreen::IQ)));
|
||||
|
||||
connect( this, SIGNAL( newAvatar( QString ) ), SLOT( onNewAvatar( QString ) ) );
|
||||
connect(this, SIGNAL(newAvatar(QString)), SLOT(onNewAvatar(QString)));
|
||||
}
|
||||
|
||||
|
||||
AvatarManager::~AvatarManager()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
AvatarManager::onNewConnection()
|
||||
void AvatarManager::onNewConnection()
|
||||
{
|
||||
fetchVCard( m_client->jid().bare() );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
AvatarManager::fetchVCard( const QString& jid )
|
||||
void AvatarManager::fetchVCard(const QString &jid)
|
||||
{
|
||||
Jreen::IQ iq( Jreen::IQ::Get, jid );
|
||||
iq.addExtension( new Jreen::VCard() );
|
||||
Jreen::IQReply *reply = m_client->send( iq );
|
||||
// qDebug() << Q_FUNC_INFO;
|
||||
|
||||
connect( reply, SIGNAL( received( Jreen::IQ ) ), SLOT( onNewIq( Jreen::IQ ) ) );
|
||||
Jreen::IQ iq(Jreen::IQ::Get, jid );
|
||||
iq.addExtension(new Jreen::VCard());
|
||||
Jreen::IQReply *reply = m_client->send(iq);
|
||||
connect(reply, SIGNAL(received(Jreen::IQ)), SLOT(onNewIq(Jreen::IQ)));
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
AvatarManager::onNewPresence( const Jreen::Presence& presence )
|
||||
void AvatarManager::onNewPresence(const Jreen::Presence& presence)
|
||||
{
|
||||
Jreen::VCardUpdate::Ptr update = presence.payload<Jreen::VCardUpdate>();
|
||||
if ( update )
|
||||
if(update)
|
||||
{
|
||||
// qDebug() << "vcard: found update for" << presence.from().full();
|
||||
if ( !isCached( update->photoHash() ) )
|
||||
if(!isCached(update->photoHash()))
|
||||
{
|
||||
// qDebug() << presence.from().full() << "vcard: photo not cached, starting request..." << update->photoHash();
|
||||
fetchVCard( presence.from().bare() );
|
||||
@@ -88,72 +84,78 @@ AvatarManager::onNewPresence( const Jreen::Presence& presence )
|
||||
m_JidsAvatarHashes.insert( update->photoHash(), presence.from().bare() );
|
||||
|
||||
if ( !this->avatar( presence.from().bare() ).isNull() )
|
||||
emit newAvatar( presence.from().bare() );
|
||||
emit newAvatar(presence.from().bare());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// qDebug() << Q_FUNC_INFO << presence.from().full() << "got no statusupdateextension";
|
||||
|
||||
//TODO: do we want this? might fetch avatars for broken clients
|
||||
fetchVCard( presence.from().bare() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
AvatarManager::onNewIq( const Jreen::IQ& iq )
|
||||
void AvatarManager::onNewIq(const Jreen::IQ& iq)
|
||||
{
|
||||
Jreen::VCard::Ptr vcard = iq.payload<Jreen::VCard>();
|
||||
if ( vcard )
|
||||
if(vcard)
|
||||
{
|
||||
iq.accept();
|
||||
|
||||
// qDebug() << Q_FUNC_INFO << "Got vcard from " << iq.from().full();
|
||||
|
||||
QString id = iq.from().full();
|
||||
QString avatarHash;
|
||||
|
||||
const Jreen::VCard::Photo &photo = vcard->photo();
|
||||
if ( !photo.data().isEmpty() )
|
||||
{
|
||||
if (!photo.data().isEmpty()) {
|
||||
// qDebug() << "vcard: got photo data" << id;
|
||||
|
||||
avatarHash = QCryptographicHash::hash( photo.data(), QCryptographicHash::Sha1 ).toHex();
|
||||
avatarHash = QCryptographicHash::hash(photo.data(), QCryptographicHash::Sha1).toHex();
|
||||
|
||||
if ( !m_cacheDir.exists() )
|
||||
if (!m_cacheDir.exists())
|
||||
m_cacheDir.mkpath( avatarDir( avatarHash ).absolutePath() );
|
||||
|
||||
QFile file( avatarPath( avatarHash ) );
|
||||
if ( file.open( QIODevice::WriteOnly ) )
|
||||
{
|
||||
file.write( photo.data() );
|
||||
|
||||
QFile file(avatarPath(avatarHash));
|
||||
if (file.open(QIODevice::WriteOnly)) {
|
||||
file.write(photo.data());
|
||||
file.close();
|
||||
}
|
||||
|
||||
m_cachedAvatars.append( avatarHash );
|
||||
m_cachedAvatars.append(avatarHash);
|
||||
m_JidsAvatarHashes.insert( avatarHash, iq.from().bare() );
|
||||
|
||||
Q_ASSERT( !this->avatar( iq.from().bare() ).isNull() );
|
||||
emit newAvatar( iq.from().bare() );
|
||||
Q_ASSERT(!this->avatar(iq.from().bare()).isNull());
|
||||
emit newAvatar(iq.from().bare());
|
||||
}
|
||||
else
|
||||
{
|
||||
// qDebug() << "vcard: got no photo data" << id;
|
||||
}
|
||||
|
||||
// got own presence
|
||||
if ( m_client->jid().bare() == id )
|
||||
{
|
||||
// qDebug() << Q_FUNC_INFO << "got own vcard";
|
||||
|
||||
Jreen::Presence presence = m_client->presence();
|
||||
Jreen::VCardUpdate::Ptr update = presence.payload<Jreen::VCardUpdate>();
|
||||
if ( update->photoHash() != avatarHash )
|
||||
if (update->photoHash() != avatarHash)
|
||||
{
|
||||
update->setPhotoHash( avatarHash );
|
||||
m_client->send( presence );
|
||||
qDebug() << Q_FUNC_INFO << "Updating own presence...";
|
||||
|
||||
update->setPhotoHash(avatarHash);
|
||||
m_client->send(presence);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
QPixmap
|
||||
AvatarManager::avatar( const QString& jid ) const
|
||||
QPixmap AvatarManager::avatar(const QString &jid) const
|
||||
{
|
||||
if ( isCached( avatarHash( jid ) ) )
|
||||
if( isCached( avatarHash( jid ) ) )
|
||||
{
|
||||
return QPixmap( avatarPath( avatarHash( jid ) ) );
|
||||
}
|
||||
@@ -163,39 +165,29 @@ AvatarManager::avatar( const QString& jid ) const
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
AvatarManager::avatarHash( const QString& jid ) const
|
||||
QString AvatarManager::avatarHash(const QString &jid) const
|
||||
{
|
||||
//qDebug() << Q_FUNC_INFO << jid << m_JidsAvatarHashes.key( jid );
|
||||
return m_JidsAvatarHashes.key( jid );
|
||||
//qDebug() << Q_FUNC_INFO << jid << m_JidsAvatarHashes.key(jid);
|
||||
return m_JidsAvatarHashes.key(jid);
|
||||
}
|
||||
|
||||
|
||||
QDir
|
||||
AvatarManager::avatarDir( const QString& /* avatarHash */ ) const
|
||||
QDir AvatarManager::avatarDir(const QString&) const
|
||||
{
|
||||
return m_cacheDir;
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
AvatarManager::avatarPath( const QString& avatarHash ) const
|
||||
QString AvatarManager::avatarPath(const QString &avatarHash) const
|
||||
{
|
||||
Q_ASSERT( !avatarHash.contains( "@" ) );
|
||||
return avatarDir( avatarHash ).absoluteFilePath( avatarHash );
|
||||
Q_ASSERT(!avatarHash.contains("@"));
|
||||
return avatarDir(avatarHash).absoluteFilePath(avatarHash);
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
AvatarManager::isCached( const QString& avatarHash ) const
|
||||
bool AvatarManager::isCached(const QString &avatarHash) const
|
||||
{
|
||||
return m_cachedAvatars.contains( avatarHash );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
AvatarManager::onNewAvatar( const QString& /* jid */ )
|
||||
void AvatarManager::onNewAvatar(const QString&)
|
||||
{
|
||||
// qDebug() << Q_FUNC_INFO << "Found new Avatar..." << jid;
|
||||
}
|
||||
|
@@ -32,32 +32,32 @@ class ACCOUNTDLLEXPORT AvatarManager : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
AvatarManager(Jreen::Client* client);
|
||||
AvatarManager(Jreen::Client *client);
|
||||
virtual ~AvatarManager();
|
||||
|
||||
QPixmap avatar(const QString& jid) const;
|
||||
QPixmap avatar(const QString &jid) const;
|
||||
|
||||
signals:
|
||||
void newAvatar( const QString& jid );
|
||||
void newAvatar( const QString &jid );
|
||||
|
||||
private slots:
|
||||
void onNewPresence( const Jreen::Presence& presence );
|
||||
void onNewIq(const Jreen::IQ& iq);
|
||||
void onNewIq(const Jreen::IQ &iq);
|
||||
void onNewConnection();
|
||||
void onNewAvatar( const QString& jid );
|
||||
void onNewAvatar( const QString &jid );
|
||||
|
||||
private:
|
||||
void fetchVCard( const QString& jid );
|
||||
QString avatarHash( const QString& jid ) const;
|
||||
QString avatarPath( const QString& avatarHash ) const;
|
||||
void fetchVCard( const QString &jid);
|
||||
QString avatarHash(const QString &jid) const;
|
||||
QString avatarPath(const QString &avatarHash) const;
|
||||
|
||||
QDir avatarDir( const QString& avatarHash ) const;
|
||||
bool isCached( const QString& avatarHash ) const;
|
||||
QDir avatarDir(const QString &avatarHash) const;
|
||||
bool isCached(const QString &avatarHash) const;
|
||||
|
||||
Jreen::Client* m_client;
|
||||
Jreen::Client *m_client;
|
||||
QStringList m_cachedAvatars;
|
||||
QDir m_cacheDir;
|
||||
QMap< QString, QString > m_JidsAvatarHashes;
|
||||
QMap<QString, QString> m_JidsAvatarHashes;
|
||||
};
|
||||
|
||||
#endif // AVATARMANAGER_H
|
||||
|
@@ -50,8 +50,6 @@
|
||||
#include <accounts/AccountManager.h>
|
||||
#include <TomahawkSettings.h>
|
||||
|
||||
#include "../XmppAccount.h"
|
||||
|
||||
#ifndef ENABLE_HEADLESS
|
||||
#include <QtGui/QInputDialog>
|
||||
#include <QtGui/QLineEdit>
|
||||
@@ -67,34 +65,28 @@ using namespace Accounts;
|
||||
// instead of simply copying this function for another thirdparty lib
|
||||
// please make it a meta-function or a macro and put it in Logger.h. kthxbbq
|
||||
#define JREEN_LOG_INFIX "Jreen"
|
||||
#define TOMAHAWK_FEATURE QLatin1String( "tomahawk:sip:v1" )
|
||||
#define TOMAHAWK_CAP_NODE_NAME QLatin1String( "http://tomahawk-player.org/" )
|
||||
|
||||
|
||||
void
|
||||
JreenMessageHandler( QtMsgType type, const char *msg )
|
||||
JreenMessageHandler(QtMsgType type, const char *msg)
|
||||
{
|
||||
switch ( type )
|
||||
switch (type)
|
||||
{
|
||||
case QtDebugMsg:
|
||||
tDebug( LOGTHIRDPARTY ).nospace() << JREEN_LOG_INFIX << ": " << "Debug: " << msg;
|
||||
tDebug(LOGTHIRDPARTY).nospace() << JREEN_LOG_INFIX << ": " << "Debug: " << msg;
|
||||
break;
|
||||
case QtWarningMsg:
|
||||
tDebug( LOGTHIRDPARTY ).nospace() << JREEN_LOG_INFIX << ": " << "Warning: " << msg;
|
||||
tDebug(LOGTHIRDPARTY).nospace() << JREEN_LOG_INFIX << ": " << "Warning: " << msg;
|
||||
break;
|
||||
case QtCriticalMsg:
|
||||
tDebug( LOGTHIRDPARTY ).nospace() << JREEN_LOG_INFIX << ": " << "Critical: " << msg;
|
||||
tDebug(LOGTHIRDPARTY).nospace() << JREEN_LOG_INFIX << ": " << "Critical: " << msg;
|
||||
break;
|
||||
case QtFatalMsg:
|
||||
tDebug( LOGTHIRDPARTY ).nospace() << JREEN_LOG_INFIX << ": " << "Fatal: " << msg;
|
||||
tDebug(LOGTHIRDPARTY).nospace() << JREEN_LOG_INFIX << ": " << "Fatal: " << msg;
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
XmppSipPlugin::XmppSipPlugin( XmppAccount *account )
|
||||
XmppSipPlugin::XmppSipPlugin( Account *account )
|
||||
: SipPlugin( account )
|
||||
, m_xmppAccount( account )
|
||||
, m_state( Account::Disconnected )
|
||||
#ifndef ENABLE_HEADLESS
|
||||
, m_menu( 0 )
|
||||
@@ -105,6 +97,7 @@ XmppSipPlugin::XmppSipPlugin( XmppAccount *account )
|
||||
Jreen::Logger::addHandler( JreenMessageHandler );
|
||||
|
||||
m_currentUsername = readUsername();
|
||||
|
||||
m_currentServer = readServer();
|
||||
m_currentPassword = readPassword();
|
||||
m_currentPort = readPort();
|
||||
@@ -129,7 +122,6 @@ XmppSipPlugin::XmppSipPlugin( XmppAccount *account )
|
||||
m_xmlConsole->show();
|
||||
}
|
||||
#endif
|
||||
|
||||
// add VCardUpdate extension to own presence
|
||||
m_client->presence().addExtension( new Jreen::VCardUpdate() );
|
||||
|
||||
@@ -156,19 +148,19 @@ XmppSipPlugin::XmppSipPlugin( XmppAccount *account )
|
||||
qDebug() << "Our Port set to" << m_client->port();
|
||||
|
||||
// setup slots
|
||||
connect( m_client, SIGNAL( serverFeaturesReceived( QSet<QString> ) ), SLOT( onConnect() ) );
|
||||
connect( m_client, SIGNAL( disconnected( Jreen::Client::DisconnectReason ) ), SLOT( onDisconnect( Jreen::Client::DisconnectReason ) ) );
|
||||
connect( m_client, SIGNAL( messageReceived( Jreen::Message ) ), SLOT( onNewMessage( Jreen::Message ) ) );
|
||||
connect(m_client, SIGNAL(serverFeaturesReceived(QSet<QString>)), SLOT(onConnect()));
|
||||
connect(m_client, SIGNAL(disconnected(Jreen::Client::DisconnectReason)), SLOT(onDisconnect(Jreen::Client::DisconnectReason)));
|
||||
connect(m_client, SIGNAL(messageReceived(Jreen::Message)), SLOT(onNewMessage(Jreen::Message)));
|
||||
|
||||
connect( m_client, SIGNAL( iqReceived( Jreen::IQ ) ), SLOT( onNewIq( Jreen::IQ ) ) );
|
||||
connect(m_client, SIGNAL(iqReceived(Jreen::IQ)), SLOT(onNewIq(Jreen::IQ)));
|
||||
|
||||
connect( m_roster, SIGNAL( presenceReceived( Jreen::RosterItem::Ptr, Jreen::Presence ) ),
|
||||
SLOT( onPresenceReceived( Jreen::RosterItem::Ptr, Jreen::Presence ) ) );
|
||||
connect( m_roster, SIGNAL( subscriptionReceived( Jreen::RosterItem::Ptr, Jreen::Presence ) ),
|
||||
SLOT( onSubscriptionReceived( Jreen::RosterItem::Ptr, Jreen::Presence ) ) );
|
||||
connect(m_roster, SIGNAL(presenceReceived(Jreen::RosterItem::Ptr,Jreen::Presence)),
|
||||
SLOT(onPresenceReceived(Jreen::RosterItem::Ptr,Jreen::Presence)));
|
||||
connect(m_roster, SIGNAL(subscriptionReceived(Jreen::RosterItem::Ptr,Jreen::Presence)),
|
||||
SLOT(onSubscriptionReceived(Jreen::RosterItem::Ptr,Jreen::Presence)));
|
||||
|
||||
#ifndef ENABLE_HEADLESS
|
||||
connect( m_avatarManager, SIGNAL( newAvatar( QString ) ), SLOT( onNewAvatar( QString ) ) );
|
||||
connect(m_avatarManager, SIGNAL(newAvatar(QString)), SLOT(onNewAvatar(QString)));
|
||||
#endif
|
||||
|
||||
m_pubSubManager = new Jreen::PubSub::Manager( m_client );
|
||||
@@ -176,16 +168,15 @@ XmppSipPlugin::XmppSipPlugin( XmppAccount *account )
|
||||
|
||||
// Clear status
|
||||
Jreen::Tune::Ptr tune( new Jreen::Tune() );
|
||||
m_pubSubManager->publishItems( QList<Jreen::Payload::Ptr>() << tune, Jreen::JID() );
|
||||
}
|
||||
m_pubSubManager->publishItems(QList<Jreen::Payload::Ptr>() << tune, Jreen::JID());
|
||||
|
||||
}
|
||||
|
||||
XmppSipPlugin::~XmppSipPlugin()
|
||||
{
|
||||
//Note: the next two lines don't currently work, because the deletion wipes out internally posted events, need to talk to euro about a fix
|
||||
Jreen::Tune::Ptr tune( new Jreen::Tune() );
|
||||
m_pubSubManager->publishItems( QList<Jreen::Payload::Ptr>() << tune, Jreen::JID() );
|
||||
|
||||
m_pubSubManager->publishItems(QList<Jreen::Payload::Ptr>() << tune, Jreen::JID());
|
||||
delete m_pubSubManager;
|
||||
delete m_avatarManager;
|
||||
delete m_roster;
|
||||
@@ -214,20 +205,21 @@ XmppSipPlugin::menu()
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void
|
||||
XmppSipPlugin::connectPlugin()
|
||||
{
|
||||
if ( m_client->isConnected() )
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
|
||||
if( m_client->isConnected() )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << "Already connected to server, not connecting again...";
|
||||
return;
|
||||
}
|
||||
|
||||
if ( m_xmppAccount->configuration().contains( "enforcesecure" ) && m_xmppAccount->configuration().value( "enforcesecure" ).toBool() )
|
||||
if( m_account->configuration().contains("enforcesecure") && m_account->configuration().value("enforcesecure").toBool() )
|
||||
{
|
||||
tLog() << Q_FUNC_INFO << "Enforcing secure connection...";
|
||||
m_client->setFeatureConfig( Jreen::Client::Encryption, Jreen::Client::Force );
|
||||
m_client->setFeatureConfig(Jreen::Client::Encryption, Jreen::Client::Force);
|
||||
}
|
||||
|
||||
tDebug() << "Connecting to the Xmpp server..." << m_client->jid().full();
|
||||
@@ -236,17 +228,18 @@ XmppSipPlugin::connectPlugin()
|
||||
QTimer::singleShot( 1000, m_client, SLOT( connectToServer() ) );
|
||||
|
||||
if ( m_client->connection() )
|
||||
connect( m_client->connection(), SIGNAL( error( Jreen::Connection::SocketError ) ), SLOT( onError( Jreen::Connection::SocketError ) ) );
|
||||
connect(m_client->connection(), SIGNAL(error(Jreen::Connection::SocketError)), SLOT(onError(Jreen::Connection::SocketError)));
|
||||
|
||||
m_state = Account::Connecting;
|
||||
emit stateChanged( m_state );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
XmppSipPlugin::disconnectPlugin()
|
||||
{
|
||||
if ( !m_client->isConnected() )
|
||||
if (!m_client->isConnected())
|
||||
{
|
||||
if ( m_state != Account::Disconnected ) // might be Connecting
|
||||
{
|
||||
@@ -274,6 +267,8 @@ XmppSipPlugin::disconnectPlugin()
|
||||
void
|
||||
XmppSipPlugin::onConnect()
|
||||
{
|
||||
// qDebug() << Q_FUNC_INFO;
|
||||
|
||||
// update jid resource, servers like gtalk use resource binding and may
|
||||
// have changed our requested /resource
|
||||
if ( m_client->jid().resource() != m_currentResource )
|
||||
@@ -282,9 +277,15 @@ XmppSipPlugin::onConnect()
|
||||
emit jidChanged( m_client->jid().full() );
|
||||
}
|
||||
|
||||
qDebug() << "Connected to xmpp as:" << m_client->jid().full();
|
||||
|
||||
// set presence to least valid value
|
||||
m_client->setPresence( Jreen::Presence::XA, "Got Tomahawk? http://gettomahawk.com", -127 );
|
||||
m_client->setPingInterval( 1000 );
|
||||
m_client->setPresence(Jreen::Presence::XA, "Got Tomahawk? http://gettomahawk.com", -127);
|
||||
|
||||
// set ping timeout to 15 secs (TODO: verify if this works)
|
||||
m_client->setPingInterval(1000);
|
||||
|
||||
// load roster
|
||||
m_roster->load();
|
||||
|
||||
// load XmppInfoPlugin
|
||||
@@ -292,12 +293,13 @@ XmppSipPlugin::onConnect()
|
||||
{
|
||||
infoPlugin().data()->moveToThread( Tomahawk::InfoSystem::InfoSystem::instance()->workerThread().data() );
|
||||
Tomahawk::InfoSystem::InfoSystem::instance()->addInfoPlugin( infoPlugin() );
|
||||
QMetaObject::invokeMethod( infoPlugin().data(), "init", Qt::QueuedConnection );
|
||||
}
|
||||
|
||||
//FIXME: this implementation is totally broken atm, so it's disabled to avoid harm :P
|
||||
// join MUC with bare jid as nickname
|
||||
//TODO: make the room a list of rooms and make that configurable
|
||||
// QString mucNickname = QString( "tomahawk@conference.qutim.org/" ).append( QString( m_client->jid().bare() ).replace( "@", "-" ) );
|
||||
QString mucNickname = QString( "tomahawk@conference.qutim.org/" ).append( QString( m_client->jid().bare() ).replace( "@", "-" ) );
|
||||
//m_room = new Jreen::MUCRoom(m_client, Jreen::JID( mucNickname ) );
|
||||
//m_room->setHistorySeconds(0);
|
||||
//m_room->join();
|
||||
@@ -316,6 +318,8 @@ XmppSipPlugin::onConnect()
|
||||
void
|
||||
XmppSipPlugin::onDisconnect( Jreen::Client::DisconnectReason reason )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
|
||||
switch( reason )
|
||||
{
|
||||
case Jreen::Client::User:
|
||||
@@ -342,7 +346,7 @@ XmppSipPlugin::onDisconnect( Jreen::Client::DisconnectReason reason )
|
||||
|
||||
default:
|
||||
qDebug() << "Not all Client::DisconnectReasons checked" << ( int ) reason;
|
||||
Q_ASSERT( false );
|
||||
Q_ASSERT(false);
|
||||
break;
|
||||
}
|
||||
m_state = Account::Disconnected;
|
||||
@@ -350,9 +354,9 @@ XmppSipPlugin::onDisconnect( Jreen::Client::DisconnectReason reason )
|
||||
|
||||
removeMenuHelper();
|
||||
|
||||
Q_FOREACH( const Jreen::JID &peer, m_peers.keys() )
|
||||
Q_FOREACH(const Jreen::JID &peer, m_peers.keys())
|
||||
{
|
||||
handlePeerStatus( peer, Jreen::Presence::Unavailable );
|
||||
handlePeerStatus(peer, Jreen::Presence::Unavailable);
|
||||
}
|
||||
|
||||
if ( !m_infoPlugin.isNull() )
|
||||
@@ -373,51 +377,56 @@ XmppSipPlugin::errorMessage( Jreen::Client::DisconnectReason reason )
|
||||
switch( reason )
|
||||
{
|
||||
case Jreen::Client::User:
|
||||
return tr( "User Interaction" );
|
||||
return tr("User Interaction");
|
||||
break;
|
||||
case Jreen::Client::HostUnknown:
|
||||
return tr( "Host is unknown" );
|
||||
return tr("Host is unknown");
|
||||
break;
|
||||
case Jreen::Client::ItemNotFound:
|
||||
return tr( "Item not found" );
|
||||
return tr("Item not found");
|
||||
break;
|
||||
case Jreen::Client::AuthorizationError:
|
||||
return tr( "Authorization Error" );
|
||||
return tr("Authorization Error");
|
||||
break;
|
||||
case Jreen::Client::RemoteStreamError:
|
||||
return tr( "Remote Stream Error" );
|
||||
return tr("Remote Stream Error");
|
||||
break;
|
||||
case Jreen::Client::RemoteConnectionFailed:
|
||||
return tr( "Remote Connection failed" );
|
||||
return tr("Remote Connection failed");
|
||||
break;
|
||||
case Jreen::Client::InternalServerError:
|
||||
return tr( "Internal Server Error" );
|
||||
return tr("Internal Server Error");
|
||||
break;
|
||||
case Jreen::Client::SystemShutdown:
|
||||
return tr( "System shutdown" );
|
||||
return tr("System shutdown");
|
||||
break;
|
||||
case Jreen::Client::Conflict:
|
||||
return tr( "Conflict" );
|
||||
break;
|
||||
case Jreen::Client::NoCompressionSupport:
|
||||
return tr( "No Compression Support" );
|
||||
break;
|
||||
case Jreen::Client::NoEncryptionSupport:
|
||||
return tr( "No Encryption Support" );
|
||||
break;
|
||||
case Jreen::Client::NoAuthorizationSupport:
|
||||
return tr( "No Authorization Support" );
|
||||
break;
|
||||
case Jreen::Client::NoSupportedFeature:
|
||||
return tr( "No Supported Feature" );
|
||||
return tr("Conflict");
|
||||
break;
|
||||
|
||||
case Jreen::Client::Unknown:
|
||||
return tr( "Unknown" );
|
||||
return tr("Unknown");
|
||||
break;
|
||||
|
||||
case Jreen::Client::NoCompressionSupport:
|
||||
return tr("No Compression Support");
|
||||
break;
|
||||
|
||||
case Jreen::Client::NoEncryptionSupport:
|
||||
return tr("No Encryption Support");
|
||||
break;
|
||||
|
||||
case Jreen::Client::NoAuthorizationSupport:
|
||||
return tr("No Authorization Support");
|
||||
break;
|
||||
|
||||
case Jreen::Client::NoSupportedFeature:
|
||||
return tr("No Supported Feature");
|
||||
break;
|
||||
|
||||
default:
|
||||
qDebug() << "Not all Client::DisconnectReasons checked";
|
||||
Q_ASSERT( false );
|
||||
Q_ASSERT(false);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -433,8 +442,9 @@ XmppSipPlugin::sendMsg( const QString& to, const QString& msg )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << to << msg;
|
||||
|
||||
if ( !m_client )
|
||||
if ( !m_client ) {
|
||||
return;
|
||||
}
|
||||
|
||||
/*******************************************************
|
||||
* Obsolete this by a SipMessage class
|
||||
@@ -442,24 +452,29 @@ XmppSipPlugin::sendMsg( const QString& to, const QString& msg )
|
||||
QJson::Parser parser;
|
||||
bool ok;
|
||||
QVariant v = parser.parse( msg.toAscii(), &ok );
|
||||
if ( !ok || v.type() != QVariant::Map )
|
||||
if ( !ok || v.type() != QVariant::Map )
|
||||
{
|
||||
qDebug() << "Invalid JSON in Xmpp msg";
|
||||
return;
|
||||
}
|
||||
|
||||
QVariantMap m = v.toMap();
|
||||
/*******************************************************/
|
||||
|
||||
TomahawkXmppMessage *sipMessage;
|
||||
if ( m["visible"].toBool() )
|
||||
if(m["visible"].toBool())
|
||||
{
|
||||
sipMessage = new TomahawkXmppMessage( m["ip"].toString(), m["port"].toInt(), m["uniqname"].toString(), m["key"].toString() );
|
||||
sipMessage = new TomahawkXmppMessage( m["ip"].toString(),
|
||||
m["port"].toInt(),
|
||||
m["uniqname"].toString(),
|
||||
m["key"].toString()
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
sipMessage = new TomahawkXmppMessage();
|
||||
}
|
||||
|
||||
qDebug() << "Send sip messsage to" << to;
|
||||
qDebug() << "Send sip messsage to " << to;
|
||||
Jreen::IQ iq( Jreen::IQ::Set, to );
|
||||
iq.addExtension( sipMessage );
|
||||
Jreen::IQReply *reply = m_client->send( iq );
|
||||
@@ -471,10 +486,12 @@ XmppSipPlugin::sendMsg( const QString& to, const QString& msg )
|
||||
void
|
||||
XmppSipPlugin::broadcastMsg( const QString& msg )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
|
||||
if ( !m_client )
|
||||
return;
|
||||
|
||||
foreach ( const Jreen::JID& jid, m_peers.keys() )
|
||||
foreach( const Jreen::JID& jid, m_peers.keys() )
|
||||
{
|
||||
sendMsg( jid.full(), msg );
|
||||
}
|
||||
@@ -485,11 +502,14 @@ void
|
||||
XmppSipPlugin::addContact( const QString& jid, const QString& msg )
|
||||
{
|
||||
// Add contact to the Tomahawk group on the roster
|
||||
|
||||
QString realJid = jid;
|
||||
if ( !realJid.contains( '@' ) )
|
||||
if( !realJid.contains( '@' ) )
|
||||
realJid += defaultSuffix();
|
||||
|
||||
m_roster->subscribe( realJid, msg, realJid, QStringList() << "Tomahawk" );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -513,24 +533,24 @@ XmppSipPlugin::showAddFriendDialog()
|
||||
void
|
||||
XmppSipPlugin::publishTune( const QUrl& url, const InfoSystem::InfoStringHash& trackInfo )
|
||||
{
|
||||
if ( m_xmppAccount->configuration().value("publishtracks").toBool() == false )
|
||||
if( m_account->configuration().value("publishtracks").toBool() == false )
|
||||
{
|
||||
tDebug() << Q_FUNC_INFO << m_client->jid().full() << "Not publishing now playing info (disabled in account config)";
|
||||
tDebug() << Q_FUNC_INFO << m_client->jid().full() << "Not publishing now playing info (disabled in account config)";
|
||||
return;
|
||||
}
|
||||
|
||||
if ( trackInfo.isEmpty() )
|
||||
{
|
||||
Jreen::Tune::Ptr tune( new Jreen::Tune() );
|
||||
m_pubSubManager->publishItems( QList<Jreen::Payload::Ptr>() << tune, Jreen::JID() );
|
||||
m_pubSubManager->publishItems(QList<Jreen::Payload::Ptr>() << tune, Jreen::JID());
|
||||
}
|
||||
|
||||
Jreen::Tune::Ptr tune( new Jreen::Tune() );
|
||||
|
||||
tune->setTitle( trackInfo.value( "title" ) );
|
||||
tune->setArtist( trackInfo.value( "artist" ) );
|
||||
tune->setLength( trackInfo.value( "duration" ).toInt() );
|
||||
tune->setTrack( trackInfo.value( "albumpos" ) );
|
||||
tune->setLength( trackInfo.value("duration").toInt() );
|
||||
tune->setTrack( trackInfo.value("albumpos") );
|
||||
|
||||
//TODO: provide a rating once available in Tomahawk
|
||||
tune->setRating( 10 );
|
||||
@@ -539,7 +559,7 @@ XmppSipPlugin::publishTune( const QUrl& url, const InfoSystem::InfoStringHash& t
|
||||
tune->setSource( "Tomahawk" );
|
||||
|
||||
tune->setUri( url );
|
||||
tDebug() << Q_FUNC_INFO << "Setting URI of" << tune->uri().toString();
|
||||
tDebug() << Q_FUNC_INFO << "Setting URI of " << tune->uri().toString();
|
||||
|
||||
m_pubSubManager->publishItems( QList<Jreen::Payload::Ptr>() << tune, Jreen::JID() );
|
||||
}
|
||||
@@ -581,7 +601,6 @@ XmppSipPlugin::configurationChanged()
|
||||
server = readServer();
|
||||
port = readPort();
|
||||
|
||||
qDebug() << Q_FUNC_INFO << "Configuration changed in SIP plugin:" << username << password << server << port << m_account->accountFriendlyName();
|
||||
if ( m_currentUsername != username )
|
||||
{
|
||||
m_currentUsername = username;
|
||||
@@ -606,35 +625,31 @@ XmppSipPlugin::configurationChanged()
|
||||
if ( !m_currentUsername.contains( '@' ) )
|
||||
{
|
||||
m_currentUsername += defaultSuffix();
|
||||
QVariantHash credentials = m_xmppAccount->credentials();
|
||||
QVariantHash credentials = m_account->credentials();
|
||||
credentials[ "username" ] = m_currentUsername;
|
||||
m_xmppAccount->saveCredentials( credentials );
|
||||
m_account->setCredentials( credentials );
|
||||
m_account->sync();
|
||||
}
|
||||
|
||||
|
||||
qDebug() << Q_FUNC_INFO << "reconnecting?" << reconnect << "enabled?" << m_account->enabled() << m_account->accountFriendlyName();
|
||||
if ( reconnect )
|
||||
setupClientHelper();
|
||||
|
||||
if ( reconnect && m_account->enabled() )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << "Reconnecting jreen plugin...";
|
||||
disconnectPlugin();
|
||||
|
||||
setupClientHelper();
|
||||
|
||||
qDebug() << Q_FUNC_INFO << "Updated settings";
|
||||
connectPlugin();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
XmppSipPlugin::setupClientHelper()
|
||||
void XmppSipPlugin::setupClientHelper()
|
||||
{
|
||||
Jreen::JID jid = Jreen::JID( m_currentUsername );
|
||||
m_client->setJID( jid );
|
||||
m_client->setPassword( m_currentPassword );
|
||||
|
||||
if ( !m_currentServer.isEmpty() )
|
||||
if( !m_currentServer.isEmpty() )
|
||||
{
|
||||
// set explicit server details
|
||||
m_client->setServer( m_currentServer );
|
||||
@@ -648,22 +663,20 @@ XmppSipPlugin::setupClientHelper()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
XmppSipPlugin::addMenuHelper()
|
||||
void XmppSipPlugin::addMenuHelper()
|
||||
{
|
||||
#ifndef ENABLE_HEADLESS
|
||||
if ( !m_menu )
|
||||
if( !m_menu )
|
||||
{
|
||||
m_menu = new QMenu( QString( "%1 (" ).arg( friendlyName() ).append( readUsername() ).append(")" ) );
|
||||
|
||||
QAction* addFriendAction = m_menu->addAction( tr( "Add Friend..." ) );
|
||||
connect( addFriendAction, SIGNAL( triggered() ), SLOT( showAddFriendDialog() ) );
|
||||
connect( addFriendAction, SIGNAL( triggered() ), this, SLOT( showAddFriendDialog() ) );
|
||||
|
||||
if ( readXmlConsoleEnabled() )
|
||||
if( readXmlConsoleEnabled() )
|
||||
{
|
||||
QAction* showXmlConsoleAction = m_menu->addAction( tr( "XML Console..." ) );
|
||||
connect( showXmlConsoleAction, SIGNAL( triggered() ), SLOT( showXmlConsole() ) );
|
||||
QAction* showXmlConsoleAction = m_menu->addAction( tr( "XML Console...") );
|
||||
connect( showXmlConsoleAction, SIGNAL( triggered() ), this, SLOT( showXmlConsole() ) );
|
||||
}
|
||||
|
||||
emit addMenu( m_menu );
|
||||
@@ -671,12 +684,10 @@ XmppSipPlugin::addMenuHelper()
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
XmppSipPlugin::removeMenuHelper()
|
||||
void XmppSipPlugin::removeMenuHelper()
|
||||
{
|
||||
#ifndef ENABLE_HEADLESS
|
||||
if ( m_menu )
|
||||
if( m_menu )
|
||||
{
|
||||
emit removeMenu( m_menu );
|
||||
|
||||
@@ -687,35 +698,37 @@ XmppSipPlugin::removeMenuHelper()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
XmppSipPlugin::onNewMessage( const Jreen::Message& message )
|
||||
void XmppSipPlugin::onNewMessage( const Jreen::Message& message )
|
||||
{
|
||||
if ( m_state != Account::Connected )
|
||||
return;
|
||||
|
||||
// qDebug() << Q_FUNC_INFO << "message type" << message.subtype();
|
||||
|
||||
QString from = message.from().full();
|
||||
QString msg = message.body();
|
||||
|
||||
if ( msg.isEmpty() )
|
||||
if(msg.isEmpty())
|
||||
return;
|
||||
|
||||
if ( message.subtype() == Jreen::Message::Error )
|
||||
if( message.subtype() == Jreen::Message::Error )
|
||||
{
|
||||
tDebug() << Q_FUNC_INFO << "Received error message from" << from << ", not answering... (Condition:"
|
||||
tDebug() << Q_FUNC_INFO << "Received error message from " << from << ", not answering... (Condition: "
|
||||
<< ( message.error().isNull() ? -1 : message.error()->condition() ) << ")";
|
||||
return;
|
||||
}
|
||||
|
||||
SipInfo info = SipInfo::fromJson( msg );
|
||||
|
||||
if ( !info.isValid() )
|
||||
{
|
||||
QString to = from;
|
||||
QString response = QString( tr( "I'm sorry -- I'm just an automatic presence used by Tomahawk Player"
|
||||
" (http://gettomahawk.com). If you are getting this message, the person you"
|
||||
" are trying to reach is probably not signed on, so please try again later!" ) );
|
||||
QString response = QString( tr("I'm sorry -- I'm just an automatic presence used by Tomahawk Player"
|
||||
" (http://gettomahawk.com). If you are getting this message, the person you"
|
||||
" are trying to reach is probably not signed on, so please try again later!") );
|
||||
|
||||
// this is not a sip message, so we send it directly through the client
|
||||
m_client->send( Jreen::Message ( Jreen::Message::Error, Jreen::JID( to ), response) );
|
||||
m_client->send( Jreen::Message ( Jreen::Message::Error, Jreen::JID(to), response) );
|
||||
|
||||
emit msgReceived( from, msg );
|
||||
return;
|
||||
@@ -726,8 +739,7 @@ XmppSipPlugin::onNewMessage( const Jreen::Message& message )
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
XmppSipPlugin::onPresenceReceived( const Jreen::RosterItem::Ptr& item, const Jreen::Presence& presence )
|
||||
void XmppSipPlugin::onPresenceReceived( const Jreen::RosterItem::Ptr &item, const Jreen::Presence& presence )
|
||||
{
|
||||
Q_UNUSED(item);
|
||||
if ( m_state != Account::Connected )
|
||||
@@ -738,20 +750,19 @@ XmppSipPlugin::onPresenceReceived( const Jreen::RosterItem::Ptr& item, const Jre
|
||||
|
||||
qDebug() << Q_FUNC_INFO << "* New presence:" << fulljid << presence.subtype();
|
||||
|
||||
if ( jid == m_client->jid() )
|
||||
if( jid == m_client->jid() )
|
||||
return;
|
||||
|
||||
if ( presence.error() )
|
||||
{
|
||||
if ( presence.error() ) {
|
||||
//qDebug() << Q_FUNC_INFO << fulljid << "Running tomahawk: no" << "presence error";
|
||||
return;
|
||||
}
|
||||
|
||||
// ignore anyone not Running tomahawk:
|
||||
Jreen::Capabilities::Ptr caps = presence.payload<Jreen::Capabilities>();
|
||||
if ( caps )
|
||||
if( caps )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << fulljid << "Running tomahawk: maybe" << "caps" << caps->node() << "requesting disco...";
|
||||
qDebug() << Q_FUNC_INFO << fulljid << "Running tomahawk: maybe" << "caps " << caps->node() << "requesting disco...";
|
||||
|
||||
// request disco features
|
||||
QString node = caps->node() + '#' + caps->ver();
|
||||
@@ -763,7 +774,7 @@ XmppSipPlugin::onPresenceReceived( const Jreen::RosterItem::Ptr& item, const Jre
|
||||
reply->setData( RequestDisco );
|
||||
connect( reply, SIGNAL( received( Jreen::IQ ) ), SLOT( onNewIq( Jreen::IQ ) ) );
|
||||
}
|
||||
else if ( !caps )
|
||||
else if( !caps )
|
||||
{
|
||||
// qDebug() << Q_FUNC_INFO << "Running tomahawk: no" << "no caps";
|
||||
if ( presenceMeansOnline( m_peers[ jid ] ) )
|
||||
@@ -772,40 +783,46 @@ XmppSipPlugin::onPresenceReceived( const Jreen::RosterItem::Ptr& item, const Jre
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
XmppSipPlugin::onSubscriptionReceived( const Jreen::RosterItem::Ptr& item, const Jreen::Presence& presence )
|
||||
void XmppSipPlugin::onSubscriptionReceived( const Jreen::RosterItem::Ptr& item, const Jreen::Presence& presence )
|
||||
{
|
||||
if ( m_state != Account::Connected )
|
||||
return;
|
||||
|
||||
if ( item )
|
||||
// qDebug() << Q_FUNC_INFO << "presence type:" << presence.subtype();
|
||||
if(item)
|
||||
qDebug() << Q_FUNC_INFO << presence.from().full() << "subs" << item->subscription() << "ask" << item->ask();
|
||||
else
|
||||
qDebug() << Q_FUNC_INFO << "item empty";
|
||||
|
||||
// don't do anything if the contact is already subscribed to us
|
||||
if ( presence.subtype() != Jreen::Presence::Subscribe ||
|
||||
( item && (item->subscription() == Jreen::RosterItem::From || item->subscription() == Jreen::RosterItem::Both ) ) )
|
||||
if( presence.subtype() != Jreen::Presence::Subscribe ||
|
||||
(
|
||||
item && (item->subscription() == Jreen::RosterItem::From || item->subscription() == Jreen::RosterItem::Both)
|
||||
)
|
||||
)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// check if the requester is already on the roster
|
||||
if ( item &&
|
||||
( item->subscription() == Jreen::RosterItem::To || ( item->subscription() == Jreen::RosterItem::None && !item->ask().isEmpty() ) ) )
|
||||
if(item &&
|
||||
(
|
||||
item->subscription() == Jreen::RosterItem::To ||
|
||||
( item->subscription() == Jreen::RosterItem::None && !item->ask().isEmpty() )
|
||||
)
|
||||
)
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << presence.from().bare() << "already on the roster so we assume ack'ing subscription request is okay...";
|
||||
m_roster->allowSubscription( presence.from(), true );
|
||||
m_roster->allowSubscription(presence.from(), true);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef ENABLE_HEADLESS
|
||||
// preparing the confirm box for the user
|
||||
QMessageBox *confirmBox = new QMessageBox(
|
||||
QMessageBox::Question,
|
||||
tr( "Authorize User" ),
|
||||
QString( tr( "Do you want to grant <b>%1</b> access to your Collection?" ) ).arg( presence.from().bare() ),
|
||||
QString( tr( "Do you want to grant <b>%1</b> access to your Collection?" ) ).arg(presence.from().bare()),
|
||||
QMessageBox::Yes | QMessageBox::No,
|
||||
TomahawkUtils::tomahawkWindow()
|
||||
);
|
||||
@@ -841,10 +858,11 @@ XmppSipPlugin::onSubscriptionRequestConfirmed( int result )
|
||||
sender()->deleteLater();
|
||||
|
||||
QMessageBox::StandardButton allowSubscription = static_cast< QMessageBox::StandardButton >( result );
|
||||
|
||||
if ( allowSubscription == QMessageBox::Yes )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << jid.bare() << "accepted by user, adding to roster";
|
||||
addContact( jid, "" );
|
||||
addContact(jid, "");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -856,8 +874,7 @@ XmppSipPlugin::onSubscriptionRequestConfirmed( int result )
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
XmppSipPlugin::onNewIq( const Jreen::IQ& iq )
|
||||
void XmppSipPlugin::onNewIq( const Jreen::IQ& iq )
|
||||
{
|
||||
if ( m_state != Account::Connected )
|
||||
return;
|
||||
@@ -871,9 +888,10 @@ XmppSipPlugin::onNewIq( const Jreen::IQ& iq )
|
||||
Jreen::Disco::Info *discoInfo = iq.payload< Jreen::Disco::Info >().data();
|
||||
if ( !discoInfo )
|
||||
return;
|
||||
|
||||
iq.accept();
|
||||
|
||||
Jreen::JID jid = iq.from();
|
||||
|
||||
Jreen::DataForm::Ptr form = discoInfo->form();
|
||||
|
||||
if ( discoInfo->features().contains( TOMAHAWK_FEATURE ) )
|
||||
@@ -889,8 +907,8 @@ XmppSipPlugin::onNewIq( const Jreen::IQ& iq )
|
||||
Jreen::SoftwareVersion::Ptr softwareVersion = iq.payload<Jreen::SoftwareVersion>();
|
||||
if ( softwareVersion )
|
||||
{
|
||||
QString versionString = QString( "%1 %2 %3" ).arg( softwareVersion->name(), softwareVersion->os(), softwareVersion->version() );
|
||||
qDebug() << Q_FUNC_INFO << "Received software version for" << iq.from().full() << ":" << versionString;
|
||||
QString versionString = QString("%1 %2 %3").arg( softwareVersion->name(), softwareVersion->os(), softwareVersion->version() );
|
||||
qDebug() << Q_FUNC_INFO << "Received software version for " << iq.from().full() << ":" << versionString;
|
||||
emit softwareVersionReceived( iq.from().full(), versionString );
|
||||
}
|
||||
}
|
||||
@@ -918,8 +936,9 @@ XmppSipPlugin::onNewIq( const Jreen::IQ& iq )
|
||||
|
||||
SipInfo info;
|
||||
info.setVisible( sipMessage->visible() );
|
||||
if ( sipMessage->visible() )
|
||||
if( sipMessage->visible() )
|
||||
{
|
||||
|
||||
QHostInfo hi;
|
||||
hi.setHostName( sipMessage->ip() );
|
||||
info.setHost( hi );
|
||||
@@ -937,8 +956,7 @@ XmppSipPlugin::onNewIq( const Jreen::IQ& iq )
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
XmppSipPlugin::presenceMeansOnline( Jreen::Presence::Type p )
|
||||
bool XmppSipPlugin::presenceMeansOnline( Jreen::Presence::Type p )
|
||||
{
|
||||
switch( p )
|
||||
{
|
||||
@@ -947,21 +965,22 @@ XmppSipPlugin::presenceMeansOnline( Jreen::Presence::Type p )
|
||||
case Jreen::Presence::Error:
|
||||
return false;
|
||||
break;
|
||||
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
XmppSipPlugin::handlePeerStatus( const Jreen::JID& jid, Jreen::Presence::Type presenceType )
|
||||
void XmppSipPlugin::handlePeerStatus( const Jreen::JID& jid, Jreen::Presence::Type presenceType )
|
||||
{
|
||||
QString fulljid = jid.full();
|
||||
|
||||
// "going offline" event
|
||||
if ( !presenceMeansOnline( presenceType ) &&
|
||||
( !m_peers.contains( jid ) || presenceMeansOnline( m_peers.value( jid ) ) ) )
|
||||
( !m_peers.contains( jid ) ||
|
||||
presenceMeansOnline( m_peers.value( jid ) )
|
||||
)
|
||||
)
|
||||
{
|
||||
m_peers[ jid ] = presenceType;
|
||||
qDebug() << Q_FUNC_INFO << "* Peer goes offline:" << fulljid;
|
||||
@@ -972,7 +991,10 @@ XmppSipPlugin::handlePeerStatus( const Jreen::JID& jid, Jreen::Presence::Type pr
|
||||
|
||||
// "coming online" event
|
||||
if ( presenceMeansOnline( presenceType ) &&
|
||||
( !m_peers.contains( jid ) || !presenceMeansOnline( m_peers.value( jid ) ) ) )
|
||||
( !m_peers.contains( jid ) ||
|
||||
!presenceMeansOnline( m_peers.value( jid ) )
|
||||
)
|
||||
)
|
||||
{
|
||||
m_peers[ jid ] = presenceType;
|
||||
qDebug() << Q_FUNC_INFO << "* Peer goes online:" << fulljid;
|
||||
@@ -999,8 +1021,7 @@ XmppSipPlugin::handlePeerStatus( const Jreen::JID& jid, Jreen::Presence::Type pr
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
XmppSipPlugin::onNewAvatar( const QString& jid )
|
||||
void XmppSipPlugin::onNewAvatar( const QString& jid )
|
||||
{
|
||||
#ifndef ENABLE_HEADLESS
|
||||
// qDebug() << Q_FUNC_INFO << jid;
|
||||
@@ -1011,20 +1032,20 @@ XmppSipPlugin::onNewAvatar( const QString& jid )
|
||||
|
||||
// find peers for the jid
|
||||
QList< Jreen::JID > peers = m_peers.keys();
|
||||
foreach ( const Jreen::JID& peer, peers )
|
||||
foreach ( const Jreen::JID &peer, peers )
|
||||
{
|
||||
if ( peer.bare() == jid )
|
||||
if( peer.bare() == jid )
|
||||
{
|
||||
emit avatarReceived( peer.full(), m_avatarManager->avatar( jid ) );
|
||||
emit avatarReceived ( peer.full(), m_avatarManager->avatar( jid ) );
|
||||
}
|
||||
}
|
||||
|
||||
if ( jid == m_client->jid().bare() )
|
||||
// own avatar
|
||||
emit avatarReceived( m_avatarManager->avatar( jid ) );
|
||||
emit avatarReceived ( m_avatarManager->avatar( jid ) );
|
||||
else
|
||||
// someone else's avatar
|
||||
emit avatarReceived( jid, m_avatarManager->avatar( jid ) );
|
||||
emit avatarReceived ( jid, m_avatarManager->avatar( jid ) );
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1041,21 +1062,22 @@ XmppSipPlugin::readXmlConsoleEnabled()
|
||||
QString
|
||||
XmppSipPlugin::readUsername()
|
||||
{
|
||||
return m_xmppAccount->credentials().value( "username" ).toString();
|
||||
QVariantHash credentials = m_account->credentials();
|
||||
return credentials.contains( "username" ) ? credentials[ "username" ].toString() : QString();
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
XmppSipPlugin::readPassword()
|
||||
{
|
||||
return m_xmppAccount->credentials().value( "password" ).toString();
|
||||
QVariantHash credentials = m_account->credentials();
|
||||
return credentials.contains( "password" ) ? credentials[ "password" ].toString() : QString();
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
XmppSipPlugin::readPort()
|
||||
{
|
||||
QVariantHash configuration = m_xmppAccount->configuration();
|
||||
QVariantHash configuration = m_account->configuration();
|
||||
return configuration.contains( "port" ) ? configuration[ "port" ].toInt() : 5222;
|
||||
}
|
||||
|
||||
@@ -1063,7 +1085,7 @@ XmppSipPlugin::readPort()
|
||||
QString
|
||||
XmppSipPlugin::readServer()
|
||||
{
|
||||
QVariantHash configuration = m_xmppAccount->configuration();
|
||||
QVariantHash configuration = m_account->configuration();
|
||||
return configuration.contains( "server" ) ? configuration[ "server" ].toString() : QString();
|
||||
}
|
||||
|
||||
|
@@ -48,17 +48,13 @@
|
||||
#include <QtGui/QMessageBox>
|
||||
#endif
|
||||
|
||||
#define TOMAHAWK_FEATURE QLatin1String( "tomahawk:sip:v1" )
|
||||
#define TOMAHAWK_CAP_NODE_NAME QLatin1String( "http://tomahawk-player.org/" )
|
||||
|
||||
#include "accounts/AccountDllMacro.h"
|
||||
|
||||
#include "../XmppInfoPlugin.h"
|
||||
|
||||
namespace Tomahawk {
|
||||
namespace Accounts {
|
||||
class XmppAccount;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class ACCOUNTDLLEXPORT XmppSipPlugin : public SipPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -66,7 +62,7 @@ class ACCOUNTDLLEXPORT XmppSipPlugin : public SipPlugin
|
||||
friend class Tomahawk::InfoSystem::XmppInfoPlugin;
|
||||
|
||||
public:
|
||||
XmppSipPlugin( Tomahawk::Accounts::XmppAccount* account );
|
||||
XmppSipPlugin( Tomahawk::Accounts::Account* account );
|
||||
virtual ~XmppSipPlugin();
|
||||
|
||||
//FIXME: Make this more correct
|
||||
@@ -94,11 +90,10 @@ public slots:
|
||||
virtual void checkSettings();
|
||||
virtual void configurationChanged();
|
||||
virtual void sendMsg( const QString& to, const QString& msg );
|
||||
virtual void addContact( const QString& jid, const QString& msg = QString() );
|
||||
|
||||
void broadcastMsg( const QString& msg );
|
||||
void broadcastMsg( const QString &msg );
|
||||
virtual void addContact( const QString &jid, const QString& msg = QString() );
|
||||
void showAddFriendDialog();
|
||||
void publishTune( const QUrl& url, const Tomahawk::InfoSystem::InfoStringHash& trackInfo );
|
||||
void publishTune( const QUrl &url, const Tomahawk::InfoSystem::InfoStringHash &trackInfo );
|
||||
|
||||
protected:
|
||||
virtual QString defaultSuffix() const;
|
||||
@@ -108,14 +103,14 @@ private slots:
|
||||
void onConnect();
|
||||
void onDisconnect( Jreen::Client::DisconnectReason reason );
|
||||
|
||||
void onPresenceReceived( const Jreen::RosterItem::Ptr& item, const Jreen::Presence& presence );
|
||||
void onSubscriptionReceived( const Jreen::RosterItem::Ptr& item, const Jreen::Presence& presence );
|
||||
void onPresenceReceived( const Jreen::RosterItem::Ptr &item, const Jreen::Presence& presence );
|
||||
void onSubscriptionReceived( const Jreen::RosterItem::Ptr &item, const Jreen::Presence& presence );
|
||||
void onSubscriptionRequestConfirmed( int result );
|
||||
|
||||
void onNewMessage( const Jreen::Message& message );
|
||||
void onError( const Jreen::Connection::SocketError& e );
|
||||
void onNewIq( const Jreen::IQ& iq );
|
||||
void onNewAvatar( const QString& jid );
|
||||
void onNewIq( const Jreen::IQ &iq );
|
||||
void onNewAvatar( const QString &jid );
|
||||
|
||||
private:
|
||||
bool readXmlConsoleEnabled();
|
||||
@@ -130,7 +125,7 @@ private:
|
||||
void removeMenuHelper();
|
||||
|
||||
bool presenceMeansOnline( Jreen::Presence::Type p );
|
||||
void handlePeerStatus( const Jreen::JID& jid, Jreen::Presence::Type presenceType );
|
||||
void handlePeerStatus( const Jreen::JID &jid, Jreen::Presence::Type presenceType );
|
||||
|
||||
QString m_currentUsername;
|
||||
QString m_currentPassword;
|
||||
@@ -138,25 +133,22 @@ private:
|
||||
int m_currentPort;
|
||||
QString m_currentResource;
|
||||
|
||||
Tomahawk::Accounts::XmppAccount* m_xmppAccount;
|
||||
QWeakPointer< Tomahawk::InfoSystem::XmppInfoPlugin > m_infoPlugin;
|
||||
QWeakPointer< Tomahawk::InfoSystem::XmppInfoPlugin> m_infoPlugin;
|
||||
Tomahawk::Accounts::Account::ConnectionState m_state;
|
||||
|
||||
// sort out
|
||||
Jreen::Client* m_client;
|
||||
|
||||
Jreen::MUCRoom* m_room;
|
||||
Jreen::SimpleRoster* m_roster;
|
||||
QHash< Jreen::JID, Jreen::Presence::Type > m_peers;
|
||||
Jreen::Client *m_client;
|
||||
|
||||
Jreen::MUCRoom *m_room;
|
||||
Jreen::SimpleRoster *m_roster;
|
||||
QHash<Jreen::JID, Jreen::Presence::Type> m_peers;
|
||||
#ifndef ENABLE_HEADLESS
|
||||
QHash< Jreen::JID, QMessageBox* > m_subscriptionConfirmBoxes;
|
||||
QHash<Jreen::JID, QMessageBox*> m_subscriptionConfirmBoxes;
|
||||
QMenu* m_menu;
|
||||
XmlConsole* m_xmlConsole;
|
||||
#endif
|
||||
|
||||
enum IqContext { NoContext, RequestDisco, RequestedDisco, SipMessageSent, RequestedVCard, RequestVersion, RequestedVersion };
|
||||
AvatarManager* m_avatarManager;
|
||||
AvatarManager *m_avatarManager;
|
||||
Jreen::PubSub::Manager* m_pubSubManager;
|
||||
};
|
||||
|
||||
|
@@ -86,7 +86,7 @@ void
|
||||
ZeroconfAccount::authenticate()
|
||||
{
|
||||
if ( !isAuthenticated() )
|
||||
sipPlugin()->connectPlugin();
|
||||
static_cast< ZeroconfPlugin* >( m_sipPlugin.data() )->connectPlugin();
|
||||
}
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ void
|
||||
ZeroconfAccount::deauthenticate()
|
||||
{
|
||||
if ( isAuthenticated() )
|
||||
sipPlugin()->disconnectPlugin();
|
||||
static_cast< ZeroconfPlugin* >( m_sipPlugin.data() )->disconnectPlugin();
|
||||
}
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ ZeroconfAccount::connectionState() const
|
||||
return Disconnected;
|
||||
|
||||
// TODO can we get called before sipPlugin()?
|
||||
return m_sipPlugin.data()->connectionState();
|
||||
return static_cast< ZeroconfPlugin* >( m_sipPlugin.data() )->connectionState();
|
||||
}
|
||||
|
||||
|
||||
@@ -120,10 +120,10 @@ SipPlugin*
|
||||
ZeroconfAccount::sipPlugin()
|
||||
{
|
||||
if ( m_sipPlugin.isNull() )
|
||||
m_sipPlugin = QWeakPointer< ZeroconfPlugin >( new ZeroconfPlugin( this ) );
|
||||
m_sipPlugin = QWeakPointer< SipPlugin >( new ZeroconfPlugin( this ) );
|
||||
|
||||
return m_sipPlugin.data();
|
||||
}
|
||||
|
||||
|
||||
Q_EXPORT_PLUGIN2( Tomahawk::Accounts::AccountFactory, Tomahawk::Accounts::ZeroconfFactory )
|
||||
Q_EXPORT_PLUGIN2( Tomahawk::Accounts::AccountFactory, Tomahawk::Accounts::ZeroconfFactory )
|
@@ -19,7 +19,6 @@
|
||||
#ifndef ZEROCONF_ACCOUNTS_H
|
||||
#define ZEROCONF_ACCOUNTS_H
|
||||
|
||||
#include "Zeroconf.h"
|
||||
#include "accounts/Account.h"
|
||||
#include "../AccountDllMacro.h"
|
||||
|
||||
@@ -72,7 +71,7 @@ public:
|
||||
QWidget* aclWidget() { return 0; }
|
||||
|
||||
private:
|
||||
QWeakPointer< ZeroconfPlugin > m_sipPlugin;
|
||||
QWeakPointer< SipPlugin > m_sipPlugin;
|
||||
};
|
||||
|
||||
}
|
||||
|
@@ -77,7 +77,7 @@
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" font-weight:600;">Sorry!</span> Tomahawk crashed. Please tell us about it! Tomahawk has created an error report for you that can help improve the stability in the future. You can now send this report directly to the Tomahawk developers.</p></body></html></string>
|
||||
<string><html><head/><body><p><span style=" font-weight:600;">Sorry!</span> Tomahawk crashed. Please tell us about it! Tomahawk has created an error report for you that can help improve the stability in the future. You can now send the this report directly to the Tomahawk developers.</p></body></html></string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::RichText</enum>
|
||||
|
@@ -9,7 +9,6 @@ list(APPEND simple_plugins
|
||||
MusixMatch
|
||||
MusicBrainz
|
||||
Rovi
|
||||
Discogs
|
||||
)
|
||||
|
||||
foreach(simple_plugin ${simple_plugins})
|
||||
|
@@ -52,23 +52,8 @@ ChartsPlugin::ChartsPlugin()
|
||||
: InfoPlugin()
|
||||
, m_chartsFetchJobs( 0 )
|
||||
{
|
||||
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << QThread::currentThread();
|
||||
/// If you add resource, update version aswell
|
||||
m_chartVersion = "2.3";
|
||||
m_supportedGetTypes << InfoChart << InfoChartCapabilities;
|
||||
}
|
||||
|
||||
|
||||
ChartsPlugin::~ChartsPlugin()
|
||||
{
|
||||
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << QThread::currentThread();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ChartsPlugin::init()
|
||||
{
|
||||
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << QThread::currentThread();
|
||||
QVariantList source_qvarlist = TomahawkUtils::Cache::instance()->getData( "ChartsPlugin", "chart_sources" ).toList();
|
||||
foreach( const QVariant & source, source_qvarlist ) {
|
||||
m_chartResources.append( source.toString() );
|
||||
@@ -78,6 +63,14 @@ ChartsPlugin::init()
|
||||
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "total sources" << m_chartResources.size() << source_qvarlist.size();
|
||||
if( m_chartResources.size() == 0 )
|
||||
fetchChartSourcesList( true );
|
||||
m_supportedGetTypes << InfoChart << InfoChartCapabilities;
|
||||
|
||||
}
|
||||
|
||||
|
||||
ChartsPlugin::~ChartsPlugin()
|
||||
{
|
||||
tDebug( LOGVERBOSE ) << Q_FUNC_INFO;
|
||||
}
|
||||
|
||||
|
||||
@@ -226,7 +219,7 @@ ChartsPlugin::fetchChartSourcesList( bool fetchOnlySourceList )
|
||||
reply->setProperty( "only_source_list", fetchOnlySourceList );
|
||||
|
||||
|
||||
tDebug() << Q_FUNC_INFO << "fetching:" << url;
|
||||
tDebug() << "fetching:" << url;
|
||||
connect( reply, SIGNAL( finished() ), SLOT( chartSourcesList() ) );
|
||||
|
||||
}
|
||||
@@ -234,7 +227,7 @@ ChartsPlugin::fetchChartSourcesList( bool fetchOnlySourceList )
|
||||
void
|
||||
ChartsPlugin::chartSourcesList()
|
||||
{
|
||||
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Got chart sources list";
|
||||
tDebug( LOGVERBOSE ) << "Got chart sources list";
|
||||
QNetworkReply* reply = qobject_cast<QNetworkReply*>( sender() );
|
||||
|
||||
if ( reply->error() == QNetworkReply::NoError )
|
||||
@@ -246,7 +239,7 @@ ChartsPlugin::chartSourcesList()
|
||||
|
||||
if ( !ok )
|
||||
{
|
||||
tLog() << Q_FUNC_INFO << "Failed to parse sources" << p.errorString() << "On line" << p.errorLine();
|
||||
tLog() << "Failed to parse sources" << p.errorString() << "On line" << p.errorLine();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -260,8 +253,6 @@ ChartsPlugin::chartSourcesList()
|
||||
if( !reply->property("only_source_list" ).toBool() )
|
||||
fetchAllChartSources();
|
||||
}
|
||||
else
|
||||
tDebug() << Q_FUNC_INFO << "Encountered error fetching chart sources list";
|
||||
}
|
||||
|
||||
void ChartsPlugin::fetchAllChartSources()
|
||||
@@ -275,7 +266,7 @@ void ChartsPlugin::fetchAllChartSources()
|
||||
QNetworkReply* reply = TomahawkUtils::nam()->get( QNetworkRequest( url ) );
|
||||
reply->setProperty( "chart_source", source);
|
||||
|
||||
tDebug() << Q_FUNC_INFO << "fetching:" << url;
|
||||
tDebug() << "fetching:" << url;
|
||||
connect( reply, SIGNAL( finished() ), SLOT( chartsList() ) );
|
||||
|
||||
m_chartsFetchJobs++;
|
||||
@@ -300,7 +291,7 @@ void ChartsPlugin::fetchChart( Tomahawk::InfoSystem::InfoRequestData requestData
|
||||
void
|
||||
ChartsPlugin::chartsList()
|
||||
{
|
||||
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Got chart list result";
|
||||
tDebug( LOGVERBOSE ) << "Got chart list result";
|
||||
QNetworkReply* reply = qobject_cast<QNetworkReply*>( sender() );
|
||||
|
||||
if ( reply->error() == QNetworkReply::NoError )
|
||||
|
@@ -55,7 +55,6 @@ public:
|
||||
ChartType chartType() const { return m_chartType; }
|
||||
|
||||
protected slots:
|
||||
virtual void init();
|
||||
virtual void getInfo( Tomahawk::InfoSystem::InfoRequestData requestData );
|
||||
virtual void notInCacheSlot( Tomahawk::InfoSystem::InfoStringHash criteria, Tomahawk::InfoSystem::InfoRequestData requestData );
|
||||
|
||||
|
@@ -1,189 +0,0 @@
|
||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||
*
|
||||
* Copyright 2012 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
|
||||
* 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 "DiscogsPlugin.h"
|
||||
|
||||
#include <QNetworkReply>
|
||||
#include <QDomDocument>
|
||||
#include <QtPlugin>
|
||||
|
||||
#include "utils/TomahawkUtils.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "utils/Closure.h"
|
||||
#include <parser.h>
|
||||
|
||||
using namespace Tomahawk::InfoSystem;
|
||||
|
||||
|
||||
DiscogsPlugin::DiscogsPlugin()
|
||||
: InfoPlugin()
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
m_supportedGetTypes << Tomahawk::InfoSystem::InfoAlbumSongs;
|
||||
}
|
||||
|
||||
|
||||
DiscogsPlugin::~DiscogsPlugin() {}
|
||||
|
||||
|
||||
void
|
||||
DiscogsPlugin::getInfo( Tomahawk::InfoSystem::InfoRequestData requestData )
|
||||
{
|
||||
if ( !requestData.input.canConvert< Tomahawk::InfoSystem::InfoStringHash >() )
|
||||
{
|
||||
emit info( requestData, QVariant() );
|
||||
return;
|
||||
}
|
||||
|
||||
InfoStringHash hash = requestData.input.value< Tomahawk::InfoSystem::InfoStringHash >();
|
||||
if ( !hash.contains( "artist" ) || !hash.contains( "album" ) )
|
||||
{
|
||||
emit info( requestData, QVariant() );
|
||||
return;
|
||||
}
|
||||
|
||||
switch ( requestData.type )
|
||||
{
|
||||
case InfoAlbumSongs:
|
||||
{
|
||||
|
||||
Tomahawk::InfoSystem::InfoStringHash criteria;
|
||||
criteria["artist"] = hash["artist"];
|
||||
criteria["album"] = hash["album"];
|
||||
|
||||
emit getCachedInfo( criteria, 2419200000, requestData );
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
Q_ASSERT( false );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DiscogsPlugin::notInCacheSlot( InfoStringHash criteria, InfoRequestData requestData )
|
||||
{
|
||||
switch ( requestData.type )
|
||||
{
|
||||
case InfoAlbumSongs:
|
||||
{
|
||||
QString requestString( "http://api.discogs.com/database/search" );
|
||||
QUrl url( requestString );
|
||||
url.addQueryItem( "type", "release" );
|
||||
url.addQueryItem( "release_title", criteria[ "album" ] );
|
||||
url.addQueryItem( "artist", criteria[ "artist" ] );
|
||||
QNetworkRequest req( url );
|
||||
req.setRawHeader( "User-Agent", "TomahawkPlayer/1.0 +http://tomahawk-player.org" );
|
||||
QNetworkReply* reply = TomahawkUtils::nam()->get( req );
|
||||
|
||||
NewClosure( reply, SIGNAL( finished() ), this, SLOT( albumSearchSlot( Tomahawk::InfoSystem::InfoRequestData, QNetworkReply* ) ), requestData, reply );
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
Q_ASSERT( false );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DiscogsPlugin::albumSearchSlot( const InfoRequestData &requestData, QNetworkReply *reply )
|
||||
{
|
||||
QJson::Parser p;
|
||||
QVariantMap results = p.parse( reply ).toMap();
|
||||
|
||||
if ( !results.contains( "results" ) || results.value( "results" ).toList().isEmpty() )
|
||||
{
|
||||
emit info( requestData, QVariant() );
|
||||
return;
|
||||
}
|
||||
|
||||
const QVariantMap result = results.value( "results" ).toList().first().toMap();
|
||||
if ( !result.contains( "id" ) )
|
||||
{
|
||||
emit info( requestData, QVariant() );
|
||||
return;
|
||||
}
|
||||
|
||||
const int id = result.value( "id" ).toInt();
|
||||
QUrl url( QString( "http://api.discogs.com/release/%1" ).arg( id ) );
|
||||
QNetworkRequest req( url );
|
||||
req.setRawHeader( "User-Agent", "TomahawkPlayer/1.0 +http://tomahawk-player.org" );
|
||||
|
||||
QNetworkReply* reply2 = TomahawkUtils::nam()->get( req );
|
||||
NewClosure( reply2, SIGNAL( finished() ), this, SLOT( albumInfoSlot( Tomahawk::InfoSystem::InfoRequestData, QNetworkReply* ) ), requestData, reply2 );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DiscogsPlugin::albumInfoSlot( const InfoRequestData& requestData, QNetworkReply* reply )
|
||||
{
|
||||
QJson::Parser p;
|
||||
QVariantMap results = p.parse( reply ).toMap();
|
||||
|
||||
if ( !results.contains( "resp" ) )
|
||||
{
|
||||
emit info( requestData, QVariant() );
|
||||
return;
|
||||
}
|
||||
|
||||
const QVariantMap resp = results[ "resp" ].toMap();
|
||||
if ( !resp.contains( "release" ) )
|
||||
{
|
||||
emit info( requestData, QVariant() );
|
||||
return;
|
||||
}
|
||||
|
||||
const QVariantMap release = resp[ "release" ].toMap();
|
||||
if ( !release.contains( "tracklist" ) || release[ "tracklist" ].toList().isEmpty() )
|
||||
{
|
||||
emit info( requestData, QVariant() );
|
||||
return;
|
||||
}
|
||||
|
||||
QStringList trackNameList;
|
||||
foreach ( const QVariant& v, release[ "tracklist" ].toList() )
|
||||
{
|
||||
const QVariantMap track = v.toMap();
|
||||
if ( track.contains( "title" ) )
|
||||
trackNameList << track[ "title" ].toString();
|
||||
}
|
||||
|
||||
QVariantMap returnedData;
|
||||
returnedData["tracks"] = trackNameList;
|
||||
|
||||
emit info( requestData, returnedData );
|
||||
|
||||
Tomahawk::InfoSystem::InfoStringHash criteria;
|
||||
criteria["artist"] = requestData.input.value< Tomahawk::InfoSystem::InfoStringHash>()["artist"];
|
||||
criteria["album"] = requestData.input.value< Tomahawk::InfoSystem::InfoStringHash>()["album"];
|
||||
|
||||
emit updateCache( criteria, 0, requestData.type, returnedData );
|
||||
}
|
||||
|
||||
|
||||
|
||||
Q_EXPORT_PLUGIN2( Tomahawk::InfoSystem::InfoPlugin, Tomahawk::InfoSystem::DiscogsPlugin )
|
@@ -1,63 +0,0 @@
|
||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||
*
|
||||
* Copyright 2012 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
|
||||
* 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 DISCOGS_PLUGIN_H
|
||||
#define DISCOGS_PLUGIN_H
|
||||
|
||||
#include "Typedefs.h"
|
||||
#include "infosystem/InfoSystem.h"
|
||||
#include "infosystem/InfoSystemWorker.h"
|
||||
#include "infoplugins/InfoPluginDllMacro.h"
|
||||
|
||||
class QNetworkReply;
|
||||
|
||||
namespace Tomahawk
|
||||
{
|
||||
|
||||
namespace InfoSystem
|
||||
{
|
||||
|
||||
class INFOPLUGINDLLEXPORT DiscogsPlugin : public InfoPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES( Tomahawk::InfoSystem::InfoPlugin )
|
||||
|
||||
public:
|
||||
DiscogsPlugin();
|
||||
virtual ~DiscogsPlugin();
|
||||
|
||||
protected slots:
|
||||
virtual void init() {}
|
||||
virtual void getInfo( Tomahawk::InfoSystem::InfoRequestData requestData );
|
||||
virtual void notInCacheSlot( InfoStringHash criteria, InfoRequestData requestData );
|
||||
|
||||
virtual void pushInfo( Tomahawk::InfoSystem::InfoPushData ) {}
|
||||
private slots:
|
||||
void albumSearchSlot( const Tomahawk::InfoSystem::InfoRequestData& , QNetworkReply* );
|
||||
void albumInfoSlot( const Tomahawk::InfoSystem::InfoRequestData& , QNetworkReply* );
|
||||
|
||||
private:
|
||||
bool isValidTrackData( Tomahawk::InfoSystem::InfoRequestData requestData );
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Q_DECLARE_METATYPE( QNetworkReply* )
|
||||
#endif
|