1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-09-21 19:31:29 +02:00

Compare commits

..

54 Commits

Author SHA1 Message Date
Hugo Lindström
da54a948a6 Build more dependencies 2019-12-27 06:48:18 +00:00
Hugo Lindström
f69c8bc708 Build QtWebkit and Sparsehash with MXE 2019-12-27 06:43:18 +00:00
Hugo Lindström
5761027839 Remove erroneous escape character 2019-12-26 10:03:18 +08:00
Hugo Lindström
a743058db0 Make build take less than 6 hrs 2019-12-25 11:50:56 +08:00
Hugo Lindström
343bc93f3b Update docker workflow
Use DOCKERHUB_USERNAME when tagging an image
2019-12-24 13:28:12 +08:00
Hugo Lindström
130f4193af Add MXE to Docker, attempt to build using Actions 2019-12-24 13:10:07 +08:00
Hugo Lindström
372ad91db4 Add Docker build and push workflow
Use Github Actions to build and push image
2019-12-24 12:53:37 +08:00
Hugo Lindström
27e8a665cf Remove circleci in favour of Github Actions 2019-12-20 18:44:41 +08:00
Hugo Lindström
fdca99e57d Accept Ipv4 or Ipv6 2019-12-20 18:17:17 +08:00
Hugo Lindström
e3bb74ce25 Merge pull request #666 from tomahawk-player/hugolm84-test-actions
Add Github Action for building on Linux
2019-12-20 18:14:56 +08:00
Hugo Lindström
4aa06f524c Create ccpp.yml
Add a test workflow
2019-12-20 17:44:40 +08:00
Hugo Lindström
8c3dc90f76 Add circleci config 2019-12-14 12:06:25 +08:00
Hugo Lindström
ba5759d453 Add circleci and Docker support 2019-12-14 11:22:14 +08:00
Hugo Lindström
18b42539e4 Add QtWebKit as required dependency for Qt>5.6, fix cmake configuration errors on OSX 2019-12-08 16:03:58 +08:00
Andreas Sturmlechner
299f033ef9 Fix build with <cmake-3.10 2019-02-03 03:35:12 +01:00
Dominik Schmidt
777b312191 Set CMP0075 at top level CMakeLists.txt 2018-10-30 20:19:33 +01:00
Dominik Schmidt
1ab3ed9f93 Switch CMake policy CMP0023 to NEW 2018-10-30 20:15:18 +01:00
Dominik Schmidt
9327204c78 Fix unused variable warning 2018-10-30 19:44:22 +01:00
Dominik Schmidt
60672e2d0c Log QtInfoMsg too 2018-10-30 19:44:00 +01:00
Dominik Schmidt
4375c8e0c4 Get rid of deprecated typedefs (QStyleOptionViewItemV4 and co) 2018-10-30 19:43:38 +01:00
Dominik Schmidt
092313cd7f Mark tomahawk_i18n.qrc as BYPRODUCT to make ninja happy 2018-10-30 19:41:59 +01:00
Dominik Schmidt
783e853c2a Use set_package_properties instead of set_package_info in MacroLogFeature 2018-10-30 19:41:32 +01:00
Dominik Schmidt
368032f399 Remove obsolete FindOggVorbis.cmake 2018-10-30 19:40:28 +01:00
Dominik Schmidt
ec2b9d84eb Explicitly enable the usage of CMAKE_REQUIRED_LIBRARIES for check_cxx_source_compiles 2018-10-30 19:40:12 +01:00
Dominik Schmidt
378f8262cf Rely on CMake to figure out proper compile flags for C++11 2018-10-30 19:39:00 +01:00
Dominik Schmidt
3f012ac9f8 Disable Hatchet plugin as hatchet is dead. 2018-10-30 19:38:36 +01:00
Dominik Schmidt
d7cc6b5719 Let AUTOMOC and AUTOUIC process generated files 2018-10-30 19:38:10 +01:00
Andreas Sturmlechner
d5c8026a9e TomahawkUse.cmake.in code deduplication 2018-10-30 19:36:14 +01:00
Andreas Sturmlechner
0ec2df0ac6 Add missing Qt5 dependencies 2018-10-30 19:36:14 +01:00
Andreas Sturmlechner
84ec28e476 Remove obsolete setup_qt macro 2018-10-30 19:36:14 +01:00
Andreas Sturmlechner
62feb25f5c Remove obsolete qt_add_dbus_adaptor macro 2018-10-30 19:36:14 +01:00
Andreas Sturmlechner
80d2fa48ec Remove obsolete qt_add_dbus_interface macro 2018-10-30 19:36:14 +01:00
Andreas Sturmlechner
4815dd78c1 Remove obsolete qt_add_translation macro 2018-10-30 19:36:14 +01:00
Andreas Sturmlechner
3b1e0b3cf1 Remove obsolete qt_add_resources macro 2018-10-30 19:36:14 +01:00
Andreas Sturmlechner
a563993b71 Remove obsolete qt_wrap_ui macro 2018-10-30 19:36:14 +01:00
Andreas Sturmlechner
57bc920534 Remove obsolete libqnetwm from thirdparty dir 2018-10-30 19:36:14 +01:00
Andreas Sturmlechner
be919f74f9 Remove obsolete Qt5Core_DIR conditionals 2018-10-30 19:36:14 +01:00
Andreas Sturmlechner
bdc3238e6e FindQuaZip.cmake: Make '5' version suffix permanent 2018-10-30 19:36:14 +01:00
Andreas Sturmlechner
333806ef4a Update PACKAGING.md 2018-10-30 19:36:14 +01:00
Andreas Sturmlechner
084084db22 Remove local copy of GNUInstallDirs, use the one from cmake 2018-10-30 19:36:14 +01:00
Andreas Sturmlechner
a6cb6a92e6 Remove obsolete QT_VERSION_CHECKs 2018-10-30 19:36:14 +01:00
Andreas Sturmlechner
2b95da1a32 Remove obsolete FindQJSON.cmake 2018-10-30 19:36:14 +01:00
Andreas Sturmlechner
25da5bdbc5 Remove obsolete FindKDE4Installed.cmake 2018-10-30 19:36:14 +01:00
Andreas Sturmlechner
d7b9c5464d Remove obsolete kde.png from configstorage 2018-10-30 19:36:14 +01:00
Andreas Sturmlechner
d96dc74353 Remove obsolete tomahawk.protocol 2018-10-30 19:36:14 +01:00
Andreas Sturmlechner
73091bec21 Qt4--: Remove any traces of WITH_KDE4, KDE4_FOUND, LEGACY_KDE_INTEGRATION 2018-10-30 19:36:14 +01:00
Andreas Sturmlechner
021223f6cc Qt4--: Drop any traces of BUILD_WITH_QT4 2018-10-30 19:36:14 +01:00
Andreas Sturmlechner
7302047e9a Qt4--: Remove any traces of TOMAHAWK_QT5 2018-10-30 19:36:14 +01:00
Zach Saunders
119a7ebdb8 Change 'noone' to 'no one' in README 2018-10-23 15:18:57 -07:00
Jason Carr
af0cb18972 Use VERSION_LESS instead of STRLESS for Lucene dependency 2018-10-16 17:11:04 +02:00
Andreas Sturmlechner
34c1f88171 Fix build with Qt 5.11_beta3 (dropping qt5_use_modules) 2018-04-22 14:05:43 +02:00
Dominik Schmidt
00f602e102 Fix #619: Correctly detect qt5keychain 2017-08-08 14:34:49 +02:00
Anton Romanov
c838959248 Update readme.md, someone has to say the obvious 2017-05-10 16:33:30 -07:00
Anton Romanov
97a407f837 Set Tomahawk's User-Agent on requests to Musicbrainz 2017-01-30 11:56:14 -08:00
134 changed files with 869 additions and 3029 deletions

16
.github/workflows/ccpp.yml vendored Normal file
View File

@@ -0,0 +1,16 @@
name: C/C++ CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
container:
image: tomahawkmusicplayer/ubuntu:latest
env:
MIX_ENV: test
steps:
- name: Checkout code
uses: actions/checkout@master
- name: Build and test
run: /usr/local/bin/build-and-test.sh

18
.github/workflows/docker.yml vendored Normal file
View File

@@ -0,0 +1,18 @@
name: Docker Image CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Login to DockerHub Registry
run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
- name: Build the Docker image
run: cd Docker && docker build . --file Dockerfile --tag ${{ secrets.DOCKERHUB_USERNAME }}/ubuntu:latest
- name: Push the latest Docker image
run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/ubuntu:latest

View File

@@ -2,10 +2,18 @@ PROJECT( tomahawk )
CMAKE_MINIMUM_REQUIRED( VERSION 2.8.12 ) CMAKE_MINIMUM_REQUIRED( VERSION 2.8.12 )
CMAKE_POLICY(SET CMP0017 NEW) CMAKE_POLICY(SET CMP0017 NEW)
CMAKE_POLICY(SET CMP0022 NEW) CMAKE_POLICY(SET CMP0022 NEW)
IF(POLICY CMP0075)
CMAKE_POLICY(SET CMP0075 NEW)
ENDIF()
# TODO: # TODO:
# Update to NEW and fix things up # Update to NEW and fix things up
CMAKE_POLICY(SET CMP0023 OLD) CMAKE_POLICY(SET CMP0023 NEW)
# Let AUTOMOC and AUTOUIC process generated files
IF(POLICY CMP0071)
CMAKE_POLICY(SET CMP0071 NEW)
ENDIF()
# TODO: # TODO:
# Disable automatic qtmain linking # Disable automatic qtmain linking
@@ -89,8 +97,7 @@ endif()
option(BUILD_GUI "Build Tomahawk with GUI" ON) option(BUILD_GUI "Build Tomahawk with GUI" ON)
option(BUILD_TESTS "Build Tomahawk with unit tests" ${BUILD_NO_RELEASE}) option(BUILD_TESTS "Build Tomahawk with unit tests" ${BUILD_NO_RELEASE})
option(BUILD_TOOLS "Build Tomahawk helper tools" ${BUILD_NO_RELEASE}) option(BUILD_TOOLS "Build Tomahawk helper tools" ${BUILD_NO_RELEASE})
option(BUILD_HATCHET "Build the Hatchet plugin" ON) option(BUILD_HATCHET "Build the Hatchet plugin" OFF)
option(BUILD_WITH_QT4 "Build Tomahawk with Qt4 instead of Qt5" OFF)
if(UNIX AND NOT APPLE) if(UNIX AND NOT APPLE)
set(CRASHREPORTER_ENABLED_BY_DEFAULT OFF) set(CRASHREPORTER_ENABLED_BY_DEFAULT OFF)
@@ -99,8 +106,6 @@ else()
endif() endif()
option(WITH_CRASHREPORTER "Build with CrashReporter" ${CRASHREPORTER_ENABLED_BY_DEFAULT}) option(WITH_CRASHREPORTER "Build with CrashReporter" ${CRASHREPORTER_ENABLED_BY_DEFAULT})
option(WITH_BINARY_ATTICA "Enable support for downloading binary resolvers automatically" 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)
option(WITH_KDE4 "Build with support for KDE specific stuff" ON)
# build options for development purposes # build options for development purposes
option(SANITIZE_ADDRESS "Enable Address Sanitizer for memory error detection" OFF) option(SANITIZE_ADDRESS "Enable Address Sanitizer for memory error detection" OFF)
@@ -161,171 +166,52 @@ INCLUDE( MacroLogFeature )
message( STATUS "Building Tomahawk ${TOMAHAWK_VERSION} ***" ) message( STATUS "Building Tomahawk ${TOMAHAWK_VERSION} ***" )
if( NOT BUILD_WITH_QT4 ) find_package(Qt5Core REQUIRED)
find_package(Qt5Core QUIET) find_package(Qt5Concurrent REQUIRED)
if( Qt5Core_DIR ) find_package(Qt5Gui REQUIRED)
# CMAKE 2.8.13+/3.0.0+ requires these for IMPORTed targets find_package(Qt5Network REQUIRED)
find_package(Qt5Concurrent REQUIRED) find_package(Qt5Sql REQUIRED)
find_package(Qt5Svg REQUIRED) find_package(Qt5Svg REQUIRED)
find_package(Qt5UiTools REQUIRED) find_package(Qt5UiTools REQUIRED)
find_package(Qt5WebKitWidgets REQUIRED) find_package(Qt5WebKitWidgets REQUIRED)
find_package(Qt5Widgets REQUIRED) find_package(Qt5Widgets REQUIRED)
find_package(Qt5Xml REQUIRED) find_package(Qt5Xml REQUIRED)
find_package(Qt5X11Extras NO_MODULE QUIET) find_package(Qt5X11Extras NO_MODULE QUIET)
if(Qt5X11Extras_FOUND) if(Qt5X11Extras_FOUND)
set(HAVE_X11 TRUE) set(HAVE_X11 TRUE)
else()
set(HAVE_X11 FALSE)
endif()
message(STATUS "Found Qt5!")
if( UNIX AND NOT APPLE )
# We need this to find the paths to qdbusxml2cpp and co
find_package(Qt5DBus REQUIRED)
endif()
if(APPLE)
find_package(Qt5MacExtras REQUIRED)
endif()
if(WIN32)
find_package(Qt5WinExtras REQUIRED)
endif()
macro(qt_wrap_ui)
qt5_wrap_ui(${ARGN})
endmacro()
macro(qt_add_resources)
qt5_add_resources(${ARGN})
endmacro()
find_package(Qt5LinguistTools REQUIRED)
macro(qt_add_translation)
qt5_add_translation(${ARGN})
endmacro()
if( UNIX AND NOT APPLE )
macro(qt_add_dbus_interface)
qt5_add_dbus_interface(${ARGN})
endmacro()
macro(qt_add_dbus_adaptor)
qt5_add_dbus_adaptor(${ARGN})
endmacro()
endif()
macro(setup_qt)
endmacro()
set(QT_RCC_EXECUTABLE "${Qt5Core_RCC_EXECUTABLE}")
#FIXME: CrashReporter depends on deprecated QHttp
set(WITH_KDE4 OFF)
endif()
endif()
if( NOT Qt5Core_DIR )
message(STATUS "Could not find Qt5, searching for Qt4 instead...")
if(NOT FORCE_QT4)
message(FATAL_ERROR "Qt4 support is broken, if you plan to fix it, add -DFORCE_QT4=ON to your cmake arguments otherwise you should compile Tomahawk with Qt5")
endif()
set(NEEDED_QT4_COMPONENTS "QtCore" "QtXml" "QtNetwork")
if( BUILD_GUI )
list(APPEND NEEDED_QT4_COMPONENTS "QtGui" "QtWebkit" "QtUiTools" "QtSvg")
endif()
if( BUILD_TESTS )
list(APPEND NEEDED_QT4_COMPONENTS "QtTest")
endif()
macro_optional_find_package(Qt4 4.7.0 COMPONENTS ${NEEDED_QT4_COMPONENTS} )
macro_log_feature(QT4_FOUND "Qt" "A cross-platform application and UI framework" "http://qt-project.org" TRUE "" "If you see this, although libqt4-devel is installed, check whether the \n qtwebkit-devel package and whatever contains QtUiTools is installed too")
macro(qt5_use_modules)
endmacro()
macro(qt_wrap_ui)
qt4_wrap_ui(${ARGN})
endmacro()
macro(qt_add_resources)
qt4_add_resources(${ARGN})
endmacro()
macro(qt_add_translation)
qt4_add_translation(${ARGN})
endmacro()
macro(qt_add_dbus_interface)
qt4_add_dbus_interface(${ARGN})
endmacro()
macro(qt_add_dbus_adaptor)
qt4_add_dbus_adaptor(${ARGN})
endmacro()
macro(setup_qt)
if( NOT BUILD_GUI )
set(QT_DONT_USE_QTGUI TRUE)
endif()
if( UNIX AND NOT APPLE )
set(QT_USE_QTDBUS TRUE)
endif()
set(QT_USE_QTSQL TRUE)
set(QT_USE_QTNETWORK TRUE)
set(QT_USE_QTXML TRUE)
set(QT_USE_QTWEBKIT TRUE)
include( ${QT_USE_FILE} )
endmacro()
# Qt5 C++11 Macros not defined within Qt4
# TODO: Add C++11 support
tomahawk_add_definitions( "-DQ_DECL_FINAL=" )
tomahawk_add_definitions( "-DQ_DECL_OVERRIDE=" )
endif()
if( Qt5Core_DIR )
set( TOMAHAWK_QT5_TMP TRUE)
else( Qt5Core_DIR )
set( TOMAHAWK_QT5_TMP FALSE )
endif( Qt5Core_DIR )
set( TOMAHAWK_QT5 ${TOMAHAWK_QT5_TMP} CACHE BOOL "Build Tomahawk with Qt5")
if( BUILD_GUI AND UNIX AND NOT APPLE )
macro_optional_find_package( X11 )
macro_log_feature(X11_FOUND "X11" "The Xorg libraries" "http://www.x.org/wiki/" TRUE "" "Xorg libraries are used by libqnetwm to bring windows to front reliably")
endif()
include(CheckCXXCompilerFlag)
check_cxx_compiler_flag( "-std=c++11" CXX11_FOUND )
check_cxx_compiler_flag( "-std=c++0x" CXX0X_FOUND )
check_cxx_compiler_flag( "-stdlib=libc++" LIBCPP_FOUND )
if(CXX11_FOUND)
tomahawk_add_cxx_flags( "-std=c++11" )
elseif(CXX0X_FOUND)
tomahawk_add_cxx_flags( "-std=c++0x" )
else() else()
message(STATUS "${CMAKE_CXX_COMPILER} does not support C++11, please use a set(HAVE_X11 FALSE)
different compiler")
endif() endif()
if(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR APPLE) AND LIBCPP_FOUND)
tomahawk_add_cxx_flags( "-stdlib=libc++" ) if( UNIX AND NOT APPLE )
# We need this to find the paths to qdbusxml2cpp and co
find_package(Qt5DBus REQUIRED)
endif() endif()
if(APPLE)
find_package(Qt5MacExtras REQUIRED)
endif()
if(WIN32)
find_package(Qt5WinExtras REQUIRED)
endif()
find_package(Qt5LinguistTools REQUIRED)
set(QT_RCC_EXECUTABLE "${Qt5Core_RCC_EXECUTABLE}")
# FIXME: CrashReporter depends on deprecated QHttp
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
find_package(Boost REQUIRED COMPONENTS filesystem system) find_package(Boost REQUIRED COMPONENTS filesystem system)
macro_log_feature(Boost_FOUND "Boost" "Provides free peer-reviewed portable C++ source libraries" "http://www.boost.org" TRUE "" "") #FIXME: give useful explanation macro_log_feature(Boost_FOUND "Boost" "Provides free peer-reviewed portable C++ source libraries" "http://www.boost.org" TRUE "" "") #FIXME: give useful explanation
macro_optional_find_package(Lucene++ 3.0.0) macro_optional_find_package(Lucene++ 3.0.0)
macro_log_feature(LUCENEPP_FOUND "Lucene++" "The open-source, C++ search engine" "https://github.com/luceneplusplus/LucenePlusPlus/" TRUE "" "Lucene++ is used for indexing the collection") macro_log_feature(LUCENEPP_FOUND "Lucene++" "The open-source, C++ search engine" "https://github.com/luceneplusplus/LucenePlusPlus/" TRUE "" "Lucene++ is used for indexing the collection")
if( NOT TOMAHAWK_QT5 )
macro_optional_find_package(QJSON 0.8.1)
macro_log_feature(QJSON_FOUND "QJson" "Qt library that maps JSON data to QVariant objects" "http://qjson.sf.net" TRUE "" "libqjson is used for encoding communication between Tomahawk instances")
ENDIF()
macro_optional_find_package(Taglib 1.8.0) macro_optional_find_package(Taglib 1.8.0)
macro_log_feature(TAGLIB_FOUND "TagLib" "Audio Meta-Data Library" "http://developer.kde.org/~wheeler/taglib.html" TRUE "" "taglib is needed for reading meta data from audio files") macro_log_feature(TAGLIB_FOUND "TagLib" "Audio Meta-Data Library" "http://developer.kde.org/~wheeler/taglib.html" TRUE "" "taglib is needed for reading meta data from audio files")
include( CheckTagLibFileName ) include( CheckTagLibFileName )
@@ -344,23 +230,15 @@ macro_log_feature(GNUTLS_FOUND "GnuTLS"
"http://gnutls.org/" TRUE "" "http://gnutls.org/" TRUE ""
"GnuTLS is needed for serving the Playdar/HTTP API via TLS") "GnuTLS is needed for serving the Playdar/HTTP API via TLS")
if( TOMAHAWK_QT5 ) macro_optional_find_package(Qca-qt5)
macro_optional_find_package(Qca-qt5) if(Qca-qt5_DIR)
if(Qca-qt5_DIR) set(QCA2_FOUND ON CACHE BOOL "QCA2 was found")
set(QCA2_FOUND ON CACHE BOOL "QCA2 was found") set(QCA2_LIBRARIES "qca-qt5" CACHE STRING "QCA2 Qt5 target")
set(QCA2_LIBRARIES "qca-qt5" CACHE STRING "QCA2 Qt5 target")
endif()
else()
macro_optional_find_package(QCA2)
endif() endif()
macro_log_feature(QCA2_FOUND "QCA2" "Provides encryption and signing functions necessary for some resolvers and accounts" "http://delta.affinix.com/qca/" TRUE "" "") macro_log_feature(QCA2_FOUND "QCA2" "Provides encryption and signing functions necessary for some resolvers and accounts" "http://delta.affinix.com/qca/" TRUE "" "")
if( TOMAHAWK_QT5 ) macro_optional_find_package(KF5Attica 1.0.0)
macro_optional_find_package(KF5Attica 1.0.0) set(LIBATTICA_FOUND ${KF5Attica_FOUND})
set(LIBATTICA_FOUND ${KF5Attica_FOUND})
else()
macro_optional_find_package(LibAttica 0.4.0)
endif()
macro_log_feature(LIBATTICA_FOUND "libattica" "Provides support for installation of resolvers from the Tomahawk website" "http://download.kde.org/stable/attica/" TRUE "" "") macro_log_feature(LIBATTICA_FOUND "libattica" "Provides support for installation of resolvers from the Tomahawk website" "http://download.kde.org/stable/attica/" TRUE "" "")
macro_optional_find_package(QuaZip) macro_optional_find_package(QuaZip)
@@ -376,21 +254,13 @@ macro_optional_find_package(LibLastFm 1.0.0)
macro_log_feature(LIBLASTFM_FOUND "liblastfm" "Qt library for the Last.fm webservices" "https://github.com/lastfm/liblastfm" TRUE "" "liblastfm is needed for scrobbling tracks to Last.fm and fetching cover artwork") macro_log_feature(LIBLASTFM_FOUND "liblastfm" "Qt library for the Last.fm webservices" "https://github.com/lastfm/liblastfm" TRUE "" "liblastfm is needed for scrobbling tracks to Last.fm and fetching cover artwork")
if( NOT APPLE ) if( NOT APPLE )
if( TOMAHAWK_QT5 ) macro_optional_find_package(Qt5Keychain 0.1.0)
macro_optional_find_package(Qt5Keychain 0.1.0) macro_log_feature(Qt5Keychain_FOUND "QtKeychain" "Provides support for secure credentials storage" "https://github.com/frankosterfeld/qtkeychain" TRUE "" "")
else()
macro_optional_find_package(QtKeychain 0.1.0)
endif()
macro_log_feature(QTKEYCHAIN_FOUND "QtKeychain" "Provides support for secure credentials storage" "https://github.com/frankosterfeld/qtkeychain" TRUE "" "")
endif() endif()
if( UNIX AND NOT APPLE ) if( UNIX AND NOT APPLE )
macro_optional_find_package(TelepathyQt 0.9.3) macro_optional_find_package(TelepathyQt 0.9.3)
if ( TOMAHAWK_QT5 ) macro_log_feature(TelepathyQt5_FOUND "Telepathy-Qt" "Telepathy-Qt is a Qt high-level binding for Telepathy, a D-Bus framework for unifying real time communication." FALSE "" "Telepathy-Qt is needed for sharing Jabber/GTalk accounts with Telepathy.\n")
macro_log_feature(TelepathyQt5_FOUND "Telepathy-Qt" "Telepathy-Qt is a Qt high-level binding for Telepathy, a D-Bus framework for unifying real time communication." FALSE "" "Telepathy-Qt is needed for sharing Jabber/GTalk accounts with Telepathy.\n")
else ( TOMAHAWK_QT5)
macro_log_feature(TelepathyQt4_FOUND "Telepathy-Qt" "Telepathy-Qt is a Qt high-level binding for Telepathy, a D-Bus framework for unifying real time communication." FALSE "" "Telepathy-Qt is needed for sharing Jabber/GTalk accounts with Telepathy.\n")
endif()
endif() endif()
# we need pthreads too # we need pthreads too
@@ -435,23 +305,7 @@ add_subdirectory(${THIRDPARTY_DIR}/libportfwd)
#### submodules end #### submodules end
SET( CLEAN_C_FLAGS ${CMAKE_C_FLAGS} )
if (WITH_KDE4)
macro_optional_find_package(KDE4)
macro_optional_find_package(KDE4Installed)
endif(WITH_KDE4)
macro_log_feature(KDE4_FOUND "KDE4" "Provides support for configuring Telepathy Accounts from inside Tomahawk" "https://www.kde.org" FALSE "" "")
IF( KDE4_FOUND )
IF( CMAKE_C_FLAGS )
# KDE4 adds and removes some compiler flags that we don't like
# (only for gcc not for clang e.g.)
STRING( REPLACE "-std=iso9899:1990" "" CLEAN_C_FLAGS ${CMAKE_C_FLAGS} )
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions" )
ENDIF()
ELSE()
SET( CLEAN_C_FLAGS ${CMAKE_C_FLAGS} )
ENDIF()
#show dep log #show dep log
macro_display_feature_log() macro_display_feature_log()
@@ -464,11 +318,6 @@ CONFIGURE_FILE(
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY) IMMEDIATE @ONLY)
# KDE4 defines an uninstall target for us automatically (and at least with Qt4 Phonon does as well no matter if kdelibs was found)
# IF( NOT KDE4_FOUND )
# ADD_CUSTOM_TARGET(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
# ENDIF()
IF( ( NOT APPLE ) AND ( NOT SANITIZE_ADDRESS )) IF( ( NOT APPLE ) AND ( NOT SANITIZE_ADDRESS ))
# Make linking as strict on linux as it is on osx. Then we don't break linking on mac so often # Make linking as strict on linux as it is on osx. Then we don't break linking on mac so often
# #
@@ -498,6 +347,7 @@ ADD_SUBDIRECTORY( src )
ADD_SUBDIRECTORY( admin ) ADD_SUBDIRECTORY( admin )
IF(BUILD_TESTS) IF(BUILD_TESTS)
find_package(Qt5Test REQUIRED)
enable_testing() enable_testing()
ADD_SUBDIRECTORY( src/tests ) ADD_SUBDIRECTORY( src/tests )
ENDIF() ENDIF()

View File

@@ -6,31 +6,22 @@
# LIBJREEN_FOUND, whether libjreen was found # LIBJREEN_FOUND, whether libjreen was found
FIND_PACKAGE(PkgConfig QUIET) FIND_PACKAGE(PkgConfig QUIET)
if( TOMAHAWK_QT5 ) PKG_CHECK_MODULES(PC_JREEN QUIET libjreen-qt5)
set(JREEN_LIB_SUFFIX "-qt5")
set(JREEN_INCLUDE_SUFFIX ${JREEN_LIB_SUFFIX})
else()
set(JREEN_INCLUDE_SUFFIX "-qt4")
endif()
PKG_CHECK_MODULES(PC_JREEN QUIET libjreen${JREEN_LIB_SUFFIX})
FIND_PATH(JREEN_INCLUDE_DIR NAMES jreen/jreen.h FIND_PATH(JREEN_INCLUDE_DIR NAMES jreen/jreen.h
HINTS HINTS
${PC_JREEN_INCLUDEDIR} ${PC_JREEN_INCLUDEDIR}
${PC_JREEN_INCLUDE_DIRS} ${PC_JREEN_INCLUDE_DIRS}
${CMAKE_INSTALL_INCLUDEDIR} ${CMAKE_INSTALL_INCLUDEDIR}
${KDE4_INCLUDE_DIR}
PATH_SUFFIXES PATH_SUFFIXES
jreen${JREEN_INCLUDE_SUFFIX} jreen-qt5
) )
FIND_LIBRARY(JREEN_LIBRARIES NAMES jreen${JREEN_LIB_SUFFIX} FIND_LIBRARY(JREEN_LIBRARIES NAMES jreen-qt5
HINTS HINTS
${PC_JREEN_LIBDIR} ${PC_JREEN_LIBDIR}
${PC_JREEN_LIBRARY_DIRS} ${PC_JREEN_LIBRARY_DIRS}
${CMAKE_INSTALL_LIBDIR} ${CMAKE_INSTALL_LIBDIR}
${KDE4_LIB_DIR}
) )
IF(JREEN_LIBRARIES AND JREEN_INCLUDE_DIR AND NOT PC_JREEN_VERSION) IF(JREEN_LIBRARIES AND JREEN_INCLUDE_DIR AND NOT PC_JREEN_VERSION)

View File

@@ -1,20 +0,0 @@
# Simple hack to detect wether KDE4 is *installed* -- not anything about the development environment!
FILE(TO_CMAKE_PATH "$ENV{KDEDIRS}" _KDEDIRS)
# For KDE4 kde-config has been renamed to kde4-config
FIND_PROGRAM(KDE4_KDECONFIG_EXECUTABLE NAMES kde4-config
# the suffix must be used since KDEDIRS can be a list of directories which don't have bin/ appended
PATH_SUFFIXES bin
HINTS
${CMAKE_INSTALL_PREFIX}
${_KDEDIRS}
/opt/kde4
ONLY_CMAKE_FIND_ROOT_PATH
)
IF (KDE4_KDECONFIG_EXECUTABLE)
SET (KDE4_INSTALLED TRUE)
message(STATUS "KDE4 is installed, will install protocol file")
ENDIF (KDE4_KDECONFIG_EXECUTABLE)

View File

@@ -7,21 +7,15 @@
# (c) Dominik Schmidt <dev@dominik-schmidt.de> # (c) Dominik Schmidt <dev@dominik-schmidt.de>
# #
if( TOMAHAWK_QT5 )
set(LASTFM_LIB_SUFFIX "5")
endif()
# Include dir # Include dir
find_path(LIBLASTFM_INCLUDE_DIR find_path(LIBLASTFM_INCLUDE_DIR
# Track.h doesn't exist in liblastfm-0.3.1, was called Track back then # Track.h doesn't exist in liblastfm-0.3.1, was called Track back then
NAMES lastfm${LASTFM_LIB_SUFFIX}/Track.h NAMES lastfm5/Track.h
PATHS ${KDE4_INCLUDE_DIR}
) )
# Finally the library itself # Finally the library itself
find_library(LIBLASTFM_LIBRARY find_library(LIBLASTFM_LIBRARY
NAMES lastfm${LASTFM_LIB_SUFFIX} NAMES lastfm5
PATHS ${KDE4_LIB_DIR}
) )
set(LIBLASTFM_LIBRARIES ${LIBLASTFM_LIBRARY}) set(LIBLASTFM_LIBRARIES ${LIBLASTFM_LIBRARY})

View File

@@ -74,10 +74,10 @@ FIND_PATH(LUCENEPP_LIBRARY_DIR
IF (LUCENEPP_LIBRARY_DIR) IF (LUCENEPP_LIBRARY_DIR)
MESSAGE(STATUS "Found Lucene++ library dir: ${LUCENEPP_LIBRARY_DIR}") MESSAGE(STATUS "Found Lucene++ library dir: ${LUCENEPP_LIBRARY_DIR}")
IF (LUCENEPP_VERSION STRLESS "${LUCENEPP_MIN_VERSION}") IF (LUCENEPP_VERSION VERSION_LESS "${LUCENEPP_MIN_VERSION}")
MESSAGE(ERROR " Lucene++ version ${LUCENEPP_VERSION} is less than the required minimum ${LUCENEPP_MIN_VERSION}") MESSAGE(ERROR " Lucene++ version ${LUCENEPP_VERSION} is less than the required minimum ${LUCENEPP_MIN_VERSION}")
SET(LUCENEPP_GOOD_VERSION FALSE) SET(LUCENEPP_GOOD_VERSION FALSE)
ENDIF (LUCENEPP_VERSION STRLESS "${LUCENEPP_MIN_VERSION}") ENDIF (LUCENEPP_VERSION VERSION_LESS "${LUCENEPP_MIN_VERSION}")
ENDIF (LUCENEPP_LIBRARY_DIR) ENDIF (LUCENEPP_LIBRARY_DIR)
IF(LUCENEPP_INCLUDE_DIR AND LUCENEPP_LIBRARIES AND LUCENEPP_LIBRARY_DIR AND LUCENEPP_GOOD_VERSION) IF(LUCENEPP_INCLUDE_DIR AND LUCENEPP_LIBRARIES AND LUCENEPP_LIBRARY_DIR AND LUCENEPP_GOOD_VERSION)

View File

@@ -1,89 +0,0 @@
# - Try to find the OggVorbis libraries
# Once done this will define
#
# OGGVORBIS_FOUND - system has OggVorbis
# OGGVORBIS_VERSION - set either to 1 or 2
# OGGVORBIS_INCLUDE_DIR - the OggVorbis include directory
# OGGVORBIS_LIBRARIES - The libraries needed to use OggVorbis
# OGG_LIBRARY - The Ogg library
# VORBIS_LIBRARY - The Vorbis library
# VORBISFILE_LIBRARY - The VorbisFile library
# VORBISENC_LIBRARY - The VorbisEnc library
# Copyright (c) 2006, Richard Laerkaeng, <richard@goteborg.utfors.se>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
include (CheckLibraryExists)
find_path(VORBIS_INCLUDE_DIR vorbis/vorbisfile.h)
find_path(OGG_INCLUDE_DIR ogg/ogg.h)
find_library(OGG_LIBRARY NAMES ogg)
find_library(VORBIS_LIBRARY NAMES vorbis)
find_library(VORBISFILE_LIBRARY NAMES vorbisfile)
find_library(VORBISENC_LIBRARY NAMES vorbisenc)
mark_as_advanced(VORBIS_INCLUDE_DIR OGG_INCLUDE_DIR
OGG_LIBRARY VORBIS_LIBRARY VORBISFILE_LIBRARY VORBISENC_LIBRARY)
if (VORBIS_INCLUDE_DIR AND VORBIS_LIBRARY AND VORBISFILE_LIBRARY AND VORBISENC_LIBRARY)
set(OGGVORBIS_FOUND TRUE)
set(OGGVORBIS_LIBRARIES ${OGG_LIBRARY} ${VORBIS_LIBRARY} ${VORBISFILE_LIBRARY} ${VORBISENC_LIBRARY})
set(_CMAKE_REQUIRED_LIBRARIES_TMP ${CMAKE_REQUIRED_LIBRARIES})
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${OGGVORBIS_LIBRARIES})
check_library_exists(vorbis vorbis_bitrate_addblock "" HAVE_LIBVORBISENC2)
set(CMAKE_REQUIRED_LIBRARIES ${_CMAKE_REQUIRED_LIBRARIES_TMP})
if (HAVE_LIBVORBISENC2)
set (OGGVORBIS_VERSION 2)
else (HAVE_LIBVORBISENC2)
set (OGGVORBIS_VERSION 1)
endif (HAVE_LIBVORBISENC2)
else (VORBIS_INCLUDE_DIR AND VORBIS_LIBRARY AND VORBISFILE_LIBRARY AND VORBISENC_LIBRARY)
set (OGGVORBIS_VERSION)
set(OGGVORBIS_FOUND FALSE)
endif (VORBIS_INCLUDE_DIR AND VORBIS_LIBRARY AND VORBISFILE_LIBRARY AND VORBISENC_LIBRARY)
if (OGGVORBIS_FOUND)
if (NOT OggVorbis_FIND_QUIETLY)
message(STATUS "Found OggVorbis: ${OGGVORBIS_LIBRARIES}")
endif (NOT OggVorbis_FIND_QUIETLY)
else (OGGVORBIS_FOUND)
if (OggVorbis_FIND_REQUIRED)
message(FATAL_ERROR "Could NOT find OggVorbis libraries")
endif (OggVorbis_FIND_REQUIRED)
if (NOT OggVorbis_FIND_QUITELY)
message(STATUS "Could NOT find OggVorbis libraries")
endif (NOT OggVorbis_FIND_QUITELY)
endif (OGGVORBIS_FOUND)
#check_include_files(vorbis/vorbisfile.h HAVE_VORBISFILE_H)
#check_library_exists(ogg ogg_page_version "" HAVE_LIBOGG)
#check_library_exists(vorbis vorbis_info_init "" HAVE_LIBVORBIS)
#check_library_exists(vorbisfile ov_open "" HAVE_LIBVORBISFILE)
#check_library_exists(vorbisenc vorbis_info_clear "" HAVE_LIBVORBISENC)
#check_library_exists(vorbis vorbis_bitrate_addblock "" HAVE_LIBVORBISENC2)
#if (HAVE_LIBOGG AND HAVE_VORBISFILE_H AND HAVE_LIBVORBIS AND HAVE_LIBVORBISFILE AND HAVE_LIBVORBISENC)
# message(STATUS "Ogg/Vorbis found")
# set (VORBIS_LIBS "-lvorbis -logg")
# set (VORBISFILE_LIBS "-lvorbisfile")
# set (VORBISENC_LIBS "-lvorbisenc")
# set (OGGVORBIS_FOUND TRUE)
# if (HAVE_LIBVORBISENC2)
# set (HAVE_VORBIS 2)
# else (HAVE_LIBVORBISENC2)
# set (HAVE_VORBIS 1)
# endif (HAVE_LIBVORBISENC2)
#else (HAVE_LIBOGG AND HAVE_VORBISFILE_H AND HAVE_LIBVORBIS AND HAVE_LIBVORBISFILE AND HAVE_LIBVORBISENC)
# message(STATUS "Ogg/Vorbis not found")
#endif (HAVE_LIBOGG AND HAVE_VORBISFILE_H AND HAVE_LIBVORBIS AND HAVE_LIBVORBISFILE AND HAVE_LIBVORBISENC)

View File

@@ -1,29 +0,0 @@
# Find QJSON - JSON handling library for Qt
#
# This module defines
# QJSON_FOUND - whether the qsjon library was found
# QJSON_LIBRARIES - the qjson library
# QJSON_INCLUDE_DIR - the include path of the qjson library
#
find_library (QJSON_LIBRARIES
NAMES
qjson
PATHS
${QJSON_LIBRARY_DIRS}
${LIB_INSTALL_DIR}
${KDE4_LIB_DIR}
)
find_path (QJSON_INCLUDE_DIR
NAMES
qjson/parser.h
PATHS
${QJSON_INCLUDE_DIRS}
${INCLUDE_INSTALL_DIR}
${KDE4_INCLUDE_DIR}
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(QJSON DEFAULT_MSG QJSON_LIBRARIES QJSON_INCLUDE_DIR)

View File

@@ -5,22 +5,12 @@
# QTSPARKLE_LIBRARY, the path to qtsparkle # QTSPARKLE_LIBRARY, the path to qtsparkle
# QTSPARKLE_FOUND, whether qtsparkle was found # QTSPARKLE_FOUND, whether qtsparkle was found
if( TOMAHAWK_QT5 ) FIND_PATH(QTSPARKLE_INCLUDE_DIR NAMES qtsparkle-qt5/Updater
set(QTSPARKLE_SUFFIX "-qt5") HINTS ${CMAKE_INSTALL_INCLUDEDIR}
else()
set(QTSPARKLE_SUFFIX "")
endif()
FIND_PATH(QTSPARKLE_INCLUDE_DIR NAMES qtsparkle${QTSPARKLE_SUFFIX}/Updater
HINTS
${CMAKE_INSTALL_INCLUDEDIR}
${KDE4_INCLUDE_DIR}
) )
FIND_LIBRARY(QTSPARKLE_LIBRARIES NAMES qtsparkle${QTSPARKLE_SUFFIX} FIND_LIBRARY(QTSPARKLE_LIBRARIES NAMES qtsparkle-qt5
HINTS HINTS ${CMAKE_INSTALL_LIBDIR}
${CMAKE_INSTALL_LIBDIR}
${KDE4_LIB_DIR}
) )
INCLUDE(FindPackageHandleStandardArgs) INCLUDE(FindPackageHandleStandardArgs)

View File

@@ -9,18 +9,15 @@ IF (QUAZIP_INCLUDE_DIRS AND QUAZIP_LIBRARIES)
# in cache already # in cache already
SET(QUAZIP_FOUND TRUE) SET(QUAZIP_FOUND TRUE)
ELSE (QUAZIP_INCLUDE_DIRS AND QUAZIP_LIBRARIES) ELSE (QUAZIP_INCLUDE_DIRS AND QUAZIP_LIBRARIES)
IF (Qt5Core_FOUND)
set(QUAZIP_LIB_VERSION_SUFFIX 5)
ENDIF()
IF (WIN32) IF (WIN32)
FIND_PATH(QUAZIP_LIBRARY_DIR FIND_PATH(QUAZIP_LIBRARY_DIR
WIN32_DEBUG_POSTFIX d WIN32_DEBUG_POSTFIX d
NAMES libquazip${QUAZIP_LIB_VERSION_SUFFIX}.dll NAMES libquazip5.dll
HINTS "C:/Programme/" "C:/Program Files" HINTS "C:/Programme/" "C:/Program Files"
PATH_SUFFIXES QuaZip/lib PATH_SUFFIXES QuaZip/lib
) )
FIND_LIBRARY(QUAZIP_LIBRARIES NAMES libquazip${QUAZIP_LIB_VERSION_SUFFIX}.dll HINTS ${QUAZIP_LIBRARY_DIR}) FIND_LIBRARY(QUAZIP_LIBRARIES NAMES libquazip5.dll HINTS ${QUAZIP_LIBRARY_DIR})
FIND_PATH(QUAZIP_INCLUDE_DIR NAMES quazip.h HINTS ${QUAZIP_LIBRARY_DIR}/../ PATH_SUFFIXES include/quazip${QUAZIP_LIB_VERSION_SUFFIX}) FIND_PATH(QUAZIP_INCLUDE_DIR NAMES quazip.h HINTS ${QUAZIP_LIBRARY_DIR}/../ PATH_SUFFIXES include/quazip5)
FIND_PATH(QUAZIP_ZLIB_INCLUDE_DIR NAMES zlib.h) FIND_PATH(QUAZIP_ZLIB_INCLUDE_DIR NAMES zlib.h)
ELSE(WIN32) ELSE(WIN32)
FIND_PACKAGE(PkgConfig) FIND_PACKAGE(PkgConfig)
@@ -28,12 +25,12 @@ ELSE (QUAZIP_INCLUDE_DIRS AND QUAZIP_LIBRARIES)
pkg_check_modules(PC_QUAZIP quazip) pkg_check_modules(PC_QUAZIP quazip)
FIND_LIBRARY(QUAZIP_LIBRARIES FIND_LIBRARY(QUAZIP_LIBRARIES
WIN32_DEBUG_POSTFIX d WIN32_DEBUG_POSTFIX d
NAMES quazip${QUAZIP_LIB_VERSION_SUFFIX} NAMES quazip5
HINTS /usr/lib /usr/lib64 HINTS /usr/lib /usr/lib64
) )
FIND_PATH(QUAZIP_INCLUDE_DIR quazip.h FIND_PATH(QUAZIP_INCLUDE_DIR quazip.h
HINTS /usr/include /usr/local/include HINTS /usr/include /usr/local/include
PATH_SUFFIXES quazip${QUAZIP_LIB_VERSION_SUFFIX} PATH_SUFFIXES quazip5
) )
FIND_PATH(QUAZIP_ZLIB_INCLUDE_DIR zlib.h HINTS /usr/include /usr/local/include) FIND_PATH(QUAZIP_ZLIB_INCLUDE_DIR zlib.h HINTS /usr/include /usr/local/include)
ENDIF (WIN32) ENDIF (WIN32)

View File

@@ -61,7 +61,6 @@ ELSE()
tag.h tag.h
PATH_SUFFIXES taglib PATH_SUFFIXES taglib
PATHS PATHS
${KDE4_INCLUDE_DIR}
${INCLUDE_INSTALL_DIR} ${INCLUDE_INSTALL_DIR}
) )
@@ -69,7 +68,6 @@ ELSE()
WIN32_DEBUG_POSTFIX d WIN32_DEBUG_POSTFIX d
NAMES tag NAMES tag
PATHS PATHS
${KDE4_LIB_DIR}
${LIB_INSTALL_DIR} ${LIB_INSTALL_DIR}
) )

View File

@@ -2,25 +2,14 @@
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
if( NOT BUILD_WITH_QT4 ) find_package(TelepathyQt5 NO_MODULE)
find_package(TelepathyQt5 NO_MODULE) set(TelepathyQt_FOUND ${TelepathyQt5_FOUND})
set(TelepathyQt_FOUND ${TelepathyQt5_FOUND}) set(TELEPATHY_QT_VERSION ${TELEPATHY_QT5_VERSION})
set(TELEPATHY_QT_VERSION ${TELEPATHY_QT5_VERSION}) set(TELEPATHY_QT_INSTALL_DIR ${TELEPATHY_QT5_INSTALL_DIR})
set(TELEPATHY_QT_INSTALL_DIR ${TELEPATHY_QT5_INSTALL_DIR}) set(TELEPATHY_QT_INCLUDE_DIR ${TELEPATHY_QT5_INCLUDE_DIR})
set(TELEPATHY_QT_INCLUDE_DIR ${TELEPATHY_QT5_INCLUDE_DIR}) set(TELEPATHY_QT_LIB_DIR ${TELEPATHY_QT5_LIB_DIR})
set(TELEPATHY_QT_LIB_DIR ${TELEPATHY_QT5_LIB_DIR}) set(TELEPATHY_QT_SHARE_DIR ${TELEPATHY_QT5_SHARE_DIR})
set(TELEPATHY_QT_SHARE_DIR ${TELEPATHY_QT5_SHARE_DIR}) set(TELEPATHY_QT_LIBRARIES ${TELEPATHY_QT5_LIBRARIES})
set(TELEPATHY_QT_LIBRARIES ${TELEPATHY_QT5_LIBRARIES})
else()
find_package(TelepathyQt4 NO_MODULE)
set(TelepathyQt_FOUND ${TelepathyQt4_FOUND})
set(TELEPATHY_QT_VERSION ${TELEPATHY_QT4_VERSION})
set(TELEPATHY_QT_INSTALL_DIR ${TELEPATHY_QT4_INSTALL_DIR})
set(TELEPATHY_QT_INCLUDE_DIR ${TELEPATHY_QT4_INCLUDE_DIR})
set(TELEPATHY_QT_LIB_DIR ${TELEPATHY_QT4_LIB_DIR})
set(TELEPATHY_QT_SHARE_DIR ${TELEPATHY_QT4_SHARE_DIR})
set(TELEPATHY_QT_LIBRARIES ${TELEPATHY_QT4_LIBRARIES})
endif()
set(TELEPATHY_QT_FOUND ${TelepathyQt_FOUND}) set(TELEPATHY_QT_FOUND ${TelepathyQt_FOUND})

View File

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

View File

@@ -93,7 +93,7 @@ MACRO(MACRO_LOG_FEATURE _var _package _description _url ) # _required _minvers _
FILE(APPEND "${_LOGFILENAME}" "${_logtext}\n") FILE(APPEND "${_LOGFILENAME}" "${_logtext}\n")
IF(COMMAND SET_PACKAGE_INFO) # in FeatureSummary.cmake since CMake 2.8.3 IF(COMMAND SET_PACKAGE_INFO) # in FeatureSummary.cmake since CMake 2.8.3
SET_PACKAGE_INFO("${_package}" "\"${_description}\"" "${_url}" "\"${_comments}\"") SET_PACKAGE_PROPERTIES("${_package}" PROPERTIES DESCRIPTION "\"${_description}\"" URL "${_url}" PURPOSE "\"${_comments}\"")
ENDIF(COMMAND SET_PACKAGE_INFO) ENDIF(COMMAND SET_PACKAGE_INFO)
ENDMACRO(MACRO_LOG_FEATURE) ENDMACRO(MACRO_LOG_FEATURE)

2
Docker/Docker.variables Normal file
View File

@@ -0,0 +1,2 @@
DOCKER_IMAGE_NAME=tomahawkmusicplayer/ubuntu
DOCKER_IMAGE_VER=latest

274
Docker/Dockerfile Normal file
View File

@@ -0,0 +1,274 @@
FROM ubuntu:19.04 as base
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
ninja-build \
openssh-client \
curl \
gnupg2 \
gosu \
wget \
locales \
git \
subversion \
make \
pkg-config \
unzip \
xz-utils \
software-properties-common \
sudo \
apt-utils \
&& rm -rf /var/lib/apt/lists/*
# LLVM/Clang
ENV CLANG_VERSION=9
RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - \
&& apt-add-repository "deb http://apt.llvm.org/disco/ llvm-toolchain-disco-$CLANG_VERSION main" \
&& apt-get update && apt-get install -y \
clang-$CLANG_VERSION \
clang-tidy-$CLANG_VERSION \
clang-format-$CLANG_VERSION \
llvm-$CLANG_VERSION-dev \
libclang-$CLANG_VERSION-dev \
&& update-alternatives \
--install /usr/bin/clang clang /usr/bin/clang-$CLANG_VERSION 100 \
--slave /usr/bin/clang++ clang++ /usr/bin/clang++-$CLANG_VERSION \
--slave /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-$CLANG_VERSION \
--slave /usr/bin/clang-format clang-format /usr/bin/clang-format-$CLANG_VERSION
# GCC
ENV GCC_VERSION=9
RUN sudo apt-get update \
&& sudo apt-get install -y --no-install-recommends \
g++-$GCC_VERSION \
gcc-$GCC_VERSION \
&& sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 100 --slave /usr/bin/g++ g++ /usr/bin/g++-9 --slave /usr/bin/gcov gcov /usr/bin/gcov-9
# Tomahawk deps
RUN sudo apt-get update \
&& apt-get install -y --no-install-recommends \
cmake \
libattica-dev \
libboost-dev \
libboost-filesystem-dev \
libboost-iostreams-dev \
libboost-thread-dev \
libfftw3-dev \
libgnutls28-dev \
libgsasl7-dev \
liblastfm-dev \
liblastfm5-dev \
liblucene++-dev \
libphonon-dev \
libphononexperimental-dev \
libqca-qt5-2-dev \
libqca2-dev \
libqca2-plugins \
libqjson-dev \
libqt5svg5-dev \
libqt5webkit5-dev \
libqt5webkit5\
libsamplerate0-dev \
libsparsehash-dev \
libssl-dev \
libtelepathy-qt5-dev \
libvlc-dev \
libvlccore-dev \
libx11-dev \
libz-dev \
qt5-default \
qtbase5-dev \
qttools5-dev \
qttools5-dev-tools \
zlib1g-dev \
&& rm -rf /var/lib/apt/lists/*
RUN git clone --depth 1 https://github.com/zaphoyd/websocketpp.git --branch master --single-branch websocketpp \
&& mkdir websocketpp/build && cd websocketpp/build \
&& cmake .. \
&& sudo cmake --build . -j 16 --target install \
&& cd ../.. \
&& rm -r websocketpp
RUN git clone --depth 1 https://github.com/frankosterfeld/qtkeychain.git --branch master --single-branch qtkeychain \
&& mkdir qtkeychain/build && cd qtkeychain/build \
&& cmake .. \
&& sudo cmake --build . -j 16 --target install \
&& cd ../.. \
&& rm -r qtkeychain
RUN git clone --depth 1 https://github.com/taglib/taglib.git --branch master --single-branch taglib \
&& mkdir taglib/build && cd taglib/build \
&& cmake -DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=ON .. \
&& sudo cmake --build . -j 16 --target install \
&& cd ../.. \
&& rm -r taglib
RUN git clone --depth 1 https://anongit.kde.org/extra-cmake-modules.git --branch master --single-branch ecm \
&& mkdir ecm/build && cd ecm/build \
&& cmake -DCMAKE_BUILD_TYPE=Release .. \
&& sudo cmake --build . -j 16 --target install \
&& cd ../.. \
&& rm -r ecm
RUN git clone --depth 1 https://github.com/KDE/attica.git --branch master --single-branch attica \
&& mkdir attica/build && cd attica/build \
&& cmake -DCMAKE_BUILD_TYPE=Release .. \
&& sudo cmake --build . -j 16 --target install \
&& cd ../.. \
&& rm -r attica
RUN git clone --depth 1 https://github.com/stachenov/quazip.git --branch master --single-branch quazip \
&& mkdir quazip/build && cd quazip/build \
&& cmake -DCMAKE_BUILD_TYPE=Release .. \
&& sudo cmake --build . -j 16 --target install \
&& cd ../.. \
&& rm -r quazip
RUN git clone --depth 1 https://github.com/euroelessar/jreen.git --branch master --single-branch jreen \
&& mkdir jreen/build && cd jreen/build \
&& cmake -DCMAKE_BUILD_TYPE=Release .. \
&& sudo cmake --build . -j 16 --target install \
&& cd ../.. \
&& rm -r jreen
# MXE deps
RUN sudo apt-get update \
&& apt-get install -y --no-install-recommends \
autoconf \
automake \
autopoint \
bash \
bison \
bzip2 \
flex \
g++ \
g++-multilib \
gettext \
git \
gperf \
intltool \
libc6-dev-i386 \
libgdk-pixbuf2.0-dev \
libltdl-dev \
libssl-dev \
libtool-bin \
libxml-parser-perl \
lzip \
make \
openssl \
p7zip-full \
patch \
perl \
pkg-config \
python \
ruby \
sed \
unzip \
wget \
xz-utils \
&& rm -rf /var/lib/apt/lists/*
RUN git clone --depth 1 https://github.com/mxe/mxe.git --branch master --single-branch mxe \
&& sudo mv mxe /opt/mxe
ENV MXE_PATH=/opt/mxe
ENV MXE_TOOLCHAIN="i686-w64-mingw32.shared"
ENV MXE_CMAKE=i686-w64-mingw32.shared-cmake
ENV MXE_PLUGINS=/opt/mxe/plugins/gcc9
RUN cd $MXE_PATH \
&& sudo make MXE_TARGETS=$MXE_TOOLCHAIN MXE_PLUGIN_DIRS=$MXE_PLUGINS \
qt5
RUN cd $MXE_PATH \
&& sudo make MXE_TARGETS=$MXE_TOOLCHAIN MXE_PLUGIN_DIRS=$MXE_PLUGINS \
qttools
RUN cd $MXE_PATH \
&& sudo make MXE_TARGETS=$MXE_TOOLCHAIN MXE_PLUGIN_DIRS=$MXE_PLUGINS \
boost
RUN cd $MXE_PATH \
&& sudo make MXE_TARGETS=$MXE_TOOLCHAIN MXE_PLUGIN_DIRS=$MXE_PLUGINS \
cc \
qca \
qtsparkle \
nsis \
liblastfm \
libgsasl
RUN cd $MXE_PATH \
&& sudo make MXE_TARGETS=$MXE_TOOLCHAIN MXE_PLUGIN_DIRS=$MXE_PLUGINS \
qtwebkit \
sparsehash
ENV PATH=/opt/mxe/usr/bin:$PATH
RUN sudo chmod -R 777 /opt/mxe/.ccache
RUN git clone --depth 1 https://anongit.kde.org/extra-cmake-modules.git --branch master --single-branch ecm \
&& mkdir ecm/build && cd ecm/build \
&& $MXE_CMAKE -DCMAKE_BUILD_TYPE=Release .. \
&& $MXE_CMAKE --build . -j 16 --target install \
&& cd ../.. \
&& rm -r ecm
RUN git clone --depth 1 https://github.com/zaphoyd/websocketpp.git --branch master --single-branch websocketpp \
&& mkdir websocketpp/build && cd websocketpp/build \
&& $MXE_CMAKE .. \
&& $MXE_CMAKE --build . -j 16 --target install \
&& cd ../.. \
&& rm -r websocketpp
RUN git clone --depth 1 https://github.com/frankosterfeld/qtkeychain.git --branch master --single-branch qtkeychain \
&& mkdir qtkeychain/build && cd qtkeychain/build \
&& $MXE_CMAKE .. \
&& $MXE_CMAKE --build . -j 16 --target install \
&& cd ../.. \
&& rm -r qtkeychain
RUN git clone --depth 1 https://github.com/taglib/taglib.git --branch master --single-branch taglib \
&& mkdir taglib/build && cd taglib/build \
&& $MXE_CMAKE -DCMAKE_INSTALL_PREFIX=/opt/mxe/usr \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=ON .. \
&& $MXE_CMAKE --build . -j 16 --target install \
&& cd ../.. \
&& rm -r taglib
RUN git clone --depth 1 https://github.com/KDE/attica.git --branch master --single-branch attica \
&& mkdir attica/build && cd attica/build \
&& $MXE_CMAKE -DCMAKE_BUILD_TYPE=Release .. \
&& $MXE_CMAKE --build . -j 16 --target install \
&& cd ../.. \
&& rm -r attica
RUN git clone --depth 1 https://github.com/stachenov/quazip.git --branch master --single-branch quazip \
&& mkdir quazip/build && cd quazip/build \
&& $MXE_CMAKE -DCMAKE_BUILD_TYPE=Release .. \
&& $MXE_CMAKE --build . -j 16 --target install \
&& cd ../.. \
&& rm -r quazip
#RUN git clone --depth 1 https://github.com/euroelessar/jreen.git --branch master --single-branch jreen \
# && mkdir jreen/build && cd jreen/build \
# && $MXE_CMAKE -DCMAKE_BUILD_TYPE=Release .. \
# && $MXE_CMAKE -build . -j 16 --target install \
# && cd ../.. \
# && rm -r jreen
# Language
ENV LANG=en_US.UTF-8
RUN echo "$LANG UTF-8" > /etc/locale.gen && locale-gen $LANG && update-locale LANG=$LANG
#entrypoint, if it is last here makes it easy to build new image without rebuilding all layers
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
COPY build-and-test.sh /usr/local/bin/build-and-test.sh
RUN chmod +x /usr/local/bin/build-and-test.sh
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
WORKDIR /tmp/workspace

8
Docker/build-and-test.sh Executable file
View File

@@ -0,0 +1,8 @@
#!/bin/bash
mkdir build
cd build
cmake -G Ninja -DCMAKE_BUILD_TYPE=${BUILD_TYPE:-Debug} ..
ninja
ninja install
env CTEST_OUTPUT_ON_FAILURE=1 ninja test

79
Docker/docker-commands.sh Executable file
View File

@@ -0,0 +1,79 @@
#!/bin/bash
get_repository_root(){
local REPOSITORY_ROOT="$(git rev-parse --show-toplevel)"
echo "$REPOSITORY_ROOT"
}
get_repository_subdir(){
REPOSITORY_ROOT=$(get_repository_root)
CUR_DIR=$(pwd)
SUB_DIR=$(echo "$CUR_DIR" | grep -oP "^$REPOSITORY_ROOT\K.*")
echo "$SUB_DIR"
}
# Run commands inside docker container
_docker_run() {
REPOSITORY_ROOT=$(get_repository_root)
SUB_DIR=$(get_repository_subdir)
echo "SUB_DIR: " "$SUB_DIR"
source $REPOSITORY_ROOT/Docker/Docker.variables
echo "Starting container: " "$DOCKER_IMAGE_NAME:$DOCKER_IMAGE_VER"
echo "Got command: " "$*"
USER_ID=$(id -u $USER)
echo "Using USER_ID:" $USER_ID
docker run --env LOCAL_USER_ID=$USER_ID \
--rm \
--volume $REPOSITORY_ROOT:/tmp/workspace \
--workdir /tmp/workspace$SUB_DIR \
--env "TERM=xterm-256color" \
--tty \
--privileged \
"$DOCKER_IMAGE_NAME:$DOCKER_IMAGE_VER" \
$*
}
# 1st command: Run make target inside docker
docker-make() {
_docker_run make "${@}"
}
# 2nd command: Run bash command inside docker
docker-run() {
_docker_run "${@}"
}
# 3rd command: Run bash interactive inside docker
docker-interactive() {
REPOSITORY_ROOT=$(get_repository_root)
SUB_DIR=$(get_repository_subdir)
echo "SUB_DIR: " "$SUB_DIR"
source $REPOSITORY_ROOT/Docker/Docker.variables
echo "Starting container: " "$DOCKER_IMAGE_NAME:$DOCKER_IMAGE_VER"
echo "Got command: " "$*"
USER_ID=$(id -u $USER)
echo "Using USER_ID:" $USER_ID
docker run --env LOCAL_USER_ID=$USER_ID \
--rm \
--interactive \
--volume $REPOSITORY_ROOT:/tmp/workspace \
--workdir /tmp/workspace$SUB_DIR \
--env "TERM=xterm-256color" \
--tty \
"$DOCKER_IMAGE_NAME:$DOCKER_IMAGE_VER" /bin/bash
}
docker-help() {
echo "docker-make - Run a make target inside docker container"
echo "docker-run - Run a specific bash command inside docker container and remove container on exit"
echo "docker-interactive - Start an interactive bash session inside docker container and remove it on exit"
echo "docker-help - Show this help text"
}

32
Docker/entrypoint.sh Executable file
View File

@@ -0,0 +1,32 @@
#!/bin/bash
# Add local user
# Either use the LOCAL_USER_ID if passed in at runtime or
# fallback
USER_ID=${LOCAL_USER_ID:-9001}
USER=docker
UPWD=Docker!
echo "Starting with USER: $USER and UID : $USER_ID"
useradd --shell /bin/bash -u $USER_ID -o -c "docker user" -m "$USER"
export HOME=/home/$USER
# Add user to sudoers
echo "docker ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/10-installer
# Add root password
echo "root":$UPWD | chpasswd
# Add user password
echo "$USER:$UPWD" | chpasswd
if [ -z "$CLANG_VERSION" ]; then
echo "No CLANG_VERSION set"
else
echo "alias clang=clang-$CLANG_VERSION" >> $HOME/.bashrc
echo "alias clang-tidy=clang-tidy-$CLANG_VERSION" >> $HOME/.bashrc
echo "alias clang-format=clang-format-$CLANG_VERSION" >> $HOME/.bashrc
fi
export PATH=/opt/mxe/usr/bin:$PATH
# Startup user
exec gosu "$USER" "$@"

View File

@@ -39,18 +39,10 @@ Tomahawk provides some tools that help highlight where crashes (of course we onl
Build the account plugin for Hatchet (http://hatchet.is). Requires [websocketpp](https://github.com/zaphoyd/websocketpp). Build the account plugin for Hatchet (http://hatchet.is). Requires [websocketpp](https://github.com/zaphoyd/websocketpp).
##### ```BUILD_WITH_QT4``` (boolean) (default: ON)
This enforces CMake to link against Qt4 regardless of whether Qt5 was found or not. Currently Qt4 is still our main development target, so this is still recommended. If you feel adventurous or are preparing Qt5 repositories for your distribution, feel free to give ```-DBUILD_WITH_QT4=OFF``` a shot.
##### ```WITH_CRASHREPORTER``` (boolean) (default: ON) ##### ```WITH_CRASHREPORTER``` (boolean) (default: ON)
The crash reporter is built by default if libcrashreporter-qt is available in ```thirdparty/libcrashreporter-qt/``` (for example via git submodule). Usually distributions don't allow packagers to upload debug symbols to the Tomahawk HQ so to give crash reports more meaning for us, that's why we have no standardised submit process in place yet. If you can do that in your distribution, please get in touch with us! The crash reporter is built by default if libcrashreporter-qt is available in ```thirdparty/libcrashreporter-qt/``` (for example via git submodule). Usually distributions don't allow packagers to upload debug symbols to the Tomahawk HQ so to give crash reports more meaning for us, that's why we have no standardised submit process in place yet. If you can do that in your distribution, please get in touch with us!
##### ```WITH_KDE``` (boolean) (default: ON)
The KDE Telepathy plugin to configure Telepathy accounts from our Telepathy plugin can be disabled, if for some reason KDE is available in your build environment but you don't need this plugin.
##### ```WITH_UPOWER``` (boolean) (default on Linux: ON) ##### ```WITH_UPOWER``` (boolean) (default on Linux: ON)
Build with support for UPower events. Build with support for UPower events.

View File

@@ -1,3 +1,7 @@
# This project is essentially abandoned
There is no one working on it.
There isn't much sense in adding any new issues in the issue tracker unless you want to fix them yourself.
# WHAT TOMAHAWK IS # WHAT TOMAHAWK IS
Tomahawk is a free multi-source and cross-platform music player. An application that can play not only your local files, but also stream from services like Spotify, Beats, SoundCloud, Google Music, YouTube and many others. You can even connect with your friends' Tomahawks, share your musical gems or listen along with them. Let the music play! Tomahawk is a free multi-source and cross-platform music player. An application that can play not only your local files, but also stream from services like Spotify, Beats, SoundCloud, Google Music, YouTube and many others. You can even connect with your friends' Tomahawks, share your musical gems or listen along with them. Let the music play!
@@ -73,7 +77,7 @@ You can download one of our nightly or stable builds:
Required dependencies: Required dependencies:
* [CMake 3](http://www.cmake.org/) * [CMake 3](http://www.cmake.org/)
* [Qt 5.4.0](http://qt-project.org/) * [Qt >= 5.4.0](http://qt-project.org/)
* [VLC 2.1.0](https://videolan.org/vlc/) * [VLC 2.1.0](https://videolan.org/vlc/)
* [SQLite 3.6.22](http://www.sqlite.org/) * [SQLite 3.6.22](http://www.sqlite.org/)
* [TagLib 1.8](https://taglib.github.io/) * [TagLib 1.8](https://taglib.github.io/)
@@ -86,6 +90,10 @@ Required dependencies:
* [Sparsehash](https://code.google.com/p/sparsehash/) * [Sparsehash](https://code.google.com/p/sparsehash/)
* [GnuTLS](http://gnutls.org/) * [GnuTLS](http://gnutls.org/)
If you are using Qt>5.6 you need to build and install QtWebKit
* [QtWebKit](https://github.com/qt/qtwebkit)
The following dependencies are optional (but *recommended*): The following dependencies are optional (but *recommended*):
* [Jreen 1.1.1](http://qutim.org/jreen/) * [Jreen 1.1.1](http://qutim.org/jreen/)

View File

@@ -25,13 +25,13 @@ function(tomahawk_add_library)
include_directories(${CMAKE_CURRENT_BINARY_DIR}) include_directories(${CMAKE_CURRENT_BINARY_DIR})
if(LIBRARY_UI) if(LIBRARY_UI)
qt_wrap_ui(LIBRARY_UI_SOURCES ${LIBRARY_UI}) qt5_wrap_ui(LIBRARY_UI_SOURCES ${LIBRARY_UI})
list(APPEND LIBRARY_SOURCES ${LIBRARY_UI_SOURCES}) list(APPEND LIBRARY_SOURCES ${LIBRARY_UI_SOURCES})
endif() endif()
# add resources from current dir # add resources from current dir
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/resources.qrc") if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/resources.qrc")
qt_add_resources(LIBRARY_RC_SOURCES "resources.qrc") qt5_add_resources(LIBRARY_RC_SOURCES "resources.qrc")
list(APPEND LIBRARY_SOURCES ${LIBRARY_RC_SOURCES}) list(APPEND LIBRARY_SOURCES ${LIBRARY_RC_SOURCES})
unset(LIBRARY_RC_SOURCES) unset(LIBRARY_RC_SOURCES)
endif() endif()
@@ -45,9 +45,6 @@ function(tomahawk_add_library)
add_library(${target} SHARED ${LIBRARY_SOURCES}) add_library(${target} SHARED ${LIBRARY_SOURCES})
endif() endif()
# HACK: add qt modules - every lib should define its own set of modules
qt5_use_modules(${target} Core Network Widgets Sql Xml ${LIBRARY_QT5_MODULES})
# definitions - can this be moved into set_target_properties below? # definitions - can this be moved into set_target_properties below?
add_definitions(${QT_DEFINITIONS}) add_definitions(${QT_DEFINITIONS})
set_target_properties(${target} PROPERTIES AUTOMOC TRUE) set_target_properties(${target} PROPERTIES AUTOMOC TRUE)
@@ -70,12 +67,12 @@ function(tomahawk_add_library)
endif() endif()
# add link targets # add link targets
target_link_libraries(${target} ${TOMAHAWK_LIBRARIES}) target_link_libraries(${target} PRIVATE ${TOMAHAWK_LIBRARIES})
if(LIBRARY_LINK_LIBRARIES) if(LIBRARY_LINK_LIBRARIES)
target_link_libraries(${target} ${LIBRARY_LINK_LIBRARIES}) target_link_libraries(${target} PUBLIC ${LIBRARY_LINK_LIBRARIES})
endif() endif()
if(LIBRARY_LINK_PRIVATE_LIBRARIES) if(LIBRARY_LINK_PRIVATE_LIBRARIES)
target_link_libraries(${target} LINK_PRIVATE ${LIBRARY_LINK_PRIVATE_LIBRARIES}) target_link_libraries(${target} PRIVATE ${LIBRARY_LINK_PRIVATE_LIBRARIES})
endif() endif()
# add soversion # add soversion

View File

@@ -1,103 +1,3 @@
#FIXME: this duplicates top level cmakelists: how can we reduce code duplication?
set( TOMAHAWK_QT5 @TOMAHAWK_QT5@ )
if(TOMAHAWK_QT5)
# CMAKE 2.8.13+/3.0.0+ requires these for IMPORTed targets
find_package(Qt5Core REQUIRED)
find_package(Qt5Concurrent REQUIRED)
find_package(Qt5Svg REQUIRED)
find_package(Qt5UiTools REQUIRED)
find_package(Qt5WebKitWidgets REQUIRED)
find_package(Qt5Widgets REQUIRED)
find_package(Qt5Xml REQUIRED)
find_package(Qt5Sql REQUIRED)
macro(qt_wrap_ui)
qt5_wrap_ui(${ARGN})
endmacro()
macro(qt_add_resources)
qt5_add_resources(${ARGN})
endmacro()
find_package(Qt5LinguistTools REQUIRED)
macro(qt_add_translation)
qt5_add_translation(${ARGN})
endmacro()
if( UNIX AND NOT APPLE )
# We need this to find the paths to qdbusxml2cpp and co
find_package(Qt5DBus REQUIRED)
endif()
if(APPLE)
find_package(Qt5MacExtras REQUIRED)
endif()
if(WIN32)
find_package(Qt5WinExtras REQUIRED)
endif()
macro(qt_wrap_ui)
qt5_wrap_ui(${ARGN})
endmacro()
macro(qt_add_resources)
qt5_add_resources(${ARGN})
endmacro()
find_package(Qt5LinguistTools REQUIRED)
macro(qt_add_translation)
qt5_add_translation(${ARGN})
endmacro()
if( UNIX AND NOT APPLE )
macro(qt_add_dbus_interface)
qt5_add_dbus_interface(${ARGN})
endmacro()
macro(qt_add_dbus_adaptor)
qt5_add_dbus_adaptor(${ARGN})
endmacro()
endif()
macro(setup_qt)
endmacro()
set(QT_RCC_EXECUTABLE "${Qt5Core_RCC_EXECUTABLE}")
#FIXME: CrashReporter depends on deprecated QHttp
set(WITH_KDE4 OFF)
else(TOMAHAWK_QT5)
find_package(Qt4 COMPONENTS QtNetwork QtCore QtGui QtSql REQUIRED)
include( ${QT_USE_FILE} )
set(NEEDED_QT4_COMPONENTS "QtCore" "QtXml" "QtNetwork")
if(BUILD_GUI OR NOT DEFINED BUILD_GUI)
list(APPEND NEEDED_QT4_COMPONENTS "QtGui" "QtWebkit" "QtUiTools" "QtSvg")
endif()
find_package(Qt4 4.7.0 COMPONENTS ${NEEDED_QT4_COMPONENTS})
include( ${QT_USE_FILE} )
macro(qt5_use_modules)
endmacro()
macro(qt_wrap_ui)
qt4_wrap_ui(${ARGN})
endmacro()
macro(qt_add_resources)
qt4_add_resources(${ARGN})
endmacro()
macro(qt_add_translation)
qt4_add_translation(${ARGN})
endmacro()
endif(TOMAHAWK_QT5)
if(NOT TOMAHAWK_CMAKE_DIR) if(NOT TOMAHAWK_CMAKE_DIR)
set(TOMAHAWK_CMAKE_DIR ${CMAKE_CURRENT_LIST_DIR}) set(TOMAHAWK_CMAKE_DIR ${CMAKE_CURRENT_LIST_DIR})
endif() endif()

View File

@@ -1,12 +0,0 @@
[Protocol]
exec=/path/to/binary "%u"
protocol=tomahawk
input=none
output=none
helper=true
listing=
reading=false
writing=false
makedir=false
deleting=false

View File

@@ -19,9 +19,11 @@ macro(add_tomahawk_translations language)
set( tomahawk_i18n_qrc_content "${tomahawk_i18n_qrc_content}</qresource>\n" ) set( tomahawk_i18n_qrc_content "${tomahawk_i18n_qrc_content}</qresource>\n" )
set( tomahawk_i18n_qrc_content "${tomahawk_i18n_qrc_content}</RCC>\n" ) set( tomahawk_i18n_qrc_content "${tomahawk_i18n_qrc_content}</RCC>\n" )
file( WRITE ${CMAKE_BINARY_DIR}/lang/tomahawk_i18n.qrc "${tomahawk_i18n_qrc_content}" ) # Write file and configure it aferwards to make it a BYPRODUCT: https://gitlab.kitware.com/cmake/cmake/issues/16367
file( WRITE ${CMAKE_BINARY_DIR}/lang/tomahawk_i18n.qrc.in "${tomahawk_i18n_qrc_content}" )
configure_file(${CMAKE_BINARY_DIR}/lang/tomahawk_i18n.qrc.in ${CMAKE_BINARY_DIR}/lang/tomahawk_i18n.qrc COPYONLY)
qt_add_translation(QM_FILES ${TS_FILES}) qt5_add_translation(QM_FILES ${TS_FILES})
## HACK HACK HACK - around rcc limitations to allow out of source-tree building ## HACK HACK HACK - around rcc limitations to allow out of source-tree building
set( trans_file tomahawk_i18n ) set( trans_file tomahawk_i18n )

View File

@@ -1,7 +1,5 @@
include( ${PROJECT_BINARY_DIR}/TomahawkUse.cmake ) include( ${PROJECT_BINARY_DIR}/TomahawkUse.cmake )
setup_qt()
include_directories( ${CMAKE_CURRENT_BINARY_DIR}/libtomahawk ) include_directories( ${CMAKE_CURRENT_BINARY_DIR}/libtomahawk )
include_directories( ${CMAKE_CURRENT_LIST_DIR}/libtomahawk ) include_directories( ${CMAKE_CURRENT_LIST_DIR}/libtomahawk )

View File

@@ -25,11 +25,6 @@
#include "utils/Logger.h" #include "utils/Logger.h"
#include "TomahawkSettings.h" #include "TomahawkSettings.h"
// Forward Declarations breaking QSharedPointer
#if QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 )
#include "Source.h"
#endif
// remove now playing status after PAUSE_TIMEOUT seconds // remove now playing status after PAUSE_TIMEOUT seconds
static const int PAUSE_TIMEOUT = 10; static const int PAUSE_TIMEOUT = 10;

View File

@@ -66,29 +66,6 @@ using namespace Accounts;
#define TOMAHAWK_CAP_NODE_NAME QLatin1String( "http://tomahawk-player.org/" ) #define TOMAHAWK_CAP_NODE_NAME QLatin1String( "http://tomahawk-player.org/" )
#if QT_VERSION <= QT_VERSION_CHECK( 5, 0, 0 )
void
JreenMessageHandler( QtMsgType type, const char *msg )
{
switch ( type )
{
case QtDebugMsg:
tDebug( LOGTHIRDPARTY ).nospace() << JREEN_LOG_INFIX << ":" << "Debug:" << msg;
break;
case QtWarningMsg:
tDebug( LOGTHIRDPARTY ).nospace() << JREEN_LOG_INFIX << ":" << "Warning:" << msg;
break;
case QtCriticalMsg:
tDebug( LOGTHIRDPARTY ).nospace() << JREEN_LOG_INFIX << ":" << "Critical:" << msg;
break;
case QtFatalMsg:
tDebug( LOGTHIRDPARTY ).nospace() << JREEN_LOG_INFIX << ":" << "Fatal:" << msg;
abort();
}
}
#endif
XmppSipPlugin::XmppSipPlugin( Account* account ) XmppSipPlugin::XmppSipPlugin( Account* account )
: SipPlugin( account ) : SipPlugin( account )
, m_state( Account::Disconnected ) , m_state( Account::Disconnected )
@@ -96,9 +73,6 @@ XmppSipPlugin::XmppSipPlugin( Account* account )
, m_xmlConsole( nullptr ) , m_xmlConsole( nullptr )
, m_pubSubManager( nullptr ) , m_pubSubManager( nullptr )
{ {
#if QT_VERSION <= QT_VERSION_CHECK( 5, 0, 0 )
Jreen::Logger::addHandler( JreenMessageHandler );
#endif
m_currentUsername = readUsername(); m_currentUsername = readUsername();
m_currentServer = readServer(); m_currentServer = readServer();

View File

@@ -3,13 +3,11 @@ cmake_policy(SET CMP0017 NEW)
set(TOMAHAWK_CRASH_REPORTER_TARGET ${TOMAHAWK_BASE_TARGET_NAME}_crash_reporter) set(TOMAHAWK_CRASH_REPORTER_TARGET ${TOMAHAWK_BASE_TARGET_NAME}_crash_reporter)
setup_qt()
list(APPEND crashreporter_SOURCES main.cpp) list(APPEND crashreporter_SOURCES main.cpp)
list(APPEND crashreporter_RC resources.qrc) list(APPEND crashreporter_RC resources.qrc)
qt_wrap_ui( crashreporter_UI_HEADERS ${crashreporter_UI} ) qt5_wrap_ui( crashreporter_UI_HEADERS ${crashreporter_UI} )
qt_add_resources( crashreporter_RC_RCC ${crashreporter_RC} ) qt5_add_resources( crashreporter_RC_RCC ${crashreporter_RC} )
if(BUILD_RELEASE) if(BUILD_RELEASE)
@@ -43,7 +41,7 @@ target_link_libraries( ${TOMAHAWK_CRASH_REPORTER_TARGET}
${QT_LIBRARIES} ${QT_LIBRARIES}
) )
target_link_libraries(${TOMAHAWK_CRASH_REPORTER_TARGET} Qt5::Widgets Qt5::Network)
set_target_properties(${TOMAHAWK_CRASH_REPORTER_TARGET} PROPERTIES AUTOMOC ON) set_target_properties(${TOMAHAWK_CRASH_REPORTER_TARGET} PROPERTIES AUTOMOC ON)
install(TARGETS ${TOMAHAWK_CRASH_REPORTER_TARGET} RUNTIME DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}) install(TARGETS ${TOMAHAWK_CRASH_REPORTER_TARGET} RUNTIME DESTINATION ${CMAKE_INSTALL_LIBEXECDIR})
qt5_use_modules(${TOMAHAWK_CRASH_REPORTER_TARGET} Widgets Network)

View File

@@ -23,11 +23,7 @@
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/NetworkAccessManager.h" #include "utils/NetworkAccessManager.h"
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
#include <echonest5/ArtistTypes.h> #include <echonest5/ArtistTypes.h>
#else
#include <echonest/ArtistTypes.h>
#endif
#include <QNetworkConfiguration> #include <QNetworkConfiguration>

View File

@@ -25,11 +25,7 @@
#include "infosystem/InfoSystem.h" #include "infosystem/InfoSystem.h"
#include "infosystem/InfoSystemWorker.h" #include "infosystem/InfoSystemWorker.h"
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
#include <echonest5/Artist.h> #include <echonest5/Artist.h>
#else
#include <echonest/Artist.h>
#endif
#include <QObject> #include <QObject>

View File

@@ -22,6 +22,7 @@
#include "utils/TomahawkUtils.h" #include "utils/TomahawkUtils.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/NetworkAccessManager.h" #include "utils/NetworkAccessManager.h"
#include "TomahawkVersion.h"
#include <QNetworkReply> #include <QNetworkReply>
#include <QDomDocument> #include <QDomDocument>
@@ -88,6 +89,16 @@ MusicBrainzPlugin::getInfo( Tomahawk::InfoSystem::InfoRequestData requestData )
} }
} }
QNetworkReply*
MusicBrainzPlugin::getUrl(QUrl url, QVariant requestData)
{
QNetworkRequest request = QNetworkRequest( url );
QByteArray userAgent = TomahawkUtils::userAgentString( TOMAHAWK_APPLICATION_NAME, TOMAHAWK_VERSION ).toUtf8();
request.setRawHeader( "User-Agent", userAgent );
QNetworkReply* reply = Tomahawk::Utils::nam()->get( request );
reply->setProperty( "requestData", requestData );
return reply;
}
void void
MusicBrainzPlugin::notInCacheSlot( InfoStringHash criteria, InfoRequestData requestData ) MusicBrainzPlugin::notInCacheSlot( InfoStringHash criteria, InfoRequestData requestData )
@@ -111,8 +122,7 @@ MusicBrainzPlugin::notInCacheSlot( InfoStringHash criteria, InfoRequestData requ
TomahawkUtils::urlAddQueryItem( url, "limit", "100" ); TomahawkUtils::urlAddQueryItem( url, "limit", "100" );
tDebug() << Q_FUNC_INFO << url.toString(); tDebug() << Q_FUNC_INFO << url.toString();
QNetworkReply* reply = Tomahawk::Utils::nam()->get( QNetworkRequest( url ) ); QNetworkReply* reply = getUrl( url, QVariant::fromValue< Tomahawk::InfoSystem::InfoRequestData >( requestData ) );
reply->setProperty( "requestData", QVariant::fromValue< Tomahawk::InfoSystem::InfoRequestData >( requestData ) );
connect( reply, SIGNAL( finished() ), SLOT( gotReleaseGroupsSlot() ) ); connect( reply, SIGNAL( finished() ), SLOT( gotReleaseGroupsSlot() ) );
@@ -131,8 +141,7 @@ MusicBrainzPlugin::notInCacheSlot( InfoStringHash criteria, InfoRequestData requ
TomahawkUtils::urlAddQueryItem( url, "limit", "100" ); TomahawkUtils::urlAddQueryItem( url, "limit", "100" );
tDebug() << Q_FUNC_INFO << url.toString(); tDebug() << Q_FUNC_INFO << url.toString();
QNetworkReply* reply = Tomahawk::Utils::nam()->get( QNetworkRequest( url ) ); QNetworkReply* reply = getUrl( url, QVariant::fromValue< Tomahawk::InfoSystem::InfoRequestData >( requestData ) );
reply->setProperty( "requestData", QVariant::fromValue< Tomahawk::InfoSystem::InfoRequestData >( requestData ) );
connect( reply, SIGNAL( finished() ), SLOT( gotReleasesSlot() ) ); connect( reply, SIGNAL( finished() ), SLOT( gotReleasesSlot() ) );
@@ -154,6 +163,7 @@ MusicBrainzPlugin::gotReleaseGroupsSlot()
if ( !oldReply ) if ( !oldReply )
return; //timeout will handle it return; //timeout will handle it
oldReply->deleteLater(); oldReply->deleteLater();
tDebug() << Q_FUNC_INFO << "HTTP response code:" << oldReply->attribute( QNetworkRequest::HttpStatusCodeAttribute ).toInt();
QDomDocument doc; QDomDocument doc;
doc.setContent( oldReply->readAll() ); doc.setContent( oldReply->readAll() );
@@ -237,8 +247,7 @@ MusicBrainzPlugin::gotReleasesSlot()
TomahawkUtils::urlAddQueryItem( url, "inc", "recordings" ); TomahawkUtils::urlAddQueryItem( url, "inc", "recordings" );
tDebug() << Q_FUNC_INFO << url.toString(); tDebug() << Q_FUNC_INFO << url.toString();
QNetworkReply* newReply = Tomahawk::Utils::nam()->get( QNetworkRequest( url ) ); QNetworkReply* newReply = getUrl( url, oldReply->property( "requestData" ) );
newReply->setProperty( "requestData", oldReply->property( "requestData" ) );
connect( newReply, SIGNAL( finished() ), SLOT( gotRecordingsSlot() ) ); connect( newReply, SIGNAL( finished() ), SLOT( gotRecordingsSlot() ) );
break; break;
@@ -261,6 +270,8 @@ MusicBrainzPlugin::gotRecordingsSlot()
return; //timeout will handle it return; //timeout will handle it
reply->deleteLater(); reply->deleteLater();
tDebug() << Q_FUNC_INFO << "HTTP response code:" << reply->attribute( QNetworkRequest::HttpStatusCodeAttribute ).toInt();
QDomDocument doc; QDomDocument doc;
doc.setContent( reply->readAll() ); doc.setContent( reply->readAll() );
QDomNodeList mediumList = doc.elementsByTagName( "medium-list" ); QDomNodeList mediumList = doc.elementsByTagName( "medium-list" );

View File

@@ -59,6 +59,7 @@ private slots:
void gotReleaseGroupsSlot(); void gotReleaseGroupsSlot();
void gotReleasesSlot(); void gotReleasesSlot();
void gotRecordingsSlot(); void gotRecordingsSlot();
QNetworkReply* getUrl( QUrl url, QVariant requestData );
}; };
} }

View File

@@ -2,13 +2,14 @@ SET(fdo_srcs
fdonotify/FdoNotifyPlugin.cpp fdonotify/FdoNotifyPlugin.cpp
fdonotify/ImageConverter.cpp fdonotify/ImageConverter.cpp
) )
SET(FDO_LINK_LIBRARIES ${LINK_LIBRARIES}) SET(FDO_LINK_LIBRARIES ${LINK_LIBRARIES} Qt5::DBus)
qt_add_dbus_interface(fdo_srcs fdonotify/org.freedesktop.Notifications.xml qt5_add_dbus_interface(fdo_srcs fdonotify/org.freedesktop.Notifications.xml
FreedesktopNotificationsProxy) FreedesktopNotificationsProxy)
tomahawk_add_plugin(fdonotify tomahawk_add_plugin(fdonotify
TYPE infoplugin EXPORT_MACRO INFOPLUGINDLLEXPORT_PRO TYPE infoplugin EXPORT_MACRO INFOPLUGINDLLEXPORT_PRO
SOURCES "${fdo_srcs}" LINK_LIBRARIES "${FDO_LINK_LIBRARIES}" SOURCES "${fdo_srcs}"
LINK_LIBRARIES "${FDO_LINK_LIBRARIES}"
) )
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR} ) INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR} )
@@ -16,9 +17,9 @@ SET(mpris_srcs
mpris/MprisPlugin.cpp mpris/MprisPlugin.cpp
) )
qt_add_dbus_adaptor(mpris_srcs mpris/MprisPluginRootAdaptor.xml qt5_add_dbus_adaptor(mpris_srcs mpris/MprisPluginRootAdaptor.xml
mpris/MprisPlugin.h Tomahawk::InfoSystem::MprisPlugin MprisPluginRootAdaptor MprisPluginRootAdaptor) mpris/MprisPlugin.h Tomahawk::InfoSystem::MprisPlugin MprisPluginRootAdaptor MprisPluginRootAdaptor)
qt_add_dbus_adaptor(mpris_srcs mpris/MprisPluginPlayerAdaptor.xml qt5_add_dbus_adaptor(mpris_srcs mpris/MprisPluginPlayerAdaptor.xml
mpris/MprisPlugin.h Tomahawk::InfoSystem::MprisPlugin MprisPluginPlayerAdaptor MprisPluginPlayerAdaptor) mpris/MprisPlugin.h Tomahawk::InfoSystem::MprisPlugin MprisPluginPlayerAdaptor MprisPluginPlayerAdaptor)
tomahawk_add_plugin(mpris tomahawk_add_plugin(mpris

View File

@@ -55,11 +55,6 @@
#include <QDBusPendingCallWatcher> #include <QDBusPendingCallWatcher>
#include <QImage> #include <QImage>
#if QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 )
// QTextDocument provides Qt::escape()
#include <QTextDocument>
#endif
namespace Tomahawk namespace Tomahawk
{ {
@@ -67,11 +62,7 @@ namespace InfoSystem
{ {
QString escapeHtml( const QString& str ) { QString escapeHtml( const QString& str ) {
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
return str.toHtmlEscaped(); return str.toHtmlEscaped();
#else
return Qt::escape( str );
#endif
} }
FdoNotifyPlugin::FdoNotifyPlugin() FdoNotifyPlugin::FdoNotifyPlugin()

View File

@@ -27,12 +27,6 @@
#include "../../InfoPluginDllMacro.h" #include "../../InfoPluginDllMacro.h"
// Forward Declarations breaking QSharedPointer
#if QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 )
#include "PlaylistInterface.h"
#endif
#include <QObject> #include <QObject>
#include <QVariant> #include <QVariant>
#include <QtDBus/QtDBus> #include <QtDBus/QtDBus>

View File

@@ -64,7 +64,7 @@ PlaylistDelegate::PlaylistDelegate()
void void
PlaylistDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const PlaylistDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const
{ {
QStyleOptionViewItemV4 opt = option; QStyleOptionViewItem opt = option;
initStyleOption( &opt, QModelIndex() ); initStyleOption( &opt, QModelIndex() );
qApp->style()->drawControl( QStyle::CE_ItemViewItem, &opt, painter ); qApp->style()->drawControl( QStyle::CE_ItemViewItem, &opt, painter );

View File

@@ -30,11 +30,6 @@
#include <QCoreApplication> #include <QCoreApplication>
// Forward Declarations breaking QSharedPointer
#if QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 )
#include "Query.h"
#endif
ActionCollection* ActionCollection::s_instance = 0; ActionCollection* ActionCollection::s_instance = 0;
ActionCollection* ActionCollection::instance() ActionCollection* ActionCollection::instance()

View File

@@ -25,11 +25,6 @@
#include <QPixmap> #include <QPixmap>
#include <QFuture> #include <QFuture>
// Forward Declarations breaking QSharedPointer
#if QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 )
#include "collection/Collection.h"
#endif
#include "infosystem/InfoSystem.h" #include "infosystem/InfoSystem.h"
#include "DllMacro.h" #include "DllMacro.h"
#include "Typedefs.h" #include "Typedefs.h"

View File

@@ -173,14 +173,6 @@ if(QCA2_FOUND)
set( libGuiSources ${libGuiSources} utils/GroovesharkParser.cpp ) set( libGuiSources ${libGuiSources} utils/GroovesharkParser.cpp )
endif() endif()
if(UNIX AND NOT APPLE AND NOT Qt5Core_DIR)
if(BUILD_GUI AND X11_FOUND)
include_directories( ${THIRDPARTY_DIR}/libqnetwm )
list(APPEND libSources ${libSources} ${THIRDPARTY_DIR}/libqnetwm/libqnetwm/netwm.cpp)
list(APPEND LINK_LIBRARIES ${X11_LIBRARIES})
endif()
endif()
list(APPEND libSources list(APPEND libSources
TomahawkSettings.cpp TomahawkSettings.cpp
SourceList.cpp SourceList.cpp
@@ -422,9 +414,7 @@ IF(LIBATTICA_FOUND)
SET( libGuiSources ${libGuiSources} AtticaManager.cpp ) SET( libGuiSources ${libGuiSources} AtticaManager.cpp )
INCLUDE_DIRECTORIES( ${LIBATTICA_INCLUDE_DIR} ) INCLUDE_DIRECTORIES( ${LIBATTICA_INCLUDE_DIR} )
LIST(APPEND PRIVATE_LINK_LIBRARIES ${LIBATTICA_LIBRARIES} ${LibAttica_LIBRARIES} ${QUAZIP_LIBRARIES}) LIST(APPEND PRIVATE_LINK_LIBRARIES ${LIBATTICA_LIBRARIES} ${LibAttica_LIBRARIES} ${QUAZIP_LIBRARIES})
IF( TOMAHAWK_QT5 ) LIST(APPEND LINK_LIBRARIES KF5::Attica)
LIST(APPEND LINK_LIBRARIES KF5::Attica )
ENDIF( TOMAHAWK_QT5 )
ENDIF(LIBATTICA_FOUND) ENDIF(LIBATTICA_FOUND)
if(HAVE_X11) if(HAVE_X11)
@@ -486,7 +476,7 @@ IF(BUILD_GUI)
LIST(APPEND libSources ${libGuiSources} ) LIST(APPEND libSources ${libGuiSources} )
ENDIF() ENDIF()
qt_wrap_ui(libUI_H ${libUI}) qt5_wrap_ui(libUI_H ${libUI})
SET( libSources ${libSources} ${libUI_H} ) SET( libSources ${libSources} ${libUI_H} )
@@ -500,12 +490,12 @@ set_target_properties(
OUTPUT_NAME ${TOMAHAWK_BASE_TARGET_NAME} OUTPUT_NAME ${TOMAHAWK_BASE_TARGET_NAME}
) )
target_link_libraries(${TOMAHAWK_LIBRARY} PUBLIC
qt5_use_modules(${TOMAHAWK_LIBRARY} Widgets Network Sql WebKitWidgets Concurrent Xml UiTools Svg) Qt5::Widgets Qt5::Network Qt5::Sql Qt5::WebKitWidgets Qt5::Concurrent Qt5::Xml Qt5::UiTools Qt5::Svg
IF(APPLE) )
qt5_use_modules(${TOMAHAWK_LIBRARY} MacExtras) if(APPLE)
ENDIF() target_link_libraries(${TOMAHAWK_LIBRARY} PRIVATE Qt5::MacExtras)
endif()
IF(QCA2_FOUND) IF(QCA2_FOUND)
INCLUDE_DIRECTORIES( ${QCA2_INCLUDE_DIR} ) INCLUDE_DIRECTORIES( ${QCA2_INCLUDE_DIR} )
@@ -514,11 +504,9 @@ ENDIF(QCA2_FOUND)
IF( UNIX AND NOT APPLE ) IF( UNIX AND NOT APPLE )
LIST(APPEND LINK_LIBRARIES ${QT_QTDBUS_LIBRARIES} ) LIST(APPEND LINK_LIBRARIES ${QT_QTDBUS_LIBRARIES} )
qt5_use_modules(${TOMAHAWK_LIBRARY} DBus)
ENDIF( UNIX AND NOT APPLE ) ENDIF( UNIX AND NOT APPLE )
TARGET_LINK_LIBRARIES( ${TOMAHAWK_LIBRARY} TARGET_LINK_LIBRARIES(${TOMAHAWK_LIBRARY} PRIVATE
LINK_PRIVATE
${LIBVLC_LIBRARY} ${LIBVLC_LIBRARY}
# Thirdparty shipped with tomahawk # Thirdparty shipped with tomahawk
@@ -526,7 +514,7 @@ TARGET_LINK_LIBRARIES( ${TOMAHAWK_LIBRARY}
${QTKEYCHAIN_LIBRARIES} ${QTKEYCHAIN_LIBRARIES}
${PRIVATE_LINK_LIBRARIES} ${PRIVATE_LINK_LIBRARIES}
LINK_PUBLIC PUBLIC
# External deps # External deps
${QJSON_LIBRARIES} ${QJSON_LIBRARIES}
${LUCENEPP_LIBRARIES} ${LUCENEPP_LIBRARIES}

View File

@@ -34,13 +34,8 @@
#include "TomahawkSettings.h" #include "TomahawkSettings.h"
#include "Track.h" #include "Track.h"
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
#include <echonest5/CatalogUpdateEntry.h> #include <echonest5/CatalogUpdateEntry.h>
#include <echonest5/Config.h> #include <echonest5/Config.h>
#else
#include <echonest/CatalogUpdateEntry.h>
#include <echonest/Config.h>
#endif
using namespace Tomahawk; using namespace Tomahawk;

View File

@@ -22,11 +22,7 @@
#include "DllMacro.h" #include "DllMacro.h"
#include "Query.h" #include "Query.h"
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
#include <echonest5/Catalog.h> #include <echonest5/Catalog.h>
#else
#include <echonest/Catalog.h>
#endif
#include <QObject> #include <QObject>
#include <QQueue> #include <QQueue>

View File

@@ -29,11 +29,6 @@
#include <QAction> #include <QAction>
// Forward Declarations breaking QSharedPointer
#if QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 )
#include "Result.h"
#endif
using namespace Tomahawk; using namespace Tomahawk;

View File

@@ -289,9 +289,4 @@ private:
Q_DECLARE_METATYPE( QSharedPointer< Tomahawk::Playlist > ) Q_DECLARE_METATYPE( QSharedPointer< Tomahawk::Playlist > )
#if QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 )
// Qt5 automatically generated this Metatype
Q_DECLARE_METATYPE( QList< QSharedPointer< Tomahawk::Query > > )
#endif
#endif // PLAYLIST_H #endif // PLAYLIST_H

View File

@@ -685,7 +685,7 @@ Query::howSimilar( const Tomahawk::result_ptr& r )
qTrackname = queryTrack()->trackSortname(); qTrackname = queryTrack()->trackSortname();
} }
static const QRegExp filterOutChars = QRegExp(QString::fromUtf8("[-`´~!@#$%^&*\\(\\)_—+=|:;<>«»,.?/{}\'\"\\[\\]\\\\]")); static const QRegExp filterOutChars = QRegExp(QString::fromUtf8("[-`´~!@#$%^&*()_—+=|:;<>«»,.?/{}\'\"\\[\\]\\\\]"));
//Cleanup symbols for minor naming differences //Cleanup symbols for minor naming differences
qArtistname.remove(filterOutChars); qArtistname.remove(filterOutChars);

View File

@@ -1,13 +1,9 @@
#include <QtPlugin> #include <QtPlugin>
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 ) #if defined(Q_EXPORT_PLUGIN)
#if defined(Q_EXPORT_PLUGIN) #undef Q_EXPORT_PLUGIN
#undef Q_EXPORT_PLUGIN #undef Q_EXPORT_PLUGIN2
#undef Q_EXPORT_PLUGIN2 #endif
#endif
#define Q_EXPORT_PLUGIN(a) #define Q_EXPORT_PLUGIN(a)
#define Q_EXPORT_PLUGIN2(a, b) #define Q_EXPORT_PLUGIN2(a, b)
#else
# define Q_PLUGIN_METADATA(a)
#endif

View File

@@ -34,14 +34,8 @@
#include "PlaylistInterface.h" #include "PlaylistInterface.h"
#include "Source.h" #include "Source.h"
#if QT_VERSION < QT_VERSION_CHECK(5,0,0) #include <qt5keychain/keychain.h>
#include <qtkeychain/keychain.h> #include <QStandardPaths>
#include <QDesktopServices>
#else
#include <qt5keychain/keychain.h>
#include <QStandardPaths>
#endif
#include <QDir> #include <QDir>
using namespace Tomahawk; using namespace Tomahawk;
@@ -733,11 +727,7 @@ TomahawkSettings::genericCacheVersion() const
QString QString
TomahawkSettings::storageCacheLocation() const TomahawkSettings::storageCacheLocation() const
{ {
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
return QStandardPaths::writableLocation( QStandardPaths::CacheLocation ); return QStandardPaths::writableLocation( QStandardPaths::CacheLocation );
#else
return QDesktopServices::storageLocation( QDesktopServices::CacheLocation );
#endif
} }
@@ -746,11 +736,7 @@ TomahawkSettings::scannerPaths() const
{ {
QString musicLocation; QString musicLocation;
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
musicLocation = QStandardPaths::writableLocation( QStandardPaths::MusicLocation ); musicLocation = QStandardPaths::writableLocation( QStandardPaths::MusicLocation );
#else
musicLocation = QDesktopServices::storageLocation( QDesktopServices::MusicLocation );
#endif
return value( "scanner/paths", musicLocation ).toStringList(); return value( "scanner/paths", musicLocation ).toStringList();
} }

View File

@@ -213,19 +213,11 @@ Track::init()
Q_D( Track ); Q_D( Track );
updateSortNames(); updateSortNames();
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
QObject::connect( d->trackData.data(), &TrackData::attributesLoaded, this, &Track::attributesLoaded ); QObject::connect( d->trackData.data(), &TrackData::attributesLoaded, this, &Track::attributesLoaded );
QObject::connect( d->trackData.data(), &TrackData::socialActionsLoaded, this, &Track::socialActionsLoaded ); QObject::connect( d->trackData.data(), &TrackData::socialActionsLoaded, this, &Track::socialActionsLoaded );
QObject::connect( d->trackData.data(), &TrackData::statsLoaded, this, &Track::statsLoaded ); QObject::connect( d->trackData.data(), &TrackData::statsLoaded, this, &Track::statsLoaded );
QObject::connect( d->trackData.data(), &TrackData::similarTracksLoaded, this, &Track::similarTracksLoaded ); QObject::connect( d->trackData.data(), &TrackData::similarTracksLoaded, this, &Track::similarTracksLoaded );
QObject::connect( d->trackData.data(), &TrackData::lyricsLoaded, this, &Track::lyricsLoaded ); QObject::connect( d->trackData.data(), &TrackData::lyricsLoaded, this, &Track::lyricsLoaded );
#else
connect( d->trackData.data(), SIGNAL( attributesLoaded() ), SIGNAL( attributesLoaded() ) );
connect( d->trackData.data(), SIGNAL( socialActionsLoaded() ), SIGNAL( socialActionsLoaded() ) );
connect( d->trackData.data(), SIGNAL( statsLoaded() ), SIGNAL( statsLoaded() ) );
connect( d->trackData.data(), SIGNAL( similarTracksLoaded() ), SIGNAL( similarTracksLoaded() ) );
connect( d->trackData.data(), SIGNAL( lyricsLoaded() ), SIGNAL( lyricsLoaded() ) );
#endif
} }

View File

@@ -64,7 +64,7 @@ AccountDelegate::sizeHint( const QStyleOptionViewItem& option, const QModelIndex
if ( m_accountRowHeight < 0 ) if ( m_accountRowHeight < 0 )
{ {
// Haven't calculated normal item height yet, do it once and save it // Haven't calculated normal item height yet, do it once and save it
QStyleOptionViewItemV4 opt( option ); QStyleOptionViewItem opt( option );
initStyleOption( &opt, index ); initStyleOption( &opt, index );
m_accountRowHeight = ACCOUNT_DELEGATE_ROW_HEIGHT_MULTIPLIER * opt.fontMetrics.height(); m_accountRowHeight = ACCOUNT_DELEGATE_ROW_HEIGHT_MULTIPLIER * opt.fontMetrics.height();
} }
@@ -98,7 +98,7 @@ AccountDelegate::sizeHint( const QStyleOptionViewItem& option, const QModelIndex
void void
AccountDelegate::paint ( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const AccountDelegate::paint ( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const
{ {
QStyleOptionViewItemV4 opt = option; QStyleOptionViewItem opt = option;
initStyleOption( &opt, index ); initStyleOption( &opt, index );
// draw the background // draw the background
@@ -139,7 +139,7 @@ AccountDelegate::paint ( QPainter* painter, const QStyleOptionViewItem& option,
// draw checkbox first // draw checkbox first
const int checkboxYPos = ( center ) - ( WRENCH_SIZE / 2 ); const int checkboxYPos = ( center ) - ( WRENCH_SIZE / 2 );
QRect checkRect = QRect( leftEdge, checkboxYPos, WRENCH_SIZE, WRENCH_SIZE ); QRect checkRect = QRect( leftEdge, checkboxYPos, WRENCH_SIZE, WRENCH_SIZE );
QStyleOptionViewItemV4 opt2 = opt; QStyleOptionViewItem opt2 = opt;
opt2.rect = checkRect; opt2.rect = checkRect;
if ( !m_loadingSpinners.contains( index ) ) if ( !m_loadingSpinners.contains( index ) )
@@ -392,7 +392,7 @@ AccountDelegate::paint ( QPainter* painter, const QStyleOptionViewItem& option,
int int
AccountDelegate::drawAccountList( QPainter* painter, QStyleOptionViewItemV4& opt, const QList< Account* > accts, int rightEdge ) const AccountDelegate::drawAccountList( QPainter* painter, QStyleOptionViewItem& opt, const QList< Account* > accts, int rightEdge ) const
{ {
// list each account name, and show the online, offline icon // list each account name, and show the online, offline icon
const int textHeight = painter->fontMetrics().height() + 1; const int textHeight = painter->fontMetrics().height() + 1;
@@ -615,7 +615,7 @@ AccountDelegate::drawStatus( QPainter* painter, const QPointF& rightTopEdge, Acc
void void
AccountDelegate::drawCheckBox( QStyleOptionViewItemV4& opt, QPainter* p, const QWidget* w ) const AccountDelegate::drawCheckBox( QStyleOptionViewItem& opt, QPainter* p, const QWidget* w ) const
{ {
QStyle* style = w ? w->style() : QApplication::style(); QStyle* style = w ? w->style() : QApplication::style();
opt.checkState == Qt::Checked ? opt.state |= QStyle::State_On : opt.state |= QStyle::State_Off; opt.checkState == Qt::Checked ? opt.state |= QStyle::State_On : opt.state |= QStyle::State_Off;
@@ -624,7 +624,7 @@ AccountDelegate::drawCheckBox( QStyleOptionViewItemV4& opt, QPainter* p, const Q
void void
AccountDelegate::drawConfigWrench ( QPainter* painter, QStyleOptionViewItemV4& opt, QStyleOptionToolButton& topt ) const AccountDelegate::drawConfigWrench ( QPainter* painter, QStyleOptionViewItem& opt, QStyleOptionToolButton& topt ) const
{ {
const QWidget* w = opt.widget; const QWidget* w = opt.widget;
QStyle* style = w ? w->style() : QApplication::style(); QStyle* style = w ? w->style() : QApplication::style();
@@ -648,7 +648,7 @@ AccountDelegate::drawConfigWrench ( QPainter* painter, QStyleOptionViewItemV4& o
QRect QRect
AccountDelegate::checkRectForIndex( const QStyleOptionViewItem& option, const QModelIndex& idx ) const AccountDelegate::checkRectForIndex( const QStyleOptionViewItem& option, const QModelIndex& idx ) const
{ {
QStyleOptionViewItemV4 opt = option; QStyleOptionViewItem opt = option;
initStyleOption( &opt, idx ); initStyleOption( &opt, idx );
// Top level item, return the corresponding rect // Top level item, return the corresponding rect
@@ -661,7 +661,7 @@ AccountDelegate::checkRectForIndex( const QStyleOptionViewItem& option, const QM
int int
AccountDelegate::removeBtnWidth( QStyleOptionViewItemV4 opt ) const AccountDelegate::removeBtnWidth( QStyleOptionViewItem opt ) const
{ {
const QString btnText = tr( "Remove" ); const QString btnText = tr( "Remove" );
QFont font = opt.font; QFont font = opt.font;
@@ -674,7 +674,7 @@ void
AccountDelegate::startInstalling( const QPersistentModelIndex& idx ) AccountDelegate::startInstalling( const QPersistentModelIndex& idx )
{ {
qDebug() << "START INSTALLING:" << idx.data( Qt::DisplayRole ).toString(); qDebug() << "START INSTALLING:" << idx.data( Qt::DisplayRole ).toString();
QStyleOptionViewItemV4 opt; QStyleOptionViewItem opt;
initStyleOption( &opt, idx ); initStyleOption( &opt, idx );
AnimatedSpinner* anim = new AnimatedSpinner( checkRectForIndex( opt, idx ).size(), true ); AnimatedSpinner* anim = new AnimatedSpinner( checkRectForIndex( opt, idx ).size(), true );

View File

@@ -71,14 +71,14 @@ private:
void drawRoundedButton( QPainter* painter, const QRect& buttonRect, bool red = false ) const; void drawRoundedButton( QPainter* painter, const QRect& buttonRect, bool red = false ) const;
// Returns new left edge // Returns new left edge
int drawStatus( QPainter* painter, const QPointF& rightTopEdge, Account* acct, bool drawText = false ) const; int drawStatus( QPainter* painter, const QPointF& rightTopEdge, Account* acct, bool drawText = false ) const;
void drawCheckBox( QStyleOptionViewItemV4& opt, QPainter* p, const QWidget* w ) const; void drawCheckBox( QStyleOptionViewItem& opt, QPainter* p, const QWidget* w ) const;
void drawConfigWrench( QPainter* painter, QStyleOptionViewItemV4& option, QStyleOptionToolButton& topt ) const; void drawConfigWrench( QPainter* painter, QStyleOptionViewItem& option, QStyleOptionToolButton& topt ) const;
// returns new left edge // returns new left edge
int drawAccountList( QPainter* painter, QStyleOptionViewItemV4& option, const QList< Account* > accounts, int rightEdge ) const; int drawAccountList( QPainter* painter, QStyleOptionViewItem& option, const QList< Account* > accounts, int rightEdge ) const;
QRect checkRectForIndex( const QStyleOptionViewItem &option, const QModelIndex &idx ) const; QRect checkRectForIndex( const QStyleOptionViewItem &option, const QModelIndex &idx ) const;
int removeBtnWidth( QStyleOptionViewItemV4 opt ) const; int removeBtnWidth( QStyleOptionViewItem opt ) const;
int m_hoveringOver; int m_hoveringOver;
QPersistentModelIndex m_hoveringItem, m_configPressed; QPersistentModelIndex m_hoveringItem, m_configPressed;

View File

@@ -44,7 +44,7 @@ AccountFactoryWrapperDelegate::AccountFactoryWrapperDelegate( QObject* parent )
void void
AccountFactoryWrapperDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const AccountFactoryWrapperDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const
{ {
QStyleOptionViewItemV4 opt = option; QStyleOptionViewItem opt = option;
initStyleOption( &opt, index ); initStyleOption( &opt, index );
const int center = opt.rect.height() / 2 + opt.rect.top(); const int center = opt.rect.height() / 2 + opt.rect.top();
@@ -61,7 +61,7 @@ AccountFactoryWrapperDelegate::paint(QPainter* painter, const QStyleOptionViewIt
// Checkbox on left edge, then text // Checkbox on left edge, then text
const QRect checkRect( PADDING/4, PADDING/4 + opt.rect.top(), opt.rect.height() - PADDING/4, opt.rect.height() - PADDING/4 ); const QRect checkRect( PADDING/4, PADDING/4 + opt.rect.top(), opt.rect.height() - PADDING/4, opt.rect.height() - PADDING/4 );
m_cachedCheckRects[ index ] = checkRect; m_cachedCheckRects[ index ] = checkRect;
QStyleOptionViewItemV4 opt2 = opt; QStyleOptionViewItem opt2 = opt;
opt2.rect = checkRect; opt2.rect = checkRect;
opt.checkState == Qt::Checked ? opt2.state |= QStyle::State_On : opt2.state |= QStyle::State_Off; opt.checkState == Qt::Checked ? opt2.state |= QStyle::State_On : opt2.state |= QStyle::State_Off;
style->drawPrimitive( QStyle::PE_IndicatorViewItemCheck, &opt2, painter, w ); style->drawPrimitive( QStyle::PE_IndicatorViewItemCheck, &opt2, painter, w );

View File

@@ -23,11 +23,7 @@
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
#include "TomahawkSettings.h" #include "TomahawkSettings.h"
#else #else
#if QT_VERSION < QT_VERSION_CHECK(5,0,0) #include <qt5keychain/keychain.h>
#include <qtkeychain/keychain.h>
#else
#include <qt5keychain/keychain.h>
#endif
#include "utils/Json.h" #include "utils/Json.h"
#endif #endif

View File

@@ -11,16 +11,3 @@ tomahawk_add_plugin(telepathy
${TELEPATHY_QT_LIBRARIES} ${TELEPATHY_QT_LIBRARIES}
SHARED_LIB SHARED_LIB
) )
if( KDE4_FOUND )
include_directories( ${KDE4_INCLUDES} )
tomahawk_add_plugin(kde
TYPE configstorage_telepathy
EXPORT_MACRO CONFIGSTORAGETELEPATHYDLLEXPORT_PRO
SOURCES
KdeTelepathyConfigWidget.cpp
LINK_LIBRARIES
${TOMAHAWK_BASE_TARGET_NAME}_configstorage_telepathy
${KDE4_KCMUTILS_LIBS}
)
endif()

View File

@@ -1,46 +0,0 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2013, Dominik Schmidt <domme@tomahawk-player.org>
*
* Tomahawk is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Tomahawk is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
*/
#include "KdeTelepathyConfigWidget.h"
#include "utils/Logger.h"
#include <KCModuleProxy>
#include <QtPlugin>
QWidget*
KdeTelepathyConfigWidget::configWidget()
{
KCModuleProxy* proxy = new KCModuleProxy( "kcm_ktp_accounts" );
if ( !proxy->aboutData() )
{
qWarning() << "Could not load kcm_ktp_accounts... ";
delete proxy;
return 0;
}
return proxy;
}
Q_EXPORT_PLUGIN2( TelepathyConfigStorageConfigWidgetPlugin, KdeTelepathyConfigWidget )

View File

@@ -1,36 +0,0 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2013, Dominik Schmidt <domme@tomahawk-player.org>
*
* Tomahawk is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Tomahawk is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef KDETELEPATHYCONFIGWIDGET_H
#define KDETELEPATHYCONFIGWIDGET_H
#include "TelepathyConfigStorageConfigWidgetPlugin.h"
#include "TelepathyConfigStorageConfigWidgetDllMacro.h"
class CONFIGSTORAGETELEPATHYDLLEXPORT KdeTelepathyConfigWidget : public TelepathyConfigStorageConfigWidgetPlugin
{
Q_OBJECT
Q_INTERFACES( TelepathyConfigStorageConfigWidgetPlugin )
public:
virtual QWidget* configWidget();
};
#endif // KDETELEPATHYCONFIGWIDGET_H

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

View File

@@ -1,5 +0,0 @@
<RCC>
<qresource prefix="/telepathy">
<file>kde.png</file>
</qresource>
</RCC>

View File

@@ -29,17 +29,10 @@
#include "utils/Closure.h" #include "utils/Closure.h"
#include "utils/NetworkAccessManager.h" #include "utils/NetworkAccessManager.h"
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
#include <lastfm5/ws.h> #include <lastfm5/ws.h>
#include <lastfm5/User.h> #include <lastfm5/User.h>
#include <lastfm5/XmlQuery.h> #include <lastfm5/XmlQuery.h>
#include <lastfm5/Track.h> #include <lastfm5/Track.h>
#else
#include <lastfm/ws.h>
#include <lastfm/User.h>
#include <lastfm/XmlQuery.h>
#include <lastfm/Track.h>
#endif
using namespace Tomahawk::Accounts; using namespace Tomahawk::Accounts;

View File

@@ -34,13 +34,8 @@
#include "TomahawkSettings.h" #include "TomahawkSettings.h"
#include "utils/NetworkAccessManager.h" #include "utils/NetworkAccessManager.h"
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
#include <lastfm5/ws.h> #include <lastfm5/ws.h>
#include <lastfm5/XmlQuery.h> #include <lastfm5/XmlQuery.h>
#else
#include <lastfm/ws.h>
#include <lastfm/XmlQuery.h>
#endif
using namespace Tomahawk::Accounts; using namespace Tomahawk::Accounts;
using namespace Tomahawk::InfoSystem; using namespace Tomahawk::InfoSystem;

View File

@@ -24,15 +24,9 @@
#include "infosystem/InfoSystemWorker.h" #include "infosystem/InfoSystemWorker.h"
#include "DllMacro.h" #include "DllMacro.h"
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
#include <lastfm5/Track.h> #include <lastfm5/Track.h>
#include <lastfm5/Audioscrobbler.h> #include <lastfm5/Audioscrobbler.h>
#include <lastfm5/ScrobblePoint.h> #include <lastfm5/ScrobblePoint.h>
#else
#include <lastfm/Track.h>
#include <lastfm/Audioscrobbler.h>
#include <lastfm/ScrobblePoint.h>
#endif
#include <QObject> #include <QObject>

View File

@@ -572,10 +572,10 @@ AudioEngine::onNowPlayingInfoReady( const Tomahawk::InfoSystem::InfoType type )
void void
AudioEngine::loadTrack( const Tomahawk::result_ptr& result, bool preload ) AudioEngine::loadTrack( const Tomahawk::result_ptr& result )
{ {
Q_D( AudioEngine ); Q_D( AudioEngine );
tDebug( LOGEXTRA ) << Q_FUNC_INFO << ( result.isNull() ? QString() : result->url() ) << " preload:" << preload; tDebug( LOGEXTRA ) << Q_FUNC_INFO << ( result.isNull() ? QString() : result->url() );
if ( !d->audioOutput->isInitialized() ) if ( !d->audioOutput->isInitialized() )
@@ -589,57 +589,18 @@ AudioEngine::loadTrack( const Tomahawk::result_ptr& result, bool preload )
return; return;
} }
if (preload && d->preloadedTrack == result) // We do this to stop the audio as soon as a user activated another track
return; // If we don't block the audioOutput signals, the state change will trigger
// loading yet another track
d->audioOutput->blockSignals( true );
d->audioOutput->stop();
d->audioOutput->blockSignals( false );
if (preload) setCurrentTrack( result );
tDebug( LOGEXTRA ) << Q_FUNC_INFO << "not preloaded yet, preloading";
if (preload)
{
setPreloadTrack( result );
}
else
{
// We do this to stop the audio as soon as a user activated another track
// If we don't block the audioOutput signals, the state change will trigger
// loading yet another track
d->audioOutput->blockSignals( true );
d->audioOutput->stop();
d->audioOutput->blockSignals( false );
setCurrentTrack( result );
if ( result == d->preloadedTrack )
{
setPreloadTrack( Tomahawk::result_ptr(nullptr) );
d->state = Loading;
emit loading( d->currentTrack );
d->audioOutput->switchToPreloadedMedia();
if ( !d->input.isNull() )
{
d->input->close();
d->input.clear();
}
d->input = d->inputPreloaded;
d->audioOutput->play();
if ( TomahawkSettings::instance()->privateListeningMode() != TomahawkSettings::FullyPrivate )
{
d->currentTrack->track()->startPlaying();
}
sendNowPlayingNotification( Tomahawk::InfoSystem::InfoNowPlaying );
return;
}
setPreloadTrack( Tomahawk::result_ptr(nullptr) );
}
ScriptJob* job = result->resolvedBy()->getStreamUrl( result ); ScriptJob* job = result->resolvedBy()->getStreamUrl( result );
connect( job, SIGNAL( done( QVariantMap ) ), SLOT( gotStreamUrl( QVariantMap ) ) ); connect( job, SIGNAL( done( QVariantMap ) ), SLOT( gotStreamUrl( QVariantMap ) ) );
job->setProperty( "result", QVariant::fromValue( result ) ); job->setProperty( "result", QVariant::fromValue( result ) );
job->setProperty( "isPreload", QVariant::fromValue(preload) );
tDebug() << "preload:" << preload << ", for result:" << result;
job->start(); job->start();
} }
@@ -650,9 +611,6 @@ AudioEngine::gotStreamUrl( const QVariantMap& data )
QString streamUrl = data[ "url" ].toString(); QString streamUrl = data[ "url" ].toString();
QVariantMap headers = data[ "headers" ].toMap(); QVariantMap headers = data[ "headers" ].toMap();
Tomahawk::result_ptr result = sender()->property( "result" ).value<result_ptr>(); Tomahawk::result_ptr result = sender()->property( "result" ).value<result_ptr>();
bool isPreload = sender()->property( "isPreload" ).value<bool>();
tDebug() << Q_FUNC_INFO << " is preload:" << isPreload << ", for result:" << result;
if ( streamUrl.isEmpty() || headers.isEmpty() || if ( streamUrl.isEmpty() || headers.isEmpty() ||
!( TomahawkUtils::isHttpResult( streamUrl ) || TomahawkUtils::isHttpsResult( streamUrl ) ) ) !( TomahawkUtils::isHttpResult( streamUrl ) || TomahawkUtils::isHttpsResult( streamUrl ) ) )
@@ -660,7 +618,7 @@ AudioEngine::gotStreamUrl( const QVariantMap& data )
// We can't supply custom headers to VLC - but prefer using its HTTP streaming due to improved seeking ability // We can't supply custom headers to VLC - but prefer using its HTTP streaming due to improved seeking ability
// Not an RTMP or HTTP-with-headers URL, get IO device // Not an RTMP or HTTP-with-headers URL, get IO device
QSharedPointer< QIODevice > sp; QSharedPointer< QIODevice > sp;
performLoadIODevice( result, streamUrl, isPreload ); performLoadIODevice( result, streamUrl );
} }
else else
{ {
@@ -696,32 +654,26 @@ AudioEngine::gotStreamUrl( const QVariantMap& data )
void void
AudioEngine::gotRedirectedStreamUrl( const Tomahawk::result_ptr& result, NetworkReply* reply ) AudioEngine::gotRedirectedStreamUrl( const Tomahawk::result_ptr& result, NetworkReply* reply )
{ {
Q_D( AudioEngine );
// std::functions cannot accept temporaries as parameters // std::functions cannot accept temporaries as parameters
QSharedPointer< QIODevice > sp ( reply->reply(), &QObject::deleteLater ); QSharedPointer< QIODevice > sp ( reply->reply(), &QObject::deleteLater );
QString url = reply->reply()->url().toString(); QString url = reply->reply()->url().toString();
reply->disconnectFromReply(); reply->disconnectFromReply();
reply->deleteLater(); reply->deleteLater();
bool isPreload = result == d->preloadedTrack; performLoadTrack( result, url, sp );
tDebug() << Q_FUNC_INFO << " is preload:" << isPreload;
performLoadTrack( result, url, sp, isPreload );
} }
void void
AudioEngine::onPositionChanged( float new_position ) AudioEngine::onPositionChanged( float new_position )
{ {
if ( new_position >= 0.90 )
loadNextTrack(true);
// tDebug() << Q_FUNC_INFO << new_position << state(); // tDebug() << Q_FUNC_INFO << new_position << state();
emit trackPosition( new_position ); emit trackPosition( new_position );
} }
void void
AudioEngine::performLoadIODevice( const result_ptr& result, const QString& url, bool preload ) AudioEngine::performLoadIODevice( const result_ptr& result, const QString& url )
{ {
tDebug( LOGEXTRA ) << Q_FUNC_INFO << ( result.isNull() ? QString() : url ); tDebug( LOGEXTRA ) << Q_FUNC_INFO << ( result.isNull() ? QString() : url );
@@ -731,39 +683,37 @@ AudioEngine::performLoadIODevice( const result_ptr& result, const QString& url,
std::function< void ( const QString, QSharedPointer< QIODevice > ) > callback = std::function< void ( const QString, QSharedPointer< QIODevice > ) > callback =
std::bind( &AudioEngine::performLoadTrack, this, result, std::bind( &AudioEngine::performLoadTrack, this, result,
std::placeholders::_1, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_2 );
preload );
Tomahawk::UrlHandler::getIODeviceForUrl( result, url, callback ); Tomahawk::UrlHandler::getIODeviceForUrl( result, url, callback );
} }
else else
{ {
QSharedPointer< QIODevice > io; QSharedPointer< QIODevice > io;
performLoadTrack( result, url, io, preload ); performLoadTrack( result, url, io );
} }
} }
void void
AudioEngine::performLoadTrack( const Tomahawk::result_ptr result, const QString& url, QSharedPointer< QIODevice > io, bool preload ) AudioEngine::performLoadTrack( const Tomahawk::result_ptr result, const QString& url, QSharedPointer< QIODevice > io )
{ {
if ( QThread::currentThread() != thread() ) if ( QThread::currentThread() != thread() )
{ {
QMetaObject::invokeMethod( this, "performLoadTrack", Qt::QueuedConnection, QMetaObject::invokeMethod( this, "performLoadTrack", Qt::QueuedConnection,
Q_ARG( const Tomahawk::result_ptr, result ), Q_ARG( const Tomahawk::result_ptr, result ),
Q_ARG( const QString, url ), Q_ARG( const QString, url ),
Q_ARG( QSharedPointer< QIODevice >, io ), Q_ARG( QSharedPointer< QIODevice >, io )
Q_ARG( bool, preload )
); );
return; return;
} }
Q_D( AudioEngine ); Q_D( AudioEngine );
if ( !preload && currentTrack() != result ) if ( currentTrack() != result )
{ {
tLog( LOGVERBOSE ) << Q_FUNC_INFO << "Track loaded too late, skip."; tLog( LOGVERBOSE ) << Q_FUNC_INFO << "Track loaded too late, skip.";
return; return;
} }
tDebug( LOGEXTRA ) << Q_FUNC_INFO << ( result.isNull() ? QString() : result->url() ) << preload; tDebug( LOGEXTRA ) << Q_FUNC_INFO << ( result.isNull() ? QString() : result->url() );
QSharedPointer< QIODevice > ioToKeep = io; QSharedPointer< QIODevice > ioToKeep = io;
bool err = false; bool err = false;
@@ -777,16 +727,9 @@ AudioEngine::performLoadTrack( const Tomahawk::result_ptr result, const QString&
if ( !err ) if ( !err )
{ {
if (preload) tLog() << Q_FUNC_INFO << "Starting new song:" << url;
{ d->state = Loading;
tLog() << Q_FUNC_INFO << "Preloading new song:" << url; emit loading( d->currentTrack );
}
else
{
tLog() << Q_FUNC_INFO << "Starting new song:" << url;
d->state = Loading;
emit loading( d->currentTrack );
}
if ( !TomahawkUtils::isLocalResult( url ) if ( !TomahawkUtils::isLocalResult( url )
&& !( TomahawkUtils::isHttpResult( url ) && io.isNull() ) && !( TomahawkUtils::isHttpResult( url ) && io.isNull() )
@@ -795,18 +738,18 @@ AudioEngine::performLoadTrack( const Tomahawk::result_ptr result, const QString&
QSharedPointer<QNetworkReply> qnr = io.objectCast<QNetworkReply>(); QSharedPointer<QNetworkReply> qnr = io.objectCast<QNetworkReply>();
if ( !qnr.isNull() ) if ( !qnr.isNull() )
{ {
d->audioOutput->setCurrentSource( new QNR_IODeviceStream( qnr, this ), preload ); d->audioOutput->setCurrentSource( new QNR_IODeviceStream( qnr, this ) );
// We keep track of the QNetworkReply in QNR_IODeviceStream // We keep track of the QNetworkReply in QNR_IODeviceStream
// and AudioOutput handles the deletion of the // and AudioOutput handles the deletion of the
// QNR_IODeviceStream object // QNR_IODeviceStream object
ioToKeep.clear(); ioToKeep.clear();
d->audioOutput->setAutoDelete( true, preload ); d->audioOutput->setAutoDelete( true );
} }
else else
{ {
d->audioOutput->setCurrentSource( io.data(), preload); d->audioOutput->setCurrentSource( io.data() );
// We handle the deletion via tracking in d->input // We handle the deletion via tracking in d->input
d->audioOutput->setAutoDelete( false, preload); d->audioOutput->setAutoDelete( false );
} }
} }
else else
@@ -825,7 +768,7 @@ AudioEngine::performLoadTrack( const Tomahawk::result_ptr result, const QString&
} }
tLog( LOGVERBOSE ) << Q_FUNC_INFO << "Passing to VLC:" << furl; tLog( LOGVERBOSE ) << Q_FUNC_INFO << "Passing to VLC:" << furl;
d->audioOutput->setCurrentSource( furl, preload ); d->audioOutput->setCurrentSource( furl );
} }
else else
{ {
@@ -834,37 +777,26 @@ AudioEngine::performLoadTrack( const Tomahawk::result_ptr result, const QString&
furl = furl.right( furl.length() - 7 ); furl = furl.right( furl.length() - 7 );
tLog( LOGVERBOSE ) << Q_FUNC_INFO << "Passing to VLC:" << QUrl::fromLocalFile( furl ); tLog( LOGVERBOSE ) << Q_FUNC_INFO << "Passing to VLC:" << QUrl::fromLocalFile( furl );
d->audioOutput->setCurrentSource( QUrl::fromLocalFile( furl ), preload ); d->audioOutput->setCurrentSource( QUrl::fromLocalFile( furl ) );
} }
d->audioOutput->setAutoDelete( true, preload ); d->audioOutput->setAutoDelete( true );
} }
if ( preload ) { if ( !d->input.isNull() )
if ( !d->inputPreloaded.isNull() )
{
d->inputPreloaded->close();
d->inputPreloaded.clear();
}
d->inputPreloaded = ioToKeep;
}
else
{ {
if ( !d->input.isNull() ) d->input->close();
{ d->input.clear();
d->input->close();
d->input.clear();
}
d->input = ioToKeep;
d->audioOutput->play();
if ( TomahawkSettings::instance()->privateListeningMode() != TomahawkSettings::FullyPrivate )
{
d->currentTrack->track()->startPlaying();
}
sendNowPlayingNotification( Tomahawk::InfoSystem::InfoNowPlaying );
} }
d->input = ioToKeep;
d->audioOutput->play();
if ( TomahawkSettings::instance()->privateListeningMode() != TomahawkSettings::FullyPrivate )
{
d->currentTrack->track()->startPlaying();
}
sendNowPlayingNotification( Tomahawk::InfoSystem::InfoNowPlaying );
} }
} }
@@ -874,10 +806,7 @@ AudioEngine::performLoadTrack( const Tomahawk::result_ptr result, const QString&
return; return;
} }
if ( !preload ) d->waitingOnNewTrack = false;
{
d->waitingOnNewTrack = false;
}
return; return;
} }
@@ -909,19 +838,18 @@ AudioEngine::loadPreviousTrack()
} }
if ( result ) if ( result )
loadTrack( result, false ); loadTrack( result );
else else
stop(); stop();
} }
void void
AudioEngine::loadNextTrack( bool preload ) AudioEngine::loadNextTrack()
{ {
if ( QThread::currentThread() != thread() ) if ( QThread::currentThread() != thread() )
{ {
QMetaObject::invokeMethod( this, "loadNextTrack", Qt::QueuedConnection, QMetaObject::invokeMethod( this, "loadNextTrack", Qt::QueuedConnection );
Q_ARG( bool, preload ));
return; return;
} }
@@ -935,11 +863,8 @@ AudioEngine::loadNextTrack( bool preload )
{ {
if ( d->stopAfterTrack->track()->equals( d->currentTrack->track() ) ) if ( d->stopAfterTrack->track()->equals( d->currentTrack->track() ) )
{ {
if ( !preload ) d->stopAfterTrack.clear();
{ stop();
d->stopAfterTrack.clear();
stop();
}
return; return;
} }
} }
@@ -957,24 +882,17 @@ AudioEngine::loadNextTrack( bool preload )
if ( d->playlist.data()->nextResult() ) if ( d->playlist.data()->nextResult() )
{ {
if ( preload ) result = d->playlist.data()->setSiblingResult( 1 );
{ setCurrentTrackPlaylist( d->playlist );
result = d->playlist.data()->nextResult();
}
else
{
result = d->playlist.data()->setSiblingResult( 1 );
setCurrentTrackPlaylist( d->playlist );
}
} }
} }
if ( result ) if ( result )
{ {
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Got next item, loading track, preload:" << preload; tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Got next item, loading track";
loadTrack( result, preload ); loadTrack( result );
} }
else if ( !preload ) else
{ {
if ( !d->playlist.isNull() && d->playlist.data()->retryMode() == Tomahawk::PlaylistModes::Retry ) if ( !d->playlist.isNull() && d->playlist.data()->retryMode() == Tomahawk::PlaylistModes::Retry )
d->waitingOnNewTrack = true; d->waitingOnNewTrack = true;
@@ -1043,7 +961,7 @@ AudioEngine::playItem( Tomahawk::playlistinterface_ptr playlist, const Tomahawk:
if ( result ) if ( result )
{ {
loadTrack( result, false ); loadTrack( result );
} }
else if ( !d->playlist.isNull() && d->playlist.data()->retryMode() == PlaylistModes::Retry ) else if ( !d->playlist.isNull() && d->playlist.data()->retryMode() == PlaylistModes::Retry )
{ {
@@ -1318,14 +1236,6 @@ AudioEngine::setStopAfterTrack( const query_ptr& query )
} }
void
AudioEngine::setPreloadTrack( const Tomahawk::result_ptr& result )
{
Q_D( AudioEngine );
d->preloadedTrack = result;
}
void void
AudioEngine::setCurrentTrack( const Tomahawk::result_ptr& result ) AudioEngine::setCurrentTrack( const Tomahawk::result_ptr& result )
{ {
@@ -1352,6 +1262,7 @@ AudioEngine::setCurrentTrack( const Tomahawk::result_ptr& result )
} }
} }
void void
AudioEngine::setState( AudioState state ) AudioEngine::setState( AudioState state )
{ {

View File

@@ -135,10 +135,10 @@ public slots:
void toggleMute(); void toggleMute();
void play( const QUrl& url ); void play( const QUrl& url );
void playItem( Tomahawk::playlistinterface_ptr playlist, const Tomahawk::result_ptr& result, const Tomahawk::query_ptr& fromQuery = Tomahawk::query_ptr()); void playItem( Tomahawk::playlistinterface_ptr playlist, const Tomahawk::result_ptr& result, const Tomahawk::query_ptr& fromQuery = Tomahawk::query_ptr() );
void playItem( Tomahawk::playlistinterface_ptr playlist, const Tomahawk::query_ptr& query); void playItem( Tomahawk::playlistinterface_ptr playlist, const Tomahawk::query_ptr& query );
void playItem( const Tomahawk::artist_ptr& artist); void playItem( const Tomahawk::artist_ptr& artist );
void playItem( const Tomahawk::album_ptr& album); void playItem( const Tomahawk::album_ptr& album );
void playPlaylistInterface( const Tomahawk::playlistinterface_ptr& playlist ); void playPlaylistInterface( const Tomahawk::playlistinterface_ptr& playlist );
void setPlaylist( Tomahawk::playlistinterface_ptr playlist ); void setPlaylist( Tomahawk::playlistinterface_ptr playlist );
void setQueue( const Tomahawk::playlistinterface_ptr& queue ); void setQueue( const Tomahawk::playlistinterface_ptr& queue );
@@ -182,22 +182,21 @@ signals:
void error( AudioEngine::AudioErrorCode errorCode ); void error( AudioEngine::AudioErrorCode errorCode );
private slots: private slots:
void loadTrack( const Tomahawk::result_ptr& result, bool preload ); //async! void loadTrack( const Tomahawk::result_ptr& result ); //async!
void gotStreamUrl( const QVariantMap& data ); void gotStreamUrl( const QVariantMap& data );
void gotRedirectedStreamUrl( const Tomahawk::result_ptr& result, NetworkReply* reply ); void gotRedirectedStreamUrl( const Tomahawk::result_ptr& result, NetworkReply* reply );
void performLoadIODevice( const Tomahawk::result_ptr& result, const QString& url, bool preload ); //only call from loadTrack kthxbi void performLoadIODevice( const Tomahawk::result_ptr& result, const QString& url ); //only call from loadTrack kthxbi
void performLoadTrack( const Tomahawk::result_ptr result, const QString& url, QSharedPointer< QIODevice > io, bool preload ); //only call from loadTrack or performLoadIODevice kthxbi void performLoadTrack( const Tomahawk::result_ptr result, const QString& url, QSharedPointer< QIODevice > io ); //only call from loadTrack or performLoadIODevice kthxbi
void loadPreviousTrack(); void loadPreviousTrack();
void loadNextTrack(bool preload = false); void loadNextTrack();
void onVolumeChanged( qreal volume ); void onVolumeChanged( qreal volume );
void timerTriggered( qint64 time ); void timerTriggered( qint64 time );
void onPositionChanged( float new_position ); void onPositionChanged( float new_position );
void setCurrentTrack( const Tomahawk::result_ptr& result ); void setCurrentTrack( const Tomahawk::result_ptr& result );
void setPreloadTrack( const Tomahawk::result_ptr& result );
void onNowPlayingInfoReady( const Tomahawk::InfoSystem::InfoType type ); void onNowPlayingInfoReady( const Tomahawk::InfoSystem::InfoType type );
void onPlaylistNextTrackAvailable(); void onPlaylistNextTrackAvailable();

View File

@@ -28,11 +28,9 @@ public slots:
private: private:
QSharedPointer<QIODevice> input; QSharedPointer<QIODevice> input;
QSharedPointer<QIODevice> inputPreloaded;
Tomahawk::query_ptr stopAfterTrack; Tomahawk::query_ptr stopAfterTrack;
Tomahawk::result_ptr currentTrack; Tomahawk::result_ptr currentTrack;
Tomahawk::result_ptr preloadedTrack;
Tomahawk::playlistinterface_ptr playlist; Tomahawk::playlistinterface_ptr playlist;
Tomahawk::playlistinterface_ptr currentTrackPlaylist; Tomahawk::playlistinterface_ptr currentTrackPlaylist;
Tomahawk::playlistinterface_ptr queue; Tomahawk::playlistinterface_ptr queue;

View File

@@ -56,11 +56,9 @@ AudioOutput::AudioOutput( QObject* parent )
: QObject( parent ) : QObject( parent )
, m_currentState( Stopped ) , m_currentState( Stopped )
, m_currentStream( nullptr ) , m_currentStream( nullptr )
, m_preloadedStream( nullptr )
, m_seekable( true ) , m_seekable( true )
, m_muted( false ) , m_muted( false )
, m_autoDelete( true ) , m_autoDelete( true )
, m_preloadedAutoDelete( true )
, m_volume( 1.0 ) , m_volume( 1.0 )
, m_currentTime( 0 ) , m_currentTime( 0 )
, m_totalTime( 0 ) , m_totalTime( 0 )
@@ -70,8 +68,6 @@ AudioOutput::AudioOutput( QObject* parent )
, m_vlcInstance( nullptr ) , m_vlcInstance( nullptr )
, m_vlcPlayer( nullptr ) , m_vlcPlayer( nullptr )
, m_vlcMedia( nullptr ) , m_vlcMedia( nullptr )
, m_vlcPreloadedPlayer( nullptr )
, m_vlcPreloadedMedia( nullptr )
{ {
tDebug() << Q_FUNC_INFO; tDebug() << Q_FUNC_INFO;
@@ -127,46 +123,37 @@ AudioOutput::AudioOutput( QObject* parent )
#endif #endif
m_vlcPlayer = libvlc_media_player_new( m_vlcInstance ); m_vlcPlayer = libvlc_media_player_new( m_vlcInstance );
m_vlcPreloadedPlayer = libvlc_media_player_new( m_vlcInstance ); libvlc_event_manager_t* manager = libvlc_media_player_event_manager( m_vlcPlayer );
libvlc_event_type_t events[] = {
for( auto player : { m_vlcPlayer, m_vlcPreloadedPlayer } ) libvlc_MediaPlayerMediaChanged,
{ libvlc_MediaPlayerNothingSpecial,
libvlc_audio_set_mute( player, 0 ); libvlc_MediaPlayerOpening,
{ libvlc_MediaPlayerBuffering,
libvlc_event_manager_t* current_manager = libvlc_media_player_event_manager( player ); libvlc_MediaPlayerPlaying,
libvlc_event_manager_t* new_manager = libvlc_media_player_event_manager( player ); libvlc_MediaPlayerPaused,
static libvlc_event_type_t events[] = { libvlc_MediaPlayerStopped,
libvlc_MediaPlayerMediaChanged, libvlc_MediaPlayerForward,
libvlc_MediaPlayerNothingSpecial, libvlc_MediaPlayerBackward,
libvlc_MediaPlayerOpening, libvlc_MediaPlayerEndReached,
libvlc_MediaPlayerBuffering, libvlc_MediaPlayerEncounteredError,
libvlc_MediaPlayerPlaying, libvlc_MediaPlayerTimeChanged,
libvlc_MediaPlayerPaused, libvlc_MediaPlayerPositionChanged,
libvlc_MediaPlayerStopped, libvlc_MediaPlayerSeekableChanged,
libvlc_MediaPlayerForward, libvlc_MediaPlayerPausableChanged,
libvlc_MediaPlayerBackward, libvlc_MediaPlayerTitleChanged,
libvlc_MediaPlayerEndReached, libvlc_MediaPlayerSnapshotTaken,
libvlc_MediaPlayerEncounteredError, //libvlc_MediaPlayerLengthChanged,
libvlc_MediaPlayerTimeChanged,
libvlc_MediaPlayerPositionChanged,
libvlc_MediaPlayerSeekableChanged,
libvlc_MediaPlayerPausableChanged,
libvlc_MediaPlayerTitleChanged,
libvlc_MediaPlayerSnapshotTaken,
//libvlc_MediaPlayerLengthChanged,
#if (LIBVLC_VERSION_INT >= LIBVLC_VERSION(2, 2, 2, 0)) #if (LIBVLC_VERSION_INT >= LIBVLC_VERSION(2, 2, 2, 0))
libvlc_MediaPlayerAudioVolume, libvlc_MediaPlayerAudioVolume,
libvlc_MediaPlayerMuted, libvlc_MediaPlayerMuted,
libvlc_MediaPlayerUnmuted, libvlc_MediaPlayerUnmuted,
#endif #endif
libvlc_MediaPlayerVout libvlc_MediaPlayerVout
}; };
const int eventCount = sizeof(events) / sizeof( *events ); const int eventCount = sizeof(events) / sizeof( *events );
for ( int i = 0; i < eventCount; i++ ) for ( int i = 0; i < eventCount; i++ )
{ {
libvlc_event_attach( new_manager, events[ i ], &AudioOutput::vlcEventCallback, this ); libvlc_event_attach( manager, events[ i ], &AudioOutput::vlcEventCallback, this );
}
}
} }
// HACK: play silent ogg file and set volume on that to workaround vlc not allowing to set volume before a file is played // HACK: play silent ogg file and set volume on that to workaround vlc not allowing to set volume before a file is played
@@ -174,81 +161,30 @@ AudioOutput::AudioOutput( QObject* parent )
Q_ASSERT( m_silenceFile.exists() ); Q_ASSERT( m_silenceFile.exists() );
Q_ASSERT( m_silenceFile.open( QIODevice::ReadOnly ) ); Q_ASSERT( m_silenceFile.open( QIODevice::ReadOnly ) );
setCurrentSource( new MediaStream( &m_silenceFile, true ), false ); setCurrentSource( new MediaStream( &m_silenceFile, true ) );
setCurrentSource( new MediaStream( &m_silenceFile, true ), true );
libvlc_media_player_play( m_vlcPlayer ); libvlc_media_player_play( m_vlcPlayer );
#if QT_VERSION >= QT_VERSION_CHECK(5,4,0)
// if the silence file did not play for 15 secs, we pretend the AudioOutput is initialized, to allow proper error reporting // if the silence file did not play for 15 secs, we pretend the AudioOutput is initialized, to allow proper error reporting
QTimer::singleShot( 15000, [&]() QTimer::singleShot( 15000, [&]()
{ {
if ( !m_initialized ) { if ( !m_initialized ) {
m_initialized = 2; m_initialized = true;
emit initialized(); emit initialized();
} }
} ); } );
#endif
} }
void AudioOutput::switchToPreloadedMedia( void )
{
//Swap
auto tempPlayer = m_vlcPreloadedPlayer;
m_vlcPreloadedPlayer = m_vlcPlayer;
m_vlcPlayer = tempPlayer;
libvlc_media_player_stop( m_vlcPreloadedPlayer );
if ( m_vlcMedia != nullptr )
{
libvlc_media_release( m_vlcMedia );
}
//Now Media
{
if ( m_autoDelete && m_currentStream != nullptr )
{
delete m_currentStream;
}
m_vlcMedia = m_vlcPreloadedMedia;
m_vlcPreloadedMedia = nullptr;
m_currentStream = m_preloadedStream;
m_preloadedStream = nullptr;
m_autoDelete = m_preloadedAutoDelete;
m_totalTime = libvlc_media_get_duration( m_vlcMedia );
m_currentTime = 0;
m_justSeeked = false;
m_seekable = true;
}
libvlc_media_player_set_position( m_vlcPlayer, 0.0 );
}
AudioOutput::~AudioOutput() AudioOutput::~AudioOutput()
{ {
tDebug() << Q_FUNC_INFO; tDebug() << Q_FUNC_INFO;
if ( m_vlcPreloadedPlayer != nullptr )
{
libvlc_media_player_stop( m_vlcPreloadedPlayer );
libvlc_media_player_release( m_vlcPreloadedPlayer );
m_vlcPreloadedPlayer = nullptr;
}
if ( m_vlcPlayer != nullptr ) if ( m_vlcPlayer != nullptr )
{ {
libvlc_media_player_stop( m_vlcPlayer ); libvlc_media_player_stop( m_vlcPlayer );
libvlc_media_player_release( m_vlcPlayer ); libvlc_media_player_release( m_vlcPlayer );
m_vlcPlayer = nullptr; m_vlcPlayer = nullptr;
} }
if ( m_vlcPreloadedMedia != nullptr )
{
libvlc_media_release( m_vlcPreloadedMedia );
m_vlcPreloadedMedia = nullptr;
}
if ( m_vlcMedia != nullptr ) if ( m_vlcMedia != nullptr )
{ {
libvlc_media_release( m_vlcMedia ); libvlc_media_release( m_vlcMedia );
@@ -270,19 +206,11 @@ AudioOutput::onInitVlcEvent( const libvlc_event_t* event )
setVolume( volume() ); setVolume( volume() );
setMuted( isMuted() ); setMuted( isMuted() );
m_initialized ++; m_initialized = true;
m_silenceFile.close();
tDebug() << Q_FUNC_INFO << "Init OK"; tDebug() << Q_FUNC_INFO << "Init OK";
if (m_initialized >=2) emit initialized();
{
m_silenceFile.close();
emit initialized();
}
else
{
switchToPreloadedMedia();
libvlc_media_player_play( m_vlcPlayer );
}
break; break;
default: default:
@@ -292,26 +220,23 @@ AudioOutput::onInitVlcEvent( const libvlc_event_t* event )
void void
AudioOutput::setAutoDelete( bool ad, bool preload ) AudioOutput::setAutoDelete( bool ad )
{ {
if (preload) m_autoDelete = ad;
m_preloadedAutoDelete = ad;
else
m_autoDelete = ad;
} }
void void
AudioOutput::setCurrentSource( const QUrl& stream, bool preload ) AudioOutput::setCurrentSource( const QUrl& stream )
{ {
setCurrentSource( new MediaStream( stream ), preload ); setCurrentSource( new MediaStream( stream ) );
} }
void void
AudioOutput::setCurrentSource( QIODevice* stream, bool preload ) AudioOutput::setCurrentSource( QIODevice* stream )
{ {
setCurrentSource( new MediaStream( stream ), preload ); setCurrentSource( new MediaStream( stream ) );
} }
@@ -331,24 +256,29 @@ readDoneCallback( void* data, const char* cookie, size_t bufferSize, void* buffe
void void
AudioOutput::setCurrentSource( MediaStream* stream, bool preload ) AudioOutput::setCurrentSource( MediaStream* stream )
{ {
tDebug() << Q_FUNC_INFO << ", preload = " << preload; tDebug() << Q_FUNC_INFO;
if ( !preload ) setState( Loading );
setState( Loading );
if ( m_vlcPreloadedMedia ) { if ( m_vlcMedia != nullptr )
libvlc_media_player_stop( m_vlcPreloadedPlayer );
libvlc_media_release( m_vlcPreloadedMedia );
m_vlcPreloadedMedia = nullptr;
}
if ( m_preloadedAutoDelete && m_preloadedStream != nullptr )
{ {
delete m_preloadedStream; // Ensure playback is stopped, then release media
libvlc_media_player_stop( m_vlcPlayer );
libvlc_media_release( m_vlcMedia );
m_vlcMedia = nullptr;
}
if ( m_autoDelete && m_currentStream != nullptr )
{
delete m_currentStream;
} }
m_preloadedStream = stream; m_currentStream = stream;
m_totalTime = 0;
m_currentTime = 0;
m_justSeeked = false;
m_seekable = true;
QByteArray url; QByteArray url;
switch ( stream->type() ) switch ( stream->type() )
@@ -382,19 +312,23 @@ AudioOutput::setCurrentSource( MediaStream* stream, bool preload )
tDebug() << Q_FUNC_INFO << "MediaStream::Final Url:" << url; tDebug() << Q_FUNC_INFO << "MediaStream::Final Url:" << url;
m_vlcPreloadedMedia = libvlc_media_new_location( m_vlcInstance, url.constData() ); m_vlcMedia = libvlc_media_new_location( m_vlcInstance, url.constData() );
if ( stream->type() == MediaStream::Stream || stream->type() == MediaStream::IODevice ) if ( stream->type() == MediaStream::Url )
{
m_totalTime = libvlc_media_get_duration( m_vlcMedia );
}
else if ( stream->type() == MediaStream::Stream || stream->type() == MediaStream::IODevice )
{ {
QString tempString; QString tempString;
libvlc_media_add_option_flag(m_vlcPreloadedMedia, "imem-cat=4", libvlc_media_option_trusted); libvlc_media_add_option_flag(m_vlcMedia, "imem-cat=4", libvlc_media_option_trusted);
tempString = QString( "imem-data=%1" ).arg( (uintptr_t)stream ); tempString = QString( "imem-data=%1" ).arg( (uintptr_t)stream );
libvlc_media_add_option_flag(m_vlcPreloadedMedia, tempString.toLatin1().constData(), libvlc_media_option_trusted); libvlc_media_add_option_flag(m_vlcMedia, tempString.toLatin1().constData(), libvlc_media_option_trusted);
tempString = QString( "imem-get=%1" ).arg( (uintptr_t)&readCallback ); tempString = QString( "imem-get=%1" ).arg( (uintptr_t)&readCallback );
libvlc_media_add_option_flag(m_vlcPreloadedMedia, tempString.toLatin1().constData(), libvlc_media_option_trusted); libvlc_media_add_option_flag(m_vlcMedia, tempString.toLatin1().constData(), libvlc_media_option_trusted);
tempString = QString( "imem-release=%1" ).arg( (uintptr_t)&readDoneCallback ); tempString = QString( "imem-release=%1" ).arg( (uintptr_t)&readDoneCallback );
libvlc_media_add_option_flag(m_vlcPreloadedMedia, tempString.toLatin1().constData(), libvlc_media_option_trusted); libvlc_media_add_option_flag(m_vlcMedia, tempString.toLatin1().constData(), libvlc_media_option_trusted);
tempString = QString( "imem-seek=%1" ).arg( (uintptr_t)&MediaStream::seekCallback ); tempString = QString( "imem-seek=%1" ).arg( (uintptr_t)&MediaStream::seekCallback );
libvlc_media_add_option_flag(m_vlcPreloadedMedia, tempString.toLatin1().constData(), libvlc_media_option_trusted); libvlc_media_add_option_flag(m_vlcMedia, tempString.toLatin1().constData(), libvlc_media_option_trusted);
} }
if ( qApp->arguments().contains( "--chromecast-ip" ) ) if ( qApp->arguments().contains( "--chromecast-ip" ) )
{ {
@@ -410,7 +344,7 @@ AudioOutput::setCurrentSource( MediaStream* stream, bool preload )
{ {
QString castIP = qApp->arguments().at( qApp->arguments().indexOf( "--chromecast-ip" ) + 1 ); QString castIP = qApp->arguments().at( qApp->arguments().indexOf( "--chromecast-ip" ) + 1 );
QString sout( ":sout=#transcode{vcodec=none,acodec=vorb,ab=320,channels=2,samplerate=44100}:chromecast{ip=%1,mux=webm}" ); QString sout( ":sout=#transcode{vcodec=none,acodec=vorb,ab=320,channels=2,samplerate=44100}:chromecast{ip=%1,mux=webm}" );
libvlc_media_add_option( m_vlcPreloadedMedia, sout.arg( castIP ).toLatin1().constData() ); libvlc_media_add_option( m_vlcMedia, sout.arg( castIP ).toLatin1().constData() );
} }
else else
{ {
@@ -418,8 +352,8 @@ AudioOutput::setCurrentSource( MediaStream* stream, bool preload )
} }
} }
libvlc_event_manager_t* manager = libvlc_media_event_manager( m_vlcPreloadedMedia ); libvlc_event_manager_t* manager = libvlc_media_event_manager( m_vlcMedia );
static libvlc_event_type_t events[] = { libvlc_event_type_t events[] = {
libvlc_MediaDurationChanged, libvlc_MediaDurationChanged,
}; };
const int eventCount = sizeof(events) / sizeof( *events ); const int eventCount = sizeof(events) / sizeof( *events );
@@ -428,13 +362,7 @@ AudioOutput::setCurrentSource( MediaStream* stream, bool preload )
libvlc_event_attach( manager, events[ i ], &AudioOutput::vlcEventCallback, this ); libvlc_event_attach( manager, events[ i ], &AudioOutput::vlcEventCallback, this );
} }
libvlc_media_player_set_media( m_vlcPreloadedPlayer, m_vlcPreloadedMedia ); libvlc_media_player_set_media( m_vlcPlayer, m_vlcMedia );
libvlc_audio_set_volume( m_vlcPreloadedPlayer, 0.0 );
libvlc_media_player_play( m_vlcPreloadedPlayer );
if ( !preload )
switchToPreloadedMedia();
// setState( Stopped ); // setState( Stopped );
} }
@@ -443,7 +371,7 @@ AudioOutput::setCurrentSource( MediaStream* stream, bool preload )
bool bool
AudioOutput::isInitialized() const AudioOutput::isInitialized() const
{ {
return m_initialized > 1; return m_initialized;
} }
@@ -596,7 +524,7 @@ AudioOutput::seek( qint64 milliseconds )
bool bool
AudioOutput::isSeekable() const AudioOutput::isSeekable() const
{ {
tDebug() << Q_FUNC_INFO << m_seekable << m_havePosition << m_totalTime << libvlc_media_player_is_seekable( m_vlcPlayer ); // tDebug() << Q_FUNC_INFO << m_seekable << m_havePosition << m_totalTime << libvlc_media_player_is_seekable( m_vlcPlayer );
return m_havePosition || (libvlc_media_player_is_seekable( m_vlcPlayer ) && m_totalTime > 0 ); return m_havePosition || (libvlc_media_player_is_seekable( m_vlcPlayer ) && m_totalTime > 0 );
} }
@@ -646,107 +574,64 @@ AudioOutput::setVolume( qreal vol )
void void
AudioOutput::onVlcEvent( const libvlc_event_t* event ) AudioOutput::onVlcEvent( const libvlc_event_t* event )
{ {
if ( event->p_obj == m_vlcPlayer || event->p_obj == m_vlcMedia ) switch ( event->type )
{ {
switch ( event->type ) case libvlc_MediaPlayerTimeChanged:
{ setCurrentTime( event->u.media_player_time_changed.new_time );
case libvlc_MediaPlayerTimeChanged: break;
setCurrentTime( event->u.media_player_time_changed.new_time ); case libvlc_MediaPlayerPositionChanged:
break; setCurrentPosition( event->u.media_player_position_changed.new_position );
case libvlc_MediaPlayerPositionChanged: break;
setCurrentPosition( event->u.media_player_position_changed.new_position ); case libvlc_MediaPlayerSeekableChanged:
break; // tDebug() << Q_FUNC_INFO << " : seekable changed : " << event->u.media_player_seekable_changed.new_seekable;
case libvlc_MediaPlayerSeekableChanged: break;
// tDebug() << Q_FUNC_INFO << " : seekable changed : " << event->u.media_player_seekable_changed.new_seekable; case libvlc_MediaDurationChanged:
break; setTotalTime( event->u.media_duration_changed.new_duration );
case libvlc_MediaDurationChanged: break;
setTotalTime( event->u.media_duration_changed.new_duration ); case libvlc_MediaPlayerLengthChanged:
break; // tDebug() << Q_FUNC_INFO << " : length changed : " << event->u.media_player_length_changed.new_length;
case libvlc_MediaPlayerLengthChanged: break;
// tDebug() << Q_FUNC_INFO << " : length changed : " << event->u.media_player_length_changed.new_length; case libvlc_MediaPlayerPlaying:
break; setState( Playing );
case libvlc_MediaPlayerPlaying: break;
setState( Playing ); case libvlc_MediaPlayerPaused:
break; setState( Paused );
case libvlc_MediaPlayerPaused: break;
setState( Paused ); case libvlc_MediaPlayerEndReached:
break; setState( Stopped );
case libvlc_MediaPlayerEndReached: break;
setState( Stopped ); case libvlc_MediaPlayerEncounteredError:
break; tDebug() << Q_FUNC_INFO << "LibVLC error: MediaPlayerEncounteredError. Stopping";
case libvlc_MediaPlayerEncounteredError: // Don't call stop() here - it will deadlock libvlc
tDebug() << Q_FUNC_INFO << "LibVLC error: MediaPlayerEncounteredError. Stopping"; setState( Error );
// Don't call stop() here - it will deadlock libvlc break;
setState( Error );
break;
#if (LIBVLC_VERSION_INT >= LIBVLC_VERSION(2, 2, 2, 0)) #if (LIBVLC_VERSION_INT >= LIBVLC_VERSION(2, 2, 2, 0))
case libvlc_MediaPlayerAudioVolume: case libvlc_MediaPlayerAudioVolume:
m_volume = event->u.media_player_audio_volume.volume; m_volume = event->u.media_player_audio_volume.volume;
tDebug() << Q_FUNC_INFO << "Got signal in current player that volume changed to:" << m_volume; emit volumeChanged( volume() );
emit volumeChanged( volume() ); break;
break; case libvlc_MediaPlayerMuted:
case libvlc_MediaPlayerMuted: m_muted = true;
m_muted = true; emit mutedChanged( true );
emit mutedChanged( true ); break;
break; case libvlc_MediaPlayerUnmuted:
case libvlc_MediaPlayerUnmuted: m_muted = false;
m_muted = false; emit mutedChanged( false );
emit mutedChanged( false ); break;
break;
#endif #endif
case libvlc_MediaPlayerNothingSpecial: case libvlc_MediaPlayerNothingSpecial:
case libvlc_MediaPlayerOpening: case libvlc_MediaPlayerOpening:
case libvlc_MediaPlayerBuffering: case libvlc_MediaPlayerBuffering:
case libvlc_MediaPlayerStopped: case libvlc_MediaPlayerStopped:
case libvlc_MediaPlayerVout: case libvlc_MediaPlayerVout:
case libvlc_MediaPlayerMediaChanged: case libvlc_MediaPlayerMediaChanged:
case libvlc_MediaPlayerForward: case libvlc_MediaPlayerForward:
case libvlc_MediaPlayerBackward: case libvlc_MediaPlayerBackward:
case libvlc_MediaPlayerPausableChanged: case libvlc_MediaPlayerPausableChanged:
case libvlc_MediaPlayerTitleChanged: case libvlc_MediaPlayerTitleChanged:
case libvlc_MediaPlayerSnapshotTaken: case libvlc_MediaPlayerSnapshotTaken:
default: default:
break; break;
}
}
else
{
tDebug() << "Event for preloaded: " << libvlc_event_type_name(event->type);
switch ( event->type )
{
case libvlc_MediaPlayerPausableChanged:
case libvlc_MediaPlayerPlaying:
case libvlc_MediaPlayerMediaChanged:
case libvlc_MediaPlayerTitleChanged:
case libvlc_MediaPlayerSeekableChanged:
case libvlc_MediaDurationChanged:
case libvlc_MediaPlayerPositionChanged:
case libvlc_MediaPlayerPaused:
case libvlc_MediaPlayerBuffering:
libvlc_media_player_set_pause( m_vlcPreloadedPlayer, 1 );
libvlc_audio_set_volume( m_vlcPreloadedPlayer, 0.0 );
libvlc_media_player_set_position( m_vlcPreloadedPlayer, 0.0 );
break;
case libvlc_MediaPlayerTimeChanged:
case libvlc_MediaPlayerLengthChanged:
case libvlc_MediaPlayerOpening:
case libvlc_MediaPlayerEndReached:
case libvlc_MediaPlayerEncounteredError:
//TODO
#if (LIBVLC_VERSION_INT >= LIBVLC_VERSION(2, 2, 2, 0))
case libvlc_MediaPlayerAudioVolume:
case libvlc_MediaPlayerMuted:
case libvlc_MediaPlayerUnmuted:
#endif
case libvlc_MediaPlayerNothingSpecial:
case libvlc_MediaPlayerStopped:
case libvlc_MediaPlayerVout:
case libvlc_MediaPlayerForward:
case libvlc_MediaPlayerBackward:
case libvlc_MediaPlayerSnapshotTaken:
default:
break;
}
} }
} }

View File

@@ -49,10 +49,9 @@ public:
bool isInitialized() const; bool isInitialized() const;
AudioState state() const; AudioState state() const;
void setCurrentSource( const QUrl& stream, bool preload ); void setCurrentSource( const QUrl& stream );
void setCurrentSource( QIODevice* stream, bool preload ); void setCurrentSource( QIODevice* stream );
void setCurrentSource( MediaStream* stream, bool preload ); void setCurrentSource( MediaStream* stream );
void setPreloadedSourceAsCurrent( void );
void play(); void play();
void pause(); void pause();
@@ -66,15 +65,13 @@ public:
qreal volume() const; qreal volume() const;
qint64 currentTime() const; qint64 currentTime() const;
qint64 totalTime() const; qint64 totalTime() const;
void setAutoDelete ( bool ad, bool preload ); void setAutoDelete ( bool ad );
void setDspCallback( std::function< void( int, int, float*, int, int ) > cb ); void setDspCallback( std::function< void( int, int, float*, int, int ) > cb );
static AudioOutput* instance(); static AudioOutput* instance();
libvlc_instance_t* vlcInstance() const; libvlc_instance_t* vlcInstance() const;
void switchToPreloadedMedia( void );
public slots: public slots:
signals: signals:
@@ -93,7 +90,6 @@ private:
void setCurrentPosition( float position ); void setCurrentPosition( float position );
void setTotalTime( qint64 time ); void setTotalTime( qint64 time );
void onVlcEvent( const libvlc_event_t* event ); void onVlcEvent( const libvlc_event_t* event );
static void vlcEventCallback( const libvlc_event_t* event, void* opaque ); static void vlcEventCallback( const libvlc_event_t* event, void* opaque );
static void s_dspCallback( int frameNumber, float* samples, int nb_channels, int nb_samples ); static void s_dspCallback( int frameNumber, float* samples, int nb_channels, int nb_samples );
@@ -101,11 +97,9 @@ private:
static AudioOutput* s_instance; static AudioOutput* s_instance;
AudioState m_currentState; AudioState m_currentState;
MediaStream* m_currentStream; MediaStream* m_currentStream;
MediaStream* m_preloadedStream;
bool m_seekable; bool m_seekable;
bool m_muted; bool m_muted;
bool m_autoDelete; bool m_autoDelete;
bool m_preloadedAutoDelete;
bool m_havePosition; bool m_havePosition;
bool m_haveTiming; bool m_haveTiming;
qreal m_volume; qreal m_volume;
@@ -113,7 +107,7 @@ private:
qint64 m_totalTime; qint64 m_totalTime;
bool m_justSeeked; bool m_justSeeked;
int m_initialized; bool m_initialized;
QFile m_silenceFile; QFile m_silenceFile;
std::function< void( int state, int frameNumber, float* samples, int nb_channels, int nb_samples ) > dspPluginCallback; std::function< void( int state, int frameNumber, float* samples, int nb_channels, int nb_samples ) > dspPluginCallback;
@@ -121,9 +115,6 @@ private:
libvlc_instance_t* m_vlcInstance; libvlc_instance_t* m_vlcInstance;
libvlc_media_player_t* m_vlcPlayer; libvlc_media_player_t* m_vlcPlayer;
libvlc_media_t* m_vlcMedia; libvlc_media_t* m_vlcMedia;
libvlc_media_player_t* m_vlcBackPlayer;
libvlc_media_player_t* m_vlcPreloadedPlayer;
libvlc_media_t* m_vlcPreloadedMedia;
}; };
#endif // AUDIOOUTPUT_H #endif // AUDIOOUTPUT_H

View File

@@ -43,11 +43,6 @@
#include "DatabaseCommand_SetCollectionAttributes.h" #include "DatabaseCommand_SetCollectionAttributes.h"
#include "DatabaseCommand_SetTrackAttributes.h" #include "DatabaseCommand_SetTrackAttributes.h"
// Forward Declarations breaking QSharedPointer
#if QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 )
#include "collection/Collection.h"
#endif
#define DEFAULT_WORKER_THREADS 4 #define DEFAULT_WORKER_THREADS 4
#define MAX_WORKER_THREADS 16 #define MAX_WORKER_THREADS 16

View File

@@ -25,11 +25,6 @@
#include "PlaylistEntry.h" #include "PlaylistEntry.h"
#include "SourceList.h" #include "SourceList.h"
// Forward Declarations breaking QSharedPointer
#if QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 )
#include "collection/Collection.h"
#endif
using namespace Tomahawk; using namespace Tomahawk;

View File

@@ -24,10 +24,6 @@
#include <QSqlQuery> #include <QSqlQuery>
// Forward Declarations breaking QSharedPointer
#if QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 )
#include "collection/Collection.h"
#endif
using namespace Tomahawk; using namespace Tomahawk;

View File

@@ -21,11 +21,6 @@
#include "Query.h" #include "Query.h"
#include "Track.h" #include "Track.h"
// Forward Declarations breaking QSharedPointer
#if QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 )
#include "Source.h"
#endif
namespace Tomahawk namespace Tomahawk
{ {

View File

@@ -87,9 +87,4 @@ private:
} }
#if QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 )
// Qt5 automatically generated this Metatype
Q_DECLARE_METATYPE(QList<QStringList>)
#endif
#endif // DATABASECOMMAND_GENERICSELECT_H #endif // DATABASECOMMAND_GENERICSELECT_H

View File

@@ -21,11 +21,6 @@
#include "Query.h" #include "Query.h"
#include "Track.h" #include "Track.h"
// Forward Declarations breaking QSharedPointer
#if QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 )
#include "Source.h"
#endif
namespace Tomahawk namespace Tomahawk
{ {

View File

@@ -22,11 +22,6 @@
#include "DatabaseImpl.h" #include "DatabaseImpl.h"
#include "TomahawkSqlQuery.h" #include "TomahawkSqlQuery.h"
// Forward Declarations breaking QSharedPointer
#if QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 )
#include "Source.h"
#endif
namespace Tomahawk namespace Tomahawk
{ {

View File

@@ -25,10 +25,6 @@
#include "PlaylistEntry.h" #include "PlaylistEntry.h"
#include "SourceList.h" #include "SourceList.h"
// Forward Declarations breaking QSharedPointer
#if QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 )
#include "collection/Collection.h"
#endif
using namespace Tomahawk; using namespace Tomahawk;

View File

@@ -54,7 +54,7 @@ ACLJobDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, co
if ( !item ) if ( !item )
return; return;
//tDebug( LOGVERBOSE ) << Q_FUNC_INFO; //tDebug( LOGVERBOSE ) << Q_FUNC_INFO;
QStyleOptionViewItemV4 opt = option; QStyleOptionViewItem opt = option;
initStyleOption( &opt, index ); initStyleOption( &opt, index );
QFontMetrics fm( opt.font ); QFontMetrics fm( opt.font );

View File

@@ -29,11 +29,6 @@
#include <QTimer> #include <QTimer>
// Forward Declarations breaking QSharedPointer
#if QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 )
#include "Source.h"
#endif
InboxJobItem::InboxJobItem( Side side, InboxJobItem::InboxJobItem( Side side,

View File

@@ -47,7 +47,7 @@ JobStatusDelegate::~JobStatusDelegate()
void void
JobStatusDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const JobStatusDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const
{ {
QStyleOptionViewItemV4 opt = option; QStyleOptionViewItem opt = option;
initStyleOption( &opt, index ); initStyleOption( &opt, index );
QFontMetrics fm( painter->font() ); QFontMetrics fm( painter->font() );
const bool allowMultiLine = index.data( JobStatusModel::AllowMultiLineRole ).toBool(); const bool allowMultiLine = index.data( JobStatusModel::AllowMultiLineRole ).toBool();
@@ -106,7 +106,7 @@ JobStatusDelegate::sizeHint( const QStyleOptionViewItem& option, const QModelInd
return QSize( QStyledItemDelegate::sizeHint( option, index ).width(), m_cachedMultiLineHeights[ index ] ); return QSize( QStyledItemDelegate::sizeHint( option, index ).width(), m_cachedMultiLineHeights[ index ] );
// Don't elide, but stretch across as many rows as required // Don't elide, but stretch across as many rows as required
QStyleOptionViewItemV4 opt = option; QStyleOptionViewItem opt = option;
initStyleOption( &opt, index ); initStyleOption( &opt, index );
const QString text = index.data( Qt::DisplayRole ).toString(); const QString text = index.data( Qt::DisplayRole ).toString();

View File

@@ -31,12 +31,6 @@
#include "Track.h" #include "Track.h"
// Forward Declarations breaking QSharedPointer
#if QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 )
#include "collection/Collection.h"
#endif
TransferStatusItem::TransferStatusItem( TransferStatusManager* p, StreamConnection* sc ) TransferStatusItem::TransferStatusItem( TransferStatusManager* p, StreamConnection* sc )
: m_parent( p ) : m_parent( p )
, m_stream( QPointer< StreamConnection >( sc ) ) , m_stream( QPointer< StreamConnection >( sc ) )

View File

@@ -23,10 +23,6 @@
#include "utils/Logger.h" #include "utils/Logger.h"
#if QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 )
#include "Msg.h"
#endif
void void
QTcpSocketExtra::connectToHost( const QHostAddress& host, quint16 port, OpenMode openMode ) QTcpSocketExtra::connectToHost( const QHostAddress& host, quint16 port, OpenMode openMode )
{ {

View File

@@ -576,11 +576,7 @@ Servent::handleSipInfo( const Tomahawk::peerinfo_ptr& peerInfo )
void void
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
Servent::incomingConnection( qintptr sd ) Servent::incomingConnection( qintptr sd )
#else
Servent::incomingConnection( int sd )
#endif
{ {
Q_ASSERT( this->thread() == QThread::currentThread() ); Q_ASSERT( this->thread() == QThread::currentThread() );

View File

@@ -157,11 +157,7 @@ signals:
void ready(); void ready();
protected: protected:
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
void incomingConnection( qintptr sd ) Q_DECL_OVERRIDE; void incomingConnection( qintptr sd ) Q_DECL_OVERRIDE;
#else
void incomingConnection( int sd ) Q_DECL_OVERRIDE;
#endif
public slots: public slots:
void setExternalAddress( QHostAddress ha, unsigned int port ); void setExternalAddress( QHostAddress ha, unsigned int port );

View File

@@ -108,7 +108,7 @@ ColumnItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option
QColor textColor = TomahawkUtils::alphaBlend( option.palette.color( QPalette::Foreground ), option.palette.color( QPalette::Background ), opacity ); QColor textColor = TomahawkUtils::alphaBlend( option.palette.color( QPalette::Foreground ), option.palette.color( QPalette::Background ), opacity );
{ {
QStyleOptionViewItemV4 o = option; QStyleOptionViewItem o = option;
initStyleOption( &o, QModelIndex() ); initStyleOption( &o, QModelIndex() );
painter->save(); painter->save();
@@ -190,7 +190,7 @@ ColumnItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option
if ( text.trimmed().isEmpty() ) if ( text.trimmed().isEmpty() )
text = tr( "Unknown" ); text = tr( "Unknown" );
QStyleOptionViewItemV4 opt = option; QStyleOptionViewItem opt = option;
initStyleOption( &opt, QModelIndex() ); initStyleOption( &opt, QModelIndex() );
const QModelIndex curIndex = m_view->currentIndex(); const QModelIndex curIndex = m_view->currentIndex();

View File

@@ -129,7 +129,7 @@ GridItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option,
if ( !item || !index.isValid() ) if ( !item || !index.isValid() )
return; return;
QStyleOptionViewItemV4 opt = option; QStyleOptionViewItem opt = option;
initStyleOption( &opt, QModelIndex() ); initStyleOption( &opt, QModelIndex() );
// qApp->style()->drawControl( QStyle::CE_ItemViewItem, &opt, painter ); // qApp->style()->drawControl( QStyle::CE_ItemViewItem, &opt, painter );

View File

@@ -106,7 +106,7 @@ PlaylistItemDelegate::sizeHint( const QStyleOptionViewItem& option, const QModel
void void
PlaylistItemDelegate::prepareStyleOption( QStyleOptionViewItemV4* option, const QModelIndex& index, PlayableItem* item ) const PlaylistItemDelegate::prepareStyleOption( QStyleOptionViewItem* option, const QModelIndex& index, PlayableItem* item ) const
{ {
initStyleOption( option, index ); initStyleOption( option, index );
@@ -176,7 +176,7 @@ PlaylistItemDelegate::paintDetailed( QPainter* painter, const QStyleOptionViewIt
QTextOption textOption( Qt::AlignVCenter | (Qt::Alignment)index.data( Qt::TextAlignmentRole ).toUInt() ); QTextOption textOption( Qt::AlignVCenter | (Qt::Alignment)index.data( Qt::TextAlignmentRole ).toUInt() );
textOption.setWrapMode( QTextOption::NoWrap ); textOption.setWrapMode( QTextOption::NoWrap );
QStyleOptionViewItemV4 opt = option; QStyleOptionViewItem opt = option;
prepareStyleOption( &opt, index, item ); prepareStyleOption( &opt, index, item );
opt.text.clear(); opt.text.clear();
qApp->style()->drawControl( QStyle::CE_ItemViewItem, &opt, painter ); qApp->style()->drawControl( QStyle::CE_ItemViewItem, &opt, painter );

View File

@@ -59,7 +59,7 @@ private slots:
void doUpdateIndex( const QPersistentModelIndex& index ); void doUpdateIndex( const QPersistentModelIndex& index );
protected: protected:
void prepareStyleOption( QStyleOptionViewItemV4* option, const QModelIndex& index, PlayableItem* item ) const; void prepareStyleOption( QStyleOptionViewItem* option, const QModelIndex& index, PlayableItem* item ) const;
void paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const; void paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const;
QWidget* createEditor( QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index ) const; QWidget* createEditor( QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index ) const;

View File

@@ -40,11 +40,6 @@
#include "utils/TomahawkUtilsGui.h" #include "utils/TomahawkUtilsGui.h"
#include "utils/Logger.h" #include "utils/Logger.h"
// Forward Declarations breaking QSharedPointer
#if QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 )
#include "utils/PixmapDelegateFader.h"
#endif
using namespace Tomahawk; using namespace Tomahawk;
@@ -98,7 +93,7 @@ TrackItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option,
PlayableItem* item = m_model->itemFromIndex( m_model->mapToSource( index ) ); PlayableItem* item = m_model->itemFromIndex( m_model->mapToSource( index ) );
Q_ASSERT( item ); Q_ASSERT( item );
QStyleOptionViewItemV4 opt = option; QStyleOptionViewItem opt = option;
prepareStyleOption( &opt, index, item ); prepareStyleOption( &opt, index, item );
if ( item->source() ) if ( item->source() )

View File

@@ -36,12 +36,6 @@
#include "utils/Logger.h" #include "utils/Logger.h"
#include "InboxModel.h" #include "InboxModel.h"
// Forward Declarations breaking QSharedPointer
#if QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 )
#include "collection/Collection.h"
#include "utils/PixmapDelegateFader.h"
#endif
#include <QKeyEvent> #include <QKeyEvent>
#include <QPainter> #include <QPainter>
#include <QScrollBar> #include <QScrollBar>

View File

@@ -35,13 +35,8 @@ ViewHeader::ViewHeader( QAbstractItemView* parent )
{ {
m_menu->setFont( TomahawkUtils::systemFont() ); m_menu->setFont( TomahawkUtils::systemFont() );
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
setSectionResizeMode( QHeaderView::Interactive ); setSectionResizeMode( QHeaderView::Interactive );
setSectionsMovable( true ); setSectionsMovable( true );
#else
setResizeMode( QHeaderView::Interactive );
setMovable( true );
#endif
setMinimumSectionSize( 60 ); setMinimumSectionSize( 60 );
setDefaultAlignment( Qt::AlignLeft ); setDefaultAlignment( Qt::AlignLeft );
setStretchLastSection( true ); setStretchLastSection( true );

View File

@@ -286,7 +286,7 @@ DynamicView::backgroundBetween( QRect rect, int rowStart )
QPixmap bg = QPixmap( rect.size() ); QPixmap bg = QPixmap( rect.size() );
bg.fill( Qt::white ); bg.fill( Qt::white );
QPainter p( &bg ); QPainter p( &bg );
QStyleOptionViewItemV4 opt = viewOptions(); QStyleOptionViewItem opt = viewOptions();
// code taken from QTreeViewPrivate::paintAlternatingRowColors // code taken from QTreeViewPrivate::paintAlternatingRowColors
m_fadebg = !style()->styleHint( QStyle::SH_ItemView_PaintAlternatingRowColorsForEmptyArea, &opt ); m_fadebg = !style()->styleHint( QStyle::SH_ItemView_PaintAlternatingRowColorsForEmptyArea, &opt );
// qDebug() << "PAINTING ALTERNATING ROW BG!: " << fadingRectViewport; // qDebug() << "PAINTING ALTERNATING ROW BG!: " << fadingRectViewport;
@@ -299,9 +299,9 @@ DynamicView::backgroundBetween( QRect rect, int rowStart )
// qDebug() << "PAINTING BG ROW IN RECT" << y << "to" << y + rowHeight << ":" << opt.rect; // qDebug() << "PAINTING BG ROW IN RECT" << y << "to" << y + rowHeight << ":" << opt.rect;
if ( current & 1 ) if ( current & 1 )
{ {
opt.features |= QStyleOptionViewItemV2::Alternate; opt.features |= QStyleOptionViewItem::Alternate;
} else { } else {
opt.features &= ~QStyleOptionViewItemV2::Alternate; opt.features &= ~QStyleOptionViewItem::Alternate;
} }
++current; ++current;
style()->drawPrimitive( QStyle::PE_PanelItemViewRow, &opt, &p ); style()->drawPrimitive( QStyle::PE_PanelItemViewRow, &opt, &p );

View File

@@ -24,11 +24,7 @@
#include <QTimer> #include <QTimer>
#include <QPointer> #include <QPointer>
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
#include <echonest5/Playlist.h> #include <echonest5/Playlist.h>
#else
#include <echonest/Playlist.h>
#endif
namespace Tomahawk namespace Tomahawk
{ {

View File

@@ -28,14 +28,8 @@
#include "DllMacro.h" #include "DllMacro.h"
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
#include <echonest5/Playlist.h> #include <echonest5/Playlist.h>
#include <echonest5/Genre.h> #include <echonest5/Genre.h>
#else
#include <echonest/Playlist.h>
#include <echonest/Genre.h>
#endif
namespace Tomahawk namespace Tomahawk
{ {

View File

@@ -24,11 +24,7 @@
#include "utils/TomahawkUtils.h" #include "utils/TomahawkUtils.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
#include <echonest5/Playlist.h> #include <echonest5/Playlist.h>
#else
#include <echonest/Playlist.h>
#endif
#include <QPaintEvent> #include <QPaintEvent>
#include <QHBoxLayout> #include <QHBoxLayout>

View File

@@ -95,11 +95,9 @@ Tomahawk::ExternalResolverGui::setupClickHandlerOnUrlButtons( QObject* widget )
QPushButton* button = qobject_cast< QPushButton* >( widget ); QPushButton* button = qobject_cast< QPushButton* >( widget );
Q_ASSERT( button ); Q_ASSERT( button );
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
connect( button, &QPushButton::clicked, [=]() { connect( button, &QPushButton::clicked, [=]() {
QDesktopServices::openUrl( widget->property( "url" ).toUrl() ); QDesktopServices::openUrl( widget->property( "url" ).toUrl() );
}); });
#endif
} }
// and recurse // and recurse

View File

@@ -190,7 +190,7 @@ JSAccount::reportNativeScriptJobResult( int resultId, const QVariantMap& result
.arg( serializeQVariantMap( result ) ); .arg( serializeQVariantMap( result ) );
// Remove when new scripting api turned out to work reliably // Remove when new scripting api turned out to work reliably
//tDebug( LOGVERBOSE ) << Q_FUNC_INFO << eval; tDebug( LOGVERBOSE ) << Q_FUNC_INFO << eval;
evaluateJavaScript( eval ); evaluateJavaScript( eval );
} }

View File

@@ -29,9 +29,7 @@ THE SOFTWARE.
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QMacCocoaViewContainer> #include <QMacCocoaViewContainer>
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
#include <qmacfunctions.h> #include <qmacfunctions.h>
#endif
static inline NSString* fromQString(const QString &string) static inline NSString* fromQString(const QString &string)
{ {
@@ -49,11 +47,7 @@ static inline QString toQString(NSString *string)
static inline NSImage* fromQPixmap(const QPixmap &pixmap) static inline NSImage* fromQPixmap(const QPixmap &pixmap)
{ {
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
CGImageRef cgImage = pixmap.toMacCGImageRef();
#else
CGImageRef cgImage = QtMac::toCGImageRef(pixmap); CGImageRef cgImage = QtMac::toCGImageRef(pixmap);
#endif
return [[[NSImage alloc] initWithCGImage:cgImage size:NSZeroSize] autorelease]; return [[[NSImage alloc] initWithCGImage:cgImage size:NSZeroSize] autorelease];
} }

View File

@@ -192,11 +192,7 @@ void QSearchField::setMenu(QMenu *menu)
if (!pimpl) if (!pimpl)
return; return;
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
NSMenu *nsMenu = menu->macMenu();
#else
NSMenu *nsMenu = menu->toNSMenu(); NSMenu *nsMenu = menu->toNSMenu();
#endif
[[pimpl->nsSearchField cell] setSearchMenuTemplate:nsMenu]; [[pimpl->nsSearchField cell] setSearchMenuTemplate:nsMenu];
} }

View File

@@ -36,11 +36,6 @@
#include <QNetworkAccessManager> #include <QNetworkAccessManager>
#include <QRegExp> #include <QRegExp>
// Forward Declarations breaking QSharedPointer
#if QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 )
#include "Playlist.h"
#endif
using namespace Tomahawk; using namespace Tomahawk;

View File

@@ -18,16 +18,9 @@
#include "Json.h" #include "Json.h"
// Qt version specific includes #include <QJsonDocument>
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 ) #include <QMetaProperty>
#include <QJsonDocument> #include <QVariantHash>
#include <QMetaProperty>
#include <QVariantHash>
#else
#include <qjson/parser.h>
#include <qjson/qobjecthelper.h>
#include <qjson/serializer.h>
#endif
namespace TomahawkUtils namespace TomahawkUtils
{ {
@@ -35,7 +28,6 @@ namespace TomahawkUtils
QVariantMap QVariantMap
qobject2qvariant( const QObject* object ) qobject2qvariant( const QObject* object )
{ {
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
QVariantMap map; QVariantMap map;
if ( object == NULL ) if ( object == NULL )
{ {
@@ -52,16 +44,12 @@ qobject2qvariant( const QObject* object )
} }
} }
return map; return map;
#else
return QJson::QObjectHelper::qobject2qvariant( object );
#endif
} }
void void
qvariant2qobject( const QVariantMap& variant, QObject* object ) qvariant2qobject( const QVariantMap& variant, QObject* object )
{ {
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
for ( QVariantMap::const_iterator iter = variant.begin(); iter != variant.end(); ++iter ) for ( QVariantMap::const_iterator iter = variant.begin(); iter != variant.end(); ++iter )
{ {
QVariant property = object->property( iter.key().toLatin1() ); QVariant property = object->property( iter.key().toLatin1() );
@@ -78,16 +66,12 @@ qvariant2qobject( const QVariantMap& variant, QObject* object )
} }
} }
} }
#else
QJson::QObjectHelper::qvariant2qobject( variant, object );
#endif
} }
QVariant QVariant
parseJson( const QByteArray& jsonData, bool* ok ) parseJson( const QByteArray& jsonData, bool* ok )
{ {
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
QJsonParseError error; QJsonParseError error;
QJsonDocument doc = QJsonDocument::fromJson( jsonData, &error ); QJsonDocument doc = QJsonDocument::fromJson( jsonData, &error );
if ( ok != NULL ) if ( ok != NULL )
@@ -95,17 +79,12 @@ parseJson( const QByteArray& jsonData, bool* ok )
*ok = ( error.error == QJsonParseError::NoError ); *ok = ( error.error == QJsonParseError::NoError );
} }
return doc.toVariant(); return doc.toVariant();
#else
QJson::Parser p;
return p.parse( jsonData, ok );
#endif
} }
QByteArray QByteArray
toJson( const QVariant &variant, bool* ok ) toJson( const QVariant &variant, bool* ok )
{ {
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
QVariant _variant = variant; QVariant _variant = variant;
if ( variant.type() == QVariant::Hash ) if ( variant.type() == QVariant::Hash )
{ {
@@ -127,10 +106,6 @@ toJson( const QVariant &variant, bool* ok )
*ok = !doc.isNull(); *ok = !doc.isNull();
} }
return doc.toJson( QJsonDocument::Compact ); return doc.toJson( QJsonDocument::Compact );
#else
QJson::Serializer serializer;
return serializer.serialize( variant, ok );
#endif
} }
} }

View File

@@ -128,20 +128,12 @@ log( const char *msg, unsigned int debugLevel, bool toDisk = true )
void void
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
TomahawkLogHandler( QtMsgType type, const QMessageLogContext& context, const QString& msg ) TomahawkLogHandler( QtMsgType type, const QMessageLogContext& context, const QString& msg )
#else
TomahawkLogHandler( QtMsgType type, const char* msg )
#endif
{ {
static QMutex s_mutex; static QMutex s_mutex;
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
QByteArray ba = msg.toUtf8(); QByteArray ba = msg.toUtf8();
const char* message = ba.constData(); const char* message = ba.constData();
#else
const char* message = msg;
#endif
QMutexLocker locker( &s_mutex ); QMutexLocker locker( &s_mutex );
switch( type ) switch( type )
@@ -150,6 +142,10 @@ TomahawkLogHandler( QtMsgType type, const char* msg )
log( message, LOGTHIRDPARTY ); log( message, LOGTHIRDPARTY );
break; break;
case QtInfoMsg:
log( message, 0 );
break;
case QtCriticalMsg: case QtCriticalMsg:
log( message, 0 ); log( message, 0 );
break; break;
@@ -196,11 +192,7 @@ setupLogfile( QFile& f )
logStream.open( f.fileName().toStdString().c_str() ); logStream.open( f.fileName().toStdString().c_str() );
#endif #endif
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
qInstallMessageHandler( TomahawkLogHandler ); qInstallMessageHandler( TomahawkLogHandler );
#else
qInstallMsgHandler( TomahawkLogHandler );
#endif
} }
} }

View File

@@ -69,8 +69,4 @@ private:
QUrl m_url; QUrl m_url;
}; };
#if QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 )
Q_DECLARE_METATYPE( NetworkReply* )
#endif
#endif // NETWORKREPLY_H #endif // NETWORKREPLY_H

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