1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-09-16 17:02:04 +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_POLICY(SET CMP0017 NEW)
CMAKE_POLICY(SET CMP0022 NEW)
IF(POLICY CMP0075)
CMAKE_POLICY(SET CMP0075 NEW)
ENDIF()
# TODO:
# 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:
# Disable automatic qtmain linking
@@ -89,8 +97,7 @@ endif()
option(BUILD_GUI "Build Tomahawk with GUI" ON)
option(BUILD_TESTS "Build Tomahawk with unit tests" ${BUILD_NO_RELEASE})
option(BUILD_TOOLS "Build Tomahawk helper tools" ${BUILD_NO_RELEASE})
option(BUILD_HATCHET "Build the Hatchet plugin" ON)
option(BUILD_WITH_QT4 "Build Tomahawk with Qt4 instead of Qt5" OFF)
option(BUILD_HATCHET "Build the Hatchet plugin" OFF)
if(UNIX AND NOT APPLE)
set(CRASHREPORTER_ENABLED_BY_DEFAULT OFF)
@@ -99,8 +106,6 @@ else()
endif()
option(WITH_CRASHREPORTER "Build with CrashReporter" ${CRASHREPORTER_ENABLED_BY_DEFAULT})
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
option(SANITIZE_ADDRESS "Enable Address Sanitizer for memory error detection" OFF)
@@ -161,171 +166,52 @@ INCLUDE( MacroLogFeature )
message( STATUS "Building Tomahawk ${TOMAHAWK_VERSION} ***" )
if( NOT BUILD_WITH_QT4 )
find_package(Qt5Core QUIET)
if( Qt5Core_DIR )
# CMAKE 2.8.13+/3.0.0+ requires these for IMPORTed targets
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(Qt5X11Extras NO_MODULE QUIET)
find_package(Qt5Core REQUIRED)
find_package(Qt5Concurrent REQUIRED)
find_package(Qt5Gui REQUIRED)
find_package(Qt5Network REQUIRED)
find_package(Qt5Sql REQUIRED)
find_package(Qt5Svg REQUIRED)
find_package(Qt5UiTools REQUIRED)
find_package(Qt5WebKitWidgets REQUIRED)
find_package(Qt5Widgets REQUIRED)
find_package(Qt5Xml REQUIRED)
find_package(Qt5X11Extras NO_MODULE QUIET)
if(Qt5X11Extras_FOUND)
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" )
if(Qt5X11Extras_FOUND)
set(HAVE_X11 TRUE)
else()
message(STATUS "${CMAKE_CXX_COMPILER} does not support C++11, please use a
different compiler")
set(HAVE_X11 FALSE)
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()
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)
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_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_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 )
@@ -344,23 +230,15 @@ macro_log_feature(GNUTLS_FOUND "GnuTLS"
"http://gnutls.org/" TRUE ""
"GnuTLS is needed for serving the Playdar/HTTP API via TLS")
if( TOMAHAWK_QT5 )
macro_optional_find_package(Qca-qt5)
if(Qca-qt5_DIR)
set(QCA2_FOUND ON CACHE BOOL "QCA2 was found")
set(QCA2_LIBRARIES "qca-qt5" CACHE STRING "QCA2 Qt5 target")
endif()
else()
macro_optional_find_package(QCA2)
macro_optional_find_package(Qca-qt5)
if(Qca-qt5_DIR)
set(QCA2_FOUND ON CACHE BOOL "QCA2 was found")
set(QCA2_LIBRARIES "qca-qt5" CACHE STRING "QCA2 Qt5 target")
endif()
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)
set(LIBATTICA_FOUND ${KF5Attica_FOUND})
else()
macro_optional_find_package(LibAttica 0.4.0)
endif()
macro_optional_find_package(KF5Attica 1.0.0)
set(LIBATTICA_FOUND ${KF5Attica_FOUND})
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)
@@ -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")
if( NOT APPLE )
if( TOMAHAWK_QT5 )
macro_optional_find_package(Qt5Keychain 0.1.0)
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 "" "")
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 "" "")
endif()
if( UNIX AND NOT APPLE )
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")
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()
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")
endif()
# we need pthreads too
@@ -435,23 +305,7 @@ add_subdirectory(${THIRDPARTY_DIR}/libportfwd)
#### submodules end
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()
SET( CLEAN_C_FLAGS ${CMAKE_C_FLAGS} )
#show dep log
macro_display_feature_log()
@@ -464,11 +318,6 @@ CONFIGURE_FILE(
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
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 ))
# 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 )
IF(BUILD_TESTS)
find_package(Qt5Test REQUIRED)
enable_testing()
ADD_SUBDIRECTORY( src/tests )
ENDIF()

View File

@@ -6,31 +6,22 @@
# LIBJREEN_FOUND, whether libjreen was found
FIND_PACKAGE(PkgConfig QUIET)
if( TOMAHAWK_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})
PKG_CHECK_MODULES(PC_JREEN QUIET libjreen-qt5)
FIND_PATH(JREEN_INCLUDE_DIR NAMES jreen/jreen.h
HINTS
${PC_JREEN_INCLUDEDIR}
${PC_JREEN_INCLUDE_DIRS}
${CMAKE_INSTALL_INCLUDEDIR}
${KDE4_INCLUDE_DIR}
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
${PC_JREEN_LIBDIR}
${PC_JREEN_LIBRARY_DIRS}
${CMAKE_INSTALL_LIBDIR}
${KDE4_LIB_DIR}
)
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>
#
if( TOMAHAWK_QT5 )
set(LASTFM_LIB_SUFFIX "5")
endif()
# Include dir
find_path(LIBLASTFM_INCLUDE_DIR
# Track.h doesn't exist in liblastfm-0.3.1, was called Track back then
NAMES lastfm${LASTFM_LIB_SUFFIX}/Track.h
PATHS ${KDE4_INCLUDE_DIR}
NAMES lastfm5/Track.h
)
# Finally the library itself
find_library(LIBLASTFM_LIBRARY
NAMES lastfm${LASTFM_LIB_SUFFIX}
PATHS ${KDE4_LIB_DIR}
NAMES lastfm5
)
set(LIBLASTFM_LIBRARIES ${LIBLASTFM_LIBRARY})

View File

@@ -74,10 +74,10 @@ FIND_PATH(LUCENEPP_LIBRARY_DIR
IF (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}")
SET(LUCENEPP_GOOD_VERSION FALSE)
ENDIF (LUCENEPP_VERSION STRLESS "${LUCENEPP_MIN_VERSION}")
ENDIF (LUCENEPP_VERSION VERSION_LESS "${LUCENEPP_MIN_VERSION}")
ENDIF (LUCENEPP_LIBRARY_DIR)
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_FOUND, whether qtsparkle was found
if( TOMAHAWK_QT5 )
set(QTSPARKLE_SUFFIX "-qt5")
else()
set(QTSPARKLE_SUFFIX "")
endif()
FIND_PATH(QTSPARKLE_INCLUDE_DIR NAMES qtsparkle${QTSPARKLE_SUFFIX}/Updater
HINTS
${CMAKE_INSTALL_INCLUDEDIR}
${KDE4_INCLUDE_DIR}
FIND_PATH(QTSPARKLE_INCLUDE_DIR NAMES qtsparkle-qt5/Updater
HINTS ${CMAKE_INSTALL_INCLUDEDIR}
)
FIND_LIBRARY(QTSPARKLE_LIBRARIES NAMES qtsparkle${QTSPARKLE_SUFFIX}
HINTS
${CMAKE_INSTALL_LIBDIR}
${KDE4_LIB_DIR}
FIND_LIBRARY(QTSPARKLE_LIBRARIES NAMES qtsparkle-qt5
HINTS ${CMAKE_INSTALL_LIBDIR}
)
INCLUDE(FindPackageHandleStandardArgs)

View File

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

View File

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

View File

@@ -2,25 +2,14 @@
include(FindPackageHandleStandardArgs)
if( NOT BUILD_WITH_QT4 )
find_package(TelepathyQt5 NO_MODULE)
set(TelepathyQt_FOUND ${TelepathyQt5_FOUND})
set(TELEPATHY_QT_VERSION ${TELEPATHY_QT5_VERSION})
set(TELEPATHY_QT_INSTALL_DIR ${TELEPATHY_QT5_INSTALL_DIR})
set(TELEPATHY_QT_INCLUDE_DIR ${TELEPATHY_QT5_INCLUDE_DIR})
set(TELEPATHY_QT_LIB_DIR ${TELEPATHY_QT5_LIB_DIR})
set(TELEPATHY_QT_SHARE_DIR ${TELEPATHY_QT5_SHARE_DIR})
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()
find_package(TelepathyQt5 NO_MODULE)
set(TelepathyQt_FOUND ${TelepathyQt5_FOUND})
set(TELEPATHY_QT_VERSION ${TELEPATHY_QT5_VERSION})
set(TELEPATHY_QT_INSTALL_DIR ${TELEPATHY_QT5_INSTALL_DIR})
set(TELEPATHY_QT_INCLUDE_DIR ${TELEPATHY_QT5_INCLUDE_DIR})
set(TELEPATHY_QT_LIB_DIR ${TELEPATHY_QT5_LIB_DIR})
set(TELEPATHY_QT_SHARE_DIR ${TELEPATHY_QT5_SHARE_DIR})
set(TELEPATHY_QT_LIBRARIES ${TELEPATHY_QT5_LIBRARIES})
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")
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)
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_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)
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)
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
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:
* [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/)
* [SQLite 3.6.22](http://www.sqlite.org/)
* [TagLib 1.8](https://taglib.github.io/)
@@ -86,6 +90,10 @@ Required dependencies:
* [Sparsehash](https://code.google.com/p/sparsehash/)
* [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*):
* [Jreen 1.1.1](http://qutim.org/jreen/)

View File

@@ -25,13 +25,13 @@ function(tomahawk_add_library)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
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})
endif()
# add resources from current dir
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})
unset(LIBRARY_RC_SOURCES)
endif()
@@ -45,9 +45,6 @@ function(tomahawk_add_library)
add_library(${target} SHARED ${LIBRARY_SOURCES})
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?
add_definitions(${QT_DEFINITIONS})
set_target_properties(${target} PROPERTIES AUTOMOC TRUE)
@@ -70,12 +67,12 @@ function(tomahawk_add_library)
endif()
# add link targets
target_link_libraries(${target} ${TOMAHAWK_LIBRARIES})
target_link_libraries(${target} PRIVATE ${TOMAHAWK_LIBRARIES})
if(LIBRARY_LINK_LIBRARIES)
target_link_libraries(${target} ${LIBRARY_LINK_LIBRARIES})
target_link_libraries(${target} PUBLIC ${LIBRARY_LINK_LIBRARIES})
endif()
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()
# 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)
set(TOMAHAWK_CMAKE_DIR ${CMAKE_CURRENT_LIST_DIR})
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}</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
set( trans_file tomahawk_i18n )

View File

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

View File

@@ -25,11 +25,6 @@
#include "utils/Logger.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
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/" )
#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 )
: SipPlugin( account )
, m_state( Account::Disconnected )
@@ -96,9 +73,6 @@ XmppSipPlugin::XmppSipPlugin( Account* account )
, m_xmlConsole( nullptr )
, m_pubSubManager( nullptr )
{
#if QT_VERSION <= QT_VERSION_CHECK( 5, 0, 0 )
Jreen::Logger::addHandler( JreenMessageHandler );
#endif
m_currentUsername = readUsername();
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)
setup_qt()
list(APPEND crashreporter_SOURCES main.cpp)
list(APPEND crashreporter_RC resources.qrc)
qt_wrap_ui( crashreporter_UI_HEADERS ${crashreporter_UI} )
qt_add_resources( crashreporter_RC_RCC ${crashreporter_RC} )
qt5_wrap_ui( crashreporter_UI_HEADERS ${crashreporter_UI} )
qt5_add_resources( crashreporter_RC_RCC ${crashreporter_RC} )
if(BUILD_RELEASE)
@@ -43,7 +41,7 @@ target_link_libraries( ${TOMAHAWK_CRASH_REPORTER_TARGET}
${QT_LIBRARIES}
)
target_link_libraries(${TOMAHAWK_CRASH_REPORTER_TARGET} Qt5::Widgets Qt5::Network)
set_target_properties(${TOMAHAWK_CRASH_REPORTER_TARGET} PROPERTIES AUTOMOC ON)
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/NetworkAccessManager.h"
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
#include <echonest5/ArtistTypes.h>
#else
#include <echonest/ArtistTypes.h>
#endif
#include <QNetworkConfiguration>

View File

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

View File

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

View File

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

View File

@@ -2,13 +2,14 @@ SET(fdo_srcs
fdonotify/FdoNotifyPlugin.cpp
fdonotify/ImageConverter.cpp
)
SET(FDO_LINK_LIBRARIES ${LINK_LIBRARIES})
qt_add_dbus_interface(fdo_srcs fdonotify/org.freedesktop.Notifications.xml
SET(FDO_LINK_LIBRARIES ${LINK_LIBRARIES} Qt5::DBus)
qt5_add_dbus_interface(fdo_srcs fdonotify/org.freedesktop.Notifications.xml
FreedesktopNotificationsProxy)
tomahawk_add_plugin(fdonotify
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} )
@@ -16,9 +17,9 @@ SET(mpris_srcs
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)
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)
tomahawk_add_plugin(mpris

View File

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

View File

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

View File

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

View File

@@ -30,11 +30,6 @@
#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::instance()

View File

@@ -25,11 +25,6 @@
#include <QPixmap>
#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 "DllMacro.h"
#include "Typedefs.h"

View File

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

View File

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

View File

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

View File

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

View File

@@ -289,9 +289,4 @@ private:
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

View File

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

View File

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

View File

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

View File

@@ -213,19 +213,11 @@ Track::init()
Q_D( Track );
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::socialActionsLoaded, this, &Track::socialActionsLoaded );
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::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 )
{
// Haven't calculated normal item height yet, do it once and save it
QStyleOptionViewItemV4 opt( option );
QStyleOptionViewItem opt( option );
initStyleOption( &opt, index );
m_accountRowHeight = ACCOUNT_DELEGATE_ROW_HEIGHT_MULTIPLIER * opt.fontMetrics.height();
}
@@ -98,7 +98,7 @@ AccountDelegate::sizeHint( const QStyleOptionViewItem& option, const QModelIndex
void
AccountDelegate::paint ( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const
{
QStyleOptionViewItemV4 opt = option;
QStyleOptionViewItem opt = option;
initStyleOption( &opt, index );
// draw the background
@@ -139,7 +139,7 @@ AccountDelegate::paint ( QPainter* painter, const QStyleOptionViewItem& option,
// draw checkbox first
const int checkboxYPos = ( center ) - ( WRENCH_SIZE / 2 );
QRect checkRect = QRect( leftEdge, checkboxYPos, WRENCH_SIZE, WRENCH_SIZE );
QStyleOptionViewItemV4 opt2 = opt;
QStyleOptionViewItem opt2 = opt;
opt2.rect = checkRect;
if ( !m_loadingSpinners.contains( index ) )
@@ -392,7 +392,7 @@ AccountDelegate::paint ( QPainter* painter, const QStyleOptionViewItem& option,
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
const int textHeight = painter->fontMetrics().height() + 1;
@@ -615,7 +615,7 @@ AccountDelegate::drawStatus( QPainter* painter, const QPointF& rightTopEdge, Acc
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();
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
AccountDelegate::drawConfigWrench ( QPainter* painter, QStyleOptionViewItemV4& opt, QStyleOptionToolButton& topt ) const
AccountDelegate::drawConfigWrench ( QPainter* painter, QStyleOptionViewItem& opt, QStyleOptionToolButton& topt ) const
{
const QWidget* w = opt.widget;
QStyle* style = w ? w->style() : QApplication::style();
@@ -648,7 +648,7 @@ AccountDelegate::drawConfigWrench ( QPainter* painter, QStyleOptionViewItemV4& o
QRect
AccountDelegate::checkRectForIndex( const QStyleOptionViewItem& option, const QModelIndex& idx ) const
{
QStyleOptionViewItemV4 opt = option;
QStyleOptionViewItem opt = option;
initStyleOption( &opt, idx );
// Top level item, return the corresponding rect
@@ -661,7 +661,7 @@ AccountDelegate::checkRectForIndex( const QStyleOptionViewItem& option, const QM
int
AccountDelegate::removeBtnWidth( QStyleOptionViewItemV4 opt ) const
AccountDelegate::removeBtnWidth( QStyleOptionViewItem opt ) const
{
const QString btnText = tr( "Remove" );
QFont font = opt.font;
@@ -674,7 +674,7 @@ void
AccountDelegate::startInstalling( const QPersistentModelIndex& idx )
{
qDebug() << "START INSTALLING:" << idx.data( Qt::DisplayRole ).toString();
QStyleOptionViewItemV4 opt;
QStyleOptionViewItem opt;
initStyleOption( &opt, idx );
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;
// Returns new left edge
int drawStatus( QPainter* painter, const QPointF& rightTopEdge, Account* acct, bool drawText = false ) const;
void drawCheckBox( QStyleOptionViewItemV4& opt, QPainter* p, const QWidget* w ) const;
void drawConfigWrench( QPainter* painter, QStyleOptionViewItemV4& option, QStyleOptionToolButton& topt ) const;
void drawCheckBox( QStyleOptionViewItem& opt, QPainter* p, const QWidget* w ) const;
void drawConfigWrench( QPainter* painter, QStyleOptionViewItem& option, QStyleOptionToolButton& topt ) const;
// 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;
int removeBtnWidth( QStyleOptionViewItemV4 opt ) const;
int removeBtnWidth( QStyleOptionViewItem opt ) const;
int m_hoveringOver;
QPersistentModelIndex m_hoveringItem, m_configPressed;

View File

@@ -44,7 +44,7 @@ AccountFactoryWrapperDelegate::AccountFactoryWrapperDelegate( QObject* parent )
void
AccountFactoryWrapperDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const
{
QStyleOptionViewItemV4 opt = option;
QStyleOptionViewItem opt = option;
initStyleOption( &opt, index );
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
const QRect checkRect( PADDING/4, PADDING/4 + opt.rect.top(), opt.rect.height() - PADDING/4, opt.rect.height() - PADDING/4 );
m_cachedCheckRects[ index ] = checkRect;
QStyleOptionViewItemV4 opt2 = opt;
QStyleOptionViewItem opt2 = opt;
opt2.rect = checkRect;
opt.checkState == Qt::Checked ? opt2.state |= QStyle::State_On : opt2.state |= QStyle::State_Off;
style->drawPrimitive( QStyle::PE_IndicatorViewItemCheck, &opt2, painter, w );

View File

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

View File

@@ -11,16 +11,3 @@ tomahawk_add_plugin(telepathy
${TELEPATHY_QT_LIBRARIES}
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/NetworkAccessManager.h"
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
#include <lastfm5/ws.h>
#include <lastfm5/User.h>
#include <lastfm5/XmlQuery.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;

View File

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

View File

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

View File

@@ -572,10 +572,10 @@ AudioEngine::onNowPlayingInfoReady( const Tomahawk::InfoSystem::InfoType type )
void
AudioEngine::loadTrack( const Tomahawk::result_ptr& result, bool preload )
AudioEngine::loadTrack( const Tomahawk::result_ptr& result )
{
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() )
@@ -589,57 +589,18 @@ AudioEngine::loadTrack( const Tomahawk::result_ptr& result, bool preload )
return;
}
if (preload && d->preloadedTrack == result)
return;
// 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 );
if (preload)
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) );
}
setCurrentTrack( result );
ScriptJob* job = result->resolvedBy()->getStreamUrl( result );
connect( job, SIGNAL( done( QVariantMap ) ), SLOT( gotStreamUrl( QVariantMap ) ) );
job->setProperty( "result", QVariant::fromValue( result ) );
job->setProperty( "isPreload", QVariant::fromValue(preload) );
tDebug() << "preload:" << preload << ", for result:" << result;
job->start();
}
@@ -650,9 +611,6 @@ AudioEngine::gotStreamUrl( const QVariantMap& data )
QString streamUrl = data[ "url" ].toString();
QVariantMap headers = data[ "headers" ].toMap();
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() ||
!( 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
// Not an RTMP or HTTP-with-headers URL, get IO device
QSharedPointer< QIODevice > sp;
performLoadIODevice( result, streamUrl, isPreload );
performLoadIODevice( result, streamUrl );
}
else
{
@@ -696,32 +654,26 @@ AudioEngine::gotStreamUrl( const QVariantMap& data )
void
AudioEngine::gotRedirectedStreamUrl( const Tomahawk::result_ptr& result, NetworkReply* reply )
{
Q_D( AudioEngine );
// std::functions cannot accept temporaries as parameters
QSharedPointer< QIODevice > sp ( reply->reply(), &QObject::deleteLater );
QString url = reply->reply()->url().toString();
reply->disconnectFromReply();
reply->deleteLater();
bool isPreload = result == d->preloadedTrack;
tDebug() << Q_FUNC_INFO << " is preload:" << isPreload;
performLoadTrack( result, url, sp, isPreload );
performLoadTrack( result, url, sp );
}
void
AudioEngine::onPositionChanged( float new_position )
{
if ( new_position >= 0.90 )
loadNextTrack(true);
// tDebug() << Q_FUNC_INFO << new_position << state();
emit trackPosition( new_position );
}
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 );
@@ -731,39 +683,37 @@ AudioEngine::performLoadIODevice( const result_ptr& result, const QString& url,
std::function< void ( const QString, QSharedPointer< QIODevice > ) > callback =
std::bind( &AudioEngine::performLoadTrack, this, result,
std::placeholders::_1,
std::placeholders::_2,
preload );
std::placeholders::_2 );
Tomahawk::UrlHandler::getIODeviceForUrl( result, url, callback );
}
else
{
QSharedPointer< QIODevice > io;
performLoadTrack( result, url, io, preload );
performLoadTrack( result, url, io );
}
}
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() )
{
QMetaObject::invokeMethod( this, "performLoadTrack", Qt::QueuedConnection,
Q_ARG( const Tomahawk::result_ptr, result ),
Q_ARG( const QString, url ),
Q_ARG( QSharedPointer< QIODevice >, io ),
Q_ARG( bool, preload )
Q_ARG( QSharedPointer< QIODevice >, io )
);
return;
}
Q_D( AudioEngine );
if ( !preload && currentTrack() != result )
if ( currentTrack() != result )
{
tLog( LOGVERBOSE ) << Q_FUNC_INFO << "Track loaded too late, skip.";
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;
bool err = false;
@@ -777,16 +727,9 @@ AudioEngine::performLoadTrack( const Tomahawk::result_ptr result, const QString&
if ( !err )
{
if (preload)
{
tLog() << Q_FUNC_INFO << "Preloading new song:" << url;
}
else
{
tLog() << Q_FUNC_INFO << "Starting new song:" << url;
d->state = Loading;
emit loading( d->currentTrack );
}
tLog() << Q_FUNC_INFO << "Starting new song:" << url;
d->state = Loading;
emit loading( d->currentTrack );
if ( !TomahawkUtils::isLocalResult( url )
&& !( TomahawkUtils::isHttpResult( url ) && io.isNull() )
@@ -795,18 +738,18 @@ AudioEngine::performLoadTrack( const Tomahawk::result_ptr result, const QString&
QSharedPointer<QNetworkReply> qnr = io.objectCast<QNetworkReply>();
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
// and AudioOutput handles the deletion of the
// QNR_IODeviceStream object
ioToKeep.clear();
d->audioOutput->setAutoDelete( true, preload );
d->audioOutput->setAutoDelete( true );
}
else
{
d->audioOutput->setCurrentSource( io.data(), preload);
d->audioOutput->setCurrentSource( io.data() );
// We handle the deletion via tracking in d->input
d->audioOutput->setAutoDelete( false, preload);
d->audioOutput->setAutoDelete( false );
}
}
else
@@ -825,7 +768,7 @@ AudioEngine::performLoadTrack( const Tomahawk::result_ptr result, const QString&
}
tLog( LOGVERBOSE ) << Q_FUNC_INFO << "Passing to VLC:" << furl;
d->audioOutput->setCurrentSource( furl, preload );
d->audioOutput->setCurrentSource( furl );
}
else
{
@@ -834,37 +777,26 @@ AudioEngine::performLoadTrack( const Tomahawk::result_ptr result, const QString&
furl = furl.right( furl.length() - 7 );
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->inputPreloaded.isNull() )
{
d->inputPreloaded->close();
d->inputPreloaded.clear();
}
d->inputPreloaded = ioToKeep;
}
else
if ( !d->input.isNull() )
{
if ( !d->input.isNull() )
{
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->close();
d->input.clear();
}
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;
}
if ( !preload )
{
d->waitingOnNewTrack = false;
}
d->waitingOnNewTrack = false;
return;
}
@@ -909,19 +838,18 @@ AudioEngine::loadPreviousTrack()
}
if ( result )
loadTrack( result, false );
loadTrack( result );
else
stop();
}
void
AudioEngine::loadNextTrack( bool preload )
AudioEngine::loadNextTrack()
{
if ( QThread::currentThread() != thread() )
{
QMetaObject::invokeMethod( this, "loadNextTrack", Qt::QueuedConnection,
Q_ARG( bool, preload ));
QMetaObject::invokeMethod( this, "loadNextTrack", Qt::QueuedConnection );
return;
}
@@ -935,11 +863,8 @@ AudioEngine::loadNextTrack( bool preload )
{
if ( d->stopAfterTrack->track()->equals( d->currentTrack->track() ) )
{
if ( !preload )
{
d->stopAfterTrack.clear();
stop();
}
d->stopAfterTrack.clear();
stop();
return;
}
}
@@ -957,24 +882,17 @@ AudioEngine::loadNextTrack( bool preload )
if ( d->playlist.data()->nextResult() )
{
if ( preload )
{
result = d->playlist.data()->nextResult();
}
else
{
result = d->playlist.data()->setSiblingResult( 1 );
setCurrentTrackPlaylist( d->playlist );
}
result = d->playlist.data()->setSiblingResult( 1 );
setCurrentTrackPlaylist( d->playlist );
}
}
if ( result )
{
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Got next item, loading track, preload:" << preload;
loadTrack( result, preload );
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Got next item, loading track";
loadTrack( result );
}
else if ( !preload )
else
{
if ( !d->playlist.isNull() && d->playlist.data()->retryMode() == Tomahawk::PlaylistModes::Retry )
d->waitingOnNewTrack = true;
@@ -1043,7 +961,7 @@ AudioEngine::playItem( Tomahawk::playlistinterface_ptr playlist, const Tomahawk:
if ( result )
{
loadTrack( result, false );
loadTrack( result );
}
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
AudioEngine::setCurrentTrack( const Tomahawk::result_ptr& result )
{
@@ -1352,6 +1262,7 @@ AudioEngine::setCurrentTrack( const Tomahawk::result_ptr& result )
}
}
void
AudioEngine::setState( AudioState state )
{

View File

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

View File

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

View File

@@ -56,11 +56,9 @@ AudioOutput::AudioOutput( QObject* parent )
: QObject( parent )
, m_currentState( Stopped )
, m_currentStream( nullptr )
, m_preloadedStream( nullptr )
, m_seekable( true )
, m_muted( false )
, m_autoDelete( true )
, m_preloadedAutoDelete( true )
, m_volume( 1.0 )
, m_currentTime( 0 )
, m_totalTime( 0 )
@@ -70,8 +68,6 @@ AudioOutput::AudioOutput( QObject* parent )
, m_vlcInstance( nullptr )
, m_vlcPlayer( nullptr )
, m_vlcMedia( nullptr )
, m_vlcPreloadedPlayer( nullptr )
, m_vlcPreloadedMedia( nullptr )
{
tDebug() << Q_FUNC_INFO;
@@ -127,46 +123,37 @@ AudioOutput::AudioOutput( QObject* parent )
#endif
m_vlcPlayer = libvlc_media_player_new( m_vlcInstance );
m_vlcPreloadedPlayer = libvlc_media_player_new( m_vlcInstance );
for( auto player : { m_vlcPlayer, m_vlcPreloadedPlayer } )
{
libvlc_audio_set_mute( player, 0 );
{
libvlc_event_manager_t* current_manager = libvlc_media_player_event_manager( player );
libvlc_event_manager_t* new_manager = libvlc_media_player_event_manager( player );
static libvlc_event_type_t events[] = {
libvlc_MediaPlayerMediaChanged,
libvlc_MediaPlayerNothingSpecial,
libvlc_MediaPlayerOpening,
libvlc_MediaPlayerBuffering,
libvlc_MediaPlayerPlaying,
libvlc_MediaPlayerPaused,
libvlc_MediaPlayerStopped,
libvlc_MediaPlayerForward,
libvlc_MediaPlayerBackward,
libvlc_MediaPlayerEndReached,
libvlc_MediaPlayerEncounteredError,
libvlc_MediaPlayerTimeChanged,
libvlc_MediaPlayerPositionChanged,
libvlc_MediaPlayerSeekableChanged,
libvlc_MediaPlayerPausableChanged,
libvlc_MediaPlayerTitleChanged,
libvlc_MediaPlayerSnapshotTaken,
//libvlc_MediaPlayerLengthChanged,
libvlc_event_manager_t* manager = libvlc_media_player_event_manager( m_vlcPlayer );
libvlc_event_type_t events[] = {
libvlc_MediaPlayerMediaChanged,
libvlc_MediaPlayerNothingSpecial,
libvlc_MediaPlayerOpening,
libvlc_MediaPlayerBuffering,
libvlc_MediaPlayerPlaying,
libvlc_MediaPlayerPaused,
libvlc_MediaPlayerStopped,
libvlc_MediaPlayerForward,
libvlc_MediaPlayerBackward,
libvlc_MediaPlayerEndReached,
libvlc_MediaPlayerEncounteredError,
libvlc_MediaPlayerTimeChanged,
libvlc_MediaPlayerPositionChanged,
libvlc_MediaPlayerSeekableChanged,
libvlc_MediaPlayerPausableChanged,
libvlc_MediaPlayerTitleChanged,
libvlc_MediaPlayerSnapshotTaken,
//libvlc_MediaPlayerLengthChanged,
#if (LIBVLC_VERSION_INT >= LIBVLC_VERSION(2, 2, 2, 0))
libvlc_MediaPlayerAudioVolume,
libvlc_MediaPlayerMuted,
libvlc_MediaPlayerUnmuted,
libvlc_MediaPlayerAudioVolume,
libvlc_MediaPlayerMuted,
libvlc_MediaPlayerUnmuted,
#endif
libvlc_MediaPlayerVout
};
const int eventCount = sizeof(events) / sizeof( *events );
for ( int i = 0; i < eventCount; i++ )
{
libvlc_event_attach( new_manager, events[ i ], &AudioOutput::vlcEventCallback, this );
}
}
libvlc_MediaPlayerVout
};
const int eventCount = sizeof(events) / sizeof( *events );
for ( int i = 0; i < eventCount; i++ )
{
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
@@ -174,81 +161,30 @@ AudioOutput::AudioOutput( QObject* parent )
Q_ASSERT( m_silenceFile.exists() );
Q_ASSERT( m_silenceFile.open( QIODevice::ReadOnly ) );
setCurrentSource( new MediaStream( &m_silenceFile, true ), false );
setCurrentSource( new MediaStream( &m_silenceFile, true ), true );
setCurrentSource( new MediaStream( &m_silenceFile, true ) );
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
QTimer::singleShot( 15000, [&]()
{
if ( !m_initialized ) {
m_initialized = 2;
m_initialized = true;
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()
{
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 )
{
libvlc_media_player_stop( m_vlcPlayer );
libvlc_media_player_release( m_vlcPlayer );
m_vlcPlayer = nullptr;
}
if ( m_vlcPreloadedMedia != nullptr )
{
libvlc_media_release( m_vlcPreloadedMedia );
m_vlcPreloadedMedia = nullptr;
}
if ( m_vlcMedia != nullptr )
{
libvlc_media_release( m_vlcMedia );
@@ -270,19 +206,11 @@ AudioOutput::onInitVlcEvent( const libvlc_event_t* event )
setVolume( volume() );
setMuted( isMuted() );
m_initialized ++;
m_initialized = true;
m_silenceFile.close();
tDebug() << Q_FUNC_INFO << "Init OK";
if (m_initialized >=2)
{
m_silenceFile.close();
emit initialized();
}
else
{
switchToPreloadedMedia();
libvlc_media_player_play( m_vlcPlayer );
}
emit initialized();
break;
default:
@@ -292,26 +220,23 @@ AudioOutput::onInitVlcEvent( const libvlc_event_t* event )
void
AudioOutput::setAutoDelete( bool ad, bool preload )
AudioOutput::setAutoDelete( bool ad )
{
if (preload)
m_preloadedAutoDelete = ad;
else
m_autoDelete = ad;
m_autoDelete = ad;
}
void
AudioOutput::setCurrentSource( const QUrl& stream, bool preload )
AudioOutput::setCurrentSource( const QUrl& stream )
{
setCurrentSource( new MediaStream( stream ), preload );
setCurrentSource( new MediaStream( stream ) );
}
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
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 ) {
libvlc_media_player_stop( m_vlcPreloadedPlayer );
libvlc_media_release( m_vlcPreloadedMedia );
m_vlcPreloadedMedia = nullptr;
}
if ( m_preloadedAutoDelete && m_preloadedStream != nullptr )
if ( m_vlcMedia != 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;
switch ( stream->type() )
@@ -382,19 +312,23 @@ AudioOutput::setCurrentSource( MediaStream* stream, bool preload )
tDebug() << Q_FUNC_INFO << "MediaStream::Final Url:" << url;
m_vlcPreloadedMedia = libvlc_media_new_location( m_vlcInstance, url.constData() );
if ( stream->type() == MediaStream::Stream || stream->type() == MediaStream::IODevice )
m_vlcMedia = libvlc_media_new_location( m_vlcInstance, url.constData() );
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;
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 );
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 );
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 );
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 );
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" ) )
{
@@ -410,7 +344,7 @@ AudioOutput::setCurrentSource( MediaStream* stream, bool preload )
{
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}" );
libvlc_media_add_option( m_vlcPreloadedMedia, sout.arg( castIP ).toLatin1().constData() );
libvlc_media_add_option( m_vlcMedia, sout.arg( castIP ).toLatin1().constData() );
}
else
{
@@ -418,8 +352,8 @@ AudioOutput::setCurrentSource( MediaStream* stream, bool preload )
}
}
libvlc_event_manager_t* manager = libvlc_media_event_manager( m_vlcPreloadedMedia );
static libvlc_event_type_t events[] = {
libvlc_event_manager_t* manager = libvlc_media_event_manager( m_vlcMedia );
libvlc_event_type_t events[] = {
libvlc_MediaDurationChanged,
};
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_media_player_set_media( m_vlcPreloadedPlayer, m_vlcPreloadedMedia );
libvlc_audio_set_volume( m_vlcPreloadedPlayer, 0.0 );
libvlc_media_player_play( m_vlcPreloadedPlayer );
if ( !preload )
switchToPreloadedMedia();
libvlc_media_player_set_media( m_vlcPlayer, m_vlcMedia );
// setState( Stopped );
}
@@ -443,7 +371,7 @@ AudioOutput::setCurrentSource( MediaStream* stream, bool preload )
bool
AudioOutput::isInitialized() const
{
return m_initialized > 1;
return m_initialized;
}
@@ -596,7 +524,7 @@ AudioOutput::seek( qint64 milliseconds )
bool
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 );
}
@@ -646,107 +574,64 @@ AudioOutput::setVolume( qreal vol )
void
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 );
break;
case libvlc_MediaPlayerPositionChanged:
setCurrentPosition( event->u.media_player_position_changed.new_position );
break;
case libvlc_MediaPlayerSeekableChanged:
// tDebug() << Q_FUNC_INFO << " : seekable changed : " << event->u.media_player_seekable_changed.new_seekable;
break;
case libvlc_MediaDurationChanged:
setTotalTime( event->u.media_duration_changed.new_duration );
break;
case libvlc_MediaPlayerLengthChanged:
// tDebug() << Q_FUNC_INFO << " : length changed : " << event->u.media_player_length_changed.new_length;
break;
case libvlc_MediaPlayerPlaying:
setState( Playing );
break;
case libvlc_MediaPlayerPaused:
setState( Paused );
break;
case libvlc_MediaPlayerEndReached:
setState( Stopped );
break;
case libvlc_MediaPlayerEncounteredError:
tDebug() << Q_FUNC_INFO << "LibVLC error: MediaPlayerEncounteredError. Stopping";
// Don't call stop() here - it will deadlock libvlc
setState( Error );
break;
case libvlc_MediaPlayerTimeChanged:
setCurrentTime( event->u.media_player_time_changed.new_time );
break;
case libvlc_MediaPlayerPositionChanged:
setCurrentPosition( event->u.media_player_position_changed.new_position );
break;
case libvlc_MediaPlayerSeekableChanged:
// tDebug() << Q_FUNC_INFO << " : seekable changed : " << event->u.media_player_seekable_changed.new_seekable;
break;
case libvlc_MediaDurationChanged:
setTotalTime( event->u.media_duration_changed.new_duration );
break;
case libvlc_MediaPlayerLengthChanged:
// tDebug() << Q_FUNC_INFO << " : length changed : " << event->u.media_player_length_changed.new_length;
break;
case libvlc_MediaPlayerPlaying:
setState( Playing );
break;
case libvlc_MediaPlayerPaused:
setState( Paused );
break;
case libvlc_MediaPlayerEndReached:
setState( Stopped );
break;
case libvlc_MediaPlayerEncounteredError:
tDebug() << Q_FUNC_INFO << "LibVLC error: MediaPlayerEncounteredError. Stopping";
// Don't call stop() here - it will deadlock libvlc
setState( Error );
break;
#if (LIBVLC_VERSION_INT >= LIBVLC_VERSION(2, 2, 2, 0))
case libvlc_MediaPlayerAudioVolume:
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() );
break;
case libvlc_MediaPlayerMuted:
m_muted = true;
emit mutedChanged( true );
break;
case libvlc_MediaPlayerUnmuted:
m_muted = false;
emit mutedChanged( false );
break;
case libvlc_MediaPlayerAudioVolume:
m_volume = event->u.media_player_audio_volume.volume;
emit volumeChanged( volume() );
break;
case libvlc_MediaPlayerMuted:
m_muted = true;
emit mutedChanged( true );
break;
case libvlc_MediaPlayerUnmuted:
m_muted = false;
emit mutedChanged( false );
break;
#endif
case libvlc_MediaPlayerNothingSpecial:
case libvlc_MediaPlayerOpening:
case libvlc_MediaPlayerBuffering:
case libvlc_MediaPlayerStopped:
case libvlc_MediaPlayerVout:
case libvlc_MediaPlayerMediaChanged:
case libvlc_MediaPlayerForward:
case libvlc_MediaPlayerBackward:
case libvlc_MediaPlayerPausableChanged:
case libvlc_MediaPlayerTitleChanged:
case libvlc_MediaPlayerSnapshotTaken:
default:
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;
}
case libvlc_MediaPlayerNothingSpecial:
case libvlc_MediaPlayerOpening:
case libvlc_MediaPlayerBuffering:
case libvlc_MediaPlayerStopped:
case libvlc_MediaPlayerVout:
case libvlc_MediaPlayerMediaChanged:
case libvlc_MediaPlayerForward:
case libvlc_MediaPlayerBackward:
case libvlc_MediaPlayerPausableChanged:
case libvlc_MediaPlayerTitleChanged:
case libvlc_MediaPlayerSnapshotTaken:
default:
break;
}
}

View File

@@ -49,10 +49,9 @@ public:
bool isInitialized() const;
AudioState state() const;
void setCurrentSource( const QUrl& stream, bool preload );
void setCurrentSource( QIODevice* stream, bool preload );
void setCurrentSource( MediaStream* stream, bool preload );
void setPreloadedSourceAsCurrent( void );
void setCurrentSource( const QUrl& stream );
void setCurrentSource( QIODevice* stream );
void setCurrentSource( MediaStream* stream );
void play();
void pause();
@@ -66,15 +65,13 @@ public:
qreal volume() const;
qint64 currentTime() 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 );
static AudioOutput* instance();
libvlc_instance_t* vlcInstance() const;
void switchToPreloadedMedia( void );
public slots:
signals:
@@ -93,7 +90,6 @@ private:
void setCurrentPosition( float position );
void setTotalTime( qint64 time );
void onVlcEvent( const libvlc_event_t* event );
static void vlcEventCallback( const libvlc_event_t* event, void* opaque );
static void s_dspCallback( int frameNumber, float* samples, int nb_channels, int nb_samples );
@@ -101,11 +97,9 @@ private:
static AudioOutput* s_instance;
AudioState m_currentState;
MediaStream* m_currentStream;
MediaStream* m_preloadedStream;
bool m_seekable;
bool m_muted;
bool m_autoDelete;
bool m_preloadedAutoDelete;
bool m_havePosition;
bool m_haveTiming;
qreal m_volume;
@@ -113,7 +107,7 @@ private:
qint64 m_totalTime;
bool m_justSeeked;
int m_initialized;
bool m_initialized;
QFile m_silenceFile;
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_media_player_t* m_vlcPlayer;
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

View File

@@ -43,11 +43,6 @@
#include "DatabaseCommand_SetCollectionAttributes.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 MAX_WORKER_THREADS 16

View File

@@ -25,11 +25,6 @@
#include "PlaylistEntry.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;

View File

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

View File

@@ -21,11 +21,6 @@
#include "Query.h"
#include "Track.h"
// Forward Declarations breaking QSharedPointer
#if QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 )
#include "Source.h"
#endif
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

View File

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

View File

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

View File

@@ -25,10 +25,6 @@
#include "PlaylistEntry.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;

View File

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

View File

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

View File

@@ -47,7 +47,7 @@ JobStatusDelegate::~JobStatusDelegate()
void
JobStatusDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const
{
QStyleOptionViewItemV4 opt = option;
QStyleOptionViewItem opt = option;
initStyleOption( &opt, index );
QFontMetrics fm( painter->font() );
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 ] );
// Don't elide, but stretch across as many rows as required
QStyleOptionViewItemV4 opt = option;
QStyleOptionViewItem opt = option;
initStyleOption( &opt, index );
const QString text = index.data( Qt::DisplayRole ).toString();

View File

@@ -31,12 +31,6 @@
#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 )
: m_parent( p )
, m_stream( QPointer< StreamConnection >( sc ) )

View File

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

View File

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

View File

@@ -157,11 +157,7 @@ signals:
void ready();
protected:
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
void incomingConnection( qintptr sd ) Q_DECL_OVERRIDE;
#else
void incomingConnection( int sd ) Q_DECL_OVERRIDE;
#endif
public slots:
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 );
{
QStyleOptionViewItemV4 o = option;
QStyleOptionViewItem o = option;
initStyleOption( &o, QModelIndex() );
painter->save();
@@ -190,7 +190,7 @@ ColumnItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option
if ( text.trimmed().isEmpty() )
text = tr( "Unknown" );
QStyleOptionViewItemV4 opt = option;
QStyleOptionViewItem opt = option;
initStyleOption( &opt, QModelIndex() );
const QModelIndex curIndex = m_view->currentIndex();

View File

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

View File

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

View File

@@ -59,7 +59,7 @@ private slots:
void doUpdateIndex( const QPersistentModelIndex& index );
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;
QWidget* createEditor( QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index ) const;

View File

@@ -40,11 +40,6 @@
#include "utils/TomahawkUtilsGui.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;
@@ -98,7 +93,7 @@ TrackItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option,
PlayableItem* item = m_model->itemFromIndex( m_model->mapToSource( index ) );
Q_ASSERT( item );
QStyleOptionViewItemV4 opt = option;
QStyleOptionViewItem opt = option;
prepareStyleOption( &opt, index, item );
if ( item->source() )

View File

@@ -36,12 +36,6 @@
#include "utils/Logger.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 <QPainter>
#include <QScrollBar>

View File

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

View File

@@ -286,7 +286,7 @@ DynamicView::backgroundBetween( QRect rect, int rowStart )
QPixmap bg = QPixmap( rect.size() );
bg.fill( Qt::white );
QPainter p( &bg );
QStyleOptionViewItemV4 opt = viewOptions();
QStyleOptionViewItem opt = viewOptions();
// code taken from QTreeViewPrivate::paintAlternatingRowColors
m_fadebg = !style()->styleHint( QStyle::SH_ItemView_PaintAlternatingRowColorsForEmptyArea, &opt );
// 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;
if ( current & 1 )
{
opt.features |= QStyleOptionViewItemV2::Alternate;
opt.features |= QStyleOptionViewItem::Alternate;
} else {
opt.features &= ~QStyleOptionViewItemV2::Alternate;
opt.features &= ~QStyleOptionViewItem::Alternate;
}
++current;
style()->drawPrimitive( QStyle::PE_PanelItemViewRow, &opt, &p );

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -18,16 +18,9 @@
#include "Json.h"
// Qt version specific includes
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
#include <QJsonDocument>
#include <QMetaProperty>
#include <QVariantHash>
#else
#include <qjson/parser.h>
#include <qjson/qobjecthelper.h>
#include <qjson/serializer.h>
#endif
#include <QJsonDocument>
#include <QMetaProperty>
#include <QVariantHash>
namespace TomahawkUtils
{
@@ -35,7 +28,6 @@ namespace TomahawkUtils
QVariantMap
qobject2qvariant( const QObject* object )
{
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
QVariantMap map;
if ( object == NULL )
{
@@ -52,16 +44,12 @@ qobject2qvariant( const QObject* object )
}
}
return map;
#else
return QJson::QObjectHelper::qobject2qvariant( object );
#endif
}
void
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 )
{
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
parseJson( const QByteArray& jsonData, bool* ok )
{
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
QJsonParseError error;
QJsonDocument doc = QJsonDocument::fromJson( jsonData, &error );
if ( ok != NULL )
@@ -95,17 +79,12 @@ parseJson( const QByteArray& jsonData, bool* ok )
*ok = ( error.error == QJsonParseError::NoError );
}
return doc.toVariant();
#else
QJson::Parser p;
return p.parse( jsonData, ok );
#endif
}
QByteArray
toJson( const QVariant &variant, bool* ok )
{
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
QVariant _variant = variant;
if ( variant.type() == QVariant::Hash )
{
@@ -127,10 +106,6 @@ toJson( const QVariant &variant, bool* ok )
*ok = !doc.isNull();
}
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
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
TomahawkLogHandler( QtMsgType type, const QMessageLogContext& context, const QString& msg )
#else
TomahawkLogHandler( QtMsgType type, const char* msg )
#endif
{
static QMutex s_mutex;
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
QByteArray ba = msg.toUtf8();
const char* message = ba.constData();
#else
const char* message = msg;
#endif
QMutexLocker locker( &s_mutex );
switch( type )
@@ -150,6 +142,10 @@ TomahawkLogHandler( QtMsgType type, const char* msg )
log( message, LOGTHIRDPARTY );
break;
case QtInfoMsg:
log( message, 0 );
break;
case QtCriticalMsg:
log( message, 0 );
break;
@@ -196,11 +192,7 @@ setupLogfile( QFile& f )
logStream.open( f.fileName().toStdString().c_str() );
#endif
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
qInstallMessageHandler( TomahawkLogHandler );
#else
qInstallMsgHandler( TomahawkLogHandler );
#endif
}
}

View File

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

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