diff --git a/.gitignore b/.gitignore --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ .* *~ -build +/build*/ release-build Doxyfile *.patch diff --git a/.reviewboardrc b/.reviewboardrc deleted file mode 100644 --- a/.reviewboardrc +++ /dev/null @@ -1,4 +0,0 @@ -REVIEWBOARD_URL = "https://git.reviewboard.kde.org" -TARGET_GROUPS = "Amarok" -GUESS_FIELDS = True -REPOSITORY = "git://anongit.kde.org/amarok" diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.4) project(Amarok) @@ -8,22 +8,64 @@ endif() ############### + +set(KF5_MIN_VERSION "5.41.0") +set(QT_REQUIRED_VERSION "5.8.0") find_package(PkgConfig REQUIRED) -find_package(ECM 1.7.0 REQUIRED CONFIG) +find_package(ECM ${KF5_MIN_VERSION} REQUIRED CONFIG) set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH}) include(KDEInstallDirs) include(KDECMakeSettings) +#include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE) include(KDECompilerSettings NO_POLICY_SCOPE) include(FeatureSummary) include(ECMInstallIcons) include(ECMSetupVersion) include(ECMAddTests) include(ECMAddAppIcon) include(FindPkgConfig) +include(CMakePushCheckState) +include(GenerateExportHeader) + +find_package(Qt5 ${QT_REQUIRED_VERSION} REQUIRED COMPONENTS Core DBus Gui QuickWidgets Qml Script ScriptTools Sql Svg Test Widgets Xml) + +find_package(Qt5QuickControls2 ${QT_REQUIRED_VERSION}) +set_package_properties(Qt5QuickControls2 PROPERTIES TYPE RUNTIME PURPOSE "Needed by the player's context area") + +find_package(Qt5WebEngine ${QT_REQUIRED_VERSION}) +set_package_properties(Qt5WebEngine PROPERTIES TYPE OPTIONAL PURPOSE "Needed by the wikipedia applet") + +find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS + Archive + Attica + Codecs + Config + ConfigWidgets + CoreAddons + Crash + DBusAddons + Declarative + DNSSD + GlobalAccel + GuiAddons + I18n + IconThemes + KCMUtils + KIO + NewStuff + Notifications + NotifyConfig + Package + Solid + TextEditor + ThreadWeaver + WidgetsAddons + WindowSystem +) -find_package( Qt5 5.8.0 REQUIRED COMPONENTS Core DBus Gui Quick QuickWidgets Qml Script ScriptTools Sql Svg Test Widgets Xml ) -find_package( KF5 REQUIRED COMPONENTS Archive Codecs CoreAddons DBusAddons Declarative DNSSD GlobalAccel GuiAddons I18n IconThemes KCMUtils KIO NewStuff Notifications NotifyConfig Package Solid TextEditor ThreadWeaver WindowSystem ) +find_package(KF5Kirigami2 ${KF5_MIN_VERSION}) +set_package_properties(KF5Kirigami2 PROPERTIES TYPE RUNTIME PURPOSE "Needed by the player's context area") ############### option(WITH_UTILITIES "Enable building of utilities" ON) @@ -40,6 +82,7 @@ # Check if TagLib is built with ASF and MP4 support include(CheckCXXSourceCompiles) +cmake_push_check_state() set(CMAKE_REQUIRED_INCLUDES "${TAGLIB_INCLUDES}") set(CMAKE_REQUIRED_LIBRARIES "${TAGLIB_LIBRARIES}") @@ -66,9 +109,7 @@ check_cxx_source_compiles("#include int main() { char *s; TagLib::Ogg::Opus::File opusfile(s); return 0;}" TAGLIB_OPUS_FOUND) - -set(CMAKE_REQUIRED_INCLUDES) -set(CMAKE_REQUIRED_LIBRARIES) +cmake_pop_check_state() set(TAGLIB-EXTRAS_MIN_VERSION "1.0") find_package(Taglib-Extras) @@ -81,6 +122,13 @@ #Needed to conditionally build tests and gui +find_package(Googlemock) +set_package_properties( GOOGLEMOCK PROPERTIES DESCRIPTION "Used in Amarok's tests." URL "https://github.com/google/googlemock" TYPE OPTIONAL ) + +if(NOT GOOGLEMOCK_FOUND) + set(BUILD_TESTING OFF) +endif() + if(BUILD_TESTING) add_definitions(-DDEBUG) endif() @@ -108,11 +156,18 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-delayed-template-parsing") endif () +#################################################################################### +# CMAKE_AUTOMOC + +if(NOT CMAKE_VERSION VERSION_LESS "3.10.0") + # CMake 3.9+ warns about automoc on files without Q_OBJECT, and doesn't know about other macros. + # 3.10+ lets us provide more macro names that require automoc. + list(APPEND CMAKE_AUTOMOC_MACRO_NAMES AMAROK_EXPORT_SIMPLE_IMPORTER_PLUGIN) +endif() add_definitions(-DQT_NO_URL_CAST_FROM_STRING) find_package(Phonon4Qt5 4.6.60 REQUIRED NO_MODULE) -include_directories(BEFORE ${PHONON_INCLUDES}) find_package( LibLastFm ) set( LIBLASTFM_MIN_VERSION "1.0.0" ) @@ -138,8 +193,9 @@ if( WITH_PLAYER ) find_package(X11) + find_package(Threads REQUIRED) - find_package(MySQLAmarok REQUIRED) + find_package(MySQL REQUIRED) if( WITH_MYSQL_EMBEDDED ) set( BUILD_MYSQLE_COLLECTION TRUE ) set_package_properties( MYSQLD PROPERTIES DESCRIPTION "Embedded MySQL Libraries" URL "http://www.mysql.com" TYPE REQUIRED ) @@ -152,10 +208,6 @@ find_package(ZLIB REQUIRED) set_package_properties( ZLIB PROPERTIES DESCRIPTION "zlib" TYPE REQUIRED ) - # QJson is required for the PlaydarCollection - find_package(QJSON) - set_package_properties( QJSON PROPERTIES DESCRIPTION "Qt JSON Parser used for the Playdar Collection" URL "http://qjson.sourceforge.net/" TYPE OPTIONAL ) - # We tell users that we need 1.0.3, but we really check just >= 1.0.0. This is because # upstream forgot to update version in lastfm/global.h, so it looks like 1.0.2. :-( # will be fixed in liblastfm-1.0.4 @@ -179,8 +231,13 @@ ) ## gpodder Service - find_package( Mygpo-qt5 ) - set_package_properties( Mygpo-qt5 PROPERTIES DESCRIPTION "Enable gpodder.net service" URL "http://wiki.gpodder.org/wiki/Libmygpo-qt" TYPE OPTIONAL ) + find_package(Mygpo-qt5 1.1.0 CONFIG) + set_package_properties(Mygpo-qt5 PROPERTIES + DESCRIPTION "A Qt/C++ library wrapping the gpodder.net Webservice." + URL "http://wiki.gpodder.org/wiki/Libmygpo-qt" + TYPE OPTIONAL + PURPOSE "Synchronize podcast subscriptions with gpodder.net" + ) if( WITH_IPOD ) find_package(Ipod) @@ -195,8 +252,11 @@ set_package_properties( GDKPixBuf PROPERTIES DESCRIPTION "Support for artwork on iPod audio devices via GDK-PixBuf" URL "http://developer.gnome.org/arch/imaging/gdkpixbuf.html" TYPE OPTIONAL ) endif() - find_package(Mtp) - set_package_properties( Mtp PROPERTIES DESCRIPTION "Enable Support for portable media devices that use the media transfer protocol" URL "http://libmtp.sourceforge.net/" TYPE OPTIONAL ) + find_package(Mtp 1.0.0) + set_package_properties(Mtp PROPERTIES + TYPE OPTIONAL + PURPOSE "Enable Support for portable media devices that use the media transfer protocol" + ) if( WITH_MP3Tunes ) find_package(CURL) @@ -229,12 +289,11 @@ set_package_properties( GLIB2 PROPERTIES DESCRIPTION "Required by libgpod and mp3tunes" URL "http://www.gtk.org" TYPE OPTIONAL ) endif() - find_program( CLAMZ_FOUND clamz PATH ) - set_package_properties( CLAMZ PROPERTIES DESCRIPTION "Optional requirement to download songs from the Amazon MP3 store. Highly recommended on Linux, as the official downloader from Amazon is quite broken on many systems." URL "https://code.google.com/p/clamz/" TYPE OPTIONAL ) - find_package(PythonInterp) set_package_properties( PYTHON PROPERTIES DESCRIPTION "Required for generating the autocompletion file for the script console" URL "https://www.python.org" TYPE OPTIONAL ) + find_package(FFTW3 REQUIRED) + if( BUILD_TESTING AND NOT WIN32 ) enable_testing() add_subdirectory( tests ) @@ -252,8 +311,6 @@ endif() if( WITH_UTILITIES ) - set(EXEC_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} CACHE PATH "Base directory for executables and libraries" FORCE) - set(BIN_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/bin" CACHE PATH "The subdirectory to the binaries prefix (default prefix/bin)" FORCE) add_subdirectory( utilities ) endif() diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -3468,7 +3468,7 @@ * When tracks are removed from the collection (deleted on disk or moved outside of a collection folder) any corresponding entry in the Playlist will be disabled. - * Dragging podcasts to to playlist will insert them in a chronological + * Dragging podcasts to the playlist will insert them in a chronological order, so you can listen to the oldest first automatically! * Improve application startup times dramaticaly by lazy loading podcast episodes. diff --git a/HACKING/building_amarok2_in_home.txt b/HACKING/building_amarok2_in_home.txt --- a/HACKING/building_amarok2_in_home.txt +++ b/HACKING/building_amarok2_in_home.txt @@ -64,12 +64,11 @@ If you are a regular Amarok contributor, please build with tests enabled. - Install gmock from http://code.google.com/p/googlemock/ - Add the following flag to your cmake line: -DKDE4_BUILD_TESTS=ON + Install gmock from https://github.com/google/googlemock - Once compiled, jsut run the tests with 'make test' + Once compiled, just run the tests with 'make test' - For more information about the test infrastructure, read the Qtestlib Manual: http://doc.trolltech.com/4.5/qtestlib-manual.html + For more information about the test infrastructure, read the Qtestlib Manual: http://doc.qt.io/qt-5/qtest-overview.html * Updating KDE Config: kbuildsycoca4 --noincremental diff --git a/INSTALL b/INSTALL --- a/INSTALL +++ b/INSTALL @@ -2,6 +2,6 @@ ================= Build instructions can be found at - % http://community.kde.org/Amarok/Development/Compiling - % http://techbase.kde.org/Getting_Started/Build/KDE4 + % https://community.kde.org/Amarok/Development/Compiling + % https://community.kde.org/Guidelines_and_HOWTOs/Build_from_source diff --git a/Messages.sh b/Messages.sh --- a/Messages.sh +++ b/Messages.sh @@ -1,3 +1,3 @@ #! /bin/sh -$XGETTEXT_QT utilities/collectionscanner/CollectionScanner.cpp -o $podir/amarokcollectionscanner_qt.pot +$EXTRACT_TR_STRINGS utilities/collectionscanner/CollectionScanner.cpp -o $podir/amarokcollectionscanner_qt.pot diff --git a/README b/README --- a/README +++ b/README @@ -25,25 +25,29 @@ * Podcast support * iPod support, as well as other media players * Powerful scripting interface - * KDE integration + * Integration with Plasma and KDE Applications * Integration with multiple web sources including Magnatune, Jamendo, Ampache, MP3tunes, and others. -------------------------------------------------------------------------------- DEPENDENCIES ============== +The following list should give you an impression what's required but it might +not be entirely up to date. You can always look at CMakeLists.txt to discover +the most recent dependencies. + Required - * KDE-Libs 4.8.4 (or newer) + KDE-Base-runtime 4.8 (oxygen-icons) (or newer) - http://www.kde.org + * KDE Frameworks 5 (for an exact list look at CMakeLists.txt) + https://www.kde.org - * Phonon backend, one of the following is strongly recommended + * Phonon 4.6.60 (with support for Qt5) and one of the following backends: * phonon-gstreamer 4.6.3 (or newer) * phonon-vlc 0.6.1 (or newer; as of 0.6.1 doesn't yet play Audio CDs, bug 313046) - * Qt 4.8.3 (or newer) - http://qt-project.org + * Qt 5.8 (or newer) + https://qt.io/ * TagLib 1.7 (or newer) (Metadata tagging library) @@ -55,19 +59,10 @@ * MySQL 5.0 (or newer) Embedded: libmysqld compiled with fPIC (In-process database support) - * QtScript Generator, Qt Bindings 0.1.0 - (Qt Bindings for QtScript for Amarok's scripting system) - http://code.google.com/p/qtscriptgenerator/ - http://qt.gitorious.org/qt-labs/qtscriptgenerator - - * LibQCA 2.0.2 (or newer) - (Qt Cryptographic Architecture) - http://delta.affinix.com/qca/ - Optional * Taglib 1.8 for support of MOD, IT, S3M and XM files * Taglib 1.9 for support of Opus files - http://developer.kde.org/~wheeler/taglib.html + http://taglib.org/ https://github.com/taglib/taglib * iPod support requires: @@ -85,34 +80,34 @@ * QtOpenGL * Mp3tunes.com integration (including syncronization) requires: - * OpenSSL http://www.openssl.org + * OpenSSL https://www.openssl.org * libxml2 http://xmlsoft.org - * libcurl http://curl.haxx.se - * Glib2 http://www.gtk.org + * libcurl https://curl.haxx.se + * Glib2 https://www.gtk.org * Loudmouth, the Jabber library, http://www.loudmouth-project.org/ * Qt must be compiled with Glib enabled * Liblastfm 1.0.3 (or newer) (For scrobbling, internet radio, and artist info) http://cdn.last.fm/client/liblastfm-1.0.3.tar.gz https://github.com/eartle/liblastfm - * QJson 0.7 (or newer) - (Qt JSON Parser for the Playdar Collection) - http://qjson.sourceforge.net/ - * MySQL 5.0 (or newer) Server (external database support) * MusicBrainz-based audio fingerprint tag lookup requires: - * FFmpeg 0.7.0 (or newer) - http://ffmpeg.org/ + * FFmpeg 0.7.0 (or newer) - https://ffmpeg.org/ * libavcodec & libavformat specifically * LibOFA - http://code.google.com/p/musicip-libofa/ * gpodder.net Podcast Provider & Service - * libmygpo-qt 1.0.7 (or newer) + * libmygpo-qt 1.0.9 (or newer) + Actually it needs the to-be-released 1.10. Or you use 1.0.9 and add the + patches from the following pull requests: + - https://github.com/gpodder/libmygpo-qt/pull/12 + - https://github.com/gpodder/libmygpo-qt/pull/13 * Transcoding requires (at runtime): - * FFmpeg 0.7.0 (or newer) - http://ffmpeg.org/ + * FFmpeg 0.7.0 (or newer) - https://ffmpeg.org/ * For all supported encoders to be available in Amarok, FFmpeg needs to support the following codecs: * aac (introduced in 3.0, https://www.ffmpeg.org/index.html#aac_encoder_stable) @@ -124,14 +119,10 @@ * wmav2 * CD support requires: - * audiocd-kio - http://www.kde.org/ (part of KDE multimedia) - - * Downloading songs from Amazon works best on non Windows systems using - * clamz - https://code.google.com/p/clamz/ - * The official downloader should work fine on Windows, too. But it's broken on many Linux systems. + * audiocd-kio - https://www.kde.org/ (part of KDE multimedia) * Building tests require: - * gmock 1.4 (or newer) - http://code.google.com/p/googlemock/ + * gmock 1.4 (or newer) - https://github.com/google/googletest Please note that if compiling from source you also need to install -dev/-devel versions of these packages, depending on your distribution. @@ -143,7 +134,7 @@ To compile from source, please refer to the INSTALL file. -Packages for popular distributions are available at http://amarok.kde.org +Packages for popular distributions are available at https://amarok.kde.org -------------------------------------------------------------------------------- @@ -153,7 +144,7 @@ For answers to problems like "Amarok won't play any MP3s!" and "My MP3s skip and stutter!" please visit: - http://amarok.kde.org/ + https://amarok.kde.org/ -------------------------------------------------------------------------------- @@ -168,12 +159,12 @@ provides a slightly-less-instant overview. More information at: -http://community.kde.org/Amarok/Development/Join +https://community.kde.org/Amarok/Development/Join See you on IRC! -------------------------------------------------------------------------------- -WWW: http://amarok.kde.org +WWW: https://amarok.kde.org MAIL: amarok@kde.org IRC: irc.freenode.net - #amarok, #amarok.de, #amarok.es, #amarok.fr diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt --- a/cmake/modules/CMakeLists.txt +++ b/cmake/modules/CMakeLists.txt @@ -2,7 +2,7 @@ file(GLOB cmakeFiles "${CMAKE_CURRENT_SOURCE_DIR}/*.cmake") -set(module_install_dir ${DATA_INSTALL_DIR}/cmake/modules ) +set(module_install_dir ${KDE_INSTALL_DATADIR}/cmake/modules ) install( FILES ${cmakeFiles} DESTINATION ${module_install_dir} ) diff --git a/cmake/modules/CheckQtGlib.cmake b/cmake/modules/CheckQtGlib.cmake --- a/cmake/modules/CheckQtGlib.cmake +++ b/cmake/modules/CheckQtGlib.cmake @@ -1,6 +1,6 @@ set(CMAKE_REQUIRED_LIBRARIES Qt5::Core) check_cxx_source_compiles(" -#include +#include int main() { #if defined(QT_NO_GLIB) diff --git a/cmake/modules/FindFFTW3.cmake b/cmake/modules/FindFFTW3.cmake new file mode 100644 --- /dev/null +++ b/cmake/modules/FindFFTW3.cmake @@ -0,0 +1,31 @@ +# FindFFTW3 +# --------- +# +# Try to locate the FFTW3 library. +# If found, this wil define the following variables: +# +# FFTW3_FOUND TRUE if the system has the fftw3 library +# FFTW3_INCLUDE_DIRS The fftw3 include directory +# FFTW3_LIBRARIES The fftw3 libraries + +find_package(PkgConfig) +pkg_check_modules(PC_FFTW3 QUIET fftw3) + +find_path(FFTW3_INCLUDE_DIRS + NAMES fftw3.h + HINTS ${PC_FFTW3_INCLUDEDIR} ${PC_FFTW3_INCLUDE_DIRS} +) + +find_library(FFTW3_LIBRARIES + NAMES fftw3 + HINTS ${PC_FFTW3_LIBDIR} ${PC_FFTW3_LIBRARY_DIRS} +) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(FFTW3 REQUIRED_VARS FFTW3_LIBRARIES FFTW3_INCLUDE_DIRS) + +mark_as_advanced(FFTW3_INCLUDE_DIRS FFTW3_LIBRARIES) +set_package_properties(FFTW3 PROPERTIES + URL "http://www.fftw.org/" + DESCRIPTION "A C subroutine library for computing the discrete Fourier transform" +) diff --git a/cmake/modules/FindGDKPixBuf.cmake b/cmake/modules/FindGDKPixBuf.cmake --- a/cmake/modules/FindGDKPixBuf.cmake +++ b/cmake/modules/FindGDKPixBuf.cmake @@ -30,12 +30,10 @@ /usr/include/ /sw/include/ /usr/local/include/ - ${KDE4_INCLUDE_DIR} # Search all subdirs of the above /usr/include/* /sw/include/* /usr/local/include/* - ${KDE4_INCLUDE_DIR}/* PATH_SUFFIXES # Subdirectory hints gdk-pixbuf-2.0 diff --git a/cmake/modules/FindGooglemock.cmake b/cmake/modules/FindGooglemock.cmake --- a/cmake/modules/FindGooglemock.cmake +++ b/cmake/modules/FindGooglemock.cmake @@ -39,9 +39,7 @@ /opt/local/include /usr/include /usr/local/include - /opt/kde4/include - ${KDE4_INCLUDE_DIR} - PATH_SUFFIXES gmock + PATH_SUFFIXES gmock gmock/src ) find_library( GOOGLEMOCK_LIBRARY NAMES gmock @@ -51,8 +49,6 @@ /usr/lib /usr/lib64 /usr/local/lib - /opt/kde4/lib - ${KDE4_LIB_DIR} ) find_library( GOOGLEMOCK_DEP_GTEST_LIBRARY NAMES gtest @@ -62,8 +58,6 @@ /usr/lib /usr/lib64 /usr/local/lib - /opt/kde4/lib - ${KDE4_LIB_DIR} ) # google-mock >= 1.5 requires pthread @@ -76,8 +70,6 @@ /usr/lib /usr/lib64 /usr/local/lib - /opt/kde4/lib - ${KDE4_LIB_DIR} ) endif() @@ -126,8 +118,6 @@ /usr/lib /usr/lib64 /usr/local/lib - /opt/kde4/lib - ${KDE4_LIB_DIR} ) set( CMAKE_FIND_LIBRARY_SUFFIXES ${OLD_CMAKE_FIND_LIBRARY_SUFFIXES}) endif() diff --git a/cmake/modules/FindHUpnp.cmake b/cmake/modules/FindHUpnp.cmake deleted file mode 100644 --- a/cmake/modules/FindHUpnp.cmake +++ /dev/null @@ -1,22 +0,0 @@ -# - Find HUpnp -# HUpnp is a Universal Plug and Play (UPnP) library -# used by the UPnP collection. -# Defines: -# HUPNP_INCLUDE_DIR -# HUPNP_LIBRARIES -# HUPNP_FOUND - -find_path(HUPNP_INCLUDE_DIR HUpnp HINTS ${KDE4_INCLUDE_DIR}) - -find_library(HUPNP_LIBRARIES HUpnp PATHS ${KDE4_LIB_DIR}) - -if(HUPNP_INCLUDE_DIR AND HUPNP_LIBRARIES) - set(HUPNP_FOUND TRUE) - message(STATUS "Found HUpnp") -else() - set(HUPNP_FOUND FALSE) - if(HUPNP_FIND_REQUIRED) - message(FATAL_ERROR "Could NOT find required package HUpnp: ") - endif() -endif() - diff --git a/cmake/modules/FindLibLastFm.cmake b/cmake/modules/FindLibLastFm.cmake --- a/cmake/modules/FindLibLastFm.cmake +++ b/cmake/modules/FindLibLastFm.cmake @@ -13,8 +13,6 @@ /opt/local/include /usr/include /usr/local/include - /opt/kde4/include - ${KDE4_INCLUDE_DIR} PATH_SUFFIXES lastfm5 ) @@ -26,8 +24,6 @@ /usr/lib64 /usr/local/lib /usr/local/lib64 - /opt/kde4/lib - ${KDE4_LIB_DIR} ) diff --git a/cmake/modules/FindLibOFA.cmake b/cmake/modules/FindLibOFA.cmake --- a/cmake/modules/FindLibOFA.cmake +++ b/cmake/modules/FindLibOFA.cmake @@ -4,8 +4,6 @@ /opt/local/include /usr/include /usr/local/include - /opt/kde4/include - ${KDE4_INCLUDE_DIR} PATH_SUFFIXES ofa1 ) @@ -16,8 +14,6 @@ /usr/lib /usr/lib64 /usr/local/lib - /opt/kde4/lib - ${KDE4_LIB_DIR} ) diff --git a/cmake/modules/FindMtp.cmake b/cmake/modules/FindMtp.cmake --- a/cmake/modules/FindMtp.cmake +++ b/cmake/modules/FindMtp.cmake @@ -7,49 +7,47 @@ # MTP_DEFINITIONS - Compiler switches required for using libmtp # -if (MTP_INCLUDE_DIR AND MTP_LIBRARIES AND MTP_VERSION_OKAY) - - # in cache already - set(MTP_FOUND TRUE) - -else () - if(NOT WIN32) - # use pkg-config to get the directories and then use these values - # in the FIND_PATH() and FIND_LIBRARY() calls - include(FindPkgConfig) - - pkg_check_modules(_MTP libmtp) - - set(MTP_DEFINITIONS ${_MTP_CFLAGS}) - endif() - find_path(MTP_INCLUDE_DIR libmtp.h - ${_MTP_INCLUDE_DIRS} - ) - - find_library(MTP_LIBRARIES NAMES mtp - PATHS - ${_MTP_LIBRARY_DIRS} - ) - - exec_program(${PKG_CONFIG_EXECUTABLE} ARGS --atleast-version=1.0.0 libmtp OUTPUT_VARIABLE _pkgconfigDevNull RETURN_VALUE MTP_VERSION_OKAY) - - if (MTP_INCLUDE_DIR AND MTP_LIBRARIES AND MTP_VERSION_OKAY STREQUAL "0") - set(MTP_FOUND TRUE) - endif () - - if (MTP_FOUND) - if (NOT Mtp_FIND_QUIETLY) - message(STATUS "Found MTP: ${MTP_LIBRARIES}") - endif () - else () - if (MTP_INCLUDE_DIR AND MTP_LIBRARIES AND NOT MTP_VERSION_OKAY STREQUAL "0") - message(STATUS "Found MTP but version requirements not met") - endif () - if (Mtp_FIND_REQUIRED) - message(FATAL_ERROR "Could NOT find MTP") - endif () - endif () - - mark_as_advanced(MTP_INCLUDE_DIR MTP_LIBRARIES MTP_VERSION_OKAY) - -endif () +find_package(PkgConfig QUIET) +pkg_check_modules(PC_MTP QUIET libmtp>=${Mtp_FIND_VERSION}) + +set(MTP_DEFINITIONS ${PC_MTP_CFLAGS}) + +find_path(MTP_INCLUDE_DIR + NAMES libmtp.h + HINTS ${PC_MTP__INCLUDEDIR} ${PC_MTP_INCLUDE_DIRS} +) + +find_library(MTP_LIBRARIES + NAMES mtp + HINTS ${PC_MTP_LIBDIR} ${PC_MTP_LIBRARY_DIRS} +) + +if(PC_MTP_VERSION) + set(MTP_VERSION_STRING ${PC_MTP_VERSION}) +elseif(MTP_INCLUDE_DIR AND EXISTS "${MTP_INCLUDE_DIR}/libmtp.h") + file(STRINGS "${MTP_INCLUDE_DIR}/libmtp.h" mtp_version_str + REGEX "^#define[\t ]+LIBMTP_VERSION_STRING[\t ]+\".*\"") + + string(REGEX REPLACE "^#define[\t ]+LIBMTP_VERSION_STRING[\t ]+\"([^\"]*)\".*" "\\1" + MTP_VERSION_STRING "${mtp_version_str}") + unset(mtp_version_str) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Mtp + REQUIRED_VARS MTP_LIBRARIES MTP_INCLUDE_DIR + VERSION_VAR MTP_VERSION_STRING +) + +if(MTP_FOUND AND NOT TARGET Mtp::Mtp) + add_library(Mtp::Mtp UNKNOWN IMPORTED) + set_target_properties(Mtp::Mtp PROPERTIES + IMPORTED_LOCATION "${MTP_LIBRARIES}" + INTERFACE_INCLUDE_DIRECTORIES "${MTP_INCLUDE_DIR}") +endif() + +mark_as_advanced(MTP_INCLUDE_DIR MTP_LIBRARIES) +set_package_properties(Mtp PROPERTIES + URL "http://libmtp.sourceforge.net/" + DESCRIPTION "An implementation of Microsoft's Media Transfer Protocol (MTP)" +) diff --git a/cmake/modules/FindMySQL.cmake b/cmake/modules/FindMySQL.cmake new file mode 100644 --- /dev/null +++ b/cmake/modules/FindMySQL.cmake @@ -0,0 +1,128 @@ +# - Try to find MySQL / MySQL Embedded library +# Find the MySQL includes and client library +# This module defines +# MYSQL_INCLUDE_DIR, where to find mysql.h +# MYSQL_LIBRARIES, the libraries needed to use MySQL. +# MYSQL_EMBEDDED_LIBRARIES, the libraries needed to use MySQL Embedded. +# MySQL_FOUND, If false, do not try to use MySQL. +# MySQL_Embedded_FOUND, If false, do not try to use MySQL Embedded. + +# Copyright (c) 2006-2018, Jarosław Staniek +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + +include(CheckCXXSourceCompiles) +include(CMakePushCheckState) + +# First try to get information from mysql_config which might be a shell script +# or an executable. Unfortunately not every distro has pkgconfig files for +# MySQL/MariaDB. +find_program(MYSQLCONFIG_EXECUTABLE + NAMES mysql_config mysql_config5 + HINTS ${BIN_INSTALL_DIR} +) + +if(MYSQLCONFIG_EXECUTABLE) + execute_process( + COMMAND ${MYSQLCONFIG_EXECUTABLE} --libs + RESULT_VARIABLE MC_return_libraries + OUTPUT_VARIABLE MYSQL_LIBRARIES + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + + execute_process( + COMMAND ${MYSQLCONFIG_EXECUTABLE} --libmysqld-libs + RESULT_VARIABLE MC_return_embedded + OUTPUT_VARIABLE MC_MYSQL_EMBEDDED_LIBRARIES + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + + if(NOT MC_MYSQL_EMBEDDED_LIBRARIES) + # At least on OpenSUSE --libmysql-libs doesn't exist, so we just use + # MYSQL_LIBRARIES for that. We'll see if that's enough when testing + # below. + set(MYSQL_EMBEDDED_LIBRARIES ${MYSQL_LIBRARIES}) + else() + set(MYSQL_EMBEDDED_LIBRARIES ${MC_MYSQL_EMBEDDED_LIBRARIES}) + endif() +endif() + +# Try searching manually via find_path/find_library, possibly with hints +# from pkg-config +find_package(PkgConfig) +pkg_check_modules(PC_MYSQL QUIET mysql mariadb) + +find_path(MYSQL_INCLUDE_DIR mysql.h + PATHS + $ENV{MYSQL_INCLUDE_DIR} + $ENV{MYSQL_DIR}/include + ${PC_MYSQL_INCLUDEDIR} + ${PC_MYSQL_INCLUDE_DIRS} + /usr/local/mysql/include + /opt/mysql/mysql/include + PATH_SUFFIXES + mysql +) + +if(NOT MYSQL_LIBRARIES AND NOT MYSQL_EMBEDDED_LIBRARIES) + find_library(MYSQL_LIBRARIES NAMES mysqlclient + PATHS + $ENV{MYSQL_DIR}/libmysql_r/.libs + $ENV{MYSQL_DIR}/lib + $ENV{MYSQL_DIR}/lib/mysql + ${PC_MYSQL_LIBDIR} + ${PC_MYSQL_LIBRARY_DIRS} + PATH_SUFFIXES + mysql + ) + + find_library(MYSQL_EMBEDDED_LIBRARIES NAMES mysqld libmysqld + PATHS + $ENV{MYSQL_DIR}/libmysql_r/.libs + $ENV{MYSQL_DIR}/lib + $ENV{MYSQL_DIR}/lib/mysql + ${PC_MYSQL_LIBDIR} + ${PC_MYSQL_LIBRARY_DIRS} + PATH_SUFFIXES + mysql + ) +endif() + +if(PC_MYSQL_VERSION) + set(MySQL_VERSION_STRING ${PC_MYSQL_VERSION}) +endif() + +if(MYSQL_EMBEDDED_LIBRARIES) + # libmysqld on FreeBSD apparently doesn't properly report what libraries + # it likes to link with, libmysqlclient does though. + #if(${CMAKE_HOST_SYSTEM_NAME} MATCHES "FreeBSD") + # string(REGEX REPLACE "-lmysqlclient" "-lmysqld" _mysql_libs ${MYSQL_LIBRARIES}) + # string(STRIP ${_mysql_libs} _mysql_libs) + # set(MYSQL_EMBEDDED_LIBRARIES ${_mysql_libs}) + #endif() + cmake_push_check_state() + set(CMAKE_REQUIRED_INCLUDES ${MYSQL_INCLUDE_DIR}) + set(CMAKE_REQUIRED_LIBRARIES ${MYSQL_EMBEDDED_LIBRARIES}) + check_cxx_source_compiles( "#include \nint main() { int i = MYSQL_OPT_USE_EMBEDDED_CONNECTION; }" HAVE_MYSQL_OPT_EMBEDDED_CONNECTION ) + cmake_pop_check_state() +endif() + +include(FindPackageHandleStandardArgs) + +find_package_handle_standard_args(MySQL + REQUIRED_VARS MYSQL_LIBRARIES MYSQL_INCLUDE_DIR + VERSION_VAR MySQL_VERSION_STRING +) + +find_package_handle_standard_args(MySQL_Embedded + REQUIRED_VARS MYSQL_EMBEDDED_LIBRARIES MYSQL_INCLUDE_DIR HAVE_MYSQL_OPT_EMBEDDED_CONNECTION +) + +mark_as_advanced(MYSQL_INCLUDE_DIR MYSQL_LIBRARIES + MYSQL_EMBEDDED_LIBRARIES HAVE_MYSQL_OPT_EMBEDDED_CONNECTION +) +set_package_properties(MySQL PROPERTIES + DESCRIPTION "MySQL Client Library (libmysqlclient)" + URL "http://www.mysql.com" +) diff --git a/cmake/modules/FindMySQLAmarok.cmake b/cmake/modules/FindMySQLAmarok.cmake deleted file mode 100644 --- a/cmake/modules/FindMySQLAmarok.cmake +++ /dev/null @@ -1,123 +0,0 @@ -# - Find MySQL / MySQL Embedded -# Find the MySQL includes and client library -# This module defines -# MYSQL_INCLUDE_DIR, where to find mysql.h -# MYSQL_LIBRARIES, the libraries needed to use MySQL. -# MYSQL_EMBEDDED_LIBRARIES, the libraries needed to use MySQL Embedded. -# MYSQL_FOUND, If false, do not try to use MySQL. -# MYSQL_EMBEDDED_FOUND, If false, do not try to use MySQL Embedded. -# MYSQLAMAROK_FOUND, TRUE if both MYSQL and MYSQL_EMBEDDED have been found, FALSE otherwise. - -# Copyright (c) 2006, Jaroslaw Staniek, -# -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - -include(CMakePushCheckState) - -if(NOT WIN32) - find_program(MYSQLCONFIG_EXECUTABLE NAMES mysql_config mysql_config5 HINTS ${BIN_INSTALL_DIR}) -endif() - -find_path(MYSQL_INCLUDE_DIR mysql.h PATH_SUFFIXES mysql mysql5/mysql) - -if(MYSQLCONFIG_EXECUTABLE) - exec_program(${MYSQLCONFIG_EXECUTABLE} ARGS --cflags RETURN_VALUE _return_VALUE OUTPUT_VARIABLE MYSQL_CFLAGS) - exec_program(${MYSQLCONFIG_EXECUTABLE} ARGS --libs RETURN_VALUE _return_VALUE OUTPUT_VARIABLE MYSQL_LIBRARIES) - exec_program(${MYSQLCONFIG_EXECUTABLE} ARGS --libmysqld-libs RETURN_VALUE _return_VALUE OUTPUT_VARIABLE MYSQL_EMBEDDED_LIBSTEMP) - - set(MYSQL_EMBEDDED_CFLAGS ${MYSQL_CFLAGS}) - - if(MYSQL_EMBEDDED_LIBSTEMP) - set( HAVE_MYSQL_EMBEDDED true ) - endif() - - find_library(MYSQLD_PIC_SEPARATE - mysqld_pic - PATH_SUFFIXES mysql - ) - - if(MYSQLD_PIC_SEPARATE) - string(REPLACE "lmysqld" "lmysqld_pic" MYSQL_EMBEDDED_LIBRARIES ${MYSQL_EMBEDDED_LIBSTEMP}) - # append link directory to variable as mysql_config is not always (since Ubuntu 12.04?) - # reporting this directory with when being called with --libs - get_filename_component(MYSQL_EMBEDDED_LIB_DIR_TMP "${MYSQLD_PIC_SEPARATE}" PATH) - set(MYSQL_EMBEDDED_LIBRARIES "${MYSQL_EMBEDDED_LIBRARIES} -L${MYSQL_EMBEDDED_LIB_DIR_TMP}") - else() - set(MYSQL_EMBEDDED_LIBRARIES ${MYSQL_EMBEDDED_LIBSTEMP}) - endif() - - if (UNIX) - # libmysqld wants -lpthread, but it is very likely it does not say that - # explicitly in --libmysqld-libs - find_package(Threads) - set(MYSQL_EMBEDDED_LIBRARIES "${MYSQL_EMBEDDED_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}") - endif() - -else() - - if(WIN32) - set(MYSQL_CLIENT_LIBRARY_NAME libmysql) - else() - set(MYSQL_CLIENT_LIBRARY_NAME mysqlclient) - endif() - - find_library(MYSQL_LIBRARIES NAMES ${MYSQL_CLIENT_LIBRARY_NAME} - PATHS - ~/usr/lib/mysql - /opt/mysql/mysql/lib - /usr/mysql/lib/mysql - /opt/local/lib/mysql5/mysql - /opt/mysqle/lib/mysql - /usr/lib/mysql - /usr/lib64/mysql - /usr/lib64 - /usr/local/lib/mysql - /opt/local/lib/mysql - /opt/ports/lib/mysql5/mysql - ) - - find_library(MYSQL_EMBEDDED_LIBRARIES NAMES mysqld_pic mysqld libmysqld - PATHS - ~/usr/lib/mysql - /opt/local/lib/mysql5/mysql - /opt/mysqle/lib/mysql - /usr/lib/mysql - /usr/lib64/mysql - /usr/local/lib/mysql - /opt/mysql/lib/mysql - /opt/local/lib/mysql - /opt/ports/lib/mysql5/mysql - ) - - cmake_push_check_state() - set( CMAKE_REQUIRED_INCLUDES ${MYSQL_INCLUDE_DIR} ) - set( CMAKE_REQUIRED_LIBRARIES ${MYSQL_EMBEDDED_LIBRARIES} ) - include_directories( ${MYSQL_INCLUDE_DIR} ) - check_cxx_source_compiles( "#if (defined(_WIN32) || defined(_WIN64))\n#define __LCC__\n#endif\n#include \nint main() { int i = MYSQL_OPT_USE_EMBEDDED_CONNECTION; }" HAVE_MYSQL_EMBEDDED ) - cmake_pop_check_state() - -endif() - -if(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES) - set(MYSQL_FOUND TRUE) - message(STATUS "Found MySQL: ${MYSQL_INCLUDE_DIR}, ${MYSQL_LIBRARIES}") -else() - set(MYSQL_FOUND FALSE) - message(STATUS "MySQL not found.") -endif() - -if(MYSQL_INCLUDE_DIR AND MYSQL_EMBEDDED_LIBRARIES AND HAVE_MYSQL_EMBEDDED) - set(MYSQL_EMBEDDED_FOUND TRUE) - message(STATUS "Found MySQL Embedded: ${MYSQL_INCLUDE_DIR}, ${MYSQL_EMBEDDED_LIBRARIES}") -else() - set(MYSQL_EMBEDDED_FOUND FALSE) - message(STATUS "MySQL Embedded not found.") -endif() - -#MYSQLAMAROK_FOUND has to be defined so that MYSQLAMAROK gets into the PACKAGES_FOUND property and the other properties that depend on _FOUND variables. If this is not set to TRUE (when both MYSQL and MYSQLD are available) then on the subsequent call to feature_summary, MySQLAmarok will be missing from the PACKAGES_FOUND property and hence it will be marked as a missing required feature thus breaking the build when feature_summary has been used with FATAL_ON_MISSING_REQUIRED_PACKAGES. -if(MYSQL_EMBEDDED_FOUND AND MYSQL_FOUND) - set(MYSQLAMAROK_FOUND TRUE) -endif() - -mark_as_advanced(MYSQL_INCLUDE_DIR MYSQL_LIBRARIES MYSQL_EMBEDDED_LIBRARIES) diff --git a/cmake/modules/FindQJSON.cmake b/cmake/modules/FindQJSON.cmake deleted file mode 100644 --- a/cmake/modules/FindQJSON.cmake +++ /dev/null @@ -1,44 +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 -# - -if (QJSON_INCLUDE_DIR AND QJSON_LIBRARIES) - - # Already in cache - set (QJSON_FOUND TRUE) - -else () - - if (NOT WIN32) - # use pkg-config to get the values of QJSON_INCLUDE_DIRS - # and QJSON_LIBRARY_DIRS to add as hints to the find commands. - include (FindPkgConfig) - pkg_check_modules (PC_QJSON QJson>=0.5) - endif () - - find_library (QJSON_LIBRARIES - NAMES - qjson - PATHS - ${PC_QJSON_LIBRARY_DIRS} - ${LIB_INSTALL_DIR} - ${KDE4_LIB_DIR} - ) - - find_path (QJSON_INCLUDE_DIR - NAMES - qjson/parser.h - PATHS - ${PC_QJSON_INCLUDE_DIRS} - ${INCLUDE_INSTALL_DIR} - ${KDE4_INCLUDE_DIR} - ) - - include(FindPackageHandleStandardArgs) - find_package_handle_standard_args(QJSON DEFAULT_MSG QJSON_LIBRARIES QJSON_INCLUDE_DIR) - -endif () diff --git a/cmake/modules/FindQtScriptQtBindings.cmake b/cmake/modules/FindQtScriptQtBindings.cmake deleted file mode 100644 --- a/cmake/modules/FindQtScriptQtBindings.cmake +++ /dev/null @@ -1,44 +0,0 @@ -## Ian Monroe Copyright 2009 -# released under public domain or: -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# This library 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# - -include(CheckCXXSourceRuns) - -if(NOT WIN32) - file( READ "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/bindingstest/QtScriptBindingsTest.cpp" source ) - message(STATUS "Checking if the QtScript Qt Bindings are installed.") - - - set(CMAKE_REQUIRED_DEFINTIONS ${QT_DEFINITIONS} ${KDE4_DEFINITIONS} ) - set(CMAKE_REQUIRED_INCLUDES ${QT_QTCORE_INCLUDE_DIR} ${QT_QTSCRIPT_INCLUDE_DIR} ${KDE4_INCLUDES}) - set(CMAKE_REQUIRED_LIBRARIES ${QT_QTSCRIPT_LIBRARY} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} -L${KDE4_LIB_DIR} -lkdecore -lkdeui) - message( STATUS "includes ${CMAKE_REQUIRED_INCLUDES} libraries ${CMAKE_REQUIRED_LIBRARIES}" ) - check_cxx_source_runs( "${source}" BINDINGS_RUN_RESULT) - - if(BINDINGS_RUN_RESULT EQUAL 1) - message( STATUS "QtBindings found") - set(QTSCRIPTQTBINDINGS_FOUND TRUE) - else() - message( STATUS "QtBindings not found. run `cd cmake/modules/bindingstest; mkdir build; cd build; cmake ..; make; ./bindingstest; echo $?` If it prints '0' then you're actually fine.") - set(QTSCRIPTQTBINDINGS_FOUND FALSE) - endif() - - set(CMAKE_REQUIRED_DEFINTIONS "" ) - set(CMAKE_REQUIRED_INCLUDES "") - set(CMAKE_REQUIRED_LIBRARIES "") -else() - set(QTSCRIPTQTBINDINGS_FOUND TRUE) -endif() diff --git a/cmake/modules/FindTaglib-Extras.cmake b/cmake/modules/FindTaglib-Extras.cmake --- a/cmake/modules/FindTaglib-Extras.cmake +++ b/cmake/modules/FindTaglib-Extras.cmake @@ -52,19 +52,18 @@ tfile_helper.h PATH_SUFFIXES taglib-extras PATHS - ${KDE4_INCLUDE_DIR} ${INCLUDE_INSTALL_DIR} ) if(NOT WIN32) # on non-win32 we don't need to take care about WIN32_DEBUG_POSTFIX - find_library(TAGLIB-EXTRAS_LIBRARIES tag-extras PATHS ${KDE4_LIB_DIR} ${LIB_INSTALL_DIR}) + find_library(TAGLIB-EXTRAS_LIBRARIES tag-extras PATHS ${LIB_INSTALL_DIR}) else() # 1. get all possible libnames - set(args PATHS ${KDE4_LIB_DIR} ${LIB_INSTALL_DIR}) + set(args PATHS ${LIB_INSTALL_DIR}) set(newargs "") set(libnames_release "") set(libnames_debug "") diff --git a/cmake/modules/FindTaglib.cmake b/cmake/modules/FindTaglib.cmake --- a/cmake/modules/FindTaglib.cmake +++ b/cmake/modules/FindTaglib.cmake @@ -52,19 +52,18 @@ tag.h PATH_SUFFIXES taglib PATHS - ${KDE4_INCLUDE_DIR} ${INCLUDE_INSTALL_DIR} ) if(NOT WIN32) # on non-win32 we don't need to take care about WIN32_DEBUG_POSTFIX - find_library(TAGLIB_LIBRARIES tag PATHS ${KDE4_LIB_DIR} ${LIB_INSTALL_DIR}) + find_library(TAGLIB_LIBRARIES tag PATHS ${LIB_INSTALL_DIR}) else() # 1. get all possible libnames - set(args PATHS ${KDE4_LIB_DIR} ${LIB_INSTALL_DIR}) + set(args PATHS ${LIB_INSTALL_DIR}) set(newargs "") set(libnames_release "") set(libnames_debug "") diff --git a/cmake/modules/bindingstest/CMakeLists.txt b/cmake/modules/bindingstest/CMakeLists.txt deleted file mode 100644 --- a/cmake/modules/bindingstest/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -cmake_minimum_required (VERSION 2.6) - -find_package( KDE4 REQUIRED ) - -add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS}) -include_directories (${QT_QTCORE_INCLUDE_DIR} ${QT_QTSCRIPT_INCLUDE_DIR} ) - -add_executable (bindingstest QtScriptBindingsTest.cpp) -target_link_libraries( bindingstest Qt5::Script ) - diff --git a/cmake/modules/bindingstest/QtScriptBindingsTest.cpp b/cmake/modules/bindingstest/QtScriptBindingsTest.cpp --- a/cmake/modules/bindingstest/QtScriptBindingsTest.cpp +++ b/cmake/modules/bindingstest/QtScriptBindingsTest.cpp @@ -34,7 +34,7 @@ { QScriptValue error = engine.importExtension( binding ); if( error.isUndefined() ) - { // undefined indiciates success + { // undefined indicates success continue; } diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt --- a/data/CMakeLists.txt +++ b/data/CMakeLists.txt @@ -1,7 +1,7 @@ -install( FILES amarok_homerc DESTINATION ${CONFIG_INSTALL_DIR} ) -install( FILES amarok.notifyrc DESTINATION ${KNOTIFYRC_INSTALL_DIR} ) +install( FILES amarok_homerc DESTINATION ${KDE_INSTALL_CONFDIR} ) +install( FILES amarok.notifyrc DESTINATION ${KDE_INSTALL_KNOTIFY5RCDIR} ) install(FILES DefaultPlaylistLayouts.xml first_run_jingle.ogg - DESTINATION ${DATA_INSTALL_DIR}/amarok/data) + DESTINATION ${KDE_INSTALL_DATADIR}/amarok/data) diff --git a/data/amarok.notifyrc b/data/amarok.notifyrc --- a/data/amarok.notifyrc +++ b/data/amarok.notifyrc @@ -1,5 +1,6 @@ [Global] IconName=amarok +DesktopEntry=org.kde.amarok Comment=Amarok Comment[bg]=Amarok Comment[bs]=Amarok @@ -72,7 +73,7 @@ Name[ga]=Athrú Amhráin Name[gl]=Cambio de pista Name[hu]=Számváltás -Name[id]=Ubah Track +Name[id]=Ubah Trek Name[is]=Skipt um lag Name[it]=Cambiamento della traccia Name[ja]=トラック変更 @@ -100,7 +101,6 @@ Name[tr]=Parça Değişimi Name[uk]=Зміна композиції Name[x-test]=xxTrack Changexx -Name[zh_CN]=音轨更改 Name[zh_TW]=曲目變更 Comment=Amarok changed to a new track Comment[bg]=Amarok прехвърли към друг запис @@ -125,7 +125,7 @@ Comment[it]=Amarok è passato a una nuova traccia Comment[ja]=Amarok は新しいトラックに変更されました Comment[km]=Amarok បាន​ផ្លាស់ប្ដូរ​ទៅ​បទ​ថ្មី -Comment[ko]=Amarok에서 새 트랙을 재생함 +Comment[ko]=Amarok이 새로운 트랙으로 바뀌었습니다 Comment[lt]=Amarokas persijungė į naują dainą Comment[lv]=Amarok sāka atskaņot jaunu celiņu Comment[nb]=Amarok byttet til et nytt spor @@ -148,13 +148,12 @@ Comment[tr]=Amarok yeni bir parçaya geçti Comment[uk]=Композиція у Amarok змінилася Comment[x-test]=xxAmarok changed to a new trackxx -Comment[zh_CN]=Amarok 更改到新音轨 Comment[zh_TW]=Amarok 已變更至新的曲目 Action=Popup +Urgency=Low [Event/message] Name=Message -Name[ast]=Mensaxe Name[bs]=Poruka Name[ca]=Missatge Name[ca@valencia]=Missatge @@ -174,6 +173,7 @@ Name[ia]=Message Name[id]=Pesan Name[it]=Messaggio +Name[ko]=메시지 Name[lt]=Pranešimas Name[lv]=Ziņojums Name[mr]=संदेश @@ -196,7 +196,7 @@ Name[ug]=ئۇچۇر Name[uk]=Повідомлення Name[x-test]=xxMessagexx -Name[zh_CN]=消息 +Name[zh_CN]=信件 Name[zh_TW]=訊息 Comment=Amarok issued an uncategorized text message Comment[bs]=Amarok je izbacio nekategorizovanu tekstualnu poruku @@ -216,6 +216,7 @@ Comment[hu]=Az Amarok egy kategorizálatlan szöveges üzenetet adott ki Comment[id]=Amarok mengeluarkan pesan teks tidak berkategori Comment[it]=Amarok ha generato un messaggio di testo non categorizzato +Comment[ko]=Amarok이 분류되지 않은 문자 메시지를 보냈습니다 Comment[lt]=Amarok pateikė tekstinį pranešimą be kategorijos Comment[lv]=Amarok izdeva teksta ziņojumu bez kategorijas Comment[nb]=Amarok sendte en tekstmelding uten kategori @@ -235,6 +236,5 @@ Comment[tr]=Amarok kategorilenmemiş bir metin iletisi oluşturdu Comment[uk]=Програмою Amarok надіслано текстове повідомлення, що не належить до певної категорії Comment[x-test]=xxAmarok issued an uncategorized text messagexx -Comment[zh_CN]=Amarok 发出了一条未分类文本消息 Comment[zh_TW]=Amarok 發出了一個未分類的文字訊息 Action=Popup diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -1 +1 @@ -kdoctools_create_handbook(index.docbook INSTALL_DESTINATION ${HTML_INSTALL_DIR}/en SUBDIR amarok) +kdoctools_create_handbook(index.docbook INSTALL_DESTINATION ${KDE_INSTALL_DOCBUNDLEDIR}/en SUBDIR amarok) diff --git a/doc/amarok.txt b/doc/amarok.txt --- a/doc/amarok.txt +++ b/doc/amarok.txt @@ -37,7 +37,6 @@ Amarok/Manual/Organization/Collection/SearchInCollection Amarok/Manual/Organization/Collection/OrganizeCollection Amarok/Manual/Organization/Collection/StatisticsSynchronization -Amarok/Manual/Organization/Collection/NepomukCollection Amarok/Manual/Organization/Collection/RemoteCollections Amarok/Manual/Organization/Collection/RemoteCollections/Ampache Amarok/Manual/Organization/Collection/RemoteCollections/DAAP @@ -57,6 +56,7 @@ Amarok/Manual/Playlist/AutomaticPlaylistGenerator Amarok/Manual/Various Amarok/Manual/Various/Moodbar +Amarok/Manual/Various/ReplayGain Amarok/Manual/Various/AmarokOnOtherPlatforms Amarok/Manual/Various/AmarokOnOtherPlatforms/NonKDE Desktops Amarok/Manual/Various/AmarokOnOtherPlatforms/Windows diff --git a/doc/amarok_2-8_nepomukindexfolders_dialog_kde_4-11.png b/doc/amarok_2-8_nepomukindexfolders_dialog_kde_4-11.png deleted file mode 100644 index adbbfa8d08f0a2720c4427077c395b00284b20ab..0000000000000000000000000000000000000000 GIT binary patch literal 0 Hc$@I* zbr0B+xlRliZ2UK$K0xFEXDbXTGIe2gF#mrY-!-QgWPbc%eGG0)rkD9aX?6ATZ^mH7 zkapV1>Ts0iK1Ii+6h|F!YH6vtEO|}O_B8)SeEFM{#l&PIy45=tx_o+_;E%{UZvqkE zbSx6EgFp513lfb*hm-tdrtb@WLejCoL;ixyb-mWV+jB1T^dm8m>%3X0f6)EXg15#? zGi%?|Z{IV~eAn61QZsa9#Fo7x5~B18!lay4KIiPSdu{oASd6fZq^=|Q>`kn*UtFVk zKzD|ShEje%A3AI0t6cyC39+ar7(dFp!Arijls~LgbD)tlvXPf#NO`WP!Ik}q=^N5b zh0Q_Glki1NWqWmX&i;s=5%>G&gVni#rx|vjTTCVj4gfn5H~l1hb={#fRo}kC=jm+L zOk{7rB6K^ZH5C6cA&DqP$=00k)Ad1|8pIVIVy}1&|KPdNPs@1NY$W1x)LN0m^)l-F z7E-s-Zn25=*|$)y0Kbv#ei=V%F~xKE`__GXU*GYaDZWCe{BD}X(90^>N+b1ZF8XT& zApD1MjSz3DCyG9|tq;$;%G?*l^dUU&aB-b(OPqDUNH6mhI!Y^bc=x*Yno^}p7JG~* zq^C%){y z_5RW3Qx+?h+ouvO+S#mXZ8q|#1%ThT{f(8WbI`b!8%1i-lgX>FOE>=rAKNxvikK_c@WNT>7_@x!#{CN;Z@vh>?m#v=Zno+ zy?gt-dlE4Jq!n!F-x48hY&VIMXicTd5`ZOa*uD*vII{w3Lv3(Gl3DR&Wu9|s^lDzT z-TC+b4{>g-@^8kGKs@r1n391mVsYT7BEP4vn$hPMPuTNBKBXP#cv@tRxnfJ1?$#%^ zMo}a4kfB@*_8Dl#pQKd@v{@1O>senJ-BSwP!c)Fi|Krw=RB~i7>@B+|=-<-Ok8;=! zrn=iQB99Jpbd0|4iL>8Tx~my`H;5*jp>*5WwsCAOs%!k~t>TSNd}rej)gl4LA33Ob z|A!RKyXus@>sv@d)a~Y^Tnv4qItADNj~RqA&xjtmmBMf`pGy7GkFMe2TZD#IaE;zx zU&6gt(08qbH#KQMm3jBU4QpKMuF8XL=b-m!Gog2>=YDqy`k7-E>hNMKn&u7o{|{@? z|Bv@1aTA94bS*Eek}L`{wBBA%^BoDF-Pb}-~|HwW7~x@~criA5ES zwYr7==-XV(a#OwM-0qo05~3xHG{9|UB)q(+-OH0MpQ93cR6UN!o7YoHeRUp^cfAEK zAwlyg((ID0ytkg8=zPoYDJtla^Ic#6VzQ@T?A1@x;4rGmp|}fqExyZLM>kC|#aqw6 z;Wn6}*2Z%Ytk`a!*%lU(`XsjJQ{$?#@#fQ%lvcF;fD5dnc&~mX^?wD7D4R?6vEF9K zrmT$B{(gP|v7w*>q3A38aPYg&9``aPe&3==7}ppq=DW2jhE_V z4}7`>aji?KnI3imz8kl@Xiq$^>ZbjFs@w71T5sz;5fb3zTE;HFb&n%?yKJU�oW5 zLay+hZ36BtW#eb=Q_D^^Vq3SGi9Z1Kptr^MHO6t?ALx9|N4ukEG|haWe~Yy%f9_xR zwwbs30Z_*;8b*yEHy{RKk1b+KNq+@&{yJneYi*=6W7xSMX23grgJ*lF<>h2oDGiJB%93&hv z>MP0vyrG>?Fg}mk`b@J%i>&&p!CNgw*7MvH%@J0{-RmpYD~0l7gZhEgW6eb~^Terr znRcNQufpO-24>-#w}J$%k@iyUxn`3!2f8=xf<&!RXQ#ievctmqzXJ=dzRaBh))x8` z((-N}7kr-}cT@|Wd7E(yl^2dPdrJHT`29pCTJQhTmIic{;mFH-(2eUP==_~LII_um zyZ+8#^^+Q@8D7$)XMgX9zK!2CE^7%^DCm7Vi>-9yTLL22eT0p5z0T$*dmr{N1)K`F z>i1h%B6ECCy<=dpNh1DJOKm4IOaF!dw%Wb=R!K31SW>z{*2=r zQIARsVi+%M>M&U3cV*wFRybj7!UFCY5825P4}>gkK7L%sXaZbJPb!5$=_Ui#S*dUz zT?XKBuCCW5$NGJ^@$WQyeLj#~y9^*z((P@wuArT=fbRXKi|mT*lPtNMu$;b}k6gN3i`fd;aIAGOlYjQTTWrqhxH zR@NbrCXzP~jRRklq&4zwCn)^w{qjrEd+*SwSvi8l4dtM!sj<@!Ik0|@-K3DpaYR4D zlf*xjN~FRki7kP?KZq)ouE>Eh;O@4Hj*4s2dy+~e+Jg(;M+YzDfUKD;g5j}HKZnk& zo=O%^6K9e?t@()<_woZww^o;xA}-lVSG3j~fo*q{<8Zz|&a;(FrMG`qRsacsX{|wE zOAh1q_Hb`HJm6yXInn}CY+-TfM;S*P7V}+Y=A9dk{0!S2frGn1UpVuvs;yjcEydgq z6b09|6L&&E4+XZ?0B@`Lik_05vYv{bs-Bvj+MfEJ#-8S$*78J`h^UCTh(xGXx2Qs2 zewd#`20qZ)**SauI3eLT*G3G#JMaTb35$xZZshTNMNZ4Vh3!~nHI0Cl74I(iypriy zB!i5~Wr}CnP@;MY+y(n|Qvt(_T-p~44%)PyB?1SO!CjzoacQ^HmcE1UQ2GHUM)v3% zbyL%sHPcH8gC0Ok>5RDHO)+RCAu5CV06RgIsq!q#=O@C=@5*xp^{kumn4?5Ul8SHO z+|!f3b)KkB=n}OU2hvq)@uzM-J6DD)XJ9S~kE(;dV*${F`+IbQy*B7_6WL)}ZH!wJgBb|Mxtm*^E zj{TUY*LH&c@7o8L8YCZORjY4yv(%?<+y?tb8(5Ne;PX`~FQIV>tS9;!q>1qd{M|dg z8*f;M?Y&iL`A)C3EW~iqLYcL}#RK)u5T-4QIt$~`P`=K>^M=arS@=MTP%S7;_z_yb zWb_BVUq$;m#v1DQebT{ZyH{coMe)s5@}G5C7VT41d{O^e{wctWOq_BkxJXx5AphWk z-p8Ew=xMY&<>A@gZ^-?m|nW!TSnJic0(>f}b3GNGvNGi9-dzU8fTE z&+U4G73u~D3U}^T%pV?@bm8v~k2cE9KcItP&mj}bo(qYtRDK(GgWXEpkJ!5oZNVXc zdy&tvsN!G0V`rvRp)bE1%)Ul^%-E=C3Y4PZpjEUdM}Cw+2ow!$e{(d_stu864x|F$ z=LKf=JdG!2SIcf@iNH{MHjJ>ycvD14>`}MnWMnT(FHZbwrDAOY^sA*nrMPG6KC$&L zY;rBU-^hG(PguxZINC3GB={&ZvK$|7sp!Q~CMtEc7=K>>Rdg`>ZZQvf5hUuZdUjEN zevbr{i$qn?j^FR&ZWOq?cz7I-PfiTtDbd4vBE)$&9 zAowER5}|S49_9-I(u&Ywa7mk1I&Kq1s~GY8NW={mEBy7>EAC@MepLVj=0LCsVuZhn zwcrWYaULeqZ1@qHoqT577}%Rvu(j;O+SF9~RS`;95t|X*zG@w~xV$T*q4fq?G=~!y zd2_7ddrEs|!|%{(gbIBmw@v*(T0xln7(K;G6*E(g5V`@ZQ^~7|Jp1fKwV7&Pn`F{=2!eXE!h7=o z!~qBASRP}>(bdDUa>2X{7xk`P4o_bFyuvtyp@A*>pBE)CL9h$%kJs)#weS`ey94_U zQz2+XmDgz*3w3s6qM(!awhNV%AmCZf*g*O}$IaxLE(r-0HHOL2V=bDBau=b$rDcDS zPz|K#YfQw9_dV|e){Q9rpwbUu<5QE5?Jyv<%9?DAFV2K`EWq)e1+6V=KCi<=_pY{; z1N-aAKW4r=!sE1%%r1Zp+!{)zKf5O)jy#Gf(h~jH=f{29$2rC>zt*HyEEu%8+KAZo z1P9!>$&VjNldL`;)aop7`id&f>Ch{mzgj*!LRoZv$CsD=q&XTtN5*mDWvU`!JGzG7p&)XJFUM;r&WMGg1^K@1 z#z>I|Q3Zisbv16fn0qQzQGmrFAD7+dlmLHqJej;eEY#Ubaq<>o^qUFh34-JYt(e;0 zXKtrzd4g2m-8`paUK3E$S)z-FVI>p&FPyZ0-}Ro&Af_NUL}PqeZbVk= zj~2fuq4Q5n0pRi>*K3C8IIAQYv-sH?+CX5qiqBs%&NP zP21ArD#JCtOfMO;#dY^{2nWPVQ%T(qH!Iuj&@?55fj3AND*aF_g>j-cHj2Upb>Z^R z%)QZ%2pPuMHjla7(cUH37#R!!*=gNGnjqEj~ju;2dqUd+ttfnLCfv) z;qx1XPcvA(6LL%XYpZ)iax)uVovlSc+_sJO@kJxxAD+%qR>>RGD*N~MAn1~=?PH>x z*Jg4L89L<(38uSrEG9>T|aT;!72~DLF&%EVt;Q$Ktv7mjZdu(r!^XApOJ zC_ba9G2!acYPHVb_S36^-u=s=a(8zA_rfuQ7)qJLaxZtD+Y-Sd(nn3_`XlcdW{s$9 zL>2h+of0Q&|5fkVa_d96(bXybd?$@4$uj!d5_Mm>Jn^)&8Q&5O47>UdzH;OU2agE| zj~S%K*v8*gvL?p8q%?MWv%l&wrUR2VK1bnLQqC!Hq=jk_kr^K! z1@oS&$w#dOw`k%u>>Ybp+0p}l)^7(G#5J)bZ7aZFQ1^}W7NzRy>+zwDmxGZ=%T5m_ z*05U1p;-xfFv4@rl1u8wa#8 zV(lKenUr~#AJ~jUYe&rR25#7RnC;|wcq(DKxCse1kdkNd5jx+khZRj@<`om9&n7qw z($R6=8FP&o_&mI|;iP$j|8v~3xVMg&Hh1gp6M_(e!fQh}#u3}ml_;xyFUXhfhoRK! zMv8Hi7F(CBvP`C|mA47IhS)r|*hg`2^rtDx?t76I*}(&^^0l4(t(Y=`niWyBKpLk- zPoBr_cao8ejIYhLq}$!=(z<%*UwkWgjhZOU<2=B#MWSYXnJb`jqq8)42_EyRix+(><$T-43g?CLkAHn)nQ!lfWE;|EL_PYwYxwAE15iy|F*amLVs=kS zF3y(*KenWK&xrpxGh|h%d3`UUXQ8ofQUiPs0xKKT2KC|di&jP-mUPs(7{%IBiPYs5vnygoD>-&w26BC>bB}9K}-Hx1m2M_vWM4 zKUc=@3T;i9N*G{3qTOw?);R`ih27|d>CNug?zEUSSs4)+WV{*RFF2_d zcNwdFkoOJIz0<~Iv_Lrl!L4|w3MBmZeZ<0$CwFGPtA4#ia#t*;3h(Mr+8N6a1ymhJ zjfps&R8&Ma$e%^81k0xdFnsT7_;qb?%ETjlM6$ZEc+%DL?tIAMv!^s&F*RarhqU zu(E)Jb^TU(5qQUc+_Vc7Sw>@FmD=q-IwNYmoGw&RW%nrq`y z7eJF?J1D%MilOFB@yTd7I)LcyD8jV}`0~8!Q28i^Qt}jh+DY_bqQ)3`evnCk4hX5; zi`T~S{`@bqCvvWa?&^tH&l$rp45w`R{`uB$X6*tuAgI;bDDY zKy0a?V%ztt&}NFgmY<2m=J}k&=pKi?MA_Eg_O1sP(t9j9y^bZp6Sd_tdJi6=hj1~^M_j{DVs(3m#hI;+9Nyo2rjR%7S;qj* zM1-Sy6He}W!9rpP!aTG0O^kLc;c!lR)%g+O{ziViB=7vIuK8mY)ohbc9z{12fuPgo zhqk-kxP9#o3RC5*#n$wtiMC@dz8467;W%!a0ZxwxP|n9`Be_t4JFR#-)c;m$L92O; zqcTUW+RUCw5K;T@k8&;o``(`$`3-}~7PIu*-GgWs*Q@+&q)^`ST4hnvjfDwa56opE zDQeS674=m8V|ynU9~&{dk3sZFDOx7Ez~e^EbZt9Le!p>^Sr|DJU9Y95&r#o%GQhnS zOvXZ`>EDbS_!|G-+Ghgr+dk@TiBQb?-8;@7IqPUX6AlXSwj~BbiuDB68Kui4U+4e<2rf>4#Kvc(ad7Y0& zNJOfOn=1^Hmgj+Rr*^hHn?t9Kn?V3Y8ni(lnF4)0u0Vifz63s}bMr4p9F%vpwvZH$>bmLGG+vd*rKwM|jn-Y`N%Zo-%AG^y zycnWdr`eZ#5Hqt)NeYaj99u8s32)0Z?mEjkAt809BJ%#)QH(0@$t9yEdK2Rb{osz^ zUZxFROa|_$TXbmL|GCC^38AOXf7IkL=3GThG`V%9T=`R+h*gfxA zhS?lfMOfg;tcPuYo>7Eh!F7GH!&((j*2{b`kl+FS`qssgT^6f7`l3-Rcj-WsWTEt3 zXNJ$4tS~lumX+me;l7czC{_6UB>w(+@b7UvWrrPO9^TxRY(g(My;1g3)U-gmyML7_ zvjeL_NO5t0n0Y^a=P>3?jA6pR#@vyx;rf&ppBIzpUyF94$1K9^SZ2|nmK~f)ovubF zeNO>Ww)}IgYYq^kaL&!_pK-^_*}T^KH_KeC9+VgGiK|wm6(>iK!Bk+qPYBJWQdI~1 zFJO#Thew9HYKbk5z+~Omf*fysZ}GwD>$eU|+s@Th)3oEaW!Ru$4CY(L?~h(TcjmKW zHVhfopevdDB`{&?3=~G|KI_ZElacVnFkRN*HFvr{loi7y2+n$SJSR8;BJhkZm}UHQcD#-fVkKo*2MXndv6SA zjPQwjMGaM81V?F)dwp8RZ;aIvPzottmD!|Zu&_AcPvwz^C&JYGZNy!M(g<|%iv#Lt zj2KCEd05?VQw}w9!N1;1cpkCKr?-+EKDCbBJ7IQFd6VZPu1ly!k@PL0X^XkTWfGGG z7Gy$+tx9ex`PbnPl(xZXXq@cA2%FQ8U^*$?LD`RtyB0p&toUYuK{%xN(SsaNf&$hX z5xD?fhOH8*#HM4&RG)g`2>$Q6T;@jwVUb6!XpFST`ZmGnxJ;d+a8q~b7H>@q?jh4E zFE{4T*SzTyp57{@=M*GN%TdT67PNdMhVnC6s`l;)-?jL95~Vog-ct5J4e4x) zd*7vv%Ge^3^;sYpua8$MDN_Ni{ur<8)Z0@4&sL`^w2q&u%9w?qfJvuqXlMEzRK>;i zuk@O)mjVGESj6pYA@uzv)Aux`^%ggc`@4}rexF{dg6p43SF3CAVuRk#84L4Cf@&9V zP%5(K{m8I!{^kaY>prms2@pi$*11Nb>+&`C58h1%cj~15c@I37kySGZqoDoP#N;A_ z;WA3|ESvlV&t?Cq`6{PCZlz@jg+azCT#ue@#=+Jw4Qu?YZSbOP4mbI_LZX{MURwUP zdF!a-SR;Mj;?BDx2R$N4%7TA@1r%75RGWn`sI7C$;)?wYl^Of6}@%F@ysaO{=LhsHUbcZ14pRO3p9QKh_5 z+EhbIp1qIDY^(6;z*xmg_e;A^{eSE>!l#4)O#8MRqN}s43U*zM^^L!4ZdTl_(wyJP z8KtsUE*i9r_eIDV16Ke|eO**F;dlOLt-U8FeD=OyPJ+k<2SqJ+#B8oAy~o&Whi1?S z-`ezk5+-_NEa&@elIP_r@Msp+i=3D2Uonj-vf+*SfZlPpmI#g4aSP>7RZ#QOA-;t`B}Y9-MQ?aZ>fy#&l;o!(h-+ztMmq*03-p?8-<$~Q1S zN?0^l@#n7T^<*4Y9xfFJ{yI#l5+D*(I{Ip9lU>Js_iIq257xpdNo4|1Tp4xVkHlmk*dGGs*|Bx@;=@f` zOKk?NFvlOJ4#f%+l8anvFhI&*FUI?dh3&Y+AR93Q?Xb?viZHP`^@?8z>DQGRC?Db zX40Zv1oe($bv>q^il`sBk@4E~v-GcX&buxHl(t18oH#)hr`1`qKp`ix@v1!OE>IX& zSWz0^cRh=nA!Xub?k}y>l_{pcxaQT`2|Tkrlbs_1eMhpp?d=CMkm~)m_X9}$@l?-; ztw+ptmWpi|0p=Zozc{P160!1N-@mhHtH}Q>6eG$R~ z9yta1hE#=RVR~6q$RI;co|eY*+KWDjdsjc*?1XAhX1sT~mjlPWTbUr3?txnT>XQ_0 zMNi(mpOYz@K3U^Zt764!+dRP%H|wJSF=8h8+I=eVgd+NWDe|PE;iMoLOcAH`5R)&~ zRt=c`o2IzGII}-ol|JDl5 zjQ7eV2*dV%TqX^W&fD=K`#2)3(3zs|lA zW=Pd{*`&wJ%=%D$Ufq5L7-*A&8qG~%eLXDbX_pNL*ik4vPDhDN^imycWpzgZTAtvg zAVn}8VKAb|7bYB3qZ1V{o_+aaeMv~-Yh^6 z=7Po_3r?MQLjslx`@Yf`hT}N6ArZG?BAm#}@W`{ussz~QG_G|%jn-yDu+Ff4Nc61I zJ0PV$RiL(O46E89-`7jW%eZ9d4Qz)f0*oi`N9io0jm=)ooZG-}xXN3K6X7_X**9Zk za=ua`(1clZcGIHmY?OKkDn4DX0b~`Qz6tnKWVfzMY|(K#-*+w^Y%UI6|I~Jh zTS#^1_c#-L2YLqrPK~RTh$5@aGhGHP@7+*+dW7Wwqx5F+Uxo?YA|Y>ODMB#dU~u3X z)B+bcJM!A)ChAQ(<>x$q7JIjhTou4F?+*5BU!@d=|Cf_SB*4o!mj*aF`X z`f6_eCJI&z_GJ!L;Q&?22S1lv`$Raeiy1kj$-nrHe)OVq?-te94C>l?G zNj}NG$>7dSqwdZ;qORU5p&_%@r8uMFWF$a`#=+^j{*#qo8fHP8Fi9JDPde<@&$dAkb;=x+WwK{^KJdwJ1X6Cx0w>ALi^pSSoy{Uv4B({@8Az zf*hC60u~>a^L^Az_o(9g^=wNOTQA~d{V7+o+0F4Tq!mdq1WQpNxE?c8U9`Uhd{9Fn z=uSA#j(Pj5D<4f_v*$A4yOkwlX?c05VgVj$%x7&~UDR7I3ayp1wYdI`DxxsN%ZDN3 ziox#{0Z->UFdZQ;A~{FyL4s2*m{cO(3KEz7g?Bj++(dmE+~SNo9wn@jvmcTf|Cqr6 zM09cxH6KQ6)4JSteD)D&TkzQY2|7rKHN;P-Avs~#f1MJDT_!f5_+$( z{tYni)(Dii`-Wwp>}lw8RHc~ZoZXb^_2e_|e4imG1y6V~(6J>V(7HQ5g;fvhD1&XHiwX#8oAIm2LcR~g>PMxb8Aqlr~sgrj6`jeZUT z32%KCit50lu%#V;cYPv0{^_Wd1Gtv#Jyvp;yAkEWu}EaG4q;HuSkTM}jTo-~LrnEE z(D#yox$uM7c7_V85E)bMyl4^_y{V~~tK`T0Wad+r-y@c=-xD!OKB>H@dIWsE(D%Q8 z;8l80!`ZC6i<&i0#wN{f>U`4MRnXE#LxDgy`t+zEU6pf9FyKA>(-*_jlJN4>X5%{H5RW(!1BwS(Q;0S92_F8j2p-ADMt=ZR^ zZ<`IM_xTij76SD-aedyeQNg#)%#`L7avu~c=c9OonZOfoQhl$XbEMHw#cBBi9(GK@ zEG@ODQsTEj0UUz-|n_0963p~uV2JY}AM~PKVT~6k6)8~5{hCjh`ij-`Kc4+Sm z`LSwsrC1+-Tj=_b=Xah3VxElINSt6WL|We#eygP3Ya(C&%V(md`ySC(FTBTx1f^Xy zr*b^ui`e|3gt99RB*==+;5P8SB(aEHg8hQJ4j}4KC{{fKx3!+PlO+K|t^cZO5#-8e zRmX_nUtl4fQXSBDxmlHNIOZNPnv(IrGj8?SI1Qby`L;2je&vyS=_c-^$*L)(yyRint7ZowWywBC;b66+P6j_Q4iKzqj!uO?%=psErvE(U?SB!-zrFeeKAd zkFG+J6h2noxj4+-vpYuziF`u2IbTQ@1X-yb;U(xt(xJFdx?g?XcjjCFbP$}Nom}Ek z)OvU{Pb}ss7AdD>3OpcaDD`>#O-o_(dA#R$q~%vuyeii|&YSaTq@cc${!UhIVtg6o zlmXPdL+8n1Z$GD6TpZxiETRw*w?%3EITvGk{P*SJqUK1rs@c}y=M%-EH!xqw z%7|;*Ndc${+4Ftkr7>*5gXV#fsRe8FpwA9;tYlj{n!Ed>ks(2K}G7(^=>ZuBH6{w z(Mm63pY{r!dz|IQ=TGLfwQoJHH^fQlBEkD?*;%ra$O4+o0#Z;I)uuA^zbr|t+|_<3 zo{RRKx(z!FPYyd%KOp>{b^1`Dl=&}ol|@$51EmoqHnjmn>W-KF+6%W#G>py(DX zaK2WwId!}FZW4CnmY{c%zj9IcpZaK-OV-xb;4~gpeLjd`R{vt5N09H~i?EpZdU~o= zZ!*Os^j#|z0gwfoLZyQ~n%MXcZhKdTda;5iMfz7rHkY$wRXIuZeQ!#=^*cDa;q00? zJz+nB@?!q-6SVk*UvRC8(i(1-QeU{(iZQwse{)@=P>PzcAJi(vi1}&7;WnbcV5h3a z)X%T?iy;tgj?VINx!Jr!M})WA9sDBqMg%)!&@apIU>W3aV3zDF#WRK^FaG@pf?z8l z#(bUGRd5FLkAxGt8bK0>FB0{I?OT^eM)mZ|{(*6&Y~6l~aWRv_E0~T=b{LZ_Dg@gnq`VTd?s`~N(t&w^(~Y<;9ME4^C8$Bhn9@|a3)g?ln&l~+Wf_^XH`n?gNL#w>A#Sw4kkkD3Ti2d`$ zkxe1=yO2`3wAvqJg?MAN9(J~sgh;NauFK|}fWYeZhWCqFbszmqa2U(w!*p3C`lc?m z6KI1z{f^CtHzZWgqKS&v_>IusX+&K##+B9K(W|ytftw<&5^~?DhV4{>j}ib0Z}CGk zVi(33%)lPGhzgKjzOANm=M81K5Pn-C@IgJ&4~O?g#8UE{lVT0Su21Y#W3%S_TbPM9 z@OlMnp98cO*`c&023miExMuhRGjH-s38;!|l0)o-9BX(?6KKO-H8SX)Xy7~f4&*mb z>NVv+_~Xdc1&d@CB}GUWCi$y(Tmf+lIShZxn++;B@=yK}#2eVi$gFCd)Jxh`o+A=8 zluzPcofSbgCKla&%oo8SaRW8O!p##kaw5=KuZnPAtVC}|?=g;#K)@FDvuxE+Sb`L< zQF*u-7|Ufk4*bnhny&btczZTW42qBiQ=)GB9ZcnRL~P^Uc8_VJxb50Qw--SnMObz)j!B$ivVzP zO@A4?4N&}3rW(J$HnPYn&$x{Omz=0k_|h!KaeRe=VT)w$UPnsiPxRfgmH&4=r8&g3 zc_8fIQtbF!=EaI2%MBk2-`Ke(=M=MKu%1KD}~$|Ir`>tERaPt6iY=^ zA~mEVu^TF2jO+(H`iI9i&L07XPgeYpkM3QF`YjdNViR_3GCn}0Cfy^t{@IOh+Os$&dU4+m!T-l3aX(^AMguDWvb3^h&PI>=Syy<1#Q>u{WustK2G?R zy3%;U3azu_RVB~}&*FnKB5#Ya1ScXnzE_{}I(Wv2HgM&IJj#d1&p)L{d$UBv0%Xe) z!}zrx_Nid_!(cFxB7UcI!)#g-QG_%M3(mj1GwyZ`@qHlS)f_`@LH|~0(KBkvy7wviZf@NMLGOsx`v2bwvRc4+doH^n8)^qqg-t={BX3;P|k>W2A ziA%3p`aE?qAvaE6lq%?DM6ddpUFMu~3Q;Xdd_g_hRWx5;ytm5vXiQm#*fjKIgjD!V zzZ}`O=)d&nYDnXf`mRx0=ItAwDOu=omulMCr2_nzO6ftqT`mW{*>BD%l<7DPV;p|` zJg6-}1uUpXLfe6B?-!waHzG?lfcA!zJ<|kV>9lgj-TZS)-R~?rL;KZY4g>TE?7xwX zo};lC3k=g);YSA~{oFf0nCA%Kfdm`M+3^+|+Y)HpL5Y1I7Ltj>(!#O%WRYR8;)x<` zvc>R{-ZTy#0v;WLf(yr3)VU*@@ThU#YTJ`K89Gnx}tMu0a2gT&cCHM@@+o@F`i)ztoQI`+U}b# zZF$)m;M7#>)Naw_nygDNEPV^yFTkYnWka6^vIrw5WMfpg;1CqLEIx$bK@m1eM1-yr zlDYDn7_#z^RHVA{uC2F>aXlHF%~1*Ck;0Qlyp|C0_3L~?d~X~Tpm)>B@xeb$!n5Qr zoc4R9KKR&?r;fGA3U+;ya)>RLW7tGyQjn)}u_X(!#PagTAq&->{=V$(O$k99zS;(q zHgDF6{g3Yv$yM{#Azm%*1*pDm)4Y^77;UjXg=CjXDyF}knvGA9pMmY83s8huNZ$$` z-#KM-E~(56XaAg^Y)9F*Q=Aa#r;Z+^yBYuHnl)dYWJ@HTQjQz3YX*Rq+BL`>>TgZ_LHdU z@!-FWIC}0>y&y9pv*APB^aj&DGU&mvY5G8%m~dB_O{0rz0rWJGtl?);1Q3Ws|5R*A z5xYZ%?a}r|R1fuXtuHNws;na*9dW72jFb4w&HL%;uO~K;wiT+KPMaW3*DLx$eAlnD zHZoTQ@~Qp`$MaRt{%$dZ?`UwsT`(p$PRz#WNGJJnB%JOx+QCiUW~Tl*F7(YU-dbA` znvnlkPAfBzHuq(%l4nU|#QgS{dnb_+6^?%I9;2Qv3gPeU_a88ymEl z@tu~Y%(#DlIV$?c`00nzDG$%=zg!0*U(#b!zX~LO#9GumX}|DZShUHNZ1IjKPhuf! z`c%>xj`lak-5?tO32y=P3ls!$#dm~#Jy<2wefIu*=Ba#Tid7dq2XJ$#7f(`a&D=@{ zUXe3VrW~{{bl+8ok7~Q@PR`03>awO496QCq+N7Yx*B_6+-mVpXVJ3}jMf5=CIj^Fj zfzoQIv@0+?Je-i07*sg$g?xo7l5D;rx31|&Ut`MhGOYifywZR85~9T6SdVvkHd0ao z5rM~cAB86_vEZJ%VZ5m~aL|b>J>*NgQ<}sy`KoRZq7jI6_Bqa;-mC>g#Ep1MAE1=o zX&p;d5#d<07Ysv`$jyy{VFm4~tN*2xpWQep57E4Bjcc*diud9|3B#o9_=|CTsbNel znk7n+rT9Cr(b>{$c8K8Ke&4MpT_EP)P89P%Gv+sqH~&Us$o(A3Vf_``<>eG;7RSFR zNvF-qpUNN98lu8=r8G%XQ;+C#^7k+BXg5qBiSQ470HEu0xf7H~P$y zXdX#b?Z<_`kYd!tH;tUlMiMldQ;{XsQ z6#JqukAg6YB#yEUO6BcVk;jYOtMUZSVwbIo{1<6;*8g#hT25)l>5{nb^1I#0Tfb`N zugv9RRB>4#Ybw}FGipC<`Sj)*PYZ7V=1~ihU!0pO>6;Lrk0bq0a!ND(@Ks7DWN$=n4awKZ~2T)tE^b%Fr0uwNx6$7sCQ}c@A{9B}Ln?c+n*h|F$_#V+JEKX$JpL>JC05s2nsm(=^hs+!l zn&;trAVklfq3iwu?Qn@9Xh*g5Ycp-Ynr1B^b?_s{|4MLu%C;?QnYnOkz=19_j#m_y zOWAF#uRENJQKQ0nt9_J04Ub&##u0HdJBh%FijXpkkcnncG5Y`%$9a=a{e>gV(D)A1 z+R5pxv5_faa_7&A_c~Xm`{?K#JZmYnG)~Wcw}b6orp+k#K54WS$6V-_P?IbZ=&g7U z7Rt`aHhIs4;>{G-$@>#L9Ijy8AVHj$*LS3}TSzFT)J(LYzM){ylxdydspQMy+ZB{d z1|$JSgg+m;U0 z`?^r<5uLX&c9Zmym`1@ppO4$u%kz=5qLY?xvLe`<-Ho9UiP{1^XjL5Swt6|kqETpv zuHT!w{J1rTAI}Y*bzshQWWt-4P{)D+FalEeiCzf#30w(L+Ci9DOpBF`RO0^jg%Xhh z0g$5kF41nkfuCRRJrGR5qm2J<>MJXnLmx6#?=d3!4a}%ggIY1Qwh-lx$^A7@T)%og zwh^$8H}X0oVs>0$99G^8wG@B195N0bybFESTxSw#BDe%lSF6f}TtLX(! z(d^SRzySJ5lOb9Gze6_C-%}{|abKanYp2=#mj3U_+435iH%Nq%bQ7-gOIT)vR39z# z^2@|3K9;t6P@XFg+F^<>q_+-~4|OGkY+exbgZhnEiSjGKG!w@OWMcp9^fgY8PIPyC zISH(>uzGA;A`wfT6y0GlV{x}HdhXrFvL&H6Tk4r<1*F4Dl)XzTYZo`^5y4O0Da;gj zZMT@EnDAG1!C&^Hd#woetnBGzAf1Epk+raY`|cYbZ&6eI z@1qDR$!aQX0xLYm73wrG@ruXWV~Qk@8jp}lp0Ib$nNB|m|9x9t`)r22{B6|ekld`! zO>MV-FobIFFvl<^JqOhb`diP3KSo9vvPvlO_qw_5Rq%!X4kt1SRcZsE@uKaSSn?SrHi`H!j$ejz)KHlPhvJ^Y zB2~`lwdmlJG=5$!)F0ivwDrKjZLv-5YEL4dU1k_E4rKwQbXhGT(RNFI)24RAHzHtP zKaGCzwUGyo!swPnApTZh-bJ#zoAG?HwpNE$Sg`3)+H$2se;V;Q1KdU0K;fz2iL`BF zL^L=t=jx(sM&#SXq7b08Cmnzw7upE_^*ed&j`gJJv8g>Sv=Akw^}CRh3u$^fbt|7K z$I#6ierigz)bHp#zwG~+#8-eddN6*(Ml8gN*OZQ}^^!IPT}9U}I~s#fqw#DA|B?P~ z`uwwivcscD)MF6EeC2ImThXfEk%MVc`;6j>i8;Za?R(*GEuxMM+Agp|Hf0}(@Q$Y5 z(J}DAhFQs)X>j!0m6bwQR8vxyZ=vU7!?WvAFM*9Q2s7l(o5J$qPm3W=>OO`cEoq*G z#l_;DIz=b3ZJ0VmT9>YeFh0wiFz)v0!7B43mC)i~@W5$frEa97c{-9X9pCnecY@ug z3PBt>pB0+L(P4mSxmJA!QNtFZe0kl!FM8#n1$Rc@^B4zR6*sPqDUN*zX=ixAdEH;4q7*5>r5K0y1=<6 zu0rdL0f_QtEf!1~dpotgab;ra8m1$ZRuk*t$HI~q(m^R`6S5mPaM)0&6;GLUZw)Pe zNY1Glo|9(<^vG!PTAIp*|Fgf2qt!zNG3}LX96}N8=Up1-svA?3ogMM^B#XHgM9!^_ zpq_iX9+S`R|0Vc7w+qhP$|9$*5Sf92ftj5>M5W^NdwRpL(a+=%Xz^3K$ILxI*@X!f z(e5Q&696eRiKpjiB~hyrxctttlf!%0;5XXoQTi0eu8n~7|9I$Je;2c#%rlx5#o;sW zx{9KGpQbnnbr`Wl3+zMh!AgR=DrMzlUQwZJV#Kgiv2u{ydg`oh9yKJU?W#LxBj@09 zp}b<(O<|j>tL8$}llZeOvQOQpYhsVOj`V#ly(jt;JeS+x7Y~fo!1p|a|BjlbL!--Z zjpTvxdz|=}^{JCnG$&%)q(gJ1!X zzU`9!DaY`tgJfA5#%78?8_ZThx~zf#DjJ%KzJ7FQ(-P*bE6;2>7TiOl&cOKKM;Vn( z*1HkW?lxvU9)6xxHH6NBxJw@aITkGPko$4G1jlV!#S^jUK;3!Ivwki&Gw2?Fu#Cm| zHzsAPvfkN{Hl<^rowaw5w8%Ld>5|CQq{TvoO!wo*OJNVTx%0I!Uk8P5>_z8;ExE$S zA9N|KaDV|8`Wf9F=it^833>F`u5`XRI==`0`v~4XAAhIBsTKUdrdHB@%YS7t)3HJ}^X2!)_ zT5GzX)aPXMje_x9%Cw7y4a?r$YTX0P0ZC>z++v|>Uk$(B2o2;sGW_XTJ|gU599VDO zykTZ#m5}hIASF9e(aCXaWfDbR866F%tICAN>?dJ>aOHrOl6Br}-73x)&3nNTr(Q~^ zk$CkYzKp&HD+J+aHfS9Zj4dH@1dLi_V|^cd{+a&)$)&LLu=!Bcld`D-R*^xvc-HS) zLIyukmIJ|`*?I!7pn)GbJYj0Zy}|7BDXo2HlCfh;mxyhTuUEoU+_!)S8fndhJ2 zK?$b&2-_krM3xh>=M)j{B z3X6(*^_Dq|r(<_-90JTud|9LVO@yecnXRf5z4LnVeHsM+ndXkgDiKT>vxMO%yi8DmTy8 zxh&%l0iMUD$6T4H3Ig4t-J-V!UO#=?Q1OBg>qNTV4^ZXp_iX!AVJenm;owZ#41TMj z78Apo$DPj6{S|sSXk=CfBz&7E?6g0YVY#qn_yxpLp zCI;G5h*q`$zSQ_rP|)2|IbNysioIbf^CwN-(6fid24lT|xM8bJ+o^)`_^cm40(*KS z^;=V;!!zrnXCVibY+-#^689d?Z)Q%G2QZ{tXqM(#JDsOBh*uOGIA%dIB5-LtX3ZgtA_YjaEfNAaruP z!sKC+d<3c*#2352IZz}?Pfx#5tnN^sLi}HvFXX_X5!rooO>g&uE8rn>Pxymp4A_MMxaFf)5M& zP1{V@Rsb(1`Jj#piX#RZeO{tLTv^rf^&TkpY3FUE`bR`4w{G?of*54#TC zZhveITL;8Jf9i?$epH`_p-&%ToZP|M)Y4$?HHs(x0aS&x>`>Ta7g|5y&fteO2& zKuLdQ8C6SYvnF~11v{*_*e`{FA>J56!1VTsh!@RxbDoGDeK@Jd%3w6WyUhl|)`Od% zrxix6Za?R8#m)r)InPqyI=Qo6nCF{S8&^SZSoZ;M)aLyo1iO#FD)o5`ffE}t>!N*T z#FchG*LLSR@)oi82!@pK*!*rh?`DNoUB~xI{;H*vW(MF#G2gMv+DroO(qC=Eq&>OY z&&*C^Uslm{sRQ}mQL`pw`mS(HSS=3ZX3uNP0{3Ak2-my8qjwC zr(vgFcMI3Iao4XbJcVy%C5B@3XIwn(QO?o@Lua;}Jas(DMWh8z#2P9_PB1|Xm?~$# zDo9sN*4c)9qkPy6fjkG+tvs1FbGbz2pC&WUnH||%{)xD2 z%X2@wEdAA?Qk>t(`xlwhqiJnR)4H6|tgsW@dVX0IKr#z`r2DdqQ463aJXQGE$X~%m zmb}eGBhN!z+}Rdx=z`qH06^E>eG96zRfkc}%tVe}4JVVThR97_44OL>_LX*C?vSew z_i6q1L$K*br0bYR`jj($vDRp-PQF5bs*z?6DmVEt_3UMh4xEiJi|oksXJ| zbU;kWbfetq7+olw%7&bAcWfpl=CiwQ8JZF0>^JXoIVCwn0$0*w=Pfn*M5Avr{M9@e z&TPzS>q>tIe*t_O4^!wrD{)r=vjqG8C!B(H6~66Dayp4|obKXR{nMhUyGQY*=e zeOI&2!#?yj#ra@KR4qqv*K+>9L@oF%>Ob-CM}-jdexT+%iQ1n>f9e=0`@(^9+siCi zk0IBGE)idW_2i4#<-CEAK9+bi#O>(iNem}mKnLl*W@fgV&-5_VMOAlwV8YoKgY%w_ zlr%_Yd9P%)k8k7==R-u23k@9ST9-zxT2n>7aU~-SyMCzl`(W_XKup>s%bT2s#5+Ix zBvZQc+gnMj?&ajO+@~SZV7X6MrU6$^KbhaGAeAXvgqEbRhk);**q|&W{hKZss~T-u z?r@3u6B*|5N6|9c_}FwIz9oguAz;U1CfE5YdTLUtUv;yCs}4=kd|{pv6jzAld;&YZ zV9)k4#-9|wgFa$m-QNeBPA0%D^gawdTdebZ_S7xIl3HAc-f%89r=<|Llu(8~9nV=M zN9}HTR3B3P@=@`$n{hN0J$+b<*f|Ro^c*kHLFga?i;Q9DKlZN-M2$m9^O|%sR;X#2IoC7?Gxo)EJ-i$3&4CzyrV7|SJvTV1uF~kMpRQZTnQmH%PsJQX)2(VoD|uGzUH88{i?5El%Fa%R zK1hwnVOQ?F7>ty$zT@+bedSj^c#t0^k`7N;!7@vSMxg zW@K097Nr{Hu4)geY?KclaZf!T%r?vKs%W{%OWFoLpC;b*nhF25oBwoMMnQaPUsCoC z)qB-0qKOOg-m(0n<2Xq11)NQv`MIKk`8ZwZt6fr{X6t9vw)2=^79TqMBw5#xg31mt zgme8t>5RR1s&z4a8=ua;tN#qut3PWJSGU+glzbTNd4O~GR;`3cqR!n~eB&oB>3il2 z<(#*lJT(PBq{f2h3I0;QeG9L#HU57nBMan9a(|mS;&`{q)&M zu(+r3O%|OZMI?JfNFh{0hd0(uEUIbA%>+7FRntYdW$IVNj5c&#a*(dt(R%LUG8P{p zq68WDJ7Gz$__xtk&h7$GF>|Jv)^&zUlsuS=a6aMO_X`inSyM)mG9K$YO?mI~w|Ok! z*OJYGfHVKhmLsteKz`*XYF;;{+@57LdTJc2tJ_M6P+ad+P2KK8@KOF+%KOjF1JYncwgK(93gD>$MMAH9hLs!PISUIxGI= z{to(H-utTMUp>*2xRuE`!P}ikK?PX*vy{-ywaklatlkrMH)EN5{I}#udA$4Y*|6>c zDm;4nIMA=%45b?TRx^*^c@>rTDh!FT#j18oqel9f)yu+`n?ZTpMSD?;3{P2Wx3_~f ztK=?aWNEBdZ)bIwu*EzJg?fs)+(wg`3BX^S96iBb5xhJ*#mr&f5e^LLDD~4&C4$Bv zlJmlnjl59uHB4_@OC*z>v;t)hX%jz!4A3aWQ%`EW(Vb=ic-Hc52NIsNiJUH;?w{(~ zuVSX)eHy6>pI9GuuOm|RhBkAML7)&)f!RX1Yr`)i|9`9Ran3}LkNi1DbgAMk@C^w=yCVqQ}aT!H#{sykta}8qS;3Nzb#Ch{Pv$EPZZnvJ#n`O>+o7LPF zWS>E!9gBfywRyxqiaM<{Q53mA)9(!iISejh&o*I1HV$6-z<- z(XjC-Ll#oLMn`7E`M#~KWX;NJAoP6{WaeK39w@mj)?`k*cfHg}&*f5EU0b;ttvL(M zE!Z#v@z8tURQ)T0>1Qb#uN(4{7WMGI_H}vq-zhY&ZKO@u4R6+37mn*r@c)+dZG1Hx z{l5m%d0d=W3Ez7pJ%U~Ly~EO1YKaV8VwsWqfmgAaYy^1=+^nT5=X=3<4BV=BroNBY znKo%hMy$^2S)x*kcp;Q52KP^u++)$+OojV; zoZdiv8J^4OEJ`uL2h|;ge0l1tZ%Sd$d1>ZY=Kk@x;u3V;zWJP3$H{hHulh)q|Ge5g z=RDAdS~u5siFQL~qxLWEFSm(EZ(b|5wzm1m=V~PPZ*D2m^FAPEA(akX2k~hclXP*3 z*e}&&L^FuiA#!E$+XA$z|9ONq&~M+%kU^rhs@DrqTkX>kEpMHe{-^kCwS9^4nt5xk zEp=6Ax1V3mp(Tp+SkVBGs7*L$ECBs5IS=lp8h1~jDA zc9m4&v&(AqFf{J~y*{U)ugA|-iUhLl0O;kL3Kjk8*z~#`-|JcU*E0xS)V7!{q39NR zti*FQ%J5Q~K3;C#(Q-ttEa<&lM`FvJwhkRNKjnbBFujCktycP4g%lP*@7V}lQ ze)kZe1R^Q>lMhOfl@-byS4H?hDq!pXbSwT>+X9ssNOc?YQbf1+etIpiF<*ooB`*1= zJ#Y~osbhMX2-aF7EuP^E&p@n7TsKi|ot4dWO2q1W@r_+B7}zRS$F`xVGOpUW%ntfn z7y3h^NgjsR>;PcyYMcHfIn(T-8h?k<4|=nQdA>f)XrggLo?ccZ)8EkT7jr7Gkez^y9U@)= z?@MptOTop6UyS%d{rpx}%NI5=tv3bJnBAkd;gL&`;?7zoMmO65GDz3Pu3z>U+Mi*a zFWw~n$d=TH_fyPZ7Jm08XWrHV{yn-=2w3cVJf}NDK_y(*8&+#R*z{%&J%u8}M_J`) zJ|(oa`?Ik_4oPg60kMb=`&o*I0(L_1%ca=_d?1D9`%*>;B*br%(<>%MKa-AniClU! zIB9bYcQJRpQAe)svJm!S#f~e?iq2usfjCs?E1?`x#cfe;QaU`O(ma}4jrou7<<*s> za}|rHnM_nVzWS(II?f6ViHVn1l#~xcbX~tK;P1g!TzHrto@T@tG#Yg)w2>oU zvQxWKKM#i!!_+@uTQ!rUB$)9zHwc})?DMz{KFi^88^rRKUQ18tiR~zzXTH*T?|Wfy z4I~qi(s0O#4s_c;dY=i&0)M;&09i+_cqdeS$rF24z03If5!KEL$E45|I_buhQ(AQ4k;^A_?k3S*98v0%?iU`EfL{(_1M=le7S!i_HKOtoqt+^ zc9@1u(FWVtr{!(<8ZuskhMPzvCVNN91#>jTd)z!TXdpb_@#Gcl665O_4z3H!udTS( z5Rm^G*}6rcw~Q|@RKzeqK9;Y&xmSki|L@1$ZQ7E}i^x%*<^$S_KIuN0;{c^}iVRUf z(0JbIIm(xlo=qM~bCo*~ld&s<10*;;wZ!u~iTmH3z8GJIXR+4{+Md3Sd7JmVSOa*7wL5Baz27!-!@~cM;3A^S?YPNWdZT)$LPlN1+5YrD==Mlb>52FU8fKhxvvG42&OwD>>HdGqFIZ^G59$pqE_1@hbP7 zSGn8yGQG%op^ReD`nzK+N7q^-Mk2EqhXLtYL~8JO$w=-B-(Wv;NT*J*<2c_Q<6Gro z3p?h2t0m?+7fO5C@}7!Ac6WQV41FbpChJpCHmhNvm%gpivyRs15+ID4NN-GCi_hX* zN0V1`#_5~U{=Lxbs>tMA*_8s~B9y)try!2iDbX_d<4r}dpRKmSx0wEOSu?$&Ii}%4 z>V9Wc1{qa1Qr(W|nosn)HvcNl^he{MetVOR;t>%t>b7OIylL3WY->&LHNevTU3yYtbntQQr>-y_Y1} zE-CywMcXd48bjDRWA?<-l5NSa{F>MQUX2ggy)7$m7!L-x9bEIV-R6Jva{8v5sqruD#n|2ipwK#g=k7t~7Lbe);AX z3qA$vy00eJ95QZ6h-?r*Fu7CN4fLlC&RL%$G2hJ#^+82!KZ}es?P0oLxPDP^3-MLa zEQM}T(VplDR;zE^;5$g#4hHKO&eM0@X{VQdXdH5TDNb=eAm#$(S! zJtZ@fE+n_kxrbu8H$av8EmycxbN1|DRdsdVk=k8Yl-QgAS>lCa&-c<+P51(Jza^~> zWFO^&BRL)S$5X$wAu-na{L0K~FJIC%NgSt|+tO=^F8U@qm9g|< zdjy@e=3VANvd?IXvGuodAc~gH?FW<8f>vog3Fzx{k|G+J$S;*@aK~R0(1XdVWq0`| zhn8d4bk=m-ex%EuK4*#V$4O`izuXn9rWGoFSr{@CDzGmSeM7W4Nb&KBu2M*PAHtc_ zd3YF*;#CNvSwd-%CEqpiwqM!KFSe5746cGW7RSLTY;5T=XgK-(EO8YVECwxesxS=CTUPw3e~(9pY^Nk+fxk|i`dkRxJwg;qMe>zuswOYv$z z<}HCG$WjP9&wkehsX0q?S{}Miy1SLXK7S6XS@YCNBmBAxZYwz`$fN+|q`m!hqmbG& zh?n+pLX#zb?sj54DOEtB>)?b=Gk?MHOT}io0GRD+n=K5JnO_Oe)V)bNd#)x>Z&6K* zCh{JqnzcE(VXPe-3R_#Sg)QN$U3Bp&Qp3KSf4V@6>}g>a;&NYzuB$Zi#<9uu$-#{y zx|cS+l-9AM!Y_4gsI_1VY(b=>wiQsVCDfK{?+8VqAwH_;s$59oH(={pat`*@@*wli zq5E9#E91UJ#&2}kW~1jyB4mjf=CuLi;q_=H?jzfeg%IcytuX{J*@*3)2 zjeZJp#@^e01MNT_S@*+c&9ii+0NPm+pZoZ~$yqDsa2oU5HyEK5+#c_4JJq>UXtdjX z7+UuD_27QK^kdw{um`RM3dEOuQ-qDrg_X7Qq4S$}CioPh%X-IL${$Q)bS&K=zo61ZMrd3$Cr}oS(B=GejvcUL6AIr0~d@di0~zA&5AowF$^F1 zO;7Bd-@KRaIB19Xeb(>pFPDOo^H_07wN_cJHTylaqDof+zmE&M9Q#q_6~_DYymz9# zY)pMC^rR&vqkRvh4*R}}ysfI>Gg8Cpsuha!?Ss?`#efH_{&OXh7!(cmkbWuEqJ8`P zd|oeH_KBLclPB%Aal*!_H9n-(F5DfCl~ft2%@V$%6Co%qpDYjfr>AYK<%wH20zB-_ z03-p?FaY77zfzBTtv9ofTy^#|E2m=iADjYBMNP#_da0TkxwkR?>478x^iSUZXa1`3 z1*?}12o8=}R+SM2i?mb+QQx_nX)_^+d+vAgLh|_O%k62jsB~2vt<0;$`AiHz*Zq=Z zrRM>Ti&<3+a3nc5qGZYwk1Z%(Mp?yqUOkk%SOQiZp~d9MKFsMEl@{)fMs2E$@=Ka> z$z5w_?>EEFFSDReOoY2lR6AZeOvkU+qkX4L#iX0Ktd(R>jz@+$^3Fd$&$0WA5b%W; z-re^GWmOzztDZc-64pFbC?Pd|4-|9`m>rjCb-5ImcgoP`I5uxRk$4g1X&fPFDn`Zo zdBawQrbaqc^UvFK*B!k-dvv{hugbxb1?_IrC{K2+HUz%VZ7zS;vlQkv5ghM3{B9@H zqli)=*q)lu;Si$@4+9Ly^>M}XnF-(*fiW9$J`1~gKeOeu;c}SctLQrM^x`y=y**czqpxeiz4W_E&i@CMBJW*3B&Ji;`z@Etx3Niw;(i~e*Epq&DXJ=$E-vW0hTvyHL5}EvQ zBC#+%LvsdQyMBa7VXu7kt@xVrROZ$5+woXAxYi{4wJ8l)Y;GJEjJ~t~Nh_ z(waq_+rHN8fzSG&fPty=&}CyPH2FzW8MVL0a`4~+;^1(;z$X4YoEhRAW5= zsN9dj6S7XE3%L>2{~pSISCYuo`i(|l(s@B2{dmGz%mQZ45JQc)W4=7m++&f~e)!1y zmz_h(RRbBqKAx+THSfruJ)+T6c{eM1a6N)r>fOYL*xH8IIh2+qp-$-m?~9I?KnDto ztnyGt?Hdu9x@z5z5$|i@Fsb+|FrQ49$hp-mGSs%qTrZ$(P;~mX$^o+&G@DBFucxhf z6!hegRm~WDmBB$*VrCVc;fqZ$w9srq>Q#I$)aO0jYLu`JO|cUBOK-Iu7@6YYG$`2G!c4nQEfk6Z$AOb>LuR4yYYN`$)Ikzr?nK7A{w%)VO`O<}A{`NUH ze24hhTof=e6&bCkKM0lsycNn(oXM&xs0K1`aXLl*@r3i4T3d^a2o{e?71oq>-B22s zoCshD0L5@YqC4%AWN-13J2e)op?Od~pc<1|$$q^v#*d9yT#!U%55BDq9h83(#c}nn z47z4o8kI7Qu(8;T?+~XXU5|2YY*S!4;<*ClYQ^&a(in`nvih13C`zsMm16^eN1s5TdPsZfl${2GWfyCPB2LGF;!rIIm0cgb%q1fIj zmW5+Tvpu-8&-TeC8OfE~NGH@{ds>%ry9hPgW$lX#RV&OKs(=<3VeFT_LLDURV$_@! zQ*mYBon3GAKNsQJ&R9W<@w}SQY&j+YhaS+3_d3^_UbO34j0e2{**VosiL)yN7yoC2 zik?BlP>_Sk$DyEwqoli6hdg$`1x5QtEFmX#!T`_4B-GUKQpfqSAtN#xYG9IdVLx&X zQK+zDhF}O{g!gZo?X8E;A9#8HlL&5|f$wL=7nR7K=zk?A<&`V64Ds-kU9#A)D7OI! z|K7-cRMjP9Y<=R8KjQk7Rw7wzL9vz@A3*=m@-+6A_|p2_lg3c0K}9a$F-Y62&%-}!yM1<5?}q+2T(1I1oG>%YXwcz-14%lQ;R z(QhT{dUK4-Loe;SgI&}rui42Q6V>ePM~z6YDur`@Dhd2 zr6!K8<)R*9bWfUH_A6M#f}4t8n_Mb-x+e}ZrfUSBUP4y&iaX!)*?`?Esb`X6zH938 zAm`n&erBLn&j*?r&5*9wFAYjt$-YSISSG@^^&zqu@7YEhBMAIBhD6FaDZOn@hPB-d zW57eo#II<{4*V}VuK7q&`#q0ugoFNyOg;a_Kow!L7qVlK;1aVj61`;FaO|a@uLX_& z=kCh;NZ-D;_tE|K8uk!Gc3_6rweAU$>mU<&MpI)e?7XcT0J*k_GP-StTy)<#wU#E{ zp1!i>x2pC}OILI&k0%hxFg)Pg!-ZU_OOW)a)SICpMkv0$_0edykw=lzhfB! z5muJ+S`vVs2^xOyJ$(CvzP7$bT)dk%&w&n5e}@r9U>;vp5bK`zpyGJJEJfX zUnWzXBBQ+*K|yez3y8L}{gdH!*psDSC4GL~jnjO$o1pXJoUBDw`2IL5X|-;Fhtamu z*YG^1p?e}d(yy+@Xd*&Lmd@RVCaibaj8c5ndc)(brSDL5&y1-5ip7sE68y&v|_ET?W*r} zjc*Nml7pGpLuyunXYZ`Gi^xIeRv$1se{i=8mTLwXg4&v_BK3&`tFgy16(y{lSgJn@ z2N8rEdA~4fq}4N+;{GQ-NcbtG_lTMqZSjc@KtX20w^oX#ollL{GjZg+>fmE*PrLDQ ziZ2S>#TDm^tz<+T9|n(EPPr%-rGZg1j6l8q3_;T#X>V-gHydjg2ws0hLMbRM%Ac4; zsVsX27Q?VnJ(WK=;NzZ8Qf{OCGHt{?hyxe|M@GU3r)7Q060O+GR{D*$SaqCad*k^? zR_a+ygxFSx0hxdbNDo9R#NG4+_c9b}&Iz?;`irW~chJp$n`~ZWBniV5C?ucfBGIaOiz>#W>FG*~dF|>seK|hw$dc;B9%&4#Fx+-%K zDir~CE>POI8N?$N@=~|CpjxRXBUx=O+Rm3Flz>dq%zv{7|Mn#zLo_xFP@>RE8tD&T z?^ zK)AEIUb302sx&dilCFf7i%b)hO`({WZ~nnb^2O5oM_!sjAl`C zZDKF6DP63lT_x&aAoJ(Kdp25ax3u4|!4Ub>P zLaz7qg2Z?PWWbMmBlDN1v#d@E#O%P=f`SlqPC2o+j8GlTs@JW%H)k4&JK`MsIMayA zkP=4xPk;ePC36}TciqZOlrvNfH{IkOQnhckV2ncTBMP%zjWUql0#}|5)SZaD#j@B4 zu&^jp9sfWaCHs`Ht_79fJeLw#_pdw-{VVEE-uMo`{l!iHEhO7V&n4o5ny#M<|46Vg zwfMyGXTvi>1|XpCcVd6=qemMuti*I4;@91s(F1ph+LBXA zK#mlk=6VMSH8Z-@qw%eq2*KIL=OTIQ-m&HW>6+j5=udEK3+0|qx4;M9nc>HSs`I5# z_x@XTF)OjtwZr?S3GeBJWSF~C2r|~~3mh>rw%#K$x>6O4zEM_bB6Wxv|M*fmuLzKI z8;u1NtYATb$&(yl*ix43ykc7tO2zRmvSo@g6C)LVqCB;Jlg2?Rw>Fk()sz4RUw@SI&l@%N~DAR^5dtM2oYg$U51?OJi)Kl=q#ejNh4CDF@2 zpaEs)eu+Yx@LL_Cc{gfcldR!0@G3b&M)U{n{y1b__u=*otDb-rP z&E@Ui)FW%#!A1K2)!qOQyfg;{@xx{PSRLLc88_pCS{mBZz==J>shVjpoHQfFz!XwfU6TYu7^F3$c|KxeGmu}TD-G66Y-wqr%LEHZK?-d8>vKC)|LSl^v zB2@eL8X}TKTU`RG{>v`yFYIQtc~`vNeO%c`KR93VE1`;Ny~^P&drz&6*7rkk zI@0kBNcTG)zM&WOy|CS+QOFA=vE4}_KdvmaTNONdD0VNZ0m4i5E*|u6xiZQ4{C+&w z@-2$5%R@I4qcnvE;)3j%THI`i!*n7ZZms`|fBqbSCyi#qmQPRDafM>e+<&)gXH!1d zqyNCgt8}>(f4aI>dbZ7omGy+E`hMWYaP^=hj{ohwU&I zO%C7MV#yekr;5rm)kx0Pl)hDE(LG~Zg6;a(1PTEvIjKou2B0)+700$vjx*+e4IuwN%}zto zi>(mGKEIWIh?3aW$eCgA7_`nGsKkIBknnrS91>a*>KeqyOUemTHoQ?->ed64$Y zA3@@rcfWdjqVz3sYC`1AA4&QGVE4bq_E7iZ0=M93iMp+{f35kP>u+90+T%+E);t0Y(KjGi0(aJgD+k zTls`&y!SHMVAb2Wgibo2sE==s`NICD5HcHKYTi`q1Mgn7L?rJ@OQb}SqzD!)BV zjevYptL!Zw5#Ze_qFnTF$bt{>bucyVOI$dNb~IdO5l;EZVDs~Mgn5ud;>*};F*e`Z z=3@3AAGbQG&sz|4Z9!y;n>RT*P$}zdceukecTv*nmm>s3L=lnB9)GAO0)@ifpM=X% zghlR|HmIO^EnCaWkoYTI>+J=GiFFwV@md*06@_9Rq<;MvsWN?Sva|3{+Rv8k(y1c$ z;Ku`;+k$YtPps_m{E!Fr9z~2(xjz|j6xw%V(i(67fqHfVB}3?&bL?%(uQ{{|hx)GO zZH5~eZ(_X@uCZg*uBL*TgkP>yklOEPrB7v|{{jEaDu7{xZvi}I8bkEzpPnZ{9-u|3 zP(@$cIvLHzqXoECHM?w_j0SoJGU^@I8P|I+xb z*y4Nc@Vo?6sKEaf(J(wNh0Vm?nYMSG$85L@R2oEq@mw{ErO1=5eer)K;;7f9sTaB^BNo* zMOJVdM`^$!-TbeuflRo2b0s4ZUa_PAKaR5Qy=3mm{lnYukM_IdTw@k`QPOJOCVRYO z;-YB47BK{aTIX*zjsV~X+d2<(HhZtNcrYg>WgYdwJSB>3BNf?f>uVP1hd`dA?fCF& zWM8P)?KV%`yk@atMqzK&l5WezlQX~PR`3h5{M|f}naL7jJwM6`~lcsNRPW7JV3VWtRP&|R_bBAK`A@VX-r zg!`Dk8b`oD87%wDG_u;wvYdbh?7X6T0iSQ?-uJK8+bSO5SJB zqGAsrWe1KnU2DDLm6Ml7_A=o2G3Eg7oOaZfXgO-4K+Jduir+KEZG+CsS&fd($v;C( zE}mg|q1CzhwO|BL&fEL&mx>v#s)xpN15drN?*6WX#mu=m`u(S|F#qL0U5M2O|KYKP zxVVM(LJ+*0u56X-w%0Shgr^qE>bH1&nq4V{))rU836SxGvYBa3u%g3J3<$T1EWn_X|H*Q~jqS z^dJ5LzY|Iw=i>&R>z?S1n%G*%j#Oy8)MD53vts6arjqF3>z=4j7N`;|8s3`VE^?-D%9?UxU_}(!Myj+^Yjjl8kP07 z$+#Pe#xU(TzxGOM^LruI|KnBX?n}fVcRFC&`R5am$m@-;Cd42|O3>5j>s_#ye4uA0 zk@%lE)bLs`$@B@;i1og4@yeV)FM?kCWOq&f?;z%x)g6i!4ZaTtXV3ep!PcvRDHY{( z{=6bd;>pHINvUrPT#>)PjS1n!|KFuyNEn#qm`mH`Hi^t7`>&JjruifhZ zjg3lnrtQqHy`H?YmT?me)AoQWs_`lg0NRGL(B*ZU*oM!xPP&jU?Mv@0*;SM&=%syj zz|r?i1I>9XtiplALq2NVI_b~pA4|vxK$x7yG4MYWmDR5BY!V{n$bJPB-tP9@aqC9? zi;4XZ><6L^BIo@9GvT2-u;JXWXf@UAVmJW%&%=73^4bnBhEugQ$G&GeGA%AcHQ8F= zdTHYP2+4ZoWyv###pwFJoBy!Sfg{^!do2JPA=WQ+vu{${?#Jcn_5OGl@;0_l<~i~@ z^ujj!17@F(z$qI{4nPW6|Gq$T|z~HA*@tr()1=XD?SM3rB2x%XUc!#(xbM1BzfeH zd$5Tf8NYPsCdIh^UyZ#5Sd?4WKa3zC-CY7IAt{|BQYuOb(k$lckd#$zi#r)OgM#{SbSj~{- z-EF-NA!GWKJ-X__F}kR*&+*CyGTr;xOi1Kp-*Z7-7Eq(5qM@a^0*Pn>2*C#Sb*&`S z>YN0d2$1;Ta$zJIby^?}UR>_w@W{2rj%S-0`KVoQ#$Me-;VD(XdQ;FX#%4@qS8Hn9 zXL&A1TGmxYB@(<%ENc8#=s}UU)0ZiUrMYuv#^D!o z>NbwiIno3O{DR7F-Y zbdBbBzKSX4T9NE2F};&lggkm(o)PA}y$W?tC|Hl~@vT}aMhK7O&JQ4t4#sl@KRzhD z>pG3^=dS8Ivd3bFn9_bjLuL%I>3-V_l8bmXc^!)**1t|0-T%{Fw0hu~fm*w-B7Qy} z%sBc?d%_w@7&>LGX*8RVQEz_aWVGlkSZ^nRTaDVly}SwIX}qo#eh_aaRI4 zj$#$q*U}6jda2$)*(#+pfr|FEk6bORr|p`7ff(R}fwY^Po$)%AqUbQIXV&tK-t>Bj z89Sk2I#`^*J+l6=17z7N{Kid5tJjD}H#cDJlYUXcb>TIl4v2DMSJJ}Ay^tUecL?B- zB4eVOsV-`aZdnclwErquY_WsL$#KQe^~-^i=^yo=Z81!`A?`&sW8F9^Uw65bg%Rc{ zNVE$jTj@h4xsB8jwH3+8!c_r2cXJ$cP*%UFc7%WLZjQ`kAz^zd2B-{9EcRp!Vg_U`W;~)aMdqj<#ElttHJHbC6$-L zB}SHQFkGH&$0XZMzl!ebN+=7A%3K$+sq?i8rgzMGEeXp=cU))5BlF>}PY8B(;P$^V z_uIp$?au5S?tl7t+=1ARlj+L@*-fr5eB7?|ZQu05v8z9s7C`6% zKFvx84N7JHWXk!fBXaLVx>TgUrLrRvj%gA5O!i`0M|35A>L%>)@uY=s((TZ|J@3Qp zDMeovnv{Z3zT@?c?*QI|?UV#QVH{BlM3P@vSboj}9548e&W*FXlI+<)Bw!}P@%N&$ zYqb!w?+RQMyPV>LHwSxHoS$vMFP|rgt^Itmwm%rA2y>$_8%w0wf_K{3`7o2s2u!wb zM8cR{IfPaA!=8=AcI0mFEIBFmT-oPzc;AWY`DmIXd9_-77nx|XC2cAknY4qRj4|z* zOCGQ;ei}P9%G)>uK)>1XxcgsMw9qp3sXG9}3{Y+c?A@Txlyb!?QW?*$tJW`$+Zxx< zTspVRkvA}iA%!t}OGRJIz%7;gFSe>2hjEaZ2-&)f-nQ9Wy|7b$F;*GG>NL(sYb4Hm zua&FvS!_U%NDoZz&vK8UHg?9qt<4Rp?;^X>ey^4u=PoHpCM8Eq38yd=lyhAIycbkWb8_lUE1sY52ov2p^4#oT{&+ig%20|DN8)ZjWwI80B#$w32ZGDjn--0 zru%wRHR)~}F~6zU;JTix*Bs}&nT=m(bQvi|3L-+8*V|A?!9TZm;08CTeLmkc9yyVJ z3KE3_`?12e@#Ox7*5^M?2Qk1h4u6(9=?qqK?3l)1M}$+c*O9>JdeqQ=PXsL3tC@nb ztC&u!c%gfq63$RRvT~zl(lIdJ=K7xplD1&i*08x$oz!8dOWvdJB^QO*H!l^b0Jm{- zo-;S@zSai?5S&=5ER93cQ`eey77Y`xwP6jsiJx9Vm?D1b+(C)P3}9$#v=1bx-#U=V zbhPPi6ku~Y)IMQ)4ZH|0O+2Yqk&yeH#fygfpLbyw72?O<3O%jq~H zWS({7@pxy$MHD?1uOppD2mD;pUbe`)2Wul8POI#t>W;6=+>+yLIHBcP3Gu11 zBqQaI(_}YRA~5gUF7y-x{YWt7yUQ)c5X6`rBReSpa{SG@R}A6;0D#45YRx@DOiv|o zfzN^s&!z|yqmfP1BAZKv**MgQQNn44ZwrOK2`O4=af4t2I=c*`p10i#UOsBsKFSsA zcRkkV-;VX)la9qL(sdC$|4P|^Mo0mS!N#A5sw;nvUQOKPYopBxUl_4_EA{ho z{x{=)7CCRs!u+)0U`MV1@a#V%E(8&7SYe-77rqY_N{Y z%Q5*#TE^|$NaPnm73MBm!c4NAwhCQnVmz{&r=QQA4_23-HYi5D-jU(TPK{8c+zXm@c;`Lg_Qt&Rtz?9?9&?>^ zN=PXibr5jNazFKX9?Ty=8_HO) zncGe)0qcFJ2DltL;nU&zb-qa`WV)p%R{8TqC8IQM3U|*;*WQFyYEtUEw8lab%PGJr z!<>l3&GANnvMCb6(AzfU5VORWVp2m17oxb*yMJAZ$mv6bkan+ropxlPyD*tFOceKE z$_z2lmGq4Q^{gcYoLPAeWZI7SQYRG;ecL%PuPYovz`qV3{tu=S(FDd^8>ZhRS zwta#xOr^IbWDpzl5PGG}N{ZDMgt3vl4>x`e^lMRsxA`Jtm_H|0*2zgYDnV>F5gHPX z-M-fIn`HJ(FQaSf)v9U7)L%i@npXN;cXFVydvw>1E2{?;;R6UwjW%6jS(IdTc2?dN zAn~-l_21qLDBIn3;v6_AdEas8ThwelEXN~C<~dLM*YrjzBm4;R6r3&_xm z4O72ZLKuvK;!d|rC4ZKo;upq_l7h*~Mk{)~9L4=^XYI0Gsr!XSXQwX{;;(jFg7}Oi zDt!0h4O&vKx_w870cbU_&v2{b5ylP=G*qf`cLz)_+PPtx2_?K?mE@XDkXn?#?K6|q zM=0ktcH_KA;f7({fnBDZ7TmBefeZh@-1Z%pSv@Jd>+AHX?&;E4$1~~^sDtS41Nw9U z+)&@IV)uioVubQXY6jHae6Wo(MZz$g`m$l@r8x^^{y9bwCnKi{u*8QZ)nPeZuil5v z*@rDv4xGqOUrj!~cj8Ot%gyb}OPv*&z_h_}WG;FD<#VHha>VwXau~$)zIw&Ko56Z8 ztyBqbmD&37Y?%Dquw}9}RX`A@YjGAgV;+4V52Ny@S*BDp#ixm}(Pmr9Y=fk!>PZuY znKlFVnysuqL{Fgn?;%^qh5l)fL=~^ds5NIuZ3Ewn88y@bReZBOxy#R}cROq*crJ#{ z>9CuhzT)#^^Ttgg2}8XIvR)hW>$3#F2*2R~q7zrxD{Sdd-qVa_Zru_oN;9P34(;`M*%P=l<*Ma8@G!apMHvOlhTq zAEW=+gXJ%N4<*m>pvJn6ElpL_*}|62o4g&-0sT+k_iB@pjoNMr`nA=3JfZDf7=c3K z8Ml((JSJK%#q;=JZL3td+4ZdNc?0${>$KG4l@~9z%Ck9ETJOvb>v+95myS3Daq~gA zAwu&I$fHx>hvkDGT6~R;xX}ivEb0g5Hbzdzq&h-iVZr~^=06syvF>S5RFx6Bt+PyO zb;0?!A*4bS0)75`V2Em|R)?j5`vGKRHg;D}c-7BLDwdM)o z*-?XrR*g)jEPkV65D$N8`+7C1F=x5!bRp*ET(g1iSy{klEW>f1A6(&&c*NI^(tsxl z$722B(!aUNc6L(xcUkDd9f{YO zWW$dPBK>`|_jJ1KcX8)tfB1LU@S}(z8qrJww_IX>7+SbxmHLA+4&>FEo@< z6mTVmY5ld%Ur%@uLwzHf0d0q_9@_ax&-UMkg1`(Zh4>z?a0bDO9GP=ejR1aG(72tZ z*}>Q)8snU1RNJib=wkGx{`%%az@~c5Z2*b^Gte@GW|{^bh+0r$bmF=~dqQ0sT&i@~ zJ6vSo-zqlgeyv~i`TuAQqf}Db0#yORPhS#WL^sQ+QjwD*r^@_93Yn|MN#QlPj{MzRNu6ClYi;s#10NLU4`0-~ z@Md^dT;1X^YGVH@!_Tf9O@@C?G`KCJD^F^U4fXrKhu=TtUNI~eg=nnqtGf#9PXOA% zQA3AE$vF~cIU_f4?=x*|l=qgWzO zC*d3Ruk!XHS<5G#!!z= z&wf=kL}eD^%-&WVy0QV{=Z2wBviyT#Cb;`Vp56g+M&hV~y}S&8WFsZ{Gn z(g{`=(&5T^72~mgw#t|qm-|#L(1OY~45y-;`%Mi~b!@Z6xYoD4t1WSbtLPTVsmg%Y z%*yFuIuer36L~DUG4@i~*Fy{(;$~Pz4@#%`qsRxQYFHq1%(|FYt#u-zza=`Iy(~6L z4gE!#@qM$)$&w(ss6SVuFu%oz;L-a1hVL~@;1c!B`m;0V(;+t1&)<5hWF!QAQIct; z5=W8;E~w!-IAq1SnG2GS;=U;p!~D`rhMhbV$Yo0VUZ5r(0Av-H($5l9ga#yUl}{aD@$$F6&oX`*Y0U6iwPbh2#RhA!{hw0ue=QxCc` zIu_;J@u{o-y%(3b*`2}9-106nYTB2KUU0opTaUvke+Ie)8m*8ovie-TI!PdkcYy}G z2QI6bR9eg&4w&T<7(4VF8u`X>0t1dwNEB`A|j5{ z=s`WfRf~frVzy4D?37^NkjzsGme0q0gI!3?#VmV2|M{|=+}LorXG7d)4Rr<1_en#1 zqE>LHM{CV_-c!+scChKd7dOD58eZ9hEClCQ?ZR5z9VJM?S1if`mPe!^dKI19M=$id zh|ka2F5dE_A)eg;Xo1|Tl(^UPqNq}X=2nP4pUolrpz7=Vg|$utJ*ng#3saSSVt~g- zN2=;|u+`T_V<}C-lg_b9Uu>s3780cqd{et=9Nz(t(qR<^Nh+oLK)eLUDyRd`Bu&zQ zK$Q_$xR7`y6J{ip|4FgBxrq_eB31Xo+x0{1@b~>Bg6{{uo4P7lnYqfc%GL0uv%M?8 zv0Yg?SfKdQ5Vt-;H&=m`_3jdzDEC1AN}qsNqllHKj5H(G@ZE&K9(|s&Yvrl@a5`^1 zRXuUaE~sqZV8?ne#d6sg)UdGH&EV1DzRUXNJ`dP?Is45n*jv76-&fA~G{I_k#!Y z4s4f*=7gd<(M+}33XLpuy;$^qs5MJEL^>c#YSjn``^o%{c%mc^1lmR_( z#&K=uLHW9O%udJ*)lg#lSlH@OegX_Cn z9D#oxi6EQ@TJzWfSd!{rKlJD`^R**v?teQFIKu=L4PeqDYU7OU?fe;V25fZVL< zUi*BvAQ;OzfK=!>IMf(6(-xJD@=I@EI4I~?@Q1D{2Vl)!K5cRdCDgUzJ4&biOnp}_IItbPDp4`cgXMmrsRGG7YWJRYQQtAnk8<}-45Fm@rat$UF&rguX1t?zxa?G^ zTXx(odluR1VmO_yR5dcol@bz&_N3Cj1n&hGM(2$-!s z&1@z$a;KeX%D;F%p*P-JUZm1BsFT(=w9@BGSL<)_bV~Y8#>n86rF~%R-8`!gKNWEZ zR;WpZ+(NL@{2#%uryIZZ;MGXx%qgMH9qT9j@Jt*(<=XU%V9*R(4Kj658vD10dVVB- z3GVefmvQb@$ zgU3vtSkAhCHEfKwQ~`nKNqEy5osBmT+hc4ElP(bxQ56{t$yq)Ub#q^h6QMNOh=WWU zv0DiwV?E}Nr0`T45c5`EJ+O>jc#;rGw`CSLEBG;Wt$%~ICnMF)&XThjbXUX(&rcQ* zlH-tqN8oO$lcn9-Q&s>rmG5F8E79YcE(T&9734s-0DwckqnyoS*T_pjzy&7V@gfvH z2%9yni@aXZmd#+>Uqr60r_-F@B=?jso$iAuR=Y<$^;6%to*hIvHZHqXe4i_JF zndqW*dv6Mss^3iS!gjVPv7OP(RkgnbeD|v^ipsW7_CXkm)7&ZV!64mZ50Bi|6V4kV zikBC$)L~%snwh{1T2^JxEvMXCV5Cf?zd77iScmUTZMA>Vlvf{w4250yTD!TBfUHuu zu{%y}sIo(8m(9A-K3_W5EBsE=x&!!5lGg*nUWjM?V*8llV*EAchQv2(3UP%aEDkao zLz3fJ@~5Uze`)?H^Pxy204Zyc(-y;qf8%BX?;65|ve}MlRT}*0;?nN^(PnDX)`NQO zkFTGGZ6%L~+x~n?9BjCXLsWx&V}pvRoOGirGmiO)j>Bkf%T(6%53?i6Sx{lzF)b15 z=~)*a>vG-f0c6|k^7t~0FX(RgKFGH-NA0Tg=in=P)JRC7Y^0(^&Y(1r%)v<2yj>?R z0MP3h$FvL;LE;MB2{g7$%u@4s&G2gBfb2H32^q9k!?yT-h6u05QHZ45D7LPdOeNbd zs3;E9Q*Q*g^Xj_C@pfXxOj_1YPzuUi(65R6)2V1b79GO+YS0*+6L4{B@p301RhGDW zWCUnznVdDxaoHSk9eko3$coB4sV;6R+Jmt;WCw_8j(~42)cz=ukJXe`0~H)BK&URB ztmf^qN0JvdteNjlfiYgbqG6`V*`INA8Jmx@s|oED9>Iah2_DueCYnARv5yRv9bxi5 zi={I_rxB)ZcSefQ&(o8u7Q29Mz)+alM|PRSs9GbUPX+2}QDhGm9ZxtK;1*W_)T}>f zubK*vR5zACdTYVSh`eIzddw8o$w|iIGeMLhFEby=6UNd>wJ* zCo>z+5XgT;*Ri!Rf!3Vyu1?W+z{Q+ZIW(U>^dho!XI?{)%5Kf-g;e-p8XT6x<%E|7CD z3xe~hXhynH@&Y!p&qX;k&PBzo5{G58Ly1ae#79*>akVeZUIv7;G07NiH_~K1Jn!k$W84O$dCO zDM}UtiWn=JsjC%QJ6?Q4xM53T;gixwl)vUCL<5xK@`erAqqD-uT0gx#he*9WuWFoL zoQaENh>A}nkMb(S|2D0o4J{;&5-GH4f!9A7RF{`Y(}*?D`sx%xP@M$33uGtSPJN(V z?$Gr^^#$As#@C+0^iSTrHFPIfAoD=bOcKBaWZ)-`dytl4*CYuMwI!J7uL#_+N`q%Y^2?;nJkzc zIyvXI(#wfG{-rw($_Oka&{~H227C!h6K%C!vHdJWf1;iLqN~mUTVxpjI_Dr6rEQa@ ze;6qbHIzZNJ-PRRG1Oa|(@_oI!N3vt&}T^2Z*~fb^Juli$^9t{wpuntLIV4o4~24$ z9%oVRr>t8q_a?2`pvbYb$`+iTbnQbn-RAA4-HsETIo6Qp+h{oUIqEf=nb zSkBX>Ps3j^dpc0kQ%V6x9BAcWnfUj5dOL*Hh)0-fREUvU*UJwQLIA3%$do4db{Y45 z+U(A;PSb&ABke%!Tu=PaZL@iskA-F6m#b0UBz?0#(4!`9AAwKfX-OjTcePB`e_o6Y z#OIbgIl3z{Irk3ZoS*%tH-^U-MuX-NB^YsY>r`zKMMa#l85tE-a0eG*j%iX7%n-a zfw2!7gpFNU53|H;IZ-*aVLC8Kj93w!_3KU`?Tm zudo%%{n#&p!WQ>MKPe8AR}>}Y-j1^TvbP2L`C7` z!LRSyS+NaYpWBK5M33qf8m4tGRv+rfrn(SnzDcwo@4cf|@H-}}3BDX9l2pXY{?7QE zNyTn&MolFQKa-sF!97}cb;>m=RpS(4<0{&aZ9O2jGh`Tkeb2N%?N;>jHD<#U@Hb8F z_WRDUKYV!(N=AlmHwEn=(~lOUr5)n6fXWNhkXiQ&_ysX*N?v~HZI38M^ZQ3$_CXlp zlf2nvu-^{i4Ga~9&1r`*fq+;=;Il`FURBzxXq5^ZelOEo>W7|7v1(gmS)J-Lf^zZ$ z#H>_L^`o)M_*A6njOvJRonu{g@yF+IzcOSQ-BmFR7eMIe)KNy62~>XJ{%+~G7)h^* z`O6*4DlUnoc7+}5g@LGH`dj%-8T#riepMvR>y3NN*?I!6d#<2VrV*3oRn=w#YNua5 zHHv;OOqt{v27HygXI4#51s?1f&fs;kmr0HuBHMo7XU}55g3|NHKlSWM>GR;skMUFa=Ak;zptOPFG-tPEF?Dq~h4cRg1}9V&Tr^Jv?h;+GX8BA_fE z@rf0&_w}*!TXfo2Uh6YD&QjEba6ur|hyJDt$Fu+5wDOvsgzwyIWMVNqX{6DrxALd- zB!r#(l-p@V&E5wlNR!Dz)QVz03UWF5MgeQRSdFpFsW3r>Jq8}3MeMg_B$3O$8&qkI znbD{<_v%Ab%-M*i3jZ77wrFFRh#^CJJdA$frN$}~chh4gfo=Znv&)P2v!hgI$avgr zoo7IQM&}sfov4zjrCINgOxp;oGuPEWcEL&4_&w97 zLwGs`Te>XSI#G2D_f_TP9#dw8%g^c=Z=5KZO%UZa=4B%bS5BvcQf>JG*D2zQYjr8s zzHZwc+gm3vZ%x~AUFd1kzrV5Dh#5BH|YFNf|X`5g%f=etG`oeWb;ZhFh# z7dql+uP#RV>DJ&yi>8YUQZ1tZzXP;vDR04L?FER)cumc~@Bw+q-EgKhWb8S(-wM_b z$@uEuFzI*8u5Ij%7fsAT3gV%7c^UY`o#UzQYrLR@9Ratcr&Z`RCAOm#n?Elc<{Y-) zo`5C2DGBEogIzQ0R$(c9mcUz+w^!&nBjuOtY%6Kq8(LYZ1dcrOQow?++yEV{oSP{5%iqP9eoQ&tB7>hLkPfX?G)FpxJc0aH_{bcGn zKjRQ1IeVnjLf?kAar2cJ<$Xmc)7MPovd^FjJLN^G)9I9{nKerigrc^OdadkB7})w< z>$>bB9i#AFFHOue4SM=un|u3sXm?(Me<4W7I5H zR3vz9-t)Les;de!CvVKcAF;Vc&~;^U+Au#iQl!3myT+(@m`9@P6?x#@X<#JyGT+)I z9TnS`rSPmYJ2IK{*?C1Q8NuBBW<6X5s?Bhni(UD??}^6}fFo27kg6OB@GG6Imz|Op z=poK49tXVb@7%d|;ZQ?mbPLY)r>RH6g!A98N;gni_`bDfB*R}~Kt5QL zNf5rkd}M@5a;1wfiT2|z_Zl_>XDlsKvX(#N$Ph0|1$1Ao7}=sG0TBMp0;!-RknM+X z6wbMOMUTa6rZmh|Dh0&$D7SBeaa5arb5drN8hKPK|EkM-0n)tNa}av>&UJodZt01O zRA#-i(qB-KW|Ucqa+U$J6O@t{Q?jDbLARlsxndFbt7xXZWqWI}b1N!(N|S`FMxT$= z;2*E5n@KUwfuhuM1fpLO$`C_lz4jIv%zkH{5;1qf6_Ejbmn&}sQOoL(IDvS%L5B#@ z6;87=-<=La01nNle&_e7$uf%6#QdJQLAN)99KDv7j$NEmaX^aPEMLY7eVfkJUL!L* zQF;P^3~@mhk0b&{qMOcpcs&HteE-TPL%ISj78Ka}^ZAFmjOVS> z{5+sfGABf9_Rm*IiL?ynf>H$co;(9$( zKs-LNrNFS&bw9@DCB)>+Vw7Q~H6#i#I%9@}@8A`lK%UJsH7BEY17UhbjXKGc<;jla zm-nge4qIf7ihg0N8NOw;FBM}b=?VeS6Ijr|O@Zq@p61Byxa`JHU9HGq;G=daWI8bW zv771fihfVqwBsB{J!M78W}GKmHux4=`$Ak?K2-tTCO-^(wVMIt9`Rs$afy$Ha=1Su z3^S*uso-A*l-B!)5!JPA7ldeNUWW$($15$@luGBg;_COowtS1X(9q)Q>+`9usRa1_ zTAtS%F!!`ITd_n#t8A_n+XD}sqp)NG)zm;`{SYWB(=%2Iyu)TFNe@mZ^vsJIrJ??) zR)=y$-kvE}YPc!D5J=(pMew>cTshj19DZ)bgoef$?q8Kdf`(>l1i?Uii{fnz`{tuc zu8Iilanm$Yq<R*MTs5ow_!*Acp!b#p2PGPe$H?G z_raeXRAo?LXy>E&y88;^s0bmt;W0OM`hO>L-A>l?S2CN}{|7@iIH2SK-bG2*M+H|5 z%D!nEC;Ok69AW%db^zcn5B|iY1Vxrfi5%7SV-%w8KluLNxQ^id6IZk-v+ zM{M87fXKdP!VKaG4oLsYghZeE9zag9t@(|K_uuJmOzX^E<`Av9Nak@8%Kz_V1J*W1@tTxW?+uwN1SG zO9z1e-{3F>0e|0|{1aBvzr*_UZ-#uW>-rmA8%O@5`?Z5w{C6DJ*nTsMkgHmx{QCs zf?NNe2E9lDH$~##d_@i@0XZuSTe(yi9gvGWoM>nesQ~R*)cPp`zTz?kn(ca=!*(8; zFaOe7H*&nv$=;JLZYxGZJAjM^)%%}+(uZGs*&5nXu0q=O252J!s`M|`;?@TMMm%Ly zyx;nFrpzjU7yW`S$FBcI1dSwthHVXg9O42#0!^zVI8q2ELhJeMTg?8q%^X8^ z;MrNhVKWiRN5AD9{V7XS zS)9E<=5#I+1b`94!&|!pAYA)GR^{`I$bfo8%h%H!Wz&|7l-{7}iEZhJXsVt}E<~ho zfpEn74jyVC-rfR38kjh!&+%$#xKUA2GaC+cFI&_F)!M}s?HremjZHA(qd#jf9=%It zttqF6$!YwM0*w0{lL8#YjvEXIqcNxS>sve$=zn4He(=Rc0BDi7k?pNUX|1lFe7uBq z%ds!4nQc(l<>_Hhe|}yI&~I{KAKo$|FtbRtac*Hbayc7wws6`OH8YZAVyJ_D1bdSP z5{WopOJ(gJDtbCxi$419u^aQncPoXLTE1AJ7Tj@d&jhI7F!a;hYKm@=s&wK%+`l;J zaG-~5Q{(5eDvFEj*(ot^owo0O?b>u^UOIKz6h3R^ar^q9KOIOz$ndna;K5Bd{ zsd4{snbDx~wi!zcz?w&{49_Z4j@Ky>_Gj;d4ookL2~Le)7*=~?u|0buxx3Q0?1?-f zQV|NV4_qXjNHyP`J{uMSvt=^MQRNfWT99w03!WX1sX+Tj3(k(G`RS1m0Y8tG+sc`e z5s5|0%j4T)l0_q#%VNHJ^eEQTQLL-F@*lEwE|d#%zEF^YycRG`xZ8P)SCR+&=j@}c z-R;ihdLq)ZqgdGMLp(Ic3tw@)XM3RA`=C>val}@?F-ihl_6y>md~5@Qnvp?i@6eLh z_u6}b2)tPOy~0m7KMGxM0(PJfZj_eGswXpjb;kti;8tIoclw>gEwb+MW~^EB=cqOP zSALiEap632Og=;GRzFHa3jmcfY!8qxm^O#ASjAY?3P>ukC%lkx`?*D|vLU0nvYwU_ zj%$g~J3h@4&Xx7>NcyE0KtcN8&+>75Fu{J%2D2{7&~yzPA1f#UpyAI>^aIN07DHgA z(u;KW{XQWAAA}@smRNCca`ueBC*_(gZ`bWrwBneJ1PwfY7f)p=w(65E@cGU;)O|JJ zY^v;@*c9ow1+dtiPUu9`<5Kh;H6pVg;C~_LxHpn5g-VNEH%C?_uYU#gDPe!>Las2} zV3&ha_jssf29#O%B2okv{DSjcd8{xasjHa1lSJ7)WO`VdKUPpjUyk1eF*o!nnz`d{ zFnGL^Y4%5zEeM;x2JmR`Y8k^|JYE9c4dGoVdE$3s>PL=qi z*KYCF$5)~koxIM)MP^G)*8G&w8KEL}WsQx7vkx20=JeUe41zW(7lR`CkhJHW+cM^` z&pYmx`Il;6%2)T-JRj(Pe=Qki@a6fz#){f>jn4zg81u8Gc}D%SOIN>z-bG%+dtw+y zo*nFSlI6r?QMml;mQe@k<3WZcIS(;?w8=zA2-q7bWD2A5|TNyIe59@UE@^sEMk>{Vk`U1%r5KD=xleaVr6Q? zq1#rVmql~~%dgghn>cDYYr++~JcHEP0_jm&^U2k9elo?orsAnPe!9|&%_~(pnoWYj znWAzweGsuvKNkCais|N!%}Pj42+}80k~hwd1K_ufs74~Wd4lmo_^#AZ)Pu* zk>5LB&?PDDhd}ijK~sVXlZ9YX$ys7>M@K;UYl`f27YRd$XM`=Wx~KSoF1P5@V9T=@ zxHXH}v9IzR9puDm*c7tqBR+4w3}~&Ud>|_@$SwX<4!!Rli|Fp_d!{7W8wvyvN;70F znTOzkV=2D_y-fGLAnl*gR`0vRGN?%%=<*|&H#baRG^lAHGa6QGJy}xeyXnDhbAK^4 zE(|fPSC_G`vYgA5_m+q!i~xSRn^(#pugwh{$}^O{J*4hb2Erg?WS9Nw8lUs9V?8z}#$O{{ zZ7W-SxiRgOV4qPn6;byl3D=+iYxylvgcbE?FY-}UG{Y2(m$X8GhE$*j40z5y4^19z zEuA(H<6M|Hj3$E0kBuZOg3?nFkAs;kFJt1T*q5Uc&iKe&JMWf-2$0gaI9yrebf6sG z`7!g88ikN=hpl(cTU9yMRiDaV`f;tT?r$|S2s5V4;}#7CmSqTcZdQ*@#7X2;lm)R_ zh1AvE>hNll>cy&6P2LeZZy&t6!w+xGqOrln!-KAwfjZJkTyhOVKF!E$bA2=RHXurV z*zBFXHk_mCX4W;Ab8Bbn)*~8pUhZEY2mQC$VyhQT9N8H=e68VWnKLQinpGZ0ifkm9 z`~@dZC-)eYagg}iY^6qUrt?YR*-=RSFt};r$f@_EGc~}SxsH})#yv?j-T#+QU`o#_ zBtcWu{fs6PvHCoF3_H6M+Q;H&mlbN3XS6if!REZzx9=?-35YzT+FKiHd(J`k-opOp zI(ypJ+v#g)>E_YwdLC?%jZntmnQATyG#U*jB2*sC6-*Y^E9VeX%7!~xD*&bJ*(BsTdrM0V0obl#8j+qZaGQE z8j->fH104KF)DLSs zYRxGWZurnHQ1@Pt6nXx>%pfEVzh-ePJAdPoTESAK1ateX zGYQ5-kAv01+W7|0bskZ>*H^N|GC4)arcoQor`Z4|z3>RIyd+tV%W5E;Im!k4nyrND zWv>~9hg%(6f~s@`jX-t~$3%*rp9su{Z02axtkO7zhQVH~p>82cZ*Ts#W9Y?2@sPBA zYl#q8bOuhYOur_2OfHQ(*g1Q+-=*WjI{w8m7%@S2pnUG>Jnjlmc9-l}tw;+g){OQE zaeF)zJ_9VfpPpem1&E^wIbvptw9w}=)9RuOhYIPs+aA>PN99EtwDE-S>=O<{5~Uis zJZ74*Q|}PP<;1%8u>0s@9LylLSdQFOGZ1cEa+r<26^=jhmDPO3F6S?;+Pf-Pv}O{kZ<=WAiaRUE86ddHD3HAcSGX)-FW)+b@52d9X(R-HSLU?(cK>=s()E0YACIB0X=>E>IW(2$v)c7z@#z)2S;2 z#R8)(XE)Rv>^GRlVO<53Pt2i*tErl?y0w@QO8(DPF>7anG`PaU)v!L#y|qeW={cq6 z&HP5&<`FqwH~yrAkA<=jJzQBoCXG8VKcRHv8nAy0FoeOUMHAU>CZNYk>i zm@~!*?-6~Om-ck5@9W)lB)$8uaqHW2dsjOOoX{`Mud3?qXJ**i>jb5(?uFg!j45D| zR2RiH!|Ufo_n)hyb{}oiAGX?qc2{r81A3J$qbo)o7T@|l;0|Va?(aWtkyB^5ek6bP z)t@8Q9S}>zDggBuh?%ZGRCKZ(IB;-8=YH>A>;)^@nsdg8ZDMMN_L6ICrs3liUHcnJOOy^nA3M?K^dGx{{0z_;vUeLQ&Ty*+Cf&_5 z!ig^zQ=_n?z8C*ma-Z>%RDPH)$myVr zvYvRH5?T`77HPTN=Y8Zp!L0sOm6+-2&#z(({BWEZB$;_Aq3wkvvMg%t#&yik6T3jk zeNz(je>mh*W)pYJ;6P5(J?{b)X}~9YRT+bdwN2ra@~|-*dfoY49D>eo`ipn( zgy1#=ruc;2ehmW5A}__+<#8Ki1*_~vB7Ty`bKr-|Nmf3z&8_nZEyIRdARmuR@S&na z&o`#y(LC(!pD2h{b~BK4Pc4a!YRFw-7JQyYftHMUlJAU?>rMB`l-|B2%1L$zEO${t zy310uIQwfd4GtBa@H$x_Q;5SFoExyB*oM1(%(fyMyRDKNS!Ry%b*4=Tj;dboWVFnr zgnh1v`w1DFoUN}$1I9?djgw&PM6F1xh-3DxIwV>v2R5>JSj)&iq^2lVwtiRIPgR6Q zaUKsE;mRXt8-V*kUHtYC`ged)V8qel6F#ZiL-{U}Qsyj_`{Q@hqw|IgBgMcid;U9n zoqEGhl}DPRT&nbA95Xi!*`nh;s0=eDaOwvih6p@s#U8f+Fv9$8O_{IyGW-hKNJ_-T z>?|Z8AQsYhTT4wSgGPMBS zPDQ{plF|b+a1WZ-Ri5Y`Fc>4S+Dke!c086hn@Lk^9=sLD>QDN&7n5-_82lsNQPE)+C$8P-bUv+9NQYq&u#h(@#38*w^_jN z7)AK`4cg=nU%vC~7^j{;)zwyd#}|l{g#h<@iCf&rYz%2II|cx9Lv)_YgZ*YVKZ6+u zyu`RQFa32&Dmu6pz114q=36~81KtnoE_ifB=Amb{ zogZV(11>rHcpswTp#ZL}{tR}-?)@i%OA6DQPx?0HzVE!9vJQFjAav1u2e3F5ctOjI zuPh?s(KX8+s9`Rb+Ko=AO@Tgc6MYA>ZyEhB z^!?%|tsS9O-w8m5xX z=_)g5XFAovmk7X<0pJ`Oqyh~cYq}m33#QXNo9Iypue0yMi6Z4oOStM+sdV+YMM`3X zbVsbGj?heLr6U>}<&JCymj>Iu=P(q}Q+PS=l~Jo??}EG~H%dvFlePxdUu-(~^7$IN zNhAXTm@HoKbgo(Bsg}62$^w78&Icq<#2Med&+350iE<$ths?1zUufsxEV|LZ z$#=Bc`PQd6x)^9;k;!t6?ZHwK_EShTEg^eOD_&x6bVv8+xZFvNSo1MFH4W`>9I{U) z&p2+T}`hO1D5m;JMOpJ<%hSUK@3N2L@P=5`+qJ{ds>bn|Z!wh1Zj;JTberDKl)l&*ScC{r z<71gMz*WI*k2IV<0TFZ+T|a(Y?p~xc<2=v9e?4N(A4hod1n0$?gI~-Y-P$Ci`ke?l z!h)`}9TSY+dwi!81T&iPns~WYFz_}Fheb{r;)UeXp@yneK6e`&Mt^U%g(eX3`~53G zW||0-sz`2g8O3%T{_wApv)M6~t^)+H7uJtt;tUCH3NZ9Kb+O11$gOLyFPE`}h3VG6 z=4ubY+jL&Oq|tBjg3?(a_j7W(-W5}3aR4}B_F*H|%wkjA8WzZTPhyx@Sj_kPErhql z`V!&{;P?f98Yy$@Ys@fkJROk)qyOaBW-C(!nTz0KWd}j;Lx_wP3V@o5_;9E2D9`$$ z;+W~wjNYY5y&~gI*&Wr&{9B-GZwX=Kh-YP3bIGI=b*p0RyhiK zrT*juxH$BLR4>eJt88XSlgfb%COKx`n?x1`ZSIyw&g}0!T^-p+keo#7{=vQ}Gm+z& zEm-GG{xAABrAZO-cYHtZjM{qaK5oW-ssBRlVMkt&)YIN4$Z-*M6L)i9{2Abbn`Cf3 z(eYzuioDNEQa4HGh|px%p)i~|49mTfGrZ8fvN;Tdoscma=6fW3Ey}MwImxBg6@YgA zOdk-?prH}u_UIieP;~HU&)w?FFZ+$j3CSreu77II~l1j59g;L*>!iVj5e-g)BOeJ3H;J8v+a84@x zYz%|J{yg2^0_Hob7mjcKQzsF$?JPcs;hW{ z?L>bSb)^=mzPO)UQXFzY$yEG7U5U^7eFopli` z(CXUt7reBO)?DeS#q5wTT$od2+%s)^slreZf^$1l2J~+KiPLE2OKHmu&*95~$+5w~ zs}7Lt6+veaAQP?tsUU~HT2$uBq>=8(PftT#>nxQ3A+aiTNEBk9Z8+Rt0Cf#$o{<-o zU)R{1YgSDGp4ab1AY6^&q7WZUfi9Ox(<25Js0(%P_u`r)S&;%|4>%z9(RFV>aeiSg zm{uerVYF&d=ewl&^{c`yTjNMc*esET<6Ipm!1j0sl4XE#v?Crl0Y5j_>j=1RUJ0Ue%b+OZ|Jiag^Abb=svOTkqUE`|wyo(G} zo$K8VWn7N4U^d}&@637kRoi`t z;p;tHreY}#YA(Q!N7~*cH5$Hot4`)hTAwE;-M?1X z_*!k$X0cf=tZ4SF7s0W$`xZt&AF+ig(r@#l0InJAENEqYwF%`=27hUw0Ig_CM%hBS zhr!JaRLB)$$>=C3zjDt&0}Wu460X)F_${$JfZRxX2oSJy^^M?VYi$Oezd(IG!QlM7 zTBZ>bcmn$;;Rlhr-WnCRUPM7d(bj`lY4T9Fq<{>tkuNxc)Uj zv5&KqyfKGv^yRJE;SYIh@P6`Z>~9#$o3}AA-L>} zqIX3{Kg!XWXW=E|Fu1FMnrZb-OLPWQAhu_0#w;i29xTQCX?<;uT6W{Z0?91IdYB&k zp-T16@>dtj&(%WW>JJYtf-ud(x*w8Qm^PqH9c&5XKcmdZ9&s~M6 z8MUH07ir|ol?|>vqudNFx;XO`W0jm)>`s)fN1m!>$8p*=C<@Mf>ni_bo9p7JSOvQ) z@M2Etn=K(Bf8}FHxEE&UAX)Q0Wg*uXlIBnU8{HLyxhP;4wR-9@9s30khfmz9noZAw4&g_ zTKTzG-)u=J1^zdhCVp(*^A=tuafwiuVFfRB1#fi}pogg=7_Oqs;(VSeidEIplFOT# z*flTdEsV9g^P!x{RLMEOE_36=dzKrJNM5XW`v%y}Y_qhM#o z0F#Ym?Y9TPIcX0F`JHUiY$F>|l88tu-}>1!+%LCC|A*@Byz=8*p*(v8s}jpt**!Xl zV?8gIOSc@d9+ONqeK1Y?h;o<~-QXi_edpewiah7aS_5bb#s)w}IqF43~p^&Q|YUeS-uxge8Gjl+2W{y=>{U<*t=nBN_ZZ zExrQFUotZ|U{&!eyU}-|X%(7HoFn+NgD{!^!iP@cX;bu&K<#@Ta(?QmA*-5qs^WiR zMQIoL3d-pKt`MahS<&^Qvp7!tPUL#=c~zoY#i4_Vm+5ku18^F9n0L$2yOLEm5a_+T zf~+sMH4b3FOS^I677gS%D;h14deDcl;F@LY0NP_$v9`omgd1w?D<>tQDWWQBKjXW( zISeFtJr9XJo{pM^v_*NE|Brb!`PT0m4EqLmw!tl4x{IWN94tuDJHXtJE(f-V0F+6> zj5|=qzG6@Un7y%_z?Z+p7mD!nqjQ*l79?FL1DHC3$1D+rc{DnNPtia;-fwNXE4o5e z&cdcSevhZ~qv+b&rtTfycqc8w)vJzS1`7pZITP}EWO)I&@W*oklEb7|nFNCs5;;Xi zdB_0?#5o?&Xxn<7_W}eGxe&OF0-~X%etgY+kQ3|gQ`hG>wEsl{_;qW9=xY9((Xr=3 zO(;?h4NY~)v;5WC{^X_a6C}fBSWR|5s1V6;75DnO_tN&5Zf(0`zY#0at1fYYy91D%UQK3-UI)>u=BGmF3Ex7zh48 D;m)^K diff --git a/doc/amaroknepomukcollectionbrowser2-7.png b/doc/amaroknepomukcollectionbrowser2-7.png deleted file mode 100644 index e02670f66060a91fc89ebe0526369eb1ca176cb0..0000000000000000000000000000000000000000 GIT binary patch literal 0 Hc$@2jR-G2AZbLpy%RMQ6Qj8tWXupV&iP42%Xpr5Gki&Wge7G-? zzK_IFti`!sLa5u-*fJFbY@mtNwykuuU9x|=((!_g2yt}Bjm_M?rKBo+*c-)cI!|)4 zkO|70VPeBW?tYSvn68M4O%@b}+QAzE{}^((l#M8|K$0uPKQ<@+cU%ft;J`o4L}dq>qJF^#t5_d{NR1N z&Hn6u-1H8XNT$!LEd{#{{l$^Z^ZW)R{!MM$y8wQSqbghW!>CV(5&IY?mE+h6mif63 zVtTip{o`e+YkMYt$mK0%H<;+EFPeWxbf-A`3hjESYp3ev?cAE{<2u?~7QPNZ-;@K0 zomEk5R2f|2hyMI{?7H^j`!@{-v=}k{n6$Krbav}4Ywu4y?~N#KqP`H6%O2B7jg0FX zVZC1mw>UjCGTIw}O3k*QS0qA4Z1|v+7^?zfgWZJWOO~I(l}AKgkGxjv?Sbk|*1MB` z+nU`k2`~P3O%1tSU6CYz5_FPveiCk?MH8Bmu;gGH!D#5(;`EZ{o36;?w1yqRA47S0 z_b1XSOXblTdt~a#jVD_HM572q1$7CnHd;f8I9T4FiTL&V2B(k-(5zQMByqkb$4jr> zB1Dzhqr;e$K9q;yvMD#QSS0)UxS`ZOd=yz6q1Ms zUR`ZFQ-Aw*U}|B(99o%i?HG3dD?(>zQWF^%WFO?_&uxv=tTivQ?0t2`kWTl21W%^S z_DpoXzaQA+52b%NnYqfUR?Iq@ZwcvtZ6x#}$fcKr64Pz&4vNHqHq8!F@$`8$9~0}e ze00hGY0-#M@+0vI0eN<|0A;r~{G)q!o4KC+p9()=XB(&>80~7)3Ju*0(jByQ`6=UIw4^R5baGUd0$C3q%X%m;` z`x_=+^ihpEWdA8t(SV0i>bOH}o19*@2Tw-S@%vFbv5jb&Jc=-0YYZ?*ci#rRy zJum1^_U9YbK#t0kh=SZtpuiaBn9K8%@T>T*U%lZ^vXWu%wO4mHKsj4b5mFL9)i%uZ zCX4OKPfLv!JDfOblt#-nu!bUdN5=-0=BGa6LH8mQ6INUm6&0P+#ftXnsSHlEOfJXX z;%u+5pW&GQdnpx%_OOB|70FSVNXf`-9xpV#+G=W0kcjvS-jZR@`=+L_%o<({2favM zO-)R??@yN;Yx;VHm=sb`}rv=Kg;0 zLlf_6J44sTo)_3V^$2qJy!rXQnQR0I4GryrB?}3QBPOSV&mW8wO^}3?NCzDr9`7C) zlcJ{k*1c_wn46b}59(`ty@HiK&ghpQiTnXN7^$<}8;H&4!I6=X;c`vH_yxvk8p{{SW0IW9JpXK#GXWyqeZ|?32C@j0| zup>C7>#i#!e^^7m9PjV%SJzxbL);$Xv44&B&sEh(3o~gT-=nRa`xg_FhEW*?d!)!r zO2n4Hrw_G1U$FkiSCe?4Ux99S-*O$g5vB}T(<5^iw-Ju^8lNakyha<=7~Fq)S~mLj z$B$}Uo$%=^Mve(>pF*Ol?)|Z3Sq1e-GEpR9j4Hp5J{z~9?NlZRhjbL(@vn6(77j*S zuGR%dJl_n~Y;)?Foke|reOy9B_&;11e3FJfZr!$l0+xbF(4zp)r0YWsIuqTzJ*!KS9_vr3P!c`xmprCI^RMf%l-v0hf3>pIO z45O5Ni@in%i-V(-k;wBZ_Dj7=_ADG6oXMsK9y)AGC6#auI5@b8y7%8bCY-gYKsYR$ zmphuy^5|%GR8-Wb-Fz3t4F|kmPfy$1x`WZtJ&f^ZXLNTLhQ2759slC|wW*Yp6!wMA zRPo{d0WP+$whs1jsQCIYbhE8DsvEQK5I*5+k-+|&w#xn;+dN9g)&0Z$9q&>Y|2S302L zi=+;NgZza3Y)=;vyu?g~CeK~01IT&ie}y|{#iSEi&3Iv92#9BLJ%u(9+QxO zo1+UbT%o*|cHbCeB_*Xg@=cSb6&#i%PZqP% zG1Iu^ZV+fUol`?x&%*?kEn+a2<9jTY2hD#<}*b!P#TWU+g%78Hl`Rg8Qnb^V^|3yuae_$UT~ zK!otjCs$BzZf?KD=Xx@t)!n-jTMt!Hb=qIW*pwtB`DMzjFBG~sfR z>w9d>;Uq7=ch`ttZp}wHSL@$WPD?DJb-5KPM$6ot$LyYYXol&+AWboRt2+ddF6b>YPug%!Dp3 zvwasg>wBS`J^qzlIexz;;QDep7(H_5HGFlq_Q%_!XiewlNe#ij#(oHK1K@P|vC7z$ zC@h?7tVA~RF0)))4^C*TPP}n0BRlwWZj%cK;vVd7Als!7sPp7{4;0va?G3TfdTV<; zis})D)ZZ(K6_b+KCZfK*hTDSPnM8|;jqNk_=SL5FI&cjG2_c_(xqedi8AdNXWC3&I z%gIip;Cr|E*52d+vU2=4h1r(pD-;)h7d}k@x+(^Z$`h2DJBXDuHY(97vZ_idH?g+Q z(YYKRhouH_m(Xc~o&pj+{7Fdz5~P*e9Rkbonu?k1(yVhF{dQtar!j8+w)Jb~@0)ZA z;`uXbW@8zk>YAZB#+zmatPnRkeTAjeWu%3L4JR|?DF-}BeC<rN z4gG>V_GmZ!yD#_dTyx~$*xMW^V@Xx+d}KMc2fxd{h7)-Z4!(--9!vT@*A*YQNE3PU z#H`uskjtgGv=uG{DImk4SKAIib^Tp13yyVPL*t*uVQ!I46AaQ*Nwi<{#0g+brGivH8uvZh(2&0?eI}9X9z=KY8=XbXwt!zAWsfwYqJ!(-{jOYb2z6GjJ4sG@1 z$7ICmu0mUFw#?1$(Zj%gH(kqMw#I~q^uOyXKx~$AfPX3au~anFCJS_-gVt!b18BzUai7#mj`52AB6T_RkVkOyA`DmS3m}1li)}QpLxm-wXI4cJk^-_D*d0 zR3&N^4)M-bZ)QZ-w%YjBQF@@|kJMN`Ls7B6*p$@_7tz&9cVdD8XrM^gJz(INe% z3$)0{d(jQ2Y)7*&atUC6{y@Zx%(mFyv+V3BLT^Q=pi&$jD13ybq&Vyynj@3M<(4!{ zng{L%RNg^Xi*+K*(+CBtJz@~*B=qEYZM zVLm({06y%#4X4N$1jdY;wPyFlPY%1uVlq>G1L4Wf_D=6F2nL22I)|0KDor17omy%} zm7Gn{W)sAzUY~IrYC~UC(@3~A*So3-Litco|=HE9IWp^#D`!y6Y@RxeI{nZtdMyCgX zdZX38H7cju9d=mw4-Tidg6Aoen6fWMIao$YC)Atn8@^`RnwYStPR^?F7XI*)wD^}~ zap8y^YwSDNv*DpAcIYnsr2J6l(wa?P6)D~U=N2=FNXFdr;luI z|GFnLnM>W5CI9h!{~jG+_y6}BK@WMzEXu)8d-yv1$R8gg_3ytz;a+j`&yscucrrJY z#CaK~oY46me);^W%IJ+Y&p+40kGC9{bF-Rqu;PpZ1^9=_%a6iWfWsH)QOf4{#nNSHuR+b=Uoy_Zz+uHi)uC!MMitZXGtoQn( zV3}rRYx6+rz5B^i9R^MG89jE(iixu^sEuZLWzGEd#1IX*>1sRenc+_od8=j2O0Fh^eG8o1s8PJ z<34~ldLZ&g5F81SktLy%gelC0=KIOBjv3hat1r6!Fkf(cl-9`HB z$ZUKUw9sSra~=$fv4y$L>44G0UwXe(DWOi@mEqX>oM1+KlcGH7Qc0_}zE*pWa0@5Coqa3m~ zZxf1x)Ev{REOeQa72V7KJOCU2)dc?q=@rEM0YU&>=2{BR_m>y$<(kw$k`3P!^{;I$ z4mA#)P-CH6*?6jq^75H7hK8n8L82atpwVI>J2$L@XaWel50#CdGH_Zp2+=>od%+dl zRP&8xqO|OvY7erB{?_31E5knO6ih&I;OMVH!>>{}_mP*0FJsPVC^67&OlEuqq;K`FY>4OiE70|p8{Cf2 zL6uh`20Tp!M8VxYCe%+4u3wOwy8K2wfSHMKLt9$7N=urf)TOopeTcP!gCD(X2}E+8 z1}Le=4AwN^bHD5fEwy#h|DyBJhNxl_7apGi-8G@0tE*eD3Atvw(>G6+Qwv-h{@OVd zh8VJ?sB-dZR!#(<9cAeu;T%3SZ1&aKalkdM1XN?mn$#!)U#qR3;t8;P41zFCKNNKT z8WX=Ds3Ky;w$W?j>_-JY`0K1VBbS#C={+PNi%?B_2e00}(BF>r@ABSO7pr zrW@2fV9kp-@~R*Z4&et%5<6pVUVjB#D&OiZEnzCL=`(u1Ta7!X1n1lFMSawy6k!|& z@5taikg(BZN0NX;_PH$!dDW_nEQtqvHU?trJ=4D+V*8t#H|m7_eH~mitR|o`V*_is zW@E;NhvdbIiTy1gQFnUvUv`LK$7J?nW&EchPwY#vf&EJxjAZ}PM$p#mzID%kU9fx~ zS8V>L&rboFnQsZ=3=!DBnPn_In0HX+IplN6OW@+>-?)PJ9LNg{h?#z%iT_a*`!yzH zr^XgHR~OqGn-<#_pOiWl8~g>W3hWIG4sQ(((1~f2sYRT$Py}TbuJJ(I zx%z#4xDrewV=T1uC7|GHv5WDGiHgaHDZ6;m91wSq{3UrOAt2=)Wgwl5m5$XiZICE4 zEHKB1D6r?6AbXb}V-D5G1jcDmqM5D~CTi2rebBI3<=s$-6X4d)tdq7|JKd+8M z>!D7o71&_}=yC4Zj)+N)3aPmf*4l@~rv45Y9~UYp+9&;{2J?qBYn0`mTYnV%1`@{& z3gKq@%-4IAEI8udmz0=@I69)4nKR_(Zo{UfRc_xDo;G{EvzeWy$7s7CGIO#3zD9id zjprLdMkgP-cc+Jr@jJi%&SQ+y<{7f{{ejYIy*X07>0*1MBlyitT8qS>;)q1dzp*!0 zQ@!5&GQ^UkR0+Qvj2_M{S92|P8P5Z(&ds?$=eJi3k25}okY;DU1(bw?)mTGuJ_KZx zW*D#FFOhJ>zS!B2gLc7P{$8glli?EjFZ0`jpv4jxX$8%XUYSZ}!ndA#%vzU+J@B(MxMb zq;-Hu#|P(oZ<;PsDGCCC0_;@9%t^4+8uTq%(m&Vn$#sH$S|s|9|%Ebc#dYe66V zT12SSPITSo+0}zORXF^efmsg>$ra7z?J2le za*K(O?=5P~yE|0^Lb6FPXxIMxbmgfceu%8lH?AntzpFV@U`Qe-ID+Jf3+#R&j2475 zS?W#w&4Fb#de^M*CYyuZ(4_k)%S@GM$yR~a;Yz!^foM7d`;O@zAU!w5tE4ZG`82@K z#H$!w)3Pj-jKu>9&+2l11f<9TFO)*2FDhUjXiA10{4q~C4)g4LWCb4lZk4YrfOLQhLk$!Vu$<>3QOpVYMQbU8?xlQ^Sn&&f z__k%hthYL1u~%*iNl6hD%={v=lqEIT6mc+JBXnZH-0d46x~9v}4Mw!&*58?|a@}sQ zu@eR)Mo0B-Toa@Zd|*@B0H-~XU%U}CqR5z1re6W_noGAAnlwPZ zq)tLMOTn+S-M(ah5zqc+xpU`>fjL{n!>sp2;x$1tBfMY`_Bn}&>Z}bvm@L`SIRzi%{9Fc&I9`S%AW+tK zn_|=W(BY_1iN?6a*PUr}eGnj_nsFXNf6I{aE!DXDiA;8&3`sv#cE zIY=Crqv~p@s>a#Z?2pgSY7W97u#E(jk6B50Fv=EXgdPzymPJd6AO6BnwOM&+IdfB$ ztKSlG)w_>EoA7T}J{gR5AB^l&R%g~@iuUeAWG9<&wmW_Ap*Ckm`nHLq6h*sDI>Q3? zU9*DGV%6;II=+qp&%eh6gYP3Zg=YY!@?wKw4myDmC@;@8U-+Yhx=b*#6}JID5+7@< z?7E@|wZ@SCsPjc;xB}6?H4ooi`Z91U0E7r8dB)oFrt4BwOD-}f2)N#2pN!>|hLi(i zkcQW6_l!H4Z7uSfLb8t#$L_>bP0A9UBDN&8{Z(G!I8 z{|Flzf}54%$tl}|VokDd&pyL7E3Jh*{UW;Ci`eoggv9v$qolOlw=e3En1kGhL&LZI zO^+{gd~3Flw%PfTZxhYLtkrKYD7<7}Pf_`rvKvR5;s)*)3L(v$In=*=zLO9tCOy)B zG@~%xbSYr5+I~BL2dWv!FQrmYzXHIOQ@vN^x`QLq@8H$`Qc zOJB7&x*$+0yHg)c1fU1QzqS{&Nr5&zfgPoa-x}Xi*RXg=V)2!Lq?FYt7nIAz?b(hi zUhVy7v5Fz8-7PGW{eg#y+N$2lkU2@xKu7fxFp^jUT?#VC7%U@1dvB8{piKFg(|2vS znOHFUhh^@c5}=b)Zsi5H_9rNm*|3tBgk|t%(W7ffN+Bh6xIe4urCMr)Y4<~F1nxtwYgj zE(sOM=GC6?WNXJcBK|(%QdF83($w;op9F+)pbcBIfxevk-OYPk2>g_3{D~U{PD`a9 z^PA|d;mm&{NtnsJj)>I3P;a}-lCIS$H3A%E5Rnn`gKB+?=pIfc;ffgefbZWSv}*LV z*2>{c*2rfBgT14pi1hTuvFX~9`mYR2&?0h7CFSMpdSK4iSKE(o?*4lXphxXDNG9zz zzFop41u6)sVxgNvZg{UU1cJZsUHLRCID_Nj0E%S`(|gLftW{uv&$t%?qcH=i0$j#m zG&HWV-{w$o3GWTm4VYaB-ykn^Yu=m!4!PjZ{-Ak^^+xG$RFhPn{PjZ-Y1Yd+2cX*g zS3RN}8m-M}VHw;vXhiKN93VC|zHrc?K}HN4KA!=jap#=Gi!!AjQ}D2tYTUiBpl21w>20rQE{{yPzKmT;fHX`(UHIX+%)lS; zL(5#Qoc@b^!`Z=+~(MRIw~BBAT!4hEEaWIsnz1uWA-PZd4LGhXDdVkMOW9B0>#gLyrTHmi7uHCK2Mr%c${ zFM|T4p#jNF(0UJrhK$$@DcFXnzs6W)2a9JP%6@?T)DXI@3ja$%Hhm8u z_v2@HCEC-H6g4u%?6hnR8n__JEib{3RnfQY7pce z23BrSCE@e_KuKk}XiF>PNgiy%-k;|UK|w8CSXlJoi9}Ks3BLqICPgM#z>DbYM^-3@ z1JcHBfajE|^wwIF;1Ip$bcKZbha+OR`r4%QBe9Inq17!18;R|MK~@YN?~dtd=BhCHl-?e)&@4^H2( z6WpULG!Es^9WVsgx?i#BN)hGr9tMRJBxJ%t^$sX;ab&p>Sftdf^DcM=u~&D|ekq$# zK}$(6M=UP9(x-5hvfQi&1)W!ngAWef2i@4hWFZ`3BOMksH}&v(R{T_p+-Rj{q6H!6rYTJmsZR`t0x13v@Lco}d;~ zvICvny^Sd!6_NMgi9@9j6AKZL4N)FLK+o)*MS0g<8A4S`>X@1GqGxj-8O9!G0W+m; zl(`6e;4R(~=>CFy@x7Ms02N0wf2VVIy`zl86hn5zww5=WsfiS$C8&-lr}v_XnmY3888JHq`a{#zReco{RRR! znSLri@r8unNsD)e4ZGHf=7N;c=QTE)zcFivrTl33!Wq#`reRM=5Z!_s-cKN*0kMNn^EcR?*Cv>;UOTZ&R3K1)9WX1; zfhIN%Y-a}l<@#->fadBNMl?X=nkx(Wzh4gos{AgzWPK(tz}jgsbwn;M8S6U1lm1== zQZ&3X^0lzIaeZQXza4$I;ID%y&XXo1V@Eov{WeF5oE%j>ZSwRI)B&XWPp$xSOFW)~ z|Em+4MGtld=LVNQ`{6@@&~d&0*H^{0fdO)$!{18#9aI~C1z zCN?2zXGi~}EE+Jng-0A9OIQ3*q>KT_I~8al~$?<4z|voS#p4Gx3gJxKa|2SRQFDaSn9tmPCe4>$$Kt z#bQAEyayKlXe}K<(A;MyE-1*>C#$XPd*2fV2*{Ho3J3@YCMXDq&i}rU%s|ox0qHIt z?1cVm3Ew(9;ck07*rV@?n+tb7)CRooa-Kd(j%dc`uVaj4X+>pJ_r=4-aq>AMMg_$2 zk{w%2<^^wOz^{#EaI`@U(M>qbib|XDk3ArcG}bnx>vBU)8iiRF%v!i>Put@t$*-+b zghmpeE-fk;d~Z4Lk5i}X$-9;kobonNBX5-MohgVT&i#!U(VzGO6*{^+K<_fofV268 z4nm|~RRbnI(2%VQUEa^Yib=o-s~&@yrRz*`DwKlxN86F)Bpt`j?Oi)@cF_TlGW8?t zEn~V%;;4&eiDap;DzP#f5YR5;wMkCC_c8oF`zU)+*16>IDIRe&MU9POyUn+0qevc@ z5ze1Q;5c|R9!oxFtT0)|*9UVj*~0gFDmfK09yuPH^_|_?4N}4HP;shqyl%WH%k|jD z%KuL2g@kv;!M#9qmg+Cvaf*Xflk`h*I(24()k)GX?V&DctBV_>46ED6$-kaGBkF-r zcKnLen8CjedcLU|DxmMf(x@hWqf!5TI-^)FT4q$5r^FsD+~C$XkGmNEM_p#I&QxVe zX^yAE-Aaw2;90LhrOZ%E&2rHyUFmh9UYmQbLElll`1JQwoz+y?$MW5a76Q*P(#OD> zHbTI|11NapJ-@-0YSrcM&3G&847V(obc~sM5u^6Mxh+i=P$f{aK}KT_Ld#Jha{9Od zuL@M_g}A26T5?UL!n3uo+mnefk5%N&(IRQj0?ow`@&%Izf%PfJ(h5z6C{IZLr=5h^ zQ?E=sHB8xXJ;qY zJ%X*`W@<_^Iyx#VCns3#kSQJ9+|0rED<>A51+qeEY*g0O3fA^I6us;bcp_A@+z%+V zq7$fkoiCaZYdTjN?Vl~2iQm=C?M0wJ4?wv#Xt46 zVE}#`kvX}4aIUXm$X5w&pT#Ao_wzPqXZ;ozl?MBQk*;s2_;*jMx+u|fo_V52XPhH} z!ecCTB~?{a`nlNXWkh7M$kKoD^Z*qY&CHwli0=);*$7ji-y+mHVdf-Xnf;9Vt!jcs zz1ZW@A=@>r1wGx!tuC4U7K;?mYKZ{p6)+`4%bQBX$iN(P6QN(fzM-8@Ps=*xrNDW+ zyK`S`bc{87fAVGVx(8`{JwwQ3^BF4ek-sE(U2gFDjm|K$YKpkxGh>Dc*1WKTjjb%d zjDX^E*nk92QstF4wxO_MJoQ)>{or0@b5`;5KQTKpRb?@^fNhTSw5ORuN1Pl&){YCB ztK8KUypKu=`o07^Gp|hGAFQ|kN2W%%6l08~AvN+G)X>CgvU{emkuH+S;d`FLeaNi_ zY;e!4b0P+%^_{3(_%?KNB{4V!YnWblRN6V zqbIu|6{ezP@@*%PyXafJr8U^V=Y!qq7Z1eKp@TSNj~yORB@0!S<%tahM^(3}mtSo! zU6n^*M!&L$&Ll+h$>(X@2@333Y${8nIHT-d6JE2ul7+lIc-+Y)3-5BHXtxi(vG_ee z2DBmij?TcPmh(e^_4wcjR#bvIGc$`-o2rFKoyX+FSM$4E`GkIiV=-KtIWdisRB@w9 zXyNnB%}zu1xe>RwD5)qvk`VQooOeN8nyvlfIa7Nm`{y5(prZNl;rJYeP#z;wq{kxG z!&FQ&>-3}g#7CR7+%cGrf0mSm_rub7&kvf1K;QdY+c2fQ5^N8bEa^1t6LYv3<*P1< zo&|k-`rZ_C1JvKQlEL5D_hXV*rClOcJi=IAFvBl{7+}hUj*jXdp^)cQ!pm6@_pF{) zES&?TZ{ywSbVk!?dde01!`Fh+l+3{P-E*zjc(#L<|i4DOrz(hIU-Q*k%?I{#n)a z5k}^ypVF5e(`=b2E-7U4raZ1pNnI&>!ZRaWW4yxY?TfU(Ktb*bT zPew{%+>NN-hA0-Y`pV*`VluuabFV9exIi^M3&yzWBnxvxClYHJOmPjU(rg&mO1Hg>{zkfKEl$4Oq6y-Y` z0j9F~hmiQ+y2pKGK6zYk3bdPPra3{G!I&ZV(9c z2AY~v_RTwhRwgvi4jgxEy1gSTsH{{-eHU{kTJjXx;>~NT#=uK7@8y^ z$^Nshps04JUi5n%p}e9q$WP+>qs3guH*#Nb#?3tV=C^RNp)x{Y^`BgGiHRKMOuuvG z`H&ev&*8FbLE=}Y(Tp4+03wH}DS6u`S1oy`jA{&B+-9^{*a7ed{CSJHc?hk zhG$Oy5f_>=#T~RYU8iEsT~dcsNzWF~7u{3ZA-d&gLbXW025H$L?Z36zhKEr3>kXd%~p%y5>D)j1$ z!OuTqY~d+|-@YVy!J*0nAFtVw^C#~Qb)eIaVZHhv#4F|~7SvO2gibEay{ql{lQ&}c zTAV101j#LGQyb9*z`&Q$h_%I_n{){sD`sp7Yo)xxY!29Sg){H4zX{$1>P1NU=QU}a zI8;%S!KtRAyi%siyTlFl`tT0c+lb$g_ps3Q6Hi~oq@}zQfzyckYOAYqit@h{1T?yj z2N}~wNl=orK@O%(1QBHphm&((p_&C{;lGkJ_YT~N-e1PB3$hUFv*L1rr!*GTE&^#7q_Zu0=zImd^OZZq& z*53Y##fFb49?$#92|(Au1A$|MZ;C|OR(UGu@k3bk=)1G>5-Rka0li6DV=!uAHnzE( zLG&Frix2Sv(_W8+qqL<=&KK_3Kg_^9=(SvVfzt)nf^NW|H#4Hv-e5eRw+|3hdsJ_( z+QaDm3-a?)n^PQl;z^>NEo#h z&Ow1#AoKPi_^SeBa<4Ds1GUmG-gU{!^0Xem4w?%f5VMF$G#wpmk&>=vt?5R`Vkk&} z=yScHbg@o{d4*BWoe_t$b3-UvQ|}!&Kpqd0>21ADofaQEsb$cei(slIG6a8Z$r7Xe zLT-aX{N>IWk;1lt(=K#9M&;Y-;Uet2!PZB#jxUY@*Q5KSG z0oYIcO-;*is0>n*@A5ItiE3*FLjLmhlLf#V%{IIVoZ{n)s1QRpLfijov+Ym(iZe0sSlGd;=_?We@rWRNn?CFf;A-|op ze$u;|h!WP$I*)sKvswT!&Ckp%C@ZPK7AV^Z*_KJEZ*IexX5Lr5?#4B_*Cep17?_b^ z#@bPY@U`=ykAkX1qqAodh40?)aRgOeA<(S3^pd;yeLlQzC)mjk3?Rv$-lX*JsA2so zG4np(CX5nfCs!-@~J3&5vTi}E$DGp}# z4!Y{=TIz=NI1H7Wp@4<=ZR@pxu+y%!F4WC0!c?+|c3pfBx#H5IvQe@-9RsH=)RJMgVjVfVb1nowYV^L$>@lrhM5?Ya8 zN)))MD49X=4RF0Gf34xb{xP%A(g-6@TIRai)Zy2srx=w-M$p#LU`bML?)1OH0?shS zg@rYrZ!8@Fz>i*cTnZbOoEflG(8A}}*Lc(ylg`KT7z_~wOBnlrhApG|P z!V&s^PuN_nyFP$nJ3BiEB`0H@ot;&?-WvVn;pMg68%E)**T|N9Hi31z{414BgE@c> zB>or0!cf+)+D4*oT1wpA-FK_J-)RRU@t};2jV=DRChlKub`cR05^^}6pr;1nt5sTi zL~R|-f7DiC<6}b6}4u9OA3P6%{Th z5yrH-ZLR%HOlsoouP+)Z5dry?D7Fxo!GtzvfucuM;9>VgjuHP>@n38O^JV<+o7>@l zImsXY?zaejV*hJ_4)_XLU_AmP|MmUa(t!UFFj@*DX9}#(3u;;dXQm6-rE_gD z$Z5zgipz=9S`^Rwr9D2o?L~dEz`Mi z)4BED_bRaw+^)UvIq{nPNqDmv@@aLm8TZ-w_LyW1?$H)wO*^<2>w&ksMzD#vzec&K zwZF!=S^4ZlzxnX|LA)vY_ArdkTSn_t*1&xOO^ zsf7vURD#~}?9kDF=TxiY6`=m4_)SeuQ7R`-DW~OM8>W_^yvX#e)S;xj(pYhUHK#Sn zL_|sx&CF4R<>cf(;w1=kp8c26!g5#;B{Rdwc-q=b0hN6loF{Du!yTVm=mV5V+bi-p zLtjVMddK6@e)DF$`y1JD8o>nsQ2l}?uTnZfBcl&)svyi ziz`wVJpQlyF2y!Nn%wFQq*u|JZ0!ej<`>J)B})-gcZGF&Z9R9TRU|DZBKhS{Evqie z_?-8Q2Uoub?^)1U@L7mis9BgkScIT@pfGw}8)&$Iq*1?>BG; zEuQ2L{vjEDUVV?pzwA#Ruh!RZ&oU+!79y^$oHw_(D>p4IEfH~XsOT6NDCN?lNYJpw zD%NU4{}V(kEnq#Wo|tCn>FEbExt(JY6TdJ7KB|ooe1bF?7%qgOq9P-;X7L;eJw4*W z!a_u8={F;IwTh(C>YH_Rdd&{;8aHc$c~g$m6oG|E91ctiu_je#a5-xa(PGlGS(5Us zACSVTuM>=;rrK|SHi88xD5(6##-vaWVPSCY6KgXwA$xlk;i@IH z1nJ%>N&neD@PcC{3uf~R3%Nx_kco+jujfAds2*yTNcp}q;qrpgS~I^xxM`S&06 zH4_?rP1ha#guel84%ux5FPOnB_q;;V0{UT+HF(s38vn4R+i=DuWrj;?IS`MDcTDu9 z(*G+EX)sX2d$d88bec3EWr)HLK2gCG*8*SG4g|)^@VCSI=Cr z%t``MC|}`bn{#xIT|K-MmK)`C(%@~s=L zj8aXIqA+!3ydSFg$MkHie?|4#k!^Xlkn6YQ@r|fkLH26{7leK#ohOV0 zey(j!ddE+>bW;vb=*@%(!IUqQd})Rgv)IB(I|*Enhx{23cnZgDqo}({1i}IukB+k& zd_LmeXuRK~*F%`pHd8<>2za4|F|$Nnv}^ukU4<{V>d*z%J_$2f%}8g2iwQ=^x8+6b z0(39IxK-pkQ+Y8j5Om&4zSt{59Rb$~enf0M`<6k7_SB1C+Y7&tT6XBH@fw1cJVEHy zUme=S^bp=Ag@j$|CYhGcW9Jr6_{#X;KE+=|%x<7c-}it5r>Nn(a1*(>9SBRR+OPn> zP4P=0a%EIunY&o^N@!a=!XUlM`@W0GX!9CVzGWf{04rbP1!%-6D7 z0?3hJ1AzU+RP4#2PI`KzndnB!2)5Us_eyV3l$DBv(JyF<|!xrQ99r8#mSsbG=V z!z%xQ$1n%zsL>B$jl}{1Jc$CQqP6na05MNOxbe31z~gC%C)Q!vLA?*006ERHF%>?^ zQRj7}PnA;sEU7+5Ihd2;DA!_ST;qC41GPsd*@zSYi*ymHfMETTQg9BewBDt_)NVE^ ze;0;Zc>kj0`%IeDr2tKmY2X84dXw{!JdsGX;jWF@pF;AGa9jC`=}If|?Zuf#roIhS z|K}H{c~0%pIlCFx0KEUvGSLC}8L$fRq06pL(d1W@DRzutYX3{i#9p5%qQK%>O$d=- z-PyVqtFgXF14%T)jH$tI}O5Pp3P4tXge=}{Z0C_LUD`2XsmS)lmdZ}&#x zy|#-44gtf^!{|?9zLlhTD(DKa!v zG507%xABCSe+l3}0gyCub*3hQ?HjTdQAco%|4296Zk*CDh1YF;X3zzWa=yx-qNe+E zWD#5xk$Vj8BQQ)AF<>_!?nckn4hE-(G((oQUP3y7VFT~mz5lK#hbt{Ul}3>BsekUJ z=2=Ny@`ut>CCo!Ns{+O#11^-p+%X4o#;iMjq1Wj-yJB`${x7oU3p?1YxJu&%c=;M}%`tLi;Aj9j8yJ)^ zV$iQ2gq2WJyW^>7%co8t$wCH(FD!mnUZ=8bU=tY4@Kim{gFzJ+&8Rrgj~!VYP8Xzz z9MO!>_AbOu)v-S0CJLI>Zs(BYB#Uj^R}}>pr+DYlQV;%&0RX1j=w%dKd{rIY6x=+T z_=a1iu!HGCH!?=)Turr>X02}05s~pCtD%|QY@L}9K}}Ca{p!0F#M>qBh>G+j-Rq1W z92H6>4D%(H4kKk~-)R?4_X5{!JBH-Wno6`@v6SyTf3f~Ak-JHFUb0?TNXX-V@95G)R>3Xz%_0ws=zMH)oIGrV%yqY zJ(~oPOqt;-S!)8ydfJgDb#LEls^xK3O@5f7d9cFXL*O-i$MDUn(=pNuOU;s-en1ob zqk6)U3$l#sWadS;B65Dxu+szmR*3}p2_is$W+(Bg!|rwg z$Cr&BW6(rTf!sE#fQFcU%RwJoYCk4qOa{c>q@Fmq*nV$p`W^g#aZG}12;Dl z-&i{@G_=rRs>$A?nRwf`y+CCY;T7mSy||TK3bASN^5b7b zX}z)G{QK7uA~f%1Rh_*}n_goVWKTC^3^b895fi?%BZ?(_e1HGRfzb>hFnv^Ybc_ar zBu_(kzm@LhHja(3na6f3&Z&HfX(F?(l|ozWllA6HV3wV`Pk&o+AI&Z5;AP5-)W1u+v zi~ANV|C^SqPi18W|7L2cPt&7mf#Dv4%HL5SGER8Go+2M?PMQ1BAd?q6BbMi{eA>|E zL+_8F2j=v~^_a$f8IS2Z4VK{%oZi`+Gaqn%?XK zh)93`Zd^LqS<)-EE zU+t!cp1BunB1+n*1mDWlGN*x@IXU$sqp?I}HX&dMOY1!>W7ybd2E-!L+H%P=$7D({ zdKEypkN0fl>eskTeGiZr3)=7mPuZTD$9x9E~hH@Sztsjr&z_ z^0M`UE|YOiawq9^v6orlJcOp6-V@IJTi*Rq9;&- z%GH-Ee$J?4RXg>n&^<=^aP7b!z}xpvs*8ur0=Lt&(aS{t2_;p&{quCJ$7@fVzDvdc z2Y)OW4uYDoO(KEMuIB?hRC{J{RF97$CO32lL1nlZ?++uEQ7W_?3CUw$M+1W)lj$qn{|YdJvA_)$?B$>oDH(@!!~z&f}#<-KP&Y<9OQv zeTq%xSvX|)H99+t5gRVx+X0$ zOe-R1pFE${OH&{;xT@D*4&Hptmi`}w?Y{g*d40%`k=&&fSLE^37AD?*tObrs zF`X#%`Lfgn{UT}V5Dh|buRy^1Yl|v#L{{w0bY9?6fKp-084K?RBV=*Xn*MB~`kBG? zel&q@+aA1-o?8_Dfr`|?M@~T&5ZM(GPBfw~Sa}x(qoU{eoJB{M3tUS#cbRhl@)j|; z<_}>57bJ?Vhbk8nFHSzDOAkLOI#yK~%1DF>5~a%b?qU?ZKG$%RFIqVL>i-Tdl=6Rw zpKh+asUl8JY=4EjFHof=B=SGsSlnSE-vS@MW@;pm55Wxn>-O={*hr9x#wq$CAfu=C zPd=kv!4C_nih)>xd}a{`4nziAP=zuI4nhM108`D?Up}JzBh|+urIh*|GLGnMI0hR2 zvlmc00)EuRzTlqKBZC?sUI2k~V@k~g!DRk~u9==+k1#%?_p4(76PcR?%73Erd(V(e zrmmh$?*s%t3rl>cyP4UywmA+G6408Onvl>?U!^j`OR^+k)0vr>a`?Z&0t`*!($bXi z#J5|Jf=vGfOK+#({|LJuv=mt5<#Hqjt&+|}+7EbkcJ}cUCVxKKTJt6Pv%hW1h=pCO z=;3A$Ft^tO2}0au{5T37f!&0`rm4|3Ag4-)yHpN zR5o1iCVs%1@;^n=CmPlYB51c%o49hl`ThT@d3y1K66AIvQZM4o(frqWYaiwRDSG~2 z6wv>VH-0GwKt-yXR}@s7*wp}OQr3(o>E8Su_!5MGKln)rBQ4!#JqVg?7hH}pfE-MRR~Ru0|n*Zvjh zC<1={t+}~~eCGCc8AqGic(S3^UDvySh}{653Q<>A&2}$W$qmE}dRKMV*ZtG}rTD6* zb_SQvtB<%xl1pV*?c0yTuHZNJov!q^roAqP&yM{ykWKo%wXka^^3A~~r=cd{=f;sH zCiBir?f9NYsAoRAeDF@9k;jU3{1v|8$1!#MmCmt8<4*6fN7qVlJIgJ%o_k?& z^}W@;`;gOkjk@M2Tg`ZLf+hYIO1sR2P2+(X8^~4YyNYvcYPFEYw#@p*P5pWl=S!B= zOB5uV#}DCkcLAPW&mEHMln!_hi)ci#Z4Hp zo8x`tL`YPqVV;!e)BmbqBv@eqrP9y2o1K+UNKDMl%kvXF=E_90wYBv~5Fms4PeM%0 zy;(=s)7zz1x{NG`86-tRD`~AkZVHD#e&CLieJpZzu>YYq*{pk9fPy`~Y7P0CdbulN z@gpr^ls$1P>{eEV{_dyNTzZSN)DO93j#2zM-V1?8HT@;B#fiac1Vzm4ULiPm`_7JDJ$_B?(3s)!46nV>4o7X{!49pWn|? zgCQnu6ilVDA zG>ynLN0!s{Kk5tLW>k5p#0?rDdLrrigE0{q2;JfVYAoZTvsPP!%{&gXW`&X8+V(lU^6;@5d8Q&hZv9qkYWyP@I`OL`*C@ap*nMm?Pu6f%2eTtws?-d z%XCR(5v?0V2K-6jo1cLos*J<&?ZhN03li8r3cUlq@F7FreYb3ukb&)VkLC;Kb5)Ma zsclWl#3Jq~G9^h{B@v|3^}gByMSI6$(AxTqB9p7&DK&t%vM>PKWWl^Me!44T8$vCI8 zHF~+hu(@VjXcR9JgBz*O^Uy9LX%tZ%!zYe1(CPkYjS}6&4;d9BXg9pjEvO>6Rqezd zqDVdyQ9d)+#^w=NzUo2XiU4~*64~5>d}u6wZpY)t-GFmtlfXCC>eGI(u|qw-G%xYF zgo!gNbyh8@HYMDqtecSLZ^u`IeuY?QqL5tJlW>{+3D*Jsb*-nNfLmf zsJKv#))1aZ7-+KXdAhC5{}rE$d&Mdm#ot^5#}mW zs@rMVzwQ+{WF^O_)!zaQ&l{=o8uhI{cID!_>0mC9TOs=|t64&R zZA&cnBp*vnlc$;0p=`Ba#*YtoKg2K7W|J|hM&c=(~oX)n-&YAa138r?k4EN=hB> z%GYRdN?!tV)<1u2+tkG1X`#s@MV<1Ia`5=#=%lnWK-?*c@82aUwG7XBQ{E|NX{q%} zZGH3w^Hhbu_JeCZu0=8W#nr;L3WY>1AGd?RaKi9o-DnMDTc>175p~Z zUR^1Jo)zhF_Ky@yf$OXBdT?KEpMuNIy6V07O>W??bL>G7H~~Cei;42zh18{n(Q_oK zDI4AH8m+ZAJDQ%vz!r9-e-w_@%GGSWn3E~{4%OpPiDdrRDe*+ph2ZC?t=nbOs@6+aBQ)Qwq6M#}6G6}r72fh) z${W65$|*9No@6``H8k20`fF07Ri4xw5BUv%A4%ZzPdO9$+o04?0p{srCYg?C)!)F9Tn_ZtO*|-xq$ zWmJwCbc8|TWl_X&Qa@?x%ajQ75wEl0bcJ0P?Q7nrzp12O^FarvSR?J{5IMba)?#YTt+r0*P{#y~VP{k_uV@9woT+tREqKkaxN) z@1+NQE2c1=*7@lxTD~JN@rDEXS#3)>tFV}KLJS}WHP*w<#TQw327yz9Bh1A5z&$`3 zCZ_hUrM5463-H~cvV^&X{v`@mAcak*KRKZ1p63#2F*~e zXjCReY^9BszHaQoZAp#lrcf$tZq50F|Miph;}+^U16d28Ng6Fiwg>&=5MoHkh*&T= zR1(TnO0vk3d4lefCW;9lyRmhPVk_JoLO<&)8B_Ckhqy}MTwYHhQQ6e=`Q8!81cvEX z_J{XK^p&w!6mshjiufRe|A)JvHi-JH`S2fhh)E{a-xYw-yzymEa&q!<%F_9dj_EQ? zB6iSC5=l6p3K^s`vX5L8{80^cp=&SekJ5fpLc>=^p6`Qyc3?7#>g z=HFgILPCnWNC7;{Ud-Qxhiz2+E`@js;%y}EJmGxoxB9p>glWP0df*xTuDhXuz#%Z8 zWyJP&wq!iwypU{XAiVEoPRs&CJn=1m#FIXN#PGH3U)#Xqp7|Gqx*=EGU{iYFU3oSJ~_&(w)cC3=j(Y>H{X)scj@B$;N@DvST!iAiHU^N zTS(QLt<<%uM%pU6+CuNocFW7jg=9w4KeNmdk*7~!x{YUf7>$NLy8!{u6qzs`d+6f8 z_owM-fJ(z_Gs+c?DYBi}y`O$)4SOU9GhRO-V|>kZ=rkZmRLF!P#<*yKq@4tvEfDUE zU(Ce9s$tElZ7eLzsu}^04a$2c{&rKeTXJ)8k?kJ5+6$S?a|f~;A0+2@cl9(!#-aUp zeiGp=d|fg%s02aPgj7%eW6-si>EDfSQwVHvgmouN)-~pYYsTQ$4*rD?cT$hUTbp=f zVq(PYyXLQ9f9i;$ZzaYXs$`=t$v_$ay^Jz1vI1!{0wGOU@9oOVT-eE_9kJT~JzS8Bp4|b63B;vvk^bj9$yiWhzsB%z4+GF?14VM0}6S{%g{O zfXRnP3Q+p2lH`E+@=dsQ$^KX=_HIy=d}A@t2&MTjnM zYUGTN6&K@rMjl^w?dQUL@RbeVWbi20?yZVJI&|>#5J3j|=#>5T!7*Wt0j$`2ZRgD} z;eeHVcH;^4bo%!rA4r?42lKvNp)Ib*!Dijh1mf|HN^WLlX+?tMVOIS-M7G5N$*aPe z02z~ojxzl@jLisu56msx1I3@B)1DDd2$bRS^wSN)$Ha> z+b*@jrELJ%J5_8^-Ln2|6=;zWbrt03q&_3um|r!q(V9Pe;mKf_51&eqUJX;J**?qG za8cu}=9K@gYu^-!bW!b2uWe-ASY)Z!K81_>Vj1Cqh6=kItoiFMn2-2|*{0{zgp3m^`*R7m~A_e@ir=Y!@iY<>aTY?rPN4l0TFPaB2HDB~!VOWe( z6Vq08%PO1a79S;3rw*5t*Y%J95+s{fdJPD+R<%QH{5a#Vo!9ISv#*JZ`!6J@ao*D& z`FbY3L&Dt9r9#}$#q3~(p}Pa|cOgufEdocuJWK!_(AN}@ooJY04g-M2Tu+h%>TXL= z_%IRK*XACzcatU<6~(OoB-TX)PH(J4PAlj~OZv#h2=N+EWi?!OzE1MJp0Pyusdag? zGriWMKSi+WuG$|?+J4Ww+;jlqM$xc{nv~3DwOn9^3kge^TdvF&mm3uLpqOZH7nW7l zi*A%POwI_itu&2Xw7ykNLtkj(WBbAjKWnru6Fwbou1GEMnWg7P9oIW5TUIAubgWjY zTsQupFhY*m62`X`-dc8kkUlJ>8IlCq*~ZbfH`XSNxPpxUoheqTv_XUvm>_z}U_>GF zW;K-*+0M(iN5Zn@HQIysbq~KM68KO8H5E8SqzJlNVh2ldGclDS`Ivz_d_Sdtc|Ot{ z2;s0tFri?SKT5am1byHf!Ur{b-xH)2%$&rA-H|Etbtcw_O-R*G4b@$HU;fePVcCID zJXGN{@!e^`+F8Y#OL=VD=`}h^cm>GVJVvPD5noYR_;b#B-}^aH^C3Rx=k%J9^@dmB z-$$KDOB^^Wzl6B8Sb-&IZJy^4iWNpfH)5@fc=BttG4!#ha`y3H!nwg`S!b zD9J68SD=%}QGf34+cpl24HvWD49*}2@C@S{82`%Gb^=14uXw&tOpr30D;Nr?lIWs@skMC!b zWMgUhUH$wP75B5(T@5A{XIiZro}e^an+V9^R zc6RhOM9*NR5)%?)C^Le)$1F=rOBrFtg&_rT5`LzBmL;W%iN&ZG_M5B*dm4a|(w}Tl zE3PF9ph=S$P4OLegre`+kay1E;sCTPAcoR@oT)?MD#0=bMxb;jaK#^D($Dh7HU*`_ zb~3mQUDntPQ-6!bRJlpl5F^9JNw5B4UEc7!Old_Ji5LB5UO{H1qG@B)OFGN*LDl`^ z`H(k*-*flR=I3A8_s=^1)YW5UM) zRePGpw;82GvJfNTj}0>9cJxU2Zi^G8LKG6#KydotE0WQE|tn+4|XEz_llWm;~ne z31VKaK`NBjfMF4{TWM&NtT=}gUAY)Y805$Z2B`y&PzKC)-ixu>FTE7#H(TrWvSPV< zhf&iP%cXiSMC@c~vDx%R!ZMtYUQ~LAT0xtIt&1TT4Ml1H?140UjxDLuY+LlY%O_fC zSkf|g-t=tZ{dn5lK4j>8%IkPJDQmR)%QfEH=lJYu+)$xfN4ZW__37sAsRw|;3iq%z z>|ci~1kfQToAN#8r3Yp=|906?Y$PW0fu^efjnFZ1S%wS>TGp~T_3^OB@tr<|W)xz` zeE<@(_>@e6~ctNDgu}>%T+sDFR#(y0?X$ZUtvm$6GPI-JUVrU!uM1i?gz{ z{{eXxS1Q5YpS>_YFJhwmV=eJRW7WX?^fSYqk=^YOA|r;*O)+#J>!CqdK<){iuwD5y zg73?>NkVyD!NJPCz^_P1Qb8JAD|Ko6hzZm?H#Pcx;#!^b{X98}QX|L{ICNb{Z!Rtn zekR59RfG8RAZ>19(byU^_#D7YecG-D4g+(j050M|9)~;oN6D{$CA`3B;G{h}BheCa z^_NfGE2`diFcPvD9OBx55CceNfEsK_K9TgXIyvc~YvOhU2ujfppJ$M58hGCuiuvvu zt{6kG&ix$L6kyM!0l}EV@1P3^w5#uc3o7@P({^A=JF;du%@}0SSY(ZzPL=Eq*Q)Jg3KjkuK;mWwepE`J77IxK@5~{>7ewTJ zms0_BLRHr9pw7Up)cz1?I8K(3%G+E5*-g;bb*vH=POXn}zjFlN%Zine>-|dcLv<*7 z#(>Z8TO`ykz$mcwckg=)$+W!e^6*e33U9C`$A_G{QD!d$F+;sZ`$p|Fudt-c`hAM7B=Q~-36pXKB{ z%zn)=BqFdfHj~j4$u#|eT{fp62L_OpWUd@z@EoEOTCNiL7TgP21kCtVNoAl$$wt9yKccl+*7#L@#Qys2FE@}ab zW}0VCGGu*RD>uQQoO2-tlVof`A=I@g1++Pd-{d~Fa(7jRA{yi(sH638`cD*boK?*% zV3*w57%w1^xyn+Cz4<8|)l!7qH>N5AZ+Ugx@M zusa`8hkD7v&W`9w^;ZLPTioLIPK-J=1mt`q!Kv{Hdy58!d%*eHt1&HjK5}9U&E~cf z17l*gHv1{sNvbbDpMSO!2{4$8Dk3W*Fpz)OD}<5njZPSu|2BjjOLi?H#(6pCCRpGU zu1joz@Bf1GMoyc%>hgB3Bbg*m2%!cQcu25^XB5WxvM5N$$4^`E`&58Ot_!bnBT2c>I4icn6^ z)h7Z#8_{ub;L$TNpfj*>VeOk1>+gnt_wVbLxP-Xmoh-5@E-0?zFKA;Y_28wva;guh z%!-Msyoh<2tPD{U4QhOtg#Qy2ve@_#lhmjvVs9Q)l*9&YEF;R=5Wvd%Lv)^Uj#93+VK;ZD|0e4^XbQ=N~p*89bw-74`Mw4;QqEP1RKesG6^1C16dT=rI?L6&Qlr;G3zpDuHh zYfm$xjoW>Zjb44h4?QpUBt%wk!)%rtV0*id{&z&drYlw(wZ8$`)`&OjgP!BneNJcV z7#q7;p05_h)l=`#vsQl_dBy7HoFFzyB(b`kzthtMZao_+s3{p4_SEgP)O^oeIpjQF z?FhDGJ{#?Bi6gEG1BWWN3j$wQAo=~{htluN+}5JSQgibPqaZaU^n<3p!|ory7kaF7 znTPX7zm=7i=P^G?0jl>k91)flAiBnawjR?`vDMJ_`Z#a$d7^UZ#e}&^kY<0>kb8bJ zv;_U5*!HvDIiTLz0qEf1WJ@o$#s~f>QL+7N7(uXQdU+mwb}^~8@`CX60_NzvA*++` z^pq&%hzJ`V2OC{D_4{GavM4`f0m3ZYv8c4=^(q-}93KK#f&T1|D#uy=s?b^SVJ@Estnk?|eK|3i-K!cL@6<}`7z#Sd_;tFu z+#xHM1HZHwEKuY1Dp;;2L-Czp`{M)qJ z8gad$6ufH@t}*N#XI29qoEuq3C?dKHbkPXN%Kb~q1pBNf~hvl)a>?uaWu!gY_fZJAvcX*#ID%Wih>A` zEjTIv{vpmBMNhDQ8m{r#73?e?q1pqy_8bCyglyW z^x$xC`*UONRopy9t)qRfyvvm=Pq%anv;7pMp%N>0hr0}~U7iZf;(fOJw4w7D?6JPM zV!8ojv8!hhOhvN(nyTC3zL6A%!oM9K5uWnv!aDpyoq=957IhprJm$R0#7Lc&{dY!|AK z^-cD92J$K&VZ4I|Lu1LzG1BrZnE&LUkv?i)9XFcfA$%((dPQu*K3rQd|Z#6kizSlUaJ6o8p5vDgf z1?2Fpl5Af1o*XQ9L_6ipGzGH__ZiP}h-xN~eC4XUyNksvlS>O7v@LEn1*B)a%@2Q{ z57;v+*hy|+LSInDxu&lrUXuk}RC<%sEV~79^t1V?eT2_aNPC38r!HNa^BL?Q!WySM zyJs;`231!M{9$$EW!nSaRLYF=XzXSyXEZ{+rr)L%r0L%M0vw zMRcEzxS{}@89tW{Y7ax(f0xEN%YpA7Y@S(C5+cSY6G)#o)kX&sXj|TCW~Yp+Kz5TIpG_4JY75rN^YB%I^k^^>3md z;QfLxks;lxBi}{ABOwogQLhHKE7B72Nnh*S!{G+NyT)pR{e%WFpvX&Ph!_VH+(dL=r+<(mQ67U2^Z zzG}cJpUWKgA?e9@{zXfR{0Pzjf_Y1B(r`hXZ+Uztg#^O7uwXHF!MLJhx>SyO+F&Hr z(h!rjmd7O2dtrivT^k=A5$rl1$Jtxl&vs%_mv`~ki*qav`R5)Ft7gKXYQ8y0Nf66Q zu)e*K1TB}28<4}Bw*`S5Jn@BH0#+Py0Xo=pi0AyMwM-wWQ*|l*(H+)@ApOw30;O@P zoqt+Z>S(3C1hq7;zV=ExO?sGbfi~$H092rV8G__GHJ`;ve6>0%03p?uuy$Av#8ng)=GIrlOZ?rX~ zx2~Gi9F7O3=&BqvPpg(Nw`#rMvFVCTAjmT0aUn>;CWUzi)~S-qkvAfit(16imN>xBo9aVnI;ordJDk zKwK8P7AE-ZFUnOxyi^@@@KAy_a?Q}Cl~P%3Vvo@nq*oFbAI53rf$le-#uAorP|;BV zj%7iuOQeaaenq=%Vo^7&;Tm*u>hVIeU&Q!T=4zH<&V^nlOQ zGZzi)ve8qCG&Htxz?_Yo1QSTsoV#NAI(`lo6t?r3lShv%NiBJj_tQIbYHu4MrXN2R ze6TgkOlkgL1EP3+p(fdAYtH#cAUCmrPA=ogqAE0 zJIf6~Tx|jMC}D&MxP@Bv<#DI5s=vlosAvkQ~4sbatNWz9S zN2qSc+1>n2=-jNlwx)Lev@k(jq@TWy{<GFE<)W4Ww1XxxU zzfX&I?v3aX$AO3ey6sn26yb@X#K7E90wkFy+waxte=^yWkr+~#8b=q%O*;D1K_-wP zx!QXT`Mr>ML-^iAXSmy-lr+gmoXi`VJ{x0>@yL6Cz=Q^ z_7s8^yqxr`(X|(Cf4dp0(d`R*+N0vf(SBWB+Ts7${T!U~{>mC`=z9(#Z=?nyHS~NcCLac}*qE%`139_FG^--{^Wk~nWO)rl^Dd?J7{Ims zS4>t_9o&hQj9^!-vrZE^F|XCq#^upvBP*1re0$RhuKTEmQ{bJowMMCT#yL+Q}?8vVQe6vyqz>(~l#>xxOtd!p}d zZOVhQBl)}K>TEx!V%h=_S??j&5mO!yjBgThQeqSJh>7_Iy7BnJ1zSSsMiTb4N!=lc zH~Sp{g)W@84kYr;EFrg66$yZbxgQ|nTxf0Yc@aW6#qrrPvH~E7cjP77RRb%P8-i*9 zN+JReumO6aUZH;(arVW{pT`9^R273jFaT8*`V6(uVtEuE8)Wfq`j>PXxtRMxwHv=5 za_YG+5y!$uCi;oj#MK^xZu_F#5cBR_?1m#o7PR*s5=(_MR-tI|-5}SQ6;64xTDH z0+DWXBg`tUopP*aKHYBr6BDM#!|TUETLi~Y3fIN_Z)eMU#FBXC2u@LPdDIGsLzA%@ zXAP6^%K~GY4UgwEQ!2J;Q9jx@z7_bAbo1EX=_9vTt zZTvLYo`=DU<=IAr*`RKH9UXz4ngu9t&GDIR?G$^SDZa1Fzzbh0J|T_Re0A7m!M0H%Yx*R|pUw1ki}X7>fM5DjdTRPI zt6*k*Bm&6J2#eFEOaZpo32IwTSD5d6t#xIf3ZiWEC4MdbGX~0y@LMm${ypAWH5va> zPL7Fw9aWtDCqCRz)Mc2Uf>^na)1NjV{F5Zna20VADwv?wE7?jiT9ld#;u<<>w@d3V z9I~-RpI4v=7}lyh-<&)jE0kT99#q_W#n}tsap?=DX7aYFj0e`|=jW4YdEWmH<^Mps z)T!EdN9cUpXBd+4x`}@}xAw-{d^=!=c@}sn7)tKEqY&U5MW)}$5KuAkZ;Vod#w94* zIS8!N!#@N@gtO3hlJTuR;~(Z3kJUC`yv;>r;9S#a^h7o)mgxVQxk_w6ay?XTLcK2l{^_ab;#nSWb{%vHB zpnsX-T1CCGYA|TPxxdc6Y@maecIQn_U;nzpd1$|GNRCfB%|Tj20cQ0=q|#$ z+>xG(8?U`Q7GD05*w9bey|MAh$K&BAo`~D$Rpn1v8jrUPAp~8^WBy51+cR#7r;-S@ zv|)P_A?UAcdwXTu%p2l?HLK%}3&zCADc8lyo+dW;_QkVL+!3>@@)H(+FqS{l9-X=F z8XKlp=f+*KBKiha#rcQDVSLQH`fuX>w_X*qM_1n`UKMM04c>G)q>&dfy&*|g2qeyu zD1@X7$lokXB-tn+B?;7d1$;LQA{lv88x9eChp_Dr_UG`8v;0yF?1w}R(Ufs~j?Dfg zCHp}gq|^6IWO=raO_IND=@~F4j32gpJq%A}FH4kSV3;X~+ZZbezvjtgzdN3kqYq85 zvDb^ddS^p<1NNQ%h)nvW2$a{|G{Jb#SNqTBY(owU(f9Is2$4mM&zbBM2FFHW0fdB3 zNFiw7-WM+&Is|FQ-o1NS6lT|uoD#-fue!dtR3IuGaD8ILVFB}R@}9Lw6DjEkysr!0OlI#NA|z=j8|k9jjr ziBZ&d81v$REkg)F&#JiO6v*>k@kAq~x3ZzFi4as}7FK0wTbwj*Q9RsMW3$NR%kPB^ zJNNF1HJ6R6Y`8Sm^skN!s(fQEUKRcP_rw0@W7U;-BJ*R}&QBNuk{CHUd(JakU-xY6 z8q%s20-$HW(Vax)`-niUgZd?gQVf8fOV1#a8+jx&K%N|The$a}>X~GH4MpA}Dlz*a zIZ@WB&`}R*dK=WO-L?g&&*u$tm}u?#Er9WL{OBuvqCJHbG+j5KZs543&`PuIr9wdf z*h{@bc?Z~LJ*5cHo@*r7%~6j)H1!C|>kLTuvtA(M&9Uyyq2^Ht%WzO(YbgxmQw$V= z%7z!Y7f(zfXzSd;LNTPx>>VM9H{X0Se)OXsAr6Lr;v3)iMoTCPtO+0lh=QI1yNGD( z=!9TJEE>biR}$`zWtR++@S~9GVRBr>xkTKnC!!wG2?_lD)VhZxQL4Gxb$8{UF0!2ttEX7A# zOOP({I$nBFd~PZRdB&`WQodYBE`d#oN8WjZoeFG5=^ZEtrSNC5*B;w&22VcPD@A}j zrA-{Er*7sCtfyQkHl3&PxerfRA=t8QaEA}uL0K1o$RU1-ycyXG(=%K&<~((>eUvt6 ztECW}JSUc3dqZ4%U49}Gd;i*gGJ-6H+ zPjAbip+DHL@VdW=_uaTSPQ?qDcTa5G_Ao*a({9)rdk^0jFUIDZjtIe?LD#(`8A(pU zQWQWDvz8=EAuvp29n@QT1|ETBA+g#pQArXak%h!&x@iDAXrKCP7m=N*JL{%TDPHZ9A+};go$F^8ZGF@fk-JNl%Gci{2NHbqp>RH`f~I01@pX3fTCQpjqTQZh9psVt^20{?wF;nkC4~>3y$ne6PjXCC z$eg{Gf19YCX%V>#o3u@Dhji)^j^Q7|XNLu^+kOK2L>?cqvJ7C1X#?{2{X`HsHen$7`+D=ca`xG!^>Tic}*G9&f zG;O25w8@e394j(@Eu(nP5;ONt0?Uw29XXw&j<)H!Kjf{%;dr^f+dF$>_S?>n z(@#G;9(ioVF=?Y#2zvSkxVR8HWX(<=LO7ZHIp-Ep(&KyI`(FI;hd<;wg81%tze^hD zN^u|^QK3G=O|(Uue?$j{ftq{sK~x`Gw;3n~q(LC%Uk3t14dn4A<|sia1d0LRTqbou z`BDt>zI7Tn^u-AUrKi?x{9A6O; zhHhvFf>#XqOr5kL^hCTC{_`36vrtI(b?q5~DMcW|x*RWGU&-3Qb9);f(0ntC{R~) zcX#U{&=zeTrSZdH*5XVJ@~9I6zdMWN2K8oxL?nF$!oBhmSr&rq8R+Kc8GfA*i0m0y zPLf0bJZ3TAvs+q^MhHspAd7)FK4j!f9ec1ZKR2LPq!`#Y?NbmkIZM!GS;vPXeKu}h zhNTQKQNPbKvCS5Y7e3PLm*4Z}sWMVm)${IEB00Al2Z zR0L{;065FcaooIJRAS}4Gf>G(5pV`A`EWx+bdZy?dkC_X7+5Zgh^X@pAe2%J%5{PS zh-64HkTmF*eRNS**hgovK${c-XYcgC6ob4Q$uR=-8IV@@ZX-P|?8<*|Lz>8;BHJ_6 z)JhEWfM_d^pJI?_-6c%Ve?Cv0&BA;>p-ugnyba@Ifzd0e6M?)AlxO^|1Le>XD8oNl z1Vrv*PUkONkJtNsYeyp%E?kNT#KR9S=MSZhu@H3cjDhDqt{1@W9v&R?X<$j8GjqVL`&sAr~xN(c)(e5g(uQTqP zJt9V)JT^`l3ns_>dpo0NXD;_#bUt-wTs(7fOrA0&X3TqUJhCmXLkz^G`!9^KW2v)c z{)D};dF9iwx%dBb@Y!NI;evQ*`yW@HKhbvKx6T{zdl@2vj3iUa8WJ(?&QU_ii=M{K zfwA>025E-hR0wFFvaUUp9z}^vyp*XE0|l(vAK&En%agANF+hm4gB|X72Tk8mgst== zdq0f7f|VE6L0&h=LZBFM-v3h2I}nVIVxT7g-07v5l-_~cH|vBTJ&jD;w3`;!n+t*I zekQMLO4^#kebnt(XMu5jLc-7F541ti&>K)FoXNY!VZEHUo-6{Q6akUX4LpDFxD|nQ zn>ym0b1sTgPn{j>*Kdu#|Lni8K6q?}prflV4t(N8*8zBc5IcQJ0pLxf0Iz^;p(RM? zysw{75J)3zgm*w2v_+fsM)q~Y-!54g*MIoFIB)6^(%!KlZa8yp+_8Cx1?Ju@aqC&9 z#?nW7DuLJ?AG>pYoVH|nZ0kQFE}bjl$~m)R`ef>Cl|P~Tskn01LJ0i7RS5X!F>XQ# z0-}Fr?WU6aGxC4xLI#o+aEC{ZkwYHd*pyKW6a0plyNTdv$*$~Y;2?x0cRgyjJ3 z`B#`O#(K_0X1Bv8kk(WP1bx-sa`#n9{28Vzuvt{Smh_`sxFvsX$M3dTwyg-1gzoj# zwlc5n<}x|WviaPB<2WR=esgD>amINubLQOW>)#WvzW$kGzgX;crI%lM1rhKmVxBVg zb<&yq^M4MoRsi@6NayXPe2k(`HNJoF{4btcj(kErmpNxGa|U@O^izzWLl(^gr&2d5X)B`2hm7IqqCKJI0O}9kVWaU##BtSX?mc z^0@7)IWgt5D`R>0?s)2sOXAEaV|a~4j2bs9-f`Ea*j|<0zV3suboTU^GI?T5nR{ET zsmdw@-CG`rORBA5H?8Q1lk_TgB-+%5K|CQ=Y41$OJ6#^momrxKO zAPLJwVhBk$j=Jo5J;R7xQcF ztrG%4Ion|zb10@H{_?xT?RR$waZU4X9|boHfHU~goAa8O*LreDs9a38&Q>A-Xjkz% z{zF3Y@s7Cm+FRn_ONiHNf4c3XZ5<7~0CxZ}i}$5-khlT>>H9}BfY(q6zT-tG3r6`=lVa=1`WU{$?@!x>slC z*+1js)5v_zVxf1D#LK!Apr%5=(QBAPMT%#$5K*}s%W==Mc+Z#53IOtDAxPIouPu8O zp5vI-9F8s|R3idaoi81?BH;GXfBnK2T@(1z3Bi_a-4Hl4_Wb_=9ODN+_yJ^&7(n>` z(-^O!0PGgx=s%lr9uZ)RDKD%;0Q_?sJpw9WJ%1Jv?Lzu>WK%IoE1wRZA2s0*))H53n3VHUVOOIZCsUrthh5S zojW5YoIEl{@s#jLo?iZFTr}yt_)rJ=Qhz4Rjzw=9AE)2AF1C}_*BuXDIV&d3d`H~) zp=V=jZ_STl-=GNS4Hy;z<(h!!MLy5WwR{b7j%fpD>JV^#0u~Z-rl}YR((>%Sl^7^I zz_o@tApp5N`6TNs20#(W-a*|KQ^_lb3HWSy$Ui-oZ1b}Q5;`_JTh}(nN9$j6_`p6W22EkVEn6^Xmaf(xrD+hKCgF zOyD_h_7cjx*6;Un(HPW+gidVK3c=>~E{L8PyCOg+$WTvw>s#N7-~8q`@tyB{2cdw- z^M4cb8Bc+8r!(^Koi>kJ2t=dfp?Lem1%`EM(Yf;Km@(%Av99y+ zn0L}&#puI}%qI>0FTj*b;*qW<`TJT3L5}nHJRMg|n;J{*Umsf=73p^_i}S|MM+jm8 zLZDz+&&iWw(R(h7nN(csVbLm7W3LvlvKRb?`kyL#-J!dDejQO}CepVIn^_d)A=bY2wyL z%Ns(G)SacoF?CyRM)pXuxaBRTd8ZE7kE5RrA5pjeA#A^?kFrC- z5R>CbIX!_=2=ZdDD4$7CBuJBtORvoH<^`FoOVRck*HECdQc@p=hv zPRQRsoX>wRNyx|lDu%>))&MVookG9-epFce=ystBQ>g#NsUvw>x3n!ct_p}ZC zXCdf*GA^EUM*Q{12(9dh6}QieF(*|XL1#zYF?VWQ^r6A}dYGAYT6T9lb=%o7ebEE4 zv8y9iuk9gx6x|!{inAsx$^vCb2tvrS{I`rUzk&dvW-`uVz&Ri>`!JQ>M4H)_4?sD? z|6@Iarb3WIMdZ<=5t5iBt}uvF2+UW;m`O9d;_P3N&fbCN93P*H;5&6#C+$!l(A&ss zC4Qz(MJIbW#{JzHL>rm>{j69UDsn8`6yR3i5?PEC0cX%alFuR_se3fP!l4M|vWkFq zaW0DhG=jdntgeL#tJzj!hfVY4ckQN&^ZbU3-leXXD8o|fnJ!e-l=E+lI`m||r z+PT-n{Tp`|WuA+z4__X0&Nw4x&YTmM-2POw^);`vWq#4OJwCK}Qk*p5l6bVO5Q6@l zvF7%LF`fS$IB7!6x%}2xdgkDwcIVoAW67CQV)DfCG1tdstOLI)aj6oLVz zC8ZKblNu_)i4#Q;Q9-KKG_BDPp@E9{`>yU=Klxmod-_snY2XYt@Ac-sdtP4p*1CJ` zz1L|JiiseAcFY%A=M0qa8s-K@aZqFvGYIyD0_D3d{U zuJGJ2w|SU0?gmg@p32|XK< z&>|6FFLD3ilLGr0xB>jLv$Gl8Pft(hN#o<==3|c@J*snR z4q@Kh=H%q0NTSFCf~YlWty*)~Oe{uu1wE^bpqmXq2c8)+{9Vh`>Jm?xzPd>fFpyU@7_cf3qGh!8 z9wC(GU|Q>Zq$0F`>JqfEde)&H-4^R?33&?=V9?Aud=h33aQXA|gl~d183Ke<0h!eC zl!WSi67CXewTgO>jBsW$B%yN>!4E$lPw#(lYr1jc#TMx zTU%R>IHw=AR;^iUk3UMYT@;PG0Ivn~zWaY^*$4nJ5mX=-FaYH#WIAh7ZUCepgKjrb zw3#Y1NxvQwfysct%jbo4gCqmOHH2(Cv`11s&z;NcLJAqw`-2Dp=Q@@?O5Phe-Azph zSvMf?|G~J9Eiv6~#hw%P8S*qa^9iX1u1Fxdh}vN7S&5YAoQ)x6QLy&BKoT`; zvQ`iQ=bl#*8bt8n_Re(s_U&nVdwY((y}jx3<;&Ch`g$|&-n~2R?(RBx?P6Sg@9K1G z>sCFlwQ9{l1Z{Uw(&qZY_hp|p5#)LKGj|=~SPBVHI{{Is3hsm z^l%*iYt@O|K?HmIAJ2FBfcpOa{&eZmrRmC*E7SGs*Qbq*jrr$y?%bJnc6O$NgM%Uq z2d`a@Pj{z#_wLp6=WBg*e-Hr??V@~P3m`kP(8@%RuL~l;m#Ed&$lbD2eDr4Qh3TZB zW>C=p^nPYQW|EnKWug`#5SYPbR*=~M;NpLC%)po(MF1csdhRI7iR*fA1$%T9zRjyVLx|v;Lm{b2(HEFm_H|bT#|%bWM!i0+R}z9OED4z~G+SVc>ZT;*b#%O$4Vm*2d~s5NS>Mm8{_OtAQ};B;AGTZsho1pZzm0dReuGcVxXv?^?G0Kn5> z#9c3romg3W@X5MA=Qjue>jvbhW@bPD#z_WD;QH>FyWk`N8=PgPU@{;IaFdAA&YFp9 z3g2|}c)thUJ9qh(h`9Ur>;g5L92{d!%SL1*buB>MwGekT0m|tL>cTO{vZ(89AUm(9 zfk0fWpOR1=w}fYdySy&%x#udHoiA2>>FEebB1jTg z3H+BPk!cC7=NvN-6FCUQ)`LvFVp3-^uuR0ceVK^p%S1s0O_>PiPG>U!SC0fTLny$@ zyW_e}u1WV2L3=4=;B2RkJDYM5*?Se+PQp9KK?eM85Q(ie>gWFbY%XUIrj^r?ci`Eb z;~E36PqH*A`i?*56p)1K=P#0kdV35&AR!5jE}_+lV8k2ME{g7og~5x6003`i22J8f zchU;3V}d~Q2aF*Atd*PIJM}Y)&SVBAgL+Mm4ATE!6U=Jo>}Li9(oODxoJ8PAVsLwD zN+n53w3hnS#q~ZHeTVEY3OW0C(&jx3k!1^LQ`#YH`)rWSV-$yTzW}%0 zTGoQJ@{S)#$UCRC_Za98jwzdo`GO${4I;R3QI-i$`2rL`6tMP)06%;?RQkN`(3ywI zeEpP+04?rflL!g`0Xc(s9e2$DiKs&Qc~>eT=w@o|fvjD?98Kv4G9Wq~M9o?P=O+k3 zYW2wPZD}WGE0{#Ke8vViw%o38`y?bmc2Lhv0-CTU$bg!zo*c7m#yJE9W_JOlZAb1A zoVMCXbSVkZftIePIF=?MS<94Q zoThZNv|j&h)XZ zs(U2hu*RKW#1@zpd`3AaWpaQ+$B`UbB}?gSp*NYX}x9^V`DjNrbi4SxG?Rae7OopAOQ!! zT)@b16CejLk{tl*3H*df1+eAV()4kyVW}vfU`aqY6bP&WIz!Zd5o-vVKd|tNTI;gKK$AG>S<}N?`|hD z0?tWk2Lj0fvn=AKC3Ftt<%|JEV#`^c3m`n`=gH(GEx+GZ3n`)F`ny~(m(f84BO5?= zs4tO$lprGj(Af464V`vIBp#wi1Y`sNa1uevM|EDxL@DhUv>~Jx835)SU&;z9QYNz0 zL{`zu418@em?Q&(5@8ZRe(*3AU~Ld${{TK82IO+qz*!BQQqBx=F92IPcpm_|g?Nwr zAFB0CASNwHAPBCxhl8^o%RxyJe(vdK3d%93Kn4Rzz_K6zgvT6fM{k004mQj0OzHSq5@&|Zm6IZKoJ?hWq^$O01}+rIW47B z_--8;#_x@5=60R#cEY0Cwe#cBYeOC_^_mm&mDA43R` zfs57()?Oq7vI9DdQrCBOKqxanhOxwCB1jiit_zu>qvxhJWCM#tz;kr=1fcqRvIf61 zvQ(Pj(Pe`tkk>MR+8LF*=LGY5JwR_j2P7#bXO@%M0BciE=nRgz#^9|)`7BLf{;Vwt z@qY8J->#!QNyz4Q`MJH;j9?JK(a9VSiT}+b{5r>vhsQ(>lKmUM{1*=%K6xHL{mssu zHYIulaRC3i$!<{aaMeXQL`393?)BL0rYavM@jyjE1mWQZ^C3F(?@kX>#hWDM%YE^y zd7hc+o_Ro;k^@mb`(~BC{3@!VSp8}hDwoU3B455>r=|0SqR17`77AZjHZL;y>cVM- zr3IyO<%MjCoj8)2qDU9mv9u;HiqJm=DPLxpoSBc8aZI87ydS0Q-F^Dx+S%iFFC1h0 zkweUrb}vGqXq+Ok1nmUFJQv3hGUMpm+78mj)-J7WY?FWe69o*vTHB)4wM`KaEB+13 zx4O=LSy{7izG~vuO-|&--geD8*mpp3A{M!9><6Epe*U;hAAJE@-`uhL!7=uXJe%8} z%{lhCMLxf~ZUAv;^%%cT1;~lDur46Z^!v>mfpMG*oUhPNACwO;59^wJ1aS@4PB28l z{fNNr9X?=tA+##S!Uu7lgX3r{p)eQwLVjE`?l1HiQNDjd(L)MH<17|Wa?HWuF&`f$ zPAHy8Q6ib4#7V~dePk(_%2DhnNs)si#Mp5-N~SqJg#P0+pr2z>S^TJAfpf!28votp z(GNTaYoHI(rth>+0sb3B9;~0jSgt4^OyKvZ&UhSS2?K5Bl>Zw=EAM6TFV>z@xhhZ8 zh|iia`5?h1Rq#HK8Am?(Mmk_7F8oP$uJ9blpd%C@QpxQmu=?)&?k=@tfi5}ol)E^sE ze}X1GLZeAfjc3t(rbe^HnynXlZnecrn_8?xt#*fA*ekU=(53ckmpZE3qgU1QsLT4) z^MuzQP=7GA2E)<6HXMyh5>si%6B@CxnKJ^Dd%$ap9`#JCu#dj853k=h`Efju zbqwvpnwrn^JfjaLhxh;Vmiw?44CMB}HR`ose+qlXyd{`7GSDJ!Jl5OCxlM*JT%uzN z*Nm8ni3N$rehh70BN&108ynNvjArvW&EMXvH|sAK#?UU|__;eKdB)h=bV{??9NaZ@ zO)=LNdGuV#y3^@Q**VC8^T}k2>#*y%xhG~E`_SuDn1{WgUrA1ZG33=)$*bcMi!pHX zU_G?D24Ie``$Q{o)8&0>F1gQ#n5Q%b^l^oK>KM-TF^Kj*asP(#_}5y{?SY3nVQWUm z&|1=l4!oLr1E&7K3rJnk8ijhLwF`AjYZ~es>Rg>QQ2%T#L|wdRsFzCWXpKFfzM{?= zTz3WPv2g1&>b5=+ytf~417F|P=;luDjKA4CqwU0TAc+3|PwftI02>3DN%B9eFX*1F zQF>TEWZ(QyN4BJHwd_`vEOJi%1;Ti}<8tL1@G{P~=``P7USDs!m*Mt9p9NmbyK@mhsO^-E?~y2K)*A7TEm`>wXl7e)z*LaS_Kj zors0|WiET>Lk#8E)L{emhhv+=+;FmnlZ7V9S^Hfe_+{OZ&Gz-!87QNM#PJ|zNjh}@aam-J7(1mVw@3&;gbJ4p_yCt)XXLUNKm zq$NpGQjfjl$pQehW4A&Gc9u12F`!haBw>I60Z7;Jt2tr+R1C%@C;(s2#NZ{wfd0o$ z478^NjHO@w3F@XM1`-sIoC`>(l9&WZ9q$@@p$Gu`Q38Ec;vy-NOXiV%tT*n4w;U^T zFQI@?I?s$J$yN7;Qel0STDJG zpXdcef)|pa?IKB+Tmk*gUILWR{Ti^{F9_!#7>|5W1h~(*=r8eVn>%*%n9^sZ4Zc!P z+_@8%^Y=@p6j4iZnRh`>krT!O6dwGVFA4-lB-@w3N+B3e=i7R0ASq9Ndf(6A-U18R zpTWfvu+Uhfz+LX*Yc^r2e-P&IS{~&L>~bZo1rQbexCZpY_AovcisN8M8-0hxzqZt^ z7lQR)2*$BL9`87g6Ce)iOEGX<+7$!liQT9WEZ6wU-8(*q#l}+LM=)PwaPETV0r06` z{iSbguRniEaJ+NwAvs~2UwM@D5ovF~N8gW+hEJeS*p9DkH^0ay@`{`@CXW`$C!s&a zryYCi1ir{a=jE8dqb%AT>q|U&7#(JBTdAzOM~3qTFOUhvO+iJ3(VBx%NUY@u)B$3{SGDF*K92cQ@f z2vNYs7>G$*!M#39U%cC%^o4a^OOn|yM8jjIlH|3?wj@Vv%{5B%5&z^F&xm}K1Rd8M zKQJaCIb&mg#&vA`FqZ!Mc--75KuN;si+Tmeaqz{p_xh#3&jC9HPv81yOmdvOHa^;z z&opnGwF$vD0kZbYzu5Il`U#Sg#FTU!d9#z}xMTj!|G6zbAVEo9ih+Qr@I{-)77!e5 zJ#kB*?2_BJe#j|wLOXkeI5(A076a(x* zep%RG=ua@7WST^tpswG+_aZ?(=*eEWf_n3vwq7K#RRoAbqL!5Hiyi$GoO~|WIBp6IV*=U})Qv5-8D9Yd9Mf*RwF$wu zfMjyVZ&HI?bS{7_-L(RU#=q_vA^-Y#$pwh5Bt|LuOJp8TNbK2G5jlkBP8uRrw5Wps z^&ugPl|o<%o*xkb1&r8zHjZ5%6DbCJ`a=4UG4>Mq^DhIgqrMOWd_5I|@Rh_R8A+NF zx+S0$?x+RtmK|e*7d}JLe;FtkB@oVP_X;2($uIjzPCc+<)zrCTZurvwfcu=?R~0h zSJmFQ4~V)vpt8&>w+> zd`;C6{i2gt?>I_XlQ6aBocALQ5ak=K`1LLLrF;q!8(Kdy!-;Tb@$0X zaQ(D~`};jupTGR-f=0L+^?zMxS|5MpHC{}>x-#Sz(kR-Fc157c2wiR&jkZ_^ub0RO z_PT#r5Og$9Uo?}*y3#b8D4As-khDoWybq16Ekvv&3C)!9#Xv`$+qw0;PUOfwS(lI% z0gjcTs6b_9CBbw@IJG!)=8UX_z;d84oH%iUWrFe&g;S@`u&v~sj2*;` zE?v-dz%m?<-!&6iGg*hwb0{Xiuob7O&B&xRfQU-21A>;3 z7CW``Fk4V@Y&FJrb@h*W3)%HaVh~p&_-sxe^qRHT*;K-pj796NX zqtabld0QvAbmmRRzNpd@Kf1&g4#5Jh+Jl(Ma=j*D>GxJ(@x;Etb-kY6g|g;W*Y6g& zeat+4x)B2MPu@4vm-3^lF|I57;xKB169SWO`qc3Gs~Fm42wpx~jyOlmwRHv(20}v6 ztP#D)&6TS`;fYW1@zFv=Sw{k~_)YMdmc&9F%@nfj5Gosu$AbDkI#PhDcpTLwX?S)} zcZ_vHP)?uyEr{KUs67{=C^-JHt1lmwE}eqFcGwU3m-)=qH@Uu|@d_MC2*Iur*Vf79 zNOjNZ)vN~m)GXTKbJQr9-!VVSg{MVi#*Id3Hj*V8UMCo$yrF!i@w13guyrtBW$a=t zo`;TTm9J+I+=~g?O5n8cP<`WhFikT-q{M#2ts6CZs-|fBdxw2k@ z&)I)&CaBJQeZRa?e(t`gzy9^F_`@ImKoMZR@>nkToSB&!Tu-s6BQeF}Y=dpJF9dFs zJ#zA3^qct^N|fG^gY~0(;GwBQtPpT?!XJ!&aBXw;J0Q@@MMNI;GxWJ}Oi3`ksd z+N4=bdwEbG1bfQs&{T5{uckhLLCephIUxihUw*eDVUeza z_^g}IVli0;8gW`ziRutZsXmgC@{JhS>n*8j^lFJ!zB4p-LoZN5j(-(lNBk}W!hrdK(Kh!eW+fh$^FA~UtlEw zN;iE7ETsEEkexyhjo0G*`3nJQA3AghMMXsr@wf8Fcl~;RpSmxMyEgv)?|;Xye)TK5 zd;-#E`i&bm2$thDbQdvCps=tFw$-6UFm>}fJl1zIwiPtD302lAjOa5B8`q6*6N2pR znB>Y0Sb7?D*Bfwr2}k`Cu(iMmS2WGlA%bo}ebo^>-`{=ivj~SGj{M^}_+Z`$^ktbI zBe8H>4&u!*oZK)I!@9Y&u6;4~h21D@2uW*fBcJG%Y!sEdzJ>^aMslq!SFmB!1L!kv zKZ;9s-KAI0-NByo@ReLCIlkm^T{z0*mKCj9st^M@t=9R-ME8 znIuc5^BxxBU`1`hx=0+WFW!1TTQ8!Di_h|Q%{VRv*|;#`ro3`#uOkRW#1H012CJA-Z-*=mD|+%=s2c`v2Q) z4g1f3{*yc4VB&MrrX)At;aLVCzKJuhHvpt}F|0j&kP{w<5cmBmGKT zI~`EXx!QyE$qkvwdk)YY92#MGC!;Y39>rVcfgfs7we!uUXEj;4Yj_$c`-SAB=`~=N-WOUJsz(vqumKrhP_` zzPPUwviUerQHOZhp5T5`Upa+Hn@h;Dl&5j1{-^A--I-Kw zAh|~flBnVYa%U(&94Z1#x8%cffAp+teHVtnJc$H}&AO{>JFHLrvGd}UuhFwF1O(4T z*n|X7_oQt^d|}Zwt>L46=Gpf293&D7?khH+=NsxKvZH^wS0#kL6(HA|EQMC{Jgf*@ z?{o>>Um>WdtmX_Kk~T;06aqIj^gsDxh(H|V{`uuEf7u}<3XBO*2q+4&6c|`$TOA8Q z1dY*Scz*C8%w0YieTFQ@iJB(lC4?Zo?gp+^?ZS+1T`+dx7?(C4-!DvTWn8(>BWQ#8 z2`uU7h-t!l9LX=n;TH!f=77d{9`?Qc3?AV~{oytEye=%QeId|Dh<}z?SsLa!;v4m5 zmMj7c3H<2vp;zL>D?{3ZAol3vw4s{>q2e%} zebC*{__avCl#4?QzETLv+k~LslH;h-RtpLum-<4W&zV8Ypek<%rlxeo*!g3Sk}?I` zbEBv(JA`L~cK!ot7cXJo3j>W1NJw~Z{JalyT-$x-??;ilR|Su2%K1Dfct;Tn+&PW- z;?0MG{-)QFlvLCSjSjIHTFE&y=~Mv?mgr+wI(5G zgV<3l>h1j2Q#WD%!S}IfP{JZ8&&AGdpW;B~aeTC7kR#y*$fyWOizOEVZ7fHSbfcAL z@gEO4LR{bo(Ttkg0<@8vLQqowaaT5$wRgZdWY z)iqmjrt~s)On29J9fOy)?RRdqUHHNJ_i(B#2ivC5!Wxcwt2W^6HB0bl_qOMs(MUpQ zLgwP$PH;Eie2vy}NC-44C9wuXr#+1{B4rs%KGyFqSQm=?`YL0mWb)j%C{8RH}o}efzVPtngToP=Bll@LBV->NMi3XRdw; zVPYuDNmdN6SJ@Dk(DhD|zTZMnQdSX=c6xd`{r@C?#sI=yKOMk|1FZt4(Goa&_AJ|A zTVGKKuA(-3Jw~OB#`2qGxZfG@Xo?V62am=7&C7J(u-;mGm7HK{b)7@FmLGdI2_SDd6!oc!O3+`U|?`R zQ`+vQ2VG~^(NLCwH|LH<|HL%c0h3_n|zxW}Rj&GaJ`{1KXv1Q}q=$JlmO zNQi7@l_eX^n{=HUOW~`zgyin=T|%nI2A0EILJGEuWJSb;(sd6K8<8pN5Ogh}G#fXN zz{t06MZ&Hgw(cJ*EUcG#e7@|Py>I_H*%*glr=#jW(&-XPj=cP0%wMns=RW`9?g;_O z)ki~93kr)$=mHXfb72@=IV5o#02XL1SSVev*KqxS1cGg_Ew-ulzZSS%1YblF{6Si; zqds$qBhN9|QrOD;`-YapABt}YH=Af~CIwyzc;`O)@KP1v-Uwv!;S+?;mF z89*0SVW@jnFCUKv+j&?wP-BAhB?Nk2ghZg#%uwNV!IlWbb>b!g@yK-L6Cx-p4!Ty? zYY~{pQDvEL>-GhPur47HFYn8Oixhbu+F!{E0m1K6`67Qk4||P$xel)jgj3=oHqB4vbGZ`aBjKjh7 z!*`>Na3QE~Y(`FQ9toXf&6z&ILNH7I%+nN6rvLu;zvoNRgLMSI``z!D#ynpfm`+h) zeR4OkEw*`wLeLrzTVri5c5hjY1#SeHGHE-CTYt_U<$e3|^rz>DN~B8CjYo5_ZDw!u zp0*u1(HaQ=k2)vu>z%|T>(H$wMEC+f8%QY3DDIl-OezFIM}p9iIEd(z!seU$C{iNt z8`mrF;~72B=c$iT+@jGfArT0y1No+vMvx#iW!I8CAtLu<10s4$VuVPaM?v`_a@&?2 z;o8rk`66DCwuN4|NXSiNMS!1quOw|t{({Q$ek=(qUu~)k%Uc1kB4CBq3Z4--K3kRz z69Kj@@cGG-)AbSofrF?{0Wjb*uZTo3b?Va?GGr8X{P5#@BLv(C?u(1rcD4^^_(%Zk z`T&wS$)6*8fw2G{Szc34ttc>!Q&VLnu&toYJHL?@)RgVRte(z??flX^@>}$yqEOuH zFV6g7uZyVdmIqqoezMu6~JxWig2G3Du#t1z9BQ zgSFH=0kBq-o}VH2kasn+PPS>Ei7m_YPVx^Q@HRBIVBWmvFnI98ShIE`>fPtNDg<2V zDW9 z{l?Gk=@&+mRzGt7iT$@>v7eUUB?{VupO9#%9M47IO6yPv5^Wkc!_B(QHC6~Zb`klc zAC@L`C<26U5wR~M6_Ep-bis?T#bnKnWe zr}5m9u7yV6gaXAPSwb!&9(k`kirkF|SQnI@qhCH$09bc@;yKDfv(H5WM(DZ75>T7g zB}7Pw^iE+b0`|Y!=@M#>TUrD1rw|aQ&z`@#LJ+H|!=;?dvH%z`wgO|B?e)_pt8I-5sO5O{kKHt zj*59S5sC}QEkwv2#PVUjf04J19Vk6a1gtMzFMUy+LYOrWY7wYSk+${mi->tt>_F|S zjI{^^5xYds_LX^ZBl+ZSU59f2SXY*gdhW8a)F;9|J1YX#`jMz5bqTd=y?3Ityb@18 zy)Y1g&70qM-+AlZ6@uzm4X)(p%L?G^9xfcyYG9E*(>RkTIRDe1{)E5$9qe4kKB())HxM!X_KU2jLMmYBm`LPi)Y z%m`aVXb>&}g1J@}h+WkyD@Si~vzCqOXE~*b)cu$M;opzkLCRA()hCyl_CE6OL2X+r zO9H6;5I2u~Q<}aPJrCvS|Jmsh>HxV{3NUHX45X%x#_ru|?wNgg_hSTH>03}xs5k)k z58_N8UjVoUfS^^tX`w!t&U|e@Awggo-A1$y*aq8To40qcsTv0t55wdwmr>JHhYOn? z!$Zq5QSFzDp290*XCpn<8jx9|nUP?AXm?u(^ygsPas>$*-6thklcw^DA?Qyezp?7{ zEdkr6z(2UiLLoyCnc?@h2cQWZr>X(>fOtBAQB zwYHPC6z&`~erOw(25ZGRSz4egEYT^>O9 zevjapZ8?b11(x$8ES>1AjUj`OI^`{#FS{uOwS}MI*-?}6=BYv)TR#)Sd+}Wcy)b&o zE)+I|NA~sS&`93C7gs)C5i5^^g2b9WDuU-Z$@!_S1h+ zO-Dk|G11?#2>5|y-ml0=K5UJg2~D9CDOzH*gf6nOBpqrE@EX=>rbhY!X7(Yu2-s@~ z&n+a^j)>g)?D_l9j7!ifTTv0w3?Po;wdov5TmnGS*NbKdZbKpP zGpz^-0|kMC!l|W-CGc}%`-%#-88Sjo$5R6y$7kh<=y+r=rVV@=2cqqa zhBfLIX&G{CM+D6ErhKRfT=N!=X;rSk?^mOAmSNo@W~N*JycKh;KDMqK3yDa52mXJ; zihvb0wHq#w5`j>c5TR>scL{YEzv~2r^5Ezv7o@GS+^PiSG5EJeAw6z8zkj4V1|;FxBuhp_3NtW%amnEzi^ zgxa#tOt8<>f0n*W$hyEJQ06&F2voL{=G--#u48y8`^C3@9k(*zqoX*5$c z2`gy4R#u7kylh$3t9sgV3Hg?hEErz|gnw6;P^S=Rdx`vlB9gyeIB#DsNtch_RZJ2O z)*8@C;7p-E|M|}Z&zZ(G0vz?T4q6EcI#WV0!Ifysa z{;dv3T%UY|d?VuC01}@%~Ko?&gFbQi%7b z48^>iC4sA_z9x>EDhUb$(~~h`{!SD`i;$HQL2V#JTQOn4T%;S<)HO4ELM|2sdG!Y; z$&y?}((IQdR3ikuUL$qQ@{#*TBSQs8Eis5h6f9*K%|6i|+^!&1-&A+ITTUc#2@!YZ z5)zUNfm~|rvu5e=S?IF}%@Uw>nfM|=5#hODNnSp9!Y6hSpXv^?1hln+L^&+@YytCpRGZ4?p}cAZuR)`0{#+L|$GV*AN7&gfCva$fM4Km(bW3-qT8u7|>dv z7%*+`-n|qHwi&w3M15HXUVGdHbW?|5*yNS?NpaKdH_}*&U5f@GWxyh26y3BANF>~Z z?ZOXcV+8lZ?=}!qR&2ye6Xqa|GmI|nz;okMF=SAGKUj>$`YYHveHfm6_d_fl)e9+I zx}baChcSQ4c~m#a8n~uE1pj;_P)+G1X=!E-NzKj%k{F0weQQ8&1NPsF3)Agv59{aG z3Rjz^QK6k7Bf?NWLWMwLV1=NAk^VO-1lo>+_bDRLfgZmoaYihw0b zk)rjT`@V2ZNfzuYEv>&^?OT!1)L(rko;AR9iGb}t)BTmw9c=$_Ep(40KiF=CpfyAU z1hZ%?R0RC#pLX$>#KD#oTK~OWLY+dO?InJ)Z+}4cByJJ@<;#}?a{uCsFM^fE=gytO z>C>li>eMNmIB|mSBen?APM$o;GQm0ozTD>g`STPBiiZS(ZLlr2$+o}Io0CtTM~!^+ zBmE{;9LtTsBZkENK@nIXtF;CZ$BQBKxy4)!|+68332*_n4BDR5JxsM1Ep}&C~ z>(sT15eWL@$_2sCf^`eo*n_MAD>haL*q@HAfvBK+QTiRl2KfBgzIG4QEGz{yt-oHQ z<&H(*x?M$V$x&iziO%}TMV_`^TULFP7~6bp3}+Vy%1YDspzlk8Rc$0^W(Wz^(hJJ? zeX%YoKfYmOC|1~#?!T05s;J6Xmyjj<7n>KAi zYHBK$En60fx8Hsn8#ivW(6vc1ZuvO8w)!=mvn{sy%?g3g6u4|eoC-FYO|b5KcTxF{ zHR_jNU8F5?B@yTkEMga-vu{=i>~<6^CrDgK-n`E4zA3kbMv^>=2rW4(kmw76+7n_z zyaU&ekW>g_UrPvht)89wFVYh!$=9toi1n!x_S}BoB16K~BZO=kC%014cL7-ORX^+& z6%v0900@Zy&*kcqyH8>wSc^~7OXb4y{r~ER6#**}UY#Adgd_stmVhPpuyp~}C1mry zs!Ql9+m?{tKXU98f}Nl34o3MR_05|%<6GbQ7DkR7iCME|;iZ>e3i8*iS%bIUdJ9{( zZlzdQ=-TA?a3kJ%=bhl3b$z;X*Z*Vh+;-%qq9FREBp(2L8A`+hh$l$q!l+5i179?# zFl)3_*>0?s%t(G@^`LK){z-Lj z5QEE@Y)2kKi|4z{3Xw#Rh$tFEB7$Iev5_b+hR7$71hSB`k%$j833NBonE;Fr{W)X1 zW&n=_gGP0=Nr1p^_Te?OQRi9E(x6Gee_I-9qln@3?A#=QClIuj&UOsHi^#0~2Yi1_ z|7`sqa1E|d#^Y_n?)Zs+AB-Kcghp?pyn#*!1w7B}+r7p>_I+mZGQ6KBULjbVz82qp z_xHzq|%*5Ap&N$9z&TwVD?9QVK zBZf#^VY^5s;)Ta(bfB2{fXPfKBJd2p0TDbf_8K}%hd?ox&IG@ViEv4$LtOC*gtQV zgs8k`pUGh?!X&+v%qPi|tjhrrp6#h$fe5H4$PE4e0QCchmuY*p9W0U+_FRM0Mf1`U z*eoN8-kG+;IK$8|`@;|--B=3pzjLf^wsx5_Pda1BQU$SsF>Q2Mt*nUvGPoT& zPDqJs!q8(70Y;hh+D;Sg%IOY%g6=xndN{>joD>sj#c&WO-6?sQ@xKjrA)K z!B+`n9o+H&L&=P7hc`fGh7A7$Xfnv(q-V09j2LE!ZcN7vzr6s76Jie zGBKmah&No+hZI(`aK%F=5A~=8yzHC?QwhKGf8pw|rV~K&EVg-RZiOL&LaS^led}7$i=J6sj{7niX zL_pBd2DAI|ARD|uSwy(x1Ca$oZy~392KxxXV0G(&B!UBQVdm_YgmV5r{xe-P<2#tzUIF`<(Le+Q zL}@w}1J8Ks4M>;NiyY%YN7IoAEUS2>D$x2kv&4+$8RX@h)-9fwn*=+F0B8)7kd3`z zV;t~oxSvjch)^J{87gwr(ApnSMvu}^L;rVc`AsEf} zeUealMIB_HuE#PDV|pE8zCUcolhcAq^s}1Rk@0SgxO264A?kc?%SSQ9W!T$jh>oOP=wNKtNu4XAcG4uAs6_=sZdf8w{-p42T54 zNCIH^&P*hz(h+8 z0n(g}J%*BNHyi^g&jVR=CV^QJV(fOeRGpjaGzsvG*oLuh!T>z8M+bm|VUj_n9l&!Y zrSz;sK8fHEJgu2IcDvQJ@zUcNlYO%b3lYp-0sA2WW=Ks0qzm#AceaeZfxtxISOK77 zwwts$D~VYu$KNRnZG&cUx%Vw1$Z?5vc)bOudvXt47lyBiz><#}t9b^D$JYk3gS?gv zO`u*xM)9T1?w>s0fLXf<051X=ti6G$aUMVtTJ}jo)n;NO0rp!ax+)0)zSDtYq@vE0 zvj+frGL?6Nl&k#KPgtgisbh@=x{u>FQsfAJXu(^PLS6$XJfC zLlRngAsLV79>>^2uOh~=%i!A+==y>@i!lpm_5jw*y7is=DoEfY0_qRC2I2AP5~RCm zprsXK5Leti{QiQE_mBVJ!`;J*kM}S5?O*)*;V#Ic_aN&Ye~G`@JG1Awj_VHp@2N^9 zwrPnZ7Gehmzzp`mzJs78%CO5eX`A3e%1$MARYdDOdhVRBr@rD*XFx?&dLT_ae06(z zIeq#rzti3Kg1oq_oLxMuoSs9ZgOjuKa)~&7@g;dP~dQvdF(4 zySP}oyu+1&zHGietw}IXXCuj1T}AAp)ADt79(!~NXNBXj%zqz zIj$uvM!FOElyw%D>vimMO}Q6V2loPSt-HZW+>78n*o!jmGwzeke!s#!&To#e6?xou zmUF*u?*zNM!Cs_y`B<%uk7p{RCf2@ zvA2I%**`dX$Ki41;OL}sc>E5YXE;7N8*q9q{5QFPE{J-eehk%?tUc(sxjiRz@f+5XKH{N#aPZgH*rRLn1}mjzhfD4p&`S?q0AmR7dP@=Cuful7rKZM*c= zcFM}eZdu*fD{Gs<)_z&PYkh`)OMsyzJFuj9g8Mf!1^RA!>F ztbWQTYENReLRoBEL_WW-e)GGy&=GJRa>2RSz{TaF#>Irk1Trot7x1?Ykr(-2Mmfi? zuIk0aZoa_LKeMc79AlQr))3#+vp4;u{$Hg}BLCU-%ku1bg|x&>?0JmgkD0I&v%fz* zE6-oNu3SHVRongP*>h~g%<_+wKgaLu7q6(pvD$kYe$-%oWe^X3o#5t7Hz?^p#5t^X zUcN3bUcQN0^6&E)vBh{88~=ASzR^$keqH{2{i6DY4=-N5DKB4t9e%yQSNz8AJKMp_ zS6_p5A=(bgUq$-$o4*Es!4K+KMw>zT*MBWtC14{qXFf@k9Y$M3nXTb}$d zzl(eK|L_O?y(s>E;VFbzK8bPhp-HTo;fgQ$;>*9_i?4nQp$EUIpe>i7Bj^lzgYKX| z=n#5@E~!!I6}p9fsb%OI`i9P-cjzAahYq5L=py=vPNJ9SCi;nvqNnI8`ijn?x9BeV ziw>*F=rcNvUZdLvf=`l}`Cgoe)i_C;5_!vIdTy!AFRqlu?s~aDHdTIkceLF3e5CyR zm-jN|7oXiPpWPdi^7*~-m`Of>m`zSp{B0f5*c=(3u1BH2&hlEBnq4dprsm7o#B3R# zoU7@{nNC?*-;RsC3#8*B_p86%)tG_xHt@SL*XdPe7rK@8tv%XM4`@@%C#Dw|CuP(L zxPf*&2l!sc2aNS+cfJpK!np8hbNis$VGNd8A3OI(C(G!A8O8(DbKLYx|MSt_EIsR~7@RvU0K|Ex<@eu9jO5jeIV_45SkF36W}*?tlQeN z9&Lbp?kS#u_IcpCLzH*oo?Q9xwBVLcI}m^mHxIgkzyre((IN<>K%g)RWo#vCM&3k+)p2%pyshJQnf|kk}g?rmNB1In!jlrc8%^ZX2Ooo5z$!3P`wZn+HvlQVTz$^)+`upHyTK!^zd zkXHeqz)@zfFev0eAU-6PLk933b5KYX4+TVVqOPK7T?CGP6dzHL zXhXj_2uLgNjDx-uWyWGXam)k(z_zOwXU__%=K()K|MAOy6tH2d0rD9)A{l=wdwdOB@jaZ}1Sy`4D}AKox#z z#PB{uKp+r|)#GQ(iV*t{df_)v$FyaLr#`qXB#34fEW~7p1wT0Vd7I8Y47A#(F61pC(yd76V3k*8UPEXD z5m?8*@hh*)GT6w$%Y5wQKmg?Dy6u*bb!|sI?o+PuVEcz_OE6#gcy!>F+d#mJ5`zGc zc4miQA?#TQTcI-#L8Pt$L7~r(N05Lf5D;|epX0DV;Ow3UUSIXs?GpE?4FJ?tWI$2M z^+ge7+=wxLF{T>>z`yy>6h&8_F*|p_)>&u{+#a92p ztsVLSe8iUI**|?UX3iIO+SL{IDWgu_e(~HIAo4a-_RB5DHVD{O(G{-+wA(YlZ|%Ds zMex%1jQ+Mkz%8D<5q!5{|;w}#w5&$DJl%{( zFkrb=0j>lXi*=k)EBM-0s7UAf_<&yog7>U~=+__sHwFR5Wf0)}BE0km3NaWYunT#M z#V=;^emA6d0*;%uHwFOe7y#TRYG0Ns@Ojp6V9n!g_x|0EQpADuO0tNratO^iIeDNW7s|rZBD;LEwi#mepy9Q_8ZYv>7+9Z!Ob?F-nRQT_h+aQ3? zc@LictS62Y`ve(+0Y`AW1_4(=?$76KBT&5j`UPAmIA*thAd5eC@(M{oceV=#0FUM? z^w?KaC2tAkAV8kvuY@uNk|C=PZ47-ckn>#mK@N(J$Gp7Pf76zbpP@<$Rt6vHq#&?+ z`wrk!3Iy!=O-;|%zph;F_R7{)znq+$mebQSkHKk8pPijUa8`D9_xLMT@h@xni$d%G zf2E1-csQ3oh!fFU`~FKi9&l&)%@)Zpag-li6^Me{t_l!J#S5WF_!URDZGEZ z0z#k-bQxDZ*3qthx1VQ%0YDT&x2YQ8cI-C=0aqXjt6+PWa0B`8{W}2iIg;lKVtvoH zT3=J&iuuq_MO&Y|m*}TkePjFVfG>e=#q$#h1VsE0vazzaw^#1mxl;}g56kuSb@}eQ z|0&;o`)&EhKi()> zIywSuQXaxH{z1$xx+xGi`$VLCVcLqJc|Q;gTowGNK;ZU8-co62`jjE23J{{>y8}Nz z1%w!TZvD_su%$5j#Z&u&xCKAy)7f}ipCjX9ER4Z%7=Y+Y;Rjbi&epM+XZ7^MwaD8c z3h?{3e>`8L}38hhl0Q~KfkPwW7)%bp@-RuTCn0X-z7$Jh0ckT#|_hJ-|XcS`eG#^fu063j9Nzab$%dk;7kE(85%B7g%T zSW*A@lf~s17`2ZXpv_tR%*+h_ou_B=4~qQtug0wZKl#_T)Jc|5k z{dI(#LSb1M&L@Q%{X)(*VRFsW<^?x35hS!(90ALwz)i%?**<~K0KG|%*m_Zs9IW(( zAtCKNE}V@=Fl{Bgk9Nmi0$Iqw(RK;ufEX0DPO*%@DP%w)fP0sW@`Y!}fiM3n9?2lH zeAUJcTgPKOY#Ya_H`dSHxDpQ1cPkShrH;BqhY$j7a#P$u%O|+sX!XqMhZ~R`6@>UQ z5`pJFDI_Y6>y-iyj)`NJ=fUU0YnE|*V?7P1>6n7cvy+(P;d9_K<XUZ*44U61yu@o=*q7xTgBtI@Qm98n`tjNq@YzQcV@ z?mPVU+i&>kr=JWGV7=6_9ltLxFSEZv7GHev1&M_=XzR@&ZVJHBQ)Wb@H)Ha-w|sR1 z74gA1l45>)A~<#jBP;5=dk`hjB!*nHEqdClZ+QSt2Mq#?fFMDPU?ayO5L^l1tg{aH zps~XStGc$0K0~ot=?+Xoja7(1_7+T`DK7#h^A)s>8yQoS7OS&+t+Hy=B55Zk00Rc<)B?+*NfF|3r%t#DRSaCNg2xD)s(LX@&(c5!JM4^x5>d!>)#V_QB4+7iGfArLeLh^SM^4hGBkd#0gjZWGT} zZMb&$5Mr*3V$DMW?4zIkBZNXdItcPNWP5(ojtdG6{gbILd0e1l(q{T09e{yTpB@kfSy2>M3( z*I$24VLSF=xQKNkBo^ABt$jf}<=$;1g(c(TNzZI$VW=EO!p`9K2PX|8XdHcnB-Jjm zZ~$}b&(V?3S$`6$C$?WFg2jFmMyl^&1?X^-R1|RKGPI-0f{!8Zu?rh7x6pU{EX;wb z%oK)%{CYT_ufn3r;*7Fz94~6d;PfJFUhw4SNY{rrVc5DM9>JbhFwuwWM-L(FT(fFh zkCebrWPDhGoCJ@D5*U?);zu^PIa78I;ZANMA`Fiw9EmxVXtvK`V!RjSr=!{4BcY1S zTpqBM+5XDPBpzRQ$9q3Vk$ryz6AJV{T^q#hoCL4VAjBkxA8I!L5wL2s7-&;oO}*OwSFYB0XkLU)V*| z+g%v#d4Qs%NTVz`HVrr0=dr%6Kz*hSrOD9ofkr2O1KZl z`YW0JlhEYAIs%%2wSXo;RqA|6K=%gN-WOO|Pm=NV282MUmwo*bfvoNl-J(-$`vSap z7eXw0AETX?uM$%84Pogv2Wg|EK)ip0V*(`jpeBB*nq zCQSiir4w!i^qnO!h{$e*<^BneM=&>shsg?f;@-!=yd75$tLu{w;aKwx4P8O@aRn{} zx?&4v4G&`zPD>Xo!$WwOsp=w1(7!Z*>|oXAVh!3_8}Oic67#NhoC{KA`H#`l-Gaux z=h#&*8)vshcx2=m-a8qnbjP8v&MM)OJ+Hvtgma;XaP)c~#z+KSkUy1w4cE#pB2no! zMHZlEaUP9XA%>pJ(hpExnu)`zZTPu*3{8xqyXlqz&XHLkp|N8aj+wvTxx1sD^TJ3U zdWQ#5ouTxEUqthS0}bgM+Yw}6yMt?``8b>R33|uI(BAMq5|zG)%zLPNYC-=%jSvBb z?EQFfN{uVA8q?eJxR;==ld90|n1X$50^RkssHv|*MQX4C`p;$-FxXyckYQBrBQ$qe zF=!ve$0;V5;;*B=rwf(op)kc>!{G89YSUDCKrFJZRpR!Id?b=&12RYi3edM<`|y|| zC#82`Q$k7vPXS`zun%X=BnyH)%S3cAmpXqT6bUy8NxXeXNFyH|sHsD|6%n1VsFP#% z^&lj?B{>2K35jkWu=jg55OuOn_Xb!_;^7%vo4cPKfZ&0=nFwa)SJg7me=|UPb92*3 z3Uk$vfd3zV{DEJ7`Gp>X0qEa<|Gi&f9}#*L^a4l<^cYAiv_V_@5kYd@BBq|^Ao8dJ z`l&9QkBCBk=Q8Y7ULsi7#&~Ti0t1fY&a?XlP@b%sfm;s^c_lD15$DQVVO!cUNMNk_ z1~T3WN6_EeoJISJ3)RU?{zl<+X&u@pR^W1t;=`o9GRM~Ekj*&G2@A?kF;`$lc9jJ~ z-q4Cp1Y@IhNHrZo;;mtfdx;<}$PH1ze4!IdM*Msmy@lb5 z$a2sywtxw{r?2^PFDA9bFJ*Oo0}GuM$c&HB?k5d(qb&aNlbO3O5wK47KKM!Uex}=_9X%u@q~@0dbaE4K zLEqskHgwNMY)cqTJP9EPj)#jg4#4j~-iipO=a!i$CTMf^P9jiCL;nXq|NOH-4if(P z;fEjg6(I%Y1V{uV1@RQPiio!MCjvK?7y3{T6N9WP$p|x-qGxFfj=vEBR}noiRuLs+ zC#bR$xI4DxKS!YJcMqT-LIG1!B?cDO&{rDcA%f>>mbW&8*1H8b5zM}~&^5gT*R%~y zxASnEWeImN^_g1Z{%Q`@=^-$g;*tN!AchqQSiK?%Wf+lMKy7eHWVc<5ht9k?8+?&sYq zSZ0^dc{$oc1h!U#2*Pt)V4a+mrJ^2BW_SPi;!L0kCodjHVBjg- z?RUa%Z9+~sJ%wv%=(nPwAWGRejk?KYAp+yx>`aC`nsAOJl+y+$kJXmF0xK4S2qFsx zuw;PZ7OWqe{F~NXMRIMB0?lWTKeiAeb!GAB9PDziJsvfj~AtgcKg!<&^wU- z9}zfbjTJsz4$8a$ft9Aj56-J9gFKa z5peIrBI?cr8TF>))v&GZz6B9ja9)9KaB3C0Ep^B@dp&|B7oOBKqrHC+PfE-N7r$fqh{Wv(w!uj8fw~asj2~)#w;ARv+<& zSEOV|VVJs~v2JE3s5^eiP4c}T!>^?EgP50 zD$#85goez;?O3Hpvb&1L49{~7PW~8{u{}}?diQR_gu#<}VsZ}hvEGY7h@4cH3 zFgQ1jI`%i6Kv|symfjB3+^dCkWdXIPO^|Tats9DTgFK!^i+k5YfO(-X#oxokj*+M( ziSR!4nXp_F#0k7Y1bS#lRvqa8uLHIuphc(NPU84N1VR85*7;2ii-(~nq=k^A59|L? zf|#O@S&#FJ2od@c8^_9t0X;OlB&*1vqJVXa8B5>PrHPK5dp$W*Zox#TD7_P)i*)iljn!<}0eaPhZ*CY%%^$wB% z#k+E767{)ZFqto-b>wv-XuISgf?CG{T+SX;<()vJS64#TEwoOocvl(Cz*3#zsWV?h zgPpov#>>C+atF4mvxs3`R4Ojt%tmBTDjwPA;23;@vW#Ph@QyL!#1%Xl;i{lN}6x9&e7I=oyJX0p6#Wf0~J)fIy^tWcBPFP{h(wo`NX$iA+XGc^2(>R{OlzhO;5Z z^GxF|!Ls%W>+`+%AoCrB8MXruom_!|y_F4l+ripHmbS1t#YtJqrXUalxD0kXA>qZ2s)&gXY@RZhoR*9)P z>`!PhlwzfLbc+)5c`YB`r4$0L*Q^QJ^bZlDJ4rE^>Tjxz44Pfov#&p{zv1?HdFP%p zCj|UwDKRoWO;{N&APJm}VYqU1>$m_cuog1BE^-_84=50f!B~vx_+JZs&#&$f-NLwU z_vC4{W2Thz%jaS)Tmxd%|U3thG=|D|xqSx$2$HC-WP=qKdPc}_QNKX1K$cg*Xox!nFzBLHcWSVOFU zbFOjE6x)DnBJJ3Hm*)ZJZssb}NZ2p$!Mo)h#C|Vestca&ko52D-z>29Crmv7c&pP9Es@;rZdQsZ;%y{PA<%Viw@d{?S-`bxx(&cFs_>niU}WJ^29%J>Syc!i0zL}~h94j^ zW{5-*@`uWE%#tD2oxAor>lT%QHtsxbX4uZM83VG(BA}JPGkIrnCRB(4Au)?+79`)L z3WW&qk?44jECd|2hMaMW{C7*_Z%ybT{PSc+7S)^yG}kPa;Ij~zf2gzse9pg1RRn0u zxEymE+wphKH3ss(gDxTZ6twqQ`zghWdx}PWC!vt!?+FweuJiu_5f~VrU=2VE;Cqc$ z3{J+s{@Z`XZMXd*=FPhz{^H(;Vt8!&%nHHa$Xn6ZKcpL|*;SkcK*A@Qi2J0Afc!HM z57q&A#^)6U`WhM<(n4S?#{5?Q&~F_*A(>?t0A!F!)*mG#0C7ufn&=1tmH`AKiKd;! z{kUoXKjaLr3tcj~=CCtpT@19NPsz;LuQPdz%bb=FFedFSaBmJGcLhswiY9Q}EC6}) z7qfqk7Sk6de&g??;AVG9&fAmkDFPOaQ9Md$U6iDoYco4TFI_^sJMZS-JG;BM4w9AO z-y;i|psj-9WT7eq3Xr1bb>MTl3Q5b-666mHN2X51@BjJV8zBHMy|Vkv3IRKP506b~ z0kB}41t6!5Xk0uePMmP3FyKB%TtGP$MI#Cd!pO*o?jpuw%y0FNJURVN76N~~ke@R- zNl+gx1Pl>Fdf7$f51k(@gq#V!O8i;@&hTA3pzn#4OQ?J|XUh4SxrG=byK~Alff^W- zwgQ62>d^&KtIp**K(+uB0EC3|(*N%)-U9LZ{>$3E3QHP03xTt2uM7LqB~%px`?hT+ zV*iGce`yVXEHLHTg2>hY<2g|fwzsVrT@`iv^S#*x{MPh|mK1-WIM_E5t5&UPL}2UI z?Q#6XZ_lt03{Aw*>0?>}ME9_9%-z6}KG%pOYR*6X^waqK^UpzZPP;NWo%x42l8;F1 zVCv}1nAP=)gU`hsOXo$;#XT|qCx0H#^w!oAregm~J7fRo*D$@_?zjggUyN%mTp8Ps zNUSGxZRA;@*L0mQi{=L`DQOk(EJO;S3(3A*@Gap2vwn4F{U8gIq@k67a4{wVWAXVc z0-|&W@hrs6Si+g9DBWhI0MJGYz`vRAmLUoIxtvAoV#$T+OTv~kZBw@Q-K!#y>mBDA zw>1X*?x_}X{>~ij({V)>0fnWyjs$#8mym+5_~&&3Y5}xl_`}8SeSNWP*>$mC!Q$An z=V1KPzx;>mJZDY_`Uc11#5=!n9f15nMEaBhKqgXvRX|v139fVB^b-mK*KiwQ9WVxC zG3J+FaC|hj-Z(FoJh(pw$KQ%yuUi}oZrKt2<#R*7j@vI^6;BU%?esxN-SNqn6aopr zh1X1CkSu<5$PX}^hdlC3(H}cMY@V;yIIfXD_XJ`Asan8Za`asiNm;Q95#W97uPOox zf$stQ4tWMH3M-_m1%L=~&o(0a;3eU5-6a!!cH4N}dx2$lW`vb?G{r$0M(ehZhaA}N< zPsZ>5;UCZZVzJ>$zkT;zM8I9d>@qf;bSD2?bAYu1z&YSL*-Lp&LBOJ*pPaysG}nyz zAKi8xIGkt zsljLC=7r1RzMVty!rE(M{&}R9I6p31{Y2~X3x=TW3hl5Q&yRj#er~z}f;@9lW2!no*K}>HkMK4F4?K=h;5+dR|=5^#M|J zjil?na;EKj`MGKhxSmsrfW>Qan_PIlbYqn+A^L#C?NcZW9)W*@9R4Z1pBKxU#DV>X zsRi7Ue~ZM&hvTlh*2c-dZHfzhbK#?h`bMwzDS#%8mUogbV8MWQ=s$UNiS+v3=mR zxckaQ@u%A-VrpVXteSIWZ0PHl_isMM-!D;SOCU!IWfAB)CT=Qb@xFgI0btxL07fn4@Xu@k7;+10>k8a2 zuT>U^eJ@b62C9|-@ZCALP3iy7dkXxXr3jSPmR1CW4$6gGi9Usq`u(|{!F|W@eJRu+(yfQu^98qFF3e8t}TUN&QEm#br*skEsrPr{XtE~n=h`9o0nb^bI$vt z&aPEbNUw;^2VRKXd*xeHZS*dTGcbfox4=-+NJ$G40)m7n(k&s~ozh(bN(>Fs%?u3P z-Q77L-7&=B{hf3EgY)U^Pix0>uY0Y%S3TFY_qI7>UhjxpR2vpHhL^3k;u4zmN5k|plWt>IgoR!8I$?4oZP#sA5g~ef{h_l zhpH~>iorF@xvh~EsP*iU8daZFx|WRAk_jPl5-s7oI;((K#)0qAho(!S}e7n}f|pmZm|tdxMSE)x?I0Ds#|4sEov{5}PDMC07THWNs^g z1N1)Cbg7{4naOI0t0GXVM$*p$+g{>Mlv?+NeB8QZVX!hWgXBo_@s@?Jm$XI@qr;uvXxh)U^>3 z?V||}eh@B$HZmW2K3{)F#q|zGH!Pld3-UfW9*@{)czsKmJobi>7-c=se*TsF(Ja;Y z$Uq-)cY7R(GC#_x+-y%ZvV6>a=K%ha?Rw-Fk)IdQ`&2aEe;|1l2WnGM>vmGbk9VoaafY z2&b=G?*T8eYZMX zJo3H&R(Ttq0o!TES2j_jTH~cx;$~o60^dgnHYPA1q=`54*(@HL;wn=M z=!}Dmg9Yl?0xkaNK|9>+(fa?6HRLn1M;S+vwA_#Z=Z5K>3GE*nI60t^GalTpD!aVEix=D zjEsgRW^8OMpV}T{rn|fQkJ)U9gnjDnu7xzJLAK{8cMHXgu>^U*|FbB!Y z-;(26psi&yH2EdI7tmLhv%jM3`MQX*u1cY|4mqI!(aFK$g-^tmao*PF&oC**-S)~f&U!%(s zf(iZE5uCo!+|nbWj1y8Cf#}^sF|D*rOX#(_BG`e|Bd;d2i39Yly?EYQ&EioC*jQD# zpKWVY7`$I}91;5}dNHY1X)%$HyWr9_uFn~D5mSmxt0Z%L3r63GRgffS5Y0=)R%B^>S)wpYcUEWDs$rfk(Im8-DYHHlf4JT_c^Zei>#P^> zBA(dyM1QLMK0q>T*6ndSr%4YaR2y3VYm%}gWr_m(E|*TQ20LRYxW!z1Gcy6-*2S}{8G>0j$L zzs$8!ALFrqWdyvjv`At6g}kAzaUBWtX7*^%^@7H?DzvkQ>G%&aKvA(N)ok+Dum0n8 zd2;l%ZU9n5t|=$94Tj9`-m;e9{6Mdl9$!bj25Ny&FJ5$7dcNo`ZhV<0|I|?rQCLb; zTo>T<3VIAL&E}z`ll`klb;cB7m0@Pj3HkXQqX$T9=fscGt}5R|@m|*$_UoXg+1_kU zI?XYSJ3gYVR(p~vhR_Oye+&;fT+425VSqx1QYRh6+wCSf;emJBUlw+;6YhA4#>W{G zDb3DOtXRDc0glOH#2(yF?#pL`^s$mFj3=rre_!t479`0ueSM zzCo5~?K{-nyh}ki(A)JT;?fzuX{(H~Ay*w3RR$U5^Q6hIG6Q0^oDqz1BrCQML4K`R6usH%V57Yw z`Fp|%d(OXd!{4z@!zu>7G}Zg#R~b#ONZxqX+d}&qV<2wP!5LbQwAyqZ2pI7VaBo%R zyhgO1ql+h70(`_*xZ<3={RQ>8prx=th65W;$l9QuNwNw*2fz1=sA-OA5)LhhdBXem z)b3*%60m8)HwZrDp8{Pb%Qbe5^+BH>q=rM8e^EVh8SHN&cL9~;iltGsH#j)kb}Jx5 z*Ef6Ary>qzGHM)Oo-u4w!1Nule$l0n{y3ZWXGqWTORNQWsh_aO`0X_-4?WM@EB%B% z_7w0Wy8f1E0sUoJX*j*)t}aUwu-kph&fLbrK%6A(m}<`@zSd6LZBamEvaTrn!T;;1 zj$-g8F?y@nyj=!C|JN%Vxz0I2;m!U1uqIky^CJ~jB6PxoRfhKHwTh^Mf2K7S>PzeZ zLXOvxvlLYz!v^F~YAQg>w#WYpL5r=B(TA1kuXJtf7vX)Ur_YA}PhI5sXSC4E7aP8>#k{ z669cdIkxTf_IBB^bPe$vXQ#;iQh)lb-|P*0oWj2{WxFV!YOqOtY>=s75+}r9)?5=y z5hjtQCbXIJ&Vx1!XWbrD%OAPZwDEoO}C!QAqUQBtgrXywqlTMNvLqWG$;n%E^7Xg&8CpzN$KphbSWPw$ZG2Y6# zM?G!_jMqeqE%nUWiZT%BXT?aJA3wX7!wnJl3~*w*pG zv1av^cE;6`wq=HFDtYW??|7n?e77#kkLQEl21ZZ>uUf{%kAi_gfz@@E#}_T(16KQ81I>cIW0Xj)n^izZ zG?rz7V4eL8oe{&@7}0BX9umX-w9-%9oU=x=NWII;0`KeUd!6rly5ILIzpc}dNor6o z$dVn<^NC`sa$|)?M!#NDwGTCDpQC_SaiF*jdulktYD#J3XAWqHBztfVxcS(_x5tIs z3_q{%OJ4aIdK-@GNp|d}=;axQ?~;;PEzl6M8XrhEL>stO@139EYZ>CkCS|FLP`T)SLSrb?B(>t{ODz}zl=Gj%ed^rQ&(@$h__Bj zYdk~w!}ZfP4FeX8!jzN~2e%Fu;4t*d4XW=GAvZ=S>q^3-sW~7I`JQ zg%;16a26!y3+v|?hKD%d_t6duML3YD63CX(!#i1C_q&hpUX_@z_DygBms~OI|9Vkt zCv=~9>@U4OHC@z25DNs>Z-g8xwd2+4(R6zbqQW|6llTG-`sk14$lIbPRrfzH{xq8x z^Gfk~N%MWNCu0ybTa1YD?&qdbiE3lB#0{C;5KI$`rXPgzZ3yP4x1OY7dHoUbCxj;m z{t^hAxJeMqNo|J*uy}QQ>G4IKb@9Sfcz#CY@xpY9dVcYUdG%i$m!<^yZm|Q3O!2>n zg%tBUg8%-Ol{*k^|Ce&>E1xA5w|AG@Hg@mhk(N8>=E|}h zGX8s1fCwdVgUaNUU>TCws>bkT+2!vR|Gm9o-Ey;>v?!eiPxHmqe=GV2!B1F80xC=M za`0f(QB-7?a+w3w@zVy7g;L6vFck5X{&X@qRvPv_!xZv)+d*BvfKU>`$ zfr`vc@M*NN&=#a$mQ;a7Ts6b!Cj4|-D0qvz-;BLn)d$6weEMojEa{Q?CAF!Q`xslq zDZ|!4)5m^jqO9h-JVgH~+m>bwQGa8iuO@ZA7vfjt7Sj4J;c;1ttnvzNMm4ejm0Ce% z`89gI&Y@Qz=PwPAKtJ@%eB-zxdtsYd2}avfpo z;sTK94Z-LsG@!?|r{V9?7&m%3iRxJs76k&&FH%2&U?jmNpX zC1!0=bgFmVc(_NI?;?IGW0P8l{tvhVE3o*mPavn(73k4KEwrZ9dH)u>K6<6SwGX|< zqn7qo0H0Z&E&riE8nQoy#dj2zSeEVTOkAue|1;-)-EWda^&@hG!hOY2s#tJmJIy$% z*gQo$sLQ2kowYmv8~)ebZHnO@Ws64v#bUAp?I6C#n$BxF(8yP;~KO%3qx&5mfu>M?0hs&Iol^6t7{*y`L zOq}OBSFm2|a(XCWUi~Vlf0~ znP}xbQ5<-9LM+7o!KMxG;I=W1mayt&!uoy@HknB{AT_ho8xHq}^i+U7fJG`{#LiB?XGOgjAio z&Y0ql;~W_|`Fkt-*F&CkLFymn)Lcuhb5%R(L~JbTR@+~V>4DkhQVg+rnQ2S9!)xSS z5bUd;xrcJNOP>L1p3#}k!r#!Z1`Y@8V6j-#RyI?4uAHV2_k^2MGge2xM{mH7i*K>e zlzwE6=$L**z-*yLml&T%jJc2ch4VgaQeeV1$TkMdD{|Ok-4*9GGc(IroQ@WC(bP;a0y+XLawg>QMIH&3ZkIYr-Ji>a&}K+q{% ze1kzQHUz6`5;MoR8-hxlK$`8}OY6xCK_ae)ne1>P*SZ(&9`3|1zpkwAjX$>jtSL9V z31CdA7gp7u^joO6-N5-&zNY~nfW-=g;#u?FX%7B$54P2>9}TBw1(NI!)YEz^eN3tJ z{tSVs8@(_7MG&XRhXdw}+vbSUvTLPgTczG31p+IDIMkC`Yf+gg!?x2Fbq2NT7`Z&PS92s)*k8YeD=S%b zjU(Xbyq62NPNs>!)oGQ4*7d3IwrZ`7qoho!Dz1W}%S(2(4I|ZATs{g#%`uNe0-F*= z2lf=Nd*S7)C!XoG2eqTSuvP6ttXehuMB~2y4CAsx`II*OAETaLU!$XzK1f7WP1P*hN`LOP40oCNM$_G)OJ_%--y9zz#x&XVnx(dTl{0cnUZ**=Hb`lLk zd#zoXO#L-kf%TteEk(>Il~eM817I)*AH*g6RRmpsGhau+aAd9x&O5Gb_e7nATaM9l zoY87W!})*>cc#Fo(u36e0yN%el0OGnqk-Oa7pFAD0A9qtXM=&VQ&yMhWQtXnjP$2+ z(ENM!4_a#fa)3hS-B~<14OU$Sec_{YGglXOKYwATai}lE5^qTXJj_5q5*U02P_VK1 z^i>Q0D9|YNCMmSl9^*3%f+{r(vnHI^3~IRnd%Sv z^*ZM^J-(<urTpAIeGDq^e&C{h zac9eC(G;6s>|bE&zCo3qgSTHsNYFt4(W`~I{9ZnR_@0R+ zxQ|(4iN!!Z7RR3osnSHOwy%>`y>8UJ=jmBA7hVPmmod#R5riVQ^=1wiF2wp0=4*}V zNcInKCOJ!e5kc7G#OzQyq?^s5VaI)zWAsKw>*e)3#PPNdf^_=SHH?cmUi$DpsJ(#Gv>1ejdGL@_%^vRmWzUdV(034Lqo%k@@L%V&kYR>{NCx56&2BW z5{fKF4m~w!)(TYZIKHzoGOOc^;$G^xzO43JlB-#1zI1xzQiVmKmi9@;Dli;HFT^=al87F1PL{jK|QVq!{p)*JK!&G9QtlAQR+D-teVS-#1c zVK(^D7H*LPVtoE#-vxie?gsF}Z0y9fKvTM)FB0u}x+7K3y;KwFR1mbK1|)vJixV0q zFMaz-8{bX1a!c~KXApj5Wi~H(I`Cr`D-#BzIy#7HKg;+lNZ?F}Nno>vs3I-*i4RE@ z%Z^Pek})%TEk;hIaOCdg^$Y)xCJw>bOl>i#opE2lCSZ55+5qcb!PKpICWbfLWEl6+ zO8D`xinI`~*Z#?m5AW-$=#H!P?_P*M-YBS;At4Bt?Z4fwtibA(-_W8spODOk28{AU z+#ar%n?~Qp(H?ZfVxDcC!4_eDQgA}I3okLBI(`fba`-v9e^mv=!bJXqmet42uNb_5 z>L(VsD#IG8pNFvVMZ~`txA&eCC>5sl4AL8p0uq=F+?=q?97#ssnn`LwLA)4*oR!)3 zRa23T5dijVaKv2rZ7RmTsiP|?d-k6$s3t)sRI7bAO*Y7YMC6P_MZnhokM2UA5^p{` zopfDyQzMRGNp7vsQ?UJM3e%m1@1gaxTCVBl`~ExGlB^JudR$^Yq;G*ySzB8RIzsTp z=ktu-V^+2py)Y9Qx-J|FRBjv;oUaKzD8dr;&3~bN*`*4p@D4hU%|?~?jPPVm(i)hy zh4;y@G36_UvKghCdDjIl8j)01Ft?g$1ebSrdDX@dz@YO!R>Y%Yq9MAM4@)-~X+!Bj zm?F!0+R~5NL!mX)Z5#GDl;R-`b<$tn7oQ~pR`SBN=n3S~s*p%S+tt@7JsR876jx}q{2FNKsrqJw)M#oVn?p$Jpp-&Y6qv+#O{C8}TO^|Nl`Q}f3E2GV4A z1Bj7LeXiJS%jICL&91(6dC$`a-)Od9vO`at+EGx246*CFdH*UDs#y>%hwGMuaktR~;vW zts=;o+Hie;W%%$->J<0T%)t)W;YYE^;Z^BW@`Mfys=>*PFUz>1vt%)gAlwQc+wiC4 zcGUqP4Y(p!vmE6L;pfXiAaI-G%vPaJfQKqWB`VdkTY^vx*7DuY-Rw09>Vuq` z+;D@g`xC~%O+~ephkh9+ijwgeS)^hwdwO@>#hGTnOX?~~jkjx6rWx_@@>A7EKBbzJ zHx~F1Y{2a;iE36oBZ_5zP$2um$h0m=CRC>tt9D}1NsOSobjO@O+d0 zIeg&%8by>~8CX=Ls;L>aVW^F_a0aQVF2Gyb2%At{uxjD^5T>6q7CShoxVg2pwqu6n zCS>I21MJMeCOK-9h>K@3Rm}P%INOGeT`h@5qQ*j~2p(kJ5Jcylw=z zBX4jusJ|+7!Y>9vtW-rNd)v_Qa3*BXWtX!Z+lZF_S8}|SHzh0hzw6X7+MqSG(*-iQ z(L0@gHCIQdoUXDr=}~$=uMEfgxOviNA?V8SEV)B1E-hZNi}q_)XVL`RO;;@VV2Nb6 z+TRENXqx=Q6Y8N8H7IRk!^y+LQ*oq)Roe5P3g1o1W1G{I{q#;%X||f)@j|=2UErYwQcG8N#gs;88L5{z+eutOU6Wigc|;pJ|-8 zdPi0sI|u;P`&8g=_3pokUo0M{O{DK?W|l_p<70<%FCsW|`ylkyiGwocy<-)7L1DnUI+gh;2yynt=qNAsG$u>#AEO01A4&W^O>S+^97a-U_~W zNe3r;R`P8NmZ?%L#Y1yk4Xmk6BCA}oBy_Gq9tSBRAD{2)7}B%CgS7v zKU*(Pj#a-KW$Jvo+!wSu1Z(`Cof_FEF$Epbh9DP#_5HWjb{4x$ehN*mz^G#Gzw?5r z61>HKhaF+;f7dQ{USEY2`ZT@^=@oIQ@3X{jq71qc40KNT*3rN)Bb>e%ANbLSW_}HC z{7^EL;acIee`-1^Kr3yLp#{gP&e8#Fo_MYBu=E)GQ~#%K(@)!1Hv%hKVKLPdVXn3N zTWnule#H+EQ{G*Eh9~g!b$xCmn6u?1DtBJi#J`#0!cHfWdp9$;HK2D}y=3OD`HvRX4XZo_ka>Lb;_+`v({r$j0{o^vZIp<;ZsYf;M^df(V zNNUfVby@0J`u(M$Yi^T8j7$A|{ZiXymDtjfHFV)%?}Ta7KjE$NBjR+ln6va rgP=)((eMCh{~wEf; - ]> @@ -9,22 +9,17 @@ - This documentation was converted from the &kde; UserBase -Amarok/Manual -page. + This documentation was converted from the KDE UserBase Amarok/Manual page. &FDLNotice; -2013-08-13 - 2.8.0 +2018-05-21 + 2.9.0 -&amarok; is a free, versatile and powerful music player for &Linux; and -&Microsoft; &Windows;, helping you to organize your music collection and -rediscover your music. The current stable release is version 2.8 that brings -back all the important features known from the 1.x series. +&amarok; is a free, versatile and powerful music player for &Linux;. The latest 2.x release series, often referred to as Amarok 2, is cross-platform (can be used on many platforms, including &Linux;, &MacOS; and &Microsoft; &Windows;) and implements a completely reworked code base that will enable it to incorporate exciting new features as the release matures. The current stable release is version 2.4. KDE @@ -38,7 +33,7 @@ sound - + Amarok: Rediscover your music! @@ -982,7 +977,7 @@ -GLOSSARY +Glossary Breadcrumbs This is a way of navigating a hierarchical file structure; on &amarok; near the top of the Media Sources pane. Starting at the Home folder level, it shows how deep one has navigated into the file system. When you have gone to a particular place in the file system, you will see all folders at a higher level. In &amarok; the > links between folder levels allow you to find out what alternative folders are available at a particular level. The breadcrumbs are an efficient mechanism to navigate the whole file system on your computer. @@ -3637,7 +3632,6 @@ Search in Collection  Organize Collection  Statistics Synchronization Between Collections and with Last.fm  -Nepomuk Collection Remote Collections  Ampache  DAAP  @@ -4170,89 +4164,6 @@ -Nepomuk collection in Amarok -Nepomuk has been a great semantic framework in recent years with many applications like &dolphin; using it for managing metadata associated with its files and resources. And now, even &amarok; uses Nepomuk to fetch tracks in your computer. This collection doesn't use the SQLite backend to store statistics and metadata ( artist, album, year, genre, Labels etc ). It instead uses Nepomuk to store them and fetch them. - -For more details on Nepomuk, please visit its official page. - -Why use the Nepomuk Collection at all? -Nepomuk is a system wide backend with multiple applications already using it for search and metadata. So when you rate a track in &amarok;, it reflects in &dolphin; as well. When you burn your music tracks onto a disc, the ratings will be included too! You don't have to remember where you have stored your music tracks anymore. Nepomuk fetches tracks from all over your computer. You don't have to organize your music tracks into one single folder! Imagine the number of times you downloaded a track again just 'cos you couldn't find it in your computer -- not anymore. - - -Getting Started -Indexing Files -For your tracks to show up in &amarok;, they need to be indexed by Nepomuk first. And Nepomuk does not index every file on the hard drive. Its default configuration in most &Linux; distributions excludes some common patterns for backup files and configuration directories and it only indexes certain directories in your home folder.  - -Beware: indexing files may take a lot of time depending upon the number of files that are to be indexed as well as on the amount of memory that is allowed to the desktop search for indexing. See also Search Desktop. - - -Choosing Directories to Index -Directories that are to be indexed can be changed in System SettingsDesktop SearchIndexingCustomizing folders. As of KDE 4.11, this is the dialog you will see: - - - - - - - - - - - - - - - -Enabling Nepomuk Collection In Amarok - - - - - - - - - - - - - -The Nepomuk Collection in &amarok; is a plugin that can be enabled in SettingsConfigure AmarokPluginsNepomuk Collection. After enabling, restart &amarok; for the plugin to load completely. - - - -Collections - - - - - - - - - - - - - -After enabling the plugin, there will be a new collection named Nepomuk Collection containing the tracks indexed by Nepomuk. - - -Using Nepomuk Collection -Rating Tracks -After enabling the Desktop Search with Nepomuk, tracks and other files can be rated in the &dolphin; file browser. Tracks in the Nepomuk Collection can be rated outside and rating will be shown instantly in &amarok;. - - -Moving Tracks -Tracks shown in the Nepomuk Collection can be played even if they are moved out of their original location. They would be usable also if you rename them. - - -Playlists -Every feature of Nepomuk can be used with created playlists too. - - - - Remote Collections Often it is very useful to share your media files across the network, especially if you want to use it on different computers. This can be done in different ways: @@ -4263,7 +4174,7 @@ UPnP Ampache -&amarok; is able to play music from an Ampache media server. If you want to install a server, see here for more information. Installation directions are here. +&amarok; is able to play music from an Ampache media server. If you want to install a server, see here for more information. Ampache Client @@ -4329,7 +4240,7 @@ Digital Audio Access Protocol (DAAP) -DAAP is a protocol to share media over a network. It was first used for the iTunes music player, but is used widely now. +DAAP is a protocol to share media over a network. It was first used for the iTunes music player, but is used widely now. The current state is that the DAAP-plugin won't work with a recent iTunes, the Firefly media server is known to work. Client @@ -4353,7 +4264,7 @@ Samba is a free implementation of the SMB/CIFS protocol which is used to share files and printers in a network. Most modern file managers like &dolphin; and Nautilus support this protocol. -Client +Client You need to mount the share to use it in &amarok;. To do this, you need to install the package smbfs. Use the command sudo mount -t cifs //host/share /mount-point/ @@ -4432,7 +4343,7 @@ -The UPnP feature depends on KDE's UPnP media server support. +The UPnP feature depends on KDE's UPnP media server support. As of now (2015) there is no working UPnP kio-slave available. @@ -4788,7 +4699,7 @@ Edit Tags Manually Change the proper line to the required value and click Save & Close. Clicking Cancel discards all unsaved changes. -Tags +Tags Tags are metadata such as the track number or the artist of the track contained in the file. A very common kind of tag is the ID3 tag. Here is a list of tags supported by &amarok;: @@ -5052,7 +4963,7 @@ -Example +Example Filename: 01-The Beatles-Hey Jude.mp3 Tracknumber: 01 @@ -5245,7 +5156,7 @@ -Playlist +Playlist The Playlist is a powerful part of &amarok;. One can drag in some tracks, but there is a lot more available. @@ -5306,10 +5217,10 @@ -Edit Box +Edit Box When you type something in the Search playlist field, &amarok; will search in your playlist and mark matching tracks, artists and so forth. -Examples +Examples The first track that matches the current search will be highlighted as in this example: @@ -5447,7 +5358,7 @@ As you select or add songs to the Queue each of them takes a number. The number indicates the order in which songs will play. -Example +Example @@ -5707,7 +5618,7 @@ Below that is the dropdown menu for loading saved playlists, the button to save playlists, and the button to delete them. -A dynamic playlist in use +A dynamic playlist in use @@ -5888,6 +5799,7 @@ Moodbar  +ReplayGain  Amarok on other Desktops and Operating Systems  Non-KDE Desktops  Amarok on Windows  @@ -5912,12 +5824,12 @@ Summary of Requirements -The Moodbar binary, in your PATH (it should be listed upon running which moodbar from a console) — Remember to configure the Moodbar package with ./configure --prefix=`pkg-config --variable=prefix gstreamer-0.10` -The GStreamer 0.10 library and plugins for the formats you want Moodbar to be able to analyse. +The Moodbar binary, in your PATH (it should be listed upon running which moodbar from a console) — Remember to configure the Moodbar package with proper path, ⪚ build and install with commands ./autogen.sh --prefix=`pkg-config --variable=prefix gstreamer-1.0` && make && sudo make install +The GStreamer 1.0 library and plugins for the formats you want Moodbar to be able to analyse. (An earlier GStreamer 0.10 based version is also still available for some distributions) The Fastest Fourier Transform In The West (fftw.org) FFTW library version 3.0 or above (at least single-precision floating point version - libfftw3f) — If your platform does not provide this for you or you need to compile your own version, remember to configure the FFTW package with ./configure --enable-single A version of &amarok; with a Use moods option in the General section of the configuration screen. This means 1.4.4 or higher in the 1.4 series or 2.2.2 or higher in the 2.x series. -Systems with package managers should automatically install the GStreamer plugins and FFTW along with the Moodbar package; this information is provided mostly for people who want or need to compile from source or manually install packages. +Systems with package managers should automatically install the GStreamer plugins and FFTW along with the Moodbar package if available; this information is provided mostly for people who want or need to compile from source or manually install packages, or where the distribution specific instructions are outdated and no updated moodbar package is yet available. Usage @@ -5928,73 +5840,65 @@ Installation Source Downloads -Latest release: moodbar-0.1.2.tar.gz — this is the Moodbar source package, which contains the Moodbar program (which generates .mood files from music files), and a GStreamer plugin that does the work. The Moodbar package needs GStreamer 0.10.* installed, plus the 0.10.* version of various plugins. Be sure to install the Moodbar package into the same prefix as GStreamer — follow the instructions in the INSTALL file. +Latest release: moodbar-0.1.4.tar.gz — this is the Moodbar source package, which contains the Moodbar program (which generates .mood files from music files), and a GStreamer plugin that does the work. The Moodbar package needs GStreamer 1.0.* installed, plus the 1.0.* version of various plugins. Be sure to install the Moodbar package into the same prefix as GStreamer — follow the instructions in  the summary of requirements chapter. The 0.1.4 is a a fork of original 0.1.2 sources, updated to use GStreamer 1.0. The old 0.1.2 sources are not reliably available online any more, but packages might be still available for some distributions. If you find any bugs, please submit a bug report at bugs.kde.org. Debian packages +This section contains old instructions for the GStreamer 0.10 based moodbar version 0.1.2, they might be outdated. + A package for Moodbar is now available in Debian unstable. Simply run apt-get install moodbar . You will likely also want to install gstreamer0.10-plugins-ugly, gstreamer0.10-plugins-good, and gstreamer0.10-plugins-bad for format support. Kubuntu and Ubuntu packages +This section contains old instructions for the GStreamer 0.10 based moodbar version 0.1.2, they might be outdated. + A package for Moodbar is available in the official package repository; just ensure the universe section is activated (which should be default anyway). Just install the package moodbar with your preferred package manager (Kpackagekit, Aptitude, Adept, Synaptic). You will likely also want to install gstreamer0.10-plugins-ugly, gstreamer0.10-plugins-good, and gstreamer0.10-plugins-bad for format support. Or, to install, paste this into Firefox or &konqueror; and hit &Enter;. apt://moodbar,gstreamer0.10-plugins-ugly,gstreamer0.10-plugins-good,gstreamer0.10-plugins-bad?section=universe?refresh=yep Gentoo ebuilds +This section contains old instructions for the GStreamer 0.10 based moodbar version 0.1.2, they might be outdated. + Moodbar is available in Portage, simply emerge moodbar Unofficial ebuilds are no longer required. RPM builds +This section contains old instructions for the GStreamer 0.10 based moodbar version 0.1.2, they might be outdated + If you are a rpm-based distro user, you can build a .rpm using rpmbuild with latest gstreamer-plugins-moodbar.spec. The binary package will be soon available for PLD-linux distro. Fedora +This section contains old instructions for the GStreamer 0.10 based moodbar version 0.1.2, they might be outdated. + In Fedora 7 and higher (up to 16 as of this writing) Moodbar is available in the default repositories. Simply install it with your PackageKit GUI or with the following yum command: yum install moodbar openSUSE packages -openSUSE 11.0 and later, automatically install the following packages: - - -gstreamer-0_10-fluendo-mp3 -gstreamer-0_10-plugins-base - -Also, if your songs contain ID3 tags, you must install +GStreamer 1.0 based version 0.1.4 is available in KDE:Extra repository for openSUSE Leap 42.3 and later. An earlier GStreamer 0.10 based version 0.1.2 is also still available in the main repository for some openSUSE versions. - -gstreamer-0_10-plugins-good - -Moodbar Installation -1-Click Install for openSUSE 11. - just choose your version and installation procedure will do the rest: +For details on how to add repositories, see the openSUSE wiki. - -openSUSE 11.2 -openSUSE 11.1 - -To install, add the correct repository for your version of openSUSE to YaST then make sure the following packages are installed: +1-Click Install for openSUSE - just choose your version and installation procedure will do the rest: -gstreamer-0_10-plugins-good -gstreamer-0_10-plugins-ugly -gstreamer-0_10-plugins-moodbar -mad +openSUSE Tumbleweed +openSUSE Leap 15.0 +openSUSE Leap 42.3 -For details on how to add repositories, see the openSUSE wiki. - -If you are using the Smart software management tool, add the channel by entering the following at the command line, remember to change the URL to match your version of openSUSE: smart channel --add http://software.opensuse.org/download/home:/d7/openSUSE_10.2/home:d7.repo Then enter smart update home:d7 You can now install the required packages by smart install gstreamer10-plugins-moodbar Dependencies are resolved automatically. - - Mandriva packages +This section contains old instructions for the GStreamer 0.10 based moodbar version 0.1.2, they might be outdated. + First of all, you need to add PLF repositories, so visit easyurpmi.zarb.org and add them to your repositories list. Then simply install the following packages: @@ -6007,12 +5911,16 @@ Arch &Linux; +This section contains old instructions for the GStreamer 0.10 based moodbar version 0.1.2, they might be outdated. + There is a PKGBUILD for Moodbar in the Arch User Repository (AUR) available here. For more information about the AUR and working with PKGBUILDs, see the AUR User Guidelines. FreeBSD +This section contains old instructions for the GStreamer 0.10 based moodbar version 0.1.2, they might be outdated. + There is a port: audio/gstreamer-plugins-moodbar here. To install the port: cd /usr/ports/audio/gstreamer-plugins-moodbar/ && make install clean @@ -6084,20 +5992,18 @@ fi done -There is another script at Github, which shows previews of the generated mood files on the command line while they are being generated. Read more about it at the author's blog. - Troubleshooting -If the Moodbar executable gives you a bus error, that almost always means it can't decode (or can't find) your file. Take a look at the supported file types below for ideas on which GStreamer plugins to install. You can also try the command below to test whether GStreamer can decode your file:gst-launch filesrc location=[file] ! decodebin ! fakesink +If the Moodbar executable gives you a bus error, that almost always means it can't decode (or can't find) your file. Take a look at the supported file types below for ideas on which GStreamer plugins to install. You can also try the command below to test whether GStreamer can decode your file:gst-launch-1.0 filesrc location=[file] ! decodebin ! fakesink If you are using the ffmpeg plugin to decode mp3s, you may also receive mysterious bus errors. The solution is to stop using the ffmpeg plugin, as it is extremely buggy — use mad instead. If the Moodbar executable tells you that it can't find an element — &ie;, it gives an error message like Could not create element of type fftwspectrum, please install it.— that usually means that you either don't have the required plugins installed (see the plugin list here), or that you didn't install the Moodbar package in the same prefix as GStreamer. If libmoodbar.so and libgstdecodebin.so are not in the same directory, then Moodbar is not installed in the same prefix as GStreamer. Please read the INSTALL file for instructions on how to configure the moodbar package correctly. Alternatively, if you know what you're doing, it may be easier for you to take a look at the GST_PLUGIN_PATH environment variable. -If you're wondering why the Moodbar isn't working, either not working at all or not working for a particular file, run the command below, where [file] is a music file:moodbar -o test.mood [file] -If you have multiple versions of GStreamer installed, make sure all of the required plugins are installed for version 0.10.* -- different versions cannot use each other's plugins. +If you're wondering why the Moodbar isn't working, either not working at all or not working for a particular file, run the command below, where [file] is a music file:moodbar -o test.mood [file] To generate a test image preview, one can use the commandːgst-launch-1.0 filesrc location=[file] ! decodebin ! audioconvert ! fftwspectrum ! moodbar height=50 max-width=300 ! pngenc ! filesink location=mood.png +If you have multiple versions of GStreamer installed, make sure all of the required plugins are installed for version 1.0.* -- different versions cannot use each other's plugins. Supported Filetypes -You will need various Gstreamer plugins to enable Moodbar to analyze your files. Here is a list of the plugins you will need; make sure to install the 0.10.* version of each plugin: +You will need various Gstreamer plugins to enable Moodbar to analyze your files. Here is a list of the plugins you will need; make sure to install the 1.0.* version of each plugin: @@ -6115,7 +6021,7 @@ All - gstreamer-0.10.*, gst-plugins-base, gst-plugins-good + gstreamer-1.0.*, gst-plugins-base, gst-plugins-good @@ -6192,6 +6098,94 @@ +Replay Gain +Replay gain will automatically adjust the volume of the currently played song, relative to other songs, as determined by the person who encoded the audio file. To enable replay gain, see Settings menu. + +To handle this, &amarok; relies on metadata embedded in the audio file: + + +If no replay gain information is embedded, &amarok; will not adjust the volume +If replay gain information is found, it will be written into &amarok;'s database + +During playback, &amarok; will only look into its own database for this information. Updates to the metadata of the file will not always get written into the database during a collection update (⪚ replay gain is deleted from file). + +This can lead to unexpected behavior: Songs from the same artist play at different volume levels &etc; + +Is replay gain being used? +To figure out if the volume problem is caused by replay gain or bad encoding: + + +Disable replay gain processing (see above) +Start &amarok; in debug mode and search for gain- related output: + +amarok -d --nofork | grep gain + +If replay gain is active for the played song, the output will be + + Using gain of -10.28 with relative peak of -1 + + +View replay gain information +For .flac files, metaflac can be used to view embedded replay gain data: + +metaflac --list Millencolin\ -\ Balanced\ Boy.flac + +Among other things, this will show something like this: + + METADATA block #2 + + type: 4 (VORBIS_COMMENT) + + is last: false + + length: 390 + + vendor string: reference libFLAC 1.2.1 20070917 + + comments: 14 + + comment[9]: REPLAYGAIN_REFERENCE_LOUDNESS=89.0 dB + + comment[10]: REPLAYGAIN_TRACK_GAIN=-1.55 dB + + comment[11]: REPLAYGAIN_TRACK_PEAK=0.75894165 + + comment[12]: REPLAYGAIN_ALBUM_GAIN=-4.19 dB + + comment[13]: REPLAYGAIN_ALBUM_PEAK=0.98712158 + +To view this tracks information within the &amarok; database: + +select id, title, albumgain, albumpeakgain, trackgain, trackpeakgain from tracks where title like "Balanced%"; + +Will show: + + +-------+------------------+-----------+---------------+-----------+---------------+ + + | id | title | albumgain | albumpeakgain | trackgain | trackpeakgain | + + +-------+------------------+-----------+---------------+-----------+---------------+ + + | 10459 | Balanced Boy | 0.53 | -5.60297 | 0.44 | -5.60297 | + +Note the difference in loudness levels + + +Delete replay gain information +First, delete the metadata from the file: + +metaflac --remove-replay-gain Millencolin\ -\ Balanced\ Boy.flac + +After that, update your &amarok; collection. If it is still using replay gain, update the database entry: + +update tracks set albumgain=-1,albumpeakgain=-1,trackgain=-1,trackpeakgain=-1 where id=10459 + +Restart &amarok; and the log output should now show the updated values being used. + +Feel free to try and mess with the values manually to improve volume levels. + + + Amarok on other platforms &amarok; is intended for the KDE desktop, but it works on other platforms as well. Although it takes some effort, Amarok can run on these configurations: @@ -6474,7 +6468,7 @@ The port command will fetch all the dependencies, compile, build and install them. This process may take quite some time, four to five hours in a recent install. -Screenshots +Screenshots The following screenshot shows &amarok; running on the &MacOS; X: @@ -6639,7 +6633,7 @@ There are many more great features like advanced scripting, dynamic collections, usability improvements, improved media devices handling, a new podcast manager, support for more software platforms, and others. -Installation +Installation Can I use Amarok without KDE? &amarok; requires parts of KDE to be installed to run, but will run fine in Gnome or other desktop environments, including Windows and OS X. For &amarok; to run, kdelibs and kdebase-runtime need to be installed. @@ -6861,7 +6855,7 @@ -Troubleshooting +Troubleshooting How can I obtain a backtrace? If &amarok; has crashed and you want to report it, visit the Debugging HowTo. The bug report must be made in bugs.kde.org after verifying if it has not already been reported. @@ -7005,7 +6999,7 @@ Some of the common actions in &amarok; are here, mostly to control media playback. -Contents +Contents @@ -7556,7 +7550,7 @@ - + The Tools Menu @@ -7622,8 +7616,7 @@ Synchronize Statistics.. - Opens the Statistics Synchronization dialog. - + Opens the Statistics Synchronization dialog. @@ -7691,7 +7684,7 @@ -Cover Manager +Cover Manager Shows all albums in your collection. Here you can set custom album covers and fetch missing ones. More about the Cover Manager, shown below. diff --git a/images/CMakeLists.txt b/images/CMakeLists.txt --- a/images/CMakeLists.txt +++ b/images/CMakeLists.txt @@ -75,7 +75,7 @@ emblem-wikipedia.png emblem-xing.png - DESTINATION ${DATA_INSTALL_DIR}/amarok/images + DESTINATION ${KDE_INSTALL_DATADIR}/amarok/images ) ecm_install_icons(ICONS @@ -85,6 +85,6 @@ 32-apps-amarok.png 48-apps-amarok.png 64-apps-amarok.png - DESTINATION ${ICON_INSTALL_DIR} + DESTINATION ${KDE_INSTALL_ICONDIR} THEME hicolor ) diff --git a/images/icons/CMakeLists.txt b/images/icons/CMakeLists.txt --- a/images/icons/CMakeLists.txt +++ b/images/icons/CMakeLists.txt @@ -197,14 +197,12 @@ 48-actions-amarok_cart_view.png 48-actions-amarok_change_language.png 48-actions-amarok_clock.png - 48-actions-amarok_lyrics.png 48-actions-amarok_playcount.png 48-actions-amarok_playlist.png 48-actions-amarok_playlist_refresh.png 48-actions-amarok_scripts.png 48-actions-amarok_track.png 48-actions-collection-rescan-amarok.png - 48-actions-current-track-amarok.png 48-actions-download-amarok.png 48-actions-dynamic-amarok.png 48-actions-filename-album-amarok.png @@ -235,7 +233,6 @@ 48-actions-info-amarok.png 48-actions-label-amarok.png 48-actions-love-amarok.png - 48-actions-media-album-cover-manager-amarok.png 48-actions-media-album-repeat-amarok.png 48-actions-media-playlist-repeat-amarok.png 48-actions-media-random-albums-amarok.png @@ -250,7 +247,6 @@ 48-actions-media-track-queue-amarok.png 48-actions-media-track-remove-amarok.png 48-actions-music-amarok.png - 48-actions-photos-amarok.png 48-actions-playlist-generator.png 48-actions-podcast-amarok.png 48-actions-preferences-indicator-amarok.png @@ -264,15 +260,14 @@ 48-actions-view-importers-banshee-amarok.png 48-actions-view-importers-clementine-amarok.png 48-actions-view-importers-rhythmbox-amarok.png - 48-actions-view-media-analyzer-amarok.png 48-actions-view-services-amazon-amarok.png 48-actions-view-services-ampache-amarok.png 48-actions-view-services-gpodder-amarok.png 48-actions-view-services-jamendo-amarok.png 48-actions-view-services-lastfm-amarok.png 48-actions-view-services-magnatune-amarok.png 48-actions-view-services-mp3tunes-amarok.png - DESTINATION ${DATA_INSTALL_DIR}/amarok/icons + DESTINATION ${KDE_INSTALL_DATADIR}/amarok/icons THEME hicolor ) diff --git a/playground/src/context/applets/coverbling/CMakeLists.txt b/playground/src/context/applets/coverbling/CMakeLists.txt --- a/playground/src/context/applets/coverbling/CMakeLists.txt +++ b/playground/src/context/applets/coverbling/CMakeLists.txt @@ -23,14 +23,14 @@ KF5::KIOCore ) -install(TARGETS amarok_context_applet_coverbling DESTINATION ${PLUGIN_INSTALL_DIR}) -install(FILES amarok-context-applet-coverbling.desktop DESTINATION ${SERVICES_INSTALL_DIR}) -install(FILES blingfastback.png DESTINATION ${DATA_INSTALL_DIR}/amarok/images/ ) -install(FILES blingtofirst.png DESTINATION ${DATA_INSTALL_DIR}/amarok/images/ ) -install(FILES blingfastforward.png DESTINATION ${DATA_INSTALL_DIR}/amarok/images/ ) -install(FILES blingtolast.png DESTINATION ${DATA_INSTALL_DIR}/amarok/images/ ) -install(FILES blingdefaultcover.png DESTINATION ${DATA_INSTALL_DIR}/amarok/images/ ) -install(FILES blingfullscreen.png DESTINATION ${DATA_INSTALL_DIR}/amarok/images/ ) -install(FILES blingjumptoplaying.png DESTINATION ${DATA_INSTALL_DIR}/amarok/images/ ) -install(FILES blingsearchalbum.png DESTINATION ${DATA_INSTALL_DIR}/amarok/images/ ) -install(FILES blingsearchartist.png DESTINATION ${DATA_INSTALL_DIR}/amarok/images/ ) +install(TARGETS amarok_context_applet_coverbling DESTINATION ${KDE_INSTALL_PLUGINDIR}) +install(FILES amarok-context-applet-coverbling.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}) +install(FILES blingfastback.png DESTINATION ${KDE_INSTALL_DATADIR}/amarok/images/ ) +install(FILES blingtofirst.png DESTINATION ${KDE_INSTALL_DATADIR}/amarok/images/ ) +install(FILES blingfastforward.png DESTINATION ${KDE_INSTALL_DATADIR}/amarok/images/ ) +install(FILES blingtolast.png DESTINATION ${KDE_INSTALL_DATADIR}/amarok/images/ ) +install(FILES blingdefaultcover.png DESTINATION ${KDE_INSTALL_DATADIR}/amarok/images/ ) +install(FILES blingfullscreen.png DESTINATION ${KDE_INSTALL_DATADIR}/amarok/images/ ) +install(FILES blingjumptoplaying.png DESTINATION ${KDE_INSTALL_DATADIR}/amarok/images/ ) +install(FILES blingsearchalbum.png DESTINATION ${KDE_INSTALL_DATADIR}/amarok/images/ ) +install(FILES blingsearchartist.png DESTINATION ${KDE_INSTALL_DATADIR}/amarok/images/ ) diff --git a/playground/src/context/applets/coverbling/CoverBling.h b/playground/src/context/applets/coverbling/CoverBling.h --- a/playground/src/context/applets/coverbling/CoverBling.h +++ b/playground/src/context/applets/coverbling/CoverBling.h @@ -27,7 +27,7 @@ Q_OBJECT public: - CoverBling( QWidget* parent ); + explicit CoverBling( QWidget* parent ); protected: void initializeGL(); diff --git a/playground/src/context/applets/coverbling/ImageLoader.h b/playground/src/context/applets/coverbling/ImageLoader.h --- a/playground/src/context/applets/coverbling/ImageLoader.h +++ b/playground/src/context/applets/coverbling/ImageLoader.h @@ -20,8 +20,8 @@ * */ -#ifndef IMAGE_THUMBNAIL_H -#define IMAGE_THUMBNAIL_H +#ifndef IMAGE_LOADER_H +#define IMAGE_LOADER_H #include "core/meta/forward_declarations.h" @@ -83,5 +83,5 @@ int idx; QImage img; }; -#endif // IMAGE_THUMBNAIL_H +#endif // IMAGE_LOADER_H diff --git a/playground/src/context/applets/coverbling/PhotoBrowser.h b/playground/src/context/applets/coverbling/PhotoBrowser.h --- a/playground/src/context/applets/coverbling/PhotoBrowser.h +++ b/playground/src/context/applets/coverbling/PhotoBrowser.h @@ -31,7 +31,7 @@ Q_OBJECT public: - explicit PhotoBrowser(QWidget* parent = 0, bool enableOpenGL = false); + explicit PhotoBrowser(QWidget* parent = nullptr, bool enableOpenGL = false); virtual ~PhotoBrowser(); void fillAlbums(Meta::AlbumList albums); diff --git a/playground/src/context/applets/coverbling/SearchBarTextItem.h b/playground/src/context/applets/coverbling/SearchBarTextItem.h --- a/playground/src/context/applets/coverbling/SearchBarTextItem.h +++ b/playground/src/context/applets/coverbling/SearchBarTextItem.h @@ -14,20 +14,24 @@ * this program. If not, see . * ****************************************************************************************/ +#ifndef SEARCHBARTEXTITEM_H +#define SEARCHBARTEXTITEM_H + #include class QKeyEvent; class SearchBarTextItem : public QGraphicsTextItem { Q_OBJECT public: - SearchBarTextItem( QGraphicsItem * parent = 0, QGraphicsScene * scene = 0 ); + explicit SearchBarTextItem( QGraphicsItem * parent = nullptr, QGraphicsScene * scene = 0 ); Q_SIGNALS: void editionValidated( QString editioncontent ); protected: virtual void keyPressEvent( QKeyEvent* Event ); virtual void mousePressEvent ( QGraphicsSceneMouseEvent * event ); private: QString m_content; }; +#endif diff --git a/playground/src/context/applets/coverbling/amarok-context-applet-coverbling.desktop b/playground/src/context/applets/coverbling/amarok-context-applet-coverbling.desktop --- a/playground/src/context/applets/coverbling/amarok-context-applet-coverbling.desktop +++ b/playground/src/context/applets/coverbling/amarok-context-applet-coverbling.desktop @@ -1,5 +1,4 @@ [Desktop Entry] -Encoding=UTF-8 Name=CoverBling Name[bg]=CoverBling Name[bs]=CoverBling @@ -23,7 +22,7 @@ Name[it]=CoverBling Name[ja]=CoverBling Name[km]=CoverBling -Name[ko]=CoverBling +Name[ko]=반짝 표지 Name[lt]=CoverBling Name[lv]=CoverBling Name[nb]=CoverBling @@ -44,7 +43,6 @@ Name[tr]=CoverBling Name[uk]=CoverBling Name[x-test]=xxCoverBlingxx -Name[zh_CN]=封面闪烁 Name[zh_TW]=CoverBling Type=Service ServiceTypes=Plasma/Applet diff --git a/playground/src/context/applets/coverbling/pictureflow.h b/playground/src/context/applets/coverbling/pictureflow.h --- a/playground/src/context/applets/coverbling/pictureflow.h +++ b/playground/src/context/applets/coverbling/pictureflow.h @@ -68,7 +68,7 @@ /*! Creates a new PictureFlow widget. */ - PictureFlow(QWidget* parent = 0, bool enableOpenGL = false); + explicit PictureFlow(QWidget* parent = nullptr, bool enableOpenGL = false); /*! Destroys the widget. diff --git a/playground/src/context/applets/covergrid/AlbumItem.h b/playground/src/context/applets/covergrid/AlbumItem.h --- a/playground/src/context/applets/covergrid/AlbumItem.h +++ b/playground/src/context/applets/covergrid/AlbumItem.h @@ -14,6 +14,9 @@ * this program. If not, see . * ****************************************************************************************/ +#ifndef ALBUM_ITEM_H +#define ALBUM_ITEM_H + #include "core/meta/forward_declarations.h" #include @@ -28,7 +31,7 @@ Q_OBJECT public: - AlbumItem( const QPixmap & pixmap, Meta::AlbumPtr album, QWidget * parent = 0, Qt::WindowFlags f = 0 ); + AlbumItem( const QPixmap & pixmap, Meta::AlbumPtr album, QWidget * parent = nullptr, Qt::WindowFlags f = {} ); ~AlbumItem(); Meta::AlbumPtr getAlbum(); @@ -44,3 +47,4 @@ int m_size; QPixmap m_pixmap; }; +#endif diff --git a/playground/src/context/applets/covergrid/CMakeLists.txt b/playground/src/context/applets/covergrid/CMakeLists.txt --- a/playground/src/context/applets/covergrid/CMakeLists.txt +++ b/playground/src/context/applets/covergrid/CMakeLists.txt @@ -21,5 +21,5 @@ KF5::KIOCore ) -install(TARGETS amarok_context_applet_covergrid DESTINATION ${PLUGIN_INSTALL_DIR}) -install(FILES amarok-context-applet-covergrid.desktop DESTINATION ${SERVICES_INSTALL_DIR}) +install(TARGETS amarok_context_applet_covergrid DESTINATION ${KDE_INSTALL_PLUGINDIR}) +install(FILES amarok-context-applet-covergrid.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}) diff --git a/playground/src/context/applets/covergrid/amarok-context-applet-covergrid.desktop b/playground/src/context/applets/covergrid/amarok-context-applet-covergrid.desktop --- a/playground/src/context/applets/covergrid/amarok-context-applet-covergrid.desktop +++ b/playground/src/context/applets/covergrid/amarok-context-applet-covergrid.desktop @@ -1,6 +1,5 @@ [Desktop Entry] -Encoding=UTF-8 Name=CoverGrid Name[bs]=CoverGrid Name[ca]=CoverGrid @@ -22,6 +21,7 @@ Name[it]=CoverGrid Name[ja]=CoverGrid Name[km]=CoverGrid +Name[ko]=격자 표지 Name[lt]=CoverGrid Name[lv]=CoverGrid Name[nb]=Omslagsrute @@ -41,7 +41,6 @@ Name[tr]=CoverGrid Name[uk]=CoverGrid Name[x-test]=xxCoverGridxx -Name[zh_CN]=封面栅栏 Name[zh_TW]=CoverGrid Type=Service ServiceTypes=Plasma/Applet diff --git a/playground/src/scripts/bbc_service/CMakeLists.txt b/playground/src/scripts/bbc_service/CMakeLists.txt --- a/playground/src/scripts/bbc_service/CMakeLists.txt +++ b/playground/src/scripts/bbc_service/CMakeLists.txt @@ -3,6 +3,6 @@ README main.js script.spec - DESTINATION ${DATA_INSTALL_DIR}/amarok/scripts/bbc_service + DESTINATION ${KDE_INSTALL_DATADIR}/amarok/scripts/bbc_service ) diff --git a/playground/src/scripts/copycover/CMakeLists.txt b/playground/src/scripts/copycover/CMakeLists.txt --- a/playground/src/scripts/copycover/CMakeLists.txt +++ b/playground/src/scripts/copycover/CMakeLists.txt @@ -2,6 +2,6 @@ main.js script.spec copycover.ui - DESTINATION ${DATA_INSTALL_DIR}/amarok/scripts/copycover + DESTINATION ${KDE_INSTALL_DATADIR}/amarok/scripts/copycover ) diff --git a/playground/src/scripts/danish_streams_service/CMakeLists.txt b/playground/src/scripts/danish_streams_service/CMakeLists.txt --- a/playground/src/scripts/danish_streams_service/CMakeLists.txt +++ b/playground/src/scripts/danish_streams_service/CMakeLists.txt @@ -2,6 +2,6 @@ install( FILES script.spec main.js - DESTINATION ${DATA_INSTALL_DIR}/amarok/scripts/danish_streams_service + DESTINATION ${KDE_INSTALL_DATADIR}/amarok/scripts/danish_streams_service ) diff --git a/playground/src/scripts/encoding_fixer/CMakeLists.txt b/playground/src/scripts/encoding_fixer/CMakeLists.txt --- a/playground/src/scripts/encoding_fixer/CMakeLists.txt +++ b/playground/src/scripts/encoding_fixer/CMakeLists.txt @@ -2,6 +2,6 @@ script.spec main.js main.ui - DESTINATION ${DATA_INSTALL_DIR}/amarok/scripts/encoding_fixer + DESTINATION ${KDE_INSTALL_DATADIR}/amarok/scripts/encoding_fixer ) diff --git a/playground/src/scripts/npr_service/CMakeLists.txt b/playground/src/scripts/npr_service/CMakeLists.txt --- a/playground/src/scripts/npr_service/CMakeLists.txt +++ b/playground/src/scripts/npr_service/CMakeLists.txt @@ -3,6 +3,6 @@ README main.js script.spec - DESTINATION ${DATA_INSTALL_DIR}/amarok/scripts/npr_service + DESTINATION ${KDE_INSTALL_DATADIR}/amarok/scripts/npr_service ) -#ecm_install_icons( ${DATA_INSTALL_DIR}/amarok/icons ) +#ecm_install_icons( ${KDE_INSTALL_DATADIR}/amarok/icons ) diff --git a/playground/src/scripts/seeqpod_service/CMakeLists.txt b/playground/src/scripts/seeqpod_service/CMakeLists.txt --- a/playground/src/scripts/seeqpod_service/CMakeLists.txt +++ b/playground/src/scripts/seeqpod_service/CMakeLists.txt @@ -4,6 +4,6 @@ COPYING README SeeqpodService.html - DESTINATION ${DATA_INSTALL_DIR}/amarok/scripts/seeqpod_service + DESTINATION ${KDE_INSTALL_DATADIR}/amarok/scripts/seeqpod_service ) diff --git a/release_scripts/RELEASE_HOWTO b/release_scripts/RELEASE_HOWTO --- a/release_scripts/RELEASE_HOWTO +++ b/release_scripts/RELEASE_HOWTO @@ -13,14 +13,17 @@ SECTION 1: Preparation * Check the README file is still relevant - * Run the "fixuifiles" script from kdesdk from the repository root + * Run the "fixuifiles" script from kde-dev-scripts from the repository root * Run the "bump_plugin_version.rb" script from the repository root * Commit the source to git -------------------------------------------------------------------------------- SECTION 2: Creating and Testing the Tarball - * Run the amarok release script from releaseme.git (amarok2.rb) + * Run the amarok release script from releaseme.git (amarok2.rb). Like all + other release scripts for KDELibs4 based software it's deprecated and thus + lives in the kdelibs4 branch (Qt5/KF5 based releases should use tarme.rb + in the future). example: ./amarok2.rb --src ~/Code/amarok -v 2.5.90 notice it updates version in shared/Version.h * Test the following: diff --git a/shared/CMakeLists.txt b/shared/CMakeLists.txt --- a/shared/CMakeLists.txt +++ b/shared/CMakeLists.txt @@ -31,6 +31,9 @@ ${amarokshared_collectionscanner_SRCS} ${amarokshared_tag_helpers_SRCS} ) +generate_export_header(amarokshared BASE_NAME amarokshared) + + target_include_directories( amarokshared PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ) include_directories( ${TAGLIB_INCLUDES} ) diff --git a/shared/FileType.cpp b/shared/FileType.cpp --- a/shared/FileType.cpp +++ b/shared/FileType.cpp @@ -21,24 +21,24 @@ static QStringList s_fileTypeStrings = QStringList() << QLatin1String( "" ) - << QLatin1String( "mp3" ) - << QLatin1String( "ogg" ) - << QLatin1String( "flac" ) - << QLatin1String( "mp4" ) - << QLatin1String( "wma" ) - << QLatin1String( "aiff" ) - << QLatin1String( "mpc" ) - << QLatin1String( "tta" ) - << QLatin1String( "wav" ) - << QLatin1String( "wv" ) - << QLatin1String( "m4a" ) - << QLatin1String( "m4v" ) - << QLatin1String( "mod" ) - << QLatin1String( "s3m" ) - << QLatin1String( "it" ) - << QLatin1String( "xm" ) - << QLatin1String( "spx" ) - << QLatin1String( "opus" ); + << QStringLiteral( "mp3" ) + << QStringLiteral( "ogg" ) + << QStringLiteral( "flac" ) + << QStringLiteral( "mp4" ) + << QStringLiteral( "wma" ) + << QStringLiteral( "aiff" ) + << QStringLiteral( "mpc" ) + << QStringLiteral( "tta" ) + << QStringLiteral( "wav" ) + << QStringLiteral( "wv" ) + << QStringLiteral( "m4a" ) + << QStringLiteral( "m4v" ) + << QStringLiteral( "mod" ) + << QStringLiteral( "s3m" ) + << QStringLiteral( "it" ) + << QStringLiteral( "xm" ) + << QStringLiteral( "spx" ) + << QStringLiteral( "opus" ); QString FileTypeSupport::toString( Amarok::FileType ft ) diff --git a/shared/FileTypeResolver.h b/shared/FileTypeResolver.h --- a/shared/FileTypeResolver.h +++ b/shared/FileTypeResolver.h @@ -35,7 +35,7 @@ { TagLib::File *createFile(TagLib::FileName fileName, bool readAudioProperties, - TagLib::AudioProperties::ReadStyle audioPropertiesStyle) const; + TagLib::AudioProperties::ReadStyle audioPropertiesStyle) const override; public: virtual ~FileTypeResolver() {} diff --git a/shared/FileTypeResolver.cpp b/shared/FileTypeResolver.cpp --- a/shared/FileTypeResolver.cpp +++ b/shared/FileTypeResolver.cpp @@ -70,21 +70,21 @@ QMimeType mimetype = db.mimeTypeForFile( fn ); // -- check by mime type - if( mimetype.inherits( QLatin1String("audio/mpeg") ) - || mimetype.inherits( QLatin1String("audio/x-mpegurl") ) - || mimetype.inherits( QLatin1String("audio/mpeg") )) + if( mimetype.inherits( QStringLiteral("audio/mpeg") ) + || mimetype.inherits( QStringLiteral("audio/x-mpegurl") ) + || mimetype.inherits( QStringLiteral("audio/mpeg") )) { result = new TagLib::MPEG::File(fileName, readProperties, propertiesStyle); } - else if( mimetype.inherits( QLatin1String("audio/mp4") ) - || mimetype.inherits( QLatin1String("video/mp4") ) ) + else if( mimetype.inherits( QStringLiteral("audio/mp4") ) + || mimetype.inherits( QStringLiteral("video/mp4") ) ) { result = new TagLib::MP4::File(fileName, readProperties, propertiesStyle); } - else if( mimetype.inherits( QLatin1String("audio/x-ms-wma") ) - || mimetype.inherits( QLatin1String("video/x-ms-asf") ) - || mimetype.inherits( QLatin1String("video/x-msvideo") ) - || mimetype.inherits( QLatin1String("video/x-ms-wmv") ) ) + else if( mimetype.inherits( QStringLiteral("audio/x-ms-wma") ) + || mimetype.inherits( QStringLiteral("video/x-ms-asf") ) + || mimetype.inherits( QStringLiteral("video/x-msvideo") ) + || mimetype.inherits( QStringLiteral("video/x-ms-wmv") ) ) { result = new TagLib::ASF::File(fileName, readProperties, propertiesStyle); } @@ -97,64 +97,64 @@ } #endif #ifdef TAGLIB_OPUS_FOUND - else if( mimetype.inherits( QLatin1String("audio/opus") ) - || mimetype.inherits( QLatin1String("audio/x-opus+ogg") ) ) + else if( mimetype.inherits( QStringLiteral("audio/opus") ) + || mimetype.inherits( QStringLiteral("audio/x-opus+ogg") ) ) { result = new TagLib::Ogg::Opus::File(fileName, readProperties, propertiesStyle); } #endif - else if( mimetype.inherits( QLatin1String("audio/vorbis") ) - || mimetype.inherits( QLatin1String("audio/x-vorbis+ogg") ) ) + else if( mimetype.inherits( QStringLiteral("audio/vorbis") ) + || mimetype.inherits( QStringLiteral("audio/x-vorbis+ogg") ) ) { result = new TagLib::Ogg::Vorbis::File(fileName, readProperties, propertiesStyle); } - else if( mimetype.inherits( QLatin1String("audio/x-flac+ogg") ) ) + else if( mimetype.inherits( QStringLiteral("audio/x-flac+ogg") ) ) { result = new TagLib::Ogg::FLAC::File(fileName, readProperties, propertiesStyle); } - else if( mimetype.inherits( QLatin1String("audio/x-aiff") ) ) + else if( mimetype.inherits( QStringLiteral("audio/x-aiff") ) ) { result = new TagLib::RIFF::AIFF::File(fileName, readProperties, propertiesStyle); } - else if( mimetype.inherits( QLatin1String("audio/x-flac") ) ) + else if( mimetype.inherits( QStringLiteral("audio/x-flac") ) ) { result = new TagLib::FLAC::File(fileName, readProperties, propertiesStyle); } - else if( mimetype.inherits( QLatin1String("audio/x-musepack") ) ) + else if( mimetype.inherits( QStringLiteral("audio/x-musepack") ) ) { result = new TagLib::MPC::File(fileName, readProperties, propertiesStyle); } - else if( mimetype.inherits( QLatin1String("audio/x-wav") ) ) + else if( mimetype.inherits( QStringLiteral("audio/x-wav") ) ) { result = new TagLib::RIFF::WAV::File(fileName, readProperties, propertiesStyle); } - else if( mimetype.inherits( QLatin1String("audio/x-wavpack") ) ) + else if( mimetype.inherits( QStringLiteral("audio/x-wavpack") ) ) { result = new TagLib::WavPack::File(fileName, readProperties, propertiesStyle); } - else if( mimetype.inherits( QLatin1String("audio/x-tta") ) ) + else if( mimetype.inherits( QStringLiteral("audio/x-tta") ) ) { result = new TagLib::TrueAudio::File(fileName, readProperties, propertiesStyle); } - else if( mimetype.inherits( QLatin1String("audio/x-speex") ) - || mimetype.inherits( QLatin1String("audio/x-speex+ogg") ) ) + else if( mimetype.inherits( QStringLiteral("audio/x-speex") ) + || mimetype.inherits( QStringLiteral("audio/x-speex+ogg") ) ) { result = new TagLib::Ogg::Speex::File(fileName, readProperties, propertiesStyle); } #ifdef TAGLIB_MOD_FOUND - else if( mimetype.inherits( QLatin1String("audio/x-mod") ) ) + else if( mimetype.inherits( QStringLiteral("audio/x-mod") ) ) { result = new TagLib::Mod::File(fileName, readProperties, propertiesStyle); } - else if( mimetype.inherits( QLatin1String("audio/x-s3m") ) ) + else if( mimetype.inherits( QStringLiteral("audio/x-s3m") ) ) { result = new TagLib::S3M::File(fileName, readProperties, propertiesStyle); } - else if( mimetype.inherits( QLatin1String("audio/x-it") ) ) + else if( mimetype.inherits( QStringLiteral("audio/x-it") ) ) { result = new TagLib::IT::File(fileName, readProperties, propertiesStyle); } - else if( mimetype.inherits( QLatin1String("audio/x-xm") ) ) + else if( mimetype.inherits( QStringLiteral("audio/x-xm") ) ) { result = new TagLib::XM::File(fileName, readProperties, propertiesStyle); } @@ -189,13 +189,13 @@ #ifndef Q_WS_WIN if( !result ) - qDebug() << QString( "FileTypeResolver: file %1 (mimetype %2) not recognized as " - "Amarok-compatible" ).arg( fileName, mimetype.name() ).toLocal8Bit().data(); + qDebug() << QStringLiteral( "FileTypeResolver: file %1 (mimetype %2) not recognized as " + "Amarok-compatible" ).arg( QString::fromLatin1(fileName), mimetype.name() ); #endif if( result && !result->isValid() ) { delete result; - result = 0; + result = nullptr; } return result; diff --git a/shared/MetaReplayGain.cpp b/shared/MetaReplayGain.cpp --- a/shared/MetaReplayGain.cpp +++ b/shared/MetaReplayGain.cpp @@ -113,7 +113,7 @@ static void maybeAddGain( const TagLib::String &input, Meta::ReplayGainTag key, Meta::ReplayGainTagMap *map ) { - QString value = TStringToQString( input ).remove( " dB" ); + QString value = TStringToQString( input ).remove( QStringLiteral(" dB") ); bool ok = false; qreal gain = value.toFloat( &ok ); if (ok) @@ -134,7 +134,7 @@ // ID3v2 frame header is 10 bytes, so skip that TagLib::ByteVector data = frames[i]->render().mid( 10 ); unsigned int offset = 0; - QString desc( data.data() ); + QString desc( QString::fromLatin1(data.data()) ); offset += desc.count() + 1; unsigned int channel = data.mid( offset, 1 ).toUInt( true ); // channel 1 is the main volume - the only one we care about @@ -150,12 +150,12 @@ qreal peak = readRVA2PeakValue( data.mid( offset ), peakBits, &ok ); if ( ok ) { - if ( desc.toLower() == "album" ) + if ( desc.toLower() == QLatin1String("album") ) { map[Meta::ReplayGain_Album_Gain] = adjustment; map[Meta::ReplayGain_Album_Peak] = peakToDecibels( peak ); } - else if ( desc.toLower() == "track" || !map.contains( Meta::ReplayGain_Track_Gain ) ) + else if ( desc.toLower() == QLatin1String("track") || !map.contains( Meta::ReplayGain_Track_Gain ) ) { map[Meta::ReplayGain_Track_Gain] = adjustment; map[Meta::ReplayGain_Track_Peak] = peakToDecibels( peak ); @@ -176,13 +176,13 @@ if ( frame && frame->fieldList().size() >= 2 ) { QString desc = TStringToQString( frame->description() ).toLower(); - if ( desc == "replaygain_album_gain" ) + if ( desc == QLatin1String("replaygain_album_gain") ) maybeAddGain( frame->fieldList()[1], Meta::ReplayGain_Album_Gain, &map ); - if ( desc == "replaygain_album_peak" ) + if ( desc == QLatin1String("replaygain_album_peak") ) maybeAddPeak( frame->fieldList()[1], Meta::ReplayGain_Album_Peak, &map ); - if ( desc == "replaygain_track_gain" ) + if ( desc == QLatin1String("replaygain_track_gain") ) maybeAddGain( frame->fieldList()[1], Meta::ReplayGain_Track_Gain, &map ); - if ( desc == "replaygain_track_peak" ) + if ( desc == QLatin1String("replaygain_track_peak") ) maybeAddPeak( frame->fieldList()[1], Meta::ReplayGain_Track_Peak, &map ); } } diff --git a/shared/MetaTagLib.h b/shared/MetaTagLib.h --- a/shared/MetaTagLib.h +++ b/shared/MetaTagLib.h @@ -42,7 +42,7 @@ * * @param path path of the file to write the tags to * @param changes Meta:val* key to value map of tags to write - * @param writeBackStatistics whether to include statistics-related tags when writing + * @param writeStatistics whether to include statistics-related tags when writing * * @see WriteTagsJob */ diff --git a/shared/MetaTagLib.cpp b/shared/MetaTagLib.cpp --- a/shared/MetaTagLib.cpp +++ b/shared/MetaTagLib.cpp @@ -152,7 +152,6 @@ char databuf[16384]; int readlen = 0; - QString returnval; if( qfile.open( QIODevice::ReadOnly ) ) { @@ -170,7 +169,7 @@ else addRandomness( &md5 ); - return QString( md5.result().toHex() ); + return QString::fromLatin1( md5.result().toHex() ); } @@ -257,7 +256,7 @@ //we didn't set a FileType till now, let's look it up via FileExtension if( !result.contains( Meta::valFormat ) ) { - QString ext = path.mid( path.lastIndexOf( '.' ) + 1 ); + QString ext = path.mid( path.lastIndexOf( QLatin1Char('.') ) + 1 ); result.insert( Meta::valFormat, Amarok::FileTypeSupport::fileType( ext ) ); } diff --git a/shared/TagsFromFileNameGuesser.h b/shared/TagsFromFileNameGuesser.h --- a/shared/TagsFromFileNameGuesser.h +++ b/shared/TagsFromFileNameGuesser.h @@ -31,15 +31,15 @@ * Try to guess metadata from file name, using common filename * templates, can't work with full file path. * @arg fileName file name, if fileName contains full path, It will be - * truckated. + * truncated. * @returns guessed metadata. */ AMAROKSHARED_EXPORT Meta::FieldHash guessTags( const QString &fileName ); /** - * Try to guess metadata from fil name,using specified scheme. + * Try to guess metadata from file name,using specified scheme. * @arg fileName file path - * @arg scheme is a regular exprassion with tokens + * @arg scheme is a regular expression with tokens * @arg cutTrailingSpaces - if true - force guesser to cut trailing spaces * @arg convertUnderscores - if true - force guesser too replace all underscores with spaces * @arg isRegExp - if true - prevents guesser from screening special symbols diff --git a/shared/TagsFromFileNameGuesser.cpp b/shared/TagsFromFileNameGuesser.cpp --- a/shared/TagsFromFileNameGuesser.cpp +++ b/shared/TagsFromFileNameGuesser.cpp @@ -20,55 +20,55 @@ const QStringList m_schemes( QStringList() //01 Artist - Title.ext - << "^%track%\\W*-?\\W*%artist%\\W*-\\W*%title%\\.+(?:\\w{2,5})$" + << QStringLiteral("^%track%\\W*-?\\W*%artist%\\W*-\\W*%title%\\.+(?:\\w{2,5})$") //01 Title.ext - << "^%track%\\W*-?\\W*%title%\\.+?:\\w{2,5}$" + << QStringLiteral("^%track%\\W*-?\\W*%title%\\.+?:\\w{2,5}$") //Album - 01 - Artist - Title.ext - << "^%album%\\W*-\\W*%track%\\W*-\\W*%artist%\\W*-\\W*%title%\\.+(?:\\w{2,5})$" + << QStringLiteral("^%album%\\W*-\\W*%track%\\W*-\\W*%artist%\\W*-\\W*%title%\\.+(?:\\w{2,5})$") //Artist - Album - 01 - Title.ext - << "^%artist%\\W*-\\W*%album%\\W*-\\W*%track%\\W*-\\W*%title%\\.+(?:\\w{2,5})$" + << QStringLiteral("^%artist%\\W*-\\W*%album%\\W*-\\W*%track%\\W*-\\W*%title%\\.+(?:\\w{2,5})$") // Artist - Album - Title.ext - << "^%artist%\\W*-\\W*%album%\\W*-\\W*%title%\\.+(?:\\w{2,5})$" + << QStringLiteral("^%artist%\\W*-\\W*%album%\\W*-\\W*%title%\\.+(?:\\w{2,5})$") //Artist - Title.ext - << "^%artist%\\W*-\\W*%title%\\.+(?:\\w{2,5})$" + << QStringLiteral("^%artist%\\W*-\\W*%title%\\.+(?:\\w{2,5})$") //Title.ext - << "^%title%\\.+(?:\\w{2,5})$" + << QStringLiteral("^%title%\\.+(?:\\w{2,5})$") ); -const QRegExp m_digitalFields( "(%(?:discnumber|track|year)%)" ); -const QRegExp m_literalFields( "(%(?:album|albumartist|artist|comment|composer|genre|title)%)" ); +const QRegExp m_digitalFields( QStringLiteral("(%(?:discnumber|track|year)%)") ); +const QRegExp m_literalFields( QStringLiteral("(%(?:album|albumartist|artist|comment|composer|genre|title)%)") ); quint64 fieldName( const QString &field ) { - if( field == "album" ) + if( field == QLatin1String("album") ) return Meta::valAlbum; - else if( field == "albumartist" ) + else if( field == QLatin1String("albumartist") ) return Meta::valAlbumArtist; - else if( field == "artist" ) + else if( field == QLatin1String("artist") ) return Meta::valArtist; - else if( field == "comment" ) + else if( field == QLatin1String("comment") ) return Meta::valComment; - else if( field == "composer" ) + else if( field == QLatin1String("composer") ) return Meta::valComposer; - else if( field == "discnumber" ) + else if( field == QLatin1String("discnumber") ) return Meta::valDiscNr; - else if( field == "genre" ) + else if( field == QLatin1String("genre") ) return Meta::valGenre; - else if( field == "title" ) + else if( field == QLatin1String("title") ) return Meta::valTitle; - else if( field == "track" ) + else if( field == QLatin1String("track") ) return Meta::valTrackNr; - else if( field == "year" ) + else if( field == QLatin1String("year") ) return Meta::valYear; return 0; } QList< qint64 > parseTokens( const QString &scheme ) { - QRegExp rxm( "%(\\w+)%" ); + QRegExp rxm( QStringLiteral("%(\\w+)%") ); QList< qint64 > tokens; int pos = 0; @@ -100,13 +100,13 @@ // Screen all special symbols if( !isRegExp ) - m_scheme = m_scheme.replace( QRegExp( "([~!\\^&*()\\-+\\[\\]{}\\\\:\"?\\.])" ),"\\\\1" ); + m_scheme = m_scheme.replace( QRegExp( QStringLiteral("([~!\\^&*()\\-+\\[\\]{}\\\\:\"?\\.])" )), QStringLiteral("\\\\1") ); - QRegExp spaces( "(\\s+)" ); - rx.setPattern( m_scheme.replace( spaces, "\\s+" ) - .replace( m_digitalFields, "(\\d+)" ) - .replace( m_literalFields, "(.+)" ) - .replace( "%ignore%", "(?:.+)" ) ); + QRegExp spaces( QStringLiteral("(\\s+)") ); + rx.setPattern( m_scheme.replace( spaces, QStringLiteral("\\s+") ) + .replace( m_digitalFields, QStringLiteral("(\\d+)") ) + .replace( m_literalFields, QStringLiteral("(.+)") ) + .replace( QLatin1String("%ignore%"), QLatin1String("(?:.+)") ) ); if( !rx.exactMatch( m_fileName ) ) return metadata; @@ -116,7 +116,7 @@ { value = rx.cap( i + 1 ); if( convertUnderscores ) - value.replace( '_', ' ' ); + value.replace( QLatin1Char('_'), QLatin1Char(' ') ); if( cutTrailingSpaces ) value = value.trimmed(); metadata.insert( tokens[i], value ); @@ -129,7 +129,7 @@ { QString tmpStr = fileName; int pos = 0; - if( ( pos = fileName.lastIndexOf( '/' ) ) != -1 ) + if( ( pos = fileName.lastIndexOf( QLatin1Char('/') ) ) != -1 ) tmpStr = fileName.mid( pos + 1 ); foreach( const QString &scheme, m_schemes ) diff --git a/shared/Version.h b/shared/Version.h --- a/shared/Version.h +++ b/shared/Version.h @@ -18,6 +18,6 @@ #define AMAROK_VERSION_H /// Update this when necessary -#define AMAROK_VERSION "2.8-git" +#define AMAROK_VERSION "2.9.70" #endif // End include guard diff --git a/shared/amarokshared_export.h b/shared/amarokshared_export.h deleted file mode 100644 --- a/shared/amarokshared_export.h +++ /dev/null @@ -1,33 +0,0 @@ -/**************************************************************************************** - * Copyright (c) 2013 Matěj Laitl * - * * - * This program is free software; you can redistribute it and/or modify it under * - * the terms of the GNU General Public License as published by the Free Software * - * Foundation; either version 2 of the License, or (at your option) any later * - * version. * - * * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY * - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * - * PARTICULAR PURPOSE. See the GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License along with * - * this program. If not, see . * - ****************************************************************************************/ - -#ifndef AMAROKSHARED_EXPORT_H -#define AMAROKSHARED_EXPORT_H - -/* needed for Q_DECL_EXPORT and Q_DECL_IMPORT macros */ -#include - -#ifndef AMAROKSHARED_EXPORT -# ifdef MAKE_AMAROKSHARED_LIB - /* We are building this library */ -# define AMAROKSHARED_EXPORT Q_DECL_EXPORT -# else - /* We are using this library */ -# define AMAROKSHARED_EXPORT Q_DECL_IMPORT -# endif -#endif // AMAROKSHARED_EXPORT - -#endif // AMAROKSHARED_EXPORT_H diff --git a/shared/collectionscanner/Album.cpp b/shared/collectionscanner/Album.cpp --- a/shared/collectionscanner/Album.cpp +++ b/shared/collectionscanner/Album.cpp @@ -70,7 +70,7 @@ // IMPROVEMENT: skip covers that have a strange aspect ratio or are // unrealistically small, or do not resolve to a valid image if( track->hasCover() ) - return QLatin1String("amarok-sqltrackuid://") + track->uniqueid(); + return QStringLiteral("amarok-sqltrackuid://") + track->uniqueid(); } // ok. Now we have to figure out which of the cover images is diff --git a/shared/collectionscanner/BatchFile.h b/shared/collectionscanner/BatchFile.h --- a/shared/collectionscanner/BatchFile.h +++ b/shared/collectionscanner/BatchFile.h @@ -43,7 +43,7 @@ BatchFile(); /** Reads the BatchFile from the disk */ - BatchFile( const QString &path ); + explicit BatchFile( const QString &path ); /** This type is a pair of directory path and modification time */ typedef QPair TimeDefinition; diff --git a/shared/collectionscanner/BatchFile.cpp b/shared/collectionscanner/BatchFile.cpp --- a/shared/collectionscanner/BatchFile.cpp +++ b/shared/collectionscanner/BatchFile.cpp @@ -126,25 +126,25 @@ writer.setAutoFormatting( true ); writer.writeStartDocument(); - writer.writeStartElement( QLatin1String("scanner") ); - writer.writeComment("Batch file for amarokcollectionscanner " AMAROK_VERSION " created on "+QDateTime::currentDateTime().toString()); + writer.writeStartElement( QStringLiteral("scanner") ); + writer.writeComment(QStringLiteral("Batch file for amarokcollectionscanner ") + QLatin1String(AMAROK_VERSION) + QStringLiteral(" created on ") + QDateTime::currentDateTime().toString()); foreach( const QString &dir, m_directories ) { - writer.writeStartElement( QLatin1String("directory") ); - writer.writeTextElement( QLatin1String("path"), dir ); + writer.writeStartElement( QStringLiteral("directory") ); + writer.writeTextElement( QStringLiteral("path"), dir ); writer.writeEndElement(); } foreach( const TimeDefinition &pair, m_timeDefinitions ) { QString path( pair.first ); uint mtime = pair.second; - writer.writeStartElement( QLatin1String("directory") ); - writer.writeTextElement( QLatin1String("path"), path ); + writer.writeStartElement( QStringLiteral("directory") ); + writer.writeTextElement( QStringLiteral("path"), path ); // note: some file systems return an mtime of 0 - writer.writeTextElement( QLatin1String("mtime"), QString::number( mtime ) ); + writer.writeTextElement( QStringLiteral("mtime"), QString::number( mtime ) ); writer.writeEndElement(); } diff --git a/shared/collectionscanner/Directory.h b/shared/collectionscanner/Directory.h --- a/shared/collectionscanner/Directory.h +++ b/shared/collectionscanner/Directory.h @@ -44,15 +44,15 @@ { public: /** - * This contructor actually scans the directory and is supposed only to be + * This constructor actually scans the directory and is supposed only to be * called by CollectionScanner directly. */ Directory( const QString &path, ScanningState *state, bool skip ); /** Reads a directory from an xml stream. * @see toXml() */ - Directory( QXmlStreamReader *reader ); + explicit Directory( QXmlStreamReader *reader ); ~Directory(); @@ -78,7 +78,7 @@ const QList& playlists() const; /** Writes the contents of this object to an xml stream. - * Only the content is writen and no enclosing directory tags. + * Only the content is written and no enclosing directory tags. * This is done to make it mirror the constructor which does not read those * tags either. */ @@ -91,7 +91,7 @@ QString m_rpath; uint m_mtime; bool m_skipped; - bool m_ignored; // the directory was ingored e.g. because of "fmps_ignore" + bool m_ignored; // the directory was ignored e.g. because of "fmps_ignore" QStringList m_covers; QList m_tracks; diff --git a/shared/collectionscanner/Directory.cpp b/shared/collectionscanner/Directory.cpp --- a/shared/collectionscanner/Directory.cpp +++ b/shared/collectionscanner/Directory.cpp @@ -53,16 +53,16 @@ return; QDir dir( path ); - if( dir.exists( "fmps_ignore" ) ) + if( dir.exists( QStringLiteral("fmps_ignore") ) ) { m_ignored = true; return; } QStringList validImages; - validImages << "jpg" << "png" << "gif" << "jpeg" << "bmp" << "svg" << "xpm"; + validImages << QStringLiteral("jpg") << QStringLiteral("png") << QStringLiteral("gif") << QStringLiteral("jpeg") << QStringLiteral("bmp") << QStringLiteral("svg") << QStringLiteral("xpm"); QStringList validPlaylists; - validPlaylists << "m3u" << "pls" << "xspf"; + validPlaylists << QStringLiteral("m3u") << QStringLiteral("pls") << QStringLiteral("xspf"); // --- check if we were restarted and failed at a file QStringList badFiles; @@ -132,27 +132,27 @@ if( reader->isStartElement() ) { QStringRef name = reader->name(); - if( name == "path" ) + if( name == QLatin1String("path") ) m_path = reader->readElementText(QXmlStreamReader::SkipChildElements); - else if( name == "rpath" ) + else if( name == QLatin1String("rpath") ) m_rpath = reader->readElementText(QXmlStreamReader::SkipChildElements); - else if( name == "mtime" ) + else if( name == QLatin1String("mtime") ) m_mtime = reader->readElementText(QXmlStreamReader::SkipChildElements).toUInt(); - else if( name == "cover" ) + else if( name == QLatin1String("cover") ) m_covers.append(reader->readElementText(QXmlStreamReader::SkipChildElements)); - else if( name == "skipped" ) + else if( name == QLatin1String("skipped") ) { m_skipped = true; reader->skipCurrentElement(); } - else if( name == "ignored" ) + else if( name == QLatin1String("ignored") ) { m_ignored = true; reader->skipCurrentElement(); } - else if( name == "track" ) + else if( name == QLatin1String("track") ) m_tracks.append( new CollectionScanner::Track( reader, this ) ); - else if( name == "playlist" ) + else if( name == QLatin1String("playlist") ) m_playlists.append( CollectionScanner::Playlist( reader ) ); else { @@ -219,28 +219,28 @@ void CollectionScanner::Directory::toXml( QXmlStreamWriter *writer ) const { - writer->writeTextElement( "path", escapeXml10(m_path) ); - writer->writeTextElement( "rpath", escapeXml10(m_rpath) ); - writer->writeTextElement( "mtime", QString::number( m_mtime ) ); + writer->writeTextElement( QStringLiteral("path"), escapeXml10(m_path) ); + writer->writeTextElement( QStringLiteral("rpath"), escapeXml10(m_rpath) ); + writer->writeTextElement( QStringLiteral("mtime"), QString::number( m_mtime ) ); if( m_skipped ) - writer->writeEmptyElement( "skipped" ); + writer->writeEmptyElement( QStringLiteral("skipped") ); if( m_ignored ) - writer->writeEmptyElement( "ignored" ); + writer->writeEmptyElement( QStringLiteral("ignored") ); foreach( const QString &cover, m_covers ) { - writer->writeTextElement( "cover", escapeXml10(cover) ); + writer->writeTextElement( QStringLiteral("cover"), escapeXml10(cover) ); } foreach( CollectionScanner::Track *track, m_tracks ) { - writer->writeStartElement( QLatin1String("track") ); + writer->writeStartElement( QStringLiteral("track") ); track->toXml( writer ); writer->writeEndElement(); } foreach( const CollectionScanner::Playlist &playlist, m_playlists ) { - writer->writeStartElement( "playlist" ); + writer->writeStartElement( QStringLiteral("playlist") ); playlist.toXml( writer ); writer->writeEndElement(); } diff --git a/shared/collectionscanner/Playlist.h b/shared/collectionscanner/Playlist.h --- a/shared/collectionscanner/Playlist.h +++ b/shared/collectionscanner/Playlist.h @@ -37,8 +37,8 @@ class AMAROKSHARED_EXPORT Playlist { public: - Playlist( const QString &path ); - Playlist( QXmlStreamReader *reader ); + explicit Playlist( const QString &path ); + explicit Playlist( QXmlStreamReader *reader ); /** The absolute path to the file. * Because of symbolic links the path could be outside the original scanning directories. @@ -50,7 +50,7 @@ /** Writes the contents of this object to an xml stream. - * Only the content is writen and no enclosing directory tags. + * Only the content is written and no enclosing directory tags. * This is done to make it mirror the constructor which does not read those * tags either. */ diff --git a/shared/collectionscanner/Playlist.cpp b/shared/collectionscanner/Playlist.cpp --- a/shared/collectionscanner/Playlist.cpp +++ b/shared/collectionscanner/Playlist.cpp @@ -67,6 +67,6 @@ void CollectionScanner::Playlist::toXml( QXmlStreamWriter *writer ) const { - writer->writeTextElement( QLatin1String("path"), escapeXml10(m_path) ); - writer->writeTextElement( QLatin1String("rpath"), escapeXml10(m_rpath) ); + writer->writeTextElement( QStringLiteral("path"), escapeXml10(m_path) ); + writer->writeTextElement( QStringLiteral("rpath"), escapeXml10(m_rpath) ); } diff --git a/shared/collectionscanner/Track.h b/shared/collectionscanner/Track.h --- a/shared/collectionscanner/Track.h +++ b/shared/collectionscanner/Track.h @@ -49,7 +49,7 @@ Track( QXmlStreamReader *reader, Directory* directory ); /** Writes the contents of this object to an xml stream. - Only the content is writen and no enclosing directory tags. + Only the content is written and no enclosing directory tags. This is done to make it mirror the constructor which does not read those tags either. */ diff --git a/shared/collectionscanner/Track.cpp b/shared/collectionscanner/Track.cpp --- a/shared/collectionscanner/Track.cpp +++ b/shared/collectionscanner/Track.cpp @@ -68,7 +68,7 @@ // for the unit test. // in a debug build a file called "crash_amarok_here.ogg" will crash the collection // scanner - if( path.contains("crash_amarok_here.ogg") ) + if( path.contains(QLatin1String("crash_amarok_here.ogg")) ) { qDebug() << "Crashing at"<writeEmptyElement( QLatin1String("compilation") ); + writer->writeEmptyElement( QStringLiteral("compilation") ); if( m_noCompilation ) - writer->writeEmptyElement( QLatin1String("noCompilation") ); + writer->writeEmptyElement( QStringLiteral("noCompilation") ); if( m_hasCover ) - writer->writeEmptyElement( QLatin1String("hasCover") ); - write( writer, QLatin1String("comment"), m_comment); - write( writer, QLatin1String("genre"), m_genre); + writer->writeEmptyElement( QStringLiteral("hasCover") ); + write( writer, QStringLiteral("comment"), m_comment); + write( writer, QStringLiteral("genre"), m_genre); if( m_year != -1 ) - write(writer, QLatin1String("year"), QString::number( m_year ) ); + write(writer, QStringLiteral("year"), QString::number( m_year ) ); if( m_disc != -1 ) - write(writer, QLatin1String("disc"), QString::number( m_disc ) ); + write(writer, QStringLiteral("disc"), QString::number( m_disc ) ); if( m_track != -1 ) - write(writer, QLatin1String("track"), QString::number( m_track ) ); + write(writer, QStringLiteral("track"), QString::number( m_track ) ); if( m_bpm != -1 ) - write(writer, QLatin1String("bpm"), QString::number( m_bpm ) ); + write(writer, QStringLiteral("bpm"), QString::number( m_bpm ) ); if( m_bitrate != -1 ) - write(writer, QLatin1String("bitrate"), QString::number( m_bitrate ) ); + write(writer, QStringLiteral("bitrate"), QString::number( m_bitrate ) ); if( m_length != -1 ) - write(writer, QLatin1String("length"), QString::number( m_length ) ); + write(writer, QStringLiteral("length"), QString::number( m_length ) ); if( m_samplerate != -1 ) - write(writer, QLatin1String("samplerate"), QString::number( m_samplerate ) ); + write(writer, QStringLiteral("samplerate"), QString::number( m_samplerate ) ); if( m_filesize != -1 ) - write(writer, QLatin1String("filesize"), QString::number( m_filesize ) ); + write(writer, QStringLiteral("filesize"), QString::number( m_filesize ) ); if( m_modified.isValid() ) - write(writer, QLatin1String("mtime"), QString::number( m_modified.toTime_t() ) ); + write(writer, QStringLiteral("mtime"), QString::number( m_modified.toTime_t() ) ); if( m_trackGain != 0 ) - write(writer, QLatin1String("trackGain"), QString::number( m_trackGain ) ); + write(writer, QStringLiteral("trackGain"), QString::number( m_trackGain ) ); if( m_trackPeakGain != 0 ) - write(writer, QLatin1String("trackPeakGain"), QString::number( m_trackPeakGain ) ); + write(writer, QStringLiteral("trackPeakGain"), QString::number( m_trackPeakGain ) ); if( m_albumGain != 0 ) - write(writer, QLatin1String("albumGain"), QString::number( m_albumGain ) ); + write(writer, QStringLiteral("albumGain"), QString::number( m_albumGain ) ); if( m_albumPeakGain != 0 ) - write(writer, QLatin1String("albumPeakGain"), QString::number( m_albumPeakGain ) ); + write(writer, QStringLiteral("albumPeakGain"), QString::number( m_albumPeakGain ) ); - write( writer, QLatin1String("composer"), m_composer); + write( writer, QStringLiteral("composer"), m_composer); if( m_rating != -1 ) - write(writer, QLatin1String("rating"), QString::number( m_rating ) ); + write(writer, QStringLiteral("rating"), QString::number( m_rating ) ); if( m_score != -1 ) - write(writer, QLatin1String("score"), QString::number( m_score ) ); + write(writer, QStringLiteral("score"), QString::number( m_score ) ); if( m_playcount != -1 ) - write(writer, QLatin1String("playcount"), QString::number( m_playcount ) ); + write(writer, QStringLiteral("playcount"), QString::number( m_playcount ) ); } diff --git a/shared/config.h.cmake b/shared/config.h.cmake --- a/shared/config.h.cmake +++ b/shared/config.h.cmake @@ -15,9 +15,6 @@ /* have QtCrypto the Qt crypto architecture */ #cmakedefine QCA2_FOUND 1 -/* have Qt bindings */ -#cmakedefine QTSCRIPTQTBINDINGS_FOUND 1 - /* have QtOpenGL */ #cmakedefine QT_QTOPENGL_FOUND 1 diff --git a/shared/tag_helpers/APETagHelper.h b/shared/tag_helpers/APETagHelper.h --- a/shared/tag_helpers/APETagHelper.h +++ b/shared/tag_helpers/APETagHelper.h @@ -30,10 +30,10 @@ public: APETagHelper( TagLib::Tag *tag, TagLib::APE::Tag *apeTag, Amarok::FileType fileType ); - virtual Meta::FieldHash tags() const; - virtual bool setTags( const Meta::FieldHash &changes ); + Meta::FieldHash tags() const override; + bool setTags( const Meta::FieldHash &changes ) override; - virtual TagLib::ByteVector render() const; + TagLib::ByteVector render() const override; private: TagLib::APE::Tag *m_tag; diff --git a/shared/tag_helpers/ASFTagHelper.h b/shared/tag_helpers/ASFTagHelper.h --- a/shared/tag_helpers/ASFTagHelper.h +++ b/shared/tag_helpers/ASFTagHelper.h @@ -31,12 +31,12 @@ public: ASFTagHelper( TagLib::Tag *tag, TagLib::ASF::Tag *asfTag, Amarok::FileType fileType ); - virtual Meta::FieldHash tags() const; - virtual bool setTags( const Meta::FieldHash &changes ); + Meta::FieldHash tags() const override; + bool setTags( const Meta::FieldHash &changes ) override; - virtual bool hasEmbeddedCover() const; - virtual QImage embeddedCover() const; - virtual bool setEmbeddedCover(const QImage &cover); + bool hasEmbeddedCover() const override; + QImage embeddedCover() const override; + bool setEmbeddedCover(const QImage &cover) override; private: TagLib::ASF::Tag *m_tag; diff --git a/shared/tag_helpers/ASFTagHelper.cpp b/shared/tag_helpers/ASFTagHelper.cpp --- a/shared/tag_helpers/ASFTagHelper.cpp +++ b/shared/tag_helpers/ASFTagHelper.cpp @@ -32,7 +32,7 @@ { m_fieldMap.insert( Meta::valAlbumArtist, TagLib::String( "WM/AlbumArtist" ) ); m_fieldMap.insert( Meta::valBpm, TagLib::String( "WM/BeatsPerMinute" ) ); - m_fieldMap.insert( Meta::valCompilation, TagLib::String( "Amarok/Compilation" ) ); //Not standatd tag + m_fieldMap.insert( Meta::valCompilation, TagLib::String( "Amarok/Compilation" ) ); //Not standard tag m_fieldMap.insert( Meta::valComposer, TagLib::String( "WM/Composer" ) ); m_fieldMap.insert( Meta::valDiscNr, TagLib::String( "WM/PartOfSet" ) ); m_fieldMap.insert( Meta::valHasCover, TagLib::String( "WM/Picture" ) ); diff --git a/shared/tag_helpers/ID3v2TagHelper.h b/shared/tag_helpers/ID3v2TagHelper.h --- a/shared/tag_helpers/ID3v2TagHelper.h +++ b/shared/tag_helpers/ID3v2TagHelper.h @@ -30,14 +30,14 @@ public: ID3v2TagHelper( TagLib::Tag *tag, TagLib::ID3v2::Tag *id3v2Tag, Amarok::FileType fileType ); - virtual Meta::FieldHash tags() const; - virtual bool setTags( const Meta::FieldHash &changes ); + Meta::FieldHash tags() const override; + bool setTags( const Meta::FieldHash &changes ) override; - virtual TagLib::ByteVector render() const; + TagLib::ByteVector render() const override; - virtual bool hasEmbeddedCover() const; - virtual QImage embeddedCover() const; - virtual bool setEmbeddedCover( const QImage &cover ); + bool hasEmbeddedCover() const override; + QImage embeddedCover() const override; + bool setEmbeddedCover( const QImage &cover ) override; private: TagLib::ID3v2::Tag *m_tag; diff --git a/shared/tag_helpers/ID3v2TagHelper.cpp b/shared/tag_helpers/ID3v2TagHelper.cpp --- a/shared/tag_helpers/ID3v2TagHelper.cpp +++ b/shared/tag_helpers/ID3v2TagHelper.cpp @@ -250,7 +250,7 @@ m_tag->removeFrames( field ); else { - TagLib::ID3v2::TextIdentificationFrame *frame = NULL; + TagLib::ID3v2::TextIdentificationFrame *frame = nullptr; if( !m_tag->frameListMap()[field].isEmpty() ) frame = dynamic_cast< TagLib::ID3v2::TextIdentificationFrame * >( m_tag->frameListMap()[field].front() @@ -288,7 +288,7 @@ if( key == Meta::valRating || key == Meta::valPlaycount ) { - TagLib::ID3v2::PopularimeterFrame *popFrame = NULL; + TagLib::ID3v2::PopularimeterFrame *popFrame = nullptr; if( !m_tag->frameListMap()[POPM_Frame].isEmpty() ) popFrame = dynamic_cast< TagLib::ID3v2::PopularimeterFrame * >( m_tag->frameListMap()[POPM_Frame].front() ); @@ -372,8 +372,8 @@ ID3v2TagHelper::embeddedCover() const { TagLib::ID3v2::FrameList apicList = m_tag->frameListMap()[fieldName( Meta::valHasCover ).toCString()]; - TagLib::ID3v2::AttachedPictureFrame *cover = NULL; - TagLib::ID3v2::AttachedPictureFrame *otherCover = NULL; + TagLib::ID3v2::AttachedPictureFrame *cover = nullptr; + TagLib::ID3v2::AttachedPictureFrame *otherCover = nullptr; for( TagLib::ID3v2::FrameList::ConstIterator it = apicList.begin(); it != apicList.end(); ++it ) { @@ -420,7 +420,7 @@ TagLib::ByteVector field = fieldName( Meta::valHasCover ).toCString(); TagLib::ID3v2::FrameList apicList = m_tag->frameListMap()[field]; - TagLib::ID3v2::AttachedPictureFrame *frontCover = NULL; + TagLib::ID3v2::AttachedPictureFrame *frontCover = nullptr; // remove covers TagLib::List backedUpPictures; diff --git a/shared/tag_helpers/MP4TagHelper.h b/shared/tag_helpers/MP4TagHelper.h --- a/shared/tag_helpers/MP4TagHelper.h +++ b/shared/tag_helpers/MP4TagHelper.h @@ -31,12 +31,12 @@ public: MP4TagHelper( TagLib::Tag *tag, TagLib::MP4::Tag *mp4Tag, Amarok::FileType fileType ); - virtual Meta::FieldHash tags() const; - virtual bool setTags( const Meta::FieldHash &changes ); + Meta::FieldHash tags() const override; + bool setTags( const Meta::FieldHash &changes ) override; - virtual bool hasEmbeddedCover() const; - virtual QImage embeddedCover() const; - virtual bool setEmbeddedCover( const QImage &cover ); + bool hasEmbeddedCover() const override; + QImage embeddedCover() const override; + bool setEmbeddedCover( const QImage &cover ) override; private: TagLib::MP4::Tag *m_tag; diff --git a/shared/tag_helpers/StringHelper.h b/shared/tag_helpers/StringHelper.h --- a/shared/tag_helpers/StringHelper.h +++ b/shared/tag_helpers/StringHelper.h @@ -46,7 +46,7 @@ * Set codec for TStringToQString conversion. */ void setCodec( QTextCodec *codec ); - void setCodecByName( QByteArray codecName ); + void setCodecByName( const QByteArray &codecName ); } } diff --git a/shared/tag_helpers/StringHelper.cpp b/shared/tag_helpers/StringHelper.cpp --- a/shared/tag_helpers/StringHelper.cpp +++ b/shared/tag_helpers/StringHelper.cpp @@ -26,7 +26,7 @@ } void -Meta::Tag::setCodecByName( QByteArray codecName ) +Meta::Tag::setCodecByName( const QByteArray &codecName ) { s_codec = QTextCodec::codecForName( codecName ); } diff --git a/shared/tag_helpers/TagHelper.h b/shared/tag_helpers/TagHelper.h --- a/shared/tag_helpers/TagHelper.h +++ b/shared/tag_helpers/TagHelper.h @@ -60,7 +60,7 @@ virtual Meta::FieldHash tags() const; /** * Write changed metadata to file. - * Return true if something writen. + * Return true if something written. */ virtual bool setTags( const Meta::FieldHash &changes ); @@ -81,7 +81,7 @@ /** * Add or update cover in file. Will be set as FrontCover. - * Return true If something writen. + * Return true If something written. */ virtual bool setEmbeddedCover( const QImage &cover ); @@ -144,7 +144,7 @@ * @return TagHelper or NULL if file doesn't have tags. * Should be deleted by user after use. */ - AMAROKSHARED_EXPORT TagHelper *selectHelper( const TagLib::FileRef fileref, bool forceCreation = false ); + AMAROKSHARED_EXPORT TagHelper *selectHelper( const TagLib::FileRef &fileref, bool forceCreation = false ); } } diff --git a/shared/tag_helpers/TagHelper.cpp b/shared/tag_helpers/TagHelper.cpp --- a/shared/tag_helpers/TagHelper.cpp +++ b/shared/tag_helpers/TagHelper.cpp @@ -182,8 +182,8 @@ TagHelper::UIDType type = UIDInvalid; QString uid = uidUrl; - if( uid.startsWith( "amarok-" ) ) - uid = uid.remove( QRegExp( "^(amarok-\\w+://).+$" ) ); + if( uid.startsWith( QLatin1String("amarok-") ) ) + uid = uid.remove( QRegExp( QStringLiteral("^(amarok-\\w+://).+$") ) ); if( isValidUID( uid, UIDAFT ) ) type = UIDAFT; @@ -196,15 +196,15 @@ { int disc; int count = 0; - if( value.indexOf( '/' ) != -1 ) + if( value.indexOf( QLatin1Char('/') ) != -1 ) { - QStringList list = value.split( '/', QString::SkipEmptyParts ); + QStringList list = value.split( QLatin1Char('/'), QString::SkipEmptyParts ); disc = list.value( 0 ).toInt(); count = list.value( 1 ).toInt(); } - else if( value.indexOf( ':' ) != -1 ) + else if( value.indexOf( QLatin1Char(':') ) != -1 ) { - QStringList list = value.split( ':', QString::SkipEmptyParts ); + QStringList list = value.split( QLatin1Char(':'), QString::SkipEmptyParts ); disc = list.value( 0 ).toInt(); count = list.value( 1 ).toInt(); } @@ -220,10 +220,10 @@ if( uid.length() >= 127 ) // the database can't handle longer uids return false; - QRegExp regexp( "^$" ); + QRegExp regexp( QStringLiteral("^$") ); if( type == UIDAFT ) - regexp.setPattern( "^[0-9a-fA-F]{32}$" ); + regexp.setPattern( QStringLiteral("^[0-9a-fA-F]{32}$") ); return regexp.exactMatch( uid ); } @@ -257,9 +257,9 @@ Meta::Tag::TagHelper * -Meta::Tag::selectHelper( const TagLib::FileRef fileref, bool forceCreation ) +Meta::Tag::selectHelper( const TagLib::FileRef &fileref, bool forceCreation ) { - TagHelper *tagHelper = NULL; + TagHelper *tagHelper = nullptr; if( TagLib::MPEG::File *file = dynamic_cast< TagLib::MPEG::File * >( fileref.file() ) ) { @@ -307,7 +307,7 @@ if( tag ) { Amarok::FileType specificType = Amarok::Mp4; - QString filename = QString( fileref.file()->name() ); + QString filename = QString::fromLatin1( fileref.file()->name() ); foreach( Amarok::FileType type, QList() << Amarok::M4a << Amarok::M4v ) { if( filename.endsWith( Amarok::FileTypeSupport::toString( type ), Qt::CaseInsensitive ) ) diff --git a/shared/tag_helpers/VorbisCommentTagHelper.h b/shared/tag_helpers/VorbisCommentTagHelper.h --- a/shared/tag_helpers/VorbisCommentTagHelper.h +++ b/shared/tag_helpers/VorbisCommentTagHelper.h @@ -32,19 +32,19 @@ class AMAROKSHARED_EXPORT VorbisCommentTagHelper : public TagHelper { public: - VorbisCommentTagHelper( TagLib::Tag *tag, TagLib::Ogg::XiphComment *commentsTag, Amarok::FileType fileType, TagLib::FLAC::File *file = 0 ); + VorbisCommentTagHelper( TagLib::Tag *tag, TagLib::Ogg::XiphComment *commentsTag, Amarok::FileType fileType, TagLib::FLAC::File *file = nullptr ); - virtual Meta::FieldHash tags() const; - virtual bool setTags( const Meta::FieldHash &changes ); + Meta::FieldHash tags() const override; + bool setTags( const Meta::FieldHash &changes ) override; - virtual TagLib::ByteVector render() const; + TagLib::ByteVector render() const override; - virtual bool hasEmbeddedCover() const; - virtual QImage embeddedCover() const; - virtual bool setEmbeddedCover( const QImage &cover ); + bool hasEmbeddedCover() const override; + QImage embeddedCover() const override; + bool setEmbeddedCover( const QImage &cover ) override; private: - static bool parsePictureBlock( const TagLib::StringList& block, QImage* result = 0 ); + static bool parsePictureBlock( const TagLib::StringList& block, QImage* result = nullptr ); TagLib::Ogg::XiphComment *m_tag; TagLib::FLAC::File *m_flacFile; }; diff --git a/src/ActionClasses.h b/src/ActionClasses.h --- a/src/ActionClasses.h +++ b/src/ActionClasses.h @@ -25,7 +25,7 @@ #include #include -#include +#include class KActionCollection; class KHelpMenu; @@ -37,9 +37,9 @@ { Q_OBJECT public: - Menu( QWidget* parent ); + explicit Menu( QWidget* parent ); static Menu *instance(); - static QMenu *helpMenu( QWidget *parent = 0 ); + static QMenu *helpMenu( QWidget *parent = nullptr ); private: static Menu *s_instance; @@ -62,7 +62,7 @@ Q_OBJECT public: - PlayPauseAction( KActionCollection*, QObject* ); + explicit PlayPauseAction( KActionCollection*, QObject* ); private Q_SLOTS: void stopped(); @@ -96,7 +96,7 @@ QString currentIcon() const; protected Q_SLOTS: - virtual void actionTriggered( QAction *a ); + void actionTriggered( QAction *a ) override; private: void ( *m_function ) ( int ); @@ -107,7 +107,7 @@ { public: RandomAction( KActionCollection *ac, QObject* ); - virtual void setCurrentItem( int n ); + void setCurrentItem( int n ) override; }; class FavorAction : public SelectAction @@ -133,7 +133,7 @@ Q_OBJECT public: - BurnMenu( QWidget* parent ); + explicit BurnMenu( QWidget* parent ); static QMenu *instance(); private Q_SLOTS: diff --git a/src/ActionClasses.cpp b/src/ActionClasses.cpp --- a/src/ActionClasses.cpp +++ b/src/ActionClasses.cpp @@ -86,16 +86,16 @@ : QAction( parent ) { setText(i18n( "Amarok Menu" )); - ac->addAction("amarok_menu", this); + ac->addAction(QStringLiteral("amarok_menu"), this); setShortcutConfigurable ( false ); //FIXME disabled as it doesn't work, should use QCursor::pos() } void MenuAction::setShortcutConfigurable(bool b) { setProperty("isShortcutConfigurable", b); } -Menu* Menu::s_instance = 0; +Menu* Menu::s_instance = nullptr; Menu::Menu( QWidget* parent ) : QMenu( parent ) @@ -175,9 +175,10 @@ : KToggleAction( parent ) { - ac->addAction( "play_pause", this ); + ac->addAction( QStringLiteral("play_pause"), this ); setText( i18n( "Play/Pause" ) ); setShortcut( Qt::Key_Space ); + KGlobalAccel::setGlobalShortcut( this, QKeySequence() ); EngineController *engine = The::engineController(); @@ -203,21 +204,21 @@ PlayPauseAction::stopped() { setChecked( false ); - setIcon( QIcon::fromTheme("media-playback-start-amarok") ); + setIcon( QIcon::fromTheme(QStringLiteral("media-playback-start-amarok")) ); } void PlayPauseAction::paused() { setChecked( true ); - setIcon( QIcon::fromTheme("media-playback-start-amarok") ); + setIcon( QIcon::fromTheme(QStringLiteral("media-playback-start-amarok")) ); } void PlayPauseAction::playing() { setChecked( false ); - setIcon( QIcon::fromTheme("media-playback-pause-amarok") ); + setIcon( QIcon::fromTheme(QStringLiteral("media-playback-pause-amarok")) ); } @@ -240,16 +241,16 @@ m_function( b ); KToggleAction::setChecked( b ); AmarokConfig::self()->save(); //So we don't lose the setting when crashing - if( announce ) emit toggled( b ); //KToggleAction doesn't do this for us. How gay! + if( announce ) Q_EMIT toggled( b ); //KToggleAction doesn't do this for us. How gay! } void ToggleAction::setEnabled( bool b ) { const bool announce = b != isEnabled(); KToggleAction::setEnabled( b ); AmarokConfig::self()->save(); //So we don't lose the setting when crashing - if( announce ) emit QAction::triggered( b ); + if( announce ) Q_EMIT QAction::triggered( b ); } ////////////////////////////////////////////////////////////////////////////////////////// @@ -274,7 +275,7 @@ m_function( n ); KSelectAction::setCurrentItem( n ); AmarokConfig::self()->save(); //So we don't lose the setting when crashing - if( announce ) emit triggered( n ); + if( announce ) Q_EMIT triggered( n ); } void SelectAction::actionTriggered( QAction *a ) @@ -290,7 +291,7 @@ KSelectAction::setEnabled( b ); AmarokConfig::self()->save(); //So we don't lose the setting when crashing - if( announce ) emit QAction::triggered( b ); + if( announce ) Q_EMIT QAction::triggered( b ); } void SelectAction::setIcons( QStringList icons ) @@ -341,7 +342,7 @@ else { // Note: it would be nice to set a tooltip that would explain why this is disabled - // to users, but tooltips aren't shown in meny anyway :-( + // to users, but tooltips aren't shown in menu anyway :-( actions().at( 1 )->setEnabled( false ); actions().at( 2 )->setEnabled( false ); } @@ -354,7 +355,7 @@ : QAction( parent ) { setText(i18n( "Burn" )); - ac->addAction("burn_menu", this); + ac->addAction(QStringLiteral("burn_menu"), this); } QWidget* @@ -385,7 +386,7 @@ } -BurnMenu* BurnMenu::s_instance = 0; +BurnMenu* BurnMenu::s_instance = nullptr; BurnMenu::BurnMenu( QWidget* parent ) : QMenu( parent ) @@ -423,9 +424,9 @@ StopAction::StopAction( KActionCollection *ac, QObject *parent ) : QAction( parent ) { - ac->addAction( "stop", this ); + ac->addAction( QStringLiteral("stop"), this ); setText( i18n( "Stop" ) ); - setIcon( QIcon::fromTheme("media-playback-stop-amarok") ); + setIcon( QIcon::fromTheme(QStringLiteral("media-playback-stop-amarok")) ); KGlobalAccel::setGlobalShortcut(this, QKeySequence() ); connect( this, &StopAction::triggered, this, &StopAction::stop ); @@ -467,9 +468,9 @@ StopPlayingAfterCurrentTrackAction::StopPlayingAfterCurrentTrackAction( KActionCollection *ac, QObject *parent ) : QAction( parent ) { - ac->addAction( "stop_after_current", this ); + ac->addAction( QStringLiteral("stop_after_current"), this ); setText( i18n( "Stop after current Track" ) ); - setIcon( QIcon::fromTheme("media-playback-stop-amarok") ); + setIcon( QIcon::fromTheme(QStringLiteral("media-playback-stop-amarok")) ); KGlobalAccel::setGlobalShortcut(this, QKeySequence( Qt::META + Qt::SHIFT + Qt::Key_V ) ); connect( this, &StopPlayingAfterCurrentTrackAction::triggered, this, &StopPlayingAfterCurrentTrackAction::stopPlayingAfterCurrentTrack ); } diff --git a/src/AmarokMimeData.h b/src/AmarokMimeData.h --- a/src/AmarokMimeData.h +++ b/src/AmarokMimeData.h @@ -46,10 +46,10 @@ static const QString BOOKMARKGROUP_MIME; AmarokMimeData(); - virtual ~AmarokMimeData(); + ~AmarokMimeData() override; - virtual QStringList formats() const; - virtual bool hasFormat( const QString &mimeType ) const; + QStringList formats() const override; + bool hasFormat( const QString &mimeType ) const override; Meta::TrackList tracks() const; void setTracks( const Meta::TrackList &tracks ); @@ -97,7 +97,7 @@ void getTrackListSignal() const; protected: - virtual QVariant retrieveData( const QString &mimeType, QVariant::Type type ) const; + QVariant retrieveData( const QString &mimeType, QVariant::Type type ) const override; private Q_SLOTS: void newResultReady( const Meta::TrackList &tracks ); diff --git a/src/AmarokMimeData.cpp b/src/AmarokMimeData.cpp --- a/src/AmarokMimeData.cpp +++ b/src/AmarokMimeData.cpp @@ -24,13 +24,13 @@ #include #include -const QString AmarokMimeData::TRACK_MIME = "application/x-amarok-tracks"; -const QString AmarokMimeData::PLAYLIST_MIME = "application/x-amarok-playlists"; -const QString AmarokMimeData::PLAYLISTBROWSERGROUP_MIME = "application/x-amarok-playlistbrowsergroup"; -const QString AmarokMimeData::PODCASTCHANNEL_MIME = "application/x-amarok-podcastchannel"; -const QString AmarokMimeData::PODCASTEPISODE_MIME = "application/x-amarok-podcastepisode"; -const QString AmarokMimeData::AMAROKURL_MIME = "application/x-amarok-amarokurl"; -const QString AmarokMimeData::BOOKMARKGROUP_MIME = "application/x-amarok-bookmarkgroup"; +const QString AmarokMimeData::TRACK_MIME = QStringLiteral("application/x-amarok-tracks"); +const QString AmarokMimeData::PLAYLIST_MIME = QStringLiteral("application/x-amarok-playlists"); +const QString AmarokMimeData::PLAYLISTBROWSERGROUP_MIME = QStringLiteral("application/x-amarok-playlistbrowsergroup"); +const QString AmarokMimeData::PODCASTCHANNEL_MIME = QStringLiteral("application/x-amarok-podcastchannel"); +const QString AmarokMimeData::PODCASTEPISODE_MIME = QStringLiteral("application/x-amarok-podcastepisode"); +const QString AmarokMimeData::AMAROKURL_MIME = QStringLiteral("application/x-amarok-amarokurl"); +const QString AmarokMimeData::BOOKMARKGROUP_MIME = QStringLiteral("application/x-amarok-bookmarkgroup"); class AmarokMimeData::Private @@ -87,10 +87,10 @@ formats.append( BOOKMARKGROUP_MIME ); formats.append( AMAROKURL_MIME ); - if( !formats.contains( "text/uri-list" ) ) - formats.append( "text/uri-list" ); - if( !formats.contains( "text/plain" ) ) - formats.append( "text/plain" ); + if( !formats.contains( QStringLiteral("text/uri-list") ) ) + formats.append( QStringLiteral("text/uri-list") ); + if( !formats.contains( QStringLiteral("text/plain") ) ) + formats.append( QStringLiteral("text/plain") ); } return formats; @@ -113,7 +113,7 @@ return !d->bookmarkGroups.isEmpty(); else if( mimeType == AMAROKURL_MIME ) return !d->bookmarks.isEmpty(); - else if( mimeType == "text/uri-list" || mimeType == "text/plain" ) + else if( mimeType == QLatin1String("text/uri-list") || mimeType == QLatin1String("text/plain") ) return !d->tracks.isEmpty() || !d->playlists.isEmpty() || !d->m_podcastChannels.isEmpty() || !d->m_podcastEpisodes.isEmpty() || !d->queryMakers.isEmpty(); @@ -165,7 +165,7 @@ if( d->trackMap.contains( qm ) ) result << d->trackMap.value( qm ); } - emit trackListSignal( result ); + Q_EMIT trackListSignal( result ); } } @@ -304,7 +304,7 @@ Podcasts::PodcastEpisodeList episodes = this->podcastEpisodes(); if( !tracks.isEmpty() ) { - if( mimeType == "text/uri-list" && (type == QVariant::List || type == QVariant::ByteArray) ) + if( mimeType == QLatin1String("text/uri-list") && (type == QVariant::List || type == QVariant::ByteArray) ) { QList list; foreach( Meta::TrackPtr track, tracks ) @@ -325,23 +325,23 @@ } return QVariant( list ); } - if( mimeType == "text/plain" && (type == QVariant::String || type == QVariant::ByteArray) ) + if( mimeType == QLatin1String("text/plain") && (type == QVariant::String || type == QVariant::ByteArray) ) { QString result; foreach( Meta::TrackPtr track, tracks ) { if( !result.isEmpty() ) result += '\n'; result += track->artist()->prettyName(); - result += " - "; + result += QLatin1String(" - "); result += track->prettyName(); } foreach( Podcasts::PodcastEpisodePtr episode, episodes ) { if( !result.isEmpty() ) result += '\n'; result += episode->prettyName(); - result += " - "; + result += QLatin1String(" - "); result += episode->channel()->prettyName(); } foreach( Playlists::PlaylistPtr playlist, playlists ) diff --git a/src/AmarokProcess.h b/src/AmarokProcess.h --- a/src/AmarokProcess.h +++ b/src/AmarokProcess.h @@ -35,7 +35,7 @@ Q_OBJECT public: - explicit AmarokProcess(QObject *parent = 0); + explicit AmarokProcess(QObject *parent = nullptr); void setLowPriority(bool lowPriority) { this->lowPriority = lowPriority; } @@ -48,7 +48,7 @@ void receivedStderr(AmarokProcess *proc); protected: - virtual void setupChildProcess(); + void setupChildProcess() override; private Q_SLOTS: void finished(); // TODO: This has the same name as a signal in QProcess. Rename it. @@ -68,7 +68,7 @@ Q_OBJECT public: - explicit AmarokProcIO(QObject *parent = 0); + explicit AmarokProcIO(QObject *parent = nullptr); int readln (QString &line); bool writeStdin(const QString &line); @@ -92,7 +92,7 @@ class AMAROK_EXPORT AmarokShellProcess : public AmarokProcess { public: - explicit AmarokShellProcess(QObject *parent = 0) : AmarokProcess(parent) {} + explicit AmarokShellProcess(QObject *parent = nullptr) : AmarokProcess(parent) {} AmarokShellProcess &operator<<(const QString& arg); AmarokShellProcess &operator<<(const QStringList& args); diff --git a/src/AmarokProcess.cpp b/src/AmarokProcess.cpp --- a/src/AmarokProcess.cpp +++ b/src/AmarokProcess.cpp @@ -70,19 +70,19 @@ void AmarokProcess::finished() // SLOT { - emit processExited( this ); + Q_EMIT processExited( this ); } void AmarokProcess::readyReadStandardOutput() // SLOT { - emit receivedStdout( this ); + Q_EMIT receivedStdout( this ); } void AmarokProcess::readyReadStandardError() // SLOT { - emit receivedStderr( this ); + Q_EMIT receivedStderr( this ); } // AmarokProcIO @@ -125,7 +125,7 @@ AmarokProcIO::readyReadStandardOutput() { if( canReadLine() ) - emit readReady( this ); + Q_EMIT readReady( this ); } // AmarokShellProcess diff --git a/src/AmarokSharedPointer.h b/src/AmarokSharedPointer.h --- a/src/AmarokSharedPointer.h +++ b/src/AmarokSharedPointer.h @@ -27,7 +27,7 @@ class AmarokSharedPointer { public: - inline AmarokSharedPointer() : d(Q_NULLPTR) {} + inline AmarokSharedPointer() : d(nullptr) {} inline explicit AmarokSharedPointer(T *t) : d(t) { if (d) d->ref.ref(); } inline AmarokSharedPointer(const AmarokSharedPointer& other) : d(other.d) { if (d) d->ref.ref(); } inline ~AmarokSharedPointer() { if (d && !d->ref.deref()) delete d; } @@ -63,12 +63,12 @@ inline T& operator*() { Q_ASSERT(d); return *d; } inline const T* operator->() const { Q_ASSERT(d); return d; } inline T* operator->() { Q_ASSERT(d); return d; } - inline operator bool() const { return ( d != Q_NULLPTR ); } + inline operator bool() const { return ( d != nullptr ); } - inline bool isNull() const { return d == Q_NULLPTR; } + inline bool isNull() const { return d == nullptr; } inline int count() const { return d ? d->ref.load() : 0; } inline T* data() const { return d; } - inline void clear() { if (d && !d->ref.deref()) delete d; d = Q_NULLPTR; } + inline void clear() { if (d && !d->ref.deref()) delete d; d = nullptr; } template static AmarokSharedPointer staticCast(const AmarokSharedPointer& o) diff --git a/src/App.h b/src/App.h --- a/src/App.h +++ b/src/App.h @@ -47,7 +47,7 @@ public: App(int &argc, char **argv); - ~App(); + ~App() override; static App *instance() { return static_cast( qApp ); } @@ -75,7 +75,7 @@ void quit(); protected: - virtual bool event( QEvent *event ); + bool event( QEvent *event ) override; private Q_SLOTS: void slotTrashResult( KJob *job ); @@ -93,7 +93,7 @@ QStringList s_delayedAmarokUrls; }; -#define pApp static_cast(QCoreApplication::instance()) +#define pApp App::instance() #endif // AMAROK_APP_H diff --git a/src/App.cpp b/src/App.cpp --- a/src/App.cpp +++ b/src/App.cpp @@ -29,7 +29,7 @@ #include "configdialog/ConfigDialog.h" #include "configdialog/dialogs/PlaybackConfig.h" #include "core/capabilities/SourceInfoCapability.h" -#include "core/interfaces/Logger.h" +#include "core/logger/Logger.h" #include "core/meta/Meta.h" #include "core/meta/support/MetaConstants.h" #include "core/meta/support/MetaUtility.h" @@ -41,6 +41,9 @@ #include "core/support/Debug.h" #include "core/transcoding/TranscodingController.h" #include "core-impl/collections/support/CollectionManager.h" +#ifdef DEBUG_BUILD_TYPE +#include "core-impl/logger/DebugLogger.h" +#endif // DEBUG_BUILD_TYPE #include "core-impl/playlists/types/file/PlaylistFileSupport.h" #include "core-impl/storage/StorageManager.h" #include "covermanager/CoverCache.h" @@ -71,22 +74,23 @@ #include #include #include //slotConfigShortcuts() +#include #include #include +#include #include #include #include #include #include //showHyperThreadingWarning() -#include #ifdef Q_WS_MAC #include extern void setupEventHandler_mac(SRefCon); #endif -AMAROK_EXPORT OcsData ocsData( "opendesktop" ); +AMAROK_EXPORT OcsData ocsData( "api.kde-look.org" ); App::App(int &argc, char **argv) : QApplication(argc, argv) @@ -212,6 +216,11 @@ AmarokConfig::self()->save(); #endif + // wait for threads to finish + ThreadWeaver::Queue::instance()->requestAbort(); + ThreadWeaver::Queue::instance()->finish(); + ThreadWeaver::Queue::instance()->shutDown(); + ScriptManager::destroy(); // this must be deleted before the connection to the Xserver is @@ -268,7 +277,7 @@ QList list; for( int i = 0; i < m_args->positionalArguments().count() ; i++ ) { - QUrl url( m_args->positionalArguments().at( i ) ); + QUrl url( QUrl::fromUserInput( m_args->positionalArguments().at( i ), QString(), QUrl::AssumeLocalFile ) ); //TODO:PORTME if( Podcasts::PodcastProvider::couldBeFeed( url.url() ) ) { @@ -397,7 +406,7 @@ Amarok::OSD::instance()->applySettings(); - emit settingsChanged(); + Q_EMIT settingsChanged(); if( AmarokConfig::enableScriptConsole() && !m_scriptConsole ) m_scriptConsole = ScriptConsoleNS::ScriptConsole::instance(); @@ -434,13 +443,16 @@ PERF_LOG( "Begin App::continueInit" ) + AmarokConfig::instance( "amarokrc" ); newInstance(); const bool restoreSession = m_args->positionalArguments().isEmpty() || m_args->isSet( "append" ) || m_args->isSet( "queue" ) || Amarok::config().readEntry( "AppendAsDefault", false ); - AmarokConfig::instance( "amarokrc" ); +#ifdef DEBUG_BUILD_TYPE + new DebugLogger( this ); +#endif // DEBUG_BUILD_TYPE new Amarok::DefaultApplicationController( this ); Amarok::Components::applicationController()->start(); @@ -573,7 +585,7 @@ KIO::Job *App::trashFiles( const QList &files ) { KIO::Job *job = KIO::trash( files ); - Amarok::Components::logger()->newProgressOperation( job, i18n("Moving files to trash") ); + Amarok::Logger::newProgressOperation( job, i18n("Moving files to trash") ); connect( job, &KIO::Job::result, this, &App::slotTrashResult ); return job; } @@ -590,7 +602,7 @@ The::playlistManager()->completePodcastDownloads(); // Following signal is relayed to scripts, which may block quitting for a while - emit prepareToQuit(); + Q_EMIT prepareToQuit(); QApplication::quit(); } diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,9 +1,6 @@ # Improves speed of string concatenation add_definitions(-DQT_USE_FAST_CONCATENATION) add_definitions(-DQT_USE_FAST_OPERATOR_PLUS) -if(NOT MSVC) - add_definitions(-DQT_STRICT_ITERATORS) -endif() if(APPLE) set(mac_SRCS @@ -23,15 +20,15 @@ include_directories( ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR}/core-impl/collections/db/sql/ ) add_subdirectory( core ) add_subdirectory( core-impl/collections ) add_subdirectory( core-impl/storage/sql ) add_subdirectory( context ) add_subdirectory( services ) add_subdirectory( scripting/scripts ) -add_subdirectory( aboutdialog/libattica-ocsclient ) add_subdirectory( transcoding ) add_subdirectory( kconf_update ) add_subdirectory( importers ) @@ -283,7 +280,13 @@ context/AppletModel.cpp context/ContextDock.cpp context/ContextView.cpp - context/LyricsManager.cpp +) + +##################################################################### +# LYRICS +##################################################################### +set( liblyrics_SRCS + lyrics/LyricsManager.cpp ) ##################################################################### @@ -442,7 +445,6 @@ scripting/scriptengine/AmarokEqualizerScript.cpp scripting/scriptengine/AmarokInfoScript.cpp scripting/scriptengine/AmarokKNotifyScript.cpp - scripting/scriptengine/AmarokLyricsScript.cpp scripting/scriptengine/AmarokNetworkScript.cpp scripting/scriptengine/AmarokOSDScript.cpp scripting/scriptengine/AmarokPlaylistManagerScript.cpp @@ -477,7 +479,7 @@ ${CMAKE_SOURCE_DIR}/src/scripting/scriptengine ${CMAKE_BINARY_DIR}/scriptconsole) install(FILES ${CMAKE_BINARY_DIR}/scriptconsole/AutoComplete.txt - DESTINATION ${DATA_INSTALL_DIR}/amarok/scriptconsole) + DESTINATION ${KDE_INSTALL_DATADIR}/amarok/scriptconsole) endif() ##################################################################### @@ -588,6 +590,7 @@ ${libcontextview_SRCS} ${libcollectionbrowser_SRCS} ${libconfigdialog_SRCS} + ${liblyrics_SRCS} ${libplaylist_SRCS} ${aggregatecollection_SRCS} ${libpodcasts_SRCS} @@ -612,7 +615,6 @@ ${libsynchronization_SRCS} ${statsyncing_SRCS} ${importers_SRCS} - core-impl/logger/ProxyLogger.cpp aboutdialog/AnimatedBarWidget.cpp aboutdialog/AnimatedWidget.cpp aboutdialog/ExtendedAboutDialog.cpp @@ -638,6 +640,7 @@ SvgHandler.cpp SvgTinter.cpp TrayIcon.cpp + core-impl/logger/DebugLogger.cpp core-impl/meta/timecode/TimecodeObserver.cpp core-impl/meta/timecode/TimecodeMeta.cpp core-impl/meta/timecode/TimecodeTrackProvider.cpp @@ -732,11 +735,6 @@ moodbar/MoodbarManager.cpp ) -if( LIBMYGPO_QT_FOUND ) - set( EXTRA_LIBS ${LIBMYGPO_QT_LIBRARIES} ) - include_directories( ${LIBMYGPO_QT_INCLUDE_DIRS} ${LIBMYGPO_QT_INCLUDE_DIRS}/../ ) -endif() - if( LIBLASTFM_FOUND ) set(amaroklib_LIB_SRCS ${amaroklib_LIB_SRCS} @@ -851,6 +849,7 @@ target_link_libraries(amaroklib Phonon::phonon4qt5 KF5::Archive + KF5::Attica KF5::CoreAddons KF5::Declarative KF5::GlobalAccel @@ -868,6 +867,7 @@ KF5::Package KF5::TextEditor KF5::ThreadWeaver + KF5::WidgetsAddons KF5::WindowSystem ${QT_QTSCRIPTTOOLS_LIBRARY} Qt5::Gui @@ -878,15 +878,19 @@ Qt5::Sql Qt5::Svg ${CMAKE_DL_LIBS} - ${CMAKE_THREAD_LIBS_INIT} + Threads::Threads ${EXTRA_LIBS} amarokpud amarokcore - amarokocsclient amarok-transcoding amarokshared ) +if( Qt5WebEngine_FOUND ) + target_link_libraries( amaroklib Qt5::WebEngine ) + add_definitions( -DWITH_QT_WEBENGINE ) +endif() + include_directories(${TAGLIB_INCLUDES}) add_definitions(${TAGLIB_CFLAGS}) target_link_libraries(amaroklib ${TAGLIB_LIBRARIES}) @@ -929,6 +933,7 @@ target_link_libraries(amarok KF5::CoreAddons + KF5::Crash KF5::DBusAddons KF5::I18n @@ -941,38 +946,38 @@ ########### install files ############### -install(PROGRAMS org.kde.amarok.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} ) -install(PROGRAMS org.kde.amarok_containers.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} ) +install(PROGRAMS org.kde.amarok.desktop DESTINATION ${KDE_INSTALL_APPDIR} ) +install(PROGRAMS org.kde.amarok_containers.desktop DESTINATION ${KDE_INSTALL_APPDIR} ) install(FILES org.kde.amarok.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR}) -install(FILES amarok-plugin.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR}) -install(FILES amarok-contextapplet.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR}) -install(FILES amarok_codecinstall.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR}) -install(FILES amarok_append.desktop DESTINATION ${SERVICES_INSTALL_DIR}/ServiceMenus) -install(FILES amarok-play-audiocd.desktop DESTINATION ${DATA_INSTALL_DIR}/solid/actions) +install(FILES amarok-plugin.desktop DESTINATION ${KDE_INSTALL_KSERVICETYPES5DIR}) +install(FILES amarok-contextapplet.desktop DESTINATION ${KDE_INSTALL_KSERVICETYPES5DIR}) +install(FILES amarok_codecinstall.desktop DESTINATION ${KDE_INSTALL_KSERVICETYPES5DIR}) +install(FILES amarok_append.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}/ServiceMenus) +install(FILES amarok-play-audiocd.desktop DESTINATION ${KDE_INSTALL_DATADIR}/solid/actions) -install(FILES amarok.knsrc DESTINATION ${CONFIG_INSTALL_DIR}) +install(FILES amarok.knsrc DESTINATION ${KDE_INSTALL_CONFDIR}) # protocol handlers -install(FILES amarokurls/amarok.protocol DESTINATION ${SERVICES_INSTALL_DIR}) -install(FILES amarokitpc.protocol DESTINATION ${SERVICES_INSTALL_DIR}) -#install(FILES amarokpcast.protocol DESTINATION ${SERVICES_INSTALL_DIR}) +install(FILES amarokurls/amarok.protocol DESTINATION ${KDE_INSTALL_KSERVICES5DIR}) +install(FILES amarokitpc.protocol DESTINATION ${KDE_INSTALL_KSERVICES5DIR}) +#install(FILES amarokpcast.protocol DESTINATION ${KDE_INSTALL_KSERVICES5DIR}) -install(FILES amarokconfig.kcfg DESTINATION ${KCFG_INSTALL_DIR} ) +install(FILES amarokconfig.kcfg DESTINATION ${KDE_INSTALL_KCFGDIR} ) install(FILES dbus/mpris1/org.freedesktop.MediaPlayer.root.xml dbus/mpris1/org.freedesktop.MediaPlayer.player.xml dbus/mpris1/org.freedesktop.MediaPlayer.tracklist.xml dbus/org.kde.amarok.App.xml dbus/org.kde.amarok.Collection.xml dbus/mpris1/org.kde.amarok.Mpris1Extensions.Player.xml dbus/mpris2/org.kde.amarok.Mpris2Extensions.Player.xml - DESTINATION ${DBUS_INTERFACES_INSTALL_DIR}) + DESTINATION ${KDE_INSTALL_DBUSINTERFACEDIR}) install(FILES services/InfoParserLoading.html browsers/hover_info_template.html - DESTINATION ${DATA_INSTALL_DIR}/amarok/data) + DESTINATION ${KDE_INSTALL_DATADIR}/amarok/data) ecm_install_icons(ICONS - DESTINATION ${ICON_INSTALL_DIR} + DESTINATION ${KDE_INSTALL_ICONDIR} THEME hicolor ) diff --git a/src/EngineController.h b/src/EngineController.h --- a/src/EngineController.h +++ b/src/EngineController.h @@ -34,11 +34,11 @@ #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include class Fadeouter; @@ -117,7 +117,7 @@ int volume() const; /** - * @return @c true if sound output is disabled, @false otherwise + * @return @c true if sound output is disabled, @c false otherwise */ bool isMuted() const; @@ -145,7 +145,7 @@ * However for rewinding we have isSeekable(). * Also for streams usually the meta data received by currentTrack() is only * for the whole stream while the meta data received by currentMetaDataChanged - * will be more current (or contain advertisment) + * will be more current (or contain advertisement) * * @return @c true if the current track is a stream, @c false otherwise */ @@ -163,7 +163,7 @@ /** * @return QString with a pretty name for the current track - * @param whether to include the playing progress (default false) + * @param progress whether to include the playing progress (default false) */ QString prettyNowPlaying( bool progress = false ) const; @@ -198,7 +198,7 @@ * This happens asynchronously. * * @param forceInstant skip any fade-out effects - * @param playingWillContinue don't emit stopped() or trackChanged( 0 ) signals + * @param playingWillContinue don't Q_EMIT stopped() or trackChanged( 0 ) signals */ void stop( bool forceInstant = false, bool playingWillContinue = false ); @@ -303,11 +303,11 @@ Q_SIGNALS: /** * Emitted when the playback stops while playing a track. - * This signal is not emitted when the track pauses or the playback stopps because + * This signal is not emitted when the track pauses or the playback stops because * Amarok was closed and "resume at start" is configured. * It is also not emitted if the playback continues with another track. In such * a case you would just get another trackPlaying signal. - * Both parameters are in milli seconds. + * Both parameters are in milliseconds. */ void stopped( qint64 /*ms*/ finalPosition, qint64 /*ms*/ trackLength ); @@ -367,7 +367,7 @@ /** * Emitted then the information for the current changed. * This signal contains data from Phonon about the meta data of the track or stream. - * This signal is expecially emitted when a stream changes it's metadata. + * This signal is especially emitted when a stream changes it's metadata. * This can happen e.g. in a ogg stream where the currentTrack data will probably * not be updated. * @@ -397,7 +397,7 @@ /** Called when the track position changes. If the track just progresses you will get a notification every couple of milliseconds. - @parem position The current position in milliseconds + @param position The current position in milliseconds @param userSeek True if the position change was caused by the user */ void trackPositionChanged( qint64 position, bool userSeek ); @@ -492,8 +492,8 @@ protected: // reimplemented from Meta::Observer using Observer::metadataChanged; - virtual void metadataChanged( Meta::TrackPtr track ); - virtual void metadataChanged( Meta::AlbumPtr album ); + void metadataChanged( const Meta::TrackPtr &track ) override; + void metadataChanged( const Meta::AlbumPtr &album ) override; private: /** @@ -508,8 +508,8 @@ /** * Try to detect MetaData spam in Streams etc. * - * Some streams are doing advertisment in the metadata. We try to filter that - * out. Additionally, some Phonon back-ends emit more than one + * Some streams are doing advertisement in the metadata. We try to filter that + * out. Additionally, some Phonon back-ends Q_EMIT more than one * metadataChanged() signals per on track, so filter it all altogether. */ bool isInRecentMetaDataHistory( const QVariantMap &meta ); @@ -521,7 +521,7 @@ void stampStreamTrackLength(); /** - * emit metadataChanged() with info so that MetaStream::Track that is + * Q_EMIT metadataChanged() with info so that MetaStream::Track that is * currently listening updates its length. * * @param length new track length in milliseconds diff --git a/src/EngineController.cpp b/src/EngineController.cpp --- a/src/EngineController.cpp +++ b/src/EngineController.cpp @@ -30,7 +30,7 @@ #include "core/capabilities/MultiPlayableCapability.h" #include "core/capabilities/MultiSourceCapability.h" #include "core/capabilities/SourceInfoCapability.h" -#include "core/interfaces/Logger.h" +#include "core/logger/Logger.h" #include "core/meta/Meta.h" #include "core/meta/support/MetaConstants.h" #include "core/meta/support/MetaUtility.h" @@ -42,18 +42,21 @@ #include "playback/PowerManager.h" #include "playlist/PlaylistActions.h" -#include -#include -#include -#include +#include +#include +#include +#include #include #include #include #include #include +#include + + // for slotMetaDataChanged() typedef QPair FieldPair; @@ -229,7 +232,7 @@ // this ensures that slotFillInSupportedMimeTypes() is called in the main thread. It // will be called directly if we are called in the main thread (so that no deadlock // can occur) and indirectly if we are called in non-main thread. - emit fillInSupportedMimeTypes(); + Q_EMIT fillInSupportedMimeTypes(); // ensure slotFillInSupportedMimeTypes() called above has already finished: m_supportedMimeTypesSemaphore.acquire(); @@ -297,13 +300,13 @@ //only update song stats, when we're not going to resume it if ( !AmarokConfig::resumePlayback() && m_currentTrack ) { - emit stopped( trackPositionMs(), m_currentTrack->length() ); + Q_EMIT stopped( trackPositionMs(), m_currentTrack->length() ); unsubscribeFrom( m_currentTrack ); if( m_currentAlbum ) unsubscribeFrom( m_currentAlbum ); - emit trackChanged( Meta::TrackPtr( 0 ) ); + Q_EMIT trackChanged( Meta::TrackPtr( 0 ) ); } - emit sessionEnded( AmarokConfig::resumePlayback() && m_currentTrack ); + Q_EMIT sessionEnded( AmarokConfig::resumePlayback() && m_currentTrack ); } EqualizerController* @@ -338,7 +341,7 @@ if( supportsFadeout() ) m_fader->setVolume( 1.0 ); m_media->play(); - emit trackPlaying( m_currentTrack ); + Q_EMIT trackPlaying( m_currentTrack ); return; } } @@ -390,7 +393,7 @@ DEBUG_BLOCK seekTo( 0 ); - emit trackPositionChanged( 0, true ); + Q_EMIT trackPositionChanged( 0, true ); } void @@ -406,7 +409,7 @@ m_currentAudioCdTrack = 0; if( url.scheme() == "audiocd" ) { - QStringList pathItems = url.path().split( '/', QString::KeepEmptyParts ); + QStringList pathItems = url.path().split( QLatin1Char('/'), QString::KeepEmptyParts ); if( pathItems.count() != 3 ) { error() << __PRETTY_FUNCTION__ << url.url() << "is not in expected format"; @@ -497,7 +500,7 @@ m_media->pause(); } - emit paused(); + Q_EMIT paused(); } void @@ -530,14 +533,14 @@ const qint64 pos = trackPositionMs(); // updateStreamLength() intentionally not here, we're probably in the middle of a track const qint64 length = trackLength(); - emit trackFinishedPlaying( m_currentTrack, pos / qMax( length, pos ) ); + Q_EMIT trackFinishedPlaying( m_currentTrack, pos / qMax( length, pos ) ); m_currentTrack = 0; m_currentAlbum = 0; if( !playingWillContinue ) { - emit stopped( pos, length ); - emit trackChanged( m_currentTrack ); + Q_EMIT stopped( pos, length ); + Q_EMIT trackChanged( m_currentTrack ); } } @@ -631,7 +634,7 @@ seekTo = ms; m_media->seek( static_cast( seekTo ) ); - emit trackPositionChanged( seekTo, true ); /* User seek */ + Q_EMIT trackPositionChanged( seekTo, true ); /* User seek */ } else debug() << "Stream is not seekable."; @@ -670,7 +673,7 @@ m_audio->setVolume( volume ); AmarokConfig::setMasterVolume( percent ); - emit volumeChanged( percent ); + Q_EMIT volumeChanged( percent ); } m_ignoreVolumeChangeAction = false; @@ -697,7 +700,7 @@ setVolume( m_volume ); AmarokConfig::setMuteState( mute ); - emit muteStateChanged( mute ); + Q_EMIT muteStateChanged( mute ); } void @@ -808,7 +811,7 @@ if( m_boundedPlayback ) { qint64 newPosition = position; - emit trackPositionChanged( + Q_EMIT trackPositionChanged( static_cast( position - m_boundedPlayback->startPosition() ), false ); @@ -834,7 +837,7 @@ else { m_lastTickPosition = position; - emit trackPositionChanged( static_cast( position ), false ); + Q_EMIT trackPositionChanged( static_cast( position ), false ); } } @@ -874,7 +877,7 @@ else if( m_media->queue().isEmpty() ) { debug() << "no more sources, skip to next track"; - m_multiSource.reset(); // don't cofuse slotFinished + m_multiSource.reset(); // don't confuse slotFinished The::playlistActions()->requestNextTrack(); } } @@ -902,23 +905,23 @@ debug() << "Track finished completely, updating statistics"; unsubscribeFrom( m_currentTrack ); // don't bother with trackMetadataChanged() stampStreamTrackLength(); // update track length in stream for accurate scrobbling - emit trackFinishedPlaying( m_currentTrack, 1.0 ); + Q_EMIT trackFinishedPlaying( m_currentTrack, 1.0 ); subscribeTo( m_currentTrack ); } if( !m_multiPlayback && !m_multiSource ) { // again. at this point the track is finished so it's trackPositionMs is 0 if( !m_nextTrack && m_nextUrl.isEmpty() ) - emit stopped( m_currentTrack ? m_currentTrack->length() : 0, + Q_EMIT stopped( m_currentTrack ? m_currentTrack->length() : 0, m_currentTrack ? m_currentTrack->length() : 0 ); unsubscribeFrom( m_currentTrack ); if( m_currentAlbum ) unsubscribeFrom( m_currentAlbum ); m_currentTrack = 0; m_currentAlbum = 0; if( !m_nextTrack && m_nextUrl.isEmpty() ) // we will the trackChanged signal later - emit trackChanged( Meta::TrackPtr() ); + Q_EMIT trackChanged( Meta::TrackPtr() ); m_media->setCurrentSource( Phonon::MediaSource() ); } @@ -970,7 +973,7 @@ { debug() << "Previous track finished completely, updating statistics"; stampStreamTrackLength(); // update track length in stream for accurate scrobbling - emit trackFinishedPlaying( m_currentTrack, 1.0 ); + Q_EMIT trackFinishedPlaying( m_currentTrack, 1.0 ); if( m_multiSource ) // advance source of a multi-source track @@ -1045,8 +1048,8 @@ } m_lastStreamStampPosition = useTrackWithinStreamDetection ? 0 : -1; - emit trackChanged( m_currentTrack ); - emit trackPlaying( m_currentTrack ); + Q_EMIT trackChanged( m_currentTrack ); + Q_EMIT trackPlaying( m_currentTrack ); } void @@ -1063,7 +1066,7 @@ if( newState == Phonon::ErrorState ) // If media is borked, skip to next track { - emit trackError( m_currentTrack ); + Q_EMIT trackError( m_currentTrack ); warning() << "Phonon failed to play this URL. Error: " << m_media->errorString(); warning() << "Forcing phonon engine reinitialization."; @@ -1080,7 +1083,7 @@ // reset error count errorCount = 0; - Amarok::Components::logger()->longMessage( + Amarok::Logger::longMessage( i18n( "Too many errors encountered in playlist. Playback stopped." ), Amarok::Logger::Warning ); @@ -1094,12 +1097,12 @@ else if( newState == Phonon::PlayingState ) { errorCount = 0; - emit playbackStateChanged(); + Q_EMIT playbackStateChanged(); } else if( newState == Phonon::StoppedState || newState == Phonon::PausedState ) { - emit playbackStateChanged(); + Q_EMIT playbackStateChanged(); } } @@ -1142,7 +1145,7 @@ EngineController::slotTrackLengthChanged( qint64 milliseconds ) { debug() << "slotTrackLengthChanged(" << milliseconds << ")"; - emit trackLengthChanged( ( !m_multiPlayback || !m_boundedPlayback ) + Q_EMIT trackLengthChanged( ( !m_multiPlayback || !m_boundedPlayback ) ? trackLength() : milliseconds ); } @@ -1165,7 +1168,7 @@ meta.insert( pair.second, values.first() ); } - // note: don't rely on m_currentTrack here. At least some Phonon backends first emit + // note: don't rely on m_currentTrack here. At least some Phonon backends first Q_EMIT // totalTimeChanged(), then metaDataChanged() and only then currentSourceChanged() // which currently sets correct m_currentTrack. if( isInRecentMetaDataHistory( meta ) ) @@ -1181,21 +1184,21 @@ if( m_currentTrack && m_lastStreamStampPosition >= 0 ) { stampStreamTrackLength(); - emit trackFinishedPlaying( m_currentTrack, 1.0 ); + Q_EMIT trackFinishedPlaying( m_currentTrack, 1.0 ); // update track length to 0 because length emitted by stampStreamTrackLength() // is for the previous song meta.insert( Meta::Field::LENGTH, 0 ); } debug() << "slotMetaDataChanged(): new meta-data:" << meta; - emit currentMetadataChanged( meta ); + Q_EMIT currentMetadataChanged( meta ); } void EngineController::slotSeekableChanged( bool seekable ) { - emit seekableChanged( seekable ); + Q_EMIT seekableChanged( seekable ); } void @@ -1219,7 +1222,7 @@ m_volume = percent; AmarokConfig::setMasterVolume( percent ); - emit volumeChanged( percent ); + Q_EMIT volumeChanged( percent ); } else m_volume = percent; @@ -1230,23 +1233,26 @@ void EngineController::slotMutedChanged( bool mute ) { AmarokConfig::setMuteState( mute ); - emit muteStateChanged( mute ); + Q_EMIT muteStateChanged( mute ); } void EngineController::slotTrackFinishedPlaying( Meta::TrackPtr track, double playedFraction ) { Q_ASSERT( track ); debug() << "slotTrackFinishedPlaying(" - << ( track->artist() ? track->artist()->name() : QString( "[no artist]" ) ) - << "-" << ( track->album() ? track->album()->name() : QString( "[no album]" ) ) + << ( track->artist() ? track->artist()->name() : QStringLiteral( "[no artist]" ) ) + << "-" << ( track->album() ? track->album()->name() : QStringLiteral( "[no album]" ) ) << "-" << track->name() << "," << playedFraction << ")"; - track->finishedPlaying( playedFraction ); + + // Track::finishedPlaying is thread-safe and can take a long time to finish. + std::thread thread( &Meta::Track::finishedPlaying, track, playedFraction ); + thread.detach(); } void -EngineController::metadataChanged( Meta::TrackPtr track ) +EngineController::metadataChanged( const Meta::TrackPtr &track ) { Meta::AlbumPtr album = m_currentTrack->album(); if( m_currentAlbum != album ) { @@ -1256,13 +1262,13 @@ if( m_currentAlbum ) subscribeTo( m_currentAlbum ); } - emit trackMetadataChanged( track ); + Q_EMIT trackMetadataChanged( track ); } void -EngineController::metadataChanged( Meta::AlbumPtr album ) +EngineController::metadataChanged( const Meta::AlbumPtr &album ) { - emit albumMetadataChanged( album ); + Q_EMIT albumMetadataChanged( album ); } QString EngineController::prettyNowPlaying( bool progress ) const @@ -1365,6 +1371,6 @@ lengthMetaData.insert( Meta::Field::URL, QUrl( m_currentTrack->playableUrl() ) ); lengthMetaData.insert( Meta::Field::LENGTH, length ); debug() << "updateStreamLength(): emitting currentMetadataChanged(" << lengthMetaData << ")"; - emit currentMetadataChanged( lengthMetaData ); + Q_EMIT currentMetadataChanged( lengthMetaData ); } diff --git a/src/GlobalCollectionActions.h b/src/GlobalCollectionActions.h --- a/src/GlobalCollectionActions.h +++ b/src/GlobalCollectionActions.h @@ -19,7 +19,6 @@ #include "amarok_export.h" #include "core/meta/forward_declarations.h" -#include "core/support/SmartPointerList.h" #include @@ -36,7 +35,7 @@ public: GlobalCollectionGenreAction( const QString &text, QObject * parent ); - void setGenre( Meta::GenrePtr genre ); + void setGenre( const Meta::GenrePtr &genre ); protected: Meta::GenrePtr genre(); @@ -51,7 +50,7 @@ public: GlobalCollectionArtistAction( const QString &text, QObject * parent ); - void setArtist( Meta::ArtistPtr artist ); + void setArtist( const Meta::ArtistPtr &artist ); protected: Meta::ArtistPtr artist(); @@ -66,7 +65,7 @@ public: GlobalCollectionAlbumAction( const QString &text, QObject * parent ); - void setAlbum( Meta::AlbumPtr album ); + void setAlbum( const Meta::AlbumPtr &album ); protected: Meta::AlbumPtr album(); @@ -81,7 +80,7 @@ public: GlobalCollectionTrackAction( const QString &text, QObject * parent ); - void setTrack( Meta::TrackPtr track ); + void setTrack( const Meta::TrackPtr &track ); protected: Meta::TrackPtr track(); @@ -96,7 +95,7 @@ public: GlobalCollectionYearAction( const QString &text, QObject * parent ); - void setYear( Meta::YearPtr year ); + void setYear( const Meta::YearPtr &year ); protected: Meta::YearPtr year(); @@ -111,7 +110,7 @@ public: GlobalCollectionComposerAction( const QString &text, QObject * parent ); - void setComposer( Meta::ComposerPtr composer ); + void setComposer( const Meta::ComposerPtr &composer ); protected: Meta::ComposerPtr composer(); @@ -137,7 +136,7 @@ friend GlobalCollectionActions* The::globalCollectionActions(); public: - QList actionsFor( Meta::DataPtr item ); + QList actionsFor( const Meta::DataPtr &item ); void addGenreAction( GlobalCollectionGenreAction * action ); void addArtistAction( GlobalCollectionArtistAction * action ); @@ -150,19 +149,19 @@ GlobalCollectionActions(); ~GlobalCollectionActions(); - QList actionsFor( Meta::GenrePtr genre ); - QList actionsFor( Meta::ArtistPtr artist ); - QList actionsFor( Meta::AlbumPtr album ); - QList actionsFor( Meta::TrackPtr track ); - QList actionsFor( Meta::YearPtr year ); - QList actionsFor( Meta::ComposerPtr composer ); - - SmartPointerList m_genreActions; - SmartPointerList m_artistActions; - SmartPointerList m_albumActions; - SmartPointerList m_trackActions; - SmartPointerList m_yearActions; - SmartPointerList m_composerActions; + QList actionsFor( const Meta::GenrePtr &genre ); + QList actionsFor( const Meta::ArtistPtr &artist ); + QList actionsFor( const Meta::AlbumPtr &album ); + QList actionsFor( const Meta::TrackPtr &track ); + QList actionsFor( const Meta::YearPtr &year ); + QList actionsFor( const Meta::ComposerPtr &composer ); + + QList m_genreActions; + QList m_artistActions; + QList m_albumActions; + QList m_trackActions; + QList m_yearActions; + QList m_composerActions; }; #endif diff --git a/src/GlobalCollectionActions.cpp b/src/GlobalCollectionActions.cpp --- a/src/GlobalCollectionActions.cpp +++ b/src/GlobalCollectionActions.cpp @@ -20,7 +20,7 @@ namespace The { - static GlobalCollectionActions* s_GlobalCollectionActions_instance = 0; + static GlobalCollectionActions* s_GlobalCollectionActions_instance = nullptr; GlobalCollectionActions* globalCollectionActions() { @@ -98,7 +98,7 @@ connect( action, &QObject::destroyed, this, [this, action]() { m_composerActions.removeAll( action ); } ); } -QList< QAction * > GlobalCollectionActions::actionsFor( Meta::DataPtr item ) +QList< QAction * > GlobalCollectionActions::actionsFor( const Meta::DataPtr &item ) { Meta::GenrePtr genrePtr = Meta::GenrePtr::dynamicCast( item ); @@ -131,7 +131,7 @@ QList< QAction * > -GlobalCollectionActions::actionsFor( Meta::GenrePtr genre ) +GlobalCollectionActions::actionsFor( const Meta::GenrePtr &genre ) { QList< QAction * > returnList; foreach( GlobalCollectionGenreAction * genreAction, m_genreActions ) @@ -144,7 +144,7 @@ } QList< QAction * > -GlobalCollectionActions::actionsFor( Meta::ArtistPtr artist ) +GlobalCollectionActions::actionsFor( const Meta::ArtistPtr &artist ) { QList< QAction * > returnList; foreach( GlobalCollectionArtistAction * artistAction, m_artistActions ) @@ -157,7 +157,7 @@ } QList< QAction * > -GlobalCollectionActions::actionsFor( Meta::AlbumPtr album ) +GlobalCollectionActions::actionsFor( const Meta::AlbumPtr &album ) { QList< QAction * > returnList; foreach( GlobalCollectionAlbumAction * albumAction, m_albumActions ) @@ -170,7 +170,7 @@ } QList< QAction * > -GlobalCollectionActions::actionsFor( Meta::TrackPtr track ) +GlobalCollectionActions::actionsFor( const Meta::TrackPtr &track ) { QList< QAction * > returnList; foreach( GlobalCollectionTrackAction * trackAction, m_trackActions ) @@ -183,7 +183,7 @@ } QList< QAction * > -GlobalCollectionActions::actionsFor( Meta::YearPtr year ) +GlobalCollectionActions::actionsFor( const Meta::YearPtr &year ) { QList< QAction * > returnList; foreach( GlobalCollectionYearAction * yearAction, m_yearActions ) @@ -196,7 +196,7 @@ } QList< QAction * > -GlobalCollectionActions::actionsFor( Meta::ComposerPtr composer ) +GlobalCollectionActions::actionsFor( const Meta::ComposerPtr &composer ) { QList< QAction * > returnList; foreach( GlobalCollectionComposerAction * composerAction, m_composerActions ) @@ -217,7 +217,7 @@ {} void -GlobalCollectionGenreAction::setGenre( Meta::GenrePtr genre ) +GlobalCollectionGenreAction::setGenre( const Meta::GenrePtr &genre ) { m_currentGenre = genre; } @@ -232,7 +232,7 @@ {} void -GlobalCollectionArtistAction::setArtist( Meta::ArtistPtr artist ) +GlobalCollectionArtistAction::setArtist( const Meta::ArtistPtr &artist ) { m_currentArtist = artist; } @@ -246,7 +246,7 @@ : GlobalCollectionAction( text, parent ) {} -void GlobalCollectionAlbumAction::setAlbum( Meta::AlbumPtr album ) +void GlobalCollectionAlbumAction::setAlbum( const Meta::AlbumPtr &album ) { m_currentAlbum = album; } @@ -260,7 +260,7 @@ : GlobalCollectionAction( text, parent ) {} -void GlobalCollectionTrackAction::setTrack( Meta::TrackPtr track ) +void GlobalCollectionTrackAction::setTrack( const Meta::TrackPtr &track ) { m_currentTrack = track; } @@ -276,7 +276,7 @@ {} void -GlobalCollectionYearAction::setYear( Meta::YearPtr year ) +GlobalCollectionYearAction::setYear( const Meta::YearPtr &year ) { m_currentYear = year; } @@ -292,7 +292,7 @@ {} void -GlobalCollectionComposerAction::setComposer(Meta::ComposerPtr composer) +GlobalCollectionComposerAction::setComposer(const Meta::ComposerPtr &composer) { m_currentComposer = composer; } diff --git a/src/GlobalCurrentTrackActions.h b/src/GlobalCurrentTrackActions.h --- a/src/GlobalCurrentTrackActions.h +++ b/src/GlobalCurrentTrackActions.h @@ -19,7 +19,9 @@ #include "amarok_export.h" #include "core/meta/forward_declarations.h" -#include "core/support/SmartPointerList.h" + +#include + class GlobalCurrentTrackActions; class QAction; @@ -33,7 +35,7 @@ @author Nikolaj Hald Nielsen */ -class AMAROK_EXPORT GlobalCurrentTrackActions +class AMAROK_EXPORT GlobalCurrentTrackActions : public QObject { friend GlobalCurrentTrackActions* The::globalCurrentTrackActions(); @@ -45,7 +47,7 @@ GlobalCurrentTrackActions(); ~GlobalCurrentTrackActions(); - SmartPointerList m_actions; + QList m_actions; }; #endif diff --git a/src/GlobalCurrentTrackActions.cpp b/src/GlobalCurrentTrackActions.cpp --- a/src/GlobalCurrentTrackActions.cpp +++ b/src/GlobalCurrentTrackActions.cpp @@ -21,7 +21,7 @@ namespace The { - static GlobalCurrentTrackActions* s_GlobalCurrentTrackActions_instance = 0; + static GlobalCurrentTrackActions* s_GlobalCurrentTrackActions_instance = nullptr; GlobalCurrentTrackActions* globalCurrentTrackActions() { @@ -36,25 +36,18 @@ GlobalCurrentTrackActions::GlobalCurrentTrackActions() {} - GlobalCurrentTrackActions::~GlobalCurrentTrackActions() {} void GlobalCurrentTrackActions::addAction( QAction * action ) { m_actions.append( action ); + QObject::connect( action, &QObject::destroyed, this, [this, action]() { m_actions.removeAll( action ); } ); } QList< QAction * > GlobalCurrentTrackActions::actions() { - // Here we filter out dangling pointers to already destroyed QActions - - QList validActions; - - foreach( QAction* action, m_actions ) - validActions.append( action ); - - return validActions; + return m_actions; } diff --git a/src/KNotificationBackend.cpp b/src/KNotificationBackend.cpp --- a/src/KNotificationBackend.cpp +++ b/src/KNotificationBackend.cpp @@ -29,7 +29,7 @@ using namespace Amarok; KNotificationBackend * -KNotificationBackend::s_instance = 0; +KNotificationBackend::s_instance = nullptr; KNotificationBackend * KNotificationBackend::instance() @@ -43,7 +43,7 @@ KNotificationBackend::destroy() { delete s_instance; - s_instance = 0; + s_instance = nullptr; } KNotificationBackend::KNotificationBackend() @@ -93,7 +93,7 @@ if( pixmap.isNull() ) { KIconLoader loader; - icon = loader.loadIcon( QString("amarok"), KIconLoader::Desktop ); + icon = loader.loadIcon( QStringLiteral("amarok"), KIconLoader::Desktop ); } else icon = pixmap; diff --git a/src/LastfmReadLabelCapability.h b/src/LastfmReadLabelCapability.h --- a/src/LastfmReadLabelCapability.h +++ b/src/LastfmReadLabelCapability.h @@ -33,7 +33,7 @@ { Q_OBJECT public: - LastfmReadLabelCapability( Meta::Track *track ); + explicit LastfmReadLabelCapability( Meta::Track *track ); virtual void fetchLabels(); virtual void fetchGlobalLabels(); virtual QStringList labels(); diff --git a/src/MainWindow.h b/src/MainWindow.h --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -28,28 +28,24 @@ #include #include -#include +#include class CollectionWidget; class SlimToolbar; class MainToolbar; class MainWindow; #ifdef DEBUG_BUILD_TYPE class NetworkAccessViewer; #endif // DEBUG_BUILD_TYPE -class PlaylistFileProvider; namespace PlaylistBrowserNS { class PlaylistBrowser; } namespace Playlist { class Dock; } class BrowserDock; class ContextDock; class QMenu; -class QAction; class QMenuBar; -class QSplitter; -class QTimer; namespace The { AMAROK_EXPORT MainWindow* mainWindow(); @@ -66,8 +62,6 @@ */ class AMAROK_EXPORT MainWindow : public KMainWindow { - friend MainWindow* The::mainWindow(); - Q_OBJECT public: @@ -78,7 +72,7 @@ }; MainWindow(); - ~MainWindow(); + ~MainWindow() override; void activate(); @@ -95,7 +89,7 @@ void deleteBrowsers(); /* Reimplemented from QMainWindow to allow only one active toolbar at any time */ - virtual QMenu* createPopupMenu(); + QMenu* createPopupMenu() override; void addViewMenuItems(QMenu* menu); @@ -172,8 +166,8 @@ #endif // DEBUG_BUILD_TYPE protected: - virtual void closeEvent( QCloseEvent* ); - virtual void changeEvent( QEvent *event ); + void closeEvent( QCloseEvent* ) override; + void changeEvent( QEvent *event ) override; private Q_SLOTS: void setRating1() { setRating( 1 ); } @@ -211,8 +205,6 @@ int m_lastBrowser; int m_searchField; - static QPointer s_instance; - bool m_waitingForCd; }; diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -23,6 +23,7 @@ #include "MainWindow.h" +#include "App.h" #include "ActionClasses.h" #include "EngineController.h" //for actions in ctor #include "KNotificationBackend.h" @@ -112,22 +113,19 @@ extern OcsData ocsData; -QPointer MainWindow::s_instance; - namespace The { - MainWindow* mainWindow() { return MainWindow::s_instance.data(); } + MainWindow* mainWindow() { return pApp->mainWindow(); } } MainWindow::MainWindow() - : KMainWindow( 0 ) - , m_showMenuBar( 0 ) + : KMainWindow( nullptr ) + , m_showMenuBar( nullptr ) , m_lastBrowser( 0 ) , m_waitingForCd( false ) { DEBUG_BLOCK setObjectName( "MainWindow" ); - s_instance = this; #ifdef Q_WS_MAC (void)new GrowlInterface( qApp->applicationName() ); @@ -264,7 +262,7 @@ ServiceBrowser *serviceBrowser = ServiceBrowser::instance(); serviceBrowser->setParent( 0 ); serviceBrowser->setPrettyName( i18n( "Internet" ) ); - serviceBrowser->setIcon( QIcon::fromTheme( "applications-internet" ) ); + serviceBrowser->setIcon( QIcon::fromTheme( "internet-services" ) ); serviceBrowser->setShortDescription( i18n( "Online sources of content" ) ); m_browserDock->list()->addCategory( serviceBrowser ); PERF_LOG( "Created ServiceBrowser" ) @@ -564,7 +562,7 @@ MainWindow::slotFocusCollectionSearch() { // ensure collection browser is activated within navigation dock: - browserDock()->list()->navigate( QString("collections") ); + browserDock()->list()->navigate( QStringLiteral("collections") ); showDock( AmarokDockNavigation ); // ensure that the dock is visible if tabbed m_collectionBrowser->focusInputLine(); } @@ -638,13 +636,13 @@ void MainWindow::slotLoveTrack() { - emit loveTrack( The::engineController()->currentTrack() ); + Q_EMIT loveTrack( The::engineController()->currentTrack() ); } void MainWindow::slotBanTrack() { - emit banTrack( The::engineController()->currentTrack() ); + Q_EMIT banTrack( The::engineController()->currentTrack() ); } void @@ -741,159 +739,159 @@ KStandardAction::preferences( pApp, &App::slotConfigAmarokWithEmptyPage, ac ); m_showMenuBar = KStandardAction::showMenubar(this, &MainWindow::slotShowMenuBar, ac); - ac->action( KStandardAction::name( KStandardAction::KeyBindings ) )->setIcon( QIcon::fromTheme( "configure-shortcuts-amarok" ) ); - ac->action( KStandardAction::name( KStandardAction::Preferences ) )->setIcon( QIcon::fromTheme( "configure-amarok" ) ); + ac->action( KStandardAction::name( KStandardAction::KeyBindings ) )->setIcon( QIcon::fromTheme( QStringLiteral("configure-shortcuts-amarok") ) ); + ac->action( KStandardAction::name( KStandardAction::Preferences ) )->setIcon( QIcon::fromTheme( QStringLiteral("configure-amarok") ) ); ac->action( KStandardAction::name( KStandardAction::Preferences ) )->setMenuRole(QAction::PreferencesRole); // Define OS X Prefs menu here, removes need for ifdef later KStandardAction::quit( pApp, &App::quit, ac ); - QAction *action = new QAction( QIcon::fromTheme( "document-open" ), i18n("&Add Media..."), this ); + QAction *action = new QAction( QIcon::fromTheme( QStringLiteral("document-open") ), i18n("&Add Media..."), this ); ac->addAction( "playlist_add", action ); connect( action, &QAction::triggered, this, &MainWindow::slotAddLocation ); KGlobalAccel::setGlobalShortcut(action, QKeySequence( Qt::META + Qt::Key_A ) ); - action = new QAction( QIcon::fromTheme( "edit-clear-list" ), i18nc( "clear playlist", "&Clear Playlist" ), this ); + action = new QAction( QIcon::fromTheme( QStringLiteral("edit-clear-list") ), i18nc( "clear playlist", "&Clear Playlist" ), this ); connect( action, &QAction::triggered, pc, &Playlist::Controller::clear ); ac->addAction( "playlist_clear", action ); - action = new QAction( QIcon::fromTheme( "format-list-ordered" ), + action = new QAction( QIcon::fromTheme( QStringLiteral("format-list-ordered") ), i18nc( "edit play queue of playlist", "Edit &Queue" ), this ); //Qt::META+Qt::Key_Q is taken by Plasma as a global action->setShortcut( QKeySequence( Qt::META + Qt::Key_U ) ); - ac->addAction( "playlist_edit_queue", action );; + ac->addAction( "playlist_edit_queue", action ); action = new QAction( i18nc( "Remove duplicate and dead (unplayable) tracks from the playlist", "Re&move Duplicates" ), this ); connect( action, &QAction::triggered, pc, &Playlist::Controller::removeDeadAndDuplicates ); ac->addAction( "playlist_remove_dead_and_duplicates", action ); action = new Playlist::LayoutConfigAction( this ); ac->addAction( "playlist_layout", action ); - action = new QAction( QIcon::fromTheme( "document-open-remote" ), i18n("&Add Stream..."), this ); + action = new QAction( QIcon::fromTheme( QStringLiteral("document-open-remote") ), i18n("&Add Stream..."), this ); connect( action, &QAction::triggered, this, &MainWindow::slotAddStream ); ac->addAction( "stream_add", action ); - action = new QAction( QIcon::fromTheme( "document-export-amarok" ), i18n("&Export Playlist As..."), this ); + action = new QAction( QIcon::fromTheme( QStringLiteral("document-export-amarok") ), i18n("&Export Playlist As..."), this ); connect( action, &QAction::triggered, this, &MainWindow::exportPlaylist ); ac->addAction( "playlist_export", action ); - action = new QAction( QIcon::fromTheme( "bookmark-new" ), i18n( "Bookmark Media Sources View" ), this ); + action = new QAction( QIcon::fromTheme( QStringLiteral("bookmark-new") ), i18n( "Bookmark Media Sources View" ), this ); ac->addAction( "bookmark_browser", action ); connect( action, &QAction::triggered, The::amarokUrlHandler(), &AmarokUrlHandler::bookmarkCurrentBrowserView ); - action = new QAction( QIcon::fromTheme( "bookmarks-organize" ), i18n( "Bookmark Manager" ), this ); + action = new QAction( QIcon::fromTheme( QStringLiteral("bookmarks-organize") ), i18n( "Bookmark Manager" ), this ); ac->addAction( "bookmark_manager", action ); connect( action, &QAction::triggered, this, &MainWindow::slotShowBookmarkManager ); - action = new QAction( QIcon::fromTheme( "view-media-equalizer" ), i18n( "Equalizer" ), this ); + action = new QAction( QIcon::fromTheme( QStringLiteral("view-media-equalizer") ), i18n( "Equalizer" ), this ); ac->addAction( "equalizer_dialog", action ); connect( action, &QAction::triggered, this, &MainWindow::slotShowEqualizer ); - action = new QAction( QIcon::fromTheme( "bookmark-new" ), i18n( "Bookmark Playlist Setup" ), this ); + action = new QAction( QIcon::fromTheme( QStringLiteral("bookmark-new") ), i18n( "Bookmark Playlist Setup" ), this ); ac->addAction( "bookmark_playlistview", action ); connect( action, &QAction::triggered, The::amarokUrlHandler(), &AmarokUrlHandler::bookmarkCurrentPlaylistView ); - action = new QAction( QIcon::fromTheme( "bookmark-new" ), i18n( "Bookmark Context Applets" ), this ); + action = new QAction( QIcon::fromTheme( QStringLiteral("bookmark-new") ), i18n( "Bookmark Context Applets" ), this ); ac->addAction( "bookmark_contextview", action ); connect( action, &QAction::triggered, The::amarokUrlHandler(), &AmarokUrlHandler::bookmarkCurrentContextView ); - action = new QAction( QIcon::fromTheme( "media-album-cover-manager-amarok" ), i18n( "Cover Manager" ), this ); + action = new QAction( QIcon::fromTheme( QStringLiteral("media-album-cover-manager-amarok") ), i18n( "Cover Manager" ), this ); connect( action, &QAction::triggered, this, &MainWindow::slotShowCoverManager ); ac->addAction( "cover_manager", action ); - action = new QAction( QIcon::fromTheme("document-open"), i18n("Play Media..."), this ); + action = new QAction( QIcon::fromTheme(QStringLiteral("document-open")), i18n("Play Media..."), this ); ac->addAction( "playlist_playmedia", action ); action->setShortcut( Qt::CTRL + Qt::Key_O ); connect( action, &QAction::triggered, this, &MainWindow::slotPlayMedia ); - action = new QAction( QIcon::fromTheme("media-track-edit-amarok"), i18n("Edit Details of Currently Selected Track"), this ); + action = new QAction( QIcon::fromTheme(QStringLiteral("media-track-edit-amarok")), i18n("Edit Details of Currently Selected Track"), this ); ac->addAction( "trackdetails_edit", action ); action->setShortcut( Qt::CTRL + Qt::Key_E ); connect( action, &QAction::triggered, this, &MainWindow::slotEditTrackInfo ); - action = new QAction( QIcon::fromTheme( "media-seek-forward-amarok" ), + action = new QAction( QIcon::fromTheme( QStringLiteral("media-seek-forward-amarok") ), i18n( "Seek Forward by %1 seconds", KFormat().formatDecimalDuration( AmarokConfig::seekShort() * 1000 ) ), this ); ac->addAction( "seek_forward_short", action ); action->setShortcut( Qt::CTRL + Qt::Key_Right ); connect( action, &QAction::triggered, this, &MainWindow::slotSeekForwardShort ); - action = new QAction( QIcon::fromTheme( "media-seek-forward-amarok" ), + action = new QAction( QIcon::fromTheme( QStringLiteral("media-seek-forward-amarok") ), i18n( "Seek Forward by %1 seconds", KFormat().formatDecimalDuration( AmarokConfig::seekMedium() * 1000 ) ), this ); ac->addAction( "seek_forward_medium", action ); action->setShortcut( Qt::Key_Right ); KGlobalAccel::setGlobalShortcut(action, QKeySequence( Qt::META + Qt::SHIFT + Qt::Key_Plus ) ); connect( action, &QAction::triggered, this, &MainWindow::slotSeekForwardMedium ); - action = new QAction( QIcon::fromTheme( "media-seek-forward-amarok" ), + action = new QAction( QIcon::fromTheme( QStringLiteral("media-seek-forward-amarok") ), i18n( "Seek Forward by %1 seconds", KFormat().formatDecimalDuration( AmarokConfig::seekLong() * 1000 ) ), this ); ac->addAction( "seek_forward_long", action ); action->setShortcut( Qt::SHIFT + Qt::Key_Right ); connect( action, &QAction::triggered, this, &MainWindow::slotSeekForwardLong ); - action = new QAction( QIcon::fromTheme( "media-seek-backward-amarok" ), + action = new QAction( QIcon::fromTheme( QStringLiteral("media-seek-backward-amarok") ), i18n( "Seek Backward by %1 seconds", KFormat().formatDecimalDuration( AmarokConfig::seekShort() * 1000 ) ), this ); ac->addAction( "seek_backward_short", action ); action->setShortcut( Qt::CTRL + Qt::Key_Left ); connect( action, &QAction::triggered, this, &MainWindow::slotSeekBackwardShort ); - action = new QAction( QIcon::fromTheme( "media-seek-backward-amarok" ), + action = new QAction( QIcon::fromTheme( QStringLiteral("media-seek-backward-amarok") ), i18n( "Seek Backward by %1 seconds", KFormat().formatDecimalDuration( AmarokConfig::seekMedium() * 1000 ) ), this ); ac->addAction( "seek_backward_medium", action ); action->setShortcut( Qt::Key_Left ); KGlobalAccel::setGlobalShortcut(action, QKeySequence( Qt::META + Qt::SHIFT + Qt::Key_Minus ) ); connect( action, &QAction::triggered, this, &MainWindow::slotSeekBackwardMedium ); - action = new QAction( QIcon::fromTheme( "media-seek-backward-amarok" ), + action = new QAction( QIcon::fromTheme( QStringLiteral("media-seek-backward-amarok") ), i18n( "Seek Backward by %1 seconds", KFormat().formatDecimalDuration( AmarokConfig::seekLong() * 1000 ) ), this ); ac->addAction( "seek_backward_long", action ); action->setShortcut( Qt::SHIFT + Qt::Key_Left ); connect( action, &QAction::triggered, this, &MainWindow::slotSeekBackwardLong ); PERF_LOG( "MainWindow::createActions 6" ) - action = new QAction( QIcon::fromTheme("view-refresh"), i18n( "Update Collection" ), this ); + action = new QAction( QIcon::fromTheme(QStringLiteral("view-refresh")), i18n( "Update Collection" ), this ); connect ( action, &QAction::triggered, CollectionManager::instance(), &CollectionManager::checkCollectionChanges ); ac->addAction( "update_collection", action ); - action = new QAction( QIcon::fromTheme( "amarok_playcount" ), i18n( "Synchronize Statistics..." ), this ); + action = new QAction( QIcon::fromTheme( QStringLiteral("amarok_playcount") ), i18n( "Synchronize Statistics..." ), this ); ac->addAction( "synchronize_statistics", action ); connect( action, &QAction::triggered, Amarok::Components::statSyncingController(), &StatSyncing::Controller::synchronize ); Amarok::Components::statSyncingController(); action = new QAction( this ); ac->addAction( "prev", action ); - action->setIcon( QIcon::fromTheme("media-skip-backward-amarok") ); + action->setIcon( QIcon::fromTheme(QStringLiteral("media-skip-backward-amarok")) ); action->setText( i18n( "Previous Track" ) ); KGlobalAccel::setGlobalShortcut(action, QKeySequence() ); connect( action, &QAction::triggered, pa, &Playlist::Actions::back ); action = new QAction( this ); ac->addAction( "replay", action ); - action->setIcon( QIcon::fromTheme("media-playback-start") ); + action->setIcon( QIcon::fromTheme(QStringLiteral("media-playback-start")) ); action->setText( i18n( "Restart current track" ) ); KGlobalAccel::setGlobalShortcut(action, QKeySequence() ); connect( action, &QAction::triggered, ec, &EngineController::replay ); action = new QAction( this ); ac->addAction( "shuffle_playlist", action ); - action->setIcon( QIcon::fromTheme("media-playlist-shuffle") ); + action->setIcon( QIcon::fromTheme(QStringLiteral("media-playlist-shuffle")) ); action->setText( i18n( "Shuffle Playlist" ) ); action->setShortcut( Qt::CTRL + Qt::Key_H ); connect( action, &QAction::triggered, this, &MainWindow::slotShufflePlaylist ); action = new QAction( this ); - ac->addAction( "repopulate", action ); + ac->addAction( QStringLiteral("repopulate"), action ); action->setText( i18n( "Repopulate Playlist" ) ); action->setIcon( QIcon::fromTheme("view-refresh-amarok") ); connect( action, &QAction::triggered, pa, &Playlist::Actions::repopulateDynamicPlaylist ); action = new QAction( this ); - ac->addAction( "disable_dynamic", action ); + ac->addAction( QStringLiteral("disable_dynamic"), action ); action->setText( i18n( "Disable Dynamic Playlist" ) ); action->setIcon( QIcon::fromTheme("edit-delete-amarok") ); //this is connected inside the dynamic playlist category - action = new QAction( QIcon::fromTheme("media-skip-forward-amarok"), i18n( "Next Track" ), this ); + action = new QAction( QIcon::fromTheme(QStringLiteral("media-skip-forward-amarok")), i18n( "Next Track" ), this ); ac->addAction( "next", action ); KGlobalAccel::setGlobalShortcut(action, QKeySequence() ); connect( action, &QAction::triggered, pa, &Playlist::Actions::next ); @@ -1193,6 +1191,7 @@ KBugReport * rbDialog = new KBugReport( KAboutData::applicationData() ,this ); rbDialog->setObjectName( "KBugReport" ); rbDialog->exec(); + delete rbDialog; } void @@ -1350,7 +1349,7 @@ Collections::MemoryCollection * cdColl = dynamic_cast( collection ); - if( !cdColl || cdColl->trackMap().count() == 0 ) + if( !cdColl || cdColl->trackMap().isEmpty() ) { debug() << "cd collection not ready yet (track count = 0 )"; m_waitingForCd = true; diff --git a/src/MediaDeviceCache.cpp b/src/MediaDeviceCache.cpp --- a/src/MediaDeviceCache.cpp +++ b/src/MediaDeviceCache.cpp @@ -38,7 +38,7 @@ #include -MediaDeviceCache* MediaDeviceCache::s_instance = 0; +MediaDeviceCache* MediaDeviceCache::s_instance = nullptr; MediaDeviceCache::MediaDeviceCache() : QObject() , m_type() @@ -55,7 +55,7 @@ MediaDeviceCache::~MediaDeviceCache() { - s_instance = 0; + s_instance = nullptr; } void @@ -221,16 +221,16 @@ } } - debug() << "udi" << udi << "is AFC cabable (Apple mobile device)"; + debug() << "udi" << udi << "is AFC capable (Apple mobile device)"; m_type[udi] = MediaDeviceCache::SolidGenericType; m_name[udi] = device.vendor() + " - " + device.product(); } else { debug() << "udi " << udi << " does not describe a portable media player or storage volume"; return; } - emit deviceAdded( udi ); + Q_EMIT deviceAdded( udi ); } void @@ -244,17 +244,17 @@ disconnect( device.as(), &Solid::StorageAccess::accessibilityChanged, this, &MediaDeviceCache::slotAccessibilityChanged ); m_volumes.removeAll( udi ); - emit deviceRemoved( udi ); + Q_EMIT deviceRemoved( udi ); } if( m_type.contains( udi ) ) { m_type.remove( udi ); m_name.remove( udi ); - emit deviceRemoved( udi ); + Q_EMIT deviceRemoved( udi ); return; } debug() << "Odd, got a deviceRemoved at udi " << udi << " but it did not seem to exist in the first place..."; - emit deviceRemoved( udi ); + Q_EMIT deviceRemoved( udi ); } void @@ -268,22 +268,22 @@ Solid::StorageAccess *ssa = device.as(); if( ssa ) m_name[udi] = ssa->filePath(); - emit deviceAdded( udi ); + Q_EMIT deviceAdded( udi ); return; } else { if( m_type.contains( udi ) ) { m_type.remove( udi ); m_name.remove( udi ); - emit deviceRemoved( udi ); + Q_EMIT deviceRemoved( udi ); return; } debug() << "Got accessibility changed to false but was not there in the first place..."; } - emit accessibilityChanged( accessible, udi ); + Q_EMIT accessibilityChanged( accessible, udi ); } MediaDeviceCache::DeviceType @@ -349,7 +349,7 @@ debug() << "Could convert parent to PortableMediaPlayer, returning true"; return true; } - if( QFile::exists( ssa->filePath() + '/' + ".is_audio_player" ) ) + if( QFile::exists( ssa->filePath() + QLatin1Char('/') + ".is_audio_player" ) ) { return true; } diff --git a/src/MediaDeviceMonitor.h b/src/MediaDeviceMonitor.h --- a/src/MediaDeviceMonitor.h +++ b/src/MediaDeviceMonitor.h @@ -76,14 +76,14 @@ /** - checkDevice checks if @param udi is a known device + checkDevice checks if @p udi is a known device and if so attempts to connect it checkOneDevice runs an identify check using the given assistant and udi checkDevicesFor checks if the device type described - by @param assistant matches any of the udi's in the + by @p assistant matches any of the udi's in the MediaDeviceCache, and if so, attempts to connect to it diff --git a/src/MediaDeviceMonitor.cpp b/src/MediaDeviceMonitor.cpp --- a/src/MediaDeviceMonitor.cpp +++ b/src/MediaDeviceMonitor.cpp @@ -33,7 +33,7 @@ #include -MediaDeviceMonitor* MediaDeviceMonitor::s_instance = 0; +MediaDeviceMonitor* MediaDeviceMonitor::s_instance = nullptr; MediaDeviceMonitor::MediaDeviceMonitor() : QObject() , m_udiAssistants() @@ -50,7 +50,7 @@ MediaDeviceMonitor::~MediaDeviceMonitor() { - s_instance = 0; + s_instance = nullptr; } void @@ -180,7 +180,7 @@ } -// emit deviceRemoved( udi ); +// Q_EMIT deviceRemoved( udi ); } void diff --git a/src/OpmlOutline.h b/src/OpmlOutline.h --- a/src/OpmlOutline.h +++ b/src/OpmlOutline.h @@ -35,12 +35,12 @@ class AMAROK_EXPORT OpmlOutline { public: - OpmlOutline( OpmlOutline *parent = 0 ); + explicit OpmlOutline( OpmlOutline *parent = nullptr ); ~OpmlOutline() {} OpmlOutline *parent() const { return m_parent; } void setParent( OpmlOutline *parent ) { m_parent = parent; } - bool isRootItem() const { return m_parent == 0; } + bool isRootItem() const { return m_parent == nullptr; } QMap attributes() const { return m_attributes; } @@ -56,7 +56,7 @@ void setHasChildren( bool hasChildren ) { m_hasChildren = hasChildren; } bool hasChildren() const { return m_hasChildren; } void addChild( OpmlOutline *outline ) { m_children << outline; } - void addChildren( QList outlineList ) + void addChildren( const QList &outlineList ) { m_children << outlineList; } OpmlNodeType opmlNodeType() const; diff --git a/src/OpmlParser.h b/src/OpmlParser.h --- a/src/OpmlParser.h +++ b/src/OpmlParser.h @@ -47,55 +47,55 @@ static const QString OPML_MIME; /** * Constructor - * @param fileName The file to parse + * @param url The address to parse * @return Pointer to new object */ - OpmlParser( const QUrl &url ); + explicit OpmlParser( const QUrl &url ); /** * Destructor * @return none */ - ~OpmlParser(); + ~OpmlParser() override; /** * The function that starts the actual work. Inherited from ThreadWeaver::Job * Note the work is performed in a separate thread * @return Returns true on success and false on failure */ - void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) Q_DECL_OVERRIDE; + void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = nullptr) override; bool read( const QUrl &url ); bool read( QIODevice *device ); /** @return the URL of the OPML being parsed. */ QUrl url() const { return m_url; } - QMap headerData() { return m_headerData; } + QMap headerData() const { return m_headerData; } /** * Get the result of the parsing as a list of OpmlOutlines. - * This list contains only root outlines that can be found in the of the OPML. + * This list contains only root outlines that can be found in the \ of the OPML. * The rest are children of these root items. * * The user is responsible for deleting the results. */ QList results() const { return m_outlines; } protected: - void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; - void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; + void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; + void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; Q_SIGNALS: /** - * Emitted when has been completely parsed. + * Emitted when \ has been completely parsed. */ void headerDone(); /** - * Signal emmited when parsing is complete. + * Signal emitted when parsing is complete. * The data is complete now and accessible via results(). * Children of all the outlines are available via OpmlOutline::children(). */ @@ -158,7 +158,7 @@ class Action { public: - Action( ActionMap &actionMap ) + explicit Action( ActionMap &actionMap ) : m_actionMap( actionMap ) , m_begin( 0 ) , m_end( 0 ) diff --git a/src/OpmlParser.cpp b/src/OpmlParser.cpp --- a/src/OpmlParser.cpp +++ b/src/OpmlParser.cpp @@ -127,7 +127,7 @@ i18n( "Reading OPML podcast from %1 failed with error:\n", m_url.url() ); errorMessage = errorMessage.append( job->errorString() ); -// emit statusBarSorryMessage( errorMessage ); +// Q_EMIT statusBarSorryMessage( errorMessage ); } m_transferJob = 0; @@ -291,7 +291,7 @@ if( hasError() ) { - emit doneParsing(); + Q_EMIT doneParsing(); return false; } @@ -344,7 +344,7 @@ action->characters( this ); } - // ignoreable whitespaces + // ignorable whitespaces case Comment: case EntityReference: case ProcessingInstruction: @@ -369,7 +369,7 @@ m_transferJob = 0; } - emit doneParsing(); + Q_EMIT doneParsing(); } void @@ -400,7 +400,7 @@ foreach( const QXmlStreamAttribute &attribute, attributes() ) outline->addAttribute( attribute.name().toString(), attribute.value().toString() ); - emit outlineParsed( outline ); + Q_EMIT outlineParsed( outline ); } void @@ -412,13 +412,13 @@ void OpmlParser::endDocument() { - emit doneParsing(); + Q_EMIT doneParsing(); } void OpmlParser::endHead() { - emit headerDone(); + Q_EMIT headerDone(); } void diff --git a/src/OpmlWriter.h b/src/OpmlWriter.h --- a/src/OpmlWriter.h +++ b/src/OpmlWriter.h @@ -29,29 +29,29 @@ Q_OBJECT public: /** OpmlWriter will write the OPML outline objects as XML text. - * @arg rootOutlines the of the OPML - * @arg headerData these fields are put in the of the OPML + * @arg rootOutlines the \ of the OPML + * @arg headerData these fields are put in the \ of the OPML * @arg device QIODevice to write to * The children of IncludeNodes will not be written. Remove the type="include" attribute * from the include node to force a save of those child nodes. */ - OpmlWriter( const QList rootOutlines, - const QMap headerData, + OpmlWriter( const QList &rootOutlines, + const QMap &headerData, QIODevice *device ); - void setHeaderData( const QMap data ) { m_headerData = data; } + void setHeaderData( const QMap &data ) { m_headerData = data; } /** * The function that starts the actual work. Inherited from ThreadWeaver::Job * Note the work is performed in a separate thread - * @return Returns true on success and false on failure + * @return Returns @c true on success and @c false on failure */ - void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) Q_DECL_OVERRIDE; + void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = nullptr) override; QIODevice *device() { return m_xmlWriter->device(); } Q_SIGNALS: /** - * Signal emmited when writing is complete. + * Signal emitted when writing is complete. */ void result( int error ); @@ -72,8 +72,8 @@ QXmlStreamWriter *m_xmlWriter; protected: - void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; - void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; + void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; + void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; }; diff --git a/src/OpmlWriter.cpp b/src/OpmlWriter.cpp --- a/src/OpmlWriter.cpp +++ b/src/OpmlWriter.cpp @@ -19,8 +19,8 @@ #include -OpmlWriter::OpmlWriter( const QList rootOutlines, - const QMap headerData, +OpmlWriter::OpmlWriter(const QList &rootOutlines, + const QMap &headerData, QIODevice *device ) : QObject() , ThreadWeaver::Job() @@ -52,7 +52,7 @@ foreach( const OpmlOutline *childOutline, m_rootOutlines ) writeOutline( childOutline ); _x->writeEndDocument(); //implicitly closes all open tags (opml & body) - emit result( 0 ); + Q_EMIT result( 0 ); } void diff --git a/src/PaletteHandler.h b/src/PaletteHandler.h --- a/src/PaletteHandler.h +++ b/src/PaletteHandler.h @@ -50,13 +50,16 @@ /** Gives the item view a special darker palette and transparent background. You need to connect to the newPalette signal afterwards because this darker palette does not automatically update. + @param view the item view. */ void updateItemView( QAbstractItemView * view ); /** * Returns the foreground color for the painter by checking the painting QWidget::foregroundRole() and falling back to - * QPalette::WindowText (or QPalette::HighlightedText if @param selected) + * QPalette::WindowText (or QPalette::HighlightedText if @p selected) * Uses the widgets palette or the application palette as fallback + * @param p the painter. + * @param selected the mode switcher. */ QColor foregroundColor( const QPainter *p, bool selected = false ); @@ -86,7 +89,7 @@ void newPalette( const QPalette & palette ); private: - PaletteHandler( QObject* parent = 0 ); + PaletteHandler( QObject* parent = nullptr ); QPalette m_palette; }; diff --git a/src/PaletteHandler.cpp b/src/PaletteHandler.cpp --- a/src/PaletteHandler.cpp +++ b/src/PaletteHandler.cpp @@ -49,7 +49,7 @@ PaletteHandler::setPalette( const QPalette & palette ) { m_palette = palette; - emit( newPalette( m_palette ) ); + Q_EMIT( newPalette( m_palette ) ); } void diff --git a/src/PluginManager.h b/src/PluginManager.h --- a/src/PluginManager.h +++ b/src/PluginManager.h @@ -22,6 +22,7 @@ #include #include +#include namespace Plugins { @@ -67,16 +68,13 @@ /** Returns enabled plugin factories for the given plugin type. * - * This function will only return enable factories. - * - * Owner of the PluginFactory pointers is the PluginManager - * and the pointers will only be valid while the PluginManager exists. + * This function will only return factories for enabled plugins. */ - QList factories( Type type ) const; + QList > factories( Type type ) const; KPluginInfo::List plugins( Type type ) const; - QList enabledPlugins (Type type ) const; + QVector enabledPlugins(Type type ) const; /** Check if any services were disabled and needs to be removed, or any * that are hidden needs to be enabled @@ -98,19 +96,19 @@ */ bool isPluginEnabled( const KPluginMetaData &plugin ) const; - /** Creates a factories for an info */ - PluginFactory* createFactory( const KPluginMetaData &pluginInfo ); + /** Creates a factories for a plugin */ + QSharedPointer createFactory( const KPluginMetaData &pluginInfo ); /// contains the names of all KPluginInfos that have factories created QVector m_plugins; QHash > m_pluginsByType; - QHash > m_factoriesByType; - QHash m_factoryCreated; + QHash > > m_factoriesByType; + QHash> m_factoryCreated; static const int s_pluginFrameworkVersion; static PluginManager *s_instance; - PluginManager( QObject *parent = 0 ); + explicit PluginManager( QObject *parent = nullptr ); }; } // namespace Plugins diff --git a/src/PluginManager.cpp b/src/PluginManager.cpp --- a/src/PluginManager.cpp +++ b/src/PluginManager.cpp @@ -41,7 +41,7 @@ * This must match the desktop files. */ const int Plugins::PluginManager::s_pluginFrameworkVersion = 73; -Plugins::PluginManager* Plugins::PluginManager::s_instance = Q_NULLPTR; +Plugins::PluginManager* Plugins::PluginManager::s_instance = nullptr; Plugins::PluginManager* Plugins::PluginManager::instance() @@ -55,7 +55,7 @@ if( s_instance ) { delete s_instance; - s_instance = Q_NULLPTR; + s_instance = nullptr; } } @@ -74,7 +74,7 @@ Plugins::PluginManager::~PluginManager() { // tell the managers to get rid of their current factories - QList emptyFactories; + QList > emptyFactories; StatSyncing::Controller *controller = Amarok::Components::statSyncingController(); if( controller ) @@ -105,10 +105,10 @@ return infos; } -QList +QVector Plugins::PluginManager::enabledPlugins(Plugins::PluginManager::Type type) const { - QList enabledList; + QVector enabledList; for( const auto &plugin : m_pluginsByType.value( type ) ) { @@ -119,7 +119,7 @@ return enabledList; } -QList +QList > Plugins::PluginManager::factories( Type type ) const { return m_factoriesByType.value( type ); @@ -155,7 +155,7 @@ for( const auto &pluginInfo : m_plugins ) { // create the factories and sort them by type - PluginFactory *factory = createFactory( pluginInfo ); + auto factory = createFactory( pluginInfo ); if( factory ) { @@ -186,7 +186,7 @@ } // the setFactories functions should: - // - filter out factories not usefull (e.g. services when setting collections) + // - filter out factories not useful (e.g. services when setting collections) // - handle the new list of factories, disabling old ones and enabling new ones. @@ -265,7 +265,7 @@ } -Plugins::PluginFactory* +QSharedPointer Plugins::PluginManager::createFactory( const KPluginMetaData &pluginInfo ) { debug() << "Creating factory for plugin:" << pluginInfo.pluginId(); @@ -280,13 +280,14 @@ return m_factoryCreated.value( name ); QPluginLoader loader( pluginInfo.fileName() ); - auto pluginFactory = qobject_cast( loader.instance() ); + auto pointer = qobject_cast( loader.instance() ); + auto pluginFactory = QSharedPointer( pointer ); if( !pluginFactory ) { warning() << QString( "Failed to get factory '%1' from QPluginLoader: %2" ) .arg( name, loader.errorString() ); - return Q_NULLPTR; + return QSharedPointer(); } m_factoryCreated[ name ] = pluginFactory; diff --git a/src/PopupDropperFactory.h b/src/PopupDropperFactory.h --- a/src/PopupDropperFactory.h +++ b/src/PopupDropperFactory.h @@ -54,7 +54,7 @@ static void adjustItemCallback( void *pdi ); private: - PopupDropperFactory( QObject* parent ); + explicit PopupDropperFactory( QObject* parent ); ~PopupDropperFactory(); }; diff --git a/src/QStringx.h b/src/QStringx.h --- a/src/QStringx.h +++ b/src/QStringx.h @@ -29,11 +29,11 @@ { public: QStringx(); - QStringx( QChar ch ); - QStringx( const QString &s ); - QStringx( const QByteArray &ba ); + explicit QStringx( QChar ch ); + explicit QStringx( const QString &s ); + explicit QStringx( const QByteArray &ba ); QStringx( const QChar *unicode, uint length ); - QStringx( const char *str ); + explicit QStringx( const char *str ); virtual ~QStringx(); // the numbers following % obviously are not taken into account diff --git a/src/QStringx.cpp b/src/QStringx.cpp --- a/src/QStringx.cpp +++ b/src/QStringx.cpp @@ -77,7 +77,7 @@ QString Amarok::QStringx::namedArgs( const QMap &args, bool opt ) const { - // Screen all kindes of brackets and format string with namedOptArgs. + // Screen all kinds of brackets and format string with namedOptArgs. QString formatString = *this; formatString.replace( QRegExp( "([\\[\\]{}])" ),"\\\\1" ); @@ -119,7 +119,7 @@ if( c == QLatin1Char( '[' ) ) return CTBracketOpen; - if( c == QLatin1Char( ':' ) ) + if( c == QLatin1Char( QLatin1Char(':') ) ) return CTBracketSeparator; if( c == QLatin1Char( ']' ) ) @@ -236,7 +236,7 @@ ( *pos )++; - // Parse token manuly (not by calling parseToken), because we need token name. + // Parse token manually (not by calling parseToken), because we need token name. CharType ct = testChar( pos ); QString key; @@ -280,7 +280,7 @@ } case CTToken: { - replacement += parseToken( pos, dict );; + replacement += parseToken( pos, dict ); break; } diff --git a/src/SvgHandler.h b/src/SvgHandler.h --- a/src/SvgHandler.h +++ b/src/SvgHandler.h @@ -67,6 +67,7 @@ /** * Another overloaded function that loads a svg file from an url. This function is usable from QML. + * @param url the given URL * @param keyname the name of the key to save in the cache * @param width Width of the resulting pixmap * @param height Height of the resulting pixmap @@ -94,13 +95,13 @@ * * @param album The AlbumPtr * @param size The size of the resulting image (border included) - * @borderWidth The desired width of the border + * @param borderWidth The desired width of the border */ QPixmap imageWithBorder( Meta::AlbumPtr album, int size = 1, int borderWidth = 5 ); /** * Add nice borders to a pixmap. The function will create and return a new - * Pixmal that is the size of the old one plus twice the border width in + * Pixmap that is the size of the old one plus twice the border width in * each dimension. * * @param orgPixmap The original pixmap. @@ -117,7 +118,9 @@ * The background part before the knob, is painted in a different color than the * part after (and under) the knob. * @param p The painter to use. - * @param percentage The percentange of the slider that the knob is positioned at. + * @param slider The slider. + * @param percentage The percentage of the slider that the knob is positioned at. + * @param paintMoodbar Whether to paint a moodbar. */ void paintCustomSlider( QPainter *p, QStyleOptionSlider *slider, qreal percentage, bool paintMoodbar = false ); @@ -153,7 +156,7 @@ void discardCache(); private: - SvgHandler( QObject* parent = 0 ); + SvgHandler( QObject* parent = nullptr ); bool loadSvg( const QString& name, bool forceCustomTheme = false ); diff --git a/src/SvgHandler.cpp b/src/SvgHandler.cpp --- a/src/SvgHandler.cpp +++ b/src/SvgHandler.cpp @@ -128,7 +128,7 @@ QString key; if( !skipCache ) { - key = QString("%1:%2x%3") + key = QStringLiteral("%1:%2x%3") .arg( keyname ) .arg( width ) .arg( height ); @@ -168,13 +168,10 @@ QPixmap SvgHandler::renderSvg( const QUrl& url, const QString& keyname, int width, int height, const QString& element, bool skipCache, const qreal opacity ) { - if( !url.isLocalFile() ) - return QPixmap(); - QString key; if( !skipCache ) { - key = QString("%1:%2x%3") + key = QStringLiteral("%1:%2x%3") .arg( keyname ) .arg( width ) .arg( height ); @@ -186,7 +183,7 @@ pixmap = QPixmap( width, height ); pixmap.fill( Qt::transparent ); - QString name = url.toLocalFile(); + QString name = url.isLocalFile() ? url.toLocalFile() : ":" + url.path(); QReadLocker readLocker( &m_lock ); if( ! m_renderers[name] ) { @@ -220,14 +217,14 @@ QPixmap SvgHandler::renderSvgWithDividers(const QString & keyname, int width, int height, const QString & element) { - const QString key = QString("%1:%2x%3-div") + const QString key = QStringLiteral("%1:%2x%3-div") .arg( keyname ) .arg( width ) .arg( height ); QPixmap pixmap; if ( !m_cache->findPixmap( key, &pixmap ) ) { -// debug() << QString("svg %1 not in cache...").arg( key ); +// debug() << QStringLiteral("svg %1 not in cache...").arg( key ); pixmap = QPixmap( width, height ); pixmap.fill( Qt::transparent ); @@ -270,7 +267,7 @@ The::svgTinter()->init(); if ( !loadSvg( m_themeFile )) warning() << "Unable to load theme file: " << m_themeFile; - emit retinted(); + Q_EMIT retinted(); } QString SvgHandler::themeFile() @@ -314,7 +311,7 @@ QString key; if( !skipCache ) { - key = QString("%1:%2x%3b%4") + key = QStringLiteral("%1:%2x%3b%4") .arg( name ) .arg( newWidth ) .arg( newHeight ) diff --git a/src/SvgTinter.cpp b/src/SvgTinter.cpp --- a/src/SvgTinter.cpp +++ b/src/SvgTinter.cpp @@ -25,7 +25,7 @@ #include -SvgTinter * SvgTinter::s_instance = 0; +SvgTinter * SvgTinter::s_instance = nullptr; SvgTinter::SvgTinter() : m_firstRun( true ) @@ -39,7 +39,7 @@ {} QByteArray -SvgTinter::tint( const QString &filename) +SvgTinter::tint( const QString &filename ) { QFile file( filename ); if ( !file.open( QIODevice::ReadOnly ) ) @@ -129,7 +129,7 @@ SvgTinter* svgTinter() { - if ( SvgTinter::s_instance == 0 ) + if ( SvgTinter::s_instance == nullptr ) SvgTinter::s_instance = new SvgTinter(); return SvgTinter::s_instance; diff --git a/src/TrayIcon.h b/src/TrayIcon.h --- a/src/TrayIcon.h +++ b/src/TrayIcon.h @@ -22,10 +22,10 @@ #include // baseclass #include "core/meta/forward_declarations.h" -#include "core/support/SmartPointerList.h" #include + class QAction; namespace Amarok { @@ -35,26 +35,26 @@ Q_OBJECT public: - TrayIcon( QObject *parent ); + explicit TrayIcon( QObject *parent ); private Q_SLOTS: void updateOverlayIcon(); void updateToolTipIcon(); void updateToolTip(); void updateMenu(); - void trackPlaying( Meta::TrackPtr track ); + void trackPlaying( const Meta::TrackPtr &track ); void stopped(); void paused(); - void trackMetadataChanged( Meta::TrackPtr track ); - void albumMetadataChanged( Meta::AlbumPtr album ); + void trackMetadataChanged( const Meta::TrackPtr &track ); + void albumMetadataChanged( const Meta::AlbumPtr &album ); void slotScrollRequested( int delta, Qt::Orientation orientation ); - QAction* action( const QString& name, QMap actionByName ); + QAction* action(const QString& name, const QMap &actionByName ); private: Meta::TrackPtr m_track; - SmartPointerList m_extraActions; + QList m_extraActions; QPointer m_separator; }; diff --git a/src/TrayIcon.cpp b/src/TrayIcon.cpp --- a/src/TrayIcon.cpp +++ b/src/TrayIcon.cpp @@ -169,12 +169,12 @@ { QString stars; for( int i = 0; i < rating / 2; ++i ) - stars += QString( "" ) + stars += QStringLiteral( "" ) .arg( QStandardPaths::locate( QStandardPaths::GenericDataLocation, "amarok/images/star.png" ) ) .arg( QFontMetrics( QToolTip::font() ).height() ) .arg( QFontMetrics( QToolTip::font() ).height() ); if( rating % 2 ) - stars += QString( "" ) + stars += QStringLiteral( "" ) .arg( QStandardPaths::locate( QStandardPaths::GenericDataLocation, "amarok/images/smallstar.png" ) ) .arg( QFontMetrics( QToolTip::font() ).height() ) .arg( QFontMetrics( QToolTip::font() ).height() ); @@ -201,7 +201,7 @@ } void -Amarok::TrayIcon::trackPlaying( Meta::TrackPtr track ) +Amarok::TrayIcon::trackPlaying( const Meta::TrackPtr &track ) { m_track = track; @@ -225,16 +225,16 @@ } void -Amarok::TrayIcon::trackMetadataChanged( Meta::TrackPtr track ) +Amarok::TrayIcon::trackMetadataChanged( const Meta::TrackPtr &track ) { Q_UNUSED( track ) updateToolTip(); updateMenu(); } void -Amarok::TrayIcon::albumMetadataChanged( Meta::AlbumPtr album ) +Amarok::TrayIcon::albumMetadataChanged( const Meta::AlbumPtr &album ) { Q_UNUSED( album ) @@ -251,9 +251,9 @@ } QAction* -Amarok::TrayIcon::action( const QString& name, QMap actionByName ) +Amarok::TrayIcon::action( const QString& name, const QMap &actionByName ) { - QAction* action = 0L; + QAction* action = nullptr; if ( !name.isEmpty() ) action = actionByName.value(name); @@ -289,20 +289,28 @@ if( m_track ) { foreach( QAction *action, The::globalCurrentTrackActions()->actions() ) + { m_extraActions.append( action ); + connect( action, &QObject::destroyed, this, [this, action]() { m_extraActions.removeAll( action ); } ); + } QScopedPointer ac( m_track->create() ); if( ac ) { QList actions = ac->actions(); foreach( QAction *action, actions ) + { m_extraActions.append( action ); + connect( action, &QObject::destroyed, this, [this, action]() { m_extraActions.removeAll( action ); } ); + } } QScopedPointer btc( m_track->create() ); if( btc ) { - m_extraActions.append( btc->bookmarkAction() ); + QAction *action = btc->bookmarkAction(); + m_extraActions.append( action ); + connect( action, &QObject::destroyed, this, [this, action]() { m_extraActions.removeAll( action ); } ); } } diff --git a/src/aboutdialog/AnimatedBarWidget.h b/src/aboutdialog/AnimatedBarWidget.h --- a/src/aboutdialog/AnimatedBarWidget.h +++ b/src/aboutdialog/AnimatedBarWidget.h @@ -27,13 +27,13 @@ { Q_OBJECT public: - AnimatedBarWidget( const QIcon &icon, const QString &text, const QString &animatedIconName = "process-working", QWidget *parent = 0 ); - ~AnimatedBarWidget(); + AnimatedBarWidget( const QIcon &icon, const QString &text, const QString &animatedIconName = QStringLiteral("process-working"), QWidget *parent = nullptr ); + ~AnimatedBarWidget() override; bool isAnimating() const { return m_animating; } - virtual QSize sizeHint() const; - virtual int heightForWidth(int w) const; + QSize sizeHint() const override; + int heightForWidth(int w) const override; public Q_SLOTS: void animate(); @@ -44,10 +44,10 @@ void setHoverHintEnabled( bool enable); bool isHoverHintEnabled() const; - virtual void enterEvent(QEvent* event); - virtual void leaveEvent(QEvent* event); + void enterEvent(QEvent* event) override; + void leaveEvent(QEvent* event) override; - virtual void paintEvent(QPaintEvent* event); + void paintEvent(QPaintEvent* event) override; void drawHoverBackground(QPainter* painter); //! Returns the foreground color by respecting the current display hint. @@ -57,7 +57,6 @@ void init(); bool m_hoverHint; AnimatedWidget *m_animatedWidget; - QString *m_text; bool m_animating; QIcon m_icon; }; diff --git a/src/aboutdialog/AnimatedWidget.h b/src/aboutdialog/AnimatedWidget.h --- a/src/aboutdialog/AnimatedWidget.h +++ b/src/aboutdialog/AnimatedWidget.h @@ -26,17 +26,17 @@ Q_OBJECT public: - explicit AnimatedWidget( const QString& iconName, QWidget *parent = 0 ); - virtual ~AnimatedWidget(); + explicit AnimatedWidget( const QString& iconName, QWidget *parent = nullptr ); + ~AnimatedWidget() override; public Q_SLOTS: void start(); void stop(); protected: - void paintEvent( QPaintEvent *event ); - void resizeEvent( QResizeEvent *event ); - void timerEvent( QTimerEvent *event ); + void paintEvent( QPaintEvent *event ) override; + void resizeEvent( QResizeEvent *event ) override; + void timerEvent( QTimerEvent *event ) override; private: void load(); diff --git a/src/aboutdialog/ExtendedAboutDialog.h b/src/aboutdialog/ExtendedAboutDialog.h --- a/src/aboutdialog/ExtendedAboutDialog.h +++ b/src/aboutdialog/ExtendedAboutDialog.h @@ -30,17 +30,18 @@ #include #include +#include class AMAROK_EXPORT ExtendedAboutDialog : public QDialog { Q_OBJECT public: - explicit ExtendedAboutDialog( const KAboutData aboutData, const OcsData *ocsData, QWidget *parent = 0 ); + explicit ExtendedAboutDialog( const KAboutData &aboutData, const OcsData *ocsData, QWidget *parent = nullptr ); virtual ~ExtendedAboutDialog(); private Q_SLOTS: void switchToOcsWidgets(); - void onProviderFetched( KJob *job ); + void onProvidersFetched(); void showLicense( const QString &number ); private: @@ -50,6 +51,7 @@ Q_DISABLE_COPY( ExtendedAboutDialog ) OcsData m_ocsData; + Attica::ProviderManager m_providerManager; //Authors: QString m_authorPageTitle; @@ -77,7 +79,7 @@ public: Private(ExtendedAboutDialog *parent) : q(parent), - aboutData(0) + aboutData(nullptr) {} void _k_showLicense( const QString &number ); diff --git a/src/aboutdialog/ExtendedAboutDialog.cpp b/src/aboutdialog/ExtendedAboutDialog.cpp --- a/src/aboutdialog/ExtendedAboutDialog.cpp +++ b/src/aboutdialog/ExtendedAboutDialog.cpp @@ -24,7 +24,6 @@ #include "core/support/Amarok.h" #include "core/support/Debug.h" #include "OcsPersonItem.h" -#include "libattica-ocsclient/providerinitjob.h" #include #include @@ -35,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -44,14 +44,15 @@ #include #include #include +#include void ExtendedAboutDialog::Private::_k_showLicense( const QString &number ) { QDialog *dialog = new QDialog(q); QWidget *mainWidget = new QWidget; dialog->setWindowTitle(i18n("License Agreement")); - QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close); + QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close, q); dialog->connect(buttonBox, &QDialogButtonBox::accepted, dialog, &QDialog::accept); dialog->connect(buttonBox, &QDialogButtonBox::rejected, dialog, &QDialog::reject); buttonBox->button(QDialogButtonBox::Close)->setDefault(true); @@ -85,7 +86,7 @@ dialog->show(); } -ExtendedAboutDialog::ExtendedAboutDialog(const KAboutData about, const OcsData *ocsData, QWidget *parent) +ExtendedAboutDialog::ExtendedAboutDialog(const KAboutData &about, const OcsData *ocsData, QWidget *parent) : QDialog(parent) , d(new Private(this)) { @@ -158,13 +159,13 @@ QString aboutPageText = aboutData->shortDescription() + '\n'; if (!aboutData->otherText().isEmpty()) - aboutPageText += '\n' + aboutData->otherText() + '\n'; + aboutPageText += QLatin1Char('\n') + aboutData->otherText() + '\n'; if (!aboutData->copyrightStatement().isEmpty()) - aboutPageText += '\n' + aboutData->copyrightStatement() + '\n'; + aboutPageText += QLatin1Char('\n') + aboutData->copyrightStatement() + '\n'; if (!aboutData->homepage().isEmpty()) - aboutPageText += '\n' + QString("%1").arg(aboutData->homepage()) + '\n'; + aboutPageText += QLatin1Char('\n') + QStringLiteral("%1").arg(aboutData->homepage()) + '\n'; aboutPageText = aboutPageText.trimmed(); QLabel *aboutLabel = new QLabel; @@ -184,7 +185,7 @@ const KAboutLicense &license = aboutData->licenses().at(i); QLabel *showLicenseLabel = new QLabel; - showLicenseLabel->setText(QString("%2").arg(QString::number(i), + showLicenseLabel->setText(QStringLiteral("%2").arg(QString::number(i), i18n("License: %1", license.name(KAboutLicense::FullName)))); showLicenseLabel->setTextInteractionFlags(Qt::TextBrowserInteraction); @@ -344,15 +345,15 @@ const QList translatorList = aboutData->translators(); - if(translatorList.count() > 0) { + if(!translatorList.isEmpty()) { QString translatorPageText; QList::ConstIterator it; for(it = translatorList.begin(); it != translatorList.end(); ++it) { - translatorPageText += QString("

%1

").arg((*it).name()); + translatorPageText += QStringLiteral("

%1

").arg((*it).name()); if (!(*it).emailAddress().isEmpty()) - translatorPageText += QString("

%1

").arg((*it).emailAddress()); - translatorPageText += "

 

"; + translatorPageText += QStringLiteral("

%1

").arg((*it).emailAddress()); + translatorPageText += QStringLiteral("

 

"); } translatorPageText += KAboutData::aboutTranslationTeam(); @@ -371,6 +372,8 @@ mainLayout->addWidget(buttonBox); + connect( &m_providerManager, &Attica::ProviderManager::defaultProvidersLoaded, this, &ExtendedAboutDialog::onProvidersFetched ); + resize( QSize( 480, 460 ) ); } @@ -394,27 +397,31 @@ m_showOcsCreditButton->animate(); if( m_showOcsDonorButton ) m_showOcsDonorButton->animate(); - AmarokAttica::ProviderInitJob *providerJob = AmarokAttica::Provider::byId( m_ocsData.providerId() ); - connect( providerJob, &AmarokAttica::ProviderInitJob::result, this, &ExtendedAboutDialog::onProviderFetched ); + m_providerManager.loadDefaultProviders(); } void -ExtendedAboutDialog::onProviderFetched( KJob *job ) +ExtendedAboutDialog::onProvidersFetched() { - AmarokAttica::ProviderInitJob *providerJob = qobject_cast< AmarokAttica::ProviderInitJob * >( job ); - if( providerJob->error() == 0 ) + foreach( const Attica::Provider &provider, m_providerManager.providers() ) { - debug()<<"Successfully fetched OCS provider"<< providerJob->provider().name(); + if( !provider.isValid() || !provider.isEnabled() ) + continue; + + if( provider.baseUrl().host() != m_ocsData.providerId() ) + continue; + + Attica::Provider copy = provider; + debug()<<"Successfully fetched OCS provider"<< copy.name(); debug()<<"About to request OCS data"; if( m_authorListWidget ) - m_authorListWidget->switchToOcs( providerJob->provider() ); + m_authorListWidget->switchToOcs( copy ); if( m_creditListWidget ) - m_creditListWidget->switchToOcs( providerJob->provider() ); + m_creditListWidget->switchToOcs( copy ); if( m_donorListWidget ) - m_donorListWidget->switchToOcs( providerJob->provider() ); + m_donorListWidget->switchToOcs( copy ); + break; } - else - warning() << "OCS provider fetch failed"; } void diff --git a/src/aboutdialog/FramedLabel.h b/src/aboutdialog/FramedLabel.h --- a/src/aboutdialog/FramedLabel.h +++ b/src/aboutdialog/FramedLabel.h @@ -29,12 +29,12 @@ Q_OBJECT public: - explicit FramedLabel( QWidget *parent = 0, Qt::WindowFlags f = 0 ); - explicit FramedLabel( const QString &text, QWidget *parent = 0, Qt::WindowFlags f = 0 ); - ~FramedLabel(); + explicit FramedLabel( QWidget *parent = nullptr, Qt::WindowFlags f = {} ); + explicit FramedLabel( const QString &text, QWidget *parent = nullptr, Qt::WindowFlags f = {} ); + ~FramedLabel() override; protected: - virtual void paintEvent( QPaintEvent *event ); + void paintEvent( QPaintEvent *event ) override; }; #endif //AMAROK_FRAMEDLABEL_H diff --git a/src/aboutdialog/OcsData.h b/src/aboutdialog/OcsData.h --- a/src/aboutdialog/OcsData.h +++ b/src/aboutdialog/OcsData.h @@ -31,7 +31,7 @@ public: typedef QList< QPair< QString, KAboutPerson > > OcsPersonList; - OcsData( const QByteArray &providerId = "opendesktop" ); + explicit OcsData( const QByteArray &providerId = "opendesktop" ); virtual ~OcsData(); void addAuthor( const QString &username, const KAboutPerson &person ); void addCredit( const QString &username, const KAboutPerson &person ); diff --git a/src/aboutdialog/OcsPersonItem.h b/src/aboutdialog/OcsPersonItem.h --- a/src/aboutdialog/OcsPersonItem.h +++ b/src/aboutdialog/OcsPersonItem.h @@ -19,17 +19,21 @@ #include "ui_OcsPersonItem.h" -#include "libattica-ocsclient/person.h" -#include "libattica-ocsclient/provider.h" #include "OcsData.h" #include #include +#include +#include #include class KJob; +namespace Attica { + class BaseJob; +} + class OcsPersonItem : public QWidget, private Ui::OcsPersonItem { Q_OBJECT @@ -46,25 +50,26 @@ Online = 1 }; - OcsPersonItem( const KAboutPerson &person, const QString ocsUsername, PersonStatus status, QWidget *parent = 0 ); + OcsPersonItem( const KAboutPerson &person, const QString &ocsUsername, PersonStatus status, QWidget *parent = nullptr ); virtual ~OcsPersonItem(); - QString name(); + QString name() const; - void switchToOcs( const AmarokAttica::Provider &provider ); + void switchToOcs( Attica::Provider &provider ); Q_SIGNALS: void ocsFetchStarted(); void ocsFetchResult( int err ); private Q_SLOTS: void launchUrl( QAction *action ); - void onJobFinished( KJob *job ); + void onJobFinished( Attica::BaseJob *job ); + void onAvatarLoadingJobFinished( KJob *job ); private: void init(); - void fillOcsData( const AmarokAttica::Person &ocsPerson ); + void fillOcsData( const Attica::Person &ocsPerson ); const KAboutPerson *m_person; QString m_ocsUsername; QString m_aboutText; diff --git a/src/aboutdialog/OcsPersonItem.cpp b/src/aboutdialog/OcsPersonItem.cpp --- a/src/aboutdialog/OcsPersonItem.cpp +++ b/src/aboutdialog/OcsPersonItem.cpp @@ -17,20 +17,20 @@ #include "OcsPersonItem.h" #include "core/support/Debug.h" -#include "libattica-ocsclient/provider.h" -#include "libattica-ocsclient/providerinitjob.h" -#include "libattica-ocsclient/personjob.h" #include #include #include +#include +#include +#include #include #include #include #include -OcsPersonItem::OcsPersonItem( const KAboutPerson &person, const QString ocsUsername, PersonStatus status, QWidget *parent ) +OcsPersonItem::OcsPersonItem( const KAboutPerson &person, const QString &ocsUsername, PersonStatus status, QWidget *parent ) : QWidget( parent ) , m_status( status ) , m_state( Offline ) @@ -92,15 +92,15 @@ if( !m_person->emailAddress().isEmpty() ) { - QAction *email = new QAction( QIcon::fromTheme( "internet-mail" ), i18n("Email contributor"), this ); + QAction *email = new QAction( QIcon::fromTheme( QStringLiteral("mail-send") ), i18n("Email contributor"), this ); email->setToolTip( m_person->emailAddress() ); email->setData( QString( "mailto:" + m_person->emailAddress() ) ); m_iconsBar->addAction( email ); } if( !m_person->webAddress().isEmpty() ) { - QAction *homepage = new QAction( QIcon::fromTheme( "applications-internet" ), i18n("Visit contributor's homepage"), this ); + QAction *homepage = new QAction( QIcon::fromTheme( QStringLiteral("internet-services") ), i18n("Visit contributor's homepage"), this ); homepage->setToolTip( m_person->webAddress() ); homepage->setData( m_person->webAddress() ); m_iconsBar->addAction( homepage ); @@ -115,20 +115,20 @@ {} QString -OcsPersonItem::name() +OcsPersonItem::name() const { return m_person->name(); } void OcsPersonItem::launchUrl( QAction *action ) //SLOT { QUrl url = QUrl( action->data().toString() ); - KRun::runUrl( url, "text/html", nullptr, KRun::RunExecutables, QString() ); + KRun::runUrl( url, QStringLiteral("text/html"), nullptr, KRun::RunExecutables, QString() ); } void -OcsPersonItem::switchToOcs( const AmarokAttica::Provider &provider ) +OcsPersonItem::switchToOcs( Attica::Provider &provider ) { if( m_state == Online ) return; @@ -139,37 +139,37 @@ if( !m_ocsUsername.isEmpty() ) { - AmarokAttica::PersonJob *personJob; - if( m_ocsUsername == QString( "%%category%%" ) ) //TODO: handle grouping + Attica::ItemJob< Attica::Person > *personJob; + if( m_ocsUsername == QStringLiteral( "%%category%%" ) ) //TODO: handle grouping return; personJob = provider.requestPerson( m_ocsUsername ); - connect( personJob, &AmarokAttica::PersonJob::result, this, &OcsPersonItem::onJobFinished ); - emit ocsFetchStarted(); + connect( personJob, &Attica::BaseJob::finished, this, &OcsPersonItem::onJobFinished ); + Q_EMIT ocsFetchStarted(); m_state = Online; + personJob->start(); } } void -OcsPersonItem::onJobFinished( KJob *job ) +OcsPersonItem::onJobFinished( Attica::BaseJob *job ) { - AmarokAttica::PersonJob *personJob = qobject_cast< AmarokAttica::PersonJob * >( job ); - if( personJob->error() == 0 ) + Attica::ItemJob< Attica::Person > *personJob = static_cast< Attica::ItemJob< Attica::Person > * >( job ); + Attica::Metadata metadata = personJob->metadata(); + if( metadata.error() == Attica::Metadata::NoError ) { - fillOcsData( personJob->person() ); + fillOcsData( personJob->result() ); } - emit ocsFetchResult( personJob->error() ); + Q_EMIT ocsFetchResult( metadata.error() ); } void -OcsPersonItem::fillOcsData( const AmarokAttica::Person &ocsPerson ) +OcsPersonItem::fillOcsData( const Attica::Person &ocsPerson ) { - if( !( ocsPerson.avatar().isNull() ) ) + if( ocsPerson.avatarUrl().isValid() ) { - m_avatar->setFixedSize( 56, 56 ); - m_avatar->setFrameShape( QFrame::StyledPanel ); //this is a FramedLabel, otherwise oxygen wouldn't paint the frame - m_avatar->setPixmap( ocsPerson.avatar() ); - m_avatar->setAlignment( Qt::AlignCenter ); + auto job = KIO::storedGet( ocsPerson.avatarUrl(), KIO::NoReload, KIO::HideProgressInfo ); + connect( job, &KIO::StoredTransferJob::result, this, &OcsPersonItem::onAvatarLoadingJobFinished ); } if( !ocsPerson.country().isEmpty() ) @@ -183,9 +183,9 @@ if( m_status == Author ) { - if( !ocsPerson.extendedAttribute( "ircchannels" ).isEmpty() ) + if( !ocsPerson.extendedAttribute( QStringLiteral("ircchannels") ).isEmpty() ) { - QString channelsString = ocsPerson.extendedAttribute( "ircchannels" ); + QString channelsString = ocsPerson.extendedAttribute( QStringLiteral("ircchannels") ); //We extract the channel names from the string provided by OCS: QRegExp channelrx = QRegExp( "#+[\\w\\.\\-\\/!()+]+([\\w\\-\\/!()+]?)", Qt::CaseInsensitive ); QStringList channels; @@ -201,137 +201,137 @@ foreach( const QString &channel, channels ) { const QString channelName = QString( channel ).remove( '#' ); - link = QString( "irc://irc.freenode.org/%1" ).arg( channelName ); - m_aboutText.append( QString( "%2" ).arg( link, channel ) + " " ); + link = QStringLiteral( "irc://irc.freenode.org/%1" ).arg( channelName ); + m_aboutText.append( QStringLiteral( "%2" ).arg( link, channel ) + " " ); } } - if( !ocsPerson.extendedAttribute( "favouritemusic" ).isEmpty() ) + if( !ocsPerson.extendedAttribute( QStringLiteral("favouritemusic") ).isEmpty() ) { - QStringList artists = ocsPerson.extendedAttribute( "favouritemusic" ).split( ", " ); + QStringList artists = ocsPerson.extendedAttribute( QStringLiteral("favouritemusic") ).split( QStringLiteral(", ") ); //TODO: make them clickable - m_aboutText.append( "
" + i18n( "Favorite music: " ) + artists.join( ", " ) ); + m_aboutText.append( "
" + i18n( "Favorite music: " ) + artists.join( QStringLiteral(", ") ) ); } } QAction *visitProfile = new QAction( QIcon( QPixmap( QStandardPaths::locate( QStandardPaths::GenericDataLocation, "amarok/images/opendesktop-22.png" ) ) ), i18n( "Visit %1's openDesktop.org profile", ocsPerson.firstName() ), this ); visitProfile->setToolTip( i18n( "Visit %1's profile on openDesktop.org", ocsPerson.firstName() ) ); - visitProfile->setData( ocsPerson.extendedAttribute( "profilepage" ) ); + visitProfile->setData( ocsPerson.extendedAttribute( QStringLiteral("profilepage") ) ); m_iconsBar->addAction( visitProfile ); if( m_status == Author ) { - QList< QPair< QString, QString > > ocsHomepages; - ocsHomepages.append( QPair< QString, QString >( ocsPerson.extendedAttribute( "homepagetype" ), ocsPerson.homepage() ) ); + QVector< QPair< QString, QString > > ocsHomepages; + ocsHomepages.append( QPair< QString, QString >( ocsPerson.extendedAttribute( QStringLiteral("homepagetype") ), ocsPerson.homepage() ) ); debug() << "USER HOMEPAGE DATA STARTS HERE"; debug() << ocsHomepages.last().first << " :: " << ocsHomepages.last().second; for( int i = 2; i <= 10; i++ ) //OCS supports 10 total homepages as of 2/oct/2009 { - QString type = ocsPerson.extendedAttribute( QString( "homepagetype%1" ).arg( i ) ); - ocsHomepages.append( QPair< QString, QString >( ( type == " " ) ? "" : type, - ocsPerson.extendedAttribute( QString( "homepage%1" ).arg( i ) ) ) ); + QString type = ocsPerson.extendedAttribute( QStringLiteral( "homepagetype%1" ).arg( i ) ); + ocsHomepages.append( QPair< QString, QString >( ( type == QLatin1String(" ") ) ? QLatin1String("") : type, + ocsPerson.extendedAttribute( QStringLiteral( "homepage%1" ).arg( i ) ) ) ); debug() << ocsHomepages.last().first << " :: " << ocsHomepages.last().second; } bool fillHomepageFromOcs = m_person->webAddress().isEmpty(); //We check if the person already has a homepage in KAboutPerson. - for( QList< QPair< QString, QString > >::const_iterator entry = ocsHomepages.constBegin(); + for( QVector< QPair< QString, QString > >::const_iterator entry = ocsHomepages.constBegin(); entry != ocsHomepages.constEnd(); ++entry ) { QString type = (*entry).first; QString url = (*entry).second; QIcon icon; QString text; - if( type == "Blog" ) + if( type == QLatin1String("Blog") ) { - icon = QIcon::fromTheme( "kblogger" ); + icon = QIcon::fromTheme( QStringLiteral("kblogger") ); text = i18n( "Visit contributor's blog" ); } - else if( type == "delicious" ) + else if( type == QLatin1String("delicious") ) { icon = QIcon( QPixmap( QStandardPaths::locate( QStandardPaths::GenericDataLocation, "amarok/images/emblem-delicious.png" ) ) ); text = i18n( "Visit contributor's del.icio.us profile" ); } - else if( type == "Digg" ) + else if( type == QLatin1String("Digg") ) { icon = QIcon( QPixmap( QStandardPaths::locate( QStandardPaths::GenericDataLocation, "amarok/images/emblem-digg.png" ) ) ); text = i18n( "Visit contributor's Digg profile" ); } - else if( type == "Facebook" ) + else if( type == QLatin1String("Facebook") ) { icon = QIcon( QPixmap( QStandardPaths::locate( QStandardPaths::GenericDataLocation, "amarok/images/emblem-facebook.png" ) ) ); text = i18n( "Visit contributor's Facebook profile" ); } - else if( type == "Homepage" || type == "other" || ( type.isEmpty() && !url.isEmpty() ) ) + else if( type == QLatin1String("Homepage") || type == QLatin1String("other") || ( type.isEmpty() && !url.isEmpty() ) ) { if( fillHomepageFromOcs ) { - QAction *homepage = new QAction( QIcon::fromTheme( "applications-internet" ), i18n("Visit contributor's homepage"), this ); + QAction *homepage = new QAction( QIcon::fromTheme( QStringLiteral("internet-services") ), i18n("Visit contributor's homepage"), this ); homepage->setToolTip( url ); homepage->setData( url ); m_iconsBar->addAction( homepage ); fillHomepageFromOcs = false; continue; } - if( type == "other" && url.contains( "last.fm/" ) ) //HACK: assign a last.fm icon if the URL contains last.fm + if( type == QLatin1String("other") && url.contains( QLatin1String("last.fm/") ) ) //HACK: assign a last.fm icon if the URL contains last.fm { icon = QIcon( QPixmap( QStandardPaths::locate( QStandardPaths::GenericDataLocation, "amarok/images/emblem-lastfm.png" ) ) ); text = i18n( "Visit contributor's Last.fm profile" ); } else continue; } - else if( type == "LinkedIn" ) + else if( type == QLatin1String("LinkedIn") ) { icon = QIcon( QPixmap( QStandardPaths::locate( QStandardPaths::GenericDataLocation, "amarok/images/emblem-linkedin.png" ) ) ); text = i18n( "Visit contributor's LinkedIn profile" ); } - else if( type == "MySpace" ) + else if( type == QLatin1String("MySpace") ) { icon = QIcon( QPixmap( QStandardPaths::locate( QStandardPaths::GenericDataLocation, "amarok/images/emblem-myspace.png" ) ) ); text = i18n( "Visit contributor's MySpace homepage" ); } - else if( type == "Reddit" ) + else if( type == QLatin1String("Reddit") ) { icon = QIcon( QPixmap( QStandardPaths::locate( QStandardPaths::GenericDataLocation, "amarok/images/emblem-reddit.png" ) ) ); text = i18n( "Visit contributor's Reddit profile" ); } - else if( type == "YouTube" ) + else if( type == QLatin1String("YouTube") ) { icon = QIcon( "dragonplayer" ); //FIXME: icon text = i18n( "Visit contributor's YouTube profile" ); } - else if( type == "Twitter" ) + else if( type == QLatin1String("Twitter") ) { icon = QIcon( QPixmap( QStandardPaths::locate( QStandardPaths::GenericDataLocation, "amarok/images/emblem-twitter.png" ) ) ); text = i18n( "Visit contributor's Twitter feed" ); } - else if( type == "Wikipedia" ) + else if( type == QLatin1String("Wikipedia") ) { icon = QIcon( QPixmap( QStandardPaths::locate( QStandardPaths::GenericDataLocation, "amarok/images/emblem-wikipedia.png" ) ) ); text = i18n( "Visit contributor's Wikipedia profile" ); } - else if( type == "Xing" ) + else if( type == QLatin1String("Xing") ) { icon = QIcon( QPixmap( QStandardPaths::locate( QStandardPaths::GenericDataLocation, "amarok/images/emblem-xing.png" ) ) ); text = i18n( "Visit contributor's Xing profile" ); } - else if( type == "identi.ca" ) + else if( type == QLatin1String("identi.ca") ) { icon = QIcon( QPixmap( QStandardPaths::locate( QStandardPaths::GenericDataLocation, "amarok/images/emblem-identica.png" ) ) ); text = i18n( "Visit contributor's identi.ca feed" ); } - else if( type == "libre.fm" ) + else if( type == QLatin1String("libre.fm") ) { icon = QIcon( "juk" ); //FIXME: icon text = i18n( "Visit contributor's libre.fm profile" ); } - else if( type == "StackOverflow" ) + else if( type == QLatin1String("StackOverflow") ) { icon = QIcon( QPixmap( QStandardPaths::locate( QStandardPaths::GenericDataLocation, "amarok/images/emblem-stackoverflow.png" ) ) ); text = i18n( "Visit contributor's StackOverflow profile" ); @@ -350,3 +350,26 @@ m_textLabel->setText( m_aboutText ); } +void +OcsPersonItem::onAvatarLoadingJobFinished( KJob *job ) +{ + auto storedJob = qobject_cast< KIO::StoredTransferJob * >( job ); + if( storedJob->error() ) + { + debug() << "failed to download the avatar of" << m_ocsUsername << "error:" << storedJob->errorString(); + return; + } + + QPixmap pic; + if ( !pic.loadFromData( storedJob->data() ) ) + { + debug() << "failed to load the avatar of" << m_ocsUsername; + return; + } + + m_avatar->setFixedSize( 56, 56 ); + m_avatar->setFrameShape( QFrame::StyledPanel ); //this is a FramedLabel, otherwise oxygen wouldn't paint the frame + m_avatar->setPixmap( pic ); + m_avatar->setAlignment( Qt::AlignCenter ); +} + diff --git a/src/aboutdialog/OcsPersonListWidget.h b/src/aboutdialog/OcsPersonListWidget.h --- a/src/aboutdialog/OcsPersonListWidget.h +++ b/src/aboutdialog/OcsPersonListWidget.h @@ -19,7 +19,7 @@ #include "OcsPersonItem.h" #include "OcsData.h" -#include "libattica-ocsclient/provider.h" +#include #include class OcsPersonListWidget : public QWidget @@ -30,10 +30,10 @@ OcsPersonListWidget( const QList< KAboutPerson > &persons, const OcsData::OcsPersonList *ocsPersons, OcsPersonItem::PersonStatus status = OcsPersonItem::Author, - QWidget *parent = 0 ); + QWidget *parent = nullptr ); public Q_SLOTS: - void switchToOcs( const AmarokAttica::Provider &provider ); + void switchToOcs( Attica::Provider &provider ); void onOcsFetchStarted(); void onOcsDataFetched( int err ); diff --git a/src/aboutdialog/OcsPersonListWidget.cpp b/src/aboutdialog/OcsPersonListWidget.cpp --- a/src/aboutdialog/OcsPersonListWidget.cpp +++ b/src/aboutdialog/OcsPersonListWidget.cpp @@ -58,7 +58,7 @@ } void -OcsPersonListWidget::switchToOcs( const AmarokAttica::Provider &provider ) +OcsPersonListWidget::switchToOcs( Attica::Provider &provider ) { for( int i = 0; i < m_areaLayout->count(); ++i ) { @@ -83,6 +83,6 @@ if( m_fetchCount == 0 ) { debug()< - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ -#ifndef ATTICA_ACTIVITY_H -#define ATTICA_ACTIVITY_H - -#include -#include - -#include "atticaclient_export.h" - - -class QDateTime; - -namespace AmarokAttica { - - -class ATTICA_EXPORT Activity -{ - public: - typedef QList List; - - Activity(); - Activity(const Activity& other); - Activity& operator=(const Activity& other); - ~Activity(); - - void setId( const QString & ); - QString id() const; - - void setUser( const QString & ); - QString user() const; - - void setTimestamp( const QDateTime & ); - QDateTime timestamp() const; - - void setMessage( const QString & ); - QString message() const; - - void setLink( const QString & ); - QString link() const; - - private: - class Private; - QSharedDataPointer d; -}; - -} - -#endif diff --git a/src/aboutdialog/libattica-ocsclient/activity.cpp b/src/aboutdialog/libattica-ocsclient/activity.cpp deleted file mode 100644 --- a/src/aboutdialog/libattica-ocsclient/activity.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include "activity.h" - -#include - - -using namespace AmarokAttica; - -class Activity::Private : public QSharedData { - public: - QString m_id; - QString m_user; - QDateTime m_timestamp; - QString m_message; - QString m_link; -}; - -Activity::Activity() : d(new Private) -{ -} - -Activity::Activity(const AmarokAttica::Activity& other) - : d(other.d) -{ -} - -Activity& Activity::operator=(const AmarokAttica::Activity & other) -{ - d = other.d; - return *this; -} - -Activity::~Activity() -{ -} - - -void Activity::setId( const QString &id ) -{ - d->m_id = id; -} - -QString Activity::id() const -{ - return d->m_id; -} - -void Activity::setUser( const QString &u ) -{ - d->m_user = u; -} - -QString Activity::user() const -{ - return d->m_user; -} - -void Activity::setTimestamp( const QDateTime &date ) -{ - d->m_timestamp = date; -} - -QDateTime Activity::timestamp() const -{ - return d->m_timestamp; -} - -void Activity::setMessage( const QString &c ) -{ - d->m_message = c; -} - -QString Activity::message() const -{ - return d->m_message; -} - -void Activity::setLink( const QString &v ) -{ - d->m_link = v; -} - -QString Activity::link() const -{ - return d->m_link; -} diff --git a/src/aboutdialog/libattica-ocsclient/activitylistjob.h b/src/aboutdialog/libattica-ocsclient/activitylistjob.h deleted file mode 100644 --- a/src/aboutdialog/libattica-ocsclient/activitylistjob.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ -#ifndef ATTICA_ACTIVITYLISTJOB_H -#define ATTICA_ACTIVITYLISTJOB_H - -#include -#include - -#include "activity.h" - - -namespace KIO { -class Job; -} - -namespace AmarokAttica { - -class ATTICA_EXPORT ActivityListJob : public KJob -{ - Q_OBJECT - public: - ActivityListJob(); - - void setUrl( const QUrl & ); - - void start(); - - Activity::List ActivityList() const; - - protected Q_SLOTS: - void doWork(); - - void slotJobResult( KJob *job ); - void slotJobData( KIO::Job *job, const QByteArray &data ); - - private: - QUrl m_url; - KIO::Job *m_job; - QByteArray m_data; - - Activity::List m_activityList; -}; - -} - -#endif diff --git a/src/aboutdialog/libattica-ocsclient/activitylistjob.cpp b/src/aboutdialog/libattica-ocsclient/activitylistjob.cpp deleted file mode 100644 --- a/src/aboutdialog/libattica-ocsclient/activitylistjob.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include "activitylistjob.h" - -#include "activityparser.h" - -#include -#include - -#include - - -using namespace AmarokAttica; - -ActivityListJob::ActivityListJob() - : m_job( ) -{ -} - -void ActivityListJob::setUrl( const QUrl &url ) -{ - m_url = url; -} - -void ActivityListJob::start() -{ - QTimer::singleShot( 0, this, &ActivityListJob::doWork ); -} - -Activity::List ActivityListJob::ActivityList() const -{ - return m_activityList; -} - -void ActivityListJob::doWork() -{ - auto job = KIO::get( m_url, KIO::NoReload, KIO::HideProgressInfo ); - connect( job, &KIO::TransferJob::result, - this, &ActivityListJob::slotJobResult ); - connect( job, &KIO::TransferJob::data, - this, &ActivityListJob::slotJobData ); - - m_job = job; -} - -void ActivityListJob::slotJobResult( KJob *job ) -{ - m_job = 0; - - if ( job->error() ) { - setError( job->error() ); - setErrorText( job->errorText() ); - - emitResult(); - } else { - // qDebug() << m_data; - m_activityList = ActivityParser().parseList( - QString::fromUtf8( m_data.data() ) ); - - emitResult(); - } -} - -void ActivityListJob::slotJobData( KIO::Job *, const QByteArray &data ) -{ - m_data.append( data ); -} diff --git a/src/aboutdialog/libattica-ocsclient/activityparser.h b/src/aboutdialog/libattica-ocsclient/activityparser.h deleted file mode 100644 --- a/src/aboutdialog/libattica-ocsclient/activityparser.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ -#ifndef ATTICA_ACTIVITYPARSER_H -#define ATTICA_ACTIVITYPARSER_H - -#include "activity.h" - - -namespace AmarokAttica { - -class ActivityParser -{ - public: - ActivityParser(); - - Activity::List parseList( const QString &xml ); -}; - -} - -#endif diff --git a/src/aboutdialog/libattica-ocsclient/activityparser.cpp b/src/aboutdialog/libattica-ocsclient/activityparser.cpp deleted file mode 100644 --- a/src/aboutdialog/libattica-ocsclient/activityparser.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include "activityparser.h" - -#include -#include -#include - - -using namespace AmarokAttica; - -ActivityParser::ActivityParser() -{ -} - -Activity::List ActivityParser::parseList( const QString &xmlString ) -{ - Activity::List activityList; - - QXmlStreamReader xml( xmlString ); - - while ( !xml.atEnd() ) { - xml.readNext(); - - if ( xml.isStartElement() && xml.name() == "activity" ) { - Activity activity; - - while ( !xml.atEnd() ) { - xml.readNext(); - - if ( xml.isStartElement() ) { - if ( xml.name() == "id" ) { - activity.setId( xml.readElementText() ); - } else if ( xml.name() == "personid" ) { - activity.setUser( xml.readElementText() ); - } else if ( xml.name() == "timestamp" ) { - QString timestampString = xml.readElementText(); - timestampString.remove( QRegExp("\\+.*$") ); - QDateTime timestamp = QDateTime::fromString( timestampString, - Qt::ISODate ); - activity.setTimestamp( timestamp ); - } else if ( xml.name() == "message" ) { - activity.setMessage( xml.readElementText() ); - } else if ( xml.name() == "link" ) { - activity.setLink( xml.readElementText() ); - } - } - - if ( xml.isEndElement() && xml.name() == "activity" ) break; - } - - activityList.append( activity ); - } - } - - return activityList; -} diff --git a/src/aboutdialog/libattica-ocsclient/atticaclient_export.h b/src/aboutdialog/libattica-ocsclient/atticaclient_export.h deleted file mode 100644 --- a/src/aboutdialog/libattica-ocsclient/atticaclient_export.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - Copyright (c) 2008 Dirk Mueller - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ -#ifndef ATTICA_EXPORT_H -#define ATTICA_EXPORT_H - -/* needed for Q_DECL_EXPORT and Q_DECL_IMPORT macros */ -#include - -#ifndef ATTICA_EXPORT -# if defined(MAKE_AMAROKOCSCLIENT_LIB) - /* We are building this library */ -# define ATTICA_EXPORT Q_DECL_EXPORT -# else - /* We are using this library */ -# define ATTICA_EXPORT Q_DECL_IMPORT -# endif -#endif - -#endif diff --git a/src/aboutdialog/libattica-ocsclient/category.h b/src/aboutdialog/libattica-ocsclient/category.h deleted file mode 100644 --- a/src/aboutdialog/libattica-ocsclient/category.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ -#ifndef ATTICA_CATEGORY_H -#define ATTICA_CATEGORY_H - -#include -#include - -#include "atticaclient_export.h" - - -namespace AmarokAttica { - - -class ATTICA_EXPORT Category -{ - public: - typedef QList List; - - Category(); - Category(const Category& other); - Category& operator=(const Category& other); - ~Category(); - - void setId( const QString & ); - QString id() const; - - void setName( const QString & ); - QString name() const; - - private: - class Private; - QSharedDataPointer d; -}; - -} - -#endif diff --git a/src/aboutdialog/libattica-ocsclient/category.cpp b/src/aboutdialog/libattica-ocsclient/category.cpp deleted file mode 100644 --- a/src/aboutdialog/libattica-ocsclient/category.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include "category.h" - -#include - - -using namespace AmarokAttica; - -class Category::Private : public QSharedData { - public: - QString m_id; - QString m_name; -}; - - -Category::Category() : d(new Private) -{ -} - -Category::Category(const AmarokAttica::Category& other) - : d(other.d) -{ -} - -Category& Category::operator=(const AmarokAttica::Category & other) -{ - d = other.d; - return *this; -} - -Category::~Category() -{ -} - - -void Category::setId( const QString &u ) -{ - d->m_id = u; -} - -QString Category::id() const -{ - return d->m_id; -} - -void Category::setName( const QString &name ) -{ - d->m_name = name; -} - -QString Category::name() const -{ - return d->m_name; -} diff --git a/src/aboutdialog/libattica-ocsclient/categorylistjob.h b/src/aboutdialog/libattica-ocsclient/categorylistjob.h deleted file mode 100644 --- a/src/aboutdialog/libattica-ocsclient/categorylistjob.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ -#ifndef ATTICA_CATEGORYLISTJOB_H -#define ATTICA_CATEGORYLISTJOB_H - -#include "category.h" - -#include -#include - -namespace KIO { -class Job; -} - -namespace AmarokAttica { - -class ATTICA_EXPORT CategoryListJob : public KJob -{ - Q_OBJECT - public: - CategoryListJob(); - - void setUrl( const QUrl & ); - - void start(); - - Category::List categoryList() const; - - protected Q_SLOTS: - void doWork(); - - void slotJobResult( KJob *job ); - void slotJobData( KIO::Job *job, const QByteArray &data ); - - private: - QUrl m_url; - KIO::Job *m_job; - QByteArray m_data; - - Category::List m_categoryList; -}; - -} - -#endif diff --git a/src/aboutdialog/libattica-ocsclient/categorylistjob.cpp b/src/aboutdialog/libattica-ocsclient/categorylistjob.cpp deleted file mode 100644 --- a/src/aboutdialog/libattica-ocsclient/categorylistjob.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include "categorylistjob.h" - -#include "categoryparser.h" - -#include -#include - -#include - - -using namespace AmarokAttica; - -CategoryListJob::CategoryListJob() - : m_job( ) -{ -} - -void CategoryListJob::setUrl( const QUrl &url ) -{ - m_url = url; -} - -void CategoryListJob::start() -{ - QTimer::singleShot( 0, this, &CategoryListJob::doWork ); -} - -Category::List CategoryListJob::categoryList() const -{ - return m_categoryList; -} - -void CategoryListJob::doWork() -{ - auto job = KIO::get( m_url, KIO::NoReload, KIO::HideProgressInfo ); - connect( job, &KIO::TransferJob::result, - this, &CategoryListJob::slotJobResult ); - connect( job, &KIO::TransferJob::data, - this, &CategoryListJob::slotJobData ); - - m_job = job; -} - -void CategoryListJob::slotJobResult( KJob *job ) -{ - m_job = 0; - - if ( job->error() ) { - setError( job->error() ); - setErrorText( job->errorText() ); - - emitResult(); - } else { - m_categoryList = CategoryParser().parseList( - QString::fromUtf8( m_data.data() ) ); - - emitResult(); - } -} - -void CategoryListJob::slotJobData( KIO::Job *, const QByteArray &data ) -{ - m_data.append( data ); -} diff --git a/src/aboutdialog/libattica-ocsclient/categoryparser.h b/src/aboutdialog/libattica-ocsclient/categoryparser.h deleted file mode 100644 --- a/src/aboutdialog/libattica-ocsclient/categoryparser.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ -#ifndef ATTICA_CATEGORYPARSER_H -#define ATTICA_CATEGORYPARSER_H - -#include "category.h" - - -namespace AmarokAttica { - -class CategoryParser -{ - public: - CategoryParser(); - - Category::List parseList( const QString &xml ); -}; - -} - -#endif diff --git a/src/aboutdialog/libattica-ocsclient/categoryparser.cpp b/src/aboutdialog/libattica-ocsclient/categoryparser.cpp deleted file mode 100644 --- a/src/aboutdialog/libattica-ocsclient/categoryparser.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include "categoryparser.h" - -#include - -using namespace AmarokAttica; - -CategoryParser::CategoryParser() -{ -} - -Category::List CategoryParser::parseList( const QString &xmlString ) -{ - Category::List categoryList; - - QXmlStreamReader xml( xmlString ); - - while ( !xml.atEnd() ) { - xml.readNext(); - - if ( xml.isStartElement() && xml.name() == "category" ) { - Category category; - - while ( !xml.atEnd() ) { - xml.readNext(); - - if ( xml.isStartElement() ) { - if ( xml.name() == "id" ) { - category.setId( xml.readElementText() ); - } else if ( xml.name() == "name" ) { - category.setName( xml.readElementText() ); - } - } - - if ( xml.isEndElement() && xml.name() == "category" ) break; - } - - categoryList.append( category ); - } - } - - return categoryList; -} diff --git a/src/aboutdialog/libattica-ocsclient/content.h b/src/aboutdialog/libattica-ocsclient/content.h deleted file mode 100644 --- a/src/aboutdialog/libattica-ocsclient/content.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ -#ifndef ATTICA_CONTENT_H -#define ATTICA_CONTENT_H - -#include -#include -#include - -#include "atticaclient_export.h" - - -class QDateTime; - -namespace AmarokAttica { - -class ATTICA_EXPORT Content -{ - public: - typedef QList List; - - Content(); - Content(const Content& other); - Content& operator=(const Content& other); - ~Content(); - - void setId( const QString & ); - QString id() const; - - void setName( const QString & ); - QString name() const; - - void setRating( int ); - int rating() const; - - void setDownloads( int ); - int downloads() const; - - void setCreated( const QDateTime & ); - QDateTime created() const; - - void setUpdated( const QDateTime & ); - QDateTime updated() const; - - void addExtendedAttribute( const QString &key, const QString &value ); - QString extendedAttribute( const QString &key ) const; - - QMap extendedAttributes() const; - - private: - class Private; - QSharedDataPointer d; -}; - -} - -#endif diff --git a/src/aboutdialog/libattica-ocsclient/content.cpp b/src/aboutdialog/libattica-ocsclient/content.cpp deleted file mode 100644 --- a/src/aboutdialog/libattica-ocsclient/content.cpp +++ /dev/null @@ -1,142 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include "content.h" - -#include - - -using namespace AmarokAttica; - -class Content::Private : public QSharedData { - public: - QDateTime m_created; - int m_downloads; - QString m_id; - QString m_name; - int m_rating; - QDateTime m_updated; - - QMap m_extendedAttributes; - - Private() - : m_downloads(0), - m_rating(0) - { - } -}; - - -Content::Content() - : d(new Private) -{ -} - -Content::Content(const AmarokAttica::Content& other) - : d(other.d) -{ -} - -Content& Content::operator=(const AmarokAttica::Content & other) -{ - d = other.d; - return *this; -} - -Content::~Content() -{ -} - - -void Content::setId( const QString &u ) -{ - d->m_id = u; -} - -QString Content::id() const -{ - return d->m_id; -} - -void Content::setName( const QString &name ) -{ - d->m_name = name; -} - -QString Content::name() const -{ - return d->m_name; -} - -void Content::setRating( int v ) -{ - d->m_rating = v; -} - -int Content::rating() const -{ - return d->m_rating; -} - -void Content::setDownloads( int v ) -{ - d->m_downloads = v; -} - -int Content::downloads() const -{ - return d->m_downloads; -} - -void Content::setCreated( const QDateTime &date ) -{ - d->m_created = date; -} - -QDateTime Content::created() const -{ - return d->m_created; -} - -void Content::setUpdated( const QDateTime &date ) -{ - d->m_updated = date; -} - -QDateTime Content::updated() const -{ - return d->m_updated; -} - -void Content::addExtendedAttribute( const QString &key, const QString &value ) -{ - d->m_extendedAttributes.insert( key, value ); -} - -QString Content::extendedAttribute( const QString &key ) const -{ - return d->m_extendedAttributes.value( key ); -} - -QMap Content::extendedAttributes() const -{ - return d->m_extendedAttributes; -} diff --git a/src/aboutdialog/libattica-ocsclient/contentjob.h b/src/aboutdialog/libattica-ocsclient/contentjob.h deleted file mode 100644 --- a/src/aboutdialog/libattica-ocsclient/contentjob.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. - */ -#ifndef ATTICA_CONTENTJOB_H -#define ATTICA_CONTENTJOB_H - -#include "content.h" - -#include -#include - -namespace KIO { -class Job; -} - -namespace AmarokAttica { - -class ATTICA_EXPORT ContentJob : public KJob -{ - Q_OBJECT - public: - ContentJob(); - - void setUrl( const QUrl & ); - - void start(); - - Content content() const; - - protected Q_SLOTS: - void doWork(); - - void slotJobResult( KJob *job ); - void slotJobData( KIO::Job *job, const QByteArray &data ); - - private: - QUrl m_url; - KIO::Job *m_job; - QByteArray m_data; - - Content m_content; -}; - -} - -#endif diff --git a/src/aboutdialog/libattica-ocsclient/contentjob.cpp b/src/aboutdialog/libattica-ocsclient/contentjob.cpp deleted file mode 100644 --- a/src/aboutdialog/libattica-ocsclient/contentjob.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include "contentjob.h" - -#include "contentparser.h" - -#include -#include - -#include - - -using namespace AmarokAttica; - -ContentJob::ContentJob() - : m_job( ) -{ -} - -void ContentJob::setUrl( const QUrl &url ) -{ - m_url = url; -} - -void ContentJob::start() -{ - QTimer::singleShot( 0, this, &ContentJob::doWork ); -} - -Content ContentJob::content() const -{ - return m_content; -} - -void ContentJob::doWork() -{ - qDebug() << m_url; - - auto job = KIO::get( m_url, KIO::NoReload, KIO::HideProgressInfo ); - connect( job, &KIO::TransferJob::result, - this, &ContentJob::slotJobResult ); - connect( job, &KIO::TransferJob::data, - this, &ContentJob::slotJobData ); - - m_job = job; -} - -void ContentJob::slotJobResult( KJob *job ) -{ - m_job = 0; - - if ( job->error() ) { - setError( job->error() ); - setErrorText( job->errorText() ); - } else { - qDebug() << m_data; - m_content = ContentParser().parse( QString::fromUtf8( m_data.data() ) ); - } - - emitResult(); -} - -void ContentJob::slotJobData( KIO::Job *, const QByteArray &data ) -{ - m_data.append( data ); -} diff --git a/src/aboutdialog/libattica-ocsclient/contentlistjob.h b/src/aboutdialog/libattica-ocsclient/contentlistjob.h deleted file mode 100644 --- a/src/aboutdialog/libattica-ocsclient/contentlistjob.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. - */ -#ifndef ATTICA_CONTENTLISTJOB_H -#define ATTICA_CONTENTLISTJOB_H - -#include "content.h" - -#include -#include - -namespace KIO { -class Job; -} - -namespace AmarokAttica { - -class ATTICA_EXPORT ContentListJob : public KJob -{ - Q_OBJECT - public: - ContentListJob(); - - void setUrl( const QUrl & ); - - void start(); - - Content::List contentList() const; - - protected Q_SLOTS: - void doWork(); - - void slotJobResult( KJob *job ); - void slotJobData( KIO::Job *job, const QByteArray &data ); - - private: - QUrl m_url; - KIO::Job *m_job; - QByteArray m_data; - - Content::List m_contentList; -}; - -} - -#endif diff --git a/src/aboutdialog/libattica-ocsclient/contentlistjob.cpp b/src/aboutdialog/libattica-ocsclient/contentlistjob.cpp deleted file mode 100644 --- a/src/aboutdialog/libattica-ocsclient/contentlistjob.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include "contentlistjob.h" - -#include "contentparser.h" - -#include -#include - -#include - - -using namespace AmarokAttica; - -ContentListJob::ContentListJob() - : m_job( ) -{ -} - -void ContentListJob::setUrl( const QUrl &url ) -{ - m_url = url; -} - -void ContentListJob::start() -{ - QTimer::singleShot( 0, this, &ContentListJob::doWork ); -} - -Content::List ContentListJob::contentList() const -{ - return m_contentList; -} - -void ContentListJob::doWork() -{ - qDebug() << m_url; - - auto job = KIO::get( m_url, KIO::NoReload, KIO::HideProgressInfo ); - connect( job, &KIO::TransferJob::result, - this, &ContentListJob::slotJobResult ); - connect( job, &KIO::TransferJob::data, - this, &ContentListJob::slotJobData ); - - m_job = job; -} - -void ContentListJob::slotJobResult( KJob *job ) -{ - m_job = 0; - - if ( job->error() ) { - setError( job->error() ); - setErrorText( job->errorText() ); - - emitResult(); - } else { - qDebug() << m_data; - m_contentList = ContentParser().parseList( - QString::fromUtf8( m_data.data() ) ); - - emitResult(); - } -} - -void ContentListJob::slotJobData( KIO::Job *, const QByteArray &data ) -{ - m_data.append( data ); -} diff --git a/src/aboutdialog/libattica-ocsclient/contentparser.h b/src/aboutdialog/libattica-ocsclient/contentparser.h deleted file mode 100644 --- a/src/aboutdialog/libattica-ocsclient/contentparser.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ -#ifndef ATTICA_CONTENTPARSER_H -#define ATTICA_CONTENTPARSER_H - -#include "content.h" - -#include - -namespace AmarokAttica { - -class ContentParser -{ - public: - ContentParser(); - - Content parse( const QString &xml ); - Content::List parseList( const QString &xml ); - - protected: - Content parseContent( QXmlStreamReader &xml ); -}; - -} - -#endif diff --git a/src/aboutdialog/libattica-ocsclient/contentparser.cpp b/src/aboutdialog/libattica-ocsclient/contentparser.cpp deleted file mode 100644 --- a/src/aboutdialog/libattica-ocsclient/contentparser.cpp +++ /dev/null @@ -1,99 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include "contentparser.h" - -#include - -using namespace AmarokAttica; - -ContentParser::ContentParser() -{ -} - -Content::List ContentParser::parseList( const QString &xmlString ) -{ - Content::List contentList; - - QXmlStreamReader xml( xmlString ); - - while ( !xml.atEnd() ) { - xml.readNext(); - - if ( xml.isStartElement() && xml.name() == "content" ) { - Content content = parseContent( xml ); - contentList.append( content ); - } - } - - return contentList; -} - -Content ContentParser::parse( const QString &xmlString ) -{ - Content content; - - QXmlStreamReader xml( xmlString ); - - while ( !xml.atEnd() ) { - xml.readNext(); - - if ( xml.isStartElement() && xml.name() == "content" ) { - content = parseContent( xml ); - } - } - - return content; -} - -Content ContentParser::parseContent( QXmlStreamReader &xml ) -{ - Content content; - - while ( !xml.atEnd() ) { - xml.readNext(); - - if ( xml.isStartElement() ) { - if ( xml.name() == "id" ) { - content.setId( xml.readElementText() ); - } else if ( xml.name() == "name" ) { - content.setName( xml.readElementText() ); - } else if ( xml.name() == "score" ) { - content.setRating( xml.readElementText().toInt() ); - } else if ( xml.name() == "downloads" ) { - content.setDownloads( xml.readElementText().toInt() ); - } else if ( xml.name() == "created" ) { - content.setCreated( QDateTime::fromString( xml.readElementText(), - Qt::ISODate ) ); - } else if ( xml.name() == "updated" ) { - content.setUpdated( QDateTime::fromString( xml.readElementText(), - Qt::ISODate ) ); - } else { - content.addExtendedAttribute( xml.name().toString(), - xml.readElementText() ); - } - } - - if ( xml.isEndElement() && xml.name() == "content" ) break; - } - - return content; -} diff --git a/src/aboutdialog/libattica-ocsclient/event.h b/src/aboutdialog/libattica-ocsclient/event.h deleted file mode 100644 --- a/src/aboutdialog/libattica-ocsclient/event.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2009 Eckhart Wörner - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#ifndef ATTICA_EVENT_H -#define ATTICA_EVENT_H - -#include "atticaclient_export.h" - -#include -#include -#include - - -namespace AmarokAttica { - -class ATTICA_EXPORT Event -{ - public: - typedef QList List; - - Event(); - - void setId(const QString& id); - QString id() const; - - void setName(const QString& name); - QString name() const; - - void setDescription(const QString& text); - QString description() const; - - void setUser(const QString& id); - QString user() const; - - void setStartDate(const QDate& date); - QDate startDate() const; - - void setEndDate(const QDate& date); - QDate endDate() const; - - void setLatitude(qreal lat); - qreal latitude() const; - - void setLongitude(qreal lon); - qreal longitude() const; - - void setHomepage(const QString& url); - QString homepage() const; - - void setCountry(const QString& country); - QString country() const; - - void setCity(const QString& city); - QString city() const; - - void addExtendedAttribute(const QString& key, const QString& value); - QString extendedAttribute(const QString& key) const; - QMap extendedAttributes() const; - - private: - QString m_id; - QString m_name; - QString m_description; - QString m_user; - QDate m_startDate; - QDate m_endDate; - qreal m_latitude; - qreal m_longitude; - QString m_homepage; - QString m_country; - QString m_city; - QMap m_extendedAttributes; -}; - -} - - -#endif diff --git a/src/aboutdialog/libattica-ocsclient/event.cpp b/src/aboutdialog/libattica-ocsclient/event.cpp deleted file mode 100644 --- a/src/aboutdialog/libattica-ocsclient/event.cpp +++ /dev/null @@ -1,168 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2009 Eckhart Wörner - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include "event.h" - - -using namespace AmarokAttica; - - -Event::Event() - : m_latitude(0), m_longitude(0) -{ -} - - -void Event::setId(const QString& id) -{ - m_id = id; -} - -QString Event::id() const -{ - return m_id; -} - - -void Event::setName(const QString& name) -{ - m_name = name; -} - -QString Event::name() const -{ - return m_name; -} - - -void Event::setDescription(const QString& text) -{ - m_description = text; -} - -QString Event::description() const -{ - return m_description; -} - - -void Event::setUser(const QString& id) -{ - m_user = id; -} - -QString Event::user() const -{ - return m_user; -} - - -void Event::setStartDate(const QDate& date) -{ - m_startDate = date; -} - -QDate Event::startDate() const -{ - return m_startDate; -} - - -void Event::setEndDate(const QDate& date) -{ - m_endDate = date; -} - -QDate Event::endDate() const -{ - return m_endDate; -} - - -void Event::setLatitude(qreal lat) -{ - m_latitude = lat; -} - -qreal Event::latitude() const -{ - return m_latitude; -} - - -void Event::setLongitude(qreal lon) -{ - m_longitude = lon; -} - -qreal Event::longitude() const -{ - return m_longitude; -} - - -void Event::setHomepage(const QString& url) -{ - m_homepage = url; -} - -QString Event::homepage() const -{ - return m_homepage; -} - - -void Event::setCountry(const QString& country) -{ - m_country = country; -} - -QString Event::country() const -{ - return m_country; -} - - -void Event::setCity(const QString& city) -{ - m_city = city; -} - -QString Event::city() const -{ - return m_city; -} - - -void Event::addExtendedAttribute(const QString& key, const QString& value) -{ - m_extendedAttributes.insert(key, value); -} - -QString Event::extendedAttribute(const QString& key) const -{ - return m_extendedAttributes.value(key); -} - -QMap Event::extendedAttributes() const -{ - return m_extendedAttributes; -} diff --git a/src/aboutdialog/libattica-ocsclient/eventjob.h b/src/aboutdialog/libattica-ocsclient/eventjob.h deleted file mode 100644 --- a/src/aboutdialog/libattica-ocsclient/eventjob.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2009 Eckhart Wörner - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#ifndef ATTICA_EVENTJOB_H -#define ATTICA_EVENTJOB_H - -#include -#include - -#include "atticaclient_export.h" -#include "event.h" - - -namespace KIO { - class Job; -} - -namespace AmarokAttica { - -class ATTICA_EXPORT EventJob : public KJob -{ - Q_OBJECT - - public: - EventJob(); - - void setUrl(const QUrl &url); - - void start(); - - Event event() const; - using QObject::event; // Unhide QObject's event() - - protected Q_SLOTS: - void doWork(); - - void slotJobResult(KJob* job); - void slotJobData(KIO::Job* job, const QByteArray& data); - - private: - QUrl m_url; - KIO::Job* m_job; - QByteArray m_data; - - Event m_event; -}; - -} - - -#endif diff --git a/src/aboutdialog/libattica-ocsclient/eventjob.cpp b/src/aboutdialog/libattica-ocsclient/eventjob.cpp deleted file mode 100644 --- a/src/aboutdialog/libattica-ocsclient/eventjob.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2009 Eckhart Wörner - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include "eventjob.h" - -#include - -#include - -#include "eventparser.h" - - -using namespace AmarokAttica; - - -EventJob::EventJob() - : m_job(0) -{ -} - - -void EventJob::setUrl(const QUrl &url) -{ - m_url = url; -} - - -void EventJob::start() -{ - QTimer::singleShot(0, this, &EventJob::doWork); -} - - -Event EventJob::event() const -{ - return m_event; -} - - -void EventJob::doWork() -{ - auto job = KIO::get( m_url, KIO::NoReload, KIO::HideProgressInfo ); - connect( job, &KIO::TransferJob::result, - this, &EventJob::slotJobResult ); - connect( job, &KIO::TransferJob::data, - this, &EventJob::slotJobData ); - - m_job = job; -} - - -void EventJob::slotJobResult(KJob* job) -{ - m_job = 0; - - if (job->error()) { - setError(job->error()); - setErrorText(job->errorText()); - - emitResult(); - } else { - m_event = EventParser().parse(QString::fromUtf8(m_data.data())); - - emitResult(); - } -} - - -void EventJob::slotJobData(KIO::Job* job, const QByteArray& data) -{ - Q_UNUSED(job); - - m_data.append(data); -} - - diff --git a/src/aboutdialog/libattica-ocsclient/eventlistjob.h b/src/aboutdialog/libattica-ocsclient/eventlistjob.h deleted file mode 100644 --- a/src/aboutdialog/libattica-ocsclient/eventlistjob.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2009 Eckhart Wörner - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#ifndef ATTICA_EVENTLISTJOB_H -#define ATTICA_EVENTLISTJOB_H - -#include -#include - -#include "atticaclient_export.h" -#include "event.h" - - -namespace KIO { - class Job; -} - -namespace AmarokAttica { - -class ATTICA_EXPORT EventListJob : public KJob -{ - Q_OBJECT - - public: - EventListJob(); - - void setUrl(const QUrl &url); - - void start(); - - Event::List eventList() const; - - protected Q_SLOTS: - void doWork(); - - void slotJobResult(KJob* job); - void slotJobData(KIO::Job* job, const QByteArray& data); - - private: - QUrl m_url; - KIO::Job* m_job; - QByteArray m_data; - - Event::List m_eventList; -}; - -} - - -#endif diff --git a/src/aboutdialog/libattica-ocsclient/eventlistjob.cpp b/src/aboutdialog/libattica-ocsclient/eventlistjob.cpp deleted file mode 100644 --- a/src/aboutdialog/libattica-ocsclient/eventlistjob.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2009 Eckhart Wörner - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include "eventlistjob.h" - -#include - -#include - -#include "eventparser.h" - - -using namespace AmarokAttica; - - -EventListJob::EventListJob() - : m_job(0) -{ -} - - -void EventListJob::setUrl(const QUrl &url) -{ - m_url = url; -} - - -void EventListJob::start() -{ - QTimer::singleShot(0, this, &EventListJob::doWork); -} - - -Event::List EventListJob::eventList() const -{ - return m_eventList; -} - - -void EventListJob::doWork() -{ - auto job = KIO::get( m_url, KIO::NoReload, KIO::HideProgressInfo ); - connect( job, &KIO::TransferJob::result, - this, &EventListJob::slotJobResult ); - connect( job, &KIO::TransferJob::data, - this, &EventListJob::slotJobData ); - - m_job = job; -} - - -void EventListJob::slotJobResult(KJob* job) -{ - m_job = 0; - - if (job->error()) { - setError(job->error()); - setErrorText(job->errorText()); - - emitResult(); - } else { - m_eventList = EventParser().parseList(QString::fromUtf8(m_data.data())); - - emitResult(); - } -} - - -void EventListJob::slotJobData(KIO::Job* job, const QByteArray& data) -{ - Q_UNUSED(job); - - m_data.append(data); -} - - diff --git a/src/aboutdialog/libattica-ocsclient/eventparser.h b/src/aboutdialog/libattica-ocsclient/eventparser.h deleted file mode 100644 --- a/src/aboutdialog/libattica-ocsclient/eventparser.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2009 Eckhart Wörner - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#ifndef ATTICA_EVENTPARSER_H -#define ATTICA_EVENTPARSER_H - -#include "event.h" - -#include - -namespace AmarokAttica { - -class EventParser -{ - public: - EventParser(); - - Event parse(const QString& xml); - Event::List parseList(const QString& xml); - - private: - Event parseEvent(QXmlStreamReader& xml); -}; - -} - - -#endif diff --git a/src/aboutdialog/libattica-ocsclient/eventparser.cpp b/src/aboutdialog/libattica-ocsclient/eventparser.cpp deleted file mode 100644 --- a/src/aboutdialog/libattica-ocsclient/eventparser.cpp +++ /dev/null @@ -1,110 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2009 Eckhart Wörner - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include "eventparser.h" - -#include - -using namespace AmarokAttica; - -EventParser::EventParser() -{ -} - - -Event EventParser::parse(const QString& xmlString) -{ - Event event; - - QXmlStreamReader xml(xmlString); - - while (!xml.atEnd()) { - xml.readNext(); - - if (xml.isStartElement() && xml.name() == "event") { - event = parseEvent(xml); - } - } - - return event; -} - - -Event::List AmarokAttica::EventParser::parseList(const QString& xmlString) -{ - Event::List eventList; - - QXmlStreamReader xml(xmlString); - - while (!xml.atEnd()) { - xml.readNext(); - - if (xml.isStartElement() && xml.name() == "event") { - eventList.append(parseEvent(xml)); - } - } - - return eventList; -} - - -Event EventParser::parseEvent(QXmlStreamReader& xml) -{ - Event event; - - while (!xml.atEnd()) { - xml.readNext(); - - if (xml.isStartElement()) { - if (xml.name() == "id") { - event.setId(xml.readElementText()); - } else if (xml.name() == "name") { - event.setName(xml.readElementText()); - } else if (xml.name() == "description") { - event.setDescription(xml.readElementText()); - } else if (xml.name() == "user") { - event.setUser(xml.readElementText()); - } else if (xml.name() == "startdate") { - QString date = xml.readElementText().remove(QRegExp("\\+.*$")); - event.setStartDate(QDate::fromString(date, Qt::ISODate)); - } else if (xml.name() == "enddate") { - QString date = xml.readElementText().remove(QRegExp("\\+.*$")); - event.setEndDate(QDate::fromString(date, Qt::ISODate)); - } else if (xml.name() == "latitude") { - event.setLatitude(xml.readElementText().toFloat()); - } else if (xml.name() == "longitude") { - event.setLongitude(xml.readElementText().toFloat()); - } else if (xml.name() == "homepage") { - event.setHomepage(xml.readElementText()); - } else if (xml.name() == "country") { - event.setCountry(xml.readElementText()); - } else if (xml.name() == "city") { - event.setCity(xml.readElementText()); - } else { - event.addExtendedAttribute(xml.name().toString(), xml.readElementText()); - } - } - else if (xml.isEndElement() && xml.name() == "event") { - break; - } - } - return event; -} diff --git a/src/aboutdialog/libattica-ocsclient/folder.h b/src/aboutdialog/libattica-ocsclient/folder.h deleted file mode 100644 --- a/src/aboutdialog/libattica-ocsclient/folder.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ -#ifndef ATTICA_FOLDER_H -#define ATTICA_FOLDER_H - -#include "atticaclient_export.h" -#include -#include -namespace AmarokAttica { - -class ATTICA_EXPORT Folder -{ - public: - typedef QList List; - - Folder(); - - void setId( const QString & ); - QString id() const; - - void setName( const QString & ); - QString name() const; - - void setMessageCount( int ); - int messageCount() const; - - void setType( const QString & ); - QString type() const; - - private: - QString m_id; - QString m_name; - int m_messageCount; - QString m_type; -}; - -} - -#endif diff --git a/src/aboutdialog/libattica-ocsclient/folder.cpp b/src/aboutdialog/libattica-ocsclient/folder.cpp deleted file mode 100644 --- a/src/aboutdialog/libattica-ocsclient/folder.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include "folder.h" - -using namespace AmarokAttica; - -Folder::Folder() - : m_messageCount( 0 ) -{ -} - -void Folder::setId( const QString &u ) -{ - m_id = u; -} - -QString Folder::id() const -{ - return m_id; -} - -void Folder::setName( const QString &d ) -{ - m_name = d; -} - -QString Folder::name() const -{ - return m_name; -} - -void Folder::setMessageCount( int c ) -{ - m_messageCount = c; -} - -int Folder::messageCount() const -{ - return m_messageCount; -} - -void Folder::setType( const QString &v ) -{ - m_type = v; -} - -QString Folder::type() const -{ - return m_type; -} diff --git a/src/aboutdialog/libattica-ocsclient/folderlistjob.h b/src/aboutdialog/libattica-ocsclient/folderlistjob.h deleted file mode 100644 --- a/src/aboutdialog/libattica-ocsclient/folderlistjob.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ -#ifndef ATTICA_FOLDERLISTJOB_H -#define ATTICA_FOLDERLISTJOB_H - -#include "folder.h" - -#include -#include - -namespace KIO { -class Job; -} - -namespace AmarokAttica { - -class ATTICA_EXPORT FolderListJob : public KJob -{ - Q_OBJECT - public: - FolderListJob(); - - void setUrl( const QUrl & ); - - void start(); - - Folder::List folderList() const; - - protected Q_SLOTS: - void doWork(); - - void slotJobResult( KJob *job ); - void slotJobData( KIO::Job *job, const QByteArray &data ); - - private: - QUrl m_url; - KIO::Job *m_job; - QByteArray m_data; - - Folder::List m_folderList; -}; - -} - -#endif diff --git a/src/aboutdialog/libattica-ocsclient/folderlistjob.cpp b/src/aboutdialog/libattica-ocsclient/folderlistjob.cpp deleted file mode 100644 --- a/src/aboutdialog/libattica-ocsclient/folderlistjob.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include "folderlistjob.h" - -#include "folderparser.h" - -#include - -#include -#include - -using namespace AmarokAttica; - -FolderListJob::FolderListJob() - : m_job( ) -{ -} - -void FolderListJob::setUrl( const QUrl &url ) -{ - m_url = url; -} - -void FolderListJob::start() -{ - QTimer::singleShot( 0, this, &FolderListJob::doWork ); -} - -Folder::List FolderListJob::folderList() const -{ - return m_folderList; -} - -void FolderListJob::doWork() -{ - qDebug() << m_url; - - auto job = KIO::get( m_url, KIO::NoReload, KIO::HideProgressInfo ); - connect( job, &KIO::TransferJob::result, - this, &FolderListJob::slotJobResult ); - connect( job, &KIO::TransferJob::data, - this, &FolderListJob::slotJobData ); - - m_job = job; -} - -void FolderListJob::slotJobResult( KJob *job ) -{ - m_job = 0; - - if ( job->error() ) { - setError( job->error() ); - setErrorText( job->errorText() ); - - emitResult(); - } else { - qDebug() << m_data; - m_folderList = FolderParser().parseList( - QString::fromUtf8( m_data.data() ) ); - - emitResult(); - } -} - -void FolderListJob::slotJobData( KIO::Job *, const QByteArray &data ) -{ - m_data.append( data ); -} diff --git a/src/aboutdialog/libattica-ocsclient/folderparser.h b/src/aboutdialog/libattica-ocsclient/folderparser.h deleted file mode 100644 --- a/src/aboutdialog/libattica-ocsclient/folderparser.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ -#ifndef ATTICA_FOLDERPARSER_H -#define ATTICA_FOLDERPARSER_H - -#include "folder.h" - - -namespace AmarokAttica { - -class FolderParser -{ - public: - FolderParser(); - - Folder::List parseList( const QString &xml ); -}; - -} - -#endif diff --git a/src/aboutdialog/libattica-ocsclient/folderparser.cpp b/src/aboutdialog/libattica-ocsclient/folderparser.cpp deleted file mode 100644 --- a/src/aboutdialog/libattica-ocsclient/folderparser.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include "folderparser.h" - -#include - -using namespace AmarokAttica; - -FolderParser::FolderParser() -{ -} - -Folder::List FolderParser::parseList( const QString &xmlString ) -{ - Folder::List folderList; - - QXmlStreamReader xml( xmlString ); - - while ( !xml.atEnd() ) { - xml.readNext(); - - if ( xml.isStartElement() && xml.name() == "folder" ) { - Folder folder; - - while ( !xml.atEnd() ) { - xml.readNext(); - - if ( xml.isStartElement() ) { - if ( xml.name() == "id" ) { - folder.setId( xml.readElementText() ); - } else if ( xml.name() == "name" ) { - folder.setName( xml.readElementText() ); - } else if ( xml.name() == "messagecount" ) { - folder.setMessageCount( xml.readElementText().toInt() ); - } else if ( xml.name() == "type" ) { - folder.setType( xml.readElementText() ); - } - } - - if ( xml.isEndElement() && xml.name() == "folder" ) break; - } - - folderList.append( folder ); - } - } - - return folderList; -} diff --git a/src/aboutdialog/libattica-ocsclient/knowledgebase.h b/src/aboutdialog/libattica-ocsclient/knowledgebase.h deleted file mode 100644 --- a/src/aboutdialog/libattica-ocsclient/knowledgebase.h +++ /dev/null @@ -1,100 +0,0 @@ -/*************************************************************************** - * This file is part of KDE. * - * Copyright (C) 2009 Marco Martin * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * - ***************************************************************************/ - -#ifndef ATTICA_KNOWLEDGEBASE_H -#define ATTICA_KNOWLEDGEBASE_H - -#include "atticaclient_export.h" - -#include -#include -#include - -namespace AmarokAttica -{ - -class ATTICA_EXPORT KnowledgeBase -{ - public: - typedef QList List; - struct Metadata - { - QString status; - QString message; - int totalItems; - int itemsPerPage; - }; - - KnowledgeBase(); - - void setId(QString id); - QString id() const; - - void setContentId(int id); - int contentId() const; - - void setUser(const QString &user); - QString user() const; - - void setStatus(const QString status); - QString status() const; - - void setChanged(const QDateTime &changed); - QDateTime changed() const; - - void setName(const QString &name); - QString name() const; - - void setDescription(const QString &description); - QString description() const; - - void setAnswer(const QString &answer); - QString answer() const; - - void setComments(int comments); - int comments() const; - - void setDetailPage(const QUrl &detailPage); - QUrl detailPage() const; - - void addExtendedAttribute( const QString &key, const QString &value ); - QString extendedAttribute( const QString &key ) const; - - QMap extendedAttributes() const; - - private: - QString m_id; - int m_contentId; - QString m_user; - QString m_status; - QDateTime m_changed; - QString m_name; - QString m_description; - QString m_answer; - int m_comments; - QUrl m_detailPage; - - QMap m_extendedAttributes; -}; - -} - -#endif - diff --git a/src/aboutdialog/libattica-ocsclient/knowledgebase.cpp b/src/aboutdialog/libattica-ocsclient/knowledgebase.cpp deleted file mode 100644 --- a/src/aboutdialog/libattica-ocsclient/knowledgebase.cpp +++ /dev/null @@ -1,156 +0,0 @@ -/*************************************************************************** - * This file is part of KDE. * - * Copyright (C) 2009 Marco Martin * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * - ***************************************************************************/ - - - -#include "knowledgebase.h" - -using namespace AmarokAttica; - -KnowledgeBase::KnowledgeBase() - : m_contentId(0), - m_comments(0) -{ -} - - -void KnowledgeBase::setId(QString id) -{ - m_id = id; -} - -QString KnowledgeBase::id() const -{ - return m_id; -} - - -void KnowledgeBase::setContentId(int id) -{ - m_contentId = id; -} - -int KnowledgeBase::contentId() const -{ - return m_contentId; -} - - -void KnowledgeBase::setUser(const QString &user) -{ - m_user = user; -} - -QString KnowledgeBase::user() const -{ - return m_user; -} - - -void KnowledgeBase::setStatus(const QString status) -{ - m_status = status; -} - -QString KnowledgeBase::status() const -{ - return m_status; -} - - -void KnowledgeBase::setChanged(const QDateTime &changed) -{ - m_changed = changed; -} - -QDateTime KnowledgeBase::changed() const -{ - return m_changed; -} - - -void KnowledgeBase::setName(const QString &name) -{ - m_name = name; -} - -QString KnowledgeBase::name() const -{ - return m_name; -} - - -void KnowledgeBase::setDescription(const QString &description) -{ - m_description = description; -} - -QString KnowledgeBase::description() const -{ - return m_description; -} - - -void KnowledgeBase::setAnswer(const QString &answer) -{ - m_answer = answer; -} - -QString KnowledgeBase::answer() const -{ - return m_answer; -} - - -void KnowledgeBase::setComments(int comments) -{ - m_comments = comments; -} - -int KnowledgeBase::comments() const -{ - return m_comments; -} - - -void KnowledgeBase::setDetailPage(const QUrl &detailPage) -{ - m_detailPage = detailPage; -} - -QUrl KnowledgeBase::detailPage() const -{ - return m_detailPage; -} - -void KnowledgeBase::addExtendedAttribute( const QString &key, const QString &value ) -{ - m_extendedAttributes.insert( key, value ); -} - -QString KnowledgeBase::extendedAttribute( const QString &key ) const -{ - return m_extendedAttributes.value( key ); -} - -QMap KnowledgeBase::extendedAttributes() const -{ - return m_extendedAttributes; -} diff --git a/src/aboutdialog/libattica-ocsclient/knowledgebasejob.h b/src/aboutdialog/libattica-ocsclient/knowledgebasejob.h deleted file mode 100644 --- a/src/aboutdialog/libattica-ocsclient/knowledgebasejob.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - Copyright (c) 2009 Marco Martin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. - */ -#ifndef ATTICA_KNOWLEDGEBASEJOB_H -#define ATTICA_KNOWLEDGEBASEJOB_H - -#include "knowledgebase.h" - -#include - -namespace KIO { -class Job; -} - -namespace AmarokAttica { - -class ATTICA_EXPORT KnowledgeBaseJob : public KJob -{ - Q_OBJECT - public: - KnowledgeBaseJob(); - - void setUrl( const QUrl & ); - - void start(); - - KnowledgeBase knowledgeBase() const; - KnowledgeBase::Metadata metadata() const; - - protected Q_SLOTS: - void doWork(); - - void slotJobResult( KJob *job ); - void slotJobData( KIO::Job *job, const QByteArray &data ); - - private: - QUrl m_url; - KIO::Job *m_job; - QByteArray m_data; - - KnowledgeBase m_knowledgeBase; - KnowledgeBase::Metadata m_metadata; -}; - -} - -#endif diff --git a/src/aboutdialog/libattica-ocsclient/knowledgebasejob.cpp b/src/aboutdialog/libattica-ocsclient/knowledgebasejob.cpp deleted file mode 100644 --- a/src/aboutdialog/libattica-ocsclient/knowledgebasejob.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - Copyright (c) 2009 Marco Martin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include "knowledgebasejob.h" - -#include "knowledgebaseparser.h" - -#include - -#include -#include - -using namespace AmarokAttica; - -KnowledgeBaseJob::KnowledgeBaseJob() - : m_job( ) -{ -} - -void KnowledgeBaseJob::setUrl( const QUrl &url ) -{ - m_url = url; -} - -void KnowledgeBaseJob::start() -{ - QTimer::singleShot( 0, this, &KnowledgeBaseJob::doWork ); -} - -KnowledgeBase KnowledgeBaseJob::knowledgeBase() const -{ - return m_knowledgeBase; -} - -KnowledgeBase::Metadata KnowledgeBaseJob::metadata() const -{ - return m_metadata; -} - -void KnowledgeBaseJob::doWork() -{ - qDebug() << m_url; - - auto job = KIO::get( m_url, KIO::NoReload, KIO::HideProgressInfo ); - connect( job, &KIO::TransferJob::result, - this, &KnowledgeBaseJob::slotJobResult ); - connect( job, &KIO::TransferJob::data, - this, &KnowledgeBaseJob::slotJobData ); - - m_job = job; -} - -void KnowledgeBaseJob::slotJobResult( KJob *job ) -{ - m_job = 0; - - if ( job->error() ) { - setError( job->error() ); - setErrorText( job->errorText() ); - } else { - qDebug() << m_data; - KnowledgeBaseParser parser; - m_knowledgeBase = parser.parse( QString::fromUtf8( m_data.data() ) ); - m_metadata = parser.lastMetadata(); - } - - emitResult(); -} - -void KnowledgeBaseJob::slotJobData( KIO::Job *, const QByteArray &data ) -{ - m_data.append( data ); -} - diff --git a/src/aboutdialog/libattica-ocsclient/knowledgebaselistjob.h b/src/aboutdialog/libattica-ocsclient/knowledgebaselistjob.h deleted file mode 100644 --- a/src/aboutdialog/libattica-ocsclient/knowledgebaselistjob.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - Copyright (c) 2009 Marco Martin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. - */ -#ifndef ATTICA_KNOWLEDGEBASELISTJOB_H -#define ATTICA_KNOWLEDGEBASELISTJOB_H - -#include "knowledgebase.h" - -#include -#include - -namespace KIO { -class Job; -} - -namespace AmarokAttica { - -class ATTICA_EXPORT KnowledgeBaseListJob : public KJob -{ - Q_OBJECT - public: - KnowledgeBaseListJob(); - - void setUrl( const QUrl & ); - - void start(); - - KnowledgeBase::List knowledgeBaseList() const; - KnowledgeBase::Metadata metadata() const; - - protected Q_SLOTS: - void doWork(); - - void slotJobResult( KJob *job ); - void slotJobData( KIO::Job *job, const QByteArray &data ); - - private: - QUrl m_url; - KIO::Job *m_job; - QByteArray m_data; - - KnowledgeBase::List m_knowledgeBaseList; - KnowledgeBase::Metadata m_metadata; -}; - -} - -#endif diff --git a/src/aboutdialog/libattica-ocsclient/knowledgebaselistjob.cpp b/src/aboutdialog/libattica-ocsclient/knowledgebaselistjob.cpp deleted file mode 100644 --- a/src/aboutdialog/libattica-ocsclient/knowledgebaselistjob.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - Copyright (c) 2009 Marco Martin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include "knowledgebaselistjob.h" - -#include "knowledgebaseparser.h" - -#include - -#include -#include - -using namespace AmarokAttica; - -KnowledgeBaseListJob::KnowledgeBaseListJob() - : m_job( ) -{ -} - -void KnowledgeBaseListJob::setUrl( const QUrl &url ) -{ - m_url = url; -} - -void KnowledgeBaseListJob::start() -{ - QTimer::singleShot( 0, this, &KnowledgeBaseListJob::doWork ); -} - -KnowledgeBase::List KnowledgeBaseListJob::knowledgeBaseList() const -{ - return m_knowledgeBaseList; -} - -KnowledgeBase::Metadata KnowledgeBaseListJob::metadata() const -{ - return m_metadata; -} - -void KnowledgeBaseListJob::doWork() -{ - qDebug() << m_url; - - auto job = KIO::get( m_url, KIO::NoReload, KIO::HideProgressInfo ); - connect( job, &KIO::TransferJob::result, - this, &KnowledgeBaseListJob::slotJobResult ); - connect( job, &KIO::TransferJob::data, - this, &KnowledgeBaseListJob::slotJobData ); - - m_job = job; -} - -void KnowledgeBaseListJob::slotJobResult( KJob *job ) -{ - m_job = 0; - - if ( job->error() ) { - setError( job->error() ); - setErrorText( job->errorText() ); - - emitResult(); - } else { - qDebug() << m_data; - KnowledgeBaseParser parser; - m_knowledgeBaseList = parser.parseList( - QString::fromUtf8( m_data.data() ) ); - m_metadata = parser.lastMetadata(); - - emitResult(); - } -} - -void KnowledgeBaseListJob::slotJobData( KIO::Job *, const QByteArray &data ) -{ - m_data.append( data ); -} diff --git a/src/aboutdialog/libattica-ocsclient/knowledgebaseparser.h b/src/aboutdialog/libattica-ocsclient/knowledgebaseparser.h deleted file mode 100644 --- a/src/aboutdialog/libattica-ocsclient/knowledgebaseparser.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - Copyright (c) 2009 Marco Martin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ -#ifndef ATTICA_KNOWLEDGEBASEPARSER_H -#define ATTICA_KNOWLEDGEBASEPARSER_H - -#include "knowledgebase.h" - -#include - -namespace AmarokAttica { - -class KnowledgeBaseParser -{ - public: - KnowledgeBaseParser(); - - KnowledgeBase parse( const QString &xml ); - KnowledgeBase::List parseList( const QString &xml ); - KnowledgeBase::Metadata lastMetadata(); - - protected: - KnowledgeBase parseKnowledgeBase( QXmlStreamReader &xml ); - KnowledgeBase::Metadata parseMetadata( QXmlStreamReader &xml ); - - private: - KnowledgeBase::Metadata m_lastMetadata; -}; - -} - -#endif diff --git a/src/aboutdialog/libattica-ocsclient/knowledgebaseparser.cpp b/src/aboutdialog/libattica-ocsclient/knowledgebaseparser.cpp deleted file mode 100644 --- a/src/aboutdialog/libattica-ocsclient/knowledgebaseparser.cpp +++ /dev/null @@ -1,150 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - Copyright (c) 2009 Marco Martin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include "knowledgebaseparser.h" - -using namespace AmarokAttica; - -KnowledgeBaseParser::KnowledgeBaseParser() -{ -} - -KnowledgeBase::List KnowledgeBaseParser::parseList( const QString &xmlString ) -{ - KnowledgeBase::List KnowledgeBaseList; - - QXmlStreamReader xml( xmlString ); - - m_lastMetadata = parseMetadata(xml); - - while ( !xml.atEnd() ) { - xml.readNext(); - - if ( xml.isStartElement() && xml.name() == "content" ) { - KnowledgeBase KnowledgeBase = parseKnowledgeBase( xml ); - KnowledgeBaseList.append( KnowledgeBase ); - } - } - - return KnowledgeBaseList; -} - -KnowledgeBase KnowledgeBaseParser::parse( const QString &xmlString ) -{ - KnowledgeBase knowledgeBase; - - QXmlStreamReader xml( xmlString ); - - m_lastMetadata = parseMetadata(xml); - - while ( !xml.atEnd() ) { - xml.readNext(); - - if ( xml.isStartElement() && xml.name() == "knowledgebase" ) { - knowledgeBase = parseKnowledgeBase( xml ); - } - } - - return knowledgeBase; -} - -KnowledgeBase::Metadata KnowledgeBaseParser::lastMetadata() -{ - return m_lastMetadata; -} - -KnowledgeBase::Metadata KnowledgeBaseParser::parseMetadata( QXmlStreamReader &xml ) -{ - KnowledgeBase::Metadata meta; - meta.status.clear(); - meta.message.clear(); - meta.totalItems = 0; - meta.itemsPerPage = 0; - - while ( !xml.atEnd() ) { - xml.readNext(); - if (xml.isStartElement() && xml.name() == "meta") { - while ( !xml.atEnd() ) { - xml.readNext(); - if (xml.isEndElement() && xml.name() == "meta") { - break; - } else if (xml.isStartElement()) { - if (xml.name() == "status") { - meta.status = xml.readElementText(); - } else if (xml.name() == "message") { - meta.message = xml.readElementText(); - } else if (xml.name() == "totalitems") { - meta.totalItems = xml.readElementText().toInt(); - } else if (xml.name() == "itemsperpage") { - meta.itemsPerPage = xml.readElementText().toInt(); - } - } - } - break; - } - } - - return meta; -} - -KnowledgeBase KnowledgeBaseParser::parseKnowledgeBase( QXmlStreamReader &xml ) -{ - KnowledgeBase knowledgeBase; - - while ( !xml.atEnd() ) { - xml.readNext(); - - if ( xml.isStartElement() ) { - if ( xml.name() == "id" ) { - knowledgeBase.setId( xml.readElementText() ); - } else if ( xml.name() == "status" ) { - knowledgeBase.setStatus( xml.readElementText() ); - } else if ( xml.name() == "contentId" ) { - knowledgeBase.setContentId( xml.readElementText().toInt() ); - } else if ( xml.name() == "user" ) { - knowledgeBase.setUser( xml.readElementText() ); - } else if ( xml.name() == "changed" ) { - knowledgeBase.setChanged( QDateTime::fromString( xml.readElementText(), - Qt::ISODate ) ); - } else if ( xml.name() == "description" ) { - knowledgeBase.setDescription( xml.readElementText() ); - } else if ( xml.name() == "answer" ) { - knowledgeBase.setAnswer( xml.readElementText() ); - } else if ( xml.name() == "comments" ) { - knowledgeBase.setComments( xml.readElementText().toInt() ); - } else if ( xml.name() == "detailpage" ) { - knowledgeBase.setDetailPage( QUrl(xml.readElementText()) ); - } else if ( xml.name() == "contentid" ) { - knowledgeBase.setContentId( xml.readElementText().toInt() ); - } else if ( xml.name() == "name" ) { - knowledgeBase.setName( xml.readElementText() ); - } else { - knowledgeBase.addExtendedAttribute( xml.name().toString(), - xml.readElementText() ); - } - } - - if ( xml.isEndElement() && xml.name() == "content" ) break; - } - - return knowledgeBase; -} diff --git a/src/aboutdialog/libattica-ocsclient/message.h b/src/aboutdialog/libattica-ocsclient/message.h deleted file mode 100644 --- a/src/aboutdialog/libattica-ocsclient/message.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ -#ifndef ATTICA_MESSAGE_H -#define ATTICA_MESSAGE_H - -#include -#include - -#include "atticaclient_export.h" - - -namespace AmarokAttica { - -class ATTICA_EXPORT Message -{ - public: - typedef QList List; - - enum Status { Unread = 0, Read = 1 }; - - Message(); - - void setId( const QString & ); - QString id() const; - - void setFrom( const QString & ); - QString from() const; - - void setTo( const QString & ); - QString to() const; - - void setSent( const QDateTime & ); - QDateTime sent() const; - - void setStatus( Status ); - Status status() const; - - void setStatusText( const QString & ); - QString statusText() const; - - void setSubject( const QString & ); - QString subject() const; - - void setBody( const QString & ); - QString body() const; - - private: - QString m_id; - QString m_from; - QString m_to; - QDateTime m_sent; - Status m_status; - QString m_statusText; - QString m_subject; - QString m_body; -}; - -} - -#endif diff --git a/src/aboutdialog/libattica-ocsclient/message.cpp b/src/aboutdialog/libattica-ocsclient/message.cpp deleted file mode 100644 --- a/src/aboutdialog/libattica-ocsclient/message.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include "message.h" - -using namespace AmarokAttica; - -Message::Message() - : m_status( Unread ) -{ -} - -void Message::setId( const QString &u ) -{ - m_id = u; -} - -QString Message::id() const -{ - return m_id; -} - -void Message::setFrom( const QString &n ) -{ - m_from = n; -} - -QString Message::from() const -{ - return m_from; -} - -void Message::setTo( const QString &n ) -{ - m_to = n; -} - -QString Message::to() const -{ - return m_to; -} - -void Message::setSent( const QDateTime &d ) -{ - m_sent = d; -} - -QDateTime Message::sent() const -{ - return m_sent; -} - -void Message::setStatus( Message::Status s ) -{ - m_status = s; -} - -Message::Status Message::status() const -{ - return m_status; -} - -void Message::setStatusText( const QString &c ) -{ - m_statusText = c; -} - -QString Message::statusText() const -{ - return m_statusText; -} - -void Message::setSubject( const QString &subject ) -{ - m_subject = subject; -} - -QString Message::subject() const -{ - return m_subject; -} - -void Message::setBody( const QString &body ) -{ - m_body = body; -} - -QString Message::body() const -{ - return m_body; -} diff --git a/src/aboutdialog/libattica-ocsclient/messagelistjob.h b/src/aboutdialog/libattica-ocsclient/messagelistjob.h deleted file mode 100644 --- a/src/aboutdialog/libattica-ocsclient/messagelistjob.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ -#ifndef ATTICA_MESSAGELISTJOB_H -#define ATTICA_MESSAGELISTJOB_H - -#include "message.h" - -#include -#include - -namespace KIO { -class Job; -} - -namespace AmarokAttica { - -class ATTICA_EXPORT MessageListJob : public KJob -{ - Q_OBJECT - public: - MessageListJob(); - - void setUrl( const QUrl & ); - - void start(); - - Message::List messageList() const; - - protected Q_SLOTS: - void doWork(); - - void slotJobResult( KJob *job ); - void slotJobData( KIO::Job *job, const QByteArray &data ); - - private: - QUrl m_url; - KIO::Job *m_job; - QByteArray m_data; - - Message::List m_messageList; -}; - -} - -#endif diff --git a/src/aboutdialog/libattica-ocsclient/messagelistjob.cpp b/src/aboutdialog/libattica-ocsclient/messagelistjob.cpp deleted file mode 100644 --- a/src/aboutdialog/libattica-ocsclient/messagelistjob.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include "messagelistjob.h" - -#include "messageparser.h" - -#include -#include - -#include - - -using namespace AmarokAttica; - -MessageListJob::MessageListJob() - : m_job( ) -{ -} - -void MessageListJob::setUrl( const QUrl &url ) -{ - m_url = url; -} - -void MessageListJob::start() -{ - QTimer::singleShot( 0, this, &MessageListJob::doWork ); -} - -Message::List MessageListJob::messageList() const -{ - return m_messageList; -} - -void MessageListJob::doWork() -{ - qDebug() << m_url; - - auto job = KIO::get( m_url, KIO::NoReload, KIO::HideProgressInfo ); - connect( job, &KIO::TransferJob::result, - this, &MessageListJob::slotJobResult ); - connect( job, &KIO::TransferJob::data, - this, &MessageListJob::slotJobData ); - - m_job = job; -} - -void MessageListJob::slotJobResult( KJob *job ) -{ - m_job = 0; - - if ( job->error() ) { - setError( job->error() ); - setErrorText( job->errorText() ); - - emitResult(); - } else { - qDebug() << m_data; - m_messageList = MessageParser().parseList( - QString::fromUtf8( m_data.data() ) ); - - emitResult(); - } -} - -void MessageListJob::slotJobData( KIO::Job *, const QByteArray &data ) -{ - m_data.append( data ); -} diff --git a/src/aboutdialog/libattica-ocsclient/messageparser.h b/src/aboutdialog/libattica-ocsclient/messageparser.h deleted file mode 100644 --- a/src/aboutdialog/libattica-ocsclient/messageparser.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ -#ifndef ATTICA_MESSAGEPARSER_H -#define ATTICA_MESSAGEPARSER_H - -#include "message.h" - - -namespace AmarokAttica { - -class MessageParser -{ - public: - MessageParser(); - - Message::List parseList( const QString &xml ); -}; - -} - -#endif diff --git a/src/aboutdialog/libattica-ocsclient/messageparser.cpp b/src/aboutdialog/libattica-ocsclient/messageparser.cpp deleted file mode 100644 --- a/src/aboutdialog/libattica-ocsclient/messageparser.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include "messageparser.h" - -#include - -using namespace AmarokAttica; - -MessageParser::MessageParser() -{ -} - -Message::List MessageParser::parseList( const QString &xmlString ) -{ - Message::List messageList; - - QXmlStreamReader xml( xmlString ); - - while ( !xml.atEnd() ) { - xml.readNext(); - - if ( xml.isStartElement() && xml.name() == "data" ) { - while ( !xml.atEnd() ) { - xml.readNext(); - - if ( xml.isEndElement() && xml.name() == "data" ) break; - - if ( xml.isStartElement() && xml.name() == "message" ) { - Message message; - - while ( !xml.atEnd() ) { - xml.readNext(); - - if ( xml.isStartElement() ) { - if ( xml.name() == "id" ) { - message.setId( xml.readElementText() ); - } else if ( xml.name() == "messagefrom" ) { - message.setFrom( xml.readElementText() ); - } else if ( xml.name() == "messageto" ) { - message.setTo( xml.readElementText() ); - } else if ( xml.name() == "senddate" ) { - message.setSent( QDateTime::fromString( xml.readElementText(), - Qt::ISODate ) ); - } else if ( xml.name() == "status" ) { - message.setStatus( - Message::Status( xml.readElementText().toInt() ) ); - } else if ( xml.name() == "statustext" ) { - message.setStatusText( xml.readElementText() ); - } else if ( xml.name() == "subject" ) { - message.setSubject( xml.readElementText() ); - } else if ( xml.name() == "body" ) { - message.setBody( xml.readElementText() ); - } - } - - if ( xml.isEndElement() && xml.name() == "message" ) break; - } - - messageList.append( message ); - } - } - } - } - - return messageList; -} diff --git a/src/aboutdialog/libattica-ocsclient/person.h b/src/aboutdialog/libattica-ocsclient/person.h deleted file mode 100644 --- a/src/aboutdialog/libattica-ocsclient/person.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ -#ifndef ATTICA_PERSON_H -#define ATTICA_PERSON_H - -#include -#include -#include - -#include -#include - -#include "atticaclient_export.h" - - -namespace AmarokAttica { - -class ATTICA_EXPORT Person -{ - public: - typedef QList List; - - Person(); - - void setId( const QString & ); - QString id() const; - - void setFirstName( const QString & ); - QString firstName() const; - - void setLastName( const QString & ); - QString lastName() const; - - void setBirthday( const QDate & ); - QDate birthday() const; - - void setCountry( const QString & ); - QString country() const; - - void setLatitude( qreal ); - qreal latitude() const; - - void setLongitude( qreal ); - qreal longitude() const; - - void setAvatarUrl( const QUrl & ); - QUrl avatarUrl() const; - - void setAvatar( const QPixmap & ); - QPixmap avatar() const; - - void setHomepage( const QString & ); - QString homepage() const; - - void setCity( const QString & ); - QString city() const; - - void addExtendedAttribute( const QString &key, const QString &value ); - QString extendedAttribute( const QString &key ) const; - - QMap extendedAttributes() const; - - private: - QString m_id; - QString m_firstName; - QString m_lastName; - QDate m_birthday; - QString m_country; - qreal m_latitude; - qreal m_longitude; - QUrl m_avatarUrl; - QPixmap m_avatar; - QString m_homepage; - QString m_city; - - QMap m_extendedAttributes; -}; - -} - -#endif diff --git a/src/aboutdialog/libattica-ocsclient/person.cpp b/src/aboutdialog/libattica-ocsclient/person.cpp deleted file mode 100644 --- a/src/aboutdialog/libattica-ocsclient/person.cpp +++ /dev/null @@ -1,154 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include "person.h" - -using namespace AmarokAttica; - -Person::Person() - : m_latitude( 0 ), m_longitude( 0 ) -{ -} - -void Person::setId( const QString &u ) -{ - m_id = u; -} - -QString Person::id() const -{ - return m_id; -} - -void Person::setFirstName( const QString &name ) -{ - m_firstName = name; -} - -QString Person::firstName() const -{ - return m_firstName; -} - -void Person::setLastName( const QString &name ) -{ - m_lastName = name; -} - -QString Person::lastName() const -{ - return m_lastName; -} - -void Person::setBirthday( const QDate &d ) -{ - m_birthday = d; -} - -QDate Person::birthday() const -{ - return m_birthday; -} - -void Person::setCountry( const QString &c ) -{ - m_country = c; -} - -QString Person::country() const -{ - return m_country; -} - -void Person::setLatitude( qreal l ) -{ - m_latitude = l; -} - -qreal Person::latitude() const -{ - return m_latitude; -} - -void Person::setLongitude( qreal l ) -{ - m_longitude = l; -} - -qreal Person::longitude() const -{ - return m_longitude; -} - -void Person::setAvatarUrl( const QUrl &url ) -{ - m_avatarUrl = url; -} - -QUrl Person::avatarUrl() const -{ - return m_avatarUrl; -} - -void Person::setAvatar( const QPixmap &p ) -{ - m_avatar = p; -} - -QPixmap Person::avatar() const -{ - return m_avatar; -} - -void Person::setHomepage( const QString &h ) -{ - m_homepage = h; -} - -QString Person::homepage() const -{ - return m_homepage; -} - -void Person::setCity( const QString &h ) -{ - m_city = h; -} - -QString Person::city() const -{ - return m_city; -} - -void Person::addExtendedAttribute( const QString &key, const QString &value ) -{ - m_extendedAttributes.insert( key, value ); -} - -QString Person::extendedAttribute( const QString &key ) const -{ - return m_extendedAttributes.value( key ); -} - -QMap Person::extendedAttributes() const -{ - return m_extendedAttributes; -} diff --git a/src/aboutdialog/libattica-ocsclient/personjob.h b/src/aboutdialog/libattica-ocsclient/personjob.h deleted file mode 100644 --- a/src/aboutdialog/libattica-ocsclient/personjob.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. - */ -#ifndef ATTICA_PERSONJOB_H -#define ATTICA_PERSONJOB_H - -#include "person.h" - -#include - -namespace KIO { -class Job; -} - -namespace AmarokAttica { - -class ATTICA_EXPORT PersonJob : public KJob -{ - Q_OBJECT - public: - PersonJob(); - - void setUrl( const QUrl & ); - - void start(); - - Person person() const; - - protected Q_SLOTS: - void doWork(); - - void slotUserJobResult( KJob *job ); - void slotUserJobData( KIO::Job *job, const QByteArray &data ); - - void slotAvatarJobResult( KJob *job ); - void slotAvatarJobData( KIO::Job *job, const QByteArray &data ); - - private: - QUrl m_url; - KIO::Job *m_job; - QString m_userData; - QByteArray m_avatarData; - - Person m_person; -}; - -} - -#endif diff --git a/src/aboutdialog/libattica-ocsclient/personjob.cpp b/src/aboutdialog/libattica-ocsclient/personjob.cpp deleted file mode 100644 --- a/src/aboutdialog/libattica-ocsclient/personjob.cpp +++ /dev/null @@ -1,120 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include "personjob.h" - -#include "personparser.h" - -#include -#include - -#include - - -using namespace AmarokAttica; - -PersonJob::PersonJob() - : m_job( ) -{ -} - -void PersonJob::setUrl( const QUrl &url ) -{ - m_url = url; -} - -void PersonJob::start() -{ - QTimer::singleShot( 0, this, &PersonJob::doWork ); -} - -Person PersonJob::person() const -{ - return m_person; -} - -void PersonJob::doWork() -{ - qDebug() << m_url; - - auto job = KIO::get( m_url, KIO::NoReload, KIO::HideProgressInfo ); - connect( job, &KIO::TransferJob::result, - this, &PersonJob::slotUserJobResult ); - connect( job, &KIO::TransferJob::data, - this, &PersonJob::slotUserJobData ); - - m_job = job; -} - -void PersonJob::slotUserJobResult( KJob *job ) -{ - m_job = 0; - - if ( job->error() ) { - setError( job->error() ); - setErrorText( job->errorText() ); - - emitResult(); - } else { - // qDebug() << m_userData; - m_person = PersonParser().parse( m_userData ); - - if (!m_person.avatarUrl().isEmpty()) { - qDebug() << "Getting avatar from" << m_person.avatarUrl(); - - auto job = KIO::get( m_url, KIO::NoReload, KIO::HideProgressInfo ); - connect( job, &KIO::TransferJob::result, - this, &PersonJob::slotAvatarJobResult ); - connect( job, &KIO::TransferJob::data, - this, &PersonJob::slotAvatarJobData ); - - m_job = job; - } else { - emitResult(); - } - } -} - -void PersonJob::slotUserJobData( KIO::Job *, const QByteArray &data ) -{ - m_userData.append( QString::fromUtf8( data.data(), data.size() + 1 ) ); -} - -void PersonJob::slotAvatarJobResult( KJob *job ) -{ - m_job = 0; - - if ( job->error() ) { - qWarning() << "Error retrieving Avatar:" << job->errorText(); - } else { - QPixmap pic; - if ( pic.loadFromData( m_avatarData ) ) { - m_person.setAvatar( pic ); - } - } - - emitResult(); -} - -void PersonJob::slotAvatarJobData( KIO::Job *, const QByteArray &data ) -{ - m_avatarData.append( data ); -} diff --git a/src/aboutdialog/libattica-ocsclient/personlistjob.h b/src/aboutdialog/libattica-ocsclient/personlistjob.h deleted file mode 100644 --- a/src/aboutdialog/libattica-ocsclient/personlistjob.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. - */ -#ifndef ATTICA_PERSONLISTJOB_H -#define ATTICA_PERSONLISTJOB_H - -#include "person.h" - -#include - -namespace KIO { -class Job; -} - -namespace AmarokAttica { - -class ATTICA_EXPORT PersonListJob : public KJob -{ - Q_OBJECT - public: - PersonListJob(); - - void setUrl( const QUrl & ); - - void start(); - - Person::List personList() const; - - protected Q_SLOTS: - void doWork(); - - void slotUserJobResult( KJob *job ); - void slotUserJobData( KIO::Job *job, const QByteArray &data ); - - void slotAvatarJobResult( KJob *job ); - void slotAvatarJobData( KIO::Job *job, const QByteArray &data ); - - private: - QUrl m_url; - KIO::Job *m_job; - QString m_userData; - QByteArray m_avatarData; - - Person::List m_personList; -}; - -} - -#endif diff --git a/src/aboutdialog/libattica-ocsclient/personlistjob.cpp b/src/aboutdialog/libattica-ocsclient/personlistjob.cpp deleted file mode 100644 --- a/src/aboutdialog/libattica-ocsclient/personlistjob.cpp +++ /dev/null @@ -1,122 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include "personlistjob.h" - -#include "personparser.h" - -#include -#include - -#include -#include - - -using namespace AmarokAttica; - -PersonListJob::PersonListJob() - : m_job( ) -{ -} - -void PersonListJob::setUrl( const QUrl &url ) -{ - m_url = url; -} - -void PersonListJob::start() -{ - QTimer::singleShot( 0, this, &PersonListJob::doWork ); -} - -Person::List PersonListJob::personList() const -{ - return m_personList; -} - -void PersonListJob::doWork() -{ - qDebug() << m_url; - - auto job = KIO::get( m_url, KIO::NoReload, KIO::HideProgressInfo ); - connect( job, &KIO::TransferJob::result, - this, &PersonListJob::slotUserJobResult ); - connect( job, &KIO::TransferJob::data, - this, &PersonListJob::slotUserJobData ); - - m_job = job; -} - -void PersonListJob::slotUserJobResult( KJob *job ) -{ - m_job = 0; - - if ( job->error() ) { - setError( job->error() ); - setErrorText( job->errorText() ); - - emitResult(); - } else { - // qDebug() << m_userData; - m_personList = PersonParser().parseList( m_userData ); - -#if 0 - m_job = KIO::get( m_person.avatarUrl(), KIO::NoReload, - KIO::HideProgressInfo ); - connect( m_job, &KIO::Job::result, - this, &PersonListJob::slotAvatarJobResult ); - connect( m_job, &KIO::Job::data, - this, &PersonListJob::slotAvatarJobData ); -#else - emitResult(); -#endif - } -} - -void PersonListJob::slotUserJobData( KIO::Job *, const QByteArray &data ) -{ - m_userData.append( QString::fromUtf8( data.data(), data.size() + 1 ) ); -} - -void PersonListJob::slotAvatarJobResult( KJob *job ) -{ - m_job = 0; - - if ( job->error() ) { - setError( job->error() ); - setErrorText( job->errorText() ); - } else { - QPixmap pic; - if ( !pic.loadFromData( m_avatarData ) ) { - setError( UserDefinedError ); - setErrorText( i18n("Unable to parse avatar image data.") ); - } else { -// m_person.setAvatar( pic ); - } - } - - emitResult(); -} - -void PersonListJob::slotAvatarJobData( KIO::Job *, const QByteArray &data ) -{ - m_avatarData.append( data ); -} diff --git a/src/aboutdialog/libattica-ocsclient/personparser.h b/src/aboutdialog/libattica-ocsclient/personparser.h deleted file mode 100644 --- a/src/aboutdialog/libattica-ocsclient/personparser.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ -#ifndef ATTICA_PERSONPARSER_H -#define ATTICA_PERSONPARSER_H - -#include "person.h" - -#include - -namespace AmarokAttica { - -class PersonParser -{ - public: - PersonParser(); - - Person parse( const QString &xml ); - Person::List parseList( const QString &xml ); - - protected: - Person parsePerson( QXmlStreamReader &xml ); -}; - -} - -#endif diff --git a/src/aboutdialog/libattica-ocsclient/personparser.cpp b/src/aboutdialog/libattica-ocsclient/personparser.cpp deleted file mode 100644 --- a/src/aboutdialog/libattica-ocsclient/personparser.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include "personparser.h" - -using namespace AmarokAttica; - -PersonParser::PersonParser() -{ -} - -Person::List PersonParser::parseList( const QString &xmlString ) -{ - Person::List personList; - - QXmlStreamReader xml( xmlString ); - - while ( !xml.atEnd() ) { - xml.readNext(); - - if ( xml.isStartElement() && - ( xml.name() == "person" || xml.name() == "user" ) ) { - Person person = parsePerson( xml ); - personList.append( person ); - } - } - - return personList; -} - -Person PersonParser::parse( const QString &xmlString ) -{ - Person person; - - QXmlStreamReader xml( xmlString ); - - while ( !xml.atEnd() ) { - xml.readNext(); - - if ( xml.isStartElement() && xml.name() == "person" ) { - person = parsePerson( xml ); - } - } - - return person; -} - -Person PersonParser::parsePerson( QXmlStreamReader &xml ) -{ - Person person; - bool hasAvatarPic = false; - - while ( !xml.atEnd() ) { - xml.readNext(); - - if ( xml.isStartElement() ) { - if ( xml.name() == "personid" ) { - person.setId( xml.readElementText() ); - } else if ( xml.name() == "firstname" ) { - person.setFirstName( xml.readElementText() ); - } else if ( xml.name() == "lastname" ) { - person.setLastName( xml.readElementText() ); - } else if ( xml.name() == "homepage" ) { - person.setHomepage( xml.readElementText() ); - } else if ( xml.name() == "avatarpic" ) { - person.setAvatarUrl( QUrl::fromUserInput(xml.readElementText()) ); - } else if ( xml.name() == "avatarpicfound" ) { - QString value = xml.readElementText(); - if (value.toInt()) { - hasAvatarPic = true; - } - } else if ( xml.name() == "birthday" ) { - person.setBirthday( QDate::fromString( xml.readElementText(), - Qt::ISODate ) ); - } else if ( xml.name() == "city" ) { - person.setCity( xml.readElementText() ); - } else if ( xml.name() == "country" ) { - person.setCountry( xml.readElementText() ); - } else if ( xml.name() == "latitude" ) { - person.setLatitude( xml.readElementText().toFloat() ); - } else if ( xml.name() == "longitude" ) { - person.setLongitude( xml.readElementText().toFloat() ); - } else { - person.addExtendedAttribute( xml.name().toString(), - xml.readElementText() ); - } - } - - if ( xml.isEndElement() && - ( xml.name() == "person" || xml.name() == "user" ) ) break; - } - - if (!hasAvatarPic) { - person.setAvatarUrl( QUrl::fromUserInput(QString()) ); - } - - return person; -} diff --git a/src/aboutdialog/libattica-ocsclient/postjob.h b/src/aboutdialog/libattica-ocsclient/postjob.h deleted file mode 100644 --- a/src/aboutdialog/libattica-ocsclient/postjob.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. - */ -#ifndef ATTICA_POSTJOB_H -#define ATTICA_POSTJOB_H - -#include "atticaclient_export.h" - -#include -#include -#include - -namespace KIO { -class Job; -} - -namespace AmarokAttica { - -class ATTICA_EXPORT PostJob : public KJob -{ - Q_OBJECT - public: - PostJob(); - - void setUrl( const QUrl & ); - void setData( const QString &name, const QString &value ); - - void start(); - - QString status() const; - QString statusMessage() const; - - protected Q_SLOTS: - void doWork(); - - void slotJobResult( KJob *job ); - void slotJobData( KIO::Job *, const QByteArray & ); - - private: - QUrl m_url; - QMap m_data; - KIO::Job *m_job; - QString m_responseData; - - QString m_status; - QString m_statusMessage; -}; - -} - -#endif diff --git a/src/aboutdialog/libattica-ocsclient/postjob.cpp b/src/aboutdialog/libattica-ocsclient/postjob.cpp deleted file mode 100644 --- a/src/aboutdialog/libattica-ocsclient/postjob.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include "postjob.h" - -#include - -#include -#include -#include -#include - -using namespace AmarokAttica; - -PostJob::PostJob() - : m_job( ) -{ -} - -void PostJob::setUrl( const QUrl &url ) -{ - m_url = url; -} - -void PostJob::setData( const QString &name, const QString &value ) -{ - m_data.insert( name, value ); -} - -void PostJob::start() -{ - QTimer::singleShot( 0, this, &PostJob::doWork ); -} - -QString PostJob::status() const -{ - return m_status; -} - -QString PostJob::statusMessage() const -{ - return m_statusMessage; -} - -void PostJob::doWork() -{ - QString postData; - - const QStringList dataKeys = m_data.keys(); - QUrlQuery query; - foreach( const QString &name, dataKeys ) { - query.addQueryItem( name, m_data.value( name ) ); - } - m_url.setQuery( query ); - - qDebug() << m_url; - - auto job = KIO::http_post( m_url, postData.toUtf8(), KIO::HideProgressInfo ); - connect( job, &KIO::TransferJob::result, - this, &PostJob::slotJobResult ); - connect( job, &KIO::TransferJob::data, - this, &PostJob::slotJobData ); - - m_job = job; -} - -void PostJob::slotJobResult( KJob *job ) -{ - m_job = 0; - - qDebug() << "RESPONSE" << m_responseData; - - if ( job->error() ) { - setError( job->error() ); - setErrorText( job->errorText() ); - } else { - qDebug() << "No error "; - - QXmlStreamReader xml( m_responseData ); - - while ( !xml.atEnd() ) { - xml.readNext(); - - if ( xml.isStartElement() && xml.name() == "meta" ) { - while ( !xml.atEnd() ) { - xml.readNext(); - - if ( xml.isStartElement() ) { - if ( xml.name() == "status" ) { - m_status = xml.readElementText(); - } else if ( xml.name() == "message" ) { - m_statusMessage = xml.readElementText(); - } - } - - if ( xml.isEndElement() && xml.name() == "meta" ) break; - } - } - } - - qDebug() << "STATUS:" << m_status; - - if ( m_status != "ok" ) { - setError( KJob::UserDefinedError ); - setErrorText( m_status + ": " + m_statusMessage ); - } - } - - emitResult(); -} - -void PostJob::slotJobData( KIO::Job *, const QByteArray &data ) -{ - m_responseData.append( QString::fromUtf8( data.data(), data.size() + 1 ) ); -} diff --git a/src/aboutdialog/libattica-ocsclient/provider.h b/src/aboutdialog/libattica-ocsclient/provider.h deleted file mode 100644 --- a/src/aboutdialog/libattica-ocsclient/provider.h +++ /dev/null @@ -1,132 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#ifndef ATTICA_PROVIDER_H -#define ATTICA_PROVIDER_H - -#include -#include - -#include "atticaclient_export.h" -#include "category.h" - -class QUrl; -class QDate; - -namespace AmarokAttica { - -class ActivityListJob; -class CategoryListJob; -class ContentJob; -class ContentListJob; -class EventJob; -class EventListJob; -class FolderListJob; -class KnowledgeBaseJob; -class KnowledgeBaseListJob; -class Message; -class MessageListJob; -class PersonJob; -class PersonListJob; -class PostJob; -class ProviderInitJob; - -/** - Open Collaboration Services API. -*/ -class ATTICA_EXPORT Provider -{ - public: - Provider(); - Provider(const Provider& other); - Provider(const QString& id, const QUrl &baseUrl, const QString& name); - Provider& operator=(const Provider& other); - ~Provider(); - - QString name() const; - QString id() const; - - enum SortMode { - Newest, - Alphabetical, - Rating, - Downloads - }; - - static ProviderInitJob* byId(const QString& id); - - // Person part of OCS - - PersonJob* requestPerson(const QString& id) const; - PersonJob* requestPersonSelf(); - PersonListJob* requestPersonSearchByName(const QString& name); - PersonListJob* requestPersonSearchByLocation(qreal latitude, qreal longitude, qreal distance, int page = 0, int pageSize = 100); - PostJob* postLocation(qreal latitude, qreal longitude, const QString& city = QString(), const QString& country = QString()); - - // Friend part of OCS - - PersonListJob* requestFriend(const QString& id, int page = 0, int pageSize = 100); - PostJob* postInvitation(const QString& to, const QString& message); - - // Message part of OCS - - FolderListJob* requestFolders(); - MessageListJob* requestMessages(const QString& folderId); - PostJob* postMessage(const Message& message); - - // Activity part of OCS - - ActivityListJob* requestActivity(); - PostJob* postActivity(const QString& message); - - // Content part of OCS - - CategoryListJob* requestCategories(); - ContentListJob* requestContent(const Category::List& categories, const QString& search, SortMode mode); - ContentJob* requestContent(const QString& id); - - // KnowledgeBase part of OCS - - KnowledgeBaseJob* requestKnowledgeBase(const QString& id); - KnowledgeBaseListJob* requestKnowledgeBase(int content, const QString& search, SortMode, int page, int pageSize); - - // Event part of OCS - - EventJob* requestEvent(const QString& id); - EventListJob* requestEvent(const QString& country, const QString& search, const QDate& startAt, SortMode mode, int page, int pageSize); - - protected: - QUrl createUrl(const QString& path) const; - - PersonJob* doRequestPerson(const QUrl &url) const; - PersonListJob* doRequestPersonList(const QUrl &url); - ActivityListJob* doRequestActivityList(const QUrl &url); - FolderListJob* doRequestFolderList(const QUrl &url); - MessageListJob* doRequestMessageList(const QUrl &url); - - private: - class Private; - QExplicitlySharedDataPointer d; -}; - -} - -#endif diff --git a/src/aboutdialog/libattica-ocsclient/provider.cpp b/src/aboutdialog/libattica-ocsclient/provider.cpp deleted file mode 100644 --- a/src/aboutdialog/libattica-ocsclient/provider.cpp +++ /dev/null @@ -1,456 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include "provider.h" - -#include -#include -#include -#include - -#include "activitylistjob.h" -#include "categorylistjob.h" -#include "contentjob.h" -#include "contentlistjob.h" -#include "eventjob.h" -#include "eventlistjob.h" -#include "folderlistjob.h" -#include "knowledgebasejob.h" -#include "knowledgebaselistjob.h" -#include "messagelistjob.h" -#include "personjob.h" -#include "personlistjob.h" -#include "postjob.h" -#include "providerinitjob.h" - - -using namespace AmarokAttica; - - -class Provider::Private : public QSharedData { - public: - QUrl m_baseUrl; - QString m_id; - QString m_name; - Private(const Private& other) - : QSharedData(other), m_baseUrl(other.m_baseUrl), m_id(other.m_id), m_name(other.m_name) - { - } - Private(const QString& id, const QUrl &baseUrl, const QString name) - : m_baseUrl(baseUrl), m_id(id), m_name(name) - { - } -}; - - -ProviderInitJob* Provider::byId(const QString& id) -{ - ProviderInitJob* job = new ProviderInitJob(id); - job->start(); - return job; -} - - -Provider::Provider() - : d(new Private(QString(), QUrl(), QString())) -{ -} - -Provider::Provider(const Provider& other) - : d(other.d) -{ -} - -Provider::Provider(const QString& id, const QUrl &baseUrl, const QString& name) - : d(new Private(id, baseUrl, name)) -{ -} - -Provider& Provider::operator=(const AmarokAttica::Provider & other) -{ - d = other.d; - return *this; -} - -Provider::~Provider() -{ -} - - -QString Provider::id() const -{ - return d->m_id; -} - - -QString Provider::name() const -{ - return d->m_name; -} - - -PersonJob* Provider::requestPerson(const QString& id) const -{ - QUrl url = createUrl( "person/data/" + id ); - return doRequestPerson( url ); -} - -PersonJob* Provider::requestPersonSelf() -{ - QUrl url = createUrl( "person/self" ); - return doRequestPerson( url ); -} - -PersonListJob* Provider::requestPersonSearchByName(const QString& name) -{ - QUrl url = createUrl( "person/data"); - QUrlQuery query; - query.addQueryItem("name", name); - url.setQuery(query); - return doRequestPersonList( url ); -} - -PersonListJob* Provider::requestPersonSearchByLocation(qreal latitude, qreal longitude, qreal distance, int page, int pageSize) -{ - QUrl url = createUrl( "person/data" ); - QUrlQuery query; - query.addQueryItem("latitude", QString::number(latitude)); - query.addQueryItem("longitude", QString::number(longitude)); - query.addQueryItem("distance", QString::number(distance)); - query.addQueryItem("page", QString::number(page)); - query.addQueryItem("pagesize", QString::number(pageSize)); - url.setQuery(query); - - qDebug() << "Location-based search:" << latitude << longitude << distance; - qDebug() << "URL:" << url; - return doRequestPersonList( url ); -} - -PersonListJob* Provider::requestFriend(const QString& id, int page, int pageSize) -{ - QUrl url = createUrl( "friend/data/" + id ); - QUrlQuery query; - query.addQueryItem("page", QString::number(page)); - query.addQueryItem("pagesize", QString::number(pageSize)); - url.setQuery(query); - - qDebug() << "URL:" << url; - return doRequestPersonList( url ); -} - -ActivityListJob* Provider::requestActivity() -{ - QUrl url = createUrl( "activity" ); - return doRequestActivityList( url ); -} - -PostJob* Provider::postActivity(const QString& message) -{ - PostJob *job = new PostJob(); - - QUrl url = createUrl( "activity" ); - job->setUrl( url ); - job->setData( "message", message ); - - job->start(); - return job; -} - -PostJob* Provider::postInvitation(const QString& to, const QString& message) -{ - PostJob *job = new PostJob(); - - QUrl url = createUrl( "friend/outbox/" + to ); - job->setUrl( url ); - job->setData( "message", message ); - - job->start(); - return job; -} - -PostJob* Provider::postLocation(qreal latitude, qreal longitude, const QString& city, const QString& country) -{ - PostJob *job = new PostJob(); - - QUrl url = createUrl( "person/self" ); - - job->setUrl( url ); - - job->setData( "latitude", QString("%1").arg(latitude) ); - job->setData( "longitude", QString("%1").arg(longitude) ); - job->setData( "city", city ); - job->setData( "country", country ); - - job->start(); - return job; -} - - -FolderListJob* Provider::requestFolders() -{ - return doRequestFolderList( createUrl( "message" ) ); -} - -MessageListJob* Provider::requestMessages(const QString& folderId) -{ - return doRequestMessageList( createUrl( "message/" + folderId ) ); -} - -PostJob* Provider::postMessage( const Message &message ) -{ - PostJob *job = new PostJob(); - - QUrl url = createUrl( "message/2" ); - job->setUrl( url ); - job->setData( "message", message.body() ); - job->setData( "subject", message.subject() ); - job->setData( "to", message.to() ); - - job->start(); - return job; -} - -CategoryListJob* Provider::requestCategories() -{ - CategoryListJob *job = new CategoryListJob(); - - QUrl url = createUrl( "content/categories" ); - job->setUrl( url ); - - job->start(); - return job; -} - -ContentListJob* Provider::requestContent(const Category::List& categories, const QString& search, SortMode sortMode) -{ - ContentListJob *job = new ContentListJob(); - - QUrl url = createUrl( "content/data" ); - QUrlQuery query; - - QStringList categoryIds; - foreach( const Category &category, categories ) { - categoryIds.append( category.id() ); - } - query.addQueryItem( "categories", categoryIds.join( "x" ) ); - - query.addQueryItem( "search", search ); - QString sortModeString; - switch ( sortMode ) { - case Newest: - sortModeString = "new"; - break; - case Alphabetical: - sortModeString = "alpha"; - break; - case Rating: - sortModeString = "high"; - break; - case Downloads: - sortModeString = "down"; - break; - } - if ( !sortModeString.isEmpty() ) { - query.addQueryItem( "sortmode", sortModeString ); - } - - url.setQuery(query); - - job->setUrl( url ); - - job->start(); - return job; -} - -ContentJob* Provider::requestContent(const QString& id) -{ - ContentJob *job = new ContentJob(); - - QUrl url = createUrl( "content/data/" + id ); - job->setUrl( url ); - - job->start(); - return job; -} - -KnowledgeBaseJob* Provider::requestKnowledgeBase(const QString& id) -{ - KnowledgeBaseJob *job = new KnowledgeBaseJob(); - - QUrl url = createUrl( "knowledgebase/data/" + id ); - job->setUrl( url ); - - job->start(); - return job; -} - -KnowledgeBaseListJob* Provider::requestKnowledgeBase(int content, const QString& search, Provider::SortMode sortMode, int page, int pageSize) -{ - KnowledgeBaseListJob *job = new KnowledgeBaseListJob(); - - QUrl url = createUrl( "knowledgebase/data" ); - QUrlQuery query; - - if (content) { - query.addQueryItem("content", QString::number(content)); - } - - query.addQueryItem( "search", search ); - QString sortModeString; - switch ( sortMode ) { - case Newest: - sortModeString = "new"; - break; - case Alphabetical: - sortModeString = "alpha"; - break; - case Rating: - sortModeString = "high"; - break; - //FIXME: knowledge base doesn't have downloads - case Downloads: - sortModeString = "new"; - break; - } - if ( !sortModeString.isEmpty() ) { - query.addQueryItem( "sortmode", sortModeString ); - } - - query.addQueryItem( "page", QString::number(page) ); - query.addQueryItem( "pagesize", QString::number(pageSize) ); - - url.setQuery(query); - - job->setUrl( url ); - - job->start(); - return job; -} - -EventJob* Provider::requestEvent(const QString& id) -{ - EventJob* job = new EventJob(); - - job->setUrl(createUrl("event/data/" + id)); - - job->start(); - return job; -} - -EventListJob* Provider::requestEvent(const QString& country, const QString& search, const QDate& startAt, Provider::SortMode mode, int page, int pageSize) -{ - EventListJob* job = new EventListJob(); - - QUrl url = createUrl("event/data"); - QUrlQuery query; - - if (!search.isEmpty()) { - query.addQueryItem("search", search); - } - - QString sortModeString; - switch (mode) { - case Newest: - sortModeString = "new"; - break; - case Alphabetical: - sortModeString = "alpha"; - break; - default: - break; - } - if (!sortModeString.isEmpty()) { - query.addQueryItem("sortmode", sortModeString); - } - - if (!country.isEmpty()) { - query.addQueryItem("country", country); - } - - query.addQueryItem("startat", startAt.toString(Qt::ISODate)); - - query.addQueryItem("page", QString::number(page)); - query.addQueryItem("pagesize", QString::number(pageSize)); - - url.setQuery(query); - - job->setUrl(url); - - job->start(); - return job; - -} - -QUrl Provider::createUrl(const QString& path) const -{ - QUrl url(d->m_baseUrl); - url = url.adjusted(QUrl::StripTrailingSlash); - url.setPath(url.path() + '/' + ( path )); - return url; -} - -PersonJob* Provider::doRequestPerson(const QUrl &url) const -{ - PersonJob *job = new PersonJob(); - - job->setUrl( url ); - - job->start(); - return job; -} - -PersonListJob* Provider::doRequestPersonList(const QUrl &url) -{ - PersonListJob *job = new PersonListJob(); - - job->setUrl( url ); - - job->start(); - return job; -} - -ActivityListJob* Provider::doRequestActivityList(const QUrl &url) -{ - ActivityListJob *job = new ActivityListJob(); - - job->setUrl( url ); - - job->start(); - return job; -} - -FolderListJob* Provider::doRequestFolderList(const QUrl &url) -{ - FolderListJob *job = new FolderListJob(); - - job->setUrl( url ); - job->start(); - return job; -} - -MessageListJob* Provider::doRequestMessageList(const QUrl &url) -{ - MessageListJob *job = new MessageListJob(); - - job->setUrl( url ); - job->start(); - return job; -} diff --git a/src/aboutdialog/libattica-ocsclient/providerinitjob.h b/src/aboutdialog/libattica-ocsclient/providerinitjob.h deleted file mode 100644 --- a/src/aboutdialog/libattica-ocsclient/providerinitjob.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2009 Eckhart Wörner - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#ifndef PROVIDERINITJOB_H -#define PROVIDERINITJOB_H - -#include - -#include "atticaclient_export.h" -#include "provider.h" - -namespace AmarokAttica { - -class ATTICA_EXPORT ProviderInitJob : public KJob -{ - Q_OBJECT - - public: - ProviderInitJob(const QString& id, QObject* parent = 0); - - void start(); - - Provider provider() const; - - private Q_SLOTS: - void doWork(); - - private: - const QString m_id; - Provider m_provider; -}; - -} - - -#endif diff --git a/src/aboutdialog/libattica-ocsclient/providerinitjob.cpp b/src/aboutdialog/libattica-ocsclient/providerinitjob.cpp deleted file mode 100644 --- a/src/aboutdialog/libattica-ocsclient/providerinitjob.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2009 Eckhart Wörner - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include "providerinitjob.h" - -#include - -#include - - -using namespace AmarokAttica; - - -ProviderInitJob::ProviderInitJob(const QString& id, QObject* parent) - : KJob(parent), m_id(id) -{ -} - - -void ProviderInitJob::start() -{ - QTimer::singleShot(0, this, &ProviderInitJob::doWork); -} - - -void ProviderInitJob::doWork() -{ - if (m_id == "opendesktop") { - m_provider = Provider(m_id, QUrl("https://api.opendesktop.org/v1/"), "OpenDesktop.org"); - } - emitResult(); -} - - -Provider ProviderInitJob::provider() const -{ - return m_provider; -} - - diff --git a/src/amarok-contextapplet.desktop b/src/amarok-contextapplet.desktop --- a/src/amarok-contextapplet.desktop +++ b/src/amarok-contextapplet.desktop @@ -21,16 +21,16 @@ Comment[fi]=Amarok-liitännäinen Comment[fr]=Module externe pour Amarok Comment[ga]=Breiseán Amarok -Comment[gl]=Extensión de Amarok +Comment[gl]=Complemento de Amarok Comment[he]=תוסף ל־Amarok Comment[hne]=अमाराक बर प्लगइन Comment[hu]=Bővítőmodul az Amarokhoz Comment[id]=Plugin untuk Amarok Comment[is]=Íforrit fyrir Amarok Comment[it]=Estensione per Amarok Comment[ja]=Amarok のためのプラグイン Comment[km]=កម្មវិធី​ជំនួយ​សម្រាប់ Amarok -Comment[ko]=Amarok 플러그인 +Comment[ko]=Amarok용 플러그인 Comment[ku]=Pêvek ji bo Amarok Comment[lt]=Amarok papildinys Comment[lv]=Amarok spraudnis @@ -57,7 +57,6 @@ Comment[uk]=Додаток для Amarok Comment[wa]=Tchôke-divins pos Amarok Comment[x-test]=xxPlugin for Amarokxx -Comment[zh_CN]=Amarok 插件 Comment[zh_TW]=Amarok 的外掛程式 diff --git a/src/amarok-play-audiocd.desktop b/src/amarok-play-audiocd.desktop --- a/src/amarok-play-audiocd.desktop +++ b/src/amarok-play-audiocd.desktop @@ -29,12 +29,12 @@ Name[hne]=अमाराक के साथ आडियो सीडी बजाव Name[hr]=Sviraj zvučni CD s Amarokom Name[hu]=Hang-CD lejátszása az Amarokkal -Name[id]=Mainkan Audio CD dengan Amarok +Name[id]=Putar Audio CD dengan Amarok Name[is]=Spila hljóðdisk með Amarok Name[it]=Riproduci CD audio con Amarok Name[ja]=Amarok でオーディオ CD を再生 Name[km]=ចាក់​ស៊ីឌី​អូឌីយ៉ូ​ជា​មួយ Amarok -Name[ko]=Amarok으로 오디오 CD 재생하기 +Name[ko]=Amarok으로 오디오 CD 재생 Name[ku]=CD ya muzîkê bi Amarok lê bide Name[lt]=Groti audio CD su Amarok Name[lv]=Atskaņot audio CD ar Amarok @@ -63,7 +63,6 @@ Name[uk]=Відтворити аудіо-КД за допомогою Amarok Name[wa]=Djouwer plake lazer odio avou Amarok Name[x-test]=xxPlay Audio CD with Amarokxx -Name[zh_CN]=用 Amarok 播放音频 CD Name[zh_TW]=使用 Amarok 播放音樂 CD Icon=amarok Exec=amarok --cdplay %f diff --git a/src/amarok-plugin.desktop b/src/amarok-plugin.desktop --- a/src/amarok-plugin.desktop +++ b/src/amarok-plugin.desktop @@ -30,7 +30,7 @@ Comment[it]=Estensione per Amarok Comment[ja]=Amarok のためのプラグイン Comment[km]=កម្មវិធី​ជំនួយ​សម្រាប់ Amarok -Comment[ko]=Amarok 플러그인 +Comment[ko]=Amarok용 플러그인 Comment[ku]=Pêvek ji bo Amarok Comment[lt]=Amarok papildinys Comment[lv]=Amarok spraudnis @@ -57,7 +57,6 @@ Comment[uk]=Додаток для Amarok Comment[wa]=Tchôke-divins pos Amarok Comment[x-test]=xxPlugin for Amarokxx -Comment[zh_CN]=Amarok 插件 Comment[zh_TW]=Amarok 的外掛程式 diff --git a/src/amarok_addaspodcast.desktop b/src/amarok_addaspodcast.desktop --- a/src/amarok_addaspodcast.desktop +++ b/src/amarok_addaspodcast.desktop @@ -30,7 +30,7 @@ Name[it]=Aggiungi come podcast in Amarok Name[ja]=ポッドキャストとして Amarok に追加 Name[km]=បន្ថែម​ជា​ផតខាស់​ទៅ Amarok -Name[ko]=Amarok에 팟캐스트로 추가하기 +Name[ko]=Amarok에 팟캐스트로 추가 Name[ku]=Wekî Podcast lê Amarok zêde bike Name[lt]=Įterpti podcast į Amarok grojaraštį Name[lv]=Pievienot Amarok kā podraidi @@ -58,7 +58,6 @@ Name[uk]=Додати в Amarok як радіотрансляцію Name[wa]=Radjouter come Podcast a Amarok Name[x-test]=xxAdd as Podcast to Amarokxx -Name[zh_CN]=作为播客添加到 Amarok Name[zh_TW]=新增為 Podcast 到 Amaork 中 Icon=amarok Exec=qdbus org.kde.amarok /PlaylistBrowser addPodcast %u diff --git a/src/amarok_append.desktop b/src/amarok_append.desktop --- a/src/amarok_append.desktop +++ b/src/amarok_append.desktop @@ -91,12 +91,12 @@ Name[hi]=गीत-सूची के अंत में जोड़ें Name[hne]=गीत-सूची के आखरी मं जोड़व Name[hu]=Hozzáfűzés a lejátszólistához -Name[id]=Lampirkan ke Daftar Main +Name[id]=Lampirkan ke Playlist Name[is]=Bæta við lagalista Name[it]=Aggiungi alla scaletta Name[ja]=プレイリストに追加 Name[km]=បន្ថែម​ទៅ​ខាង​ចុង​បញ្ជី​ចាក់ -Name[ko]=재생 목록에 덧붙이기 +Name[ko]=재생 목록에 추가 Name[ku]=Bixe ser lîsteya lêdanê Name[lt]=Papildyti grojaraštį Name[lv]=Pievienot repertuāram @@ -124,7 +124,6 @@ Name[uk]=Додати до списку композицій Name[wa]=Mete dins l' djivêye a djouwer Name[x-test]=xxAppend to Playlistxx -Name[zh_CN]=追加到播放列表 Name[zh_TW]=添加到清單中 Icon=amarok Exec=amarok -a %U @@ -153,12 +152,12 @@ Name[hi]=अंत में जोड़ें व बजाएँ Name[hne]=आखरी मं जोड़व अउ बजाव Name[hu]=Hozzáfűzés és lejátszás -Name[id]=Lampirkan & Mainkan +Name[id]=Lampirkan & Putarkan Name[is]=Bæta við & spila Name[it]=Aggiungi e riproduci Name[ja]=追加して再生 Name[km]=បន្ថែម​ខាង​ចុង និង​ចាក់ -Name[ko]=덧붙이고 재생하기 +Name[ko]=추가 및 재생 Name[ku]=Bixe & Lê bide Name[lt]=Papildyti ir groti Name[lv]=Pievienot un atskaņot @@ -186,7 +185,6 @@ Name[uk]=Додати і відтворити Name[wa]=Mete dins l' djivêye eyet djouwer Name[x-test]=xxAppend & Playxx -Name[zh_CN]=追加并播放 Name[zh_TW]=添加並播放 Icon=amarok Exec=amarok --append %U --play @@ -216,12 +214,12 @@ Name[hi]=ट्रैक कतार में लगाएं Name[hne]=ट्रैक कतार मं लगाव Name[hu]=Szám betevése a sorba -Name[id]=Antrean Track +Name[id]=Antrean Trek Name[is]=Setja í biðröð Name[it]=Accoda traccia Name[ja]=トラックをキュー Name[km]=តម្រៀប​បទ​ជា​ជួរ -Name[ko]=대기열에 추가하기 +Name[ko]=대기열에 추가 Name[ku]=Rêza Stranan Name[lt]=Pridėti į eilę Name[lv]=Pievienot rindai @@ -249,7 +247,6 @@ Name[uk]=Поставити композицію в чергу Name[wa]=Mete boket el cawêye Name[x-test]=xxQueue Trackxx -Name[zh_CN]=音轨排队 Name[zh_TW]=佇列曲目 Icon=amarok Exec=amarok --queue %U diff --git a/src/amarok_export.h b/src/amarok_export.h --- a/src/amarok_export.h +++ b/src/amarok_export.h @@ -20,7 +20,7 @@ #define AMAROK_EXPORT_H /* needed for Q_DECL_EXPORT and Q_DECL_IMPORT macros */ -#include +#include #ifndef AMAROK_EXPORT # ifdef MAKE_AMAROKLIB_LIB diff --git a/src/amarokurls/AmarokUrl.h b/src/amarokurls/AmarokUrl.h --- a/src/amarokurls/AmarokUrl.h +++ b/src/amarokurls/AmarokUrl.h @@ -29,12 +29,12 @@ { public: AmarokUrl(); - explicit AmarokUrl( const QString & urlString, BookmarkGroupPtr parent = BookmarkGroupPtr() ); - explicit AmarokUrl( const QStringList & resultRow, BookmarkGroupPtr parent = BookmarkGroupPtr() ); + explicit AmarokUrl( const QString & urlString, const BookmarkGroupPtr &parent = BookmarkGroupPtr() ); + explicit AmarokUrl( const QStringList & resultRow, const BookmarkGroupPtr &parent = BookmarkGroupPtr() ); ~AmarokUrl(); - void reparent( BookmarkGroupPtr parent ); + void reparent( const BookmarkGroupPtr &parent ); void initFromString( const QString & urlString ); QString command() const; @@ -46,13 +46,13 @@ void setPath( const QString &path ); /** - * Sets the url argument named @param name to @param value. Overrides any possible + * Sets the url argument named @param name to @param value . Overrides any possible * previous value. */ void setArg( const QString &name, const QString &value ); void setName( const QString &name ); - void setDescription( const QString &description ); + void setDescription( const QString &description ) override; void setCustomValue( const QString &custom ); QString customValue() const; @@ -68,11 +68,11 @@ bool isNull() const; - virtual QString name() const; - virtual QString description() const; - virtual BookmarkGroupPtr parent() const { return m_parent; } - virtual void removeFromDb(); - virtual void rename( const QString &name ); + QString name() const override; + QString description() const override; + BookmarkGroupPtr parent() const override { return m_parent; } + void removeFromDb() override; + void rename( const QString &name ) override; static QString escape( const QString &in ); static QString unescape( const QString &in ); @@ -88,7 +88,7 @@ QString m_description; QString m_name; - //this value is used for storing application specific inoformation that should not be made user visible. + //this value is used for storing application specific information that should not be made user visible. QString m_customValue; }; diff --git a/src/amarokurls/AmarokUrl.cpp b/src/amarokurls/AmarokUrl.cpp --- a/src/amarokurls/AmarokUrl.cpp +++ b/src/amarokurls/AmarokUrl.cpp @@ -30,14 +30,14 @@ , m_parent( 0 ) {} -AmarokUrl::AmarokUrl( const QString & urlString, BookmarkGroupPtr parent ) +AmarokUrl::AmarokUrl( const QString & urlString, const BookmarkGroupPtr &parent ) : m_id( -1 ) , m_parent( parent ) { initFromString( urlString ); } -AmarokUrl::AmarokUrl( const QStringList & resultRow, BookmarkGroupPtr parent ) +AmarokUrl::AmarokUrl( const QStringList & resultRow, const BookmarkGroupPtr &parent ) : m_parent( parent ) { m_id = resultRow[0].toInt(); @@ -56,10 +56,10 @@ { //first, strip amarok:// QString strippedUrlString = urlString; - strippedUrlString = strippedUrlString.replace( "amarok://", "" ); + strippedUrlString = strippedUrlString.replace( QLatin1String("amarok://"), QLatin1String("") ); //separate path from arguments - QStringList parts = strippedUrlString.split( '?' ); + QStringList parts = strippedUrlString.split( QLatin1Char('?') ); QString commandAndPath = parts.at( 0 ); @@ -82,10 +82,10 @@ //get the command - parts = commandAndPath.split( '/' ); + parts = commandAndPath.split( QLatin1Char('/') ); m_command = parts.takeFirst(); - m_path = parts.join( "/" ); + m_path = parts.join( QLatin1Char('/') ); m_path = unescape( m_path ); } @@ -125,7 +125,7 @@ QString AmarokUrl::url() const { QUrl url; - url.setScheme( "amarok" ); + url.setScheme( QStringLiteral("amarok") ); url.setHost( m_command ); url.setPath( '/' + m_path ); // the path must begin by / QUrlQuery query; @@ -152,19 +152,19 @@ { //update existing debug() << "Updating bookmark"; - QString query = "UPDATE bookmarks SET parent_id=%1, name='%2', url='%3', description='%4', custom='%5' WHERE id=%6;"; + QString query = QStringLiteral("UPDATE bookmarks SET parent_id=%1, name='%2', url='%3', description='%4', custom='%5' WHERE id=%6;"); query = query.arg( QString::number( parentId ), sql->escape( m_name ), sql->escape( url() ), sql->escape( m_description ), sql->escape( m_customValue ), QString::number( m_id ) ); StorageManager::instance()->sqlStorage()->query( query ); } else { //insert new debug() << "Creating new bookmark in the db"; - QString query = "INSERT INTO bookmarks ( parent_id, name, url, description, custom ) VALUES ( %1, '%2', '%3', '%4', '%5' );"; + QString query = QStringLiteral("INSERT INTO bookmarks ( parent_id, name, url, description, custom ) VALUES ( %1, '%2', '%3', '%4', '%5' );"); query = query.arg( QString::number( parentId ), sql->escape( m_name ), sql->escape( url() ), sql->escape( m_description ), sql->escape( m_customValue ) ); - m_id = StorageManager::instance()->sqlStorage()->insert( query, NULL ); + m_id = StorageManager::instance()->sqlStorage()->insert( query, nullptr ); } return true; @@ -192,7 +192,7 @@ void AmarokUrl::removeFromDb() { - QString query = "DELETE FROM bookmarks WHERE id=%1"; + QString query = QStringLiteral("DELETE FROM bookmarks WHERE id=%1"); query = query.arg( QString::number( m_id ) ); StorageManager::instance()->sqlStorage()->query( query ); } @@ -204,7 +204,7 @@ saveToDb(); } -void AmarokUrl::reparent( BookmarkGroupPtr parent ) +void AmarokUrl::reparent( const BookmarkGroupPtr &parent ) { m_parent = parent; saveToDb(); diff --git a/src/amarokurls/AmarokUrlGenerator.h b/src/amarokurls/AmarokUrlGenerator.h --- a/src/amarokurls/AmarokUrlGenerator.h +++ b/src/amarokurls/AmarokUrlGenerator.h @@ -24,10 +24,10 @@ { public: - virtual ~AmarokUrlGenerator() {}; + virtual ~AmarokUrlGenerator() {} /** - Get the user visible description of what the createUrl() function will actualy bookmarks. + Get the user visible description of what the createUrl() function will actually bookmarks. */ virtual QString description() = 0; @@ -37,7 +37,7 @@ virtual QIcon icon() = 0; /** - Cretate the default url for this generator. + Create the default url for this generator. */ virtual AmarokUrl createUrl() = 0; }; diff --git a/src/amarokurls/AmarokUrlHandler.h b/src/amarokurls/AmarokUrlHandler.h --- a/src/amarokurls/AmarokUrlHandler.h +++ b/src/amarokurls/AmarokUrlHandler.h @@ -56,12 +56,12 @@ void registerGenerator( AmarokUrlGenerator * generator ); void unRegisterGenerator( AmarokUrlGenerator * generator ); - bool run( AmarokUrl url ); + bool run( const AmarokUrl &url ); BookmarkList urlsByCommand( const QString &command ); QIcon iconForCommand( const QString &command ); - void updateTimecodes( const QString * BookmarkName = 0 ); + void updateTimecodes( const QString * BookmarkName = nullptr ); void paintNewTimecode( const QString &name, int pos ); QList generators() { return m_registeredGenerators; } @@ -74,8 +74,8 @@ public Q_SLOTS: - void bookmarkAlbum( Meta::AlbumPtr album ); - void bookmarkArtist( Meta::ArtistPtr artist ); + void bookmarkAlbum( const Meta::AlbumPtr &album ); + void bookmarkArtist( const Meta::ArtistPtr &artist ); void bookmarkCurrentBrowserView(); void bookmarkCurrentPlaylistView(); diff --git a/src/amarokurls/AmarokUrlHandler.cpp b/src/amarokurls/AmarokUrlHandler.cpp --- a/src/amarokurls/AmarokUrlHandler.cpp +++ b/src/amarokurls/AmarokUrlHandler.cpp @@ -104,7 +104,7 @@ m_registeredGenerators.removeAll( generator ); } -bool AmarokUrlHandler::run( AmarokUrl url ) +bool AmarokUrlHandler::run( const AmarokUrl &url ) { DEBUG_BLOCK @@ -121,13 +121,13 @@ } -void AmarokUrlHandler::bookmarkAlbum( Meta::AlbumPtr album ) //slot +void AmarokUrlHandler::bookmarkAlbum( const Meta::AlbumPtr &album ) //slot { NavigationUrlGenerator::instance()->urlFromAlbum( album ).saveToDb(); BookmarkModel::instance()->reloadFromDb(); } -void AmarokUrlHandler::bookmarkArtist( Meta::ArtistPtr artist ) //slot +void AmarokUrlHandler::bookmarkArtist( const Meta::ArtistPtr &artist ) //slot { NavigationUrlGenerator::instance()->urlFromArtist( artist ).saveToDb(); BookmarkModel::instance()->reloadFromDb(); @@ -137,7 +137,7 @@ { DEBUG_BLOCK - QString query = "SELECT id, parent_id, name, url, description, custom FROM bookmarks where url like 'amarok://%1%' ORDER BY name;"; + QString query = QStringLiteral("SELECT id, parent_id, name, url, description, custom FROM bookmarks where url like 'amarok://%1%' ORDER BY name;"); query = query.arg( command ); QStringList result = StorageManager::instance()->sqlStorage()->query( query ); @@ -157,7 +157,7 @@ AmarokUrl AmarokUrlHandler::createBrowserViewBookmark() { - return NavigationUrlGenerator::instance()->CreateAmarokUrl();; + return NavigationUrlGenerator::instance()->CreateAmarokUrl(); } AmarokUrl @@ -201,18 +201,18 @@ if( m_registeredRunners.keys().contains( command ) ) return m_registeredRunners.value( command )->icon(); - return QIcon::fromTheme( "unknown" ); + return QIcon::fromTheme( QStringLiteral("unknown") ); } void AmarokUrlHandler::updateTimecodes(const QString* BookmarkName) { - emit timecodesUpdated( BookmarkName ); + Q_EMIT timecodesUpdated( BookmarkName ); } void AmarokUrlHandler::paintNewTimecode( const QString &name, int pos ) { - emit timecodeAdded( name, pos ); + Q_EMIT timecodeAdded( name, pos ); } QString diff --git a/src/amarokurls/AmarokUrlRunnerBase.h b/src/amarokurls/AmarokUrlRunnerBase.h --- a/src/amarokurls/AmarokUrlRunnerBase.h +++ b/src/amarokurls/AmarokUrlRunnerBase.h @@ -33,11 +33,11 @@ public: virtual QString command() const = 0; virtual QString prettyCommand() const = 0; - virtual bool run( AmarokUrl url ) = 0; + virtual bool run( const AmarokUrl &url ) = 0; virtual QIcon icon() const = 0; protected: - virtual ~AmarokUrlRunnerBase() {}; + virtual ~AmarokUrlRunnerBase() {} }; #endif diff --git a/src/amarokurls/BookmarkCurrentButton.h b/src/amarokurls/BookmarkCurrentButton.h --- a/src/amarokurls/BookmarkCurrentButton.h +++ b/src/amarokurls/BookmarkCurrentButton.h @@ -23,7 +23,7 @@ { Q_OBJECT public: - BookmarkCurrentButton( QWidget *parent ); + explicit BookmarkCurrentButton( QWidget *parent ); virtual ~BookmarkCurrentButton(); protected Q_SLOTS: diff --git a/src/amarokurls/BookmarkCurrentButton.cpp b/src/amarokurls/BookmarkCurrentButton.cpp --- a/src/amarokurls/BookmarkCurrentButton.cpp +++ b/src/amarokurls/BookmarkCurrentButton.cpp @@ -28,7 +28,7 @@ BookmarkCurrentButton::BookmarkCurrentButton( QWidget *parent ) : QToolButton( parent ) { - setIcon( QIcon::fromTheme( "bookmark-new" ) ); + setIcon( QIcon::fromTheme( QStringLiteral("bookmark-new") ) ); setText( i18n( "New Bookmark" ) ); setToolButtonStyle( Qt::ToolButtonTextBesideIcon ); connect( this, &BookmarkCurrentButton::clicked, this, &BookmarkCurrentButton::showMenu ); diff --git a/src/amarokurls/BookmarkGroup.h b/src/amarokurls/BookmarkGroup.h --- a/src/amarokurls/BookmarkGroup.h +++ b/src/amarokurls/BookmarkGroup.h @@ -41,34 +41,34 @@ class BookmarkGroup : public BookmarkViewItem { public: - BookmarkGroup( const QStringList &dbResultRow, BookmarkGroupPtr parent ); - explicit BookmarkGroup( const QString &name, BookmarkGroupPtr parent = BookmarkGroupPtr() ); + BookmarkGroup( const QStringList &dbResultRow, const BookmarkGroupPtr &parent ); + explicit BookmarkGroup( const QString &name, const BookmarkGroupPtr &parent = BookmarkGroupPtr() ); BookmarkGroup( const QString &name, const QString &customType ); ~BookmarkGroup(); int id() const; - QString name() const; - QString description() const; + QString name() const override; + QString description() const override; - virtual int childCount() const; + int childCount() const override; - virtual BookmarkGroupPtr parent() const { return m_parent; } + BookmarkGroupPtr parent() const override { return m_parent; } - virtual void rename( const QString &name ); - virtual void setDescription( const QString &description ); + void rename( const QString &name ) override; + void setDescription( const QString &description ) override; void save(); BookmarkGroupList childGroups() const; BookmarkList childBookmarks() const; - void reparent( BookmarkGroupPtr parent ); + void reparent( const BookmarkGroupPtr &parent ); void clear(); - void deleteChild( BookmarkViewItemPtr item ); - virtual void removeFromDb(); + void deleteChild( const BookmarkViewItemPtr &item ); + void removeFromDb() override; private: int m_dbId; diff --git a/src/amarokurls/BookmarkGroup.cpp b/src/amarokurls/BookmarkGroup.cpp --- a/src/amarokurls/BookmarkGroup.cpp +++ b/src/amarokurls/BookmarkGroup.cpp @@ -23,7 +23,7 @@ #include -BookmarkGroup::BookmarkGroup( const QStringList & dbResultRow, BookmarkGroupPtr parent ) +BookmarkGroup::BookmarkGroup( const QStringList & dbResultRow, const BookmarkGroupPtr &parent ) : BookmarkViewItem() , m_parent( parent ) , m_customType() @@ -35,7 +35,7 @@ m_description = dbResultRow[3]; } -BookmarkGroup::BookmarkGroup( const QString & name, BookmarkGroupPtr parent ) +BookmarkGroup::BookmarkGroup( const QString & name, const BookmarkGroupPtr &parent ) : BookmarkViewItem() , m_dbId( -1 ) , m_parent( parent ) @@ -59,7 +59,7 @@ debug() << "custom type: " << customType << " named '" << name << "'"; //check if this custom group already exists and if so, just load that data. - QString query = "SELECT id, parent_id, name, description FROM bookmark_groups where custom='%1';"; + QString query = QStringLiteral("SELECT id, parent_id, name, description FROM bookmark_groups where custom='%1';"); query = query.arg( customType ); QStringList result = StorageManager::instance()->sqlStorage()->query( query ); @@ -99,16 +99,16 @@ if ( m_dbId != -1 ) { //update existing - QString query = "UPDATE bookmark_groups SET parent_id=%1, name='%2', description='%3', custom='%4%' WHERE id=%5;"; + QString query = QStringLiteral("UPDATE bookmark_groups SET parent_id=%1, name='%2', description='%3', custom='%4%' WHERE id=%5;"); query = query.arg( QString::number( parentId ), m_name, m_description, m_customType, QString::number( m_dbId ) ); StorageManager::instance()->sqlStorage()->query( query ); } else { //insert new - QString query = "INSERT INTO bookmark_groups ( parent_id, name, description, custom) VALUES ( %1, '%2', '%3', '%4' );"; + QString query = QStringLiteral("INSERT INTO bookmark_groups ( parent_id, name, description, custom) VALUES ( %1, '%2', '%3', '%4' );"); query = query.arg( QString::number( parentId ), m_name, m_description, m_customType ); - m_dbId = StorageManager::instance()->sqlStorage()->insert( query, NULL ); + m_dbId = StorageManager::instance()->sqlStorage()->insert( query, nullptr ); } } @@ -119,7 +119,7 @@ if ( !m_hasFetchedChildGroups ) { - QString query = "SELECT id, parent_id, name, description FROM bookmark_groups where parent_id=%1 ORDER BY name;"; + QString query = QStringLiteral("SELECT id, parent_id, name, description FROM bookmark_groups where parent_id=%1 ORDER BY name;"); query = query.arg( QString::number( m_dbId ) ); QStringList result = StorageManager::instance()->sqlStorage()->query( query ); @@ -145,7 +145,7 @@ //DEBUG_BLOCK //debug() << "my name: " << m_name << " my pointer: " << this; if ( !m_hasFetchedChildPlaylists ) { - QString query = "SELECT id, parent_id, name, url, description, custom FROM bookmarks where parent_id=%1 ORDER BY name;"; + QString query = QStringLiteral("SELECT id, parent_id, name, url, description, custom FROM bookmarks where parent_id=%1 ORDER BY name;"); query = query.arg( QString::number( m_dbId ) ); QStringList result = StorageManager::instance()->sqlStorage()->query( query ); @@ -209,16 +209,14 @@ save(); } -void BookmarkGroup::deleteChild( BookmarkViewItemPtr item ) +void BookmarkGroup::deleteChild( const BookmarkViewItemPtr &item ) { - if ( typeid( * item ) == typeid( BookmarkGroup ) ) + if ( auto group = BookmarkGroupPtr::dynamicCast( item ) ) { - BookmarkGroupPtr group = BookmarkGroupPtr::staticCast( item ); m_childGroups.removeAll( group ); } - else if ( typeid( * item ) == typeid( AmarokUrl ) ) + else if ( auto bookmark = AmarokUrlPtr::dynamicCast( item ) ) { - AmarokUrlPtr bookmark = AmarokUrlPtr::staticCast( item ); m_childBookmarks.removeAll( bookmark ); } } @@ -232,12 +230,12 @@ foreach( AmarokUrlPtr bookmark, m_childBookmarks ) bookmark->removeFromDb(); - QString query = QString( "DELETE FROM bookmark_groups where id=%1;").arg( QString::number( m_dbId ) ); + QString query = QStringLiteral( "DELETE FROM bookmark_groups where id=%1;").arg( QString::number( m_dbId ) ); debug() << "query: " << query; QStringList result = StorageManager::instance()->sqlStorage()->query( query ); } -void BookmarkGroup::reparent( BookmarkGroupPtr parent ) +void BookmarkGroup::reparent( const BookmarkGroupPtr &parent ) { m_parent = parent; save(); diff --git a/src/amarokurls/BookmarkManager.h b/src/amarokurls/BookmarkManager.h --- a/src/amarokurls/BookmarkManager.h +++ b/src/amarokurls/BookmarkManager.h @@ -28,11 +28,11 @@ static BookmarkManager * instance(); ~BookmarkManager(); - static void showOnce( QWidget* parent = 0 ); + static void showOnce( QWidget* parent = nullptr ); private: - BookmarkManager( QWidget* parent = 0 ); + explicit BookmarkManager( QWidget* parent = nullptr ); static BookmarkManager *s_instance; BookmarkManagerWidget * m_widget; diff --git a/src/amarokurls/BookmarkManager.cpp b/src/amarokurls/BookmarkManager.cpp --- a/src/amarokurls/BookmarkManager.cpp +++ b/src/amarokurls/BookmarkManager.cpp @@ -25,35 +25,35 @@ #include #include -BookmarkManager * BookmarkManager::s_instance = 0; +BookmarkManager * BookmarkManager::s_instance = nullptr; BookmarkManager::BookmarkManager( QWidget* parent ) : QDialog( parent ) { // Sets caption and icon correctly (needed e.g. for GNOME) //kapp->setTopWidget( this ); setWindowTitle( i18n("Bookmark Manager") ); setAttribute( Qt::WA_DeleteOnClose ); - setObjectName( "BookmarkManager" ); + setObjectName( QStringLiteral("BookmarkManager") ); QHBoxLayout *layout = new QHBoxLayout( this ); m_widget = new BookmarkManagerWidget( this ); layout->addWidget( m_widget ); layout->setContentsMargins( 0, 0, 0, 0 ); - const QSize winSize = Amarok::config( "Bookmark Manager" ).readEntry( "Window Size", QSize( 600, 400 ) ); + const QSize winSize = Amarok::config( QStringLiteral("Bookmark Manager") ).readEntry( "Window Size", QSize( 600, 400 ) ); resize( winSize ); } BookmarkManager::~BookmarkManager() { - Amarok::config( "Bookmark Manager" ).writeEntry( "Window Size", size() ); - s_instance = 0; + Amarok::config( QStringLiteral("Bookmark Manager") ).writeEntry( "Window Size", size() ); + s_instance = nullptr; } void BookmarkManager::showOnce( QWidget* parent ) { - if( s_instance == 0 ) + if( s_instance == nullptr ) s_instance = new BookmarkManager( parent ); s_instance->activateWindow(); diff --git a/src/amarokurls/BookmarkManagerWidget.h b/src/amarokurls/BookmarkManagerWidget.h --- a/src/amarokurls/BookmarkManagerWidget.h +++ b/src/amarokurls/BookmarkManagerWidget.h @@ -37,7 +37,7 @@ { Q_OBJECT public: - BookmarkManagerWidget( QWidget *parent = Q_NULLPTR ); + explicit BookmarkManagerWidget( QWidget *parent = nullptr ); ~BookmarkManagerWidget(); BookmarkTreeView * treeView(); diff --git a/src/amarokurls/BookmarkManagerWidget.cpp b/src/amarokurls/BookmarkManagerWidget.cpp --- a/src/amarokurls/BookmarkManagerWidget.cpp +++ b/src/amarokurls/BookmarkManagerWidget.cpp @@ -41,7 +41,7 @@ m_toolBar = new QToolBar( topLayout ); m_toolBar->setToolButtonStyle( Qt::ToolButtonTextBesideIcon ); - QAction * addGroupAction = new QAction( QIcon::fromTheme("media-track-add-amarok" ), i18n( "Add Group" ), this ); + QAction * addGroupAction = new QAction( QIcon::fromTheme(QStringLiteral("media-track-add-amarok") ), i18n( "Add Group" ), this ); m_toolBar->addAction( addGroupAction ); connect( addGroupAction, &QAction::triggered, BookmarkModel::instance(), &BookmarkModel::createNewGroup ); diff --git a/src/amarokurls/BookmarkMetaActions.h b/src/amarokurls/BookmarkMetaActions.h --- a/src/amarokurls/BookmarkMetaActions.h +++ b/src/amarokurls/BookmarkMetaActions.h @@ -28,7 +28,7 @@ Q_OBJECT public: - BookmarkAlbumAction( QObject *parent, Meta::AlbumPtr album ); + BookmarkAlbumAction( QObject *parent, const Meta::AlbumPtr &album ); private Q_SLOTS: void slotTriggered(); @@ -43,7 +43,7 @@ Q_OBJECT public: - BookmarkArtistAction( QObject *parent, Meta::ArtistPtr artist ); + BookmarkArtistAction( QObject *parent, const Meta::ArtistPtr &artist ); private Q_SLOTS: void slotTriggered(); diff --git a/src/amarokurls/BookmarkMetaActions.cpp b/src/amarokurls/BookmarkMetaActions.cpp --- a/src/amarokurls/BookmarkMetaActions.cpp +++ b/src/amarokurls/BookmarkMetaActions.cpp @@ -27,12 +27,12 @@ #include #include -BookmarkAlbumAction::BookmarkAlbumAction( QObject *parent, Meta::AlbumPtr album ) +BookmarkAlbumAction::BookmarkAlbumAction( QObject *parent, const Meta::AlbumPtr &album ) : QAction( i18n( "Bookmark this Album" ), parent ) , m_album( album ) { connect( this, &BookmarkAlbumAction::triggered, this, &BookmarkAlbumAction::slotTriggered ); - setIcon( QIcon::fromTheme("bookmark-new") ); + setIcon( QIcon::fromTheme(QStringLiteral("bookmark-new")) ); setProperty( "popupdropper_svg_id", "lastfm" ); } @@ -43,12 +43,12 @@ } -BookmarkArtistAction::BookmarkArtistAction( QObject *parent, Meta::ArtistPtr artist ) +BookmarkArtistAction::BookmarkArtistAction( QObject *parent, const Meta::ArtistPtr &artist ) : QAction( i18n( "Bookmark this Artist" ), parent ) , m_artist( artist ) { connect( this, &BookmarkArtistAction::triggered, this, &BookmarkArtistAction::slotTriggered ); - setIcon( QIcon::fromTheme("bookmark-new") ); + setIcon( QIcon::fromTheme(QStringLiteral("bookmark-new")) ); setProperty( "popupdropper_svg_id", "lastfm" ); } @@ -62,7 +62,7 @@ : QAction( i18n( "Add Position Marker" ), parent ) { connect( this, &BookmarkCurrentTrackPositionAction::triggered, this, &BookmarkCurrentTrackPositionAction::slotTriggered ); - setIcon( QIcon::fromTheme("flag-amarok") ); + setIcon( QIcon::fromTheme(QStringLiteral("flag-amarok")) ); } void diff --git a/src/amarokurls/BookmarkModel.h b/src/amarokurls/BookmarkModel.h --- a/src/amarokurls/BookmarkModel.h +++ b/src/amarokurls/BookmarkModel.h @@ -57,27 +57,27 @@ static BookmarkModel * instance(); - ~BookmarkModel(); - - virtual QVariant data( const QModelIndex &index, int role ) const; - virtual Qt::ItemFlags flags( const QModelIndex &index ) const; - virtual QVariant headerData( int section, Qt::Orientation orientation, - int role = Qt::DisplayRole ) const; - virtual QModelIndex index( int row, int column, - const QModelIndex &parent = QModelIndex() ) const; - virtual QModelIndex parent( const QModelIndex &index ) const; - virtual int rowCount( const QModelIndex &parent = QModelIndex() ) const; - virtual int columnCount( const QModelIndex &parent = QModelIndex() ) const; - virtual bool setData( const QModelIndex &index, const QVariant &value, int role = Qt::EditRole ); - - virtual Qt::DropActions supportedDropActions() const + ~BookmarkModel() override; + + QVariant data( const QModelIndex &index, int role ) const override; + Qt::ItemFlags flags( const QModelIndex &index ) const override; + QVariant headerData( int section, Qt::Orientation orientation, + int role = Qt::DisplayRole ) const override; + QModelIndex index( int row, int column, + const QModelIndex &parent = QModelIndex() ) const override; + QModelIndex parent( const QModelIndex &index ) const override; + int rowCount( const QModelIndex &parent = QModelIndex() ) const override; + int columnCount( const QModelIndex &parent = QModelIndex() ) const override; + bool setData( const QModelIndex &index, const QVariant &value, int role = Qt::EditRole ) override; + + Qt::DropActions supportedDropActions() const override { return Qt::MoveAction; } - virtual QStringList mimeTypes() const; - QMimeData* mimeData( const QModelIndexList &indexes ) const; - bool dropMimeData( const QMimeData * data, Qt::DropAction action, int row, int column, const QModelIndex &parent ); + QStringList mimeTypes() const override; + QMimeData* mimeData( const QModelIndexList &indexes ) const override; + bool dropMimeData( const QMimeData * data, Qt::DropAction action, int row, int column, const QModelIndex &parent ) override; void reloadFromDb(); void editBookmark( int id ); @@ -104,8 +104,8 @@ void renameBookmark( const QString &oldName , const QString &newName ); /** - * Sets the bookmark's (whose name is @param name) url argument named @param key - * to @param value. Overrides any possible previous value. + * Sets the bookmark's (whose name is @param name ) url argument named @param key + * to @param value . Overrides any possible previous value. */ void setBookmarkArg(const QString &name, const QString &key, const QString &value); diff --git a/src/amarokurls/BookmarkModel.cpp b/src/amarokurls/BookmarkModel.cpp --- a/src/amarokurls/BookmarkModel.cpp +++ b/src/amarokurls/BookmarkModel.cpp @@ -33,13 +33,13 @@ #include static const int BOOKMARK_DB_VERSION = 4; -static const QString key("AMAROK_BOOKMARKS"); +static const QString key(QStringLiteral("AMAROK_BOOKMARKS")); -BookmarkModel * BookmarkModel::s_instance = 0; +BookmarkModel * BookmarkModel::s_instance = nullptr; BookmarkModel * BookmarkModel::instance() { - if ( s_instance == 0 ) + if ( s_instance == nullptr ) s_instance = new BookmarkModel(); return s_instance; @@ -51,7 +51,7 @@ { checkTables(); - m_root = BookmarkGroupPtr( new BookmarkGroup( "root", BookmarkGroupPtr() ) ); + m_root = BookmarkGroupPtr( new BookmarkGroup( QStringLiteral("root"), BookmarkGroupPtr() ) ); } @@ -108,13 +108,10 @@ { if( index.column() == Name ) { - if ( typeid( * item ) == typeid( BookmarkGroup ) ) - return QVariant( QIcon::fromTheme( "folder-bookmark" ) ); - else if ( typeid( * item ) == typeid( AmarokUrl ) ) - { - AmarokUrl * url = static_cast( item.data() ); + if ( BookmarkGroupPtr::dynamicCast( item ) ) + return QVariant( QIcon::fromTheme( QStringLiteral("folder-bookmark") ) ); + else if ( auto url = AmarokUrlPtr::dynamicCast( item ) ) return The::amarokUrlHandler()->iconForCommand( url->command() ); - } } } @@ -236,7 +233,7 @@ return Qt::ItemIsEnabled | Qt::ItemIsDropEnabled; BookmarkViewItemPtr item = BookmarkViewItemPtr::staticCast( m_viewItems.value( index.internalId() ) ); - if ( typeid( * item ) == typeid( BookmarkGroup ) ) + if ( BookmarkGroupPtr::dynamicCast( item ) ) { if ( index.column() != Command ) return Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDropEnabled | Qt::ItemIsDragEnabled; @@ -282,7 +279,7 @@ { case Name: item->rename( value.toString() ); - emit dataChanged( index, index ); + Q_EMIT dataChanged( index, index ); break; case Url: { @@ -293,7 +290,7 @@ url->initFromString( value.toString() ); url->saveToDb(); - emit dataChanged( index, index ); + Q_EMIT dataChanged( index, index ); } break; } @@ -305,7 +302,7 @@ if ( url ) { url->saveToDb(); - emit dataChanged( index, index ); + Q_EMIT dataChanged( index, index ); } break; @@ -338,16 +335,10 @@ BookmarkViewItemPtr item = m_viewItems.value( index.internalId() ); - if ( typeid( * item ) == typeid( BookmarkGroup ) ) { - BookmarkGroupPtr playlistGroup = BookmarkGroupPtr::staticCast( item ); - groups << playlistGroup; - } - else - { - AmarokUrlPtr bookmark = AmarokUrlPtr::dynamicCast( item ); - if( bookmark ) - bookmarks << bookmark; - } + if ( auto group = BookmarkGroupPtr::dynamicCast( item ) ) + groups << group; + else if( auto bookmark = AmarokUrlPtr::dynamicCast( item ) ) + bookmarks << bookmark; } debug() << "adding " << groups.count() << " groups and " << bookmarks.count() << " bookmarks"; @@ -454,8 +445,8 @@ if( !sqlStorage ) return; - sqlStorage->query( "DROP TABLE IF EXISTS bookmark_groups;" ); - sqlStorage->query( "DROP TABLE IF EXISTS bookmarks;" ); + sqlStorage->query( QStringLiteral("DROP TABLE IF EXISTS bookmark_groups;") ); + sqlStorage->query( QStringLiteral("DROP TABLE IF EXISTS bookmarks;") ); } @@ -468,10 +459,10 @@ if( !sqlStorage ) return; - QStringList values = sqlStorage->query( QString("SELECT version FROM admin WHERE component = '%1';").arg(sqlStorage->escape( key ) ) ); + QStringList values = sqlStorage->query( QStringLiteral("SELECT version FROM admin WHERE component = '%1';").arg(sqlStorage->escape( key ) ) ); //also check if the db version is correct but the table is simply missing... can happen due to a bug in 2.2.0 beta1 and beta2 - QStringList values2 = sqlStorage->query( "show tables like 'bookmarks';"); + QStringList values2 = sqlStorage->query( QStringLiteral("show tables like 'bookmarks';")); if( values.isEmpty() || values2.isEmpty() ) { @@ -507,7 +498,7 @@ foreach ( AmarokUrlPtr bookmark, m_root->childBookmarks() ) { row++; if ( bookmark->id() == id ) { - emit editIndex( createIndex( row , 0, BookmarkViewItemPtr::staticCast( bookmark ) ) ); + Q_EMIT editIndex( createIndex( row , 0, BookmarkViewItemPtr::staticCast( bookmark ) ) ); } } } @@ -529,7 +520,7 @@ if ( childGroup->id() == id ) { debug() << "emitting edit for " << childGroup->name() << " id " << childGroup->id() << " in row " << row; - emit editIndex( createIndex( row , 0, BookmarkViewItemPtr::staticCast( childGroup ) ) ); + Q_EMIT editIndex( createIndex( row , 0, BookmarkViewItemPtr::staticCast( childGroup ) ) ); } row++; } @@ -556,7 +547,7 @@ if ( childBookmark->id() == id ) { debug() << "emitting edit for " << childBookmark->name() << " id " << childBookmark->id() << " in row " << row; - emit editIndex( createIndex( row , 0, BookmarkViewItemPtr::staticCast( childBookmark ) ) ); + Q_EMIT editIndex( createIndex( row , 0, BookmarkViewItemPtr::staticCast( childBookmark ) ) ); } row++; } diff --git a/src/amarokurls/BookmarkTreeView.h b/src/amarokurls/BookmarkTreeView.h --- a/src/amarokurls/BookmarkTreeView.h +++ b/src/amarokurls/BookmarkTreeView.h @@ -27,7 +27,6 @@ class QMenu; -class PopupDropper; class QAction; class QAction; @@ -37,21 +36,21 @@ Q_OBJECT public: - BookmarkTreeView( QWidget *parent = 0 ); - ~BookmarkTreeView(); + explicit BookmarkTreeView( QWidget *parent = nullptr ); + ~BookmarkTreeView() override; void setNewGroupAction( QAction * action ); QMenu* contextMenu( const QPoint& point ); void setProxy( QSortFilterProxyModel *proxy ); void slotEdit( const QModelIndex &index ); protected: - void keyPressEvent( QKeyEvent *event ); - void mouseDoubleClickEvent( QMouseEvent *event ); - void contextMenuEvent( QContextMenuEvent *event ); - void resizeEvent( QResizeEvent *event ); - bool viewportEvent( QEvent *event ); + void keyPressEvent( QKeyEvent *event ) override; + void mouseDoubleClickEvent( QMouseEvent *event ) override; + void contextMenuEvent( QContextMenuEvent *event ) override; + void resizeEvent( QResizeEvent *event ) override; + bool viewportEvent( QEvent *event ) override; protected Q_SLOTS: void slotLoad(); @@ -65,15 +64,15 @@ void slotSectionResized( int logicalIndex, int oldSize, int newSize ); void slotSectionCountChanged( int oldCount, int newCount ); - void selectionChanged ( const QItemSelection & selected, const QItemSelection & deselected ); + void selectionChanged ( const QItemSelection & selected, const QItemSelection & deselected ) override; Q_SIGNALS: void bookmarkSelected( AmarokUrl bookmark ); void showMenu( QMenu*, const QPointF& ); private: QSet selectedItems() const; - QList createCommonActions( QModelIndexList indices ); + QList createCommonActions( const QModelIndexList &indices ); QAction *m_loadAction; QAction *m_deleteAction; diff --git a/src/amarokurls/BookmarkTreeView.cpp b/src/amarokurls/BookmarkTreeView.cpp --- a/src/amarokurls/BookmarkTreeView.cpp +++ b/src/amarokurls/BookmarkTreeView.cpp @@ -73,10 +73,8 @@ { BookmarkViewItemPtr item = BookmarkModel::instance()->data( index, 0xf00d ).value(); - if ( typeid( *item ) == typeid( AmarokUrl ) ) { - AmarokUrl * bookmark = static_cast< AmarokUrl* >( item.data() ); + if ( auto bookmark = AmarokUrlPtr::dynamicCast( item ) ) bookmark->run(); - } } } @@ -98,7 +96,7 @@ } QList -BookmarkTreeView::createCommonActions( QModelIndexList indices ) +BookmarkTreeView::createCommonActions( const QModelIndexList &indices ) { DEBUG_BLOCK @@ -108,20 +106,20 @@ QList< QAction * > actions; if ( m_loadAction == 0 ) { - m_loadAction = new QAction( QIcon::fromTheme( "folder-open" ), i18nc( "Load the view represented by this bookmark", "&Load" ), this ); + m_loadAction = new QAction( QIcon::fromTheme( QStringLiteral("folder-open") ), i18nc( "Load the view represented by this bookmark", "&Load" ), this ); connect( m_loadAction, &QAction::triggered, this, &BookmarkTreeView::slotLoad ); } if ( m_deleteAction == 0 ) { - m_deleteAction = new QAction( QIcon::fromTheme( "media-track-remove-amarok" ), i18n( "&Delete" ), this ); + m_deleteAction = new QAction( QIcon::fromTheme( QStringLiteral("media-track-remove-amarok") ), i18n( "&Delete" ), this ); connect( m_deleteAction, &QAction::triggered, this, &BookmarkTreeView::slotDelete ); } if ( m_createTimecodeTrackAction == 0 ) { debug() << "creating m_createTimecodeTrackAction"; - m_createTimecodeTrackAction = new QAction( QIcon::fromTheme( "media-track-edit-amarok" ), i18n( "&Create timecode track" ), this ); + m_createTimecodeTrackAction = new QAction( QIcon::fromTheme( QStringLiteral("media-track-edit-amarok") ), i18n( "&Create timecode track" ), this ); connect( m_createTimecodeTrackAction, &QAction::triggered, this, &BookmarkTreeView::slotCreateTimecodeTrack ); } @@ -144,11 +142,8 @@ DEBUG_BLOCK foreach( BookmarkViewItemPtr item, selectedItems() ) { - if( typeid( * item ) == typeid( AmarokUrl ) ) - { - AmarokUrlPtr bookmark = AmarokUrlPtr::staticCast( item ); + if( auto bookmark = AmarokUrlPtr::dynamicCast( item ) ) bookmark->run(); - } } } @@ -179,19 +174,21 @@ { DEBUG_BLOCK - QModelIndexList indices = selectionModel()->selectedIndexes(); + const QModelIndexList indices = selectionModel()->selectedIndexes(); QMenu* menu = new QMenu( this ); + const QList actions = createCommonActions( indices ); - QList actions = createCommonActions( indices ); - - foreach( QAction * action, actions ) + for ( QAction * action : actions ) menu->addAction( action ); - if( indices.count() == 0 ) + if( indices.isEmpty() && m_addGroupAction) menu->addAction( m_addGroupAction ); - menu->exec( event->globalPos() ); + if (!menu->isEmpty()) { + menu->exec( event->globalPos() ); + } + delete menu; } void BookmarkTreeView::resizeEvent( QResizeEvent *event ) @@ -282,10 +279,10 @@ { BookmarkViewItemPtr item = BookmarkModel::instance()->data( sourceIndex, 0xf00d ).value(); - if ( typeid( * item ) == typeid( AmarokUrl ) ) { + if ( auto bookmark = AmarokUrlPtr::dynamicCast( item ) ) + { debug() << "a url was selected..."; - AmarokUrl bookmark = *static_cast< AmarokUrl* >( item.data() ); - emit( bookmarkSelected( bookmark ) ); + Q_EMIT( bookmarkSelected( *bookmark ) ); } } } @@ -295,7 +292,7 @@ QMenu* BookmarkTreeView::contextMenu( const QPoint& point ) { DEBUG_BLOCK - QMenu* menu = new QMenu( 0 ); + QMenu* menu = new QMenu( nullptr ); debug() << "getting menu for point:" << point; QModelIndex index = m_proxyModel->mapToSource( indexAt( point ) ); @@ -311,7 +308,7 @@ foreach( QAction * action, actions ) menu->addAction( action ); - if( indices.count() == 0 ) + if( indices.isEmpty() ) menu->addAction( m_addGroupAction ); } @@ -331,14 +328,14 @@ if ( url1 == 0 ) return; - if ( url1->command() != "play" ) + if ( url1->command() != QLatin1String("play") ) return; const AmarokUrl * url2 = dynamic_cast( list.at( 1 ).data() ); if ( url2 == 0 ) return; - if ( url2->command() != "play" ) + if ( url2->command() != QLatin1String("play") ) return; if ( url1->path() != url2->path() ) @@ -349,14 +346,14 @@ qreal pos1 = 0; qreal pos2 = 0; - if ( url1->args().keys().contains( "pos" ) ) + if ( url1->args().keys().contains( QStringLiteral("pos") ) ) { - pos1 = url1->args().value( "pos" ).toDouble(); + pos1 = url1->args().value( QStringLiteral("pos") ).toDouble(); } - if ( url2->args().keys().contains( "pos" ) ) + if ( url2->args().keys().contains( QStringLiteral("pos") ) ) { - pos2 = url2->args().value( "pos" ).toDouble(); + pos2 = url2->args().value( QStringLiteral("pos") ).toDouble(); } if ( pos1 == pos2 ) diff --git a/src/amarokurls/ContextUrlGenerator.h b/src/amarokurls/ContextUrlGenerator.h --- a/src/amarokurls/ContextUrlGenerator.h +++ b/src/amarokurls/ContextUrlGenerator.h @@ -30,13 +30,13 @@ AmarokUrl createContextBookmark(); - QString description(); - QIcon icon(); - AmarokUrl createUrl(); + QString description() override; + QIcon icon() override; + AmarokUrl createUrl() override; private: ContextUrlGenerator(); - virtual ~ContextUrlGenerator(); + ~ContextUrlGenerator() override; static ContextUrlGenerator * s_instance; diff --git a/src/amarokurls/ContextUrlGenerator.cpp b/src/amarokurls/ContextUrlGenerator.cpp --- a/src/amarokurls/ContextUrlGenerator.cpp +++ b/src/amarokurls/ContextUrlGenerator.cpp @@ -23,11 +23,11 @@ #include -ContextUrlGenerator * ContextUrlGenerator::s_instance = 0; +ContextUrlGenerator * ContextUrlGenerator::s_instance = nullptr; ContextUrlGenerator * ContextUrlGenerator::instance() { - if( s_instance == 0 ) + if( s_instance == nullptr ) s_instance = new ContextUrlGenerator(); return s_instance; @@ -49,10 +49,10 @@ QStringList appletNames = Context::ContextView::self()->currentAppletNames(); AmarokUrl url; - url.setCommand( "context" ); - url.setArg( "applets", pluginNames.join( "," ) ); + url.setCommand( QStringLiteral("context") ); + url.setArg( QStringLiteral("applets"), pluginNames.join( QStringLiteral(",") ) ); - url.setName( i18n( "Context: %1", appletNames.join( "," ) ) ); + url.setName( i18n( "Context: %1", appletNames.join( QStringLiteral(",") ) ) ); return url; } @@ -65,7 +65,7 @@ QIcon ContextUrlGenerator::icon() { - return QIcon::fromTheme( "x-media-podcast-amarok" ); + return QIcon::fromTheme( QStringLiteral("x-media-podcast-amarok") ); } AmarokUrl diff --git a/src/amarokurls/ContextUrlRunner.h b/src/amarokurls/ContextUrlRunner.h --- a/src/amarokurls/ContextUrlRunner.h +++ b/src/amarokurls/ContextUrlRunner.h @@ -30,12 +30,12 @@ { public: ContextUrlRunner(); - ~ContextUrlRunner(); + ~ContextUrlRunner() override; - virtual QIcon icon() const; - virtual bool run(AmarokUrl url); - virtual QString command() const; - virtual QString prettyCommand() const; + QIcon icon() const override; + bool run(const AmarokUrl &url) override; + QString command() const override; + QString prettyCommand() const override; }; #endif // CONTEXTURLRUNNER_H diff --git a/src/amarokurls/ContextUrlRunner.cpp b/src/amarokurls/ContextUrlRunner.cpp --- a/src/amarokurls/ContextUrlRunner.cpp +++ b/src/amarokurls/ContextUrlRunner.cpp @@ -33,10 +33,10 @@ QIcon ContextUrlRunner::icon() const { - return QIcon::fromTheme( "x-media-podcast-amarok" ); + return QIcon::fromTheme( QStringLiteral("x-media-podcast-amarok") ); } -bool ContextUrlRunner::run( AmarokUrl url ) +bool ContextUrlRunner::run( const AmarokUrl &url ) { DEBUG_BLOCK @@ -47,9 +47,9 @@ return false; - QString appletsString = url.args().value( "applets" ); + QString appletsString = url.args().value( QStringLiteral("applets") ); debug() << "applet string: " << appletsString; - QStringList appletList = appletsString.split( ',' ); + QStringList appletList = appletsString.split( QLatin1Char(',') ); auto model = Context::ContextView::self()->appletModel(); if( model ) { @@ -66,7 +66,7 @@ QString ContextUrlRunner::command() const { - return "context"; + return QStringLiteral("context"); } QString ContextUrlRunner::prettyCommand() const diff --git a/src/amarokurls/NavigationUrlGenerator.h b/src/amarokurls/NavigationUrlGenerator.h --- a/src/amarokurls/NavigationUrlGenerator.h +++ b/src/amarokurls/NavigationUrlGenerator.h @@ -39,13 +39,13 @@ AmarokUrl urlFromAlbum( Meta::AlbumPtr album ); AmarokUrl urlFromArtist( Meta::ArtistPtr artist ); - QString description(); - QIcon icon(); - AmarokUrl createUrl(); + QString description() override; + QIcon icon() override; + AmarokUrl createUrl() override; private: NavigationUrlGenerator(); - virtual ~NavigationUrlGenerator(); + ~NavigationUrlGenerator() override; static NavigationUrlGenerator * s_instance; diff --git a/src/amarokurls/NavigationUrlGenerator.cpp b/src/amarokurls/NavigationUrlGenerator.cpp --- a/src/amarokurls/NavigationUrlGenerator.cpp +++ b/src/amarokurls/NavigationUrlGenerator.cpp @@ -31,11 +31,11 @@ #include "core-impl/collections/db/sql/SqlMeta.h" #include "playlistmanager/PlaylistManager.h" -NavigationUrlGenerator * NavigationUrlGenerator::s_instance = 0; +NavigationUrlGenerator * NavigationUrlGenerator::s_instance = nullptr; NavigationUrlGenerator * NavigationUrlGenerator::instance() { - if( s_instance == 0 ) + if( s_instance == nullptr ) s_instance = new NavigationUrlGenerator(); return s_instance; @@ -55,47 +55,47 @@ DEBUG_BLOCK AmarokUrl url; - url.setCommand( "navigate" ); + url.setCommand( QStringLiteral("navigate") ); //get the path QString path = The::mainWindow()->browserDock()->list()->path(); - QStringList pathParts = path.split( '/' ); + QStringList pathParts = path.split( QLatin1Char('/') ); //we don't use the "Home" part in navigation urls - if ( pathParts.at( 0 ) == "root list" ) + if ( pathParts.at( 0 ) == QLatin1String("root list") ) pathParts.removeFirst(); - url.setPath( pathParts.join( "/" ) ); + url.setPath( pathParts.join( QLatin1Char('/') ) ); QString filter = The::mainWindow()->browserDock()->list()->activeCategoryRecursive()->filter(); if ( !filter.isEmpty() ) - url.setArg( "filter", filter ); + url.setArg( QStringLiteral("filter"), filter ); QList levels = The::mainWindow()->browserDock()->list()->activeCategoryRecursive()->levels(); QString sortMode; foreach( CategoryId::CatMenuId level, levels ) { switch( level ) { case CategoryId::Genre: - sortMode += "genre-"; + sortMode += QLatin1String("genre-"); break; case CategoryId::Artist: - sortMode += "artist-"; + sortMode += QLatin1String("artist-"); break; case CategoryId::Album: - sortMode += "album-"; + sortMode += QLatin1String("album-"); break; case CategoryId::AlbumArtist: - sortMode += "albumartist-"; + sortMode += QLatin1String("albumartist-"); break; case CategoryId::Composer: - sortMode += "composer-"; + sortMode += QLatin1String("composer-"); break; case CategoryId::Year: - sortMode += "year-"; + sortMode += QLatin1String("year-"); break; default: break; @@ -107,39 +107,39 @@ sortMode = sortMode.left( sortMode.size() - 1 ); if ( !sortMode.isEmpty() ) - url.setArg( "levels", sortMode ); + url.setArg( QStringLiteral("levels"), sortMode ); //if in the local collection view, also store "show covers" and "show years" - if( url.path().endsWith( "collections", Qt::CaseInsensitive ) ) + if( url.path().endsWith( QLatin1String("collections"), Qt::CaseInsensitive ) ) { debug() << "bookmarking in local collection"; if( AmarokConfig::showAlbumArt() ) - url.setArg( "show_cover", "true" ); + url.setArg( QStringLiteral("show_cover"), QStringLiteral("true") ); else - url.setArg( "show_cover", "false" ); + url.setArg( QStringLiteral("show_cover"), QStringLiteral("false") ); if( AmarokConfig::showYears() ) - url.setArg( "show_years", "true" ); + url.setArg( QStringLiteral("show_years"), QStringLiteral("true") ); else - url.setArg( "show_years", "false" ); + url.setArg( QStringLiteral("show_years"), QStringLiteral("false") ); } //come up with a default name for this url.. QString name = The::mainWindow()->browserDock()->list()->activeCategoryRecursive()->prettyName(); //if in the file browser, also store the file path - if( url.path().endsWith( "files", Qt::CaseInsensitive ) ) + if( url.path().endsWith( QLatin1String("files"), Qt::CaseInsensitive ) ) { //Give a proper name since it will return "/" as that is what is used in the breadcrumb. name = i18n( "Files" ); FileBrowser * fileBrowser = dynamic_cast( The::mainWindow()->browserDock()->list()->activeCategory() ); if( fileBrowser ) { - url.setArg( "path", fileBrowser->currentDir() ); + url.setArg( QStringLiteral("path"), fileBrowser->currentDir() ); name = i18n( "Files (%1)", fileBrowser->currentDir() ); } } @@ -161,7 +161,7 @@ QString albumName = album->prettyName(); - url.setCommand( "navigate" ); + url.setCommand( QStringLiteral("navigate") ); QString path = btc->browserName(); if ( !btc->collectionName().isEmpty() ) @@ -174,7 +174,7 @@ } else { - url.setArg( "levels", "album" ); + url.setArg( QStringLiteral("levels"), QStringLiteral("album") ); QString artistName; if ( album->albumArtist() ) @@ -185,7 +185,7 @@ filter += ( " AND artist:\"" + artistName + "\"" ); } - url.setArg( "filter", filter ); + url.setArg( QStringLiteral("filter"), filter ); if ( !btc->collectionName().isEmpty() ) url.setName( i18n( "Album \"%1\" from %2", albumName, btc->collectionName() ) ); @@ -212,7 +212,7 @@ QString artistName = artist->prettyName(); - url.setCommand( "navigate" ); + url.setCommand( QStringLiteral("navigate") ); QString path = btc->browserName(); if ( !btc->collectionName().isEmpty() ) @@ -228,11 +228,11 @@ } else { - url.setArg( "levels", "artist-album" ); + url.setArg( QStringLiteral("levels"), QStringLiteral("artist-album") ); filter = ( "artist:\"" + artistName + "\"" ); } - url.setArg( "filter", filter ); + url.setArg( QStringLiteral("filter"), filter ); if ( !btc->collectionName().isEmpty() ) url.setName( i18n( "Artist \"%1\" from %2", artistName, btc->collectionName() ) ); @@ -254,7 +254,7 @@ QIcon NavigationUrlGenerator::icon() { - return QIcon::fromTheme( "flag-amarok" ); + return QIcon::fromTheme( QStringLiteral("flag-amarok") ); } AmarokUrl diff --git a/src/amarokurls/NavigationUrlRunner.h b/src/amarokurls/NavigationUrlRunner.h --- a/src/amarokurls/NavigationUrlRunner.h +++ b/src/amarokurls/NavigationUrlRunner.h @@ -28,12 +28,12 @@ public: NavigationUrlRunner(); - virtual ~NavigationUrlRunner(); + ~NavigationUrlRunner() override; - virtual QString command() const; - virtual QString prettyCommand() const; - virtual QIcon icon() const; - virtual bool run( AmarokUrl url ); + QString command() const override; + QString prettyCommand() const override; + QIcon icon() const override; + bool run( const AmarokUrl &url ) override; }; #endif diff --git a/src/amarokurls/NavigationUrlRunner.cpp b/src/amarokurls/NavigationUrlRunner.cpp --- a/src/amarokurls/NavigationUrlRunner.cpp +++ b/src/amarokurls/NavigationUrlRunner.cpp @@ -40,7 +40,7 @@ } bool -NavigationUrlRunner::run( AmarokUrl url ) +NavigationUrlRunner::run(const AmarokUrl &url ) { DEBUG_BLOCK; @@ -52,25 +52,25 @@ QMap args = url.args(); - if ( args.keys().contains( "levels" ) ) + if ( args.keys().contains( QStringLiteral("levels") ) ) { - QString levelsString = args.value( "levels" ); + QString levelsString = args.value( QStringLiteral("levels") ); QList levels; - QStringList levelsStringList = levelsString.split( '-' ); + QStringList levelsStringList = levelsString.split( QLatin1Char('-') ); foreach( const QString &levelString, levelsStringList ) { - if( levelString == "genre" ) + if( levelString == QLatin1String("genre") ) levels.append( CategoryId::Genre ); - else if( levelString == "artist" ) + else if( levelString == QLatin1String("artist") ) levels.append( CategoryId::Artist ); - else if( levelString == "album" ) + else if( levelString == QLatin1String("album") ) levels.append( CategoryId::Album ); - else if( levelString == "albumartist" ) + else if( levelString == QLatin1String("albumartist") ) levels.append( CategoryId::AlbumArtist ); - else if( levelString == "composer" ) + else if( levelString == QLatin1String("composer") ) levels.append( CategoryId::Composer ); - else if( levelString == "year" ) + else if( levelString == QLatin1String("year") ) levels.append( CategoryId::Year ); } @@ -81,49 +81,49 @@ //if we are activating the local collection, check if we need to restore "show cover" and "show year" //if in the local collection view, also store "show covers" and "show years" - if( url.path().endsWith( "collections", Qt::CaseInsensitive ) ) + if( url.path().endsWith( QLatin1String("collections"), Qt::CaseInsensitive ) ) { - if ( args.keys().contains( "show_cover" ) ) + if ( args.keys().contains( QStringLiteral("show_cover") ) ) { - if( args.value( "show_cover" ).compare( "true", Qt::CaseInsensitive ) == 0 ) + if( args.value( QStringLiteral("show_cover") ).compare( QLatin1String("true"), Qt::CaseInsensitive ) == 0 ) AmarokConfig::setShowAlbumArt( true ); - else if( args.value( "show_cover" ).compare( "false", Qt::CaseInsensitive ) == 0 ) + else if( args.value( QStringLiteral("show_cover") ).compare( QLatin1String("false"), Qt::CaseInsensitive ) == 0 ) AmarokConfig::setShowAlbumArt( false ); } - if ( args.keys().contains( "show_years" ) ) + if ( args.keys().contains( QStringLiteral("show_years") ) ) { - if( args.value( "show_years" ).compare( "true", Qt::CaseInsensitive ) == 0 ) + if( args.value( QStringLiteral("show_years") ).compare( QLatin1String("true"), Qt::CaseInsensitive ) == 0 ) AmarokConfig::setShowYears( true ); - else if( args.value( "show_years" ).compare( "false", Qt::CaseInsensitive ) == 0 ) + else if( args.value( QStringLiteral("show_years") ).compare( QLatin1String("false"), Qt::CaseInsensitive ) == 0 ) AmarokConfig::setShowYears( false ); } } //also set the correct path if we are navigating to the file browser - if( url.path().endsWith( "files", Qt::CaseInsensitive ) ) + if( url.path().endsWith( QLatin1String("files"), Qt::CaseInsensitive ) ) { FileBrowser * fileBrowser = dynamic_cast( The::mainWindow()->browserDock()->list()->activeCategory() ); if( fileBrowser ) { - if( args.keys().contains( "path" ) ) + if( args.keys().contains( QStringLiteral("path") ) ) { - fileBrowser->setDir( QUrl::fromUserInput(args.value( "path" )) ); + fileBrowser->setDir( QUrl::fromUserInput(args.value( QStringLiteral("path") )) ); } } } - if ( args.keys().contains( "filter" ) ) - active->setFilter( QUrl::fromPercentEncoding(args.value( "filter" ).toUtf8()) ); + if ( args.keys().contains( QStringLiteral("filter") ) ) + active->setFilter( QUrl::fromPercentEncoding(args.value( QStringLiteral("filter") ).toUtf8()) ); The::mainWindow()->showDock( MainWindow::AmarokDockNavigation ); return true; } QString NavigationUrlRunner::command() const { - return "navigate"; + return QStringLiteral("navigate"); } QString NavigationUrlRunner::prettyCommand() const @@ -133,7 +133,7 @@ QIcon NavigationUrlRunner::icon() const { - return QIcon::fromTheme( "flag-amarok" ); + return QIcon::fromTheme( QStringLiteral("flag-amarok") ); } diff --git a/src/amarokurls/PlayUrlGenerator.h b/src/amarokurls/PlayUrlGenerator.h --- a/src/amarokurls/PlayUrlGenerator.h +++ b/src/amarokurls/PlayUrlGenerator.h @@ -29,33 +29,33 @@ * A class used to generate and modify amarok://play/ urls. * * The format of a 'play' amarokurl is: - * amarok://play// + * amarok://play/\/\ */ class AMAROK_EXPORT PlayUrlGenerator : public AmarokUrlGenerator { public: static PlayUrlGenerator * instance(); AmarokUrl createCurrentTrackBookmark(); - AmarokUrl createTrackBookmark( Meta::TrackPtr track, qint64 miliseconds, QString name = QString() ); + AmarokUrl createTrackBookmark( Meta::TrackPtr track, qint64 miliseconds, const QString &name = QString() ); /** * Updates the position of the bookmark named @param name to @param newMiliseconds - * for the track @param track. + * for the track @param track . * * The name should be a valid bookmark name and should include the trailing "- mm:ss". * Bookmark is renamed according to track title and new position, too. */ - void moveTrackBookmark( Meta::TrackPtr track, qint64 newMiliseconds, QString name ); + void moveTrackBookmark( Meta::TrackPtr track, qint64 newMiliseconds, const QString &name ); - QString description(); - QIcon icon(); - AmarokUrl createUrl(); + QString description() override; + QIcon icon() override; + AmarokUrl createUrl() override; private: PlayUrlGenerator(); - ~PlayUrlGenerator(); + ~PlayUrlGenerator() override; static PlayUrlGenerator * s_instance; }; diff --git a/src/amarokurls/PlayUrlGenerator.cpp b/src/amarokurls/PlayUrlGenerator.cpp --- a/src/amarokurls/PlayUrlGenerator.cpp +++ b/src/amarokurls/PlayUrlGenerator.cpp @@ -26,11 +26,11 @@ #include -PlayUrlGenerator * PlayUrlGenerator::s_instance = 0; +PlayUrlGenerator * PlayUrlGenerator::s_instance = nullptr; PlayUrlGenerator * PlayUrlGenerator::instance() { - if( s_instance == 0) + if( s_instance == nullptr) s_instance = new PlayUrlGenerator(); return s_instance; @@ -56,7 +56,7 @@ } AmarokUrl -PlayUrlGenerator::createTrackBookmark( Meta::TrackPtr track, qint64 miliseconds, QString name ) +PlayUrlGenerator::createTrackBookmark( Meta::TrackPtr track, qint64 miliseconds, const QString &name ) { DEBUG_BLOCK @@ -69,9 +69,9 @@ return url; const QString trackUrl = track->playableUrl().toEncoded().toBase64(); - url.setCommand( "play" ); + url.setCommand( QStringLiteral("play") ); url.setPath( trackUrl ); - url.setArg( "pos", secondsString ); + url.setArg( QStringLiteral("pos"), secondsString ); if( name.isEmpty() ) url.setName( track->prettyName() + " - " + Meta::secToPrettyTime( seconds ) ); @@ -84,16 +84,16 @@ } void -PlayUrlGenerator::moveTrackBookmark( Meta::TrackPtr track, qint64 newMiliseconds, QString name ) +PlayUrlGenerator::moveTrackBookmark( Meta::TrackPtr track, qint64 newMiliseconds, const QString &name ) { qreal seconds = qreal ( newMiliseconds ) / 1000; QString trackPosition; trackPosition.setNum( seconds ); QString trackName = track->prettyName(); QString newName = ( trackName + " - " + Meta::msToPrettyTime( newMiliseconds ) ); - BookmarkModel::instance()->setBookmarkArg( name, "pos", trackPosition ); + BookmarkModel::instance()->setBookmarkArg( name, QStringLiteral("pos"), trackPosition ); BookmarkModel::instance()->renameBookmark( name, newName ); } @@ -105,7 +105,7 @@ QIcon PlayUrlGenerator::icon() { - return QIcon::fromTheme( "x-media-podcast-amarok" ); + return QIcon::fromTheme( QStringLiteral("x-media-podcast-amarok") ); } AmarokUrl diff --git a/src/amarokurls/PlayUrlRunner.h b/src/amarokurls/PlayUrlRunner.h --- a/src/amarokurls/PlayUrlRunner.h +++ b/src/amarokurls/PlayUrlRunner.h @@ -30,12 +30,12 @@ public: PlayUrlRunner (); - virtual ~PlayUrlRunner (); + ~PlayUrlRunner () override; - virtual QString command () const; - virtual QString prettyCommand() const; - virtual bool run ( AmarokUrl url ); - virtual QIcon icon () const; + QString command () const override; + QString prettyCommand() const override; + bool run ( const AmarokUrl &url ) override; + QIcon icon () const override; /** * This function takes a url for a track, and returns a list @@ -46,7 +46,7 @@ * @return a list of bookmarks. the list is empty if no bookmarks exist. * @see PlayUrlGenerator */ - static BookmarkList bookmarksFromUrl( QUrl url ); + static BookmarkList bookmarksFromUrl( const QUrl &url ); }; diff --git a/src/amarokurls/PlayUrlRunner.cpp b/src/amarokurls/PlayUrlRunner.cpp --- a/src/amarokurls/PlayUrlRunner.cpp +++ b/src/amarokurls/PlayUrlRunner.cpp @@ -38,7 +38,7 @@ The::amarokUrlHandler()->unRegisterRunner ( this ); } -bool PlayUrlRunner::run ( AmarokUrl url ) +bool PlayUrlRunner::run (const AmarokUrl &url ) { DEBUG_BLOCK if ( url.isNull() ) @@ -49,9 +49,9 @@ //get the position qint64 pos = 0; - if ( url.args().keys().contains( "pos" ) ) + if ( url.args().keys().contains( QStringLiteral("pos") ) ) { - pos = (qint64) ( url.args().value( "pos" ).toDouble() * 1000.0 ); + pos = (qint64) ( url.args().value( QStringLiteral("pos") ).toDouble() * 1000.0 ); } debug() << "seek pos: " << pos; @@ -78,15 +78,15 @@ QString PlayUrlRunner::command() const { - return "play"; + return QStringLiteral("play"); } QString PlayUrlRunner::prettyCommand() const { return i18nc( "A type of command that starts playing at a specific position in a track", "Play" ); } -BookmarkList PlayUrlRunner::bookmarksFromUrl( QUrl url ) +BookmarkList PlayUrlRunner::bookmarksFromUrl( const QUrl &url ) { BookmarkList list; @@ -103,7 +103,7 @@ // Queries the database for bookmarks where the url field contains // the base64 encoded url (minus the '='). - QString query = "SELECT id, parent_id, name, url, description, custom FROM bookmarks WHERE url LIKE '%%1%'"; + QString query = QStringLiteral("SELECT id, parent_id, name, url, description, custom FROM bookmarks WHERE url LIKE '%%1%'"); query = query.arg ( track_encoded ); QStringList result = StorageManager::instance()->sqlStorage()->query ( query ); @@ -119,6 +119,6 @@ QIcon PlayUrlRunner::icon() const { - return QIcon::fromTheme( "x-media-podcast-amarok" ); + return QIcon::fromTheme( QStringLiteral("x-media-podcast-amarok") ); } diff --git a/src/browsers/BrowserBreadcrumbItem.h b/src/browsers/BrowserBreadcrumbItem.h --- a/src/browsers/BrowserBreadcrumbItem.h +++ b/src/browsers/BrowserBreadcrumbItem.h @@ -47,14 +47,14 @@ { Q_OBJECT public: - BrowserBreadcrumbItem( BrowserCategory* category, QWidget* parent = 0 ); + explicit BrowserBreadcrumbItem( BrowserCategory* category, QWidget* parent = nullptr ); /** * Overloaded constructor for creating breadcrumb items not bound to a particular BrowserCategory */ BrowserBreadcrumbItem( const QString &name, const QString &callback, const BreadcrumbSiblingList &childItems, FileBrowser *handler, - QWidget *parent = 0 ); + QWidget *parent = nullptr ); ~BrowserBreadcrumbItem(); void setActive( bool active ); diff --git a/src/browsers/BrowserBreadcrumbItem.cpp b/src/browsers/BrowserBreadcrumbItem.cpp --- a/src/browsers/BrowserBreadcrumbItem.cpp +++ b/src/browsers/BrowserBreadcrumbItem.cpp @@ -31,7 +31,7 @@ BrowserBreadcrumbItem::BrowserBreadcrumbItem( BrowserCategory *category, QWidget *parent ) : BoxWidget( false, parent ) - , m_menuButton( 0 ) + , m_menuButton( nullptr ) { //figure out if we want to add a menu to this item. A menu allows you to select //any of the _sibling_ items. (yes, I know, this is different from how Dolphin @@ -45,7 +45,7 @@ //parent is only for memory management. QMap siblingMap = parentList->categories(); - QStringList siblingNames = siblingMap.keys(); + const QStringList siblingNames = siblingMap.keys(); foreach( const QString &siblingName, siblingNames ) { @@ -68,12 +68,12 @@ { // root item m_mainButton->setToolTip( i18n( "Media Sources Home" ) ); - m_mainButton->setIcon( QIcon::fromTheme( "user-home" ) ); + m_mainButton->setIcon( QIcon::fromTheme( QStringLiteral("user-home") ) ); } connect( m_mainButton, &BreadcrumbItemButton::sizePolicyChanged, this, &BrowserBreadcrumbItem::updateSizePolicy ); - //if this is a list, make cliking on this item cause us + //if this is a list, make clicking on this item cause us //to navigate to its home. BrowserCategoryList *list = qobject_cast( category ); if ( list ) @@ -96,7 +96,7 @@ BrowserBreadcrumbItem::BrowserBreadcrumbItem( const QString &name, const QString &callback, const BreadcrumbSiblingList &childItems, FileBrowser *handler, QWidget *parent ) : BoxWidget( false, parent ) - , m_menuButton( 0 ) + , m_menuButton( nullptr ) , m_callback( callback ) { if ( !childItems.isEmpty() ) @@ -108,7 +108,7 @@ foreach( const BreadcrumbSibling &sibling, childItems ) { QString visibleName = sibling.name; - visibleName.replace( '&', "&&" ); // prevent bug 244817 + visibleName.replace( '&', QLatin1String("&&") ); // prevent bug 244817 QAction *action = menu->addAction( sibling.icon, visibleName ); action->setProperty( "callback", sibling.callback ); @@ -159,14 +159,14 @@ void BrowserBreadcrumbItem::activate() { - emit activated( m_callback ); + Q_EMIT activated( m_callback ); } void BrowserBreadcrumbItem::activateSibling() { QAction *action = qobject_cast( sender() ); if( action ) - emit activated( action->property( "callback" ).toString() ); + Q_EMIT activated( action->property( "callback" ).toString() ); } int BrowserBreadcrumbItem::nominalWidth() const diff --git a/src/browsers/BrowserBreadcrumbWidget.h b/src/browsers/BrowserBreadcrumbWidget.h --- a/src/browsers/BrowserBreadcrumbWidget.h +++ b/src/browsers/BrowserBreadcrumbWidget.h @@ -42,17 +42,17 @@ * Constructor * @param parent the parent widget */ - BrowserBreadcrumbWidget( QWidget * parent ); + explicit BrowserBreadcrumbWidget( QWidget * parent ); /** * Destructor */ - ~BrowserBreadcrumbWidget(); + ~BrowserBreadcrumbWidget() override; /** * Set the BrowserCategoryList which acts as the "root" of the breadcrumb widget. * A root breadcrumb item is created that represents the lowest level, and the categories - * in the list are added to the items dropdown menu. + * in the list are added to the items drop-down menu. * @param rootList the BrowserCategoryList representing the lowest level in the navigation hirachy */ void setRootList( BrowserCategoryList *rootList ); @@ -65,14 +65,14 @@ public Q_SLOTS: /** - * Rebuild the list of breadcrumb items corrosponding to the current location in the hirachy. + * Rebuild the list of breadcrumb items corresponding to the current location in the hierarchy. * This also allows for categories that add additional breadcrumb items (such as the file browser) to update the * breadcrumbs when their internal state changes. */ void updateBreadcrumbs(); protected: - virtual void resizeEvent( QResizeEvent * event ); + void resizeEvent( QResizeEvent * event ) override; private Q_SLOTS: /** diff --git a/src/browsers/BrowserBreadcrumbWidget.cpp b/src/browsers/BrowserBreadcrumbWidget.cpp --- a/src/browsers/BrowserBreadcrumbWidget.cpp +++ b/src/browsers/BrowserBreadcrumbWidget.cpp @@ -36,19 +36,19 @@ BrowserBreadcrumbWidget::BrowserBreadcrumbWidget( QWidget * parent ) : BoxWidget( false, parent) - , m_rootList( 0 ) - , m_childMenuButton( 0 ) + , m_rootList( nullptr ) + , m_childMenuButton( nullptr ) { setFixedHeight( 28 ); setContentsMargins( 3, 0, 3, 0 ); m_breadcrumbArea = new BoxWidget( false, this ); m_breadcrumbArea->setContentsMargins( 0, 0, 0, 0 ); static_cast( layout() )->setStretchFactor( m_breadcrumbArea, 10 ); - new BreadcrumbUrlMenuButton( "navigate", this ); + new BreadcrumbUrlMenuButton( QStringLiteral("navigate"), this ); - m_spacer = new QWidget( 0 ); + m_spacer = new QWidget( nullptr ); } BrowserBreadcrumbWidget::~BrowserBreadcrumbWidget() diff --git a/src/browsers/BrowserCategory.h b/src/browsers/BrowserCategory.h --- a/src/browsers/BrowserCategory.h +++ b/src/browsers/BrowserCategory.h @@ -43,7 +43,7 @@ * @param name The internal name of the category, used for generating Amarok urls. This should never be translated. * @param parent The parent widget. */ - BrowserCategory( const QString &name, QWidget *parent = 0 ); + explicit BrowserCategory( const QString &name, QWidget *parent = nullptr ); /** * Destructor. @@ -138,7 +138,7 @@ virtual void polish() {} virtual void setupAddItems() {} - //These 2 functions are forwarded to simplifiy the creation of urls + //These 2 functions are forwarded to simplify the creation of urls //even though they might not be needed in many cases. virtual QString filter() const { return QString(); } virtual QList levels() const { return QList(); } diff --git a/src/browsers/BrowserCategory.cpp b/src/browsers/BrowserCategory.cpp --- a/src/browsers/BrowserCategory.cpp +++ b/src/browsers/BrowserCategory.cpp @@ -105,8 +105,8 @@ // Hack alert: Use the class name of the most derived object (using polymorphism) for CSS // This is required to limit the style to this specific class only (avoiding cascading) // \sa http://doc.qt.nokia.com/latest/stylesheet-syntax.html#widgets-inside-c-namespaces - const QString escapedClassName = QString( metaObject()->className() ).replace( "::", "--" ); - setStyleSheet( QString("%1 { background-image: url(\"%2\"); \ + const QString escapedClassName = QString( metaObject()->className() ).replace( QLatin1String("::"), QLatin1String("--") ); + setStyleSheet( QStringLiteral("%1 { background-image: url(\"%2\"); \ background-repeat: no-repeat; \ background-attachment: fixed; \ background-position: center; }").arg( escapedClassName, path ) @@ -162,7 +162,7 @@ foreach( BrowserBreadcrumbItem *item, m_additionalItems ) { m_additionalItems.removeAll( item ); - /* deleting immediatelly isn't safe, this method may be called from an inner + /* deleting immediately isn't safe, this method may be called from an inner * QEventLoop inside QMenu::exec() of another breadcrumb item, which could * then leas to crash bug 265626 */ item->deleteLater(); diff --git a/src/browsers/BrowserCategoryList.h b/src/browsers/BrowserCategoryList.h --- a/src/browsers/BrowserCategoryList.h +++ b/src/browsers/BrowserCategoryList.h @@ -46,8 +46,9 @@ * Constructor * @param parent The parent widget. * @param name The name of this widget. + * @param sort Whether to sort the list. */ - BrowserCategoryList( const QString& name, QWidget* parent = 0, bool sort = false ); + explicit BrowserCategoryList( const QString& name, QWidget* parent = nullptr, bool sort = false ); /** * Destructor. @@ -72,7 +73,7 @@ * @param target This is a / delimited string of category names. * This list will take the first category name, and if a child category with * this name exists, it will switch to it. If there are are more category names - * in the target string, and the category activcated is itself a category list, + * in the target string, and the category activated is itself a category list, * it will strip the first category name and / from the targe string and pass * the rest to the navigate() method of the active category list. * @@ -120,7 +121,7 @@ private Q_SLOTS: /** Sets the current filter value and updates the content */ - virtual void setFilter( const QString &filter ); + void setFilter( const QString &filter ) override; private: @@ -140,7 +141,7 @@ private Q_SLOTS: /** * Slot called when an item in the list has been activated and the - * corrosponding category should be shown. + * corresponding category should be shown. * @param index The index that was activated */ void categoryActivated( const QModelIndex &index ); diff --git a/src/browsers/BrowserCategoryList.cpp b/src/browsers/BrowserCategoryList.cpp --- a/src/browsers/BrowserCategoryList.cpp +++ b/src/browsers/BrowserCategoryList.cpp @@ -120,7 +120,7 @@ activeCategory()->clearAdditionalItems(); m_widgetStack->setCurrentIndex( 0 ); - emit( viewChanged() ); + Q_EMIT( viewChanged() ); } } @@ -157,7 +157,7 @@ { m_proxyModel->sort( 0 ); } - emit( viewChanged() ); + Q_EMIT( viewChanged() ); } @@ -179,7 +179,7 @@ m_categoryListView->reset(); - emit( viewChanged() ); + Q_EMIT( viewChanged() ); } BrowserCategory* @@ -204,7 +204,7 @@ m_widgetStack->setCurrentWidget( category ); - emit( viewChanged() ); + Q_EMIT( viewChanged() ); } void BrowserCategoryList::back() @@ -227,24 +227,24 @@ void BrowserCategoryList::childViewChanged() { DEBUG_BLOCK - emit( viewChanged() ); + Q_EMIT( viewChanged() ); } QString BrowserCategoryList::navigate( const QString & target ) { DEBUG_BLOCK debug() << "target: " << target; - QStringList categories = target.split( '/' ); - if ( categories.size() == 0 ) + QStringList categories = target.split( QLatin1Char('/') ); + if ( categories.isEmpty() ) return QString(); //remove our own name if present, before passing on... if ( categories.at( 0 ) == name() ) { debug() << "removing own name (" << categories.at( 0 ) << ") from path"; categories.removeFirst(); - if ( categories.size() == 0 ) + if ( categories.isEmpty() ) { //nothing else left, make sure this category is visible home(); @@ -264,13 +264,13 @@ //check if this category is also BrowserCategoryList.target BrowserCategoryList *childList = qobject_cast( activeCategory() ); - if ( childList == 0 ) + if ( childList == nullptr ) { debug() << "child is not a list..."; if ( categories.size() > 1 ) { categories.removeFirst(); - QString leftover = categories.join( "/" ); + QString leftover = categories.join( QLatin1Char('/') ); return leftover; } return QString(); @@ -288,8 +288,8 @@ } categories.removeFirst(); - debug() << "passing remaining path to child: " << categories.join( "/" ); - return childList->navigate( categories.join( "/" ) ); + debug() << "passing remaining path to child: " << categories.join( QLatin1Char('/') ); + return childList->navigate( categories.join( QLatin1Char('/') ) ); } @@ -311,9 +311,9 @@ void BrowserCategoryList::categoryEntered( const QModelIndex & index ) { - //get the long description for this item and pass it it to info proxy. + //get the long description for this item and pass it to info proxy. - BrowserCategory *category = 0; + BrowserCategory *category = nullptr; if ( index.data( CustomCategoryRoles::CategoryRole ).canConvert() ) category = index.data( CustomCategoryRoles::CategoryRole ).value(); @@ -329,7 +329,7 @@ if ( m_infoHtmlTemplate.isEmpty() ) { - QString dataPath = QStandardPaths::locate( QStandardPaths::GenericDataLocation, "amarok/data/", QStandardPaths::LocateDirectory ); + QString dataPath = QStandardPaths::locate( QStandardPaths::GenericDataLocation, QStringLiteral("amarok/data/"), QStandardPaths::LocateDirectory ); //load html QString htmlPath = dataPath + "/hover_info_template.html"; @@ -342,23 +342,23 @@ m_infoHtmlTemplate = file.readAll(); file.close(); - m_infoHtmlTemplate.replace( "{background_color}", The::paletteHandler()->highlightColor().lighter( 150 ).name() ); - m_infoHtmlTemplate.replace( "{border_color}", The::paletteHandler()->highlightColor().lighter( 150 ).name() ); - m_infoHtmlTemplate.replace( "{text_color}", pApp->palette().brush( QPalette::Text ).color().name() ); + m_infoHtmlTemplate.replace( QLatin1String("{background_color}"), The::paletteHandler()->highlightColor().lighter( 150 ).name() ); + m_infoHtmlTemplate.replace( QLatin1String("{border_color}"), The::paletteHandler()->highlightColor().lighter( 150 ).name() ); + m_infoHtmlTemplate.replace( QLatin1String("{text_color}"), pApp->palette().brush( QPalette::Text ).color().name() ); QColor highlight( pApp->palette().highlight().color() ); highlight.setHsvF( highlight.hueF(), 0.3, .95, highlight.alphaF() ); - m_infoHtmlTemplate.replace( "{header_background_color}", highlight.name() ); + m_infoHtmlTemplate.replace( QLatin1String("{header_background_color}"), highlight.name() ); } QString currentHtml = m_infoHtmlTemplate; - currentHtml.replace( "%%NAME%%", category->prettyName() ); - currentHtml.replace( "%%DESCRIPTION%%", category->longDescription() ); - currentHtml.replace( "%%IMAGE_PATH%%", "file://" + category->imagePath() ); + currentHtml.replace( QLatin1String("%%NAME%%"), category->prettyName() ); + currentHtml.replace( QLatin1String("%%DESCRIPTION%%"), category->longDescription() ); + currentHtml.replace( QLatin1String("%%IMAGE_PATH%%"), "file://" + category->imagePath() ); QVariantMap variantMap; - variantMap["main_info"] = QVariant( currentHtml ); + variantMap[QStringLiteral("main_info")] = QVariant( currentHtml ); The::infoProxy()->setInfo( variantMap ); } } diff --git a/src/browsers/BrowserCategoryListDelegate.h b/src/browsers/BrowserCategoryListDelegate.h --- a/src/browsers/BrowserCategoryListDelegate.h +++ b/src/browsers/BrowserCategoryListDelegate.h @@ -30,7 +30,7 @@ class BrowserCategoryListDelegate : public QStyledItemDelegate { public: - BrowserCategoryListDelegate( QTreeView *view ); + explicit BrowserCategoryListDelegate( QTreeView *view ); ~BrowserCategoryListDelegate(); void paint( QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index ) const; diff --git a/src/browsers/BrowserCategoryListModel.h b/src/browsers/BrowserCategoryListModel.h --- a/src/browsers/BrowserCategoryListModel.h +++ b/src/browsers/BrowserCategoryListModel.h @@ -39,11 +39,11 @@ class BrowserCategoryListModel : public QAbstractListModel { public: - BrowserCategoryListModel( QObject *parent = 0 ); + explicit BrowserCategoryListModel( QObject *parent = nullptr ); ~BrowserCategoryListModel(); - int rowCount( const QModelIndex & parent = QModelIndex() ) const; - QVariant data( const QModelIndex & index, int role = Qt::DisplayRole ) const; + int rowCount( const QModelIndex & parent = QModelIndex() ) const override; + QVariant data( const QModelIndex & index, int role = Qt::DisplayRole ) const override; /** * Adds a new sub-category to this list. diff --git a/src/browsers/BrowserCategoryListSortFilterProxyModel.h b/src/browsers/BrowserCategoryListSortFilterProxyModel.h --- a/src/browsers/BrowserCategoryListSortFilterProxyModel.h +++ b/src/browsers/BrowserCategoryListSortFilterProxyModel.h @@ -23,8 +23,9 @@ class BrowserCategoryListSortFilterProxyModel : public QSortFilterProxyModel { + Q_OBJECT public: - BrowserCategoryListSortFilterProxyModel( QObject * parent = 0 ); + explicit BrowserCategoryListSortFilterProxyModel( QObject * parent = nullptr ); virtual ~BrowserCategoryListSortFilterProxyModel(); }; diff --git a/src/browsers/BrowserDock.h b/src/browsers/BrowserDock.h --- a/src/browsers/BrowserDock.h +++ b/src/browsers/BrowserDock.h @@ -15,8 +15,8 @@ * this program. If not, see . * ****************************************************************************************/ -#ifndef BROWSERWIDGET_H -#define BROWSERWIDGET_H +#ifndef BROWSERDOCK_H +#define BROWSERDOCK_H #include "BrowserBreadcrumbWidget.h" #include "BrowserCategoryList.h" @@ -35,13 +35,13 @@ Q_OBJECT public: - BrowserDock( QWidget *parent ); + explicit BrowserDock( QWidget *parent ); ~BrowserDock(); BrowserCategoryList *list() const; void navigate( const QString &target ); - void polish(); + void polish() override; private Q_SLOTS: void home(); diff --git a/src/browsers/BrowserDock.cpp b/src/browsers/BrowserDock.cpp --- a/src/browsers/BrowserDock.cpp +++ b/src/browsers/BrowserDock.cpp @@ -17,11 +17,10 @@ #include "BrowserDock.h" -#include "core/interfaces/Logger.h" +#include "core/logger/Logger.h" #include "core/support/Amarok.h" #include "core/support/Components.h" #include "core/support/Debug.h" -#include "core-impl/logger/ProxyLogger.h" #include "PaletteHandler.h" #include "widgets/BoxWidget.h" #include "widgets/HorizontalDivider.h" @@ -34,7 +33,7 @@ BrowserDock::BrowserDock( QWidget *parent ) : AmarokDockWidget( i18n( "&Media Sources" ), parent ) { - setObjectName( "Media Sources dock" ); + setObjectName( QStringLiteral("Media Sources dock") ); setAllowedAreas( Qt::AllDockWidgetAreas ); //we have to create this here as it is used when setting up the @@ -49,39 +48,32 @@ m_breadcrumbWidget = new BrowserBreadcrumbWidget( m_mainWidget ); new HorizontalDivider( m_mainWidget ); - m_categoryList = new BrowserCategoryList( "root list", m_mainWidget ); + m_categoryList = new BrowserCategoryList( QStringLiteral("root list"), m_mainWidget ); m_breadcrumbWidget->setRootList( m_categoryList.data() ); m_messageArea = new BrowserMessageArea( m_mainWidget ); m_messageArea->setAutoFillBackground( true ); //TODO: set dynamic height for hidpi displays m_messageArea->setFixedHeight( 36 ); - Amarok::Logger *logger = Amarok::Components::logger(); - ProxyLogger *proxy = dynamic_cast( logger ); - if( proxy ) - proxy->setLogger( m_messageArea ); - else - error() << "Was not able to register BrowserDock as logger"; - ensurePolish(); } BrowserDock::~BrowserDock() {} void BrowserDock::polish() { - m_categoryList->setIcon( QIcon::fromTheme( "user-home" ) ); + m_categoryList->setIcon( QIcon::fromTheme( QStringLiteral("user-home") ) ); m_categoryList->setMinimumSize( 100, 300 ); connect( m_breadcrumbWidget, &BrowserBreadcrumbWidget::toHome, this, &BrowserDock::home ); // Keyboard shortcut for going back one level - QAction *action = new QAction( QIcon::fromTheme( "go-up" ), i18n( "Go Up in Media Sources Pane" ), + QAction *action = new QAction( QIcon::fromTheme( QStringLiteral("go-up") ), i18n( "Go Up in Media Sources Pane" ), m_mainWidget ); - Amarok::actionCollection()->addAction( "browser_previous", action ); + Amarok::actionCollection()->addAction( QStringLiteral("browser_previous"), action ); connect( action, &QAction::triggered, m_categoryList.data(), &BrowserCategoryList::back ); // action->setShortcut( QKeySequence( Qt::Key_Backspace ) ); action->setShortcut( Qt::Key_Backspace ); @@ -115,9 +107,9 @@ QString( "QFrame#BrowserMessageArea { border: 1px ridge %1; " \ "background-color: %2; color: %3; border-radius: 3px; }" \ "QLabel { color: %3; }" ) - .arg( palette.color( QPalette::Active, QPalette::Window ).name() ) - .arg( palette.color( QPalette::Active, QPalette::Mid ).name() ) - .arg( palette.color( QPalette::Active, QPalette::HighlightedText ).name() ) + .arg( palette.color( QPalette::Active, QPalette::Window ).name(), + palette.color( QPalette::Active, QPalette::Mid ).name(), + palette.color( QPalette::Active, QPalette::HighlightedText ).name() ) ); } diff --git a/src/browsers/BrowserMessageArea.h b/src/browsers/BrowserMessageArea.h --- a/src/browsers/BrowserMessageArea.h +++ b/src/browsers/BrowserMessageArea.h @@ -17,7 +17,7 @@ #ifndef BROWSERMESSAGEAREA_H #define BROWSERMESSAGEAREA_H -#include "core-impl/logger/ProxyLogger.h" +#include "core/logger/Logger.h" #include "statusbar/CompoundProgressBar.h" #include "statusbar/KJobProgressBar.h" #include "statusbar/NetworkProgressBar.h" @@ -30,32 +30,31 @@ Q_OBJECT public: - BrowserMessageArea( QWidget *parent ); + explicit BrowserMessageArea( QWidget *parent ); ~BrowserMessageArea() { } +protected: /* Amarok::Logger virtual methods */ - virtual void shortMessage( const QString &text ); - virtual void longMessage( const QString &text, MessageType type ); + void shortMessageImpl( const QString &text ) override; + void longMessageImpl( const QString &text, MessageType type ) override; + virtual void newProgressOperationImpl( KJob * job, const QString & text, QObject *context, + const std::function &function, Qt::ConnectionType type ) override; - virtual void newProgressOperation( KJob *job, const QString &text, QObject *obj, - const char *slot, Qt::ConnectionType type ); + virtual void newProgressOperationImpl( QNetworkReply *reply, const QString &text, QObject *obj, + const std::function &function, Qt::ConnectionType type ) override; - virtual void newProgressOperation( QNetworkReply *reply, const QString &text, QObject *obj, - const char *slot, Qt::ConnectionType type ); - - virtual void newProgressOperation( QObject *sender, const QString &text, int maximum, - QObject *obj, const char *slot, Qt::ConnectionType type ); + virtual void newProgressOperationImpl( QObject *sender, const QMetaMethod &increment, const QMetaMethod &end, const QString &text, + int maximum, QObject *obj, const std::function &function, Qt::ConnectionType type ) override; Q_SIGNALS: void signalLongMessage( const QString & text, MessageType type ); private Q_SLOTS: void hideProgress(); void nextShortMessage(); - void hideLongMessage(); void slotLongMessage( const QString &text, MessageType type = Information ); private: diff --git a/src/browsers/BrowserMessageArea.cpp b/src/browsers/BrowserMessageArea.cpp --- a/src/browsers/BrowserMessageArea.cpp +++ b/src/browsers/BrowserMessageArea.cpp @@ -25,7 +25,7 @@ : BoxWidget( true, parent ) , m_busy( false ) { - setObjectName( "BrowserMessageArea" ); + setObjectName( QStringLiteral("BrowserMessageArea") ); m_progressBar = new CompoundProgressBar( this ); connect( m_progressBar, &CompoundProgressBar::allDone, this, &BrowserMessageArea::hideProgress ); @@ -50,7 +50,7 @@ } void -BrowserMessageArea::shortMessage( const QString &text ) +BrowserMessageArea::shortMessageImpl( const QString &text ) { if( !m_busy ) { @@ -66,60 +66,63 @@ } void -BrowserMessageArea::longMessage( const QString &text, MessageType type ) +BrowserMessageArea::longMessageImpl( const QString &text, MessageType type ) { - // The purpose of this emit is to make the operation thread safe. If this - // method is called from a non-GUI thread, the "emit" relays it over the + // The purpose of this Q_EMIT is to make the operation thread safe. If this + // method is called from a non-GUI thread, the "Q_EMIT" relays it over the // event loop to the GUI thread, so that we can safely create widgets. - emit signalLongMessage( text, type ); + Q_EMIT signalLongMessage( text, type ); } void -BrowserMessageArea::newProgressOperation( KJob *job, const QString &text, QObject *obj, - const char *slot, Qt::ConnectionType type ) +BrowserMessageArea::newProgressOperationImpl( KJob *job, const QString &text, QObject *context, + const std::function &function, Qt::ConnectionType type ) { - KJobProgressBar *newBar = new KJobProgressBar( 0, job ); + KJobProgressBar *newBar = new KJobProgressBar( nullptr, job ); newBar->setDescription( text ); connect( job, &KJob::destroyed, m_progressBar, &CompoundProgressBar::endProgressOperation ); - newBar->setAbortSlot( obj, slot, type ); + newBar->setAbortSlot( context, function, type ); m_progressBar->addProgressBar( newBar, job ); m_progressBar->show(); m_busy = true; } void -BrowserMessageArea::newProgressOperation( QNetworkReply *reply, const QString &text, QObject *obj, - const char *slot, Qt::ConnectionType type ) +BrowserMessageArea::newProgressOperationImpl( QNetworkReply *reply, const QString &text, QObject *obj, + const std::function &function, Qt::ConnectionType type ) { - NetworkProgressBar *newBar = new NetworkProgressBar( 0, reply ); + NetworkProgressBar *newBar = new NetworkProgressBar( nullptr, reply ); newBar->setDescription( text ); newBar->setAbortSlot( reply, &QNetworkReply::deleteLater ); connect( reply, &QNetworkReply::destroyed, m_progressBar, &CompoundProgressBar::endProgressOperation ); - newBar->setAbortSlot( obj, slot, type ); + newBar->setAbortSlot( obj, function, type ); m_progressBar->addProgressBar( newBar, reply ); m_progressBar->show(); m_busy = true; } void -BrowserMessageArea::newProgressOperation( QObject *sender, const QString &text, int maximum, - QObject *obj, const char *slot, Qt::ConnectionType type ) +BrowserMessageArea::newProgressOperationImpl( QObject *sender, const QMetaMethod &increment, const QMetaMethod &end, const QString &text, + int maximum, QObject *obj, const std::function &function, Qt::ConnectionType type ) { - ProgressBar *newBar = new ProgressBar( 0 ); + ProgressBar *newBar = new ProgressBar( nullptr ); newBar->setDescription( text ); newBar->setMaximum( maximum ); connect( sender, &QObject::destroyed, m_progressBar, &CompoundProgressBar::endProgressOperation, Qt::QueuedConnection ); - connect( sender, SIGNAL(endProgressOperation(QObject*)), m_progressBar, - SLOT(endProgressOperation(QObject*)), Qt::QueuedConnection ); - connect( sender, SIGNAL(incrementProgress()), m_progressBar, - SLOT(slotIncrementProgress()), Qt::QueuedConnection ); - connect( sender, SIGNAL(totalSteps(int)), newBar, SLOT(slotTotalSteps(int)) ); - newBar->setAbortSlot( obj, slot, type ); + int endIndex = m_progressBar->metaObject()->indexOfSlot( "endProgressOperation(QObject*)" ); + auto endSlot = m_progressBar->metaObject()->method( endIndex ); + connect( sender, end, m_progressBar, endSlot, Qt::QueuedConnection ); + int incrementIndex = m_progressBar->metaObject()->indexOfSlot( "slotIncrementProgress()" ); + auto incrementSlot = m_progressBar->metaObject()->method( incrementIndex ); + connect( sender, increment, m_progressBar, incrementSlot, Qt::QueuedConnection ); + if( sender->metaObject()->indexOfSignal( "totalSteps(int)" ) != -1 ) + connect( sender, SIGNAL(totalSteps(int)), newBar, SLOT(slotTotalSteps(int)) ); + newBar->setAbortSlot( obj, function, type ); m_progressBar->addProgressBar( newBar, sender ); m_progressBar->show(); @@ -152,15 +155,11 @@ } } -void -BrowserMessageArea::hideLongMessage() -{ - sender()->deleteLater(); -} - void BrowserMessageArea::slotLongMessage( const QString &text, MessageType type ) { - LongMessageWidget *message = new LongMessageWidget( this, text, type ); - connect( message, &LongMessageWidget::closed, this, &BrowserMessageArea::hideLongMessage ); + Q_UNUSED(type) + + LongMessageWidget *message = new LongMessageWidget( text ); + connect( message, &LongMessageWidget::closed, message, &QObject::deleteLater ); } diff --git a/src/browsers/CollectionSortFilterProxyModel.h b/src/browsers/CollectionSortFilterProxyModel.h --- a/src/browsers/CollectionSortFilterProxyModel.h +++ b/src/browsers/CollectionSortFilterProxyModel.h @@ -36,19 +36,18 @@ class CollectionSortFilterProxyModel : public QSortFilterProxyModel { public: - CollectionSortFilterProxyModel( QObject * parent = 0 ); + explicit CollectionSortFilterProxyModel( QObject *parent = nullptr ); virtual ~CollectionSortFilterProxyModel(); - bool hasChildren(const QModelIndex &parent) const; + bool hasChildren(const QModelIndex &parent) const override; protected: - virtual bool lessThan( const QModelIndex &left, const QModelIndex &right ) const; + bool lessThan( const QModelIndex &left, const QModelIndex &right ) const override; + bool filterAcceptsRow( int source_row, const QModelIndex & source_parent ) const override; private: QCollator *m_col; - /** Tries to compute a year for the album using the track years. */ - int albumYear( Meta::AlbumPtr album ) const; CollectionTreeItem* treeItem( const QModelIndex &index ) const; bool lessThanTrack( const QModelIndex &left, const QModelIndex &right ) const; diff --git a/src/browsers/CollectionSortFilterProxyModel.cpp b/src/browsers/CollectionSortFilterProxyModel.cpp --- a/src/browsers/CollectionSortFilterProxyModel.cpp +++ b/src/browsers/CollectionSortFilterProxyModel.cpp @@ -57,6 +57,24 @@ return sourceModel()->hasChildren(sourceParent); } +bool +CollectionSortFilterProxyModel::filterAcceptsRow( int source_row, const QModelIndex& source_parent ) const +{ + bool stringAccepted = QSortFilterProxyModel::filterAcceptsRow( source_row, source_parent ); + + if( AmarokConfig::showYears()) + { + QModelIndex index = sourceModel()->index( source_row, 0, source_parent ); + if( treeItem( index )->isAlbumItem() ) + { + bool yearLoaded = index.data( PrettyTreeRoles::YearRole ) >= 0; + return yearLoaded && stringAccepted; + } + } + + return stringAccepted; +} + bool CollectionSortFilterProxyModel::lessThan( const QModelIndex &left, const QModelIndex &right ) const { @@ -138,8 +156,8 @@ // compare by year if( AmarokConfig::showYears() ) { - int leftYear = albumYear( leftAlbum ); - int rightYear = albumYear( rightAlbum ); + int leftYear = left.data( PrettyTreeRoles::YearRole ).toInt(); + int rightYear = right.data( PrettyTreeRoles::YearRole ).toInt(); if( leftYear < rightYear ) return false; // left album is newer @@ -162,8 +180,8 @@ bool CollectionSortFilterProxyModel::lessThanItem( const QModelIndex &left, const QModelIndex &right ) const { - Meta::DataPtr leftData = Meta::DataPtr::dynamicCast( treeItem(left)->data() ); - Meta::DataPtr rightData = Meta::DataPtr::dynamicCast( treeItem(right)->data() ); + Meta::DataPtr leftData = treeItem(left)->data(); + Meta::DataPtr rightData = treeItem(right)->data(); if( !leftData || !rightData ) { @@ -190,20 +208,3 @@ { return static_cast( index.internalPointer() ); } - -int -CollectionSortFilterProxyModel::albumYear( Meta::AlbumPtr album ) const -{ - if( album->name().isEmpty() ) // an unnamed album has no year - return 0; - - Meta::TrackList tracks = album->tracks(); - if( !tracks.isEmpty() ) - { - Meta::YearPtr year = tracks.first()->year(); - if( year && (year->year() != 0) ) - return year->year(); - } - return 0; -} - diff --git a/src/browsers/CollectionTreeItem.h b/src/browsers/CollectionTreeItem.h --- a/src/browsers/CollectionTreeItem.h +++ b/src/browsers/CollectionTreeItem.h @@ -31,7 +31,6 @@ class AMAROK_EXPORT CollectionTreeItem : public QObject { Q_OBJECT - Q_ENUMS( Type ) public: enum Type @@ -42,9 +41,10 @@ NoLabel, Data }; + Q_ENUM( Type ) - CollectionTreeItem( CollectionTreeItemModelBase *model ); //root node - CollectionTreeItem( Meta::DataPtr data, CollectionTreeItem *parent, CollectionTreeItemModelBase *model ); //data node + explicit CollectionTreeItem( CollectionTreeItemModelBase *model ); //root node + CollectionTreeItem( const Meta::DataPtr &data, CollectionTreeItem *parent, CollectionTreeItemModelBase *model ); //data node CollectionTreeItem( Collections::Collection *parentCollection, CollectionTreeItem *parent, CollectionTreeItemModelBase *model ); //collection node //this ctor creates a "Various Artists" and "No Labels" nodes. do not use it for anything else CollectionTreeItem( Type type, const Meta::DataList &data, CollectionTreeItem *parent, CollectionTreeItemModelBase *model ); //various artist node @@ -97,7 +97,7 @@ bool allDescendentTracksLoaded() const; - //required to mark a tree item as dirty if the model has to requiry its childre + //required to mark a tree item as dirty if the model has to require its children Type type() const; bool requiresUpdate() const; diff --git a/src/browsers/CollectionTreeItem.cpp b/src/browsers/CollectionTreeItem.cpp --- a/src/browsers/CollectionTreeItem.cpp +++ b/src/browsers/CollectionTreeItem.cpp @@ -44,7 +44,7 @@ { } -CollectionTreeItem::CollectionTreeItem( Meta::DataPtr data, CollectionTreeItem *parent, CollectionTreeItemModelBase *model ) +CollectionTreeItem::CollectionTreeItem( const Meta::DataPtr &data, CollectionTreeItem *parent, CollectionTreeItemModelBase *model ) : m_data( data ) , m_parent( parent ) , m_model( model ) @@ -140,7 +140,7 @@ case Qt::DisplayRole: return i18nc( "No labels are assigned to the given item are any of its subitems", "No Labels" ); case Qt::DecorationRole: - return QIcon::fromTheme( "label-amarok" ); + return QIcon::fromTheme( QStringLiteral("label-amarok") ); } return QVariant(); } @@ -209,7 +209,7 @@ else m_trackCount = 0; m_isCounting = false; - emit dataUpdated(); + Q_EMIT dataUpdated(); } void diff --git a/src/browsers/CollectionTreeItemModel.h b/src/browsers/CollectionTreeItemModel.h --- a/src/browsers/CollectionTreeItemModel.h +++ b/src/browsers/CollectionTreeItemModel.h @@ -34,24 +34,24 @@ Q_OBJECT public: - CollectionTreeItemModel( const QList &levelType ); + explicit CollectionTreeItemModel( const QList &levelType ); /* QAbstractItemModel methods */ - virtual Qt::ItemFlags flags( const QModelIndex &index ) const; - virtual QVariant data( const QModelIndex &index, int role ) const; - virtual bool dropMimeData( const QMimeData *data, Qt::DropAction action, int row, - int column, const QModelIndex &parent ); - virtual bool canFetchMore( const QModelIndex &parent ) const; - virtual void fetchMore( const QModelIndex &parent ); - virtual Qt::DropActions supportedDropActions() const; + Qt::ItemFlags flags( const QModelIndex &index ) const override; + QVariant data( const QModelIndex &index, int role ) const override; + bool dropMimeData( const QMimeData *data, Qt::DropAction action, int row, + int column, const QModelIndex &parent ) override; + bool canFetchMore( const QModelIndex &parent ) const override; + void fetchMore( const QModelIndex &parent ) override; + Qt::DropActions supportedDropActions() const override; public Q_SLOTS: virtual void collectionAdded( Collections::Collection *newCollection ); virtual void collectionRemoved( const QString &collectionId ); protected: - virtual void filterChildren(); - virtual int levelModifier() const { return 0; } + void filterChildren() override; + int levelModifier() const override { return 0; } private Q_SLOTS: void requestCollectionsExpansion(); diff --git a/src/browsers/CollectionTreeItemModel.cpp b/src/browsers/CollectionTreeItemModel.cpp --- a/src/browsers/CollectionTreeItemModel.cpp +++ b/src/browsers/CollectionTreeItemModel.cpp @@ -137,7 +137,7 @@ sourceLocation = new Collections::FileCollectionLocation(); } - // we need to create target collection location per each source colleciton location + // we need to create target collection location per each source collection location // -- prepareSomething() takes ownership of the pointer. Collections::CollectionLocation *targetLocation = targetCollection->location(); Q_ASSERT(targetLocation); @@ -153,7 +153,6 @@ targetLocation ); } } - return true; } @@ -240,7 +239,7 @@ { for( int i = 0, count = m_rootItem->childCount(); i < count; i++ ) { - emit expandIndex( itemIndex( m_rootItem->child( i ) ) ); + Q_EMIT expandIndex( itemIndex( m_rootItem->child( i ) ) ); } } diff --git a/src/browsers/CollectionTreeItemModelBase.h b/src/browsers/CollectionTreeItemModelBase.h --- a/src/browsers/CollectionTreeItemModelBase.h +++ b/src/browsers/CollectionTreeItemModelBase.h @@ -38,6 +38,7 @@ } class CollectionTreeItem; class QTimeLine; +class TrackLoaderJob; typedef QPair CollectionRoot; @@ -48,25 +49,27 @@ { Q_OBJECT + friend class TrackLoaderJob; + public: CollectionTreeItemModelBase(); virtual ~CollectionTreeItemModelBase(); - virtual Qt::ItemFlags flags(const QModelIndex &index) const; - virtual QVariant headerData(int section, Qt::Orientation orientation, - int role = Qt::DisplayRole) const; - virtual QModelIndex index(int row, int column, - const QModelIndex &parent = QModelIndex()) const; - virtual QModelIndex parent(const QModelIndex &index) const; - virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; - virtual int columnCount(const QModelIndex &parent = QModelIndex()) const; - virtual bool hasChildren ( const QModelIndex & parent = QModelIndex() ) const; + Qt::ItemFlags flags(const QModelIndex &index) const override; + QVariant headerData(int section, Qt::Orientation orientation, + int role = Qt::DisplayRole) const override; + QModelIndex index(int row, int column, + const QModelIndex &parent = QModelIndex()) const override; + QModelIndex parent(const QModelIndex &index) const override; + int rowCount(const QModelIndex &parent = QModelIndex()) const override; + int columnCount(const QModelIndex &parent = QModelIndex()) const override; + bool hasChildren ( const QModelIndex & parent = QModelIndex() ) const override; // Writable.. - virtual bool setData( const QModelIndex &index, const QVariant &value, int role = Qt::EditRole ); + bool setData( const QModelIndex &index, const QVariant &value, int role = Qt::EditRole ) override; - virtual QStringList mimeTypes() const; - virtual QMimeData* mimeData( const QModelIndexList &indices ) const; + QStringList mimeTypes() const override; + QMimeData* mimeData( const QModelIndexList &indices ) const override; virtual QMimeData* mimeData( const QList &items ) const; virtual void listForLevel( int level, Collections::QueryMaker *qm, CollectionTreeItem* parent ); @@ -97,7 +100,7 @@ void ensureChildrenLoaded( CollectionTreeItem *item ); /** - * Get a pointer to colleciton tree item given its index. It is not safe to + * Get a pointer to collection tree item given its index. It is not safe to * cache this pointer unless QPointer is used. */ CollectionTreeItem *treeItem( const QModelIndex &index ) const; @@ -114,14 +117,14 @@ public Q_SLOTS: virtual void queryDone(); - void newTracksReady( Meta::TrackList ); - void newArtistsReady( Meta::ArtistList ); - void newAlbumsReady( Meta::AlbumList ); - void newGenresReady( Meta::GenreList ); - void newComposersReady( Meta::ComposerList ); - void newYearsReady( Meta::YearList ); - void newLabelsReady( Meta::LabelList ); - virtual void newDataReady( Meta::DataList data ); + void newTracksReady( const Meta::TrackList &); + void newArtistsReady( const Meta::ArtistList &); + void newAlbumsReady( const Meta::AlbumList &); + void newGenresReady( const Meta::GenreList &); + void newComposersReady( const Meta::ComposerList &); + void newYearsReady( const Meta::YearList &); + void newLabelsReady( const Meta::LabelList &); + virtual void newDataReady( const Meta::DataList &data ); /** * Apply the current filter. @@ -141,6 +144,10 @@ void handleNormalQueryResult( Collections::QueryMaker *qm, const Meta::DataList &dataList ); Collections::QueryMaker::QueryType mapCategoryToQueryType( int levelType ) const; + void tracksLoaded( const Meta::AlbumPtr &album, const QModelIndex &index, const Meta::TrackList &tracks ); + + QHash m_years; + mutable QSet m_loadingAlbums; protected: /** Adds the query maker to the running queries and connects the slots */ diff --git a/src/browsers/CollectionTreeItemModelBase.cpp b/src/browsers/CollectionTreeItemModelBase.cpp --- a/src/browsers/CollectionTreeItemModelBase.cpp +++ b/src/browsers/CollectionTreeItemModelBase.cpp @@ -35,18 +35,67 @@ #include "widgets/PrettyTreeRoles.h" #include +#include +#include #include #include #include +#include #include #include #include #include +#include + + using namespace Meta; +class TrackLoaderJob : public ThreadWeaver::Job +{ +public: + TrackLoaderJob( const QModelIndex &index, const Meta::AlbumPtr &album, CollectionTreeItemModelBase *model ) + : m_index( index ) + , m_album( album ) + , m_model( model ) + , m_abortRequested( false ) + { + if( !m_model || !m_album || !m_index.isValid() ) + requestAbort(); + } + + void requestAbort() override + { + m_abortRequested = true; + } + +protected: + void run( ThreadWeaver::JobPointer self, ThreadWeaver::Thread *thread ) override + { + Q_UNUSED( self ) + Q_UNUSED( thread ) + + if( m_abortRequested || !m_model ) + return; + + const auto tracks = m_album->tracks(); + + if( m_model && !m_abortRequested ) + { + auto slot = std::bind( &CollectionTreeItemModelBase::tracksLoaded, m_model, m_album, m_index, tracks ); + QTimer::singleShot( 0, m_model, slot ); + } + } + +private: + QModelIndex m_index; + Meta::AlbumPtr m_album; + QPointer m_model; + bool m_abortRequested; +}; + inline uint qHash( const Meta::DataPtr &data ) { return qHash( data.data() ); @@ -63,8 +112,8 @@ : QAbstractItemModel() , m_rootItem( 0 ) , m_animFrame( 0 ) - , m_loading1( QPixmap( QStandardPaths::locate( QStandardPaths::GenericDataLocation, "amarok/images/loading1.png" ) ) ) - , m_loading2( QPixmap( QStandardPaths::locate( QStandardPaths::GenericDataLocation, "amarok/images/loading2.png" ) ) ) + , m_loading1( QPixmap( QStandardPaths::locate( QStandardPaths::GenericDataLocation, QStringLiteral("amarok/images/loading1.png") ) ) ) + , m_loading2( QPixmap( QStandardPaths::locate( QStandardPaths::GenericDataLocation, QStringLiteral("amarok/images/loading2.png") ) ) ) , m_currentAnimPixmap( m_loading1 ) , m_autoExpand( false ) { @@ -76,7 +125,7 @@ CollectionTreeItemModelBase::~CollectionTreeItemModelBase() { - KConfigGroup config = Amarok::config( "Collection Browser" ); + KConfigGroup config = Amarok::config( QStringLiteral("Collection Browser") ); QList levelNumbers; foreach( CategoryId::CatMenuId category, levels() ) levelNumbers.append( category ); @@ -94,7 +143,6 @@ flags = Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsEditable; } return flags; - } bool @@ -114,7 +162,7 @@ if( ec ) { ec->setTitle( value.toString() ); - emit dataChanged( index, index ); + Q_EMIT dataChanged( index, index ); return true; } } @@ -129,7 +177,7 @@ if( ec ) ec->setAlbum( value.toString() ); } - emit dataChanged( index, index ); + Q_EMIT dataChanged( index, index ); return true; } } @@ -144,7 +192,7 @@ if( ec ) ec->setArtist( value.toString() ); } - emit dataChanged( index, index ); + Q_EMIT dataChanged( index, index ); return true; } } @@ -159,7 +207,7 @@ if( ec ) ec->setGenre( value.toString() ); } - emit dataChanged( index, index ); + Q_EMIT dataChanged( index, index ); return true; } } @@ -174,7 +222,7 @@ if( ec ) ec->setYear( value.toInt() ); } - emit dataChanged( index, index ); + Q_EMIT dataChanged( index, index ); return true; } } @@ -189,7 +237,7 @@ if( ec ) ec->setComposer( value.toString() ); } - emit dataChanged( index, index ); + Q_EMIT dataChanged( index, index ); return true; } } @@ -216,13 +264,13 @@ Meta::ArtistPtr artist = track->artist(); if( album && artist && album->isCompilation() ) - name.prepend( QString("%1 - ").arg(artist->prettyName()) ); + name.prepend( QStringLiteral("%1 - ").arg(artist->prettyName()) ); if( AmarokConfig::showTrackNumbers() ) { int trackNum = track->trackNumber(); if( trackNum > 0 ) - name.prepend( QString("%1 - ").arg(trackNum) ); + name.prepend( QStringLiteral("%1 - ").arg(trackNum) ); } // Check empty after track logic and before album logic @@ -232,7 +280,7 @@ } case Qt::DecorationRole: - return QIcon::fromTheme( "media-album-track" ); + return QIcon::fromTheme( QStringLiteral("media-album-track") ); case PrettyTreeRoles::SortRole: return track->sortableName(); } @@ -247,14 +295,25 @@ { QString name = album->prettyName(); // add years for named albums (if enabled) - if( AmarokConfig::showYears() && !album->name().isEmpty() ) + if( AmarokConfig::showYears() ) { - Meta::TrackList tracks = album->tracks(); - if( !tracks.isEmpty() ) + if( m_years.contains( album.data() ) ) { - Meta::YearPtr year = tracks.first()->year(); - if( year && (year->year() != 0) ) - name.prepend( QString("%1 - ").arg( year->name() ) ); + int year = m_years.value( album.data() ); + + if( year > 0 ) + name.prepend( QStringLiteral("%1 - ").arg( year ) ); + } + else if( !album->name().isEmpty() ) + { + if( !m_loadingAlbums.contains( album ) ) + { + m_loadingAlbums.insert( album ); + + auto nonConstThis = const_cast( this ); + auto job = QSharedPointer::create( itemIndex( item ), album, nonConstThis ); + ThreadWeaver::Queue::instance()->enqueue( job ); + } } } return name; @@ -276,6 +335,25 @@ case PrettyTreeRoles::HasCoverRole: return AmarokConfig::showAlbumArt(); + + case PrettyTreeRoles::YearRole: + { + if( m_years.contains( album.data() ) ) + return m_years.value( album.data() ); + + else if( !album->name().isEmpty() ) + { + if( !m_loadingAlbums.contains( album ) ) + { + m_loadingAlbums.insert( album ); + + auto nonConstThis = const_cast( this ); + auto job = QSharedPointer::create( itemIndex( item ), album, nonConstThis ); + ThreadWeaver::Queue::instance()->enqueue( job ); + } + } + return -1; + } } } else if( item->isDataItem() ) @@ -311,7 +389,7 @@ switch( role ) { case Qt::DecorationRole: - return QIcon::fromTheme( "similarartists-amarok" ); + return QIcon::fromTheme( QStringLiteral("similarartists-amarok") ); case Qt::DisplayRole: return i18n( "Various Artists" ); case PrettyTreeRoles::SortRole: @@ -503,7 +581,8 @@ return createIndex( item->row(), 0, item ); } -void CollectionTreeItemModelBase::listForLevel(int level, Collections::QueryMaker * qm, CollectionTreeItem * parent) +void +CollectionTreeItemModelBase::listForLevel(int level, Collections::QueryMaker * qm, CollectionTreeItem * parent) { if( qm && parent ) { @@ -615,6 +694,37 @@ return type; } +void +CollectionTreeItemModelBase::tracksLoaded( const Meta::AlbumPtr &album, const QModelIndex &index, const Meta::TrackList& tracks ) +{ + DEBUG_BLOCK + + if( !album ) + return; + + m_loadingAlbums.remove( album ); + + if( !index.isValid() ) + return; + + int year = 0; + + if( !tracks.isEmpty() ) + { + Meta::YearPtr yearPtr = tracks.first()->year(); + if( yearPtr ) + year = yearPtr->year(); + + debug() << "Valid album year found:" << year; + } + + if( !m_years.contains( album.data() ) || m_years.value( album.data() ) != year ) + { + m_years[ album.data() ] = year; + Q_EMIT dataChanged( index, index ); + } +} + void CollectionTreeItemModelBase::addQueryMaker( CollectionTreeItem* item, Collections::QueryMaker *qm ) const @@ -652,13 +762,13 @@ //reset icon for this item if( item && item != m_rootItem ) { - emit dataChanged( itemIndex( item ), itemIndex( item ) ); + Q_EMIT dataChanged( itemIndex( item ), itemIndex( item ) ); } //stop timer if there are no more animations active if( m_runningQueries.isEmpty() ) { - emit allQueriesFinished( m_autoExpand ); + Q_EMIT allQueriesFinished( m_autoExpand ); m_autoExpand = false; // reset to default value m_timeLine->stop(); } @@ -668,61 +778,61 @@ // TODO /** Small helper function to convert a list of e.g. tracks to a list of DataPtr */ -template +template static Meta::DataList -convertToDataList( const ListType& list ) +convertToDataList( const QList& list ) { Meta::DataList data; - foreach( PointerType p, list ) + for( const auto &p : list ) data << Meta::DataPtr::staticCast( p ); return data; } void -CollectionTreeItemModelBase::newTracksReady( Meta::TrackList res ) +CollectionTreeItemModelBase::newTracksReady( const Meta::TrackList &res ) { - newDataReady( convertToDataList( res ) ); + newDataReady( convertToDataList( res ) ); } void -CollectionTreeItemModelBase::newArtistsReady( Meta::ArtistList res ) +CollectionTreeItemModelBase::newArtistsReady( const Meta::ArtistList &res ) { - newDataReady( convertToDataList( res ) ); + newDataReady( convertToDataList( res ) ); } void -CollectionTreeItemModelBase::newAlbumsReady( Meta::AlbumList res ) +CollectionTreeItemModelBase::newAlbumsReady( const Meta::AlbumList &res ) { - newDataReady( convertToDataList( res ) ); + newDataReady( convertToDataList( res ) ); } void -CollectionTreeItemModelBase::newGenresReady( Meta::GenreList res ) +CollectionTreeItemModelBase::newGenresReady( const Meta::GenreList &res ) { - newDataReady( convertToDataList( res ) ); + newDataReady( convertToDataList( res ) ); } void -CollectionTreeItemModelBase::newComposersReady( Meta::ComposerList res ) +CollectionTreeItemModelBase::newComposersReady( const Meta::ComposerList &res ) { - newDataReady( convertToDataList( res ) ); + newDataReady( convertToDataList( res ) ); } void -CollectionTreeItemModelBase::newYearsReady( Meta::YearList res ) +CollectionTreeItemModelBase::newYearsReady( const Meta::YearList &res ) { - newDataReady( convertToDataList( res ) ); + newDataReady( convertToDataList( res ) ); } void -CollectionTreeItemModelBase::newLabelsReady( Meta::LabelList res ) +CollectionTreeItemModelBase::newLabelsReady( const Meta::LabelList &res ) { - newDataReady( convertToDataList( res ) ); + newDataReady( convertToDataList( res ) ); } void -CollectionTreeItemModelBase::newDataReady( Meta::DataList data ) +CollectionTreeItemModelBase::newDataReady( const Meta::DataList &data ) { //if we are expanding an item, we'll find the sender in childQueries //otherwise we are filtering all collections @@ -743,7 +853,7 @@ void CollectionTreeItemModelBase::handleSpecialQueryResult( CollectionTreeItem::Type type, Collections::QueryMaker *qm, const Meta::DataList &dataList ) { - CollectionTreeItem *parent = 0; + CollectionTreeItem *parent = nullptr; if( type == CollectionTreeItem::VariousArtist ) parent = m_compilationQueries.value( qm ); @@ -835,7 +945,7 @@ { if( m_expandedSpecialNodes.contains( parent->parentCollection() ) ) { - emit expandIndex( createIndex( 0, 0, specialNode ) ); //we have just inserted the vaItem at row 0 + Q_EMIT expandIndex( createIndex( 0, 0, specialNode ) ); //we have just inserted the vaItem at row 0 } } } @@ -852,7 +962,7 @@ if ( parent->isDataItem() ) { if ( m_expandedItems.contains( parent->data() ) ) - emit expandIndex( parentIndex ); + Q_EMIT expandIndex( parentIndex ); else //simply insert the item, nothing will change if it is already in the set m_expandedItems.insert( parent->data() ); @@ -868,7 +978,7 @@ // add new rows after existing ones here (which means all artists nodes // will be inserted after the "Various Artists" node) // figure out which children of parent have to be removed, - // which new children have to be added, and preemptively emit dataChanged for the rest + // which new children have to be added, and preemptively Q_EMIT dataChanged for the rest // have to check how that influences performance... const QSet dataSet = dataList.toSet(); QSet childrenSet; @@ -884,7 +994,7 @@ const QSet dataToBeRemoved = childrenSet - dataSet; // first remove all rows that have to be removed - // walking through the cildren in reverse order does not screw up the order + // walking through the children in reverse order does not screw up the order for( int i = parent->childCount() - 1; i >= 0; i-- ) { CollectionTreeItem *child = parent->child( i ); @@ -912,13 +1022,13 @@ } else { - // the remainging child items may be dirty, so refresh them + // the remaining child items may be dirty, so refresh them if( child->isDataItem() && child->data() && m_expandedItems.contains( child->data() ) ) ensureChildrenLoaded( child ); // tell the view that the existing children may have changed QModelIndex idx = index( i, 0, parentIndex ); - emit dataChanged( idx, idx ); + Q_EMIT dataChanged( idx, idx ); } } @@ -954,22 +1064,22 @@ switch( category ) { case CategoryId::Album : - return QIcon::fromTheme( "media-optical-amarok" ); + return QIcon::fromTheme( QStringLiteral("media-optical-amarok") ); case CategoryId::Artist : - return QIcon::fromTheme( "view-media-artist-amarok" ); + return QIcon::fromTheme( QStringLiteral("view-media-artist-amarok") ); case CategoryId::AlbumArtist : - return QIcon::fromTheme( "view-media-artist-amarok" ); + return QIcon::fromTheme( QStringLiteral("view-media-artist-amarok") ); case CategoryId::Composer : - return QIcon::fromTheme( "filename-composer-amarok" ); + return QIcon::fromTheme( QStringLiteral("filename-composer-amarok") ); case CategoryId::Genre : - return QIcon::fromTheme( "favorite-genres-amarok" ); + return QIcon::fromTheme( QStringLiteral("favorite-genres-amarok") ); case CategoryId::Year : - return QIcon::fromTheme( "clock" ); + return QIcon::fromTheme( QStringLiteral("clock") ); case CategoryId::Label : - return QIcon::fromTheme( "label-amarok" ); + return QIcon::fromTheme( QStringLiteral("label-amarok") ); case CategoryId::None: default: - return QIcon::fromTheme( "image-missing" ); + return QIcon::fromTheme( QStringLiteral("image-missing") ); } } @@ -1069,7 +1179,7 @@ { if( item == m_rootItem ) continue; - emit dataChanged( itemIndex( item ), itemIndex( item ) ); + Q_EMIT dataChanged( itemIndex( item ), itemIndex( item ) ); } } @@ -1097,7 +1207,7 @@ { CollectionTreeItem *expandedItem = m_collections.value( expanded->collectionId() ).second; if( expandedItem ) - emit expandIndex( itemIndex( expandedItem ) ); + Q_EMIT expandIndex( itemIndex( expandedItem ) ); } } diff --git a/src/browsers/CollectionTreeView.h b/src/browsers/CollectionTreeView.h --- a/src/browsers/CollectionTreeView.h +++ b/src/browsers/CollectionTreeView.h @@ -47,7 +47,7 @@ Q_OBJECT public: - explicit CollectionTreeView( QWidget *parent = 0 ); + explicit CollectionTreeView( QWidget *parent = nullptr ); ~CollectionTreeView(); QSortFilterProxyModel* filterModel() const; @@ -57,7 +57,7 @@ void setLevel( int level, CategoryId::CatMenuId type ); - void setModel( QAbstractItemModel *model ); + void setModel( QAbstractItemModel *model ) override; //Helper function to remove children if their parent is already present static QSet cleanItemSet( const QSet &items ); @@ -91,16 +91,16 @@ void addingFilteredTracksDone(); protected: - void contextMenuEvent( QContextMenuEvent *event ); - void mouseDoubleClickEvent( QMouseEvent *event ); - void mouseReleaseEvent( QMouseEvent *event ); - void keyPressEvent( QKeyEvent *event ); - void dragEnterEvent( QDragEnterEvent *event ); - void dragMoveEvent( QDragMoveEvent *event ); - void startDrag( Qt::DropActions supportedActions ); + void contextMenuEvent( QContextMenuEvent *event ) override; + void mouseDoubleClickEvent( QMouseEvent *event ) override; + void mouseReleaseEvent( QMouseEvent *event ) override; + void keyPressEvent( QKeyEvent *event ) override; + void dragEnterEvent( QDragEnterEvent *event ) override; + void dragMoveEvent( QDragMoveEvent *event ) override; + void startDrag( Qt::DropActions supportedActions ) override; protected Q_SLOTS: - virtual void selectionChanged ( const QItemSelection & selected, const QItemSelection & deselected ); + void selectionChanged ( const QItemSelection & selected, const QItemSelection & deselected ) override; void slotCollapsed( const QModelIndex &index ); void slotExpanded( const QModelIndex &index ); void slotExpandIndex( const QModelIndex &index ); @@ -131,13 +131,13 @@ // creates different actions from the different objects. // note: you should not delete the created actions. - QActionList createBasicActions( const QModelIndexList &indcies ); - QActionList createExtendedActions( const QModelIndexList &indcies ); + QActionList createBasicActions( const QModelIndexList &indices ); + QActionList createExtendedActions( const QModelIndexList &indices ); QActionList createCollectionActions( const QModelIndexList &indices ); QActionList createCustomActions( const QModelIndexList &indices ); - QHash getCopyActions( const QModelIndexList &indcies ); - QHash getMoveActions( const QModelIndexList &indcies ); + QHash getCopyActions( const QModelIndexList &indices ); + QHash getMoveActions( const QModelIndexList &indices ); CollectionTreeItem* getItemFromIndex( QModelIndex &index ); diff --git a/src/browsers/CollectionTreeView.cpp b/src/browsers/CollectionTreeView.cpp --- a/src/browsers/CollectionTreeView.cpp +++ b/src/browsers/CollectionTreeView.cpp @@ -87,7 +87,7 @@ deleteLater(); // nothing to do } - private slots: + private Q_SLOTS: void slotScroll() { deleteLater(); @@ -134,7 +134,7 @@ slotExpandMore(); } - private slots: + private Q_SLOTS: void slotExpandMore() { const int maxChildrenToExpand = 3; @@ -349,7 +349,7 @@ if( albumActions.count() > 1 ) { menuAlbum.addActions( albumActions ); - menuAlbum.setIcon( QIcon::fromTheme( "filename-album-amarok" ) ); + menuAlbum.setIcon( QIcon::fromTheme( QStringLiteral("filename-album-amarok") ) ); menu.addMenu( &menuAlbum ); menu.addSeparator(); } @@ -368,7 +368,7 @@ if( collectionActions.count() > 1 ) { - menuCollection.setIcon( QIcon::fromTheme( "drive-harddisk" ) ); + menuCollection.setIcon( QIcon::fromTheme( QStringLiteral("drive-harddisk") ) ); menuCollection.addActions( collectionActions ); menu.addMenu( &menuCollection ); menu.addSeparator(); @@ -384,16 +384,16 @@ if( !m_currentCopyDestination.empty() ) { QMenu *copyMenu = new QMenu( i18n( "Copy to Collection" ), &menu ); - copyMenu->setIcon( QIcon::fromTheme( "edit-copy" ) ); + copyMenu->setIcon( QIcon::fromTheme( QStringLiteral("edit-copy") ) ); copyMenu->addActions( m_currentCopyDestination.keys() ); menu.addMenu( copyMenu ); } //Move = copy + delete from source if( !m_currentMoveDestination.empty() ) { QMenu *moveMenu = new QMenu( i18n( "Move to Collection" ), &menu ); - moveMenu->setIcon( QIcon::fromTheme( "go-jump" ) ); + moveMenu->setIcon( QIcon::fromTheme( QStringLiteral("go-jump") ) ); moveMenu->addActions( m_currentMoveDestination.keys() ); menu.addMenu( moveMenu ); } @@ -405,7 +405,7 @@ if( collection && collection->isWritable() ) { //TODO: don't recreate action - QAction *trashAction = new QAction( QIcon::fromTheme( "user-trash" ), + QAction *trashAction = new QAction( QIcon::fromTheme( QStringLiteral("user-trash") ), i18n( "Move Tracks to Trash" ), &menu ); trashAction->setProperty( "popupdropper_svg_id", "delete" ); @@ -416,7 +416,7 @@ this, &CollectionTreeView::slotTrashTracks ); menu.addAction( trashAction ); - QAction *deleteAction = new QAction( QIcon::fromTheme( "remove-amarok" ), + QAction *deleteAction = new QAction( QIcon::fromTheme( QStringLiteral("remove-amarok") ), i18n( "Delete Tracks" ), &menu ); deleteAction->setProperty( "popupdropper_svg_id", "delete" ); @@ -561,7 +561,7 @@ case Qt::Key_Up: if( current.parent() == QModelIndex() && current.row() == 0 ) { - emit leavingTree(); + Q_EMIT leavingTree(); return; } break; @@ -737,7 +737,7 @@ CollectionTreeItem *item = static_cast( index.internalPointer() ); - emit( itemSelected ( item ) ); + Q_EMIT( itemSelected ( item ) ); } void @@ -862,7 +862,7 @@ foreach( collection, collections ) { - if ( collection->collectionId() == "localCollection" ) + if ( collection->collectionId() == QLatin1String("localCollection") ) break; } @@ -1054,7 +1054,7 @@ } if( !items.isEmpty() ) playChildTracks( items, Playlist::OnAppendToPlaylistAction ); - emit addingFilteredTracksDone(); + Q_EMIT addingFilteredTracksDone(); } } @@ -1067,7 +1067,7 @@ { if( m_appendAction == 0 ) { - m_appendAction = new QAction( QIcon::fromTheme( "media-track-add-amarok" ), + m_appendAction = new QAction( QIcon::fromTheme( QStringLiteral("media-track-add-amarok") ), i18n( "&Add to Playlist" ), this ); m_appendAction->setProperty( "popupdropper_svg_id", "append" ); connect( m_appendAction, &QAction::triggered, this, &CollectionTreeView::slotAppendChildTracks ); @@ -1127,7 +1127,7 @@ { if( m_organizeAction == 0 ) { - m_organizeAction = new QAction( QIcon::fromTheme("folder-open" ), + m_organizeAction = new QAction( QIcon::fromTheme(QStringLiteral("folder-open") ), i18nc( "Organize Files", "Organize Files" ), this ); m_organizeAction->setProperty( "popupdropper_svg_id", "organize" ); connect( m_organizeAction, &QAction::triggered, @@ -1160,7 +1160,7 @@ if( m_editAction == 0 ) { - m_editAction = new QAction( QIcon::fromTheme( "media-track-edit-amarok" ), + m_editAction = new QAction( QIcon::fromTheme( QStringLiteral("media-track-edit-amarok") ), i18n( "&Edit Track Details" ), this ); setProperty( "popupdropper_svg_id", "edit" ); connect( m_editAction, &QAction::triggered, this, &CollectionTreeView::slotEditTracks ); diff --git a/src/browsers/InfoObserver.h b/src/browsers/InfoObserver.h --- a/src/browsers/InfoObserver.h +++ b/src/browsers/InfoObserver.h @@ -29,7 +29,7 @@ class AMAROK_EXPORT InfoObserver{ public: virtual void infoChanged( QVariantMap infoMap ) = 0; - virtual ~InfoObserver() {}; + virtual ~InfoObserver() {} }; #endif diff --git a/src/browsers/InfoProxy.cpp b/src/browsers/InfoProxy.cpp --- a/src/browsers/InfoProxy.cpp +++ b/src/browsers/InfoProxy.cpp @@ -49,9 +49,9 @@ weights << 10 << 4 << 8 << 2 << 6 << 5 << 10 << 9 << 3 << 1 << 3 << 5 << 7 << 9 << 3 << 2 << 10 << 6 << 4; - m_storedCloud["cloud_name"] = QVariant( "test cloud" ); - m_storedCloud["cloud_strings"] = QVariant( strings ); - m_storedCloud["cloud_weights"] = QVariant( weights ); + m_storedCloud[QStringLiteral("cloud_name")] = QVariant( "test cloud" ); + m_storedCloud[QStringLiteral("cloud_strings")] = QVariant( strings ); + m_storedCloud[QStringLiteral("cloud_weights")] = QVariant( weights ); loadHomePage(); } @@ -135,7 +135,7 @@ { DEBUG_BLOCK - QUrl dataUrl( QStandardPaths::locate( QStandardPaths::GenericDataLocation, "amarok/data/" ) ); + QUrl dataUrl( QStandardPaths::locate( QStandardPaths::GenericDataLocation, QStringLiteral("amarok/data/") ) ); QString dataPath = dataUrl.path(); //load html @@ -150,21 +150,21 @@ QString html = file.readAll(); - QUrl imageUrl( QStandardPaths::locate( QStandardPaths::GenericDataLocation, "amarok/images/" ) ); + QUrl imageUrl( QStandardPaths::locate( QStandardPaths::GenericDataLocation, QStringLiteral("amarok/images/") ) ); QString imagePath = imageUrl.url(); - html.replace( "_PATH_", imagePath ); + html.replace( QLatin1String("_PATH_"), imagePath ); - html.replace( "{background_color}", The::paletteHandler()->highlightColor().lighter( 150 ).name() ); - html.replace( "{border_color}", The::paletteHandler()->highlightColor().lighter( 150 ).name() ); - html.replace( "{text_color}", pApp->palette().brush( QPalette::Text ).color().name() ); + html.replace( QLatin1String("{background_color}"), The::paletteHandler()->highlightColor().lighter( 150 ).name() ); + html.replace( QLatin1String("{border_color}"), The::paletteHandler()->highlightColor().lighter( 150 ).name() ); + html.replace( QLatin1String("{text_color}"), pApp->palette().brush( QPalette::Text ).color().name() ); QColor highlight( pApp->palette().highlight().color() ); highlight.setHsvF( highlight.hueF(), 0.3, .95, highlight.alphaF() ); - html.replace( "{header_background_color}", highlight.name() ); + html.replace( QLatin1String("{header_background_color}"), highlight.name() ); - m_storedInfo["service_name"] = i18n( "Home" ); - m_storedInfo["main_info"] = html; + m_storedInfo[QStringLiteral("service_name")] = i18n( "Home" ); + m_storedInfo[QStringLiteral("main_info")] = html; notifyObservers( m_storedInfo ); } diff --git a/src/browsers/SingleCollectionTreeItemModel.h b/src/browsers/SingleCollectionTreeItemModel.h --- a/src/browsers/SingleCollectionTreeItemModel.h +++ b/src/browsers/SingleCollectionTreeItemModel.h @@ -40,14 +40,14 @@ SingleCollectionTreeItemModel( Collections::Collection *collection, const QList &levelType ); - virtual QVariant data(const QModelIndex &index, int role) const; - virtual bool canFetchMore( const QModelIndex &parent ) const; - virtual void fetchMore( const QModelIndex &parent ); - virtual Qt::ItemFlags flags(const QModelIndex &index) const; + QVariant data(const QModelIndex &index, int role) const override; + bool canFetchMore( const QModelIndex &parent ) const override; + void fetchMore( const QModelIndex &parent ) override; + Qt::ItemFlags flags(const QModelIndex &index) const override; protected: - virtual void filterChildren(); - virtual int levelModifier() const { return 1; } + void filterChildren() override; + int levelModifier() const override { return 1; } private: diff --git a/src/browsers/collectionbrowser/CollectionBrowserTreeView.h b/src/browsers/collectionbrowser/CollectionBrowserTreeView.h --- a/src/browsers/collectionbrowser/CollectionBrowserTreeView.h +++ b/src/browsers/collectionbrowser/CollectionBrowserTreeView.h @@ -26,7 +26,7 @@ class CollectionBrowserTreeView : public CollectionTreeView { public: - explicit CollectionBrowserTreeView( QWidget *parent = 0 ); + explicit CollectionBrowserTreeView( QWidget *parent = nullptr ); ~CollectionBrowserTreeView(); }; diff --git a/src/browsers/collectionbrowser/CollectionWidget.h b/src/browsers/collectionbrowser/CollectionWidget.h --- a/src/browsers/collectionbrowser/CollectionWidget.h +++ b/src/browsers/collectionbrowser/CollectionWidget.h @@ -28,33 +28,33 @@ class CollectionWidget : public BrowserCategory { Q_OBJECT - Q_ENUMS( ViewMode ) public: enum ViewMode { UnifiedCollection, NormalCollections }; + Q_ENUM( ViewMode ) - CollectionWidget( const QString &name , QWidget *parent ); - ~CollectionWidget(); + explicit CollectionWidget( const QString &name , QWidget *parent ); + ~CollectionWidget() override; static CollectionWidget *instance() { return s_instance; } - QString filter() const; + QString filter() const override; /** * Apply a filter to the tree view. * @param filter The filter to apply. */ - void setFilter( const QString &filter ); + void setFilter( const QString &filter ) override; /** Return the current views selected levels */ - QList levels() const; + QList levels() const override; /** Set the current views selected levels */ - void setLevels( const QList &levels ); + void setLevels( const QList &levels ) override; void focusInputLine(); CollectionBrowserTreeView *currentView(); diff --git a/src/browsers/collectionbrowser/CollectionWidget.cpp b/src/browsers/collectionbrowser/CollectionWidget.cpp --- a/src/browsers/collectionbrowser/CollectionWidget.cpp +++ b/src/browsers/collectionbrowser/CollectionWidget.cpp @@ -52,7 +52,7 @@ #include #include -CollectionWidget *CollectionWidget::s_instance = 0; +CollectionWidget *CollectionWidget::s_instance = nullptr; #define CATEGORY_LEVEL_COUNT 3 @@ -82,7 +82,7 @@ CollectionBrowserTreeView * CollectionWidget::Private::view( CollectionWidget::ViewMode mode ) { - CollectionBrowserTreeView *v(0); + CollectionBrowserTreeView *v(nullptr); switch( mode ) { @@ -145,7 +145,7 @@ setObjectName( name ); //TODO: we have a really nice opportunity to make these info blurbs both helpful and pretty setLongDescription( i18n( "This is where you will find your local music, as well as music from mobile audio players and CDs." ) ); - setImagePath( QStandardPaths::locate( QStandardPaths::GenericDataLocation, "amarok/images/hover_info_collections.png" ) ); + setImagePath( QStandardPaths::locate( QStandardPaths::GenericDataLocation, QStringLiteral("amarok/images/hover_info_collections.png") ) ); // set background if( AmarokConfig::showBrowserBackgroundImage() ) @@ -159,7 +159,7 @@ // -- read the current view mode from the configuration const QMetaObject *mo = metaObject(); const QMetaEnum me = mo->enumerator( mo->indexOfEnumerator( "ViewMode" ) ); - const QString &value = Amarok::config( "Collection Browser" ).readEntry( "View Mode" ); + const QString &value = Amarok::config( QStringLiteral("Collection Browser") ).readEntry( "View Mode" ); int enumValue = me.keyToValue( value.toLocal8Bit().constData() ); enumValue == -1 ? d->viewMode = NormalCollections : d->viewMode = (ViewMode) enumValue; @@ -180,7 +180,7 @@ QString(Meta::shortI18nForField( Meta::valCreateDate ) + ":<1m") ); combo->insertSeparator( combo->count() ); - QMenu *filterMenu = new QMenu( 0 ); + QMenu *filterMenu = new QMenu( nullptr ); using namespace CategoryId; static const QList > levelPresets = QList >() @@ -261,14 +261,14 @@ d->searchWidget->toolBar()->addSeparator(); - QAction *toggleAction = new QAction( QIcon::fromTheme( "view-list-tree" ), i18n( "Merged View" ), this ); + QAction *toggleAction = new QAction( QIcon::fromTheme( QStringLiteral("view-list-tree") ), i18n( "Merged View" ), this ); toggleAction->setCheckable( true ); toggleAction->setChecked( d->viewMode == CollectionWidget::UnifiedCollection ); toggleView( d->viewMode == CollectionWidget::UnifiedCollection ); connect( toggleAction, &QAction::triggered, this, &CollectionWidget::toggleView ); d->searchWidget->toolBar()->addAction( toggleAction ); - QAction *searchMenuAction = new QAction( QIcon::fromTheme( "preferences-other" ), i18n( "Sort Options" ), this ); + QAction *searchMenuAction = new QAction( QIcon::fromTheme( QStringLiteral("preferences-other") ), i18n( "Sort Options" ), this ); searchMenuAction->setMenu( filterMenu ); d->searchWidget->toolBar()->addAction( searchMenuAction ); @@ -288,7 +288,7 @@ void CollectionWidget::focusInputLine() { - return d->searchWidget->comboBox()->setFocus(); + d->searchWidget->comboBox()->setFocus(); } void @@ -359,7 +359,7 @@ void CollectionWidget::setLevels( const QList &levels ) { - // -- select the corrrect menu entries + // -- select the correct menu entries QSet encounteredLevels; for( int i = 0; i < CATEGORY_LEVEL_COUNT; i++ ) { @@ -423,13 +423,13 @@ const QMetaObject *mo = metaObject(); const QMetaEnum me = mo->enumerator( mo->indexOfEnumerator( "ViewMode" ) ); - Amarok::config( "Collection Browser" ).writeEntry( "View Mode", me.valueToKey( d->viewMode ) ); + Amarok::config( QStringLiteral("Collection Browser") ).writeEntry( "View Mode", me.valueToKey( d->viewMode ) ); } QList CollectionWidget::readLevelsFromConfig() const { - QList levelNumbers = Amarok::config( "Collection Browser" ).readEntry( "TreeCategory", QList() ); + QList levelNumbers = Amarok::config( QStringLiteral("Collection Browser") ).readEntry( "TreeCategory", QList() ); QList levels; // we changed "Track Artist" to "Album Artist" default before Amarok 2.8. Migrate user diff --git a/src/browsers/filebrowser/DirPlaylistTrackFilterProxyModel.h b/src/browsers/filebrowser/DirPlaylistTrackFilterProxyModel.h --- a/src/browsers/filebrowser/DirPlaylistTrackFilterProxyModel.h +++ b/src/browsers/filebrowser/DirPlaylistTrackFilterProxyModel.h @@ -29,10 +29,10 @@ Q_OBJECT public: - explicit DirPlaylistTrackFilterProxyModel( QObject *parent = 0 ); + explicit DirPlaylistTrackFilterProxyModel( QObject *parent = nullptr ); protected: - virtual bool filterAcceptsRow( int source_row, const QModelIndex &source_parent ) const; + bool filterAcceptsRow( int source_row, const QModelIndex &source_parent ) const override; }; #endif // DIRPLAYLISTTRACKFILTERPROXYMODEL_H diff --git a/src/browsers/filebrowser/FileBrowser.h b/src/browsers/filebrowser/FileBrowser.h --- a/src/browsers/filebrowser/FileBrowser.h +++ b/src/browsers/filebrowser/FileBrowser.h @@ -30,9 +30,9 @@ public: FileBrowser( const char *name, QWidget *parent ); - ~FileBrowser(); + ~FileBrowser() override; - virtual void setupAddItems(); + void setupAddItems() override; /** * Navigate to a specific directory @@ -50,7 +50,7 @@ protected Q_SLOTS: void slotNavigateToDirectory( const QModelIndex &index ); - virtual void reActivate(); + void reActivate() override; /** * Shows/hides the columns as selected in the context menu of the header of the @@ -85,7 +85,7 @@ void refresh(); /** - * Handle results of tryiong to setup an item in "places" that needed mouting or other + * Handle results of trying to setup an item in "places" that needed mounting or other * special setup. * @param index the index that we tried to setup * @param success did the setup succeed? diff --git a/src/browsers/filebrowser/FileBrowser.cpp b/src/browsers/filebrowser/FileBrowser.cpp --- a/src/browsers/filebrowser/FileBrowser.cpp +++ b/src/browsers/filebrowser/FileBrowser.cpp @@ -67,7 +67,7 @@ upAction = KStandardAction::up( q, &FileBrowser::up, topHBox ); homeAction = KStandardAction::home( q, &FileBrowser::home, topHBox ); - refreshAction = new QAction( QIcon::fromTheme("view-refresh"), i18n( "Refresh" ), topHBox ); + refreshAction = new QAction( QIcon::fromTheme(QStringLiteral("view-refresh")), i18n( "Refresh" ), topHBox ); QObject::connect( refreshAction, &QAction::triggered, q, &FileBrowser::refresh ); navigationToolbar->addAction( backAction ); @@ -469,7 +469,7 @@ // other additional items while( !workingUrl.midRef( currentPosition ).isEmpty() ) { - int nextPosition = workingUrl.indexOf( '/', currentPosition ) + 1; + int nextPosition = workingUrl.indexOf( QLatin1Char('/'), currentPosition ) + 1; if( nextPosition <= 0 ) nextPosition = workingUrl.length(); diff --git a/src/browsers/filebrowser/FileBrowser_p.h b/src/browsers/filebrowser/FileBrowser_p.h --- a/src/browsers/filebrowser/FileBrowser_p.h +++ b/src/browsers/filebrowser/FileBrowser_p.h @@ -100,13 +100,13 @@ Q_OBJECT public: - DirBrowserModel( QObject *parent = 0 ) : KDirModel( parent ) + explicit DirBrowserModel( QObject *parent = nullptr ) : KDirModel( parent ) { } virtual ~DirBrowserModel() {} - virtual QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const + QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const override { if( role == Qt::SizeHintRole ) return QSize( 1, QFontMetrics( QFont() ).height() + 4 ); @@ -120,13 +120,13 @@ Q_OBJECT public: - FilePlacesModel( QObject *parent = 0 ) : KFilePlacesModel( parent ) + explicit FilePlacesModel( QObject *parent = nullptr ) : KFilePlacesModel( parent ) { } virtual ~FilePlacesModel() {} - virtual QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const + QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const override { if( role == Qt::SizeHintRole ) return QSize( 1, QFontMetrics( QFont() ).height() + 4 ); diff --git a/src/browsers/filebrowser/FileView.h b/src/browsers/filebrowser/FileView.h --- a/src/browsers/filebrowser/FileView.h +++ b/src/browsers/filebrowser/FileView.h @@ -38,7 +38,7 @@ class CollectionAction : public QAction { public: - explicit CollectionAction( Collections::Collection *coll, QObject *parent = 0 ) + explicit CollectionAction( Collections::Collection *coll, QObject *parent = nullptr ) : QAction( parent ) , m_collection( coll ) { @@ -60,7 +60,7 @@ Q_OBJECT public: - FileView( QWidget *parent ); + explicit FileView( QWidget *parent ); Q_SIGNALS: void navigateToDirectory( const QModelIndex &index ); @@ -94,13 +94,13 @@ void addIndexToPlaylist( const QModelIndex &idx, Playlist::AddOptions options ); void addIndicesToPlaylist( QModelIndexList indices, Playlist::AddOptions options ); - virtual void contextMenuEvent( QContextMenuEvent *e ); - virtual void mouseReleaseEvent( QMouseEvent *event ); - virtual void mouseDoubleClickEvent( QMouseEvent *event ); + void contextMenuEvent( QContextMenuEvent *e ) override; + void mouseReleaseEvent( QMouseEvent *event ) override; + void mouseDoubleClickEvent( QMouseEvent *event ) override; - virtual void keyPressEvent( QKeyEvent *event ); + void keyPressEvent( QKeyEvent *event ) override; - virtual void startDrag( Qt::DropActions supportedActions ); + void startDrag( Qt::DropActions supportedActions ) override; KFileItemList selectedItems() const; private: diff --git a/src/browsers/filebrowser/FileView.cpp b/src/browsers/filebrowser/FileView.cpp --- a/src/browsers/filebrowser/FileView.cpp +++ b/src/browsers/filebrowser/FileView.cpp @@ -111,8 +111,8 @@ } if( !writableCollections.isEmpty() ) { - QMenu *copyMenu = new QMenu( i18n( "Copy to Collection" ), &menu ); - copyMenu->setIcon( QIcon::fromTheme( "edit-copy" ) ); + QMenu *copyMenu = new QMenu( i18n( ("Copy to Collection") ), &menu ); + copyMenu->setIcon( QIcon::fromTheme( QStringLiteral("edit-copy") ) ); foreach( Collections::Collection *coll, writableCollections ) { CollectionAction *copyAction = new CollectionAction( coll, &menu ); @@ -122,7 +122,7 @@ menu.addMenu( copyMenu ); QMenu *moveMenu = new QMenu( i18n( "Move to Collection" ), &menu ); - moveMenu->setIcon( QIcon::fromTheme( "go-jump" ) ); + moveMenu->setIcon( QIcon::fromTheme( QStringLiteral("go-jump") ) ); foreach( Collections::Collection *coll, writableCollections ) { CollectionAction *moveAction = new CollectionAction( coll, &menu ); @@ -165,7 +165,7 @@ style()->styleHint( QStyle::SH_ItemView_ActivateItemOnSingleClick, 0, this ) && ( file.isDir() || file.isNull() ) ) { - emit navigateToDirectory( index ); + Q_EMIT navigateToDirectory( index ); event->accept(); return; } @@ -197,7 +197,7 @@ if( !file.isNull() && ( Playlists::isPlaylist( url ) || MetaFile::Track::isTrack( url ) ) ) addIndexToPlaylist( index, Playlist::OnDoubleClickOnSelectedItems ); else - emit navigateToDirectory( index ); + Q_EMIT navigateToDirectory( index ); event->accept(); return; @@ -224,15 +224,15 @@ // right, we test the current item, but then add the selection to playlist addSelectionToPlaylist( Playlist::OnReturnPressedOnSelectedItems ); else - emit navigateToDirectory( index ); + Q_EMIT navigateToDirectory( index ); return; } case Qt::Key_Delete: slotMoveToTrash( Qt::NoButton, event->modifiers() ); break; case Qt::Key_F5: - emit refreshBrowser(); + Q_EMIT refreshBrowser(); break; default: break; diff --git a/src/browsers/playlistbrowser/APGCategory.h b/src/browsers/playlistbrowser/APGCategory.h --- a/src/browsers/playlistbrowser/APGCategory.h +++ b/src/browsers/playlistbrowser/APGCategory.h @@ -29,7 +29,7 @@ Q_OBJECT public: - APGCategory( QWidget* parent ); + explicit APGCategory( QWidget* parent ); ~APGCategory(); Q_SIGNALS: diff --git a/src/browsers/playlistbrowser/APGCategory.cpp b/src/browsers/playlistbrowser/APGCategory.cpp --- a/src/browsers/playlistbrowser/APGCategory.cpp +++ b/src/browsers/playlistbrowser/APGCategory.cpp @@ -32,13 +32,13 @@ #include PlaylistBrowserNS::APGCategory::APGCategory( QWidget* ) - : BrowserCategory ( "APG", 0 ) + : BrowserCategory ( QStringLiteral("APG"), nullptr ) { m_qualityFactor = AmarokConfig::qualityFactorAPG(); setPrettyName( i18n( "Automated Playlist Generator" ) ); setShortDescription( i18n("Create playlists by specifying criteria") ); - setIcon( QIcon::fromTheme( "playlist-generator" ) ); + setIcon( QIcon::fromTheme( QStringLiteral("playlist-generator") ) ); // set background if( AmarokConfig::showBrowserBackgroundImage() ) @@ -60,31 +60,31 @@ toolBar_Actions->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Preferred ); QAction* a; - a = toolBar_Actions->addAction( QIcon::fromTheme( "list-add-amarok" ), i18n("Add new preset") ); + a = toolBar_Actions->addAction( QIcon::fromTheme( QStringLiteral("list-add-amarok") ), i18n("Add new preset") ); connect( a, &QAction::triggered, presetmodel, &APG::PresetModel::addNew ); - a = toolBar_Actions->addAction( QIcon::fromTheme( "document-properties-amarok" ), i18n("Edit selected preset") ); + a = toolBar_Actions->addAction( QIcon::fromTheme( QStringLiteral("document-properties-amarok") ), i18n("Edit selected preset") ); a->setEnabled( false ); connect( a, &QAction::triggered, presetmodel, &APG::PresetModel::edit ); connect( this, &APGCategory::validIndexSelected, a, &QAction::setEnabled ); - a = toolBar_Actions->addAction( QIcon::fromTheme( "list-remove-amarok" ), i18n("Delete selected preset") ); + a = toolBar_Actions->addAction( QIcon::fromTheme( QStringLiteral("list-remove-amarok") ), i18n("Delete selected preset") ); a->setEnabled( false ); connect( a, &QAction::triggered, presetmodel, &APG::PresetModel::removeActive ); connect( this, &APGCategory::validIndexSelected, a, &QAction::setEnabled ); - a = toolBar_Actions->addAction( QIcon::fromTheme( "document-import-amarok" ), i18n("Import a new preset") ); + a = toolBar_Actions->addAction( QIcon::fromTheme( QStringLiteral("document-import-amarok") ), i18n("Import a new preset") ); a->setEnabled( true ); connect( a, &QAction::triggered, presetmodel, &APG::PresetModel::import ); - a = toolBar_Actions->addAction( QIcon::fromTheme( "document-export-amarok" ), i18n("Export the selected preset") ); + a = toolBar_Actions->addAction( QIcon::fromTheme( QStringLiteral("document-export-amarok") ), i18n("Export the selected preset") ); a->setEnabled( false ); connect( a, &QAction::triggered, presetmodel, &APG::PresetModel::exportActive ); connect( this, &APGCategory::validIndexSelected, a, &QAction::setEnabled ); toolBar_Actions->addSeparator(); - a = toolBar_Actions->addAction( QIcon::fromTheme( "go-next-amarok" ), i18n("Run APG with selected preset") ); + a = toolBar_Actions->addAction( QIcon::fromTheme( QStringLiteral("go-next-amarok") ), i18n("Run APG with selected preset") ); a->setEnabled( false ); connect( a, &QAction::triggered, this, &APGCategory::runGenerator ); connect( this, &APGCategory::validIndexSelected, a, &QAction::setEnabled ); @@ -135,7 +135,7 @@ PlaylistBrowserNS::APGCategory::activeChanged( const QModelIndex& index ) { APG::PresetModel::instance()->setActivePreset( index ); - emit validIndexSelected( index.isValid() ); + Q_EMIT validIndexSelected( index.isValid() ); } void diff --git a/src/browsers/playlistbrowser/DynamicBiasDelegate.h b/src/browsers/playlistbrowser/DynamicBiasDelegate.h --- a/src/browsers/playlistbrowser/DynamicBiasDelegate.h +++ b/src/browsers/playlistbrowser/DynamicBiasDelegate.h @@ -32,12 +32,12 @@ class DynamicBiasDelegate : public QStyledItemDelegate { public: - DynamicBiasDelegate( QWidget* parent = 0 ); - ~DynamicBiasDelegate(); + explicit DynamicBiasDelegate( QWidget* parent = nullptr ); + ~DynamicBiasDelegate() override; void paint( QPainter* painter, const QStyleOptionViewItem& option, - const QModelIndex& index ) const; + const QModelIndex& index ) const override; private: QFont m_normalFont; diff --git a/src/browsers/playlistbrowser/DynamicBiasDelegate.cpp b/src/browsers/playlistbrowser/DynamicBiasDelegate.cpp --- a/src/browsers/playlistbrowser/DynamicBiasDelegate.cpp +++ b/src/browsers/playlistbrowser/DynamicBiasDelegate.cpp @@ -47,7 +47,7 @@ const QStyleOptionViewItem& option, const QModelIndex& index ) const { - Dynamic::AbstractBias* bias = 0; + Dynamic::AbstractBias* bias = nullptr; QVariant v; if( index.isValid() ) { v = index.model()->data( index, Dynamic::DynamicModel::BiasRole ); @@ -59,19 +59,19 @@ if( bias ) { QModelIndex parentIndex = index.parent(); - Dynamic::AbstractBias* parentBias = 0; + Dynamic::AbstractBias* parentBias = nullptr; - const bool isRTL = QApplication::isRightToLeft(); - Q_UNUSED( isRTL ); + //const bool isRTL = QApplication::isRightToLeft(); + //Q_UNUSED( isRTL ); v = parentIndex.model()->data( parentIndex, Dynamic::DynamicModel::BiasRole ); if( v.isValid() ) parentBias = qobject_cast(v.value() ); if( parentBias ) { // sub-biases have a operator drawn in front of them. - const int operatorWidth = m_smallFm->boundingRect( "mmmm" ).width(); + const int operatorWidth = m_smallFm->boundingRect( QStringLiteral("mmmm") ).width(); // draw the selection QApplication::style()->drawPrimitive( QStyle::PE_PanelItemViewItem, &option, painter ); diff --git a/src/browsers/playlistbrowser/DynamicBiasDialog.h b/src/browsers/playlistbrowser/DynamicBiasDialog.h --- a/src/browsers/playlistbrowser/DynamicBiasDialog.h +++ b/src/browsers/playlistbrowser/DynamicBiasDialog.h @@ -18,8 +18,8 @@ * this program. If not, see . * ****************************************************************************************/ -#ifndef AMAROK_DYNAMICBIASWIDGETS_H -#define AMAROK_DYNAMICBIASWIDGETS_H +#ifndef AMAROK_DYNAMICBIASDIALOG_H +#define AMAROK_DYNAMICBIASDIALOG_H #include "amarok_export.h" #include "dynamic/Bias.h" @@ -32,28 +32,27 @@ namespace PlaylistBrowserNS { - class BiasWidget; /** A dialog that contains the widget from a bias and allows to edit it. */ class BiasDialog : public QDialog { Q_OBJECT public: - BiasDialog( Dynamic::BiasPtr bias, QWidget* parent = 0 ); - virtual ~BiasDialog(); + explicit BiasDialog( const Dynamic::BiasPtr &bias, QWidget* parent = nullptr ); + ~BiasDialog() override; public Q_SLOTS: - void accept(); - void reject(); + void accept() override; + void reject() override; protected Q_SLOTS: /** Updates the list of biases in the bias type selection list */ void factoriesChanged(); /** Called when a new bias type has been selected */ void selectionChanged( int index ); - void biasReplaced( Dynamic::BiasPtr oldBias, Dynamic::BiasPtr newBias ); + void biasReplaced( const Dynamic::BiasPtr &oldBias, Dynamic::BiasPtr newBias ); protected: diff --git a/src/browsers/playlistbrowser/DynamicBiasDialog.cpp b/src/browsers/playlistbrowser/DynamicBiasDialog.cpp --- a/src/browsers/playlistbrowser/DynamicBiasDialog.cpp +++ b/src/browsers/playlistbrowser/DynamicBiasDialog.cpp @@ -32,7 +32,7 @@ #include #include -PlaylistBrowserNS::BiasDialog::BiasDialog( Dynamic::BiasPtr bias, QWidget* parent ) +PlaylistBrowserNS::BiasDialog::BiasDialog( const Dynamic::BiasPtr &bias, QWidget* parent ) : QDialog( parent ) , m_mainLayout( 0 ) , m_biasLayout( 0 ) @@ -56,15 +56,15 @@ m_mainLayout->addLayout( selectionLayout ); // -- bias itself - m_descriptionLabel = new QLabel( "" ); + m_descriptionLabel = new QLabel( QLatin1String("") ); m_descriptionLabel->setWordWrap( true ); m_mainLayout->addWidget( m_descriptionLabel ); m_biasLayout = new QVBoxLayout(); m_mainLayout->addLayout( m_biasLayout ); // -- button box - QDialogButtonBox* buttonBox = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel ); + QDialogButtonBox* buttonBox = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this ); m_mainLayout->addWidget( buttonBox ); factoriesChanged(); @@ -151,9 +151,9 @@ return; } -debug() << "replace bias" << oldBias->toString() << "with" << newBias->toString(); + debug() << "replace bias" << oldBias->toString() << "with" << newBias->toString(); m_bias->replace( newBias ); // tell the old bias it has just been replaced -debug() << "replaced"; + debug() << "replaced"; // -- if the new bias is AndBias, try to add the old biase(s) into it Dynamic::AndBias *oldABias = qobject_cast(oldBias.data()); @@ -173,15 +173,15 @@ } void -PlaylistBrowserNS::BiasDialog::biasReplaced( Dynamic::BiasPtr oldBias, Dynamic::BiasPtr newBias ) +PlaylistBrowserNS::BiasDialog::biasReplaced( const Dynamic::BiasPtr &oldBias, Dynamic::BiasPtr newBias ) { Q_UNUSED( oldBias ); if( m_biasWidget ) { m_biasLayout->removeWidget( m_biasWidget ); m_biasWidget->deleteLater(); - m_biasWidget = 0; + m_biasWidget = nullptr; } m_bias = newBias; @@ -191,7 +191,7 @@ connect( newBias.data(), &Dynamic::AbstractBias::replaced, this, &PlaylistBrowserNS::BiasDialog::biasReplaced ); - m_biasWidget = newBias->widget( 0 ); + m_biasWidget = newBias->widget( nullptr ); if( !m_biasWidget ) m_biasWidget = new QLabel( i18n("This bias has no settings.") ); m_biasLayout->addWidget( m_biasWidget ); diff --git a/src/browsers/playlistbrowser/DynamicCategory.h b/src/browsers/playlistbrowser/DynamicCategory.h --- a/src/browsers/playlistbrowser/DynamicCategory.h +++ b/src/browsers/playlistbrowser/DynamicCategory.h @@ -21,24 +21,21 @@ #include "browsers/BrowserCategory.h" -class QCheckBox; class QPushButton; class QToolButton; -class QStandardItemModel; class QSpinBox; namespace PlaylistBrowserNS { class DynamicView; - class DynamicBiasDelegate; /** */ class DynamicCategory : public BrowserCategory { Q_OBJECT public: - DynamicCategory( QWidget* parent ); + explicit DynamicCategory( QWidget* parent ); ~DynamicCategory(); bool allowDuplicates() const; diff --git a/src/browsers/playlistbrowser/DynamicCategory.cpp b/src/browsers/playlistbrowser/DynamicCategory.cpp --- a/src/browsers/playlistbrowser/DynamicCategory.cpp +++ b/src/browsers/playlistbrowser/DynamicCategory.cpp @@ -41,15 +41,15 @@ PlaylistBrowserNS::DynamicCategory::DynamicCategory( QWidget* parent ) - : BrowserCategory( "dynamic category", parent ) + : BrowserCategory( QStringLiteral("dynamic category"), parent ) { setPrettyName( i18n( "Dynamic Playlists" ) ); setShortDescription( i18n( "Dynamically updating parameter based playlists" ) ); - setIcon( QIcon::fromTheme( "dynamic-amarok" ) ); + setIcon( QIcon::fromTheme( QStringLiteral("dynamic-amarok") ) ); setLongDescription( i18n( "With a dynamic playlist, Amarok becomes your own personal dj, automatically selecting tracks for you, based on a number of parameters that you select." ) ); - setImagePath( QStandardPaths::locate( QStandardPaths::GenericDataLocation, "amarok/images/hover_info_dynamic_playlists.png" ) ); + setImagePath( QStandardPaths::locate( QStandardPaths::GenericDataLocation, QStringLiteral("amarok/images/hover_info_dynamic_playlists.png") ) ); // set background if( AmarokConfig::showBrowserBackgroundImage() ) @@ -84,8 +84,8 @@ this, &PlaylistBrowserNS::DynamicCategory::setUpcomingTracks ); - connect( Amarok::actionCollection()->action( "playlist_clear" ), &QAction::triggered, this, &DynamicCategory::playlistCleared ); - connect( Amarok::actionCollection()->action( "disable_dynamic" ), &QAction::triggered, this, &DynamicCategory::playlistCleared, Qt::DirectConnection ); + connect( Amarok::actionCollection()->action( QStringLiteral("playlist_clear") ), &QAction::triggered, this, &DynamicCategory::playlistCleared ); + connect( Amarok::actionCollection()->action( QStringLiteral("disable_dynamic") ), &QAction::triggered, this, &DynamicCategory::playlistCleared, Qt::DirectConnection ); // -- the tool bar @@ -102,41 +102,41 @@ m_onOffButton = new QToolButton( presetToolbar ); m_onOffButton->setText( i18nc( "Turn dynamic mode on", "On") ); m_onOffButton->setCheckable( true ); - m_onOffButton->setIcon( QIcon::fromTheme( "dynamic-amarok" ) ); + m_onOffButton->setIcon( QIcon::fromTheme( QStringLiteral("dynamic-amarok") ) ); m_onOffButton->setToolTip( i18n( "Turn dynamic mode on." ) ); presetToolbar->addWidget( m_onOffButton ); m_duplicateButton = new QToolButton( presetToolbar ); m_duplicateButton->setText( i18n("Duplicates") ); m_duplicateButton->setCheckable( true ); m_duplicateButton->setChecked( allowDuplicates() ); - m_duplicateButton->setIcon( QIcon::fromTheme( "edit-copy" ) ); + m_duplicateButton->setIcon( QIcon::fromTheme( QStringLiteral("edit-copy") ) ); m_duplicateButton->setToolTip( i18n( "Allow duplicate songs in result" ) ); presetToolbar->addWidget( m_duplicateButton ); m_addButton = new QToolButton( presetToolbar ); m_addButton->setText( i18n("New") ); - m_addButton->setIcon( QIcon::fromTheme( "document-new" ) ); + m_addButton->setIcon( QIcon::fromTheme( QStringLiteral("document-new") ) ); m_addButton->setToolTip( i18n( "New playlist" ) ); presetToolbar->addWidget( m_addButton ); m_editButton = new QToolButton( presetToolbar ); m_editButton->setText( i18n("Edit") ); - m_editButton->setIcon( QIcon::fromTheme( "document-properties-amarok" ) ); + m_editButton->setIcon( QIcon::fromTheme( QStringLiteral("document-properties-amarok") ) ); m_editButton->setToolTip( i18n( "Edit the selected playlist or bias" ) ); presetToolbar->addWidget( m_editButton ); m_deleteButton = new QToolButton( presetToolbar ); m_deleteButton->setText( i18n("Delete") ); m_deleteButton->setEnabled( false ); - m_deleteButton->setIcon( QIcon::fromTheme( "edit-delete" ) ); + m_deleteButton->setIcon( QIcon::fromTheme( QStringLiteral("edit-delete") ) ); m_deleteButton->setToolTip( i18n( "Delete the selected playlist or bias") ); presetToolbar->addWidget( m_deleteButton ); m_repopulateButton = new QPushButton( presetLayout ); m_repopulateButton->setText( i18n("Repopulate") ); m_repopulateButton->setToolTip( i18n("Replace the upcoming tracks with fresh ones.") ); - m_repopulateButton->setIcon( QIcon::fromTheme( "view-refresh-amarok" ) ); + m_repopulateButton->setIcon( QIcon::fromTheme( QStringLiteral("view-refresh-amarok") ) ); m_repopulateButton->setEnabled( enabled ); // m_repopulateButton->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); QObject::connect( m_repopulateButton, &QAbstractButton::clicked, The::playlistActions(), &Playlist::Actions::repopulateDynamicPlaylist ); diff --git a/src/browsers/playlistbrowser/DynamicView.h b/src/browsers/playlistbrowser/DynamicView.h --- a/src/browsers/playlistbrowser/DynamicView.h +++ b/src/browsers/playlistbrowser/DynamicView.h @@ -23,8 +23,6 @@ #include -class PopupDropper; -class QAction; class QKeyEvent; class QMouseEvent; class QContextMenuEvent; @@ -35,8 +33,8 @@ { Q_OBJECT public: - explicit DynamicView( QWidget *parent = 0 ); - ~DynamicView(); + explicit DynamicView( QWidget *parent = nullptr ); + ~DynamicView() override; Q_SIGNALS: void currentItemChanged( const QModelIndex ¤t ); @@ -53,10 +51,10 @@ void collapseRecursive(const QModelIndex &index); protected: - virtual void keyPressEvent( QKeyEvent *event ); - virtual void mouseDoubleClickEvent( QMouseEvent *event ); + void keyPressEvent( QKeyEvent *event ) override; + void mouseDoubleClickEvent( QMouseEvent *event ) override; - virtual void contextMenuEvent( QContextMenuEvent* event ); + void contextMenuEvent( QContextMenuEvent* event ) override; }; } // namespace PlaylistBrowserNS diff --git a/src/browsers/playlistbrowser/DynamicView.cpp b/src/browsers/playlistbrowser/DynamicView.cpp --- a/src/browsers/playlistbrowser/DynamicView.cpp +++ b/src/browsers/playlistbrowser/DynamicView.cpp @@ -38,7 +38,6 @@ #include #include -#include #include #include #include @@ -221,19 +220,19 @@ Q_UNUSED( playlist ); QAction* action; - action = new QAction( QIcon::fromTheme( "document-properties-amarok" ), i18n( "&Rename playlist" ), this ); + action = new QAction( QIcon::fromTheme( QStringLiteral("document-properties-amarok") ), i18n( "&Rename playlist" ), this ); connect( action, &QAction::triggered, this, &DynamicView::editSelected ); actions.append( action ); - action = new QAction( QIcon::fromTheme( "document-new" ), i18n( "&Add new Bias" ), this ); + action = new QAction( QIcon::fromTheme( QStringLiteral("document-new") ), i18n( "&Add new Bias" ), this ); connect( action, &QAction::triggered, this, &DynamicView::addToSelected ); actions.append( action ); - action = new QAction( QIcon::fromTheme( "edit-copy" ), i18n( "&Clone Playlist" ), this ); + action = new QAction( QIcon::fromTheme( QStringLiteral("edit-copy") ), i18n( "&Clone Playlist" ), this ); connect( action, &QAction::triggered, this, &DynamicView::cloneSelected ); actions.append( action ); - action = new QAction( QIcon::fromTheme( "edit-delete" ), i18n( "&Delete playlist" ), this ); + action = new QAction( QIcon::fromTheme( QStringLiteral("edit-delete") ), i18n( "&Delete playlist" ), this ); connect( action, &QAction::triggered, this, &DynamicView::removeSelected ); actions.append( action ); } @@ -247,11 +246,11 @@ Dynamic::AndBias* aBias = qobject_cast(v.value() ); QAction* action; - action = new QAction( QIcon::fromTheme( "document-properties-amarok" ), i18n( "&Edit bias..." ), this ); + action = new QAction( QIcon::fromTheme( QStringLiteral("document-properties-amarok") ), i18n( "&Edit bias..." ), this ); connect( action, &QAction::triggered, this, &DynamicView::editSelected ); actions.append( action ); - action = new QAction( QIcon::fromTheme( "edit-copy" ), i18n( "&Clone bias" ), this ); + action = new QAction( QIcon::fromTheme( QStringLiteral("edit-copy") ), i18n( "&Clone bias" ), this ); connect( action, &QAction::triggered, this, &DynamicView::cloneSelected ); actions.append( action ); @@ -261,14 +260,14 @@ QVariant parentV = model()->data( parentIndex, Dynamic::DynamicModel::PlaylistRole ); if( !parentV.isValid() || (aBias && aBias->biases().count() > 0) ) { - action = new QAction( QIcon::fromTheme( "edit-delete" ), i18n( "&Delete bias" ), this ); + action = new QAction( QIcon::fromTheme( QStringLiteral("edit-delete") ), i18n( "&Delete bias" ), this ); connect( action, &QAction::triggered, this, &DynamicView::removeSelected ); actions.append( action ); } if( aBias ) { - action = new QAction( QIcon::fromTheme( "document-new" ), i18n( "&Add new bias" ), this ); + action = new QAction( QIcon::fromTheme( QStringLiteral("document-new") ), i18n( "&Add new bias" ), this ); connect( action, &QAction::triggered, this, &DynamicView::addToSelected ); actions.append( action ); } diff --git a/src/browsers/playlistbrowser/PlaylistBrowser.h b/src/browsers/playlistbrowser/PlaylistBrowser.h --- a/src/browsers/playlistbrowser/PlaylistBrowser.h +++ b/src/browsers/playlistbrowser/PlaylistBrowser.h @@ -21,20 +21,18 @@ #include -class PodcastCollection; namespace PlaylistBrowserNS { -class PodcastCategory; /** @author Bart Cerneels */ class PlaylistBrowser : public BrowserCategoryList { Q_OBJECT public: - PlaylistBrowser( const QString &name, QWidget *parent = 0 ); + explicit PlaylistBrowser( const QString &name, QWidget *parent = nullptr ); ~PlaylistBrowser(); private: diff --git a/src/browsers/playlistbrowser/PlaylistBrowser.cpp b/src/browsers/playlistbrowser/PlaylistBrowser.cpp --- a/src/browsers/playlistbrowser/PlaylistBrowser.cpp +++ b/src/browsers/playlistbrowser/PlaylistBrowser.cpp @@ -36,13 +36,13 @@ { setContentsMargins(0,0,0,0); - addCategory( new DynamicCategory( 0 ) ); - addCategory( new UserPlaylistCategory( 0 ) ); - addCategory( new APGCategory( 0 ) ); + addCategory( new DynamicCategory( nullptr ) ); + addCategory( new UserPlaylistCategory( nullptr ) ); + addCategory( new APGCategory( nullptr ) ); setLongDescription( i18n( "The playlist browser contains your list of imported and saved playlists. It is also where you can specify powerful dynamic playlists and manage your podcast subscriptions and episodes." ) ); - setImagePath( QStandardPaths::locate( QStandardPaths::GenericDataLocation, "amarok/images/hover_info_playlists.png" ) ); + setImagePath( QStandardPaths::locate( QStandardPaths::GenericDataLocation, QStringLiteral("amarok/images/hover_info_playlists.png") ) ); } PlaylistBrowserNS::PlaylistBrowser::~PlaylistBrowser() diff --git a/src/browsers/playlistbrowser/PlaylistBrowserCategory.h b/src/browsers/playlistbrowser/PlaylistBrowserCategory.h --- a/src/browsers/playlistbrowser/PlaylistBrowserCategory.h +++ b/src/browsers/playlistbrowser/PlaylistBrowserCategory.h @@ -31,7 +31,6 @@ class QAction; class KActionMenu; -class QLineEdit; class KToolBar; class PlaylistsInFoldersProxy; @@ -60,8 +59,8 @@ QWidget *parent ); ~PlaylistBrowserCategory(); - virtual QString filter() const; - virtual void setFilter( const QString &filter ); + QString filter() const override; + void setFilter( const QString &filter ) override; /** * Sets the help text for the action. diff --git a/src/browsers/playlistbrowser/PlaylistBrowserCategory.cpp b/src/browsers/playlistbrowser/PlaylistBrowserCategory.cpp --- a/src/browsers/playlistbrowser/PlaylistBrowserCategory.cpp +++ b/src/browsers/playlistbrowser/PlaylistBrowserCategory.cpp @@ -44,7 +44,7 @@ using namespace PlaylistBrowserNS; -QString PlaylistBrowserCategory::s_mergeViewKey( "Merged View" ); +QString PlaylistBrowserCategory::s_mergeViewKey( QStringLiteral("Merged View") ); PlaylistBrowserCategory::PlaylistBrowserCategory( int playlistCategory, const QString &categoryName, @@ -56,7 +56,7 @@ m_playlistCategory( playlistCategory ) { setContentsMargins( 0, 0, 0, 0 ); - setImagePath( QStandardPaths::locate( QStandardPaths::GenericDataLocation, "amarok/images/hover_info_podcasts.png" ) ); + setImagePath( QStandardPaths::locate( QStandardPaths::GenericDataLocation, QStringLiteral("amarok/images/hover_info_podcasts.png") ) ); // set background if( AmarokConfig::showBrowserBackgroundImage() ) @@ -74,17 +74,17 @@ m_toolBar->addSeparator(); - m_addFolderAction = new QAction( QIcon::fromTheme( "folder-new" ), i18n( "Add Folder" ), this ); + m_addFolderAction = new QAction( QIcon::fromTheme( QStringLiteral("folder-new") ), i18n( "Add Folder" ), this ); m_addFolderAction->setPriority( QAction::LowPriority ); m_toolBar->addAction( m_addFolderAction ); connect( m_addFolderAction, &QAction::triggered, this, &PlaylistBrowserCategory::createNewFolder ); - m_providerMenu = new KActionMenu( QIcon::fromTheme( "checkbox" ), i18n( "Visible Sources"), this ); + m_providerMenu = new KActionMenu( QIcon::fromTheme( QStringLiteral("checkbox") ), i18n( "Visible Sources"), this ); m_providerMenu->setDelayed( false ); m_providerMenu->setPriority( QAction::HighPriority ); m_toolBar->addAction( m_providerMenu ); - QAction *toggleAction = new QAction( QIcon::fromTheme( "view-list-tree" ), i18n( "Merged View" ), + QAction *toggleAction = new QAction( QIcon::fromTheme( QStringLiteral("view-list-tree") ), i18n( "Merged View" ), m_toolBar ); toggleAction->setCheckable( true ); toggleAction->setChecked( Amarok::config( m_configGroup ).readEntry( s_mergeViewKey, false ) ); @@ -242,7 +242,7 @@ //if there is only one provider the button needs to be disabled. //When a second is added we can enable the first. - if( m_providerActions.count() == 0 ) + if( m_providerActions.isEmpty() ) providerToggle->setEnabled( false ); else if( m_providerActions.count() == 1 ) m_providerActions.values().first()->setEnabled( true ); @@ -260,7 +260,7 @@ QAction *action = m_providerActions.value( p ); if( action->isChecked() ) { - QString escapedName = QRegExp::escape( p->prettyName() ).replace( ' ', "\\ " ); + QString escapedName = QRegExp::escape( p->prettyName() ).replace( ' ', QLatin1String("\\ ") ); filter += QString( filter.isEmpty() ? "%1" : "|%1" ).arg( escapedName ); checkedActions << action; action->setEnabled( true ); @@ -298,7 +298,7 @@ folderCount = newNumber; } } - groupName += QString( " (%1)" ).arg( folderCount + 1 ); + groupName += QStringLiteral( " (%1)" ).arg( folderCount + 1 ); } QModelIndex idx = m_filterProxy->mapFromSource( m_byFolderProxy->createNewFolder( groupName ) ); m_playlistView->setCurrentIndex( idx ); diff --git a/src/browsers/playlistbrowser/PlaylistBrowserFilterProxy.h b/src/browsers/playlistbrowser/PlaylistBrowserFilterProxy.h --- a/src/browsers/playlistbrowser/PlaylistBrowserFilterProxy.h +++ b/src/browsers/playlistbrowser/PlaylistBrowserFilterProxy.h @@ -26,11 +26,11 @@ /** simple reimplementation of QSortFilterProxyModel to allow editing call from down the * modelstack. */ - explicit PlaylistBrowserFilterProxy( QObject *parent = 0 ); - ~PlaylistBrowserFilterProxy() {} + explicit PlaylistBrowserFilterProxy( QObject *parent = nullptr ); + ~PlaylistBrowserFilterProxy() override {} // QSortFilterProxyModel methods - virtual void setSourceModel( QAbstractItemModel *sourceModel ); + void setSourceModel( QAbstractItemModel *sourceModel ) override; Q_SIGNALS: void renameIndex( const QModelIndex &index ); diff --git a/src/browsers/playlistbrowser/PlaylistBrowserFilterProxy.cpp b/src/browsers/playlistbrowser/PlaylistBrowserFilterProxy.cpp --- a/src/browsers/playlistbrowser/PlaylistBrowserFilterProxy.cpp +++ b/src/browsers/playlistbrowser/PlaylistBrowserFilterProxy.cpp @@ -39,5 +39,5 @@ { const QModelIndex &idx = mapFromSource( sourceIdx ); if( idx.isValid() ) - emit renameIndex( idx ); + Q_EMIT renameIndex( idx ); } diff --git a/src/browsers/playlistbrowser/PlaylistBrowserModel.h b/src/browsers/playlistbrowser/PlaylistBrowserModel.h --- a/src/browsers/playlistbrowser/PlaylistBrowserModel.h +++ b/src/browsers/playlistbrowser/PlaylistBrowserModel.h @@ -55,38 +55,38 @@ PlaylistRole = Qt::UserRole + 22, // PlaylistPtr for associated playlist or null TrackRole = Qt::UserRole + 23, // TrackPtr for associated track or null EpisodeIsNewRole = Qt::UserRole + 24, // for podcast episodes, supports setting, type: bool - CustomRoleOffset = Qt::UserRole + 25 //first role that can be used by sublasses for their own data + CustomRoleOffset = Qt::UserRole + 25 //first role that can be used by subclasses for their own data }; PlaylistBrowserModel( int PlaylistCategory ); - virtual ~PlaylistBrowserModel() {} + ~PlaylistBrowserModel() override {} /* QAbstractItemModel methods */ - virtual QVariant data( const QModelIndex &index, int role ) const; - virtual bool setData( const QModelIndex &idx, const QVariant &value, int role ); - virtual Qt::ItemFlags flags( const QModelIndex &index ) const; - virtual QVariant headerData( int section, Qt::Orientation orientation, - int role = Qt::DisplayRole ) const; - virtual QModelIndex index( int row, int column, - const QModelIndex &parent = QModelIndex() ) const; - virtual QModelIndex parent( const QModelIndex &index ) const; - - virtual bool hasChildren( const QModelIndex &parent = QModelIndex() ) const; - virtual int rowCount( const QModelIndex &parent = QModelIndex() ) const; - virtual int columnCount( const QModelIndex &parent = QModelIndex() ) const; - - virtual bool canFetchMore( const QModelIndex &parent ) const; - virtual void fetchMore( const QModelIndex &parent ); - - virtual QStringList mimeTypes() const; - virtual QMimeData* mimeData( const QModelIndexList &indexes ) const; - virtual bool dropMimeData( const QMimeData *data, Qt::DropAction action, int row, - int column, const QModelIndex &parent ); + QVariant data( const QModelIndex &index, int role ) const override; + bool setData( const QModelIndex &idx, const QVariant &value, int role ) override; + Qt::ItemFlags flags( const QModelIndex &index ) const override; + QVariant headerData( int section, Qt::Orientation orientation, + int role = Qt::DisplayRole ) const override; + QModelIndex index( int row, int column, + const QModelIndex &parent = QModelIndex() ) const override; + QModelIndex parent( const QModelIndex &index ) const override; + + bool hasChildren( const QModelIndex &parent = QModelIndex() ) const override; + int rowCount( const QModelIndex &parent = QModelIndex() ) const override; + int columnCount( const QModelIndex &parent = QModelIndex() ) const override; + + bool canFetchMore( const QModelIndex &parent ) const override; + void fetchMore( const QModelIndex &parent ) override; + + QStringList mimeTypes() const override; + QMimeData* mimeData( const QModelIndexList &indexes ) const override; + bool dropMimeData( const QMimeData *data, Qt::DropAction action, int row, + int column, const QModelIndex &parent ) override; /* Playlists::PlaylistObserver methods */ - virtual void metadataChanged( Playlists::PlaylistPtr playlist ); - virtual void trackAdded( Playlists::PlaylistPtr playlist, Meta::TrackPtr track, int position ); - virtual void trackRemoved( Playlists::PlaylistPtr playlist, int position ); + void metadataChanged( const Playlists::PlaylistPtr &playlist ) override; + void trackAdded( const Playlists::PlaylistPtr &playlist, const Meta::TrackPtr &track, int position ) override; + void trackRemoved( const Playlists::PlaylistPtr &playlist, int position ) override; public Q_SLOTS: void slotRenamePlaylist( Playlists::PlaylistPtr playlist ); diff --git a/src/browsers/playlistbrowser/PlaylistBrowserModel.cpp b/src/browsers/playlistbrowser/PlaylistBrowserModel.cpp --- a/src/browsers/playlistbrowser/PlaylistBrowserModel.cpp +++ b/src/browsers/playlistbrowser/PlaylistBrowserModel.cpp @@ -79,21 +79,21 @@ { track = playlist->tracks()[index.row()]; name = track->prettyName(); - icon = QIcon::fromTheme( "amarok_track" ); + icon = QIcon::fromTheme( QStringLiteral("amarok_track") ); } else { name = playlist->prettyName(); - icon = QIcon::fromTheme( "amarok_playlist" ); + icon = QIcon::fromTheme( QStringLiteral("amarok_playlist") ); } break; } case PlaylistBrowserModel::LabelColumn: //group { if( !playlist->groups().isEmpty() ) { name = playlist->groups().first(); - icon = QIcon::fromTheme( "folder" ); + icon = QIcon::fromTheme( QStringLiteral("folder") ); } break; } @@ -204,7 +204,7 @@ Meta::TrackPtr track = trackFromIndex( idx ); if( !track ) return false; - debug() << QString( "Copy track \"%1\" to \"%2\"." ) + debug() << QStringLiteral( "Copy track \"%1\" to \"%2\"." ) .arg( track->prettyName(), provider->prettyName() ); // return !provider->addTrack( track ).isNull(); provider->addTrack( track ); //ignore result since UmsPodcastProvider returns NULL @@ -222,7 +222,7 @@ return false; } - debug() << QString( "Copy playlist \"%1\" to \"%2\"." ) + debug() << QStringLiteral( "Copy playlist \"%1\" to \"%2\"." ) .arg( playlist->prettyName(), provider->prettyName() ); return !provider->addPlaylist( playlist ).isNull(); @@ -337,7 +337,7 @@ else if( !IS_TRACK(parent) ) { Playlists::PlaylistPtr playlist = m_playlists.value( parent.internalId() ); - //TODO: imeplement incremental loading of tracks by checking for == + //TODO: implement incremental loading of tracks by checking for == if( playlist->trackCount() != playlist->tracks().count() ) return true; //tracks still need to be loaded. } @@ -498,20 +498,20 @@ } void -PlaylistBrowserModel::metadataChanged( Playlists::PlaylistPtr playlist ) +PlaylistBrowserModel::metadataChanged( const Playlists::PlaylistPtr &playlist ) { int indexNumber = m_playlists.indexOf( playlist ); if( indexNumber == -1 ) { error() << "This playlist is not in the list of this model."; return; } QModelIndex playlistIdx = index( indexNumber, 0 ); - emit dataChanged( playlistIdx, playlistIdx ); + Q_EMIT dataChanged( playlistIdx, playlistIdx ); } void -PlaylistBrowserModel::trackAdded( Playlists::PlaylistPtr playlist, Meta::TrackPtr track, +PlaylistBrowserModel::trackAdded(const Playlists::PlaylistPtr &playlist, const Meta::TrackPtr &track, int position ) { Q_UNUSED( track ); @@ -527,7 +527,7 @@ } void -PlaylistBrowserModel::trackRemoved( Playlists::PlaylistPtr playlist, int position ) +PlaylistBrowserModel::trackRemoved(const Playlists::PlaylistPtr &playlist, int position ) { int indexNumber = m_playlists.indexOf( playlist ); if( indexNumber == -1 ) @@ -551,7 +551,7 @@ { if( p == playlist ) { - emit renameIndex( index( row, 0 ) ); + Q_EMIT renameIndex( index( row, 0 ) ); break; } row++; @@ -649,7 +649,7 @@ //TODO: this should work by signaling a change in the model data, but QtGroupingProxy doesn't //work like that ATM // const QModelIndex &idx = index( position, 0 ); -// emit dataChanged( idx, idx ); +// Q_EMIT dataChanged( idx, idx ); //HACK: remove and readd so QtGroupingProxy can put it in the correct groups. beginRemoveRows( QModelIndex(), position, position ); diff --git a/src/browsers/playlistbrowser/PlaylistBrowserView.h b/src/browsers/playlistbrowser/PlaylistBrowserView.h --- a/src/browsers/playlistbrowser/PlaylistBrowserView.h +++ b/src/browsers/playlistbrowser/PlaylistBrowserView.h @@ -38,26 +38,26 @@ { Q_OBJECT public: - explicit PlaylistBrowserView( QAbstractItemModel *model, QWidget *parent = 0 ); + explicit PlaylistBrowserView( QAbstractItemModel *model, QWidget *parent = nullptr ); - virtual void setModel( QAbstractItemModel *model ); + void setModel( QAbstractItemModel *model ) override; Q_SIGNALS: void currentItemChanged( const QModelIndex ¤t ); protected: // TODO: re-implement QWidget::dragEnterEvent() to show drop-not-allowed indicator - virtual void keyPressEvent( QKeyEvent *event ); - virtual void mouseDoubleClickEvent( QMouseEvent *event ); - virtual void mouseReleaseEvent( QMouseEvent *event ); - virtual void startDrag( Qt::DropActions supportedActions ); + void keyPressEvent( QKeyEvent *event ) override; + void mouseDoubleClickEvent( QMouseEvent *event ) override; + void mouseReleaseEvent( QMouseEvent *event ) override; + void startDrag( Qt::DropActions supportedActions ) override; - virtual void contextMenuEvent( QContextMenuEvent *event ); + void contextMenuEvent( QContextMenuEvent *event ) override; protected Q_SLOTS: - /** reimplemented to emit a signal */ - void currentChanged( const QModelIndex ¤t, const QModelIndex &previous ); + /** reimplemented to Q_EMIT a signal */ + void currentChanged( const QModelIndex ¤t, const QModelIndex &previous ) override; private Q_SLOTS: // these are connected to m_*Actions: diff --git a/src/browsers/playlistbrowser/PlaylistBrowserView.cpp b/src/browsers/playlistbrowser/PlaylistBrowserView.cpp --- a/src/browsers/playlistbrowser/PlaylistBrowserView.cpp +++ b/src/browsers/playlistbrowser/PlaylistBrowserView.cpp @@ -61,48 +61,48 @@ setEditTriggers( QAbstractItemView::EditKeyPressed ); setMouseTracking( true ); // needed for highlighting provider action icons - m_createEmptyPlaylistAction = new QAction( QIcon::fromTheme( "media-track-add-amarok" ), + m_createEmptyPlaylistAction = new QAction( QIcon::fromTheme( QStringLiteral("media-track-add-amarok") ), i18n( "Create an Empty Playlist" ), this ); connect( m_createEmptyPlaylistAction, &QAction::triggered, this, &PlaylistBrowserView::slotCreateEmptyPlaylist ); - m_appendAction = new QAction( QIcon::fromTheme( "media-track-add-amarok" ), + m_appendAction = new QAction( QIcon::fromTheme( QStringLiteral("media-track-add-amarok") ), i18n( "&Add to Playlist" ), this ); m_appendAction->setProperty( "popupdropper_svg_id", "append" ); connect( m_appendAction, &QAction::triggered, this, &PlaylistBrowserView::slotAppend ); - m_loadAction = new QAction( QIcon::fromTheme( "folder-open" ), i18nc( "Replace the currently " + m_loadAction = new QAction( QIcon::fromTheme( QStringLiteral("folder-open") ), i18nc( "Replace the currently " "loaded tracks with these", "&Replace Playlist" ), this ); m_loadAction->setProperty( "popupdropper_svg_id", "load" ); connect( m_loadAction, &QAction::triggered, this, &PlaylistBrowserView::slotLoad ); - m_setNewAction = new QAction( QIcon::fromTheme( "rating" ), i18nc( "toggle the \"new\" status " + m_setNewAction = new QAction( QIcon::fromTheme( QStringLiteral("rating") ), i18nc( "toggle the \"new\" status " " of this podcast episode", "&New" ), this ); m_setNewAction->setProperty( "popupdropper_svg_id", "new" ); m_setNewAction->setCheckable( true ); connect( m_setNewAction, &QAction::triggered, this, &PlaylistBrowserView::slotSetNew ); - m_renamePlaylistAction = new QAction( QIcon::fromTheme( "media-track-edit-amarok" ), + m_renamePlaylistAction = new QAction( QIcon::fromTheme( QStringLiteral("media-track-edit-amarok") ), i18n( "&Rename..." ), this ); m_renamePlaylistAction->setProperty( "popupdropper_svg_id", "edit" ); // key shortcut is only for display purposes here, actual one is determined by View in Model/View classes m_renamePlaylistAction->setShortcut( Qt::Key_F2 ); connect( m_renamePlaylistAction, &QAction::triggered, this, &PlaylistBrowserView::slotRename ); - m_deletePlaylistAction = new QAction( QIcon::fromTheme( "media-track-remove-amarok" ), + m_deletePlaylistAction = new QAction( QIcon::fromTheme( QStringLiteral("media-track-remove-amarok") ), i18n( "&Delete..." ), this ); m_deletePlaylistAction->setProperty( "popupdropper_svg_id", "delete" ); // key shortcut is only for display purposes here, actual one is determined by View in Model/View classes m_deletePlaylistAction->setShortcut( Qt::Key_Delete ); connect( m_deletePlaylistAction, &QAction::triggered, this, &PlaylistBrowserView::slotDelete ); - m_removeTracksAction = new QAction( QIcon::fromTheme( "media-track-remove-amarok" ), - QString( "" ), this ); + m_removeTracksAction = new QAction( QIcon::fromTheme( QStringLiteral("media-track-remove-amarok") ), + QStringLiteral( "" ), this ); m_removeTracksAction->setProperty( "popupdropper_svg_id", "delete" ); // key shortcut is only for display purposes here, actual one is determined by View in Model/View classes m_removeTracksAction->setShortcut( Qt::Key_Delete ); connect( m_removeTracksAction, &QAction::triggered, this, &PlaylistBrowserView::slotRemoveTracks ); - m_exportAction = new QAction( QIcon::fromTheme( "document-export-amarok" ), + m_exportAction = new QAction( QIcon::fromTheme( QStringLiteral("document-export-amarok") ), i18n( "&Export As..." ), this ); connect( m_exportAction, &QAction::triggered, this, &PlaylistBrowserView::slotExport ); @@ -400,7 +400,7 @@ const QModelIndex &previous ) { Q_UNUSED( previous ) - emit currentItemChanged( current ); + Q_EMIT currentItemChanged( current ); Amarok::PrettyTreeView::currentChanged( current, previous ); } @@ -467,7 +467,7 @@ auto button = QMessageBox::question( The::mainWindow(), i18n( "Confirm Playlist Deletion" ), i18nc( "%1 is playlist provider pretty name", - "Delete playlist from %1.", providerNames.join( ", " ) ), + "Delete playlist from %1.", providerNames.join( QStringLiteral(", ") ) ), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes ); @@ -508,31 +508,31 @@ // compare with MainWindow::exportPlaylist // TODO: have this code only once QFileDialog fileDialog; - fileDialog.restoreState( Amarok::config( "playlist-export-dialog" ).readEntry( "state", QByteArray() ) ); + fileDialog.restoreState( Amarok::config( QStringLiteral("playlist-export-dialog") ).readEntry( "state", QByteArray() ) ); // FIXME: Make checkbox visible in dialog QCheckBox *saveRelativeCheck = new QCheckBox( i18n("Use relative path for &saving"), &fileDialog ); saveRelativeCheck->setChecked( AmarokConfig::relativePlaylist() ); QStringList supportedMimeTypes; - supportedMimeTypes << "video/x-ms-asf"; //ASX - supportedMimeTypes << "audio/x-mpegurl"; //M3U - supportedMimeTypes << "audio/x-scpls"; //PLS - supportedMimeTypes << "application/xspf+xml"; //XSPF + supportedMimeTypes << QStringLiteral("video/x-ms-asf"); //ASX + supportedMimeTypes << QStringLiteral("audio/x-mpegurl"); //M3U + supportedMimeTypes << QStringLiteral("audio/x-scpls"); //PLS + supportedMimeTypes << QStringLiteral("application/xspf+xml"); //XSPF fileDialog.setMimeTypeFilters( supportedMimeTypes ); fileDialog.setAcceptMode( QFileDialog::AcceptSave ); fileDialog.setFileMode( QFileDialog::AnyFile ); fileDialog.setWindowTitle( i18n("Save As") ); - fileDialog.setObjectName( "PlaylistExport" ); + fileDialog.setObjectName( QStringLiteral("PlaylistExport") ); int result = fileDialog.exec(); QString playlistPath = fileDialog.selectedFiles().value( 0 ); if( result == QDialog::Accepted && !playlistPath.isEmpty() ) Playlists::exportPlaylistFile( playlist->tracks(), QUrl::fromLocalFile( playlistPath ) ); - Amarok::config( "playlist-export-dialog" ).writeEntry( "state", fileDialog.saveState() ); + Amarok::config( QStringLiteral("playlist-export-dialog") ).writeEntry( "state", fileDialog.saveState() ); } void diff --git a/src/browsers/playlistbrowser/PlaylistViewItem.h b/src/browsers/playlistbrowser/PlaylistViewItem.h --- a/src/browsers/playlistbrowser/PlaylistViewItem.h +++ b/src/browsers/playlistbrowser/PlaylistViewItem.h @@ -35,7 +35,7 @@ public: PlaylistViewItem() : QSharedData() {} - virtual ~PlaylistViewItem() {}; + virtual ~PlaylistViewItem() {} virtual Meta::PlaylistGroupPtr parent() const = 0; virtual int childCount() const { return 0; } diff --git a/src/browsers/playlistbrowser/PlaylistsByProviderProxy.h b/src/browsers/playlistbrowser/PlaylistsByProviderProxy.h --- a/src/browsers/playlistbrowser/PlaylistsByProviderProxy.h +++ b/src/browsers/playlistbrowser/PlaylistsByProviderProxy.h @@ -25,34 +25,34 @@ { Q_OBJECT public: - explicit PlaylistsByProviderProxy( int playlistCategory, QObject *parent = 0 ); + explicit PlaylistsByProviderProxy( int playlistCategory, QObject *parent = nullptr ); PlaylistsByProviderProxy( QAbstractItemModel *model, int column, int playlistCategory ); - ~PlaylistsByProviderProxy() {} + ~PlaylistsByProviderProxy() override {} /* QtGroupingProxy methods */ /* reimplement to handle tracks with multiple providers (synced) */ - virtual QVariant data( const QModelIndex &idx, int role ) const; + QVariant data( const QModelIndex &idx, int role ) const override; /* reimplemented to prevent changing providers name */ - virtual Qt::ItemFlags flags( const QModelIndex &idx ) const; + Qt::ItemFlags flags( const QModelIndex &idx ) const override; /* QAbstractModel methods */ - virtual bool removeRows( int row, int count, - const QModelIndex &parent = QModelIndex() ); - virtual QStringList mimeTypes() const; - virtual QMimeData *mimeData( const QModelIndexList &indexes ) const; - virtual bool dropMimeData( const QMimeData *data, Qt::DropAction action, - int row, int column, const QModelIndex &parent ); + bool removeRows( int row, int count, + const QModelIndex &parent = QModelIndex() ) override; + QStringList mimeTypes() const override; + QMimeData *mimeData( const QModelIndexList &indexes ) const override; + bool dropMimeData( const QMimeData *data, Qt::DropAction action, + int row, int column, const QModelIndex &parent ) override; - virtual Qt::DropActions supportedDropActions() const; - virtual Qt::DropActions supportedDragActions() const; + Qt::DropActions supportedDropActions() const override; + Qt::DropActions supportedDragActions() const override; // re-implement to connect renameIndex signal - virtual void setSourceModel( QAbstractItemModel *sourceModel ); + void setSourceModel( QAbstractItemModel *sourceModel ) override; protected Q_SLOTS: //re-implemented to add empty providers - virtual void buildTree(); + void buildTree() override; private Q_SLOTS: void slotRenameIndex( const QModelIndex &index ); diff --git a/src/browsers/playlistbrowser/PlaylistsByProviderProxy.cpp b/src/browsers/playlistbrowser/PlaylistsByProviderProxy.cpp --- a/src/browsers/playlistbrowser/PlaylistsByProviderProxy.cpp +++ b/src/browsers/playlistbrowser/PlaylistsByProviderProxy.cpp @@ -39,7 +39,7 @@ this, &PlaylistsByProviderProxy::slotProviderRemoved ); } -//TODO: remove this contructor +//TODO: remove this constructor PlaylistsByProviderProxy::PlaylistsByProviderProxy( QAbstractItemModel *model, int column, int playlistCategory ) : QtGroupingProxy( model, QModelIndex(), column ) , m_playlistCategory( playlistCategory ) @@ -69,7 +69,7 @@ if( indexData.type() != QVariant::List ) return indexData; - QString providerString = indexData.toStringList().join( ", " ); + QString providerString = indexData.toStringList().join( QStringLiteral(", ") ); return QVariant( providerString ); } @@ -231,7 +231,7 @@ { QModelIndex idx = mapFromSource( sourceIdx ); if( idx.isValid() ) - emit renameIndex( idx ); + Q_EMIT renameIndex( idx ); } void diff --git a/src/browsers/playlistbrowser/PlaylistsInFoldersProxy.h b/src/browsers/playlistbrowser/PlaylistsInFoldersProxy.h --- a/src/browsers/playlistbrowser/PlaylistsInFoldersProxy.h +++ b/src/browsers/playlistbrowser/PlaylistsInFoldersProxy.h @@ -30,30 +30,30 @@ { Q_OBJECT public: - PlaylistsInFoldersProxy( QAbstractItemModel *model ); - ~PlaylistsInFoldersProxy(); + explicit PlaylistsInFoldersProxy( QAbstractItemModel *model ); + ~PlaylistsInFoldersProxy() override; /* PlaylistInGroupsProxy methods */ QModelIndex createNewFolder( const QString &groupName ); /* QtGroupingProxy methods */ //re-implemented to make folder name (== label) editable. - virtual Qt::ItemFlags flags(const QModelIndex &idx) const; - virtual QVariant data( const QModelIndex &idx, int role ) const; + Qt::ItemFlags flags(const QModelIndex &idx) const override; + QVariant data( const QModelIndex &idx, int role ) const override; /* QAbstractModel methods */ - virtual bool removeRows( int row, int count, - const QModelIndex &parent = QModelIndex() ); - virtual QStringList mimeTypes() const; - virtual QMimeData *mimeData( const QModelIndexList &indexes ) const; - virtual bool dropMimeData( const QMimeData *data, Qt::DropAction action, - int row, int column, const QModelIndex &parent ); + bool removeRows( int row, int count, + const QModelIndex &parent = QModelIndex() ) override; + QStringList mimeTypes() const override; + QMimeData *mimeData( const QModelIndexList &indexes ) const override; + bool dropMimeData( const QMimeData *data, Qt::DropAction action, + int row, int column, const QModelIndex &parent ) override; - virtual Qt::DropActions supportedDropActions() const; - virtual Qt::DropActions supportedDragActions() const; + Qt::DropActions supportedDropActions() const override; + Qt::DropActions supportedDragActions() const override; // re-implement to connect renameIndex signal - virtual void setSourceModel( QAbstractItemModel *sourceModel ); + void setSourceModel( QAbstractItemModel *sourceModel ) override; private Q_SLOTS: void slotRenameIndex( const QModelIndex &idx ); diff --git a/src/browsers/playlistbrowser/PlaylistsInFoldersProxy.cpp b/src/browsers/playlistbrowser/PlaylistsInFoldersProxy.cpp --- a/src/browsers/playlistbrowser/PlaylistsInFoldersProxy.cpp +++ b/src/browsers/playlistbrowser/PlaylistsInFoldersProxy.cpp @@ -33,15 +33,15 @@ PlaylistsInFoldersProxy::PlaylistsInFoldersProxy( QAbstractItemModel *model ) : QtGroupingProxy( model, QModelIndex(), PlaylistBrowserNS::UserModel::LabelColumn ) { - m_renameFolderAction = new QAction( QIcon::fromTheme( "media-track-edit-amarok" ), + m_renameFolderAction = new QAction( QIcon::fromTheme( QStringLiteral("media-track-edit-amarok") ), i18n( "&Rename Folder..." ), this ); m_renameFolderAction->setProperty( "popupdropper_svg_id", "edit_group" ); connect( m_renameFolderAction, &QAction::triggered, this, &PlaylistsInFoldersProxy::slotRenameFolder ); - m_deleteFolderAction = new QAction( QIcon::fromTheme( "media-track-remove-amarok" ), + m_deleteFolderAction = new QAction( QIcon::fromTheme( QStringLiteral("media-track-remove-amarok") ), i18n( "&Delete Folder" ), this ); m_deleteFolderAction->setProperty( "popupdropper_svg_id", "delete_group" ); - m_deleteFolderAction->setObjectName( "deleteAction" ); + m_deleteFolderAction->setObjectName( QStringLiteral("deleteAction") ); connect( m_deleteFolderAction, &QAction::triggered, this, &PlaylistsInFoldersProxy::slotDeleteFolder ); if( auto m = static_cast(sourceModel()) ) @@ -65,7 +65,7 @@ if( indexData.type() != QVariant::List ) return indexData; - QString providerString = indexData.toStringList().join( ", " ); + QString providerString = indexData.toStringList().join( QStringLiteral(", ") ); return QVariant( providerString ); } @@ -77,7 +77,7 @@ QPersistentModelIndexList actionList = m_deleteFolderAction->data().value(); - //make a persistant modelindex since the location of the groups can change while executing + //make a persistent modelindex since the location of the groups can change while executing //actions. actionList << QPersistentModelIndex( idx ); QVariant value = QVariant::fromValue( actionList ); @@ -184,7 +184,7 @@ DEBUG_BLOCK Q_UNUSED( row ); Q_UNUSED( column ); - debug() << "dropped on " << QString("row: %1, column: %2, parent:").arg( row ).arg( column ); + debug() << "dropped on " << QStringLiteral("row: %1, column: %2, parent:").arg( row ).arg( column ); debug() << parent; if( action == Qt::IgnoreAction ) { @@ -283,7 +283,7 @@ { QModelIndex idx = mapFromSource( sourceIdx ); if( idx.isValid() ) - emit renameIndex( idx ); + Q_EMIT renameIndex( idx ); } void @@ -316,7 +316,7 @@ QModelIndex folder = indexes.first(); QString folderName = folder.data( Qt::DisplayRole ).toString(); bool ok; - const QString newName = QInputDialog::getText( Q_NULLPTR, + const QString newName = QInputDialog::getText( nullptr, i18n("New name"), i18nc("Enter a new name for a folder that already exists", "Enter new folder name:"), @@ -357,7 +357,7 @@ RowData data; ItemData roleData; roleData.insert( Qt::DisplayRole, groupName ); - roleData.insert( Qt::DecorationRole, QVariant( QIcon::fromTheme( "folder" ) ) ); + roleData.insert( Qt::DecorationRole, QVariant( QIcon::fromTheme( QStringLiteral("folder") ) ) ); roleData.insert( Qt::EditRole, groupName ); data.insert( 0, roleData ); return addEmptyGroup( data ); diff --git a/src/browsers/playlistbrowser/PodcastCategory.h b/src/browsers/playlistbrowser/PodcastCategory.h --- a/src/browsers/playlistbrowser/PodcastCategory.h +++ b/src/browsers/playlistbrowser/PodcastCategory.h @@ -38,7 +38,7 @@ static QString s_configGroup; static QString s_mergedViewKey; - PodcastCategory( QWidget *parent ); + explicit PodcastCategory( QWidget *parent ); ~PodcastCategory(); private Q_SLOTS: diff --git a/src/browsers/playlistbrowser/PodcastCategory.cpp b/src/browsers/playlistbrowser/PodcastCategory.cpp --- a/src/browsers/playlistbrowser/PodcastCategory.cpp +++ b/src/browsers/playlistbrowser/PodcastCategory.cpp @@ -52,9 +52,9 @@ using namespace PlaylistBrowserNS; -QString PodcastCategory::s_configGroup( "Podcast View" ); +QString PodcastCategory::s_configGroup( QStringLiteral("Podcast View") ); -PodcastCategory* PodcastCategory::s_instance = 0; +PodcastCategory* PodcastCategory::s_instance = nullptr; PodcastCategory* PodcastCategory::instance() @@ -68,46 +68,46 @@ if( s_instance ) { delete s_instance; - s_instance = 0; + s_instance = nullptr; } } PodcastCategory::PodcastCategory( QWidget *parent ) : PlaylistBrowserCategory( Playlists::PodcastChannelPlaylist, - "podcasts", + QStringLiteral("podcasts"), s_configGroup, The::podcastModel(), parent ) { setPrettyName( i18n( "Podcasts" ) ); setShortDescription( i18n( "List of podcast subscriptions and episodes" ) ); - setIcon( QIcon::fromTheme( "podcast-amarok" ) ); + setIcon( QIcon::fromTheme( QStringLiteral("podcast-amarok") ) ); setLongDescription( i18n( "Manage your podcast subscriptions and browse individual episodes. " "Downloading episodes to the disk is also done here, or you can tell " "Amarok to do this automatically." ) ); - setImagePath( QStandardPaths::locate( QStandardPaths::GenericDataLocation, "amarok/images/hover_info_podcasts.png" ) ); + setImagePath( QStandardPaths::locate( QStandardPaths::GenericDataLocation, QStringLiteral("amarok/images/hover_info_podcasts.png") ) ); // set background if( AmarokConfig::showBrowserBackgroundImage() ) setBackgroundImage( imagePath() ); - QAction *addPodcastAction = new QAction( QIcon::fromTheme( "list-add-amarok" ), i18n("&Add Podcast"), + QAction *addPodcastAction = new QAction( QIcon::fromTheme( QStringLiteral("list-add-amarok") ), i18n("&Add Podcast"), m_toolBar ); addPodcastAction->setPriority( QAction::NormalPriority ); m_toolBar->insertAction( m_separator, addPodcastAction ); connect( addPodcastAction, &QAction::triggered, The::podcastModel(), &PodcastModel::addPodcast ); - QAction *updateAllAction = new QAction( QIcon::fromTheme("view-refresh-amarok"), QString(), m_toolBar ); + QAction *updateAllAction = new QAction( QIcon::fromTheme(QStringLiteral("view-refresh-amarok")), QString(), m_toolBar ); updateAllAction->setToolTip( i18n("&Update All") ); updateAllAction->setPriority( QAction::LowPriority ); m_toolBar->insertAction( m_separator, updateAllAction ); connect( updateAllAction, &QAction::triggered, The::podcastModel(), &PodcastModel::refreshPodcasts ); - QAction *importOpmlAction = new QAction( QIcon::fromTheme("document-import") + QAction *importOpmlAction = new QAction( QIcon::fromTheme(QStringLiteral("document-import")) , i18n( "Import OPML File" ) , m_toolBar ); @@ -164,14 +164,14 @@ if( !author.isEmpty() ) { - authorAndPubDate = QString( "%1 %2 " ) - .arg( i18n( "By" ) ) - .arg( author.toHtmlEscaped() ); + authorAndPubDate = QStringLiteral( "%1 %2 " ) + .arg( i18n( "By" ), + author.toHtmlEscaped() ); } if( !subtitle.isEmpty() ) { - description += QString( "

%1

" ) + description += QStringLiteral( "

%1

" ) .arg( subtitle.toHtmlEscaped() ); } @@ -203,15 +203,15 @@ if( pubDate.isValid() ) { - authorAndPubDate += QString( "%1 %2" ) - .arg( i18nc( "Podcast published on date", "On" ) ) - .arg( QLocale().toString( pubDate, QLocale::ShortFormat ) ); + authorAndPubDate += QStringLiteral( "%1 %2" ) + .arg( i18nc( "Podcast published on date", "On" ), + QLocale().toString( pubDate, QLocale::ShortFormat ) ); } } if( !authorAndPubDate.isEmpty() ) { - description += QString( "

%1

" ) + description += QStringLiteral( "

%1

" ) .arg( authorAndPubDate ); } @@ -221,9 +221,9 @@ if( fileSize != 0 ) { - description += QString( "

%1 %2

" ) - .arg( i18n( "File Size:" ) ) - .arg( Meta::prettyFilesize( fileSize ) ); + description += QStringLiteral( "

%1 %2

" ) + .arg( i18n( "File Size:" ), + Meta::prettyFilesize( fileSize ) ); } } @@ -233,17 +233,17 @@ if( subsDate.isValid() ) { - description += QString( "

%1 %2

" ) - .arg( i18n( "Subscription Date:" ) ) - .arg( QLocale().toString( subsDate, QLocale::ShortFormat ) ); + description += QStringLiteral( "

%1 %2

" ) + .arg( i18n( "Subscription Date:" ), + QLocale().toString( subsDate, QLocale::ShortFormat ) ); } } if( !keywords.isEmpty() ) { - description += QString( "

%1 %2

" ) - .arg( i18n( "Keywords:" ) ) - .arg( keywords.join( ", " ).toHtmlEscaped() ); + description += QStringLiteral( "

%1 %2

" ) + .arg( i18n( "Keywords:" ), + keywords.join( QStringLiteral(", ") ).toHtmlEscaped() ); } description += index.data( PrettyTreeRoles::ByLineRole ).toString(); @@ -264,20 +264,20 @@ " %2" " " "") - .arg( title.toHtmlEscaped() ) - .arg( description ) - .arg( pApp->palette().brush( QPalette::Text ).color().name() ) - .arg( The::paletteHandler()->highlightColor().name() ); + .arg( title.toHtmlEscaped(), + description, + pApp->palette().brush( QPalette::Text ).color().name(), + The::paletteHandler()->highlightColor().name() ); QVariantMap map; - map["service_name"] = title; - map["main_info"] = description; + map[QStringLiteral("service_name")] = title; + map[QStringLiteral("main_info")] = description; The::infoProxy()->setInfo( map ); } void PodcastCategory::slotImportOpml() { - AmarokUrl( "amarok://service-podcastdirectory/addOpml" ).run(); + AmarokUrl( QStringLiteral("amarok://service-podcastdirectory/addOpml") ).run(); } diff --git a/src/browsers/playlistbrowser/PodcastModel.h b/src/browsers/playlistbrowser/PodcastModel.h --- a/src/browsers/playlistbrowser/PodcastModel.h +++ b/src/browsers/playlistbrowser/PodcastModel.h @@ -58,18 +58,18 @@ static void destroy(); /* QAbstractItemModel methods */ - virtual QVariant data(const QModelIndex &index, int role) const; - virtual bool setData( const QModelIndex &index, const QVariant &value, - int role = Qt::EditRole ); - virtual QVariant headerData(int section, Qt::Orientation orientation, - int role = Qt::DisplayRole) const; - virtual int columnCount(const QModelIndex &parent = QModelIndex()) const; - - virtual Qt::DropActions supportedDropActions() const { + QVariant data(const QModelIndex &index, int role) const override; + bool setData( const QModelIndex &index, const QVariant &value, + int role = Qt::EditRole ) override; + QVariant headerData(int section, Qt::Orientation orientation, + int role = Qt::DisplayRole) const override; + int columnCount(const QModelIndex &parent = QModelIndex()) const override; + + Qt::DropActions supportedDropActions() const override { return Qt::CopyAction | Qt::MoveAction; } - virtual Qt::DropActions supportedDragActions() const { + Qt::DropActions supportedDragActions() const override { return Qt::MoveAction | Qt::CopyAction; } diff --git a/src/browsers/playlistbrowser/PodcastModel.cpp b/src/browsers/playlistbrowser/PodcastModel.cpp --- a/src/browsers/playlistbrowser/PodcastModel.cpp +++ b/src/browsers/playlistbrowser/PodcastModel.cpp @@ -46,7 +46,7 @@ } } -PlaylistBrowserNS::PodcastModel* PlaylistBrowserNS::PodcastModel::s_instance = 0; +PlaylistBrowserNS::PodcastModel* PlaylistBrowserNS::PodcastModel::s_instance = nullptr; PlaylistBrowserNS::PodcastModel* PlaylistBrowserNS::PodcastModel::instance() @@ -60,7 +60,7 @@ if ( s_instance ) { delete s_instance; - s_instance = 0; + s_instance = nullptr; } } @@ -80,7 +80,7 @@ { isOnDisk = QFileInfo( episodeFile.toLocalFile() ).exists(); // reset localUrl because the file is not there. - // FIXME: changing a podcast in innoncent-looking getter method is convoluted + // FIXME: changing a podcast in innocent-looking getter method is convoluted if( !isOnDisk ) episode->setLocalUrl( QUrl() ); } @@ -97,7 +97,7 @@ { if( ep->isNew() ) { - emblems << "rating"; + emblems << QStringLiteral("rating"); break; } } @@ -120,7 +120,7 @@ // if it's a new episode draw the overlay: if( !emblems.isEmpty() ) // draw the overlay the same way KIconLoader does: - p.drawPixmap( 2, 32 - 16 - 2, QIcon::fromTheme( "rating" ).pixmap( 16, 16 ) ); + p.drawPixmap( 2, 32 - 16 - 2, QIcon::fromTheme( QStringLiteral("rating") ).pixmap( 16, 16 ) ); p.end(); return pixmap; @@ -134,7 +134,7 @@ { QStringList emblems; if( isOnDisk( episode ) ) - emblems << "go-down"; + emblems << QStringLiteral("go-down"); if( episode->isNew() ) return ( QIcon( new KIconEngine( "rating", 0, emblems )).pixmap( 24, 24 ) ); @@ -277,8 +277,8 @@ bool checked = value.toBool(); episode->setNew( checked ); if( checked ) - emit episodeMarkedAsNew( episode ); - emit dataChanged( idx, idx ); + Q_EMIT episodeMarkedAsNew( episode ); + Q_EMIT dataChanged( idx, idx ); return true; } diff --git a/src/browsers/playlistbrowser/QtGroupingProxy.h b/src/browsers/playlistbrowser/QtGroupingProxy.h --- a/src/browsers/playlistbrowser/QtGroupingProxy.h +++ b/src/browsers/playlistbrowser/QtGroupingProxy.h @@ -31,10 +31,10 @@ { Q_OBJECT public: - explicit QtGroupingProxy( QObject *parent = 0 ); - QtGroupingProxy( QAbstractItemModel *model, QModelIndex rootIndex = QModelIndex(), - int groupedColumn = -1, QObject *parent = 0 ); - ~QtGroupingProxy(); + explicit QtGroupingProxy( QObject *parent = nullptr ); + explicit QtGroupingProxy(QAbstractItemModel *model, const QModelIndex &rootIndex = QModelIndex(), + int groupedColumn = -1, QObject *parent = nullptr ); + ~QtGroupingProxy() override; /* QtGroupingProxy methods */ void setRootIndex( const QModelIndex &rootIndex ); @@ -44,25 +44,25 @@ /* QAbstractProxyModel methods */ //re-implemented to connect to source signals - virtual void setSourceModel( QAbstractItemModel *sourceModel ); - virtual QModelIndex index( int row, int column = 0, - const QModelIndex& parent = QModelIndex() ) const; - virtual Qt::ItemFlags flags( const QModelIndex &idx ) const; - virtual QModelIndex buddy( const QModelIndex &index ) const; - virtual QModelIndex parent( const QModelIndex &idx ) const; - virtual int rowCount( const QModelIndex &idx = QModelIndex() ) const; - virtual int columnCount( const QModelIndex &idx ) const; - virtual QModelIndex mapToSource( const QModelIndex &idx ) const; + void setSourceModel( QAbstractItemModel *sourceModel ) override; + QModelIndex index( int row, int column = 0, + const QModelIndex& parent = QModelIndex() ) const override; + Qt::ItemFlags flags( const QModelIndex &idx ) const override; + QModelIndex buddy( const QModelIndex &index ) const override; + QModelIndex parent( const QModelIndex &idx ) const override; + int rowCount( const QModelIndex &idx = QModelIndex() ) const override; + int columnCount( const QModelIndex &idx ) const override; + QModelIndex mapToSource( const QModelIndex &idx ) const override; virtual QModelIndexList mapToSource( const QModelIndexList &list ) const; - virtual QModelIndex mapFromSource( const QModelIndex &idx ) const; - virtual QVariant data( const QModelIndex &idx, int role ) const; - virtual bool setData( const QModelIndex &index, const QVariant &value, - int role = Qt::EditRole ); - virtual QVariant headerData ( int section, Qt::Orientation orientation, - int role ) const; - virtual bool canFetchMore( const QModelIndex &parent ) const; - virtual void fetchMore( const QModelIndex &parent ); - virtual bool hasChildren( const QModelIndex &parent = QModelIndex() ) const; + QModelIndex mapFromSource( const QModelIndex &idx ) const override; + QVariant data( const QModelIndex &idx, int role ) const override; + bool setData( const QModelIndex &index, const QVariant &value, + int role = Qt::EditRole ) override; + QVariant headerData ( int section, Qt::Orientation orientation, + int role ) const override; + bool canFetchMore( const QModelIndex &parent ) const override; + void fetchMore( const QModelIndex &parent ) override; + bool hasChildren( const QModelIndex &parent = QModelIndex() ) const override; Q_SIGNALS: void renameIndex( const QModelIndex &idx ); @@ -107,7 +107,7 @@ */ QList m_groupMaps; - /** "instuctions" how to create an item in the tree. + /** "instructions" how to create an item in the tree. * This is used by parent( QModelIndex ) */ struct ParentCreate diff --git a/src/browsers/playlistbrowser/QtGroupingProxy.cpp b/src/browsers/playlistbrowser/QtGroupingProxy.cpp --- a/src/browsers/playlistbrowser/QtGroupingProxy.cpp +++ b/src/browsers/playlistbrowser/QtGroupingProxy.cpp @@ -35,7 +35,7 @@ { } -QtGroupingProxy::QtGroupingProxy( QAbstractItemModel *model, QModelIndex rootIndex, +QtGroupingProxy::QtGroupingProxy( QAbstractItemModel *model, const QModelIndex &rootIndex, int groupedColumn, QObject *parent ) : QAbstractProxyModel( parent ) , m_rootIndex( rootIndex ) @@ -171,7 +171,7 @@ m_parentCreateList.clear(); int max = sourceModel()->rowCount( m_rootIndex ); - //qDebug() << QString("building tree with %1 leafs.").arg( max ); + //qDebug() << QStringLiteral("building tree with %1 leafs.").arg( max ); //WARNING: these have to be added in order because the addToGroups function is optimized for //modelRowsInserted(). Failure to do so will result in wrong data shown in the view at best. for( int row = 0; row < max; row++ ) @@ -205,7 +205,7 @@ int updatedGroup = -1; if( !data.isEmpty() ) { -// qDebug() << QString("index %1 belongs to group %2").arg( row ) +// qDebug() << QStringLiteral("index %1 belongs to group %2").arg( row ) // .arg( data[0][Qt::DisplayRole].toString() ); foreach( const RowData &cachedData, m_groupMaps ) @@ -270,7 +270,7 @@ /** Each ModelIndex has in it's internalId a position in the parentCreateList. * struct ParentCreate are the instructions to recreate the parent index. - * It contains the proxy row number of the parent and the postion in this list of the grandfather. + * It contains the proxy row number of the parent and the position in this list of the grandfather. * This function creates the ParentCreate structs and saves them in a list. */ int @@ -426,12 +426,12 @@ roleMap.insert( role, variantsOfChildren ); } - //qDebug() << QString("roleMap[%1]:").arg(role) << roleMap[role]; + //qDebug() << QStringLiteral("roleMap[%1]:").arg(role) << roleMap[role]; //only one unique variant? No need to return a list if( variantsOfChildren.count() == 1 ) return variantsOfChildren.first(); - if( variantsOfChildren.count() == 0 ) + if( variantsOfChildren.isEmpty() ) return QVariant(); return variantsOfChildren; @@ -472,7 +472,7 @@ } //TODO: we might need to reload the data from the children at this point - emit dataChanged( idx, idx ); + Q_EMIT dataChanged( idx, idx ); return true; } @@ -610,7 +610,7 @@ bool groupIsEditable = true; //it's possible to have empty groups - if( m_groupHash.value( idx.row() ).count() == 0 ) + if( m_groupHash.value( idx.row() ).isEmpty() ) { //check the flags of this column with the root node QModelIndex originalRootNode = sourceModel()->index( m_rootIndex.row(), m_groupedColumn, @@ -700,7 +700,7 @@ if( isGroup( parent ) ) return; - return sourceModel()->fetchMore( mapToSource( parent ) ); + sourceModel()->fetchMore( mapToSource( parent ) ); } QModelIndex @@ -860,12 +860,12 @@ if( topLeft == bottomRight ) { - emit dataChanged( proxyTopLeft, proxyTopLeft ); + Q_EMIT dataChanged( proxyTopLeft, proxyTopLeft ); } else { QModelIndex proxyBottomRight = mapFromSource( bottomRight ); - emit dataChanged( proxyTopLeft, proxyBottomRight ); + Q_EMIT dataChanged( proxyTopLeft, proxyBottomRight ); } } diff --git a/src/browsers/playlistbrowser/UserPlaylistCategory.h b/src/browsers/playlistbrowser/UserPlaylistCategory.h --- a/src/browsers/playlistbrowser/UserPlaylistCategory.h +++ b/src/browsers/playlistbrowser/UserPlaylistCategory.h @@ -38,7 +38,7 @@ public: static QString s_configGroup; - UserPlaylistCategory( QWidget *parent ); + explicit UserPlaylistCategory( QWidget *parent ); ~UserPlaylistCategory(); }; diff --git a/src/browsers/playlistbrowser/UserPlaylistCategory.cpp b/src/browsers/playlistbrowser/UserPlaylistCategory.cpp --- a/src/browsers/playlistbrowser/UserPlaylistCategory.cpp +++ b/src/browsers/playlistbrowser/UserPlaylistCategory.cpp @@ -26,22 +26,22 @@ using namespace PlaylistBrowserNS; -QString UserPlaylistCategory::s_configGroup( "Saved Playlists View" ); +QString UserPlaylistCategory::s_configGroup( QStringLiteral("Saved Playlists View") ); UserPlaylistCategory::UserPlaylistCategory( QWidget * parent ) : PlaylistBrowserCategory( Playlists::UserPlaylist, - "user playlists", s_configGroup, + QStringLiteral("user playlists"), s_configGroup, The::userPlaylistModel(), parent ) { setPrettyName( i18n( "Saved Playlists" ) ); setShortDescription( i18n( "User generated and imported playlists" ) ); - setIcon( QIcon::fromTheme( "amarok_playlist" ) ); + setIcon( QIcon::fromTheme( QStringLiteral("amarok_playlist") ) ); setLongDescription( i18n( "Create, edit, organize and load playlists. " "Amarok automatically adds any playlists found when scanning your collection, " "and any playlists that you save are also shown here." ) ); - setImagePath( QStandardPaths::locate( QStandardPaths::GenericDataLocation, "amarok/images/hover_info_user_playlists.png" ) ); + setImagePath( QStandardPaths::locate( QStandardPaths::GenericDataLocation, QStringLiteral("amarok/images/hover_info_user_playlists.png") ) ); } UserPlaylistCategory::~UserPlaylistCategory() diff --git a/src/browsers/playlistbrowser/UserPlaylistModel.h b/src/browsers/playlistbrowser/UserPlaylistModel.h --- a/src/browsers/playlistbrowser/UserPlaylistModel.h +++ b/src/browsers/playlistbrowser/UserPlaylistModel.h @@ -41,20 +41,20 @@ static UserModel * instance(); static void destroy(); - ~UserModel(); + ~UserModel() override; - virtual bool setData( const QModelIndex &index, const QVariant &value, int role = Qt::EditRole ); - virtual bool removeRows( int row, int count, const QModelIndex & parent = QModelIndex() ); + bool setData( const QModelIndex &index, const QVariant &value, int role = Qt::EditRole ) override; + bool removeRows( int row, int count, const QModelIndex & parent = QModelIndex() ) override; - virtual Qt::DropActions supportedDropActions() const { + Qt::DropActions supportedDropActions() const override { return Qt::CopyAction | Qt::MoveAction; } - virtual Qt::DropActions supportedDragActions() const { + Qt::DropActions supportedDragActions() const override { return Qt::MoveAction | Qt::CopyAction; } - bool dropMimeData ( const QMimeData * data, Qt::DropAction action, int row, int column, const QModelIndex & parent ); + bool dropMimeData ( const QMimeData * data, Qt::DropAction action, int row, int column, const QModelIndex & parent ) override; private: UserModel(); diff --git a/src/browsers/playlistbrowser/UserPlaylistModel.cpp b/src/browsers/playlistbrowser/UserPlaylistModel.cpp --- a/src/browsers/playlistbrowser/UserPlaylistModel.cpp +++ b/src/browsers/playlistbrowser/UserPlaylistModel.cpp @@ -45,11 +45,11 @@ } } -PlaylistBrowserNS::UserModel *PlaylistBrowserNS::UserModel::s_instance = 0; +PlaylistBrowserNS::UserModel *PlaylistBrowserNS::UserModel::s_instance = nullptr; PlaylistBrowserNS::UserModel *PlaylistBrowserNS::UserModel::instance() { - if( s_instance == 0 ) + if( s_instance == nullptr ) s_instance = new UserModel(); return s_instance; @@ -61,7 +61,7 @@ if( s_instance ) { delete s_instance; - s_instance = 0; + s_instance = nullptr; } } @@ -88,15 +88,15 @@ if( newName.isEmpty() ) return false; Playlists::PlaylistPtr playlist = m_playlists.value( idx.internalId() ); - // we emit dataChanged signals later + // we Q_EMIT dataChanged signals later return The::playlistManager()->rename( playlist, newName ); } case PlaylistBrowserModel::LabelColumn: { debug() << "changing group of item " << idx.internalId() << " to " << value.toString(); Playlists::PlaylistPtr item = m_playlists.value( idx.internalId() ); item->setGroups( value.toStringList() ); - // we emit dataChanged signals later + // we Q_EMIT dataChanged signals later return true; } default: @@ -176,7 +176,7 @@ if( data->hasUrls() ) { foreach( const QUrl &url, data->urls() ) - The::playlistManager()->import( url.toString() ); + The::playlistManager()->import( url ); } return false; diff --git a/src/browsers/servicebrowser/ServiceBrowser.h b/src/browsers/servicebrowser/ServiceBrowser.h --- a/src/browsers/servicebrowser/ServiceBrowser.h +++ b/src/browsers/servicebrowser/ServiceBrowser.h @@ -32,7 +32,7 @@ /** * A browser for selecting and displaying a service in the style of the first - * imbedded Magnatune store from a list of available services. Allows + * embedded Magnatune store from a list of available services. Allows * many services to be shown as a single category. * Implemented as a singleton. * @@ -76,7 +76,7 @@ * @param parent The parent widget. * @param name The name of this widget. */ - ServiceBrowser( const QString& name, QWidget *parent = 0 ); + ServiceBrowser( const QString& name, QWidget *parent = nullptr ); static ServiceBrowser *s_instance; diff --git a/src/browsers/servicebrowser/ServiceBrowser.cpp b/src/browsers/servicebrowser/ServiceBrowser.cpp --- a/src/browsers/servicebrowser/ServiceBrowser.cpp +++ b/src/browsers/servicebrowser/ServiceBrowser.cpp @@ -20,12 +20,12 @@ #include -ServiceBrowser * ServiceBrowser::s_instance = 0; +ServiceBrowser * ServiceBrowser::s_instance = nullptr; ServiceBrowser * ServiceBrowser::instance() { - if ( s_instance == 0 ) - s_instance = new ServiceBrowser( "internet" ); + if ( s_instance == nullptr ) + s_instance = new ServiceBrowser( QStringLiteral("internet") ); return s_instance; } @@ -38,7 +38,7 @@ setLongDescription( i18n( "The Internet browser lets you browse online sources of content that integrates directly into Amarok. Amarok ships with a number of these sources, but many more can be added using scripts." ) ); - setImagePath( QStandardPaths::locate( QStandardPaths::GenericDataLocation, "amarok/images/hover_info_internet.png" ) ); + setImagePath( QStandardPaths::locate( QStandardPaths::GenericDataLocation, QStringLiteral("amarok/images/hover_info_internet.png") ) ); } diff --git a/src/configdialog/ConfigDialog.h b/src/configdialog/ConfigDialog.h --- a/src/configdialog/ConfigDialog.h +++ b/src/configdialog/ConfigDialog.h @@ -33,7 +33,7 @@ public: Amarok2ConfigDialog( QWidget *parent, const char* name, KConfigSkeleton *config ); - ~Amarok2ConfigDialog(); + ~Amarok2ConfigDialog() override; void addPage( ConfigDialogBase *page, const QString &itemName, const QString &pixmapName, const QString &header = QString(), bool manage = true ); @@ -52,13 +52,13 @@ void updateButtons(); protected Q_SLOTS: - void updateSettings() Q_DECL_OVERRIDE; - void updateWidgets() Q_DECL_OVERRIDE; - void updateWidgetsDefault() Q_DECL_OVERRIDE; + void updateSettings() override; + void updateWidgets() override; + void updateWidgetsDefault() override; protected: - bool hasChanged() Q_DECL_OVERRIDE; - bool isDefault() Q_DECL_OVERRIDE; + bool hasChanged() override; + bool isDefault() override; private: QList m_pageList; diff --git a/src/configdialog/ConfigDialog.cpp b/src/configdialog/ConfigDialog.cpp --- a/src/configdialog/ConfigDialog.cpp +++ b/src/configdialog/ConfigDialog.cpp @@ -34,7 +34,7 @@ #include -QString Amarok2ConfigDialog::s_currentPage = "GeneralConfig"; +QString Amarok2ConfigDialog::s_currentPage = QStringLiteral("GeneralConfig"); ////////////////////////////////////////////////////////////////////////////////////////// // PUBLIC @@ -56,21 +56,21 @@ ConfigDialogBase *scripts = new ScriptsConfig( this ); //ConfigDialogBase* mediadevice = new MediadeviceConfig( this ); - addPage( general, i18nc( "Miscellaneous settings", "General" ), "preferences-other-amarok", i18n( "Configure General Options" ) ); - addPage( collection, i18n( "Local Collection" ), "drive-harddisk", i18n( "Configure Local Collection" ) ); - addPage( metadata, i18n( "Metadata" ), "amarok_playcount", i18n( "Configure Metadata Handling" ) ); - addPage( playback, i18n( "Playback" ), "preferences-media-playback-amarok", i18n( "Configure Playback" ) ); - addPage( notify, i18n( "Notifications" ), "preferences-indicator-amarok", i18n( "Configure Notifications" ) ); - addPage( database, i18n( "Database" ), "server-database", i18n( "Configure Database" ) ); - addPage( plugins, i18n( "Plugins" ), "preferences-plugin", i18n( "Configure Plugins" ) ); - addPage( scripts, i18n( "Scripts" ), "preferences-plugin-script", i18n( "Configure Scripts" ) ); + addPage( general, i18nc( "Miscellaneous settings", "General" ), QStringLiteral("preferences-other-amarok"), i18n( "Configure General Options" ) ); + addPage( collection, i18n( "Local Collection" ), QStringLiteral("drive-harddisk"), i18n( "Configure Local Collection" ) ); + addPage( metadata, i18n( "Metadata" ), QStringLiteral("amarok_playcount"), i18n( "Configure Metadata Handling" ) ); + addPage( playback, i18n( "Playback" ), QStringLiteral("preferences-media-playback-amarok"), i18n( "Configure Playback" ) ); + addPage( notify, i18n( "Notifications" ), QStringLiteral("preferences-indicator-amarok"), i18n( "Configure Notifications" ) ); + addPage( database, i18n( "Database" ), QStringLiteral("server-database"), i18n( "Configure Database" ) ); + addPage( plugins, i18n( "Plugins" ), QStringLiteral("preferences-plugin"), i18n( "Configure Plugins" ) ); + addPage( scripts, i18n( "Scripts" ), QStringLiteral("preferences-plugin-script"), i18n( "Configure Scripts" ) ); //addPage( mediadevice, i18n( "Media Devices" ), "preferences-multimedia-player-amarok", i18n( "Configure Portable Player Support" ) ); QPushButton *okButton = buttonBox()->button(QDialogButtonBox::Ok); okButton->setDefault(true); okButton->setShortcut(Qt::CTRL | Qt::Key_Return); - KWindowConfig::restoreWindowSize(windowHandle(), Amarok::config( "ConfigDialog" )); + KWindowConfig::restoreWindowSize(windowHandle(), Amarok::config( QStringLiteral("ConfigDialog") )); } Amarok2ConfigDialog::~Amarok2ConfigDialog() @@ -88,7 +88,7 @@ } } - KConfigGroup config = Amarok::config( "ConfigDialog" ); + KConfigGroup config = Amarok::config( QStringLiteral("ConfigDialog") ); KWindowConfig::saveWindowSize(windowHandle(), config); AmarokConfig::self()->save(); } diff --git a/src/configdialog/dialogs/CollectionConfig.h b/src/configdialog/dialogs/CollectionConfig.h --- a/src/configdialog/dialogs/CollectionConfig.h +++ b/src/configdialog/dialogs/CollectionConfig.h @@ -27,12 +27,12 @@ Q_OBJECT public: - CollectionConfig( Amarok2ConfigDialog* parent ); + explicit CollectionConfig( Amarok2ConfigDialog* parent ); virtual ~CollectionConfig(); - bool hasChanged() Q_DECL_OVERRIDE; - bool isDefault() Q_DECL_OVERRIDE; - void updateSettings() Q_DECL_OVERRIDE; + bool hasChanged() override; + bool isDefault() override; + void updateSettings() override; private: CollectionSetup* m_collectionSetup; diff --git a/src/configdialog/dialogs/DatabaseConfig.h b/src/configdialog/dialogs/DatabaseConfig.h --- a/src/configdialog/dialogs/DatabaseConfig.h +++ b/src/configdialog/dialogs/DatabaseConfig.h @@ -32,9 +32,9 @@ DatabaseConfig( Amarok2ConfigDialog* parent, KConfigSkeleton *config ); virtual ~DatabaseConfig(); - virtual bool hasChanged() Q_DECL_OVERRIDE; - virtual bool isDefault() Q_DECL_OVERRIDE; - virtual void updateSettings() Q_DECL_OVERRIDE; + bool hasChanged() override; + bool isDefault() override; + void updateSettings() override; public Q_SLOTS: void toggleExternalConfigAvailable( int checkBoxState ); diff --git a/src/configdialog/dialogs/DatabaseConfig.cpp b/src/configdialog/dialogs/DatabaseConfig.cpp --- a/src/configdialog/dialogs/DatabaseConfig.cpp +++ b/src/configdialog/dialogs/DatabaseConfig.cpp @@ -40,10 +40,9 @@ // enable the test button if one of the plugin factories has a correct testSettings slot // get all storage factories - QList factories; - factories = Plugins::PluginManager::instance()->factories( Plugins::PluginManager::Storage ); + auto factories = Plugins::PluginManager::instance()->factories( Plugins::PluginManager::Storage ); bool testFunctionAvailable = false; - foreach( Plugins::PluginFactory* factory, factories ) + for( const auto &factory : factories ) { // check the meta object if there is a testSettings slot available if( factory->metaObject()-> @@ -79,16 +78,15 @@ DatabaseConfig::testDatabaseConnection() //SLOT { // get all storage factories - QList factories; - factories = Plugins::PluginManager::instance()->factories( Plugins::PluginManager::Storage ); + auto factories = Plugins::PluginManager::instance()->factories( Plugins::PluginManager::Storage ); // try if they have a testSettings slot that we can call - foreach( Plugins::PluginFactory* factory, factories ) + for( const auto &factory : factories ) { bool callSucceeded = false; QStringList connectionErrors; - callSucceeded = QMetaObject::invokeMethod( factory, + callSucceeded = QMetaObject::invokeMethod( factory.data(), "testSettings", Q_RETURN_ARG( QStringList, connectionErrors ), Q_ARG( QString, kcfg_Host->text() ), @@ -107,8 +105,8 @@ else KMessageBox::error( this, i18n( "The amarok database reported " "the following errors:\n%1\nIn most cases you will need to resolve " - "these errors before Amarok will run properly." ). - arg( connectionErrors.join( "\n" ) ), + "these errors before Amarok will run properly.", + connectionErrors.join( QStringLiteral("\n") ) ), i18n( "Database Error" )); } } @@ -134,7 +132,7 @@ DatabaseConfig::updateSettings() { if( m_configManager->hasChanged() ) - KMessageBox::messageBox( 0, KMessageBox::Information, + KMessageBox::messageBox( nullptr, KMessageBox::Information, i18n( "Changes to database settings only take\neffect after Amarok is restarted." ), i18n( "Database settings changed" ) ); } @@ -156,10 +154,8 @@ // Don't print the actual password! const QString examplePassword = i18nc( "A default password for insertion into an example SQL command (so as not to print the real one). To be manually replaced by the user.", "password" ); - query = QString( "CREATE DATABASE %1;\nGRANT ALL PRIVILEGES ON %1.* TO '%2' IDENTIFIED BY '%3'; FLUSH PRIVILEGES;" ) - .arg( kcfg_Database->text() ) - .arg( kcfg_User->text() ) - .arg( examplePassword ); + query = QStringLiteral( "CREATE DATABASE %1;\nGRANT ALL PRIVILEGES ON %1.* TO '%2' IDENTIFIED BY '%3'; FLUSH PRIVILEGES;" ) + .arg( kcfg_Database->text(), kcfg_User->text(), examplePassword ); } text_SQL->setPlainText( query ); } diff --git a/src/configdialog/dialogs/ExcludedLabelsDialog.h b/src/configdialog/dialogs/ExcludedLabelsDialog.h --- a/src/configdialog/dialogs/ExcludedLabelsDialog.h +++ b/src/configdialog/dialogs/ExcludedLabelsDialog.h @@ -25,16 +25,13 @@ namespace StatSyncing { class Config; } -class QLineEdit; -class QGridLayout; -class QListWidget; class ExcludedLabelsDialog : public QDialog, private Ui_ExcludedLabelsDialog { Q_OBJECT public: - explicit ExcludedLabelsDialog( StatSyncing::Config *config, QWidget *parent = Q_NULLPTR, + explicit ExcludedLabelsDialog( StatSyncing::Config *config, QWidget *parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags() ); private Q_SLOTS: diff --git a/src/configdialog/dialogs/ExcludedLabelsDialog.cpp b/src/configdialog/dialogs/ExcludedLabelsDialog.cpp --- a/src/configdialog/dialogs/ExcludedLabelsDialog.cpp +++ b/src/configdialog/dialogs/ExcludedLabelsDialog.cpp @@ -40,12 +40,11 @@ { Q_ASSERT( m_statSyncingConfig ); QWidget *mainWidget = new QWidget(this); - QVBoxLayout *mainLayout = new QVBoxLayout; - setLayout(mainLayout); + QVBoxLayout *mainLayout = new QVBoxLayout(this); mainLayout->addWidget(mainWidget); setupUi(mainWidget); - QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel); + QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel, this); QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok); okButton->setDefault(true); okButton->setShortcut(Qt::CTRL | Qt::Key_Return); diff --git a/src/configdialog/dialogs/GeneralConfig.h b/src/configdialog/dialogs/GeneralConfig.h --- a/src/configdialog/dialogs/GeneralConfig.h +++ b/src/configdialog/dialogs/GeneralConfig.h @@ -25,12 +25,12 @@ Q_OBJECT public: - GeneralConfig( Amarok2ConfigDialog* parent ); + explicit GeneralConfig( Amarok2ConfigDialog* parent ); virtual ~GeneralConfig(); - bool hasChanged() Q_DECL_OVERRIDE; - bool isDefault() Q_DECL_OVERRIDE; - void updateSettings() Q_DECL_OVERRIDE; + bool hasChanged() override; + bool isDefault() override; + void updateSettings() override; }; #endif diff --git a/src/configdialog/dialogs/MetadataConfig.h b/src/configdialog/dialogs/MetadataConfig.h --- a/src/configdialog/dialogs/MetadataConfig.h +++ b/src/configdialog/dialogs/MetadataConfig.h @@ -29,12 +29,12 @@ Q_OBJECT public: - MetadataConfig( Amarok2ConfigDialog *parent ); - virtual ~MetadataConfig(); + explicit MetadataConfig( Amarok2ConfigDialog *parent ); + ~MetadataConfig() override; - bool isDefault() Q_DECL_OVERRIDE; - bool hasChanged() Q_DECL_OVERRIDE; - void updateSettings() Q_DECL_OVERRIDE; + bool isDefault() override; + bool hasChanged() override; + void updateSettings() override; Q_SIGNALS: void changed(); diff --git a/src/configdialog/dialogs/MetadataConfig.cpp b/src/configdialog/dialogs/MetadataConfig.cpp --- a/src/configdialog/dialogs/MetadataConfig.cpp +++ b/src/configdialog/dialogs/MetadataConfig.cpp @@ -67,8 +67,8 @@ StatSyncing::Config *config = controller ? controller->config() : 0; m_statSyncingConfig = config; m_statSyncingProvidersView->setModel( config ); - m_synchronizeButton->setIcon( QIcon::fromTheme( "amarok_playcount" ) ); - m_configureTargetButton->setIcon( QIcon::fromTheme( "configure" ) ); + m_synchronizeButton->setIcon( QIcon::fromTheme( QStringLiteral("amarok_playcount") ) ); + m_configureTargetButton->setIcon( QIcon::fromTheme( QStringLiteral("configure") ) ); connect( config, &StatSyncing::Config::dataChanged, this, &MetadataConfig::changed ); connect( config, &StatSyncing::Config::rowsInserted, this, &MetadataConfig::changed ); connect( config, &StatSyncing::Config::rowsRemoved, this, &MetadataConfig::changed ); @@ -126,7 +126,7 @@ { QHBoxLayout *lineLayout = new QHBoxLayout(); QLabel *button = new QLabel(); - button->setObjectName( "configureLabelExceptions" ); + button->setObjectName( QStringLiteral("configureLabelExceptions") ); connect( button, &QLabel::linkActivated, this, &MetadataConfig::slotConfigureExcludedLabels ); @@ -219,15 +219,15 @@ void MetadataConfig::slotUpdateConfigureExcludedLabelsLabel() { - QLabel *label = findChild( "configureLabelExceptions" ); + QLabel *label = findChild( QStringLiteral("configureLabelExceptions") ); if( !label || !m_statSyncingConfig ) { warning() << __PRETTY_FUNCTION__ << "label or m_statSyncingConfig is null!"; return; } int exceptions = m_statSyncingConfig->excludedLabels().count(); - QString begin = ""; - QString end = ""; + QString begin = QStringLiteral(""); + QString end = QStringLiteral(""); label->setText( i18np( "(%2one exception%3)", "(%2%1 exceptions%3)", exceptions, begin, end ) ); } @@ -239,7 +239,7 @@ if( dialog.exec() == QDialog::Accepted ) { slotUpdateConfigureExcludedLabelsLabel(); - emit changed(); + Q_EMIT changed(); } } diff --git a/src/configdialog/dialogs/NotificationsConfig.h b/src/configdialog/dialogs/NotificationsConfig.h --- a/src/configdialog/dialogs/NotificationsConfig.h +++ b/src/configdialog/dialogs/NotificationsConfig.h @@ -29,12 +29,12 @@ Q_OBJECT public: - NotificationsConfig( Amarok2ConfigDialog* parent ); + explicit NotificationsConfig( Amarok2ConfigDialog* parent ); virtual ~NotificationsConfig(); - bool hasChanged() Q_DECL_OVERRIDE; - bool isDefault() Q_DECL_OVERRIDE; - void updateSettings() Q_DECL_OVERRIDE; + bool hasChanged() override; + bool isDefault() override; + void updateSettings() override; Q_SIGNALS: void changed(); @@ -50,8 +50,8 @@ OSDWidget::Alignment m_oldAlignment; uint m_oldYOffset; - void hideEvent( QHideEvent* ); - void showEvent( QShowEvent* ); + void hideEvent( QHideEvent* ) override; + void showEvent( QShowEvent* ) override; }; #endif diff --git a/src/configdialog/dialogs/NotificationsConfig.cpp b/src/configdialog/dialogs/NotificationsConfig.cpp --- a/src/configdialog/dialogs/NotificationsConfig.cpp +++ b/src/configdialog/dialogs/NotificationsConfig.cpp @@ -50,7 +50,7 @@ this, &NotificationsConfig::setGrowlEnabled ); #endif - // Enable/disable the translucency option depending on availablity of desktop compositing + // Enable/disable the translucency option depending on availability of desktop compositing kcfg_OsdUseTranslucency->setEnabled( KWindowSystem::compositingActive() ); connect( m_osdPreview, &OSDPreviewWidget::positionChanged, this, &NotificationsConfig::slotPositionChanged ); @@ -136,7 +136,7 @@ Amarok::KNotificationBackend::instance()->setEnabled( kcfg_KNotifyEnabled->isChecked() ); - emit settingsChanged( QString() ); + Q_EMIT settingsChanged( QString() ); } @@ -154,7 +154,7 @@ kcfg_OsdScreen->blockSignals( false ); // Update button states (e.g. "Apply") - emit changed(); + Q_EMIT changed(); } void diff --git a/src/configdialog/dialogs/PlaybackConfig.h b/src/configdialog/dialogs/PlaybackConfig.h --- a/src/configdialog/dialogs/PlaybackConfig.h +++ b/src/configdialog/dialogs/PlaybackConfig.h @@ -26,12 +26,12 @@ Q_OBJECT public: - PlaybackConfig( Amarok2ConfigDialog* parent ); - virtual ~PlaybackConfig(); + explicit PlaybackConfig( Amarok2ConfigDialog* parent ); + ~PlaybackConfig() override; - bool hasChanged() Q_DECL_OVERRIDE; - bool isDefault() Q_DECL_OVERRIDE; - void updateSettings() Q_DECL_OVERRIDE; + bool hasChanged() override; + bool isDefault() override; + void updateSettings() override; private Q_SLOTS: void configurePhonon(); diff --git a/src/configdialog/dialogs/PlaybackConfig.cpp b/src/configdialog/dialogs/PlaybackConfig.cpp --- a/src/configdialog/dialogs/PlaybackConfig.cpp +++ b/src/configdialog/dialogs/PlaybackConfig.cpp @@ -46,7 +46,7 @@ kcfg_FadeoutLength->setToolTip( toolTip ); } - connect( findChild( "pushButtonPhonon" ), &QAbstractButton::clicked, this, &PlaybackConfig::configurePhonon ); + connect( findChild( QStringLiteral("pushButtonPhonon") ), &QAbstractButton::clicked, this, &PlaybackConfig::configurePhonon ); connect( kcfg_FadeoutOnStop, &QCheckBox::toggled, this, &PlaybackConfig::setFadeoutState ); connect( kcfg_FadeoutOnPause, &QCheckBox::toggled, this, &PlaybackConfig::setFadeoutState ); } @@ -88,7 +88,7 @@ KCMultiDialog KCM; KCM.setWindowTitle( i18n( "Sound System - Amarok" ) ); - KCM.addModule( "kcm_phonon" ); + KCM.addModule( QStringLiteral("kcm_phonon") ); KCM.exec(); } diff --git a/src/configdialog/dialogs/PluginsConfig.h b/src/configdialog/dialogs/PluginsConfig.h --- a/src/configdialog/dialogs/PluginsConfig.h +++ b/src/configdialog/dialogs/PluginsConfig.h @@ -29,12 +29,12 @@ Q_OBJECT public: - PluginsConfig( Amarok2ConfigDialog *parent ); - virtual ~PluginsConfig(); + explicit PluginsConfig( Amarok2ConfigDialog *parent ); + ~PluginsConfig() override; - void updateSettings() Q_DECL_OVERRIDE; - bool hasChanged() Q_DECL_OVERRIDE; - bool isDefault() Q_DECL_OVERRIDE; + void updateSettings() override; + bool hasChanged() override; + bool isDefault() override; public Q_SLOTS: void slotConfigChanged( bool changed ); diff --git a/src/configdialog/dialogs/PluginsConfig.cpp b/src/configdialog/dialogs/PluginsConfig.cpp --- a/src/configdialog/dialogs/PluginsConfig.cpp +++ b/src/configdialog/dialogs/PluginsConfig.cpp @@ -41,13 +41,13 @@ layout->addWidget( m_selector ); m_selector->addPlugins( The::pluginManager()->plugins( Plugins::PluginManager::Collection ), - KPluginSelector::ReadConfigFile, i18n("Collections"), "Collection" ); + KPluginSelector::ReadConfigFile, i18n("Collections"), QStringLiteral("Collection") ); m_selector->addPlugins( The::pluginManager()->plugins( Plugins::PluginManager::Service ), - KPluginSelector::ReadConfigFile, i18n("Internet Services"), "Service" ); + KPluginSelector::ReadConfigFile, i18n("Internet Services"), QStringLiteral("Service") ); m_selector->addPlugins( The::pluginManager()->plugins( Plugins::PluginManager::Importer ), - KPluginSelector::ReadConfigFile, i18n("Statistics importers"), "Importer" ); + KPluginSelector::ReadConfigFile, i18n("Statistics importers"), QStringLiteral("Importer") ); connect( m_selector, &KPluginSelector::changed, this, &PluginsConfig::slotConfigChanged ); connect( m_selector, &KPluginSelector::changed, parent, &Amarok2ConfigDialog::updateButtons ); diff --git a/src/configdialog/dialogs/ScriptSelector.h b/src/configdialog/dialogs/ScriptSelector.h --- a/src/configdialog/dialogs/ScriptSelector.h +++ b/src/configdialog/dialogs/ScriptSelector.h @@ -23,14 +23,13 @@ class KCategorizedView; class QLineEdit; class KPluginInfo; -class QScrollBar; class ScriptSelector : public KPluginSelector { Q_OBJECT public: - ScriptSelector( QWidget * parent ); + explicit ScriptSelector( QWidget * parent ); ~ScriptSelector(); QString currentItem() const; diff --git a/src/configdialog/dialogs/ScriptSelector.cpp b/src/configdialog/dialogs/ScriptSelector.cpp --- a/src/configdialog/dialogs/ScriptSelector.cpp +++ b/src/configdialog/dialogs/ScriptSelector.cpp @@ -111,8 +111,8 @@ ScriptSelector::slotFiltered( const QString &filter ) { if( filter.isEmpty() ) - emit filtered( false ); + Q_EMIT filtered( false ); else - emit filtered( true ); + Q_EMIT filtered( true ); } diff --git a/src/configdialog/dialogs/ScriptsConfig.h b/src/configdialog/dialogs/ScriptsConfig.h --- a/src/configdialog/dialogs/ScriptsConfig.h +++ b/src/configdialog/dialogs/ScriptsConfig.h @@ -36,12 +36,12 @@ Q_OBJECT public: - ScriptsConfig( Amarok2ConfigDialog *parent ); - virtual ~ScriptsConfig(); + explicit ScriptsConfig( Amarok2ConfigDialog *parent ); + ~ScriptsConfig() override; - void updateSettings() Q_DECL_OVERRIDE; - bool hasChanged() Q_DECL_OVERRIDE; - bool isDefault() Q_DECL_OVERRIDE; + void updateSettings() override; + bool hasChanged() override; + bool isDefault() override; public Q_SLOTS: void slotConfigChanged( bool changed ); diff --git a/src/configdialog/dialogs/ScriptsConfig.cpp b/src/configdialog/dialogs/ScriptsConfig.cpp --- a/src/configdialog/dialogs/ScriptsConfig.cpp +++ b/src/configdialog/dialogs/ScriptsConfig.cpp @@ -59,7 +59,7 @@ // Load config gui.kcfg_AutoUpdateScripts->setChecked( AmarokConfig::autoUpdateScripts() ); - gui.manageButton->setIcon( QIcon::fromTheme( "get-hot-new-stuff-amarok" ) ); + gui.manageButton->setIcon( QIcon::fromTheme( QStringLiteral("get-hot-new-stuff-amarok") ) ); connect( gui.manageButton, &QAbstractButton::clicked, this, &ScriptsConfig::slotManageScripts ); connect( gui.installButton, &QAbstractButton::clicked, @@ -85,7 +85,7 @@ ScriptsConfig::slotManageScripts() { QStringList updateScriptsList; - KNS3::DownloadDialog dialog("amarok.knsrc", this); + KNS3::DownloadDialog dialog(QStringLiteral("amarok.knsrc"), this); dialog.exec(); if( !dialog.installedEntries().isEmpty() || !dialog.changedEntries().isEmpty() ) @@ -131,7 +131,7 @@ // the script can actually be updated if you get the folder name right int response = KMessageBox::warningContinueCancel( this, i18n( "Manually installed scripts " "cannot be automatically updated, continue?" ), QString(), KStandardGuiItem::cont() - , KStandardGuiItem::cancel(), "manualScriptInstallWarning" ); + , KStandardGuiItem::cancel(), QStringLiteral("manualScriptInstallWarning") ); if( response == KMessageBox::Cancel ) return; @@ -143,7 +143,7 @@ QMimeDatabase db; QMimeType mimeType = db.mimeTypeForFile( filePath ); QScopedPointer archive; - if( mimeType.inherits( "application/zip" ) ) + if( mimeType.inherits( QStringLiteral("application/zip") ) ) archive.reset( new KZip( filePath ) ); else archive.reset( new KTar( filePath ) ); @@ -154,7 +154,7 @@ return; } - QString destination = QStandardPaths::writableLocation( QStandardPaths::GenericDataLocation ) + QString("amarok/scripts/") + fileName + "/"; + QString destination = QStandardPaths::writableLocation( QStandardPaths::GenericDataLocation ) + QStringLiteral("amarok/scripts/") + fileName + '/'; const KArchiveDirectory* const archiveDir = archive->directory(); const QDir dir( destination ); const KArchiveFile *specFile = findSpecFile( archiveDir ); @@ -182,7 +182,7 @@ { QString existingVersion = ScriptManager::instance()->m_scripts[ newScriptInfo.pluginName() ]->info().version(); QString message = i18n( "Another script with the name %1 already exists\nExisting Script's " - "Version: %1\nSelected Script's Version: %2", newScriptInfo.version() + "Version: %2\nSelected Script's Version: %3", newScriptInfo.name() , existingVersion, newScriptInfo.version() ); KMessageBox::error( this, message ); return; @@ -202,15 +202,15 @@ DEBUG_BLOCK m_oldSelector = m_selector; m_selector = new ScriptSelector( this ); - QString key = QLatin1String( "Generic" ); + QString key = QStringLiteral( "Generic" ); m_selector->addScripts( ScriptManager::instance()->scripts( key ), KPluginSelector::ReadConfigFile, i18n("Generic"), key ); - key = QLatin1String( "Lyrics" ); + key = QStringLiteral( "Lyrics" ); m_selector->addScripts( ScriptManager::instance()->scripts( key ), KPluginSelector::ReadConfigFile, i18n("Lyrics"), key ); - key = QLatin1String( "Scriptable Service" ); + key = QStringLiteral( "Scriptable Service" ); m_selector->addScripts( ScriptManager::instance()->scripts( key ), KPluginSelector::ReadConfigFile, i18n("Scriptable Service"), key ); connect( m_selector, &ScriptSelector::changed, this, &ScriptsConfig::slotConfigChanged ); @@ -268,12 +268,12 @@ { if( dir->entry( entry )->isFile() ) { - if( entry == "script.spec" ) + if( entry == QLatin1String("script.spec") ) return static_cast( dir->entry( entry ) ); } else { - if( entry != "." && entry != ".." ) + if( entry != QLatin1String(".") && entry != QLatin1String("..") ) { const KArchiveDirectory *subDir = static_cast( dir->entry( entry ) ); if( subDir ) @@ -286,7 +286,7 @@ } } } - return 0; + return nullptr; } void diff --git a/src/context/AmarokContextPackageStructure.h b/src/context/AmarokContextPackageStructure.h --- a/src/context/AmarokContextPackageStructure.h +++ b/src/context/AmarokContextPackageStructure.h @@ -27,7 +27,7 @@ Q_OBJECT public: - virtual void initPackage(KPackage::Package *package) Q_DECL_OVERRIDE; + void initPackage(KPackage::Package *package) override; }; #endif // AMAROKCONTEXTPACKAGESTRUCTURE_H diff --git a/src/context/AmarokContextPackageStructure.cpp b/src/context/AmarokContextPackageStructure.cpp --- a/src/context/AmarokContextPackageStructure.cpp +++ b/src/context/AmarokContextPackageStructure.cpp @@ -24,6 +24,8 @@ void AmarokContextPackageStructure::initPackage(KPackage::Package* package) { package->addFileDefinition("mainscript", QStringLiteral("ui/main.qml"), i18n("Main Script File")); + package->addFileDefinition("icon", QStringLiteral("images/icon.png"), i18n("Applet Icon File")); + package->addFileDefinition("icon", QStringLiteral("images/icon.svg"), i18n("Applet Icon File")); package->setDefaultPackageRoot(QStringLiteral("kpackage/amarok")); package->addDirectoryDefinition("images", QStringLiteral("images"), i18n("Images")); auto mimetypes = QStringList() << QStringLiteral("image/svg+xml"); diff --git a/src/context/AppletLoader.h b/src/context/AppletLoader.h --- a/src/context/AppletLoader.h +++ b/src/context/AppletLoader.h @@ -30,15 +30,15 @@ Q_OBJECT public: - AppletLoader(QObject *parent = Q_NULLPTR); + explicit AppletLoader(QObject *parent = nullptr); ~AppletLoader(); QList applets() const; QList enabledApplets() const; void findApplets(); -signals: - void finished(QList); +Q_SIGNALS: + void finished(const QList&); private: QList m_applets; diff --git a/src/context/AppletLoader.cpp b/src/context/AppletLoader.cpp --- a/src/context/AppletLoader.cpp +++ b/src/context/AppletLoader.cpp @@ -43,7 +43,7 @@ QList Context::AppletLoader::enabledApplets() const { QList list; - QStringList enabledApplets = Amarok::config("Context").readEntry("enabledApplets", QStringList()); + QStringList enabledApplets = Amarok::config(QStringLiteral("Context")).readEntry("enabledApplets", QStringList()); for (const auto &applet : m_applets) { @@ -64,7 +64,7 @@ QString(), [] (const KPluginMetaData &data) { return data.serviceTypes().contains(QStringLiteral("Amarok/ContextApplet")); }); - emit finished(m_applets); + Q_EMIT finished(m_applets); for (const auto &applet : m_applets) { diff --git a/src/context/AppletModel.h b/src/context/AppletModel.h --- a/src/context/AppletModel.h +++ b/src/context/AppletModel.h @@ -41,23 +41,23 @@ Icon, Mainscript, Collapsed, - PackagePath, ContentHeight }; Q_ENUM(Role) - AppletModel(AppletLoader *loader, QObject *parent = Q_NULLPTR); - virtual ~AppletModel(); + explicit AppletModel(AppletLoader *loader, QObject *parent = nullptr); + ~AppletModel() override; - virtual int rowCount(const QModelIndex& parent) const Q_DECL_OVERRIDE; - virtual QVariant data(const QModelIndex& index, int role) const Q_DECL_OVERRIDE; - virtual bool setData(const QModelIndex& index, const QVariant& value, int role) Q_DECL_OVERRIDE; - virtual QHash< int, QByteArray > roleNames() const Q_DECL_OVERRIDE; + int rowCount(const QModelIndex& parent) const override; + QVariant data(const QModelIndex& index, int role) const override; + bool setData(const QModelIndex& index, const QVariant& value, int role) override; + QHash< int, QByteArray > roleNames() const override; AppletLoader* loader() const { return m_loader; } Q_INVOKABLE void setAppletCollapsed(const QString &id, bool collapsed); Q_INVOKABLE void setAppletContentHeight(const QString& id, qreal height); + Q_INVOKABLE QUrl imageUrl(const QString &id, const QString &imageName); public Q_SLOTS: void newApplets(const QList &applets); @@ -77,8 +77,8 @@ Q_PROPERTY(QStringList enabledApplets READ enabledApplets NOTIFY enabledAppletsChanged) public: - AppletProxyModel(AppletModel *appletModel, QObject *parent = Q_NULLPTR); - virtual ~AppletProxyModel(); + explicit AppletProxyModel(AppletModel *appletModel, QObject *parent = nullptr); + ~AppletProxyModel() override; /** * @returns QStringList with ids of all enabled applets. @@ -133,8 +133,8 @@ void enabledAppletsChanged(); protected: - bool lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const Q_DECL_OVERRIDE; - bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const Q_DECL_OVERRIDE; + bool lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const override; + bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override; private: AppletModel *m_appletModel; diff --git a/src/context/AppletModel.cpp b/src/context/AppletModel.cpp --- a/src/context/AppletModel.cpp +++ b/src/context/AppletModel.cpp @@ -74,7 +74,7 @@ m_packages.clear(); - for (const auto applet : applets) + for (const auto &applet : applets) { auto loader = KPackage::PackageLoader::self(); auto structure = new AmarokContextPackageStructure; @@ -115,19 +115,16 @@ return package.metadata().pluginId(); case Icon: - return package.metadata().iconName(); + return package.fileUrl("icon"); case Mainscript: - return QUrl::fromLocalFile(package.filePath("mainscript")); + return package.fileUrl("mainscript"); case Collapsed: - return Amarok::config("Context").readEntry(package.metadata().pluginId() + "_collapsed", false); + return Amarok::config(QStringLiteral("Context")).readEntry(package.metadata().pluginId() + "_collapsed", false); case ContentHeight: - return Amarok::config("Context").readEntry(package.metadata().pluginId() + "_contentHeight", 300); - - case PackagePath: - return QVariant(package.path() + "contents/"); + return Amarok::config(QStringLiteral("Context")).readEntry(package.metadata().pluginId() + "_contentHeight", 300); } return QVariant(); @@ -146,14 +143,14 @@ { case Collapsed: { - Amarok::config("Context").writeEntry(package.metadata().pluginId() + "_collapsed", value.toBool()); - emit dataChanged(index, index, QVector{role}); + Amarok::config(QStringLiteral("Context")).writeEntry(package.metadata().pluginId() + "_collapsed", value.toBool()); + Q_EMIT dataChanged(index, index, QVector{role}); return true; } case ContentHeight: { - Amarok::config("Context").writeEntry(package.metadata().pluginId() + "_contentHeight", value.toReal()); - emit dataChanged(index, index, QVector{role}); + Amarok::config(QStringLiteral("Context")).writeEntry(package.metadata().pluginId() + "_contentHeight", value.toReal()); + Q_EMIT dataChanged(index, index, QVector{role}); return true; } @@ -172,7 +169,6 @@ roles.insert(Icon, "icon"); roles.insert(Mainscript, "mainscript"); roles.insert(Collapsed, "collapsed"); - roles.insert(PackagePath, "packagePath"); roles.insert(ContentHeight, "contentHeight"); return roles; @@ -187,10 +183,10 @@ auto package = findPackage(id); if (package.isValid()) { - Amarok::config("Context").writeEntry(id + "_collapsed", collapsed); + Amarok::config(QStringLiteral("Context")).writeEntry(id + "_collapsed", collapsed); int row = m_packages.indexOf(package); auto index = createIndex(row, 0); - emit dataChanged(index, index, QVector{Collapsed}); + Q_EMIT dataChanged(index, index, QVector{Collapsed}); } } @@ -203,13 +199,21 @@ auto package = findPackage(id); if (package.isValid()) { - Amarok::config("Context").writeEntry(id + "_contentHeight", height); + Amarok::config(QStringLiteral("Context")).writeEntry(id + "_contentHeight", height); int row = m_packages.indexOf(package); auto index = createIndex(row, 0); - emit dataChanged(index, index, QVector{ContentHeight}); + Q_EMIT dataChanged(index, index, QVector{ContentHeight}); } } +QUrl Context::AppletModel::imageUrl(const QString& id, const QString& imageName) +{ + auto package = findPackage(id); + if (package.isValid()) + return package.fileUrl("images", imageName); + return QUrl(); +} + AppletPackage AppletModel::findPackage(const QString& id) { for (const auto &package : m_packages) @@ -249,7 +253,7 @@ std::sort(list.begin(), list.end(), [] (const QString &a, const QString &b) { - QStringList ae = Amarok::config("Context").readEntry("enabledApplets", QStringList()); + QStringList ae = Amarok::config(QStringLiteral("Context")).readEntry("enabledApplets", QStringList()); return ae.indexOf(a) < ae.indexOf(b); } ); @@ -280,13 +284,13 @@ { ea.removeAll(id); } - Amarok::config("Context").writeEntry("enabledApplets", ea); + Amarok::config(QStringLiteral("Context")).writeEntry("enabledApplets", ea); debug() << "New enabled applets:" << ea; invalidateFilter(); - emit enabledAppletsChanged(); + Q_EMIT enabledAppletsChanged(); } void AppletProxyModel::setAppletPlace(const QString& id, int place) @@ -317,7 +321,7 @@ beginMoveRows(QModelIndex(), currentPlace, currentPlace, QModelIndex(), forward ? place + 1 : place); ea.move(currentPlace, place); - Amarok::config("Context").writeEntry("enabledApplets", ea); + Amarok::config(QStringLiteral("Context")).writeEntry("enabledApplets", ea); endMoveRows(); debug() << "New enabled applets:" << ea; diff --git a/src/context/CMakeLists.txt b/src/context/CMakeLists.txt --- a/src/context/CMakeLists.txt +++ b/src/context/CMakeLists.txt @@ -52,4 +52,4 @@ install( FILES ${qml_plugin_qml_files} DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/amarok/qml ) -kpackage_install_package( context_qml_package org.kde.amarok.context genericqml ) +kpackage_install_bundled_package( context_qml_package org.kde.amarok.context genericqml ) diff --git a/src/context/ContextDock.h b/src/context/ContextDock.h --- a/src/context/ContextDock.h +++ b/src/context/ContextDock.h @@ -27,9 +27,9 @@ Q_OBJECT public: - ContextDock( QWidget *parent ); + explicit ContextDock( QWidget *parent ); - void polish(); + void polish() override; protected Q_SLOTS: void createContextView(); diff --git a/src/context/ContextDock.cpp b/src/context/ContextDock.cpp --- a/src/context/ContextDock.cpp +++ b/src/context/ContextDock.cpp @@ -26,7 +26,7 @@ ContextDock::ContextDock( QWidget *parent ) : AmarokDockWidget( i18n( "&Context" ), parent ) { - setObjectName( "Context dock" ); + setObjectName( QStringLiteral("Context dock") ); setAllowedAreas( Qt::AllDockWidgetAreas ); setMinimumWidth( 50 ); setContentsMargins( 0, 0, 0, 0 ); diff --git a/src/context/ContextView.h b/src/context/ContextView.h --- a/src/context/ContextView.h +++ b/src/context/ContextView.h @@ -28,11 +28,9 @@ #include + class ContextUrlRunner; -class FontFilter; class QPalette; -class QQmlPropertyMap; -class QScreen; namespace Context { @@ -45,14 +43,8 @@ { Q_OBJECT - // Properties copied from KF5::Plasma::Units - Q_PROPERTY( int smallSpacing READ smallSpacing NOTIFY spacingChanged ) - Q_PROPERTY( int largeSpacing READ largeSpacing NOTIFY spacingChanged ) - Q_PROPERTY( QQmlPropertyMap *iconSizes READ iconSizes CONSTANT ) - Q_PROPERTY( qreal devicePixelRatio READ devicePixelRatio NOTIFY devicePixelRatioChanged ) - public: - ContextView( QWidget *parent = Q_NULLPTR ); + explicit ContextView( QWidget *parent = nullptr ); ~ContextView(); /** @@ -81,39 +73,17 @@ Q_INVOKABLE void warning( const QString &error ) const; Q_INVOKABLE void error( const QString &error ) const; - int smallSpacing() const { return m_smallSpacing; } - int largeSpacing() const { return m_largeSpacing; } - QQmlPropertyMap* iconSizes() const { return m_iconSizes; } - qreal devicePixelRatio() const { return m_devicePixelRatio; } - -private slots: +private Q_SLOTS: void slotStatusChanged( QQuickWidget::Status status ); - void updateSpacing(); - void updateDevicePixelRatio( QScreen *screen ); - void iconLoaderSettingsChanged(); void updatePalette( const QPalette &palette ); -signals: - void spacingChanged(); - void iconSizesChanged(); - void devicePixelRatioChanged(); - private: - // copied from KF5::Plasma::Units - int devicePixelIconSize( int size ) const; - static ContextView *s_self; ContextUrlRunner *m_urlRunner; AppletLoader *m_loader; AppletModel *m_appletModel; AppletProxyModel *m_proxyModel; - FontFilter *m_fontFilter; - - int m_smallSpacing; - int m_largeSpacing; - QQmlPropertyMap *m_iconSizes; - qreal m_devicePixelRatio; }; } // Context namespace diff --git a/src/context/ContextView.cpp b/src/context/ContextView.cpp --- a/src/context/ContextView.cpp +++ b/src/context/ContextView.cpp @@ -36,74 +36,37 @@ #include #include #include -#include #include #include #include #include -class FontFilter : public QObject -{ - Q_OBJECT - -public: - FontFilter( QObject *parent ) - : QObject( parent ) - { - qApp->installEventFilter( this ); - } - - bool eventFilter( QObject *watched, QEvent *event ) - { - if( watched == qApp ) - { - if( event->type() == QEvent::ApplicationFontChange ) - emit fontChanged(); - } - return QObject::eventFilter( watched, event ); - } - -signals: - void fontChanged(); -}; - - namespace Context { -ContextView* ContextView::s_self = Q_NULLPTR; +ContextView* ContextView::s_self = nullptr; ContextView::ContextView( QWidget *parent ) : QQuickWidget( parent ) - , m_urlRunner( Q_NULLPTR ) + , m_urlRunner( nullptr ) , m_loader( new AppletLoader( this ) ) , m_appletModel( new AppletModel( m_loader, this ) ) , m_proxyModel( new AppletProxyModel( m_appletModel, this ) ) - , m_fontFilter( new FontFilter( this ) ) - , m_smallSpacing( 2 ) - , m_largeSpacing( 8 ) - , m_iconSizes( new QQmlPropertyMap( this ) ) { DEBUG_BLOCK KDeclarative::KDeclarative decl; decl.setDeclarativeEngine( engine() ); decl.setupBindings(); connect( this, &QQuickWidget::statusChanged, this, &ContextView::slotStatusChanged ); - connect( qApp, &QGuiApplication::primaryScreenChanged, this, &ContextView::updateDevicePixelRatio ); - connect( m_fontFilter, &FontFilter::fontChanged, this, &ContextView::updateSpacing ); - connect( KIconLoader::global(), &KIconLoader::iconLoaderSettingsChanged, this, &ContextView::iconLoaderSettingsChanged ); connect( The::paletteHandler(), &PaletteHandler::newPalette, this, &ContextView::updatePalette ); - updateSpacing(); - updateDevicePixelRatio( qApp->primaryScreen() ); - m_urlRunner = new ContextUrlRunner(); - The::amarokUrlHandler()->registerRunner( m_urlRunner, "context" ); + The::amarokUrlHandler()->registerRunner( m_urlRunner, QStringLiteral("context") ); rootContext()->setContextProperty( QStringLiteral( "AppletModel" ), m_appletModel ); rootContext()->setContextProperty( QStringLiteral( "AppletProxyModel" ), m_proxyModel ); @@ -116,12 +79,11 @@ QStringLiteral( "org.kde.amarok.context" ) ); Q_ASSERT( qmlPackage.isValid() ); - const QString sourcePath = qmlPackage.filePath( "mainscript" ); - Q_ASSERT( QFile::exists( sourcePath ) ); + const QUrl sourceUrl = qmlPackage.fileUrl( "mainscript" ); - ::debug() << "Loading context qml mainscript:" << sourcePath; + ::debug() << "Loading context qml mainscript:" << sourceUrl; - setSource( QUrl::fromLocalFile( sourcePath ) ); + setSource( sourceUrl ); setResizeMode( SizeRootObjectToView ); // keep this assignment at bottom so that premature usage of ::self() asserts out @@ -133,7 +95,7 @@ DEBUG_BLOCK delete m_urlRunner; - s_self = Q_NULLPTR; + s_self = nullptr; } QStringList @@ -188,67 +150,6 @@ error( e.description() ); } -void -ContextView::updateSpacing() -{ - int gridUnit = QFontMetrics( QGuiApplication::font() ).boundingRect( QStringLiteral("M") ).height(); - if (gridUnit % 2 != 0) - gridUnit++; - - if (gridUnit != m_largeSpacing) - { - m_smallSpacing = qMax( 2, (int)( gridUnit / 4 ) ); // 1/4 of gridUnit, at least 2 - m_largeSpacing = gridUnit; // msize.height - emit spacingChanged(); - } -} - -void -ContextView::updateDevicePixelRatio( QScreen *screen ) -{ - if (!screen) - return; - - const qreal dpi = screen->logicalDotsPerInchX(); - // Usual "default" is 96 dpi - m_devicePixelRatio = (qreal)dpi / (qreal)96; - iconLoaderSettingsChanged(); - emit devicePixelRatioChanged(); -} - -void -ContextView::iconLoaderSettingsChanged() -{ - m_iconSizes->insert( QStringLiteral( "tiny" ), devicePixelIconSize( KIconLoader::SizeSmall ) / 2 ); - m_iconSizes->insert( QStringLiteral( "small" ), devicePixelIconSize( KIconLoader::SizeSmall ) ); - m_iconSizes->insert( QStringLiteral( "smallMedium" ), devicePixelIconSize( KIconLoader::SizeSmallMedium ) ); - m_iconSizes->insert( QStringLiteral( "medium" ), devicePixelIconSize( KIconLoader::SizeMedium ) ); - m_iconSizes->insert( QStringLiteral( "large" ), devicePixelIconSize( KIconLoader::SizeLarge ) ); - m_iconSizes->insert( QStringLiteral( "huge" ), devicePixelIconSize( KIconLoader::SizeHuge ) ); - m_iconSizes->insert( QStringLiteral( "enormous" ), devicePixelIconSize( KIconLoader::SizeEnormous ) ); - - emit iconSizesChanged(); -} - -int -ContextView::devicePixelIconSize( int size ) const -{ - const qreal ratio = devicePixelRatio(); - - if ( ratio < 1.5 ) - return size; - else if ( ratio < 2.0 ) - return size * 1.5; - else if ( ratio < 2.5 ) - return size * 2.0; - else if ( ratio < 3.0 ) - return size * 2.5; - else if ( ratio < 3.5 ) - return size * 3.0; - else - return size * ratio; -} - void ContextView::updatePalette( const QPalette &palette ) { @@ -274,5 +175,3 @@ } } // Context namespace - -#include diff --git a/src/context/LyricsManager.h b/src/context/LyricsManager.h deleted file mode 100644 --- a/src/context/LyricsManager.h +++ /dev/null @@ -1,129 +0,0 @@ -/**************************************************************************************** - * Copyright (c) 2007 Leo Franchi * - * * - * This program is free software; you can redistribute it and/or modify it under * - * the terms of the GNU General Public License as published by the Free Software * - * Foundation; either version 2 of the License, or (at your option) any later * - * version. * - * * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY * - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * - * PARTICULAR PURPOSE. See the GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License along with * - * this program. If not, see . * - ****************************************************************************************/ - -#ifndef LYRICS_MANAGER_H -#define LYRICS_MANAGER_H - -#include "amarok_export.h" - -#include -#include -#include - -class LyricsSubject; - -struct LyricsData -{ - QString text; - QString title; - QString artist; - QUrl site; - - void clear() - { - text.clear(); - title.clear(); - artist.clear(); - site.clear(); - } -}; - -class AMAROK_EXPORT LyricsObserver -{ - public: - LyricsObserver(); - LyricsObserver( LyricsSubject* ); - virtual ~LyricsObserver(); - - /** - * A lyrics script has returned new lyrics. - */ - virtual void newLyrics( const LyricsData &lyrics ) { Q_UNUSED( lyrics ); } - /** - * A lyrics script has returned a list of suggested URLs for correct lyrics. - */ - virtual void newSuggestions( const QVariantList &suggestions ) { Q_UNUSED( suggestions ); } - /** - * A lyrics script has returned some generic message that they want to be displayed. - */ - virtual void lyricsMessage( const QString& key, const QString &val ) { Q_UNUSED( key ); Q_UNUSED( val ); } - - private: - LyricsSubject *m_subject; -}; - -class LyricsSubject -{ - public: - void attach( LyricsObserver *observer ); - void detach( LyricsObserver *observer ); - - protected: - LyricsSubject() {} - virtual ~LyricsSubject() {} - - void sendNewLyrics( const LyricsData &lyrics ); - void sendNewSuggestions( const QVariantList &suggestions ); - void sendLyricsMessage( const QString &key, const QString &val ); - - private: - QList m_observers; -}; - -class AMAROK_EXPORT LyricsManager : public LyricsSubject -{ - public: - static LyricsManager* self() - { - if( !s_self ) - s_self = new LyricsManager(); - - return s_self; - } - - void lyricsResult( const QString& lyrics, bool cached = false ); - void lyricsResultHtml( const QString& lyrics, bool cached = false ); - void lyricsError( const QString &error ); - void lyricsNotFound( const QString& notfound ); - - /** - * Sets the given lyrics for the track with the given URL. - * - * @param trackUrl The URL of the track. - * @param lyrics The new lyrics. - */ - void setLyricsForTrack( const QString &trackUrl, const QString &lyrics ) const; - - /** - * Tests if the given lyrics are empty. - * - * @param lyrics The lyrics which will be tested. - * - * @return true if the given lyrics are empty, otherwise false. - */ - bool isEmpty( const QString &lyrics ) const; - - private: - LyricsManager() : LyricsSubject() { s_self = this; } - - bool showCached(); - - static LyricsManager* s_self; -}; - -Q_DECLARE_METATYPE( LyricsData ); - -#endif diff --git a/src/context/LyricsManager.cpp b/src/context/LyricsManager.cpp deleted file mode 100644 --- a/src/context/LyricsManager.cpp +++ /dev/null @@ -1,271 +0,0 @@ -/**************************************************************************************** - * Copyright (c) 2007 Leo Franchi * - * Copyright (c) 2009 Seb Ruiz * - * * - * This program is free software; you can redistribute it and/or modify it under * - * the terms of the GNU General Public License as published by the Free Software * - * Foundation; either version 2 of the License, or (at your option) any later * - * version. * - * * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY * - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * - * PARTICULAR PURPOSE. See the GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License along with * - * this program. If not, see . * - ****************************************************************************************/ - -#define DEBUG_PREFIX "LyricsManager" - -#include "LyricsManager.h" - -#include "EngineController.h" -#include "core/meta/Meta.h" -#include "core/support/Debug.h" -#include "core-impl/collections/support/CollectionManager.h" - -#include -#include - -#include - -//////////////////////////////////////////////////////////////// -//// CLASS LyricsObserver -/////////////////////////////////////////////////////////////// - -LyricsObserver::LyricsObserver() - : m_subject( 0 ) -{ - qRegisterMetaType("LyricsData"); -} - -LyricsObserver::LyricsObserver( LyricsSubject *s ) - : m_subject( s ) -{ - m_subject->attach( this ); -} - -LyricsObserver::~LyricsObserver() -{ - if( m_subject ) - m_subject->detach( this ); -} - -//////////////////////////////////////////////////////////////// -//// CLASS LyricsSubject -/////////////////////////////////////////////////////////////// - -void LyricsSubject::sendNewLyrics( const LyricsData &lyrics ) -{ - DEBUG_BLOCK - foreach( LyricsObserver* obs, m_observers ) - { - obs->newLyrics( lyrics ); - } -} - -void LyricsSubject::sendNewSuggestions( const QVariantList &sug ) -{ - DEBUG_BLOCK - foreach( LyricsObserver* obs, m_observers ) - { - obs->newSuggestions( sug ); - } -} - -void LyricsSubject::sendLyricsMessage( const QString &key, const QString &val ) -{ - DEBUG_BLOCK - foreach( LyricsObserver* obs, m_observers ) - { - obs->lyricsMessage( key, val ); - } -} - -void LyricsSubject::attach( LyricsObserver *obs ) -{ - if( !obs || m_observers.indexOf( obs ) != -1 ) - return; - m_observers.append( obs ); -} - -void LyricsSubject::detach( LyricsObserver *obs ) -{ - int index = m_observers.indexOf( obs ); - if( index != -1 ) m_observers.removeAt( index ); -} - -//////////////////////////////////////////////////////////////// -//// CLASS LyricsManager -/////////////////////////////////////////////////////////////// - -LyricsManager* LyricsManager::s_self = 0; - -void -LyricsManager::lyricsResult( const QString& lyricsXML, bool cached ) //SLOT -{ - DEBUG_BLOCK - Q_UNUSED( cached ); - - QXmlStreamReader xml( lyricsXML ); - while( xml.readNextStartElement() ) - { - if( xml.name() == QLatin1String("lyric") ) - { - Meta::TrackPtr currentTrack = The::engineController()->currentTrack(); - if( !currentTrack ) - return; - - QString lyrics( xml.readElementText() ); - if( !isEmpty( lyrics ) ) - { - // overwrite cached lyrics (as either there were no lyircs available previously OR - // the user exlicitly agreed to overwrite the lyrics) - debug() << "setting cached lyrics..."; - currentTrack->setCachedLyrics( lyrics ); // TODO: setLyricsByPath? - } - else if( !isEmpty( currentTrack->cachedLyrics() ) ) - { - // we found nothing, so if we have cached lyrics, use it! - debug() << "using cached lyrics..."; - lyrics = currentTrack->cachedLyrics(); - } - else - { - lyricsError( i18n("Retrieved lyrics is empty") ); - return; - } - - QString artist = currentTrack->artist() ? currentTrack->artist()->name() : QString(); - LyricsData data = { lyrics, currentTrack->name(), artist, QUrl() }; - sendNewLyrics( data ); - return; - } - else if( xml.name() == QLatin1String("suggestions") ) - { - QVariantList suggestions; - while( xml.readNextStartElement() ) - { - if( xml.name() != QLatin1String("suggestion") ) - continue; - - const QXmlStreamAttributes &a = xml.attributes(); - - QString artist = a.value( QLatin1String("artist") ).toString(); - QString title = a.value( QLatin1String("title") ).toString(); - QString url = a.value( QLatin1String("url") ).toString(); - - if( !url.isEmpty() ) - suggestions << ( QStringList() << title << artist << url ); - xml.skipCurrentElement(); - } - - debug() << "got" << suggestions.size() << "suggestions"; - if( suggestions.isEmpty() ) - sendLyricsMessage( "notFound", "notfound" ); - else - sendNewSuggestions( suggestions ); - return; - } - xml.skipCurrentElement(); - } - - if( xml.hasError() ) - { - warning() << "errors occurred during reading lyrics xml result:" << xml.errorString(); - lyricsError( i18n("Lyrics data could not be parsed") ); - } -} - -void -LyricsManager::lyricsResultHtml( const QString& lyricsHTML, bool cached ) -{ - DEBUG_BLOCK - Q_UNUSED( cached ) - - // we don't need to deal with suggestions here, because - // we assume the script has called showLyrics if they could - // be suggestions. this is for HTML display only - - Meta::TrackPtr currentTrack = The::engineController()->currentTrack(); - if( currentTrack && !isEmpty( lyricsHTML ) ) - { - QString artist = currentTrack->artist() ? currentTrack->artist()->name() : QString(); - LyricsData data = { lyricsHTML, currentTrack->name(), artist, QUrl() }; - sendNewLyrics( data ); - - // overwrite cached lyrics (as either there were no lyircs available previously OR - // the user exlicitly agreed to overwrite the lyrics) - currentTrack->setCachedLyrics( lyricsHTML ); - } -} - -void -LyricsManager::lyricsError( const QString &error ) -{ - DEBUG_BLOCK - if( !showCached() ) - { - sendLyricsMessage( "error", error ); - } -} - - -void -LyricsManager::lyricsNotFound( const QString& notfound ) -{ - DEBUG_BLOCK - if( !showCached() ) - sendLyricsMessage( "notfound", notfound ); -} - - -bool LyricsManager::showCached() -{ - DEBUG_BLOCK - //if we have cached lyrics there is absolutely no point in not showing these.. - Meta::TrackPtr currentTrack = The::engineController()->currentTrack(); - if( currentTrack && !isEmpty( currentTrack->cachedLyrics() ) ) - { - // TODO: add some sort of feedback that we could not fetch new ones - // so we are showing a cached result - debug() << "showing cached lyrics!"; - - QString lyrics = currentTrack->cachedLyrics(); - QString artist = currentTrack->artist() ? currentTrack->artist()->name() : QString(); - LyricsData data = { lyrics, currentTrack->name(), artist, QUrl() }; - sendNewLyrics( data ); - return true; - } - return false; -} - -void LyricsManager::setLyricsForTrack( const QString &trackUrl, const QString &lyrics ) const -{ - DEBUG_BLOCK - - Meta::TrackPtr track = CollectionManager::instance()->trackForUrl( QUrl( trackUrl ) ); - - if( track ) - track->setCachedLyrics( lyrics ); - else - debug() << QString("could not find a track for the given URL (%1) - ignoring.").arg( trackUrl ); -} - -bool LyricsManager::isEmpty( const QString &lyrics ) const -{ - QTextEdit testItem; - - // Set the text of the TextItem. - if( Qt::mightBeRichText( lyrics ) ) - testItem.setHtml( lyrics ); - else - testItem.setPlainText( lyrics ); - - // Get the plaintext content. - // We use toPlainText() to strip all Html formatting, - // so we can test if there's any text given. - QString testText = testItem.toPlainText().trimmed(); - - return testText.isEmpty(); -} diff --git a/src/context/applets/CMakeLists.txt b/src/context/applets/CMakeLists.txt --- a/src/context/applets/CMakeLists.txt +++ b/src/context/applets/CMakeLists.txt @@ -5,9 +5,12 @@ add_subdirectory( lyrics ) add_subdirectory( photos ) #add_subdirectory( tabs ) -#add_subdirectory( wikipedia ) add_subdirectory( analyzer ) +if( Qt5WebEngine_FOUND ) + add_subdirectory( wikipedia ) +endif() + if( LIBLASTFM_FOUND ) # add_subdirectory( upcomingevents ) # add_subdirectory( similarartists ) diff --git a/src/context/applets/albums/CMakeLists.txt b/src/context/applets/albums/CMakeLists.txt --- a/src/context/applets/albums/CMakeLists.txt +++ b/src/context/applets/albums/CMakeLists.txt @@ -19,4 +19,4 @@ install(TARGETS amarok_context_applet_albums DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/amarok/albums) install(FILES plugin/qmldir DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/amarok/albums) -kpackage_install_package(package org.kde.amarok.albums amarok) +kpackage_install_bundled_package(package org.kde.amarok.albums amarok) diff --git a/images/icons/48-actions-media-album-cover-manager-amarok.png b/src/context/applets/albums/package/contents/images/icon.png rename from images/icons/48-actions-media-album-cover-manager-amarok.png rename to src/context/applets/albums/package/contents/images/icon.png index 65dd14d4117315683d010ca1f34830a9b6a04bea..65dd14d4117315683d010ca1f34830a9b6a04bea GIT binary patch literal 3132 zc$@(|48!w@P)Y76nFqBFUE^S1lGbIy0R`y!;2@NWJX@Gk$nC%}6G{J#qzp8E3B za(ZS4Vr?-f6bsOqNTkCA=ojVCmX&jpc+90^7D53qTrn8fnSle{~?!p zB#3Iurp>Tn!+Hi)B-2*3kI$hXYu2uUp4Cslh4UBT z)Zb54(X%dmwiE!76Tg~$y3-jL+`S9h)O2i1AWX3m|1f@X2@*cJ3H} zXf&c8UdK+!76=g-N*M^8B93i2DoP1uB?7I4FxW>72Ja7d;-1yZ;S-O2yrBRt#f?@z z;Mo2MqsboLGYGL*j346qhXAOt0-Dz}IChsXc02qO1&nfu+PWIoR&bqNh&tcx?cWHG zeE4I{gpf<7(BQ5?Om1q^M4{!~%VA~D3I#}Nu(DbZUA9i=`nw7<#NnhS6X}VRGnn-xqJc6ox1>2(=$~xiFb5BFP7^x2zUsKGNpi^ zX%&A2`6B&vv@mFe-MjX{tv}slDmQmxZJwSLJrKc?mGgE0CsPK5XL^2^O9NZN^wc!G zcKnS1cyitlhTwLt^Jiyg;nJl`iU!j0Y9oI>@Gax`g%dq<^QKL#JeNX7D+-YShT-#5 zfwx&*GQiVd1gW4i|KsdARW6{XCK3tg?CQjA94pWm=MlPhW^N9yUcIX8A)y0=Zv_DX z=hr?(yP3=~&kvdlpp#e(&CRJ^4>lzwG0vbyAP}kOMCY$v8-{E?&y+}}l2FD53u@0kDaT?luBoOGd z->9_J4gnMQCfW2En)#2WO8Bn5lCfI-y&3K(GaG4ECf>s*41b>n}vzV3D%aS`To!I z=dnF3Ga$NdhJ@o*K`5(2FiR`#(>X8c;d8pN<6G1M?gbp{r3`dcP+i!&e?u+^Ree(5 z+ZJuZ5rqPVQrBzZ3DrN4uh4Z-Gpw{LTuTZ+8o7QU{18WfY4KrEA0QfJvAt6bifk}c zqyTpxl-bkR6HBU7a2|^J2M#>Kr7!i^otOtU_4RR~#{lrUbUMw#N(Q8IN5fK{aM%uK z-|@S5mgWP~Q!}t}<3^~fwF26ZBA9*vHsJNs*sO=KPbT22SM|Wbg9l-Lex9A$L<-Pv znxC#or#sc%9P9n0CId?~u8Yxm65#g4ID1D+3y_wEM@E`xzj}b@!vgyIdRePP9}DNn zqq9=hr7&utQ5#oB05n8ns3e zzWw$kSiNSIE{m(n9tN+AIFGxI5`x0(!1e*ywsjknalSm(@9nWD=Mh@)qJBWRx}!Ah zF-U47r~_)@LM`!-B95JSje!eW_t%XCxR2oJp>*LNkI~A2RkOrVttB^Vxm&3LQPQDe zjQ}U&3EVez*4Cj`s=k@$kg9xFL($ddxg6!-Qf2v>xmmBAmdz+c^l>j59=?udyQsj* zM&P9e?+!%+$CjF_w6C;CfG8}JLI|+qsL*L+&p^N(4W1SAP)SFo2M-qD(2<{d;1}=697luoKhGV09@ec}1A7Pecuwom%JDKX zROblWr<XMzZI?ns8%w=!uq!rii9!|Js)a9Y9WPNTWfY5L zIC}IY_|4JZD*n~af56RYRqfG|r;_L7)4#Vfa^aVJ6`~>8)dEWxM@UpZOh(@eAOYc|Q^H`ka zi<~FsW*6XvU;Y+8^SRH$zpq{9MS!Jz%>VlJCO0@CZXuuf-ZQYde-nJ_@lV3Qjsbp0 z=Drj2@`m2pdTZg9){I84--WRo!|=kdj-X$ZS?l#{rT-%V48!m&6cmKsKn{OL-p6VkVOb zE_vHyZ4kl9Qh3vvRcoR4zv0kiu10$B6lroPA6m?!@>;#D&ey-NZt_{m^QP|KgZ}_D W*iin%`_^~>0000Y76nFqBFUE^S1lGbIy0R`y!;2@NWJX@Gk$nC%}6G{J#qzp8E3B za(ZS4Vr?-f6bsOqNTkCA=ojVCmX&jpc+90^7D53qTrn8fnSle{~?!p zB#3Iurp>Tn!+Hi)B-2*3kI$hXYu2uUp4Cslh4UBT z)Zb54(X%dmwiE!76Tg~$y3-jL+`S9h)O2i1AWX3m|1f@X2@*cJ3H} zXf&c8UdK+!76=g-N*M^8B93i2DoP1uB?7I4FxW>72Ja7d;-1yZ;S-O2yrBRt#f?@z z;Mo2MqsboLGYGL*j346qhXAOt0-Dz}IChsXc02qO1&nfu+PWIoR&bqNh&tcx?cWHG zeE4I{gpf<7(BQ5?Om1q^M4{!~%VA~D3I#}Nu(DbZUA9i=`nw7<#NnhS6X}VRGnn-xqJc6ox1>2(=$~xiFb5BFP7^x2zUsKGNpi^ zX%&A2`6B&vv@mFe-MjX{tv}slDmQmxZJwSLJrKc?mGgE0CsPK5XL^2^O9NZN^wc!G zcKnS1cyitlhTwLt^Jiyg;nJl`iU!j0Y9oI>@Gax`g%dq<^QKL#JeNX7D+-YShT-#5 zfwx&*GQiVd1gW4i|KsdARW6{XCK3tg?CQjA94pWm=MlPhW^N9yUcIX8A)y0=Zv_DX z=hr?(yP3=~&kvdlpp#e(&CRJ^4>lzwG0vbyAP}kOMCY$v8-{E?&y+}}l2FD53u@0kDaT?luBoOGd z->9_J4gnMQCfW2En)#2WO8Bn5lCfI-y&3K(GaG4ECf>s*41b>n}vzV3D%aS`To!I z=dnF3Ga$NdhJ@o*K`5(2FiR`#(>X8c;d8pN<6G1M?gbp{r3`dcP+i!&e?u+^Ree(5 z+ZJuZ5rqPVQrBzZ3DrN4uh4Z-Gpw{LTuTZ+8o7QU{18WfY4KrEA0QfJvAt6bifk}c zqyTpxl-bkR6HBU7a2|^J2M#>Kr7!i^otOtU_4RR~#{lrUbUMw#N(Q8IN5fK{aM%uK z-|@S5mgWP~Q!}t}<3^~fwF26ZBA9*vHsJNs*sO=KPbT22SM|Wbg9l-Lex9A$L<-Pv znxC#or#sc%9P9n0CId?~u8Yxm65#g4ID1D+3y_wEM@E`xzj}b@!vgyIdRePP9}DNn zqq9=hr7&utQ5#oB05n8ns3e zzWw$kSiNSIE{m(n9tN+AIFGxI5`x0(!1e*ywsjknalSm(@9nWD=Mh@)qJBWRx}!Ah zF-U47r~_)@LM`!-B95JSje!eW_t%XCxR2oJp>*LNkI~A2RkOrVttB^Vxm&3LQPQDe zjQ}U&3EVez*4Cj`s=k@$kg9xFL($ddxg6!-Qf2v>xmmBAmdz+c^l>j59=?udyQsj* zM&P9e?+!%+$CjF_w6C;CfG8}JLI|+qsL*L+&p^N(4W1SAP)SFo2M-qD(2<{d;1}=697luoKhGV09@ec}1A7Pecuwom%JDKX zROblWr<XMzZI?ns8%w=!uq!rii9!|Js)a9Y9WPNTWfY5L zIC}IY_|4JZD*n~af56RYRqfG|r;_L7)4#Vfa^aVJ6`~>8)dEWxM@UpZOh(@eAOYc|Q^H`ka zi<~FsW*6XvU;Y+8^SRH$zpq{9MS!Jz%>VlJCO0@CZXuuf-ZQYde-nJ_@lV3Qjsbp0 z=Drj2@`m2pdTZg9){I84--WRo!|=kdj-X$ZS?l#{rT-%V48!m&6cmKsKn{OL-p6VkVOb zE_vHyZ4kl9Qh3vvRcoR4zv0kiu10$B6lroPA6m?!@>;#D&ey-NZt_{m^QP|KgZ}_D W*iin%`_^~>0000 -class QMenu; namespace Collections { class QueryMaker; @@ -37,20 +36,20 @@ Q_PROPERTY( QString filterPattern READ filterPattern WRITE setFilterPattern NOTIFY filterPatternChanged ) public: - AlbumsEngine( QObject *parent = Q_NULLPTR ); + explicit AlbumsEngine( QObject *parent = nullptr ); AlbumsProxyModel * model() const { return m_proxyModel; } QString filterPattern() const; void setFilterPattern( const QString &pattern ); Q_INVOKABLE void showContextMenu( const QModelIndexList &indexes, const QModelIndex &mouseOverIndex ) const; -signals: +Q_SIGNALS: void lengthAlignmentChanged(); void filterPatternChanged(); private Q_SLOTS: - void slotTrackChanged( Meta::TrackPtr track ); + void slotTrackChanged( const Meta::TrackPtr &track ); void slotTrackMetadataChanged( Meta::TrackPtr track ); void stopped(); void resultReady( const Meta::AlbumList &albums ); diff --git a/src/context/applets/albums/plugin/AlbumsEngine.cpp b/src/context/applets/albums/plugin/AlbumsEngine.cpp --- a/src/context/applets/albums/plugin/AlbumsEngine.cpp +++ b/src/context/applets/albums/plugin/AlbumsEngine.cpp @@ -36,7 +36,7 @@ AlbumsEngine::AlbumsEngine( QObject *parent ) : QObject( parent ) - , m_lastQueryMaker( Q_NULLPTR ) + , m_lastQueryMaker( nullptr ) , m_model( new AlbumsModel( this ) ) , m_proxyModel( new AlbumsProxyModel( this ) ) { @@ -69,7 +69,7 @@ update(); } -void AlbumsEngine::slotTrackChanged( Meta::TrackPtr track ) +void AlbumsEngine::slotTrackChanged( const Meta::TrackPtr &track ) { if( !track || track == m_currentTrack ) return; @@ -210,7 +210,7 @@ return; m_proxyModel->setFilterRegExp( QRegExp(pattern, Qt::CaseInsensitive) ); - emit filterPatternChanged(); + Q_EMIT filterPatternChanged(); } void AlbumsEngine::clear() diff --git a/src/context/applets/albums/plugin/AlbumsModel.h b/src/context/applets/albums/plugin/AlbumsModel.h --- a/src/context/applets/albums/plugin/AlbumsModel.h +++ b/src/context/applets/albums/plugin/AlbumsModel.h @@ -30,11 +30,11 @@ Q_OBJECT public: - AlbumsModel( QObject *parent = 0 ); + explicit AlbumsModel( QObject *parent = nullptr ); virtual ~AlbumsModel() {} - virtual QVariant data( const QModelIndex &index, int role ) const; - virtual QMimeData* mimeData( const QModelIndexList &indices ) const; - virtual QStringList mimeTypes() const; + QVariant data( const QModelIndex &index, int role ) const override; + QMimeData* mimeData( const QModelIndexList &indices ) const override; + QStringList mimeTypes() const override; int rowHeight() const; private Q_SLOTS: @@ -53,33 +53,33 @@ Q_PROPERTY( Mode mode READ mode WRITE setMode NOTIFY modeChanged ) public: - AlbumsProxyModel( QObject *parent ); - ~AlbumsProxyModel(); + explicit AlbumsProxyModel( QObject *parent ); + ~AlbumsProxyModel() override; enum Mode { SortByCreateDate, SortByYear }; Q_ENUM( Mode ) Mode mode() const; void setMode( Mode mode ); - QHash roleNames() const Q_DECL_OVERRIDE; + QHash roleNames() const override; -signals: +Q_SIGNALS: void modeChanged(); protected: /** - * Determine if album @param left is less than album @param right. + * Determine if album @param left is less than album @param right . * * If @param left and @param right both reference albums and @c m_mode * is set to @c SortByCreateDate, @c lessThan will return @c true if * and only the album referenced by @param left has a track that was * added more recently than all of the tracks in the album - * referenced by @param right. + * referenced by @param right . */ - bool lessThan( const QModelIndex &left, const QModelIndex &right ) const; + bool lessThan( const QModelIndex &left, const QModelIndex &right ) const override; - bool filterAcceptsRow( int sourceRow, const QModelIndex &sourceParent ) const Q_DECL_OVERRIDE; + bool filterAcceptsRow( int sourceRow, const QModelIndex &sourceParent ) const override; private: Mode m_mode; diff --git a/src/context/applets/albums/plugin/AlbumsModel.cpp b/src/context/applets/albums/plugin/AlbumsModel.cpp --- a/src/context/applets/albums/plugin/AlbumsModel.cpp +++ b/src/context/applets/albums/plugin/AlbumsModel.cpp @@ -99,7 +99,7 @@ { DEBUG_BLOCK if( indices.isEmpty() ) - return 0; + return nullptr; Meta::TrackList tracks; foreach( const QModelIndex &index, indices ) @@ -110,7 +110,7 @@ // If the list of indexes is empty, or there are no supported MIME types, // 0 is returned rather than a serialized empty list. if( tracks.isEmpty() ) - return 0; + return nullptr; AmarokMimeData *mimeData = new AmarokMimeData(); mimeData->setTracks( tracks ); diff --git a/src/context/applets/albums/plugin/AlbumsPlugin.cpp b/src/context/applets/albums/plugin/AlbumsPlugin.cpp --- a/src/context/applets/albums/plugin/AlbumsPlugin.cpp +++ b/src/context/applets/albums/plugin/AlbumsPlugin.cpp @@ -32,7 +32,7 @@ Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) public: - void registerTypes(const char* uri) Q_DECL_OVERRIDE + void registerTypes(const char* uri) override { Q_ASSERT(uri == QLatin1String("org.kde.amarok.albums")); diff --git a/src/context/applets/albums/plugin/TrackItem.h b/src/context/applets/albums/plugin/TrackItem.h --- a/src/context/applets/albums/plugin/TrackItem.h +++ b/src/context/applets/albums/plugin/TrackItem.h @@ -26,14 +26,14 @@ { public: TrackItem(); - ~TrackItem(); + ~TrackItem() override; /** * Sets the TrackPtr for this item to associate with * * @arg track pointer to associate with */ - void setTrack( Meta::TrackPtr trackPtr ); + void setTrack( const Meta::TrackPtr &trackPtr ); /** * @return the track pointer associated with this item @@ -54,11 +54,11 @@ // overloaded from Meta::Observer using Observer::metadataChanged; - virtual void metadataChanged( Meta::TrackPtr track ) Q_DECL_OVERRIDE; + void metadataChanged( const Meta::TrackPtr &track ) override; - virtual int type() const Q_DECL_OVERRIDE; + int type() const override; - virtual bool operator<( const QStandardItem &other ) const Q_DECL_OVERRIDE; + bool operator<( const QStandardItem &other ) const override; private: Meta::TrackPtr m_track; diff --git a/src/context/applets/albums/plugin/TrackItem.cpp b/src/context/applets/albums/plugin/TrackItem.cpp --- a/src/context/applets/albums/plugin/TrackItem.cpp +++ b/src/context/applets/albums/plugin/TrackItem.cpp @@ -38,7 +38,7 @@ } void -TrackItem::setTrack( Meta::TrackPtr trackPtr ) +TrackItem::setTrack( const Meta::TrackPtr &trackPtr ) { if( m_track ) unsubscribeFrom( m_track ); @@ -49,7 +49,7 @@ } void -TrackItem::metadataChanged( Meta::TrackPtr track ) +TrackItem::metadataChanged(const Meta::TrackPtr &track ) { QMutexLocker locker( &m_mutex ); if( !track ) diff --git a/src/context/applets/analyzer/CMakeLists.txt b/src/context/applets/analyzer/CMakeLists.txt --- a/src/context/applets/analyzer/CMakeLists.txt +++ b/src/context/applets/analyzer/CMakeLists.txt @@ -9,11 +9,6 @@ #plugin/ASCIIAnalyzer.cpp ) -find_library(FFTW_LIBRARIES NAMES fftw3) -if(NOT FFTW_LIBRARIES) - message(FATAL_ERROR "fftw not found") -endif(NOT FFTW_LIBRARIES) - add_library(amarok_context_applet_analyzer SHARED ${analyzer_SRCS}) if(APPLE) @@ -25,10 +20,10 @@ amaroklib Qt5::Qml Qt5::Quick - fftw3 + ${FFTW3_LIBRARIES} ) install(TARGETS amarok_context_applet_analyzer DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/amarok/analyzer) install(FILES plugin/qmldir DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/amarok/analyzer) -kpackage_install_package(package org.kde.amarok.analyzer amarok) +kpackage_install_bundled_package(package org.kde.amarok.analyzer amarok) diff --git a/images/icons/48-actions-view-media-analyzer-amarok.png b/src/context/applets/analyzer/package/contents/images/icon.png rename from images/icons/48-actions-view-media-analyzer-amarok.png rename to src/context/applets/analyzer/package/contents/images/icon.png index 58d757ecad98bfa7ed4d7e8ca03a733c9d05b41f..58d757ecad98bfa7ed4d7e8ca03a733c9d05b41f GIT binary patch literal 2897 zc$@)I3$FBuP)eEh5@l)17d+t1W6DQDEES{?&U2+o`?w|iV|QF zHtb-@3T4Lv5Ml))2^R_7D*<982n0wZBm#L&AU!=jJ*T_Roays&`}oPC%IEm>BcwZ0 zBqZFj?6N=qUFG`y>UA3az5RQ8O`8MozkqLd56Jc%n|trF5B&;Nhd6{l2qgQC8VGS% zB|B04ad-ug6$O)>9sE2;Dut+PL|MXU#7a>RD@AUDW54vZ%a@6hj35ZW6VTkw zGQ8C{u-7ioG2z6JOjT4mXA*BQ%U^s#-<5axN;C0gU2|b`{BNLzlac84n0-y7A0$`D1(FxEkFCZvFgM z33htKMP|Ixc*gVSKKneuGryU=zZF1Vt`RSu2{xIP$>4Evl-FVKufdenUU zj<4bGY!O!_t|KU@Q52wkE?<0!`1vR1CQimMyu41WCV08ak~hUI8;$m%-hh0r(R2d4 z8*9XFf=&g>Em4jzH|q+j4Vbhvofk|7JNP0;RtlkNL{S1GR%A}Rq9`^N$6CX`zs%BP zf>s`GnWGxdFyPI8IP;7GIMac(Up$IdMhcrFh&=G5*&`pqaGs$v9a#UR~U z19Pr}Ie)4Hd(S;aDUDqEiFuC_MoL71|10wI;*y@Q~6 zPyCoI388|`$(#?B;k9mQ`jz;=^73S!Q2^twK&~MOVX93tP==;s4MNBx7<<5XZ54kB z@^H?J6iN+AYSPmPd<}g2Xub+zm_Qc7)ZT0O>z}0#Lhx*!3Y(uKHF29*d=t|TT<rBMhpkXq+E#3X}9W|e%s3m^F8gQ#E!EdwObK`^1BgTNtTG?;7pxO{&T zKK7{xP`Zcb1o(hPkW!&7pIBZ2>?KsgYgdSuCUjN>4w~9FCX$q#E_rJ}x|cx1yQ>2n zLJBH73rorNHChcHEl*fl`R9C|z+~qNdU--;*`+2Vr$7P~sbSj9=vz;7!}{MJ$F5d-1gq{s9^gDK03gE=zZt$^sDDT_}+)`gR6(| z-U4s>fiVoPtrNv#N-2@PY$^v-25c_Of)4Vn@23vVo6<3id&lM1AWkTRgVL>WhAI~3 zhYH~AX}Gxd7@h}S2evm&`|Nd$HlxU-XYKlFc;V&8&{pf+4Tw6R0+WuS*@DK2`4`t7 zHxs;0i?<#Nm*@FW0QZUcn8XoKodThuO3mVg5a6_CtM>~tM)HIiywq<5$AdaEX#qI$ zwegNHa}Wo}-w3V;bqbDa^CVjZP}^|tM;~USyVP-kRtgu7DJedh4l$1p9^s{CMYsoF zxcMQ*!4@o+_)_Ab$w=|ggha22XB)ow(T5rNTd0)+$93@0v;1gcerkCIkf(5MaEWO( zA@n7QDsim`ChT&JjfHl)O5ob=I$3S_tW%O(KBHo|u!b?`t9pWG`O*%3$Mg^IbppNJ zb*iNat}jt4w`+kW{x0i_{lL;0`1#tSIND68k}mj>sb=AUh(NUF150P%7weYSkZpo& zcx|2)t$twX?D6@ZU-~iP5Z>|3d6OR_ApuRhBLpn1E^4&ZCe3<}W<68@a<%1|Bi3$Y zn?GefOqH3m3zYkK0Z8i^vAXCyP4De&!iv(kcSk@=SCFe%97>*J}C*zH_VG=A!o~cE*{ndcbQl9G`>qLi3ivaN*AOlKuvi?7b0U7# zoV)GoZ4dnSo%gV*9t;^Nh(DQ>%sw_LbD-7EO7J3mJ++@V~~7&Dnk zqQI0b3ElO z#0L)W-Eo(ZoKWWl!V?HeQUn))>r^w(7|s2lrD<({whRwy^mjMm_`tir-_mqwdEL@z vqv`k9_}_0WZoXQ+?U|$an{fW+|JmaodA;@@4WAyM00000NkvXXu0mjfK|_ac literal 2897 zc$@)I3$FBuP)eEh5@l)17d+t1W6DQDEES{?&U2+o`?w|iV|QF zHtb-@3T4Lv5Ml))2^R_7D*<982n0wZBm#L&AU!=jJ*T_Roays&`}oPC%IEm>BcwZ0 zBqZFj?6N=qUFG`y>UA3az5RQ8O`8MozkqLd56Jc%n|trF5B&;Nhd6{l2qgQC8VGS% zB|B04ad-ug6$O)>9sE2;Dut+PL|MXU#7a>RD@AUDW54vZ%a@6hj35ZW6VTkw zGQ8C{u-7ioG2z6JOjT4mXA*BQ%U^s#-<5axN;C0gU2|b`{BNLzlac84n0-y7A0$`D1(FxEkFCZvFgM z33htKMP|Ixc*gVSKKneuGryU=zZF1Vt`RSu2{xIP$>4Evl-FVKufdenUU zj<4bGY!O!_t|KU@Q52wkE?<0!`1vR1CQimMyu41WCV08ak~hUI8;$m%-hh0r(R2d4 z8*9XFf=&g>Em4jzH|q+j4Vbhvofk|7JNP0;RtlkNL{S1GR%A}Rq9`^N$6CX`zs%BP zf>s`GnWGxdFyPI8IP;7GIMac(Up$IdMhcrFh&=G5*&`pqaGs$v9a#UR~U z19Pr}Ie)4Hd(S;aDUDqEiFuC_MoL71|10wI;*y@Q~6 zPyCoI388|`$(#?B;k9mQ`jz;=^73S!Q2^twK&~MOVX93tP==;s4MNBx7<<5XZ54kB z@^H?J6iN+AYSPmPd<}g2Xub+zm_Qc7)ZT0O>z}0#Lhx*!3Y(uKHF29*d=t|TT<rBMhpkXq+E#3X}9W|e%s3m^F8gQ#E!EdwObK`^1BgTNtTG?;7pxO{&T zKK7{xP`Zcb1o(hPkW!&7pIBZ2>?KsgYgdSuCUjN>4w~9FCX$q#E_rJ}x|cx1yQ>2n zLJBH73rorNHChcHEl*fl`R9C|z+~qNdU--;*`+2Vr$7P~sbSj9=vz;7!}{MJ$F5d-1gq{s9^gDK03gE=zZt$^sDDT_}+)`gR6(| z-U4s>fiVoPtrNv#N-2@PY$^v-25c_Of)4Vn@23vVo6<3id&lM1AWkTRgVL>WhAI~3 zhYH~AX}Gxd7@h}S2evm&`|Nd$HlxU-XYKlFc;V&8&{pf+4Tw6R0+WuS*@DK2`4`t7 zHxs;0i?<#Nm*@FW0QZUcn8XoKodThuO3mVg5a6_CtM>~tM)HIiywq<5$AdaEX#qI$ zwegNHa}Wo}-w3V;bqbDa^CVjZP}^|tM;~USyVP-kRtgu7DJedh4l$1p9^s{CMYsoF zxcMQ*!4@o+_)_Ab$w=|ggha22XB)ow(T5rNTd0)+$93@0v;1gcerkCIkf(5MaEWO( zA@n7QDsim`ChT&JjfHl)O5ob=I$3S_tW%O(KBHo|u!b?`t9pWG`O*%3$Mg^IbppNJ zb*iNat}jt4w`+kW{x0i_{lL;0`1#tSIND68k}mj>sb=AUh(NUF150P%7weYSkZpo& zcx|2)t$twX?D6@ZU-~iP5Z>|3d6OR_ApuRhBLpn1E^4&ZCe3<}W<68@a<%1|Bi3$Y zn?GefOqH3m3zYkK0Z8i^vAXCyP4De&!iv(kcSk@=SCFe%97>*J}C*zH_VG=A!o~cE*{ndcbQl9G`>qLi3ivaN*AOlKuvi?7b0U7# zoV)GoZ4dnSo%gV*9t;^Nh(DQ>%sw_LbD-7EO7J3mJ++@V~~7&Dnk zqQI0b3ElO z#0L)W-Eo(ZoKWWl!V?HeQUn))>r^w(7|s2lrD<({whRwy^mjMm_`tir-_mqwdEL@z vqv`k9_}_0WZoXQ+?U|$an{fW+|JmaodA;@@4WAyM00000NkvXXu0mjfK|_ac diff --git a/src/context/applets/analyzer/package/contents/ui/main.qml b/src/context/applets/analyzer/package/contents/ui/main.qml --- a/src/context/applets/analyzer/package/contents/ui/main.qml +++ b/src/context/applets/analyzer/package/contents/ui/main.qml @@ -19,6 +19,7 @@ import QtQuick.Dialogs 1.2 as Dialogs // QtQuick.Controls Dialogs only work properly with ApplicationWindow import QtQuick.Layouts 1.0 import QtQml.Models 2.1 +import org.kde.kirigami 2.0 as Kirigami import org.kde.amarok.qml 1.0 as AmarokQml import org.kde.amarok.analyzer 1.0 @@ -35,7 +36,7 @@ id: dialog title: i18nc("The title of the analyzer config dialog", "%1 config", applet.name) - width: Context.largeSpacing * 25 + width: Kirigami.Units.largeSpacing * 25 standardButtons: Dialogs.StandardButton.Ok | Dialogs.StandardButton.Apply | Dialogs.StandardButton.Cancel function applyChanges() { @@ -53,7 +54,7 @@ Column { width: parent.width - spacing: Context.smallSpacing + spacing: Kirigami.Units.smallSpacing RowLayout { width: parent.width diff --git a/src/context/applets/analyzer/package/metadata.desktop b/src/context/applets/analyzer/package/metadata.desktop --- a/src/context/applets/analyzer/package/metadata.desktop +++ b/src/context/applets/analyzer/package/metadata.desktop @@ -15,6 +15,7 @@ Name[hu]=Elemző Name[id]=Analizer Name[it]=Analizzatore +Name[ko]=분석기 Name[lt]=Analizatorius Name[lv]=Analizators Name[nb]=Analysator diff --git a/src/context/applets/analyzer/plugin/ASCIIAnalyzer.h b/src/context/applets/analyzer/plugin/ASCIIAnalyzer.h --- a/src/context/applets/analyzer/plugin/ASCIIAnalyzer.h +++ b/src/context/applets/analyzer/plugin/ASCIIAnalyzer.h @@ -24,14 +24,12 @@ #include #include -class QMouseEvent; class QPalette; -class QResizeEvent; class ASCIIAnalyzer : public Analyzer::Base { public: - ASCIIAnalyzer( QWidget* ); + explicit ASCIIAnalyzer( QWidget* ); static GLuint createTexture( const QImage &image ) { return instance->bindTexture( image ); } static void freeTexture( GLuint id ) { instance->deleteTexture( id ); } diff --git a/src/context/applets/analyzer/plugin/AnalyzerBase.h b/src/context/applets/analyzer/plugin/AnalyzerBase.h --- a/src/context/applets/analyzer/plugin/AnalyzerBase.h +++ b/src/context/applets/analyzer/plugin/AnalyzerBase.h @@ -50,11 +50,11 @@ public: enum WindowFunction { - Rectangular = 0, - Hann = 1, - Nuttall = 2, - Lanczos = 3, - Sine = 4 + Rectangular, + Hann, + Nuttall, + Lanczos, + Sine }; Q_ENUM(WindowFunction) @@ -76,7 +76,7 @@ */ const Worker* worker() const; -signals: +Q_SIGNALS: void minFreqChanged(); void maxFreqChanged(); void scopeSizeChanged( uint ); diff --git a/src/context/applets/analyzer/plugin/AnalyzerBase.cpp b/src/context/applets/analyzer/plugin/AnalyzerBase.cpp --- a/src/context/applets/analyzer/plugin/AnalyzerBase.cpp +++ b/src/context/applets/analyzer/plugin/AnalyzerBase.cpp @@ -45,11 +45,11 @@ : QQuickFramebufferObject( parent ) , m_sampleRate( 44100 ) , m_scopeSize( 0 ) - , m_worker( Q_NULLPTR ) + , m_worker( nullptr ) { DEBUG_BLOCK - qRegisterMetaType(); + qRegisterMetaType("WindowFunction"); m_minFreq = config().readEntry( "minFreq", 50.0 ); m_maxFreq = config().readEntry( "maxFreq", 15000.0 ); @@ -68,8 +68,12 @@ { DEBUG_BLOCK - m_worker->deleteLater(); - m_worker = Q_NULLPTR; + if( m_worker ) + { + m_worker->deleteLater(); + m_worker = nullptr; + } + m_workerThread.quit(); m_workerThread.wait(); } @@ -97,7 +101,7 @@ setSampleSize( config().readEntry( "sampleSize", 4096 ) ); setWindowFunction( (WindowFunction) config().readEntry( "windowFunction", (int)Hann ) ); - emit calculateExpFactorNeeded( m_minFreq, m_maxFreq, m_sampleRate); + Q_EMIT calculateExpFactorNeeded( m_minFreq, m_maxFreq, m_sampleRate); } } @@ -133,7 +137,7 @@ m_sampleRate = sampleRate; - emit calculateExpFactorNeeded( m_minFreq, m_maxFreq, m_sampleRate ); + Q_EMIT calculateExpFactorNeeded( m_minFreq, m_maxFreq, m_sampleRate ); } KConfigGroup @@ -155,8 +159,8 @@ return; m_scopeSize = scopeSize; - emit scopeSizeChanged( scopeSize ); - emit calculateExpFactorNeeded( m_minFreq, m_maxFreq, m_sampleRate ); + Q_EMIT scopeSizeChanged( scopeSize ); + Q_EMIT calculateExpFactorNeeded( m_minFreq, m_maxFreq, m_sampleRate ); } void @@ -171,8 +175,8 @@ config().writeEntry( "maxFreq", maxFreq ); m_maxFreq = maxFreq; - emit maxFreqChanged(); - emit calculateExpFactorNeeded( m_minFreq, m_maxFreq, m_sampleRate ); + Q_EMIT maxFreqChanged(); + Q_EMIT calculateExpFactorNeeded( m_minFreq, m_maxFreq, m_sampleRate ); } void @@ -187,8 +191,8 @@ config().writeEntry( "minFreq", minFreq ); m_minFreq = minFreq; - emit minFreqChanged(); - emit calculateExpFactorNeeded( m_minFreq, m_maxFreq, m_sampleRate ); + Q_EMIT minFreqChanged(); + Q_EMIT calculateExpFactorNeeded( m_minFreq, m_maxFreq, m_sampleRate ); } Analyzer::Base::WindowFunction @@ -205,7 +209,7 @@ debug() << "Set window function to:" << windowFunction; config().writeEntry( "windowFunction", (int)windowFunction ); - emit windowFunctionChanged( windowFunction ); + Q_EMIT windowFunctionChanged( windowFunction ); } int Analyzer::Base::sampleSize() const @@ -227,8 +231,8 @@ } config().writeEntry( "sampleSize", sampleSize ); - emit sampleSizeChanged( sampleSize ); - emit calculateExpFactorNeeded( m_minFreq, m_maxFreq, m_sampleRate ); + Q_EMIT sampleSizeChanged( sampleSize ); + Q_EMIT calculateExpFactorNeeded( m_minFreq, m_maxFreq, m_sampleRate ); } const Analyzer::Worker * diff --git a/src/context/applets/analyzer/plugin/AnalyzerPlugin.cpp b/src/context/applets/analyzer/plugin/AnalyzerPlugin.cpp --- a/src/context/applets/analyzer/plugin/AnalyzerPlugin.cpp +++ b/src/context/applets/analyzer/plugin/AnalyzerPlugin.cpp @@ -31,7 +31,7 @@ Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) public: - void registerTypes(const char* uri) Q_DECL_OVERRIDE + void registerTypes(const char* uri) override { Q_ASSERT(uri == QLatin1String("org.kde.amarok.analyzer")); diff --git a/src/context/applets/analyzer/plugin/AnalyzerWorker.h b/src/context/applets/analyzer/plugin/AnalyzerWorker.h --- a/src/context/applets/analyzer/plugin/AnalyzerWorker.h +++ b/src/context/applets/analyzer/plugin/AnalyzerWorker.h @@ -50,7 +50,7 @@ public: const static int PROCESSING_INTERVAL = 5; // Interval between new data lookups - const static int DATA_BUFFER_SIZE = 7; // Higher values increase latency, lower values increase risk of missing frames + const static int DATA_BUFFER_SIZE = 8; // Higher values increase latency, lower values increase risk of missing frames Worker(); ~Worker(); diff --git a/src/context/applets/analyzer/plugin/AnalyzerWorker.cpp b/src/context/applets/analyzer/plugin/AnalyzerWorker.cpp --- a/src/context/applets/analyzer/plugin/AnalyzerWorker.cpp +++ b/src/context/applets/analyzer/plugin/AnalyzerWorker.cpp @@ -66,12 +66,6 @@ if( newData.isEmpty() || newData[Phonon::AudioDataOutput::LeftChannel].size() != newDataSize ) return; - if( m_size < newDataSize ) - { - debug() << "Data size mismatch in analyzer!"; - return; - } - m_rawInMutex.lock(); for( int x = 0; x < newDataSize; x++ ) @@ -89,19 +83,16 @@ m_rawIn.last() /= ( 1 << 15 ); // Scale to [0, 1] } - while( m_rawIn.size() > (int)m_size + DATA_BUFFER_SIZE * newDataSize ) - m_rawIn.removeFirst(); - m_rawInMutex.unlock(); } void Analyzer::Worker::processData() { int timeElapsed = m_lastUpdate.elapsed(); // Delay if processing is too fast - if( timeElapsed < m_expectedDataTime ) - QThread::currentThread()->msleep( m_expectedDataTime - timeElapsed ); + if( timeElapsed < m_expectedDataTime - 1 ) + QThread::currentThread()->msleep( m_expectedDataTime - timeElapsed - 1 ); applyWindowFunction(); } @@ -118,6 +109,9 @@ const int newDataSize = EngineController::DATAOUTPUT_DATA_SIZE; + while( m_rawIn.size() > (int)m_size + DATA_BUFFER_SIZE * newDataSize ) + m_rawIn.removeFirst(); + // Apply window function for( uint i = 0; i < m_size; i++ ) { diff --git a/src/context/applets/analyzer/plugin/BallsAnalyzer.h b/src/context/applets/analyzer/plugin/BallsAnalyzer.h --- a/src/context/applets/analyzer/plugin/BallsAnalyzer.h +++ b/src/context/applets/analyzer/plugin/BallsAnalyzer.h @@ -27,7 +27,7 @@ class BallsAnalyzer : public Analyzer::Base { public: - BallsAnalyzer( QWidget * ); + explicit BallsAnalyzer( QWidget * ); ~BallsAnalyzer(); void analyze( const QVector & ); diff --git a/src/context/applets/analyzer/plugin/BallsAnalyzer.cpp b/src/context/applets/analyzer/plugin/BallsAnalyzer.cpp --- a/src/context/applets/analyzer/plugin/BallsAnalyzer.cpp +++ b/src/context/applets/analyzer/plugin/BallsAnalyzer.cpp @@ -70,7 +70,7 @@ void updatePhysics( float dT ) { - x += vx * dT; // posision + x += vx * dT; // position vx += ( 1300 * ( X - x ) / mass ) * dT; // elasticity vx *= ( 1 - 4.0 * dT ); // air friction } @@ -240,7 +240,7 @@ m_show.gridScrollK += 0.2 * m_show.peakEnergy * m_show.dT; // Roll camera up/down handling the beat - m_show.camRot += m_show.camRoll * m_show.dT; // posision + m_show.camRot += m_show.camRoll * m_show.dT; // position m_show.camRoll -= 400 * m_show.camRot * m_show.dT; // elasticity m_show.camRoll *= ( 1 - 2.0 * m_show.dT ); // friction if( !m_frame.silence && m_frame.dEnergy > 0.4 ) diff --git a/src/context/applets/analyzer/plugin/BlockAnalyzer.h b/src/context/applets/analyzer/plugin/BlockAnalyzer.h --- a/src/context/applets/analyzer/plugin/BlockAnalyzer.h +++ b/src/context/applets/analyzer/plugin/BlockAnalyzer.h @@ -27,7 +27,6 @@ #include class QPalette; -class QSGTexture; class BlockAnalyzer : public Analyzer::Base { @@ -49,9 +48,9 @@ }; Q_ENUM( FallSpeed ) - BlockAnalyzer( QQuickItem *parent = Q_NULLPTR ); + explicit BlockAnalyzer( QQuickItem *parent = nullptr ); - Renderer* createRenderer() const Q_DECL_OVERRIDE; + Renderer* createRenderer() const override; FallSpeed fallSpeed() const { return m_fallSpeed; } void setFallSpeed( FallSpeed fallSpeed ); @@ -64,7 +63,7 @@ static const int BLOCK_HEIGHT = 2; static const int FADE_SIZE = 90; -signals: +Q_SIGNALS: void fallSpeedChanged(); void columnWidthChanged(); void showFadebarsChanged( bool ); @@ -74,8 +73,8 @@ void refreshRateChanged( qreal ); protected: - virtual void geometryChanged(const QRectF& newGeometry, const QRectF& oldGeometry) Q_DECL_OVERRIDE; - virtual Analyzer::Worker* createWorker() const Q_DECL_OVERRIDE; + void geometryChanged(const QRectF& newGeometry, const QRectF& oldGeometry) override; + Analyzer::Worker* createWorker() const override; virtual void paletteChange( const QPalette& ); void drawBackground( const QPalette &palette ); diff --git a/src/context/applets/analyzer/plugin/BlockAnalyzer.cpp b/src/context/applets/analyzer/plugin/BlockAnalyzer.cpp --- a/src/context/applets/analyzer/plugin/BlockAnalyzer.cpp +++ b/src/context/applets/analyzer/plugin/BlockAnalyzer.cpp @@ -20,8 +20,8 @@ #include "AnalyzerWorker.h" #include "BlockRenderer.h" #include "BlockWorker.h" - #include "PaletteHandler.h" +#include "core/support/Debug.h" #include @@ -81,9 +81,9 @@ // Rounded up so that the last column/line is covered if partially visible m_columns = std::lround( std::ceil( (double)newGeometry.width() / ( m_columnWidth + 1 ) ) ); - emit columnsChanged( m_columns ); + Q_EMIT columnsChanged( m_columns ); m_rows = std::ceil( (double)newGeometry.height() / ( BLOCK_HEIGHT + 1 ) ); - emit rowsChanged( m_rows ); + Q_EMIT rowsChanged( m_rows ); setScopeSize( m_columns ); @@ -105,7 +105,7 @@ const qreal fallTime = 1.0 / pow( 1.5, m_fallSpeed ); // time to fall from top to bottom m_step = qreal( m_rows ) / fallTime; // the amount of rows to fall per second - emit stepChanged( m_step ); + Q_EMIT stepChanged( m_step ); } void @@ -182,7 +182,7 @@ m_fallSpeed = fallSpeed; config().writeEntry( "fallSpeed", (int) m_fallSpeed ); - emit fallSpeedChanged(); + Q_EMIT fallSpeedChanged(); determineStep(); } @@ -205,10 +205,10 @@ m_columnWidth = columnWidth; config().writeEntry( "columnWidth", m_columnWidth ); - emit columnWidthChanged(); + Q_EMIT columnWidthChanged(); m_columns = std::lround( std::ceil( (double)width() / ( m_columnWidth + 1 ) ) ); - emit columnsChanged( m_columns ); + Q_EMIT columnsChanged( m_columns ); setScopeSize( m_columns ); m_barPixmap = QPixmap( m_columnWidth, m_rows * ( BLOCK_HEIGHT + 1 ) ); paletteChange( The::paletteHandler()->palette() ); @@ -225,12 +225,12 @@ return; m_showFadebars = showFadebars; - emit showFadebarsChanged( m_showFadebars ); + Q_EMIT showFadebarsChanged( m_showFadebars ); } void BlockAnalyzer::newWindow( QQuickWindow* window ) { if( window ) - emit refreshRateChanged( window->screen()->refreshRate() ); + Q_EMIT refreshRateChanged( window->screen()->refreshRate() ); } diff --git a/src/context/applets/analyzer/plugin/BlockRenderer.h b/src/context/applets/analyzer/plugin/BlockRenderer.h --- a/src/context/applets/analyzer/plugin/BlockRenderer.h +++ b/src/context/applets/analyzer/plugin/BlockRenderer.h @@ -26,83 +26,82 @@ #include "BlockAnalyzer.h" #include "BlockWorker.h" -#include "core/support/Debug.h" #include #include #include +#include #include -#include -#include + class BlockRenderer : public QQuickFramebufferObject::Renderer { public: static const int BLOCK_HEIGHT = BlockAnalyzer::BLOCK_HEIGHT; - BlockRenderer() {} + BlockRenderer() : m_worker( nullptr ) {} protected: - QOpenGLFramebufferObject* createFramebufferObject(const QSize &size) Q_DECL_OVERRIDE + QOpenGLFramebufferObject* createFramebufferObject(const QSize &size) override { QOpenGLFramebufferObject* fo = new QOpenGLFramebufferObject(size); fo->setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil); return fo; } - void render() Q_DECL_OVERRIDE + void render() override { + // Synchronize worker data + if (!m_worker) + return; + + m_worker->m_mutex.lock(); + const QVector store = m_worker->m_store; + const QVector > fadebars = m_worker->m_fadebars; + m_worker->m_mutex.unlock(); + QOpenGLPaintDevice d; d.setSize(framebufferObject()->size()); QPainter p(&d); // Draw the background p.drawPixmap(QRect(QPoint(0, 0), framebufferObject()->size()), m_backgroundPixmap); - - const int frameHeight = framebufferObject()->height(); - - for( uint x = 0; x < (uint)m_store.size(); ++x ) + for(uint x = 0; x < (uint)store.size(); ++x) { // Draw fade bars - for( const auto &fadebar : m_fadebars.at(x) ) + for(const auto &fadebar : qAsConst(fadebars.at(x))) { - if( fadebar.intensity > 0 ) + if(fadebar.intensity > 0) { const uint offset = fadebar.intensity; - const int fadeHeight = frameHeight - fadebar.y * (BLOCK_HEIGHT + 1); - if( fadeHeight > 0 ) - p.drawPixmap(x * ( m_columnWidth + 1 ), 0, m_fadeBarsPixmaps.value(offset), 0, 0, m_columnWidth, fadeHeight); + const int fadeHeight = fadebar.y * (BLOCK_HEIGHT + 1); + if(fadeHeight > 0) + p.drawPixmap(x * (m_columnWidth + 1), 0, m_fadeBarsPixmaps.value(offset), 0, 0, m_columnWidth, fadeHeight); } } // Draw bars - const int height = frameHeight - m_store.at(x) * (BLOCK_HEIGHT + 1); + const int height = store.at(x) * (BLOCK_HEIGHT + 1); if (height > 0) p.drawPixmap(x * (m_columnWidth + 1), 0, m_barPixmap, 0, 0, m_columnWidth, height); // Draw top bar p.drawPixmap(x * (m_columnWidth + 1), height + BLOCK_HEIGHT - 1, m_topBarPixmap); } } - void synchronize(QQuickFramebufferObject *item) Q_DECL_OVERRIDE + void synchronize(QQuickFramebufferObject *item) override { auto analyzer = qobject_cast(item); if (!analyzer) return; m_rows = analyzer->m_rows; m_columnWidth = analyzer->m_columnWidth; - auto worker = qobject_cast(analyzer->worker()); - if (worker) - { - worker->m_mutex.lock(); - m_store = worker->m_store; - m_fadebars = worker->m_fadebars; - worker->m_mutex.unlock(); - } + if (!m_worker) + m_worker = qobject_cast(analyzer->worker()); if (analyzer->m_pixmapsChanged) { @@ -116,8 +115,8 @@ } private: - QVector m_store; - QVector > m_fadebars; + QPointer m_worker; + int m_rows; int m_columnWidth; diff --git a/src/context/applets/analyzer/plugin/BlockWorker.h b/src/context/applets/analyzer/plugin/BlockWorker.h --- a/src/context/applets/analyzer/plugin/BlockWorker.h +++ b/src/context/applets/analyzer/plugin/BlockWorker.h @@ -39,11 +39,11 @@ void setRefreshRate( qreal refreshRate ) { m_refreshTime = std::floor( 1000.0 / refreshRate ); } void setShowFadebars( bool showFadebars ) { m_showFadebars = showFadebars; } -signals: +Q_SIGNALS: void finished(); protected: - void analyze() Q_DECL_OVERRIDE; + void analyze() override; private: struct Fadebar diff --git a/src/context/applets/analyzer/plugin/BlockWorker.cpp b/src/context/applets/analyzer/plugin/BlockWorker.cpp --- a/src/context/applets/analyzer/plugin/BlockWorker.cpp +++ b/src/context/applets/analyzer/plugin/BlockWorker.cpp @@ -32,13 +32,11 @@ , m_refreshTime( 16 ) , m_showFadebars( showFadebars ) { - m_yscale.resize( m_rows + 1 ); - const double PRE = 1, PRO = 1; //PRE and PRO allow us to restrict the range somewhat + m_yscale.resize( m_rows ); + const double PRO = 1; //PRO allows us to restrict the range somewhat for( int z = 0; z < m_rows; ++z ) - m_yscale[z] = 1 - ( log10( PRE + z ) / log10( PRE + m_rows + PRO ) ); - - m_yscale[m_rows] = 0; + m_yscale[z] = 1 - log10( m_rows - z ) / log10( m_rows + PRO ); m_store.resize( columns ); m_fadebars.resize( columns ); @@ -55,16 +53,15 @@ m_rows = rows; m_yscale.resize( m_rows + 1 ); - const double PRE = 1, PRO = 1; //PRE and PRO allow us to restrict the range somewhat + const double PRO = 1; //PRO allows us to restrict the range somewhat for( int z = 0; z < m_rows; ++z ) - m_yscale[z] = 1 - ( log10( PRE + z ) / log10( PRE + m_rows + PRO ) ); + m_yscale[z] = 1 - log10( m_rows - z ) / log10( m_rows + PRO ); - m_yscale[m_rows] = 0; m_mutex.unlock(); } -void BlockWorker::setColumns(int columns) +void BlockWorker::setColumns( int columns ) { if( m_columns == columns ) return; @@ -77,7 +74,7 @@ int timeElapsed = m_lastUpdate.elapsed(); // only analyze if screen is fast enough - if( timeElapsed < m_refreshTime ) + if( timeElapsed < m_refreshTime - 1 ) QThread::currentThread()->msleep( m_refreshTime - timeElapsed - 1 ); const auto scopeData = scope(); @@ -88,24 +85,24 @@ const qreal step = m_step * timeElapsed / 1000.0; const qreal fadeStep = (qreal)timeElapsed / 20.0; - // block m_store and m_fadebars - QMutexLocker locker(&m_mutex); + // lock m_store and m_fadebars + QMutexLocker locker( &m_mutex ); m_store.resize( scopeSize ); m_fadebars.resize( scopeSize ); for( int x = 0; x < scopeSize; ++x ) { // determine y int y = 0; - while( y < m_yscale.size() && scopeData.at(x) < m_yscale.at(y) ) + while( y < m_yscale.size() && scopeData.at(x) > m_yscale.at(y) ) y++; auto &fadebars = m_fadebars[x]; auto &store = m_store[x]; // remove obscured fadebars - while( !fadebars.isEmpty() && fadebars.last().y >= y ) + while( !fadebars.isEmpty() && fadebars.last().y <= y ) fadebars.removeLast(); // remove completely faded fadebars @@ -116,17 +113,17 @@ for( auto &fadebar : fadebars ) fadebar.intensity -= fadeStep; - if( ( double )y > store ) + if( ( double )y < store ) { // add new fadebar at old column height if( m_showFadebars ) fadebars << Fadebar( store, BlockAnalyzer::FADE_SIZE ); - store = qMin( store + step, double( y ) ); + store = qMax( store - step, double( y ) ); } else store = y; } - emit finished(); + Q_EMIT finished(); } diff --git a/src/context/applets/analyzer/plugin/DiscoAnalyzer.h b/src/context/applets/analyzer/plugin/DiscoAnalyzer.h --- a/src/context/applets/analyzer/plugin/DiscoAnalyzer.h +++ b/src/context/applets/analyzer/plugin/DiscoAnalyzer.h @@ -21,12 +21,11 @@ #include "AnalyzerBase.h" -class QPaintEvent; class DiscoAnalyzer : public Analyzer::Base { public: - DiscoAnalyzer( QWidget * ); + explicit DiscoAnalyzer( QWidget * ); ~DiscoAnalyzer(); void analyze( const QVector& ); diff --git a/src/context/applets/currenttrack/CMakeLists.txt b/src/context/applets/currenttrack/CMakeLists.txt --- a/src/context/applets/currenttrack/CMakeLists.txt +++ b/src/context/applets/currenttrack/CMakeLists.txt @@ -15,4 +15,4 @@ install(TARGETS amarok_context_applet_currenttrack DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/amarok/currenttrack) install(FILES plugin/qmldir DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/amarok/currenttrack) -kpackage_install_package(package org.kde.amarok.currenttrack amarok) +kpackage_install_bundled_package(package org.kde.amarok.currenttrack amarok) diff --git a/images/icons/48-actions-current-track-amarok.png b/src/context/applets/currenttrack/package/contents/images/icon.png rename from images/icons/48-actions-current-track-amarok.png rename to src/context/applets/currenttrack/package/contents/images/icon.png index 314507874cd10d64cb4c3aeb54a8287d104fa1aa..314507874cd10d64cb4c3aeb54a8287d104fa1aa GIT binary patch literal 3982 zc$@)_4{`8`P)_pKtejuU~gBF*Cl%K|}kr3Q()!n7LLu<9VpI)*L@rTT>SlFYhGYPDeoP4jfCvbQ5*(Gu z+A{lxFEx5U?(KN($jX%~)&GkCBBCo-JzF22F?TiB)LrGdF}nh7Oa?zrMdg|hK*$CJ z0i+d-;ejOO2Y)@VYwdk&)~t~{O|WSRAR=+oPq*DDYU)>)YU*N!Vd9IxgMfeuxR!s7 znZN)bJ&2(rp9~LlU9o!AIlHDKVoCu-WZd-gw|=f7vwx(WTEi6L3&RruK?|@9{{l0> z1b_j}fEY^l7y3KDd;e`;d7hak^@~Xbobt76?Q_1l>WO0Q>?fzW01N@t z*noiF@)ZJR|I`3PE?p?~9lHG&x1RdwWFpK7l@S>?-S_^6e57fqVFr!^e&TDU@Zl@h ziAP0Lswy|?pw4{o_J=-nh-l43BE&@SD}VOpzZPp7zW_W{g%<<_3@V4BYH#<&NUfj) zu0gTJpWe3mjiogHg%b%NB60oQTd!Bq#vhVpPYb@9ifT0ofFOb)M(d8R#{i`ABPlZ= zov>rYn}2)DJsVo9i8x9C5z*Cuzu|Nv-u$4p!@`^<{Py?9Q? zk1xOcat{C#GlPi4%DcB*X*7O$9b2wHP?dXOD)_n@!gXg0v?TnO97+M51B`?H3Wxe7 z!a)Ob5(b)LgqFBQjSUov9$wui@XkSN6uu0rv@gOR6Dp!cg<08Te|FEa^H*HhKCo=r zGF>qt5vYk>Cyx>St8)deSVRbzK<^On2DiCMW+UC7H6Js5q3K!oi?oe@2;o`oqI>w>ss zzC_q6VRsL(VNVTM`$nxbkMuyL<(2kDC=DoPn7x1AwD$JXmNTRy(UctQtbglJ zWZq{-ROq*ZE^atWpfz5=39&r(^t-@Fi;u!f1t>l0AIt!`k+T4pL?lfB!i~&W!GYkk z-~qzY`Gm$8(3t{W+&K(Z60?eLzrW=4=$=`#7WBtrv7F;Lo?#fw%my=));izldAasE z!(C6k-WBW1HP*kd$HiqQG8Q)v;$YfB)-%dI0C>uW*Ht2u41^Qc{lmsfpSX9~a{_=c z+}cwsk!LFSSP)pcfS@$6?kx$gl!sI3IJoqT`j6Y&+YdK3Hl|I}3>AyT6AOjH{6e9y zpja%nI*#Ln!(oatqcm%Z+WeKhph&WvY$v{&O~`o zHx0{)P6b~%n&bZGfdPP(L`WV!(AF|58I4ABp65kv+cvb;hwr)Pp6%`J?f-twHP>w3 zwryLlZQDvIWtpZq7z_rFoYorb$mWakaN0w*Bv4}(VZtlFWfFKUJGrnD07#sD$q(W% z0?t(Mm10G}p#crBMj|K=N2AePAP`WV=gn|kcj%#q9{T96yY5(;H?S}K(u z?CR>;>ALP`nM}qE1Ok0Ep-@T``+JpC=+0OGfVh>dIvO7ZuNlk?2rCYNMC*d{PGn;= zy_gK12xyLxKVbEH00>Pnk#t?xGYo@?$dXc)cJJQ(HUJlZ0f3e)S<<i6un~v@5T;iuObfm;6*Pn&;*|F97y(;Z zmc{VHnn^^?rI%jn0tmog?->MuU@$mX!6718mZiwBG&4h%pCwq2gZHyh%?us`@0S$= zAhG+sP5ViCQ^J>@hr?-qMm0Nb!7zYyJ`g7&2Y^dN0mCq6oqO)N7XXj|6aY;`#`5LM zPhn<52vP8##WbX98ptp)BUl78W55ed2(OQVXDF|j1^}`1&1ce3rNUJ3mGYsK|Jhnk z2-*fRGBCSTD!I&D8wdoX=Xo<*T3Y^kaB%RdwQJW#UVr`dIYUE3*G3|dwsblji$o%w zT5HM|ie^rP8vsH>s03z4UokW_eC2;xOaag)0FPxc4WMBnctMqu&^_qqIL$G_2bP75 zj<)xu^E<-fu&`|#`F!30K#@pf$;~(4ybyo|fQE*K5{~0^GBZl0lJVk>^la93mgAa; z*dC4yn;2Gsso^WBhAa#KU;#iXub7(1=1t+BmO-!#pnJ%_eM%D$t#zSc+0XCv7D*{< znYqSw-K>$-sZ=VNZ+zSn{q>*nf16Rkwty4Fjb}-?ro_t~F7~Es zs>16kjiTm@j502q--WajrC*trYQ#s~-)S@kFrCNh)5`*ob2om-y1_rm1>vgYHDKaNKqeKh9{9ocS08_yq28p`lgefef@ zFXPou8RxYNEI&f%y=UWaZzlZNkagbvw8qQ(7+?X0 zB0Re*d`$3$@=!>1z67Ae%uLKoD^{#- zQBi0#Dg}po(p%Sl_l#ucj)TmsOaSaSj`#ixtDn25>B~Pfn-?y?80hf_SK$2u{@e>Z z{IbGjrwE+ZEU>uUKLHb(T?iVT&@(dzhk+;GCVX(noY2Nc;c*l^X^DLIN54;Y?&!nV zRS6=Zwzjs=qKj_5s{QLXKBk-+5@VdUBE}!){g$W7l(#ZhRY2HgG{ptx#tAJ6LUUXo zQ(){*D(vsq_^eN(BdL+|CTi*N@JHVdW)3AcuDpgd&Z*iE$=@}`=Xe^pb>axz>^wX1>jIh;*EWNtNY&@t;6LwKQTNegg3N@T-S&H zQOFJ?;ioBn$REqt-QAtu^~N(lp~0TvQIn}mtSe?yfheyaz@M`!?Z13v72z)k&#Yk& ze7a}zZ&p48AU}5FV?;ptV(EYWaPMm!@2;`K?<4^OT0-T@ZR30Fd0&<>4NsfUZBjQ-$Emee->NvRbrAKbv`}WhX!Cyw7bkBG? z+pGkCQW8Ds)UTaI{8-y3CE;Yc(gUBqzHZBtxBUu0 zH-IcNPq}M9-HmR7zrx@&G&IaubpDlJZ(nrzDiLd)pEbjVggF5`CNvYx3`-SYeQ5N|c3|XP$Xxt!bJwQ@KFPNoQVtW$mmJ&v6oS z=P5fJ@W_NBF#gRm={_LUtfOobFB~4}9|8 o3lDEA0}lbn!H;^!1YSA*58zJ!&hn@juK)l507*qoM6N<$f{fsK_W%F@ literal 3982 zc$@)_4{`8`P)_pKtejuU~gBF*Cl%K|}kr3Q()!n7LLu<9VpI)*L@rTT>SlFYhGYPDeoP4jfCvbQ5*(Gu z+A{lxFEx5U?(KN($jX%~)&GkCBBCo-JzF22F?TiB)LrGdF}nh7Oa?zrMdg|hK*$CJ z0i+d-;ejOO2Y)@VYwdk&)~t~{O|WSRAR=+oPq*DDYU)>)YU*N!Vd9IxgMfeuxR!s7 znZN)bJ&2(rp9~LlU9o!AIlHDKVoCu-WZd-gw|=f7vwx(WTEi6L3&RruK?|@9{{l0> z1b_j}fEY^l7y3KDd;e`;d7hak^@~Xbobt76?Q_1l>WO0Q>?fzW01N@t z*noiF@)ZJR|I`3PE?p?~9lHG&x1RdwWFpK7l@S>?-S_^6e57fqVFr!^e&TDU@Zl@h ziAP0Lswy|?pw4{o_J=-nh-l43BE&@SD}VOpzZPp7zW_W{g%<<_3@V4BYH#<&NUfj) zu0gTJpWe3mjiogHg%b%NB60oQTd!Bq#vhVpPYb@9ifT0ofFOb)M(d8R#{i`ABPlZ= zov>rYn}2)DJsVo9i8x9C5z*Cuzu|Nv-u$4p!@`^<{Py?9Q? zk1xOcat{C#GlPi4%DcB*X*7O$9b2wHP?dXOD)_n@!gXg0v?TnO97+M51B`?H3Wxe7 z!a)Ob5(b)LgqFBQjSUov9$wui@XkSN6uu0rv@gOR6Dp!cg<08Te|FEa^H*HhKCo=r zGF>qt5vYk>Cyx>St8)deSVRbzK<^On2DiCMW+UC7H6Js5q3K!oi?oe@2;o`oqI>w>ss zzC_q6VRsL(VNVTM`$nxbkMuyL<(2kDC=DoPn7x1AwD$JXmNTRy(UctQtbglJ zWZq{-ROq*ZE^atWpfz5=39&r(^t-@Fi;u!f1t>l0AIt!`k+T4pL?lfB!i~&W!GYkk z-~qzY`Gm$8(3t{W+&K(Z60?eLzrW=4=$=`#7WBtrv7F;Lo?#fw%my=));izldAasE z!(C6k-WBW1HP*kd$HiqQG8Q)v;$YfB)-%dI0C>uW*Ht2u41^Qc{lmsfpSX9~a{_=c z+}cwsk!LFSSP)pcfS@$6?kx$gl!sI3IJoqT`j6Y&+YdK3Hl|I}3>AyT6AOjH{6e9y zpja%nI*#Ln!(oatqcm%Z+WeKhph&WvY$v{&O~`o zHx0{)P6b~%n&bZGfdPP(L`WV!(AF|58I4ABp65kv+cvb;hwr)Pp6%`J?f-twHP>w3 zwryLlZQDvIWtpZq7z_rFoYorb$mWakaN0w*Bv4}(VZtlFWfFKUJGrnD07#sD$q(W% z0?t(Mm10G}p#crBMj|K=N2AePAP`WV=gn|kcj%#q9{T96yY5(;H?S}K(u z?CR>;>ALP`nM}qE1Ok0Ep-@T``+JpC=+0OGfVh>dIvO7ZuNlk?2rCYNMC*d{PGn;= zy_gK12xyLxKVbEH00>Pnk#t?xGYo@?$dXc)cJJQ(HUJlZ0f3e)S<<i6un~v@5T;iuObfm;6*Pn&;*|F97y(;Z zmc{VHnn^^?rI%jn0tmog?->MuU@$mX!6718mZiwBG&4h%pCwq2gZHyh%?us`@0S$= zAhG+sP5ViCQ^J>@hr?-qMm0Nb!7zYyJ`g7&2Y^dN0mCq6oqO)N7XXj|6aY;`#`5LM zPhn<52vP8##WbX98ptp)BUl78W55ed2(OQVXDF|j1^}`1&1ce3rNUJ3mGYsK|Jhnk z2-*fRGBCSTD!I&D8wdoX=Xo<*T3Y^kaB%RdwQJW#UVr`dIYUE3*G3|dwsblji$o%w zT5HM|ie^rP8vsH>s03z4UokW_eC2;xOaag)0FPxc4WMBnctMqu&^_qqIL$G_2bP75 zj<)xu^E<-fu&`|#`F!30K#@pf$;~(4ybyo|fQE*K5{~0^GBZl0lJVk>^la93mgAa; z*dC4yn;2Gsso^WBhAa#KU;#iXub7(1=1t+BmO-!#pnJ%_eM%D$t#zSc+0XCv7D*{< znYqSw-K>$-sZ=VNZ+zSn{q>*nf16Rkwty4Fjb}-?ro_t~F7~Es zs>16kjiTm@j502q--WajrC*trYQ#s~-)S@kFrCNh)5`*ob2om-y1_rm1>vgYHDKaNKqeKh9{9ocS08_yq28p`lgefef@ zFXPou8RxYNEI&f%y=UWaZzlZNkagbvw8qQ(7+?X0 zB0Re*d`$3$@=!>1z67Ae%uLKoD^{#- zQBi0#Dg}po(p%Sl_l#ucj)TmsOaSaSj`#ixtDn25>B~Pfn-?y?80hf_SK$2u{@e>Z z{IbGjrwE+ZEU>uUKLHb(T?iVT&@(dzhk+;GCVX(noY2Nc;c*l^X^DLIN54;Y?&!nV zRS6=Zwzjs=qKj_5s{QLXKBk-+5@VdUBE}!){g$W7l(#ZhRY2HgG{ptx#tAJ6LUUXo zQ(){*D(vsq_^eN(BdL+|CTi*N@JHVdW)3AcuDpgd&Z*iE$=@}`=Xe^pb>axz>^wX1>jIh;*EWNtNY&@t;6LwKQTNegg3N@T-S&H zQOFJ?;ioBn$REqt-QAtu^~N(lp~0TvQIn}mtSe?yfheyaz@M`!?Z13v72z)k&#Yk& ze7a}zZ&p48AU}5FV?;ptV(EYWaPMm!@2;`K?<4^OT0-T@ZR30Fd0&<>4NsfUZBjQ-$Emee->NvRbrAKbv`}WhX!Cyw7bkBG? z+pGkCQW8Ds)UTaI{8-y3CE;Yc(gUBqzHZBtxBUu0 zH-IcNPq}M9-HmR7zrx@&G&IaubpDlJZ(nrzDiLd)pEbjVggF5`CNvYx3`-SYeQ5N|c3|XP$Xxt!bJwQ@KFPNoQVtW$mmJ&v6oS z=P5fJ@W_NBF#gRm={_LUtfOobFB~4}9|8 o3lDEA0}lbn!H;^!1YSA*58zJ!&hn@juK)l507*qoM6N<$f{fsK_W%F@ diff --git a/src/context/applets/currenttrack/package/contents/ui/InfoItem.qml b/src/context/applets/currenttrack/package/contents/ui/InfoItem.qml --- a/src/context/applets/currenttrack/package/contents/ui/InfoItem.qml +++ b/src/context/applets/currenttrack/package/contents/ui/InfoItem.qml @@ -17,6 +17,7 @@ import QtQuick 2.4 import QtQuick.Controls 2.0 import QtQuick.Layouts 1.3 +import org.kde.kirigami 2.0 as Kirigami import org.kde.amarok.currenttrack 1.0 ColumnLayout { @@ -26,7 +27,7 @@ property alias album: albumLabel.text property alias artist: artistLabel.text - spacing: Context.smallSpacing + spacing: Kirigami.Units.smallSpacing Label { id: titleLabel diff --git a/src/context/applets/currenttrack/package/contents/ui/StatsItem.qml b/src/context/applets/currenttrack/package/contents/ui/StatsItem.qml --- a/src/context/applets/currenttrack/package/contents/ui/StatsItem.qml +++ b/src/context/applets/currenttrack/package/contents/ui/StatsItem.qml @@ -16,77 +16,94 @@ import QtQuick 2.4 import QtQuick.Controls 2.0 -import QtQuick.Layouts 1.3 import org.kde.amarok.currenttrack 1.0 -Column { +Item { id: root - property real textSize: Context.largeSpacing property alias playCount: playCountLabel.text property alias score: scoreLabel.text property alias lastPlayed: lastPlayedLabel.text Row { - width: parent.width + height: parent.height / 2 Label { text: i18n("Play Count") - width: parent.width / 3 + width: root.width / 3 + height: parent.height horizontalAlignment: Text.AlignHCenter maximumLineCount: 1 - font.pixelSize: root.textSize + fontSizeMode: Text.Fit + font.pointSize: 32 + minimumPointSize: 9 } Label { text: i18n("Score") - width: parent.width / 3 + width: root.width / 3 + height: parent.height horizontalAlignment: Text.AlignHCenter maximumLineCount: 1 - font.pixelSize: root.textSize + fontSizeMode: Text.Fit + font.pointSize: 32 + minimumPointSize: 9 } Label { text: i18n("Last played") - width: parent.width / 3 + width: root.width / 3 + height: parent.height horizontalAlignment: Text.AlignHCenter maximumLineCount: 1 - font.pixelSize: root.textSize + fontSizeMode: Text.Fit + font.pointSize: 32 + minimumPointSize: 9 } } Rectangle { width: parent.width - height: childrenRect.height + height: parent.height / 2 + anchors.bottom: parent.bottom color: palette.base Row { - width: parent.width + height: parent.height Label { id: playCountLabel - width: parent.width / 3 + width: root.width / 3 + height: parent.height horizontalAlignment: Text.AlignHCenter maximumLineCount: 1 - font.pixelSize: root.textSize + fontSizeMode: Text.Fit + font.pointSize: 32 + minimumPointSize: 9 text: CurrentTrackEngine.timesPlayed elide: Text.ElideRight } Label { id: scoreLabel - width: parent.width / 3 + width: root.width / 3 + height: parent.height horizontalAlignment: Text.AlignHCenter maximumLineCount: 1 - font.pixelSize: root.textSize + fontSizeMode: Text.Fit + font.pointSize: 32 + minimumPointSize: 9 text: CurrentTrackEngine.score elide: Text.ElideRight } Label { id: lastPlayedLabel - width: parent.width / 3 + width: root.width / 3 + height: parent.height horizontalAlignment: Text.AlignHCenter maximumLineCount: 1 - font.pixelSize: root.textSize + fontSizeMode: Text.Fit + font.pointSize: 32 + minimumPointSize: 9 text: CurrentTrackEngine.lastPlayed elide: Text.ElideRight } diff --git a/src/context/applets/currenttrack/package/contents/ui/main.qml b/src/context/applets/currenttrack/package/contents/ui/main.qml --- a/src/context/applets/currenttrack/package/contents/ui/main.qml +++ b/src/context/applets/currenttrack/package/contents/ui/main.qml @@ -17,44 +17,23 @@ import QtQuick 2.4 import QtQuick.Controls 2.0 import QtQuick.Layouts 1.3 +import org.kde.kirigami 2.0 as Kirigami import org.kde.amarok.qml 1.0 as AmarokQml import org.kde.amarok.currenttrack 1.0 AmarokQml.Applet { id: applet //album art - Rectangle { + Loader { id: cover - color: "white" - radius: Context.smallSpacing / 2 - border.width: 1 - border.color: applet.palette.light height: parent.height width: height - AmarokQml.PixmapItem { - id: iconItem - - anchors.fill: parent - anchors.margins: parent.radius - source: CurrentTrackEngine.cover - - onWidthChanged: CurrentTrackEngine.coverWidth = width - - //show standard empty cover if no data is available - AmarokQml.PixmapItem { - anchors.fill: parent - source: Svg.renderSvg("file://" + applet.packagePath + "images/amarok-currenttrack.svg", - "CurrentTrack", - width, - height, - "album_old"); - visible: !iconItem.valid - } - } + sourceComponent: CurrentTrackEngine.hasValidCover ? coverComponent : emptyComponent } + ColumnLayout { anchors { left: cover.right @@ -79,8 +58,8 @@ AmarokQml.RatingItem { id: ratingItem - height: Context.largeSpacing * 2 - width: height * 6 + Layout.preferredWidth: height * 6 + Layout.preferredHeight: parent.height / 5 Layout.alignment: Qt.AlignTop | Qt.AlignRight rating: CurrentTrackEngine.rating onClicked: CurrentTrackEngine.rating = newRating @@ -91,7 +70,40 @@ Layout.fillWidth: true Layout.alignment: Qt.AlignBottom - height: Context.largeSpacing * 3 + Layout.preferredHeight: parent.height / 5 + } + } + + Component { + id: coverComponent + + Rectangle { + id: cover + + color: "white" + radius: Kirigami.Units.smallSpacing / 2 + border.width: 1 + border.color: applet.palette.light + + + AmarokQml.PixmapItem { + id: iconItem + + anchors.fill: parent + anchors.margins: parent.radius + source: CurrentTrackEngine.cover + } + } + } + Component { + id: emptyComponent + + AmarokQml.PixmapItem { + source: Svg.renderSvg(applet.imageUrl("amarok-currenttrack.svg"), + "CurrentTrack", + width, + height, + "album_old"); } } } diff --git a/src/context/applets/currenttrack/package/metadata.desktop b/src/context/applets/currenttrack/package/metadata.desktop --- a/src/context/applets/currenttrack/package/metadata.desktop +++ b/src/context/applets/currenttrack/package/metadata.desktop @@ -19,12 +19,12 @@ Name[ga]=An tAmhrán Reatha Name[gl]=Pista actual Name[hu]=Jelenlegi szám -Name[id]=Track Saat Ini +Name[id]=Trek Saat Ini Name[is]=Núverandi lag Name[it]=Traccia attuale Name[ja]=現在のトラック Name[km]=​បទ​បច្ចុប្បន្ន -Name[ko]=현재 곡 +Name[ko]=현재 트랙 Name[lt]=Dabartinė daina Name[lv]=Aktīvais celiņš Name[nb]=Gjeldende spor diff --git a/src/context/applets/currenttrack/plugin/CurrentEngine.h b/src/context/applets/currenttrack/plugin/CurrentEngine.h --- a/src/context/applets/currenttrack/plugin/CurrentEngine.h +++ b/src/context/applets/currenttrack/plugin/CurrentEngine.h @@ -40,10 +40,10 @@ Q_PROPERTY(QString lastPlayed READ lastPlayed NOTIFY trackChanged) Q_PROPERTY(int timesPlayed READ timesPlayed NOTIFY trackChanged) Q_PROPERTY(QVariant cover READ cover NOTIFY albumChanged) - Q_PROPERTY(int coverWidth READ coverWidth WRITE setCoverWidth NOTIFY coverWidthChanged) + Q_PROPERTY(bool hasValidCover READ hasValidCover NOTIFY albumChanged) public: - CurrentEngine( QObject* parent = Q_NULLPTR ); + explicit CurrentEngine( QObject* parent = nullptr ); virtual ~CurrentEngine(); QString artist() const; @@ -56,25 +56,23 @@ QString lastPlayed() const; int timesPlayed() const; QVariant cover() const { return QVariant(m_cover); } - int coverWidth() { return m_coverWidth; } - void setCoverWidth( int width ); + bool hasValidCover() const { return !m_cover.isNull(); } -signals: +Q_SIGNALS: void trackChanged(); void albumChanged(); void coverWidthChanged(); private Q_SLOTS: - void slotAlbumMetadataChanged( Meta::AlbumPtr album ); + void slotAlbumMetadataChanged(const Meta::AlbumPtr &album ); void slotTrackMetadataChanged( Meta::TrackPtr track ); - void slotTrackChanged( Meta::TrackPtr track ); + void slotTrackChanged( const Meta::TrackPtr &track ); void stopped(); private: void update( Meta::TrackPtr track ); void update( Meta::AlbumPtr album ); - int m_coverWidth; QPixmap m_cover; Meta::AlbumList m_albums; Meta::TrackPtr m_currentTrack; diff --git a/src/context/applets/currenttrack/plugin/CurrentEngine.cpp b/src/context/applets/currenttrack/plugin/CurrentEngine.cpp --- a/src/context/applets/currenttrack/plugin/CurrentEngine.cpp +++ b/src/context/applets/currenttrack/plugin/CurrentEngine.cpp @@ -37,27 +37,27 @@ CurrentEngine::CurrentEngine( QObject* parent ) : QObject( parent ) - , m_coverWidth( 0 ) - , m_lastQueryMaker( Q_NULLPTR ) + , m_lastQueryMaker( nullptr ) { EngineController* engine = The::engineController(); + // Connect queued to reduce interface stuttering. connect( engine, &EngineController::trackPlaying, - this, &CurrentEngine::slotTrackChanged ); + this, &CurrentEngine::slotTrackChanged, Qt::QueuedConnection ); connect( engine, &EngineController::stopped, - this, &CurrentEngine::stopped ); + this, &CurrentEngine::stopped, Qt::QueuedConnection ); connect( engine, &EngineController::trackMetadataChanged, - this, &CurrentEngine::slotTrackMetadataChanged ); + this, &CurrentEngine::slotTrackMetadataChanged, Qt::QueuedConnection ); connect( engine, &EngineController::albumMetadataChanged, - this, &CurrentEngine::slotAlbumMetadataChanged ); + this, &CurrentEngine::slotAlbumMetadataChanged, Qt::QueuedConnection ); } CurrentEngine::~CurrentEngine() { } void -CurrentEngine::slotAlbumMetadataChanged( Meta::AlbumPtr album ) +CurrentEngine::slotAlbumMetadataChanged( const Meta::AlbumPtr &album ) { DEBUG_BLOCK @@ -68,12 +68,12 @@ QPixmap cover; if( album ) - cover = The::coverCache()->getCover( album, m_coverWidth ); + cover = The::coverCache()->getCover( album, 1 ); if( m_cover.cacheKey() != cover.cacheKey() ) { m_cover = cover; - emit albumChanged(); + Q_EMIT albumChanged(); } } @@ -84,11 +84,11 @@ return; update( track->album() ); - emit trackChanged(); + Q_EMIT trackChanged(); } void -CurrentEngine::slotTrackChanged(Meta::TrackPtr track) +CurrentEngine::slotTrackChanged(const Meta::TrackPtr &track) { DEBUG_BLOCK @@ -104,13 +104,13 @@ CurrentEngine::stopped() { m_currentTrack.clear(); - emit trackChanged(); + Q_EMIT trackChanged(); m_cover = QPixmap(); // Collect data for the recently added albums m_albums.clear(); - emit albumChanged(); + Q_EMIT albumChanged(); Collections::QueryMaker *qm = CollectionManager::instance()->queryMaker(); qm->setAutoDelete( true ); @@ -129,7 +129,7 @@ void CurrentEngine::update( Meta::AlbumPtr album ) { - m_lastQueryMaker = Q_NULLPTR; + m_lastQueryMaker = nullptr; if( !album ) return; @@ -223,7 +223,7 @@ return; m_currentTrack->statistics()->setRating( rating ); - emit trackChanged(); + Q_EMIT trackChanged(); } int @@ -268,16 +268,3 @@ return m_currentTrack->statistics()->playCount(); } - -void -CurrentEngine::setCoverWidth(int width) -{ - if( m_coverWidth == width ) - return; - - m_coverWidth = width; - emit coverWidthChanged(); - - if( m_currentTrack ) - slotAlbumMetadataChanged( m_currentTrack->album() ); -} diff --git a/src/context/applets/currenttrack/plugin/CurrentPlugin.cpp b/src/context/applets/currenttrack/plugin/CurrentPlugin.cpp --- a/src/context/applets/currenttrack/plugin/CurrentPlugin.cpp +++ b/src/context/applets/currenttrack/plugin/CurrentPlugin.cpp @@ -32,7 +32,7 @@ Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) public: - void registerTypes(const char* uri) Q_DECL_OVERRIDE + void registerTypes(const char* uri) override { Q_ASSERT(uri == QLatin1String("org.kde.amarok.currenttrack")); diff --git a/src/context/applets/info/CMakeLists.txt b/src/context/applets/info/CMakeLists.txt --- a/src/context/applets/info/CMakeLists.txt +++ b/src/context/applets/info/CMakeLists.txt @@ -14,4 +14,4 @@ install(TARGETS amarok_context_applet_info DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/amarok/info) install(FILES plugin/qmldir DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/amarok/info) -kpackage_install_package(package org.kde.amarok.info amarok) +kpackage_install_bundled_package(package org.kde.amarok.info amarok) diff --git a/src/context/applets/info/package/contents/ui/main.qml b/src/context/applets/info/package/contents/ui/main.qml --- a/src/context/applets/info/package/contents/ui/main.qml +++ b/src/context/applets/info/package/contents/ui/main.qml @@ -16,6 +16,7 @@ import QtQuick 2.4 // import QtWebView 1.1 +import org.kde.kirigami 2.0 as Kirigami import org.kde.amarok.qml 1.0 as AmarokQml import org.kde.amarok.info 1.0 @@ -25,9 +26,7 @@ // WebView { // id: content // -// anchors.top: parent.top -// width: parent.width -// height: Context.largeSpacing * 20 //TODO: Find a more elegant solution to set the height +// anchors.fill: parent // // Connections { // target: InfoEngine diff --git a/src/context/applets/info/plugin/InfoEngine.h b/src/context/applets/info/plugin/InfoEngine.h --- a/src/context/applets/info/plugin/InfoEngine.h +++ b/src/context/applets/info/plugin/InfoEngine.h @@ -45,15 +45,15 @@ public: - InfoEngine( QObject* parent = Q_NULLPTR ); + explicit InfoEngine( QObject* parent = nullptr ); ~InfoEngine(); QString serviceName() const { return m_storedInfo.value("service_name").toString(); } QString mainInfo() const; void infoChanged( QVariantMap infoMap ); -signals: +Q_SIGNALS: void serviceChanged(); private: diff --git a/src/context/applets/info/plugin/InfoPlugin.cpp b/src/context/applets/info/plugin/InfoPlugin.cpp --- a/src/context/applets/info/plugin/InfoPlugin.cpp +++ b/src/context/applets/info/plugin/InfoPlugin.cpp @@ -32,7 +32,7 @@ Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) public: - void registerTypes(const char* uri) Q_DECL_OVERRIDE + void registerTypes(const char* uri) override { Q_ASSERT(uri == QLatin1String("org.kde.amarok.info")); diff --git a/src/context/applets/labels/CMakeLists.txt b/src/context/applets/labels/CMakeLists.txt --- a/src/context/applets/labels/CMakeLists.txt +++ b/src/context/applets/labels/CMakeLists.txt @@ -16,5 +16,5 @@ KF5::Plasma ) -install(TARGETS amarok_context_applet_labels DESTINATION ${PLUGIN_INSTALL_DIR}) -install(FILES amarok-context-applet-labels.desktop DESTINATION ${SERVICES_INSTALL_DIR}) +install(TARGETS amarok_context_applet_labels DESTINATION ${KDE_INSTALL_PLUGINDIR}) +install(FILES amarok-context-applet-labels.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}) diff --git a/src/context/applets/labels/LabelGraphicsItem.h b/src/context/applets/labels/LabelGraphicsItem.h --- a/src/context/applets/labels/LabelGraphicsItem.h +++ b/src/context/applets/labels/LabelGraphicsItem.h @@ -38,7 +38,7 @@ public: LabelGraphicsItem( const QString& text, qreal deltaPointSize, QGraphicsItem *parent ); - ~LabelGraphicsItem(); + ~LabelGraphicsItem() override; QString text(); void setText( const QString& text ); @@ -54,9 +54,9 @@ void paint( QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget ); protected: - virtual void hoverLeaveEvent( QGraphicsSceneHoverEvent *event ); - virtual void hoverEnterEvent( QGraphicsSceneHoverEvent *event ); - virtual void mousePressEvent( QGraphicsSceneMouseEvent *event ); + void hoverLeaveEvent( QGraphicsSceneHoverEvent *event ) override; + void hoverEnterEvent( QGraphicsSceneHoverEvent *event ) override; + void mousePressEvent( QGraphicsSceneMouseEvent *event ) override; private: qreal hoverValue(); diff --git a/src/context/applets/labels/LabelOverlayButton.h b/src/context/applets/labels/LabelOverlayButton.h --- a/src/context/applets/labels/LabelOverlayButton.h +++ b/src/context/applets/labels/LabelOverlayButton.h @@ -22,7 +22,6 @@ class KIconEffect; class QGraphicsSceneHoverEvent; -class QGraphicsSceneMouseEvent; class QPainter; class QStyleOptionGraphicsItem; class QWidget; @@ -34,8 +33,8 @@ Q_PROPERTY( qreal opacity READ opacity WRITE setOpacity ) public: - LabelOverlayButton( QGraphicsItem *parent ); - ~LabelOverlayButton(); + explicit LabelOverlayButton( QGraphicsItem *parent ); + ~LabelOverlayButton() override; void setPixmap( const QPixmap& pixmap ); QPixmap pixmap(); @@ -47,8 +46,8 @@ void paint( QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget ); protected: - virtual void hoverEnterEvent( QGraphicsSceneHoverEvent *event ); - virtual void hoverLeaveEvent( QGraphicsSceneHoverEvent *event ); + void hoverEnterEvent( QGraphicsSceneHoverEvent *event ) override; + void hoverLeaveEvent( QGraphicsSceneHoverEvent *event ) override; private: KIconEffect *m_iconEffect; diff --git a/src/context/applets/labels/LabelsApplet.cpp b/src/context/applets/labels/LabelsApplet.cpp --- a/src/context/applets/labels/LabelsApplet.cpp +++ b/src/context/applets/labels/LabelsApplet.cpp @@ -562,7 +562,7 @@ if( !m_stoppedstate ) // otherwise there's been an error { m_userLabels = data[ "user" ].toStringList(); - m_webLabels.clear(); // we can saftly clear the web labels because user labels will never be updated without the web labels + m_webLabels.clear(); // we can safely clear the web labels because user labels will never be updated without the web labels if( !data.contains( "web" ) ) // avoid calling updateLabels twice updateLabels(); @@ -702,9 +702,9 @@ m_addLabel.data()->lineEdit()->setText( saveText ); } - // usuallay the engine keeps track of label changes of the playing track - // (except if the lables get auto added, this is why we have to keep m_userLabels up to date) - // but it doesn't work alway, so we update + // usually the engine keeps track of label changes of the playing track + // (except if the labels get auto added, this is why we have to keep m_userLabels up to date) + // but it doesn't work always, so we update updateLabels(); } diff --git a/src/context/applets/labels/amarok-context-applet-labels.desktop b/src/context/applets/labels/amarok-context-applet-labels.desktop --- a/src/context/applets/labels/amarok-context-applet-labels.desktop +++ b/src/context/applets/labels/amarok-context-applet-labels.desktop @@ -48,7 +48,7 @@ Name[ug]=ئەنلەر Name[uk]=Мітки Name[x-test]=xxLabelsxx -Name[zh_CN]=标签 +Name[zh_CN]=标记 Name[zh_TW]=標籤 Type=Service Icon=label-amarok diff --git a/src/context/applets/lyrics/CMakeLists.txt b/src/context/applets/lyrics/CMakeLists.txt --- a/src/context/applets/lyrics/CMakeLists.txt +++ b/src/context/applets/lyrics/CMakeLists.txt @@ -14,4 +14,4 @@ install(TARGETS amarok_context_applet_lyrics DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/amarok/lyrics) install(FILES plugin/qmldir DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/amarok/lyrics) -kpackage_install_package(package org.kde.amarok.lyrics amarok) +kpackage_install_bundled_package(package org.kde.amarok.lyrics amarok) diff --git a/images/icons/48-actions-amarok_lyrics.png b/src/context/applets/lyrics/package/contents/images/icon.png rename from images/icons/48-actions-amarok_lyrics.png rename to src/context/applets/lyrics/package/contents/images/icon.png index 963b0cf9d42419bdcc5d67688a4e19484ee94792..963b0cf9d42419bdcc5d67688a4e19484ee94792 GIT binary patch literal 1952 zc$}Tp`#0429|!Qypk1<+D7Rwstxy|lHAO0=r6FdrW0sJOm{f8J+gM8FtJyBA+;#M2 zFMd2 znVDHxS$TPR`T6+;1qH=#-@bhZdk>T#sIbz~(z3F$a-gEJ0-(_<0g!YWf=;7@s-go` zRrKmAST(E$sD*t1>JasahKBlv#s;7f)&wvZO^jv+gV79YX>LJ$M6@E>HvJB3hjjqm zJ)N+w&aO?&F6O3g1oBuG^57m&Y&d{k1iOz7^dUH$zJ4wT_yh4Lq94H>9vB!H9313w zxkE!k!vJs72ybK)e}unjls`Jk9~&P9#t`E$fk5yVAe{Ugm_P`H6T(R$FgYol6bYwh zCjpUYQY3~05Q{}(i5QSb#1g3lkV+-eDJd|8m`2PXW)X9UdBnoPynJZ^kRcWka>PG~ zCB!n~)25YAD=VK?*H&PwE2{t!YlzQ?b=bzn1{l}q2@Ds^pGhPh=LRV$tEj4NRku6$ zy@S&wPcQGwKK?g@Z%0MPlT%X*M@D3_wKZ_hdSK8Rf>g|$?Cl6q!)fVPu6zHe%jjL^ z^YVRo?^z%6D-CW0{z|0NnZxE;0~K_MZf>r!Nz4zgUw!+ZIM=(0PsUS}o2}m5O0ny+ z)Z_iv+JhbEWsEB(`b{~;lw)5VXK_Z3Sh3bqVpyHn9W2VT#R+m)#~i6~?xe_hR@kZ7 zTL^v9Eef$f9iD*{5BHEOZdf#HKi2Aagwp;>Ob_PTa9sB7>w(%A9_-zxd0^!kndqfe zrhonHY={Y^;KT)Lc%5}lG7kV zTQdB!%{0|jTIcc?&*vVaPoKPJmtp(Z=U{Qs$>AX$xcC;uX@8yF5f$*@ib3DTO-T`T zUjTLP#gs`&ycNoV)clLr`ESew)^e@Z@VF!g7el`w4RjOHS(|3XPLrLYqEo`OH0{60 za8gs|xTFP=YRp4)w3j=d#HM|$Ddpp#mrvbiDHXp8$}|jWhHTJ{nE7u~G4FE6irh)t z7pr6Lw2l-HzU%jY9+hyFqkYc6V@sNa>Nr_Ho3Im)xi#J0HLYo8mG`I8`h;32{yP&p zX0DOsWrN7a#%Q|4se~4Em&Qq|4>OMX`(B2_g=%B+{phKlEMF#Z*;Wt~I5WX3Uz2&v zx|zobAFX&~tp0&dP_&0tKkh|ee6vHrIe2yE6p4M+d(2LS9XltJ)yntR>HlOjP#5r$ z|6<9`wyEV%)d^SXF;mJ~MhCVpAjyvyl!Hp_(d!LUM~S;9oKT@+`!{PLx-J&G1EvJW zZS$rMV7E|BmF|g@cFmIu-|WKn|7?Hc#y0I|W~dK^2dsAgKu~MXa#MH9+(nUIQ^SVR z401^E9cenZ&5|ASofdWQNnvYwy-ik9@1~hxxuXtcYP%0kuDYy$TK2R|KgsJZ<-&`J z+@(fA-Tlbfki4K+F{g}{T68^@ttau)j!pPbfBN~+WK*5p>*nLo*oLL%fv^4VG}epV zaF5k1nPa-);`cNoopnQT`R>nz%uGv(eD!A0cg(R=!>;LZZsEpwsUOYVuGcv!?{!-9 zku#0d)c>J9DbwESHrX13>v7h%#RcA9rVT$>;^8Z-n5BpE2{lzq0>-UOt<%9CEou8H zwLQl$WaH%DLqtP_c-g_0hdZC2;-?M-U)&z8L+i_Fy82U$(XOaFgy@baV|JB3qon5~ z8K)F;HsV$yhVN1E(u?X{E>E literal 1952 zc$}Tp`#0429|!Qypk1<+D7Rwstxy|lHAO0=r6FdrW0sJOm{f8J+gM8FtJyBA+;#M2 zFMd2 znVDHxS$TPR`T6+;1qH=#-@bhZdk>T#sIbz~(z3F$a-gEJ0-(_<0g!YWf=;7@s-go` zRrKmAST(E$sD*t1>JasahKBlv#s;7f)&wvZO^jv+gV79YX>LJ$M6@E>HvJB3hjjqm zJ)N+w&aO?&F6O3g1oBuG^57m&Y&d{k1iOz7^dUH$zJ4wT_yh4Lq94H>9vB!H9313w zxkE!k!vJs72ybK)e}unjls`Jk9~&P9#t`E$fk5yVAe{Ugm_P`H6T(R$FgYol6bYwh zCjpUYQY3~05Q{}(i5QSb#1g3lkV+-eDJd|8m`2PXW)X9UdBnoPynJZ^kRcWka>PG~ zCB!n~)25YAD=VK?*H&PwE2{t!YlzQ?b=bzn1{l}q2@Ds^pGhPh=LRV$tEj4NRku6$ zy@S&wPcQGwKK?g@Z%0MPlT%X*M@D3_wKZ_hdSK8Rf>g|$?Cl6q!)fVPu6zHe%jjL^ z^YVRo?^z%6D-CW0{z|0NnZxE;0~K_MZf>r!Nz4zgUw!+ZIM=(0PsUS}o2}m5O0ny+ z)Z_iv+JhbEWsEB(`b{~;lw)5VXK_Z3Sh3bqVpyHn9W2VT#R+m)#~i6~?xe_hR@kZ7 zTL^v9Eef$f9iD*{5BHEOZdf#HKi2Aagwp;>Ob_PTa9sB7>w(%A9_-zxd0^!kndqfe zrhonHY={Y^;KT)Lc%5}lG7kV zTQdB!%{0|jTIcc?&*vVaPoKPJmtp(Z=U{Qs$>AX$xcC;uX@8yF5f$*@ib3DTO-T`T zUjTLP#gs`&ycNoV)clLr`ESew)^e@Z@VF!g7el`w4RjOHS(|3XPLrLYqEo`OH0{60 za8gs|xTFP=YRp4)w3j=d#HM|$Ddpp#mrvbiDHXp8$}|jWhHTJ{nE7u~G4FE6irh)t z7pr6Lw2l-HzU%jY9+hyFqkYc6V@sNa>Nr_Ho3Im)xi#J0HLYo8mG`I8`h;32{yP&p zX0DOsWrN7a#%Q|4se~4Em&Qq|4>OMX`(B2_g=%B+{phKlEMF#Z*;Wt~I5WX3Uz2&v zx|zobAFX&~tp0&dP_&0tKkh|ee6vHrIe2yE6p4M+d(2LS9XltJ)yntR>HlOjP#5r$ z|6<9`wyEV%)d^SXF;mJ~MhCVpAjyvyl!Hp_(d!LUM~S;9oKT@+`!{PLx-J&G1EvJW zZS$rMV7E|BmF|g@cFmIu-|WKn|7?Hc#y0I|W~dK^2dsAgKu~MXa#MH9+(nUIQ^SVR z401^E9cenZ&5|ASofdWQNnvYwy-ik9@1~hxxuXtcYP%0kuDYy$TK2R|KgsJZ<-&`J z+@(fA-Tlbfki4K+F{g}{T68^@ttau)j!pPbfBN~+WK*5p>*nLo*oLL%fv^4VG}epV zaF5k1nPa-);`cNoopnQT`R>nz%uGv(eD!A0cg(R=!>;LZZsEpwsUOYVuGcv!?{!-9 zku#0d)c>J9DbwESHrX13>v7h%#RcA9rVT$>;^8Z-n5BpE2{lzq0>-UOt<%9CEou8H zwLQl$WaH%DLqtP_c-g_0hdZC2;-?M-U)&z8L+i_Fy82U$(XOaFgy@baV|JB3qon5~ z8K)F;HsV$yhVN1E(u?X{E>E diff --git a/src/context/applets/lyrics/plugin/LyricsEngine.h b/src/context/applets/lyrics/plugin/LyricsEngine.h --- a/src/context/applets/lyrics/plugin/LyricsEngine.h +++ b/src/context/applets/lyrics/plugin/LyricsEngine.h @@ -18,14 +18,13 @@ #ifndef AMAROK_LYRICS_ENGINE #define AMAROK_LYRICS_ENGINE -#include "context/LyricsManager.h" #include "core/meta/Meta.h" #include #include #include -class LyricsEngine : public QObject, public LyricsObserver +class LyricsEngine : public QObject { Q_OBJECT Q_PROPERTY(QString text READ text NOTIFY lyricsChanged) @@ -37,14 +36,13 @@ Q_PROPERTY(QString font READ font WRITE setFont NOTIFY fontChanged) public: - LyricsEngine( QObject* parent = Q_NULLPTR ); + explicit LyricsEngine( QObject* parent = nullptr ); - // reimplemented from LyricsObserver - void newLyrics( const LyricsData &lyrics ) Q_DECL_OVERRIDE; - void newSuggestions( const QVariantList &suggest ) Q_DECL_OVERRIDE; - void lyricsMessage( const QString& key, const QString& val ) Q_DECL_OVERRIDE; + void newLyrics( const Meta::TrackPtr &track ); + void newSuggestions( const QVariantList &suggest ); + void lyricsMessage( const QString& key, const QString& val ); - QString text() const { return m_lyrics.text; } + QString text() const { return m_lyrics; } QVariantList suggestions() const { return m_suggestions; } bool fetching() const { return m_fetching; } qreal position() const; @@ -56,7 +54,6 @@ void setFont( const QString &font ); Q_INVOKABLE void refetchLyrics() const; - Q_INVOKABLE void fetchLyrics( const QString &artist, const QString &title, const QString &url ); Q_INVOKABLE QStringList availableFonts() const; Q_SIGNALS: @@ -73,11 +70,9 @@ void onTrackMetadataChanged( Meta::TrackPtr track ); private: - void setLyrics( const LyricsData &lyrics ); void clearLyrics(); - void refetchLyrics(); - LyricsData m_lyrics; + QString m_lyrics; QVariantList m_suggestions; bool m_fetching; bool m_isUpdateInProgress; diff --git a/src/context/applets/lyrics/plugin/LyricsEngine.cpp b/src/context/applets/lyrics/plugin/LyricsEngine.cpp --- a/src/context/applets/lyrics/plugin/LyricsEngine.cpp +++ b/src/context/applets/lyrics/plugin/LyricsEngine.cpp @@ -20,144 +20,73 @@ #include "LyricsEngine.h" #include "EngineController.h" -#include "scripting/scriptmanager/ScriptManager.h" #include "core/support/Amarok.h" #include "core/support/Debug.h" +#include "lyrics/LyricsManager.h" #include #include LyricsEngine::LyricsEngine( QObject* parent ) : QObject( parent ) - , LyricsObserver( LyricsManager::self() ) , m_fetching( false ) , m_isUpdateInProgress( false ) { EngineController* engine = The::engineController(); + LyricsManager* lyricsManager = LyricsManager::instance(); connect( engine, &EngineController::trackChanged, this, &LyricsEngine::update ); connect( engine, &EngineController::trackMetadataChanged, this, &LyricsEngine::onTrackMetadataChanged ); connect( engine, &EngineController::trackPositionChanged, this, &LyricsEngine::positionChanged ); + connect( lyricsManager, &LyricsManager::newLyrics, this, &LyricsEngine::newLyrics ); + connect( lyricsManager, &LyricsManager::newSuggestions, this, &LyricsEngine::newSuggestions ); } void LyricsEngine::onTrackMetadataChanged( Meta::TrackPtr track ) { DEBUG_BLOCK // Only update if the lyrics have changed. - QString artist = track->artist() ? track->artist()->name() : QString(); - if( m_lyrics.artist != artist || - m_lyrics.title != track->name() || - m_lyrics.text != track->cachedLyrics() ) + if( m_lyrics != track->cachedLyrics() ) update(); } void LyricsEngine::update() { - if( m_isUpdateInProgress ) - return; - - m_isUpdateInProgress = true; - - // -- get current title and artist - Meta::TrackPtr currentTrack = The::engineController()->currentTrack(); - if( !currentTrack ) + Meta::TrackPtr track = The::engineController()->currentTrack(); + if( !track ) { - debug() << "no current track"; - m_lyrics.clear(); - emit lyricsChanged(); - m_isUpdateInProgress = false; + clearLyrics(); return; } - QString title = currentTrack->name(); - QString artist = currentTrack->artist() ? currentTrack->artist()->name() : QString(); - - // -- clean up title - const QString magnatunePreviewString = QLatin1String( "PREVIEW: buy it at www.magnatune.com" ); - if( title.contains(magnatunePreviewString, Qt::CaseSensitive) ) - title = title.remove( " (" + magnatunePreviewString + ')' ); - if( artist.contains(magnatunePreviewString, Qt::CaseSensitive) ) - artist = artist.remove( " (" + magnatunePreviewString + ')' ); - - if( title.isEmpty() && currentTrack ) + if( LyricsManager::instance()->isEmpty( track->cachedLyrics() ) ) { - /* If title is empty, try to use pretty title. - The fact that it often (but not always) has "artist name" together, can be bad, - but at least the user will hopefully get nice suggestions. */ - QString prettyTitle = currentTrack->prettyName(); - int h = prettyTitle.indexOf( QLatin1Char('-') ); - if ( h != -1 ) - { - title = prettyTitle.mid( h + 1 ).trimmed(); - if( title.contains(magnatunePreviewString, Qt::CaseSensitive) ) - title = title.remove( " (" + magnatunePreviewString + ')' ); - - if( artist.isEmpty() ) - { - artist = prettyTitle.mid( 0, h ).trimmed(); - if( artist.contains(magnatunePreviewString, Qt::CaseSensitive) ) - artist = artist.remove( " (" + magnatunePreviewString + ')' ); - } - } - } - - LyricsData lyrics = { currentTrack->cachedLyrics(), title, artist, QUrl() }; - - // Check if the title, the artist and the lyrics are still the same. - if( !lyrics.text.isEmpty() && (lyrics.text == m_lyrics.text) ) - { - debug() << "nothing changed:" << lyrics.title; - newLyrics( lyrics ); - m_isUpdateInProgress = false; + clearLyrics(); return; } - // don't rely on caching for streams - const bool cached = !LyricsManager::self()->isEmpty( lyrics.text ) - && !The::engineController()->isStream(); - - if( cached ) - { - newLyrics( lyrics ); - } - else - { - // no lyrics, and no lyrics script! - if( !ScriptManager::instance()->lyricsScriptRunning() ) - { - debug() << "no lyrics script running"; - clearLyrics(); - disconnect( ScriptManager::instance(), &ScriptManager::lyricsScriptStarted, this, 0 ); - connect( ScriptManager::instance(), &ScriptManager::lyricsScriptStarted, this, &LyricsEngine::update ); - m_isUpdateInProgress = false; - return; - } - - // fetch by lyrics script - clearLyrics(); - m_fetching = true; - emit fetchingChanged(); - ScriptManager::instance()->notifyFetchLyrics( lyrics.artist, lyrics.title, "", currentTrack ); - } - m_isUpdateInProgress = false; + newLyrics( track ); } -void LyricsEngine::newLyrics( const LyricsData &lyrics ) +void LyricsEngine::newLyrics( const Meta::TrackPtr &track ) { DEBUG_BLOCK - m_lyrics = lyrics; - emit lyricsChanged(); + if( track != The::engineController()->currentTrack() ) + return; + + m_lyrics = track->cachedLyrics(); + Q_EMIT lyricsChanged(); m_fetching = false; - emit fetchingChanged(); + Q_EMIT fetchingChanged(); } void LyricsEngine::newSuggestions( const QVariantList &suggested ) @@ -174,16 +103,16 @@ DEBUG_BLOCK clearLyrics(); - emit newLyricsMessage( key, val ); + Q_EMIT newLyricsMessage( key, val ); } void LyricsEngine::clearLyrics() { m_fetching = false; - emit fetchingChanged(); + Q_EMIT fetchingChanged(); m_lyrics.clear(); - emit lyricsChanged(); + Q_EMIT lyricsChanged(); } qreal LyricsEngine::position() const @@ -197,36 +126,7 @@ if( !currentTrack ) return; - ScriptManager::instance()->notifyFetchLyrics( m_lyrics.artist, m_lyrics.title, "", currentTrack ); -} - -void LyricsEngine::refetchLyrics() -{ - DEBUG_BLOCK - - auto currentTrack = The::engineController()->currentTrack(); - - if( currentTrack ) - ScriptManager::instance()->notifyFetchLyrics( currentTrack->artist()->name(), - currentTrack->name(), "", currentTrack ); - - m_fetching = true; - emit fetchingChanged(); -} - -void LyricsEngine::fetchLyrics(const QString& artist, const QString& title, const QString& url) -{ - DEBUG_BLOCK - - if( !QUrl( url ).isValid() ) - return; - - debug() << "clicked suggestion" << url; - - ScriptManager::instance()->notifyFetchLyrics( artist, title, url, Meta::TrackPtr() ); - - m_fetching = true; - emit fetchingChanged(); + LyricsManager::instance()->loadLyrics( currentTrack, true ); } qreal LyricsEngine::fontSize() const @@ -242,7 +142,7 @@ return; Amarok::config( "Context" ).group( "Lyrics" ).writeEntry( "fontSize", fontSize ); - emit fontSizeChanged(); + Q_EMIT fontSizeChanged(); } int LyricsEngine::alignment() const @@ -258,7 +158,7 @@ return; Amarok::config( "Context" ).group( "Lyrics" ).writeEntry( "alignment", alignment ); - emit alignmentChanged(); + Q_EMIT alignmentChanged(); } QString LyricsEngine::font() const @@ -274,7 +174,7 @@ return; Amarok::config( "Context" ).group( "Lyrics" ).writeEntry( "font", font ); - emit fontChanged(); + Q_EMIT fontChanged(); } QStringList LyricsEngine::availableFonts() const diff --git a/src/context/applets/lyrics/plugin/LyricsPlugin.cpp b/src/context/applets/lyrics/plugin/LyricsPlugin.cpp --- a/src/context/applets/lyrics/plugin/LyricsPlugin.cpp +++ b/src/context/applets/lyrics/plugin/LyricsPlugin.cpp @@ -32,7 +32,7 @@ Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) public: - void registerTypes(const char* uri) Q_DECL_OVERRIDE + void registerTypes(const char* uri) override { Q_ASSERT(uri == QLatin1String("org.kde.amarok.lyrics")); diff --git a/src/context/applets/photos/CMakeLists.txt b/src/context/applets/photos/CMakeLists.txt --- a/src/context/applets/photos/CMakeLists.txt +++ b/src/context/applets/photos/CMakeLists.txt @@ -14,4 +14,4 @@ install(TARGETS amarok_context_applet_photos DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/amarok/photos) install(FILES plugin/qmldir DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/amarok/photos) -kpackage_install_package(package org.kde.amarok.photos amarok) +kpackage_install_bundled_package(package org.kde.amarok.photos amarok) diff --git a/images/icons/48-actions-photos-amarok.png b/src/context/applets/photos/package/contents/images/icon.png rename from images/icons/48-actions-photos-amarok.png rename to src/context/applets/photos/package/contents/images/icon.png index bbe1180e18ef74728e43fe5597866a98326eed85..bbe1180e18ef74728e43fe5597866a98326eed85 GIT binary patch literal 2729 zc$@*L3Rd-rP)P%Q>2{P)hMtMglhs+%Ry%z*iWZNr)VL z1yGYlr#D805EAfB7!qIh_yHTpDy7_f1_D4e5Ce3++}OYn&ZYG@p zArJxtc#rd|x8zrVDX$AAG4*`_Mc-E(P1DeI{XSq+2$9k!^+Nb+@cWJp(Q!7#_{Z-P z9?c>UIQl3~b`S-gu2hsWra1(AU4mnVx2dKZjK>|u%nWY#r${@=it=VOU1MxmN0)+- z)QJs+P*tTQs^erEmrpWPoLk$%+_5wY5C-(AP3-N`aW2gZ?+mf%NC$ThchMEjQZ~33 z7lo@J5sGsmdIvS1IB1qd7Cg*gkmjmtQju~lm>P-DVf+_&;t%R1wN~uomxz`axawx2 zy{mcqlO8%ME13;Xh#Kx(7GrY4(MpCEEW)fDrhd2w z!?Ku+p&Op+#x3r@(#lP7gOTz^bVD*fbb<0UO~fJw^Xq!Kvt=IXP!&RmSxHK7EjR~6 zUIIW$S}z}>lq)Fr3IP4{mlKNhQRbXLC>z@sWGcF@qe~5`1ewT10+pW;Z|$YOaS6Il zvT{K`V$Blf2UDb$)>HE78yG?%q@1bp5i&VuIiXZR#Y|vXru_5I40aiLO{lN9PB$meuii@MDA& zGnSOH$Vn_fc6MSLJ;coOjK`~p=v@Hxmn^|9gNXk$etn=|G8np!MB+$|z1kjLJkiRz zR6W6f&YCp?=rxs;*VN-Iy@iX1-(qbutPKv&$^e4G5}Fb}1R)(SWiZr)89$FeF%Vfq zICutx3&6N9_IdU1W#DAgC2Lr?jPREeKDty3%}pT!wO99B%+X87sJU6Ap|(F~t^z5< zj3p4oG9Xa8jZYuL2n}*vYvzKv9G}^bkP4a8f7}&(kg}(gkB;t@kfb7GQtQ?uHHkDF zUOXOVFguUN`WkwYft-OOv^QNL83|G1vuBk7A!cxy6OGHTH9v+i$cgbZ$Lt7xIfN}u zcBEI)IogFKGldz@bT0!9V_ANFVlAsiSL2VF#2X^KdhYAks*KIscd%mN0GUWN!;um$ zX@OamP@x08z)_@}q`#UWlDKYy#?#9glL@~!9~m&V(Olt=j})q)U`8B)B7y#|qjqt%ZwBI5+?Fy)sA89v@Z zGI`E>J>te#b$S7Lq!8pMkftQklOW*NS$FDoq7^ZGo3aGXlp!htn5A*T@mkF4TY0V9 zyzVB}0j8Q54K`tl2Pw(y1t8kpPigZ!0uC%c6hS(QJi1|c6DS{eUPjnYJfpF6OFiw| zZQgn?%y89NN-Gx=*4o*!GfbD`V-^WO6e}SCNC8p``pj=4qMblL0Luszk74@AS{Yj37$)jeQkxE9RWCq~n(RIVf9&Zl3!aq7p zXgot6R}=I`L-dvoP#V(ckBqT!R1z5tdS#@WK3wI}bFzm8sv0e5P_i<_l1PZx_A6f6 zQ-=`DfnrUZcPRw`ny;LaWg3|e4TNO@;Ak4jkcmov%tz)@+}va0S!%O~_0y$}@b;aH5XB5Y z!40sxYBe-EIF+CyY0?rbmLUuorrAElw+BAt@r%0&W(G)$6#J@n6SDkB1k5uD{dgGb zku&uD`!XAkHhFtqk0wxg$->|%7+*(YzvI-3Qfwue=e8jOCD^e94S{M}v=JKR1=1>u z<2Y29ey^Fc50}HAUF??q^uH0}sevjktC+XnT%}L|#m8u2t?6V|Zser)E_KFJR5V#+ z4hww4lFGzFlxvVoeMn<@IaQ@)^xqpG@XHG)~#l(jV zAiUDaAD-UxGiu^OG*T<>=Wk=peD<%WN%i+~>9!JLtB!KH*P?n~Es;`_MB54u-=-mU z`+54@Q&>s^4aBsOyC~NI*G4H9JSo(K0g)3@0SYGvkOiE=b70aKy%u_80hPD>gr0*h zbMja^SJz<-;nLXHz-P_BU@%*X{hlIgD}Wh{OO+2kC(Fx#QcgY+@Pd~BSeC_>En8k# zw{D$p+qP|Km171OC?s5WGh-DkT-v({U!(tvpCpxZW;`mDV}o)~%F4;k zX~GN&SLK6}NU4z=7(L%sQ`3Cr%$dVL>T^pdKSrm+x_pS%J02wxP`H5#Y8Kx`Dyuy6 zmJ*YHzj)2#qL^4+3pYK6<7B|GymE?#eLS$TntK+9TsJl7f9?;j{;Z>;o;^vyTlJgt@@e~g8$8r9zrR_(9jTrgM;+-^<{SKczgZk&6^J?r83jsg@l;4 zek;?5NhyaTr+bK&1hCK%reH1zFZz6=D_l2AYkd`f7yN|WJ$v>%@$9qDz5`^YKL>=E zwuzN%bES6#!x{$Q@9&)?x@0Y)YHkLkCUKQST$Qc7Mqb=hH92?=9z6K#jT<*^1-z+K z^eO?XYHf-3i zwJ`YN*XiPoC=LEMXb5x!E=tq5f0=1@cXy|D?%eskXP$ZHp9N(z69dcYbiOMkV$xVG zTqjffIi-{**LBHDDeqd4lZI_;_!Hx&tW-Aq`s=ShvT4(%kAQ5k-~q&hDu7$Emh}(E zw(**IO3+0O6h6-XoDbMrb3x}N>J(*RG!Y2|HT@IuHWP%Q>2{P)hMtMglhs+%Ry%z*iWZNr)VL z1yGYlr#D805EAfB7!qIh_yHTpDy7_f1_D4e5Ce3++}OYn&ZYG@p zArJxtc#rd|x8zrVDX$AAG4*`_Mc-E(P1DeI{XSq+2$9k!^+Nb+@cWJp(Q!7#_{Z-P z9?c>UIQl3~b`S-gu2hsWra1(AU4mnVx2dKZjK>|u%nWY#r${@=it=VOU1MxmN0)+- z)QJs+P*tTQs^erEmrpWPoLk$%+_5wY5C-(AP3-N`aW2gZ?+mf%NC$ThchMEjQZ~33 z7lo@J5sGsmdIvS1IB1qd7Cg*gkmjmtQju~lm>P-DVf+_&;t%R1wN~uomxz`axawx2 zy{mcqlO8%ME13;Xh#Kx(7GrY4(MpCEEW)fDrhd2w z!?Ku+p&Op+#x3r@(#lP7gOTz^bVD*fbb<0UO~fJw^Xq!Kvt=IXP!&RmSxHK7EjR~6 zUIIW$S}z}>lq)Fr3IP4{mlKNhQRbXLC>z@sWGcF@qe~5`1ewT10+pW;Z|$YOaS6Il zvT{K`V$Blf2UDb$)>HE78yG?%q@1bp5i&VuIiXZR#Y|vXru_5I40aiLO{lN9PB$meuii@MDA& zGnSOH$Vn_fc6MSLJ;coOjK`~p=v@Hxmn^|9gNXk$etn=|G8np!MB+$|z1kjLJkiRz zR6W6f&YCp?=rxs;*VN-Iy@iX1-(qbutPKv&$^e4G5}Fb}1R)(SWiZr)89$FeF%Vfq zICutx3&6N9_IdU1W#DAgC2Lr?jPREeKDty3%}pT!wO99B%+X87sJU6Ap|(F~t^z5< zj3p4oG9Xa8jZYuL2n}*vYvzKv9G}^bkP4a8f7}&(kg}(gkB;t@kfb7GQtQ?uHHkDF zUOXOVFguUN`WkwYft-OOv^QNL83|G1vuBk7A!cxy6OGHTH9v+i$cgbZ$Lt7xIfN}u zcBEI)IogFKGldz@bT0!9V_ANFVlAsiSL2VF#2X^KdhYAks*KIscd%mN0GUWN!;um$ zX@OamP@x08z)_@}q`#UWlDKYy#?#9glL@~!9~m&V(Olt=j})q)U`8B)B7y#|qjqt%ZwBI5+?Fy)sA89v@Z zGI`E>J>te#b$S7Lq!8pMkftQklOW*NS$FDoq7^ZGo3aGXlp!htn5A*T@mkF4TY0V9 zyzVB}0j8Q54K`tl2Pw(y1t8kpPigZ!0uC%c6hS(QJi1|c6DS{eUPjnYJfpF6OFiw| zZQgn?%y89NN-Gx=*4o*!GfbD`V-^WO6e}SCNC8p``pj=4qMblL0Luszk74@AS{Yj37$)jeQkxE9RWCq~n(RIVf9&Zl3!aq7p zXgot6R}=I`L-dvoP#V(ckBqT!R1z5tdS#@WK3wI}bFzm8sv0e5P_i<_l1PZx_A6f6 zQ-=`DfnrUZcPRw`ny;LaWg3|e4TNO@;Ak4jkcmov%tz)@+}va0S!%O~_0y$}@b;aH5XB5Y z!40sxYBe-EIF+CyY0?rbmLUuorrAElw+BAt@r%0&W(G)$6#J@n6SDkB1k5uD{dgGb zku&uD`!XAkHhFtqk0wxg$->|%7+*(YzvI-3Qfwue=e8jOCD^e94S{M}v=JKR1=1>u z<2Y29ey^Fc50}HAUF??q^uH0}sevjktC+XnT%}L|#m8u2t?6V|Zser)E_KFJR5V#+ z4hww4lFGzFlxvVoeMn<@IaQ@)^xqpG@XHG)~#l(jV zAiUDaAD-UxGiu^OG*T<>=Wk=peD<%WN%i+~>9!JLtB!KH*P?n~Es;`_MB54u-=-mU z`+54@Q&>s^4aBsOyC~NI*G4H9JSo(K0g)3@0SYGvkOiE=b70aKy%u_80hPD>gr0*h zbMja^SJz<-;nLXHz-P_BU@%*X{hlIgD}Wh{OO+2kC(Fx#QcgY+@Pd~BSeC_>En8k# zw{D$p+qP|Km171OC?s5WGh-DkT-v({U!(tvpCpxZW;`mDV}o)~%F4;k zX~GN&SLK6}NU4z=7(L%sQ`3Cr%$dVL>T^pdKSrm+x_pS%J02wxP`H5#Y8Kx`Dyuy6 zmJ*YHzj)2#qL^4+3pYK6<7B|GymE?#eLS$TntK+9TsJl7f9?;j{;Z>;o;^vyTlJgt@@e~g8$8r9zrR_(9jTrgM;+-^<{SKczgZk&6^J?r83jsg@l;4 zek;?5NhyaTr+bK&1hCK%reH1zFZz6=D_l2AYkd`f7yN|WJ$v>%@$9qDz5`^YKL>=E zwuzN%bES6#!x{$Q@9&)?x@0Y)YHkLkCUKQST$Qc7Mqb=hH92?=9z6K#jT<*^1-z+K z^eO?XYHf-3i zwJ`YN*XiPoC=LEMXb5x!E=tq5f0=1@cXy|D?%eskXP$ZHp9N(z69dcYbiOMkV$xVG zTqjffIi-{**LBHDDeqd4lZI_;_!Hx&tW-Aq`s=ShvT4(%kAQ5k-~q&hDu7$Emh}(E zw(**IO3+0O6h6-XoDbMrb3x}N>J(*RG!Y2|HT@IuHW photoUrls() const; QList pageUrls() const; @@ -73,7 +73,7 @@ QString error() const { return m_error; } QString artist() const { return m_artist; } -signals: +Q_SIGNALS: void fetchSizeChanged(); void keywordsChanged(); void photosChanged(); @@ -90,10 +90,10 @@ * http://api.flickr.com/services/rest/?method=flickr.photos.search&api_key=9c5a288116c34c17ecee37877397fe31&text=My+Bloody+Valentine * see here for details: http://www.flickr.com/services/api/ */ - void resultFlickr( const QUrl &url, QByteArray data, NetworkAccessManagerProxy::Error e ); + void resultFlickr(const QUrl &url, const QByteArray &data, const NetworkAccessManagerProxy::Error &e ); void stopped(); - void trackChanged( Meta::TrackPtr track ); + void trackChanged( const Meta::TrackPtr &track ); private: struct PhotoInfo diff --git a/src/context/applets/photos/plugin/PhotosEngine.cpp b/src/context/applets/photos/plugin/PhotosEngine.cpp --- a/src/context/applets/photos/plugin/PhotosEngine.cpp +++ b/src/context/applets/photos/plugin/PhotosEngine.cpp @@ -55,7 +55,7 @@ } void -PhotosEngine::trackChanged( Meta::TrackPtr track ) +PhotosEngine::trackChanged( const Meta::TrackPtr &track ) { if( !track ) return; @@ -88,11 +88,11 @@ return; m_keywords = keywords; - emit keywordsChanged(); + Q_EMIT keywordsChanged(); } void -PhotosEngine::metadataChanged( Meta::TrackPtr track ) +PhotosEngine::metadataChanged(const Meta::TrackPtr &track ) { const bool hasChanged = !track->artist() || track->artist()->name() != m_artist; if ( hasChanged ) @@ -102,7 +102,6 @@ void PhotosEngine::update( bool force ) { - QString tmpYoutStr; // prevent Meta::TrackPtr currentTrack = The::engineController()->currentTrack(); if( !currentTrack || !currentTrack->artist() ) @@ -162,14 +161,13 @@ debug() << "Flickr url:" << flickrUrl; m_flickrUrls << flickrUrl; - The::networkAccessManager()->getData( flickrUrl, this, - SLOT(resultFlickr(QUrl,QByteArray,NetworkAccessManagerProxy::Error)) ); + The::networkAccessManager()->getData( flickrUrl, this, &PhotosEngine::resultFlickr ); } } void -PhotosEngine::resultFlickr( const QUrl &url, QByteArray data, NetworkAccessManagerProxy::Error e ) +PhotosEngine::resultFlickr(const QUrl &url, const QByteArray &data, const NetworkAccessManagerProxy::Error &e ) { if( !m_flickrUrls.contains( url ) ) return; @@ -221,13 +219,13 @@ QUrl photoUrl; photoUrl.setScheme( "http" ); - photoUrl.setHost( QString("farm%1.static.flickr.com").arg( farm.toString() ) ); - photoUrl.setPath( QString("/%1/%2_%3.jpg").arg( server.toString(), id.toString(), secret.toString() ) ); + photoUrl.setHost( QStringLiteral("farm%1.static.flickr.com").arg( farm.toString() ) ); + photoUrl.setPath( QStringLiteral("/%1/%2_%3.jpg").arg( server.toString(), id.toString(), secret.toString() ) ); QUrl pageUrl; pageUrl.setScheme( "http" ); pageUrl.setHost( QLatin1String("www.flickr.com") ); - pageUrl.setPath( QString("/photos/%1/%2").arg( owner.toString(), id.toString() ) ); + pageUrl.setPath( QStringLiteral("/photos/%1/%2").arg( owner.toString(), id.toString() ) ); PhotoInfo info; info.title = title.toString(); @@ -247,7 +245,7 @@ return; m_photos = photos; - emit photosChanged(); + Q_EMIT photosChanged(); } void @@ -257,7 +255,7 @@ return; m_status = status; - emit statusChanged(); + Q_EMIT statusChanged(); } void @@ -267,7 +265,7 @@ return; m_error = error; - emit errorChanged(); + Q_EMIT errorChanged(); } void @@ -277,7 +275,7 @@ return; m_artist = artist; - emit artistChanged(); + Q_EMIT artistChanged(); } QList diff --git a/src/context/applets/photos/plugin/PhotosPlugin.cpp b/src/context/applets/photos/plugin/PhotosPlugin.cpp --- a/src/context/applets/photos/plugin/PhotosPlugin.cpp +++ b/src/context/applets/photos/plugin/PhotosPlugin.cpp @@ -32,7 +32,7 @@ Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) public: - void registerTypes(const char* uri) Q_DECL_OVERRIDE + void registerTypes(const char* uri) override { Q_ASSERT(uri == QLatin1String("org.kde.amarok.photos")); diff --git a/src/context/applets/playlistinfo/CMakeLists.txt b/src/context/applets/playlistinfo/CMakeLists.txt --- a/src/context/applets/playlistinfo/CMakeLists.txt +++ b/src/context/applets/playlistinfo/CMakeLists.txt @@ -12,6 +12,6 @@ KF5::Plasma ) -install(TARGETS amarok_context_applet_currenttrack DESTINATION ${PLUGIN_INSTALL_DIR}) -install(FILES amarok-context-applet-currenttrack.desktop DESTINATION ${SERVICES_INSTALL_DIR}) -install(FILES amarok-currenttrack.svg DESTINATION ${DATA_INSTALL_DIR}/desktoptheme/default/widgets/ ) +install(TARGETS amarok_context_applet_currenttrack DESTINATION ${KDE_INSTALL_PLUGINDIR}) +install(FILES amarok-context-applet-currenttrack.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}) +install(FILES amarok-currenttrack.svg DESTINATION ${KDE_INSTALL_DATADIR}/desktoptheme/default/widgets/ ) diff --git a/src/context/applets/playlistinfo/PlaylistInfo.h b/src/context/applets/playlistinfo/PlaylistInfo.h --- a/src/context/applets/playlistinfo/PlaylistInfo.h +++ b/src/context/applets/playlistinfo/PlaylistInfo.h @@ -25,10 +25,8 @@ #include class QGraphicsPixmapItem; -class QLabel; class QHBoxLayout; class QSpinBox; -class QCheckBox; class PlaylistInfo : public Context::Applet { diff --git a/src/context/applets/playlistinfo/amarok-context-applet-playlistinfo.desktop b/src/context/applets/playlistinfo/amarok-context-applet-playlistinfo.desktop --- a/src/context/applets/playlistinfo/amarok-context-applet-playlistinfo.desktop +++ b/src/context/applets/playlistinfo/amarok-context-applet-playlistinfo.desktop @@ -22,7 +22,7 @@ Name[he]=מידע על רשימת־ההשמעה Name[hne]=गीतसूची जानकारी Name[hu]=Lejátszólista-információ -Name[id]=Informasi Daftar Main +Name[id]=Informasi Playlist Name[is]=Upplýsingar um lagalista Name[it]=Informazioni sulla scaletta Name[ja]=プレイリスト情報 @@ -53,7 +53,6 @@ Name[uk]=Інформація про список композицій Name[wa]=Pondants et djondants del djivêye a djouwer Name[x-test]=xxPlaylist Informationxx -Name[zh_CN]=播放列表信息 Name[zh_TW]=播放清單資訊 Type=Service ServiceTypes=Plasma/Applet diff --git a/src/context/applets/similarartists/ArtistWidget.h b/src/context/applets/similarartists/ArtistWidget.h --- a/src/context/applets/similarartists/ArtistWidget.h +++ b/src/context/applets/similarartists/ArtistWidget.h @@ -51,10 +51,12 @@ public: /** * ArtistWidget constructor + * @param artist The pointer to the artist item * @param parent The widget parent + * @param wFlags The Qt::WindowFlags */ - ArtistWidget( const SimilarArtistPtr &artist, - QGraphicsWidget *parent = 0, Qt::WindowFlags wFlags = 0 ); + explicit ArtistWidget( const SimilarArtistPtr &artist, + QGraphicsWidget *parent = nullptr, Qt::WindowFlags wFlags = 0 ); /** * ArtistWidget destructor @@ -119,7 +121,7 @@ void setBioSummary( const QString &bio ); /** - * Set arist tags + * Set artist tags */ void setTags(); @@ -174,12 +176,12 @@ Plasma::PushButton *m_topTrackButton; /** - * Button to add the last.fm simmilar artist station for this artist to the playlist + * Button to add the last.fm similar artist station for this artist to the playlist */ Plasma::PushButton *m_lastfmStationButton; /** - * Button to navigate to the artit in the local collection + * Button to navigate to the artist in the local collection */ Plasma::PushButton *m_navigateButton; @@ -273,7 +275,7 @@ Q_PROPERTY( QString name READ name WRITE setName ) public: - explicit ArtistsListWidget( QGraphicsWidget *parent = 0 ); + explicit ArtistsListWidget( QGraphicsWidget *parent = nullptr ); ~ArtistsListWidget(); int count() const; diff --git a/src/context/applets/similarartists/ArtistWidget.cpp b/src/context/applets/similarartists/ArtistWidget.cpp --- a/src/context/applets/similarartists/ArtistWidget.cpp +++ b/src/context/applets/similarartists/ArtistWidget.cpp @@ -161,7 +161,7 @@ { m_urlButton = new Plasma::PushButton( this ); m_urlButton->setMaximumSize( QSizeF( 22, 22 ) ); - m_urlButton->setIcon( QIcon::fromTheme("applications-internet") ); + m_urlButton->setIcon( QIcon::fromTheme("internet-services") ); m_urlButton->setToolTip( i18n( "Open Last.fm webpage for this artist" ) ); connect( m_urlButton, SIGNAL(clicked()), this, SLOT(openArtistUrl()) ); buttonsLayout->addItem( m_urlButton ); @@ -237,7 +237,7 @@ void ArtistWidget::fetchInfo() { - // we genere the url for the demand on the lastFM Api + // we generate the url for the demand on the lastFM Api QUrl url; url.setScheme( "http" ); url.setHost( "ws.audioscrobbler.com" ); @@ -253,7 +253,7 @@ void ArtistWidget::fetchTopTrack() { - // we genere the url for the demand on the lastFM Api + // we generate the url for the demand on the lastFM Api QUrl url; url.setScheme( "http" ); url.setHost( "ws.audioscrobbler.com" ); diff --git a/src/context/applets/similarartists/CMakeLists.txt b/src/context/applets/similarartists/CMakeLists.txt --- a/src/context/applets/similarartists/CMakeLists.txt +++ b/src/context/applets/similarartists/CMakeLists.txt @@ -20,5 +20,5 @@ ) -install(TARGETS amarok_context_applet_similarArtists DESTINATION ${PLUGIN_INSTALL_DIR}) -install(FILES amarok-context-applet-similarArtists.desktop DESTINATION ${SERVICES_INSTALL_DIR}) +install(TARGETS amarok_context_applet_similarArtists DESTINATION ${KDE_INSTALL_PLUGINDIR}) +install(FILES amarok-context-applet-similarArtists.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}) diff --git a/src/context/applets/similarartists/SimilarArtist.h b/src/context/applets/similarartists/SimilarArtist.h --- a/src/context/applets/similarartists/SimilarArtist.h +++ b/src/context/applets/similarartists/SimilarArtist.h @@ -47,7 +47,7 @@ /** * Create a similar artist with data * @param name The name of this similar artist - * @param match The match pourcent (between 0 and 100) of the similarity + * @param match The match percent (between 0 and 100) of the similarity * between this artist and the artist similarTo * @param url A url of this artist on the web, for example on last.fm * @param urlImage A url of an image of this artist, for example on last.fm @@ -64,7 +64,7 @@ QString name() const; /** - * @return the pourcent of match of this artist, betwwen 0 and 100 + * @return the percent of match of this artist, between 0 and 100 */ int match() const; diff --git a/src/context/applets/similarartists/amarok-context-applet-similarArtists.desktop b/src/context/applets/similarartists/amarok-context-applet-similarArtists.desktop --- a/src/context/applets/similarartists/amarok-context-applet-similarArtists.desktop +++ b/src/context/applets/similarartists/amarok-context-applet-similarArtists.desktop @@ -45,7 +45,6 @@ Name[tr]=Benzer Sanatçılar Name[uk]=Подібні виконавці Name[x-test]=xxSimilar Artistsxx -Name[zh_CN]=相似艺人 Name[zh_TW]=相似的演出者 Type=Service ServiceTypes=Plasma/Applet diff --git a/src/context/applets/songkick/CMakeLists.txt b/src/context/applets/songkick/CMakeLists.txt --- a/src/context/applets/songkick/CMakeLists.txt +++ b/src/context/applets/songkick/CMakeLists.txt @@ -11,5 +11,5 @@ endif() target_link_libraries(amarok_context_applet_songkick amarokcore amaroklib KF5::Plasma KF5::KIOCore) -install(TARGETS amarok_context_applet_songkick DESTINATION ${PLUGIN_INSTALL_DIR}) -install(FILES amarok-context-applet-songkick.desktop DESTINATION ${SERVICES_INSTALL_DIR}) +install(TARGETS amarok_context_applet_songkick DESTINATION ${KDE_INSTALL_PLUGINDIR}) +install(FILES amarok-context-applet-songkick.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}) diff --git a/src/context/applets/songkick/amarok-context-applet-songkick.desktop b/src/context/applets/songkick/amarok-context-applet-songkick.desktop --- a/src/context/applets/songkick/amarok-context-applet-songkick.desktop +++ b/src/context/applets/songkick/amarok-context-applet-songkick.desktop @@ -50,7 +50,6 @@ Name[uk]=Songkick Name[wa]=Songkick Name[x-test]=xxSongkickxx -Name[zh_CN]=Songkick Name[zh_TW]=Songkick Type=Service ServiceTypes=Plasma/Applet diff --git a/src/context/applets/tabs/CMakeLists.txt b/src/context/applets/tabs/CMakeLists.txt --- a/src/context/applets/tabs/CMakeLists.txt +++ b/src/context/applets/tabs/CMakeLists.txt @@ -12,9 +12,9 @@ KF5::KIOCore ) -install( TARGETS amarok_context_applet_tabs DESTINATION ${PLUGIN_INSTALL_DIR} ) -install( FILES amarok-context-applet-tabs.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) -install( FILES amarok-tabs-guitar.png DESTINATION ${DATA_INSTALL_DIR}/amarok/images/ ) -install( FILES amarok-tabs-bass.png DESTINATION ${DATA_INSTALL_DIR}/amarok/images/ ) -install( FILES amarok-tabs-drum.png DESTINATION ${DATA_INSTALL_DIR}/amarok/images/ ) -install( FILES amarok-tabs-piano.png DESTINATION ${DATA_INSTALL_DIR}/amarok/images/ ) +install( TARGETS amarok_context_applet_tabs DESTINATION ${KDE_INSTALL_PLUGINDIR} ) +install( FILES amarok-context-applet-tabs.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR} ) +install( FILES amarok-tabs-guitar.png DESTINATION ${KDE_INSTALL_DATADIR}/amarok/images/ ) +install( FILES amarok-tabs-bass.png DESTINATION ${KDE_INSTALL_DATADIR}/amarok/images/ ) +install( FILES amarok-tabs-drum.png DESTINATION ${KDE_INSTALL_DATADIR}/amarok/images/ ) +install( FILES amarok-tabs-piano.png DESTINATION ${KDE_INSTALL_DATADIR}/amarok/images/ ) diff --git a/src/context/applets/tabs/TabsApplet.h b/src/context/applets/tabs/TabsApplet.h --- a/src/context/applets/tabs/TabsApplet.h +++ b/src/context/applets/tabs/TabsApplet.h @@ -34,7 +34,6 @@ namespace Plasma { class IconWidget; - class Label; } class KConfigDialog; diff --git a/src/context/applets/tabs/TabsView.h b/src/context/applets/tabs/TabsView.h --- a/src/context/applets/tabs/TabsView.h +++ b/src/context/applets/tabs/TabsView.h @@ -35,7 +35,7 @@ Q_OBJECT public: - explicit TabsView( QGraphicsWidget *parent = 0 ); + explicit TabsView( QGraphicsWidget *parent = nullptr ); ~TabsView(); void appendTab( TabsItem *tabsItem ); diff --git a/src/context/applets/tabs/amarok-context-applet-tabs.desktop b/src/context/applets/tabs/amarok-context-applet-tabs.desktop --- a/src/context/applets/tabs/amarok-context-applet-tabs.desktop +++ b/src/context/applets/tabs/amarok-context-applet-tabs.desktop @@ -17,13 +17,14 @@ Name[fi]=Tabulatuurit Name[fr]=Tablatures Name[ga]=Cluaisíní -Name[gl]=Tablaturas +Name[gl]=Tabulaturas Name[hu]=Tabok Name[ia]=Schedas Name[id]=Tab Name[it]=Tablature Name[ja]=タブ Name[km]=ផ្ទាំង +Name[ko]=Tabs Name[lt]=Kortelės Name[lv]=Cilnes Name[mr]=टॅब्स @@ -47,7 +48,7 @@ Name[ug]=بەتكۈچلەر Name[uk]=Акорди Name[x-test]=xxTabsxx -Name[zh_CN]=吉他谱 +Name[zh_CN]=标签页 Name[zh_TW]=Tabs Type=Service Icon=filename-genre-amarok diff --git a/src/context/applets/upcomingevents/CMakeLists.txt b/src/context/applets/upcomingevents/CMakeLists.txt --- a/src/context/applets/upcomingevents/CMakeLists.txt +++ b/src/context/applets/upcomingevents/CMakeLists.txt @@ -36,6 +36,6 @@ Qt5::WebKitWidgets ) -install(TARGETS amarok_context_applet_upcomingEvents DESTINATION ${PLUGIN_INSTALL_DIR}) -install(FILES amarok-context-applet-upcomingEvents.desktop DESTINATION ${SERVICES_INSTALL_DIR}) -install(FILES upcoming-events-map.html DESTINATION ${DATA_INSTALL_DIR}/amarok/data) +install(TARGETS amarok_context_applet_upcomingEvents DESTINATION ${KDE_INSTALL_PLUGINDIR}) +install(FILES amarok-context-applet-upcomingEvents.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}) +install(FILES upcoming-events-map.html DESTINATION ${KDE_INSTALL_DATADIR}/amarok/data) diff --git a/src/context/applets/upcomingevents/LastFmEventXmlParser.h b/src/context/applets/upcomingevents/LastFmEventXmlParser.h --- a/src/context/applets/upcomingevents/LastFmEventXmlParser.h +++ b/src/context/applets/upcomingevents/LastFmEventXmlParser.h @@ -25,7 +25,7 @@ class LastFmEventXmlParser { public: - LastFmEventXmlParser( QXmlStreamReader &reader ); + explicit LastFmEventXmlParser( QXmlStreamReader &reader ); ~LastFmEventXmlParser(); bool read(); @@ -44,7 +44,7 @@ class LastFmVenueXmlParser { public: - LastFmVenueXmlParser( QXmlStreamReader &reader ); + explicit LastFmVenueXmlParser( QXmlStreamReader &reader ); ~LastFmVenueXmlParser(); bool read(); @@ -60,7 +60,7 @@ class LastFmLocationXmlParser { public: - LastFmLocationXmlParser( QXmlStreamReader &reader ); + explicit LastFmLocationXmlParser( QXmlStreamReader &reader ); ~LastFmLocationXmlParser(); bool read(); diff --git a/src/context/applets/upcomingevents/UpcomingEventsApplet.h b/src/context/applets/upcomingevents/UpcomingEventsApplet.h --- a/src/context/applets/upcomingevents/UpcomingEventsApplet.h +++ b/src/context/applets/upcomingevents/UpcomingEventsApplet.h @@ -28,16 +28,13 @@ #include "ui_upcomingEventsVenueSettings.h" class KConfigDialog; -class QGraphicsLinearLayout; class QListWidgetItem; -class QXmlStreamReader; class UpcomingEventsMapWidget; class UpcomingEventsStackItem; class UpcomingEventsStack; namespace Plasma { - class WebView; } /** @@ -68,7 +65,7 @@ * * This method is called when the interface should be painted * - * \param painter : the QPainter to use to do the paintiner + * \param painter : the QPainter to use to do the paint * \param option : the style options object * \param contentsRect : the rect to paint within; automatically adjusted for * the background, if any diff --git a/src/context/applets/upcomingevents/UpcomingEventsCalendarWidget.h b/src/context/applets/upcomingevents/UpcomingEventsCalendarWidget.h --- a/src/context/applets/upcomingevents/UpcomingEventsCalendarWidget.h +++ b/src/context/applets/upcomingevents/UpcomingEventsCalendarWidget.h @@ -30,7 +30,7 @@ Q_PROPERTY( QAction* todayAction READ todayAction ) public: - UpcomingEventsCalendarWidget( QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0 ); + explicit UpcomingEventsCalendarWidget( QGraphicsItem *parent = nullptr, Qt::WindowFlags wFlags = 0 ); ~UpcomingEventsCalendarWidget(); void clear(); diff --git a/src/context/applets/upcomingevents/UpcomingEventsMapWidget.h b/src/context/applets/upcomingevents/UpcomingEventsMapWidget.h --- a/src/context/applets/upcomingevents/UpcomingEventsMapWidget.h +++ b/src/context/applets/upcomingevents/UpcomingEventsMapWidget.h @@ -33,7 +33,7 @@ Q_PROPERTY( LastFmEvent::List events READ events ) public: - UpcomingEventsMapWidget( QGraphicsItem *parent = 0 ); + explicit UpcomingEventsMapWidget( QGraphicsItem *parent = nullptr ); ~UpcomingEventsMapWidget(); bool isLoaded() const; diff --git a/src/context/applets/upcomingevents/UpcomingEventsStack.h b/src/context/applets/upcomingevents/UpcomingEventsStack.h --- a/src/context/applets/upcomingevents/UpcomingEventsStack.h +++ b/src/context/applets/upcomingevents/UpcomingEventsStack.h @@ -30,7 +30,7 @@ Q_PROPERTY( bool empty READ isEmpty ) public: - explicit UpcomingEventsStack( QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0 ); + explicit UpcomingEventsStack( QGraphicsItem *parent = nullptr, Qt::WindowFlags wFlags = 0 ); ~UpcomingEventsStack(); int count() const; ///< number of list widgets in the stack widget diff --git a/src/context/applets/upcomingevents/UpcomingEventsStackItem.h b/src/context/applets/upcomingevents/UpcomingEventsStackItem.h --- a/src/context/applets/upcomingevents/UpcomingEventsStackItem.h +++ b/src/context/applets/upcomingevents/UpcomingEventsStackItem.h @@ -78,6 +78,7 @@ /** * Adds custom actions to appear in the drag handle. + * @param name the given name in our collection * @param action the action to add. Actions will be displayed as an icon in the drag * handle. */ diff --git a/src/context/applets/upcomingevents/UpcomingEventsWidget.h b/src/context/applets/upcomingevents/UpcomingEventsWidget.h --- a/src/context/applets/upcomingevents/UpcomingEventsWidget.h +++ b/src/context/applets/upcomingevents/UpcomingEventsWidget.h @@ -30,8 +30,6 @@ class QLabel; class QGraphicsLinearLayout; class QGraphicsProxyWidget; -class QPixmap; -class QPointF; class QSignalMapper; namespace Plasma { class Label; @@ -45,10 +43,12 @@ public: /** * UpcomingEventsWidget constructor - * @param QGraphicsWidget*, like QGraphicsWidget constructor + * @param event the pointer to event + * @param parent like QGraphicsWidget constructor + * @param wFlags the Qt::WindowFlags */ - UpcomingEventsWidget( const LastFmEventPtr &event, - QGraphicsItem *parent = 0, + explicit UpcomingEventsWidget( const LastFmEventPtr &event, + QGraphicsItem *parent = nullptr, Qt::WindowFlags wFlags = 0 ); ~UpcomingEventsWidget(); @@ -59,8 +59,8 @@ { return m_event; } /** - *Set the event's image in Plasma::Label from an url - *@param QUrl, image's url to be displayed + * Set the event's image in Plasma::Label from an url + * @param url image's url to be displayed */ void setImage( const QUrl &url ); @@ -72,25 +72,25 @@ /** *Set the event's participants text in Plasma::Label from a QString - *@param QString, participant's text to be displayed + *@param participants participants text to be displayed */ void setParticipants( const QStringList &participants ); /** *Set the event's date in Plasma::Label from a KDateTime - *@param KDateTime, date to be displayed + *@param date date to be displayed */ void setDate( const KDateTime &date ); /** *Set the event's name in Plasma::Label from a QString - *@param QString, name's text to be displayed + *@param name name's text to be displayed */ void setName( const QString &name ); /** *Set the event's location in a Plasma::Label from a QString - *@param QString, location's text to be displayed + *@param location location's text to be displayed */ void setLocation( const LastFmLocationPtr &location ); @@ -102,7 +102,7 @@ /** *Set the event's url in Plasma::Label from a QUrl - *@param QUrl, url to be displayed + *@param url url to be displayed */ void setUrl( const QUrl &url ); @@ -145,7 +145,7 @@ Q_PROPERTY( LastFmEvent::List events READ events ) public: - explicit UpcomingEventsListWidget( QGraphicsWidget *parent = 0 ); + explicit UpcomingEventsListWidget( QGraphicsWidget *parent = nullptr ); ~UpcomingEventsListWidget(); int count() const; diff --git a/src/context/applets/upcomingevents/UpcomingEventsWidget.cpp b/src/context/applets/upcomingevents/UpcomingEventsWidget.cpp --- a/src/context/applets/upcomingevents/UpcomingEventsWidget.cpp +++ b/src/context/applets/upcomingevents/UpcomingEventsWidget.cpp @@ -84,15 +84,15 @@ { m_urlButton = new Plasma::PushButton( this ); m_urlButton->setMaximumSize( QSizeF( 22, 22 ) ); - m_urlButton->setIcon( QIcon::fromTheme("applications-internet") ); + m_urlButton->setIcon( QIcon::fromTheme("internet-services") ); m_urlButton->setToolTip( i18n( "Open Last.fm webpage for this event" ) ); connect( m_urlButton, SIGNAL(clicked()), this, SLOT(openUrl()) ); buttonsLayout->addItem( m_urlButton ); } QSizePolicy::Policy minPol = QSizePolicy::Minimum; QGraphicsWidget *supportLabel, *venueLabel, *locationLabel, *dateLabel, *attendLabel, *tagsLabel; - supportLabel = createLabel( i18nc("@label:textbox Supporing acts for an event", "Supporting:"), minPol ); + supportLabel = createLabel( i18nc("@label:textbox Supporting acts for an event", "Supporting:"), minPol ); venueLabel = createLabel( i18nc("@label:textbox", "Venue:"), minPol ); locationLabel = createLabel( i18nc("@label:textbox", "Location:"), minPol ); dateLabel = createLabel( i18nc("@label:textbox", "Date:"), minPol ); diff --git a/src/context/applets/upcomingevents/amarok-context-applet-upcomingEvents.desktop b/src/context/applets/upcomingevents/amarok-context-applet-upcomingEvents.desktop --- a/src/context/applets/upcomingevents/amarok-context-applet-upcomingEvents.desktop +++ b/src/context/applets/upcomingevents/amarok-context-applet-upcomingEvents.desktop @@ -23,7 +23,7 @@ Name[it]=Prossimi eventi Name[ja]=近日中のイベント Name[km]=ព្រឹត្តិការណ៍​ដែល​នឹង​កើត​មាន​ឡើង -Name[ko]=다가오는 약속 +Name[ko]=곧 있을 이벤트 Name[lt]=Artimiausi įvykiai Name[lv]=Tuvākie notikumi Name[mr]=पुढे येणाऱ्या घटना diff --git a/src/context/applets/wikipedia/CMakeLists.txt b/src/context/applets/wikipedia/CMakeLists.txt --- a/src/context/applets/wikipedia/CMakeLists.txt +++ b/src/context/applets/wikipedia/CMakeLists.txt @@ -14,6 +14,6 @@ install(TARGETS amarok_context_applet_wikipedia DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/amarok/wikipedia) install(FILES plugin/qmldir DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/amarok/wikipedia) -install(FILES WikipediaCustomStyle.css bullet.gif DESTINATION ${DATA_INSTALL_DIR}/amarok/data ) +install(FILES WikipediaCustomStyle.css bullet.gif DESTINATION ${KDE_INSTALL_DATADIR}/amarok/data ) -kpackage_install_package(package org.kde.amarok.wikipedia amarok) +kpackage_install_bundled_package(package org.kde.amarok.wikipedia amarok) diff --git a/src/context/applets/wikipedia/WikipediaCustomStyle.css b/src/context/applets/wikipedia/WikipediaCustomStyle.css --- a/src/context/applets/wikipedia/WikipediaCustomStyle.css +++ b/src/context/applets/wikipedia/WikipediaCustomStyle.css @@ -4,13 +4,13 @@ { margin: 0px; padding: 6px 2px; + background-color: /*{background_color}*/; color: /*{text_color}*/; font-size: medium; } h1, h2, h3, h4, h5, h6 { - border: 2px solid /*{border_color}*/; -webkit-border-radius: 4px; -khtml-border-radius: 4px; -moz-border-radius: 4px; @@ -50,7 +50,6 @@ div#wiki_otherlangs { clear: both; - border: 2px solid /*{border_color}*/; -webkit-border-radius: 4px; -khtml-border-radius: 4px; -moz-border-radius: 4px; @@ -97,8 +96,6 @@ /* table for embedded media clip boxes */ table.metadata, table.ambox { - border-radius: 1.6em; - border: 2px solid /*{border_color}*/; -webkit-border-radius: 4px; -khtml-border-radius: 4px; -moz-border-radius: 4px; @@ -115,7 +112,6 @@ clear: right; float: right; width: 150pt; - border: 2px solid /*{border_color}*/; -webkit-border-radius: 4px; -khtml-border-radius: 4px; -moz-border-radius: 4px; @@ -134,16 +130,14 @@ table.infobox th { padding: 2pt; - border: 1px solid /*{border_color}*/; background-color: /*{alternate_table_background_color}*/; color: /*{text_color}*/; } table.gallery { clear: both; display: block; - border: 2px solid /*{border_color}*/; -webkit-border-radius: 4px; -khtml-border-radius: 4px; -moz-border-radius: 4px; @@ -217,7 +211,6 @@ { clear: right; background-color: /*{shaded_text_background_color}*/; - border: 2px solid /*{border_color}*/; border-radius: 4px; -webkit-border-radius: 4px; -khtml-border-radius: 4px; @@ -232,7 +225,6 @@ table.wikitable { - border: 2px solid /*{border_color}*/; -webkit-border-radius: 4px; -khtml-border-radius: 4px; -moz-border-radius: 4px; @@ -245,18 +237,15 @@ { padding: 2pt; background-color: /*{alternate_table_background_color}*/; - border: 2px solid /*{border_color}*/; } table.wikitable td { padding: 2pt; background-color: /*{table_background_color}*/; - border: 2px solid /*{border_color}*/; } table.navbox { - border: 2px solid /*{border_color}*/; -webkit-border-radius: 4px; -khtml-border-radius: 4px; -moz-border-radius: 4px; @@ -268,14 +257,12 @@ } table.navbox td { - border: 2px solid /*{border_color}*/; background-color: /*{table_background_color}*/; } /* article thumbnail images */ div.thumb { - border: 2px solid /*{border_color}*/; -webkit-border-radius: 4px; -khtml-border-radius: 4px; -moz-border-radius: 4px; diff --git a/src/context/applets/wikipedia/package/contents/images/amarok-wikipedia.svg b/src/context/applets/wikipedia/package/contents/images/amarok-wikipedia.svg deleted file mode 100644 --- a/src/context/applets/wikipedia/package/contents/images/amarok-wikipedia.svg +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - image/svg+xml - - - - image/svg+xml - - - - - - - - - - - diff --git a/src/context/applets/wikipedia/package/contents/images/icon.svg b/src/context/applets/wikipedia/package/contents/images/icon.svg new file mode 100644 --- /dev/null +++ b/src/context/applets/wikipedia/package/contents/images/icon.svg @@ -0,0 +1 @@ +]>Wikipedia logo version 2 \ No newline at end of file diff --git a/src/context/applets/wikipedia/package/contents/ui/main.qml b/src/context/applets/wikipedia/package/contents/ui/main.qml --- a/src/context/applets/wikipedia/package/contents/ui/main.qml +++ b/src/context/applets/wikipedia/package/contents/ui/main.qml @@ -17,104 +17,101 @@ import QtQuick 2.4 import QtQuick.Controls 1.4 import QtQuick.Layouts 1.3 -import QtWebEngine 1.1 +import QtWebEngine 1.3 import org.kde.amarok.qml 1.0 as AmarokQml import org.kde.amarok.wikipedia 1.0 AmarokQml.Applet { id: applet - RowLayout { - id: buttonRow + ColumnLayout { + anchors.fill: parent - anchors.top: parent.top - width: parent.width + RowLayout { + Layout.fillWidth: true + Layout.alignment: Qt.AlignTop - Button { - iconName: "go-previous" - enabled: content.canGoBack - Layout.alignment: Qt.AlignLeft - ToolTip.text: i18n("Previous") + Button { + iconName: "go-previous" + enabled: content.canGoBack + Layout.alignment: Qt.AlignLeft + tooltip: i18n("Previous") - onClicked: content.goBack() - } - Button { - iconName: "go-next" - enabled: content.canGoForward - Layout.alignment: Qt.AlignLeft - ToolTip.text: i18n("Next") + onClicked: content.goBack() + } + Button { + iconName: "go-next" + enabled: content.canGoForward + Layout.alignment: Qt.AlignLeft + tooltip: i18n("Next") - onClicked: content.goForward() - } - Button { - iconName: "view-refresh" - enabled: !content.loading - Layout.alignment: Qt.AlignLeft - ToolTip.text: i18n("Refresh") + onClicked: content.goForward() + } + Button { + iconName: "view-refresh" + enabled: !content.loading + Layout.alignment: Qt.AlignLeft + tooltip: i18n("Refresh") - onClicked: content.reload() - } - Item { - Layout.fillWidth: true - } - Button { - iconName: "filename-artist-amarok" - Layout.alignment: Qt.AlignRight - ToolTip.text: i18n("Artist") + onClicked: content.reload() + } + Item { + Layout.fillWidth: true + } + Button { + iconName: "filename-artist-amarok" + Layout.alignment: Qt.AlignRight + tooltip: i18n("Artist") - onClicked: WikipediaEngine.selection = WikipediaEngine.Artist - } - Button { - iconName: "filename-composer-amarok" - Layout.alignment: Qt.AlignRight - ToolTip.text: i18n("Composer") + onClicked: WikipediaEngine.selection = WikipediaEngine.Artist + } + Button { + iconName: "filename-composer-amarok" + Layout.alignment: Qt.AlignRight + tooltip: i18n("Composer") - onClicked: WikipediaEngine.selection = WikipediaEngine.Composer - } - Button { - iconName: "filename-album-amarok" - Layout.alignment: Qt.AlignRight - ToolTip.text: i18n("Album") + onClicked: WikipediaEngine.selection = WikipediaEngine.Composer + } + Button { + iconName: "filename-album-amarok" + Layout.alignment: Qt.AlignRight + tooltip: i18n("Album") - onClicked: WikipediaEngine.selection = WikipediaEngine.Album - } - Button { - iconName: "filename-title-amarok" - Layout.alignment: Qt.AlignRight - ToolTip.text: i18n("Track") + onClicked: WikipediaEngine.selection = WikipediaEngine.Album + } + Button { + iconName: "filename-title-amarok" + Layout.alignment: Qt.AlignRight + tooltip: i18n("Track") - onClicked: WikipediaEngine.selection = WikipediaEngine.Track + onClicked: WikipediaEngine.selection = WikipediaEngine.Track + } } - } - WebEngineView { - id: content + WebEngineView { + id: content + + backgroundColor: "transparent" - anchors.top: buttonRow.bottom - anchors.topMargin: applet.spacing - width: parent.width - height: Context.largeSpacing * 25 //TODO: Find a more elegant solution to set the height + Layout.fillWidth: true + Layout.fillHeight: true + Layout.alignment: Qt.AlignBottom - onNavigationRequested: { - if (request.navigationType == WebEngineNavigationRequest.LinkClickedNavigation) { + onNavigationRequested: { request.action = WebEngineNavigationRequest.IgnoreRequest; WikipediaEngine.url = request.url; } - } - Connections { - target: WikipediaEngine + Connections { + target: WikipediaEngine - onPageChanged: content.loadHtml(WikipediaEngine.page, WikipediaEngine.url) - } + onPageChanged: content.loadHtml(WikipediaEngine.page, WikipediaEngine.url) + } - BusyIndicator { - anchors.centerIn: parent - running: WikipediaEngine.busy + BusyIndicator { + anchors.centerIn: parent + running: WikipediaEngine.busy + } } } - - SystemPalette { - id: palette - } } diff --git a/src/context/applets/wikipedia/package/metadata.desktop b/src/context/applets/wikipedia/package/metadata.desktop --- a/src/context/applets/wikipedia/package/metadata.desktop +++ b/src/context/applets/wikipedia/package/metadata.desktop @@ -57,7 +57,7 @@ Type=Service ServiceTypes=Amarok/ContextApplet -Icon=wikipedia-amarok +Icon=amarok-wikipedia X-KDE-PluginInfo-Author=Leo Franchi X-KDE-PluginInfo-Email=lfranchi@gmail.com diff --git a/src/context/applets/wikipedia/plugin/WikipediaApplet.h b/src/context/applets/wikipedia/plugin/WikipediaApplet.h --- a/src/context/applets/wikipedia/plugin/WikipediaApplet.h +++ b/src/context/applets/wikipedia/plugin/WikipediaApplet.h @@ -22,16 +22,12 @@ #include "context/DataEngine.h" #include "NetworkAccessManagerProxy.h" -class QAction; -class QDialog; class KConfigDialog; class QListWidgetItem; class WikipediaAppletPrivate; namespace Plasma { - class WebView; - class IconWidget; } class WikipediaApplet : public Context::Applet diff --git a/src/context/applets/wikipedia/plugin/WikipediaApplet.cpp b/src/context/applets/wikipedia/plugin/WikipediaApplet.cpp --- a/src/context/applets/wikipedia/plugin/WikipediaApplet.cpp +++ b/src/context/applets/wikipedia/plugin/WikipediaApplet.cpp @@ -528,7 +528,7 @@ void WikipediaAppletPrivate::_searchLineEditTextEdited( const QString &text ) { - webView->page()->findText( QString(), QWebPage::HighlightAllOccurrences ); // clears preivous highlights + webView->page()->findText( QString(), QWebPage::HighlightAllOccurrences ); // clears previous highlights webView->page()->findText( text, QWebPage::FindWrapsAroundDocument | QWebPage::HighlightAllOccurrences ); } diff --git a/src/context/applets/wikipedia/plugin/WikipediaApplet_p.h b/src/context/applets/wikipedia/plugin/WikipediaApplet_p.h --- a/src/context/applets/wikipedia/plugin/WikipediaApplet_p.h +++ b/src/context/applets/wikipedia/plugin/WikipediaApplet_p.h @@ -53,7 +53,7 @@ Q_DECLARE_PUBLIC( WikipediaApplet ) public: - WikipediaAppletPrivate( WikipediaApplet *parent ) + explicit WikipediaAppletPrivate( WikipediaApplet *parent ) : q_ptr( parent ) , css( 0 ) , dataContainer( 0 ) @@ -150,7 +150,7 @@ Q_OBJECT public: - WikipediaSearchLineEdit( QGraphicsWidget *parent = 0 ) + explicit WikipediaSearchLineEdit( QGraphicsWidget *parent = nullptr ) : Plasma::LineEdit( parent ) {} ~WikipediaSearchLineEdit() {} @@ -185,7 +185,7 @@ Q_OBJECT public: - WikipediaWebView( QGraphicsItem *parent = 0 ) + explicit WikipediaWebView( QGraphicsItem *parent = nullptr ) : KGraphicsWebView( parent ) { m_lineEdit = new WikipediaSearchLineEdit( this ); diff --git a/src/context/applets/wikipedia/plugin/WikipediaEngine.h b/src/context/applets/wikipedia/plugin/WikipediaEngine.h --- a/src/context/applets/wikipedia/plugin/WikipediaEngine.h +++ b/src/context/applets/wikipedia/plugin/WikipediaEngine.h @@ -23,6 +23,7 @@ #include "network/NetworkAccessManagerProxy.h" #include +#include class WikipediaEngine : public QObject @@ -46,7 +47,7 @@ }; Q_ENUM(SelectionType) - WikipediaEngine( QObject* parent = Q_NULLPTR ); + explicit WikipediaEngine( QObject* parent = nullptr ); virtual ~WikipediaEngine(); QString page() const { return m_page; } @@ -60,7 +61,7 @@ QString language() const { return preferredLangs.first(); } void setLanguage( const QString &language ); -signals: +Q_SIGNALS: void pageChanged(); void messageChanged(); void busyChanged(); @@ -108,13 +109,15 @@ QString m_message; bool m_busy; QString m_title; + QString m_css; -private slots: +private Q_SLOTS: void _checkRequireUpdate( Meta::TrackPtr track ); - void _parseLangLinksResult( const QUrl &url, QByteArray data, NetworkAccessManagerProxy::Error e ); - void _parseListingResult( const QUrl &url, QByteArray data, NetworkAccessManagerProxy::Error e ); - void _wikiResult( const QUrl &url, QByteArray result, NetworkAccessManagerProxy::Error e ); + void _parseLangLinksResult(const QUrl &url, const QByteArray &data, const NetworkAccessManagerProxy::Error &e ); + void _parseListingResult(const QUrl &url, const QByteArray &data, const NetworkAccessManagerProxy::Error &e ); + void _wikiResult(const QUrl &url, const QByteArray &result, const NetworkAccessManagerProxy::Error &e ); void _stopped(); + void _paletteChanged( const QPalette &palette ); }; diff --git a/src/context/applets/wikipedia/plugin/WikipediaEngine.cpp b/src/context/applets/wikipedia/plugin/WikipediaEngine.cpp --- a/src/context/applets/wikipedia/plugin/WikipediaEngine.cpp +++ b/src/context/applets/wikipedia/plugin/WikipediaEngine.cpp @@ -22,11 +22,14 @@ #include "WikipediaEngine.h" #include "EngineController.h" +#include "PaletteHandler.h" #include "core/meta/support/MetaConstants.h" #include "core/support/Amarok.h" #include "core/support/Debug.h" #include +#include +#include #include #include @@ -43,21 +46,24 @@ EngineController *engine = The::engineController(); _checkRequireUpdate( engine->currentTrack() ); + _paletteChanged( The::paletteHandler()->palette() ); connect( engine, &EngineController::trackChanged, this, &WikipediaEngine::_checkRequireUpdate ); connect( engine, &EngineController::trackMetadataChanged, this, &WikipediaEngine::_checkRequireUpdate ); connect( engine, &EngineController::stopped, this, &WikipediaEngine::_stopped ); + connect( The::paletteHandler(), &PaletteHandler::newPalette, + this, &WikipediaEngine::_paletteChanged ); } WikipediaEngine::~WikipediaEngine() { } void -WikipediaEngine::_wikiResult( const QUrl &url, QByteArray result, NetworkAccessManagerProxy::Error e ) +WikipediaEngine::_wikiResult( const QUrl &url, const QByteArray &result, const NetworkAccessManagerProxy::Error &e ) { if( !urls.contains( url ) ) return; @@ -119,8 +125,8 @@ } void -WikipediaEngine::_parseLangLinksResult( const QUrl &url, QByteArray data, - NetworkAccessManagerProxy::Error e ) +WikipediaEngine::_parseLangLinksResult( const QUrl &url, const QByteArray &data, + const NetworkAccessManagerProxy::Error &e ) { if( !urls.contains( url ) ) return; @@ -247,8 +253,8 @@ void WikipediaEngine::_parseListingResult( const QUrl &url, - QByteArray data, - NetworkAccessManagerProxy::Error e ) + const QByteArray &data, + const NetworkAccessManagerProxy::Error &e ) { if( !urls.contains( url ) ) return; @@ -379,6 +385,41 @@ m_previousTrackMetadata.clear(); } +void +WikipediaEngine::_paletteChanged( const QPalette &palette ) +{ + DEBUG_BLOCK + + // read css, replace color placeholders, write to file, load into page + QFile file( QStandardPaths::locate( QStandardPaths::GenericDataLocation, "amarok/data/WikipediaCustomStyle.css" ) ); + if( file.open(QIODevice::ReadOnly | QIODevice::Text) ) + { + QString contents = QString( file.readAll() ); + contents.replace( "/*{text_color}*/", palette.text().color().name() ); + contents.replace( "/*{link_color}*/", palette.link().color().name() ); + contents.replace( "/*{link_hover_color}*/", palette.linkVisited().color().name() ); + contents.replace( "/*{background_color}*/", palette.base().color().name() ); + + const QString abg = palette.window().color().name(); + contents.replace( "/*{shaded_text_background_color}*/", abg ); + contents.replace( "/*{table_background_color}*/", abg ); + contents.replace( "/*{headings_background_color}*/", abg ); + + const QString atbg = palette.alternateBase().color().name(); + contents.replace( "/*{alternate_table_background_color}*/", atbg ); + + if( m_css == contents ) + return; + + m_css = contents; + updateEngine(); + } + else + { + error() << "Could not load WikipediaCustomStyle.css"; + } +} + void WikipediaEngine::fetchWikiUrl( const QString &title, const QString &urlPrefix ) { @@ -391,7 +432,7 @@ // host.prepend( ".m" ); // host.prepend( urlPrefix ); // pageUrl.setHost( host ); -// pageUrl.setPath( QString("/wiki/%1").arg(title) ); +// pageUrl.setPath( QStringLiteral("/wiki/%1").arg(title) ); // DataEngine::Data data; // data[QLatin1String("sourceUrl")] = pageUrl; // removeAllData( QLatin1String("wikipedia") ); @@ -412,9 +453,8 @@ pageUrl.setQuery( query ); wikiCurrentUrl = pageUrl; urls << pageUrl; - emit urlChanged(); - The::networkAccessManager()->getData( pageUrl, this, - SLOT(_wikiResult(QUrl,QByteArray,NetworkAccessManagerProxy::Error)) ); + Q_EMIT urlChanged(); + The::networkAccessManager()->getData( pageUrl, this, &WikipediaEngine::_wikiResult ); } void @@ -438,8 +478,7 @@ url.setQuery( query ); urls << url; debug() << "Fetching langlinks:" << url; - The::networkAccessManager()->getData( url, this, - SLOT(_parseLangLinksResult(QUrl,QByteArray,NetworkAccessManagerProxy::Error)) ); + The::networkAccessManager()->getData( url, this, &WikipediaEngine::_parseLangLinksResult ); } void @@ -460,8 +499,7 @@ url.setQuery( query ); urls << url; debug() << "Fetching listing:" << url; - The::networkAccessManager()->getData( url, this, - SLOT(_parseListingResult(QUrl,QByteArray,NetworkAccessManagerProxy::Error)) ); + The::networkAccessManager()->getData( url, this, &WikipediaEngine::_parseListingResult ); } void @@ -567,8 +605,8 @@ WikipediaEngine::wikiParse( QString &wiki ) { //remove the new-lines and tabs(replace with spaces IS needed). - wiki.replace( '\n', QLatin1Char(' ') ); - wiki.replace( '\t', QLatin1Char(' ') ); +// wiki.replace( '\n', QLatin1Char(' ') ); +// wiki.replace( '\t', QLatin1Char(' ') ); // Get the available language list QString wikiLanguagesSection; @@ -635,14 +673,26 @@ } }; + QString header = QString( "\n\n%1\n\n\n" ).arg( title ); + + // add own stylesheet + if( !m_css.isEmpty() ) + { + removeTag( "" ); + int index = header.indexOf( QStringLiteral( "" ) ); + header.insert( index, QString( "\n\n" ).arg( m_css ) ); + } + + wiki.prepend( header ); + // lets remove the warning box removeTag( "" ); // remove protection policy (we don't do edits) removeTag( "
" ); // lets also remove the "lock" image removeTag( "" ); // remove
]*>") ) ); @@ -676,9 +726,6 @@ wiki.remove( QRegExp( QLatin1String("]*>") ) ); wiki.remove( QLatin1String("") ); - wiki.prepend( QLatin1String("\n") ); - wiki.append( QString(QLatin1String("%1\n")).arg(title) ); - wiki.append( QLatin1String("\n") ); // wiki.append( createLanguageComboBox(langMap) ); // BUG:259075 wiki.append( QLatin1String("\n") ); } @@ -694,11 +741,11 @@ while( i.hasNext() ) { i.next(); - html += QString( "" ).arg( i.value(), i.key() ); + html += QStringLiteral( "" ).arg( i.value(), i.key() ); } - html.prepend( QString("
") ); + html.prepend( QStringLiteral("
") ); return html; } @@ -709,8 +756,7 @@ return; urls << wikiCurrentUrl; setBusy( true ); - The::networkAccessManager()->getData( wikiCurrentUrl, this, - SLOT(_wikiResult(QUrl,QByteArray,NetworkAccessManagerProxy::Error)) ); + The::networkAccessManager()->getData( wikiCurrentUrl, this, &WikipediaEngine::_wikiResult ); } WikipediaEngine::SelectionType @@ -726,7 +772,7 @@ return false; currentSelection = type; - emit selectionChanged(); + Q_EMIT selectionChanged(); updateEngine(); @@ -755,7 +801,7 @@ return; m_page = page; - emit pageChanged(); + Q_EMIT pageChanged(); } void @@ -765,7 +811,7 @@ return; m_message = message; - emit messageChanged(); + Q_EMIT messageChanged(); } @@ -776,7 +822,7 @@ return; m_busy = busy; - emit busyChanged(); + Q_EMIT busyChanged(); } void @@ -786,7 +832,7 @@ return; m_title = title; - emit titleChanged(); + Q_EMIT titleChanged(); } void @@ -805,7 +851,7 @@ preferredLangs.removeAll( language ); preferredLangs.prepend( language ); - emit languageChanged(); + Q_EMIT languageChanged(); updateEngine(); } @@ -818,8 +864,8 @@ wikiCurrentUrl = url; urls << url; - emit urlChanged(); + Q_EMIT urlChanged(); - The::networkAccessManager()->getData( url, this, SLOT(_wikiResult(QUrl,QByteArray,NetworkAccessManagerProxy::Error)) ); + The::networkAccessManager()->getData( url, this, &WikipediaEngine::_wikiResult ); } diff --git a/src/context/applets/wikipedia/plugin/WikipediaPlugin.cpp b/src/context/applets/wikipedia/plugin/WikipediaPlugin.cpp --- a/src/context/applets/wikipedia/plugin/WikipediaPlugin.cpp +++ b/src/context/applets/wikipedia/plugin/WikipediaPlugin.cpp @@ -32,7 +32,7 @@ Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) public: - void registerTypes(const char* uri) Q_DECL_OVERRIDE + void registerTypes(const char* uri) override { Q_ASSERT(uri == QLatin1String("org.kde.amarok.wikipedia")); diff --git a/src/context/context_qml_package/contents/ui/main.qml b/src/context/context_qml_package/contents/ui/main.qml --- a/src/context/context_qml_package/contents/ui/main.qml +++ b/src/context/context_qml_package/contents/ui/main.qml @@ -18,6 +18,7 @@ import QtQuick.Controls 2.0 import QtQuick.Layouts 1.2 import QtQml.Models 2.2 +import org.kde.kirigami 2.0 as Kirigami import "toolbar" Item { @@ -28,69 +29,80 @@ ColumnLayout { anchors.fill: parent - ListView { - id: appletListView + Flickable { + id: appletFlickable signal scrollToApplet(string id) Layout.alignment: Qt.AlignTop Layout.fillHeight: true Layout.fillWidth: true - spacing: Context.smallSpacing - displayMarginEnd: 100000 - displayMarginBeginning: 100000 - clip: true + contentWidth: scrollBar.visible ? width - scrollBar.width : width + contentHeight: appletColumn.height + flickableDirection: Flickable.VerticalFlick + focus: true - model: AppletProxyModel + Keys.onUpPressed: scrollBar.decrease() + Keys.onDownPressed: scrollBar.increase() ScrollBar.vertical: ScrollBar { id: scrollBar } - delegate: Loader { - width: scrollBar.visible ? parent.width - scrollBar.width : parent.width - active: true - asynchronous: true - - function initialize() { - setSource(mainscript, { - "name": name, - "appletId": appletId, - "iconSource": "image://icon/" + icon, - "collapsed": collapsed, - "contentHeight": contentHeight, - "packagePath": packagePath, - "configEnabled": Qt.binding(function() { return appletToolbar.configEnabled; } ) - }); - } + Column { + id: appletColumn + + width: parent.width + spacing: Kirigami.Units.smallSpacing + + Repeater { + model: AppletProxyModel + + delegate: Loader { + width: appletColumn.width + active: true + asynchronous: false + + function initialize() { + setSource(mainscript, { + "name": name, + "appletId": appletId, + "iconSource": icon, + "collapsed": collapsed, + "contentHeight": contentHeight, + "configEnabled": Qt.binding(function() { return appletToolbar.configEnabled; } ) + }); + } - Component.onCompleted: initialize() + Component.onCompleted: initialize() - onStatusChanged: { - if (status == Loader.Error) { - Context.error("Error loading applet: " + appletId); - Context.error(sourceComponent.errorString()); - } - if (status == Loader.Ready) { - Context.debug("Applet loaded: " + appletId); - } - } + onStatusChanged: { + if (status == Loader.Error) { + Context.error("Error loading applet: " + appletId); + Context.error(sourceComponent.errorString()); + } + if (status == Loader.Ready) { + Context.debug("Applet loaded: " + appletId); + } + } - Connections { - target: AppletProxyModel + Connections { + target: AppletProxyModel - onDataChanged: { - if (!!mainscript && mainscript != source) { - Context.debug("Data changed for applet " + appletId); - initialize(); + onDataChanged: { + if (!!mainscript && mainscript != source) { + Context.debug("Data changed for applet " + appletId); + initialize(); + } + } } - } - } - Connections { - target: appletListView - - onScrollToApplet: { - if (id == appletId) { - appletListView.positionViewAtIndex(index, ListView.Beginning); - Context.debug("Scroll to applet: " + appletId); + Connections { + target: appletFlickable + + onScrollToApplet: { + if (id == appletId) { + appletFlickable.contentY = y; + Context.debug("Scroll to applet: " + appletId); + } + } } } } @@ -100,15 +112,15 @@ id: appletToolbarAddItem Layout.fillWidth: true - height: Context.iconSizes.enormous + height: Kirigami.Units.iconSizes.enormous visible: appletToolbar.configEnabled } AppletToolbar { id: appletToolbar contextRoot: root addItem: appletToolbarAddItem - listView: appletListView + flickable: appletFlickable Layout.alignment: Qt.AlignBottom Layout.fillWidth: true } diff --git a/src/context/context_qml_package/contents/ui/toolbar/AppletToolbar.qml b/src/context/context_qml_package/contents/ui/toolbar/AppletToolbar.qml --- a/src/context/context_qml_package/contents/ui/toolbar/AppletToolbar.qml +++ b/src/context/context_qml_package/contents/ui/toolbar/AppletToolbar.qml @@ -18,13 +18,15 @@ import QtQuick.Controls 1.4 import QtQml.Models 2.1 import QtQuick.Layouts 1.3 +import org.kde.kirigami 2.0 as Kirigami + Rectangle { id: root readonly property alias configEnabled: configureButton.checked property var addItem - property var listView + property var flickable property var contextRoot function resizeApplets() { @@ -36,7 +38,7 @@ } if (items.length > 0) { var space = toolbarAppletRow.width - (items.length - 1) * toolbarAppletRow.spacing; - var threshhold = space / items.length; + var threshold = space / items.length; var smallApplets = []; var largeApplets = []; for (var i=0; i 0 && space > 0) { var countSmallApplets = smallApplets.length; smallApplets.forEach(function (applet, index) { - if (applet.implicitWidth >= threshhold) { + if (applet.implicitWidth >= threshold) { largeApplets.push(applet); applet.width = applet.implicitWidth; space -= applet.width; @@ -59,7 +61,7 @@ }); return; } - threshhold = space / smallApplets.length; + threshold = space / smallApplets.length; } if (smallApplets.length == 0) return; for (var i=0; i &args ); @@ -101,7 +102,7 @@ * Parse the xml fetched on the lastFM API. * Launched when the download of the data are finished. */ - void parseSimilarArtists( const QUrl &url, QByteArray data, NetworkAccessManagerProxy::Error e ); + void parseSimilarArtists( const QUrl &url, const QByteArray &data, NetworkAccessManagerProxy::Error e ); }; #endif // SIMILARARTISTSENGINE_H diff --git a/src/context/engines/similarartists/SimilarArtistsEngine.cpp b/src/context/engines/similarartists/SimilarArtistsEngine.cpp --- a/src/context/engines/similarartists/SimilarArtistsEngine.cpp +++ b/src/context/engines/similarartists/SimilarArtistsEngine.cpp @@ -128,7 +128,7 @@ } void -SimilarArtistsEngine::parseSimilarArtists( const QUrl &url, QByteArray data, +SimilarArtistsEngine::parseSimilarArtists( const QUrl &url, consr QByteArray &data, NetworkAccessManagerProxy::Error e ) { if( e.code != QNetworkReply::NoError ) diff --git a/src/context/engines/similarartists/amarok-data-engine-similarArtists.desktop b/src/context/engines/similarartists/amarok-data-engine-similarArtists.desktop --- a/src/context/engines/similarartists/amarok-data-engine-similarArtists.desktop +++ b/src/context/engines/similarartists/amarok-data-engine-similarArtists.desktop @@ -22,7 +22,7 @@ Name[it]=Motore dati Prossimi eventi Name[ja]=近日中のイベントデータエンジン Name[km]=ម៉ាស៊ីន​ទិន្នន័យ​ព្រឹត្តិការណ៍​ដែល​នឹង​កើត​ឡើង​ -Name[ko]=다가오는 약속 데이터 엔진 +Name[ko]=곧 있을 이벤트 데이터 엔진 Name[lt]=Artimiausių įvykių duomenų sistema Name[lv]=Tuvāko notikumu datu dzinis Name[nb]=Datamotor for kommende hendelser @@ -44,7 +44,6 @@ Name[tr]=Gelecek Etkinlikler Veri Motoru Name[uk]=Рушій розкладу найближчих подій Name[x-test]=xxUpcoming Events Data Enginexx -Name[zh_CN]=近期事件数据引擎 Name[zh_TW]=即將來臨的事件資料引擎 X-KDE-ServiceTypes=Plasma/DataEngine Type=Service diff --git a/src/context/engines/songkick/CMakeLists.txt b/src/context/engines/songkick/CMakeLists.txt --- a/src/context/engines/songkick/CMakeLists.txt +++ b/src/context/engines/songkick/CMakeLists.txt @@ -11,6 +11,6 @@ add_library(amarok_data_engine_songkick MODULE ${songkick_engine_SRCS}) target_link_libraries( amarok_data_engine_songkick amarokcore amaroklib KF5::Plasma amarokqtjson KF5::KIOCore) -install( TARGETS amarok_data_engine_songkick DESTINATION ${PLUGIN_INSTALL_DIR} ) -install( FILES amarok-data-engine-songkick.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) +install( TARGETS amarok_data_engine_songkick DESTINATION ${KDE_INSTALL_PLUGINDIR} ) +install( FILES amarok-data-engine-songkick.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR} ) diff --git a/src/context/engines/songkick/amarok-data-engine-songkick.desktop b/src/context/engines/songkick/amarok-data-engine-songkick.desktop --- a/src/context/engines/songkick/amarok-data-engine-songkick.desktop +++ b/src/context/engines/songkick/amarok-data-engine-songkick.desktop @@ -52,7 +52,6 @@ Name[uk]=Рушій даних Songkick Name[wa]=Éndjin d' dinêyes Songkick Name[x-test]=xxSongkick Data Enginexx -Name[zh_CN]=Songkick 数据引擎 Name[zh_TW]=Songkick 資料引擎 X-KDE-ServiceTypes=Plasma/DataEngine Type=Service diff --git a/src/context/engines/tabs/CMakeLists.txt b/src/context/engines/tabs/CMakeLists.txt --- a/src/context/engines/tabs/CMakeLists.txt +++ b/src/context/engines/tabs/CMakeLists.txt @@ -9,5 +9,5 @@ add_library(amarok_data_engine_tabs MODULE ${tabs_engine_SRCS}) target_link_libraries( amarok_data_engine_tabs amarokcore amaroklib KF5::Plasma KF5::KIOCore) -install( TARGETS amarok_data_engine_tabs DESTINATION ${PLUGIN_INSTALL_DIR} ) -install( FILES amarok-data-engine-tabs.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) +install( TARGETS amarok_data_engine_tabs DESTINATION ${KDE_INSTALL_PLUGINDIR} ) +install( FILES amarok-data-engine-tabs.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR} ) diff --git a/src/context/engines/tabs/TabsEngine.h b/src/context/engines/tabs/TabsEngine.h --- a/src/context/engines/tabs/TabsEngine.h +++ b/src/context/engines/tabs/TabsEngine.h @@ -25,7 +25,6 @@ #include -class KJob; using namespace Context; /** diff --git a/src/context/engines/tabs/amarok-data-engine-tabs.desktop b/src/context/engines/tabs/amarok-data-engine-tabs.desktop --- a/src/context/engines/tabs/amarok-data-engine-tabs.desktop +++ b/src/context/engines/tabs/amarok-data-engine-tabs.desktop @@ -15,12 +15,13 @@ Name[fi]=Tabulatuurien tietomoottori Name[fr]=Moteur de données pour les tablatures Name[ga]=Inneall Sonraí: Cluaisíní -Name[gl]=Motor de datos de tablaturas +Name[gl]=Motor de datos de tabulaturas Name[hu]=Tabok adatmodul Name[id]=Mesin Data Tab Name[it]=Motore dati delle tablature Name[ja]=Tabs データエンジン Name[km]=ម៉ាស៊ីន​ទិន្នន័យ​ផ្ទាំង +Name[ko]=Tabs 데이터 엔진 Name[lt]=Kortelių duomenų sistema Name[lv]=Ciļņu datu dzinējs Name[nb]=Datamotor for tablaturer @@ -41,7 +42,6 @@ Name[tr]=Akor Veri Motoru Name[uk]=Рушій даних акордів Name[x-test]=xxTabs Data Enginexx -Name[zh_CN]=吉他谱数据引擎 Name[zh_TW]=Tabs 資料引擎 X-KDE-ServiceTypes=Plasma/DataEngine Type=Service diff --git a/src/context/engines/upcomingevents/CMakeLists.txt b/src/context/engines/upcomingevents/CMakeLists.txt --- a/src/context/engines/upcomingevents/CMakeLists.txt +++ b/src/context/engines/upcomingevents/CMakeLists.txt @@ -15,5 +15,5 @@ add_library(amarok_data_engine_upcomingEvents MODULE ${upcomingEvents_engine_SRCS}) target_link_libraries( amarok_data_engine_upcomingEvents amarokcore amaroklib KF5::Plasma KF5::KIOCore ${LIBLASTFM_LIBRARY} ) -install( TARGETS amarok_data_engine_upcomingEvents DESTINATION ${PLUGIN_INSTALL_DIR} ) -install( FILES amarok-data-engine-upcomingEvents.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) +install( TARGETS amarok_data_engine_upcomingEvents DESTINATION ${KDE_INSTALL_PLUGINDIR} ) +install( FILES amarok-data-engine-upcomingEvents.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR} ) diff --git a/src/context/engines/upcomingevents/UpcomingEventsEngine.h b/src/context/engines/upcomingevents/UpcomingEventsEngine.h --- a/src/context/engines/upcomingevents/UpcomingEventsEngine.h +++ b/src/context/engines/upcomingevents/UpcomingEventsEngine.h @@ -29,7 +29,6 @@ #include #include -class QNetworkReply; using namespace Context; @@ -48,7 +47,7 @@ * * Creates a new instance of UpcomingEventsEngine */ - UpcomingEventsEngine( QObject* parent, const QList& args ); + explicit UpcomingEventsEngine( QObject* parent, const QList& args ); /** * \brief Destructor @@ -103,8 +102,8 @@ */ void updateDataForVenues(); - void artistEventsFetched( const QUrl &url, QByteArray data, NetworkAccessManagerProxy::Error e ); - void venueEventsFetched( const QUrl &url, QByteArray data, NetworkAccessManagerProxy::Error e ); + void artistEventsFetched( const QUrl &url, const QByteArray &data, NetworkAccessManagerProxy::Error e ); + void venueEventsFetched( const QUrl &url, const QByteArray &data, NetworkAccessManagerProxy::Error e ); }; #endif diff --git a/src/context/engines/upcomingevents/UpcomingEventsEngine.cpp b/src/context/engines/upcomingevents/UpcomingEventsEngine.cpp --- a/src/context/engines/upcomingevents/UpcomingEventsEngine.cpp +++ b/src/context/engines/upcomingevents/UpcomingEventsEngine.cpp @@ -136,7 +136,7 @@ } void -UpcomingEventsEngine::artistEventsFetched( const QUrl &url, QByteArray data, +UpcomingEventsEngine::artistEventsFetched( const QUrl &url, const QByteArray &data, NetworkAccessManagerProxy::Error e ) { if( !m_urls.contains( url ) ) @@ -163,7 +163,7 @@ } void -UpcomingEventsEngine::venueEventsFetched( const QUrl &url, QByteArray data, +UpcomingEventsEngine::venueEventsFetched( const QUrl &url, const QByteArray data&, NetworkAccessManagerProxy::Error e ) { Q_UNUSED( url ) diff --git a/src/context/engines/upcomingevents/amarok-data-engine-upcomingEvents.desktop b/src/context/engines/upcomingevents/amarok-data-engine-upcomingEvents.desktop --- a/src/context/engines/upcomingevents/amarok-data-engine-upcomingEvents.desktop +++ b/src/context/engines/upcomingevents/amarok-data-engine-upcomingEvents.desktop @@ -22,7 +22,7 @@ Name[it]=Motore dati Prossimi eventi Name[ja]=近日中のイベントデータエンジン Name[km]=ម៉ាស៊ីន​ទិន្នន័យ​ព្រឹត្តិការណ៍​ដែល​នឹង​កើត​ឡើង​ -Name[ko]=다가오는 약속 데이터 엔진 +Name[ko]=곧 있을 이벤트 데이터 엔진 Name[lt]=Artimiausių įvykių duomenų sistema Name[lv]=Tuvāko notikumu datu dzinis Name[nb]=Datamotor for kommende hendelser @@ -44,7 +44,6 @@ Name[tr]=Gelecek Etkinlikler Veri Motoru Name[uk]=Рушій розкладу найближчих подій Name[x-test]=xxUpcoming Events Data Enginexx -Name[zh_CN]=近期事件数据引擎 Name[zh_TW]=即將來臨的事件資料引擎 X-KDE-ServiceTypes=Plasma/DataEngine Type=Service diff --git a/src/context/popupdropper/libpud/CMakeLists.txt b/src/context/popupdropper/libpud/CMakeLists.txt --- a/src/context/popupdropper/libpud/CMakeLists.txt +++ b/src/context/popupdropper/libpud/CMakeLists.txt @@ -22,14 +22,14 @@ VERSION ${POPUPDROPPER_LIB_MAJOR_VERSION}.${POPUPDROPPER_LIB_MINOR_VERSION}.${POPUPDROPPER_LIB_PATCH_VERSION} SOVERSION ${POPUPDROPPER_LIB_MAJOR_VERSION} - INSTALL_NAME_DIR ${LIB_INSTALL_DIR} + INSTALL_NAME_DIR ${KDE_INSTALL_LIBDIR} ) install(TARGETS pud - LIBRARY DESTINATION ${LIB_INSTALL_DIR} + LIBRARY DESTINATION ${KDE_INSTALL_LIBDIR} RUNTIME DESTINATION bin - ARCHIVE DESTINATION ${LIB_INSTALL_DIR} + ARCHIVE DESTINATION ${KDE_INSTALL_LIBDIR} ) install( FILES PopupDropper.h PopupDropperItem.h PopupDropperView.h PopupDropper_Export.h DESTINATION - ${INCLUDE_INSTALL_DIR}/popupdropper COMPONENT Devel) + ${KDE_INSTALL_INCLUDEDIR}/popupdropper COMPONENT Devel) diff --git a/src/context/popupdropper/libpud/PopupDropper.h b/src/context/popupdropper/libpud/PopupDropper.h --- a/src/context/popupdropper/libpud/PopupDropper.h +++ b/src/context/popupdropper/libpud/PopupDropper.h @@ -26,8 +26,6 @@ #include "PopupDropper_Export.h" -class QGraphicsSvgItem; -class QGraphicsItem; class QMenu; class QSvgRenderer; class QTimeLine; @@ -60,13 +58,13 @@ public: enum Fading { NoFade, FadeIn, FadeOut, FadeInOut }; - Q_ENUMS( Fading ) + Q_ENUM( Fading ) explicit PopupDropper( QWidget *parent, bool standalone = false ); ~PopupDropper(); int overlayLevel() const; - void initOverlay( QWidget* parent, PopupDropperPrivate* priv = 0 ); + void initOverlay( QWidget* parent, PopupDropperPrivate* priv = nullptr ); void addOverlay(); @@ -132,7 +130,7 @@ QList items() const; QList submenuItems( const PopupDropperItem *item ) const; void forEachItem( void callback(void*) ); - void addSeparator( PopupDropperItem *separator = 0 ); + void addSeparator( PopupDropperItem *separator = nullptr ); Q_SIGNALS: void fadeHideFinished(); diff --git a/src/context/popupdropper/libpud/PopupDropper.cpp b/src/context/popupdropper/libpud/PopupDropper.cpp --- a/src/context/popupdropper/libpud/PopupDropper.cpp +++ b/src/context/popupdropper/libpud/PopupDropper.cpp @@ -140,7 +140,7 @@ { view->hide(); //qDebug() << "Emitting fadeHideFinished in d pointer " << this; - emit q->fadeHideFinished(); + Q_EMIT q->fadeHideFinished(); } void PopupDropperPrivate::fadeShowTimerFinished() //SLOT @@ -410,10 +410,10 @@ if( !menu ) return false; - if( menu->actions().size() == 0 ) + if( menu->actions().isEmpty() ) return true; - PopupDropperItem *pdi = 0; + PopupDropperItem *pdi = nullptr; foreach( QAction *action, menu->actions() ) { if( !action->menu() ) @@ -424,12 +424,12 @@ } else { - PopupDropper *pd = new PopupDropper( 0 ); + PopupDropper *pd = new PopupDropper( nullptr ); bool success = pd->addMenu( action->menu() ); if( success ) pdi = addSubmenu( &pd, action->text() ); } - pdi = 0; + pdi = nullptr; } return true; @@ -920,6 +920,7 @@ return list; PopupDropperPrivate *pdp = d->submenuMap[item->action()]; + list.reserve(pdp->pdiItems.count()); foreach( PopupDropperItem *pdi, pdp->pdiItems ) list.append( pdi ); diff --git a/src/context/popupdropper/libpud/PopupDropperItem.h b/src/context/popupdropper/libpud/PopupDropperItem.h --- a/src/context/popupdropper/libpud/PopupDropperItem.h +++ b/src/context/popupdropper/libpud/PopupDropperItem.h @@ -28,7 +28,6 @@ class QDropEvent; class QGraphicsTextItem; -class QGraphicsView; class QSvgRenderer; class QAction; class PopupDropper; @@ -73,16 +72,16 @@ public: enum HoverIndicatorShowStyle { Never, OnHover, AlwaysShow }; - Q_ENUMS( HoverIndicatorShowStyle ) + Q_ENUM( HoverIndicatorShowStyle ) enum Orientation { Left, Right }; - Q_ENUMS( Orientation ) + Q_ENUM( Orientation ) enum TextProtection { NoProtection, MultiLine, ScaleFont }; - Q_ENUMS( TextProtection ) - enum SeparatorStyle{TextSeparator, LineSeparator}; - Q_ENUMS( separatorStyle ) + Q_ENUM( TextProtection ) + enum SeparatorStyle { TextSeparator, LineSeparator }; + Q_ENUM( SeparatorStyle ) - PopupDropperItem( QGraphicsItem *parent = 0 ); - explicit PopupDropperItem( const QString &file, QGraphicsItem *parent = 0 ); + PopupDropperItem( QGraphicsItem *parent = nullptr ); + explicit PopupDropperItem( const QString &file, QGraphicsItem *parent = nullptr ); virtual ~PopupDropperItem(); void show(); @@ -166,8 +165,8 @@ void fullUpdate(); - virtual QRectF boundingRect() const; - virtual void paint( QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0 ); + QRectF boundingRect() const override; + void paint( QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = nullptr ) override; public Q_SLOTS: virtual void dropped( QDropEvent *event ); diff --git a/src/context/popupdropper/libpud/PopupDropperItem_p.h b/src/context/popupdropper/libpud/PopupDropperItem_p.h --- a/src/context/popupdropper/libpud/PopupDropperItem_p.h +++ b/src/context/popupdropper/libpud/PopupDropperItem_p.h @@ -33,7 +33,7 @@ public: - PopupDropperItemPrivate( PopupDropperItem* parent ); + explicit PopupDropperItemPrivate( PopupDropperItem* parent ); ~PopupDropperItemPrivate(); diff --git a/src/context/popupdropper/libpud/PopupDropperView.h b/src/context/popupdropper/libpud/PopupDropperView.h --- a/src/context/popupdropper/libpud/PopupDropperView.h +++ b/src/context/popupdropper/libpud/PopupDropperView.h @@ -31,12 +31,12 @@ public: PopupDropperView( PopupDropper *pd, QGraphicsScene *scene, QWidget *parent ); - ~PopupDropperView(); + ~PopupDropperView() override; - void dropEvent( QDropEvent *event ); - void dragEnterEvent( QDragEnterEvent *event ); - void dragMoveEvent( QDragMoveEvent *event ); - void dragLeaveEvent( QDragLeaveEvent *event ); + void dropEvent( QDropEvent *event ) override; + void dragEnterEvent( QDragEnterEvent *event ) override; + void dragMoveEvent( QDragMoveEvent *event ) override; + void dragLeaveEvent( QDragLeaveEvent *event ) override; void resetView(); diff --git a/src/context/qml_plugin/Applet.qml b/src/context/qml_plugin/Applet.qml --- a/src/context/qml_plugin/Applet.qml +++ b/src/context/qml_plugin/Applet.qml @@ -16,6 +16,7 @@ import QtQuick 2.4 import QtQuick.Dialogs 1.2 +import org.kde.kirigami 2.0 as Kirigami Rectangle { @@ -25,23 +26,27 @@ property alias title: header.title property string name: "Nameless Applet" property string appletId - property string packagePath property url iconSource property bool collapsed: false property bool configEnabled: false - property real spacing: Context.smallSpacing + property real spacing: Kirigami.Units.smallSpacing property real padding: spacing property real contentHeight: content.childrenRect.height property Dialog configDialog: null + readonly property AppletHeader appletHeader: header readonly property SystemPalette palette: palette - radius: Context.smallSpacing + radius: Kirigami.Units.smallSpacing border.width: 2 border.color: palette.mid color: "transparent" clip: true height: content.height + header.height + 2 * padding + !collapsed * spacing + function imageUrl(filename) { + return AppletModel.imageUrl(root.appletId, filename); + } + onCollapsedChanged: AppletModel.setAppletCollapsed(appletId, collapsed) onContentHeightChanged: AppletModel.setAppletContentHeight(appletId, contentHeight) @@ -88,7 +93,7 @@ preventStealing: true onMouseYChanged: { if(pressed) { - root.contentHeight = Math.max(Context.largeSpacing, root.contentHeight + mouseY); + root.contentHeight = Math.max(Kirigami.Units.largeSpacing, root.contentHeight + mouseY); } } } diff --git a/src/context/qml_plugin/AppletHeader.qml b/src/context/qml_plugin/AppletHeader.qml --- a/src/context/qml_plugin/AppletHeader.qml +++ b/src/context/qml_plugin/AppletHeader.qml @@ -41,6 +41,7 @@ width: height sourceSize.width: width sourceSize.height: height + fillMode: Image.PreserveAspectFit Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter } diff --git a/src/context/qml_plugin/src/PixmapItem.h b/src/context/qml_plugin/src/PixmapItem.h --- a/src/context/qml_plugin/src/PixmapItem.h +++ b/src/context/qml_plugin/src/PixmapItem.h @@ -40,10 +40,10 @@ QPixmap source() const { return m_source; } bool valid() const { return !m_source.isNull(); } - QSGNode* updatePaintNode( QSGNode * oldNode, UpdatePaintNodeData * updatePaintNodeData ) Q_DECL_OVERRIDE; - void geometryChanged( const QRectF &newGeometry, const QRectF &oldGeometry ) Q_DECL_OVERRIDE; + QSGNode* updatePaintNode( QSGNode * oldNode, UpdatePaintNodeData * updatePaintNodeData ) override; + void geometryChanged( const QRectF &newGeometry, const QRectF &oldGeometry ) override; -signals: +Q_SIGNALS: void sourceChanged(); private: diff --git a/src/context/qml_plugin/src/PixmapItem.cpp b/src/context/qml_plugin/src/PixmapItem.cpp --- a/src/context/qml_plugin/src/PixmapItem.cpp +++ b/src/context/qml_plugin/src/PixmapItem.cpp @@ -41,7 +41,7 @@ m_source = source; m_pixmapChanged = true; - emit sourceChanged(); + Q_EMIT sourceChanged(); setImplicitSize( source.width(), source.height() ); diff --git a/src/context/qml_plugin/src/Plugin.cpp b/src/context/qml_plugin/src/Plugin.cpp --- a/src/context/qml_plugin/src/Plugin.cpp +++ b/src/context/qml_plugin/src/Plugin.cpp @@ -33,7 +33,7 @@ Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) public: - void registerTypes(const char* uri) Q_DECL_OVERRIDE + void registerTypes(const char* uri) override { Q_ASSERT(uri == QLatin1String("org.kde.amarok.qml")); diff --git a/src/context/qml_plugin/src/RatingItem.h b/src/context/qml_plugin/src/RatingItem.h --- a/src/context/qml_plugin/src/RatingItem.h +++ b/src/context/qml_plugin/src/RatingItem.h @@ -23,6 +23,9 @@ #include + +class KRatingPainter; + class RatingItem : public QQuickPaintedItem { Q_OBJECT @@ -39,12 +42,12 @@ /** * Creates a new rating widget. */ - RatingItem( QQuickItem* parent = Q_NULLPTR ); + explicit RatingItem( QQuickItem* parent = nullptr ); /** * Destructor */ - ~RatingItem(); + ~RatingItem() override; /** * @return The current rating. @@ -144,15 +147,17 @@ protected: - virtual void mousePressEvent( QMouseEvent* e ) Q_DECL_OVERRIDE; - virtual void hoverMoveEvent( QHoverEvent* e ) Q_DECL_OVERRIDE; - virtual void hoverEnterEvent( QHoverEvent* e ) Q_DECL_OVERRIDE; - virtual void hoverLeaveEvent( QHoverEvent* e ) Q_DECL_OVERRIDE; - virtual void paint( QPainter* painter ) Q_DECL_OVERRIDE; + void mousePressEvent( QMouseEvent* e ) override; + void hoverMoveEvent( QHoverEvent* e ) override; + void hoverEnterEvent( QHoverEvent* e ) override; + void hoverLeaveEvent( QHoverEvent* e ) override; + void paint( QPainter* painter ) override; private: - class Private; - Private* const d; + int m_rating; + int m_hoverRating; + + KRatingPainter *m_ratingPainter; }; #endif diff --git a/src/context/qml_plugin/src/RatingItem.cpp b/src/context/qml_plugin/src/RatingItem.cpp --- a/src/context/qml_plugin/src/RatingItem.cpp +++ b/src/context/qml_plugin/src/RatingItem.cpp @@ -31,27 +31,10 @@ #include -class RatingItem::Private -{ -public: - Private() - : rating(0) - , hoverRating(-1) - , pixSize( 16 ) - { - } - - int rating; - int hoverRating; - int pixSize; - - KRatingPainter ratingPainter; -}; - RatingItem::RatingItem( QQuickItem* parent ) : QQuickPaintedItem( parent ) - , d( new Private() ) + , m_ratingPainter( new KRatingPainter ) { setAcceptedMouseButtons( Qt::LeftButton ); setAcceptHoverEvents( true ); @@ -62,7 +45,7 @@ RatingItem::~RatingItem() { - delete d; + delete m_ratingPainter; } @@ -72,146 +55,146 @@ if( iconName == icon() ) return; - d->ratingPainter.setIcon( QIcon::fromTheme( iconName ) ); - emit iconChanged(); + m_ratingPainter->setIcon( QIcon::fromTheme( iconName ) ); + Q_EMIT iconChanged(); update(); } int RatingItem::spacing() const { - return d->ratingPainter.spacing(); + return m_ratingPainter->spacing(); } QString RatingItem::icon() const { - return d->ratingPainter.icon().name(); + return m_ratingPainter->icon().name(); } void RatingItem::setSpacing( int s ) { - if( s == d->ratingPainter.spacing() ) + if( s == m_ratingPainter->spacing() ) return; - d->ratingPainter.setSpacing( s ); - emit spacingChanged(); + m_ratingPainter->setSpacing( s ); + Q_EMIT spacingChanged(); update(); } Qt::Alignment RatingItem::alignment() const { - return d->ratingPainter.alignment(); + return m_ratingPainter->alignment(); } void RatingItem::setAlignment( Qt::Alignment align ) { - if( align == d->ratingPainter.alignment() ) + if( align == m_ratingPainter->alignment() ) return; - d->ratingPainter.setAlignment( align ); - emit alignmentChanged(); + m_ratingPainter->setAlignment( align ); + Q_EMIT alignmentChanged(); update(); } Qt::LayoutDirection RatingItem::layoutDirection() const { - return d->ratingPainter.layoutDirection(); + return m_ratingPainter->layoutDirection(); } void RatingItem::setLayoutDirection( Qt::LayoutDirection direction ) { - if( direction == d->ratingPainter.layoutDirection() ) + if( direction == m_ratingPainter->layoutDirection() ) return; - d->ratingPainter.setLayoutDirection( direction ); - emit layoutDirectionChanged(); + m_ratingPainter->setLayoutDirection( direction ); + Q_EMIT layoutDirectionChanged(); update(); } unsigned int RatingItem::rating() const { - return d->rating; + return m_rating; } int RatingItem::maxRating() const { - return d->ratingPainter.maxRating(); + return m_ratingPainter->maxRating(); } int RatingItem::hoverRating() const { - return d->hoverRating; + return m_hoverRating; } bool RatingItem::halfStepsEnabled() const { - return d->ratingPainter.halfStepsEnabled(); + return m_ratingPainter->halfStepsEnabled(); } void RatingItem::setRating( int rating ) { - if( rating == d->rating ) + if( rating == m_rating ) return; - d->rating = rating; - d->hoverRating = rating; - emit ratingChanged(); - emit hoverRatingChanged(); + m_rating = rating; + m_hoverRating = rating; + Q_EMIT ratingChanged(); + Q_EMIT hoverRatingChanged(); update(); } void RatingItem::setMaxRating( int max ) { - if( max == d->ratingPainter.maxRating() ) + if( max == m_ratingPainter->maxRating() ) return; - bool halfSteps = d->ratingPainter.halfStepsEnabled(); + bool halfSteps = m_ratingPainter->halfStepsEnabled(); - d->ratingPainter.setMaxRating( max ); - emit maxRatingChanged(); + m_ratingPainter->setMaxRating( max ); + Q_EMIT maxRatingChanged(); - if( halfSteps != d->ratingPainter.halfStepsEnabled() ) - emit halfStepsEnabledChanged(); + if( halfSteps != m_ratingPainter->halfStepsEnabled() ) + Q_EMIT halfStepsEnabledChanged(); update(); } void RatingItem::setHalfStepsEnabled( bool enabled ) { - if( enabled == d->ratingPainter.halfStepsEnabled() ) + if( enabled == m_ratingPainter->halfStepsEnabled() ) return; - d->ratingPainter.setHalfStepsEnabled( enabled ); - emit halfStepsEnabledChanged(); + m_ratingPainter->setHalfStepsEnabled( enabled ); + Q_EMIT halfStepsEnabledChanged(); update(); } @@ -224,52 +207,46 @@ if ( e->button() == Qt::LeftButton ) { QRect rect( 0, 0, width(), height() ); - int ratingFromPos = d->ratingPainter.ratingFromPosition( rect, e->pos() ); + int ratingFromPos = m_ratingPainter->ratingFromPosition( rect, e->pos() ); debug() << "Rating item clicked. New rating:" << ratingFromPos; if ( ratingFromPos >= 0 ) - { - // setToolTip( i18n( "Track rating: %1", (float)d->rating / 2 ) ); - emit clicked( ratingFromPos ); - } + Q_EMIT clicked( ratingFromPos ); } } - void RatingItem::hoverMoveEvent( QHoverEvent* e ) { QRect rect( 0, 0, width(), height() ); - d->hoverRating = d->ratingPainter.ratingFromPosition( rect, e->pos() ); + m_hoverRating = m_ratingPainter->ratingFromPosition( rect, e->pos() ); update(); } - void RatingItem::hoverEnterEvent( QHoverEvent* e ) { QRect rect( 0, 0, width(), height() ); - d->hoverRating = d->ratingPainter.ratingFromPosition( rect, e->pos() ); - - // setToolTip( i18n( "Track rating: %1", (float)d->rating / 2 ) ); + m_hoverRating = m_ratingPainter->ratingFromPosition( rect, e->pos() ); update(); } void RatingItem::hoverLeaveEvent( QHoverEvent* ) { - d->hoverRating = -1; + m_hoverRating = -1; + update(); } void RatingItem::paint( QPainter* painter ) { - d->ratingPainter.setEnabled( isEnabled() ); + m_ratingPainter->setEnabled( isEnabled() ); QRect rect( 0, 0, width(), height() ); - d->ratingPainter.paint( painter, rect, d->rating, d->hoverRating ); + m_ratingPainter->paint( painter, rect, m_rating, m_hoverRating ); } diff --git a/src/context/servicetypes/amarok_containment.desktop b/src/context/servicetypes/amarok_containment.desktop --- a/src/context/servicetypes/amarok_containment.desktop +++ b/src/context/servicetypes/amarok_containment.desktop @@ -23,7 +23,7 @@ Comment[hne]=प्लाज्मा एपलेट कंटेनर अउ पिछोत अंगना पुतइया Comment[hu]=Tároló Plasma-kisalkalmazásokhoz, háttérrajzoló Comment[ia]=Receptaculo applet Plasma e pictor de fundo -Comment[id]=Plasma applet wadah dan pelukis latar belakang +Comment[id]=Wadah applet Plasma dan pelukis latarbelakang Comment[is]=Ílát og bakgrunnsmálari fyrir Plasma smáforrit Comment[it]=Contenitore applet Plasma e creazione sfondo Comment[ja]=Plasma アプレットのコンテナおよび背景描画 diff --git a/src/context/servicetypes/amarok_context_applet.desktop b/src/context/servicetypes/amarok_context_applet.desktop --- a/src/context/servicetypes/amarok_context_applet.desktop +++ b/src/context/servicetypes/amarok_context_applet.desktop @@ -1,5 +1,4 @@ [Desktop Entry] -Encoding=UTF-8 Type=ServiceType X-KDE-ServiceType=Plasma/Applet @@ -30,7 +29,7 @@ Comment[it]=Applet Contesto di Amarok Comment[ja]=Amarok 関連情報アプレット Comment[km]=អាប់ភ្លេត​បរិបទ​របស់ Amarok -Comment[ko]=Amarok 컨텍스트 애플릿 +Comment[ko]=Amarok 콘텍스트 애플릿 Comment[ku]=Apleta Naveroka Amarok Comment[lt]=Amarok informacijos įskiepis Comment[lv]=Amarok konteksta sīkrīks @@ -56,5 +55,4 @@ Comment[uk]=Аплет контексту Amarok Comment[wa]=Aplikete di contecse d' Amarok Comment[x-test]=xxAmarok Context appletxx -Comment[zh_CN]=Amarok 环境挂件 Comment[zh_TW]=Amarok 內容應用小程式 diff --git a/src/context/toolbar/AppletToolbarBase.h b/src/context/toolbar/AppletToolbarBase.h --- a/src/context/toolbar/AppletToolbarBase.h +++ b/src/context/toolbar/AppletToolbarBase.h @@ -25,10 +25,10 @@ class AppletToolbarBase : public QGraphicsWidget { public: - explicit AppletToolbarBase(QGraphicsItem* parent = 0, Qt::WindowFlags wFlags = 0); + explicit AppletToolbarBase(QGraphicsItem* parent = nullptr, Qt::WindowFlags wFlags = {}); ~AppletToolbarBase(); - virtual void paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0 ); + void paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = nullptr ) override; }; diff --git a/src/context/tools/amarokpkg.cpp b/src/context/tools/amarokpkg.cpp --- a/src/context/tools/amarokpkg.cpp +++ b/src/context/tools/amarokpkg.cpp @@ -48,8 +48,8 @@ void runKbuildsycoca() { - QDBusInterface dbus("org.kde.kded", "/kbuildsycoca", "org.kde.kbuildsycoca"); - dbus.call(QDBus::NoBlock, "recreate"); + QDBusInterface dbus(QStringLiteral("org.kde.kded"), QStringLiteral("/kbuildsycoca"), QStringLiteral("org.kde.kbuildsycoca")); + dbus.call(QDBus::NoBlock, QStringLiteral("recreate")); } QStringList packages() @@ -81,83 +81,83 @@ int main(int argc, char **argv) { - KAboutData aboutData("amarokpkg", i18n("Amarok Applet Manager"), + KAboutData aboutData(QStringLiteral("amarokpkg"), i18n("Amarok Applet Manager"), version, i18n(description), KAboutLicense::GPL, i18n("(C) 2008, Aaron Seigo, (C) 2009, Leo Franchi")); aboutData.addAuthor( i18n("Aaron Seigo"), i18n("Original author"), - "aseigo@kde.org" ); + QStringLiteral("aseigo@kde.org") ); aboutData.addAuthor( i18n( "Leo Franchi" ), i18n( "Developer" ) , - "lfranchi@kde.org" ); + QStringLiteral("lfranchi@kde.org") ); QApplication app(argc, argv); - app.setApplicationName("amarokpkg"); - app.setOrganizationDomain("kde.org"); + app.setApplicationName(QStringLiteral("amarokpkg")); + app.setOrganizationDomain(QStringLiteral("kde.org")); app.setApplicationDisplayName(i18n("Amarok Applet Manager")); app.setApplicationVersion(version); /** - * @TODO: DO WE NEED THIS ? + * TODO: DO WE NEED THIS ? */ KAboutData::setApplicationData(aboutData); QCommandLineParser parser; - parser.addOption(QCommandLineOption(QStringList() << "g" << "global", + parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("g") << QStringLiteral("global"), i18n("For install or remove, operates on applets installed for all users."))); - parser.addOption(QCommandLineOption(QStringList() << "s" << "i" << "install ", + parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("s") << QStringLiteral("i") << QStringLiteral("install "), i18nc("Do not translate ", "Install the applet at "))); - parser.addOption(QCommandLineOption(QStringList() << "u" << "upgrade ", + parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("u") << QStringLiteral("upgrade "), i18nc("Do not translate ", "Upgrade the applet at "))); - parser.addOption(QCommandLineOption(QStringList() << "l" << "list", + parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("l") << QStringLiteral("list"), i18n("Most installed applets"))); - parser.addOption(QCommandLineOption(QStringList() << "r" << "remove ", + parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("r") << QStringLiteral("remove "), i18nc("Do not translate ", "Remove the applet named "))); - parser.addOption(QCommandLineOption(QStringList() << "p" << "packageroot ", + parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("p") << QStringLiteral("packageroot "), i18n("Absolute path to the package root. If not supplied, then the standard data directories for this KDE session will be searched instead."))); parser.addVersionOption(); parser.addHelpOption(); aboutData.setupCommandLine(&parser); parser.process(app); aboutData.processCommandLine(&parser); - QString packageRoot = "kpackage/amarok"; + QString packageRoot = QStringLiteral("kpackage/amarok"); KPackage::Package *installer = 0; - if (parser.isSet("list")) { + if (parser.isSet(QStringLiteral("list"))) { listPackages(); } else { // install, remove or upgrade if (!installer) installer = new KPackage::Package(new AmarokContextPackageStructure); - if (parser.isSet("packageroot")) { - packageRoot = parser.value("packageroot"); - } else if (parser.isSet("global")) { + if (parser.isSet(QStringLiteral("packageroot"))) { + packageRoot = parser.value(QStringLiteral("packageroot")); + } else if (parser.isSet(QStringLiteral("global"))) { packageRoot = QStandardPaths::locate(QStandardPaths::GenericDataLocation, packageRoot); } else { //@FIXME Maybe we need to check whether the folders exist or not. packageRoot = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + packageRoot; } QString package; QString packageFile; - if (parser.isSet("remove")) { - package = parser.value("remove"); - } else if (parser.isSet("upgrade")) { - package = parser.value("upgrade"); - } else if (parser.isSet("install")) { - package = parser.value("install"); + if (parser.isSet(QStringLiteral("remove"))) { + package = parser.value(QStringLiteral("remove")); + } else if (parser.isSet(QStringLiteral("upgrade"))) { + package = parser.value(QStringLiteral("upgrade")); + } else if (parser.isSet(QStringLiteral("install"))) { + package = parser.value(QStringLiteral("install")); } if (!QDir::isAbsolutePath(package)) { - packageFile = QDir(QDir::currentPath() + '/' + package).absolutePath(); + packageFile = QDir(QDir::currentPath() + QLatin1Char('/') + package).absolutePath(); } else { packageFile = package; } - if (parser.isSet("remove") || parser.isSet("upgrade")) { + if (parser.isSet(QStringLiteral("remove")) || parser.isSet(QStringLiteral("upgrade"))) { installer->setPath(packageFile); KPluginMetaData metadata = installer->metadata(); @@ -174,16 +174,16 @@ if (installed.contains(pluginId)) { if (installer->uninstall(pluginId, packageRoot)) { output(i18n("Successfully removed %1", pluginId)); - } else if (!parser.isSet("upgrade")) { + } else if (!parser.isSet(QStringLiteral("upgrade"))) { output(i18n("Removal of %1 failed.", pluginId)); delete installer; return 1; } } else { output(i18n("Plugin %1 is not installed.", pluginId)); } } - if (parser.isSet("install") || parser.isSet("upgrade")) { + if (parser.isSet(QStringLiteral("install")) || parser.isSet(QStringLiteral("upgrade"))) { if (installer->install(packageFile, packageRoot)) { output(i18n("Successfully installed %1", packageFile)); runKbuildsycoca(); diff --git a/src/core-impl/capabilities/AlbumActionsCapability.h b/src/core-impl/capabilities/AlbumActionsCapability.h --- a/src/core-impl/capabilities/AlbumActionsCapability.h +++ b/src/core-impl/capabilities/AlbumActionsCapability.h @@ -34,7 +34,7 @@ * @param album album to create common actions for * @param actions custom actions to append after common actions */ - AlbumActionsCapability( Meta::AlbumPtr album, QList actions = QList() ); + explicit AlbumActionsCapability( const Meta::AlbumPtr &album, const QList &actions = QList() ); virtual ~AlbumActionsCapability(); protected: diff --git a/src/core-impl/capabilities/AlbumActionsCapability.cpp b/src/core-impl/capabilities/AlbumActionsCapability.cpp --- a/src/core-impl/capabilities/AlbumActionsCapability.cpp +++ b/src/core-impl/capabilities/AlbumActionsCapability.cpp @@ -27,25 +27,25 @@ Q_OBJECT public: - CompilationAction( QObject* parent, Meta::AlbumPtr album ) + CompilationAction( QObject* parent, const Meta::AlbumPtr &album ) : QAction( parent ) , m_album( album ) { connect( this, &CompilationAction::triggered, this, &CompilationAction::slotTriggered ); if( m_album->isCompilation() ) { - setIcon( QIcon::fromTheme( "filename-artist-amarok" ) ); + setIcon( QIcon::fromTheme( QStringLiteral("filename-artist-amarok") ) ); setText( i18n( "Do not show under Various Artists" ) ); } else { - setIcon( QIcon::fromTheme( "similarartists-amarok" ) ); + setIcon( QIcon::fromTheme( QStringLiteral("similarartists-amarok") ) ); setText( i18n( "Show under Various Artists" ) ); } setEnabled( m_album->canUpdateCompilation() ); } - private slots: + private Q_SLOTS: void slotTriggered() { if( !m_album->canUpdateCompilation() ) @@ -59,7 +59,7 @@ using namespace Capabilities; -AlbumActionsCapability::AlbumActionsCapability( Meta::AlbumPtr album, QList actions ) +AlbumActionsCapability::AlbumActionsCapability( const Meta::AlbumPtr &album, const QList &actions ) : ActionsCapability() { m_actions.append( new DisplayCoverAction( 0, album ) ); diff --git a/src/core-impl/capabilities/multisource/MultiSourceCapabilityImpl.h b/src/core-impl/capabilities/multisource/MultiSourceCapabilityImpl.h --- a/src/core-impl/capabilities/multisource/MultiSourceCapabilityImpl.h +++ b/src/core-impl/capabilities/multisource/MultiSourceCapabilityImpl.h @@ -28,13 +28,13 @@ Q_OBJECT public: - MultiSourceCapabilityImpl( Meta::MultiTrack *track ); + explicit MultiSourceCapabilityImpl( Meta::MultiTrack *track ); virtual ~MultiSourceCapabilityImpl(); - virtual QStringList sources() const; - virtual void setSource( int source ); - virtual int current() const; - virtual QUrl nextUrl() const; + QStringList sources() const override; + void setSource( int source ) override; + int current() const override; + QUrl nextUrl() const override; private: Meta::MultiTrack *m_track; diff --git a/src/core-impl/capabilities/timecode/TimecodeBoundedPlaybackCapability.h b/src/core-impl/capabilities/timecode/TimecodeBoundedPlaybackCapability.h --- a/src/core-impl/capabilities/timecode/TimecodeBoundedPlaybackCapability.h +++ b/src/core-impl/capabilities/timecode/TimecodeBoundedPlaybackCapability.h @@ -27,12 +27,12 @@ { Q_OBJECT public: - TimecodeBoundedPlaybackCapability( Meta::TimecodeTrack * track ) + explicit TimecodeBoundedPlaybackCapability( Meta::TimecodeTrack * track ) : m_track( track ) {} - virtual qint64 startPosition(); - virtual qint64 endPosition(); + qint64 startPosition() override; + qint64 endPosition() override; private: Meta::TimecodeTrack * m_track; diff --git a/src/core-impl/capabilities/timecode/TimecodeWriteCapability.h b/src/core-impl/capabilities/timecode/TimecodeWriteCapability.h --- a/src/core-impl/capabilities/timecode/TimecodeWriteCapability.h +++ b/src/core-impl/capabilities/timecode/TimecodeWriteCapability.h @@ -37,14 +37,14 @@ /** * Stores a timecode for the track - * @param seconds the position in seconds at which the timecide should be stored. + * @param miliseconds the position in milliseconds at which the timecide should be stored. * @return true if the write was successful, false if not. */ virtual bool writeTimecode ( qint64 miliseconds ) = 0; /** * Stores an auto timecode for the track and deletes any previously added auto timecodes - * @param seconds the position in seconds at which the timecide should be stored. + * @param miliseconds the position in milliseconds at which the timecide should be stored. * @return true if the write was successful, false if not. */ virtual bool writeAutoTimecode ( qint64 miliseconds ) = 0; @@ -60,7 +60,7 @@ protected: - bool writeTimecode( qint64 miliseconds, Meta::TrackPtr track ); + bool writeTimecode( qint64 miliseconds, const Meta::TrackPtr &track ); bool writeAutoTimecode( qint64 miliseconds, Meta::TrackPtr track ); }; diff --git a/src/core-impl/capabilities/timecode/TimecodeWriteCapability.cpp b/src/core-impl/capabilities/timecode/TimecodeWriteCapability.cpp --- a/src/core-impl/capabilities/timecode/TimecodeWriteCapability.cpp +++ b/src/core-impl/capabilities/timecode/TimecodeWriteCapability.cpp @@ -35,7 +35,7 @@ TimecodeWriteCapability::~TimecodeWriteCapability() {} -bool TimecodeWriteCapability::writeTimecode( qint64 miliseconds, Meta::TrackPtr track ) +bool TimecodeWriteCapability::writeTimecode( qint64 miliseconds, const Meta::TrackPtr &track ) { DEBUG_BLOCK AmarokUrl url = PlayUrlGenerator::instance()->createTrackBookmark( track, miliseconds ); @@ -69,8 +69,8 @@ BookmarkList list = tcl->loadTimecodes(); foreach( AmarokUrlPtr oldUrl, list ) { - if( oldUrl->command() == "play" ) { - if( oldUrl->customValue() == "auto timecode" ) { + if( oldUrl->command() == QLatin1String("play") ) { + if( oldUrl->customValue() == QLatin1String("auto timecode") ) { debug() << "deleting: " << oldUrl->name(); oldUrl->removeFromDb(); } @@ -89,23 +89,23 @@ { debug() << " current track"; QMap args = url.args(); - if ( args.keys().contains( "pos" ) ) + if ( args.keys().contains( QStringLiteral("pos") ) ) { - int pos = args.value( "pos" ).toInt(); + int pos = args.value( QStringLiteral("pos") ).toInt(); The::amarokUrlHandler()->paintNewTimecode( url.name(), pos * 1000 ); } } //change the name a little bit - url.setCustomValue( "auto timecode" ); + url.setCustomValue( QStringLiteral("auto timecode") ); - QString date = QDateTime::currentDateTime().toString( "dd.MM.yyyy" ); + QString date = QDateTime::currentDateTime().toString( QStringLiteral("dd.MM.yyyy") ); url.setName( i18n( "%1 - Stopped %2", track->prettyName(), date ) ); debug() << "creating new auto timecode: " << url.name(); //put in custom group to ensure that we do not clutter the list of bookmarks. - BookmarkGroupPtr parentPtr = BookmarkGroupPtr( new BookmarkGroup( i18n( "Playback Ended Markers" ), "auto_markers" ) ); + BookmarkGroupPtr parentPtr = BookmarkGroupPtr( new BookmarkGroup( i18n( "Playback Ended Markers" ), QStringLiteral("auto_markers") ) ); url.reparent( parentPtr ); //save it diff --git a/src/core-impl/collections/CMakeLists.txt b/src/core-impl/collections/CMakeLists.txt --- a/src/core-impl/collections/CMakeLists.txt +++ b/src/core-impl/collections/CMakeLists.txt @@ -14,10 +14,6 @@ add_subdirectory( mtpcollection ) add_subdirectory( umscollection ) add_subdirectory( db ) - -# only build playdarcollection if QJson was found -if( QJSON_FOUND ) - add_subdirectory( playdarcollection ) -endif() +add_subdirectory( playdarcollection ) add_subdirectory( upnpcollection ) #add_subdirectory( nepomukcollection ) diff --git a/src/core-impl/collections/aggregate/AggregateCollection.h b/src/core-impl/collections/aggregate/AggregateCollection.h --- a/src/core-impl/collections/aggregate/AggregateCollection.h +++ b/src/core-impl/collections/aggregate/AggregateCollection.h @@ -50,25 +50,25 @@ // Collections::Collection methods - virtual QString prettyName() const; - virtual QIcon icon() const; + QString prettyName() const override; + QIcon icon() const override; - virtual bool possiblyContainsTrack( const QUrl &url ) const; - virtual Meta::TrackPtr trackForUrl( const QUrl &url ); + bool possiblyContainsTrack( const QUrl &url ) const override; + Meta::TrackPtr trackForUrl( const QUrl &url ) override; - virtual QueryMaker* queryMaker(); + QueryMaker* queryMaker() override; - virtual QString collectionId() const; + QString collectionId() const override; // AggregateCollection methods void removeTrack( const Meta::TrackKey &key ); - Meta::AggregateTrack* getTrack( Meta::TrackPtr track ); + Meta::AggregateTrack* getTrack( const Meta::TrackPtr &track ); void setTrack( Meta::AggregateTrack *track ); bool hasTrack( const Meta::TrackKey &key ); void removeAlbum( const QString &album, const QString &albumArtist ); - Meta::AggregateAlbum* getAlbum( Meta::AlbumPtr album ); + Meta::AggregateAlbum* getAlbum( const Meta::AlbumPtr &album ); void setAlbum( Meta::AggregateAlbum *album ); bool hasAlbum( const QString &album, const QString &albumArtist ); diff --git a/src/core-impl/collections/aggregate/AggregateCollection.cpp b/src/core-impl/collections/aggregate/AggregateCollection.cpp --- a/src/core-impl/collections/aggregate/AggregateCollection.cpp +++ b/src/core-impl/collections/aggregate/AggregateCollection.cpp @@ -54,7 +54,7 @@ QIcon AggregateCollection::icon() const { - return QIcon::fromTheme("drive-harddisk"); + return QIcon::fromTheme(QStringLiteral("drive-harddisk")); } bool @@ -99,7 +99,7 @@ AggregateCollection::collectionId() const { // do we need more than one AggregateCollection? - return QLatin1String( "AggregateCollection" ); + return QStringLiteral( "AggregateCollection" ); } void @@ -113,28 +113,28 @@ m_idCollectionMap.insert( collection->collectionId(), collection ); //TODO - emit updated(); + Q_EMIT updated(); } void AggregateCollection::removeCollectionById( const QString &collectionId ) { m_idCollectionMap.remove( collectionId ); - emit updated(); + Q_EMIT updated(); } void AggregateCollection::removeCollection( Collections::Collection *collection ) { m_idCollectionMap.remove( collection->collectionId() ); - emit updated(); + Q_EMIT updated(); } void AggregateCollection::slotUpdated() { //TODO - emit updated(); + Q_EMIT updated(); } void @@ -335,7 +335,7 @@ } Meta::AggregateAlbum* -AggregateCollection::getAlbum( Meta::AlbumPtr album ) +AggregateCollection::getAlbum( const Meta::AlbumPtr &album ) { Meta::AlbumKey key( album ); m_albumLock.lockForRead(); @@ -384,7 +384,7 @@ } Meta::AggregateTrack* -AggregateCollection::getTrack( Meta::TrackPtr track ) +AggregateCollection::getTrack( const Meta::TrackPtr &track ) { const Meta::TrackKey key( track ); m_trackLock.lockForRead(); @@ -494,7 +494,7 @@ //elem.count() == 2 is correct because elem is one pointer to the object //and the other is stored in the hash map (except for m_trackMap, where - //another refence is stored in m_uidMap + //another reference is stored in m_uidMap #define foreachCollectGarbage( Key, Type, RefCount, x ) \ for( QMutableHashIterator iter(x); iter.hasNext(); ) \ { \ diff --git a/src/core-impl/collections/aggregate/AggregateMeta.h b/src/core-impl/collections/aggregate/AggregateMeta.h --- a/src/core-impl/collections/aggregate/AggregateMeta.h +++ b/src/core-impl/collections/aggregate/AggregateMeta.h @@ -34,72 +34,72 @@ { public: AggregateTrack( Collections::AggregateCollection *coll, const Meta::TrackPtr &track ); - ~AggregateTrack(); + ~AggregateTrack() override; - QString name() const; - QString prettyName() const; - virtual QString sortableName() const; + QString name() const override; + QString prettyName() const override; + QString sortableName() const override; - QUrl playableUrl() const; - QString prettyUrl() const; - QString uidUrl() const; + QUrl playableUrl() const override; + QString prettyUrl() const override; + QString uidUrl() const override; /** * Return a comma separated list of reasons why constituent * tracks are unplayable or an empty string if any of the tracks is playable */ - QString notPlayableReason() const; + QString notPlayableReason() const override; - Meta::AlbumPtr album() const; - Meta::ArtistPtr artist() const; - Meta::ComposerPtr composer() const; - Meta::GenrePtr genre() const; - Meta::YearPtr year() const; + Meta::AlbumPtr album() const override; + Meta::ArtistPtr artist() const override; + Meta::ComposerPtr composer() const override; + Meta::GenrePtr genre() const override; + Meta::YearPtr year() const override; - QString comment() const; - qreal bpm() const; + QString comment() const override; + qreal bpm() const override; - void finishedPlaying( double playedFraction ); + void finishedPlaying( double playedFraction ) override; - qint64 length() const; - int filesize() const; - int sampleRate() const; - int bitrate() const; - QDateTime createDate() const; - int trackNumber() const; - int discNumber() const; - QString type() const; + qint64 length() const override; + int filesize() const override; + int sampleRate() const override; + int bitrate() const override; + QDateTime createDate() const override; + int trackNumber() const override; + int discNumber() const override; + QString type() const override; - Collections::Collection* collection() const; + Collections::Collection* collection() const override; - virtual bool hasCapabilityInterface( Capabilities::Capability::Type type ) const; - virtual Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ); + bool hasCapabilityInterface( Capabilities::Capability::Type type ) const override; + Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ) override; - virtual void addLabel( const QString &label ); - virtual void addLabel( const Meta::LabelPtr &label ); - virtual void removeLabel( const Meta::LabelPtr &label ); - virtual Meta::LabelList labels() const; + void addLabel( const QString &label ) override; + void addLabel( const Meta::LabelPtr &label ) override; + void removeLabel( const Meta::LabelPtr &label ) override; + Meta::LabelList labels() const override; - virtual TrackEditorPtr editor(); - virtual StatisticsPtr statistics(); + TrackEditorPtr editor() override; + StatisticsPtr statistics() override; // Meta::Statistics methods: - double score() const; - void setScore( double newScore ); - int rating() const; - void setRating( int newRating ); - QDateTime firstPlayed() const; - void setFirstPlayed( const QDateTime &date ); - QDateTime lastPlayed() const; - void setLastPlayed( const QDateTime &date ); - int playCount() const; - void setPlayCount( int newPlayCount ); + double score() const override; + void setScore( double newScore ) override; + int rating() const override; + void setRating( int newRating ) override; + QDateTime firstPlayed() const override; + void setFirstPlayed( const QDateTime &date ) override; + QDateTime lastPlayed() const override; + void setLastPlayed( const QDateTime &date ) override; + int playCount() const override; + void setPlayCount( int newPlayCount ) override; void add( const Meta::TrackPtr &track ); protected: using Observer::metadataChanged; - virtual void metadataChanged( Meta::TrackPtr track ); + void metadataChanged( const Meta::TrackPtr &track ) override; private: Collections::AggregateCollection *m_collection; @@ -116,43 +116,43 @@ { public: AggregateAlbum( Collections::AggregateCollection *coll, Meta::AlbumPtr album ); - ~AggregateAlbum(); + ~AggregateAlbum() override; - QString name() const; - QString prettyName() const; - virtual QString sortableName() const; + QString name() const override; + QString prettyName() const override; + QString sortableName() const override; - Meta::TrackList tracks(); - Meta::ArtistPtr albumArtist() const; - bool isCompilation() const; - bool hasAlbumArtist() const; + Meta::TrackList tracks() override; + Meta::ArtistPtr albumArtist() const override; + bool isCompilation() const override; + bool hasAlbumArtist() const override; - virtual bool hasCapabilityInterface( Capabilities::Capability::Type type ) const; - virtual Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ); + bool hasCapabilityInterface( Capabilities::Capability::Type type ) const override; + Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ) override; - void add( Meta::AlbumPtr album ); + void add( const Meta::AlbumPtr &album ); /** returns true if the album has a cover set */ - virtual bool hasImage( int size = 0 ) const; + bool hasImage( int size = 0 ) const override; /** returns the cover of the album */ - virtual QImage image( int size = 0 ) const; + QImage image( int size = 0 ) const override; /** returns the image location on disk */ - virtual QUrl imageLocation( int size = 0 ); + QUrl imageLocation( int size = 0 ) override; /** returns the cover of the album with a nice border around it*/ virtual QPixmap imageWithBorder( int size = 0, int borderWidth = 5 ); /** Returns true if it is possible to update the cover of the album */ - virtual bool canUpdateImage() const; + bool canUpdateImage() const override; /** updates the cover of the album */ - virtual void setImage( const QImage &image ); - virtual void removeImage(); + void setImage( const QImage &image ) override; + void removeImage() override; /** don't automatically fetch artwork */ - virtual void setSuppressImageAutoFetch( const bool suppress ); + void setSuppressImageAutoFetch( const bool suppress ) override; /** should automatic artwork retrieval be suppressed? */ - virtual bool suppressImageAutoFetch() const; + bool suppressImageAutoFetch() const override; protected: using Observer::metadataChanged; - virtual void metadataChanged( Meta::AlbumPtr album ); + void metadataChanged(const Meta::AlbumPtr &album ) override; private: Collections::AggregateCollection *m_collection; @@ -164,23 +164,23 @@ class AMAROK_EXPORT AggregateArtist : public Meta::Artist, private Meta::Observer { public: - AggregateArtist( Collections::AggregateCollection *coll, Meta::ArtistPtr artist ); - ~AggregateArtist(); + AggregateArtist( Collections::AggregateCollection *coll, const Meta::ArtistPtr &artist ); + ~AggregateArtist() override; - QString name() const; - QString prettyName() const; - virtual QString sortableName() const; + QString name() const override; + QString prettyName() const override; + QString sortableName() const override; - Meta::TrackList tracks(); + Meta::TrackList tracks() override; - virtual bool hasCapabilityInterface( Capabilities::Capability::Type type ) const; - virtual Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ); + bool hasCapabilityInterface( Capabilities::Capability::Type type ) const override; + Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ) override; - void add( Meta::ArtistPtr artist ); + void add( const Meta::ArtistPtr &artist ); protected: using Observer::metadataChanged; - virtual void metadataChanged( Meta::ArtistPtr artist ); + void metadataChanged( const Meta::ArtistPtr &artist ) override; private: Collections::AggregateCollection *m_collection; @@ -191,23 +191,23 @@ class AMAROK_EXPORT AggregateGenre : public Meta::Genre, private Meta::Observer { public: - AggregateGenre( Collections::AggregateCollection *coll, Meta::GenrePtr genre ); + AggregateGenre( Collections::AggregateCollection *coll, const Meta::GenrePtr &genre ); ~AggregateGenre(); - QString name() const; - QString prettyName() const; - virtual QString sortableName() const; + QString name() const override; + QString prettyName() const override; + QString sortableName() const override; - Meta::TrackList tracks(); + Meta::TrackList tracks() override; - virtual bool hasCapabilityInterface( Capabilities::Capability::Type type ) const; - virtual Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ); + bool hasCapabilityInterface( Capabilities::Capability::Type type ) const override; + Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ) override; - void add( Meta::GenrePtr genre ); + void add( const Meta::GenrePtr &genre ); protected: using Observer::metadataChanged; - virtual void metadataChanged( Meta::GenrePtr genre ); + void metadataChanged( const Meta::GenrePtr &genre ) override; private: Collections::AggregateCollection *m_collection; @@ -218,23 +218,23 @@ class AMAROK_EXPORT AggregateComposer : public Meta::Composer, private Meta::Observer { public: - AggregateComposer( Collections::AggregateCollection *coll, Meta::ComposerPtr composer ); - ~AggregateComposer(); + AggregateComposer(Collections::AggregateCollection *coll, const ComposerPtr &composer ); + ~AggregateComposer() override; - QString name() const; - QString prettyName() const; - virtual QString sortableName() const; + QString name() const override; + QString prettyName() const override; + QString sortableName() const override; - Meta::TrackList tracks(); + Meta::TrackList tracks() override; - virtual bool hasCapabilityInterface( Capabilities::Capability::Type type ) const; - virtual Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ); + bool hasCapabilityInterface( Capabilities::Capability::Type type ) const override; + Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ) override; - void add( Meta::ComposerPtr composer ); + void add( const Meta::ComposerPtr &composer ); protected: using Observer::metadataChanged; - virtual void metadataChanged( Meta::ComposerPtr composer ); + void metadataChanged( const Meta::ComposerPtr &composer ) override; private: Collections::AggregateCollection *m_collection; @@ -245,26 +245,26 @@ class AMAROK_EXPORT AggreagateYear : public Meta::Year, private Meta::Observer { public: - AggreagateYear( Collections::AggregateCollection * coll, Meta::YearPtr year ); - ~AggreagateYear(); + AggreagateYear( Collections::AggregateCollection * coll, const Meta::YearPtr &year ); + ~AggreagateYear() override; - QString name() const; - QString prettyName() const; - virtual QString sortableName() const; + QString name() const override; + QString prettyName() const override; + QString sortableName() const override; - Meta::TrackList tracks(); + Meta::TrackList tracks() override; - virtual bool hasCapabilityInterface( Capabilities::Capability::Type type ) const; - virtual Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ); + bool hasCapabilityInterface( Capabilities::Capability::Type type ) const override; + Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ) override; /** * adds another Meta::Year instance to be proxied. */ - void add( Meta::YearPtr year ); + void add( const Meta::YearPtr &year ); protected: using Observer::metadataChanged; - virtual void metadataChanged( Meta::YearPtr year ); + void metadataChanged( const Meta::YearPtr &year ) override; private: Collections::AggregateCollection *m_collection; @@ -279,12 +279,12 @@ AggregateLabel( Collections::AggregateCollection *coll, const Meta::LabelPtr &label ); virtual ~AggregateLabel(); - virtual QString name() const; - virtual QString prettyName() const; - virtual QString sortableName() const; + QString name() const override; + QString prettyName() const override; + QString sortableName() const override; - virtual bool hasCapabilityInterface( Capabilities::Capability::Type type ) const; - virtual Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ); + bool hasCapabilityInterface( Capabilities::Capability::Type type ) const override; + Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ) override; /** adds another Meta::Label instance to be proxied. diff --git a/src/core-impl/collections/aggregate/AggregateMeta.cpp b/src/core-impl/collections/aggregate/AggregateMeta.cpp --- a/src/core-impl/collections/aggregate/AggregateMeta.cpp +++ b/src/core-impl/collections/aggregate/AggregateMeta.cpp @@ -44,28 +44,28 @@ , m_editors( editors ) {} - void beginUpdate() + void beginUpdate() override { m_batchMode = true; foreach( TrackEditorPtr ec, m_editors ) ec->beginUpdate(); } - void endUpdate() + void endUpdate() override { foreach( TrackEditorPtr ec, m_editors ) ec->endUpdate(); m_batchMode = false; QTimer::singleShot( 0, m_collection, &Collections::AggregateCollection::slotUpdated ); } - void setComment( const QString &newComment ) { FORWARD( setComment( newComment ) ) } - void setTrackNumber( int newTrackNumber ) { FORWARD( setTrackNumber( newTrackNumber ) ) } - void setDiscNumber( int newDiscNumber ) { FORWARD( setDiscNumber( newDiscNumber ) ) } - void setBpm( const qreal newBpm ) { FORWARD( setBpm( newBpm ) ) } - void setTitle( const QString &newTitle ) { FORWARD( setTitle( newTitle ) ) } - void setArtist( const QString &newArtist ) { FORWARD( setArtist( newArtist ) ) } - void setAlbum( const QString &newAlbum ) { FORWARD( setAlbum( newAlbum ) ) } - void setAlbumArtist( const QString &newAlbumArtist ) { FORWARD( setAlbumArtist ( newAlbumArtist ) ) } - void setGenre( const QString &newGenre ) { FORWARD( setGenre( newGenre ) ) } - void setComposer( const QString &newComposer ) { FORWARD( setComposer( newComposer ) ) } - void setYear( int newYear ) { FORWARD( setYear( newYear ) ) } + void setComment( const QString &newComment ) override { FORWARD( setComment( newComment ) ) } + void setTrackNumber( int newTrackNumber ) override { FORWARD( setTrackNumber( newTrackNumber ) ) } + void setDiscNumber( int newDiscNumber ) override { FORWARD( setDiscNumber( newDiscNumber ) ) } + void setBpm( const qreal newBpm ) override { FORWARD( setBpm( newBpm ) ) } + void setTitle( const QString &newTitle ) override { FORWARD( setTitle( newTitle ) ) } + void setArtist( const QString &newArtist ) override { FORWARD( setArtist( newArtist ) ) } + void setAlbum( const QString &newAlbum ) override { FORWARD( setAlbum( newAlbum ) ) } + void setAlbumArtist( const QString &newAlbumArtist ) override { FORWARD( setAlbumArtist ( newAlbumArtist ) ) } + void setGenre( const QString &newGenre ) override { FORWARD( setGenre( newGenre ) ) } + void setComposer( const QString &newComposer ) override { FORWARD( setComposer( newComposer ) ) } + void setYear( int newYear ) override { FORWARD( setYear( newYear ) ) } private: bool m_batchMode; Collections::AggregateCollection *m_collection; @@ -79,11 +79,11 @@ , Observer() , m_collection( coll ) , m_name( track->name() ) - , m_album( 0 ) - , m_artist( 0 ) - , m_genre( 0 ) - , m_composer( 0 ) - , m_year( 0 ) + , m_album( nullptr ) + , m_artist( nullptr ) + , m_genre( nullptr ) + , m_composer( nullptr ) + , m_year( nullptr ) { subscribeTo( track ); m_tracks.append( track ); @@ -187,7 +187,7 @@ else return QString(); // no reason if at least one playable } - return reasons.join( QString( ", " ) ); + return reasons.join( QStringLiteral( ", " ) ); } Meta::AlbumPtr @@ -553,7 +553,7 @@ if( m_tracks.count() == 1 ) return m_tracks.first()->createCapabilityInterface( type ); else - return 0; + return nullptr; } TrackEditorPtr @@ -639,7 +639,7 @@ } void -AggregateTrack::metadataChanged( Meta::TrackPtr track ) +AggregateTrack::metadataChanged(const TrackPtr &track ) { if( !track ) return; @@ -797,12 +797,12 @@ } else { - return 0; + return nullptr; } } void -AggregateAlbum::add( Meta::AlbumPtr album ) +AggregateAlbum::add( const Meta::AlbumPtr &album ) { if( !album || m_albums.contains( album ) ) return; @@ -870,12 +870,12 @@ bool AggregateAlbum::canUpdateImage() const { - if( m_albums.count() == 0 ) + if( m_albums.isEmpty() ) return false; foreach( const Meta::AlbumPtr &album, m_albums ) { - //we can only update the image for all albusm at the same time + //we can only update the image for all albums at the same time if( !album->canUpdateImage() ) return false; } @@ -921,7 +921,7 @@ } void -AggregateAlbum::metadataChanged( Meta::AlbumPtr album ) +AggregateAlbum::metadataChanged(const AlbumPtr &album ) { if( !album || !m_albums.contains( album ) ) return; @@ -953,7 +953,7 @@ notifyObservers(); } -AggregateArtist::AggregateArtist( Collections::AggregateCollection *coll, Meta::ArtistPtr artist ) +AggregateArtist::AggregateArtist( Collections::AggregateCollection *coll, const Meta::ArtistPtr &artist ) : Meta::Artist() , Meta::Observer() , m_collection( coll ) @@ -1032,12 +1032,12 @@ } else { - return 0; + return nullptr; } } void -AggregateArtist::add( Meta::ArtistPtr artist ) +AggregateArtist::add( const Meta::ArtistPtr &artist ) { if( !artist || m_artists.contains( artist ) ) return; @@ -1049,7 +1049,7 @@ } void -AggregateArtist::metadataChanged( Meta::ArtistPtr artist ) +AggregateArtist::metadataChanged(const ArtistPtr &artist ) { if( !artist || !m_artists.contains( artist ) ) return; @@ -1079,7 +1079,7 @@ notifyObservers(); } -AggregateGenre::AggregateGenre( Collections::AggregateCollection *coll, Meta::GenrePtr genre ) +AggregateGenre::AggregateGenre( Collections::AggregateCollection *coll, const Meta::GenrePtr &genre ) : Meta::Genre() , Meta::Observer() , m_collection( coll ) @@ -1158,12 +1158,12 @@ } else { - return 0; + return nullptr; } } void -AggregateGenre::add( Meta::GenrePtr genre ) +AggregateGenre::add( const Meta::GenrePtr &genre ) { if( !genre || m_genres.contains( genre ) ) return; @@ -1175,7 +1175,7 @@ } void -AggregateGenre::metadataChanged( Meta::GenrePtr genre ) +AggregateGenre::metadataChanged( const Meta::GenrePtr &genre ) { if( !genre || !m_genres.contains( genre ) ) return; @@ -1199,7 +1199,7 @@ notifyObservers(); } -AggregateComposer::AggregateComposer( Collections::AggregateCollection *coll, Meta::ComposerPtr composer ) +AggregateComposer::AggregateComposer( Collections::AggregateCollection *coll, const Meta::ComposerPtr &composer ) : Meta::Composer() , Meta::Observer() , m_collection( coll ) @@ -1278,12 +1278,12 @@ } else { - return 0; + return nullptr; } } void -AggregateComposer::add( Meta::ComposerPtr composer ) +AggregateComposer::add( const Meta::ComposerPtr &composer ) { if( !composer || m_composers.contains( composer ) ) return; @@ -1295,7 +1295,7 @@ } void -AggregateComposer::metadataChanged( Meta::ComposerPtr composer ) +AggregateComposer::metadataChanged(const ComposerPtr &composer ) { if( !composer || !m_composers.contains( composer ) ) return; @@ -1319,7 +1319,7 @@ notifyObservers(); } -AggreagateYear::AggreagateYear( Collections::AggregateCollection *coll, Meta::YearPtr year ) +AggreagateYear::AggreagateYear( Collections::AggregateCollection *coll, const Meta::YearPtr &year ) : Meta::Year() , Meta::Observer() , m_collection( coll ) @@ -1399,12 +1399,12 @@ } else { - return 0; + return nullptr; } } void -AggreagateYear::add( Meta::YearPtr year ) +AggreagateYear::add( const Meta::YearPtr &year ) { if( !year || m_years.contains( year ) ) return; @@ -1416,7 +1416,7 @@ } void -AggreagateYear::metadataChanged( Meta::YearPtr year ) +AggreagateYear::metadataChanged( const Meta::YearPtr &year ) { if( !year || !m_years.contains( year ) ) return; @@ -1516,7 +1516,7 @@ } else { - return 0; + return nullptr; } } diff --git a/src/core-impl/collections/aggregate/AggregateQueryMaker.h b/src/core-impl/collections/aggregate/AggregateQueryMaker.h --- a/src/core-impl/collections/aggregate/AggregateQueryMaker.h +++ b/src/core-impl/collections/aggregate/AggregateQueryMaker.h @@ -43,37 +43,37 @@ AggregateQueryMaker( Collections::AggregateCollection *collection, const QList &queryMakers ); ~AggregateQueryMaker(); - virtual void run(); - virtual void abortQuery(); + void run() override; + void abortQuery() override; - virtual QueryMaker* setQueryType( QueryType type ); + QueryMaker* setQueryType( QueryType type ) override; - virtual QueryMaker* addReturnValue( qint64 value); - virtual QueryMaker* addReturnFunction( ReturnFunction function, qint64 value ); - virtual QueryMaker* orderBy( qint64 value, bool descending = false ); + QueryMaker* addReturnValue( qint64 value) override; + QueryMaker* addReturnFunction( ReturnFunction function, qint64 value ) override; + QueryMaker* orderBy( qint64 value, bool descending = false ) override; - virtual QueryMaker* addMatch( const Meta::TrackPtr &track ); - virtual QueryMaker* addMatch( const Meta::ArtistPtr &artist, ArtistMatchBehaviour behaviour = TrackArtists ); - virtual QueryMaker* addMatch( const Meta::AlbumPtr &album ); - virtual QueryMaker* addMatch( const Meta::ComposerPtr &composer ); - virtual QueryMaker* addMatch( const Meta::GenrePtr &genre ); - virtual QueryMaker* addMatch( const Meta::YearPtr &year ); - virtual QueryMaker* addMatch( const Meta::LabelPtr &label ); + QueryMaker* addMatch( const Meta::TrackPtr &track ) override; + QueryMaker* addMatch( const Meta::ArtistPtr &artist, ArtistMatchBehaviour behaviour = TrackArtists ) override; + QueryMaker* addMatch( const Meta::AlbumPtr &album ) override; + QueryMaker* addMatch( const Meta::ComposerPtr &composer ) override; + QueryMaker* addMatch( const Meta::GenrePtr &genre ) override; + QueryMaker* addMatch( const Meta::YearPtr &year ) override; + QueryMaker* addMatch( const Meta::LabelPtr &label ) override; - virtual QueryMaker* addFilter( qint64 value, const QString &filter, bool matchBegin, bool matchEnd ); - virtual QueryMaker* excludeFilter( qint64 value, const QString &filter, bool matchBegin, bool matchEnd ); + QueryMaker* addFilter( qint64 value, const QString &filter, bool matchBegin, bool matchEnd ) override; + QueryMaker* excludeFilter( qint64 value, const QString &filter, bool matchBegin, bool matchEnd ) override; - virtual QueryMaker* addNumberFilter( qint64 value, qint64 filter, QueryMaker::NumberComparison compare ); - virtual QueryMaker* excludeNumberFilter( qint64 value, qint64 filter, QueryMaker::NumberComparison compare ); + QueryMaker* addNumberFilter( qint64 value, qint64 filter, QueryMaker::NumberComparison compare ) override; + QueryMaker* excludeNumberFilter( qint64 value, qint64 filter, QueryMaker::NumberComparison compare ) override; - virtual QueryMaker* limitMaxResultSize( int size ); + QueryMaker* limitMaxResultSize( int size ) override; - virtual QueryMaker* beginAnd(); - virtual QueryMaker* beginOr(); - virtual QueryMaker* endAndOr(); + QueryMaker* beginAnd() override; + QueryMaker* beginOr() override; + QueryMaker* endAndOr() override; - virtual QueryMaker* setAlbumQueryMode( AlbumQueryMode mode ); - virtual QueryMaker* setLabelQueryMode( LabelQueryMode mode ); + QueryMaker* setAlbumQueryMode( AlbumQueryMode mode ) override; + QueryMaker* setLabelQueryMode( LabelQueryMode mode ) override; private: void handleResult(); diff --git a/src/core-impl/collections/aggregate/AggregateQueryMaker.cpp b/src/core-impl/collections/aggregate/AggregateQueryMaker.cpp --- a/src/core-impl/collections/aggregate/AggregateQueryMaker.cpp +++ b/src/core-impl/collections/aggregate/AggregateQueryMaker.cpp @@ -305,7 +305,7 @@ //make sure we don't give control to code outside this class while holding the lock m_queryDoneCountMutex.unlock(); handleResult(); - emit queryDone(); + Q_EMIT queryDone(); } else { @@ -358,7 +358,7 @@ count++; } } - emit newResultReady( result ); + Q_EMIT newResultReady( result ); break; } case QueryMaker::Track : @@ -380,7 +380,7 @@ if ( m_maxResultSize >= 0 && tracks.count() > m_maxResultSize ) tracks = tracks.mid( 0, m_maxResultSize ); - emit newTracksReady(tracks); + Q_EMIT newTracksReady(tracks); break; } case QueryMaker::Album : @@ -396,7 +396,7 @@ if ( m_maxResultSize >= 0 && albums.count() > m_maxResultSize ) albums = albums.mid( 0, m_maxResultSize ); - emit newAlbumsReady(albums); + Q_EMIT newAlbumsReady(albums); break; } case QueryMaker::Artist : @@ -413,7 +413,7 @@ if ( m_maxResultSize >= 0 && artists.count() > m_maxResultSize ) artists = artists.mid( 0, m_maxResultSize ); - emit newArtistsReady(artists); + Q_EMIT newArtistsReady(artists); break; } case QueryMaker::Composer : @@ -429,7 +429,7 @@ if ( m_maxResultSize >= 0 && composers.count() > m_maxResultSize ) composers = composers.mid( 0, m_maxResultSize ); - emit newComposersReady(composers); + Q_EMIT newComposersReady(composers); break; } case QueryMaker::Genre : @@ -445,7 +445,7 @@ if ( m_maxResultSize >= 0 && genres.count() > m_maxResultSize ) genres = genres.mid( 0, m_maxResultSize ); - emit newGenresReady(genres); + Q_EMIT newGenresReady(genres); break; } case QueryMaker::Year : @@ -465,7 +465,7 @@ if ( m_maxResultSize >= 0 && years.count() > m_maxResultSize ) years = years.mid( 0, m_maxResultSize ); - emit newYearsReady(years); + Q_EMIT newYearsReady(years); break; } case QueryMaker::Label : @@ -481,7 +481,7 @@ if ( m_maxResultSize >= 0 && labels.count() > m_maxResultSize ) labels = labels.mid( 0, m_maxResultSize ); - emit newLabelsReady(labels); + Q_EMIT newLabelsReady(labels); break; } case QueryMaker::None : diff --git a/src/core-impl/collections/audiocd/AudioCdCollection.h b/src/core-impl/collections/audiocd/AudioCdCollection.h --- a/src/core-impl/collections/audiocd/AudioCdCollection.h +++ b/src/core-impl/collections/audiocd/AudioCdCollection.h @@ -29,7 +29,7 @@ #include class MediaDeviceInfo; - +class KJob; namespace Collections { class AudioCdCollection; @@ -42,7 +42,7 @@ public: AudioCdCollectionFactory(); - virtual ~AudioCdCollectionFactory() {}; + virtual ~AudioCdCollectionFactory() {} /* virtual void init(); @@ -59,7 +59,7 @@ /** - * This is a Memorycollection sublclass that uses the KIO audiocd:/ slave to + * This is a Memorycollection subclass that uses the KIO audiocd:/ slave to * populate itself whenever it detects a CD. * * @author Nikolaj Hald Nielsen @@ -71,30 +71,30 @@ enum { WAV, FLAC, OGG, MP3 } EncodingFormat; - AudioCdCollection( MediaDeviceInfo* info ); + explicit AudioCdCollection( MediaDeviceInfo* info ); ~AudioCdCollection(); QString encodingFormat() const; QString copyableFilePath( const QString &fileName ) const; void setEncodingFormat( int format ) const; - virtual QString collectionId() const; - virtual QString prettyName() const; - virtual QIcon icon() const; + QString collectionId() const override; + QString prettyName() const override; + QIcon icon() const override; - virtual CollectionLocation* location(); + CollectionLocation* location() override; - virtual bool possiblyContainsTrack( const QUrl &url ) const; - virtual Meta::TrackPtr trackForUrl( const QUrl &url ); + bool possiblyContainsTrack( const QUrl &url ) const override; + Meta::TrackPtr trackForUrl( const QUrl &url ) override; void cdRemoved(); virtual void startFullScan(); //Override this one as I really don't want to move parsing to the handler atm. - virtual void startFullScanDevice() { startFullScan(); } + void startFullScanDevice() override { startFullScan(); } public Q_SLOTS: - virtual void eject(); + void eject() override; private Q_SLOTS: void audioCdEntries( KIO::Job *job, const KIO::UDSEntryList &list ); diff --git a/src/core-impl/collections/audiocd/AudioCdCollection.cpp b/src/core-impl/collections/audiocd/AudioCdCollection.cpp --- a/src/core-impl/collections/audiocd/AudioCdCollection.cpp +++ b/src/core-impl/collections/audiocd/AudioCdCollection.cpp @@ -87,7 +87,7 @@ { QUrl url("audiocd:/"); url = url.adjusted(QUrl::StripTrailingSlash); - url.setPath(url.path() + '/' + ( path )); + url.setPath(url.path() + QLatin1Char('/') + ( path )); if( !m_device.isEmpty() ) { @@ -285,7 +285,7 @@ baseFileName.replace( "%{genre}", genre, Qt::CaseInsensitive ); //we hack the url so the engine controller knows what track on the CD to play.. - QUrl baseUrl = audiocdUrl( m_discCddbId + '/' + QString::number( i + 1 ) ); + QUrl baseUrl = audiocdUrl( m_discCddbId + QLatin1Char('/') + QString::number( i + 1 ) ); debug() << "Track Base File Name (after): " << baseFileName; debug() << "Track url: " << baseUrl; @@ -331,7 +331,7 @@ The::coverFetcher()->queueAlbum( Meta::AlbumPtr::staticCast( albumPtr ) ); updateProxyTracks(); - emit collectionReady( this ); + Q_EMIT collectionReady( this ); } void @@ -349,7 +349,7 @@ QString AudioCdCollection::trackBaseFileName( int i ) const { - return QString( "Track%1" ).arg( i, 2, 10, QChar('0') ); + return QStringLiteral( "Track%1" ).arg( i, 2, 10, QChar('0') ); } @@ -402,7 +402,7 @@ void AudioCdCollection::cdRemoved() { - emit remove(); + Q_EMIT remove(); } QString @@ -511,7 +511,7 @@ debug() << "got track url: " << audiocdUrl( trackWav ); //we hack the url so the engine controller knows what track on the CD to play.. - QUrl baseUrl = audiocdUrl( m_discCddbId + '/' + QString::number( i ) ); + QUrl baseUrl = audiocdUrl( m_discCddbId + QLatin1Char('/') + QString::number( i ) ); Meta::AudioCdTrackPtr trackPtr = Meta::AudioCdTrackPtr( new Meta::AudioCdTrack( this, trackDisplayName( i ), baseUrl ) ); @@ -541,7 +541,7 @@ } updateProxyTracks(); - emit collectionReady( this ); + Q_EMIT collectionReady( this ); } void @@ -602,7 +602,7 @@ { QString urlString = url.url().remove( "audiocd:/" ); - const QStringList &parts = urlString.split( '/' ); + const QStringList &parts = urlString.split( QLatin1Char('/') ); if( parts.count() != 2 ) continue; diff --git a/src/core-impl/collections/audiocd/AudioCdCollectionLocation.h b/src/core-impl/collections/audiocd/AudioCdCollectionLocation.h --- a/src/core-impl/collections/audiocd/AudioCdCollectionLocation.h +++ b/src/core-impl/collections/audiocd/AudioCdCollectionLocation.h @@ -32,12 +32,12 @@ { Q_OBJECT public: - AudioCdCollectionLocation( AudioCdCollection *parentCollection ); + explicit AudioCdCollectionLocation( AudioCdCollection *parentCollection ); ~AudioCdCollectionLocation(); - virtual void getKIOCopyableUrls( const Meta::TrackList &tracks ); + void getKIOCopyableUrls( const Meta::TrackList &tracks ) override; - virtual void showSourceDialog( const Meta::TrackList &tracks, bool removeSources ); + void showSourceDialog( const Meta::TrackList &tracks, bool removeSources ) override; private Q_SLOTS: void formatSelected( int format ); diff --git a/src/core-impl/collections/audiocd/AudioCdCollectionLocation.cpp b/src/core-impl/collections/audiocd/AudioCdCollectionLocation.cpp --- a/src/core-impl/collections/audiocd/AudioCdCollectionLocation.cpp +++ b/src/core-impl/collections/audiocd/AudioCdCollectionLocation.cpp @@ -42,7 +42,7 @@ { Meta::AudioCdTrackPtr cdTrack = Meta::AudioCdTrackPtr::staticCast( trackPtr ); - const QString path = m_collection->copyableFilePath( cdTrack->fileNameBase() + '.' + m_collection->encodingFormat() ); + const QString path = m_collection->copyableFilePath( cdTrack->fileNameBase() + QLatin1Char('.') + m_collection->encodingFormat() ); resultMap.insert( trackPtr, QUrl::fromLocalFile( path ) ); } diff --git a/src/core-impl/collections/audiocd/AudioCdMeta.h b/src/core-impl/collections/audiocd/AudioCdMeta.h --- a/src/core-impl/collections/audiocd/AudioCdMeta.h +++ b/src/core-impl/collections/audiocd/AudioCdMeta.h @@ -47,42 +47,42 @@ AudioCdTrack( Collections::AudioCdCollection *collection, const QString &name, const QUrl &url ); virtual ~AudioCdTrack(); - virtual QString name() const; + QString name() const override; - virtual QUrl playableUrl() const; - virtual QString uidUrl() const; - virtual QString prettyUrl() const; - virtual QString notPlayableReason() const; + QUrl playableUrl() const override; + QString uidUrl() const override; + QString prettyUrl() const override; + QString notPlayableReason() const override; - virtual AlbumPtr album() const; - virtual ArtistPtr artist() const; - virtual GenrePtr genre() const; - virtual ComposerPtr composer() const; - virtual YearPtr year() const; + AlbumPtr album() const override; + ArtistPtr artist() const override; + GenrePtr genre() const override; + ComposerPtr composer() const override; + YearPtr year() const override; virtual void setTitle( const QString &newTitle ); - virtual qreal bpm() const; + qreal bpm() const override; - virtual QString comment() const; + QString comment() const override; virtual void setComment ( const QString &newComment ); - virtual qint64 length() const; + qint64 length() const override; - virtual int filesize() const; - virtual int sampleRate() const; - virtual int bitrate() const; + int filesize() const override; + int sampleRate() const override; + int bitrate() const override; - virtual int trackNumber() const; + int trackNumber() const override; virtual void setTrackNumber ( int newTrackNumber ); - virtual int discNumber() const; + int discNumber() const override; virtual void setDiscNumber ( int newDiscNumber ); - virtual QString type() const; + QString type() const override; - virtual bool inCollection() const; - virtual Collections::Collection* collection() const; + bool inCollection() const override; + Collections::Collection* collection() const override; //AudioCdTrack specific methods void setAlbum( AudioCdAlbumPtr album ); @@ -115,12 +115,12 @@ class AudioCdArtist : public Meta::Artist { public: - AudioCdArtist( const QString &name ); - virtual ~AudioCdArtist(); + explicit AudioCdArtist( const QString &name ); + ~AudioCdArtist() override; - virtual QString name() const; + QString name() const override; - virtual TrackList tracks(); + TrackList tracks() override; virtual AlbumList albums(); @@ -135,23 +135,23 @@ class AudioCdAlbum : public Meta::Album { public: - AudioCdAlbum( const QString &name ); - virtual ~AudioCdAlbum(); + explicit AudioCdAlbum( const QString &name ); + ~AudioCdAlbum() override; - virtual QString name() const; + QString name() const override; - virtual bool isCompilation() const; - virtual bool canUpdateCompilation() const; - virtual void setCompilation( bool compilation ); + bool isCompilation() const override; + bool canUpdateCompilation() const override; + void setCompilation( bool compilation ) override; - virtual bool hasAlbumArtist() const; - virtual ArtistPtr albumArtist() const; - virtual TrackList tracks(); + bool hasAlbumArtist() const override; + ArtistPtr albumArtist() const override; + TrackList tracks() override; - virtual QImage image( int size = 0 ) const; - virtual bool hasImage( int size = 0 ) const; - virtual bool canUpdateImage() const; - virtual void setImage( const QImage &image ); + QImage image( int size = 0 ) const override; + bool hasImage( int size = 0 ) const override; + bool canUpdateImage() const override; + void setImage( const QImage &image ) override; //AudioCdAlbum specific methods void addTrack( AudioCdTrackPtr track ); @@ -168,12 +168,12 @@ class AudioCdGenre : public Meta::Genre { public: - AudioCdGenre( const QString &name ); - virtual ~AudioCdGenre(); + explicit AudioCdGenre( const QString &name ); + ~AudioCdGenre() override; - virtual QString name() const; + QString name() const override; - virtual TrackList tracks(); + TrackList tracks() override; //AudioCdGenre specific methods void addTrack( AudioCdTrackPtr track ); @@ -186,12 +186,12 @@ class AudioCdComposer : public Meta::Composer { public: - AudioCdComposer( const QString &name ); - virtual ~AudioCdComposer(); + explicit AudioCdComposer( const QString &name ); + ~AudioCdComposer() override; - virtual QString name() const; + QString name() const override; - virtual TrackList tracks(); + TrackList tracks() override; //AudioCdComposer specific methods void addTrack( AudioCdTrackPtr track ); @@ -204,12 +204,12 @@ class AudioCdYear : public Meta::Year { public: - AudioCdYear( const QString &name ); - virtual ~AudioCdYear(); + explicit AudioCdYear( const QString &name ); + ~AudioCdYear() override; - virtual QString name() const; + QString name() const override; - virtual TrackList tracks(); + TrackList tracks() override; //AudioCdYear specific methods void addTrack( AudioCdTrackPtr track ); diff --git a/src/core-impl/collections/audiocd/AudioCdMeta.cpp b/src/core-impl/collections/audiocd/AudioCdMeta.cpp --- a/src/core-impl/collections/audiocd/AudioCdMeta.cpp +++ b/src/core-impl/collections/audiocd/AudioCdMeta.cpp @@ -70,7 +70,7 @@ QString AudioCdTrack::notPlayableReason() const { - //TODO: check availablity of correct CD somehow + //TODO: check availability of correct CD somehow return QString(); } diff --git a/src/core-impl/collections/audiocd/CMakeLists.txt b/src/core-impl/collections/audiocd/CMakeLists.txt --- a/src/core-impl/collections/audiocd/CMakeLists.txt +++ b/src/core-impl/collections/audiocd/CMakeLists.txt @@ -39,6 +39,6 @@ set_target_properties(amarok_collection-audiocdcollection PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") endif() -install(TARGETS amarok_collection-audiocdcollection DESTINATION ${PLUGIN_INSTALL_DIR} ) +install(TARGETS amarok_collection-audiocdcollection DESTINATION ${KDE_INSTALL_PLUGINDIR} ) kcoreaddons_desktop_to_json(amarok_collection-audiocdcollection amarok_collection-audiocdcollection.desktop SERVICE_TYPES ${CMAKE_SOURCE_DIR}/src/amarok-plugin.desktop) diff --git a/src/core-impl/collections/audiocd/FormatSelectionDialog.h b/src/core-impl/collections/audiocd/FormatSelectionDialog.h --- a/src/core-impl/collections/audiocd/FormatSelectionDialog.h +++ b/src/core-impl/collections/audiocd/FormatSelectionDialog.h @@ -32,12 +32,12 @@ { Q_OBJECT public: - FormatSelectionDialog( QWidget *parent = 0 ); + explicit FormatSelectionDialog( QWidget *parent = nullptr ); ~FormatSelectionDialog(); public Q_SLOTS: - virtual void accept(); + void accept() override; virtual void showAdvancedSettings(); diff --git a/src/core-impl/collections/audiocd/FormatSelectionDialog.cpp b/src/core-impl/collections/audiocd/FormatSelectionDialog.cpp --- a/src/core-impl/collections/audiocd/FormatSelectionDialog.cpp +++ b/src/core-impl/collections/audiocd/FormatSelectionDialog.cpp @@ -104,7 +104,7 @@ KConfigGroup config = Amarok::config("Audio CD Collection"); config.writeEntry( "Import Format", format ); - emit formatSelected( m_selectedFormat ); + Q_EMIT formatSelected( m_selectedFormat ); QDialog::accept(); } diff --git a/src/core-impl/collections/audiocd/amarok_collection-audiocdcollection.desktop b/src/core-impl/collections/audiocd/amarok_collection-audiocdcollection.desktop --- a/src/core-impl/collections/audiocd/amarok_collection-audiocdcollection.desktop +++ b/src/core-impl/collections/audiocd/amarok_collection-audiocdcollection.desktop @@ -50,7 +50,6 @@ Name[uk]=Збірка звукових КД Name[wa]=Ramexhnêye di plakes lazer odio Name[x-test]=xxAudioCd Collectionxx -Name[zh_CN]=音频 CD 收藏 Name[zh_TW]=音效 CD 收藏 Comment=AudioCd collection plugin for Amarok Comment[bg]=Приставка за колекция с компактдискове (Amarok) @@ -76,7 +75,7 @@ Comment[it]=Estensione CD audio della collezione di Amarok Comment[ja]=Amarok の オーディオ CD コレクションプラグイン Comment[km]=កម្មវិធី​ជំនួយ​សម្រាំង​ស៊ីឌី​អូឌីយ៉ូ​​សម្រាប់ Amarok -Comment[ko]=Amarok의 오디오 CD 모음집 플러그인 +Comment[ko]=Amarok용 오디오 CD 모음집 플러그인 Comment[lt]=Garso CD fonotekos Amarok papildinys Comment[lv]=AudioCd kolekcijas Amarok spraudnis Comment[nb]=LydCD-samling programtillegg for Amarok @@ -101,7 +100,6 @@ Comment[uk]=Додаток збірки звукових КД для Amarok Comment[wa]=Tchôke-divins di ramexhnêye d' plakes lazer odio po Amarok Comment[x-test]=xxAudioCd collection plugin for Amarokxx -Comment[zh_CN]=Amarok 的音频 CD 收藏插件 Comment[zh_TW]=Amarok 的音效 CD 收藏外掛程式 ServiceTypes=Amarok/Plugin diff --git a/src/core-impl/collections/audiocd/handler/AudioCdHandler.h b/src/core-impl/collections/audiocd/handler/AudioCdHandler.h --- a/src/core-impl/collections/audiocd/handler/AudioCdHandler.h +++ b/src/core-impl/collections/audiocd/handler/AudioCdHandler.h @@ -29,13 +29,13 @@ class AudioCdHandler : public MediaDeviceHandler { public: - AudioCdHandler( QObject *parent ); + explicit AudioCdHandler( QObject *parent ); ~AudioCdHandler(); - virtual void init(); - virtual bool isWritable() const { return false; } - virtual QString prettyName() const; + void init() override; + bool isWritable() const override { return false; } + QString prettyName() const override; }; diff --git a/src/core-impl/collections/audiocd/support/AudioCdConnectionAssistant.h b/src/core-impl/collections/audiocd/support/AudioCdConnectionAssistant.h --- a/src/core-impl/collections/audiocd/support/AudioCdConnectionAssistant.h +++ b/src/core-impl/collections/audiocd/support/AudioCdConnectionAssistant.h @@ -28,8 +28,8 @@ public: virtual ~AudioCdConnectionAssistant(); - virtual bool identify( const QString& udi ); - virtual MediaDeviceInfo* deviceInfo( const QString& udi ); + bool identify( const QString& udi ) override; + MediaDeviceInfo* deviceInfo( const QString& udi ) override; }; diff --git a/src/core-impl/collections/audiocd/support/AudioCdDeviceInfo.h b/src/core-impl/collections/audiocd/support/AudioCdDeviceInfo.h --- a/src/core-impl/collections/audiocd/support/AudioCdDeviceInfo.h +++ b/src/core-impl/collections/audiocd/support/AudioCdDeviceInfo.h @@ -23,10 +23,10 @@ { Q_OBJECT public: - AudioCdDeviceInfo( QString device, QString udi ); + AudioCdDeviceInfo(const QString &device, const QString &udi ); ~AudioCdDeviceInfo(); - QString device(); + QString device() const; private: QString m_device; diff --git a/src/core-impl/collections/audiocd/support/AudioCdDeviceInfo.cpp b/src/core-impl/collections/audiocd/support/AudioCdDeviceInfo.cpp --- a/src/core-impl/collections/audiocd/support/AudioCdDeviceInfo.cpp +++ b/src/core-impl/collections/audiocd/support/AudioCdDeviceInfo.cpp @@ -17,7 +17,7 @@ #include "AudioCdDeviceInfo.h" #include "MediaDeviceInfo.h" -AudioCdDeviceInfo::AudioCdDeviceInfo( QString device, QString udi ) +AudioCdDeviceInfo::AudioCdDeviceInfo( const QString &device, const QString &udi ) : MediaDeviceInfo(), m_device( device ) { @@ -29,7 +29,7 @@ } QString -AudioCdDeviceInfo::device() +AudioCdDeviceInfo::device() const { return m_device; } diff --git a/src/core-impl/collections/daap/CMakeLists.txt b/src/core-impl/collections/daap/CMakeLists.txt --- a/src/core-impl/collections/daap/CMakeLists.txt +++ b/src/core-impl/collections/daap/CMakeLists.txt @@ -30,6 +30,6 @@ set_target_properties(amarok_collection-daapcollection PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") endif() -install(TARGETS amarok_collection-daapcollection DESTINATION ${PLUGIN_INSTALL_DIR} ) +install(TARGETS amarok_collection-daapcollection DESTINATION ${KDE_INSTALL_PLUGINDIR} ) kcoreaddons_desktop_to_json(amarok_collection-daapcollection amarok_collection-daapcollection.desktop SERVICE_TYPES ${CMAKE_SOURCE_DIR}/src/amarok-plugin.desktop) diff --git a/src/core-impl/collections/daap/DaapCollection.h b/src/core-impl/collections/daap/DaapCollection.h --- a/src/core-impl/collections/daap/DaapCollection.h +++ b/src/core-impl/collections/daap/DaapCollection.h @@ -51,7 +51,7 @@ DaapCollectionFactory(); virtual ~DaapCollectionFactory(); - virtual void init(); + void init() override; private: QString serverKey( const QString& host, quint16 port ) const; @@ -64,8 +64,8 @@ void slotCollectionReady(); void slotCollectionDownloadFailed(); - void resolvedServiceIp(QHostInfo); - void resolvedManualServerIp(QHostInfo); + void resolvedServiceIp(const QHostInfo&); + void resolvedManualServerIp(const QHostInfo&); private: KDNSSD::ServiceBrowser* m_browser; @@ -82,11 +82,11 @@ DaapCollection( const QString &host, const QString &ip, quint16 port ); virtual ~DaapCollection(); - virtual QueryMaker* queryMaker(); + QueryMaker* queryMaker() override; - virtual QString collectionId() const; - virtual QString prettyName() const; - virtual QIcon icon() const { return QIcon::fromTheme("network-server"); } + QString collectionId() const override; + QString prettyName() const override; + QIcon icon() const override { return QIcon::fromTheme("network-server"); } void serverOffline(); diff --git a/src/core-impl/collections/daap/DaapCollection.cpp b/src/core-impl/collections/daap/DaapCollection.cpp --- a/src/core-impl/collections/daap/DaapCollection.cpp +++ b/src/core-impl/collections/daap/DaapCollection.cpp @@ -21,7 +21,7 @@ #include "DaapCollection.h" #include "amarokconfig.h" -#include "core/interfaces/Logger.h" +#include "core/logger/Logger.h" #include "core/support/Components.h" #include "core/support/Debug.h" #include "DaapMeta.h" @@ -90,14 +90,14 @@ foreach( const QString &server, sl ) { debug() << "Adding server " << server; - QStringList current = server.split( ':', QString::KeepEmptyParts ); + QStringList current = server.split( QLatin1Char(':'), QString::KeepEmptyParts ); //handle invalid urls gracefully if( current.count() < 2 ) continue; QString host = current.first(); quint16 port = current.last().toUShort(); - Amarok::Components::logger()->longMessage( + Amarok::Logger::longMessage( i18n( "Loading remote collection from host %1", host), Amarok::Logger::Information ); @@ -149,7 +149,7 @@ QString DaapCollectionFactory::serverKey( const QString& host, quint16 port) const { - return host + ':' + QString::number( port ); + return host + QLatin1Char(':') + QString::number( port ); } void @@ -160,7 +160,7 @@ if( collection ) { disconnect( collection, &DaapCollection::remove, this, &DaapCollectionFactory::slotCollectionDownloadFailed ); - emit newCollection( collection ); + Q_EMIT newCollection( collection ); } } @@ -184,7 +184,7 @@ } void -DaapCollectionFactory::resolvedManualServerIp( QHostInfo hostInfo ) +DaapCollectionFactory::resolvedManualServerIp( const QHostInfo &hostInfo ) { if ( !m_lookupHash.contains(hostInfo.lookupId()) ) return; @@ -203,7 +203,7 @@ } void -DaapCollectionFactory::resolvedServiceIp( QHostInfo hostInfo ) +DaapCollectionFactory::resolvedServiceIp( const QHostInfo &hostInfo ) { DEBUG_BLOCK // debug() << "got address:" << hostInfo.addresses() << "and lookup hash contains id" << hostInfo.lookupId() << "?" << m_lookupHash.contains(hostInfo.lookupId()); @@ -235,7 +235,7 @@ , m_host( host ) , m_port( port ) , m_ip( ip ) - , m_reader( 0 ) + , m_reader( nullptr ) , m_mc( new MemoryCollection() ) { debug() << "Host: " << host << " port: " << port; @@ -258,7 +258,7 @@ QString DaapCollection::collectionId() const { - return QString( "daap://" + m_ip + ':' ) + QString::number( m_port ); + return QString( QStringLiteral("daap://") + m_ip + QLatin1Char(':') ) + QString::number( m_port ); } QString @@ -288,25 +288,25 @@ { DEBUG_BLOCK debug() << "Http error in DaapReader: " << error; - emit remove(); + Q_EMIT remove(); } void DaapCollection::serverOffline() { - emit remove(); + Q_EMIT remove(); } void DaapCollection::loadedDataFromServer() { DEBUG_BLOCK - emit collectionReady(); + Q_EMIT collectionReady(); } void DaapCollection::parsingFailed() { DEBUG_BLOCK - emit remove(); + Q_EMIT remove(); } diff --git a/src/core-impl/collections/daap/DaapMeta.h b/src/core-impl/collections/daap/DaapMeta.h --- a/src/core-impl/collections/daap/DaapMeta.h +++ b/src/core-impl/collections/daap/DaapMeta.h @@ -46,18 +46,18 @@ DaapTrack( Collections::DaapCollection *collection, const QString &host, quint16 port, const QString &dbId, const QString &itemId, const QString &format); virtual ~DaapTrack(); - virtual QString name() const; + QString name() const override; - virtual QUrl playableUrl() const; - virtual QString uidUrl() const; - virtual QString prettyUrl() const; - virtual QString notPlayableReason() const; + QUrl playableUrl() const override; + QString uidUrl() const override; + QString prettyUrl() const override; + QString notPlayableReason() const override; - virtual AlbumPtr album() const; - virtual ArtistPtr artist() const; - virtual GenrePtr genre() const; - virtual ComposerPtr composer() const; - virtual YearPtr year() const; + AlbumPtr album() const override; + ArtistPtr artist() const override; + GenrePtr genre() const override; + ComposerPtr composer() const override; + YearPtr year() const override; virtual void setAlbum ( const QString &newAlbum ); virtual void setArtist ( const QString &newArtist ); @@ -67,34 +67,34 @@ virtual void setTitle( const QString &newTitle ); - virtual qreal bpm() const; + qreal bpm() const override; - virtual QString comment() const; + QString comment() const override; virtual void setComment ( const QString &newComment ); - virtual qint64 length() const; + qint64 length() const override; - virtual int filesize() const; - virtual int sampleRate() const; - virtual int bitrate() const; + int filesize() const override; + int sampleRate() const override; + int bitrate() const override; - virtual int trackNumber() const; + int trackNumber() const override; virtual void setTrackNumber ( int newTrackNumber ); - virtual int discNumber() const; + int discNumber() const override; virtual void setDiscNumber ( int newDiscNumber ); - virtual QString type() const; + QString type() const override; - virtual bool inCollection() const; - virtual Collections::Collection* collection() const; + bool inCollection() const override; + Collections::Collection* collection() const override; //DaapTrack specific methods - void setAlbum( DaapAlbumPtr album ); - void setArtist( DaapArtistPtr artist ); - void setComposer( DaapComposerPtr composer ); - void setGenre( DaapGenrePtr genre ); - void setYear( DaapYearPtr year ); + void setAlbum( const DaapAlbumPtr &album ); + void setArtist( const DaapArtistPtr &artist ); + void setComposer( const DaapComposerPtr &composer ); + void setGenre( const DaapGenrePtr &genre ); + void setYear( const DaapYearPtr &year ); void setLength( qint64 length ); @@ -118,17 +118,17 @@ class DaapArtist : public Meta::Artist { public: - DaapArtist( const QString &name ); + explicit DaapArtist( const QString &name ); virtual ~DaapArtist(); - virtual QString name() const; + QString name() const override; - virtual TrackList tracks(); + TrackList tracks() override; virtual AlbumList albums(); //DaapArtist specific methods - void addTrack( DaapTrackPtr track ); + void addTrack( const DaapTrackPtr &track ); private: QString m_name; @@ -138,19 +138,19 @@ class DaapAlbum : public Meta::Album { public: - DaapAlbum( const QString &name ); + explicit DaapAlbum( const QString &name ); virtual ~DaapAlbum(); - virtual QString name() const; + QString name() const override; - virtual bool isCompilation() const; - virtual bool hasAlbumArtist() const; - virtual ArtistPtr albumArtist() const; - virtual TrackList tracks(); + bool isCompilation() const override; + bool hasAlbumArtist() const override; + ArtistPtr albumArtist() const override; + TrackList tracks() override; //DaapAlbum specific methods - void addTrack( DaapTrackPtr track ); - void setAlbumArtist( DaapArtistPtr artist ); + void addTrack( const DaapTrackPtr &track ); + void setAlbumArtist( const DaapArtistPtr &artist ); private: QString m_name; @@ -162,15 +162,15 @@ class DaapGenre : public Meta::Genre { public: - DaapGenre( const QString &name ); + explicit DaapGenre( const QString &name ); virtual ~DaapGenre(); - virtual QString name() const; + QString name() const override; - virtual TrackList tracks(); + TrackList tracks() override; //DaapGenre specific methods - void addTrack( DaapTrackPtr track ); + void addTrack( const DaapTrackPtr &track ); private: QString m_name; @@ -180,15 +180,15 @@ class DaapComposer : public Meta::Composer { public: - DaapComposer( const QString &name ); + explicit DaapComposer( const QString &name ); virtual ~DaapComposer(); - virtual QString name() const; + QString name() const override; - virtual TrackList tracks(); + TrackList tracks() override; //DaapComposer specific methods - void addTrack( DaapTrackPtr track ); + void addTrack( const DaapTrackPtr &track ); private: QString m_name; @@ -198,15 +198,15 @@ class DaapYear : public Meta::Year { public: - DaapYear( const QString &name ); + explicit DaapYear( const QString &name ); virtual ~DaapYear(); - virtual QString name() const; + QString name() const override; - virtual TrackList tracks(); + TrackList tracks() override; //DaapYear specific methods - void addTrack( DaapTrackPtr track ); + void addTrack( const DaapTrackPtr &track ); private: QString m_name; diff --git a/src/core-impl/collections/daap/DaapMeta.cpp b/src/core-impl/collections/daap/DaapMeta.cpp --- a/src/core-impl/collections/daap/DaapMeta.cpp +++ b/src/core-impl/collections/daap/DaapMeta.cpp @@ -35,7 +35,7 @@ , m_displayUrl() , m_playableUrl() { - QString url = QString( "daap://%1:%2/databases/%3/items/%4.%5" ) + QString url = QStringLiteral( "daap://%1:%2/databases/%3/items/%4.%5" ) .arg( host, QString::number( port ), dbId, itemId, format ); m_displayUrl = url; m_playableUrl = url; @@ -228,31 +228,31 @@ } void -DaapTrack::setAlbum( DaapAlbumPtr album ) +DaapTrack::setAlbum( const DaapAlbumPtr &album ) { m_album = album; } void -DaapTrack::setArtist( DaapArtistPtr artist ) +DaapTrack::setArtist( const DaapArtistPtr &artist ) { m_artist = artist; } void -DaapTrack::setGenre( DaapGenrePtr genre ) +DaapTrack::setGenre( const DaapGenrePtr &genre ) { m_genre = genre; } void -DaapTrack::setComposer( DaapComposerPtr composer ) +DaapTrack::setComposer( const DaapComposerPtr &composer ) { m_composer = composer; } void -DaapTrack::setYear( DaapYearPtr year ) +DaapTrack::setYear( const DaapYearPtr &year ) { m_year = year; } @@ -304,7 +304,7 @@ } void -DaapArtist::addTrack( DaapTrackPtr track ) +DaapArtist::addTrack( const DaapTrackPtr &track ) { m_tracks.append( TrackPtr::staticCast( track ) ); } @@ -355,13 +355,13 @@ } void -DaapAlbum::addTrack( DaapTrackPtr track ) +DaapAlbum::addTrack( const DaapTrackPtr &track ) { m_tracks.append( TrackPtr::staticCast( track ) ); } void -DaapAlbum::setAlbumArtist( DaapArtistPtr artist ) +DaapAlbum::setAlbumArtist( const DaapArtistPtr &artist ) { m_albumArtist = artist; } @@ -394,7 +394,7 @@ } void -DaapGenre::addTrack( DaapTrackPtr track ) +DaapGenre::addTrack( const DaapTrackPtr &track ) { m_tracks.append( TrackPtr::staticCast( track ) ); } @@ -427,7 +427,7 @@ } void -DaapComposer::addTrack( DaapTrackPtr track ) +DaapComposer::addTrack( const DaapTrackPtr &track ) { m_tracks.append( TrackPtr::staticCast( track ) ); } @@ -460,7 +460,7 @@ } void -DaapYear::addTrack( DaapTrackPtr track ) +DaapYear::addTrack( const DaapTrackPtr &track ) { m_tracks.append( TrackPtr::staticCast( track ) ); } diff --git a/src/core-impl/collections/daap/amarok_collection-daapcollection.desktop b/src/core-impl/collections/daap/amarok_collection-daapcollection.desktop --- a/src/core-impl/collections/daap/amarok_collection-daapcollection.desktop +++ b/src/core-impl/collections/daap/amarok_collection-daapcollection.desktop @@ -56,7 +56,6 @@ Name[uk]=Збірка DAAP Name[wa]=Ramexhnêye DAAP Name[x-test]=xxDAAP Collectionxx -Name[zh_CN]=DAAP 收藏 Name[zh_TW]=DAAP 收藏 Comment=DAAP collection plugin for Amarok Comment[be]=Утулка калекцыі DAAP для Amarok @@ -86,7 +85,7 @@ Comment[it]=Estensione della collezione DAAP di Amarok Comment[ja]=Amarok のための DAAP コレクションプラグイン Comment[km]=កម្មវិធី​ជំនួយ​សម្រាំង DAAP សម្រាប់​ Amarok -Comment[ko]=Amarok의 DAAP 모음집 플러그인 +Comment[ko]=Amarok용 DAAP 모음집 플러그인 Comment[ku]=Pêveka berhevoka DAAP ji bo Amarok Comment[lt]=DAAP fonotekos Amarok įskiepis Comment[lv]=Amarok DAAP kolekcijas spraudnis @@ -113,7 +112,6 @@ Comment[uk]=Додаток збірки DAAP для Amarok Comment[wa]=Tchôke-divins di ramexhnêye DAAP po Amarok Comment[x-test]=xxDAAP collection plugin for Amarokxx -Comment[zh_CN]=Amarok 的 DAAP 收藏插件 Comment[zh_TW]=Amarok 的 DAAP 收藏外掛程式 ServiceTypes=Amarok/Plugin diff --git a/src/core-impl/collections/daap/daapreader/Reader.h b/src/core-impl/collections/daap/daapreader/Reader.h --- a/src/core-impl/collections/daap/daapreader/Reader.h +++ b/src/core-impl/collections/daap/daapreader/Reader.h @@ -32,7 +32,6 @@ class DaapCollection; } -class QHttpResponseHeader; namespace Daap { @@ -95,11 +94,11 @@ * @param raw stream of DAAP reply */ Map parse( QDataStream &raw); - static void addElement( Map &parentMap, char* tag, QVariant element ); //!< supporter function for parse + static void addElement( Map &parentMap, char* tag, const QVariant &element ); //!< supporter function for parse static quint32 getTagAndLength( QDataStream &raw, char tag[5] ); QVariant readTagData(QDataStream &, char[5], quint32); void addTrack( const QString& itemId, const QString& title, const QString& artist, const QString& composer, - const QString& commment, const QString& album, const QString& genre, int year, + const QString& comment, const QString& album, const QString& genre, int year, const QString& format, qint32 trackNumber, qint32 songTime ); QMap m_codes; @@ -126,12 +125,12 @@ WorkerThread( const QByteArray &data, Reader* reader, Collections::DaapCollection *coll ); virtual ~WorkerThread(); - virtual bool success() const Q_DECL_OVERRIDE; + bool success() const override; protected: - void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; - void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; - void run(ThreadWeaver::JobPointer self=QSharedPointer(), ThreadWeaver::Thread *thread = 0) Q_DECL_OVERRIDE; + void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; + void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; + void run(ThreadWeaver::JobPointer self=QSharedPointer(), ThreadWeaver::Thread *thread = 0) override; Q_SIGNALS: /** This signal is emitted when this job is being processed by a thread. */ diff --git a/src/core-impl/collections/daap/daapreader/Reader.cpp b/src/core-impl/collections/daap/daapreader/Reader.cpp --- a/src/core-impl/collections/daap/daapreader/Reader.cpp +++ b/src/core-impl/collections/daap/daapreader/Reader.cpp @@ -137,7 +137,7 @@ disconnect( http, &ContentFetcher::loginRequired, this, &Reader::loginHeaderReceived ); - emit passwordRequired(); + Q_EMIT passwordRequired(); http->deleteLater(); // connect( http, &ContentFetcher::finished, this, &Reader::loginFinished ); @@ -198,7 +198,7 @@ Map dbIdResults = parse( raw ); m_databaseId = QString::number( dbIdResults["avdb"].toList()[0].toMap()["mlcl"].toList()[0].toMap()["mlit"].toList()[0].toMap()["miid"].toList()[0].toInt() ); connect( http, &ContentFetcher::finished, this, &Reader::songListFinished ); - http->getDaap( QString("/databases/%1/items?type=music&meta=dmap.itemid,dmap.itemname,daap.songformat,daap.songartist,daap.songalbum,daap.songtime,daap.songtracknumber,daap.songcomment,daap.songyear,daap.songgenre&%2") + http->getDaap( QStringLiteral("/databases/%1/items?type=music&meta=dmap.itemid,dmap.itemname,daap.songformat,daap.songartist,daap.songalbum,daap.songtime,daap.songtracknumber,daap.songcomment,daap.songyear,daap.songgenre&%2") .arg( m_databaseId, m_loginString ) ); } @@ -517,7 +517,7 @@ } void -Reader::addElement( Map &parentMap, char* tag, QVariant element ) +Reader::addElement( Map &parentMap, char* tag, const QVariant &element ) { QList list; Map::Iterator it = parentMap.find( tag ); @@ -536,7 +536,7 @@ { DEBUG_BLOCK sender()->deleteLater(); - emit httpError( error ); + Q_EMIT httpError( error ); } WorkerThread::WorkerThread( const QByteArray &data, Reader *reader, Collections::DaapCollection *coll ) diff --git a/src/core-impl/collections/daap/daapreader/authentication/contentfetcher.h b/src/core-impl/collections/daap/daapreader/authentication/contentfetcher.h --- a/src/core-impl/collections/daap/daapreader/authentication/contentfetcher.h +++ b/src/core-impl/collections/daap/daapreader/authentication/contentfetcher.h @@ -37,7 +37,7 @@ Q_OBJECT public: - ContentFetcher( const QString & hostname, quint16 port, const QString& password, QObject * parent = 0, const char * name = 0 ); + ContentFetcher( const QString & hostname, quint16 port, const QString& password, QObject * parent = nullptr, const char * name = 0 ); ~ContentFetcher(); void getDaap( const QString & command, QIODevice* musicFile = 0 ); diff --git a/src/core-impl/collections/daap/daapreader/authentication/contentfetcher.cpp b/src/core-impl/collections/daap/daapreader/authentication/contentfetcher.cpp --- a/src/core-impl/collections/daap/daapreader/authentication/contentfetcher.cpp +++ b/src/core-impl/collections/daap/daapreader/authentication/contentfetcher.cpp @@ -33,7 +33,7 @@ ContentFetcher::ContentFetcher( const QString & hostname, quint16 port, const QString& password, QObject * parent, const char * name ) : QObject(parent) - , m_reply( Q_NULLPTR ) + , m_reply( nullptr ) , m_hostname( hostname ) , m_port( port ) , m_selfDestruct( false ) @@ -97,13 +97,13 @@ { if( m_reply->error() == QNetworkReply::AuthenticationRequiredError ) { - emit loginRequired(); + Q_EMIT loginRequired(); return; } debug() << "there is an error? " << m_reply->error() << " " << m_reply->errorString(); m_selfDestruct = true; - emit httpError( m_reply->errorString() ); + Q_EMIT httpError( m_reply->errorString() ); } QByteArray read = m_reply->readAll(); @@ -121,9 +121,9 @@ else m_lastResult = read; - emit finished(); + Q_EMIT finished(); m_reply->deleteLater(); - m_reply = Q_NULLPTR; + m_reply = nullptr; } diff --git a/src/core-impl/collections/db/DatabaseCollection.h b/src/core-impl/collections/db/DatabaseCollection.h --- a/src/core-impl/collections/db/DatabaseCollection.h +++ b/src/core-impl/collections/db/DatabaseCollection.h @@ -37,7 +37,6 @@ namespace Collections { class CollectionLocation; -class DatabaseCollectionLocationFactory; /** The DatabaseCollection is intended to be a base class for all database backed primary collections. * Primary collection implies that the basis for the collection is a file system. @@ -59,14 +58,13 @@ public: /** Creates a new DatabaseCollection. - * @param storage The storage this collection should work on. It will be freed by the collection. */ DatabaseCollection(); virtual ~DatabaseCollection(); - virtual QString collectionId() const; - virtual QString prettyName() const; - virtual QIcon icon() const; + QString collectionId() const override; + QString prettyName() const override; + QIcon icon() const override; virtual GenericScanManager *scanManager() const; virtual MountPointManager *mountPointManager() const; @@ -96,8 +94,8 @@ */ void collectionUpdated(); - virtual bool hasCapabilityInterface( Capabilities::Capability::Type type ) const; - virtual Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ); + bool hasCapabilityInterface( Capabilities::Capability::Type type ) const override; + Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ) override; public Q_SLOTS: /** Dumps the complete database content. @@ -107,8 +105,8 @@ virtual void dumpDatabaseContent() = 0; protected Q_SLOTS: - virtual void slotDeviceAdded( int id ) { Q_UNUSED( id ); }; - virtual void slotDeviceRemoved( int id ) { Q_UNUSED( id ); }; + virtual void slotDeviceAdded( int id ) { Q_UNUSED( id ); } + virtual void slotDeviceRemoved( int id ) { Q_UNUSED( id ); } protected: MountPointManager *m_mpm; @@ -124,12 +122,12 @@ Q_OBJECT public: - DatabaseCollectionScanCapability( DatabaseCollection* collection ); + explicit DatabaseCollectionScanCapability( DatabaseCollection* collection ); virtual ~DatabaseCollectionScanCapability(); - virtual void startFullScan(); - virtual void startIncrementalScan( const QString &directory = QString() ); - virtual void stopScan(); + void startFullScan() override; + void startIncrementalScan( const QString &directory = QString() ) override; + void stopScan() override; private: DatabaseCollection* m_collection; @@ -140,10 +138,10 @@ Q_OBJECT public: - DatabaseCollectionImportCapability( DatabaseCollection* collection ); + explicit DatabaseCollectionImportCapability( DatabaseCollection* collection ); virtual ~DatabaseCollectionImportCapability(); - virtual void import( QIODevice *input, QObject *listener ); + void import( QIODevice *input, QObject *listener ) override; private: DatabaseCollection* m_collection; diff --git a/src/core-impl/collections/db/DatabaseCollection.cpp b/src/core-impl/collections/db/DatabaseCollection.cpp --- a/src/core-impl/collections/db/DatabaseCollection.cpp +++ b/src/core-impl/collections/db/DatabaseCollection.cpp @@ -57,7 +57,7 @@ QIcon DatabaseCollection::icon() const { - return QIcon::fromTheme("drive-harddisk"); + return QIcon::fromTheme(QStringLiteral("drive-harddisk")); } GenericScanManager* @@ -123,7 +123,7 @@ { m_updatedSignalRequested = false; locker.unlock(); - emit updated(); + Q_EMIT updated(); } } @@ -135,7 +135,7 @@ { m_updatedSignalRequested = false; locker.unlock(); - emit updated(); + Q_EMIT updated(); } else { diff --git a/src/core-impl/collections/db/MountPointManager.h b/src/core-impl/collections/db/MountPointManager.h --- a/src/core-impl/collections/db/MountPointManager.h +++ b/src/core-impl/collections/db/MountPointManager.h @@ -44,12 +44,12 @@ Q_OBJECT public: - DeviceHandlerFactory( QObject *parent ) : QObject( parent ) {} + explicit DeviceHandlerFactory( QObject *parent ) : QObject( parent ) {} virtual ~DeviceHandlerFactory() {} /** * checks whether a DeviceHandler subclass can handle a given Medium. - * @param volume the connected solid volume + * @param device the connected solid volume * @return true if the DeviceHandler implementation can handle the medium, * false otherwise */ @@ -64,18 +64,20 @@ /** * creates a DeviceHandler which represents the Medium. - * @param volume the Volume for which a DeviceHandler is required + * @param device the Volume for which a DeviceHandler is required + * @param udi the device UUID + * @param s SQL storage * @return a DeviceHandler or 0 if the factory cannot handle the Medium */ virtual DeviceHandler* createHandler( const Solid::Device &device, const QString &udi, QSharedPointer s ) const = 0; virtual bool canCreateFromConfig() const = 0; - virtual DeviceHandler* createHandler( KSharedConfigPtr c, QSharedPointer s ) const = 0; + virtual DeviceHandler* createHandler( const KSharedConfigPtr &c, QSharedPointer s ) const = 0; /** * returns the type of the DeviceHandler. Should be the same as the value used in - * ~/.kde/share/config/amarokrc + * ~/.config/amarokrc * @return a QString describing the type of the DeviceHandler */ virtual QString type() const = 0; @@ -128,7 +130,7 @@ /** * allows MountPointManager to check if a device handler handles a specific medium. - * @param m + * @param udi * @return true if the device handler handles the Medium m */ virtual bool deviceMatchesUdi( const QString &udi ) const = 0; @@ -172,7 +174,6 @@ * calculates a file's/directory's relative path on a given device. * @param deviceId the unique id which identifies the device the file/directory is supposed to be on * @param absolutePath the file's/directory's absolute path - * @param relativePath the calculated relative path */ virtual QString getRelativePath( const int deviceId, const QString& absolutePath ) const; diff --git a/src/core-impl/collections/db/MountPointManager.cpp b/src/core-impl/collections/db/MountPointManager.cpp --- a/src/core-impl/collections/db/MountPointManager.cpp +++ b/src/core-impl/collections/db/MountPointManager.cpp @@ -223,7 +223,7 @@ { absoluteUrl = QUrl::fromLocalFile( lastMountPoint.first() ); absoluteUrl = absoluteUrl.adjusted(QUrl::StripTrailingSlash); - absoluteUrl.setPath( absoluteUrl.path() + '/' + rurl.path() ); + absoluteUrl.setPath( absoluteUrl.path() + QLatin1Char('/') + rurl.path() ); absoluteUrl.setPath( QDir::cleanPath( absoluteUrl.path() ) ); //debug() << "Device " << deviceId << " not mounted, using last mount point and returning " << absoluteUrl.toLocalFile(); } @@ -306,7 +306,7 @@ KConfigGroup folderConf = Amarok::config( "Collection Folders" ); FolderMap folderMap; - foreach( const QString &folder, folders ) + for( const QString &folder : folders ) { int id = getIdForUrl( QUrl::fromLocalFile(folder) ); const QString rpath = getRelativePath( id, folder ); @@ -318,8 +318,8 @@ folderMap[id] = QStringList( rpath ); } //make sure that collection folders on devices which are not in foldermap are deleted - IdList ids = getMountedDeviceIds(); - foreach( int deviceId, ids ) + const IdList ids = getMountedDeviceIds(); + for ( int deviceId : ids ) { if( !folderMap.contains( deviceId ) ) { @@ -371,7 +371,7 @@ debug() << "removed device " << key; m_handlerMapMutex.unlock(); //we found the medium which was removed, so we can abort the loop - emit deviceRemoved( key ); + Q_EMIT deviceRemoved( key ); return; } } @@ -406,7 +406,7 @@ m_handlerMap.insert( key, handler ); m_handlerMapMutex.unlock(); // debug() << "added device " << key << " with mount point " << volumeAccess->mountPoint(); - emit deviceAdded( key ); + Q_EMIT deviceAdded( key ); break; //we found the added medium and don't have to check the other device handlers } else diff --git a/src/core-impl/collections/db/sql/CMakeLists.txt b/src/core-impl/collections/db/sql/CMakeLists.txt --- a/src/core-impl/collections/db/sql/CMakeLists.txt +++ b/src/core-impl/collections/db/sql/CMakeLists.txt @@ -20,14 +20,14 @@ ) add_library(amarok-sqlcollection SHARED ${amarok_collection-sqlcollection_SRCS}) +generate_export_header(amarok-sqlcollection BASE_NAME amarok_sqlcollection) target_link_libraries(amarok-sqlcollection KF5::KIOCore - ${KDE4_SOLID_LIBRARY} KF5::ThreadWeaver Qt5::Core Qt5::Gui - ${CMAKE_THREAD_LIBS_INIT} + Threads::Threads amarokcore amaroklib amarok-transcoding diff --git a/src/core-impl/collections/db/sql/DatabaseUpdater.h b/src/core-impl/collections/db/sql/DatabaseUpdater.h --- a/src/core-impl/collections/db/sql/DatabaseUpdater.h +++ b/src/core-impl/collections/db/sql/DatabaseUpdater.h @@ -22,7 +22,6 @@ #include "amarok_sqlcollection_export.h" -class SqlStorage; namespace Collections { class SqlCollection; @@ -32,7 +31,7 @@ */ class AMAROK_SQLCOLLECTION_EXPORT DatabaseUpdater { public: - DatabaseUpdater( Collections::SqlCollection *collection ); + explicit DatabaseUpdater( Collections::SqlCollection *collection ); ~DatabaseUpdater(); static int expectedDatabaseVersion(); @@ -77,7 +76,7 @@ * Note: it can handle also the directories table but that is better * be left to the ScannerProcessor * - * TODO: also check the remainding 8 tables + * TODO: also check the remaining 8 tables */ void deleteAllRedundant( const QString &type ); @@ -110,7 +109,7 @@ void writeCSVFile( const QString &table, const QString &filename, bool forceDebug = false ); - static int textColumnLength() { return 255; }; + static int textColumnLength() { return 255; } private: /** creates all the necessary tables, indexes etc. for the database */ diff --git a/src/core-impl/collections/db/sql/DatabaseUpdater.cpp b/src/core-impl/collections/db/sql/DatabaseUpdater.cpp --- a/src/core-impl/collections/db/sql/DatabaseUpdater.cpp +++ b/src/core-impl/collections/db/sql/DatabaseUpdater.cpp @@ -139,7 +139,7 @@ if( dbVersion > DB_VERSION ) { - KMessageBox::error(0, + KMessageBox::error(nullptr, "

The Amarok collection database was created by a newer version of Amarok, " "and this version of Amarok cannot use it.

", "Database Type Unknown"); @@ -624,7 +624,7 @@ storage->query( "UPDATE lyrics l SET l.url = (SELECT u.id FROM urls u WHERE u.rpath = l.rpath LIMIT 1)" ); // delete entries with no matches in urls table; these should be just stale ones storage->query( "DELETE FROM lyrics WHERE url IS NULL" ); - // make the url columnt non-null + // make the url column non-null storage->query( "ALTER TABLE lyrics MODIFY url INT NOT NULL" ); // select duplicate ids into temporary table storage->query( "CREATE TEMPORARY TABLE duplicate_lyrics_ids ( id INT NOT NULL ) " @@ -1062,7 +1062,7 @@ // that clashes with INFORMATION_SCHEMA.statistics, a build in table. if( table == "statistics" && columns.count() > 15 ) { - // delete all columns with full upper case name. Those are the buildins. + // delete all columns with full upper case name. Those are the builtins. for( int i = columns.count()-1; i>= 0; --i ) { if( columns[i].toUpper() == columns[i] ) @@ -1087,7 +1087,6 @@ { QTextStream stream( &file ); int i = 0; - QString line; //write header foreach( const QString &column, columns ) { @@ -1101,7 +1100,7 @@ stream << data; stream << ';'; ++i; - if( i % columns.count() == 0 ) + if( i % columns.isEmpty() ) stream << '\n'; } file.close(); diff --git a/src/core-impl/collections/db/sql/DefaultSqlQueryMakerFactory.h b/src/core-impl/collections/db/sql/DefaultSqlQueryMakerFactory.h --- a/src/core-impl/collections/db/sql/DefaultSqlQueryMakerFactory.h +++ b/src/core-impl/collections/db/sql/DefaultSqlQueryMakerFactory.h @@ -24,11 +24,11 @@ class DefaultSqlQueryMakerFactory : public SqlQueryMakerFactory { public: - DefaultSqlQueryMakerFactory( SqlCollection *collection ) + explicit DefaultSqlQueryMakerFactory( SqlCollection *collection ) : SqlQueryMakerFactory() , m_collection( collection ) {} - SqlQueryMaker *createQueryMaker() const + SqlQueryMaker *createQueryMaker() const override { Q_ASSERT( m_collection ); return new SqlQueryMaker( m_collection ); diff --git a/src/core-impl/collections/db/sql/SqlCapabilities.h b/src/core-impl/collections/db/sql/SqlCapabilities.h --- a/src/core-impl/collections/db/sql/SqlCapabilities.h +++ b/src/core-impl/collections/db/sql/SqlCapabilities.h @@ -47,10 +47,10 @@ public: - OrganiseCapabilityImpl( Meta::SqlTrack *track ); + explicit OrganiseCapabilityImpl( Meta::SqlTrack *track ); virtual ~OrganiseCapabilityImpl(); - virtual void deleteTrack(); + void deleteTrack() override; private: AmarokSharedPointer m_track; @@ -62,15 +62,15 @@ public: - TimecodeWriteCapabilityImpl( Meta::SqlTrack *track ); + explicit TimecodeWriteCapabilityImpl( Meta::SqlTrack *track ); virtual ~TimecodeWriteCapabilityImpl(); - virtual bool writeTimecode( qint64 miliseconds ) + bool writeTimecode( qint64 miliseconds ) override { return Capabilities::TimecodeWriteCapability::writeTimecode( miliseconds, Meta::TrackPtr( m_track.data() ) ); } - virtual bool writeAutoTimecode( qint64 miliseconds ) + bool writeAutoTimecode( qint64 miliseconds ) override { return Capabilities::TimecodeWriteCapability::writeAutoTimecode( miliseconds, Meta::TrackPtr( m_track.data() ) ); } @@ -85,11 +85,11 @@ public: - TimecodeLoadCapabilityImpl( Meta::SqlTrack *track ); + explicit TimecodeLoadCapabilityImpl( Meta::SqlTrack *track ); virtual ~TimecodeLoadCapabilityImpl(); - virtual bool hasTimecodes(); - virtual QList > loadTimecodes(); + bool hasTimecodes() override; + QList > loadTimecodes() override; private: AmarokSharedPointer m_track; @@ -101,10 +101,10 @@ Q_OBJECT public: - FindInSourceCapabilityImpl( Meta::SqlTrack *track ); - virtual ~FindInSourceCapabilityImpl(); + explicit FindInSourceCapabilityImpl( Meta::SqlTrack *track ); + ~FindInSourceCapabilityImpl() override; - virtual void findInSource( QFlags tag ); + void findInSource( QFlags tag ) override; private: AmarokSharedPointer m_track; diff --git a/src/core-impl/collections/db/sql/SqlCollection.h b/src/core-impl/collections/db/sql/SqlCollection.h --- a/src/core-impl/collections/db/sql/SqlCollection.h +++ b/src/core-impl/collections/db/sql/SqlCollection.h @@ -37,7 +37,7 @@ class SqlQueryMakerFactory; /// Configuration group name in amarokrc for preferred transcoding configuration for SqlCollection -static const QString SQL_TRANSCODING_GROUP_NAME = "Collection Transcoding Preference"; +static const QString SQL_TRANSCODING_GROUP_NAME = QStringLiteral("Collection Transcoding Preference"); class AMAROK_SQLCOLLECTION_EXPORT SqlCollection : public Collections::DatabaseCollection { @@ -47,15 +47,15 @@ /** Creates a new SqlCollection. * @param storage The storage this collection should work on. It will be freed by the collection. */ - SqlCollection( QSharedPointer storage ); - virtual ~SqlCollection(); + explicit SqlCollection( const QSharedPointer &storage ); + ~SqlCollection() override; - virtual QueryMaker *queryMaker(); + QueryMaker *queryMaker() override; /** Returns the protocol for the uid urls of this collection. The SqlCollection support "amarok-sqltrackuid" and "file" protocol. */ - virtual QString uidUrlProtocol() const; + QString uidUrlProtocol() const override; /** * Generates uidUrl out of a hash (as returned by tag reader) that can be then * fed to Track::setUidUrl(). @@ -69,38 +69,38 @@ QSharedPointer sqlStorage() const; /** Every collection has this function. */ - virtual bool possiblyContainsTrack( const QUrl &url ) const; + bool possiblyContainsTrack( const QUrl &url ) const override; - virtual Meta::TrackPtr trackForUrl( const QUrl &url ); + Meta::TrackPtr trackForUrl( const QUrl &url ) override; /** Gets an existing track (or a new one) at the given position. This function should only be used by the SqlScanResultProcessor. */ virtual Meta::TrackPtr getTrack( int deviceId, const QString &rpath, int directoryId, const QString &uidUrl ); virtual Meta::TrackPtr getTrackFromUid( const QString &uniqueid ); virtual Meta::AlbumPtr getAlbum( const QString &album, const QString &artist ); - virtual CollectionLocation* location(); + CollectionLocation* location() override; - virtual bool hasCapabilityInterface( Capabilities::Capability::Type type ) const; - virtual Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ); + bool hasCapabilityInterface( Capabilities::Capability::Type type ) const override; + Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ) override; public Q_SLOTS: /** Dumps the complete database content. * The content of all Amarok tables is dumped in a couple of files * in the users homedirectory. */ - void dumpDatabaseContent(); + void dumpDatabaseContent() override; private Q_SLOTS: - void slotDeviceAdded( int id ); - void slotDeviceRemoved( int id ); + void slotDeviceAdded( int id ) override; + void slotDeviceRemoved( int id ) override; private: SqlRegistry* m_registry; QSharedPointer m_sqlStorage; SqlScanResultProcessor* m_scanProcessor; - AbstractDirectoryWatcher* m_directoryWatcher; + QWeakPointer m_directoryWatcher; SqlCollectionLocationFactory* m_collectionLocationFactory; SqlQueryMakerFactory* m_queryMakerFactory; @@ -113,8 +113,8 @@ virtual ~SqlCollectionTranscodeCapability(); - virtual Transcoding::Configuration savedConfiguration(); - virtual void setSavedConfiguration( const Transcoding::Configuration &configuration ); + Transcoding::Configuration savedConfiguration() override; + void setSavedConfiguration( const Transcoding::Configuration &configuration ) override; }; } diff --git a/src/core-impl/collections/db/sql/SqlCollection.cpp b/src/core-impl/collections/db/sql/SqlCollection.cpp --- a/src/core-impl/collections/db/sql/SqlCollection.cpp +++ b/src/core-impl/collections/db/sql/SqlCollection.cpp @@ -63,7 +63,7 @@ { } protected: - QList collectionFolders() + QList collectionFolders() override { return m_collection->mountPointManager()->collectionFolders(); } Collections::SqlCollection* m_collection; @@ -77,7 +77,7 @@ , m_collection( collection ) { } - ~SqlScanManager() + ~SqlScanManager() override { } protected: @@ -112,7 +112,7 @@ return result; } - QString getBatchFile( const QStringList &scanDirsRequested ) + QString getBatchFile( const QStringList &scanDirsRequested ) override { // -- write the batch file // the batch file contains the known modification dates so that the scanner only @@ -151,15 +151,15 @@ , m_organizing( false ) {} virtual ~ OrganizeCollectionDelegateImpl() { delete m_dialog; } - virtual void setTracks( const Meta::TrackList &tracks ) { m_tracks = tracks; } - virtual void setFolders( const QStringList &folders ) { m_folders = folders; } - virtual void setIsOrganizing( bool organizing ) { m_organizing = organizing; } - virtual void setTranscodingConfiguration( const Transcoding::Configuration &configuration ) + void setTracks( const Meta::TrackList &tracks ) override { m_tracks = tracks; } + void setFolders( const QStringList &folders ) override { m_folders = folders; } + void setIsOrganizing( bool organizing ) override { m_organizing = organizing; } + void setTranscodingConfiguration( const Transcoding::Configuration &configuration ) override { m_targetFileExtension = Amarok::Components::transcodingController()->format( configuration.encoder() )->fileExtension(); } - virtual void setCaption( const QString &caption ) { m_caption = caption; } + void setCaption( const QString &caption ) override { m_caption = caption; } - virtual void show() + void show() override { m_dialog = new OrganizeCollectionDialog( m_tracks, m_folders, @@ -177,8 +177,8 @@ m_dialog->show(); } - virtual bool overwriteDestinations() const { return m_dialog->overwriteDestinations(); } - virtual QMap destinations() const { return m_dialog->getDestinations(); } + bool overwriteDestinations() const override { return m_dialog->overwriteDestinations(); } + QMap destinations() const override { return m_dialog->getDestinations(); } private: Meta::TrackList m_tracks; @@ -193,7 +193,7 @@ class OrganizeCollectionDelegateFactoryImpl : public OrganizeCollectionDelegateFactory { public: - virtual OrganizeCollectionDelegate* createDelegate() { return new OrganizeCollectionDelegateImpl(); } + OrganizeCollectionDelegate* createDelegate() override { return new OrganizeCollectionDelegateImpl(); } }; @@ -204,7 +204,7 @@ : SqlCollectionLocationFactory() , m_collection( collection ) {} - SqlCollectionLocation *createSqlCollectionLocation() const + SqlCollectionLocation *createSqlCollectionLocation() const override { Q_ASSERT( m_collection ); SqlCollectionLocation *loc = new SqlCollectionLocation( m_collection ); @@ -219,14 +219,14 @@ using namespace Collections; -SqlCollection::SqlCollection( QSharedPointer storage ) +SqlCollection::SqlCollection( const QSharedPointer &storage ) : DatabaseCollection() - , m_registry( 0 ) + , m_registry( nullptr ) , m_sqlStorage( storage ) - , m_scanProcessor( 0 ) - , m_directoryWatcher( 0 ) - , m_collectionLocationFactory( 0 ) - , m_queryMakerFactory( 0 ) + , m_scanProcessor( nullptr ) + , m_directoryWatcher( nullptr ) + , m_collectionLocationFactory( nullptr ) + , m_queryMakerFactory( nullptr ) { qRegisterMetaType( "TrackUrls" ); qRegisterMetaType( "ChangedTrackUrls" ); @@ -270,19 +270,22 @@ // scanning m_scanManager = new SqlScanManager( this, this ); m_scanProcessor = new SqlScanResultProcessor( m_scanManager, this, this ); - m_directoryWatcher = new SqlDirectoryWatcher( this ); - connect( m_directoryWatcher, &AbstractDirectoryWatcher::done, - m_directoryWatcher, &AbstractDirectoryWatcher::deleteLater ); // auto delete - connect( m_directoryWatcher, &AbstractDirectoryWatcher::requestScan, + auto directoryWatcher = QSharedPointer::create( this ); + m_directoryWatcher = directoryWatcher.toWeakRef(); + connect( directoryWatcher.data(), &AbstractDirectoryWatcher::done, + directoryWatcher.data(), &AbstractDirectoryWatcher::deleteLater ); // auto delete + connect( directoryWatcher.data(), &AbstractDirectoryWatcher::requestScan, m_scanManager, &GenericScanManager::requestScan ); - ThreadWeaver::Queue::instance()->enqueue( QSharedPointer(m_directoryWatcher) ); + ThreadWeaver::Queue::instance()->enqueue( directoryWatcher ); } SqlCollection::~SqlCollection() { DEBUG_BLOCK - m_directoryWatcher->abort(); + if( auto directoryWatcher = m_directoryWatcher.toStrongRef() ) + directoryWatcher->requestAbort(); + delete m_scanProcessor; // this prevents any further commits from the scanner delete m_collectionLocationFactory; delete m_queryMakerFactory; diff --git a/src/core-impl/collections/db/sql/SqlCollectionLocation.h b/src/core-impl/collections/db/sql/SqlCollectionLocation.h --- a/src/core-impl/collections/db/sql/SqlCollectionLocation.h +++ b/src/core-impl/collections/db/sql/SqlCollectionLocation.h @@ -48,21 +48,21 @@ public: TransferJob( SqlCollectionLocation * location, const Transcoding::Configuration & configuration ); - void start(); - virtual bool addSubjob( KJob* job ); + void start() override; + bool addSubjob( KJob* job ) override; void emitInfo( const QString &message ); public Q_SLOTS: /** * A move or copy job finished */ void slotJobFinished( KJob *job ); protected Q_SLOTS: - void slotResult( KJob *job ); + void slotResult( KJob *job ) override; void doWork(); void propagateProcessedAmount( KJob *job, KJob::Unit unit, qulonglong amount); protected: - virtual bool doKill(); + bool doKill() override; private: SqlCollectionLocation* m_location; bool m_killed; @@ -74,27 +74,27 @@ Q_OBJECT public: - SqlCollectionLocation( SqlCollection *collection ); + explicit SqlCollectionLocation( SqlCollection *collection ); virtual ~SqlCollectionLocation(); - virtual QString prettyLocation() const; - virtual QStringList actualLocation() const; - virtual bool isWritable() const; - virtual bool isOrganizable() const; + QString prettyLocation() const override; + QStringList actualLocation() const override; + bool isWritable() const override; + bool isOrganizable() const override; bool remove( const Meta::TrackPtr &track ); - virtual bool insert( const Meta::TrackPtr &track, const QString &path ); + bool insert( const Meta::TrackPtr &track, const QString &path ) override; //dependency injectors void setOrganizeCollectionDelegateFactory( OrganizeCollectionDelegateFactory *fac ); protected: - virtual void showDestinationDialog( const Meta::TrackList &tracks, + void showDestinationDialog( const Meta::TrackList &tracks, bool removeSources, - const Transcoding::Configuration &configuration ); - virtual void copyUrlsToCollection( const QMap &sources, - const Transcoding::Configuration & configuration ); - virtual void removeUrlsFromCollection( const Meta::TrackList &sources ); + const Transcoding::Configuration &configuration ) override; + void copyUrlsToCollection( const QMap &sources, + const Transcoding::Configuration & configuration ) override; + void removeUrlsFromCollection( const Meta::TrackList &sources ) override; private Q_SLOTS: void slotDialogAccepted(); @@ -107,7 +107,7 @@ private: QUrl moodFile( const QUrl &track ) const; void migrateLabels( const QMap &trackMap ); - bool startNextJob( const Transcoding::Configuration configuration ); + bool startNextJob(const Transcoding::Configuration &configuration ); bool startNextRemoveJob(); Collections::SqlCollection *m_collection; diff --git a/src/core-impl/collections/db/sql/SqlCollectionLocation.cpp b/src/core-impl/collections/db/sql/SqlCollectionLocation.cpp --- a/src/core-impl/collections/db/sql/SqlCollectionLocation.cpp +++ b/src/core-impl/collections/db/sql/SqlCollectionLocation.cpp @@ -24,7 +24,7 @@ #include "MetaTagLib.h" // for getting the uid #include "core/collections/CollectionLocationDelegate.h" #include -#include "core/interfaces/Logger.h" +#include "core/logger/Logger.h" #include "core/support/Components.h" #include "core/support/Debug.h" #include "core/meta/Meta.h" @@ -271,7 +271,7 @@ metaTrack->endUpdate(); metaTrack->setWriteFile( true ); - // we have a first shot at the meta data (expecially ratings and playcounts from media + // we have a first shot at the meta data (especially ratings and playcounts from media // collections) but we still need to trigger the collection scanner // to get the album and other meta data correct. // TODO m_collection->directoryWatcher()->delayedIncrementalScan( QFileInfo(url).path() ); @@ -291,9 +291,9 @@ foreach( Meta::TrackPtr track, tracks ) transferSize += track->filesize(); - QStringList actual_folders = actualLocation(); // the folders in the collection + const QStringList actual_folders = actualLocation(); // the folders in the collection QStringList available_folders; // the folders which have freespace available - foreach(QString path, actual_folders) + foreach(const QString &path, actual_folders) { if( path.isEmpty() ) continue; @@ -477,8 +477,8 @@ QString statusBarTxt = operationInProgressText( configuration, sources.count() ); m_transferjob = new TransferJob( this, configuration ); - Amarok::Components::logger()->newProgressOperation( m_transferjob, statusBarTxt, this, - SLOT(slotTransferJobAborted()) ); + Amarok::Logger::newProgressOperation( m_transferjob, statusBarTxt, this, + &SqlCollectionLocation::slotTransferJobAborted ); connect( m_transferjob, &Collections::TransferJob::result, this, &SqlCollectionLocation::slotTransferJobFinished ); m_transferjob->start(); @@ -501,7 +501,7 @@ m_delegateFactory = fac; } -bool SqlCollectionLocation::startNextJob( const Transcoding::Configuration configuration ) +bool SqlCollectionLocation::startNextJob( const Transcoding::Configuration &configuration ) { DEBUG_BLOCK if( !m_sources.isEmpty() ) @@ -581,7 +581,7 @@ else { QString destPath = dest.path(); - destPath.truncate( dest.path().lastIndexOf( '.' ) + 1 ); + destPath.truncate( dest.path().lastIndexOf( QLatin1Char('.') ) + 1 ); destPath.append( Amarok::Components::transcodingController()-> format( configuration.encoder() )->fileExtension() ); dest.setPath( destPath ); @@ -610,7 +610,7 @@ QString name = track->prettyName(); if( track->artist() ) - name = QString( "%1 - %2" ).arg( track->artist()->name(), track->prettyName() ); + name = QStringLiteral( "%1 - %2" ).arg( track->artist()->name(), track->prettyName() ); if( isJustCopy ) m_transferjob->emitInfo( i18n( "Transferring: %1", name ) ); @@ -657,9 +657,9 @@ connect( job, &KIO::DeleteJob::result, this, &SqlCollectionLocation::slotRemoveJobFinished ); QString name = track->prettyName(); if( track->artist() ) - name = QString( "%1 - %2" ).arg( track->artist()->name(), track->prettyName() ); + name = QStringLiteral( "%1 - %2" ).arg( track->artist()->name(), track->prettyName() ); - Amarok::Components::logger()->newProgressOperation( job, i18n( "Removing: %1", name ) ); + Amarok::Logger::newProgressOperation( job, i18n( "Removing: %1", name ) ); m_removejobs.insert( job, track ); return true; } @@ -672,8 +672,9 @@ SqlCollectionLocation::moodFile( const QUrl &track ) const { QUrl moodPath = track; + QString fileName = moodPath.fileName(); moodPath = moodPath.adjusted(QUrl::RemoveFilename); - moodPath.setPath(moodPath.path() + '.' + moodPath.fileName().replace( QRegExp( "(\\.\\w{2,5})$" ), ".mood" ) ); + moodPath.setPath(moodPath.path() + '.' + fileName.replace( QRegExp( "(\\.\\w{2,5})$" ), ".mood" ) ); return moodPath; } @@ -697,7 +698,7 @@ void TransferJob::emitInfo(const QString& message) { - emit infoMessage( this, message ); + Q_EMIT infoMessage( this, message ); } void TransferJob::slotResult( KJob *job ) diff --git a/src/core-impl/collections/db/sql/SqlMeta.h b/src/core-impl/collections/db/sql/SqlMeta.h --- a/src/core-impl/collections/db/sql/SqlMeta.h +++ b/src/core-impl/collections/db/sql/SqlMeta.h @@ -26,19 +26,16 @@ #include "amarok_sqlcollection_export.h" #include "FileType.h" +#include #include #include #include #include #include #include namespace Capabilities { - class AlbumCapabilityDelegate; - class ArtistCapabilityDelegate; - class TrackCapabilityDelegate; } -class QAction; class SqlRegistry; class TrackUrlsTableCommitter; @@ -72,83 +69,83 @@ SqlTrack( Collections::SqlCollection *collection, int deviceId, const QString &rpath, int directoryId, const QString &uidUrl ); SqlTrack( Collections::SqlCollection *collection, const QStringList &queryResult ); - ~ SqlTrack(); - - virtual QString name() const; - virtual QString prettyName() const; - virtual QUrl playableUrl() const; - virtual QString prettyUrl() const; - virtual QString uidUrl() const; - virtual QString notPlayableReason() const; - - virtual Meta::AlbumPtr album() const; - virtual Meta::ArtistPtr artist() const; - virtual Meta::ComposerPtr composer() const; - virtual Meta::YearPtr year() const; - virtual Meta::GenrePtr genre() const; - - virtual QString type() const; - virtual qreal bpm() const; - virtual QString comment() const; - virtual qint64 length() const; - virtual int filesize() const; - virtual int sampleRate() const; - virtual int bitrate() const; - virtual QDateTime createDate() const; - virtual QDateTime modifyDate() const; - virtual int trackNumber() const; - virtual int discNumber() const; - virtual qreal replayGain( Meta::ReplayGainTag mode ) const; - - virtual bool inCollection() const; - virtual Collections::Collection* collection() const; - - virtual QString cachedLyrics() const; - virtual void setCachedLyrics( const QString &lyrics ); - - virtual bool hasCapabilityInterface( Capabilities::Capability::Type type ) const; - virtual Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ); - - virtual void addLabel( const QString &label ); - virtual void addLabel( const Meta::LabelPtr &label ); - virtual void removeLabel( const Meta::LabelPtr &label ); - virtual Meta::LabelList labels() const; - - virtual TrackEditorPtr editor(); - virtual StatisticsPtr statistics(); + ~ SqlTrack() override; + + QString name() const override; + QString prettyName() const override; + QUrl playableUrl() const override; + QString prettyUrl() const override; + QString uidUrl() const override; + QString notPlayableReason() const override; + + Meta::AlbumPtr album() const override; + Meta::ArtistPtr artist() const override; + Meta::ComposerPtr composer() const override; + Meta::YearPtr year() const override; + Meta::GenrePtr genre() const override; + + QString type() const override; + qreal bpm() const override; + QString comment() const override; + qint64 length() const override; + int filesize() const override; + int sampleRate() const override; + int bitrate() const override; + QDateTime createDate() const override; + QDateTime modifyDate() const override; + int trackNumber() const override; + int discNumber() const override; + qreal replayGain( Meta::ReplayGainTag mode ) const override; + + bool inCollection() const override; + Collections::Collection* collection() const override; + + QString cachedLyrics() const override; + void setCachedLyrics( const QString &lyrics ) override; + + bool hasCapabilityInterface( Capabilities::Capability::Type type ) const override; + Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ) override; + + void addLabel( const QString &label ) override; + void addLabel( const Meta::LabelPtr &label ) override; + void removeLabel( const Meta::LabelPtr &label ) override; + Meta::LabelList labels() const override; + + TrackEditorPtr editor() override; + StatisticsPtr statistics() override; // Meta::TrackEditor methods: - virtual void setAlbum( const QString &newAlbum ); - virtual void setAlbumArtist( const QString &newAlbumArtist ); - virtual void setArtist( const QString &newArtist ); - virtual void setComposer( const QString &newComposer ); - virtual void setGenre( const QString &newGenre ); - virtual void setYear( int newYear ); - virtual void setTitle( const QString &newTitle ); - virtual void setComment( const QString &newComment ); - virtual void setTrackNumber( int newTrackNumber ); - virtual void setDiscNumber( int newDiscNumber ); - virtual void setBpm( const qreal newBpm ); + void setAlbum( const QString &newAlbum ) override; + void setAlbumArtist( const QString &newAlbumArtist ) override; + void setArtist( const QString &newArtist ) override; + void setComposer( const QString &newComposer ) override; + void setGenre( const QString &newGenre ) override; + void setYear( int newYear ) override; + void setTitle( const QString &newTitle ) override; + void setComment( const QString &newComment ) override; + void setTrackNumber( int newTrackNumber ) override; + void setDiscNumber( int newDiscNumber ) override; + void setBpm( const qreal newBpm ) override; // Meta::Statistics methods: - virtual double score() const; - virtual void setScore( double newScore ); + double score() const override; + void setScore( double newScore ) override; - virtual int rating() const; - virtual void setRating( int newRating ); + int rating() const override; + void setRating( int newRating ) override; - virtual QDateTime firstPlayed() const; - virtual void setFirstPlayed( const QDateTime &newTime ); + QDateTime firstPlayed() const override; + void setFirstPlayed( const QDateTime &newTime ) override; - virtual QDateTime lastPlayed() const; - virtual void setLastPlayed( const QDateTime &newTime ); + QDateTime lastPlayed() const override; + void setLastPlayed( const QDateTime &newTime ) override; - virtual int playCount() const; - virtual void setPlayCount( const int newCount ); + int playCount() const override; + void setPlayCount( const int newCount ) override; // combined Meta::Statistics and Meta::TrackEditor methods: - virtual void beginUpdate(); - virtual void endUpdate(); + void beginUpdate() override; + void endUpdate() override; // SqlTrack specific methods /** true if there is a collection, the file exists on disk and is writable */ @@ -281,7 +278,7 @@ FieldHash m_cache; /** This ReadWriteLock is protecting all internal variables. - It is ensuring that m_cache, m_batchUpdate and the othre internal variable are + It is ensuring that m_cache, m_batchUpdate and the other internal variable are in a consistent state all the time. */ mutable QReadWriteLock m_lock; @@ -301,15 +298,15 @@ SqlArtist( Collections::SqlCollection* collection, int id, const QString &name ); ~SqlArtist(); - virtual QString name() const { return m_name; } + QString name() const override { return m_name; } virtual void invalidateCache(); - virtual Meta::TrackList tracks(); + Meta::TrackList tracks() override; - virtual bool hasCapabilityInterface( Capabilities::Capability::Type type ) const; + bool hasCapabilityInterface( Capabilities::Capability::Type type ) const override; - virtual Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ); + Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ) override; //SQL specific methods int id() const { return m_id; } @@ -336,54 +333,54 @@ SqlAlbum( Collections::SqlCollection* collection, int id, const QString &name, int artist ); ~SqlAlbum(); - virtual QString name() const { return m_name; } + QString name() const override { return m_name; } virtual void invalidateCache(); - virtual Meta::TrackList tracks(); + Meta::TrackList tracks() override; - virtual bool isCompilation() const; - virtual bool canUpdateCompilation() const { return true; } - void setCompilation( bool compilation ); + bool isCompilation() const override; + bool canUpdateCompilation() const override { return true; } + void setCompilation( bool compilation ) override; /** Returns true if this album has an artist. * The following equation is always true: isCompilation() != hasAlbumArtist() */ - virtual bool hasAlbumArtist() const; + bool hasAlbumArtist() const override; /** Returns the album artist. * Note that setting the album artist is not supported. * A compilation does not have an artist and not only an empty artist. */ - virtual Meta::ArtistPtr albumArtist() const; + Meta::ArtistPtr albumArtist() const override; //updating album images is possible for local tracks, but let's ignore it for now /** Returns true if the album has a cover image. * @param size The maximum width or height of the result. * when size is <= 1, return the full size image */ - virtual bool hasImage(int size = 0) const; - virtual bool canUpdateImage() const { return true; } + bool hasImage(int size = 0) const override; + bool canUpdateImage() const override { return true; } /** Returns the album cover image. * Returns a default image if no specific album image could be found. * In such a case it will start the cover fetcher. * * @param size is the maximum width or height of the resulting image. * when size is <= 1, return the full size image */ - virtual QImage image( int size = 0 ) const; + QImage image( int size = 0 ) const override; - virtual QUrl imageLocation( int size = 0 ); - virtual void setImage( const QImage &image ); - virtual void removeImage(); - virtual void setSuppressImageAutoFetch( const bool suppress ) { m_suppressAutoFetch = suppress; } - virtual bool suppressImageAutoFetch() const { return m_suppressAutoFetch; } + QUrl imageLocation( int size = 0 ) override; + void setImage( const QImage &image ) override; + void removeImage() override; + void setSuppressImageAutoFetch( const bool suppress ) override { m_suppressAutoFetch = suppress; } + bool suppressImageAutoFetch() const override { return m_suppressAutoFetch; } - virtual bool hasCapabilityInterface( Capabilities::Capability::Type type ) const; + bool hasCapabilityInterface( Capabilities::Capability::Type type ) const override; - virtual Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ); + Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ) override; //SQL specific methods int id() const { return m_id; } @@ -423,28 +420,33 @@ * The path should point to a valid image. * Note: setImage will not delete the already set image. */ - void setImage( const QString &path ); + void setImage( const QString &path ); - /** Finds or creates a magic value in the database which tells Amarok not to auto fetch an image since it has been explicitly unset. - */ - int unsetImageId() const; + /** Finds or creates a magic value in the database which tells Amarok not to auto fetch an image since it has been explicitly unset. + */ + int unsetImageId() const; - private: Collections::SqlCollection* const m_collection; + enum TracksLoadingStatus + { + NotLoaded, + Loading, + Loaded + }; - QString m_name; - int m_id; // the id of this album in the database - int m_artistId; + const QString m_name; + const int m_id; // the id of this album in the database + const int m_artistId; int m_imageId; mutable QString m_imagePath; // path read from the database mutable bool m_hasImage; // true if we have an original image mutable bool m_hasImageChecked; // true if hasImage was checked mutable int m_unsetImageId; // this is the id of the unset magic value in the image sql database static const QString AMAROK_UNSET_MAGIC; - bool m_tracksLoaded; + TracksLoadingStatus m_tracksLoaded; bool m_suppressAutoFetch; Meta::ArtistPtr m_artist; Meta::TrackList m_tracks; @@ -462,11 +464,11 @@ public: SqlComposer( Collections::SqlCollection* collection, int id, const QString &name ); - virtual QString name() const { return m_name; } + QString name() const override { return m_name; } virtual void invalidateCache(); - virtual Meta::TrackList tracks(); + Meta::TrackList tracks() override; //SQL specific methods int id() const { return m_id; } @@ -478,6 +480,7 @@ const QString m_name; bool m_tracksLoaded; + bool m_tracksLoading; Meta::TrackList m_tracks; QMutex m_mutex; @@ -490,13 +493,13 @@ public: SqlGenre( Collections::SqlCollection* collection, int id, const QString &name ); - virtual QString name() const { return m_name; } + QString name() const override { return m_name; } /** Invalidates the tracks cache */ /** Invalidates the tracks cache */ virtual void invalidateCache(); - virtual Meta::TrackList tracks(); + Meta::TrackList tracks() override; //SQL specific methods int id() const { return m_id; } @@ -520,14 +523,14 @@ public: SqlYear( Collections::SqlCollection* collection, int id, int year ); - virtual QString name() const { return QString::number(m_year); } + QString name() const override { return QString::number(m_year); } - virtual int year() const { return m_year; } + int year() const override { return m_year; } /** Invalidates the tracks cache */ virtual void invalidateCache(); - virtual Meta::TrackList tracks(); + Meta::TrackList tracks() override; //SQL specific methods int id() const { return m_id; } @@ -551,7 +554,7 @@ public: SqlLabel( Collections::SqlCollection *collection, int id, const QString &name ); - virtual QString name() const { return m_name; } + QString name() const override { return m_name; } /** Invalidates the tracks cache */ virtual void invalidateCache(); diff --git a/src/core-impl/collections/db/sql/SqlMeta.cpp b/src/core-impl/collections/db/sql/SqlMeta.cpp --- a/src/core-impl/collections/db/sql/SqlMeta.cpp +++ b/src/core-impl/collections/db/sql/SqlMeta.cpp @@ -59,6 +59,7 @@ #include #include + // additional constants namespace Meta { @@ -105,7 +106,7 @@ int SqlTrack::getTrackReturnValueCount() { - static int count = getTrackReturnValues().split( ',' ).count(); + static int count = getTrackReturnValues().split( QLatin1Char(',') ).count(); return count; } @@ -1115,7 +1116,7 @@ s = s.left( s.length() - 5 ); //remove file extension, s/_/ /g and decode %2f-like sequences - s = s.left( s.lastIndexOf( '.' ) ).replace( '_', ' ' ); + s = s.left( s.lastIndexOf( QLatin1Char('.') ) ).replace( '_', ' ' ); s = QUrl::fromPercentEncoding( s.toLatin1() ); return s; @@ -1138,7 +1139,7 @@ SqlTrack::cachedLyrics() const { /* We don't cache the string as it may be potentially very long */ - QString query = QString( "SELECT lyrics FROM lyrics WHERE url = %1" ).arg( m_urlId ); + QString query = QStringLiteral( "SELECT lyrics FROM lyrics WHERE url = %1" ).arg( m_urlId ); QStringList result = m_collection->sqlStorage()->query( query ); if( result.isEmpty() ) return QString(); @@ -1468,7 +1469,7 @@ , m_hasImage( false ) , m_hasImageChecked( false ) , m_unsetImageId( -1 ) - , m_tracksLoaded( false ) + , m_tracksLoaded( NotLoaded ) , m_suppressAutoFetch( false ) , m_mutex( QMutex::Recursive ) { @@ -1485,37 +1486,59 @@ SqlAlbum::invalidateCache() { QMutexLocker locker( &m_mutex ); - m_tracksLoaded = false; + m_tracksLoaded = NotLoaded; m_hasImage = false; m_hasImageChecked = false; m_tracks.clear(); } TrackList SqlAlbum::tracks() { + bool startQuery = false; + { QMutexLocker locker( &m_mutex ); - if( m_tracksLoaded ) + if( m_tracksLoaded == Loaded ) return m_tracks; + else if( m_tracksLoaded == NotLoaded ) + { + startQuery = true; + m_tracksLoaded = Loading; + } } - // when running the query maker don't lock. might lead to deadlock via registry - Collections::SqlQueryMaker *qm = static_cast< Collections::SqlQueryMaker* >( m_collection->queryMaker() ); - qm->setQueryType( Collections::QueryMaker::Track ); - qm->addMatch( Meta::AlbumPtr( this ) ); - qm->orderBy( Meta::valDiscNr ); - qm->orderBy( Meta::valTrackNr ); - qm->orderBy( Meta::valTitle ); - qm->setBlocking( true ); - qm->run(); + if( startQuery ) + { + // when running the query maker don't lock. might lead to deadlock via registry + Collections::SqlQueryMaker *qm = static_cast< Collections::SqlQueryMaker* >( m_collection->queryMaker() ); + qm->setQueryType( Collections::QueryMaker::Track ); + qm->addMatch( Meta::AlbumPtr( this ) ); + qm->orderBy( Meta::valDiscNr ); + qm->orderBy( Meta::valTrackNr ); + qm->orderBy( Meta::valTitle ); + qm->setBlocking( true ); + qm->run(); + { + QMutexLocker locker( &m_mutex ); + m_tracks = qm->tracks(); + m_tracksLoaded = Loaded; + delete qm; + return m_tracks; + } + } + else { - QMutexLocker locker( &m_mutex ); - m_tracks = qm->tracks(); - m_tracksLoaded = true; - delete qm; - return m_tracks; + // Wait for tracks to be loaded + forever + { + QMutexLocker locker( &m_mutex ); + if( m_tracksLoaded == Loaded ) + return m_tracks; + else + QThread::yieldCurrentThread(); + } } } @@ -1607,7 +1630,7 @@ if( size > 1 && size < 1000 ) { image = image.scaled( size, size, Qt::KeepAspectRatio, Qt::SmoothTransformation ); - image.save( cachedImagePath, "PNG" ); + image.save( cachedImagePath, "PNG", -1 ); } return image; @@ -1650,10 +1673,11 @@ if( m_name.isEmpty() ) return; - QMutexLocker locker( &m_mutex ); if( image.isNull() ) return; + QMutexLocker locker( &m_mutex ); + // removeImage() will destroy all scaled cached versions of the artwork // and remove references from the database if required. removeImage(); @@ -1663,7 +1687,7 @@ while( QFile(path).exists() ) path += '_'; // not that nice but it shouldn't happen that often. - image.save( path, "JPG" ); + image.save( path, "JPG", -1 ); setImage( path ); locker.unlock(); @@ -1742,7 +1766,7 @@ foreach( const QString &image, cachedImages ) { bool r = QFile::remove( cacheDir.filePath( image ) ); - debug() << "deleting cached image: " << image << " : " + ( r ? QString("ok") : QString("fail") ); + debug() << "deleting cached image: " << image << " : " + ( r ? QStringLiteral("ok") : QStringLiteral("fail") ); } CoverCache::invalidateAlbum( this ); @@ -1912,43 +1936,42 @@ void SqlAlbum::setImage( const QString &path ) { - if( m_imagePath == path ) - return; if( m_name.isEmpty() ) // the empty album never has an image return; QMutexLocker locker( &m_mutex ); - QString imagePath = path; + if( m_imagePath == path ) + return; QString query = "SELECT id FROM images WHERE path = '%1'"; - query = query.arg( m_collection->sqlStorage()->escape( imagePath ) ); + query = query.arg( m_collection->sqlStorage()->escape( path ) ); QStringList res = m_collection->sqlStorage()->query( query ); if( res.isEmpty() ) { QString insert = QString( "INSERT INTO images( path ) VALUES ( '%1' )" ) - .arg( m_collection->sqlStorage()->escape( imagePath ) ); + .arg( m_collection->sqlStorage()->escape( path ) ); m_imageId = m_collection->sqlStorage()->insert( insert, "images" ); } else m_imageId = res.first().toInt(); if( m_imageId >= 0 ) { - query = QString("UPDATE albums SET image = %1 WHERE albums.id = %2" ) + query = QStringLiteral("UPDATE albums SET image = %1 WHERE albums.id = %2" ) .arg( QString::number( m_imageId ), QString::number( m_id ) ); m_collection->sqlStorage()->query( query ); - m_imagePath = imagePath; + m_imagePath = path; m_hasImage = true; m_hasImageChecked = true; CoverCache::invalidateAlbum( this ); } } /** Set the compilation flag. - * Actually it does not cange this album but instead moves + * Actually it does not change this album but instead moves * the tracks to other albums (e.g. one with the same name which is a * compilation) * If the compilation flag is set to "false" then all songs diff --git a/src/core-impl/collections/db/sql/SqlQueryMaker.h b/src/core-impl/collections/db/sql/SqlQueryMaker.h --- a/src/core-impl/collections/db/sql/SqlQueryMaker.h +++ b/src/core-impl/collections/db/sql/SqlQueryMaker.h @@ -32,40 +32,40 @@ Q_OBJECT public: - SqlQueryMaker( SqlCollection* collection ); + explicit SqlQueryMaker( SqlCollection* collection ); virtual ~SqlQueryMaker(); - virtual void abortQuery(); - virtual void run(); + void abortQuery() override; + void run() override; - virtual QueryMaker* setQueryType( QueryType type ); + QueryMaker* setQueryType( QueryType type ) override; - virtual QueryMaker* addMatch( const Meta::TrackPtr &track ); - virtual QueryMaker* addMatch( const Meta::ArtistPtr &artist, ArtistMatchBehaviour behaviour = TrackArtists ); - virtual QueryMaker* addMatch( const Meta::AlbumPtr &album ); - virtual QueryMaker* addMatch( const Meta::ComposerPtr &composer ); - virtual QueryMaker* addMatch( const Meta::GenrePtr &genre ); - virtual QueryMaker* addMatch( const Meta::YearPtr &year ); - virtual QueryMaker* addMatch( const Meta::LabelPtr &label ); + QueryMaker* addMatch( const Meta::TrackPtr &track ) override; + QueryMaker* addMatch( const Meta::ArtistPtr &artist, ArtistMatchBehaviour behaviour = TrackArtists ) override; + QueryMaker* addMatch( const Meta::AlbumPtr &album ) override; + QueryMaker* addMatch( const Meta::ComposerPtr &composer ) override; + QueryMaker* addMatch( const Meta::GenrePtr &genre ) override; + QueryMaker* addMatch( const Meta::YearPtr &year ) override; + QueryMaker* addMatch( const Meta::LabelPtr &label ) override; - virtual QueryMaker* addFilter( qint64 value, const QString &filter, bool matchBegin, bool matchEnd ); - virtual QueryMaker* excludeFilter( qint64 value, const QString &filter, bool matchBegin, bool matchEnd ); + QueryMaker* addFilter( qint64 value, const QString &filter, bool matchBegin, bool matchEnd ) override; + QueryMaker* excludeFilter( qint64 value, const QString &filter, bool matchBegin, bool matchEnd ) override; - virtual QueryMaker* addNumberFilter( qint64 value, qint64 filter, NumberComparison compare ); - virtual QueryMaker* excludeNumberFilter( qint64 value, qint64 filter, NumberComparison compare ); + QueryMaker* addNumberFilter( qint64 value, qint64 filter, NumberComparison compare ) override; + QueryMaker* excludeNumberFilter( qint64 value, qint64 filter, NumberComparison compare ) override; - virtual QueryMaker* addReturnValue( qint64 value ); - virtual QueryMaker* addReturnFunction( ReturnFunction function, qint64 value ); - virtual QueryMaker* orderBy( qint64 value, bool descending = false ); + QueryMaker* addReturnValue( qint64 value ) override; + QueryMaker* addReturnFunction( ReturnFunction function, qint64 value ) override; + QueryMaker* orderBy( qint64 value, bool descending = false ) override; - virtual QueryMaker* limitMaxResultSize( int size ); + QueryMaker* limitMaxResultSize( int size ) override; - virtual QueryMaker* setAlbumQueryMode( AlbumQueryMode mode ); - virtual QueryMaker* setLabelQueryMode( LabelQueryMode mode ); + QueryMaker* setAlbumQueryMode( AlbumQueryMode mode ) override; + QueryMaker* setLabelQueryMode( LabelQueryMode mode ) override; - virtual QueryMaker* beginAnd(); - virtual QueryMaker* beginOr(); - virtual QueryMaker* endAndOr(); + QueryMaker* beginAnd() override; + QueryMaker* beginOr() override; + QueryMaker* endAndOr() override; QString query(); QStringList runQuery( const QString &query ); @@ -87,7 +87,7 @@ Meta::LabelList labels() const; protected: - virtual QString escape( QString text ) const; + virtual QString escape( const QString &text ) const; /** * returns a pattern for LIKE operator that will match given text with given options @@ -127,7 +127,7 @@ { public: virtual SqlQueryMaker* createQueryMaker() const = 0; - virtual ~SqlQueryMakerFactory() {}; + virtual ~SqlQueryMakerFactory() {} }; } //namespace Collections diff --git a/src/core-impl/collections/db/sql/SqlQueryMaker.cpp b/src/core-impl/collections/db/sql/SqlQueryMaker.cpp --- a/src/core-impl/collections/db/sql/SqlQueryMaker.cpp +++ b/src/core-impl/collections/db/sql/SqlQueryMaker.cpp @@ -52,7 +52,7 @@ delete m_queryMakerInternal; } - virtual void requestAbort() + void requestAbort() override { m_aborted = true; } @@ -63,7 +63,7 @@ } protected: - virtual void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) + void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) override { Q_UNUSED(self); Q_UNUSED(thread); @@ -73,13 +73,13 @@ else setStatus(Status_Running); } - void defaultBegin(const ThreadWeaver::JobPointer& self, ThreadWeaver::Thread *thread) + void defaultBegin(const ThreadWeaver::JobPointer& self, ThreadWeaver::Thread *thread) override { Q_EMIT started(self); ThreadWeaver::Job::defaultBegin(self, thread); } - void defaultEnd(const ThreadWeaver::JobPointer& self, ThreadWeaver::Thread *thread) + void defaultEnd(const ThreadWeaver::JobPointer& self, ThreadWeaver::Thread *thread) override { ThreadWeaver::Job::defaultEnd(self, thread); if (!self->success()) { @@ -233,7 +233,7 @@ Q_UNUSED( job ) d->worker = 0; // d->worker *is* the job, prevent stale pointer - emit queryDone(); + Q_EMIT queryDone(); } QueryMaker* @@ -356,7 +356,7 @@ if( kurl.scheme() == "amarok-sqltrackuid" ) */ { - d->queryMatch += QString( " AND urls.uniqueid = '%1' " ).arg( url /*kurl.url()*/ ); + d->queryMatch += QStringLiteral( " AND urls.uniqueid = '%1' " ).arg( url /*kurl.url()*/ ); } else { @@ -392,8 +392,8 @@ if( artist && !artist->name().isEmpty() ) { - artistQuery = QString("artists.name = '%1'").arg( escape( artist->name() ) ); - albumArtistQuery = QString("albumartists.name = '%1'").arg( escape( artist->name() ) ); + artistQuery = QStringLiteral("artists.name = '%1'").arg( escape( artist->name() ) ); + albumArtistQuery = QStringLiteral("albumartists.name = '%1'").arg( escape( artist->name() ) ); } else { @@ -1092,7 +1092,7 @@ } QString -SqlQueryMaker::escape( QString text ) const //krazy:exclude=constref +SqlQueryMaker::escape( const QString &text ) const //krazy:exclude=constref { return m_collection->sqlStorage()->escape( text ); } @@ -1136,7 +1136,7 @@ } else { - return QString( " = '%1' COLLATE utf8_unicode_ci " ).arg( escape( text ) ); + return QStringLiteral( " = '%1' COLLATE utf8_unicode_ci " ).arg( escape( text ) ); } } diff --git a/src/core-impl/collections/db/sql/SqlQueryMakerInternal.h b/src/core-impl/collections/db/sql/SqlQueryMakerInternal.h --- a/src/core-impl/collections/db/sql/SqlQueryMakerInternal.h +++ b/src/core-impl/collections/db/sql/SqlQueryMakerInternal.h @@ -41,14 +41,14 @@ void setResultAsDataPtrs( bool value ); Q_SIGNALS: - void newTracksReady( Meta::TrackList ); - void newArtistsReady( Meta::ArtistList ); - void newAlbumsReady( Meta::AlbumList ); - void newGenresReady( Meta::GenreList ); - void newComposersReady( Meta::ComposerList ); - void newYearsReady( Meta::YearList ); - void newResultReady( QStringList ); - void newLabelsReady( Meta::LabelList ); + void newTracksReady( const Meta::TrackList& ); + void newArtistsReady( const Meta::ArtistList& ); + void newAlbumsReady( const Meta::AlbumList& ); + void newGenresReady( const Meta::GenreList& ); + void newComposersReady( const Meta::ComposerList& ); + void newYearsReady( const Meta::YearList& ); + void newResultReady( const QStringList& ); + void newLabelsReady( const Meta::LabelList& ); private: void handleResult( const QStringList &result ); diff --git a/src/core-impl/collections/db/sql/SqlQueryMakerInternal.cpp b/src/core-impl/collections/db/sql/SqlQueryMakerInternal.cpp --- a/src/core-impl/collections/db/sql/SqlQueryMakerInternal.cpp +++ b/src/core-impl/collections/db/sql/SqlQueryMakerInternal.cpp @@ -74,7 +74,7 @@ { switch( m_queryType ) { case QueryMaker::Custom: - emit newResultReady( result ); + Q_EMIT newResultReady( result ); break; case QueryMaker::Track: handleTracks( result ); @@ -107,29 +107,29 @@ { switch( m_queryType ) { case QueryMaker::Custom: - emit newResultReady( QStringList() ); + Q_EMIT newResultReady( QStringList() ); break; case QueryMaker::Track: - emit newTracksReady( Meta::TrackList() ); + Q_EMIT newTracksReady( Meta::TrackList() ); break; case QueryMaker::Artist: case QueryMaker::AlbumArtist: - emit newArtistsReady( Meta::ArtistList() ); + Q_EMIT newArtistsReady( Meta::ArtistList() ); break; case QueryMaker::Album: - emit newAlbumsReady( Meta::AlbumList() ); + Q_EMIT newAlbumsReady( Meta::AlbumList() ); break; case QueryMaker::Genre: - emit newGenresReady( Meta::GenreList() ); + Q_EMIT newGenresReady( Meta::GenreList() ); break; case QueryMaker::Composer: - emit newComposersReady( Meta::ComposerList() ); + Q_EMIT newComposersReady( Meta::ComposerList() ); break; case QueryMaker::Year: - emit newYearsReady( Meta::YearList() ); + Q_EMIT newYearsReady( Meta::YearList() ); break; case QueryMaker::Label: - emit newLabelsReady( Meta::LabelList() ); + Q_EMIT newLabelsReady( Meta::LabelList() ); break; case QueryMaker::None: @@ -152,7 +152,7 @@ QStringList row = result.mid( i*returnCount, returnCount ); tracks.append( reg->getTrack( row[Meta::SqlTrack::returnIndex_trackId].toInt(), row ) ); } - emit newTracksReady( tracks ); + Q_EMIT newTracksReady( tracks ); } void @@ -167,7 +167,7 @@ if( id.toInt() > 0 ) artists.append( reg->getArtist( id.toInt(), name ) ); } - emit newArtistsReady( artists ); + Q_EMIT newArtistsReady( artists ); } void @@ -182,7 +182,7 @@ QString artist = iter.next(); albums.append( reg->getAlbum( id.toInt(), name, artist.toInt() ) ); } - emit newAlbumsReady( albums ); + Q_EMIT newAlbumsReady( albums ); } void @@ -196,7 +196,7 @@ QString id = iter.next(); genres.append( reg->getGenre( id.toInt(), name ) ); } - emit newGenresReady( genres ); + Q_EMIT newGenresReady( genres ); } void @@ -210,7 +210,7 @@ QString id = iter.next(); composers.append( reg->getComposer( id.toInt(), name ) ); } - emit newComposersReady( composers ); + Q_EMIT newComposersReady( composers ); } void @@ -224,7 +224,7 @@ QString id = iter.next(); years.append( reg->getYear( id.toInt(), name.toInt() ) ); } - emit newYearsReady( years ); + Q_EMIT newYearsReady( years ); } void @@ -239,6 +239,6 @@ labels.append( reg->getLabel( id.toInt(), label ) ); } - emit newLabelsReady( labels ); + Q_EMIT newLabelsReady( labels ); } diff --git a/src/core-impl/collections/db/sql/SqlReadLabelCapability.h b/src/core-impl/collections/db/sql/SqlReadLabelCapability.h --- a/src/core-impl/collections/db/sql/SqlReadLabelCapability.h +++ b/src/core-impl/collections/db/sql/SqlReadLabelCapability.h @@ -33,28 +33,28 @@ { Q_OBJECT public: - SqlReadLabelCapability( Meta::SqlTrack *track, QSharedPointer storage ); + SqlReadLabelCapability( Meta::SqlTrack *track, const QSharedPointer &storage ); /** * fetches a list of labels assigned to this track */ - virtual void fetchLabels(); + void fetchLabels() override; /** * fetches a list of all labels in the database */ - virtual void fetchGlobalLabels(); //TODO: This shouldn't be in a Track capability + void fetchGlobalLabels() override; //TODO: This shouldn't be in a Track capability /** * @returns all labels assigned to this track */ - virtual QStringList labels(); + QStringList labels() override; private: QStringList m_labels; Meta::TrackPtr m_track; QSharedPointer m_storage; - void fetch( QString uniqueURL ); + void fetch(const QString &uniqueURL ); }; } diff --git a/src/core-impl/collections/db/sql/SqlReadLabelCapability.cpp b/src/core-impl/collections/db/sql/SqlReadLabelCapability.cpp --- a/src/core-impl/collections/db/sql/SqlReadLabelCapability.cpp +++ b/src/core-impl/collections/db/sql/SqlReadLabelCapability.cpp @@ -25,7 +25,7 @@ namespace Capabilities { -SqlReadLabelCapability::SqlReadLabelCapability( Meta::SqlTrack *track, QSharedPointer storage ) +SqlReadLabelCapability::SqlReadLabelCapability( Meta::SqlTrack *track, const QSharedPointer& storage ) : ReadLabelCapability() , m_track( track ) , m_storage( storage ) @@ -35,7 +35,7 @@ } void -SqlReadLabelCapability::fetch( QString uniqueURL ) +SqlReadLabelCapability::fetch( const QString &uniqueURL ) { QStringList labels; @@ -66,7 +66,7 @@ } m_labels = labels; - emit labelsFetched( labels ); + Q_EMIT labelsFetched( labels ); } diff --git a/src/core-impl/collections/db/sql/SqlRegistry.h b/src/core-impl/collections/db/sql/SqlRegistry.h --- a/src/core-impl/collections/db/sql/SqlRegistry.h +++ b/src/core-impl/collections/db/sql/SqlRegistry.h @@ -27,9 +27,7 @@ #include #include -class SqlStorage; -class TestScanResultProcessorFull; class TestSqlAlbum; class TestSqlArtist; class TestSqlTrack; @@ -80,11 +78,12 @@ Q_OBJECT public: - SqlRegistry(Collections::SqlCollection *collection); + explicit SqlRegistry(Collections::SqlCollection *collection); virtual ~SqlRegistry(); /** Searches a directory entry in the scanned directories This function searches an existing directory entry. + @param path the directory path @param mtime if mtime is != 0 then the mtime of the entry is updated @returns the directory id */ @@ -161,7 +160,7 @@ * is normally called by SqlTrack. Do not call directly unless you know what you * do. */ - void removeTrack( int urlId, const QString uid ); + void removeTrack( int urlId, const QString &uid ); // --- functions needed to commit a track diff --git a/src/core-impl/collections/db/sql/SqlRegistry.cpp b/src/core-impl/collections/db/sql/SqlRegistry.cpp --- a/src/core-impl/collections/db/sql/SqlRegistry.cpp +++ b/src/core-impl/collections/db/sql/SqlRegistry.cpp @@ -30,7 +30,7 @@ #include SqlRegistry::SqlRegistry( Collections::SqlCollection* collection ) - : QObject( 0 ) + : QObject( nullptr ) , m_collection( collection ) , m_blockDatabaseUpdateCount( 0 ) , m_collectionChanged( false ) @@ -340,7 +340,7 @@ } void -SqlRegistry::removeTrack( int urlId, const QString uid ) +SqlRegistry::removeTrack( int urlId, const QString &uid ) { // delete all entries linked to the url, including track QStringList tables = QStringList() << "tracks" << "lyrics" << "statistics" << "urls_labels"; @@ -832,7 +832,7 @@ foreach( Meta::SqlYearPtr year, dirtyYears ) { // this means that a new year was added to track or an old removed (or both), - // Collection docs says we need to emit updated() in this case. Ditto below. + // Collection docs says we need to Q_EMIT updated() in this case. Ditto below. m_collectionChanged = true; year->invalidateCache(); year->notifyObservers(); @@ -851,7 +851,7 @@ } foreach( Meta::SqlTrackPtr track, dirtyTracks ) { - // if only track changes, no need to emit updated() from here + // if only track changes, no need to Q_EMIT updated() from here track->notifyObservers(); } foreach( Meta::SqlArtistPtr artist, dirtyArtists ) @@ -929,7 +929,7 @@ // elem.count() == 2 is correct because elem is one pointer to the object // and the other is stored in the hash map (except for m_trackMap, m_albumMap - // and m_artistMap , where another refence is stored in m_uidMap, m_albumIdMap + // and m_artistMap , where another reference is stored in m_uidMap, m_albumIdMap // and m_artistIdMap #define foreachCollectGarbage( Key, Type, RefCount, x ) \ for( QMutableHashIterator iter(x); iter.hasNext(); ) \ diff --git a/src/core-impl/collections/db/sql/SqlRegistry_p.h b/src/core-impl/collections/db/sql/SqlRegistry_p.h --- a/src/core-impl/collections/db/sql/SqlRegistry_p.h +++ b/src/core-impl/collections/db/sql/SqlRegistry_p.h @@ -62,37 +62,37 @@ virtual ~TrackUrlsTableCommitter() {} protected: - virtual QString tableName(); - virtual int getId( Meta::SqlTrack *track ); - virtual void setId( Meta::SqlTrack *track, int id ); - virtual QStringList getFields(); - virtual QStringList getValues( Meta::SqlTrack *track ); + QString tableName() override; + int getId( Meta::SqlTrack *track ) override; + void setId( Meta::SqlTrack *track, int id ) override; + QStringList getFields() override; + QStringList getValues( Meta::SqlTrack *track ) override; }; class TrackTracksTableCommitter: public AbstractTrackTableCommitter { public: virtual ~TrackTracksTableCommitter() {} protected: - virtual QString tableName(); - virtual int getId( Meta::SqlTrack *track ); - virtual void setId( Meta::SqlTrack *track, int id ); - virtual QStringList getFields(); - virtual QStringList getValues( Meta::SqlTrack *track ); + QString tableName() override; + int getId( Meta::SqlTrack *track ) override; + void setId( Meta::SqlTrack *track, int id ) override; + QStringList getFields() override; + QStringList getValues( Meta::SqlTrack *track ) override; }; class TrackStatisticsTableCommitter: public AbstractTrackTableCommitter { public: virtual ~TrackStatisticsTableCommitter() {} protected: - virtual QString tableName(); - virtual int getId( Meta::SqlTrack *track ); - virtual void setId( Meta::SqlTrack *track, int id ); - virtual QStringList getFields(); - virtual QStringList getValues( Meta::SqlTrack *track ); + QString tableName() override; + int getId( Meta::SqlTrack *track ) override; + void setId( Meta::SqlTrack *track, int id ) override; + QStringList getFields() override; + QStringList getValues( Meta::SqlTrack *track ) override; }; diff --git a/src/core-impl/collections/db/sql/SqlScanResultProcessor.h b/src/core-impl/collections/db/sql/SqlScanResultProcessor.h --- a/src/core-impl/collections/db/sql/SqlScanResultProcessor.h +++ b/src/core-impl/collections/db/sql/SqlScanResultProcessor.h @@ -32,32 +32,32 @@ public: SqlScanResultProcessor( GenericScanManager* manager, Collections::SqlCollection *collection, - QObject *parent = 0 ); - virtual ~SqlScanResultProcessor(); + QObject *parent = nullptr ); + ~SqlScanResultProcessor() override; protected Q_SLOTS: - virtual void scanStarted( GenericScanManager::ScanType type ); - virtual void scanSucceeded(); + void scanStarted( GenericScanManager::ScanType type ) override; + void scanSucceeded() override; virtual void displayMessages(); protected: - virtual void message( const QString& message ); + void message( const QString& message ) override; - virtual void commitDirectory( QSharedPointer directory ); - virtual void commitAlbum( CollectionScanner::Album *album ); - virtual void commitTrack( CollectionScanner::Track *track, CollectionScanner::Album *srcAlbum ); + void commitDirectory( QSharedPointer directory ) override; + void commitAlbum( CollectionScanner::Album *album ) override; + void commitTrack( CollectionScanner::Track *track, CollectionScanner::Album *srcAlbum ) override; /** Deletes all directories (and it's tracks) not contained in m_foundDirectories */ - virtual void deleteDeletedDirectories(); + void deleteDeletedDirectories() override; - virtual void deleteDeletedTracksAndSubdirs( QSharedPointer directory ); + void deleteDeletedTracksAndSubdirs( QSharedPointer directory ) override; /** Removes all tracks contained in the directory dirId that are not contained in m_foundTracks. */ virtual void deleteDeletedTracks( int directoryId ); - virtual void cleanupMembers(); + void cleanupMembers() override; void blockUpdates(); void unblockUpdates(); diff --git a/src/core-impl/collections/db/sql/SqlScanResultProcessor.cpp b/src/core-impl/collections/db/sql/SqlScanResultProcessor.cpp --- a/src/core-impl/collections/db/sql/SqlScanResultProcessor.cpp +++ b/src/core-impl/collections/db/sql/SqlScanResultProcessor.cpp @@ -33,6 +33,7 @@ #include +#include #include SqlScanResultProcessor::SqlScanResultProcessor( GenericScanManager* manager, @@ -94,13 +95,17 @@ void SqlScanResultProcessor::blockUpdates() { + DEBUG_BLOCK + m_collection->blockUpdatedSignal(); m_collection->registry()->blockDatabaseUpdate(); } void SqlScanResultProcessor::unblockUpdates() { + DEBUG_BLOCK + m_collection->registry()->unblockDatabaseUpdate(); m_collection->unblockUpdatedSignal(); } @@ -263,7 +268,7 @@ urlsCacheInsert( entry ); // removes the previous entry (by id) first if necessary m_foundTracks.insert( uid, entry.id ); - // TODO: we need to check the modified date of the file agains the last updated of the file + // TODO: we need to check the modified date of the file against the last updated of the file // to figure out if the track information was updated from outside Amarok. // In such a case we would fully reread all the information as if in a FullScan @@ -599,9 +604,9 @@ } } - // now we must fileter-out all found directories *and their children*, because the + // now we must filter out all found directories *and their children*, because the // children are *not* in m_foundDirectories and deleteDeletedDirectories() would - // remove them errorneously + // remove them erroneously foreach( int foundDirectoryId, m_foundDirectories ) { if( idToDirEntryMap.contains( foundDirectoryId ) ) @@ -627,9 +632,11 @@ void SqlScanResultProcessor::urlsCacheInit() { + DEBUG_BLOCK + auto storage = m_collection->sqlStorage(); - QString query = QString( "SELECT id, deviceid, rpath, directory, uniqueid FROM urls;"); + QString query = QStringLiteral( "SELECT id, deviceid, rpath, directory, uniqueid FROM urls;"); QStringList res = storage->query( query ); for( int i = 0; i < res.count(); ) @@ -660,6 +667,8 @@ } urlsCacheInsert( entry ); + + QAbstractEventDispatcher::instance()->processEvents( QEventLoop::AllEvents ); } } @@ -670,7 +679,7 @@ if( m_urlsCache.contains( entry.id ) ) urlsCacheRemove( m_urlsCache[ entry.id ] ); - // following shoudn't normally happen: + // following shouldn't normally happen: if( m_pathCache.contains( entry.path ) ) { int oldId = m_pathCache.value( entry.path ); diff --git a/src/core-impl/collections/db/sql/SqlWriteLabelCapability.h b/src/core-impl/collections/db/sql/SqlWriteLabelCapability.h --- a/src/core-impl/collections/db/sql/SqlWriteLabelCapability.h +++ b/src/core-impl/collections/db/sql/SqlWriteLabelCapability.h @@ -33,8 +33,8 @@ { Q_OBJECT public: - SqlWriteLabelCapability( Meta::SqlTrack *track, QSharedPointer storage ); - void setLabels( const QStringList &removedLabels, const QStringList &newlabels ); + SqlWriteLabelCapability( Meta::SqlTrack *track, const QSharedPointer &storage ); + void setLabels( const QStringList &removedLabels, const QStringList &newlabels ) override; private: Meta::TrackPtr m_track; diff --git a/src/core-impl/collections/db/sql/SqlWriteLabelCapability.cpp b/src/core-impl/collections/db/sql/SqlWriteLabelCapability.cpp --- a/src/core-impl/collections/db/sql/SqlWriteLabelCapability.cpp +++ b/src/core-impl/collections/db/sql/SqlWriteLabelCapability.cpp @@ -25,7 +25,7 @@ namespace Capabilities { -SqlWriteLabelCapability::SqlWriteLabelCapability( Meta::SqlTrack* track, QSharedPointer storage ) +SqlWriteLabelCapability::SqlWriteLabelCapability( Meta::SqlTrack* track, const QSharedPointer &storage ) : WriteLabelCapability() , m_track( track ) , m_storage( storage ) diff --git a/src/core-impl/collections/db/sql/amarok_sqlcollection_export.h b/src/core-impl/collections/db/sql/amarok_sqlcollection_export.h deleted file mode 100644 --- a/src/core-impl/collections/db/sql/amarok_sqlcollection_export.h +++ /dev/null @@ -1,47 +0,0 @@ -/**************************************************************************************** - * Copyright (c) 2007 David Faure * - * * - * This program is free software; you can redistribute it and/or modify it under * - * the terms of the GNU General Public License as published by the Free Software * - * Foundation; either version 2 of the License, or (at your option) any later * - * version. * - * * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY * - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * - * PARTICULAR PURPOSE. See the GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License along with * - * this program. If not, see . * - ****************************************************************************************/ - -#ifndef AMAROK_SQLCOLLECTION_EXPORT_H -#define AMAROK_SQLCOLLECTION_EXPORT_H - -/* needed for Q_DECL_EXPORT and Q_DECL_IMPORT macros */ -#include - -#ifndef AMAROK_SQLCOLLECTION_EXPORT -# if defined(MAKE_AMAROK_SQLCOLLECTION_LIB) - /* We are building this library */ -# define AMAROK_SQLCOLLECTION_EXPORT Q_DECL_EXPORT -# else - /* We are using this library */ -# define AMAROK_SQLCOLLECTION_EXPORT Q_DECL_IMPORT -# endif -#endif - -#ifndef AMAROK_SQLCOLLECTION_MYSQLE_EXPORT -# if defined(MAKE_AMAROK_COLLECTION_MYSQLECOLLECTION_LIB) - /* We are building this library */ -# define AMAROK_SQLCOLLECTION_MYSQLE_EXPORT Q_DECL_EXPORT -# else - /* We are using this library */ -# define AMAROK_SQLCOLLECTION_MYSQLE_EXPORT Q_DECL_IMPORT -# endif -#endif - -# ifndef AMAROK_SQLCOLLECTION_EXPORT_DEPRECATED -# define AMAROK_SQLCOLLECTION_EXPORT_DEPRECATED QT_DEPRECATED AMAROK_SQLCOLLECTION_EXPORT -# endif - -#endif diff --git a/src/core-impl/collections/db/sql/device/massstorage/MassStorageDeviceHandler.h b/src/core-impl/collections/db/sql/device/massstorage/MassStorageDeviceHandler.h --- a/src/core-impl/collections/db/sql/device/massstorage/MassStorageDeviceHandler.h +++ b/src/core-impl/collections/db/sql/device/massstorage/MassStorageDeviceHandler.h @@ -24,20 +24,20 @@ class MassStorageDeviceHandlerFactory : public DeviceHandlerFactory { public: - MassStorageDeviceHandlerFactory( QObject *parent ) : DeviceHandlerFactory( parent ) {} + explicit MassStorageDeviceHandlerFactory( QObject *parent ) : DeviceHandlerFactory( parent ) {} virtual ~MassStorageDeviceHandlerFactory(); - virtual bool canHandle( const Solid::Device &device ) const; + bool canHandle( const Solid::Device &device ) const override; - virtual bool canCreateFromMedium() const; + bool canCreateFromMedium() const override; - virtual DeviceHandler* createHandler( const Solid::Device &device, const QString &uuid, QSharedPointer s ) const; + DeviceHandler* createHandler( const Solid::Device &device, const QString &uuid, QSharedPointer s ) const override; - virtual bool canCreateFromConfig() const; + bool canCreateFromConfig() const override; - virtual DeviceHandler* createHandler( KSharedConfigPtr c, QSharedPointer s ) const; + DeviceHandler* createHandler( const KSharedConfigPtr &c, QSharedPointer s ) const override; - virtual QString type() const; + QString type() const override; private: bool excludedFilesystem( const QString &fstype ) const; @@ -54,13 +54,13 @@ virtual ~MassStorageDeviceHandler(); - virtual bool isAvailable() const; - virtual QString type() const; - virtual int getDeviceID( ); - virtual const QString &getDevicePath() const; - virtual void getURL( QUrl &absolutePath, const QUrl &relativePath ); - virtual void getPlayableURL( QUrl &absolutePath, const QUrl &relativePath ); - virtual bool deviceMatchesUdi( const QString &udi ) const; + bool isAvailable() const override; + QString type() const override; + int getDeviceID( ) override; + const QString &getDevicePath() const override; + void getURL( QUrl &absolutePath, const QUrl &relativePath ) override; + void getPlayableURL( QUrl &absolutePath, const QUrl &relativePath ) override; + bool deviceMatchesUdi( const QString &udi ) const override; private: diff --git a/src/core-impl/collections/db/sql/device/massstorage/MassStorageDeviceHandler.cpp b/src/core-impl/collections/db/sql/device/massstorage/MassStorageDeviceHandler.cpp --- a/src/core-impl/collections/db/sql/device/massstorage/MassStorageDeviceHandler.cpp +++ b/src/core-impl/collections/db/sql/device/massstorage/MassStorageDeviceHandler.cpp @@ -69,7 +69,7 @@ { absolutePath.setPath( m_mountPoint ); absolutePath = absolutePath.adjusted(QUrl::StripTrailingSlash); - absolutePath.setPath(absolutePath.path() + '/' + ( relativePath.path() )); + absolutePath.setPath(absolutePath.path() + QLatin1Char('/') + ( relativePath.path() )); absolutePath.setPath( QDir::cleanPath(absolutePath.path()) ); } @@ -125,7 +125,7 @@ { } -DeviceHandler * MassStorageDeviceHandlerFactory::createHandler( KSharedConfigPtr, QSharedPointer ) const +DeviceHandler * MassStorageDeviceHandlerFactory::createHandler( const KSharedConfigPtr&, QSharedPointer ) const { return 0; } @@ -158,16 +158,16 @@ debug() << "Found existing UUID config for ID " << ids[0] << " , uuid " << volume->uuid(); s->query( QString( "UPDATE devices SET lastmountpoint = '%2' WHERE " "id = %1;" ) - .arg( ids[0] ) - .arg( s->escape( volumeAccess->filePath() ) ) ); + .arg( ids[0], + s->escape( volumeAccess->filePath() ) ) ); return new MassStorageDeviceHandler( ids[0].toInt(), volumeAccess->filePath(), udi ); } else { const int id = s->insert( QString( "INSERT INTO devices( type, uuid, lastmountpoint ) " "VALUES ( 'uuid', '%1', '%2' );" ) - .arg( volume->uuid() ) - .arg( s->escape( volumeAccess->filePath() ) ), + .arg( volume->uuid(), + s->escape( volumeAccess->filePath() ) ), "devices" ); if ( id == 0 ) { diff --git a/src/core-impl/collections/db/sql/device/nfs/NfsDeviceHandler.h b/src/core-impl/collections/db/sql/device/nfs/NfsDeviceHandler.h --- a/src/core-impl/collections/db/sql/device/nfs/NfsDeviceHandler.h +++ b/src/core-impl/collections/db/sql/device/nfs/NfsDeviceHandler.h @@ -23,20 +23,20 @@ class NfsDeviceHandlerFactory : public DeviceHandlerFactory { public: - NfsDeviceHandlerFactory( QObject *parent ) : DeviceHandlerFactory( parent ) {} + explicit NfsDeviceHandlerFactory( QObject *parent ) : DeviceHandlerFactory( parent ) {} virtual ~NfsDeviceHandlerFactory(); - virtual bool canHandle( const Solid::Device &device ) const; + bool canHandle( const Solid::Device &device ) const override; - virtual bool canCreateFromMedium() const; + bool canCreateFromMedium() const override; - virtual DeviceHandler* createHandler( const Solid::Device &device, const QString &uuid, QSharedPointer s ) const; + DeviceHandler* createHandler( const Solid::Device &device, const QString &uuid, QSharedPointer s ) const override; - virtual bool canCreateFromConfig() const; + bool canCreateFromConfig() const override; - virtual DeviceHandler* createHandler( KSharedConfigPtr c, QSharedPointer s ) const; + DeviceHandler* createHandler( const KSharedConfigPtr &c, QSharedPointer s ) const override; - virtual QString type() const; + QString type() const override; }; /** @@ -51,13 +51,13 @@ virtual ~NfsDeviceHandler(); - virtual bool isAvailable() const; - virtual QString type() const; - virtual int getDeviceID( ); - virtual const QString &getDevicePath() const; - virtual void getURL( QUrl &absolutePath, const QUrl &relativePath ); - virtual void getPlayableURL( QUrl &absoluteUrl, const QUrl &relativeUrl ); - virtual bool deviceMatchesUdi( const QString &udi ) const; + bool isAvailable() const override; + QString type() const override; + int getDeviceID( ) override; + const QString &getDevicePath() const override; + void getURL( QUrl &absolutePath, const QUrl &relativePath ) override; + void getPlayableURL( QUrl &absoluteUrl, const QUrl &relativeUrl ) override; + bool deviceMatchesUdi( const QString &udi ) const override; private: diff --git a/src/core-impl/collections/db/sql/device/nfs/NfsDeviceHandler.cpp b/src/core-impl/collections/db/sql/device/nfs/NfsDeviceHandler.cpp --- a/src/core-impl/collections/db/sql/device/nfs/NfsDeviceHandler.cpp +++ b/src/core-impl/collections/db/sql/device/nfs/NfsDeviceHandler.cpp @@ -80,7 +80,7 @@ { absolutePath.setPath( m_mountPoint ); absolutePath = absolutePath.adjusted(QUrl::StripTrailingSlash); - absolutePath.setPath(absolutePath.path() + '/' + ( relativePath.path() )); + absolutePath.setPath(absolutePath.path() + QLatin1Char('/') + ( relativePath.path() )); absolutePath.setPath( QDir::cleanPath(absolutePath.path()) ); } @@ -147,9 +147,9 @@ } DeviceHandler * -NfsDeviceHandlerFactory::createHandler( KSharedConfigPtr, QSharedPointer ) const +NfsDeviceHandlerFactory::createHandler( const KSharedConfigPtr&, QSharedPointer ) const { - return 0; + return nullptr; } DeviceHandler * @@ -159,10 +159,10 @@ if( !s ) { debug() << "!s, returning 0"; - return 0; + return nullptr; } if( !canHandle( device ) ) - return 0; + return nullptr; const Solid::StorageAccess *access = device.as(); Q_ASSERT( access ); // canHandle() checks it @@ -177,30 +177,30 @@ QStringList ids = s->query( QString( "SELECT id, label, lastmountpoint " "FROM devices WHERE type = 'nfs' " "AND servername = '%1' AND sharename = '%2';" ) - .arg( s->escape( server ) ) - .arg( s->escape( share ) ) ); + .arg( s->escape( server ), + s->escape( share ) ) ); if ( ids.size() == 3 ) { debug() << "Found existing NFS config for ID " << ids[0] << " , server " << server << " ,share " << share; s->query( QString( "UPDATE devices SET lastmountpoint = '%2' WHERE " "id = %1;" ) - .arg( ids[0] ) - .arg( s->escape( mountPoint ) ) ); + .arg( ids[0], + s->escape( mountPoint ) ) ); return new NfsDeviceHandler( ids[0].toInt(), server, share, mountPoint, udi ); } else { int id = s->insert( QString( "INSERT INTO devices" "( type, servername, sharename, lastmountpoint ) " "VALUES ( 'nfs', '%1', '%2', '%3' );" ) - .arg( s->escape( server ) ) - .arg( s->escape( share ) ) - .arg( s->escape( mountPoint ) ), + .arg( s->escape( server ), + s->escape( share ), + s->escape( mountPoint ) ), "devices" ); if ( id == 0 ) { warning() << "Inserting into devices failed for type=nfs, server=" << server << ", share=" << share; - return 0; + return nullptr; } debug() << "Created new NFS device with ID " << id << " , server " << server << " ,share " << share; return new NfsDeviceHandler( id, server, share, mountPoint, udi ); diff --git a/src/core-impl/collections/db/sql/device/smb/SmbDeviceHandler.h b/src/core-impl/collections/db/sql/device/smb/SmbDeviceHandler.h --- a/src/core-impl/collections/db/sql/device/smb/SmbDeviceHandler.h +++ b/src/core-impl/collections/db/sql/device/smb/SmbDeviceHandler.h @@ -23,20 +23,20 @@ class SmbDeviceHandlerFactory : public DeviceHandlerFactory { public: - SmbDeviceHandlerFactory( QObject *parent ) : DeviceHandlerFactory( parent ) {} - virtual ~SmbDeviceHandlerFactory(); + explicit SmbDeviceHandlerFactory( QObject *parent ) : DeviceHandlerFactory( parent ) {} + ~SmbDeviceHandlerFactory() override; - virtual bool canHandle( const Solid::Device &device ) const; + bool canHandle( const Solid::Device &device ) const override; - virtual bool canCreateFromMedium() const; + bool canCreateFromMedium() const override; - virtual DeviceHandler* createHandler( const Solid::Device &device, const QString &uuid, QSharedPointer s ) const; + DeviceHandler* createHandler( const Solid::Device &device, const QString &uuid, QSharedPointer s ) const override; - virtual bool canCreateFromConfig() const; + bool canCreateFromConfig() const override; - virtual DeviceHandler* createHandler( KSharedConfigPtr c, QSharedPointer s ) const; + DeviceHandler* createHandler( const KSharedConfigPtr &c, QSharedPointer s ) const override; - virtual QString type() const; + QString type() const override; }; /** @@ -51,13 +51,13 @@ virtual ~SmbDeviceHandler(); - virtual bool isAvailable() const; - virtual QString type() const; - virtual int getDeviceID( ); - virtual const QString &getDevicePath() const; - virtual void getURL( QUrl &absolutePath, const QUrl &relativePath ); - virtual void getPlayableURL( QUrl &absolutePath, const QUrl &relativePath ); - virtual bool deviceMatchesUdi( const QString &udi ) const; + bool isAvailable() const override; + QString type() const override; + int getDeviceID( ) override; + const QString &getDevicePath() const override; + void getURL( QUrl &absolutePath, const QUrl &relativePath ) override; + void getPlayableURL( QUrl &absolutePath, const QUrl &relativePath ) override; + bool deviceMatchesUdi( const QString &udi ) const override; private: diff --git a/src/core-impl/collections/db/sql/device/smb/SmbDeviceHandler.cpp b/src/core-impl/collections/db/sql/device/smb/SmbDeviceHandler.cpp --- a/src/core-impl/collections/db/sql/device/smb/SmbDeviceHandler.cpp +++ b/src/core-impl/collections/db/sql/device/smb/SmbDeviceHandler.cpp @@ -80,7 +80,7 @@ { absolutePath.setPath( m_mountPoint ); absolutePath = absolutePath.adjusted(QUrl::StripTrailingSlash); - absolutePath.setPath(absolutePath.path() + '/' + ( relativePath.path() )); + absolutePath.setPath(absolutePath.path() + QLatin1Char('/') + ( relativePath.path() )); absolutePath.setPath( QDir::cleanPath(absolutePath.path()) ); } @@ -147,7 +147,7 @@ } DeviceHandler * -SmbDeviceHandlerFactory::createHandler( KSharedConfigPtr, QSharedPointer ) const +SmbDeviceHandlerFactory::createHandler( const KSharedConfigPtr&, QSharedPointer ) const { return 0; } @@ -177,25 +177,25 @@ QStringList ids = s->query( QString( "SELECT id, label, lastmountpoint " "FROM devices WHERE type = 'smb' " "AND servername = '%1' AND sharename = '%2';" ) - .arg( s->escape( server ) ) - .arg( s->escape( share ) ) ); + .arg( s->escape( server ), + s->escape( share ) ) ); if ( ids.size() == 3 ) { debug() << "Found existing SMB config for ID " << ids[0] << " , server " << server << " ,share " << share; s->query( QString( "UPDATE devices SET lastmountpoint = '%2' WHERE " "id = %1;" ) - .arg( ids[0] ) - .arg( s->escape( mountPoint ) ) ); + .arg( ids[0], + s->escape( mountPoint ) ) ); return new SmbDeviceHandler( ids[0].toInt(), server, share, mountPoint, udi ); } else { int id = s->insert( QString( "INSERT INTO devices" "( type, servername, sharename, lastmountpoint ) " "VALUES ( 'smb', '%1', '%2', '%3' );" ) - .arg( s->escape( server ) ) - .arg( s->escape( share ) ) - .arg( s->escape( mountPoint ) ), + .arg( s->escape( server ), + s->escape( share ), + s->escape( mountPoint ) ), "devices" ); if ( id == 0 ) { diff --git a/src/core-impl/collections/db/sql/mysqlcollection/CMakeLists.txt b/src/core-impl/collections/db/sql/mysqlcollection/CMakeLists.txt --- a/src/core-impl/collections/db/sql/mysqlcollection/CMakeLists.txt +++ b/src/core-impl/collections/db/sql/mysqlcollection/CMakeLists.txt @@ -28,16 +28,12 @@ target_link_libraries( amarok_collection-mysqlcollection ${MYSQL_EMBEDDED_LIBRARIES} ) endif(WITH_MYSQL_EMBEDDED) -if(NOT WIN32 AND NOT APPLE) - target_link_libraries( amarok_collection-mysqlcollection crypt pthread ) -endif() - if(APPLE) SET_TARGET_PROPERTIES(amarok_collection-mysqlcollection PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") endif() -install(TARGETS amarok_collection-mysqlcollection DESTINATION ${PLUGIN_INSTALL_DIR} ) +install(TARGETS amarok_collection-mysqlcollection DESTINATION ${KDE_INSTALL_PLUGINDIR} ) -install(FILES amarok_collection-mysqlcollection.desktop DESTINATION ${SERVICES_INSTALL_DIR}) +install(FILES amarok_collection-mysqlcollection.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}) kcoreaddons_desktop_to_json(amarok_collection-mysqlcollection amarok_collection-mysqlcollection.desktop SERVICE_TYPES ${CMAKE_SOURCE_DIR}/src/amarok-plugin.desktop) diff --git a/src/core-impl/collections/db/sql/mysqlcollection/MySqlCollectionFactory.h b/src/core-impl/collections/db/sql/mysqlcollection/MySqlCollectionFactory.h --- a/src/core-impl/collections/db/sql/mysqlcollection/MySqlCollectionFactory.h +++ b/src/core-impl/collections/db/sql/mysqlcollection/MySqlCollectionFactory.h @@ -32,9 +32,9 @@ MySqlCollectionFactory() : Collections::CollectionFactory() {} - virtual ~MySqlCollectionFactory() {} + ~MySqlCollectionFactory() override {} - virtual void init(); + void init() override; }; } //namespace Collections diff --git a/src/core-impl/collections/db/sql/mysqlcollection/MySqlCollectionFactory.cpp b/src/core-impl/collections/db/sql/mysqlcollection/MySqlCollectionFactory.cpp --- a/src/core-impl/collections/db/sql/mysqlcollection/MySqlCollectionFactory.cpp +++ b/src/core-impl/collections/db/sql/mysqlcollection/MySqlCollectionFactory.cpp @@ -37,5 +37,5 @@ SqlCollection *collection = fac.createSqlCollection( storage ); m_initialized = true; - emit newCollection( collection ); + Q_EMIT newCollection( collection ); } diff --git a/src/core-impl/collections/db/sql/mysqlcollection/MySqlQueryMaker.h b/src/core-impl/collections/db/sql/mysqlcollection/MySqlQueryMaker.h --- a/src/core-impl/collections/db/sql/mysqlcollection/MySqlQueryMaker.h +++ b/src/core-impl/collections/db/sql/mysqlcollection/MySqlQueryMaker.h @@ -26,11 +26,11 @@ class MySqlQueryMaker : public SqlQueryMaker { public: - MySqlQueryMaker( SqlCollection* collection ); - virtual ~MySqlQueryMaker(); + explicit MySqlQueryMaker( SqlCollection* collection ); + ~MySqlQueryMaker() override; protected: - virtual QString escape( QString text ) const; + QString escape( const QString &text ) const override; }; } diff --git a/src/core-impl/collections/db/sql/mysqlcollection/MySqlQueryMaker.cpp b/src/core-impl/collections/db/sql/mysqlcollection/MySqlQueryMaker.cpp --- a/src/core-impl/collections/db/sql/mysqlcollection/MySqlQueryMaker.cpp +++ b/src/core-impl/collections/db/sql/mysqlcollection/MySqlQueryMaker.cpp @@ -28,7 +28,8 @@ } QString -Collections::MySqlQueryMaker::escape( QString text ) const // krazy:exclude=constref +Collections::MySqlQueryMaker::escape(const QString &text ) const { - return text.replace("\\", "\\\\").replace( '\'', "''" ); + QString str = text; + return str.replace("\\", "\\\\").replace( '\'', "''" ); } diff --git a/src/core-impl/collections/db/sql/mysqlcollection/amarok_collection-mysqlcollection.desktop b/src/core-impl/collections/db/sql/mysqlcollection/amarok_collection-mysqlcollection.desktop --- a/src/core-impl/collections/db/sql/mysqlcollection/amarok_collection-mysqlcollection.desktop +++ b/src/core-impl/collections/db/sql/mysqlcollection/amarok_collection-mysqlcollection.desktop @@ -16,6 +16,7 @@ Name[gl]=Colección MySQL Name[id]=Koleksi MySQL Name[it]=Collezione MySQL +Name[ko]=MySQL 모음집 Name[nl]=MySQL-verzameling Name[pl]=Zbiór MySQL Name[pt]=Colecção de MySQL @@ -30,6 +31,7 @@ Name[tr]=MySQL Koleksiyonu Name[uk]=Збірка MySQL Name[x-test]=xxMySQL Collectionxx +Name[zh_TW]=MySQL 收藏 Comment=Collection plugin for Amarok Comment[be]=Утулка калекцыі для Amarok Comment[bg]=Приставка за колекция (Amarok) @@ -58,7 +60,7 @@ Comment[it]=Estensione della collezione di Amarok Comment[ja]=Amarok のためのコレクションプラグイン Comment[km]=កម្មវិធី​ជំនួយ​សម្រាំង​សម្រាប់​ Amarok -Comment[ko]=Amarok의 모음집 플러그인 +Comment[ko]=Amarok용 모음집 플러그인 Comment[ku]=Pêveka berhevokê ji bo Amarok Comment[lt]=Fonotekos Amarok papildinys Comment[lv]=Kolekciju Amarok spraudnis @@ -85,7 +87,6 @@ Comment[uk]=Додаток збірки для Amarok Comment[wa]=Tchôke-divins di ramexhnêye pos Amarok Comment[x-test]=xxCollection plugin for Amarokxx -Comment[zh_CN]=Amarok 的收藏插件 Comment[zh_TW]=Amarok 的收藏外掛程式 NoDisplay=true diff --git a/src/core-impl/collections/ipodcollection/CMakeLists.txt b/src/core-impl/collections/ipodcollection/CMakeLists.txt --- a/src/core-impl/collections/ipodcollection/CMakeLists.txt +++ b/src/core-impl/collections/ipodcollection/CMakeLists.txt @@ -65,7 +65,7 @@ install(TARGETS amarok_collection-ipodcollection DESTINATION - ${PLUGIN_INSTALL_DIR} + ${KDE_INSTALL_PLUGINDIR} ) kcoreaddons_desktop_to_json(amarok_collection-ipodcollection amarok_collection-ipodcollection.desktop SERVICE_TYPES ${CMAKE_SOURCE_DIR}/src/amarok-plugin.desktop) diff --git a/src/core-impl/collections/ipodcollection/IpodCollection.h b/src/core-impl/collections/ipodcollection/IpodCollection.h --- a/src/core-impl/collections/ipodcollection/IpodCollection.h +++ b/src/core-impl/collections/ipodcollection/IpodCollection.h @@ -36,6 +36,11 @@ struct _Itdb_iTunesDB; typedef _Itdb_iTunesDB Itdb_iTunesDB; +namespace Playlists +{ +class UserPlaylistProvider; +} + class IpodCollection : public Collections::Collection, public Meta::Observer { Q_OBJECT @@ -61,45 +66,45 @@ virtual ~IpodCollection(); // TrackProvider methods: - virtual bool possiblyContainsTrack( const QUrl &url ) const; - virtual Meta::TrackPtr trackForUrl( const QUrl &url ); + bool possiblyContainsTrack( const QUrl &url ) const override; + Meta::TrackPtr trackForUrl( const QUrl &url ) override; // CollectionBase methods: - virtual bool hasCapabilityInterface( Capabilities::Capability::Type type ) const; - virtual Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ); + bool hasCapabilityInterface( Capabilities::Capability::Type type ) const override; + Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ) override; // Collection methods: - virtual Collections::QueryMaker *queryMaker(); + Collections::QueryMaker *queryMaker() override; - virtual QString uidUrlProtocol() const; - virtual QString collectionId() const; - virtual QString prettyName() const; - virtual QIcon icon() const; + QString uidUrlProtocol() const override; + QString collectionId() const override; + QString prettyName() const override; + QIcon icon() const override; - virtual bool hasCapacity() const; - virtual float usedCapacity() const; - virtual float totalCapacity() const; + bool hasCapacity() const override; + float usedCapacity() const override; + float totalCapacity() const override; - virtual Collections::CollectionLocation *location(); - virtual bool isWritable() const; - virtual bool isOrganizable() const; + Collections::CollectionLocation *location() override; + bool isWritable() const override; + bool isOrganizable() const override; // Observer methods: - virtual void metadataChanged( Meta::TrackPtr track ); + void metadataChanged( const Meta::TrackPtr &track ) override; // so that the compiler doesn't complain about hidden virtual functions: using Meta::Observer::metadataChanged; // IpodCollection methods: /** - * In-fact second phase of the construcor. Called by CollectionFactory right after + * In-fact second phase of the constructor. Called by CollectionFactory right after * constructor. Should return true if the collection initialised itself successfully * and should be shown to the user; return value of false means it should be * destroyed and forgotten by the factory. */ bool init(); /** - * Get local mount point. Can return QString() in case no reasonamble mountpoint + * Get local mount point. Can return QString() in case no reasonable mountpoint * is available */ QString mountPoint(); @@ -128,14 +133,14 @@ /** * Start a count-down that emits updated() signal after it expires. * Resets the timer to original timeout if already running. This is to ensure - * that we emit update() max. once per for batch updates. + * that we Q_EMIT update() max. once per \ for batch updates. * * Timers can only be started from "their" thread so use signals & slots for that. */ void startUpdateTimer(); /** - * Start a count-down that initiates iTunes database wrtiging after it expires. + * Start a count-down that initiates iTunes database writing after it expires. * Resets the timer to original timeout if already running. This is to ensure * that we don't write the database all the time for batch updates. * @@ -169,7 +174,7 @@ private Q_SLOTS: /** - * Update m_lastUpdated timestamp and emit updated() + * Update m_lastUpdated timestamp and Q_EMIT updated() */ void collectionUpdated(); @@ -185,7 +190,7 @@ void slotApplyConfiguration(); /** - * Starts a timer that ensures we emit updated() signal sometime in future. + * Starts a timer that ensures we Q_EMIT updated() signal sometime in future. */ void slotStartUpdateTimer(); @@ -208,8 +213,8 @@ void slotPerformTeardownAndRemove(); /** - * Do sanity checks and emit remove() so that this collection is destroyed by - * CollectionManager. No other method is allowed to emit remove()! + * Do sanity checks and Q_EMIT remove() so that this collection is destroyed by + * CollectionManager. No other method is allowed to Q_EMIT remove()! */ void slotRemove(); diff --git a/src/core-impl/collections/ipodcollection/IpodCollection.cpp b/src/core-impl/collections/ipodcollection/IpodCollection.cpp --- a/src/core-impl/collections/ipodcollection/IpodCollection.cpp +++ b/src/core-impl/collections/ipodcollection/IpodCollection.cpp @@ -26,7 +26,7 @@ #include "support/IpodTranscodeCapability.h" #include "core/capabilities/ActionsCapability.h" -#include "core/interfaces/Logger.h" +#include "core/logger/Logger.h" #include "core/support/Components.h" #include "core/support/Debug.h" #include "core-impl/collections/support/MemoryCollection.h" @@ -157,7 +157,7 @@ // call directly from main thread in destructor, we have no other chance: writeDatabase(); } - delete m_preventUnmountTempFile; // this should have been certaily 0, but why not + delete m_preventUnmountTempFile; // this should have been certainly 0, but why not m_preventUnmountTempFile = 0; /* because m_itdb takes ownership of the tracks added to it, we need to remove the @@ -243,7 +243,7 @@ QString IpodCollection::collectionId() const { - return QString( "%1://%2" ).arg( s_uidUrlProtocol, m_uuid ); + return QStringLiteral( "%1://%2" ).arg( s_uidUrlProtocol, m_uuid ); } QString @@ -295,14 +295,14 @@ } void -IpodCollection::metadataChanged( Meta::TrackPtr track ) +IpodCollection::metadataChanged(const Meta::TrackPtr &track ) { - // reflect change to ouside world: + // reflect change to outside world: bool mapsChanged = MemoryMeta::MapChanger( m_mc.data() ).trackChanged( track ); if( mapsChanged ) - // while docs say somehting different, collection browser doesn't update unless we emit updated() - emit startUpdateTimer(); - emit startWriteDatabaseTimer(); + // while docs say something different, collection browser doesn't update unless we Q_EMIT updated() + Q_EMIT startUpdateTimer(); + Q_EMIT startWriteDatabaseTimer(); } QString @@ -345,7 +345,7 @@ IpodCollection::slotDestroy() { // guard against user hitting the button twice or hitting it while there is another - // write database job alreaddy running + // write database job already running if( m_writeDatabaseJob ) { IpodWriteDatabaseJob *job = m_writeDatabaseJob.data(); @@ -374,7 +374,7 @@ IpodCollection::slotEject() { // guard against user hitting the button twice or hitting it while there is another - // write database job alreaddy running + // write database job already running if( m_writeDatabaseJob ) { IpodWriteDatabaseJob *job = m_writeDatabaseJob.data(); @@ -456,7 +456,7 @@ void IpodCollection::collectionUpdated() { m_lastUpdated = QDateTime::currentMSecsSinceEpoch(); - emit updated(); + Q_EMIT updated(); } void @@ -507,8 +507,8 @@ { IpodDeviceHelper::setIpodName( m_itdb, newName ); m_prettyName = IpodDeviceHelper::collectionName( m_itdb ); - emit startWriteDatabaseTimer(); // the change should be written down to the database - emit startUpdateTimer(); + Q_EMIT startWriteDatabaseTimer(); // the change should be written down to the database + Q_EMIT startUpdateTimer(); } QScopedPointer tc( create() ); @@ -548,7 +548,7 @@ if( m_writeDatabaseJob ) { warning() << __PRETTY_FUNCTION__ << "called while m_writeDatabaseJob still points" - << "to an older job. Not doing anyhing."; + << "to an older job. Not doing anything."; return; } IpodWriteDatabaseJob *job = new IpodWriteDatabaseJob( this ); @@ -561,7 +561,7 @@ { /* try to eject the device from system. Following technique potentially catches more * cases than simply passing the udi from IpodCollectionFactory, think of fuse-based - * filesystems for mounting iPhones et caetera.. */ + * filesystems for mounting iPhones et cetera.. */ Solid::Predicate query( Solid::DeviceInterface::StorageAccess, QString( "filePath" ), m_mountPoint ); QList devices = Solid::Device::listFromQuery( query ); @@ -582,14 +582,14 @@ // in the main thread if( m_parseTracksJob ) { - // we need to wait until parseTracksJob finishes, because it acceses IpodCollection + // we need to wait until parseTracksJob finishes, because it accesses IpodCollection // and IpodPlaylistProvider in an asynchronous way that cannot safely cope with // IpodCollection disappearing connect( m_parseTracksJob.data(), &QObject::destroyed, this, &IpodCollection::remove ); m_parseTracksJob->abort(); } else - emit remove(); + Q_EMIT remove(); } Meta::TrackPtr @@ -611,7 +611,7 @@ itdb_playlist_add_track( itdb_playlist_mpl( m_itdb ), itdbTrack, -1 ); justAdded = true; - emit startWriteDatabaseTimer(); + Q_EMIT startWriteDatabaseTimer(); } track->setCollection( QPointer( this ) ); @@ -629,7 +629,7 @@ if( memTrack ) { subscribeTo( trackPtr ); - emit startUpdateTimer(); + Q_EMIT startUpdateTimer(); } return memTrack; } @@ -668,10 +668,10 @@ itdb_playlist_remove_track( itdb_playlist_mpl( m_itdb ), itdbTrack ); // remove it from the db: itdb_track_unlink( itdbTrack ); - emit startWriteDatabaseTimer(); + Q_EMIT startWriteDatabaseTimer(); } - emit startUpdateTimer(); + Q_EMIT startUpdateTimer(); } bool IpodCollection::writeDatabase() @@ -703,7 +703,7 @@ { QString message = i18nc( "%1: iPod collection name", "iTunes database successfully written to %1", prettyName() ); - Amarok::Components::logger()->shortMessage( message ); + Amarok::Logger::shortMessage( message ); } else { @@ -715,7 +715,7 @@ else message = i18nc( "%1: iPod collection name, %2: technical error from libgpod", "Writing iTunes database to %1 failed: %2", prettyName(), gpodError ); - Amarok::Components::logger()->longMessage( message ); + Amarok::Logger::longMessage( message ); } return success; } diff --git a/src/core-impl/collections/ipodcollection/IpodCollectionFactory.h b/src/core-impl/collections/ipodcollection/IpodCollectionFactory.h --- a/src/core-impl/collections/ipodcollection/IpodCollectionFactory.h +++ b/src/core-impl/collections/ipodcollection/IpodCollectionFactory.h @@ -38,7 +38,7 @@ IpodCollectionFactory(); virtual ~IpodCollectionFactory(); - virtual void init(); + void init() override; private Q_SLOTS: /** @@ -75,7 +75,7 @@ /** * Attempts to create appropriate collection for already identified solid device - * @param udi. Should emit newCollection() if the collection was successfully + * @param udi. Should Q_EMIT newCollection() if the collection was successfully * created and should become visible to the user. */ void createCollectionForSolidDevice( const QString &udi ); diff --git a/src/core-impl/collections/ipodcollection/IpodCollectionFactory.cpp b/src/core-impl/collections/ipodcollection/IpodCollectionFactory.cpp --- a/src/core-impl/collections/ipodcollection/IpodCollectionFactory.cpp +++ b/src/core-impl/collections/ipodcollection/IpodCollectionFactory.cpp @@ -199,7 +199,7 @@ } // we are definitely interested in this device, listen for accessibility changes - disconnect( ssa, &Solid::StorageAccess::accessibilityChanged, this, 0 ); + disconnect( ssa, &Solid::StorageAccess::accessibilityChanged, this, nullptr ); connect( ssa, &Solid::StorageAccess::accessibilityChanged, this, &IpodCollectionFactory::slotAccessibilityChanged ); @@ -264,7 +264,7 @@ connect( ssa, &Solid::StorageAccess::teardownRequested, collection, &IpodCollection::slotEject ); if( collection->init() ) - emit newCollection( collection ); + Q_EMIT newCollection( collection ); else collection->deleteLater(); } diff --git a/src/core-impl/collections/ipodcollection/IpodCollectionLocation.h b/src/core-impl/collections/ipodcollection/IpodCollectionLocation.h --- a/src/core-impl/collections/ipodcollection/IpodCollectionLocation.h +++ b/src/core-impl/collections/ipodcollection/IpodCollectionLocation.h @@ -31,33 +31,35 @@ Q_OBJECT public: - IpodCollectionLocation( QPointer parentCollection ); + explicit IpodCollectionLocation( const QPointer &parentCollection ); virtual ~IpodCollectionLocation(); // CollectionLocation methods: - virtual Collections::Collection *collection() const; - virtual QString prettyLocation() const; - virtual bool isWritable() const; + Collections::Collection *collection() const override; + QString prettyLocation() const override; + bool isWritable() const override; - virtual void copyUrlsToCollection( const QMap &sources, - const Transcoding::Configuration &configuration ); - virtual void removeUrlsFromCollection( const Meta::TrackList &sources ); + void copyUrlsToCollection( const QMap &sources, + const Transcoding::Configuration &configuration ) override; + void removeUrlsFromCollection( const Meta::TrackList &sources ) override; // IpodCollectionLocation specific methods: /** * Calling this causes that when the tracks are copied, they are added to iPod - * playlist @param destPlaylist + * playlist @p destPlaylist + * @param destPlaylist destination playlist + * @param trackPlaylistPositions positions of tracks in the playlist */ - void setDestinationPlaylist( Playlists::PlaylistPtr destPlaylist, + void setDestinationPlaylist( const Playlists::PlaylistPtr &destPlaylist, const QMap &trackPlaylistPositions ); /** * This method is published so that IpodPlaylistProvider can hide removal dialog. */ using Collections::CollectionLocation::setHidingRemoveConfirm; private Q_SLOTS: - void slotCopyTrackProcessed( Meta::TrackPtr srcTrack, Meta::TrackPtr destTrack, + void slotCopyTrackProcessed( const Meta::TrackPtr &srcTrack, const Meta::TrackPtr &destTrack, IpodCopyTracksJob::CopiedStatus status ); private: diff --git a/src/core-impl/collections/ipodcollection/IpodCollectionLocation.cpp b/src/core-impl/collections/ipodcollection/IpodCollectionLocation.cpp --- a/src/core-impl/collections/ipodcollection/IpodCollectionLocation.cpp +++ b/src/core-impl/collections/ipodcollection/IpodCollectionLocation.cpp @@ -17,7 +17,7 @@ #include "IpodCollectionLocation.h" #include "jobs/IpodDeleteTracksJob.h" -#include "core/interfaces/Logger.h" +#include "core/logger/Logger.h" #include "core/support/Components.h" #include "core/support/Debug.h" @@ -28,7 +28,7 @@ #include -IpodCollectionLocation::IpodCollectionLocation( QPointer parentCollection ) +IpodCollectionLocation::IpodCollectionLocation( const QPointer &parentCollection ) : CollectionLocation() // we implement collection(), we need not pass parentCollection , m_coll( parentCollection ) { @@ -59,7 +59,7 @@ { if( !m_coll ) return false; - return m_coll->isWritable(); // no infinite loop, IpodCollection iplements this + return m_coll->isWritable(); // no infinite loop, IpodCollection implements this } void @@ -72,8 +72,9 @@ IpodCopyTracksJob *job = new IpodCopyTracksJob( sources, m_coll, configuration, isGoingToRemoveSources() ); int trackCount = sources.size(); - Amarok::Components::logger()->newProgressOperation( job, - operationInProgressText( configuration, trackCount ), trackCount, job, SLOT(abort()) ); + Amarok::Logger::newProgressOperation( job, + operationInProgressText( configuration, trackCount ), + trackCount, job, &IpodCopyTracksJob::abort ); qRegisterMetaType( "IpodCopyTracksJob::CopiedStatus" ); connect( job, &IpodCopyTracksJob::signalTrackProcessed, @@ -96,14 +97,14 @@ } void -IpodCollectionLocation::setDestinationPlaylist( Playlists::PlaylistPtr destPlaylist, const QMap &trackPlaylistPositions ) +IpodCollectionLocation::setDestinationPlaylist( const Playlists::PlaylistPtr &destPlaylist, const QMap &trackPlaylistPositions ) { m_destPlaylist = destPlaylist; m_trackPlaylistPositions = trackPlaylistPositions; } void -IpodCollectionLocation::slotCopyTrackProcessed( Meta::TrackPtr srcTrack, Meta::TrackPtr destTrack, +IpodCollectionLocation::slotCopyTrackProcessed( const Meta::TrackPtr &srcTrack, const Meta::TrackPtr &destTrack, IpodCopyTracksJob::CopiedStatus status ) { if( status == IpodCopyTracksJob::Success ) diff --git a/src/core-impl/collections/ipodcollection/IpodMeta.h b/src/core-impl/collections/ipodcollection/IpodMeta.h --- a/src/core-impl/collections/ipodcollection/IpodMeta.h +++ b/src/core-impl/collections/ipodcollection/IpodMeta.h @@ -34,16 +34,16 @@ namespace IpodMeta { /** - * An iPod track. album, artist, composer etc. are invisible to ouside world, they are + * An iPod track. album, artist, composer etc. are invisible to outside world, they are * proxied in the MemoMeta track. All methods in this class are thread-safe with a few * exceptions that are noted in relevant method docstrings. */ class Track : public Meta::Track, public Meta::Statistics, public Meta::TrackEditor { public: /** * Constructs an iPod track from an existing libgpod track structure. Caller - * must guarantee that these are already added to the collection's itdb databse. + * must guarantee that these are already added to the collection's itdb database. */ explicit Track( Itdb_Track *ipodTrack ); @@ -55,73 +55,73 @@ virtual ~Track(); // Meta::Base methods: - virtual QString name() const; + QString name() const override; // Meta::Track methods: - virtual QUrl playableUrl() const; - virtual QString prettyUrl() const; - virtual QString uidUrl() const; - virtual QString notPlayableReason() const; + QUrl playableUrl() const override; + QString prettyUrl() const override; + QString uidUrl() const override; + QString notPlayableReason() const override; - virtual Meta::AlbumPtr album() const; - virtual Meta::ArtistPtr artist() const; - virtual Meta::ComposerPtr composer() const; - virtual Meta::GenrePtr genre() const; - virtual Meta::YearPtr year() const; + Meta::AlbumPtr album() const override; + Meta::ArtistPtr artist() const override; + Meta::ComposerPtr composer() const override; + Meta::GenrePtr genre() const override; + Meta::YearPtr year() const override; - virtual qreal bpm() const; - virtual QString comment() const; + qreal bpm() const override; + QString comment() const override; - virtual qint64 length() const; - virtual int filesize() const; - virtual int sampleRate() const; - virtual int bitrate() const; + qint64 length() const override; + int filesize() const override; + int sampleRate() const override; + int bitrate() const override; - virtual QDateTime createDate() const; - virtual QDateTime modifyDate() const; + QDateTime createDate() const override; + QDateTime modifyDate() const override; - virtual int trackNumber() const; - virtual int discNumber() const; + int trackNumber() const override; + int discNumber() const override; - virtual qreal replayGain( Meta::ReplayGainTag mode ) const; - virtual QString type() const; + qreal replayGain( Meta::ReplayGainTag mode ) const override; + QString type() const override; - virtual bool inCollection() const; - virtual Collections::Collection* collection() const; + bool inCollection() const override; + Collections::Collection* collection() const override; - virtual Meta::TrackEditorPtr editor(); - virtual Meta::StatisticsPtr statistics(); + Meta::TrackEditorPtr editor() override; + Meta::StatisticsPtr statistics() override; // Meta::TrackEditor methods: - virtual void setAlbum( const QString &newAlbum ); - virtual void setAlbumArtist( const QString &newAlbumArtist ); - virtual void setArtist( const QString &newArtist ); - virtual void setComposer( const QString &newComposer ); - virtual void setGenre( const QString &newGenre ); - virtual void setYear( int newYear ); - virtual void setTitle( const QString &newTitle ); - virtual void setComment( const QString &newComment ); - virtual void setTrackNumber( int newTrackNumber ); - virtual void setDiscNumber( int newDiscNumber ); - virtual void setBpm( const qreal newBpm ); + void setAlbum( const QString &newAlbum ) override; + void setAlbumArtist( const QString &newAlbumArtist ) override; + void setArtist( const QString &newArtist ) override; + void setComposer( const QString &newComposer ) override; + void setGenre( const QString &newGenre ) override; + void setYear( int newYear ) override; + void setTitle( const QString &newTitle ) override; + void setComment( const QString &newComment ) override; + void setTrackNumber( int newTrackNumber ) override; + void setDiscNumber( int newDiscNumber ) override; + void setBpm( const qreal newBpm ) override; // Meta::Statistics methods: - virtual int rating() const; - virtual void setRating( int newRating ); + int rating() const override; + void setRating( int newRating ) override; - virtual QDateTime lastPlayed() const; - virtual void setLastPlayed( const QDateTime &time ); + QDateTime lastPlayed() const override; + void setLastPlayed( const QDateTime &time ) override; - virtual QDateTime firstPlayed() const; - virtual void setFirstPlayed( const QDateTime &time ); + QDateTime firstPlayed() const override; + void setFirstPlayed( const QDateTime &time ) override; - virtual int playCount() const; - virtual int recentPlayCount() const; - virtual void setPlayCount( const int playcount ); + int playCount() const override; + int recentPlayCount() const override; + void setPlayCount( const int playcount ) override; // Combined Meta::TrackEditor, Meta::Statistics methods: - virtual void beginUpdate(); - virtual void endUpdate(); + void beginUpdate() override; + void endUpdate() override; // IpodMeta::Track methods: /** @@ -146,7 +146,7 @@ * @param mountPoint a path where iPod is mounted, e.g. /media/MyiPod in local * encoding (use QFile::encodeName()) * @param filePath full absolute path to copied file, must be in form - * <@param mountPoint>/iPod_Control/Music/... - it is recommended to use + * <@p mountPoint>/iPod_Control/Music/... - it is recommended to use * itdb_cp_get_dest_filename() to construct the filename * * @return true if the track was "accepted", false if not in which case you @@ -240,11 +240,11 @@ class Artist : public Meta::Artist { public: - Artist( const QString &name ) : m_name( name ) {} + explicit Artist( const QString &name ) : m_name( name ) {} virtual ~Artist() {} - virtual QString name() const { return m_name; } - virtual Meta::TrackList tracks() { return Meta::TrackList(); } + QString name() const override { return m_name; } + Meta::TrackList tracks() override { return Meta::TrackList(); } private: QString m_name; @@ -257,24 +257,24 @@ class Album : public Meta::Album { public: - Album( Track *track ); + explicit Album( Track *track ); - virtual QString name() const; + QString name() const override; // dummy, iPod tracks are supposed to be proxied by MemoryMeta which handles this - virtual Meta::TrackList tracks() { return Meta::TrackList(); } + Meta::TrackList tracks() override { return Meta::TrackList(); } - virtual bool isCompilation() const; - virtual bool canUpdateCompilation() const; - virtual void setCompilation( bool isCompilation ); + bool isCompilation() const override; + bool canUpdateCompilation() const override; + void setCompilation( bool isCompilation ) override; - virtual bool hasAlbumArtist() const; - virtual Meta::ArtistPtr albumArtist() const; + bool hasAlbumArtist() const override; + Meta::ArtistPtr albumArtist() const override; - virtual bool hasImage( int size = 0 ) const; - virtual QImage image( int size = 0 ) const; - virtual bool canUpdateImage() const; - virtual void setImage( const QImage &image ); - virtual void removeImage(); + bool hasImage( int size = 0 ) const override; + QImage image( int size = 0 ) const override; + bool canUpdateImage() const override; + void setImage( const QImage &image ) override; + void removeImage() override; private: AmarokSharedPointer m_track; @@ -287,11 +287,11 @@ class Composer : public Meta::Composer { public: - Composer( const QString &name ) : m_name( name ) {} + explicit Composer( const QString &name ) : m_name( name ) {} virtual ~Composer() {} - virtual QString name() const { return m_name; } - virtual Meta::TrackList tracks() { return Meta::TrackList(); } + QString name() const override { return m_name; } + Meta::TrackList tracks() override { return Meta::TrackList(); } private: QString m_name; @@ -304,11 +304,11 @@ class Genre : public Meta::Genre { public: - Genre( const QString &name ) : m_name( name ) {} + explicit Genre( const QString &name ) : m_name( name ) {} virtual ~Genre() {} - virtual QString name() const { return m_name; } - virtual Meta::TrackList tracks() { return Meta::TrackList(); } + QString name() const override { return m_name; } + Meta::TrackList tracks() override { return Meta::TrackList(); } private: QString m_name; @@ -321,11 +321,11 @@ class Year : public Meta::Year { public: - Year( const QString &name ) : m_name( name ) {} + explicit Year( const QString &name ) : m_name( name ) {} virtual ~Year() {} - virtual QString name() const { return m_name; } - virtual Meta::TrackList tracks() { return Meta::TrackList(); } + QString name() const override { return m_name; } + Meta::TrackList tracks() override { return Meta::TrackList(); } private: QString m_name; diff --git a/src/core-impl/collections/ipodcollection/IpodMeta.cpp b/src/core-impl/collections/ipodcollection/IpodMeta.cpp --- a/src/core-impl/collections/ipodcollection/IpodMeta.cpp +++ b/src/core-impl/collections/ipodcollection/IpodMeta.cpp @@ -272,7 +272,7 @@ if( tempImageFile.open() ) m_tempImageFilePath = tempImageFile.fileName(); if( tempImageFile.isOpen() && image.save( &tempImageFile, "PNG" ) ) - /* this function remembers image path, it also fogots previous images (if any) + /* this function remembers image path, it also forgets previous images (if any) * and sets artwork_size, artwork_count and has_artwork m_track fields */ itdb_track_set_thumbnails( m_track, QFile::encodeName( m_tempImageFilePath ) ); } @@ -373,16 +373,16 @@ int Track::rating() const { - /* (rating/RATING_STEP) is a number of stars, Amarok uses numer of half-stars. + /* (rating/RATING_STEP) is a number of stars, Amarok uses number of half-stars. * the order of multiply and divide operations is significant because of rounding */ return ( ( m_track->rating * 2 ) / ITDB_RATING_STEP ); } void Track::setRating( int newRating ) { newRating = ( newRating * ITDB_RATING_STEP ) / 2; - if( newRating == (int) m_track->rating ) // casting prevents compiler waring about signedness + if( newRating == (int) m_track->rating ) // casting prevents compiler warning about signedness return; // nothing to do, do not notify observers QWriteLocker locker( &m_trackLock ); @@ -730,7 +730,7 @@ return; // we block changing the track meta-data of read-only iPod Collections; - // it would only be cofusing to the user as the changes would get discarded. + // it would only be confusing to the user as the changes would get discarded. if( !m_coll || !m_coll->isWritable() ) return; diff --git a/src/core-impl/collections/ipodcollection/IpodPlaylist.h b/src/core-impl/collections/ipodcollection/IpodPlaylist.h --- a/src/core-impl/collections/ipodcollection/IpodPlaylist.h +++ b/src/core-impl/collections/ipodcollection/IpodPlaylist.h @@ -49,26 +49,29 @@ IpodPlaylist( Itdb_Playlist *ipodPlaylist, IpodCollection *collection ); /** - * Create new Amarok iPod playlist. Some @param tracks may not be in corresponding + * Create new Amarok iPod playlist. Some @p tracks may not be in corresponding * iPod collection, these are copied to iPod (unless not matched by meta tags) * + * @param tracks the tracks + * @param name the playlist name + * @param collection iPod collection * @param type whether this playlist is an ordinatory one or a kind of special */ IpodPlaylist( const Meta::TrackList &tracks, const QString &name, IpodCollection *collection, Type type = Normal ); virtual ~IpodPlaylist(); - virtual QUrl uidUrl() const; - virtual QString name() const; - virtual void setName( const QString &name ); + QUrl uidUrl() const override; + QString name() const override; + void setName( const QString &name ) override; - virtual Playlists::PlaylistProvider *provider() const; + Playlists::PlaylistProvider *provider() const override; - virtual int trackCount() const; - virtual Meta::TrackList tracks(); - virtual void addTrack( Meta::TrackPtr track, int position = -1 ); - virtual void removeTrack( int position ); + int trackCount() const override; + Meta::TrackList tracks() override; + void addTrack( const Meta::TrackPtr &track, int position = -1 ) override; + void removeTrack( int position ) override; // IpodPlaylist specific: Itdb_Playlist *itdbPlaylist(); @@ -96,9 +99,11 @@ void scheduleCopyAndInsert(); /** - * Does the dirty job of adding @param track to this playlist, both to m_tracks - * and to underlying libgpoid playlist. @param position must be a valid position + * Does the dirty job of adding @p track to this playlist, both to m_tracks + * and to underlying libgpoid playlist. @p position must be a valid position * otherwise this method asserts out. + * @param track the track + * @param position the position */ void addIpodTrack( Meta::TrackPtr track, int position ); diff --git a/src/core-impl/collections/ipodcollection/IpodPlaylist.cpp b/src/core-impl/collections/ipodcollection/IpodPlaylist.cpp --- a/src/core-impl/collections/ipodcollection/IpodPlaylist.cpp +++ b/src/core-impl/collections/ipodcollection/IpodPlaylist.cpp @@ -87,7 +87,7 @@ { // integer reading is atomic, no lock needed QString collId = m_coll ? m_coll->collectionId() : "removedipodcollection:/"; - return QUrl( QString( "%1/playlists/%2" ).arg( collId ).arg( m_playlist->id ) ); + return QUrl( QStringLiteral( "%1/playlists/%2" ).arg( collId ).arg( m_playlist->id ) ); } QString @@ -108,7 +108,7 @@ Playlists::PlaylistProvider* IpodPlaylist::provider() const { - return m_coll ? m_coll->playlistProvider() : 0; + return m_coll ? m_coll->playlistProvider() : nullptr; } int @@ -124,7 +124,7 @@ } void -IpodPlaylist::addTrack( Meta::TrackPtr track, int position ) +IpodPlaylist::addTrack(const Meta::TrackPtr &track, int position ) { if( m_type != Normal || !m_coll || !m_coll->isWritable() ) return; diff --git a/src/core-impl/collections/ipodcollection/IpodPlaylistProvider.h b/src/core-impl/collections/ipodcollection/IpodPlaylistProvider.h --- a/src/core-impl/collections/ipodcollection/IpodPlaylistProvider.h +++ b/src/core-impl/collections/ipodcollection/IpodPlaylistProvider.h @@ -31,35 +31,35 @@ Q_OBJECT public: - IpodPlaylistProvider( IpodCollection *collection ); + explicit IpodPlaylistProvider( IpodCollection *collection ); virtual ~IpodPlaylistProvider(); // PlaylistProvider methods: - virtual QString prettyName() const; - virtual QIcon icon() const; + QString prettyName() const override; + QIcon icon() const override; - virtual int playlistCount() const; - virtual Playlists::PlaylistList playlists(); + int playlistCount() const override; + Playlists::PlaylistList playlists() override; - virtual Playlists::PlaylistPtr addPlaylist( Playlists::PlaylistPtr playlist ); - virtual Meta::TrackPtr addTrack( Meta::TrackPtr track ); + Playlists::PlaylistPtr addPlaylist(Playlists::PlaylistPtr playlist ) override; + Meta::TrackPtr addTrack( const Meta::TrackPtr &track ) override; // UserPlaylistProvider methods: - virtual Playlists::PlaylistPtr save( const Meta::TrackList &tracks, - const QString& name = QString() ); + Playlists::PlaylistPtr save( const Meta::TrackList &tracks, + const QString& name = QString() ) override; - virtual QActionList providerActions(); - virtual QActionList playlistActions( const Playlists::PlaylistList &playlists ); - virtual QActionList trackActions( const QMultiHash &playlistTracks ); + QActionList providerActions() override; + QActionList playlistActions( const Playlists::PlaylistList &playlists ) override; + QActionList trackActions( const QMultiHash &playlistTracks ) override; - virtual bool isWritable(); - virtual void renamePlaylist( Playlists::PlaylistPtr playlist, const QString &newName ); - virtual bool deletePlaylists( const Playlists::PlaylistList &playlistlist ); + bool isWritable() override; + void renamePlaylist( Playlists::PlaylistPtr playlist, const QString &newName ) override; + bool deletePlaylists( const Playlists::PlaylistList &playlistlist ) override; // PlaylistObserver methods: - virtual void metadataChanged( Playlists::PlaylistPtr playlist ); - virtual void trackAdded( Playlists::PlaylistPtr playlist, Meta::TrackPtr track, int position ); - virtual void trackRemoved( Playlists::PlaylistPtr playlist, int position ); + void metadataChanged( const Playlists::PlaylistPtr &playlist ) override; + void trackAdded( const Playlists::PlaylistPtr &playlist, const Meta::TrackPtr &track, int position ) override; + void trackRemoved( const Playlists::PlaylistPtr &playlist, int position ) override; // IpodPlaylistProvider specific methods: /** diff --git a/src/core-impl/collections/ipodcollection/IpodPlaylistProvider.cpp b/src/core-impl/collections/ipodcollection/IpodPlaylistProvider.cpp --- a/src/core-impl/collections/ipodcollection/IpodPlaylistProvider.cpp +++ b/src/core-impl/collections/ipodcollection/IpodPlaylistProvider.cpp @@ -20,7 +20,7 @@ #include "IpodCollectionLocation.h" #include "IpodPlaylist.h" #include "core/capabilities/ActionsCapability.h" -#include "core/interfaces/Logger.h" +#include "core/logger/Logger.h" #include "core/support/Components.h" #include "core/support/Debug.h" #include "core-impl/collections/support/FileCollectionLocation.h" @@ -65,13 +65,13 @@ } Playlists::PlaylistPtr -IpodPlaylistProvider::addPlaylist( Playlists::PlaylistPtr playlist ) +IpodPlaylistProvider::addPlaylist(Playlists::PlaylistPtr playlist ) { return save( playlist->tracks(), playlist->name() ); } Meta::TrackPtr -IpodPlaylistProvider::addTrack( Meta::TrackPtr track ) +IpodPlaylistProvider::addTrack(const Meta::TrackPtr &track ) { QString name = QLocale().toString( QDateTime::currentDateTime() ); return save( Meta::TrackList() << track , name )->tracks().last(); @@ -88,8 +88,8 @@ Playlists::PlaylistPtr playlistPtr( playlist ); m_playlists << playlistPtr; subscribeTo( playlistPtr ); - emit playlistAdded( playlistPtr ); - emit startWriteDatabaseTimer(); + Q_EMIT playlistAdded( playlistPtr ); + Q_EMIT startWriteDatabaseTimer(); return playlistPtr; } @@ -141,8 +141,8 @@ return; // special playlists cannot be renamed playlist->setName( newName ); - emit updated(); - emit startWriteDatabaseTimer(); + Q_EMIT updated(); + Q_EMIT startWriteDatabaseTimer(); } bool @@ -163,35 +163,35 @@ IpodPlaylist *ipodPlaylist = static_cast( playlist.data() ); itdb_playlist_unlink( ipodPlaylist->itdbPlaylist() ); - emit playlistRemoved( playlist ); - emit startWriteDatabaseTimer(); + Q_EMIT playlistRemoved( playlist ); + Q_EMIT startWriteDatabaseTimer(); } return true; } void -IpodPlaylistProvider::metadataChanged( Playlists::PlaylistPtr ) +IpodPlaylistProvider::metadataChanged(const Playlists::PlaylistPtr & ) { - emit startWriteDatabaseTimer(); + Q_EMIT startWriteDatabaseTimer(); } void -IpodPlaylistProvider::trackAdded( Playlists::PlaylistPtr, Meta::TrackPtr, int ) +IpodPlaylistProvider::trackAdded(const Playlists::PlaylistPtr &, const Meta::TrackPtr &, int ) { - emit startWriteDatabaseTimer(); + Q_EMIT startWriteDatabaseTimer(); } void -IpodPlaylistProvider::trackRemoved( Playlists::PlaylistPtr, int ) +IpodPlaylistProvider::trackRemoved(const Playlists::PlaylistPtr &, int ) { - emit startWriteDatabaseTimer(); + Q_EMIT startWriteDatabaseTimer(); } void IpodPlaylistProvider::scheduleCopyAndInsertToPlaylist( AmarokSharedPointer playlist ) { m_copyTracksTo.insert( playlist ); - QTimer::singleShot( 0, this, SLOT(slotCopyAndInsertToPlaylists()) ); + QTimer::singleShot( 0, this, &IpodPlaylistProvider::slotCopyAndInsertToPlaylists ); } void @@ -217,7 +217,7 @@ { int matched = 0, added = 0, removed = 0, failed = 0; - /* Sometimes users accidentaly rename files on iPod. This creates a pair of a stale + /* Sometimes users accidentally rename files on iPod. This creates a pair of a stale * iTunes database entry and an orphaned file. Find these specifically and move the files * back to their original location. */ if( m_stalePlaylist && m_orphanedPlaylist ) @@ -278,7 +278,7 @@ static_cast( location )->setHidingRemoveConfirm( true ); removed += m_stalePlaylist->trackCount(); location->prepareRemove( m_stalePlaylist->tracks() ); - // remove all tracks from the playlist, assume the removal suceeded + // remove all tracks from the playlist, assume the removal succeeded while( m_stalePlaylist->trackCount() ) m_stalePlaylist->removeTrack( 0 ); } @@ -290,7 +290,7 @@ Collections::CollectionLocation *dest = m_coll->location(); added += m_orphanedPlaylist->trackCount(); src->prepareMove( m_orphanedPlaylist->tracks(), dest ); - // remove all tracks from the playlist, assume the move suceeded + // remove all tracks from the playlist, assume the move succeeded while( m_orphanedPlaylist->trackCount() ) m_orphanedPlaylist->removeTrack( 0 ); } @@ -300,26 +300,26 @@ if( m_stalePlaylist && m_stalePlaylist->trackCount() == 0 ) { m_playlists.removeOne( m_stalePlaylist ); - emit playlistRemoved( m_stalePlaylist ); + Q_EMIT playlistRemoved( m_stalePlaylist ); m_stalePlaylist = 0; } if( m_orphanedPlaylist && m_orphanedPlaylist->trackCount() == 0 ) { m_playlists.removeOne( m_orphanedPlaylist ); - emit playlistRemoved( m_orphanedPlaylist ); + Q_EMIT playlistRemoved( m_orphanedPlaylist ); m_orphanedPlaylist = 0; } QString failedText = failed ? i18np("Failed to process one track. (more info about " "it is in the Amarok debugging log)", "Failed to process %1 tracks. (more info " "about these is in the Amarok debugging log)", failed ) : QString(); - QString text = i18nc( "Infrequently displayed message, don't bother with singlar " + QString text = i18nc( "Infrequently displayed message, don't bother with singular " "forms. %1 to %3 are numbers, %4 is the 'Failed to process ...' sentence or an " "empty string.", "Done consolidating iPod files. %1 orphaned tracks matched with " "stale iTunes database entries, %2 stale database entries removed, %3 orphaned " "tracks added back to the iTunes database. %4", matched, removed, added, failedText ); - Amarok::Components::logger()->longMessage( text ); + Amarok::Logger::longMessage( text ); } void diff --git a/src/core-impl/collections/ipodcollection/amarok_collection-ipodcollection.desktop b/src/core-impl/collections/ipodcollection/amarok_collection-ipodcollection.desktop --- a/src/core-impl/collections/ipodcollection/amarok_collection-ipodcollection.desktop +++ b/src/core-impl/collections/ipodcollection/amarok_collection-ipodcollection.desktop @@ -20,6 +20,7 @@ Name[id]=Koleksi iPod, iPad & iPhone Name[it]=Collezione iPod, iPad e iPhone Name[km]=សម្រាំង iPod, iPad & iPhone +Name[ko]=iPod, iPad 및 iPhone 모음집 Name[lt]=iPod, iPad & iPhone kolekcija Name[lv]=iPod, iPad un iPhone kolekcija Name[nb]=iPod, iPad og iPhone-samling @@ -40,7 +41,6 @@ Name[tr]=iPod, iPad & iPhone Koleksiyonu Name[uk]=Збірка на iPod, iPad і iPhone Name[x-test]=xxiPod, iPad & iPhone Collectionxx -Name[zh_CN]=iPod,iPad 和 iPhone 收藏 Name[zh_TW]=iPod, iPad 與 iPhone 收藏 Comment=Plugin to use iPod-like devices as collections in Amarok Comment[bs]=Priključak za korištenje uređaja poput iPod-a kao kolekcija u Amaroku @@ -58,9 +58,10 @@ Comment[ga]=Breiseán chun gléasanna cosúil le iPod a úsáid mar bhailiúcháin in Amarok Comment[gl]=Complemento para empregar dispositivos como o iPod a modo de coleccións en Amarok Comment[hu]=Bővítmény iPod-szerű eszközök Amarok-gyűjteményként való használatára -Comment[id]=Plugin untuk digunakan peranti iPod-like sebagai koleksi di Amarok +Comment[id]=Plugin untuk digunakan perangkat iPod-like sebagai koleksi di Amarok Comment[it]=Estensione per utilizzare dispositivi del tipo iPod come collezioni di Amarok Comment[km]=កម្មវិធី​ជំនួយ​ ដើម្បី​ប្រើ​ឧបករណ៍​ដូច​ជា iPod ជា​ការ​សម្រាំង​នៅ​ក្នុង Amarok +Comment[ko]=Amarok에서 iPod과 같은 장치를 모음집으로 사용하는 플러그인 Comment[lt]=Papildinys naudoti iPod tipo įrenginius kaip kolekcijas Amarok grotuve Comment[lv]=Spraudnis, lai lietotu iPod līdzīgas iekārtas kā kolekcijas iekš Amarok Comment[nb]=Programtillegg som bruker iPod-aktige enheter som samlinger i Amarok @@ -80,7 +81,6 @@ Comment[tr]=Amarok için iPod benzeri aygıtları koleksiyon olarak kullanma eklentisi Comment[uk]=Додаток для використання iPod-подібних пристроїв як збірок у Amarok Comment[x-test]=xxPlugin to use iPod-like devices as collections in Amarokxx -Comment[zh_CN]=在 Amarok 中使用类 iPod 设备作为收藏的插件 Comment[zh_TW]=Amarok 的類 iPod 裝置收藏外掛程式 ServiceTypes=Amarok/Plugin diff --git a/src/core-impl/collections/ipodcollection/jobs/IpodCopyTracksJob.h b/src/core-impl/collections/ipodcollection/jobs/IpodCopyTracksJob.h --- a/src/core-impl/collections/ipodcollection/jobs/IpodCopyTracksJob.h +++ b/src/core-impl/collections/ipodcollection/jobs/IpodCopyTracksJob.h @@ -43,13 +43,16 @@ }; /** + * @param sources list of sources + * @param collection collection + * @param configuration transcoding configuration * @param goingToRemoveSources whether this is in fact a move operation */ IpodCopyTracksJob( const QMap &sources, const QPointer &collection, const Transcoding::Configuration &configuration, bool goingToRemoveSources ); - void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) Q_DECL_OVERRIDE; + void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) override; public Q_SLOTS: void abort(); @@ -67,7 +70,7 @@ // signals for progress operation: void incrementProgress(); void endProgressOperation( QObject *obj ); - void totalSteps( int steps ); // not used, defined to keep QObject::conect warning quiet + void totalSteps( int steps ); // not used, defined to keep QObject::connect warning quiet /** * Signal various track copy statuses back to IpodCollectionLocation @@ -101,7 +104,7 @@ void slotDisplaySorryDialog(); private: - void trackProcessed( CopiedStatus status, Meta::TrackPtr srcTrack, Meta::TrackPtr destTrack = Meta::TrackPtr() ); + void trackProcessed( CopiedStatus status, const Meta::TrackPtr &srcTrack, const Meta::TrackPtr &destTrack = Meta::TrackPtr() ); QPointer m_coll; Transcoding::Configuration m_transcodingConfig; @@ -116,8 +119,8 @@ QSet m_copyErrors; protected: - void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; - void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; + void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; + void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; }; diff --git a/src/core-impl/collections/ipodcollection/jobs/IpodCopyTracksJob.cpp b/src/core-impl/collections/ipodcollection/jobs/IpodCopyTracksJob.cpp --- a/src/core-impl/collections/ipodcollection/jobs/IpodCopyTracksJob.cpp +++ b/src/core-impl/collections/ipodcollection/jobs/IpodCopyTracksJob.cpp @@ -18,7 +18,7 @@ #include "IpodMeta.h" #include "core/collections/QueryMaker.h" -#include "core/interfaces/Logger.h" +#include "core/logger/Logger.h" #include "core/support/Components.h" #include "core/support/Debug.h" #include "core/transcoding/TranscodingController.h" @@ -74,7 +74,7 @@ it.next(); Meta::TrackPtr track = it.key(); QUrl sourceUrl = it.value(); - emit startDuplicateTrackSearch( track ); + Q_EMIT startDuplicateTrackSearch( track ); // wait for searching to finish: m_searchingForDuplicates.acquire( 1 ); @@ -133,7 +133,7 @@ // start the physical copying QUrl destUrl = QUrl::fromLocalFile( QFile::decodeName( destFilename ) ); - emit startCopyOrTranscodeJob( sourceUrl, destUrl, isJustCopy ); + Q_EMIT startCopyOrTranscodeJob( sourceUrl, destUrl, isJustCopy ); // wait for copying to finish: m_copying.acquire( 1 ); @@ -200,7 +200,7 @@ if( !m_coll ) { delete ipodTrack; - break; // we were waiting for copying, m_coll may got destoryed + break; // we were waiting for copying, m_coll may got destroyed } Meta::TrackPtr newTrack = m_coll->addTrack( ipodTrack ); if( !newTrack ) @@ -214,7 +214,7 @@ if( m_coll ) itdb_stop_sync( m_coll->m_itdb ); - emit endProgressOperation( this ); + Q_EMIT endProgressOperation( this ); int sourceSize = m_sources.size(); int successCount = m_sourceTrackStatus.count( Success ); @@ -229,26 +229,26 @@ if( successCount == sourceSize ) { - Amarok::Components::logger()->shortMessage( transferredText ); + Amarok::Logger::shortMessage( transferredText ); } else if( m_aborted ) { QString text = i18np( "Transfer aborted. Managed to transfer one track.", "Transfer aborted. Managed to transfer %1 tracks.", successCount ); - Amarok::Components::logger()->longMessage( text ); + Amarok::Logger::longMessage( text ); } else if( successCount + duplicateCount == sourceSize ) { QString text = i18ncp( "%2 is the 'Transferred 123 tracks to Some collection.' message", "%2 One track was already there.", "%2 %1 tracks were already there.", duplicateCount, transferredText ); - Amarok::Components::logger()->longMessage( text ); + Amarok::Logger::longMessage( text ); } else { - // somethig more severe failed, notify user using a dialog - emit displaySorryDialog(); + // something more severe failed, notify user using a dialog + Q_EMIT displaySorryDialog(); } } @@ -420,14 +420,14 @@ details += i18nc( "%1 is a list of errors that occurred during copying of tracks", "Error causes: %1
", QStringList( m_copyErrors.toList() ).join( "
" ) ); } - KMessageBox::detailedSorry( 0, text, details, caption ); + KMessageBox::detailedSorry( nullptr, text, details, caption ); } void -IpodCopyTracksJob::trackProcessed( CopiedStatus status, Meta::TrackPtr srcTrack, Meta::TrackPtr destTrack ) +IpodCopyTracksJob::trackProcessed( CopiedStatus status, const Meta::TrackPtr &srcTrack, const Meta::TrackPtr &destTrack ) { m_sourceTrackStatus.insert( status, srcTrack ); - emit incrementProgress(); - emit signalTrackProcessed( srcTrack, destTrack, status ); + Q_EMIT incrementProgress(); + Q_EMIT signalTrackProcessed( srcTrack, destTrack, status ); } diff --git a/src/core-impl/collections/ipodcollection/jobs/IpodDeleteTracksJob.h b/src/core-impl/collections/ipodcollection/jobs/IpodDeleteTracksJob.h --- a/src/core-impl/collections/ipodcollection/jobs/IpodDeleteTracksJob.h +++ b/src/core-impl/collections/ipodcollection/jobs/IpodDeleteTracksJob.h @@ -30,13 +30,13 @@ public: explicit IpodDeleteTracksJob( const Meta::TrackList &sources, const QPointer &collection ); - void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) Q_DECL_OVERRIDE; + void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) override; Q_SIGNALS: // signals for progress operation: void incrementProgress(); void endProgressOperation( QObject *obj ); - void totalSteps( int steps ); // not used, defined to keep QObject::conect warning quiet + void totalSteps( int steps ); // not used, defined to keep QObject::connect warning quiet /** This signal is emitted when this job is being processed by a thread. */ void started(ThreadWeaver::JobPointer); @@ -47,8 +47,8 @@ void failed(ThreadWeaver::JobPointer); protected: - void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; - void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; + void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; + void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; private: Meta::TrackList m_sources; diff --git a/src/core-impl/collections/ipodcollection/jobs/IpodDeleteTracksJob.cpp b/src/core-impl/collections/ipodcollection/jobs/IpodDeleteTracksJob.cpp --- a/src/core-impl/collections/ipodcollection/jobs/IpodDeleteTracksJob.cpp +++ b/src/core-impl/collections/ipodcollection/jobs/IpodDeleteTracksJob.cpp @@ -16,7 +16,7 @@ #include "IpodDeleteTracksJob.h" -#include "core/interfaces/Logger.h" +#include "core/logger/Logger.h" #include "core/support/Components.h" #include "core-impl/collections/ipodcollection/IpodMeta.h" @@ -43,7 +43,7 @@ int trackCount = m_sources.size(); QString operationText = i18np( "Removing one track from iPod", "Removing %1 tracks from iPod", trackCount ); - Amarok::Components::logger()->newProgressOperation( this, operationText, trackCount ); + Amarok::Logger::newProgressOperation( this, operationText, trackCount ); itdb_start_sync( m_coll->m_itdb ); QListIterator it( m_sources ); @@ -65,7 +65,7 @@ incrementProgress(); } - emit endProgressOperation( this ); + Q_EMIT endProgressOperation( this ); if( m_coll ) itdb_stop_sync( m_coll->m_itdb ); } diff --git a/src/core-impl/collections/ipodcollection/jobs/IpodParseTracksJob.h b/src/core-impl/collections/ipodcollection/jobs/IpodParseTracksJob.h --- a/src/core-impl/collections/ipodcollection/jobs/IpodParseTracksJob.h +++ b/src/core-impl/collections/ipodcollection/jobs/IpodParseTracksJob.h @@ -25,7 +25,7 @@ /** * A job designed to parse iPod tracks and playlists in a thread so that main thread is - * not blocked with it. It is guaranteed by IpodCollection that is doesn't destory itself + * not blocked with it. It is guaranteed by IpodCollection that is doesn't destroy itself * while this job is alive. Memory management of this job is up to the caller of it. */ class IpodParseTracksJob : public QObject, public ThreadWeaver::Job @@ -42,15 +42,15 @@ void abort(); protected: - void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; - void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; - void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) Q_DECL_OVERRIDE; + void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; + void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; + void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) override; Q_SIGNALS: // signals for progress operation: void incrementProgress(); void endProgressOperation( QObject *obj ); - void totalSteps( int steps ); // not used, defined to keep QObject::conect warning quiet + void totalSteps( int steps ); // not used, defined to keep QObject::connect warning quiet /** This signal is emitted when this job is being processed by a thread. */ void started(ThreadWeaver::JobPointer); diff --git a/src/core-impl/collections/ipodcollection/jobs/IpodParseTracksJob.cpp b/src/core-impl/collections/ipodcollection/jobs/IpodParseTracksJob.cpp --- a/src/core-impl/collections/ipodcollection/jobs/IpodParseTracksJob.cpp +++ b/src/core-impl/collections/ipodcollection/jobs/IpodParseTracksJob.cpp @@ -19,11 +19,12 @@ #include "IpodCollection.h" #include "IpodMeta.h" #include "IpodPlaylistProvider.h" -#include "core/interfaces/Logger.h" +#include "core/logger/Logger.h" #include "core/support/Components.h" #include "core/support/Debug.h" #include "core-impl/meta/file/File.h" +#include #include #include @@ -54,8 +55,8 @@ guint32 trackNumber = itdb_tracks_number( itdb ); QString operationText = i18nc( "operation when iPod is connected", "Reading iPod tracks" ); - Amarok::Components::logger()->newProgressOperation( this, operationText, trackNumber, - this, SLOT(abort()) ); + Amarok::Logger::newProgressOperation( this, operationText, trackNumber, + this, &IpodParseTracksJob::abort ); Meta::TrackList staleTracks; QSet knownPaths; @@ -83,7 +84,7 @@ } parsePlaylists( staleTracks, knownPaths ); - emit endProgressOperation( this ); + Q_EMIT endProgressOperation( this ); } void @@ -116,16 +117,16 @@ prov->m_stalePlaylist = Playlists::PlaylistPtr( new IpodPlaylist( staleTracks, i18nc( "iPod playlist name", "Stale tracks" ), m_coll, IpodPlaylist::Stale ) ); prov->m_playlists << prov->m_stalePlaylist; // we don't subscribe to this playlist, no need to update database - emit prov->playlistAdded( prov->m_stalePlaylist ); + Q_EMIT prov->playlistAdded( prov->m_stalePlaylist ); } Meta::TrackList orphanedTracks = findOrphanedTracks( knownPaths ); if( !orphanedTracks.isEmpty() ) { prov->m_orphanedPlaylist = Playlists::PlaylistPtr( new IpodPlaylist( orphanedTracks, i18nc( "iPod playlist name", "Orphaned tracks" ), m_coll, IpodPlaylist::Orphaned ) ); prov->m_playlists << prov->m_orphanedPlaylist; // we don't subscribe to this playlist, no need to update database - emit prov->playlistAdded( prov->m_orphanedPlaylist ); + Q_EMIT prov->playlistAdded( prov->m_orphanedPlaylist ); } if( !m_coll->m_itdb || m_aborted ) @@ -138,16 +139,16 @@ Playlists::PlaylistPtr playlistPtr( new IpodPlaylist( playlist, m_coll ) ); prov->m_playlists << playlistPtr; prov->subscribeTo( playlistPtr ); - emit prov->playlistAdded( playlistPtr ); + Q_EMIT prov->playlistAdded( playlistPtr ); } if( !m_aborted && ( prov->m_stalePlaylist || prov->m_orphanedPlaylist ) ) { QString text = i18n( "Stale and/or orphaned tracks detected on %1. You can resolve " "the situation using the %2 collection action. You can also view the tracks " "under the Saved Playlists tab.", m_coll->prettyName(), m_coll->m_consolidateAction->text() ); - Amarok::Components::logger()->longMessage( text ); + Amarok::Logger::longMessage( text ); } } diff --git a/src/core-impl/collections/ipodcollection/jobs/IpodWriteDatabaseJob.h b/src/core-impl/collections/ipodcollection/jobs/IpodWriteDatabaseJob.h --- a/src/core-impl/collections/ipodcollection/jobs/IpodWriteDatabaseJob.h +++ b/src/core-impl/collections/ipodcollection/jobs/IpodWriteDatabaseJob.h @@ -24,16 +24,16 @@ /** * A job designed to call IpodCollection::writeDatabase() in a thread so that main * thread is not blocked with it. It is guaranteed by IpodCollection that is doesn't - * destory itself while this job is alive. Memory management of this job is up to + * destroy itself while this job is alive. Memory management of this job is up to * the caller of it. */ class IpodWriteDatabaseJob : public QObject, public ThreadWeaver::Job { Q_OBJECT public: explicit IpodWriteDatabaseJob( IpodCollection *collection ); - void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) Q_DECL_OVERRIDE; + void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) override; Q_SIGNALS: /** This signal is emitted when this job is being processed by a thread. */ @@ -45,8 +45,8 @@ void failed(ThreadWeaver::JobPointer); protected: - void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; - void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; + void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; + void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; private: IpodCollection *m_coll; diff --git a/src/core-impl/collections/ipodcollection/support/IphoneMountPoint.h b/src/core-impl/collections/ipodcollection/support/IphoneMountPoint.h --- a/src/core-impl/collections/ipodcollection/support/IphoneMountPoint.h +++ b/src/core-impl/collections/ipodcollection/support/IphoneMountPoint.h @@ -32,7 +32,7 @@ * Mount iPhone/iPad device by its 40-digit device UUID or mount any connected * iPhone/iPad if @param uuid is empty. */ - IphoneMountPoint( const QString &uuid ); + explicit IphoneMountPoint( const QString &uuid ); ~IphoneMountPoint(); /** diff --git a/src/core-impl/collections/ipodcollection/support/IphoneMountPoint.cpp b/src/core-impl/collections/ipodcollection/support/IphoneMountPoint.cpp --- a/src/core-impl/collections/ipodcollection/support/IphoneMountPoint.cpp +++ b/src/core-impl/collections/ipodcollection/support/IphoneMountPoint.cpp @@ -53,7 +53,7 @@ if( !call( "ifuse", args ) ) { logMessage( QString( "Failed to mount iPhone on %1" ).arg( mountPointCandidate ) ); - KMessageBox::detailedSorry( 0, i18n( "Connecting to iPhone, iPad or iPod touch failed."), + KMessageBox::detailedSorry( nullptr, i18n( "Connecting to iPhone, iPad or iPod touch failed."), failureDetails() ); return; } @@ -100,22 +100,22 @@ mountPointCandidate += "imobiledevice"; if( !uuid.isEmpty() ) mountPointCandidate += "_uuid_" + uuid; - logMessage( QString( "determined mount-point path to %1" ).arg( mountPointCandidate ) ); + logMessage( QStringLiteral( "determined mount-point path to %1" ).arg( mountPointCandidate ) ); QDir mp( mountPointCandidate ); if( !mp.exists() ) { mp.mkpath( mountPointCandidate ); - logMessage( QString( "created %1 directory" ).arg( mountPointCandidate ) ); + logMessage( QStringLiteral( "created %1 directory" ).arg( mountPointCandidate ) ); } return mountPointCandidate; } bool IphoneMountPoint::call( const QString &command, const QStringList &arguments, int timeout ) { QProcess process; process.setProcessChannelMode( QProcess::MergedChannels ); - logMessage( QString( "calling `%1 \"%2\"` with timeout of %3s" ).arg( command, arguments.join( "\" \"" ) ).arg( timeout/1000.0 ) ); + logMessage( QStringLiteral( "calling `%1 \"%2\"` with timeout of %3s" ).arg( command, arguments.join( "\" \"" ) ).arg( timeout/1000.0 ) ); process.start( command, arguments ); if( !process.waitForStarted( timeout ) ) @@ -132,7 +132,7 @@ QByteArray output( process.readAllStandardOutput() ); foreach( const QString &line, QString::fromLocal8Bit( output ).split( QChar( '\n' ) ) ) { - logMessage( QString("%1: %2").arg( command, line ) ); + logMessage( QStringLiteral("%1: %2").arg( command, line ) ); } if( process.exitStatus() != QProcess::NormalExit ) diff --git a/src/core-impl/collections/ipodcollection/support/IpodDeviceHelper.h b/src/core-impl/collections/ipodcollection/support/IpodDeviceHelper.h --- a/src/core-impl/collections/ipodcollection/support/IpodDeviceHelper.h +++ b/src/core-impl/collections/ipodcollection/support/IpodDeviceHelper.h @@ -31,7 +31,7 @@ namespace IpodDeviceHelper { /** - * Tries to parse itunes db from an iPod mounted at @param mountPoint. + * Tries to parse itunes db from an iPod mounted at @param mountPoint . * @param errorMsg is set appropriately if error occurred * @return valid itdb or null, in which case @param errorMsg is not empty */ @@ -57,7 +57,8 @@ /** * Fills in a dialog with iPod configuration. * - * @param configureDialog QDialog that coutains the ui. Must not be null + * @param configureDialog QDialog that contains the ui. Must not be null + * @param mountPoint mount point * @param configureDialogUi ui of the dialog. Must not be null * @param itdb itdb of the device or null if could not be parsed * @param transcodeConfig current transcoding configuration preference @@ -84,7 +85,7 @@ QString &errorMessage ); /** - * Sets iPod name to @param name. Does nothing if @param itdb is null + * Sets iPod name to @param newName . Does nothing if @param itdb is null */ AMAROK_EXPORT void setIpodName( Itdb_iTunesDB *itdb, const QString &newName ); diff --git a/src/core-impl/collections/ipodcollection/support/IpodDeviceHelper.cpp b/src/core-impl/collections/ipodcollection/support/IpodDeviceHelper.cpp --- a/src/core-impl/collections/ipodcollection/support/IpodDeviceHelper.cpp +++ b/src/core-impl/collections/ipodcollection/support/IpodDeviceHelper.cpp @@ -197,8 +197,8 @@ gchar *controlDir = itdb_get_device_dir( QFile::encodeName( mountPoint ) ); if( !controlDir ) return false; - QString absFilename = QString( "%1/%2" ).arg( QFile::decodeName( controlDir ) ) - .arg( relFilename ); + QString absFilename = QStringLiteral( "%1/%2" ).arg( QFile::decodeName( controlDir ), + relFilename ); g_free( controlDir ); QFileInfo fileInfo( absFilename ); @@ -268,7 +268,7 @@ if( !info ) { // this is not i18n-ed for purpose: it should never happen - comboBox->addItem( QString( "Failed to get iPod info table!" ), QString() ); + comboBox->addItem( QStringLiteral( "Failed to get iPod info table!" ), QString() ); return; } diff --git a/src/core-impl/collections/ipodcollection/support/IpodTranscodeCapability.h b/src/core-impl/collections/ipodcollection/support/IpodTranscodeCapability.h --- a/src/core-impl/collections/ipodcollection/support/IpodTranscodeCapability.h +++ b/src/core-impl/collections/ipodcollection/support/IpodTranscodeCapability.h @@ -30,14 +30,15 @@ public: /** + * @param coll collection * @param deviceDirPath path to .../iPod_Control/Device directory */ IpodTranscodeCapability( IpodCollection *coll, const QString &deviceDirPath ); virtual ~IpodTranscodeCapability(); - virtual QStringList playableFileTypes(); - virtual Transcoding::Configuration savedConfiguration(); - virtual void setSavedConfiguration( const Transcoding::Configuration &configuration ); + QStringList playableFileTypes() override; + Transcoding::Configuration savedConfiguration() override; + void setSavedConfiguration( const Transcoding::Configuration &configuration ) override; private: QPointer m_coll; diff --git a/src/core-impl/collections/mediadevicecollection/MediaDeviceCollection.h b/src/core-impl/collections/mediadevicecollection/MediaDeviceCollection.h --- a/src/core-impl/collections/mediadevicecollection/MediaDeviceCollection.h +++ b/src/core-impl/collections/mediadevicecollection/MediaDeviceCollection.h @@ -42,7 +42,7 @@ public: virtual ~MediaDeviceCollectionFactoryBase(); - virtual void init(); + void init() override; protected: MediaDeviceCollectionFactoryBase( ConnectionAssistant* assistant ); @@ -71,7 +71,7 @@ virtual ~MediaDeviceCollectionFactory() {} private: - virtual MediaDeviceCollection* createCollection( MediaDeviceInfo* info ) + MediaDeviceCollection* createCollection( MediaDeviceInfo* info ) override { return new CollType( info ); } @@ -91,10 +91,10 @@ * url-based methods can be abstracted via use of Amarok URLs * subclasses simply define a protocol prefix, e.g. ipod */ - virtual bool possiblyContainsTrack( const QUrl &url ) const { Q_UNUSED(url); return false;} // TODO: NYI - virtual Meta::TrackPtr trackForUrl( const QUrl &url ) { Q_UNUSED(url); return Meta::TrackPtr(); } // TODO: NYI + bool possiblyContainsTrack( const QUrl &url ) const override { Q_UNUSED(url); return false;} // TODO: NYI + Meta::TrackPtr trackForUrl( const QUrl &url ) override { Q_UNUSED(url); return Meta::TrackPtr(); } // TODO: NYI - virtual QueryMaker* queryMaker(); + QueryMaker* queryMaker() override; virtual void startFullScanDevice(); // NOTE: incrementalscan and stopscan not implemented, might be used by UMS later though @@ -105,22 +105,22 @@ This has to be overridden for every device type, e.g. ipod:// */ - virtual QString uidUrlProtocol() const { return QString(); } // TODO: NYI - virtual QString collectionId() const; // uses udi + QString uidUrlProtocol() const override { return QString(); } // TODO: NYI + QString collectionId() const override; // uses udi - virtual QString prettyName() const = 0; // NOTE: must be overridden based on device type - virtual QIcon icon() const = 0; // NOTE: must be overridden based on device type + QString prettyName() const override = 0; // NOTE: must be overridden based on device type + QIcon icon() const override = 0; // NOTE: must be overridden based on device type - virtual bool hasCapacity() const; - virtual float usedCapacity() const; - virtual float totalCapacity() const; + bool hasCapacity() const override; + float usedCapacity() const override; + float totalCapacity() const override; // NOTE: location will have same method calls always, no need to redo each time - virtual CollectionLocation* location() { return new MediaDeviceCollectionLocation( this ); } + CollectionLocation* location() override { return new MediaDeviceCollectionLocation( this ); } /** Capability-related methods */ - virtual bool hasCapabilityInterface( Capabilities::Capability::Type type ) const; - virtual Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ); + bool hasCapabilityInterface( Capabilities::Capability::Type type ) const override; + Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ) override; /** MediaDeviceCollection methods */ QString udi() const { return m_udi; } @@ -133,7 +133,7 @@ virtual QAction *ejectAction() const; QSharedPointer memoryCollection() const { return m_mc; } - void collectionUpdated() { emit updated(); } + void collectionUpdated() { Q_EMIT updated(); } Q_SIGNALS: void collectionReady( Collections::Collection* ); diff --git a/src/core-impl/collections/mediadevicecollection/MediaDeviceCollection.cpp b/src/core-impl/collections/mediadevicecollection/MediaDeviceCollection.cpp --- a/src/core-impl/collections/mediadevicecollection/MediaDeviceCollection.cpp +++ b/src/core-impl/collections/mediadevicecollection/MediaDeviceCollection.cpp @@ -135,7 +135,7 @@ // If handler successfully connected to device m_handler->parseTracks(); - //emit collectionReady( this ); + //Q_EMIT collectionReady( this ); } Meta::MediaDeviceHandler* @@ -149,15 +149,15 @@ { DEBUG_BLOCK // Do nothing special here. - emit collectionDisconnected( m_udi ); + Q_EMIT collectionDisconnected( m_udi ); } void MediaDeviceCollection::deleteCollection() { DEBUG_BLOCK - emit deletingCollection(); - emit remove(); + Q_EMIT deletingCollection(); + Q_EMIT remove(); } void @@ -173,7 +173,7 @@ else { debug() << "connection failed, not scanning"; - emit collectionDisconnected( m_udi ); + Q_EMIT collectionDisconnected( m_udi ); } } @@ -230,15 +230,15 @@ void MediaDeviceCollection::emitCollectionReady() { - emit collectionReady( this ); + Q_EMIT collectionReady( this ); } QAction * MediaDeviceCollection::ejectAction() const { if( !m_ejectAction ) { - m_ejectAction = new QAction( QIcon::fromTheme( "media-eject" ), i18n( "&Disconnect Device" ), + m_ejectAction = new QAction( QIcon::fromTheme( QStringLiteral("media-eject") ), i18n( "&Disconnect Device" ), const_cast(this) ); m_ejectAction->setProperty( "popupdropper_svg_id", "eject" ); diff --git a/src/core-impl/collections/mediadevicecollection/MediaDeviceCollectionLocation.h b/src/core-impl/collections/mediadevicecollection/MediaDeviceCollectionLocation.h --- a/src/core-impl/collections/mediadevicecollection/MediaDeviceCollectionLocation.h +++ b/src/core-impl/collections/mediadevicecollection/MediaDeviceCollectionLocation.h @@ -25,7 +25,6 @@ #include #include -class KJob; namespace Collections { @@ -35,20 +34,20 @@ { Q_OBJECT public: - MediaDeviceCollectionLocation( MediaDeviceCollection *collection ); + explicit MediaDeviceCollectionLocation( MediaDeviceCollection *collection ); virtual ~MediaDeviceCollectionLocation(); - virtual QString prettyLocation() const; - virtual bool isWritable() const; + QString prettyLocation() const override; + bool isWritable() const override; protected: - virtual void getKIOCopyableUrls( const Meta::TrackList &tracks ); + void getKIOCopyableUrls( const Meta::TrackList &tracks ) override; /// Copies these tracks to the Collection using the Handler - virtual void copyUrlsToCollection( const QMap &sources, - const Transcoding::Configuration &configuration ); + void copyUrlsToCollection( const QMap &sources, + const Transcoding::Configuration &configuration ) override; - virtual void removeUrlsFromCollection( const Meta::TrackList &sources ); + void removeUrlsFromCollection( const Meta::TrackList &sources ) override; private Q_SLOTS: diff --git a/src/core-impl/collections/mediadevicecollection/MediaDeviceMeta.h b/src/core-impl/collections/mediadevicecollection/MediaDeviceMeta.h --- a/src/core-impl/collections/mediadevicecollection/MediaDeviceMeta.h +++ b/src/core-impl/collections/mediadevicecollection/MediaDeviceMeta.h @@ -30,7 +30,6 @@ class MediaDeviceCollection; } -class QAction; namespace Handler { class ArtworkCapability; } @@ -56,23 +55,23 @@ class MEDIADEVICECOLLECTION_EXPORT MediaDeviceTrack : public Meta::Track, public Statistics { public: - MediaDeviceTrack( Collections::MediaDeviceCollection *collection ); + explicit MediaDeviceTrack( Collections::MediaDeviceCollection *collection ); virtual ~MediaDeviceTrack(); - virtual QString name() const; + QString name() const override; - virtual QUrl playableUrl() const; - virtual QString uidUrl() const; - virtual QString prettyUrl() const; - virtual QString notPlayableReason() const; + QUrl playableUrl() const override; + QString uidUrl() const override; + QString prettyUrl() const override; + QString notPlayableReason() const override; bool isEditable() const; - virtual AlbumPtr album() const; - virtual ArtistPtr artist() const; - virtual GenrePtr genre() const; - virtual ComposerPtr composer() const; - virtual YearPtr year() const; + AlbumPtr album() const override; + ArtistPtr artist() const override; + GenrePtr genre() const override; + ComposerPtr composer() const override; + YearPtr year() const override; virtual void setAlbum ( const QString &newAlbum ); virtual void setAlbumArtist( const QString &newAlbumArtist ); @@ -84,56 +83,56 @@ virtual QString title() const; virtual void setTitle( const QString &newTitle ); - virtual QString comment() const; + QString comment() const override; virtual void setComment ( const QString &newComment ); - virtual qint64 length() const; + qint64 length() const override; void setFileSize( int newFileSize ); - virtual int filesize() const; + int filesize() const override; - virtual int bitrate() const; + int bitrate() const override; virtual void setBitrate( int newBitrate ); - virtual int sampleRate() const; + int sampleRate() const override; virtual void setSamplerate( int newSamplerate ); - virtual qreal bpm() const; + qreal bpm() const override; virtual void setBpm( const qreal newBpm ); - virtual int trackNumber() const; + int trackNumber() const override; virtual void setTrackNumber ( int newTrackNumber ); - virtual int discNumber() const; + int discNumber() const override; virtual void setDiscNumber ( int newDiscNumber ); - virtual qreal replayGain( ReplayGainTag mode ) const; + qreal replayGain( ReplayGainTag mode ) const override; /* Set the track replay gain (other types unsupported) */ void setReplayGain( qreal newReplayGain ); - virtual QString type() const; - virtual void prepareToPlay(); + QString type() const override; + void prepareToPlay() override; - virtual bool inCollection() const; - virtual Collections::Collection* collection() const; + bool inCollection() const override; + Collections::Collection* collection() const override; - virtual TrackEditorPtr editor(); - virtual StatisticsPtr statistics(); + TrackEditorPtr editor() override; + StatisticsPtr statistics() override; // Meta::Statistics methods - virtual double score() const; - virtual void setScore ( double newScore ); + double score() const override; + void setScore ( double newScore ) override; - virtual int rating() const; - virtual void setRating ( int newRating ); + int rating() const override; + void setRating ( int newRating ) override; - virtual QDateTime lastPlayed() const; - void setLastPlayed( const QDateTime &newTime ); + QDateTime lastPlayed() const override; + void setLastPlayed( const QDateTime &newTime ) override; // firstPlayed() not available in any media device - virtual int playCount() const; - void setPlayCount( const int newCount ); + int playCount() const override; + void setPlayCount( const int newCount ) override; //MediaDeviceTrack specific methods @@ -189,12 +188,12 @@ class MEDIADEVICECOLLECTION_EXPORT MediaDeviceArtist : public Meta::Artist { public: - MediaDeviceArtist( const QString &name ); + explicit MediaDeviceArtist( const QString &name ); virtual ~MediaDeviceArtist(); - virtual QString name() const; + QString name() const override; - virtual TrackList tracks(); + TrackList tracks() override; //MediaDeviceArtist specific methods virtual void addTrack( MediaDeviceTrackPtr track ); @@ -211,23 +210,23 @@ MediaDeviceAlbum( Collections::MediaDeviceCollection *collection, const QString &name ); virtual ~MediaDeviceAlbum(); - virtual QString name() const; + QString name() const override; - virtual bool isCompilation() const; + bool isCompilation() const override; void setIsCompilation( bool compilation ); - virtual bool hasAlbumArtist() const; - virtual ArtistPtr albumArtist() const; - virtual TrackList tracks(); + bool hasAlbumArtist() const override; + ArtistPtr albumArtist() const override; + TrackList tracks() override; - virtual bool hasImage( int size = 0 ) const; - virtual QImage image( int size = 0 ) const; - virtual bool canUpdateImage() const; - virtual void setImage( const QImage &image ); + bool hasImage( int size = 0 ) const override; + QImage image( int size = 0 ) const override; + bool canUpdateImage() const override; + void setImage( const QImage &image ) override; virtual void setImagePath( const QString &path ); - virtual bool hasCapabilityInterface( Capabilities::Capability::Type type ) const; - virtual Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ); + bool hasCapabilityInterface( Capabilities::Capability::Type type ) const override; + Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ) override; //MediaDeviceAlbum specific methods @@ -251,12 +250,12 @@ class MEDIADEVICECOLLECTION_EXPORT MediaDeviceComposer : public Meta::Composer { public: - MediaDeviceComposer( const QString &name ); + explicit MediaDeviceComposer( const QString &name ); virtual ~MediaDeviceComposer(); - virtual QString name() const; + QString name() const override; - virtual TrackList tracks(); + TrackList tracks() override; //MediaDeviceComposer specific methods void addTrack( MediaDeviceTrackPtr track ); @@ -270,12 +269,12 @@ class MEDIADEVICECOLLECTION_EXPORT MediaDeviceGenre : public Meta::Genre { public: - MediaDeviceGenre( const QString &name ); + explicit MediaDeviceGenre( const QString &name ); virtual ~MediaDeviceGenre(); - virtual QString name() const; + QString name() const override; - virtual TrackList tracks(); + TrackList tracks() override; //MediaDeviceGenre specific methods void addTrack( MediaDeviceTrackPtr track ); @@ -290,12 +289,12 @@ class MEDIADEVICECOLLECTION_EXPORT MediaDeviceYear : public Meta::Year { public: - MediaDeviceYear( const QString &name ); + explicit MediaDeviceYear( const QString &name ); virtual ~MediaDeviceYear(); - virtual QString name() const; + QString name() const override; - virtual TrackList tracks(); + TrackList tracks() override; //MediaDeviceYear specific methods void addTrack( MediaDeviceTrackPtr track ); diff --git a/src/core-impl/collections/mediadevicecollection/MediaDeviceMeta.cpp b/src/core-impl/collections/mediadevicecollection/MediaDeviceMeta.cpp --- a/src/core-impl/collections/mediadevicecollection/MediaDeviceMeta.cpp +++ b/src/core-impl/collections/mediadevicecollection/MediaDeviceMeta.cpp @@ -92,7 +92,7 @@ // Check name() to prevent infinite recursion QString trackName = !name().isEmpty()? prettyName() : i18n( "Unknown track" ); - return QString( "%1: %2 - %3" ).arg( collName, artistName, trackName ); + return QStringLiteral( "%1: %2 - %3" ).arg( collName, artistName, trackName ); } QString @@ -309,7 +309,7 @@ if( m_type.isEmpty() && !m_playableUrl.path().isEmpty() ) { QString path = m_playableUrl.path(); - return path.mid( path.lastIndexOf( '.' ) + 1 ); + return path.mid( path.lastIndexOf( QLatin1Char('.') ) + 1 ); } return m_type; } diff --git a/src/core-impl/collections/mediadevicecollection/MediaDeviceTrackEditor.h b/src/core-impl/collections/mediadevicecollection/MediaDeviceTrackEditor.h --- a/src/core-impl/collections/mediadevicecollection/MediaDeviceTrackEditor.h +++ b/src/core-impl/collections/mediadevicecollection/MediaDeviceTrackEditor.h @@ -14,8 +14,8 @@ * this program. If not, see . * ****************************************************************************************/ -#ifndef MEDIADEVICE_EDIT_CAPABILITY_H -#define MEDIADEVICE_EDIT_CAPABILITY_H +#ifndef MEDIADEVICE_TRACK_EDITOR_H +#define MEDIADEVICE_TRACK_EDITOR_H #include "core/meta/TrackEditor.h" #include "MediaDeviceMeta.h" @@ -25,22 +25,22 @@ class MediaDeviceTrackEditor : public Meta::TrackEditor { public: - MediaDeviceTrackEditor( MediaDeviceTrack *track ); - - virtual void setAlbum( const QString &newAlbum ); - virtual void setAlbumArtist( const QString &newAlbumArtist ); - virtual void setArtist( const QString &newArtist ); - virtual void setComposer( const QString &newComposer ); - virtual void setGenre( const QString &newGenre ); - virtual void setYear( int newYear ); - virtual void setBpm( const qreal newBpm ); - virtual void setTitle( const QString &newTitle ); - virtual void setComment( const QString &newComment ); - virtual void setTrackNumber( int newTrackNumber ); - virtual void setDiscNumber( int newDiscNumber ); - - virtual void beginUpdate(); - virtual void endUpdate(); + explicit MediaDeviceTrackEditor( MediaDeviceTrack *track ); + + void setAlbum( const QString &newAlbum ) override; + void setAlbumArtist( const QString &newAlbumArtist ) override; + void setArtist( const QString &newArtist ) override; + void setComposer( const QString &newComposer ) override; + void setGenre( const QString &newGenre ) override; + void setYear( int newYear ) override; + void setBpm( const qreal newBpm ) override; + void setTitle( const QString &newTitle ) override; + void setComment( const QString &newComment ) override; + void setTrackNumber( int newTrackNumber ) override; + void setDiscNumber( int newDiscNumber ) override; + + void beginUpdate() override; + void endUpdate() override; private: /** diff --git a/src/core-impl/collections/mediadevicecollection/amarok_collection-mediadevicecollection.desktop b/src/core-impl/collections/mediadevicecollection/amarok_collection-mediadevicecollection.desktop --- a/src/core-impl/collections/mediadevicecollection/amarok_collection-mediadevicecollection.desktop +++ b/src/core-impl/collections/mediadevicecollection/amarok_collection-mediadevicecollection.desktop @@ -23,7 +23,7 @@ Name[he]=אוסף התקן מדיה Name[hne]=मीडिया उपकरन संग्रह Name[hu]=Médiaeszköz-gyűjtemény -Name[id]=Koleksi Peranti Media +Name[id]=Koleksi Perangkat Media Name[is]=Ferðatækjasafn Name[it]=Collezione dispositivo multimediale Name[ja]=メディアデバイスコレクション @@ -54,7 +54,6 @@ Name[uk]=Збірка на носіях інформації Name[wa]=Ramexhnêye d' éndjin media Name[x-test]=xxMedia Device Collectionxx -Name[zh_CN]=媒体设备收藏 Name[zh_TW]=媒體裝置收藏 Comment=Media Device collection plugin for Amarok Comment[be]=Утулка калекцыі медыяпрылады для Amarok @@ -78,12 +77,12 @@ Comment[he]=תוסף אוסף התקן מדיה ל־Amarok Comment[hne]=अमाराक बर मीडिया उपकरन संग्रह प्लगइन Comment[hu]=Médiaeszköz-gyűjteményt megvalósító bővítőmodul az Amarokhoz -Comment[id]=Plugin koleksi Media Peranti untuk Amarok +Comment[id]=Plugin koleksi Media Perangkat untuk Amarok Comment[is]=Ferðatækjasafníforrit fyrir Amarok Comment[it]=Estensione della collezione dispositivo multimediale di Amarok Comment[ja]=Amarok のためのメディアデバイスコレクションプラグイン Comment[km]=កម្មវិធី​ជំនួយ​សម្រាំង​ឧបករណ៍​មេឌៀ​សម្រាប់​ Amarok -Comment[ko]=Amarok의 미디어 장치 모음집 플러그인 +Comment[ko]=Amarok용 미디어 장치 모음집 플러그인 Comment[ku]=Peveka Berhevoka Cîhazên Medya ji bo Amarok Comment[lt]=Muzikos įrenginio fonotekos Amarok papildinys Comment[lv]=Multivides ierīces kolekcijas Amarok spraudnis @@ -109,7 +108,6 @@ Comment[uk]=Додаток збірки на носіях інформації для Amarok Comment[wa]=Tchôke-divins di ramexhnêye d' éndjin media po Amarok Comment[x-test]=xxMedia Device collection plugin for Amarokxx -Comment[zh_CN]=Amarok 的媒体设备收藏插件 Comment[zh_TW]=Amarok 的媒體裝置收藏外掛程式 ServiceTypes=Amarok/Plugin diff --git a/src/core-impl/collections/mediadevicecollection/handler/MediaDeviceHandler.h b/src/core-impl/collections/mediadevicecollection/handler/MediaDeviceHandler.h --- a/src/core-impl/collections/mediadevicecollection/handler/MediaDeviceHandler.h +++ b/src/core-impl/collections/mediadevicecollection/handler/MediaDeviceHandler.h @@ -134,7 +134,7 @@ * of this type of device. If the device needs to * do some work to get URLs (e.g. copy tracks to a * temporary location) the overridden method in - * the handler takes care of it, but must emit + * the handler takes care of it, but must Q_EMIT * gotCopyableUrls when finished. * @param tracks The list of tracks for which to fetch urls */ @@ -156,7 +156,7 @@ /** * Removes a list of tracks from the device. - * @param tracklist The list of tracks to remove. + * @param tracks The list of tracks to remove. */ void removeTrackListFromDevice( const Meta::TrackList &tracks ); @@ -316,12 +316,12 @@ // Observer Methods /** These methods are called when the metadata of a track has changed. They invoke an MediaDevice DB update */ - virtual void metadataChanged( Meta::TrackPtr track ); - virtual void metadataChanged( Meta::ArtistPtr artist ); - virtual void metadataChanged( Meta::AlbumPtr album ); - virtual void metadataChanged( Meta::GenrePtr genre ); - virtual void metadataChanged( Meta::ComposerPtr composer ); - virtual void metadataChanged( Meta::YearPtr year ); + void metadataChanged( const Meta::TrackPtr &track ) override; + void metadataChanged( const Meta::ArtistPtr &artist ) override; + void metadataChanged( const Meta::AlbumPtr &album ) override; + void metadataChanged( const Meta::GenrePtr &genre ) override; + void metadataChanged( const Meta::ComposerPtr &composer ) override; + void metadataChanged(const YearPtr &year ) override; /** * Handler Variables @@ -334,7 +334,7 @@ bool m_isDeleting; Meta::TrackList m_tracksToCopy; ///< List of tracks left to copy - Meta::TrackList m_tracksCopying; ///< List of tracks currrently copying + Meta::TrackList m_tracksCopying; ///< List of tracks currently copying Meta::TrackList m_tracksToDelete; ///< List of tracks left to delete int m_numTracksToCopy; ///< The number of tracks left to copy @@ -367,7 +367,7 @@ * @param handler The handler */ - ParseWorkerThread( MediaDeviceHandler* handler); + explicit ParseWorkerThread( MediaDeviceHandler* handler); /** * The destructor. @@ -381,7 +381,7 @@ * @return Whether or not the copy was successful, i.e. m_success */ - virtual bool success() const; + bool success() const override; Q_SIGNALS: /** This signal is emitted when this job is being processed by a thread. */ @@ -405,9 +405,9 @@ /** * Reimplemented, simply runs the parse method. */ - virtual void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) Q_DECL_OVERRIDE; - void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; - void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; + void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) override; + void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; + void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; private: bool m_success; ///< Whether or not the parse was successful @@ -445,21 +445,23 @@ * @return Whether or not the copy was successful, i.e. m_success */ - virtual bool success() const; + bool success() const override; Q_SIGNALS: /** * Is emitted when the job is done successfully - * @param job The job that was done + * Parameters: + * The job that was done * @param track The source track used for the copy */ void copyTrackDone( ThreadWeaver::JobPointer, const Meta::TrackPtr& track ); /** * Is emitted when the job is done and has failed - * @param job The job that was done + * Parameters: + * The job that was done * @param track The source track used for the copy */ void copyTrackFailed( ThreadWeaver::JobPointer, const Meta::TrackPtr& track ); @@ -493,9 +495,9 @@ /** * Reimplemented, simply runs the copy track method. */ - virtual void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) Q_DECL_OVERRIDE; - void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; - void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; + void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) override; + void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; + void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; private: bool m_success; ///< Whether or not the copy was successful diff --git a/src/core-impl/collections/mediadevicecollection/handler/MediaDeviceHandler.cpp b/src/core-impl/collections/mediadevicecollection/handler/MediaDeviceHandler.cpp --- a/src/core-impl/collections/mediadevicecollection/handler/MediaDeviceHandler.cpp +++ b/src/core-impl/collections/mediadevicecollection/handler/MediaDeviceHandler.cpp @@ -18,7 +18,7 @@ #include "MediaDeviceHandler.h" -#include "core/interfaces/Logger.h" +#include "core/logger/Logger.h" #include "core/support/Components.h" #include "core-impl/collections/mediadevicecollection/MediaDeviceCollection.h" #include "core-impl/collections/mediadevicecollection/handler/MediaDeviceHandlerCapability.h" @@ -77,7 +77,7 @@ DEBUG_BLOCK if( m_provider ) The::playlistManager()->removeProvider( m_provider ); - m_memColl = NULL; + m_memColl = nullptr; } void @@ -150,7 +150,7 @@ } if( isCompilation && albumArtist.isEmpty() ) - // iPod doesn't handle empy album artist well for compilation albums (splits these albums) + // iPod doesn't handle empty album artist well for compilation albums (splits these albums) albumArtist = i18n( "Various Artists" ); else albumArtist = ArtistHelper::bestGuessAlbumArtist( albumArtist, trackArtist, genre, composer ); @@ -304,7 +304,7 @@ urls.insert( track, track->playableUrl() ); } - emit gotCopyableUrls( urls ); + Q_EMIT gotCopyableUrls( urls ); } void @@ -315,7 +315,7 @@ if ( m_isCopying ) { - KMessageBox::error( 0, i18n( "Tracks not copied: the device is already being copied to" ), copyErrorCaption ); + KMessageBox::error( nullptr, i18n( "Tracks not copied: the device is already being copied to" ), copyErrorCaption ); return; } @@ -405,11 +405,11 @@ // Do not bother copying 0 tracks // This could happen if all tracks to copy are dupes - if( m_tracksToCopy.size() == 0 ) + if( m_tracksToCopy.isEmpty() ) { - KMessageBox::error( 0, i18n( "Tracks not copied: the device already has these tracks" ), copyErrorCaption ); + KMessageBox::error( nullptr, i18n( "Tracks not copied: the device already has these tracks" ), copyErrorCaption ); m_isCopying = false; - emit copyTracksDone( false ); + Q_EMIT copyTracksDone( false ); return; } @@ -428,16 +428,16 @@ { debug() << "Free space: " << freeSpace(); debug() << "Space would've been after copy: " << (freeSpace() - transfersize); - KMessageBox::error( 0, i18n( "Tracks not copied: the device has insufficient space" ), copyErrorCaption ); + KMessageBox::error( nullptr, i18n( "Tracks not copied: the device has insufficient space" ), copyErrorCaption ); m_isCopying = false; - emit copyTracksDone( false ); + Q_EMIT copyTracksDone( false ); return; } debug() << "Copying " << m_tracksToCopy.size() << " tracks"; // Set up progress bar - Amarok::Components::logger()->newProgressOperation( this, + Amarok::Logger::newProgressOperation( this, i18n( "Transferring Tracks to Device" ), m_tracksToCopy.size() ); // prepare to copy @@ -479,7 +479,7 @@ if ( m_copyFailed ) { - Amarok::Components::logger()->shortMessage( + Amarok::Logger::shortMessage( i18np( "%1 track failed to copy to the device", "%1 tracks failed to copy to the device", m_tracksFailed.size() ) ); } @@ -493,7 +493,7 @@ // copying done m_isCopying = false; - emit copyTracksDone( true ); + Q_EMIT copyTracksDone( true ); } } @@ -546,15 +546,15 @@ // add track to collection addMediaDeviceTrackToCollection( destTrack ); - emit incrementProgress(); + Q_EMIT incrementProgress(); m_numTracksToCopy--; } void MediaDeviceHandler::slotCopyTrackFailed( const Meta::TrackPtr & track ) { DEBUG_BLOCK - emit incrementProgress(); + Q_EMIT incrementProgress(); m_numTracksToCopy--; @@ -573,7 +573,7 @@ if ( m_isDeleting ) { - KMessageBox::error( 0, i18n( "%1 tracks are already being deleted from the device.", removeError ), removeErrorCaption ); + KMessageBox::error( nullptr, i18n( "%1 tracks are already being deleted from the device.", removeError ), removeErrorCaption ); return; } @@ -586,7 +586,7 @@ m_tracksToDelete = tracks; // Set up statusbar for deletion operation - Amarok::Components::logger()->newProgressOperation( this, + Amarok::Logger::newProgressOperation( this, i18np( "Removing Track from Device", "Removing Tracks from Device", tracks.size() ), tracks.size() ); @@ -644,22 +644,22 @@ // remove from memory collection removeMediaDeviceTrackFromCollection( devicetrack ); - emit incrementProgress(); + Q_EMIT incrementProgress(); m_numTracksToRemove--; if( m_numTracksToRemove == 0 ) { /* if( m_tracksFailed.size() > 0 ) { - Amarok::Components::logger()->shortMessage( + Amarok::Logger::shortMessage( i18n( "%1 tracks failed to copy to the device", m_tracksFailed.size() ) ); } */ debug() << "Done removing tracks"; m_isDeleting = false; - emit removeTracksDone(); + Q_EMIT removeTracksDone(); } } @@ -669,7 +669,7 @@ DEBUG_BLOCK Q_UNUSED( success ) - emit endProgressOperation( this ); + Q_EMIT endProgressOperation( this ); m_memColl->collectionUpdated(); } @@ -698,7 +698,7 @@ { const QString album( m_rc->libGetAlbum( track ) ); QString albumArtist( m_rc->libGetAlbumArtist( track ) ); - if( albumArtist.compare( "Various Artists", Qt::CaseInsensitive ) == 0 || + if( albumArtist.compare( QLatin1String("Various Artists"), Qt::CaseInsensitive ) == 0 || albumArtist.compare( i18n( "Various Artists" ), Qt::CaseInsensitive ) == 0 ) { albumArtist.clear(); @@ -968,12 +968,12 @@ else { // Finish the progress bar - emit incrementProgress(); - emit endProgressOperation( this ); + Q_EMIT incrementProgress(); + Q_EMIT endProgressOperation( this ); // Inform CollectionLocation that copying is done m_isCopying = false; - emit copyTracksDone( true ); + Q_EMIT copyTracksDone( true ); } } @@ -1112,7 +1112,7 @@ /** Observer Methods **/ void -MediaDeviceHandler::metadataChanged( TrackPtr track ) +MediaDeviceHandler::metadataChanged( const TrackPtr &track ) { DEBUG_BLOCK @@ -1128,31 +1128,31 @@ } void -MediaDeviceHandler::metadataChanged( ArtistPtr artist ) +MediaDeviceHandler::metadataChanged(const ArtistPtr &artist ) { Q_UNUSED( artist ); } void -MediaDeviceHandler::metadataChanged( AlbumPtr album ) +MediaDeviceHandler::metadataChanged(const AlbumPtr &album ) { Q_UNUSED( album ); } void -MediaDeviceHandler::metadataChanged( GenrePtr genre ) +MediaDeviceHandler::metadataChanged(const GenrePtr &genre ) { Q_UNUSED( genre ); } void -MediaDeviceHandler::metadataChanged( ComposerPtr composer ) +MediaDeviceHandler::metadataChanged(const ComposerPtr &composer ) { Q_UNUSED( composer ); } void -MediaDeviceHandler::metadataChanged( YearPtr year ) +MediaDeviceHandler::metadataChanged(const YearPtr &year ) { Q_UNUSED( year ); } @@ -1274,11 +1274,11 @@ void CopyWorkerThread::slotDoneSuccess( ThreadWeaver::JobPointer ) { - emit copyTrackDone( QSharedPointer(this), m_track ); + Q_EMIT copyTrackDone( QSharedPointer(this), m_track ); } void CopyWorkerThread::slotDoneFailed( ThreadWeaver::JobPointer ) { - emit copyTrackFailed( QSharedPointer(this), m_track ); + Q_EMIT copyTrackFailed( QSharedPointer(this), m_track ); } diff --git a/src/core-impl/collections/mediadevicecollection/handler/MediaDeviceHandlerCapability.h b/src/core-impl/collections/mediadevicecollection/handler/MediaDeviceHandlerCapability.h --- a/src/core-impl/collections/mediadevicecollection/handler/MediaDeviceHandlerCapability.h +++ b/src/core-impl/collections/mediadevicecollection/handler/MediaDeviceHandlerCapability.h @@ -35,7 +35,6 @@ class MEDIADEVICECOLLECTION_EXPORT Capability : public QObject { Q_OBJECT - Q_ENUMS( Type ) public: //add additional capabilities here @@ -46,14 +45,15 @@ , Artwork = 4 // can read/write artwork , Podcast = 5 // can read/write podcasts }; + Q_ENUM( Type ) /** * @param handler should be set to associated MediaDeviceHandler or Collection. * * The capability sets its parent to handler, so that it can be guaranteed that * the handler is valid for Capability's lifetime. */ - Capability( QObject *handler ); + explicit Capability( QObject *handler ); virtual ~Capability(); Q_SIGNALS: diff --git a/src/core-impl/collections/mediadevicecollection/handler/MediaDeviceHandlerCapability.cpp b/src/core-impl/collections/mediadevicecollection/handler/MediaDeviceHandlerCapability.cpp --- a/src/core-impl/collections/mediadevicecollection/handler/MediaDeviceHandlerCapability.cpp +++ b/src/core-impl/collections/mediadevicecollection/handler/MediaDeviceHandlerCapability.cpp @@ -28,7 +28,7 @@ * Qt builds. This is a workaround that is safe as long as this object is only deleted * using deleteLater() or form the handler's thread */ connect( this, &Handler::Capability::signalSetParent, this, &Handler::Capability::slotSetParent ); - emit signalSetParent( handler ); + Q_EMIT signalSetParent( handler ); } Handler::Capability::~Capability() diff --git a/src/core-impl/collections/mediadevicecollection/handler/capabilities/ArtworkCapability.h b/src/core-impl/collections/mediadevicecollection/handler/capabilities/ArtworkCapability.h --- a/src/core-impl/collections/mediadevicecollection/handler/capabilities/ArtworkCapability.h +++ b/src/core-impl/collections/mediadevicecollection/handler/capabilities/ArtworkCapability.h @@ -27,14 +27,14 @@ Q_OBJECT public: - ArtworkCapability( QObject *parent ) : Capability( parent ) {} + explicit ArtworkCapability( QObject *parent ) : Capability( parent ) {} virtual ~ArtworkCapability(); virtual QImage getCover( const Meta::MediaDeviceTrackPtr &track ) = 0; virtual void setCover( Meta::MediaDeviceAlbumPtr album, const QImage &image ) = 0; - virtual void setCoverPath( Meta::MediaDeviceAlbumPtr album, const QString &path ); + virtual void setCoverPath( const Meta::MediaDeviceAlbumPtr &album, const QString &path ); virtual bool canUpdateCover() const = 0; diff --git a/src/core-impl/collections/mediadevicecollection/handler/capabilities/ArtworkCapability.cpp b/src/core-impl/collections/mediadevicecollection/handler/capabilities/ArtworkCapability.cpp --- a/src/core-impl/collections/mediadevicecollection/handler/capabilities/ArtworkCapability.cpp +++ b/src/core-impl/collections/mediadevicecollection/handler/capabilities/ArtworkCapability.cpp @@ -22,7 +22,7 @@ } void -Handler::ArtworkCapability::setCoverPath( Meta::MediaDeviceAlbumPtr album, const QString &path ) +Handler::ArtworkCapability::setCoverPath( const Meta::MediaDeviceAlbumPtr &album, const QString &path ) { const QImage pix( path ); if( !pix.isNull() ) diff --git a/src/core-impl/collections/mediadevicecollection/handler/capabilities/PlaylistCapability.h b/src/core-impl/collections/mediadevicecollection/handler/capabilities/PlaylistCapability.h --- a/src/core-impl/collections/mediadevicecollection/handler/capabilities/PlaylistCapability.h +++ b/src/core-impl/collections/mediadevicecollection/handler/capabilities/PlaylistCapability.h @@ -29,7 +29,7 @@ Q_OBJECT public: - PlaylistCapability( QObject *parent ) : Capability( parent ) {} + explicit PlaylistCapability( QObject *parent ) : Capability( parent ) {} virtual ~PlaylistCapability(); /// Parsing of Tracks in Playlists on Device @@ -116,7 +116,7 @@ /** * Saves a playlist of tracks, with a name. - * @param tracks the tracks that make up the playlist to be made + * @param playlist the playlist to be made * @param name the name of the playlist */ virtual void savePlaylist( const Playlists::MediaDevicePlaylistPtr &playlist, const QString& name ) = 0; diff --git a/src/core-impl/collections/mediadevicecollection/handler/capabilities/PodcastCapability.h b/src/core-impl/collections/mediadevicecollection/handler/capabilities/PodcastCapability.h --- a/src/core-impl/collections/mediadevicecollection/handler/capabilities/PodcastCapability.h +++ b/src/core-impl/collections/mediadevicecollection/handler/capabilities/PodcastCapability.h @@ -112,13 +112,13 @@ /** * Deletes a particular Podcast from the device - * @param Podcast the Podcast to remove + * @param channel the channel to remove */ virtual void removePodcast( const MediaDevicePodcastChannelPtr &channel ) = 0; /** * Deletes a particular Podcast Episode from the device - * @param Podcast the Podcast to remove + * @param episode the episode to remove */ virtual void removePodcastEpisode( const MediaDevicePodcastEpisodePtr &episode ) = 0; @@ -128,7 +128,7 @@ * For example, for libgpod one would associate Itdb_Podcast*. It makes * the most sense to use a QHash since it is fastest lookup and order * does not matter. - * @param Podcast The list to two-way associate with a library list struct + * @param channel The channel to two-way associate with a library list struct */ virtual void setAssociatePodcast( const MediaDevicePodcastChannelPtr &channel ) { Q_UNUSED( channel ) } diff --git a/src/core-impl/collections/mediadevicecollection/handler/capabilities/ReadCapability.h b/src/core-impl/collections/mediadevicecollection/handler/capabilities/ReadCapability.h --- a/src/core-impl/collections/mediadevicecollection/handler/capabilities/ReadCapability.h +++ b/src/core-impl/collections/mediadevicecollection/handler/capabilities/ReadCapability.h @@ -32,7 +32,7 @@ Q_OBJECT public: - ReadCapability( QObject *parent ) : Capability( parent ) {} + explicit ReadCapability( QObject *parent ) : Capability( parent ) {} virtual ~ReadCapability(); static Type capabilityInterfaceType() { return Handler::Capability::Readable; } diff --git a/src/core-impl/collections/mediadevicecollection/handler/capabilities/WriteCapability.h b/src/core-impl/collections/mediadevicecollection/handler/capabilities/WriteCapability.h --- a/src/core-impl/collections/mediadevicecollection/handler/capabilities/WriteCapability.h +++ b/src/core-impl/collections/mediadevicecollection/handler/capabilities/WriteCapability.h @@ -29,7 +29,7 @@ Q_OBJECT public: - WriteCapability( QObject *parent ) : Capability( parent ) {} + explicit WriteCapability( QObject *parent ) : Capability( parent ) {} virtual ~WriteCapability(); static Type capabilityInterfaceType() { return Handler::Capability::Writable; } @@ -62,7 +62,7 @@ /** * libDeleteTrack does the actual file deleting. For Ipods, it uses KIO, - * for MTPs this uses a libmtp call. Must emit libRemoveTrackDone when finished. + * for MTPs this uses a libmtp call. Must Q_EMIT libRemoveTrackDone when finished. * @param track The track whose file is to be deleted * @return Whether or not the track removal was successful */ diff --git a/src/core-impl/collections/mediadevicecollection/playlist/MediaDevicePlaylist.h b/src/core-impl/collections/mediadevicecollection/playlist/MediaDevicePlaylist.h --- a/src/core-impl/collections/mediadevicecollection/playlist/MediaDevicePlaylist.h +++ b/src/core-impl/collections/mediadevicecollection/playlist/MediaDevicePlaylist.h @@ -36,17 +36,17 @@ ~MediaDevicePlaylist(); // Playlist Functions - virtual QString name() const { return m_name; } - virtual QUrl uidUrl() const { return QUrl(); } + QString name() const override { return m_name; } + QUrl uidUrl() const override { return QUrl(); } /**override showing just the filename */ - virtual void setName( const QString &name ); + void setName( const QString &name ) override; - virtual int trackCount() const; - virtual Meta::TrackList tracks(); - virtual void addTrack( Meta::TrackPtr track, int position = -1 ); + int trackCount() const override; + Meta::TrackList tracks() override; + void addTrack( const Meta::TrackPtr &track, int position = -1 ) override; - virtual void removeTrack( int position ); + void removeTrack( int position ) override; private: Meta::TrackList m_tracks; diff --git a/src/core-impl/collections/mediadevicecollection/playlist/MediaDevicePlaylist.cpp b/src/core-impl/collections/mediadevicecollection/playlist/MediaDevicePlaylist.cpp --- a/src/core-impl/collections/mediadevicecollection/playlist/MediaDevicePlaylist.cpp +++ b/src/core-impl/collections/mediadevicecollection/playlist/MediaDevicePlaylist.cpp @@ -50,7 +50,7 @@ } void -Playlists::MediaDevicePlaylist::addTrack( Meta::TrackPtr track, int position ) +Playlists::MediaDevicePlaylist::addTrack(const Meta::TrackPtr &track, int position ) { DEBUG_BLOCK int insertAt = (position == -1) ? m_tracks.count() : position; diff --git a/src/core-impl/collections/mediadevicecollection/playlist/MediaDeviceUserPlaylistProvider.h b/src/core-impl/collections/mediadevicecollection/playlist/MediaDeviceUserPlaylistProvider.h --- a/src/core-impl/collections/mediadevicecollection/playlist/MediaDeviceUserPlaylistProvider.h +++ b/src/core-impl/collections/mediadevicecollection/playlist/MediaDeviceUserPlaylistProvider.h @@ -34,30 +34,30 @@ { Q_OBJECT public: - MediaDeviceUserPlaylistProvider( Collections::MediaDeviceCollection *collection ); - ~MediaDeviceUserPlaylistProvider(); + explicit MediaDeviceUserPlaylistProvider( Collections::MediaDeviceCollection *collection ); + ~MediaDeviceUserPlaylistProvider() override; /* PlaylistProvider functions */ - virtual QString prettyName() const { return i18n( "Media Device playlists" ); }; - virtual QIcon icon() const { return QIcon::fromTheme( "multimedia-player" ); } + QString prettyName() const override { return i18n( "Media Device playlists" ); } + QIcon icon() const override { return QIcon::fromTheme( QStringLiteral("multimedia-player") ); } /* Playlists::UserPlaylistProvider functions */ - virtual Playlists::PlaylistList playlists(); + Playlists::PlaylistList playlists() override; virtual Playlists::PlaylistPtr save( const Meta::TrackList &tracks ); - virtual Playlists::PlaylistPtr save( const Meta::TrackList &tracks, const QString& name ); + Playlists::PlaylistPtr save( const Meta::TrackList &tracks, const QString& name ) override; - virtual bool isWritable() { return true; } - virtual void renamePlaylist( Playlists::PlaylistPtr playlist, const QString &newName ); - virtual bool deletePlaylists( const Playlists::PlaylistList &playlistlist ); + bool isWritable() override { return true; } + void renamePlaylist(Playlists::PlaylistPtr playlist, const QString &newName ) override; + bool deletePlaylists( const Playlists::PlaylistList &playlistlist ) override; /// MediaDevice-specific Functions void addMediaDevicePlaylist( Playlists::MediaDevicePlaylistPtr &playlist ); void removePlaylist( Playlists::MediaDevicePlaylistPtr &playlist ); public Q_SLOTS: - void sendUpdated() { emit updated(); } + void sendUpdated() { Q_EMIT updated(); } Q_SIGNALS: void playlistSaved( const Playlists::MediaDevicePlaylistPtr &playlist, const QString &name ); diff --git a/src/core-impl/collections/mediadevicecollection/playlist/MediaDeviceUserPlaylistProvider.cpp b/src/core-impl/collections/mediadevicecollection/playlist/MediaDeviceUserPlaylistProvider.cpp --- a/src/core-impl/collections/mediadevicecollection/playlist/MediaDeviceUserPlaylistProvider.cpp +++ b/src/core-impl/collections/mediadevicecollection/playlist/MediaDeviceUserPlaylistProvider.cpp @@ -35,8 +35,8 @@ #include -static const int USERPLAYLIST_DB_VERSION = 2; -static const QString key("AMAROK_USERPLAYLIST"); +// static const int USERPLAYLIST_DB_VERSION = 2; +static const QString key(QStringLiteral("AMAROK_USERPLAYLIST")); namespace Playlists { @@ -59,7 +59,7 @@ // playlist->saveToDb( true ); // } m_playlists.clear(); -// emit updated(); +// Q_EMIT updated(); // The::playlistManager()->removeProvider( this ); } @@ -89,7 +89,7 @@ filteredTracks << track; return save( filteredTracks, - QDateTime::currentDateTime().toString( "ddd MMMM d yy hh-mm" ) ); + QDateTime::currentDateTime().toString( QStringLiteral("ddd MMMM d yy hh-mm") ) ); } Playlists::PlaylistPtr @@ -101,24 +101,24 @@ Playlists::MediaDevicePlaylistPtr pl = Playlists::MediaDevicePlaylistPtr( new Playlists::MediaDevicePlaylist( name, tracks ) ); //pl = 0; - emit playlistSaved( pl, name ); // inform handler of new playlist + Q_EMIT playlistSaved( pl, name ); // inform handler of new playlist addMediaDevicePlaylist( pl ); return Playlists::PlaylistPtr::dynamicCast( pl ); } void -MediaDeviceUserPlaylistProvider::renamePlaylist( Playlists::PlaylistPtr playlist, const QString &newName ) +MediaDeviceUserPlaylistProvider::renamePlaylist(PlaylistPtr playlist, const QString &newName ) { DEBUG_BLOCK Playlists::MediaDevicePlaylistPtr pl = Playlists::MediaDevicePlaylistPtr::staticCast( playlist ); if( pl ) { debug() << "Setting name of playlist"; pl->setName( newName ); - emit playlistRenamed( pl ); + Q_EMIT playlistRenamed( pl ); } } @@ -139,23 +139,23 @@ } } - emit playlistsDeleted( pllist ); + Q_EMIT playlistsDeleted( pllist ); return true; } void MediaDeviceUserPlaylistProvider::addMediaDevicePlaylist( Playlists::MediaDevicePlaylistPtr &playlist ) { m_playlists << playlist; - emit updated(); + Q_EMIT updated(); } void MediaDeviceUserPlaylistProvider::removePlaylist( Playlists::MediaDevicePlaylistPtr &playlist ) { m_playlists.removeOne( playlist ); - emit updated(); + Q_EMIT updated(); } } //namespace Playlists diff --git a/src/core-impl/collections/mediadevicecollection/podcast/MediaDevicePodcastProvider.h b/src/core-impl/collections/mediadevicecollection/podcast/MediaDevicePodcastProvider.h --- a/src/core-impl/collections/mediadevicecollection/podcast/MediaDevicePodcastProvider.h +++ b/src/core-impl/collections/mediadevicecollection/podcast/MediaDevicePodcastProvider.h @@ -25,32 +25,32 @@ class MediaDevicePodcastProvider : public Podcasts::PodcastProvider { public: - MediaDevicePodcastProvider( Meta::MediaDeviceHandler *handler ); + explicit MediaDevicePodcastProvider( Meta::MediaDeviceHandler *handler ); //TODO:implement these - virtual bool possiblyContainsTrack( const QUrl &url ) const { Q_UNUSED(url); return false;} - virtual Meta::TrackPtr trackForUrl( const QUrl &url ) { Q_UNUSED(url); return Meta::TrackPtr(); } + bool possiblyContainsTrack( const QUrl &url ) const override { Q_UNUSED(url); return false;} + Meta::TrackPtr trackForUrl( const QUrl &url ) override { Q_UNUSED(url); return Meta::TrackPtr(); } - virtual void addPodcast( const QUrl &url ); + void addPodcast( const QUrl &url ) override; - virtual Podcasts::PodcastChannelPtr addChannel( Podcasts::PodcastChannelPtr channel ); - virtual Podcasts::PodcastEpisodePtr addEpisode( Podcasts::PodcastEpisodePtr episode ); + Podcasts::PodcastChannelPtr addChannel( const Podcasts::PodcastChannelPtr &channel ) override; + Podcasts::PodcastEpisodePtr addEpisode( Podcasts::PodcastEpisodePtr episode ) override; - virtual Podcasts::PodcastChannelList channels(); + Podcasts::PodcastChannelList channels() override; virtual void removeSubscription( Podcasts::PodcastChannelPtr channel ); virtual void configureProvider(); virtual void configureChannel( Podcasts::PodcastChannelPtr channel ); // PlaylistProvider methods - virtual QString prettyName() const; - virtual int category() const { return (int)Playlists::PodcastChannelPlaylist; } + QString prettyName() const override; + int category() const override { return (int)Playlists::PodcastChannelPlaylist; } - virtual Playlists::PlaylistList playlists(); + Playlists::PlaylistList playlists() override; - virtual Playlists::PlaylistPtr addPlaylist( Playlists::PlaylistPtr playlist ); - virtual Meta::TrackPtr addTrack( Meta::TrackPtr track ); + Playlists::PlaylistPtr addPlaylist(Playlists::PlaylistPtr playlist ) override; + Meta::TrackPtr addTrack( const Meta::TrackPtr &track ) override; private: Meta::MediaDeviceHandler *m_handler; diff --git a/src/core-impl/collections/mediadevicecollection/podcast/MediaDevicePodcastProvider.cpp b/src/core-impl/collections/mediadevicecollection/podcast/MediaDevicePodcastProvider.cpp --- a/src/core-impl/collections/mediadevicecollection/podcast/MediaDevicePodcastProvider.cpp +++ b/src/core-impl/collections/mediadevicecollection/podcast/MediaDevicePodcastProvider.cpp @@ -32,7 +32,7 @@ } PodcastChannelPtr -MediaDevicePodcastProvider::addChannel( PodcastChannelPtr channel ) +MediaDevicePodcastProvider::addChannel( const PodcastChannelPtr &channel ) { Q_UNUSED( channel ) return PodcastChannelPtr(); @@ -87,7 +87,7 @@ } Playlists::PlaylistPtr -MediaDevicePodcastProvider::addPlaylist( Playlists::PlaylistPtr playlist ) +MediaDevicePodcastProvider::addPlaylist(Playlists::PlaylistPtr playlist ) { PodcastChannelPtr channel = PodcastChannelPtr::dynamicCast( playlist ); if( channel.isNull() ) @@ -97,7 +97,7 @@ } Meta::TrackPtr -MediaDevicePodcastProvider::addTrack( Meta::TrackPtr track ) +MediaDevicePodcastProvider::addTrack(const Meta::TrackPtr &track ) { PodcastEpisodePtr episode = PodcastEpisodePtr::dynamicCast( track ); if( episode.isNull() ) diff --git a/src/core-impl/collections/mediadevicecollection/support/ConnectionAssistant.h b/src/core-impl/collections/mediadevicecollection/support/ConnectionAssistant.h --- a/src/core-impl/collections/mediadevicecollection/support/ConnectionAssistant.h +++ b/src/core-impl/collections/mediadevicecollection/support/ConnectionAssistant.h @@ -45,7 +45,7 @@ /** - identify checks if a device identified by @param uid matches the type + identify checks if a device identified by @param udi matches the type of device described by this ConnectionAssistant */ @@ -62,7 +62,7 @@ bool wait(); - // Simply emit identified( info ) + // Simply Q_EMIT identified( info ) virtual void tellIdentified( const QString &udi ); virtual void tellDisconnected( const QString &udi ); diff --git a/src/core-impl/collections/mediadevicecollection/support/ConnectionAssistant.cpp b/src/core-impl/collections/mediadevicecollection/support/ConnectionAssistant.cpp --- a/src/core-impl/collections/mediadevicecollection/support/ConnectionAssistant.cpp +++ b/src/core-impl/collections/mediadevicecollection/support/ConnectionAssistant.cpp @@ -48,14 +48,14 @@ ConnectionAssistant::tellIdentified( const QString &udi ) { DEBUG_BLOCK - emit identified( deviceInfo( udi ) ); + Q_EMIT identified( deviceInfo( udi ) ); } void ConnectionAssistant::tellDisconnected( const QString& udi ) { DEBUG_BLOCK - emit disconnected( udi ); + Q_EMIT disconnected( udi ); } bool diff --git a/src/core-impl/collections/mediadevicecollection/support/mediadevicecollection_export.h b/src/core-impl/collections/mediadevicecollection/support/mediadevicecollection_export.h --- a/src/core-impl/collections/mediadevicecollection/support/mediadevicecollection_export.h +++ b/src/core-impl/collections/mediadevicecollection/support/mediadevicecollection_export.h @@ -18,7 +18,7 @@ #define MEDIADEVICECOLLECTION_EXPORT_H /* needed for Q_DECL_EXPORT and Q_DECL_IMPORT macros */ -#include +#include #ifndef MEDIADEVICECOLLECTION_EXPORT # if defined(MAKE_MEDIADEVICELIB_LIB) || defined(MAKE_AMAROKLIB_LIB) diff --git a/src/core-impl/collections/mtpcollection/CMakeLists.txt b/src/core-impl/collections/mtpcollection/CMakeLists.txt --- a/src/core-impl/collections/mtpcollection/CMakeLists.txt +++ b/src/core-impl/collections/mtpcollection/CMakeLists.txt @@ -1,6 +1,3 @@ -find_package(Mtp) - - if (MTP_FOUND) include_directories( ${Amarok_SOURCE_DIR}/src @@ -13,11 +10,8 @@ ${Amarok_SOURCE_DIR}/src/core-impl/collections/mtpcollection/handler/capabilities ${Amarok_SOURCE_DIR}/src/core-impl/collections/mtpcollection/support ${GLIB2_INCLUDE_DIR} - ${MTP_INCLUDE_DIR} ${CMAKE_BINARY_DIR}/src ${AMAROK_COLLECTION_SUPPORT_DIR} - - ) @@ -40,10 +34,10 @@ KF5::KIOCore KF5::ThreadWeaver Qt5::Gui - ${MTP_LIBRARIES} + Mtp::Mtp ) -install(TARGETS amarok_collection-mtpcollection DESTINATION ${PLUGIN_INSTALL_DIR} ) +install(TARGETS amarok_collection-mtpcollection DESTINATION ${KDE_INSTALL_PLUGINDIR} ) kcoreaddons_desktop_to_json(amarok_collection-mtpcollection amarok_collection-mtpcollection.desktop SERVICE_TYPES ${CMAKE_SOURCE_DIR}/src/amarok-plugin.desktop) diff --git a/src/core-impl/collections/mtpcollection/MtpCollection.h b/src/core-impl/collections/mtpcollection/MtpCollection.h --- a/src/core-impl/collections/mtpcollection/MtpCollection.h +++ b/src/core-impl/collections/mtpcollection/MtpCollection.h @@ -50,12 +50,12 @@ public: - MtpCollection( MediaDeviceInfo* ); + explicit MtpCollection( MediaDeviceInfo* ); virtual ~MtpCollection(); - virtual QString collectionId() const; - virtual QString prettyName() const; - virtual QIcon icon() const { return QIcon::fromTheme("multimedia-player"); } + QString collectionId() const override; + QString prettyName() const override; + QIcon icon() const override { return QIcon::fromTheme(QStringLiteral("multimedia-player")); } //void writeDatabase(); }; diff --git a/src/core-impl/collections/mtpcollection/amarok_collection-mtpcollection.desktop b/src/core-impl/collections/mtpcollection/amarok_collection-mtpcollection.desktop --- a/src/core-impl/collections/mtpcollection/amarok_collection-mtpcollection.desktop +++ b/src/core-impl/collections/mtpcollection/amarok_collection-mtpcollection.desktop @@ -54,7 +54,6 @@ Name[uk]=Збірка MTP Name[wa]=Ramexhnêye MTP Name[x-test]=xxMTP Collectionxx -Name[zh_CN]=MTP 收藏 Name[zh_TW]=MTP 收藏 Comment=MTP collection plugin for Amarok Comment[be]=Утулка калекцыі MTP для Amarok @@ -78,12 +77,12 @@ Comment[he]=תוסף אוסף MTP ל־Amarok Comment[hne]=अमाराक बर एमटीपी संग्रह प्लगइन Comment[hu]=MTP-gyűjteményt megvalósító bővítőmodul az Amarokhoz -Comment[id]=Koleksi plugin MTP untuk Amarok +Comment[id]=Plugin MTP collection untuk Amarok Comment[is]=MTP safníforrit fyrir Amarok Comment[it]=Estensione della collezione MTP di Amarok Comment[ja]=Amarok のための MTP コレクションプラグイン Comment[km]=កម្មវិធី​ជំនួយ​សម្រាំង MTP សម្រាប់​ Amarok -Comment[ko]=Amarok의 MTP 모음집 플러그인 +Comment[ko]=Amarok용 MTP 모음집 플러그인 Comment[ku]=Pêveka Berhevoka MTP ji bo Amarok Comment[lt]=MTP fonotekos Amarok papildinys Comment[lv]=Amarok MTP kolekcijas spraudnis @@ -109,7 +108,6 @@ Comment[uk]=Додаток збірки MTP для Amarok Comment[wa]=Tchôke-divins di ramexhnêye MTP po Amarok Comment[x-test]=xxMTP collection plugin for Amarokxx -Comment[zh_CN]=Amarok 的 MTP 收藏插件 Comment[zh_TW]=Amarok 的 MTP 收藏外掛程式 ServiceTypes=Amarok/Plugin diff --git a/src/core-impl/collections/mtpcollection/handler/MtpHandler.h b/src/core-impl/collections/mtpcollection/handler/MtpHandler.h --- a/src/core-impl/collections/mtpcollection/handler/MtpHandler.h +++ b/src/core-impl/collections/mtpcollection/handler/MtpHandler.h @@ -62,24 +62,24 @@ Q_OBJECT public: - MtpHandler( Collections::MtpCollection *mc ); + explicit MtpHandler( Collections::MtpCollection *mc ); virtual ~MtpHandler(); friend class WorkerThread; - virtual void init(); // collection - virtual bool isWritable() const; + void init() override; // collection + bool isWritable() const override; - virtual void getCopyableUrls( const Meta::TrackList &tracks ); + void getCopyableUrls( const Meta::TrackList &tracks ) override; - virtual QString prettyName() const; + QString prettyName() const override; - virtual void prepareToPlay( Meta::MediaDeviceTrackPtr &track ); + void prepareToPlay( Meta::MediaDeviceTrackPtr &track ) override; /// Capability-related methods - virtual bool hasCapabilityInterface( Handler::Capability::Type type ) const; - virtual Handler::Capability* createCapabilityInterface( Handler::Capability::Type type ); + bool hasCapabilityInterface( Handler::Capability::Type type ) const override; + Handler::Capability* createCapabilityInterface( Handler::Capability::Type type ) override; friend class Handler::MtpPlaylistCapability; friend class Handler::MtpReadCapability; @@ -261,12 +261,12 @@ WorkerThread( int numrawdevices, LIBMTP_raw_device_t* rawdevices, MtpHandler* handler ); virtual ~WorkerThread(); - virtual bool success() const Q_DECL_OVERRIDE; + bool success() const override; protected: - virtual void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) Q_DECL_OVERRIDE; - void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; - void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; + void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) override; + void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; + void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; Q_SIGNALS: /** This signal is emitted when this job is being processed by a thread. */ diff --git a/src/core-impl/collections/mtpcollection/handler/MtpHandler.cpp b/src/core-impl/collections/mtpcollection/handler/MtpHandler.cpp --- a/src/core-impl/collections/mtpcollection/handler/MtpHandler.cpp +++ b/src/core-impl/collections/mtpcollection/handler/MtpHandler.cpp @@ -26,7 +26,7 @@ #include "core/support/Debug.h" #include "core-impl/meta/file/File.h" // for KIO file handling -#include "core/interfaces/Logger.h" +#include "core/logger/Logger.h" #include #include @@ -91,7 +91,7 @@ LIBMTP_Release_Device( m_device ); /* possible race condition with statusbar destructor, will uncomment when fixed */ - //Amarok::Components::logger()->longMessage( + //Amarok::Logger::longMessage( // i18n( "The MTP device %1 has been disconnected", prettyName() ), StatusBar::Information ); debug() << "Device released"; } @@ -203,7 +203,7 @@ else { free( rawdevices ); - // emit failed(); + // Q_EMIT failed(); } } @@ -222,7 +222,7 @@ { debug() << "Opening raw device number: " << ( i + 1 ); device = LIBMTP_Open_Raw_Device( &rawdevices[i] ); - if ( device == NULL ) + if ( device == nullptr ) { debug() << "Unable to open raw device: " << ( i + 1 ); success = false; @@ -359,7 +359,7 @@ LIBMTP_Release_Device( m_device ); /* possible race condition with statusbar destructor, will uncomment when fixed - Amarok::Components::logger()->longMessage( + Amarok::Logger::longMessage( i18n( "The MTP device %1 has been disconnected", prettyName() ), Amarok::Logger::Information ); */ @@ -385,7 +385,7 @@ QString trackFileName = QString::fromUtf8( m_mtpTrackHash.value( track )->filename ); - QString filename = m_tempDir->path() + '/' + trackFileName; + QString filename = m_tempDir->path() + QLatin1Char('/') + trackFileName; debug() << "Temp Filename: " << filename; @@ -405,7 +405,7 @@ } } - emit gotCopyableUrls( urls ); + Q_EMIT gotCopyableUrls( urls ); } /** @@ -439,7 +439,7 @@ genreName = genre->prettyName(); uint32_t parent_id = getDefaultParentId(); - QStringList folders = m_folderStructure.split( '/' ); // use slash as a dir separator + QStringList folders = m_folderStructure.split( QLatin1Char('/') ); // use slash as a dir separator QString completePath; for ( QStringList::Iterator it = folders.begin(); it != folders.end(); ++it ) { @@ -486,7 +486,7 @@ parent_id = m_default_parent_folder; } // Otherwise look for a folder called "Music" - else if ( m_folders != 0 ) + else if ( m_folders != nullptr ) { parent_id = folderNameToID( qstrdup( QString( "Music" ).toUtf8() ), m_folders ); if ( !parent_id ) @@ -511,7 +511,7 @@ { uint32_t i; - if ( folderlist == 0 ) + if ( folderlist == nullptr ) return 0; if ( !strcasecmp( name, folderlist->name ) ) @@ -534,7 +534,7 @@ { uint32_t i; - if ( folderlist == 0 ) + if ( folderlist == nullptr ) return 0; if ( !strcasecmp( name, folderlist->name ) && folderlist->parent_id == parent_id ) @@ -577,7 +577,7 @@ MtpHandler::updateFolders( void ) { LIBMTP_destroy_folder_t( m_folders ); - m_folders = 0; + m_folders = nullptr; m_folders = LIBMTP_Get_Folder_List( m_device ); } #if 0 @@ -600,7 +600,7 @@ if ( status != 0 ) { debug() << "delete object failed"; - Amarok::Components::logger()->longMessage( i18n( "Delete failed" ), + Amarok::Logger::longMessage( i18n( "Delete failed" ), Amarok::Logger::Error ); // return false; @@ -698,9 +698,9 @@ 0, 0 ); debug() << "sent"; -// emit canCopyMoreTracks(); +// Q_EMIT canCopyMoreTracks(); -// emit libCopyTrackDone( srcTrack ); +// Q_EMIT libCopyTrackDone( srcTrack ); return ( ret == 0 ); } @@ -996,7 +996,7 @@ int MtpHandler::libGetYear( const Meta::MediaDeviceTrackPtr &track ) { - return QString::fromUtf8( m_mtpTrackHash.value( track )->date ).mid( 0, 4 ).toUInt(); + return QString::fromUtf8( m_mtpTrackHash.value( track )->date ).midRef( 0, 4 ).toUInt(); } qint64 @@ -1489,7 +1489,7 @@ { if ( job->success() ) { - emit incrementProgress(); + Q_EMIT incrementProgress(); } else { diff --git a/src/core-impl/collections/mtpcollection/handler/capabilities/MtpPlaylistCapability.h b/src/core-impl/collections/mtpcollection/handler/capabilities/MtpPlaylistCapability.h --- a/src/core-impl/collections/mtpcollection/handler/capabilities/MtpPlaylistCapability.h +++ b/src/core-impl/collections/mtpcollection/handler/capabilities/MtpPlaylistCapability.h @@ -32,24 +32,24 @@ Q_OBJECT public: - MtpPlaylistCapability( Meta::MtpHandler *handler ); - - virtual void prepareToParsePlaylists(); - virtual bool isEndOfParsePlaylistsList(); - virtual void prepareToParseNextPlaylist(); - virtual void nextPlaylistToParse(); - virtual bool shouldNotParseNextPlaylist(); - virtual void prepareToParsePlaylistTracks(); - virtual bool isEndOfParsePlaylist(); - virtual void prepareToParseNextPlaylistTrack(); - virtual void nextPlaylistTrackToParse(); + explicit MtpPlaylistCapability( Meta::MtpHandler *handler ); + + void prepareToParsePlaylists() override; + bool isEndOfParsePlaylistsList() override; + void prepareToParseNextPlaylist() override; + void nextPlaylistToParse() override; + bool shouldNotParseNextPlaylist() override; + void prepareToParsePlaylistTracks() override; + bool isEndOfParsePlaylist() override; + void prepareToParseNextPlaylistTrack() override; + void nextPlaylistTrackToParse() override; - virtual void savePlaylist( const Playlists::MediaDevicePlaylistPtr &playlist, const QString& name ); - virtual void deletePlaylist( const Playlists::MediaDevicePlaylistPtr &playlist ); - virtual void renamePlaylist( const Playlists::MediaDevicePlaylistPtr &playlist ); + void savePlaylist( const Playlists::MediaDevicePlaylistPtr &playlist, const QString& name ) override; + void deletePlaylist( const Playlists::MediaDevicePlaylistPtr &playlist ) override; + void renamePlaylist( const Playlists::MediaDevicePlaylistPtr &playlist ) override; - virtual Meta::MediaDeviceTrackPtr libGetTrackPtrForTrackStruct(); - virtual QString libGetPlaylistName(); + Meta::MediaDeviceTrackPtr libGetTrackPtrForTrackStruct() override; + QString libGetPlaylistName() override; private: Meta::MtpHandler *m_handler; diff --git a/src/core-impl/collections/mtpcollection/handler/capabilities/MtpReadCapability.h b/src/core-impl/collections/mtpcollection/handler/capabilities/MtpReadCapability.h --- a/src/core-impl/collections/mtpcollection/handler/capabilities/MtpReadCapability.h +++ b/src/core-impl/collections/mtpcollection/handler/capabilities/MtpReadCapability.h @@ -36,41 +36,41 @@ Q_OBJECT public: - MtpReadCapability( Meta::MtpHandler *handler ); - - virtual void prepareToParseTracks(); - - virtual bool isEndOfParseTracksList(); - - virtual void prepareToParseNextTrack(); - - virtual void nextTrackToParse(); - - virtual void setAssociateTrack( const Meta::MediaDeviceTrackPtr track ); - - virtual QString libGetTitle( const Meta::MediaDeviceTrackPtr &track ); - virtual QString libGetAlbum( const Meta::MediaDeviceTrackPtr &track ); - virtual QString libGetArtist( const Meta::MediaDeviceTrackPtr &track ); - virtual QString libGetAlbumArtist( const Meta::MediaDeviceTrackPtr &track ); - virtual QString libGetComposer( const Meta::MediaDeviceTrackPtr &track ); - virtual QString libGetGenre( const Meta::MediaDeviceTrackPtr &track ); - virtual int libGetYear( const Meta::MediaDeviceTrackPtr &track ); - virtual qint64 libGetLength( const Meta::MediaDeviceTrackPtr &track ); - virtual int libGetTrackNumber( const Meta::MediaDeviceTrackPtr &track ); - virtual QString libGetComment( const Meta::MediaDeviceTrackPtr &track ); - virtual int libGetDiscNumber( const Meta::MediaDeviceTrackPtr &track ); - virtual int libGetBitrate( const Meta::MediaDeviceTrackPtr &track ); - virtual int libGetSamplerate( const Meta::MediaDeviceTrackPtr &track ); - virtual qreal libGetBpm( const Meta::MediaDeviceTrackPtr &track ); - virtual int libGetFileSize( const Meta::MediaDeviceTrackPtr &track ); - virtual int libGetPlayCount( const Meta::MediaDeviceTrackPtr &track ); - virtual QDateTime libGetLastPlayed( const Meta::MediaDeviceTrackPtr &track ); - virtual int libGetRating( const Meta::MediaDeviceTrackPtr &track ); - virtual QString libGetType( const Meta::MediaDeviceTrackPtr &track ); - virtual QUrl libGetPlayableUrl( const Meta::MediaDeviceTrackPtr &track ); - - virtual float usedCapacity() const; - virtual float totalCapacity() const; + explicit MtpReadCapability( Meta::MtpHandler *handler ); + + void prepareToParseTracks() override; + + bool isEndOfParseTracksList() override; + + void prepareToParseNextTrack() override; + + void nextTrackToParse() override; + + void setAssociateTrack( const Meta::MediaDeviceTrackPtr track ) override; + + QString libGetTitle( const Meta::MediaDeviceTrackPtr &track ) override; + QString libGetAlbum( const Meta::MediaDeviceTrackPtr &track ) override; + QString libGetArtist( const Meta::MediaDeviceTrackPtr &track ) override; + QString libGetAlbumArtist( const Meta::MediaDeviceTrackPtr &track ) override; + QString libGetComposer( const Meta::MediaDeviceTrackPtr &track ) override; + QString libGetGenre( const Meta::MediaDeviceTrackPtr &track ) override; + int libGetYear( const Meta::MediaDeviceTrackPtr &track ) override; + qint64 libGetLength( const Meta::MediaDeviceTrackPtr &track ) override; + int libGetTrackNumber( const Meta::MediaDeviceTrackPtr &track ) override; + QString libGetComment( const Meta::MediaDeviceTrackPtr &track ) override; + int libGetDiscNumber( const Meta::MediaDeviceTrackPtr &track ) override; + int libGetBitrate( const Meta::MediaDeviceTrackPtr &track ) override; + int libGetSamplerate( const Meta::MediaDeviceTrackPtr &track ) override; + qreal libGetBpm( const Meta::MediaDeviceTrackPtr &track ) override; + int libGetFileSize( const Meta::MediaDeviceTrackPtr &track ) override; + int libGetPlayCount( const Meta::MediaDeviceTrackPtr &track ) override; + QDateTime libGetLastPlayed( const Meta::MediaDeviceTrackPtr &track ) override; + int libGetRating( const Meta::MediaDeviceTrackPtr &track ) override; + QString libGetType( const Meta::MediaDeviceTrackPtr &track ) override; + QUrl libGetPlayableUrl( const Meta::MediaDeviceTrackPtr &track ) override; + + float usedCapacity() const override; + float totalCapacity() const override; private: QPointer m_handler; diff --git a/src/core-impl/collections/mtpcollection/handler/capabilities/MtpWriteCapability.h b/src/core-impl/collections/mtpcollection/handler/capabilities/MtpWriteCapability.h --- a/src/core-impl/collections/mtpcollection/handler/capabilities/MtpWriteCapability.h +++ b/src/core-impl/collections/mtpcollection/handler/capabilities/MtpWriteCapability.h @@ -31,52 +31,52 @@ { Q_OBJECT public: - MtpWriteCapability( Meta::MtpHandler *handler ); + explicit MtpWriteCapability( Meta::MtpHandler *handler ); - virtual QStringList supportedFormats(); + QStringList supportedFormats() override; - virtual void findPathToCopy( const Meta::TrackPtr &srcTrack, const Meta::MediaDeviceTrackPtr &destTrack ); + void findPathToCopy( const Meta::TrackPtr &srcTrack, const Meta::MediaDeviceTrackPtr &destTrack ) override; - virtual bool libCopyTrack( const Meta::TrackPtr &srcTrack, Meta::MediaDeviceTrackPtr &destTrack ); + bool libCopyTrack( const Meta::TrackPtr &srcTrack, Meta::MediaDeviceTrackPtr &destTrack ) override; - virtual bool libDeleteTrackFile( const Meta::MediaDeviceTrackPtr &track ); + bool libDeleteTrackFile( const Meta::MediaDeviceTrackPtr &track ) override; - virtual void libCreateTrack( const Meta::MediaDeviceTrackPtr &track ); + void libCreateTrack( const Meta::MediaDeviceTrackPtr &track ) override; - virtual void libDeleteTrack( const Meta::MediaDeviceTrackPtr &track ); + void libDeleteTrack( const Meta::MediaDeviceTrackPtr &track ) override; - virtual void addTrackInDB( const Meta::MediaDeviceTrackPtr &track ); + void addTrackInDB( const Meta::MediaDeviceTrackPtr &track ) override; - virtual void removeTrackFromDB( const Meta::MediaDeviceTrackPtr &track ); + void removeTrackFromDB( const Meta::MediaDeviceTrackPtr &track ) override; - virtual void setDatabaseChanged(); + void setDatabaseChanged() override; - virtual void libSetTitle( Meta::MediaDeviceTrackPtr &track, const QString& title ); - virtual void libSetAlbum( Meta::MediaDeviceTrackPtr &track, const QString& album ); - virtual void libSetArtist( Meta::MediaDeviceTrackPtr &track, const QString& artist ); - virtual void libSetAlbumArtist( Meta::MediaDeviceTrackPtr &track, const QString& albumArtist ); - virtual void libSetComposer( Meta::MediaDeviceTrackPtr &track, const QString& composer ); - virtual void libSetGenre( Meta::MediaDeviceTrackPtr &track, const QString& genre ); - virtual void libSetYear( Meta::MediaDeviceTrackPtr &track, const QString& year ); - virtual void libSetLength( Meta::MediaDeviceTrackPtr &track, int length ); - virtual void libSetTrackNumber( Meta::MediaDeviceTrackPtr &track, int tracknum ); - virtual void libSetComment( Meta::MediaDeviceTrackPtr &track, const QString& comment ); - virtual void libSetDiscNumber( Meta::MediaDeviceTrackPtr &track, int discnum ); - virtual void libSetBitrate( Meta::MediaDeviceTrackPtr &track, int bitrate ); - virtual void libSetSamplerate( Meta::MediaDeviceTrackPtr &track, int samplerate ); - virtual void libSetBpm( Meta::MediaDeviceTrackPtr &track, qreal bpm ); - virtual void libSetFileSize( Meta::MediaDeviceTrackPtr &track, int filesize ); - virtual void libSetPlayCount( Meta::MediaDeviceTrackPtr &track, int playcount ); - virtual void libSetLastPlayed( Meta::MediaDeviceTrackPtr &track, const QDateTime &lastplayed ); - virtual void libSetRating( Meta::MediaDeviceTrackPtr &track, int rating ) ; - virtual void libSetType( Meta::MediaDeviceTrackPtr &track, const QString& type ); - virtual void libSetPlayableUrl( Meta::MediaDeviceTrackPtr &destTrack, const Meta::TrackPtr &srcTrack ); - virtual void libSetCoverArt( Meta::MediaDeviceTrackPtr &track, const QImage &cover ); + void libSetTitle( Meta::MediaDeviceTrackPtr &track, const QString& title ) override; + void libSetAlbum( Meta::MediaDeviceTrackPtr &track, const QString& album ) override; + void libSetArtist( Meta::MediaDeviceTrackPtr &track, const QString& artist ) override; + void libSetAlbumArtist( Meta::MediaDeviceTrackPtr &track, const QString& albumArtist ) override; + void libSetComposer( Meta::MediaDeviceTrackPtr &track, const QString& composer ) override; + void libSetGenre( Meta::MediaDeviceTrackPtr &track, const QString& genre ) override; + void libSetYear( Meta::MediaDeviceTrackPtr &track, const QString& year ) override; + void libSetLength( Meta::MediaDeviceTrackPtr &track, int length ) override; + void libSetTrackNumber( Meta::MediaDeviceTrackPtr &track, int tracknum ) override; + void libSetComment( Meta::MediaDeviceTrackPtr &track, const QString& comment ) override; + void libSetDiscNumber( Meta::MediaDeviceTrackPtr &track, int discnum ) override; + void libSetBitrate( Meta::MediaDeviceTrackPtr &track, int bitrate ) override; + void libSetSamplerate( Meta::MediaDeviceTrackPtr &track, int samplerate ) override; + void libSetBpm( Meta::MediaDeviceTrackPtr &track, qreal bpm ) override; + void libSetFileSize( Meta::MediaDeviceTrackPtr &track, int filesize ) override; + void libSetPlayCount( Meta::MediaDeviceTrackPtr &track, int playcount ) override; + void libSetLastPlayed( Meta::MediaDeviceTrackPtr &track, const QDateTime &lastplayed ) override; + void libSetRating( Meta::MediaDeviceTrackPtr &track, int rating ) override; + void libSetType( Meta::MediaDeviceTrackPtr &track, const QString& type ) override; + void libSetPlayableUrl( Meta::MediaDeviceTrackPtr &destTrack, const Meta::TrackPtr &srcTrack ) override; + void libSetCoverArt( Meta::MediaDeviceTrackPtr &track, const QImage &cover ) override; - virtual void prepareToCopy(); - virtual void prepareToDelete(); + void prepareToCopy() override; + void prepareToDelete() override; - virtual void updateTrack( Meta::MediaDeviceTrackPtr &track ); + void updateTrack( Meta::MediaDeviceTrackPtr &track ) override; private: Meta::MtpHandler *m_handler; diff --git a/src/core-impl/collections/mtpcollection/support/MtpConnectionAssistant.h b/src/core-impl/collections/mtpcollection/support/MtpConnectionAssistant.h --- a/src/core-impl/collections/mtpcollection/support/MtpConnectionAssistant.h +++ b/src/core-impl/collections/mtpcollection/support/MtpConnectionAssistant.h @@ -28,8 +28,8 @@ public: virtual ~MtpConnectionAssistant(); - virtual bool identify( const QString& udi ); - virtual MediaDeviceInfo* deviceInfo( const QString& udi ); + bool identify( const QString& udi ) override; + MediaDeviceInfo* deviceInfo( const QString& udi ) override; }; diff --git a/src/core-impl/collections/mtpcollection/support/MtpDeviceInfo.h b/src/core-impl/collections/mtpcollection/support/MtpDeviceInfo.h --- a/src/core-impl/collections/mtpcollection/support/MtpDeviceInfo.h +++ b/src/core-impl/collections/mtpcollection/support/MtpDeviceInfo.h @@ -23,7 +23,7 @@ { Q_OBJECT public: - MtpDeviceInfo( QString udi ); + explicit MtpDeviceInfo(const QString &udi ); ~MtpDeviceInfo(); private: diff --git a/src/core-impl/collections/mtpcollection/support/MtpDeviceInfo.cpp b/src/core-impl/collections/mtpcollection/support/MtpDeviceInfo.cpp --- a/src/core-impl/collections/mtpcollection/support/MtpDeviceInfo.cpp +++ b/src/core-impl/collections/mtpcollection/support/MtpDeviceInfo.cpp @@ -17,7 +17,7 @@ #include "MtpDeviceInfo.h" #include "MediaDeviceInfo.h" -MtpDeviceInfo::MtpDeviceInfo( QString udi ) +MtpDeviceInfo::MtpDeviceInfo( const QString &udi ) : MediaDeviceInfo() { m_udi = udi; diff --git a/src/core-impl/collections/nepomukcollection/CMakeLists.txt b/src/core-impl/collections/nepomukcollection/CMakeLists.txt --- a/src/core-impl/collections/nepomukcollection/CMakeLists.txt +++ b/src/core-impl/collections/nepomukcollection/CMakeLists.txt @@ -41,10 +41,10 @@ ${SOPRANO_LIBRARIES} ) - install(TARGETS amarok_collection-nepomukcollection DESTINATION ${PLUGIN_INSTALL_DIR}) + install(TARGETS amarok_collection-nepomukcollection DESTINATION ${KDE_INSTALL_PLUGINDIR}) ########### install files ############### - install(FILES amarok_collection-nepomukcollection.desktop DESTINATION ${SERVICES_INSTALL_DIR}) + install(FILES amarok_collection-nepomukcollection.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}) endif() diff --git a/src/core-impl/collections/nepomukcollection/NepomukCache.h b/src/core-impl/collections/nepomukcollection/NepomukCache.h --- a/src/core-impl/collections/nepomukcollection/NepomukCache.h +++ b/src/core-impl/collections/nepomukcollection/NepomukCache.h @@ -59,7 +59,7 @@ NepomukCachePrivate *d; - NepomukCache( NepomukCollection *parent ); + explicit NepomukCache( NepomukCollection *parent ); ~NepomukCache(); friend class NepomukCollection; diff --git a/src/core-impl/collections/nepomukcollection/NepomukCollectionFactory.cpp b/src/core-impl/collections/nepomukcollection/NepomukCollectionFactory.cpp --- a/src/core-impl/collections/nepomukcollection/NepomukCollectionFactory.cpp +++ b/src/core-impl/collections/nepomukcollection/NepomukCollectionFactory.cpp @@ -19,7 +19,7 @@ #include "NepomukCollection.h" #include "NepomukCollectionFactory.h" -#include "core/interfaces/Logger.h" +#include "core/logger/Logger.h" #include "core/support/Components.h" #include "core/support/Debug.h" @@ -44,7 +44,7 @@ "Check if 'Nepomuk Semantic Desktop' is enabled in System Settings -> Desktop Search. " "Nepomuk Plugin won't be loaded unless Nepomuk is enabled."; - Amarok::Components::logger()->longMessage( + Amarok::Logger::longMessage( i18n( "Couldn't initialize Nepomuk Collection. " "Check if 'Nepomuk Semantic Desktop' is enabled in System Settings -> Desktop Search. " "Nepomuk Plugin won't be loaded unless Nepomuk is enabled." ), diff --git a/src/core-impl/collections/nepomukcollection/NepomukInquirer.h b/src/core-impl/collections/nepomukcollection/NepomukInquirer.h --- a/src/core-impl/collections/nepomukcollection/NepomukInquirer.h +++ b/src/core-impl/collections/nepomukcollection/NepomukInquirer.h @@ -51,9 +51,9 @@ void failed(ThreadWeaver::JobPointer); protected: - void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; - void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; - void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) Q_DECL_OVERRIDE; + void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; + void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; + void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) override; private: QString m_query; diff --git a/src/core-impl/collections/nepomukcollection/NepomukParser.h b/src/core-impl/collections/nepomukcollection/NepomukParser.h --- a/src/core-impl/collections/nepomukcollection/NepomukParser.h +++ b/src/core-impl/collections/nepomukcollection/NepomukParser.h @@ -53,10 +53,10 @@ * * @param coll must be a valid NepomukCollection */ - NepomukParser( NepomukCollection *coll ); + explicit NepomukParser( NepomukCollection *coll ); /** - * Parse all the query results in the given QueryResultIterator and emit + * Parse all the query results in the given QueryResultIterator and Q_EMIT * newResultReady with the constructed objects. */ virtual void parse( Soprano::QueryResultIterator& ) = 0; @@ -102,7 +102,7 @@ while( queryResult.next() ) parseOne( queryResult, result ); - emit newResultReady( result ); + Q_EMIT newResultReady( result ); } }; diff --git a/src/core-impl/collections/nepomukcollection/amarok_collection-nepomukcollection.desktop b/src/core-impl/collections/nepomukcollection/amarok_collection-nepomukcollection.desktop --- a/src/core-impl/collections/nepomukcollection/amarok_collection-nepomukcollection.desktop +++ b/src/core-impl/collections/nepomukcollection/amarok_collection-nepomukcollection.desktop @@ -54,7 +54,6 @@ Name[uk]=Збірка Nepomuk Name[wa]=Ramexhnêye Nepomuk Name[x-test]=xxNepomuk Collectionxx -Name[zh_CN]=Nepomuk 收藏 Name[zh_TW]=Nepomuk 收藏 diff --git a/src/core-impl/collections/nepomukcollection/meta/NepomukGenre.h b/src/core-impl/collections/nepomukcollection/meta/NepomukGenre.h --- a/src/core-impl/collections/nepomukcollection/meta/NepomukGenre.h +++ b/src/core-impl/collections/nepomukcollection/meta/NepomukGenre.h @@ -27,7 +27,7 @@ class NepomukGenre : public Genre { public: - NepomukGenre( const QString &name ); + explicit NepomukGenre( const QString &name ); virtual TrackList tracks(); virtual QString name() const; diff --git a/src/core-impl/collections/nepomukcollection/meta/NepomukTrack.h b/src/core-impl/collections/nepomukcollection/meta/NepomukTrack.h --- a/src/core-impl/collections/nepomukcollection/meta/NepomukTrack.h +++ b/src/core-impl/collections/nepomukcollection/meta/NepomukTrack.h @@ -39,7 +39,7 @@ { public: // construct a NepomukTrack out of a Nepomuk resource - NepomukTrack( const QUrl &resUri, Collections::NepomukCollection *coll = 0 ); + explicit NepomukTrack( const QUrl &resUri, Collections::NepomukCollection *coll = 0 ); ~NepomukTrack(); virtual QString name() const; diff --git a/src/core-impl/collections/nepomukcollection/meta/NepomukYear.h b/src/core-impl/collections/nepomukcollection/meta/NepomukYear.h --- a/src/core-impl/collections/nepomukcollection/meta/NepomukYear.h +++ b/src/core-impl/collections/nepomukcollection/meta/NepomukYear.h @@ -26,7 +26,7 @@ class NepomukYear : public Year { public: - NepomukYear( int yearValue ); + explicit NepomukYear( int yearValue ); virtual TrackList tracks(); virtual QString name() const; diff --git a/src/core-impl/collections/playdarcollection/CMakeLists.txt b/src/core-impl/collections/playdarcollection/CMakeLists.txt --- a/src/core-impl/collections/playdarcollection/CMakeLists.txt +++ b/src/core-impl/collections/playdarcollection/CMakeLists.txt @@ -1,5 +1,3 @@ -include_directories( ${QJSON_INCLUDE_DIR} ) - set( amarok_collection-playdarcollection_PART_SRCS PlaydarMeta.cpp PlaydarCollection.cpp @@ -14,11 +12,10 @@ target_link_libraries( amarok_collection-playdarcollection amarokcore amaroklib - ${QJSON_LIBRARIES} KF5::ThreadWeaver KF5::KIOCore ) -install(TARGETS amarok_collection-playdarcollection DESTINATION ${PLUGIN_INSTALL_DIR} ) +install(TARGETS amarok_collection-playdarcollection DESTINATION ${KDE_INSTALL_PLUGINDIR} ) kcoreaddons_desktop_to_json(amarok_collection-playdarcollection amarok_collection-playdarcollection.desktop SERVICE_TYPES ${CMAKE_SOURCE_DIR}/src/amarok-plugin.desktop) diff --git a/src/core-impl/collections/playdarcollection/PlaydarCollection.h b/src/core-impl/collections/playdarcollection/PlaydarCollection.h --- a/src/core-impl/collections/playdarcollection/PlaydarCollection.h +++ b/src/core-impl/collections/playdarcollection/PlaydarCollection.h @@ -30,6 +30,14 @@ #include #include +namespace Playlists +{ +class UserPlaylistProvider; +} +namespace Playdar +{ +class ProxyResolver; +} namespace Collections { @@ -45,7 +53,7 @@ PlaydarCollectionFactory(); virtual ~PlaydarCollectionFactory(); - virtual void init(); + void init() override; private Q_SLOTS: void checkStatus(); @@ -67,24 +75,24 @@ PlaydarCollection(); ~PlaydarCollection(); - QueryMaker* queryMaker(); + QueryMaker* queryMaker() override; Playlists::UserPlaylistProvider* userPlaylistProvider(); - QString uidUrlProtocol() const; - QString collectionId() const; - QString prettyName() const; - QIcon icon() const; + QString uidUrlProtocol() const override; + QString collectionId() const override; + QString prettyName() const override; + QIcon icon() const override; - bool isWritable() const; - bool isOrganizable() const; + bool isWritable() const override; + bool isOrganizable() const override; //Methods from Collections::TrackProvider - bool possiblyContainsTrack( const QUrl &url ) const; - Meta::TrackPtr trackForUrl( const QUrl &url ); + bool possiblyContainsTrack( const QUrl &url ) const override; + Meta::TrackPtr trackForUrl( const QUrl &url ) override; //Methods from Collections::CollectionBase - bool hasCapabilityInterface( Capabilities::Capability::Type type ) const; - Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ); + bool hasCapabilityInterface( Capabilities::Capability::Type type ) const override; + Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ) override; //PlaydarCollection-specific void addNewTrack( Meta::PlaydarTrackPtr track ); diff --git a/src/core-impl/collections/playdarcollection/PlaydarCollection.cpp b/src/core-impl/collections/playdarcollection/PlaydarCollection.cpp --- a/src/core-impl/collections/playdarcollection/PlaydarCollection.cpp +++ b/src/core-impl/collections/playdarcollection/PlaydarCollection.cpp @@ -49,16 +49,15 @@ PlaydarCollectionFactory::~PlaydarCollectionFactory() { DEBUG_BLOCK - CollectionManager::instance()->removeTrackProvider( m_collection.data() ); delete m_collection.data(); delete m_controller; } void PlaydarCollectionFactory::init() { DEBUG_BLOCK - m_controller = new Playdar::Controller( this ); + m_controller = new Playdar::Controller; connect( m_controller, &Playdar::Controller::playdarReady, this, &PlaydarCollectionFactory::playdarReady ); connect( m_controller, &Playdar::Controller::playdarError, @@ -93,7 +92,7 @@ if( !m_collectionIsManaged ) { m_collectionIsManaged = true; - emit newCollection( m_collection.data() ); + Q_EMIT newCollection( m_collection.data() ); } } @@ -150,13 +149,13 @@ { DEBUG_BLOCK - return 0; + return nullptr; } QString PlaydarCollection::uidUrlProtocol() const { - return QString( "playdar" ); + return QStringLiteral( "playdar" ); } QString @@ -353,7 +352,7 @@ } m_memoryCollection->releaseLock(); - emit updated(); + Q_EMIT updated(); } else m_memoryCollection->releaseLock(); @@ -369,6 +368,6 @@ PlaydarCollection::slotPlaydarError( Playdar::Controller::ErrorState error ) { if( error == Playdar::Controller::ErrorState( 1 ) ) - emit remove(); + Q_EMIT remove(); } } diff --git a/src/core-impl/collections/playdarcollection/PlaydarMeta.h b/src/core-impl/collections/playdarcollection/PlaydarMeta.h --- a/src/core-impl/collections/playdarcollection/PlaydarMeta.h +++ b/src/core-impl/collections/playdarcollection/PlaydarMeta.h @@ -72,56 +72,56 @@ int bitrate, int filesize, QString &source ); - ~PlaydarTrack(); + ~PlaydarTrack() override; - QString name() const; - QUrl playableUrl() const; - QString prettyUrl() const; - QString uidUrl() const; + QString name() const override; + QUrl playableUrl() const override; + QString prettyUrl() const override; + QString uidUrl() const override; QString sid() const; - QString notPlayableReason() const; - - AlbumPtr album() const; - ArtistPtr artist() const; - ComposerPtr composer() const; - GenrePtr genre() const; - YearPtr year() const; - LabelList labels() const; - qreal bpm() const; - QString comment() const; + QString notPlayableReason() const override; + + AlbumPtr album() const override; + ArtistPtr artist() const override; + ComposerPtr composer() const override; + GenrePtr genre() const override; + YearPtr year() const override; + LabelList labels() const override; + qreal bpm() const override; + QString comment() const override; double score() const; - qint64 length() const; - int filesize() const; - int sampleRate() const; - int bitrate() const; - QDateTime createDate() const; - int trackNumber() const; - int discNumber() const; + qint64 length() const override; + int filesize() const override; + int sampleRate() const override; + int bitrate() const override; + QDateTime createDate() const override; + int trackNumber() const override; + int discNumber() const override; - QString type() const; + QString type() const override; - bool inCollection() const; - Collections::Collection* collection() const; + bool inCollection() const override; + Collections::Collection* collection() const override; - QString cachedLyrics() const; - void setCachedLyrics( const QString &lyrics ); + QString cachedLyrics() const override; + void setCachedLyrics( const QString &lyrics ) override; - void addLabel( const QString &label ); - void addLabel( const LabelPtr &label ); - void removeLabel( const LabelPtr &label ); + void addLabel( const QString &label ) override; + void addLabel( const LabelPtr &label ) override; + void removeLabel( const LabelPtr &label ) override; - StatisticsPtr statistics(); + StatisticsPtr statistics() override; //PlaydarTrack-specific: QString source() const; QString mimetype() const; void addToCollection( Collections::PlaydarCollection *collection ); - void setAlbum( PlaydarAlbumPtr album ); - void setArtist( PlaydarArtistPtr artist ); - void setComposer( PlaydarComposerPtr composer ); - void setGenre( PlaydarGenrePtr genre ); - void setYear( PlaydarYearPtr year ); + void setAlbum( const PlaydarAlbumPtr &album ); + void setArtist( const PlaydarArtistPtr &artist ); + void setComposer( const PlaydarComposerPtr &composer ); + void setGenre( const PlaydarGenrePtr &genre ); + void setYear( const PlaydarYearPtr &year ); PlaydarAlbumPtr playdarAlbum(); PlaydarArtistPtr playdarArtist(); @@ -161,16 +161,16 @@ class PlaydarArtist : public Artist { public: - PlaydarArtist( const QString &name ); + explicit PlaydarArtist( const QString &name ); ~PlaydarArtist(); - QString name() const; + QString name() const override; - TrackList tracks(); + TrackList tracks() override; AlbumList albums(); - void addTrack( PlaydarTrackPtr newTrack ); - void addAlbum( PlaydarAlbumPtr newAlbum ); + void addTrack( const PlaydarTrackPtr &newTrack ); + void addAlbum( const PlaydarAlbumPtr &newAlbum ); private: QString m_name; @@ -181,26 +181,26 @@ class PlaydarAlbum : public Album { public: - PlaydarAlbum( const QString &name ); + explicit PlaydarAlbum( const QString &name ); ~PlaydarAlbum(); - bool isCompilation() const; + bool isCompilation() const override; - QString name() const; + QString name() const override; - bool hasAlbumArtist() const; - ArtistPtr albumArtist() const; - TrackList tracks(); - bool hasImage( int size = 0 ) const; - QImage image( int size = 0 ) const; - QUrl imageLocation( int size = 0 ); - bool canUpdateImage() const; - void setImage( const QImage &image ); - void removeImage(); - void setSuppressImageAutoFetch( const bool suppress ); - bool suppressImageAutoFetch() const; - - void addTrack( PlaydarTrackPtr newTrack ); - void setAlbumArtist( PlaydarArtistPtr newAlbumArtist ); + bool hasAlbumArtist() const override; + ArtistPtr albumArtist() const override; + TrackList tracks() override; + bool hasImage( int size = 0 ) const override; + QImage image( int size = 0 ) const override; + QUrl imageLocation( int size = 0 ) override; + bool canUpdateImage() const override; + void setImage( const QImage &image ) override; + void removeImage() override; + void setSuppressImageAutoFetch( const bool suppress ) override; + bool suppressImageAutoFetch() const override; + + void addTrack( const PlaydarTrackPtr &newTrack ); + void setAlbumArtist( const PlaydarArtistPtr &newAlbumArtist ); private: QString m_name; @@ -215,14 +215,14 @@ class PlaydarComposer : public Composer { public: - PlaydarComposer( const QString &name ); + explicit PlaydarComposer( const QString &name ); ~PlaydarComposer(); - QString name() const; + QString name() const override; - TrackList tracks(); + TrackList tracks() override; - void addTrack( PlaydarTrackPtr newTrack ); + void addTrack( const PlaydarTrackPtr &newTrack ); private: QString m_name; @@ -232,14 +232,14 @@ class PlaydarGenre : public Genre { public: - PlaydarGenre( const QString &name ); + explicit PlaydarGenre( const QString &name ); ~PlaydarGenre(); - QString name() const; + QString name() const override; - TrackList tracks(); + TrackList tracks() override; - void addTrack( PlaydarTrackPtr newTrack ); + void addTrack( const PlaydarTrackPtr &newTrack ); private: QString m_name; @@ -249,14 +249,14 @@ class PlaydarYear : public Year { public: - PlaydarYear( const QString &name ); + explicit PlaydarYear( const QString &name ); ~PlaydarYear(); - QString name() const; + QString name() const override; - TrackList tracks(); + TrackList tracks() override; - void addTrack( PlaydarTrackPtr newTrack ); + void addTrack( const PlaydarTrackPtr &newTrack ); private: QString m_name; @@ -266,12 +266,12 @@ class PlaydarLabel : public Label { public: - PlaydarLabel( const QString &name ); + explicit PlaydarLabel( const QString &name ); ~PlaydarLabel(); - QString name() const; + QString name() const override; - void addTrack( PlaydarTrackPtr newTrack ); + void addTrack( const PlaydarTrackPtr &newTrack ); private: QString m_name; diff --git a/src/core-impl/collections/playdarcollection/PlaydarMeta.cpp b/src/core-impl/collections/playdarcollection/PlaydarMeta.cpp --- a/src/core-impl/collections/playdarcollection/PlaydarMeta.cpp +++ b/src/core-impl/collections/playdarcollection/PlaydarMeta.cpp @@ -71,11 +71,11 @@ , m_source( source ) { QUrlQuery query; - m_uidUrl.setScheme( QString( "playdar" ) ); - m_uidUrl.setPath(m_uidUrl.path() + '/' + source ); - query.addQueryItem( QString( "artist" ), artist ); - query.addQueryItem( QString( "album" ), album ); - query.addQueryItem( QString( "title" ), name ); + m_uidUrl.setScheme( QStringLiteral( "playdar" ) ); + m_uidUrl.setPath(m_uidUrl.path() + QLatin1Char('/') + source ); + query.addQueryItem( QStringLiteral( "artist" ), artist ); + query.addQueryItem( QStringLiteral( "album" ), album ); + query.addQueryItem( QStringLiteral( "title" ), name ); m_uidUrl.setQuery( query ); m_statsStore = new UrlStatisticsStore( this ); } @@ -229,7 +229,7 @@ QString Meta::PlaydarTrack::type() const { - return QString( "stream" ); + return QStringLiteral( "stream" ); } QString @@ -253,7 +253,7 @@ QString Meta::PlaydarTrack::cachedLyrics() const { - return QString( "" ); + return QStringLiteral( "" ); } void @@ -315,31 +315,31 @@ } void -Meta::PlaydarTrack::setAlbum( PlaydarAlbumPtr album ) +Meta::PlaydarTrack::setAlbum( const PlaydarAlbumPtr &album ) { m_album = album; } void -Meta::PlaydarTrack::setArtist( PlaydarArtistPtr artist ) +Meta::PlaydarTrack::setArtist( const PlaydarArtistPtr &artist ) { m_artist = artist; } void -Meta::PlaydarTrack::setComposer( PlaydarComposerPtr composer ) +Meta::PlaydarTrack::setComposer( const PlaydarComposerPtr &composer ) { m_composer = composer; } void -Meta::PlaydarTrack::setGenre( PlaydarGenrePtr genre ) +Meta::PlaydarTrack::setGenre( const PlaydarGenrePtr &genre ) { m_genre = genre; } void -Meta::PlaydarTrack::setYear( PlaydarYearPtr year ) +Meta::PlaydarTrack::setYear( const PlaydarYearPtr &year ) { m_year = year; } @@ -412,13 +412,13 @@ } void -Meta::PlaydarArtist::addTrack( PlaydarTrackPtr newTrack ) +Meta::PlaydarArtist::addTrack( const PlaydarTrackPtr &newTrack ) { m_tracks.append( TrackPtr::staticCast( newTrack ) ); } void -Meta::PlaydarArtist::addAlbum( PlaydarAlbumPtr newAlbum ) +Meta::PlaydarArtist::addAlbum( const PlaydarAlbumPtr &newAlbum ) { m_albums.append( AlbumPtr::staticCast( newAlbum ) ); } @@ -543,13 +543,13 @@ } void -Meta::PlaydarAlbum::addTrack( PlaydarTrackPtr newTrack ) +Meta::PlaydarAlbum::addTrack( const PlaydarTrackPtr &newTrack ) { m_tracks.append( TrackPtr::staticCast( newTrack ) ); } void -Meta::PlaydarAlbum::setAlbumArtist( PlaydarArtistPtr newArtist ) +Meta::PlaydarAlbum::setAlbumArtist( const PlaydarArtistPtr &newArtist ) { m_albumArtist = ArtistPtr::staticCast( newArtist ); } @@ -579,7 +579,7 @@ } void -Meta::PlaydarComposer::addTrack( PlaydarTrackPtr newTrack ) +Meta::PlaydarComposer::addTrack( const PlaydarTrackPtr &newTrack ) { m_tracks.append( Meta::TrackPtr::staticCast( newTrack ) ); } @@ -609,7 +609,7 @@ } void -Meta::PlaydarGenre::addTrack( PlaydarTrackPtr newTrack ) +Meta::PlaydarGenre::addTrack( const PlaydarTrackPtr &newTrack ) { m_tracks.append( Meta::TrackPtr::staticCast( newTrack ) ); } @@ -639,7 +639,7 @@ } void -Meta::PlaydarYear::addTrack( PlaydarTrackPtr newTrack ) +Meta::PlaydarYear::addTrack( const PlaydarTrackPtr &newTrack ) { m_tracks.append( Meta::TrackPtr::staticCast( newTrack ) ); } @@ -663,7 +663,7 @@ } void -Meta::PlaydarLabel::addTrack( PlaydarTrackPtr newTrack ) +Meta::PlaydarLabel::addTrack( const PlaydarTrackPtr &newTrack ) { m_tracks.append( Meta::TrackPtr::staticCast( newTrack ) ); } diff --git a/src/core-impl/collections/playdarcollection/PlaydarQueryMaker.h b/src/core-impl/collections/playdarcollection/PlaydarQueryMaker.h --- a/src/core-impl/collections/playdarcollection/PlaydarQueryMaker.h +++ b/src/core-impl/collections/playdarcollection/PlaydarQueryMaker.h @@ -34,60 +34,59 @@ namespace Collections { - class QueryMakerFunction; class PlaydarQueryMaker : public QueryMaker { Q_OBJECT public: - PlaydarQueryMaker( PlaydarCollection *collection ); - ~PlaydarQueryMaker(); - - void run(); - void abortQuery(); - - QueryMaker* setQueryType( QueryType type ); - QueryMaker* addReturnValue( qint64 value ); - QueryMaker* addReturnFunction( ReturnFunction function, qint64 value ); - QueryMaker* orderBy( qint64 value, bool descending = false ); - - QueryMaker* addMatch( const Meta::TrackPtr &track ); - QueryMaker* addMatch( const Meta::ArtistPtr &artist, ArtistMatchBehaviour behaviour = TrackArtists ); - QueryMaker* addMatch( const Meta::AlbumPtr &album ); - QueryMaker* addMatch( const Meta::ComposerPtr &composer ); - QueryMaker* addMatch( const Meta::GenrePtr &genre ); - QueryMaker* addMatch( const Meta::YearPtr &year ); - QueryMaker* addMatch( const Meta::LabelPtr &label ); - - QueryMaker* addFilter( qint64 value, const QString &filter, bool matchBegin = false, bool matchEnd = false ); - QueryMaker* excludeFilter( qint64 value, const QString &filter, bool matchBegin = false, bool matchEnd = false ); + explicit PlaydarQueryMaker( PlaydarCollection *collection ); + ~PlaydarQueryMaker() override; + + void run() override; + void abortQuery() override; + + QueryMaker* setQueryType( QueryType type ) override; + QueryMaker* addReturnValue( qint64 value ) override; + QueryMaker* addReturnFunction( ReturnFunction function, qint64 value ) override; + QueryMaker* orderBy( qint64 value, bool descending = false ) override; + + QueryMaker* addMatch( const Meta::TrackPtr &track ) override; + QueryMaker* addMatch( const Meta::ArtistPtr &artist, ArtistMatchBehaviour behaviour = TrackArtists ) override; + QueryMaker* addMatch( const Meta::AlbumPtr &album ) override; + QueryMaker* addMatch( const Meta::ComposerPtr &composer ) override; + QueryMaker* addMatch( const Meta::GenrePtr &genre ) override; + QueryMaker* addMatch( const Meta::YearPtr &year ) override; + QueryMaker* addMatch( const Meta::LabelPtr &label ) override; + + QueryMaker* addFilter( qint64 value, const QString &filter, bool matchBegin = false, bool matchEnd = false ) override; + QueryMaker* excludeFilter( qint64 value, const QString &filter, bool matchBegin = false, bool matchEnd = false ) override; - QueryMaker* addNumberFilter( qint64 value, qint64 filter, NumberComparison compare ); - QueryMaker* excludeNumberFilter( qint64 value, qint64 filter, NumberComparison compare ); + QueryMaker* addNumberFilter( qint64 value, qint64 filter, NumberComparison compare ) override; + QueryMaker* excludeNumberFilter( qint64 value, qint64 filter, NumberComparison compare ) override; - QueryMaker* limitMaxResultSize( int size ); + QueryMaker* limitMaxResultSize( int size ) override; - QueryMaker* setAlbumQueryMode( AlbumQueryMode mode ); + QueryMaker* setAlbumQueryMode( AlbumQueryMode mode ) override; - QueryMaker* setLabelQueryMode( LabelQueryMode mode ); + QueryMaker* setLabelQueryMode( LabelQueryMode mode ) override; - QueryMaker* beginAnd(); - QueryMaker* beginOr(); - QueryMaker* endAndOr(); + QueryMaker* beginAnd() override; + QueryMaker* beginOr() override; + QueryMaker* endAndOr() override; QueryMaker* setAutoDelete( bool autoDelete ); - int validFilterMask(); + int validFilterMask() override; Q_SIGNALS: - void newTracksReady( Meta::TrackList ); - void newArtistsReady( Meta::ArtistList ); - void newAlbumsReady( Meta::AlbumList ); - void newGenresReady( Meta::GenreList ); - void newComposersReady( Meta::ComposerList ); - void newYearsReady( Meta::YearList ); - void newResultReady( QStringList ); - void newLabelsReady( Meta::LabelList ); + void newTracksReady( const Meta::TrackList& ); + void newArtistsReady( const Meta::ArtistList& ); + void newAlbumsReady( const Meta::AlbumList& ); + void newGenresReady( const Meta::GenreList& ); + void newComposersReady(const Meta::ComposerList& ); + void newYearsReady( const Meta::YearList& ); + void newResultReady( const QStringList &); + void newLabelsReady( const Meta::LabelList& ); void queryDone(); diff --git a/src/core-impl/collections/playdarcollection/PlaydarQueryMaker.cpp b/src/core-impl/collections/playdarcollection/PlaydarQueryMaker.cpp --- a/src/core-impl/collections/playdarcollection/PlaydarQueryMaker.cpp +++ b/src/core-impl/collections/playdarcollection/PlaydarQueryMaker.cpp @@ -484,7 +484,7 @@ { DEBUG_BLOCK - emit playdarError( error ); + Q_EMIT playdarError( error ); } void @@ -528,7 +528,7 @@ } else { - emit queryDone(); + Q_EMIT queryDone(); if( m_autoDelete ) deleteLater(); } @@ -545,7 +545,7 @@ if( m_activeQueryCount <= 0 ) { - emit queryDone(); + Q_EMIT queryDone(); if( m_autoDelete ) deleteLater(); } diff --git a/src/core-impl/collections/playdarcollection/amarok_collection-playdarcollection.desktop b/src/core-impl/collections/playdarcollection/amarok_collection-playdarcollection.desktop --- a/src/core-impl/collections/playdarcollection/amarok_collection-playdarcollection.desktop +++ b/src/core-impl/collections/playdarcollection/amarok_collection-playdarcollection.desktop @@ -23,6 +23,7 @@ Name[it]=Collezione Playdar Name[ja]=Playdar コレクション Name[km]=សម្រាំង Playdar +Name[ko]=Playdar 모음집 Name[lt]=Playdar fonoteka Name[lv]=Playdar kolekcija Name[nb]=Playdar-samling @@ -43,7 +44,6 @@ Name[tr]=Playdar Koleksiyonu Name[uk]=Збірка Playdar Name[x-test]=xxPlaydar Collectionxx -Name[zh_CN]=Playdar 收藏 Name[zh_TW]=Playdar 收藏 Comment=Music that Playdar can find Comment[bg]=Музика откривана с Playdar @@ -63,10 +63,11 @@ Comment[ga]=Ceol is féidir le Playdar aimsiú Comment[gl]=Música que pode atopar Playdar Comment[hu]=A Playdar által található zenék -Comment[id]=Musik Playdar itu dapat dicari +Comment[id]=Musik yang Playdar bisa temukan Comment[it]=Musica che Playdar può trovare Comment[ja]=Playdar が見つけることのできる音楽 Comment[km]=តន្ត្រី​ដែល​ Playdar អាច​រក​ឃើញ +Comment[ko]=Playdar에서 찾을 수 있는 음악 Comment[lt]=Muziką, kurią gali rasti Playdar Comment[lv]=Mūzika, ko atrod Playdar Comment[nb]=Musikk som Playdar kan finne @@ -87,10 +88,9 @@ Comment[tr]=Playdar'ın bulabileceği müzik Comment[uk]=Музика, яку може знайти Playdar Comment[x-test]=xxMusic that Playdar can findxx -Comment[zh_CN]=Playdar 可找到的音乐 Comment[zh_TW]=Playdar 可以找到的音樂 -ServiceTypes=Amarok/Plugin-disabled +ServiceTypes=Amarok/Plugin X-KDE-Amarok-authors=Andrew Coder X-KDE-Amarok-email=andrew.coder@gmail.com diff --git a/src/core-impl/collections/playdarcollection/support/Controller.h b/src/core-impl/collections/playdarcollection/support/Controller.h --- a/src/core-impl/collections/playdarcollection/support/Controller.h +++ b/src/core-impl/collections/playdarcollection/support/Controller.h @@ -32,7 +32,6 @@ namespace Playdar { class Query; - class ProxyResolver; /** * This class provides a basic interface to Playdar's resolution @@ -50,12 +49,12 @@ public: /** * We invoke the private function status() here, return immediately, - * and will emit playdarReady() once things are actually set up. + * and will Q_EMIT playdarReady() once things are actually set up. * @param queriesShouldWaitForSolutions * If true, Playdar::Queries created by this controller will * only use getResultsLongPoll instead of first using getResults. */ - Controller( bool queriesShouldWaitForSolutions = false ); + explicit Controller( bool queriesShouldWaitForSolutions = false ); /** * Controllers don't hold on to anything, so the deconstructor does nothing. */ diff --git a/src/core-impl/collections/playdarcollection/support/Controller.cpp b/src/core-impl/collections/playdarcollection/support/Controller.cpp --- a/src/core-impl/collections/playdarcollection/support/Controller.cpp +++ b/src/core-impl/collections/playdarcollection/support/Controller.cpp @@ -21,17 +21,19 @@ #include "Query.h" #include "core/support/Debug.h" -#include - -#include - +#include +#include +#include #include #include #include #include #include #include +#include + + namespace Playdar { Controller::Controller( bool queriesShouldWaitForSolutions ) @@ -110,7 +112,7 @@ QUrl playableUrl( baseUrl ); playableUrl = playableUrl.adjusted(QUrl::StripTrailingSlash); - playableUrl.setPath(playableUrl.path() + '/' + ( sid )); + playableUrl.setPath(playableUrl.path() + QLatin1Char('/') + ( sid )); return playableUrl; } @@ -132,39 +134,42 @@ { if( statusJob->error() != 0 ) { // debug() << "Error getting status from Playdar"; - emit playdarError( Playdar::Controller::ErrorState( ExternalError ) ); + Q_EMIT playdarError( Playdar::Controller::ErrorState( ExternalError ) ); return; } debug() << "Processing received JSON data..."; KIO::StoredTransferJob* storedStatusJob = static_cast( statusJob ); - QVariant parsedStatusVariant; - - QJson::Parser parser; - bool ok; - parsedStatusVariant = parser.parse( storedStatusJob->data(),&ok ); - if ( !ok ) + QJsonParseError err; + auto doc = QJsonDocument::fromJson( storedStatusJob->data(), &err ); + + if ( err.error != QJsonParseError::NoError ) + debug() << "Error parsing JSON Data:" << err.errorString(); + + if( !doc.isObject() ) { - debug() << "Error parsing JSON Data"; + debug() << "Parsed Json data is not an object"; + return; } - QVariantMap parsedStatus = parsedStatusVariant.toMap(); + + auto object = doc.object(); - if( !parsedStatus.contains("name") ) + if( !object.contains("name") ) { debug() << "Expected a service name from Playdar, received none"; - emit playdarError( Playdar::Controller::ErrorState( MissingServiceName ) ); + Q_EMIT playdarError( Playdar::Controller::ErrorState( MissingServiceName ) ); return; } - if( parsedStatus.value("name") != QString( "playdar" ) ) + if( object.value("name").toString() != QStringLiteral( "playdar" ) ) { debug() << "Expected Playdar, got response from some other service"; - emit playdarError( Playdar::Controller::ErrorState( WrongServiceName ) ); + Q_EMIT playdarError( Playdar::Controller::ErrorState( WrongServiceName ) ); return; } debug() << "All good! Emitting playdarReady()"; - emit playdarReady(); + Q_EMIT playdarReady(); } void @@ -175,35 +180,39 @@ if( queryJob->error() != 0 ) { debug() << "Error getting qid from Playdar"; - emit playdarError( Playdar::Controller::ErrorState( ExternalError ) ); + Q_EMIT playdarError( Playdar::Controller::ErrorState( ExternalError ) ); return; } debug() << "Processing received JSON data..."; KIO::StoredTransferJob* storedQueryJob = static_cast( queryJob ); - QVariant parsedQueryVariant; - QJson::Parser parser; - bool ok; - parsedQueryVariant = parser.parse( storedQueryJob->data(),&ok ); - if ( !ok ) + QJsonParseError err; + auto doc = QJsonDocument::fromJson( storedQueryJob->data(), &err ); + + if ( err.error != QJsonParseError::NoError ) + debug() << "Error parsing JSON Data:" << err.errorString(); + + if( !doc.isObject() ) { - debug() << "Error parsing JSON Data"; + debug() << "Parsed Json data is not an object"; + return; } - - QVariantMap parsedQuery = parsedQueryVariant.toMap(); - if( !parsedQuery.contains( "qid" ) ) + + auto object = doc.object(); + + if( !object.contains( "qid" ) ) { debug() << "Expected qid in Playdar's response, but didn't get it"; - emit playdarError( Playdar::Controller::ErrorState( MissingQid ) ); + Q_EMIT playdarError( Playdar::Controller::ErrorState( MissingQid ) ); return; } - Query* query = new Query( parsedQuery.value( "qid" ).toString(), this, m_queriesShouldWaitForSolutions ); + Query* query = new Query( object.value( "qid" ).toString(), this, m_queriesShouldWaitForSolutions ); debug() << "All good! Emitting queryReady( Playdar::Query* )..."; - emit queryReady( query ); + Q_EMIT queryReady( query ); connect( query, &Query::playdarError, this, &Controller::playdarError ); } diff --git a/src/core-impl/collections/playdarcollection/support/ProxyResolver.h b/src/core-impl/collections/playdarcollection/support/ProxyResolver.h --- a/src/core-impl/collections/playdarcollection/support/ProxyResolver.h +++ b/src/core-impl/collections/playdarcollection/support/ProxyResolver.h @@ -38,7 +38,7 @@ public: ProxyResolver( Collections::PlaydarCollection *collection, - const QUrl &url, MetaProxy::TrackPtr track ); + const QUrl &url, const MetaProxy::TrackPtr &track ); ~ProxyResolver(); Q_SIGNALS: diff --git a/src/core-impl/collections/playdarcollection/support/ProxyResolver.cpp b/src/core-impl/collections/playdarcollection/support/ProxyResolver.cpp --- a/src/core-impl/collections/playdarcollection/support/ProxyResolver.cpp +++ b/src/core-impl/collections/playdarcollection/support/ProxyResolver.cpp @@ -26,7 +26,7 @@ #include Playdar::ProxyResolver::ProxyResolver( Collections::PlaydarCollection *collection, - const QUrl &url, MetaProxy::TrackPtr track ) + const QUrl &url, const MetaProxy::TrackPtr &track ) : m_collection( collection ) , m_proxyTrack( track ) , m_controller( new Playdar::Controller( true ) ) @@ -50,7 +50,7 @@ void Playdar::ProxyResolver::slotPlaydarError( Playdar::Controller::ErrorState error ) { - emit playdarError( error ); + Q_EMIT playdarError( error ); this->deleteLater(); } diff --git a/src/core-impl/collections/playdarcollection/support/QMFunctionTypes.h b/src/core-impl/collections/playdarcollection/support/QMFunctionTypes.h --- a/src/core-impl/collections/playdarcollection/support/QMFunctionTypes.h +++ b/src/core-impl/collections/playdarcollection/support/QMFunctionTypes.h @@ -14,8 +14,8 @@ * this program. If not, see . * ****************************************************************************************/ -#ifndef QUERYMAKER_FUNCTION_TYPES_H -#define QUERYMAKER_FUNCTION_TYPES_H +#ifndef QM_FUNCTION_TYPES_H +#define QM_FUNCTION_TYPES_H #include "core/collections/QueryMaker.h" @@ -36,7 +36,7 @@ class CurriedQMFunction { public: - virtual ~CurriedQMFunction() {}; + virtual ~CurriedQMFunction() {} /** * Invokes the stored function, with the stored * parameters, providing @param qm as the this pointer. @@ -53,12 +53,12 @@ public: typedef QueryMaker* ( QueryMaker::*FunPtr ) (); - CurriedZeroArityQMFunction( FunPtr function ) + explicit CurriedZeroArityQMFunction( FunPtr function ) : m_function( function ) - {}; - virtual ~CurriedZeroArityQMFunction() {}; + {} + virtual ~CurriedZeroArityQMFunction() {} - QueryMaker* operator()( QueryMaker *qm = 0 ) + QueryMaker* operator()( QueryMaker *qm = 0 ) override { if( qm ) return ( qm->*m_function )(); @@ -81,10 +81,10 @@ CurriedUnaryQMFunction( FunPtr function, Type parameter ) : m_function( function ) , m_parameter( parameter ) - {}; - virtual ~CurriedUnaryQMFunction() {}; + {} + virtual ~CurriedUnaryQMFunction() {} - QueryMaker* operator()( QueryMaker *qm ) + QueryMaker* operator()( QueryMaker *qm ) override { if( qm ) return ( qm->*m_function )( m_parameter ); @@ -109,10 +109,10 @@ : m_function( function ) , m_parameterOne( parameterOne ) , m_parameterTwo( parameterTwo ) - {}; - virtual ~CurriedBinaryQMFunction() {}; + {} + virtual ~CurriedBinaryQMFunction() {} - QueryMaker* operator()( QueryMaker *qm ) + QueryMaker* operator()( QueryMaker *qm ) override { if( qm ) return ( qm->*m_function )( m_parameterOne, m_parameterTwo ); @@ -139,10 +139,10 @@ , m_parameterOne( parameterOne ) , m_parameterTwo( parameterTwo ) , m_parameterThree( parameterThree ) - {}; - virtual ~CurriedTrinaryQMFunction() {}; + {} + virtual ~CurriedTrinaryQMFunction() {} - QueryMaker* operator()( QueryMaker *qm ) + QueryMaker* operator()( QueryMaker *qm ) override { if( qm ) return ( qm->*m_function )( m_parameterOne, m_parameterTwo, m_parameterThree ); @@ -168,16 +168,16 @@ public: typedef QueryMaker* ( QueryMaker::*FunPtr ) ( qint64, const QString&, bool, bool ); - CurriedQMStringFilterFunction( FunPtr function, qint64 value, QString filter, bool matchBegin, bool matchEnd ) + CurriedQMStringFilterFunction( FunPtr function, qint64 value, const QString &filter, bool matchBegin, bool matchEnd ) : m_function( function ) , m_value( value ) , m_filter( filter ) , m_matchBegin( matchBegin ) , m_matchEnd( matchEnd ) - {}; - virtual ~CurriedQMStringFilterFunction() {}; + {} + virtual ~CurriedQMStringFilterFunction() {} - QueryMaker* operator()( QueryMaker *qm ) + QueryMaker* operator()( QueryMaker *qm ) override { if( qm ) return ( qm->*m_function )( m_value, m_filter, m_matchBegin, m_matchEnd ); diff --git a/src/core-impl/collections/playdarcollection/support/Query.h b/src/core-impl/collections/playdarcollection/support/Query.h --- a/src/core-impl/collections/playdarcollection/support/Query.h +++ b/src/core-impl/collections/playdarcollection/support/Query.h @@ -83,18 +83,18 @@ * Emitted each time a new track is added to the list of results, * returning the latest result as a Meta::PlaydarTrack. */ - void newTrackAdded( Meta::PlaydarTrackPtr ); + void newTrackAdded( const Meta::PlaydarTrackPtr &); /** * Emitted once if a query is solved, and returns the first track * with a perfect score of 1.00. Will not be emitted if the query * ends otherwise. (Emitted alongside newTrackAdded). */ - void querySolved( Meta::PlaydarTrackPtr ); + void querySolved( const Meta::PlaydarTrackPtr &); /** * Emitted once all results that may be found by our means have * been found, and returns the internal results list in its final state. */ - void queryDone( Playdar::Query*, Meta::PlaydarTrackList ); + void queryDone( Playdar::Query*, const Meta::PlaydarTrackList &); /** * Indicates an error. Don't bother connecting to this if you're * already connected to Controller::error, since the controller diff --git a/src/core-impl/collections/playdarcollection/support/Query.cpp b/src/core-impl/collections/playdarcollection/support/Query.cpp --- a/src/core-impl/collections/playdarcollection/support/Query.cpp +++ b/src/core-impl/collections/playdarcollection/support/Query.cpp @@ -20,16 +20,19 @@ #include "../PlaydarMeta.h" #include "core/support/Debug.h" -#include - -#include -#include - +#include +#include +#include +#include +#include #include +#include #include -#include #include +#include + + namespace Playdar { Query::Query( const QString &qid, @@ -117,49 +120,53 @@ if( resultsJob->error() != 0 ) { debug() << "Error getting results from Playdar"; - emit playdarError( Playdar::Controller::ErrorState( 1 ) ); + Q_EMIT playdarError( Playdar::Controller::ErrorState( 1 ) ); return; } debug() << "Processing received JSON data..."; KIO::StoredTransferJob* storedResultsJob = static_cast( resultsJob ); - QJson::Parser parser; - bool ok; - QVariant parsedResultsVariant; - parsedResultsVariant = parser.parse( storedResultsJob->data(),&ok ); - if ( !ok ) + QJsonParseError err; + auto doc = QJsonDocument::fromJson( storedResultsJob->data(), &err ); + + if ( err.error != QJsonParseError::NoError ) + debug() << "Error parsing JSON Data:" << err.errorString(); + + if( !doc.isObject() ) { - debug() << "Error parsing JSON Data"; + debug() << "Parsed Json data is not an object"; + return; } - - QVariantMap parsedResults = parsedResultsVariant.toMap(); - if( !parsedResults.contains( "results" ) ) + + auto object = doc.object(); + + if( !object.contains( "results" ) ) { debug() << "Expecting results in Playdar's response, received none"; - emit playdarError( Playdar::Controller::ErrorState( 6 ) ); + Q_EMIT playdarError( Playdar::Controller::ErrorState( 6 ) ); return; } - if( !parsedResults.contains( "qid" ) ) + if( !object.contains( "qid" ) ) { debug() << "Expected qid in Playdar's response, received none"; - emit playdarError( Playdar::Controller::ErrorState( 4 ) ); + Q_EMIT playdarError( Playdar::Controller::ErrorState( 4 ) ); return; } - if( parsedResults.value( "qid" ) != m_qid ) + if( object.value( "qid" ) != m_qid ) { debug() << "A query received the wrong results from Playdar..."; - emit playdarError( Playdar::Controller::ErrorState( 5 ) ); + Q_EMIT playdarError( Playdar::Controller::ErrorState( 5 ) ); return; } - m_artist = parsedResults.value( "artist" ).toString(); - m_album = parsedResults.value( "album" ).toString(); - m_title = parsedResults.value( "track" ).toString(); + m_artist = object.value( "artist" ).toString(); + m_album = object.value( "album" ).toString(); + m_title = object.value( "track" ).toString(); - foreach( const QVariant &resultVariant, parsedResults.value( "results" ).toList() ) + for( const auto &resultVariant : object.value( "results" ).toArray() ) { - QVariantMap result = resultVariant.toMap(); + auto result = resultVariant.toObject(); Meta::PlaydarTrackPtr aTrack; QUrl resultUrl( m_controller->urlForSid( result.value( "sid" ).toString() ) ); @@ -190,25 +197,25 @@ { m_solved = true; m_trackList.prepend( aTrack ); - emit querySolved( aTrack ); + Q_EMIT querySolved( aTrack ); if( m_waitForSolution ) { - emit queryDone( this, m_trackList ); + Q_EMIT queryDone( this, m_trackList ); return; } } else { m_trackList.append( aTrack ); } - emit newTrackAdded( aTrack ); + Q_EMIT newTrackAdded( aTrack ); } if( m_receivedFirstResults || m_solved ) { m_receivedFirstResults = true; - emit queryDone( this, m_trackList ); + Q_EMIT queryDone( this, m_trackList ); } else { diff --git a/src/core-impl/collections/support/ArtistHelper.cpp b/src/core-impl/collections/support/ArtistHelper.cpp --- a/src/core-impl/collections/support/ArtistHelper.cpp +++ b/src/core-impl/collections/support/ArtistHelper.cpp @@ -49,25 +49,25 @@ { bool featuring = false; QStringList trackArtists; - if( trackArtistTag.contains( "featuring" ) ) + if( trackArtistTag.contains( QLatin1String("featuring") ) ) { featuring = true; - trackArtists = trackArtistTag.split( "featuring" ); + trackArtists = trackArtistTag.split( QStringLiteral("featuring") ); } - else if( trackArtistTag.contains( "feat." ) ) + else if( trackArtistTag.contains( QLatin1String("feat.") ) ) { featuring = true; - trackArtists = trackArtistTag.split( "feat." ); + trackArtists = trackArtistTag.split( QStringLiteral("feat.") ); } - else if( trackArtistTag.contains( "ft." ) ) + else if( trackArtistTag.contains( QLatin1String("ft.") ) ) { featuring = true; - trackArtists = trackArtistTag.split( "ft." ); + trackArtists = trackArtistTag.split( QStringLiteral("ft.") ); } - else if( trackArtistTag.contains( "f." ) ) + else if( trackArtistTag.contains( QLatin1String("f.") ) ) { featuring = true; - trackArtists = trackArtistTag.split( "f." ); + trackArtists = trackArtistTag.split( QStringLiteral("f.") ); } //this needs to be improved @@ -77,7 +77,7 @@ //always use the first artist QString tmp = trackArtists[0].simplified(); //artists are written as "A (feat. B)" or "A [feat. B]" as well - if( tmp.endsWith(" (") || tmp.endsWith( " [" ) ) + if( tmp.endsWith(QLatin1String(" (")) || tmp.endsWith( QLatin1String(" [") ) ) tmp = tmp.left( tmp.length() -2 ).simplified(); //remove last two characters if( tmp.isEmpty() ) diff --git a/src/core-impl/collections/support/CollectionLocationDelegateImpl.h b/src/core-impl/collections/support/CollectionLocationDelegateImpl.h --- a/src/core-impl/collections/support/CollectionLocationDelegateImpl.h +++ b/src/core-impl/collections/support/CollectionLocationDelegateImpl.h @@ -29,19 +29,19 @@ class AMAROK_EXPORT CollectionLocationDelegateImpl : public CollectionLocationDelegate { public: - CollectionLocationDelegateImpl() {}; - virtual ~ CollectionLocationDelegateImpl() {}; - - virtual bool reallyDelete( CollectionLocation *loc, const Meta::TrackList &tracks ) const; - virtual bool reallyMove(CollectionLocation* loc, const Meta::TrackList& tracks) const; - virtual bool reallyTrash( CollectionLocation *loc, const Meta::TrackList &tracks ) const; - virtual void errorDeleting( CollectionLocation* loc, const Meta::TrackList& tracks ) const; - virtual void notWriteable(CollectionLocation* loc) const; - virtual bool deleteEmptyDirs(CollectionLocation* loc) const; - virtual Transcoding::Configuration transcode( const QStringList &playableFileTypes, + CollectionLocationDelegateImpl() {} + virtual ~ CollectionLocationDelegateImpl() {} + + bool reallyDelete( CollectionLocation *loc, const Meta::TrackList &tracks ) const override; + bool reallyMove(CollectionLocation* loc, const Meta::TrackList& tracks) const override; + bool reallyTrash( CollectionLocation *loc, const Meta::TrackList &tracks ) const override; + void errorDeleting( CollectionLocation* loc, const Meta::TrackList& tracks ) const override; + void notWriteable(CollectionLocation* loc) const override; + bool deleteEmptyDirs(CollectionLocation* loc) const override; + Transcoding::Configuration transcode( const QStringList &playableFileTypes, bool *remember, OperationType operation, const QString &destCollectionName, - const Transcoding::Configuration &prevConfiguration ) const; + const Transcoding::Configuration &prevConfiguration ) const override; private: QStringList trackList( const Meta::TrackList &tracks ) const; diff --git a/src/core-impl/collections/support/CollectionLocationDelegateImpl.cpp b/src/core-impl/collections/support/CollectionLocationDelegateImpl.cpp --- a/src/core-impl/collections/support/CollectionLocationDelegateImpl.cpp +++ b/src/core-impl/collections/support/CollectionLocationDelegateImpl.cpp @@ -18,7 +18,7 @@ #include "CollectionLocationDelegateImpl.h" -#include "core/interfaces/Logger.h" +#include "core/logger/Logger.h" #include "core/collections/CollectionLocation.h" #include "core/support/Components.h" #include "transcoding/TranscodingAssistantDialog.h" @@ -36,7 +36,7 @@ "Do you really want to delete this track? It will be removed from %2 and from underlying storage medium.", "Do you really want to delete these %1 tracks? They will be removed from %2 and from underlying storage medium.", tracks.count(), loc->prettyLocation()) ); - int ret = KMessageBox::warningContinueCancelList(0, text, files, + int ret = KMessageBox::warningContinueCancelList(nullptr, text, files, i18nc( "@title:window", "Confirm Delete" ), KStandardGuiItem::del() ); return ret == KMessageBox::Continue; } @@ -49,7 +49,7 @@ "Do you really want to move this track to the trash? It will be removed from %2.", "Do you really want to move these %1 tracks to the trash? They will be removed from %2.", tracks.count(), loc->prettyLocation() ) ); - int ret = KMessageBox::warningContinueCancelList( 0, text, files, + int ret = KMessageBox::warningContinueCancelList( nullptr, text, files, i18nc( "@title:window", "Confirm Move to Trash" ), KStandardGuiItem::remove() ); return ret == KMessageBox::Continue; } @@ -63,8 +63,8 @@ "Do you really want to move this track? It will be renamed and the original deleted.", "Do you really want to move these %1 tracks? They will be renamed and the originals deleted.", tracks.count() ) ); - int ret = KMessageBox::warningContinueCancelList( 0, text, files, - i18nc( "@title:window", "Move Files" ), KGuiItem( i18nc( "rename files button", "&Rename" ), "go-jump" ) ); + int ret = KMessageBox::warningContinueCancelList( nullptr, text, files, + i18nc( "@title:window", "Move Files" ), KGuiItem( i18nc( "rename files button", "&Rename" ), QStringLiteral("go-jump") ) ); return ret == KMessageBox::Continue; } @@ -77,14 +77,14 @@ "There was a problem and this track could not be removed. Make sure the directory is writable.", "There was a problem and %1 tracks could not be removed. Make sure the directory is writable.", files.count() ) ); - KMessageBox::informationList( 0, text, files, i18n( "Unable to remove tracks") ); + KMessageBox::informationList( nullptr, text, files, i18n( "Unable to remove tracks") ); } void CollectionLocationDelegateImpl::notWriteable( CollectionLocation *loc ) const { Q_UNUSED( loc ) - Amarok::Components::logger()->longMessage( + Amarok::Logger::longMessage( i18n( "The collection does not have enough free space available or is not writable." ), Amarok::Logger::Error ); } @@ -94,7 +94,7 @@ { const QString text( i18n( "Do you want to remove empty folders?" ) ); const QString caption( i18n( "Remove empty folders?" ) ); - int result = KMessageBox::questionYesNo( 0, text, caption, KStandardGuiItem::yes(), + int result = KMessageBox::questionYesNo( nullptr, text, caption, KStandardGuiItem::yes(), KStandardGuiItem::no(), QString( "Delete empty dirs from " + loc->prettyLocation() ) ); return result == KMessageBox::Yes; } diff --git a/src/core-impl/collections/support/CollectionManager.h b/src/core-impl/collections/support/CollectionManager.h --- a/src/core-impl/collections/support/CollectionManager.h +++ b/src/core-impl/collections/support/CollectionManager.h @@ -25,7 +25,6 @@ #include #include -class CollectionManagerSingleton; namespace Plugins { class PluginFactory; @@ -41,13 +40,12 @@ /** Class managing the different collections. * * This singleton class is the main repository for all current collections. - * The most usefull functions are probably queryMaker and + * The most useful functions are probably queryMaker and * viewableCollections */ class AMAROK_EXPORT CollectionManager : public QObject { Q_OBJECT - Q_ENUMS( CollectionStatus ) public: @@ -60,6 +58,7 @@ CollectionQueryable= 4, ///< Collection wil not show up in the browser, but is queryable by global queries CollectionEnabled = CollectionViewable | CollectionQueryable ///< Collection viewable in the browser and queryable }; + Q_ENUM( CollectionStatus ) static CollectionManager *instance(); @@ -131,12 +130,12 @@ * For every factory that is a CollectionFactory uses it to create new * collections and register with this manager. */ - void setFactories( const QList &factories ); + void setFactories( const QList > &factories ); public Q_SLOTS: /** Starts the full scan for each collection with CollectionScanCapability */ void startFullScan(); - /** Starts the incremetal scan for each collection with CollectionScanCapability */ + /** Starts the incremental scan for each collection with CollectionScanCapability */ void startIncrementalScan( const QString &directory = QString() ); void stopScan(); void checkCollectionChanges(); @@ -146,7 +145,7 @@ // void collectionAdded( Collections::Collection *newCollection ); void collectionAdded( Collections::Collection *newCollection, CollectionManager::CollectionStatus status ); - void collectionRemoved( QString collectionId ); + void collectionRemoved( const QString &collectionId ); void trackProviderAdded( Collections::TrackProvider *provider ); //this signal will be emitted after major changes to the collection //e.g. new songs where added, or an album changed diff --git a/src/core-impl/collections/support/CollectionManager.cpp b/src/core-impl/collections/support/CollectionManager.cpp --- a/src/core-impl/collections/support/CollectionManager.cpp +++ b/src/core-impl/collections/support/CollectionManager.cpp @@ -44,7 +44,7 @@ struct CollectionManager::Private { QList collections; - QList factories; // factories belong to PluginManager + QList > factories; // factories belong to PluginManager QList trackProviders; TimecodeTrackProvider *timecodeTrackProvider; @@ -55,7 +55,7 @@ QReadWriteLock lock; ///< protects all other variables against threading issues }; -CollectionManager *CollectionManager::s_instance = 0; +CollectionManager *CollectionManager::s_instance = nullptr; CollectionManager * CollectionManager::instance() @@ -73,7 +73,7 @@ { if( s_instance ) { delete s_instance; - s_instance = 0; + s_instance = nullptr; } } @@ -85,7 +85,7 @@ // ensure this object is created in a main thread Q_ASSERT( thread() == QCoreApplication::instance()->thread() ); - setObjectName( "CollectionManager" ); + setObjectName( QStringLiteral("CollectionManager") ); d->primaryCollection = 0; d->timecodeTrackProvider = 0; d->fileTrackProvider = 0; @@ -104,10 +104,6 @@ d->trackProviders.clear(); delete d->timecodeTrackProvider; delete d->fileTrackProvider; - - // Hmm, qDeleteAll from Qt 4.8 crashes with our SmartPointerList, do it manually. Bug 285951 - while (!d->factories.isEmpty() ) - delete d->factories.takeFirst(); } delete d; @@ -121,49 +117,49 @@ d->timecodeTrackProvider = new TimecodeTrackProvider(); addTrackProvider( d->timecodeTrackProvider ); - // addint fileTrackProvider second since local tracks should be preferred even if the url matchs two tracks + // addint fileTrackProvider second since local tracks should be preferred even if the url matches two tracks d->fileTrackProvider = new FileTrackProvider(); addTrackProvider( d->fileTrackProvider ); } void -CollectionManager::setFactories( const QList &factories ) +CollectionManager::setFactories( const QList > &factories ) { using Collections::CollectionFactory; - QSet newFactories = factories.toSet(); - QSet oldFactories; + QSet > newFactories = factories.toSet(); + QSet > oldFactories; { QReadLocker locker( &d->lock ); oldFactories = d->factories.toSet(); } // remove old factories - foreach( Plugins::PluginFactory* pFactory, oldFactories - newFactories ) + for( const auto &pFactory : oldFactories - newFactories ) { - CollectionFactory *factory = qobject_cast( pFactory ); + auto factory = qobject_cast( pFactory ); if( !factory ) continue; - disconnect( factory, &CollectionFactory::newCollection, + disconnect( factory.data(), &CollectionFactory::newCollection, this, &CollectionManager::slotNewCollection ); { QWriteLocker locker( &d->lock ); d->factories.removeAll( factory ); } } // create new factories - foreach( Plugins::PluginFactory* pFactory, newFactories - oldFactories ) + for( const auto &pFactory : newFactories - oldFactories ) { - CollectionFactory *factory = qobject_cast( pFactory ); + auto factory = qobject_cast( pFactory ); if( !factory ) continue; - connect( factory, &CollectionFactory::newCollection, + connect( factory.data(), &CollectionFactory::newCollection, this, &CollectionManager::slotNewCollection ); { QWriteLocker locker( &d->lock ); @@ -258,7 +254,7 @@ const QMetaObject *mo = metaObject(); const QMetaEnum me = mo->enumerator( mo->indexOfEnumerator( "CollectionStatus" ) ); - const QString &value = Amarok::config( "CollectionManager" ).readEntry( newCollection->collectionId() ); + const QString &value = Amarok::config( QStringLiteral("CollectionManager") ).readEntry( newCollection->collectionId() ); int enumValue = me.keyToValue( value.toLocal8Bit().constData() ); CollectionStatus status; enumValue == -1 ? status = CollectionEnabled : status = (CollectionStatus) enumValue; @@ -285,8 +281,8 @@ if( status & CollectionViewable ) { -// emit collectionAdded( newCollection ); - emit collectionAdded( newCollection, status ); +// Q_EMIT collectionAdded( newCollection ); + Q_EMIT collectionAdded( newCollection, status ); } } @@ -305,7 +301,7 @@ d->trackProviders.removeAll( collection ); } - emit collectionRemoved( collection->collectionId() ); + Q_EMIT collectionRemoved( collection->collectionId() ); QTimer::singleShot( 500, collection, &QObject::deleteLater ); // give the tree some time to update itself until we really delete the collection pointers. } } @@ -319,7 +315,7 @@ CollectionStatus status = collectionStatus( collection->collectionId() ); if( status & CollectionViewable ) { - emit collectionDataChanged( collection ); + Q_EMIT collectionDataChanged( collection ); } } } @@ -371,7 +367,7 @@ // TODO: create specific TrackProviders for these: static const QSet remoteProtocols = QSet() - << "http" << "https" << "mms" << "smb"; // consider unifying with TrackLoader::tracksLoaded() + << QStringLiteral("http") << QStringLiteral("https") << QStringLiteral("mms") << QStringLiteral("smb"); // consider unifying with TrackLoader::tracksLoaded() if( remoteProtocols.contains( url.scheme() ) ) return Meta::TrackPtr( new MetaStream::Track( url ) ); @@ -414,7 +410,7 @@ QWriteLocker locker( &d->lock ); d->trackProviders.append( provider ); } - emit trackProviderAdded( provider ); + Q_EMIT trackProviderAdded( provider ); } void diff --git a/src/core-impl/collections/support/Expression.h b/src/core-impl/collections/support/Expression.h --- a/src/core-impl/collections/support/Expression.h +++ b/src/core-impl/collections/support/Expression.h @@ -55,7 +55,7 @@ class ExpressionParser { public: - ExpressionParser( const QString &expression ); + explicit ExpressionParser( const QString &expression ); ParsedExpression parse(); static ParsedExpression parse( const QString &expression ); diff --git a/src/core-impl/collections/support/Expression.cpp b/src/core-impl/collections/support/Expression.cpp --- a/src/core-impl/collections/support/Expression.cpp +++ b/src/core-impl/collections/support/Expression.cpp @@ -47,8 +47,8 @@ return ( expression.contains( '"' ) || expression.contains( ':' ) || expression.contains( '-' ) || - expression.contains( "AND" ) || - expression.contains( "OR" ) ); + expression.contains( QLatin1String("AND") ) || + expression.contains( QLatin1String("OR") ) ); } /* PRIVATE */ @@ -147,9 +147,9 @@ int s; if( m_haveGroup || !m_element.field.isEmpty() ) s = Neither; - else if( m_string == "AND" ) + else if( m_string == QLatin1String("AND") ) s = And; - else if( m_string == "OR" ) + else if( m_string == QLatin1String("OR") ) s = Or; else s = Neither; diff --git a/src/core-impl/collections/support/FileCollectionLocation.h b/src/core-impl/collections/support/FileCollectionLocation.h --- a/src/core-impl/collections/support/FileCollectionLocation.h +++ b/src/core-impl/collections/support/FileCollectionLocation.h @@ -35,11 +35,11 @@ FileCollectionLocation(); virtual ~FileCollectionLocation(); - virtual QString prettyLocation() const; - virtual bool isWritable() const; - virtual bool isOrganizable() const; - virtual void removeUrlsFromCollection( const Meta::TrackList& sources ); - virtual void showRemoveDialog( const Meta::TrackList &tracks ); + QString prettyLocation() const override; + bool isWritable() const override; + bool isOrganizable() const override; + void removeUrlsFromCollection( const Meta::TrackList& sources ) override; + void showRemoveDialog( const Meta::TrackList &tracks ) override; public Q_SLOTS: void slotRemoveJobFinished( KJob *job ); private: diff --git a/src/core-impl/collections/support/FileCollectionLocation.cpp b/src/core-impl/collections/support/FileCollectionLocation.cpp --- a/src/core-impl/collections/support/FileCollectionLocation.cpp +++ b/src/core-impl/collections/support/FileCollectionLocation.cpp @@ -18,7 +18,7 @@ #include "FileCollectionLocation.h" #include "core/collections/CollectionLocationDelegate.h" -#include "core/interfaces/Logger.h" +#include "core/logger/Logger.h" #include "core/support/Components.h" #include "core/support/Debug.h" @@ -49,7 +49,7 @@ QString FileCollectionLocation::prettyLocation() const { - return "File Browser Location"; + return QStringLiteral("File Browser Location"); } @@ -82,9 +82,9 @@ connect( job, &KIO::Job::result, this, &FileCollectionLocation::slotRemoveJobFinished ); QString name = track->prettyName(); if( track->artist() ) - name = QString( "%1 - %2" ).arg( track->artist()->name(), track->prettyName() ); + name = QStringLiteral( "%1 - %2" ).arg( track->artist()->name(), track->prettyName() ); - Amarok::Components::logger()->newProgressOperation( job, i18n( "Removing: %1", name ) ); + Amarok::Logger::newProgressOperation( job, i18n( "Removing: %1", name ) ); m_removejobs.insert( job, track ); } } diff --git a/src/core-impl/collections/support/MemoryCollection.h b/src/core-impl/collections/support/MemoryCollection.h --- a/src/core-impl/collections/support/MemoryCollection.h +++ b/src/core-impl/collections/support/MemoryCollection.h @@ -38,8 +38,8 @@ return QMap::contains( Meta::AlbumKey( album ) ); } /** - * Return true if this map contains album named @param name with album artist - * @param artistName. Amarok convention is to use empty artistName for compilaitons. + * @return @c true if this map contains album named @param name with album artist + * @param artistName Amarok convention is to use empty artistName for compilations. */ bool contains( const QString &name, const QString &artistName ) const { return QMap::contains( Meta::AlbumKey( name, artistName ) ); } @@ -103,8 +103,8 @@ void setArtistMap( const ArtistMap &map ) { m_artistMap = map; } void addArtist( Meta::ArtistPtr artistPtr) { m_artistMap.insert( artistPtr->name(), artistPtr ); } void setAlbumMap( const AlbumMap &map ) { m_albumMap = map; } - void addAlbum ( Meta::AlbumPtr albumPtr ) { m_albumMap.insert( albumPtr ); } - void setGenreMap( GenreMap map ) { m_genreMap = map; } + void addAlbum ( const Meta::AlbumPtr &albumPtr ) { m_albumMap.insert( albumPtr ); } + void setGenreMap( const GenreMap &map ) { m_genreMap = map; } void addGenre( Meta::GenrePtr genrePtr) { m_genreMap.insert( genrePtr->name(), genrePtr ); } void setComposerMap( const ComposerMap &map ) { m_composerMap = map; } void addComposer( Meta::ComposerPtr composerPtr ) { m_composerMap.insert( composerPtr->name(), composerPtr ); } diff --git a/src/core-impl/collections/support/MemoryCustomValue.h b/src/core-impl/collections/support/MemoryCustomValue.h --- a/src/core-impl/collections/support/MemoryCustomValue.h +++ b/src/core-impl/collections/support/MemoryCustomValue.h @@ -48,52 +48,52 @@ TrackCounter(); virtual ~TrackCounter(); - virtual QString value( const Meta::TrackList &tracks ) const; + QString value( const Meta::TrackList &tracks ) const override; }; class AMAROK_EXPORT ArtistCounter : public CustomReturnFunction { public: ArtistCounter(); virtual ~ArtistCounter(); - virtual QString value( const Meta::TrackList &tracks ) const; + QString value( const Meta::TrackList &tracks ) const override; }; class AMAROK_EXPORT GenreCounter : public CustomReturnFunction { public: GenreCounter(); virtual ~GenreCounter(); - virtual QString value( const Meta::TrackList &tracks ) const; + QString value( const Meta::TrackList &tracks ) const override; }; class AMAROK_EXPORT ComposerCounter : public CustomReturnFunction { public: ComposerCounter(); virtual ~ComposerCounter(); - virtual QString value( const Meta::TrackList &tracks ) const; + QString value( const Meta::TrackList &tracks ) const override; }; class AMAROK_EXPORT AlbumCounter : public CustomReturnFunction { public: AlbumCounter(); virtual ~AlbumCounter(); - virtual QString value( const Meta::TrackList &tracks ) const; + QString value( const Meta::TrackList &tracks ) const override; }; class AMAROK_EXPORT YearCounter : public CustomReturnFunction { public: YearCounter(); virtual ~YearCounter(); - virtual QString value( const Meta::TrackList &tracks ) const; + QString value( const Meta::TrackList &tracks ) const override; }; class AMAROK_EXPORT CustomReturnValue @@ -110,15 +110,15 @@ public: TitleReturnValue(); virtual ~TitleReturnValue(); - virtual QString value( const Meta::TrackPtr &track ) const; + QString value( const Meta::TrackPtr &track ) const override; }; class AMAROK_EXPORT UrlReturnValue : public CustomReturnValue { public: UrlReturnValue(); virtual ~UrlReturnValue(); - virtual QString value( const Meta::TrackPtr &track ) const; + QString value( const Meta::TrackPtr &track ) const override; }; diff --git a/src/core-impl/collections/support/MemoryCustomValue.cpp b/src/core-impl/collections/support/MemoryCustomValue.cpp --- a/src/core-impl/collections/support/MemoryCustomValue.cpp +++ b/src/core-impl/collections/support/MemoryCustomValue.cpp @@ -27,7 +27,7 @@ SumReturnFunction( CustomReturnValue * rv ) : returnValue( rv ) {} ~SumReturnFunction() { delete returnValue; } - QString value( const Meta::TrackList &tracks ) const + QString value( const Meta::TrackList &tracks ) const override { if( !returnValue ) return QString::number( 0 ); @@ -49,7 +49,7 @@ MinimumReturnFunction( CustomReturnValue * rv ) : returnValue( rv ) {} ~MinimumReturnFunction() { delete returnValue; } - QString value( const Meta::TrackList &tracks ) const + QString value( const Meta::TrackList &tracks ) const override { if( tracks.empty() || !returnValue ) return QString::number( 0 ); @@ -71,7 +71,7 @@ MaximumReturnFunction( CustomReturnValue * rv ) : returnValue( rv ) {} ~MaximumReturnFunction() { delete returnValue; } - QString value( const Meta::TrackList &tracks ) const + QString value( const Meta::TrackList &tracks ) const override { if( tracks.empty() || !returnValue ) return QString::number( 0 ); @@ -311,119 +311,119 @@ public: ArtistReturnValue() {} virtual ~ArtistReturnValue() {} - virtual QString value( const Meta::TrackPtr &track ) const { return track->artist() ? track->artist()->name() : QString(); } + QString value( const Meta::TrackPtr &track ) const override { return track->artist() ? track->artist()->name() : QString(); } }; class AlbumReturnValue : public CustomReturnValue { public: AlbumReturnValue() {} virtual ~AlbumReturnValue() {} - virtual QString value( const Meta::TrackPtr &track ) const { return track->album() ? track->album()->name() : QString(); } + QString value( const Meta::TrackPtr &track ) const override { return track->album() ? track->album()->name() : QString(); } }; class ComposerReturnValue : public CustomReturnValue { public: ComposerReturnValue() {} virtual ~ComposerReturnValue() {} - virtual QString value( const Meta::TrackPtr &track ) const { return track->composer() ? track->composer()->name() : QString(); } + QString value( const Meta::TrackPtr &track ) const override { return track->composer() ? track->composer()->name() : QString(); } }; class GenreReturnValue : public CustomReturnValue { public: GenreReturnValue() {} virtual ~GenreReturnValue() {} - virtual QString value( const Meta::TrackPtr &track ) const { return track->genre() ? track->genre()->name() : QString(); } + QString value( const Meta::TrackPtr &track ) const override { return track->genre() ? track->genre()->name() : QString(); } }; class YearReturnValue : public CustomReturnValue { public: YearReturnValue() {} virtual ~YearReturnValue() {} - virtual QString value( const Meta::TrackPtr &track ) const { return track->year() ? track->year()->name() : QString(); } + QString value( const Meta::TrackPtr &track ) const override { return track->year() ? track->year()->name() : QString(); } }; class CommentReturnValue : public CustomReturnValue { public: CommentReturnValue() {} virtual ~CommentReturnValue() {} - virtual QString value( const Meta::TrackPtr &track ) const { return track->comment(); } + QString value( const Meta::TrackPtr &track ) const override { return track->comment(); } }; class TrackNrReturnValue : public CustomReturnValue { public: TrackNrReturnValue() {} virtual ~TrackNrReturnValue() {} - virtual QString value( const Meta::TrackPtr &track ) const { return QString::number( track->trackNumber() ); } + QString value( const Meta::TrackPtr &track ) const override { return QString::number( track->trackNumber() ); } }; class DiscNrReturnValue : public CustomReturnValue { public: DiscNrReturnValue() {} virtual ~DiscNrReturnValue() {} - virtual QString value( const Meta::TrackPtr &track ) const { return QString::number( track->discNumber() ); } + QString value( const Meta::TrackPtr &track ) const override { return QString::number( track->discNumber() ); } }; class ScoreReturnValue : public CustomReturnValue { public: ScoreReturnValue() {} virtual ~ScoreReturnValue() {} - virtual QString value( const Meta::TrackPtr &track ) const { return QString::number( track->statistics()->score() ); } + QString value( const Meta::TrackPtr &track ) const override { return QString::number( track->statistics()->score() ); } }; class RatingReturnValue : public CustomReturnValue { public: RatingReturnValue() {} virtual ~RatingReturnValue() {} - virtual QString value( const Meta::TrackPtr &track ) const { return QString::number( track->statistics()->rating() ); } + QString value( const Meta::TrackPtr &track ) const override { return QString::number( track->statistics()->rating() ); } }; class PlaycountReturnValue : public CustomReturnValue { public: PlaycountReturnValue() {} virtual ~PlaycountReturnValue() {} - virtual QString value( const Meta::TrackPtr &track ) const { return QString::number( track->statistics()->playCount() ); } + QString value( const Meta::TrackPtr &track ) const override { return QString::number( track->statistics()->playCount() ); } }; class LengthReturnValue : public CustomReturnValue { public: LengthReturnValue() {} virtual ~LengthReturnValue() {} - virtual QString value( const Meta::TrackPtr &track ) const { return QString::number( track->length() / 1000 ); } + QString value( const Meta::TrackPtr &track ) const override { return QString::number( track->length() / 1000 ); } }; class BitrateReturnValue : public CustomReturnValue { public: BitrateReturnValue() {} virtual ~BitrateReturnValue() {} - virtual QString value( const Meta::TrackPtr &track ) const { return QString::number( track->bitrate() ); } + QString value( const Meta::TrackPtr &track ) const override { return QString::number( track->bitrate() ); } }; class FileSizeReturnValue : public CustomReturnValue { public: FileSizeReturnValue() {} virtual ~FileSizeReturnValue() {} - virtual QString value( const Meta::TrackPtr &track ) const { return QString::number( track->filesize() ); } + QString value( const Meta::TrackPtr &track ) const override { return QString::number( track->filesize() ); } }; class SampleRateReturnValue : public CustomReturnValue { public: SampleRateReturnValue() {} virtual ~SampleRateReturnValue() {} - virtual QString value( const Meta::TrackPtr &track ) const { return QString::number( track->sampleRate() ); } + QString value( const Meta::TrackPtr &track ) const override { return QString::number( track->sampleRate() ); } }; CustomReturnValue* diff --git a/src/core-impl/collections/support/MemoryFilter.h b/src/core-impl/collections/support/MemoryFilter.h --- a/src/core-impl/collections/support/MemoryFilter.h +++ b/src/core-impl/collections/support/MemoryFilter.h @@ -38,7 +38,7 @@ public: MemoryFilter(); virtual ~MemoryFilter(); - virtual bool filterMatches( Meta::TrackPtr track ) const = 0; + virtual bool filterMatches( const Meta::TrackPtr &track ) const = 0; }; class AMAROK_EXPORT ContainerMemoryFilter : public MemoryFilter @@ -56,23 +56,23 @@ public: AndContainerMemoryFilter(); virtual ~AndContainerMemoryFilter(); - virtual bool filterMatches( Meta::TrackPtr track ) const; + bool filterMatches( const Meta::TrackPtr &track ) const override; }; class AMAROK_EXPORT OrContainerMemoryFilter : public ContainerMemoryFilter { public: OrContainerMemoryFilter(); virtual ~OrContainerMemoryFilter(); - virtual bool filterMatches( Meta::TrackPtr track ) const; + bool filterMatches( const Meta::TrackPtr &track ) const override; }; class AMAROK_EXPORT NegateMemoryFilter : public MemoryFilter { public: - NegateMemoryFilter( MemoryFilter *filter ); + explicit NegateMemoryFilter( MemoryFilter *filter ); virtual ~NegateMemoryFilter(); - virtual bool filterMatches( Meta::TrackPtr track ) const; + bool filterMatches( const Meta::TrackPtr &track ) const override; private: MemoryFilter *m_filter; }; @@ -82,11 +82,11 @@ public: StringMemoryFilter(); virtual ~StringMemoryFilter(); - virtual bool filterMatches( Meta::TrackPtr track ) const; + bool filterMatches( const Meta::TrackPtr &track ) const override; void setFilter( const QString &filter, bool matchBegin, bool matchEnd ); protected: - virtual QString value( Meta::TrackPtr track ) const = 0; + virtual QString value( const Meta::TrackPtr &track ) const = 0; private: QString m_filter; @@ -99,11 +99,11 @@ { public: NumberMemoryFilter(); - virtual ~NumberMemoryFilter(); + ~NumberMemoryFilter() override; void setFilter( qint64 filter, Collections::QueryMaker::NumberComparison compare ); - bool filterMatches( Meta::TrackPtr track ) const; + bool filterMatches( const Meta::TrackPtr &track ) const override; protected: - virtual qint64 value( Meta::TrackPtr track ) const = 0; + virtual qint64 value( const Meta::TrackPtr &track ) const = 0; private: qint64 m_filter; Collections::QueryMaker::NumberComparison m_compare; @@ -114,8 +114,8 @@ { public: LabelFilter( const QString &filter, bool matchBegin, bool matchEnd ); - virtual ~ LabelFilter(); - bool filterMatches( Meta::TrackPtr track ) const; + ~ LabelFilter() override; + bool filterMatches( const Meta::TrackPtr &track ) const override; private: QRegExp m_expression; diff --git a/src/core-impl/collections/support/MemoryFilter.cpp b/src/core-impl/collections/support/MemoryFilter.cpp --- a/src/core-impl/collections/support/MemoryFilter.cpp +++ b/src/core-impl/collections/support/MemoryFilter.cpp @@ -24,7 +24,7 @@ class UrlMemoryFilter : public StringMemoryFilter { protected: - virtual QString value( Meta::TrackPtr track ) const + QString value( const Meta::TrackPtr &track ) const override { return track->playableUrl().url(); } }; @@ -38,7 +38,7 @@ { setFilter( filter, matchBegin, matchEnd ); } protected: - virtual QString value( Meta::TrackPtr track ) const + QString value( const Meta::TrackPtr &track ) const override { return Meta::valueForField( m_value, track ).toString(); } private: @@ -54,7 +54,7 @@ { setFilter( filter, compare ); } protected: - virtual qint64 value( Meta::TrackPtr track ) const + qint64 value( const Meta::TrackPtr &track ) const override { QVariant v = Meta::valueForField( m_value, track ); if( v.type() == QVariant::DateTime ) @@ -118,7 +118,7 @@ } bool -AndContainerMemoryFilter::filterMatches( Meta::TrackPtr track ) const +AndContainerMemoryFilter::filterMatches( const Meta::TrackPtr &track ) const { if( m_filters.isEmpty() ) return false; @@ -141,7 +141,7 @@ } bool -OrContainerMemoryFilter::filterMatches( Meta::TrackPtr track ) const +OrContainerMemoryFilter::filterMatches( const Meta::TrackPtr &track ) const { if( m_filters.isEmpty() ) return false; @@ -166,7 +166,7 @@ } bool -NegateMemoryFilter::filterMatches( Meta::TrackPtr track ) const +NegateMemoryFilter::filterMatches( const Meta::TrackPtr &track ) const { return !m_filter->filterMatches( track ); } @@ -192,7 +192,7 @@ } bool -StringMemoryFilter::filterMatches( Meta::TrackPtr track ) const +StringMemoryFilter::filterMatches( const Meta::TrackPtr &track ) const { const QString &str = value( track ); if( m_matchBegin && m_matchEnd ) @@ -232,7 +232,7 @@ } bool -NumberMemoryFilter::filterMatches( Meta::TrackPtr track ) const +NumberMemoryFilter::filterMatches( const Meta::TrackPtr &track ) const { qint64 currentValue = value( track ); switch( m_compare ) @@ -266,7 +266,7 @@ } bool -LabelFilter::filterMatches( Meta::TrackPtr track ) const +LabelFilter::filterMatches(const Meta::TrackPtr &track ) const { foreach( const Meta::LabelPtr &label, track->labels() ) { diff --git a/src/core-impl/collections/support/MemoryMatcher.h b/src/core-impl/collections/support/MemoryMatcher.h --- a/src/core-impl/collections/support/MemoryMatcher.h +++ b/src/core-impl/collections/support/MemoryMatcher.h @@ -47,9 +47,9 @@ class AMAROK_EXPORT TrackMatcher : public MemoryMatcher { public: - TrackMatcher( Meta::TrackPtr track ); - virtual Meta::TrackList match( Collections::MemoryCollection *memColl ); - virtual Meta::TrackList match( const Meta::TrackList &tracks ); + explicit TrackMatcher( const Meta::TrackPtr &track ); + Meta::TrackList match( Collections::MemoryCollection *memColl ) override; + Meta::TrackList match( const Meta::TrackList &tracks ) override; private: Meta::TrackPtr m_track; @@ -59,10 +59,10 @@ class AMAROK_EXPORT ArtistMatcher : public MemoryMatcher { public: - ArtistMatcher( Meta::ArtistPtr artist, Collections::QueryMaker::ArtistMatchBehaviour artistMode + ArtistMatcher( const Meta::ArtistPtr &artist, Collections::QueryMaker::ArtistMatchBehaviour artistMode = Collections::QueryMaker::TrackArtists ); - virtual Meta::TrackList match( Collections::MemoryCollection *memColl ); - virtual Meta::TrackList match( const Meta::TrackList &tracks ); + Meta::TrackList match( Collections::MemoryCollection *memColl ) override; + Meta::TrackList match( const Meta::TrackList &tracks ) override; private: Meta::ArtistPtr m_artist; @@ -72,53 +72,53 @@ class AMAROK_EXPORT AlbumMatcher : public MemoryMatcher { public: - AlbumMatcher( Meta::AlbumPtr album ); - virtual Meta::TrackList match( Collections::MemoryCollection *memColl ); - virtual Meta::TrackList match( const Meta::TrackList &tracks ); + explicit AlbumMatcher( const Meta::AlbumPtr &album ); + Meta::TrackList match( Collections::MemoryCollection *memColl ) override; + Meta::TrackList match( const Meta::TrackList &tracks ) override; private: Meta::AlbumPtr m_album; }; class AMAROK_EXPORT GenreMatcher : public MemoryMatcher { public: - GenreMatcher( Meta::GenrePtr genre ); - virtual Meta::TrackList match( Collections::MemoryCollection *memColl ); - virtual Meta::TrackList match( const Meta::TrackList &tracks ); + explicit GenreMatcher( const Meta::GenrePtr &genre ); + Meta::TrackList match( Collections::MemoryCollection *memColl ) override; + Meta::TrackList match( const Meta::TrackList &tracks ) override; private: Meta::GenrePtr m_genre; }; class AMAROK_EXPORT ComposerMatcher : public MemoryMatcher { public: - ComposerMatcher( Meta::ComposerPtr composer ); - virtual Meta::TrackList match( Collections::MemoryCollection *memColl ); - virtual Meta::TrackList match( const Meta::TrackList &tracks ); + explicit ComposerMatcher( const Meta::ComposerPtr &composer ); + Meta::TrackList match( Collections::MemoryCollection *memColl ) override; + Meta::TrackList match( const Meta::TrackList &tracks ) override; private: Meta::ComposerPtr m_composer; }; class AMAROK_EXPORT YearMatcher : public MemoryMatcher { public: - YearMatcher( Meta::YearPtr year ); - virtual Meta::TrackList match( Collections::MemoryCollection *memColl ); - virtual Meta::TrackList match( const Meta::TrackList &tracks ); + explicit YearMatcher( const Meta::YearPtr &year ); + Meta::TrackList match( Collections::MemoryCollection *memColl ) override; + Meta::TrackList match( const Meta::TrackList &tracks ) override; private: Meta::YearPtr m_year; }; class AMAROK_EXPORT LabelMatcher : public MemoryMatcher { public: - LabelMatcher( const Meta::LabelPtr &label ); - virtual Meta::TrackList match( Collections::MemoryCollection *memColl ); - virtual Meta::TrackList match( const Meta::TrackList &tracks ); + explicit LabelMatcher( const Meta::LabelPtr &label ); + Meta::TrackList match( Collections::MemoryCollection *memColl ) override; + Meta::TrackList match( const Meta::TrackList &tracks ) override; private: Meta::LabelPtr m_label; diff --git a/src/core-impl/collections/support/MemoryMatcher.cpp b/src/core-impl/collections/support/MemoryMatcher.cpp --- a/src/core-impl/collections/support/MemoryMatcher.cpp +++ b/src/core-impl/collections/support/MemoryMatcher.cpp @@ -48,7 +48,7 @@ m_next = next; } -TrackMatcher::TrackMatcher( TrackPtr track ) +TrackMatcher::TrackMatcher( const TrackPtr &track ) : MemoryMatcher() , m_track( track ) {} @@ -81,7 +81,7 @@ -ArtistMatcher::ArtistMatcher( ArtistPtr artist, Collections::QueryMaker::ArtistMatchBehaviour artistMode ) +ArtistMatcher::ArtistMatcher( const ArtistPtr &artist, Collections::QueryMaker::ArtistMatchBehaviour artistMode ) : MemoryMatcher() , m_artist( artist ) , m_queryMode( artistMode ) @@ -149,7 +149,7 @@ -AlbumMatcher::AlbumMatcher( AlbumPtr album ) +AlbumMatcher::AlbumMatcher( const AlbumPtr &album ) : MemoryMatcher() , m_album( album ) {} @@ -181,15 +181,15 @@ foreach( TrackPtr track, tracks ) if ( track->album()->name() == name ) matchingTracks.append( track ); - if ( isLast() || matchingTracks.count() == 0) + if ( isLast() || matchingTracks.isEmpty()) return matchingTracks; else return next()->match( matchingTracks ); } -GenreMatcher::GenreMatcher( GenrePtr genre ) +GenreMatcher::GenreMatcher( const GenrePtr &genre ) : MemoryMatcher() , m_genre( genre ) {} @@ -221,15 +221,15 @@ foreach( TrackPtr track, tracks ) if ( track->genre()->name() == name ) matchingTracks.append( track ); - if ( isLast() || matchingTracks.count() == 0) + if ( isLast() || matchingTracks.isEmpty()) return matchingTracks; else return next()->match( matchingTracks ); } -ComposerMatcher::ComposerMatcher( ComposerPtr composer ) +ComposerMatcher::ComposerMatcher( const ComposerPtr &composer ) : MemoryMatcher() , m_composer( composer ) {} @@ -261,15 +261,15 @@ foreach( TrackPtr track, tracks ) if ( track->composer()->name() == name ) matchingTracks.append( track ); - if ( isLast() || matchingTracks.count() == 0) + if ( isLast() || matchingTracks.isEmpty()) return matchingTracks; else return next()->match( matchingTracks ); } -YearMatcher::YearMatcher( YearPtr year ) +YearMatcher::YearMatcher( const YearPtr &year ) : MemoryMatcher() , m_year( year ) {} @@ -301,7 +301,7 @@ foreach( TrackPtr track, tracks ) if ( track->year()->year() == year ) matchingTracks.append( track ); - if ( isLast() || matchingTracks.count() == 0) + if ( isLast() || matchingTracks.isEmpty()) return matchingTracks; else return next()->match( matchingTracks ); @@ -334,7 +334,7 @@ } } } - if( isLast() || matchingTracks.count() == 0 ) + if( isLast() || matchingTracks.isEmpty() ) return matchingTracks; else return next()->match( matchingTracks ); @@ -354,7 +354,7 @@ Meta::LabelPtr realLabel = memColl->labelMap().value( m_label->name() ); matchingTracks = memColl->labelToTrackMap().value( realLabel ); } - if( isLast() || matchingTracks.count() == 0 ) + if( isLast() || matchingTracks.isEmpty() ) return matchingTracks; else return next()->match( matchingTracks ); diff --git a/src/core-impl/collections/support/MemoryMeta.h b/src/core-impl/collections/support/MemoryMeta.h --- a/src/core-impl/collections/support/MemoryMeta.h +++ b/src/core-impl/collections/support/MemoryMeta.h @@ -37,7 +37,7 @@ class Base { public: - Base( const QString &name ) : m_name( name ) {} + explicit Base( const QString &name ) : m_name( name ) {} virtual ~Base() {} // Meta::{Artist,Album,Composer,Genre,Year} methods: @@ -61,10 +61,10 @@ class Artist : public Meta::Artist, public Base { public: - Artist( const QString &name ) : MemoryMeta::Base( name ) {} + explicit Artist( const QString &name ) : MemoryMeta::Base( name ) {} - virtual QString name() const { return MemoryMeta::Base::name(); } - virtual Meta::TrackList tracks() { return MemoryMeta::Base::tracks(); } + QString name() const override { return MemoryMeta::Base::name(); } + Meta::TrackList tracks() override { return MemoryMeta::Base::tracks(); } }; class Album : public Meta::Album, public Base @@ -80,29 +80,29 @@ /** * Copy-like constructor for MapChanger */ - Album( const Meta::AlbumPtr &other ); + explicit Album( const Meta::AlbumPtr &other ); /* Meta::MetaCapability virtual methods */ - virtual bool hasCapabilityInterface( Capabilities::Capability::Type type ) const; - virtual Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ); + bool hasCapabilityInterface( Capabilities::Capability::Type type ) const override; + Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ) override; /* Meta::Base virtual methods */ - virtual QString name() const { return MemoryMeta::Base::name(); } + QString name() const override { return MemoryMeta::Base::name(); } /* Meta::Album virtual methods */ - virtual bool isCompilation() const { return m_isCompilation; } - virtual bool canUpdateCompilation() const { return m_canUpdateCompilation; } - virtual void setCompilation( bool isCompilation ); + bool isCompilation() const override { return m_isCompilation; } + bool canUpdateCompilation() const override { return m_canUpdateCompilation; } + void setCompilation( bool isCompilation ) override; - virtual bool hasAlbumArtist() const { return !m_albumArtist.isNull(); } - virtual Meta::ArtistPtr albumArtist() const { return m_albumArtist; } - virtual Meta::TrackList tracks() { return MemoryMeta::Base::tracks(); } + bool hasAlbumArtist() const override { return !m_albumArtist.isNull(); } + Meta::ArtistPtr albumArtist() const override { return m_albumArtist; } + Meta::TrackList tracks() override { return MemoryMeta::Base::tracks(); } - virtual bool hasImage( int /* size */ = 0 ) const { return !m_image.isNull(); } - virtual QImage image( int size = 0 ) const; - virtual bool canUpdateImage() const { return m_canUpdateImage; } - virtual void setImage( const QImage &image ); - virtual void removeImage(); + bool hasImage( int /* size */ = 0 ) const override { return !m_image.isNull(); } + QImage image( int size = 0 ) const override; + bool canUpdateImage() const override { return m_canUpdateImage; } + void setImage( const QImage &image ) override; + void removeImage() override; /* MemoryMeta::Album methods: */ /** @@ -122,91 +122,91 @@ class Composer : public Meta::Composer, public Base { public: - Composer( const QString &name ) : MemoryMeta::Base( name ) {} + explicit Composer( const QString &name ) : MemoryMeta::Base( name ) {} - virtual QString name() const { return MemoryMeta::Base::name(); } - virtual Meta::TrackList tracks() { return MemoryMeta::Base::tracks(); } + QString name() const override { return MemoryMeta::Base::name(); } + Meta::TrackList tracks() override { return MemoryMeta::Base::tracks(); } }; class Genre : public Meta::Genre, public Base { public: - Genre( const QString &name ) : MemoryMeta::Base( name ) {} + explicit Genre( const QString &name ) : MemoryMeta::Base( name ) {} - virtual QString name() const { return MemoryMeta::Base::name(); } - virtual Meta::TrackList tracks() { return MemoryMeta::Base::tracks(); } + QString name() const override { return MemoryMeta::Base::name(); } + Meta::TrackList tracks() override { return MemoryMeta::Base::tracks(); } }; class Year : public Meta::Year, public Base { public: - Year( const QString &name ) : MemoryMeta::Base( name ) {} + explicit Year( const QString &name ) : MemoryMeta::Base( name ) {} - virtual QString name() const { return MemoryMeta::Base::name(); } - virtual Meta::TrackList tracks() { return MemoryMeta::Base::tracks(); } + QString name() const override { return MemoryMeta::Base::name(); } + Meta::TrackList tracks() override { return MemoryMeta::Base::tracks(); } }; class AMAROK_EXPORT Track : public Meta::Track { public: - Track( const Meta::TrackPtr &originalTrack ); + explicit Track( const Meta::TrackPtr &originalTrack ); virtual ~Track(); /* Meta::MetaCapability methods */ - virtual bool hasCapabilityInterface( Capabilities::Capability::Type type ) const + bool hasCapabilityInterface( Capabilities::Capability::Type type ) const override { return m_track->hasCapabilityInterface( type ); } - virtual Capabilities::Capability *createCapabilityInterface( Capabilities::Capability::Type type ) + Capabilities::Capability *createCapabilityInterface( Capabilities::Capability::Type type ) override { return m_track->createCapabilityInterface( type ); } /* Meta::Base virtual methods */ - virtual QString name() const { return m_track->name(); } + QString name() const override { return m_track->name(); } /* Meta::Track virtual methods */ - virtual QUrl playableUrl() const { return m_track->playableUrl(); } - virtual QString prettyUrl() const { return m_track->prettyUrl(); } - virtual QString uidUrl() const { return m_track->uidUrl(); } - virtual QString notPlayableReason() const { return m_track->notPlayableReason(); } + QUrl playableUrl() const override { return m_track->playableUrl(); } + QString prettyUrl() const override { return m_track->prettyUrl(); } + QString uidUrl() const override { return m_track->uidUrl(); } + QString notPlayableReason() const override { return m_track->notPlayableReason(); } //these functions return the proxy track values - virtual Meta::AlbumPtr album() const { return m_album; } - virtual Meta::ArtistPtr artist() const { return m_artist; } - virtual Meta::ComposerPtr composer() const { return m_composer; } - virtual Meta::GenrePtr genre() const { return m_genre; } - virtual Meta::YearPtr year() const { return m_year; } + Meta::AlbumPtr album() const override { return m_album; } + Meta::ArtistPtr artist() const override { return m_artist; } + Meta::ComposerPtr composer() const override { return m_composer; } + Meta::GenrePtr genre() const override { return m_genre; } + Meta::YearPtr year() const override { return m_year; } //TODO:implement labels - virtual Meta::LabelList labels() const { return Meta::LabelList(); } - virtual qreal bpm() const { return m_track->bpm(); } - virtual QString comment() const { return m_track->comment(); } - virtual qint64 length() const { return m_track->length(); } - virtual int filesize() const { return m_track->filesize(); } - virtual int sampleRate() const { return m_track->sampleRate(); } - virtual int bitrate() const { return m_track->bitrate(); } - virtual QDateTime createDate() const { return m_track->createDate(); } - virtual QDateTime modifyDate() const { return m_track->modifyDate(); } - virtual int trackNumber() const { return m_track->trackNumber(); } - virtual int discNumber() const { return m_track->discNumber(); } - - virtual qreal replayGain( Meta::ReplayGainTag mode ) const + Meta::LabelList labels() const override { return Meta::LabelList(); } + qreal bpm() const override { return m_track->bpm(); } + QString comment() const override { return m_track->comment(); } + qint64 length() const override { return m_track->length(); } + int filesize() const override { return m_track->filesize(); } + int sampleRate() const override { return m_track->sampleRate(); } + int bitrate() const override { return m_track->bitrate(); } + QDateTime createDate() const override { return m_track->createDate(); } + QDateTime modifyDate() const override { return m_track->modifyDate(); } + int trackNumber() const override { return m_track->trackNumber(); } + int discNumber() const override { return m_track->discNumber(); } + + qreal replayGain( Meta::ReplayGainTag mode ) const override { return m_track->replayGain( mode ); } - virtual QString type() const { return m_track->type(); } + QString type() const override { return m_track->type(); } - virtual void prepareToPlay() { m_track->prepareToPlay(); } - virtual void finishedPlaying( double fraction ) { m_track->finishedPlaying( fraction ); } + void prepareToPlay() override { m_track->prepareToPlay(); } + void finishedPlaying( double fraction ) override { m_track->finishedPlaying( fraction ); } - virtual bool inCollection() const { return m_track->inCollection(); } - virtual Collections::Collection *collection() const { return m_track->collection(); } + bool inCollection() const override { return m_track->inCollection(); } + Collections::Collection *collection() const override { return m_track->collection(); } - virtual QString cachedLyrics() const { return m_track->cachedLyrics(); } - virtual void setCachedLyrics( const QString &lyrics ) { m_track->setCachedLyrics( lyrics ); } + QString cachedLyrics() const override { return m_track->cachedLyrics(); } + void setCachedLyrics( const QString &lyrics ) override { m_track->setCachedLyrics( lyrics ); } //TODO: implement labels - virtual void addLabel( const QString &label ) { Q_UNUSED( label ) } - virtual void addLabel( const Meta::LabelPtr &label ) { Q_UNUSED( label ) } - virtual void removeLabel( const Meta::LabelPtr &label ) { Q_UNUSED( label ) } + void addLabel( const QString &label ) override { Q_UNUSED( label ) } + void addLabel( const Meta::LabelPtr &label ) override { Q_UNUSED( label ) } + void removeLabel( const Meta::LabelPtr &label ) override { Q_UNUSED( label ) } - virtual Meta::TrackEditorPtr editor(); - virtual Meta::StatisticsPtr statistics(); + Meta::TrackEditorPtr editor() override; + Meta::StatisticsPtr statistics() override; // MemoryMeta::Track methods: @@ -264,7 +264,7 @@ class AMAROK_EXPORT MapChanger { public: - MapChanger( MemoryCollection *memoryCollection ); + explicit MapChanger( MemoryCollection *memoryCollection ); ~MapChanger(); /** diff --git a/src/core-impl/collections/support/MemoryMeta.cpp b/src/core-impl/collections/support/MemoryMeta.cpp --- a/src/core-impl/collections/support/MemoryMeta.cpp +++ b/src/core-impl/collections/support/MemoryMeta.cpp @@ -305,7 +305,7 @@ { /* Even if MemoryQueryMaker doesn't need albumArtists to be in MemoryCollection * maps, we add her into artist map so that album artist has the same instance as - * indentically-named artist (of potentially different tracks) */ + * identically-named artist (of potentially different tracks) */ albumArtist = m_mc->artistMap().value( albumArtistName ); if( !albumArtist ) { @@ -468,7 +468,7 @@ if( mapsNeedUpdating ) { - // we hold write lock so we can do the followin trick: + // we hold write lock so we can do the following trick: removeTrack( track ); addExistingTrack( originalTrack, memoryTrack ); } @@ -525,7 +525,7 @@ if( entitiesDiffer( first->albumArtist().data(), second->albumArtist().data() ) ) return true; - // we only compare images using dimension, it would be too costy otherwise + // we only compare images using dimension, it would be too costly otherwise if( first->image().width() != second->image().width() ) return true; if( first->image().height() != second->image().height() ) diff --git a/src/core-impl/collections/support/MemoryQueryMaker.h b/src/core-impl/collections/support/MemoryQueryMaker.h --- a/src/core-impl/collections/support/MemoryQueryMaker.h +++ b/src/core-impl/collections/support/MemoryQueryMaker.h @@ -44,40 +44,40 @@ * @param mc the MemoryCollection instance that the query should be run on. * @param collectionId the collectionid that has to be emitted by this querymaker. */ - MemoryQueryMaker( QWeakPointer mc, const QString &collectionId ); + MemoryQueryMaker( const QWeakPointer &mc, const QString &collectionId ); virtual ~MemoryQueryMaker(); - virtual void run() Q_DECL_OVERRIDE; - virtual void abortQuery(); + void run() override; + void abortQuery() override; - virtual QueryMaker* setQueryType( QueryType type ); + QueryMaker* setQueryType( QueryType type ) override; - virtual QueryMaker* addReturnValue( qint64 value ); - virtual QueryMaker* addReturnFunction( ReturnFunction function, qint64 value ); - virtual QueryMaker* orderBy( qint64 value, bool descending = false ); + QueryMaker* addReturnValue( qint64 value ) override; + QueryMaker* addReturnFunction( ReturnFunction function, qint64 value ) override; + QueryMaker* orderBy( qint64 value, bool descending = false ) override; - virtual QueryMaker* addMatch( const Meta::TrackPtr &track ); - virtual QueryMaker* addMatch( const Meta::ArtistPtr &artist, ArtistMatchBehaviour behaviour = TrackArtists ); - virtual QueryMaker* addMatch( const Meta::AlbumPtr &album ); - virtual QueryMaker* addMatch( const Meta::ComposerPtr &composer ); - virtual QueryMaker* addMatch( const Meta::GenrePtr &genre ); - virtual QueryMaker* addMatch( const Meta::YearPtr &year ); - virtual QueryMaker* addMatch( const Meta::LabelPtr &label ); + QueryMaker* addMatch( const Meta::TrackPtr &track ) override; + QueryMaker* addMatch( const Meta::ArtistPtr &artist, ArtistMatchBehaviour behaviour = TrackArtists ) override; + QueryMaker* addMatch( const Meta::AlbumPtr &album ) override; + QueryMaker* addMatch( const Meta::ComposerPtr &composer ) override; + QueryMaker* addMatch( const Meta::GenrePtr &genre ) override; + QueryMaker* addMatch( const Meta::YearPtr &year ) override; + QueryMaker* addMatch( const Meta::LabelPtr &label ) override; - virtual QueryMaker* addFilter( qint64 value, const QString &filter, bool matchBegin, bool matchEnd ); - virtual QueryMaker* excludeFilter( qint64 value, const QString &filter, bool matchBegin, bool matchEnd ); + QueryMaker* addFilter( qint64 value, const QString &filter, bool matchBegin, bool matchEnd ) override; + QueryMaker* excludeFilter( qint64 value, const QString &filter, bool matchBegin, bool matchEnd ) override; - virtual QueryMaker* addNumberFilter( qint64 value, qint64 filter, NumberComparison compare ); - virtual QueryMaker* excludeNumberFilter( qint64 value, qint64 filter, NumberComparison compare ); + QueryMaker* addNumberFilter( qint64 value, qint64 filter, NumberComparison compare ) override; + QueryMaker* excludeNumberFilter( qint64 value, qint64 filter, NumberComparison compare ) override; - virtual QueryMaker* limitMaxResultSize( int size ); + QueryMaker* limitMaxResultSize( int size ) override; - virtual QueryMaker* beginAnd(); - virtual QueryMaker* beginOr(); - virtual QueryMaker* endAndOr(); + QueryMaker* beginAnd() override; + QueryMaker* beginOr() override; + QueryMaker* endAndOr() override; - virtual QueryMaker* setAlbumQueryMode( AlbumQueryMode mode ); - virtual QueryMaker* setLabelQueryMode( LabelQueryMode mode ); + QueryMaker* setAlbumQueryMode( AlbumQueryMode mode ) override; + QueryMaker* setLabelQueryMode( LabelQueryMode mode ) override; private Q_SLOTS: void done( ThreadWeaver::JobPointer job ); diff --git a/src/core-impl/collections/support/MemoryQueryMaker.cpp b/src/core-impl/collections/support/MemoryQueryMaker.cpp --- a/src/core-impl/collections/support/MemoryQueryMaker.cpp +++ b/src/core-impl/collections/support/MemoryQueryMaker.cpp @@ -55,21 +55,21 @@ } protected: - void defaultBegin(const ThreadWeaver::JobPointer& self, ThreadWeaver::Thread *thread) + void defaultBegin(const ThreadWeaver::JobPointer& self, ThreadWeaver::Thread *thread) override { Q_EMIT started(self); ThreadWeaver::Job::defaultBegin(self, thread); } - void defaultEnd(const ThreadWeaver::JobPointer& self, ThreadWeaver::Thread *thread) + void defaultEnd(const ThreadWeaver::JobPointer& self, ThreadWeaver::Thread *thread) override { ThreadWeaver::Job::defaultEnd(self, thread); if (!self->success()) { Q_EMIT failed(self); } Q_EMIT done(self); } - void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread=0) + void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread=0) override { Q_UNUSED(self); Q_UNUSED(thread); @@ -111,7 +111,7 @@ QString collectionId; }; -MemoryQueryMaker::MemoryQueryMaker( QWeakPointer mc, const QString &collectionId ) +MemoryQueryMaker::MemoryQueryMaker( const QWeakPointer &mc, const QString &collectionId ) : QueryMaker() , m_collection( mc ) , d( new Private ) @@ -500,7 +500,7 @@ { ThreadWeaver::Queue::instance()->dequeue( job ); d->job = 0; - emit queryDone(); + Q_EMIT queryDone(); } QueryMaker * MemoryQueryMaker::setAlbumQueryMode( AlbumQueryMode mode ) diff --git a/src/core-impl/collections/support/MemoryQueryMakerInternal.h b/src/core-impl/collections/support/MemoryQueryMakerInternal.h --- a/src/core-impl/collections/support/MemoryQueryMakerInternal.h +++ b/src/core-impl/collections/support/MemoryQueryMakerInternal.h @@ -49,7 +49,7 @@ * can be safely deleted in the original thread while the query is still running. * @param collection the MemoryCollection instance that the query should be run on. */ - MemoryQueryMakerInternal( const QWeakPointer &collection ); + explicit MemoryQueryMakerInternal( const QWeakPointer &collection ); ~MemoryQueryMakerInternal(); diff --git a/src/core-impl/collections/support/MemoryQueryMakerInternal.cpp b/src/core-impl/collections/support/MemoryQueryMakerInternal.cpp --- a/src/core-impl/collections/support/MemoryQueryMakerInternal.cpp +++ b/src/core-impl/collections/support/MemoryQueryMakerInternal.cpp @@ -121,7 +121,7 @@ || ( m_albumQueryMode == QueryMaker::OnlyNormalAlbums && !track->album()->isCompilation()) ) && ( m_labelQueryMode == QueryMaker::NoConstraint || ( m_labelQueryMode == QueryMaker::OnlyWithLabels && track->labels().count() > 0 ) - || ( m_labelQueryMode == QueryMaker::OnlyWithoutLabels && track->labels().count() == 0) ) ) + || ( m_labelQueryMode == QueryMaker::OnlyWithoutLabels && track->labels().isEmpty()) ) ) { tracks.append( track ); } @@ -158,7 +158,7 @@ count++; } } - emit newResultReady( result ); + Q_EMIT newResultReady( result ); break; } case QueryMaker::Track : @@ -174,7 +174,7 @@ || ( m_albumQueryMode == QueryMaker::OnlyNormalAlbums && (album && !album->isCompilation()) ) ) && ( m_labelQueryMode == QueryMaker::NoConstraint || ( m_labelQueryMode == QueryMaker::OnlyWithLabels && track->labels().count() > 0 ) - || ( m_labelQueryMode == QueryMaker::OnlyWithoutLabels && track->labels().count() == 0) ) ) + || ( m_labelQueryMode == QueryMaker::OnlyWithoutLabels && track->labels().isEmpty()) ) ) { tracks.append( track ); } @@ -188,7 +188,7 @@ tracks = MemoryQueryMakerHelper::orderListByString( tracks, m_orderByField, m_orderDescending ); } - emit newTracksReady( tracks ); + Q_EMIT newTracksReady( tracks ); break; } case QueryMaker::Album : @@ -206,7 +206,7 @@ || ( m_albumQueryMode == QueryMaker::OnlyNormalAlbums && (album && !album->isCompilation()) ) ) && ( m_labelQueryMode == QueryMaker::NoConstraint || ( m_labelQueryMode == QueryMaker::OnlyWithLabels && track->labels().count() > 0 ) - || ( m_labelQueryMode == QueryMaker::OnlyWithoutLabels && track->labels().count() == 0) ) ) + || ( m_labelQueryMode == QueryMaker::OnlyWithoutLabels && track->labels().isEmpty()) ) ) { albums.append( album ); break; @@ -216,7 +216,7 @@ albums = MemoryQueryMakerHelper::orderListByName( albums, m_orderDescending ); - emit newAlbumsReady( albums ); + Q_EMIT newAlbumsReady( albums ); break; } case QueryMaker::Artist : @@ -233,15 +233,15 @@ || ( m_albumQueryMode == QueryMaker::OnlyNormalAlbums && !track->album()->isCompilation()) ) && ( m_labelQueryMode == QueryMaker::NoConstraint || ( m_labelQueryMode == QueryMaker::OnlyWithLabels && track->labels().count() > 0 ) - || ( m_labelQueryMode == QueryMaker::OnlyWithoutLabels && track->labels().count() == 0) ) ) + || ( m_labelQueryMode == QueryMaker::OnlyWithoutLabels && track->labels().isEmpty()) ) ) { artists.append( artist ); break; } } } artists = MemoryQueryMakerHelper::orderListByName( artists, m_orderDescending ); - emit newArtistsReady( artists ); + Q_EMIT newArtistsReady( artists ); break; } case QueryMaker::AlbumArtist : @@ -261,15 +261,15 @@ || ( m_albumQueryMode == QueryMaker::OnlyNormalAlbums && !album->isCompilation()) ) && ( m_labelQueryMode == QueryMaker::NoConstraint || ( m_labelQueryMode == QueryMaker::OnlyWithLabels && track->labels().count() > 0 ) - || ( m_labelQueryMode == QueryMaker::OnlyWithoutLabels && track->labels().count() == 0) ) ) + || ( m_labelQueryMode == QueryMaker::OnlyWithoutLabels && track->labels().isEmpty()) ) ) { artists.append( album->albumArtist() ); break; } } } artists = MemoryQueryMakerHelper::orderListByName( artists, m_orderDescending ); - emit newArtistsReady( artists ); + Q_EMIT newArtistsReady( artists ); break; } case QueryMaker::Composer : @@ -286,16 +286,16 @@ || ( m_albumQueryMode == QueryMaker::OnlyNormalAlbums && !track->album()->isCompilation()) ) && ( m_labelQueryMode == QueryMaker::NoConstraint || ( m_labelQueryMode == QueryMaker::OnlyWithLabels && track->labels().count() > 0 ) - || ( m_labelQueryMode == QueryMaker::OnlyWithoutLabels && track->labels().count() == 0) ) ) + || ( m_labelQueryMode == QueryMaker::OnlyWithoutLabels && track->labels().isEmpty()) ) ) { composers.append( composer ); break; } } } composers = MemoryQueryMakerHelper::orderListByName( composers, m_orderDescending ); - emit newComposersReady( composers ); + Q_EMIT newComposersReady( composers ); break; } case QueryMaker::Genre : @@ -312,7 +312,7 @@ || ( m_albumQueryMode == QueryMaker::OnlyNormalAlbums && !track->album()->isCompilation()) ) && ( m_labelQueryMode == QueryMaker::NoConstraint || ( m_labelQueryMode == QueryMaker::OnlyWithLabels && track->labels().count() > 0 ) - || ( m_labelQueryMode == QueryMaker::OnlyWithoutLabels && track->labels().count() == 0) ) ) + || ( m_labelQueryMode == QueryMaker::OnlyWithoutLabels && track->labels().isEmpty()) ) ) { genres.append( genre ); break; @@ -322,7 +322,7 @@ genres = MemoryQueryMakerHelper::orderListByName( genres, m_orderDescending ); - emit newGenresReady( genres ); + Q_EMIT newGenresReady( genres ); break; } case QueryMaker::Year : @@ -339,7 +339,7 @@ || ( m_albumQueryMode == QueryMaker::OnlyNormalAlbums && !track->album()->isCompilation()) ) && ( m_labelQueryMode == QueryMaker::NoConstraint || ( m_labelQueryMode == QueryMaker::OnlyWithLabels && track->labels().count() > 0 ) - || ( m_labelQueryMode == QueryMaker::OnlyWithoutLabels && track->labels().count() == 0) ) ) + || ( m_labelQueryMode == QueryMaker::OnlyWithoutLabels && track->labels().isEmpty()) ) ) { years.append( year ); break; @@ -354,7 +354,7 @@ years = MemoryQueryMakerHelper::orderListByYear( years, m_orderDescending ); } - emit newYearsReady( years ); + Q_EMIT newYearsReady( years ); break; } case QueryMaker::Label: @@ -371,7 +371,7 @@ || ( m_albumQueryMode == QueryMaker::OnlyNormalAlbums && !track->album()->isCompilation()) ) && ( m_labelQueryMode == QueryMaker::NoConstraint || ( m_labelQueryMode == QueryMaker::OnlyWithLabels && track->labels().count() > 0 ) - || ( m_labelQueryMode == QueryMaker::OnlyWithoutLabels && track->labels().count() == 0) ) ) + || ( m_labelQueryMode == QueryMaker::OnlyWithoutLabels && track->labels().isEmpty()) ) ) { labels.append( label ); break; @@ -381,7 +381,7 @@ labels = MemoryQueryMakerHelper::orderListByName( labels, m_orderDescending ); - emit newLabelsReady( labels ); + Q_EMIT newLabelsReady( labels ); break; } case QueryMaker::None : @@ -401,7 +401,7 @@ || ( m_albumQueryMode == QueryMaker::OnlyNormalAlbums && !track->album()->isCompilation()) ) && ( m_labelQueryMode == QueryMaker::NoConstraint || ( m_labelQueryMode == QueryMaker::OnlyWithLabels && track->labels().count() > 0 ) - || ( m_labelQueryMode == QueryMaker::OnlyWithoutLabels && track->labels().count() == 0) ) ) + || ( m_labelQueryMode == QueryMaker::OnlyWithoutLabels && track->labels().isEmpty()) ) ) { tracks.append( track ); } @@ -444,7 +444,7 @@ count++; } } - emit newResultReady( result ); + Q_EMIT newResultReady( result ); break; } case QueryMaker::Track : @@ -461,7 +461,7 @@ else newResult = tracks; - emit newTracksReady( newResult ); + Q_EMIT newTracksReady( newResult ); break; } case QueryMaker::Album : @@ -473,7 +473,7 @@ } Meta::AlbumList albumList = albumSet.toList(); albumList = MemoryQueryMakerHelper::orderListByName( albumList, m_orderDescending ); - emit newAlbumsReady( albumList ); + Q_EMIT newAlbumsReady( albumList ); break; } case QueryMaker::Artist : @@ -485,7 +485,7 @@ } Meta::ArtistList list = artistSet.toList(); list = MemoryQueryMakerHelper::orderListByName( list, m_orderDescending ); - emit newArtistsReady( list ); + Q_EMIT newArtistsReady( list ); break; } case QueryMaker::AlbumArtist : @@ -498,7 +498,7 @@ } Meta::ArtistList list = artistSet.toList(); list = MemoryQueryMakerHelper::orderListByName( list, m_orderDescending ); - emit newArtistsReady( list ); + Q_EMIT newArtistsReady( list ); break; } case QueryMaker::Genre : @@ -510,7 +510,7 @@ } Meta::GenreList list = genreSet.toList(); list = MemoryQueryMakerHelper::orderListByName( list, m_orderDescending ); - emit newGenresReady( list ); + Q_EMIT newGenresReady( list ); break; } case QueryMaker::Composer : @@ -522,7 +522,7 @@ } Meta::ComposerList list = composerSet.toList(); list = MemoryQueryMakerHelper::orderListByName( list, m_orderDescending ); - emit newComposersReady( list ); + Q_EMIT newComposersReady( list ); break; } case QueryMaker::Year : @@ -538,7 +538,7 @@ years = MemoryQueryMakerHelper::orderListByYear( years, m_orderDescending ); } - emit newYearsReady( years ); + Q_EMIT newYearsReady( years ); break; } case QueryMaker::Label: @@ -553,7 +553,7 @@ { labels = MemoryQueryMakerHelper::orderListByName( labels, m_orderDescending ); } - emit newLabelsReady( labels ); + Q_EMIT newLabelsReady( labels ); break; } case QueryMaker::None: diff --git a/src/core-impl/collections/support/TextualQueryFilter.cpp b/src/core-impl/collections/support/TextualQueryFilter.cpp --- a/src/core-impl/collections/support/TextualQueryFilter.cpp +++ b/src/core-impl/collections/support/TextualQueryFilter.cpp @@ -173,7 +173,7 @@ } /* * A special case is made for Equals (e.g. filesize:100), which actually filters - * for anything beween 100 and 101MBs. Megabytes are used because for audio files + * for anything between 100 and 101MBs. Megabytes are used because for audio files * they are the most reasonable units for the user to deal with. */ const qreal bytes = mbytes * 1024.0 * 1024.0; @@ -257,7 +257,7 @@ Collections::semanticDateTimeParser( const QString &text, bool *absolute ) { /* TODO: semanticDateTimeParser: has potential to extend and form a class of its own */ - // some code duplications, see EditFilterDialog::parseTextFilter + // some code duplication, see EditFilterDialog::parseTextFilter const QString lowerText = text.toLower(); const QDateTime curTime = QDateTime::currentDateTime(); @@ -274,15 +274,15 @@ if( text.at(0).isLetter() ) { - if( ( lowerText.compare( "today" ) == 0 ) || ( lowerText.compare( i18n( "today" ) ) == 0 ) ) + if( ( lowerText.compare( QLatin1String("today") ) == 0 ) || ( lowerText.compare( i18n( "today" ) ) == 0 ) ) result = curTime.addDays( -1 ); - else if( ( lowerText.compare( "last week" ) == 0 ) || ( lowerText.compare( i18n( "last week" ) ) == 0 ) ) + else if( ( lowerText.compare( QLatin1String("last week") ) == 0 ) || ( lowerText.compare( i18n( "last week" ) ) == 0 ) ) result = curTime.addDays( -7 ); - else if( ( lowerText.compare( "last month" ) == 0 ) || ( lowerText.compare( i18n( "last month" ) ) == 0 ) ) + else if( ( lowerText.compare( QLatin1String("last month") ) == 0 ) || ( lowerText.compare( i18n( "last month" ) ) == 0 ) ) result = curTime.addMonths( -1 ); - else if( ( lowerText.compare( "two months ago" ) == 0 ) || ( lowerText.compare( i18n( "two months ago" ) ) == 0 ) ) + else if( ( lowerText.compare( QLatin1String("two months ago") ) == 0 ) || ( lowerText.compare( i18n( "two months ago" ) ) == 0 ) ) result = curTime.addMonths( -2 ); - else if( ( lowerText.compare( "three months ago" ) == 0 ) || ( lowerText.compare( i18n( "three months ago" ) ) == 0 ) ) + else if( ( lowerText.compare( QLatin1String("three months ago") ) == 0 ) || ( lowerText.compare( i18n( "three months ago" ) ) == 0 ) ) result = curTime.addMonths( -3 ); } else if( result.isValid() ) diff --git a/src/core-impl/collections/support/TrashCollectionLocation.h b/src/core-impl/collections/support/TrashCollectionLocation.h --- a/src/core-impl/collections/support/TrashCollectionLocation.h +++ b/src/core-impl/collections/support/TrashCollectionLocation.h @@ -26,7 +26,7 @@ /** * Utility class that allows moving tracks to the KIO trash using standard - * CollectionLocation API. It is not intented to be a collection, but more + * CollectionLocation API. It is not intended to be a collection, but more * as a black hole destination. */ class TrashCollectionLocation : public CollectionLocation @@ -37,14 +37,14 @@ TrashCollectionLocation(); ~TrashCollectionLocation(); - QString prettyLocation() const; - bool isWritable() const; + QString prettyLocation() const override; + bool isWritable() const override; protected: void copyUrlsToCollection( const QMap &sources, - const Transcoding::Configuration &configuration ); + const Transcoding::Configuration &configuration ) override; void showDestinationDialog( const Meta::TrackList &tracks, bool removeSources, - const Transcoding::Configuration &configuration ); + const Transcoding::Configuration &configuration ) override; private Q_SLOTS: void slotTrashJobFinished( KJob *job ); diff --git a/src/core-impl/collections/support/TrashCollectionLocation.cpp b/src/core-impl/collections/support/TrashCollectionLocation.cpp --- a/src/core-impl/collections/support/TrashCollectionLocation.cpp +++ b/src/core-impl/collections/support/TrashCollectionLocation.cpp @@ -19,7 +19,7 @@ #include "TrashCollectionLocation.h" #include "core/collections/CollectionLocationDelegate.h" -#include "core/interfaces/Logger.h" +#include "core/logger/Logger.h" #include "core/support/Components.h" #include "core/support/Debug.h" @@ -91,14 +91,14 @@ int max = 3; while( !tracks.isEmpty() && (max > 0) ) { - name += QString( ", %1" ).arg( tracks.takeFirst()->prettyName() ); + name += QStringLiteral( ", %1" ).arg( tracks.takeFirst()->prettyName() ); --max; } if( max == 0 && !tracks.isEmpty() ) - name += " ..."; + name += QLatin1String(" ..."); } - Amarok::Components::logger()->newProgressOperation( job, i18n( "Moving to trash: %1", name ) ); + Amarok::Logger::newProgressOperation( job, i18n( "Moving to trash: %1", name ) ); } } diff --git a/src/core-impl/collections/support/XmlQueryReader.cpp b/src/core-impl/collections/support/XmlQueryReader.cpp --- a/src/core-impl/collections/support/XmlQueryReader.cpp +++ b/src/core-impl/collections/support/XmlQueryReader.cpp @@ -74,7 +74,7 @@ //so fail if we find more than one if( name() == "query" ) { - if( attributes().value( "version" ) == "1.0" ) + if( attributes().value( QStringLiteral("version") ) == "1.0" ) { queryCount++; readQuery(); @@ -100,8 +100,8 @@ else if( name() == "order" ) { QXmlStreamAttributes attr = attributes(); - QStringRef fieldStr = attr.value( "field" ); - QStringRef valueStr = attr.value( "value" ); + QStringRef fieldStr = attr.value( QStringLiteral("field") ); + QStringRef valueStr = attr.value( QStringLiteral("value") ); qint64 field = Meta::fieldForName( fieldStr.toString() ); bool descending = valueStr == "descending"; @@ -111,7 +111,7 @@ } else if( name() == "limit" ) { - QStringRef value = attributes().value( "value" ); + QStringRef value = attributes().value( QStringLiteral("value") ); if( !value.isEmpty() ) d->qm->limitMaxResultSize( value.toString().toInt() ); } @@ -225,10 +225,10 @@ QXmlStreamAttributes attr = reader->attributes(); filter.exclude = (reader->name() != "include"); - filter.field = Meta::fieldForName( attr.value( "field" ).toString() ); - filter.value = attr.value( "value" ).toString(); + filter.field = Meta::fieldForName( attr.value( QStringLiteral("field") ).toString() ); + filter.value = attr.value( QStringLiteral("value") ).toString(); - QStringRef compareStr = attr.value( "compare" ); + QStringRef compareStr = attr.value( QStringLiteral("compare") ); if( compareStr.isEmpty() ) filter.compare = -1; else diff --git a/src/core-impl/collections/support/jobs/WriteTagsJob.h b/src/core-impl/collections/support/jobs/WriteTagsJob.h --- a/src/core-impl/collections/support/jobs/WriteTagsJob.h +++ b/src/core-impl/collections/support/jobs/WriteTagsJob.h @@ -39,11 +39,11 @@ public: WriteTagsJob( const QString &path, const Meta::FieldHash &changes, bool respectConfig = true ); - virtual void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) Q_DECL_OVERRIDE; + void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) override; protected: - void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; - void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; + void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; + void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; Q_SIGNALS: /** This signal is emitted when this job is being processed by a thread. */ diff --git a/src/core-impl/collections/umscollection/CMakeLists.txt b/src/core-impl/collections/umscollection/CMakeLists.txt --- a/src/core-impl/collections/umscollection/CMakeLists.txt +++ b/src/core-impl/collections/umscollection/CMakeLists.txt @@ -37,6 +37,6 @@ install(TARGETS amarok_collection-umscollection DESTINATION - ${PLUGIN_INSTALL_DIR} ) + ${KDE_INSTALL_PLUGINDIR} ) kcoreaddons_desktop_to_json(amarok_collection-umscollection amarok_collection-umscollection.desktop SERVICE_TYPES ${CMAKE_SOURCE_DIR}/src/amarok-plugin.desktop) diff --git a/src/core-impl/collections/umscollection/UmsCollection.h b/src/core-impl/collections/umscollection/UmsCollection.h --- a/src/core-impl/collections/umscollection/UmsCollection.h +++ b/src/core-impl/collections/umscollection/UmsCollection.h @@ -33,7 +33,6 @@ class GenericScanManager; class UmsPodcastProvider; class UmsCollection; -class UmsCollectionLocation; class QAction; using namespace Collections; @@ -48,7 +47,7 @@ UmsCollectionFactory(); virtual ~UmsCollectionFactory(); - virtual void init(); + void init() override; private Q_SLOTS: /** @@ -88,7 +87,7 @@ /** * Attempts to create appropriate collection for already identified solid device - * @param udi. Should emit newCollection() if the collection was successfully + * @param udi. Should Q_EMIT newCollection() if the collection was successfully * created and should become visible to the user. */ void createCollectionForSolidDevice( const QString &udi ); @@ -104,36 +103,36 @@ public: // inherited methods - UmsCollection( Solid::Device device ); + explicit UmsCollection( const Solid::Device &device ); virtual ~UmsCollection(); /* TrackProvider methods */ - virtual bool possiblyContainsTrack( const QUrl &url ) const; - virtual Meta::TrackPtr trackForUrl( const QUrl &url ); + bool possiblyContainsTrack( const QUrl &url ) const override; + Meta::TrackPtr trackForUrl( const QUrl &url ) override; /* Collection methods */ - virtual QueryMaker *queryMaker(); - virtual QString uidUrlProtocol() const; + QueryMaker *queryMaker() override; + QString uidUrlProtocol() const override; - virtual QString collectionId() const; - virtual QString prettyName() const; - virtual QIcon icon() const; + QString collectionId() const override; + QString prettyName() const override; + QIcon icon() const override; - virtual bool hasCapacity() const; - virtual float usedCapacity() const; - virtual float totalCapacity() const; + bool hasCapacity() const override; + float usedCapacity() const override; + float totalCapacity() const override; - virtual CollectionLocation *location(); + CollectionLocation *location() override; - virtual bool isOrganizable() const; + bool isOrganizable() const override; /* Capability-related methods */ - virtual bool hasCapabilityInterface( Capabilities::Capability::Type type ) const; - virtual Capabilities::Capability *createCapabilityInterface( - Capabilities::Capability::Type type ); + bool hasCapabilityInterface( Capabilities::Capability::Type type ) const override; + Capabilities::Capability *createCapabilityInterface( + Capabilities::Capability::Type type ) override; /* Meta::Observer methods */ - virtual void metadataChanged( Meta::TrackPtr track ); + void metadataChanged( const Meta::TrackPtr &track ) override; using Meta::Observer::metadataChanged; // silence compiler warning about hidder overloads /* own methods */ @@ -146,15 +145,15 @@ * @param fileExtension new extension to use. Leave empty if you don't wish to * change file extension */ - QUrl organizedUrl( Meta::TrackPtr track, const QString &fileExtension = QString() ) const; + QUrl organizedUrl( const Meta::TrackPtr &track, const QString &fileExtension = QString() ) const; QSharedPointer memoryCollection() const { return m_mc; } Q_SIGNALS: /** * Start a count-down that emits updated() signal after it expires. * Resets the timer to original timeout if already running. This is to ensure - * that we emit update() max. once per for batch updates. + * that we Q_EMIT update() max. once per \ for batch updates. * * Timers can only be started from "their" thread so use signals & slots for that. */ @@ -171,12 +170,12 @@ */ void slotEject(); - void slotTrackAdded( QUrl trackLocation ); + void slotTrackAdded( const QUrl &trackLocation ); void slotTrackRemoved( const Meta::TrackPtr &track ); private Q_SLOTS: /** - * Update m_lastUpdated timestamp and emit updated() + * Update m_lastUpdated timestamp and Q_EMIT updated() */ void collectionUpdated(); @@ -187,7 +186,7 @@ void slotDirectoryScanned( QSharedPointer dir ); /** - * Starts a timer that ensures we emit updated() signal sometime in future. + * Starts a timer that ensures we Q_EMIT updated() signal sometime in future. */ void slotStartUpdateTimer(); diff --git a/src/core-impl/collections/umscollection/UmsCollection.cpp b/src/core-impl/collections/umscollection/UmsCollection.cpp --- a/src/core-impl/collections/umscollection/UmsCollection.cpp +++ b/src/core-impl/collections/umscollection/UmsCollection.cpp @@ -22,7 +22,7 @@ #include "ui_UmsConfiguration.h" #include "collectionscanner/Track.h" #include "core/capabilities/ActionsCapability.h" -#include "core/interfaces/Logger.h" +#include "core/logger/Logger.h" #include "core/meta/Meta.h" #include "core/support/Components.h" #include "core/support/Debug.h" @@ -133,7 +133,7 @@ Solid::Device device( udi ); if( !device.is() ) return false; - // HACK to exlude iPods until UMS and iPod have common collection factory + // HACK to exclude iPods until UMS and iPod have common collection factory if( device.vendor().contains( "Apple", Qt::CaseInsensitive ) ) return false; @@ -201,7 +201,7 @@ // fail if we hold some files on the device open, we try to tearDown the device too. connect( ssa, &Solid::StorageAccess::teardownRequested, this, &UmsCollectionFactory::slotRemoveAndTeardownSolidDevice ); - emit newCollection( collection ); + Q_EMIT newCollection( collection ); } //UmsCollection @@ -220,7 +220,7 @@ QString UmsCollection::s_collectionName( "collection_name" ); QString UmsCollection::s_transcodingGroup( "transcoding" ); -UmsCollection::UmsCollection( Solid::Device device ) +UmsCollection::UmsCollection( const Solid::Device &device ) : Collection() , m_device( device ) , m_mc( 0 ) @@ -274,21 +274,21 @@ debug() << "Mounted at: " << m_mountPoint << "collection id:" << m_collectionId; // read .is_audio_player from filesystem - KConfig config( m_mountPoint + '/' + s_settingsFileName, KConfig::SimpleConfig ); + KConfig config( m_mountPoint + QLatin1Char('/') + s_settingsFileName, KConfig::SimpleConfig ); KConfigGroup entries = config.group( QString() ); // default group if( entries.hasKey( s_musicFolderKey ) ) { m_musicUrl = QUrl::fromLocalFile( m_mountPoint ); m_musicUrl = m_musicUrl.adjusted(QUrl::StripTrailingSlash); - m_musicUrl.setPath(m_musicUrl.path() + '/' + ( entries.readPathEntry( s_musicFolderKey, QString() ) )); + m_musicUrl.setPath(m_musicUrl.path() + QLatin1Char('/') + ( entries.readPathEntry( s_musicFolderKey, QString() ) )); m_musicUrl.setPath( QDir::cleanPath(m_musicUrl.path()) ); if( !QDir( m_musicUrl.toLocalFile() ).exists() ) { QString message = i18n( "File %1 suggests that we should use %2 " "as music folder on the device, but it doesn't exist. Falling back to " - "%3 instead", m_mountPoint + '/' + s_settingsFileName, + "%3 instead", m_mountPoint + QLatin1Char('/') + s_settingsFileName, m_musicUrl.toLocalFile(), m_mountPoint ); - Amarok::Components::logger()->longMessage( message, Amarok::Logger::Warning ); + Amarok::Logger::longMessage( message, Amarok::Logger::Warning ); m_musicUrl = QUrl::fromLocalFile(m_mountPoint); } } @@ -309,16 +309,16 @@ { m_podcastUrl = QUrl::fromLocalFile( m_mountPoint ); m_podcastUrl = m_podcastUrl.adjusted(QUrl::StripTrailingSlash); - m_podcastUrl.setPath(m_podcastUrl.path() + '/' + ( entries.readPathEntry( s_podcastFolderKey, QString() ) )); + m_podcastUrl.setPath(m_podcastUrl.path() + QLatin1Char('/') + ( entries.readPathEntry( s_podcastFolderKey, QString() ) )); m_podcastUrl.setPath( QDir::cleanPath(m_podcastUrl.path()) ); } m_autoConnect = entries.readEntry( s_autoConnectKey, m_autoConnect ); m_collectionName = entries.readEntry( s_collectionName, m_collectionName ); m_mc = QSharedPointer(new MemoryCollection()); if( m_autoConnect ) - QTimer::singleShot( 0, this, SLOT(slotParseTracks()) ); + QTimer::singleShot( 0, this, &UmsCollection::slotParseTracks ); } bool @@ -354,7 +354,7 @@ QString UmsCollection::uidUrlProtocol() const { - return QString( "file://" ); + return QStringLiteral( "file://" ); } QString @@ -461,23 +461,23 @@ return new Capabilities::ActionsCapability( actions ); } case Capabilities::Capability::Transcode: - return new UmsTranscodeCapability( m_mountPoint + '/' + s_settingsFileName, + return new UmsTranscodeCapability( m_mountPoint + QLatin1Char('/') + s_settingsFileName, s_transcodingGroup ); default: - return 0; + return nullptr; } } void -UmsCollection::metadataChanged( Meta::TrackPtr track ) +UmsCollection::metadataChanged(const Meta::TrackPtr &track ) { if( MemoryMeta::MapChanger( m_mc.data() ).trackChanged( track ) ) // big-enough change: - emit startUpdateTimer(); + Q_EMIT startUpdateTimer(); } QUrl -UmsCollection::organizedUrl( Meta::TrackPtr track, const QString &fileExtension ) const +UmsCollection::organizedUrl( const Meta::TrackPtr &track, const QString &fileExtension ) const { TrackOrganizer trackOrganizer( Meta::TrackList() << track ); //%folder% prefix required to get absolute url. @@ -500,7 +500,7 @@ //TODO: stop scanner if running //unregister PlaylistProvider //CollectionManager will call destructor. - emit remove(); + Q_EMIT remove(); } void @@ -512,7 +512,7 @@ } void -UmsCollection::slotTrackAdded( QUrl location ) +UmsCollection::slotTrackAdded( const QUrl &location ) { Q_ASSERT( m_musicUrl.isParentOf( location ) || m_musicUrl.matches( location , QUrl::StripTrailingSlash) ); MetaFile::Track *fileTrack = new MetaFile::Track( location ); @@ -522,7 +522,7 @@ if( proxyTrack ) { subscribeTo( fileTrackPtr ); - emit startUpdateTimer(); + Q_EMIT startUpdateTimer(); } else warning() << __PRETTY_FUNCTION__ << "Failed to add" << fileTrackPtr->playableUrl() @@ -538,7 +538,7 @@ unsubscribeFrom( removedTrack ); // we only added MetaFile::Tracks, following static cast is safe static_cast( removedTrack.data() )->setCollection( 0 ); - emit startUpdateTimer(); + Q_EMIT startUpdateTimer(); } else warning() << __PRETTY_FUNCTION__ << "Failed to remove" << track->playableUrl() @@ -549,7 +549,7 @@ UmsCollection::collectionUpdated() { m_lastUpdated = QDateTime::currentMSecsSinceEpoch(); - emit updated(); + Q_EMIT updated(); } void @@ -570,7 +570,7 @@ UmsCollection::slotParseActionTriggered() { if( m_mc->trackMap().isEmpty() ) - QTimer::singleShot( 0, this, SLOT(slotParseTracks()) ); + QTimer::singleShot( 0, this, &UmsCollection::slotParseTracks ); } void @@ -679,10 +679,10 @@ m_autoConnect = settings->m_autoConnect->isChecked(); if( !m_musicUrl.isEmpty() && m_autoConnect ) - QTimer::singleShot( 0, this, SLOT(slotParseTracks()) ); + QTimer::singleShot( 0, this, &UmsCollection::slotParseTracks ); // write the data to the on-disk file - KConfig config( m_mountPoint + '/' + s_settingsFileName, KConfig::SimpleConfig ); + KConfig config( m_mountPoint + QLatin1Char('/') + s_settingsFileName, KConfig::SimpleConfig ); KConfigGroup entries = config.group( QString() ); // default group if( !m_musicUrl.isEmpty() ) entries.writePathEntry( s_musicFolderKey, QDir( m_mountPoint ).relativeFilePath( m_musicUrl.toLocalFile() )); @@ -722,7 +722,7 @@ foreach( const CollectionScanner::Track *scannerTrack, dir->tracks() ) { //TODO: use proxy tracks so no real file read is required - // following method calls startUpdateTimer(), no need to emit updated() + // following method calls startUpdateTimer(), no need to Q_EMIT updated() slotTrackAdded( QUrl::fromLocalFile(scannerTrack->path()) ); } diff --git a/src/core-impl/collections/umscollection/UmsCollectionLocation.h b/src/core-impl/collections/umscollection/UmsCollectionLocation.h --- a/src/core-impl/collections/umscollection/UmsCollectionLocation.h +++ b/src/core-impl/collections/umscollection/UmsCollectionLocation.h @@ -32,18 +32,18 @@ { Q_OBJECT public: - UmsCollectionLocation( UmsCollection *umsCollection ); + explicit UmsCollectionLocation( UmsCollection *umsCollection ); ~UmsCollectionLocation(); /* CollectionLocation methods */ - virtual QString prettyLocation() const; - virtual QStringList actualLocation() const; - virtual bool isWritable() const; - virtual bool isOrganizable() const; + QString prettyLocation() const override; + QStringList actualLocation() const override; + bool isWritable() const override; + bool isOrganizable() const override; - virtual void copyUrlsToCollection( const QMap &sources, - const Transcoding::Configuration &configuration ); - virtual void removeUrlsFromCollection( const Meta::TrackList &sources ); + void copyUrlsToCollection( const QMap &sources, + const Transcoding::Configuration &configuration ) override; + void removeUrlsFromCollection( const Meta::TrackList &sources ) override; protected Q_SLOTS: void slotRemoveOperationFinished(); // hides intentionally parent methods @@ -67,11 +67,11 @@ void addCopy( const QUrl &from, const QUrl &to ); void addTranscode( const QUrl &from, const QUrl &to ); - virtual void start(); + void start() override; Q_SIGNALS: - void sourceFileTransferDone( QUrl source ); - void fileTransferDone( QUrl destination ); + void sourceFileTransferDone( const QUrl &source ); + void fileTransferDone( const QUrl &destination ); public Q_SLOTS: void slotCancel(); @@ -81,7 +81,7 @@ void slotChildJobPercent( KJob *job, unsigned long percentage ); //reimplemented from KCompositeJob - virtual void slotResult( KJob *job ); + void slotResult( KJob *job ) override; private: UmsCollectionLocation *m_location; diff --git a/src/core-impl/collections/umscollection/UmsCollectionLocation.cpp b/src/core-impl/collections/umscollection/UmsCollectionLocation.cpp --- a/src/core-impl/collections/umscollection/UmsCollectionLocation.cpp +++ b/src/core-impl/collections/umscollection/UmsCollectionLocation.cpp @@ -18,7 +18,7 @@ #include "core/support/Components.h" #include "core/support/Debug.h" -#include "core/interfaces/Logger.h" +#include "core/logger/Logger.h" #include "core/transcoding/TranscodingController.h" #include "core-impl/meta/file/File.h" #include "transcoding/TranscodingJob.h" @@ -107,8 +107,8 @@ this, &UmsCollectionLocation::slotCopyOperationFinished ); QString loggerText = operationInProgressText( configuration, sources.count(), m_umsCollection->prettyName() ); - Amarok::Components::logger()->newProgressOperation( transferJob, loggerText, transferJob, - SLOT(slotCancel()) ); + Amarok::Logger::newProgressOperation( transferJob, loggerText, transferJob, + &UmsTransferJob::slotCancel ); transferJob->start(); } @@ -127,7 +127,7 @@ "Removing %1 tracks from %2", sourceUrls.count(), m_umsCollection->prettyName() ); KIO::DeleteJob *delJob = KIO::del( sourceUrls, KIO::HideProgressInfo ); - Amarok::Components::logger()->newProgressOperation( delJob, loggerText, delJob, SLOT(kill()) ); + Amarok::Logger::newProgressOperation( delJob, loggerText, delJob, &KIO::DeleteJob::kill, Qt::AutoConnection, KIO::Job::Quietly ); connect( delJob, &KIO::DeleteJob::finished, this, &UmsCollectionLocation::slotRemoveOperationFinished ); } @@ -251,21 +251,21 @@ Transcoding::Job *transcodingJob = dynamic_cast( job ); if( copyJob ) { - emit sourceFileTransferDone( copyJob->srcUrl() ); - emit fileTransferDone( copyJob->destUrl() ); + Q_EMIT sourceFileTransferDone( copyJob->srcUrl() ); + Q_EMIT fileTransferDone( copyJob->destUrl() ); } else if( transcodingJob ) { - emit sourceFileTransferDone( transcodingJob->srcUrl() ); - emit fileTransferDone( transcodingJob->destUrl() ); + Q_EMIT sourceFileTransferDone( transcodingJob->srcUrl() ); + Q_EMIT fileTransferDone( transcodingJob->destUrl() ); } else Debug::warning() << __PRETTY_FUNCTION__ << "invalid job passed to me!"; } else Debug::warning() << __PRETTY_FUNCTION__ << "job failed with" << job->error(); - // transcoding job currently doesn't emit percentage, so emit it at least once for track + // transcoding job currently doesn't Q_EMIT percentage, so Q_EMIT it at least once for track emitPercent( m_totalTracks - ( m_transcodeList.size() + m_copyList.size() ), m_totalTracks ); startNextJob(); diff --git a/src/core-impl/collections/umscollection/UmsTranscodeCapability.h b/src/core-impl/collections/umscollection/UmsTranscodeCapability.h --- a/src/core-impl/collections/umscollection/UmsTranscodeCapability.h +++ b/src/core-impl/collections/umscollection/UmsTranscodeCapability.h @@ -28,8 +28,8 @@ UmsTranscodeCapability( const QString &configFilePath, const QString &groupName ); virtual ~UmsTranscodeCapability(); - virtual Transcoding::Configuration savedConfiguration(); - virtual void setSavedConfiguration(const Transcoding::Configuration& configuration); + Transcoding::Configuration savedConfiguration() override; + void setSavedConfiguration(const Transcoding::Configuration& configuration) override; private: Q_DISABLE_COPY( UmsTranscodeCapability ) diff --git a/src/core-impl/collections/umscollection/amarok_collection-umscollection.desktop b/src/core-impl/collections/umscollection/amarok_collection-umscollection.desktop --- a/src/core-impl/collections/umscollection/amarok_collection-umscollection.desktop +++ b/src/core-impl/collections/umscollection/amarok_collection-umscollection.desktop @@ -48,7 +48,6 @@ Name[tr]=Evrensel Yığın Depolama Koleksiyonu Name[uk]=Універсальна збірка на носії даних Name[x-test]=xxUniversal Mass Storage Collectionxx -Name[zh_CN]=通用大容量存储收藏 Name[zh_TW]=通用大容量儲存裝置收藏 ServiceTypes=Amarok/Plugin diff --git a/src/core-impl/collections/umscollection/podcasts/UmsPodcastMeta.h b/src/core-impl/collections/umscollection/podcasts/UmsPodcastMeta.h --- a/src/core-impl/collections/umscollection/podcasts/UmsPodcastMeta.h +++ b/src/core-impl/collections/umscollection/podcasts/UmsPodcastMeta.h @@ -42,33 +42,33 @@ friend class UmsPodcastProvider; public: - static UmsPodcastEpisodePtr fromPodcastEpisodePtr( Podcasts::PodcastEpisodePtr episode ); - static UmsPodcastEpisodePtr fromTrackPtr( Meta::TrackPtr track ); - static Podcasts::PodcastEpisodePtr toPodcastEpisodePtr( UmsPodcastEpisodePtr episode ); + static UmsPodcastEpisodePtr fromPodcastEpisodePtr( const Podcasts::PodcastEpisodePtr &episode ); + static UmsPodcastEpisodePtr fromTrackPtr( const Meta::TrackPtr &track ); + static Podcasts::PodcastEpisodePtr toPodcastEpisodePtr( const UmsPodcastEpisodePtr &episode ); static Podcasts::PodcastEpisodeList toPodcastEpisodeList( UmsPodcastEpisodeList episodes ); - UmsPodcastEpisode( UmsPodcastChannelPtr channel ); + explicit UmsPodcastEpisode( const UmsPodcastChannelPtr &channel ); ~UmsPodcastEpisode(); - void setLocalFile( MetaFile::TrackPtr localFile ); + void setLocalFile( const MetaFile::TrackPtr &localFile ); //PodcastEpisode methods - virtual QString title() const; - virtual void setLocalUrl( const QUrl &localUrl ); + QString title() const override; + void setLocalUrl( const QUrl &localUrl ) override; //Track Methods - virtual QString name() const { return title(); } - virtual QUrl playableUrl() const; - virtual QString notPlayableReason() const; - virtual QString prettyName() const { return name(); } - virtual void setTitle( const QString &title ); - virtual QDateTime createDate() const; - - virtual Meta::AlbumPtr album() const; - virtual Meta::ArtistPtr artist() const; - virtual Meta::ComposerPtr composer() const; - virtual Meta::GenrePtr genre() const; - virtual Meta::YearPtr year() const; + QString name() const override { return title(); } + QUrl playableUrl() const override; + QString notPlayableReason() const override; + QString prettyName() const override { return name(); } + void setTitle( const QString &title ) override; + QDateTime createDate() const override; + + Meta::AlbumPtr album() const override; + Meta::ArtistPtr artist() const override; + Meta::ComposerPtr composer() const override; + Meta::GenrePtr genre() const override; + Meta::YearPtr year() const override; private: MetaFile::TrackPtr m_localFile; @@ -80,29 +80,29 @@ friend class UmsPodcastProvider; public: static UmsPodcastChannelPtr fromPodcastChannelPtr( - Podcasts::PodcastChannelPtr channel ); - static Podcasts::PodcastChannelPtr toPodcastChannelPtr( UmsPodcastChannelPtr channel ); + const Podcasts::PodcastChannelPtr &channel ); + static Podcasts::PodcastChannelPtr toPodcastChannelPtr( const UmsPodcastChannelPtr &channel ); static Podcasts::PodcastChannelList toPodcastChannelList( UmsPodcastChannelList umsChannels ); - UmsPodcastChannel( UmsPodcastProvider *provider ); + explicit UmsPodcastChannel( UmsPodcastProvider *provider ); UmsPodcastChannel( Podcasts::PodcastChannelPtr channel, UmsPodcastProvider *provider ); - ~UmsPodcastChannel(); + ~UmsPodcastChannel() override; - virtual Podcasts::PodcastEpisodePtr addEpisode( Podcasts::PodcastEpisodePtr episode ); + Podcasts::PodcastEpisodePtr addEpisode( const Podcasts::PodcastEpisodePtr &episode ) override; UmsPodcastEpisodeList umsEpisodes() { return m_umsEpisodes; } void addUmsEpisode( UmsPodcastEpisodePtr episode ); void setPlaylistFileSource( const QUrl &playlistFilePath ); QUrl playlistFilePath() const { return m_playlistFilePath; } - virtual Podcasts::PodcastEpisodeList episodes() const + Podcasts::PodcastEpisodeList episodes() const override { return UmsPodcastEpisode::toPodcastEpisodeList( m_umsEpisodes ); } - virtual Playlists::PlaylistProvider *provider() const; + Playlists::PlaylistProvider *provider() const override; protected: - void removeEpisode( UmsPodcastEpisodePtr episode ); + void removeEpisode( const UmsPodcastEpisodePtr &episode ); private: UmsPodcastProvider *m_provider; diff --git a/src/core-impl/collections/umscollection/podcasts/UmsPodcastMeta.cpp b/src/core-impl/collections/umscollection/podcasts/UmsPodcastMeta.cpp --- a/src/core-impl/collections/umscollection/podcasts/UmsPodcastMeta.cpp +++ b/src/core-impl/collections/umscollection/podcasts/UmsPodcastMeta.cpp @@ -25,19 +25,19 @@ using namespace Podcasts; UmsPodcastEpisodePtr -UmsPodcastEpisode::fromPodcastEpisodePtr( PodcastEpisodePtr episode ) +UmsPodcastEpisode::fromPodcastEpisodePtr( const PodcastEpisodePtr &episode ) { return UmsPodcastEpisodePtr::dynamicCast( episode ); } UmsPodcastEpisodePtr -UmsPodcastEpisode::fromTrackPtr( Meta::TrackPtr track ) +UmsPodcastEpisode::fromTrackPtr( const Meta::TrackPtr &track ) { return UmsPodcastEpisodePtr::dynamicCast( track ); } PodcastEpisodePtr -UmsPodcastEpisode::toPodcastEpisodePtr( UmsPodcastEpisodePtr episode ) +UmsPodcastEpisode::toPodcastEpisodePtr( const UmsPodcastEpisodePtr &episode ) { return PodcastEpisodePtr::dynamicCast( episode ); } @@ -51,7 +51,7 @@ return list; } -UmsPodcastEpisode::UmsPodcastEpisode( UmsPodcastChannelPtr channel ) +UmsPodcastEpisode::UmsPodcastEpisode( const UmsPodcastChannelPtr &channel ) : Podcasts::PodcastEpisode( UmsPodcastChannel::toPodcastChannelPtr( channel ) ) { } @@ -85,7 +85,7 @@ } void -UmsPodcastEpisode::setLocalFile( MetaFile::TrackPtr localFile ) +UmsPodcastEpisode::setLocalFile( const MetaFile::TrackPtr &localFile ) { m_localFile = localFile; } @@ -164,13 +164,13 @@ } UmsPodcastChannelPtr -UmsPodcastChannel::fromPodcastChannelPtr( PodcastChannelPtr channel ) +UmsPodcastChannel::fromPodcastChannelPtr( const PodcastChannelPtr &channel ) { return UmsPodcastChannelPtr::dynamicCast( channel ); } PodcastChannelPtr -UmsPodcastChannel::toPodcastChannelPtr( UmsPodcastChannelPtr channel ) +UmsPodcastChannel::toPodcastChannelPtr( const UmsPodcastChannelPtr &channel ) { return PodcastChannelPtr::dynamicCast( channel ); } @@ -210,7 +210,7 @@ } PodcastEpisodePtr -UmsPodcastChannel::addEpisode( PodcastEpisodePtr episode ) +UmsPodcastChannel::addEpisode(const PodcastEpisodePtr &episode ) { DEBUG_BLOCK @@ -258,7 +258,7 @@ } void -UmsPodcastChannel::removeEpisode( UmsPodcastEpisodePtr episode ) +UmsPodcastChannel::removeEpisode( const UmsPodcastEpisodePtr &episode ) { int position = m_umsEpisodes.indexOf( episode ); diff --git a/src/core-impl/collections/umscollection/podcasts/UmsPodcastProvider.h b/src/core-impl/collections/umscollection/podcasts/UmsPodcastProvider.h --- a/src/core-impl/collections/umscollection/podcasts/UmsPodcastProvider.h +++ b/src/core-impl/collections/umscollection/podcasts/UmsPodcastProvider.h @@ -28,45 +28,45 @@ { Q_OBJECT public: - UmsPodcastProvider( QUrl scanDirectory ); - ~UmsPodcastProvider(); + explicit UmsPodcastProvider( const QUrl &scanDirectory ); + ~UmsPodcastProvider() override; UmsPodcastEpisodePtr addFile( MetaFile::TrackPtr metafileTrack ); int addPath( const QString &path ); - virtual bool possiblyContainsTrack( const QUrl &url ) const; - virtual Meta::TrackPtr trackForUrl( const QUrl &url ); + bool possiblyContainsTrack( const QUrl &url ) const override; + Meta::TrackPtr trackForUrl( const QUrl &url ) override; - virtual Podcasts::PodcastEpisodePtr episodeForGuid( const QString &guid ); + Podcasts::PodcastEpisodePtr episodeForGuid( const QString &guid ) override; - virtual void addPodcast( const QUrl &url ); + void addPodcast( const QUrl &url ) override; - virtual Podcasts::PodcastChannelPtr addChannel( Podcasts::PodcastChannelPtr channel ); - virtual Podcasts::PodcastEpisodePtr addEpisode( Podcasts::PodcastEpisodePtr episode ); + Podcasts::PodcastChannelPtr addChannel( const Podcasts::PodcastChannelPtr &channel ) override; + Podcasts::PodcastEpisodePtr addEpisode( Podcasts::PodcastEpisodePtr episode ) override; - virtual Podcasts::PodcastChannelList channels(); + Podcasts::PodcastChannelList channels() override; - virtual void removeSubscription( Podcasts::PodcastChannelPtr channel ); + virtual void removeSubscription( const Podcasts::PodcastChannelPtr &channel ); virtual void configureProvider(); - virtual void configureChannel( Podcasts::PodcastChannelPtr channel ); + virtual void configureChannel( const Podcasts::PodcastChannelPtr &channel ); // PlaylistProvider methods - virtual QString prettyName() const; - virtual QIcon icon() const; + QString prettyName() const override; + QIcon icon() const override; - virtual Playlists::PlaylistList playlists(); + Playlists::PlaylistList playlists() override; - virtual QActionList playlistActions( const Playlists::PlaylistList &playlists ); - virtual QActionList trackActions( const QMultiHash &playlistTracks ); + QActionList playlistActions( const Playlists::PlaylistList &playlists ) override; + QActionList trackActions( const QMultiHash &playlistTracks ) override; - virtual void completePodcastDownloads(); + void completePodcastDownloads() override; public Q_SLOTS: - virtual void updateAll(); - virtual void update( Podcasts::PodcastChannelPtr channel ); - virtual void downloadEpisode( Podcasts::PodcastEpisodePtr episode ); - virtual void deleteDownloadedEpisode( Podcasts::PodcastEpisodePtr episode ); + void updateAll() override; + virtual void update( const Podcasts::PodcastChannelPtr &channel ); + virtual void downloadEpisode( const Podcasts::PodcastEpisodePtr &episode ); + virtual void deleteDownloadedEpisode( const Podcasts::PodcastEpisodePtr &episode ); virtual void slotUpdated(); virtual void scan(); @@ -80,8 +80,8 @@ void slotCopyComplete( KJob *job ); private: - QList episodeActions( Podcasts::PodcastEpisodeList ); - QList channelActions( Podcasts::PodcastChannelList ); + QList episodeActions( const Podcasts::PodcastEpisodeList &); + QList channelActions( const Podcasts::PodcastChannelList &); void deleteEpisodes( UmsPodcastEpisodeList umsEpisodes ); QUrl m_scanDirectory; diff --git a/src/core-impl/collections/umscollection/podcasts/UmsPodcastProvider.cpp b/src/core-impl/collections/umscollection/podcasts/UmsPodcastProvider.cpp --- a/src/core-impl/collections/umscollection/podcasts/UmsPodcastProvider.cpp +++ b/src/core-impl/collections/umscollection/podcasts/UmsPodcastProvider.cpp @@ -35,7 +35,7 @@ using namespace Podcasts; -UmsPodcastProvider::UmsPodcastProvider( QUrl scanDirectory ) +UmsPodcastProvider::UmsPodcastProvider( const QUrl &scanDirectory ) : m_scanDirectory( scanDirectory ) , m_deleteEpisodeAction( 0 ) , m_deleteChannelAction( 0 ) @@ -76,13 +76,13 @@ } PodcastChannelPtr -UmsPodcastProvider::addChannel( PodcastChannelPtr channel ) +UmsPodcastProvider::addChannel( const PodcastChannelPtr &channel ) { UmsPodcastChannelPtr umsChannel = UmsPodcastChannelPtr( new UmsPodcastChannel( channel, this ) ); m_umsChannels << umsChannel; - emit playlistAdded( Playlists::PlaylistPtr( umsChannel.data() ) ); + Q_EMIT playlistAdded( Playlists::PlaylistPtr( umsChannel.data() ) ); return PodcastChannelPtr( umsChannel.data() ); } @@ -95,13 +95,13 @@ QUrl destination = m_scanDirectory; destination = destination.adjusted(QUrl::StripTrailingSlash); - destination.setPath(destination.path() + '/' + ( Amarok::vfatPath( episode->channel()->prettyName() ) )); + destination.setPath(destination.path() + QLatin1Char('/') + ( Amarok::vfatPath( episode->channel()->prettyName() ) )); KIO::mkdir( destination ); destination = destination.adjusted(QUrl::StripTrailingSlash); - destination.setPath(destination.path() + '/' + ( Amarok::vfatPath( localFilePath.fileName() ) )); + destination.setPath(destination.path() + QLatin1Char('/') + ( Amarok::vfatPath( localFilePath.fileName() ) )); - debug() << QString( "Copy episode \"%1\" to %2" ).arg( localFilePath.path()) - .arg( destination.path() ); + debug() << QString( "Copy episode \"%1\" to %2" ).arg( localFilePath.path(), + destination.path() ); KIO::FileCopyJob *copyJob = KIO::file_copy( localFilePath, destination ); connect( copyJob, &KJob::result, this, &UmsPodcastProvider::slotCopyComplete ); copyJob->start(); @@ -130,7 +130,7 @@ } void -UmsPodcastProvider::removeSubscription( PodcastChannelPtr channel ) +UmsPodcastProvider::removeSubscription( const PodcastChannelPtr &channel ) { UmsPodcastChannelPtr umsChannel = UmsPodcastChannelPtr::dynamicCast( channel ); if( umsChannel.isNull() ) @@ -154,15 +154,15 @@ } void -UmsPodcastProvider::configureChannel( PodcastChannelPtr channel ) +UmsPodcastProvider::configureChannel( const PodcastChannelPtr &channel ) { Q_UNUSED( channel ); } QString UmsPodcastProvider::prettyName() const { - return i18nc( "Podcasts on a media device", "Podcasts on %1", QString("TODO: replace me") ); + return i18nc( "Podcasts on a media device", "Podcasts on %1", QStringLiteral("TODO: replace me") ); } QIcon @@ -181,7 +181,7 @@ } QActionList -UmsPodcastProvider::episodeActions( PodcastEpisodeList episodes ) +UmsPodcastProvider::episodeActions( const PodcastEpisodeList &episodes ) { QActionList actions; if( episodes.isEmpty() ) @@ -274,7 +274,7 @@ layout->addWidget( buttonBox ); buttonBox->button( QDialogButtonBox::Ok )->setText( i18n( "Yes, delete from %1.", - QString("TODO: replace me") ) ); + QStringLiteral("TODO: replace me") ) ); if( dialog.exec() != QDialog::Accepted ) return; @@ -314,13 +314,13 @@ { debug() << "channel is empty now, remove it"; m_umsChannels.removeAll( umsChannel ); - emit( playlistRemoved( Playlists::PlaylistPtr::dynamicCast( umsChannel ) ) ); + Q_EMIT( playlistRemoved( Playlists::PlaylistPtr::dynamicCast( umsChannel ) ) ); } } } QActionList -UmsPodcastProvider::channelActions( PodcastChannelList channels ) +UmsPodcastProvider::channelActions( const PodcastChannelList &channels ) { QActionList actions; if( channels.isEmpty() ) @@ -364,7 +364,7 @@ } deleteEpisodes( umsChannel->m_umsEpisodes ); - //slot deleteJobComplete() will emit signal once all tracks are gone. + //slot deleteJobComplete() will Q_EMIT signal once all tracks are gone. } } @@ -417,19 +417,19 @@ } void -UmsPodcastProvider::update( Podcasts::PodcastChannelPtr channel ) //slot +UmsPodcastProvider::update( const Podcasts::PodcastChannelPtr &channel ) //slot { Q_UNUSED( channel ); } void -UmsPodcastProvider::downloadEpisode( Podcasts::PodcastEpisodePtr episode ) //slot +UmsPodcastProvider::downloadEpisode( const Podcasts::PodcastEpisodePtr &episode ) //slot { Q_UNUSED( episode ); } void -UmsPodcastProvider::deleteDownloadedEpisode( Podcasts::PodcastEpisodePtr episode ) //slot +UmsPodcastProvider::deleteDownloadedEpisode( const Podcasts::PodcastEpisodePtr &episode ) //slot { Q_UNUSED( episode ); } @@ -543,7 +543,7 @@ channel = UmsPodcastChannelPtr( new UmsPodcastChannel( this ) ); channel->setTitle( metafileTrack->album()->name() ); m_umsChannels << channel; - emit playlistAdded( Playlists::PlaylistPtr( channel.data() ) ); + Q_EMIT playlistAdded( Playlists::PlaylistPtr( channel.data() ) ); } if( episode.isNull() ) diff --git a/src/core-impl/collections/upnpcollection/CMakeLists.txt b/src/core-impl/collections/upnpcollection/CMakeLists.txt --- a/src/core-impl/collections/upnpcollection/CMakeLists.txt +++ b/src/core-impl/collections/upnpcollection/CMakeLists.txt @@ -37,6 +37,6 @@ set_target_properties(amarok_collection-upnpcollection PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") endif() -install(TARGETS amarok_collection-upnpcollection DESTINATION ${PLUGIN_INSTALL_DIR} ) +install(TARGETS amarok_collection-upnpcollection DESTINATION ${KDE_INSTALL_PLUGINDIR} ) kcoreaddons_desktop_to_json(amarok_collection-upnpcollection amarok_collection-upnpcollection.desktop SERVICE_TYPES ${CMAKE_SOURCE_DIR}/src/amarok-plugin.desktop) diff --git a/src/core-impl/collections/upnpcollection/UpnpBrowseCollection.h b/src/core-impl/collections/upnpcollection/UpnpBrowseCollection.h --- a/src/core-impl/collections/upnpcollection/UpnpBrowseCollection.h +++ b/src/core-impl/collections/upnpcollection/UpnpBrowseCollection.h @@ -35,31 +35,29 @@ namespace KIO { class Job; - class ListJob; } class KJob; class QTimer; namespace Collections { class UpnpCache; -class UpnpMemoryQueryMaker; class UpnpBrowseCollection : public UpnpCollectionBase { Q_OBJECT public: - UpnpBrowseCollection( const DeviceInfo& ); + explicit UpnpBrowseCollection( const DeviceInfo& ); virtual ~UpnpBrowseCollection(); - virtual QueryMaker* queryMaker(); + QueryMaker* queryMaker() override; - virtual bool hasCapabilityInterface( Capabilities::Capability::Type type ) const; - virtual Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ); + bool hasCapabilityInterface( Capabilities::Capability::Type type ) const override; + Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ) override; - Meta::TrackPtr trackForUrl( const QUrl &url ); - virtual QIcon icon() const { return QIcon::fromTheme("network-server"); } + Meta::TrackPtr trackForUrl( const QUrl &url ) override; + QIcon icon() const override { return QIcon::fromTheme("network-server"); } QSharedPointer memoryCollection() const { return m_mc; } @@ -76,7 +74,7 @@ void entries( KIO::Job *, const KIO::UDSEntryList& ); void done( KJob * ); void createTrack( const KIO::UDSEntry &, const QString &baseUrl ); - void removeTrack( Meta::TrackPtr t ); + void removeTrack( const Meta::TrackPtr &t ); void invalidateTracksIn( const QString &dir ); void updateMemoryCollection(); void slotFilesChanged(const QStringList &); @@ -104,12 +102,12 @@ { Q_OBJECT public: - UpnpBrowseCollectionScanCapability( UpnpBrowseCollection* collection ); + explicit UpnpBrowseCollectionScanCapability( UpnpBrowseCollection* collection ); virtual ~UpnpBrowseCollectionScanCapability(); - virtual void startFullScan(); - virtual void startIncrementalScan( const QString &directory = QString() ); - virtual void stopScan(); + void startFullScan() override; + void startIncrementalScan( const QString &directory = QString() ) override; + void stopScan() override; private: UpnpBrowseCollection *m_collection; diff --git a/src/core-impl/collections/upnpcollection/UpnpBrowseCollection.cpp b/src/core-impl/collections/upnpcollection/UpnpBrowseCollection.cpp --- a/src/core-impl/collections/upnpcollection/UpnpBrowseCollection.cpp +++ b/src/core-impl/collections/upnpcollection/UpnpBrowseCollection.cpp @@ -18,7 +18,7 @@ #include "UpnpBrowseCollection.h" -#include "core/interfaces/Logger.h" +#include "core/logger/Logger.h" #include "core/support/Components.h" #include "core/support/Debug.h" #include "MemoryQueryMaker.h" @@ -44,7 +44,7 @@ //UpnpBrowseCollection -// TODO register for the device bye bye and emit remove() +// TODO register for the device bye bye and Q_EMIT remove() UpnpBrowseCollection::UpnpBrowseCollection( const DeviceInfo& dev ) : UpnpCollectionBase( dev ) , m_mc( new MemoryCollection() ) @@ -115,7 +115,7 @@ // TODO probably set abort slot // TODO figure out what to do with the total steps - Amarok::Components::logger()->newProgressOperation( this, i18n( "Scanning %1", prettyName() ) ); + Amarok::Logger::newProgressOperation( this, i18n( "Scanning %1", prettyName() ) ); startIncrementalScan( "/" ); @@ -158,8 +158,8 @@ createTrack( entry, sj->url().toDisplayString() ); } count++; - emit totalSteps( count ); - emit incrementProgress(); + Q_EMIT totalSteps( count ); + Q_EMIT incrementProgress(); } updateMemoryCollection(); } @@ -172,7 +172,7 @@ memoryCollection()->setAlbumMap( m_cache->albums() ); memoryCollection()->setGenreMap( m_cache->genres() ); memoryCollection()->setYearMap( m_cache->years() ); - emit updated(); + Q_EMIT updated(); } void @@ -188,7 +188,7 @@ } void -UpnpBrowseCollection::removeTrack( TrackPtr t ) +UpnpBrowseCollection::removeTrack( const TrackPtr &t ) { m_cache->removeTrack( t ); } @@ -199,16 +199,16 @@ DEBUG_BLOCK if( job->error() ) { - Amarok::Components::logger()->longMessage( i18n("UPnP Error: %1", job->errorString() ), + Amarok::Logger::longMessage( i18n("UPnP Error: %1", job->errorString() ), Amarok::Logger::Error ); return; } updateMemoryCollection(); if( m_fullScanInProgress ) { m_fullScanTimer->stop(); m_fullScanInProgress = false; - emit endProgressOperation( this ); + Q_EMIT endProgressOperation( this ); debug() << "Full Scan done"; } diff --git a/src/core-impl/collections/upnpcollection/UpnpCache.h b/src/core-impl/collections/upnpcollection/UpnpCache.h --- a/src/core-impl/collections/upnpcollection/UpnpCache.h +++ b/src/core-impl/collections/upnpcollection/UpnpCache.h @@ -31,15 +31,15 @@ class UpnpCache { public: - UpnpCache( UpnpCollectionBase *collection ); + explicit UpnpCache( UpnpCollectionBase *collection ); Meta::TrackPtr getTrack( const KIO::UDSEntry &entry, bool refresh = false ); Meta::ArtistPtr getArtist( const QString &name ); Meta::AlbumPtr getAlbum( const QString& name, const QString& artist = QString() ); Meta::GenrePtr getGenre( const QString &name ); Meta::YearPtr getYear( int name ); - void removeTrack( Meta::TrackPtr track ); + void removeTrack( const Meta::TrackPtr &track ); TrackMap tracks() { return m_trackMap; } ArtistMap artists() { return m_artistMap; } diff --git a/src/core-impl/collections/upnpcollection/UpnpCache.cpp b/src/core-impl/collections/upnpcollection/UpnpCache.cpp --- a/src/core-impl/collections/upnpcollection/UpnpCache.cpp +++ b/src/core-impl/collections/upnpcollection/UpnpCache.cpp @@ -23,24 +23,24 @@ #include "UpnpCollectionBase.h" // TODO : move this to CollectionBase -static qint64 duration( QString duration ) { +static qint64 duration( const QString &duration ) { if( duration.isEmpty() ) return 0; - QStringList parts = duration.split( ':' ); + QStringList parts = duration.split( QLatin1Char(':') ); int hours = parts.takeFirst().toInt(); int minutes = parts.takeFirst().toInt(); QString rest = parts.takeFirst(); int seconds = 0; int mseconds = 0; - if( rest.contains( '.' ) ) { + if( rest.contains( QLatin1Char('.') ) ) { int dotIndex = rest.indexOf( "." ); - seconds = rest.left( dotIndex ).toInt(); + seconds = rest.leftRef( dotIndex ).toInt(); QString frac = rest.mid( dotIndex + 1 ); - if( frac.contains( '/' ) ) { - int slashIndex = frac.indexOf( '/' ); - int num = frac.left( frac.indexOf( '/' ) ).toInt(); - int den = frac.mid( slashIndex + 1 ).toInt(); + if( frac.contains( QLatin1Char('/') ) ) { + int slashIndex = frac.indexOf( QLatin1Char('/') ); + int num = frac.leftRef( frac.indexOf( QLatin1Char('/') ) ).toInt(); + int den = frac.midRef( slashIndex + 1 ).toInt(); mseconds = num * 1000 / den; } else { @@ -162,7 +162,7 @@ return m_yearMap[name]; } -void UpnpCache::removeTrack( Meta::TrackPtr t ) +void UpnpCache::removeTrack( const Meta::TrackPtr &t ) { #define DOWNCAST( Type, item ) Meta::Upnp##Type##Ptr::staticCast( item ) Meta::UpnpTrackPtr track = DOWNCAST( Track, t ); diff --git a/src/core-impl/collections/upnpcollection/UpnpCollectionBase.h b/src/core-impl/collections/upnpcollection/UpnpCollectionBase.h --- a/src/core-impl/collections/upnpcollection/UpnpCollectionBase.h +++ b/src/core-impl/collections/upnpcollection/UpnpCollectionBase.h @@ -38,11 +38,9 @@ } class KJob; -class QTimer; namespace Collections { -class UpnpMemoryQueryMaker; /** * UPnP Collections are of two types. @@ -58,13 +56,13 @@ { Q_OBJECT public: - UpnpCollectionBase( const DeviceInfo& dev ); + explicit UpnpCollectionBase( const DeviceInfo& dev ); virtual ~UpnpCollectionBase(); - void removeCollection() { emit remove(); } + void removeCollection() { Q_EMIT remove(); } - virtual QString collectionId() const; - virtual QString prettyName() const; - bool possiblyContainsTrack( const QUrl &url ) const; + QString collectionId() const override; + QString prettyName() const override; + bool possiblyContainsTrack( const QUrl &url ) const override; private Q_SLOTS: void slotSlaveError( KIO::Slave *slave, int err, const QString &msg ); diff --git a/src/core-impl/collections/upnpcollection/UpnpCollectionBase.cpp b/src/core-impl/collections/upnpcollection/UpnpCollectionBase.cpp --- a/src/core-impl/collections/upnpcollection/UpnpCollectionBase.cpp +++ b/src/core-impl/collections/upnpcollection/UpnpCollectionBase.cpp @@ -56,7 +56,7 @@ QString UpnpCollectionBase::collectionId() const { - return QString("upnp-ms://") + m_device.uuid(); + return QStringLiteral("upnp-ms://") + m_device.uuid(); } QString UpnpCollectionBase::prettyName() const @@ -90,7 +90,7 @@ m_continuousJobFailureCount++; if( m_continuousJobFailureCount >= MAX_JOB_FAILURES_BEFORE_ABORT ) { debug() << prettyName() << "Had" << m_continuousJobFailureCount << "continuous job failures, something wrong with the device. Removing this collection."; - emit remove(); + Q_EMIT remove(); } } else { @@ -107,12 +107,12 @@ if( err == KIO::ERR_COULD_NOT_CONNECT || err == KIO::ERR_CONNECTION_BROKEN ) { debug() << "COULD NOT CONNECT TO " << msg << "REMOVING THE COLLECTION"; - emit remove(); + Q_EMIT remove(); } if( err == KIO::ERR_SLAVE_DIED ) { m_slave = 0; - emit remove(); + Q_EMIT remove(); } } diff --git a/src/core-impl/collections/upnpcollection/UpnpCollectionFactory.h b/src/core-impl/collections/upnpcollection/UpnpCollectionFactory.h --- a/src/core-impl/collections/upnpcollection/UpnpCollectionFactory.h +++ b/src/core-impl/collections/upnpcollection/UpnpCollectionFactory.h @@ -49,7 +49,7 @@ UpnpCollectionFactory(); virtual ~UpnpCollectionFactory(); - virtual void init(); + void init() override; private: diff --git a/src/core-impl/collections/upnpcollection/UpnpCollectionFactory.cpp b/src/core-impl/collections/upnpcollection/UpnpCollectionFactory.cpp --- a/src/core-impl/collections/upnpcollection/UpnpCollectionFactory.cpp +++ b/src/core-impl/collections/upnpcollection/UpnpCollectionFactory.cpp @@ -249,7 +249,7 @@ qDebug() << "Supported Search() meta-data" << searchCaps << "not enough. Using UpnpBrowseCollection"; m_devices[dev.uuid()] = new UpnpBrowseCollection( dev ); } - emit newCollection( m_devices[dev.uuid()] ); + Q_EMIT newCollection( m_devices[dev.uuid()] ); } } diff --git a/src/core-impl/collections/upnpcollection/UpnpMemoryQueryMaker.h b/src/core-impl/collections/upnpcollection/UpnpMemoryQueryMaker.h --- a/src/core-impl/collections/upnpcollection/UpnpMemoryQueryMaker.h +++ b/src/core-impl/collections/upnpcollection/UpnpMemoryQueryMaker.h @@ -30,10 +30,10 @@ { Q_OBJECT public: - UpnpMemoryQueryMaker( QWeakPointer mc, const QString &collectionId ); + UpnpMemoryQueryMaker( const QWeakPointer &mc, const QString &collectionId ); virtual ~UpnpMemoryQueryMaker(); - virtual void run(); + void run() override; Q_SIGNALS: void startFullScan(); diff --git a/src/core-impl/collections/upnpcollection/UpnpMemoryQueryMaker.cpp b/src/core-impl/collections/upnpcollection/UpnpMemoryQueryMaker.cpp --- a/src/core-impl/collections/upnpcollection/UpnpMemoryQueryMaker.cpp +++ b/src/core-impl/collections/upnpcollection/UpnpMemoryQueryMaker.cpp @@ -26,7 +26,7 @@ namespace Collections { bool UpnpMemoryQueryMaker::m_firstRun = true; -UpnpMemoryQueryMaker::UpnpMemoryQueryMaker( QWeakPointer mc, const QString &collectionId ) +UpnpMemoryQueryMaker::UpnpMemoryQueryMaker( const QWeakPointer &mc, const QString &collectionId ) : MemoryQueryMaker( mc, collectionId ) { } @@ -41,7 +41,7 @@ DEBUG_BLOCK if( m_firstRun ) { m_firstRun = false; - emit startFullScan(); + Q_EMIT startFullScan(); } MemoryQueryMaker::run(); } diff --git a/src/core-impl/collections/upnpcollection/UpnpMeta.h b/src/core-impl/collections/upnpcollection/UpnpMeta.h --- a/src/core-impl/collections/upnpcollection/UpnpMeta.h +++ b/src/core-impl/collections/upnpcollection/UpnpMeta.h @@ -43,21 +43,21 @@ class UpnpTrack : public Meta::Track { public: - UpnpTrack( Collections::UpnpCollectionBase *collection ); + explicit UpnpTrack( Collections::UpnpCollectionBase *collection ); virtual ~UpnpTrack(); - virtual QString name() const; + QString name() const override; - virtual QUrl playableUrl() const; - virtual QString uidUrl() const; - virtual QString prettyUrl() const; - virtual QString notPlayableReason() const; + QUrl playableUrl() const override; + QString uidUrl() const override; + QString prettyUrl() const override; + QString notPlayableReason() const override; - virtual AlbumPtr album() const; - virtual ArtistPtr artist() const; - virtual GenrePtr genre() const; - virtual ComposerPtr composer() const; - virtual YearPtr year() const; + AlbumPtr album() const override; + ArtistPtr artist() const override; + GenrePtr genre() const override; + ComposerPtr composer() const override; + YearPtr year() const override; virtual void setAlbum ( const QString &newAlbum ); virtual void setArtist ( const QString &newArtist ); @@ -69,34 +69,34 @@ virtual void setUidUrl( const QString &url ); - virtual qreal bpm() const; + qreal bpm() const override; - virtual QString comment() const; + QString comment() const override; virtual void setComment ( const QString &newComment ); - virtual qint64 length() const; + qint64 length() const override; - virtual int filesize() const; - virtual int sampleRate() const; - virtual int bitrate() const; + int filesize() const override; + int sampleRate() const override; + int bitrate() const override; - virtual int trackNumber() const; + int trackNumber() const override; virtual void setTrackNumber ( int newTrackNumber ); - virtual int discNumber() const; + int discNumber() const override; virtual void setDiscNumber ( int newDiscNumber ); - virtual QString type() const; + QString type() const override; - virtual bool inCollection() const; - virtual Collections::Collection* collection() const; + bool inCollection() const override; + Collections::Collection* collection() const override; //UpnpTrack specific methods - void setAlbum( UpnpAlbumPtr album ); - void setArtist( UpnpArtistPtr artist ); - void setComposer( UpnpComposerPtr composer ); - void setGenre( UpnpGenrePtr genre ); - void setYear( UpnpYearPtr year ); + void setAlbum( const UpnpAlbumPtr &album ); + void setArtist( const UpnpArtistPtr &artist ); + void setComposer( const UpnpComposerPtr &composer ); + void setGenre( const UpnpGenrePtr &genre ); + void setYear( const UpnpYearPtr &year ); void setPlayableUrl( const QString &url ); void setLength( qint64 length ); @@ -124,16 +124,16 @@ class UpnpArtist : public Meta::Artist { public: - UpnpArtist( const QString &name ); - virtual ~UpnpArtist(); + explicit UpnpArtist( const QString &name ); + ~UpnpArtist() override; - virtual QString name() const; + QString name() const override; - virtual TrackList tracks(); + TrackList tracks() override; //UpnpArtist specific methods - void addTrack( UpnpTrackPtr track ); - void removeTrack( UpnpTrackPtr track ); + void addTrack( const UpnpTrackPtr &track ); + void removeTrack( const UpnpTrackPtr &track ); private: QString m_name; @@ -144,26 +144,26 @@ { Q_OBJECT public: - UpnpAlbum( const QString &name ); + explicit UpnpAlbum( const QString &name ); virtual ~UpnpAlbum(); - virtual QString name() const; + QString name() const override; - virtual bool isCompilation() const; - virtual bool hasAlbumArtist() const; - virtual ArtistPtr albumArtist() const; - virtual TrackList tracks(); + bool isCompilation() const override; + bool hasAlbumArtist() const override; + ArtistPtr albumArtist() const override; + TrackList tracks() override; - virtual bool hasImage( int size = 0 ) const; - virtual QImage image( int size = 0 ) const; - virtual QUrl imageLocation( int size = 0 ); + bool hasImage( int size = 0 ) const override; + QImage image( int size = 0 ) const override; + QUrl imageLocation( int size = 0 ) override; - virtual Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ); + Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ) override; //UpnpAlbum specific methods - void addTrack( UpnpTrackPtr track ); - void removeTrack( UpnpTrackPtr track ); - void setAlbumArtist( UpnpArtistPtr artist ); + void addTrack( const UpnpTrackPtr &track ); + void removeTrack( const UpnpTrackPtr &track ); + void setAlbumArtist( const UpnpArtistPtr &artist ); void setAlbumArtUrl( const QUrl &url ); private: @@ -178,16 +178,16 @@ class UpnpGenre : public Meta::Genre { public: - UpnpGenre( const QString &name ); + explicit UpnpGenre( const QString &name ); virtual ~UpnpGenre(); - virtual QString name() const; + QString name() const override; - virtual TrackList tracks(); + TrackList tracks() override; //UpnpGenre specific methods - void addTrack( UpnpTrackPtr track ); - void removeTrack( UpnpTrackPtr track ); + void addTrack( const UpnpTrackPtr &track ); + void removeTrack( const UpnpTrackPtr &track ); private: QString m_name; @@ -197,16 +197,16 @@ class UpnpComposer : public Meta::Composer { public: - UpnpComposer( const QString &name ); + explicit UpnpComposer( const QString &name ); virtual ~UpnpComposer(); - virtual QString name() const; + QString name() const override; - virtual TrackList tracks(); + TrackList tracks() override; //UpnpComposer specific methods - void addTrack( UpnpTrackPtr track ); - void removeTrack( UpnpTrackPtr track ); + void addTrack( const UpnpTrackPtr &track ); + void removeTrack( const UpnpTrackPtr &track ); private: QString m_name; @@ -216,16 +216,16 @@ class UpnpYear : public Meta::Year { public: - UpnpYear( int year ); + explicit UpnpYear( int year ); virtual ~UpnpYear(); - virtual QString name() const; + QString name() const override; - virtual TrackList tracks(); + TrackList tracks() override; //UpnpYear specific methods - void addTrack( UpnpTrackPtr track ); - void removeTrack( UpnpTrackPtr track ); + void addTrack( const UpnpTrackPtr &track ); + void removeTrack( const UpnpTrackPtr &track ); private: QString m_name; diff --git a/src/core-impl/collections/upnpcollection/UpnpMeta.cpp b/src/core-impl/collections/upnpcollection/UpnpMeta.cpp --- a/src/core-impl/collections/upnpcollection/UpnpMeta.cpp +++ b/src/core-impl/collections/upnpcollection/UpnpMeta.cpp @@ -240,31 +240,31 @@ } void -UpnpTrack::setAlbum( UpnpAlbumPtr album ) +UpnpTrack::setAlbum( const UpnpAlbumPtr &album ) { m_album = album; } void -UpnpTrack::setArtist( UpnpArtistPtr artist ) +UpnpTrack::setArtist( const UpnpArtistPtr &artist ) { m_artist = artist; } void -UpnpTrack::setGenre( UpnpGenrePtr genre ) +UpnpTrack::setGenre( const UpnpGenrePtr &genre ) { m_genre = genre; } void -UpnpTrack::setComposer( UpnpComposerPtr composer ) +UpnpTrack::setComposer( const UpnpComposerPtr &composer ) { m_composer = composer; } void -UpnpTrack::setYear( UpnpYearPtr year ) +UpnpTrack::setYear( const UpnpYearPtr &year ) { m_year = year; } @@ -316,13 +316,13 @@ } void -UpnpArtist::addTrack( UpnpTrackPtr track ) +UpnpArtist::addTrack( const UpnpTrackPtr &track ) { m_tracks.append( TrackPtr::staticCast( track ) ); } void -UpnpArtist::removeTrack( UpnpTrackPtr track ) +UpnpArtist::removeTrack( const UpnpTrackPtr &track ) { m_tracks.removeOne( TrackPtr::staticCast( track ) ); } @@ -408,19 +408,19 @@ } void -UpnpAlbum::addTrack( UpnpTrackPtr track ) +UpnpAlbum::addTrack( const UpnpTrackPtr &track ) { m_tracks.append( TrackPtr::staticCast( track ) ); } void -UpnpAlbum::removeTrack( UpnpTrackPtr track ) +UpnpAlbum::removeTrack( const UpnpTrackPtr &track ) { m_tracks.removeOne( TrackPtr::staticCast( track ) ); } void -UpnpAlbum::setAlbumArtist( UpnpArtistPtr artist ) +UpnpAlbum::setAlbumArtist( const UpnpArtistPtr &artist ) { m_albumArtist = artist; } @@ -470,13 +470,13 @@ } void -UpnpGenre::addTrack( UpnpTrackPtr track ) +UpnpGenre::addTrack( const UpnpTrackPtr &track ) { m_tracks.append( TrackPtr::staticCast( track ) ); } void -UpnpGenre::removeTrack( UpnpTrackPtr track ) +UpnpGenre::removeTrack( const UpnpTrackPtr &track ) { m_tracks.removeOne( TrackPtr::staticCast( track ) ); } @@ -509,13 +509,13 @@ } void -UpnpComposer::addTrack( UpnpTrackPtr track ) +UpnpComposer::addTrack( const UpnpTrackPtr &track ) { m_tracks.append( TrackPtr::staticCast( track ) ); } void -UpnpComposer::removeTrack( UpnpTrackPtr track ) +UpnpComposer::removeTrack( const UpnpTrackPtr &track ) { m_tracks.removeOne( TrackPtr::staticCast( track ) ); } @@ -548,13 +548,13 @@ } void -UpnpYear::addTrack( UpnpTrackPtr track ) +UpnpYear::addTrack( const UpnpTrackPtr &track ) { m_tracks.append( TrackPtr::staticCast( track ) ); } void -UpnpYear::removeTrack( UpnpTrackPtr track ) +UpnpYear::removeTrack( const UpnpTrackPtr &track ) { m_tracks.removeOne( TrackPtr::staticCast( track ) ); } diff --git a/src/core-impl/collections/upnpcollection/UpnpQuery.cpp b/src/core-impl/collections/upnpcollection/UpnpQuery.cpp --- a/src/core-impl/collections/upnpcollection/UpnpQuery.cpp +++ b/src/core-impl/collections/upnpcollection/UpnpQuery.cpp @@ -46,7 +46,7 @@ void UpnpQuery::beginAnd() { - for( int i = 0; i < m_expressions.length() ; ++i ) { + for( int i = 0, total = m_expressions.length(); i < total ; ++i ) { m_expressions[i] += " and "; } } diff --git a/src/core-impl/collections/upnpcollection/UpnpQueryMaker.h b/src/core-impl/collections/upnpcollection/UpnpQueryMaker.h --- a/src/core-impl/collections/upnpcollection/UpnpQueryMaker.h +++ b/src/core-impl/collections/upnpcollection/UpnpQueryMaker.h @@ -30,10 +30,8 @@ class UDSEntry; typedef QList UDSEntryList; class Job; - class ListJob; } -class KJob; namespace Collections { @@ -45,63 +43,63 @@ Q_OBJECT public: - UpnpQueryMaker( UpnpSearchCollection * ); + explicit UpnpQueryMaker( UpnpSearchCollection * ); ~UpnpQueryMaker(); QueryMaker* reset(); - void run() ; - void abortQuery() ; + void run() override; + void abortQuery() override; - QueryMaker* setQueryType( QueryType type ) ; - QueryMaker* addReturnValue( qint64 value ) ; - QueryMaker* addReturnFunction( ReturnFunction function, qint64 value ) ; - QueryMaker* orderBy( qint64 value, bool descending = false ) ; + QueryMaker* setQueryType( QueryType type ) override; + QueryMaker* addReturnValue( qint64 value ) override; + QueryMaker* addReturnFunction( ReturnFunction function, qint64 value ) override; + QueryMaker* orderBy( qint64 value, bool descending = false ) override; - QueryMaker* addMatch( const Meta::TrackPtr &track ) ; - QueryMaker* addMatch( const Meta::ArtistPtr &artist, ArtistMatchBehaviour behaviour = TrackArtists ); - QueryMaker* addMatch( const Meta::AlbumPtr &album ) ; - QueryMaker* addMatch( const Meta::ComposerPtr &composer ) ; - QueryMaker* addMatch( const Meta::GenrePtr &genre ) ; - QueryMaker* addMatch( const Meta::YearPtr &year ) ; - QueryMaker* addMatch( const Meta::LabelPtr &label ); + QueryMaker* addMatch( const Meta::TrackPtr &track ) override; + QueryMaker* addMatch( const Meta::ArtistPtr &artist, ArtistMatchBehaviour behaviour = TrackArtists ) override; + QueryMaker* addMatch( const Meta::AlbumPtr &album ) override; + QueryMaker* addMatch( const Meta::ComposerPtr &composer ) override; + QueryMaker* addMatch( const Meta::GenrePtr &genre ) override; + QueryMaker* addMatch( const Meta::YearPtr &year ) override; + QueryMaker* addMatch( const Meta::LabelPtr &label ) override; - QueryMaker* addFilter( qint64 value, const QString &filter, bool matchBegin = false, bool matchEnd = false ) ; - QueryMaker* excludeFilter( qint64 value, const QString &filter, bool matchBegin = false, bool matchEnd = false ) ; + QueryMaker* addFilter( qint64 value, const QString &filter, bool matchBegin = false, bool matchEnd = false ) override; + QueryMaker* excludeFilter( qint64 value, const QString &filter, bool matchBegin = false, bool matchEnd = false ) override; - QueryMaker* addNumberFilter( qint64 value, qint64 filter, NumberComparison compare ) ; - QueryMaker* excludeNumberFilter( qint64 value, qint64 filter, NumberComparison compare ) ; + QueryMaker* addNumberFilter( qint64 value, qint64 filter, NumberComparison compare ) override; + QueryMaker* excludeNumberFilter( qint64 value, qint64 filter, NumberComparison compare ) override; - QueryMaker* limitMaxResultSize( int size ) ; + QueryMaker* limitMaxResultSize( int size ) override; - QueryMaker* setAlbumQueryMode( AlbumQueryMode mode ); + QueryMaker* setAlbumQueryMode( AlbumQueryMode mode ) override; - QueryMaker* setLabelQueryMode( LabelQueryMode mode ); + QueryMaker* setLabelQueryMode( LabelQueryMode mode ) override; - QueryMaker* beginAnd() ; - QueryMaker* beginOr() ; - QueryMaker* endAndOr() ; + QueryMaker* beginAnd() override; + QueryMaker* beginOr() override; + QueryMaker* endAndOr() override; QueryMaker* setAutoDelete( bool autoDelete ); - int validFilterMask(); + int validFilterMask() override; Q_SIGNALS: - void newTracksReady( Meta::TrackList ); - void newArtistsReady( Meta::ArtistList ); - void newAlbumsReady( Meta::AlbumList ); - void newGenresReady( Meta::GenreList ); - void newComposersReady( Meta::ComposerList ); - void newYearsReady( Meta::YearList ); - void newResultReady( QStringList ); - void newLabelsReady( Meta::LabelList ); + void newTracksReady( const Meta::TrackList& ); + void newArtistsReady( const Meta::ArtistList &); + void newAlbumsReady( const Meta::AlbumList& ); + void newGenresReady( const Meta::GenreList& ); + void newComposersReady( const Meta::ComposerList& ); + void newYearsReady( const Meta::YearList& ); + void newResultReady( const QStringList& ); + void newLabelsReady( const Meta::LabelList& ); void queryDone(); private Q_SLOTS: void slotDone(); - void handleArtists( Meta::ArtistList ); - void handleAlbums( Meta::AlbumList ); - void handleTracks( Meta::TrackList ); + void handleArtists( const Meta::ArtistList &); + void handleAlbums( const Meta::AlbumList &); + void handleTracks( const Meta::TrackList &); private: /* diff --git a/src/core-impl/collections/upnpcollection/UpnpQueryMaker.cpp b/src/core-impl/collections/upnpcollection/UpnpQueryMaker.cpp --- a/src/core-impl/collections/upnpcollection/UpnpQueryMaker.cpp +++ b/src/core-impl/collections/upnpcollection/UpnpQueryMaker.cpp @@ -107,15 +107,15 @@ // we don't deal with compilations else if( m_queryType == Album && m_albumMode == OnlyCompilations ) { // we don't support any other attribute - emit newTracksReady( Meta::TrackList() ); - emit newArtistsReady( Meta::ArtistList() ); - emit newAlbumsReady( Meta::AlbumList() ); - emit newGenresReady( Meta::GenreList() ); - emit newComposersReady( Meta::ComposerList() ); - emit newYearsReady( Meta::YearList() ); - emit newResultReady( QStringList() ); - emit newLabelsReady( Meta::LabelList() ); - emit queryDone(); + Q_EMIT newTracksReady( Meta::TrackList() ); + Q_EMIT newArtistsReady( Meta::ArtistList() ); + Q_EMIT newAlbumsReady( Meta::AlbumList() ); + Q_EMIT newGenresReady( Meta::GenreList() ); + Q_EMIT newComposersReady( Meta::ComposerList() ); + Q_EMIT newYearsReady( Meta::YearList() ); + Q_EMIT newResultReady( QStringList() ); + Q_EMIT newLabelsReady( Meta::LabelList() ); + Q_EMIT queryDone(); return; } @@ -148,15 +148,15 @@ default: debug() << this << "Default case: Query type"; // we don't support any other attribute - emit newTracksReady( Meta::TrackList() ); - emit newArtistsReady( Meta::ArtistList() ); - emit newAlbumsReady( Meta::AlbumList() ); - emit newGenresReady( Meta::GenreList() ); - emit newComposersReady( Meta::ComposerList() ); - emit newYearsReady( Meta::YearList() ); - emit newResultReady( QStringList() ); - emit newLabelsReady( Meta::LabelList() ); - emit queryDone(); + Q_EMIT newTracksReady( Meta::TrackList() ); + Q_EMIT newArtistsReady( Meta::ArtistList() ); + Q_EMIT newAlbumsReady( Meta::AlbumList() ); + Q_EMIT newGenresReady( Meta::GenreList() ); + Q_EMIT newComposersReady( Meta::ComposerList() ); + Q_EMIT newYearsReady( Meta::YearList() ); + Q_EMIT newResultReady( QStringList() ); + Q_EMIT newLabelsReady( Meta::LabelList() ); + Q_EMIT queryDone(); return; } } @@ -408,22 +408,22 @@ return mask; } -void UpnpQueryMaker::handleArtists( Meta::ArtistList list ) +void UpnpQueryMaker::handleArtists( const Meta::ArtistList &list ) { // TODO Post filtering - emit newArtistsReady( list ); + Q_EMIT newArtistsReady( list ); } -void UpnpQueryMaker::handleAlbums( Meta::AlbumList list ) +void UpnpQueryMaker::handleAlbums( const Meta::AlbumList &list ) { // TODO Post filtering - emit newAlbumsReady( list ); + Q_EMIT newAlbumsReady( list ); } -void UpnpQueryMaker::handleTracks( Meta::TrackList list ) +void UpnpQueryMaker::handleTracks( const Meta::TrackList &list ) { // TODO Post filtering - emit newTracksReady( list ); + Q_EMIT newTracksReady( list ); } /* @@ -435,7 +435,7 @@ Q_ASSERT( !list.empty() ); QString count = list.first().stringValue( KIO::UDSEntry::UDS_NAME ); m_collection->setProperty( "numberOfTracks", count.toUInt() ); - emit newResultReady( QStringList( count ) ); + Q_EMIT newResultReady( QStringList( count ) ); } default: debug() << "Custom result functions other than \"Count\" are not supported by UpnpQueryMaker"; @@ -455,34 +455,34 @@ fake->setYear( Meta::UpnpYearPtr( new Meta::UpnpYear( 2010 ) ) ); Meta::DataPtr ptr( fake ); ret << ptr; - //emit newResultReady( ret ); + //Q_EMIT newResultReady( ret ); } switch( m_queryType ) { case Artist: { Meta::ArtistList list; foreach( Meta::DataPtr ptr, m_cacheEntries ) list << Meta::ArtistPtr::staticCast( ptr ); - emit newArtistsReady( list ); + Q_EMIT newArtistsReady( list ); break; } case Album: { Meta::AlbumList list; foreach( Meta::DataPtr ptr, m_cacheEntries ) list << Meta::AlbumPtr::staticCast( ptr ); - emit newAlbumsReady( list ); + Q_EMIT newAlbumsReady( list ); break; } case Track: { Meta::TrackList list; foreach( Meta::DataPtr ptr, m_cacheEntries ) list << Meta::TrackPtr::staticCast( ptr ); - emit newTracksReady( list ); + Q_EMIT newTracksReady( list ); break; } default: @@ -492,7 +492,7 @@ } debug() << "ALL JOBS DONE< TERMINATING THIS QM" << this; - emit queryDone(); + Q_EMIT queryDone(); } QString UpnpQueryMaker::propertyForValue( qint64 value ) diff --git a/src/core-impl/collections/upnpcollection/UpnpQueryMakerInternal.h b/src/core-impl/collections/upnpcollection/UpnpQueryMakerInternal.h --- a/src/core-impl/collections/upnpcollection/UpnpQueryMakerInternal.h +++ b/src/core-impl/collections/upnpcollection/UpnpQueryMakerInternal.h @@ -41,20 +41,20 @@ { Q_OBJECT public: - UpnpQueryMakerInternal( UpnpSearchCollection *collection ); + explicit UpnpQueryMakerInternal( UpnpSearchCollection *collection ); ~UpnpQueryMakerInternal(); void setQueryType( Collections::QueryMaker::QueryType type ) { m_queryType = type; } void reset(); void runQuery( QUrl query, bool filter=true ); Q_SIGNALS: - void results( bool error, const KIO::UDSEntryList list ); + void results( bool error, const KIO::UDSEntryList &list ); void done(); - void newTracksReady( Meta::TrackList ); - void newArtistsReady( Meta::ArtistList ); - void newAlbumsReady( Meta::AlbumList ); - void newGenresReady( Meta::GenreList ); + void newTracksReady( const Meta::TrackList &); + void newArtistsReady( const Meta::ArtistList &); + void newAlbumsReady( const Meta::AlbumList &); + void newGenresReady( const Meta::GenreList &); void newResultReady( const KIO::UDSEntryList & ); private Q_SLOTS: void slotEntries( KIO::Job *, const KIO::UDSEntryList & ); diff --git a/src/core-impl/collections/upnpcollection/UpnpQueryMakerInternal.cpp b/src/core-impl/collections/upnpcollection/UpnpQueryMakerInternal.cpp --- a/src/core-impl/collections/upnpcollection/UpnpQueryMakerInternal.cpp +++ b/src/core-impl/collections/upnpcollection/UpnpQueryMakerInternal.cpp @@ -110,9 +110,9 @@ // are available or not using queryItem("filter") details // if( job->error() ) - emit results( true, KIO::UDSEntryList() ); + Q_EMIT results( true, KIO::UDSEntryList() ); else - emit results( false, list ); + Q_EMIT results( false, list ); debug() << this << "SLOT ENTRIES" << list.length() << m_queryType; @@ -141,15 +141,15 @@ void UpnpQueryMakerInternal::slotDone( KJob *job ) { - // here check if all jobs done, then we might want to emit done() + // here check if all jobs done, then we might want to Q_EMIT done() // clean up this job, remove it from the hash and so on. m_jobCount--; job->deleteLater(); if( m_jobCount <= 0 ) { - //emit newResultReady( list ); + //Q_EMIT newResultReady( list ); debug() << "ALL JOBS DONE< TERMINATING THIS QM" << this; - emit done(); + Q_EMIT done(); } } @@ -166,9 +166,9 @@ } sj->deleteLater(); if( m_jobCount <= 0 ) { - //emit newResultReady( list ); + //Q_EMIT newResultReady( list ); debug() << "ALL JOBS DONE< TERMINATING THIS QM" << this; - emit done(); + Q_EMIT done(); } } @@ -189,7 +189,7 @@ } } } - emit newArtistsReady( ret ); + Q_EMIT newArtistsReady( ret ); } void UpnpQueryMakerInternal::handleAlbums( const KIO::UDSEntryList &list ) @@ -211,7 +211,7 @@ } } } - emit newAlbumsReady( ret ); + Q_EMIT newAlbumsReady( ret ); } void UpnpQueryMakerInternal::handleTracks( const KIO::UDSEntryList &list ) @@ -247,12 +247,12 @@ } ret << m_collection->cache()->getTrack( entry ); } - emit newTracksReady( ret ); + Q_EMIT newTracksReady( ret ); } void UpnpQueryMakerInternal::handleCustom( const KIO::UDSEntryList &list ) { - emit newResultReady( list ); + Q_EMIT newResultReady( list ); } } diff --git a/src/core-impl/collections/upnpcollection/UpnpSearchCollection.h b/src/core-impl/collections/upnpcollection/UpnpSearchCollection.h --- a/src/core-impl/collections/upnpcollection/UpnpSearchCollection.h +++ b/src/core-impl/collections/upnpcollection/UpnpSearchCollection.h @@ -31,11 +31,8 @@ namespace KIO { class Job; - class ListJob; } -class KJob; -class QTimer; namespace Collections { @@ -47,16 +44,16 @@ { Q_OBJECT public: - UpnpSearchCollection( const DeviceInfo&, QStringList searchCapabilities ); - virtual ~UpnpSearchCollection(); - virtual QueryMaker* queryMaker(); + UpnpSearchCollection( const DeviceInfo&, const QStringList &searchCapabilities ); + ~UpnpSearchCollection() override; + QueryMaker* queryMaker() override; - virtual QIcon icon() const { return QIcon::fromTheme("network-server"); } + QIcon icon() const override { return QIcon::fromTheme("network-server"); } - Meta::TrackPtr trackForUrl( const QUrl &url ); + Meta::TrackPtr trackForUrl( const QUrl &url ) override; UpnpCache* cache() { return m_cache; } - QStringList searchCapabilities() { return m_searchCapabilities; } + QStringList searchCapabilities() const { return m_searchCapabilities; } private Q_SLOTS: void slotFilesChanged(const QStringList &); diff --git a/src/core-impl/collections/upnpcollection/UpnpSearchCollection.cpp b/src/core-impl/collections/upnpcollection/UpnpSearchCollection.cpp --- a/src/core-impl/collections/upnpcollection/UpnpSearchCollection.cpp +++ b/src/core-impl/collections/upnpcollection/UpnpSearchCollection.cpp @@ -38,8 +38,8 @@ //UpnpSearchCollection -// TODO register for the device bye bye and emit remove() -UpnpSearchCollection::UpnpSearchCollection( const DeviceInfo& dev, QStringList searchCapabilities ) +// TODO register for the device bye bye and Q_EMIT remove() +UpnpSearchCollection::UpnpSearchCollection(const DeviceInfo& dev, const QStringList &searchCapabilities ) : UpnpCollectionBase( dev ) , m_searchCapabilities( searchCapabilities ) , m_cache( new UpnpCache( this ) ) diff --git a/src/core-impl/collections/upnpcollection/amarok_collection-upnpcollection.desktop b/src/core-impl/collections/upnpcollection/amarok_collection-upnpcollection.desktop --- a/src/core-impl/collections/upnpcollection/amarok_collection-upnpcollection.desktop +++ b/src/core-impl/collections/upnpcollection/amarok_collection-upnpcollection.desktop @@ -54,7 +54,6 @@ Name[uk]=Збірка на UPnP Name[wa]=Ramexhnêye UPnP Name[x-test]=xxUPnP Collectionxx -Name[zh_CN]=UPnP 收藏 Name[zh_TW]=UPnP 收藏 Comment=UPnP collection plugin for Amarok Comment[be]=Утулка калекцыі UPnP для Amarok @@ -83,7 +82,7 @@ Comment[it]=Estensione della collezione UPnP di Amarok Comment[ja]=Amarok のための UPnP コレクションプラグイン Comment[km]=កម្មវិធី​ជំនួយ​សម្រាំង UPnP សម្រាប់ Amarok -Comment[ko]=Amarok의 UPnP 모음집 플러그인 +Comment[ko]=Amarok용 UPnP 모음집 플러그인 Comment[ku]=Pêveka Berhevoka UPnP ji bo Amarok Comment[lt]=UPnP fonotekos Amarok papildinys Comment[lv]=UPnP kolekcijas Amarok spraudnis @@ -109,7 +108,6 @@ Comment[uk]=Додаток збірки на UPnP для Amarok Comment[wa]=Tchôke-divins di ramexhnêye UPnP pos Amarok Comment[x-test]=xxUPnP collection plugin for Amarokxx -Comment[zh_CN]=Amarok 的 UPnP 收藏插件 Comment[zh_TW]=Amarok 的 UPnP 收藏外掛程式 ServiceTypes=Amarok/Plugin diff --git a/src/core-impl/collections/upnpcollection/deviceinfo.h b/src/core-impl/collections/upnpcollection/deviceinfo.h --- a/src/core-impl/collections/upnpcollection/deviceinfo.h +++ b/src/core-impl/collections/upnpcollection/deviceinfo.h @@ -152,7 +152,7 @@ class DeviceInfo0_2_0 : public DeviceInfo { public: - DeviceInfo0_2_0( const DeviceDetailsMap &map ) + explicit DeviceInfo0_2_0( const DeviceDetailsMap &map ) { m_type = map.value( "deviceType" ); m_friendlyName = map.value( "friendlyName" ); diff --git a/src/core-impl/collections/upnpcollection/upnptypes.h b/src/core-impl/collections/upnpcollection/upnptypes.h --- a/src/core-impl/collections/upnpcollection/upnptypes.h +++ b/src/core-impl/collections/upnpcollection/upnptypes.h @@ -18,7 +18,8 @@ *********************************************************************/ /** - * @file Provides extra UDSEntry field types for UPnP specific meta-data + * @file upnptypes.h + * @brief Provides extra UDSEntry field types for UPnP specific meta-data */ #ifndef UPNPTYPES_H diff --git a/src/core-impl/logger/DebugLogger.h b/src/core-impl/logger/DebugLogger.h new file mode 100644 --- /dev/null +++ b/src/core-impl/logger/DebugLogger.h @@ -0,0 +1,45 @@ +/* + * Copyright 2018 Malte Veerman + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License or (at your option) version 3 or any later version + * accepted by the membership of KDE e.V. (or its successor approved + * by the membership of KDE e.V.), which shall act as a proxy + * defined in Section 14 of version 3 of the license. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef DEBUGLOGGER_H +#define DEBUGLOGGER_H + +#include + +#include + + +/** + * This class is for debugging messages send to the logging system. + */ +class DebugLogger : public Amarok::Logger, public QObject +{ +public: + DebugLogger( QObject *parent = nullptr ); + +protected: + void shortMessageImpl( const QString& text ) override; + void longMessageImpl( const QString& text, Amarok::Logger::MessageType type ) override; + void newProgressOperationImpl( QObject* sender, const QMetaMethod& increment, const QMetaMethod& end, const QString& text, int maximum, QObject* context, const std::function& function, Qt::ConnectionType type ) override; + void newProgressOperationImpl( QNetworkReply* reply, const QString& text, QObject* context, const std::function& function, Qt::ConnectionType type ) override; + void newProgressOperationImpl( KJob* job, const QString& text, QObject* context, const std::function& function, Qt::ConnectionType type ) override; +}; + +#endif // DEBUGLOGGER_H diff --git a/src/core-impl/logger/DebugLogger.cpp b/src/core-impl/logger/DebugLogger.cpp new file mode 100644 --- /dev/null +++ b/src/core-impl/logger/DebugLogger.cpp @@ -0,0 +1,81 @@ +/* + * Copyright 2018 Malte Veerman + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License or (at your option) version 3 or any later version + * accepted by the membership of KDE e.V. (or its successor approved + * by the membership of KDE e.V.), which shall act as a proxy + * defined in Section 14 of version 3 of the license. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "DebugLogger.h" + +#include "core/support/Debug.h" + + +DebugLogger::DebugLogger( QObject *parent ) + : QObject( parent ) +{ + DEBUG_BLOCK +} + +void DebugLogger::shortMessageImpl( const QString& text ) +{ + DEBUG_BLOCK + + debug() << "Short message:" << text; +} + +void DebugLogger::longMessageImpl( const QString& text, Amarok::Logger::MessageType type ) +{ + DEBUG_BLOCK + + debug() << "Long message:" << text << type; +} + +void DebugLogger::newProgressOperationImpl( QObject* sender, const QMetaMethod& increment, const QMetaMethod& end, const QString& text, int maximum, QObject* context, const std::function& function, Qt::ConnectionType type ) +{ + Q_UNUSED( increment ) + Q_UNUSED( end ) + + DEBUG_BLOCK + + debug() << "New progress operation with generic QObject:" << sender; + debug() << "Text:" << text; + debug() << "Maximum:" << maximum; + debug() << "Object to call when canceled:" << context; + debug() << "Member function to call when canceled:" << function.target_type().name(); + debug() << "Connection type:" << type; +} + +void DebugLogger::newProgressOperationImpl( QNetworkReply* reply, const QString& text, QObject* context, const std::function& function, Qt::ConnectionType type ) +{ + DEBUG_BLOCK + + debug() << "New progress operation with QNetworkReply:" << reply; + debug() << "Text:" << text; + debug() << "Object to call when canceled:" << context; + debug() << "Member function to call when canceled:" << function.target_type().name(); + debug() << "Connection type:" << type; +} + +void DebugLogger::newProgressOperationImpl( KJob* job, const QString& text, QObject* context, const std::function& function, Qt::ConnectionType type ) +{ + DEBUG_BLOCK + + debug() << "New progress operation with KJob:" << job; + debug() << "Text:" << text; + debug() << "Object to call when canceled:" << context; + debug() << "Member function to call when canceled:" << function.target_type().name(); + debug() << "Connection type:" << type; +} diff --git a/src/core-impl/logger/ProxyLogger.h b/src/core-impl/logger/ProxyLogger.h deleted file mode 100644 --- a/src/core-impl/logger/ProxyLogger.h +++ /dev/null @@ -1,108 +0,0 @@ -/**************************************************************************************** - * Copyright (c) 2010 Maximilian Kossick * - * * - * This program is free software; you can redistribute it and/or modify it under * - * the terms of the GNU General Public License as published by the Free Software * - * Foundation; either version 2 of the License, or (at your option) any later * - * version. * - * * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY * - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * - * PARTICULAR PURPOSE. See the GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License along with * - * this program. If not, see . * - ****************************************************************************************/ - -#ifndef AMAROK_PROXY_LOGGER_H -#define AMAROK_PROXY_LOGGER_H - -#include "core/interfaces/Logger.h" - -#include -#include -#include -#include -#include -#include - -#include - -class QNetworkReply; - -typedef QPair LongMessage; - -struct ProgressData -{ - QPointer sender; - QPointer job; - QPointer reply; - QString text; - int maximum; - QPointer cancelObject; - const char *slot; - Qt::ConnectionType type; -}; - -/** - * Proxy implementation for the Amarok::Logger interface. - * This class does not notify the user, but forwards the notifications - * to a real logger if available. If no logger is available yet, it stores - * the notifications until another logger becomes available. - * - * This class can be only instantiated from the main thread and must reside in the main - * thread for its lifetime. - */ -class ProxyLogger : public QObject, public Amarok::Logger -{ - Q_OBJECT - Q_PROPERTY( Amarok::Logger* logger - READ logger - WRITE setLogger - DESIGNABLE false ) - -public: - ProxyLogger(); - virtual ~ProxyLogger(); - -public Q_SLOTS: - virtual void shortMessage( const QString &text ); - virtual void longMessage( const QString &text, MessageType type ); - virtual void newProgressOperation( KJob *job, const QString &text, QObject *obj = 0, - const char *slot = 0, - Qt::ConnectionType type = Qt::AutoConnection ); - virtual void newProgressOperation( QNetworkReply *reply, const QString &text, QObject *obj = 0, - const char *slot = 0, - Qt::ConnectionType type = Qt::AutoConnection ); - virtual void newProgressOperation( QObject *sender, const QString &text, int maximum = 100, - QObject *obj = 0, const char *slot = 0, - Qt::ConnectionType type = Qt::AutoConnection ); - - /** - * Set the real logger. - * The proxy logger will forward notifications to this logger. - * @param logger The real logger to use. ProxyLogger does not take ownership of the pointer - */ - void setLogger( Logger *logger ); - Logger* logger() const; - -private Q_SLOTS: - void forwardNotifications(); - void slotStartTimer(); - void slotTotalSteps( int totalSteps ); - -Q_SIGNALS: - // timer can only be started from its thread, use signals & slots to pass thread barrier - void startTimer(); - -private: - Logger *m_logger; //!< stores the real logger - QMutex m_lock; //!< protect members that may be accessed from multiple threads - QTimer *m_timer; //!< internal timer that triggers forwarding of notifications - QQueue m_shortMessageQueue; //!< temporary storage for notifications that have not been forwarded yet - QQueue m_longMessageQueue; //!< temporary storage for notifications that have not been forwarded yet - QQueue m_progressQueue; //!< temporary storage for notifications that have not been forwarded yet -}; - -Q_DECLARE_METATYPE(ProxyLogger *) -#endif diff --git a/src/core-impl/logger/ProxyLogger.cpp b/src/core-impl/logger/ProxyLogger.cpp deleted file mode 100644 --- a/src/core-impl/logger/ProxyLogger.cpp +++ /dev/null @@ -1,186 +0,0 @@ -/**************************************************************************************** - * Copyright (c) 2010 Maximilian Kossick * - * * - * This program is free software; you can redistribute it and/or modify it under * - * the terms of the GNU General Public License as published by the Free Software * - * Foundation; either version 2 of the License, or (at your option) any later * - * version. * - * * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY * - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * - * PARTICULAR PURPOSE. See the GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License along with * - * this program. If not, see . * - ****************************************************************************************/ - -#include "ProxyLogger.h" - -#include -#include -#include - -ProxyLogger::ProxyLogger() - : Amarok::Logger() - , m_logger( 0 ) - , m_timer( 0 ) -{ - // ensure that the object livs in the GUI thread - Q_ASSERT( thread() == QCoreApplication::instance()->thread() ); - - m_timer = new QTimer( this ); - connect( m_timer, &QTimer::timeout, this, &ProxyLogger::forwardNotifications ); - m_timer->setSingleShot( true ); - m_timer->setInterval( 0 ); - - connect( this, &ProxyLogger::startTimer, this, &ProxyLogger::slotStartTimer ); -} - -ProxyLogger::~ProxyLogger() -{ - //nothing to do -} - -void -ProxyLogger::setLogger( Amarok::Logger *logger ) -{ - m_logger = logger; - emit startTimer(); -} - -Amarok::Logger * -ProxyLogger::logger() const -{ - return m_logger; -} - -void -ProxyLogger::slotStartTimer() -{ - if( m_logger && !m_timer->isActive() ) - m_timer->start(); -} - -void -ProxyLogger::shortMessage( const QString &text ) -{ - QMutexLocker locker( &m_lock ); - m_shortMessageQueue.enqueue( text ); - emit startTimer(); -} - -void -ProxyLogger::longMessage( const QString &text, MessageType type ) -{ - QMutexLocker locker( &m_lock ); - LongMessage msg; - msg.first = text; - msg.second = type; - m_longMessageQueue.enqueue( msg ); - emit startTimer(); -} - -void -ProxyLogger::newProgressOperation( KJob *job, const QString &text, QObject *obj, const char *slot, Qt::ConnectionType type ) -{ - QMutexLocker locker( &m_lock ); - ProgressData data; - data.job = job; - data.text = text; - data.cancelObject = obj; - data.slot = slot; - data.type = type; - m_progressQueue.enqueue( data ); - emit startTimer(); -} - -void -ProxyLogger::newProgressOperation( QNetworkReply *reply, const QString &text, QObject *obj, const char *slot, Qt::ConnectionType type ) -{ - QMutexLocker locker( &m_lock ); - ProgressData data; - data.reply = reply; - data.text = text; - data.cancelObject = obj; - data.slot = slot; - data.type = type; - m_progressQueue.enqueue( data ); - emit startTimer(); -} - -void -ProxyLogger::newProgressOperation( QObject *sender, const QString &text, int maximum, QObject *obj, - const char *slot, Qt::ConnectionType type ) -{ - QMutexLocker locker( &m_lock ); - ProgressData data; - data.sender = sender; - data.text = text; - data.maximum = maximum; - data.cancelObject = obj; - data.slot = slot; - data.type = type; - m_progressQueue.enqueue( data ); - connect( sender, SIGNAL(totalSteps(int)), SLOT(slotTotalSteps(int)) ); - emit startTimer(); -} - -void -ProxyLogger::forwardNotifications() -{ - QMutexLocker locker( &m_lock ); - if( !m_logger ) - return; //can't do anything before m_logger is created. - - while( !m_shortMessageQueue.isEmpty() ) - { - m_logger->shortMessage( m_shortMessageQueue.dequeue() ); - } - while( !m_longMessageQueue.isEmpty() ) - { - LongMessage msg = m_longMessageQueue.dequeue(); - m_logger->longMessage( msg.first, msg.second ); - } - while( !m_progressQueue.isEmpty() ) - { - ProgressData d = m_progressQueue.dequeue(); - if( d.job ) - { - m_logger->newProgressOperation( d.job.data(), d.text, d.cancelObject.data(), - d.cancelObject.data() ? d.slot : 0 , d.type ); - } - else if( d.reply ) - { - m_logger->newProgressOperation( d.reply.data(), d.text, d.cancelObject.data(), - d.cancelObject.data() ? d.slot : 0 , d.type ); - } - else if( d.sender ) - { - // m_logger handles the signals from now on - disconnect( d.sender.data(), 0, this, 0 ); - m_logger->newProgressOperation( d.sender.data(), d.text, d.maximum, - d.cancelObject.data(), - d.cancelObject.data() ? d.slot : 0 , d.type ); - } - } -} - -void -ProxyLogger::slotTotalSteps( int totalSteps ) -{ - QObject *operation = sender(); - if( !operation ) - // warning, slotTotalSteps can only be connected to progress operation QObject signal - return; - QMutableListIterator it( m_progressQueue ); - while( it.hasNext() ) - { - ProgressData &data = it.next(); - if( data.sender.data() != operation ) - continue; - data.maximum = totalSteps; - return; - } - // warning, operation not found in m_progressQueue -} - diff --git a/src/core-impl/meta/cue/CueFileSupport.h b/src/core-impl/meta/cue/CueFileSupport.h --- a/src/core-impl/meta/cue/CueFileSupport.h +++ b/src/core-impl/meta/cue/CueFileSupport.h @@ -105,7 +105,7 @@ INDEX_FOUND }; - static CueFileItemMap loadCueFile( const QUrl &cuefile, const Meta::TrackPtr track ); + static CueFileItemMap loadCueFile( const QUrl &cuefile, const Meta::TrackPtr &track ); static CueFileItemMap loadCueFile( const QUrl &cuefile, const QUrl &trackUrl, qint64 trackLen ); /** diff --git a/src/core-impl/meta/cue/CueFileSupport.cpp b/src/core-impl/meta/cue/CueFileSupport.cpp --- a/src/core-impl/meta/cue/CueFileSupport.cpp +++ b/src/core-impl/meta/cue/CueFileSupport.cpp @@ -35,7 +35,7 @@ * @author (C) 2005 by Martin Ehmke */ -CueFileItemMap CueFileSupport::loadCueFile( const QUrl &cuefile, const Meta::TrackPtr track ) +CueFileItemMap CueFileSupport::loadCueFile( const QUrl &cuefile, const Meta::TrackPtr &track ) { return loadCueFile( cuefile, track->playableUrl(), track->length() ); } @@ -83,7 +83,7 @@ { line = stream.readLine().simplified(); - if ( line.startsWith ( "title", Qt::CaseInsensitive ) ) + if ( line.startsWith ( QLatin1String("title"), Qt::CaseInsensitive ) ) { title = line.mid ( 6 ).remove ( '"' ); if ( mode == BEGIN && !filesSection ) @@ -101,7 +101,7 @@ debug() << "Title: " << title; } - else if ( line.startsWith ( "performer", Qt::CaseInsensitive ) ) + else if ( line.startsWith ( QLatin1String("performer"), Qt::CaseInsensitive ) ) { artist = line.mid ( 10 ).remove ( '"' ); if ( mode == BEGIN && !filesSection ) @@ -119,7 +119,7 @@ debug() << "Artist: " << artist; } - else if ( line.startsWith ( "track", Qt::CaseInsensitive ) && fileFound ) + else if ( line.startsWith ( QLatin1String("track"), Qt::CaseInsensitive ) && fileFound ) { if ( mode == TRACK_FOUND ) { @@ -145,15 +145,15 @@ debug() << "Track: " << trackNr; mode = TRACK_FOUND; } - else if ( line.startsWith ( "index", Qt::CaseInsensitive ) && fileFound ) + else if ( line.startsWith ( QLatin1String("index"), Qt::CaseInsensitive ) && fileFound ) { if ( mode == TRACK_FOUND ) { int indexNo = line.section ( ' ',1,1 ).toInt(); if ( indexNo == 1 ) { - QStringList time = line.section ( ' ', -1, -1 ).split ( ':' ); + QStringList time = line.section ( ' ', -1, -1 ).split ( QLatin1Char(':') ); index = time[0].toLong() *60*1000 + time[1].toLong() *1000 + time[2].toLong() *1000/75; //75 frames per second @@ -171,7 +171,7 @@ else if ( indexNo == 0 ) // gap, use to calc prev track length { - QStringList time = line.section ( ' ', -1, -1 ).split ( ':' ); + QStringList time = line.section ( ' ', -1, -1 ).split ( QLatin1Char(':') ); length = time[0].toLong() * 60 * 1000 + time[1].toLong() * 1000 + time[2].toLong() *1000/75; //75 frames per second @@ -199,7 +199,7 @@ } debug() << "index: " << index; } - else if( line.startsWith ( "file", Qt::CaseInsensitive ) ) + else if( line.startsWith ( QLatin1String("file"), Qt::CaseInsensitive ) ) { QString file = line.mid ( 5 ).remove ( '"' ); if( fileFound ) @@ -222,7 +222,7 @@ /** * Because there is no way to set the length for the last track in a normal way, * we have to do some magic here. Having the total length of the media file given - * we can set the lenth for the last track after all the cue file was loaded into array. + * we can set the length for the last track after all the cue file was loaded into array. */ cueItems[index].setLength ( trackLen - index ); @@ -239,7 +239,7 @@ return QUrl(); // look for the cue file that matches the media file QString path = trackurl.path(); - QString cueFile = path.left ( path.lastIndexOf ( '.' ) ) + ".cue"; + QString cueFile = path.left ( path.lastIndexOf ( QLatin1Char('.') ) ) + ".cue"; if ( validateCueSheet ( cueFile ) ) { @@ -251,7 +251,7 @@ bool foundCueFile = false; QDir dir ( trackurl.adjusted(QUrl::RemoveFilename|QUrl::StripTrailingSlash).path() ); QStringList filters; - filters << "*.cue" << "*.CUE"; + filters << QStringLiteral("*.cue") << QStringLiteral("*.CUE"); dir.setNameFilters ( filters ); QStringList cueFilesList = dir.entryList(); @@ -270,7 +270,7 @@ { line = stream.readLine().simplified(); - if ( line.startsWith ( "file", Qt::CaseInsensitive ) ) + if ( line.startsWith ( QLatin1String("file"), Qt::CaseInsensitive ) ) { line = line.mid ( 5 ).remove ( '"' ); @@ -323,7 +323,7 @@ { line = stream.readLine().simplified(); - if ( line.startsWith ( "title", Qt::CaseInsensitive ) ) + if ( line.startsWith ( QLatin1String("title"), Qt::CaseInsensitive ) ) { title = line.mid ( 6 ).remove ( '"' ); if ( mode == BEGIN ) @@ -336,7 +336,7 @@ debug() << "Title: " << title; } - else if ( line.startsWith ( "performer", Qt::CaseInsensitive ) ) + else if ( line.startsWith ( QLatin1String("performer"), Qt::CaseInsensitive ) ) { artist = line.mid ( 10 ).remove ( '"' ); if ( mode == BEGIN ) @@ -349,7 +349,7 @@ debug() << "Artist: " << artist; } - else if ( line.startsWith ( "track", Qt::CaseInsensitive ) ) + else if ( line.startsWith ( QLatin1String("track"), Qt::CaseInsensitive ) ) { if ( mode == TRACK_FOUND ) { @@ -372,15 +372,15 @@ debug() << "Track: " << track; mode = TRACK_FOUND; } - else if ( line.startsWith ( "index", Qt::CaseInsensitive ) ) + else if ( line.startsWith ( QLatin1String("index"), Qt::CaseInsensitive ) ) { if ( mode == TRACK_FOUND ) { int indexNo = line.section ( ' ',1,1 ).toInt(); if ( indexNo == 1 ) { - QStringList time = line.section ( ' ', -1, -1 ).split ( ':' ); + QStringList time = line.section ( ' ', -1, -1 ).split ( QLatin1Char(':') ); index = time[0].toLong() *60*1000 + time[1].toLong() *1000 + time[2].toLong() *1000/75; //75 frames per second @@ -396,7 +396,7 @@ else if ( indexNo == 0 ) // gap, use to calc prev track length { - QStringList time = line.section ( ' ', -1, -1 ).split ( ':' ); + QStringList time = line.section ( ' ', -1, -1 ).split ( QLatin1Char(':') ); length = time[0].toLong() *60*1000 + time[1].toLong() *1000 + time[2].toLong() *1000/75; //75 frames per second diff --git a/src/core-impl/meta/default/DefaultMetaTypes.h b/src/core-impl/meta/default/DefaultMetaTypes.h --- a/src/core-impl/meta/default/DefaultMetaTypes.h +++ b/src/core-impl/meta/default/DefaultMetaTypes.h @@ -33,12 +33,12 @@ { public: - DefaultArtist() {}; - virtual ~DefaultArtist() {}; + DefaultArtist() {} + virtual ~DefaultArtist() {} - virtual QString name() const { return i18nc( "The value is not known", "Unknown" ); } + QString name() const override { return i18nc( "The value is not known", "Unknown" ); } - virtual TrackList tracks() { return TrackList(); } + TrackList tracks() override { return TrackList(); } }; class AMAROK_EXPORT DefaultAlbum : public Meta::Album @@ -48,16 +48,16 @@ DefaultAlbum() : Meta::Album() , m_albumArtist( new DefaultArtist() ) {} - virtual ~DefaultAlbum() {}; + virtual ~DefaultAlbum() {} - virtual bool hasAlbumArtist() const { return true; } - virtual ArtistPtr albumArtist() const { return m_albumArtist; } + bool hasAlbumArtist() const override { return true; } + ArtistPtr albumArtist() const override { return m_albumArtist; } - virtual bool isCompilation() const { return false; } + bool isCompilation() const override { return false; } - virtual QString name() const { return i18nc( "The Value is not known", "Unknown" ); } + QString name() const override { return i18nc( "The Value is not known", "Unknown" ); } - virtual TrackList tracks() { return TrackList(); } + TrackList tracks() override { return TrackList(); } private: Meta::ArtistPtr m_albumArtist; @@ -69,12 +69,12 @@ { public: - DefaultComposer() {}; - virtual ~DefaultComposer() {}; + DefaultComposer() {} + virtual ~DefaultComposer() {} - virtual QString name() const { return i18nc( "The value is not known", "Unknown" ); } + QString name() const override { return i18nc( "The value is not known", "Unknown" ); } - virtual TrackList tracks() { return TrackList(); } + TrackList tracks() override { return TrackList(); } private: @@ -86,24 +86,24 @@ { public: - DefaultGenre() {}; - virtual ~DefaultGenre() {}; + DefaultGenre() {} + virtual ~DefaultGenre() {} - virtual QString name() const { return i18nc( "The value is not known", "Unknown" ); } + QString name() const override { return i18nc( "The value is not known", "Unknown" ); } - virtual TrackList tracks() { return TrackList(); } + TrackList tracks() override { return TrackList(); } }; class AMAROK_EXPORT DefaultYear : public Meta::Year { public: - DefaultYear() {}; - virtual ~DefaultYear() {}; + DefaultYear() {} + virtual ~DefaultYear() {} - virtual QString name() const { return "0"; } + QString name() const override { return QStringLiteral("0"); } - virtual TrackList tracks() { return TrackList(); } + TrackList tracks() override { return TrackList(); } }; diff --git a/src/core-impl/meta/file/File.h b/src/core-impl/meta/file/File.h --- a/src/core-impl/meta/file/File.h +++ b/src/core-impl/meta/file/File.h @@ -31,75 +31,75 @@ class AMAROK_EXPORT Track : public Meta::Track, public Meta::Statistics, Meta::TrackEditor { public: - Track( const QUrl &url ); + explicit Track( const QUrl &url ); virtual ~Track(); //methods inherited from Meta::Base - virtual QString name() const; + QString name() const override; //methods inherited from Meta::Track - virtual QUrl playableUrl() const; - virtual QString prettyUrl() const; - virtual QString uidUrl() const; - virtual QString notPlayableReason() const; + QUrl playableUrl() const override; + QString prettyUrl() const override; + QString uidUrl() const override; + QString notPlayableReason() const override; - virtual Meta::AlbumPtr album() const; - virtual Meta::ArtistPtr artist() const; - virtual Meta::GenrePtr genre() const; - virtual Meta::ComposerPtr composer() const; - virtual Meta::YearPtr year() const; + Meta::AlbumPtr album() const override; + Meta::ArtistPtr artist() const override; + Meta::GenrePtr genre() const override; + Meta::ComposerPtr composer() const override; + Meta::YearPtr year() const override; - virtual qreal bpm() const; - virtual QString comment() const; + qreal bpm() const override; + QString comment() const override; - virtual int trackNumber() const; - virtual int discNumber() const; + int trackNumber() const override; + int discNumber() const override; - virtual qint64 length() const; - virtual int filesize() const; - virtual int sampleRate() const; - virtual int bitrate() const; - virtual QDateTime createDate() const; + qint64 length() const override; + int filesize() const override; + int sampleRate() const override; + int bitrate() const override; + QDateTime createDate() const override; - virtual qreal replayGain( Meta::ReplayGainTag mode ) const; + qreal replayGain( Meta::ReplayGainTag mode ) const override; - virtual QString type() const; + QString type() const override; - virtual bool inCollection() const; - virtual Collections::Collection *collection() const; + bool inCollection() const override; + Collections::Collection *collection() const override; - virtual bool hasCapabilityInterface( Capabilities::Capability::Type type ) const; - virtual Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ); + bool hasCapabilityInterface( Capabilities::Capability::Type type ) const override; + Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ) override; - virtual Meta::TrackEditorPtr editor(); - virtual Meta::StatisticsPtr statistics(); + Meta::TrackEditorPtr editor() override; + Meta::StatisticsPtr statistics() override; // Meta::TrackEditor methods: - virtual void setAlbum( const QString &newAlbum ); - virtual void setAlbumArtist( const QString &newAlbumArtist ); - virtual void setArtist( const QString &newArtist ); - virtual void setComposer( const QString &newComposer ); - virtual void setGenre( const QString &newGenre ); - virtual void setYear( int newYear ); - virtual void setTitle( const QString &newTitle ); - virtual void setComment( const QString &newComment ); - virtual void setTrackNumber( int newTrackNumber ); - virtual void setDiscNumber( int newDiscNumber ); - virtual void setBpm( const qreal newBpm ); + void setAlbum( const QString &newAlbum ) override; + void setAlbumArtist( const QString &newAlbumArtist ) override; + void setArtist( const QString &newArtist ) override; + void setComposer( const QString &newComposer ) override; + void setGenre( const QString &newGenre ) override; + void setYear( int newYear ) override; + void setTitle( const QString &newTitle ) override; + void setComment( const QString &newComment ) override; + void setTrackNumber( int newTrackNumber ) override; + void setDiscNumber( int newDiscNumber ) override; + void setBpm( const qreal newBpm ) override; // Meta::Statistics methods: - virtual double score() const; - virtual void setScore( double newScore ); + double score() const override; + void setScore( double newScore ) override; - virtual int rating() const; - virtual void setRating( int newRating ); + int rating() const override; + void setRating( int newRating ) override; - virtual int playCount() const; - virtual void setPlayCount( int newPlayCount ); + int playCount() const override; + void setPlayCount( int newPlayCount ) override; // combined Meta::TrackEditor, Meta::Statistics methods: - virtual void beginUpdate(); - virtual void endUpdate(); + void beginUpdate() override; + void endUpdate() override; // MetaFile::Track own methods: bool isEditable() const; diff --git a/src/core-impl/meta/file/File.cpp b/src/core-impl/meta/file/File.cpp --- a/src/core-impl/meta/file/File.cpp +++ b/src/core-impl/meta/file/File.cpp @@ -56,13 +56,13 @@ , m_track( track ) {} - virtual bool writeTimecode ( qint64 miliseconds ) + bool writeTimecode ( qint64 miliseconds ) override { DEBUG_BLOCK return Capabilities::TimecodeWriteCapability::writeTimecode( miliseconds, Meta::TrackPtr( m_track.data() ) ); } - virtual bool writeAutoTimecode ( qint64 miliseconds ) + bool writeAutoTimecode ( qint64 miliseconds ) override { DEBUG_BLOCK return Capabilities::TimecodeWriteCapability::writeAutoTimecode( miliseconds, Meta::TrackPtr( m_track.data() ) ); @@ -80,14 +80,14 @@ , m_track( track ) {} - virtual bool hasTimecodes() + bool hasTimecodes() override { if ( loadTimecodes().size() > 0 ) return true; return false; } - virtual BookmarkList loadTimecodes() + BookmarkList loadTimecodes() override { BookmarkList list = PlayUrlRunner::bookmarksFromUrl( m_track->playableUrl() ); return list; @@ -106,13 +106,13 @@ , m_track( track ) {} - virtual void findInSource( QFlags tag ) + void findInSource( QFlags tag ) override { Q_UNUSED( tag ) //first show the filebrowser AmarokUrl url; - url.setCommand( "navigate" ); - url.setPath( "files" ); + url.setCommand( QStringLiteral("navigate") ); + url.setPath( QStringLiteral("files") ); url.run(); //then navigate to the correct directory @@ -161,7 +161,7 @@ const QString trackName = d->m_data.title; return trackName; } - return "This is a bug!"; + return QStringLiteral("This is a bug!"); } QUrl @@ -423,7 +423,7 @@ QMimeDatabase db; const QMimeType mimeType = db.mimeTypeForFile( url.toLocalFile() ); const QString name = mimeType.name(); - return name.startsWith( "audio/" ) || name.startsWith( "video/" ); + return name.startsWith( QLatin1String("audio/") ) || name.startsWith( QLatin1String("video/") ); } void @@ -587,7 +587,7 @@ return; } - d->writeMetaData(); // clears d->chages + d->writeMetaData(); // clears d->changes d->lock.unlock(); // rather call notifyObservers() without a lock notifyObservers(); d->lock.lockForWrite(); // return to original state diff --git a/src/core-impl/meta/file/FileTrackProvider.h b/src/core-impl/meta/file/FileTrackProvider.h --- a/src/core-impl/meta/file/FileTrackProvider.h +++ b/src/core-impl/meta/file/FileTrackProvider.h @@ -21,17 +21,17 @@ #include "core/collections/Collection.h" /** - * A simple track provider that contructs MetaFile::Tracks for local and + * A simple track provider that constructs MetaFile::Tracks for local and * existing urls. (no remote protocols supported, just "file" protocol.) */ class AMAROK_EXPORT FileTrackProvider : public Collections::TrackProvider { public: FileTrackProvider(); virtual ~FileTrackProvider(); - virtual bool possiblyContainsTrack( const QUrl &url ) const; - virtual Meta::TrackPtr trackForUrl( const QUrl &url ); + bool possiblyContainsTrack( const QUrl &url ) const override; + Meta::TrackPtr trackForUrl( const QUrl &url ) override; private: Q_DISABLE_COPY( FileTrackProvider ) diff --git a/src/core-impl/meta/file/File_p.h b/src/core-impl/meta/file/File_p.h --- a/src/core-impl/meta/file/File_p.h +++ b/src/core-impl/meta/file/File_p.h @@ -223,25 +223,25 @@ class FileArtist : public Meta::Artist { public: - FileArtist( MetaFile::Track::Private *dptr, bool isAlbumArtist = false ) + explicit FileArtist( MetaFile::Track::Private *dptr, bool isAlbumArtist = false ) : Meta::Artist() , d( dptr ) , m_isAlbumArtist( isAlbumArtist ) {} - Meta::TrackList tracks() + Meta::TrackList tracks() override { return Meta::TrackList(); } - QString name() const + QString name() const override { const QString artist = m_isAlbumArtist ? d.data()->m_data.albumArtist : d.data()->m_data.artist; return artist; } - bool operator==( const Meta::Artist &other ) const { + bool operator==( const Meta::Artist &other ) const override { return name() == other.name(); } @@ -252,12 +252,12 @@ class FileAlbum : public Meta::Album { public: - FileAlbum( MetaFile::Track::Private *dptr ) + explicit FileAlbum( MetaFile::Track::Private *dptr ) : Meta::Album() , d( dptr ) {} - bool hasCapabilityInterface( Capabilities::Capability::Type type ) const + bool hasCapabilityInterface( Capabilities::Capability::Type type ) const override { switch( type ) { @@ -268,7 +268,7 @@ } } - Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ) + Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ) override { switch( type ) { @@ -279,19 +279,19 @@ } } - bool isCompilation() const + bool isCompilation() const override { /* non-compilation albums with no album artists may be hidden in collection * browser if certain modes are used, so force compilation in this case */ return !hasAlbumArtist(); } - bool hasAlbumArtist() const + bool hasAlbumArtist() const override { return !d.data()->albumArtist->name().isEmpty(); } - Meta::ArtistPtr albumArtist() const + Meta::ArtistPtr albumArtist() const override { /* only return album artist if it would be non-empty, some Amarok parts do not * call hasAlbumArtist() prior to calling albumArtist() and it is better to be @@ -301,12 +301,12 @@ return Meta::ArtistPtr(); } - Meta::TrackList tracks() + Meta::TrackList tracks() override { return Meta::TrackList(); } - QString name() const + QString name() const override { if( d ) { @@ -317,14 +317,14 @@ return QString(); } - bool hasImage( int /* size */ = 0 ) const + bool hasImage( int /* size */ = 0 ) const override { if( d && d.data()->m_data.embeddedImage ) return true; return false; } - QImage image( int size = 0 ) const + QImage image( int size = 0 ) const override { QImage image; if( d && d.data()->m_data.embeddedImage ) @@ -337,26 +337,26 @@ return image.scaled( size, size, Qt::KeepAspectRatio, Qt::SmoothTransformation ); } - bool canUpdateImage() const + bool canUpdateImage() const override { return d; // true if underlying track is not null } - void setImage( const QImage &image ) + void setImage( const QImage &image ) override { if( !d ) return; Meta::FieldHash fields; fields.insert( Meta::valImage, image ); WriteTagsJob *job = new WriteTagsJob( d.data()->url.toLocalFile(), fields ); - QObject::connect( job, SIGNAL(done(ThreadWeaver::JobPointer)), job, SLOT(deleteLater()) ); + QObject::connect( job, &WriteTagsJob::done, job, &QObject::deleteLater ); ThreadWeaver::Queue::instance()->enqueue( QSharedPointer(job) ); if( d.data()->m_data.embeddedImage == image.isNull() ) // we need to toggle the embeddedImage switch in this case - QObject::connect( job, SIGNAL(done(ThreadWeaver::JobPointer)), d.data(), SLOT(readMetaData()) ); + QObject::connect( job, &WriteTagsJob::done, d.data(), &Track::Private::readMetaData ); CoverCache::invalidateAlbum( this ); notifyObservers(); @@ -366,12 +366,12 @@ d.data()->notifyObservers(); } - void removeImage() + void removeImage() override { setImage( QImage() ); } - bool operator==( const Meta::Album &other ) const { + bool operator==( const Meta::Album &other ) const override { return name() == other.name(); } @@ -381,23 +381,23 @@ class FileGenre : public Meta::Genre { public: - FileGenre( MetaFile::Track::Private *dptr ) + explicit FileGenre( MetaFile::Track::Private *dptr ) : Meta::Genre() , d( dptr ) {} - Meta::TrackList tracks() + Meta::TrackList tracks() override { return Meta::TrackList(); } - QString name() const + QString name() const override { const QString genreName = d.data()->m_data.genre; return genreName; } - bool operator==( const Meta::Genre &other ) const { + bool operator==( const Meta::Genre &other ) const override { return name() == other.name(); } @@ -407,23 +407,23 @@ class FileComposer : public Meta::Composer { public: - FileComposer( MetaFile::Track::Private *dptr ) + explicit FileComposer( MetaFile::Track::Private *dptr ) : Meta::Composer() , d( dptr ) {} - Meta::TrackList tracks() + Meta::TrackList tracks() override { return Meta::TrackList(); } - QString name() const + QString name() const override { const QString composer = d.data()->m_data.composer; return composer; } - bool operator==( const Meta::Composer &other ) const { + bool operator==( const Meta::Composer &other ) const override { return name() == other.name(); } @@ -433,23 +433,23 @@ class FileYear : public Meta::Year { public: - FileYear( MetaFile::Track::Private *dptr ) + explicit FileYear( MetaFile::Track::Private *dptr ) : Meta::Year() , d( dptr ) {} - Meta::TrackList tracks() + Meta::TrackList tracks() override { return Meta::TrackList(); } - QString name() const + QString name() const override { const QString year = QString::number( d.data()->m_data.year ); return year; } - bool operator==( const Meta::Year &other ) const { + bool operator==( const Meta::Year &other ) const override { return name() == other.name(); } diff --git a/src/core-impl/meta/multi/MultiTrack.h b/src/core-impl/meta/multi/MultiTrack.h --- a/src/core-impl/meta/multi/MultiTrack.h +++ b/src/core-impl/meta/multi/MultiTrack.h @@ -36,7 +36,7 @@ Q_OBJECT public: - MultiTrack( Playlists::PlaylistPtr playlist ); + explicit MultiTrack( Playlists::PlaylistPtr playlist ); ~MultiTrack(); QStringList sources() const; @@ -83,10 +83,10 @@ private: using Observer::metadataChanged; - virtual void metadataChanged( Meta::TrackPtr track ); + void metadataChanged( const Meta::TrackPtr &track ) override; using PlaylistObserver::metadataChanged; - virtual void trackAdded( Playlists::PlaylistPtr playlist, TrackPtr track, int position ); + void trackAdded( const Playlists::PlaylistPtr &playlist, const TrackPtr &track, int position ) override; /** * Implementation for setSource. Must be called with m_lock held for writing. @@ -98,7 +98,7 @@ TrackPtr m_currentTrack; /** * Guards access to data members; note that m_playlist methods are considered - * thread-safe and the pointer itself does not change throughout life of thhis + * thread-safe and the pointer itself does not change throughout life of this * object, so mere m_playlist->someMethod() doesn't have to be guarded. */ mutable QReadWriteLock m_lock; diff --git a/src/core-impl/meta/multi/MultiTrack.cpp b/src/core-impl/meta/multi/MultiTrack.cpp --- a/src/core-impl/meta/multi/MultiTrack.cpp +++ b/src/core-impl/meta/multi/MultiTrack.cpp @@ -60,7 +60,7 @@ locker.unlock(); notifyObservers(); - emit urlChanged( playableUrl() ); + Q_EMIT urlChanged( playableUrl() ); } int @@ -117,15 +117,15 @@ } void -Meta::MultiTrack::metadataChanged( Meta::TrackPtr track ) +Meta::MultiTrack::metadataChanged(const TrackPtr &track ) { Q_UNUSED( track ) // forward changes from active tracks notifyObservers(); } void -MultiTrack::trackAdded( Playlists::PlaylistPtr, TrackPtr, int ) +MultiTrack::trackAdded(const Playlists::PlaylistPtr &, const TrackPtr &, int ) { PlaylistObserver::unsubscribeFrom( m_playlist ); @@ -136,7 +136,7 @@ locker.unlock(); notifyObservers(); - emit urlChanged( playableUrl() ); + Q_EMIT urlChanged( playableUrl() ); } } diff --git a/src/core-impl/meta/proxy/MetaProxy.h b/src/core-impl/meta/proxy/MetaProxy.h --- a/src/core-impl/meta/proxy/MetaProxy.h +++ b/src/core-impl/meta/proxy/MetaProxy.h @@ -48,98 +48,101 @@ * Construct a lazy-loading proxying track. You must assign this track to a * AmarokSharedPointer right after constructing it. * - * If @param lookupType is AutomaticLookup (the default), an asynchronous + * If @p lookupType is AutomaticLookup (the default), an asynchronous * job employing CollectionManager to lookup the track in TrackProviders is * enqueued and started right from this constructor. * - * If @param lookupType is ManualLookup, lookup is not done automatically + * If @p lookupType is ManualLookup, lookup is not done automatically * and you are responsible to call lookupTrack() once it is feasible. This way * you can also optionally define which TrackProvider will be used. + * + * @param url th URL + * @param lookupType lookup type */ - Track( const QUrl &url, LookupType lookupType = AutomaticLookup ); + explicit Track( const QUrl &url, LookupType lookupType = AutomaticLookup ); virtual ~Track(); /** * Tell MetaProxy::Track to start looking up the real track. Only valid if * this Track is constructed with lookupType = ManualLookup. This method * returns quickly and the lookup happens asynchronously in a thread (in - * other words, @param provider, id supplied, must be thread-safe). + * other words, @p provider, id supplied, must be thread-safe). * - * If @param provider is null (the default), lookup happens in all + * If @p provider is null (the default), lookup happens in all * registered providers by employing CollectionManager. Otherwise lookup * only checks @param provider (still asynchronously). */ void lookupTrack( Collections::TrackProvider *provider = 0 ); // methods inherited from Meta::MetaCapability - virtual bool hasCapabilityInterface( Capabilities::Capability::Type type ) const; - virtual Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ); + bool hasCapabilityInterface( Capabilities::Capability::Type type ) const override; + Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ) override; // methods inherited from Meta::Base - virtual QString name() const; - virtual QString prettyName() const; - virtual QString sortableName() const; + QString name() const override; + QString prettyName() const override; + QString sortableName() const override; // methods inherited from Meta::Track - virtual QUrl playableUrl() const; - virtual QString prettyUrl() const; - virtual QString uidUrl() const; - virtual QString notPlayableReason() const; - - virtual Meta::AlbumPtr album() const; - virtual Meta::ArtistPtr artist() const; - virtual Meta::GenrePtr genre() const; - virtual Meta::ComposerPtr composer() const; - virtual Meta::YearPtr year() const; - - virtual Meta::LabelList labels() const; - virtual qreal bpm() const; - virtual QString comment() const; - virtual qint64 length() const; - virtual int filesize() const; - virtual int sampleRate() const; - virtual int bitrate() const; - virtual QDateTime createDate() const; - virtual QDateTime modifyDate() const; - virtual int trackNumber() const; - virtual int discNumber() const; - virtual qreal replayGain( Meta::ReplayGainTag mode ) const; - - virtual QString type() const; - - virtual void prepareToPlay(); - virtual void finishedPlaying( double playedFraction ); - - virtual bool inCollection() const; - virtual Collections::Collection *collection() const; - - virtual QString cachedLyrics() const; - virtual void setCachedLyrics( const QString &lyrics ); - - virtual void addLabel( const QString &label ); - virtual void addLabel( const Meta::LabelPtr &label ); - virtual void removeLabel( const Meta::LabelPtr &label ); - - virtual Meta::TrackEditorPtr editor(); - virtual Meta::StatisticsPtr statistics(); - - virtual bool operator==( const Meta::Track &track ) const; + QUrl playableUrl() const override; + QString prettyUrl() const override; + QString uidUrl() const override; + QString notPlayableReason() const override; + + Meta::AlbumPtr album() const override; + Meta::ArtistPtr artist() const override; + Meta::GenrePtr genre() const override; + Meta::ComposerPtr composer() const override; + Meta::YearPtr year() const override; + + Meta::LabelList labels() const override; + qreal bpm() const override; + QString comment() const override; + qint64 length() const override; + int filesize() const override; + int sampleRate() const override; + int bitrate() const override; + QDateTime createDate() const override; + QDateTime modifyDate() const override; + int trackNumber() const override; + int discNumber() const override; + qreal replayGain( Meta::ReplayGainTag mode ) const override; + + QString type() const override; + + void prepareToPlay() override; + void finishedPlaying( double playedFraction ) override; + + bool inCollection() const override; + Collections::Collection *collection() const override; + + QString cachedLyrics() const override; + void setCachedLyrics( const QString &lyrics ) override; + + void addLabel( const QString &label ) override; + void addLabel( const Meta::LabelPtr &label ) override; + void removeLabel( const Meta::LabelPtr &label ) override; + + Meta::TrackEditorPtr editor() override; + Meta::StatisticsPtr statistics() override; + + bool operator==( const Meta::Track &track ) const override; // Meta::TrackEditor methods: - virtual void setAlbum( const QString &album ); - virtual void setAlbumArtist( const QString &artist ); - virtual void setArtist( const QString &artist ); - virtual void setComposer( const QString &composer ); - virtual void setGenre( const QString &genre ); - virtual void setYear( int year ); - virtual void setComment( const QString &comment ); - virtual void setTitle( const QString &name ); - virtual void setTrackNumber( int number ); - virtual void setDiscNumber( int discNumber ); - virtual void setBpm( const qreal bpm ); - - virtual void beginUpdate(); - virtual void endUpdate(); + void setAlbum( const QString &album ) override; + void setAlbumArtist( const QString &artist ) override; + void setArtist( const QString &artist ) override; + void setComposer( const QString &composer ) override; + void setGenre( const QString &genre ) override; + void setYear( int year ) override; + void setComment( const QString &comment ) override; + void setTitle( const QString &name ) override; + void setTrackNumber( int number ) override; + void setDiscNumber( int discNumber ) override; + void setBpm( const qreal bpm ) override; + + void beginUpdate() override; + void endUpdate() override; // custom MetaProxy methods /** @@ -151,7 +154,7 @@ /** * MetaProxy will update the proxy with the track. */ - void updateTrack( Meta::TrackPtr track ); + void updateTrack( const Meta::TrackPtr &track ); private: Q_DISABLE_COPY( Track ) diff --git a/src/core-impl/meta/proxy/MetaProxy.cpp b/src/core-impl/meta/proxy/MetaProxy.cpp --- a/src/core-impl/meta/proxy/MetaProxy.cpp +++ b/src/core-impl/meta/proxy/MetaProxy.cpp @@ -372,7 +372,7 @@ return d->realTrack->type(); else // just debugging, normal users shouldn't hit this - return QString( "MetaProxy::Track" ); + return QStringLiteral( "MetaProxy::Track" ); } void @@ -453,7 +453,7 @@ } void -MetaProxy::Track::updateTrack( Meta::TrackPtr track ) +MetaProxy::Track::updateTrack( const Meta::TrackPtr &track ) { d->slotUpdateTrack( track ); } @@ -515,7 +515,7 @@ void Track::endUpdate() { - // we intentionally don't call metadataUpdated() so that thi first thing that + // we intentionally don't call metadataUpdated() so that the first thing that // triggers metadataUpdated() is when the real track is found. } diff --git a/src/core-impl/meta/proxy/MetaProxyWorker.h b/src/core-impl/meta/proxy/MetaProxyWorker.h --- a/src/core-impl/meta/proxy/MetaProxyWorker.h +++ b/src/core-impl/meta/proxy/MetaProxyWorker.h @@ -36,18 +36,20 @@ public: /** - * If @param provider is null (the default), all providers registered to + * If @p provider is null (the default), all providers registered to * CollectionManager are used and a watch for new providers is used. - * Otherwise the lookup happes just in @param provider and is one-shot. + * Otherwise the lookup happens just in @p provider and is one-shot. + * @param url the URL + * @param provider track provider */ explicit Worker( const QUrl &url, Collections::TrackProvider *provider = 0 ); //TrackForUrlWorker virtual methods - virtual void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) Q_DECL_OVERRIDE; + void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) override; protected: - void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; - void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; + void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; + void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; Q_SIGNALS: void finishedLookup( Meta::TrackPtr track ); diff --git a/src/core-impl/meta/proxy/MetaProxyWorker.cpp b/src/core-impl/meta/proxy/MetaProxyWorker.cpp --- a/src/core-impl/meta/proxy/MetaProxyWorker.cpp +++ b/src/core-impl/meta/proxy/MetaProxyWorker.cpp @@ -40,14 +40,14 @@ if( m_provider ) { track = m_provider->trackForUrl( m_url ); - emit finishedLookup( track ); + Q_EMIT finishedLookup( track ); return; } track = CollectionManager::instance()->trackForUrl( m_url ); if( track ) { - emit finishedLookup( track ); + Q_EMIT finishedLookup( track ); return; } @@ -89,7 +89,7 @@ if( newTrackProvider->possiblyContainsTrack( m_url ) ) { Meta::TrackPtr track = newTrackProvider->trackForUrl( m_url ); - emit finishedLookup( track ); + Q_EMIT finishedLookup( track ); } } diff --git a/src/core-impl/meta/proxy/MetaProxy_p.h b/src/core-impl/meta/proxy/MetaProxy_p.h --- a/src/core-impl/meta/proxy/MetaProxy_p.h +++ b/src/core-impl/meta/proxy/MetaProxy_p.h @@ -62,14 +62,14 @@ public: using Observer::metadataChanged; - void metadataChanged( Meta::TrackPtr track ) + void metadataChanged( const Meta::TrackPtr &track ) override { Q_UNUSED( track ) proxy->notifyObservers(); } public Q_SLOTS: - void slotUpdateTrack( Meta::TrackPtr track ) + void slotUpdateTrack( const Meta::TrackPtr &track ) { if( track ) { @@ -100,19 +100,19 @@ class ProxyArtist : public Meta::Artist { public: - ProxyArtist( MetaProxy::Track::Private *dptr ) + explicit ProxyArtist( MetaProxy::Track::Private *dptr ) : Meta::Artist() , d( dptr ) {} - Meta::TrackList tracks() + Meta::TrackList tracks() override { Meta::TrackPtr realTrack = d ? d->realTrack : Meta::TrackPtr(); Meta::ArtistPtr artist = realTrack ? realTrack->artist() : Meta::ArtistPtr(); return artist ? artist->tracks() : Meta::TrackList(); } - QString name() const + QString name() const override { Meta::TrackPtr realTrack = d ? d->realTrack : Meta::TrackPtr(); if( realTrack ) @@ -123,7 +123,7 @@ return d ? d->cachedArtist : QString(); } - QString prettyName() const + QString prettyName() const override { Meta::TrackPtr realTrack = d ? d->realTrack : Meta::TrackPtr(); if( realTrack ) @@ -134,7 +134,7 @@ return d ? d->cachedArtist : QString(); } - virtual bool operator==( const Meta::Artist &artist ) const + bool operator==( const Meta::Artist &artist ) const override { const ProxyArtist *proxy = dynamic_cast( &artist ); if( proxy ) @@ -154,74 +154,74 @@ class ProxyAlbum : public Meta::Album { public: - ProxyAlbum( MetaProxy::Track::Private *dptr ) + explicit ProxyAlbum( MetaProxy::Track::Private *dptr ) : Meta::Album() , d( dptr ) {} - bool hasCapabilityInterface( Capabilities::Capability::Type type ) const + bool hasCapabilityInterface( Capabilities::Capability::Type type ) const override { if( d && d->realTrack && d->realTrack->album() ) return d->realTrack->album()->hasCapabilityInterface( type ); else return false; } - Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ) + Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ) override { if( d && d->realTrack && d->realTrack->album() ) return d->realTrack->album()->createCapabilityInterface( type ); else return 0; } - bool isCompilation() const + bool isCompilation() const override { if( d && d->realTrack && d->realTrack->album() ) return d->realTrack->album()->isCompilation(); else return false; } - bool canUpdateCompilation() const + bool canUpdateCompilation() const override { if( d && d->realTrack && d->realTrack->album() ) return d->realTrack->album()->canUpdateCompilation(); else return Meta::Album::canUpdateCompilation(); } - void setCompilation( bool isCompilation ) + void setCompilation( bool isCompilation ) override { if( d && d->realTrack && d->realTrack->album() ) - return d->realTrack->album()->setCompilation( isCompilation ); + d->realTrack->album()->setCompilation( isCompilation ); } - bool hasAlbumArtist() const + bool hasAlbumArtist() const override { if( d && d->realTrack && d->realTrack->album() ) return d->realTrack->album()->hasAlbumArtist(); else return false; } - Meta::ArtistPtr albumArtist() const + Meta::ArtistPtr albumArtist() const override { if( d && d->realTrack && d->realTrack->album() ) return d->realTrack->album()->albumArtist(); else return Meta::ArtistPtr(); } - Meta::TrackList tracks() + Meta::TrackList tracks() override { if( d && d->realTrack && d->realTrack->album() ) return d->realTrack->album()->tracks(); else return Meta::TrackList(); } - QString name() const + QString name() const override { if( d && d->realTrack ) { @@ -235,59 +235,59 @@ return QString(); } - QString prettyName() const + QString prettyName() const override { if( d && d->realTrack && d->realTrack->album() ) return d->realTrack->album()->prettyName(); else return name(); } - QImage image( int size ) const + QImage image( int size ) const override { if( d && d->realTrack && d->realTrack->album() ) return d->realTrack->album()->image( size ); else return Meta::Album::image( size ); } - bool hasImage( int size ) const + bool hasImage( int size ) const override { if( d && d->realTrack && d->realTrack->album() ) return d->realTrack->album()->hasImage( size ); else return Meta::Album::hasImage( size ); } - QUrl imageLocation( int size = 0 ) + QUrl imageLocation( int size = 0 ) override { if( d && d->realTrack && d->realTrack->album() ) return d->realTrack->album()->imageLocation( size ); else return Meta::Album::imageLocation( size ); } - bool canUpdateImage() const + bool canUpdateImage() const override { if( d && d->realTrack && d->realTrack->album() ) return d->realTrack->album()->canUpdateImage(); else return Meta::Album::canUpdateImage(); } - void setImage( const QImage &image ) + void setImage( const QImage &image ) override { if( d && d->realTrack && d->realTrack->album() ) - return d->realTrack->album()->setImage( image ); + d->realTrack->album()->setImage( image ); } - void removeImage() + void removeImage() override { if( d && d->realTrack && d->realTrack->album() ) - return d->realTrack->album()->removeImage(); + d->realTrack->album()->removeImage(); } - virtual bool operator==( const Meta::Album &album ) const + bool operator==( const Meta::Album &album ) const override { const ProxyAlbum *proxy = dynamic_cast( &album ); if( proxy ) @@ -306,12 +306,12 @@ class ProxyGenre : public Meta::Genre { public: - ProxyGenre( MetaProxy::Track::Private *dptr ) + explicit ProxyGenre( MetaProxy::Track::Private *dptr ) : Meta::Genre() , d( dptr ) {} - QString name() const + QString name() const override { if( d && d->realTrack && d->realTrack->genre() ) return d->realTrack->genre()->name(); @@ -321,23 +321,23 @@ return QString(); } - QString prettyName() const + QString prettyName() const override { if( d && d->realTrack && d->realTrack->genre() ) return d->realTrack->genre()->prettyName(); else return QString(); } - Meta::TrackList tracks() + Meta::TrackList tracks() override { if( d && d->realTrack && d->realTrack->genre() ) return d->realTrack->genre()->tracks(); else return Meta::TrackList(); } - virtual bool operator==( const Meta::Genre &genre ) const + bool operator==( const Meta::Genre &genre ) const override { const ProxyGenre *proxy = dynamic_cast( &genre ); if( proxy ) @@ -356,12 +356,12 @@ class ProxyComposer : public Meta::Composer { public: - ProxyComposer( MetaProxy::Track::Private *dptr ) + explicit ProxyComposer( MetaProxy::Track::Private *dptr ) : Meta::Composer() , d( dptr ) {} - QString name() const + QString name() const override { if( d && d->realTrack && d->realTrack->composer() ) return d->realTrack->composer()->name(); @@ -371,23 +371,23 @@ return QString(); } - QString prettyName() const + QString prettyName() const override { if( d && d->realTrack && d->realTrack->composer()) return d->realTrack->composer()->prettyName(); else return name(); } - Meta::TrackList tracks() + Meta::TrackList tracks() override { if( d && d->realTrack && d->realTrack->composer() ) return d->realTrack->composer()->tracks(); else return Meta::TrackList(); } - virtual bool operator==( const Meta::Composer &composer ) const + bool operator==( const Meta::Composer &composer ) const override { const ProxyComposer *proxy = dynamic_cast( &composer ); if( proxy ) @@ -406,12 +406,12 @@ class ProxyYear : public Meta::Year { public: - ProxyYear( MetaProxy::Track::Private *dptr ) + explicit ProxyYear( MetaProxy::Track::Private *dptr ) : Meta::Year() , d( dptr ) {} - QString name() const + QString name() const override { if( d && d->realTrack && d->realTrack->year() ) return d->realTrack->year()->name(); @@ -421,23 +421,23 @@ return QString(); } - QString prettyName() const + QString prettyName() const override { if( d && d->realTrack && d->realTrack->year() ) return d->realTrack->year()->prettyName(); else return name(); } - Meta::TrackList tracks() + Meta::TrackList tracks() override { if( d && d->realTrack && d->realTrack->year() ) return d->realTrack->year()->tracks(); else return Meta::TrackList(); } - virtual bool operator==( const Meta::Year &year ) const + bool operator==( const Meta::Year &year ) const override { const ProxyYear *proxy = dynamic_cast( &year ); if( proxy ) diff --git a/src/core-impl/meta/stream/Stream.h b/src/core-impl/meta/stream/Stream.h --- a/src/core-impl/meta/stream/Stream.h +++ b/src/core-impl/meta/stream/Stream.h @@ -27,46 +27,50 @@ public: class Private; - Track( const QUrl &url ); + explicit Track( const QUrl &url ); virtual ~Track(); // methods inherited from Meta::Base - virtual QString name() const; + QString name() const override; // methods inherited from Meta::Track - virtual QUrl playableUrl() const; - virtual QString prettyUrl() const; - virtual QString uidUrl() const; - virtual QString notPlayableReason() const; + QUrl playableUrl() const override; + QString prettyUrl() const override; + QString uidUrl() const override; + QString notPlayableReason() const override; - virtual Meta::AlbumPtr album() const; - virtual Meta::ArtistPtr artist() const; - virtual Meta::GenrePtr genre() const; - virtual Meta::ComposerPtr composer() const; - virtual Meta::YearPtr year() const; + Meta::AlbumPtr album() const override; + Meta::ArtistPtr artist() const override; + Meta::GenrePtr genre() const override; + Meta::ComposerPtr composer() const override; + Meta::YearPtr year() const override; - virtual qreal bpm() const; - virtual QString comment() const; - virtual int trackNumber() const; - virtual int discNumber() const; + qreal bpm() const override; + QString comment() const override; + int trackNumber() const override; + int discNumber() const override; - virtual qint64 length() const; - virtual int filesize() const; - virtual int sampleRate() const; - virtual int bitrate() const; + qint64 length() const override; + int filesize() const override; + int sampleRate() const override; + int bitrate() const override; - virtual void finishedPlaying( double playedFraction ); + void finishedPlaying( double playedFraction ) override; - virtual QString type() const; + QString type() const override; // MetaStream::Track methods, used to restore initial stream info /** * Set initial values to display before more accurate info can be fetched. * This method doesn't call notifyObservers(), it is the caller's * responsibility; it also doesn't overwrite already filled entries. * + * @param artist track artist + * @param album track album + * @param title track title * @param length is in milliseconds + * @param trackNumber track number */ void setInitialInfo( const QString &artist, const QString &album, const QString &title, qint64 length, int trackNumber ); diff --git a/src/core-impl/meta/stream/Stream.cpp b/src/core-impl/meta/stream/Stream.cpp --- a/src/core-impl/meta/stream/Stream.cpp +++ b/src/core-impl/meta/stream/Stream.cpp @@ -170,7 +170,7 @@ Track::type() const { // don't localize. See EngineController quirks - return "stream"; + return QStringLiteral("stream"); } void diff --git a/src/core-impl/meta/stream/Stream_p.h b/src/core-impl/meta/stream/Stream_p.h --- a/src/core-impl/meta/stream/Stream_p.h +++ b/src/core-impl/meta/stream/Stream_p.h @@ -45,13 +45,13 @@ // force a direct connection or slot might not be called because of thread // affinity. (see BUG 300334) - connect( engine, SIGNAL(currentMetadataChanged( QVariantMap) ), - this, SLOT(currentMetadataChanged( QVariantMap )), + connect( engine, &EngineController::currentMetadataChanged, + this, &Private::currentMetadataChanged, Qt::DirectConnection ); } public Q_SLOTS: - void currentMetadataChanged( QVariantMap metaData ) + void currentMetadataChanged( const QVariantMap &metaData ) { const QUrl metaDataUrl = metaData.value( Meta::Field::URL ).toUrl(); if( metaDataUrl == url ) @@ -75,9 +75,9 @@ //TODO: move special handling to subclass or using some configurable XSPF // Special demangling of artist/title for Shoutcast streams, which usually // have "Artist - Title" in the title tag: - if( artist.isEmpty() && title.contains( " - " ) ) + if( artist.isEmpty() && title.contains( QLatin1String(" - ") ) ) { - const QStringList artist_title = title.split( " - " ); + const QStringList artist_title = title.split( QStringLiteral(" - ") ); if( artist_title.size() >= 2 ) { artist = artist_title[0]; @@ -115,12 +115,12 @@ class StreamArtist : public Meta::DefaultArtist { public: - StreamArtist( MetaStream::Track::Private *dptr ) + explicit StreamArtist( MetaStream::Track::Private *dptr ) : DefaultArtist() , d( dptr ) {} - QString name() const + QString name() const override { if( d && !d->artist.isEmpty() ) return d->artist; @@ -133,7 +133,7 @@ class StreamAlbum : public Meta::DefaultAlbum { public: - StreamAlbum( MetaStream::Track::Private *dptr ) + explicit StreamAlbum( MetaStream::Track::Private *dptr ) : DefaultAlbum() , d( dptr ) {} @@ -143,35 +143,35 @@ CoverCache::invalidateAlbum( this ); } - bool hasAlbumArtist() const + bool hasAlbumArtist() const override { return false; } - QString name() const + QString name() const override { if( d && !d->album.isEmpty() ) return d->album; return DefaultAlbum::name(); } - bool hasImage( int size ) const + bool hasImage( int size ) const override { if( m_cover.isNull() ) return Meta::Album::hasImage( size ); else return true; } - QImage image( int size ) const + QImage image( int size ) const override { if( m_cover.isNull() ) return Meta::Album::image( size ); else return m_cover.scaled( size, size, Qt::KeepAspectRatio, Qt::SmoothTransformation ); } - void setImage( const QImage &image ) + void setImage( const QImage &image ) override { m_cover = image; CoverCache::invalidateAlbum( this ); @@ -184,12 +184,12 @@ class StreamGenre : public Meta::DefaultGenre { public: - StreamGenre( MetaStream::Track::Private *dptr ) + explicit StreamGenre( MetaStream::Track::Private *dptr ) : DefaultGenre() , d( dptr ) {} - QString name() const + QString name() const override { if( d && !d->genre.isEmpty() ) return d->genre; diff --git a/src/core-impl/meta/timecode/TimecodeMeta.h b/src/core-impl/meta/timecode/TimecodeMeta.h --- a/src/core-impl/meta/timecode/TimecodeMeta.h +++ b/src/core-impl/meta/timecode/TimecodeMeta.h @@ -20,7 +20,6 @@ #include "core/meta/Meta.h" #include "core/meta/TrackEditor.h" -class QAction; namespace Meta { @@ -45,56 +44,56 @@ TimecodeTrack( const QString &name, const QUrl &url, qint64 start, qint64 end ); virtual ~TimecodeTrack(); - virtual QString name() const; + QString name() const override; - virtual QUrl playableUrl() const; - virtual QString uidUrl() const; - virtual QString prettyUrl() const; - virtual QString notPlayableReason() const; + QUrl playableUrl() const override; + QString uidUrl() const override; + QString prettyUrl() const override; + QString notPlayableReason() const override; - virtual AlbumPtr album() const; - virtual ArtistPtr artist() const; - virtual GenrePtr genre() const; - virtual ComposerPtr composer() const; - virtual YearPtr year() const; + AlbumPtr album() const override; + ArtistPtr artist() const override; + GenrePtr genre() const override; + ComposerPtr composer() const override; + YearPtr year() const override; - virtual qreal bpm() const; - virtual QString comment() const; - virtual qint64 length() const; - virtual int filesize() const; - virtual int sampleRate() const; - virtual int bitrate() const; - virtual int trackNumber() const; - virtual int discNumber() const; - virtual QString type() const; + qreal bpm() const override; + QString comment() const override; + qint64 length() const override; + int filesize() const override; + int sampleRate() const override; + int bitrate() const override; + int trackNumber() const override; + int discNumber() const override; + QString type() const override; - virtual bool hasCapabilityInterface( Capabilities::Capability::Type type ) const; - virtual Capabilities::Capability *createCapabilityInterface( Capabilities::Capability::Type type ); + bool hasCapabilityInterface( Capabilities::Capability::Type type ) const override; + Capabilities::Capability *createCapabilityInterface( Capabilities::Capability::Type type ) override; - virtual TrackEditorPtr editor(); + TrackEditorPtr editor() override; // TrackEditor methods - virtual void setAlbum( const QString &newAlbum ); - virtual void setAlbumArtist( const QString &newAlbumArtist ); - virtual void setArtist( const QString &newArtist ); - virtual void setComposer( const QString &newComposer ); - virtual void setGenre( const QString &newGenre ); - virtual void setYear( int newYear ); - virtual void setTitle( const QString &newTitle ); - virtual void setComment( const QString &newComment ); - virtual void setTrackNumber( int newTrackNumber ); - virtual void setDiscNumber( int newDiscNumber ); - virtual void setBpm( const qreal newBpm ); - - virtual void beginUpdate(); - virtual void endUpdate(); + void setAlbum( const QString &newAlbum ) override; + void setAlbumArtist( const QString &newAlbumArtist ) override; + void setArtist( const QString &newArtist ) override; + void setComposer( const QString &newComposer ) override; + void setGenre( const QString &newGenre ) override; + void setYear( int newYear ) override; + void setTitle( const QString &newTitle ) override; + void setComment( const QString &newComment ) override; + void setTrackNumber( int newTrackNumber ) override; + void setDiscNumber( int newDiscNumber ) override; + void setBpm( const qreal newBpm ) override; + + void beginUpdate() override; + void endUpdate() override; //TimecodeTrack specific methods - void setAlbum( TimecodeAlbumPtr album ); - void setArtist( TimecodeArtistPtr artist ); - void setComposer( TimecodeComposerPtr composer ); - void setGenre( TimecodeGenrePtr genre ); - void setYear( TimecodeYearPtr year ); + void setAlbum( const TimecodeAlbumPtr &album ); + void setArtist( const TimecodeArtistPtr &artist ); + void setComposer( const TimecodeComposerPtr &composer ); + void setGenre( const TimecodeGenrePtr &genre ); + void setYear( const TimecodeYearPtr &year ); qint64 start(); qint64 end(); @@ -142,22 +141,22 @@ class TimecodeArtist : public Meta::Artist { public: - TimecodeArtist( const QString &name ); + explicit TimecodeArtist( const QString &name ); virtual ~TimecodeArtist(); - virtual QString name() const; + QString name() const override; - virtual TrackList tracks(); + TrackList tracks() override; virtual AlbumList albums(); - bool operator==( const Meta::Artist &other ) const + bool operator==( const Meta::Artist &other ) const override { return name() == other.name(); } //TimecodeArtist specific methods - void addTrack( TimecodeTrackPtr track ); + void addTrack( const TimecodeTrackPtr &track ); private: QString m_name; @@ -168,28 +167,28 @@ { Q_OBJECT public: - TimecodeAlbum( const QString &name ); + explicit TimecodeAlbum( const QString &name ); virtual ~TimecodeAlbum(); - virtual QString name() const; + QString name() const override; - virtual bool isCompilation() const; - virtual bool hasAlbumArtist() const; - virtual ArtistPtr albumArtist() const; - virtual TrackList tracks(); + bool isCompilation() const override; + bool hasAlbumArtist() const override; + ArtistPtr albumArtist() const override; + TrackList tracks() override; - virtual QImage image( int size = 0 ) const; - virtual bool canUpdateImage() const; - virtual void setImage( const QImage &image ); + QImage image( int size = 0 ) const override; + bool canUpdateImage() const override; + void setImage( const QImage &image ) override; - virtual bool hasCapabilityInterface( Capabilities::Capability::Type type ) const; - virtual Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ); + bool hasCapabilityInterface( Capabilities::Capability::Type type ) const override; + Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ) override; //TimecodeAlbum specific methods - void addTrack( TimecodeTrackPtr track ); - void setAlbumArtist( TimecodeArtistPtr artist ); + void addTrack( const TimecodeTrackPtr &track ); + void setAlbumArtist( const TimecodeArtistPtr &artist ); - bool operator==( const Meta::Album &other ) const + bool operator==( const Meta::Album &other ) const override { return name() == other.name(); } @@ -206,20 +205,20 @@ class TimecodeGenre : public Meta::Genre { public: - TimecodeGenre( const QString &name ); + explicit TimecodeGenre( const QString &name ); virtual ~TimecodeGenre(); - virtual QString name() const; + QString name() const override; - virtual TrackList tracks(); + TrackList tracks() override; - bool operator==( const Meta::Genre &other ) const + bool operator==( const Meta::Genre &other ) const override { return name() == other.name(); } //TimecodeGenre specific methods - void addTrack( TimecodeTrackPtr track ); + void addTrack( const TimecodeTrackPtr &track ); private: QString m_name; @@ -229,20 +228,20 @@ class TimecodeComposer : public Meta::Composer { public: - TimecodeComposer( const QString &name ); + explicit TimecodeComposer( const QString &name ); virtual ~TimecodeComposer(); - virtual QString name() const; + QString name() const override; - virtual TrackList tracks(); + TrackList tracks() override; - bool operator==( const Meta::Composer &other ) const + bool operator==( const Meta::Composer &other ) const override { return name() == other.name(); } //TimecodeComposer specific methods - void addTrack( TimecodeTrackPtr track ); + void addTrack( const TimecodeTrackPtr &track ); private: QString m_name; @@ -252,20 +251,20 @@ class TimecodeYear : public Meta::Year { public: - TimecodeYear( const QString &name ); + explicit TimecodeYear( const QString &name ); virtual ~TimecodeYear(); - virtual QString name() const; + QString name() const override; - virtual TrackList tracks(); + TrackList tracks() override; - bool operator==( const Meta::Year &other ) const + bool operator==( const Meta::Year &other ) const override { return name() == other.name(); } //TimecodeYear specific methods - void addTrack( TimecodeTrackPtr track ); + void addTrack( const TimecodeTrackPtr &track ); private: QString m_name; diff --git a/src/core-impl/meta/timecode/TimecodeMeta.cpp b/src/core-impl/meta/timecode/TimecodeMeta.cpp --- a/src/core-impl/meta/timecode/TimecodeMeta.cpp +++ b/src/core-impl/meta/timecode/TimecodeMeta.cpp @@ -45,7 +45,7 @@ , m_playableUrl( url ) , m_updatedFields( 0 ) { - m_displayUrl = url.toDisplayString() + ':' + QString::number( start ) + '-' + QString::number( end ); + m_displayUrl = url.toDisplayString() + QLatin1Char(':') + QString::number( start ) + '-' + QString::number( end ); } TimecodeTrack::~ TimecodeTrack() @@ -333,37 +333,37 @@ } void -TimecodeTrack::setAlbum( TimecodeAlbumPtr album ) +TimecodeTrack::setAlbum( const TimecodeAlbumPtr &album ) { m_album = album; } void TimecodeTrack::setAlbumArtist( const QString & ) { - // no suport for it + // no support for it } void -TimecodeTrack::setYear( TimecodeYearPtr year ) +TimecodeTrack::setYear( const TimecodeYearPtr &year ) { m_year = year; } void -TimecodeTrack::setGenre( TimecodeGenrePtr genre ) +TimecodeTrack::setGenre( const TimecodeGenrePtr &genre ) { m_genre = genre; } void -TimecodeTrack::setComposer( TimecodeComposerPtr composer ) +TimecodeTrack::setComposer( const TimecodeComposerPtr &composer ) { m_composer = composer; } void -TimecodeTrack::setArtist( TimecodeArtistPtr artist ) +TimecodeTrack::setArtist( const TimecodeArtistPtr &artist ) { m_artist = artist; } @@ -433,7 +433,7 @@ } void -TimecodeArtist::addTrack( TimecodeTrackPtr track ) +TimecodeArtist::addTrack( const TimecodeTrackPtr &track ) { m_tracks.append( TrackPtr::staticCast( track ) ); } @@ -504,12 +504,12 @@ } void -TimecodeAlbum::addTrack( TimecodeTrackPtr track ) +TimecodeAlbum::addTrack( const TimecodeTrackPtr &track ) { m_tracks.append( TrackPtr::staticCast( track ) ); } -void TimecodeAlbum::setAlbumArtist( TimecodeArtistPtr artist ) +void TimecodeAlbum::setAlbumArtist( const TimecodeArtistPtr &artist ) { m_albumArtist = artist; } @@ -556,11 +556,11 @@ TrackList TimecodeGenre::tracks() { - return tracks(); + return m_tracks; } void -TimecodeGenre::addTrack( TimecodeTrackPtr track ) +TimecodeGenre::addTrack( const TimecodeTrackPtr &track ) { m_tracks.append( TrackPtr::staticCast( track ) ); } @@ -589,7 +589,7 @@ } void -TimecodeComposer::addTrack( TimecodeTrackPtr track ) +TimecodeComposer::addTrack( const TimecodeTrackPtr &track ) { m_tracks.append( TrackPtr::staticCast( track ) ); } @@ -618,7 +618,7 @@ } void -TimecodeYear::addTrack( TimecodeTrackPtr track ) +TimecodeYear::addTrack( const TimecodeTrackPtr &track ) { m_tracks.append( TrackPtr::staticCast( track ) ); } diff --git a/src/core-impl/meta/timecode/TimecodeObserver.h b/src/core-impl/meta/timecode/TimecodeObserver.h --- a/src/core-impl/meta/timecode/TimecodeObserver.h +++ b/src/core-impl/meta/timecode/TimecodeObserver.h @@ -31,7 +31,7 @@ Q_OBJECT public: - TimecodeObserver( QObject *parent = 0 ); + explicit TimecodeObserver( QObject *parent = nullptr ); virtual ~TimecodeObserver(); protected Q_SLOTS: diff --git a/src/core-impl/meta/timecode/TimecodeTrackProvider.h b/src/core-impl/meta/timecode/TimecodeTrackProvider.h --- a/src/core-impl/meta/timecode/TimecodeTrackProvider.h +++ b/src/core-impl/meta/timecode/TimecodeTrackProvider.h @@ -30,8 +30,8 @@ ~TimecodeTrackProvider(); - virtual bool possiblyContainsTrack( const QUrl &url ) const; - virtual Meta::TrackPtr trackForUrl( const QUrl &url ); + bool possiblyContainsTrack( const QUrl &url ) const override; + Meta::TrackPtr trackForUrl( const QUrl &url ) override; }; diff --git a/src/core-impl/playlists/providers/user/UserPlaylistProvider.h b/src/core-impl/playlists/providers/user/UserPlaylistProvider.h --- a/src/core-impl/playlists/providers/user/UserPlaylistProvider.h +++ b/src/core-impl/playlists/providers/user/UserPlaylistProvider.h @@ -31,10 +31,10 @@ Q_OBJECT public: - explicit UserPlaylistProvider( QObject *parent = 0 ); + explicit UserPlaylistProvider( QObject *parent = nullptr ); /* PlaylistProvider functions */ - virtual int category() const; + int category() const override; /* UserPlaylistProvider functions */ virtual PlaylistPtr save( const Meta::TrackList &tracks, diff --git a/src/core-impl/playlists/types/file/PlaylistFile.h b/src/core-impl/playlists/types/file/PlaylistFile.h --- a/src/core-impl/playlists/types/file/PlaylistFile.h +++ b/src/core-impl/playlists/types/file/PlaylistFile.h @@ -45,19 +45,19 @@ public: /* Playlist methods */ - virtual QUrl uidUrl() const { return m_url; } - virtual QString name() const { return m_url.fileName(); } - virtual Meta::TrackList tracks() { return m_tracks; } - virtual int trackCount() const; - virtual void addTrack( Meta::TrackPtr track, int position ); - virtual void removeTrack( int position ); - virtual void triggerTrackLoad(); + QUrl uidUrl() const override { return m_url; } + QString name() const override { return m_url.fileName(); } + Meta::TrackList tracks() override { return m_tracks; } + int trackCount() const override; + void addTrack( const Meta::TrackPtr &track, int position ) override; + void removeTrack( int position ) override; + void triggerTrackLoad() override; /** * Overrides filename */ - virtual void setName( const QString &name ); - virtual PlaylistProvider *provider() const { return m_provider; } + void setName( const QString &name ) override; + PlaylistProvider *provider() const override { return m_provider; } /* PlaylistFile methods */ virtual QList queue() { return QList(); } @@ -75,7 +75,7 @@ virtual bool isWritable() const; /** - * Saves the playlist to underlying file immediatelly. + * Saves the playlist to underlying file immediately. * * @param relative whether to use relative paths to track in the file */ @@ -87,8 +87,8 @@ * @note in order to save tracks to file, save method should be called **/ virtual void addTracks( const Meta::TrackList &tracks ) { m_tracks += tracks; } - virtual void setGroups( const QStringList &groups ) { m_groups = groups; } - virtual QStringList groups() { return m_groups; } + void setGroups( const QStringList &groups ) override { m_groups = groups; } + QStringList groups() override { return m_groups; } protected: PlaylistFile( const QUrl &url, PlaylistProvider *provider ); diff --git a/src/core-impl/playlists/types/file/PlaylistFile.cpp b/src/core-impl/playlists/types/file/PlaylistFile.cpp --- a/src/core-impl/playlists/types/file/PlaylistFile.cpp +++ b/src/core-impl/playlists/types/file/PlaylistFile.cpp @@ -82,7 +82,7 @@ } void -PlaylistFile::addTrack( Meta::TrackPtr track, int position ) +PlaylistFile::addTrack( const Meta::TrackPtr &track, int position ) { if( !track ) // playlists might contain invalid tracks. see BUG: 303056 return; @@ -129,7 +129,7 @@ if( !file.open( QIODevice::WriteOnly ) ) { - warning() << QString( "Cannot write playlist (%1)." ).arg( file.fileName() ) + warning() << QStringLiteral( "Cannot write playlist (%1)." ).arg( file.fileName() ) << file.errorString(); return false; } @@ -145,9 +145,9 @@ //can't save to a new file if we don't know where. if( !m_url.isEmpty() && !name.isEmpty() ) { - QString exten = QString( ".%1" ).arg(extension()); + QString exten = QStringLiteral( ".%1" ).arg(extension()); m_url = m_url.adjusted(QUrl::RemoveFilename); - m_url.setPath(m_url.path() + name + ( name.endsWith( exten, Qt::CaseInsensitive ) ? "" : exten )); + m_url.setPath(m_url.path() + name + ( name.endsWith( exten, Qt::CaseInsensitive ) ? QLatin1String("") : exten )); } } @@ -169,13 +169,13 @@ if( !absUrl.isLocalFile() ) return url; - if( !url.path().startsWith( '/' ) ) + if( !url.path().startsWith( QLatin1Char('/') ) ) { m_relativePaths = true; // example: url = QUrl( "file://../tunes/tune.ogg" ) absUrl = m_url.adjusted(QUrl::RemoveFilename); // file:///playlists/ absUrl = absUrl.adjusted(QUrl::StripTrailingSlash); - absUrl.setPath( absUrl.path() + '/' + url.path() ); + absUrl.setPath( absUrl.path() + QLatin1Char('/') + url.path() ); absUrl.setPath( QDir::cleanPath(absUrl.path()) ); // file:///playlists/tunes/tune.ogg } return absUrl; diff --git a/src/core-impl/playlists/types/file/PlaylistFileLoaderJob.h b/src/core-impl/playlists/types/file/PlaylistFileLoaderJob.h --- a/src/core-impl/playlists/types/file/PlaylistFileLoaderJob.h +++ b/src/core-impl/playlists/types/file/PlaylistFileLoaderJob.h @@ -35,12 +35,12 @@ Q_OBJECT public: - PlaylistFileLoaderJob( const PlaylistFilePtr &playlist ); + explicit PlaylistFileLoaderJob( const PlaylistFilePtr &playlist ); protected: - void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) Q_DECL_OVERRIDE; - void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; - void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; + void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) override; + void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; + void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; Q_SIGNALS: /** This signal is emitted when this job is being processed by a thread. */ diff --git a/src/core-impl/playlists/types/file/PlaylistFileLoaderJob.cpp b/src/core-impl/playlists/types/file/PlaylistFileLoaderJob.cpp --- a/src/core-impl/playlists/types/file/PlaylistFileLoaderJob.cpp +++ b/src/core-impl/playlists/types/file/PlaylistFileLoaderJob.cpp @@ -17,7 +17,7 @@ #include "core/meta/Meta.h" #include "core/playlists/PlaylistFormat.h" -#include "core/interfaces/Logger.h" +#include "core/logger/Logger.h" #include "core/support/Amarok.h" #include "core/support/Components.h" #include "core/support/Debug.h" @@ -54,15 +54,15 @@ // m_tempFile.setFileTemplate( QDir::tempPath() + "/XXXXXX." + Amarok::extension( url.url() ) ); if( !m_tempFile.open() ) { - Amarok::Components::logger()->longMessage( + Amarok::Logger::longMessage( i18n( "Could not create a temporary file to download playlist." ) ); m_downloadSemaphore.release(); // prevent deadlock return; } KIO::FileCopyJob *job = KIO::file_copy( url , QUrl::fromLocalFile(m_tempFile.fileName()), 0774, KIO::Overwrite | KIO::HideProgressInfo ); - Amarok::Components::logger()->newProgressOperation( job, + Amarok::Logger::newProgressOperation( job, i18n("Downloading remote playlist" ) ); if( playlist->isLoadingAsync() ) // job is started automatically by KIO @@ -88,9 +88,8 @@ QFile file( m_actualPlaylistFile ); if( !file.open( QIODevice::ReadOnly | QIODevice::Text ) ) { - using namespace Amarok; - Components::logger()->longMessage( i18nc( "%1 is file path", - "Cannot read playlist from %1", m_actualPlaylistFile ), Logger::Error ); + Amarok::Logger::longMessage( i18nc( "%1 is file path", + "Cannot read playlist from %1", m_actualPlaylistFile ), Amarok::Logger::Error ); return; } diff --git a/src/core-impl/playlists/types/file/PlaylistFileSupport.cpp b/src/core-impl/playlists/types/file/PlaylistFileSupport.cpp --- a/src/core-impl/playlists/types/file/PlaylistFileSupport.cpp +++ b/src/core-impl/playlists/types/file/PlaylistFileSupport.cpp @@ -17,7 +17,7 @@ ****************************************************************************************/ #include "core/playlists/PlaylistFormat.h" -#include "core/interfaces/Logger.h" +#include "core/logger/Logger.h" #include "core/support/Components.h" #include "core/support/Amarok.h" #include "core-impl/playlists/types/file/PlaylistFileSupport.h" @@ -54,7 +54,7 @@ { if( !QFileInfo( url.toLocalFile() ).exists() ) { - error() << QString("Could not load local playlist file %1!").arg( url.toLocalFile() ); + error() << QStringLiteral("Could not load local playlist file %1!").arg( url.toLocalFile() ); return PlaylistFilePtr(); } } @@ -118,7 +118,7 @@ } else { - KMessageBox::error( 0, + KMessageBox::error( nullptr, i18n( "The used file extension is not valid for playlists." ), i18n( "Unknown playlist format" ) ); } @@ -146,15 +146,15 @@ { int trailingNumber = 1; KLocalizedString fileName = ki18n("Playlist_%1"); - QUrl url = QUrl::fromLocalFile( Amarok::saveLocation( "playlists" ) ); + QUrl url = QUrl::fromLocalFile( Amarok::saveLocation( QStringLiteral("playlists") ) ); url = url.adjusted(QUrl::StripTrailingSlash); - url.setPath(url.path() + '/' + ( fileName.subs( trailingNumber ).toString() )); + url.setPath(url.path() + QLatin1Char('/') + ( fileName.subs( trailingNumber ).toString() )); while( QFileInfo( url.path() ).exists() ) { url = url.adjusted(QUrl::RemoveFilename); url.setPath(url.path() + fileName.subs( ++trailingNumber ).toString() ); } - return QUrl::fromLocalFile( QString( "%1.%2" ).arg( url.path(), fileExtension ) ); + return QUrl::fromLocalFile( QStringLiteral( "%1.%2" ).arg( url.path(), fileExtension ) ); } diff --git a/src/core-impl/playlists/types/file/asx/ASXPlaylist.h b/src/core-impl/playlists/types/file/asx/ASXPlaylist.h --- a/src/core-impl/playlists/types/file/asx/ASXPlaylist.h +++ b/src/core-impl/playlists/types/file/asx/ASXPlaylist.h @@ -26,21 +26,21 @@ class AMAROK_EXPORT ASXPlaylist : public PlaylistFile, public QDomDocument { public: - ASXPlaylist( const QUrl &url, PlaylistProvider *provider = 0 ); + explicit ASXPlaylist( const QUrl &url, PlaylistProvider *provider = 0 ); virtual bool save( bool relative ) { return PlaylistFile::save( relative ); } using PlaylistFile::load; - virtual bool load( QTextStream &stream ) { return loadAsx( stream ); } + bool load( QTextStream &stream ) override { return loadAsx( stream ); } - virtual QString extension() const { return "asx"; } - virtual QString mimetype() const { return "video/x-ms-asf"; } + QString extension() const override { return QStringLiteral("asx"); } + QString mimetype() const override { return QStringLiteral("video/x-ms-asf"); } protected: bool loadAsx( QTextStream &stream ); /** Writes tracks to file */ void writeTrackList(); - virtual void savePlaylist( QFile &file ); + void savePlaylist( QFile &file ) override; bool processContent( QTextStream &stream ); }; } diff --git a/src/core-impl/playlists/types/file/asx/ASXPlaylist.cpp b/src/core-impl/playlists/types/file/asx/ASXPlaylist.cpp --- a/src/core-impl/playlists/types/file/asx/ASXPlaylist.cpp +++ b/src/core-impl/playlists/types/file/asx/ASXPlaylist.cpp @@ -66,7 +66,7 @@ { // Some playlists have unescaped & characters in URLs QString url = urlPattern.cap( 2 ); - url.replace( QRegExp( "&(?!amp;|quot;|apos;|lt;|gt;)" ), "&" ); + url.replace( QRegExp( "&(?!amp;|quot;|apos;|lt;|gt;)" ), QStringLiteral("&") ); QString urlReplacement = urlPattern.cap( 1 ) % url % "\""; tagReplacement.replace( urlPattern.cap(0).toLocal8Bit().toLower(), @@ -100,21 +100,21 @@ { XSPFTrack track; subSubNode = subNode.firstChild(); - if( subNode.nodeName() == "entry" ) + if( subNode.nodeName() == QLatin1String("entry") ) { while( !subSubNode.isNull() ) { - if( subSubNode.nodeName() == "ref" ) + if( subSubNode.nodeName() == QLatin1String("ref") ) { - QByteArray path = subSubNode.attributes().namedItem("href").nodeValue().toUtf8(); + QByteArray path = subSubNode.attributes().namedItem(QStringLiteral("href")).nodeValue().toUtf8(); path.replace( '\\', '/' ); QUrl url = getAbsolutePath( QUrl::fromEncoded( path ) ); track.location = url; } - else if( subSubNode.nodeName() == "title" ) + else if( subSubNode.nodeName() == QLatin1String("title") ) track.title = subSubNode.firstChild().nodeValue(); - else if( subSubNode.nodeName() == "author" ) + else if( subSubNode.nodeName() == QLatin1String("author") ) track.creator = subSubNode.firstChild().nodeValue(); subSubNode = subSubNode.nextSibling(); @@ -135,30 +135,30 @@ { Meta::TrackList trackList = tracks(); - if ( documentElement().namedItem( "asx" ).isNull() ) + if ( documentElement().namedItem( QStringLiteral("asx") ).isNull() ) { - QDomElement root = createElement( "asx" ); - root.setAttribute( "version", 3.0 ); + QDomElement root = createElement( QStringLiteral("asx") ); + root.setAttribute( QStringLiteral("version"), 3.0 ); appendChild( root ); } foreach( Meta::TrackPtr track, trackList ) { - QDomNode subNode = createElement( "entry" ); + QDomNode subNode = createElement( QStringLiteral("entry") ); //URI of resource to be rendered. - QDomElement location = createElement( "ref" ); + QDomElement location = createElement( QStringLiteral("ref") ); //Track title - QDomNode title = createElement( "title" ); + QDomNode title = createElement( QStringLiteral("title") ); //Human-readable name of the entity that authored the resource. - QDomNode creator = createElement( "author" ); + QDomNode creator = createElement( QStringLiteral("author") ); //Description of a track - QDomNode abstact = createElement( "abstract" ); + QDomNode abstract = createElement( QStringLiteral("abstract") ); - location.setAttribute( "href", trackLocation( track ) ); + location.setAttribute( QStringLiteral("href"), trackLocation( track ) ); subNode.appendChild( location ); #define APPENDNODE( X, Y ) \ @@ -185,7 +185,7 @@ APPENDNODE( creator, track->artist()->name() ); } if( !track->comment().isEmpty() ) - APPENDNODE(abstact, track->comment() ); + APPENDNODE(abstract, track->comment() ); #undef APPENDNODE documentElement().appendChild( subNode ); } diff --git a/src/core-impl/playlists/types/file/m3u/M3UPlaylist.h b/src/core-impl/playlists/types/file/m3u/M3UPlaylist.h --- a/src/core-impl/playlists/types/file/m3u/M3UPlaylist.h +++ b/src/core-impl/playlists/types/file/m3u/M3UPlaylist.h @@ -26,17 +26,17 @@ class AMAROK_EXPORT M3UPlaylist : public PlaylistFile { public: - M3UPlaylist( const QUrl &url, PlaylistProvider *provider = 0 ); + explicit M3UPlaylist( const QUrl &url, PlaylistProvider *provider = 0 ); /* PlaylistFile methods */ using PlaylistFile::load; - virtual bool load( QTextStream &stream ) { return loadM3u( stream ); } + bool load( QTextStream &stream ) override { return loadM3u( stream ); } - virtual QString extension() const { return "m3u"; } - virtual QString mimetype() const { return "audio/x-mpegurl"; } + QString extension() const override { return QStringLiteral("m3u"); } + QString mimetype() const override { return QStringLiteral("audio/x-mpegurl"); } protected: - virtual void savePlaylist( QFile &file ); + void savePlaylist( QFile &file ) override; private: bool loadM3u( QTextStream &stream ); diff --git a/src/core-impl/playlists/types/file/m3u/M3UPlaylist.cpp b/src/core-impl/playlists/types/file/m3u/M3UPlaylist.cpp --- a/src/core-impl/playlists/types/file/m3u/M3UPlaylist.cpp +++ b/src/core-impl/playlists/types/file/m3u/M3UPlaylist.cpp @@ -39,24 +39,24 @@ do { QString line = stream.readLine(); - if( line.startsWith( "#EXTINF" ) ) + if( line.startsWith( QLatin1String("#EXTINF") ) ) { - const QString extinf = line.section( ':', 1 ); + const QString extinf = line.section( QLatin1Char(':'), 1 ); bool ok; - length = extinf.section( ',', 0, 0 ).toInt( &ok ); + length = extinf.section( QLatin1Char(','), 0, 0 ).toInt( &ok ); if( !ok ) length = -1; - extinfTitle = extinf.section( ',', 1 ); + extinfTitle = extinf.section( QLatin1Char(','), 1 ); } else if( !line.startsWith( '#' ) && !line.isEmpty() ) { - line = line.replace( "\\", "/" ); + line = line.replace( QLatin1String("\\"), QLatin1String("/") ); QUrl url = getAbsolutePath( QUrl( line ) ); MetaProxy::TrackPtr proxyTrack( new MetaProxy::Track( url ) ); - QString artist = extinfTitle.section( " - ", 0, 0 ); - QString title = extinfTitle.section( " - ", 1, 1 ); + QString artist = extinfTitle.section( QStringLiteral(" - "), 0, 0 ); + QString title = extinfTitle.section( QStringLiteral(" - "), 1, 1 ); //if title and artist are saved such as in M3UPlaylist::save() if( !title.isEmpty() && !artist.isEmpty() ) { @@ -106,7 +106,7 @@ stream << '\n'; } - if( url.scheme() == "file" ) + if( url.scheme() == QLatin1String("file") ) stream << trackLocation( track ); else stream << url.url(); diff --git a/src/core-impl/playlists/types/file/pls/PLSPlaylist.h b/src/core-impl/playlists/types/file/pls/PLSPlaylist.h --- a/src/core-impl/playlists/types/file/pls/PLSPlaylist.h +++ b/src/core-impl/playlists/types/file/pls/PLSPlaylist.h @@ -26,17 +26,17 @@ class AMAROK_EXPORT PLSPlaylist : public PlaylistFile { public: - PLSPlaylist( const QUrl &url, PlaylistProvider *provider = 0 ); + explicit PLSPlaylist( const QUrl &url, PlaylistProvider *provider = 0 ); /* PlaylistFile methods */ using PlaylistFile::load; - virtual bool load( QTextStream &stream ) { return loadPls( stream ); } + bool load( QTextStream &stream ) override { return loadPls( stream ); } - virtual QString extension() const { return "pls"; } - virtual QString mimetype() const { return "audio/x-scpls"; } + QString extension() const override { return QStringLiteral("pls"); } + QString mimetype() const override { return QStringLiteral("audio/x-scpls"); } protected: - virtual void savePlaylist( QFile &file ); + void savePlaylist( QFile &file ) override; private: bool loadPls( QTextStream &stream ); diff --git a/src/core-impl/playlists/types/file/pls/PLSPlaylist.cpp b/src/core-impl/playlists/types/file/pls/PLSPlaylist.cpp --- a/src/core-impl/playlists/types/file/pls/PLSPlaylist.cpp +++ b/src/core-impl/playlists/types/file/pls/PLSPlaylist.cpp @@ -49,7 +49,7 @@ const QRegExp regExp_Title("^Title\\d+\\s*="); const QRegExp regExp_Length("^Length\\d+\\s*=\\s*-?\\d+$"); // Length Can be -1 const QRegExp regExp_Version("^Version\\s*=\\s*\\d+$"); - const QString section_playlist("[playlist]"); + const QString section_playlist(QStringLiteral("[playlist]")); @@ -77,7 +77,7 @@ } if( tmp.contains( regExp_NumberOfEntries ) ) { - numberOfEntries = tmp.section( '=', -1 ).trimmed().toUInt(); + numberOfEntries = tmp.section( QLatin1Char('='), -1 ).trimmed().toUInt(); continue; } } @@ -122,7 +122,7 @@ index = loadPls_extractIndex( *i ); if( index > numberOfEntries || index == 0 ) continue; - tmp = (*i).section( '=', 1 ).trimmed(); + tmp = (*i).section( QLatin1Char('='), 1 ).trimmed(); QUrl url = getAbsolutePath( QUrl( tmp ) ); proxyTrack = new MetaProxy::Track( url ); Meta::TrackPtr track( proxyTrack.data() ); @@ -135,7 +135,7 @@ index = loadPls_extractIndex(*i); if( index > numberOfEntries || index == 0 ) continue; - tmp = (*i).section( '=', 1 ).trimmed(); + tmp = (*i).section( QLatin1Char('='), 1 ).trimmed(); proxyTrack->setTitle( tmp ); continue; } @@ -145,7 +145,7 @@ index = loadPls_extractIndex(*i); if( index > numberOfEntries || index == 0 ) continue; - tmp = (*i).section( '=', 1 ).trimmed(); + tmp = (*i).section( QLatin1Char('='), 1 ).trimmed(); bool ok = false; int seconds = tmp.toInt( &ok ); if( ok ) @@ -160,7 +160,7 @@ if( (*i).contains( regExp_Version ) ) { // Have the "Version=#" line. - tmp = (*i).section( '=', 1 ).trimmed(); + tmp = (*i).section( QLatin1Char('='), 1 ).trimmed(); // We only support Version=2 if (tmp.toUInt( &ok ) != 2) warning() << ".pls playlist: Unsupported version." << endl; @@ -179,7 +179,7 @@ * loadPls_extractIndex("File2=foobar") == 2 */ bool ok = false; unsigned int ret; - QString tmp( str.section( '=', 0, 0 ) ); + QString tmp( str.section( QLatin1Char('='), 0, 0 ) ); tmp.remove( QRegExp( "^\\D*" ) ); ret = tmp.trimmed().toUInt( &ok ); Q_ASSERT(ok); diff --git a/src/core-impl/playlists/types/file/xspf/XSPFPlaylist.h b/src/core-impl/playlists/types/file/xspf/XSPFPlaylist.h --- a/src/core-impl/playlists/types/file/xspf/XSPFPlaylist.h +++ b/src/core-impl/playlists/types/file/xspf/XSPFPlaylist.h @@ -60,14 +60,15 @@ * Creates a new XSPFPlaylist * * @param url The Url of the xspf file to load. + * @param provider The playlist provider. * @param onLoad Should this playlist automatically append itself to the playlist when loaded (useful when loading a remote url as it - * allows the caller to do it in a "one shot" way and not have to worry about waiting untill download and parsing is completed. + * allows the caller to do it in a "one shot" way and not have to worry about waiting until download and parsing is completed. */ explicit XSPFPlaylist( const QUrl &url, PlaylistProvider *provider = 0, OnLoadAction onLoad = NoAction ); ~XSPFPlaylist(); - virtual QString name() const; + QString name() const override; /* convenience functions */ QString title() const; @@ -97,20 +98,20 @@ void setTrackList( Meta::TrackList trackList, bool append = false ); /* PlaylistFile methods */ - virtual bool load( QTextStream &stream ) { return loadXSPF( stream ); } - virtual bool load( QByteArray &content ) { return loadXSPF( content ); } + bool load( QTextStream &stream ) override { return loadXSPF( stream ); } + bool load( QByteArray &content ) override { return loadXSPF( content ); } /* Overrides filename and title */ - void setName(const QString &name); - virtual QString extension() const { return "xspf"; } - virtual QString mimetype() const { return "application/xspf+xml"; } + void setName(const QString &name) override; + QString extension() const override { return QStringLiteral("xspf"); } + QString mimetype() const override { return QStringLiteral("application/xspf+xml"); } virtual bool save( bool relative ) { return PlaylistFile::save( relative ); } - void setQueue( const QList &queue ); - QList queue(); + void setQueue( const QList &queue ) override; + QList queue() override; protected: - virtual void savePlaylist( QFile &file ); + void savePlaylist( QFile &file ) override; private: XSPFTrackList trackList(); diff --git a/src/core-impl/playlists/types/file/xspf/XSPFPlaylist.cpp b/src/core-impl/playlists/types/file/xspf/XSPFPlaylist.cpp --- a/src/core-impl/playlists/types/file/xspf/XSPFPlaylist.cpp +++ b/src/core-impl/playlists/types/file/xspf/XSPFPlaylist.cpp @@ -45,14 +45,14 @@ XSPFPlaylist::savePlaylist(QFile &file) { // if trackList item exists than no need to setup new file - if ( documentElement().namedItem( "trackList" ).isNull() ) + if ( documentElement().namedItem( QStringLiteral("trackList") ).isNull() ) { - QDomElement root = createElement( "playlist" ); + QDomElement root = createElement( QStringLiteral("playlist") ); - root.setAttribute( "version", 1 ); - root.setAttribute( "xmlns", "http://xspf.org/ns/0/" ); + root.setAttribute( QStringLiteral("version"), 1 ); + root.setAttribute( QStringLiteral("xmlns"), QStringLiteral("http://xspf.org/ns/0/") ); - root.appendChild( createElement( "trackList" ) ); + root.appendChild( createElement( QStringLiteral("trackList") ) ); appendChild( root ); } @@ -140,61 +140,61 @@ QString XSPFPlaylist::title() const { - return documentElement().namedItem( "title" ).firstChild().nodeValue(); + return documentElement().namedItem( QStringLiteral("title") ).firstChild().nodeValue(); } QString XSPFPlaylist::creator() const { - return documentElement().namedItem( "creator" ).firstChild().nodeValue(); + return documentElement().namedItem( QStringLiteral("creator") ).firstChild().nodeValue(); } QString XSPFPlaylist::annotation() const { - return documentElement().namedItem( "annotation" ).firstChild().nodeValue(); + return documentElement().namedItem( QStringLiteral("annotation") ).firstChild().nodeValue(); } QUrl XSPFPlaylist::info() const { - return QUrl( documentElement().namedItem( "info" ).firstChild().nodeValue() ); + return QUrl( documentElement().namedItem( QStringLiteral("info") ).firstChild().nodeValue() ); } QUrl XSPFPlaylist::location() const { - return QUrl( documentElement().namedItem( "location" ).firstChild().nodeValue() ); + return QUrl( documentElement().namedItem( QStringLiteral("location") ).firstChild().nodeValue() ); } QString XSPFPlaylist::identifier() const { - return documentElement().namedItem( "identifier" ).firstChild().nodeValue(); + return documentElement().namedItem( QStringLiteral("identifier") ).firstChild().nodeValue(); } QUrl XSPFPlaylist::image() const { - return QUrl( documentElement().namedItem( "image" ).firstChild().nodeValue() ); + return QUrl( documentElement().namedItem( QStringLiteral("image") ).firstChild().nodeValue() ); } QDateTime XSPFPlaylist::date() const { - return QDateTime::fromString( documentElement().namedItem( "date" ).firstChild().nodeValue(), Qt::ISODate ); + return QDateTime::fromString( documentElement().namedItem( QStringLiteral("date") ).firstChild().nodeValue(), Qt::ISODate ); } QUrl XSPFPlaylist::license() const { - return QUrl( documentElement().namedItem( "license" ).firstChild().nodeValue() ); + return QUrl( documentElement().namedItem( QStringLiteral("license") ).firstChild().nodeValue() ); } QList XSPFPlaylist::attribution() const { - const QDomNodeList nodes = documentElement().namedItem( "attribution" ).childNodes(); + const QDomNodeList nodes = documentElement().namedItem( QStringLiteral("attribution") ).childNodes(); QList list; for( int i = 0, count = nodes.length(); i < count; ++i ) @@ -209,24 +209,24 @@ QUrl XSPFPlaylist::link() const { - return QUrl( documentElement().namedItem( "link" ).firstChild().nodeValue() ); + return QUrl( documentElement().namedItem( QStringLiteral("link") ).firstChild().nodeValue() ); } void XSPFPlaylist::setTitle( const QString &title ) { - QDomNode titleNode = documentElement().namedItem( "title" ); + QDomNode titleNode = documentElement().namedItem( QStringLiteral("title") ); if( titleNode.isNull() || !titleNode.hasChildNodes() ) { - QDomNode node = createElement( "title" ); + QDomNode node = createElement( QStringLiteral("title") ); QDomNode subNode = createTextNode( title ); node.appendChild( subNode ); - documentElement().insertBefore( node, documentElement().namedItem( "trackList" ) ); + documentElement().insertBefore( node, documentElement().namedItem( QStringLiteral("trackList") ) ); } else { - documentElement().namedItem( "title" ).replaceChild( createTextNode( title ), - documentElement().namedItem( "title" ).firstChild() + documentElement().namedItem( QStringLiteral("title") ).replaceChild( createTextNode( title ), + documentElement().namedItem( QStringLiteral("title") ).firstChild() ); } notifyObserversMetadataChanged(); @@ -238,17 +238,17 @@ void XSPFPlaylist::setCreator( const QString &creator ) { - if( documentElement().namedItem( "creator" ).isNull() ) + if( documentElement().namedItem( QStringLiteral("creator") ).isNull() ) { - QDomNode node = createElement( "creator" ); + QDomNode node = createElement( QStringLiteral("creator") ); QDomNode subNode = createTextNode( creator ); node.appendChild( subNode ); - documentElement().insertBefore( node, documentElement().namedItem( "trackList" ) ); + documentElement().insertBefore( node, documentElement().namedItem( QStringLiteral("trackList") ) ); } else { - documentElement().namedItem( "creator" ).replaceChild( createTextNode( creator ), - documentElement().namedItem( "creator" ).firstChild() ); + documentElement().namedItem( QStringLiteral("creator") ).replaceChild( createTextNode( creator ), + documentElement().namedItem( QStringLiteral("creator") ).firstChild() ); } //write changes to file directly if we know where @@ -259,17 +259,17 @@ void XSPFPlaylist::setAnnotation( const QString &annotation ) { - if( documentElement().namedItem( "annotation" ).isNull() ) + if( documentElement().namedItem( QStringLiteral("annotation") ).isNull() ) { - QDomNode node = createElement( "annotation" ); + QDomNode node = createElement( QStringLiteral("annotation") ); QDomNode subNode = createTextNode( annotation ); node.appendChild( subNode ); - documentElement().insertBefore( node, documentElement().namedItem( "trackList" ) ); + documentElement().insertBefore( node, documentElement().namedItem( QStringLiteral("trackList") ) ); } else { - documentElement().namedItem( "annotation" ).replaceChild( createTextNode( annotation ), - documentElement().namedItem( "annotation" ).firstChild() ); + documentElement().namedItem( QStringLiteral("annotation") ).replaceChild( createTextNode( annotation ), + documentElement().namedItem( QStringLiteral("annotation") ).firstChild() ); } //write changes to file directly if we know where. @@ -281,17 +281,17 @@ XSPFPlaylist::setInfo( const QUrl &info ) { - if( documentElement().namedItem( "info" ).isNull() ) + if( documentElement().namedItem( QStringLiteral("info") ).isNull() ) { - QDomNode node = createElement( "info" ); + QDomNode node = createElement( QStringLiteral("info") ); QDomNode subNode = createTextNode( info.url() ); node.appendChild( subNode ); - documentElement().insertBefore( node, documentElement().namedItem( "trackList" ) ); + documentElement().insertBefore( node, documentElement().namedItem( QStringLiteral("trackList") ) ); } else { - documentElement().namedItem( "info" ).replaceChild( createTextNode( info.url() ), - documentElement().namedItem( "info" ).firstChild() ); + documentElement().namedItem( QStringLiteral("info") ).replaceChild( createTextNode( info.url() ), + documentElement().namedItem( QStringLiteral("info") ).firstChild() ); } //write changes to file directly if we know where. @@ -302,17 +302,17 @@ void XSPFPlaylist::setLocation( const QUrl &location ) { - if( documentElement().namedItem( "location" ).isNull() ) + if( documentElement().namedItem( QStringLiteral("location") ).isNull() ) { - QDomNode node = createElement( "location" ); + QDomNode node = createElement( QStringLiteral("location") ); QDomNode subNode = createTextNode( location.url() ); node.appendChild( subNode ); - documentElement().insertBefore( node, documentElement().namedItem( "trackList" ) ); + documentElement().insertBefore( node, documentElement().namedItem( QStringLiteral("trackList") ) ); } else { - documentElement().namedItem( "location" ).replaceChild( createTextNode( location.url() ), - documentElement().namedItem( "location" ).firstChild() ); + documentElement().namedItem( QStringLiteral("location") ).replaceChild( createTextNode( location.url() ), + documentElement().namedItem( QStringLiteral("location") ).firstChild() ); } //write changes to file directly if we know where. @@ -323,17 +323,17 @@ void XSPFPlaylist::setIdentifier( const QString &identifier ) { - if( documentElement().namedItem( "identifier" ).isNull() ) + if( documentElement().namedItem( QStringLiteral("identifier") ).isNull() ) { - QDomNode node = createElement( "identifier" ); + QDomNode node = createElement( QStringLiteral("identifier") ); QDomNode subNode = createTextNode( identifier ); node.appendChild( subNode ); - documentElement().insertBefore( node, documentElement().namedItem( "trackList" ) ); + documentElement().insertBefore( node, documentElement().namedItem( QStringLiteral("trackList") ) ); } else { - documentElement().namedItem( "identifier" ).replaceChild( createTextNode( identifier ), - documentElement().namedItem( "identifier" ).firstChild() ); + documentElement().namedItem( QStringLiteral("identifier") ).replaceChild( createTextNode( identifier ), + documentElement().namedItem( QStringLiteral("identifier") ).firstChild() ); } //write changes to file directly if we know where. @@ -344,17 +344,17 @@ void XSPFPlaylist::setImage( const QUrl &image ) { - if( documentElement().namedItem( "image" ).isNull() ) + if( documentElement().namedItem( QStringLiteral("image") ).isNull() ) { - QDomNode node = createElement( "image" ); + QDomNode node = createElement( QStringLiteral("image") ); QDomNode subNode = createTextNode( image.url() ); node.appendChild( subNode ); - documentElement().insertBefore( node, documentElement().namedItem( "trackList" ) ); + documentElement().insertBefore( node, documentElement().namedItem( QStringLiteral("trackList") ) ); } else { - documentElement().namedItem( "image" ).replaceChild( createTextNode( image.url() ), - documentElement().namedItem( "image" ).firstChild() ); + documentElement().namedItem( QStringLiteral("image") ).replaceChild( createTextNode( image.url() ), + documentElement().namedItem( QStringLiteral("image") ).firstChild() ); } //write changes to file directly if we know where. @@ -368,18 +368,18 @@ /* date needs timezone info to be compliant with the standard (ex. 2005-01-08T17:10:47-05:00 ) */ - if( documentElement().namedItem( "date" ).isNull() ) + if( documentElement().namedItem( QStringLiteral("date") ).isNull() ) { - QDomNode node = createElement( "date" ); - QDomNode subNode = createTextNode( date.toString( "yyyy-MM-ddThh:mm:ss" ) ); + QDomNode node = createElement( QStringLiteral("date") ); + QDomNode subNode = createTextNode( date.toString( QStringLiteral("yyyy-MM-ddThh:mm:ss") ) ); node.appendChild( subNode ); - documentElement().insertBefore( node, documentElement().namedItem( "trackList" ) ); + documentElement().insertBefore( node, documentElement().namedItem( QStringLiteral("trackList") ) ); } else { - documentElement().namedItem( "date" ) - .replaceChild( createTextNode( date.toString( "yyyy-MM-ddThh:mm:ss" ) ), - documentElement().namedItem( "date" ).firstChild() ); + documentElement().namedItem( QStringLiteral("date") ) + .replaceChild( createTextNode( date.toString( QStringLiteral("yyyy-MM-ddThh:mm:ss") ) ), + documentElement().namedItem( QStringLiteral("date") ).firstChild() ); } //write changes to file directly if we know where. @@ -390,17 +390,17 @@ void XSPFPlaylist::setLicense( const QUrl &license ) { - if( documentElement().namedItem( "license" ).isNull() ) + if( documentElement().namedItem( QStringLiteral("license") ).isNull() ) { - QDomNode node = createElement( "license" ); + QDomNode node = createElement( QStringLiteral("license") ); QDomNode subNode = createTextNode( license.url() ); node.appendChild( subNode ); - documentElement().insertBefore( node, documentElement().namedItem( "trackList" ) ); + documentElement().insertBefore( node, documentElement().namedItem( QStringLiteral("trackList") ) ); } else { - documentElement().namedItem( "license" ).replaceChild( createTextNode( license.url() ), - documentElement().namedItem( "license" ).firstChild() ); + documentElement().namedItem( QStringLiteral("license") ).replaceChild( createTextNode( license.url() ), + documentElement().namedItem( QStringLiteral("license") ).firstChild() ); } //write changes to file directly if we know where. @@ -414,29 +414,29 @@ if( !attribution.isValid() ) return; - if( documentElement().namedItem( "attribution" ).isNull() ) + if( documentElement().namedItem( QStringLiteral("attribution") ).isNull() ) { - documentElement().insertBefore( createElement( "attribution" ), - documentElement().namedItem( "trackList" ) ); + documentElement().insertBefore( createElement( QStringLiteral("attribution") ), + documentElement().namedItem( QStringLiteral("trackList") ) ); } if( append ) { - QDomNode subNode = createElement( "location" ); + QDomNode subNode = createElement( QStringLiteral("location") ); QDomNode subSubNode = createTextNode( attribution.url() ); subNode.appendChild( subSubNode ); - QDomNode first = documentElement().namedItem( "attribution" ).firstChild(); - documentElement().namedItem( "attribution" ).insertBefore( subNode, first ); + QDomNode first = documentElement().namedItem( QStringLiteral("attribution") ).firstChild(); + documentElement().namedItem( QStringLiteral("attribution") ).insertBefore( subNode, first ); } else { - QDomNode node = createElement( "attribution" ); - QDomNode subNode = createElement( "location" ); + QDomNode node = createElement( QStringLiteral("attribution") ); + QDomNode subNode = createElement( QStringLiteral("location") ); QDomNode subSubNode = createTextNode( attribution.url() ); subNode.appendChild( subSubNode ); node.appendChild( subNode ); - documentElement().replaceChild( node, documentElement().namedItem( "attribution" ) ); + documentElement().replaceChild( node, documentElement().namedItem( QStringLiteral("attribution") ) ); } //write changes to file directly if we know where. @@ -447,17 +447,17 @@ void XSPFPlaylist::setLink( const QUrl &link ) { - if( documentElement().namedItem( "link" ).isNull() ) + if( documentElement().namedItem( QStringLiteral("link") ).isNull() ) { - QDomNode node = createElement( "link" ); + QDomNode node = createElement( QStringLiteral("link") ); QDomNode subNode = createTextNode( link.url() ); node.appendChild( subNode ); - documentElement().insertBefore( node, documentElement().namedItem( "trackList" ) ); + documentElement().insertBefore( node, documentElement().namedItem( QStringLiteral("trackList") ) ); } else { - documentElement().namedItem( "link" ).replaceChild( createTextNode( link.url() ), - documentElement().namedItem( "link" ).firstChild() ); + documentElement().namedItem( QStringLiteral("link") ).replaceChild( createTextNode( link.url() ), + documentElement().namedItem( QStringLiteral("link") ).firstChild() ); } //write changes to file directly if we know where. @@ -470,45 +470,45 @@ { XSPFTrackList list; - QDomNode trackList = documentElement().namedItem( "trackList" ); + QDomNode trackList = documentElement().namedItem( QStringLiteral("trackList") ); QDomNode subNode = trackList.firstChild(); QDomNode subSubNode; while( !subNode.isNull() ) { XSPFTrack track; subSubNode = subNode.firstChild(); - if( subNode.nodeName() == "track" ) + if( subNode.nodeName() == QLatin1String("track") ) { while( !subSubNode.isNull() ) { - if( subSubNode.nodeName() == "location" ) + if( subSubNode.nodeName() == QLatin1String("location") ) { QByteArray path = subSubNode.firstChild().nodeValue().toLatin1(); path.replace( '\\', '/' ); QUrl url = getAbsolutePath( QUrl::fromEncoded( path ) ); track.location = url; } - else if( subSubNode.nodeName() == "title" ) + else if( subSubNode.nodeName() == QLatin1String("title") ) track.title = subSubNode.firstChild().nodeValue(); - else if( subSubNode.nodeName() == "creator" ) + else if( subSubNode.nodeName() == QLatin1String("creator") ) track.creator = subSubNode.firstChild().nodeValue(); - else if( subSubNode.nodeName() == "duration" ) + else if( subSubNode.nodeName() == QLatin1String("duration") ) track.duration = subSubNode.firstChild().nodeValue().toInt(); - else if( subSubNode.nodeName() == "annotation" ) + else if( subSubNode.nodeName() == QLatin1String("annotation") ) track.annotation = subSubNode.firstChild().nodeValue(); - else if( subSubNode.nodeName() == "album" ) + else if( subSubNode.nodeName() == QLatin1String("album") ) track.album = subSubNode.firstChild().nodeValue(); - else if( subSubNode.nodeName() == "trackNum" ) + else if( subSubNode.nodeName() == QLatin1String("trackNum") ) track.trackNum = (uint)subSubNode.firstChild().nodeValue().toInt(); - else if( subSubNode.nodeName() == "identifier" ) + else if( subSubNode.nodeName() == QLatin1String("identifier") ) track.identifier = subSubNode.firstChild().nodeValue(); - else if( subSubNode.nodeName() == "info" ) + else if( subSubNode.nodeName() == QLatin1String("info") ) track.info = QUrl::fromUserInput(subSubNode.firstChild().nodeValue()); - else if( subSubNode.nodeName() == "image" ) + else if( subSubNode.nodeName() == QLatin1String("image") ) track.image = QUrl::fromUserInput(subSubNode.firstChild().nodeValue()); - else if( subSubNode.nodeName() == "link" ) + else if( subSubNode.nodeName() == QLatin1String("link") ) track.link = QUrl::fromUserInput(subSubNode.firstChild().nodeValue()); subSubNode = subSubNode.nextSibling(); @@ -526,39 +526,39 @@ { //documentation of attributes from http://www.xspf.org/xspf-v1.html - if( documentElement().namedItem( "trackList" ).isNull() ) - documentElement().appendChild( createElement( "trackList" ) ); + if( documentElement().namedItem( QStringLiteral("trackList") ).isNull() ) + documentElement().appendChild( createElement( QStringLiteral("trackList") ) ); - QDomNode node = createElement( "trackList" ); + QDomNode node = createElement( QStringLiteral("trackList") ); Meta::TrackPtr track; foreach( track, trackList ) // krazy:exclude=foreach { - QDomNode subNode = createElement( "track" ); + QDomNode subNode = createElement( QStringLiteral("track") ); //URI of resource to be rendered. - QDomNode location = createElement( "location" ); + QDomNode location = createElement( QStringLiteral("location") ); //Human-readable name of the track that authored the resource - QDomNode title = createElement( "title" ); + QDomNode title = createElement( QStringLiteral("title") ); //Human-readable name of the entity that authored the resource. - QDomNode creator = createElement( "creator" ); + QDomNode creator = createElement( QStringLiteral("creator") ); //A human-readable comment on the track. - QDomNode annotation = createElement( "annotation" ); + QDomNode annotation = createElement( QStringLiteral("annotation") ); //Human-readable name of the collection from which the resource comes - QDomNode album = createElement( "album" ); + QDomNode album = createElement( QStringLiteral("album") ); //Integer > 0 giving the ordinal position of the media in the album. - QDomNode trackNum = createElement( "trackNum" ); + QDomNode trackNum = createElement( QStringLiteral("trackNum") ); //The time to render a resource, in milliseconds. It MUST be a nonNegativeInteger. - QDomNode duration = createElement( "duration" ); + QDomNode duration = createElement( QStringLiteral("duration") ); //location-independent name, such as a MusicBrainz identifier. MUST be a legal URI. - QDomNode identifier = createElement( "identifier" ); + QDomNode identifier = createElement( QStringLiteral("identifier") ); //info - URI of a place where this resource can be bought or more info can be found. //QDomNode info = createElement( "info" ); @@ -571,8 +571,8 @@ //QDomNode meta //amarok specific queue info, see the XSPF specification's meta element - QDomElement queue = createElement( "meta" ); - queue.setAttribute( "rel", "http://amarok.kde.org/queue" ); + QDomElement queue = createElement( QStringLiteral("meta") ); + queue.setAttribute( QStringLiteral("rel"), QStringLiteral("http://amarok.kde.org/queue") ); //QDomNode extension @@ -619,28 +619,28 @@ { while( !node.isNull() ) { - documentElement().namedItem( "trackList" ).appendChild( node.firstChild() ); + documentElement().namedItem( QStringLiteral("trackList") ).appendChild( node.firstChild() ); node = node.nextSibling(); } } else - documentElement().replaceChild( node, documentElement().namedItem( "trackList" ) ); + documentElement().replaceChild( node, documentElement().namedItem( QStringLiteral("trackList") ) ); } void XSPFPlaylist::setQueue( const QList &queue ) { - QDomElement q = createElement( "queue" ); + QDomElement q = createElement( QStringLiteral("queue") ); foreach( int row, queue ) { - QDomElement qTrack = createElement( "track" ); + QDomElement qTrack = createElement( QStringLiteral("track") ); qTrack.appendChild( createTextNode( QString::number( row ) ) ); q.appendChild( qTrack ); } - QDomElement extension = createElement( "extension" ); - extension.setAttribute( "application", "http://amarok.kde.org" ); + QDomElement extension = createElement( QStringLiteral("extension") ); + extension.setAttribute( QStringLiteral("application"), QStringLiteral("http://amarok.kde.org") ); extension.appendChild( q ); QDomNode root = firstChild(); @@ -652,20 +652,20 @@ { QList tracks; - QDomElement extension = documentElement().firstChildElement( "extension" ); + QDomElement extension = documentElement().firstChildElement( QStringLiteral("extension") ); if( extension.isNull() ) return tracks; - if( extension.attribute( "application" ) != "http://amarok.kde.org" ) + if( extension.attribute( QStringLiteral("application") ) != QLatin1String("http://amarok.kde.org") ) return tracks; - QDomElement queue = extension.firstChildElement( "queue" ); + QDomElement queue = extension.firstChildElement( QStringLiteral("queue") ); if( queue.isNull() ) return tracks; - for( QDomElement trackElem = queue.firstChildElement( "track" ); + for( QDomElement trackElem = queue.firstChildElement( QStringLiteral("track") ); !trackElem.isNull(); - trackElem = trackElem.nextSiblingElement( "track" ) ) + trackElem = trackElem.nextSiblingElement( QStringLiteral("track") ) ) { tracks << trackElem.text().toInt(); } diff --git a/src/core-impl/podcasts/sql/PodcastFilenameLayoutConfigDialog.h b/src/core-impl/podcasts/sql/PodcastFilenameLayoutConfigDialog.h --- a/src/core-impl/podcasts/sql/PodcastFilenameLayoutConfigDialog.h +++ b/src/core-impl/podcasts/sql/PodcastFilenameLayoutConfigDialog.h @@ -31,7 +31,7 @@ Q_OBJECT public: - explicit PodcastFilenameLayoutConfigDialog( Podcasts::SqlPodcastChannelPtr channel, QWidget *parent = 0 ); + explicit PodcastFilenameLayoutConfigDialog( const Podcasts::SqlPodcastChannelPtr &channel, QWidget *parent = nullptr ); //shows the filename configuration dialog bool configure(); diff --git a/src/core-impl/podcasts/sql/PodcastFilenameLayoutConfigDialog.cpp b/src/core-impl/podcasts/sql/PodcastFilenameLayoutConfigDialog.cpp --- a/src/core-impl/podcasts/sql/PodcastFilenameLayoutConfigDialog.cpp +++ b/src/core-impl/podcasts/sql/PodcastFilenameLayoutConfigDialog.cpp @@ -23,7 +23,7 @@ #include #include -PodcastFilenameLayoutConfigDialog::PodcastFilenameLayoutConfigDialog( Podcasts::SqlPodcastChannelPtr channel, QWidget *parent ) +PodcastFilenameLayoutConfigDialog::PodcastFilenameLayoutConfigDialog( const Podcasts::SqlPodcastChannelPtr &channel, QWidget *parent ) : KPageDialog( parent ) , m_channel( channel ) , m_pflc( new Ui::PodcastFilenameLayoutConfigWidget ) @@ -37,8 +37,7 @@ QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel); // showButtonSeparator( true ); TODO KF5: Replace with a Qt5 equivalent (if any equivalent exists) - QVBoxLayout *mainLayout = new QVBoxLayout; - setLayout(mainLayout); + QVBoxLayout *mainLayout = new QVBoxLayout(this); QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok); okButton->setDefault(true); @@ -84,7 +83,7 @@ if( m_pflc->m_filenameLayoutCustom->isChecked() ) m_channel->setFilenameLayout( m_pflc->m_filenameLayoutText->text() ); else - m_channel->setFilenameLayout( "%default%" ); + m_channel->setFilenameLayout( QStringLiteral("%default%") ); } bool diff --git a/src/core-impl/podcasts/sql/PodcastSettingsDialog.h b/src/core-impl/podcasts/sql/PodcastSettingsDialog.h --- a/src/core-impl/podcasts/sql/PodcastSettingsDialog.h +++ b/src/core-impl/podcasts/sql/PodcastSettingsDialog.h @@ -30,7 +30,7 @@ Q_OBJECT public: - explicit PodcastSettingsDialog( Podcasts::SqlPodcastChannelPtr channel, QWidget* parent=0 ); + explicit PodcastSettingsDialog( const Podcasts::SqlPodcastChannelPtr &channel, QWidget* parent=0 ); bool configure(); diff --git a/src/core-impl/podcasts/sql/PodcastSettingsDialog.cpp b/src/core-impl/podcasts/sql/PodcastSettingsDialog.cpp --- a/src/core-impl/podcasts/sql/PodcastSettingsDialog.cpp +++ b/src/core-impl/podcasts/sql/PodcastSettingsDialog.cpp @@ -28,7 +28,7 @@ #include #include -PodcastSettingsDialog::PodcastSettingsDialog( Podcasts::SqlPodcastChannelPtr channel, QWidget* parent ) +PodcastSettingsDialog::PodcastSettingsDialog( const Podcasts::SqlPodcastChannelPtr &channel, QWidget* parent ) : KPageDialog( parent ) , m_ps( new Ui::PodcastSettingsBase() ) , m_channel( channel ) @@ -39,8 +39,7 @@ setWindowTitle( i18nc("change options", "Configure %1", m_channel->title() ) ); setModal( true ); QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel|QDialogButtonBox::Apply); - QVBoxLayout *mainLayout = new QVBoxLayout; - setLayout(mainLayout); + QVBoxLayout *mainLayout = new QVBoxLayout(this); mainLayout->addWidget(main); QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok); diff --git a/src/core-impl/podcasts/sql/SqlPodcastMeta.h b/src/core-impl/podcasts/sql/SqlPodcastMeta.h --- a/src/core-impl/podcasts/sql/SqlPodcastMeta.h +++ b/src/core-impl/podcasts/sql/SqlPodcastMeta.h @@ -41,38 +41,38 @@ static Meta::TrackList toTrackList( SqlPodcastEpisodeList episodes ); static PodcastEpisodeList toPodcastEpisodeList( SqlPodcastEpisodeList episodes ); - SqlPodcastEpisode( const QStringList &queryResult, SqlPodcastChannelPtr sqlChannel ); + SqlPodcastEpisode( const QStringList &queryResult, const SqlPodcastChannelPtr &sqlChannel ); /** Copy from another PodcastEpisode */ - SqlPodcastEpisode( PodcastEpisodePtr episode ); - SqlPodcastEpisode( PodcastChannelPtr channel, PodcastEpisodePtr episode ); + explicit SqlPodcastEpisode( PodcastEpisodePtr episode ); + SqlPodcastEpisode( const PodcastChannelPtr &channel, PodcastEpisodePtr episode ); ~SqlPodcastEpisode(); //PodcastEpisode methods - PodcastChannelPtr channel() const { return PodcastChannelPtr::dynamicCast( m_channel ); } + PodcastChannelPtr channel() const override { return PodcastChannelPtr::dynamicCast( m_channel ); } virtual bool isKeep() const { return m_isKeep; } - virtual void setNew( bool isNew ); + void setNew( bool isNew ) override; virtual void setKeep( bool isKeep ); - virtual void setLocalUrl( const QUrl &url ); + void setLocalUrl( const QUrl &url ) override; //Track Methods - virtual QString name() const; - virtual QString prettyName() const; - virtual void setTitle( const QString &title ); - virtual qint64 length() const; - virtual bool hasCapabilityInterface( Capabilities::Capability::Type type ) const; - virtual Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ); - virtual void finishedPlaying( double playedFraction ); + QString name() const override; + QString prettyName() const override; + void setTitle( const QString &title ) override; + qint64 length() const override; + bool hasCapabilityInterface( Capabilities::Capability::Type type ) const override; + Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ) override; + void finishedPlaying( double playedFraction ) override; - virtual Meta::ArtistPtr artist() const; - virtual Meta::ComposerPtr composer() const; - virtual Meta::GenrePtr genre() const; - virtual Meta::YearPtr year() const; + Meta::ArtistPtr artist() const override; + Meta::ComposerPtr composer() const override; + Meta::GenrePtr genre() const override; + Meta::YearPtr year() const override; - virtual Meta::TrackEditorPtr editor(); + Meta::TrackEditorPtr editor() override; //SqlPodcastEpisode specific methods bool writeTagsToFile(); @@ -97,44 +97,44 @@ class SqlPodcastChannel : public Podcasts::PodcastChannel { public: - static Playlists::PlaylistPtr toPlaylistPtr( SqlPodcastChannelPtr sqlChannel ); - static SqlPodcastChannelPtr fromPlaylistPtr( Playlists::PlaylistPtr playlist ); + static Playlists::PlaylistPtr toPlaylistPtr( const SqlPodcastChannelPtr &sqlChannel ); + static SqlPodcastChannelPtr fromPlaylistPtr( const Playlists::PlaylistPtr &playlist ); SqlPodcastChannel( SqlPodcastProvider *provider, const QStringList &queryResult ); /** Copy a PodcastChannel */ SqlPodcastChannel( SqlPodcastProvider *provider, PodcastChannelPtr channel ); - ~SqlPodcastChannel(); + ~SqlPodcastChannel() override; // Playlists::Playlist methods - virtual void syncTrackStatus( int position, Meta::TrackPtr otherTrack ); - virtual int trackCount() const; + void syncTrackStatus( int position, const Meta::TrackPtr &otherTrack ) override; + int trackCount() const override; virtual QString filenameLayout() const { return m_filenameLayout; } - virtual Meta::TrackList tracks(); - virtual void addTrack( Meta::TrackPtr track, int position = -1 ); + Meta::TrackList tracks() override; + void addTrack( const Meta::TrackPtr &track, int position = -1 ) override; - virtual void triggerTrackLoad(); - virtual Playlists::PlaylistProvider *provider() const; + void triggerTrackLoad() override; + Playlists::PlaylistProvider *provider() const override; - virtual QStringList groups(); - virtual void setGroups( const QStringList &groups ); + QStringList groups() override; + void setGroups( const QStringList &groups ) override; //Podcasts::PodcastChannel methods - virtual QUrl uidUrl() const; - virtual void setTitle( const QString &title ); - virtual Podcasts::PodcastEpisodeList episodes() const; - virtual bool hasImage() const { return !m_image.isNull(); } - virtual void setImage( const QImage &image ); - virtual QImage image() const { return m_image; } - virtual QUrl imageUrl() const { return m_imageUrl; } - virtual void setImageUrl( const QUrl &imageUrl ); + QUrl uidUrl() const override; + void setTitle( const QString &title ) override; + Podcasts::PodcastEpisodeList episodes() const override; + bool hasImage() const override { return !m_image.isNull(); } + void setImage( const QImage &image ) override; + QImage image() const override { return m_image; } + QUrl imageUrl() const override { return m_imageUrl; } + void setImageUrl( const QUrl &imageUrl ) override; virtual void setFilenameLayout( const QString &filenameLayout ) { m_filenameLayout = filenameLayout; } - PodcastEpisodePtr addEpisode( PodcastEpisodePtr episode ); + PodcastEpisodePtr addEpisode( const PodcastEpisodePtr &episode ) override; //SqlPodcastChannel specific methods int dbId() const { return m_dbId; } diff --git a/src/core-impl/podcasts/sql/SqlPodcastMeta.cpp b/src/core-impl/podcasts/sql/SqlPodcastMeta.cpp --- a/src/core-impl/podcasts/sql/SqlPodcastMeta.cpp +++ b/src/core-impl/podcasts/sql/SqlPodcastMeta.cpp @@ -45,14 +45,14 @@ , m_episode( episode ) {} - virtual bool writeTimecode ( qint64 miliseconds ) + bool writeTimecode ( qint64 miliseconds ) override { DEBUG_BLOCK return Capabilities::TimecodeWriteCapability::writeTimecode( miliseconds, Meta::TrackPtr::dynamicCast( m_episode ) ); } - virtual bool writeAutoTimecode ( qint64 miliseconds ) + bool writeAutoTimecode ( qint64 miliseconds ) override { DEBUG_BLOCK return Capabilities::TimecodeWriteCapability::writeAutoTimecode( miliseconds, @@ -74,14 +74,14 @@ debug() << "episode: " << m_episode->name(); } - virtual bool hasTimecodes() + bool hasTimecodes() override { if ( loadTimecodes().size() > 0 ) return true; return false; } - virtual BookmarkList loadTimecodes() + BookmarkList loadTimecodes() override { DEBUG_BLOCK if ( m_episode && m_episode->playableUrl().isValid() ) @@ -117,7 +117,7 @@ return sqlEpisodes; } -SqlPodcastEpisode::SqlPodcastEpisode( const QStringList &result, SqlPodcastChannelPtr sqlChannel ) +SqlPodcastEpisode::SqlPodcastEpisode( const QStringList &result, const SqlPodcastChannelPtr &sqlChannel ) : Podcasts::PodcastEpisode( Podcasts::PodcastChannelPtr::staticCast( sqlChannel ) ) , m_channel( sqlChannel ) { @@ -189,7 +189,7 @@ setupLocalFile(); } -SqlPodcastEpisode::SqlPodcastEpisode( PodcastChannelPtr channel, Podcasts::PodcastEpisodePtr episode ) +SqlPodcastEpisode::SqlPodcastEpisode( const PodcastChannelPtr &channel, Podcasts::PodcastEpisodePtr episode ) : Podcasts::PodcastEpisode() , m_dbId( 0 ) , m_isKeep( false ) @@ -501,27 +501,27 @@ stream << (isNew() ? boolTrue : boolFalse) << ", "; stream << (isKeep() ? boolTrue : boolFalse); stream << ");"; - m_dbId = sqlStorage->insert( command, "podcastepisodes" ); + m_dbId = sqlStorage->insert( command, QStringLiteral("podcastepisodes") ); } } void SqlPodcastEpisode::deleteFromDb() { auto sqlStorage = StorageManager::instance()->sqlStorage(); sqlStorage->query( - QString( "DELETE FROM podcastepisodes WHERE id = %1;" ).arg( dbId() ) ); + QStringLiteral( "DELETE FROM podcastepisodes WHERE id = %1;" ).arg( dbId() ) ); } Playlists::PlaylistPtr -SqlPodcastChannel::toPlaylistPtr( SqlPodcastChannelPtr sqlChannel ) +SqlPodcastChannel::toPlaylistPtr( const SqlPodcastChannelPtr &sqlChannel ) { Playlists::PlaylistPtr playlist = Playlists::PlaylistPtr::dynamicCast( sqlChannel ); return playlist; } SqlPodcastChannelPtr -SqlPodcastChannel::fromPlaylistPtr( Playlists::PlaylistPtr playlist ) +SqlPodcastChannel::fromPlaylistPtr( const Playlists::PlaylistPtr &playlist ) { SqlPodcastChannelPtr sqlChannel = SqlPodcastChannelPtr::dynamicCast( playlist ); return sqlChannel; @@ -544,7 +544,7 @@ m_description = *(iter++); m_copyright = *(iter++); m_directory = QUrl( *(iter++) ); - m_labels = QStringList( QString( *(iter++) ).split( ',', QString::SkipEmptyParts ) ); + m_labels = QStringList( QString( *(iter++) ).split( QLatin1Char(','), QString::SkipEmptyParts ) ); m_subscribeDate = QDate::fromString( *(iter++) ); m_autoScan = sqlStorage->boolTrue() == *(iter++); m_fetchType = (*(iter++)).toInt() == DownloadWhenAvailable ? DownloadWhenAvailable : StreamOrDownloadOnDemand; @@ -560,7 +560,7 @@ , m_dbId( 0 ) , m_trackCacheIsValid( false ) , m_provider( provider ) - , m_filenameLayout( "%default%" ) + , m_filenameLayout( QStringLiteral("%default%") ) { // PodcastMetaCommon m_title = channel->title(); @@ -585,7 +585,7 @@ m_directory = QUrl( m_provider->baseDownloadDir() ); m_directory = m_directory.adjusted(QUrl::StripTrailingSlash); - m_directory.setPath( QDir::toNativeSeparators(m_directory.path() + '/' + Amarok::vfatPath( m_title )) ); + m_directory.setPath( QDir::toNativeSeparators(m_directory.path() + QLatin1Char('/') + Amarok::vfatPath( m_title )) ); m_autoScan = true; m_fetchType = StreamOrDownloadOnDemand; @@ -643,7 +643,7 @@ QUrl SqlPodcastChannel::uidUrl() const { - return QUrl( QString( "amarok-sqlpodcastuid://%1").arg( m_dbId ) ); + return QUrl( QStringLiteral( "amarok-sqlpodcastuid://%1").arg( m_dbId ) ); } SqlPodcastChannel::~SqlPodcastChannel() @@ -659,7 +659,7 @@ if( m_title.isEmpty() ) { m_directory = m_directory.adjusted(QUrl::StripTrailingSlash); - m_directory.setPath( QDir::toNativeSeparators(m_directory.path() + '/' + Amarok::vfatPath( title )) ); + m_directory.setPath( QDir::toNativeSeparators(m_directory.path() + QLatin1Char('/') + Amarok::vfatPath( title )) ); } m_title = title; } @@ -695,7 +695,7 @@ } Podcasts::PodcastEpisodePtr -SqlPodcastChannel::addEpisode( PodcastEpisodePtr episode ) +SqlPodcastChannel::addEpisode(const PodcastEpisodePtr &episode ) { if( !m_provider ) return PodcastEpisodePtr(); @@ -802,7 +802,7 @@ stream << "', directory='"; stream << escape(m_directory.url()); stream << "', labels='"; - stream << escape(m_labels.join( "," )); + stream << escape(m_labels.join( QLatin1Char(',') )); stream << "', subscribedate='"; stream << escape(m_subscribeDate.toString()); stream << "', autoscan="; @@ -836,7 +836,7 @@ stream << escape(m_description) << "', '"; stream << escape(m_copyright) << "', '"; stream << escape(m_directory.url()) << "', '"; - stream << escape(m_labels.join( "," )) << "', '"; + stream << escape(m_labels.join( QLatin1Char(',') )) << "', '"; stream << escape(m_subscribeDate.toString()) << "', "; stream << (m_autoScan ? boolTrue : boolFalse) << ", "; stream << QString::number(m_fetchType) << ", "; @@ -846,7 +846,7 @@ stream << escape(m_filenameLayout); stream << "');"; debug() << command; - m_dbId = sqlStorage->insert( command, "podcastchannels" ); + m_dbId = sqlStorage->insert( command, QStringLiteral("podcastchannels") ); } } @@ -862,7 +862,7 @@ m_trackCacheIsValid = false; sqlStorage->query( - QString( "DELETE FROM podcastchannels WHERE id = %1;" ).arg( dbId() ) ); + QStringLiteral( "DELETE FROM podcastchannels WHERE id = %1;" ).arg( dbId() ) ); } void @@ -929,7 +929,7 @@ } void -Podcasts::SqlPodcastChannel::syncTrackStatus( int position, Meta::TrackPtr otherTrack ) +Podcasts::SqlPodcastChannel::syncTrackStatus(int position, const Meta::TrackPtr &otherTrack ) { Q_UNUSED( position ); @@ -945,7 +945,7 @@ } void -Podcasts::SqlPodcastChannel::addTrack( Meta::TrackPtr track, int position ) +Podcasts::SqlPodcastChannel::addTrack( const Meta::TrackPtr &track, int position ) { Q_UNUSED( position ); diff --git a/src/core-impl/podcasts/sql/SqlPodcastProvider.h b/src/core-impl/podcasts/sql/SqlPodcastProvider.h --- a/src/core-impl/podcasts/sql/SqlPodcastProvider.h +++ b/src/core-impl/podcasts/sql/SqlPodcastProvider.h @@ -30,7 +30,6 @@ class QDialog; class QUrl; class PodcastReader; -class SqlStorage; class QTimer; namespace Ui { @@ -47,44 +46,44 @@ Q_OBJECT public: SqlPodcastProvider(); - virtual ~SqlPodcastProvider(); + ~SqlPodcastProvider() override; //TrackProvider methods - virtual bool possiblyContainsTrack( const QUrl &url ) const; - virtual Meta::TrackPtr trackForUrl( const QUrl &url ); + bool possiblyContainsTrack( const QUrl &url ) const override; + Meta::TrackPtr trackForUrl( const QUrl &url ) override; //PlaylistProvider methods - virtual QString prettyName() const { return i18n("Local Podcasts"); } - virtual QIcon icon() const { return QIcon::fromTheme( "server-database" ); } + QString prettyName() const override { return i18n("Local Podcasts"); } + QIcon icon() const override { return QIcon::fromTheme( QStringLiteral("server-database") ); } - virtual Playlists::PlaylistList playlists(); + Playlists::PlaylistList playlists() override; //PlaylistProvider methods - virtual QActionList providerActions(); - virtual QActionList playlistActions( const Playlists::PlaylistList &playlists ); - virtual QActionList trackActions( const QMultiHash &playlistTracks ); + QActionList providerActions() override; + QActionList playlistActions( const Playlists::PlaylistList &playlists ) override; + QActionList trackActions( const QMultiHash &playlistTracks ) override; //PodcastProvider methods - virtual Podcasts::PodcastEpisodePtr episodeForGuid( const QString &guid ); + Podcasts::PodcastEpisodePtr episodeForGuid( const QString &guid ) override; - virtual void addPodcast( const QUrl &url ); + void addPodcast( const QUrl &url ) override; - virtual Podcasts::PodcastChannelPtr addChannel( Podcasts::PodcastChannelPtr channel ); - virtual Podcasts::PodcastEpisodePtr addEpisode( Podcasts::PodcastEpisodePtr episode ); + Podcasts::PodcastChannelPtr addChannel( const Podcasts::PodcastChannelPtr &channel ) override; + Podcasts::PodcastEpisodePtr addEpisode( Podcasts::PodcastEpisodePtr episode ) override; - virtual Podcasts::PodcastChannelList channels(); + Podcasts::PodcastChannelList channels() override; - virtual void completePodcastDownloads(); + void completePodcastDownloads() override; //SqlPodcastProvider specific methods virtual Podcasts::SqlPodcastChannelPtr podcastChannelForId( int podcastChannelDbId ); virtual QUrl baseDownloadDir() const { return m_baseDownloadDir; } public Q_SLOTS: - void updateAll(); - void downloadEpisode( Podcasts::PodcastEpisodePtr episode ); - void deleteDownloadedEpisode( Podcasts::PodcastEpisodePtr episode ); + void updateAll() override; + void downloadEpisode( const Podcasts::PodcastEpisodePtr &episode ); + void deleteDownloadedEpisode( const Podcasts::PodcastEpisodePtr &episode ); void slotReadResult( PodcastReader *podcastReader ); void downloadEpisode( Podcasts::SqlPodcastEpisodePtr episode ); @@ -114,7 +113,7 @@ void episodeDeleted( Podcasts::PodcastEpisodePtr ); private Q_SLOTS: - void channelImageReady( Podcasts::PodcastChannelPtr, QImage ); + void channelImageReady( Podcasts::PodcastChannelPtr, const QImage &); void podcastImageFetcherDone( PodcastImageFetcher * ); void slotConfigureProvider(); @@ -138,7 +137,7 @@ Podcasts::SqlPodcastEpisodePtr sqlEpisodeForString( const QString &string ); void updateDatabase( int fromVersion, int toVersion ); - void fetchImage( Podcasts::SqlPodcastChannelPtr channel ); + void fetchImage( const Podcasts::SqlPodcastChannelPtr &channel ); /** shows a modal dialog asking the user if he really wants to unsubscribe and if he wants to keep the podcast media */ diff --git a/src/core-impl/podcasts/sql/SqlPodcastProvider.cpp b/src/core-impl/podcasts/sql/SqlPodcastProvider.cpp --- a/src/core-impl/podcasts/sql/SqlPodcastProvider.cpp +++ b/src/core-impl/podcasts/sql/SqlPodcastProvider.cpp @@ -25,7 +25,7 @@ // #include "context/popupdropper/libpud/PopupDropper.h" // #include "context/popupdropper/libpud/PopupDropperItem.h" #include -#include "core/interfaces/Logger.h" +#include "core/logger/Logger.h" #include "core/podcasts/PodcastImageFetcher.h" #include "core/podcasts/PodcastReader.h" #include "core/support/Amarok.h" @@ -61,8 +61,8 @@ using namespace Podcasts; static const int PODCAST_DB_VERSION = 6; -static const QString key( "AMAROK_PODCAST" ); -static const QString PODCAST_TMP_POSTFIX( ".tmp" ); +static const QString key( QStringLiteral("AMAROK_PODCAST") ); +static const QString PODCAST_TMP_POSTFIX( QStringLiteral(".tmp") ); SqlPodcastProvider::SqlPodcastProvider() : m_updateTimer( new QTimer( this ) ) @@ -89,19 +89,19 @@ return; } - m_autoUpdateInterval = Amarok::config( "Podcasts" ) + m_autoUpdateInterval = Amarok::config( QStringLiteral("Podcasts") ) .readEntry( "AutoUpdate Interval", 30 ); - m_maxConcurrentDownloads = Amarok::config( "Podcasts" ) + m_maxConcurrentDownloads = Amarok::config( QStringLiteral("Podcasts") ) .readEntry( "Maximum Simultaneous Downloads", 4 ); - m_maxConcurrentUpdates = Amarok::config( "Podcasts" ) + m_maxConcurrentUpdates = Amarok::config( QStringLiteral("Podcasts") ) .readEntry( "Maximum Simultaneous Updates", 4 ); - m_baseDownloadDir = QUrl::fromUserInput( Amarok::config( "Podcasts" ).readEntry( "Base Download Directory", - Amarok::saveLocation( "podcasts" ) ) ); + m_baseDownloadDir = QUrl::fromUserInput( Amarok::config( QStringLiteral("Podcasts") ).readEntry( "Base Download Directory", + Amarok::saveLocation( QStringLiteral("podcasts") ) ) ); QStringList values; values = sqlStorage->query( - QString( "SELECT version FROM admin WHERE component = '%1';" ) + QStringLiteral( "SELECT version FROM admin WHERE component = '%1';" ) .arg( sqlStorage->escape( key ) ) ); if( values.isEmpty() ) @@ -155,11 +155,11 @@ } m_channels.clear(); - Amarok::config( "Podcasts" ) + Amarok::config( QStringLiteral("Podcasts") ) .writeEntry( "AutoUpdate Interval", m_autoUpdateInterval ); - Amarok::config( "Podcasts" ) + Amarok::config( QStringLiteral("Podcasts") ) .writeEntry( "Maximum Simultaneous Downloads", m_maxConcurrentDownloads ); - Amarok::config( "Podcasts" ) + Amarok::config( QStringLiteral("Podcasts") ) .writeEntry( "Maximum Simultaneous Updates", m_maxConcurrentUpdates ); } @@ -188,7 +188,7 @@ } if( m_podcastImageFetcher ) m_podcastImageFetcher->run(); - emit updated(); + Q_EMIT updated(); } SqlPodcastEpisodePtr @@ -286,19 +286,19 @@ { if( m_providerActions.isEmpty() ) { - QAction *updateAllAction = new QAction( QIcon::fromTheme( "view-refresh-amarok" ), + QAction *updateAllAction = new QAction( QIcon::fromTheme( QStringLiteral("view-refresh-amarok") ), i18n( "&Update All Channels" ), this ); updateAllAction->setProperty( "popupdropper_svg_id", "update" ); connect( updateAllAction, &QAction::triggered, this, &SqlPodcastProvider::updateAll ); m_providerActions << updateAllAction; - QAction *configureAction = new QAction( QIcon::fromTheme( "configure" ), + QAction *configureAction = new QAction( QIcon::fromTheme( QStringLiteral("configure") ), i18n( "&Configure General Settings" ), this ); configureAction->setProperty( "popupdropper_svg_id", "configure" ); connect( configureAction, &QAction::triggered, this, &SqlPodcastProvider::slotConfigureProvider ); m_providerActions << configureAction; - QAction *exportOpmlAction = new QAction( QIcon::fromTheme( "document-export" ), + QAction *exportOpmlAction = new QAction( QIcon::fromTheme( QStringLiteral("document-export") ), i18n( "&Export subscriptions to OPML file" ), this ); connect( exportOpmlAction, &QAction::triggered, this, &SqlPodcastProvider::slotExportOpml ); m_providerActions << exportOpmlAction; @@ -325,7 +325,7 @@ //TODO: add export OPML action for selected playlists only. Use the QAction::data() trick. if( m_configureChannelAction == 0 ) { - m_configureChannelAction = new QAction( QIcon::fromTheme( "configure" ), i18n( "&Configure" ), this ); + m_configureChannelAction = new QAction( QIcon::fromTheme( QStringLiteral("configure") ), i18n( "&Configure" ), this ); m_configureChannelAction->setProperty( "popupdropper_svg_id", "configure" ); connect( m_configureChannelAction, &QAction::triggered, this, &SqlPodcastProvider::slotConfigureChannel ); } @@ -338,16 +338,16 @@ if( m_removeAction == 0 ) { - m_removeAction = new QAction( QIcon::fromTheme( "news-unsubscribe" ), i18n( "&Remove Subscription" ), this ); + m_removeAction = new QAction( QIcon::fromTheme( QStringLiteral("news-unsubscribe") ), i18n( "&Remove Subscription" ), this ); m_removeAction->setProperty( "popupdropper_svg_id", "remove" ); connect( m_removeAction, &QAction::triggered, this, &SqlPodcastProvider::slotRemoveChannels ); } m_removeAction->setData( QVariant::fromValue( sqlChannels ) ); actions << m_removeAction; if( m_updateAction == 0 ) { - m_updateAction = new QAction( QIcon::fromTheme( "view-refresh-amarok" ), i18n( "&Update Channel" ), this ); + m_updateAction = new QAction( QIcon::fromTheme( QStringLiteral("view-refresh-amarok") ), i18n( "&Update Channel" ), this ); m_updateAction->setProperty( "popupdropper_svg_id", "update" ); connect( m_updateAction, &QAction::triggered, this, &SqlPodcastProvider::slotUpdateChannels ); } @@ -383,31 +383,31 @@ if( m_downloadAction == 0 ) { - m_downloadAction = new QAction( QIcon::fromTheme( "go-down" ), i18n( "&Download Episode" ), this ); + m_downloadAction = new QAction( QIcon::fromTheme( QStringLiteral("go-down") ), i18n( "&Download Episode" ), this ); m_downloadAction->setProperty( "popupdropper_svg_id", "download" ); connect( m_downloadAction, &QAction::triggered, this, &SqlPodcastProvider::slotDownloadEpisodes ); } if( m_deleteAction == 0 ) { - m_deleteAction = new QAction( QIcon::fromTheme( "edit-delete" ), + m_deleteAction = new QAction( QIcon::fromTheme( QStringLiteral("edit-delete") ), i18n( "&Delete Downloaded Episode" ), this ); m_deleteAction->setProperty( "popupdropper_svg_id", "delete" ); - m_deleteAction->setObjectName( "deleteAction" ); + m_deleteAction->setObjectName( QStringLiteral("deleteAction") ); connect( m_deleteAction, &QAction::triggered, this, &SqlPodcastProvider::slotDeleteDownloadedEpisodes ); } if( m_writeTagsAction == 0 ) { - m_writeTagsAction = new QAction( QIcon::fromTheme( "media-track-edit-amarok" ), + m_writeTagsAction = new QAction( QIcon::fromTheme( QStringLiteral("media-track-edit-amarok") ), i18n( "&Write Feed Information to File" ), this ); m_writeTagsAction->setProperty( "popupdropper_svg_id", "edit" ); connect( m_writeTagsAction, &QAction::triggered, this, &SqlPodcastProvider::slotWriteTagsToFiles ); } if( m_keepAction == 0 ) { - m_keepAction = new QAction( QIcon::fromTheme( "podcast-amarok" ), + m_keepAction = new QAction( QIcon::fromTheme( QStringLiteral("podcast-amarok") ), i18n( "&Keep downloaded file" ), this ); m_keepAction->setToolTip( i18n( "Toggle the \"keep\" downloaded file status of " "this podcast episode. Downloaded files with this status wouldn't be " @@ -466,15 +466,15 @@ if( !sqlStorage ) return; - QString command = "SELECT title FROM podcastchannels WHERE url='%1';"; + QString command = QStringLiteral("SELECT title FROM podcastchannels WHERE url='%1';"); command = command.arg( sqlStorage->escape( kurl.url() ) ); QStringList dbResult = sqlStorage->query( command ); if( !dbResult.isEmpty() ) { //Already subscribed to this Channel //notify the user. - Amarok::Components::logger()->longMessage( + Amarok::Logger::longMessage( i18n( "Already subscribed to %1.", dbResult.first() ), Amarok::Logger::Error ); } else @@ -519,16 +519,16 @@ } Podcasts::PodcastChannelPtr -SqlPodcastProvider::addChannel( Podcasts::PodcastChannelPtr channel ) +SqlPodcastProvider::addChannel(const PodcastChannelPtr &channel ) { Podcasts::SqlPodcastChannelPtr sqlChannel = SqlPodcastChannelPtr( new Podcasts::SqlPodcastChannel( this, channel ) ); m_channels << sqlChannel; - if( sqlChannel->episodes().count() == 0 ) + if( sqlChannel->episodes().isEmpty() ) updateSqlChannel( sqlChannel ); - emit playlistAdded( Playlists::PlaylistPtr( sqlChannel.data() ) ); + Q_EMIT playlistAdded( Playlists::PlaylistPtr( sqlChannel.data() ) ); return PodcastChannelPtr( sqlChannel.data() ); } @@ -579,18 +579,18 @@ if( !sqlStorage ) return; debug() << "Unsubscribed from last channel, cleaning out the podcastepisodes table."; - sqlStorage->query( "DELETE FROM podcastepisodes WHERE 1;" ); + sqlStorage->query( QStringLiteral("DELETE FROM podcastepisodes WHERE 1;") ); } - emit playlistRemoved( Playlists::PlaylistPtr::dynamicCast( sqlChannel ) ); + Q_EMIT playlistRemoved( Playlists::PlaylistPtr::dynamicCast( sqlChannel ) ); } void SqlPodcastProvider::configureProvider() { m_providerSettingsDialog = new QDialog( The::mainWindow() ); QWidget *settingsWidget = new QWidget( m_providerSettingsDialog ); - m_providerSettingsDialog->setObjectName( "SqlPodcastProviderSettings" ); + m_providerSettingsDialog->setObjectName( QStringLiteral("SqlPodcastProviderSettings") ); Ui::SqlPodcastProviderSettingsWidget settings; m_providerSettingsWidget = &settings; settings.setupUi( settingsWidget ); @@ -625,7 +625,7 @@ if( adjustedNewPath != m_baseDownloadDir ) { m_baseDownloadDir = adjustedNewPath; - Amarok::config( "Podcasts" ).writeEntry( "Base Download Directory", m_baseDownloadDir ); + Amarok::config( QStringLiteral("Podcasts") ).writeEntry( "Base Download Directory", m_baseDownloadDir ); if( !m_channels.isEmpty() ) { //TODO: check if there actually are downloaded episodes @@ -640,7 +640,7 @@ QUrl oldSaveLocation = sqlChannel->saveLocation(); QUrl newSaveLocation = m_baseDownloadDir; newSaveLocation = newSaveLocation.adjusted(QUrl::StripTrailingSlash); - newSaveLocation.setPath(newSaveLocation.path() + '/' + ( oldSaveLocation.fileName() )); + newSaveLocation.setPath(newSaveLocation.path() + QLatin1Char('/') + ( oldSaveLocation.fileName() )); sqlChannel->setSaveLocation( newSaveLocation ); debug() << newSaveLocation.path(); moveDownloadedEpisodes( sqlChannel ); @@ -693,7 +693,7 @@ //TODO: add checkbox as widget to filedialog to include podcast settings. QFileDialog fileDialog; - fileDialog.restoreState( Amarok::config( "amarok-podcast-export-dialog" ).readEntry( "state", QByteArray() ) ); + fileDialog.restoreState( Amarok::config( QStringLiteral("amarok-podcast-export-dialog") ).readEntry( "state", QByteArray() ) ); fileDialog.setMimeTypeFilters( QStringList( QStringLiteral( "*.opml" ) ) ); fileDialog.setAcceptMode( QFileDialog::AcceptSave ); @@ -754,7 +754,7 @@ else sqlChannel->applyPurge(); - emit updated(); + Q_EMIT updated(); if( oldSaveLocation != sqlChannel->saveLocation() ) { @@ -782,21 +782,20 @@ void SqlPodcastProvider::moveDownloadedEpisodes( Podcasts::SqlPodcastChannelPtr sqlChannel ) { - debug() << QString( "We need to move downloaded episodes of \"%1\" to %2" ) - .arg( sqlChannel->title() ) - .arg( sqlChannel->saveLocation().toDisplayString() ); + debug() << QStringLiteral( "We need to move downloaded episodes of \"%1\" to %2" ) + .arg( sqlChannel->title(), + sqlChannel->saveLocation().toDisplayString() ); - QList filesToMove; foreach( Podcasts::SqlPodcastEpisodePtr episode, sqlChannel->sqlEpisodes() ) { if( !episode->localUrl().isEmpty() ) { QUrl newLocation = sqlChannel->saveLocation(); QDir dir( newLocation.toLocalFile() ); - dir.mkpath( "." ); + dir.mkpath( QStringLiteral(".") ); newLocation = newLocation.adjusted(QUrl::StripTrailingSlash); - newLocation.setPath(newLocation.path() + '/' + ( episode->localUrl().fileName() )); + newLocation.setPath(newLocation.path() + QLatin1Char('/') + ( episode->localUrl().fileName() )); debug() << "Moving from " << episode->localUrl() << " to " << newLocation; KIO::Job *moveJob = KIO::move( episode->localUrl(), newLocation, KIO::HideProgressInfo ); @@ -849,7 +848,7 @@ unsubscribeDialog.setText( i18n( "Do you really want to unsubscribe from \"%1\"?", channel->title() ) ); unsubscribeDialog.setStandardButtons( QMessageBox::Ok | QMessageBox::Cancel ); - QCheckBox *deleteMediaCheckBox = new QCheckBox( i18n( "Delete downloaded episodes" ), Q_NULLPTR ); + QCheckBox *deleteMediaCheckBox = new QCheckBox( i18n( "Delete downloaded episodes" ), nullptr ); unsubscribeDialog.setCheckBox( deleteMediaCheckBox ); QPair result; @@ -909,7 +908,7 @@ //keep the completed jobs in mind as well. totalDownloadPercentage += m_completedDownloads * 100; - emit totalPodcastDownloadProgress( + Q_EMIT totalPodcastDownloadProgress( totalDownloadPercentage / ( m_downloadJobMap.count() + m_completedDownloads ) ); } @@ -948,7 +947,7 @@ episode->setLocalUrl( QUrl() ); - emit episodeDeleted( Podcasts::PodcastEpisodePtr::dynamicCast( episode ) ); + Q_EMIT episodeDeleted( Podcasts::PodcastEpisodePtr::dynamicCast( episode ) ); } Podcasts::SqlPodcastChannelPtr @@ -970,7 +969,7 @@ //check to see if there are still downloads in progress if( !m_downloadJobMap.isEmpty() ) { - debug() << QString( "There are still %1 podcast download jobs running!" ) + debug() << QStringLiteral( "There are still %1 podcast download jobs running!" ) .arg( m_downloadJobMap.count() ); QProgressDialog progressDialog( i18np( "There is still a podcast download in progress", "There are still %1 podcast downloads in progress", @@ -1050,7 +1049,7 @@ if( podcastReader->error() != QXmlStreamReader::NoError ) { debug() << podcastReader->errorString(); - Amarok::Components::logger()->longMessage( podcastReader->errorString(), + Amarok::Logger::longMessage( podcastReader->errorString(), Amarok::Logger::Error ); } debug() << "Finished updating: " << podcastReader->url(); @@ -1097,7 +1096,7 @@ const QString &description, Podcasts::PodcastReader* reader ) { - Amarok::Components::logger()->newProgressOperation( job, description, reader, SLOT(slotAbort()) ); + Amarok::Logger::newProgressOperation( job, description, reader, &Podcasts::PodcastReader::slotAbort ); } void @@ -1148,42 +1147,44 @@ qint64 offset = tmpFile->size(); debug() << "temporary file exists, resume download from offset " << offset; QMap resumeData; - resumeData.insert( "resume", QString::number( offset ) ); + resumeData.insert( QStringLiteral("resume"), QString::number( offset ) ); transferJob->addMetaData( resumeData ); } if( !tmpFile->open( QIODevice::WriteOnly | QIODevice::Append ) ) { - Amarok::Components::logger()->longMessage( i18n( "Unable to save podcast episode file to %1", + Amarok::Logger::longMessage( i18n( "Unable to save podcast episode file to %1", tmpFile->fileName() ) ); delete tmpFile; return; } debug() << "starting download for " << sqlEpisode->title() << " url: " << sqlEpisode->prettyUrl(); - Amarok::Components::logger()->newProgressOperation( transferJob + Amarok::Logger::newProgressOperation( transferJob , sqlEpisode->title().isEmpty() ? i18n( "Downloading Podcast Media" ) : i18n( "Downloading Podcast \"%1\"" , sqlEpisode->title() ), transferJob, - SLOT(kill()) + &KIO::TransferJob::kill, + Qt::AutoConnection, + KJob::Quietly ); connect( transferJob, &KIO::TransferJob::data, this, &SqlPodcastProvider::addData ); //need to connect to finished instead of result because it's always emitted. - //We need to cleanup after a download is cancled regardless of the argument in + //We need to cleanup after a download is canceled regardless of the argument in //KJob::kill() connect( transferJob, &KIO::TransferJob::finished, this, &SqlPodcastProvider::downloadResult ); connect( transferJob, &KIO::TransferJob::redirection, this, &SqlPodcastProvider::redirected ); } void -SqlPodcastProvider::downloadEpisode( Podcasts::PodcastEpisodePtr episode ) +SqlPodcastProvider::downloadEpisode( const Podcasts::PodcastEpisodePtr &episode ) { downloadEpisode( SqlPodcastEpisodePtr::dynamicCast( episode ) ); } @@ -1221,7 +1222,7 @@ } QDir dir( sqlChannel->saveLocation().toLocalFile() ); - dir.mkpath( "." ); // ensure that the path is there + dir.mkpath( QStringLiteral(".") ); // ensure that the path is there //TODO: what if result is false? QUrl localUrl = QUrl::fromLocalFile( dir.absolutePath() ); @@ -1234,7 +1235,7 @@ QString tempNameMd5( QCryptographicHash::hash( tempName.toUtf8(), QCryptographicHash::Md5 ).toHex() ); localUrl = localUrl.adjusted(QUrl::StripTrailingSlash); - localUrl.setPath(localUrl.path() + '/' + ( tempNameMd5 + PODCAST_TMP_POSTFIX )); + localUrl.setPath(localUrl.path() + QLatin1Char('/') + ( tempNameMd5 + PODCAST_TMP_POSTFIX )); return new QFile( localUrl.toLocalFile() ); } @@ -1257,15 +1258,16 @@ return false; } - QString fileName = sqlChannel->saveLocation().adjusted(QUrl::StripTrailingSlash).toLocalFile(); - fileName += download.fileName; + QString fileName = sqlChannel->saveLocation().adjusted(QUrl::StripTrailingSlash).toLocalFile() + + QLatin1Char('/') + + download.fileName; debug() << "checking " << fileName; QFileInfo fileInfo( fileName ); if( !fileInfo.exists() ) return false; debug() << fileName << " already exists, no need to redownload"; - // NOTE: we need to emit because the KJobProgressBar relies on it to clean up + // NOTE: we need to Q_EMIT because the KJobProgressBar relies on it to clean up job->kill( KJob::EmitResult ); sqlEpisode->setLocalUrl( QUrl::fromLocalFile(fileName) ); //TODO: repaint icons, probably with signal metadataUpdate() @@ -1300,15 +1302,15 @@ } void -SqlPodcastProvider::deleteDownloadedEpisode( Podcasts::PodcastEpisodePtr episode ) +SqlPodcastProvider::deleteDownloadedEpisode( const Podcasts::PodcastEpisodePtr &episode ) { deleteDownloadedEpisode( SqlPodcastEpisodePtr::dynamicCast( episode ) ); } void SqlPodcastProvider::slotStatusBarSorryMessage( const QString &message ) { - Amarok::Components::logger()->longMessage( message, Amarok::Logger::Error ); + Amarok::Logger::longMessage( message, Amarok::Logger::Error ); } void @@ -1324,7 +1326,7 @@ // in the statusbar when the user cancels a download if( job->error() != KJob::KilledJobError ) { - Amarok::Components::logger()->longMessage( job->errorText() ); + Amarok::Logger::longMessage( job->errorText() ); } error() << "Unable to retrieve podcast media. KIO Error: " << job->errorText(); error() << "keeping temporary file for download restart"; @@ -1353,38 +1355,39 @@ QString sequenceNumber; if( sqlEpisode->artist() ) - layoutmap.insert( "artist", sqlEpisode->artist()->prettyName() ); + layoutmap.insert( QStringLiteral("artist"), sqlEpisode->artist()->prettyName() ); - layoutmap.insert( "title", sqlEpisode->title() ); + layoutmap.insert( QStringLiteral("title"), sqlEpisode->title() ); if( sqlEpisode->genre() ) - layoutmap.insert( "genre", sqlEpisode->genre()->prettyName() ); + layoutmap.insert( QStringLiteral("genre"), sqlEpisode->genre()->prettyName() ); if( sqlEpisode->year() ) - layoutmap.insert( "year", sqlEpisode->year()->prettyName() ); + layoutmap.insert( QStringLiteral("year"), sqlEpisode->year()->prettyName() ); if( sqlEpisode->composer() ) - layoutmap.insert( "composer", sqlEpisode->composer()->prettyName() ); + layoutmap.insert( QStringLiteral("composer"), sqlEpisode->composer()->prettyName() ); - layoutmap.insert( "pubdate", sqlEpisode->pubDate().toString() ); + layoutmap.insert( QStringLiteral("pubdate"), sqlEpisode->pubDate().toString() ); sequenceNumber.sprintf( "%.6d", sqlEpisode->sequenceNumber() ); - layoutmap.insert( "number", sequenceNumber ); + layoutmap.insert( QStringLiteral("number"), sequenceNumber ); if( sqlEpisode->album() ) - layoutmap.insert( "album", sqlEpisode->album()->prettyName() ); + layoutmap.insert( QStringLiteral("album"), sqlEpisode->album()->prettyName() ); if( !filenameLayout.isEmpty() && - Amarok::QStringx::compare( filenameLayout, "%default%", Qt::CaseInsensitive ) ) + Amarok::QStringx::compare( filenameLayout, QStringLiteral("%default%"), Qt::CaseInsensitive ) ) { - filenameLayout = filenameLayout.namedArgs( layoutmap ); + filenameLayout = Amarok::QStringx(filenameLayout.namedArgs( layoutmap )); //add the file extension to the filename - filenameLayout.append( QString( "." ) ); + filenameLayout.append( QStringLiteral( "." ) ); filenameLayout.append( sqlEpisode->type() ); download.fileName = QString( filenameLayout ); } QString finalName = sqlChannel->saveLocation().adjusted(QUrl::StripTrailingSlash).toLocalFile() + + QLatin1Char('/') + download.fileName; if( tmpFile->rename( finalName ) ) { @@ -1396,11 +1399,11 @@ sqlEpisode->writeTagsToFile(); //TODO: force a redraw of the view so the icon can be updated in the PlaylistBrowser - emit episodeDownloaded( Podcasts::PodcastEpisodePtr::dynamicCast( sqlEpisode ) ); + Q_EMIT episodeDownloaded( Podcasts::PodcastEpisodePtr::dynamicCast( sqlEpisode ) ); } else { - Amarok::Components::logger()->longMessage( i18n( "Unable to save podcast episode file to %1", + Amarok::Logger::longMessage( i18n( "Unable to save podcast episode file to %1", finalName ) ); downloadFailed = true; } @@ -1462,16 +1465,16 @@ ",isnew BOOL" ",iskeep BOOL) ENGINE = MyISAM;" ) ); - sqlStorage->query( "CREATE FULLTEXT INDEX url_podchannel ON podcastchannels( url );" ); - sqlStorage->query( "CREATE FULLTEXT INDEX url_podepisode ON podcastepisodes( url );" ); + sqlStorage->query( QStringLiteral("CREATE FULLTEXT INDEX url_podchannel ON podcastchannels( url );") ); + sqlStorage->query( QStringLiteral("CREATE FULLTEXT INDEX url_podepisode ON podcastepisodes( url );") ); sqlStorage->query( - "CREATE FULLTEXT INDEX localurl_podepisode ON podcastepisodes( localurl );" ); + QStringLiteral("CREATE FULLTEXT INDEX localurl_podepisode ON podcastepisodes( localurl );") ); } void SqlPodcastProvider::updateDatabase( int fromVersion, int toVersion ) { - debug() << QString( "Updating Podcast tables from version %1 to version %2" ) + debug() << QStringLiteral( "Updating Podcast tables from version %1 to version %2" ) .arg( fromVersion ).arg( toVersion ); auto sqlStorage = StorageManager::instance()->sqlStorage(); @@ -1486,7 +1489,7 @@ sqlStorage->query( updateChannelQuery ); - QString setDateQuery = QString( + QString setDateQuery = QStringLiteral( "UPDATE podcastchannels SET subscribedate='%1' WHERE subscribedate='';" ) .arg( escape( QDate::currentDate().toString() ) ); sqlStorage->query( setDateQuery ); @@ -1524,19 +1527,19 @@ ",isnew BOOL" ",iskeep BOOL) ENGINE = MyISAM;" ) ); - sqlStorage->query( "INSERT INTO podcastchannels_temp SELECT * FROM podcastchannels;" ); - sqlStorage->query( "INSERT INTO podcastepisodes_temp SELECT * FROM podcastepisodes;" ); + sqlStorage->query( QStringLiteral("INSERT INTO podcastchannels_temp SELECT * FROM podcastchannels;") ); + sqlStorage->query( QStringLiteral("INSERT INTO podcastepisodes_temp SELECT * FROM podcastepisodes;") ); - sqlStorage->query( "DROP TABLE podcastchannels;" ); - sqlStorage->query( "DROP TABLE podcastepisodes;" ); + sqlStorage->query( QStringLiteral("DROP TABLE podcastchannels;") ); + sqlStorage->query( QStringLiteral("DROP TABLE podcastepisodes;") ); createTables(); - sqlStorage->query( "INSERT INTO podcastchannels SELECT * FROM podcastchannels_temp;" ); - sqlStorage->query( "INSERT INTO podcastepisodes SELECT * FROM podcastepisodes_temp;" ); + sqlStorage->query( QStringLiteral("INSERT INTO podcastchannels SELECT * FROM podcastchannels_temp;") ); + sqlStorage->query( QStringLiteral("INSERT INTO podcastepisodes SELECT * FROM podcastepisodes_temp;") ); - sqlStorage->query( "DROP TABLE podcastchannels_temp;" ); - sqlStorage->query( "DROP TABLE podcastepisodes_temp;" ); + sqlStorage->query( QStringLiteral("DROP TABLE podcastchannels_temp;") ); + sqlStorage->query( QStringLiteral("DROP TABLE podcastepisodes_temp;") ); } if( fromVersion < 4 && toVersion == 4 ) @@ -1555,27 +1558,27 @@ QString updateChannelQuery = QString ( "ALTER TABLE podcastchannels" " ADD filenamelayout VARCHAR(1024);" ); sqlStorage->query( updateChannelQuery ); - QString setWriteTagsQuery = QString( "UPDATE podcastchannels SET filenamelayout='%default%'" ); + QString setWriteTagsQuery = QStringLiteral( "UPDATE podcastchannels SET filenamelayout='%default%'" ); sqlStorage->query( setWriteTagsQuery ); } if( fromVersion < 6 && toVersion == 6 ) { QString updateEpisodeQuery = QString ( "ALTER TABLE podcastepisodes" " ADD iskeep BOOL;" ); sqlStorage->query( updateEpisodeQuery ); - QString setIsKeepQuery = QString( "UPDATE podcastepisodes SET iskeep=FALSE;" ); + QString setIsKeepQuery = QStringLiteral( "UPDATE podcastepisodes SET iskeep=FALSE;" ); sqlStorage->query( setIsKeepQuery ); } - QString updateAdmin = QString( "UPDATE admin SET version=%1 WHERE component='%2';" ); + QString updateAdmin = QStringLiteral( "UPDATE admin SET version=%1 WHERE component='%2';" ); sqlStorage->query( updateAdmin.arg( toVersion ).arg( escape( key ) ) ); loadPodcasts(); } void -SqlPodcastProvider::fetchImage( SqlPodcastChannelPtr channel ) +SqlPodcastProvider::fetchImage( const SqlPodcastChannelPtr &channel ) { if( m_podcastImageFetcher == 0 ) { @@ -1590,7 +1593,7 @@ } void -SqlPodcastProvider::channelImageReady( Podcasts::PodcastChannelPtr channel, QImage image ) +SqlPodcastProvider::channelImageReady( Podcasts::PodcastChannelPtr channel, const QImage &image ) { if( image.isNull() ) return; diff --git a/src/core-impl/storage/StorageManager.h b/src/core-impl/storage/StorageManager.h --- a/src/core-impl/storage/StorageManager.h +++ b/src/core-impl/storage/StorageManager.h @@ -58,8 +58,7 @@ /** retrieve an interface which allows client-code to store/load data in a relational database. - Note: code using this method does NOT take ownership of the pointer, but may cache the pointer - Note2: You should never modify the database unless you really really know what you do. + Note: You should never modify the database unless you really really know what you do. Using the SqlMeta (e.g. SqlRegistry or SqlTrack) is much better. @return Returns a pointer to the amarok wide SqlStorage or to an internal dummy SqlStorage if that cannot be found. @@ -73,7 +72,7 @@ * For every factory that is a CollectionFactory uses it to create new * collections and register with this manager. */ - void setFactories( const QList &factories ); + void setFactories( const QList > &factories ); /** Returns a list of the last sql errors. The list might not include every one error if the number @@ -88,7 +87,7 @@ /** Will be called whenever a factory emits a newStorage signal. * - * The first factory to emit this signal will get it's storage + * The first factory to Q_EMIT this signal will get it's storage * registered as "the" storage. * * StorageManager will take ownership of the pointer and free it @@ -98,12 +97,12 @@ /** Will be called whenever a factory emits a newError signal. * - * The factories will not emit the newStorage signal in case + * The factories will not Q_EMIT the newStorage signal in case * of initialization problems. - * In order to report their issues they will instead emit + * In order to report their issues they will instead Q_EMIT * newError with the list of errors. */ - void slotNewError( QStringList errorMessageList ); + void slotNewError( const QStringList &errorMessageList ); private: static StorageManager* s_instance; diff --git a/src/core-impl/storage/StorageManager.cpp b/src/core-impl/storage/StorageManager.cpp --- a/src/core-impl/storage/StorageManager.cpp +++ b/src/core-impl/storage/StorageManager.cpp @@ -44,28 +44,28 @@ virtual int sqlDatabasePriority() const { return 10; } - virtual QString type() const { return QLatin1String("Empty"); } + virtual QString type() const { return QStringLiteral("Empty"); } - virtual QString escape( const QString &text) const { return text; } + QString escape( const QString &text) const override { return text; } - virtual QStringList query( const QString &) { return QStringList(); } - virtual int insert( const QString &, const QString &) { return 0; } + QStringList query( const QString &) override { return QStringList(); } + int insert( const QString &, const QString &) override { return 0; } - virtual QString boolTrue() const { return QString(); } - virtual QString boolFalse() const { return QString(); } + QString boolTrue() const override { return QString(); } + QString boolFalse() const override { return QString(); } - virtual QString idType() const { return QString(); }; - virtual QString textColumnType( int ) const { return QString(); } - virtual QString exactTextColumnType( int ) const { return QString(); } + QString idType() const override { return QString(); } + QString textColumnType( int ) const override { return QString(); } + QString exactTextColumnType( int ) const override { return QString(); } - virtual QString exactIndexableTextColumnType( int ) const { return QString(); } - virtual QString longTextColumnType() const { return QString(); } - virtual QString randomFunc() const { return QString(); } + QString exactIndexableTextColumnType( int ) const override { return QString(); } + QString longTextColumnType() const override { return QString(); } + QString randomFunc() const override { return QString(); } - virtual QStringList getLastErrors() const { return QStringList(); } + QStringList getLastErrors() const override { return QStringList(); } /** Clears the list of the last errors. */ - virtual void clearLastErrors() { } + void clearLastErrors() override { } }; @@ -83,7 +83,7 @@ QStringList errorList; }; -StorageManager *StorageManager::s_instance = Q_NULLPTR; +StorageManager *StorageManager::s_instance = nullptr; StorageManager * @@ -102,7 +102,7 @@ { if( s_instance ) { delete s_instance; - s_instance = 0; + s_instance = nullptr; } } @@ -112,7 +112,7 @@ { DEBUG_BLOCK - setObjectName( "StorageManager" ); + setObjectName( QStringLiteral("StorageManager") ); qRegisterMetaType( "SqlStorage*" ); d->sqlDatabase = QSharedPointer( new EmptySqlStorage ); } @@ -136,17 +136,17 @@ } void -StorageManager::setFactories( const QList &factories ) +StorageManager::setFactories( const QList > &factories ) { - foreach( Plugins::PluginFactory* pFactory, factories ) + for( const auto &pFactory : factories ) { - StorageFactory *factory = qobject_cast( pFactory ); + auto factory = qobject_cast( pFactory ); if( !factory ) continue; - connect( factory, &StorageFactory::newStorage, + connect( factory.data(), &StorageFactory::newStorage, this, &StorageManager::slotNewStorage ); - connect( factory, &StorageFactory::newError, + connect( factory.data(), &StorageFactory::newError, this, &StorageManager::slotNewError ); } } @@ -194,7 +194,7 @@ } void -StorageManager::slotNewError( QStringList errorMessageList ) +StorageManager::slotNewError( const QStringList &errorMessageList ) { d->errorList << errorMessageList; } diff --git a/src/core-impl/storage/sql/CMakeLists.txt b/src/core-impl/storage/sql/CMakeLists.txt --- a/src/core-impl/storage/sql/CMakeLists.txt +++ b/src/core-impl/storage/sql/CMakeLists.txt @@ -1,6 +1,6 @@ if( BUILD_MYSQLE_COLLECTION ) add_subdirectory( mysqlestorage ) endif() -if( MYSQL_FOUND ) +if( MySQL_FOUND ) add_subdirectory( mysqlserverstorage ) endif() diff --git a/src/core-impl/storage/sql/amarok_sqlstorage_export.h b/src/core-impl/storage/sql/amarok_sqlstorage_export.h --- a/src/core-impl/storage/sql/amarok_sqlstorage_export.h +++ b/src/core-impl/storage/sql/amarok_sqlstorage_export.h @@ -18,7 +18,7 @@ #define AMAROK_SQLSTORAGE_EXPORT_H /* needed for Q_DECL_EXPORT and Q_DECL_IMPORT macros */ -#include +#include #ifndef AMAROK_SQLSTORAGE_EXPORT # if defined(MAKE_AMAROK_SQLSTORAGE_LIB) diff --git a/src/core-impl/storage/sql/mysql-shared/MySqlStorage.h b/src/core-impl/storage/sql/mysql-shared/MySqlStorage.h --- a/src/core-impl/storage/sql/mysql-shared/MySqlStorage.h +++ b/src/core-impl/storage/sql/mysql-shared/MySqlStorage.h @@ -40,34 +40,34 @@ MySqlStorage(); virtual ~MySqlStorage(); - virtual QStringList query( const QString &query ); - virtual int insert( const QString &statement, const QString &table = QString() ); + QStringList query( const QString &query ) override; + int insert( const QString &statement, const QString &table = QString() ) override; - virtual QString escape( const QString &text ) const; - virtual QString randomFunc() const; + QString escape( const QString &text ) const override; + QString randomFunc() const override; - virtual QString boolTrue() const; - virtual QString boolFalse() const; - virtual QString idType() const; - virtual QString textColumnType( int length = 255 ) const; - virtual QString exactTextColumnType( int length = 1000 ) const; + QString boolTrue() const override; + QString boolFalse() const override; + QString idType() const override; + QString textColumnType( int length = 255 ) const override; + QString exactTextColumnType( int length = 1000 ) const override; //the below value may have to be decreased even more for different indexes; only time will tell - virtual QString exactIndexableTextColumnType( int length = 324 ) const; - virtual QString longTextColumnType() const; + QString exactIndexableTextColumnType( int length = 324 ) const override; + QString longTextColumnType() const override; /** Returns a list of the last sql errors. The list might not include every one error if the number is beyond a sensible limit. */ - QStringList getLastErrors() const; + QStringList getLastErrors() const override; /** Clears the list of the last errors. */ - void clearLastErrors(); + void clearLastErrors() override; protected: /** Adds an error message to the m_lastErrors. * - * Adds a message including the mysql error number and mesage + * Adds a message including the mysql error number and message * to the last error messages. * @param message Usually the query statement being executed. */ diff --git a/src/core-impl/storage/sql/mysql-shared/MySqlStorage.cpp b/src/core-impl/storage/sql/mysql-shared/MySqlStorage.cpp --- a/src/core-impl/storage/sql/mysql-shared/MySqlStorage.cpp +++ b/src/core-impl/storage/sql/mysql-shared/MySqlStorage.cpp @@ -136,10 +136,8 @@ warning() << "Errr... query returned but with no fields"; } -#if QT_VERSION >= 0x040700 int rows = mysql_num_rows( pres ); values.reserve( rows ); -#endif MYSQL_ROW row = mysql_fetch_row( pres ); while( row ) { @@ -236,7 +234,7 @@ QString MySqlStorage::textColumnType( int length ) const { - return QString( "VARCHAR(%1)" ).arg( length ); + return QStringLiteral( "VARCHAR(%1)" ).arg( length ); } QString diff --git a/src/core-impl/storage/sql/mysqlestorage/CMakeLists.txt b/src/core-impl/storage/sql/mysqlestorage/CMakeLists.txt --- a/src/core-impl/storage/sql/mysqlestorage/CMakeLists.txt +++ b/src/core-impl/storage/sql/mysqlestorage/CMakeLists.txt @@ -1,7 +1,7 @@ -add_definitions(${MYSQL_EMBEDDED_CFLAGS}) - ########### mysqle ############### +include_directories(${MYSQL_INCLUDE_DIR}) + set( amarok_storage-mysqlestorage_PART_SRCS ../mysql-shared/MySqlStorage.cpp MySqlEmbeddedStorage.cpp @@ -27,16 +27,20 @@ ${ZLIB_LIBRARIES} ) +if(${CMAKE_HOST_SYSTEM_NAME} MATCHES "FreeBSD") + target_link_libraries(amarok_storage-mysqlestorage ${MYSQL_LIBRARIES}) +endif() + if(NOT WIN32 AND NOT APPLE) target_link_libraries( amarok_storage-mysqlestorage crypt pthread ) endif() if(APPLE) SET_TARGET_PROPERTIES(amarok_storage-mysqlestorage PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") endif() -install(TARGETS amarok_storage-mysqlestorage DESTINATION ${PLUGIN_INSTALL_DIR} ) +install(TARGETS amarok_storage-mysqlestorage DESTINATION ${KDE_INSTALL_PLUGINDIR} ) -install(FILES amarok_storage-mysqlestorage.desktop DESTINATION ${SERVICES_INSTALL_DIR}) +install(FILES amarok_storage-mysqlestorage.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}) kcoreaddons_desktop_to_json(amarok_storage-mysqlestorage amarok_storage-mysqlestorage.desktop SERVICE_TYPES ${CMAKE_SOURCE_DIR}/src/amarok-plugin.desktop) diff --git a/src/core-impl/storage/sql/mysqlestorage/MySqlEmbeddedStorage.cpp b/src/core-impl/storage/sql/mysqlestorage/MySqlEmbeddedStorage.cpp --- a/src/core-impl/storage/sql/mysqlestorage/MySqlEmbeddedStorage.cpp +++ b/src/core-impl/storage/sql/mysqlestorage/MySqlEmbeddedStorage.cpp @@ -61,7 +61,7 @@ } QVector mysql_args; - QByteArray dataDir = QString( "--datadir=%1" ).arg( databaseDir ).toLocal8Bit(); + QByteArray dataDir = QStringLiteral( "--datadir=%1" ).arg( databaseDir ).toLocal8Bit(); mysql_args << "amarok" << dataDir.constData() // CAUTION: if we ever change the table type we will need to fix a number of MYISAM specific diff --git a/src/core-impl/storage/sql/mysqlestorage/MySqlEmbeddedStorageFactory.h b/src/core-impl/storage/sql/mysqlestorage/MySqlEmbeddedStorageFactory.h --- a/src/core-impl/storage/sql/mysqlestorage/MySqlEmbeddedStorageFactory.h +++ b/src/core-impl/storage/sql/mysqlestorage/MySqlEmbeddedStorageFactory.h @@ -14,8 +14,8 @@ * this program. If not, see . * ****************************************************************************************/ -#ifndef AMAROK_STORAGE_MYSQLEMBEDDEDFACTORY_H -#define AMAROK_STORAGE_MYSQLEMBEDDEDFACTORY_H +#ifndef AMAROK_STORAGE_MYSQLEMBEDDEDSTORAGEFACTORY_H +#define AMAROK_STORAGE_MYSQLEMBEDDEDSTORAGEFACTORY_H #include "core/storage/StorageFactory.h" @@ -29,7 +29,7 @@ MySqleStorageFactory(); virtual ~MySqleStorageFactory(); - virtual void init(); + void init() override; }; diff --git a/src/core-impl/storage/sql/mysqlestorage/MySqlEmbeddedStorageFactory.cpp b/src/core-impl/storage/sql/mysqlestorage/MySqlEmbeddedStorageFactory.cpp --- a/src/core-impl/storage/sql/mysqlestorage/MySqlEmbeddedStorageFactory.cpp +++ b/src/core-impl/storage/sql/mysqlestorage/MySqlEmbeddedStorageFactory.cpp @@ -44,11 +44,11 @@ // handle errors during creation if( !storage->getLastErrors().isEmpty() ) - emit newError( storage->getLastErrors() ); + Q_EMIT newError( storage->getLastErrors() ); storage->clearLastErrors(); if( initResult ) - emit newStorage( QSharedPointer( storage ) ); + Q_EMIT newStorage( QSharedPointer( storage ) ); else delete storage; } diff --git a/src/core-impl/storage/sql/mysqlestorage/amarok_storage-mysqlestorage.desktop b/src/core-impl/storage/sql/mysqlestorage/amarok_storage-mysqlestorage.desktop --- a/src/core-impl/storage/sql/mysqlestorage/amarok_storage-mysqlestorage.desktop +++ b/src/core-impl/storage/sql/mysqlestorage/amarok_storage-mysqlestorage.desktop @@ -16,6 +16,7 @@ Name[gl]=Almacenamento MySQLe Name[id]=Penyimpanan MySQLe Name[it]=Archiviazione MySQLe +Name[ko]=MySQLe 저장소 Name[nl]=MySQLe-opslag Name[pl]=Przechowalnia MySQLe Name[pt]=Armazenamento no MySQLe @@ -30,6 +31,7 @@ Name[tr]=MySQLe Depolaması Name[uk]=Сховище даних MySQLe Name[x-test]=xxMySQLe Storagexx +Name[zh_TW]=MySQLe 儲存空間 Comment=Storage plugin for Amarok Comment[bs]=Priključak za Amarok Comment[ca]=Connector d'emmagatzematge per l'Amarok @@ -45,6 +47,7 @@ Comment[gl]=Complemento de almacenamento para Amarok Comment[id]=Plugin penyimpanan untuk Amarok Comment[it]=Estensione di archiviazione per Amarok +Comment[ko]=Amarok용 저장소 플러그인 Comment[nl]=Opslag-plug-in voor Amarok Comment[pl]=Wtyczka przechowywania dla Amaroka Comment[pt]='Plugin' de armazenamento do Amarok @@ -59,6 +62,7 @@ Comment[tr]=Amarok için depolama eklentisi Comment[uk]=Додаток сховища даних для Amarok Comment[x-test]=xxStorage plugin for Amarokxx +Comment[zh_TW]=Amarok 的裝置外掛程式 NoDisplay=true ServiceTypes=Amarok/Plugin diff --git a/src/core-impl/storage/sql/mysqlserverstorage/CMakeLists.txt b/src/core-impl/storage/sql/mysqlserverstorage/CMakeLists.txt --- a/src/core-impl/storage/sql/mysqlserverstorage/CMakeLists.txt +++ b/src/core-impl/storage/sql/mysqlserverstorage/CMakeLists.txt @@ -1,7 +1,7 @@ -add_definitions(${MYSQL_CFLAGS}) - ########### mysqlserver ############### +include_directories(${MYSQL_INCLUDE_DIR}) + set( amarok_storage-mysqlserverstorage_PART_SRCS ../mysql-shared/MySqlStorage.cpp MySqlServerStorage.cpp @@ -35,8 +35,8 @@ SET_TARGET_PROPERTIES(amarok_storage-mysqlserverstorage PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") endif() -install(TARGETS amarok_storage-mysqlserverstorage DESTINATION ${PLUGIN_INSTALL_DIR} ) +install(TARGETS amarok_storage-mysqlserverstorage DESTINATION ${KDE_INSTALL_PLUGINDIR} ) -install(FILES amarok_storage-mysqlserverstorage.desktop DESTINATION ${SERVICES_INSTALL_DIR}) +install(FILES amarok_storage-mysqlserverstorage.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}) kcoreaddons_desktop_to_json(amarok_storage-mysqlserverstorage amarok_storage-mysqlserverstorage.desktop SERVICE_TYPES ${CMAKE_SOURCE_DIR}/src/amarok-plugin.desktop) diff --git a/src/core-impl/storage/sql/mysqlserverstorage/MySqlServerStorage.h b/src/core-impl/storage/sql/mysqlserverstorage/MySqlServerStorage.h --- a/src/core-impl/storage/sql/mysqlserverstorage/MySqlServerStorage.h +++ b/src/core-impl/storage/sql/mysqlserverstorage/MySqlServerStorage.h @@ -39,7 +39,7 @@ */ virtual bool init( const QString &host, const QString &user, const QString &password, int port, const QString &databaseName ); - virtual QStringList query( const QString &query ); + QStringList query( const QString &query ) override; private: QString m_databaseName; ///< remember the name given at init for reconnects diff --git a/src/core-impl/storage/sql/mysqlserverstorage/MySqlServerStorage.cpp b/src/core-impl/storage/sql/mysqlserverstorage/MySqlServerStorage.cpp --- a/src/core-impl/storage/sql/mysqlserverstorage/MySqlServerStorage.cpp +++ b/src/core-impl/storage/sql/mysqlserverstorage/MySqlServerStorage.cpp @@ -46,7 +46,7 @@ // we only need to do this once if( !libraryInitRef.fetchAndAddOrdered( 1 ) ) { - int ret = mysql_library_init( 0, NULL, NULL ); + int ret = mysql_library_init( 0, nullptr, nullptr ); if( ret != 0 ) { // mysql sources show that there is only 0 and 1 as return code diff --git a/src/core-impl/storage/sql/mysqlserverstorage/MySqlServerStorageFactory.h b/src/core-impl/storage/sql/mysqlserverstorage/MySqlServerStorageFactory.h --- a/src/core-impl/storage/sql/mysqlserverstorage/MySqlServerStorageFactory.h +++ b/src/core-impl/storage/sql/mysqlserverstorage/MySqlServerStorageFactory.h @@ -30,7 +30,7 @@ MySqlServerStorageFactory(); virtual ~MySqlServerStorageFactory(); - virtual void init(); + void init() override; public Q_SLOTS: diff --git a/src/core-impl/storage/sql/mysqlserverstorage/MySqlServerStorageFactory.cpp b/src/core-impl/storage/sql/mysqlserverstorage/MySqlServerStorageFactory.cpp --- a/src/core-impl/storage/sql/mysqlserverstorage/MySqlServerStorageFactory.cpp +++ b/src/core-impl/storage/sql/mysqlserverstorage/MySqlServerStorageFactory.cpp @@ -48,11 +48,11 @@ // handle errors during creation if( !storage->getLastErrors().isEmpty() ) - emit newError( storage->getLastErrors() ); + Q_EMIT newError( storage->getLastErrors() ); storage->clearLastErrors(); if( initResult ) - emit newStorage( storage ); + Q_EMIT newStorage( storage ); } } diff --git a/src/core-impl/storage/sql/mysqlserverstorage/amarok_storage-mysqlserverstorage.desktop b/src/core-impl/storage/sql/mysqlserverstorage/amarok_storage-mysqlserverstorage.desktop --- a/src/core-impl/storage/sql/mysqlserverstorage/amarok_storage-mysqlserverstorage.desktop +++ b/src/core-impl/storage/sql/mysqlserverstorage/amarok_storage-mysqlserverstorage.desktop @@ -16,6 +16,7 @@ Name[gl]=Almacenamento MySQLServer Name[id]=Penyimpanan MySQLServer Name[it]=Archiviazione MySQLServer +Name[ko]=MySQL서버 저장소 Name[nl]=MySQLServer-opslag Name[pl]=Przechowalnia MySQLServer Name[pt]=Armazenamento no Servidor de MySQL @@ -30,6 +31,7 @@ Name[tr]=MySQL Sunucu Depolaması Name[uk]=Сховище даних MySQLServer Name[x-test]=xxMySQLServer Storagexx +Name[zh_TW]=MySQLServer 儲存空間 Comment=Storage plugin for Amarok Comment[bs]=Priključak za Amarok Comment[ca]=Connector d'emmagatzematge per l'Amarok @@ -45,6 +47,7 @@ Comment[gl]=Complemento de almacenamento para Amarok Comment[id]=Plugin penyimpanan untuk Amarok Comment[it]=Estensione di archiviazione per Amarok +Comment[ko]=Amarok용 저장소 플러그인 Comment[nl]=Opslag-plug-in voor Amarok Comment[pl]=Wtyczka przechowywania dla Amaroka Comment[pt]='Plugin' de armazenamento do Amarok @@ -59,6 +62,7 @@ Comment[tr]=Amarok için depolama eklentisi Comment[uk]=Додаток сховища даних для Amarok Comment[x-test]=xxStorage plugin for Amarokxx +Comment[zh_TW]=Amarok 的裝置外掛程式 NoDisplay=true ServiceTypes=Amarok/Plugin diff --git a/src/core-impl/support/PersistentStatisticsStore.h b/src/core-impl/support/PersistentStatisticsStore.h --- a/src/core-impl/support/PersistentStatisticsStore.h +++ b/src/core-impl/support/PersistentStatisticsStore.h @@ -15,8 +15,8 @@ * this program. If not, see . * ****************************************************************************************/ -#ifndef PERMANENTSTATISTICSSTORE_H -#define PERMANENTSTATISTICSSTORE_H +#ifndef PERSISTENTSTATISTICSSTORE_H +#define PERSISTENTSTATISTICSSTORE_H #include "amarok_export.h" #include "core/meta/Observer.h" @@ -26,7 +26,7 @@ #include /** - * Base class for all permanent statistics storage providers. Use one of the sublassed if + * Base class for all permanent statistics storage providers. Use one of the subclassed if * your collection cannot store statistics (rating, play count..) natively, but you still * want to provide the functionality. * @@ -40,40 +40,40 @@ { public: /** - * Create persistent statistics store of @param track statistics. @param trak may + * Create persistent statistics store of @param track statistics. @p track may * not be null. * * This methods takes plain pointer so that you can call it in the Track * constructor without AmarokSharedPointer deleting it right away. */ - PersistentStatisticsStore( Meta::Track *track ); + explicit PersistentStatisticsStore( Meta::Track *track ); virtual ~PersistentStatisticsStore(); // Meta::Statistics methods - virtual double score() const; - virtual void setScore( double newScore ); + double score() const override; + void setScore( double newScore ) override; - virtual int rating() const; - virtual void setRating( int newRating ); + int rating() const override; + void setRating( int newRating ) override; - virtual QDateTime lastPlayed() const; - virtual void setLastPlayed( const QDateTime &dt ); + QDateTime lastPlayed() const override; + void setLastPlayed( const QDateTime &dt ) override; - virtual QDateTime firstPlayed() const; - virtual void setFirstPlayed( const QDateTime &dt ); + QDateTime firstPlayed() const override; + void setFirstPlayed( const QDateTime &dt ) override; - virtual int playCount() const; - virtual void setPlayCount( int playCount ); + int playCount() const override; + void setPlayCount( int playCount ) override; - virtual void beginUpdate(); - virtual void endUpdate(); + void beginUpdate() override; + void endUpdate() override; // Meta::Observer methods /** * Notice that the linked track was destroyed. */ - virtual void entityDestroyed(); + void entityDestroyed() override; protected: virtual void save() = 0; // called with m_lock locked for writing! @@ -86,7 +86,7 @@ double m_score; int m_rating; int m_playCount; - mutable QReadWriteLock m_lock; // lock procecting access to fields. + mutable QReadWriteLock m_lock; // lock protecting access to fields. private: void commitIfInNonBatchUpdate(); // must be called with the m_lock locked for writing @@ -98,4 +98,4 @@ int m_batch; }; -#endif // PERMANENTSTATISTICSSTORE_H +#endif // PERSISTENTSTATISTICSSTORE_H diff --git a/src/core-impl/support/PersistentStatisticsStore.cpp b/src/core-impl/support/PersistentStatisticsStore.cpp --- a/src/core-impl/support/PersistentStatisticsStore.cpp +++ b/src/core-impl/support/PersistentStatisticsStore.cpp @@ -21,7 +21,7 @@ #include "core/support/Amarok.h" #include "core/support/Debug.h" -const QString PersistentStatisticsStore::s_sqlDateFormat( "yyyy-MM-dd hh:mm:ss" ); +const QString PersistentStatisticsStore::s_sqlDateFormat( QStringLiteral("yyyy-MM-dd hh:mm:ss") ); PersistentStatisticsStore::PersistentStatisticsStore( Meta::Track *track ) : m_track( track ) diff --git a/src/core-impl/support/TagStatisticsStore.h b/src/core-impl/support/TagStatisticsStore.h --- a/src/core-impl/support/TagStatisticsStore.h +++ b/src/core-impl/support/TagStatisticsStore.h @@ -14,25 +14,25 @@ * this program. If not, see . * ****************************************************************************************/ -#ifndef TAGSTATISTICSPROVIDER_H -#define TAGSTATISTICSPROVIDER_H +#ifndef TAGSTATISTICSSTORE_H +#define TAGSTATISTICSSTORE_H #include "core-impl/support/PersistentStatisticsStore.h" #include class AMAROK_EXPORT TagStatisticsStore : public PersistentStatisticsStore { public: - TagStatisticsStore( Meta::Track *track ); + explicit TagStatisticsStore( Meta::Track *track ); protected: - virtual void save(); + void save() override; private: QString m_name; QString m_artist; QString m_album; }; -#endif // PERMANENTURLSTATISTICSPROVIDER_H +#endif // TAGSTATISTICSSTORE_H diff --git a/src/core-impl/support/TrackLoader.h b/src/core-impl/support/TrackLoader.h --- a/src/core-impl/support/TrackLoader.h +++ b/src/core-impl/support/TrackLoader.h @@ -67,9 +67,9 @@ * * @param flags binary or of flags, see TrackLoader::Flags enum * @param timeout if FullMetadataRequired is in flags, this is the timeout in - * milliseconds for wating on track to resolve. Ignored otherwise. + * milliseconds for waiting on track to resolve. Ignored otherwise. */ - TrackLoader( Flags flags = 0, int timeout = 2000 ); + explicit TrackLoader( Flags flags = 0, int timeout = 2000 ); ~TrackLoader(); /** @@ -81,7 +81,7 @@ * Starts TrackLoader's job, you'll get finished() signal in the end and * TrackLoader will auto-delete itself. * - * @urls list of urls to load tracks from, you can pass local and remote urls + * @param urls list of urls to load tracks from, you can pass local and remote urls * pointing to directories, tracks and playlists. */ void init( const QList &urls ); @@ -95,11 +95,11 @@ /* PlaylistObserver methods */ using PlaylistObserver::metadataChanged; - virtual void tracksLoaded( Playlists::PlaylistPtr playlist ); + void tracksLoaded( Playlists::PlaylistPtr playlist ) override; /* Meta::Observer methods */ using Observer::metadataChanged; - virtual void metadataChanged( Meta::TrackPtr track ); + void metadataChanged( const Meta::TrackPtr &track ) override; Q_SIGNALS: void finished( const Meta::TrackList &tracks ); diff --git a/src/core-impl/support/TrackLoader.cpp b/src/core-impl/support/TrackLoader.cpp --- a/src/core-impl/support/TrackLoader.cpp +++ b/src/core-impl/support/TrackLoader.cpp @@ -172,7 +172,7 @@ { // this method needs to be thread-safe! - // some playlists used to emit tracksLoaded() in ->tracks(), prevent infinite + // some playlists used to Q_EMIT tracksLoaded() in ->tracks(), prevent infinite // recursion by unsubscribing early PlaylistObserver::unsubscribeFrom( playlist ); @@ -213,7 +213,7 @@ } void -TrackLoader::metadataChanged( Meta::TrackPtr track ) +TrackLoader::metadataChanged( const Meta::TrackPtr &track ) { // first metadataChanged() from a MetaProxy::Track means that it has found the real track bool isEmpty; @@ -250,13 +250,13 @@ void TrackLoader::finish() { - // prevent double emit of finished(), race between singleshot QTimers from mayFinish() + // prevent double Q_EMIT of finished(), race between singleshot QTimers from mayFinish() // and metadataChanged() if( m_status != MayFinish ) return; m_status = Finished; - emit finished( m_tracks ); + Q_EMIT finished( m_tracks ); deleteLater(); } diff --git a/src/core-impl/support/UrlStatisticsStore.h b/src/core-impl/support/UrlStatisticsStore.h --- a/src/core-impl/support/UrlStatisticsStore.h +++ b/src/core-impl/support/UrlStatisticsStore.h @@ -25,13 +25,15 @@ { public: /** - * Construct persistent per-url statistics store. If @param permanentUrl is not + * Construct persistent per-url statistics store. If @p permanentUrl is not * specified, track->uidUrl() is used. + * @param track the track + * @param permanentUrl the URL */ - UrlStatisticsStore( Meta::Track *track, const QString &permanentUrl = QString() ); + explicit UrlStatisticsStore( Meta::Track *track, const QString &permanentUrl = QString() ); protected: - virtual void save(); + void save() override; private: QString m_permanentUrl; diff --git a/src/core-impl/support/UrlStatisticsStore.cpp b/src/core-impl/support/UrlStatisticsStore.cpp --- a/src/core-impl/support/UrlStatisticsStore.cpp +++ b/src/core-impl/support/UrlStatisticsStore.cpp @@ -58,7 +58,7 @@ return; } - const QString check = "SELECT COUNT(*) FROM statistics_permanent WHERE url = '%1'"; + const QString check = QStringLiteral("SELECT COUNT(*) FROM statistics_permanent WHERE url = '%1'"); QStringList rsCheck = sql->query( check.arg( sql->escape( m_permanentUrl ) ) ); if( !rsCheck.isEmpty() ) { diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -1,5 +1,4 @@ set(libcore_interfaces_SRCS - interfaces/Logger.cpp interfaces/MetaCapability.cpp ) @@ -62,7 +61,6 @@ support/Amarok.cpp support/Components.cpp support/SemaphoreReleaser.cpp - support/SmartPointerList.cpp support/PluginFactory.cpp support/Debug.cpp ) @@ -81,6 +79,10 @@ transcoding/TranscodingProperty.cpp ) +set(libcore_logger_SRCS + logger/Logger.cpp +) + ##################################################################### # LIBCORE ##################################################################### @@ -94,10 +96,11 @@ ${libcore_capabilities_SRCS} ${libcore_support_SRCS} ${libcore_transcoding_SRCS} + ${libcore_logger_SRCS} ) add_library(amarokcore SHARED ${libcore_LIB_SRCS}) - +generate_export_header(amarokcore BASE_NAME amarokcore) target_include_directories( amarokcore PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} @@ -108,7 +111,7 @@ target_link_libraries(amarokcore amarokshared ${CMAKE_DL_LIBS} - ${CMAKE_THREAD_LIBS_INIT} + Threads::Threads Qt5::Core Qt5::Network KF5::KIOCore diff --git a/src/core/amarokcore_export.h b/src/core/amarokcore_export.h deleted file mode 100644 --- a/src/core/amarokcore_export.h +++ /dev/null @@ -1,35 +0,0 @@ -/**************************************************************************************** - * Copyright (c) 2007 David Faure * - * Copyright (c) 2010 Patrick von Reth * - * Copyright (c) 2013 Matěj Laitl * - * * - * This program is free software; you can redistribute it and/or modify it under * - * the terms of the GNU General Public License as published by the Free Software * - * Foundation; either version 2 of the License, or (at your option) any later * - * version. * - * * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY * - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * - * PARTICULAR PURPOSE. See the GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License along with * - * this program. If not, see . * - ****************************************************************************************/ - -#ifndef AMAROKCORE_EXPORT_H -#define AMAROKCORE_EXPORT_H - -/* needed for Q_DECL_EXPORT and Q_DECL_IMPORT macros */ -#include - -#ifndef AMAROK_CORE_EXPORT -# ifdef MAKE_AMAROKCORE_LIB - /* We are building this library */ -# define AMAROK_CORE_EXPORT Q_DECL_EXPORT -# else - /* We are using this library */ -# define AMAROK_CORE_EXPORT Q_DECL_IMPORT -# endif // MAKE_AMAROKCORE_LIB -#endif // AMAROK_CORE_EXPORT - -#endif // AMAROKCORE_EXPORT_H diff --git a/src/core/capabilities/ActionsCapability.h b/src/core/capabilities/ActionsCapability.h --- a/src/core/capabilities/ActionsCapability.h +++ b/src/core/capabilities/ActionsCapability.h @@ -36,24 +36,24 @@ * * @author Nikolaj Hald Nielsen */ - class AMAROK_CORE_EXPORT ActionsCapability : public Capabilities::Capability + class AMAROKCORE_EXPORT ActionsCapability : public Capabilities::Capability { Q_OBJECT public: /** * Constructor * Note: The actions are not freed after usage * @param actions A list of actions to use. */ - ActionsCapability( const QList< QAction* > &actions ); + explicit ActionsCapability( const QList< QAction* > &actions ); /** * Destructor */ virtual ~ActionsCapability(); /** - * Get the custom actions for this capablility + * Get the custom actions for this capability * The caller must free actions that have no parent after use. * Actions with a parent are freed by the parent (obviously) * @return The list of actions diff --git a/src/core/capabilities/BookmarkThisCapability.h b/src/core/capabilities/BookmarkThisCapability.h --- a/src/core/capabilities/BookmarkThisCapability.h +++ b/src/core/capabilities/BookmarkThisCapability.h @@ -29,14 +29,14 @@ @author Nikolaj Hald Nielsen */ -class AMAROK_CORE_EXPORT BookmarkThisCapability : public Capability { +class AMAROKCORE_EXPORT BookmarkThisCapability : public Capability { Q_OBJECT public: - BookmarkThisCapability( QAction* action ); + explicit BookmarkThisCapability( QAction* action ); virtual ~BookmarkThisCapability(); virtual bool isBookmarkable() { return true; } - virtual QString browserName() { return "collections"; } + virtual QString browserName() { return QStringLiteral("collections"); } virtual QString collectionName() { return QString(); } virtual bool simpleFiltering() { return false; } diff --git a/src/core/capabilities/BoundedPlaybackCapability.h b/src/core/capabilities/BoundedPlaybackCapability.h --- a/src/core/capabilities/BoundedPlaybackCapability.h +++ b/src/core/capabilities/BoundedPlaybackCapability.h @@ -26,7 +26,7 @@ @author Nikolaj Hald Nielsen */ -class AMAROK_CORE_EXPORT BoundedPlaybackCapability : public Capability +class AMAROKCORE_EXPORT BoundedPlaybackCapability : public Capability { Q_OBJECT public: diff --git a/src/core/capabilities/Capability.h b/src/core/capabilities/Capability.h --- a/src/core/capabilities/Capability.h +++ b/src/core/capabilities/Capability.h @@ -17,7 +17,7 @@ #ifndef AMAROK_CAPABILITY_H #define AMAROK_CAPABILITY_H -#include "core/amarokcore_export.h" +#include "amarokcore_export.h" #include @@ -32,10 +32,9 @@ Please note that the capability object will be created on demand and also destroyed. */ - class AMAROK_CORE_EXPORT Capability : public QObject + class AMAROKCORE_EXPORT Capability : public QObject { Q_OBJECT - Q_ENUMS( Type ) public: //add additional capabilities here @@ -66,6 +65,7 @@ , CollectionScan = 24 , Transcode = 25 }; + Q_ENUM( Type ) virtual ~Capability(); diff --git a/src/core/capabilities/CollectionImportCapability.h b/src/core/capabilities/CollectionImportCapability.h --- a/src/core/capabilities/CollectionImportCapability.h +++ b/src/core/capabilities/CollectionImportCapability.h @@ -31,7 +31,7 @@ * @author Ralf Engels */ - class AMAROK_CORE_EXPORT CollectionImportCapability : public Capabilities::Capability + class AMAROKCORE_EXPORT CollectionImportCapability : public Capabilities::Capability { Q_OBJECT public: diff --git a/src/core/capabilities/CollectionScanCapability.h b/src/core/capabilities/CollectionScanCapability.h --- a/src/core/capabilities/CollectionScanCapability.h +++ b/src/core/capabilities/CollectionScanCapability.h @@ -14,23 +14,23 @@ * this program. If not, see . * ****************************************************************************************/ -#ifndef AMAROK_COLLECTIONSSCANCAPABILITY_H -#define AMAROK_COLLECTIONSSCANCAPABILITY_H +#ifndef AMAROK_COLLECTIONSCANCAPABILITY_H +#define AMAROK_COLLECTIONSCANCAPABILITY_H #include "core/amarokcore_export.h" #include "core/capabilities/Capability.h" namespace Capabilities { /** * This capability allows to initiate a scan on a collection. - * Currently only a few collections have this capablitity and even then it's unclear + * Currently only a few collections have this capability and even then it's unclear * Which collections uses the collection folders. * * @author Ralf Engels */ - class AMAROK_CORE_EXPORT CollectionScanCapability : public Capabilities::Capability + class AMAROKCORE_EXPORT CollectionScanCapability : public Capabilities::Capability { Q_OBJECT public: diff --git a/src/core/capabilities/FindInSourceCapability.h b/src/core/capabilities/FindInSourceCapability.h --- a/src/core/capabilities/FindInSourceCapability.h +++ b/src/core/capabilities/FindInSourceCapability.h @@ -28,7 +28,7 @@ @author Nikolaj Hald Nielsen */ -class AMAROK_CORE_EXPORT FindInSourceCapability : public Capabilities::Capability +class AMAROKCORE_EXPORT FindInSourceCapability : public Capabilities::Capability { Q_OBJECT Q_FLAGS( TargetTag TargetTags ) diff --git a/src/core/capabilities/MultiPlayableCapability.h b/src/core/capabilities/MultiPlayableCapability.h --- a/src/core/capabilities/MultiPlayableCapability.h +++ b/src/core/capabilities/MultiPlayableCapability.h @@ -23,7 +23,7 @@ namespace Capabilities { - class AMAROK_CORE_EXPORT MultiPlayableCapability : public Capability + class AMAROKCORE_EXPORT MultiPlayableCapability : public Capability { Q_OBJECT diff --git a/src/core/capabilities/MultiSourceCapability.h b/src/core/capabilities/MultiSourceCapability.h --- a/src/core/capabilities/MultiSourceCapability.h +++ b/src/core/capabilities/MultiSourceCapability.h @@ -27,12 +27,12 @@ /** * A capability for tracks that can have several different source urls, such as * multiple fallback streams for a radio station. If one source url fails or finishes, - * the track will automatically use the next one. It is also possbile to get a list + * the track will automatically use the next one. It is also possible to get a list * of all urls that can be presented to the user so tha she can choose. * * @author Nikolaj Hald Nielsen */ - class AMAROK_CORE_EXPORT MultiSourceCapability : public Capability + class AMAROKCORE_EXPORT MultiSourceCapability : public Capability { Q_OBJECT @@ -49,7 +49,7 @@ virtual QStringList sources() const = 0; /** - * Set current source. Does nothing if @param current is out of bounds. + * Set current source. Does nothing if @param source is out of bounds. */ virtual void setSource( int source ) = 0; diff --git a/src/core/capabilities/OrganiseCapability.h b/src/core/capabilities/OrganiseCapability.h --- a/src/core/capabilities/OrganiseCapability.h +++ b/src/core/capabilities/OrganiseCapability.h @@ -22,7 +22,7 @@ namespace Capabilities { - class AMAROK_CORE_EXPORT OrganiseCapability : public Capabilities::Capability + class AMAROKCORE_EXPORT OrganiseCapability : public Capabilities::Capability { Q_OBJECT public: diff --git a/src/core/capabilities/ReadLabelCapability.h b/src/core/capabilities/ReadLabelCapability.h --- a/src/core/capabilities/ReadLabelCapability.h +++ b/src/core/capabilities/ReadLabelCapability.h @@ -26,7 +26,7 @@ namespace Capabilities { -class AMAROK_CORE_EXPORT ReadLabelCapability : public Capabilities::Capability +class AMAROKCORE_EXPORT ReadLabelCapability : public Capabilities::Capability { Q_OBJECT public: @@ -38,7 +38,7 @@ virtual QStringList labels() = 0; Q_SIGNALS: - void labelsFetched( QStringList ); + void labelsFetched( const QStringList &); }; diff --git a/src/core/capabilities/SourceInfoCapability.h b/src/core/capabilities/SourceInfoCapability.h --- a/src/core/capabilities/SourceInfoCapability.h +++ b/src/core/capabilities/SourceInfoCapability.h @@ -30,7 +30,7 @@ @author Nikolaj Hald Nielsen */ - class AMAROK_CORE_EXPORT SourceInfoCapability : public Capabilities::Capability{ + class AMAROKCORE_EXPORT SourceInfoCapability : public Capabilities::Capability{ public: Q_OBJECT public: diff --git a/src/core/capabilities/StreamInfoCapability.h b/src/core/capabilities/StreamInfoCapability.h --- a/src/core/capabilities/StreamInfoCapability.h +++ b/src/core/capabilities/StreamInfoCapability.h @@ -34,12 +34,12 @@ @author Dan Meltzer */ - class AMAROK_CORE_EXPORT StreamInfoCapability : public Capabilities::Capability + class AMAROKCORE_EXPORT StreamInfoCapability : public Capabilities::Capability { Q_OBJECT public: - StreamInfoCapability() {}; - virtual ~StreamInfoCapability() {}; + StreamInfoCapability() {} + virtual ~StreamInfoCapability() {} /** * The human readable name of this stream diff --git a/src/core/capabilities/TranscodeCapability.h b/src/core/capabilities/TranscodeCapability.h --- a/src/core/capabilities/TranscodeCapability.h +++ b/src/core/capabilities/TranscodeCapability.h @@ -38,7 +38,7 @@ * * @author Matěj Laitl */ - class AMAROK_CORE_EXPORT TranscodeCapability : public Capability + class AMAROKCORE_EXPORT TranscodeCapability : public Capability { Q_OBJECT @@ -48,7 +48,7 @@ /** * Return a list of file types (should be compatible with Meta::Track::type()) * that your collection is able to play. This is used to disable transcoding - * to formats that wouldnt be playable; if your collection is a portable player + * to formats that wouldn't be playable; if your collection is a portable player * that can only play ogg vorbis and flac, you would return * QStringList() << "ogg" << "flac"; * @@ -68,8 +68,10 @@ virtual Transcoding::Configuration savedConfiguration() = 0; /** - * Set saved configuration to @param configuration. An invalid configuration + * Set saved configuration to @p configuration. An invalid configuration * should be interpreted as an action to unset saved configuration. + * + * @param configuration the transcoding configuration */ virtual void setSavedConfiguration( const Transcoding::Configuration &configuration ) = 0; diff --git a/src/core/capabilities/WriteLabelCapability.h b/src/core/capabilities/WriteLabelCapability.h --- a/src/core/capabilities/WriteLabelCapability.h +++ b/src/core/capabilities/WriteLabelCapability.h @@ -24,7 +24,7 @@ namespace Capabilities { -class AMAROK_CORE_EXPORT WriteLabelCapability : public Capabilities::Capability +class AMAROKCORE_EXPORT WriteLabelCapability : public Capabilities::Capability { Q_OBJECT public: diff --git a/src/core/collections/Collection.h b/src/core/collections/Collection.h --- a/src/core/collections/Collection.h +++ b/src/core/collections/Collection.h @@ -30,7 +30,6 @@ typedef AmarokSharedPointer TrackPtr; } namespace Playlists { - class UserPlaylistProvider; } class QIcon; @@ -44,7 +43,7 @@ /** A plugin that creates new collections. */ - class AMAROK_CORE_EXPORT CollectionFactory : public Plugins::PluginFactory + class AMAROKCORE_EXPORT CollectionFactory : public Plugins::PluginFactory { Q_OBJECT @@ -62,7 +61,7 @@ * are also a couple of other track providers. * All TrackProvider are managed by the CollectionManager. */ - class AMAROK_CORE_EXPORT TrackProvider + class AMAROKCORE_EXPORT TrackProvider { public: TrackProvider(); @@ -84,7 +83,7 @@ virtual Meta::TrackPtr trackForUrl( const QUrl &url ); }; - class AMAROK_CORE_EXPORT Collection : public QObject, public TrackProvider, public MetaCapability + class AMAROKCORE_EXPORT Collection : public QObject, public TrackProvider, public MetaCapability { Q_OBJECT @@ -154,22 +153,22 @@ * This signal must be emitted when the collection contents has changed * significantly. * - * More specifically, you must emit this signal (only) in such situations: + * More specifically, you must Q_EMIT this signal (only) in such situations: * a) the set of entities (tracks, albums, years, ...) in this collection has * changed: a track was added, album is renamed, year was removed... * b) the relationship between the entities has changed: the track changed - * album, album is no longer associated to an album artist and bacame a + * album, album is no longer associated to an album artist and became a * compilation, an alum changed its year... * - * You should not emit this signal when some minor data of an entity change, + * You should not Q_EMIT this signal when some minor data of an entity change, * for example when a track comment changes, etc. * - * Also note there are ::notifyObservers() methods of various entities. - * ::notifyObservers() and Collection::updated() are perpendicular and + * Also note there are \::notifyObservers() methods of various entities. + * \::notifyObservers() and Collection::updated() are perpendicular and * responsibility to call one of these may and may not mean need to call the * other. * - * This signal spedifically this means that previous done searches can no + * This signal specifically this means that previous done searches can no * longer be considered valid. */ void updated(); diff --git a/src/core/collections/CollectionLocation.h b/src/core/collections/CollectionLocation.h --- a/src/core/collections/CollectionLocation.h +++ b/src/core/collections/CollectionLocation.h @@ -95,7 +95,7 @@ slotFinishRemove */ -class AMAROK_CORE_EXPORT CollectionLocation : public QObject +class AMAROKCORE_EXPORT CollectionLocation : public QObject { Q_OBJECT @@ -108,7 +108,7 @@ public: CollectionLocation(); - CollectionLocation( Collections::Collection *parentCollection ); + explicit CollectionLocation( Collections::Collection *parentCollection ); virtual ~CollectionLocation(); /** @@ -125,7 +125,7 @@ virtual QString prettyLocation() const; /** - Returns a list of machine usable strings representingthe collection location. + Returns a list of machine usable strings representing the collection location. For example, a local collection would return a list of paths where tracks are stored, while an Ampache collection would return a list with one string containing the URL of an ampache server. An iPod collection and a MTP device @@ -155,36 +155,44 @@ Convenience method for copying a single track. @see prepareCopy( Meta::TrackList, CollectionLocation* ) */ - void prepareCopy( Meta::TrackPtr track, CollectionLocation *destination ); + void prepareCopy( const Meta::TrackPtr &track, CollectionLocation *destination ); /** - Schedule copying of @param tracks to collection location @param destination. - This method takes ownership of the @param destination, you may not reference + Schedule copying of @p tracks to collection location @p destination. + This method takes ownership of the @p destination, you may not reference or delete it after this call. This method returns immediately and the actual copy is performed in the event loop and/or another thread. + @param tracks tracks + @param destination the collection location destination */ void prepareCopy( const Meta::TrackList &tracks, CollectionLocation *destination ); /** - Convenience method for copying tracks based on QueryMaker restults, - takes ownership of the @param qm. + Convenience method for copying tracks based on QueryMaker results, + takes ownership of the @p qm. + @param qm the QueryMaker query + @param destination the collection destination @see prepareCopy( Meta::TrackList, CollectionLocation* ) */ void prepareCopy( Collections::QueryMaker *qm, CollectionLocation *destination ); /** * Convenience method for moving a single track. * @see prepareMove( Meta::TrackList, CollectionLocation* ) */ - void prepareMove( Meta::TrackPtr track, CollectionLocation *destination ); + void prepareMove( const Meta::TrackPtr &track, CollectionLocation *destination ); /** - Schedule moving of @param tracks to collection location @param destination. - This method takes ownership of the @param destination, you may not reference + Schedule moving of @p tracks to collection location @p destination. + This method takes ownership of the @p destination, you may not reference or delete it after this call. This method returns immediately and the actual move is performed in the event loop and/or another thread. + @param tracks tracks + @param destination the collection location destination */ void prepareMove( const Meta::TrackList &tracks, CollectionLocation *destination ); /** - Convenience method for moving tracks based on QueryMaker restults, - takes ownership of the @param qm. + Convenience method for moving tracks based on QueryMaker results, + takes ownership of the @p qm. + @param qm the QueryMaker query + @param destination the collection destination @see prepareMove( Meta::TrackList, CollectionLocation* ) */ void prepareMove( Collections::QueryMaker *qm, CollectionLocation *destination ); @@ -195,14 +203,17 @@ void prepareRemove( const Meta::TrackList &tracks ); /** Convenience method for removing tracks selected by QueryMaker, - takes ownership of the @param qm. + takes ownership of the @p qm. + @param qm the QueryMaker query @see prepareRemove( Meta::TrackList ) */ void prepareRemove( Collections::QueryMaker *qm ); /** * Adds or merges a track to the collection (not to the disk) * Inserts a set of TrackPtrs directly into the database without needing to actual move any files + * @param track track + * @param path path * This is a hack required by the DatabaseImporter * TODO: Remove this hack * @return true if the database entry was inserted, false otherwise @@ -213,11 +224,14 @@ explicitly inform the source collection of successful transfer. The source collection will only remove files (if necessary) for which this method was called. + @param track track */ void transferSuccessful( const Meta::TrackPtr &track ); /** * tells the source location that an error occurred during the transfer of the file + * @param track track + * @param error error */ virtual void transferError( const Meta::TrackPtr &track, const QString &error ); @@ -329,7 +343,7 @@ /** * Get nice localised string describing the current operation based on transcoding - * configuraiton and isGoingToRemoveSources(); meant to be called by destination + * configuration and isGoingToRemoveSources(); meant to be called by destination * collection. * * @return "Copy Tracks", "Transcode and Organize Tracks" etc. @@ -340,6 +354,7 @@ * Get nice localised string that can be used as progress bar text for the current * operation; meant to be called by the destination collection. * + * @param configuration the transcoding configuration * @param trackCount number of tracks in the transfer * @param destinationName pretty localised name of the destination collection; * prettyLocation() is used if the string is empty or not specified @@ -402,7 +417,7 @@ CollectionLocation *m_source; Meta::TrackList getSourceTracks() const { return m_sourceTracks; } - void setSourceTracks( Meta::TrackList tracks ) { m_sourceTracks = tracks; } + void setSourceTracks( const Meta::TrackList &tracks ) { m_sourceTracks = tracks; } Meta::TrackList m_sourceTracks; Collections::Collection *m_parentCollection; diff --git a/src/core/collections/CollectionLocation.cpp b/src/core/collections/CollectionLocation.cpp --- a/src/core/collections/CollectionLocation.cpp +++ b/src/core/collections/CollectionLocation.cpp @@ -100,7 +100,7 @@ } void -CollectionLocation::prepareCopy( Meta::TrackPtr track, CollectionLocation *destination ) +CollectionLocation::prepareCopy( const Meta::TrackPtr &track, CollectionLocation *destination ) { Q_ASSERT(destination); Meta::TrackList list; @@ -148,7 +148,7 @@ } void -CollectionLocation::prepareMove( Meta::TrackPtr track, CollectionLocation *destination ) +CollectionLocation::prepareMove( const Meta::TrackPtr &track, CollectionLocation *destination ) { Meta::TrackList list; list.append( track ); @@ -244,7 +244,7 @@ void CollectionLocation::abort() { - emit aborted(); + Q_EMIT aborted(); } void @@ -436,37 +436,37 @@ void CollectionLocation::slotGetKIOCopyableUrlsDone( const QMap &sources ) { - emit startCopy( sources, m_transcodingConfiguration ); + Q_EMIT startCopy( sources, m_transcodingConfiguration ); } void CollectionLocation::slotCopyOperationFinished() { - emit finishCopy(); + Q_EMIT finishCopy(); } void CollectionLocation::slotRemoveOperationFinished() { - emit finishRemove(); + Q_EMIT finishRemove(); } void CollectionLocation::slotShowSourceDialogDone() { - emit prepareOperation( m_sourceTracks, m_removeSources, m_transcodingConfiguration ); + Q_EMIT prepareOperation( m_sourceTracks, m_removeSources, m_transcodingConfiguration ); } void CollectionLocation::slotShowDestinationDialogDone() { - emit operationPrepared(); + Q_EMIT operationPrepared(); } void CollectionLocation::slotShowRemoveDialogDone() { - emit startRemove(); + Q_EMIT startRemove(); } void @@ -561,7 +561,7 @@ continue; dir.setFilter( QDir::NoDotAndDotDot ); - while( !dir.isRoot() && dir.count() == 0 ) + while( !dir.isRoot() && dir.isEmpty() ) { const QString name = dir.dirName(); dir.cdUp(); diff --git a/src/core/collections/CollectionLocationDelegate.h b/src/core/collections/CollectionLocationDelegate.h --- a/src/core/collections/CollectionLocationDelegate.h +++ b/src/core/collections/CollectionLocationDelegate.h @@ -26,16 +26,16 @@ class CollectionLocation; -class AMAROK_CORE_EXPORT CollectionLocationDelegate +class AMAROKCORE_EXPORT CollectionLocationDelegate { public: enum OperationType { Copy, Move }; - CollectionLocationDelegate() {}; - virtual ~ CollectionLocationDelegate() {}; + CollectionLocationDelegate() {} + virtual ~ CollectionLocationDelegate() {} virtual bool reallyDelete( CollectionLocation *loc, const Meta::TrackList &tracks ) const = 0; virtual bool reallyMove( CollectionLocation *loc, const Meta::TrackList &tracks ) const = 0; @@ -47,12 +47,12 @@ /** * Displays a dialog requesting what transcoding configuration to use. * - * @param playableFileTypes list of filetypes that are playable (empty if everyhing playable) + * @param playableFileTypes list of filetypes that are playable (empty if everything playable) * @param remember is set to true if user checks this transcoding config should be * remembered per target collection. If null, such option is disabled in the UI. * @param operation whether this is copying or moving * @param destCollectionName name of the destination collection - * @param savedConfiguration the previously saved configuration, for restoring values from + * @param prevConfiguration the previously saved configuration, for restoring values from * * @return Transcoding configuration user requested or invalid configuration if user * has hit Cancel or closed the dialog. diff --git a/src/core/collections/MetaQueryMaker.h b/src/core/collections/MetaQueryMaker.h --- a/src/core/collections/MetaQueryMaker.h +++ b/src/core/collections/MetaQueryMaker.h @@ -25,46 +25,46 @@ namespace Collections { -class AMAROK_CORE_EXPORT MetaQueryMaker : public QueryMaker +class AMAROKCORE_EXPORT MetaQueryMaker : public QueryMaker { Q_OBJECT public: - MetaQueryMaker( const QList &collections ); - MetaQueryMaker( const QList &queryMakers ); + explicit MetaQueryMaker( const QList &collections ); + explicit MetaQueryMaker( const QList &queryMakers ); ~MetaQueryMaker(); - virtual void run(); - virtual void abortQuery(); + void run() override; + void abortQuery() override; - virtual QueryMaker* setQueryType( QueryType type ); + QueryMaker* setQueryType( QueryType type ) override; - virtual QueryMaker* addReturnValue( qint64 value); - virtual QueryMaker* addReturnFunction( ReturnFunction function, qint64 value ); - virtual QueryMaker* orderBy( qint64 value, bool descending = false ); + QueryMaker* addReturnValue( qint64 value) override; + QueryMaker* addReturnFunction( ReturnFunction function, qint64 value ) override; + QueryMaker* orderBy( qint64 value, bool descending = false ) override; - virtual QueryMaker* addMatch( const Meta::TrackPtr &track ); - virtual QueryMaker* addMatch( const Meta::ArtistPtr &artist, ArtistMatchBehaviour behaviour = TrackArtists ); - virtual QueryMaker* addMatch( const Meta::AlbumPtr &album ); - virtual QueryMaker* addMatch( const Meta::ComposerPtr &composer ); - virtual QueryMaker* addMatch( const Meta::GenrePtr &genre ); - virtual QueryMaker* addMatch( const Meta::YearPtr &year ); - virtual QueryMaker* addMatch( const Meta::LabelPtr &label ); + QueryMaker* addMatch( const Meta::TrackPtr &track ) override; + QueryMaker* addMatch( const Meta::ArtistPtr &artist, ArtistMatchBehaviour behaviour = TrackArtists ) override; + QueryMaker* addMatch( const Meta::AlbumPtr &album ) override; + QueryMaker* addMatch( const Meta::ComposerPtr &composer ) override; + QueryMaker* addMatch( const Meta::GenrePtr &genre ) override; + QueryMaker* addMatch( const Meta::YearPtr &year ) override; + QueryMaker* addMatch( const Meta::LabelPtr &label ) override; - virtual QueryMaker* addFilter( qint64 value, const QString &filter, bool matchBegin, bool matchEnd ); - virtual QueryMaker* excludeFilter( qint64 value, const QString &filter, bool matchBegin, bool matchEnd ); + QueryMaker* addFilter( qint64 value, const QString &filter, bool matchBegin, bool matchEnd ) override; + QueryMaker* excludeFilter( qint64 value, const QString &filter, bool matchBegin, bool matchEnd ) override; - virtual QueryMaker* addNumberFilter( qint64 value, qint64 filter, QueryMaker::NumberComparison compare ); - virtual QueryMaker* excludeNumberFilter( qint64 value, qint64 filter, QueryMaker::NumberComparison compare ); + QueryMaker* addNumberFilter( qint64 value, qint64 filter, QueryMaker::NumberComparison compare ) override; + QueryMaker* excludeNumberFilter( qint64 value, qint64 filter, QueryMaker::NumberComparison compare ) override; - virtual QueryMaker* limitMaxResultSize( int size ); + QueryMaker* limitMaxResultSize( int size ) override; - virtual QueryMaker* beginAnd(); - virtual QueryMaker* beginOr(); - virtual QueryMaker* endAndOr(); + QueryMaker* beginAnd() override; + QueryMaker* beginOr() override; + QueryMaker* endAndOr() override; - virtual QueryMaker* setAlbumQueryMode( AlbumQueryMode mode ); - virtual QueryMaker* setLabelQueryMode( LabelQueryMode mode ); + QueryMaker* setAlbumQueryMode( AlbumQueryMode mode ) override; + QueryMaker* setLabelQueryMode( LabelQueryMode mode ) override; private Q_SLOTS: void slotQueryDone(); diff --git a/src/core/collections/MetaQueryMaker.cpp b/src/core/collections/MetaQueryMaker.cpp --- a/src/core/collections/MetaQueryMaker.cpp +++ b/src/core/collections/MetaQueryMaker.cpp @@ -33,7 +33,7 @@ // actually this is wrong. We would need to combine the results // to prevent duplicate album name results. // On the other hand we need duplicate AlbumPtr results. - // Summary: be carefull when using this class. (Ralf) + // Summary: be careful when using this class. (Ralf) connect( b, &QueryMaker::newTracksReady, this, &MetaQueryMaker::newTracksReady, Qt::DirectConnection ); connect( b, &QueryMaker::newArtistsReady, this, &MetaQueryMaker::newArtistsReady, Qt::DirectConnection ); connect( b, &QueryMaker::newAlbumsReady, this, &MetaQueryMaker::newAlbumsReady, Qt::DirectConnection ); @@ -266,7 +266,7 @@ { //make sure we don't give control to code outside this class while holding the lock m_queryDoneCountMutex.unlock(); - emit queryDone(); + Q_EMIT queryDone(); } else m_queryDoneCountMutex.unlock(); diff --git a/src/core/collections/QueryMaker.h b/src/core/collections/QueryMaker.h --- a/src/core/collections/QueryMaker.h +++ b/src/core/collections/QueryMaker.h @@ -27,7 +27,7 @@ namespace Collections { -class AMAROK_CORE_EXPORT QueryMaker : public QObject +class AMAROKCORE_EXPORT QueryMaker : public QObject { Q_OBJECT @@ -81,7 +81,7 @@ }; enum QueryType { - None, // Set to faciliate using this in subclasses + None, // Set to facilitate using this in subclasses Track, Artist, Album, @@ -116,15 +116,16 @@ * * if you set QueryType custom, this starts a custom query. Unlike other query types, you have to set up the return * values yourself using addReturnValue( qint64 ) and addReturnFunction(). The results will - * be returned as a QStringList. Threfore you have to connect to the + * be returned as a QStringList. Therefore you have to connect to the * newResultReady( QStringList ) signal to receive the results. * @return this */ virtual QueryMaker* setQueryType( QueryType type ) = 0; /** * only works after starting a custom query with setQueryType( Custom ) - * Use this to inform the query maker you are looking for results of value @param value. + * Use this to inform the query maker you are looking for results of type @p value. + * @param value the type of the results * @return this */ virtual QueryMaker* addReturnValue( qint64 value ) = 0; @@ -143,11 +144,12 @@ virtual QueryMaker* addMatch( const Meta::TrackPtr &track ) = 0; /** * Match given artist. Depending on @param behaviour matches: - * track artist if TrackArtists is given, - * album artist if AlbumArtists is given, + * @p track artist if TrackArtists is given, + * @p album artist if AlbumArtists is given, * any of track or album artist if AlbumOrTrackArtists is given. * * By default matches only track artist. + * @param artist the track artist. */ virtual QueryMaker* addMatch( const Meta::ArtistPtr &artist, ArtistMatchBehaviour behaviour = TrackArtists ) = 0; virtual QueryMaker* addMatch( const Meta::AlbumPtr &album ) = 0; @@ -158,15 +160,17 @@ /** * Add a filter of type @p value and value @p filter. The querymaker applies this to all queries. - * @param text the text to match + * @param value the type of the filter + * @param filter the text to match * @param matchBegin If set then wildcard match the beginning of @p text (*text) * @param matchEnd If set then wildcard match the end of @p text (text*) * @return this */ virtual QueryMaker* addFilter( qint64 value, const QString &filter, bool matchBegin = false, bool matchEnd = false ) = 0; /** * Exclude filter of type @p value and value @p filter. The querymaker applies this to all queries. - * @param text the text to match + * @param value the type of the filter + * @param filter the text to match * @param matchBegin If set then wildcard match the beginning of @p text (*text) * @param matchEnd If set then wildcard match the end of @p text (text*) * @return this @@ -205,7 +209,7 @@ /** * Choose whether the query maker instance should delete itself after the query. * By passing true the query maker instance will delete itself after emitting queryDone(). - * Otherwise it is the responsibility of the owner (the code which called ::queryMaker() usually) to delete the instance + * Otherwise it is the responsibility of the owner (the code which called \::queryMaker() usually) to delete the instance * when it is not needed anymore. * * Defaults to false, i.e. the querymaker instance will not delete itself. @@ -221,15 +225,15 @@ * (e.g. in case when the result is received in several batches). * The results will be terminated by a queryDone signal. */ - void newResultReady( QStringList ); - void newTracksReady( Meta::TrackList ); - void newArtistsReady( Meta::ArtistList ); - void newAlbumsReady( Meta::AlbumList ); - void newGenresReady( Meta::GenreList ); - void newComposersReady( Meta::ComposerList ); - void newYearsReady( Meta::YearList ); - void newLabelsReady( Meta::LabelList ); - void newDataReady( Meta::DataList ); + void newResultReady( const QStringList &); + void newTracksReady( const Meta::TrackList &); + void newArtistsReady( const Meta::ArtistList &); + void newAlbumsReady( const Meta::AlbumList &); + void newGenresReady( const Meta::GenreList &); + void newComposersReady( const Meta::ComposerList &); + void newYearsReady( const Meta::YearList &); + void newLabelsReady( const Meta::LabelList &); + void newDataReady( const Meta::DataList &); /** * This signal is emitted after all the results have been submitted via zero or more newResultReady signals. diff --git a/src/core/collections/support/TrackForUrlWorker.h b/src/core/collections/support/TrackForUrlWorker.h --- a/src/core/collections/support/TrackForUrlWorker.h +++ b/src/core/collections/support/TrackForUrlWorker.h @@ -31,15 +31,15 @@ * Derive from this class and implement the run() method to set mTrack. * @author Casey Link */ -class AMAROK_CORE_EXPORT TrackForUrlWorker : public QObject, public ThreadWeaver::Job +class AMAROKCORE_EXPORT TrackForUrlWorker : public QObject, public ThreadWeaver::Job { Q_OBJECT public: - TrackForUrlWorker( const QUrl &url ); - TrackForUrlWorker( const QString &url ); - ~TrackForUrlWorker(); + explicit TrackForUrlWorker( const QUrl &url ); + explicit TrackForUrlWorker( const QString &url ); + ~TrackForUrlWorker() override; - virtual void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) = 0 ; + void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = nullptr) override = 0; Q_SIGNALS: void finishedLookup( const Meta::TrackPtr &track ); diff --git a/src/core/collections/support/TrackForUrlWorker.cpp b/src/core/collections/support/TrackForUrlWorker.cpp --- a/src/core/collections/support/TrackForUrlWorker.cpp +++ b/src/core/collections/support/TrackForUrlWorker.cpp @@ -40,6 +40,6 @@ void Amarok::TrackForUrlWorker::completeJob() { - emit finishedLookup( m_track ); + Q_EMIT finishedLookup( m_track ); // deleteLater(); } diff --git a/src/core/interfaces/Logger.h b/src/core/interfaces/Logger.h deleted file mode 100644 --- a/src/core/interfaces/Logger.h +++ /dev/null @@ -1,112 +0,0 @@ -/**************************************************************************************** - * Copyright (c) 2010 Maximilian Kossick * - * * - * This program is free software; you can redistribute it and/or modify it under * - * the terms of the GNU General Public License as published by the Free Software * - * Foundation; either version 2 of the License, or (at your option) any later * - * version. * - * * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY * - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * - * PARTICULAR PURPOSE. See the GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License along with * - * this program. If not, see . * - ****************************************************************************************/ - -#ifndef AMAROK_LOGGER_H -#define AMAROK_LOGGER_H - -#include "core/amarokcore_export.h" - -#include -#include - -class KJob; -class QNetworkReply; - -namespace Amarok -{ - /** - * This interface provides methods that allow backend components to notify the user. - * Users of this class may not make assumptions about the kind of notifications that - * will be sent to the user. - * - * The class name is up for discussion btw. - */ - class AMAROK_CORE_EXPORT Logger - { - public: - - enum MessageType { Information, Warning, Error }; - - Logger() {} - virtual ~Logger() {} - - public Q_SLOTS: - - /** - * Informs the user about the progress of a job, i.e. a download job. - * At the very least, the user is notified about the start and end of the job. - * - * @param job The job whose progress should be monitored - * @param text An additional text that will be part of the notification - * @param obj The object that will be called if the user cancels the job. If not set, the job will not be cancellable - * @param slot The slot on the given object that will be called if the user cancels the job. No slot will be called if not set. - * The signal will be emitted from the GUI thread. The receiver may not make assumptions about the sender - * @param type The Qt connection type to use for the connection to the receiving slot. Defaults to Qt::AutoConnection - */ - virtual void newProgressOperation( KJob *job, const QString &text, QObject *obj = 0, const char *slot = 0, Qt::ConnectionType type = Qt::AutoConnection ) = 0; - - /** - * Informs the user about the progress of a network request. - * At the very least, the user is notified about the start and end of the request. - * - * @param reply The network reply object whose progress should be monitored - * @param text An additional text that will be part of the notification - * @param obj The object that will be called if the user cancels the network request. If not set, the progress will not be cancellable - * @param slot The slot on the given object that will be called if the user cancels the network request. No slot will be called if not set. - * The signal will be emitted from the GUI thread. The receiver may not make assumptions about the sender - * @param type The Qt connection type to use for the connection to the receiving slot. Defaults to Qt::AutoConnection - */ - virtual void newProgressOperation( QNetworkReply *reply, const QString &text, QObject *obj = 0, const char *slot = 0, Qt::ConnectionType type = Qt::AutoConnection ) = 0; - - /** - * Informs the user about the progress of a generic QObject - * - * @param sender The object sending the required signals. This sender must emit singals - * incrementProgress() and endProgressOperation() and optionally totalSteps(). - * @param text An additional text that will be part of the notification - * @param maximum The maximum value of the progress operation - * @param obj The object that will be called if the user cancels the network request. If not - * set, the progress will not be cancellable - * @param slot The slot on the given object that will be called if the user cancels the - * network request. No slot will be called if not set. - * The signal will be emitted from the GUI thread. The receiver may not make assumptions - * about the sender - * @param type The Qt connection type to use for the connection to the receiving slot. - * Defaults to Qt::AutoConnection - */ - virtual void newProgressOperation( QObject *sender, const QString &text, int maximum = 100, - QObject *obj = 0, const char *slot = 0, - Qt::ConnectionType type = Qt::AutoConnection ) = 0; - - /** - * Sends a notification to the user. - * This method will send a notification containing the given text to the user. - * - * @param text The text that the notification will contain - */ - virtual void shortMessage( const QString &text ) = 0; - - /** - * Send a notification to the user with an additional context. - * A notification will be send to the user containing the given text. Additionally, it will convey the context given by @p type. - * @param text The text that the notification will contain - * @param type The context of the notification - */ - virtual void longMessage( const QString &text, MessageType type = Information ) = 0; - }; -} - -#endif diff --git a/src/core/interfaces/Logger.cpp b/src/core/interfaces/Logger.cpp deleted file mode 100644 --- a/src/core/interfaces/Logger.cpp +++ /dev/null @@ -1,17 +0,0 @@ -/**************************************************************************************** - * Copyright (c) 2010 Maximilian Kossick * - * * - * This program is free software; you can redistribute it and/or modify it under * - * the terms of the GNU General Public License as published by the Free Software * - * Foundation; either version 2 of the License, or (at your option) any later * - * version. * - * * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY * - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * - * PARTICULAR PURPOSE. See the GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License along with * - * this program. If not, see . * - ****************************************************************************************/ - -#include "Logger.h" diff --git a/src/core/interfaces/MetaCapability.h b/src/core/interfaces/MetaCapability.h --- a/src/core/interfaces/MetaCapability.h +++ b/src/core/interfaces/MetaCapability.h @@ -20,13 +20,13 @@ #include "core/capabilities/Capability.h" #include "core/amarokcore_export.h" -class AMAROK_CORE_EXPORT MetaCapability +class AMAROKCORE_EXPORT MetaCapability { public: virtual ~MetaCapability() {} /** - * Return true if this entity has capability @param CapIface, false otherwise. + * Return true if this entity has capability @c CapIface, false otherwise. */ template bool has() const { diff --git a/src/core/logger/Logger.h b/src/core/logger/Logger.h new file mode 100644 --- /dev/null +++ b/src/core/logger/Logger.h @@ -0,0 +1,233 @@ +/**************************************************************************************** + * Copyright (c) 2010 Maximilian Kossick * + * * + * This program is free software; you can redistribute it and/or modify it under * + * the terms of the GNU General Public License as published by the Free Software * + * Foundation; either version 2 of the License, or (at your option) any later * + * version. * + * * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY * + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * + * PARTICULAR PURPOSE. See the GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License along with * + * this program. If not, see . * + ****************************************************************************************/ + +#ifndef AMAROK_LOGGER_H +#define AMAROK_LOGGER_H + +#include "core/amarokcore_export.h" + +#include +#include +#include + +#include + + +class KJob; +class QNetworkReply; +struct ShortMessage; +struct LongMessage; +struct ProgressData; + +namespace Amarok +{ + /** + * This class provides methods that allow backend components to notify the user. + * Users of this class may not make assumptions about the kind of notifications that + * will be sent to the user. + * + * The class name is up for discussion btw. + */ + class AMAROKCORE_EXPORT Logger + { + public: + enum MessageType { Information, Warning, Error }; + + Logger(); + virtual ~Logger(); + + /** + * Informs the user about the progress of a job, i.e. a download job. + * At the very least, the user is notified about the start and end of the job. + * + * @param job The job whose progress should be monitored + * @param text An additional text that will be part of the notification + * @param obj The object that will be called if the user cancels the job. If not set, the job will not be cancellable + * @param slot The slot on the given object that will be called if the user cancels the job. No slot will be called if not set. + * The signal will be emitted from the GUI thread. The receiver may not make assumptions about the sender + * @param type The Qt connection type to use for the connection to the receiving slot. Defaults to Qt::AutoConnection + */ + template + static void newProgressOperation( KJob *job, const QString &text, Object *obj = nullptr, Func slot = nullptr, Qt::ConnectionType type = Qt::AutoConnection ) + { + if( !job ) + return; + + std::function function = std::bind( slot, obj ); + addProgressOperation( job, nullptr, nullptr, QMetaMethod(), QMetaMethod(), text, 100, obj, obj ? function : nullptr, type ); + } + + /** + * Informs the user about the progress of a job, i.e. a download job. + * At the very least, the user is notified about the start and end of the job. + * + * @param job The job whose progress should be monitored + * @param text An additional text that will be part of the notification + * @param obj The object that will be called if the user cancels the job. + * @param slot The slot on the given object that will be called if the user cancels the job. + * The signal will be emitted from the GUI thread. The receiver may not make assumptions about the sender + * @param type The Qt connection type to use for the connection to the receiving slot. + * @param args Arguments given to the slot. + */ + template + static void newProgressOperation( KJob *job, const QString &text, Object *obj, Func slot, Qt::ConnectionType type, FuncArgs... args ) + { + if( !job ) + return; + + std::function function = std::bind( slot, obj, args... ); + addProgressOperation( job, nullptr, nullptr, QMetaMethod(), QMetaMethod(), text, 100, obj, obj ? function : nullptr, type ); + } + + /** + * Informs the user about the progress of a network request. + * At the very least, the user is notified about the start and end of the request. + * + * @param reply The network reply object whose progress should be monitored + * @param text An additional text that will be part of the notification + * @param obj The object that will be called if the user cancels the network request. If not set, the progress will not be cancellable + * @param slot The slot on the given object that will be called if the user cancels the network request. No slot will be called if not set. + * The signal will be emitted from the GUI thread. The receiver may not make assumptions about the sender + * @param type The Qt connection type to use for the connection to the receiving slot. Defaults to Qt::AutoConnection + */ + template + static void newProgressOperation( QNetworkReply *reply, const QString &text, Object *obj = nullptr, Func slot = nullptr, Qt::ConnectionType type = Qt::AutoConnection ) + { + if( !reply ) + return; + + std::function function = std::bind( slot, obj ); + addProgressOperation( nullptr, reply, nullptr, QMetaMethod(), QMetaMethod(), text, 100, obj, obj ? function : nullptr, type ); + } + + /** + * Informs the user about the progress of a network request. + * At the very least, the user is notified about the start and end of the request. + * + * @param reply The network reply object whose progress should be monitored + * @param text An additional text that will be part of the notification + * @param obj The object that will be called if the user cancels the network request. + * @param slot The slot on the given object that will be called if the user cancels the network request. + * The signal will be emitted from the GUI thread. The receiver may not make assumptions about the sender + * @param type The Qt connection type to use for the connection to the receiving slot. + * @param args Arguments given to the slot. + */ + template + static void newProgressOperation( QNetworkReply *reply, const QString &text, Object *obj, Func slot, Qt::ConnectionType type, FuncArgs... args ) + { + if( !reply ) + return; + + std::function function = std::bind( slot, obj, args... ); + addProgressOperation( nullptr, reply, nullptr, QMetaMethod(), QMetaMethod(), text, 100, obj, obj ? function : nullptr, type ); + } + + /** + * Informs the user about the progress of a generic QObject + * + * @param sender The object sending the required signals. This sender must Q_EMIT signals + * incrementProgress() and endProgressOperation() and optionally totalSteps(). + * @param text An additional text that will be part of the notification + * @param maximum The maximum value of the progress operation + * @param obj The object that will be called if the user cancels the network request. If not + * set, the progress will not be cancellable + * @param slot The slot on the given object that will be called if the user cancels the + * network request. No slot will be called if not set. + * The signal will be emitted from the GUI thread. The receiver may not make assumptions + * about the sender + * @param type The Qt connection type to use for the connection to the receiving slot. + * Defaults to Qt::AutoConnection + */ + template + static typename std::enable_if::value && !std::is_convertible::value && std::is_convertible::value>::type + newProgressOperation( Sender *sender, const QString &text, int maximum = 100, Object *obj = nullptr, Func slot = nullptr, Qt::ConnectionType type = Qt::AutoConnection) + { + if( !sender ) + return; + + auto increment = QMetaMethod::fromSignal( &Sender::incrementProgress ); + auto end = QMetaMethod::fromSignal( &Sender::endProgressOperation ); + std::function function = std::bind( slot, obj ); + addProgressOperation( nullptr, nullptr, sender, increment, end, text, maximum, obj, obj ? function : nullptr, type ); + } + + /** + * Informs the user about the progress of a generic QObject + * + * @param sender The object sending the required signals. This sender must Q_EMIT signals + * incrementProgress() and endProgressOperation() and optionally totalSteps(). + * @param text An additional text that will be part of the notification + * @param maximum The maximum value of the progress operation + * @param obj The object that will be called if the user cancels the network request. + * @param slot The slot on the given object that will be called if the user cancels the + * network request. + * The signal will be emitted from the GUI thread. The receiver may not make assumptions + * about the sender + * @param type The Qt connection type to use for the connection to the receiving slot. + * @param args Arguments given to the slot. + */ + template + static typename std::enable_if::value && !std::is_convertible::value && std::is_convertible::value>::type + newProgressOperation( Sender *sender, const QString &text, int maximum, Object *obj, Func slot, Qt::ConnectionType type, FuncArgs... args ) + { + if( !sender ) + return; + + auto increment = QMetaMethod::fromSignal( &Sender::incrementProgress ); + auto end = QMetaMethod::fromSignal( &Sender::endProgressOperation ); + std::function function = std::bind( slot, obj, args... ); + addProgressOperation( nullptr, nullptr, sender, increment, end, text, maximum, obj, obj ? function : nullptr, type ); + } + + /** + * Sends a notification to the user. + * This method will send a notification containing the given text to the user. + * + * @param text The text that the notification will contain + */ + static void shortMessage( const QString &text ); + + /** + * Send a notification to the user with an additional context. + * A notification will be send to the user containing the given text. Additionally, it will convey the context given by @p type. + * @param text The text that the notification will contain + * @param type The context of the notification + */ + static void longMessage( const QString &text, MessageType type = Information ); + + protected: + virtual void newProgressOperationImpl( KJob *job, const QString &text, QObject *context, const std::function &function, Qt::ConnectionType type ) = 0; + virtual void newProgressOperationImpl( QNetworkReply *reply, const QString &text, QObject *context, const std::function &function, Qt::ConnectionType type ) = 0; + virtual void newProgressOperationImpl( QObject *sender, const QMetaMethod &increment, const QMetaMethod &end, const QString &text, + int maximum, QObject *context, const std::function &function, Qt::ConnectionType type ) = 0; + virtual void longMessageImpl( const QString &text, MessageType type = Information ) = 0; + virtual void shortMessageImpl( const QString &text ) = 0; + + private: + static void addProgressOperation(KJob *job = nullptr, QNetworkReply *reply = nullptr, QObject *sender = nullptr, QMetaMethod increment = QMetaMethod(), + const QMetaMethod &end = QMetaMethod(), const QString &text = QString(), int maximum = 100, QObject *context = nullptr, + const std::function &function = nullptr, Qt::ConnectionType type = Qt::AutoConnection ); + void loadExistingMessages(); + + static QMutex s_mutex; + static QList s_loggers; + static QList s_shortMessageList; + static QList s_longMessageList; + static QList s_progressList; + }; +} + +#endif diff --git a/src/core/logger/Logger.cpp b/src/core/logger/Logger.cpp new file mode 100644 --- /dev/null +++ b/src/core/logger/Logger.cpp @@ -0,0 +1,186 @@ +/**************************************************************************************** + * Copyright (c) 2010 Maximilian Kossick * + * * + * This program is free software; you can redistribute it and/or modify it under * + * the terms of the GNU General Public License as published by the Free Software * + * Foundation; either version 2 of the License, or (at your option) any later * + * version. * + * * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY * + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * + * PARTICULAR PURPOSE. See the GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License along with * + * this program. If not, see . * + ****************************************************************************************/ + +#include "Logger.h" + +#include +#include +#include + +#include + + +// Durations for which messages are being saved. +#define SHORT_MESSAGE_DURATION 10000 +#define LONG_MESSAGE_DURATION 10000 + +struct LongMessage +{ + QString text; + Amarok::Logger::MessageType type; +}; + +struct ProgressData +{ + QPointer sender; + QMetaMethod increment; + QMetaMethod end; + QPointer job; + QPointer reply; + QString text; + int maximum; + QPointer cancelObject; + std::function function; + Qt::ConnectionType type; + + bool operator==( const ProgressData &other ) + { + return sender == other.sender && + job == other.job && + reply == other.reply && + increment == other.increment && + end == other.end && + text == other.text && + maximum == other.maximum && + cancelObject == other.cancelObject && + function.target_type() == other.function.target_type() && + type == other.type; + } +}; + +QMutex Amarok::Logger::s_mutex; +QList Amarok::Logger::s_loggers; +QList Amarok::Logger::s_shortMessageList; +QList Amarok::Logger::s_longMessageList; +QList Amarok::Logger::s_progressList; + +Amarok::Logger::Logger() +{ + QMutexLocker locker( &s_mutex ); + s_loggers << this; + + QTimer::singleShot( 0, [this] () { this->loadExistingMessages(); } ); +} + +Amarok::Logger::~Logger() +{ + QMutexLocker locker( &s_mutex ); + s_loggers.removeAll( this ); +} + +void Amarok::Logger::addProgressOperation( KJob* job, QNetworkReply* reply, QObject* sender, QMetaMethod increment, const QMetaMethod& end, + const QString& text, int maximum, QObject* context, const std::function& function, Qt::ConnectionType type ) +{ + ProgressData data; + data.sender = sender; + data.job = job; + data.reply = reply; + data.increment = increment; + data.end = end; + data.text = text; + data.maximum = maximum; + data.cancelObject = context; + data.function = function; + data.type = type; + + QMutexLocker locker( &s_mutex ); + s_progressList << data; + + auto removeFunction = [data] () { + QMutexLocker locker( &s_mutex ); + s_progressList.removeAll( data ); + }; + + if( job ) + { + QObject::connect( job, &QObject::destroyed, removeFunction ); + for( const auto &logger : s_loggers ) + logger->newProgressOperationImpl( job, text, context, function, type ); + } + else if( reply ) + { + QObject::connect( reply, &QObject::destroyed, removeFunction ); + for( const auto &logger : s_loggers ) + logger->newProgressOperationImpl( reply, text, context, function, type ); + } + else if( sender ) + { + QObject::connect( sender, &QObject::destroyed, removeFunction ); + for( const auto &logger : s_loggers ) + logger->newProgressOperationImpl( sender, increment, end, text, maximum, context, function, type ); + } +} + +void Amarok::Logger::shortMessage( const QString& text ) +{ + if( text.isEmpty() ) + return; + + QMutexLocker locker( &s_mutex ); + s_shortMessageList << text; + + for( const auto &logger : s_loggers ) + logger->shortMessageImpl( text ); + + auto removeFunction = [text] () { + QMutexLocker locker( &s_mutex ); + s_shortMessageList.removeAll( text ); + }; + + QTimer::singleShot( SHORT_MESSAGE_DURATION, removeFunction ); +} + +void Amarok::Logger::longMessage( const QString& text, Amarok::Logger::MessageType type ) +{ + if( text.isEmpty() ) + return; + + LongMessage message; + message.text = text; + message.type = type; + QMutexLocker locker( &s_mutex ); + s_longMessageList << message; + + for( const auto &logger : s_loggers ) + logger->longMessageImpl( text, type ); + + auto removeFunction = [text] () { + QMutexLocker locker( &s_mutex ); + s_shortMessageList.removeAll( text ); + }; + + QTimer::singleShot( LONG_MESSAGE_DURATION, removeFunction ); +} + +void Amarok::Logger::loadExistingMessages() +{ + QMutexLocker locker( &s_mutex ); + for( const auto &data : s_progressList ) + { + if( data.job ) + newProgressOperationImpl( data.job, data.text, data.cancelObject, data.function, data.type ); + else if( data.reply ) + newProgressOperationImpl( data.reply, data.text, data.cancelObject, data.function, data.type ); + else if( data.sender ) + newProgressOperationImpl( data.sender, data.increment, data.end, data.text, data.maximum, data.cancelObject, data.function, data.type ); + } + + for( const auto &data : s_shortMessageList ) + shortMessageImpl( data ); + + for( const auto &data : s_longMessageList ) + longMessageImpl( data.text, data.type ); +} diff --git a/src/core/meta/Base.h b/src/core/meta/Base.h --- a/src/core/meta/Base.h +++ b/src/core/meta/Base.h @@ -31,7 +31,7 @@ namespace Meta { class Observer; - class AMAROK_CORE_EXPORT Base : public virtual QSharedData, public MetaCapability + class AMAROKCORE_EXPORT Base : public virtual QSharedData, public MetaCapability // virtual inherit. so that implementations can be both Meta::Track and Meta::Statistics { public: @@ -52,7 +52,7 @@ * We will try to prevent this name from being empty. E.g. a track will fall * back to the filename if possible. */ - virtual QString prettyName() const { return name(); }; + virtual QString prettyName() const { return name(); } /** * A name that can be used for sorting. @@ -63,7 +63,7 @@ protected: /** - * Helper so that notifyObservers() implemetation can be shared. Template + * Helper so that notifyObservers() implementation can be shared. Template * parameter Obs is just Observer, we add it so that Observer.h doesn't need * to be included in this header. */ @@ -84,7 +84,7 @@ /** * Unsubscribe @param observer from change updates. Don't ever think of - * calling this method yourself or overriging it, it's highly coupled with + * calling this method yourself or overriding it, it's highly coupled with * Observer. */ void unsubscribe( Observer *observer ); @@ -103,7 +103,7 @@ QWriteLocker locker( &m_observersLock ); foreach( Obs *observer, m_observers ) { - // observers can potentially remove or even destory other observers during + // observers can potentially remove or even destroy other observers during // metadataChanged() call. Guard against it. The guarding doesn't need to be // thread-safe, because we already hold m_observersLock (which is recursive), // so other threads wait on potential unsubscribe(). @@ -116,6 +116,6 @@ Q_DECLARE_METATYPE( Meta::DataPtr ) Q_DECLARE_METATYPE( Meta::DataList ) -AMAROK_CORE_EXPORT QDebug operator<<( QDebug dbg, const Meta::Base &base ); +AMAROKCORE_EXPORT QDebug operator<<( QDebug dbg, const Meta::Base &base ); #endif // META_BASE_H diff --git a/src/core/meta/Meta.h b/src/core/meta/Meta.h --- a/src/core/meta/Meta.h +++ b/src/core/meta/Meta.h @@ -32,17 +32,16 @@ namespace Collections { class Collection; - class QueryMaker; } class PersistentStatisticsStore; namespace Meta { - class AMAROK_CORE_EXPORT Track : public Base + class AMAROKCORE_EXPORT Track : public Base { public: /** used to display the trackname, should never be empty, returns prettyUrl() by default if name() is empty */ - virtual QString prettyName() const; + QString prettyName() const override; /** an url which can be played by the engine backends */ virtual QUrl playableUrl() const = 0; /** an url for display purposes */ @@ -175,7 +174,7 @@ * Return a pointer to TrackEditor interface that allows you to edit metadata * of this track. May be null, which signifies that the track is not editable. * - * This is a replacement to ::create() with more + * This is a replacement to \::create() with more * well-defined memory management and nicer implementation possibilities. * (multiple inheritance and returning self) * @@ -210,17 +209,17 @@ QString localFileNotPlayableReason( const QString &path ) const; }; - class AMAROK_CORE_EXPORT Artist : public Base + class AMAROKCORE_EXPORT Artist : public Base { public: - virtual QString prettyName() const; + QString prettyName() const override; /** returns all tracks by this artist */ virtual TrackList tracks() = 0; virtual bool operator==( const Meta::Artist &artist ) const; - virtual QString sortableName() const; + QString sortableName() const override; protected: virtual void notifyObservers() const; @@ -245,18 +244,18 @@ * with an artist should contain all singles of the specific artist. There should * be one album without title and artist for all the rest. */ - class AMAROK_CORE_EXPORT Album : public Base + class AMAROKCORE_EXPORT Album : public Base { public: - virtual QString prettyName() const; + QString prettyName() const override; /** * Whether this album is considered to be a compilation of tracks from various * artists. */ virtual bool isCompilation() const = 0; /** - * Whether toggling the compilation status is currenlty supported. Default + * Whether toggling the compilation status is currently supported. Default * implementation returns false. */ virtual bool canUpdateCompilation() const { return false; } @@ -315,10 +314,10 @@ virtual void notifyObservers() const; }; - class AMAROK_CORE_EXPORT Composer : public Base + class AMAROKCORE_EXPORT Composer : public Base { public: - virtual QString prettyName() const; + QString prettyName() const override; /** returns all tracks by this composer */ virtual TrackList tracks() = 0; @@ -329,10 +328,10 @@ virtual void notifyObservers() const; }; - class AMAROK_CORE_EXPORT Genre : public Base + class AMAROKCORE_EXPORT Genre : public Base { public: - virtual QString prettyName() const; + QString prettyName() const override; /** returns all tracks which belong to the genre */ virtual TrackList tracks() = 0; @@ -343,7 +342,7 @@ virtual void notifyObservers() const; }; - class AMAROK_CORE_EXPORT Year : public Base + class AMAROKCORE_EXPORT Year : public Base { public: /** @@ -364,7 +363,7 @@ /** * A Label represents an arbitrary classification of a Track. */ - class AMAROK_CORE_EXPORT Label : public Base + class AMAROKCORE_EXPORT Label : public Base { // we need nothing more than what Meta::Base has }; diff --git a/src/core/meta/Meta.cpp b/src/core/meta/Meta.cpp --- a/src/core/meta/Meta.cpp +++ b/src/core/meta/Meta.cpp @@ -277,13 +277,13 @@ { QStringRef article = n.leftRef( 3 ); QStringRef subject = n.midRef( 4 ); - m_sortableName = QString( "%1, %2" ).arg( subject.toString(), article.toString() ); + m_sortableName = QStringLiteral( "%1, %2" ).arg( subject.toString(), article.toString() ); } else if( n.startsWith( QLatin1String("dj "), Qt::CaseInsensitive ) ) { QStringRef article = n.leftRef( 2 ); QStringRef subject = n.midRef( 3 ); - m_sortableName = QString( "%1, %2" ).arg( subject.toString(), article.toString() ); + m_sortableName = QStringLiteral( "%1, %2" ).arg( subject.toString(), article.toString() ); } else m_sortableName = n; diff --git a/src/core/meta/Observer.h b/src/core/meta/Observer.h --- a/src/core/meta/Observer.h +++ b/src/core/meta/Observer.h @@ -32,23 +32,23 @@ * Subclass this class to be able to listen to changes of track, artist, album, genre, * composer and year metadata. Must useful just for tracks and albums though. * - * If you want to everride just one metadataChanged() and want to get rid of "method + * If you want to override just one metadataChanged() and want to get rid of "method * hidden compiler warnings", use following pattern in your class declaration: * * using Observer::metadataChanged; * void metadataChanged( AlbumPtr album ); * * This class is thread-safe. */ - class AMAROK_CORE_EXPORT Observer + class AMAROKCORE_EXPORT Observer { friend class Base; // so that it can call destroyedNotify() public: virtual ~Observer(); /** - * Subscribe to changes made by @param entity. + * Subscribe to changes made by @param entity . * * Changed in 2.7: being subscribed to an entity no longer prevents its * destruction. @@ -62,12 +62,12 @@ * This method is called when the metadata of a track has changed. * The called class may not cache the pointer. */ - virtual void metadataChanged( TrackPtr track ); - virtual void metadataChanged( ArtistPtr artist ); - virtual void metadataChanged( AlbumPtr album ); - virtual void metadataChanged( GenrePtr genre ); - virtual void metadataChanged( ComposerPtr composer ); - virtual void metadataChanged( YearPtr year ); + virtual void metadataChanged( const TrackPtr &track ); + virtual void metadataChanged( const ArtistPtr &artist ); + virtual void metadataChanged( const AlbumPtr &album ); + virtual void metadataChanged( const GenrePtr &genre ); + virtual void metadataChanged( const ComposerPtr &composer ); + virtual void metadataChanged( const YearPtr &year ); /** * One of the subscribed entities was destroyed. You don't get which one diff --git a/src/core/meta/Observer.cpp b/src/core/meta/Observer.cpp --- a/src/core/meta/Observer.cpp +++ b/src/core/meta/Observer.cpp @@ -33,37 +33,37 @@ } void -Observer::metadataChanged( TrackPtr track ) +Observer::metadataChanged( const TrackPtr &track ) { Q_UNUSED( track ); } void -Observer::metadataChanged( ArtistPtr artist ) +Observer::metadataChanged( const ArtistPtr &artist ) { Q_UNUSED( artist ); } void -Observer::metadataChanged( AlbumPtr album ) +Observer::metadataChanged( const AlbumPtr &album ) { Q_UNUSED( album ); } void -Observer::metadataChanged( ComposerPtr composer ) +Observer::metadataChanged( const ComposerPtr &composer ) { Q_UNUSED( composer ); } void -Observer::metadataChanged( GenrePtr genre ) +Observer::metadataChanged( const GenrePtr &genre ) { Q_UNUSED( genre ); } void -Observer::metadataChanged( YearPtr year ) +Observer::metadataChanged( const YearPtr &year ) { Q_UNUSED( year ); } diff --git a/src/core/meta/Statistics.h b/src/core/meta/Statistics.h --- a/src/core/meta/Statistics.h +++ b/src/core/meta/Statistics.h @@ -35,7 +35,7 @@ * thread-safe -- if you return same instance of Statistics every time then it means * that even the instance must be thread-safe. */ - class AMAROK_CORE_EXPORT Statistics : public virtual QSharedData // virtual inheritance + class AMAROKCORE_EXPORT Statistics : public virtual QSharedData // virtual inheritance // so that Track implementations can inherit both Meta::Track and Meta::Statistics { public: diff --git a/src/core/meta/TrackEditor.h b/src/core/meta/TrackEditor.h --- a/src/core/meta/TrackEditor.h +++ b/src/core/meta/TrackEditor.h @@ -36,7 +36,7 @@ * be thread-safe -- if you return same instance of TrackEditor every time then it * means that even the instance must be thread-safe. */ - class AMAROK_CORE_EXPORT TrackEditor : public virtual QSharedData // virtual inheritance + class AMAROKCORE_EXPORT TrackEditor : public virtual QSharedData // virtual inheritance // so that Track implementations can inherit both Meta::Track and Meta::TrackEditor { public: diff --git a/src/core/meta/support/MetaConstants.h b/src/core/meta/support/MetaConstants.h --- a/src/core/meta/support/MetaConstants.h +++ b/src/core/meta/support/MetaConstants.h @@ -28,41 +28,41 @@ /** Returns a textual identification for the given field. This name can be used e.g. for identifying the field in a xml file. */ - AMAROK_CORE_EXPORT QString nameForField( qint64 field ); + AMAROKCORE_EXPORT QString nameForField( qint64 field ); /** The inverse of nameForField */ - AMAROK_CORE_EXPORT qint64 fieldForName( const QString &name ); + AMAROKCORE_EXPORT qint64 fieldForName( const QString &name ); /** Returns a localized name for the given field. */ - AMAROK_CORE_EXPORT QString i18nForField( qint64 field ); + AMAROKCORE_EXPORT QString i18nForField( qint64 field ); /** Returns a short localized name for the given field. The short form is only one word and is used for the collection filter. - e.g. the "added to collecition" is just "added" + e.g. the "added to collection" is just "added" */ - AMAROK_CORE_EXPORT QString shortI18nForField( qint64 field ); + AMAROKCORE_EXPORT QString shortI18nForField( qint64 field ); /** Returns a textual identification for the given field. This name is used in the playlist generator and is slightly different from the one in nameForField */ - AMAROK_CORE_EXPORT QString playlistNameForField( qint64 field ); + AMAROKCORE_EXPORT QString playlistNameForField( qint64 field ); /** The inverse of playlistNameForField */ - AMAROK_CORE_EXPORT qint64 fieldForPlaylistName( const QString &name ); + AMAROKCORE_EXPORT qint64 fieldForPlaylistName( const QString &name ); /** Returns the name of the icon representing the field. May return an empty string if no such icon exists. Create the icon with QIcon::fromTheme(iconForField(field)) */ - AMAROK_CORE_EXPORT QString iconForField( qint64 field ); + AMAROKCORE_EXPORT QString iconForField( qint64 field ); /** Returns the value for the given field. */ - AMAROK_CORE_EXPORT QVariant valueForField( qint64 field, TrackPtr track ); + AMAROKCORE_EXPORT QVariant valueForField( qint64 field, TrackPtr track ); /** * The Field variables. Please note that these constants are considered deprecated. @@ -72,38 +72,38 @@ namespace Field { //actual string values are not final yet - static const QString ALBUM = "xesam:album"; - static const QString ARTIST = "xesam:author"; - static const QString BITRATE = "xesam:audioBitrate"; - static const QString BPM = "xesam:audioBPM"; - static const QString CODEC = "xesam:audioCodec"; - static const QString COMMENT = "xesam:comment"; - static const QString COMPOSER = "xesam:composer"; - static const QString DISCNUMBER = "xesam:discNumber"; - static const QString FILESIZE = "xesam:size"; - static const QString GENRE = "xesam:genre"; - static const QString LENGTH = "xesam:mediaDuration"; - static const QString RATING = "xesam:userRating"; - static const QString SAMPLERATE = "xesam:audioSampleRate"; - static const QString TITLE = "xesam:title"; - static const QString TRACKNUMBER = "xesam:trackNumber"; - static const QString URL = "xesam:url"; - static const QString YEAR = "xesam:contentCreated"; - static const QString ALBUMARTIST = "xesam:albumArtist"; - static const QString ALBUMGAIN = "xesam:albumGain"; - static const QString ALBUMPEAKGAIN = "xesam:albumPeakGain"; - static const QString TRACKGAIN = "xesam:trackGain"; - static const QString TRACKPEAKGAIN = "xesam:trackPeakGain"; - - static const QString SCORE = "xesam:autoRating"; - static const QString PLAYCOUNT = "xesam:useCount"; - static const QString FIRST_PLAYED = "xesam:firstUsed"; - static const QString LAST_PLAYED = "xesam:lastUsed"; - - static const QString UNIQUEID = "xesam:id"; + static const QString ALBUM = QStringLiteral("xesam:album"); + static const QString ARTIST = QStringLiteral("xesam:author"); + static const QString BITRATE = QStringLiteral("xesam:audioBitrate"); + static const QString BPM = QStringLiteral("xesam:audioBPM"); + static const QString CODEC = QStringLiteral("xesam:audioCodec"); + static const QString COMMENT = QStringLiteral("xesam:comment"); + static const QString COMPOSER = QStringLiteral("xesam:composer"); + static const QString DISCNUMBER = QStringLiteral("xesam:discNumber"); + static const QString FILESIZE = QStringLiteral("xesam:size"); + static const QString GENRE = QStringLiteral("xesam:genre"); + static const QString LENGTH = QStringLiteral("xesam:mediaDuration"); + static const QString RATING = QStringLiteral("xesam:userRating"); + static const QString SAMPLERATE = QStringLiteral("xesam:audioSampleRate"); + static const QString TITLE = QStringLiteral("xesam:title"); + static const QString TRACKNUMBER = QStringLiteral("xesam:trackNumber"); + static const QString URL = QStringLiteral("xesam:url"); + static const QString YEAR = QStringLiteral("xesam:contentCreated"); + static const QString ALBUMARTIST = QStringLiteral("xesam:albumArtist"); + static const QString ALBUMGAIN = QStringLiteral("xesam:albumGain"); + static const QString ALBUMPEAKGAIN = QStringLiteral("xesam:albumPeakGain"); + static const QString TRACKGAIN = QStringLiteral("xesam:trackGain"); + static const QString TRACKPEAKGAIN = QStringLiteral("xesam:trackPeakGain"); + + static const QString SCORE = QStringLiteral("xesam:autoRating"); + static const QString PLAYCOUNT = QStringLiteral("xesam:useCount"); + static const QString FIRST_PLAYED = QStringLiteral("xesam:firstUsed"); + static const QString LAST_PLAYED = QStringLiteral("xesam:lastUsed"); + + static const QString UNIQUEID = QStringLiteral("xesam:id"); // new - static const QString COMPILATION = "xesam:compilation"; + static const QString COMPILATION = QStringLiteral("xesam:compilation"); } } diff --git a/src/core/meta/support/MetaConstants.cpp b/src/core/meta/support/MetaConstants.cpp --- a/src/core/meta/support/MetaConstants.cpp +++ b/src/core/meta/support/MetaConstants.cpp @@ -28,145 +28,145 @@ { switch( field ) { - case 0: return "anything"; - case Meta::valUrl: return "filename"; - case Meta::valTitle: return "title"; - case Meta::valArtist: return "artist"; - case Meta::valAlbum: return "album"; - case Meta::valGenre: return "genre"; - case Meta::valComposer: return "composer"; - case Meta::valYear: return "year"; - case Meta::valComment: return "comment"; - case Meta::valTrackNr: return "tracknr"; - case Meta::valDiscNr: return "discnumber"; - case Meta::valBpm: return "bpm"; - case Meta::valLength: return "length"; - case Meta::valBitrate: return "bitrate"; - case Meta::valSamplerate: return "samplerate"; - case Meta::valFilesize: return "filesize"; - case Meta::valFormat: return "format"; - case Meta::valCreateDate: return "added"; - case Meta::valScore: return "score"; - case Meta::valRating: return "rating"; - case Meta::valFirstPlayed: return "firstplay"; - case Meta::valLastPlayed: return "lastplay"; - case Meta::valPlaycount: return "playcount"; - case Meta::valUniqueId: return "uniqueid"; - - case Meta::valTrackGain: return "trackgain"; - case Meta::valTrackGainPeak: return "trackgainpeak"; - case Meta::valAlbumGain: return "albumgain"; - case Meta::valAlbumGainPeak: return "albumgainpeak"; - - case Meta::valAlbumArtist: return "albumartist"; - case Meta::valLabel: return "label"; - case Meta::valModified: return "modified"; - case Meta::valLyrics: return "lyrics"; + case 0: return QStringLiteral("anything"); + case Meta::valUrl: return QStringLiteral("filename"); + case Meta::valTitle: return QStringLiteral("title"); + case Meta::valArtist: return QStringLiteral("artist"); + case Meta::valAlbum: return QStringLiteral("album"); + case Meta::valGenre: return QStringLiteral("genre"); + case Meta::valComposer: return QStringLiteral("composer"); + case Meta::valYear: return QStringLiteral("year"); + case Meta::valComment: return QStringLiteral("comment"); + case Meta::valTrackNr: return QStringLiteral("tracknr"); + case Meta::valDiscNr: return QStringLiteral("discnumber"); + case Meta::valBpm: return QStringLiteral("bpm"); + case Meta::valLength: return QStringLiteral("length"); + case Meta::valBitrate: return QStringLiteral("bitrate"); + case Meta::valSamplerate: return QStringLiteral("samplerate"); + case Meta::valFilesize: return QStringLiteral("filesize"); + case Meta::valFormat: return QStringLiteral("format"); + case Meta::valCreateDate: return QStringLiteral("added"); + case Meta::valScore: return QStringLiteral("score"); + case Meta::valRating: return QStringLiteral("rating"); + case Meta::valFirstPlayed: return QStringLiteral("firstplay"); + case Meta::valLastPlayed: return QStringLiteral("lastplay"); + case Meta::valPlaycount: return QStringLiteral("playcount"); + case Meta::valUniqueId: return QStringLiteral("uniqueid"); + + case Meta::valTrackGain: return QStringLiteral("trackgain"); + case Meta::valTrackGainPeak: return QStringLiteral("trackgainpeak"); + case Meta::valAlbumGain: return QStringLiteral("albumgain"); + case Meta::valAlbumGainPeak: return QStringLiteral("albumgainpeak"); + + case Meta::valAlbumArtist: return QStringLiteral("albumartist"); + case Meta::valLabel: return QStringLiteral("label"); + case Meta::valModified: return QStringLiteral("modified"); + case Meta::valLyrics: return QStringLiteral("lyrics"); default: return QString(); } } qint64 Meta::fieldForName( const QString &name ) { - if( name.compare( "anything", Qt::CaseInsensitive ) == 0 + if( name.compare( QLatin1String("anything"), Qt::CaseInsensitive ) == 0 || name.compare( shortI18nForField( 0 ), Qt::CaseInsensitive ) == 0 ) return 0; - else if( name.compare( "filename", Qt::CaseInsensitive ) == 0 + else if( name.compare( QLatin1String("filename"), Qt::CaseInsensitive ) == 0 || name.compare( shortI18nForField( Meta::valUrl ), Qt::CaseInsensitive ) == 0 ) return Meta::valUrl; - else if( name.compare( "title", Qt::CaseInsensitive ) == 0 + else if( name.compare( QLatin1String("title"), Qt::CaseInsensitive ) == 0 || name.compare( shortI18nForField( Meta::valTitle ), Qt::CaseInsensitive ) == 0 ) return Meta::valTitle; - else if( name.compare( "artist", Qt::CaseInsensitive ) == 0 + else if( name.compare( QLatin1String("artist"), Qt::CaseInsensitive ) == 0 || name.compare( shortI18nForField( Meta::valArtist ), Qt::CaseInsensitive ) == 0 ) return Meta::valArtist; - else if( name.compare( "album", Qt::CaseInsensitive ) == 0 + else if( name.compare( QLatin1String("album"), Qt::CaseInsensitive ) == 0 || name.compare( shortI18nForField( Meta::valAlbum ), Qt::CaseInsensitive ) == 0 ) return Meta::valAlbum; - else if( name.compare( "genre", Qt::CaseInsensitive ) == 0 + else if( name.compare( QLatin1String("genre"), Qt::CaseInsensitive ) == 0 || name.compare( shortI18nForField( Meta::valGenre ), Qt::CaseInsensitive ) == 0 ) return Meta::valGenre; - else if( name.compare( "composer", Qt::CaseInsensitive ) == 0 + else if( name.compare( QLatin1String("composer"), Qt::CaseInsensitive ) == 0 || name.compare( shortI18nForField( Meta::valComposer ), Qt::CaseInsensitive ) == 0 ) return Meta::valComposer; - else if( name.compare( "year", Qt::CaseInsensitive ) == 0 + else if( name.compare( QLatin1String("year"), Qt::CaseInsensitive ) == 0 || name.compare( shortI18nForField( Meta::valYear ), Qt::CaseInsensitive ) == 0 ) return Meta::valYear; - else if( name.compare( "comment", Qt::CaseInsensitive ) == 0 + else if( name.compare( QLatin1String("comment"), Qt::CaseInsensitive ) == 0 || name.compare( shortI18nForField( Meta::valComment ), Qt::CaseInsensitive ) == 0 ) return Meta::valComment; - else if( name.compare( "tracknumber", Qt::CaseInsensitive ) == 0 + else if( name.compare( QLatin1String("tracknumber"), Qt::CaseInsensitive ) == 0 || name.compare( shortI18nForField( Meta::valTrackNr ), Qt::CaseInsensitive ) == 0 ) return Meta::valTrackNr; - else if( name.compare( "discnumber", Qt::CaseInsensitive ) == 0 + else if( name.compare( QLatin1String("discnumber"), Qt::CaseInsensitive ) == 0 || name.compare( shortI18nForField( Meta::valDiscNr ), Qt::CaseInsensitive ) == 0 ) return Meta::valDiscNr; - else if( name.compare( "bpm", Qt::CaseInsensitive ) == 0 + else if( name.compare( QLatin1String("bpm"), Qt::CaseInsensitive ) == 0 || name.compare( shortI18nForField( Meta::valBpm ), Qt::CaseInsensitive ) == 0 ) return Meta::valBpm; - else if( name.compare( "length", Qt::CaseInsensitive ) == 0 + else if( name.compare( QLatin1String("length"), Qt::CaseInsensitive ) == 0 || name.compare( shortI18nForField( Meta::valLength ), Qt::CaseInsensitive ) == 0 ) return Meta::valLength; - else if( name.compare( "bitrate", Qt::CaseInsensitive ) == 0 + else if( name.compare( QLatin1String("bitrate"), Qt::CaseInsensitive ) == 0 || name.compare( shortI18nForField( Meta::valBitrate ), Qt::CaseInsensitive ) == 0 ) return Meta::valBitrate; - else if( name.compare( "samplerate", Qt::CaseInsensitive ) == 0 + else if( name.compare( QLatin1String("samplerate"), Qt::CaseInsensitive ) == 0 || name.compare( shortI18nForField( Meta::valSamplerate ), Qt::CaseInsensitive ) == 0 ) return Meta::valSamplerate; - else if( name.compare( "filesize", Qt::CaseInsensitive ) == 0 + else if( name.compare( QLatin1String("filesize"), Qt::CaseInsensitive ) == 0 || name.compare( shortI18nForField( Meta::valFilesize ), Qt::CaseInsensitive ) == 0 ) return Meta::valFilesize; - else if( name.compare( "format", Qt::CaseInsensitive ) == 0 - || name.compare( "codec", Qt::CaseInsensitive ) == 0 + else if( name.compare( QLatin1String("format"), Qt::CaseInsensitive ) == 0 + || name.compare( QLatin1String("codec"), Qt::CaseInsensitive ) == 0 || name.compare( shortI18nForField( Meta::valFormat ), Qt::CaseInsensitive ) == 0 ) return Meta::valFormat; - else if( name.compare( "added", Qt::CaseInsensitive ) == 0 + else if( name.compare( QLatin1String("added"), Qt::CaseInsensitive ) == 0 || name.compare( shortI18nForField( Meta::valCreateDate ), Qt::CaseInsensitive ) == 0 ) return Meta::valCreateDate; - else if( name.compare( "score", Qt::CaseInsensitive ) == 0 + else if( name.compare( QLatin1String("score"), Qt::CaseInsensitive ) == 0 || name.compare( shortI18nForField( Meta::valScore ), Qt::CaseInsensitive ) == 0 ) return Meta::valScore; - else if( name.compare( "rating", Qt::CaseInsensitive ) == 0 + else if( name.compare( QLatin1String("rating"), Qt::CaseInsensitive ) == 0 || name.compare( shortI18nForField( Meta::valRating ), Qt::CaseInsensitive ) == 0 ) return Meta::valRating; - else if( name.compare( "firstplay", Qt::CaseInsensitive ) == 0 - || name.compare( "first", Qt::CaseInsensitive ) == 0 // legacy + else if( name.compare( QLatin1String("firstplay"), Qt::CaseInsensitive ) == 0 + || name.compare( QLatin1String("first"), Qt::CaseInsensitive ) == 0 // legacy || name.compare( shortI18nForField( Meta::valFirstPlayed ), Qt::CaseInsensitive ) == 0 ) return Meta::valFirstPlayed; - else if( name.compare( "lastplay", Qt::CaseInsensitive ) == 0 - || name.compare( "played", Qt::CaseInsensitive ) == 0 // legacy + else if( name.compare( QLatin1String("lastplay"), Qt::CaseInsensitive ) == 0 + || name.compare( QLatin1String("played"), Qt::CaseInsensitive ) == 0 // legacy || name.compare( shortI18nForField( Meta::valLastPlayed ), Qt::CaseInsensitive ) == 0 ) return Meta::valLastPlayed; - else if( name.compare( "playcount", Qt::CaseInsensitive ) == 0 + else if( name.compare( QLatin1String("playcount"), Qt::CaseInsensitive ) == 0 || name.compare( shortI18nForField( Meta::valPlaycount ), Qt::CaseInsensitive ) == 0 ) return Meta::valPlaycount; - else if( name.compare( "uniqueid", Qt::CaseInsensitive ) == 0 + else if( name.compare( QLatin1String("uniqueid"), Qt::CaseInsensitive ) == 0 || name.compare( shortI18nForField( Meta::valUniqueId ), Qt::CaseInsensitive ) == 0 ) return Meta::valUniqueId; - else if( name.compare( "trackgain", Qt::CaseInsensitive ) == 0 + else if( name.compare( QLatin1String("trackgain"), Qt::CaseInsensitive ) == 0 || name.compare( shortI18nForField( Meta::valTrackGain ), Qt::CaseInsensitive ) == 0 ) return Meta::valTrackGain; - else if( name.compare( "trackgainpeak", Qt::CaseInsensitive ) == 0 + else if( name.compare( QLatin1String("trackgainpeak"), Qt::CaseInsensitive ) == 0 || name.compare( shortI18nForField( Meta::valTrackGainPeak ), Qt::CaseInsensitive ) == 0 ) return Meta::valTrackGainPeak; - else if( name.compare( "albumgain", Qt::CaseInsensitive ) == 0 + else if( name.compare( QLatin1String("albumgain"), Qt::CaseInsensitive ) == 0 || name.compare( shortI18nForField( Meta::valAlbumGain ), Qt::CaseInsensitive ) == 0 ) return Meta::valAlbumGain; - else if( name.compare( "albumgainpeak", Qt::CaseInsensitive ) == 0 + else if( name.compare( QLatin1String("albumgainpeak"), Qt::CaseInsensitive ) == 0 || name.compare( shortI18nForField( Meta::valAlbumGainPeak ), Qt::CaseInsensitive ) == 0 ) return Meta::valAlbumGainPeak; - else if( name.compare( "albumartist", Qt::CaseInsensitive ) == 0 + else if( name.compare( QLatin1String("albumartist"), Qt::CaseInsensitive ) == 0 || name.compare( shortI18nForField( Meta::valAlbumArtist ), Qt::CaseInsensitive ) == 0 ) return Meta::valAlbumArtist; - else if( name.compare( "label", Qt::CaseInsensitive ) == 0 + else if( name.compare( QLatin1String("label"), Qt::CaseInsensitive ) == 0 || name.compare( shortI18nForField( Meta::valLabel ), Qt::CaseInsensitive ) == 0 ) return Meta::valLabel; - else if( name.compare( "modified", Qt::CaseInsensitive ) == 0 + else if( name.compare( QLatin1String("modified"), Qt::CaseInsensitive ) == 0 || name.compare( shortI18nForField( Meta::valModified ), Qt::CaseInsensitive ) == 0 ) return Meta::valModified; - else if( name.compare( "lyrics", Qt::CaseInsensitive ) == 0 + else if( name.compare( QLatin1String("lyrics"), Qt::CaseInsensitive ) == 0 || name.compare( shortI18nForField( Meta::valLyrics ), Qt::CaseInsensitive ) == 0 ) return Meta::valLyrics; else @@ -263,111 +263,111 @@ { switch( field ) { - case 0: return "anything"; - case Meta::valUrl: return "url"; - case Meta::valTitle: return "title"; - case Meta::valArtist: return "artist name"; - case Meta::valAlbum: return "album name"; - case Meta::valGenre: return "genre"; - case Meta::valComposer: return "composer"; - case Meta::valYear: return "year"; - case Meta::valComment: return "comment"; - case Meta::valTrackNr: return "track number"; - case Meta::valDiscNr: return "disc number"; - case Meta::valBpm: return "bpm"; - case Meta::valLength: return "length"; - case Meta::valBitrate: return "bit rate"; - case Meta::valSamplerate: return "sample rate"; - case Meta::valFilesize: return "file size"; - case Meta::valFormat: return "format"; - case Meta::valCreateDate: return "create date"; - case Meta::valScore: return "score"; - case Meta::valRating: return "rating"; - case Meta::valFirstPlayed: return "first played"; - case Meta::valLastPlayed: return "last played"; - case Meta::valPlaycount: return "play count"; - case Meta::valUniqueId: return "unique id"; - - case Meta::valTrackGain: return "track gain"; - case Meta::valTrackGainPeak: return "track gain peak"; - case Meta::valAlbumGain: return "album gain"; - case Meta::valAlbumGainPeak: return "album gain peak"; - - case Meta::valAlbumArtist: return "album artist name"; - case Meta::valLabel: return "label"; - case Meta::valModified: return "modified"; - default: return ""; + case 0: return QStringLiteral("anything"); + case Meta::valUrl: return QStringLiteral("url"); + case Meta::valTitle: return QStringLiteral("title"); + case Meta::valArtist: return QStringLiteral("artist name"); + case Meta::valAlbum: return QStringLiteral("album name"); + case Meta::valGenre: return QStringLiteral("genre"); + case Meta::valComposer: return QStringLiteral("composer"); + case Meta::valYear: return QStringLiteral("year"); + case Meta::valComment: return QStringLiteral("comment"); + case Meta::valTrackNr: return QStringLiteral("track number"); + case Meta::valDiscNr: return QStringLiteral("disc number"); + case Meta::valBpm: return QStringLiteral("bpm"); + case Meta::valLength: return QStringLiteral("length"); + case Meta::valBitrate: return QStringLiteral("bit rate"); + case Meta::valSamplerate: return QStringLiteral("sample rate"); + case Meta::valFilesize: return QStringLiteral("file size"); + case Meta::valFormat: return QStringLiteral("format"); + case Meta::valCreateDate: return QStringLiteral("create date"); + case Meta::valScore: return QStringLiteral("score"); + case Meta::valRating: return QStringLiteral("rating"); + case Meta::valFirstPlayed: return QStringLiteral("first played"); + case Meta::valLastPlayed: return QStringLiteral("last played"); + case Meta::valPlaycount: return QStringLiteral("play count"); + case Meta::valUniqueId: return QStringLiteral("unique id"); + + case Meta::valTrackGain: return QStringLiteral("track gain"); + case Meta::valTrackGainPeak: return QStringLiteral("track gain peak"); + case Meta::valAlbumGain: return QStringLiteral("album gain"); + case Meta::valAlbumGainPeak: return QStringLiteral("album gain peak"); + + case Meta::valAlbumArtist: return QStringLiteral("album artist name"); + case Meta::valLabel: return QStringLiteral("label"); + case Meta::valModified: return QStringLiteral("modified"); + default: return QLatin1String(""); } } qint64 Meta::fieldForPlaylistName( const QString &name ) { - if( name == "anything" ) return 0; - else if( name == "url" ) return Meta::valUrl; - else if( name == "title" ) return Meta::valTitle; - else if( name == "artist name" ) return Meta::valArtist; - else if( name == "album name" ) return Meta::valAlbum; - else if( name == "genre" ) return Meta::valGenre; - else if( name == "composer" ) return Meta::valComposer; - else if( name == "year" ) return Meta::valYear; - else if( name == "comment" ) return Meta::valComment; - else if( name == "track number" ) return Meta::valTrackNr; - else if( name == "disc number" ) return Meta::valDiscNr; - else if( name == "bpm" ) return Meta::valBpm; - else if( name == "length" ) return Meta::valLength; - else if( name == "bit rate" ) return Meta::valBitrate; - else if( name == "sample rate" ) return Meta::valSamplerate; - else if( name == "file size" ) return Meta::valFilesize; - else if( name == "format" ) return Meta::valFormat; - else if( name == "create date" ) return Meta::valCreateDate; - else if( name == "score" ) return Meta::valScore; - else if( name == "rating" ) return Meta::valRating; - else if( name == "first played" ) return Meta::valFirstPlayed; - else if( name == "last played" ) return Meta::valLastPlayed; - else if( name == "play count" ) return Meta::valPlaycount; - else if( name == "unique id" ) return Meta::valUniqueId; - - else if( name == "track gain" ) return Meta::valTrackGain; - else if( name == "track gain peak" ) return Meta::valTrackGainPeak; - else if( name == "album gain" ) return Meta::valAlbumGain; - else if( name == "album gain peak" ) return Meta::valAlbumGainPeak; - - else if( name == "album artist name" ) return Meta::valAlbumArtist; - else if( name == "label" ) return Meta::valLabel; - else if( name == "modified" ) return Meta::valModified; + if( name == QLatin1String("anything") ) return 0; + else if( name == QLatin1String("url") ) return Meta::valUrl; + else if( name == QLatin1String("title") ) return Meta::valTitle; + else if( name == QLatin1String("artist name") ) return Meta::valArtist; + else if( name == QLatin1String("album name") ) return Meta::valAlbum; + else if( name == QLatin1String("genre") ) return Meta::valGenre; + else if( name == QLatin1String("composer") ) return Meta::valComposer; + else if( name == QLatin1String("year") ) return Meta::valYear; + else if( name == QLatin1String("comment") ) return Meta::valComment; + else if( name == QLatin1String("track number") ) return Meta::valTrackNr; + else if( name == QLatin1String("disc number") ) return Meta::valDiscNr; + else if( name == QLatin1String("bpm") ) return Meta::valBpm; + else if( name == QLatin1String("length") ) return Meta::valLength; + else if( name == QLatin1String("bit rate") ) return Meta::valBitrate; + else if( name == QLatin1String("sample rate") ) return Meta::valSamplerate; + else if( name == QLatin1String("file size") ) return Meta::valFilesize; + else if( name == QLatin1String("format") ) return Meta::valFormat; + else if( name == QLatin1String("create date") ) return Meta::valCreateDate; + else if( name == QLatin1String("score") ) return Meta::valScore; + else if( name == QLatin1String("rating") ) return Meta::valRating; + else if( name == QLatin1String("first played") ) return Meta::valFirstPlayed; + else if( name == QLatin1String("last played") ) return Meta::valLastPlayed; + else if( name == QLatin1String("play count") ) return Meta::valPlaycount; + else if( name == QLatin1String("unique id") ) return Meta::valUniqueId; + + else if( name == QLatin1String("track gain") ) return Meta::valTrackGain; + else if( name == QLatin1String("track gain peak") ) return Meta::valTrackGainPeak; + else if( name == QLatin1String("album gain") ) return Meta::valAlbumGain; + else if( name == QLatin1String("album gain peak") ) return Meta::valAlbumGainPeak; + + else if( name == QLatin1String("album artist name") ) return Meta::valAlbumArtist; + else if( name == QLatin1String("label") ) return Meta::valLabel; + else if( name == QLatin1String("modified") ) return Meta::valModified; else return 0; } QString Meta::iconForField( qint64 field ) { // see also PlaylistDefines.h::iconNames switch( field ) { - case Meta::valUrl: return "filename-space-amarok"; - case Meta::valTitle: return "filename-title-amarok"; - case Meta::valArtist: return "filename-artist-amarok"; - case Meta::valAlbumArtist: return "filename-artist-amarok"; - case Meta::valAlbum: return "filename-album-amarok"; - case Meta::valGenre: return "filename-genre-amarok"; - case Meta::valComposer: return "filename-composer-amarok"; - case Meta::valYear: return "filename-year-amarok"; + case Meta::valUrl: return QStringLiteral("filename-space-amarok"); + case Meta::valTitle: return QStringLiteral("filename-title-amarok"); + case Meta::valArtist: return QStringLiteral("filename-artist-amarok"); + case Meta::valAlbumArtist: return QStringLiteral("filename-artist-amarok"); + case Meta::valAlbum: return QStringLiteral("filename-album-amarok"); + case Meta::valGenre: return QStringLiteral("filename-genre-amarok"); + case Meta::valComposer: return QStringLiteral("filename-composer-amarok"); + case Meta::valYear: return QStringLiteral("filename-year-amarok"); case Meta::valModified: - case Meta::valCreateDate: return "filename-year-amarok"; - case Meta::valComment: return "amarok_comment"; - case Meta::valPlaycount: return "amarok_playcount"; - case Meta::valTrackNr: return "filename-track-amarok"; - case Meta::valDiscNr: return "filename-discnumber-amarok"; - case Meta::valBpm: return "filename-bpm-amarok"; - case Meta::valLength: return "chronometer"; - case Meta::valBitrate: return "audio-x-generic"; - case Meta::valSamplerate: return "filename-sample-rate"; - case Meta::valFormat: return "filename-filetype-amarok"; - case Meta::valScore: return "emblem-favorite"; - case Meta::valRating: return "rating"; + case Meta::valCreateDate: return QStringLiteral("filename-year-amarok"); + case Meta::valComment: return QStringLiteral("amarok_comment"); + case Meta::valPlaycount: return QStringLiteral("amarok_playcount"); + case Meta::valTrackNr: return QStringLiteral("filename-track-amarok"); + case Meta::valDiscNr: return QStringLiteral("filename-discnumber-amarok"); + case Meta::valBpm: return QStringLiteral("filename-bpm-amarok"); + case Meta::valLength: return QStringLiteral("chronometer"); + case Meta::valBitrate: return QStringLiteral("audio-x-generic"); + case Meta::valSamplerate: return QStringLiteral("filename-sample-rate"); + case Meta::valFormat: return QStringLiteral("filename-filetype-amarok"); + case Meta::valScore: return QStringLiteral("emblem-favorite"); + case Meta::valRating: return QStringLiteral("rating"); case Meta::valFirstPlayed: - case Meta::valLastPlayed: return "filename-last-played"; - case Meta::valLabel: return "label-amarok"; - case Meta::valFilesize: return "info-amarok"; + case Meta::valLastPlayed: return QStringLiteral("filename-last-played"); + case Meta::valLabel: return QStringLiteral("label-amarok"); + case Meta::valFilesize: return QStringLiteral("info-amarok"); default: return QString(); } } diff --git a/src/core/meta/support/MetaKeys.h b/src/core/meta/support/MetaKeys.h --- a/src/core/meta/support/MetaKeys.h +++ b/src/core/meta/support/MetaKeys.h @@ -30,7 +30,7 @@ { /** The AlbumKey can be used when an album needs to be identified independent of a collection */ - class AMAROK_CORE_EXPORT AlbumKey + class AMAROKCORE_EXPORT AlbumKey { public: AlbumKey(); @@ -58,7 +58,7 @@ }; /** The TrackKey can be used when an album needs to be identified independent of a collection */ - class AMAROK_CORE_EXPORT TrackKey + class AMAROKCORE_EXPORT TrackKey { public: TrackKey(); diff --git a/src/core/meta/support/MetaUtility.h b/src/core/meta/support/MetaUtility.h --- a/src/core/meta/support/MetaUtility.h +++ b/src/core/meta/support/MetaUtility.h @@ -33,34 +33,34 @@ { //deprecated - AMAROK_CORE_EXPORT QVariantMap mapFromTrack( const Meta::TrackPtr track ); + AMAROKCORE_EXPORT QVariantMap mapFromTrack( const Meta::TrackPtr &track ); //this method will return a map with keys that are compatible to the fdo MPRIS 1.0 specification - AMAROK_CORE_EXPORT QVariantMap mprisMapFromTrack( const Meta::TrackPtr track ); + AMAROKCORE_EXPORT QVariantMap mprisMapFromTrack( const Meta::TrackPtr &track ); //this method will return a map with keys that are compatible to the fdo MPRIS 2.0 specification - AMAROK_CORE_EXPORT QVariantMap mpris20MapFromTrack( const Meta::TrackPtr track ); - AMAROK_CORE_EXPORT void updateTrack( Meta::TrackPtr track, const QVariantMap &metadata ); - AMAROK_CORE_EXPORT QString xesamPrettyToFullFieldName( const QString &name ); - AMAROK_CORE_EXPORT QString xesamFullToPrettyFieldName( const QString &name ); + AMAROKCORE_EXPORT QVariantMap mpris20MapFromTrack( const Meta::TrackPtr &track ); + AMAROKCORE_EXPORT void updateTrack( Meta::TrackPtr track, const QVariantMap &metadata ); + AMAROKCORE_EXPORT QString xesamPrettyToFullFieldName( const QString &name ); + AMAROKCORE_EXPORT QString xesamFullToPrettyFieldName( const QString &name ); } - AMAROK_CORE_EXPORT QString msToPrettyTime( qint64 ms ); + AMAROKCORE_EXPORT QString msToPrettyTime( qint64 ms ); /** Returns the character representation for the time duration. This is a pretty short representation looking like this: 3:45. It is used in the playlist. It is not useful for times above a 24 hours. */ - AMAROK_CORE_EXPORT QString secToPrettyTime( int seconds ); + AMAROKCORE_EXPORT QString secToPrettyTime( int seconds ); /** Returns the character representation for the time duration. - This is a longer human friendy representation looking like this: 5 minutes even when + This is a longer human friendly representation looking like this: 5 minutes even when the actual seconds are 307. */ - AMAROK_CORE_EXPORT QString secToPrettyTimeLong( int seconds ); + AMAROKCORE_EXPORT QString secToPrettyTimeLong( int seconds ); - AMAROK_CORE_EXPORT QString prettyFilesize( quint64 size ); - AMAROK_CORE_EXPORT QString prettyBitrate( int bitrate ); + AMAROKCORE_EXPORT QString prettyFilesize( quint64 size ); + AMAROKCORE_EXPORT QString prettyBitrate( int bitrate ); } diff --git a/src/core/meta/support/MetaUtility.cpp b/src/core/meta/support/MetaUtility.cpp --- a/src/core/meta/support/MetaUtility.cpp +++ b/src/core/meta/support/MetaUtility.cpp @@ -29,35 +29,35 @@ #include #include - static const QString XESAM_ALBUM = "http://freedesktop.org/standards/xesam/1.0/core#album"; - static const QString XESAM_ALBUMARTIST = "http://freedesktop.org/standards/xesam/1.0/core#albumArtist"; - static const QString XESAM_ARTIST = "http://freedesktop.org/standards/xesam/1.0/core#artist"; - static const QString XESAM_BITRATE = "http://freedesktop.org/standards/xesam/1.0/core#audioBitrate"; - static const QString XESAM_BPM = "http://freedesktop.org/standards/xesam/1.0/core#audioBPM"; - static const QString XESAM_CODEC = "http://freedesktop.org/standards/xesam/1.0/core#audioCodec"; - static const QString XESAM_COMMENT = "http://freedesktop.org/standards/xesam/1.0/core#comment"; - static const QString XESAM_COMPOSER = "http://freedesktop.org/standards/xesam/1.0/core#composer"; - static const QString XESAM_DISCNUMBER = "http://freedesktop.org/standards/xesam/1.0/core#discNumber"; - static const QString XESAM_FILESIZE = "http://freedesktop.org/standards/xesam/1.0/core#size"; - static const QString XESAM_GENRE = "http://freedesktop.org/standards/xesam/1.0/core#genre"; - static const QString XESAM_LENGTH = "http://freedesktop.org/standards/xesam/1.0/core#mediaDuration"; - static const QString XESAM_RATING = "http://freedesktop.org/standards/xesam/1.0/core#userRating"; - static const QString XESAM_SAMPLERATE = "http://freedesktop.org/standards/xesam/1.0/core#audioSampleRate"; - static const QString XESAM_TITLE = "http://freedesktop.org/standards/xesam/1.0/core#title"; - static const QString XESAM_TRACKNUMBER = "http://freedesktop.org/standards/xesam/1.0/core#trackNumber"; - static const QString XESAM_URL = "http://freedesktop.org/standards/xesam/1.0/core#url"; - static const QString XESAM_YEAR = "http://freedesktop.org/standards/xesam/1.0/core#contentCreated"; - - static const QString XESAM_SCORE = "http://freedesktop.org/standards/xesam/1.0/core#autoRating"; - static const QString XESAM_PLAYCOUNT = "http://freedesktop.org/standards/xesam/1.0/core#useCount"; - static const QString XESAM_FIRST_PLAYED = "http://freedesktop.org/standards/xesam/1.0/core#firstUsed"; - static const QString XESAM_LAST_PLAYED = "http://freedesktop.org/standards/xesam/1.0/core#lastUsed"; - - static const QString XESAM_ID = "http://freedesktop.org/standards/xesam/1.0/core#id"; + static const QString XESAM_ALBUM = QStringLiteral("http://freedesktop.org/standards/xesam/1.0/core#album"); + static const QString XESAM_ALBUMARTIST = QStringLiteral("http://freedesktop.org/standards/xesam/1.0/core#albumArtist"); + static const QString XESAM_ARTIST = QStringLiteral("http://freedesktop.org/standards/xesam/1.0/core#artist"); + static const QString XESAM_BITRATE = QStringLiteral("http://freedesktop.org/standards/xesam/1.0/core#audioBitrate"); + static const QString XESAM_BPM = QStringLiteral("http://freedesktop.org/standards/xesam/1.0/core#audioBPM"); + static const QString XESAM_CODEC = QStringLiteral("http://freedesktop.org/standards/xesam/1.0/core#audioCodec"); + static const QString XESAM_COMMENT = QStringLiteral("http://freedesktop.org/standards/xesam/1.0/core#comment"); + static const QString XESAM_COMPOSER = QStringLiteral("http://freedesktop.org/standards/xesam/1.0/core#composer"); + static const QString XESAM_DISCNUMBER = QStringLiteral("http://freedesktop.org/standards/xesam/1.0/core#discNumber"); + static const QString XESAM_FILESIZE = QStringLiteral("http://freedesktop.org/standards/xesam/1.0/core#size"); + static const QString XESAM_GENRE = QStringLiteral("http://freedesktop.org/standards/xesam/1.0/core#genre"); + static const QString XESAM_LENGTH = QStringLiteral("http://freedesktop.org/standards/xesam/1.0/core#mediaDuration"); + static const QString XESAM_RATING = QStringLiteral("http://freedesktop.org/standards/xesam/1.0/core#userRating"); + static const QString XESAM_SAMPLERATE = QStringLiteral("http://freedesktop.org/standards/xesam/1.0/core#audioSampleRate"); + static const QString XESAM_TITLE = QStringLiteral("http://freedesktop.org/standards/xesam/1.0/core#title"); + static const QString XESAM_TRACKNUMBER = QStringLiteral("http://freedesktop.org/standards/xesam/1.0/core#trackNumber"); + static const QString XESAM_URL = QStringLiteral("http://freedesktop.org/standards/xesam/1.0/core#url"); + static const QString XESAM_YEAR = QStringLiteral("http://freedesktop.org/standards/xesam/1.0/core#contentCreated"); + + static const QString XESAM_SCORE = QStringLiteral("http://freedesktop.org/standards/xesam/1.0/core#autoRating"); + static const QString XESAM_PLAYCOUNT = QStringLiteral("http://freedesktop.org/standards/xesam/1.0/core#useCount"); + static const QString XESAM_FIRST_PLAYED = QStringLiteral("http://freedesktop.org/standards/xesam/1.0/core#firstUsed"); + static const QString XESAM_LAST_PLAYED = QStringLiteral("http://freedesktop.org/standards/xesam/1.0/core#lastUsed"); + + static const QString XESAM_ID = QStringLiteral("http://freedesktop.org/standards/xesam/1.0/core#id"); //static bool conversionMapsInitialised = false; QVariantMap -Meta::Field::mapFromTrack( const Meta::TrackPtr track ) +Meta::Field::mapFromTrack( const Meta::TrackPtr &track ) { QVariantMap map; if( !track ) @@ -111,74 +111,79 @@ } QVariantMap -Meta::Field::mprisMapFromTrack( const Meta::TrackPtr track ) +Meta::Field::mprisMapFromTrack( const Meta::TrackPtr &track ) { + DEBUG_BLOCK + QVariantMap map; if( track ) { // MANDATORY: - map["location"] = track->playableUrl().url(); + map[QStringLiteral("location")] = track->playableUrl().url(); // INFORMATIONAL: - map["title"] = track->prettyName(); + map[QStringLiteral("title")] = track->prettyName(); if( track->artist() ) - map["artist"] = track->artist()->name(); + map[QStringLiteral("artist")] = track->artist()->name(); if( track->album() ) { - map["album"] = track->album()->name(); + map[QStringLiteral("album")] = track->album()->name(); if( track->album()->hasAlbumArtist() && !track->album()->albumArtist()->name().isEmpty() ) - map[ "albumartist" ] = track->album()->albumArtist()->name(); + map[ QStringLiteral("albumartist") ] = track->album()->albumArtist()->name(); - QImage image = track->album()->image(); QUrl url = track->album()->imageLocation(); - if ( url.isValid() && !url.isLocalFile() ) { + if ( url.isValid() && !url.isLocalFile() ) + { // embedded id? Request a version to be put in the cache + QImage image = track->album()->image(); int width = track->album()->image().width(); url = track->album()->imageLocation( width ); debug() << "MPRIS: New location for width" << width << "is" << url; } if ( url.isValid() && url.isLocalFile() ) - map["arturl"] = QString::fromLatin1( url.toEncoded() ); + map[QStringLiteral("arturl")] = QString::fromLatin1( url.toEncoded() ); } - map["tracknumber"] = track->trackNumber(); - map["time"] = track->length() / 1000; - map["mtime"] = track->length(); + map[QStringLiteral("tracknumber")] = track->trackNumber(); + map[QStringLiteral("time")] = track->length() / 1000; + map[QStringLiteral("mtime")] = track->length(); if( track->genre() ) - map["genre"] = track->genre()->name(); + map[QStringLiteral("genre")] = track->genre()->name(); - map["comment"] = track->comment(); - map["rating"] = track->statistics()->rating()/2; //out of 5, not 10. + map[QStringLiteral("comment")] = track->comment(); + map[QStringLiteral("rating")] = track->statistics()->rating()/2; //out of 5, not 10. if( track->year() ) - map["year"] = track->year()->name(); + map[QStringLiteral("year")] = track->year()->name(); //TODO: external service meta info // TECHNICAL: - map["audio-bitrate"] = track->bitrate(); - map["audio-samplerate"] = track->sampleRate(); + map[QStringLiteral("audio-bitrate")] = track->bitrate(); + map[QStringLiteral("audio-samplerate")] = track->sampleRate(); //amarok has no video-bitrate // EXTRA Amarok specific const QString lyrics = track->cachedLyrics(); if( !lyrics.isEmpty() ) - map["lyrics"] = lyrics; + map[QStringLiteral("lyrics")] = lyrics; } return map; } QVariantMap -Meta::Field::mpris20MapFromTrack( const Meta::TrackPtr track ) +Meta::Field::mpris20MapFromTrack( const Meta::TrackPtr &track ) { + DEBUG_BLOCK + QVariantMap map; if( track ) { // We do not set mpris::trackid here because it depends on the position // of the track in the playlist - map["mpris:length"] = track->length() * 1000; // microseconds + map[QStringLiteral("mpris:length")] = track->length() * 1000; // microseconds // get strong pointers (BR 317980) Meta::AlbumPtr album = track->album(); @@ -189,65 +194,65 @@ Meta::ConstStatisticsPtr statistics = track->statistics(); if( album ) { - QImage image = album->image(); QUrl url = album->imageLocation(); debug() << "MPRIS2: Album image location is" << url; if ( url.isValid() && !url.isLocalFile() ) { // embedded id? Request a version to be put in the cache - int width = album->image().width(); + const QImage image = album->image(); + int width = image.width(); url = album->imageLocation( width ); debug() << "MPRIS2: New location for width" << width << "is" << url; } if ( url.isValid() && url.isLocalFile() ) - map["mpris:artUrl"] = QString::fromLatin1( url.toEncoded() ); + map[QStringLiteral("mpris:artUrl")] = QString::fromLatin1( url.toEncoded() ); - map["xesam:album"] = album->name(); + map[QStringLiteral("xesam:album")] = album->name(); if ( album->hasAlbumArtist() ) - map["xesam:albumArtist"] = QStringList() << album->albumArtist()->name(); + map[QStringLiteral("xesam:albumArtist")] = QStringList() << album->albumArtist()->name(); } if( artist ) - map["xesam:artist"] = QStringList() << artist->name(); + map[QStringLiteral("xesam:artist")] = QStringList() << artist->name(); const QString lyrics = track->cachedLyrics(); if( !lyrics.isEmpty() ) - map["xesam:asText"] = lyrics; + map[QStringLiteral("xesam:asText")] = lyrics; if( track->bpm() > 0 ) - map["xesam:audioBPM"] = int(track->bpm()); + map[QStringLiteral("xesam:audioBPM")] = int(track->bpm()); - map["xesam:autoRating"] = statistics->score(); + map[QStringLiteral("xesam:autoRating")] = statistics->score(); - map["xesam:comment"] = QStringList() << track->comment(); + map[QStringLiteral("xesam:comment")] = QStringList() << track->comment(); if( composer ) - map["xesam:composer"] = QStringList() << composer->name(); + map[QStringLiteral("xesam:composer")] = QStringList() << composer->name(); if( year ) - map["xesam:contentCreated"] = QDateTime(QDate(year->year(), 1, 1)).toString(Qt::ISODate); + map[QStringLiteral("xesam:contentCreated")] = QDateTime(QDate(year->year(), 1, 1)).toString(Qt::ISODate); if( track->discNumber() ) - map["xesam:discNumber"] = track->discNumber(); + map[QStringLiteral("xesam:discNumber")] = track->discNumber(); if( statistics->firstPlayed().isValid() ) - map["xesam:firstUsed"] = statistics->firstPlayed().toString(Qt::ISODate); + map[QStringLiteral("xesam:firstUsed")] = statistics->firstPlayed().toString(Qt::ISODate); if( genre ) - map["xesam:genre"] = QStringList() << genre->name(); + map[QStringLiteral("xesam:genre")] = QStringList() << genre->name(); if( statistics->lastPlayed().isValid() ) - map["xesam:lastUsed"] = statistics->lastPlayed().toString(Qt::ISODate); + map[QStringLiteral("xesam:lastUsed")] = statistics->lastPlayed().toString(Qt::ISODate); - map["xesam:title"] = track->prettyName(); + map[QStringLiteral("xesam:title")] = track->prettyName(); - map["xesam:trackNumber"] = track->trackNumber(); + map[QStringLiteral("xesam:trackNumber")] = track->trackNumber(); - map["xesam:url"] = track->playableUrl().url(); + map[QStringLiteral("xesam:url")] = track->playableUrl().url(); - map["xesam:useCount"] = statistics->playCount(); + map[QStringLiteral("xesam:useCount")] = statistics->playCount(); - map["xesam:userRating"] = statistics->rating() / 10.; // xesam:userRating is a float + map[QStringLiteral("xesam:userRating")] = statistics->rating() / 10.; // xesam:userRating is a float } return map; } @@ -283,6 +288,7 @@ ec->setAlbum( album ); QString albumArtist = metadata.contains( Meta::Field::ALBUMARTIST ) ? metadata.value( Meta::Field::ALBUMARTIST ).toString() : QString(); + ec->setAlbumArtist(albumArtist); QString genre = metadata.contains( Meta::Field::GENRE ) ? metadata.value( Meta::Field::GENRE ).toString() : QString(); ec->setGenre( genre ); @@ -417,7 +423,7 @@ // QDateTime isn't suitable as it thinks it's a date) int days = seconds / 86400; seconds %= 86400; - QString reply = ""; + QString reply = QLatin1String(""); if ( days > 0 ) reply += i18ncp("number of days with spacing for the pretty time", "%1 day, ", "%1 days, ", days); reply += QTime(0, 0, 0).addSecs( seconds ).toString( i18nc("the time format for a time length when the time is 1 hour or above see QTime documentation.", "h:mm:ss" ) ); @@ -462,5 +468,5 @@ return (bitrate >=0 && bitrate <= 256 && bitrate % 32 == 0) ? bitrateStore[ bitrate / 32 ] - : QString( "%1" ).arg( bitrate ); + : QStringLiteral( "%1" ).arg( bitrate ); } diff --git a/src/core/meta/support/PrivateMetaRegistry.h b/src/core/meta/support/PrivateMetaRegistry.h --- a/src/core/meta/support/PrivateMetaRegistry.h +++ b/src/core/meta/support/PrivateMetaRegistry.h @@ -30,16 +30,16 @@ * are from the same album). This, besides saving memory, also makes it possible to group * by pointers in the playlist instead of some album/artist name foo. */ -class AMAROK_CORE_EXPORT PrivateMetaRegistry +class AMAROKCORE_EXPORT PrivateMetaRegistry { public: static PrivateMetaRegistry *instance(); - void insertAlbum( const QString &owner, const QString &key, AlbumPtr album ); - void insertArtist( const QString &owner, const QString &key, ArtistPtr artist ); - void insertGenre( const QString &owner, const QString &key, GenrePtr genre ); - void insertComposer( const QString &owner, const QString &key, ComposerPtr composer ); - void insertYear( const QString &owner, const QString &key, YearPtr year ); + void insertAlbum( const QString &owner, const QString &key, const AlbumPtr &album ); + void insertArtist( const QString &owner, const QString &key, const ArtistPtr &artist ); + void insertGenre( const QString &owner, const QString &key, const GenrePtr &genre ); + void insertComposer( const QString &owner, const QString &key, const ComposerPtr &composer ); + void insertYear( const QString &owner, const QString &key, const YearPtr &year ); AlbumPtr album( const QString &owner, const QString &key ); ArtistPtr artist( const QString &owner, const QString &key ); diff --git a/src/core/meta/support/PrivateMetaRegistry.cpp b/src/core/meta/support/PrivateMetaRegistry.cpp --- a/src/core/meta/support/PrivateMetaRegistry.cpp +++ b/src/core/meta/support/PrivateMetaRegistry.cpp @@ -21,12 +21,12 @@ namespace Meta { -PrivateMetaRegistry* PrivateMetaRegistry::s_instance = 0; +PrivateMetaRegistry* PrivateMetaRegistry::s_instance = nullptr; PrivateMetaRegistry * PrivateMetaRegistry::instance() { - if ( s_instance == 0 ) + if ( s_instance == nullptr ) s_instance = new PrivateMetaRegistry(); return s_instance; } @@ -42,31 +42,31 @@ } -void PrivateMetaRegistry::insertAlbum( const QString &owner, const QString &key, AlbumPtr album ) +void PrivateMetaRegistry::insertAlbum( const QString &owner, const QString &key, const AlbumPtr &album ) { const QString compositeKey = owner + '-' + key; m_albums.insert( compositeKey, album ); } -void PrivateMetaRegistry::insertArtist( const QString &owner, const QString &key, ArtistPtr artist ) +void PrivateMetaRegistry::insertArtist( const QString &owner, const QString &key, const ArtistPtr &artist ) { const QString compositeKey = owner + '-' + key; m_artists.insert( compositeKey, artist ); } -void PrivateMetaRegistry::insertGenre( const QString &owner, const QString &key, GenrePtr genre ) +void PrivateMetaRegistry::insertGenre( const QString &owner, const QString &key, const GenrePtr &genre ) { const QString compositeKey = owner + '-' + key; m_genre.insert( compositeKey, genre ); } -void PrivateMetaRegistry::insertComposer( const QString &owner, const QString &key, ComposerPtr composer ) +void PrivateMetaRegistry::insertComposer( const QString &owner, const QString &key, const ComposerPtr &composer ) { const QString compositeKey = owner + '-' + key; m_composers.insert( compositeKey, composer ); } -void PrivateMetaRegistry::insertYear( const QString &owner, const QString &key, YearPtr year ) +void PrivateMetaRegistry::insertYear( const QString &owner, const QString &key, const YearPtr &year ) { const QString compositeKey = owner + '-' + key; m_years.insert( compositeKey, year ); diff --git a/src/core/playlists/Playlist.h b/src/core/playlists/Playlist.h --- a/src/core/playlists/Playlist.h +++ b/src/core/playlists/Playlist.h @@ -55,24 +55,28 @@ * Subclass this class in order to be able to watch playlists as their metadata and * track list changes. */ - class AMAROK_CORE_EXPORT PlaylistObserver + class AMAROKCORE_EXPORT PlaylistObserver { public: PlaylistObserver(); virtual ~PlaylistObserver(); /** - * Subscribe to changes made by @param playlist. Does nothing if playlist is + * Subscribe to changes made by @p playlist. Does nothing if playlist is * null or if already subscribed. * + * @param playlist the playlist + * * This method is thread-safe. */ void subscribeTo( PlaylistPtr playlist ); /** - * Unsubscribe from changes made by @param playlist. Does nothing if not yet + * Unsubscribe from changes made by @p playlist. Does nothing if not yet * subscribed to playlist. * + * @param playlist the playlist + * * This method is thread-safe. */ void unsubscribeFrom( PlaylistPtr playlist ); @@ -86,7 +90,7 @@ * @note this method may get called from non-main thread and must be * implemented in a thread-safe manner */ - virtual void metadataChanged( PlaylistPtr playlist ); + virtual void metadataChanged( const PlaylistPtr &playlist ); /** * This method is called when a track has been added to the playlist. @@ -98,7 +102,7 @@ * @note this method may get called from non-main thread and must be * implemented in a thread-safe manner */ - virtual void trackAdded( PlaylistPtr playlist, Meta::TrackPtr track, int position ); + virtual void trackAdded( const PlaylistPtr &playlist, const Meta::TrackPtr &track, int position ); /** * This method is called after a track is removed from to the playlist. @@ -109,7 +113,7 @@ * @note this method may get called from non-main thread and must be * implemented in a thread-safe manner */ - virtual void trackRemoved( PlaylistPtr playlist, int position ); + virtual void trackRemoved( const PlaylistPtr &playlist, int position ); /** * This method is called after loading of playlist is finished @@ -127,7 +131,7 @@ QMutex m_playlistSubscriptionsMutex; // guards access to m_playlistSubscriptions }; - class AMAROK_CORE_EXPORT Playlist : public virtual QSharedData + class AMAROKCORE_EXPORT Playlist : public virtual QSharedData { public: Playlist(); @@ -142,7 +146,7 @@ virtual QString name() const = 0; virtual QString prettyName() const { return name(); } - virtual PlaylistProvider *provider() const { return 0; } + virtual PlaylistProvider *provider() const { return nullptr; } virtual void setName( const QString &name ); @@ -188,13 +192,14 @@ /** * Add the track to a certain position in the playlist * + * @param track the track to add * @param position place to add this track. The default value -1 appends to * the end. * * @note if the position is larger then the size of the playlist append to the * end without generating an error. */ - virtual void addTrack( Meta::TrackPtr track, int position = -1 ); + virtual void addTrack( const Meta::TrackPtr &track, int position = -1 ); /** * Remove track at the specified position @@ -206,7 +211,7 @@ * useful for podcasts providers and some other exotic * playlist providers. */ - virtual void syncTrackStatus( int position, Meta::TrackPtr otherTrack ); + virtual void syncTrackStatus( int position, const Meta::TrackPtr &otherTrack ); /** * A list of groups or labels this playlist belongs to. @@ -230,7 +235,7 @@ // added everywhere /** * Call this method to assure synchronously loading. - * @note not all playlist implemetations support asynchronous loading + * @note not all playlist implementations support asynchronous loading */ QT_DEPRECATED void makeLoadingSync() { m_async = false; } /** @@ -261,6 +266,7 @@ /** * Implementations must call this when a track is added to playlist * + * @param track the track that was added * @param position is the actual new position of the added track, never negative * @note calling this from (code called by) Playlist constructor is FORBIDDEN. */ diff --git a/src/core/playlists/Playlist.cpp b/src/core/playlists/Playlist.cpp --- a/src/core/playlists/Playlist.cpp +++ b/src/core/playlists/Playlist.cpp @@ -56,15 +56,15 @@ } } -void PlaylistObserver::metadataChanged( PlaylistPtr ) +void PlaylistObserver::metadataChanged( const PlaylistPtr &) { } -void PlaylistObserver::trackAdded( PlaylistPtr, Meta::TrackPtr, int ) +void PlaylistObserver::trackAdded( const PlaylistPtr&, const Meta::TrackPtr&, int ) { } -void PlaylistObserver::trackRemoved( PlaylistPtr, int ) +void PlaylistObserver::trackRemoved( const PlaylistPtr&, int ) { } @@ -93,16 +93,16 @@ notifyObserversTracksLoaded(); } -void Playlist::addTrack( Meta::TrackPtr, int ) +void Playlist::addTrack( const Meta::TrackPtr&, int ) { } void Playlist::removeTrack( int ) { } void -Playlist::syncTrackStatus( int, Meta::TrackPtr ) +Playlist::syncTrackStatus( int, const Meta::TrackPtr &) { } diff --git a/src/core/playlists/PlaylistFormat.h b/src/core/playlists/PlaylistFormat.h --- a/src/core/playlists/PlaylistFormat.h +++ b/src/core/playlists/PlaylistFormat.h @@ -22,7 +22,6 @@ #include -class QFile; namespace Playlists { @@ -39,8 +38,8 @@ NotPlaylist = Unknown }; - AMAROK_CORE_EXPORT PlaylistFormat getFormat( const QUrl &path ); - AMAROK_CORE_EXPORT bool isPlaylist( const QUrl &path ); + AMAROKCORE_EXPORT PlaylistFormat getFormat( const QUrl &path ); + AMAROKCORE_EXPORT bool isPlaylist( const QUrl &path ); } #endif diff --git a/src/core/playlists/PlaylistFormat.cpp b/src/core/playlists/PlaylistFormat.cpp --- a/src/core/playlists/PlaylistFormat.cpp +++ b/src/core/playlists/PlaylistFormat.cpp @@ -32,13 +32,13 @@ { const QString ext = Amarok::extension( path.fileName() ); - if( ext == "m3u" || ext == "m3u8" ) return M3U; //m3u8 is M3U in UTF8 - if( ext == "pls" ) return PLS; - if( ext == "ram" ) return RAM; - if( ext == "smil") return SMIL; - if( ext == "asx" || ext == "wax" || ext == "asf" ) return ASX; - if( ext == "xml" ) return XML; - if( ext == "xspf" ) return XSPF; + if( ext == QLatin1String("m3u") || ext == QLatin1String("m3u8") ) return M3U; //m3u8 is M3U in UTF8 + if( ext == QLatin1String("pls") ) return PLS; + if( ext == QLatin1String("ram") ) return RAM; + if( ext == QLatin1String("smil")) return SMIL; + if( ext == QLatin1String("asx") || ext == QLatin1String("wax") || ext == QLatin1String("asf") ) return ASX; + if( ext == QLatin1String("xml") ) return XML; + if( ext == QLatin1String("xspf") ) return XSPF; return Unknown; } diff --git a/src/core/playlists/PlaylistProvider.h b/src/core/playlists/PlaylistProvider.h --- a/src/core/playlists/PlaylistProvider.h +++ b/src/core/playlists/PlaylistProvider.h @@ -24,12 +24,12 @@ namespace Playlists { -class AMAROK_CORE_EXPORT PlaylistProvider : public QObject +class AMAROKCORE_EXPORT PlaylistProvider : public QObject { Q_OBJECT public: - explicit PlaylistProvider( QObject *parent = 0 ); + explicit PlaylistProvider( QObject *parent = nullptr ); /** * A translated string to identify this Provider. @@ -56,7 +56,7 @@ virtual int playlistCount() const { return -1; } /** - * Return a list of plyalists of this provider. If playlistCount() is negative, + * Return a list of playlists of this provider. If playlistCount() is negative, * this list may be incomplete. */ virtual PlaylistList playlists() = 0; @@ -97,12 +97,12 @@ * It's up to the implementation to decide what to do but could for instance allow the * creation of a new playlist from scratch. */ - virtual Meta::TrackPtr addTrack( Meta::TrackPtr track ); + virtual Meta::TrackPtr addTrack( const Meta::TrackPtr &track ); Q_SIGNALS: void updated(); - void playlistAdded( Playlists::PlaylistPtr playlist ); - void playlistRemoved( Playlists::PlaylistPtr playlist ); + void playlistAdded( const Playlists::PlaylistPtr &playlist ); + void playlistRemoved( const Playlists::PlaylistPtr &playlist ); }; } //namespace Playlists diff --git a/src/core/playlists/PlaylistProvider.cpp b/src/core/playlists/PlaylistProvider.cpp --- a/src/core/playlists/PlaylistProvider.cpp +++ b/src/core/playlists/PlaylistProvider.cpp @@ -50,13 +50,13 @@ } PlaylistPtr -PlaylistProvider::addPlaylist( Playlists::PlaylistPtr ) +PlaylistProvider::addPlaylist(PlaylistPtr) { return PlaylistPtr(); } void -PlaylistProvider::renamePlaylist( PlaylistPtr, const QString & ) +PlaylistProvider::renamePlaylist(PlaylistPtr, const QString & ) { } @@ -67,7 +67,7 @@ } Meta::TrackPtr -PlaylistProvider::addTrack( Meta::TrackPtr ) +PlaylistProvider::addTrack( const Meta::TrackPtr &) { return Meta::TrackPtr(); } diff --git a/src/core/podcasts/PodcastImageFetcher.h b/src/core/podcasts/PodcastImageFetcher.h --- a/src/core/podcasts/PodcastImageFetcher.h +++ b/src/core/podcasts/PodcastImageFetcher.h @@ -21,30 +21,30 @@ #include -class AMAROK_CORE_EXPORT PodcastImageFetcher : public QObject +class AMAROKCORE_EXPORT PodcastImageFetcher : public QObject { Q_OBJECT public: PodcastImageFetcher(); void addChannel( Podcasts::PodcastChannelPtr channel ); - void addEpisode( Podcasts::PodcastEpisodePtr episode ); + void addEpisode( const Podcasts::PodcastEpisodePtr &episode ); void run(); - static QUrl cachedImagePath( Podcasts::PodcastChannelPtr channel ); + static QUrl cachedImagePath(const Podcasts::PodcastChannelPtr &channel ); static QUrl cachedImagePath( Podcasts::PodcastChannel *channel ); Q_SIGNALS: - void channelImageReady( Podcasts::PodcastChannelPtr channel, QImage image ); - void episodeImageReady( Podcasts::PodcastEpisodePtr episode, QImage image ); + void channelImageReady( const Podcasts::PodcastChannelPtr &channel, const QImage &image ); + void episodeImageReady( const Podcasts::PodcastEpisodePtr &episode, const QImage &image ); void done( PodcastImageFetcher * ); private Q_SLOTS: void slotDownloadFinished( KJob *job ); private: - static bool hasCachedImage( Podcasts::PodcastChannelPtr channel ); + static bool hasCachedImage(const Podcasts::PodcastChannelPtr &channel ); Podcasts::PodcastChannelList m_channels; Podcasts::PodcastEpisodeList m_episodes; diff --git a/src/core/podcasts/PodcastImageFetcher.cpp b/src/core/podcasts/PodcastImageFetcher.cpp --- a/src/core/podcasts/PodcastImageFetcher.cpp +++ b/src/core/podcasts/PodcastImageFetcher.cpp @@ -19,7 +19,7 @@ #include "core/support/Debug.h" #include -#include +#include #include @@ -66,13 +66,13 @@ } void -PodcastImageFetcher::addEpisode( Podcasts::PodcastEpisodePtr episode ) +PodcastImageFetcher::addEpisode( const Podcasts::PodcastEpisodePtr &episode ) { Q_UNUSED( episode ); } QUrl -PodcastImageFetcher::cachedImagePath( Podcasts::PodcastChannelPtr channel ) +PodcastImageFetcher::cachedImagePath( const Podcasts::PodcastChannelPtr &channel ) { return cachedImagePath( channel.data() ); } @@ -82,17 +82,17 @@ { QUrl imagePath = channel->saveLocation(); if( imagePath.isEmpty() || !imagePath.isLocalFile() ) - imagePath = QUrl::fromLocalFile( Amarok::saveLocation( "podcasts" ) ); + imagePath = QUrl::fromLocalFile( Amarok::saveLocation( QStringLiteral("podcasts") ) ); QCryptographicHash md5( QCryptographicHash::Md5 ); md5.addData( channel->url().url().toLocal8Bit() ); QString extension = Amarok::extension( channel->imageUrl().fileName() ); imagePath = imagePath.adjusted( QUrl::StripTrailingSlash ); - imagePath.setPath( imagePath.path() + '/' + ( md5.result().toHex() + '.' + extension ) ); + imagePath.setPath( imagePath.path() + QLatin1Char('/') + ( md5.result().toHex() + QLatin1Char('.') + extension ) ); return imagePath; } bool -PodcastImageFetcher::hasCachedImage( Podcasts::PodcastChannelPtr channel ) +PodcastImageFetcher::hasCachedImage( const Podcasts::PodcastChannelPtr &channel ) { DEBUG_BLOCK return QFile( PodcastImageFetcher::cachedImagePath( @@ -106,15 +106,15 @@ && m_jobChannelMap.isEmpty() && m_jobEpisodeMap.isEmpty() ) { //nothing to do - emit( done( this ) ); + Q_EMIT( done( this ) ); return; } QNetworkConfigurationManager mgr; if( !mgr.isOnline() ) { debug() << "QNetworkConfigurationManager reports we are not online, canceling podcast image download"; - emit( done( this ) ); + Q_EMIT( done( this ) ); //TODO: schedule another run after Solid reports we are online again return; } diff --git a/src/core/podcasts/PodcastMeta.h b/src/core/podcasts/PodcastMeta.h --- a/src/core/podcasts/PodcastMeta.h +++ b/src/core/podcasts/PodcastMeta.h @@ -30,7 +30,10 @@ #include #include - +namespace Collections +{ +class QueryMaker; +} namespace Podcasts { class PodcastEpisode; @@ -48,7 +51,7 @@ typedef QList PodcastEpisodeList; typedef QList PodcastChannelList; -class AMAROK_CORE_EXPORT PodcastMetaCommon +class AMAROKCORE_EXPORT PodcastMetaCommon { public: PodcastMetaCommon() {} @@ -78,59 +81,59 @@ QString m_author; // TODO: save to DB }; -class AMAROK_CORE_EXPORT PodcastEpisode : public PodcastMetaCommon, public Meta::Track +class AMAROKCORE_EXPORT PodcastEpisode : public PodcastMetaCommon, public Meta::Track { public: PodcastEpisode(); - PodcastEpisode( PodcastChannelPtr channel ); - PodcastEpisode( PodcastEpisodePtr episode, PodcastChannelPtr channel ); + explicit PodcastEpisode( const PodcastChannelPtr &channel ); + PodcastEpisode( const PodcastEpisodePtr &episode, const PodcastChannelPtr &channel ); - virtual ~PodcastEpisode() {} + ~PodcastEpisode() override {} // Meta::Base methods - virtual QString name() const { return m_title; } + QString name() const override { return m_title; } // Meta::Track Methods - virtual QUrl playableUrl() const { return m_localUrl.isEmpty() ? m_url : m_localUrl; } - virtual QString prettyUrl() const { return playableUrl().toDisplayString(); } - virtual QString uidUrl() const { return m_url.url(); } - virtual QString notPlayableReason() const; + QUrl playableUrl() const override { return m_localUrl.isEmpty() ? m_url : m_localUrl; } + QString prettyUrl() const override { return playableUrl().toDisplayString(); } + QString uidUrl() const override { return m_url.url(); } + QString notPlayableReason() const override; - virtual Meta::AlbumPtr album() const { return m_albumPtr; } - virtual Meta::ArtistPtr artist() const { return m_artistPtr; } - virtual Meta::ComposerPtr composer() const { return m_composerPtr; } - virtual Meta::GenrePtr genre() const { return m_genrePtr; } - virtual Meta::YearPtr year() const { return m_yearPtr; } + Meta::AlbumPtr album() const override { return m_albumPtr; } + Meta::ArtistPtr artist() const override { return m_artistPtr; } + Meta::ComposerPtr composer() const override { return m_composerPtr; } + Meta::GenrePtr genre() const override { return m_genrePtr; } + Meta::YearPtr year() const override { return m_yearPtr; } - virtual qreal bpm() const { return -1.0; } + qreal bpm() const override { return -1.0; } - virtual QString comment() const { return QString(); } + QString comment() const override { return QString(); } virtual void setComment( const QString &newComment ) { Q_UNUSED( newComment ); } - virtual qint64 length() const { return m_duration * 1000; } - virtual int filesize() const { return m_fileSize; } - virtual int sampleRate() const { return 0; } - virtual int bitrate() const { return 0; } - virtual int trackNumber() const { return m_sequenceNumber; } + qint64 length() const override { return m_duration * 1000; } + int filesize() const override { return m_fileSize; } + int sampleRate() const override { return 0; } + int bitrate() const override { return 0; } + int trackNumber() const override { return m_sequenceNumber; } virtual void setTrackNumber( int newTrackNumber ) { Q_UNUSED( newTrackNumber ); } - virtual int discNumber() const { return 0; } + int discNumber() const override { return 0; } virtual void setDiscNumber( int newDiscNumber ) { Q_UNUSED( newDiscNumber ); } virtual QString mimeType() const { return m_mimeType; } - virtual QString type() const + QString type() const override { const QString fileName = playableUrl().fileName(); return Amarok::extension( fileName ); } virtual void addMatchTo( Collections::QueryMaker* qm ) { Q_UNUSED( qm ); } - virtual bool inCollection() const { return false; } - virtual QString cachedLyrics() const { return QString(); } - virtual void setCachedLyrics( const QString &lyrics ) { Q_UNUSED( lyrics ); } + bool inCollection() const override { return false; } + QString cachedLyrics() const override { return QString(); } + void setCachedLyrics( const QString &lyrics ) override { Q_UNUSED( lyrics ); } - virtual bool operator==( const Meta::Track &track ) const; + bool operator==( const Meta::Track &track ) const override; //PodcastMetaCommon methods - virtual void setTitle( const QString &title ) { m_title = title; } + void setTitle( const QString &title ) override { m_title = title; } //PodcastEpisode methods virtual QUrl localUrl() const { return m_localUrl; } @@ -150,7 +153,7 @@ virtual void setGuid( const QString &guid ) { m_guid = guid; } virtual void setNew( bool isNew ) { m_isNew = isNew; } virtual void setSequenceNumber( int sequenceNumber ) { m_sequenceNumber = sequenceNumber; } - virtual void setChannel( const PodcastChannelPtr channel ) { m_channel = channel; } + virtual void setChannel( const PodcastChannelPtr &channel ) { m_channel = channel; } protected: PodcastChannelPtr m_channel; @@ -173,7 +176,7 @@ Meta::YearPtr m_yearPtr; }; -class AMAROK_CORE_EXPORT PodcastChannel : public PodcastMetaCommon, public Playlists::Playlist +class AMAROKCORE_EXPORT PodcastChannel : public PodcastMetaCommon, public Playlists::Playlist { public: @@ -195,20 +198,20 @@ , m_purgeCount( 0 ) { } - PodcastChannel( Podcasts::PodcastChannelPtr channel ); - virtual ~PodcastChannel() {} + explicit PodcastChannel(const PodcastChannelPtr &channel ); + ~PodcastChannel() override {} //Playlist virtual methods - virtual QUrl uidUrl() const { return m_url; } - virtual QString name() const { return title(); } + QUrl uidUrl() const override { return m_url; } + QString name() const override { return title(); } - virtual int trackCount() const { return m_episodes.count(); } - virtual Meta::TrackList tracks(); - virtual void addTrack( Meta::TrackPtr track, int position = -1 ); + int trackCount() const override { return m_episodes.count(); } + Meta::TrackList tracks() override; + void addTrack( const Meta::TrackPtr &track, int position = -1 ) override; //PodcastMetaCommon methods - // override this since it's ambigous in PodcastMetaCommon and Playlist - virtual QString description() const { return m_description; } + // override this since it's ambiguous in PodcastMetaCommon and Playlist + QString description() const override { return m_description; } //PodcastChannel methods virtual QUrl url() const { return m_url; } @@ -230,7 +233,7 @@ virtual void addLabel( const QString &label ) { m_labels << label; } virtual void setSubscribeDate( const QDate &date ) { m_subscribeDate = date; } - virtual Podcasts::PodcastEpisodePtr addEpisode( PodcastEpisodePtr episode ); + virtual Podcasts::PodcastEpisodePtr addEpisode( const PodcastEpisodePtr &episode ); virtual PodcastEpisodeList episodes() const { return m_episodes; } bool load( QTextStream &stream ) { Q_UNUSED( stream ); return false; } @@ -266,15 +269,15 @@ // internal helper classes -class AMAROK_CORE_EXPORT PodcastArtist : public Meta::Artist +class AMAROKCORE_EXPORT PodcastArtist : public Meta::Artist { public: - PodcastArtist( PodcastEpisode *episode ) + explicit PodcastArtist( PodcastEpisode *episode ) : Meta::Artist() , episode( episode ) {} - Meta::TrackList tracks() + Meta::TrackList tracks() override { return Meta::TrackList(); } @@ -284,61 +287,61 @@ return Meta::AlbumList(); } - QString name() const + QString name() const override { QString author; if( episode && episode->channel() ) author = episode->channel()->author(); return author; } - bool operator==( const Meta::Artist &other ) const + bool operator==( const Meta::Artist &other ) const override { return name() == other.name(); } PodcastEpisode const *episode; }; -class AMAROK_CORE_EXPORT PodcastAlbum : public Meta::Album +class AMAROKCORE_EXPORT PodcastAlbum : public Meta::Album { public: - PodcastAlbum( PodcastEpisode *episode ) + explicit PodcastAlbum( PodcastEpisode *episode ) : Meta::Album() , episode( episode ) {} /* Its all a little bit stupid. - When the cannel image (and also the album image) changes the album get's no indication. + When the channel image (and also the album image) changes the album get's no indication. Also the CoverCache is not in amarokcorelib but in amaroklib. Why the PodcastAlbum is the only one with a concrete implementation in amarokcorelib is another question. virtual ~PodcastAlbum() { CoverCache::invalidateAlbum( Meta::AlbumPtr(this) ); } */ - bool isCompilation() const + bool isCompilation() const override { return false; } - bool hasAlbumArtist() const + bool hasAlbumArtist() const override { return false; } - Meta::ArtistPtr albumArtist() const + Meta::ArtistPtr albumArtist() const override { return Meta::ArtistPtr(); } - Meta::TrackList tracks() + Meta::TrackList tracks() override { return Meta::TrackList(); } - QString name() const + QString name() const override { if( episode != 0 ) { @@ -349,62 +352,62 @@ return QString(); } - QImage image( int size ) const + QImage image( int size ) const override { - // This is a little stupid. If Channel::setImage is called we don't emit a MetaDataChanged or invalidate the cache + // This is a little stupid. If Channel::setImage is called we don't Q_EMIT a MetaDataChanged or invalidate the cache QImage image = episode->channel()->image(); return image.scaledToHeight( size ); } - bool operator==( const Meta::Album &other ) const + bool operator==( const Meta::Album &other ) const override { return name() == other.name(); } PodcastEpisode const *episode; }; -class AMAROK_CORE_EXPORT PodcastGenre : public Meta::Genre +class AMAROKCORE_EXPORT PodcastGenre : public Meta::Genre { public: - PodcastGenre( PodcastEpisode *episode ) + explicit PodcastGenre( PodcastEpisode *episode ) : Meta::Genre() , episode( episode ) {} - Meta::TrackList tracks() + Meta::TrackList tracks() override { return Meta::TrackList(); } - QString name() const + QString name() const override { const QString genreName = i18n( "Podcast" ); return genreName; } - bool operator==( const Meta::Genre &other ) const + bool operator==( const Meta::Genre &other ) const override { return name() == other.name(); } PodcastEpisode const *episode; }; -class AMAROK_CORE_EXPORT PodcastComposer : public Meta::Composer +class AMAROKCORE_EXPORT PodcastComposer : public Meta::Composer { public: - PodcastComposer( PodcastEpisode *episode ) + explicit PodcastComposer( PodcastEpisode *episode ) : Meta::Composer() , episode( episode ) {} - Meta::TrackList tracks() + Meta::TrackList tracks() override { return Meta::TrackList(); } - QString name() const + QString name() const override { if( episode != 0 ) { @@ -416,39 +419,39 @@ } - bool operator==( const Meta::Composer &other ) const + bool operator==( const Meta::Composer &other ) const override { return name() == other.name(); } PodcastEpisode const *episode; }; -class AMAROK_CORE_EXPORT PodcastYear : public Meta::Year +class AMAROKCORE_EXPORT PodcastYear : public Meta::Year { public: - PodcastYear( PodcastEpisode *episode ) + explicit PodcastYear( PodcastEpisode *episode ) : Meta::Year() , episode( episode ) {} - Meta::TrackList tracks() + Meta::TrackList tracks() override { return Meta::TrackList(); } - QString name() const + QString name() const override { if( episode != 0 ) { - const QString year = episode->pubDate().toString( "yyyy" ); + const QString year = episode->pubDate().toString( QStringLiteral("yyyy") ); return year; } else return QString(); } - bool operator==( const Meta::Year &other ) const + bool operator==( const Meta::Year &other ) const override { return name() == other.name(); } diff --git a/src/core/podcasts/PodcastMeta.cpp b/src/core/podcasts/PodcastMeta.cpp --- a/src/core/podcasts/PodcastMeta.cpp +++ b/src/core/podcasts/PodcastMeta.cpp @@ -37,7 +37,7 @@ m_yearPtr = Meta::YearPtr( new PodcastYear( this ) ); } -PodcastEpisode::PodcastEpisode( PodcastChannelPtr channel ) +PodcastEpisode::PodcastEpisode( const PodcastChannelPtr &channel ) : PodcastMetaCommon() , Track() , m_channel( channel ) @@ -56,8 +56,8 @@ m_yearPtr = Meta::YearPtr( new PodcastYear( this ) ); } -PodcastEpisode::PodcastEpisode( PodcastEpisodePtr episode, - PodcastChannelPtr channel ) +PodcastEpisode::PodcastEpisode( const PodcastEpisodePtr &episode, + const PodcastChannelPtr &channel ) : m_channel( channel ) { m_author = episode->author(); @@ -100,7 +100,7 @@ ); } -PodcastChannel::PodcastChannel( PodcastChannelPtr channel ) +PodcastChannel::PodcastChannel( const PodcastChannelPtr &channel ) { m_author = channel->author(); m_autoScan = channel->autoScan(); @@ -138,14 +138,14 @@ } void -PodcastChannel::addTrack( Meta::TrackPtr track, int position ) +PodcastChannel::addTrack( const Meta::TrackPtr &track, int position ) { Q_UNUSED( position ); addEpisode( PodcastEpisodePtr::dynamicCast( track ) ); } Podcasts::PodcastEpisodePtr -PodcastChannel::addEpisode( PodcastEpisodePtr episode ) +PodcastChannel::addEpisode( const PodcastEpisodePtr &episode ) { if( !episode.isNull() ) m_episodes << episode; diff --git a/src/core/podcasts/PodcastProvider.h b/src/core/podcasts/PodcastProvider.h --- a/src/core/podcasts/PodcastProvider.h +++ b/src/core/podcasts/PodcastProvider.h @@ -26,14 +26,14 @@ /** @author Bart Cerneels */ -class AMAROK_CORE_EXPORT PodcastProvider : public Collections::TrackProvider, public Playlists::PlaylistProvider +class AMAROKCORE_EXPORT PodcastProvider : public Collections::TrackProvider, public Playlists::PlaylistProvider { public: static bool couldBeFeed( const QString &urlString ); static QUrl toFeedUrl( const QString &urlString ); - virtual bool possiblyContainsTrack( const QUrl &url ) const = 0; - virtual Meta::TrackPtr trackForUrl( const QUrl &url ) = 0; + bool possiblyContainsTrack( const QUrl &url ) const override = 0; + Meta::TrackPtr trackForUrl( const QUrl &url ) override = 0; /** Special function to get an episode for a given guid. * @@ -46,7 +46,7 @@ virtual void addPodcast( const QUrl &url ) = 0; virtual void updateAll() {} - virtual Podcasts::PodcastChannelPtr addChannel( Podcasts::PodcastChannelPtr channel ) = 0; + virtual Podcasts::PodcastChannelPtr addChannel( const Podcasts::PodcastChannelPtr &channel ) = 0; virtual Podcasts::PodcastEpisodePtr addEpisode( Podcasts::PodcastEpisodePtr episode ) = 0; virtual Podcasts::PodcastChannelList channels() = 0; @@ -56,15 +56,15 @@ virtual void completePodcastDownloads() = 0; // PlaylistProvider methods - virtual int category() const { return Playlists::PodcastChannelPlaylist; } + int category() const override { return Playlists::PodcastChannelPlaylist; } /** convenience function that downcast the argument to PodcastChannel and calls addChannel() */ - virtual Playlists::PlaylistPtr addPlaylist( Playlists::PlaylistPtr playlist ); + Playlists::PlaylistPtr addPlaylist(Playlists::PlaylistPtr playlist ) override; /** convenience function that downcast the argument to PodcastEpisode and calls addEpisode() */ - virtual Meta::TrackPtr addTrack( Meta::TrackPtr track ); + Meta::TrackPtr addTrack( const Meta::TrackPtr &track ) override; }; } //namespace Podcasts diff --git a/src/core/podcasts/PodcastProvider.cpp b/src/core/podcasts/PodcastProvider.cpp --- a/src/core/podcasts/PodcastProvider.cpp +++ b/src/core/podcasts/PodcastProvider.cpp @@ -28,11 +28,11 @@ DEBUG_BLOCK QStringList feedProtocols; - feedProtocols << "itpc"; - feedProtocols << "pcast"; - feedProtocols << "feed"; + feedProtocols << QStringLiteral("itpc"); + feedProtocols << QStringLiteral("pcast"); + feedProtocols << QStringLiteral("feed"); - QString matchString = QString( "^(%1)" ).arg( feedProtocols.join( "|" ) ); + QString matchString = QStringLiteral( "^(%1)" ).arg( feedProtocols.join( QStringLiteral("|") ) ); QRegExp rx( matchString ); int pos = rx.indexIn( urlString.trimmed() ); @@ -47,28 +47,28 @@ QUrl kurl( urlString.trimmed() ); - if( kurl.scheme() == "itpc" ) + if( kurl.scheme() == QLatin1String("itpc") ) { debug() << "itpc:// url."; - kurl.setScheme( "http" ); + kurl.setScheme( QStringLiteral("http") ); } - else if( kurl.scheme() == "pcast" ) + else if( kurl.scheme() == QLatin1String("pcast") ) { debug() << "pcast:// url."; - kurl.setScheme( "http" ); + kurl.setScheme( QStringLiteral("http") ); } - else if( kurl.scheme() == "feed" ) + else if( kurl.scheme() == QLatin1String("feed") ) { //TODO: also handle the case feed:https://example.com/entries.atom debug() << "feed:// url."; - kurl.setScheme( "http" ); + kurl.setScheme( QStringLiteral("http") ); } return kurl; } Playlists::PlaylistPtr -PodcastProvider::addPlaylist( Playlists::PlaylistPtr playlist ) +PodcastProvider::addPlaylist(Playlists::PlaylistPtr playlist ) { PodcastChannelPtr channel = PodcastChannelPtr::dynamicCast( playlist ); if( channel.isNull() ) @@ -78,7 +78,7 @@ } Meta::TrackPtr -PodcastProvider::addTrack( Meta::TrackPtr track ) +PodcastProvider::addTrack( const Meta::TrackPtr &track ) { PodcastEpisodePtr episode = PodcastEpisodePtr::dynamicCast( track ); if( episode.isNull() ) diff --git a/src/core/podcasts/PodcastReader.h b/src/core/podcasts/PodcastReader.h --- a/src/core/podcasts/PodcastReader.h +++ b/src/core/podcasts/PodcastReader.h @@ -40,20 +40,20 @@ @author Bart Cerneels Mathias Panzenböck */ -class AMAROK_CORE_EXPORT PodcastReader : public QObject +class AMAROKCORE_EXPORT PodcastReader : public QObject { Q_OBJECT public: /** Create a new PodcastReader that delivers the result to the podcastProvider. Note: the PodcastProvider pointer is not owned by the PodcastReader and must remain valid throughout the lifetime of this object. */ - PodcastReader( PodcastProvider *podcastProvider, QObject *parent = 0 ); + explicit PodcastReader( PodcastProvider *podcastProvider, QObject *parent = nullptr ); ~PodcastReader(); bool read( QIODevice *device ); bool read( const QUrl &url ); - bool update( Podcasts::PodcastChannelPtr channel ); + bool update(const PodcastChannelPtr &channel ); QUrl & url() { return m_url; } Podcasts::PodcastChannelPtr channel() { return m_channel; } @@ -129,7 +129,7 @@ class Action { public: - Action( ActionMap &actionMap ) + explicit Action( ActionMap &actionMap ) : m_actionMap( actionMap ) , m_begin( 0 ) , m_end( 0 ) @@ -375,7 +375,7 @@ the data of the current item */ Podcasts::PodcastMetaCommon *m_current; - // this somewhat emulates a callstack (whithout local variables): + // this somewhat emulates a callstack (without local variables): QStack m_actionStack; ContentType m_contentType; diff --git a/src/core/podcasts/PodcastReader.cpp b/src/core/podcasts/PodcastReader.cpp --- a/src/core/podcasts/PodcastReader.cpp +++ b/src/core/podcasts/PodcastReader.cpp @@ -55,7 +55,7 @@ , m_xmlReader() , m_podcastProvider( podcastProvider ) , m_transferJob( ) - , m_current( 0 ) + , m_current( nullptr ) , m_actionStack() , m_contentType( TextContent ) , m_buffer() @@ -84,7 +84,7 @@ // initialization of the feed parser automata: PodcastReader::StaticData::StaticData() - : removeScripts( "|]*>", Qt::CaseInsensitive ) + : removeScripts( QStringLiteral("|]*>"), Qt::CaseInsensitive ) , mightBeHtml( "<\\?xml[^>]*\\?>|]*>|]*>|<|>|&|"|" "<([-:\\w\\d]+)[^>]*(/>|>.*)|]*>|&#\\d+;|&#x[a-fA-F\\d]+;", Qt::CaseInsensitive ) , linkify( "\\b(" RE_URL ")|\\b(" RE_MAIL ")|(\n)" ) @@ -275,37 +275,37 @@ &PodcastReader::readAtomTextCharacters ) { // known elements: - knownElements[ "rss" ] = Rss; - knownElements[ "RDF" ] = Rdf; - knownElements[ "feed" ] = Feed; - knownElements[ "channel" ] = Channel; - knownElements[ "item" ] = Item; - knownElements[ "image" ] = Image; - knownElements[ "link" ] = Link; - knownElements[ "url" ] = Url; - knownElements[ "title" ] = Title; - knownElements[ "author" ] = Author; - knownElements[ "enclosure" ] = EnclosureElement; - knownElements[ "guid" ] = Guid; - knownElements[ "pubDate" ] = PubDate; - knownElements[ "description" ] = Description; - knownElements[ "summary" ] = Summary; - knownElements[ "body" ] = Body; - knownElements[ "entry" ] = Entry; - knownElements[ "content" ] = Content; - knownElements[ "name" ] = Name; - knownElements[ "id" ] = Id; - knownElements[ "subtitle" ] = Subtitle; - knownElements[ "updated" ] = Updated; - knownElements[ "published" ] = Published; - knownElements[ "logo" ] = Logo; - knownElements[ "icon" ] = Icon; - knownElements[ "encoded" ] = Encoded; - knownElements[ "creator" ] = Creator; - knownElements[ "keywords" ] = Keywords; - knownElements[ "new-feed-url" ] = NewFeedUrl; - knownElements[ "html" ] = Html; - knownElements[ "HTML" ] = Html; + knownElements[ QStringLiteral("rss") ] = Rss; + knownElements[ QStringLiteral("RDF") ] = Rdf; + knownElements[ QStringLiteral("feed") ] = Feed; + knownElements[ QStringLiteral("channel") ] = Channel; + knownElements[ QStringLiteral("item") ] = Item; + knownElements[ QStringLiteral("image") ] = Image; + knownElements[ QStringLiteral("link") ] = Link; + knownElements[ QStringLiteral("url") ] = Url; + knownElements[ QStringLiteral("title") ] = Title; + knownElements[ QStringLiteral("author") ] = Author; + knownElements[ QStringLiteral("enclosure") ] = EnclosureElement; + knownElements[ QStringLiteral("guid") ] = Guid; + knownElements[ QStringLiteral("pubDate") ] = PubDate; + knownElements[ QStringLiteral("description") ] = Description; + knownElements[ QStringLiteral("summary") ] = Summary; + knownElements[ QStringLiteral("body") ] = Body; + knownElements[ QStringLiteral("entry") ] = Entry; + knownElements[ QStringLiteral("content") ] = Content; + knownElements[ QStringLiteral("name") ] = Name; + knownElements[ QStringLiteral("id") ] = Id; + knownElements[ QStringLiteral("subtitle") ] = Subtitle; + knownElements[ QStringLiteral("updated") ] = Updated; + knownElements[ QStringLiteral("published") ] = Published; + knownElements[ QStringLiteral("logo") ] = Logo; + knownElements[ QStringLiteral("icon") ] = Icon; + knownElements[ QStringLiteral("encoded") ] = Encoded; + knownElements[ QStringLiteral("creator") ] = Creator; + knownElements[ QStringLiteral("keywords") ] = Keywords; + knownElements[ QStringLiteral("new-feed-url") ] = NewFeedUrl; + knownElements[ QStringLiteral("html") ] = Html; + knownElements[ QStringLiteral("HTML") ] = Html; // before start document/after end document rootMap.insert( Document, &docAction ); @@ -456,7 +456,7 @@ : i18n( "Updating \"%1\"", m_channel->title() ); } - emit statusBarNewProgressOperation( m_transferJob, description, this ); + Q_EMIT statusBarNewProgressOperation( m_transferJob, description, this ); // parse data return read(); @@ -469,7 +469,7 @@ } bool -PodcastReader::update( PodcastChannelPtr channel ) +PodcastReader::update( const PodcastChannelPtr &channel ) { DEBUG_BLOCK m_channel = channel; @@ -510,7 +510,7 @@ } errorMessage = errorMessage.append( job->errorString() ); - emit statusBarSorryMessage( errorMessage ); + Q_EMIT statusBarSorryMessage( errorMessage ); } else if( job->error() ) { @@ -524,10 +524,10 @@ } errorMessage = errorMessage.append( job->errorString() ); - emit statusBarSorryMessage( errorMessage ); + Q_EMIT statusBarSorryMessage( errorMessage ); } - m_transferJob = 0; + m_transferJob = nullptr; } PodcastReader::ElementType @@ -613,8 +613,8 @@ { DEBUG_BLOCK - m_current = 0; - m_item = 0; + m_current = nullptr; + m_item = nullptr; m_contentType = TextContent; m_buffer.clear(); m_actionStack.clear(); @@ -629,7 +629,7 @@ { // this is some kind of pushdown automata // with this it should be possible to parse feeds in parallel - // woithout using threads + // without using threads DEBUG_BLOCK while( !m_xmlReader.atEnd() && m_xmlReader.error() != QXmlStreamReader::CustomError ) @@ -643,7 +643,7 @@ if( m_xmlReader.hasError() ) { - emit finished( this ); + Q_EMIT finished( this ); return false; } @@ -654,7 +654,7 @@ } const Action* action = m_actionStack.top(); - const Action* subAction = 0; + const Action* subAction = nullptr; switch( token ) { @@ -691,8 +691,8 @@ { action->characters( this ); } - - // ignoreable whitespaces + break; + // ignorable whitespaces case QXmlStreamReader::Comment: case QXmlStreamReader::EntityReference: case QXmlStreamReader::ProcessingInstruction: @@ -714,10 +714,10 @@ if( m_transferJob ) { m_transferJob->kill(KJob::EmitResult); - m_transferJob = 0; + m_transferJob = nullptr; } - emit finished( this ); + Q_EMIT finished( this ); } void @@ -786,7 +786,7 @@ if( c == '&' ) { - int endIndex = text.indexOf( ';', i ); + int endIndex = text.indexOf( QLatin1Char(';'), i ); if( endIndex == -1 ) { @@ -823,29 +823,29 @@ { QString entity( text.mid( i + 1, endIndex - i - 1 ) ); - if( entity == "lt" ) + if( entity == QLatin1String("lt") ) { - buf += '<'; + buf += QLatin1Char('<'); i = endIndex; } - else if( entity == "gt" ) + else if( entity == QLatin1String("gt") ) { - buf += '>'; + buf += QLatin1Char('>'); i = endIndex; } - else if( entity == "amp" ) + else if( entity == QLatin1String("amp") ) { - buf += '&'; + buf += QLatin1Char('&'); i = endIndex; } - else if( entity == "apos" ) + else if( entity == QLatin1String("apos") ) { - buf += '\''; + buf += QLatin1Char('\''); i = endIndex; } - else if( entity == "quot" ) + else if( entity == QLatin1String("quot") ) { - buf += '"'; + buf += QLatin1Char('"'); i = endIndex; } else @@ -940,18 +940,18 @@ } else { - buf += QString( "
%1" ) + buf += QStringLiteral( "%1" ) .arg( s.toHtmlEscaped() ); } } else if( !(s = re.cap( 2 )).isEmpty() ) { - buf += QString( "%1" ) + buf += QStringLiteral( "%1" ) .arg( s.toHtmlEscaped() ); } else if( !re.cap( 3 ).isEmpty() ) { - buf += "
\n"; + buf += QLatin1String("
\n"); } index = re.pos() + re.matchedLength(); @@ -1003,7 +1003,7 @@ void PodcastReader::beginRss() { - if( m_xmlReader.attributes().value( "version" ) != "2.0" ) + if( m_xmlReader.attributes().value( QStringLiteral("version") ) != "2.0" ) { // TODO: change this string once we support more stopWithError( i18n( "%1 is not an RSS version 2.0 feed.", m_url.url() ) ); @@ -1056,7 +1056,7 @@ PodcastReader::endDocument() { debug() << "successfully parsed feed: " << m_url.url(); - emit finished( this ); + Q_EMIT finished( this ); } void @@ -1087,8 +1087,8 @@ // they only get changed when longer information is read as there is stored in // the appropriate field already. In order to still be able to correctly update // the feed's description/summary I set it here to the empty string: - m_channel->setDescription( "" ); - m_channel->setSummary( "" ); + m_channel->setDescription( QLatin1String("") ); + m_channel->setSummary( QLatin1String("") ); m_channel->setKeywords( QStringList() ); } @@ -1126,22 +1126,22 @@ if( !m_enclosures.isEmpty() ) { QString description( m_item->description() ); - description += "\n

"; + description += QLatin1String("\n

"); description += i18n( "Alternative Enclosures:" ); - description += "
\n

    "; + description += QLatin1String("
    \n
      "); foreach( const Enclosure& enclosure, m_enclosures ) { - description += QString( "
    • %2 (%3, %4)
    • " ) - .arg( enclosure.url().url().toHtmlEscaped() ) - .arg( enclosure.url().fileName().toHtmlEscaped() ) - .arg( Meta::prettyFilesize( enclosure.fileSize() ) ) - .arg( enclosure.mimeType().isEmpty() ? + description += QStringLiteral( "
    • %2 (%3, %4)
    • " ) + .arg( enclosure.url().url().toHtmlEscaped(), + enclosure.url().fileName().toHtmlEscaped(), + Meta::prettyFilesize( enclosure.fileSize() ), + enclosure.mimeType().isEmpty() ? i18n( "unknown type" ) : enclosure.mimeType().toHtmlEscaped() ); } - description += "

    "; + description += QLatin1String("

"); m_item->setDescription( description ); } @@ -1203,7 +1203,7 @@ // http://www.xs4all.nl/~foz/mod_enclosure.html QStringRef str; - str = m_xmlReader.attributes().value( "url" ); + str = m_xmlReader.attributes().value( QStringLiteral("url") ); if( str.isEmpty() ) str = attribute( RDF_NS, "about" ); @@ -1216,14 +1216,14 @@ QUrl url( str.toString() ); - str = m_xmlReader.attributes().value( "length" ); + str = m_xmlReader.attributes().value( QStringLiteral("length") ); if( str.isEmpty() ) str = attribute( ENC_NS, "length" ); int length = str.toString().toInt(); - str = m_xmlReader.attributes().value( "type" ); + str = m_xmlReader.attributes().value( QStringLiteral("type") ); if( str.isEmpty() ) str = attribute( ENC_NS, "type" ); @@ -1258,7 +1258,7 @@ { if( m_xmlReader.namespaceUri() == ITUNES_NS ) { - m_channel->setImageUrl( QUrl( m_xmlReader.attributes().value( "href" ).toString() ) ); + m_channel->setImageUrl( QUrl( m_xmlReader.attributes().value( QStringLiteral("href") ).toString() ) ); } } @@ -1274,7 +1274,7 @@ { QList keywords( m_current->keywords() ); - foreach( const QString &keyword, m_buffer.split( ',' ) ) + foreach( const QString &keyword, m_buffer.split( QLatin1Char(',') ) ) { QString kwd( keyword.simplified() ); if( !kwd.isEmpty() && !keywords.contains( kwd ) ) @@ -1325,9 +1325,9 @@ foreach( const QXmlStreamAttribute &attr, m_xmlReader.attributes() ) { - m_buffer += QString( " %1=\"%2\"" ) - .arg( attr.name().toString() ) - .arg( attr.value().toString().toHtmlEscaped() ); + m_buffer += QStringLiteral( " %1=\"%2\"" ) + .arg( attr.name().toString(), + attr.value().toString().toHtmlEscaped() ); } m_buffer += '>'; @@ -1559,7 +1559,7 @@ void PodcastReader::endXml() { - m_buffer += "'; } @@ -1585,7 +1585,7 @@ if( m_xmlReader.attributes().hasAttribute( namespaceUri, name ) ) return m_xmlReader.attributes().value( namespaceUri, name ); else - return m_xmlReader.attributes().value( NULL, name ); + return m_xmlReader.attributes().value( QString(), name ); } bool @@ -1595,7 +1595,7 @@ if( m_xmlReader.attributes().hasAttribute( namespaceUri, name ) ) return true; else - return m_xmlReader.attributes().hasAttribute( NULL, name ); + return m_xmlReader.attributes().hasAttribute( QString(), name ); } QDateTime @@ -1605,14 +1605,14 @@ QString parseInput = dateString; debug() << "Parsing pubdate: " << parseInput; - QRegExp rfcDateDayRegex( "^[A-Z]{1}[a-z]{2}\\s*,\\s*(.*)" ); + QRegExp rfcDateDayRegex( QStringLiteral("^[A-Z]{1}[a-z]{2}\\s*,\\s*(.*)") ); if( rfcDateDayRegex.indexIn( parseInput ) != -1 ) { parseInput = rfcDateDayRegex.cap(1); } //Hack around a to strict RFCDate implementation in KDateTime. //See http://bugs.kde.org/show_bug.cgi?id=231062 - QRegExp rfcMonthLowercase( "^\\d+\\s+\\b(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\\b" ); + QRegExp rfcMonthLowercase( QStringLiteral("^\\d+\\s+\\b(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\\b") ); if( rfcMonthLowercase.indexIn( parseInput ) != -1 ) { QString lowerMonth = rfcMonthLowercase.cap( 1 ); @@ -1645,7 +1645,7 @@ debug() << "permanently redirected to: " << toUrl.url(); m_url = toUrl; /* change the url for existing feeds as well. Permanent redirection means the old one - might dissapear soon. */ + might disappear soon. */ if( m_channel ) m_channel->setUrl( m_url ); } diff --git a/src/core/storage/StorageFactory.h b/src/core/storage/StorageFactory.h --- a/src/core/storage/StorageFactory.h +++ b/src/core/storage/StorageFactory.h @@ -33,7 +33,7 @@ * that have the same symbols. * */ -class AMAROK_CORE_EXPORT StorageFactory : public Plugins::PluginFactory +class AMAROKCORE_EXPORT StorageFactory : public Plugins::PluginFactory { Q_OBJECT @@ -48,12 +48,12 @@ void newStorage( QSharedPointer newStorage ); /** - * The factories will not emit the newStorage signal in case + * The factories will not Q_EMIT the newStorage signal in case * of initialization problems. - * In order to report their issues they will instead emit + * In order to report their issues they will instead Q_EMIT * newError with the list of errors. */ - void newError( QStringList errorMessageList ); + void newError( const QStringList &errorMessageList ); }; #endif /* AMAROK_STORAGE_FACTORY_H */ diff --git a/src/core/support/Amarok.h b/src/core/support/Amarok.h --- a/src/core/support/Amarok.h +++ b/src/core/support/Amarok.h @@ -30,10 +30,8 @@ class QColor; class QDateTime; -class QEvent; class QMutex; class QPixmap; -class QWidget; namespace KIO { class Job; } @@ -63,21 +61,21 @@ } /** The version of the playlist XML format. Increase whenever it changes backwards-incompatibly. */ - inline QString xmlVersion() { return "2.4"; } + inline QString xmlVersion() { return QStringLiteral("2.4"); } /** * Convenience function to return the QApplication instance KConfig object * pre-set to a specific group. * @param group Will pre-set the KConfig object to this group. */ /* FIXME: This function can lead to very bizarre and hard to figure bugs. While we don`t fix it properly, use it like this: amarok::config( Group )->readEntry( ... ) */ - AMAROK_CORE_EXPORT KConfigGroup config( const QString &group = "General" ); + AMAROKCORE_EXPORT KConfigGroup config( const QString &group = QStringLiteral("General") ); /** * @return the KActionCollection used by Amarok */ - AMAROK_CORE_EXPORT KActionCollection *actionCollection(); + AMAROKCORE_EXPORT KActionCollection *actionCollection(); /** * Compute score for a track that has finished playing. @@ -102,33 +100,33 @@ */ class OverrideCursor { public: - OverrideCursor( Qt::CursorShape cursor = Qt::WaitCursor ); + explicit OverrideCursor( Qt::CursorShape cursor = Qt::WaitCursor ); ~OverrideCursor(); }; /** * For saving files to ~/.local/share/amarok/ * @param directory: Subdirectory of ~/.local/share/amarok/ to save files to. */ - AMAROK_CORE_EXPORT QString saveLocation( const QString &directory = QString() ); + AMAROKCORE_EXPORT QString saveLocation( const QString &directory = QString() ); - AMAROK_CORE_EXPORT QString defaultPlaylistPath(); + AMAROKCORE_EXPORT QString defaultPlaylistPath(); - AMAROK_CORE_EXPORT QString verboseTimeSince( const QDateTime &datetime ); - AMAROK_CORE_EXPORT QString verboseTimeSince( uint time_t ); - AMAROK_CORE_EXPORT QString conciseTimeSince( uint time_t ); + AMAROKCORE_EXPORT QString verboseTimeSince( const QDateTime &datetime ); + AMAROKCORE_EXPORT QString verboseTimeSince( uint time_t ); + AMAROKCORE_EXPORT QString conciseTimeSince( uint time_t ); /** * @return the LOWERCASE file extension without the preceding '.', or "" if there is none */ inline QString extension( const QString &fileName ) { - if( fileName.contains( '.' ) ) + if( fileName.contains( QLatin1Char('.') ) ) { - QString ext = fileName.mid( fileName.lastIndexOf( '.' ) + 1 ).toLower(); + QString ext = fileName.mid( fileName.lastIndexOf( QLatin1Char('.') ) + 1 ).toLower(); // Remove url parameters (some remote playlists use these) - if( ext.contains( '?' ) ) - return ext.left( ext.indexOf( '?' ) ); + if( ext.contains( QLatin1Char('?') ) ) + return ext.left( ext.indexOf( QLatin1Char('?') ) ); return ext; } @@ -157,14 +155,14 @@ * @param path The original path. * @return The cleaned up path. */ - AMAROK_CORE_EXPORT QString cleanPath( const QString &path ); + AMAROKCORE_EXPORT QString cleanPath( const QString &path ); /** * Replaces all non-ASCII characters with '_'. * @param path The original path. * @return The ASCIIfied path. */ - AMAROK_CORE_EXPORT QString asciiPath( const QString &path ); + AMAROKCORE_EXPORT QString asciiPath( const QString &path ); /** * Define how Amarok::vfatPath() should behave wrt path separators: @@ -188,9 +186,10 @@ * reserved device names are being prefixed with '_' * for file/folder names or extensions that end with a space it will be replaced by '_' * @param path The original path. + * @param behaviour see PathSeparatorBehaviour. * @return The cleaned up path. */ - AMAROK_CORE_EXPORT QString vfatPath( const QString &path, + AMAROKCORE_EXPORT QString vfatPath( const QString &path, PathSeparatorBehaviour behaviour = AutoBehaviour ); /* defined in browsers/CollectionTreeItemModel.cpp */ @@ -200,20 +199,20 @@ * @param str the string to manipulate * @param reverse if true, The Eagles -> Eagles, The. If false, Eagles, The -> The Eagles */ - AMAROK_CORE_EXPORT void manipulateThe( QString &str, bool reverse ); + AMAROKCORE_EXPORT void manipulateThe( QString &str, bool reverse ); /** * Return a playlist name based on the artist and album info of the tracks or a string * containing the creation date. */ - AMAROK_CORE_EXPORT QString generatePlaylistName( const Meta::TrackList tracks ); + AMAROKCORE_EXPORT QString generatePlaylistName( const Meta::TrackList &tracks ); /** * Creates a semi-transparent Amarok logo for suitable for painting. * @param dim width of the logo * @return A QPixmap of the logo */ - AMAROK_CORE_EXPORT QPixmap semiTransparentLogo( int dim ); + AMAROKCORE_EXPORT QPixmap semiTransparentLogo( int dim ); inline const char* discogsApiKey() { return "91734dd989"; } inline const char* lastfmApiKey() { return "402d3ca8e9bc9d3cf9b85e1202944ca5"; } diff --git a/src/core/support/Amarok.cpp b/src/core/support/Amarok.cpp --- a/src/core/support/Amarok.cpp +++ b/src/core/support/Amarok.cpp @@ -54,7 +54,7 @@ return i18nc( "When this track was last played", "Unknown" ); if( datediff >= 6*7 /*six weeks*/ ) { // return absolute month/year - QString month_year = datetime.date().toString("MM yyyy"); + QString month_year = datetime.date().toString(QStringLiteral("MM yyyy")); return i18nc( "monthname year", "%1", month_year ); } @@ -126,27 +126,27 @@ //TODO are we too specific here? Be more fuzzy? ie, use units of 5 minutes, or "Recently" if( timediff >= 60 ) // return difference in minutes - return QString("%1'").arg( ( timediff + 30 )/60 ); + return QStringLiteral("%1'").arg( ( timediff + 30 )/60 ); if( timediff >= 0 ) // return difference in seconds - return QString("%1\"").arg( ( timediff + 1 )/60 ); + return QStringLiteral("%1\"").arg( ( timediff + 1 )/60 ); return i18n( "0" ); } void manipulateThe( QString &str, bool reverse ) { if( reverse ) { - if( !str.startsWith( "the ", Qt::CaseInsensitive ) ) + if( !str.startsWith( QLatin1String("the "), Qt::CaseInsensitive ) ) return; QString begin = str.left( 3 ); str = str.append( ", %1" ).arg( begin ); str = str.mid( 4 ); return; } - if( !str.endsWith( ", the", Qt::CaseInsensitive ) ) + if( !str.endsWith( QLatin1String(", the"), Qt::CaseInsensitive ) ) return; QString end = str.right( 3 ); @@ -157,11 +157,11 @@ str.truncate( newLen ); } - QString generatePlaylistName( const Meta::TrackList tracks ) + QString generatePlaylistName( const Meta::TrackList& tracks ) { QString datePart = QLocale::system().toString( QDateTime::currentDateTime(), QLocale::ShortFormat ); - if( tracks.count() == 0 ) + if( tracks.isEmpty() ) { return i18nc( "A saved playlist with the current time (KLocalizedString::Shortdate) added between \ the parentheses", @@ -232,7 +232,7 @@ if( !actionCollectionObject ) { actionCollectionObject = new KActionCollection( qApp ); - actionCollectionObject->setObjectName( "Amarok-KActionCollection" ); + actionCollectionObject->setObjectName( QStringLiteral("Amarok-KActionCollection") ); } return actionCollectionObject.data(); @@ -296,17 +296,17 @@ QString result = path; // German umlauts - result.replace( QChar(0x00e4), "ae" ).replace( QChar(0x00c4), "Ae" ); - result.replace( QChar(0x00f6), "oe" ).replace( QChar(0x00d6), "Oe" ); - result.replace( QChar(0x00fc), "ue" ).replace( QChar(0x00dc), "Ue" ); - result.replace( QChar(0x00df), "ss" ); + result.replace( QChar(0x00e4), QLatin1String("ae") ).replace( QChar(0x00c4), QLatin1String("Ae") ); + result.replace( QChar(0x00f6), QLatin1String("oe") ).replace( QChar(0x00d6), QLatin1String("Oe") ); + result.replace( QChar(0x00fc), QLatin1String("ue") ).replace( QChar(0x00dc), QLatin1String("Ue") ); + result.replace( QChar(0x00df), QLatin1String("ss") ); // other special cases - result.replace( QChar(0x00C6), "AE" ); - result.replace( QChar(0x00E6), "ae" ); + result.replace( QChar(0x00C6), QLatin1String("AE") ); + result.replace( QChar(0x00E6), QLatin1String("ae") ); - result.replace( QChar(0x00D8), "OE" ); - result.replace( QChar(0x00F8), "oe" ); + result.replace( QChar(0x00D8), QLatin1String("OE") ); + result.replace( QChar(0x00F8), QLatin1String("oe") ); // normalize in a form where accents are separate characters result = result.normalized( QString::NormalizationForm_D ); @@ -337,19 +337,21 @@ QString vfatPath( const QString &path, PathSeparatorBehaviour behaviour ) { + if( path.isEmpty() ) + return QString(); + QString s = path; - if( behaviour == AutoBehaviour ) - behaviour = ( QDir::separator() == '/' ) ? UnixBehaviour : WindowsBehaviour; + QChar separator = ( behaviour == AutoBehaviour ) ? QDir::separator() : ( behaviour == UnixBehaviour ) ? '/' : '\\'; if( behaviour == UnixBehaviour ) // we are on *nix, \ is a valid character in file or directory names, NOT the dir separator s.replace( '\\', '_' ); else - s.replace( '/', '_' ); // on windows we have to replace / instead + s.replace( QLatin1Char('/'), '_' ); // on windows we have to replace / instead int start = 0; #ifdef Q_OS_WIN - // exclude the leading "C:/" from special character replecement in the loop below + // exclude the leading "C:/" from special character replacement in the loop below // bug 279560, bug 302251 if( QDir::isAbsolutePath( s ) ) start = 3; @@ -373,43 +375,56 @@ if( len == 3 || (len > 3 && s[3] == '.') ) { QString l = s.left(3).toLower(); - if( l=="aux" || l=="con" || l=="nul" || l=="prn" ) + if( l==QLatin1String("aux") || l==QLatin1String("con") || l==QLatin1String("nul") || l==QLatin1String("prn") ) s = '_' + s; } else if( len == 4 || (len > 4 && s[4] == '.') ) { QString l = s.left(3).toLower(); QString d = s.mid(3,1); - if( (l=="com" || l=="lpt") && - (d=="0" || d=="1" || d=="2" || d=="3" || d=="4" || - d=="5" || d=="6" || d=="7" || d=="8" || d=="9") ) + if( (l==QLatin1String("com") || l==QLatin1String("lpt")) && + (d==QLatin1String("0") || d==QLatin1String("1") || d==QLatin1String("2") || d==QLatin1String("3") || d==QLatin1String("4") || + d==QLatin1String("5") || d==QLatin1String("6") || d==QLatin1String("7") || d==QLatin1String("8") || d==QLatin1String("9")) ) s = '_' + s; } // "clock$" is only allowed WITH extension, according to: // http://en.wikipedia.org/w/index.php?title=Filename&oldid=303934888#Comparison_of_file_name_limitations - if( QString::compare( s, "clock$", Qt::CaseInsensitive ) == 0 ) + if( QString::compare( s, QStringLiteral("clock$"), Qt::CaseInsensitive ) == 0 ) s = '_' + s; /* max path length of Windows API */ s = s.left(255); - /* whitespace at the end of folder/file names or extensions are bad */ + /* whitespace or dot at the end of folder/file names or extensions are bad */ len = s.length(); - if( s[len-1] == ' ' ) - s[len-1] = '_'; - - int extensionIndex = s.lastIndexOf( '.' ); // correct trailing spaces in file name itself - if( ( s.length() > 1 ) && ( extensionIndex > 0 ) ) - if( s.at( extensionIndex - 1 ) == ' ' ) - s[extensionIndex - 1] = '_'; + if( s.at(len - 1) == ' ' || s.at(len - 1) == '.' ) + s[len - 1] = '_'; for( int i = 1; i < s.length(); i++ ) // correct trailing whitespace in folder names { - if( ( s.at( i ) == QDir::separator() ) && ( s.at( i - 1 ) == ' ' ) ) + if( s.at(i) == separator && s.at(i - 1) == ' ' ) s[i - 1] = '_'; } + for( int i = 1; i < s.length(); i++ ) // correct trailing dot in folder names, excluding . and .. + { + if( s.at(i) == separator + && s.at(i - 1) == '.' + && !( i == 1 // ./any + || ( i == 2 && s.at(i - 2) == '.' ) // ../any + || ( i >= 2 && s.at(i - 2) == separator ) // any/./any + || ( i >= 3 && s.at(i - 3) == separator && s.at(i - 2) == '.' ) // any/../any + ) ) + s[i - 1] = '_'; + } + + /* correct trailing spaces in file name itself, not needed for dots */ + int extensionIndex = s.lastIndexOf( QLatin1Char('.') ); + if( ( s.length() > 1 ) && ( extensionIndex > 0 ) ) + if( s.at(extensionIndex - 1) == ' ' ) + s[extensionIndex - 1] = '_'; + return s; } @@ -419,7 +434,7 @@ #define AMAROK_LOGO_CACHE_KEY QLatin1String("AmarokSemiTransparentLogo")+QString::number(dim) if( !QPixmapCache::find( AMAROK_LOGO_CACHE_KEY, &logo ) ) { - QImage amarokIcon = QIcon::fromTheme( QLatin1String("amarok") ).pixmap( dim, dim ).toImage(); + QImage amarokIcon = QIcon::fromTheme( QStringLiteral("amarok") ).pixmap( dim, dim ).toImage(); amarokIcon = amarokIcon.convertToFormat( QImage::Format_ARGB32 ); QRgb *data = reinterpret_cast( amarokIcon.bits() ); QRgb *end = data + amarokIcon.byteCount() / 4; diff --git a/src/core/support/Components.h b/src/core/support/Components.h --- a/src/core/support/Components.h +++ b/src/core/support/Components.h @@ -22,7 +22,6 @@ namespace Amarok { class ApplicationController; - class Logger; } namespace Collections @@ -48,29 +47,26 @@ { namespace Components { - AMAROK_CORE_EXPORT CollectionManager *collectionManager(); - AMAROK_CORE_EXPORT CollectionManager *setCollectionManager( CollectionManager *mgr ); + AMAROKCORE_EXPORT CollectionManager *collectionManager(); + AMAROKCORE_EXPORT CollectionManager *setCollectionManager( CollectionManager *mgr ); - AMAROK_CORE_EXPORT EngineController *engineController(); - AMAROK_CORE_EXPORT EngineController *setEngineController( EngineController *controller ); + AMAROKCORE_EXPORT EngineController *engineController(); + AMAROKCORE_EXPORT EngineController *setEngineController( EngineController *controller ); - AMAROK_CORE_EXPORT SqlStorage *sqlStorage(); - AMAROK_CORE_EXPORT SqlStorage *setSqlStorage( SqlStorage *storage ); + AMAROKCORE_EXPORT SqlStorage *sqlStorage(); + AMAROKCORE_EXPORT SqlStorage *setSqlStorage( SqlStorage *storage ); - AMAROK_CORE_EXPORT Amarok::Logger *logger(); - AMAROK_CORE_EXPORT Amarok::Logger *setLogger( Amarok::Logger *logger ); + AMAROKCORE_EXPORT Amarok::ApplicationController *applicationController(); + AMAROKCORE_EXPORT Amarok::ApplicationController *setApplicationController( Amarok::ApplicationController *controller ); - AMAROK_CORE_EXPORT Amarok::ApplicationController *applicationController(); - AMAROK_CORE_EXPORT Amarok::ApplicationController *setApplicationController( Amarok::ApplicationController *controller ); + AMAROKCORE_EXPORT Collections::CollectionLocationDelegate *collectionLocationDelegate(); + AMAROKCORE_EXPORT Collections::CollectionLocationDelegate *setCollectionLocationDelegate( Collections::CollectionLocationDelegate *delegate ); - AMAROK_CORE_EXPORT Collections::CollectionLocationDelegate *collectionLocationDelegate(); - AMAROK_CORE_EXPORT Collections::CollectionLocationDelegate *setCollectionLocationDelegate( Collections::CollectionLocationDelegate *delegate ); + AMAROKCORE_EXPORT Transcoding::Controller *transcodingController(); + AMAROKCORE_EXPORT Transcoding::Controller *setTranscodingController( Transcoding::Controller *controller ); - AMAROK_CORE_EXPORT Transcoding::Controller *transcodingController(); - AMAROK_CORE_EXPORT Transcoding::Controller *setTranscodingController( Transcoding::Controller *controller ); - - AMAROK_CORE_EXPORT StatSyncing::Controller *statSyncingController(); - AMAROK_CORE_EXPORT StatSyncing::Controller *setStatSyncingController( StatSyncing::Controller *controller ); + AMAROKCORE_EXPORT StatSyncing::Controller *statSyncingController(); + AMAROKCORE_EXPORT StatSyncing::Controller *setStatSyncingController( StatSyncing::Controller *controller ); } } diff --git a/src/core/support/Components.cpp b/src/core/support/Components.cpp --- a/src/core/support/Components.cpp +++ b/src/core/support/Components.cpp @@ -15,16 +15,15 @@ ****************************************************************************************/ #include "core/support/Components.h" - +#include class ComponentsPrivate { public: ComponentsPrivate() : collectionManager( 0 ) , engineController( 0 ) , sqlStorage( 0 ) - , logger( 0 ) , applicationController( 0 ) , collectionLocationDelegate( 0 ) , transcodingController( 0 ) @@ -34,7 +33,6 @@ CollectionManager *collectionManager; EngineController *engineController; SqlStorage *sqlStorage; - Amarok::Logger *logger; Amarok::ApplicationController *applicationController; Collections::CollectionLocationDelegate *collectionLocationDelegate; Transcoding::Controller *transcodingController; @@ -67,8 +65,6 @@ COMPONENT_ACCESSORS( SqlStorage*, sqlStorage, setSqlStorage ) -COMPONENT_ACCESSORS( Amarok::Logger*, logger, setLogger ) - COMPONENT_ACCESSORS( Amarok::ApplicationController*, applicationController, setApplicationController ) COMPONENT_ACCESSORS( Collections::CollectionLocationDelegate*, collectionLocationDelegate, setCollectionLocationDelegate ) diff --git a/src/core/support/Debug.h b/src/core/support/Debug.h --- a/src/core/support/Debug.h +++ b/src/core/support/Debug.h @@ -68,11 +68,7 @@ #define DEBUG_ASSERT_STRINGIFY(x) DEBUG_ASSERT_STRINGIFY_INTERNAL(x) // END__: DEBUG_ASSERT -#if QT_VERSION >= 0x040700 # include -#else -# include -#endif // Platform specific macros #ifdef _WIN32 @@ -120,7 +116,7 @@ */ namespace Debug { - extern AMAROK_CORE_EXPORT QMutex mutex; + extern AMAROKCORE_EXPORT QMutex mutex; // from kdebug.h enum DebugLevel { @@ -130,12 +126,12 @@ KDEBUG_FATAL = 3 }; - AMAROK_CORE_EXPORT QDebug dbgstream( DebugLevel level = KDEBUG_INFO ); - AMAROK_CORE_EXPORT bool debugEnabled(); - AMAROK_CORE_EXPORT bool debugColorEnabled(); - AMAROK_CORE_EXPORT void setDebugEnabled( bool enable ); - AMAROK_CORE_EXPORT void setColoredDebug( bool enable ); - AMAROK_CORE_EXPORT QString indent(); + AMAROKCORE_EXPORT QDebug dbgstream( DebugLevel level = KDEBUG_INFO ); + AMAROKCORE_EXPORT bool debugEnabled(); + AMAROKCORE_EXPORT bool debugColorEnabled(); + AMAROKCORE_EXPORT void setDebugEnabled( bool enable ); + AMAROKCORE_EXPORT void setColoredDebug( bool enable ); + AMAROKCORE_EXPORT QString indent(); static inline QDebug dbgstreamwrapper( DebugLevel level ) { #ifdef DEBUG_PREFIX @@ -150,7 +146,7 @@ static inline QDebug error() { return dbgstreamwrapper( KDEBUG_ERROR ); } static inline QDebug fatal() { return dbgstreamwrapper( KDEBUG_FATAL ); } - AMAROK_CORE_EXPORT void perfLog( const QString &message, const QString &func ); + AMAROKCORE_EXPORT void perfLog( const QString &message, const QString &func ); } using Debug::debug; @@ -205,8 +201,8 @@ class Block { public: - AMAROK_CORE_EXPORT Block( const char *name ); - AMAROK_CORE_EXPORT ~Block(); + AMAROKCORE_EXPORT explicit Block( const char *name ); + AMAROKCORE_EXPORT ~Block(); private: QElapsedTimer m_startTime; @@ -235,7 +231,7 @@ * app: Stamp: 2 * */ - AMAROK_CORE_EXPORT void stamp(); + AMAROKCORE_EXPORT void stamp(); /** * @class Debug::List diff --git a/src/core/support/Debug.cpp b/src/core/support/Debug.cpp --- a/src/core/support/Debug.cpp +++ b/src/core/support/Debug.cpp @@ -37,7 +37,7 @@ #define DEBUG_INDENT_OBJECTNAME QLatin1String("Debug_Indent_object") -AMAROK_CORE_EXPORT QMutex Debug::mutex( QMutex::Recursive ); +AMAROKCORE_EXPORT QMutex Debug::mutex( QMutex::Recursive ); using namespace Debug; @@ -76,11 +76,11 @@ switch( level ) { case KDEBUG_WARN: - return "[WARNING]"; + return QStringLiteral("[WARNING]"); case KDEBUG_ERROR: - return "[ERROR__]"; + return QStringLiteral("[ERROR__]"); case KDEBUG_FATAL: - return "[FATAL__]"; + return QStringLiteral("[FATAL__]"); default: return QString(); } @@ -104,15 +104,15 @@ if( !debugColorEnabled() ) return text; - return QString( "\x1b[00;3%1m%2\x1b[00;39m" ).arg( QString::number(s_colors[color]), text ); + return QStringLiteral( "\x1b[00;3%1m%2\x1b[00;39m" ).arg( QString::number(s_colors[color]), text ); } static QString reverseColorize( const QString &text, int color ) { if( !debugColorEnabled() ) return text; - return QString( "\x1b[07;3%1m%2\x1b[00;39m" ).arg( QString::number(color), text ); + return QStringLiteral( "\x1b[07;3%1m%2\x1b[00;39m" ).arg( QString::number(color), text ); } QString Debug::indent() @@ -149,7 +149,7 @@ const QString currentIndent = indent(); mutex.unlock(); - QString text = QString("%1%2").arg( APP_PREFIX ).arg( currentIndent ); + QString text = QStringLiteral("%1%2").arg( APP_PREFIX ).arg( currentIndent ); if ( level > KDEBUG_INFO ) text.append( ' ' + reverseColorize( toString(level), toColor( level ) ) ); @@ -162,7 +162,7 @@ if( !debugEnabled() ) return; - QString str = QString( "MARK: %1: %2 %3" ).arg( qApp->applicationName(), func, message ); + QString str = QStringLiteral( "MARK: %1: %2 %3" ).arg( qApp->applicationName(), func, message ); access( str.toLocal8Bit().data(), F_OK ); #endif } @@ -174,11 +174,7 @@ if( !debugEnabled() ) return; -#if QT_VERSION >= 0x040700 m_startTime.start(); -#else - m_startTime = QTime::currentTime(); -#endif mutex.lock(); s_colorIndex = (s_colorIndex + 1) % 5; @@ -194,11 +190,7 @@ if( !debugEnabled() ) return; -#if QT_VERSION >= 0x040700 double duration = m_startTime.elapsed() / 1000.0; -#else - double duration = (double)m_startTime.msecsTo( QTime::currentTime() ) / 1000.0; -#endif mutex.lock(); IndentPrivate::instance()->m_string.truncate( Debug::indent().length() - 2 ); diff --git a/src/core/support/Debug_p.h b/src/core/support/Debug_p.h --- a/src/core/support/Debug_p.h +++ b/src/core/support/Debug_p.h @@ -27,7 +27,7 @@ : public QObject { private: - explicit IndentPrivate(QObject* parent = 0); + explicit IndentPrivate(QObject* parent = nullptr); public: static IndentPrivate* instance(); @@ -42,19 +42,19 @@ { open(WriteOnly); } - bool isSequential() const Q_DECL_OVERRIDE + bool isSequential() const override { return true; } - qint64 readData(char *, qint64) Q_DECL_OVERRIDE + qint64 readData(char *, qint64) override { return 0; } - qint64 readLineData(char *, qint64) Q_DECL_OVERRIDE + qint64 readLineData(char *, qint64) override { return 0; } - qint64 writeData(const char *, qint64 len) Q_DECL_OVERRIDE + qint64 writeData(const char *, qint64 len) override { return len; } diff --git a/src/core/support/PluginFactory.h b/src/core/support/PluginFactory.h --- a/src/core/support/PluginFactory.h +++ b/src/core/support/PluginFactory.h @@ -34,7 +34,7 @@ * - StoragePlugin * */ -class AMAROK_CORE_EXPORT PluginFactory : public QObject +class AMAROKCORE_EXPORT PluginFactory : public QObject { Q_OBJECT diff --git a/src/core/support/SemaphoreReleaser.h b/src/core/support/SemaphoreReleaser.h --- a/src/core/support/SemaphoreReleaser.h +++ b/src/core/support/SemaphoreReleaser.h @@ -18,17 +18,17 @@ #define SEMAPHORERELEASER_H #include "core/amarokcore_export.h" - +#include class QSemaphore; /** * Helper RAII class that releases passed QSemaphore upon deletion. Similar to * QMutexLocker. */ -class AMAROK_CORE_EXPORT SemaphoreReleaser +class AMAROKCORE_EXPORT SemaphoreReleaser { public: - SemaphoreReleaser( QSemaphore *semaphore ); + explicit SemaphoreReleaser( QSemaphore *semaphore ); ~SemaphoreReleaser(); /** diff --git a/src/core/support/SmartPointerList.h b/src/core/support/SmartPointerList.h deleted file mode 100644 --- a/src/core/support/SmartPointerList.h +++ /dev/null @@ -1,211 +0,0 @@ -/**************************************************************************************** - * Copyright (c) 2009 Mark Kretschmann * - * Copyright (c) 2009 Ian Monroe * - * Copyright (c) 2009 Max Howell * - * * - * This program is free software; you can redistribute it and/or modify it under * - * the terms of the GNU General Public License as published by the Free Software * - * Foundation; either version 2 of the License, or (at your option) any later * - * version. * - * * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY * - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * - * PARTICULAR PURPOSE. See the GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License along with * - * this program. If not, see . * - ****************************************************************************************/ - -#ifndef AMAROK_SMART_POINTER_LIST_H -#define AMAROK_SMART_POINTER_LIST_H - -#include "core/amarokcore_export.h" - -#include //baseclass -#include //baseclass - -#ifdef Q_CC_MSVC -class SmartPointerListDaddy : public QObject -#else -class AMAROK_CORE_EXPORT SmartPointerListDaddy : public QObject -#endif -{ - Q_OBJECT - QList& m_list; - -public: -#ifdef Q_CC_MSVC - AMAROK_CORE_EXPORT SmartPointerListDaddy( QList* list ) : m_list( *list ) -#else - SmartPointerListDaddy( QList* list ) : m_list( *list ) -#endif - {} - -private Q_SLOTS: - void onDestroyed() - { - m_list.removeAll( sender() ); - } -}; - -/** QList has no virtual functions, so we inherit privately and define the - * interface exactly to ensure users can't write code that breaks the - * class's internal behaviour. - * - * I deliberately didn't define clear. I worried people would assume it - * deleted the pointers. Or assume it didn't. I didn't expose a few other - * functions for that reason. - * - * non-const iterator functions are not exposed as they access the QList - * baseclass, and then the Daddy wouldn't be watching newly inserted items. - * - * --mxcl - * Exposed clear. This class doesn't have a QPtrList autodelete functionality - * ever, so if people think that, they're really confused! -- Ian Monroe - * - */ -template class SmartPointerList : private QList -{ - class SmartPointerListDaddy* m_daddy; - -public: - SmartPointerList() : m_daddy( new SmartPointerListDaddy( (QList*)this ) ) - {} - - ~SmartPointerList() - { - delete m_daddy; - } - - SmartPointerList( const SmartPointerList& that ) - : QList() - , m_daddy( new SmartPointerListDaddy( (QList*)this ) ) - { - QListIterator i( that ); - while (i.hasNext()) - append( i.next() ); - } - - SmartPointerList& operator=( const SmartPointerList& that ) - { - QListIterator i( *this); - while (i.hasNext()) - QObject::disconnect( m_daddy, 0, i.next(), 0 ); - - QList::operator=( that ); - - if (this != &that) { - QListIterator i( that ); - while (i.hasNext()) - m_daddy->connect( i.next(), SIGNAL(destroyed()), SLOT(onDestroyed()) ); - } - - return *this; - } - - // keep same function names as Qt - void append( T* o ) - { - m_daddy->connect( o, SIGNAL(destroyed()), SLOT(onDestroyed()) ); - QList::append( o ); - } - - void prepend( T* o ) - { - m_daddy->connect( o, SIGNAL(destroyed()), SLOT(onDestroyed()) ); - QList::prepend( o ); - } - - SmartPointerList& operator+=( T* o ) - { - append( o ); - return *this; - } - - SmartPointerList& operator<<( T* o ) - { - return operator+=( o ); - } - - SmartPointerList operator+( const SmartPointerList that ) - { - SmartPointerList copy = *this; - QListIterator i( that ); - while (i.hasNext()) - copy.append( i.next() ); - return copy; - } - - SmartPointerList& operator+=( const SmartPointerList that ) - { - QListIterator i( that ); - while (i.hasNext()) - append( i.next() ); - return *this; - } - - void push_back( T* o ) - { - append( o ); - } - - void push_front( T* o ) - { - prepend( o ); - } - - void replace( int i, T* o ) - { - QList::replace( i, o ); - m_daddy->connect( o, SIGNAL(destroyed()), SLOT(onDestroyed()) ); - } - - /** this is a "safe" class. We always bounds check */ - inline T* operator[]( int index ) const { return QList::value( index ); } - inline T* at( int index ) const { return QList::value( index ); } - - // make public safe functions again - using QList::back; - using QList::constBegin; - using QList::constEnd; - using typename QList::const_iterator; - using QList::contains; - using QList::count; - using QList::empty; - using QList::erase; - using QList::first; - using QList::front; - using QList::indexOf; - using QList::insert; - using QList::isEmpty; - using QList::last; - using QList::lastIndexOf; - using QList::mid; - using QList::move; - using QList::pop_back; - using QList::pop_front; - using QList::size; - using QList::swap; - using QList::value; - using QList::operator!=; - using QList::operator==; - - // can't use using directive here since we only want the const versions - typename QList::const_iterator begin() const { return QList::constBegin(); } - typename QList::const_iterator end() const { return QList::constEnd(); } - - // it can lead to poor performance situations if we don't disconnect - // but I think it's not worth making this class more complicated for such - // an edge case - using QList::clear; - using QList::removeAll; - using QList::removeAt; - using QList::removeFirst; - using QList::removeLast; - using QList::removeOne; - using QList::takeAt; - using QList::takeFirst; - using QList::takeLast; -}; - -#endif //HEADER_GUARD diff --git a/src/core/support/SmartPointerList.cpp b/src/core/support/SmartPointerList.cpp deleted file mode 100644 --- a/src/core/support/SmartPointerList.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/**************************************************************************************** - * Copyright (c) 2009 Nikolaj Hald Nielsen * - * Copyright (c) 2009 Mark Kretschmann * - * Copyright (c) 2009 Ian Monroe * - * * - * This program is free software; you can redistribute it and/or modify it under * - * the terms of the GNU General Public License as published by the Free Software * - * Foundation; either version 2 of the License, or (at your option) any later * - * version. * - * * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY * - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * - * PARTICULAR PURPOSE. See the GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License along with * - * this program. If not, see . * - ****************************************************************************************/ - -//A file to make automoc happy - -#include "core/support/SmartPointerList.h" - diff --git a/src/core/transcoding/TranscodingConfiguration.h b/src/core/transcoding/TranscodingConfiguration.h --- a/src/core/transcoding/TranscodingConfiguration.h +++ b/src/core/transcoding/TranscodingConfiguration.h @@ -35,7 +35,7 @@ * Transcoding::PropertyList. It contains all the data needed to start a Transcoding::Job. * @author Téo Mrnjavac */ -class AMAROK_CORE_EXPORT Configuration +class AMAROKCORE_EXPORT Configuration { public: @@ -82,8 +82,8 @@ bool isJustCopy( const Meta::TrackPtr &srcTrack = Meta::TrackPtr(), const QStringList &playableFileTypes = QStringList() ) const; - QVariant property( QByteArray name ) const; - void addProperty( QByteArray name, QVariant value ); + QVariant property( const QByteArray &name ) const; + void addProperty(const QByteArray &name, const QVariant &value ); /** * Re-create transcoding configuration from serialized form stored in a KConfigGroup. diff --git a/src/core/transcoding/TranscodingConfiguration.cpp b/src/core/transcoding/TranscodingConfiguration.cpp --- a/src/core/transcoding/TranscodingConfiguration.cpp +++ b/src/core/transcoding/TranscodingConfiguration.cpp @@ -34,13 +34,13 @@ } void -Configuration::addProperty( QByteArray name, QVariant value ) +Configuration::addProperty( const QByteArray &name, const QVariant &value ) { m_values.insert( name, value ); } QVariant -Configuration::property( QByteArray name ) const +Configuration::property( const QByteArray &name ) const { return m_values.value( name ); } @@ -58,19 +58,19 @@ Controller *controller = Amarok::Components::transcodingController(); // reset controller to 0 if it doesn't contain encoder to prevent bogus format() call if( controller && !controller->allEncoders().contains( ret.encoder() ) ) - controller = 0; - Format *format = controller ? controller->format( ret.encoder() ) : 0; + controller = nullptr; + Format *format = controller ? controller->format( ret.encoder() ) : nullptr; PropertyList emptyList; foreach( const Property &property, format ? format->propertyList() : emptyList ) { Configuration invalid( INVALID ); - QString key = QString( "Parameter ").append( property.name() ); + QString key = QStringLiteral( "Parameter ").append( property.name() ); QVariant value = serialized.readEntry( key, QString() /* does not work with QVariant() */ ); if( !value.isValid() ) return invalid; - if( !value.convert( property.variantType() ) ) + if( !value.canConvert( property.variantType() ) ) return invalid; switch( property.type() ) { @@ -92,13 +92,13 @@ group.deleteGroup(); // remove all keys Q_ASSERT( encoderNames().contains( m_encoder ) ); QString encoderName = encoderNames().value( m_encoder ); - group.writeEntry( QLatin1String( "Encoder" ), encoderName ); - group.writeEntry( QLatin1String( "TrackSelection" ), int( m_trackSelection ) ); + group.writeEntry( QStringLiteral( "Encoder" ), encoderName ); + group.writeEntry( QStringLiteral( "TrackSelection" ), int( m_trackSelection ) ); QMapIterator it( m_values ); while( it.hasNext() ) { it.next(); - group.writeEntry( QString( "Parameter " ).append( it.key() ), it.value() ); + group.writeEntry( QStringLiteral( "Parameter " ).append( it.key() ), it.value() ); } } @@ -149,15 +149,15 @@ if( !s_encoderNames.isEmpty() ) return s_encoderNames; - s_encoderNames.insert( INVALID, QLatin1String( "INVALID" ) ); - s_encoderNames.insert( JUST_COPY, QLatin1String( "JUST_COPY" ) ); - s_encoderNames.insert( AAC, QLatin1String( "AAC" ) ); - s_encoderNames.insert( ALAC, QLatin1String( "ALAC" ) ); - s_encoderNames.insert( FLAC, QLatin1String( "FLAC" ) ); - s_encoderNames.insert( MP3, QLatin1String( "MP3" ) ); - s_encoderNames.insert( OPUS, QLatin1String( "OPUS" ) ); - s_encoderNames.insert( VORBIS, QLatin1String( "VORBIS" ) ); - s_encoderNames.insert( WMA2, QLatin1String( "WMA2" ) ); + s_encoderNames.insert( INVALID, QStringLiteral( "INVALID" ) ); + s_encoderNames.insert( JUST_COPY, QStringLiteral( "JUST_COPY" ) ); + s_encoderNames.insert( AAC, QStringLiteral( "AAC" ) ); + s_encoderNames.insert( ALAC, QStringLiteral( "ALAC" ) ); + s_encoderNames.insert( FLAC, QStringLiteral( "FLAC" ) ); + s_encoderNames.insert( MP3, QStringLiteral( "MP3" ) ); + s_encoderNames.insert( OPUS, QStringLiteral( "OPUS" ) ); + s_encoderNames.insert( VORBIS, QStringLiteral( "VORBIS" ) ); + s_encoderNames.insert( WMA2, QStringLiteral( "WMA2" ) ); return s_encoderNames; } diff --git a/src/core/transcoding/TranscodingController.h b/src/core/transcoding/TranscodingController.h --- a/src/core/transcoding/TranscodingController.h +++ b/src/core/transcoding/TranscodingController.h @@ -37,11 +37,11 @@ * Singleton class that handles and wraps around the Transcoding architecture. * @author Téo Mrnjavac */ -class AMAROK_CORE_EXPORT Controller : public QObject +class AMAROKCORE_EXPORT Controller : public QObject { Q_OBJECT public: - Controller( QObject *parent = 0 ); + explicit Controller( QObject *parent = nullptr ); ~Controller(); /** @@ -56,7 +56,7 @@ QSet availableEncoders() const { return m_availableEncoders; } /** - * Return pointer to format that encodes using @param encoder. You must ensure that + * Return pointer to format that encodes using @p encoder. You must ensure that * @param encoder is in @see allEncoders(). Always returns non-null pointer which * remains owned by Transcoding::Controller. */ diff --git a/src/core/transcoding/TranscodingController.cpp b/src/core/transcoding/TranscodingController.cpp --- a/src/core/transcoding/TranscodingController.cpp +++ b/src/core/transcoding/TranscodingController.cpp @@ -42,8 +42,8 @@ KProcess *verifyAvailability = new KProcess( this ); verifyAvailability->setOutputChannelMode( KProcess::MergedChannels ); - verifyAvailability->setProgram( "ffmpeg" ); - *verifyAvailability << QString( "-codecs" ); + verifyAvailability->setProgram( QStringLiteral("ffmpeg") ); + *verifyAvailability << QStringLiteral( "-codecs" ); connect( verifyAvailability, QOverload::of(&KProcess::finished), this, &Controller::onAvailabilityVerified ); verifyAvailability->start(); @@ -63,11 +63,11 @@ QString output = qobject_cast< KProcess * >( sender() )->readAllStandardOutput().data(); if( output.simplified().isEmpty() ) return; - QStringList lines = output.split( QRegExp( "\r|\n" ), QString::SkipEmptyParts ); + const QStringList lines = output.split( QRegExp( QStringLiteral("\r|\n") ), QString::SkipEmptyParts ); foreach( Format *format, m_formats ) { bool formatAvailable = false; - foreach( const QString &line, lines ) + for( const QString &line : lines ) { formatAvailable |= format->verifyAvailability( line ); if( formatAvailable ) diff --git a/src/core/transcoding/TranscodingDefines.h b/src/core/transcoding/TranscodingDefines.h --- a/src/core/transcoding/TranscodingDefines.h +++ b/src/core/transcoding/TranscodingDefines.h @@ -23,7 +23,7 @@ { INVALID, // denotes invalid transcoding configuration JUST_COPY, // just copy or move the tracks (no transcoding) - AAC, // Advanded Audio Coding + AAC, // Advanced Audio Coding ALAC, // Apple Lossless Audio Codec FLAC, // Free Lossless Audio Codec MP3, // MPEG-1 or MPEG-2 Audio Layer III encoded using lame encoder diff --git a/src/core/transcoding/TranscodingFormat.h b/src/core/transcoding/TranscodingFormat.h --- a/src/core/transcoding/TranscodingFormat.h +++ b/src/core/transcoding/TranscodingFormat.h @@ -35,7 +35,7 @@ * All transcoding format descriptor classes must inherit from this class. * @author Téo Mrnjavac */ -class AMAROK_CORE_EXPORT Format //: public QObject +class AMAROKCORE_EXPORT Format //: public QObject { public: /** diff --git a/src/core/transcoding/TranscodingProperty.h b/src/core/transcoding/TranscodingProperty.h --- a/src/core/transcoding/TranscodingProperty.h +++ b/src/core/transcoding/TranscodingProperty.h @@ -32,24 +32,24 @@ * defined by a Transcoding::Format subclass. * @author Téo Mrnjavac */ -class AMAROK_CORE_EXPORT Property +class AMAROKCORE_EXPORT Property { public: enum Type { TRADEOFF }; - static Property Tradeoff( const QByteArray name, + static Property Tradeoff( const QByteArray &name, const QString &prettyName, const QString &description, const QString &leftText, const QString &rightText, int min, int max, int defaultValue ); - static Property Tradeoff( const QByteArray name, + static Property Tradeoff( const QByteArray &name, const QString &prettyName, const QString &description, const QString &leftText, @@ -78,11 +78,11 @@ const QStringList & endLabels() const { return m_endLabels; } private: - Property( const QByteArray name, + Property( const QByteArray &name, const QString &prettyName, const QString &description, Type type, - QVariant defaultValue, + const QVariant &defaultValue, int min, int max, const QStringList &valueLabels, diff --git a/src/core/transcoding/TranscodingProperty.cpp b/src/core/transcoding/TranscodingProperty.cpp --- a/src/core/transcoding/TranscodingProperty.cpp +++ b/src/core/transcoding/TranscodingProperty.cpp @@ -27,7 +27,7 @@ { Property -Property::Tradeoff( const QByteArray name, +Property::Tradeoff( const QByteArray &name, const QString &prettyName, const QString &description, const QString &leftText, @@ -44,7 +44,7 @@ } Property -Property::Tradeoff( const QByteArray name, +Property::Tradeoff(const QByteArray &name, const QString &prettyName, const QString &description, const QString &leftText, @@ -68,11 +68,11 @@ return QVariant::Invalid; } -Property::Property( const QByteArray name, +Property::Property( const QByteArray &name, const QString &prettyName, const QString &description, Type type, - QVariant defaultValue, + const QVariant &defaultValue, int min, int max, const QStringList &valueLabels, diff --git a/src/core/transcoding/formats/TranscodingAacFormat.h b/src/core/transcoding/formats/TranscodingAacFormat.h --- a/src/core/transcoding/formats/TranscodingAacFormat.h +++ b/src/core/transcoding/formats/TranscodingAacFormat.h @@ -32,15 +32,15 @@ * FAAC with another encoder. * @author Téo Mrnjavac */ -class AMAROK_CORE_EXPORT AacFormat : public Format +class AMAROKCORE_EXPORT AacFormat : public Format { public: AacFormat(); - QString prettyName() const; - QString description() const; - QIcon icon() const; - QStringList ffmpegParameters( const Configuration &configuration ) const; - bool verifyAvailability( const QString &ffmpegOutput ) const; + QString prettyName() const override; + QString description() const override; + QIcon icon() const override; + QStringList ffmpegParameters( const Configuration &configuration ) const override; + bool verifyAvailability( const QString &ffmpegOutput ) const override; }; } diff --git a/src/core/transcoding/formats/TranscodingAacFormat.cpp b/src/core/transcoding/formats/TranscodingAacFormat.cpp --- a/src/core/transcoding/formats/TranscodingAacFormat.cpp +++ b/src/core/transcoding/formats/TranscodingAacFormat.cpp @@ -25,7 +25,7 @@ AacFormat::AacFormat() { m_encoder = AAC; - m_fileExtension = "m4a"; + m_fileExtension = QStringLiteral("m4a"); QString description1 = i18n( "The bitrate is a measure of the quantity of data used to represent a " "second of the audio track.
" @@ -70,27 +70,27 @@ QIcon AacFormat::icon() const { - return QIcon::fromTheme( "audio-ac3" ); //TODO: get a *real* icon! + return QIcon::fromTheme( QStringLiteral("audio-ac3") ); //TODO: get a *real* icon! } QStringList AacFormat::ffmpegParameters( const Configuration &configuration ) const { QStringList parameters; - parameters << "-acodec" << "aac" << "-strict" << "-2"; + parameters << QStringLiteral("-acodec") << QStringLiteral("aac") << QStringLiteral("-strict") << QStringLiteral("-2"); foreach( const Property &property, m_propertyList ) { if( !configuration.property( property.name() ).isNull() && configuration.property( property.name() ).type() == property.variantType() ) { if( property.name() == "bitrate" ) { - parameters << "-b:a" + parameters << QStringLiteral("-b:a") << QString::number( ( configuration.property( "bitrate" ).toInt() + 1 ) * 32000); } } } - parameters << "-vn"; // no album art, writing it to m4a is not supported by ffmpeg + parameters << QStringLiteral("-vn"); // no album art, writing it to m4a is not supported by ffmpeg return parameters; } diff --git a/src/core/transcoding/formats/TranscodingAlacFormat.h b/src/core/transcoding/formats/TranscodingAlacFormat.h --- a/src/core/transcoding/formats/TranscodingAlacFormat.h +++ b/src/core/transcoding/formats/TranscodingAlacFormat.h @@ -26,15 +26,15 @@ * This class implements the interface for the FFmpeg ALAC encoder. * @author Téo Mrnjavac */ -class AMAROK_CORE_EXPORT AlacFormat : public Format +class AMAROKCORE_EXPORT AlacFormat : public Format { public: AlacFormat(); - QString prettyName() const; - QString description() const; - QIcon icon() const; - QStringList ffmpegParameters( const Configuration &configuration ) const; - bool verifyAvailability( const QString &ffmpegOutput ) const; + QString prettyName() const override; + QString description() const override; + QIcon icon() const override; + QStringList ffmpegParameters( const Configuration &configuration ) const override; + bool verifyAvailability( const QString &ffmpegOutput ) const override; }; } diff --git a/src/core/transcoding/formats/TranscodingAlacFormat.cpp b/src/core/transcoding/formats/TranscodingAlacFormat.cpp --- a/src/core/transcoding/formats/TranscodingAlacFormat.cpp +++ b/src/core/transcoding/formats/TranscodingAlacFormat.cpp @@ -23,7 +23,7 @@ AlacFormat::AlacFormat() { m_encoder = ALAC; - m_fileExtension = "m4a"; + m_fileExtension = QStringLiteral("m4a"); //ALAC seems to have absolutely no configurable options whatsoever. Gnomes would love it. } @@ -47,21 +47,21 @@ QIcon AlacFormat::icon() const { - return QIcon::fromTheme( "audio-x-flac" ); //TODO: get a *real* icon! + return QIcon::fromTheme( QStringLiteral("audio-x-flac") ); //TODO: get a *real* icon! } QStringList AlacFormat::ffmpegParameters( const Configuration &configuration ) const { Q_UNUSED( configuration ) QStringList parameters; - parameters << "-acodec" << "alac"; - parameters << "-vn"; // no album art, writing it to m4a is not supported by ffmpeg + parameters << QStringLiteral("-acodec") << QStringLiteral("alac"); + parameters << QStringLiteral("-vn"); // no album art, writing it to m4a is not supported by ffmpeg return parameters; } bool AlacFormat::verifyAvailability( const QString &ffmpegOutput ) const { - return ffmpegOutput.contains( QRegExp( "^ .EA... alac +" ) ); + return ffmpegOutput.contains( QRegExp( QStringLiteral("^ .EA... alac +") ) ); } diff --git a/src/core/transcoding/formats/TranscodingFlacFormat.h b/src/core/transcoding/formats/TranscodingFlacFormat.h --- a/src/core/transcoding/formats/TranscodingFlacFormat.h +++ b/src/core/transcoding/formats/TranscodingFlacFormat.h @@ -26,15 +26,15 @@ * This class implements the interface for the FFmpeg FLAC codec. * @author Téo Mrnjavac */ -class AMAROK_CORE_EXPORT FlacFormat : public Format +class AMAROKCORE_EXPORT FlacFormat : public Format { public: FlacFormat(); - QString prettyName() const; - QString description() const; - QIcon icon() const; - QStringList ffmpegParameters( const Configuration &configuration ) const; - bool verifyAvailability( const QString &ffmpegOutput ) const; + QString prettyName() const override; + QString description() const override; + QIcon icon() const override; + QStringList ffmpegParameters( const Configuration &configuration ) const override; + bool verifyAvailability( const QString &ffmpegOutput ) const override; }; } diff --git a/src/core/transcoding/formats/TranscodingFlacFormat.cpp b/src/core/transcoding/formats/TranscodingFlacFormat.cpp --- a/src/core/transcoding/formats/TranscodingFlacFormat.cpp +++ b/src/core/transcoding/formats/TranscodingFlacFormat.cpp @@ -25,8 +25,8 @@ FlacFormat::FlacFormat() { m_encoder = FLAC; - m_fileExtension = "flac"; - QString description1 = + m_fileExtension = QStringLiteral("flac"); + const QString description1 = i18n( "The " "compression level is an integer value between 0 and 8 that represents " "the tradeoff between file size and compression speed while encoding with FLAC.
" @@ -63,32 +63,32 @@ QIcon FlacFormat::icon() const { - return QIcon::fromTheme( "audio-x-flac" ); //TODO: get a *real* icon! + return QIcon::fromTheme( QStringLiteral("audio-x-flac") ); //TODO: get a *real* icon! } QStringList FlacFormat::ffmpegParameters( const Configuration &configuration ) const { QStringList parameters; - parameters << "-acodec" << "flac"; + parameters << QStringLiteral("-acodec") << QStringLiteral("flac"); foreach( const Property &property, m_propertyList ) { if( !configuration.property( property.name() ).isNull() && configuration.property( property.name() ).type() == property.variantType() ) { if( property.name() == "level" ) { - parameters << "-compression_level" + parameters << QStringLiteral("-compression_level") << QString::number( configuration.property( "level" ).toInt() ); } } } - parameters << "-vn"; // no album art, writing it to flac is not supported by ffmpeg + parameters << QStringLiteral("-vn"); // no album art, writing it to flac is not supported by ffmpeg return parameters; } bool FlacFormat::verifyAvailability( const QString &ffmpegOutput ) const { - return ffmpegOutput.contains( QRegExp( "^ .EA... flac +" ) ); + return ffmpegOutput.contains( QRegExp( QStringLiteral("^ .EA... flac +") ) ); } diff --git a/src/core/transcoding/formats/TranscodingMp3Format.h b/src/core/transcoding/formats/TranscodingMp3Format.h --- a/src/core/transcoding/formats/TranscodingMp3Format.h +++ b/src/core/transcoding/formats/TranscodingMp3Format.h @@ -29,15 +29,15 @@ * requiring LAME support in FFmpeg should not be an excessive demand. * @author Téo Mrnjavac */ -class AMAROK_CORE_EXPORT Mp3Format : public Format +class AMAROKCORE_EXPORT Mp3Format : public Format { public: Mp3Format(); - QString prettyName() const; - QString description() const; - QIcon icon() const; - QStringList ffmpegParameters( const Configuration &configuration ) const; - bool verifyAvailability( const QString &ffmpegOutput ) const; + QString prettyName() const override; + QString description() const override; + QIcon icon() const override; + QStringList ffmpegParameters( const Configuration &configuration ) const override; + bool verifyAvailability( const QString &ffmpegOutput ) const override; }; } diff --git a/src/core/transcoding/formats/TranscodingMp3Format.cpp b/src/core/transcoding/formats/TranscodingMp3Format.cpp --- a/src/core/transcoding/formats/TranscodingMp3Format.cpp +++ b/src/core/transcoding/formats/TranscodingMp3Format.cpp @@ -23,8 +23,8 @@ Mp3Format::Mp3Format() { m_encoder = MP3; - m_fileExtension = "mp3"; - QString description1 = + m_fileExtension = QStringLiteral("mp3"); + const QString description1 = i18n( "The bitrate is a measure of the quantity of data used to represent a " "second of the audio track.
The MP3 encoder used by Amarok supports " "a variable bitrate (VBR) " @@ -77,32 +77,32 @@ QIcon Mp3Format::icon() const { - return QIcon::fromTheme( "audio-x-generic" ); //TODO: get a *real* icon! + return QIcon::fromTheme( QStringLiteral("audio-x-generic") ); //TODO: get a *real* icon! } QStringList Mp3Format::ffmpegParameters( const Configuration &configuration ) const { QStringList parameters; - parameters << "-acodec" << "libmp3lame"; + parameters << QStringLiteral("-acodec") << QStringLiteral("libmp3lame"); foreach( const Property &property, m_propertyList ) { if( !configuration.property( property.name() ).isNull() && configuration.property( property.name() ).type() == property.variantType() ) { if( property.name() == "quality" ) { int ffmpegQuality = qAbs( configuration.property( "quality" ).toInt() - 9 ); - parameters << "-aq" << QString::number( ffmpegQuality ); + parameters << QStringLiteral("-aq") << QString::number( ffmpegQuality ); } } } - parameters << "-vcodec" << "copy"; // keep album art unchanged + parameters << QStringLiteral("-vcodec") << QStringLiteral("copy"); // keep album art unchanged return parameters; } bool Mp3Format::verifyAvailability( const QString &ffmpegOutput ) const { - return ffmpegOutput.contains( QRegExp( "^ .EA... mp3 +.*libmp3lame" ) ); + return ffmpegOutput.contains( QRegExp( QStringLiteral("^ .EA... mp3 +.*libmp3lame") ) ); } diff --git a/src/core/transcoding/formats/TranscodingNullFormat.h b/src/core/transcoding/formats/TranscodingNullFormat.h --- a/src/core/transcoding/formats/TranscodingNullFormat.h +++ b/src/core/transcoding/formats/TranscodingNullFormat.h @@ -26,15 +26,15 @@ * This class implements the interface for a dummy codec. * @author Téo Mrnjavac */ -class AMAROK_CORE_EXPORT NullFormat : public Format +class AMAROKCORE_EXPORT NullFormat : public Format { public: - NullFormat( const Encoder &encoder ); - QString prettyName() const; - QString description() const; - QIcon icon() const; - QStringList ffmpegParameters( const Configuration &configuration ) const; - bool verifyAvailability( const QString &ffmpegOutput ) const; + explicit NullFormat( const Encoder &encoder ); + QString prettyName() const override; + QString description() const override; + QIcon icon() const override; + QStringList ffmpegParameters( const Configuration &configuration ) const override; + bool verifyAvailability( const QString &ffmpegOutput ) const override; }; } diff --git a/src/core/transcoding/formats/TranscodingNullFormat.cpp b/src/core/transcoding/formats/TranscodingNullFormat.cpp --- a/src/core/transcoding/formats/TranscodingNullFormat.cpp +++ b/src/core/transcoding/formats/TranscodingNullFormat.cpp @@ -22,7 +22,7 @@ NullFormat::NullFormat( const Encoder &encoder ) { m_encoder = encoder; - m_fileExtension = ""; + m_fileExtension = QString(); } QString @@ -47,7 +47,7 @@ NullFormat::ffmpegParameters( const Configuration &configuration ) const { Q_UNUSED( configuration ) - return QStringList() << "-acodec" << "copy"; + return QStringList() << QStringLiteral("-acodec") << QStringLiteral("copy"); } bool diff --git a/src/core/transcoding/formats/TranscodingOpusFormat.h b/src/core/transcoding/formats/TranscodingOpusFormat.h --- a/src/core/transcoding/formats/TranscodingOpusFormat.h +++ b/src/core/transcoding/formats/TranscodingOpusFormat.h @@ -27,15 +27,15 @@ * be compiled with support for the libopus library for this to work. * @author Martin Brodbeck */ -class AMAROK_CORE_EXPORT OpusFormat : public Format +class AMAROKCORE_EXPORT OpusFormat : public Format { public: OpusFormat(); - QString prettyName() const; - QString description() const; - QIcon icon() const; - QStringList ffmpegParameters( const Configuration &configuration ) const; - bool verifyAvailability( const QString &ffmpegOutput ) const; + QString prettyName() const override; + QString description() const override; + QIcon icon() const override; + QStringList ffmpegParameters( const Configuration &configuration ) const override; + bool verifyAvailability( const QString &ffmpegOutput ) const override; private: inline int toFfmpegBitrate( int setting ) const; diff --git a/src/core/transcoding/formats/TranscodingOpusFormat.cpp b/src/core/transcoding/formats/TranscodingOpusFormat.cpp --- a/src/core/transcoding/formats/TranscodingOpusFormat.cpp +++ b/src/core/transcoding/formats/TranscodingOpusFormat.cpp @@ -23,8 +23,8 @@ OpusFormat::OpusFormat() { m_encoder = OPUS; - m_fileExtension = "opus"; - QString description1 = + m_fileExtension = QStringLiteral("opus"); + const QString description1 = i18n( "The bitrate is a measure of the quantity of data used to represent a " "second of the audio track.
The Opus encoder used by Amarok supports " "a variable bitrate (VBR) " @@ -84,27 +84,27 @@ QIcon OpusFormat::icon() const { - return QIcon::fromTheme( "audio-x-generic" ); //TODO: get a *real* icon! + return QIcon::fromTheme( QStringLiteral("audio-x-generic") ); //TODO: get a *real* icon! } QStringList OpusFormat::ffmpegParameters( const Configuration &configuration ) const { QStringList parameters; - parameters << "-acodec" << "libopus"; + parameters << QStringLiteral("-acodec") << QStringLiteral("libopus"); foreach( const Property &property, m_propertyList ) { if( !configuration.property( property.name() ).isNull() && configuration.property( property.name() ).type() == property.variantType() ) { if( property.name() == "bitrate" ) { int ffmpegBitrate = toFfmpegBitrate( configuration.property( "bitrate" ).toInt() ); - parameters << "-ab" << QString::number( ffmpegBitrate ); + parameters << QStringLiteral("-ab") << QString::number( ffmpegBitrate ); } } } - parameters << "-vn"; // no video stream or album art + parameters << QStringLiteral("-vn"); // no video stream or album art return parameters; } @@ -117,5 +117,5 @@ bool OpusFormat::verifyAvailability( const QString &ffmpegOutput ) const { - return ffmpegOutput.contains( QRegExp( "^ .EA... opus +.*libopus" ) ); + return ffmpegOutput.contains( QRegExp( QStringLiteral("^ .EA... opus +.*libopus") ) ); } diff --git a/src/core/transcoding/formats/TranscodingVorbisFormat.h b/src/core/transcoding/formats/TranscodingVorbisFormat.h --- a/src/core/transcoding/formats/TranscodingVorbisFormat.h +++ b/src/core/transcoding/formats/TranscodingVorbisFormat.h @@ -26,15 +26,15 @@ * This class implements the interface for the FFmpeg Vorbis codec. * @author Téo Mrnjavac */ -class AMAROK_CORE_EXPORT VorbisFormat : public Format +class AMAROKCORE_EXPORT VorbisFormat : public Format { public: VorbisFormat(); - QString prettyName() const; - QString description() const; - QIcon icon() const; - QStringList ffmpegParameters( const Configuration &configuration ) const; - bool verifyAvailability( const QString &ffmpegOutput ) const; + QString prettyName() const override; + QString description() const override; + QIcon icon() const override; + QStringList ffmpegParameters( const Configuration &configuration ) const override; + bool verifyAvailability( const QString &ffmpegOutput ) const override; }; } diff --git a/src/core/transcoding/formats/TranscodingVorbisFormat.cpp b/src/core/transcoding/formats/TranscodingVorbisFormat.cpp --- a/src/core/transcoding/formats/TranscodingVorbisFormat.cpp +++ b/src/core/transcoding/formats/TranscodingVorbisFormat.cpp @@ -23,8 +23,8 @@ VorbisFormat::VorbisFormat() { m_encoder = VORBIS; - m_fileExtension = "ogg"; - QString description1 = + m_fileExtension = QStringLiteral("ogg"); + const QString description1 = i18n( "The bitrate is a measure of the quantity of data used to represent a " "second of the audio track.
The Vorbis encoder used by Amarok supports " "a variable bitrate " @@ -42,7 +42,7 @@ "Anything below -q3 might be unsatisfactory for music and anything above " "-q8 is probably overkill."); QStringList valueLabels; - QByteArray vbr = "-q%1 ~%2kb/s"; + const QByteArray vbr = "-q%1 ~%2kb/s"; valueLabels << i18n( vbr, -1, 45 ) << i18n( vbr, 0, 64 ) @@ -82,14 +82,14 @@ QIcon VorbisFormat::icon() const { - return QIcon::fromTheme( "audio-x-wav" ); //TODO: get a *real* icon! + return QIcon::fromTheme( QStringLiteral("audio-x-wav") ); //TODO: get a *real* icon! } QStringList VorbisFormat::ffmpegParameters( const Configuration &configuration ) const { QStringList parameters; - parameters << "-acodec" << "libvorbis"; //libvorbis is better than FFmpeg's + parameters << QStringLiteral("-acodec") << QStringLiteral("libvorbis"); //libvorbis is better than FFmpeg's //vorbis implementation in many ways foreach( const Property &property, m_propertyList ) { @@ -99,16 +99,16 @@ if( property.name() == "quality" ) { int ffmpegQuality = configuration.property( "quality" ).toInt() - 1; - parameters << "-aq" << QString::number( ffmpegQuality ); + parameters << QStringLiteral("-aq") << QString::number( ffmpegQuality ); } } } - parameters << "-vn"; // no video stream or album art, some devices can't handle that + parameters << QStringLiteral("-vn"); // no video stream or album art, some devices can't handle that return parameters; } bool VorbisFormat::verifyAvailability( const QString &ffmpegOutput ) const { - return ffmpegOutput.contains( QRegExp( "^ .EA... vorbis +.*libvorbis" ) ); + return ffmpegOutput.contains( QRegExp( QStringLiteral("^ .EA... vorbis +.*libvorbis") ) ); } diff --git a/src/core/transcoding/formats/TranscodingWmaFormat.h b/src/core/transcoding/formats/TranscodingWmaFormat.h --- a/src/core/transcoding/formats/TranscodingWmaFormat.h +++ b/src/core/transcoding/formats/TranscodingWmaFormat.h @@ -27,15 +27,15 @@ * cares about WMA any more... * @author Téo Mrnjavac */ -class AMAROK_CORE_EXPORT WmaFormat : public Format +class AMAROKCORE_EXPORT WmaFormat : public Format { public: WmaFormat(); - QString prettyName() const; - QString description() const; - QIcon icon() const; - QStringList ffmpegParameters( const Configuration &configuration ) const; - bool verifyAvailability( const QString &ffmpegOutput ) const; + QString prettyName() const override; + QString description() const override; + QIcon icon() const override; + QStringList ffmpegParameters( const Configuration &configuration ) const override; + bool verifyAvailability( const QString &ffmpegOutput ) const override; private: inline int toFfmpegBitrate( int setting ) const; diff --git a/src/core/transcoding/formats/TranscodingWmaFormat.cpp b/src/core/transcoding/formats/TranscodingWmaFormat.cpp --- a/src/core/transcoding/formats/TranscodingWmaFormat.cpp +++ b/src/core/transcoding/formats/TranscodingWmaFormat.cpp @@ -23,8 +23,8 @@ WmaFormat::WmaFormat() { m_encoder = WMA2; - m_fileExtension = "wma"; - QString description1 = + m_fileExtension = QStringLiteral("wma"); + const QString description1 = i18n( "The bitrate is a measure of the quantity of data used to represent a " "second of the audio track.
Due to the limitations of the proprietary WMA " "format and the difficulty of reverse-engineering a proprietary encoder, the " @@ -36,7 +36,7 @@ "Anything below 112kb/s might be unsatisfactory for music and anything above " "182kb/s is probably overkill."); QStringList valueLabels; - QByteArray cbr = "CBR %1kb/s"; + const QByteArray cbr = "CBR %1kb/s"; valueLabels << i18n( cbr, 64 ) << i18n( cbr, 80 ) @@ -88,20 +88,20 @@ WmaFormat::ffmpegParameters( const Configuration &configuration ) const { QStringList parameters; - parameters << "-acodec" << "wmav2"; + parameters << QStringLiteral("-acodec") << QStringLiteral("wmav2"); foreach( const Property &property, m_propertyList ) { if( !configuration.property( property.name() ).isNull() && configuration.property( property.name() ).type() == property.variantType() ) { if( property.name() == "bitrate" ) { int ffmpegBitrate = toFfmpegBitrate( configuration.property( "bitrate" ).toInt() ); - parameters << "-ab" << QString::number( ffmpegBitrate ); + parameters << QStringLiteral("-ab") << QString::number( ffmpegBitrate ); } } } - parameters << "-vn"; // no video stream or album art + parameters << QStringLiteral("-vn"); // no video stream or album art return parameters; } @@ -115,5 +115,5 @@ bool WmaFormat::verifyAvailability( const QString &ffmpegOutput ) const { - return ffmpegOutput.contains( QRegExp( "^ .EA... wmav2 +" ) ); + return ffmpegOutput.contains( QRegExp( QStringLiteral("^ .EA... wmav2 +") ) ); } diff --git a/src/covermanager/CoverCache.h b/src/covermanager/CoverCache.h --- a/src/covermanager/CoverCache.h +++ b/src/covermanager/CoverCache.h @@ -56,6 +56,7 @@ Note: as this function can create a pixmap it is not recommended to call this function from outside the UI thread. + @param album the album to get cover @param size is the maximum width or height of the resulting image. when size is <= 1, return the full size image */ diff --git a/src/covermanager/CoverCache.cpp b/src/covermanager/CoverCache.cpp --- a/src/covermanager/CoverCache.cpp +++ b/src/covermanager/CoverCache.cpp @@ -25,12 +25,14 @@ #include #include #include +#include #include -#include #include -CoverCache* CoverCache::s_instance = 0; +#include + +CoverCache* CoverCache::s_instance = nullptr; CoverCache* CoverCache::instance() @@ -43,7 +45,7 @@ if( s_instance ) { delete s_instance; - s_instance = 0; + s_instance = nullptr; } } @@ -115,7 +117,8 @@ { const QPixmap orgPixmap( QStandardPaths::locate( QStandardPaths::GenericDataLocation, "amarok/images/nocover.png" ) ); pixmap = orgPixmap.scaled( size, size, Qt::KeepAspectRatio, Qt::SmoothTransformation ); - pixmap.save( cacheCoverDir.filePath( noCoverKey ), "PNG" ); + std::thread thread( QOverload::of( &QPixmap::save ), pixmap, cacheCoverDir.filePath( noCoverKey ), "PNG", -1 ); + thread.detach(); } QPixmapCache::insert( noCoverKey, pixmap ); return pixmap; diff --git a/src/covermanager/CoverFetchQueue.h b/src/covermanager/CoverFetchQueue.h --- a/src/covermanager/CoverFetchQueue.h +++ b/src/covermanager/CoverFetchQueue.h @@ -27,7 +27,6 @@ #include #include -class CoverFetchPayload; typedef QList< CoverFetchUnit::Ptr > CoverFetchUnitList; @@ -44,7 +43,7 @@ Q_OBJECT public: - CoverFetchQueue( QObject *parent = 0 ); + explicit CoverFetchQueue( QObject *parent = nullptr ); ~CoverFetchQueue(); /** @@ -55,7 +54,7 @@ * @param xml xml document from the cover provider. Can be empty on first * pass of the fetching process. */ - void add( const Meta::AlbumPtr album, + void add( const Meta::AlbumPtr &album, const CoverFetch::Option opt = CoverFetch::Automatic, const CoverFetch::Source src = CoverFetch::LastFm, const QByteArray &xml = QByteArray() ); @@ -81,25 +80,22 @@ void addQuery( const QString &query, const CoverFetch::Source src = CoverFetch::LastFm, unsigned int page = 0, - Meta::AlbumPtr album = Meta::AlbumPtr(0) ); - - bool contains( const Meta::AlbumPtr album ) const; - int index( const Meta::AlbumPtr album ) const; - int size() const; - bool isEmpty() const; + const Meta::AlbumPtr &album = Meta::AlbumPtr(0) ); void clear(); - const CoverFetchUnit::Ptr take( const Meta::AlbumPtr album ); public Q_SLOTS: - void remove( const CoverFetchUnit::Ptr unit ); - void remove( const Meta::AlbumPtr album ); + void remove( const CoverFetchUnit::Ptr &unit ); + void remove( const Meta::AlbumPtr &album ); Q_SIGNALS: void fetchUnitAdded( CoverFetchUnit::Ptr ); private: - void add( const CoverFetchUnit::Ptr unit ); + void add( const CoverFetchUnit::Ptr &unit ); + bool contains( const Meta::AlbumPtr &album ) const; + int index( const Meta::AlbumPtr &album ) const; + const CoverFetchUnit::Ptr take( const Meta::AlbumPtr &album ); CoverFetchUnitList m_queue; Q_DISABLE_COPY( CoverFetchQueue ) diff --git a/src/covermanager/CoverFetchQueue.cpp b/src/covermanager/CoverFetchQueue.cpp --- a/src/covermanager/CoverFetchQueue.cpp +++ b/src/covermanager/CoverFetchQueue.cpp @@ -16,6 +16,7 @@ #include "CoverFetchQueue.h" + CoverFetchQueue::CoverFetchQueue( QObject *parent ) : QObject( parent ) { @@ -26,14 +27,14 @@ } void -CoverFetchQueue::add( const CoverFetchUnit::Ptr unit ) +CoverFetchQueue::add( const CoverFetchUnit::Ptr &unit ) { m_queue.append( unit ); - emit fetchUnitAdded( unit ); + Q_EMIT fetchUnitAdded( unit ); } void -CoverFetchQueue::add( const Meta::AlbumPtr album, +CoverFetchQueue::add( const Meta::AlbumPtr &album, const CoverFetch::Option opt, const CoverFetch::Source src, const QByteArray &xml ) @@ -92,44 +93,32 @@ CoverFetchQueue::addQuery( const QString &query, const CoverFetch::Source src, unsigned int page, - Meta::AlbumPtr album ) + const Meta::AlbumPtr &album ) { CoverFetchSearchPayload *payload = new CoverFetchSearchPayload( query, src, page, album ); add( AmarokSharedPointer< CoverFetchUnit >( new CoverFetchUnit( payload ) ) ); } -int -CoverFetchQueue::size() const -{ - return m_queue.size(); -} - -bool -CoverFetchQueue::isEmpty() const -{ - return m_queue.isEmpty(); -} - void CoverFetchQueue::clear() { m_queue.clear(); } void -CoverFetchQueue::remove( const CoverFetchUnit::Ptr unit ) +CoverFetchQueue::remove( const CoverFetchUnit::Ptr &unit ) { m_queue.removeAll( unit ); } void -CoverFetchQueue::remove( const Meta::AlbumPtr album ) +CoverFetchQueue::remove( const Meta::AlbumPtr &album ) { m_queue.removeAt( index( album ) ); } bool -CoverFetchQueue::contains( const Meta::AlbumPtr album ) const +CoverFetchQueue::contains( const Meta::AlbumPtr &album ) const { typedef CoverFetchUnitList::const_iterator ListIter; ListIter it = m_queue.constBegin(); @@ -145,7 +134,7 @@ } int -CoverFetchQueue::index( const Meta::AlbumPtr album ) const +CoverFetchQueue::index( const Meta::AlbumPtr &album ) const { for( int i = 0, len = m_queue.size(); i < len; ++i ) { @@ -156,9 +145,9 @@ } const CoverFetchUnit::Ptr -CoverFetchQueue::take( const Meta::AlbumPtr album ) +CoverFetchQueue::take( const Meta::AlbumPtr &album ) { - for( int i = 0, end = this->size(); i < end; ++i ) + for( int i = 0, end = m_queue.size(); i < end; ++i ) { const CoverFetchUnit::Ptr unit = m_queue.at( i ); if( unit->album() == album ) diff --git a/src/covermanager/CoverFetchUnit.h b/src/covermanager/CoverFetchUnit.h --- a/src/covermanager/CoverFetchUnit.h +++ b/src/covermanager/CoverFetchUnit.h @@ -32,7 +32,7 @@ { enum Option { - Automatic, //!< Automtically save cover for the specified album, if one is found + Automatic, //!< Automatically save cover for the specified album, if one is found Interactive, //!< Opens a dialog for the user to decide, and add more searches if desired WildInteractive //!< As @ref Interactive, but without filtering results (used for web search) }; @@ -62,11 +62,11 @@ public: typedef AmarokSharedPointer< CoverFetchUnit > Ptr; - CoverFetchUnit( Meta::AlbumPtr album, + CoverFetchUnit( const Meta::AlbumPtr &album, const CoverFetchPayload *payload, CoverFetch::Option opt = CoverFetch::Automatic ); CoverFetchUnit( const CoverFetchPayload *payload, CoverFetch::Option opt ); - CoverFetchUnit( const CoverFetchSearchPayload *payload ); + explicit CoverFetchUnit( const CoverFetchSearchPayload *payload ); ~CoverFetchUnit(); Meta::AlbumPtr album() const; @@ -99,7 +99,7 @@ { public: enum Type { Info, Search, Art }; - CoverFetchPayload( const Meta::AlbumPtr album, enum Type type, const CoverFetch::Source src ); + CoverFetchPayload( const Meta::AlbumPtr &album, enum Type type, const CoverFetch::Source src ); virtual ~CoverFetchPayload(); Meta::AlbumPtr album() const; @@ -132,12 +132,12 @@ class CoverFetchInfoPayload : public CoverFetchPayload { public: - explicit CoverFetchInfoPayload( const Meta::AlbumPtr album, const CoverFetch::Source src ); + explicit CoverFetchInfoPayload( const Meta::AlbumPtr &album, const CoverFetch::Source src ); explicit CoverFetchInfoPayload( const CoverFetch::Source src, const QByteArray &xml ); - ~CoverFetchInfoPayload(); + ~CoverFetchInfoPayload() override; protected: - void prepareUrls(); + void prepareUrls() override; private: void prepareDiscogsUrls( const QByteArray &data ); @@ -154,13 +154,13 @@ explicit CoverFetchSearchPayload( const QString &query = QString(), const CoverFetch::Source src = CoverFetch::LastFm, unsigned int page = 0, - Meta::AlbumPtr album = Meta::AlbumPtr() ); + const Meta::AlbumPtr &album = Meta::AlbumPtr() ); ~CoverFetchSearchPayload(); QString query() const; protected: - void prepareUrls(); + void prepareUrls() override; private: const unsigned int m_page; @@ -175,7 +175,7 @@ class CoverFetchArtPayload : public CoverFetchPayload { public: - explicit CoverFetchArtPayload( const Meta::AlbumPtr album, + explicit CoverFetchArtPayload( const Meta::AlbumPtr &album, const CoverFetch::ImageSize size = CoverFetch::NormalSize, const CoverFetch::Source src = CoverFetch::LastFm, bool wild = false ); @@ -191,7 +191,7 @@ void setXml( const QByteArray &xml ); protected: - void prepareUrls(); + void prepareUrls() override; private: CoverFetch::ImageSize m_size; diff --git a/src/covermanager/CoverFetchUnit.cpp b/src/covermanager/CoverFetchUnit.cpp --- a/src/covermanager/CoverFetchUnit.cpp +++ b/src/covermanager/CoverFetchUnit.cpp @@ -32,7 +32,7 @@ * CoverFetchUnit */ -CoverFetchUnit::CoverFetchUnit( Meta::AlbumPtr album, +CoverFetchUnit::CoverFetchUnit( const Meta::AlbumPtr &album, const CoverFetchPayload *payload, CoverFetch::Option opt ) : m_album( album ) @@ -123,7 +123,7 @@ * CoverFetchPayload */ -CoverFetchPayload::CoverFetchPayload( const Meta::AlbumPtr album, +CoverFetchPayload::CoverFetchPayload( const Meta::AlbumPtr &album, CoverFetchPayload::Type type, CoverFetch::Source src ) : m_src( src ) @@ -202,7 +202,7 @@ * CoverFetchInfoPayload */ -CoverFetchInfoPayload::CoverFetchInfoPayload( const Meta::AlbumPtr album, const CoverFetch::Source src ) +CoverFetchInfoPayload::CoverFetchInfoPayload( const Meta::AlbumPtr &album, const CoverFetch::Source src ) : CoverFetchPayload( album, CoverFetchPayload::Info, src ) { prepareUrls(); @@ -289,7 +289,7 @@ { QUrl releaseUrl( xml.readElementText() ); QString releaseStr = releaseUrl.adjusted(QUrl::StripTrailingSlash).toString(); - QString releaseId = releaseStr.split( '/' ).last(); + QString releaseId = releaseStr.split( QLatin1Char('/') ).last(); QUrl url; url.setScheme( "http" ); @@ -324,7 +324,7 @@ CoverFetchSearchPayload::CoverFetchSearchPayload( const QString &query, const CoverFetch::Source src, unsigned int page, - Meta::AlbumPtr album ) + const Meta::AlbumPtr &album ) : CoverFetchPayload( album, CoverFetchPayload::Search, src ) , m_page( page ) , m_query( query ) @@ -398,7 +398,7 @@ * CoverFetchArtPayload */ -CoverFetchArtPayload::CoverFetchArtPayload( const Meta::AlbumPtr album, +CoverFetchArtPayload::CoverFetchArtPayload( const Meta::AlbumPtr &album, const CoverFetch::ImageSize size, const CoverFetch::Source src, bool wild ) diff --git a/src/covermanager/CoverFetcher.h b/src/covermanager/CoverFetcher.h --- a/src/covermanager/CoverFetcher.h +++ b/src/covermanager/CoverFetcher.h @@ -31,6 +31,7 @@ class CoverFetchQueue; class CoverFoundDialog; +class QThread; namespace KIO { class Job; } @@ -51,7 +52,7 @@ enum FinishState { Success, Error, NotFound, Cancelled }; public Q_SLOTS: - AMAROK_EXPORT void queueQuery( Meta::AlbumPtr album, const QString &query, int page = 0 ); + AMAROK_EXPORT void queueQuery( const Meta::AlbumPtr &album, const QString &query, int page = 0 ); Q_SIGNALS: void finishedSingle( int state ); @@ -62,7 +63,7 @@ void slotFetch( CoverFetchUnit::Ptr unit ); /// Handle result of a fetch job - void slotResult( const QUrl &url, QByteArray data, NetworkAccessManagerProxy::Error e ); + void slotResult( const QUrl &url, const QByteArray &data, const NetworkAccessManagerProxy::Error &e ); /// Cover found dialog is closed by the user void slotDialogFinished(); @@ -76,13 +77,12 @@ ~CoverFetcher(); /// Remove a fetch unit from the queue, and clean up any running jobs - void abortFetch( CoverFetchUnit::Ptr unit ); + void abortFetch( const CoverFetchUnit::Ptr &unit ); void queueQueryForAlbum( Meta::AlbumPtr album ); - const int m_limit; //!< maximum number of concurrent fetches CoverFetchQueue *m_queue; //!< current fetch queue - Meta::AlbumList m_queueLater; //!< put here if m_queue exceeds m_limit + QThread *m_queueThread; QHash< QUrl, CoverFetchUnit::Ptr > m_urls; QHash< const CoverFetchUnit::Ptr, QImage > m_selectedImages; @@ -92,7 +92,7 @@ QPointer m_dialog; /// cleanup depending on the fetch result - void finish( const CoverFetchUnit::Ptr unit, + void finish( const CoverFetchUnit::Ptr &unit, FinishState state = Success, const QString &message = QString() ); diff --git a/src/covermanager/CoverFetcher.cpp b/src/covermanager/CoverFetcher.cpp --- a/src/covermanager/CoverFetcher.cpp +++ b/src/covermanager/CoverFetcher.cpp @@ -23,26 +23,28 @@ #include "CoverFetcher.h" #include "amarokconfig.h" -#include "core/interfaces/Logger.h" +#include "core/logger/Logger.h" #include "core/meta/Meta.h" #include "core/support/Amarok.h" #include "core/support/Components.h" #include "core/support/Debug.h" #include "CoverFetchQueue.h" #include "CoverFoundDialog.h" #include "CoverFetchUnit.h" -#include -#include - #include #include +#include #include #include #include -CoverFetcher* CoverFetcher::s_instance = 0; +#include +#include + + +CoverFetcher* CoverFetcher::s_instance = nullptr; CoverFetcher* CoverFetcher::instance() @@ -55,41 +57,48 @@ if( s_instance ) { delete s_instance; - s_instance = 0; + s_instance = nullptr; } } CoverFetcher::CoverFetcher() : QObject() - , m_limit( 10 ) { DEBUG_BLOCK setObjectName( "CoverFetcher" ); qRegisterMetaType("CoverFetchUnit::Ptr"); - m_queue = new CoverFetchQueue( this ); + s_instance = this; + + m_queueThread = new QThread( this ); + m_queueThread->start(); + m_queue = new CoverFetchQueue; + m_queue->moveToThread( m_queueThread ); + connect( m_queue, &CoverFetchQueue::fetchUnitAdded, this, &CoverFetcher::slotFetch ); - s_instance = this; connect( The::networkAccessManager(), &NetworkAccessManagerProxy::requestRedirectedReply, this, &CoverFetcher::fetchRequestRedirected ); } CoverFetcher::~CoverFetcher() { + m_queue->deleteLater(); + m_queueThread->quit(); + m_queueThread->wait(); } void CoverFetcher::manualFetch( Meta::AlbumPtr album ) { - debug() << QString("Adding interactive cover fetch for: '%1' from %2") + debug() << QStringLiteral("Adding interactive cover fetch for: '%1' from %2") .arg( album->name(), Amarok::config("Cover Fetcher").readEntry("Interactive Image Source", "LastFm") ); switch( fetchSource() ) { case CoverFetch::LastFm: - m_queue->add( album, CoverFetch::Interactive, fetchSource() ); + QTimer::singleShot( 0, m_queue, [=] () { m_queue->add( album, CoverFetch::Interactive, fetchSource() ); } ); break; case CoverFetch::Discogs: @@ -105,29 +114,23 @@ void CoverFetcher::queueAlbum( Meta::AlbumPtr album ) { - if( m_queue->size() > m_limit ) - m_queueLater.append( album ); - else - m_queue->add( album, CoverFetch::Automatic ); + QTimer::singleShot( 0, m_queue, [=] () { m_queue->add( album, CoverFetch::Automatic ); } ); debug() << "Queueing automatic cover fetch for:" << album->name(); } void CoverFetcher::queueAlbums( Meta::AlbumList albums ) { foreach( Meta::AlbumPtr album, albums ) { - if( m_queue->size() > m_limit ) - m_queueLater.append( album ); - else - m_queue->add( album, CoverFetch::Automatic ); + QTimer::singleShot( 0, m_queue, [=] () { m_queue->add( album, CoverFetch::Automatic ); } ); } } void -CoverFetcher::queueQuery( Meta::AlbumPtr album, const QString &query, int page ) +CoverFetcher::queueQuery( const Meta::AlbumPtr &album, const QString &query, int page ) { - m_queue->addQuery( query, fetchSource(), page, album ); + QTimer::singleShot( 0, m_queue, [=] () { m_queue->addQuery( query, fetchSource(), page, album ); } ); debug() << QString( "Queueing cover fetch query: '%1' (page %2)" ).arg( query, QString::number( page ) ); } @@ -166,32 +169,31 @@ if( !url.isValid() ) continue; - QNetworkReply *reply = The::networkAccessManager()->getData( url, this, - SLOT(slotResult(QUrl,QByteArray,NetworkAccessManagerProxy::Error)) ); + QNetworkReply *reply = The::networkAccessManager()->getData( url, this, &CoverFetcher::slotResult ); m_urls.insert( url, unit ); if( payload->type() == CoverFetchPayload::Art ) { if( unit->isInteractive() ) - Amarok::Components::logger()->newProgressOperation( reply, i18n( "Fetching Cover" ) ); + Amarok::Logger::newProgressOperation( reply, i18n( "Fetching Cover" ) ); else return; // only one is needed when the fetch is non-interactive } } } void -CoverFetcher::slotResult( const QUrl &url, QByteArray data, NetworkAccessManagerProxy::Error e ) +CoverFetcher::slotResult( const QUrl &url, const QByteArray &data, const NetworkAccessManagerProxy::Error &e ) { DEBUG_BLOCK if( !m_urls.contains( url ) ) return; - debug() << "Data dump from the result: " << data; +// debug() << "Data dump from the result: " << data; const CoverFetchUnit::Ptr unit( m_urls.take( url ) ); if( !unit ) { - m_queue->remove( unit ); + QTimer::singleShot( 0, m_queue, [=] () { m_queue->remove( unit ); } ); return; } @@ -205,13 +207,13 @@ switch( payload->type() ) { case CoverFetchPayload::Info: - m_queue->add( unit->album(), unit->options(), payload->source(), data ); - m_queue->remove( unit ); + QTimer::singleShot( 0, m_queue, [=] () { m_queue->add( unit->album(), unit->options(), payload->source(), data ); + m_queue->remove( unit ); } ); break; case CoverFetchPayload::Search: - m_queue->add( unit->options(), fetchSource(), data ); - m_queue->remove( unit ); + QTimer::singleShot( 0, m_queue, [=] () { m_queue->add( unit->options(), fetchSource(), data ); + m_queue->remove( unit ); } ); break; case CoverFetchPayload::Art: @@ -262,7 +264,7 @@ if( reader.read( &image ) ) { showCover( unit, image, metadata ); - m_queue->remove( unit ); + QTimer::singleShot( 0, m_queue, [=] () { m_queue->remove( unit ); } ); return; } } @@ -336,7 +338,7 @@ // If the unit is an interactive one we have to incidate that we're // still fetching the cover. if( unit->isInteractive() ) - Amarok::Components::logger()->newProgressOperation( newReply, i18n( "Fetching Cover" ) ); + Amarok::Logger::newProgressOperation( newReply, i18n( "Fetching Cover" ) ); } } @@ -354,7 +356,7 @@ return; } - m_dialog = new CoverFoundDialog( unit, data, static_cast( parent() ) ); + m_dialog = new CoverFoundDialog( unit, data ); connect( m_dialog.data(), &CoverFoundDialog::newCustomQuery, this, &CoverFetcher::queueQuery ); connect( m_dialog.data(), &CoverFoundDialog::accepted, @@ -383,19 +385,18 @@ } void -CoverFetcher::abortFetch( CoverFetchUnit::Ptr unit ) +CoverFetcher::abortFetch( const CoverFetchUnit::Ptr &unit ) { - m_queue->remove( unit ); - m_queueLater.removeAll( unit->album() ); + QTimer::singleShot( 0, m_queue, [=] () { m_queue->remove( unit ); } ); m_selectedImages.remove( unit ); QList urls = m_urls.keys( unit ); foreach( const QUrl &url, urls ) m_urls.remove( url ); The::networkAccessManager()->abortGet( urls ); } void -CoverFetcher::finish( const CoverFetchUnit::Ptr unit, +CoverFetcher::finish( const CoverFetchUnit::Ptr &unit, CoverFetcher::FinishState state, const QString &message ) { @@ -405,22 +406,24 @@ switch( state ) { case Success: + { if( !albumName.isEmpty() ) { const QString text = i18n( "Retrieved cover successfully for '%1'.", albumName ); - if( Amarok::Components::logger() ) - Amarok::Components::logger()->shortMessage( text ); + Amarok::Logger::shortMessage( text ); debug() << "Finished successfully for album" << albumName; } - album->setImage( m_selectedImages.take( unit ) ); + QImage image = m_selectedImages.take( unit ); + std::thread thread( std::bind( &Meta::Album::setImage, album, image ) ); + thread.detach(); abortFetch( unit ); break; - + } case Error: if( !albumName.isEmpty() ) { const QString text = i18n( "Fetching cover for '%1' failed.", albumName ); - Amarok::Components::logger()->shortMessage( text ); + Amarok::Logger::shortMessage( text ); QString debugMessage; if( !message.isEmpty() ) debugMessage = '[' + message + ']'; @@ -433,7 +436,7 @@ if( !albumName.isEmpty() ) { const QString text = i18n( "Canceled fetching cover for '%1'.", albumName ); - Amarok::Components::logger()->shortMessage( text ); + Amarok::Logger::shortMessage( text ); debug() << "Finished, cancelled by user for album" << albumName; } break; @@ -443,30 +446,16 @@ { const QString text = i18n( "Unable to find a cover for '%1'.", albumName ); //FIXME: Not visible behind cover manager - Amarok::Components::logger()->shortMessage( text ); + Amarok::Logger::shortMessage( text ); m_errors += text; debug() << "Finished due to cover not found for album" << albumName; } break; } - m_queue->remove( unit ); - - if( !m_queueLater.isEmpty() ) - { - const int diff = m_limit - m_queue->size(); - if( diff > 0 ) - { - for( int i = 0; i < diff && !m_queueLater.isEmpty(); ++i ) - { - Meta::AlbumPtr album = m_queueLater.takeFirst(); - // automatic fetching only uses Last.fm as source - m_queue->add( album, CoverFetch::Automatic, CoverFetch::LastFm ); - } - } - } + QTimer::singleShot( 0, m_queue, [=] () { m_queue->remove( unit ); } ); - emit finishedSingle( static_cast< int >( state ) ); + Q_EMIT finishedSingle( static_cast< int >( state ) ); } CoverFetch::Source diff --git a/src/covermanager/CoverFetchingActions.h b/src/covermanager/CoverFetchingActions.h --- a/src/covermanager/CoverFetchingActions.h +++ b/src/covermanager/CoverFetchingActions.h @@ -32,13 +32,13 @@ { Q_OBJECT public: - BaseCoverAction( QObject *parent, Meta::AlbumPtr album ) + BaseCoverAction( QObject *parent, const Meta::AlbumPtr &album ) : QAction( parent ) { m_albums.append( album ); connect( this, &QAction::triggered, this, &BaseCoverAction::slotTriggered ); } - BaseCoverAction( QObject *parent, Meta::AlbumList albums ) + BaseCoverAction( QObject *parent, const Meta::AlbumList &albums ) : QAction( parent ) { m_albums = albums; @@ -55,58 +55,58 @@ { Q_OBJECT public: - FetchCoverAction( QObject *parent, Meta::AlbumPtr album ) + FetchCoverAction( QObject *parent, const Meta::AlbumPtr &album ) : BaseCoverAction( parent, album ) { init(); } - FetchCoverAction( QObject *parent, Meta::AlbumList albums ) + FetchCoverAction( QObject *parent, const Meta::AlbumList &albums ) : BaseCoverAction( parent, albums ) { init(); } protected Q_SLOTS: - virtual void slotTriggered(); + void slotTriggered() override; protected: virtual void init(); }; class AMAROK_EXPORT DisplayCoverAction : public BaseCoverAction { Q_OBJECT public: - DisplayCoverAction( QObject *parent, Meta::AlbumPtr album ) + DisplayCoverAction( QObject *parent, const Meta::AlbumPtr &album ) : BaseCoverAction( parent, album ) { init(); } - DisplayCoverAction( QObject *parent, Meta::AlbumList albums ) + DisplayCoverAction( QObject *parent, const Meta::AlbumList &albums ) : BaseCoverAction( parent, albums ) { init(); } protected Q_SLOTS: - virtual void slotTriggered(); + void slotTriggered() override; protected: virtual void init(); }; class AMAROK_EXPORT UnsetCoverAction : public BaseCoverAction { Q_OBJECT public: - UnsetCoverAction( QObject *parent, Meta::AlbumPtr album ) + UnsetCoverAction( QObject *parent, const Meta::AlbumPtr &album ) : BaseCoverAction( parent, album ) { init(); } - UnsetCoverAction( QObject *parent, Meta::AlbumList albums ) + UnsetCoverAction( QObject *parent, const Meta::AlbumList &albums ) : BaseCoverAction( parent, albums ) { init(); } protected Q_SLOTS: - virtual void slotTriggered(); + void slotTriggered() override; protected: virtual void init(); }; class AMAROK_EXPORT SetCustomCoverAction : public BaseCoverAction { Q_OBJECT public: - SetCustomCoverAction( QObject *parent, Meta::AlbumPtr album ) + SetCustomCoverAction( QObject *parent, const Meta::AlbumPtr &album ) : BaseCoverAction( parent, album ) { init(); } - SetCustomCoverAction( QObject *parent, Meta::AlbumList albums ) + SetCustomCoverAction( QObject *parent, const Meta::AlbumList &albums ) : BaseCoverAction( parent, albums ) { init(); } protected Q_SLOTS: - virtual void slotTriggered(); + void slotTriggered() override; protected: virtual void init(); }; diff --git a/src/covermanager/CoverFetchingActions.cpp b/src/covermanager/CoverFetchingActions.cpp --- a/src/covermanager/CoverFetchingActions.cpp +++ b/src/covermanager/CoverFetchingActions.cpp @@ -45,7 +45,7 @@ void FetchCoverAction::init() { setText( i18np("Fetch Cover", "Fetch Covers", m_albums.count()) ); - setIcon( QIcon::fromTheme("insert-image") ); + setIcon( QIcon::fromTheme(QStringLiteral("insert-image")) ); setToolTip( i18np("Fetch the artwork for this album", "Fetch artwork for %1 albums", m_albums.count()) ); bool enabled = !m_albums.isEmpty(); @@ -74,7 +74,7 @@ void DisplayCoverAction::init() { setText( i18n("Display Cover") ); - setIcon( QIcon::fromTheme("zoom-original") ); + setIcon( QIcon::fromTheme(QStringLiteral("zoom-original")) ); setToolTip( i18n("Display artwork for this album") ); Meta::AlbumPtr album = m_albums.first(); if( album ) @@ -94,7 +94,7 @@ void UnsetCoverAction::init() { setText( i18np("Unset Cover", "Unset Covers", m_albums.count()) ); - setIcon( QIcon::fromTheme("list-remove") ); + setIcon( QIcon::fromTheme(QStringLiteral("list-remove")) ); setToolTip( i18np("Remove artwork for this album", "Remove artwork for %1 albums", m_albums.count()) ); // this action is enabled if any one of the albums has an image and can be updated @@ -132,7 +132,7 @@ void SetCustomCoverAction::init() { setText( i18n("Set Custom Cover") ); - setIcon( QIcon::fromTheme("document-open") ); + setIcon( QIcon::fromTheme(QStringLiteral("document-open")) ); setToolTip( i18np("Set custom artwork for this album", "Set custom artwork for these %1 albums", m_albums.count()) ); // this action is enabled if any one of the albums can be updated @@ -184,7 +184,7 @@ QTemporaryDir tempDir; tempDir.setAutoRemove( true ); - const QString coverDownloadPath = tempDir.path() + '/' + file.fileName(); + const QString coverDownloadPath = tempDir.path() + QLatin1Char('/') + file.fileName(); auto copyJob = KIO::copy( file, QUrl::fromLocalFile( coverDownloadPath ) ); bool ret = copyJob->exec(); diff --git a/src/covermanager/CoverFoundDialog.h b/src/covermanager/CoverFoundDialog.h --- a/src/covermanager/CoverFoundDialog.h +++ b/src/covermanager/CoverFoundDialog.h @@ -37,22 +37,20 @@ class CoverFoundSideBar; class QDialog; class KJob; -class KJobProgressBar; class KComboBox; class QListWidget; class QPushButton; class BoxWidget; -class QGridLayout; class QTabWidget; class CoverFoundDialog : public QDialog { Q_OBJECT public: - explicit CoverFoundDialog( const CoverFetchUnit::Ptr unit, + explicit CoverFoundDialog( const CoverFetchUnit::Ptr &unit, const CoverFetch::Metadata &data = CoverFetch::Metadata(), - QWidget *parent = 0 ); + QWidget *parent = nullptr ); ~CoverFoundDialog(); /** @@ -73,7 +71,7 @@ const CoverFetch::ImageSize imageSize = CoverFetch::NormalSize ); protected: - void hideEvent( QHideEvent *event ); + void hideEvent( QHideEvent *event ) override; protected Q_SLOTS: void slotButtonClicked( int button ); @@ -84,7 +82,7 @@ void clearView(); void downloadProgressed( qint64 bytesReceived, qint64 bytesTotal ); void fetchRequestRedirected( QNetworkReply *oldReply, QNetworkReply *newReply ); - void handleFetchResult( const QUrl &url, QByteArray data, NetworkAccessManagerProxy::Error e ); + void handleFetchResult( const QUrl &url, const QByteArray &data, const NetworkAccessManagerProxy::Error &e ); void insertComboText( const QString &text ); void currentItemChanged( QListWidgetItem *current, QListWidgetItem *previous ); void itemDoubleClicked( QListWidgetItem *item ); @@ -132,12 +130,12 @@ Q_OBJECT public: - explicit CoverFoundSideBar( const Meta::AlbumPtr album, QWidget *parent = 0 ); + explicit CoverFoundSideBar( const Meta::AlbumPtr &album, QWidget *parent = nullptr ); ~CoverFoundSideBar(); public Q_SLOTS: void clear(); - void setPixmap( const QPixmap &pixmap, CoverFetch::Metadata metadata ); + void setPixmap( const QPixmap &pixmap, const CoverFetch::Metadata &metadata ); void setPixmap( const QPixmap &pixmap ); private: @@ -162,7 +160,7 @@ explicit CoverFoundItem( const QImage &cover, const CoverFetch::Metadata &data, const CoverFetch::ImageSize imageSize = CoverFetch::NormalSize, - QListWidget *parent = 0 ); + QListWidget *parent = nullptr ); ~CoverFoundItem(); const CoverFetch::Metadata metadata() const { return m_metadata; } diff --git a/src/covermanager/CoverFoundDialog.cpp b/src/covermanager/CoverFoundDialog.cpp --- a/src/covermanager/CoverFoundDialog.cpp +++ b/src/covermanager/CoverFoundDialog.cpp @@ -55,7 +55,7 @@ #include #include -CoverFoundDialog::CoverFoundDialog( const CoverFetchUnit::Ptr unit, +CoverFoundDialog::CoverFoundDialog( const CoverFetchUnit::Ptr &unit, const CoverFetch::Metadata &data, QWidget *parent ) : QDialog( parent ) @@ -137,6 +137,10 @@ QAction *lastFmAct = new QAction( i18n( "Last.fm" ), sourceMenu ); QAction *googleAct = new QAction( i18n( "Google" ), sourceMenu ); QAction *discogsAct = new QAction( i18n( "Discogs" ), sourceMenu ); + // TODO: currently broken, re-enable after adjusting to current API/returned doc + googleAct->setEnabled( false ); + // TODO: currently broken, re-enable after adjusting to current API/returned doc + discogsAct->setEnabled( false ); lastFmAct->setCheckable( true ); googleAct->setCheckable( true ); discogsAct->setCheckable( true ); @@ -309,7 +313,7 @@ if( !query.isEmpty() ) q << query; q << text; - const QString result = q.join( QChar( ' ' ) ); + const QString result = q.join( QLatin1Char( ' ' ) ); qobject_cast( m_search->lineEdit() )->setText( result ); } } @@ -373,10 +377,10 @@ item->setSelected( true ); QMenu menu( this ); - QAction *display = new QAction( QIcon::fromTheme("zoom-original"), i18n("Display Cover"), &menu ); + QAction *display = new QAction( QIcon::fromTheme(QStringLiteral("zoom-original")), i18n("Display Cover"), &menu ); connect( display, &QAction::triggered, this, &CoverFoundDialog::display ); - QAction *save = new QAction( QIcon::fromTheme("document-save"), i18n("Save As"), &menu ); + QAction *save = new QAction( QIcon::fromTheme(QStringLiteral("document-save")), i18n("Save As"), &menu ); connect( save, &QAction::triggered, this, &CoverFoundDialog::saveAs ); menu.addAction( display ); @@ -495,8 +499,8 @@ } } -void CoverFoundDialog::handleFetchResult( const QUrl &url, QByteArray data, - NetworkAccessManagerProxy::Error e ) +void CoverFoundDialog::handleFetchResult( const QUrl &url, const QByteArray &data, + const NetworkAccessManagerProxy::Error &e ) { CoverFoundItem *item = m_urls.take( url ); QImage image; @@ -525,8 +529,7 @@ if( !url.isValid() ) return false; - QNetworkReply *reply = The::networkAccessManager()->getData( url, this, - SLOT(handleFetchResult(QUrl,QByteArray,NetworkAccessManagerProxy::Error)) ); + QNetworkReply *reply = The::networkAccessManager()->getData( url, this, &CoverFoundDialog::handleFetchResult ); m_urls.insert( url, item ); if( !m_dialog ) @@ -602,7 +605,7 @@ if( !q.isEmpty() ) { - emit newCustomQuery( m_album, q, m_queryPage ); + Q_EMIT newCustomQuery( m_album, q, m_queryPage ); updateSearchButton( q ); m_queryPage++; } @@ -717,7 +720,7 @@ setWindowTitle( caption ); } -CoverFoundSideBar::CoverFoundSideBar( const Meta::AlbumPtr album, QWidget *parent ) +CoverFoundSideBar::CoverFoundSideBar( const Meta::AlbumPtr &album, QWidget *parent ) : BoxWidget( true, parent ) , m_album( album ) { @@ -755,7 +758,7 @@ m_metadata.clear(); } -void CoverFoundSideBar::setPixmap( const QPixmap &pixmap, CoverFetch::Metadata metadata ) +void CoverFoundSideBar::setPixmap( const QPixmap &pixmap, const CoverFetch::Metadata &metadata ) { m_metadata = metadata; updateNotes(); @@ -828,7 +831,7 @@ { QLabel *label = new QLabel( value, 0 ); label->setToolTip( value ); - layout->addRow( QString("%1:").arg(name), label ); + layout->addRow( QStringLiteral("%1:").arg(name), label ); } } ++mit; @@ -854,10 +857,10 @@ const QString &tooltip = qfm.elidedText( toolUrl, Qt::ElideMiddle, 350 ); const QString &decoded = QUrl::fromPercentEncoding( refUrl.toLocal8Bit() ); const QString &url = QString( "
%2" ) - .arg( decoded ) - .arg( i18nc("@item::intable URL", "link") ); + .arg( decoded, + i18nc("@item::intable URL", "link") ); - QLabel *label = new QLabel( url, 0 ); + QLabel *label = new QLabel( url, nullptr ); label->setOpenExternalLinks( true ); label->setTextInteractionFlags( Qt::TextBrowserInteraction ); label->setToolTip( tooltip ); @@ -925,7 +928,7 @@ const QString &width = m_metadata.value( QLatin1String("width") ); const QString &height = m_metadata.value( QLatin1String("height") ); if( !width.isEmpty() && !height.isEmpty() ) - captions << QString( "%1 x %2" ).arg( width ).arg( height ); + captions << QString( "%1 x %2" ).arg( width, height ); int size = m_metadata.value( QLatin1String("size") ).toInt(); if( size ) diff --git a/src/covermanager/CoverManager.h b/src/covermanager/CoverManager.h --- a/src/covermanager/CoverManager.h +++ b/src/covermanager/CoverManager.h @@ -41,7 +41,6 @@ class QLabel; class CoverView; class QHBoxLayout; -class QProgressBar; class QHBoxLayout; class QColorGroup; class QSplitter; @@ -54,20 +53,20 @@ static bool s_constructed; public: - CoverManager( QWidget *parent = 0 ); + explicit CoverManager( QWidget *parent = nullptr ); ~CoverManager(); static bool isConstructed() { return s_constructed; } static CoverManager *instance() { return s_instance; } - static void showOnce( const QString &artist = QString(), QWidget* parent = 0 ); - static void viewCover( Meta::AlbumPtr album, QWidget* parent = 0 ); + static void showOnce( const QString &artist = QString(), QWidget* parent = nullptr ); + static void viewCover( const Meta::AlbumPtr &album, QWidget* parent = nullptr ); - void setStatusText( QString text ); + void setStatusText(const QString &text ); // Reimplemented from Meta::Observer using Observer::metadataChanged; - void metadataChanged( Meta::AlbumPtr album ); + void metadataChanged( const Meta::AlbumPtr &album ) override; public Q_SLOTS: void updateStatusBar(); @@ -81,7 +80,7 @@ void slotContinueConstruction(); void slotArtistSelected(); - void slotAlbumQueryResult( Meta::AlbumList albums ); + void slotAlbumQueryResult( const Meta::AlbumList &albums ); void slotAlbumFilterTriggered( QAction *action ); void slotArtistQueryDone(); void coverItemClicked( QListWidgetItem *item ); @@ -151,10 +150,10 @@ Q_OBJECT public: - explicit CoverView( QWidget *parent = 0, const char *name = 0, Qt::WindowFlags f = 0 ); + explicit CoverView( QWidget *parent = nullptr, const char *name = 0, Qt::WindowFlags f = {} ); protected: - void contextMenuEvent( QContextMenuEvent *event ); + void contextMenuEvent( QContextMenuEvent *event ) override; private Q_SLOTS: void setStatusText( QListWidgetItem *item ); diff --git a/src/covermanager/CoverManager.cpp b/src/covermanager/CoverManager.cpp --- a/src/covermanager/CoverManager.cpp +++ b/src/covermanager/CoverManager.cpp @@ -60,7 +60,7 @@ #include static QString artistToSelectInInitFunction; -CoverManager *CoverManager::s_instance = 0; +CoverManager *CoverManager::s_instance = nullptr; class ArtistItem : public QTreeWidgetItem { @@ -72,7 +72,7 @@ setText( 0, artist->prettyName() ); } - ArtistItem( const QString &text, QTreeWidget *parent = 0 ) + ArtistItem( const QString &text, QTreeWidget *parent = nullptr ) : QTreeWidgetItem( parent ) , m_artist( 0 ) { @@ -104,9 +104,8 @@ // Sets caption and icon correctly (needed e.g. for GNOME) //kapp->setTopWidget( this ); - QDialogButtonBox *buttonBox = new QDialogButtonBox( QDialogButtonBox::Close ); - QVBoxLayout *mainLayout = new QVBoxLayout; - setLayout(mainLayout); + QDialogButtonBox *buttonBox = new QDialogButtonBox( QDialogButtonBox::Close, this ); + QVBoxLayout *mainLayout = new QVBoxLayout(this); connect(buttonBox, &QDialogButtonBox::accepted, this, &CoverManager::accept); connect(buttonBox, &QDialogButtonBox::rejected, this, &CoverManager::reject); setWindowTitle( i18n("Cover Manager") ); @@ -202,7 +201,7 @@ viewGroup->addAction( m_selectAlbumsWithoutCover ); m_viewButton->setMenu( m_viewMenu ); - m_viewButton->setIcon( QIcon::fromTheme( "filename-album-amarok" ) ); + m_viewButton->setIcon( QIcon::fromTheme( QStringLiteral("filename-album-amarok") ) ); connect( m_viewMenu, &QMenu::triggered, this, &CoverManager::slotAlbumFilterTriggered ); //fetch missing covers button @@ -251,19 +250,6 @@ } } - // signals and slots connections - connect( m_artistView, &QTreeWidget::itemSelectionChanged, - this, &CoverManager::slotArtistSelected ); - connect( m_coverView, &CoverView::itemActivated, - this, &CoverManager::coverItemClicked ); - connect( m_timer, &QTimer::timeout, - this, &CoverManager::slotSetFilter ); - connect( m_searchEdit, &Amarok::LineEdit::textChanged, - this, &CoverManager::slotSetFilterTimeout ); - - if( item == 0 ) - item = m_artistView->invisibleRootItem()->child( 0 ); - // signals and slots connections connect( m_artistView, &QTreeWidget::itemSelectionChanged, this, &CoverManager::slotArtistSelected ); @@ -287,19 +273,19 @@ qDeleteAll( m_coverItems ); delete m_coverView; m_coverView = 0; - s_instance = 0; + s_instance = nullptr; } void -CoverManager::viewCover( Meta::AlbumPtr album, QWidget *parent ) //static +CoverManager::viewCover( const Meta::AlbumPtr &album, QWidget *parent ) //static { //QDialog means "escape" works as expected QDialog *dialog = new CoverViewDialog( album, parent ); dialog->show(); } void -CoverManager::metadataChanged( Meta::AlbumPtr album ) +CoverManager::metadataChanged(const Meta::AlbumPtr &album ) { const QString albumName = album->name(); foreach( CoverViewItem *item, m_coverItems ) @@ -399,7 +385,7 @@ } void -CoverManager::slotAlbumQueryResult( Meta::AlbumList albums ) //SLOT +CoverManager::slotAlbumQueryResult( const Meta::AlbumList &albums ) //SLOT { m_albumList = albums; } @@ -736,7 +722,7 @@ } void -CoverManager::setStatusText( QString text ) +CoverManager::setStatusText( const QString &text ) { m_oldStatusText = m_statusLabel->text(); m_statusLabel->setText( text ); @@ -846,12 +832,12 @@ void CoverView::setStatusText( QListWidgetItem *item ) { - #define item static_cast( item ) - if ( !item ) + #define itemmacro static_cast( item ) + if ( !itemmacro ) return; - const QString artist = item->albumPtr()->isCompilation() ? i18n( "Various Artists" ) : item->artist(); - const QString tipContent = i18n( "%1 - %2", artist , item->album() ); + const QString artist = itemmacro->albumPtr()->isCompilation() ? i18n( "Various Artists" ) : itemmacro->artist(); + const QString tipContent = i18n( "%1 - %2", artist , itemmacro->album() ); CoverManager::instance()->setStatusText( tipContent ); #undef item } diff --git a/src/covermanager/CoverViewDialog.cpp b/src/covermanager/CoverViewDialog.cpp --- a/src/covermanager/CoverViewDialog.cpp +++ b/src/covermanager/CoverViewDialog.cpp @@ -57,8 +57,8 @@ QString width = QString::number( m_size.width() ); QString height = QString::number( m_size.height() ); QString zoom = QString::number( m_zoom ); - QString size = QString( "%1x%2" ).arg( width, height ); - QString caption = QString( "%1 - %2 - %3\%" ).arg( m_title, size, zoom ); + QString size = QStringLiteral( "%1x%2" ).arg( width, height ); + QString caption = QStringLiteral( "%1 - %2 - %3%" ).arg( m_title, size, zoom ); setWindowTitle( caption ); } diff --git a/src/databaseimporter/SqlBatchImporter.h b/src/databaseimporter/SqlBatchImporter.h --- a/src/databaseimporter/SqlBatchImporter.h +++ b/src/databaseimporter/SqlBatchImporter.h @@ -32,7 +32,7 @@ Q_OBJECT public: - SqlBatchImporter( QObject *parent ); + explicit SqlBatchImporter( QObject *parent ); ~SqlBatchImporter(); SqlBatchImporterConfig *configWidget( QWidget *parent ); @@ -55,20 +55,20 @@ Q_SIGNALS: void importFailed(); void importSucceeded(); - void importError( QString ); - void showMessage( QString ); + void importError( const QString& ); + void showMessage( const QString& ); void trackAdded( Meta::TrackPtr ); - void trackDiscarded( QString ); - void trackMatchFound( Meta::TrackPtr, QString ); - void trackMatchMultiple( Meta::TrackList, QString ); + void trackDiscarded( const QString& ); + void trackMatchFound( Meta::TrackPtr, const QString& ); + void trackMatchMultiple( Meta::TrackList, const QString& ); protected: void import(); protected Q_SLOTS: void importingFinished(); - void trackImported( Meta::TrackPtr track ); - void trackMatched( Meta::TrackPtr track, QString oldUrl ); + void trackImported( const Meta::TrackPtr &track ); + void trackMatched( const Meta::TrackPtr &track, const QString &oldUrl ); private: SqlBatchImporterConfig *m_config; diff --git a/src/databaseimporter/SqlBatchImporter.cpp b/src/databaseimporter/SqlBatchImporter.cpp --- a/src/databaseimporter/SqlBatchImporter.cpp +++ b/src/databaseimporter/SqlBatchImporter.cpp @@ -80,14 +80,14 @@ numStarted++; } else { debug() << "could not open"; - emit importError( i18n( "Could not open file \"%1\".", m_config->inputFilePath() ) ); + Q_EMIT importError( i18n( "Could not open file \"%1\".", m_config->inputFilePath() ) ); delete file; } } } if( !numStarted ) - emit importFailed(); + Q_EMIT importFailed(); } int @@ -97,14 +97,14 @@ } void -SqlBatchImporter::trackImported( Meta::TrackPtr track ) +SqlBatchImporter::trackImported( const Meta::TrackPtr &track ) { Q_UNUSED( track ) ++m_count; } void -SqlBatchImporter::trackMatched( Meta::TrackPtr track, QString oldUrl ) +SqlBatchImporter::trackMatched(const Meta::TrackPtr &track, const QString &oldUrl ) { Q_UNUSED( track ) Q_UNUSED( oldUrl ) diff --git a/src/databaseimporter/SqlBatchImporterConfig.h b/src/databaseimporter/SqlBatchImporterConfig.h --- a/src/databaseimporter/SqlBatchImporterConfig.h +++ b/src/databaseimporter/SqlBatchImporterConfig.h @@ -22,15 +22,14 @@ #include #include -class QLabel; class QLineEdit; class SqlBatchImporterConfig : public BoxWidget { Q_OBJECT public: - SqlBatchImporterConfig( QWidget *parent = 0 ); + explicit SqlBatchImporterConfig( QWidget *parent = nullptr ); virtual ~SqlBatchImporterConfig() { } QString inputFilePath() const; diff --git a/src/dbus/CollectionDBusHandler.h b/src/dbus/CollectionDBusHandler.h --- a/src/dbus/CollectionDBusHandler.h +++ b/src/dbus/CollectionDBusHandler.h @@ -34,7 +34,7 @@ Q_CLASSINFO( "Collection D-Bus Interface", "org.kde.amarok.Collection" ) public: - CollectionDBusHandler( QObject *parent ); + explicit CollectionDBusHandler( QObject *parent ); public Q_SLOTS: /* diff --git a/src/dbus/CollectionDBusHandler.cpp b/src/dbus/CollectionDBusHandler.cpp --- a/src/dbus/CollectionDBusHandler.cpp +++ b/src/dbus/CollectionDBusHandler.cpp @@ -27,11 +27,11 @@ : QObject( parent ) , QDBusContext() { - setObjectName("CollectionDBusHandler"); + setObjectName(QStringLiteral("CollectionDBusHandler")); qDBusRegisterMetaType(); new CollectionAdaptor( this ); - bool result = QDBusConnection::sessionBus().registerObject("/Collection", this); + bool result = QDBusConnection::sessionBus().registerObject(QStringLiteral("/Collection"), this); debug() << "Register object: " << result; } diff --git a/src/dbus/DBusQueryHelper.cpp b/src/dbus/DBusQueryHelper.cpp --- a/src/dbus/DBusQueryHelper.cpp +++ b/src/dbus/DBusQueryHelper.cpp @@ -74,7 +74,7 @@ deleteLater(); m_timeout = true; - QDBusMessage error = m_message.createErrorReply( QDBusError::InternalError, "Internal timeout" ); + QDBusMessage error = m_message.createErrorReply( QDBusError::InternalError, QStringLiteral("Internal timeout") ); bool success = m_connection.send( error ); if( !success ) debug() << "sending async error failed"; diff --git a/src/dbus/mpris1/PlayerHandler.h b/src/dbus/mpris1/PlayerHandler.h --- a/src/dbus/mpris1/PlayerHandler.h +++ b/src/dbus/mpris1/PlayerHandler.h @@ -106,10 +106,10 @@ void StatusChange( Mpris1::Status ); public: - QVariantMap GetTrackMetadata( Meta::TrackPtr track ); + QVariantMap GetTrackMetadata( const Meta::TrackPtr &track ); private Q_SLOTS: - void slotTrackChanged( Meta::TrackPtr track ); + void slotTrackChanged( const Meta::TrackPtr &track ); void slotStateChanged(); }; diff --git a/src/dbus/mpris1/PlayerHandler.cpp b/src/dbus/mpris1/PlayerHandler.cpp --- a/src/dbus/mpris1/PlayerHandler.cpp +++ b/src/dbus/mpris1/PlayerHandler.cpp @@ -31,7 +31,7 @@ #include "playlist/PlaylistModelStack.h" #include "widgets/Osd.h" -#include +#include // Marshall the Status data into a D-BUS argument QDBusArgument &operator<<(QDBusArgument &argument, const Mpris1::Status &status) @@ -66,12 +66,12 @@ { qDBusRegisterMetaType(); - setObjectName("PlayerHandler"); + setObjectName(QStringLiteral("PlayerHandler")); new Mpris1PlayerAdaptor( this ); // amarok extensions: new Mpris1AmarokPlayerAdaptor( this ); - QDBusConnection::sessionBus().registerObject("/Player", this); + QDBusConnection::sessionBus().registerObject(QStringLiteral("/Player"), this); connect( The::playlistActions(), &Playlist::Actions::navigatorChanged, this, &PlayerHandler::updateStatus ); @@ -260,18 +260,18 @@ void PlayerHandler::updateStatus() { Status status = GetStatus(); - emit StatusChange( status ); - emit CapsChange( GetCaps() ); + Q_EMIT StatusChange( status ); + Q_EMIT CapsChange( GetCaps() ); } - QVariantMap PlayerHandler::GetTrackMetadata( Meta::TrackPtr track ) + QVariantMap PlayerHandler::GetTrackMetadata( const Meta::TrackPtr &track ) { return Meta::Field::mprisMapFromTrack( track ); } - void PlayerHandler::slotTrackChanged( Meta::TrackPtr track ) + void PlayerHandler::slotTrackChanged( const Meta::TrackPtr &track ) { - emit TrackChange( GetTrackMetadata( track ) ); + Q_EMIT TrackChange( GetTrackMetadata( track ) ); } void PlayerHandler::slotStateChanged() diff --git a/src/dbus/mpris1/RootHandler.cpp b/src/dbus/mpris1/RootHandler.cpp --- a/src/dbus/mpris1/RootHandler.cpp +++ b/src/dbus/mpris1/RootHandler.cpp @@ -55,12 +55,12 @@ new Mpris1RootAdaptor( this ); // amarok extensions: new Mpris1AmarokAppAdaptor( this ); - QDBusConnection::sessionBus().registerObject("/", this); + QDBusConnection::sessionBus().registerObject(QStringLiteral("/"), this); } QString RootHandler::Identity() { - return QString( "%1 %2" ).arg( "Amarok", AMAROK_VERSION ); + return QStringLiteral( "%1 %2" ).arg( QStringLiteral("Amarok"), AMAROK_VERSION ); } void RootHandler::Quit() diff --git a/src/dbus/mpris1/TrackListHandler.cpp b/src/dbus/mpris1/TrackListHandler.cpp --- a/src/dbus/mpris1/TrackListHandler.cpp +++ b/src/dbus/mpris1/TrackListHandler.cpp @@ -39,7 +39,7 @@ : QObject( qApp ) { new Mpris1TrackListAdaptor(this); - QDBusConnection::sessionBus().registerObject( "/TrackList", this ); + QDBusConnection::sessionBus().registerObject( QStringLiteral("/TrackList"), this ); connect( The::playlist()->qaim(), &QAbstractItemModel::rowsInserted, this, &TrackListHandler::slotTrackListChange ); connect( The::playlist()->qaim(), &QAbstractItemModel::rowsRemoved, this, &TrackListHandler::slotTrackListChange ); } @@ -114,7 +114,7 @@ void TrackListHandler::slotTrackListChange() { - emit TrackListChange( The::playlist()->qaim()->rowCount() ); + Q_EMIT TrackListChange( The::playlist()->qaim()->rowCount() ); } void TrackListHandler::UpdateAllPodcasts() diff --git a/src/dbus/mpris2/DBusAbstractAdaptor.cpp b/src/dbus/mpris2/DBusAbstractAdaptor.cpp --- a/src/dbus/mpris2/DBusAbstractAdaptor.cpp +++ b/src/dbus/mpris2/DBusAbstractAdaptor.cpp @@ -93,8 +93,8 @@ warning() << "MPRIS2: No D-Bus interface given (missing Q_CLASSINFO)"; } else { QDBusMessage signal = QDBusMessage::createSignal( m_path, - "org.freedesktop.DBus.Properties", - "PropertiesChanged" ); + QStringLiteral("org.freedesktop.DBus.Properties"), + QStringLiteral("PropertiesChanged") ); signal << metaObject()->classInfo( ifaceIndex ).value(); signal << m_updatedProperties; signal << m_invalidatedProperties; diff --git a/src/dbus/mpris2/DBusAmarokApp.h b/src/dbus/mpris2/DBusAmarokApp.h --- a/src/dbus/mpris2/DBusAmarokApp.h +++ b/src/dbus/mpris2/DBusAmarokApp.h @@ -18,8 +18,8 @@ * along with this program. If not, see . ***********************************************************************/ -#ifndef AMAROK_MEDIAPLAYRER2AMAROKAPP_H -#define AMAROK_MEDIAPLAYRER2AMAROKAPP_H +#ifndef AMAROK_DBUS_AMAROKAPP_H +#define AMAROK_DBUS_AMAROKAPP_H #include "DBusAbstractAdaptor.h" @@ -43,5 +43,5 @@ }; } -#endif // AMAROK_MEDIAPLAYRER2AMAROKAPP_H +#endif // AMAROK_DBUS_AMAROKAPP_H diff --git a/src/dbus/mpris2/MediaPlayer2.cpp b/src/dbus/mpris2/MediaPlayer2.cpp --- a/src/dbus/mpris2/MediaPlayer2.cpp +++ b/src/dbus/mpris2/MediaPlayer2.cpp @@ -94,12 +94,12 @@ QString MediaPlayer2::DesktopEntry() const { - return QLatin1String("org.kde.amarok"); + return QStringLiteral("org.kde.amarok"); } QStringList MediaPlayer2::SupportedUriSchemes() const { - return QStringList() << "file" << "http"; + return QStringList() << QStringLiteral("file") << QStringLiteral("http"); } QStringList MediaPlayer2::SupportedMimeTypes() const diff --git a/src/dbus/mpris2/MediaPlayer2AmarokExtensions.h b/src/dbus/mpris2/MediaPlayer2AmarokExtensions.h --- a/src/dbus/mpris2/MediaPlayer2AmarokExtensions.h +++ b/src/dbus/mpris2/MediaPlayer2AmarokExtensions.h @@ -18,8 +18,8 @@ * along with this program. If not, see . ***********************************************************************/ -#ifndef AMAROK_MEDIAPLAYRER2AMAROKEXTENSIONS_H -#define AMAROK_MEDIAPLAYRER2AMAROKEXTENSIONS_H +#ifndef AMAROK_MEDIAPLAYER2AMAROKEXTENSIONS_H +#define AMAROK_MEDIAPLAYER2AMAROKEXTENSIONS_H #include "DBusAbstractAdaptor.h" @@ -51,4 +51,4 @@ }; } -#endif // AMAROK_MEDIAPLAYRER2AMAROKEXTENSIONS_H +#endif // AMAROK_MEDIAPLAYER2AMAROKEXTENSIONS_H diff --git a/src/dbus/mpris2/MediaPlayer2AmarokExtensions.cpp b/src/dbus/mpris2/MediaPlayer2AmarokExtensions.cpp --- a/src/dbus/mpris2/MediaPlayer2AmarokExtensions.cpp +++ b/src/dbus/mpris2/MediaPlayer2AmarokExtensions.cpp @@ -67,6 +67,6 @@ void MediaPlayer2AmarokExtensions::mutedChanged( bool newValue ) { - signalPropertyChange( "Muted", newValue ); + signalPropertyChange( QStringLiteral("Muted"), newValue ); } diff --git a/src/dbus/mpris2/MediaPlayer2Player.h b/src/dbus/mpris2/MediaPlayer2Player.h --- a/src/dbus/mpris2/MediaPlayer2Player.h +++ b/src/dbus/mpris2/MediaPlayer2Player.h @@ -18,8 +18,8 @@ * along with this program. If not, see . ***********************************************************************/ -#ifndef AMAROK_MEDIAPLAYRER2PLAYER_H -#define AMAROK_MEDIAPLAYRER2PLAYER_H +#ifndef AMAROK_MEDIAPLAYER2PLAYER_H +#define AMAROK_MEDIAPLAYER2PLAYER_H #include "DBusAbstractAdaptor.h" @@ -88,29 +88,29 @@ void Play() const; void Seek( qlonglong Offset ) const; void SetPosition( const QDBusObjectPath& TrackId, qlonglong Position ) const; - void OpenUri( QString Uri ) const; + void OpenUri( const QString &Uri ) const; private Q_SLOTS: void trackPositionChanged( qint64 position, bool userSeek ); - void trackChanged( Meta::TrackPtr track ); - void trackMetadataChanged( Meta::TrackPtr track ); - void albumMetadataChanged( Meta::AlbumPtr album ); + void trackChanged( const Meta::TrackPtr &track ); + void trackMetadataChanged( const Meta::TrackPtr &track ); + void albumMetadataChanged( const Meta::AlbumPtr &album ); void seekableChanged( bool seekable ); void volumeChanged( int newVolPercent ); void trackLengthChanged( qint64 milliseconds ); void playbackStateChanged(); void playlistNavigatorChanged(); - void playlistRowsInserted( QModelIndex, int, int ); - void playlistRowsMoved( QModelIndex, int, int, QModelIndex, int ); - void playlistRowsRemoved( QModelIndex, int, int ); + void playlistRowsInserted(const QModelIndex &, int, int ); + void playlistRowsMoved(const QModelIndex &, int, int, const QModelIndex &, int ); + void playlistRowsRemoved(const QModelIndex &, int, int ); void playlistReplaced(); void playlistActiveTrackChanged( quint64 ); private: - QVariantMap metadataForTrack( Meta::TrackPtr track ) const; + QVariantMap metadataForTrack( const Meta::TrackPtr &track ) const; qint64 m_lastPosition; }; } -#endif // AMAROK_MEDIAPLAYRER2PLAYER_H +#endif // AMAROK_MEDIAPLAYER2PLAYER_H diff --git a/src/dbus/mpris2/MediaPlayer2Player.cpp b/src/dbus/mpris2/MediaPlayer2Player.cpp --- a/src/dbus/mpris2/MediaPlayer2Player.cpp +++ b/src/dbus/mpris2/MediaPlayer2Player.cpp @@ -38,10 +38,10 @@ { QString path; if( playlistTrackId > 0 ) { - path = QString( "/org/kde/amarok/Track/%1" ).arg( playlistTrackId ); + path = QStringLiteral( "/org/kde/amarok/Track/%1" ).arg( playlistTrackId ); } else { // dropped out of the playlist - path = QLatin1String( "/org/kde/amarok/OrphanTrack" ); + path = QStringLiteral( "/org/kde/amarok/OrphanTrack" ); } return QDBusObjectPath( path ); } @@ -169,20 +169,20 @@ debug() << "SetPosition() called with a trackId (" << TrackId.path() << ") which is not for the active track (" << activeTrackId.path() << ")"; } -void MediaPlayer2Player::OpenUri( QString Uri ) const +void MediaPlayer2Player::OpenUri( const QString &Uri ) const { QUrl url( Uri ); The::playlistController()->insertOptioned( url, Playlist::OnPlayMediaAction ); } QString MediaPlayer2Player::PlaybackStatus() const { if( The::engineController()->isPlaying() ) - return QLatin1String( "Playing" ); + return QStringLiteral( "Playing" ); else if ( The::engineController()->isPaused() ) - return QLatin1String( "Paused" ); + return QStringLiteral( "Paused" ); else - return QLatin1String( "Stopped" ); + return QStringLiteral( "Stopped" ); } QString MediaPlayer2Player::LoopStatus() const @@ -193,15 +193,15 @@ case AmarokConfig::EnumTrackProgression::OnlyQueue: case AmarokConfig::EnumTrackProgression::RandomTrack: case AmarokConfig::EnumTrackProgression::RandomAlbum: - return QLatin1String( "None" ); + return QStringLiteral( "None" ); case AmarokConfig::EnumTrackProgression::RepeatTrack: - return QLatin1String( "Track" ); + return QStringLiteral( "Track" ); case AmarokConfig::EnumTrackProgression::RepeatAlbum: case AmarokConfig::EnumTrackProgression::RepeatPlaylist: - return QLatin1String( "Playlist" ); + return QStringLiteral( "Playlist" ); default: Q_ASSERT( false ); - return QLatin1String( "None" ); + return QStringLiteral( "None" ); } } @@ -258,18 +258,18 @@ The::playlistActions()->playlistModeChanged(); } -QVariantMap MediaPlayer2Player::metadataForTrack( Meta::TrackPtr track ) const +QVariantMap MediaPlayer2Player::metadataForTrack( const Meta::TrackPtr &track ) const { if ( !track ) return QVariantMap(); QVariantMap metaData = Meta::Field::mpris20MapFromTrack( track ); if ( track == The::playlist()->activeTrack() ) - metaData["mpris:trackid"] = QVariant::fromValue( activeMprisTrackId() ); + metaData[QStringLiteral("mpris:trackid")] = QVariant::fromValue( activeMprisTrackId() ); else { // we should be updated shortly - QString path = QLatin1String( "/org/kde/amarok/PendingTrack" ); - metaData["mpris:trackid"] = QVariant::fromValue( QDBusObjectPath( path ) ); + QString path = QStringLiteral( "/org/kde/amarok/PendingTrack" ); + metaData[QStringLiteral("mpris:trackid")] = QVariant::fromValue( QDBusObjectPath( path ) ); } return metaData; } @@ -333,88 +333,88 @@ void MediaPlayer2Player::trackPositionChanged( qint64 position, bool userSeek ) { if ( userSeek ) - emit Seeked( position * 1000 ); + Q_EMIT Seeked( position * 1000 ); m_lastPosition = position; } -void MediaPlayer2Player::trackChanged( Meta::TrackPtr track ) +void MediaPlayer2Player::trackChanged( const Meta::TrackPtr &track ) { - signalPropertyChange( "CanPause", CanPause() ); - signalPropertyChange( "Metadata", metadataForTrack( track ) ); + signalPropertyChange( QStringLiteral("CanPause"), CanPause() ); + signalPropertyChange( QStringLiteral("Metadata"), metadataForTrack( track ) ); } -void MediaPlayer2Player::trackMetadataChanged( Meta::TrackPtr track ) +void MediaPlayer2Player::trackMetadataChanged( const Meta::TrackPtr &track ) { - signalPropertyChange( "Metadata", metadataForTrack( track ) ); + signalPropertyChange( QStringLiteral("Metadata"), metadataForTrack( track ) ); } -void MediaPlayer2Player::albumMetadataChanged( Meta::AlbumPtr album ) +void MediaPlayer2Player::albumMetadataChanged( const Meta::AlbumPtr &album ) { Q_UNUSED( album ) - signalPropertyChange( "Metadata", Metadata() ); + signalPropertyChange( QStringLiteral("Metadata"), Metadata() ); } void MediaPlayer2Player::seekableChanged( bool seekable ) { - signalPropertyChange( "CanSeek", seekable ); + signalPropertyChange( QStringLiteral("CanSeek"), seekable ); } void MediaPlayer2Player::volumeChanged( int percent ) { DEBUG_BLOCK - signalPropertyChange( "Volume", static_cast(percent) / 100.0 ); + signalPropertyChange( QStringLiteral("Volume"), static_cast(percent) / 100.0 ); } void MediaPlayer2Player::trackLengthChanged( qint64 milliseconds ) { // milliseconds < 0 is not a helpful value, and generally happens // when the track changes or playback is stopped; these cases are // dealt with better by other signal handlers if ( milliseconds >= 0 ) - signalPropertyChange( "Metadata", Metadata() ); + signalPropertyChange( QStringLiteral("Metadata"), Metadata() ); } void MediaPlayer2Player::playbackStateChanged() { - signalPropertyChange( "PlaybackStatus", PlaybackStatus() ); + signalPropertyChange( QStringLiteral("PlaybackStatus"), PlaybackStatus() ); } void MediaPlayer2Player::playlistNavigatorChanged() { - signalPropertyChange( "CanGoNext", CanGoNext() ); - signalPropertyChange( "CanGoPrevious", CanGoPrevious() ); - signalPropertyChange( "LoopStatus", LoopStatus() ); - signalPropertyChange( "Shuffle", Shuffle() ); + signalPropertyChange( QStringLiteral("CanGoNext"), CanGoNext() ); + signalPropertyChange( QStringLiteral("CanGoPrevious"), CanGoPrevious() ); + signalPropertyChange( QStringLiteral("LoopStatus"), LoopStatus() ); + signalPropertyChange( QStringLiteral("Shuffle"), Shuffle() ); } -void MediaPlayer2Player::playlistRowsInserted( QModelIndex, int, int ) +void MediaPlayer2Player::playlistRowsInserted( const QModelIndex&, int, int ) { - signalPropertyChange( "CanGoPrevious", CanGoPrevious() ); - signalPropertyChange( "CanGoPrevious", CanGoPrevious() ); + signalPropertyChange( QStringLiteral("CanGoPrevious"), CanGoPrevious() ); + signalPropertyChange( QStringLiteral("CanGoPrevious"), CanGoPrevious() ); } -void MediaPlayer2Player::playlistRowsMoved( QModelIndex, int, int, QModelIndex, int ) +void MediaPlayer2Player::playlistRowsMoved( const QModelIndex&, int, int, const QModelIndex&, int ) { - signalPropertyChange( "CanGoPrevious", CanGoPrevious() ); - signalPropertyChange( "CanGoPrevious", CanGoPrevious() ); + signalPropertyChange( QStringLiteral("CanGoPrevious"), CanGoPrevious() ); + signalPropertyChange( QStringLiteral("CanGoPrevious"), CanGoPrevious() ); } -void MediaPlayer2Player::playlistRowsRemoved( QModelIndex, int, int ) +void MediaPlayer2Player::playlistRowsRemoved( const QModelIndex&, int, int ) { - signalPropertyChange( "CanGoPrevious", CanGoPrevious() ); - signalPropertyChange( "CanGoPrevious", CanGoPrevious() ); + signalPropertyChange( QStringLiteral("CanGoPrevious"), CanGoPrevious() ); + signalPropertyChange( QStringLiteral("CanGoPrevious"), CanGoPrevious() ); } void MediaPlayer2Player::playlistReplaced() { - signalPropertyChange( "CanGoPrevious", CanGoPrevious() ); - signalPropertyChange( "CanGoPrevious", CanGoPrevious() ); + signalPropertyChange( QStringLiteral("CanGoPrevious"), CanGoPrevious() ); + signalPropertyChange( QStringLiteral("CanGoPrevious"), CanGoPrevious() ); } void MediaPlayer2Player::playlistActiveTrackChanged( quint64 ) { - signalPropertyChange( "CanGoPrevious", CanGoPrevious() ); - signalPropertyChange( "CanGoPrevious", CanGoPrevious() ); + signalPropertyChange( QStringLiteral("CanGoPrevious"), CanGoPrevious() ); + signalPropertyChange( QStringLiteral("CanGoPrevious"), CanGoPrevious() ); } diff --git a/src/dbus/mpris2/Mpris2.h b/src/dbus/mpris2/Mpris2.h --- a/src/dbus/mpris2/Mpris2.h +++ b/src/dbus/mpris2/Mpris2.h @@ -30,7 +30,7 @@ Q_OBJECT public: - explicit Mpris2( QObject *parent = 0 ); + explicit Mpris2( QObject *parent = nullptr ); ~Mpris2(); }; } diff --git a/src/dbus/mpris2/Mpris2.cpp b/src/dbus/mpris2/Mpris2.cpp --- a/src/dbus/mpris2/Mpris2.cpp +++ b/src/dbus/mpris2/Mpris2.cpp @@ -34,7 +34,7 @@ Mpris2::Mpris2( QObject *parent ) : QObject( parent ) { - QString mpris2Name( "org.mpris.MediaPlayer2.amarok" ); + QString mpris2Name( QStringLiteral("org.mpris.MediaPlayer2.amarok") ); bool success = QDBusConnection::sessionBus().registerService( mpris2Name ); @@ -49,14 +49,14 @@ if ( success ) { DBusAbstractAdaptor *adaptor = new MediaPlayer2( this ); - adaptor->setDBusPath( "/org/mpris/MediaPlayer2" ); + adaptor->setDBusPath( QStringLiteral("/org/mpris/MediaPlayer2") ); adaptor = new MediaPlayer2Player( this ); - adaptor->setDBusPath( "/org/mpris/MediaPlayer2" ); + adaptor->setDBusPath( QStringLiteral("/org/mpris/MediaPlayer2") ); adaptor = new MediaPlayer2AmarokExtensions( this ); - adaptor->setDBusPath( "/org/mpris/MediaPlayer2" ); + adaptor->setDBusPath( QStringLiteral("/org/mpris/MediaPlayer2") ); adaptor = new DBusAmarokApp( this ); - adaptor->setDBusPath( "/org/mpris/MediaPlayer2" ); - QDBusConnection::sessionBus().registerObject( "/org/mpris/MediaPlayer2", this, QDBusConnection::ExportAdaptors ); + adaptor->setDBusPath( QStringLiteral("/org/mpris/MediaPlayer2") ); + QDBusConnection::sessionBus().registerObject( QStringLiteral("/org/mpris/MediaPlayer2"), this, QDBusConnection::ExportAdaptors ); } } diff --git a/src/dialogs/CollectionSetup.h b/src/dialogs/CollectionSetup.h --- a/src/dialogs/CollectionSetup.h +++ b/src/dialogs/CollectionSetup.h @@ -29,7 +29,6 @@ class QAction; class QCheckBox; -class TranscodingConfig; namespace CollectionFolder { class Model; } @@ -42,7 +41,7 @@ public: static CollectionSetup* instance() { return s_instance; } - CollectionSetup( QWidget* ); + explicit CollectionSetup( QWidget* ); virtual ~CollectionSetup() {} void writeConfig(); @@ -89,15 +88,15 @@ class Model : public QFileSystemModel { public: - Model( QObject *parent ); + explicit Model( QObject *parent ); - virtual Qt::ItemFlags flags( const QModelIndex &index ) const; - QVariant data( const QModelIndex& index, int role = Qt::DisplayRole ) const; - bool setData( const QModelIndex& index, const QVariant& value, int role = Qt::EditRole ); - virtual int columnCount( const QModelIndex& ) const { return 1; } + Qt::ItemFlags flags( const QModelIndex &index ) const override; + QVariant data( const QModelIndex& index, int role = Qt::DisplayRole ) const override; + bool setData( const QModelIndex& index, const QVariant& value, int role = Qt::EditRole ) override; + int columnCount( const QModelIndex& ) const override { return 1; } /** Set the currently checked directories according to dirs */ - void setDirectories( QStringList &dirs ); + void setDirectories(const QStringList &dirs ); /** Returns the currently checked directories in this model. */ QStringList directories() const; @@ -134,7 +133,7 @@ static inline QString normalPath( const QString &path ) { - return path.endsWith( '/' ) ? path : path + '/'; + return path.endsWith( QLatin1Char('/') ) ? path : path + QLatin1Char('/'); } QSet m_checked; diff --git a/src/dialogs/CollectionSetup.cpp b/src/dialogs/CollectionSetup.cpp --- a/src/dialogs/CollectionSetup.cpp +++ b/src/dialogs/CollectionSetup.cpp @@ -304,7 +304,7 @@ QString topAncestor; // Remove all selected ancestor of path, and find shallowest // ancestor - foreach( QString elem, ancestors ) + for ( const QString &elem : ancestors ) { m_checked.remove( elem ); if( elem < topAncestor || topAncestor.isEmpty() ) @@ -317,14 +317,14 @@ } // A check or un-check can possibly require the whole view to change, // so we signal that the root's data is changed - emit dataChanged( QModelIndex(), QModelIndex() ); + Q_EMIT dataChanged( QModelIndex(), QModelIndex() ); return true; } return QFileSystemModel::setData( index, value, role ); } void - Model::setDirectories( QStringList &dirs ) + Model::setDirectories( const QStringList &dirs ) { m_checked.clear(); foreach( const QString &dir, dirs ) diff --git a/src/dialogs/DatabaseImporterDialog.h b/src/dialogs/DatabaseImporterDialog.h --- a/src/dialogs/DatabaseImporterDialog.h +++ b/src/dialogs/DatabaseImporterDialog.h @@ -24,9 +24,6 @@ #include #include -class QAbstractButton; -class QButtonGroup; -class QRadioButton; class QPlainTextEdit; class KPageWidgetItem; class BoxWidget; @@ -38,19 +35,19 @@ Q_OBJECT public: - DatabaseImporterDialog( QWidget *parent = 0 ); + explicit DatabaseImporterDialog( QWidget *parent = nullptr ); ~DatabaseImporterDialog(); private Q_SLOTS: void importFailed(); void importSucceeded(); - void importError( QString error ); + void importError( const QString &error ); void importedTrack( Meta::TrackPtr track ); - void discardedTrack( QString url ); - void matchedTrack( Meta::TrackPtr track, QString oldUrl ); - void ambigousTrack( Meta::TrackList tracks, QString oldUrl ); + void discardedTrack( const QString &url ); + void matchedTrack(Meta::TrackPtr track, const QString &oldUrl ); + void ambigousTrack( const Meta::TrackList &tracks, const QString &oldUrl ); void pageChanged( KPageWidgetItem *current, KPageWidgetItem *before ); - void showMessage( QString message ); + void showMessage( const QString &message ); private: SqlBatchImporter *m_importer; diff --git a/src/dialogs/DatabaseImporterDialog.cpp b/src/dialogs/DatabaseImporterDialog.cpp --- a/src/dialogs/DatabaseImporterDialog.cpp +++ b/src/dialogs/DatabaseImporterDialog.cpp @@ -121,13 +121,13 @@ } void -DatabaseImporterDialog::showMessage( QString message ) +DatabaseImporterDialog::showMessage( const QString &message ) { m_results->appendHtml( message ); } void -DatabaseImporterDialog::importError( QString error ) +DatabaseImporterDialog::importError( const QString &error ) { QString text = i18n( "Error: %1", error ); m_results->appendHtml( text ); @@ -155,15 +155,15 @@ m_results->appendHtml( text ); } -void DatabaseImporterDialog::discardedTrack( QString url ) +void DatabaseImporterDialog::discardedTrack( const QString &url ) { QString text; text = i18nc( "Track has been discarded, format: Url", "Discarded %1", url ); m_results->appendHtml( text ); } -void DatabaseImporterDialog::matchedTrack( Meta::TrackPtr track, QString oldUrl ) +void DatabaseImporterDialog::matchedTrack( Meta::TrackPtr track, const QString &oldUrl ) { if( !track ) return; @@ -185,13 +185,13 @@ m_results->appendHtml( text ); } -void DatabaseImporterDialog::ambigousTrack( Meta::TrackList tracks, QString oldUrl ) +void DatabaseImporterDialog::ambigousTrack( const Meta::TrackList &tracks, const QString &oldUrl ) { Q_UNUSED( tracks ); QString text; // TODO: wording; etc. - text = i18nc( "Track has been matched ambigously, format: Url", + text = i18nc( "Track has been matched ambiguously, format: Url", "Multiple ambiguous matches found for %1, has been discarded.", oldUrl ); m_results->appendHtml( text ); } diff --git a/src/dialogs/DiagnosticDialog.h b/src/dialogs/DiagnosticDialog.h --- a/src/dialogs/DiagnosticDialog.h +++ b/src/dialogs/DiagnosticDialog.h @@ -30,7 +30,7 @@ Q_OBJECT public: - explicit DiagnosticDialog( const KAboutData about, QWidget *parent = 0 ); + explicit DiagnosticDialog( const KAboutData &about, QWidget *parent = nullptr ); private: QPlainTextEdit *m_textBox; diff --git a/src/dialogs/DiagnosticDialog.cpp b/src/dialogs/DiagnosticDialog.cpp --- a/src/dialogs/DiagnosticDialog.cpp +++ b/src/dialogs/DiagnosticDialog.cpp @@ -39,7 +39,7 @@ -DiagnosticDialog::DiagnosticDialog( const KAboutData about, QWidget *parent ) +DiagnosticDialog::DiagnosticDialog( const KAboutData &about, QWidget *parent ) : QDialog( parent ) { setLayout( new QVBoxLayout ); @@ -83,23 +83,23 @@ // Get plugins -- we have to assemble a list again. - QList aPlugins; + QVector aPlugins; const auto aPluginManager = Plugins::PluginManager::instance(); aPlugins.append( aPluginManager->enabledPlugins( Plugins::PluginManager::Collection ) ); aPlugins.append( aPluginManager->enabledPlugins( Plugins::PluginManager::Service ) ); aPlugins.append( aPluginManager->enabledPlugins( Plugins::PluginManager::Importer ) ); QString aPluginString; - for( const auto &aInfo : aPlugins ) + for( const auto &aInfo : qAsConst(aPlugins) ) { aPluginString += " " + aInfo.name() + " (" + aInfo.version() + ")\n"; } // Get applets QString appletString; const QStringList appletList = Context::ContextView::self()->currentAppletNames(); - foreach( const QString &applet, appletList ) + for ( const QString &applet : appletList ) { // Currently we cannot extract the applet version number this way appletString += " " + applet + '\n'; diff --git a/src/dialogs/EditFilterDialog.h b/src/dialogs/EditFilterDialog.h --- a/src/dialogs/EditFilterDialog.h +++ b/src/dialogs/EditFilterDialog.h @@ -37,7 +37,7 @@ public: explicit EditFilterDialog( QWidget* parent, const QString &text = QString() ); - ~EditFilterDialog(); + virtual ~EditFilterDialog(); QString filter(); @@ -52,7 +52,7 @@ void slotSeparatorChange(); void slotSearchEditChanged( const QString &filterText ); void slotReset(); - void accept(); + void accept() override; void updateAttributeEditor(); void updateSearchEdit(); diff --git a/src/dialogs/EditFilterDialog.cpp b/src/dialogs/EditFilterDialog.cpp --- a/src/dialogs/EditFilterDialog.cpp +++ b/src/dialogs/EditFilterDialog.cpp @@ -234,7 +234,7 @@ void EditFilterDialog::accept() { - emit filterChanged( filter() ); + Q_EMIT filterChanged( filter() ); QDialog::accept(); } @@ -286,7 +286,7 @@ m_ui->dropTarget->clear(); - // some code duplications, see Collections::semanticDateTimeParser + // some code duplication, see Collections::semanticDateTimeParser ParsedExpression parsed = ExpressionParser::parse( text ); bool AND = false; // need an AND token diff --git a/src/dialogs/EqualizerDialog.h b/src/dialogs/EqualizerDialog.h --- a/src/dialogs/EqualizerDialog.h +++ b/src/dialogs/EqualizerDialog.h @@ -32,7 +32,7 @@ public: ~EqualizerDialog(); - static void showOnce( QWidget *parent = 0 );; + static void showOnce( QWidget *parent = nullptr ); /** Returns the untranslated current preset name. */ QString selectedPresetName() const; @@ -62,7 +62,7 @@ void toggleEqualizer( bool enabled ); private: - EqualizerDialog( QWidget *parent = 0 ); + explicit EqualizerDialog( QWidget *parent = nullptr ); void updateToolTips(); void updateLabels(); diff --git a/src/dialogs/EqualizerDialog.cpp b/src/dialogs/EqualizerDialog.cpp --- a/src/dialogs/EqualizerDialog.cpp +++ b/src/dialogs/EqualizerDialog.cpp @@ -24,7 +24,7 @@ #include "core/support/Amarok.h" #include "core/support/Debug.h" -EqualizerDialog * EqualizerDialog::s_instance = 0; +EqualizerDialog * EqualizerDialog::s_instance = nullptr; EqualizerDialog::EqualizerDialog( QWidget* parent ) : QDialog( parent ) @@ -85,8 +85,8 @@ // Ask engine for maximum gain value and compute scale to display values mValueScale = equalizer->eqMaxGain(); const QString mlblText = i18n( "%0\ndB" ).arg( QString::number( mValueScale, 'f', 1 ) ); - eqMaxEq->setText( QString("+") + mlblText ); - eqMinEq->setText( QString("-") + mlblText ); + eqMaxEq->setText( QStringLiteral("+") + mlblText ); + eqMinEq->setText( QStringLiteral("-") + mlblText ); // Ask engine for band frequencies and set labels const QStringList equalizerBandFreq = equalizer->eqBandsFreq(); @@ -124,13 +124,13 @@ foreach( QSlider* mSlider, m_bands ) connect( mSlider, &QSlider::valueChanged, this, &EqualizerDialog::bandsChanged ); - eqPresetSaveBtn->setIcon( QIcon::fromTheme( "document-save" ) ); + eqPresetSaveBtn->setIcon( QIcon::fromTheme( QStringLiteral("document-save") ) ); connect( eqPresetSaveBtn, &QAbstractButton::clicked, this, &EqualizerDialog::savePreset ); - eqPresetDeleteBtn->setIcon( QIcon::fromTheme( "edit-delete" ) ); + eqPresetDeleteBtn->setIcon( QIcon::fromTheme( QStringLiteral("edit-delete") ) ); connect( eqPresetDeleteBtn, &QAbstractButton::clicked, this, &EqualizerDialog::deletePreset ); - eqPresetResetBtn->setIcon( QIcon::fromTheme( "edit-undo" ) ); + eqPresetResetBtn->setIcon( QIcon::fromTheme( QStringLiteral("edit-undo") ) ); connect( eqPresetResetBtn, &QAbstractButton::clicked, this, &EqualizerDialog::restorePreset ); } @@ -141,7 +141,7 @@ { DEBUG_BLOCK - if( s_instance == 0 ) + if( s_instance == nullptr ) s_instance = new EqualizerDialog( parent ); s_instance->activateWindow(); @@ -185,11 +185,17 @@ void EqualizerDialog::restoreOriginalSettings() { - activeCheckBox->setChecked( m_originalActivated ); - int originalPresetIndex = EqualizerPresets::eqGlobalList().indexOf( m_originalPreset ); - The::engineController()->equalizerController()->applyEqualizerPresetByIndex( originalPresetIndex ); - eqPresets->setEditText( m_originalPreset ); - The::engineController()->equalizerController()->setGains( m_originalGains ); + // Only restore original settings if the equalizer was originally enabled + // or if the equalizer is currently enabled. This prevents a reset of the + // equalizer when cancel button is clicked with equalizer toggle off. + if( m_originalActivated || activeCheckBox->isChecked() ) + { + activeCheckBox->setChecked( m_originalActivated ); + int originalPresetIndex = EqualizerPresets::eqGlobalList().indexOf( m_originalPreset ); + The::engineController()->equalizerController()->applyEqualizerPresetByIndex( originalPresetIndex ); + eqPresets->setEditText( m_originalPreset ); + The::engineController()->equalizerController()->setGains( m_originalGains ); + } this->reject(); } diff --git a/src/dialogs/LabelListModel.h b/src/dialogs/LabelListModel.h --- a/src/dialogs/LabelListModel.h +++ b/src/dialogs/LabelListModel.h @@ -32,48 +32,48 @@ Q_OBJECT public: - explicit LabelListModel( const QStringList &m_labels, QObject *parent = 0 ); + explicit LabelListModel( const QStringList &m_labels, QObject *parent = nullptr ); - int rowCount( const QModelIndex &parent = QModelIndex() ) const; - QVariant data( const QModelIndex &index, int role ) const; - QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const; - Qt::ItemFlags flags( const QModelIndex &index ) const; - bool setData( const QModelIndex &index, const QVariant &value, int role = Qt::EditRole ); - bool insertRows( int position, int rows, const QModelIndex &index = QModelIndex() ); - bool removeRows( int position, int rows, const QModelIndex &index = QModelIndex() ); + int rowCount( const QModelIndex &parent = QModelIndex() ) const override; + QVariant data( const QModelIndex &index, int role ) const override; + QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const override; + Qt::ItemFlags flags( const QModelIndex &index ) const override; + bool setData( const QModelIndex &index, const QVariant &value, int role = Qt::EditRole ) override; + bool insertRows( int position, int rows, const QModelIndex &index = QModelIndex() ) override; + bool removeRows( int position, int rows, const QModelIndex &index = QModelIndex() ) override; /** * Adds a label * @arg label Label that should be added */ - void addLabel( const QString label ); + void addLabel( const QString &label ); /** * Removes a label * @arg label Label that should be removed */ - void removeLabel( const QString label ); + void removeLabel( const QString &label ); /** * Removes labels * @arg labels List of labels that should be removed */ - void removeLabels( const QStringList labels ); + void removeLabels( const QStringList &labels ); /** * Sets the labels * @arg labels List of new Labels */ - void setLabels( const QStringList labels ); + void setLabels( const QStringList& labels ); /** * @returns List of labels */ - QStringList labels(); + QStringList labels() const; private: QStringList m_labels; - bool isPresent( const QString label ); + bool isPresent( const QString &label ); }; #endif diff --git a/src/dialogs/LabelListModel.cpp b/src/dialogs/LabelListModel.cpp --- a/src/dialogs/LabelListModel.cpp +++ b/src/dialogs/LabelListModel.cpp @@ -64,15 +64,15 @@ if ( index.isValid() && role == Qt::EditRole ) { m_labels.replace( index.row(), value.toString() ); - emit dataChanged( index, index ); + Q_EMIT dataChanged( index, index ); m_labels.sort(); return true; } return false; } //Adds a label to the list if not present -void LabelListModel::addLabel( const QString label ) +void LabelListModel::addLabel( const QString &label ) { if ( ( !label.isEmpty() ) && ( !isPresent( label ) ) ) { @@ -83,8 +83,8 @@ } } -//Checks if a label is alread present -bool LabelListModel::isPresent( const QString label ) +//Checks if a label is already present +bool LabelListModel::isPresent( const QString &label ) { if ( m_labels.indexOf( label ) > -1 ) { @@ -95,7 +95,7 @@ } // Removes the label "label" from the list if present -void LabelListModel::removeLabel( const QString label ) +void LabelListModel::removeLabel( const QString &label ) { int index = m_labels.indexOf( label ); @@ -108,7 +108,7 @@ } //Wrapper function for remove label -void LabelListModel::removeLabels( const QStringList labels ) +void LabelListModel::removeLabels( const QStringList &labels ) { if ( !labels.isEmpty() ) { @@ -120,13 +120,13 @@ } //Returns all labels in the list -QStringList LabelListModel::labels() +QStringList LabelListModel::labels() const { return m_labels; } //Sets label list to "labels" -void LabelListModel::setLabels( QStringList labels ) +void LabelListModel::setLabels( const QStringList &labels ) { beginInsertRows( QModelIndex(), 0, m_labels.length() ); m_labels = labels; diff --git a/src/dialogs/MusicBrainzTagger.h b/src/dialogs/MusicBrainzTagger.h --- a/src/dialogs/MusicBrainzTagger.h +++ b/src/dialogs/MusicBrainzTagger.h @@ -46,11 +46,11 @@ * @arg tracks Track list for search */ explicit MusicBrainzTagger( const Meta::TrackList &tracks, - QWidget *parent = 0 ); + QWidget *parent = nullptr ); virtual ~MusicBrainzTagger(); Q_SIGNALS: - void sendResult( const QMap result ); + void sendResult( const QMap &result ); private Q_SLOTS: void search(); diff --git a/src/dialogs/MusicBrainzTagger.cpp b/src/dialogs/MusicBrainzTagger.cpp --- a/src/dialogs/MusicBrainzTagger.cpp +++ b/src/dialogs/MusicBrainzTagger.cpp @@ -162,7 +162,7 @@ QMap result = m_resultsModel->chosenItems(); if( !result.isEmpty() ) - emit sendResult( result ); + Q_EMIT sendResult( result ); accept(); } diff --git a/src/dialogs/OrganizeCollectionDialog.h b/src/dialogs/OrganizeCollectionDialog.h --- a/src/dialogs/OrganizeCollectionDialog.h +++ b/src/dialogs/OrganizeCollectionDialog.h @@ -33,7 +33,6 @@ class OrganizeCollectionDialogBase; } -class QLineEdit; class TrackOrganizer; @@ -43,7 +42,7 @@ Q_OBJECT public: - OrganizeCollectionOptionWidget( QWidget *parent = 0 ); + explicit OrganizeCollectionOptionWidget( QWidget *parent = nullptr ); bool asciiOnly() const { return asciiCheck->isChecked(); } void setAsciiOnly( bool enable ) { asciiCheck->setChecked( enable ); } @@ -71,7 +70,7 @@ Q_OBJECT public: - explicit OrganizeCollectionWidget( QWidget *parent = 0 ); + explicit OrganizeCollectionWidget( QWidget *parent = nullptr ); virtual ~OrganizeCollectionWidget() {} protected: @@ -88,15 +87,15 @@ explicit OrganizeCollectionDialog( const Meta::TrackList &tracks, const QStringList &folders, const QString &targetExtension = QString(), - QWidget *parent = 0, - const char *name = 0, + QWidget *parent = nullptr, + const char *name = nullptr, bool modal = true, const QString &caption = QString(), QFlags buttonMask = QDialogButtonBox::Ok|QDialogButtonBox::Cancel ); ~OrganizeCollectionDialog(); - QMap getDestinations(); + QMap getDestinations() const; bool overwriteDestinations() const; public Q_SLOTS: diff --git a/src/dialogs/OrganizeCollectionDialog.cpp b/src/dialogs/OrganizeCollectionDialog.cpp --- a/src/dialogs/OrganizeCollectionDialog.cpp +++ b/src/dialogs/OrganizeCollectionDialog.cpp @@ -120,7 +120,7 @@ QString tooltip = i18n( "You can use the following tokens:" ); tooltip += "
    "; - for( QMap::iterator it = args.begin(); it != args.end(); ++it ) + for( QMap::iterator it = args.begin(), total = args.end(); it != total; ++it ) tooltip += QString( "
  • %1 - %%2%" ).arg( it.value(), it.key() ); tooltip += "
"; @@ -216,7 +216,7 @@ } QMap -OrganizeCollectionDialog::getDestinations() +OrganizeCollectionDialog::getDestinations() const { return m_trackOrganizer->getDestinations(); } @@ -254,7 +254,7 @@ // empty the table, not only its contents ui->previewTableWidget->clearContents(); ui->previewTableWidget->setRowCount( 0 ); - ui->previewTableWidget->setSortingEnabled( false ); // intereferes with inserting + ui->previewTableWidget->setSortingEnabled( false ); // interferes with inserting m_trackOrganizer->resetTrackOffset(); m_conflict = false; setCursor( Qt::BusyCursor ); @@ -277,9 +277,9 @@ originals << it.key()->prettyUrl(); previews << it.value(); - QStringList originalPrefix = originals.last().split( '/' ); + QStringList originalPrefix = originals.last().split( QLatin1Char('/') ); originalPrefix.removeLast(); // we never include file name in the common prefix - QStringList previewPrefix = previews.last().split( '/' ); + QStringList previewPrefix = previews.last().split( QLatin1Char('/') ); previewPrefix.removeLast(); if( it == destinations.constBegin() ) @@ -307,8 +307,8 @@ } } - QString originalPrefix = commonOriginalPrefix.isEmpty() ? QString() : commonOriginalPrefix.join( "/" ) + '/'; - m_previewPrefix = commonPreviewPrefix.isEmpty() ? QString() : commonPreviewPrefix.join( "/" ) + '/'; + QString originalPrefix = commonOriginalPrefix.isEmpty() ? QString() : commonOriginalPrefix.join( QLatin1Char('/') ) + '/'; + m_previewPrefix = commonPreviewPrefix.isEmpty() ? QString() : commonPreviewPrefix.join( QLatin1Char('/') ) + '/'; ui->previewTableWidget->horizontalHeaderItem( 1 )->setText( i18n( "Original: %1", originalPrefix ) ); ui->previewTableWidget->horizontalHeaderItem( 0 )->setText( i18n( "Preview: %1", m_previewPrefix ) ); diff --git a/src/dialogs/TagDialog.h b/src/dialogs/TagDialog.h --- a/src/dialogs/TagDialog.h +++ b/src/dialogs/TagDialog.h @@ -55,20 +55,17 @@ enum Tabs { SUMMARYTAB, TAGSTAB, LYRICSTAB, LABELSTAB }; - explicit TagDialog( const Meta::TrackList &tracks, QWidget *parent = 0 ); - explicit TagDialog( Meta::TrackPtr track, QWidget *parent = 0 ); + explicit TagDialog( const Meta::TrackList &tracks, QWidget *parent = nullptr ); + explicit TagDialog( Meta::TrackPtr track, QWidget *parent = nullptr ); explicit TagDialog( Collections::QueryMaker *qm ); - ~TagDialog(); + ~TagDialog() override; // inherited from Meta::Observer using Observer::metadataChanged; - void metadataChanged( Meta::AlbumPtr album ); - - Q_SIGNALS: - void lyricsChanged( const QString& ); + void metadataChanged( const Meta::AlbumPtr &album ) override; private Q_SLOTS: - void accept(); + void accept() override; void cancelPressed(); void openPressed(); void previousTrack(); @@ -94,7 +91,7 @@ void guessFromFilename(); void musicbrainzTagger(); - void musicbrainzTaggerResult( const QMap result ); + void musicbrainzTaggerResult( const QMap &result ); /** Safely adds a track to m_tracks. Ensures that tracks are not added twice. @@ -129,7 +126,7 @@ void initUi(); /** Set's the current track to the number. - Will check agains invalid numbers, so the caller does not have to do that. + Will check against invalid numbers, so the caller does not have to do that. */ void setCurrentTrack( int num ); @@ -175,13 +172,6 @@ void updateCover(); void setControlsAccessability(); - /** - * Stores changes to labels for a specific track - * @arg track Track to store the labels to - * @arg labels The new set of labels for the track - */ - void saveLabels( Meta::TrackPtr track, const QStringList &labels ); - /** Writes all the tags to all the tracks. This finally updates the Meta::Tracks */ @@ -205,6 +195,7 @@ bool m_perTrack; Meta::TrackList m_tracks; Meta::TrackPtr m_currentTrack; + Meta::AlbumPtr m_currentAlbum; int m_currentTrackNum; /** True if m_storedTags contains changed. diff --git a/src/dialogs/TagDialog.cpp b/src/dialogs/TagDialog.cpp --- a/src/dialogs/TagDialog.cpp +++ b/src/dialogs/TagDialog.cpp @@ -28,7 +28,7 @@ #include "MainWindow.h" #include "SvgHandler.h" #include "core/collections/QueryMaker.h" -#include "core/interfaces/Logger.h" +#include "core/logger/Logger.h" #include "core/meta/Statistics.h" #include "core/meta/TrackEditor.h" #include "core/meta/support/MetaUtility.h" @@ -49,6 +49,9 @@ #include +#include + + namespace Meta { namespace Field { const QString LABELS = "labels"; @@ -127,20 +130,20 @@ Amarok::config( "TagDialog" ).writeEntry( "CurrentTab", ui->qTabWidget->currentIndex() ); - if( m_currentTrack && m_currentTrack->album() ) - unsubscribeFrom( m_currentTrack->album() ); + if( m_currentAlbum ) + unsubscribeFrom( m_currentAlbum ); delete ui; } void -TagDialog::metadataChanged( Meta::AlbumPtr album ) +TagDialog::metadataChanged( const Meta::AlbumPtr &album ) { - if( !m_currentTrack || !m_currentTrack->album() ) + if( m_currentAlbum ) return; // If the metadata of the current album has changed, reload the cover - if( album == m_currentTrack->album() ) + if( album == m_currentAlbum ) updateCover(); // TODO: if the lyrics changed: should we show a warning and ask the user @@ -539,7 +542,7 @@ ui->removeButton->setEnabled( false ); // set an icon for the open-in-konqui button - ui->pushButton_open->setIcon( QIcon::fromTheme( "folder-amarok" ) ); + ui->pushButton_open->setIcon( QIcon::fromTheme( QStringLiteral("folder-amarok") ) ); connect( ui->pushButton_guessTags, &QAbstractButton::clicked, this, &TagDialog::guessFromFilename ); @@ -607,14 +610,15 @@ // there is a logical problem here. // if the track itself changes (e.g. because it get's a new album) // then we don't re-subscribe - if( m_currentTrack && m_currentTrack->album() ) - unsubscribeFrom( m_currentTrack->album() ); + if( m_currentAlbum ) + unsubscribeFrom( m_currentAlbum ); m_currentTrack = m_tracks.at( num ); + m_currentAlbum = m_currentTrack->album(); m_currentTrackNum = num; - if( m_currentTrack && m_currentTrack->album() ) - subscribeTo( m_currentTrack->album() ); + if( m_currentAlbum ) + subscribeTo( m_currentAlbum ); setControlsAccessability(); updateButtons(); @@ -675,26 +679,26 @@ void TagDialog::showCoverMenu( const QPoint &pos ) { - Meta::AlbumPtr album = m_currentTrack->album(); - if( !album ) + if( !m_currentAlbum ) return; // TODO: warning or something? - QAction *displayCoverAction = new DisplayCoverAction( this, album ); - QAction *unsetCoverAction = new UnsetCoverAction( this, album ); + QAction *displayCoverAction = new DisplayCoverAction( this, m_currentAlbum ); + QAction *unsetCoverAction = new UnsetCoverAction( this, m_currentAlbum ); - if( !album->hasImage() ) + if( !m_currentAlbum->hasImage() ) { displayCoverAction->setEnabled( false ); unsetCoverAction->setEnabled( false ); } QMenu *menu = new QMenu( this ); menu->addAction( displayCoverAction ); - menu->addAction( new FetchCoverAction( this, album ) ); - menu->addAction( new SetCustomCoverAction( this, album ) ); + menu->addAction( new FetchCoverAction( this, m_currentAlbum ) ); + menu->addAction( new SetCustomCoverAction( this, m_currentAlbum ) ); menu->addAction( unsetCoverAction ); menu->exec( ui->pixmap_cover->mapToGlobal(pos) ); + delete menu; } void @@ -729,13 +733,13 @@ QString curTrackName = fnt.elidedText( m_currentTrack->name().toHtmlEscaped(), Qt::ElideRight, len ); QString curTrackPretName = fnt.elidedText( m_currentTrack->prettyName().toHtmlEscaped(), Qt::ElideRight, len ); - if( m_currentTrack->album() ) - curTrackAlbName = fnt.elidedText( m_currentTrack->album()->name().toHtmlEscaped(), Qt::ElideRight, len ); + if( m_currentAlbum ) + curTrackAlbName = fnt.elidedText( m_currentAlbum->name().toHtmlEscaped(), Qt::ElideRight, len ); if( m_currentTrack->artist() ) curArtistName = fnt.elidedText( m_currentTrack->artist()->name().toHtmlEscaped(), Qt::ElideRight, len ); - if( m_currentTrack->album() && m_currentTrack->album()->name().isEmpty() ) + if( m_currentAlbum && m_currentAlbum->name().isEmpty() ) { if( !m_currentTrack->name().isEmpty() ) { @@ -747,7 +751,7 @@ else niceTitle = curTrackPretName; } - else if( m_currentTrack->album() ) + else if( m_currentAlbum ) niceTitle = i18n( "%1 by %2 on %3" , curTrackName, curArtistName, curTrackAlbName ); else if( m_currentTrack->artist() ) niceTitle = i18n( "%1 by %2" , curTrackName, curArtistName ); @@ -822,9 +826,9 @@ // If it's a local file, write the directory to m_path, else disable the "open in konqui" button QString urlString = tags.value( Meta::Field::URL ).toString(); - QUrl url( urlString ); - //pathOrUrl will give localpath or proper url for remote. - ui->kLineEdit_location->setText( url.toDisplayString() ); + QUrl url = QUrl::fromUserInput( urlString ); + //QUrl::PreferLocalFile will give localpath or proper url for remote. + ui->kLineEdit_location->setText( url.toDisplayString( QUrl::PreferLocalFile ) ); if( url.isLocalFile() ) { ui->locationLabel->show(); @@ -1217,13 +1221,13 @@ return; // -- get the album - Meta::AlbumPtr album = m_currentTrack->album(); + Meta::AlbumPtr album = m_currentAlbum; if( !m_perTrack ) { foreach( Meta::TrackPtr track, m_tracks ) { if( track->album() != album ) - album = 0; + album = nullptr; } } @@ -1280,90 +1284,78 @@ ui->pushButton_musicbrainz->setEnabled( editable ); } -void -TagDialog::saveLabels( Meta::TrackPtr track, const QStringList &labels ) -{ - if( !track ) - return; - - QHash labelMap; - foreach( const Meta::LabelPtr &label, track->labels() ) - { - labelMap.insert( label->name(), label ); - } - - // labels to remove - foreach( const QString &label, labelMap.keys().toSet() - labels.toSet() ) - { - track->removeLabel( labelMap.value( label ) ); - } - - // labels to add - foreach( const QString &label, labels.toSet() - labelMap.keys().toSet() ) - { - track->addLabel( label ); - } -} - - void TagDialog::saveTags() { setTagsToTrack(); - foreach( Meta::TrackPtr track, m_tracks ) + for( auto &track : m_tracks ) { QVariantMap data = m_storedTags[ track ]; //there is really no need to write to the file if only info m_stored in the db has changed if( !data.isEmpty() ) { debug() << "File info changed...."; - if( data.contains( Meta::Field::SCORE ) ) - track->statistics()->setScore( data.value( Meta::Field::SCORE ).toInt() ); - if( data.contains( Meta::Field::RATING ) ) - track->statistics()->setRating( data.value( Meta::Field::RATING ).toInt() ); - if( data.contains( Meta::Field::LYRICS ) ) + auto lambda = [=] () mutable { - track->setCachedLyrics( data.value( Meta::Field::LYRICS ).toString() ); - emit lyricsChanged( track->uidUrl() ); - } - - saveLabels( track, data.value( Meta::Field::LABELS ).toStringList() ); - - Meta::TrackEditorPtr ec = track->editor(); - if( !ec ) - { - debug() << "Track" << track->prettyUrl() << "does not have Meta::TrackEditor. Skipping."; - continue; - } + if( data.contains( Meta::Field::SCORE ) ) + track->statistics()->setScore( data.value( Meta::Field::SCORE ).toInt() ); + if( data.contains( Meta::Field::RATING ) ) + track->statistics()->setRating( data.value( Meta::Field::RATING ).toInt() ); + if( data.contains( Meta::Field::LYRICS ) ) + track->setCachedLyrics( data.value( Meta::Field::LYRICS ).toString() ); + + QStringList labels = data.value( Meta::Field::LABELS ).toStringList(); + QHash labelMap; + for( const auto &label : track->labels() ) + labelMap.insert( label->name(), label ); + + // labels to remove + for( const auto &label : labelMap.keys().toSet() - labels.toSet() ) + track->removeLabel( labelMap.value( label ) ); + + // labels to add + for( const auto &label : labels.toSet() - labelMap.keys().toSet() ) + track->addLabel( label ); + + Meta::TrackEditorPtr ec = track->editor(); + if( !ec ) + { + debug() << "Track" << track->prettyUrl() << "does not have Meta::TrackEditor. Skipping."; + return; + } - ec->beginUpdate(); - if( data.contains( Meta::Field::TITLE ) ) - ec->setTitle( data.value( Meta::Field::TITLE ).toString() ); - if( data.contains( Meta::Field::COMMENT ) ) - ec->setComment( data.value( Meta::Field::COMMENT ).toString() ); - if( data.contains( Meta::Field::ARTIST ) ) - ec->setArtist( data.value( Meta::Field::ARTIST ).toString() ); - if( data.contains( Meta::Field::ALBUM ) ) - ec->setAlbum( data.value( Meta::Field::ALBUM ).toString() ); - if( data.contains( Meta::Field::GENRE ) ) - ec->setGenre( data.value( Meta::Field::GENRE ).toString() ); - if( data.contains( Meta::Field::COMPOSER ) ) - ec->setComposer( data.value( Meta::Field::COMPOSER ).toString() ); - if( data.contains( Meta::Field::YEAR ) ) - ec->setYear( data.value( Meta::Field::YEAR ).toInt() ); - if( data.contains( Meta::Field::TRACKNUMBER ) ) - ec->setTrackNumber( data.value( Meta::Field::TRACKNUMBER ).toInt() ); - if( data.contains( Meta::Field::DISCNUMBER ) ) - ec->setDiscNumber( data.value( Meta::Field::DISCNUMBER ).toInt() ); - if( data.contains( Meta::Field::BPM ) ) - ec->setBpm( data.value( Meta::Field::BPM ).toDouble() ); - if( data.contains( Meta::Field::ALBUMARTIST ) ) - ec->setAlbumArtist( data.value( Meta::Field::ALBUMARTIST ).toString() ); - - ec->endUpdate(); - // note: the track should by itself emit a collectionUpdated signal if needed + ec->beginUpdate(); + + if( data.contains( Meta::Field::TITLE ) ) + ec->setTitle( data.value( Meta::Field::TITLE ).toString() ); + if( data.contains( Meta::Field::COMMENT ) ) + ec->setComment( data.value( Meta::Field::COMMENT ).toString() ); + if( data.contains( Meta::Field::ARTIST ) ) + ec->setArtist( data.value( Meta::Field::ARTIST ).toString() ); + if( data.contains( Meta::Field::ALBUM ) ) + ec->setAlbum( data.value( Meta::Field::ALBUM ).toString() ); + if( data.contains( Meta::Field::GENRE ) ) + ec->setGenre( data.value( Meta::Field::GENRE ).toString() ); + if( data.contains( Meta::Field::COMPOSER ) ) + ec->setComposer( data.value( Meta::Field::COMPOSER ).toString() ); + if( data.contains( Meta::Field::YEAR ) ) + ec->setYear( data.value( Meta::Field::YEAR ).toInt() ); + if( data.contains( Meta::Field::TRACKNUMBER ) ) + ec->setTrackNumber( data.value( Meta::Field::TRACKNUMBER ).toInt() ); + if( data.contains( Meta::Field::DISCNUMBER ) ) + ec->setDiscNumber( data.value( Meta::Field::DISCNUMBER ).toInt() ); + if( data.contains( Meta::Field::BPM ) ) + ec->setBpm( data.value( Meta::Field::BPM ).toDouble() ); + if( data.contains( Meta::Field::ALBUMARTIST ) ) + ec->setAlbumArtist( data.value( Meta::Field::ALBUMARTIST ).toString() ); + + ec->endUpdate(); + // note: the track should by itself Q_EMIT a collectionUpdated signal if needed + }; + std::thread thread( lambda ); + thread.detach(); } } } @@ -1396,7 +1388,7 @@ } void -TagDialog::musicbrainzTaggerResult( const QMap result ) +TagDialog::musicbrainzTaggerResult( const QMap &result ) { if( result.isEmpty() ) return; diff --git a/src/dialogs/TagGuesser.h b/src/dialogs/TagGuesser.h --- a/src/dialogs/TagGuesser.h +++ b/src/dialogs/TagGuesser.h @@ -62,9 +62,9 @@ bool guess(); /** - * @Returns a list of guessed Tags + * @returns a list of guessed Tags */ - QMap tags() { return m_tags; }; + QMap tags() const { return m_tags; } private: diff --git a/src/dialogs/TagGuesser.cpp b/src/dialogs/TagGuesser.cpp --- a/src/dialogs/TagGuesser.cpp +++ b/src/dialogs/TagGuesser.cpp @@ -51,7 +51,7 @@ m_caseOptions = caseOptions; } -// sets whether trailing spcaes should be removes +// sets whether trailing spaces should be removes void TagGuesser::setCutTrailingSpaces( const bool cutTrailingSpaces ) { @@ -106,9 +106,9 @@ case 2: { QString complete; - QStringList splitted = tag.toLower().split( ' ', QString::SkipEmptyParts ); + QStringList splitList = tag.toLower().split( ' ', QString::SkipEmptyParts ); - foreach( QString word, splitted ) + foreach( QString word, splitList ) { if( word.length() > 1 ) word.replace( 0, 1, word.left( 1 ).toUpper() ); diff --git a/src/dialogs/TagGuesserDialog.h b/src/dialogs/TagGuesserDialog.h --- a/src/dialogs/TagGuesserDialog.h +++ b/src/dialogs/TagGuesserDialog.h @@ -31,13 +31,13 @@ #include class QLabel; - +class QFileInfo; class TagGuessOptionWidget : public QWidget, public Ui::TagGuessOptions { Q_OBJECT public: - TagGuessOptionWidget( QWidget *parent = 0 ); + explicit TagGuessOptionWidget( QWidget *parent = nullptr ); int getCaseOptions(); bool getWhitespaceOptions(); @@ -62,20 +62,20 @@ Q_OBJECT public: - explicit TagGuesserWidget( QWidget *parent = 0 ); + explicit TagGuesserWidget( QWidget *parent = nullptr ); virtual ~TagGuesserWidget() {} protected: - virtual Token* createToken(qint64 value) const; + Token* createToken(qint64 value) const override; }; class AMAROK_EXPORT TagGuesserDialog : public QDialog { Q_OBJECT public: - TagGuesserDialog( const QString &fileName, QWidget *parent = 0 ); + explicit TagGuesserDialog( const QString &fileName, QWidget *parent = nullptr ); QMap guessedTags(); @@ -103,7 +103,7 @@ /** * @Returns a colored version of the filename */ - QString coloredFileName( QMap tags ); + QString coloredFileName(const QMap &tags ); /** * @Returns color name for specified metadata field diff --git a/src/dialogs/TagGuesserDialog.cpp b/src/dialogs/TagGuesserDialog.cpp --- a/src/dialogs/TagGuesserDialog.cpp +++ b/src/dialogs/TagGuesserDialog.cpp @@ -222,10 +222,9 @@ { setWindowTitle( i18n( "Guess Tags from Filename" ) ); - QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel); + QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel, this); QWidget* mainWidget = new QWidget( this ); - QBoxLayout* mainLayout = new QVBoxLayout; - setLayout(mainLayout); + QBoxLayout* mainLayout = new QVBoxLayout(this); QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok); okButton->setDefault(true); okButton->setShortcut(Qt::CTRL | Qt::Key_Return); @@ -355,17 +354,17 @@ debug() << m_layoutWidget->getParsableScheme() << "; " << path; - int schemaLevels = m_layoutWidget->getParsableScheme().count( '/' ); - int pathLevels = path.count( '/' ); + int schemaLevels = m_layoutWidget->getParsableScheme().count( QLatin1Char('/') ); + int pathLevels = path.count( QLatin1Char('/') ); // -- cut paths int pos; for( pos = 0; pathLevels > schemaLevels && pos < path.length(); pos++ ) if( path[pos] == '/' ) pathLevels--; // -- cut extension - int dotPos = path.lastIndexOf( '.' ); + int dotPos = path.lastIndexOf( QLatin1Char('.') ); if( dotPos >= 0 ) dotPos -= pos; @@ -381,7 +380,7 @@ // creates a colored version of the filename QString -TagGuesserDialog::coloredFileName( QMap tags ) +TagGuesserDialog::coloredFileName( const QMap &tags ) { QString coloredFileName = m_fileName; diff --git a/src/dialogs/TrackOrganizer.h b/src/dialogs/TrackOrganizer.h --- a/src/dialogs/TrackOrganizer.h +++ b/src/dialogs/TrackOrganizer.h @@ -35,7 +35,7 @@ { Q_OBJECT public: - TrackOrganizer( const Meta::TrackList &tracks, QObject* parent = 0 ); + explicit TrackOrganizer( const Meta::TrackList &tracks, QObject* parent = nullptr ); /** * Sets the format string. Required. @@ -49,7 +49,7 @@ void setFolderPrefix( const QString &prefix ); /** - * Sets whether to move the the in an artist name to the end of the name. + * Sets whether to move the "the" in an artist name to the end of the name. * Default value is false. * @param flag turns the option on */ diff --git a/src/dialogs/TrackOrganizer.cpp b/src/dialogs/TrackOrganizer.cpp --- a/src/dialogs/TrackOrganizer.cpp +++ b/src/dialogs/TrackOrganizer.cpp @@ -67,7 +67,7 @@ if ( track->trackNumber() ) { - QString trackNum = QString("%1").arg( track->trackNumber(), 2, 10, QChar('0') ); + QString trackNum = QStringLiteral("%1").arg( track->trackNumber(), 2, 10, QChar('0') ); args["track"] = trackNum; } args["title"] = track->name(); @@ -97,7 +97,7 @@ args["filesize"] = track->filesize(); args["length"] = track->length() / 1000; - // Fill up default empty values for StringX formater + // Fill up default empty values for StringX formatter // TODO make this values changeable by user args["default_album"] = i18n( "Unknown album" ); args["default_albumartist"] = i18n( "Unknown artist" ); @@ -113,7 +113,7 @@ foreach( const QString &key, args.keys() ) if( key != "collectionroot" && key != "folder" ) - args[key] = args[key].replace( '/', '-' ); + args[key] = args[key].replace( QLatin1Char('/'), '-' ); Amarok::QStringx formatx( format ); QString result = formatx.namedOptArgs( args ); diff --git a/src/dialogs/deletedialog.h b/src/dialogs/deletedialog.h --- a/src/dialogs/deletedialog.h +++ b/src/dialogs/deletedialog.h @@ -32,7 +32,7 @@ class DeleteDialogBase : public QWidget, public Ui::DeleteDialogBase { public: - DeleteDialogBase( QWidget *parent ) : QWidget( parent ) { + explicit DeleteDialogBase( QWidget *parent ) : QWidget( parent ) { setupUi( this ); } }; @@ -43,7 +43,7 @@ Q_OBJECT public: - DeleteWidget(QWidget *parent = 0); + explicit DeleteWidget(QWidget *parent = nullptr); void setFiles(const QList &files); diff --git a/src/dialogs/deviceconfiguredialog.h b/src/dialogs/deviceconfiguredialog.h --- a/src/dialogs/deviceconfiguredialog.h +++ b/src/dialogs/deviceconfiguredialog.h @@ -22,7 +22,6 @@ class HintLineEdit; class MediaDevice; -class Medium; class QCheckBox; class QRadioButton; @@ -34,9 +33,9 @@ Q_OBJECT public: - DeviceConfigureDialog( MediaDevice *device ); - ~DeviceConfigureDialog(); - bool successful() { return m_accepted; } + explicit DeviceConfigureDialog( MediaDevice *device ); + virtual ~DeviceConfigureDialog(); + bool successful() const { return m_accepted; } private: bool m_accepted; diff --git a/src/dialogs/deviceconfiguredialog.cpp b/src/dialogs/deviceconfiguredialog.cpp --- a/src/dialogs/deviceconfiguredialog.cpp +++ b/src/dialogs/deviceconfiguredialog.cpp @@ -35,7 +35,6 @@ #include #include #include -#include DeviceConfigureDialog::DeviceConfigureDialog( MediaDevice *device ) diff --git a/src/dialogs/transferdialog.h b/src/dialogs/transferdialog.h --- a/src/dialogs/transferdialog.h +++ b/src/dialogs/transferdialog.h @@ -37,10 +37,10 @@ Q_OBJECT public: - TransferDialog( MediaDevice* mdev ); - ~TransferDialog() {} + explicit TransferDialog( MediaDevice* mdev ); + virtual ~TransferDialog() {} - bool isAccepted() { return m_accepted; } + bool isAccepted() const { return m_accepted; } private Q_SLOTS: void slotOk(); diff --git a/src/dynamic/Bias.h b/src/dynamic/Bias.h --- a/src/dynamic/Bias.h +++ b/src/dynamic/Bias.h @@ -37,7 +37,6 @@ namespace Collections { class Collection; - class QueryMaker; } namespace Dynamic @@ -65,11 +64,11 @@ AbstractBias(); virtual ~AbstractBias(); - /** Reads the contensts of this object from an xml stream */ + /** Reads the contents of this object from an xml stream */ virtual void fromXml( QXmlStreamReader *reader ); /** Writes the contents of this object to an xml stream. - Only the content is writen and no enclosing tags. + Only the content is written and no enclosing tags. This is done to make it mirror the constructor which does not read those tags either. */ @@ -95,7 +94,7 @@ /** Create a widget appropriate for editing the bias. */ - virtual QWidget* widget( QWidget* parent = 0 ); + virtual QWidget* widget( QWidget* parent = nullptr ); /** Paints an operator (like "and" or a progress bar") in front of a bias item */ virtual void paintOperator( QPainter* painter, const QRect &rect, Dynamic::AbstractBias* bias ); @@ -107,21 +106,20 @@ the result was received or invalidate called. @param playlist The current playlist context for the track. @param contextCount The number of songs that are already fixed. - @parem finalCount The number of tracks that the playlist should finally contain (including the contextCount) + @param finalCount The number of tracks that the playlist should finally contain (including the contextCount) @param universe A TrackCollectionPtr to be used for the resulting TrackSet */ virtual TrackSet matchingTracks( const Meta::TrackList& playlist, int contextCount, int finalCount, - const TrackCollectionPtr universe ) const = 0; + const TrackCollectionPtr &universe ) const = 0; /** Returns true if indicated track fits that position. The function might block until a result is ready. @param position The position inside the playlist that we search a track for. The position can be larger than the number of playlist entries if we search a track for the end of the playlist. @param playlist The current playlist context for the track. @param contextCount The number of songs that are already fixed. - @param universe A TrackCollectionPtr to be used for the resulting TrackSet */ virtual bool trackMatches( int position, const Meta::TrackList& playlist, int contextCount ) const = 0; @@ -149,9 +147,9 @@ /** Call this function when this bias should be replaced by a new one. @param newBias The bias that replaces this bias. If you give - an empty BiasPrt as argument the bias will be removed. + an empty BiasPtr as argument the bias will be removed. */ - virtual void replace( Dynamic::BiasPtr newBias ); + virtual void replace( const Dynamic::BiasPtr &newBias ); }; /** A bias that returns all the tracks in the universe as possible tracks */ @@ -164,18 +162,18 @@ virtual ~RandomBias(); static QString sName(); - virtual QString name() const; - virtual QString toString() const; + QString name() const override; + QString toString() const override; - virtual QWidget* widget( QWidget* parent = 0 ); + QWidget* widget( QWidget* parent = nullptr ) override; - virtual TrackSet matchingTracks( const Meta::TrackList& playlist, + TrackSet matchingTracks( const Meta::TrackList& playlist, int contextCount, int finalCount, - const TrackCollectionPtr universe ) const; + const TrackCollectionPtr &universe ) const override; - virtual bool trackMatches( int position, + bool trackMatches( int position, const Meta::TrackList& playlist, - int contextCount ) const; + int contextCount ) const override; private: Q_DISABLE_COPY(RandomBias) @@ -192,33 +190,32 @@ public: /** Create a new And bias. - @param empty If true, then the newly created bias will not have a set of example sub-biases. */ AndBias(); - virtual ~AndBias(); + ~AndBias() override; - virtual void fromXml( QXmlStreamReader *reader ); - virtual void toXml( QXmlStreamWriter *writer ) const; + void fromXml( QXmlStreamReader *reader ) override; + void toXml( QXmlStreamWriter *writer ) const override; static QString sName(); - virtual QString name() const; - virtual QString toString() const; + QString name() const override; + QString toString() const override; - virtual QWidget* widget( QWidget* parent = 0 ); - virtual void paintOperator( QPainter* painter, const QRect &rect, Dynamic::AbstractBias* bias ); + QWidget* widget( QWidget* parent = nullptr ) override; + void paintOperator( QPainter* painter, const QRect &rect, Dynamic::AbstractBias* bias ) override; - virtual TrackSet matchingTracks( const Meta::TrackList& playlist, + TrackSet matchingTracks( const Meta::TrackList& playlist, int contextCount, int finalCount, - const TrackCollectionPtr universe ) const; + const TrackCollectionPtr &universe ) const override; - virtual bool trackMatches( int position, + bool trackMatches( int position, const Meta::TrackList& playlist, - int contextCount ) const; + int contextCount ) const override; /** Appends a bias to this bias. This object will take ownership of the bias and free it when destroyed. */ - virtual void appendBias( Dynamic::BiasPtr bias ); + virtual void appendBias( const Dynamic::BiasPtr &bias ); virtual void moveBias( int from, int to ); BiasList biases() const @@ -230,12 +227,12 @@ void biasMoved( int from, int to ); public Q_SLOTS: - virtual void invalidate(); + void invalidate() override; protected Q_SLOTS: virtual void resultReceived( const Dynamic::TrackSet &tracks ); - virtual void biasReplaced( Dynamic::BiasPtr oldBias, Dynamic::BiasPtr newBias ); - virtual void biasChanged( Dynamic::BiasPtr bias ); + virtual void biasReplaced( const Dynamic::BiasPtr &oldBias, const Dynamic::BiasPtr &newBias ); + virtual void biasChanged( const Dynamic::BiasPtr &bias ); protected: BiasList m_biases; @@ -255,21 +252,21 @@ OrBias(); static QString sName(); - virtual QString name() const; - virtual QString toString() const; + QString name() const override; + QString toString() const override; - virtual void paintOperator( QPainter* painter, const QRect &rect, Dynamic::AbstractBias* bias ); + void paintOperator( QPainter* painter, const QRect &rect, Dynamic::AbstractBias* bias ) override; - virtual TrackSet matchingTracks( const Meta::TrackList& playlist, + TrackSet matchingTracks( const Meta::TrackList& playlist, int contextCount, int finalCount, - const TrackCollectionPtr universe ) const; + const TrackCollectionPtr &universe ) const override; - virtual bool trackMatches( int position, + bool trackMatches( int position, const Meta::TrackList& playlist, - int contextCount ) const; + int contextCount ) const override; protected Q_SLOTS: - virtual void resultReceived( const Dynamic::TrackSet &tracks ); + void resultReceived( const Dynamic::TrackSet &tracks ) override; private: Q_DISABLE_COPY(OrBias) diff --git a/src/dynamic/Bias.cpp b/src/dynamic/Bias.cpp --- a/src/dynamic/Bias.cpp +++ b/src/dynamic/Bias.cpp @@ -81,7 +81,7 @@ QString Dynamic::AbstractBias::sName() { - return QLatin1String( "abstractBias" ); + return QStringLiteral( "abstractBias" ); } QString @@ -110,9 +110,9 @@ { } void -Dynamic::AbstractBias::replace( Dynamic::BiasPtr newBias ) +Dynamic::AbstractBias::replace( const Dynamic::BiasPtr &newBias ) { - emit replaced( BiasPtr(const_cast(this)), newBias ); + Q_EMIT replaced( BiasPtr(const_cast(this)), newBias ); } // -------- RandomBias ------ @@ -126,7 +126,7 @@ QString Dynamic::RandomBias::sName() { - return QLatin1String( "randomBias" ); + return QStringLiteral( "randomBias" ); } QString @@ -151,7 +151,7 @@ Dynamic::TrackSet Dynamic::RandomBias::matchingTracks( const Meta::TrackList& playlist, int contextCount, int finalCount, - Dynamic::TrackCollectionPtr universe ) const + const Dynamic::TrackCollectionPtr &universe ) const { Q_UNUSED( playlist ); Q_UNUSED( contextCount ); @@ -218,7 +218,7 @@ QString Dynamic::AndBias::sName() { - return QLatin1String( "andBias" ); + return QStringLiteral( "andBias" ); } QString @@ -255,7 +255,7 @@ Dynamic::TrackSet Dynamic::AndBias::matchingTracks( const Meta::TrackList& playlist, int contextCount, int finalCount, - Dynamic::TrackCollectionPtr universe ) const + const Dynamic::TrackCollectionPtr &universe ) const { DEBUG_BLOCK; debug() << "universe:" << universe.data(); @@ -309,7 +309,7 @@ } void -Dynamic::AndBias::appendBias( Dynamic::BiasPtr bias ) +Dynamic::AndBias::appendBias(const BiasPtr &bias ) { bool newInModel = DynamicModel::instance()->index( bias ).isValid(); if (newInModel) { @@ -331,12 +331,12 @@ this, &AndBias::biasReplaced ); connect( bias.data(), &Dynamic::AbstractBias::changed, this, &AndBias::biasChanged ); - emit biasAppended( bias ); + Q_EMIT biasAppended( bias ); // creating a shared pointer and destructing it just afterwards would // also destruct this object. // so we give the object creating this bias a chance to increment the refcount - emit changed( thisPtr ); + Q_EMIT changed( thisPtr ); } void @@ -357,8 +357,8 @@ if( inModel ) DynamicModel::instance()->endMoveBias(); - emit biasMoved( from, to ); - emit changed( BiasPtr( this ) ); + Q_EMIT biasMoved( from, to ); + Q_EMIT changed( BiasPtr( this ) ); } @@ -371,11 +371,11 @@ if( m_outstandingMatches < 0 ) warning() << "Received more results than expected."; else if( m_outstandingMatches == 0 ) - emit resultReady( m_tracks ); + Q_EMIT resultReady( m_tracks ); } void -Dynamic::AndBias::biasReplaced( Dynamic::BiasPtr oldBias, Dynamic::BiasPtr newBias ) +Dynamic::AndBias::biasReplaced( const Dynamic::BiasPtr &oldBias, const Dynamic::BiasPtr &newBias ) { DEBUG_BLOCK; BiasPtr thisPtr( this ); @@ -389,7 +389,7 @@ m_biases.removeAt( index ); if( inModel ) DynamicModel::instance()->endRemoveBias(); - emit biasRemoved( index ); + Q_EMIT biasRemoved( index ); if( newBias ) { @@ -407,18 +407,18 @@ DynamicModel::instance()->endInsertBias(); // we don't have an bias inserted signal - emit biasAppended( newBias ); - emit biasMoved( m_biases.count()-1, index ); + Q_EMIT biasAppended( newBias ); + Q_EMIT biasMoved( m_biases.count()-1, index ); } - emit changed( thisPtr ); + Q_EMIT changed( thisPtr ); } void -Dynamic::AndBias::biasChanged( Dynamic::BiasPtr bias ) +Dynamic::AndBias::biasChanged( const Dynamic::BiasPtr &bias ) { BiasPtr thisPtr( this ); - emit changed( thisPtr ); + Q_EMIT changed( thisPtr ); bool inModel = DynamicModel::instance()->index( thisPtr ).isValid(); if( inModel ) DynamicModel::instance()->biasChanged( bias ); @@ -433,7 +433,7 @@ QString Dynamic::OrBias::sName() { - return QLatin1String( "orBias" ); + return QStringLiteral( "orBias" ); } QString @@ -463,7 +463,7 @@ Dynamic::TrackSet Dynamic::OrBias::matchingTracks( const Meta::TrackList& playlist, int contextCount, int finalCount, - Dynamic::TrackCollectionPtr universe ) const + const Dynamic::TrackCollectionPtr &universe ) const { m_tracks = Dynamic::TrackSet( universe, false ); m_outstandingMatches = 0; @@ -508,7 +508,7 @@ if( m_outstandingMatches < 0 ) warning() << "Received more results than expected."; else if( m_outstandingMatches == 0 ) - emit resultReady( m_tracks ); + Q_EMIT resultReady( m_tracks ); } diff --git a/src/dynamic/BiasFactory.h b/src/dynamic/BiasFactory.h --- a/src/dynamic/BiasFactory.h +++ b/src/dynamic/BiasFactory.h @@ -41,16 +41,16 @@ Q_OBJECT public: - ReplacementBias( const QString &n ); + explicit ReplacementBias( const QString &n ); ReplacementBias( const QString &n, QXmlStreamReader *reader ); - void toXml( QXmlStreamWriter *writer ) const; + void toXml( QXmlStreamWriter *writer ) const override; static QString sName(); - virtual QString name() const; - virtual QString toString() const; + QString name() const override; + QString toString() const override; - virtual QWidget* widget( QWidget* parent = 0 ); + QWidget* widget( QWidget* parent = nullptr ) override; protected Q_SLOTS: void factoryChanged(); @@ -129,7 +129,7 @@ void changed(); private: - BiasFactory( QObject *parent = 0 ); + BiasFactory( QObject *parent = nullptr ); ~BiasFactory(); void emitChanged(); diff --git a/src/dynamic/BiasFactory.cpp b/src/dynamic/BiasFactory.cpp --- a/src/dynamic/BiasFactory.cpp +++ b/src/dynamic/BiasFactory.cpp @@ -46,58 +46,58 @@ class RandomBiasFactory : public Dynamic::AbstractBiasFactory { - QString i18nName() const + QString i18nName() const override { return i18nc("Name of the random bias", "Random"); } - QString name() const + QString name() const override { return Dynamic::RandomBias::sName(); } - QString i18nDescription() const + QString i18nDescription() const override { return i18nc("Description of the random bias", "The random bias adds random tracks from the\n" "whole collection without any bias."); } - Dynamic::BiasPtr createBias() + Dynamic::BiasPtr createBias() override { return Dynamic::BiasPtr( new Dynamic::RandomBias() ); } }; class AndBiasFactory : public Dynamic::AbstractBiasFactory { - QString i18nName() const + QString i18nName() const override { return i18nc("Name of the \"And\" bias", "And"); } - QString name() const + QString name() const override { return Dynamic::AndBias::sName(); } - QString i18nDescription() const + QString i18nDescription() const override { return i18nc("Description of the \"And\" bias", "The \"And\" bias adds tracks that match all\n" "of the sub biases."); } - Dynamic::BiasPtr createBias() + Dynamic::BiasPtr createBias() override { return Dynamic::BiasPtr( new Dynamic::AndBias() ); } }; class OrBiasFactory : public Dynamic::AbstractBiasFactory { - QString i18nName() const + QString i18nName() const override { return i18nc("Name of the \"Or\" bias", "Or"); } - QString name() const + QString name() const override { return Dynamic::OrBias::sName(); } - QString i18nDescription() const + QString i18nDescription() const override { return i18nc("Description of the \"Or\" bias", "The \"Or\" bias adds tracks that match at\n" "least one of the sub biases."); } - Dynamic::BiasPtr createBias() + Dynamic::BiasPtr createBias() override { return Dynamic::BiasPtr( new Dynamic::OrBias() ); } }; -Dynamic::BiasFactory* Dynamic::BiasFactory::s_instance = 0; +Dynamic::BiasFactory* Dynamic::BiasFactory::s_instance = nullptr; QList Dynamic::BiasFactory::s_biasFactories = QList(); @@ -160,14 +160,14 @@ Dynamic::ReplacementBias::toXml( QXmlStreamWriter *writer ) const { Q_UNUSED( writer ); - writer->writeComment("Replacement"); // we need to force the closing of the bias start tag + writer->writeComment(QStringLiteral("Replacement")); // we need to force the closing of the bias start tag writer->device()->write( m_html.left( m_html.size() - m_name.length() - 3 ) ); } QString Dynamic::ReplacementBias::sName() { - return QLatin1String( "replacementBias" ); + return QStringLiteral( "replacementBias" ); } QString @@ -295,6 +295,6 @@ void Dynamic::BiasFactory::emitChanged() { - emit changed(); + Q_EMIT changed(); } diff --git a/src/dynamic/BiasSolver.h b/src/dynamic/BiasSolver.h --- a/src/dynamic/BiasSolver.h +++ b/src/dynamic/BiasSolver.h @@ -76,25 +76,25 @@ * Create and prepare the solver. The constructor returns * * @param n The size of the playlist to generate. - * @param biases The system of biases being applied. + * @param bias The system of biases being applied. * @param context The tracks (if any) that precede the playlist * being generated. */ - BiasSolver( int n, BiasPtr bias, Meta::TrackList context ); + BiasSolver( int n, const BiasPtr &bias, const Meta::TrackList &context ); ~BiasSolver(); /// Returns the playlist generated after the job has finished. Meta::TrackList solution(); /// Politely asks the thread to give up and finish ASAP. - void requestAbort(); + void requestAbort() override; /** * Returns true if the solver was successful, false if it was * aborted or encountered some other error. */ - virtual bool success() const; + bool success() const override; /** * Choose whether the BiasSolver instance should delete itself after the query. @@ -119,9 +119,9 @@ static void outdateUniverse(); protected: - void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) Q_DECL_OVERRIDE; - void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; - void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; + void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) override; + void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; + void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; Q_SIGNALS: /** a job must implement the following signals for the progress bar @@ -146,7 +146,7 @@ private Q_SLOTS: void biasResultReady( const Dynamic::TrackSet &set ); - void trackCollectionResultsReady( QStringList ); + void trackCollectionResultsReady( const QStringList &); void trackCollectionDone(); diff --git a/src/dynamic/BiasSolver.cpp b/src/dynamic/BiasSolver.cpp --- a/src/dynamic/BiasSolver.cpp +++ b/src/dynamic/BiasSolver.cpp @@ -46,15 +46,15 @@ { public: - SolverList( Meta::TrackList trackList, + SolverList( const Meta::TrackList &trackList, int contextCount, - BiasPtr bias ) + const BiasPtr &bias ) : m_trackList(trackList) , m_contextCount( contextCount ) , m_bias( bias ) {} - void appendTrack( Meta::TrackPtr track ) + void appendTrack( const Meta::TrackPtr &track ) { m_trackList.append( track ); } @@ -80,7 +80,7 @@ -BiasSolver::BiasSolver( int n, BiasPtr bias, Meta::TrackList context ) +BiasSolver::BiasSolver( int n, const BiasPtr &bias, const Meta::TrackList &context ) : m_n( n ) , m_bias( bias ) , m_context( context ) @@ -101,15 +101,15 @@ BiasSolver::~BiasSolver() { debug() << "DESTROYING BiasSolver in thread:" << QThread::currentThreadId(); - emit endProgressOperation( this ); + Q_EMIT endProgressOperation( this ); } void BiasSolver::requestAbort() { m_abortRequested = true; - emit endProgressOperation( this ); + Q_EMIT endProgressOperation( this ); } bool @@ -302,7 +302,7 @@ // ---- getting the TrackCollection ---- void -BiasSolver::trackCollectionResultsReady( QStringList uids ) +BiasSolver::trackCollectionResultsReady( const QStringList &uids ) { m_collectionUids.append( uids ); } @@ -346,7 +346,7 @@ while( m_currentProgress < progress ) { m_currentProgress++; - emit incrementProgress(); + Q_EMIT incrementProgress(); } } diff --git a/src/dynamic/BiasedPlaylist.h b/src/dynamic/BiasedPlaylist.h --- a/src/dynamic/BiasedPlaylist.h +++ b/src/dynamic/BiasedPlaylist.h @@ -46,26 +46,26 @@ public: /** Creates a new random playlist */ - BiasedPlaylist( QObject *parent = 0 ); + explicit BiasedPlaylist( QObject *parent = nullptr ); /** Creates a new playlist from an xml stream */ - BiasedPlaylist( QXmlStreamReader *reader, QObject *parent = 0 ); + explicit BiasedPlaylist( QXmlStreamReader *reader, QObject *parent = nullptr ); ~BiasedPlaylist(); - void toXml( QXmlStreamWriter *writer ) const; + void toXml( QXmlStreamWriter *writer ) const override; - void requestTracks(int); + void requestTracks(int) override; BiasPtr bias() const; public Q_SLOTS: - virtual void requestAbort(); + void requestAbort() override; private Q_SLOTS: void solverFinished(); void biasChanged(); - void biasReplaced( Dynamic::BiasPtr oldBias, Dynamic::BiasPtr newBias ); + void biasReplaced( const Dynamic::BiasPtr &oldBias, const Dynamic::BiasPtr &newBias ); private: /** Starts the BiasSolver (if not already running) and requests a couple of new tracks. */ diff --git a/src/dynamic/BiasedPlaylist.cpp b/src/dynamic/BiasedPlaylist.cpp --- a/src/dynamic/BiasedPlaylist.cpp +++ b/src/dynamic/BiasedPlaylist.cpp @@ -24,7 +24,7 @@ #include "App.h" #include "amarokconfig.h" #include "core/collections/Collection.h" -#include "core/interfaces/Logger.h" +#include "core/logger/Logger.h" #include "core/meta/Meta.h" #include "core/support/Components.h" #include "core/support/Debug.h" @@ -91,7 +91,7 @@ void Dynamic::BiasedPlaylist::toXml( QXmlStreamWriter *writer ) const { - writer->writeTextElement( "title", m_title ); + writer->writeTextElement( QStringLiteral("title"), m_title ); writer->writeStartElement( m_bias->name() ); m_bias->toXml( writer ); writer->writeEndElement(); @@ -120,9 +120,9 @@ m_solver = new BiasSolver( numRequested, m_bias, getContext() ); connect( m_solver, &BiasSolver::done, this, &BiasedPlaylist::solverFinished ); - Amarok::Components::logger()->newProgressOperation( m_solver, + Amarok::Logger::newProgressOperation( m_solver, i18n( "Generating playlist..." ), 100, - this, SLOT(requestAbort()) ); + this, &BiasedPlaylist::requestAbort ); ThreadWeaver::Queue::instance()->enqueue( QSharedPointer(m_solver) ); @@ -135,14 +135,14 @@ void Dynamic::BiasedPlaylist::biasChanged() { - emit changed( this ); + Q_EMIT changed( this ); bool inModel = DynamicModel::instance()->index( this ).isValid(); if( inModel ) DynamicModel::instance()->biasChanged( m_bias ); } void -Dynamic::BiasedPlaylist::biasReplaced( Dynamic::BiasPtr oldBias, Dynamic::BiasPtr newBias ) +Dynamic::BiasedPlaylist::biasReplaced( const Dynamic::BiasPtr &oldBias, const Dynamic::BiasPtr &newBias ) { if( oldBias && !newBias ) // don't move the last bias away from this playlist without replacement return; @@ -170,7 +170,7 @@ connect( m_bias.data(), &AbstractBias::replaced, this, &BiasedPlaylist::biasReplaced ); - if( oldBias ) // don't emit a changed during construction + if( oldBias ) // don't Q_EMIT a changed during construction biasChanged(); } @@ -201,7 +201,7 @@ // remove the additional requested track if( list.count() > 1 ) list.removeLast(); - emit tracksReady( list ); + Q_EMIT tracksReady( list ); } m_solver->deleteLater(); diff --git a/src/dynamic/DynamicModel.h b/src/dynamic/DynamicModel.h --- a/src/dynamic/DynamicModel.h +++ b/src/dynamic/DynamicModel.h @@ -33,7 +33,6 @@ namespace Dynamic { class BiasedPlaylist; -class AbstractBias; class AMAROK_EXPORT DynamicModel : public QAbstractItemModel { @@ -77,31 +76,31 @@ The bias must not be part of a model. When in doubt call bias->replace(BiasPtr()) to remove the bias from it's current position. */ - QModelIndex insertBias( int row, const QModelIndex &parentIndex, Dynamic::BiasPtr bias ); + QModelIndex insertBias( int row, const QModelIndex &parentIndex, const Dynamic::BiasPtr &bias ); - Qt::DropActions supportedDropActions() const; + Qt::DropActions supportedDropActions() const override; // --- QAbstractItemModel functions --- - QVariant data( const QModelIndex& index, int role = Qt::DisplayRole ) const; - bool setData( const QModelIndex& index, const QVariant& value, int role = Qt::EditRole ); - Qt::ItemFlags flags( const QModelIndex& index ) const; - QModelIndex index( int row, int column, const QModelIndex& parent = QModelIndex() ) const; - QModelIndex parent(const QModelIndex& index) const; - int rowCount( const QModelIndex& parent = QModelIndex() ) const; - int columnCount( const QModelIndex& parent = QModelIndex() ) const; - - QStringList mimeTypes() const; - QMimeData* mimeData(const QModelIndexList &indexes) const; + QVariant data( const QModelIndex& index, int role = Qt::DisplayRole ) const override; + bool setData( const QModelIndex& index, const QVariant& value, int role = Qt::EditRole ) override; + Qt::ItemFlags flags( const QModelIndex& index ) const override; + QModelIndex index( int row, int column, const QModelIndex& parent = QModelIndex() ) const override; + QModelIndex parent(const QModelIndex& index) const override; + int rowCount( const QModelIndex& parent = QModelIndex() ) const override; + int columnCount( const QModelIndex& parent = QModelIndex() ) const override; + + QStringList mimeTypes() const override; + QMimeData* mimeData(const QModelIndexList &indexes) const override; bool dropMimeData(const QMimeData *data, Qt::DropAction action, - int row, int column, const QModelIndex &parent); + int row, int column, const QModelIndex &parent) override; // --- /** Returns the index for the bias @return Returns an invalid index if the bias is not in the model. */ - QModelIndex index( Dynamic::BiasPtr bias ) const; + QModelIndex index( const Dynamic::BiasPtr &bias ) const; /** Returns the index for the playlist @return Returns an invalid index if the playlist is not in the model. @@ -132,8 +131,8 @@ private: // two functions to search for parents - QModelIndex parent( int row, Dynamic::BiasedPlaylist* list, Dynamic::BiasPtr bias ) const; - QModelIndex parent( int row, Dynamic::BiasPtr parent, Dynamic::BiasPtr bias ) const; + QModelIndex parent( int row, Dynamic::BiasedPlaylist* list, const Dynamic::BiasPtr &bias ) const; + QModelIndex parent( int row, const Dynamic::BiasPtr &parent, const Dynamic::BiasPtr &bias ) const; /** Writes the index to the data stream */ void serializeIndex( QDataStream *stream, const QModelIndex& index ) const; @@ -149,26 +148,26 @@ // notify the model about changes. void playlistChanged( Dynamic::DynamicPlaylist* playlist ); - void biasChanged( Dynamic::BiasPtr bias ); + void biasChanged( const Dynamic::BiasPtr &bias ); void beginRemoveBias( Dynamic::BiasedPlaylist* parent ); - void beginRemoveBias( Dynamic::BiasPtr parent, int index ); + void beginRemoveBias( const Dynamic::BiasPtr &parent, int index ); void endRemoveBias(); void beginInsertBias( Dynamic::BiasedPlaylist* parent ); - void beginInsertBias( Dynamic::BiasPtr parent, int index ); + void beginInsertBias( const Dynamic::BiasPtr &parent, int index ); void endInsertBias(); - void beginMoveBias( Dynamic::BiasPtr parent, int from, int to ); + void beginMoveBias( const Dynamic::BiasPtr &parent, int from, int to ); void endMoveBias(); // ---- bool savePlaylists( const QString &filename ); bool loadPlaylists( const QString &filename ); void initPlaylists(); - DynamicModel(QObject* parent = 0); + DynamicModel(QObject* parent = nullptr); static DynamicModel* s_instance; int m_activePlaylistIndex; diff --git a/src/dynamic/DynamicModel.cpp b/src/dynamic/DynamicModel.cpp --- a/src/dynamic/DynamicModel.cpp +++ b/src/dynamic/DynamicModel.cpp @@ -50,7 +50,7 @@ a different one. */ -Dynamic::DynamicModel* Dynamic::DynamicModel::s_instance = 0; +Dynamic::DynamicModel* Dynamic::DynamicModel::s_instance = nullptr; Dynamic::DynamicModel* Dynamic::DynamicModel::instance() @@ -83,13 +83,13 @@ if( m_activePlaylistIndex == index ) return m_playlists[m_activePlaylistIndex]; - emit dataChanged( this->index( m_activePlaylistIndex, 0 ), + Q_EMIT dataChanged( this->index( m_activePlaylistIndex, 0 ), this->index( m_activePlaylistIndex, 0 ) ); m_activePlaylistIndex = index; - emit dataChanged( this->index( m_activePlaylistIndex, 0 ), + Q_EMIT dataChanged( this->index( m_activePlaylistIndex, 0 ), this->index( m_activePlaylistIndex, 0 ) ); - emit activeChanged( index ); + Q_EMIT activeChanged( index ); savePlaylists(); // save in between to prevent loosing too much in case of a crash return m_playlists[m_activePlaylistIndex]; @@ -161,7 +161,7 @@ } QModelIndex -Dynamic::DynamicModel::insertBias( int row, const QModelIndex &parentIndex, Dynamic::BiasPtr bias ) +Dynamic::DynamicModel::insertBias( int row, const QModelIndex &parentIndex, const Dynamic::BiasPtr &bias ) { QObject* o = static_cast(parentIndex.internalPointer()); BiasedPlaylist* parentPlaylist = qobject_cast(o); @@ -257,9 +257,9 @@ case Qt::DecorationRole: if( activePlaylist() == indexPlaylist ) - return QIcon::fromTheme( "amarok_playlist" ); + return QIcon::fromTheme( QStringLiteral("amarok_playlist") ); else - return QIcon::fromTheme( "amarok_playlist_clear" ); + return QIcon::fromTheme( QStringLiteral("amarok_playlist_clear") ); case Qt::FontRole: { @@ -285,7 +285,7 @@ { case Qt::DisplayRole: return QVariant(indexBias->toString()); - // return QVariant(QString("and: ")+indexBias->toString()); + // return QVariant(QStringLiteral("and: ")+indexBias->toString()); case Qt::ToolTipRole: { @@ -431,15 +431,15 @@ } QModelIndex -Dynamic::DynamicModel::parent( int row, BiasedPlaylist* list, BiasPtr bias ) const +Dynamic::DynamicModel::parent( int row, BiasedPlaylist* list, const BiasPtr &bias ) const { if( list->bias() == bias ) return createIndex( row, 0, list ); return parent( 0, list->bias(), bias ); } QModelIndex -Dynamic::DynamicModel::parent( int row, BiasPtr parent, BiasPtr bias ) const +Dynamic::DynamicModel::parent( int row, const BiasPtr &parent, const BiasPtr &bias ) const { Dynamic::AndBias* andBias = qobject_cast(parent.data()); if( !andBias ) @@ -523,7 +523,7 @@ Dynamic::DynamicModel::mimeTypes() const { QStringList types; - types << "application/amarok.biasModel.index"; + types << QStringLiteral("application/amarok.biasModel.index"); return types; } @@ -544,7 +544,7 @@ QDataStream stream( &bytes, QIODevice::WriteOnly ); serializeIndex( &stream, index ); QMimeData *mimeData = new QMimeData(); - mimeData->setData("application/amarok.biasModel.index", bytes); + mimeData->setData(QStringLiteral("application/amarok.biasModel.index"), bytes); return mimeData; } @@ -560,10 +560,10 @@ if( action == Qt::IgnoreAction ) return true; - if( data->hasFormat("application/amarok.biasModel.index") ) + if( data->hasFormat(QStringLiteral("application/amarok.biasModel.index")) ) { // get the source index from the mime data - QByteArray bytes = data->data("application/amarok.biasModel.index"); + QByteArray bytes = data->data(QStringLiteral("application/amarok.biasModel.index")); QDataStream stream( &bytes, QIODevice::ReadOnly ); QModelIndex index = unserializeIndex( &stream ); @@ -627,7 +627,7 @@ QModelIndex -Dynamic::DynamicModel::index( Dynamic::BiasPtr bias ) const +Dynamic::DynamicModel::index( const Dynamic::BiasPtr &bias ) const { QModelIndex res; @@ -672,13 +672,13 @@ void Dynamic::DynamicModel::savePlaylists() { - savePlaylists( "dynamic.xml" ); + savePlaylists( QStringLiteral("dynamic.xml") ); } void Dynamic::DynamicModel::loadPlaylists() { - loadPlaylists( "dynamic.xml" ); + loadPlaylists( QStringLiteral("dynamic.xml") ); } void @@ -797,13 +797,13 @@ QXmlStreamWriter xmlWriter( &xmlFile ); xmlWriter.setAutoFormatting( true ); xmlWriter.writeStartDocument(); - xmlWriter.writeStartElement("biasedPlaylists"); - xmlWriter.writeAttribute("version", "2" ); - xmlWriter.writeAttribute("current", QString::number( m_activePlaylistIndex ) ); + xmlWriter.writeStartElement(QStringLiteral("biasedPlaylists")); + xmlWriter.writeAttribute(QStringLiteral("version"), QStringLiteral("2") ); + xmlWriter.writeAttribute(QStringLiteral("current"), QString::number( m_activePlaylistIndex ) ); foreach( Dynamic::DynamicPlaylist *playlist, m_playlists ) { - xmlWriter.writeStartElement("playlist"); + xmlWriter.writeStartElement(QStringLiteral("playlist")); playlist->toXml( &xmlWriter ); xmlWriter.writeEndElement(); } @@ -889,7 +889,7 @@ m_activePlaylistIndex = qBound( 0, newPlaylistIndex, m_playlists.count()-1 ); - emit activeChanged( m_activePlaylistIndex ); + Q_EMIT activeChanged( m_activePlaylistIndex ); endResetModel(); return true; @@ -908,18 +908,18 @@ // -- create the empty default random playlists - // - first one rantom playlist + // - first one random playlist playlist = new Dynamic::BiasedPlaylist( this ); insertPlaylist( 0, playlist ); // - a playlist demonstrating the SearchQueryBias playlist = new Dynamic::BiasedPlaylist( this ); playlist->setTitle( i18n("Rock and Pop") ); - QString query = Meta::shortI18nForField( Meta::valGenre ) + ':' + i18n( "Rock" ); + QString query = Meta::shortI18nForField( Meta::valGenre ) + QLatin1Char(':') + i18n( "Rock" ); /* following cannot be currently translated, see ExpressionParser::isAdvancedExpression() * and ExpressionParser::finishedToken() */ - query += " AND "; - query += Meta::shortI18nForField( Meta::valGenre ) + ':' + i18n( "Pop" ); + query += QLatin1String(" AND "); + query += Meta::shortI18nForField( Meta::valGenre ) + QLatin1Char(':') + i18n( "Pop" ); playlist->bias()->replace( Dynamic::BiasPtr( new Dynamic::SearchQueryBias( query ) ) ); insertPlaylist( 1, playlist ); @@ -965,7 +965,7 @@ m_activePlaylistIndex = 0; - emit activeChanged( m_activePlaylistIndex ); + Q_EMIT activeChanged( m_activePlaylistIndex ); endResetModel(); } @@ -1009,7 +1009,7 @@ // write the list QXmlStreamWriter xmlWriter( &buffer ); - xmlWriter.writeStartElement( QLatin1String("playlist") ); + xmlWriter.writeStartElement( QStringLiteral("playlist") ); list->toXml( &xmlWriter ); xmlWriter.writeEndElement(); @@ -1032,14 +1032,14 @@ { DEBUG_BLOCK; QModelIndex index = this->index( p ); - emit dataChanged( index, index ); + Q_EMIT dataChanged( index, index ); } void -Dynamic::DynamicModel::biasChanged( Dynamic::BiasPtr b ) +Dynamic::DynamicModel::biasChanged( const Dynamic::BiasPtr &b ) { QModelIndex index = this->index( b ); - emit dataChanged( index, index ); + Q_EMIT dataChanged( index, index ); } void @@ -1050,7 +1050,7 @@ } void -Dynamic::DynamicModel::beginRemoveBias( Dynamic::BiasPtr parent, int index ) +Dynamic::DynamicModel::beginRemoveBias( const Dynamic::BiasPtr &parent, int index ) { QModelIndex parentIndex = this->index( parent ); beginRemoveRows( parentIndex, index, index ); @@ -1071,7 +1071,7 @@ void -Dynamic::DynamicModel::beginInsertBias( Dynamic::BiasPtr parent, int index ) +Dynamic::DynamicModel::beginInsertBias( const Dynamic::BiasPtr &parent, int index ) { QModelIndex parentIndex = this->index( parent ); beginInsertRows( parentIndex, index, index ); @@ -1084,7 +1084,7 @@ } void -Dynamic::DynamicModel::beginMoveBias( Dynamic::BiasPtr parent, int from, int to ) +Dynamic::DynamicModel::beginMoveBias( const Dynamic::BiasPtr &parent, int from, int to ) { QModelIndex parentIndex = this->index( parent ); beginMoveRows( parentIndex, from, from, parentIndex, to ); @@ -1103,7 +1103,7 @@ biasToString( Dynamic::BiasPtr bias, int level ) { QString result; - result += QString(" ").repeated(level) + bias->toString() + ' ' + QString::number(quintptr(bias.data()), 16) + '\n'; + result += QStringLiteral(" ").repeated(level) + bias->toString() + ' ' + QString::number(quintptr(bias.data()), 16) + '\n'; if( Dynamic::AndBias* aBias = qobject_cast(bias.data()) ) { foreach( Dynamic::BiasPtr bias2, aBias->biases() ) diff --git a/src/dynamic/DynamicPlaylist.h b/src/dynamic/DynamicPlaylist.h --- a/src/dynamic/DynamicPlaylist.h +++ b/src/dynamic/DynamicPlaylist.h @@ -41,16 +41,16 @@ Q_OBJECT public: - DynamicPlaylist( QObject *parent = 0 ); - DynamicPlaylist( QXmlStreamReader *reader, QObject *parent = 0 ); + explicit DynamicPlaylist( QObject *parent = nullptr ); + explicit DynamicPlaylist( QXmlStreamReader *reader, QObject *parent = nullptr ); virtual ~DynamicPlaylist(); virtual void toXml( QXmlStreamWriter *writer ) const = 0; virtual void requestTracks(int) = 0; QString title() const; - void setTitle( QString ); + void setTitle( const QString &); Q_SIGNALS: void tracksReady( Meta::TrackList ); diff --git a/src/dynamic/DynamicPlaylist.cpp b/src/dynamic/DynamicPlaylist.cpp --- a/src/dynamic/DynamicPlaylist.cpp +++ b/src/dynamic/DynamicPlaylist.cpp @@ -40,7 +40,7 @@ QString Dynamic::DynamicPlaylist::title() const { return m_title; } -void Dynamic::DynamicPlaylist::setTitle( QString title ) +void Dynamic::DynamicPlaylist::setTitle( const QString &title ) { m_title = title; bool inModel = DynamicModel::instance()->index( this ).isValid(); diff --git a/src/dynamic/TrackSet.h b/src/dynamic/TrackSet.h --- a/src/dynamic/TrackSet.h +++ b/src/dynamic/TrackSet.h @@ -56,7 +56,7 @@ class AMAROK_EXPORT TrackCollection : public QSharedData { public: - TrackCollection( const QStringList& uids ); + explicit TrackCollection( const QStringList& uids ); int count() const; QStringList uids() const; @@ -86,9 +86,10 @@ TrackSet( const TrackSet& other ); /** Creates a TrackSet that represents the whole universe. - @param value If true set is set to "full". Else to "empty". + * @param collection The collection of the tracks + * @param value If true set is set to "full". Else to "empty". */ - TrackSet( const Dynamic::TrackCollectionPtr collection, bool value ); + TrackSet( const Dynamic::TrackCollectionPtr &collection, bool value ); /** Includes or excludes all tracks in the set. @param value If true set is set to "full". Else to "empty". diff --git a/src/dynamic/TrackSet.cpp b/src/dynamic/TrackSet.cpp --- a/src/dynamic/TrackSet.cpp +++ b/src/dynamic/TrackSet.cpp @@ -45,15 +45,15 @@ Dynamic::TrackSet::TrackSet() : m_bits() - , m_collection( 0 ) + , m_collection( nullptr ) { } Dynamic::TrackSet::TrackSet( const TrackSet& other ) : m_bits( other.m_bits ) , m_collection( other.m_collection ) { } -Dynamic::TrackSet::TrackSet( const Dynamic::TrackCollectionPtr collection, bool value ) +Dynamic::TrackSet::TrackSet( const Dynamic::TrackCollectionPtr &collection, bool value ) : m_bits( collection->count(), value ) , m_collection( collection ) {} @@ -224,8 +224,8 @@ // that seems to happen. e.g. for tracks from the file collection warning() << "TrackSet::subtract called for a track not even known to the collection. "<< "Track uid is"<m_ids.isEmpty()?QString("no example"):QString(m_collection->m_ids.keys().first()))<< - "track is from collection"<<(B->collection()?B->collection()->collectionId():QString("no collection")); + "example from collection"<<(m_collection->m_ids.isEmpty()?QStringLiteral("no example"):QString(m_collection->m_ids.keys().first()))<< + "track is from collection"<<(B->collection()?B->collection()->collectionId():QStringLiteral("no collection")); return; } diff --git a/src/dynamic/biases/AlbumPlayBias.h b/src/dynamic/biases/AlbumPlayBias.h --- a/src/dynamic/biases/AlbumPlayBias.h +++ b/src/dynamic/biases/AlbumPlayBias.h @@ -39,22 +39,22 @@ AlbumPlayBias(); - virtual void fromXml( QXmlStreamReader *reader ); - virtual void toXml( QXmlStreamWriter *writer ) const; + void fromXml( QXmlStreamReader *reader ) override; + void toXml( QXmlStreamWriter *writer ) const override; static QString sName(); - virtual QString name() const; - virtual QString toString() const; + QString name() const override; + QString toString() const override; - virtual QWidget* widget( QWidget* parent = 0 ); + QWidget* widget( QWidget* parent = nullptr ) override; - virtual TrackSet matchingTracks( const Meta::TrackList& playlist, + TrackSet matchingTracks( const Meta::TrackList& playlist, int contextCount, int finalCount, - const TrackCollectionPtr universe ) const; + const TrackCollectionPtr &universe ) const override; - virtual bool trackMatches( int position, + bool trackMatches( int position, const Meta::TrackList& playlist, - int contextCount ) const; + int contextCount ) const override; FollowType follow() const; void setFollow( FollowType value ); @@ -77,10 +77,10 @@ class AMAROK_EXPORT AlbumPlayBiasFactory : public Dynamic::AbstractBiasFactory { public: - virtual QString i18nName() const; - virtual QString name() const; - virtual QString i18nDescription() const; - virtual BiasPtr createBias(); + QString i18nName() const override; + QString name() const override; + QString i18nDescription() const override; + BiasPtr createBias() override; }; } diff --git a/src/dynamic/biases/AlbumPlayBias.cpp b/src/dynamic/biases/AlbumPlayBias.cpp --- a/src/dynamic/biases/AlbumPlayBias.cpp +++ b/src/dynamic/biases/AlbumPlayBias.cpp @@ -82,13 +82,13 @@ void Dynamic::AlbumPlayBias::toXml( QXmlStreamWriter *writer ) const { - writer->writeTextElement( "follow", nameForFollow( m_follow ) ); + writer->writeTextElement( QStringLiteral("follow"), nameForFollow( m_follow ) ); } QString Dynamic::AlbumPlayBias::sName() { - return QLatin1String( "albumPlayBias" ); + return QStringLiteral( "albumPlayBias" ); } QString @@ -141,7 +141,7 @@ Dynamic::TrackSet Dynamic::AlbumPlayBias::matchingTracks( const Meta::TrackList& playlist, int contextCount, int finalCount, - Dynamic::TrackCollectionPtr universe ) const + const Dynamic::TrackCollectionPtr &universe ) const { Q_UNUSED( contextCount ); Q_UNUSED( finalCount ); @@ -255,7 +255,7 @@ { m_follow = value; invalidate(); - emit changed( BiasPtr(this) ); + Q_EMIT changed( BiasPtr(this) ); } void @@ -270,19 +270,19 @@ { switch( match ) { - case Dynamic::AlbumPlayBias::DirectlyFollow: return "directlyFollow"; - case Dynamic::AlbumPlayBias::Follow: return "follow"; - case Dynamic::AlbumPlayBias::DontCare: return "dontCare"; + case Dynamic::AlbumPlayBias::DirectlyFollow: return QStringLiteral("directlyFollow"); + case Dynamic::AlbumPlayBias::Follow: return QStringLiteral("follow"); + case Dynamic::AlbumPlayBias::DontCare: return QStringLiteral("dontCare"); } return QString(); } Dynamic::AlbumPlayBias::FollowType Dynamic::AlbumPlayBias::followForName( const QString &name ) { - if( name == "directlyFollow" ) return DirectlyFollow; - else if( name == "follow" ) return Follow; - else if( name == "dontCare" ) return DontCare; + if( name == QLatin1String("directlyFollow") ) return DirectlyFollow; + else if( name == QLatin1String("follow") ) return Follow; + else if( name == QLatin1String("dontCare") ) return DontCare; else return DontCare; } diff --git a/src/dynamic/biases/EchoNestBias.h b/src/dynamic/biases/EchoNestBias.h --- a/src/dynamic/biases/EchoNestBias.h +++ b/src/dynamic/biases/EchoNestBias.h @@ -49,48 +49,48 @@ EchoNestBias(); ~EchoNestBias(); - virtual void fromXml( QXmlStreamReader *reader ); - virtual void toXml( QXmlStreamWriter *writer ) const; + void fromXml( QXmlStreamReader *reader ) override; + void toXml( QXmlStreamWriter *writer ) const override; static QString sName(); - virtual QString name() const; - virtual QString toString() const; + QString name() const override; + QString toString() const override; - virtual QWidget* widget( QWidget* parent = 0 ); + QWidget* widget( QWidget* parent = nullptr ) override; - virtual Dynamic::TrackSet matchingTracks( const Meta::TrackList& playlist, + Dynamic::TrackSet matchingTracks( const Meta::TrackList& playlist, int contextCount, int finalCount, - Dynamic::TrackCollectionPtr universe ) const; + const Dynamic::TrackCollectionPtr &universe ) const override; - virtual bool trackMatches( int position, + bool trackMatches( int position, const Meta::TrackList& playlist, - int contextCount ) const; + int contextCount ) const override; MatchType match() const; void setMatch( MatchType value ); public Q_SLOTS: - virtual void invalidate(); + void invalidate() override; private Q_SLOTS: - virtual void newQuery(); + void newQuery() override; virtual void newSimilarArtistQuery(); void similarArtistQueryDone( KJob* ); - virtual void updateFinished(); + void updateFinished() override; void setMatchTypePlaylist( bool ); private: /** Returns the artists we should lookup */ QStringList currentArtists( int position, const Meta::TrackList& playlist ) const; - static QUrl createUrl( QString method, QMultiMap< QString, QString > params ); + static QUrl createUrl( const QString &method, QMultiMap< QString, QString > params ); static QString nameForMatch( MatchType match ); static MatchType matchForName( const QString &name ); /** Returns the key used for m_tracksMap */ - static QString tracksMapKey( QStringList artists ); + static QString tracksMapKey( const QStringList &artists ); void saveDataToFile() const; @@ -116,10 +116,10 @@ class AMAROK_EXPORT EchoNestBiasFactory : public Dynamic::AbstractBiasFactory { public: - virtual QString i18nName() const; - virtual QString name() const; - virtual QString i18nDescription() const; - virtual BiasPtr createBias(); + QString i18nName() const override; + QString name() const override; + QString i18nDescription() const override; + BiasPtr createBias() override; }; } diff --git a/src/dynamic/biases/EchoNestBias.cpp b/src/dynamic/biases/EchoNestBias.cpp --- a/src/dynamic/biases/EchoNestBias.cpp +++ b/src/dynamic/biases/EchoNestBias.cpp @@ -101,13 +101,13 @@ void Dynamic::EchoNestBias::toXml( QXmlStreamWriter *writer ) const { - writer->writeTextElement( "match", nameForMatch( m_match ) ); + writer->writeTextElement( QStringLiteral("match"), nameForMatch( m_match ) ); } QString Dynamic::EchoNestBias::sName() { - return QLatin1String( "echoNestBias" ); + return QStringLiteral( "echoNestBias" ); } QString @@ -138,7 +138,7 @@ QVBoxLayout *layout = new QVBoxLayout( widget ); QLabel *imageLabel = new QLabel(); - imageLabel->setPixmap( QPixmap( QStandardPaths::locate( QStandardPaths::GenericDataLocation, "amarok/images/echonest.png" ) ) ); + imageLabel->setPixmap( QPixmap( QStandardPaths::locate( QStandardPaths::GenericDataLocation, QStringLiteral("amarok/images/echonest.png") ) ) ); QLabel *label = new QLabel( i18n( "the echonest thinks the artist is similar to" ) ); QRadioButton *rb1 = new QRadioButton( i18n( "the previous track's artist" ) ); @@ -161,7 +161,7 @@ Dynamic::TrackSet Dynamic::EchoNestBias::matchingTracks( const Meta::TrackList& playlist, int contextCount, int finalCount, - Dynamic::TrackCollectionPtr universe ) const + const Dynamic::TrackCollectionPtr &universe ) const { Q_UNUSED( contextCount ); Q_UNUSED( finalCount ); @@ -241,7 +241,7 @@ if( m_similarArtistMap.contains( key ) ) { similar = m_similarArtistMap.value( key ); - debug() << "got similar artists:" << similar.join(", "); + debug() << "got similar artists:" << similar.join(QStringLiteral(", ")); } else { @@ -280,9 +280,9 @@ QMultiMap< QString, QString > params; // -- start the query - params.insert( "results", "30" ); - params.insert( "name", m_currentArtists.join(", ") ); - m_artistSuggestedQuery = KIO::storedGet( createUrl( "artist/similar", params ), KIO::NoReload, KIO::HideProgressInfo ); + params.insert( QStringLiteral("results"), QStringLiteral("30") ); + params.insert( QStringLiteral("name"), m_currentArtists.join(QStringLiteral(", ")) ); + m_artistSuggestedQuery = KIO::storedGet( createUrl( QStringLiteral("artist/similar"), params ), KIO::NoReload, KIO::HideProgressInfo ); connect( m_artistSuggestedQuery, &KJob::result, this, &EchoNestBias::similarArtistQueryDone ); } @@ -295,33 +295,33 @@ { debug() << "job was deleted from under us...wtf! blame the gerbils."; m_tracks.reset( false ); - emit resultReady( m_tracks ); + Q_EMIT resultReady( m_tracks ); return; } QDomDocument doc; if( !doc.setContent( m_artistSuggestedQuery->data() ) ) { debug() << "got invalid XML from EchoNest::get_similar!"; m_tracks.reset( false ); - emit resultReady( m_tracks ); + Q_EMIT resultReady( m_tracks ); return; } // -- decode the result - QDomNodeList artists = doc.elementsByTagName( "artist" ); + QDomNodeList artists = doc.elementsByTagName( QStringLiteral("artist") ); if( artists.isEmpty() ) { debug() << "Got no similar artists! Bailing!"; m_tracks.reset( false ); - emit resultReady( m_tracks ); + Q_EMIT resultReady( m_tracks ); return; } QStringList similarArtists; for( int i = 0; i < artists.count(); i++ ) { - similarArtists.append( artists.at(i).firstChildElement( "name" ).text() ); + similarArtists.append( artists.at(i).firstChildElement( QStringLiteral("name") ).text() ); } // -- commit the result @@ -375,15 +375,15 @@ // this method shamelessly inspired by liblastfm/src/ws/ws.cpp -QUrl Dynamic::EchoNestBias::createUrl( QString method, QMultiMap< QString, QString > params ) +QUrl Dynamic::EchoNestBias::createUrl( const QString &method, QMultiMap< QString, QString > params ) { - params.insert( "api_key", "DD9P0OV9OYFH1LCAE" ); - params.insert( "format", "xml" ); + params.insert( QStringLiteral("api_key"), QStringLiteral("DD9P0OV9OYFH1LCAE") ); + params.insert( QStringLiteral("format"), QStringLiteral("xml") ); QUrl url; QUrlQuery query; - url.setScheme( "http" ); - url.setHost( "developer.echonest.com" ); + url.setScheme( QStringLiteral("http") ); + url.setHost( QStringLiteral("developer.echonest.com") ); url.setPath( "/api/v4/" + method ); // take care of the ID possibility manually @@ -411,16 +411,16 @@ writer.setAutoFormatting( true ); writer.writeStartDocument(); - writer.writeStartElement( QLatin1String("echonestSimilar") ); + writer.writeStartElement( QStringLiteral("echonestSimilar") ); // -- write the similar artists foreach( const QString& key, m_similarArtistMap.keys() ) { - writer.writeStartElement( QLatin1String("similarArtist") ); - writer.writeTextElement( QLatin1String("artist"), key ); + writer.writeStartElement( QStringLiteral("similarArtist") ); + writer.writeTextElement( QStringLiteral("artist"), key ); foreach( const QString& name, m_similarArtistMap.value( key ) ) { - writer.writeTextElement( QLatin1String("similar"), name ); + writer.writeTextElement( QStringLiteral("similar"), name ); } writer.writeEndElement(); } @@ -505,7 +505,7 @@ { m_match = value; invalidate(); - emit changed( BiasPtr(this) ); + Q_EMIT changed( BiasPtr(this) ); } @@ -521,23 +521,23 @@ { switch( match ) { - case Dynamic::EchoNestBias::PreviousTrack: return "previous"; - case Dynamic::EchoNestBias::Playlist: return "playlist"; + case Dynamic::EchoNestBias::PreviousTrack: return QStringLiteral("previous"); + case Dynamic::EchoNestBias::Playlist: return QStringLiteral("playlist"); } return QString(); } Dynamic::EchoNestBias::MatchType Dynamic::EchoNestBias::matchForName( const QString &name ) { - if( name == "previous" ) return PreviousTrack; - else if( name == "playlist" ) return Playlist; + if( name == QLatin1String("previous") ) return PreviousTrack; + else if( name == QLatin1String("playlist") ) return Playlist; else return PreviousTrack; } QString -Dynamic::EchoNestBias::tracksMapKey( QStringList artists ) +Dynamic::EchoNestBias::tracksMapKey( const QStringList &artists ) { - return artists.join("|"); + return artists.join(QStringLiteral("|")); } diff --git a/src/dynamic/biases/IfElseBias.h b/src/dynamic/biases/IfElseBias.h --- a/src/dynamic/biases/IfElseBias.h +++ b/src/dynamic/biases/IfElseBias.h @@ -39,16 +39,16 @@ IfElseBias(); static QString sName(); - virtual QString name() const; - virtual QString toString() const; + QString name() const override; + QString toString() const override; - virtual void paintOperator( QPainter* painter, const QRect &rect, Dynamic::AbstractBias* bias ); + void paintOperator( QPainter* painter, const QRect &rect, Dynamic::AbstractBias* bias ) override; - virtual TrackSet matchingTracks( const Meta::TrackList& playlist, + TrackSet matchingTracks( const Meta::TrackList& playlist, int contextCount, int finalCount, - const TrackCollectionPtr universe ) const; + const TrackCollectionPtr &universe ) const override; - virtual void resultReceived( const Dynamic::TrackSet &tracks ); + void resultReceived( const Dynamic::TrackSet &tracks ) override; private: /** Removes duplicate tracks from m_tracks @@ -70,10 +70,10 @@ class AMAROK_EXPORT IfElseBiasFactory : public Dynamic::AbstractBiasFactory { public: - virtual QString i18nName() const; - virtual QString name() const; - virtual QString i18nDescription() const; - virtual BiasPtr createBias(); + QString i18nName() const override; + QString name() const override; + QString i18nDescription() const override; + BiasPtr createBias() override; }; } diff --git a/src/dynamic/biases/IfElseBias.cpp b/src/dynamic/biases/IfElseBias.cpp --- a/src/dynamic/biases/IfElseBias.cpp +++ b/src/dynamic/biases/IfElseBias.cpp @@ -57,7 +57,7 @@ QString Dynamic::IfElseBias::sName() { - return QLatin1String( "ifElseBias" ); + return QStringLiteral( "ifElseBias" ); } QString @@ -84,7 +84,7 @@ Dynamic::TrackSet Dynamic::IfElseBias::matchingTracks( const Meta::TrackList& playlist, int contextCount, int finalCount, - Dynamic::TrackCollectionPtr universe ) const + const Dynamic::TrackCollectionPtr &universe ) const { // store the parameters in case we need to request additional matching tracks later m_playlist = playlist; @@ -125,7 +125,7 @@ removeDuplicate(); if( !m_tracks.isEmpty() ) { - emit resultReady( m_tracks ); + Q_EMIT resultReady( m_tracks ); return; } @@ -155,12 +155,12 @@ { removeDuplicate(); if( !m_tracks.isEmpty() ) { - emit resultReady( m_tracks ); + Q_EMIT resultReady( m_tracks ); return; } } } - emit resultReady( m_tracks ); + Q_EMIT resultReady( m_tracks ); } // we need to eliminate duplicates now to have a proper check for an empty result diff --git a/src/dynamic/biases/PartBias.h b/src/dynamic/biases/PartBias.h --- a/src/dynamic/biases/PartBias.h +++ b/src/dynamic/biases/PartBias.h @@ -40,7 +40,7 @@ Q_OBJECT public: - PartBiasWidget( Dynamic::PartBias* bias, QWidget* parent = 0 ); + explicit PartBiasWidget( Dynamic::PartBias* bias, QWidget* parent = nullptr ); protected Q_SLOTS: void biasAppended( Dynamic::BiasPtr bias ); @@ -51,7 +51,7 @@ void biasWeightsChanged(); protected: - /** True if we just handle a signal. Used to protect agains recursion */ + /** True if we just handle a signal. Used to protect against recursion */ bool m_inSignal; Dynamic::PartBias* m_bias; @@ -71,39 +71,38 @@ public: /** Create a new part bias. - @param empty If true, then the newly created bias will not have a set of example sub-biases. */ PartBias(); - virtual void fromXml( QXmlStreamReader *reader ); - virtual void toXml( QXmlStreamWriter *writer ) const; + void fromXml( QXmlStreamReader *reader ) override; + void toXml( QXmlStreamWriter *writer ) const override; static QString sName(); - virtual QString name() const; - virtual QString toString() const; + QString name() const override; + QString toString() const override; - virtual QWidget* widget( QWidget* parent = 0 ); - virtual void paintOperator( QPainter* painter, const QRect &rect, Dynamic::AbstractBias* bias ); + QWidget* widget( QWidget* parent = nullptr ) override; + void paintOperator( QPainter* painter, const QRect &rect, Dynamic::AbstractBias* bias ) override; - virtual TrackSet matchingTracks( const Meta::TrackList& playlist, + TrackSet matchingTracks( const Meta::TrackList& playlist, int contextCount, int finalCount, - const TrackCollectionPtr universe ) const; + const TrackCollectionPtr &universe ) const override; - virtual bool trackMatches( int position, + bool trackMatches( int position, const Meta::TrackList& playlist, - int contextCount ) const; + int contextCount ) const override; /** Returns the weights of the bias itself and all the sub-biases. */ virtual QList weights() const; /** Appends a bias to this bias. This object will take ownership of the bias and free it when destroyed. */ - virtual void appendBias( Dynamic::BiasPtr bias ); - virtual void moveBias( int from, int to ); + void appendBias( const Dynamic::BiasPtr &bias ) override; + void moveBias( int from, int to ) override; public Q_SLOTS: - void resultReceived( const Dynamic::TrackSet &tracks ); + void resultReceived( const Dynamic::TrackSet &tracks ) override; /** The overall weight has changed */ void changeBiasWeight( int biasNum, qreal value ); @@ -113,7 +112,7 @@ void weightsChanged(); protected Q_SLOTS: - virtual void biasReplaced( Dynamic::BiasPtr oldBias, Dynamic::BiasPtr newBias ); + void biasReplaced( const Dynamic::BiasPtr &oldBias, const Dynamic::BiasPtr &newBias ) override; private: /** Using the data from m_matchingTracks it tries to compute a valid m_tracks */ @@ -135,10 +134,10 @@ class AMAROK_EXPORT PartBiasFactory : public Dynamic::AbstractBiasFactory { public: - virtual QString i18nName() const; - virtual QString name() const; - virtual QString i18nDescription() const; - virtual BiasPtr createBias(); + QString i18nName() const override; + QString name() const override; + QString i18nDescription() const override; + BiasPtr createBias() override; }; } diff --git a/src/dynamic/biases/PartBias.cpp b/src/dynamic/biases/PartBias.cpp --- a/src/dynamic/biases/PartBias.cpp +++ b/src/dynamic/biases/PartBias.cpp @@ -75,7 +75,6 @@ { public: /** Creates the matching - @param ignoreTrack a track number that should be ignored for matching. -1 if no track should be ignored. */ MatchState( const Dynamic::PartBias *bias, const Meta::TrackList& playlist, @@ -295,7 +294,7 @@ Dynamic::PartBiasWidget::sliderValueChanged( int val ) { DEBUG_BLOCK; - // protect agains recursion + // protect against recursion if( m_inSignal ) return; @@ -310,7 +309,7 @@ Dynamic::PartBiasWidget::biasWeightsChanged() { DEBUG_BLOCK; - // protect agains recursion + // protect against recursion if( m_inSignal ) return; @@ -345,7 +344,7 @@ if( reader->isStartElement() ) { - float weight = reader->attributes().value( "weight" ).toString().toFloat(); + float weight = reader->attributes().value( QStringLiteral("weight") ).toString().toFloat(); Dynamic::BiasPtr bias( Dynamic::BiasFactory::fromXml( reader ) ); if( bias ) { @@ -373,16 +372,16 @@ for( int i = 0; i < m_biases.count(); i++ ) { writer->writeStartElement( m_biases[i]->name() ); - writer->writeAttribute( "weight", QString::number(m_weights[i]) ); + writer->writeAttribute( QStringLiteral("weight"), QString::number(m_weights[i]) ); m_biases[i]->toXml( writer ); writer->writeEndElement(); } } QString Dynamic::PartBias::sName() { - return QLatin1String( "partBias" ); + return QStringLiteral( "partBias" ); } QString @@ -429,7 +428,7 @@ Dynamic::TrackSet Dynamic::PartBias::matchingTracks( const Meta::TrackList& playlist, int contextCount, int finalCount, - Dynamic::TrackCollectionPtr universe ) const + const Dynamic::TrackCollectionPtr &universe ) const { DEBUG_BLOCK; @@ -517,7 +516,7 @@ updateResults(); if( !m_tracks.isOutstanding() ) - emit resultReady( m_tracks ); + Q_EMIT resultReady( m_tracks ); } bool @@ -531,7 +530,7 @@ } void -Dynamic::PartBias::appendBias( Dynamic::BiasPtr bias ) +Dynamic::PartBias::appendBias( const Dynamic::BiasPtr &bias ) { DEBUG_BLOCK; m_weights.append( qreal(0.0) ); @@ -561,7 +560,7 @@ if( m_weights.at(0) != 1.0 ) { m_weights[0] = 1.0; - emit weightsChanged(); + Q_EMIT weightsChanged(); } return; } @@ -610,12 +609,12 @@ for( int i = 0; i < m_weights.count(); i++ ) debug() << "Weight"<writeTextElement( "follow", nameForFollow( m_follow ) ); + writer->writeTextElement( QStringLiteral("follow"), nameForFollow( m_follow ) ); } QString Dynamic::QuizPlayBias::sName() { - return QLatin1String( "quizPlayBias" ); + return QStringLiteral( "quizPlayBias" ); } QString @@ -160,7 +160,7 @@ Dynamic::TrackSet Dynamic::QuizPlayBias::matchingTracks( const Meta::TrackList& playlist, int contextCount, int finalCount, - Dynamic::TrackCollectionPtr universe ) const + const Dynamic::TrackCollectionPtr &universe ) const { Q_UNUSED( contextCount ); Q_UNUSED( finalCount ); @@ -254,7 +254,7 @@ { m_follow = value; invalidate(); - emit changed( BiasPtr(this) ); + Q_EMIT changed( BiasPtr(this) ); } void @@ -339,19 +339,19 @@ { switch( match ) { - case Dynamic::QuizPlayBias::TitleToTitle: return "titleQuiz"; - case Dynamic::QuizPlayBias::ArtistToArtist: return "artistQuiz"; - case Dynamic::QuizPlayBias::AlbumToAlbum: return "albumQuiz"; + case Dynamic::QuizPlayBias::TitleToTitle: return QStringLiteral("titleQuiz"); + case Dynamic::QuizPlayBias::ArtistToArtist: return QStringLiteral("artistQuiz"); + case Dynamic::QuizPlayBias::AlbumToAlbum: return QStringLiteral("albumQuiz"); } return QString(); } Dynamic::QuizPlayBias::FollowType Dynamic::QuizPlayBias::followForName( const QString &name ) { - if( name == "titleQuiz" ) return TitleToTitle; - else if( name == "artistQuiz" ) return ArtistToArtist; - else if( name == "albumQuiz" ) return AlbumToAlbum; + if( name == QLatin1String("titleQuiz") ) return TitleToTitle; + else if( name == QLatin1String("artistQuiz") ) return ArtistToArtist; + else if( name == QLatin1String("albumQuiz") ) return AlbumToAlbum; else return TitleToTitle; } diff --git a/src/dynamic/biases/SearchQueryBias.h b/src/dynamic/biases/SearchQueryBias.h --- a/src/dynamic/biases/SearchQueryBias.h +++ b/src/dynamic/biases/SearchQueryBias.h @@ -34,24 +34,24 @@ Q_OBJECT public: - SearchQueryBias( QString filter = QString("genre:Rock") ); + explicit SearchQueryBias( const QString &filter = QStringLiteral("genre:Rock") ); - virtual void fromXml( QXmlStreamReader *reader ); - virtual void toXml( QXmlStreamWriter *writer ) const; + void fromXml( QXmlStreamReader *reader ) override; + void toXml( QXmlStreamWriter *writer ) const override; static QString sName(); - virtual QString name() const; - virtual QString toString() const; + QString name() const override; + QString toString() const override; - virtual QWidget* widget( QWidget* parent = 0 ); + QWidget* widget( QWidget* parent = nullptr ) override; QString filter() const; public Q_SLOTS: void setFilter( const QString &filter ); protected Q_SLOTS: - virtual void newQuery(); + void newQuery() override; private: QString m_filter; @@ -66,10 +66,10 @@ class AMAROK_EXPORT SearchQueryBiasFactory : public Dynamic::AbstractBiasFactory { public: - virtual QString i18nName() const; - virtual QString name() const; - virtual QString i18nDescription() const; - virtual BiasPtr createBias(); + QString i18nName() const override; + QString name() const override; + QString i18nDescription() const override; + BiasPtr createBias() override; }; } diff --git a/src/dynamic/biases/SearchQueryBias.cpp b/src/dynamic/biases/SearchQueryBias.cpp --- a/src/dynamic/biases/SearchQueryBias.cpp +++ b/src/dynamic/biases/SearchQueryBias.cpp @@ -58,7 +58,7 @@ // ----- SearchQueryBias -------- -Dynamic::SearchQueryBias::SearchQueryBias( QString filter ) +Dynamic::SearchQueryBias::SearchQueryBias( const QString &filter ) : SimpleMatchBias() , m_filter( filter ) { } @@ -92,13 +92,13 @@ void Dynamic::SearchQueryBias::toXml( QXmlStreamWriter *writer ) const { - writer->writeTextElement( "filter", m_filter ); + writer->writeTextElement( QStringLiteral("filter"), m_filter ); } QString Dynamic::SearchQueryBias::sName() { - return QLatin1String( "searchQueryBias" ); + return QStringLiteral( "searchQueryBias" ); } QString @@ -148,7 +148,7 @@ m_filter = filter; invalidate(); - emit changed( BiasPtr(this) ); + Q_EMIT changed( BiasPtr(this) ); } void diff --git a/src/dynamic/biases/TagMatchBias.h b/src/dynamic/biases/TagMatchBias.h --- a/src/dynamic/biases/TagMatchBias.h +++ b/src/dynamic/biases/TagMatchBias.h @@ -18,8 +18,8 @@ * this program. If not, see . * ****************************************************************************************/ -#ifndef AMAROK_METATAGBIAS_H -#define AMAROK_METATAGBIAS_H +#ifndef AMAROK_TAGMATCHBIAS_H +#define AMAROK_TAGMATCHBIAS_H #include "amarok_export.h" #include "core/collections/QueryMaker.h" @@ -37,7 +37,7 @@ class TagMatchBias; - /** An abstract bias that will check matching tracks agains the results from a query maker. + /** An abstract bias that will check matching tracks against the results from a query maker. You can use this base class for writing your own biases. In all cases you have to implement newQuery which creates a QueryMaker and starts it. @@ -49,27 +49,27 @@ public: SimpleMatchBias(); - virtual void fromXml( QXmlStreamReader *reader ); - virtual void toXml( QXmlStreamWriter *writer ) const; + void fromXml( QXmlStreamReader *reader ) override; + void toXml( QXmlStreamWriter *writer ) const override; - virtual TrackSet matchingTracks( const Meta::TrackList& playlist, + TrackSet matchingTracks( const Meta::TrackList& playlist, int contextCount, int finalCount, - const TrackCollectionPtr universe ) const; + const TrackCollectionPtr &universe ) const override; - virtual bool trackMatches( int position, + bool trackMatches( int position, const Meta::TrackList& playlist, - int contextCount ) const; + int contextCount ) const override; /** Is the result inverted (e.g. does NOT contain) */ bool isInvert() const; void setInvert( bool value ); public Q_SLOTS: - virtual void invalidate(); + void invalidate() override; protected Q_SLOTS: /** Called when we get new uids from the query maker */ - virtual void updateReady( QStringList uids ); + virtual void updateReady( const QStringList &uids ); /** Called when the querymaker is finished */ virtual void updateFinished(); @@ -108,7 +108,7 @@ Q_OBJECT public: - TagMatchBiasWidget( Dynamic::TagMatchBias* bias, QWidget* parent = 0 ); + explicit TagMatchBiasWidget( Dynamic::TagMatchBias* bias, QWidget* parent = nullptr ); private Q_SLOTS: void syncControlsToBias(); @@ -130,25 +130,25 @@ public: TagMatchBias(); - virtual void fromXml( QXmlStreamReader *reader ); - virtual void toXml( QXmlStreamWriter *writer ) const; + void fromXml( QXmlStreamReader *reader ) override; + void toXml( QXmlStreamWriter *writer ) const override; static QString sName(); - virtual QString name() const; - virtual QString toString() const; + QString name() const override; + QString toString() const override; - virtual QWidget* widget( QWidget* parent = 0 ); + QWidget* widget( QWidget* parent = nullptr ) override; - virtual bool trackMatches( int position, + bool trackMatches( int position, const Meta::TrackList& playlist, - int contextCount ) const; + int contextCount ) const override; MetaQueryWidget::Filter filter() const; void setFilter( const MetaQueryWidget::Filter &filter ); protected Q_SLOTS: - virtual void newQuery(); + void newQuery() override; protected: static QString nameForCondition( MetaQueryWidget::FilterCondition cond ); @@ -164,10 +164,10 @@ class AMAROK_EXPORT TagMatchBiasFactory : public Dynamic::AbstractBiasFactory { public: - virtual QString i18nName() const; - virtual QString name() const; - virtual QString i18nDescription() const; - virtual BiasPtr createBias(); + QString i18nName() const override; + QString name() const override; + QString i18nDescription() const override; + BiasPtr createBias() override; }; } diff --git a/src/dynamic/biases/TagMatchBias.cpp b/src/dynamic/biases/TagMatchBias.cpp --- a/src/dynamic/biases/TagMatchBias.cpp +++ b/src/dynamic/biases/TagMatchBias.cpp @@ -65,14 +65,14 @@ void Dynamic::SimpleMatchBias::fromXml( QXmlStreamReader *reader ) { - m_invert = reader->attributes().value( "invert" ).toString().toInt(); + m_invert = reader->attributes().value( QStringLiteral("invert") ).toString().toInt(); } void Dynamic::SimpleMatchBias::toXml( QXmlStreamWriter *writer ) const { if( m_invert ) - writer->writeAttribute("invert", "1"); + writer->writeAttribute(QStringLiteral("invert"), QStringLiteral("1")); } bool @@ -90,14 +90,14 @@ m_invert = value; // setting "invert" does not invalidate the search results - emit changed( BiasPtr(this) ); + Q_EMIT changed( BiasPtr(this) ); } Dynamic::TrackSet Dynamic::SimpleMatchBias::matchingTracks( const Meta::TrackList& playlist, int contextCount, int finalCount, - Dynamic::TrackCollectionPtr universe ) const + const Dynamic::TrackCollectionPtr &universe ) const { Q_UNUSED( playlist ); Q_UNUSED( contextCount ); @@ -116,7 +116,7 @@ } void -Dynamic::SimpleMatchBias::updateReady( QStringList uids ) +Dynamic::SimpleMatchBias::updateReady( const QStringList &uids ) { if( m_invert ) m_tracks.subtract( uids ); @@ -130,7 +130,7 @@ m_tracksTime = QDateTime::currentDateTime(); m_qm.reset(); debug() << "SimpleMatchBias::"<writeTextElement( "field", Meta::playlistNameForField( m_filter.field() ) ); + writer->writeTextElement( QStringLiteral("field"), Meta::playlistNameForField( m_filter.field() ) ); if( m_filter.isNumeric() ) { - writer->writeTextElement( "numValue", QString::number( m_filter.numValue ) ); - writer->writeTextElement( "numValue2", QString::number( m_filter.numValue2 ) ); + writer->writeTextElement( QStringLiteral("numValue"), QString::number( m_filter.numValue ) ); + writer->writeTextElement( QStringLiteral("numValue2"), QString::number( m_filter.numValue2 ) ); } else { - writer->writeTextElement( "value", m_filter.value ); + writer->writeTextElement( QStringLiteral("value"), m_filter.value ); } - writer->writeTextElement( "condition", nameForCondition( m_filter.condition ) ); + writer->writeTextElement( QStringLiteral("condition"), nameForCondition( m_filter.condition ) ); } QString Dynamic::TagMatchBias::sName() { - return QLatin1String( "tagMatchBias" ); + return QStringLiteral( "tagMatchBias" ); } QString @@ -317,7 +317,7 @@ DEBUG_BLOCK; m_filter = filter; invalidate(); - emit changed( BiasPtr(this) ); + Q_EMIT changed( BiasPtr(this) ); } void @@ -424,12 +424,12 @@ { switch( cond ) { - case MetaQueryWidget::Equals: return "equals"; - case MetaQueryWidget::GreaterThan: return "greater"; - case MetaQueryWidget::LessThan: return "less"; - case MetaQueryWidget::Between: return "between"; - case MetaQueryWidget::OlderThan: return "older"; - case MetaQueryWidget::Contains: return "contains"; + case MetaQueryWidget::Equals: return QStringLiteral("equals"); + case MetaQueryWidget::GreaterThan: return QStringLiteral("greater"); + case MetaQueryWidget::LessThan: return QStringLiteral("less"); + case MetaQueryWidget::Between: return QStringLiteral("between"); + case MetaQueryWidget::OlderThan: return QStringLiteral("older"); + case MetaQueryWidget::Contains: return QStringLiteral("contains"); default: ;// the other conditions are only for the advanced playlist generator } @@ -439,12 +439,12 @@ MetaQueryWidget::FilterCondition Dynamic::TagMatchBias::conditionForName( const QString &name ) { - if( name == "equals" ) return MetaQueryWidget::Equals; - else if( name == "greater" ) return MetaQueryWidget::GreaterThan; - else if( name == "less" ) return MetaQueryWidget::LessThan; - else if( name == "between" ) return MetaQueryWidget::Between; - else if( name == "older" ) return MetaQueryWidget::OlderThan; - else if( name == "contains" ) return MetaQueryWidget::Contains; + if( name == QLatin1String("equals") ) return MetaQueryWidget::Equals; + else if( name == QLatin1String("greater") ) return MetaQueryWidget::GreaterThan; + else if( name == QLatin1String("less") ) return MetaQueryWidget::LessThan; + else if( name == QLatin1String("between") ) return MetaQueryWidget::Between; + else if( name == QLatin1String("older") ) return MetaQueryWidget::OlderThan; + else if( name == QLatin1String("contains") ) return MetaQueryWidget::Contains; else return MetaQueryWidget::Equals; } diff --git a/src/equalizer/EqualizerPresets.h b/src/equalizer/EqualizerPresets.h --- a/src/equalizer/EqualizerPresets.h +++ b/src/equalizer/EqualizerPresets.h @@ -31,7 +31,7 @@ QStringList eqGlobalTranslatedList(); QStringList eqGlobalList(); - /** Will return a list of all non default preset name namess */ + /** Will return a list of all non default preset names */ QStringList eqUserList(); /** Will return a "user" preset if present. Else a "global". */ @@ -55,6 +55,7 @@ /** Sets the preset (create a user preset). @param presetName The untranslated preset name. + @param presetValues The preset values. */ void eqCfgSetPresetVal( const QString &presetName, const QList &presetValues ); diff --git a/src/equalizer/EqualizerPresets.cpp b/src/equalizer/EqualizerPresets.cpp --- a/src/equalizer/EqualizerPresets.cpp +++ b/src/equalizer/EqualizerPresets.cpp @@ -122,12 +122,12 @@ QStringList EqualizerPresets::eqUserList() { - QStringList defaultList = eqDefaultPresetsList(); + const QStringList defaultList = eqDefaultPresetsList(); QStringList userList; foreach( const QString &mUsrName, AmarokConfig::equalizerPresetsNames() ) { - if( defaultList.indexOf( mUsrName ) < 0 ) + if( !defaultList.contains( mUsrName ) ) userList.append( mUsrName ); } return userList; @@ -227,7 +227,7 @@ EqualizerPresets::eqCfgGetPresetVal( const QString &presetName ) { // Idea is to return user preset with request name first - // if not look into into default preset names + // if not look into the default preset names const int idUsr = AmarokConfig::equalizerPresetsNames().indexOf( presetName ); const int idDef = eqDefaultPresetsList().indexOf( presetName ); diff --git a/src/importers/ImporterManager.h b/src/importers/ImporterManager.h --- a/src/importers/ImporterManager.h +++ b/src/importers/ImporterManager.h @@ -53,21 +53,21 @@ /** * Destructor. */ - virtual ~ImporterManager(); + ~ImporterManager() override; /** * Loads up saved configuration, for every retrieved config calls * createProvider( config ), and then registers created providers with * StatSyncing::Controller. This method is called by PluginManager. */ - virtual void init(); + void init() override; /** * Basic implementation for StatSyncing::ProviderFactory createConfigWidget() method, * used for configuring new providers. By default calls @see getConfigWidget with * empty config parameter. */ - virtual ProviderConfigWidget *createConfigWidget(); + ProviderConfigWidget *createConfigWidget() override; /** * Returns a configuration widget prepopulated with given config values. @@ -81,7 +81,7 @@ * * This method can also be used to replace existing provider instances. */ - virtual ProviderPtr createProvider( QVariantMap config ); + ProviderPtr createProvider( const QVariantMap &config ) override; protected: /** diff --git a/src/importers/ImporterManager.cpp b/src/importers/ImporterManager.cpp --- a/src/importers/ImporterManager.cpp +++ b/src/importers/ImporterManager.cpp @@ -70,16 +70,16 @@ } ProviderPtr -ImporterManager::createProvider( QVariantMap config ) +ImporterManager::createProvider( const QVariantMap &config ) { Controller *controller = Amarok::Components::statSyncingController(); // First, get rid of the old provider instance. Note: the StatSyncing::Config // remembers the provider by the id, even when it's unregistered. After this // block, old instance should be destroyed, its destructor called. - if( config.contains( "uid" ) ) + if( config.contains( QStringLiteral("uid") ) ) { - const QString providerId = config.value( "uid" ).toString(); + const QString providerId = config.value( QStringLiteral("uid") ).toString(); if( m_providers.contains( providerId ) ) { ProviderPtr oldProvider = m_providers.take( providerId ); @@ -128,7 +128,7 @@ KConfigGroup ImporterManager::managerConfig() const { - return Amarok::config( "Importers" ).group( type() ); + return Amarok::config( QStringLiteral("Importers") ).group( type() ); } KConfigGroup diff --git a/src/importers/ImporterProvider.h b/src/importers/ImporterProvider.h --- a/src/importers/ImporterProvider.h +++ b/src/importers/ImporterProvider.h @@ -53,47 +53,47 @@ * Provider's unique id which may be used as a key for configuration storage. * Returns m_config["uid"] by default. */ - virtual QString id() const; + QString id() const override; /** * Description of the provider. Returns m_importer->description() by default. */ - virtual QString description() const; + QString description() const override; /** * Provider's icon. Returns m_importer->icon() by default. */ - virtual QIcon icon() const; + QIcon icon() const override; /** * Provider's name as displayed in Amarok's Metadata Configuration tab. Returns * m_config["name"] by default. */ - virtual QString prettyName() const; + QString prettyName() const override; /** * Returns true if provider is configurable. Returns true by default. */ - virtual bool isConfigurable() const; + bool isConfigurable() const override; /** * Returns configuration widget used to reconfigure this provider. By default * delegates to m_importer->getConfigWidget( m_config ). */ - virtual ProviderConfigWidget *configWidget(); + ProviderConfigWidget *configWidget() override; /** * Reconfigures current provider. An ImporterManager subclass handles the * task, _recreating_ this provider with new configuration. Please note that * m_config["uid"] is not subject to reconfiguration. */ - virtual void reconfigure( const QVariantMap &config ); + void reconfigure( const QVariantMap &config ) override; /** * Determines if this provider should participate in statistics synchronization * by default. By default returns StatSyncing::Provider::NoByDefault . */ - virtual Preference defaultPreference(); + Preference defaultPreference() override; Q_SIGNALS: void reconfigurationRequested( const QVariantMap &config ); diff --git a/src/importers/ImporterProvider.cpp b/src/importers/ImporterProvider.cpp --- a/src/importers/ImporterProvider.cpp +++ b/src/importers/ImporterProvider.cpp @@ -25,8 +25,8 @@ : m_config( config ) , m_manager( manager ) { - if( !m_config.contains( "uid" ) ) - m_config.insert( "uid", qrand() ); + if( !m_config.contains( QStringLiteral("uid") ) ) + m_config.insert( QStringLiteral("uid"), qrand() ); if( m_manager == 0 ) warning() << __PRETTY_FUNCTION__ << "manager pointer is not set"; @@ -39,7 +39,7 @@ QString StatSyncing::ImporterProvider::id() const { - return m_config.value( "uid" ).toString(); + return m_config.value( QStringLiteral("uid") ).toString(); } QString @@ -57,7 +57,7 @@ QString ImporterProvider::prettyName() const { - return m_config.value( "name" ).toString(); + return m_config.value( QStringLiteral("name") ).toString(); } bool @@ -76,8 +76,8 @@ void ImporterProvider::reconfigure( const QVariantMap &config ) { - if( config.value( "uid" ) == m_config.value( "uid" ) ) - emit reconfigurationRequested( config ); + if( config.value( QStringLiteral("uid") ) == m_config.value( QStringLiteral("uid") ) ) + Q_EMIT reconfigurationRequested( config ); else warning() << __PRETTY_FUNCTION__ << "reconfigure called with different provider" << "uid!"; diff --git a/src/importers/ImporterSqlConnection.h b/src/importers/ImporterSqlConnection.h --- a/src/importers/ImporterSqlConnection.h +++ b/src/importers/ImporterSqlConnection.h @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include #include @@ -37,7 +37,7 @@ /** * A helper class encapsulating communication with the database. It guarantees that * a connection is only used in thread that created it, as per - * @link http://qt-project.org/doc/qt-4.8/threads-modules.html#threads-and-the-sql-module + * http://doc.qt.io/qt-5/threads-modules.html#threads-and-the-sql-module * This class is very basic, e.g. returns a whole query result as a list of lists, * so it may not be suitable for more advanced usage. */ @@ -57,20 +57,23 @@ /** * Constructor. Overload for creating a connection to SQLite database. */ - ImporterSqlConnection( const QString &dbPath ); + explicit ImporterSqlConnection( const QString &dbPath ); /** * Destructor. Removes connection created in the constructor. If a transaction was * in progress it is rolled back. */ virtual ~ImporterSqlConnection(); /** - * Executes a query given in QString @param query , first using QSqlQuery::bindValue - * to bind parameters given in @param bindValues . If @param ok is not null the bool + * Executes a query given in QString @p query, first using QSqlQuery::bindValue + * to bind parameters given in @p bindValues. If @p ok is not null the bool * it points at is set to true if the query was successful and false if error occurred. * Note that if no transaction is started, the connection is opened for the query and * then closed again. + * @param query the query + * @param bindValues the bind parameters + * @param ok whether the query was successful * * @returns The result of the query. */ diff --git a/src/importers/ImporterSqlConnection.cpp b/src/importers/ImporterSqlConnection.cpp --- a/src/importers/ImporterSqlConnection.cpp +++ b/src/importers/ImporterSqlConnection.cpp @@ -21,10 +21,10 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include using namespace StatSyncing; @@ -51,7 +51,7 @@ , m_apiMutex( QMutex::Recursive ) , m_openTransaction( false ) { - QSqlDatabase db = QSqlDatabase::addDatabase( "QSQLITE", m_connectionName ); + QSqlDatabase db = QSqlDatabase::addDatabase( QStringLiteral("QSQLITE"), m_connectionName ); db.setDatabaseName( dbPath ); } diff --git a/src/importers/SimpleImporterConfigWidget.h b/src/importers/SimpleImporterConfigWidget.h --- a/src/importers/SimpleImporterConfigWidget.h +++ b/src/importers/SimpleImporterConfigWidget.h @@ -35,11 +35,15 @@ public: /** * Constructor. Creates a widget with one label: "Target name," and one text field - * with its default value specified in @param targetName . @param config contains + * with its default value specified in @p targetName . @p config contains * configuration for this widget. + * @param targetName the target name + * @param config configuration for the created widget + * @param parent the parent widget + * @param f Qt window flags */ SimpleImporterConfigWidget( const QString &targetName, const QVariantMap &config, - QWidget *parent = 0, Qt::WindowFlags f = 0 ); + QWidget *parent = nullptr, Qt::WindowFlags f = {} ); /** * Destructor. @@ -62,7 +66,7 @@ /** * Returns a config generated from this widget's fields. */ - QVariantMap config() const; + QVariantMap config() const override; private: const QVariantMap m_config; diff --git a/src/importers/SimpleImporterConfigWidget.cpp b/src/importers/SimpleImporterConfigWidget.cpp --- a/src/importers/SimpleImporterConfigWidget.cpp +++ b/src/importers/SimpleImporterConfigWidget.cpp @@ -46,8 +46,8 @@ mainLayout->addStretch( 1 ); setLayout( mainLayout ); - addField( "name", i18nc( "Name of the synchronization target", "Target name" ), - new QLineEdit( targetName ), "text" ); + addField( QStringLiteral("name"), i18nc( "Name of the synchronization target", "Target name" ), + new QLineEdit( targetName ), QStringLiteral("text") ); } SimpleImporterConfigWidget::~SimpleImporterConfigWidget() diff --git a/src/importers/SimpleImporterManager.h b/src/importers/SimpleImporterManager.h --- a/src/importers/SimpleImporterManager.h +++ b/src/importers/SimpleImporterManager.h @@ -25,7 +25,7 @@ * This macro can be used to reduce the amount of code needed in order to implement * ImporterManager subclass and export it as a plugin. If your manager doesn't do * anything other than give static info, you can replace the whole class with this macro. - * You need to include the .moc file after this macro (#include ). + * You need to include the .moc file after this macro (\#include ). * See iTunes importer for usage example (ITunesManager.cpp file). */ #define AMAROK_EXPORT_SIMPLE_IMPORTER_PLUGIN( libname, JSON, TYPE, PRETTY_NAME, DESCRIPTION, \ @@ -42,33 +42,33 @@ } \ \ QString type() const \ - { \ + override { \ return TYPE; \ } \ \ QString prettyName() const \ - { \ + override { \ return PRETTY_NAME; \ } \ \ QString description() const \ - { \ + override { \ return DESCRIPTION; \ } \ \ QIcon icon() const \ - { \ + override { \ return ICON; \ } \ \ ProviderConfigWidget *configWidget( const QVariantMap &config ) \ - { \ + override { \ return new ConfigWidget_T( config ); \ } \ \ protected: \ ImporterProviderPtr newInstance( const QVariantMap &config ) \ - { \ + override { \ return ImporterProviderPtr( new ImporterProvider_T( config, this ) ); \ } \ }; \ diff --git a/src/importers/amarok/AmarokConfigWidget.h b/src/importers/amarok/AmarokConfigWidget.h --- a/src/importers/amarok/AmarokConfigWidget.h +++ b/src/importers/amarok/AmarokConfigWidget.h @@ -28,11 +28,11 @@ Q_OBJECT public: - explicit AmarokConfigWidget( const QVariantMap &config, QWidget *parent = 0, - Qt::WindowFlags f = 0 ); + explicit AmarokConfigWidget( const QVariantMap &config, QWidget *parent = nullptr, + Qt::WindowFlags f = {} ); ~AmarokConfigWidget(); - QVariantMap config() const; + QVariantMap config() const override; enum ConnectionType { diff --git a/src/importers/amarok/AmarokEmbeddedSqlConnection.h b/src/importers/amarok/AmarokEmbeddedSqlConnection.h --- a/src/importers/amarok/AmarokEmbeddedSqlConnection.h +++ b/src/importers/amarok/AmarokEmbeddedSqlConnection.h @@ -37,7 +37,7 @@ ~AmarokEmbeddedSqlConnection(); protected: - QSqlDatabase connection(); + QSqlDatabase connection() override; private: bool startServer( const int port, const QString &socketPath, const QString &pidPath ); diff --git a/src/importers/amarok/AmarokEmbeddedSqlConnection.cpp b/src/importers/amarok/AmarokEmbeddedSqlConnection.cpp --- a/src/importers/amarok/AmarokEmbeddedSqlConnection.cpp +++ b/src/importers/amarok/AmarokEmbeddedSqlConnection.cpp @@ -144,7 +144,7 @@ << "--pid-file=" + pidPath; m_srv.start( m_mysqld.absoluteFilePath(), args ); - debug() << __PRETTY_FUNCTION__ << m_mysqld.absoluteFilePath() + " " + args.join(" "); + debug() << __PRETTY_FUNCTION__ << m_mysqld.absoluteFilePath() + ' ' + args.join(' '); // Wait for any of the startup conditions to be true loop.exec(); diff --git a/src/importers/amarok/AmarokManager.h b/src/importers/amarok/AmarokManager.h --- a/src/importers/amarok/AmarokManager.h +++ b/src/importers/amarok/AmarokManager.h @@ -31,14 +31,14 @@ public: AmarokManager(); - QString type() const; - QString prettyName() const; - QString description() const; - QIcon icon() const; - ProviderConfigWidget *configWidget( const QVariantMap &config ); + QString type() const override; + QString prettyName() const override; + QString description() const override; + QIcon icon() const override; + ProviderConfigWidget *configWidget( const QVariantMap &config ) override; protected: - virtual ImporterProviderPtr newInstance( const QVariantMap &config ); + ImporterProviderPtr newInstance( const QVariantMap &config ) override; }; } // namespace StatSyncing diff --git a/src/importers/amarok/AmarokManager.cpp b/src/importers/amarok/AmarokManager.cpp --- a/src/importers/amarok/AmarokManager.cpp +++ b/src/importers/amarok/AmarokManager.cpp @@ -30,7 +30,7 @@ QString AmarokManager::type() const { - return "AmarokImporter"; + return QStringLiteral("AmarokImporter"); } QString @@ -48,7 +48,7 @@ QIcon AmarokManager::icon() const { - return QIcon::fromTheme( "amarok" ); + return QIcon::fromTheme( QStringLiteral("amarok") ); } ProviderConfigWidget* diff --git a/src/importers/amarok/AmarokProvider.h b/src/importers/amarok/AmarokProvider.h --- a/src/importers/amarok/AmarokProvider.h +++ b/src/importers/amarok/AmarokProvider.h @@ -31,11 +31,11 @@ AmarokProvider( const QVariantMap &config, ImporterManager *importer ); ~AmarokProvider(); - qint64 reliableTrackMetaData() const; - qint64 writableTrackStatsData() const; + qint64 reliableTrackMetaData() const override; + qint64 writableTrackStatsData() const override; - QSet artists(); - TrackList artistTracks( const QString &artistName ); + QSet artists() override; + TrackList artistTracks( const QString &artistName ) override; private: ImporterSqlConnectionPtr m_connection; diff --git a/src/importers/amarok/AmarokTrack.h b/src/importers/amarok/AmarokTrack.h --- a/src/importers/amarok/AmarokTrack.h +++ b/src/importers/amarok/AmarokTrack.h @@ -35,7 +35,7 @@ ~AmarokTrack(); protected: - void doCommit( const qint64 fields ); + void doCommit( const qint64 fields ) override; private: const ImporterSqlConnectionPtr m_connection; diff --git a/src/importers/amarok/CMakeLists.txt b/src/importers/amarok/CMakeLists.txt --- a/src/importers/amarok/CMakeLists.txt +++ b/src/importers/amarok/CMakeLists.txt @@ -17,6 +17,6 @@ Qt5::Sql ) -install( TARGETS amarok_importer-amarok DESTINATION ${PLUGIN_INSTALL_DIR} ) +install( TARGETS amarok_importer-amarok DESTINATION ${KDE_INSTALL_PLUGINDIR} ) kcoreaddons_desktop_to_json(amarok_importer-amarok amarok_importer-amarok.desktop SERVICE_TYPES ${CMAKE_SOURCE_DIR}/src/amarok-plugin.desktop) diff --git a/src/importers/amarok/amarok_importer-amarok.desktop b/src/importers/amarok/amarok_importer-amarok.desktop --- a/src/importers/amarok/amarok_importer-amarok.desktop +++ b/src/importers/amarok/amarok_importer-amarok.desktop @@ -17,6 +17,7 @@ Name[hu]=Amarok 2.x importáló Name[id]=Pengimpor Amarok 2.x Name[it]=Importatore di Amarok 2.x +Name[ko]=Amarok 2.x 가져오기 도구 Name[nl]=Programma voor importeren van Amarok 2.x Name[pl]=Importowanie z Amaroka 2.x Name[pt]=Importação do Amarok 2.x @@ -50,6 +51,7 @@ Comment[hu]=Statisztikák importálása az Amarok 2.x adatbázisából Comment[id]=Impor statistik dari database Amarok 2.x Comment[it]=Importa le statistiche dal database di Amarok 2.x +Comment[ko]=Amarok 2.x 데이터베이스에서 통계 가져오기 Comment[nl]=Statistieken uit de Amarok 2.x database importeren Comment[pl]=Importowanie statystyk z bazy danych Amaroka 2.x Comment[pt]=Importa as estatísticas da base de dados do Amarok 2.x diff --git a/src/importers/banshee/BansheeConfigWidget.h b/src/importers/banshee/BansheeConfigWidget.h --- a/src/importers/banshee/BansheeConfigWidget.h +++ b/src/importers/banshee/BansheeConfigWidget.h @@ -25,8 +25,8 @@ class BansheeConfigWidget : public SimpleImporterConfigWidget { public: - explicit BansheeConfigWidget( const QVariantMap &config, QWidget *parent = 0, - Qt::WindowFlags f = 0 ); + explicit BansheeConfigWidget( const QVariantMap &config, QWidget *parent = nullptr, + Qt::WindowFlags f = {} ); ~BansheeConfigWidget(); }; diff --git a/src/importers/banshee/BansheeConfigWidget.cpp b/src/importers/banshee/BansheeConfigWidget.cpp --- a/src/importers/banshee/BansheeConfigWidget.cpp +++ b/src/importers/banshee/BansheeConfigWidget.cpp @@ -25,13 +25,13 @@ BansheeConfigWidget::BansheeConfigWidget( const QVariantMap &config, QWidget *parent, Qt::WindowFlags f ) - : SimpleImporterConfigWidget( "Banshee", config, parent, f ) + : SimpleImporterConfigWidget( QStringLiteral("Banshee"), config, parent, f ) { const QString defaultPath = QDir::toNativeSeparators( QDir::homePath() + "/.config/banshee-1/banshee.db" ); KUrlRequester *dbField = new KUrlRequester( QUrl::fromLocalFile(defaultPath) ); - dbField->setFilter( "banshee.db" ); + dbField->setFilter( QStringLiteral("banshee.db") ); addField( "dbPath", i18n( "Database location" ), dbField, "text" ); } diff --git a/src/importers/banshee/BansheeProvider.h b/src/importers/banshee/BansheeProvider.h --- a/src/importers/banshee/BansheeProvider.h +++ b/src/importers/banshee/BansheeProvider.h @@ -33,11 +33,11 @@ BansheeProvider( const QVariantMap &config, ImporterManager *importer ); ~BansheeProvider(); - qint64 reliableTrackMetaData() const; - qint64 writableTrackStatsData() const; + qint64 reliableTrackMetaData() const override; + qint64 writableTrackStatsData() const override; - QSet artists(); - TrackList artistTracks( const QString &artistName ); + QSet artists() override; + TrackList artistTracks( const QString &artistName ) override; private: const ImporterSqlConnectionPtr m_connection; diff --git a/src/importers/banshee/BansheeTrack.h b/src/importers/banshee/BansheeTrack.h --- a/src/importers/banshee/BansheeTrack.h +++ b/src/importers/banshee/BansheeTrack.h @@ -34,11 +34,11 @@ const Meta::FieldHash &metadata ); ~BansheeTrack(); - int rating() const; - void setRating( int rating ); + int rating() const override; + void setRating( int rating ) override; protected: - virtual void doCommit( const qint64 fields ); + void doCommit( const qint64 fields ) override; private: const ImporterSqlConnectionPtr m_connection; diff --git a/src/importers/banshee/CMakeLists.txt b/src/importers/banshee/CMakeLists.txt --- a/src/importers/banshee/CMakeLists.txt +++ b/src/importers/banshee/CMakeLists.txt @@ -14,6 +14,6 @@ Qt5::Sql ) -install( TARGETS amarok_importer-banshee DESTINATION ${PLUGIN_INSTALL_DIR} ) +install( TARGETS amarok_importer-banshee DESTINATION ${KDE_INSTALL_PLUGINDIR} ) kcoreaddons_desktop_to_json(amarok_importer-banshee amarok_importer-banshee.desktop SERVICE_TYPES ${CMAKE_SOURCE_DIR}/src/amarok-plugin.desktop) diff --git a/src/importers/banshee/amarok_importer-banshee.desktop b/src/importers/banshee/amarok_importer-banshee.desktop --- a/src/importers/banshee/amarok_importer-banshee.desktop +++ b/src/importers/banshee/amarok_importer-banshee.desktop @@ -17,6 +17,7 @@ Name[hu]=Banshee importáló Name[id]=Pengimpor Banshee Name[it]=Importatore di Banshee +Name[ko]=Banshee 가져오기 도구 Name[nl]=Programma voor importeren van Banshee Name[pl]=Importowanie z Banshee Name[pt]=Importação do Banshee @@ -48,8 +49,9 @@ Comment[fr]=Importe les statistiques de la base de données de Banshee Comment[gl]=Importar estatísticas da base de datos de Banshee. Comment[hu]=Statisztikák importálása a Banshee adatbázisából -Comment[id]=Import statistik dari database Banshee +Comment[id]=Impor statistik dari database Banshee Comment[it]=Importa le statistiche dal database di Banshee +Comment[ko]=Banshee 데이터베이스에서 통계 가져오기 Comment[nl]=Statistieken uit de Banshee database importeren Comment[pl]=Importowanie statystyk z bazy danych Banshee Comment[pt]=Importa as estatísticas da base de dados do Banshee diff --git a/src/importers/clementine/CMakeLists.txt b/src/importers/clementine/CMakeLists.txt --- a/src/importers/clementine/CMakeLists.txt +++ b/src/importers/clementine/CMakeLists.txt @@ -14,6 +14,6 @@ Qt5::Sql ) -install( TARGETS amarok_importer-clementine DESTINATION ${PLUGIN_INSTALL_DIR} ) +install( TARGETS amarok_importer-clementine DESTINATION ${KDE_INSTALL_PLUGINDIR} ) kcoreaddons_desktop_to_json(amarok_importer-clementine amarok_importer-clementine.desktop SERVICE_TYPES ${CMAKE_SOURCE_DIR}/src/amarok-plugin.desktop) diff --git a/src/importers/clementine/ClementineConfigWidget.h b/src/importers/clementine/ClementineConfigWidget.h --- a/src/importers/clementine/ClementineConfigWidget.h +++ b/src/importers/clementine/ClementineConfigWidget.h @@ -25,8 +25,8 @@ class ClementineConfigWidget : public SimpleImporterConfigWidget { public: - explicit ClementineConfigWidget( const QVariantMap &config, QWidget *parent = 0, - Qt::WindowFlags f = 0 ); + explicit ClementineConfigWidget( const QVariantMap &config, QWidget *parent = nullptr, + Qt::WindowFlags f = {} ); ~ClementineConfigWidget(); }; diff --git a/src/importers/clementine/ClementineConfigWidget.cpp b/src/importers/clementine/ClementineConfigWidget.cpp --- a/src/importers/clementine/ClementineConfigWidget.cpp +++ b/src/importers/clementine/ClementineConfigWidget.cpp @@ -25,13 +25,13 @@ ClementineConfigWidget::ClementineConfigWidget( const QVariantMap &config, QWidget *parent, Qt::WindowFlags f ) - : SimpleImporterConfigWidget( "Clementine", config, parent, f ) + : SimpleImporterConfigWidget( QStringLiteral("Clementine"), config, parent, f ) { const QString defaultPath = QDir::toNativeSeparators( - QDir::homePath() + "/.config/Clementine/clementine.db" ); + QDir::homePath() + QStringLiteral("/.config/Clementine/clementine.db") ); KUrlRequester *dbField = new KUrlRequester( QUrl::fromLocalFile(defaultPath) ); - dbField->setFilter( "clementine.db" ); + dbField->setFilter( QStringLiteral("clementine.db") ); addField( "dbPath", i18n( "Database location" ), dbField, "text" ); } diff --git a/src/importers/clementine/ClementineProvider.h b/src/importers/clementine/ClementineProvider.h --- a/src/importers/clementine/ClementineProvider.h +++ b/src/importers/clementine/ClementineProvider.h @@ -31,11 +31,11 @@ ClementineProvider( const QVariantMap &config, ImporterManager *importer ); ~ClementineProvider(); - qint64 reliableTrackMetaData() const; - qint64 writableTrackStatsData() const; + qint64 reliableTrackMetaData() const override; + qint64 writableTrackStatsData() const override; - QSet artists(); - TrackList artistTracks( const QString &artistName ); + QSet artists() override; + TrackList artistTracks( const QString &artistName ) override; private: const ImporterSqlConnectionPtr m_connection; diff --git a/src/importers/clementine/ClementineTrack.h b/src/importers/clementine/ClementineTrack.h --- a/src/importers/clementine/ClementineTrack.h +++ b/src/importers/clementine/ClementineTrack.h @@ -34,19 +34,19 @@ const Meta::FieldHash &metadata ); ~ClementineTrack(); - int year() const; - int trackNumber() const; - int discNumber() const; + int year() const override; + int trackNumber() const override; + int discNumber() const override; - QDateTime lastPlayed() const; - void setLastPlayed( const QDateTime &lastPlayed ); - int playCount() const; - void setPlayCount( int playCount ); - int rating() const; - void setRating( int rating ); + QDateTime lastPlayed() const override; + void setLastPlayed( const QDateTime &lastPlayed ) override; + int playCount() const override; + void setPlayCount( int playCount ) override; + int rating() const override; + void setRating( int rating ) override; protected: - void doCommit( const qint64 fields ); + void doCommit( const qint64 fields ) override; private: const ImporterSqlConnectionPtr m_connection; diff --git a/src/importers/clementine/amarok_importer-clementine.desktop b/src/importers/clementine/amarok_importer-clementine.desktop --- a/src/importers/clementine/amarok_importer-clementine.desktop +++ b/src/importers/clementine/amarok_importer-clementine.desktop @@ -17,6 +17,7 @@ Name[hu]=Clementine importáló Name[id]=Pengimpor Clementine Name[it]=Importatore di Clementine +Name[ko]=Clementine 가져오기 도구 Name[nl]=Programma voor importeren van Clementine Name[pl]=Importowanie z Clementine Name[pt]=Importação do Clementine @@ -50,6 +51,7 @@ Comment[hu]=Statisztikák importálása a Clementine adatbázisából Comment[id]=Import statistik dari database Clementine Comment[it]=Importa le statistiche dal database di Clementine +Comment[ko]=Clementine 데이터베이스에서 통계 가져오기 Comment[nl]=Statistieken uit de Clementine database importeren Comment[pl]=Importowanie statystyk z bazy danych Clementine Comment[pt]=Importa as estatísticas da base de dados do Clementine diff --git a/src/importers/fastforward/CMakeLists.txt b/src/importers/fastforward/CMakeLists.txt --- a/src/importers/fastforward/CMakeLists.txt +++ b/src/importers/fastforward/CMakeLists.txt @@ -16,6 +16,6 @@ Qt5::Sql ) -install( TARGETS amarok_importer-fastforward DESTINATION ${PLUGIN_INSTALL_DIR} ) +install( TARGETS amarok_importer-fastforward DESTINATION ${KDE_INSTALL_PLUGINDIR} ) kcoreaddons_desktop_to_json(amarok_importer-fastforward amarok_importer-fastforward.desktop SERVICE_TYPES ${CMAKE_SOURCE_DIR}/src/amarok-plugin.desktop) diff --git a/src/importers/fastforward/FastForwardConfigWidget.h b/src/importers/fastforward/FastForwardConfigWidget.h --- a/src/importers/fastforward/FastForwardConfigWidget.h +++ b/src/importers/fastforward/FastForwardConfigWidget.h @@ -27,21 +27,21 @@ public Ui::FastForwardConfigWidget { Q_OBJECT - Q_ENUMS( Driver ) public: - explicit FastForwardConfigWidget( const QVariantMap &config, QWidget *parent = 0, - Qt::WindowFlags f = 0 ); + explicit FastForwardConfigWidget( const QVariantMap &config, QWidget *parent = nullptr, + Qt::WindowFlags f = {} ); ~FastForwardConfigWidget(); - QVariantMap config() const; + QVariantMap config() const override; enum Driver { QMYSQL, QPSQL, QSQLITE }; + Q_ENUM( Driver ) private: void populateFields(); diff --git a/src/importers/fastforward/FastForwardConfigWidget.cpp b/src/importers/fastforward/FastForwardConfigWidget.cpp --- a/src/importers/fastforward/FastForwardConfigWidget.cpp +++ b/src/importers/fastforward/FastForwardConfigWidget.cpp @@ -100,7 +100,7 @@ m_connectionType->setCurrentIndex( index ); const QString defaultPath = QDir::toNativeSeparators( - QDir::homePath() + "/.kde/share/apps/amarok/collection.db" ); + QDir::homePath() + QStringLiteral("/.kde/share/apps/amarok/collection.db") ); m_databaseLocation->setText( m_config.value( "dbPath", defaultPath ).toString() ); m_databaseName->setText( m_config.value( "dbName", "amarokdb" ).toString() ); diff --git a/src/importers/fastforward/FastForwardManager.cpp b/src/importers/fastforward/FastForwardManager.cpp --- a/src/importers/fastforward/FastForwardManager.cpp +++ b/src/importers/fastforward/FastForwardManager.cpp @@ -24,7 +24,7 @@ "FastForwardImporter", i18n( "Amarok 1.4 (FastForward)" ), i18n( "Amarok 1.4 Statistics Importer" ), - QIcon::fromTheme( "amarok" ), + QIcon::fromTheme( QStringLiteral("amarok") ), StatSyncing::FastForwardConfigWidget, StatSyncing::FastForwardProvider ) diff --git a/src/importers/fastforward/FastForwardProvider.h b/src/importers/fastforward/FastForwardProvider.h --- a/src/importers/fastforward/FastForwardProvider.h +++ b/src/importers/fastforward/FastForwardProvider.h @@ -31,11 +31,11 @@ FastForwardProvider( const QVariantMap &config, ImporterManager *importer ); ~FastForwardProvider(); - qint64 reliableTrackMetaData() const; - qint64 writableTrackStatsData() const; + qint64 reliableTrackMetaData() const override; + qint64 writableTrackStatsData() const override; - QSet artists(); - TrackList artistTracks( const QString &artistName ); + QSet artists() override; + TrackList artistTracks( const QString &artistName ) override; private: ImporterSqlConnectionPtr m_connection; diff --git a/src/importers/fastforward/FastForwardTrack.h b/src/importers/fastforward/FastForwardTrack.h --- a/src/importers/fastforward/FastForwardTrack.h +++ b/src/importers/fastforward/FastForwardTrack.h @@ -30,12 +30,12 @@ class FastForwardTrack : public SimpleWritableTrack { public: - FastForwardTrack( const QString &trackUrl, const ImporterSqlConnectionPtr &connection, - const Meta::FieldHash &metadata, const QSet labels ); - ~FastForwardTrack(); + FastForwardTrack(const QString &trackUrl, const ImporterSqlConnectionPtr &connection, + const Meta::FieldHash &metadata, const QSet &labels ); + ~FastForwardTrack() override; protected: - void doCommit( const qint64 fields ); + void doCommit( const qint64 fields ) override; private: const ImporterSqlConnectionPtr m_connection; diff --git a/src/importers/fastforward/FastForwardTrack.cpp b/src/importers/fastforward/FastForwardTrack.cpp --- a/src/importers/fastforward/FastForwardTrack.cpp +++ b/src/importers/fastforward/FastForwardTrack.cpp @@ -24,7 +24,7 @@ FastForwardTrack::FastForwardTrack( const QString &trackUrl, const ImporterSqlConnectionPtr &connection, const Meta::FieldHash &metadata, - const QSet labels ) + const QSet &labels ) : SimpleWritableTrack( metadata, labels ) , m_connection( connection ) , m_trackUrl( trackUrl ) @@ -60,22 +60,22 @@ if( fields & Meta::valFirstPlayed ) { - updates << "createdate = :createdate"; + updates << QStringLiteral("createdate = :createdate"); uBindValues.insert( ":createdate", m_statistics.value( Meta::valFirstPlayed ) ); } if( fields & Meta::valLastPlayed ) { - updates << "accessdate = :accessdate"; + updates << QStringLiteral("accessdate = :accessdate"); uBindValues.insert( ":accessdate", m_statistics.value( Meta::valLastPlayed ) ); } if( fields & Meta::valRating ) { - updates << "rating = :rating"; + updates << QStringLiteral("rating = :rating"); uBindValues.insert( ":rating", m_statistics.value( Meta::valRating ) ); } if( fields & Meta::valPlaycount ) { - updates << "playcounter = :playcount"; + updates << QStringLiteral("playcounter = :playcount"); uBindValues.insert( ":playcount", m_statistics.value( Meta::valPlaycount ) ); } diff --git a/src/importers/fastforward/amarok_importer-fastforward.desktop b/src/importers/fastforward/amarok_importer-fastforward.desktop --- a/src/importers/fastforward/amarok_importer-fastforward.desktop +++ b/src/importers/fastforward/amarok_importer-fastforward.desktop @@ -17,6 +17,7 @@ Name[hu]=Amarok 1.4 (FastForward) importáló Name[id]=Pengimpor Amarok 1.4 (FastForward) Name[it]=Importatore di Amarok 1.4 (FastForward) +Name[ko]=Amarok 1.4 (FastForward) 가져오기 도구 Name[nl]=Programma voor importeren van Amarok 1.4 (snel vooruit) Name[pl]=Importowanie z Amaroka 1.4 (FastForward) Name[pt]=Importação do Amarok 1.4 (FastForward) @@ -50,6 +51,7 @@ Comment[hu]=Statisztikák importálása az Amarok 1.4 adatbázisából Comment[id]=Impor statistik dari database Amarok 1.4 Comment[it]=Importa le statistiche dal database di Amarok 1.4 +Comment[ko]=Amarok 1.4 데이터베이스에서 통계 가져오기 Comment[nl]=Statistieken uit de Amarok 1.4 database importeren Comment[pl]=Importowanie statystyk z bazy danych Amaroka 1.4 Comment[pt]=Importa as estatísticas da base de dados do Amarok 1.4 diff --git a/src/importers/itunes/CMakeLists.txt b/src/importers/itunes/CMakeLists.txt --- a/src/importers/itunes/CMakeLists.txt +++ b/src/importers/itunes/CMakeLists.txt @@ -13,6 +13,6 @@ KF5::KIOCore ) -install( TARGETS amarok_importer-itunes DESTINATION ${PLUGIN_INSTALL_DIR} ) +install( TARGETS amarok_importer-itunes DESTINATION ${KDE_INSTALL_PLUGINDIR} ) kcoreaddons_desktop_to_json(amarok_importer-itunes amarok_importer-itunes.desktop SERVICE_TYPES ${CMAKE_SOURCE_DIR}/src/amarok-plugin.desktop) diff --git a/src/importers/itunes/ITunesConfigWidget.h b/src/importers/itunes/ITunesConfigWidget.h --- a/src/importers/itunes/ITunesConfigWidget.h +++ b/src/importers/itunes/ITunesConfigWidget.h @@ -25,8 +25,8 @@ class ITunesConfigWidget : public SimpleImporterConfigWidget { public: - explicit ITunesConfigWidget( const QVariantMap &config, QWidget *parent = 0, - Qt::WindowFlags f = 0 ); + explicit ITunesConfigWidget( const QVariantMap &config, QWidget *parent = nullptr, + Qt::WindowFlags f = {} ); ~ITunesConfigWidget(); }; diff --git a/src/importers/itunes/ITunesConfigWidget.cpp b/src/importers/itunes/ITunesConfigWidget.cpp --- a/src/importers/itunes/ITunesConfigWidget.cpp +++ b/src/importers/itunes/ITunesConfigWidget.cpp @@ -23,10 +23,10 @@ ITunesConfigWidget::ITunesConfigWidget( const QVariantMap &config, QWidget *parent, Qt::WindowFlags f ) - : SimpleImporterConfigWidget( "iTunes", config, parent, f ) + : SimpleImporterConfigWidget( QStringLiteral("iTunes"), config, parent, f ) { KUrlRequester *dbField = new KUrlRequester; - dbField->setFilter( "iTunes Music Library.xml" ); + dbField->setFilter( QStringLiteral("iTunes Music Library.xml") ); addField( "dbPath", i18n( "Database location" ), dbField, "text" ); } diff --git a/src/importers/itunes/ITunesProvider.h b/src/importers/itunes/ITunesProvider.h --- a/src/importers/itunes/ITunesProvider.h +++ b/src/importers/itunes/ITunesProvider.h @@ -37,12 +37,12 @@ ITunesProvider( const QVariantMap &config, ImporterManager *importer ); ~ITunesProvider(); - qint64 reliableTrackMetaData() const; - qint64 writableTrackStatsData() const; - QSet artists(); - TrackList artistTracks( const QString &artistName ); + qint64 reliableTrackMetaData() const override; + qint64 writableTrackStatsData() const override; + QSet artists() override; + TrackList artistTracks( const QString &artistName ) override; - void commitTracks(); + void commitTracks() override; private: void readXml( const QString &byArtist ); diff --git a/src/importers/itunes/ITunesTrack.h b/src/importers/itunes/ITunesTrack.h --- a/src/importers/itunes/ITunesTrack.h +++ b/src/importers/itunes/ITunesTrack.h @@ -32,15 +32,15 @@ explicit ITunesTrack( const int trackId, const Meta::FieldHash &metadata ); ~ITunesTrack(); - int rating() const; - void setRating( int rating ); - QDateTime lastPlayed() const; + int rating() const override; + void setRating( int rating ) override; + QDateTime lastPlayed() const override; Q_SIGNALS: void commitCalled( const int trackId, const Meta::FieldHash &statistics ); protected: - void doCommit( const qint64 changes ); + void doCommit( const qint64 changes ) override; private: const int m_trackId; diff --git a/src/importers/itunes/ITunesTrack.cpp b/src/importers/itunes/ITunesTrack.cpp --- a/src/importers/itunes/ITunesTrack.cpp +++ b/src/importers/itunes/ITunesTrack.cpp @@ -64,5 +64,5 @@ ITunesTrack::doCommit( const qint64 changes ) { Q_UNUSED( changes ); - emit commitCalled( m_trackId, m_statistics ); + Q_EMIT commitCalled( m_trackId, m_statistics ); } diff --git a/src/importers/itunes/amarok_importer-itunes.desktop b/src/importers/itunes/amarok_importer-itunes.desktop --- a/src/importers/itunes/amarok_importer-itunes.desktop +++ b/src/importers/itunes/amarok_importer-itunes.desktop @@ -17,6 +17,7 @@ Name[hu]=Apple iTunes importáló Name[id]=Pengimpor Apple iTunes Name[it]=Importatore di Apple iTunes +Name[ko]=Apple iTunes 가져오기 도구 Name[nl]=Programma voor importeren van iTunes Name[pl]=Importowanie z iTunes Name[pt]=Importação do Apple iTunes @@ -50,6 +51,7 @@ Comment[hu]=Statisztikák importálása az Apple iTunes adatbázisából Comment[id]=Impor statistik dari database Apple iTunes Comment[it]=Importa le statistiche dal database di Apple iTunes +Comment[ko]=Apple iTunes 데이터베이스에서 통계 가져오기 Comment[nl]=Statistieken uit de Apple iTunes database importeren Comment[pl]=Importowanie statystyk z bazy danych Apple iTunes Comment[pt]=Importa as estatísticas da base de dados do iTunes da Apple diff --git a/src/importers/rhythmbox/CMakeLists.txt b/src/importers/rhythmbox/CMakeLists.txt --- a/src/importers/rhythmbox/CMakeLists.txt +++ b/src/importers/rhythmbox/CMakeLists.txt @@ -13,6 +13,6 @@ KF5::KIOCore ) -install( TARGETS amarok_importer-rhythmbox DESTINATION ${PLUGIN_INSTALL_DIR} ) +install( TARGETS amarok_importer-rhythmbox DESTINATION ${KDE_INSTALL_PLUGINDIR} ) kcoreaddons_desktop_to_json(amarok_importer-rhythmbox amarok_importer-rhythmbox.desktop SERVICE_TYPES ${CMAKE_SOURCE_DIR}/src/amarok-plugin.desktop) diff --git a/src/importers/rhythmbox/RhythmboxConfigWidget.h b/src/importers/rhythmbox/RhythmboxConfigWidget.h --- a/src/importers/rhythmbox/RhythmboxConfigWidget.h +++ b/src/importers/rhythmbox/RhythmboxConfigWidget.h @@ -25,8 +25,8 @@ class RhythmboxConfigWidget : public SimpleImporterConfigWidget { public: - explicit RhythmboxConfigWidget( const QVariantMap &config, QWidget *parent = 0, - Qt::WindowFlags f = 0 ); + explicit RhythmboxConfigWidget( const QVariantMap &config, QWidget *parent = nullptr, + Qt::WindowFlags f = {} ); ~RhythmboxConfigWidget(); }; diff --git a/src/importers/rhythmbox/RhythmboxProvider.h b/src/importers/rhythmbox/RhythmboxProvider.h --- a/src/importers/rhythmbox/RhythmboxProvider.h +++ b/src/importers/rhythmbox/RhythmboxProvider.h @@ -37,12 +37,12 @@ RhythmboxProvider( const QVariantMap &config, ImporterManager *importer ); ~RhythmboxProvider(); - qint64 reliableTrackMetaData() const; - qint64 writableTrackStatsData() const; - QSet artists(); - TrackList artistTracks( const QString &artistName ); + qint64 reliableTrackMetaData() const override; + qint64 writableTrackStatsData() const override; + QSet artists() override; + TrackList artistTracks( const QString &artistName ) override; - void commitTracks(); + void commitTracks() override; private: void readXml( const QString &byArtist ); diff --git a/src/importers/rhythmbox/RhythmboxTrack.h b/src/importers/rhythmbox/RhythmboxTrack.h --- a/src/importers/rhythmbox/RhythmboxTrack.h +++ b/src/importers/rhythmbox/RhythmboxTrack.h @@ -31,11 +31,11 @@ RhythmboxTrack( const QString &location, const Meta::FieldHash &metadata ); ~RhythmboxTrack(); - int rating() const; - void setRating( int rating ); + int rating() const override; + void setRating( int rating ) override; protected: - void doCommit( const qint64 fields ); + void doCommit( const qint64 fields ) override; Q_SIGNALS: void commitCalled( const QString &location, const Meta::FieldHash &statistics ); diff --git a/src/importers/rhythmbox/RhythmboxTrack.cpp b/src/importers/rhythmbox/RhythmboxTrack.cpp --- a/src/importers/rhythmbox/RhythmboxTrack.cpp +++ b/src/importers/rhythmbox/RhythmboxTrack.cpp @@ -44,5 +44,5 @@ RhythmboxTrack::doCommit( const qint64 fields ) { Q_UNUSED( fields ); - emit commitCalled( m_location, m_statistics ); + Q_EMIT commitCalled( m_location, m_statistics ); } diff --git a/src/importers/rhythmbox/amarok_importer-rhythmbox.desktop b/src/importers/rhythmbox/amarok_importer-rhythmbox.desktop --- a/src/importers/rhythmbox/amarok_importer-rhythmbox.desktop +++ b/src/importers/rhythmbox/amarok_importer-rhythmbox.desktop @@ -17,6 +17,7 @@ Name[hu]=Rhythmbox importáló Name[id]=Pengimpor Rhythmbox Name[it]=Importatore di Rhythmbox +Name[ko]=리듬박스 가져오기 도구 Name[nl]=Programma voor importeren van Rhythmbox Name[pl]=Importowanie z Rhythmboksa Name[pt]=Importação do Rhythmbox @@ -50,6 +51,7 @@ Comment[hu]=Statisztikák importálása a Rhythmbox adatbázisából Comment[id]=Impor statistik dari database Rhythmbox Comment[it]=Importa le statistiche dal database di Rhythmbox +Comment[ko]=리듬박스 데이터베이스에서 통계 가져오기 Comment[nl]=Statistieken uit de Rhythmbox database importeren Comment[pl]=Importowanie statystyk z bazy danych Rhythmboksa Comment[pt]=Importa as estatísticas da base de dados do Rhythmbox diff --git a/src/kconf_update/CMakeLists.txt b/src/kconf_update/CMakeLists.txt --- a/src/kconf_update/CMakeLists.txt +++ b/src/kconf_update/CMakeLists.txt @@ -1,5 +1,5 @@ -install( FILES amarok.upd DESTINATION ${KCONF_UPDATE_INSTALL_DIR} ) +install( FILES amarok.upd DESTINATION ${KDE_INSTALL_KCONFUPDATEDIR} ) install( PROGRAMS amarok-2.4.1-tokens_syntax_update.pl - DESTINATION ${KCONF_UPDATE_INSTALL_DIR} + DESTINATION ${KDE_INSTALL_KCONFUPDATEDIR} ) diff --git a/src/services/lastfm/AvatarDownloader.h b/src/lyrics/LyricsManager.h copy from src/services/lastfm/AvatarDownloader.h copy to src/lyrics/LyricsManager.h --- a/src/services/lastfm/AvatarDownloader.h +++ b/src/lyrics/LyricsManager.h @@ -1,5 +1,5 @@ /**************************************************************************************** - * Copyright (c) 2008 Casey Link * + * Copyright (c) 2007 Leo Franchi * * * * This program is free software; you can redistribute it and/or modify it under * * the terms of the GNU General Public License as published by the Free Software * @@ -14,48 +14,60 @@ * this program. If not, see . * ****************************************************************************************/ -#ifndef AVATAR_DOWNLOADER_H -#define AVATAR_DOWNLOADER_H +#ifndef LYRICS_MANAGER_H +#define LYRICS_MANAGER_H +#include "amarok_export.h" +#include "core/meta/Meta.h" #include "network/NetworkAccessManagerProxy.h" -#include -#include -#include +#include +#include +#include +#include -class AvatarDownloader : public QObject + +class AMAROK_EXPORT LyricsManager : public QObject { Q_OBJECT public: + static LyricsManager* instance() + { + if( !s_self ) + s_self = new LyricsManager(); - /** - * Constructor. - */ - AvatarDownloader(); + return s_self; + } /** - * Destructor. - */ - ~AvatarDownloader(); + * Tests if the given lyrics are empty. + * + * @param lyrics The lyrics which will be tested. + * + * @return true if the given lyrics are empty, otherwise false. + */ + bool isEmpty( const QString &lyrics ) const; - /** - * Start the download - * @param url The url that should be downloaded. - */ - void downloadAvatar( const QString& username, const QUrl &url ); + void newTrack( const Meta::TrackPtr &track ); + void lyricsResult( const QByteArray& lyrics, Meta::TrackPtr track ); + void lyricsLoaded( const QUrl &url, const QByteArray &data, const NetworkAccessManagerProxy::Error &err ); + void loadLyrics( Meta::TrackPtr track, bool overwrite = false ); Q_SIGNALS: - void avatarDownloaded( const QString &username, QPixmap avatar ); - - private Q_SLOTS: - /** - * Slot called when the network access manager finished a request - */ - void downloaded( const QUrl &url, QByteArray data, NetworkAccessManagerProxy::Error e ); + void newLyrics( Meta::TrackPtr ); + void newSuggestions( const QVariantList& ); + void error( const QString &); private: - QHash m_userAvatarUrls; + LyricsManager(); + + void sanitizeTitle( QString &title ); + void sanitizeArtist( QString &artist ); + + static LyricsManager* s_self; + + QMap m_trackMap; }; #endif diff --git a/src/lyrics/LyricsManager.cpp b/src/lyrics/LyricsManager.cpp new file mode 100644 --- /dev/null +++ b/src/lyrics/LyricsManager.cpp @@ -0,0 +1,275 @@ +/**************************************************************************************** + * Copyright (c) 2007 Leo Franchi * + * Copyright (c) 2009 Seb Ruiz * + * * + * This program is free software; you can redistribute it and/or modify it under * + * the terms of the GNU General Public License as published by the Free Software * + * Foundation; either version 2 of the License, or (at your option) any later * + * version. * + * * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY * + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * + * PARTICULAR PURPOSE. See the GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License along with * + * this program. If not, see . * + ****************************************************************************************/ + +#define DEBUG_PREFIX "LyricsManager" + +#include "LyricsManager.h" + +#include "EngineController.h" +#include "core/meta/Meta.h" +#include "core/support/Debug.h" +#include "core-impl/collections/support/CollectionManager.h" + +#include +#include +#include + +#include + + +#define APIURL "http://lyrics.wikia.com/api.php?action=query&prop=revisions&rvprop=content&format=xml&titles=" + + +LyricsManager* LyricsManager::s_self = nullptr; + +LyricsManager::LyricsManager() +{ + s_self = this; + connect( The::engineController(), &EngineController::trackChanged, this, &LyricsManager::newTrack ); +} + +void +LyricsManager::newTrack( const Meta::TrackPtr &track ) +{ + loadLyrics( track ); +} + +void +LyricsManager::lyricsResult( const QByteArray& lyricsXML, Meta::TrackPtr track ) //SLOT +{ + DEBUG_BLOCK + + QXmlStreamReader xml( lyricsXML ); + while( !xml.atEnd() ) + { + xml.readNext(); + + if( xml.name() == QStringLiteral("lyric") || xml.name() == QStringLiteral( "lyrics" ) ) + { + QString lyrics( xml.readElementText() ); + if( !isEmpty( lyrics ) ) + { + // overwrite cached lyrics (as either there were no lyrics available previously OR + // the user explicitly agreed to overwrite the lyrics) + debug() << "setting cached lyrics..."; + track->setCachedLyrics( lyrics ); // TODO: setLyricsByPath? + Q_EMIT newLyrics( track ); + } + else + { + ::error() << i18n("Retrieved lyrics is empty"); + return; + } + } + else if( xml.name() == QLatin1String("suggestions") ) + { + QVariantList suggestions; + while( xml.readNextStartElement() ) + { + if( xml.name() != QLatin1String("suggestion") ) + continue; + + const QXmlStreamAttributes &a = xml.attributes(); + + QString artist = a.value( QLatin1String("artist") ).toString(); + QString title = a.value( QLatin1String("title") ).toString(); + QString url = a.value( QLatin1String("url") ).toString(); + + if( !url.isEmpty() ) + suggestions << ( QStringList() << title << artist << url ); + + xml.skipCurrentElement(); + } + + debug() << "got" << suggestions.size() << "suggestions"; + + if( !suggestions.isEmpty() ) + Q_EMIT newSuggestions( suggestions ); + + return; + } + } + + if( xml.hasError() ) + { + warning() << "errors occurred during reading lyrics xml result:" << xml.errorString(); + Q_EMIT error( i18n("Lyrics data could not be parsed") ); + } +} + +void LyricsManager::loadLyrics( Meta::TrackPtr track, bool overwrite ) +{ + DEBUG_BLOCK + + if( !track ) + { + debug() << "no current track"; + return; + } + + // -- get current title and artist + QString title = track->name(); + QString artist = track->artist() ? track->artist()->name() : QString(); + + sanitizeTitle( title ); + sanitizeArtist( artist ); + + if( !isEmpty( track->cachedLyrics() ) && !overwrite ) + { + debug() << "Lyrics already cached."; + return; + } + + QUrl url( APIURL + artist + QLatin1Char(':') + title ); + m_trackMap.insert( url, track ); + NetworkAccessManagerProxy::instance()->getData( url, this, &LyricsManager::lyricsLoaded ); +} + +void LyricsManager::lyricsLoaded( const QUrl& url, const QByteArray& data, const NetworkAccessManagerProxy::Error &err ) +{ + DEBUG_BLOCK + + if( err.code ) + { + warning() << "A network error occurred:" << err.description; + return; + } + + Meta::TrackPtr track = m_trackMap.take( url ); + if( !track ) + { + warning() << "No track belongs to this url:" << url.url(); + return; + } + + QDomDocument document; + document.setContent( data ); + auto list = document.elementsByTagName( QStringLiteral( "rev" ) ); + if( list.isEmpty() ) + { + if( track->album() && track->album()->albumArtist() ) + { + QString albumArtist = track->album()->albumArtist()->name(); + QString artist = track->artist() ? track->artist()->name() : QString(); + QString title = track->name(); + sanitizeTitle( title ); + sanitizeArtist( artist ); + sanitizeArtist( albumArtist ); + + //Try with album artist + if( url == QUrl( APIURL + artist + QLatin1Char(':') + title ) && albumArtist != artist ) + { + debug() << "Try again with album artist."; + + QUrl newUrl( APIURL + albumArtist + QLatin1Char(':') + title ); + m_trackMap.insert( newUrl, track ); + NetworkAccessManagerProxy::instance()->getData( newUrl, this, &LyricsManager::lyricsLoaded ); + return; + } + } + + debug() << "No lyrics found for track:" << track->name(); + return; + } + + QString rev = list.at( 0 ).toElement().text(); + if( rev.contains( QStringLiteral( "lyrics" ) ) ) + { + int lindex = rev.indexOf( QStringLiteral( "" ) ); + int rindex = rev.indexOf( QStringLiteral( "" ) ); + lyricsResult( (rev.mid( lindex, rindex - lindex ) + "" ).toUtf8(), track ); + } + else if( rev.contains( QStringLiteral( "lyric" ) ) ) + { + int lindex = rev.indexOf( QStringLiteral( "" ) ); + int rindex = rev.indexOf( QStringLiteral( "" ) ); + lyricsResult( (rev.mid( lindex, rindex - lindex ) + "" ).toUtf8(), track ); + } + else if( rev.contains( QStringLiteral( "#REDIRECT" ) ) ) + { + debug() << "Redirect:" << data; + + int lindex = rev.indexOf( QStringLiteral( "#REDIRECT [[" ) ) + 12; + int rindex = rev.indexOf( QStringLiteral( "]]" ) ); + QStringList list = rev.mid( lindex, rindex - lindex ).split( QLatin1Char(':') ); + if( list.size() == 2 ) + { + list[0] = list[0].replace( '&', QStringLiteral( "%26" ) ); + list[1] = list[1].replace( '&', QStringLiteral( "%26" ) ); + QUrl newUrl( APIURL + list.join( QLatin1Char(':') ) ); + m_trackMap.insert( newUrl, track ); + NetworkAccessManagerProxy::instance()->getData( newUrl, this, &LyricsManager::lyricsLoaded ); + } + } + else + warning() << "No lyrics found in data:" << data; +} + +void LyricsManager::sanitizeTitle( QString& title ) +{ + const QString magnatunePreviewString = QStringLiteral( "PREVIEW: buy it at www.magnatune.com" ); + + if( title.contains(magnatunePreviewString, Qt::CaseSensitive) ) + title = title.remove( " (" + magnatunePreviewString + ')' ); + + title = title.remove( QStringLiteral( "(Live)" ) ); + title = title.remove( QStringLiteral( "(live)" ) ); + title = title.replace( '`', QStringLiteral( "'" ) ); + title = title.replace( '&', QStringLiteral( "%26" ) ); +} + +void LyricsManager::sanitizeArtist( QString& artist ) +{ + const QString magnatunePreviewString = QStringLiteral( "PREVIEW: buy it at www.magnatune.com" ); + + if( artist.contains(magnatunePreviewString, Qt::CaseSensitive) ) + artist = artist.remove( " (" + magnatunePreviewString + ')' ); + + // strip "featuring " from the artist + int strip = artist.toLower().indexOf( QLatin1String(" ft. ")); + if ( strip != -1 ) + artist = artist.mid( 0, strip ); + + strip = artist.toLower().indexOf( QLatin1String(" feat. ") ); + if ( strip != -1 ) + artist = artist.mid( 0, strip ); + + strip = artist.toLower().indexOf( QLatin1String(" featuring ") ); + if ( strip != -1 ) + artist = artist.mid( 0, strip ); + + artist = artist.replace( '`', QStringLiteral( "'" ) ); + artist = artist.replace( '&', QStringLiteral( "%26" ) ); +} + +bool LyricsManager::isEmpty( const QString &lyrics ) const +{ + QTextEdit testItem; + + // Set the text of the TextItem. + if( Qt::mightBeRichText( lyrics ) ) + testItem.setHtml( lyrics ); + else + testItem.setPlainText( lyrics ); + + // Get the plaintext content. + // We use toPlainText() to strip all Html formatting, + // so we can test if there's any text given. + QString testText = testItem.toPlainText().trimmed(); + + return testText.isEmpty(); +} diff --git a/src/main.cpp b/src/main.cpp --- a/src/main.cpp +++ b/src/main.cpp @@ -20,14 +20,23 @@ #include "aboutdialog/OcsData.h" #include +#include #include +#include +#include + #include #include +#include #include +#ifdef WITH_QT_WEBENGINE +#include +#endif + #ifdef Q_WS_X11 - #include +#include #endif #include @@ -39,254 +48,291 @@ int main( int argc, char *argv[] ) { App app(argc, argv); + +#ifdef WITH_QT_WEBENGINE + QtWebEngine::initialize(); +#endif + app.setApplicationDisplayName(i18n("Amarok")); QCoreApplication::setApplicationName("amarok"); QCoreApplication::setOrganizationDomain("kde.org"); QCoreApplication::setApplicationVersion(AMAROK_VERSION); + KCrash::initialize(); + + Kdelibs4ConfigMigrator configMigrator(QStringLiteral("amarok")); + configMigrator.setConfigFiles(QStringList() + << QStringLiteral("amarokrc") + << QStringLiteral("amarok_homerc") + << QStringLiteral("amarok-appletsrc") + ); + configMigrator.migrate(); + + if (configMigrator.migrate()) { + Kdelibs4Migration dataMigrator; + const QString sourceBasePath = dataMigrator.saveLocation("data", QStringLiteral("amarok")); + const QString targetBasePath = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QStringLiteral("/amarok/"); + QString targetFilePath; + + QDir sourceDir(sourceBasePath); + QDir targetDir(targetBasePath); + + if (sourceDir.exists()) { + if (!targetDir.exists()) { + QDir().mkpath(targetBasePath); + } + QStringList fileNames = sourceDir.entryList( + QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot | QDir::NoSymLinks); + foreach (const QString &fileName, fileNames) { + targetFilePath = targetBasePath + fileName; + if (!QFile::exists(targetFilePath)) { + QFile::copy(sourceBasePath + fileName, targetFilePath); + } + } + } + } + KAboutData aboutData( "amarok", - ki18n( "Amarok" ).toString(), - AMAROK_VERSION, - ki18n( "The audio player by KDE" ).toString(), - KAboutLicense::GPL, - ki18n( "(C) 2002-2003, Mark Kretschmann\n(C) 2003-2013, The Amarok Development Squad" ).toString(), - ki18n( "IRC:\nirc.freenode.net - #amarok, #amarok.de, #amarok.es, #amarok.fr\n\nFeedback:\namarok@kde.org\n\n(Build Date: %1)" ).subs( __DATE__ ).toString(), - ( "http://amarok.kde.org" ) ); + i18n( "Amarok" ), + AMAROK_VERSION, + i18n( "The audio player by KDE" ), + KAboutLicense::GPL, + i18n( "(C) 2002-2003, Mark Kretschmann\n(C) 2003-2013, The Amarok Development Squad" ), + ki18n( "IRC:\nirc.freenode.net - #amarok, #amarok.de, #amarok.es, #amarok.fr\n\nFeedback:\namarok@kde.org\n\n(Build Date: %1)" ).subs( __DATE__ ).toString(), + ( "http://amarok.kde.org" ) ); //------------ About data ---------------------- //Currently active Authors extern OcsData ocsData; - aboutData.addAuthor( ki18n("Bart 'Where are my toothpicks' Cerneels").toString(), - ki18n("Developer (Stecchino)").toString(), "bart.cerneels@kde.org", "http://commonideas.blogspot.com" ); + aboutData.addAuthor( i18n("Bart 'Where are my toothpicks' Cerneels"), + i18n("Developer (Stecchino)"), "bart.cerneels@kde.org", "http://commonideas.blogspot.com" ); ocsData.addAuthor( "Stecchino", aboutData.authors().last() ); - aboutData.addAuthor( ki18n("Edward \"Hades\" Toroshchin").toString(), - ki18n("Developer (dr_lepper)").toString(), "edward.hades@gmail.com" ); + aboutData.addAuthor( i18n("Edward \"Hades\" Toroshchin"), + i18n("Developer (dr_lepper)"), "edward.hades@gmail.com" ); ocsData.addAuthor( "hadeschief", aboutData.authors().last() ); - aboutData.addAuthor( ki18n("Mark Kretschmann" ).toString(), - ki18n("Project founder (markey)").toString(), "kretschmann@kde.org", "https://plus.google.com/102602725322221030250/posts" ); - ocsData.addAuthor( "MarkKretschmann", aboutData.authors().last() ); + aboutData.addAuthor( i18n("Mark Kretschmann" ), + i18n("Project founder (markey)"), "kretschmann@kde.org", "https://plus.google.com/102602725322221030250/posts" ); + ocsData.addAuthor( "MarkKretschmann", aboutData.authors().last() ); - aboutData.addAuthor( ki18n("Matěj Laitl").toString(), - ki18n("iPod collection rewrite & more (strohel)").toString(), "matej@laitl.cz", "http://strohel.blogspot.com/" ); + aboutData.addAuthor( i18n("Matěj Laitl"), + i18n("iPod collection rewrite & more (strohel)"), "matej@laitl.cz", "http://strohel.blogspot.com/" ); ocsData.addAuthor( "strohel", aboutData.authors().last() ); - aboutData.addAuthor( ki18n("Myriam Schweingruber").toString(), ki18n("Rokymoter, Bug triaging (Mamarok)").toString(), "myriam@kde.org", "http://blogs.fsfe.org/myriam" ); + aboutData.addAuthor( i18n("Myriam Schweingruber"), i18n("Rokymoter, Bug triaging (Mamarok)"), "myriam@kde.org", "http://blogs.fsfe.org/myriam" ); ocsData.addAuthor( "Mamarok", aboutData.authors().last() ); - aboutData.addAuthor( ki18n("Ralf 'SalsaMaster' Engels").toString(), - ki18n("Developer (rengels)").toString(), "ralf.engels@nokia.com" ); + aboutData.addAuthor( i18n("Ralf 'SalsaMaster' Engels"), + i18n("Developer (rengels)"), "ralf.engels@nokia.com" ); ocsData.addAuthor( QString(), aboutData.authors().last() ); - aboutData.addAuthor( ki18n("Patrick von Reth").toString(), ki18n("Windows build (TheOneRing)").toString(), - "patrick.vonreth@gmail.com" ); + aboutData.addAuthor( i18n("Patrick von Reth"), i18n("Windows build (TheOneRing)"), + "patrick.vonreth@gmail.com" ); ocsData.addAuthor( QString(), aboutData.authors().last() ); - aboutData.addAuthor( ki18n("Rick W. Chen").toString(), - ki18n("Developer (stuffcorpse)").toString(), "stuffcorpse@archlinux.us" ); + aboutData.addAuthor( i18n("Rick W. Chen"), + i18n("Developer (stuffcorpse)"), "stuffcorpse@archlinux.us" ); ocsData.addAuthor( "stuffcorpse", aboutData.authors().last() ); - aboutData.addAuthor( ki18n("Sam Lade").toString(), ki18n("Developer (Sentynel)").toString(), - "sam@sentynel.com" ); + aboutData.addAuthor( i18n("Sam Lade"), i18n("Developer (Sentynel)"), + "sam@sentynel.com" ); ocsData.addAuthor( "Sentynel", aboutData.authors().last() ); - aboutData.addAuthor( ki18n("Sven Krohlas").toString(), ki18n("Rokymoter, Developer (sven423)").toString(), "sven@asbest-online.de" ); + aboutData.addAuthor( i18n("Sven Krohlas"), i18n("Rokymoter, Developer (sven423)"), "sven@asbest-online.de" ); ocsData.addAuthor( "krohlas", aboutData.authors().last() ); - aboutData.addAuthor( ki18n("Téo Mrnjavac").toString(), - ki18n("Developer (Teo`)").toString(), "teo@kde.org", "http://teom.wordpress.com/" ); + aboutData.addAuthor( i18n("Téo Mrnjavac"), + i18n("Developer (Teo`)"), "teo@kde.org", "http://teom.wordpress.com/" ); ocsData.addAuthor( "teom", aboutData.authors().last() ); - aboutData.addAuthor( ki18n("Valorie Zimmerman").toString(), - ki18n("Rokymoter, Handbook (valorie)").toString(), "valorie@kde.org" ); + aboutData.addAuthor( i18n("Valorie Zimmerman"), + i18n("Rokymoter, Handbook (valorie)"), "valorie@kde.org" ); ocsData.addAuthor( "valorie", aboutData.authors().last() ); //Inactive authors /* This list should contain people who still hold major copyright on the current code * For instance: does not include authors of 1.4 who have not contributed to 2.x */ - aboutData.addAuthor( ki18n("Inactive authors").toString(), - ki18n("Amarok authorship is not a hobby, it's a lifestyle. " + aboutData.addAuthor( i18n("Inactive authors"), + i18n("Amarok authorship is not a hobby, it's a lifestyle. " "But when people move on we want to keep respecting " - "them by mentioning them here:").toString(), "" ); - ocsData.addAuthor( "%%category%%", aboutData.authors().last() ); + "them by mentioning them here:"), "" ); + ocsData.addAuthor( "%%category%%", aboutData.authors().last() ); - aboutData.addAuthor( ki18n("Ian 'The Beard' Monroe").toString(), ki18n("Developer (eean)").toString(), "ian@monroe.nu" ); - ocsData.addAuthor( "eean", aboutData.authors().last() ); + aboutData.addAuthor( i18n("Ian 'The Beard' Monroe"), i18n("Developer (eean)"), "ian@monroe.nu" ); + ocsData.addAuthor( "eean", aboutData.authors().last() ); - aboutData.addAuthor( ki18n("Jeff 'IROKSOHARD' Mitchell").toString(), ki18n("Developer (jefferai)").toString(), "mitchell@kde.org" ); - ocsData.addAuthor( "jefferai", aboutData.authors().last() ); + aboutData.addAuthor( i18n("Jeff 'IROKSOHARD' Mitchell"), i18n("Developer (jefferai)"), "mitchell@kde.org" ); + ocsData.addAuthor( "jefferai", aboutData.authors().last() ); - aboutData.addAuthor( ki18n("Leo Franchi").toString(), ki18n("Developer (lfranchi)").toString(), "lfranchi@kde.org" ); - ocsData.addAuthor( "lfranchi", aboutData.authors().last() ); + aboutData.addAuthor( i18n("Leo Franchi"), i18n("Developer (lfranchi)"), "lfranchi@kde.org" ); + ocsData.addAuthor( "lfranchi", aboutData.authors().last() ); - aboutData.addAuthor( ki18n("Lydia 'is wrong(TM)' Pintscher").toString(), ki18n("Release Vixen (Nightrose)").toString(), "lydia@kde.org" ); - ocsData.addAuthor( "nightrose", aboutData.authors().last() ); + aboutData.addAuthor( i18n("Lydia 'is wrong(TM)' Pintscher"), i18n("Release Vixen (Nightrose)"), "lydia@kde.org" ); + ocsData.addAuthor( "nightrose", aboutData.authors().last() ); - aboutData.addCredit( ki18n("Max Howell").toString(), ki18n("Developer, Vision").toString(), "max.howell@methylblue.com" ); - ocsData.addCredit( QString(), aboutData.credits().last() ); + aboutData.addCredit( i18n("Max Howell"), i18n("Developer, Vision"), "max.howell@methylblue.com" ); + ocsData.addCredit( QString(), aboutData.credits().last() ); - aboutData.addAuthor( ki18n("Maximilian Kossick").toString(), ki18n("Developer (maxx_k)").toString(), "maximilian.kossick@gmail.com" ); - ocsData.addAuthor( QString(), aboutData.authors().last() ); + aboutData.addAuthor( i18n("Maximilian Kossick"), i18n("Developer (maxx_k)"), "maximilian.kossick@gmail.com" ); + ocsData.addAuthor( QString(), aboutData.authors().last() ); - aboutData.addAuthor( ki18n("Nikolaj Hald 'Also very hot' Nielsen").toString(), ki18n("Developer (nhn)").toString(), "nhn@kde.org" ); - ocsData.addAuthor( "nhnFreespirit", aboutData.authors().last() ); + aboutData.addAuthor( i18n("Nikolaj Hald 'Also very hot' Nielsen"), i18n("Developer (nhn)"), "nhn@kde.org" ); + ocsData.addAuthor( "nhnFreespirit", aboutData.authors().last() ); - aboutData.addCredit( ki18n("Seb 'Surfin' down under' Ruiz").toString(), ki18n("Developer (sebr)").toString(), "ruiz@kde.org" ); - ocsData.addCredit( "seb", aboutData.credits().last() ); + aboutData.addCredit( i18n("Seb 'Surfin' down under' Ruiz"), i18n("Developer (sebr)"), "ruiz@kde.org" ); + ocsData.addCredit( "seb", aboutData.credits().last() ); //Contributors - aboutData.addCredit( ki18n("Alejandro Wainzinger").toString(), ki18n("Developer (xevix)").toString(), "aikawarazuni@gmail.com" ); - ocsData.addCredit( "xevix", aboutData.credits().last() ); - aboutData.addCredit( ki18n("Alex Merry").toString(), ki18n("Developer, Replay Gain support").toString(), "kde@randomguy3.me.uk" ); - ocsData.addCredit( "randomguy3", aboutData.credits().last() ); - aboutData.addCredit( ki18n("Casey Link").toString(), ki18n("MP3tunes integration").toString(), "unnamedrambler@gmail.com" ); - ocsData.addCredit( "Ramblurr", aboutData.credits().last() ); - aboutData.addCredit( ki18n("Casper van Donderen").toString(), ki18n("Windows porting").toString(), "casper.vandonderen@gmail.com" ); - ocsData.addCredit( "cvandonderen", aboutData.credits().last() ); - aboutData.addCredit( ki18n("Christie Harris").toString(), ki18n("Rokymoter (dangle)").toString(), "dangle.baby@gmail.com" ); - ocsData.addCredit( "dangle", aboutData.credits().last() ); - aboutData.addCredit( ki18n("Dan Leinir Turthra Jensen").toString(), ki18n("Usability").toString(), "admin@leinir.dk" ); - ocsData.addCredit( "leinir", aboutData.credits().last() ); - aboutData.addCredit( ki18n("Dan 'Hey, it compiled...' Meltzer").toString(), ki18n("Developer (hydrogen)").toString(), "parallelgrapefruit@gmail.com" ); - ocsData.addCredit( QString(), aboutData.credits().last() ); - aboutData.addCredit( ki18n("Daniel Caleb Jones").toString(), ki18n("Biased playlists").toString(), "danielcjones@gmail.com" ); - ocsData.addCredit( QString(), aboutData.credits().last() ); - aboutData.addCredit( ki18n("Daniel Dewald").toString(), ki18n("Tag Guesser, Labels, Spectrum Analyzer").toString(), "Daniel.Dewald@time-shift.de" ); - ocsData.addCredit( "TheCrasher", aboutData.credits().last() ); - aboutData.addCredit( ki18n("Daniel Winter").toString(), ki18n("Nepomuk integration").toString(), "dw@danielwinter.de" ); - ocsData.addCredit( QString(), aboutData.credits().last() ); - aboutData.addCredit( ki18n("Frank Meerkötter").toString(), ki18n("Podcast improvements").toString(), "frank@meerkoetter.org" ); - ocsData.addCredit( QString(), aboutData.credits().last() ); - aboutData.addCredit( ki18n("Greg Meyer").toString(), ki18n("Live CD, Bug squashing (oggb4mp3)").toString(), "greg@gkmweb.com" ); - ocsData.addCredit( "oggb4mp3", aboutData.credits().last() ); - aboutData.addCredit( ki18n("Harald Sitter").toString(), ki18n("Phonon, Lord-President of KDE Multimedia (apachelogger)").toString(), "harald.sitter@kdemail.net" ); - ocsData.addCredit( "apachelogger", aboutData.credits().last() ); - aboutData.addCredit( ki18n("John Atkinson").toString(), ki18n("Assorted patches").toString(), "john@fauxnetic.co.uk" ); - ocsData.addCredit( "fauxnetic", aboutData.credits().last() ); - aboutData.addCredit( ki18n("Kenneth Wesley Wimer II").toString(), ki18n("Icons").toString(), "kwwii@bootsplash.org" ); - ocsData.addCredit( "kwwii", aboutData.credits().last() ); - aboutData.addCredit( ki18n("Kevin Funk").toString(), ki18n("Developer, Website theme (KRF)").toString(), "krf@electrostorm.net" ); - ocsData.addCredit( "krf", aboutData.credits().last() ); - aboutData.addCredit( ki18n("Kuba Serafinowski").toString(), ki18n("Rokymoter").toString(), "zizzfizzix@gmail.com" ); - ocsData.addCredit( "zizzfizzix", aboutData.credits().last() ); - aboutData.addCredit( ki18n("Lee Olson").toString(), ki18n("Artwork").toString(), "leetolson@gmail.com" ); - ocsData.addCredit( QString(), aboutData.credits().last() ); - aboutData.addCredit( ki18n("Ljubomir Simin").toString(), ki18n("Rokymoter (ljubomir)").toString(), "ljubomir.simin@gmail.com" ); - ocsData.addCredit( "ljubomir", aboutData.credits().last() ); - aboutData.addCredit( ki18n("Lucas Gomes").toString(), ki18n("Developer (MaskMaster)").toString(), "x8lucas8x@gmail.com" ); - ocsData.addCredit( "x8lucas8x", aboutData.credits().last() ); - aboutData.addCredit( ki18n("Mathias Panzenböck").toString(), ki18n("Podcast improvements").toString(), "grosser.meister.morti@gmx.net" ); - ocsData.addCredit( "panzi", aboutData.credits().last() ); - aboutData.addCredit( ki18n("Mikko Caldara").toString(), ki18n("Bug triaging and sanitizing").toString(), "mikko.cal@gmail.com" ); - ocsData.addCredit( QString(), aboutData.credits().last() ); - aboutData.addCredit( ki18n("Nikhil Marathe").toString(), ki18n("UPnP support and patches (nsm)").toString(), "nsm.nikhil@gmail.com" ); - ocsData.addCredit( "nikhilm", aboutData.credits().last() ); - aboutData.addCredit( ki18n("Nuno Pinheiro").toString(), ki18n("Artwork").toString(), "nuno@oxygen-icons.org" ); - ocsData.addCredit( "nunopinheirokde", aboutData.credits().last() ); - aboutData.addCredit( ki18n("Olivier Bédard").toString(), ki18n("Website hosting").toString(), "paleo@pwsp.net" ); - ocsData.addCredit( QString(), aboutData.credits().last() ); - aboutData.addCredit( ki18n("Pasi Lalinaho").toString(), ki18n("Rokymoter (emunkki)").toString(), "pasi@getamarok.com" ); - ocsData.addCredit( QString(), aboutData.credits().last() ); - aboutData.addCredit( ki18n("Peter Zhou Lei").toString(), ki18n("Scripting interface").toString(), "peterzhoulei@gmail.com" ); - ocsData.addCredit( "peterzl", aboutData.credits().last() ); - aboutData.addCredit( ki18n("Phalgun Guduthur").toString(), ki18n("Nepomuk Collection (phalgun)").toString(), "me@phalgun.in" ); - ocsData.addCredit( "phalgun", aboutData.credits().last() ); - aboutData.addCredit( ki18n("Scott Wheeler").toString(), ki18n("TagLib & ktrm code").toString(), "wheeler@kde.org" ); - ocsData.addCredit( "wheels", aboutData.credits().last() ); - aboutData.addCredit( ki18n("Shane King").toString(), ki18n("Patches & Windows porting (shakes)").toString(), "kde@dontletsstart.com" ); - ocsData.addCredit( QString(), aboutData.credits().last() ); - aboutData.addCredit( ki18n("Simon Esneault").toString(), ki18n("Photos & Videos applets, Context View").toString(), "simon.esneault@gmail.com" ); - ocsData.addCredit( "Takahani", aboutData.credits().last() ); - aboutData.addCredit( ki18n("Soren Harward").toString(), ki18n("Developer, Automated Playlist Generator").toString(), "stharward@gmail.com" ); - ocsData.addCredit( QString(), aboutData.credits().last() ); - aboutData.addCredit( ki18n("Thomas Lübking").toString(), ki18n("Developer").toString(), "thomas.luebking@web.de" ); - ocsData.addCredit( "thomas12777", aboutData.credits().last() ); - aboutData.addCredit( ki18n("Valentin Rouet").toString(), ki18n("Developer").toString(), "v.rouet@gmail.com" ); - ocsData.addCredit( QString(), aboutData.credits().last() ); - aboutData.addCredit( ki18n("Wade Olson").toString(), ki18n("Splash screen artist").toString(), "wade@corefunction.com" ); - ocsData.addCredit( QString(), aboutData.credits().last() ); - aboutData.addCredit( ki18n("William Viana Soares").toString(), ki18n("Context view").toString(), "vianasw@gmail.com" ); - ocsData.addCredit( QString(), aboutData.credits().last() ); + aboutData.addCredit( i18n("Alejandro Wainzinger"), i18n("Developer (xevix)"), "aikawarazuni@gmail.com" ); + ocsData.addCredit( "xevix", aboutData.credits().last() ); + aboutData.addCredit( i18n("Alex Merry"), i18n("Developer, Replay Gain support"), "kde@randomguy3.me.uk" ); + ocsData.addCredit( "randomguy3", aboutData.credits().last() ); + aboutData.addCredit( i18n("Casey Link"), i18n("MP3tunes integration"), "unnamedrambler@gmail.com" ); + ocsData.addCredit( "Ramblurr", aboutData.credits().last() ); + aboutData.addCredit( i18n("Casper van Donderen"), i18n("Windows porting"), "casper.vandonderen@gmail.com" ); + ocsData.addCredit( "cvandonderen", aboutData.credits().last() ); + aboutData.addCredit( i18n("Christie Harris"), i18n("Rokymoter (dangle)"), "dangle.baby@gmail.com" ); + ocsData.addCredit( "dangle", aboutData.credits().last() ); + aboutData.addCredit( i18n("Dan Leinir Turthra Jensen"), i18n("Usability"), "admin@leinir.dk" ); + ocsData.addCredit( "leinir", aboutData.credits().last() ); + aboutData.addCredit( i18n("Dan 'Hey, it compiled...' Meltzer"), i18n("Developer (hydrogen)"), "parallelgrapefruit@gmail.com" ); + ocsData.addCredit( QString(), aboutData.credits().last() ); + aboutData.addCredit( i18n("Daniel Caleb Jones"), i18n("Biased playlists"), "danielcjones@gmail.com" ); + ocsData.addCredit( QString(), aboutData.credits().last() ); + aboutData.addCredit( i18n("Daniel Dewald"), i18n("Tag Guesser, Labels, Spectrum Analyzer"), "Daniel.Dewald@time-shift.de" ); + ocsData.addCredit( "TheCrasher", aboutData.credits().last() ); + aboutData.addCredit( i18n("Daniel Winter"), i18n("Nepomuk integration"), "dw@danielwinter.de" ); + ocsData.addCredit( QString(), aboutData.credits().last() ); + aboutData.addCredit( i18n("Frank Meerkötter"), i18n("Podcast improvements"), "frank@meerkoetter.org" ); + ocsData.addCredit( QString(), aboutData.credits().last() ); + aboutData.addCredit( i18n("Greg Meyer"), i18n("Live CD, Bug squashing (oggb4mp3)"), "greg@gkmweb.com" ); + ocsData.addCredit( "oggb4mp3", aboutData.credits().last() ); + aboutData.addCredit( i18n("Harald Sitter"), i18n("Phonon, Lord-President of KDE Multimedia (apachelogger)"), "harald.sitter@kdemail.net" ); + ocsData.addCredit( "apachelogger", aboutData.credits().last() ); + aboutData.addCredit( i18n("John Atkinson"), i18n("Assorted patches"), "john@fauxnetic.co.uk" ); + ocsData.addCredit( "fauxnetic", aboutData.credits().last() ); + aboutData.addCredit( i18n("Kenneth Wesley Wimer II"), i18n("Icons"), "kwwii@bootsplash.org" ); + ocsData.addCredit( "kwwii", aboutData.credits().last() ); + aboutData.addCredit( i18n("Kevin Funk"), i18n("Developer, Website theme (KRF)"), "krf@electrostorm.net" ); + ocsData.addCredit( "krf", aboutData.credits().last() ); + aboutData.addCredit( i18n("Kuba Serafinowski"), i18n("Rokymoter"), "zizzfizzix@gmail.com" ); + ocsData.addCredit( "zizzfizzix", aboutData.credits().last() ); + aboutData.addCredit( i18n("Lee Olson"), i18n("Artwork"), "leetolson@gmail.com" ); + ocsData.addCredit( QString(), aboutData.credits().last() ); + aboutData.addCredit( i18n("Ljubomir Simin"), i18n("Rokymoter (ljubomir)"), "ljubomir.simin@gmail.com" ); + ocsData.addCredit( "ljubomir", aboutData.credits().last() ); + aboutData.addCredit( i18n("Lucas Gomes"), i18n("Developer (MaskMaster)"), "x8lucas8x@gmail.com" ); + ocsData.addCredit( "x8lucas8x", aboutData.credits().last() ); + aboutData.addCredit( i18n("Mathias Panzenböck"), i18n("Podcast improvements"), "grosser.meister.morti@gmx.net" ); + ocsData.addCredit( "panzi", aboutData.credits().last() ); + aboutData.addCredit( i18n("Mikko Caldara"), i18n("Bug triaging and sanitizing"), "mikko.cal@gmail.com" ); + ocsData.addCredit( QString(), aboutData.credits().last() ); + aboutData.addCredit( i18n("Nikhil Marathe"), i18n("UPnP support and patches (nsm)"), "nsm.nikhil@gmail.com" ); + ocsData.addCredit( "nikhilm", aboutData.credits().last() ); + aboutData.addCredit( i18n("Nuno Pinheiro"), i18n("Artwork"), "nuno@oxygen-icons.org" ); + ocsData.addCredit( "nunopinheirokde", aboutData.credits().last() ); + aboutData.addCredit( i18n("Olivier Bédard"), i18n("Website hosting"), "paleo@pwsp.net" ); + ocsData.addCredit( QString(), aboutData.credits().last() ); + aboutData.addCredit( i18n("Pasi Lalinaho"), i18n("Rokymoter (emunkki)"), "pasi@getamarok.com" ); + ocsData.addCredit( QString(), aboutData.credits().last() ); + aboutData.addCredit( i18n("Peter Zhou Lei"), i18n("Scripting interface"), "peterzhoulei@gmail.com" ); + ocsData.addCredit( "peterzl", aboutData.credits().last() ); + aboutData.addCredit( i18n("Phalgun Guduthur"), i18n("Nepomuk Collection (phalgun)"), "me@phalgun.in" ); + ocsData.addCredit( "phalgun", aboutData.credits().last() ); + aboutData.addCredit( i18n("Scott Wheeler"), i18n("TagLib & ktrm code"), "wheeler@kde.org" ); + ocsData.addCredit( "wheels", aboutData.credits().last() ); + aboutData.addCredit( i18n("Shane King"), i18n("Patches & Windows porting (shakes)"), "kde@dontletsstart.com" ); + ocsData.addCredit( QString(), aboutData.credits().last() ); + aboutData.addCredit( i18n("Simon Esneault"), i18n("Photos & Videos applets, Context View"), "simon.esneault@gmail.com" ); + ocsData.addCredit( "Takahani", aboutData.credits().last() ); + aboutData.addCredit( i18n("Soren Harward"), i18n("Developer, Automated Playlist Generator"), "stharward@gmail.com" ); + ocsData.addCredit( QString(), aboutData.credits().last() ); + aboutData.addCredit( i18n("Thomas Lübking"), i18n("Developer"), "thomas.luebking@web.de" ); + ocsData.addCredit( "thomas12777", aboutData.credits().last() ); + aboutData.addCredit( i18n("Valentin Rouet"), i18n("Developer"), "v.rouet@gmail.com" ); + ocsData.addCredit( QString(), aboutData.credits().last() ); + aboutData.addCredit( i18n("Wade Olson"), i18n("Splash screen artist"), "wade@corefunction.com" ); + ocsData.addCredit( QString(), aboutData.credits().last() ); + aboutData.addCredit( i18n("William Viana Soares"), i18n("Context view"), "vianasw@gmail.com" ); + ocsData.addCredit( QString(), aboutData.credits().last() ); //Former Contributors - aboutData.addCredit( ki18n("Former contributors").toString(), ki18n("People listed below have contributed to Amarok in the past. Thank you!").toString(), "" ); - ocsData.addCredit( "%%category%%", aboutData.credits().last() ); - aboutData.addCredit( ki18n("Adam Pigg").toString(), ki18n("Analyzers, patches, shoutcast").toString(), "adam@piggz.co.uk" ); - ocsData.addCredit( QString(), aboutData.credits().last() ); - aboutData.addCredit( ki18n("Adeodato Simó").toString(), ki18n("Patches").toString(), "asp16@alu.ua.es" ); - ocsData.addCredit( QString(), aboutData.credits().last() ); - aboutData.addCredit( ki18n("Alexandre Oliveira").toString(), ki18n("Developer").toString(), "aleprj@gmail.com" ); - ocsData.addCredit( QString(), aboutData.credits().last() ); - aboutData.addCredit( ki18n("Andreas Mair").toString(), ki18n("MySQL support").toString(), "am_ml@linogate.com" ); - ocsData.addCredit( QString(), aboutData.credits().last() ); - aboutData.addCredit( ki18n("Andrew de Quincey").toString(), ki18n("Postgresql support").toString(), "adq_dvb@lidskialf.net" ); - ocsData.addCredit( QString(), aboutData.credits().last() ); - aboutData.addCredit( ki18n("Andrew Turner").toString(), ki18n("Patches").toString(), "andrewturner512@googlemail.com" ); - ocsData.addCredit( QString(), aboutData.credits().last() ); - aboutData.addCredit( ki18n("Andy Kelk").toString(), ki18n("MTP and Rio Karma media devices, patches").toString(), "andy@mopoke.co.uk" ); - ocsData.addCredit( QString(), aboutData.credits().last() ); - aboutData.addCredit( ki18n("Christian Muehlhaeuser").toString(), ki18n("Developer").toString(), "chris@chris.de" ); - ocsData.addCredit( QString(), aboutData.credits().last() ); - aboutData.addCredit( ki18n("Derek Nelson").toString(), ki18n("Graphics, splash-screen").toString(), "admrla@gmail.com" ); - ocsData.addCredit( QString(), aboutData.credits().last() ); - aboutData.addCredit( ki18n("Enrico Ros").toString(), ki18n("Analyzers, Context Browser and systray eye-candy").toString(), "eros.kde@email.it" ); - ocsData.addCredit( QString(), aboutData.credits().last() ); - aboutData.addCredit( ki18n("Frederik Holljen").toString(), ki18n("Developer").toString(), "fh@ez.no" ); - ocsData.addCredit( QString(), aboutData.credits().last() ); - aboutData.addCredit( ki18n("Gábor Lehel").toString(), ki18n("Developer").toString(), "illissius@gmail.com" ); - ocsData.addCredit( QString(), aboutData.credits().last() ); - aboutData.addCredit( ki18n("Gérard Dürrmeyer").toString(), ki18n("Icons and image work").toString(), "gerard@randomtree.com" ); - ocsData.addCredit( QString(), aboutData.credits().last() ); - aboutData.addCredit( ki18n("Giovanni Venturi").toString(), ki18n("Dialog to filter the collection titles").toString(), "giovanni@ksniffer.org" ); - ocsData.addCredit( QString(), aboutData.credits().last() ); - aboutData.addCredit( ki18n("Jarkko Lehti").toString(), ki18n("Tester, IRC channel operator, whipping").toString(), "grue@iki.fi" ); - ocsData.addCredit( QString(), aboutData.credits().last() ); - aboutData.addCredit( ki18n("Jocke Andersson").toString(), ki18n("Rokymoter, bug fixer (Firetech)").toString(), "ajocke@gmail.com" ); - ocsData.addCredit( QString(), aboutData.credits().last() ); - aboutData.addCredit( ki18n("Marco Gulino").toString(), ki18n("Konqueror Sidebar, some DCOP methods").toString(), "marco@kmobiletools.org" ); - ocsData.addCredit( QString(), aboutData.credits().last() ); - aboutData.addCredit( ki18n("Martin Aumueller").toString(), ki18n("Developer").toString(), "aumuell@reserv.at" ); - ocsData.addCredit( QString(), aboutData.credits().last() ); - aboutData.addCredit( ki18n("Melchior Franz").toString(), ki18n("FHT routine, bugfixes").toString(), "mfranz@kde.org" ); - ocsData.addCredit( QString(), aboutData.credits().last() ); - aboutData.addCredit( ki18n("Michael Pyne").toString(), ki18n("K3b export code").toString(), "michael.pyne@kdemail.net" ); - ocsData.addCredit( QString(), aboutData.credits().last() ); - aboutData.addCredit( ki18n("Mike Diehl").toString(), ki18n("Developer").toString(), "madpenguin8@yahoo.com" ); - ocsData.addCredit( QString(), aboutData.credits().last() ); - aboutData.addCredit( ki18n("Paul Cifarelli").toString(), ki18n("Developer").toString(), "paul@cifarelli.net" ); - ocsData.addCredit( QString(), aboutData.credits().last() ); - aboutData.addCredit( ki18n("Peter C. Ndikuwera").toString(), ki18n("Bugfixes, PostgreSQL support").toString(), "pndiku@gmail.com" ); - ocsData.addCredit( QString(), aboutData.credits().last() ); - aboutData.addCredit( ki18n("Pierpaolo Panfilo").toString(), ki18n("Developer").toString(), "pippo_dp@libero.it" ); - ocsData.addCredit( QString(), aboutData.credits().last() ); - aboutData.addCredit( ki18n("Reigo Reinmets").toString(), ki18n("Wikipedia support, patches").toString(), "xatax@hot.ee" ); - ocsData.addCredit( QString(), aboutData.credits().last() ); - aboutData.addCredit( ki18n("Roman Becker").toString(), ki18n("Former Amarok logo, former splash screen, former icons").toString(), "roman@formmorf.de" ); - ocsData.addCredit( QString(), aboutData.credits().last() ); - aboutData.addCredit( ki18n("Sami Nieminen").toString(), ki18n("Audioscrobbler support").toString(), "sami.nieminen@iki.fi" ); - ocsData.addCredit( QString(), aboutData.credits().last() ); - aboutData.addCredit( ki18n("Stanislav Karchebny").toString(), ki18n("Developer").toString(), "berkus@madfire.net" ); - ocsData.addCredit( QString(), aboutData.credits().last() ); - aboutData.addCredit( ki18n("Stefan Bogner").toString(), ki18n("Loads of stuff").toString(), "bochi@online.ms" ); - ocsData.addCredit( QString(), aboutData.credits().last() ); - aboutData.addCredit( ki18n("Tomasz Dudzik").toString(), ki18n("Splash screen").toString(), "madsheytan@gmail.com" ); - ocsData.addCredit( QString(), aboutData.credits().last() ); + aboutData.addCredit( i18n("Former contributors"), i18n("People listed below have contributed to Amarok in the past. Thank you!"), "" ); + ocsData.addCredit( "%%category%%", aboutData.credits().last() ); + aboutData.addCredit( i18n("Adam Pigg"), i18n("Analyzers, patches, shoutcast"), "adam@piggz.co.uk" ); + ocsData.addCredit( QString(), aboutData.credits().last() ); + aboutData.addCredit( i18n("Adeodato Simó"), i18n("Patches"), "asp16@alu.ua.es" ); + ocsData.addCredit( QString(), aboutData.credits().last() ); + aboutData.addCredit( i18n("Alexandre Oliveira"), i18n("Developer"), "aleprj@gmail.com" ); + ocsData.addCredit( QString(), aboutData.credits().last() ); + aboutData.addCredit( i18n("Andreas Mair"), i18n("MySQL support"), "am_ml@linogate.com" ); + ocsData.addCredit( QString(), aboutData.credits().last() ); + aboutData.addCredit( i18n("Andrew de Quincey"), i18n("Postgresql support"), "adq_dvb@lidskialf.net" ); + ocsData.addCredit( QString(), aboutData.credits().last() ); + aboutData.addCredit( i18n("Andrew Turner"), i18n("Patches"), "andrewturner512@googlemail.com" ); + ocsData.addCredit( QString(), aboutData.credits().last() ); + aboutData.addCredit( i18n("Andy Kelk"), i18n("MTP and Rio Karma media devices, patches"), "andy@mopoke.co.uk" ); + ocsData.addCredit( QString(), aboutData.credits().last() ); + aboutData.addCredit( i18n("Christian Muehlhaeuser"), i18n("Developer"), "chris@chris.de" ); + ocsData.addCredit( QString(), aboutData.credits().last() ); + aboutData.addCredit( i18n("Derek Nelson"), i18n("Graphics, splash-screen"), "admrla@gmail.com" ); + ocsData.addCredit( QString(), aboutData.credits().last() ); + aboutData.addCredit( i18n("Enrico Ros"), i18n("Analyzers, Context Browser and systray eye-candy"), "eros.kde@email.it" ); + ocsData.addCredit( QString(), aboutData.credits().last() ); + aboutData.addCredit( i18n("Frederik Holljen"), i18n("Developer"), "fh@ez.no" ); + ocsData.addCredit( QString(), aboutData.credits().last() ); + aboutData.addCredit( i18n("Gábor Lehel"), i18n("Developer"), "illissius@gmail.com" ); + ocsData.addCredit( QString(), aboutData.credits().last() ); + aboutData.addCredit( i18n("Gérard Dürrmeyer"), i18n("Icons and image work"), "gerard@randomtree.com" ); + ocsData.addCredit( QString(), aboutData.credits().last() ); + aboutData.addCredit( i18n("Giovanni Venturi"), i18n("Dialog to filter the collection titles"), "giovanni@ksniffer.org" ); + ocsData.addCredit( QString(), aboutData.credits().last() ); + aboutData.addCredit( i18n("Jarkko Lehti"), i18n("Tester, IRC channel operator, whipping"), "grue@iki.fi" ); + ocsData.addCredit( QString(), aboutData.credits().last() ); + aboutData.addCredit( i18n("Jocke Andersson"), i18n("Rokymoter, bug fixer (Firetech)"), "ajocke@gmail.com" ); + ocsData.addCredit( QString(), aboutData.credits().last() ); + aboutData.addCredit( i18n("Marco Gulino"), i18n("Konqueror Sidebar, some DCOP methods"), "marco@kmobiletools.org" ); + ocsData.addCredit( QString(), aboutData.credits().last() ); + aboutData.addCredit( i18n("Martin Aumueller"), i18n("Developer"), "aumuell@reserv.at" ); + ocsData.addCredit( QString(), aboutData.credits().last() ); + aboutData.addCredit( i18n("Melchior Franz"), i18n("FHT routine, bugfixes"), "mfranz@kde.org" ); + ocsData.addCredit( QString(), aboutData.credits().last() ); + aboutData.addCredit( i18n("Michael Pyne"), i18n("K3b export code"), "michael.pyne@kdemail.net" ); + ocsData.addCredit( QString(), aboutData.credits().last() ); + aboutData.addCredit( i18n("Mike Diehl"), i18n("Developer"), "madpenguin8@yahoo.com" ); + ocsData.addCredit( QString(), aboutData.credits().last() ); + aboutData.addCredit( i18n("Paul Cifarelli"), i18n("Developer"), "paul@cifarelli.net" ); + ocsData.addCredit( QString(), aboutData.credits().last() ); + aboutData.addCredit( i18n("Peter C. Ndikuwera"), i18n("Bugfixes, PostgreSQL support"), "pndiku@gmail.com" ); + ocsData.addCredit( QString(), aboutData.credits().last() ); + aboutData.addCredit( i18n("Pierpaolo Panfilo"), i18n("Developer"), "pippo_dp@libero.it" ); + ocsData.addCredit( QString(), aboutData.credits().last() ); + aboutData.addCredit( i18n("Reigo Reinmets"), i18n("Wikipedia support, patches"), "xatax@hot.ee" ); + ocsData.addCredit( QString(), aboutData.credits().last() ); + aboutData.addCredit( i18n("Roman Becker"), i18n("Former Amarok logo, former splash screen, former icons"), "roman@formmorf.de" ); + ocsData.addCredit( QString(), aboutData.credits().last() ); + aboutData.addCredit( i18n("Sami Nieminen"), i18n("Audioscrobbler support"), "sami.nieminen@iki.fi" ); + ocsData.addCredit( QString(), aboutData.credits().last() ); + aboutData.addCredit( i18n("Stanislav Karchebny"), i18n("Developer"), "berkus@madfire.net" ); + ocsData.addCredit( QString(), aboutData.credits().last() ); + aboutData.addCredit( i18n("Stefan Bogner"), i18n("Loads of stuff"), "bochi@online.ms" ); + ocsData.addCredit( QString(), aboutData.credits().last() ); + aboutData.addCredit( i18n("Tomasz Dudzik"), i18n("Splash screen"), "madsheytan@gmail.com" ); + ocsData.addCredit( QString(), aboutData.credits().last() ); //Donors: //Last update: 2012/11/07, post Roktober 2012 - ocsData.addDonor( "ayleph", KAboutPerson( ki18n( "Andrew Browning" ).toString() ) ); - ocsData.addDonor( QString(), KAboutPerson( ki18n( "Chris Wales" ).toString() ) ); - ocsData.addDonor( QString(), KAboutPerson( ki18n( "ZImin Stanislav" ).toString() ) ); + ocsData.addDonor( "ayleph", KAboutPerson( i18n( "Andrew Browning" ) ) ); + ocsData.addDonor( QString(), KAboutPerson( i18n( "Chris Wales" ) ) ); + ocsData.addDonor( QString(), KAboutPerson( i18n( "ZImin Stanislav" ) ) ); KAboutData::setApplicationData(aboutData); // Command line parser QCommandLineParser parser; - parser.addVersionOption(); - parser.addHelpOption(); aboutData.setupCommandLine(&parser); app.initCliArgs(&parser); @@ -313,11 +359,11 @@ qputenv( "PHONON_PULSEAUDIO_DEBUG", QByteArray( "3" ) ); } -#pragma message("PORT KF5: This *if* hould be moved to activateRequested() slot") +#pragma message("PORT KF5: This *if* should be moved to activateRequested() slot") if( !dbusService.isRegistered() ) { QList instanceOptions; instanceOptions << "previous" << "play" << "play-pause" << "stop" << "next" - << "append" << "queue" << "load"; + << "append" << "queue" << "load"; // Check if an option for a running instance is set bool isSet = false; for( int i = 0; i < instanceOptions.size(); ++i ) diff --git a/src/moodbar/MoodbarManager.cpp b/src/moodbar/MoodbarManager.cpp --- a/src/moodbar/MoodbarManager.cpp +++ b/src/moodbar/MoodbarManager.cpp @@ -147,12 +147,12 @@ m_lastPaintMode = AmarokConfig::moodbarPaintStyle(); m_cache->clear(); m_moodDataMap.clear(); - emit moodbarStyleChanged(); + Q_EMIT moodbarStyleChanged(); } //Do we already have this pixmap cached? - const QString pixmapKey = QString( "mood:%1-%2x%3%4" ).arg( track->uidUrl(), QString::number( width ), + const QString pixmapKey = QStringLiteral( "mood:%1-%2x%3%4" ).arg( track->uidUrl(), QString::number( width ), QString::number( height ), QString( rtl?"r":"" ) ); QPixmap moodbar; @@ -431,7 +431,7 @@ // First average the moodbar samples that will go into each // vertical bar on the screen. - if( data.size() == 0 ) // Play it safe -- see below + if( data.isEmpty() ) // Play it safe -- see below return QPixmap(); MoodbarColorList screenColors; @@ -506,7 +506,7 @@ QString MoodbarManager::moodPath( const QString &trackPath ) const { - QStringList parts = trackPath.split( '.' ); + QStringList parts = trackPath.split( QLatin1Char('.') ); parts.takeLast(); parts.append( "mood" ); QString moodPath = parts.join( "." ); diff --git a/src/musicbrainz/MusicBrainzFinder.h b/src/musicbrainz/MusicBrainzFinder.h --- a/src/musicbrainz/MusicBrainzFinder.h +++ b/src/musicbrainz/MusicBrainzFinder.h @@ -30,7 +30,7 @@ Q_OBJECT public: - explicit MusicBrainzFinder( QObject *parent = 0, + explicit MusicBrainzFinder( QObject *parent = nullptr, const QString &host = "musicbrainz.org", const int port = 80, const QString &pathPrefix = "/ws/2", diff --git a/src/musicbrainz/MusicBrainzFinder.cpp b/src/musicbrainz/MusicBrainzFinder.cpp --- a/src/musicbrainz/MusicBrainzFinder.cpp +++ b/src/musicbrainz/MusicBrainzFinder.cpp @@ -209,7 +209,7 @@ Meta::TrackPtr trackPtr = m_parsers.value( parser ); bool found = false; - emit progressStep(); + Q_EMIT progressStep(); if( parser->type() == MusicBrainzXmlParser::TrackList && !parser->tracks.isEmpty() ) { @@ -494,7 +494,7 @@ tags.remove( MusicBrainz::TRACKINFO ); } - emit trackFound( track, tags ); + Q_EMIT trackFound( track, tags ); } void @@ -504,7 +504,7 @@ { /* * Empty the queue of tracks waiting for release group requests. If the requests - * fail (hint: network failure), remeaining queued tracks will silently disappear. + * fail (hint: network failure), remaining queued tracks will silently disappear. * Sending an empty result makes the user aware of the fact that the track will * not be tagged. */ @@ -515,7 +515,7 @@ debug() << "There is no queued request. Stopping timer."; m_timer->stop(); - emit done(); + Q_EMIT done(); } } diff --git a/src/musicbrainz/MusicBrainzTagsItem.h b/src/musicbrainz/MusicBrainzTagsItem.h --- a/src/musicbrainz/MusicBrainzTagsItem.h +++ b/src/musicbrainz/MusicBrainzTagsItem.h @@ -26,9 +26,9 @@ class MusicBrainzTagsItem { public: - explicit MusicBrainzTagsItem( MusicBrainzTagsItem *parent = 0, - const Meta::TrackPtr track = Meta::TrackPtr(), - const QVariantMap tags = QVariantMap() ); + explicit MusicBrainzTagsItem( MusicBrainzTagsItem *parent = nullptr, + const Meta::TrackPtr &track = Meta::TrackPtr(), + const QVariantMap &tags = QVariantMap() ); ~MusicBrainzTagsItem(); MusicBrainzTagsItem *parent() const; diff --git a/src/musicbrainz/MusicBrainzTagsItem.cpp b/src/musicbrainz/MusicBrainzTagsItem.cpp --- a/src/musicbrainz/MusicBrainzTagsItem.cpp +++ b/src/musicbrainz/MusicBrainzTagsItem.cpp @@ -25,8 +25,8 @@ #include "core/collections/QueryMaker.h" MusicBrainzTagsItem::MusicBrainzTagsItem( MusicBrainzTagsItem *parent, - const Meta::TrackPtr track, - const QVariantMap tags ) + const Meta::TrackPtr &track, + const QVariantMap &tags ) : m_parent( parent ) , m_track( track ) , m_data( tags ) @@ -245,7 +245,7 @@ return title; } case 1: - return dataValue( Meta::Field::ARTIST );; + return dataValue( Meta::Field::ARTIST ); case 2: { QString album = dataValue( Meta::Field::ALBUM ).toString(); diff --git a/src/musicbrainz/MusicBrainzTagsModel.h b/src/musicbrainz/MusicBrainzTagsModel.h --- a/src/musicbrainz/MusicBrainzTagsModel.h +++ b/src/musicbrainz/MusicBrainzTagsModel.h @@ -43,27 +43,27 @@ Chosen }; - explicit MusicBrainzTagsModel( QObject *parent = 0 ); + explicit MusicBrainzTagsModel( QObject *parent = nullptr ); ~MusicBrainzTagsModel(); QModelIndex index( int row, int column, - const QModelIndex &parent = QModelIndex() ) const; - QModelIndex parent( const QModelIndex &index ) const; + const QModelIndex &parent = QModelIndex() ) const override; + QModelIndex parent( const QModelIndex &index ) const override; - QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const; - bool setData( const QModelIndex &index, const QVariant &value, int role ); - Qt::ItemFlags flags( const QModelIndex &index ) const; + QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const override; + bool setData( const QModelIndex &index, const QVariant &value, int role ) override; + Qt::ItemFlags flags( const QModelIndex &index ) const override; QVariant headerData( int section, Qt::Orientation orientation, - int role = Qt::DisplayRole ) const; + int role = Qt::DisplayRole ) const override; - int rowCount( const QModelIndex &parent = QModelIndex() ) const; - int columnCount( const QModelIndex &parent = QModelIndex() ) const; + int rowCount( const QModelIndex &parent = QModelIndex() ) const override; + int columnCount( const QModelIndex &parent = QModelIndex() ) const override; QMap chosenItems() const; void chooseBestMatchesFromRelease( const QStringList &releases ); public Q_SLOTS: - void addTrack( const Meta::TrackPtr track, const QVariantMap tags ); + void addTrack( const Meta::TrackPtr &track, const QVariantMap &tags ); void chooseBestMatches(); void clearChoices(); diff --git a/src/musicbrainz/MusicBrainzTagsModel.cpp b/src/musicbrainz/MusicBrainzTagsModel.cpp --- a/src/musicbrainz/MusicBrainzTagsModel.cpp +++ b/src/musicbrainz/MusicBrainzTagsModel.cpp @@ -196,7 +196,7 @@ parentItem->clearChoices(); item->setChosen( value.toBool() ); QModelIndex parent = index.parent(); - emit dataChanged( this->index( 0, 0, parent ), + Q_EMIT dataChanged( this->index( 0, 0, parent ), this->index( rowCount( parent ) - 1, 0, parent ) ); return true; } @@ -249,7 +249,7 @@ } void -MusicBrainzTagsModel::addTrack( const Meta::TrackPtr track, const QVariantMap tags ) +MusicBrainzTagsModel::addTrack( const Meta::TrackPtr &track, const QVariantMap &tags ) { DEBUG_BLOCK @@ -298,7 +298,7 @@ similarItem = item; item->mergeData( tags ); - emit dataChanged( index( i, 0, trackIndex ), index(i, columnCount() - 1, trackIndex ) ); + Q_EMIT dataChanged( index( i, 0, trackIndex ), index(i, columnCount() - 1, trackIndex ) ); break; } @@ -348,7 +348,7 @@ if( item->chooseBestMatch() ) { QModelIndex parent = index( i, 0 ); - emit dataChanged( index( 0, 0, parent ), + Q_EMIT dataChanged( index( 0, 0, parent ), index( rowCount( parent ) - 1, 0, parent ) ); } } @@ -363,7 +363,7 @@ if( item->chooseBestMatchFromRelease( releases ) ) { QModelIndex parent = index( i, 0 ); - emit dataChanged( index( 0, 0, parent ), + Q_EMIT dataChanged( index( 0, 0, parent ), index( rowCount( parent ) - 1, 0, parent ) ); } } @@ -377,7 +377,7 @@ MusicBrainzTagsItem *item = m_rootItem->child( i ); item->clearChoices(); QModelIndex parent = index( i, 0 ); - emit dataChanged( index( 0, 0, parent ), + Q_EMIT dataChanged( index( 0, 0, parent ), index( rowCount( parent ) - 1, 0, parent ) ); } } diff --git a/src/musicbrainz/MusicBrainzTagsModelDelegate.h b/src/musicbrainz/MusicBrainzTagsModelDelegate.h --- a/src/musicbrainz/MusicBrainzTagsModelDelegate.h +++ b/src/musicbrainz/MusicBrainzTagsModelDelegate.h @@ -23,11 +23,11 @@ class MusicBrainzTagsModelDelegate : public QItemDelegate { public: - explicit MusicBrainzTagsModelDelegate( QObject *parent = 0 ); + explicit MusicBrainzTagsModelDelegate( QObject *parent = nullptr ); protected: - virtual void drawCheck( QPainter *painter, const QStyleOptionViewItem &option, - const QRect &rect, Qt::CheckState state ) const; + void drawCheck( QPainter *painter, const QStyleOptionViewItem &option, + const QRect &rect, Qt::CheckState state ) const override; }; #endif // MUSICBRAINZTAGSMODELDELEGATE_H diff --git a/src/musicbrainz/MusicBrainzTagsView.h b/src/musicbrainz/MusicBrainzTagsView.h --- a/src/musicbrainz/MusicBrainzTagsView.h +++ b/src/musicbrainz/MusicBrainzTagsView.h @@ -29,16 +29,16 @@ Q_OBJECT public: - explicit MusicBrainzTagsView( QWidget *parent = 0 ); + explicit MusicBrainzTagsView( QWidget *parent = nullptr ); MusicBrainzTagsModel *sourceModel() const; public Q_SLOTS: void collapseChosen(); void expandUnchosen(); protected: - virtual void contextMenuEvent( QContextMenuEvent *event ); + void contextMenuEvent( QContextMenuEvent *event ) override; private Q_SLOTS: void chooseBestMatchesFromRelease() const; diff --git a/src/musicbrainz/MusicBrainzTagsView.cpp b/src/musicbrainz/MusicBrainzTagsView.cpp --- a/src/musicbrainz/MusicBrainzTagsView.cpp +++ b/src/musicbrainz/MusicBrainzTagsView.cpp @@ -131,6 +131,7 @@ menu->addActions( actions ); menu->exec( event->globalPos() ); event->accept(); + delete menu; } void diff --git a/src/musicbrainz/MusicBrainzXmlParser.h b/src/musicbrainz/MusicBrainzXmlParser.h --- a/src/musicbrainz/MusicBrainzXmlParser.h +++ b/src/musicbrainz/MusicBrainzXmlParser.h @@ -36,7 +36,7 @@ explicit MusicBrainzXmlParser( const QString &doc ); - void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) Q_DECL_OVERRIDE; + void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) override; int type(); @@ -80,8 +80,8 @@ QVariantMap m_currentTrackInfo; protected: - void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; - void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; + void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; + void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; }; diff --git a/src/musicbrainz/MusicDNSAudioDecoder.h b/src/musicbrainz/MusicDNSAudioDecoder.h --- a/src/musicbrainz/MusicDNSAudioDecoder.h +++ b/src/musicbrainz/MusicDNSAudioDecoder.h @@ -59,10 +59,10 @@ { Q_OBJECT public: - MusicDNSAudioDecoder( const Meta::TrackList &tracks, const int sampleLength = DEFAULT_SAMPLE_LENGTH ); + explicit MusicDNSAudioDecoder( const Meta::TrackList &tracks, const int sampleLength = DEFAULT_SAMPLE_LENGTH ); virtual ~MusicDNSAudioDecoder(); - void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) Q_DECL_OVERRIDE; + void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) override; Q_SIGNALS: void trackDecoded( const Meta::TrackPtr, const QString ); @@ -82,8 +82,8 @@ int m_sampleLength; protected: - void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; - void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; + void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; + void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; }; diff --git a/src/musicbrainz/MusicDNSFinder.h b/src/musicbrainz/MusicDNSFinder.h --- a/src/musicbrainz/MusicDNSFinder.h +++ b/src/musicbrainz/MusicDNSFinder.h @@ -32,7 +32,7 @@ { Q_OBJECT public: - MusicDNSFinder( QObject *parent = 0, + explicit MusicDNSFinder( QObject *parent = nullptr, const QString &host = "ofa.musicdns.org", const int port = 80, const QString &pathPrefix = "/ofa/1", diff --git a/src/musicbrainz/MusicDNSXmlParser.h b/src/musicbrainz/MusicDNSXmlParser.h --- a/src/musicbrainz/MusicDNSXmlParser.h +++ b/src/musicbrainz/MusicDNSXmlParser.h @@ -26,8 +26,8 @@ { Q_OBJECT public: - MusicDNSXmlParser(QString &doc ); - void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) Q_DECL_OVERRIDE; + explicit MusicDNSXmlParser(QString &doc ); + void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) override; QStringList puid(); private: @@ -52,8 +52,8 @@ void failed(ThreadWeaver::JobPointer); protected: - void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; - void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; + void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; + void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; }; diff --git a/src/network/NetworkAccessManagerProxy.h b/src/network/NetworkAccessManagerProxy.h --- a/src/network/NetworkAccessManagerProxy.h +++ b/src/network/NetworkAccessManagerProxy.h @@ -19,11 +19,16 @@ #include "amarok_export.h" #include +#include "core/support/Debug.h" #include -#include #include +#include +#include +#include +#include + class NetworkAccessManagerProxy; #ifdef DEBUG_BUILD_TYPE @@ -59,11 +64,29 @@ * @param url the url to get the content from. * @param receiver the receiver object to call @p method on. * @param method the method to call when content is retrieved. - * @param type the #Qt::ConnectionType used for calling the @p method. + * @param type the Qt::ConnectionType used for calling the @p method. * @return a QNetworkReply object for custom monitoring. */ - QNetworkReply *getData( const QUrl &url, QObject *receiver, const char *method, - Qt::ConnectionType type = Qt::AutoConnection ); + template + QNetworkReply *getData( const QUrl &url, Object *receiver, Return ( Object::*method )( Args... ), + Qt::ConnectionType type = Qt::AutoConnection ) + { + if( !url.isValid() ) + { + const QMetaObject *mo = receiver->metaObject(); + debug() << QStringLiteral( "Error: URL '%1' is invalid (from %2)" ).arg( url.url(), mo->className() ); + return 0; + } + + QNetworkReply *r = get( QNetworkRequest(url) ); + m_urlMap.insert( url, r ); + auto lambda = [this, r, receiver, method, type] () + { + replyFinished( r, QPointer( receiver ), method, type ); + }; + connect( r, &QNetworkReply::finished, this, lambda ); + return r; + } int abortGet( const QUrl &url ); int abortGet( const QList &urls ); @@ -93,17 +116,71 @@ void slotError( QObject *reply ); protected: - virtual QNetworkReply *createRequest(Operation op, const QNetworkRequest &req, - QIODevice *outgoingData = 0); + QNetworkReply *createRequest(Operation op, const QNetworkRequest &req, + QIODevice *outgoingData = 0) override; private: - NetworkAccessManagerProxy( QObject *parent = 0 ); - void replyFinished(); + NetworkAccessManagerProxy( QObject *parent = nullptr ); + + template + void replyFinished( QNetworkReply *reply, QPointer receiver, Return ( Object::*method )( Args... ), Qt::ConnectionType type ) + { + if( !reply || !receiver ) + return; + + QUrl url = reply->request().url(); + QByteArray data = reply->readAll(); + data.detach(); // detach so the bytes are not deleted before methods are invoked + + // There may have been a redirect. + QUrl redirectUrl = getRedirectUrl( reply ); + + // Check if there's no redirect. + if( redirectUrl.isEmpty() ) + { + Error err = { reply->error(), reply->errorString() }; + + if( type == Qt::AutoConnection ) + { + if( QThread::currentThread() == receiver->thread() ) + type = Qt::DirectConnection; + else + type = Qt::QueuedConnection; + } + + if( type == Qt::DirectConnection ) + ( receiver->*method )( url, data, err ); + else + { + auto lambda = [receiver, method, url, data, err] () + { + ( receiver->*method )( url, data, err ); + }; + QTimer::singleShot( 0, receiver, lambda ); + } + } + else + { + debug() << "the server is redirecting the request to: " << redirectUrl; + + // Let's try to fetch the data again, but this time from the new url. + QNetworkReply *newReply = getData( redirectUrl, receiver.data(), method, type ); + + Q_EMIT requestRedirectedUrl( url, redirectUrl ); + Q_EMIT requestRedirectedReply( reply, newReply ); + } + + reply->deleteLater(); + } + static NetworkAccessManagerProxy *s_instance; - class NetworkAccessManagerProxyPrivate; - NetworkAccessManagerProxyPrivate* const d; - friend class NetworkAccessManagerProxyPrivate; + QMultiHash m_urlMap; + QString m_userAgent; + +#ifdef DEBUG_BUILD_TYPE + NetworkAccessViewer *m_viewer; +#endif // DEBUG_BUILD_TYPE Q_DISABLE_COPY( NetworkAccessManagerProxy ) }; diff --git a/src/network/NetworkAccessManagerProxy.cpp b/src/network/NetworkAccessManagerProxy.cpp --- a/src/network/NetworkAccessManagerProxy.cpp +++ b/src/network/NetworkAccessManagerProxy.cpp @@ -22,21 +22,16 @@ #include "NetworkAccessViewer.h" #endif // DEBUG_BUILD_TYPE -#include "core/support/Debug.h" - #include "Version.h" #include -#include -#include -#include -NetworkAccessManagerProxy *NetworkAccessManagerProxy::s_instance = 0; +NetworkAccessManagerProxy *NetworkAccessManagerProxy::s_instance = nullptr; NetworkAccessManagerProxy *NetworkAccessManagerProxy::instance() { - if( s_instance == 0 ) + if( s_instance == nullptr ) s_instance = new NetworkAccessManagerProxy(); return s_instance; } @@ -46,168 +41,45 @@ if( s_instance ) { delete s_instance; - s_instance = 0; + s_instance = nullptr; } } -class NetworkAccessManagerProxy::NetworkAccessManagerProxyPrivate -{ -public: - NetworkAccessManagerProxyPrivate( NetworkAccessManagerProxy *parent ) - : userAgent( QString( "Amarok/" ) + AMAROK_VERSION ) -#ifdef DEBUG_BUILD_TYPE - , viewer( 0 ) -#endif // DEBUG_BUILD_TYPE - , q_ptr( parent ) - {} - - ~NetworkAccessManagerProxyPrivate() {} - - void _replyFinished() - { - Q_Q( NetworkAccessManagerProxy ); - QNetworkReply *reply = static_cast( q->sender() ); - - QUrl url = reply->request().url(); - QList callbacks = urlMap.values( url ); - urlMap.remove( url ); - QByteArray data = reply->readAll(); - data.detach(); // detach so the bytes are not deleted before methods are invoked - foreach( const CallBackData *cb, callbacks ) - { - // There may have been a redirect. - QUrl redirectUrl = q->getRedirectUrl( reply ); - - // Check if there's no redirect. - if( redirectUrl.isEmpty() ) - { - QByteArray sig = QMetaObject::normalizedSignature( cb->method ); - sig.remove( 0, 1 ); // remove first char, which is the member code (see qobjectdefs.h) - // and let Qt's meta object system handle the rest. - if( cb->receiver ) - { - bool success( false ); - const QMetaObject *mo = cb->receiver->metaObject(); - int methodIndex = mo->indexOfSlot( sig ); - if( methodIndex != -1 ) - { - Error err = { reply->error(), reply->errorString() }; - QMetaMethod method = mo->method( methodIndex ); - success = method.invoke( cb->receiver.data(), - cb->type, - Q_ARG( QUrl, reply->request().url() ), - Q_ARG( QByteArray, data ), - Q_ARG( NetworkAccessManagerProxy::Error, err ) ); - } - - if( !success ) - { - debug() << QString( "Failed to invoke method %1 of %2" ) - .arg( QString(sig) ).arg( mo->className() ); - } - } - } - else - { - debug() << "the server is redirecting the request to: " << redirectUrl; - - // Let's try to fetch the data again, but this time from the new url. - QNetworkReply *newReply = q->getData( redirectUrl, cb->receiver.data(), cb->method, cb->type ); - - emit q->requestRedirectedUrl( url, redirectUrl ); - emit q->requestRedirectedReply( reply, newReply ); - } - } - - qDeleteAll( callbacks ); - reply->deleteLater(); - } - - class CallBackData - { - public: - CallBackData( QObject *rec, QNetworkReply *rep, const char *met, Qt::ConnectionType t ) - : receiver( rec ) - , reply( rep ) - , method( met ) - , type( t ) - {} - - ~CallBackData() - { - if( reply ) - reply->deleteLater(); - } - - QPointer receiver; - QPointer reply; - const char *method; - Qt::ConnectionType type; - }; - - QMultiHash urlMap; - QString userAgent; -#ifdef DEBUG_BUILD_TYPE - NetworkAccessViewer *viewer; -#endif // DEBUG_BUILD_TYPE - -private: - NetworkAccessManagerProxy *const q_ptr; - Q_DECLARE_PUBLIC( NetworkAccessManagerProxy ) -}; - NetworkAccessManagerProxy::NetworkAccessManagerProxy( QObject *parent ) : KIO::Integration::AccessManager( parent ) - , d( new NetworkAccessManagerProxyPrivate( this ) ) + , m_userAgent( QStringLiteral( "Amarok/" ) + AMAROK_VERSION ) +#ifdef DEBUG_BUILD_TYPE + , m_viewer( nullptr ) +#endif // DEBUG_BUILD_TYPE { setCache(0); // disable QtWebKit cache to just use KIO one.. qRegisterMetaType(); } NetworkAccessManagerProxy::~NetworkAccessManagerProxy() { - delete d; - s_instance = 0; + s_instance = nullptr; } #ifdef DEBUG_BUILD_TYPE NetworkAccessViewer * NetworkAccessManagerProxy::networkAccessViewer() { - return d->viewer; + return m_viewer; } void NetworkAccessManagerProxy::setNetworkAccessViewer( NetworkAccessViewer *viewer ) { if( viewer ) { - if( d->viewer ) - delete d->viewer; - d->viewer = viewer; + if( m_viewer ) + delete m_viewer; + m_viewer = viewer; } } #endif // DEBUG_BUILD_TYPE -QNetworkReply * -NetworkAccessManagerProxy::getData( const QUrl &url, QObject *receiver, const char *method, - Qt::ConnectionType type ) -{ - if( !url.isValid() ) - { - const QMetaObject *mo = receiver->metaObject(); - debug() << QString( "Error: URL '%1' is invalid (from %2)" ).arg( url.url() ).arg( mo->className() ); - return 0; - } - - QNetworkReply *r = get( QNetworkRequest(url) ); - typedef NetworkAccessManagerProxyPrivate::CallBackData PrivateCallBackData; - PrivateCallBackData *cbm = new PrivateCallBackData( receiver, r, method, type ); - d->urlMap.insert( url, cbm ); - connect( r, &QNetworkReply::finished, this, &NetworkAccessManagerProxy::replyFinished, type ); - return r; -} - int NetworkAccessManagerProxy::abortGet( const QList &urls ) { @@ -221,11 +93,11 @@ int NetworkAccessManagerProxy::abortGet( const QUrl &url ) { - if( !d->urlMap.contains(url) ) + if( m_urlMap.contains(url) ) return 0; - qDeleteAll( d->urlMap.values( url ) ); - int removed = d->urlMap.remove( url ); + qDeleteAll( m_urlMap.values( url ) ); + int removed = m_urlMap.remove( url ); return removed; } @@ -261,7 +133,7 @@ if( !reply ) return; QUrl url = reply->request().url(); - d->urlMap.remove( url ); + m_urlMap.remove( url ); reply->deleteLater(); } @@ -271,9 +143,9 @@ QNetworkRequest request = req; request.setAttribute( QNetworkRequest::HttpPipeliningAllowedAttribute, true ); if ( request.hasRawHeader( "User-Agent" ) ) - request.setRawHeader( "User-Agent", d->userAgent.toLocal8Bit() + ' ' + request.rawHeader( "User-Agent" ) ); + request.setRawHeader( "User-Agent", m_userAgent.toLocal8Bit() + ' ' + request.rawHeader( "User-Agent" ) ); else - request.setRawHeader( "User-Agent", d->userAgent.toLocal8Bit() ); + request.setRawHeader( "User-Agent", m_userAgent.toLocal8Bit() ); KIO::CacheControl cc = KProtocolManager::cacheControl(); switch (cc) @@ -300,18 +172,12 @@ QNetworkReply *reply = KIO::Integration::AccessManager::createRequest( op, request, outgoingData ); #ifdef DEBUG_BUILD_TYPE - if( d->viewer ) - d->viewer->addRequest( op, request, outgoingData, reply ); + if( m_viewer ) + m_viewer->addRequest( op, request, outgoingData, reply ); #endif // DEBUG_BUILD_TYPE return reply; } -void -NetworkAccessManagerProxy::replyFinished() -{ - d->_replyFinished(); -} - namespace The { NetworkAccessManagerProxy *networkAccessManager() diff --git a/src/network/NetworkAccessViewer.h b/src/network/NetworkAccessViewer.h --- a/src/network/NetworkAccessViewer.h +++ b/src/network/NetworkAccessViewer.h @@ -38,7 +38,7 @@ Q_OBJECT public: - NetworkAccessViewer( QWidget *parent = 0 ); + explicit NetworkAccessViewer( QWidget *parent = nullptr ); ~NetworkAccessViewer(); void addRequest( QNetworkAccessManager::Operation op, const QNetworkRequest&req, QIODevice *outgoingData, QNetworkReply *reply ); diff --git a/src/org.kde.amarok.appdata.xml b/src/org.kde.amarok.appdata.xml --- a/src/org.kde.amarok.appdata.xml +++ b/src/org.kde.amarok.appdata.xml @@ -4,7 +4,6 @@ CC0-1.0 Amarok أماروك - Amarok Amarok Amarok Amarok @@ -26,6 +25,7 @@ Amarok Amarok Amarok + Amarok Amarok Amarok Амарок @@ -36,17 +36,24 @@ Amarok xxAmarokxx Amarok + Amarok Audio Player Reproductor d'àudio Reproductor d'àudio Zvukový přehrávač + Lydafspiller Audio-Wiedergabeprogramm Αναπαραγωγέας ήχου Audio Player Reproductor de sonido - Pemain Audio + Äänisoitin + Lecteur audio + Reprodutor de son + Pemutar Audio Lettore audio + 오디오 재생기 Audiospeler + Odtwarzacz muzyki Leitor de Áudio Reprodutor de áudio Audio prehrávač @@ -57,40 +64,31 @@ Ljudspelare Аудіопрогравач xxAudio Playerxx + 音樂播放器 -

Amarok is a free, versatile and powerful music player.

-

أماروك مشغّل موسيقى مجّانيّ، وقويّ متعدّد الاستعمالات.

-

Amarok je besplatan, prilagodljiv i snažan muzički player.

-

L'Amarok és un reproductor de música lliure, versàtil i potent.

-

L'Amarok és un reproductor de música lliure, versàtil i potent.

-

Amarok je svobodný, univerzální a mocný přehrávač hudby.

-

Amarok er en fri, alsidig og kraftfuld musikafspiller.

-

Amarok ist eine freie, vielfältige und leistungsfähige Anwendung zur Musikwiedergabe.

-

Το Amarok είναι ένας πολλαπλών χρήσεων, πανίσχυρος αναπαραγωγέας μουσικής.

-

Amarok is a free, versatile and powerful music player.

-

Amarok es un potente y versátil reproductor de música libre.

-

Amarok on vapaa, monipuolinen ja tehokas musiikkisoitin.

-

Amarok est un lecteur de musique libre, polyvalent et puissant.

-

Amarok é un reprodutor de música libre, versátil e potente.

-

Amarok es un libere, versatile e potente reproductor musical

-

Amarok adalah pemain musik yang bebas, serbaguna dan hebat.

-

Amarok è un lettore musicale libero, versatile e potente.

-

Amarok은 강력한 자유 소프트웨어 음악 재생기입니다.

-

Amarok is een vrije, veelzijdige en krachtige muziekspeler.

-

ਅਮਰੋਕ ਮੁਫ਼ਤ, ਲਚਕੀਲਾ ਤੇ ਮਜ਼ਬੂਤ ਸੰਗੀਤ ਪਲੇਅਰ ਹੈ।

-

Amarok jest darmowym, wszechstronnym i zaawansowanym odtwarzaczem muzyki.

-

O Amarok é um leitor multimédia gratuito, versátil e poderoso.

-

Amarok é um reprodutor de músicas livre, versátil e poderoso.

-

Amarok je slobodný, univerzálny a silný prehrávač hudby.

-

Amarok je prost, vsestranski in zmogljiv predvajalnik glasbe.

-

Амарок је слободан, свестран и моћан музички плејер.

-

Amarok je slobodan, svestran i moćan muzički plejer.

-

Амарок је слободан, свестран и моћан музички плејер.

-

Amarok je slobodan, svestran i moćan muzički plejer.

-

Amarok är en fri, mångsidig och kraftfull musikspelare.

-

Amarok — вільна, універсальна та потужна програма для відтворення звукових даних.

-

xxAmarok is a free, versatile and powerful music player.xx

-

Amarok 是自由,全能,强大的音乐播放器。

+

Amarok is a free, cross-platform, versatile, powerful and feature-rich music player and collection manager.

+

L'Amarok és un reproductor de música i gestor de col·leccions lliure, multiplataforma, versàtil, potent i ric en característiques.

+

L'Amarok és un reproductor de música i gestor de col·leccions lliure, multiplataforma, versàtil, potent i ric en característiques.

+

Amarok je svobodný, multiplatformní, univerzální, mocný přehrávač hudby a správce kolekcí se spoustou funkcí.

+

Amarok er en fri, multiplatforms, alsidig, kraftfuld og funktionsrig musikafspiller og samlingshåndtering.

+

Amarok ist eine freie, plattformübergreifende und vielfältige Anwendung zur Musikwiedergabe und Verwaltung Ihrer Musiksammlung mit vielen Funktionen.

+

Το Amarok είναι ένας ελεύθερος, πολλαπλών πλατφορμών και χρήσεων, πανίσχυρος και πλούσιος σε χαρακτηριστικά αναπαραγωγέας μουσικής και διαχειριστής συλλογών.

+

Amarok is a free, cross-platform, versatile, powerful and feature-rich music player and collection manager.

+

Amarok es un potente, versátil, libre y multiplataforma reproductor de música y gestor de colecciones que dispone de gran cantidad de funciones.

+

Amarok on vapaa, monipuolinen ja tehokas monen alustan musiikkisoitin- ja -kokoelmanhallintasovellus.

+

Amarok est un lecteur de musique et un gestionnaire de collections libre, multiplateforme, polyvalent, puissant et riche en fonctionnalités.

+

Amarok é xestor de coleccións de música e reprodutor libre, compatíbel con múltiples plataformas, versátil, potente e cheo de funcionalidades.

+

Amarok adalah pemutar musik dan pengelola koleksi gratis, lintas platform, serbaguna, hebat, dan kaya fitur.

+

Amarok è un lettore musicale e gestore delle raccolte libero, versatile, potente e ricco di funzionalità

+

Amarok은 강력한 크로스 플랫폼 자유 소프트웨어 음악 재생기 및 모음집 관리 도구입니다.

+

Amarok is een vrije muziekspeler en beheerder van een verzameling, cross-platform, veelzijdig, krachtig en rijk aan functies.

+

Amarok jest darmowym, wieloplatformowym, wszechstronnym i zaawansowanym odtwarzaczem muzyki i programem do zarządzania nią.

+

O Amarok é um leitor multimédia e gestor de colecções gratuito, multi-plataforma, versátil, poderoso e rico em funcionalidades.

+

Amarok é um reprodutor de músicas e gerenciador de coleção livre, multiplataforma, versátil, poderoso e rico em recursos.

+

Amarok är en fri, mångsidig, kraftfull och funktionsrik musikspelare och samlingshanterare för flera plattformar.

+

Amarok — вільна, універсальна, різнобічна та потужна програма для відтворення звукових даних та керування фонотеками.

+

xxAmarok is a free, cross-platform, versatile, powerful and feature-rich music player and collection manager.xx

+

Amarok 是款自由、跨平台、多功能且強大的音樂播放和收藏管理器。

Features:

الميزات:

Svojstva:

@@ -114,6 +112,7 @@

Możliwości:

Funcionalidades:

Funcionalidades:

+

Возможности:

Funkcie:

Zmožnosti:

Могућности:

@@ -123,7 +122,8 @@

Funktioner:

Можливості:

xxFeatures:xx

-

特性:

+

功能:

+

功能:

  • Dynamic playlists matching different criteria
  • قوائم تشغيل حركيّة تطابق معايير مختلفة
  • @@ -155,7 +155,6 @@
  • Dynamiska spellistor som motsvarar olika kriterier
  • динамічні списки відтворення на основі різних критеріїв;
  • xxDynamic playlists matching different criteriaxx
  • -
  • 匹配不同规则的动态播放列表
  • Collection managing with rating support
  • إدارة التّجميعات مع دعم التّقييم
  • Kolekcija upravljanja sa podrškom procjene
  • @@ -186,7 +185,7 @@
  • Samlingshantering med betygsstöd
  • керування збіркою з підтримкою оцінок;
  • xxCollection managing with rating supportxx
  • -
  • 收藏集管理和评分支持
  • +
  • 支援評分的收藏管理工具
  • Support for basic iPod, MTP and UMS music player devices
  • دعم أجهة مشغّلات الوسائط iPod، وMTP وUMS الأساسيّة
  • Podrška za osnovne iPod, MTP i UMS muzičke player uređaje
  • @@ -201,7 +200,7 @@
  • Tuki tavallisille iPod-, MTP- ja UMS-musiikkisoitinlaitteille
  • Prise en charge basique des iPod et des lecteurs de musique conformes à MTP et UMS
  • Compatíbel con dispositivos de reprodución de música básicos: iPod, MTP e UMS.
  • -
  • Terutama mendukung peranti pemain musik iPod, MTP dan UMS
  • +
  • Terutama mendukung perangkat pemutar musik iPod, MTP dan UMS
  • Supporto per i lettori musicali iPod, MTP e UMS
  • iPod, MTP, UMS 음악 재생기 장치 지원
  • Ondersteuning voor basis iPod, MTP en UMS muziekspelerapparaten
  • @@ -217,7 +216,7 @@
  • Stöd för grundläggande iPod-, MTP- och UMS-musikspelare
  • підтримка базової роботи з пристроями відтворення, що працюють за протоколами iPod, MTP та UMS;
  • xxSupport for basic iPod, MTP and UMS music player devicesxx
  • -
  • 支持 iPod,MTP 和 UMS 音乐播放设备
  • +
  • 支援基本的 iPod、MTP 和 UMS 音樂播放裝置
  • Integrated Internet services: last.fm, Magnatune, Jamendo, Ampache, mp3tunes and more.
  • Integrisane Internet usluge: last.fm, Magnatune, Jamendo, Ampache, mp3tunes i još mnogo toga.
  • Serveis integrats d'Internet: last.fm, Magnatune, Jamendo, Ampache, mp3tunes i més.
  • @@ -247,7 +246,7 @@
  • Integrerade Internet-tjänster: last.fm, Magnatune, Jamendo, Ampache, mp3tunes med flera.
  • інтеграція з інтернет-службами: last.fm, Magnatune, Jamendo, Ampache, mp3tunes тощо;
  • xxIntegrated Internet services: last.fm, Magnatune, Jamendo, Ampache, mp3tunes and more.xx
  • -
  • 集成互联网服务:last.fm, Magnatune, Jamendo, Ampache, mp3tunes 等
  • +
  • 整合了這些網路服務:last.fm、Magnatune、Jamendo、Ampache、mp3tunes 等等。
  • Scripting support
  • Podrška za skriptiranje
  • Permet la creació de scripts
  • @@ -278,7 +277,7 @@
  • Stöd för skript
  • підтримка роботи зі скриптами;
  • xxScripting supportxx
  • -
  • 支持脚本
  • +
  • 支援指令碼
  • Cover manager
  • إدارة الأغلفة
  • Upravitelj naslovnicom
  • @@ -309,7 +308,7 @@
  • Omslagshanterare
  • засіб керування збіркою зображень обкладинок;
  • xxCover managerxx
  • -
  • 封面管理器
  • +
  • 專輯管理員
  • Replay gain support
  • Ponoviti dobijanje podrške
  • Permet el guany de repetició
  • @@ -323,7 +322,7 @@
  • Voimakkuudentasauksen tuki
  • Prise en charge de Replay Gain
  • Permite normalizar o volume.
  • -
  • Dukungan gain mainkan ulang
  • +
  • Dukungan gain putar ulang
  • Supporto del guadagno di riproduzione
  • 리플레이게인 지원
  • Ondersteuning van Replay gain
  • @@ -339,17 +338,62 @@
  • Stöd för uppspelningsnivå
  • підтримка вирівнювання гучності.
  • xxReplay gain supportxx
  • -
  • 支持回放增益
http://amarok.kde.org https://bugs.kde.org/enter_bug.cgi?format=guided&product=amarok https://docs.kde.org/index.php?application=amarok +
+ + + + + + + + + + + + + + + + + + + + + + http://kde.org/images/screenshots/amarok.png + + + + + + + + + + + + + + + + + + + + + + + https://amarok.kde.org/files/Amarok2.7screenie.png diff --git a/src/org.kde.amarok.desktop b/src/org.kde.amarok.desktop --- a/src/org.kde.amarok.desktop +++ b/src/org.kde.amarok.desktop @@ -87,7 +87,7 @@ GenericName[he]=נגן שמע GenericName[hne]=आडियो प्लेयर GenericName[hu]=Zenelejátszó -GenericName[id]=Pemain Audio +GenericName[id]=Pemutar Audio GenericName[is]=Tónlistarspilari GenericName[it]=Lettore audio GenericName[ja]=オーディオプレーヤー @@ -123,7 +123,6 @@ GenericName[uk]=Аудіопрогравач GenericName[wa]=Djouweu d' son GenericName[x-test]=xxAudio Playerxx -GenericName[zh_CN]=音频播放器 GenericName[zh_TW]=音效播放器 Exec=amarok %U Comment=Amarok - Rediscover Your Music! @@ -183,7 +182,6 @@ Comment[uk]=Amarok — відкрийте свою музику знову! Comment[wa]=Amarok - Ridiscovroz vosse muzike! Comment[x-test]=xxAmarok - Rediscover Your Music!xx -Comment[zh_CN]=Amarok - 重新探索您的音乐! Comment[zh_TW]=Amarok - 重新探索您的音樂世界! Icon=amarok # Add pure audio formats here, for other formats see amarok_*.desktop files @@ -210,6 +208,7 @@ X-KDE-Keywords[it]=musica,podcast X-KDE-Keywords[ja]=music,podcast X-KDE-Keywords[km]=តន្ត្រី ផតខាស់ +X-KDE-Keywords[ko]=음악, 팟캐스트 X-KDE-Keywords[lt]=muzika,prenumerata X-KDE-Keywords[lv]=mūzika,podraide X-KDE-Keywords[nb]=musikk,podkasting @@ -229,7 +228,6 @@ X-KDE-Keywords[tr]=müzik,podcast X-KDE-Keywords[uk]=music,podcast,музика,трансляція,подкаст X-KDE-Keywords[x-test]=xxmusicxx,xxpodcastxx -X-KDE-Keywords[zh_CN]=music,podcast,音乐,播客 X-KDE-Keywords[zh_TW]=music,podcast X-KDE-Protocols=http DBusActivatable=true diff --git a/src/org.kde.amarok_containers.desktop b/src/org.kde.amarok_containers.desktop --- a/src/org.kde.amarok_containers.desktop +++ b/src/org.kde.amarok_containers.desktop @@ -87,7 +87,7 @@ GenericName[he]=נגן שמע GenericName[hne]=आडियो प्लेयर GenericName[hu]=Zenelejátszó -GenericName[id]=Pemain Audio +GenericName[id]=Pemutar Audio GenericName[is]=Tónlistarspilari GenericName[it]=Lettore audio GenericName[ja]=オーディオプレーヤー @@ -123,7 +123,6 @@ GenericName[uk]=Аудіопрогравач GenericName[wa]=Djouweu d' son GenericName[x-test]=xxAudio Playerxx -GenericName[zh_CN]=音频播放器 GenericName[zh_TW]=音效播放器 Exec=amarok %U Comment=Amarok - Rediscover Your Music! @@ -183,7 +182,6 @@ Comment[uk]=Amarok — відкрийте свою музику знову! Comment[wa]=Amarok - Ridiscovroz vosse muzike! Comment[x-test]=xxAmarok - Rediscover Your Music!xx -Comment[zh_CN]=Amarok - 重新探索您的音乐! Comment[zh_TW]=Amarok - 重新探索您的音樂世界! Icon=amarok # Add container formats here @@ -209,6 +207,7 @@ X-KDE-Keywords[it]=musica,podcast X-KDE-Keywords[ja]=music,podcast X-KDE-Keywords[km]=តន្ត្រី ផតខាស់ +X-KDE-Keywords[ko]=음악, 팟캐스트 X-KDE-Keywords[lt]=muzika,prenumerata X-KDE-Keywords[lv]=mūzika,podraide X-KDE-Keywords[nb]=musikk,podkasting @@ -228,7 +227,6 @@ X-KDE-Keywords[tr]=müzik,podcast X-KDE-Keywords[uk]=music,podcast,музика,трансляція,подкаст X-KDE-Keywords[x-test]=xxmusicxx,xxpodcastxx -X-KDE-Keywords[zh_CN]=music,podcast,音乐,播客 X-KDE-Keywords[zh_TW]=music,podcast X-KDE-Protocols=http Terminal=false diff --git a/src/playback/DelayedDoers.h b/src/playback/DelayedDoers.h --- a/src/playback/DelayedDoers.h +++ b/src/playback/DelayedDoers.h @@ -19,7 +19,7 @@ #include "amarok_export.h" -#include +#include #include #include @@ -72,7 +72,7 @@ void trackPositionChanged( qint64 position, bool userSeek ); protected: - virtual void performAction(); + void performAction() override; qint64 m_seekTo; bool m_startPaused; @@ -88,7 +88,7 @@ int trackNumber, qint64 seekTo, bool startPaused ); protected: - virtual void performAction(); + void performAction() override; private: Phonon::MediaController *m_mediaController; diff --git a/src/playback/DelayedDoers.cpp b/src/playback/DelayedDoers.cpp --- a/src/playback/DelayedDoers.cpp +++ b/src/playback/DelayedDoers.cpp @@ -18,8 +18,8 @@ #include "core/support/Debug.h" -#include -#include +#include +#include DelayedDoer::DelayedDoer( Phonon::MediaObject *mediaObject, const QSet &applicableStates ) @@ -60,7 +60,7 @@ DelayedSeeker::performAction() { m_mediaObject->seek( m_seekTo ); - emit trackPositionChanged( m_seekTo, /* userSeek */ true ); + Q_EMIT trackPositionChanged( m_seekTo, /* userSeek */ true ); if( !m_startPaused ) m_mediaObject->play(); @@ -85,7 +85,7 @@ if( m_seekTo ) { m_mediaObject->seek( m_seekTo ); - emit trackPositionChanged( m_seekTo, /* userSeek */ true ); + Q_EMIT trackPositionChanged( m_seekTo, /* userSeek */ true ); } if( !m_startPaused ) diff --git a/src/playback/EqualizerController.h b/src/playback/EqualizerController.h --- a/src/playback/EqualizerController.h +++ b/src/playback/EqualizerController.h @@ -26,8 +26,8 @@ #include -#include -#include +#include +#include static const int s_equalizerBandsNum = 10; // Number of equalizer parameters excluding Preamp @@ -37,7 +37,7 @@ public: - EqualizerController( QObject *object ); + explicit EqualizerController( QObject *object ); ~EqualizerController(); void initialize( const Phonon::Path &path ); @@ -99,20 +99,20 @@ Q_SIGNALS: /** - * Emitted when preset with index @param idnex is applied or the equalizer is disabled. - * index is <0 when disabled. + * Emitted when preset with index @param index is applied or the equalizer is disabled. + * index is \<0 when disabled. */ void presetApplied( int index ); /** * Emitted when the current gains are changed. */ - void gainsChanged( QList gains ); + void gainsChanged( const QList &gains ); /** * Emitted when preset @param name is added, removed or modified. */ - void presetsChanged( QString name ); + void presetsChanged( const QString &name ); private: QPointer m_equalizer; diff --git a/src/playback/EqualizerController.cpp b/src/playback/EqualizerController.cpp --- a/src/playback/EqualizerController.cpp +++ b/src/playback/EqualizerController.cpp @@ -31,8 +31,8 @@ #include -#include -#include +#include +#include EqualizerController::EqualizerController( QObject *object ) : QObject( object ) @@ -55,8 +55,8 @@ using namespace Phonon; // Add an equalizer effect if available - QList effects = BackendCapabilities::availableAudioEffects(); - QRegExp equalizerRegExp( QString( "equalizer.*%1.*bands" ).arg( s_equalizerBandsNum ), + const QList effects = BackendCapabilities::availableAudioEffects(); + QRegExp equalizerRegExp( QStringLiteral( "equalizer.*%1.*bands" ).arg( s_equalizerBandsNum ), Qt::CaseInsensitive ); foreach( const EffectDescription &description, effects ) { @@ -191,7 +191,7 @@ } } } - emit gainsChanged( equalizerParametersCfg ); + Q_EMIT gainsChanged( equalizerParametersCfg ); } QString @@ -201,7 +201,7 @@ if( index > 0 ) return EqualizerPresets::eqGlobalList()[index]; else - return QString(""); + return QString(); } void @@ -216,31 +216,31 @@ AmarokConfig::setEqualizerMode( 0 ); eqUpdate(); - emit presetApplied( index ); + Q_EMIT presetApplied( index ); } void EqualizerController::applyEqualizerPresetByName( const QString &name ) { DEBUG_BLOCK - int index = EqualizerPresets::eqGlobalTranslatedList().indexOf( name ); - return applyEqualizerPresetByIndex( index > 0 ? index : 0 ); + const int index = EqualizerPresets::eqGlobalTranslatedList().indexOf( name ); + applyEqualizerPresetByIndex( index > 0 ? index : 0 ); } void EqualizerController::savePreset( const QString &name, const QList &gains ) { EqualizerPresets::eqCfgSetPresetVal( name, gains ); - emit presetsChanged( name ); + Q_EMIT presetsChanged( name ); } bool EqualizerController::deletePreset( const QString &name ) { if( !EqualizerPresets::eqCfgDeletePreset( name ) ) return false; - emit presetsChanged( name ); + Q_EMIT presetsChanged( name ); return true; } diff --git a/src/playback/Fadeouter.cpp b/src/playback/Fadeouter.cpp --- a/src/playback/Fadeouter.cpp +++ b/src/playback/Fadeouter.cpp @@ -16,8 +16,8 @@ #include "Fadeouter.h" -#include -#include +#include +#include #include @@ -56,6 +56,6 @@ void Fadeouter::slotFinalizeFadeout() { - emit fadeoutFinished(); + Q_EMIT fadeoutFinished(); deleteLater(); } diff --git a/src/playback/PowerManager.h b/src/playback/PowerManager.h --- a/src/playback/PowerManager.h +++ b/src/playback/PowerManager.h @@ -30,7 +30,7 @@ Q_OBJECT public: - PowerManager( EngineController *engine ); + explicit PowerManager( EngineController *engine ); ~PowerManager(); private Q_SLOTS: diff --git a/src/playlist/PlaylistActions.h b/src/playlist/PlaylistActions.h --- a/src/playlist/PlaylistActions.h +++ b/src/playlist/PlaylistActions.h @@ -29,7 +29,7 @@ #include #include -#include +#include namespace Playlist { diff --git a/src/playlist/PlaylistActions.cpp b/src/playlist/PlaylistActions.cpp --- a/src/playlist/PlaylistActions.cpp +++ b/src/playlist/PlaylistActions.cpp @@ -30,7 +30,7 @@ #include "core/support/Amarok.h" #include "core/support/Components.h" #include "core/support/Debug.h" -#include "core/interfaces/Logger.h" +#include "core/logger/Logger.h" #include "core-impl/collections/support/CollectionManager.h" #include "core-impl/playlists/types/file/PlaylistFileSupport.h" #include "dynamic/DynamicModel.h" @@ -50,7 +50,7 @@ #include #include -Playlist::Actions* Playlist::Actions::s_instance = 0; +Playlist::Actions* Playlist::Actions::s_instance = nullptr; Playlist::Actions* Playlist::Actions::instance() { @@ -66,7 +66,7 @@ Playlist::Actions::destroy() { delete s_instance; - s_instance = 0; + s_instance = nullptr; } Playlist::Actions::Actions() @@ -276,7 +276,7 @@ { //HACK: Migrate the queue to the new navigator //TODO: The queue really should not be maintained by the navigators in this way - // but should be handled by a separate and persistant object. + // but should be handled by a separate and persistent object. currentQueue = m_navigator->queue(); m_navigator->deleteLater(); @@ -287,7 +287,7 @@ if ( AmarokConfig::dynamicMode() ) { m_navigator = new DynamicTrackNavigator(); - emit navigatorChanged(); + Q_EMIT navigatorChanged(); return; } @@ -335,7 +335,7 @@ m_navigator->queueIds( currentQueue ); - emit navigatorChanged(); + Q_EMIT navigatorChanged(); } void diff --git a/src/playlist/PlaylistBreadcrumbItem.h b/src/playlist/PlaylistBreadcrumbItem.h --- a/src/playlist/PlaylistBreadcrumbItem.h +++ b/src/playlist/PlaylistBreadcrumbItem.h @@ -43,7 +43,7 @@ * @param currentColumn The column corresponding to the current sort level * @param parent The parent QWidget */ - explicit BreadcrumbItemMenu( Column currentColumn, QWidget *parent = 0 ); + explicit BreadcrumbItemMenu( Column currentColumn, QWidget *parent = nullptr ); /** * Destructor. @@ -53,12 +53,12 @@ Q_SIGNALS: /** * Emitted when a non-Shuffle item is triggered from the menu. - * @param action the action in the menu that has been triggered. + * @param internalColName the internal name of the column in which the menu has been triggered. */ void actionClicked( QString internalColName ); /** - * Emmited when the Shuffle item is triggered from the menu. + * Emitted when the Shuffle item is triggered from the menu. */ void shuffleActionClicked(); @@ -84,7 +84,7 @@ * @param level The BreadcrumbLevel assigned to this item. * @param parent The parent QWidget. */ - explicit BreadcrumbItem( BreadcrumbLevel *level, QWidget *parent = 0 ); + explicit BreadcrumbItem( BreadcrumbLevel *level, QWidget *parent = nullptr ); /** * Destructor. @@ -154,7 +154,7 @@ /** * Constructor. */ - BreadcrumbAddMenuButton( QWidget *parent ); + explicit BreadcrumbAddMenuButton( QWidget *parent ); /** * Destructor. diff --git a/src/playlist/PlaylistBreadcrumbItem.cpp b/src/playlist/PlaylistBreadcrumbItem.cpp --- a/src/playlist/PlaylistBreadcrumbItem.cpp +++ b/src/playlist/PlaylistBreadcrumbItem.cpp @@ -39,9 +39,9 @@ } addSeparator(); - QAction *shuffleAction = addAction( QIcon::fromTheme( "media-playlist-shuffle" ), - QString( i18n( "Shuffle" ) ) ); - shuffleAction->setData( QString( "Shuffle" ) ); + QAction *shuffleAction = addAction( QIcon::fromTheme( QStringLiteral("media-playlist-shuffle") ), + i18n( "Shuffle" ) ); + shuffleAction->setData( QStringLiteral( "Shuffle" ) ); connect( this, &BreadcrumbItemMenu::triggered, this, &BreadcrumbItemMenu::actionTriggered ); } @@ -53,10 +53,10 @@ BreadcrumbItemMenu::actionTriggered( QAction *action ) { const QString actionName( action->data().toString() ); - if( actionName == "Shuffle" ) - emit shuffleActionClicked(); + if( actionName == QLatin1String("Shuffle") ) + Q_EMIT shuffleActionClicked(); else - emit actionClicked( actionName ); + Q_EMIT actionClicked( actionName ); } /////// BreadcrumbItem methods begin here diff --git a/src/playlist/PlaylistBreadcrumbItemSortButton.h b/src/playlist/PlaylistBreadcrumbItemSortButton.h --- a/src/playlist/PlaylistBreadcrumbItemSortButton.h +++ b/src/playlist/PlaylistBreadcrumbItemSortButton.h @@ -37,14 +37,12 @@ * Constructor. * @param parent the parent QWidget. */ - BreadcrumbItemSortButton( QWidget *parent ); + explicit BreadcrumbItemSortButton( QWidget *parent ); /** * Constructor, nontrivial. * @param icon the icon to paint on the button. * @param text the text to show on the button. - * @param noArrows true if the button should be shown without order inversion arrows, - * otherwise false. * @param parent the parent QWidget. */ BreadcrumbItemSortButton( const QIcon &icon, const QString &text, QWidget *parent ); @@ -58,7 +56,7 @@ * Returns the recommended size for the button depending on the contents. * @return the recommended size. */ - virtual QSize sizeHint() const; + QSize sizeHint() const override; /** * Returns the state of the sort order defined by the order inversion arrow. @@ -74,41 +72,41 @@ Q_SIGNALS: /** * Emitted when the order inversion arrow has been toggled. - * @sortOrder the new sort order based on the position of the arrow. + * @p sortOrder the new sort order based on the position of the arrow. */ void arrowToggled( Qt::SortOrder ); protected: /** * Repaints the widget. * @param event the triggered QPaintEvent as provided by Qt. */ - virtual void paintEvent( QPaintEvent *event ); + void paintEvent( QPaintEvent *event ) override; /** * Checks if the mouse is hovering the arrow rectangle. * @param e the triggered QMouseEvent as provided by Qt. */ - virtual void mouseMoveEvent( QMouseEvent *e ); + void mouseMoveEvent( QMouseEvent *e ) override; /** * Handles the beginning of a mouse click. * @param e the triggered QMouseEvent as provided by Qt. */ - virtual void mousePressEvent( QMouseEvent *e ); + void mousePressEvent( QMouseEvent *e ) override; /** * Handles the release of the mouse button which completes a click action. * @param e the triggered QMouseEvent as provided by Qt. */ - virtual void mouseReleaseEvent( QMouseEvent *e ); + void mouseReleaseEvent( QMouseEvent *e ) override; /** * Reimplemented from BreadcrumbItemButton, handles the painting of the widget's * background, used by paintEvent(). * @param painter the QPainter object used by paintEvent(). */ - virtual void drawHoverBackground( QPainter *painter ); + void drawHoverBackground( QPainter *painter ) override; private: /** diff --git a/src/playlist/PlaylistBreadcrumbItemSortButton.cpp b/src/playlist/PlaylistBreadcrumbItemSortButton.cpp --- a/src/playlist/PlaylistBreadcrumbItemSortButton.cpp +++ b/src/playlist/PlaylistBreadcrumbItemSortButton.cpp @@ -54,7 +54,7 @@ BreadcrumbItemSortButton::init() { setMouseTracking( true ); - emit arrowToggled( m_order ); + Q_EMIT arrowToggled( m_order ); repaint(); } @@ -155,7 +155,7 @@ m_order = Qt::AscendingOrder; else //ascending m_order = Qt::DescendingOrder; - emit arrowToggled( m_order ); + Q_EMIT arrowToggled( m_order ); repaint(); } diff --git a/src/playlist/PlaylistBreadcrumbLevel.h b/src/playlist/PlaylistBreadcrumbLevel.h --- a/src/playlist/PlaylistBreadcrumbLevel.h +++ b/src/playlist/PlaylistBreadcrumbLevel.h @@ -36,7 +36,7 @@ /** * Constructor. */ - BreadcrumbLevel( QString internalColumnName ); + explicit BreadcrumbLevel(const QString &internalColumnName ); /** * Destructor. diff --git a/src/playlist/PlaylistBreadcrumbLevel.cpp b/src/playlist/PlaylistBreadcrumbLevel.cpp --- a/src/playlist/PlaylistBreadcrumbLevel.cpp +++ b/src/playlist/PlaylistBreadcrumbLevel.cpp @@ -23,7 +23,7 @@ namespace Playlist { -BreadcrumbLevel::BreadcrumbLevel( QString internalColumnName ) +BreadcrumbLevel::BreadcrumbLevel( const QString &internalColumnName ) : m_name( internalColumnName ) { Column col = columnForName( internalColumnName ); diff --git a/src/playlist/PlaylistController.h b/src/playlist/PlaylistController.h --- a/src/playlist/PlaylistController.h +++ b/src/playlist/PlaylistController.h @@ -152,8 +152,8 @@ /** * Moves a track from one row to another in the playlist. - * @param from the row containing the track that is about to be moved. - * @param to the target row where the track should be moved. + * @param topModelFrom the row containing the track that is about to be moved. + * @param topModelTo the target row where the track should be moved. */ void moveRow( int topModelFrom, int topModelTo ); @@ -175,8 +175,8 @@ * 4 Charlie * 5 Foxtrot * and the function will return 2, because that's where the rows really ended up. - * @param from the list of rows containing the tracks that are about to be moved. - * @param to the target row where the tracks should be moved. + * @param topModelFrom the list of rows containing the tracks that are about to be moved. + * @param topModelTo the target row where the tracks should be moved. * @return the first row where the tracks ended up in the new list. */ int moveRows( QList& topModelFrom, int topModelTo ); diff --git a/src/playlist/PlaylistController.cpp b/src/playlist/PlaylistController.cpp --- a/src/playlist/PlaylistController.cpp +++ b/src/playlist/PlaylistController.cpp @@ -59,12 +59,12 @@ } -Controller* Controller::s_instance = 0; +Controller* Controller::s_instance = nullptr; Controller* Controller::instance() { - if( s_instance == 0 ) + if( s_instance == nullptr ) s_instance = new Controller(); return s_instance; } @@ -75,7 +75,7 @@ if( s_instance ) { delete s_instance; - s_instance = 0; + s_instance = nullptr; } } @@ -136,10 +136,10 @@ if( options.testFlag( Replace ) ) { - emit replacingPlaylist(); //make sure that we clear filters + Q_EMIT replacingPlaylist(); //make sure that we clear filters clear(); //make sure that we turn off dynamic mode. - Amarok::actionCollection()->action( "disable_dynamic" )->trigger(); + Amarok::actionCollection()->action( QStringLiteral("disable_dynamic") )->trigger(); } int bottomModelRowCount = m_bottomModel->qaim()->rowCount(); @@ -219,7 +219,7 @@ if( startPlaying ) Actions::instance()->requestUserNextTrack(); // desired track will be first in queue - emit changed(); + Q_EMIT changed(); } void @@ -349,7 +349,7 @@ if( bottomModelCmds.size() > 0 ) m_undoStack->push( new RemoveTracksCmd( 0, bottomModelCmds ) ); - emit changed(); + Q_EMIT changed(); } void @@ -381,7 +381,7 @@ if( !topModelRowsToRemove.empty() ) { - m_undoStack->beginMacro( "Remove dead and duplicate entries" ); // TODO: Internationalize? + m_undoStack->beginMacro( QStringLiteral("Remove dead and duplicate entries") ); // TODO: Internationalize? removeRows( topModelRowsToRemove ); m_undoStack->endMacro(); } @@ -508,31 +508,31 @@ if( bottomModelCmds.size() > 0 ) m_undoStack->push( new MoveTracksCmd( 0, bottomModelCmds ) ); - emit changed(); + Q_EMIT changed(); } void Controller::undo() { DEBUG_BLOCK m_undoStack->undo(); - emit changed(); + Q_EMIT changed(); } void Controller::redo() { DEBUG_BLOCK m_undoStack->redo(); - emit changed(); + Q_EMIT changed(); } void Controller::clear() { DEBUG_BLOCK removeRows( 0, ModelStack::instance()->bottom()->qaim()->rowCount() ); - emit changed(); + Q_EMIT changed(); } /************************************************** @@ -612,7 +612,7 @@ { /*ignore*/ } - else if( typeid( *track.data() ) == typeid( MetaFile::Track ) ) + else if( MetaFile::TrackPtr::dynamicCast( track ) ) { QUrl cuesheet = MetaCue::CueFileSupport::locateCueSheet( track->playableUrl() ); if( !cuesheet.isEmpty() ) @@ -622,7 +622,7 @@ { Meta::TrackList cueTracks = MetaCue::CueFileSupport::generateTimeCodeTracks( track, cueMap ); if( !cueTracks.isEmpty() ) - modifiedList << cueTracks; + modifiedList << cueTracks; else modifiedList << track; } @@ -646,5 +646,5 @@ if( bottomModelCmds.size() > 0 ) m_undoStack->push( new InsertTracksCmd( 0, bottomModelCmds ) ); - emit changed(); + Q_EMIT changed(); } diff --git a/src/playlist/PlaylistDefines.cpp b/src/playlist/PlaylistDefines.cpp --- a/src/playlist/PlaylistDefines.cpp +++ b/src/playlist/PlaylistDefines.cpp @@ -40,40 +40,40 @@ //this list is used internally and for reading writing config files and sths should not be translated! s_internalNames = new QStringList(); - *s_internalNames << QLatin1String( "Placeholder" ) - << QLatin1String( "Album" ) - << QLatin1String( "Album artist" ) - << QLatin1String( "Artist" ) - << QLatin1String( "Bitrate" ) - << QLatin1String( "Bpm" ) - << QLatin1String( "Comment" ) - << QLatin1String( "Composer" ) - << QLatin1String( "Cover image" ) - << QLatin1String( "Directory" ) - << QLatin1String( "Disc number" ) - << QLatin1String( "Divider" ) - << QLatin1String( "File name" ) - << QLatin1String( "File size" ) - << QLatin1String( "Genre" ) - << QLatin1String( "Group length" ) - << QLatin1String( "Group tracks" ) - << QLatin1String( "Labels" ) - << QLatin1String( "Last played" ) - << QLatin1String( "Length" ) - << QLatin1String( "Length (seconds)" ) - << QLatin1String( "Mood" ) - << QLatin1String( "Moodbar" ) - << QLatin1String( "Play count" ) - << QLatin1String( "Rating" ) - << QLatin1String( "Sample rate" ) - << QLatin1String( "Score" ) - << QLatin1String( "Source" ) - << QLatin1String( "SourceEmblem" ) - << QLatin1String( "Title" ) - << QLatin1String( "Title (with track number)" ) - << QLatin1String( "Track number" ) - << QLatin1String( "Type" ) - << QLatin1String( "Year" ); + *s_internalNames << QStringLiteral( "Placeholder" ) + << QStringLiteral( "Album" ) + << QStringLiteral( "Album artist" ) + << QStringLiteral( "Artist" ) + << QStringLiteral( "Bitrate" ) + << QStringLiteral( "Bpm" ) + << QStringLiteral( "Comment" ) + << QStringLiteral( "Composer" ) + << QStringLiteral( "Cover image" ) + << QStringLiteral( "Directory" ) + << QStringLiteral( "Disc number" ) + << QStringLiteral( "Divider" ) + << QStringLiteral( "File name" ) + << QStringLiteral( "File size" ) + << QStringLiteral( "Genre" ) + << QStringLiteral( "Group length" ) + << QStringLiteral( "Group tracks" ) + << QStringLiteral( "Labels" ) + << QStringLiteral( "Last played" ) + << QStringLiteral( "Length" ) + << QStringLiteral( "Length (seconds)" ) + << QStringLiteral( "Mood" ) + << QStringLiteral( "Moodbar" ) + << QStringLiteral( "Play count" ) + << QStringLiteral( "Rating" ) + << QStringLiteral( "Sample rate" ) + << QStringLiteral( "Score" ) + << QStringLiteral( "Source" ) + << QStringLiteral( "SourceEmblem" ) + << QStringLiteral( "Title" ) + << QStringLiteral( "Title (with track number)" ) + << QStringLiteral( "Track number" ) + << QStringLiteral( "Type" ) + << QStringLiteral( "Year" ); } return *s_internalNames; @@ -133,35 +133,35 @@ // the order is important. See PlaylistDefines // should be kept in sync with Meta::iconForField() for shared fields s_icons = new QStringList(); - *s_icons << "filename-space-amarok" + *s_icons << QStringLiteral("filename-space-amarok") << Meta::iconForField( Meta::valAlbum ) << Meta::iconForField( Meta::valAlbumArtist ) << Meta::iconForField( Meta::valArtist ) << Meta::iconForField( Meta::valBitrate ) << Meta::iconForField( Meta::valBpm ) << Meta::iconForField( Meta::valComment ) << Meta::iconForField( Meta::valComposer ) - << "" // cover image - << "folder-blue" // directory + << QLatin1String("") // cover image + << QStringLiteral("folder-blue") // directory << Meta::iconForField( Meta::valDiscNr ) - << "filename-divider" - << "filename-filetype-amarok" // filename + << QStringLiteral("filename-divider") + << QStringLiteral("filename-filetype-amarok") // filename << Meta::iconForField( Meta::valFilesize ) << Meta::iconForField( Meta::valGenre ) - << "filename-group-length" - << "filename-group-tracks" + << QStringLiteral("filename-group-length") + << QStringLiteral("filename-group-tracks") << Meta::iconForField( Meta::valLabel ) << Meta::iconForField( Meta::valLastPlayed ) << Meta::iconForField( Meta::valLength ) << Meta::iconForField( Meta::valLength ) - << "" - << "filename-moodbar" + << QLatin1String("") + << QStringLiteral("filename-moodbar") << Meta::iconForField( Meta::valPlaycount ) << Meta::iconForField( Meta::valRating ) << Meta::iconForField( Meta::valSamplerate ) << Meta::iconForField( Meta::valScore ) - << "applications-internet" - << "" // source emblem + << QStringLiteral("internet-services") + << QLatin1String("") // source emblem << Meta::iconForField( Meta::valTitle ) << Meta::iconForField( Meta::valTitle ) << Meta::iconForField( Meta::valTrackNr ) diff --git a/src/playlist/PlaylistDock.h b/src/playlist/PlaylistDock.h --- a/src/playlist/PlaylistDock.h +++ b/src/playlist/PlaylistDock.h @@ -16,8 +16,8 @@ * this program. If not, see . * ****************************************************************************************/ -#ifndef AMAROK_PLAYLISTWIDGET_H -#define AMAROK_PLAYLISTWIDGET_H +#ifndef AMAROK_PLAYLISTDOCK_H +#define AMAROK_PLAYLISTDOCK_H #include "PlaylistSortWidget.h" #include "view/listview/PrettyListView.h" @@ -48,21 +48,21 @@ Q_OBJECT public: - Dock( QWidget* parent ); + explicit Dock( QWidget* parent ); PrettyListView *currentView(); SortWidget *sortWidget(); ProgressiveSearchWidget *searchWidget(); void showActiveTrack(); void editTrackInfo(); - void polish(); + void polish() override; public Q_SLOTS: void clearFilterIfActive(); void slotEditQueue(); protected: - QSize sizeHint() const; + QSize sizeHint() const override; private Q_SLOTS: /** show or hide the dynamic playlist mode indicator */ diff --git a/src/playlist/PlaylistDock.cpp b/src/playlist/PlaylistDock.cpp --- a/src/playlist/PlaylistDock.cpp +++ b/src/playlist/PlaylistDock.cpp @@ -50,15 +50,15 @@ #include #include -static const QString s_dynMode( "dynamic_mode" ); -static const QString s_repopulate( "repopulate" ); -static const QString s_turnOff( "turn_off" ); +static const QString s_dynMode( QStringLiteral("dynamic_mode") ); +static const QString s_repopulate( QStringLiteral("repopulate") ); +static const QString s_turnOff( QStringLiteral("turn_off") ); Playlist::Dock::Dock( QWidget* parent ) : AmarokDockWidget( i18n( "&Playlist" ), parent ) , m_barBox( 0 ) { - setObjectName( "Playlist dock" ); + setObjectName( QStringLiteral("Playlist dock") ); setAllowedAreas( Qt::AllDockWidgetAreas ); } @@ -146,7 +146,7 @@ connect( The::mainWindow(), &MainWindow::switchQueueStateShortcut, m_playlistView, &Playlist::PrettyListView::switchQueueState ); - KConfigGroup searchConfig = Amarok::config("Playlist Search"); + KConfigGroup searchConfig = Amarok::config(QStringLiteral("Playlist Search")); m_playlistView->showOnlyMatches( searchConfig.readEntry( "ShowOnlyMatches", false ) ); connect( m_playlistView, &Playlist::PrettyListView::found, m_searchWidget, &Playlist::ProgressiveSearchWidget::match ); @@ -163,7 +163,7 @@ { // START: Playlist toolbar // action toolbar m_barBox = new BoxWidget( false, m_mainWidget ); - m_barBox->setObjectName( "PlaylistBarBox" ); + m_barBox->setObjectName( QStringLiteral("PlaylistBarBox") ); m_barBox->setContentsMargins( 0, 0, 4, 0 ); m_barBox->setFixedHeight( 36 ); @@ -173,11 +173,11 @@ plBar->setMovable( false ); QActionGroup *playlistActions = new QActionGroup( m_mainWidget ); - playlistActions->addAction( Amarok::actionCollection()->action( "playlist_clear" ) ); + playlistActions->addAction( Amarok::actionCollection()->action( QStringLiteral("playlist_clear") ) ); - m_savePlaylistMenu = new KActionMenu( QIcon::fromTheme( "document-save-amarok" ), + m_savePlaylistMenu = new KActionMenu( QIcon::fromTheme( QStringLiteral("document-save-amarok") ), i18n("&Save Current Playlist"), m_mainWidget ); - m_savePlaylistMenu->addAction( Amarok::actionCollection()->action( "playlist_export" ) ); + m_savePlaylistMenu->addAction( Amarok::actionCollection()->action( QStringLiteral("playlist_export") ) ); m_saveActions = new KActionCollection( m_mainWidget ); @@ -196,10 +196,10 @@ playlistActions->addAction( m_savePlaylistMenu ); - playlistActions->addAction( Amarok::actionCollection()->action( "playlist_undo" ) ); + playlistActions->addAction( Amarok::actionCollection()->action( QStringLiteral("playlist_undo") ) ); //redo action can be accessed from menu > Playlist - playlistActions->addAction( Amarok::actionCollection()->action( "show_active_track" ) ); + playlistActions->addAction( Amarok::actionCollection()->action( QStringLiteral("show_active_track") ) ); plBar->addCollapsibleActions( playlistActions ); @@ -273,7 +273,7 @@ m_saveActions->addAction( QString::number( (qlonglong) userProvider ), action ); // insert the playlist provider actions before "export" - QAction* exportAction = Amarok::actionCollection()->action( "playlist_export" ); + QAction* exportAction = Amarok::actionCollection()->action( QStringLiteral("playlist_export") ); m_savePlaylistMenu->insertAction( exportAction, action ); connect( action, &QAction::triggered, this, &Playlist::Dock::slotSaveCurrentPlaylist ); } @@ -348,7 +348,7 @@ Playlist::Dock::clearFilterIfActive() // slot { DEBUG_BLOCK - KConfigGroup config = Amarok::config( "Playlist Search" ); + KConfigGroup config = Amarok::config( QStringLiteral("Playlist Search") ); bool filterActive = config.readEntry( "ShowOnlyMatches", true ); if( filterActive ) @@ -359,7 +359,7 @@ Playlist::Dock::slotDynamicHintLinkActivated( const QString &href ) { if( href == s_dynMode ) - AmarokUrl( "amarok://navigate/playlists/dynamic category" ).run(); + AmarokUrl( QStringLiteral("amarok://navigate/playlists/dynamic category") ).run(); else if( href == s_repopulate ) The::playlistActions()->repopulateDynamicPlaylist(); else if( href == s_turnOff ) diff --git a/src/playlist/PlaylistInfoWidget.h b/src/playlist/PlaylistInfoWidget.h --- a/src/playlist/PlaylistInfoWidget.h +++ b/src/playlist/PlaylistInfoWidget.h @@ -15,6 +15,9 @@ * this program. If not, see . * ****************************************************************************************/ +#ifndef AMAROK_PLAYLISTINFOWIDGET_H +#define AMAROK_PLAYLISTINFOWIDGET_H + #include /** A small widget that displays the current length and size of the playlist. @@ -24,13 +27,14 @@ Q_OBJECT public: - explicit PlaylistInfoWidget( QWidget* parent = 0 ); + explicit PlaylistInfoWidget( QWidget* parent = nullptr ); virtual ~PlaylistInfoWidget(); protected: - bool event( QEvent *event ); + bool event( QEvent *event ) override; private Q_SLOTS: void updateTotalPlaylistLength(); }; +#endif diff --git a/src/playlist/PlaylistItem.h b/src/playlist/PlaylistItem.h --- a/src/playlist/PlaylistItem.h +++ b/src/playlist/PlaylistItem.h @@ -43,7 +43,7 @@ static void listRemove( QList &target, QSet &removeSet ); Item(); - Item( Meta::TrackPtr track ); + explicit Item( const Meta::TrackPtr &track ); ~Item(); const Meta::TrackPtr& track() const; diff --git a/src/playlist/PlaylistItem.cpp b/src/playlist/PlaylistItem.cpp --- a/src/playlist/PlaylistItem.cpp +++ b/src/playlist/PlaylistItem.cpp @@ -34,7 +34,7 @@ { } -Playlist::Item::Item( Meta::TrackPtr track ) +Playlist::Item::Item( const Meta::TrackPtr &track ) : m_track( track ), m_state( NewlyAdded ) { m_id = ( static_cast( KRandom::random() ) << 32 ) | static_cast( KRandom::random() ); diff --git a/src/playlist/PlaylistModel.h b/src/playlist/PlaylistModel.h --- a/src/playlist/PlaylistModel.h +++ b/src/playlist/PlaylistModel.h @@ -33,9 +33,8 @@ #include #include -#include +#include -class AmarokMimeData; class QMimeData; class QModelIndex; class TestPlaylistModels; @@ -53,56 +52,56 @@ Q_OBJECT public: - Model( QObject *parent = 0 ); + explicit Model( QObject *parent = nullptr ); ~Model(); // Inherited from QAbstractItemModel (via QAbstractListModel) - int columnCount( const QModelIndex& parent = QModelIndex() ) const { Q_UNUSED( parent ); return NUM_COLUMNS; } - QVariant data( const QModelIndex& index, int role ) const; - bool dropMimeData( const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent ); - Qt::ItemFlags flags( const QModelIndex &index ) const; - QVariant headerData( int section, Qt::Orientation orientation, int role ) const; - QMimeData* mimeData( const QModelIndexList &indexes ) const; - QStringList mimeTypes() const; - int rowCount( const QModelIndex& parent = QModelIndex() ) const { Q_UNUSED( parent ); return m_items.size(); } - Qt::DropActions supportedDropActions() const; + int columnCount( const QModelIndex& parent = QModelIndex() ) const override { Q_UNUSED( parent ); return NUM_COLUMNS; } + QVariant data( const QModelIndex& index, int role ) const override; + bool dropMimeData( const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent ) override; + Qt::ItemFlags flags( const QModelIndex &index ) const override; + QVariant headerData( int section, Qt::Orientation orientation, int role ) const override; + QMimeData* mimeData( const QModelIndexList &indexes ) const override; + QStringList mimeTypes() const override; + int rowCount( const QModelIndex& parent = QModelIndex() ) const override { Q_UNUSED( parent ); return m_items.size(); } + Qt::DropActions supportedDropActions() const override; // Inherited from Playlist::AbstractModel - QAbstractItemModel* qaim() const { return const_cast( this ); } - - quint64 activeId() const; - Meta::TrackPtr activeTrack() const; - int activeRow() const { return m_activeRow; } // returns -1 if there is no active row - - bool containsTrack( const Meta::TrackPtr& track ) const; - int firstRowForTrack( const Meta::TrackPtr& track ) const; - QSet allRowsForTrack( const Meta::TrackPtr& track ) const; - - quint64 idAt( const int row ) const; - bool rowExists( int row ) const { return (( row >= 0 ) && ( row < m_items.size() ) ); } - int rowForId( const quint64 id ) const; // returns -1 if the id is invalid - int rowFromBottomModel( const int row ) { return row; } - int rowToBottomModel( const int row ) { return row; } - void setActiveId( const quint64 id ) { setActiveRow( rowForId( id ) ); } - void setActiveRow( int row ); + QAbstractItemModel* qaim() const override { return const_cast( this ); } + + quint64 activeId() const override; + Meta::TrackPtr activeTrack() const override; + int activeRow() const override { return m_activeRow; } // returns -1 if there is no active row + + bool containsTrack( const Meta::TrackPtr& track ) const override; + int firstRowForTrack( const Meta::TrackPtr& track ) const override; + QSet allRowsForTrack( const Meta::TrackPtr& track ) const override; + + quint64 idAt( const int row ) const override; + bool rowExists( int row ) const override { return (( row >= 0 ) && ( row < m_items.size() ) ); } + int rowForId( const quint64 id ) const override; // returns -1 if the id is invalid + int rowFromBottomModel( const int row ) override { return row; } + int rowToBottomModel( const int row ) override { return row; } + void setActiveId( const quint64 id ) override { setActiveRow( rowForId( id ) ); } + void setActiveRow( int row ) override; void setAllNewlyAddedToUnplayed(); - void setAllUnplayed(); - void emitQueueChanged(); - int queuePositionOfRow( int row ); - Item::State stateOfId( quint64 id ) const; - Item::State stateOfRow( int row ) const; - qint64 totalLength() const { return m_totalLength; } - quint64 totalSize() const { return m_totalSize; } - Meta::TrackPtr trackAt( int row ) const; - Meta::TrackPtr trackForId( const quint64 id ) const; - - virtual bool exportPlaylist( const QString &path, bool relative = false ) const; - virtual Meta::TrackList tracks() const; + void setAllUnplayed() override; + void emitQueueChanged() override; + int queuePositionOfRow( int row ) override; + Item::State stateOfId( quint64 id ) const override; + Item::State stateOfRow( int row ) const override; + qint64 totalLength() const override { return m_totalLength; } + quint64 totalSize() const override { return m_totalSize; } + Meta::TrackPtr trackAt( int row ) const override; + Meta::TrackPtr trackForId( const quint64 id ) const override; + + bool exportPlaylist( const QString &path, bool relative = false ) override; + Meta::TrackList tracks() override; // Inherited from Meta::Observer using Observer::metadataChanged; - void metadataChanged( Meta::TrackPtr track ); - void metadataChanged( Meta::AlbumPtr album ); + void metadataChanged( const Meta::TrackPtr &track ) override; + void metadataChanged( const Meta::AlbumPtr &album ) override; // static member functions static QString prettyColumnName( Column index ); //!< takes a Column enum and returns its string name @@ -129,9 +128,9 @@ // Inherited from QAbstractItemModel. Make them private so that nobody is tempted to use them. bool insertRow( int, const QModelIndex& parent = QModelIndex() ) { Q_UNUSED( parent ); return false; } - bool insertRows( int, int, const QModelIndex& parent = QModelIndex() ) { Q_UNUSED( parent ); return false; } + bool insertRows( int, int, const QModelIndex& parent = QModelIndex() ) override { Q_UNUSED( parent ); return false; } bool removeRow( int, const QModelIndex& parent = QModelIndex() ) { Q_UNUSED( parent ); return false; } - bool removeRows( int, int, const QModelIndex& parent = QModelIndex() ) { Q_UNUSED( parent ); return false; } + bool removeRows( int, int, const QModelIndex& parent = QModelIndex() ) override { Q_UNUSED( parent ); return false; } // These functions do the real work of modifying the playlist, and should be called ONLY by UndoCommands void insertTracksCommand( const InsertCmdList& ); diff --git a/src/playlist/PlaylistModel.cpp b/src/playlist/PlaylistModel.cpp --- a/src/playlist/PlaylistModel.cpp +++ b/src/playlist/PlaylistModel.cpp @@ -75,9 +75,9 @@ { // filter-out HTML tags.. QString text( origText ); - text.replace( '&', "&" ); // needs to be first, obviously - text.replace( '<', "<" ); - text.replace( '>', ">" ); + text.replace( '&', QLatin1String("&") ); // needs to be first, obviously + text.replace( '<', QLatin1String("<") ); + text.replace( '>', QLatin1String(">") ); // Now let's break up long lines so that the tooltip doesn't become hideously large if( fitsInOneLineHTML( text ) ) @@ -98,7 +98,7 @@ { if (lineLength > 0) { - textInLines += "
"; + textInLines += QLatin1String("
"); } lineLength = 0; // Let's check if the next word is not too long for the new line to contain @@ -122,21 +122,22 @@ /** * Prepares a row for the playlist tooltips consisting of an icon representing * an mp3 tag and its value -* @param column The colunm used to display the icon +* @param column The column used to display the icon * @param value The QString value to be shown +* @param force If @c true, allows to set empty values * @return The line to be shown or an empty QString if the value is null */ static QString HTMLLine( const Playlist::Column& column, const QString& value, bool force = false ) { if( !value.isEmpty() || force ) { QString line; - line += "
"; + line += QLatin1String(""); return line; } else @@ -146,15 +147,16 @@ /** * Prepares a row for the playlist tooltips consisting of an icon representing * an mp3 tag and its value -* @param column The colunm used to display the icon +* @param column The column used to display the icon * @param value The integer value to be shown +* @param force If @c true, allows to set non-positive values * @return The line to be shown or an empty QString if the value is 0 */ static QString HTMLLine( const Playlist::Column& column, const int value, bool force = false ) { - // there is currenly no numeric meta-data that would have sense if it were negative. - // also, zero denotes not available, unknow etc; don't show these unless forced. + // there is currently no numeric meta-data that would have sense if it were negative. + // also, zero denotes not available, unknown etc; don't show these unless forced. if( value > 0 || force ) { return HTMLLine( column, QString::number( value ) ); @@ -312,7 +314,7 @@ if( label ) labels << label->name(); } - text += HTMLLine( Playlist::Labels, labels.join( QString(", ") ) ); + text += HTMLLine( Playlist::Labels, labels.join( QStringLiteral(", ") ) ); } if( s_tooltipColumns[Playlist::Score] ) @@ -331,7 +333,7 @@ text += HTMLLine( Playlist::Bitrate, i18nc( "%1: bitrate", "%1 kbps", track->bitrate() ) ); if( text.isEmpty() ) - text = QString( i18n( "No extra information available" ) ); + text = i18n( "No extra information available" ); else text = QString(""+ text +"
"); @@ -485,7 +487,7 @@ { labelNames << label->prettyName(); } - return labelNames.join( ", " ); + return labelNames.join( QStringLiteral(", ") ); } break; } @@ -618,7 +620,7 @@ { QStringList ret = QAbstractListModel::mimeTypes(); ret << AmarokMimeData::TRACK_MIME; - ret << "text/uri-list"; //we do accept urls + ret << QStringLiteral("text/uri-list"); //we do accept urls return ret; } @@ -719,19 +721,19 @@ { setStateOfRow( row, Item::Played ); m_activeRow = row; - emit activeTrackChanged( m_items.at( row )->id() ); + Q_EMIT activeTrackChanged( m_items.at( row )->id() ); } else { m_activeRow = -1; - emit activeTrackChanged( 0 ); + Q_EMIT activeTrackChanged( 0 ); } } void Playlist::Model::emitQueueChanged() { - emit queueChanged(); + Q_EMIT queueChanged(); } int @@ -851,7 +853,7 @@ } void -Playlist::Model::metadataChanged( Meta::TrackPtr track ) +Playlist::Model::metadataChanged(const Meta::TrackPtr &track ) { int row = 0; foreach( Item* i, m_items ) @@ -863,14 +865,14 @@ if( album ) subscribeTo( album ); - emit dataChanged( index( row, 0 ), index( row, columnCount() - 1 ) ); + Q_EMIT dataChanged( index( row, 0 ), index( row, columnCount() - 1 ) ); } row++; } } void -Playlist::Model::metadataChanged( Meta::AlbumPtr album ) +Playlist::Model::metadataChanged(const Meta::AlbumPtr &album ) { // Mainly to get update about changed covers @@ -881,7 +883,7 @@ { if ( m_items.at( i )->track()->album() == album ) { - emit dataChanged( index( i, 0 ), index( i, columnCount() - 1 ) ); + Q_EMIT dataChanged( index( i, 0 ), index( i, columnCount() - 1 ) ); found = true; debug()<<"Metadata updated for album"<prettyName(); } @@ -894,7 +896,7 @@ } bool -Playlist::Model::exportPlaylist( const QString &path, bool relative ) const +Playlist::Model::exportPlaylist( const QString &path, bool relative ) { // check queue state QQueue queueIds = The::playlistActions()->queue(); @@ -906,7 +908,7 @@ } Meta::TrackList -Playlist::Model::tracks() const +Playlist::Model::tracks() { Meta::TrackList tl; foreach( Item* item, m_items ) @@ -942,7 +944,7 @@ case LastPlayed: return i18nc( "Column name", "Last Played" ); case Mood: return i18n( "Mood" ); case Filesize: return i18n( "File Size" ); - default: return "This is a bug."; + default: return QStringLiteral("This is a bug."); } } @@ -1188,14 +1190,14 @@ // - Call 'beginMoveRows()' / 'endMoveRows()'. Drawback: we'd need to do N of them, all causing resorts etc. // - Emit 'layoutAboutToChange' / 'layoutChanged'. Drawback: unspecific, 'changePersistentIndex()' complications. // - Emit 'dataChanged'. Drawback: a bit inappropriate. But not wrong. - emit dataChanged( index( min, 0 ), index( max, columnCount() - 1 ) ); + Q_EMIT dataChanged( index( min, 0 ), index( max, columnCount() - 1 ) ); //update the active row m_activeRow = newActiveRow; } -// When doing a 'setStateOfItem_batch', we emit 1 crude 'dataChanged' signal. If we're +// When doing a 'setStateOfItem_batch', we Q_EMIT 1 crude 'dataChanged' signal. If we're // unlucky, that signal may span many innocent rows that haven't changed at all. // Although that "worst case" will cause unnecessary work in our listeners "upstream", it // still has much better performance than the worst case of emitting very many tiny @@ -1213,7 +1215,7 @@ Playlist::Model::setStateOfItem_batchEnd() { if ( ( m_setStateOfItem_batchMaxRow - m_setStateOfItem_batchMinRow ) >= 0 ) - emit dataChanged( index( m_setStateOfItem_batchMinRow, 0 ), index( m_setStateOfItem_batchMaxRow, columnCount() - 1 ) ); + Q_EMIT dataChanged( index( m_setStateOfItem_batchMinRow, 0 ), index( m_setStateOfItem_batchMaxRow, columnCount() - 1 ) ); m_setStateOfItem_batchMinRow = -1; } @@ -1224,7 +1226,7 @@ item->setState( state ); if ( m_setStateOfItem_batchMinRow == -1 ) // If not in batch mode - emit dataChanged( index( row, 0 ), index( row, columnCount() - 1 ) ); + Q_EMIT dataChanged( index( row, 0 ), index( row, columnCount() - 1 ) ); else { m_setStateOfItem_batchMinRow = qMin( m_setStateOfItem_batchMinRow, row ); diff --git a/src/playlist/PlaylistModelStack.cpp b/src/playlist/PlaylistModelStack.cpp --- a/src/playlist/PlaylistModelStack.cpp +++ b/src/playlist/PlaylistModelStack.cpp @@ -32,12 +32,12 @@ namespace Playlist { -ModelStack* ModelStack::s_instance = 0; +ModelStack* ModelStack::s_instance = nullptr; ModelStack* ModelStack::instance() { - if( s_instance == 0 ) + if( s_instance == nullptr ) s_instance = new ModelStack(); return s_instance; } @@ -48,7 +48,7 @@ if( s_instance ) { delete s_instance; - s_instance = 0; + s_instance = nullptr; } } diff --git a/src/playlist/PlaylistQueueEditor.h b/src/playlist/PlaylistQueueEditor.h --- a/src/playlist/PlaylistQueueEditor.h +++ b/src/playlist/PlaylistQueueEditor.h @@ -16,6 +16,9 @@ * this program. If not, see . * ****************************************************************************************/ +#ifndef AMAROK_PLAYLISTQUEUEEDITOR_H +#define AMAROK_PLAYLISTQUEUEEDITOR_H + #include #include "ui_PlaylistQueueEditor.h" @@ -40,3 +43,4 @@ bool m_blockViewUpdates; Ui::PlaylistQueueEditor m_ui; }; +#endif diff --git a/src/playlist/PlaylistQueueEditor.cpp b/src/playlist/PlaylistQueueEditor.cpp --- a/src/playlist/PlaylistQueueEditor.cpp +++ b/src/playlist/PlaylistQueueEditor.cpp @@ -35,10 +35,10 @@ m_ui.setupUi( this ); updateView(); connect( qobject_cast(The::playlist()->qaim()), &Playlist::Model::queueChanged, this, &PlaylistQueueEditor::queueChanged ); - m_ui.upButton->setIcon( QIcon::fromTheme( "go-up" ) ); - m_ui.downButton->setIcon( QIcon::fromTheme( "go-down" ) ); - m_ui.dequeueTrackButton->setIcon( QIcon::fromTheme( "list-remove" ) ); - m_ui.clearButton->setIcon( QIcon::fromTheme( "edit-clear-list" ) ); + m_ui.upButton->setIcon( QIcon::fromTheme( QStringLiteral("go-up") ) ); + m_ui.downButton->setIcon( QIcon::fromTheme( QStringLiteral("go-down") ) ); + m_ui.dequeueTrackButton->setIcon( QIcon::fromTheme( QStringLiteral("list-remove") ) ); + m_ui.clearButton->setIcon( QIcon::fromTheme( QStringLiteral("edit-clear-list") ) ); connect( m_ui.upButton, &QAbstractButton::clicked, this, &PlaylistQueueEditor::moveUp ); connect( m_ui.downButton, &QAbstractButton::clicked, this, &PlaylistQueueEditor::moveDown ); connect( m_ui.clearButton, &QAbstractButton::clicked, this, &PlaylistQueueEditor::clear ); diff --git a/src/playlist/PlaylistRestorer.h b/src/playlist/PlaylistRestorer.h --- a/src/playlist/PlaylistRestorer.h +++ b/src/playlist/PlaylistRestorer.h @@ -22,7 +22,6 @@ namespace Playlist { -class Actions; /** * Implements loading of default playlist or default track * in case if no playlist was saved (e.g. first run of Amarok) @@ -41,7 +40,7 @@ void restore( const QUrl &path ); // PlaylistObserver methods: - virtual void tracksLoaded( Playlists::PlaylistPtr ); + void tracksLoaded( Playlists::PlaylistPtr) override; Q_SIGNALS: void restoreFinished(); diff --git a/src/playlist/PlaylistRestorer.cpp b/src/playlist/PlaylistRestorer.cpp --- a/src/playlist/PlaylistRestorer.cpp +++ b/src/playlist/PlaylistRestorer.cpp @@ -17,7 +17,7 @@ #include "PlaylistRestorer.h" #include "amarokconfig.h" -#include "core/interfaces/Logger.h" +#include "core/logger/Logger.h" #include "core-impl/collections/support/CollectionManager.h" #include "core-impl/playlists/types/file/PlaylistFileSupport.h" #include "playlist/PlaylistActions.h" @@ -55,16 +55,16 @@ DEBUG_BLOCK if( AmarokConfig::playFirstRunJingle() ) { - QString jingle = QStandardPaths::locate( QStandardPaths::GenericDataLocation, "amarok/data/first_run_jingle.ogg" ); + QString jingle = QStandardPaths::locate( QStandardPaths::GenericDataLocation, QStringLiteral("amarok/data/first_run_jingle.ogg") ); The::playlistController()->clear(); The::playlistController()->insertTrack( 0, CollectionManager::instance()->trackForUrl( QUrl::fromLocalFile(jingle) ) ); AmarokConfig::setPlayFirstRunJingle( false ); } - emit restoreFinished(); + Q_EMIT restoreFinished(); } void -Restorer::tracksLoaded( Playlists::PlaylistPtr playlist ) +Restorer::tracksLoaded(Playlists::PlaylistPtr playlist ) { if( m_playlistToRestore == playlist ) { @@ -115,5 +115,5 @@ const int lastPlayingRow = AmarokConfig::lastPlaying(); if( lastPlayingRow >= 0 ) ModelStack::instance()->bottom()->setActiveRow( lastPlayingRow ); - emit restoreFinished(); + Q_EMIT restoreFinished(); } diff --git a/src/playlist/PlaylistSortWidget.h b/src/playlist/PlaylistSortWidget.h --- a/src/playlist/PlaylistSortWidget.h +++ b/src/playlist/PlaylistSortWidget.h @@ -37,7 +37,7 @@ /** * Constructor. */ - SortWidget( QWidget *parent ); + explicit SortWidget( QWidget *parent ); /** * Destructor. @@ -56,7 +56,7 @@ QString sortPath() const; /** - * Generate current sort scheme from a sorth path stored in a QString. + * Generate current sort scheme from a sort path stored in a QString. */ void readSortPath( const QString &sortPath ); @@ -91,14 +91,14 @@ * @param internalColumnName the name of the level. * @param sortOrder the Qt::SortOrder of the level. */ - void addLevel( QString internalColumnName, Qt::SortOrder sortOrder = Qt::AscendingOrder ); + void addLevel( const QString &internalColumnName, Qt::SortOrder sortOrder = Qt::AscendingOrder ); /** * Adds a level to the breadcrumb path. * Orders the level in ascending order. * @param internalColumnName the name of the level. */ - void addLevelAscending( QString internalColumnName ); + void addLevelAscending( const QString &internalColumnName ); /** * Handles the (possible) deletion of further levels when an item is clicked. @@ -109,7 +109,7 @@ * Handles the rearrangement of the breadcrumb path when a sibling of an item is clicked. * @param action the action in the menu. */ - void onItemSiblingClicked( QString internalColumnName ); + void onItemSiblingClicked( const QString &internalColumnName ); /** * Handles the rearrangement of the breadcrumb path when a Shuffle action is clicked. diff --git a/src/playlist/PlaylistSortWidget.cpp b/src/playlist/PlaylistSortWidget.cpp --- a/src/playlist/PlaylistSortWidget.cpp +++ b/src/playlist/PlaylistSortWidget.cpp @@ -55,23 +55,23 @@ m_layout->addWidget( m_addButton ); m_layout->addStretch( 10 ); - m_urlButton = new BreadcrumbUrlMenuButton( "playlist", this ); + m_urlButton = new BreadcrumbUrlMenuButton( QStringLiteral("playlist"), this ); m_layout->addWidget( m_urlButton ); connect( m_addButton->menu(), &BreadcrumbItemMenu::actionClicked, this, &SortWidget::addLevelAscending ); connect( m_addButton->menu(), &BreadcrumbItemMenu::shuffleActionClicked, The::playlistActions(), &Actions::shuffle ); - QString sortPath = Amarok::config( "Playlist Sorting" ).readEntry( "SortPath", QString() ); + QString sortPath = Amarok::config( QStringLiteral("Playlist Sorting") ).readEntry( "SortPath", QString() ); readSortPath( sortPath ); } SortWidget::~SortWidget() {} void -SortWidget::addLevel( QString internalColumnName, Qt::SortOrder sortOrder ) //private slot +SortWidget::addLevel( const QString &internalColumnName, Qt::SortOrder sortOrder ) //private slot { BreadcrumbLevel *bLevel = new BreadcrumbLevel( internalColumnName ); BreadcrumbItem *item = new BreadcrumbItem( bLevel, this ); @@ -87,7 +87,7 @@ } void -SortWidget::addLevelAscending ( QString internalColumnName ) +SortWidget::addLevelAscending ( const QString &internalColumnName ) { addLevel(internalColumnName, Qt::AscendingOrder); } @@ -122,7 +122,7 @@ } void -SortWidget::onItemSiblingClicked( QString internalColumnName ) +SortWidget::onItemSiblingClicked( const QString &internalColumnName ) { const int level = m_ribbon->indexOf( qobject_cast< QWidget * >( sender()->parent() ) ); trimToLevel( level - 1 ); @@ -150,7 +150,7 @@ } ModelStack::instance()->sortProxy()->updateSortMap( scheme ); - KConfigGroup config = Amarok::config( "Playlist Sorting" ); + KConfigGroup config = Amarok::config( QStringLiteral("Playlist Sorting") ); config.writeEntry( "SortPath", sortPath() ); } @@ -173,7 +173,7 @@ { trimToLevel(); - QStringList levels = sortPath.split( '-' ); + QStringList levels = sortPath.split( QLatin1Char('-') ); foreach( const QString &level, levels ) { QStringList levelParts = level.split( '_' ); @@ -188,9 +188,9 @@ || ( Playlist::PlaylistColumnInfos::internalNames(). indexOf( levelParts.value(0) ) == -1) ) warning() << "Playlist sorting load error: Invalid sort level " << level; - else if( levelParts.value( 1 ) == QString( "asc" ) ) + else if( levelParts.value( 1 ) == QStringLiteral( "asc" ) ) addLevel( levelParts.value( 0 ), Qt::AscendingOrder ); - else if( levelParts.value( 1 ) == QString( "des" ) ) + else if( levelParts.value( 1 ) == QStringLiteral( "des" ) ) addLevel( levelParts.value( 0 ), Qt::DescendingOrder ); else warning() << "Playlist sorting load error: Invalid sort order for level " << level; @@ -203,7 +203,6 @@ QString prettyPath; for( int i = 0; i < m_ribbon->count(); ++i ) //could be faster if done with iterator { - QString name( qobject_cast< BreadcrumbItem * >( m_ribbon->itemAt( i )->widget() )->name() ); QString prettyName( qobject_cast< BreadcrumbItem * >( m_ribbon->itemAt( i )->widget() )->prettyName() ); Qt::SortOrder sortOrder = qobject_cast< BreadcrumbItem * >( m_ribbon->itemAt( i )->widget() )->sortOrder(); QString prettyLevel = prettyName + ( sortOrder ? "↓" : "↑" ); diff --git a/src/playlist/PlaylistToolBar.h b/src/playlist/PlaylistToolBar.h --- a/src/playlist/PlaylistToolBar.h +++ b/src/playlist/PlaylistToolBar.h @@ -60,8 +60,8 @@ void onActionsAdded(); protected: - void resizeEvent( QResizeEvent *event ); - void actionEvent( QActionEvent *event ); + void resizeEvent( QResizeEvent *event ) override; + void actionEvent( QActionEvent *event ) override; private: /** diff --git a/src/playlist/PlaylistToolBar.cpp b/src/playlist/PlaylistToolBar.cpp --- a/src/playlist/PlaylistToolBar.cpp +++ b/src/playlist/PlaylistToolBar.cpp @@ -30,12 +30,12 @@ QToolBar( parent ), m_collapsed( false ) { - setObjectName( "PlaylistToolBar" ); + setObjectName( QStringLiteral("PlaylistToolBar") ); m_collapsibleActions = new QActionGroup( parent ); //needs to exist before adding any //other action to the toolbar - m_playlistOperationsMenu = new KActionMenu( QIcon::fromTheme( "amarok_playlist" ), + m_playlistOperationsMenu = new KActionMenu( QIcon::fromTheme( QStringLiteral("amarok_playlist") ), i18n( "&Playlist" ), parent ); m_playlistOperationsMenu->setDelayed( false ); m_playlistOperationsMenu->setVisible( false ); diff --git a/src/playlist/PlaylistViewUrlGenerator.h b/src/playlist/PlaylistViewUrlGenerator.h --- a/src/playlist/PlaylistViewUrlGenerator.h +++ b/src/playlist/PlaylistViewUrlGenerator.h @@ -30,9 +30,9 @@ static ViewUrlGenerator * instance(); - QString description(); - QIcon icon(); - AmarokUrl createUrl(); + QString description() override; + QIcon icon() override; + AmarokUrl createUrl() override; private: diff --git a/src/playlist/PlaylistViewUrlGenerator.cpp b/src/playlist/PlaylistViewUrlGenerator.cpp --- a/src/playlist/PlaylistViewUrlGenerator.cpp +++ b/src/playlist/PlaylistViewUrlGenerator.cpp @@ -29,11 +29,11 @@ namespace Playlist { -ViewUrlGenerator * ViewUrlGenerator::s_instance = 0; +ViewUrlGenerator * ViewUrlGenerator::s_instance = nullptr; ViewUrlGenerator * ViewUrlGenerator::instance() { - if( s_instance == 0) + if( s_instance == nullptr) s_instance = new ViewUrlGenerator(); return s_instance; @@ -51,8 +51,8 @@ { DEBUG_BLOCK AmarokUrl url; - url.setCommand( "playlist" ); - url.setPath( "view" ); + url.setCommand( QStringLiteral("playlist") ); + url.setPath( QStringLiteral("view") ); Dock * playlistDock = The::mainWindow()->playlistDock(); QString filterExpr = playlistDock->searchWidget()->currentFilter(); @@ -69,23 +69,23 @@ if( !sortPath.isEmpty() ) { - url.setArg( "sort", sortPath ); + url.setArg( QStringLiteral("sort"), sortPath ); prettyUrlName.append( prettySortPath ); } if( !filterExpr.isEmpty() ) { - url.setArg( "filter", filterExpr ); - url.setArg( "matches", onlyMatches ); + url.setArg( QStringLiteral("filter"), filterExpr ); + url.setArg( QStringLiteral("matches"), onlyMatches ); if( !prettyUrlName.isEmpty() ) prettyUrlName.append( " | " ); QString prettyFilterExpr = "\"" + filterExpr + "\""; - prettyUrlName.append( ( onlyMatches == QString( "true" ) ) + prettyUrlName.append( ( onlyMatches == QStringLiteral( "true" ) ) ? i18n( "Filter %1", prettyFilterExpr ) : i18n( "Search %1", prettyFilterExpr ) ); } if( !layout.isEmpty() ) { - url.setArg( "layout", layout ); + url.setArg( QStringLiteral("layout"), layout ); if( !prettyUrlName.isEmpty() ) prettyUrlName.append( " | " ); prettyUrlName.append( i18n( "%1 layout", layout ) ); diff --git a/src/playlist/PlaylistViewUrlRunner.h b/src/playlist/PlaylistViewUrlRunner.h --- a/src/playlist/PlaylistViewUrlRunner.h +++ b/src/playlist/PlaylistViewUrlRunner.h @@ -32,10 +32,10 @@ ViewUrlRunner(); virtual ~ViewUrlRunner(); - virtual QString command() const; - virtual QString prettyCommand() const; - virtual QIcon icon() const; - virtual bool run( AmarokUrl url ); + QString command() const override; + QString prettyCommand() const override; + QIcon icon() const override; + bool run( const AmarokUrl &url ) override; }; } diff --git a/src/playlist/PlaylistViewUrlRunner.cpp b/src/playlist/PlaylistViewUrlRunner.cpp --- a/src/playlist/PlaylistViewUrlRunner.cpp +++ b/src/playlist/PlaylistViewUrlRunner.cpp @@ -44,32 +44,32 @@ } bool -ViewUrlRunner::run( AmarokUrl url ) +ViewUrlRunner::run( const AmarokUrl &url ) { DEBUG_BLOCK const QMap< QString, QString > args = url.args(); auto playlistDock = The::mainWindow()->playlistDock(); - if( args.keys().contains( "filter" ) ) + if( args.keys().contains( QStringLiteral("filter") ) ) { - const QString filterExpr = args.value( "filter" ); + const QString filterExpr = args.value( QStringLiteral("filter") ); playlistDock->searchWidget()->setCurrentFilter( filterExpr ); - if( args.keys().contains( "matches" ) ) + if( args.keys().contains( QStringLiteral("matches") ) ) { - const QString onlyMatches = args.value( "matches" ); - playlistDock->searchWidget()->slotShowOnlyMatches( ( onlyMatches == QString( "true" ) ) ); + const QString onlyMatches = args.value( QStringLiteral("matches") ); + playlistDock->searchWidget()->slotShowOnlyMatches( ( onlyMatches == QStringLiteral( "true" ) ) ); } } - if( args.keys().contains( "sort" ) ) + if( args.keys().contains( QStringLiteral("sort") ) ) { - const QString sortPath = args.value( "sort" ); + const QString sortPath = args.value( QStringLiteral("sort") ); playlistDock->sortWidget()->readSortPath( sortPath ); } - if( args.keys().contains( "layout" ) ) + if( args.keys().contains( QStringLiteral("layout") ) ) { - const QString layout = args.value( "layout" ); + const QString layout = args.value( QStringLiteral("layout") ); LayoutManager::instance()->setActiveLayout( layout ); } @@ -81,7 +81,7 @@ QString ViewUrlRunner::command() const { - return "playlist"; + return QStringLiteral("playlist"); } QString diff --git a/src/playlist/ProgressiveSearchWidget.h b/src/playlist/ProgressiveSearchWidget.h --- a/src/playlist/ProgressiveSearchWidget.h +++ b/src/playlist/ProgressiveSearchWidget.h @@ -22,7 +22,6 @@ class QAction; class QKeyEvent; -class QLabel; class QMenu; class QToolBar; @@ -49,20 +48,21 @@ * Constructor. * @param parent The parent widget this is added to. */ - ProgressiveSearchWidget( QWidget * parent ); + explicit ProgressiveSearchWidget( QWidget * parent ); QString currentFilter() const { return m_searchEdit->text(); } void focusInputLine(); - void setCurrentFilter( const QString filterExpr ) { m_searchEdit->setText( filterExpr ); } + void setCurrentFilter( const QString &filterExpr ) { m_searchEdit->setText( filterExpr ); } bool onlyMatches() const { return m_showOnlyMatches; } Q_SIGNALS: /** * Signal emitted when the search term has changed. * @param filter The new search term. - * @param fiellds The mask containing the fields to match against. + * @param fields The mask containing the fields to match against. + * @param showOnlyMatches Determines whether to show only matches. */ void filterChanged( const QString &filter, int fields, bool showOnlyMatches ); @@ -74,14 +74,14 @@ /** * Signal emitted when the "next" button is pressed. * @param filter The current search term. - * @param fiellds The mask containing the fields to match against. + * @param fields The mask containing the fields to match against. */ void next( const QString &filter, int fields ); /** * Signal emitted when the "previous" button is pressed. * @param filter The current search term. - * @param fiellds The mask containing the fields to match against. + * @param fields The mask containing the fields to match against. */ void previous( const QString &filter, int fields ); @@ -122,7 +122,7 @@ void noMatch(); /** - * Clear the filter.. + * Clear the filter. */ void slotFilterClear(); @@ -194,7 +194,7 @@ void slotSearchYears( bool search ); protected: - void keyPressEvent( QKeyEvent *event ); + void keyPressEvent( QKeyEvent *event ) override; private Q_SLOTS: void defocus() { m_searchEdit->clearFocus(); } diff --git a/src/playlist/ProgressiveSearchWidget.cpp b/src/playlist/ProgressiveSearchWidget.cpp --- a/src/playlist/ProgressiveSearchWidget.cpp +++ b/src/playlist/ProgressiveSearchWidget.cpp @@ -59,10 +59,10 @@ connect( m_searchEdit, &Amarok::LineEdit::downPressed, this, &ProgressiveSearchWidget::downPressed ); connect( m_searchEdit, &Amarok::LineEdit::upPressed, this, &ProgressiveSearchWidget::upPressed ); - m_nextAction = new QAction( QIcon::fromTheme( "go-down" ), i18n( "&Next" ), this ); + m_nextAction = new QAction( QIcon::fromTheme( QStringLiteral("go-down") ), i18n( "&Next" ), this ); connect( m_nextAction, &QAction::triggered, this, &ProgressiveSearchWidget::slotNext ); - m_previousAction = new QAction( QIcon::fromTheme( "go-up" ), i18n( "&Previous" ), this ); + m_previousAction = new QAction( QIcon::fromTheme( QStringLiteral("go-up") ), i18n( "&Previous" ), this ); connect( m_previousAction, &QAction::triggered, this, &ProgressiveSearchWidget::slotPrevious ); m_nextAction->setEnabled( false ); @@ -133,7 +133,7 @@ m_nextAction->setVisible( !m_showOnlyMatches ); m_previousAction->setVisible( !m_showOnlyMatches ); - QAction *searchMenuAction = new QAction( QIcon::fromTheme( "preferences-other" ), i18n( "Search Preferences" ), this ); + QAction *searchMenuAction = new QAction( QIcon::fromTheme( QStringLiteral("preferences-other") ), i18n( "Search Preferences" ), this ); searchMenuAction->setMenu( m_menu ); m_toolBar->addAction( searchMenuAction ); @@ -145,7 +145,7 @@ m_toolBar->setFixedHeight( m_searchEdit->sizeHint().height() ); //make sure that this edit is cleared when the playlist is cleared: - connect( Amarok::actionCollection()->action( "playlist_clear" ), &QAction::triggered, this, &ProgressiveSearchWidget::slotFilterClear ); + connect( Amarok::actionCollection()->action( QStringLiteral("playlist_clear") ), &QAction::triggered, this, &ProgressiveSearchWidget::slotFilterClear ); } void ProgressiveSearchWidget::slotFilterChanged( const QString & filter ) @@ -170,24 +170,24 @@ p.setColor( QPalette::Base, palette().color( QPalette::Base ) ); m_searchEdit->setPalette( p ); - emit( filterCleared() ); + Q_EMIT( filterCleared() ); return; } - emit( filterChanged( filter, m_searchFieldsMask, m_showOnlyMatches ) ); + Q_EMIT( filterChanged( filter, m_searchFieldsMask, m_showOnlyMatches ) ); } void ProgressiveSearchWidget::slotNext() { DEBUG_BLOCK - emit( next( m_searchEdit->text(), m_searchFieldsMask ) ); + Q_EMIT( next( m_searchEdit->text(), m_searchFieldsMask ) ); } void ProgressiveSearchWidget::slotPrevious() { DEBUG_BLOCK - emit( previous( m_searchEdit->text(), m_searchFieldsMask ) ); + Q_EMIT( previous( m_searchEdit->text(), m_searchFieldsMask ) ); } void ProgressiveSearchWidget::match() @@ -219,10 +219,10 @@ else m_searchFieldsMask ^= Playlist::MatchTrack; - Amarok::config( "Playlist Search" ).writeEntry( "MatchTrack", search ); + Amarok::config( QStringLiteral("Playlist Search") ).writeEntry( "MatchTrack", search ); if( !m_searchEdit->text().isEmpty() ) - emit( filterChanged( m_searchEdit->text(), m_searchFieldsMask, m_showOnlyMatches ) ); + Q_EMIT( filterChanged( m_searchEdit->text(), m_searchFieldsMask, m_showOnlyMatches ) ); } void ProgressiveSearchWidget::slotSearchArtists( bool search ) @@ -232,10 +232,10 @@ else m_searchFieldsMask ^= Playlist::MatchArtist; - Amarok::config( "Playlist Search" ).writeEntry( "MatchArtist", search ); + Amarok::config( QStringLiteral("Playlist Search") ).writeEntry( "MatchArtist", search ); if( !m_searchEdit->text().isEmpty() ) - emit( filterChanged( m_searchEdit->text(), m_searchFieldsMask, m_showOnlyMatches ) ); + Q_EMIT( filterChanged( m_searchEdit->text(), m_searchFieldsMask, m_showOnlyMatches ) ); } void ProgressiveSearchWidget::slotSearchAlbums( bool search ) @@ -245,10 +245,10 @@ else m_searchFieldsMask ^= Playlist::MatchAlbum; - Amarok::config( "Playlist Search" ).writeEntry( "MatchAlbum", search ); + Amarok::config( QStringLiteral("Playlist Search") ).writeEntry( "MatchAlbum", search ); if( !m_searchEdit->text().isEmpty() ) - emit( filterChanged( m_searchEdit->text(), m_searchFieldsMask, m_showOnlyMatches ) ); + Q_EMIT( filterChanged( m_searchEdit->text(), m_searchFieldsMask, m_showOnlyMatches ) ); } void ProgressiveSearchWidget::slotSearchGenre( bool search ) @@ -258,10 +258,10 @@ else m_searchFieldsMask ^= Playlist::MatchGenre; - Amarok::config( "Playlist Search" ).writeEntry( "MatchGenre", search ); + Amarok::config( QStringLiteral("Playlist Search") ).writeEntry( "MatchGenre", search ); if( !m_searchEdit->text().isEmpty() ) - emit( filterChanged( m_searchEdit->text(), m_searchFieldsMask, m_showOnlyMatches ) ); + Q_EMIT( filterChanged( m_searchEdit->text(), m_searchFieldsMask, m_showOnlyMatches ) ); } void ProgressiveSearchWidget::slotSearchComposers( bool search ) @@ -271,10 +271,10 @@ else m_searchFieldsMask ^= Playlist::MatchComposer; - Amarok::config( "Playlist Search" ).writeEntry( "MatchComposer", search ); + Amarok::config( QStringLiteral("Playlist Search") ).writeEntry( "MatchComposer", search ); if( !m_searchEdit->text().isEmpty() ) - emit( filterChanged( m_searchEdit->text(), m_searchFieldsMask, m_showOnlyMatches ) ); + Q_EMIT( filterChanged( m_searchEdit->text(), m_searchFieldsMask, m_showOnlyMatches ) ); } void ProgressiveSearchWidget::slotSearchRating( bool search ) @@ -284,10 +284,10 @@ else m_searchFieldsMask ^= Playlist::MatchRating; - Amarok::config( "Playlist Search" ).writeEntry( "MatchRating", search ); + Amarok::config( QStringLiteral("Playlist Search") ).writeEntry( "MatchRating", search ); if( !m_searchEdit->text().isEmpty() ) - emit( filterChanged( m_searchEdit->text(), m_searchFieldsMask, m_showOnlyMatches ) ); + Q_EMIT( filterChanged( m_searchEdit->text(), m_searchFieldsMask, m_showOnlyMatches ) ); } void ProgressiveSearchWidget::slotSearchYears( bool search ) @@ -297,17 +297,17 @@ else m_searchFieldsMask ^= Playlist::MatchYear; - Amarok::config( "Playlist Search" ).writeEntry( "MatchYear", search ); + Amarok::config( QStringLiteral("Playlist Search") ).writeEntry( "MatchYear", search ); if( !m_searchEdit->text().isEmpty() ) - emit( filterChanged( m_searchEdit->text(), m_searchFieldsMask, m_showOnlyMatches ) ); + Q_EMIT( filterChanged( m_searchEdit->text(), m_searchFieldsMask, m_showOnlyMatches ) ); } void ProgressiveSearchWidget::readConfig() { m_searchFieldsMask = 0; - KConfigGroup config = Amarok::config("Playlist Search"); + KConfigGroup config = Amarok::config(QStringLiteral("Playlist Search")); if( config.readEntry( "MatchTrack", true ) ) m_searchFieldsMask |= Playlist::MatchTrack; @@ -346,11 +346,11 @@ m_nextAction->setVisible( !onlyMatches ); m_previousAction->setVisible( !onlyMatches ); - KConfigGroup cg = Amarok::config( "Playlist Search" ); + KConfigGroup cg = Amarok::config( QStringLiteral("Playlist Search") ); cg.writeEntry( "ShowOnlyMatches", m_showOnlyMatches ); cg.sync(); - emit( showOnlyMatches( onlyMatches ) ); + Q_EMIT( showOnlyMatches( onlyMatches ) ); } void diff --git a/src/playlist/UndoCommands.h b/src/playlist/UndoCommands.h --- a/src/playlist/UndoCommands.h +++ b/src/playlist/UndoCommands.h @@ -34,8 +34,8 @@ { public: InsertTracksCmd( QUndoCommand* parent, const InsertCmdList& ); - void undo(); - void redo(); + void undo() override; + void redo() override; private: const InsertCmdList m_cmdlist; }; @@ -46,8 +46,8 @@ { public: RemoveTracksCmd( QUndoCommand* parent, const RemoveCmdList& ); - void undo(); - void redo(); + void undo() override; + void redo() override; private: const RemoveCmdList m_cmdlist; }; @@ -58,8 +58,8 @@ { public: MoveTracksCmd( QUndoCommand* parent, const MoveCmdList& ); - void undo(); - void redo(); + void undo() override; + void redo() override; private: const MoveCmdList m_cmdlist; }; diff --git a/src/playlist/layouts/LayoutConfigAction.h b/src/playlist/layouts/LayoutConfigAction.h --- a/src/playlist/layouts/LayoutConfigAction.h +++ b/src/playlist/layouts/LayoutConfigAction.h @@ -22,7 +22,6 @@ #include #include -class QComboBox; namespace Playlist { @@ -42,7 +41,7 @@ * Constructor. * @param parent Parent widget. */ - LayoutConfigAction( QWidget * parent ); + explicit LayoutConfigAction( QWidget * parent ); /** * Destructor. diff --git a/src/playlist/layouts/LayoutConfigAction.cpp b/src/playlist/layouts/LayoutConfigAction.cpp --- a/src/playlist/layouts/LayoutConfigAction.cpp +++ b/src/playlist/layouts/LayoutConfigAction.cpp @@ -79,13 +79,13 @@ void LayoutConfigAction::setActiveLayout( QAction *layoutAction ) { QString layoutName( layoutAction->text() ); - layoutName = layoutName.remove( QChar( '&' ) ); //need to remove the & from the string, used for the shortcut key underscore + layoutName = layoutName.remove( QLatin1Char( '&' ) ); //need to remove the & from the string, used for the shortcut key underscore LayoutManager::instance()->setActiveLayout( layoutName ); } void LayoutConfigAction::configureLayouts() { - if( m_layoutDialog == 0 ) + if( m_layoutDialog == nullptr ) m_layoutDialog = new PlaylistLayoutEditDialog( The::mainWindow() ); m_layoutDialog->setModal( false ); @@ -119,8 +119,8 @@ void LayoutConfigAction::onActiveLayoutChanged() { QString layoutName( LayoutManager::instance()->activeLayoutName() ); - layoutName = layoutName.remove( QChar( '&' ) ); //need to remove the & from the string, used for the shortcut key underscore - if( layoutName != QString( "%%PREVIEW%%" ) ) //if it's not just a preview + layoutName = layoutName.remove( QLatin1Char( '&' ) ); //need to remove the & from the string, used for the shortcut key underscore + if( layoutName != QStringLiteral( "%%PREVIEW%%" ) ) //if it's not just a preview { int index = LayoutManager::instance()->layouts().indexOf( layoutName ); if( index != -1 && m_layoutActions->actions()[ index ] != m_layoutActions->checkedAction() ) diff --git a/src/playlist/layouts/LayoutEditDialog.h b/src/playlist/layouts/LayoutEditDialog.h --- a/src/playlist/layouts/LayoutEditDialog.h +++ b/src/playlist/layouts/LayoutEditDialog.h @@ -21,7 +21,6 @@ #include class HintingLineEdit; -class QLineEdit; class QLabel; class QRadioButton; class QSlider; @@ -32,7 +31,7 @@ { Q_OBJECT public: - LayoutEditDialog( QWidget *parent = 0 ); + explicit LayoutEditDialog( QWidget *parent = nullptr ); void setToken( TokenWithLayout *t ); public Q_SLOTS: void close(); diff --git a/src/playlist/layouts/LayoutEditDialog.cpp b/src/playlist/layouts/LayoutEditDialog.cpp --- a/src/playlist/layouts/LayoutEditDialog.cpp +++ b/src/playlist/layouts/LayoutEditDialog.cpp @@ -40,14 +40,14 @@ class HintingLineEdit : public QLineEdit { public: - HintingLineEdit( const QString &hint = QString(), QWidget *parent = 0 ) : QLineEdit( parent ), m_hint( hint ) + HintingLineEdit( const QString &hint = QString(), QWidget *parent = nullptr ) : QLineEdit( parent ), m_hint( hint ) { } void setHint( const QString &hint ) { m_hint = hint; } protected: - void paintEvent ( QPaintEvent *pe ) + void paintEvent ( QPaintEvent *pe ) override { QLineEdit::paintEvent( pe ); if ( !hasFocus() && text().isEmpty() ) @@ -130,7 +130,7 @@ metrics->addItem( "chars" ); l5->addWidget( metrics ); #else - QLabel *metrics = new QLabel( "%", this ); + QLabel *metrics = new QLabel( QStringLiteral("%"), this ); l5->addWidget( metrics ); #endif @@ -168,23 +168,23 @@ l1->addStretch(); - m_alignLeft->setIcon( QIcon::fromTheme( "format-justify-left" ) ); + m_alignLeft->setIcon( QIcon::fromTheme( QStringLiteral("format-justify-left") ) ); m_alignLeft->setCheckable( true ); - m_alignCenter->setIcon( QIcon::fromTheme( "format-justify-center" ) ); + m_alignCenter->setIcon( QIcon::fromTheme( QStringLiteral("format-justify-center") ) ); m_alignCenter->setCheckable( true ); - m_alignRight->setIcon( QIcon::fromTheme( "format-justify-right" ) ); + m_alignRight->setIcon( QIcon::fromTheme( QStringLiteral("format-justify-right") ) ); m_alignRight->setCheckable( true ); QButtonGroup *align = new QButtonGroup( this ); align->setExclusive( true ); align->addButton( m_alignLeft ); align->addButton( m_alignCenter ); align->addButton( m_alignRight ); - m_bold->setIcon( QIcon::fromTheme( "format-text-bold" ) ); + m_bold->setIcon( QIcon::fromTheme( QStringLiteral("format-text-bold") ) ); m_bold->setCheckable( true ); - m_italic->setIcon( QIcon::fromTheme( "format-text-italic" ) ); + m_italic->setIcon( QIcon::fromTheme( QStringLiteral("format-text-italic") ) ); m_italic->setCheckable( true ); - m_underline->setIcon( QIcon::fromTheme( "format-text-underline" ) ); + m_underline->setIcon( QIcon::fromTheme( QStringLiteral("format-text-underline") ) ); m_underline->setCheckable( true ); } @@ -223,7 +223,7 @@ if( automatic ) { m_previousWidth = m_width->value(); - m_width->setMinimum( 0 ); // without setting the minumum we can't set the value.. + m_width->setMinimum( 0 ); // without setting the minimum we can't set the value.. m_width->setValue( 0 ); // automatic width is represented by width == 0 } else diff --git a/src/playlist/layouts/LayoutEditWidget.h b/src/playlist/layouts/LayoutEditWidget.h --- a/src/playlist/layouts/LayoutEditWidget.h +++ b/src/playlist/layouts/LayoutEditWidget.h @@ -41,7 +41,7 @@ * Constructor. * @param parent The parent widget. */ - LayoutEditWidget( QWidget *parent ); + explicit LayoutEditWidget( QWidget *parent ); /** * Destructor. @@ -52,10 +52,10 @@ * Setup the edit widget to represent an existing LayoutItemConfig. * @param config The config to read. */ - void readLayout( Playlist::LayoutItemConfig config ); + void readLayout( const Playlist::LayoutItemConfig &config ); /** - * Create and return a LayoutItemConfig corrosponding to the current state of the editor + * Create and return a LayoutItemConfig corresponding to the current state of the editor * @return LayoutItemConfig matching the contents of the editor. */ Playlist::LayoutItemConfig config(); @@ -69,7 +69,7 @@ /** * Signal emitted when the token drop target receives input focus. - * @param The widget that received the focus. + * The parameter is a widget that received the focus. */ void focuseReceived( QWidget* ); void changed(); diff --git a/src/playlist/layouts/LayoutEditWidget.cpp b/src/playlist/layouts/LayoutEditWidget.cpp --- a/src/playlist/layouts/LayoutEditWidget.cpp +++ b/src/playlist/layouts/LayoutEditWidget.cpp @@ -50,7 +50,7 @@ LayoutEditWidget::~LayoutEditWidget() { } -void LayoutEditWidget::readLayout( Playlist::LayoutItemConfig config ) +void LayoutEditWidget::readLayout( const Playlist::LayoutItemConfig &config ) { DEBUG_BLOCK int rowCount = config.rows(); diff --git a/src/playlist/layouts/LayoutItemConfig.h b/src/playlist/layouts/LayoutItemConfig.h --- a/src/playlist/layouts/LayoutItemConfig.h +++ b/src/playlist/layouts/LayoutItemConfig.h @@ -123,7 +123,7 @@ }; /** - * This class corrosponds to a row in a playlist layout + * This class corresponds to a row in a playlist layout * @author Nikolaj Hald Nielsen */ class LayoutItemConfigRow @@ -134,7 +134,7 @@ * Add an element to the end of this row. * @param element The element to add. */ - void addElement( LayoutItemConfigRowElement element ); + void addElement(const LayoutItemConfigRowElement &element ); /** * Get the number of elements in this row. @@ -200,7 +200,7 @@ * Add a row to this config. * @param row The row to add. */ - void addRow( LayoutItemConfigRow row ); + void addRow( const LayoutItemConfigRow &row ); /** * Set whether the cover image should be shown or not. @@ -273,7 +273,7 @@ /** * Set the layout config for the specified part type. */ - void setLayoutForPart( Part part, LayoutItemConfig itemConfig ); + void setLayoutForPart( Part part, const LayoutItemConfig &itemConfig ); /** * Set whether this config can be edited by the user. diff --git a/src/playlist/layouts/LayoutItemConfig.cpp b/src/playlist/layouts/LayoutItemConfig.cpp --- a/src/playlist/layouts/LayoutItemConfig.cpp +++ b/src/playlist/layouts/LayoutItemConfig.cpp @@ -86,7 +86,7 @@ ////////////////////////////////////////////// -void LayoutItemConfigRow::addElement( LayoutItemConfigRowElement element ) +void LayoutItemConfigRow::addElement( const LayoutItemConfigRowElement &element ) { m_elements.append( element ); } @@ -125,7 +125,7 @@ return m_rows.at( at ); } -void Playlist::LayoutItemConfig::addRow( LayoutItemConfigRow row ) +void Playlist::LayoutItemConfig::addRow( const LayoutItemConfigRow &row ) { m_rows.append( row ); } @@ -192,7 +192,7 @@ } void -Playlist::PlaylistLayout::setLayoutForPart( Part part, LayoutItemConfig itemConfig ) +Playlist::PlaylistLayout::setLayoutForPart( Part part, const LayoutItemConfig &itemConfig ) { m_layoutItemConfigs[part] = itemConfig; } diff --git a/src/playlist/layouts/LayoutManager.h b/src/playlist/layouts/LayoutManager.h --- a/src/playlist/layouts/LayoutManager.h +++ b/src/playlist/layouts/LayoutManager.h @@ -31,7 +31,7 @@ /** * Class for keeping track of playlist layouts and loading/saving them to xml files. Also keeps track - * Of the order in which these layouts are shown to the user and makes this persistant between sessions. + * Of the order in which these layouts are shown to the user and makes this persistent between sessions. * @author Nikolaj Hald Nielsen */ class LayoutManager : public QObject @@ -71,7 +71,7 @@ void updateCurrentLayout( const PlaylistLayout &layout ); /** - * Get the layout with a specific name. Returns an empty layout if there is no layout matchig the name. + * Get the layout with a specific name. Returns an empty layout if there is no layout matching the name. * @param layout The name of the layout. * @return The layout matching the name. */ @@ -90,7 +90,7 @@ QString activeLayoutName() const; /** - * Check if a named layout if one of Amaroks defaults or is one added by a user, This is important + * Check if a named layout if one of Amarok's defaults or is one added by a user, This is important * as default layouts cannot be changed or deleted. * @param layout The name of the layout. * @return Is layout one of the defaults. @@ -179,11 +179,11 @@ void loadLayouts( const QString &fileName, bool user ); /** - * Create a DOM element corrosponding to a LayoutItemConfig. Used when storing a layout to a file. + * Create a DOM element corresponding to a LayoutItemConfig. Used when storing a layout to a file. * @param doc The QDomDocument that is the parent of the current tree. * @param name The name of the layoutItem * @param item The layout item. - * @return A DOM element containig the XML encoded layout item. + * @return A DOM element containing the XML encoded layout item. */ QDomElement createItemElement( QDomDocument doc, const QString &name, const LayoutItemConfig &item ) const; diff --git a/src/playlist/layouts/LayoutManager.cpp b/src/playlist/layouts/LayoutManager.cpp --- a/src/playlist/layouts/LayoutManager.cpp +++ b/src/playlist/layouts/LayoutManager.cpp @@ -21,7 +21,7 @@ #include "core/support/Amarok.h" #include "core/support/Components.h" #include "core/support/Debug.h" -#include "core/interfaces/Logger.h" +#include "core/logger/Logger.h" #include "playlist/PlaylistDefines.h" #include "playlist/PlaylistModelStack.h" @@ -37,8 +37,8 @@ namespace Playlist { -static const QString PREVIEW_LAYOUT = "%%PREVIEW%%"; -LayoutManager* LayoutManager::s_instance = 0; +static const QString PREVIEW_LAYOUT = QStringLiteral("%%PREVIEW%%"); +LayoutManager* LayoutManager::s_instance = nullptr; LayoutManager* LayoutManager::instance() { @@ -56,10 +56,10 @@ loadUserLayouts(); orderLayouts(); - KConfigGroup config = Amarok::config("Playlist Layout"); + KConfigGroup config = Amarok::config(QStringLiteral("Playlist Layout")); m_activeLayout = config.readEntry( "CurrentLayout", "Default" ); if( !layouts().contains( m_activeLayout ) ) - m_activeLayout = "Default"; + m_activeLayout = QStringLiteral("Default"); Playlist::ModelStack::instance()->groupingProxy()->setGroupingCategory( activeLayout().groupBy() ); } @@ -71,8 +71,8 @@ void LayoutManager::setActiveLayout( const QString &layout ) { m_activeLayout = layout; - Amarok::config( "Playlist Layout" ).writeEntry( "CurrentLayout", m_activeLayout ); - emit( activeLayoutChanged() ); + Amarok::config( QStringLiteral("Playlist Layout") ).writeEntry( "CurrentLayout", m_activeLayout ); + Q_EMIT( activeLayoutChanged() ); //Change the grouping style to that of this layout. Playlist::ModelStack::instance()->groupingProxy()->setGroupingCategory( activeLayout().groupBy() ); @@ -84,7 +84,7 @@ DEBUG_BLOCK m_activeLayout = PREVIEW_LAYOUT; m_previewLayout = layout; - emit( activeLayoutChanged() ); + Q_EMIT( activeLayoutChanged() ); //Change the grouping style to that of this layout. Playlist::ModelStack::instance()->groupingProxy()->setGroupingCategory( activeLayout().groupBy() ); @@ -116,7 +116,7 @@ } - Amarok::Components::logger()->longMessage( i18n( "Current layout '%1' is read only. " \ + Amarok::Logger::longMessage( i18n( "Current layout '%1' is read only. " \ "Creating a new layout '%2' with your changes and setting this as active", m_activeLayout, newLayoutName ) ); @@ -135,12 +135,12 @@ void LayoutManager::loadUserLayouts() { - QDir layoutsDir = QDir( Amarok::saveLocation( "playlist_layouts/" ) ); + QDir layoutsDir = QDir( Amarok::saveLocation( QStringLiteral("playlist_layouts/") ) ); layoutsDir.setSorting( QDir::Name ); QStringList filters; - filters << "*.xml" << "*.XML"; + filters << QStringLiteral("*.xml") << QStringLiteral("*.XML"); layoutsDir.setNameFilters( filters ); layoutsDir.setSorting( QDir::Name ); @@ -156,19 +156,19 @@ void LayoutManager::loadDefaultLayouts() { const QString dataLocation = QStandardPaths::locate(QStandardPaths::GenericDataLocation, - "amarok/data", + QStringLiteral("amarok/data"), QStandardPaths::LocateDirectory); - QString configFile = dataLocation + "/DefaultPlaylistLayouts.xml"; + QString configFile = dataLocation + QStringLiteral("/DefaultPlaylistLayouts.xml"); loadLayouts( configFile, false ); } void LayoutManager::loadLayouts( const QString &fileName, bool user ) { DEBUG_BLOCK - QDomDocument doc( "layouts" ); + QDomDocument doc( QStringLiteral("layouts") ); if ( !QFile::exists( fileName ) ) { @@ -191,52 +191,52 @@ file->close(); delete file; - QDomElement layouts_element = doc.firstChildElement( "playlist_layouts" ); - QDomNodeList layouts = layouts_element.elementsByTagName("layout"); + QDomElement layouts_element = doc.firstChildElement( QStringLiteral("playlist_layouts") ); + QDomNodeList layouts = layouts_element.elementsByTagName(QStringLiteral("layout")); int index = 0; while ( index < layouts.size() ) { QDomNode layout = layouts.item( index ); index++; - QString layoutName = layout.toElement().attribute( "name", "" ); + QString layoutName = layout.toElement().attribute( QStringLiteral("name"), QLatin1String("") ); debug() << "loading layout " << layoutName; PlaylistLayout currentLayout; currentLayout.setEditable( user ); - currentLayout.setInlineControls( layout.toElement().attribute( "inline_controls", "false" ).compare( "true", Qt::CaseInsensitive ) == 0 ); - currentLayout.setTooltips( layout.toElement().attribute( "tooltips", "false" ).compare( "true", Qt::CaseInsensitive ) == 0 ); + currentLayout.setInlineControls( layout.toElement().attribute( QStringLiteral("inline_controls"), QStringLiteral("false") ).compare( QLatin1String("true"), Qt::CaseInsensitive ) == 0 ); + currentLayout.setTooltips( layout.toElement().attribute( QStringLiteral("tooltips"), QStringLiteral("false") ).compare( QLatin1String("true"), Qt::CaseInsensitive ) == 0 ); //For backwards compatibility, if a grouping is not set in the XML file assume "group by album" (which was previously the default) - currentLayout.setGroupBy( layout.toElement().attribute( "group_by", "Album" ) ); - debug() << "grouping mode is: " << layout.toElement().attribute( "group_by", "Album" ); + currentLayout.setGroupBy( layout.toElement().attribute( QStringLiteral("group_by"), QStringLiteral("Album") ) ); + debug() << "grouping mode is: " << layout.toElement().attribute( QStringLiteral("group_by"), QStringLiteral("Album") ); - currentLayout.setLayoutForPart( PlaylistLayout::Head, parseItemConfig( layout.toElement().firstChildElement( "group_head" ) ) ); - currentLayout.setLayoutForPart( PlaylistLayout::StandardBody, parseItemConfig( layout.toElement().firstChildElement( "group_body" ) ) ); - QDomElement variousArtistsXML = layout.toElement().firstChildElement( "group_variousArtistsBody" ); + currentLayout.setLayoutForPart( PlaylistLayout::Head, parseItemConfig( layout.toElement().firstChildElement( QStringLiteral("group_head") ) ) ); + currentLayout.setLayoutForPart( PlaylistLayout::StandardBody, parseItemConfig( layout.toElement().firstChildElement( QStringLiteral("group_body") ) ) ); + QDomElement variousArtistsXML = layout.toElement().firstChildElement( QStringLiteral("group_variousArtistsBody") ); if ( !variousArtistsXML.isNull() ) currentLayout.setLayoutForPart( PlaylistLayout::VariousArtistsBody, parseItemConfig( variousArtistsXML ) ); else // Handle old custom layout XMLs - currentLayout.setLayoutForPart( PlaylistLayout::VariousArtistsBody, parseItemConfig( layout.toElement().firstChildElement( "group_body" ) ) ); - currentLayout.setLayoutForPart( PlaylistLayout::Single, parseItemConfig( layout.toElement().firstChildElement( "single_track" ) ) ); + currentLayout.setLayoutForPart( PlaylistLayout::VariousArtistsBody, parseItemConfig( layout.toElement().firstChildElement( QStringLiteral("group_body") ) ) ); + currentLayout.setLayoutForPart( PlaylistLayout::Single, parseItemConfig( layout.toElement().firstChildElement( QStringLiteral("single_track") ) ) ); if ( !layoutName.isEmpty() ) m_layouts.insert( layoutName, currentLayout ); } } LayoutItemConfig LayoutManager::parseItemConfig( const QDomElement &elem ) const { - const bool showCover = ( elem.attribute( "show_cover", "false" ).compare( "true", Qt::CaseInsensitive ) == 0 ); - const int activeIndicatorRow = elem.attribute( "active_indicator_row", "0" ).toInt(); + const bool showCover = ( elem.attribute( QStringLiteral("show_cover"), QStringLiteral("false") ).compare( QLatin1String("true"), Qt::CaseInsensitive ) == 0 ); + const int activeIndicatorRow = elem.attribute( QStringLiteral("active_indicator_row"), QStringLiteral("0") ).toInt(); LayoutItemConfig config; config.setShowCover( showCover ); config.setActiveIndicatorRow( activeIndicatorRow ); - QDomNodeList rows = elem.elementsByTagName("row"); + QDomNodeList rows = elem.elementsByTagName(QStringLiteral("row")); int index = 0; while ( index < rows.size() ) @@ -246,28 +246,28 @@ LayoutItemConfigRow row; - QDomNodeList elements = rowNode.toElement().elementsByTagName("element"); + QDomNodeList elements = rowNode.toElement().elementsByTagName(QStringLiteral("element")); int index2 = 0; while ( index2 < elements.size() ) { QDomNode elementNode = elements.item( index2 ); index2++; - int value = columnForName( elementNode.toElement().attribute( "value", "Title" ) ); - QString prefix = elementNode.toElement().attribute( "prefix", QString() ); - QString sufix = elementNode.toElement().attribute( "suffix", QString() ); - qreal size = elementNode.toElement().attribute( "size", "0.0" ).toDouble(); - bool bold = ( elementNode.toElement().attribute( "bold", "false" ).compare( "true", Qt::CaseInsensitive ) == 0 ); - bool italic = ( elementNode.toElement().attribute( "italic", "false" ).compare( "true", Qt::CaseInsensitive ) == 0 ); - bool underline = ( elementNode.toElement().attribute( "underline", "false" ).compare( "true", Qt::CaseInsensitive ) == 0 ); - QString alignmentString = elementNode.toElement().attribute( "alignment", "left" ); + int value = columnForName( elementNode.toElement().attribute( QStringLiteral("value"), QStringLiteral("Title") ) ); + QString prefix = elementNode.toElement().attribute( QStringLiteral("prefix"), QString() ); + QString sufix = elementNode.toElement().attribute( QStringLiteral("suffix"), QString() ); + qreal size = elementNode.toElement().attribute( QStringLiteral("size"), QStringLiteral("0.0") ).toDouble(); + bool bold = ( elementNode.toElement().attribute( QStringLiteral("bold"), QStringLiteral("false") ).compare( QLatin1String("true"), Qt::CaseInsensitive ) == 0 ); + bool italic = ( elementNode.toElement().attribute( QStringLiteral("italic"), QStringLiteral("false") ).compare( QLatin1String("true"), Qt::CaseInsensitive ) == 0 ); + bool underline = ( elementNode.toElement().attribute( QStringLiteral("underline"), QStringLiteral("false") ).compare( QLatin1String("true"), Qt::CaseInsensitive ) == 0 ); + QString alignmentString = elementNode.toElement().attribute( QStringLiteral("alignment"), QStringLiteral("left") ); Qt::Alignment alignment; - if ( alignmentString.compare( "left", Qt::CaseInsensitive ) == 0 ) + if ( alignmentString.compare( QLatin1String("left"), Qt::CaseInsensitive ) == 0 ) alignment = Qt::AlignLeft | Qt::AlignVCenter; - else if ( alignmentString.compare( "right", Qt::CaseInsensitive ) == 0 ) + else if ( alignmentString.compare( QLatin1String("right"), Qt::CaseInsensitive ) == 0 ) alignment = Qt::AlignRight| Qt::AlignVCenter; else alignment = Qt::AlignCenter| Qt::AlignVCenter; @@ -298,37 +298,37 @@ m_layouts.insert( name, layout ); - QDomDocument doc( "layouts" ); - QDomElement layouts_element = doc.createElement( "playlist_layouts" ); + QDomDocument doc( QStringLiteral("layouts") ); + QDomElement layouts_element = doc.createElement( QStringLiteral("playlist_layouts") ); QDomElement newLayout = doc.createElement( ("layout" ) ); - newLayout.setAttribute( "name", name ); + newLayout.setAttribute( QStringLiteral("name"), name ); doc.appendChild( layouts_element ); layouts_element.appendChild( newLayout ); - emit( layoutListChanged() ); + Q_EMIT( layoutListChanged() ); - QDomElement body = doc.createElement( "body" ); - QDomElement single = doc.createElement( "single" ); + QDomElement body = doc.createElement( QStringLiteral("body") ); + QDomElement single = doc.createElement( QStringLiteral("single") ); - newLayout.appendChild( createItemElement( doc, "single_track", layout.layoutForPart( PlaylistLayout::Single ) ) ); - newLayout.appendChild( createItemElement( doc, "group_head", layout.layoutForPart( PlaylistLayout::Head ) ) ); - newLayout.appendChild( createItemElement( doc, "group_body", layout.layoutForPart( PlaylistLayout::StandardBody ) ) ); - newLayout.appendChild( createItemElement( doc, "group_variousArtistsBody", layout.layoutForPart( PlaylistLayout::VariousArtistsBody ) ) ); + newLayout.appendChild( createItemElement( doc, QStringLiteral("single_track"), layout.layoutForPart( PlaylistLayout::Single ) ) ); + newLayout.appendChild( createItemElement( doc, QStringLiteral("group_head"), layout.layoutForPart( PlaylistLayout::Head ) ) ); + newLayout.appendChild( createItemElement( doc, QStringLiteral("group_body"), layout.layoutForPart( PlaylistLayout::StandardBody ) ) ); + newLayout.appendChild( createItemElement( doc, QStringLiteral("group_variousArtistsBody"), layout.layoutForPart( PlaylistLayout::VariousArtistsBody ) ) ); if( layout.inlineControls() ) - newLayout.setAttribute( "inline_controls", "true" ); + newLayout.setAttribute( QStringLiteral("inline_controls"), QStringLiteral("true") ); if( layout.tooltips() ) - newLayout.setAttribute( "tooltips", "true" ); + newLayout.setAttribute( QStringLiteral("tooltips"), QStringLiteral("true") ); - newLayout.setAttribute( "group_by", layout.groupBy() ); + newLayout.setAttribute( QStringLiteral("group_by"), layout.groupBy() ); - QDir layoutsDir = QDir( Amarok::saveLocation( "playlist_layouts/" ) ); + QDir layoutsDir = QDir( Amarok::saveLocation( QStringLiteral("playlist_layouts/") ) ); //make sure that this directory exists if ( !layoutsDir.exists() ) - layoutsDir.mkpath( Amarok::saveLocation( "playlist_layouts/" ) ); + layoutsDir.mkpath( Amarok::saveLocation( QStringLiteral("playlist_layouts/") ) ); QFile file( layoutsDir.filePath( name + ".xml" ) ); if ( !file.open(QIODevice::WriteOnly | QIODevice::Text) ) @@ -343,37 +343,37 @@ QDomElement element = doc.createElement( name ); QString showCover = item.showCover() ? "true" : "false"; - element.setAttribute ( "show_cover", showCover ); - element.setAttribute ( "active_indicator_row", QString::number( item.activeIndicatorRow() ) ); + element.setAttribute ( QStringLiteral("show_cover"), showCover ); + element.setAttribute ( QStringLiteral("active_indicator_row"), QString::number( item.activeIndicatorRow() ) ); for( int i = 0; i < item.rows(); i++ ) { LayoutItemConfigRow row = item.row( i ); - QDomElement rowElement = doc.createElement( "row" ); + QDomElement rowElement = doc.createElement( QStringLiteral("row") ); element.appendChild( rowElement ); for( int j = 0; j < row.count(); j++ ) { LayoutItemConfigRowElement element = row.element( j ); - QDomElement elementElement = doc.createElement( "element" ); + QDomElement elementElement = doc.createElement( QStringLiteral("element") ); - elementElement.setAttribute ( "prefix", element.prefix() ); - elementElement.setAttribute ( "suffix", element.suffix() ); - elementElement.setAttribute ( "value", internalColumnName( static_cast( element.value() ) ) ); - elementElement.setAttribute ( "size", QString::number( element.size() ) ); - elementElement.setAttribute ( "bold", element.bold() ? "true" : "false" ); - elementElement.setAttribute ( "italic", element.italic() ? "true" : "false" ); - elementElement.setAttribute ( "underline", element.underline() ? "true" : "false" ); + elementElement.setAttribute ( QStringLiteral("prefix"), element.prefix() ); + elementElement.setAttribute ( QStringLiteral("suffix"), element.suffix() ); + elementElement.setAttribute ( QStringLiteral("value"), internalColumnName( static_cast( element.value() ) ) ); + elementElement.setAttribute ( QStringLiteral("size"), QString::number( element.size() ) ); + elementElement.setAttribute ( QStringLiteral("bold"), element.bold() ? "true" : "false" ); + elementElement.setAttribute ( QStringLiteral("italic"), element.italic() ? "true" : "false" ); + elementElement.setAttribute ( QStringLiteral("underline"), element.underline() ? "true" : "false" ); QString alignmentString; if ( element.alignment() & Qt::AlignLeft ) - alignmentString = "left"; + alignmentString = QStringLiteral("left"); else if ( element.alignment() & Qt::AlignRight ) - alignmentString = "right"; + alignmentString = QStringLiteral("right"); else - alignmentString = "center"; + alignmentString = QStringLiteral("center"); - elementElement.setAttribute ( "alignment", alignmentString ); + elementElement.setAttribute ( QStringLiteral("alignment"), alignmentString ); rowElement.appendChild( elementElement ); } @@ -400,21 +400,21 @@ //check if layout is editable if ( m_layouts.value( layout ).isEditable() ) { - QDir layoutsDir = QDir( Amarok::saveLocation( "playlist_layouts/" ) ); - QString xmlFile = layoutsDir.path() + '/' + layout + ".xml"; + QDir layoutsDir = QDir( Amarok::saveLocation( QStringLiteral("playlist_layouts/") ) ); + QString xmlFile = layoutsDir.path() + QLatin1Char('/') + layout + ".xml"; if ( !QFile::remove( xmlFile ) ) debug() << "error deleting file" << xmlFile; m_layouts.remove( layout ); m_layoutNames.removeAll( layout ); - emit( layoutListChanged() ); + Q_EMIT( layoutListChanged() ); if ( layout == m_activeLayout ) - setActiveLayout( "Default" ); + setActiveLayout( QStringLiteral("Default") ); } else - KMessageBox::sorry( 0, i18n( "The layout '%1' is one of the default layouts and cannot be deleted.", layout ), i18n( "Cannot Delete Default Layouts" ) ); + KMessageBox::sorry( nullptr, i18n( "The layout '%1' is one of the default layouts and cannot be deleted.", layout ), i18n( "Cannot Delete Default Layouts" ) ); } bool LayoutManager::isDeleteable( const QString &layout ) const @@ -427,7 +427,7 @@ int index = m_layoutNames.indexOf( layout ); if ( index > 0 ) { m_layoutNames.swap ( index, index - 1 ); - emit( layoutListChanged() ); + Q_EMIT( layoutListChanged() ); storeLayoutOrdering(); return index - 1; } @@ -440,7 +440,7 @@ int index = m_layoutNames.indexOf( layout ); if ( index < m_layoutNames.size() -1 ) { m_layoutNames.swap ( index, index + 1 ); - emit( layoutListChanged() ); + Q_EMIT( layoutListChanged() ); storeLayoutOrdering(); return index + 1; } @@ -450,12 +450,12 @@ void LayoutManager::orderLayouts() { - KConfigGroup config = Amarok::config( "Playlist Layout" ); + KConfigGroup config = Amarok::config( QStringLiteral("Playlist Layout") ); QString orderString = config.readEntry( "Order", "Default" ); QStringList knownLayouts = m_layouts.keys(); - QStringList orderingList = orderString.split( ';', QString::SkipEmptyParts ); + QStringList orderingList = orderString.split( QLatin1Char(';'), QString::SkipEmptyParts ); foreach( const QString &layout, orderingList ) { @@ -488,7 +488,7 @@ if ( !ordering.isEmpty() ) ordering.chop( 1 ); //remove trailing; - KConfigGroup config = Amarok::config("Playlist Layout"); + KConfigGroup config = Amarok::config(QStringLiteral("Playlist Layout")); config.writeEntry( "Order", ordering ); } diff --git a/src/playlist/layouts/PlaylistLayoutEditDialog.h b/src/playlist/layouts/PlaylistLayoutEditDialog.h --- a/src/playlist/layouts/PlaylistLayoutEditDialog.h +++ b/src/playlist/layouts/PlaylistLayoutEditDialog.h @@ -43,7 +43,7 @@ * Populates the token pool, loads the available layouts from the LayoutManager in the right area and loads the configuration of the currently active layout. * @param parent The parent widget. */ - PlaylistLayoutEditDialog( QWidget *parent = 0 ); + explicit PlaylistLayoutEditDialog( QWidget *parent = nullptr ); /** * Destructor. @@ -69,12 +69,12 @@ /** * Accepts the currently changed layouts and stores them. Closes the dialog. */ - virtual void accept(); + void accept() override; /** * Reject the changed layouts and close the dialog. */ - virtual void reject(); + void reject() override; /** * Accepts the currently changed layouts and stores them. diff --git a/src/playlist/layouts/PlaylistLayoutEditDialog.cpp b/src/playlist/layouts/PlaylistLayoutEditDialog.cpp --- a/src/playlist/layouts/PlaylistLayoutEditDialog.cpp +++ b/src/playlist/layouts/PlaylistLayoutEditDialog.cpp @@ -108,27 +108,27 @@ connect( moveUpButton, &QAbstractButton::clicked, this, &PlaylistLayoutEditDialog::moveUp ); connect( moveDownButton, &QAbstractButton::clicked, this, &PlaylistLayoutEditDialog::moveDown ); - buttonBox->button(QDialogButtonBox::Apply)->setIcon( QIcon::fromTheme( "dialog-ok-apply" ) ); - buttonBox->button(QDialogButtonBox::Ok)->setIcon( QIcon::fromTheme( "dialog-ok" ) ); - buttonBox->button(QDialogButtonBox::Cancel)->setIcon( QIcon::fromTheme( "dialog-cancel" ) ); + buttonBox->button(QDialogButtonBox::Apply)->setIcon( QIcon::fromTheme( QStringLiteral("dialog-ok-apply") ) ); + buttonBox->button(QDialogButtonBox::Ok)->setIcon( QIcon::fromTheme( QStringLiteral("dialog-ok") ) ); + buttonBox->button(QDialogButtonBox::Cancel)->setIcon( QIcon::fromTheme( QStringLiteral("dialog-cancel") ) ); connect( buttonBox->button(QDialogButtonBox::Apply), &QAbstractButton::clicked, this, &PlaylistLayoutEditDialog::apply ); - const QIcon newIcon( "document-new" ); + const QIcon newIcon = QIcon::fromTheme( QStringLiteral("document-new") ); newLayoutButton->setIcon( newIcon ); newLayoutButton->setToolTip( i18n( "New playlist layout" ) ); connect( newLayoutButton, &QAbstractButton::clicked, this, &PlaylistLayoutEditDialog::newLayout ); - const QIcon copyIcon( "edit-copy" ); + const QIcon copyIcon = QIcon::fromTheme( QStringLiteral("edit-copy") ); copyLayoutButton->setIcon( copyIcon ); copyLayoutButton->setToolTip( i18n( "Copy playlist layout" ) ); connect( copyLayoutButton, &QAbstractButton::clicked, this, &PlaylistLayoutEditDialog::copyLayout ); - const QIcon deleteIcon( "edit-delete" ); + const QIcon deleteIcon( QStringLiteral("edit-delete") ); deleteLayoutButton->setIcon( deleteIcon ); deleteLayoutButton->setToolTip( i18n( "Delete playlist layout" ) ); connect( deleteLayoutButton, &QAbstractButton::clicked, this, &PlaylistLayoutEditDialog::deleteLayout ); - const QIcon renameIcon( "edit-rename" ); + const QIcon renameIcon = QIcon::fromTheme( QStringLiteral("edit-rename") ); renameLayoutButton->setIcon( renameIcon ); renameLayoutButton->setToolTip( i18n( "Rename playlist layout" ) ); connect( renameLayoutButton, &QAbstractButton::clicked, this, &PlaylistLayoutEditDialog::renameLayout ); @@ -169,7 +169,7 @@ KMessageBox::sorry( this, i18n( "Cannot create a layout with the same name as an existing layout." ), i18n( "Layout name error" ) ); return; } - if( layoutName.contains( '/' ) ) + if( layoutName.contains( QLatin1Char('/') ) ) { KMessageBox::sorry( this, i18n( "Cannot create a layout containing '/'." ), i18n( "Layout name error" ) ); return; @@ -303,7 +303,7 @@ groupByComboBox->setCurrentIndex( groupByComboBox->findData( layout.groupBy() ) ); setEnabledTabs(); - //make sure that it is not marked dirty (it will be because of the changed signal triggereing when loagin it) + //make sure that it is not marked dirty (it will be because of the changed signal triggering when loading it) //unless it is actually changed debug() << "not dirty anyway!!"; (*m_layoutsMap)[m_layoutName].setDirty( false ); @@ -369,7 +369,7 @@ else if ( layoutListWidget->currentRow() >= m_layoutsMap->size() -1 ) { moveDownButton->setEnabled( 0 ); - moveUpButton->setEnabled( 1 ); //we already cheked that this is not row 0 + moveUpButton->setEnabled( 1 ); //we already checked that this is not row 0 } else { @@ -445,7 +445,7 @@ debug() << "Applying initial layout: " << m_firstActiveLayout; if( layoutListWidget->findItems( m_firstActiveLayout, Qt::MatchExactly ).isEmpty() ) - LayoutManager::instance()->setActiveLayout( "Default" ); + LayoutManager::instance()->setActiveLayout( QStringLiteral("Default") ); else LayoutManager::instance()->setActiveLayout( m_firstActiveLayout ); @@ -481,7 +481,7 @@ //Enable or disable tabs depending on whether grouping is allowed. QString grouping = groupByComboBox->itemData( groupByComboBox->currentIndex() ).toString(); - bool groupingEnabled = ( !grouping.isEmpty() && grouping != "None" ); + bool groupingEnabled = ( !grouping.isEmpty() && grouping != QLatin1String("None") ); if ( !groupingEnabled ) elementTabs->setCurrentWidget( m_partsEdit[PlaylistLayout::Single] ); @@ -509,7 +509,7 @@ //Add the option to not perform grouping //Use a null string to specify "no grouping" - groupByComboBox->addItem( i18n( "No Grouping" ), QVariant( "None" ) ); + groupByComboBox->addItem( i18n( "No Grouping" ), QVariant( QStringLiteral("None") ) ); } void diff --git a/src/playlist/navigators/AlbumNavigator.h b/src/playlist/navigators/AlbumNavigator.h --- a/src/playlist/navigators/AlbumNavigator.h +++ b/src/playlist/navigators/AlbumNavigator.h @@ -42,8 +42,8 @@ protected: //! Overrides from 'NonlinearTrackNavigator' - void notifyItemsInserted( const QSet &insertedItems ); - void notifyItemsRemoved( const QSet &removedItems ); + void notifyItemsInserted( const QSet &insertedItems ) override; + void notifyItemsRemoved( const QSet &removedItems ) override; typedef QString AlbumId; // Not Meta::AlbumPtr but QString '->name()'. Reason: Meta::AlbumPtr doesn't work for meta types that use private album pointers. @@ -55,7 +55,7 @@ /** * Empty notification callback for child classes: new albums have been inserted. */ - virtual void notifyAlbumsInserted( const QList insertedAlbums ) = 0; + virtual void notifyAlbumsInserted( const QList &insertedAlbums ) = 0; /** * Convenience function: the album of 'currentItem()'. diff --git a/src/playlist/navigators/DynamicTrackNavigator.h b/src/playlist/navigators/DynamicTrackNavigator.h --- a/src/playlist/navigators/DynamicTrackNavigator.h +++ b/src/playlist/navigators/DynamicTrackNavigator.h @@ -51,7 +51,7 @@ private Q_SLOTS: void activePlaylistChanged(); - void receiveTracks( Meta::TrackList ); + void receiveTracks( const Meta::TrackList &); void trackChanged(); private: diff --git a/src/playlist/navigators/DynamicTrackNavigator.cpp b/src/playlist/navigators/DynamicTrackNavigator.cpp --- a/src/playlist/navigators/DynamicTrackNavigator.cpp +++ b/src/playlist/navigators/DynamicTrackNavigator.cpp @@ -48,7 +48,7 @@ } void -Playlist::DynamicTrackNavigator::receiveTracks( Meta::TrackList tracks ) +Playlist::DynamicTrackNavigator::receiveTracks( const Meta::TrackList &tracks ) { The::playlistController()->insertOptioned( tracks ); } diff --git a/src/playlist/navigators/FavoredRandomTrackNavigator.h b/src/playlist/navigators/FavoredRandomTrackNavigator.h --- a/src/playlist/navigators/FavoredRandomTrackNavigator.h +++ b/src/playlist/navigators/FavoredRandomTrackNavigator.h @@ -34,11 +34,11 @@ private: //! Override from 'NonlinearTrackNavigator' - void planOne(); - void notifyItemsInserted( const QSet &insertedItems ) { Q_UNUSED( insertedItems ); } - void notifyItemsRemoved( const QSet &removedItems ) { Q_UNUSED( removedItems ); } + void planOne() override; + void notifyItemsInserted( const QSet &insertedItems ) override { Q_UNUSED( insertedItems ); } + void notifyItemsRemoved( const QSet &removedItems ) override { Q_UNUSED( removedItems ); } - QList rowWeights( QSet avoidSet ); + QList rowWeights( const QSet &avoidSet ); QSet getRecentHistory( int size ); }; diff --git a/src/playlist/navigators/FavoredRandomTrackNavigator.cpp b/src/playlist/navigators/FavoredRandomTrackNavigator.cpp --- a/src/playlist/navigators/FavoredRandomTrackNavigator.cpp +++ b/src/playlist/navigators/FavoredRandomTrackNavigator.cpp @@ -72,7 +72,7 @@ } QList -Playlist::FavoredRandomTrackNavigator::rowWeights( QSet avoidSet ) +Playlist::FavoredRandomTrackNavigator::rowWeights(const QSet &avoidSet ) { QList weights; diff --git a/src/playlist/navigators/NavigatorConfigAction.h b/src/playlist/navigators/NavigatorConfigAction.h --- a/src/playlist/navigators/NavigatorConfigAction.h +++ b/src/playlist/navigators/NavigatorConfigAction.h @@ -29,7 +29,7 @@ * Constructor. * @param parent Parent widget. */ - NavigatorConfigAction( QWidget * parent ); + explicit NavigatorConfigAction( QWidget * parent ); /** * Destructor. @@ -40,7 +40,7 @@ /** * Set the currently active navigator based on the selected action. - * @param layoutAction The action triggered. + * @param navigatorAction The action triggered. */ void setActiveNavigator( QAction *navigatorAction ); diff --git a/src/playlist/navigators/NavigatorConfigAction.cpp b/src/playlist/navigators/NavigatorConfigAction.cpp --- a/src/playlist/navigators/NavigatorConfigAction.cpp +++ b/src/playlist/navigators/NavigatorConfigAction.cpp @@ -36,40 +36,40 @@ navigatorActions->setExclusive( true ); m_standardNavigatorAction = navigatorActions->addAction( i18n( "Standard" ) ); - m_standardNavigatorAction->setIcon( QIcon::fromTheme( "media-standard-track-progression-amarok" ) ); + m_standardNavigatorAction->setIcon( QIcon::fromTheme( QStringLiteral("media-standard-track-progression-amarok") ) ); m_standardNavigatorAction->setCheckable( true ); //action->setIcon( true ); m_onlyQueueNavigatorAction = navigatorActions->addAction( i18n( "Only Queue" ) ); - m_onlyQueueNavigatorAction->setIcon( QIcon::fromTheme( "media-standard-track-progression-amarok" ) ); + m_onlyQueueNavigatorAction->setIcon( QIcon::fromTheme( QStringLiteral("media-standard-track-progression-amarok") ) ); m_onlyQueueNavigatorAction->setCheckable( true ); QAction * action = new QAction( parent ); action->setSeparator( true ); navigatorActions->addAction( action ); m_repeatTrackNavigatorAction = navigatorActions->addAction( i18n( "Repeat Track" ) ); - m_repeatTrackNavigatorAction->setIcon( QIcon::fromTheme( "media-repeat-track-amarok" ) ); + m_repeatTrackNavigatorAction->setIcon( QIcon::fromTheme( QStringLiteral("media-repeat-track-amarok") ) ); m_repeatTrackNavigatorAction->setCheckable( true ); m_repeatAlbumNavigatorAction = navigatorActions->addAction( i18n( "Repeat Album" ) ); - m_repeatAlbumNavigatorAction->setIcon( QIcon::fromTheme( "media-repeat-album-amarok" ) ); + m_repeatAlbumNavigatorAction->setIcon( QIcon::fromTheme( QStringLiteral("media-repeat-album-amarok") ) ); m_repeatAlbumNavigatorAction->setCheckable( true ); m_repeatPlaylistNavigatorAction = navigatorActions->addAction( i18n( "Repeat Playlist" ) ); - m_repeatPlaylistNavigatorAction->setIcon( QIcon::fromTheme( "media-repeat-playlist-amarok" ) ); + m_repeatPlaylistNavigatorAction->setIcon( QIcon::fromTheme( QStringLiteral("media-repeat-playlist-amarok") ) ); m_repeatPlaylistNavigatorAction->setCheckable( true ); action = new QAction( parent ); action->setSeparator( true ); navigatorActions->addAction( action ); m_randomTrackNavigatorAction = navigatorActions->addAction( i18n( "Random Tracks" ) ); - m_randomTrackNavigatorAction->setIcon( QIcon::fromTheme( "media-random-tracks-amarok" ) ); + m_randomTrackNavigatorAction->setIcon( QIcon::fromTheme( QStringLiteral("media-random-tracks-amarok") ) ); m_randomTrackNavigatorAction->setCheckable( true ); m_randomAlbumNavigatorAction = navigatorActions->addAction( i18n( "Random Albums" ) ); - m_randomAlbumNavigatorAction->setIcon( QIcon::fromTheme( "media-random-albums-amarok" ) ); + m_randomAlbumNavigatorAction->setIcon( QIcon::fromTheme( QStringLiteral("media-random-albums-amarok") ) ); m_randomAlbumNavigatorAction->setCheckable( true ); navigatorMenu->addActions( navigatorActions->actions() ); diff --git a/src/playlist/navigators/NonlinearTrackNavigator.h b/src/playlist/navigators/NonlinearTrackNavigator.h --- a/src/playlist/navigators/NonlinearTrackNavigator.h +++ b/src/playlist/navigators/NonlinearTrackNavigator.h @@ -51,12 +51,12 @@ NonlinearTrackNavigator(); //! Overrides from 'TrackNavigator' - quint64 likelyNextTrack(); - quint64 requestNextTrack(); - quint64 requestUserNextTrack() { return requestNextTrack(); } + quint64 likelyNextTrack() override; + quint64 requestNextTrack() override; + quint64 requestUserNextTrack() override { return requestNextTrack(); } - quint64 likelyLastTrack(); - quint64 requestLastTrack(); + quint64 likelyLastTrack() override; + quint64 requestLastTrack() override; static const int MAX_HISTORY_SIZE = 1000; // This is probably enough for even the most crazed user. diff --git a/src/playlist/navigators/RandomAlbumNavigator.h b/src/playlist/navigators/RandomAlbumNavigator.h --- a/src/playlist/navigators/RandomAlbumNavigator.h +++ b/src/playlist/navigators/RandomAlbumNavigator.h @@ -41,10 +41,10 @@ private: //! Override from 'AlbumNavigator' - void notifyAlbumsInserted( const QList insertedAlbums ); + void notifyAlbumsInserted( const QList &insertedAlbums ) override; //! Override from 'NonlinearTrackNavigator' - void planOne(); + void planOne() override; }; } diff --git a/src/playlist/navigators/RandomAlbumNavigator.cpp b/src/playlist/navigators/RandomAlbumNavigator.cpp --- a/src/playlist/navigators/RandomAlbumNavigator.cpp +++ b/src/playlist/navigators/RandomAlbumNavigator.cpp @@ -75,7 +75,7 @@ } void -Playlist::RandomAlbumNavigator::notifyAlbumsInserted( const QList insertedAlbums ) +Playlist::RandomAlbumNavigator::notifyAlbumsInserted( const QList &insertedAlbums ) { DEBUG_BLOCK diff --git a/src/playlist/navigators/RandomTrackNavigator.h b/src/playlist/navigators/RandomTrackNavigator.h --- a/src/playlist/navigators/RandomTrackNavigator.h +++ b/src/playlist/navigators/RandomTrackNavigator.h @@ -39,12 +39,12 @@ private: //! Overrides from 'NonlinearTrackNavigator' - void planOne(); - void notifyItemsInserted( const QSet &insertedItems ) { Q_UNUSED( insertedItems ); } - void notifyItemsRemoved( const QSet &removedItems ) { Q_UNUSED( removedItems ); } + void planOne() override; + void notifyItemsInserted( const QSet &insertedItems ) override { Q_UNUSED( insertedItems ); } + void notifyItemsRemoved( const QSet &removedItems ) override { Q_UNUSED( removedItems ); } QSet getRecentHistory( int size ); - quint64 chooseRandomItem( QSet avoidSet ); + quint64 chooseRandomItem(const QSet &avoidSet ); }; } diff --git a/src/playlist/navigators/RandomTrackNavigator.cpp b/src/playlist/navigators/RandomTrackNavigator.cpp --- a/src/playlist/navigators/RandomTrackNavigator.cpp +++ b/src/playlist/navigators/RandomTrackNavigator.cpp @@ -82,7 +82,7 @@ } quint64 -Playlist::RandomTrackNavigator::chooseRandomItem( QSet avoidSet ) +Playlist::RandomTrackNavigator::chooseRandomItem( const QSet &avoidSet ) { quint64 chosenItem; diff --git a/src/playlist/navigators/RepeatAlbumNavigator.h b/src/playlist/navigators/RepeatAlbumNavigator.h --- a/src/playlist/navigators/RepeatAlbumNavigator.h +++ b/src/playlist/navigators/RepeatAlbumNavigator.h @@ -42,10 +42,10 @@ private: //! Override from 'AlbumNavigator' - void notifyAlbumsInserted( const QList insertedAlbums ) { Q_UNUSED( insertedAlbums ); } + void notifyAlbumsInserted( const QList &insertedAlbums ) override { Q_UNUSED( insertedAlbums ); } //! Override from 'NonlinearTrackNavigator' - void planOne(); + void planOne() override; }; } #endif diff --git a/src/playlist/navigators/RepeatTrackNavigator.h b/src/playlist/navigators/RepeatTrackNavigator.h --- a/src/playlist/navigators/RepeatTrackNavigator.h +++ b/src/playlist/navigators/RepeatTrackNavigator.h @@ -33,10 +33,10 @@ public: RepeatTrackNavigator(); - quint64 likelyNextTrack() { return m_trackid ? m_trackid : bestFallbackItem(); } + quint64 likelyNextTrack() override { return m_trackid ? m_trackid : bestFallbackItem(); } // likelyLastTrack(): The user explicitly asks for change. Let parent 'StandardTrackNavigator' handle that. - quint64 requestNextTrack() { return likelyNextTrack(); } - quint64 requestUserNextTrack() { return StandardTrackNavigator::requestNextTrack(); } // The user explicitly asks for change. Use the 'next' behaviour of parent 'StandardTrackNavigator'. + quint64 requestNextTrack() override { return likelyNextTrack(); } + quint64 requestUserNextTrack() override { return StandardTrackNavigator::requestNextTrack(); } // The user explicitly asks for change. Use the 'next' behaviour of parent 'StandardTrackNavigator'. // requestLastTrack(): The user explicitly asks for change. Let parent 'StandardTrackNavigator' handle that. private Q_SLOTS: diff --git a/src/playlist/navigators/StandardTrackNavigator.h b/src/playlist/navigators/StandardTrackNavigator.h --- a/src/playlist/navigators/StandardTrackNavigator.h +++ b/src/playlist/navigators/StandardTrackNavigator.h @@ -32,11 +32,11 @@ public: StandardTrackNavigator(); - virtual quint64 likelyNextTrack() { return chooseNextTrack( m_repeatPlaylist ); } - virtual quint64 likelyLastTrack(); - virtual quint64 requestNextTrack(); - virtual quint64 requestUserNextTrack(); - virtual quint64 requestLastTrack(); + quint64 likelyNextTrack() override { return chooseNextTrack( m_repeatPlaylist ); } + quint64 likelyLastTrack() override; + quint64 requestNextTrack() override; + quint64 requestUserNextTrack() override; + quint64 requestLastTrack() override; private: /** diff --git a/src/playlist/proxymodels/AbstractModel.h b/src/playlist/proxymodels/AbstractModel.h --- a/src/playlist/proxymodels/AbstractModel.h +++ b/src/playlist/proxymodels/AbstractModel.h @@ -124,16 +124,16 @@ /** * Get the current search term. - * @return The curent search term. + * @return The current search term. */ virtual QString currentSearchTerm() { return QString(); } //dummy, needed by Playlist::Model /** * Saves a playlist to a specified location. * @param path the path of the playlist file, as chosen by a FileDialog in MainWindow. * @param relative use relative paths. Defaults to false, uses absolute paths. */ - virtual bool exportPlaylist( const QString &path, bool relative = false ) const = 0; + virtual bool exportPlaylist( const QString &path, bool relative = false ) = 0; /** * Notify FilterProxy that the search term of searched fields has changed. Since this @@ -151,8 +151,8 @@ * Filtering MUST take its filter parameters from this call, but SHOULD delay doing * any work until it gets a 'filterUpdated()' call. * - * @param searchTerm The term to search for. - * @param searchFields A bitmask specifying the fields to look in. + * The first parameter is a term to search for. + * The second parameter is a bitmask specifying the fields to look in. * @return The row of the first found match, -1 if no match is found. */ virtual int find( const QString &, int ) { return -1; } @@ -164,9 +164,9 @@ * depending on whether a match is found. If no row is found below the current row, the * function wraps around and returns the first match. If no match is found at all, -1 * is returned. - * @param searchTerm The term to search for. - * @param selectedRow The offset row. - * @param searchFields A bitmask specifying the fields to look in. + * The first parameter is a term to search for. + * The second parameter is an offset row. + * The third parameter is a bitmask specifying the fields to look in. * @return The row of the first found match below the offset, -1 if no match is found. */ virtual int findNext( const QString &, int, int ) { return -1; } @@ -178,9 +178,9 @@ * depending on whether a match is found. If no row is found above the current row, the * function wraps around and returns the last match. If no match is found at all, -1 * is returned. - * @param searchTerm The term to search for. - * @param selectedRow The offset row. - * @param searchFields A bitmask specifying the fields to look in. + * The first parameter is a term to search for. + * The second parameter is an offset row. + * The third parameter is a bitmask specifying the fields to look in. * @return The row of the first found match above the offset, -1 if no match is found. */ virtual int findPrevious( const QString &, int, int ) {return -1; } @@ -257,7 +257,7 @@ /** * Decides if FilterProxy or SearchProxy should be used. - * @param onlyMatches true if one wants to use SearchProxy, false otherwise. + * The parameter is true if one wants to use SearchProxy, false otherwise. */ virtual void showOnlyMatches( bool ) {} @@ -305,7 +305,7 @@ * Returns an ordered list of tracks exposed by the current model. * @return the tracklist. */ - virtual Meta::TrackList tracks() const = 0; + virtual Meta::TrackList tracks() = 0; }; } //namespace Playlist diff --git a/src/playlist/proxymodels/GroupingProxy.h b/src/playlist/proxymodels/GroupingProxy.h --- a/src/playlist/proxymodels/GroupingProxy.h +++ b/src/playlist/proxymodels/GroupingProxy.h @@ -60,19 +60,19 @@ Q_OBJECT public: - explicit GroupingProxy( AbstractModel *belowModel, QObject *parent = 0 ); + explicit GroupingProxy( AbstractModel *belowModel, QObject *parent = nullptr ); ~GroupingProxy(); static GroupingProxy* instance(); static void destroy(); //! Configuration + QString groupingCategory() const; /** - * The criterium by which adjacent items are divided into groups. + * The criterion by which adjacent items are divided into groups. * @param groupingCategory A string from 'groupableCategories', or "None", or empty string. */ - QString groupingCategory() const; void setGroupingCategory( const QString &groupingCategory ); @@ -109,7 +109,7 @@ //! Custom version of functions inherited from QSortFilterProxyModel - QVariant data( const QModelIndex &index, int role ) const; + QVariant data( const QModelIndex &index, int role ) const override; //Q_SIGNALS: // Emits signals inherited from QSortFilterProxy diff --git a/src/playlist/proxymodels/GroupingProxy.cpp b/src/playlist/proxymodels/GroupingProxy.cpp --- a/src/playlist/proxymodels/GroupingProxy.cpp +++ b/src/playlist/proxymodels/GroupingProxy.cpp @@ -39,7 +39,7 @@ Playlist::GroupingProxy::GroupingProxy( Playlist::AbstractModel *belowModel, QObject *parent ) : ProxyBase( belowModel, parent ) { - setGroupingCategory( QString( "Album" ) ); + setGroupingCategory( QStringLiteral( "Album" ) ); // Adjust our internal state based on changes in the source model. @@ -71,7 +71,7 @@ // No need to scan the pre-existing entries in sourceModel(), because we build our // internal state on-the-fly. - setObjectName( "GroupingProxy" ); + setObjectName( QStringLiteral("GroupingProxy") ); } Playlist::GroupingProxy::~GroupingProxy() @@ -97,7 +97,7 @@ // - Not 'layoutChanged': that is for when rows have been moved around, which they haven't. // - Not 'modelReset': that is too heavy. E.g. it also invalidates QListView item selections, etc. if ( rowCount() > 0 ) - emit dataChanged( index( 0, 0 ), index( rowCount() - 1, columnCount() - 1 ) ); + Q_EMIT dataChanged( index( 0, 0 ), index( rowCount() - 1, columnCount() - 1 ) ); } @@ -323,7 +323,7 @@ case 4: //Genre if( track1->genre() && track2->genre() ) { - debug() << "gruping by genre. Comparing " << track1->genre()->prettyName() << " with " << track2->genre()->prettyName(); + debug() << "grouping by genre. Comparing " << track1->genre()->prettyName() << " with " << track2->genre()->prettyName(); debug() << track1->genre().data() << " == " << track2->genre().data() << " : " << ( *track1->genre().data() == *track2->genre().data()); return ( *track1->genre().data() ) == ( *track2->genre().data() ); } diff --git a/src/playlist/proxymodels/ProxyBase.h b/src/playlist/proxymodels/ProxyBase.h --- a/src/playlist/proxymodels/ProxyBase.h +++ b/src/playlist/proxymodels/ProxyBase.h @@ -38,48 +38,48 @@ /** * Constructor. */ - explicit ProxyBase( AbstractModel *belowModel, QObject *parent = 0 ); + explicit ProxyBase( AbstractModel *belowModel, QObject *parent = nullptr ); /** * Destructor. */ virtual ~ProxyBase(); //! Inherited from Playlist::AbstractModel - QAbstractItemModel* qaim() const { return const_cast( this ); } - - virtual quint64 activeId() const; - virtual int activeRow() const; - virtual Meta::TrackPtr activeTrack() const; - virtual QSet allRowsForTrack( const Meta::TrackPtr& track ) const; - virtual void clearSearchTerm(); - virtual bool containsTrack( const Meta::TrackPtr& track ) const; - virtual int currentSearchFields(); - virtual QString currentSearchTerm(); - virtual bool exportPlaylist( const QString &path, bool relative = false ) const; - virtual void filterUpdated(); - virtual int find( const QString &searchTerm, int searchFields ); - virtual int findNext( const QString &searchTerm, int selectedRow, int searchFields ); - virtual int findPrevious( const QString &searchTerm, int selectedRow, int searchFields ); - virtual int firstRowForTrack( const Meta::TrackPtr& track ) const; - virtual quint64 idAt( const int row ) const; - virtual bool rowExists( int row ) const; - virtual int rowForId( const quint64 id ) const; - virtual int rowFromBottomModel( const int rowInBase ); - virtual int rowToBottomModel( const int rowInProxy ); - virtual void setActiveId( const quint64 id ); - virtual void setActiveRow( int row ); - virtual void setAllUnplayed(); - virtual void emitQueueChanged(); - virtual int queuePositionOfRow( int row ); - virtual void showOnlyMatches( bool onlyMatches ); - virtual Item::State stateOfId( quint64 id ) const; - virtual Item::State stateOfRow( int row ) const; - virtual qint64 totalLength() const; - virtual quint64 totalSize() const; - virtual Meta::TrackPtr trackAt( int row ) const; - virtual Meta::TrackPtr trackForId( const quint64 id ) const; - virtual Meta::TrackList tracks() const; + QAbstractItemModel* qaim() const override { return const_cast( this ); } + + quint64 activeId() const override; + int activeRow() const override; + Meta::TrackPtr activeTrack() const override; + QSet allRowsForTrack( const Meta::TrackPtr& track ) const override; + void clearSearchTerm() override; + bool containsTrack( const Meta::TrackPtr& track ) const override; + int currentSearchFields() override; + QString currentSearchTerm() override; + bool exportPlaylist( const QString &path, bool relative = false ) override; + void filterUpdated() override; + int find( const QString &searchTerm, int searchFields ) override; + int findNext( const QString &searchTerm, int selectedRow, int searchFields ) override; + int findPrevious( const QString &searchTerm, int selectedRow, int searchFields ) override; + int firstRowForTrack( const Meta::TrackPtr& track ) const override; + quint64 idAt( const int row ) const override; + bool rowExists( int row ) const override; + int rowForId( const quint64 id ) const override; + int rowFromBottomModel( const int rowInBase ) override; + int rowToBottomModel( const int rowInProxy ) override; + void setActiveId( const quint64 id ) override; + void setActiveRow( int row ) override; + void setAllUnplayed() override; + void emitQueueChanged() override; + int queuePositionOfRow( int row ) override; + void showOnlyMatches( bool onlyMatches ) override; + Item::State stateOfId( quint64 id ) const override; + Item::State stateOfRow( int row ) const override; + qint64 totalLength() const override; + quint64 totalSize() const override; + Meta::TrackPtr trackAt( int row ) const override; + Meta::TrackPtr trackForId( const quint64 id ) const override; + Meta::TrackList tracks() override; Q_SIGNALS: //! Proxied from Playlist::Model. @@ -90,27 +90,27 @@ /** * Check if a certain row in the source model matches a search term when looking at * the fields specified by the searchFields bitmask. - * @param row The row number in the source model to match against. + * @param sourceModelRow The row number in the source model to match against. * @param searchTerm The search term. * @param searchFields A bitmask containing the fields that should be matched against. * @return True if a match is found in any field, false otherwise. */ bool rowMatch( int sourceModelRow, const QString &searchTerm, int searchFields ) const; /** * Converts a row number in the underlying model to a row number in this proxy. - * @param rowInSource the row number that's valid in 'sourceModel()'. + * @param sourceModelRow the row number that's valid in 'sourceModel()'. * @return the row number that's valid in this proxy. */ virtual int rowFromSource( int sourceModelRow ) const; /** * Converts a row number in this proxy to a row number in the underlying model. * - * As a special case, 'rowInProxy == rowCount()' returns the bottom model's + * As a special case, 'proxyModelRow == rowCount()' returns the bottom model's * 'rowCount()'. See comment at 'rowToBottomModel()'. * - * @param rowInProxy the row number that's valid in this proxy. + * @param proxyModelRow the row number that's valid in this proxy. * @return the row number that's valid in 'sourceModel()'. */ virtual int rowToSource( int proxyModelRow ) const; diff --git a/src/playlist/proxymodels/ProxyBase.cpp b/src/playlist/proxymodels/ProxyBase.cpp --- a/src/playlist/proxymodels/ProxyBase.cpp +++ b/src/playlist/proxymodels/ProxyBase.cpp @@ -106,7 +106,7 @@ } bool -ProxyBase::exportPlaylist( const QString &path, bool relative ) const +ProxyBase::exportPlaylist( const QString &path, bool relative ) { return Playlists::exportPlaylistFile( tracks(), QUrl::fromLocalFile(path), relative ); } @@ -281,7 +281,7 @@ } Meta::TrackList -ProxyBase::tracks() const +ProxyBase::tracks() { Meta::TrackList tl; for( int i = 0; i < rowCount(); ++i ) @@ -299,7 +299,7 @@ Meta::TrackPtr track = m_belowModel->trackAt( sourceModelRow ); - QStringList searchList = searchTerms.split(' ', QString::SkipEmptyParts); + QStringList searchList = searchTerms.split(QLatin1Char(' '), QString::SkipEmptyParts); foreach( const QString& searchTerm, searchList ) { @@ -343,7 +343,7 @@ if( searchFields & MatchRating ) { bool ok; - int rating = QString( searchTerm ).remove( "rating:" ).toInt( &ok ); + int rating = QString( searchTerm ).remove( QStringLiteral("rating:") ).toInt( &ok ); if( ok && ( track->statistics()->rating() == rating ) ) match = true; } diff --git a/src/playlist/proxymodels/SearchProxy.h b/src/playlist/proxymodels/SearchProxy.h --- a/src/playlist/proxymodels/SearchProxy.h +++ b/src/playlist/proxymodels/SearchProxy.h @@ -35,7 +35,7 @@ /** * Constructor. */ - explicit SearchProxy( AbstractModel *belowModel, QObject *parent = 0 ); + explicit SearchProxy( AbstractModel *belowModel, QObject *parent = nullptr ); /** * Destructor. @@ -45,12 +45,12 @@ /** * Implementation of Playlist::AbstractModel: search/filter-related functions. */ - void clearSearchTerm(); - int currentSearchFields() { return m_currentSearchFields; } - QString currentSearchTerm() { return m_currentSearchTerm; } - int find( const QString & searchTerm, int searchFields = MatchTrack ); - int findNext( const QString & searchTerm, int selectedRow, int searchFields = MatchTrack ); - int findPrevious( const QString & searchTerm, int selectedRow, int searchFields = MatchTrack ); + void clearSearchTerm() override; + int currentSearchFields() override { return m_currentSearchFields; } + QString currentSearchTerm() override { return m_currentSearchTerm; } + int find( const QString & searchTerm, int searchFields = MatchTrack ) override; + int findNext( const QString & searchTerm, int selectedRow, int searchFields = MatchTrack ) override; + int findPrevious( const QString & searchTerm, int selectedRow, int searchFields = MatchTrack ) override; private: QString m_currentSearchTerm; diff --git a/src/playlist/proxymodels/SortAlgorithms.h b/src/playlist/proxymodels/SortAlgorithms.h --- a/src/playlist/proxymodels/SortAlgorithms.h +++ b/src/playlist/proxymodels/SortAlgorithms.h @@ -36,24 +36,24 @@ { /** * Constructor. - * @param sourceProxy a pointer to the underlying proxy instance. - * @param scheme the sorting scheme that needs to be applied. */ multilevelLessThan() : m_scheme( SortScheme() ) { } /** * Set sort scheme + * @param scheme the sorting scheme that needs to be applied. */ void setSortScheme( const SortScheme & scheme ); /** * Takes two row numbers from the source model and compares the corresponding indexes * based on a number of chosen criteria (columns). - * @param rowA the first row. - * @param rowB the second row. - * @return true if rowA is to be placed before rowB, false otherwise. + * @param sourceModel the source model. + * @param sourceModelRowA the first row. + * @param sourceModelRowB the second row. + * @return true if sourceModelRowA is to be placed before sourceModelRowB, false otherwise. */ bool operator()( const QAbstractItemModel* sourceModel, int sourceModelRowA, int sourceModelRowB ) const; diff --git a/src/playlist/proxymodels/SortAlgorithms.cpp b/src/playlist/proxymodels/SortAlgorithms.cpp --- a/src/playlist/proxymodels/SortAlgorithms.cpp +++ b/src/playlist/proxymodels/SortAlgorithms.cpp @@ -70,7 +70,7 @@ // The track with higher lastPlayed value was played more recently // // '!=' is the XOR operation; it simply negates the result if 'inverted' - // is true. It isn't necessarry to do it this way, although later on it will + // is true. It isn't necessary to do it this way, although later on it will // ease figuring out what's actually being returned. if( lastPlayedA != lastPlayedB ) return ( lastPlayedA > lastPlayedB ) != inverted; diff --git a/src/playlist/proxymodels/SortFilterProxy.h b/src/playlist/proxymodels/SortFilterProxy.h --- a/src/playlist/proxymodels/SortFilterProxy.h +++ b/src/playlist/proxymodels/SortFilterProxy.h @@ -49,7 +49,7 @@ * Applies a sorting scheme to the playlist. * @param scheme the sorting scheme that will be applied. */ - virtual void updateSortMap( SortScheme scheme ) = 0; + virtual void updateSortMap( const SortScheme &scheme ) = 0; }; @@ -64,26 +64,26 @@ public: //! Basics. - explicit SortFilterProxy( AbstractModel *belowModel, QObject *parent = 0 ); + explicit SortFilterProxy( AbstractModel *belowModel, QObject *parent = nullptr ); ~SortFilterProxy(); //! Sort-related functions. //! SortProxy public functions - bool isSorted(); - void updateSortMap( SortScheme scheme ); + bool isSorted() override; + void updateSortMap( const SortScheme &scheme ) override; //! Filter-related functions. //! Playlist::AbstractModel search-related functions. - void clearSearchTerm(); - void filterUpdated(); + void clearSearchTerm() override; + void filterUpdated() override; /** This will set the search term for the filter. filterUpdated() must be called to update the results. This allows client 'PrettyListView' to give the user the time to type a few characters before we do a filter run that might block for a few seconds. */ - int find( const QString & searchTerm, int searchFields = MatchTrack ); - void showOnlyMatches( bool onlyMatches ); + int find( const QString & searchTerm, int searchFields = MatchTrack ) override; + void showOnlyMatches( bool onlyMatches ) override; //!Q_SIGNALS: //! Emits signals inherited from QSortFilterProxy @@ -96,16 +96,16 @@ * @param right the second index to compare. * @return true if left is to be placed before right, false otherwise. */ - bool lessThan( const QModelIndex &left, const QModelIndex &right ) const; + bool lessThan( const QModelIndex &left, const QModelIndex &right ) const override; /** * Reimplemented from QSortFilterProxyModel. The filter decision function. * When not in 'showOnlyMatches' mode, this always returns true. - * @param rowInSourceModel The row in 'sourceModel()' to check. - * @param source_parent Ignored. + * @param sourceModelRow The row in 'sourceModel()' to check. + * @param sourceModelParent Ignored. * @return True if the row should be included, false otherwise. */ - bool filterAcceptsRow( int sourceModelRow, const QModelIndex &sourceModelParent ) const; + bool filterAcceptsRow( int sourceModelRow, const QModelIndex &sourceModelParent ) const override; SortScheme m_scheme; //!< The current sorting scheme. diff --git a/src/playlist/proxymodels/SortFilterProxy.cpp b/src/playlist/proxymodels/SortFilterProxy.cpp --- a/src/playlist/proxymodels/SortFilterProxy.cpp +++ b/src/playlist/proxymodels/SortFilterProxy.cpp @@ -25,7 +25,7 @@ #include "amarokconfig.h" -// Note: the 'sort' mode of QSortFilterProxyModel can emit QAbstractItemModel::layoutChanged signals. +// Note: the 'sort' mode of QSortFilterProxyModel can Q_EMIT QAbstractItemModel::layoutChanged signals. // Note: the QSortFilterProxyModel sorting is always on, even with an empty SortScheme. // - That case does not seem worth special-casing @@ -52,7 +52,7 @@ // Tell QSortFilterProxyModel: activate sorting. sort( 0 ); // 0 is a dummy column. - KConfigGroup config = Amarok::config("Playlist Search"); + KConfigGroup config = Amarok::config(QStringLiteral("Playlist Search")); m_showOnlyMatches = config.readEntry( "ShowOnlyMatches", true ); } @@ -78,7 +78,7 @@ } void -SortFilterProxy::updateSortMap( SortScheme scheme ) +SortFilterProxy::updateSortMap( const SortScheme &scheme ) { m_scheme = scheme; m_mlt.setSortScheme( m_scheme ); diff --git a/src/playlist/view/PlaylistViewCommon.cpp b/src/playlist/view/PlaylistViewCommon.cpp --- a/src/playlist/view/PlaylistViewCommon.cpp +++ b/src/playlist/view/PlaylistViewCommon.cpp @@ -64,7 +64,7 @@ // there are no cover actions if the song/album is not in the collection QMenu *menuCover = new QMenu( i18n( "Album" ), menu ); menuCover->addActions( albumActionsList ); - menuCover->setIcon( QIcon::fromTheme( "filename-album-amarok" ) ); + menuCover->setIcon( QIcon::fromTheme( QStringLiteral("filename-album-amarok") ) ); menu->addMenu( menuCover ); menu->addSeparator(); } @@ -74,6 +74,7 @@ menu->addActions( parentCheckActions( parent, editActionsFor( parent, index ) ) ); menu->exec( pos ); + delete menu; } @@ -121,7 +122,7 @@ if( m_cueTrackAction == 0 ) { - m_cueTrackAction = new QAction( QIcon::fromTheme( "media-track-queue-amarok" ), queueText, parent ); + m_cueTrackAction = new QAction( QIcon::fromTheme( QStringLiteral("media-track-queue-amarok") ), queueText, parent ); } else { @@ -152,7 +153,7 @@ { if( m_stopAfterTrackAction == 0 ) { - m_stopAfterTrackAction = new QAction( QIcon::fromTheme( "media-playback-stop-amarok" ), + m_stopAfterTrackAction = new QAction( QIcon::fromTheme( QStringLiteral("media-playback-stop-amarok") ), i18n( "Stop Playing After This Track" ), parent ); if ( auto p = static_cast(parent) ) @@ -166,7 +167,7 @@ if( m_removeTracTrackAction == 0 ) { - m_removeTracTrackAction = new QAction( QIcon::fromTheme( "media-track-remove-amarok" ), + m_removeTracTrackAction = new QAction( QIcon::fromTheme( QStringLiteral("media-track-remove-amarok") ), i18n( "Remove From Playlist" ), parent ); if ( auto p = static_cast(parent) ) @@ -197,7 +198,7 @@ { if( m_findInSourceAction == 0 ) { - m_findInSourceAction = new QAction( QIcon::fromTheme( "edit-find" ), + m_findInSourceAction = new QAction( QIcon::fromTheme( QStringLiteral("edit-find") ), i18n( "Show in Media Sources" ), parent ); if( auto p = static_cast(parent) ) @@ -240,7 +241,7 @@ if( isMultiSource ) { - QAction *selectSourceAction = new QAction( QIcon::fromTheme( "media-playlist-repeat" ), + QAction *selectSourceAction = new QAction( QIcon::fromTheme( QStringLiteral("media-playlist-repeat") ), i18n( "Select Source" ), parent ); if( auto p = static_cast(parent) ) @@ -260,7 +261,7 @@ Meta::TrackPtr track = index->data( Playlist::TrackRole ).value< Meta::TrackPtr >(); - QAction *editAction = new QAction( QIcon::fromTheme( "media-track-edit-amarok" ), + QAction *editAction = new QAction( QIcon::fromTheme( QStringLiteral("media-track-edit-amarok") ), i18n( "Edit Track Details" ), parent ); editAction->setProperty( "popupdropper_svg_id", "edit" ); diff --git a/src/playlist/view/listview/InlineEditorWidget.h b/src/playlist/view/listview/InlineEditorWidget.h --- a/src/playlist/view/listview/InlineEditorWidget.h +++ b/src/playlist/view/listview/InlineEditorWidget.h @@ -24,14 +24,14 @@ #include /** - An inline editor for a playlist item. Relies on the same item layout configuration as is used by the delegate, and strives to have a simmilar look. + An inline editor for a playlist item. Relies on the same item layout configuration as is used by the delegate, and strives to have a similar look. */ class InlineEditorWidget : public BoxWidget { Q_OBJECT public: - InlineEditorWidget( QWidget * parent, const QModelIndex &index, Playlist::PlaylistLayout layout, int height, int width ); + InlineEditorWidget(QWidget * parent, const QModelIndex &index, const Playlist::PlaylistLayout &layout, int height, int width ); ~InlineEditorWidget(); QMap changedValues(); @@ -46,7 +46,7 @@ private: void createChildWidgets(); - bool eventFilter( QObject *obj, QEvent *event ); + bool eventFilter( QObject *obj, QEvent *event ) override; QPersistentModelIndex m_index; Playlist::PlaylistLayout m_layout; diff --git a/src/playlist/view/listview/InlineEditorWidget.cpp b/src/playlist/view/listview/InlineEditorWidget.cpp --- a/src/playlist/view/listview/InlineEditorWidget.cpp +++ b/src/playlist/view/listview/InlineEditorWidget.cpp @@ -40,7 +40,7 @@ using namespace Playlist; InlineEditorWidget::InlineEditorWidget( QWidget * parent, const QModelIndex &index, - PlaylistLayout layout, int height, int width ) + const PlaylistLayout &layout, int height, int width ) : BoxWidget( false, parent ) , m_index( index ) , m_layout( layout ) @@ -200,13 +200,13 @@ } else if( value == Divider ) { - QPixmap left = The::svgHandler()->renderSvg( "divider_left", + QPixmap left = The::svgHandler()->renderSvg( QStringLiteral("divider_left"), 1, rowHeight, - "divider_left" ); + QStringLiteral("divider_left") ); - QPixmap right = The::svgHandler()->renderSvg( "divider_right", + QPixmap right = The::svgHandler()->renderSvg( QStringLiteral("divider_right"), 1, rowHeight, - "divider_right" ); + QStringLiteral("divider_right") ); QPixmap dividerPixmap( 2, rowHeight ); dividerPixmap.fill( Qt::transparent ); @@ -407,7 +407,7 @@ if( widget ) { widget->clearFocus(); - emit editingDone( this ); + Q_EMIT editingDone( this ); } return true; } diff --git a/src/playlist/view/listview/PrettyItemDelegate.h b/src/playlist/view/listview/PrettyItemDelegate.h --- a/src/playlist/view/listview/PrettyItemDelegate.h +++ b/src/playlist/view/listview/PrettyItemDelegate.h @@ -40,30 +40,31 @@ public: static int rowsForItem( const QModelIndex &index ); - PrettyItemDelegate( QObject* parent = 0 ); + explicit PrettyItemDelegate( QObject* parent = nullptr ); ~PrettyItemDelegate(); - QSize sizeHint( const QStyleOptionViewItem&, const QModelIndex& ) const; - void paint( QPainter*, const QStyleOptionViewItem&, const QModelIndex& ) const; + QSize sizeHint( const QStyleOptionViewItem&, const QModelIndex& ) const override; + void paint( QPainter*, const QStyleOptionViewItem&, const QModelIndex& ) const override; // helper function for view which lets us determine if a click is within an album group's header bool insideItemHeader( const QPoint&, const QRect& ); /** Returns the height an item header would have */ int headerHeight() const; /** - * Handle clicks witin a delegate. + * Handle clicks within a delegate. * @param pos The position of the click, in delegate coordinates. - * @param pos The index of the clicked item. + * @param itemRect QRect for the item. + * @param index The index of the clicked item. * @return True if delegate acts on this click, false otherwise. */ bool clicked( const QPoint &pos, const QRect &itemRect, const QModelIndex& index ); - QWidget * createEditor ( QWidget * parent, const QStyleOptionViewItem & option, const QModelIndex & index ) const; + QWidget * createEditor ( QWidget * parent, const QStyleOptionViewItem & option, const QModelIndex & index ) const override; - void setModelData ( QWidget * editor, QAbstractItemModel * model, const QModelIndex & index ) const; - void updateEditorGeometry ( QWidget * editor, const QStyleOptionViewItem & option, const QModelIndex & index ) const; + void setModelData ( QWidget * editor, QAbstractItemModel * model, const QModelIndex & index ) const override; + void updateEditorGeometry ( QWidget * editor, const QStyleOptionViewItem & option, const QModelIndex & index ) const override; /** @@ -102,7 +103,7 @@ static int getGroupMode( const QModelIndex &index); - QMap buildTrackArgsMap( const Meta::TrackPtr track ) const; + QMap buildTrackArgsMap( const Meta::TrackPtr &track ) const; static QFontMetricsF* s_nfm; //normal static QFontMetricsF* s_ufm; //underline diff --git a/src/playlist/view/listview/PrettyItemDelegate.cpp b/src/playlist/view/listview/PrettyItemDelegate.cpp --- a/src/playlist/view/listview/PrettyItemDelegate.cpp +++ b/src/playlist/view/listview/PrettyItemDelegate.cpp @@ -127,7 +127,7 @@ QApplication::style()->drawPrimitive( QStyle::PE_PanelItemViewItem, &option, painter ); painter->translate( option.rect.topLeft() ); - painter->drawPixmap( 0, 0, The::svgHandler()->renderSvgWithDividers( "track", ( int )option.rect.width(), ( int )option.rect.height(), "track" ) ); + painter->drawPixmap( 0, 0, The::svgHandler()->renderSvgWithDividers( QStringLiteral("track"), ( int )option.rect.width(), ( int )option.rect.height(), QStringLiteral("track") ) ); painter->setPen( The::paletteHandler()->foregroundColor( painter, option.state & QStyle::State_Selected ) ); @@ -164,7 +164,6 @@ QFont boldfont( option.font ); boldfont.setBold( true ); - QFontMetricsF bfm( boldfont ); QStyleOptionViewItem headOption( option ); QStyleOptionViewItem trackOption( option ); @@ -299,7 +298,7 @@ if( !headerRow && index.data( ActiveTrackRole ).toBool() ) { //paint this in 3 parts to solve stretching issues with wide playlists - //TODO: propper 9 part painting, but I don't want to bother with this until we + //TODO: proper 9 part painting, but I don't want to bother with this until we //get some new graphics anyway... // -- try not to highlight the indicator row @@ -327,26 +326,26 @@ const bool skipCache = opacity == 1.0 ? false : true; painter->drawPixmap( overlayXOffset, overlayYOffset, - The::svgHandler()->renderSvg( "active_overlay_left", + The::svgHandler()->renderSvg( QStringLiteral("active_overlay_left"), endWidth, overlayHeight, - "active_overlay_left", + QStringLiteral("active_overlay_left"), skipCache, opacity ) ); painter->drawPixmap( overlayXOffset + endWidth, overlayYOffset, - The::svgHandler()->renderSvg( "active_overlay_mid", + The::svgHandler()->renderSvg( QStringLiteral("active_overlay_mid"), overlayLength - endWidth * 2, overlayHeight, - "active_overlay_mid", + QStringLiteral("active_overlay_mid"), skipCache, opacity ) ); painter->drawPixmap( overlayXOffset + ( overlayLength - endWidth ), overlayYOffset, - The::svgHandler()->renderSvg( "active_overlay_right", + The::svgHandler()->renderSvg( QStringLiteral("active_overlay_right"), endWidth, overlayHeight, - "active_overlay_right", + QStringLiteral("active_overlay_right"), skipCache, opacity ) ); } @@ -416,7 +415,7 @@ { const int x = markerOffsetX; const int y = nominalImageRect.y() + ( coverHeight - smallIconSize ); - painter->drawPixmap( x, y, The::svgHandler()->renderSvg( "multi_marker", smallIconSize, smallIconSize, "multi_marker" ) ); + painter->drawPixmap( x, y, The::svgHandler()->renderSvg( QStringLiteral("multi_marker"), smallIconSize, smallIconSize, QStringLiteral("multi_marker") ) ); markerOffsetX += ( smallIconSize + iconSpacing ); @@ -428,7 +427,7 @@ { const int x = markerOffsetX; const int y = nominalImageRect.y() + ( coverHeight - smallIconSize ); - painter->drawPixmap( x, y, The::svgHandler()->renderSvg( "stop_button", smallIconSize, smallIconSize, "stop_button" ) ); + painter->drawPixmap( x, y, The::svgHandler()->renderSvg( QStringLiteral("stop_button"), smallIconSize, smallIconSize, QStringLiteral("stop_button") ) ); markerOffsetX += ( smallIconSize + iconSpacing ); @@ -519,13 +518,13 @@ } else if( value == Divider ) { - QPixmap left = The::svgHandler()->renderSvg( "divider_left", + QPixmap left = The::svgHandler()->renderSvg( QStringLiteral("divider_left"), 1, rowHeight , - "divider_left" ); + QStringLiteral("divider_left") ); - QPixmap right = The::svgHandler()->renderSvg( "divider_right", + QPixmap right = The::svgHandler()->renderSvg( QStringLiteral("divider_right"), 1, rowHeight, - "divider_right" ); + QStringLiteral("divider_right") ); if( alignment & Qt::AlignLeft ) { @@ -618,39 +617,39 @@ int offset = x + frameHMargin; painter->drawPixmap( offset, y + 2, - The::svgHandler()->renderSvg( "back_button", + The::svgHandler()->renderSvg( QStringLiteral("back_button"), buttonSize, buttonSize, - "back_button" ) ); + QStringLiteral("back_button") ) ); if( The::engineController()->isPlaying() ) { offset += ( buttonSize + iconSpacing ); painter->drawPixmap( offset, y + 2, - The::svgHandler()->renderSvg( "pause_button", + The::svgHandler()->renderSvg( QStringLiteral("pause_button"), buttonSize, buttonSize, - "pause_button" ) ); + QStringLiteral("pause_button") ) ); } else { offset += ( buttonSize + iconSpacing ); painter->drawPixmap( offset, y + 2, - The::svgHandler()->renderSvg( "play_button", + The::svgHandler()->renderSvg( QStringLiteral("play_button"), buttonSize, buttonSize, - "play_button" ) ); + QStringLiteral("play_button") ) ); } offset += ( buttonSize + iconSpacing ); painter->drawPixmap( offset, y + 2, - The::svgHandler()->renderSvg( "stop_button", + The::svgHandler()->renderSvg( QStringLiteral("stop_button"), buttonSize, buttonSize, - "stop_button" ) ); + QStringLiteral("stop_button") ) ); offset += ( buttonSize + iconSpacing ); painter->drawPixmap( offset, y + 2, - The::svgHandler()->renderSvg( "next_button", + The::svgHandler()->renderSvg( QStringLiteral("next_button"), buttonSize, buttonSize, - "next_button" ) ); + QStringLiteral("next_button") ) ); offset += ( buttonSize + iconSpacing ); @@ -703,32 +702,32 @@ QRect backRect( offset, extrasOffsetY + 2, buttonSize, buttonSize ); if( backRect.contains( pos ) ) { - Amarok::actionCollection()->action( "prev" )->trigger(); + Amarok::actionCollection()->action( QStringLiteral("prev") )->trigger(); return true; } offset += ( buttonSize + iconSpacing ); QRect playRect( offset, extrasOffsetY + 2, buttonSize, buttonSize ); if( playRect.contains( pos ) ) { - Amarok::actionCollection()->action( "play_pause" )->trigger(); + Amarok::actionCollection()->action( QStringLiteral("play_pause") )->trigger(); return true; } offset += ( buttonSize + iconSpacing ); QRect stopRect( offset, extrasOffsetY + 2, buttonSize, buttonSize ); if( stopRect.contains( pos ) ) { - Amarok::actionCollection()->action( "stop" )->trigger(); + Amarok::actionCollection()->action( QStringLiteral("stop") )->trigger(); return true; } offset += ( buttonSize + iconSpacing ); QRect nextRect( offset, extrasOffsetY + 2, buttonSize, buttonSize ); if( nextRect.contains( pos ) ) { - Amarok::actionCollection()->action( "next" )->trigger(); + Amarok::actionCollection()->action( QStringLiteral("next") )->trigger(); return true; } @@ -884,7 +883,7 @@ void Playlist::PrettyItemDelegate::editorDone( InlineEditorWidget * editor ) { - emit commitData( editor ); + Q_EMIT commitData( editor ); } void @@ -897,7 +896,7 @@ } QMap -Playlist::PrettyItemDelegate::buildTrackArgsMap( const Meta::TrackPtr track ) const +Playlist::PrettyItemDelegate::buildTrackArgsMap( const Meta::TrackPtr &track ) const { QMap args; QString artist = track->artist() ? track->artist()->name() : QString(); @@ -908,32 +907,32 @@ albumartist = artist; - args["title"] = track->name(); - args["composer"] = track->composer() ? track->composer()->name() : QString(); + args[QStringLiteral("title")] = track->name(); + args[QStringLiteral("composer")] = track->composer() ? track->composer()->name() : QString(); // if year == 0 then we don't want include it QString year = track->year() ? track->year()->name() : QString(); - args["year"] = year.localeAwareCompare( "0" ) == 0 ? QString() : year; - args["album"] = track->album() ? track->album()->name() : QString(); + args[QStringLiteral("year")] = year.localeAwareCompare( QStringLiteral("0") ) == 0 ? QString() : year; + args[QStringLiteral("album")] = track->album() ? track->album()->name() : QString(); if( track->discNumber() ) - args["discnumber"] = QString::number( track->discNumber() ); + args[QStringLiteral("discnumber")] = QString::number( track->discNumber() ); - args["genre"] = track->genre() ? track->genre()->name() : QString(); - args["comment"] = track->comment(); - args["artist"] = artist; - args["albumartist"] = albumartist; - args["initial"] = albumartist.mid( 0, 1 ).toUpper(); //artists starting with The are already handled above - args["filetype"] = track->type(); + args[QStringLiteral("genre")] = track->genre() ? track->genre()->name() : QString(); + args[QStringLiteral("comment")] = track->comment(); + args[QStringLiteral("artist")] = artist; + args[QStringLiteral("albumartist")] = albumartist; + args[QStringLiteral("initial")] = albumartist.mid( 0, 1 ).toUpper(); //artists starting with The are already handled above + args[QStringLiteral("filetype")] = track->type(); - args["rating"] = track->statistics()->rating(); - args["filesize"] = track->filesize(); - args["length"] = track->length() / 1000; + args[QStringLiteral("rating")] = track->statistics()->rating(); + args[QStringLiteral("filesize")] = track->filesize(); + args[QStringLiteral("length")] = track->length() / 1000; if ( track->trackNumber() ) { - QString trackNum = QString( "%1" ).arg( track->trackNumber(), 2, 10, QChar('0') ); - args["track"] = trackNum; + QString trackNum = QStringLiteral( "%1" ).arg( track->trackNumber(), 2, 10, QChar('0') ); + args[QStringLiteral("track")] = trackNum; } return args; diff --git a/src/playlist/view/listview/PrettyListView.h b/src/playlist/view/listview/PrettyListView.h --- a/src/playlist/view/listview/PrettyListView.h +++ b/src/playlist/view/listview/PrettyListView.h @@ -51,11 +51,11 @@ Q_OBJECT public: - PrettyListView( QWidget* parent = 0 ); + explicit PrettyListView( QWidget* parent = nullptr ); ~PrettyListView(); protected: - int verticalOffset() const; + int verticalOffset() const override; Q_SIGNALS: void found(); @@ -91,21 +91,21 @@ void findInSource(); protected: - void showEvent( QShowEvent* ); - void contextMenuEvent( QContextMenuEvent* ); - void dragEnterEvent( QDragEnterEvent *event ); - void dragLeaveEvent( QDragLeaveEvent* ); - void dragMoveEvent( QDragMoveEvent* ); - void dropEvent( QDropEvent* ); - void keyPressEvent( QKeyEvent* ); - void mousePressEvent( QMouseEvent* ); - void mouseReleaseEvent( QMouseEvent* ); + void showEvent( QShowEvent* ) override; + void contextMenuEvent( QContextMenuEvent* ) override; + void dragEnterEvent( QDragEnterEvent *event ) override; + void dragLeaveEvent( QDragLeaveEvent* ) override; + void dragMoveEvent( QDragMoveEvent* ) override; + void dropEvent( QDropEvent* ) override; + void keyPressEvent( QKeyEvent* ) override; + void mousePressEvent( QMouseEvent* ) override; + void mouseReleaseEvent( QMouseEvent* ) override; /** Draws a "drop here" text if empty */ - void paintEvent( QPaintEvent* ); + void paintEvent( QPaintEvent* ) override; - void startDrag( Qt::DropActions supportedActions ); - bool edit( const QModelIndex &index, EditTrigger trigger, QEvent *event ); + void startDrag( Qt::DropActions supportedActions ) override; + bool edit( const QModelIndex &index, EditTrigger trigger, QEvent *event ) override; protected Q_SLOTS: void newPalette( const QPalette & palette ); diff --git a/src/playlist/view/listview/PrettyListView.cpp b/src/playlist/view/listview/PrettyListView.cpp --- a/src/playlist/view/listview/PrettyListView.cpp +++ b/src/playlist/view/listview/PrettyListView.cpp @@ -722,10 +722,10 @@ if( m_pd && m_pd->isHidden() ) { - m_pd->setSvgRenderer( The::svgHandler()->getRenderer( "amarok/images/pud_items.svg" ) ); - qDebug() << "svgHandler SVG renderer is " << (QObject*)(The::svgHandler()->getRenderer( "amarok/images/pud_items.svg" )); + m_pd->setSvgRenderer( The::svgHandler()->getRenderer( QStringLiteral("amarok/images/pud_items.svg") ) ); + qDebug() << "svgHandler SVG renderer is " << (QObject*)(The::svgHandler()->getRenderer( QStringLiteral("amarok/images/pud_items.svg") )); qDebug() << "m_pd SVG renderer is " << (QObject*)(m_pd->svgRenderer()); - qDebug() << "does play exist in renderer? " << ( The::svgHandler()->getRenderer( "amarok/images/pud_items.svg" )->elementExists( "load" ) ); + qDebug() << "does play exist in renderer? " << ( The::svgHandler()->getRenderer( QStringLiteral("amarok/images/pud_items.svg") )->elementExists( QStringLiteral("load") ) ); QList actions = actionsFor( this, &indices.first() ); foreach( QAction * action, actions ) @@ -860,10 +860,10 @@ if ( foundIndex.isValid() ) scrollTo( foundIndex, QAbstractItemView::PositionAtCenter ); - emit( found() ); + Q_EMIT( found() ); } else - emit( notFound() ); + Q_EMIT( notFound() ); if ( updateProxy ) The::playlist()->filterUpdated(); @@ -896,10 +896,10 @@ if ( foundIndex.isValid() ) scrollTo( foundIndex, QAbstractItemView::PositionAtCenter ); - emit( found() ); + Q_EMIT( found() ); } else - emit( notFound() ); + Q_EMIT( notFound() ); if ( updateProxy ) The::playlist()->filterUpdated(); @@ -956,10 +956,10 @@ scrollTo( foundIndex, QAbstractItemView::PositionAtCenter ); } - emit( found() ); + Q_EMIT( found() ); } else - emit( notFound() ); + Q_EMIT( notFound() ); } void Playlist::PrettyListView::showOnlyMatches( bool onlyMatches ) @@ -972,7 +972,7 @@ // Handle scrolling to newly inserted playlist items. // Warning, this slot is connected to the 'rowsInserted' signal of the *bottom* model, // not the normal top model. -// The reason: FilterProxy can emit *A LOT* (thousands) of 'rowsInserted' signals when its +// The reason: FilterProxy can Q_EMIT *A LOT* (thousands) of 'rowsInserted' signals when its // search string changes. For that case we don't want to do any scrollTo() at all. void Playlist::PrettyListView::bottomModelRowsInserted( const QModelIndex& parent, int start, int end ) diff --git a/src/playlist/view/listview/SourceSelectionPopup.cpp b/src/playlist/view/listview/SourceSelectionPopup.cpp --- a/src/playlist/view/listview/SourceSelectionPopup.cpp +++ b/src/playlist/view/listview/SourceSelectionPopup.cpp @@ -51,7 +51,7 @@ foreach( const QString &source, m_msc->sources() ) { if ( i == m_msc->current() ) - new QListWidgetItem( QIcon::fromTheme( "arrow-right" ), source, m_listWidget ) ; + new QListWidgetItem( QIcon::fromTheme( QStringLiteral("arrow-right") ), source, m_listWidget ) ; else new QListWidgetItem( source, m_listWidget ); @@ -79,7 +79,7 @@ foreach( const QString &source, m_msc->sources() ) { if ( i == m_msc->current() ) - new QListWidgetItem( QIcon::fromTheme( "arrow-right" ), source, m_listWidget ) ; + new QListWidgetItem( QIcon::fromTheme( QStringLiteral("arrow-right") ), source, m_listWidget ) ; else new QListWidgetItem( source, m_listWidget ); diff --git a/src/playlistgenerator/Constraint.h b/src/playlistgenerator/Constraint.h --- a/src/playlistgenerator/Constraint.h +++ b/src/playlistgenerator/Constraint.h @@ -25,7 +25,7 @@ class Constraint : public ConstraintNode { Q_OBJECT public: - virtual int getNodeType() const { return ConstraintNode::ConstraintType; } + int getNodeType() const override { return ConstraintNode::ConstraintType; } protected: Constraint( ConstraintNode* ); diff --git a/src/playlistgenerator/ConstraintFactory.cpp b/src/playlistgenerator/ConstraintFactory.cpp --- a/src/playlistgenerator/ConstraintFactory.cpp +++ b/src/playlistgenerator/ConstraintFactory.cpp @@ -55,7 +55,7 @@ * Constraint Factory Singleton * ******************************************/ -ConstraintFactory* ConstraintFactory::s_self = 0; +ConstraintFactory* ConstraintFactory::s_self = nullptr; ConstraintFactory* ConstraintFactory::instance() { @@ -68,7 +68,7 @@ void ConstraintFactory::destroy() { delete ConstraintFactory::s_self; - ConstraintFactory::s_self = 0; + ConstraintFactory::s_self = nullptr; } ConstraintFactory::ConstraintFactory() @@ -117,7 +117,7 @@ ConstraintNode* ConstraintFactory::createConstraint( QDomElement& xmlelem, ConstraintNode* parent, int row ) const { - QString t = xmlelem.attributeNode( "type" ).value(); + QString t = xmlelem.attributeNode( QStringLiteral("type") ).value(); if ( !m_registryNames.contains( t ) || !parent ) return 0; diff --git a/src/playlistgenerator/ConstraintGroup.h b/src/playlistgenerator/ConstraintGroup.h --- a/src/playlistgenerator/ConstraintGroup.h +++ b/src/playlistgenerator/ConstraintGroup.h @@ -43,22 +43,22 @@ static ConstraintGroup* createFromXml( QDomElement&, ConstraintNode* ); static ConstraintGroup* createNew( ConstraintNode* ); - virtual QString getName() const; - virtual int getNodeType() const { return ConstraintNode::ConstraintGroupType; } - virtual QWidget* editWidget() const; - virtual void toXml( QDomDocument&, QDomElement& ) const; + QString getName() const override; + int getNodeType() const override { return ConstraintNode::ConstraintGroupType; } + QWidget* editWidget() const override; + void toXml( QDomDocument&, QDomElement& ) const override; - virtual Collections::QueryMaker* initQueryMaker( Collections::QueryMaker* ) const; - virtual double satisfaction( const Meta::TrackList& ) const; - virtual quint32 suggestPlaylistSize() const; + Collections::QueryMaker* initQueryMaker( Collections::QueryMaker* ) const override; + double satisfaction( const Meta::TrackList& ) const override; + quint32 suggestPlaylistSize() const override; private Q_SLOTS: void setMatchAny(); void setMatchAll(); private: ConstraintGroup(QDomElement&, ConstraintNode*); - ConstraintGroup(ConstraintNode*); + explicit ConstraintGroup(ConstraintNode*); // parameters MatchType m_matchtype; @@ -71,7 +71,7 @@ Q_OBJECT public: - ConstraintGroupEditWidget( const ConstraintGroup::MatchType ); + explicit ConstraintGroupEditWidget( const ConstraintGroup::MatchType ); Q_SIGNALS: void updated(); diff --git a/src/playlistgenerator/ConstraintGroup.cpp b/src/playlistgenerator/ConstraintGroup.cpp --- a/src/playlistgenerator/ConstraintGroup.cpp +++ b/src/playlistgenerator/ConstraintGroup.cpp @@ -31,13 +31,13 @@ ConstraintGroup::ConstraintGroup( QDomElement& xmlelem, ConstraintNode* p ) : ConstraintNode( p ) { DEBUG_BLOCK - if ( xmlelem.tagName() == "group" ) { - if ( xmlelem.attribute( "matchtype" ) == "any" ) { + if ( xmlelem.tagName() == QLatin1String("group") ) { + if ( xmlelem.attribute( QStringLiteral("matchtype") ) == QLatin1String("any") ) { m_matchtype = MatchAny; } else { m_matchtype = MatchAll; } - } else if ( xmlelem.tagName() == "constrainttree" ) { + } else if ( xmlelem.tagName() == QLatin1String("constrainttree") ) { // root node of a constraint tree m_matchtype = MatchAll; } else { @@ -62,9 +62,9 @@ for ( int i = 0; i < xmlelem.childNodes().count(); i++ ) { QDomElement childXmlElem = xmlelem.childNodes().item( i ).toElement(); if ( !childXmlElem.isNull() ) { - if ( childXmlElem.tagName() == "group" ) { + if ( childXmlElem.tagName() == QLatin1String("group") ) { cfact->createGroup( childXmlElem, cg ); - } else if ( childXmlElem.tagName() == "constraint" ) { + } else if ( childXmlElem.tagName() == QLatin1String("constraint") ) { cfact->createConstraint( childXmlElem, cg ); } else { debug() << "unknown child: " << childXmlElem.nodeName(); @@ -84,11 +84,11 @@ ConstraintGroup::getName() const { if ( m_matchtype == MatchAny ) { - return QString( i18nc("name of a type of constraint group", "\"Match Any\" group") ); + return i18nc("name of a type of constraint group", "\"Match Any\" group"); } else if ( m_matchtype == MatchAll ) { - return QString( i18nc("name of a type of constraint group", "\"Match All\" group") ); + return i18nc("name of a type of constraint group", "\"Match All\" group"); } else { - return QString( i18nc("name of a type of constraint group", "Unknown match group") ); + return i18nc("name of a type of constraint group", "Unknown match group"); } } @@ -106,14 +106,14 @@ { QDomElement group; - if ( elem.tagName() == "generatorpreset" ) { - group = doc.createElement( "constrainttree" ); // unmodifiable root element of the constraint tree + if ( elem.tagName() == QLatin1String("generatorpreset") ) { + group = doc.createElement( QStringLiteral("constrainttree") ); // unmodifiable root element of the constraint tree } else { - group = doc.createElement( "group" ); + group = doc.createElement( QStringLiteral("group") ); if ( m_matchtype == MatchAny ) { - group.setAttribute( "matchtype", "any" ); + group.setAttribute( QStringLiteral("matchtype"), QStringLiteral("any") ); } else { - group.setAttribute( "matchtype", "all" ); + group.setAttribute( QStringLiteral("matchtype"), QStringLiteral("all") ); } } @@ -267,14 +267,14 @@ ConstraintGroup::setMatchAny() { m_matchtype = MatchAny; - emit dataChanged(); + Q_EMIT dataChanged(); } void ConstraintGroup::setMatchAll() { m_matchtype = MatchAll; - emit dataChanged(); + Q_EMIT dataChanged(); } /****************************** @@ -300,16 +300,16 @@ ConstraintGroupEditWidget::on_radioButton_MatchAll_clicked( bool c ) { if ( c ) { - emit clickedMatchAll(); - emit updated(); + Q_EMIT clickedMatchAll(); + Q_EMIT updated(); } } void ConstraintGroupEditWidget::on_radioButton_MatchAny_clicked( bool c ) { if ( c ) { - emit clickedMatchAny(); - emit updated(); + Q_EMIT clickedMatchAny(); + Q_EMIT updated(); } } diff --git a/src/playlistgenerator/ConstraintNode.cpp b/src/playlistgenerator/ConstraintNode.cpp --- a/src/playlistgenerator/ConstraintNode.cpp +++ b/src/playlistgenerator/ConstraintNode.cpp @@ -72,23 +72,23 @@ ConstraintNode::getChild( int idx ) { if ( idx < 0 ) - return 0; + return nullptr; if ( idx < m_children.size() ) return m_children.at( idx ); - return 0; + return nullptr; } ConstraintNode* ConstraintNode::pruneChild( int idx ) { if ( idx < 0 ) - return 0; + return nullptr; if ( idx < m_children.size() ) { return m_children.takeAt( idx ); } - return 0; + return nullptr; } bool diff --git a/src/playlistgenerator/ConstraintSolver.h b/src/playlistgenerator/ConstraintSolver.h --- a/src/playlistgenerator/ConstraintSolver.h +++ b/src/playlistgenerator/ConstraintSolver.h @@ -51,10 +51,8 @@ // overloaded ThreadWeaver::Job functions bool canBeExecuted(); - bool success() const; - - public Q_SLOTS: - void requestAbort(); + bool success() const override; + void requestAbort() override; Q_SIGNALS: void readyToRun(); @@ -71,12 +69,12 @@ void failed(ThreadWeaver::JobPointer); protected: - void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; - void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; - void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) Q_DECL_OVERRIDE; // from ThreadWeaver::Job + void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; + void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; + void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) override; // from ThreadWeaver::Job private Q_SLOTS: - void receiveQueryMakerData( Meta::TrackList ); + void receiveQueryMakerData( const Meta::TrackList &); void receiveQueryMakerDone(); private: diff --git a/src/playlistgenerator/ConstraintSolver.cpp b/src/playlistgenerator/ConstraintSolver.cpp --- a/src/playlistgenerator/ConstraintSolver.cpp +++ b/src/playlistgenerator/ConstraintSolver.cpp @@ -25,7 +25,7 @@ #include "core/meta/Meta.h" #include "core/support/Debug.h" #include "core/support/Components.h" -#include "core/interfaces/Logger.h" +#include "core/logger/Logger.h" #include "core-impl/collections/support/CollectionManager.h" #include "playlist/PlaylistModel.h" @@ -157,12 +157,12 @@ debug() << "Running ConstraintSolver" << m_serialNumber; - emit totalSteps( m_maxGenerations ); + Q_EMIT totalSteps( m_maxGenerations ); // GENETIC ALGORITHM LOOP Population population; quint32 generation = 0; - Meta::TrackList* best = NULL; + Meta::TrackList* best = nullptr; while ( !m_abortRequested && ( generation < m_maxGenerations ) ) { quint32 s = m_constraintTreeRoot->suggestPlaylistSize(); m_suggestedPlaylistSize = (s > 0) ? s : m_suggestedPlaylistSize; @@ -172,7 +172,7 @@ select_population( population, best ); mutate_population( population ); generation++; - emit incrementProgress(); + Q_EMIT incrementProgress(); } else { break; } @@ -193,7 +193,7 @@ it = population.erase( it ); } - emit endProgressOperation( this ); + Q_EMIT endProgressOperation( this ); } void APG::ConstraintSolver::defaultBegin(const ThreadWeaver::JobPointer& self, ThreadWeaver::Thread *thread) @@ -212,7 +212,7 @@ } void -APG::ConstraintSolver::receiveQueryMakerData( Meta::TrackList results ) +APG::ConstraintSolver::receiveQueryMakerData( const Meta::TrackList &results ) { m_domainMutex.lock(); m_domain += results; @@ -227,12 +227,12 @@ if (( m_domain.size() > 0 ) || m_domainReductionFailed ) { if ( m_domain.size() <= 0 ) { - Amarok::Components::logger()->shortMessage( i18n("The playlist generator failed to load any tracks from the collection.") ); + Amarok::Logger::shortMessage( i18n("The playlist generator failed to load any tracks from the collection.") ); } m_readyToRun = true; - emit readyToRun(); + Q_EMIT readyToRun(); } else { - Amarok::Components::logger()->longMessage( + Amarok::Logger::longMessage( i18n("There are no tracks that match all constraints. " \ "The playlist generator will find the tracks that match best, " \ "but you may want to consider loosening the constraints to find more tracks.") ); diff --git a/src/playlistgenerator/Preset.cpp b/src/playlistgenerator/Preset.cpp --- a/src/playlistgenerator/Preset.cpp +++ b/src/playlistgenerator/Preset.cpp @@ -23,7 +23,7 @@ #include "ConstraintSolver.h" #include "constraints/TrackSpreader.h" -#include "core/interfaces/Logger.h" +#include "core/logger/Logger.h" #include "core/meta/Meta.h" #include "core/support/Components.h" #include "core/support/Debug.h" @@ -64,15 +64,15 @@ , m_constraintTreeRoot( 0 ) { - if ( xmlelem.hasAttribute( "title" ) ) { - m_title = xmlelem.attribute( "title" ); + if ( xmlelem.hasAttribute( QStringLiteral("title") ) ) { + m_title = xmlelem.attribute( QStringLiteral("title") ); } else { m_title = i18n("Unnamed playlist preset"); } for ( int i = 0; i < xmlelem.childNodes().count(); i++ ) { QDomElement childXmlElem = xmlelem.childNodes().item( i ).toElement(); if ( !childXmlElem.isNull() ) { - if ( childXmlElem.tagName() == "constrainttree" ) { + if ( childXmlElem.tagName() == QLatin1String("constrainttree") ) { m_constraintTreeRoot = ConstraintFactory::instance()->createGroup( childXmlElem, 0 ); } else { error() << "unknown child: " << childXmlElem.nodeName(); @@ -100,8 +100,8 @@ QDomElement* APG::Preset::toXml( QDomDocument& xmldoc ) const { - QDomElement e = xmldoc.createElement( "generatorpreset" ); - e.setAttribute( "title", m_title ); + QDomElement e = xmldoc.createElement( QStringLiteral("generatorpreset") ); + e.setAttribute( QStringLiteral("title"), m_title ); m_constraintTreeRoot->toXml( xmldoc, e ); return new QDomElement( e ); } @@ -126,10 +126,10 @@ * until it's ready to run, and then the Weaver will start running it * pretty much immediately. -- sth */ - emit lock( true ); + Q_EMIT lock( true ); ConstraintSolver* s = static_cast( sender() ); - Amarok::Components::logger()->newProgressOperation( s, i18n("Generating a new playlist"), s->iterationCount(), s, SLOT(requestAbort()), Qt::QueuedConnection ); + Amarok::Logger::newProgressOperation( s, i18n("Generating a new playlist"), s->iterationCount(), s, &ConstraintSolver::requestAbort, Qt::QueuedConnection ); connect( s, &APG::ConstraintSolver::done, this, &Preset::solverFinished, Qt::QueuedConnection ); m_constraintTreeRoot->addChild( ConstraintTypes::TrackSpreader::createNew( m_constraintTreeRoot ), 0 ); // private mandatory constraint @@ -146,7 +146,7 @@ if ( job->success() ) { debug() << "Solver" << solver->serial() << "finished successfully"; if ( !solver->satisfied() ) { - Amarok::Components::logger()->longMessage( + Amarok::Logger::longMessage( i18n("The playlist generator created a playlist which does not meet all " "of your constraints. If you are not satisfied with the results, " "try loosening or removing some constraints and then generating a " @@ -157,5 +157,5 @@ debug() << "Ignoring results from aborted Solver" << solver->serial(); } - emit lock( false ); + Q_EMIT lock( false ); } diff --git a/src/playlistgenerator/PresetEditDialog.h b/src/playlistgenerator/PresetEditDialog.h --- a/src/playlistgenerator/PresetEditDialog.h +++ b/src/playlistgenerator/PresetEditDialog.h @@ -33,15 +33,15 @@ Q_OBJECT public: - PresetEditDialog( PresetPtr ); + explicit PresetEditDialog( const PresetPtr &); private Q_SLOTS: void addNode( const QString& ); void removeNode(); void currentNodeChanged( const QModelIndex& ); - void accept(); - void reject(); + void accept() override; + void reject() override; void on_lineEdit_Title_textChanged( const QString& ); diff --git a/src/playlistgenerator/PresetEditDialog.cpp b/src/playlistgenerator/PresetEditDialog.cpp --- a/src/playlistgenerator/PresetEditDialog.cpp +++ b/src/playlistgenerator/PresetEditDialog.cpp @@ -30,7 +30,7 @@ #include #include -APG::PresetEditDialog::PresetEditDialog( PresetPtr p ) +APG::PresetEditDialog::PresetEditDialog( const PresetPtr &p ) : QDialog( 0 ) , m_preset( p ) { @@ -60,7 +60,7 @@ QAction* a; QMenu* m = new QMenu( i18n("Add new"), this ); - a = m->addAction( QString( i18n("Constraint Group") ) ); + a = m->addAction( i18n("Constraint Group") ); connect( a, &QAction::triggered, adderMapper, QOverload<>::of(&QSignalMapper::map) ); adderMapper->setMapping( a, i18n("Constraint Group") ); foreach( const QString& name, ConstraintFactory::instance()->i18nNames() ) { diff --git a/src/playlistgenerator/PresetModel.h b/src/playlistgenerator/PresetModel.h --- a/src/playlistgenerator/PresetModel.h +++ b/src/playlistgenerator/PresetModel.h @@ -24,7 +24,6 @@ #include #include -class ConstraintModel; class QPersistentModelIndex; namespace APG { @@ -39,11 +38,11 @@ // user opens the APG // Overloaded QAbstractListModel methods - QVariant data( const QModelIndex&, int role = Qt::DisplayRole ) const; - QModelIndex index( int, int, const QModelIndex& parent = QModelIndex() ) const; - QModelIndex parent( const QModelIndex& ) const { return QModelIndex(); } - int rowCount( const QModelIndex& parent = QModelIndex() ) const; - int columnCount( const QModelIndex& ) const { return 1; } + QVariant data( const QModelIndex&, int role = Qt::DisplayRole ) const override; + QModelIndex index( int, int, const QModelIndex& parent = QModelIndex() ) const override; + QModelIndex parent( const QModelIndex& ) const override { return QModelIndex(); } + int rowCount( const QModelIndex& parent = QModelIndex() ) const override; + int columnCount( const QModelIndex& ) const override { return 1; } APG::PresetPtr activePreset() const; @@ -72,7 +71,7 @@ class ExportDialog; - void insertPreset(APG::PresetPtr); + void insertPreset(const APG::PresetPtr&); void parseXmlToPresets( QDomDocument& ); QPersistentModelIndex* m_activePresetIndex; diff --git a/src/playlistgenerator/PresetModel.cpp b/src/playlistgenerator/PresetModel.cpp --- a/src/playlistgenerator/PresetModel.cpp +++ b/src/playlistgenerator/PresetModel.cpp @@ -19,7 +19,7 @@ #include "PresetModel.h" #include "amarokconfig.h" -#include "core/interfaces/Logger.h" +#include "core/logger/Logger.h" #include "core/collections/Collection.h" #include "core/support/Amarok.h" #include "core/support/Components.h" @@ -38,11 +38,11 @@ #include #include -APG::PresetModel* APG::PresetModel::s_instance = 0; +APG::PresetModel* APG::PresetModel::s_instance = nullptr; APG::PresetModel* APG::PresetModel::instance() { - if ( s_instance == 0 ) { + if ( s_instance == nullptr ) { s_instance = new PresetModel(); } @@ -54,7 +54,7 @@ { s_instance->savePresetsToXml( Amarok::saveLocation() + "playlistgenerator.xml", s_instance->m_presetList ); delete s_instance; - s_instance = 0; + s_instance = nullptr; } APG::PresetModel::PresetModel() @@ -151,9 +151,9 @@ void APG::PresetModel::import() { - QString filename = QFileDialog::getOpenFileName( Q_NULLPTR, i18n("Import preset"), + const QString filename = QFileDialog::getOpenFileName( nullptr, i18n("Import preset"), QStandardPaths::writableLocation( QStandardPaths::MusicLocation ), - QString("*.xml|" + i18n("Preset files (*.xml)") ) ); + QStringLiteral("%1 (*.xml)").arg(i18n("Preset files") )); if( !filename.isEmpty() ) loadPresetsFromXml( filename ); } @@ -197,7 +197,7 @@ APG::PresetModel::savePresetsToXml( const QString& filename, const QList &pl ) const { QDomDocument xmldoc; - QDomElement base = xmldoc.createElement( "playlistgenerator" ); + QDomElement base = xmldoc.createElement( QStringLiteral("playlistgenerator") ); QList nodes; foreach ( APG::PresetPtr ps, pl ) { QDomElement* elemPtr = ps->toXml( xmldoc ); @@ -211,15 +211,15 @@ QTextStream out( &file ); out.setCodec( "UTF-8" ); xmldoc.save( out, 2, QDomNode::EncodingFromTextStream ); - if( !filename.contains( "playlistgenerator.xml" ) ) + if( !filename.contains( QLatin1String("playlistgenerator.xml") ) ) { - Amarok::Components::logger()->longMessage( i18n("Preset exported to %1", filename), + Amarok::Logger::longMessage( i18n("Preset exported to %1", filename), Amarok::Logger::Information ); } } else { - Amarok::Components::logger()->longMessage( + Amarok::Logger::longMessage( i18n("Preset could not be exported to %1", filename), Amarok::Logger::Error ); error() << "Can not write presets to " << filename; } @@ -237,23 +237,23 @@ parseXmlToPresets( document ); } else { error() << "Failed to read" << filename; - Amarok::Components::logger()->longMessage( + Amarok::Logger::longMessage( i18n("Presets could not be imported from %1", filename), Amarok::Logger::Error ); } file.close(); } else { if ( !createDefaults ) { - Amarok::Components::logger()->longMessage( + Amarok::Logger::longMessage( i18n("%1 could not be opened for preset import", filename), Amarok::Logger::Error ); } else { QDomDocument document; QString translatedPresetExamples( presetExamples.arg( - i18n("Example 1: new tracks added this week") ).arg( - i18n("Example 2: rock or pop music") ).arg( - i18n("Example 3: about one hour of tracks from different artists") ).arg( - i18n("Example 4: like my favorite radio station") ).arg( + i18n("Example 1: new tracks added this week"), + i18n("Example 2: rock or pop music"), + i18n("Example 3: about one hour of tracks from different artists"), + i18n("Example 4: like my favorite radio station"), i18n("Example 5: an 80-minute CD of rock, metal, and industrial") ) ); document.setContent( translatedPresetExamples ); debug() << "Reading built-in example presets"; @@ -264,7 +264,7 @@ } void -APG::PresetModel::insertPreset( APG::PresetPtr ps ) +APG::PresetModel::insertPreset( const APG::PresetPtr &ps ) { if ( ps ) { int row = m_presetList.size(); @@ -281,7 +281,7 @@ QDomElement rootelem = document.documentElement(); for ( int i = 0; i < rootelem.childNodes().count(); i++ ) { QDomElement e = rootelem.childNodes().at( i ).toElement(); - if ( e.tagName() == "generatorpreset" ) { + if ( e.tagName() == QLatin1String("generatorpreset") ) { debug() << "creating a new generator preset"; insertPreset( APG::Preset::createFromXml( e ) ); } else { @@ -294,23 +294,23 @@ * ExportDialog nested class */ APG::PresetModel::ExportDialog::ExportDialog( APG::PresetPtr ps ) - : QFileDialog( Q_NULLPTR, i18n( "Export \"%1\" preset", ps->title() ), + : QFileDialog( nullptr, i18n( "Export \"%1\" preset", ps->title() ), QStandardPaths::writableLocation( QStandardPaths::MusicLocation ), - QString("*.xml|" + i18n("Preset files (*.xml)") ) ) + i18n("Preset files (*.xml)") ) { m_presetsToExportList.append( ps ); setFileMode( QFileDialog::AnyFile ); selectFile( ps->title() + ".xml" ); setAcceptMode( QFileDialog::AcceptSave ); - connect( this, &ExportDialog::accept, this, &ExportDialog::recvAccept ); + connect( this, &ExportDialog::accepted, this, &ExportDialog::recvAccept ); } APG::PresetModel::ExportDialog::~ExportDialog() {} void APG::PresetModel::ExportDialog::recvAccept() const { - emit pleaseExport( selectedFiles().first(), m_presetsToExportList ); + Q_EMIT pleaseExport( selectedFiles().first(), m_presetsToExportList ); } const QString APG::PresetModel::presetExamples = diff --git a/src/playlistgenerator/TreeController.h b/src/playlistgenerator/TreeController.h --- a/src/playlistgenerator/TreeController.h +++ b/src/playlistgenerator/TreeController.h @@ -19,7 +19,6 @@ #include -class QLayout; class QTreeView; class QWidget; @@ -30,7 +29,7 @@ Q_OBJECT public: - TreeController( TreeModel*, QTreeView*, QWidget* parent = 0); + TreeController( TreeModel*, QTreeView*, QWidget* parent = nullptr); ~TreeController(); public Q_SLOTS: diff --git a/src/playlistgenerator/TreeModel.h b/src/playlistgenerator/TreeModel.h --- a/src/playlistgenerator/TreeModel.h +++ b/src/playlistgenerator/TreeModel.h @@ -31,16 +31,16 @@ Q_OBJECT public: - explicit TreeModel( ConstraintNode*, QObject* parent = 0 ); + explicit TreeModel( ConstraintNode*, QObject* parent = nullptr ); ~TreeModel(); - QVariant data( const QModelIndex& index, int role ) const; - Qt::ItemFlags flags( const QModelIndex& index ) const; - QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const; - QModelIndex index( int row, int column, const QModelIndex& parent = QModelIndex() ) const; - QModelIndex parent( const QModelIndex& child ) const; - int rowCount( const QModelIndex& parent = QModelIndex() ) const; - int columnCount( const QModelIndex& parent = QModelIndex() ) const { Q_UNUSED( parent ); return 1; } + QVariant data( const QModelIndex& index, int role ) const override; + Qt::ItemFlags flags( const QModelIndex& index ) const override; + QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const override; + QModelIndex index( int row, int column, const QModelIndex& parent = QModelIndex() ) const override; + QModelIndex parent( const QModelIndex& child ) const override; + int rowCount( const QModelIndex& parent = QModelIndex() ) const override; + int columnCount( const QModelIndex& parent = QModelIndex() ) const override { Q_UNUSED( parent ); return 1; } bool removeNode( const QModelIndex& ); QModelIndex insertGroup( const QModelIndex& ); QModelIndex insertConstraint( const QModelIndex&, const QString& ); diff --git a/src/playlistgenerator/TreeModel.cpp b/src/playlistgenerator/TreeModel.cpp --- a/src/playlistgenerator/TreeModel.cpp +++ b/src/playlistgenerator/TreeModel.cpp @@ -212,7 +212,7 @@ ConstraintNode* n = static_cast( sender() ); if ( n ) { QModelIndex idx = createIndex( n->row(), 0, n ); - emit dataChanged( idx, idx ); + Q_EMIT dataChanged( idx, idx ); } } diff --git a/src/playlistgenerator/constraints/Checkpoint.h b/src/playlistgenerator/constraints/Checkpoint.h --- a/src/playlistgenerator/constraints/Checkpoint.h +++ b/src/playlistgenerator/constraints/Checkpoint.h @@ -44,13 +44,13 @@ static Constraint* createNew(ConstraintNode*); static ConstraintFactoryEntry* registerMe(); - virtual QWidget* editWidget() const; - virtual void toXml(QDomDocument&, QDomElement&) const; + QWidget* editWidget() const override; + void toXml(QDomDocument&, QDomElement&) const override; - virtual QString getName() const; + QString getName() const override; - virtual double satisfaction( const Meta::TrackList& ) const; - virtual quint32 suggestPlaylistSize() const; + double satisfaction( const Meta::TrackList& ) const override; + quint32 suggestPlaylistSize() const override; private Q_SLOTS: void setPosition( const int ); @@ -65,7 +65,7 @@ class AlbumMatcher; Checkpoint( QDomElement&, ConstraintNode* ); - Checkpoint( ConstraintNode* ); + explicit Checkpoint( ConstraintNode* ); ~Checkpoint(); // constraint parameters @@ -99,8 +99,8 @@ TrackMatcher( const Meta::TrackPtr& ); virtual ~TrackMatcher(); - virtual QList find( const Meta::TrackList& ) const; - virtual bool match( const Meta::TrackPtr& ) const; + QList find( const Meta::TrackList& ) const override; + bool match( const Meta::TrackPtr& ) const override; private: Meta::TrackPtr m_trackToMatch; @@ -112,8 +112,8 @@ AlbumMatcher( const Meta::AlbumPtr& ); virtual ~AlbumMatcher(); - virtual QList find( const Meta::TrackList& ) const; - virtual bool match( const Meta::TrackPtr& ) const; + QList find( const Meta::TrackList& ) const override; + bool match( const Meta::TrackPtr& ) const override; private: Meta::AlbumPtr m_albumToMatch; @@ -125,8 +125,8 @@ ArtistMatcher( const Meta::ArtistPtr& ); virtual ~ArtistMatcher(); - virtual QList find( const Meta::TrackList& ) const; - virtual bool match( const Meta::TrackPtr& ) const; + QList find( const Meta::TrackList& ) const override; + bool match( const Meta::TrackPtr& ) const override; private: Meta::ArtistPtr m_artistToMatch; diff --git a/src/playlistgenerator/constraints/Checkpoint.cpp b/src/playlistgenerator/constraints/Checkpoint.cpp --- a/src/playlistgenerator/constraints/Checkpoint.cpp +++ b/src/playlistgenerator/constraints/Checkpoint.cpp @@ -37,7 +37,7 @@ if ( p ) { return new Checkpoint( xmlelem, p ); } else { - return 0; + return nullptr; } } @@ -47,14 +47,14 @@ if ( p ) { return new Checkpoint( p ); } else { - return 0; + return nullptr; } } ConstraintFactoryEntry* ConstraintTypes::Checkpoint::registerMe() { - return new ConstraintFactoryEntry( "Checkpoint", + return new ConstraintFactoryEntry( QStringLiteral("Checkpoint"), i18n("Checkpoint"), i18n("Fixes a track, album, or artist to a certain position in the playlist"), &Checkpoint::createFromXml, &Checkpoint::createNew ); @@ -69,16 +69,16 @@ { QDomAttr a; - a = xmlelem.attributeNode( "position" ); + a = xmlelem.attributeNode( QStringLiteral("position") ); if ( !a.isNull() ) m_position = a.value().toInt(); - a = xmlelem.attributeNode( "checkpointtype" ); + a = xmlelem.attributeNode( QStringLiteral("checkpointtype") ); if ( !a.isNull() ) m_checkpointType = static_cast( a.value().toInt() ); - a = xmlelem.attributeNode( "trackurl" ); + a = xmlelem.attributeNode( QStringLiteral("trackurl") ); if ( !a.isNull() ) { Meta::TrackPtr trk = CollectionManager::instance()->trackForUrl( QUrl( a.value() ) ); if ( trk ) { @@ -94,7 +94,7 @@ setCheckpoint( m_checkpointObject ); - a = xmlelem.attributeNode( "strictness" ); + a = xmlelem.attributeNode( QStringLiteral("strictness") ); if ( !a.isNull() ) m_strictness = a.value().toDouble(); debug() << getName(); @@ -131,36 +131,36 @@ if( !m_checkpointObject ) return; - QDomElement c = doc.createElement( "constraint" ); + QDomElement c = doc.createElement( QStringLiteral("constraint") ); QDomText t = doc.createTextNode( getName() ); c.appendChild( t ); - c.setAttribute( "type", "Checkpoint" ); - c.setAttribute( "position", m_position ); - c.setAttribute( "checkpointtype", m_checkpointType ); + c.setAttribute( QStringLiteral("type"), QStringLiteral("Checkpoint") ); + c.setAttribute( QStringLiteral("position"), m_position ); + c.setAttribute( QStringLiteral("checkpointtype"), m_checkpointType ); Meta::TrackPtr r; Meta::ArtistPtr a; Meta::AlbumPtr l; switch ( m_checkpointType ) { case CheckpointTrack: r = Meta::TrackPtr::dynamicCast( m_checkpointObject ); - c.setAttribute( "trackurl", r->uidUrl() ); + c.setAttribute( QStringLiteral("trackurl"), r->uidUrl() ); break; case CheckpointAlbum: l = Meta::AlbumPtr::dynamicCast( m_checkpointObject ); if ( l->tracks().length() > 0 ) { r = l->tracks().first(); - c.setAttribute( "trackurl", r->uidUrl() ); + c.setAttribute( QStringLiteral("trackurl"), r->uidUrl() ); } break; case CheckpointArtist: a = Meta::ArtistPtr::dynamicCast( m_checkpointObject ); if ( a->tracks().length() > 0 ) { r = a->tracks().first(); - c.setAttribute( "trackurl", r->uidUrl() ); + c.setAttribute( QStringLiteral("trackurl"), r->uidUrl() ); } break; } - c.setAttribute( "strictness", QString::number( m_strictness ) ); + c.setAttribute( QStringLiteral("strictness"), QString::number( m_strictness ) ); elem.appendChild( c ); } @@ -295,7 +295,7 @@ } m_checkpointObject = data; - emit dataChanged(); + Q_EMIT dataChanged(); } /****************************** @@ -409,20 +409,20 @@ void ConstraintTypes::CheckpointEditWidget::on_timeEdit_Position_timeChanged( const QTime& t ) { - emit positionChanged( QTime(0, 0, 0).msecsTo( t ) ); - emit updated(); + Q_EMIT positionChanged( QTime(0, 0, 0).msecsTo( t ) ); + Q_EMIT updated(); } void ConstraintTypes::CheckpointEditWidget::on_slider_Strictness_valueChanged( const int v ) { - emit strictnessChanged( v ); - emit updated(); + Q_EMIT strictnessChanged( v ); + Q_EMIT updated(); } void ConstraintTypes::CheckpointEditWidget::on_trackSelector_selectionChanged( const Meta::DataPtr& data ) { - emit checkpointChanged( data ); - emit updated(); + Q_EMIT checkpointChanged( data ); + Q_EMIT updated(); } diff --git a/src/playlistgenerator/constraints/PlaylistDuration.h b/src/playlistgenerator/constraints/PlaylistDuration.h --- a/src/playlistgenerator/constraints/PlaylistDuration.h +++ b/src/playlistgenerator/constraints/PlaylistDuration.h @@ -41,22 +41,22 @@ static Constraint* createNew(ConstraintNode*); static ConstraintFactoryEntry* registerMe(); - virtual QWidget* editWidget() const; - virtual void toXml(QDomDocument&, QDomElement&) const; + QWidget* editWidget() const override; + void toXml(QDomDocument&, QDomElement&) const override; - virtual QString getName() const; + QString getName() const override; - virtual double satisfaction(const Meta::TrackList&) const; - virtual quint32 suggestPlaylistSize() const; + double satisfaction(const Meta::TrackList&) const override; + quint32 suggestPlaylistSize() const override; private Q_SLOTS: void setComparison( const int ); void setDuration( const int ); void setStrictness( const int ); private: PlaylistDuration(QDomElement&, ConstraintNode*); - PlaylistDuration(ConstraintNode*); + explicit PlaylistDuration(ConstraintNode*); // constraint parameters qint64 m_duration; // time in msec diff --git a/src/playlistgenerator/constraints/PlaylistDuration.cpp b/src/playlistgenerator/constraints/PlaylistDuration.cpp --- a/src/playlistgenerator/constraints/PlaylistDuration.cpp +++ b/src/playlistgenerator/constraints/PlaylistDuration.cpp @@ -48,7 +48,7 @@ ConstraintFactoryEntry* ConstraintTypes::PlaylistDuration::registerMe() { - return new ConstraintFactoryEntry( "PlaylistDuration", + return new ConstraintFactoryEntry( QStringLiteral("PlaylistDuration"), i18n("Playlist Duration"), i18n("Sets the preferred duration of the playlist"), &PlaylistDuration::createFromXml, &PlaylistDuration::createNew ); @@ -62,22 +62,22 @@ { QDomAttr a; - a = xmlelem.attributeNode( "duration" ); + a = xmlelem.attributeNode( QStringLiteral("duration") ); if ( !a.isNull() ) { m_duration = a.value().toInt(); } else { // Accommodate schema change when PlaylistLength became PlaylistDuration - a = xmlelem.attributeNode( "length" ); + a = xmlelem.attributeNode( QStringLiteral("length") ); if ( !a.isNull() ) m_duration = a.value().toInt(); } - a = xmlelem.attributeNode( "comparison" ); + a = xmlelem.attributeNode( QStringLiteral("comparison") ); if ( !a.isNull() ) m_comparison = a.value().toInt(); - a = xmlelem.attributeNode( "strictness" ); + a = xmlelem.attributeNode( QStringLiteral("strictness") ); if ( !a.isNull() ) m_strictness = a.value().toDouble(); } @@ -103,11 +103,11 @@ void ConstraintTypes::PlaylistDuration::toXml( QDomDocument& doc, QDomElement& elem ) const { - QDomElement c = doc.createElement( "constraint" ); - c.setAttribute( "type", "PlaylistDuration" ); - c.setAttribute( "duration", QString::number( m_duration ) ); - c.setAttribute( "comparison", QString::number( m_comparison ) ); - c.setAttribute( "strictness", QString::number( m_strictness ) ); + QDomElement c = doc.createElement( QStringLiteral("constraint") ); + c.setAttribute( QStringLiteral("type"), QStringLiteral("PlaylistDuration") ); + c.setAttribute( QStringLiteral("duration"), QString::number( m_duration ) ); + c.setAttribute( QStringLiteral("comparison"), QString::number( m_comparison ) ); + c.setAttribute( QStringLiteral("strictness"), QString::number( m_strictness ) ); elem.appendChild( c ); } @@ -124,15 +124,15 @@ } else { v = ki18n( "Playlist duration: unknown"); } - v = v.subs( QTime(0, 0, 0).addMSecs( m_duration ).toString( "H:mm:ss" ) ); + v = v.subs( QTime(0, 0, 0).addMSecs( m_duration ).toString( QStringLiteral("H:mm:ss") ) ); return v.toString(); } double ConstraintTypes::PlaylistDuration::satisfaction( const Meta::TrackList& tl ) const { qint64 l = 0; - foreach( Meta::TrackPtr t, tl ) { + for( const Meta::TrackPtr &t : tl ) { l += t->length(); } @@ -163,14 +163,14 @@ ConstraintTypes::PlaylistDuration::setComparison( const int c ) { m_comparison = c; - emit dataChanged(); + Q_EMIT dataChanged(); } void ConstraintTypes::PlaylistDuration::setDuration( const int v ) { m_duration = v; - emit dataChanged(); + Q_EMIT dataChanged(); } void @@ -185,7 +185,7 @@ ConstraintTypes::PlaylistDurationEditWidget::PlaylistDurationEditWidget( const int duration, const int comparison, - const int strictness ) : QWidget( 0 ) + const int strictness ) : QWidget( nullptr ) { ui.setupUi( this ); @@ -197,20 +197,20 @@ void ConstraintTypes::PlaylistDurationEditWidget::on_timeEdit_Duration_timeChanged( const QTime& t ) { - emit durationChanged( QTime(0, 0, 0).msecsTo( t ) ); - emit updated(); + Q_EMIT durationChanged( QTime(0, 0, 0).msecsTo( t ) ); + Q_EMIT updated(); } void ConstraintTypes::PlaylistDurationEditWidget::on_comboBox_Comparison_currentIndexChanged( const int v ) { - emit comparisonChanged( v ); - emit updated(); + Q_EMIT comparisonChanged( v ); + Q_EMIT updated(); } void ConstraintTypes::PlaylistDurationEditWidget::on_slider_Strictness_valueChanged( const int v ) { - emit strictnessChanged( v ); - emit updated(); + Q_EMIT strictnessChanged( v ); + Q_EMIT updated(); } diff --git a/src/playlistgenerator/constraints/PlaylistFileSize.h b/src/playlistgenerator/constraints/PlaylistFileSize.h --- a/src/playlistgenerator/constraints/PlaylistFileSize.h +++ b/src/playlistgenerator/constraints/PlaylistFileSize.h @@ -38,13 +38,13 @@ static Constraint* createNew( ConstraintNode* ); static ConstraintFactoryEntry* registerMe(); - virtual QWidget* editWidget() const; - virtual void toXml( QDomDocument&, QDomElement& ) const; + QWidget* editWidget() const override; + void toXml( QDomDocument&, QDomElement& ) const override; - virtual QString getName() const; + QString getName() const override; - virtual double satisfaction( const Meta::TrackList& ) const; - virtual quint32 suggestPlaylistSize() const; + double satisfaction( const Meta::TrackList& ) const override; + quint32 suggestPlaylistSize() const override; private Q_SLOTS: void setComparison( const int ); @@ -54,7 +54,7 @@ private: PlaylistFileSize( QDomElement&, ConstraintNode* ); - PlaylistFileSize( ConstraintNode* ); + explicit PlaylistFileSize( ConstraintNode* ); // constraint parameters int m_size; diff --git a/src/playlistgenerator/constraints/PlaylistFileSize.cpp b/src/playlistgenerator/constraints/PlaylistFileSize.cpp --- a/src/playlistgenerator/constraints/PlaylistFileSize.cpp +++ b/src/playlistgenerator/constraints/PlaylistFileSize.cpp @@ -44,14 +44,14 @@ if ( p ) { return new PlaylistFileSize( p ); } else { - return 0; + return nullptr; } } ConstraintFactoryEntry* ConstraintTypes::PlaylistFileSize::registerMe() { - return new ConstraintFactoryEntry( "PlaylistFileSize", + return new ConstraintFactoryEntry( QStringLiteral("PlaylistFileSize"), i18n("Total File Size of Playlist"), i18n("Sets the preferred total file size of the playlist"), &PlaylistFileSize::createFromXml, &PlaylistFileSize::createNew ); @@ -66,19 +66,19 @@ { QDomAttr a; - a = xmlelem.attributeNode( "size" ); + a = xmlelem.attributeNode( QStringLiteral("size") ); if ( !a.isNull() ) m_size = a.value().toInt(); - a = xmlelem.attributeNode( "unit" ); + a = xmlelem.attributeNode( QStringLiteral("unit") ); if ( !a.isNull() ) m_unit = a.value().toInt(); - a = xmlelem.attributeNode( "comparison" ); + a = xmlelem.attributeNode( QStringLiteral("comparison") ); if ( !a.isNull() ) m_comparison = a.value().toInt(); - a = xmlelem.attributeNode( "strictness" ); + a = xmlelem.attributeNode( QStringLiteral("strictness") ); if ( !a.isNull() ) m_strictness = a.value().toDouble(); } @@ -106,12 +106,12 @@ void ConstraintTypes::PlaylistFileSize::toXml( QDomDocument& doc, QDomElement& elem ) const { - QDomElement c = doc.createElement( "constraint" ); - c.setAttribute( "type", "PlaylistFileSize" ); - c.setAttribute( "size", QString::number( m_size ) ); - c.setAttribute( "unit", QString::number( m_unit ) ); - c.setAttribute( "comparison", QString::number( m_comparison ) ); - c.setAttribute( "strictness", QString::number( m_strictness ) ); + QDomElement c = doc.createElement( QStringLiteral("constraint") ); + c.setAttribute( QStringLiteral("type"), QStringLiteral("PlaylistFileSize") ); + c.setAttribute( QStringLiteral("size"), QString::number( m_size ) ); + c.setAttribute( QStringLiteral("unit"), QString::number( m_unit ) ); + c.setAttribute( QStringLiteral("comparison"), QString::number( m_comparison ) ); + c.setAttribute( QStringLiteral("strictness"), QString::number( m_strictness ) ); elem.appendChild( c ); } @@ -194,14 +194,14 @@ ConstraintTypes::PlaylistFileSize::setComparison( const int c ) { m_comparison = c; - emit dataChanged(); + Q_EMIT dataChanged(); } void ConstraintTypes::PlaylistFileSize::setSize( const int l ) { m_size = l; - emit dataChanged(); + Q_EMIT dataChanged(); } void @@ -214,7 +214,7 @@ ConstraintTypes::PlaylistFileSize::setUnit( const int u ) { m_unit = u; - emit dataChanged(); + Q_EMIT dataChanged(); } /****************************** @@ -237,27 +237,27 @@ void ConstraintTypes::PlaylistFileSizeEditWidget::on_spinBox_Size_valueChanged( const int l ) { - emit sizeChanged( l ); - emit updated(); + Q_EMIT sizeChanged( l ); + Q_EMIT updated(); } void ConstraintTypes::PlaylistFileSizeEditWidget::on_comboBox_Unit_currentIndexChanged( const int l ) { - emit unitChanged( l ); - emit updated(); + Q_EMIT unitChanged( l ); + Q_EMIT updated(); } void ConstraintTypes::PlaylistFileSizeEditWidget::on_comboBox_Comparison_currentIndexChanged( const int v ) { - emit comparisonChanged( v ); - emit updated(); + Q_EMIT comparisonChanged( v ); + Q_EMIT updated(); } void ConstraintTypes::PlaylistFileSizeEditWidget::on_slider_Strictness_valueChanged( const int v ) { - emit strictnessChanged( v ); - emit updated(); + Q_EMIT strictnessChanged( v ); + Q_EMIT updated(); } diff --git a/src/playlistgenerator/constraints/PlaylistLength.h b/src/playlistgenerator/constraints/PlaylistLength.h --- a/src/playlistgenerator/constraints/PlaylistLength.h +++ b/src/playlistgenerator/constraints/PlaylistLength.h @@ -41,22 +41,22 @@ static Constraint* createNew( ConstraintNode* ); static ConstraintFactoryEntry* registerMe(); - virtual QWidget* editWidget() const; - virtual void toXml( QDomDocument&, QDomElement& ) const; + QWidget* editWidget() const override; + void toXml( QDomDocument&, QDomElement& ) const override; - virtual QString getName() const; + QString getName() const override; - virtual double satisfaction( const Meta::TrackList& ) const; - virtual quint32 suggestPlaylistSize() const; + double satisfaction( const Meta::TrackList& ) const override; + quint32 suggestPlaylistSize() const override; private Q_SLOTS: void setComparison( const int ); void setLength( const int ); void setStrictness( const int ); private: PlaylistLength( QDomElement&, ConstraintNode* ); - PlaylistLength( ConstraintNode* ); + explicit PlaylistLength( ConstraintNode* ); // constraint parameters quint32 m_length; diff --git a/src/playlistgenerator/constraints/PlaylistLength.cpp b/src/playlistgenerator/constraints/PlaylistLength.cpp --- a/src/playlistgenerator/constraints/PlaylistLength.cpp +++ b/src/playlistgenerator/constraints/PlaylistLength.cpp @@ -47,7 +47,7 @@ ConstraintFactoryEntry* ConstraintTypes::PlaylistLength::registerMe() { - return new ConstraintFactoryEntry( "PlaylistLength", + return new ConstraintFactoryEntry( QStringLiteral("PlaylistLength"), i18n("Playlist Length"), i18n("Sets the preferred number of tracks in the playlist"), &PlaylistLength::createFromXml, &PlaylistLength::createNew ); @@ -61,7 +61,7 @@ { QDomAttr a; - a = xmlelem.attributeNode( "length" ); + a = xmlelem.attributeNode( QStringLiteral("length") ); if ( !a.isNull() ) { m_length = a.value().toInt(); /* after 2.3.2, what was the PlaylistLength constraint became the @@ -71,11 +71,11 @@ m_length /= 240000; } - a = xmlelem.attributeNode( "comparison" ); + a = xmlelem.attributeNode( QStringLiteral("comparison") ); if ( !a.isNull() ) m_comparison = a.value().toInt(); - a = xmlelem.attributeNode( "strictness" ); + a = xmlelem.attributeNode( QStringLiteral("strictness") ); if ( !a.isNull() ) m_strictness = a.value().toDouble(); } @@ -101,11 +101,11 @@ void ConstraintTypes::PlaylistLength::toXml( QDomDocument& doc, QDomElement& elem ) const { - QDomElement c = doc.createElement( "constraint" ); - c.setAttribute( "type", "PlaylistLength" ); - c.setAttribute( "length", QString::number( m_length ) ); - c.setAttribute( "comparison", QString::number( m_comparison ) ); - c.setAttribute( "strictness", QString::number( m_strictness ) ); + QDomElement c = doc.createElement( QStringLiteral("constraint") ); + c.setAttribute( QStringLiteral("type"), QStringLiteral("PlaylistLength") ); + c.setAttribute( QStringLiteral("length"), QString::number( m_length ) ); + c.setAttribute( QStringLiteral("comparison"), QString::number( m_comparison ) ); + c.setAttribute( QStringLiteral("strictness"), QString::number( m_strictness ) ); elem.appendChild( c ); } @@ -165,14 +165,14 @@ ConstraintTypes::PlaylistLength::setComparison( const int c ) { m_comparison = c; - emit dataChanged(); + Q_EMIT dataChanged(); } void ConstraintTypes::PlaylistLength::setLength( const int l ) { m_length = static_cast(l); - emit dataChanged(); + Q_EMIT dataChanged(); } void @@ -199,20 +199,20 @@ void ConstraintTypes::PlaylistLengthEditWidget::on_spinBox_Length_valueChanged( const int l ) { - emit lengthChanged( l ); - emit updated(); + Q_EMIT lengthChanged( l ); + Q_EMIT updated(); } void ConstraintTypes::PlaylistLengthEditWidget::on_comboBox_Comparison_currentIndexChanged( const int v ) { - emit comparisonChanged( v ); - emit updated(); + Q_EMIT comparisonChanged( v ); + Q_EMIT updated(); } void ConstraintTypes::PlaylistLengthEditWidget::on_slider_Strictness_valueChanged( const int v ) { - emit strictnessChanged( v ); - emit updated(); + Q_EMIT strictnessChanged( v ); + Q_EMIT updated(); } diff --git a/src/playlistgenerator/constraints/PreventDuplicates.h b/src/playlistgenerator/constraints/PreventDuplicates.h --- a/src/playlistgenerator/constraints/PreventDuplicates.h +++ b/src/playlistgenerator/constraints/PreventDuplicates.h @@ -40,19 +40,19 @@ static Constraint* createNew( ConstraintNode* ); static ConstraintFactoryEntry* registerMe(); - virtual QWidget* editWidget() const; - virtual void toXml( QDomDocument&, QDomElement& ) const; + QWidget* editWidget() const override; + void toXml( QDomDocument&, QDomElement& ) const override; - virtual QString getName() const; + QString getName() const override; - virtual double satisfaction( const Meta::TrackList& ) const; + double satisfaction( const Meta::TrackList& ) const override; private Q_SLOTS: void setField( const int ); private: PreventDuplicates( QDomElement&, ConstraintNode* ); - PreventDuplicates( ConstraintNode* ); + explicit PreventDuplicates( ConstraintNode* ); double penalty( const int ) const; @@ -64,7 +64,7 @@ Q_OBJECT public: - PreventDuplicatesEditWidget( const int ); + explicit PreventDuplicatesEditWidget( const int ); Q_SIGNALS: void updated(); diff --git a/src/playlistgenerator/constraints/PreventDuplicates.cpp b/src/playlistgenerator/constraints/PreventDuplicates.cpp --- a/src/playlistgenerator/constraints/PreventDuplicates.cpp +++ b/src/playlistgenerator/constraints/PreventDuplicates.cpp @@ -47,7 +47,7 @@ ConstraintFactoryEntry* ConstraintTypes::PreventDuplicates::registerMe() { - return new ConstraintFactoryEntry( "PreventDuplicates", + return new ConstraintFactoryEntry( QStringLiteral("PreventDuplicates"), i18n("Prevent Duplicates"), i18n("Prevents duplicate tracks, albums, or artists from appearing in the playlist"), &PreventDuplicates::createFromXml, &PreventDuplicates::createNew ); @@ -58,7 +58,7 @@ { QDomAttr a; - a = xmlelem.attributeNode( "field" ); + a = xmlelem.attributeNode( QStringLiteral("field") ); if ( !a.isNull() ) { m_field = static_cast( a.value().toInt() ); } @@ -81,9 +81,9 @@ void ConstraintTypes::PreventDuplicates::toXml( QDomDocument& doc, QDomElement& elem ) const { - QDomElement c = doc.createElement( "constraint" ); - c.setAttribute( "type", "PreventDuplicates" ); - c.setAttribute( "field", QString::number( m_field ) ); + QDomElement c = doc.createElement( QStringLiteral("constraint") ); + c.setAttribute( QStringLiteral("type"), QStringLiteral("PreventDuplicates") ); + c.setAttribute( QStringLiteral("field"), QString::number( m_field ) ); elem.appendChild( c ); } @@ -145,7 +145,7 @@ ConstraintTypes::PreventDuplicates::setField( const int c ) { m_field = static_cast( c ); - emit dataChanged(); + Q_EMIT dataChanged(); } @@ -163,6 +163,6 @@ void ConstraintTypes::PreventDuplicatesEditWidget::on_comboBox_Field_currentIndexChanged( const int v ) { - emit fieldChanged( v ); - emit updated(); + Q_EMIT fieldChanged( v ); + Q_EMIT updated(); } diff --git a/src/playlistgenerator/constraints/TagMatch.h b/src/playlistgenerator/constraints/TagMatch.h --- a/src/playlistgenerator/constraints/TagMatch.h +++ b/src/playlistgenerator/constraints/TagMatch.h @@ -62,17 +62,17 @@ static Constraint* createNew(ConstraintNode*); static ConstraintFactoryEntry* registerMe(); - virtual QWidget* editWidget() const; - virtual void toXml(QDomDocument&, QDomElement&) const; + QWidget* editWidget() const override; + void toXml(QDomDocument&, QDomElement&) const override; - virtual QString getName() const; + QString getName() const override; - virtual Collections::QueryMaker* initQueryMaker(Collections::QueryMaker*) const; - virtual double satisfaction(const Meta::TrackList&) const; + Collections::QueryMaker* initQueryMaker(Collections::QueryMaker*) const override; + double satisfaction(const Meta::TrackList&) const override; // Implementation of MatchingConstraint virtuals - const QBitArray whatTracksMatch( const Meta::TrackList& ); - int constraintMatchType() const; + const QBitArray whatTracksMatch( const Meta::TrackList& ) override; + int constraintMatchType() const override; private Q_SLOTS: void setComparison( int ); @@ -83,7 +83,7 @@ private: TagMatch( QDomElement&, ConstraintNode* ); - TagMatch( ConstraintNode* ); + explicit TagMatch( ConstraintNode* ); ~TagMatch(); // constraint parameters @@ -114,7 +114,7 @@ double compareNum( const double, const int, const double, const double, const qint64 ) const; double compareStr( const QString&, const int, const QString& ) const; double compareDate( const uint, const int, const QVariant&, const double ) const; - double compareLabels( const Meta::TrackPtr, const int, const QString& ) const; + double compareLabels( const Meta::TrackPtr&, const int, const QString& ) const; // rough inverses of the comparison uint rangeDate( const double ) const; @@ -138,8 +138,8 @@ ~TagMatchFieldsModel(); // required by QAbstractListModel - QVariant data( const QModelIndex&, int role = Qt::DisplayRole ) const; - int rowCount( const QModelIndex& parent = QModelIndex() ) const; + QVariant data( const QModelIndex&, int role = Qt::DisplayRole ) const override; + int rowCount( const QModelIndex& parent = QModelIndex() ) const override; bool contains( const QString& ) const; int index_of( const QString& ) const; diff --git a/src/playlistgenerator/constraints/TagMatch.cpp b/src/playlistgenerator/constraints/TagMatch.cpp --- a/src/playlistgenerator/constraints/TagMatch.cpp +++ b/src/playlistgenerator/constraints/TagMatch.cpp @@ -35,22 +35,22 @@ if ( p ) return new TagMatch( xmlelem, p ); else - return 0; + return nullptr; } Constraint* ConstraintTypes::TagMatch::createNew( ConstraintNode* p ) { if ( p ) return new TagMatch( p ); else - return 0; + return nullptr; } ConstraintFactoryEntry* ConstraintTypes::TagMatch::registerMe() { - return new ConstraintFactoryEntry( "TagMatch", + return new ConstraintFactoryEntry( QStringLiteral("TagMatch"), i18n("Match Tags"), i18n("Make all tracks in the playlist match the specified characteristic"), &TagMatch::createFromXml, &TagMatch::createNew ); @@ -63,18 +63,18 @@ { QDomAttr a; - a = xmlelem.attributeNode( "field" ); + a = xmlelem.attributeNode( QStringLiteral("field") ); if ( !a.isNull() ) { if ( m_fieldsModel->contains( a.value() ) ) m_field = a.value(); } - a = xmlelem.attributeNode( "comparison" ); + a = xmlelem.attributeNode( QStringLiteral("comparison") ); if ( !a.isNull() ) { m_comparison = a.value().toInt(); } - a = xmlelem.attributeNode( "value" ); + a = xmlelem.attributeNode( QStringLiteral("value") ); if ( !a.isNull() ) { if ( m_fieldsModel->type_of( m_field ) == FieldTypeInt ) { m_value = a.value().toInt(); @@ -84,9 +84,9 @@ if ( parts.size() == 2 ) { int u = parts.at( 0 ).toInt(); int v = 0; - if ( parts.at( 1 ) == "months" ) + if ( parts.at( 1 ) == QLatin1String("months") ) v = 1; - else if ( parts.at( 1 ) == "years" ) + else if ( parts.at( 1 ) == QLatin1String("years") ) v = 2; m_value = QVariant::fromValue( DateRange( u, v ) ); } else @@ -98,21 +98,21 @@ } } - a = xmlelem.attributeNode( "invert" ); - if ( !a.isNull() && a.value() == "true" ) + a = xmlelem.attributeNode( QStringLiteral("invert") ); + if ( !a.isNull() && a.value() == QLatin1String("true") ) m_invert = true; else m_invert = false; - a = xmlelem.attributeNode( "strictness" ); + a = xmlelem.attributeNode( QStringLiteral("strictness") ); if ( !a.isNull() ) m_strictness = a.value().toDouble(); } ConstraintTypes::TagMatch::TagMatch( ConstraintNode* p ) : MatchingConstraint( p ) , m_comparison( CompareStrEquals ) - , m_field( "title" ) + , m_field( QStringLiteral("title") ) , m_invert( false ) , m_strictness( 1.0 ) , m_value() @@ -147,19 +147,19 @@ void ConstraintTypes::TagMatch::toXml( QDomDocument& doc, QDomElement& elem ) const { - QDomElement c = doc.createElement( "constraint" ); + QDomElement c = doc.createElement( QStringLiteral("constraint") ); - c.setAttribute( "type", "TagMatch" ); - c.setAttribute( "field", m_field ); - c.setAttribute( "comparison", m_comparison ); - c.setAttribute( "value", valueToString() ); + c.setAttribute( QStringLiteral("type"), QStringLiteral("TagMatch") ); + c.setAttribute( QStringLiteral("field"), m_field ); + c.setAttribute( QStringLiteral("comparison"), m_comparison ); + c.setAttribute( QStringLiteral("value"), valueToString() ); if ( m_invert ) - c.setAttribute( "invert", "true" ); + c.setAttribute( QStringLiteral("invert"), QStringLiteral("true") ); else - c.setAttribute( "invert", "false" ); + c.setAttribute( QStringLiteral("invert"), QStringLiteral("false") ); - c.setAttribute( "strictness", QString::number( m_strictness ) ); + c.setAttribute( QStringLiteral("strictness"), QString::number( m_strictness ) ); elem.appendChild( c ); } @@ -172,16 +172,16 @@ "%3 = a predicate, can be equals, starts with, ends with or contains; " "%4 = a string to match; " "Example: Match tag: not title contains \"foo\"", "Match tag:%1 %2 %3 %4") ); - v = v.arg( ( m_invert ? i18n(" not") : "" ), m_fieldsModel->pretty_name_of( m_field ), comparisonToString() ); - if ( m_field == "rating" ) { + v = v.arg( ( m_invert ? i18n(" not") : QLatin1String("") ), m_fieldsModel->pretty_name_of( m_field ), comparisonToString() ); + if ( m_field == QLatin1String("rating") ) { double r = m_value.toDouble() / 2.0; return v.arg( i18ncp("number of stars in the rating of a track", "%1 star", "%1 stars", r) ); - } else if ( m_field == "length" ) { - return v.arg( QTime(0, 0, 0).addMSecs( m_value.toInt() ).toString( "H:mm:ss" ) ); + } else if ( m_field == QLatin1String("length") ) { + return v.arg( QTime(0, 0, 0).addMSecs( m_value.toInt() ).toString( QStringLiteral("H:mm:ss") ) ); } else { if ( m_fieldsModel->type_of( m_field ) == FieldTypeString ) { // put quotes around any strings (eg, track title or artist name) ... - QString s = QString( i18nc("an arbitrary string surrounded by quotes", "\"%1\"") ).arg( valueToString() ); + QString s = i18nc("an arbitrary string surrounded by quotes", "\"%1\"", valueToString() ); return v.arg( s ); } else { // ... but don't quote put quotes around anything else @@ -332,36 +332,36 @@ { if ( m_fieldsModel->type_of( m_field ) == FieldTypeInt ) { if ( m_comparison == CompareNumEquals ) { - return QString( i18nc("a numerical tag (like year or track number) equals a value","equals") ); + return i18nc("a numerical tag (like year or track number) equals a value","equals"); } else if ( m_comparison == CompareNumGreaterThan ) { - return QString( i18n("greater than") ); + return i18n("greater than"); } else if ( m_comparison == CompareNumLessThan ) { - return QString( i18n("less than") ); + return i18n("less than"); } } else if ( m_fieldsModel->type_of( m_field ) == FieldTypeDate ) { if ( m_comparison == CompareDateBefore ) { - return QString( i18n("before") ); + return i18n("before"); } else if ( m_comparison == CompareDateOn ) { - return QString( i18n("on") ); + return i18n("on"); } else if ( m_comparison == CompareDateAfter ) { - return QString( i18n("after") ); + return i18n("after"); } else if ( m_comparison == CompareDateWithin ) { - return QString( i18n("within") ); + return i18n("within"); } } else { if ( m_comparison == CompareStrEquals ) { - return QString( i18nc("an alphabetical tag (like title or artist name) equals some string","equals") ); + return i18nc("an alphabetical tag (like title or artist name) equals some string","equals"); } else if ( m_comparison == CompareStrStartsWith ) { - return QString( i18nc("an alphabetical tag (like title or artist name) starts with some string","starts with") ); + return i18nc("an alphabetical tag (like title or artist name) starts with some string","starts with"); } else if ( m_comparison == CompareStrEndsWith ) { - return QString( i18nc("an alphabetical tag (like title or artist name) ends with some string","ends with") ); + return i18nc("an alphabetical tag (like title or artist name) ends with some string","ends with"); } else if ( m_comparison == CompareStrContains ) { - return QString( i18nc("an alphabetical tag (like title or artist name) contains some string","contains") ); + return i18nc("an alphabetical tag (like title or artist name) contains some string","contains"); } else if ( m_comparison == CompareStrRegExp ) { - return QString( i18n("regexp") ); + return i18n("regexp"); } } - return QString( i18n("unknown comparison") ); + return i18n("unknown comparison"); } QString @@ -476,15 +476,15 @@ { m_comparison = c; m_matchCache.clear(); - emit dataChanged(); + Q_EMIT dataChanged(); } void ConstraintTypes::TagMatch::setField( const QString& s ) { m_field = s; m_matchCache.clear(); - emit dataChanged(); + Q_EMIT dataChanged(); } void @@ -496,7 +496,7 @@ } } m_invert = v; - emit dataChanged(); + Q_EMIT dataChanged(); } void @@ -511,7 +511,7 @@ { m_value = v; m_matchCache.clear(); - emit dataChanged(); + Q_EMIT dataChanged(); } /****************************** @@ -524,7 +524,7 @@ const bool invert, const int strictness, const QVariant& value ) - : QWidget( 0 ) + : QWidget( nullptr ) , m_fieldsModel( new TagMatchFieldsModel() ) { ui.setupUi( this ); @@ -543,11 +543,11 @@ ui.comboBox_Field->setModel( m_fieldsModel ); ui.checkBox_Invert->setChecked( invert ); - if ( field == "rating" ) { + if ( field == QLatin1String("rating") ) { ui.comboBox_ComparisonRating->setCurrentIndex( comparison ); ui.slider_StrictnessRating->setValue( strictness ); ui.rating_RatingValue->setRating( value.toInt() ); - } else if ( field == "length" ) { + } else if ( field == QLatin1String("length") ) { ui.comboBox_ComparisonTime->setCurrentIndex( comparison ); ui.slider_StrictnessTime->setValue( strictness ); ui.timeEdit_TimeValue->setTime( QTime(0, 0, 0).addMSecs( value.toInt() ) ); @@ -588,31 +588,31 @@ ui.stackedWidget_Date->setCurrentIndex( 1 ); else ui.stackedWidget_Date->setCurrentIndex( 0 ); - emit comparisonChanged( c ); + Q_EMIT comparisonChanged( c ); } void ConstraintTypes::TagMatchEditWidget::on_comboBox_ComparisonInt_currentIndexChanged( int c ) { - emit comparisonChanged( c ); + Q_EMIT comparisonChanged( c ); } void ConstraintTypes::TagMatchEditWidget::on_comboBox_ComparisonRating_currentIndexChanged( int c ) { - emit comparisonChanged( c ); + Q_EMIT comparisonChanged( c ); } void ConstraintTypes::TagMatchEditWidget::on_comboBox_ComparisonString_currentIndexChanged( int c ) { - emit comparisonChanged( c ); + Q_EMIT comparisonChanged( c ); } void ConstraintTypes::TagMatchEditWidget::on_comboBox_ComparisonTime_currentIndexChanged( int c ) { - emit comparisonChanged( c ); + Q_EMIT comparisonChanged( c ); } // ComboBox slots for field @@ -623,12 +623,12 @@ int c = 0; int s = 0; QVariant v; - if ( field == "length" ) { + if ( field == QLatin1String("length") ) { ui.stackedWidget_Field->setCurrentIndex( 3 ); c = ui.comboBox_ComparisonTime->currentIndex(); s = ui.slider_StrictnessTime->value(); v = QTime(0, 0, 0).msecsTo( ui.timeEdit_TimeValue->time() ); - } else if ( field == "rating" ) { + } else if ( field == QLatin1String("rating") ) { ui.stackedWidget_Field->setCurrentIndex( 4 ); c = ui.comboBox_ComparisonRating->currentIndex(); s = ui.slider_StrictnessRating->value(); @@ -662,88 +662,88 @@ // TODO: set range limitations and default values depending on field - emit fieldChanged( field ); - emit valueChanged( v ); - emit comparisonChanged( c ); - emit strictnessChanged( s ); + Q_EMIT fieldChanged( field ); + Q_EMIT valueChanged( v ); + Q_EMIT comparisonChanged( c ); + Q_EMIT strictnessChanged( s ); } // Invert checkbox slot void ConstraintTypes::TagMatchEditWidget::on_checkBox_Invert_clicked( bool v ) { - emit invertChanged( v ); + Q_EMIT invertChanged( v ); } // Strictness Slider slots void ConstraintTypes::TagMatchEditWidget::on_slider_StrictnessDate_valueChanged( int v ) { - emit strictnessChanged( v ); + Q_EMIT strictnessChanged( v ); } void ConstraintTypes::TagMatchEditWidget::on_slider_StrictnessInt_valueChanged( int v ) { - emit strictnessChanged( v ); + Q_EMIT strictnessChanged( v ); } void ConstraintTypes::TagMatchEditWidget::on_slider_StrictnessRating_valueChanged( int v ) { - emit strictnessChanged( v ); + Q_EMIT strictnessChanged( v ); } void ConstraintTypes::TagMatchEditWidget::on_slider_StrictnessTime_valueChanged( int v ) { - emit strictnessChanged( v ); + Q_EMIT strictnessChanged( v ); } // various value slots void ConstraintTypes::TagMatchEditWidget::on_kdatewidget_DateSpecific_changed( const QDate& v ) { - emit valueChanged( QVariant( v ) ); + Q_EMIT valueChanged( QVariant( v ) ); } void ConstraintTypes::TagMatchEditWidget::on_comboBox_ValueDateUnit_currentIndexChanged( int u ) { int v = ui.spinBox_ValueDateValue->value(); - emit valueChanged( QVariant::fromValue( DateRange( v, u ) ) ); + Q_EMIT valueChanged( QVariant::fromValue( DateRange( v, u ) ) ); } void ConstraintTypes::TagMatchEditWidget::on_spinBox_ValueDateValue_valueChanged( int v ) { int u = ui.comboBox_ValueDateUnit->currentIndex(); - emit valueChanged( QVariant::fromValue( DateRange( v, u ) ) ); + Q_EMIT valueChanged( QVariant::fromValue( DateRange( v, u ) ) ); } void ConstraintTypes::TagMatchEditWidget::on_spinBox_ValueInt_valueChanged( int v ) { - emit valueChanged( QVariant( v ) ); + Q_EMIT valueChanged( QVariant( v ) ); } void ConstraintTypes::TagMatchEditWidget::on_lineEdit_StringValue_textChanged( const QString& v ) { - emit valueChanged( QVariant( v ) ); + Q_EMIT valueChanged( QVariant( v ) ); } void ConstraintTypes::TagMatchEditWidget::on_rating_RatingValue_ratingChanged( int v ) { - emit valueChanged( QVariant( v ) ); + Q_EMIT valueChanged( QVariant( v ) ); } void ConstraintTypes::TagMatchEditWidget::on_timeEdit_TimeValue_timeChanged( const QTime& t ) { int v = QTime(0, 0, 0).msecsTo( t ); - emit valueChanged( QVariant( v ) ); + Q_EMIT valueChanged( QVariant( v ) ); } void diff --git a/src/playlistgenerator/constraints/TagMatchSupport.cpp b/src/playlistgenerator/constraints/TagMatchSupport.cpp --- a/src/playlistgenerator/constraints/TagMatchSupport.cpp +++ b/src/playlistgenerator/constraints/TagMatchSupport.cpp @@ -25,81 +25,81 @@ ConstraintTypes::TagMatchFieldsModel::TagMatchFieldsModel() { - m_fieldNames << "url" - << "title" - << "artist name" - << "album name" - << "genre" - << "composer" - << "year" - << "comment" - << "track number" - << "disc number" - << "length" - << "score" - << "rating" - << "create date" - << "first played" - << "last played" - << "play count" - << "label"; - - m_fieldTypes.insert( "url", TagMatch::FieldTypeString ); - m_fieldTypes.insert( "title", TagMatch::FieldTypeString ); - m_fieldTypes.insert( "artist name", TagMatch::FieldTypeString ); - m_fieldTypes.insert( "album name", TagMatch::FieldTypeString ); - m_fieldTypes.insert( "genre", TagMatch::FieldTypeString ); - m_fieldTypes.insert( "composer", TagMatch::FieldTypeString ); - m_fieldTypes.insert( "year", TagMatch::FieldTypeInt ); - m_fieldTypes.insert( "comment", TagMatch::FieldTypeString ); - m_fieldTypes.insert( "track number", TagMatch::FieldTypeInt ); - m_fieldTypes.insert( "disc number", TagMatch::FieldTypeInt ); - m_fieldTypes.insert( "length", TagMatch::FieldTypeInt ); - m_fieldTypes.insert( "create date", TagMatch::FieldTypeDate); - m_fieldTypes.insert( "score", TagMatch::FieldTypeInt ); - m_fieldTypes.insert( "rating", TagMatch::FieldTypeInt ); - m_fieldTypes.insert( "first played", TagMatch::FieldTypeDate ); - m_fieldTypes.insert( "last played", TagMatch::FieldTypeDate ); - m_fieldTypes.insert( "play count", TagMatch::FieldTypeInt ); - m_fieldTypes.insert( "label", TagMatch::FieldTypeString ); - - m_fieldMetaValues.insert( "url", Meta::valUrl ); - m_fieldMetaValues.insert( "title", Meta::valTitle ); - m_fieldMetaValues.insert( "artist name", Meta::valArtist ); - m_fieldMetaValues.insert( "album name", Meta::valAlbum ); - m_fieldMetaValues.insert( "genre", Meta::valGenre ); - m_fieldMetaValues.insert( "composer", Meta::valComposer ); - m_fieldMetaValues.insert( "year", Meta::valYear ); - m_fieldMetaValues.insert( "comment", Meta::valComment ); - m_fieldMetaValues.insert( "track number", Meta::valTrackNr ); - m_fieldMetaValues.insert( "disc number", Meta::valDiscNr ); - m_fieldMetaValues.insert( "length", Meta::valLength ); - m_fieldMetaValues.insert( "create date", Meta::valCreateDate); - m_fieldMetaValues.insert( "score", Meta::valScore ); - m_fieldMetaValues.insert( "rating", Meta::valRating ); - m_fieldMetaValues.insert( "first played", Meta::valFirstPlayed ); - m_fieldMetaValues.insert( "last played", Meta::valLastPlayed ); - m_fieldMetaValues.insert( "play count", Meta::valPlaycount ); - m_fieldMetaValues.insert( "label", Meta::valLabel ); - - m_fieldPrettyNames.insert( "url", i18n("url") ); - m_fieldPrettyNames.insert( "title", i18n("title") ); - m_fieldPrettyNames.insert( "artist name", i18n("artist name") ); - m_fieldPrettyNames.insert( "album name", i18n("album name") ); - m_fieldPrettyNames.insert( "genre", i18n("genre") ); - m_fieldPrettyNames.insert( "composer", i18n("composer") ); - m_fieldPrettyNames.insert( "year", i18n("year") ); - m_fieldPrettyNames.insert( "comment", i18n("comment") ); - m_fieldPrettyNames.insert( "track number", i18n("track number") ); - m_fieldPrettyNames.insert( "disc number", i18n("disc number") ); - m_fieldPrettyNames.insert( "length", i18n("length") ); - m_fieldPrettyNames.insert( "create date", i18n("added to collection") ); - m_fieldPrettyNames.insert( "score", i18n("score") ); - m_fieldPrettyNames.insert( "rating", i18n("rating") ); - m_fieldPrettyNames.insert( "first played", i18n("first played") ); - m_fieldPrettyNames.insert( "last played", i18n("last played") ); - m_fieldPrettyNames.insert( "play count", i18n("play count") ); - m_fieldPrettyNames.insert( "label", i18n("label") ); + m_fieldNames << QStringLiteral("url") + << QStringLiteral("title") + << QStringLiteral("artist name") + << QStringLiteral("album name") + << QStringLiteral("genre") + << QStringLiteral("composer") + << QStringLiteral("year") + << QStringLiteral("comment") + << QStringLiteral("track number") + << QStringLiteral("disc number") + << QStringLiteral("length") + << QStringLiteral("score") + << QStringLiteral("rating") + << QStringLiteral("create date") + << QStringLiteral("first played") + << QStringLiteral("last played") + << QStringLiteral("play count") + << QStringLiteral("label"); + + m_fieldTypes.insert( QStringLiteral("url"), TagMatch::FieldTypeString ); + m_fieldTypes.insert( QStringLiteral("title"), TagMatch::FieldTypeString ); + m_fieldTypes.insert( QStringLiteral("artist name"), TagMatch::FieldTypeString ); + m_fieldTypes.insert( QStringLiteral("album name"), TagMatch::FieldTypeString ); + m_fieldTypes.insert( QStringLiteral("genre"), TagMatch::FieldTypeString ); + m_fieldTypes.insert( QStringLiteral("composer"), TagMatch::FieldTypeString ); + m_fieldTypes.insert( QStringLiteral("year"), TagMatch::FieldTypeInt ); + m_fieldTypes.insert( QStringLiteral("comment"), TagMatch::FieldTypeString ); + m_fieldTypes.insert( QStringLiteral("track number"), TagMatch::FieldTypeInt ); + m_fieldTypes.insert( QStringLiteral("disc number"), TagMatch::FieldTypeInt ); + m_fieldTypes.insert( QStringLiteral("length"), TagMatch::FieldTypeInt ); + m_fieldTypes.insert( QStringLiteral("create date"), TagMatch::FieldTypeDate); + m_fieldTypes.insert( QStringLiteral("score"), TagMatch::FieldTypeInt ); + m_fieldTypes.insert( QStringLiteral("rating"), TagMatch::FieldTypeInt ); + m_fieldTypes.insert( QStringLiteral("first played"), TagMatch::FieldTypeDate ); + m_fieldTypes.insert( QStringLiteral("last played"), TagMatch::FieldTypeDate ); + m_fieldTypes.insert( QStringLiteral("play count"), TagMatch::FieldTypeInt ); + m_fieldTypes.insert( QStringLiteral("label"), TagMatch::FieldTypeString ); + + m_fieldMetaValues.insert( QStringLiteral("url"), Meta::valUrl ); + m_fieldMetaValues.insert( QStringLiteral("title"), Meta::valTitle ); + m_fieldMetaValues.insert( QStringLiteral("artist name"), Meta::valArtist ); + m_fieldMetaValues.insert( QStringLiteral("album name"), Meta::valAlbum ); + m_fieldMetaValues.insert( QStringLiteral("genre"), Meta::valGenre ); + m_fieldMetaValues.insert( QStringLiteral("composer"), Meta::valComposer ); + m_fieldMetaValues.insert( QStringLiteral("year"), Meta::valYear ); + m_fieldMetaValues.insert( QStringLiteral("comment"), Meta::valComment ); + m_fieldMetaValues.insert( QStringLiteral("track number"), Meta::valTrackNr ); + m_fieldMetaValues.insert( QStringLiteral("disc number"), Meta::valDiscNr ); + m_fieldMetaValues.insert( QStringLiteral("length"), Meta::valLength ); + m_fieldMetaValues.insert( QStringLiteral("create date"), Meta::valCreateDate); + m_fieldMetaValues.insert( QStringLiteral("score"), Meta::valScore ); + m_fieldMetaValues.insert( QStringLiteral("rating"), Meta::valRating ); + m_fieldMetaValues.insert( QStringLiteral("first played"), Meta::valFirstPlayed ); + m_fieldMetaValues.insert( QStringLiteral("last played"), Meta::valLastPlayed ); + m_fieldMetaValues.insert( QStringLiteral("play count"), Meta::valPlaycount ); + m_fieldMetaValues.insert( QStringLiteral("label"), Meta::valLabel ); + + m_fieldPrettyNames.insert( QStringLiteral("url"), i18n("url") ); + m_fieldPrettyNames.insert( QStringLiteral("title"), i18n("title") ); + m_fieldPrettyNames.insert( QStringLiteral("artist name"), i18n("artist name") ); + m_fieldPrettyNames.insert( QStringLiteral("album name"), i18n("album name") ); + m_fieldPrettyNames.insert( QStringLiteral("genre"), i18n("genre") ); + m_fieldPrettyNames.insert( QStringLiteral("composer"), i18n("composer") ); + m_fieldPrettyNames.insert( QStringLiteral("year"), i18n("year") ); + m_fieldPrettyNames.insert( QStringLiteral("comment"), i18n("comment") ); + m_fieldPrettyNames.insert( QStringLiteral("track number"), i18n("track number") ); + m_fieldPrettyNames.insert( QStringLiteral("disc number"), i18n("disc number") ); + m_fieldPrettyNames.insert( QStringLiteral("length"), i18n("length") ); + m_fieldPrettyNames.insert( QStringLiteral("create date"), i18n("added to collection") ); + m_fieldPrettyNames.insert( QStringLiteral("score"), i18n("score") ); + m_fieldPrettyNames.insert( QStringLiteral("rating"), i18n("rating") ); + m_fieldPrettyNames.insert( QStringLiteral("first played"), i18n("first played") ); + m_fieldPrettyNames.insert( QStringLiteral("last played"), i18n("last played") ); + m_fieldPrettyNames.insert( QStringLiteral("play count"), i18n("play count") ); + m_fieldPrettyNames.insert( QStringLiteral("label"), i18n("label") ); } ConstraintTypes::TagMatchFieldsModel::~TagMatchFieldsModel() @@ -291,7 +291,7 @@ } double -ConstraintTypes::TagMatch::Comparer::compareLabels( const Meta::TrackPtr t, +ConstraintTypes::TagMatch::Comparer::compareLabels( const Meta::TrackPtr &t, const int comparison, const QString& target ) const { diff --git a/src/playlistgenerator/constraints/TrackSpreader.h b/src/playlistgenerator/constraints/TrackSpreader.h --- a/src/playlistgenerator/constraints/TrackSpreader.h +++ b/src/playlistgenerator/constraints/TrackSpreader.h @@ -41,15 +41,15 @@ static Constraint* createNew( ConstraintNode* ); static ConstraintFactoryEntry* registerMe(); - virtual QWidget* editWidget() const; - virtual void toXml( QDomDocument&, QDomElement& ) const; + QWidget* editWidget() const override; + void toXml( QDomDocument&, QDomElement& ) const override; - virtual QString getName() const { return QString(); } + QString getName() const override { return QString(); } - virtual double satisfaction( const Meta::TrackList& ) const; + double satisfaction( const Meta::TrackList& ) const override; private: - TrackSpreader(ConstraintNode*); + explicit TrackSpreader(ConstraintNode*); double distance( const int, const int ) const; }; diff --git a/src/playlistmanager/PlaylistManager.h b/src/playlistmanager/PlaylistManager.h --- a/src/playlistmanager/PlaylistManager.h +++ b/src/playlistmanager/PlaylistManager.h @@ -57,14 +57,14 @@ class AMAROK_EXPORT PlaylistManager : public QObject { Q_OBJECT - Q_ENUMS( PlaylistCategory ) public: enum PlaylistCategory { UserPlaylist = 1, PodcastChannel }; + Q_ENUM( PlaylistCategory ) static PlaylistManager *instance(); static void destroy(); @@ -122,19 +122,24 @@ /** * Saves a playlist from a file to the database. - * @arg fromLocation Saved playlist file to load + * @param fromLocation Saved playlist file to load */ - bool import( const QString &fromLocation ); + bool import( const QUrl &fromLocation ); /** - * Initiates renaming of playlists @param playlist. Can Focus Saved Playlists and + * Initiates renaming of playlists. Can Focus Saved Playlists and * initiate inline rename. + * + * @param playlist the playlists. */ void rename( Playlists::PlaylistPtr playlist ); /** - * Rename @param playlist to @param newName, return true if renaming was successful, + * Rename @p playlist to @p newName, return true if renaming was successful, * false otherwise. + * + * @param playlist the playlist. + * @param newName the new name. */ bool rename( Playlists::PlaylistPtr playlist, const QString &newName ); diff --git a/src/playlistmanager/PlaylistManager.cpp b/src/playlistmanager/PlaylistManager.cpp --- a/src/playlistmanager/PlaylistManager.cpp +++ b/src/playlistmanager/PlaylistManager.cpp @@ -32,7 +32,7 @@ #include "playlistmanager/SyncedPlaylist.h" #include "core/support/Debug.h" #include "core/support/Components.h" -#include "core/interfaces/Logger.h" +#include "core/logger/Logger.h" #include "browsers/playlistbrowser/UserPlaylistModel.h" #include @@ -49,7 +49,7 @@ using namespace Meta; using namespace Playlists; -PlaylistManager *PlaylistManager::s_instance = 0; +PlaylistManager *PlaylistManager::s_instance = nullptr; namespace The { @@ -67,7 +67,7 @@ { if (s_instance) { delete s_instance; - s_instance = 0; + s_instance = nullptr; } } @@ -129,10 +129,10 @@ this, &PlaylistManager::slotPlaylistRemoved ); if( newCategory ) - emit categoryAdded( category ); + Q_EMIT categoryAdded( category ); - emit providerAdded( provider, category ); - emit updated( category ); + Q_EMIT providerAdded( provider, category ); + Q_EMIT updated( category ); loadPlaylists( provider, category ); } @@ -176,25 +176,25 @@ { m_syncedPlaylistMap.insert( syncedPlaylist, playlist ); - //The synchronosation will be done in the next mainloop run + //The synchronization will be done in the next mainloop run m_syncNeeded.append( syncedPlaylist ); QTimer::singleShot( 0, this, &PlaylistManager::slotSyncNeeded ); } - //deliberatly reusing the passed argument + //deliberately reusing the passed argument playlist = PlaylistPtr::dynamicCast( syncedPlaylist ); if( m_playlistMap.values( category ).contains( playlist ) ) { //no need to add it again but do let the model know something changed. - emit playlistUpdated( playlist, category ); + Q_EMIT playlistUpdated( playlist, category ); return; } } m_playlistMap.insert( category, playlist ); //reemit so models know about new playlist in their category - emit playlistAdded( playlist, category ); + Q_EMIT playlistAdded( playlist, category ); } void @@ -214,8 +214,8 @@ m_providerMap.remove( provider->category(), provider ); - emit providerRemoved( provider, provider->category() ); - emit updated( provider->category() ); + Q_EMIT providerRemoved( provider, provider->category() ); + Q_EMIT updated( provider->category() ); } void @@ -234,9 +234,8 @@ void PlaylistManager::removePlaylist( Playlists::PlaylistPtr playlist, int category ) { - if( typeid( *playlist.data() ) == typeid( SyncedPlaylist ) ) + if( auto syncedPlaylist = SyncedPlaylistPtr::dynamicCast( playlist ) ) { - SyncedPlaylistPtr syncedPlaylist = SyncedPlaylistPtr::dynamicCast( playlist ); //TODO: this might be wrong if there were multiple playlists from the same provider. //remove the specific child playlist, not all from same provider. syncedPlaylist->removePlaylistsFrom( playlist->provider() ); @@ -250,7 +249,7 @@ m_playlistMap.remove( category, playlist ); } - emit playlistRemoved( playlist, category ); + Q_EMIT playlistRemoved( playlist, category ); } void @@ -261,11 +260,11 @@ if( !provider ) return; - //forcefull reload all the providers playlists. + //forceful reload all the providers playlists. //This is an expensive operation, the provider should use playlistAdded/Removed signals instead. removePlaylists( provider ); loadPlaylists( provider, provider->category() ); - emit updated( provider->category() ); + Q_EMIT updated( provider->category() ); } void @@ -329,7 +328,7 @@ } bool -PlaylistManager::import( const QString& fromLocation ) +PlaylistManager::import( const QUrl& fromLocation ) { // used by: PlaylistBrowserNS::UserModel::dropMimeData() AMAROK_DEPRECATED @@ -339,17 +338,17 @@ debug() << "ERROR: m_playlistFileProvider was null"; return false; } - return m_playlistFileProvider->import( QUrl(fromLocation) ); + return m_playlistFileProvider->import( fromLocation ); } void PlaylistManager::rename( Playlists::PlaylistPtr playlist ) { if( playlist.isNull() ) return; - AmarokUrl("amarok://navigate/playlists/user playlists").run(); - emit renamePlaylist( playlist ); // connected to PlaylistBrowserModel + AmarokUrl(QStringLiteral("amarok://navigate/playlists/user playlists")).run(); + Q_EMIT renamePlaylist( playlist ); // connected to PlaylistBrowserModel } bool @@ -516,7 +515,7 @@ m_playlistMap.insert( category, syncedPlaylistPtr ); //reemit so models know about new playlist in their category - emit playlistAdded( syncedPlaylistPtr, category ); + Q_EMIT playlistAdded( syncedPlaylistPtr, category ); } } } diff --git a/src/playlistmanager/SyncedPlaylist.h b/src/playlistmanager/SyncedPlaylist.h --- a/src/playlistmanager/SyncedPlaylist.h +++ b/src/playlistmanager/SyncedPlaylist.h @@ -26,28 +26,28 @@ class SyncedPlaylist : public Playlists::Playlist, public Playlists::PlaylistObserver { public: - explicit SyncedPlaylist( Playlists::PlaylistPtr playlist ); - virtual ~SyncedPlaylist() {} + explicit SyncedPlaylist( const Playlists::PlaylistPtr &playlist ); + ~SyncedPlaylist() override {} //Playlists::Playlist methods - virtual QUrl uidUrl() const; - virtual QString name() const; - virtual QString prettyName() const; - virtual Playlists::PlaylistProvider *provider() const; - virtual void setName( const QString &name ) { Q_UNUSED( name ); } + QUrl uidUrl() const override; + QString name() const override; + QString prettyName() const override; + Playlists::PlaylistProvider *provider() const override; + void setName( const QString &name ) override { Q_UNUSED( name ); } - virtual Meta::TrackList tracks(); - virtual int trackCount() const; + Meta::TrackList tracks() override; + int trackCount() const override; - virtual void addTrack( Meta::TrackPtr track, int position = -1 ); - virtual void removeTrack( int position ); + void addTrack( const Meta::TrackPtr &track, int position = -1 ) override; + void removeTrack( int position ) override; //PlaylistObserver methods - virtual void metadataChanged( Playlists::PlaylistPtr playlist ); - virtual void tracksLoaded( Playlists::PlaylistPtr); - virtual void trackAdded( Playlists::PlaylistPtr playlist, Meta::TrackPtr track, - int position ); - virtual void trackRemoved( Playlists::PlaylistPtr playlist, int position ); + void metadataChanged( const Playlists::PlaylistPtr &playlist ) override; + void tracksLoaded( Playlists::PlaylistPtr) override; + void trackAdded( const Playlists::PlaylistPtr &playlist, const Meta::TrackPtr &track, + int position ) override; + void trackRemoved( const Playlists::PlaylistPtr &playlist, int position ) override; //SyncedPlaylist methods /** returns true when there is no active playlist associated with it anymore. */ @@ -65,7 +65,7 @@ virtual Playlists::PlaylistList slaves() const; protected: - SyncedPlaylist() {}; + SyncedPlaylist() {} private: Playlists::PlaylistList m_playlists; diff --git a/src/playlistmanager/SyncedPlaylist.cpp b/src/playlistmanager/SyncedPlaylist.cpp --- a/src/playlistmanager/SyncedPlaylist.cpp +++ b/src/playlistmanager/SyncedPlaylist.cpp @@ -25,15 +25,15 @@ using namespace Meta; -SyncedPlaylist::SyncedPlaylist( Playlists::PlaylistPtr playlist ) +SyncedPlaylist::SyncedPlaylist( const Playlists::PlaylistPtr &playlist ) { addPlaylist( playlist ); } QUrl SyncedPlaylist::uidUrl() const { - return QUrl( QString( "amarok-syncedplaylist://" ) + m_playlists.first()->name() ); + return QUrl( QStringLiteral( "amarok-syncedplaylist://" ) + m_playlists.first()->name() ); } QString @@ -77,7 +77,7 @@ } void -SyncedPlaylist::addTrack( Meta::TrackPtr track, int position ) +SyncedPlaylist::addTrack( const Meta::TrackPtr &track, int position ) { //only apply it to the first, the rest will follow in trackAdded() m_playlists.first()->addTrack( track, position ); @@ -91,7 +91,7 @@ } void -SyncedPlaylist::metadataChanged( Playlists::PlaylistPtr playlist ) +SyncedPlaylist::metadataChanged( const Playlists::PlaylistPtr &playlist ) { if( !m_playlists.contains( playlist ) ) return; @@ -106,12 +106,12 @@ if( !m_playlists.contains( playlist ) ) return; - // TODO: me may give more thought to this and emit tracksLoaded() only when all subplaylists load + // TODO: me may give more thought to this and Q_EMIT tracksLoaded() only when all subplaylists load notifyObserversTracksLoaded(); } void -SyncedPlaylist::trackAdded( Playlists::PlaylistPtr playlist, TrackPtr track, int position ) +SyncedPlaylist::trackAdded( const Playlists::PlaylistPtr &playlist, const TrackPtr &track, int position ) { if( !m_playlists.contains( playlist ) ) return; @@ -132,7 +132,7 @@ } void -SyncedPlaylist::trackRemoved( Playlists::PlaylistPtr playlist, int position ) +SyncedPlaylist::trackRemoved( const Playlists::PlaylistPtr &playlist, int position ) { if( !m_playlists.contains( playlist ) ) return; @@ -245,7 +245,7 @@ int position = 0; debug() << "Master Playlist: " << master->name() << " - " << master->uidUrl().url(); while( m.hasNext() ) - debug() << QString( "%1 : %2" ).arg( position++ ).arg( m.next()->name() ); + debug() << QStringLiteral( "%1 : %2" ).arg( position++ ).arg( m.next()->name() ); m.toFront(); for( ;i != m_playlists.end(); ++i) @@ -256,7 +256,7 @@ position = 0; debug() << "Slave Playlist: " << slave->name() << " - " << slave->uidUrl().url(); foreach( const TrackPtr track, slaveTracks ) - debug() << QString( "%1 : %2" ).arg( position++ ).arg( track->name() ); + debug() << QStringLiteral( "%1 : %2" ).arg( position++ ).arg( track->name() ); //Add first. Tracks in slave that are not in master will eventually shift to the end. position = 0; @@ -266,7 +266,7 @@ if( position >= slaveTracks.size() || track->uidUrl() != slaveTracks.at( position )->uidUrl() ) { - debug() << QString( "insert %2 at %1" ).arg( position ).arg( track->name() ); + debug() << QStringLiteral( "insert %2 at %1" ).arg( position ).arg( track->name() ); slave->addTrack( track, position ); slave->syncTrackStatus( position, track ); @@ -281,7 +281,7 @@ position = 0; debug() << "slave playlist after insertions:"; foreach( const TrackPtr track, slaveTracks ) - debug() << QString( "%1 : %2" ).arg( position++ ).arg( track->name() ); + debug() << QStringLiteral( "%1 : %2" ).arg( position++ ).arg( track->name() ); //Then remove everything after the position of the last track in master. //This removes any tracks that are not in master. @@ -294,7 +294,7 @@ position = 0; debug() << "slave playlist after removal:"; foreach( const TrackPtr track, slave->tracks() ) - debug() << QString( "%1 : %2" ).arg( position++ ).arg( track->name() ); + debug() << QStringLiteral( "%1 : %2" ).arg( position++ ).arg( track->name() ); } } diff --git a/src/playlistmanager/SyncedPodcast.h b/src/playlistmanager/SyncedPodcast.h --- a/src/playlistmanager/SyncedPodcast.h +++ b/src/playlistmanager/SyncedPodcast.h @@ -27,40 +27,40 @@ virtual ~SyncedPodcast() {} //Playlist virtual methods - virtual QString name() const { return title(); } + QString name() const override { return title(); } //PodcastMetaCommon methods - virtual QString title() const { return m_master->title(); } - virtual QString description() const { return m_master->description(); } - virtual QStringList keywords() const { return m_master->keywords(); } - virtual QString subtitle() const { return m_master->subtitle(); } - virtual QString summary() const { return m_master->summary(); } - virtual QString author() const { return m_master->author(); } + QString title() const override { return m_master->title(); } + QString description() const override { return m_master->description(); } + QStringList keywords() const override { return m_master->keywords(); } + QString subtitle() const override { return m_master->subtitle(); } + QString summary() const override { return m_master->summary(); } + QString author() const override { return m_master->author(); } //Podcasts::PodcastChannel methods - virtual QUrl url() const { return m_master->url(); } - virtual QUrl webLink() const { return m_master->webLink(); } - virtual bool hasImage() const { return m_master->hasImage(); } - virtual QUrl imageUrl() const { return m_master->imageUrl(); } - virtual QImage image() const { return m_master->image(); } - virtual QString copyright() const { return m_master->copyright(); } - virtual QStringList labels() const { return m_master->labels(); } - virtual QDate subscribeDate() const { return m_master->subscribeDate(); } + QUrl url() const override { return m_master->url(); } + QUrl webLink() const override { return m_master->webLink(); } + bool hasImage() const override { return m_master->hasImage(); } + QUrl imageUrl() const override { return m_master->imageUrl(); } + QImage image() const override { return m_master->image(); } + QString copyright() const override { return m_master->copyright(); } + QStringList labels() const override { return m_master->labels(); } + QDate subscribeDate() const override { return m_master->subscribeDate(); } - virtual void setUrl( const QUrl &url ) { m_master->setUrl( url ); } - virtual void setWebLink( const QUrl &link ) { m_master->setWebLink( link ); } - virtual void setImage( const QImage &image ) { m_master->setImage( image ); } - virtual void setImageUrl( const QUrl &imageUrl ) { m_master->setImageUrl( imageUrl ); } - virtual void setCopyright( const QString ©right ) { m_master->setCopyright( copyright ); } - virtual void setLabels( const QStringList &labels ) { m_master->setLabels( labels ); } - virtual void addLabel( const QString &label ) { m_master->addLabel( label ); } - virtual void setSubscribeDate( const QDate &date ) { m_master->setSubscribeDate( date ); } + void setUrl( const QUrl &url ) override { m_master->setUrl( url ); } + void setWebLink( const QUrl &link ) override { m_master->setWebLink( link ); } + void setImage( const QImage &image ) override { m_master->setImage( image ); } + void setImageUrl( const QUrl &imageUrl ) override { m_master->setImageUrl( imageUrl ); } + void setCopyright( const QString ©right ) override { m_master->setCopyright( copyright ); } + void setLabels( const QStringList &labels ) override { m_master->setLabels( labels ); } + void addLabel( const QString &label ) override { m_master->addLabel( label ); } + void setSubscribeDate( const QDate &date ) override { m_master->setSubscribeDate( date ); } - virtual Podcasts::PodcastEpisodePtr addEpisode( Podcasts::PodcastEpisodePtr episode ) + Podcasts::PodcastEpisodePtr addEpisode( const Podcasts::PodcastEpisodePtr &episode ) override { return m_master->addEpisode( episode ); } - virtual Podcasts::PodcastEpisodeList episodes() const { return m_master->episodes(); } + Podcasts::PodcastEpisodeList episodes() const override { return m_master->episodes(); } bool load( QTextStream &stream ) { return m_master->load( stream ); } diff --git a/src/playlistmanager/file/KConfigSyncRelStore.h b/src/playlistmanager/file/KConfigSyncRelStore.h --- a/src/playlistmanager/file/KConfigSyncRelStore.h +++ b/src/playlistmanager/file/KConfigSyncRelStore.h @@ -28,11 +28,11 @@ public: KConfigSyncRelStore(); - virtual ~KConfigSyncRelStore(); + ~KConfigSyncRelStore() override; - virtual void addSync( const Playlists::PlaylistPtr master, const Playlists::PlaylistPtr slave ); - virtual bool hasToSync( Playlists::PlaylistPtr master, Playlists::PlaylistPtr slave ) const; - virtual SyncedPlaylistPtr asSyncedPlaylist( const Playlists::PlaylistPtr playlist ); + void addSync( const Playlists::PlaylistPtr master, const Playlists::PlaylistPtr slave ) override; + bool hasToSync( Playlists::PlaylistPtr master, Playlists::PlaylistPtr slave ) const override; + SyncedPlaylistPtr asSyncedPlaylist( const Playlists::PlaylistPtr playlist ) override; private: KConfigGroup syncedPlaylistsConfig() const; diff --git a/src/playlistmanager/file/KConfigSyncRelStore.cpp b/src/playlistmanager/file/KConfigSyncRelStore.cpp --- a/src/playlistmanager/file/KConfigSyncRelStore.cpp +++ b/src/playlistmanager/file/KConfigSyncRelStore.cpp @@ -37,7 +37,7 @@ m_syncMasterMap.insert( masterUrl, SyncedPlaylistPtr() ); - foreach( const QString &value, syncedPlaylistsConfig().readEntry( key ).split( ',' ) ) + foreach( const QString &value, syncedPlaylistsConfig().readEntry( key ).split( QLatin1Char(',') ) ) { m_syncSlaveMap.insert( QUrl( value ), masterUrl ); } @@ -59,7 +59,7 @@ { DEBUG_BLOCK - debug() << QString("UIDurl: %1").arg( playlist->uidUrl().url() ); + debug() << QStringLiteral("UIDurl: %1").arg( playlist->uidUrl().url() ); SyncedPlaylistPtr syncedPlaylist; @@ -89,7 +89,7 @@ inline KConfigGroup KConfigSyncRelStore::syncedPlaylistsConfig() const { - return Amarok::config( "Synchronized Playlists" ); + return Amarok::config( QStringLiteral("Synchronized Playlists") ); } void diff --git a/src/playlistmanager/file/PlaylistFileProvider.h b/src/playlistmanager/file/PlaylistFileProvider.h --- a/src/playlistmanager/file/PlaylistFileProvider.h +++ b/src/playlistmanager/file/PlaylistFileProvider.h @@ -38,28 +38,28 @@ PlaylistFileProvider(); virtual ~PlaylistFileProvider(); - virtual QString prettyName() const; - virtual QIcon icon() const; + QString prettyName() const override; + QIcon icon() const override; - virtual int category() const { return Playlists::UserPlaylist; } + int category() const override { return Playlists::UserPlaylist; } - virtual int playlistCount() const; - virtual Playlists::PlaylistList playlists(); + int playlistCount() const override; + Playlists::PlaylistList playlists() override; /** * Returns a Playlists::PlaylistPtr to the new playlist, NULL if something failed. * @param tracks Tracks being added to that new playlist. * @param name File name of the new playlist. If no extension is being given we * default to xspf. '/' and '\' are being replaced by '-'. */ - virtual Playlists::PlaylistPtr save( const Meta::TrackList &tracks, - const QString &name = QString() ); + Playlists::PlaylistPtr save( const Meta::TrackList &tracks, + const QString &name = QString() ) override; virtual bool import( const QUrl &path ); - virtual bool isWritable() { return true; } - virtual void renamePlaylist( Playlists::PlaylistPtr playlist, const QString &newName ); - virtual bool deletePlaylists( const Playlists::PlaylistList &playlists ); + bool isWritable() override { return true; } + void renamePlaylist(Playlists::PlaylistPtr playlist, const QString &newName ) override; + bool deletePlaylists( const Playlists::PlaylistList &playlists ) override; /* PlaylistFileProvider methods */ /** Schedules a PlaylistFile to be saved on the next iteration of the mainloop. diff --git a/src/playlistmanager/file/PlaylistFileProvider.cpp b/src/playlistmanager/file/PlaylistFileProvider.cpp --- a/src/playlistmanager/file/PlaylistFileProvider.cpp +++ b/src/playlistmanager/file/PlaylistFileProvider.cpp @@ -20,7 +20,7 @@ #include "core/support/Amarok.h" #include "core/support/Debug.h" #include "core/support/Components.h" -#include "core/interfaces/Logger.h" +#include "core/logger/Logger.h" #include "core-impl/playlists/types/file/asx/ASXPlaylist.h" #include "core-impl/playlists/types/file/m3u/M3UPlaylist.h" #include "core-impl/playlists/types/file/pls/PLSPlaylist.h" @@ -54,19 +54,19 @@ { QUrl url( key ); //Don't load these from the config file, they are read from the directory anyway - if( KIO::upUrl(url).matches( QUrl::fromUserInput(Amarok::saveLocation("playlists")), QUrl::StripTrailingSlash ) ) + if( KIO::upUrl(url).matches( QUrl::fromUserInput(Amarok::saveLocation(QStringLiteral("playlists"))), QUrl::StripTrailingSlash ) ) continue; m_urlsToLoad << url; } //also add all files in the $KDEHOME/share/apps/amarok/playlists - QDir playlistDir = QDir( Amarok::saveLocation( "playlists" ), "", + QDir playlistDir = QDir( Amarok::saveLocation( QStringLiteral("playlists") ), QLatin1String(""), QDir::Name, QDir::Files | QDir::Readable ); foreach( const QString &file, playlistDir.entryList() ) { QUrl url( playlistDir.path() ); url = url.adjusted(QUrl::StripTrailingSlash); - url.setPath(url.path() + '/' + ( file )); + url.setPath(url.path() + QLatin1Char('/') + ( file )); if( Playlists::isPlaylist( url ) ) m_urlsToLoad << url; } @@ -82,7 +82,7 @@ { QUrl url = playlistFile->uidUrl(); //only save files NOT in "playlists", those are automatically loaded. - if( KIO::upUrl(url).matches( QUrl::fromUserInput(Amarok::saveLocation( "playlists" )), QUrl::StripTrailingSlash ) ) + if( KIO::upUrl(url).matches( QUrl::fromUserInput(Amarok::saveLocation( QStringLiteral("playlists") )), QUrl::StripTrailingSlash ) ) continue; //debug() << "storing to rc-file: " << url.url(); @@ -135,8 +135,8 @@ { DEBUG_BLOCK - QString filename = name.isEmpty() ? QDateTime::currentDateTime().toString( "ddd MMMM d yy hh-mm") : name; - filename.replace( '/', QLatin1Char('-') ); + QString filename = name.isEmpty() ? QDateTime::currentDateTime().toString( QStringLiteral("ddd MMMM d yy hh-mm")) : name; + filename.replace( QLatin1Char('/'), QLatin1Char('-') ); filename.replace( QLatin1Char('\\'), QLatin1Char('-') ); Playlists::PlaylistFormat format = Playlists::getFormat( QUrl::fromUserInput(filename) ); @@ -146,9 +146,9 @@ filename.append( QLatin1String( ".xspf" ) ); } - QUrl path( Amarok::saveLocation( "playlists" ) ); + QUrl path( Amarok::saveLocation( QStringLiteral("playlists") ) ); path = path.adjusted(QUrl::StripTrailingSlash); - path.setPath(path.path() + '/' + ( Amarok::vfatPath( filename ) )); + path.setPath(path.path() + QLatin1Char('/') + ( Amarok::vfatPath( filename ) )); if( QFileInfo( path.toLocalFile() ).exists() ) { //TODO:request overwrite @@ -187,7 +187,7 @@ m_playlistsLoaded = true; Playlists::PlaylistPtr playlist( playlistFile ); - emit playlistAdded( playlist ); + Q_EMIT playlistAdded( playlist ); return playlist; } @@ -231,12 +231,12 @@ //just in case there wasn't one loaded before. m_playlistsLoaded = true; - emit playlistAdded( PlaylistPtr( playlistFile.data() ) ); + Q_EMIT playlistAdded( PlaylistPtr( playlistFile.data() ) ); return true; } void -PlaylistFileProvider::renamePlaylist( Playlists::PlaylistPtr playlist, const QString &newName ) +PlaylistFileProvider::renamePlaylist(PlaylistPtr playlist, const QString &newName ) { DEBUG_BLOCK playlist->setName( newName ); @@ -264,7 +264,7 @@ m_playlists.removeAll( playlistFile ); loadedPlaylistsConfig().deleteEntry( playlistFile->uidUrl().url() ); QFile::remove( playlistFile->uidUrl().path() ); - emit playlistRemoved( Playlists::PlaylistPtr::dynamicCast( playlistFile ) ); + Q_EMIT playlistRemoved( Playlists::PlaylistPtr::dynamicCast( playlistFile ) ); } loadedPlaylistsConfig().sync(); @@ -285,18 +285,18 @@ Playlists::PlaylistFilePtr playlist = Playlists::loadPlaylistFile( url, this ); if( !playlist ) { - Amarok::Components::logger()->longMessage( + Amarok::Logger::longMessage( i18n("The playlist file \"%1\" could not be loaded.", url.fileName() ), Amarok::Logger::Error ); continue; } if( !groups.isEmpty() && playlist->isWritable() ) - playlist->setGroups( groups.split( ',', QString::SkipEmptyParts ) ); + playlist->setGroups( groups.split( QLatin1Char(','), QString::SkipEmptyParts ) ); m_playlists << playlist; - emit playlistAdded( PlaylistPtr( playlist.data() ) ); + Q_EMIT playlistAdded( PlaylistPtr( playlist.data() ) ); } //give the mainloop time to run @@ -339,7 +339,7 @@ KConfigGroup PlaylistFileProvider::loadedPlaylistsConfig() const { - return Amarok::config( "Loaded Playlist Files" ); + return Amarok::config( QStringLiteral("Loaded Playlist Files") ); } } //namespace Playlists diff --git a/src/playlistmanager/sql/SqlPlaylist.h b/src/playlistmanager/sql/SqlPlaylist.h --- a/src/playlistmanager/sql/SqlPlaylist.h +++ b/src/playlistmanager/sql/SqlPlaylist.h @@ -48,22 +48,22 @@ ~SqlPlaylist(); /* Playlist virtual functions */ - virtual QUrl uidUrl() const; - virtual QString name() const { return m_name; } + QUrl uidUrl() const override; + QString name() const override { return m_name; } - virtual PlaylistProvider *provider() const { return m_provider; } + PlaylistProvider *provider() const override { return m_provider; } - virtual void setName( const QString &name ); + void setName( const QString &name ) override; - virtual QStringList groups(); - void setGroups( const QStringList &groups ); + QStringList groups() override; + void setGroups( const QStringList &groups ) override; - virtual int trackCount() const; - virtual Meta::TrackList tracks(); - virtual void triggerTrackLoad(); + int trackCount() const override; + Meta::TrackList tracks() override; + void triggerTrackLoad() override; - virtual void addTrack( Meta::TrackPtr track, int position = -1 ); - virtual void removeTrack( int position ); + void addTrack( const Meta::TrackPtr &track, int position = -1 ) override; + void removeTrack( int position ) override; // SqlPlaylist-specific methods bool saveToDb( bool tracks = true ); diff --git a/src/playlistmanager/sql/SqlPlaylist.cpp b/src/playlistmanager/sql/SqlPlaylist.cpp --- a/src/playlistmanager/sql/SqlPlaylist.cpp +++ b/src/playlistmanager/sql/SqlPlaylist.cpp @@ -64,7 +64,7 @@ QUrl SqlPlaylist::uidUrl() const { - return QUrl( QString( "amarok-sqlplaylistuid://%1").arg( m_dbId ) ); + return QUrl( QStringLiteral( "amarok-sqlplaylistuid://%1").arg( m_dbId ) ); } QStringList @@ -110,7 +110,7 @@ debug() << "Checking " << m_urlId << " against db"; //check if urlId exists - QString query = "SELECT id from playlists WHERE urlid='%1'"; + QString query = QStringLiteral("SELECT id from playlists WHERE urlid='%1'"); query = query.arg( sql->escape( m_urlId ) ); QStringList result = sql->query( query ); @@ -125,16 +125,16 @@ if( m_dbId != -1 ) { //update existing - QString query = "UPDATE playlists SET parent_id=%1, name='%2' WHERE id=%3;"; - query = query.arg( QString::number( parentId ) ) - .arg( sql->escape( m_name ) ) - .arg( QString::number( m_dbId ) ); + QString query = QStringLiteral("UPDATE playlists SET parent_id=%1, name='%2' WHERE id=%3;"); + query = query.arg( QString::number( parentId ), + sql->escape( m_name ), + QString::number( m_dbId ) ); StorageManager::instance()->sqlStorage()->query( query ); if( tracks ) { //delete existing tracks and insert all - query = "DELETE FROM playlist_tracks where playlist_id=%1;"; + query = QStringLiteral("DELETE FROM playlist_tracks where playlist_id=%1;"); query = query.arg( QString::number( m_dbId ) ); StorageManager::instance()->sqlStorage()->query( query ); saveTracks(); @@ -145,10 +145,10 @@ //insert new QString query = "INSERT INTO playlists ( parent_id, name, urlid ) " "VALUES ( %1, '%2', '%3' );"; - query = query.arg( QString::number( parentId ) ) - .arg( sql->escape( m_name ) ) - .arg( sql->escape( m_urlId ) ); - m_dbId = StorageManager::instance()->sqlStorage()->insert( query, "playlists" ); + query = query.arg( QString::number( parentId ), + sql->escape( m_name ), + sql->escape( m_urlId ) ); + m_dbId = StorageManager::instance()->sqlStorage()->insert( query, QStringLiteral("playlists") ); if( tracks ) saveTracks(); } @@ -187,11 +187,11 @@ query = query.arg( QString::number( m_dbId ), QString::number( trackNum ), sql->escape( trackPtr->uidUrl() ), sql->escape( trackPtr->prettyName() ), - trackPtr->album() ? sql->escape( trackPtr->album()->prettyName() ) : "", - trackPtr->artist()? sql->escape( trackPtr->artist()->prettyName() ) : "", + trackPtr->album() ? sql->escape( trackPtr->album()->prettyName() ) : QLatin1String(""), + trackPtr->artist()? sql->escape( trackPtr->artist()->prettyName() ) : QLatin1String(""), QString::number( trackPtr->length() ), sql->escape( trackPtr->uidUrl() ) ); - sql->insert( query, "playlist_tracks" ); + sql->insert( query, QStringLiteral("playlist_tracks") ); trackNum++; } @@ -222,7 +222,7 @@ } void -SqlPlaylist::addTrack( Meta::TrackPtr track, int position ) +SqlPlaylist::addTrack(const Meta::TrackPtr &track, int position ) { if( !m_tracksLoaded ) loadTracks(); @@ -286,11 +286,11 @@ void SqlPlaylist::removeFromDb() { - QString query = "DELETE FROM playlist_tracks WHERE playlist_id=%1"; + QString query = QStringLiteral("DELETE FROM playlist_tracks WHERE playlist_id=%1"); query = query.arg( QString::number( m_dbId ) ); StorageManager::instance()->sqlStorage()->query( query ); - query = "DELETE FROM playlists WHERE id=%1"; + query = QStringLiteral("DELETE FROM playlists WHERE id=%1"); query = query.arg( QString::number( m_dbId ) ); StorageManager::instance()->sqlStorage()->query( query ); } diff --git a/src/playlistmanager/sql/SqlPlaylistGroup.h b/src/playlistmanager/sql/SqlPlaylistGroup.h --- a/src/playlistmanager/sql/SqlPlaylistGroup.h +++ b/src/playlistmanager/sql/SqlPlaylistGroup.h @@ -39,9 +39,9 @@ { public: SqlPlaylistGroup( const QStringList &dbResultRow, - SqlPlaylistGroupPtr parent, PlaylistProvider *provider ); + const SqlPlaylistGroupPtr &parent, PlaylistProvider *provider ); SqlPlaylistGroup( const QString &name, - SqlPlaylistGroupPtr parent, PlaylistProvider *provider ); + const SqlPlaylistGroupPtr &parent, PlaylistProvider *provider ); ~SqlPlaylistGroup(); @@ -51,7 +51,7 @@ SqlPlaylistGroupPtr parent() const { return m_parent; } void setName( const QString &name ); - void setParent( Playlists::SqlPlaylistGroupPtr parent ); + void setParent( const Playlists::SqlPlaylistGroupPtr &parent ); void setDescription( const QString &description ); int id() const { return m_dbId; } diff --git a/src/playlistmanager/sql/SqlPlaylistGroup.cpp b/src/playlistmanager/sql/SqlPlaylistGroup.cpp --- a/src/playlistmanager/sql/SqlPlaylistGroup.cpp +++ b/src/playlistmanager/sql/SqlPlaylistGroup.cpp @@ -25,7 +25,7 @@ namespace Playlists { SqlPlaylistGroup::SqlPlaylistGroup( const QStringList & dbResultRow, - SqlPlaylistGroupPtr parent, + const SqlPlaylistGroupPtr &parent, PlaylistProvider *provider ) : m_hasFetchedChildGroups( false ) , m_hasFetchedChildPlaylists( false ) @@ -38,7 +38,7 @@ } SqlPlaylistGroup::SqlPlaylistGroup( const QString & name, - SqlPlaylistGroupPtr parent, + const SqlPlaylistGroupPtr &parent, PlaylistProvider *provider ) : m_dbId( -1 ) , m_hasFetchedChildGroups( false ) @@ -69,19 +69,19 @@ if ( m_dbId != -1 ) { //update existing - QString query = "UPDATE playlist_groups SET parent_id=%1, name='%2', \ - description='%3' WHERE id=%4;"; + QString query = QStringLiteral("UPDATE playlist_groups SET parent_id=%1, name='%2', \ + description='%3' WHERE id=%4;"); query = query.arg( QString::number( parentId ), m_name, m_description, QString::number( m_dbId ) ); sqlStorage->query( query ); } else { //insert new - QString query = "INSERT INTO playlist_groups ( parent_id, name, \ - description) VALUES ( %1, '%2', '%3' );"; + QString query = QStringLiteral("INSERT INTO playlist_groups ( parent_id, name, \ + description) VALUES ( %1, '%2', '%3' );"); query = query.arg( QString::number( parentId ), m_name, m_description ); - m_dbId = sqlStorage->insert( query, NULL ); + m_dbId = sqlStorage->insert( query, nullptr ); } } @@ -107,7 +107,7 @@ return; - QString query = "DELETE FROM playlist_groups where id=%1;"; + QString query = QStringLiteral("DELETE FROM playlist_groups where id=%1;"); query = query.arg( QString::number( m_dbId ) ); QStringList result = sqlStorage->query( query ); } @@ -126,7 +126,7 @@ } void -SqlPlaylistGroup::setParent( SqlPlaylistGroupPtr parent ) +SqlPlaylistGroup::setParent( const SqlPlaylistGroupPtr &parent ) { if( parent ) m_parent = SqlPlaylistGroupPtr::staticCast( parent ); @@ -145,8 +145,8 @@ if ( !m_hasFetchedChildGroups ) { - QString query = "SELECT id, parent_id, name, description FROM \ - playlist_groups where parent_id=%1 ORDER BY name;"; + QString query = QStringLiteral("SELECT id, parent_id, name, description FROM \ + playlist_groups where parent_id=%1 ORDER BY name;"); query = query.arg( QString::number( m_dbId ) ); QStringList result = sqlStorage->query( query ); @@ -177,8 +177,8 @@ if ( !m_hasFetchedChildPlaylists ) { - QString query = "SELECT id, parent_id, name, urlid FROM \ - playlists where parent_id=%1 ORDER BY name;"; + QString query = QStringLiteral("SELECT id, parent_id, name, urlid FROM \ + playlists where parent_id=%1 ORDER BY name;"); query = query.arg( QString::number( m_dbId ) ); QStringList result = sqlStorage->query( query ); diff --git a/src/playlistmanager/sql/SqlUserPlaylistProvider.h b/src/playlistmanager/sql/SqlUserPlaylistProvider.h --- a/src/playlistmanager/sql/SqlUserPlaylistProvider.h +++ b/src/playlistmanager/sql/SqlUserPlaylistProvider.h @@ -25,7 +25,6 @@ #include -class QAction; namespace Playlists { @@ -42,20 +41,20 @@ ~SqlUserPlaylistProvider(); /* PlaylistProvider functions */ - virtual QString prettyName() const { return i18n( "Amarok Database" ); } + QString prettyName() const override { return i18n( "Amarok Database" ); } virtual QString description() const { return i18n( "Local playlists stored in the database" ); } - virtual QIcon icon() const { return QIcon::fromTheme( "server-database" ); } + QIcon icon() const override { return QIcon::fromTheme( QStringLiteral("server-database") ); } - virtual int playlistCount() const; - virtual Playlists::PlaylistList playlists(); + int playlistCount() const override; + Playlists::PlaylistList playlists() override; virtual Playlists::PlaylistPtr save( const Meta::TrackList &tracks ); - virtual Playlists::PlaylistPtr save( const Meta::TrackList &tracks, const QString& name ); + Playlists::PlaylistPtr save( const Meta::TrackList &tracks, const QString& name ) override; /* UserPlaylistProvider functions */ - virtual bool isWritable(); - virtual bool deletePlaylists( const Playlists::PlaylistList &playlistlist ); - virtual void renamePlaylist( Playlists::PlaylistPtr playlist, const QString &newName ); + bool isWritable() override; + bool deletePlaylists( const Playlists::PlaylistList &playlistlist ) override; + void renamePlaylist(Playlists::PlaylistPtr playlist, const QString &newName ) override; Playlists::SqlPlaylistGroupPtr group( const QString &name ); diff --git a/src/playlistmanager/sql/SqlUserPlaylistProvider.cpp b/src/playlistmanager/sql/SqlUserPlaylistProvider.cpp --- a/src/playlistmanager/sql/SqlUserPlaylistProvider.cpp +++ b/src/playlistmanager/sql/SqlUserPlaylistProvider.cpp @@ -42,7 +42,7 @@ static const int USERPLAYLIST_DB_VERSION = 3; // a database updater has been added in checkTables(). Use that when updating db version -static const QString key("AMAROK_USERPLAYLIST"); +static const QString key(QStringLiteral("AMAROK_USERPLAYLIST")); namespace Playlists { @@ -77,7 +77,7 @@ } void -SqlUserPlaylistProvider::renamePlaylist( Playlists::PlaylistPtr playlist, const QString &newName ) +SqlUserPlaylistProvider::renamePlaylist(PlaylistPtr playlist, const QString &newName ) { playlist->setName( newName.trimmed() ); } @@ -112,7 +112,7 @@ { debug() << "deleting " << sqlPlaylist->name(); m_root->m_childPlaylists.removeAll( sqlPlaylist ); - emit playlistRemoved( Playlists::PlaylistPtr::dynamicCast( sqlPlaylist ) ); + Q_EMIT playlistRemoved( Playlists::PlaylistPtr::dynamicCast( sqlPlaylist ) ); sqlPlaylist->removeFromDb(); } } @@ -141,16 +141,16 @@ m_root->m_childPlaylists << sqlPlaylist; Playlists::PlaylistPtr playlist( sqlPlaylist.data() ); - emit playlistAdded( playlist ); + Q_EMIT playlistAdded( playlist ); return playlist; // assumes insertion in db was successful! } void SqlUserPlaylistProvider::reloadFromDb() { DEBUG_BLOCK; m_root->clear(); - emit updated(); + Q_EMIT updated(); } Playlists::SqlPlaylistGroupPtr @@ -198,15 +198,15 @@ ", parent_id INTEGER" ", name " + sqlStorage->textColumnType() + ", description " + sqlStorage->textColumnType() + " ) ENGINE = MyISAM;" ) ); - sqlStorage->query( "CREATE INDEX parent_podchannel ON playlist_groups( parent_id );" ); + sqlStorage->query( QStringLiteral("CREATE INDEX parent_podchannel ON playlist_groups( parent_id );") ); sqlStorage->query( QString( "CREATE TABLE playlists (" " id " + sqlStorage->idType() + ", parent_id INTEGER" ", name " + sqlStorage->textColumnType() + ", urlid " + sqlStorage->exactTextColumnType() + " ) ENGINE = MyISAM;" ) ); - sqlStorage->query( "CREATE INDEX parent_playlist ON playlists( parent_id );" ); + sqlStorage->query( QStringLiteral("CREATE INDEX parent_playlist ON playlists( parent_id );") ); sqlStorage->query( QString( "CREATE TABLE playlist_tracks (" " id " + sqlStorage->idType() + @@ -219,8 +219,8 @@ ", length INTEGER " ", uniqueid " + sqlStorage->textColumnType(128) + ") ENGINE = MyISAM;" ) ); - sqlStorage->query( "CREATE INDEX parent_playlist_tracks ON playlist_tracks( playlist_id );" ); - sqlStorage->query( "CREATE INDEX playlist_tracks_uniqueid ON playlist_tracks( uniqueid );" ); + sqlStorage->query( QStringLiteral("CREATE INDEX parent_playlist_tracks ON playlist_tracks( playlist_id );") ); + sqlStorage->query( QStringLiteral("CREATE INDEX playlist_tracks_uniqueid ON playlist_tracks( uniqueid );") ); } void @@ -236,14 +236,14 @@ return; } - sqlStorage->query( "DROP INDEX parent_podchannel ON playlist_groups;" ); - sqlStorage->query( "DROP INDEX parent_playlist ON playlists;" ); - sqlStorage->query( "DROP INDEX parent_playlist_tracks ON playlist_tracks;" ); - sqlStorage->query( "DROP INDEX playlist_tracks_uniqueid ON playlist_tracks;" ); + sqlStorage->query( QStringLiteral("DROP INDEX parent_podchannel ON playlist_groups;") ); + sqlStorage->query( QStringLiteral("DROP INDEX parent_playlist ON playlists;") ); + sqlStorage->query( QStringLiteral("DROP INDEX parent_playlist_tracks ON playlist_tracks;") ); + sqlStorage->query( QStringLiteral("DROP INDEX playlist_tracks_uniqueid ON playlist_tracks;") ); - sqlStorage->query( "DROP TABLE IF EXISTS playlist_groups;" ); - sqlStorage->query( "DROP TABLE IF EXISTS playlists;" ); - sqlStorage->query( "DROP TABLE IF EXISTS playlist_tracks;" ); + sqlStorage->query( QStringLiteral("DROP TABLE IF EXISTS playlist_groups;") ); + sqlStorage->query( QStringLiteral("DROP TABLE IF EXISTS playlists;") ); + sqlStorage->query( QStringLiteral("DROP TABLE IF EXISTS playlist_tracks;") ); } @@ -259,7 +259,7 @@ if ( !sqlStorage ) return; - values = sqlStorage->query( QString("SELECT version FROM admin WHERE component = '%1';").arg(sqlStorage->escape( key ) ) ); + values = sqlStorage->query( QStringLiteral("SELECT version FROM admin WHERE component = '%1';").arg(sqlStorage->escape( key ) ) ); if( values.isEmpty() ) { @@ -299,7 +299,7 @@ { DEBUG_BLOCK auto sqlStorage = StorageManager::instance()->sqlStorage(); - sqlStorage->query( "ALTER TABLE playlists DROP COLUMN description" ); + sqlStorage->query( QStringLiteral("ALTER TABLE playlists DROP COLUMN description") ); } Playlists::SqlPlaylistList diff --git a/src/scanner/AbstractDirectoryWatcher.h b/src/scanner/AbstractDirectoryWatcher.h --- a/src/scanner/AbstractDirectoryWatcher.h +++ b/src/scanner/AbstractDirectoryWatcher.h @@ -57,17 +57,18 @@ public: AbstractDirectoryWatcher(); - void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) Q_DECL_OVERRIDE; - void abort(); + void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) override; + void requestAbort() override; /** Pauses the emitting of the scan signal */ void setBlockScanning( bool block ); Q_SIGNALS: /** Requests the scanner to do an incremental scan. * The incremental scan will check for new files or sub-folders. - * @param directory The directory to scan or and empty string if every + * @param directories The directories to scan or and empty string if every * collection folder should be checked for changes. + * @param type The type of the scan. */ void requestScan( QList directories, GenericScanManager::ScanType type ); /** This signal is emitted when this job is being processed by a thread. */ @@ -88,8 +89,8 @@ /** Adds the given directory to the list of directories for the next scan. */ void addDirToList( const QString &directory ); - void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; - void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; + void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; + void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; QTimer* m_delayedScanTimer; KDirWatch *m_watcher; diff --git a/src/scanner/AbstractDirectoryWatcher.cpp b/src/scanner/AbstractDirectoryWatcher.cpp --- a/src/scanner/AbstractDirectoryWatcher.cpp +++ b/src/scanner/AbstractDirectoryWatcher.cpp @@ -82,7 +82,7 @@ { urls.append( QUrl::fromLocalFile( path ) ); } - emit requestScan( urls, GenericScanManager::PartialUpdateScan ); + Q_EMIT requestScan( urls, GenericScanManager::PartialUpdateScan ); m_watcher->startScan( true ); } @@ -138,7 +138,7 @@ } void -AbstractDirectoryWatcher::abort() +AbstractDirectoryWatcher::requestAbort() { DEBUG_BLOCK @@ -167,7 +167,7 @@ if( m_scanDirsRequested.isEmpty() ) return; - emit requestScan( m_scanDirsRequested.toList(), GenericScanManager::PartialUpdateScan ); + Q_EMIT requestScan( m_scanDirsRequested.toList(), GenericScanManager::PartialUpdateScan ); m_scanDirsRequested.clear(); } diff --git a/src/scanner/AbstractScanResultProcessor.h b/src/scanner/AbstractScanResultProcessor.h --- a/src/scanner/AbstractScanResultProcessor.h +++ b/src/scanner/AbstractScanResultProcessor.h @@ -53,7 +53,7 @@ Q_OBJECT public: - AbstractScanResultProcessor( GenericScanManager* manager, QObject* parent = 0 ); + explicit AbstractScanResultProcessor( GenericScanManager* manager, QObject* parent = nullptr ); virtual ~AbstractScanResultProcessor(); Q_SIGNALS: diff --git a/src/scanner/AbstractScanResultProcessor.cpp b/src/scanner/AbstractScanResultProcessor.cpp --- a/src/scanner/AbstractScanResultProcessor.cpp +++ b/src/scanner/AbstractScanResultProcessor.cpp @@ -25,7 +25,7 @@ #include "collectionscanner/Directory.h" #include "collectionscanner/Playlist.h" #include "collectionscanner/Track.h" -#include "core/interfaces/Logger.h" +#include "core/logger/Logger.h" #include "core/support/Debug.h" #include "core/support/Components.h" #include "core-impl/collections/support/ArtistHelper.h" @@ -62,28 +62,27 @@ m_type = type; // -- show the progress operation for the job - if( Amarok::Components::logger() ) - Amarok::Components::logger()->newProgressOperation( this, - i18n( "Scanning music" ), - 100, - this, - SLOT(abort()) ); + Amarok::Logger::newProgressOperation( this, + i18n( "Scanning music" ), + 100, + this, + &AbstractScanResultProcessor::abort ); } void AbstractScanResultProcessor::scanDirectoryCount( int count ) { // message( i18np("Found one directory", "Found %1 directories", count ) ); debug() << "got" << count << "directories"; - emit totalSteps( count * 2 ); + Q_EMIT totalSteps( count * 2 ); } void AbstractScanResultProcessor::scanDirectoryScanned( QSharedPointer dir ) { m_directories.append( dir ); - emit incrementProgress(); + Q_EMIT incrementProgress(); } void @@ -97,13 +96,13 @@ if( nonCompilationAlbumNames.isEmpty() ) { nonCompilationAlbumNames - << "" // don't throw together albums without name. At least not here - << "Best Of" - << "Anthology" - << "Hit collection" - << "Greatest Hits" - << "All Time Greatest Hits" - << "Live"; + << QLatin1String("") // don't throw together albums without name. At least not here + << QStringLiteral("Best Of") + << QStringLiteral("Anthology") + << QStringLiteral("Hit collection") + << QStringLiteral("Greatest Hits") + << QStringLiteral("All Time Greatest Hits") + << QStringLiteral("Live"); } // -- commit the directories @@ -145,7 +144,7 @@ // --- add all albums QList keys = m_albumNames.uniqueKeys(); - emit totalSteps( m_directories.count() + keys.count() ); // update progress bar + Q_EMIT totalSteps( m_directories.count() + keys.count() ); // update progress bar foreach( const QString &key, keys ) { // --- commit the albums as compilation or normal album @@ -202,7 +201,7 @@ commitAlbum( albums.takeFirst() ); } - emit incrementProgress(); + Q_EMIT incrementProgress(); } // -- now check if some of the tracks are not longer used and also not moved to another directory @@ -214,16 +213,16 @@ deleteDeletedDirectories(); cleanupMembers(); - emit endProgressOperation( this ); + Q_EMIT endProgressOperation( this ); } void AbstractScanResultProcessor::scanFailed( const QString& text ) { message( text ); cleanupMembers(); - emit endProgressOperation( this ); + Q_EMIT endProgressOperation( this ); } void @@ -252,19 +251,15 @@ // debug() << "commitPlaylist on " << playlist->path(); if( The::playlistManager() ) - The::playlistManager()->import( "file:"+playlist.path() ); + The::playlistManager()->import( QUrl::fromLocalFile( playlist.path() ) ); } -/** This will just put the tracks into an album. - @param album the name of the target album - @returns true if the track was put into an album -*/ CollectionScanner::Album* AbstractScanResultProcessor::sortTrack( CollectionScanner::Track *track, const QString &dirName ) { QString albumName = track->album(); - // we allow albums with empty name and nonepty artist, see bug 272471 + // we allow albums with empty name and nonempty artist, see bug 272471 QString albumArtist = track->albumArtist(); if( track->isCompilation() ) albumArtist.clear(); // no album artist denotes a compilation diff --git a/src/scanner/GenericScanManager.h b/src/scanner/GenericScanManager.h --- a/src/scanner/GenericScanManager.h +++ b/src/scanner/GenericScanManager.h @@ -48,7 +48,7 @@ { Q_OBJECT public: - explicit GenericScanManager( QObject* parent = 0 ); + explicit GenericScanManager( QObject* parent = nullptr ); virtual ~GenericScanManager(); /** The scan mode. @@ -130,10 +130,10 @@ void directoryCount( int count ); /** Emitted once we get the complete data for a directory. - * @dir The directory structure with all containing tracks. + * @param dir The directory structure with all containing tracks. * * The dir pointer will stay valid until after the done signal. - * Be carefull, you need to have direct connections to + * Be careful, you need to have direct connections to * ensure that you don't access the pointer before it's being freed. * That also means that your slots are called within the job context. */ diff --git a/src/scanner/GenericScannerJob.h b/src/scanner/GenericScannerJob.h --- a/src/scanner/GenericScannerJob.h +++ b/src/scanner/GenericScannerJob.h @@ -62,25 +62,27 @@ public: /** Creates the parse job. The constructor itself should be called from the UI thread. + @param manager The scan manager. @param input An input io device for the scanner. The input must remain valid as long as the scanner is working (TODO: is this smart?) + @param type The scan type. @see GenericScanManager::ScanType */ GenericScannerJob( GenericScanManager* manager, QIODevice *input, GenericScanManager::ScanType type ); GenericScannerJob( GenericScanManager* manager, - QStringList scanDirsRequested, + const QStringList &scanDirsRequested, GenericScanManager::ScanType type, bool recursive = true, bool detectCharset = false ); - ~GenericScannerJob(); + ~GenericScannerJob() override; /* ThreadWeaver::Job virtual methods */ - void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) Q_DECL_OVERRIDE; + void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = nullptr) override; virtual void abort(); - void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; - void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; + void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; + void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; Q_SIGNALS: void started( GenericScanManager::ScanType type ); diff --git a/src/scanner/GenericScannerJob.cpp b/src/scanner/GenericScannerJob.cpp --- a/src/scanner/GenericScannerJob.cpp +++ b/src/scanner/GenericScannerJob.cpp @@ -40,19 +40,19 @@ static const int SHARED_MEMORY_SIZE = 1024 * 1024; // 1 MB shared memory GenericScannerJob::GenericScannerJob( GenericScanManager* manager, - QStringList scanDirsRequested, + const QStringList &scanDirsRequested, GenericScanManager::ScanType type, bool recursive, bool detectCharset ) : QObject() , ThreadWeaver::Job( ) , m_manager( manager ) , m_type( type ) , m_scanDirsRequested( scanDirsRequested ) - , m_input( 0 ) + , m_input( nullptr ) , m_restartCount( 0 ) , m_abortRequested( false ) - , m_scanner( 0 ) - , m_scannerStateMemory( 0 ) + , m_scanner( nullptr ) + , m_scannerStateMemory( nullptr ) , m_recursive( recursive ) , m_charsetDetect( detectCharset ) { @@ -68,8 +68,8 @@ , m_input( input ) , m_restartCount( 0 ) , m_abortRequested( false ) - , m_scanner( 0 ) - , m_scannerStateMemory( 0 ) + , m_scanner( nullptr ) + , m_scannerStateMemory( nullptr ) , m_recursive( true ) , m_charsetDetect( false ) { @@ -103,7 +103,7 @@ return; } - emit started( m_type ); + Q_EMIT started( m_type ); // -- read the input and loop bool finished = false; @@ -115,7 +115,7 @@ if( m_abortRequested ) { debug() << "Aborting ScannerJob"; - emit failed( i18n( "Abort for scanner requested" ) ); + Q_EMIT failed( i18n( "Abort for scanner requested" ) ); closeScannerProcess(); return; } @@ -144,13 +144,13 @@ if( !finished && m_reader.hasError() ) { warning() << "Aborting ScannerJob with error" << m_reader.errorString(); - emit failed( i18n( "Aborting scanner with error: %1", m_reader.errorString() ) ); + Q_EMIT failed( i18n( "Aborting scanner with error: %1", m_reader.errorString() ) ); closeScannerProcess(); return; } else { - emit succeeded(); + Q_EMIT succeeded(); closeScannerProcess(); return; } @@ -189,7 +189,7 @@ QString path; if( overridePath.isEmpty() ) // Not running a test { - path = QStandardPaths::findExecutable( "amarokcollectionscanner" ); + path = QStandardPaths::findExecutable( QStringLiteral("amarokcollectionscanner") ); // TODO: Not sure this is still useful... // If the binary is not in $PATH, then search in the application folder too @@ -205,7 +205,7 @@ if( !QFile::exists( path ) ) { error() << "Cannot find amarokcollectionscanner! Check your install"; - emit failed( i18n( "Could not find amarokcollectionscanner!" ) ); + Q_EMIT failed( i18n( "Could not find amarokcollectionscanner!" ) ); return QString(); } return path; @@ -224,38 +224,38 @@ warning() << "Unable to create shared memory for collection scanner"; warning() << "Shared Memory error: " << m_scannerStateMemory->errorString(); delete m_scannerStateMemory; - m_scannerStateMemory = 0; + m_scannerStateMemory = nullptr; } } // -- create the scanner process KProcess *scanner = new KProcess(); //not parented since in a different thread scanner->setOutputChannelMode( KProcess::OnlyStdoutChannel ); // debug() << "creating options"; - *scanner << scannerPath() << "--idlepriority"; + *scanner << scannerPath() << QStringLiteral("--idlepriority"); if( m_type != GenericScanManager::FullScan ) // we don't need a batch file for a full scan m_batchfilePath = m_manager->getBatchFile( m_scanDirsRequested ); if( m_type != GenericScanManager::FullScan ) - *scanner << "-i"; + *scanner << QStringLiteral("-i"); if( !m_batchfilePath.isEmpty() ) - *scanner << "--batch" << m_batchfilePath; + *scanner << QStringLiteral("--batch") << m_batchfilePath; if( m_recursive ) - *scanner << "-r"; + *scanner << QStringLiteral("-r"); if( m_charsetDetect ) - *scanner << "-c"; + *scanner << QStringLiteral("-c"); if( restart ) - *scanner << "-s"; + *scanner << QStringLiteral("-s"); // debug() << "creating shared memory"; if( m_scannerStateMemory ) - *scanner << "--sharedmemory" << m_scannerStateMemory->key(); + *scanner << QStringLiteral("--sharedmemory") << m_scannerStateMemory->key(); *scanner << m_scanDirsRequested; @@ -266,7 +266,7 @@ delete scanner; warning() << "Unable to start Amarok collection scanner."; - emit failed( i18n("Unable to start Amarok collection scanner." ) ); + Q_EMIT failed( i18n("Unable to start Amarok collection scanner." ) ); return false; } // debug() << "finished"; @@ -306,7 +306,7 @@ // -- delete the old scanner delete m_scanner; - m_scanner = 0; + m_scanner = nullptr; if( m_restartCount >= MAX_RESTARTS ) { @@ -317,15 +317,15 @@ // TODO: this message doesn't seem to be propagated to the UI QString text = i18n( "The collection scan had to be aborted. Too many crashes (%1) " "were encountered during the scan. Following files caused the crashes:\n\n%2", - m_restartCount, badFiles.join( "\n" ) ); + m_restartCount, badFiles.join( QStringLiteral("\n") ) ); - emit failed( text ); + Q_EMIT failed( text ); return false; } createScannerProcess( true ); - return (m_scanner != 0); + return (m_scanner != nullptr); } void @@ -337,7 +337,7 @@ m_scanner->close(); m_scanner->waitForFinished(); // waits at most 3 seconds delete m_scanner; - m_scanner = 0; + m_scanner = nullptr; } @@ -364,14 +364,14 @@ QStringRef name = m_reader.name(); if( name == "scanner" ) { - int totalCount = m_reader.attributes().value( "count" ).toString().toInt(); - emit directoryCount( totalCount ); + int totalCount = m_reader.attributes().value( QStringLiteral("count") ).toString().toInt(); + Q_EMIT directoryCount( totalCount ); } else if( name == "directory" ) { QSharedPointer dir( new CollectionScanner::Directory( &m_reader ) ); - emit directoryScanned( dir ); + Q_EMIT directoryScanned( dir ); } else { @@ -402,19 +402,19 @@ QByteArray newData = m_scanner->readAll(); m_incompleteTagBuffer += newData; - int index = m_incompleteTagBuffer.lastIndexOf( "" ); + int index = m_incompleteTagBuffer.lastIndexOf( QLatin1String("") ); if( index >= 0 ) { - // append new data (we need to be locked. the reader is probalby not thread save) + // append new data (we need to be locked. the reader is probably not thread save) m_reader.addData( QString( m_incompleteTagBuffer.left( index + 10 ) ) ); m_incompleteTagBuffer = m_incompleteTagBuffer.mid( index + 10 ); } else { - index = m_incompleteTagBuffer.lastIndexOf( "" ); + index = m_incompleteTagBuffer.lastIndexOf( QLatin1String("") ); if( index >= 0 ) { - // append new data (we need to be locked. the reader is probalby not thread save) + // append new data (we need to be locked. the reader is probably not thread save) m_reader.addData( QString( m_incompleteTagBuffer.left( index + 12 ) ) ); m_incompleteTagBuffer = m_incompleteTagBuffer.mid( index + 12 ); } diff --git a/src/scripting/scriptconsole/CompletionModel.h b/src/scripting/scriptconsole/CompletionModel.h --- a/src/scripting/scriptconsole/CompletionModel.h +++ b/src/scripting/scriptconsole/CompletionModel.h @@ -22,24 +22,23 @@ namespace KTextEditor { class View; - class Document; } namespace ScriptConsoleNS { class AmarokScriptCodeCompletionModel : public KTextEditor::CodeCompletionModelControllerInterface , public KTextEditor::CodeCompletionModel { public: - AmarokScriptCodeCompletionModel( QObject *parent ); + explicit AmarokScriptCodeCompletionModel( QObject *parent ); virtual ~AmarokScriptCodeCompletionModel(); private: - QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const; - void completionInvoked( KTextEditor::View *view, const KTextEditor::Range &range, InvocationType invocationType ); - void executeCompletionItem( KTextEditor::View *view, const KTextEditor::Range &range, const QModelIndex &index ) const; - KTextEditor::Range completionRange( KTextEditor::View *view, const KTextEditor::Cursor &position ); - bool shouldAbortCompletion( KTextEditor::View *view, const KTextEditor::Range &range, const QString ¤tCompletion ); + QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const override; + void completionInvoked( KTextEditor::View *view, const KTextEditor::Range &range, InvocationType invocationType ) override; + void executeCompletionItem( KTextEditor::View *view, const KTextEditor::Range &range, const QModelIndex &index ) const override; + KTextEditor::Range completionRange( KTextEditor::View *view, const KTextEditor::Cursor &position ) override; + bool shouldAbortCompletion( KTextEditor::View *view, const KTextEditor::Range &range, const QString ¤tCompletion ) override; QStringList m_completionList; QStringList m_autoCompleteStrings; diff --git a/src/scripting/scriptconsole/CompletionModel.cpp b/src/scripting/scriptconsole/CompletionModel.cpp --- a/src/scripting/scriptconsole/CompletionModel.cpp +++ b/src/scripting/scriptconsole/CompletionModel.cpp @@ -29,8 +29,8 @@ AmarokScriptCodeCompletionModel::AmarokScriptCodeCompletionModel( QObject *parent ) : CodeCompletionModel( parent ) { - const QUrl url( QStandardPaths::locate( QStandardPaths::GenericDataLocation, "amarok/scriptconsole/" ) ); - QFile file( url.path() + "AutoComplete.txt" ); + const QUrl url( QStandardPaths::locate( QStandardPaths::GenericDataLocation, QStringLiteral("amarok/scriptconsole/") ) ); + QFile file( url.path() + QStringLiteral("AutoComplete.txt") ); if( file.open( QFile::ReadOnly ) ) { QTextStream in( &file ); @@ -52,7 +52,7 @@ foreach( const QString &completionItem, m_autoCompleteStrings ) { int index = completionItem.indexOf( currentText, Qt::CaseInsensitive ) + currentText.length(); - if( index != -1 && !QStringRef( &completionItem, index, completionItem.size()-index ).contains( '.' ) && completionItem != currentText ) + if( index != -1 && !QStringRef( &completionItem, index, completionItem.size()-index ).contains( QLatin1Char('.') ) && completionItem != currentText ) m_completionList << completionItem; } setRowCount( m_completionList.count() ); diff --git a/src/scripting/scriptconsole/ScriptConsole.h b/src/scripting/scriptconsole/ScriptConsole.h --- a/src/scripting/scriptconsole/ScriptConsole.h +++ b/src/scripting/scriptconsole/ScriptConsole.h @@ -20,19 +20,17 @@ #include #include #include -#include +#include #include namespace KTextEditor{ class Editor; - class View; } class QEvent; class QListWidget; class QListWidgetItem; class QModelIndex; class QScriptEngine; -class QSplitter; namespace ScriptConsoleNS { @@ -59,9 +57,9 @@ explicit ScriptConsole( QWidget *parent ); virtual ~ScriptConsole(); - bool eventFilter( QObject *watched, QEvent *event ); + bool eventFilter( QObject *watched, QEvent *event ) override; QDockWidget *getWidget( const QString &title, QScriptEngineDebugger::DebuggerWidget widget ); - void closeEvent( QCloseEvent *event ); + void closeEvent( QCloseEvent *event ) override; ScriptConsoleItem* createScriptItem( const QString &script ); QScriptEngineDebugger *m_debugger; @@ -78,7 +76,7 @@ Q_OBJECT public: - ScriptListDockWidget( QWidget *parent ); + explicit ScriptListDockWidget( QWidget *parent ); ~ScriptListDockWidget(); void addScript( ScriptConsoleItem *script ); void addItem( QListWidgetItem *item ); diff --git a/src/scripting/scriptconsole/ScriptConsole.cpp b/src/scripting/scriptconsole/ScriptConsole.cpp --- a/src/scripting/scriptconsole/ScriptConsole.cpp +++ b/src/scripting/scriptconsole/ScriptConsole.cpp @@ -62,7 +62,7 @@ m_editor = KTextEditor::Editor::instance(); if ( !m_editor ) { - KMessageBox::error( 0, i18n("A KDE text-editor component could not be found.\n" + KMessageBox::error( nullptr, i18n("A KDE text-editor component could not be found.\n" "Please check your KDE installation. Exiting the console!") ); deleteLater(); return; @@ -72,10 +72,10 @@ setDockNestingEnabled( true ); setWindowTitle( i18n( "Script Console" ) ); - setObjectName( "scriptconsole" ); + setObjectName( QStringLiteral("scriptconsole") ); m_debugger->setAutoShowStandardWindow( false ); - m_codeWidget = getWidget( "Code", QScriptEngineDebugger::CodeWidget ); + m_codeWidget = getWidget( QStringLiteral("Code"), QScriptEngineDebugger::CodeWidget ); addDockWidget( Qt::BottomDockWidgetArea, m_codeWidget ); QList debugWidgets = QList() << getWidget( i18n( "Console" ), QScriptEngineDebugger::ConsoleWidget ) << getWidget( i18n( "Error" ), QScriptEngineDebugger::ErrorLogWidget ) @@ -102,15 +102,15 @@ action->setIcon( QApplication::style()->standardIcon( QStyle::SP_MediaStop ) ); connect( action, &QAction::toggled, this, &ScriptConsole::slotAbortEvaluation ); toolBar->addAction( action ); - action = new QAction( QIcon::fromTheme( "media-playback-start" ), i18n("Execute Script"), this ); + action = new QAction( QIcon::fromTheme( QStringLiteral("media-playback-start") ), i18n("Execute Script"), this ); action->setShortcut( Qt::CTRL + Qt::Key_Enter ); connect( action, &QAction::triggered, this, &ScriptConsole::slotExecuteNewScript ); toolBar->addAction( action ); - action = new QAction( QIcon::fromTheme( "document-new" ), i18n( "&New Script" ), this ); + action = new QAction( QIcon::fromTheme( QStringLiteral("document-new") ), i18n( "&New Script" ), this ); action->setShortcut( Qt::CTRL + Qt::Key_N ); toolBar->addAction( action ); connect( action, &QAction::triggered, this, &ScriptConsole::slotNewScript ); - action = new QAction( QIcon::fromTheme( "edit-delete" ), i18n( "&Delete Script" ), this ); + action = new QAction( QIcon::fromTheme( QStringLiteral("edit-delete") ), i18n( "&Delete Script" ), this ); toolBar->addAction( action ); connect( action, &QAction::triggered, m_scriptListDock, &ScriptListDockWidget::removeCurrentScript ); action = new QAction( i18n( "&Clear All Scripts" ), this ); @@ -151,14 +151,14 @@ item->setFlags( Qt::NoItemFlags ); m_scriptListDock->addItem( item ); - QSettings settings( "KDE", "Amarok" ); - settings.beginGroup( "ScriptConsole" ); - restoreGeometry( settings.value("geometry").toByteArray() ); - m_savePath = settings.value("savepath").toString(); + QSettings settings( QStringLiteral("KDE"), QStringLiteral("Amarok") ); + settings.beginGroup( QStringLiteral("ScriptConsole") ); + restoreGeometry( settings.value(QStringLiteral("geometry")).toByteArray() ); + m_savePath = settings.value(QStringLiteral("savepath")).toString(); settings.endGroup(); if( m_savePath.isEmpty() ) - m_savePath = Amarok::saveLocation("scriptconsole"); + m_savePath = Amarok::saveLocation(QStringLiteral("scriptconsole")); slotNewScript(); connect( m_debugger, &QScriptEngineDebugger::evaluationSuspended, this, &ScriptConsole::slotEvaluationSuspended ); @@ -194,10 +194,10 @@ void ScriptConsole::closeEvent( QCloseEvent *event ) { - QSettings settings( "KDE", "Amarok" ); - settings.beginGroup( "ScriptConsole" ); - settings.setValue( "geometry", saveGeometry() ); - settings.setValue( "savepath", m_savePath ); + QSettings settings( QStringLiteral("KDE"), QStringLiteral("Amarok") ); + settings.beginGroup( QStringLiteral("ScriptConsole") ); + settings.setValue( QStringLiteral("geometry"), saveGeometry() ); + settings.setValue( QStringLiteral("savepath"), m_savePath ); settings.endGroup(); QMainWindow::closeEvent( event ); deleteLater(); @@ -207,7 +207,7 @@ ScriptConsole::slotEditScript( ScriptConsoleItem *item ) { if( m_scriptItem->running() && KMessageBox::warningContinueCancel( this, i18n( "This will stop this script! Continue?" ), QString(), KStandardGuiItem::cont() - , KStandardGuiItem::cancel(), "stopRunningScriptWarning" ) == KMessageBox::Cancel ) + , KStandardGuiItem::cancel(), QStringLiteral("stopRunningScriptWarning") ) == KMessageBox::Cancel ) return; item->pause(); @@ -218,22 +218,22 @@ ScriptConsole::createScriptItem( const QString &script ) { if( ( m_savePath.isEmpty() || !QDir( m_savePath ).exists() ) - && ( m_savePath = QFileDialog::getExistingDirectory(this, i18n( "Choose where to save your scripts" ), "~", + && ( m_savePath = QFileDialog::getExistingDirectory(this, i18n( "Choose where to save your scripts" ), QStringLiteral("~"), QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks) ).isEmpty() ) return 0; QString scriptPath; QString scriptName; do { - scriptName = QString( "Script-%1" ).arg( qrand() ); - scriptPath = QString( "%1/%2" ).arg( m_savePath, scriptName ); + scriptName = QStringLiteral( "Script-%1" ).arg( qrand() ); + scriptPath = QStringLiteral( "%1/%2" ).arg( m_savePath, scriptName ); } while ( QDir( scriptPath ).exists() ); QDir().mkdir( scriptPath ); ScriptEditorDocument *document = new ScriptEditorDocument( this, m_editor->createDocument( 0 ) ); document->setText( script ); - ScriptConsoleItem *scriptItem = new ScriptConsoleItem( this, scriptName, "Generic", scriptPath, document ); + ScriptConsoleItem *scriptItem = new ScriptConsoleItem( this, scriptName, QStringLiteral("Generic"), scriptPath, document ); return scriptItem; } @@ -311,7 +311,7 @@ void ScriptConsole::slotNewScript() { - ScriptConsoleItem *item = createScriptItem( "" ); + ScriptConsoleItem *item = createScriptItem( QLatin1String("") ); m_scriptListDock->addScript( item ); setCurrentScriptItem( item ); } @@ -385,19 +385,19 @@ ScriptListDockWidget::slotCurrentItemChanged( QListWidgetItem *newItem, QListWidgetItem *oldItem ) { Q_UNUSED( oldItem ) - emit currentItemChanged( newItem ? qvariant_cast( newItem->data(ScriptRole) ) : 0 ); + Q_EMIT currentItemChanged( newItem ? qvariant_cast( newItem->data(ScriptRole) ) : nullptr ); } void ScriptListDockWidget::slotDoubleClicked( const QModelIndex &index ) { - emit edit( qvariant_cast( index.data(ScriptRole) ) ); + Q_EMIT edit( qvariant_cast( index.data(ScriptRole) ) ); } void ScriptListDockWidget::clear() { - if( sender() && KMessageBox::warningContinueCancel( 0, i18n("Are you absolutely certain?") ) == KMessageBox::Cancel ) + if( sender() && KMessageBox::warningContinueCancel( nullptr, i18n("Are you absolutely certain?") ) == KMessageBox::Cancel ) return; for( int i = 0; icount(); ++i ) qvariant_cast( m_scriptListWidget->item( i )->data( ScriptRole ) )->deleteLater(); diff --git a/src/scripting/scriptconsole/ScriptConsoleItem.h b/src/scripting/scriptconsole/ScriptConsoleItem.h --- a/src/scripting/scriptconsole/ScriptConsoleItem.h +++ b/src/scripting/scriptconsole/ScriptConsoleItem.h @@ -22,11 +22,7 @@ namespace KTextEditor{ class View; } -class QUrl; -class QIcon; -class QScriptContext; class QScriptEngine; -class QScriptEngineDebugger; class QWidget; namespace ScriptConsoleNS @@ -42,24 +38,24 @@ , const QString &category, ScriptEditorDocument *document ); virtual ~ScriptConsoleItem(); ScriptEditorDocument* document() { return m_viewFactory; } - bool start( bool silent = false ); + bool start( bool silent = false ) override; KTextEditor::View *createEditorView( QWidget *parent ); /** * Clear script files on disk upon object deletion */ void setClearOnDeletion( bool clearOnDelete ); - void pause(); + void pause() override; private: bool m_clearOnDelete; ScriptEditorDocument *m_viewFactory; QPointer m_view; - void timerEvent(QTimerEvent* event); - void initializeScriptEngine(); + void timerEvent(QTimerEvent* event) override; + void initializeScriptEngine() override; static KPluginInfo createSpecFile( const QString &name, const QString &category, const QString &path ); - QString handleError( QScriptEngine *engine ); + QString handleError( QScriptEngine *engine ) override; }; } diff --git a/src/scripting/scriptconsole/ScriptConsoleItem.cpp b/src/scripting/scriptconsole/ScriptConsoleItem.cpp --- a/src/scripting/scriptconsole/ScriptConsoleItem.cpp +++ b/src/scripting/scriptconsole/ScriptConsoleItem.cpp @@ -30,14 +30,14 @@ #include #include #include -#include +#include #include using namespace ScriptConsoleNS; ScriptConsoleItem::ScriptConsoleItem( QObject *parent, const QString &name, const QString &category , const QString &path, ScriptEditorDocument *document ) -: ScriptItem( parent, name, QString("%1/main.js").arg(path), createSpecFile( name, category, path ) ) +: ScriptItem( parent, name, QStringLiteral("%1/main.js").arg(path), createSpecFile( name, category, path ) ) , m_clearOnDelete( false ) , m_viewFactory( document ) { @@ -56,8 +56,8 @@ QDir dir( info.path() ); if( !dir.exists() ) return; - dir.remove( "main.js" ); - dir.remove( "script.spec" ); + dir.remove( QStringLiteral("main.js") ); + dir.remove( QStringLiteral("script.spec") ); if( !dir.rmdir( dir.absolutePath() ) ) debug() << "Directory %1 not removed, contains other files"; } @@ -79,7 +79,7 @@ "\nX-KDE-PluginInfo-Depends=Amarok2.0" "\nX-KDE-PluginInfo-EnabledByDefault=false\n" ).arg( name, category ); - QString specPath = QString( "%1/script.spec" ).arg( path ); + QString specPath = QStringLiteral( "%1/script.spec" ).arg( path ); QFile file( specPath ); if( !file.open( QIODevice::WriteOnly ) ) { @@ -140,7 +140,7 @@ QString ScriptConsoleItem::handleError( QScriptEngine *engine ) { - QString errorString = QString( "Script Error: %1 (line: %2)" ) + QString errorString = QStringLiteral( "Script Error: %1 (line: %2)" ) .arg( engine->uncaughtException().toString(), QString::number( engine->uncaughtExceptionLineNumber() ) ); return errorString; diff --git a/src/scripting/scriptconsole/ScriptEditorDocument.h b/src/scripting/scriptconsole/ScriptEditorDocument.h --- a/src/scripting/scriptconsole/ScriptEditorDocument.h +++ b/src/scripting/scriptconsole/ScriptEditorDocument.h @@ -24,21 +24,21 @@ namespace KTextEditor { - class Attribute; class Document; class View; } class QUrl; class QColor; -class QIcon; class QWidget; namespace ScriptConsoleNS { class AmarokScriptCodeCompletionModel; class ScriptEditorDocument : public QObject { + Q_OBJECT + public: ScriptEditorDocument( QObject *parent, KTextEditor::Document* document ); virtual ~ScriptEditorDocument(); diff --git a/src/scripting/scriptconsole/ScriptEditorDocument.cpp b/src/scripting/scriptconsole/ScriptEditorDocument.cpp --- a/src/scripting/scriptconsole/ScriptEditorDocument.cpp +++ b/src/scripting/scriptconsole/ScriptEditorDocument.cpp @@ -36,7 +36,7 @@ { m_document = document; m_document->setParent( this ); - m_document->setHighlightingMode("JavaScript"); + m_document->setHighlightingMode(QStringLiteral("JavaScript")); } KTextEditor::View* @@ -53,7 +53,7 @@ } KTextEditor::ConfigInterface *configIface = qobject_cast( view ); if( configIface ) - configIface->setConfigValue( "line-numbers", true ); + configIface->setConfigValue( QStringLiteral("line-numbers"), true ); return view; } diff --git a/src/scripting/scriptengine/AmarokBookmarkScript.h b/src/scripting/scriptengine/AmarokBookmarkScript.h --- a/src/scripting/scriptengine/AmarokBookmarkScript.h +++ b/src/scripting/scriptengine/AmarokBookmarkScript.h @@ -38,7 +38,7 @@ Q_OBJECT public: - AmarokBookmarkScript( QScriptEngine* scriptEngine ); + explicit AmarokBookmarkScript( QScriptEngine* scriptEngine ); /** * @return bookmark for the current context view. @@ -56,7 +56,7 @@ Q_INVOKABLE AmarokUrlPtr browserView(); /** - * Bookmark the current track at the currrent position. + * Bookmark the current track at the current position. */ Q_INVOKABLE AmarokUrlPtr createCurrentTrackBookmark(); }; @@ -77,7 +77,7 @@ public: static QScriptValue bookmarkCtor( QScriptContext *context, QScriptEngine *engine ); - BookmarkPrototype( AmarokUrlPtr bookmark ); + explicit BookmarkPrototype( const AmarokUrlPtr &bookmark ); AmarokUrlPtr data() const { return m_url; } /** @@ -91,15 +91,18 @@ Q_INVOKABLE StringMap args() const; /** - * Sets the url argument named @param name to @param value. Overrides any possible + * Sets the url argument named @p name to @p value. Overrides any possible * previous value. + * + * @param name The name of the url argument. + * @param value The value. */ Q_INVOKABLE void setArg( const QString &name, const QString &value ); private: void setId( int id ); int id() const; - void setParent( BookmarkGroupPtr parent ); + void setParent( const BookmarkGroupPtr &parent ); QString command() const; void setCommand( const QString &command ); void setName( const QString &name ); @@ -128,7 +131,7 @@ Q_PROPERTY( int childCount READ childCount ) public: - BookmarkGroupPrototype( BookmarkGroupPtr group ); + explicit BookmarkGroupPrototype( const BookmarkGroupPtr &group ); static QScriptValue bookmarkGroupCtor( QScriptContext *context, QScriptEngine *engine ); BookmarkGroupPtr data() const { return m_group; } @@ -139,8 +142,8 @@ Q_INVOKABLE BookmarkGroupList childGroups() const; Q_INVOKABLE BookmarkList childBookmarks() const; Q_INVOKABLE void clear(); - Q_INVOKABLE void deleteChildBookmark( AmarokUrlPtr bookmark ); - Q_INVOKABLE void deleteChildBookmarkgroup( BookmarkGroupPtr bookmarkGroup ); + Q_INVOKABLE void deleteChildBookmark( const AmarokUrlPtr &bookmark ); + Q_INVOKABLE void deleteChildBookmarkgroup( const BookmarkGroupPtr &bookmarkGroup ); private: int id() const; @@ -150,7 +153,7 @@ void setName( const QString &name ); void setDescription( const QString &description ); BookmarkGroupPtr parent() const; - void setParent( BookmarkGroupPtr parent ); + void setParent( const BookmarkGroupPtr &parent ); BookmarkGroupPtr m_group; }; diff --git a/src/scripting/scriptengine/AmarokBookmarkScript.cpp b/src/scripting/scriptengine/AmarokBookmarkScript.cpp --- a/src/scripting/scriptengine/AmarokBookmarkScript.cpp +++ b/src/scripting/scriptengine/AmarokBookmarkScript.cpp @@ -37,11 +37,11 @@ { QScriptValue scriptObject = engine->newQObject( this, QScriptEngine::AutoOwnership, QScriptEngine::ExcludeSuperClassContents ); - engine->globalObject().property( "Amarok" ).setProperty( "Bookmark", scriptObject ); + engine->globalObject().property( QStringLiteral("Amarok") ).setProperty( QStringLiteral("Bookmark"), scriptObject ); qScriptRegisterMetaType( engine, toScriptValue, fromScriptValue ); qScriptRegisterMetaType( engine, toScriptValue, fromScriptValue ); - engine->globalObject().setProperty( "BookmarkGroup", engine->newFunction( BookmarkGroupPrototype::bookmarkGroupCtor ) ); - engine->globalObject().setProperty( "Bookmark", engine->newFunction( BookmarkPrototype::bookmarkCtor ) ); + engine->globalObject().setProperty( QStringLiteral("BookmarkGroup"), engine->newFunction( BookmarkGroupPrototype::bookmarkGroupCtor ) ); + engine->globalObject().setProperty( QStringLiteral("Bookmark"), engine->newFunction( BookmarkPrototype::bookmarkCtor ) ); qScriptRegisterMetaType( engine, toScriptArray, fromScriptArray ); qScriptRegisterMetaType( engine, toScriptArray, fromScriptArray ); } @@ -81,7 +81,7 @@ switch( context->argumentCount() ) { case 0: - return context->throwError( QScriptContext::SyntaxError, "Not enough arguments!!" ); + return context->throwError( QScriptContext::SyntaxError, QStringLiteral("Not enough arguments!!") ); case 1: if( context->argument( 0 ).isString() ) @@ -100,12 +100,12 @@ break; } if( !group ) - return context->throwError( QScriptContext::TypeError, "Invalid arguments!" ); + return context->throwError( QScriptContext::TypeError, QStringLiteral("Invalid arguments!") ); return engine->newQObject( new BookmarkGroupPrototype( BookmarkGroupPtr( group ) ), QScriptEngine::ScriptOwnership, QScriptEngine::ExcludeSuperClassContents ); } -BookmarkGroupPrototype::BookmarkGroupPrototype( BookmarkGroupPtr group ) -:QObject( 0 ) +BookmarkGroupPrototype::BookmarkGroupPrototype( const BookmarkGroupPtr &group ) +:QObject( nullptr ) , m_group( group ) {} @@ -127,13 +127,13 @@ m_group->clear(); } -void BookmarkGroupPrototype::deleteChildBookmark( AmarokUrlPtr bookmark ) +void BookmarkGroupPrototype::deleteChildBookmark( const AmarokUrlPtr &bookmark ) { m_group->deleteChild( BookmarkViewItemPtr::staticCast( bookmark ) ); } void -BookmarkGroupPrototype::deleteChildBookmarkgroup( BookmarkGroupPtr bookmarkGroup ) +BookmarkGroupPrototype::deleteChildBookmarkgroup( const BookmarkGroupPtr &bookmarkGroup ) { m_group->deleteChild( BookmarkViewItemPtr::staticCast( bookmarkGroup ) ); } @@ -189,7 +189,7 @@ } void -BookmarkGroupPrototype::setParent( BookmarkGroupPtr parent ) +BookmarkGroupPrototype::setParent( const BookmarkGroupPtr &parent ) { m_group->reparent( parent ); } @@ -217,7 +217,7 @@ switch( context->argumentCount() ) { case 0: - return context->throwError( QScriptContext::SyntaxError, "Not enough arguments!!" ); + return context->throwError( QScriptContext::SyntaxError, QStringLiteral("Not enough arguments!!") ); case 1: if( context->argument( 0 ).isString() ) @@ -240,15 +240,15 @@ break; } if( !url ) - return context->throwError( QScriptContext::TypeError, "Invalid arguments!" ); + return context->throwError( QScriptContext::TypeError, QStringLiteral("Invalid arguments!") ); return engine->newQObject( new BookmarkPrototype( url ), QScriptEngine::ScriptOwnership, QScriptEngine::ExcludeSuperClassContents ); } -BookmarkPrototype::BookmarkPrototype( AmarokUrlPtr bookmark ) -: QObject( 0 ) +BookmarkPrototype::BookmarkPrototype( const AmarokUrlPtr &bookmark ) +: QObject( nullptr ) , m_url( bookmark ) {} @@ -353,7 +353,7 @@ void BookmarkPrototype::setName( const QString &name ) { - return m_url->setName( name ); + m_url->setName( name ); } @@ -364,7 +364,7 @@ } void -BookmarkPrototype::setParent( BookmarkGroupPtr parent ) +BookmarkPrototype::setParent( const BookmarkGroupPtr &parent ) { m_url->reparent( parent ); } diff --git a/src/scripting/scriptengine/AmarokCollectionScript.h b/src/scripting/scriptengine/AmarokCollectionScript.h --- a/src/scripting/scriptengine/AmarokCollectionScript.h +++ b/src/scripting/scriptengine/AmarokCollectionScript.h @@ -22,7 +22,6 @@ #include #include -class QScriptEngine; namespace Collections { class QueryMaker; @@ -32,7 +31,6 @@ namespace Playlists { - class PlaylistProvider; } namespace AmarokScript @@ -46,7 +44,7 @@ Q_OBJECT public: - AmarokCollectionScript( AmarokScriptEngine* scriptEngine ); + explicit AmarokCollectionScript( AmarokScriptEngine* scriptEngine ); Q_INVOKABLE int totalAlbums() const; Q_INVOKABLE int totalArtists() const; diff --git a/src/scripting/scriptengine/AmarokCollectionScript.cpp b/src/scripting/scriptengine/AmarokCollectionScript.cpp --- a/src/scripting/scriptengine/AmarokCollectionScript.cpp +++ b/src/scripting/scriptengine/AmarokCollectionScript.cpp @@ -43,9 +43,9 @@ QScriptValue scriptObject = engine->newQObject( this, QScriptEngine::AutoOwnership, QScriptEngine::ExcludeSuperClassContents ); //deprecate - engine->setDeprecatedProperty( "Amarok", "Collection", scriptObject ); + engine->setDeprecatedProperty( QStringLiteral("Amarok"), QStringLiteral("Collection"), scriptObject ); - engine->globalObject().property( "Amarok" ).setProperty( "CollectionManager", scriptObject ); + engine->globalObject().property( QStringLiteral("Amarok") ).setProperty( QStringLiteral("CollectionManager"), scriptObject ); CollectionManager *instance = CollectionManager::instance(); connect( instance, &CollectionManager::collectionDataChanged, @@ -59,7 +59,7 @@ int AmarokCollectionScript::totalAlbums() const { - QStringList albums = query( "SELECT COUNT( id ) FROM albums;" ); + QStringList albums = query( QStringLiteral("SELECT COUNT( id ) FROM albums;") ); if( albums.size() < 1 ) return 0; QString total = albums[0]; @@ -69,7 +69,7 @@ int AmarokCollectionScript::totalArtists() const { - QStringList artists = query( "SELECT COUNT( id ) FROM artists;" ); + QStringList artists = query( QStringLiteral("SELECT COUNT( id ) FROM artists;") ); if( artists.size() < 1 ) return 0; QString total = artists[0]; @@ -79,7 +79,7 @@ int AmarokCollectionScript::totalComposers() const { - QStringList composers = query( "SELECT COUNT( id ) FROM composers;" ); + QStringList composers = query( QStringLiteral("SELECT COUNT( id ) FROM composers;") ); if( composers.size() < 1 ) return 0; QString total = composers[0]; @@ -89,7 +89,7 @@ int AmarokCollectionScript::totalGenres() const { - QStringList genres = query( "SELECT COUNT( id ) FROM genres;" ); + QStringList genres = query( QStringLiteral("SELECT COUNT( id ) FROM genres;") ); if( genres.size() < 1 ) return 0; QString total = genres[0]; @@ -99,7 +99,7 @@ int AmarokCollectionScript::totalTracks() const { - QStringList tracks = query( "SELECT COUNT( url ) FROM tracks;" ); + QStringList tracks = query( QStringLiteral("SELECT COUNT( url ) FROM tracks;") ); if( tracks.size() < 0 ) return 0; QString total = tracks[0]; diff --git a/src/scripting/scriptengine/AmarokCollectionViewScript.h b/src/scripting/scriptengine/AmarokCollectionViewScript.h --- a/src/scripting/scriptengine/AmarokCollectionViewScript.h +++ b/src/scripting/scriptengine/AmarokCollectionViewScript.h @@ -54,7 +54,6 @@ class AmarokCollectionViewScript : public QObject { Q_OBJECT - Q_ENUMS( Category ) Q_PROPERTY( QString filter READ filter WRITE setFilter ) Q_PROPERTY( QScriptValue selection READ selectionScriptValue ) @@ -89,6 +88,7 @@ Year = CategoryId::Year, Label = CategoryId::Label }; + Q_ENUM( Category ) public Q_SLOTS: void setLevel( int level, int type ); @@ -153,7 +153,7 @@ Q_PROPERTY( bool childrenLoaded READ childrenLoaded ) public: - CollectionViewItem( CollectionTreeItem *item, QObject *parent = 0 ); + explicit CollectionViewItem( CollectionTreeItem *item, QObject *parent = nullptr ); CollectionTreeItem* data() const; static QScriptValue toScriptValue( QScriptEngine *engine, CollectionTreeItem* const &item ); @@ -163,13 +163,17 @@ Q_INVOKABLE Collections::QueryMaker* queryMaker(); /** - * Add a filter representing this item to @param queryMaker. + * Add a filter representing this item to @p queryMaker. * For example, for obtaining a specific collection's items in the merged view. + * + * @param queryMaker the Query maker. */ Q_INVOKABLE void addFilter( Collections::QueryMaker *queryMaker ); /** - * Return the child item at @param row. + * Return the child item at @p row. + * + * @param row the number of the row. */ Q_INVOKABLE CollectionTreeItem* child( int row ); diff --git a/src/scripting/scriptengine/AmarokCollectionViewScript.cpp b/src/scripting/scriptengine/AmarokCollectionViewScript.cpp --- a/src/scripting/scriptengine/AmarokCollectionViewScript.cpp +++ b/src/scripting/scriptengine/AmarokCollectionViewScript.cpp @@ -52,14 +52,14 @@ { QScriptValue scriptObject = engine->newQObject( this, QScriptEngine::AutoOwnership, QScriptEngine::ExcludeSuperClassContents ); - QScriptValue windowObject = engine->globalObject().property( "Amarok" ).property( "Window" ); + QScriptValue windowObject = engine->globalObject().property( QStringLiteral("Amarok") ).property( QStringLiteral("Window") ); Q_ASSERT( !windowObject.isUndefined() ); - windowObject.setProperty( "CollectionView", scriptObject ); + windowObject.setProperty( QStringLiteral("CollectionView"), scriptObject ); const QMetaEnum typeEnum = CollectionTreeItem::staticMetaObject.enumerator( CollectionTreeItem::staticMetaObject.indexOfEnumerator( "Type" ) ); Q_ASSERT( typeEnum.isValid() ); - scriptObject.setProperty( "Type", engine->enumObject( typeEnum ) ); + scriptObject.setProperty( QStringLiteral("Type"), engine->enumObject( typeEnum ) ); Q_ASSERT( m_categoryEnum.isValid() ); - scriptObject.setProperty( "Category", engine->enumObject( m_categoryEnum ) ); + scriptObject.setProperty( QStringLiteral("Category"), engine->enumObject( m_categoryEnum ) ); qScriptRegisterMetaType( engine, CollectionViewItem::toScriptValue, fromScriptValue ); engine->registerArrayType< QList >(); engine->registerArrayType(); @@ -77,7 +77,7 @@ void AmarokCollectionViewScript::setFilter( const QString &filter ) { - return m_collectionWidget->setFilter( filter ); + m_collectionWidget->setFilter( filter ); } QString @@ -204,9 +204,11 @@ void AmarokCollectionViewScript::setLevel( int level, int type ) { - if( m_categoryEnum.valueToKey( type ) ) - return m_collectionWidget->currentView()->setLevel( level, CategoryId::CatMenuId( type ) ); - m_engine->currentContext()->throwError( QScriptContext::TypeError, "Invalid category!" ); + if( m_categoryEnum.valueToKey( type ) ) { + m_collectionWidget->currentView()->setLevel( level, CategoryId::CatMenuId( type ) ); + return; + } + m_engine->currentContext()->throwError( QScriptContext::TypeError, QStringLiteral("Invalid category!") ); } void @@ -217,7 +219,7 @@ { if( !m_categoryEnum.valueToKey( level ) ) { - m_engine->currentContext()->throwError( QScriptContext::TypeError, "Invalid category!" ); + m_engine->currentContext()->throwError( QScriptContext::TypeError, QStringLiteral("Invalid category!") ); return; } catLevels << CategoryId::CatMenuId( level ); @@ -356,7 +358,7 @@ Q_UNUSED( bottomRight ) if( static_cast( topLeft.internalPointer() ) != m_item ) return; - emit loaded( m_item ); + Q_EMIT loaded( m_item ); Q_ASSERT( disconnect( qobject_cast(sender()), &QAbstractItemModel::dataChanged, this, 0 ) ); } @@ -410,7 +412,7 @@ } Selection::Selection( const QModelIndexList &indices ) - : QObject( 0 ) + : QObject( nullptr ) , m_indices( indices ) {} diff --git a/src/scripting/scriptengine/AmarokEngineScript.h b/src/scripting/scriptengine/AmarokEngineScript.h --- a/src/scripting/scriptengine/AmarokEngineScript.h +++ b/src/scripting/scriptengine/AmarokEngineScript.h @@ -38,7 +38,7 @@ Q_PROPERTY( int fadeoutLength READ fadeoutLength WRITE setFadeoutLength ) public: - AmarokEngineScript( QScriptEngine* scriptEngine ); + explicit AmarokEngineScript( QScriptEngine* scriptEngine ); enum PlayerStatus { @@ -95,13 +95,13 @@ void trackSeeked( int ); //return relative time in million second /** This signal will be emitted when the volume changes. - @param volume The relative volume between 0 (mute) and 100. + The parameter is the relative volume between 0 (mute) and 100. */ void volumeChanged( int ); /** This signal is emitted when the engine state switches to play or pause. Note: You could get two trackPlayPause(1) in a row if e.g. the state - changed to stopped in beetween (which you will notice if connecting to + changed to stopped in between (which you will notice if connecting to the trackFinished signal) @param state Is 0 when state changed to playing or 1 when the state switched to pause. */ diff --git a/src/scripting/scriptengine/AmarokEngineScript.cpp b/src/scripting/scriptengine/AmarokEngineScript.cpp --- a/src/scripting/scriptengine/AmarokEngineScript.cpp +++ b/src/scripting/scriptengine/AmarokEngineScript.cpp @@ -33,7 +33,7 @@ { QScriptValue scriptObject = scriptEngine->newQObject( this, QScriptEngine::AutoOwnership , QScriptEngine::ExcludeSuperClassContents ); - scriptEngine->globalObject().property( "Amarok" ).setProperty( "Engine", scriptObject ); + scriptEngine->globalObject().property( QStringLiteral("Amarok") ).setProperty( QStringLiteral("Engine"), scriptObject ); EngineController *engine = The::engineController(); connect( engine, &EngineController::trackPositionChanged, @@ -164,25 +164,25 @@ void AmarokEngineScript::trackPositionChanged( qint64 pos ) { - emit trackSeeked( pos ); + Q_EMIT trackSeeked( pos ); } void AmarokEngineScript::slotNewMetaData() { - emit newMetaData( QHash(), false ); + Q_EMIT newMetaData( QHash(), false ); } void AmarokEngineScript::slotPaused() { - emit trackPlayPause( Paused ); + Q_EMIT trackPlayPause( Paused ); } void AmarokEngineScript::slotPlaying() { - emit trackPlayPause( Playing ); + Q_EMIT trackPlayPause( Playing ); } bool diff --git a/src/scripting/scriptengine/AmarokEqualizerScript.h b/src/scripting/scriptengine/AmarokEqualizerScript.h --- a/src/scripting/scriptengine/AmarokEqualizerScript.h +++ b/src/scripting/scriptengine/AmarokEqualizerScript.h @@ -91,7 +91,10 @@ Q_INVOKABLE bool deletePreset( const QString &presetName ); /** - * Save the @param presetGains as a preset with name @param name. + * Save the @p presetGains as a preset with name @p name. + * + * @param name the name. + * @param presetGains The untranslated preset name. */ Q_INVOKABLE void savePreset( const QString &name, const QList &presetGains ); @@ -128,7 +131,7 @@ QStringList translatedDefaultPresetList() const; QStringList defaultPresetList() const; QList gains() const; - void setGains( QList gains ); + void setGains( const QList &gains ); int maxGain() const; friend class AmarokEngineScript; diff --git a/src/scripting/scriptengine/AmarokEqualizerScript.cpp b/src/scripting/scriptengine/AmarokEqualizerScript.cpp --- a/src/scripting/scriptengine/AmarokEqualizerScript.cpp +++ b/src/scripting/scriptengine/AmarokEqualizerScript.cpp @@ -29,7 +29,7 @@ { QScriptValue scriptObject = scriptEngine->newQObject( this, QScriptEngine::AutoOwnership , QScriptEngine::ExcludeSuperClassContents ); - scriptEngine->globalObject().property( "Amarok" ).property( "Engine" ).setProperty( "Equalizer", scriptObject ); + scriptEngine->globalObject().property( QStringLiteral("Amarok") ).property( QStringLiteral("Engine") ).setProperty( QStringLiteral("Equalizer"), scriptObject ); EqualizerController *equalizer = The::engineController()->equalizerController(); connect( equalizer, &EqualizerController::gainsChanged, this, &AmarokEqualizerScript::gainsChanged ); @@ -74,7 +74,7 @@ void AmarokEqualizerScript::equalizerPresetApplied( int index ) { - emit presetApplied( EqualizerPresets::eqGlobalList().value( index ) ); + Q_EMIT presetApplied( EqualizerPresets::eqGlobalList().value( index ) ); } QList @@ -138,7 +138,7 @@ } void -AmarokEqualizerScript::setGains( QList gains ) +AmarokEqualizerScript::setGains( const QList &gains ) { The::engineController()->equalizerController()->setGains( gains ); } diff --git a/src/scripting/scriptengine/AmarokInfoScript.h b/src/scripting/scriptengine/AmarokInfoScript.h --- a/src/scripting/scriptengine/AmarokInfoScript.h +++ b/src/scripting/scriptengine/AmarokInfoScript.h @@ -22,7 +22,6 @@ #include #include -class QScriptEngine; namespace AmarokScript { @@ -32,7 +31,6 @@ class InfoScript : public QObject { Q_OBJECT - Q_ENUMS( IconSizes ) public: // SCRIPTDOX enum Amarok.Info.IconSizes @@ -44,6 +42,7 @@ Huge=64, Enormous=128 }; + Q_ENUM( IconSizes ) InfoScript( const QUrl &scriptUrl, AmarokScriptEngine *engine ); @@ -63,7 +62,7 @@ * @param name The name of the icon, without extension. If an absolute * path is supplied for this parameter, iconPath will return it * directly. - * @param size Search icons whose size is @param size. + * @param size Search icons whose size is @p size. * See Info.IconSizes */ Q_INVOKABLE QString iconPath( const QString& name, int size ) const; diff --git a/src/scripting/scriptengine/AmarokInfoScript.cpp b/src/scripting/scriptengine/AmarokInfoScript.cpp --- a/src/scripting/scriptengine/AmarokInfoScript.cpp +++ b/src/scripting/scriptengine/AmarokInfoScript.cpp @@ -34,11 +34,11 @@ { QScriptValue scriptObject = engine->newQObject( this, QScriptEngine::AutoOwnership, QScriptEngine::ExcludeSuperClassContents ); - engine->globalObject().property( "Amarok" ).setProperty( "Info", scriptObject ); + engine->globalObject().property( QStringLiteral("Amarok") ).setProperty( QStringLiteral("Info"), scriptObject ); const QMetaEnum iconEnum = metaObject()->enumerator( metaObject()->indexOfEnumerator("IconSizes") ); Q_ASSERT( iconEnum.isValid() ); - scriptObject.setProperty( "IconSizes", engine->enumObject( iconEnum ) ); + scriptObject.setProperty( QStringLiteral("IconSizes"), engine->enumObject( iconEnum ) ); } QString diff --git a/src/scripting/scriptengine/AmarokKNotifyScript.h b/src/scripting/scriptengine/AmarokKNotifyScript.h --- a/src/scripting/scriptengine/AmarokKNotifyScript.h +++ b/src/scripting/scriptengine/AmarokKNotifyScript.h @@ -38,7 +38,7 @@ Q_PROPERTY( bool kNotifyEnabled READ kNotifyEnabled WRITE setKNotifyEnabled ) public: - AmarokKNotifyScript( QScriptEngine* scriptEngine ); + explicit AmarokKNotifyScript( QScriptEngine* scriptEngine ); /** * Show notifications for the currently playing track. diff --git a/src/scripting/scriptengine/AmarokKNotifyScript.cpp b/src/scripting/scriptengine/AmarokKNotifyScript.cpp --- a/src/scripting/scriptengine/AmarokKNotifyScript.cpp +++ b/src/scripting/scriptengine/AmarokKNotifyScript.cpp @@ -31,8 +31,8 @@ { QScriptValue scriptObject = engine->newQObject( this, QScriptEngine::AutoOwnership, QScriptEngine::ExcludeSuperClassContents ); - QScriptValue windowObject = engine->globalObject().property( "Amarok" ).property( "Window" ); - windowObject.setProperty( "KNotify", scriptObject ); + QScriptValue windowObject = engine->globalObject().property( QStringLiteral("Amarok") ).property( QStringLiteral("Window") ); + windowObject.setProperty( QStringLiteral("KNotify"), scriptObject ); } bool diff --git a/src/scripting/scriptengine/AmarokLyricsScript.h b/src/scripting/scriptengine/AmarokLyricsScript.h deleted file mode 100644 --- a/src/scripting/scriptengine/AmarokLyricsScript.h +++ /dev/null @@ -1,56 +0,0 @@ -/**************************************************************************************** - * Copyright (c) 2008 Leo Franchi * - * Copyright (c) 2008 Peter ZHOU * - * * - * This program is free software; you can redistribute it and/or modify it under * - * the terms of the GNU General Public License as published by the Free Software * - * Foundation; either version 2 of the License, or (at your option) any later * - * version. * - * * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY * - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * - * PARTICULAR PURPOSE. See the GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License along with * - * this program. If not, see . * - ****************************************************************************************/ - -#ifndef AMAROK_LYRICS_SCRIPT_H -#define AMAROK_LYRICS_SCRIPT_H - -#include "core/meta/forward_declarations.h" - -#include - -class QScriptEngine; -class QByteArray; - -namespace AmarokScript -{ - // SCRIPTDOX Amarok.Lyrics - class AmarokLyricsScript : public QObject - { - Q_OBJECT - - public: - AmarokLyricsScript( QScriptEngine* scriptEngine ); - - Q_INVOKABLE void showLyrics( const QString& lyrics ) const; - - Q_INVOKABLE void showLyricsHtml( const QString& lyrics ) const; - Q_INVOKABLE void showLyricsError( const QString& error ) const; - Q_INVOKABLE void showLyricsNotFound( const QString& msg ) const; - - Q_INVOKABLE QString escape( const QString& str ); - - Q_INVOKABLE void setLyricsForTrack( const QString& trackUrl , const QString& lyrics ) const; - Q_INVOKABLE QString toUtf8( const QByteArray& lyrics, const QString& encoding = "UTF-8" ); - Q_INVOKABLE QString QStringtoUtf8( const QString& lyrics, const QString& encoding = "UTF-8" ); - Q_INVOKABLE QByteArray fromUtf8( const QString& str, const QString& encoding ); - - Q_SIGNALS: - void fetchLyrics( const QString& artist, const QString& title, const QString&, Meta::TrackPtr ); - }; -} - -#endif diff --git a/src/scripting/scriptengine/AmarokLyricsScript.cpp b/src/scripting/scriptengine/AmarokLyricsScript.cpp deleted file mode 100644 --- a/src/scripting/scriptengine/AmarokLyricsScript.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/**************************************************************************************** - * Copyright (c) 2008 Leo Franchi * - * Copyright (c) 2008 Peter ZHOU * - * * - * This program is free software; you can redistribute it and/or modify it under * - * the terms of the GNU General Public License as published by the Free Software * - * Foundation; either version 2 of the License, or (at your option) any later * - * version. * - * * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY * - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * - * PARTICULAR PURPOSE. See the GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License along with * - * this program. If not, see . * - ****************************************************************************************/ - -#define DEBUG_PREFIX "AmarokLyricsScript" - -#include "AmarokLyricsScript.h" - -#include "EngineController.h" -#include "scripting/scriptmanager/ScriptManager.h" -#include "context/LyricsManager.h" -#include "core/meta/Meta.h" -#include "core/support/Amarok.h" -#include "core/support/Debug.h" - -#include -#include -#include -#include - -using namespace AmarokScript; - - -AmarokLyricsScript::AmarokLyricsScript( QScriptEngine *engine ) - : QObject( engine ) -{ - QScriptValue scriptObject = engine->newQObject( this, QScriptEngine::AutoOwnership, - QScriptEngine::ExcludeSuperClassContents ); - engine->globalObject().property( "Amarok" ).setProperty( "Lyrics", scriptObject ); - connect( ScriptManager::instance(), &ScriptManager::fetchLyrics, - this, &AmarokLyricsScript::fetchLyrics ); -} - -void -AmarokLyricsScript::showLyrics( const QString &lyrics ) const -{ - DEBUG_BLOCK - Meta::TrackPtr track = The::engineController()->currentTrack(); - if( !track ) - return; - LyricsManager::self()->lyricsResult( lyrics, false ); -} - -void -AmarokLyricsScript::showLyricsHtml( const QString &lyrics ) const -{ - DEBUG_BLOCK - Meta::TrackPtr track = The::engineController()->currentTrack(); - if( !track ) - return; - LyricsManager::self()->lyricsResultHtml( lyrics, false ); -} - -void -AmarokLyricsScript::showLyricsError( const QString &error ) const -{ - DEBUG_BLOCK - LyricsManager::self()->lyricsError( error ); -} - - -void -AmarokLyricsScript::showLyricsNotFound( const QString &msg ) const -{ - DEBUG_BLOCK - LyricsManager::self()->lyricsNotFound( msg ); -} - - -QString -AmarokLyricsScript::escape( const QString &str ) -{ - return str.toHtmlEscaped(); -} - -void -AmarokLyricsScript::setLyricsForTrack( const QString &trackUrl, const QString &lyrics ) const -{ - LyricsManager::self()->setLyricsForTrack( trackUrl, lyrics ); -} - -QString -AmarokLyricsScript::toUtf8( const QByteArray &lyrics, const QString &encoding ) -{ - QTextCodec* codec = QTextCodec::codecForName( encoding.toUtf8() ); - if( !codec ) - return QString(); - return codec->toUnicode( lyrics ); -} - -QString -AmarokLyricsScript::QStringtoUtf8( const QString &lyrics, const QString &encoding ) -{ - QTextCodec* codec = QTextCodec::codecForName( encoding.toUtf8() ); - if( !codec ) - return QString(); - return codec->toUnicode( lyrics.toLatin1() ); -} - -QByteArray -AmarokLyricsScript::fromUtf8( const QString &str, const QString &encoding ) -{ - QTextCodec* codec = QTextCodec::codecForName( encoding.toUtf8() ); - if( !codec ) - return QByteArray(); - - return codec->fromUnicode( str ); -} diff --git a/src/scripting/scriptengine/AmarokNetworkScript.h b/src/scripting/scriptengine/AmarokNetworkScript.h --- a/src/scripting/scriptengine/AmarokNetworkScript.h +++ b/src/scripting/scriptengine/AmarokNetworkScript.h @@ -37,7 +37,7 @@ Q_OBJECT public: - Downloader( QScriptEngine* scriptEngine ); + explicit Downloader( QScriptEngine* scriptEngine ); private: static QScriptValue dataDownloader_prototype_ctor( QScriptContext* context, QScriptEngine* engine ); @@ -61,18 +61,26 @@ static AmarokDownloadHelper *instance(); // called by the wrapper class to register a new download - void newStringDownload( const QUrl &url, QScriptEngine* engine, QScriptValue obj, QString encoding = "UTF-8" ); - void newDataDownload( const QUrl &url, QScriptEngine* engine, QScriptValue obj ); + void newStringDownload( const QUrl &url, QScriptEngine* engine, const QScriptValue &obj, const QString &encoding = QStringLiteral("UTF-8") ); + void newDataDownload( const QUrl &url, QScriptEngine* engine, const QScriptValue &obj ); private Q_SLOTS: - void resultString( const QUrl &url, QByteArray data, NetworkAccessManagerProxy::Error e ); - void resultData( const QUrl &url, QByteArray data, NetworkAccessManagerProxy::Error e ); + void resultString( const QUrl &url, const QByteArray &data, const NetworkAccessManagerProxy::Error &e ); + void resultData( const QUrl &url, const QByteArray &data, const NetworkAccessManagerProxy::Error &e ); void requestRedirected( const QUrl &sourceUrl, const QUrl &targetUrl ); private: void cleanUp( const QUrl &url ); - void newDownload( const QUrl &url, QScriptEngine* engine, QScriptValue obj, const char *slot ); + + template + void newDownload( const QUrl &url, QScriptEngine* engine, const QScriptValue &obj, Function slot ) + { + m_values[ url ] = obj; + m_engines[ url ] = engine; + + The::networkAccessManager()->getData( url, this, slot ); + } /** * Template function which updates the given @p sourceUrl to the given diff --git a/src/scripting/scriptengine/AmarokNetworkScript.cpp b/src/scripting/scriptengine/AmarokNetworkScript.cpp --- a/src/scripting/scriptengine/AmarokNetworkScript.cpp +++ b/src/scripting/scriptengine/AmarokNetworkScript.cpp @@ -29,18 +29,18 @@ using namespace AmarokScript; -AmarokDownloadHelper *AmarokDownloadHelper::s_instance = 0; +AmarokDownloadHelper *AmarokDownloadHelper::s_instance = nullptr; Downloader::Downloader( QScriptEngine* engine ) : QObject( engine ) , m_scriptEngine( engine ) { engine->setDefaultPrototype( qMetaTypeId(), QScriptValue() ); const QScriptValue stringCtor = engine->newFunction( stringDownloader_prototype_ctor ); - engine->globalObject().setProperty( "Downloader", stringCtor ); //kept for compat - engine->globalObject().setProperty( "StringDownloader", stringCtor ); //added for clarity + engine->globalObject().setProperty( QStringLiteral("Downloader"), stringCtor ); //kept for compat + engine->globalObject().setProperty( QStringLiteral("StringDownloader"), stringCtor ); //added for clarity const QScriptValue dataCtor = engine->newFunction( dataDownloader_prototype_ctor ); - engine->globalObject().setProperty( "DataDownloader", dataCtor ); + engine->globalObject().setProperty( QStringLiteral("DataDownloader"), dataCtor ); } QScriptValue @@ -52,7 +52,7 @@ QScriptValue Downloader::dataDownloader_prototype_ctor( QScriptContext* context, QScriptEngine* engine ) { - if( engine->importedExtensions().contains( "qt.core" ) ) + if( engine->importedExtensions().contains( QStringLiteral("qt.core") ) ) return init( context, engine, false ); else { @@ -73,7 +73,7 @@ else { object = engine->newObject(); - object.setPrototype( context->callee().property("prototype") ); + object.setPrototype( context->callee().property(QStringLiteral("prototype")) ); } if( context->argumentCount() < 2 ) @@ -99,7 +99,7 @@ // start download, and connect to it if( stringResult ) { - QString encoding = "UTF-8"; + QString encoding = QStringLiteral("UTF-8"); if( context->argumentCount() == 3 ) // encoding specified encoding = context->argument( 2 ).toString(); AmarokDownloadHelper::instance()->newStringDownload( url, engine, context->argument( 1 ), encoding ); @@ -123,25 +123,16 @@ } void -AmarokDownloadHelper::newStringDownload( const QUrl &url, QScriptEngine* engine, QScriptValue obj, QString encoding ) +AmarokDownloadHelper::newStringDownload( const QUrl &url, QScriptEngine* engine, const QScriptValue &obj, const QString &encoding ) { m_encodings[ url ] = encoding; - newDownload( url, engine, obj, SLOT(resultString(QUrl,QByteArray,NetworkAccessManagerProxy::Error)) ); + newDownload( url, engine, obj, &AmarokDownloadHelper::resultString ); } void -AmarokDownloadHelper::newDataDownload( const QUrl &url, QScriptEngine* engine, QScriptValue obj ) +AmarokDownloadHelper::newDataDownload( const QUrl &url, QScriptEngine* engine, const QScriptValue &obj ) { - newDownload( url, engine, obj, SLOT(resultData(QUrl,QByteArray,NetworkAccessManagerProxy::Error)) ); -} - -void -AmarokDownloadHelper::newDownload( const QUrl &url, QScriptEngine* engine, QScriptValue obj, const char *slot ) -{ - m_values[ url ] = obj; - m_engines[ url ] = engine; - - The::networkAccessManager()->getData( url, this, slot ); + newDownload( url, engine, obj, &AmarokDownloadHelper::resultData ); } void @@ -156,7 +147,7 @@ } void -AmarokDownloadHelper::resultData( const QUrl &url, QByteArray data, NetworkAccessManagerProxy::Error e ) +AmarokDownloadHelper::resultData( const QUrl &url, const QByteArray &data, const NetworkAccessManagerProxy::Error &e ) { if( !m_values.contains( url ) ) return; @@ -188,7 +179,7 @@ void -AmarokDownloadHelper::resultString( const QUrl &url, QByteArray data, NetworkAccessManagerProxy::Error e ) +AmarokDownloadHelper::resultString( const QUrl &url, const QByteArray &data, const NetworkAccessManagerProxy::Error &e ) { if( !m_values.contains( url ) ) return; diff --git a/src/scripting/scriptengine/AmarokOSDScript.h b/src/scripting/scriptengine/AmarokOSDScript.h --- a/src/scripting/scriptengine/AmarokOSDScript.h +++ b/src/scripting/scriptengine/AmarokOSDScript.h @@ -33,7 +33,7 @@ Q_PROPERTY ( bool osdEnabled READ osdEnabled WRITE setOsdEnabled ) public: - AmarokOSDScript( QScriptEngine* scriptEngine ); + explicit AmarokOSDScript( QScriptEngine* scriptEngine ); /** * Show an OSD for the currently playing track, even if the OSD diff --git a/src/scripting/scriptengine/AmarokOSDScript.cpp b/src/scripting/scriptengine/AmarokOSDScript.cpp --- a/src/scripting/scriptengine/AmarokOSDScript.cpp +++ b/src/scripting/scriptengine/AmarokOSDScript.cpp @@ -29,8 +29,8 @@ { QScriptValue scriptObject = engine->newQObject( this, QScriptEngine::AutoOwnership, QScriptEngine::ExcludeSuperClassContents ); - QScriptValue windowObject = engine->globalObject().property( "Amarok" ).property( "Window" ); - windowObject.setProperty( "OSD", scriptObject ); + QScriptValue windowObject = engine->globalObject().property( QStringLiteral("Amarok") ).property( QStringLiteral("Window") ); + windowObject.setProperty( QStringLiteral("OSD"), scriptObject ); } void diff --git a/src/scripting/scriptengine/AmarokPlaylistManagerScript.h b/src/scripting/scriptengine/AmarokPlaylistManagerScript.h --- a/src/scripting/scriptengine/AmarokPlaylistManagerScript.h +++ b/src/scripting/scriptengine/AmarokPlaylistManagerScript.h @@ -21,7 +21,6 @@ #include -class QScriptEngine; namespace Playlists { class Playlist; @@ -51,7 +50,7 @@ Q_PROPERTY( QList availableCategories READ availableCategories ) public: - AmarokPlaylistManagerScript( AmarokScriptEngine* engine ); + explicit AmarokPlaylistManagerScript( AmarokScriptEngine* engine ); /** * @returns playlists of a certain category from all registered PlaylistProviders @@ -73,7 +72,10 @@ //void setupSync( const Playlists::PlaylistPtr master, const Playlists::PlaylistPtr slave ); /** - * Return provider with name @param name and category @param category. + * Return provider with @p name and @p category. + * + * @param category the category. + * @param name the name. */ Q_INVOKABLE Playlists::PlaylistProvider *playlistProvider( int category, QString name ); @@ -88,13 +90,16 @@ /** * Saves a playlist from a file to the database. - * @arg fromLocation Saved playlist file to load + * @param fromLocation Saved playlist file to load */ - Q_INVOKABLE bool import( const QString &fromLocation ); + Q_INVOKABLE bool import( const QUrl &fromLocation ); /** - * Rename @param playlist to @param newName, return true if renaming was successful, + * Rename @p playlist to @p newName, return true if renaming was successful, * false otherwise. + * + * @param playlist the playlist. + * @param newName the new name. */ Q_INVOKABLE bool rename( Playlists::PlaylistPtr playlist, const QString &newName ); diff --git a/src/scripting/scriptengine/AmarokPlaylistManagerScript.cpp b/src/scripting/scriptengine/AmarokPlaylistManagerScript.cpp --- a/src/scripting/scriptengine/AmarokPlaylistManagerScript.cpp +++ b/src/scripting/scriptengine/AmarokPlaylistManagerScript.cpp @@ -31,25 +31,25 @@ { QScriptValue scriptObject = engine->newQObject( this, QScriptEngine::AutoOwnership, QScriptEngine::ExcludeSuperClassContents ); - engine->globalObject().property( "Amarok" ).setProperty( "PlaylistManager", scriptObject ); + engine->globalObject().property( QStringLiteral("Amarok") ).setProperty( QStringLiteral("PlaylistManager"), scriptObject ); const QMetaObject *metaObject = &PlaylistManager::staticMetaObject; const QMetaEnum categoryEnum = metaObject->enumerator( metaObject->indexOfEnumerator("PlaylistCategory") ); Q_ASSERT( categoryEnum.isValid() ); - scriptObject.setProperty( "PlaylistCategory", engine->enumObject( categoryEnum ) ); + scriptObject.setProperty( QStringLiteral("PlaylistCategory"), engine->enumObject( categoryEnum ) ); PlaylistPrototype::init( engine ); PlaylistProviderPrototype::init( engine ); PlaylistManager *instance = PlaylistManager::instance(); - connect( instance, SIGNAL(categoryAdded(int)), SIGNAL(categoryAdded(int)) ); + connect( instance, &PlaylistManager::categoryAdded, this, &AmarokPlaylistManagerScript::categoryAdded ); connect( instance, SIGNAL(playlistAdded(Playlists::PlaylistPtr,int)), SIGNAL(playlistAdded(Playlists::PlaylistPtr,int)) ); connect( instance, SIGNAL(playlistRemoved(Playlists::PlaylistPtr,int)), SIGNAL(playlistRemoved(Playlists::PlaylistPtr,int)) ); connect( instance, SIGNAL(playlistUpdated(Playlists::PlaylistPtr,int)), SIGNAL(playlistUpdated(Playlists::PlaylistPtr,int)) ); - connect( instance, SIGNAL(providerAdded(Playlists::PlaylistProvider*,int)), SIGNAL(providerAdded(Playlists::PlaylistProvider*,int)) ); - connect( instance, SIGNAL(providerRemoved(Playlists::PlaylistProvider*,int)), SIGNAL(providerRemoved(Playlists::PlaylistProvider*,int)) ); + connect( instance, &PlaylistManager::providerAdded, this, &AmarokPlaylistManagerScript::providerAdded ); + connect( instance, &PlaylistManager::providerRemoved, this, &AmarokPlaylistManagerScript::providerRemoved ); connect( instance, SIGNAL(renamePlaylist(Playlists::PlaylistPtr)), SIGNAL(renamePlaylist(Playlists::PlaylistPtr)) ); - connect( instance, SIGNAL(updated(int)), SIGNAL(updated(int)) ); + connect( instance, &PlaylistManager::updated, this, &AmarokPlaylistManagerScript::updated ); } // script invokable @@ -67,7 +67,7 @@ } bool -AmarokPlaylistManagerScript::import( const QString &fromLocation ) +AmarokPlaylistManagerScript::import( const QUrl &fromLocation ) { return PlaylistManager::instance()->import( fromLocation ); } diff --git a/src/scripting/scriptengine/AmarokPlaylistScript.h b/src/scripting/scriptengine/AmarokPlaylistScript.h --- a/src/scripting/scriptengine/AmarokPlaylistScript.h +++ b/src/scripting/scriptengine/AmarokPlaylistScript.h @@ -36,7 +36,7 @@ Q_OBJECT public: - AmarokPlaylistScript( AmarokScriptEngine *engine ); + explicit AmarokPlaylistScript( AmarokScriptEngine *engine ); /** * Return the index of the currently playing track in the playlist. @@ -61,7 +61,7 @@ /** * Append @param track to playlist. */ - Q_INVOKABLE void addTrack( Meta::TrackPtr track ); + Q_INVOKABLE void addTrack( const Meta::TrackPtr &track ); /** * Load the list of tracks represented by the urls and append to playlist. @@ -84,17 +84,17 @@ Q_INVOKABLE void playByIndex( int index ); /** - * Prepend the the track represented by the passed url and start playing it. + * Prepend the track represented by the passed url and start playing it. */ Q_INVOKABLE void playMedia( const QUrl &url ); /** * Prepend @param track and start playing it. */ - Q_INVOKABLE void playTrack( Meta::TrackPtr track ); + Q_INVOKABLE void playTrack( const Meta::TrackPtr &track ); /** - * Prepend the the tracks represented by the passed urls and start playing them. + * Prepend the tracks represented by the passed urls and start playing them. */ Q_INVOKABLE void playMediaList( const QList &urls ); @@ -114,12 +114,16 @@ Q_INVOKABLE void removeByIndex( int index ); /** - * Save the current playlist at the absolute path @param path. + * Save the current playlist at the absolute path @p path. + * + * @param path the absolute path. */ Q_INVOKABLE void savePlaylist( const QString& path ); /** * Set whether to stop playing after the current track. + * + * @param on @c true if on, @c false otherwise. */ Q_INVOKABLE void setStopAfterCurrent( bool on ); diff --git a/src/scripting/scriptengine/AmarokPlaylistScript.cpp b/src/scripting/scriptengine/AmarokPlaylistScript.cpp --- a/src/scripting/scriptengine/AmarokPlaylistScript.cpp +++ b/src/scripting/scriptengine/AmarokPlaylistScript.cpp @@ -39,9 +39,9 @@ , m_scriptEngine( engine ) { QScriptValue scriptObject = engine->newQObject( this, QScriptEngine::AutoOwnership, QScriptEngine::ExcludeSuperClassContents ); - engine->globalObject().property( "Amarok" ).setProperty( "Playlist", scriptObject ); - connect( The::playlist()->qaim(), SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT (slotTrackInserted(QModelIndex,int,int)) ); - connect( The::playlist()->qaim(), SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT (slotTrackRemoved(QModelIndex,int,int)) ); + engine->globalObject().property( QStringLiteral("Amarok") ).setProperty( QStringLiteral("Playlist"), scriptObject ); + connect( The::playlist()->qaim(), &QAbstractItemModel::rowsInserted, this, &AmarokPlaylistScript::slotTrackInserted ); + connect( The::playlist()->qaim(), &QAbstractItemModel::rowsRemoved, this, &AmarokPlaylistScript::slotTrackRemoved ); engine->registerArrayType< QList >(); } @@ -72,7 +72,7 @@ } void -AmarokPlaylistScript::addTrack( Meta::TrackPtr track ) +AmarokPlaylistScript::addTrack( const Meta::TrackPtr &track ) { The::playlistController()->insertOptioned( track ); } @@ -111,7 +111,7 @@ } void -AmarokPlaylistScript::playTrack( Meta::TrackPtr track ) +AmarokPlaylistScript::playTrack( const Meta::TrackPtr &track ) { The::playlistController()->insertOptioned( track, Playlist::OnPlayMediaAction ); } @@ -214,11 +214,11 @@ void AmarokPlaylistScript::slotTrackInserted( const QModelIndex&, int start, int end ) { - emit trackInserted( start, end ); + Q_EMIT trackInserted( start, end ); } void AmarokPlaylistScript::slotTrackRemoved( const QModelIndex&, int start, int end ) { - emit trackRemoved( start, end ); + Q_EMIT trackRemoved( start, end ); } diff --git a/src/scripting/scriptengine/AmarokScript.h b/src/scripting/scriptengine/AmarokScript.h --- a/src/scripting/scriptengine/AmarokScript.h +++ b/src/scripting/scriptengine/AmarokScript.h @@ -38,16 +38,16 @@ /** * Print debug output to the shell. Only printed if amarok is started with --debug. - * @text The text to print. + * @param text The text to print. */ Q_INVOKABLE void debug( const QString& text ) const; /** * Show an information dialog in Amarok. - * @text The text to display. - * @type Type of the dialog. See KMessageBox docs. + * @param text The text to display. + * @param type Type of the dialog. See KMessageBox docs. */ - Q_INVOKABLE int alert( const QString& text, const QString& type = "information" ) const; + Q_INVOKABLE int alert( const QString& text, const QString& type = QStringLiteral("information") ) const; /** Signals Amarok that this script has ended. */ Q_INVOKABLE void end(); @@ -76,7 +76,7 @@ */ void uninstalled(); - // TODO: actaully emit this signal + // TODO: actually Q_EMIT this signal void configured(); private: diff --git a/src/scripting/scriptengine/AmarokScript.cpp b/src/scripting/scriptengine/AmarokScript.cpp --- a/src/scripting/scriptengine/AmarokScript.cpp +++ b/src/scripting/scriptengine/AmarokScript.cpp @@ -32,7 +32,7 @@ { QScriptValue scriptObject = engine->newQObject( this, QScriptEngine::AutoOwnership, QScriptEngine::ExcludeSuperClassContents ); - engine->globalObject().setProperty( "Amarok", scriptObject ); + engine->globalObject().setProperty( QStringLiteral("Amarok"), scriptObject ); if( ScriptManager::instance()->m_scripts.contains( name ) ) connect( ScriptManager::instance()->m_scripts[name], &ScriptItem::uninstalled, this, &AmarokScript::uninstalled ); } @@ -53,33 +53,33 @@ AmarokScript::AmarokScript::alert( const QString& text, const QString& type ) const { //Ok = 1, Cancel = 2, Yes = 3, No = 4, Continue = 5 - if( type == "error" ) + if( type == QLatin1String("error") ) { - KMessageBox::error( 0, text ); + KMessageBox::error( nullptr, text ); return -1; } - else if( type == "sorry" ) + else if( type == QLatin1String("sorry") ) { - KMessageBox::sorry( 0, text ); + KMessageBox::sorry( nullptr, text ); return -1; } - else if( type == "information" ) + else if( type == QLatin1String("information") ) { - KMessageBox::information( 0, text ); + KMessageBox::information( nullptr, text ); return -1; } - else if( type == "questionYesNo" ) - return KMessageBox::questionYesNo( 0, text ); - else if( type == "questionYesNoCancel" ) - return KMessageBox::questionYesNo( 0, text ); - else if( type == "warningYesNo" ) - return KMessageBox::warningYesNo( 0, text ); - else if( type == "warningContinueCancel" ) - return KMessageBox::warningContinueCancel( 0, text ); - else if( type == "warningYesNoCancel" ) - return KMessageBox::warningYesNoCancel( 0, text ); + else if( type == QLatin1String("questionYesNo") ) + return KMessageBox::questionYesNo( nullptr, text ); + else if( type == QLatin1String("questionYesNoCancel") ) + return KMessageBox::questionYesNo( nullptr, text ); + else if( type == QLatin1String("warningYesNo") ) + return KMessageBox::warningYesNo( nullptr, text ); + else if( type == QLatin1String("warningContinueCancel") ) + return KMessageBox::warningContinueCancel( nullptr, text ); + else if( type == QLatin1String("warningYesNoCancel") ) + return KMessageBox::warningYesNoCancel( nullptr, text ); - debug( "alert type not found!" ); + debug( QStringLiteral("alert type not found!") ); return -1; } diff --git a/src/scripting/scriptengine/AmarokScriptConfig.cpp b/src/scripting/scriptengine/AmarokScriptConfig.cpp --- a/src/scripting/scriptengine/AmarokScriptConfig.cpp +++ b/src/scripting/scriptengine/AmarokScriptConfig.cpp @@ -32,7 +32,7 @@ QScriptValue scriptObject = engine->newQObject( this, QScriptEngine::AutoOwnership, QScriptEngine::ExcludeSuperClassContents ); //better name? - engine->globalObject().property( "Amarok" ).setProperty( "Script", scriptObject ); + engine->globalObject().property( QStringLiteral("Amarok") ).setProperty( QStringLiteral("Script"), scriptObject ); } QVariant diff --git a/src/scripting/scriptengine/AmarokScriptXml.h b/src/scripting/scriptengine/AmarokScriptXml.h --- a/src/scripting/scriptengine/AmarokScriptXml.h +++ b/src/scripting/scriptengine/AmarokScriptXml.h @@ -34,7 +34,7 @@ Q_OBJECT public: - AmarokScriptXml( QScriptEngine *engine ); + explicit AmarokScriptXml( QScriptEngine *engine ); ~AmarokScriptXml(); Q_INVOKABLE void setReaderData( const QString &data ); diff --git a/src/scripting/scriptengine/AmarokScriptXml.cpp b/src/scripting/scriptengine/AmarokScriptXml.cpp --- a/src/scripting/scriptengine/AmarokScriptXml.cpp +++ b/src/scripting/scriptengine/AmarokScriptXml.cpp @@ -29,12 +29,12 @@ AmarokScriptXml::AmarokScriptXml( QScriptEngine *engine ) : QObject( engine ) - , m_reader( Q_NULLPTR ) + , m_reader( nullptr ) , m_domDocument( new QDomDocument ) { QScriptValue scriptObject = engine->newQObject( this, QScriptEngine::AutoOwnership, QScriptEngine::ExcludeSuperClassContents ); - engine->globalObject().property( "Amarok" ).setProperty( "Xml", scriptObject ); + engine->globalObject().property( QStringLiteral("Amarok") ).setProperty( QStringLiteral("Xml"), scriptObject ); } AmarokScriptXml::~AmarokScriptXml() diff --git a/src/scripting/scriptengine/AmarokScriptableServiceScript.h b/src/scripting/scriptengine/AmarokScriptableServiceScript.h --- a/src/scripting/scriptengine/AmarokScriptableServiceScript.h +++ b/src/scripting/scriptengine/AmarokScriptableServiceScript.h @@ -39,10 +39,10 @@ Q_OBJECT public: - ScriptableServiceScript( QScriptEngine* engine ); + explicit ScriptableServiceScript( QScriptEngine* engine ); - void slotPopulate( QString name, int level, int parent_id, QString callbackData, QString filter ); - void slotRequestInfo( QString name, int level, QString callbackData ); + void slotPopulate(const QString &name, int level, int parent_id, const QString &callbackData, const QString &filter ); + void slotRequestInfo(const QString &name, int level, const QString &callbackData ); void slotCustomize( const QString &name ); @@ -64,8 +64,8 @@ static QScriptValue ScriptableServiceScript_prototype_populate( QScriptContext *context, QScriptEngine *engine ); Q_SIGNALS: - void populate( int, QString, QString ); - void fetchInfo( int, QString ); + void populate( int, const QString&, const QString& ); + void fetchInfo( int, const QString& ); void customize(); }; } diff --git a/src/scripting/scriptengine/AmarokScriptableServiceScript.cpp b/src/scripting/scriptengine/AmarokScriptableServiceScript.cpp --- a/src/scripting/scriptengine/AmarokScriptableServiceScript.cpp +++ b/src/scripting/scriptengine/AmarokScriptableServiceScript.cpp @@ -37,7 +37,7 @@ m_scriptEngine = engine; engine->setDefaultPrototype( qMetaTypeId(), QScriptValue() ); const QScriptValue ctor = engine->newFunction( ScriptableServiceScript_prototype_ctor ); - engine->globalObject().setProperty( "ScriptableServiceScript", ctor ); + engine->globalObject().setProperty( QStringLiteral("ScriptableServiceScript"), ctor ); } QScriptValue @@ -56,7 +56,7 @@ } QScriptValue obj = engine->newQObject( context->thisObject(), ScriptManager::instance()->m_scripts.value(serviceName)->service(), QScriptEngine::AutoOwnership, QScriptEngine::ExcludeSuperClassContents ); - engine->globalObject().setProperty( "ScriptableServiceScript", obj ); + engine->globalObject().setProperty( QStringLiteral("ScriptableServiceScript"), obj ); The::scriptableServiceManager()->initService( serviceName, levels, shortDescription, rootHtml, showSearchBar ); return engine->undefinedValue(); } @@ -87,28 +87,28 @@ } void -ScriptableServiceScript::slotPopulate( QString name, int level, int parent_id, QString callbackData, QString filter ) +ScriptableServiceScript::slotPopulate( const QString &name, int level, int parent_id, const QString &callbackData, const QString &filter ) { DEBUG_BLOCK m_currentId = parent_id; m_serviceName = name; - emit( populate( level, callbackData, filter ) ); + Q_EMIT( populate( level, callbackData, filter ) ); } void -ScriptableServiceScript::slotRequestInfo( QString name, int level, QString callbackData ) +ScriptableServiceScript::slotRequestInfo( const QString &name, int level, const QString &callbackData ) { DEBUG_BLOCK m_serviceName = name; - emit( fetchInfo( level, callbackData ) ); + Q_EMIT( fetchInfo( level, callbackData ) ); } void ScriptableServiceScript::slotCustomize( const QString &name ) { DEBUG_BLOCK m_serviceName = name; - emit( customize() ); + Q_EMIT( customize() ); } diff --git a/src/scripting/scriptengine/AmarokServicePluginManagerScript.h b/src/scripting/scriptengine/AmarokServicePluginManagerScript.h --- a/src/scripting/scriptengine/AmarokServicePluginManagerScript.h +++ b/src/scripting/scriptengine/AmarokServicePluginManagerScript.h @@ -31,7 +31,7 @@ Q_OBJECT public: - AmarokServicePluginManagerScript( QScriptEngine* scriptEngine ); + explicit AmarokServicePluginManagerScript( QScriptEngine* scriptEngine ); Q_INVOKABLE QStringList loadedServices(); Q_INVOKABLE QStringList loadedServiceNames(); diff --git a/src/scripting/scriptengine/AmarokServicePluginManagerScript.cpp b/src/scripting/scriptengine/AmarokServicePluginManagerScript.cpp --- a/src/scripting/scriptengine/AmarokServicePluginManagerScript.cpp +++ b/src/scripting/scriptengine/AmarokServicePluginManagerScript.cpp @@ -28,7 +28,7 @@ { QScriptValue scriptObject = engine->newQObject( this, QScriptEngine::AutoOwnership, QScriptEngine::ExcludeSuperClassContents ); - engine->globalObject().property( "Amarok" ).setProperty( "ServicePluginManager", scriptObject ); + engine->globalObject().property( QStringLiteral("Amarok") ).setProperty( QStringLiteral("ServicePluginManager"), scriptObject ); } QStringList diff --git a/src/scripting/scriptengine/AmarokStatusbarScript.h b/src/scripting/scriptengine/AmarokStatusbarScript.h --- a/src/scripting/scriptengine/AmarokStatusbarScript.h +++ b/src/scripting/scriptengine/AmarokStatusbarScript.h @@ -29,7 +29,7 @@ Q_OBJECT public: - AmarokStatusbarScript( QScriptEngine* scriptEngine ); + explicit AmarokStatusbarScript( QScriptEngine* scriptEngine ); Q_INVOKABLE void longMessage( const QString &text ); Q_INVOKABLE void shortMessage( const QString &text ); diff --git a/src/scripting/scriptengine/AmarokStatusbarScript.cpp b/src/scripting/scriptengine/AmarokStatusbarScript.cpp --- a/src/scripting/scriptengine/AmarokStatusbarScript.cpp +++ b/src/scripting/scriptengine/AmarokStatusbarScript.cpp @@ -16,7 +16,7 @@ #include "AmarokStatusbarScript.h" -#include "core/interfaces/Logger.h" +#include "core/logger/Logger.h" #include "core/support/Components.h" #include @@ -28,18 +28,18 @@ { QScriptValue scriptObject = engine->newQObject( this, QScriptEngine::AutoOwnership, QScriptEngine::ExcludeSuperClassContents ); - QScriptValue windowObject = engine->globalObject().property( "Amarok" ).property( "Window" ); - windowObject.setProperty( "Statusbar", scriptObject ); + QScriptValue windowObject = engine->globalObject().property( QStringLiteral("Amarok") ).property( QStringLiteral("Window") ); + windowObject.setProperty( QStringLiteral("Statusbar"), scriptObject ); } void AmarokStatusbarScript::longMessage( const QString &text ) { - Amarok::Components::logger()->longMessage( text ); + Amarok::Logger::longMessage( text ); } void AmarokStatusbarScript::shortMessage( const QString &text ) { - Amarok::Components::logger()->shortMessage( text ); + Amarok::Logger::shortMessage( text ); } diff --git a/src/scripting/scriptengine/AmarokStreamItemScript.h b/src/scripting/scriptengine/AmarokStreamItemScript.h --- a/src/scripting/scriptengine/AmarokStreamItemScript.h +++ b/src/scripting/scriptengine/AmarokStreamItemScript.h @@ -44,7 +44,7 @@ Q_PROPERTY( QString coverUrl WRITE setCoverUrl READ coverUrl ) public: - StreamItem( QScriptEngine *engine ); + explicit StreamItem( QScriptEngine *engine ); QString itemName() const; QString infoHtml() const; @@ -60,18 +60,18 @@ QString coverUrl(); private: - void setItemName( QString name ); - void setInfoHtml( QString infoHtml ); - void setPlayableUrl( QString playableUrl ); - void setCallbackData( QString callbackData ); + void setItemName( const QString &name ); + void setInfoHtml( const QString &infoHtml ); + void setPlayableUrl( const QString &playableUrl ); + void setCallbackData( const QString &callbackData ); void setLevel( int level ); - void setAlbum( QString album ); - void setArtist( QString artist ); - void setGenre( QString genre ); - void setComposer( QString composer ); + void setAlbum( const QString &album ); + void setArtist( const QString &artist ); + void setGenre( const QString &genre ); + void setComposer( const QString &composer ); void setYear( int year ); - void setCoverUrl( QString url ); + void setCoverUrl( const QString &url ); QString m_name; QString m_infoHtml; diff --git a/src/scripting/scriptengine/AmarokStreamItemScript.cpp b/src/scripting/scriptengine/AmarokStreamItemScript.cpp --- a/src/scripting/scriptengine/AmarokStreamItemScript.cpp +++ b/src/scripting/scriptengine/AmarokStreamItemScript.cpp @@ -29,7 +29,7 @@ { QScriptValue scriptObject = engine->newQObject( this, QScriptEngine::AutoOwnership, QScriptEngine::ExcludeSuperClassContents ); - engine->globalObject().property( "Amarok" ).setProperty( "StreamItem", scriptObject ); + engine->globalObject().property( QStringLiteral("Amarok") ).setProperty( QStringLiteral("StreamItem"), scriptObject ); engine->setDefaultPrototype( qMetaTypeId(), QScriptValue() ); } @@ -102,25 +102,25 @@ void -StreamItem::setItemName( QString name ) +StreamItem::setItemName( const QString &name ) { m_name = name; } void -StreamItem::setInfoHtml( QString infoHtml ) +StreamItem::setInfoHtml( const QString &infoHtml ) { m_infoHtml = infoHtml; } void -StreamItem::setPlayableUrl( QString playableUrl ) +StreamItem::setPlayableUrl( const QString &playableUrl ) { m_playableUrl = playableUrl; } void -StreamItem::setCallbackData( QString callbackData ) +StreamItem::setCallbackData( const QString &callbackData ) { m_callbackData = callbackData; } @@ -132,25 +132,25 @@ } void -StreamItem::setAlbum( QString album ) +StreamItem::setAlbum( const QString &album ) { m_album = album; } void -StreamItem::setArtist( QString artist ) +StreamItem::setArtist( const QString &artist ) { m_artist = artist; } void -StreamItem::setGenre( QString genre ) +StreamItem::setGenre( const QString &genre ) { m_genre = genre; } void -StreamItem::setComposer( QString composer ) +StreamItem::setComposer( const QString &composer ) { m_composer = composer; } @@ -162,7 +162,7 @@ } void -StreamItem::setCoverUrl( QString url ) +StreamItem::setCoverUrl( const QString &url ) { m_coverUrl = url; } diff --git a/src/scripting/scriptengine/AmarokWindowScript.h b/src/scripting/scriptengine/AmarokWindowScript.h --- a/src/scripting/scriptengine/AmarokWindowScript.h +++ b/src/scripting/scriptengine/AmarokWindowScript.h @@ -26,11 +26,9 @@ #include #include -class EventFilter; class QMenu; class QMainWindow; class QMenu; -class QScriptEngine; namespace AmarokScript { @@ -51,23 +49,21 @@ Q_PROPERTY( QPalette palette READ palette WRITE setPalette ) public: - AmarokWindowScript( AmarokScriptEngine* scriptEngine ); + explicit AmarokWindowScript( AmarokScriptEngine* scriptEngine ); Q_INVOKABLE void addToolsMenu( const QString &name ); Q_INVOKABLE void addSettingsMenu( const QString &name ); - Q_INVOKABLE bool addToolsAction( QString id, QString actionName, QString icon = "amarok" ); + Q_INVOKABLE bool addToolsAction( const QString &id, const QString &actionName, const QString &icon = QStringLiteral("amarok") ); Q_INVOKABLE void addToolsSeparator(); - Q_INVOKABLE bool addSettingsAction( QString id, QString actionName, QString icon = "amarok" ); - Q_INVOKABLE bool addCustomAction( QString menuName, QString id, QString actionName, QString icon = "amarok" ); + Q_INVOKABLE bool addSettingsAction( const QString &id, const QString &actionName, const QString &icon = QStringLiteral("amarok") ); + Q_INVOKABLE bool addCustomAction( const QString &menuName, const QString &id, const QString &actionName, const QString &icon = QStringLiteral("amarok") ); Q_INVOKABLE void addSettingsSeparator(); Q_INVOKABLE void showTrayIcon( bool show ); /** * Show tooltips with the widget's name on mouseover. - * @param showDelay the duration after which toolTip appears. - * @param copyDelay the duration after * - * Must restart Amarok afetr invoking this function to revert tooltips + * Must restart Amarok after invoking this function to revert tooltips * to normal. */ Q_INVOKABLE void showToolTip(); @@ -88,7 +84,7 @@ * * @return true if adding the action was successful, false otherwise */ - bool addMenuAction( QMenu *menu, QString id, QString actionName, QString menuProperty, QString icon ); + bool addMenuAction( QMenu *menu, const QString &id, const QString &actionName, const QString &menuProperty, const QString &icon ); QString activeBrowserName(); bool isTrayIconShown(); diff --git a/src/scripting/scriptengine/AmarokWindowScript.cpp b/src/scripting/scriptengine/AmarokWindowScript.cpp --- a/src/scripting/scriptengine/AmarokWindowScript.cpp +++ b/src/scripting/scriptengine/AmarokWindowScript.cpp @@ -41,7 +41,7 @@ private: ToolTipEventFilter(); - bool eventFilter( QObject *object, QEvent *event ); + bool eventFilter( QObject *object, QEvent *event ) override; static QPointer s_instance; }; @@ -78,10 +78,10 @@ { QScriptValue windowObject = scriptEngine->newQObject( this, QScriptEngine::AutoOwnership, QScriptEngine::ExcludeSuperClassContents ); - scriptEngine->globalObject().property( "Amarok" ).setProperty( "Window", windowObject ); + scriptEngine->globalObject().property( QStringLiteral("Amarok") ).setProperty( QStringLiteral("Window"), windowObject ); - windowObject.setProperty( "ToolsMenu", scriptEngine->newObject() ); - windowObject.setProperty( "SettingsMenu", scriptEngine->newObject() ); + windowObject.setProperty( QStringLiteral("ToolsMenu"), scriptEngine->newObject() ); + windowObject.setProperty( QStringLiteral("SettingsMenu"), scriptEngine->newObject() ); connect( pApp, &App::prepareToQuit, this, &AmarokWindowScript::prepareToQuit ); } @@ -96,7 +96,7 @@ m_customMenus.insert( name, menu ); m_toolsMenu->addMenu( menu ); QScriptValue scriptMenu = m_scriptEngine->newQObject( menu ); - m_scriptEngine->globalObject().property( "Amarok" ).property( "Window" ).setProperty( name, scriptMenu ); + m_scriptEngine->globalObject().property( QStringLiteral("Amarok") ).property( QStringLiteral("Window") ).setProperty( name, scriptMenu ); } void @@ -109,13 +109,13 @@ m_customMenus.insert( name, menu ); m_settingsMenu->addMenu( menu ); QScriptValue scriptMenu = m_scriptEngine->newQObject( menu ); - m_scriptEngine->globalObject().property( "Amarok" ).property( "Window" ).setProperty( name, scriptMenu ); + m_scriptEngine->globalObject().property( QStringLiteral("Amarok") ).property( QStringLiteral("Window") ).setProperty( name, scriptMenu ); } bool -AmarokWindowScript::addToolsAction( QString id, QString actionName, QString icon ) +AmarokWindowScript::addToolsAction( const QString &id, const QString &actionName, const QString &icon ) { - return addMenuAction( m_toolsMenu, id, actionName, "ToolsMenu", icon ); + return addMenuAction( m_toolsMenu, id, actionName, QStringLiteral("ToolsMenu"), icon ); } void @@ -125,13 +125,13 @@ } bool -AmarokWindowScript::addSettingsAction( QString id, QString actionName, QString icon ) +AmarokWindowScript::addSettingsAction( const QString &id, const QString &actionName, const QString &icon ) { - return addMenuAction( m_settingsMenu, id, actionName, "SettingsMenu", icon ); + return addMenuAction( m_settingsMenu, id, actionName, QStringLiteral("SettingsMenu"), icon ); } bool -AmarokScript::AmarokWindowScript::addCustomAction(QString menuName, QString id, QString actionName, QString icon) +AmarokScript::AmarokWindowScript::addCustomAction(const QString &menuName, const QString &id, const QString &actionName, const QString &icon) { if( !m_customMenus.contains( menuName ) ) return false; @@ -146,7 +146,7 @@ } bool -AmarokWindowScript::addMenuAction( QMenu *menu, QString id, QString actionName, QString menuProperty, QString icon ) +AmarokWindowScript::addMenuAction( QMenu *menu, const QString &id, const QString &actionName, const QString &menuProperty, const QString &icon ) { KActionCollection* const ac = Amarok::actionCollection(); if( ac->action( id ) ) @@ -163,7 +163,7 @@ menu->addAction( ac->action( id ) ); QScriptValue newMenu = m_scriptEngine->newQObject( action ); - m_scriptEngine->globalObject().property( "Amarok" ).property( "Window" ).property( menuProperty ).setProperty( id, newMenu ); + m_scriptEngine->globalObject().property( QStringLiteral("Amarok") ).property( QStringLiteral("Window") ).property( menuProperty ).setProperty( id, newMenu ); return true; } diff --git a/src/scripting/scriptengine/ScriptImporter.h b/src/scripting/scriptengine/ScriptImporter.h --- a/src/scripting/scriptengine/ScriptImporter.h +++ b/src/scripting/scriptengine/ScriptImporter.h @@ -23,7 +23,6 @@ #include #include -class QScriptEngine; class QStringList; namespace AmarokScript diff --git a/src/scripting/scriptengine/ScriptImporter.cpp b/src/scripting/scriptengine/ScriptImporter.cpp --- a/src/scripting/scriptengine/ScriptImporter.cpp +++ b/src/scripting/scriptengine/ScriptImporter.cpp @@ -39,7 +39,7 @@ { QScriptValue scriptObject = scriptEngine->newQObject( this, QScriptEngine::AutoOwnership , QScriptEngine::ExcludeSuperClassContents ); - scriptEngine->globalObject().setProperty( "Importer", scriptObject ); + scriptEngine->globalObject().setProperty( QStringLiteral("Importer"), scriptObject ); } void @@ -63,7 +63,7 @@ { QUrl includeUrl = KIO::upUrl(m_scriptUrl); includeUrl = includeUrl.adjusted(QUrl::StripTrailingSlash); - includeUrl.setPath(includeUrl.path() + '/' + ( relativeFilename )); + includeUrl.setPath(includeUrl.path() + QLatin1Char('/') + ( relativeFilename )); QFile file( includeUrl.toLocalFile() ); if ( !file.open( QIODevice::ReadOnly | QIODevice::Text ) ) { @@ -85,11 +85,11 @@ bool ScriptImporter::loadAmarokBinding( const QString &name ) { - if( name == "bookmarks" ) + if( name == QLatin1String("bookmarks") ) new AmarokBookmarkScript( m_scriptEngine ); - else if( name == "collectionview" ) + else if( name == QLatin1String("collectionview") ) new AmarokCollectionViewScript( m_scriptEngine, ScriptManager::instance()->scriptNameForEngine( m_scriptEngine ) ); - else if( name == "playlistmanager" ) + else if( name == QLatin1String("playlistmanager") ) new AmarokPlaylistManagerScript( m_scriptEngine ); else { diff --git a/src/scripting/scriptengine/ScriptingDefines.h b/src/scripting/scriptengine/ScriptingDefines.h --- a/src/scripting/scriptengine/ScriptingDefines.h +++ b/src/scripting/scriptengine/ScriptingDefines.h @@ -60,7 +60,7 @@ template void fromScriptArray( const QScriptValue &value, Container &container ) { - quint32 len = value.property( "length" ).toUInt32(); + quint32 len = value.property( QStringLiteral("length") ).toUInt32(); for( quint32 i = 0; i < len; ++i ) { QScriptValue item = value.property( i ); @@ -97,7 +97,7 @@ Q_OBJECT public: - AmarokScriptEngine( QObject *parent ); + explicit AmarokScriptEngine( QObject *parent ); virtual ~AmarokScriptEngine(); void setDeprecatedProperty( const QString &parent, const QString &name, const QScriptValue &property ); @@ -131,7 +131,7 @@ void slotTimeout(); Q_SIGNALS: - void deprecatedCall(QString); + void deprecatedCall(const QString &); private: const QString internalObject; diff --git a/src/scripting/scriptengine/ScriptingDefines.cpp b/src/scripting/scriptengine/ScriptingDefines.cpp --- a/src/scripting/scriptengine/ScriptingDefines.cpp +++ b/src/scripting/scriptengine/ScriptingDefines.cpp @@ -25,21 +25,21 @@ AmarokScriptEngine::AmarokScriptEngine( QObject *parent ) : QScriptEngine(parent) -, internalObject( "UndocumentedAmarokScriptingInternals" ) +, internalObject( QStringLiteral("UndocumentedAmarokScriptingInternals") ) { QScriptValue scriptObject = newQObject( this, QtOwnership, ExcludeChildObjects | ExcludeSuperClassContents ); globalObject().setProperty( internalObject, scriptObject, QScriptValue::ReadOnly ); - QScriptValue setTimeoutObject = scriptObject.property( "setTimeout" ); + QScriptValue setTimeoutObject = scriptObject.property( QStringLiteral("setTimeout") ); Q_ASSERT( !setTimeoutObject.isUndefined() ); Q_ASSERT( !globalObject().property( internalObject ).property( "invokableDeprecatedCall" ).isUndefined() ); - globalObject().setProperty( "setTimeout", setTimeoutObject ); + globalObject().setProperty( QStringLiteral("setTimeout"), setTimeoutObject ); } void AmarokScriptEngine::setDeprecatedProperty( const QString &parent, const QString &name, const QScriptValue &property ) { - const QString objName = QString( "%1%2" ).arg( name, QString::number( qrand() ) ); + const QString objName = QStringLiteral( "%1%2" ).arg( name, QString::number( qrand() ) ); globalObject().property( internalObject ).setProperty( objName, property, QScriptValue::ReadOnly | QScriptValue::SkipInEnumeration ); const QString command = QString( "Object.defineProperty( %1, \"%2\", {get : function(){ var iobj= %3; iobj.invokableDeprecatedCall(\"" " %1.%2 \"); return iobj.%4; },\ @@ -53,7 +53,7 @@ AmarokScriptEngine::invokableDeprecatedCall( const QString &call ) { warning() << "Deprecated function " + call; - emit deprecatedCall( call ); + Q_EMIT deprecatedCall( call ); } void @@ -80,7 +80,7 @@ { thisObject = m_callbacks[timer][1]; if( m_callbacks[timer].size() == 3 ) - for ( quint32 i = 0; i < m_callbacks[timer][2].property("length").toUInt32(); ++i ) + for ( quint32 i = 0; i < m_callbacks[timer][2].property(QStringLiteral("length")).toUInt32(); ++i ) args << m_callbacks[timer][2].property( i ); } m_callbacks[timer][0].call( thisObject, args ); diff --git a/src/scripting/scriptengine/exporters/CollectionTypeExporter.h b/src/scripting/scriptengine/exporters/CollectionTypeExporter.h --- a/src/scripting/scriptengine/exporters/CollectionTypeExporter.h +++ b/src/scripting/scriptengine/exporters/CollectionTypeExporter.h @@ -34,7 +34,6 @@ class QueryMaker; } class QScriptEngine; -class QScriptValue; namespace AmarokScript { @@ -112,7 +111,7 @@ Q_PROPERTY( QString prettyLocation READ prettyLocation ) /** - * Returns a list of machine usable string*s representingthe collection location. + * Returns a list of machine usable string*s representing the collection location. * For example, a local collection would return a list of paths where tracks are * stored, while an Ampache collection would return a list with one string * containing the URL of an ampache server. Empty for collections like iPod collection and @@ -133,13 +132,16 @@ /** * Copy a single track to the destination collection */ - Q_INVOKABLE void copyTracks( const Meta::TrackPtr track, Collections::Collection *targetCollection ); + Q_INVOKABLE void copyTracks( const Meta::TrackPtr &track, Collections::Collection *targetCollection ); /** * Convenience method for copying tracks based on QueryMaker results, - * takes ownership of the @param qm (The querymaker is rendered invalid + * takes ownership of the @p queryMaker. (The querymaker is rendered invalid * after copying). * @see copyTracks( Meta::TrackList, CollectionLocation* ) + * + * @param queryMaker the Query maker. + * @param targetCollection the target collection. */ Q_INVOKABLE void queryAndCopyTracks( Collections::QueryMaker *queryMaker, Collections::Collection *targetCollection ); @@ -151,13 +153,16 @@ /** * Move a single track to the destination collection. */ - Q_INVOKABLE void moveTracks( const Meta::TrackPtr track, Collections::Collection *targetCollection ); + Q_INVOKABLE void moveTracks( const Meta::TrackPtr &track, Collections::Collection *targetCollection ); /** * Convenience method for moving tracks based on QueryMaker results, - * takes ownership of the @param qm (The querymaker is rendered invalid + * takes ownership of the @p queryMaker (The querymaker is rendered invalid * after moving). * @see moveTracks( Meta::TrackList, CollectionLocation* ) + * + * @param queryMaker the Query maker. + * @param targetCollection the target collection. */ Q_INVOKABLE void queryAndMoveTracks( Collections::QueryMaker *queryMaker, Collections::Collection *targetCollection ); @@ -169,7 +174,7 @@ /** * Remove single track from collection. */ - Q_INVOKABLE void removeTracks( const Meta::TrackPtr track ); + Q_INVOKABLE void removeTracks( const Meta::TrackPtr &track ); /** * Convenience method for removing tracks selected by QueryMaker, @@ -216,7 +221,7 @@ void updated(); /** - * Emited when this collection is removed. + * Emitted when this collection is removed. */ void removed(); diff --git a/src/scripting/scriptengine/exporters/CollectionTypeExporter.cpp b/src/scripting/scriptengine/exporters/CollectionTypeExporter.cpp --- a/src/scripting/scriptengine/exporters/CollectionTypeExporter.cpp +++ b/src/scripting/scriptengine/exporters/CollectionTypeExporter.cpp @@ -45,7 +45,7 @@ //script invokable void -CollectionPrototype::copyTracks( const Meta::TrackPtr track, Collection* targetCollection ) +CollectionPrototype::copyTracks( const Meta::TrackPtr &track, Collection* targetCollection ) { copyTracks( Meta::TrackList() << track, targetCollection ); } @@ -69,7 +69,7 @@ } void -CollectionPrototype::moveTracks( const Meta::TrackPtr track, Collection *targetCollection ) +CollectionPrototype::moveTracks( const Meta::TrackPtr &track, Collection *targetCollection ) { moveTracks( Meta::TrackList() << track, targetCollection ); } @@ -99,7 +99,7 @@ collection->location()->prepareRemove( removeInvalidTracks( list ) ); } -void CollectionPrototype::removeTracks( const Meta::TrackPtr track ) +void CollectionPrototype::removeTracks( const Meta::TrackPtr &track ) { removeTracks( Meta::TrackList() << track ); } @@ -211,14 +211,14 @@ //private CollectionPrototype::CollectionPrototype( Collection *collection ) -: QObject( 0 ) //script owned +: QObject( nullptr ) //script owned , m_collection( collection ) { - connect( collection, SIGNAL(updated()), SIGNAL(updated()) ); - connect( collection->location(), SIGNAL(aborted()), SIGNAL(aborted()) ); - connect( collection->location(), SIGNAL(finishCopy()), SIGNAL(finishCopy()) ); - connect( collection->location(), SIGNAL(finishRemove()), SIGNAL(finishRemove()) ); - connect( collection, SIGNAL(remove()), SIGNAL(removed()) ); + connect( collection, &Collections::Collection::updated, this, &CollectionPrototype::updated ); + connect( collection->location(), &Collections::CollectionLocation::aborted, this, &CollectionPrototype::aborted ); + connect( collection->location(), &Collections::CollectionLocation::finishCopy, this, &CollectionPrototype::finishCopy ); + connect( collection->location(), &Collections::CollectionLocation::finishRemove, this, &CollectionPrototype::finishRemove ); + connect( collection, &Collections::Collection::remove, this, &CollectionPrototype::removed ); } Meta::TrackList diff --git a/src/scripting/scriptengine/exporters/MetaTypeExporter.h b/src/scripting/scriptengine/exporters/MetaTypeExporter.h --- a/src/scripting/scriptengine/exporters/MetaTypeExporter.h +++ b/src/scripting/scriptengine/exporters/MetaTypeExporter.h @@ -127,7 +127,7 @@ * @param respectConfig Whether to respect the user's preferences of writing tags to tracks. * * For example, - * var tags = {}; + * var tags = {} * tags["lyrics"] = "My lyrics"; * tags["title"]= "My Song"; * track.changeTags( tags ); @@ -143,12 +143,12 @@ private: Meta::TrackPtr m_track; - void metadataChanged( Meta::TrackPtr track ) override; - void metadataChanged( Meta::ArtistPtr artist ) override { Q_UNUSED( artist ) } - void metadataChanged( Meta::AlbumPtr album ) override { Q_UNUSED( album ) } - void metadataChanged( Meta::GenrePtr genre ) override { Q_UNUSED( genre ) } - void metadataChanged( Meta::ComposerPtr composer ) override { Q_UNUSED( composer ) } - void metadataChanged( Meta::YearPtr year ) override { Q_UNUSED( year ) } + void metadataChanged( const Meta::TrackPtr &track ) override; + void metadataChanged( const Meta::ArtistPtr &artist ) override { Q_UNUSED( artist ) } + void metadataChanged( const Meta::AlbumPtr &album ) override { Q_UNUSED( album ) } + void metadataChanged( const Meta::GenrePtr &genre ) override { Q_UNUSED( genre ) } + void metadataChanged( const Meta::ComposerPtr &composer ) override { Q_UNUSED( composer ) } + void metadataChanged( const Meta::YearPtr &year ) override { Q_UNUSED( year ) } QScriptEngine *m_engine; diff --git a/src/scripting/scriptengine/exporters/MetaTypeExporter.cpp b/src/scripting/scriptengine/exporters/MetaTypeExporter.cpp --- a/src/scripting/scriptengine/exporters/MetaTypeExporter.cpp +++ b/src/scripting/scriptengine/exporters/MetaTypeExporter.cpp @@ -53,18 +53,18 @@ qScriptRegisterMetaType( engine, toScriptArray, fromScriptArray ); qScriptRegisterMetaType( engine, toScriptMap, fromScriptMap ); qScriptRegisterMetaType( engine, toScriptTagMap, fromScriptTagMap ); - engine->globalObject().setProperty( "Track", engine->newFunction( trackCtor ) ); + engine->globalObject().setProperty( QStringLiteral("Track"), engine->newFunction( trackCtor ) ); } QScriptValue MetaTrackPrototype::trackCtor( QScriptContext *context, QScriptEngine *engine ) { if( context->argumentCount() < 1 ) - return context->throwError( QScriptContext::SyntaxError, "Not enough arguments! Pass the track url." ); + return context->throwError( QScriptContext::SyntaxError, QStringLiteral("Not enough arguments! Pass the track url.") ); QUrl url( qscriptvalue_cast( context->argument( 0 ) ) ); if( !url.isValid() ) - return context->throwError( QScriptContext::TypeError, "Invalid QUrl" ); + return context->throwError( QScriptContext::TypeError, QStringLiteral("Invalid QUrl") ); MetaProxy::TrackPtr proxyTrack( new MetaProxy::Track( url ) ); proxyTrack->setTitle( url.fileName() ); // set temporary name @@ -74,7 +74,7 @@ } MetaTrackPrototype::MetaTrackPrototype( const Meta::TrackPtr &track ) -: QObject( 0 ) +: QObject( nullptr ) , m_track( track ) { } @@ -372,11 +372,11 @@ } void -MetaTrackPrototype::metadataChanged( Meta::TrackPtr track ) +MetaTrackPrototype::metadataChanged(const Meta::TrackPtr &track ) { Observer::unsubscribeFrom( track ); debug() << "Loaded track: " << track->prettyName(); - emit loaded( track ); + Q_EMIT loaded( track ); } void diff --git a/src/scripting/scriptengine/exporters/PlaylistExporter.h b/src/scripting/scriptengine/exporters/PlaylistExporter.h --- a/src/scripting/scriptengine/exporters/PlaylistExporter.h +++ b/src/scripting/scriptengine/exporters/PlaylistExporter.h @@ -24,12 +24,10 @@ #include #include -class QScriptValue; class QScriptEngine; namespace AmarokScript { - class AmarokScriptEngine; // SCRIPTDOX PROTOTYPE Playlists::Playlist Playlist class PlaylistPrototype : public QObject, public Playlists::PlaylistObserver @@ -62,7 +60,7 @@ public: static void init( QScriptEngine *engine ); - PlaylistPrototype( Playlists::PlaylistPtr playlist ); + explicit PlaylistPrototype( Playlists::PlaylistPtr playlist ); Playlists::PlaylistPtr data() const { return m_playlist; } /** @@ -90,6 +88,7 @@ /** * Add the track to a certain position in the playlist * + * @param track the track. * @param position place to add this track. The default value -1 appends to * the end. * @@ -106,8 +105,8 @@ Q_INVOKABLE QString toString() const; private: - void trackAdded( Playlists::PlaylistPtr playlist, Meta::TrackPtr track, int position ) override; - void trackRemoved( Playlists::PlaylistPtr playlist, int position ) override; + void trackAdded( const Playlists::PlaylistPtr &playlist, const Meta::TrackPtr &track, int position ) override; + void trackRemoved( const Playlists::PlaylistPtr &playlist, int position ) override; bool isValid() const; QUrl uidUrl() const; diff --git a/src/scripting/scriptengine/exporters/PlaylistExporter.cpp b/src/scripting/scriptengine/exporters/PlaylistExporter.cpp --- a/src/scripting/scriptengine/exporters/PlaylistExporter.cpp +++ b/src/scripting/scriptengine/exporters/PlaylistExporter.cpp @@ -53,17 +53,17 @@ } void -PlaylistPrototype::trackAdded( Playlists::PlaylistPtr playlist, Meta::TrackPtr track, int position ) +PlaylistPrototype::trackAdded(const Playlists::PlaylistPtr &playlist, const Meta::TrackPtr &track, int position ) { Q_UNUSED( playlist ) - emit addedTrack( track, position ); + Q_EMIT addedTrack( track, position ); } void -PlaylistPrototype::trackRemoved( Playlists::PlaylistPtr playlist, int position ) +PlaylistPrototype::trackRemoved(const Playlists::PlaylistPtr &playlist, int position ) { Q_UNUSED( playlist ) - emit removedTrack( position ); + Q_EMIT removedTrack( position ); } void @@ -78,7 +78,7 @@ { if( m_playlist ) return m_playlist->provider(); - return 0; + return nullptr; } void @@ -99,7 +99,7 @@ // private PlaylistPrototype::PlaylistPrototype( Playlists::PlaylistPtr playlist ) -: QObject( 0 ) +: QObject( nullptr ) , m_playlist( playlist ) { PlaylistObserver::subscribeTo( playlist ); @@ -115,7 +115,7 @@ PlaylistPrototype::toString() const { if( !m_playlist ) - return QString( "Invalid" ); + return QStringLiteral( "Invalid" ); return m_playlist->name(); } diff --git a/src/scripting/scriptengine/exporters/PlaylistProviderExporter.h b/src/scripting/scriptengine/exporters/PlaylistProviderExporter.h --- a/src/scripting/scriptengine/exporters/PlaylistProviderExporter.h +++ b/src/scripting/scriptengine/exporters/PlaylistProviderExporter.h @@ -14,8 +14,8 @@ * this program. If not, see . * ****************************************************************************************/ -#ifndef PLAYLISTPROVIDER_TYPE_EXPORTER_H -#define PLAYLISTPROVIDER_TYPE_EXPORTER_H +#ifndef PLAYLISTPROVIDER_EXPORTER_H +#define PLAYLISTPROVIDER_EXPORTER_H #include "core/meta/forward_declarations.h" #include "core/playlists/PlaylistProvider.h" @@ -26,7 +26,6 @@ #include class QScriptEngine; -class QScriptValue; namespace Playlists @@ -82,7 +81,7 @@ public: static void init( QScriptEngine *engine ); - PlaylistProviderPrototype( Playlists::PlaylistProvider *provider ); + explicit PlaylistProviderPrototype( Playlists::PlaylistProvider *provider ); Playlists::PlaylistProvider* data() const { return m_provider.data(); } Q_INVOKABLE QString toString() const; diff --git a/src/scripting/scriptengine/exporters/PlaylistProviderExporter.cpp b/src/scripting/scriptengine/exporters/PlaylistProviderExporter.cpp --- a/src/scripting/scriptengine/exporters/PlaylistProviderExporter.cpp +++ b/src/scripting/scriptengine/exporters/PlaylistProviderExporter.cpp @@ -29,7 +29,7 @@ using namespace AmarokScript; PlaylistProviderPrototype::PlaylistProviderPrototype( Playlists::PlaylistProvider *provider ) -: QObject( 0 ) +: QObject( nullptr ) , m_provider( provider ) {} @@ -93,7 +93,7 @@ { if( m_provider ) return m_provider->prettyName(); - return QString( "Invalid" ); + return QStringLiteral( "Invalid" ); } // private diff --git a/src/scripting/scriptengine/exporters/QueryMakerExporter.h b/src/scripting/scriptengine/exporters/QueryMakerExporter.h --- a/src/scripting/scriptengine/exporters/QueryMakerExporter.h +++ b/src/scripting/scriptengine/exporters/QueryMakerExporter.h @@ -30,7 +30,6 @@ class QueryMaker; } class QScriptEngine; -class QScriptValue; namespace AmarokScript { @@ -68,7 +67,7 @@ Q_INVOKABLE void run(); /** - * Block until the query completes, returns the tracklist.. + * Block until the query completes, returns the tracklist. */ Q_INVOKABLE Meta::TrackList blockingRun(); diff --git a/src/scripting/scriptengine/exporters/QueryMakerExporter.cpp b/src/scripting/scriptengine/exporters/QueryMakerExporter.cpp --- a/src/scripting/scriptengine/exporters/QueryMakerExporter.cpp +++ b/src/scripting/scriptengine/exporters/QueryMakerExporter.cpp @@ -41,7 +41,7 @@ if( !m_querymaker ) return; Collections::addTextualFilter( m_querymaker.data(), filter ); - m_filter += filter + " "; + m_filter += filter + ' '; } void @@ -76,7 +76,7 @@ //private QueryMakerPrototype::QueryMakerPrototype( QueryMaker *queryMaker ) -: QObject( 0 ) //engine ownership +: QObject( nullptr ) //engine ownership , m_querymaker( queryMaker ) { if( !queryMaker ) diff --git a/src/scripting/scriptengine/exporters/ScriptableBiasExporter.h b/src/scripting/scriptengine/exporters/ScriptableBiasExporter.h --- a/src/scripting/scriptengine/exporters/ScriptableBiasExporter.h +++ b/src/scripting/scriptengine/exporters/ScriptableBiasExporter.h @@ -138,24 +138,24 @@ Q_OBJECT public: - ScriptableBias( ScriptableBiasFactory *biasProto ); + explicit ScriptableBias( ScriptableBiasFactory *biasProto ); ~ScriptableBias() override; QScriptValue scriptObject() { return m_biasObject; } public: void fromXml( QXmlStreamReader *reader ) override; void toXml(QXmlStreamWriter *writer) const override; Dynamic::TrackSet matchingTracks( const Meta::TrackList &playlist, int contextCount, - int finalCount, const Dynamic::TrackCollectionPtr universe ) const override; + int finalCount, const Dynamic::TrackCollectionPtr &universe ) const override; bool trackMatches( int position, const Meta::TrackList &playlist, int contextCount ) const override; QString toString() const override; QString name() const override; void paintOperator( QPainter *painter, const QRect &rect, AbstractBias *bias ) override; - QWidget* widget( QWidget *parent = 0 ) override; + QWidget* widget( QWidget *parent = nullptr ) override; private Q_SLOTS: Dynamic::TrackSet slotMatchingTracks( const Meta::TrackList &playlist, int contextCount, - int finalCount, const Dynamic::TrackCollectionPtr universe ) const; + int finalCount, const Dynamic::TrackCollectionPtr &universe ) const; void removeBias(); public Q_SLOTS: @@ -170,7 +170,7 @@ * @param newBias The bias that replaces this bias. If you give * an empty BiasPrt as argument the bias will be removed. */ - void replace( Dynamic::BiasPtr newBias ) override; + void replace( const Dynamic::BiasPtr &newBias ) override; /** * Call after an outstanding result is completed @@ -227,7 +227,7 @@ */ Q_INVOKABLE bool containsUid( const QString& uid ) const; - Q_INVOKABLE bool containsTrack( const Meta::TrackPtr track ) const; + Q_INVOKABLE bool containsTrack( const Meta::TrackPtr &track ) const; /** * Returns the uids of a random track contains in this set @@ -240,12 +240,16 @@ Q_INVOKABLE void uniteTrack( const Meta::TrackPtr &track ); /** - * Add the track @param track to the trackset. + * Add the track set @p trackSet to the trackset. + * + * @param trackSet the track set to be added. */ Q_INVOKABLE void uniteTrackSet( const Dynamic::TrackSet &trackSet ); /** - * Add the track @param track to the trackset. + * Add the uids @p uids to the trackset. + * + * @param uids string list of the uids. */ Q_INVOKABLE void uniteUids( const QStringList &uids ); @@ -255,12 +259,12 @@ Q_INVOKABLE void intersectTrackSet( const Dynamic::TrackSet &trackSet ); /** - * Perform an intersection on this trackset with the tracksset represtente by @param uids + * Perform an intersection on this trackset with the trackset represented by @param uids */ Q_INVOKABLE void intersectUids( const QStringList &uids ); /** - * Subtraact the track @param track from this trackset. + * Subtract the track @param track from this trackset. */ Q_INVOKABLE void subtractTrack( const Meta::TrackPtr &track ); @@ -276,7 +280,7 @@ private: static void init( QScriptEngine *engine ); - TrackSetExporter( const Dynamic::TrackSet &trackSet ); + explicit TrackSetExporter( const Dynamic::TrackSet &trackSet ); friend class ScriptableBiasFactory; }; diff --git a/src/scripting/scriptengine/exporters/ScriptableBiasExporter.cpp b/src/scripting/scriptengine/exporters/ScriptableBiasExporter.cpp --- a/src/scripting/scriptengine/exporters/ScriptableBiasExporter.cpp +++ b/src/scripting/scriptengine/exporters/ScriptableBiasExporter.cpp @@ -35,9 +35,9 @@ ScriptableBiasFactory::init( QScriptEngine *engine ) { TrackSetExporter::init( engine ); - engine->globalObject().setProperty( "BiasFactory", engine->newFunction( biasCtor ), + engine->globalObject().setProperty( QStringLiteral("BiasFactory"), engine->newFunction( biasCtor ), QScriptValue:: Undeletable | QScriptValue::ReadOnly ); - engine->globalObject().setProperty( "GroupBiasFactory", engine->newFunction( groupBiasCtor ), + engine->globalObject().setProperty( QStringLiteral("GroupBiasFactory"), engine->newFunction( groupBiasCtor ), QScriptValue:: Undeletable | QScriptValue::ReadOnly ); } @@ -279,7 +279,7 @@ } Dynamic::TrackSet -ScriptableBias::matchingTracks( const Meta::TrackList &playlist, int contextCount, int finalCount, const Dynamic::TrackCollectionPtr universe ) const +ScriptableBias::matchingTracks(const Meta::TrackList &playlist, int contextCount, int finalCount, const Dynamic::TrackCollectionPtr &universe ) const { DEBUG_BLOCK if( QThread::currentThread() == QCoreApplication::instance()->thread() ) @@ -298,7 +298,7 @@ } Dynamic::TrackSet -ScriptableBias::slotMatchingTracks( const Meta::TrackList &playlist, int contextCount, int finalCount, const Dynamic::TrackCollectionPtr universe ) const +ScriptableBias::slotMatchingTracks( const Meta::TrackList &playlist, int contextCount, int finalCount, const Dynamic::TrackCollectionPtr &universe ) const { Q_ASSERT( QThread::currentThread() == QCoreApplication::instance()->thread() ); if( m_scriptBias->matchingTracksFunction().isFunction() ) @@ -329,7 +329,7 @@ ScriptableBias::ready( const Dynamic::TrackSet &trackSet ) { debug() << "Received trackset, count: " << trackSet.trackCount() << "Is outstanding:" << trackSet.isOutstanding(); - emit resultReady( trackSet ); + Q_EMIT resultReady( trackSet ); } void @@ -339,7 +339,7 @@ } void -ScriptableBias::replace( Dynamic::BiasPtr newBias ) +ScriptableBias::replace(const Dynamic::BiasPtr &newBias ) { Dynamic::AbstractBias::replace( newBias ); } @@ -387,7 +387,7 @@ TrackSetExporter::init( QScriptEngine *engine ) { qScriptRegisterMetaType( engine, toScriptValue, fromScriptValue ); - engine->globalObject().setProperty( "TrackSet", engine->newFunction( trackSetConstructor ), + engine->globalObject().setProperty( QStringLiteral("TrackSet"), engine->newFunction( trackSetConstructor ), QScriptValue:: Undeletable | QScriptValue::ReadOnly ); } @@ -478,7 +478,7 @@ } if( invalid ) { - context->throwError( QScriptContext::SyntaxError, "Invalid arguments for TrackSet!" ); + context->throwError( QScriptContext::SyntaxError, QStringLiteral("Invalid arguments for TrackSet!") ); return engine->undefinedValue(); } @@ -549,13 +549,13 @@ } bool -TrackSetExporter::containsTrack( const Meta::TrackPtr track ) const +TrackSetExporter::containsTrack( const Meta::TrackPtr &track ) const { return Dynamic::TrackSet::contains( track ); } // private TrackSetExporter::TrackSetExporter( const Dynamic::TrackSet &trackSet ) -: QObject( 0 ) +: QObject( nullptr ) , TrackSet( trackSet ) {} diff --git a/src/scripting/scriptmanager/ScriptItem.h b/src/scripting/scriptmanager/ScriptItem.h --- a/src/scripting/scriptmanager/ScriptItem.h +++ b/src/scripting/scriptmanager/ScriptItem.h @@ -33,15 +33,14 @@ class AmarokScript; } class ScriptItem; -class QScriptContext; class QScriptEngine; class QTimerEvent; class ScriptTerminatorWidget : public PopupWidget { Q_OBJECT public: - ScriptTerminatorWidget( const QString &message ); + explicit ScriptTerminatorWidget( const QString &message ); Q_SIGNALS: void terminate(); @@ -52,16 +51,16 @@ Q_OBJECT public: ScriptItem( QObject *parent, const QString &name, const QString &path, const KPluginInfo &info ); - virtual ~ScriptItem(); + ~ScriptItem() override; QString name() const { return m_name; } AmarokScript::AmarokScriptEngine* engine() { return m_engine.data(); } AmarokScript::ScriptableServiceScript* service() { return m_service.data(); } QUrl url() const { return m_url; } KPluginInfo info() const { return m_info; } bool running() const { return m_running; } QString specPath() const; - QString output() const { return m_output.join("\n"); } + QString output() const { return m_output.join(QStringLiteral("\n")); } virtual bool start( bool silent ); virtual void pause(); @@ -76,7 +75,7 @@ virtual void slotDeprecatedCall( const QString &call ); private Q_SLOTS: - virtual void timerEvent( QTimerEvent *event ); + void timerEvent( QTimerEvent *event ) override; Q_SIGNALS: void signalHandlerException(QScriptValue); diff --git a/src/scripting/scriptmanager/ScriptItem.cpp b/src/scripting/scriptmanager/ScriptItem.cpp --- a/src/scripting/scriptmanager/ScriptItem.cpp +++ b/src/scripting/scriptmanager/ScriptItem.cpp @@ -27,7 +27,7 @@ #include "core/support/Amarok.h" #include "core/support/Debug.h" #include "core/support/Components.h" -#include "core/interfaces/Logger.h" +#include "core/logger/Logger.h" #include "MainWindow.h" #include "amarokconfig.h" #include "config.h" @@ -37,7 +37,6 @@ #include "scripting/scriptengine/AmarokEngineScript.h" #include "scripting/scriptengine/AmarokInfoScript.h" #include "scripting/scriptengine/AmarokKNotifyScript.h" -#include "scripting/scriptengine/AmarokLyricsScript.h" #include "scripting/scriptengine/AmarokNetworkScript.h" #include "scripting/scriptengine/AmarokOSDScript.h" #include "scripting/scriptengine/AmarokPlaylistScript.h" @@ -91,7 +90,7 @@ alabel->setPalette( p ); QPushButton *button = new QPushButton( i18n( "Terminate" ), this ); - button->setPalette(p);; + button->setPalette(p); connect( button, &QAbstractButton::clicked, this, &ScriptTerminatorWidget::terminate ); auto closeItem = KStandardGuiItem::close(); button = new QPushButton( closeItem.icon(), closeItem.text(), this ); @@ -131,7 +130,7 @@ if( m_popupWidget ) { m_popupWidget->hide(); - m_popupWidget->deleteLater();; + m_popupWidget->deleteLater(); } //FIXME: Sometimes a script can be evaluating and cannot be abort? or can be reevaluating for some reason? if( m_engine->isEvaluating() ) @@ -221,13 +220,13 @@ m_running = true; m_evaluating = true; - m_log << QString( "%1 Script started" ).arg( QTime::currentTime().toString() ); + m_log << QStringLiteral( "%1 Script started" ).arg( QTime::currentTime().toString() ); m_timerId = startTimer( 100 ); Q_ASSERT( m_engine ); m_output << m_engine->evaluate( scriptFile.readAll() ).toString(); debug() << "After Evaluation "<< m_name; - emit evaluated( m_output.join( "\n" ) ); + Q_EMIT evaluated( m_output.join( "\n" ) ); scriptFile.close(); if ( m_evaluating ) @@ -292,10 +291,6 @@ AmarokScript::QueryMakerPrototype::init( m_engine.data() ); const QString &category = m_info.category(); - if( category.contains( QLatin1String("Lyrics") ) ) - { - new AmarokScript::AmarokLyricsScript( m_engine.data() ); - } if( category.contains( QLatin1String("Scriptable Service") ) ) { new StreamItem( m_engine.data() ); @@ -327,13 +322,13 @@ , "The script %1 uses deprecated scripting API calls. Please contact the script" " author, %2 at %3, and ask him to upgrade it before the next Amarok release." , m_info.name(), m_info.author(), m_info.email() ); - Amarok::Components::logger()->longMessage( message ); + Amarok::Logger::longMessage( message ); } void ScriptItem::uninstall() { - emit uninstalled(); + Q_EMIT uninstalled(); deleteLater(); } diff --git a/src/scripting/scriptmanager/ScriptManager.h b/src/scripting/scriptmanager/ScriptManager.h --- a/src/scripting/scriptmanager/ScriptManager.h +++ b/src/scripting/scriptmanager/ScriptManager.h @@ -31,7 +31,6 @@ namespace AmarokScript { class AmarokScript; } -class QScriptContext; class QScriptEngine; class QScriptValue; @@ -46,6 +45,7 @@ /** * Runs the script with the given name. * @param name The pluginName of the script. + * @param silent Whether to suppress the script output. * @return True if successful. */ bool runScript( const QString& name, bool silent = false ); @@ -73,7 +73,7 @@ QString scriptNameForEngine( const QScriptEngine *engine ) const; /** Notifies any running lyric scripts to fetch desired lyric from given URL */ - void notifyFetchLyrics( const QString& artist, const QString& title, const QString& url, Meta::TrackPtr track ); + void notifyFetchLyrics( const QString& artist, const QString& title, const QString& url, const Meta::TrackPtr &track ); void ServiceScriptPopulate( const QString &name, int level, diff --git a/src/scripting/scriptmanager/ScriptManager.cpp b/src/scripting/scriptmanager/ScriptManager.cpp --- a/src/scripting/scriptmanager/ScriptManager.cpp +++ b/src/scripting/scriptmanager/ScriptManager.cpp @@ -27,7 +27,7 @@ #include "core/support/Amarok.h" #include "core/support/Debug.h" #include "core/support/Components.h" -#include "core/interfaces/Logger.h" +#include "core/logger/Logger.h" #include "MainWindow.h" #include "amarokconfig.h" #include // for the compile flags @@ -47,7 +47,7 @@ #include -ScriptManager* ScriptManager::s_instance = 0; +ScriptManager* ScriptManager::s_instance = nullptr; ScriptManager::ScriptManager( QObject* parent ) : QObject( parent ) @@ -73,7 +73,7 @@ ScriptManager::destroy() { if (s_instance) { delete s_instance; - s_instance = 0; + s_instance = nullptr; } } @@ -134,10 +134,10 @@ } void -ScriptManager::notifyFetchLyrics( const QString& artist, const QString& title, const QString& url, Meta::TrackPtr track ) +ScriptManager::notifyFetchLyrics( const QString& artist, const QString& title, const QString& url, const Meta::TrackPtr &track ) { DEBUG_BLOCK - emit fetchLyrics( artist, title, url, track ); + Q_EMIT fetchLyrics( artist, title, url, track ); } //////////////////////////////////////////////////////////////////////////////// @@ -249,7 +249,7 @@ { m_lyricsScript = name; debug() << "lyrics script started:" << name; - emit lyricsScriptStarted(); + Q_EMIT lyricsScriptStarted(); } return item->start( silent ); } @@ -263,7 +263,7 @@ if (!engine) return; - Amarok::Components::logger()->longMessage( i18n( "Script error reported by: %1\n%2", scriptNameForEngine( engine ), value.toString() ), Amarok::Logger::Error ); + Amarok::Logger::longMessage( i18n( "Script error reported by: %1\n%2", scriptNameForEngine( engine ), value.toString() ), Amarok::Logger::Error ); } void @@ -291,7 +291,7 @@ void ScriptManager::configChanged( bool changed ) { - emit scriptsChanged(); + Q_EMIT scriptsChanged(); if( !changed ) return; //evil scripts may prevent the config dialog from dismissing, delay execution diff --git a/src/scripting/scriptmanager/ScriptUpdater.cpp b/src/scripting/scriptmanager/ScriptUpdater.cpp --- a/src/scripting/scriptmanager/ScriptUpdater.cpp +++ b/src/scripting/scriptmanager/ScriptUpdater.cpp @@ -54,18 +54,18 @@ // 1a. detect currently installed version QFileInfo info( m_scriptPath ); - const QString specPath = info.path() + '/' + "script.spec"; + const QString specPath = info.path() + QLatin1Char('/') + "script.spec"; if( !QFile::exists( specPath ) ) { // no .spec file found, can't continue - emit finished( m_scriptPath ); + Q_EMIT finished( m_scriptPath ); return; } KPluginInfo pInfo( specPath ); if ( !pInfo.isValid() || pInfo.name().isEmpty() || pInfo.version().isEmpty() ) { // invalid or unusable .spec file, can't continue - emit finished( m_scriptPath ); + Q_EMIT finished( m_scriptPath ); return; } m_scriptversion = pInfo.version(); @@ -80,9 +80,9 @@ // 2. check if there are updates: get 'version' file from server QUrl versionUrl( updateBaseUrl ); versionUrl = versionUrl.adjusted(QUrl::StripTrailingSlash); - versionUrl.setPath(versionUrl.path() + '/' + ( m_scriptname )); + versionUrl.setPath(versionUrl.path() + QLatin1Char('/') + ( m_scriptname )); versionUrl = versionUrl.adjusted(QUrl::StripTrailingSlash); - versionUrl.setPath(versionUrl.path() + '/' + ( '/' + versionFilename )); + versionUrl.setPath(versionUrl.path() + QLatin1Char('/') + ( '/' + versionFilename )); m_versionFile.open(); debug() << m_scriptname << ": Accessing " << versionUrl.toDisplayString() << " ..."; QUrl versionDest( m_versionFile.fileName() ); @@ -97,32 +97,32 @@ if ( job->error() ) { // if no 'version' file was found, cancel the update - emit finished( m_scriptPath ); + Q_EMIT finished( m_scriptPath ); return; } QFile file( m_versionFile.fileName() ); if ( !file.open( QIODevice::ReadOnly ) ) { debug() << m_scriptname << ": Failed to open version file for reading!"; - emit finished( m_scriptPath ); + Q_EMIT finished( m_scriptPath ); return; } QString response( file.readAll() ); file.close(); debug() << m_scriptname << ": online version: " << response; if ( !isNewer( response, m_scriptversion ) ) { // if no newer version is available, cancel update - emit finished( m_scriptPath ); + Q_EMIT finished( m_scriptPath ); return; } debug() << m_scriptname << ": newer version found, starting update :-)"; // 3. get the update archive, download it to a temporary file QUrl archiveSrc( updateBaseUrl ); archiveSrc = archiveSrc.adjusted(QUrl::StripTrailingSlash); - archiveSrc.setPath(archiveSrc.path() + '/' + ( m_scriptname )); + archiveSrc.setPath(archiveSrc.path() + QLatin1Char('/') + ( m_scriptname )); archiveSrc = archiveSrc.adjusted(QUrl::StripTrailingSlash); - archiveSrc.setPath(archiveSrc.path() + '/' + ( '/' + archiveFilename )); + archiveSrc.setPath(archiveSrc.path() + QLatin1Char('/') + ( '/' + archiveFilename )); m_archiveFile.open(); // temporary files only have a fileName() after they've been opened QUrl archiveDest( m_archiveFile.fileName() ); KIO::FileCopyJob *archiveJob = KIO::file_copy( archiveSrc, archiveDest, -1, KIO::Overwrite | KIO::HideProgressInfo ); @@ -134,16 +134,16 @@ if ( job->error() ) { // if the file wasn't found, cancel the update - emit finished( m_scriptPath ); + Q_EMIT finished( m_scriptPath ); return; } // 4. get the archive's signature, download it to a temporary file as well QUrl sigSrc( updateBaseUrl ); sigSrc = sigSrc.adjusted(QUrl::StripTrailingSlash); - sigSrc.setPath(sigSrc.path() + '/' + ( m_scriptname )); + sigSrc.setPath(sigSrc.path() + QLatin1Char('/') + ( m_scriptname )); sigSrc = sigSrc.adjusted(QUrl::StripTrailingSlash); - sigSrc.setPath(sigSrc.path() + '/' + ( '/' + signatureFilename )); + sigSrc.setPath(sigSrc.path() + QLatin1Char('/') + ( '/' + signatureFilename )); m_sigFile.open(); QUrl sigDest( m_sigFile.fileName() ); KIO::FileCopyJob *sigJob = KIO::file_copy( sigSrc, sigDest, -1, KIO::Overwrite | KIO::HideProgressInfo ); @@ -156,7 +156,7 @@ if ( job->error() ) { // if the signature couldn't be downloaded, cancel the update - emit finished( m_scriptPath ); + Q_EMIT finished( m_scriptPath ); return; } @@ -168,14 +168,14 @@ if ( !( QCA::ConvertGood == conversionResult ) ) { debug() << m_scriptname << ": Failed to read public key!"; - emit finished( m_scriptPath ); + Q_EMIT finished( m_scriptPath ); return; } QFile file( m_archiveFile.fileName() ); if ( !file.open( QIODevice::ReadOnly ) ) { debug() << m_scriptname << ": Failed to open archive file for reading!"; - emit finished( m_scriptPath ); + Q_EMIT finished( m_scriptPath ); return; } QCA::Hash hash( "sha1" ); @@ -185,7 +185,7 @@ if ( !versionFile.open( QIODevice::ReadOnly ) ) { debug() << m_scriptname << ": Failed to open version file for reading!"; - emit finished( m_scriptPath ); + Q_EMIT finished( m_scriptPath ); return; } QCA::Hash versionHash( "sha1" ); @@ -195,7 +195,7 @@ if ( !sigFile.open( QIODevice::ReadOnly ) ) { debug() << m_scriptname << ": Failed to open signature file for reading!"; - emit finished( m_scriptPath ); + Q_EMIT finished( m_scriptPath ); return; } QByteArray signature = QByteArray::fromBase64( sigFile.readAll() ); @@ -206,7 +206,7 @@ if ( !pubkey.validSignature( signature ) ) { debug() << m_scriptname << ": Invalid signature, no update performed."; - emit finished( m_scriptPath ); + Q_EMIT finished( m_scriptPath ); return; } debug() << m_scriptname << ": Signature matches. Performing update now."; @@ -222,18 +222,18 @@ { // in case of errors: bad luck, cancel the update debug() << m_scriptname << ": Error opening the update package."; - emit finished( m_scriptPath ); + Q_EMIT finished( m_scriptPath ); return; } const QStringList locations = QStandardPaths::standardLocations( QStandardPaths::GenericDataLocation ); QString relativePath; for( const auto &location : locations ) if( m_fileName.startsWith( location ) ) relativePath = m_fileName.remove( location ); - if( relativePath.startsWith( '/' ) ) + if( relativePath.startsWith( QLatin1Char('/') ) ) relativePath.remove( 0, 1 ); const QFileInfo fileinfo( relativePath ); - const QString destination = QStandardPaths::writableLocation( QStandardPaths::GenericDataLocation ) + '/' + fileinfo.path(); + const QString destination = QStandardPaths::writableLocation( QStandardPaths::GenericDataLocation ) + QLatin1Char('/') + fileinfo.path(); const QDir dir; if( !dir.exists( destination ) ) { @@ -246,17 +246,17 @@ debug() << m_scriptname << ": Updating finished successfully :-)"; // all done, temporary files are deleted automatically by Qt - emit finished( m_scriptPath ); + Q_EMIT finished( m_scriptPath ); } // decide whether a version string 'update' is newer than 'installed' bool ScriptUpdater::isNewer( const QString & update, const QString & installed ) { // only dots are supported as separators, and only integers are supported // between the dots (so no fancy stuff like 2.1-1 or 2.1.beta2) - QStringList uList = update.split( '.' ); - QStringList iList = installed.split( '.' ); + QStringList uList = update.split( QLatin1Char('.') ); + QStringList iList = installed.split( QLatin1Char('.') ); int i = 0; // stop working if the end of both lists is reached while ( i < uList.length() || i < iList.length() ) { diff --git a/src/scripting/scripts/CMakeLists.txt b/src/scripting/scripts/CMakeLists.txt --- a/src/scripting/scripts/CMakeLists.txt +++ b/src/scripting/scripts/CMakeLists.txt @@ -1,6 +1,5 @@ #add_subdirectory( radio_station_service ) #add_subdirectory( librivox_service ) -add_subdirectory( lyrics_lyricwiki ) #add_subdirectory( qtscript_debug ) #add_subdirectory( script_console ) diff --git a/src/scripting/scripts/librivox_service/CMakeLists.txt b/src/scripting/scripts/librivox_service/CMakeLists.txt --- a/src/scripting/scripts/librivox_service/CMakeLists.txt +++ b/src/scripting/scripts/librivox_service/CMakeLists.txt @@ -9,11 +9,11 @@ LibrivoxEmblem.png LibrivoxScalableEmblem.svgz audio_book128.png - DESTINATION ${DATA_INSTALL_DIR}/amarok/scripts/librivox_service + DESTINATION ${KDE_INSTALL_DATADIR}/amarok/scripts/librivox_service ) kcoreaddons_desktop_to_json("" script.desktop) install( FILES ${CMAKE_CURRENT_BINARY_DIR}/script.json - DESTINATION ${DATA_INSTALL_DIR}/amarok/scripts/librivox_service + DESTINATION ${KDE_INSTALL_DATADIR}/amarok/scripts/librivox_service ) diff --git a/src/scripting/scripts/librivox_service/script.desktop b/src/scripting/scripts/librivox_service/script.desktop --- a/src/scripting/scripts/librivox_service/script.desktop +++ b/src/scripting/scripts/librivox_service/script.desktop @@ -19,6 +19,7 @@ Name[hu]=Librivox.org Name[id]=Librivox.org Name[it]=Librivox.org +Name[ko]=Librivox.org Name[nl]=Librivox.org Name[pl]=Librivox.org Name[pt]=Librivox.org @@ -38,7 +39,7 @@ Comment=A scripted service that lets you search, stream and download free, public domain, audio books from Librivox.org Comment[bs]=Skriptovana usluga koja vam dopušta pretragu, slušanje i besplatno preuzimanje, javne domene, audio knjiga sa Librivox.org Comment[ca]=Un servei amb scripts que us permet cercar, escoltar i baixar àudio llibres lliures de domini públic des de Librivox.org -Comment[ca@valencia]=Un servei amb scripts que vos permet buscar, escoltar i baixar àudio llibres lliures de domini públic des de Librivox.org +Comment[ca@valencia]=Un servei amb scripts que vos permet cercar, escoltar i baixar àudio llibres lliures de domini públic des de Librivox.org Comment[cs]=Skriptovaná služba, jenž vám umožní hledat, přehrávat a stahovat svobodné a public domain audio knihy z Librivox.org Comment[da]=En scriptet tjeneste som giver dig mulighed for at søge, streame og downloade gratis lydbøger, som er public domain, fra Librivox.org Comment[de]=Ein Skriptdienst, mit dem Sie freie und gemeinfreie Hörbücher auf Librivox.org suchen, streamen und herunterladen können @@ -51,6 +52,7 @@ Comment[hu]=Egy szkriptelt szolgáltatás, amely lehetővé teszi a keresést, streamelést és a szabad, közkincs hangoskönyvek letöltését a Librivox.org oldalról Comment[id]=Sebuah layanan skrip yang langsung bisa anda cari, stream dan bebas unduh, domain publik, pustaka audio dari Librivox.org Comment[it]=Un servizio basato su script che ti consente di cercare, trasmettere e scaricare libri audio gratuiti e di dominio pubblico da Librivox.org +Comment[ko]=Librivox.org에서 무료 공개 도메인 오디오북을 검색, 스트리밍 및 다운로드 할 수 있는 스크립트 서비스 Comment[nl]=Een "scripted" service die u vrije, zich in het publieke domein bevindende, gesproken boeken laat zoeken en streamen uit Librivox.org Comment[pl]=Usługa skryptowa, która umożliwia znajdywanie, strumieniowanie i pobieranie darmowych, z domeny publicznej słuchowisk z Librivox.org Comment[pt]=Um serviço programado que lhe permite pesquisar, transmitir e transferir livros de áudio gratuitos e do domínio público a partir do Librivox.org diff --git a/src/scripting/scripts/lyrics_lyricwiki/CMakeLists.txt b/src/scripting/scripts/lyrics_lyricwiki/CMakeLists.txt deleted file mode 100644 --- a/src/scripting/scripts/lyrics_lyricwiki/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -install( FILES - main.js - DESTINATION ${DATA_INSTALL_DIR}/amarok/scripts/lyrics_lyricwiki -) - -kcoreaddons_desktop_to_json("" script.desktop) - -install( FILES ${CMAKE_CURRENT_BINARY_DIR}/script.json - DESTINATION ${DATA_INSTALL_DIR}/amarok/scripts/lyrics_lyricwiki -) diff --git a/src/scripting/scripts/lyrics_lyricwiki/main.js b/src/scripting/scripts/lyrics_lyricwiki/main.js deleted file mode 100644 --- a/src/scripting/scripts/lyrics_lyricwiki/main.js +++ /dev/null @@ -1,284 +0,0 @@ -/************************************************************************** -* Amarok 2 lyrics script to fetch lyrics from lyrics.wikia.com * -* (formerly lyricwiki.org) * -* * -* Copyright * -* (C) 2008 Aaron Reichman * -* (C) 2008 Leo Franchi * -* (C) 2008 Mark Kretschmann * -* (C) 2008 Peter ZHOU * -* (C) 2009 Jakob Kummerow * -* * -* This program is free software; you can redistribute it and/or modify * -* it under the terms of the GNU General Public License as published by * -* the Free Software Foundation; either version 2 of the License, or * -* (at your option) any later version. * -* * -* This program is distributed in the hope that it will be useful, * -* but WITHOUT ANY WARRANTY; without even the implied warranty of * -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * -* GNU General Public License for more details. * -* * -* You should have received a copy of the GNU General Public License * -* along with this program; if not, write to the * -* Free Software Foundation, Inc., * -* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * -**************************************************************************/ - -/* GLOBAL VARIABLES */ -// template for the xml object that will be populated and passed to Amarok.Lyrics.showLyrics() -XML = "{lyrics}"; -// if we change variable xml it will not reinitialized on next lyrics request, so we will get lyrics from previous song -// because of that we need temp variable -NEWXML = ""; -// maximum numbers that we can follow by #REDIRECT [[Band:Song]] -MAXREDIRECTS = 3; -// url to get lyrics using mediawiki API -APIURL = "http://lyrics.wikia.com/api.php?action=query&prop=revisions&rvprop=content&format=xml&titles="; -// urlified artist and title will be here after initialization -ARTIST = ""; -TITLE = ""; -// the error message that is displayed if no lyrics were found or there was an error while trying to fetch them -ERRORMSG = "Lyrics not found. Sorry."; - -var embedLyrics = Amarok.Script.readConfig("embedLyrics", false); - -function readEmbeddedLyrics() -{ - var track = Amarok.Engine.currentTrack(); - var embeddedLyrics = track.tags["lyrics"]; - if( embeddedLyrics != undefined && embeddedLyrics !== "" ) - { - Amarok.debug( "Using embedded lyrics for track \"" + track.title + "\"" ); - Amarok.Lyrics.showLyricsHtml( embeddedLyrics ); - return true; - } - return false; -} - -function embed( lyricsXML ) -{ - if( !embedLyrics ) - return; - - Amarok.Xml.setReaderData( lyricsXML ); - var lyrics = Amarok.Xml.readFirstElementWithName( "lyric" ); - if( lyrics !== "" ) - { - Amarok.Engine.currentTrack().changeTags( { "lyrics":lyrics }, false ); - Amarok.debug( "Writing lyrics to track." ); - Amarok.debug( lyrics ); - return; - } -} - -/* receives a Wiki page (in XML format) that contains url to lyric of the requested song - this API function can correct our tags - for example we trying to receive lyrics for Nightwish:Nightwish_-_Sleepwalker (incorrect tags) - this API functions will redirect us to Nightwish:Sleepwalker (correct tags) -*/ -function onHelpReceived( response ) -{ - try - { - if( response.length == 0 ) - Amarok.Lyrics.showLyricsError( ERRORMSG ); - else - { - Amarok.Xml.setDomObjectData(response); - var urlstr = Amarok.Xml.textOfFirstDomElementWithName( "url" ); - var capture; - if(capture = /.+\/([^?=:]+:[^?=:]+)$/.exec(urlstr)) - { - // matched url is like this one: http://lyrics.wikia.com/Nightwish:Sleepwalker - // but not like this: http://lyrics.wikia.com/index.php?title=Nightwish:Sleepwalker&action=edit - var url = APIURL + capture[1]; - // this zero will not allow to execute this function again - new Downloader( url, new Function("response", "onLyricsReceived(response, 0)") ); - } - else - { - Amarok.Lyrics.showLyricsNotFound( ERRORMSG ); - } - } - } - catch( err ) - { - Amarok.Lyrics.showLyricsError( ERRORMSG ); - Amarok.debug( "script error in function onHelpReceived: " + err ); - } -} - -/* receives a Wiki page (in XML format) using wikimedia API and extracts lyrics from it */ -function onLyricsReceived( response, redirects ) -{ - try - { - if( response.length == 0 ) - Amarok.Lyrics.showLyricsError( "Unable to contact server - no website returned" ); // TODO: this should be i18n able - else - { - Amarok.Xml.setDomObjectData(response); - - var capture; - response = Amarok.Xml.textOfFirstDomElementWithName( "rev" ); - - if(capture = /<(lyrics?>)/i.exec(response)) - { // ok, lyrics found - // lyrycs can be between or tags - // such variant can be in one response: national lyrics english lyrics - // example: http://lyrics.wikia.com/api.php?action=query&prop=revisions&titles=Flёur:Колыбельная_для_Солнца&rvprop=content&format=xml - // we can not use lazy regexp because qt script don't understand it - // so let's extract lyrics with string functions - - var lindex = response.indexOf("<" + capture[1]) + capture[1].length + 1; - var rindex = response.indexOf(" upper && words[i].charAt(upper).toUpperCase() == "I" ) { - upper++; - } - } - // if the word starts with an apostrophe or parenthesis, the next character has to be uppercase - if ( words[i].charAt(0) == "'" || words[i].charAt(0) == "(" ) { - upper++; - } - // finally, perform the capitalization - if ( upper < words[i].length ) { - words[i] = words[i].substring( 0, upper ).toUpperCase() + words[i].substring( upper ); - } else { - words[i] = words[i].toUpperCase(); - } - // now take care of more special cases - // names like "McSomething" - if ( words[i].substring( 0, 2 ) == "Mc" ) { - words[i] = "Mc" + words[i][2].toUpperCase() + words[i].substring( 3 ); - } - // URI-encode the word - words[i] = encodeURIComponent( words[i] ); - } - // join the words back together and return the result - var result = words.join( "_" ); - return result; - } catch ( err ) { - Amarok.debug ( "script error in function URLify: " + err ); - } -} - -// convert all HTML entities to their applicable characters -function entityDecode(string) -{ - try - { - var convertxml = "" + string + ""; - if(Amarok.Xml.setDomObjectData(convertxml)) - { // xml is valid - return Amarok.Xml.textOfFirstDomElementWithName( "entity" ); - } - - return string; - } - catch( err ) - { - Amarok.debug( "script error in function entityDecode: " + err ); - } -} - -// entry point -function getLyrics( artist, title, url, track ) -{ - if( readEmbeddedLyrics() ) - return; - try - { - // save artist and title for later display now - NEWXML = XML.replace( "{artist}", Amarok.Lyrics.escape( artist ) ); - NEWXML = NEWXML.replace( "{title}", Amarok.Lyrics.escape( title ) ); - - // strip "featuring " from the artist - var strip = artist.toLowerCase().indexOf( " ft. "); - if ( strip != -1 ) { - artist = artist.substring( 0, strip ); - } - strip = artist.toLowerCase().indexOf( " feat. " ); - if ( strip != -1 ) { - artist = artist.substring( 0, strip ); - } - strip = artist.toLowerCase().indexOf( " featuring " ); - if ( strip != -1 ) { - artist = artist.substring( 0, strip ); - } - - // URLify artist and title - ARTIST = artist = URLify( entityDecode(artist) ); - TITLE = title = URLify( entityDecode(title) ); - - // assemble the (encoded!) URL, build a QUrl out of it and dispatch the download request - var url = APIURL + artist + ":" + title; - Amarok.debug( "request URL: " + url.toString() ); - // there was no redirections yet - new Downloader( url, new Function("response", "onLyricsReceived(response, -1)") ); - } - catch( err ) - { - Amarok.debug( "error: " + err ); - } -} - - -Amarok.Window.addSettingsSeparator(); -Amarok.Window.addSettingsMenu( "LyricWiki" ); -Amarok.Window.addCustomAction( "LyricWiki", "EmbedLyrics", "Embed Lyrics" ); -Amarok.Window.LyricWiki.EmbedLyrics.checkable = true; -Amarok.Window.LyricWiki.EmbedLyrics.checked = embedLyrics; -Amarok.Window.LyricWiki.EmbedLyrics.toggled.connect( function( checked ) { - embedLyrics = checked; - Amarok.Script.writeConfig( "embedLyrics", embedLyrics ); - } ); - -Amarok.Lyrics.fetchLyrics.connect( getLyrics ); diff --git a/src/scripting/scripts/lyrics_lyricwiki/script.desktop b/src/scripting/scripts/lyrics_lyricwiki/script.desktop deleted file mode 100644 --- a/src/scripting/scripts/lyrics_lyricwiki/script.desktop +++ /dev/null @@ -1,79 +0,0 @@ -[Desktop Entry] -Icon=view-pim-journal -Type=script -ServiceTypes=KPluginInfo - -Name=Lyricwiki -Name[bs]=Lyricwiki -Name[ca]=Lyricwiki -Name[ca@valencia]=Lyricwiki -Name[cs]=Lyricwiki -Name[da]=Lyricwiki -Name[de]=Lyricwiki -Name[el]=Lyricwiki -Name[en_GB]=Lyricwiki -Name[es]=Lyricwiki -Name[fi]=Lyricwiki -Name[fr]=LyricWiki -Name[gl]=Lyricwiki -Name[hu]=Lyricwiki -Name[id]=Lyricwiki -Name[it]=Lyricwiki -Name[nl]=Lyricwiki -Name[pl]=Lyricwiki -Name[pt]=Lyricwiki -Name[pt_BR]=Lyricwiki -Name[ro]=Lyricwiki -Name[sk]=Lyricwiki -Name[sl]=Lyricwiki -Name[sr]=Лириквики -Name[sr@ijekavian]=Лириквики -Name[sr@ijekavianlatin]=LyricWiki -Name[sr@latin]=LyricWiki -Name[sv]=Lyricwiki -Name[tr]=Lyricwiki -Name[uk]=Lyricwiki -Name[x-test]=xxLyricwikixx -Name[zh_TW]=Lyricwiki -Comment=A script to fetch lyrics from lyricwiki.org -Comment[bs]=Skripta za dobavljanje tekstova pjesama sa lyricwiki.org -Comment[ca]=Un script per recuperar lletres des de lyricwiki.org -Comment[ca@valencia]=Un script per recuperar lletres des de lyricwiki.org -Comment[cs]=Skript pro stažení textů písní z lyricwiki.org -Comment[da]=Et script til at hente sangtekster fra lyricwiki.org -Comment[de]=Ein Skript, um Liedtexte von lyricwiki.org zu holen -Comment[el]=Σενάριο για μεταφορά στίχων από το lyricwiki.org -Comment[en_GB]=A script to fetch lyrics from lyricwiki.org -Comment[es]=Un guion para recuperar letras desde lyricwiki.org -Comment[fi]=Skripti, joka hakee laulun sanat lyricwiki.orgista -Comment[fr]=Un script pour télécharger des paroles depuis lyricwiki.org -Comment[gl]=Un script para obter letras de lyricwiki.org. -Comment[hu]=Egy parancsfájl dalszövegek letöltéséhez a lyricwiki.org oldalról -Comment[id]=Script untuk menarik lirik dari lyricwiki.org -Comment[it]=Uno script per scaricare i testi da lyricwiki.org -Comment[nl]=Een script om liedteksten op te halen uit lyricwiki.org -Comment[pl]=Skrypt do pobieranie słów z lyricwiki.org -Comment[pt]=Um programa para obter letras musicais a partir do lyricwiki.org -Comment[pt_BR]=Um script para baixar letras de músicas a partir do lyricwiki.org -Comment[ro]=Script ce obține versuri de la lyricwiki.org -Comment[sk]=Skript na stiahnutie textu z lyricwiki.org -Comment[sl]=Skript za pridobivanje besedil iz lyricwiki.org -Comment[sr]=Скрипта за добављање стихова са Лириквикија -Comment[sr@ijekavian]=Скрипта за добављање стихова са Лириквикија -Comment[sr@ijekavianlatin]=Skripta za dobavljanje stihova sa LyricWikija -Comment[sr@latin]=Skripta za dobavljanje stihova sa LyricWikija -Comment[sv]=Ett skript för att hämta sångtexter från lyricwiki.org -Comment[tr]=Lyricwiki.org şarkı sözleri getirmek için bir betik -Comment[uk]=Скрипт для отримання слів пісень з lyricwiki.org -Comment[x-test]=xxA script to fetch lyrics from lyricwiki.orgxx -Comment[zh_TW]=從 lyricwiki.org 抓取歌詞的文稿 - -X-KDE-PluginInfo-Author=Aaron Reichman -X-KDE-PluginInfo-Email=reldruh@gmail.com -X-KDE-PluginInfo-Name=LyricWiki -X-KDE-PluginInfo-Version=.3 -X-KDE-PluginInfo-Category=Lyrics -X-KDE-PluginInfo-Depends=Amarok2.0 -X-KDE-PluginInfo-License=LGPL -X-KDE-PluginInfo-BugAddress=submit@bugs.kde.org -X-KDE-PluginInfo-EnabledByDefault=true diff --git a/src/scripting/scripts/qtscript_debug/CMakeLists.txt b/src/scripting/scripts/qtscript_debug/CMakeLists.txt --- a/src/scripting/scripts/qtscript_debug/CMakeLists.txt +++ b/src/scripting/scripts/qtscript_debug/CMakeLists.txt @@ -1,14 +1,14 @@ install( FILES script.spec - DESTINATION ${DATA_INSTALL_DIR}/amarok/scripts/qtscript_debug + DESTINATION ${KDE_INSTALL_DATADIR}/amarok/scripts/qtscript_debug ) install( PROGRAMS main.js - DESTINATION ${DATA_INSTALL_DIR}/amarok/scripts/qtscript_debug + DESTINATION ${KDE_INSTALL_DATADIR}/amarok/scripts/qtscript_debug ) install( PROGRAMS debug/debug.js - DESTINATION ${DATA_INSTALL_DIR}/amarok/scripts/qtscript_debug/debug + DESTINATION ${KDE_INSTALL_DATADIR}/amarok/scripts/qtscript_debug/debug ) diff --git a/src/scripting/scripts/radio_station_service/CMakeLists.txt b/src/scripting/scripts/radio_station_service/CMakeLists.txt --- a/src/scripting/scripts/radio_station_service/CMakeLists.txt +++ b/src/scripting/scripts/radio_station_service/CMakeLists.txt @@ -1,11 +1,11 @@ install( FILES main.js - DESTINATION ${DATA_INSTALL_DIR}/amarok/scripts/radio_station_service + DESTINATION ${KDE_INSTALL_DATADIR}/amarok/scripts/radio_station_service ) kcoreaddons_desktop_to_json("" script.desktop) install( FILES ${CMAKE_CURRENT_BINARY_DIR}/script.json - DESTINATION ${DATA_INSTALL_DIR}/amarok/scripts/radio_station_service + DESTINATION ${KDE_INSTALL_DATADIR}/amarok/scripts/radio_station_service ) diff --git a/src/scripting/scripts/radio_station_service/script.desktop b/src/scripting/scripts/radio_station_service/script.desktop --- a/src/scripting/scripts/radio_station_service/script.desktop +++ b/src/scripting/scripts/radio_station_service/script.desktop @@ -19,6 +19,7 @@ Name[hu]=Szuper adatfolyamok Name[id]=Cool Streams Name[it]=Cool Stream +Name[ko]=멋진 스트림 Name[nl]=Cool Streams Name[pl]=Strumienie Cool Name[pt]=Transmissões Fixes @@ -51,6 +52,7 @@ Comment[hu]=Egy parancsfájl, amely egy szolgáltatást állít be néhány szuper internetes rádióállomással Comment[id]=Sebuah skrip yang di siapkan untuk melayani beberapa stasiun radio internet keren Comment[it]=Uno script che configura un servizio con alcune fantastiche stazioni radio in rete +Comment[ko]=몇 가지 멋진 인터넷 라디오 방송국을 사용하여 서비스를 설정하는 스크립트 Comment[nl]=Een script dat een service met een paar coole internet-radio-stations instelt Comment[pl]=Skrypt, który ustawia usługę dla kilku internetowych rozgłośni radiowych cool Comment[pt]=Um programa que configura um serviço com algumas estações de rádio fixes na Internet diff --git a/src/scripting/scripts/script_console/CMakeLists.txt b/src/scripting/scripts/script_console/CMakeLists.txt --- a/src/scripting/scripts/script_console/CMakeLists.txt +++ b/src/scripting/scripts/script_console/CMakeLists.txt @@ -1,10 +1,10 @@ install( FILES main.js - DESTINATION ${DATA_INSTALL_DIR}/amarok/scripts/script_console + DESTINATION ${KDE_INSTALL_DATADIR}/amarok/scripts/script_console ) kcoreaddons_desktop_to_json("" script.desktop) install( FILES ${CMAKE_CURRENT_BINARY_DIR}/script.json - DESTINATION ${DATA_INSTALL_DIR}/amarok/scripts/script_console + DESTINATION ${KDE_INSTALL_DATADIR}/amarok/scripts/script_console ) diff --git a/src/scripting/scripts/script_console/script.desktop b/src/scripting/scripts/script_console/script.desktop --- a/src/scripting/scripts/script_console/script.desktop +++ b/src/scripting/scripts/script_console/script.desktop @@ -19,6 +19,7 @@ Name[hu]=Amarok parancsfájl konzol Name[id]=Konsol Skrip Amarok Name[it]=Console degli script di Amarok +Name[ko]=Amarok 스크립트 콘솔 Name[nl]=Script-console van Amarok Name[pl]=Konsola skryptów Amaroka Name[pt]=Consola de Programas do Amarok @@ -51,6 +52,7 @@ Comment[hu]=Amarok parancsfájl konzol Comment[id]=Konsol Skrip Amarok Comment[it]=Console degli script di Amarok +Comment[ko]=Amarok 스크립트 콘솔 Comment[nl]=Script-console van Amarok Comment[pl]=Konsola skryptów Amaroka Comment[pt]=Consola de Programas do Amarok diff --git a/src/scripting/scripts/templates/CMakeLists.txt b/src/scripting/scripts/templates/CMakeLists.txt --- a/src/scripting/scripts/templates/CMakeLists.txt +++ b/src/scripting/scripts/templates/CMakeLists.txt @@ -1,5 +1,5 @@ install( FILES script.spec template.js - DESTINATION ${DATA_INSTALL_DIR}/amarok/scripts/templates + DESTINATION ${KDE_INSTALL_DATADIR}/amarok/scripts/templates ) diff --git a/src/scripting/scripts/webcontrol/CMakeLists.txt b/src/scripting/scripts/webcontrol/CMakeLists.txt --- a/src/scripting/scripts/webcontrol/CMakeLists.txt +++ b/src/scripting/scripts/webcontrol/CMakeLists.txt @@ -1,5 +1,5 @@ install( FILES main.js script.spec - DESTINATION ${DATA_INSTALL_DIR}/amarok/scripts/webcontrol + DESTINATION ${KDE_INSTALL_DATADIR}/amarok/scripts/webcontrol ) diff --git a/src/services/DynamicServiceQueryMaker.h b/src/services/DynamicServiceQueryMaker.h --- a/src/services/DynamicServiceQueryMaker.h +++ b/src/services/DynamicServiceQueryMaker.h @@ -26,7 +26,6 @@ namespace ThreadWeaver { - class Job; } namespace Collections { @@ -42,40 +41,40 @@ Q_OBJECT public: DynamicServiceQueryMaker( ); - virtual ~DynamicServiceQueryMaker() {}; + virtual ~DynamicServiceQueryMaker() {} - //this is the stuff that must be implmeneted - virtual void run() = 0; - virtual void abortQuery() = 0; + //this is the stuff that must be implemented + void run() override = 0; + void abortQuery() override = 0; //below here is the stuf that each dynamic querymaker will most likely only need - //Some of, hense they are all stubbed out: + //Some of, hence they are all stubbed out: - virtual QueryMaker* setQueryType( QueryType type ) { Q_UNUSED( type); return this; } + QueryMaker* setQueryType( QueryType type ) override { Q_UNUSED( type); return this; } - virtual QueryMaker* addReturnValue ( qint64 value ); - virtual QueryMaker* addReturnFunction( ReturnFunction function, qint64 value ); - virtual QueryMaker* orderBy ( qint64 value, bool descending = false ); + QueryMaker* addReturnValue ( qint64 value ) override; + QueryMaker* addReturnFunction( ReturnFunction function, qint64 value ) override; + QueryMaker* orderBy ( qint64 value, bool descending = false ) override; - virtual QueryMaker* addMatch ( const Meta::TrackPtr &track ); - virtual QueryMaker* addMatch ( const Meta::ArtistPtr &artist, ArtistMatchBehaviour behaviour = TrackArtists ); - virtual QueryMaker* addMatch ( const Meta::AlbumPtr &album ); - virtual QueryMaker* addMatch ( const Meta::GenrePtr &genre ); - virtual QueryMaker* addMatch ( const Meta::ComposerPtr &composer ); - virtual QueryMaker* addMatch ( const Meta::YearPtr &year ); - virtual QueryMaker* addMatch ( const Meta::LabelPtr &label ); + QueryMaker* addMatch ( const Meta::TrackPtr &track ) override; + QueryMaker* addMatch ( const Meta::ArtistPtr &artist, ArtistMatchBehaviour behaviour = TrackArtists ) override; + QueryMaker* addMatch ( const Meta::AlbumPtr &album ) override; + QueryMaker* addMatch ( const Meta::GenrePtr &genre ) override; + QueryMaker* addMatch ( const Meta::ComposerPtr &composer ) override; + QueryMaker* addMatch ( const Meta::YearPtr &year ) override; + QueryMaker* addMatch ( const Meta::LabelPtr &label ) override; - virtual QueryMaker* addFilter ( qint64 value, const QString &filter, bool matchBegin, bool matchEnd ); - virtual QueryMaker* excludeFilter ( qint64 value, const QString &filter, bool matchBegin, bool matchEnd ); + QueryMaker* addFilter ( qint64 value, const QString &filter, bool matchBegin, bool matchEnd ) override; + QueryMaker* excludeFilter ( qint64 value, const QString &filter, bool matchBegin, bool matchEnd ) override; - virtual QueryMaker* addNumberFilter( qint64 value, qint64 filter, QueryMaker::NumberComparison compare ); - virtual QueryMaker* excludeNumberFilter( qint64 value, qint64 filter, QueryMaker::NumberComparison compare ); + QueryMaker* addNumberFilter( qint64 value, qint64 filter, QueryMaker::NumberComparison compare ) override; + QueryMaker* excludeNumberFilter( qint64 value, qint64 filter, QueryMaker::NumberComparison compare ) override; - virtual QueryMaker* limitMaxResultSize ( int size ); + QueryMaker* limitMaxResultSize ( int size ) override; - virtual QueryMaker* beginAnd() { return this; } - virtual QueryMaker* beginOr() { return this; } - virtual QueryMaker* endAndOr() { return this; } + QueryMaker* beginAnd() override { return this; } + QueryMaker* beginOr() override { return this; } + QueryMaker* endAndOr() override { return this; } static Meta::AlbumList matchAlbums( ServiceCollection *coll, const Meta::ArtistPtr &artist ); }; diff --git a/src/services/InfoParserBase.h b/src/services/InfoParserBase.h --- a/src/services/InfoParserBase.h +++ b/src/services/InfoParserBase.h @@ -33,33 +33,33 @@ InfoParserBase(); /** - * Fetches info about artist and emits info( Qstring ) + * Fetches info about artist and emits info( QString ) * with a ready to show html page when the info is ready * @param artist The artist to get info about */ - virtual void getInfo( Meta::ArtistPtr artist ) = 0; + virtual void getInfo( const Meta::ArtistPtr &artist ) = 0; /** * Overloaded function - * Fetches info about album and emits info( Qstring ) + * Fetches info about album and emits info( QString ) * with a ready to show html page when the info is ready - * @param url The album to get info about + * @param album The album to get info about */ - virtual void getInfo( Meta::AlbumPtr album ) = 0; + virtual void getInfo( const Meta::AlbumPtr &album ) = 0; /** * Overloaded function - * Fetches info about track and emits info( Qstring ) + * Fetches info about track and emits info( QString ) * with a ready to show html page when the info is ready - * @param url The track to get info about + * @param track The track to get info about */ - virtual void getInfo( Meta::TrackPtr track ) = 0; + virtual void getInfo( const Meta::TrackPtr &track ) = 0; void showLoading( const QString &message ); Q_SIGNALS: /** - * Signal emmited when new html info is ready to be shown + * Signal emitted when new html info is ready to be shown * @param info The string containing the html formatted information */ void info( const QString &info ); diff --git a/src/services/InfoParserBase.cpp b/src/services/InfoParserBase.cpp --- a/src/services/InfoParserBase.cpp +++ b/src/services/InfoParserBase.cpp @@ -36,7 +36,7 @@ if( s_loadingBaseHtml.isEmpty() ) { - const QUrl url( QStandardPaths::locate( QStandardPaths::GenericDataLocation, "amarok/data/" ) ); + const QUrl url( QStandardPaths::locate( QStandardPaths::GenericDataLocation, QStringLiteral("amarok/data/") ) ); QString htmlFile = url.path() + "InfoParserLoading.html"; if( !QFile::exists( htmlFile ) ) @@ -57,12 +57,12 @@ QString currentHtml = s_loadingBaseHtml; - const QUrl url( QStandardPaths::locate( QStandardPaths::GenericDataLocation, "amarok/images/" ) ); - currentHtml = currentHtml.replace( "%%IMAGEPATH%%", url.url() ); - currentHtml = currentHtml.replace( "%%TEXT%%", message ); + const QUrl url( QStandardPaths::locate( QStandardPaths::GenericDataLocation, QStringLiteral("amarok/images/") ) ); + currentHtml = currentHtml.replace( QLatin1String("%%IMAGEPATH%%"), url.url() ); + currentHtml = currentHtml.replace( QLatin1String("%%TEXT%%"), message ); // debug() << "showing html: " << currentHtml; - emit ( info( currentHtml ) ); + Q_EMIT ( info( currentHtml ) ); } diff --git a/src/services/ServiceAlbumCoverDownloader.h b/src/services/ServiceAlbumCoverDownloader.h --- a/src/services/ServiceAlbumCoverDownloader.h +++ b/src/services/ServiceAlbumCoverDownloader.h @@ -49,13 +49,13 @@ * Constructor, reimplemented from ServiceAlbum. * @param name The name of the album. */ - ServiceAlbumWithCover( const QString &name ); + explicit ServiceAlbumWithCover( const QString &name ); /** * Constructor, reimplemented from ServiceAlbum. - * @param name The result list used to initialize the album. + * @param resultRow The result raw used to initialize the album. */ - ServiceAlbumWithCover( const QStringList &resultRow ); + explicit ServiceAlbumWithCover( const QStringList &resultRow ); /** * Destructor. @@ -81,10 +81,10 @@ virtual QString coverUrl() const = 0; /** - * Set the cover image of thes album. + * Set the cover image of the album. * @param image The cover image. */ - void setImage( const QImage &image ); + void setImage( const QImage &image ) override; /** * Notify album that the download of the cover has been cancelled. @@ -96,16 +96,15 @@ * @param size Unused. * @return True. */ - virtual bool hasImage( int size = 1 ) const { Q_UNUSED( size ); return true; } + bool hasImage( int size = 1 ) const override { Q_UNUSED( size ); return true; } /** * Get the image of this album. If the image has not yet been fetched, this call will return a standard * "no-cover" cover and then start the download of the real cover. When the download is complete, any oberserves will be notified that the metadata of this album has been changed. * @param size The required size of the album. - * @param withShadow Unused. * @return The cover image or a default cover. */ - virtual QImage image( int size = 0 ) const; //overridden from Meta::Album + QImage image( int size = 0 ) const override; //overridden from Meta::Album protected: diff --git a/src/services/ServiceAlbumCoverDownloader.cpp b/src/services/ServiceAlbumCoverDownloader.cpp --- a/src/services/ServiceAlbumCoverDownloader.cpp +++ b/src/services/ServiceAlbumCoverDownloader.cpp @@ -24,6 +24,8 @@ #include "core/support/Debug.h" #include "covermanager/CoverCache.h" +#include + #include #include @@ -58,10 +60,10 @@ const QString artist = hasAlbumArtist() ? albumArtist()->name() : - QLatin1String("NULL"); //no need to translate, only used as a caching key/temp filename + QStringLiteral("NULL"); //no need to translate, only used as a caching key/temp filename - const QString coverName = QString( "%1_%2_%3_cover.png" ).arg( downloadPrefix(), artist, name() ); - const QString saveLocation = Amarok::saveLocation( "albumcovers/cache/" ); + const QString coverName = QStringLiteral( "%1_%2_%3_cover.png" ).arg( downloadPrefix(), artist, name() ); + const QString saveLocation = Amarok::saveLocation( QStringLiteral("albumcovers/cache/") ); const QDir cacheCoverDir = QDir( saveLocation ); //make sure that this dir exists @@ -81,7 +83,8 @@ else if( m_hasFetchedCover && !m_cover.isNull() ) { QImage image( m_cover.scaled( size, size, Qt::KeepAspectRatio, Qt::SmoothTransformation ) ); - image.save( cacheCoverPath, "PNG" ); + std::thread thread( QOverload::of( &QImage::save ), image, cacheCoverPath, "PNG", -1 ); + thread.detach(); return image; } else if( !m_isFetchingCover && !coverUrl().isEmpty() ) @@ -137,7 +140,7 @@ QUrl downloadUrl( album->coverUrl() ); - m_coverDownloadPath = m_tempDir->path() + '/' + downloadUrl.fileName(); + m_coverDownloadPath = m_tempDir->path() + QLatin1Char('/') + downloadUrl.fileName(); debug() << "Download Cover: " << downloadUrl.url() << " to: " << m_coverDownloadPath; diff --git a/src/services/ServiceBase.h b/src/services/ServiceBase.h --- a/src/services/ServiceBase.h +++ b/src/services/ServiceBase.h @@ -76,16 +76,16 @@ * @param url The url to test. * @return A bool representing whether the ServiceFactory believes that a service of this kind can process the given url. */ - virtual bool possiblyContainsTrack( const QUrl &url ) const { Q_UNUSED( url ); return false; } + bool possiblyContainsTrack( const QUrl &url ) const override { Q_UNUSED( url ); return false; } /** * Attempt to create a Meta::Track object from a given url. This method is meant as a proxy that will forward this call to one or more * services managed by this factory. If init has not been called ( no services of this kind has been loaded ) they can now be loaded on * demand. * @param url The url to test. * @return A Meta::TrackPtr based one the url, or empty if nothing was known about the url. */ - virtual Meta::TrackPtr trackForUrl( const QUrl &url ); + Meta::TrackPtr trackForUrl( const QUrl &url ) override; /** * Clear the list of active services created by this factory. Used when unloading services. @@ -197,7 +197,7 @@ /** * Do expensive initialization. This method is called when the service is first shown. */ - virtual void polish() = 0; + void polish() override = 0; /** * ?????? @@ -209,7 +209,7 @@ * Apply a filter to the tree view. * @param filter The filter to apply. */ - void setFilter( const QString &filter ); + void setFilter( const QString &filter ) override; /** * Returns a list of the messages that the current service accepts. Default implementation does not @@ -239,8 +239,8 @@ */ ServiceFactory* parent() const; - virtual QString filter() const; - virtual QList levels() const; + QString filter() const override; + QList levels() const override; public Q_SLOTS: //void treeViewSelectionChanged( const QItemSelection & selected ); @@ -275,7 +275,7 @@ */ void sortByGenreArtistAlbum(); - void setLevels( const QList &levels ); + void setLevels( const QList &levels ) override; Q_SIGNALS: /** @@ -290,7 +290,7 @@ void selectionChanged( CollectionTreeItem *item ); /** - * Signal emitted when the service is ready to be used. You don't need to emit this + * Signal emitted when the service is ready to be used. You don't need to Q_EMIT this * manually, just call setServiceReady() as appropriate. */ void ready(); diff --git a/src/services/ServiceBase.cpp b/src/services/ServiceBase.cpp --- a/src/services/ServiceBase.cpp +++ b/src/services/ServiceBase.cpp @@ -48,7 +48,7 @@ Meta::TrackPtr ServiceFactory::trackForUrl( const QUrl &url ) { - if ( m_activeServices.size() == 0 ) { + if ( m_activeServices.isEmpty() ) { debug() << "our service (" << name() << ") is needed for a url, so init it!"; init(); } @@ -107,18 +107,18 @@ service->deleteLater(); } -ServiceBase *ServiceBase::s_instance = 0; +ServiceBase *ServiceBase::s_instance = nullptr; ServiceBase::ServiceBase( const QString &name, ServiceFactory *parent, bool useCollectionTreeView, const QString &prettyName ) - : BrowserCategory( name, 0 ) - , m_contentView ( 0 ) + : BrowserCategory( name, nullptr ) + , m_contentView ( nullptr ) , m_parentFactory( parent ) , m_polished( false ) , m_useCollectionTreeView( useCollectionTreeView ) - , m_infoParser( 0 ) + , m_infoParser( nullptr ) , m_serviceready( false ) - , m_model( 0 ) - , m_filterModel( 0 ) + , m_model( nullptr ) + , m_filterModel( nullptr ) { DEBUG_BLOCK @@ -232,15 +232,15 @@ m_serviceready = newReady; if( m_serviceready ) - emit ready(); + Q_EMIT ready(); } void ServiceBase::infoChanged( const QString &infoHtml ) { QVariantMap map; - map["service_name"] = prettyName(); - map["main_info"] = infoHtml; + map[QStringLiteral("service_name")] = prettyName(); + map[QStringLiteral("main_info")] = infoHtml; The::infoProxy()->setInfo( map ); } @@ -263,8 +263,8 @@ ServiceBase::generateWidgetInfo( const QString &html ) const { QVariantMap map; - map["service_name"] = prettyName(); - map["main_info"] = html; + map[QStringLiteral("service_name")] = prettyName(); + map[QStringLiteral("main_info")] = html; The::infoProxy()->setInfo( map ); } diff --git a/src/services/ServiceCapabilities.h b/src/services/ServiceCapabilities.h --- a/src/services/ServiceCapabilities.h +++ b/src/services/ServiceCapabilities.h @@ -45,15 +45,15 @@ */ class AMAROK_EXPORT ServiceBookmarkThisCapability : public Capabilities::BookmarkThisCapability { public: - ServiceBookmarkThisCapability( BookmarkThisProvider * provider ); + explicit ServiceBookmarkThisCapability( BookmarkThisProvider * provider ); ~ServiceBookmarkThisCapability(); - virtual bool isBookmarkable(); - virtual QString browserName(); - virtual QString collectionName(); - virtual bool simpleFiltering(); - virtual QAction * bookmarkAction() const; + bool isBookmarkable() override; + QString browserName() override; + QString collectionName() override; + bool simpleFiltering() override; + QAction * bookmarkAction() const override; private: @@ -66,9 +66,9 @@ Q_OBJECT public: - ServiceActionsCapability( ActionsProvider * actionsProvider ); + explicit ServiceActionsCapability( ActionsProvider * actionsProvider ); virtual ~ServiceActionsCapability(); - virtual QList< QAction * > actions() const; + QList< QAction * > actions() const override; private: ActionsProvider * m_actionsProvider; @@ -79,14 +79,14 @@ class AMAROK_EXPORT ServiceSourceInfoCapability : public Capabilities::SourceInfoCapability { public: - ServiceSourceInfoCapability( SourceInfoProvider * sourceInfoProvider ); + explicit ServiceSourceInfoCapability( SourceInfoProvider * sourceInfoProvider ); ~ServiceSourceInfoCapability(); - QString sourceName(); - QString sourceDescription(); - QPixmap emblem(); - QString scalableEmblem(); + QString sourceName() override; + QString sourceDescription() override; + QPixmap emblem() override; + QString scalableEmblem() override; private: SourceInfoProvider * m_sourceInfoProvider; @@ -99,8 +99,8 @@ { Q_OBJECT public: - ServiceFindInSourceCapability( Meta::ServiceTrack *track ); - virtual void findInSource( QFlags tag ); + explicit ServiceFindInSourceCapability( Meta::ServiceTrack *track ); + void findInSource( QFlags tag ) override; private: Meta::ServiceTrack * m_track; diff --git a/src/services/ServiceCapabilities.cpp b/src/services/ServiceCapabilities.cpp --- a/src/services/ServiceCapabilities.cpp +++ b/src/services/ServiceCapabilities.cpp @@ -130,12 +130,12 @@ QString album = m_track->album()->prettyName(); AmarokUrl url; - url.setCommand( "navigate" ); + url.setCommand( QStringLiteral("navigate") ); url.setPath( "internet/" + collection ); if( !m_track->simpleFiltering() ) { - url.setArg( "filter", "artist:\"" + artist + "\" AND album:\"" + album + "\"" ); - url.setArg( "levels", "artist-album" ); + url.setArg( QStringLiteral("filter"), "artist:\"" + artist + "\" AND album:\"" + album + "\"" ); + url.setArg( QStringLiteral("levels"), QStringLiteral("artist-album") ); debug() << "running url: " << url.url(); url.run(); } diff --git a/src/services/ServiceCollection.h b/src/services/ServiceCollection.h --- a/src/services/ServiceCollection.h +++ b/src/services/ServiceCollection.h @@ -45,37 +45,37 @@ { Q_OBJECT public: - ServiceCollection( ServiceBase * service = 0 ); + explicit ServiceCollection( ServiceBase * service = 0 ); ServiceCollection( ServiceBase * service, const QString &id, const QString &prettyName ); virtual ~ServiceCollection(); - virtual Collections::QueryMaker* queryMaker(); + Collections::QueryMaker* queryMaker() override; - virtual QString collectionId() const; - virtual QString prettyName() const; - virtual QIcon icon() const { return QIcon::fromTheme("action-view-services-scripted-amarok"); } + QString collectionId() const override; + QString prettyName() const override; + QIcon icon() const override { return QIcon::fromTheme(QStringLiteral("action-view-services-scripted-amarok")); } - virtual CollectionLocation* location(); + CollectionLocation* location() override; void emitUpdated(); virtual QStringList query( const QString &query ) { Q_UNUSED( query ); return QStringList(); } virtual int insert( const QString &statement, const QString &table ) { Q_UNUSED( statement ); Q_UNUSED( table ); return 0; } - virtual QString escape( QString text ) const { Q_UNUSED( text ); return QString(); } + virtual QString escape( const QString &text ) const { Q_UNUSED( text ); return QString(); } Meta::TrackPtr trackById( int id ); Meta::AlbumPtr albumById( int id ); Meta::ArtistPtr artistById( int id ); Meta::GenrePtr genreById( int id ); - //Override some stuff to be able to hande id mappings + //Override some stuff to be able to handle id mappings - void addTrack( Meta::TrackPtr trackPtr ); - void addArtist( Meta::ArtistPtr artistPtr ); - void addAlbum( Meta::AlbumPtr albumPtr ); - void addGenre( Meta::GenrePtr genrePtr ); + void addTrack( const Meta::TrackPtr &trackPtr ); + void addArtist( const Meta::ArtistPtr &artistPtr ); + void addAlbum( const Meta::AlbumPtr &albumPtr ); + void addGenre( const Meta::GenrePtr &genrePtr ); //TODO: //void setTrackMap( TrackMap map ) { m_trackMap = map; } diff --git a/src/services/ServiceCollection.cpp b/src/services/ServiceCollection.cpp --- a/src/services/ServiceCollection.cpp +++ b/src/services/ServiceCollection.cpp @@ -83,38 +83,38 @@ void ServiceCollection::emitUpdated() { - emit( updated() ); + Q_EMIT( updated() ); } -void ServiceCollection::addTrack( Meta::TrackPtr trackPtr ) +void ServiceCollection::addTrack( const Meta::TrackPtr &trackPtr ) { m_mc->addTrack( trackPtr ); const Meta::ServiceTrackPtr track = Meta::ServiceTrackPtr::dynamicCast( trackPtr ); if ( track && track->id() != 0 ) m_trackIdMap.insert( track->id(), trackPtr ); } -void ServiceCollection::addArtist( Meta::ArtistPtr artistPtr ) +void ServiceCollection::addArtist( const Meta::ArtistPtr &artistPtr ) { m_mc->addArtist( artistPtr ); const Meta::ServiceArtistPtr artist = Meta::ServiceArtistPtr::dynamicCast( artistPtr ); if ( artist && artist->id() != 0 ) m_artistIdMap.insert( artist->id(), artistPtr ); } -void ServiceCollection::addAlbum( Meta::AlbumPtr albumPtr ) +void ServiceCollection::addAlbum( const Meta::AlbumPtr &albumPtr ) { m_mc->addAlbum( albumPtr ); const Meta::ServiceAlbumPtr album = Meta::ServiceAlbumPtr::dynamicCast( albumPtr ); if ( album && album->id() != 0 ) m_albumIdMap.insert( album->id(), albumPtr ); } -void ServiceCollection::addGenre( Meta::GenrePtr genrePtr ) +void ServiceCollection::addGenre( const Meta::GenrePtr &genrePtr ) { m_mc->addGenre( genrePtr ); const Meta::ServiceGenrePtr genre = Meta::ServiceGenrePtr::dynamicCast( genrePtr ); diff --git a/src/services/ServiceCollectionLocation.h b/src/services/ServiceCollectionLocation.h --- a/src/services/ServiceCollectionLocation.h +++ b/src/services/ServiceCollectionLocation.h @@ -32,15 +32,15 @@ Q_OBJECT public: ServiceCollectionLocation(); - ServiceCollectionLocation( ServiceCollection *parentCollection ); + explicit ServiceCollectionLocation( ServiceCollection *parentCollection ); virtual ~ServiceCollectionLocation(); - virtual void getKIOCopyableUrls( const Meta::TrackList &tracks ); + void getKIOCopyableUrls( const Meta::TrackList &tracks ) override; - //These are service dependant - virtual QString prettyLocation() const; - virtual bool isWritable() const; - virtual bool isOrganizable() const; + //These are service dependent + QString prettyLocation() const override; + bool isWritable() const override; + bool isOrganizable() const override; private: ServiceCollection *m_collection; //parent collection bool m_removeSources; //used by the destination to remember the value, needed in copyurlsToCollection diff --git a/src/services/ServiceCollectionLocation.cpp b/src/services/ServiceCollectionLocation.cpp --- a/src/services/ServiceCollectionLocation.cpp +++ b/src/services/ServiceCollectionLocation.cpp @@ -55,7 +55,7 @@ ServiceCollectionLocation::getKIOCopyableUrls( const Meta::TrackList &tracks ) { QMap urls; - foreach( Meta::TrackPtr track, tracks ) + foreach( const Meta::TrackPtr &track, tracks ) { Meta::ServiceTrack *servtrack = static_cast( track.data() ); if( servtrack->isPlayable() ) diff --git a/src/services/ServiceCollectionTreeView.h b/src/services/ServiceCollectionTreeView.h --- a/src/services/ServiceCollectionTreeView.h +++ b/src/services/ServiceCollectionTreeView.h @@ -31,15 +31,15 @@ class ServiceCollectionTreeView : public CollectionTreeView { public: - ServiceCollectionTreeView( QWidget *parent = 0 ); + explicit ServiceCollectionTreeView( QWidget *parent = nullptr ); ~ServiceCollectionTreeView(); void setPlayableTracks( bool playable ); bool playableTracks() const; protected: - void mouseDoubleClickEvent(QMouseEvent* event); - void contextMenuEvent(QContextMenuEvent* event); + void mouseDoubleClickEvent(QMouseEvent* event) override; + void contextMenuEvent(QContextMenuEvent* event) override; private: bool m_playableTracks; diff --git a/src/services/ServiceMetaBase.h b/src/services/ServiceMetaBase.h --- a/src/services/ServiceMetaBase.h +++ b/src/services/ServiceMetaBase.h @@ -31,16 +31,15 @@ namespace Amarok { - class TrackProvider; } class AMAROK_EXPORT ServiceMetaFactory { public: - ServiceMetaFactory( const QString &dbPrefix ); + explicit ServiceMetaFactory( const QString &dbPrefix ); virtual ~ServiceMetaFactory() {} - QString tablePrefix(); + QString tablePrefix() const; virtual int getTrackSqlRowCount(); virtual QString getTrackSqlRows(); @@ -102,10 +101,10 @@ virtual ~BookmarkThisProvider() {} virtual bool isBookmarkable() const { return false; } - virtual QString browserName() const { return "internet"; } + virtual QString browserName() const { return QStringLiteral("internet"); } virtual QString collectionName() const { return QString(); } virtual bool simpleFiltering() const { return true; } - virtual QAction * bookmarkAction() { return 0; }; + virtual QAction * bookmarkAction() { return 0; } protected: QPointer m_bookmarkAction; @@ -144,69 +143,69 @@ public: //Give this a displayable name as some services has terrible names for their streams //ServiceTrack( const QString & name ); - ServiceTrack( const QString & name ); + explicit ServiceTrack( const QString & name ); //create track based on an sql query result - ServiceTrack( const QStringList & resultRow ); + explicit ServiceTrack( const QStringList & resultRow ); virtual ~ServiceTrack(); - virtual QString name() const; + QString name() const override; virtual QUrl downloadableUrl() const; - virtual QUrl playableUrl() const; - virtual QString uidUrl() const; - virtual QString prettyUrl() const; - virtual QString notPlayableReason() const; + QUrl playableUrl() const override; + QString uidUrl() const override; + QString prettyUrl() const override; + QString notPlayableReason() const override; - virtual AlbumPtr album() const; + AlbumPtr album() const override; virtual void setAlbum( const QString &newAlbum ); - virtual ArtistPtr artist() const; + ArtistPtr artist() const override; virtual void setArtist( const QString &newArtist ); - virtual GenrePtr genre() const; + GenrePtr genre() const override; virtual void setGenre( const QString &newGenre ); - virtual ComposerPtr composer() const; + ComposerPtr composer() const override; virtual void setComposer( const QString &newComposer ); - virtual YearPtr year() const; + YearPtr year() const override; virtual void setYear( int newYear ); virtual void setTitle( const QString &newTitle ); - virtual qreal bpm() const; + qreal bpm() const override; - virtual QString comment() const; + QString comment() const override; virtual void setComment( const QString &newComment ); virtual QString description() const; virtual void setDescription( const QString &newDescription ); - virtual qint64 length() const; + qint64 length() const override; - virtual int filesize() const; - virtual int sampleRate() const; - virtual int bitrate() const; + int filesize() const override; + int sampleRate() const override; + int bitrate() const override; - virtual int trackNumber() const; + int trackNumber() const override; virtual void setTrackNumber( int newTrackNumber ); - virtual int discNumber() const; + int discNumber() const override; virtual void setDiscNumber( int newDiscNumber ); - virtual QString type() const; + QString type() const override; - virtual void processInfoOf( InfoParserBase * infoParser ); + void processInfoOf( InfoParserBase * infoParser ) override; - virtual bool hasCapabilityInterface( Capabilities::Capability::Type type ) const + bool hasCapabilityInterface( Capabilities::Capability::Type type ) const override { return ( type == Capabilities::Capability::Actions ) || ( type == Capabilities::Capability::SourceInfo && hasSourceInfo() ) || ( type == Capabilities::Capability::BookmarkThis ) || ( type == Capabilities::Capability::FindInSource && isBookmarkable() ); } - virtual Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ) + Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ) override { if ( type == Capabilities::Capability::Actions ) return new ServiceActionsCapability( this ); @@ -219,16 +218,16 @@ return 0; } - virtual StatisticsPtr statistics(); + StatisticsPtr statistics() override; //ServiceTrack specific methods - virtual void setAlbumPtr( Meta::AlbumPtr album ); - void setArtist( Meta::ArtistPtr artist ); - void setComposer( Meta::ComposerPtr composer ); - void setGenre( Meta::GenrePtr genre ); - void setYear( Meta::YearPtr year ); - void setStatisticsProvider( Meta::StatisticsPtr provider ); + virtual void setAlbumPtr( const Meta::AlbumPtr &album ); + void setArtist( const Meta::ArtistPtr &artist ); + void setComposer( const Meta::ComposerPtr &composer ); + void setGenre( const Meta::GenrePtr &genre ); + void setYear( const Meta::YearPtr &year ); + void setStatisticsProvider( const Meta::StatisticsPtr &provider ); void setLength( qint64 length ); @@ -271,25 +270,25 @@ public BookmarkThisProvider { public: - ServiceArtist( const QStringList & resultRow ); - ServiceArtist( const QString & name ); + explicit ServiceArtist( const QStringList & resultRow ); + explicit ServiceArtist( const QString & name ); virtual ~ServiceArtist(); - virtual QString name() const; + QString name() const override; - virtual TrackList tracks(); + TrackList tracks() override; - virtual void processInfoOf( InfoParserBase * infoParser ); + void processInfoOf( InfoParserBase * infoParser ) override; - virtual bool hasCapabilityInterface( Capabilities::Capability::Type type ) const + bool hasCapabilityInterface( Capabilities::Capability::Type type ) const override { return ( type == Capabilities::Capability::Actions ) || ( type == Capabilities::Capability::SourceInfo && hasSourceInfo() ) || ( type == Capabilities::Capability::BookmarkThis ); } - virtual Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ) + Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ) override { if ( type == Capabilities::Capability::Actions ) return new ServiceActionsCapability( this ); @@ -300,7 +299,7 @@ return 0; } - virtual QAction * bookmarkAction() { + QAction * bookmarkAction() override { if ( isBookmarkable() ) { if ( m_bookmarkAction.isNull()) @@ -313,16 +312,16 @@ //ServiceArtist specific methods - void addTrack( TrackPtr track ); + void addTrack( const TrackPtr &track ); void setDescription( const QString &description ); QString description( ) const; void setId( int id ); int id( ) const; void setTitle( const QString &title ); - void setSourceName( const QString source ) { m_sourceName = source; } - virtual QString sourceName() { return m_sourceName; } + void setSourceName( const QString &source ) { m_sourceName = source; } + QString sourceName() override { return m_sourceName; } private: int m_id; @@ -339,30 +338,30 @@ public BookmarkThisProvider { public: - ServiceAlbum( const QStringList & resultRow ); - ServiceAlbum( const QString & name ); + explicit ServiceAlbum( const QStringList & resultRow ); + explicit ServiceAlbum( const QString & name ); virtual ~ServiceAlbum(); - virtual QString name() const; + QString name() const override; - virtual bool isCompilation() const; - virtual bool canUpdateCompilation() const; - virtual void setCompilation( bool compilation ); + bool isCompilation() const override; + bool canUpdateCompilation() const override; + void setCompilation( bool compilation ) override; - virtual bool hasAlbumArtist() const; - virtual ArtistPtr albumArtist() const; - virtual TrackList tracks(); + bool hasAlbumArtist() const override; + ArtistPtr albumArtist() const override; + TrackList tracks() override; - virtual void processInfoOf( InfoParserBase * infoParser ); + void processInfoOf( InfoParserBase * infoParser ) override; - virtual bool hasCapabilityInterface( Capabilities::Capability::Type type ) const + bool hasCapabilityInterface( Capabilities::Capability::Type type ) const override { return ( type == Capabilities::Capability::Actions ) || ( type == Capabilities::Capability::SourceInfo && hasSourceInfo() ) || ( type == Capabilities::Capability::BookmarkThis ); } - virtual Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ) + Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ) override { if ( type == Capabilities::Capability::Actions ) return new ServiceActionsCapability( this ); @@ -373,7 +372,7 @@ return 0; } - virtual QAction * bookmarkAction() { + QAction * bookmarkAction() override { if ( isBookmarkable() ) { if ( m_bookmarkAction.isNull()) @@ -385,8 +384,8 @@ } //ServiceAlbum specific methods - void addTrack( TrackPtr track ); - void setAlbumArtist( ArtistPtr artist ); + void addTrack( const TrackPtr &track ); + void setAlbumArtist( const ArtistPtr &artist ); void setDescription( const QString &description ); QString description( ) const; @@ -402,8 +401,8 @@ void setTitle( const QString &title ); - void setSourceName( const QString source ) { m_sourceName = source; } - virtual QString sourceName() { return m_sourceName; } + void setSourceName( const QString &source ) { m_sourceName = source; } + QString sourceName() override { return m_sourceName; } private: int m_id; @@ -424,24 +423,24 @@ public BookmarkThisProvider { public: - ServiceGenre( const QString &name ); - ServiceGenre( const QStringList &row ); + explicit ServiceGenre( const QString &name ); + explicit ServiceGenre( const QStringList &row ); virtual ~ServiceGenre(); - virtual QString name() const; + QString name() const override; - virtual TrackList tracks(); + TrackList tracks() override; - virtual void processInfoOf( InfoParserBase * infoParser ); + void processInfoOf( InfoParserBase * infoParser ) override; - virtual bool hasCapabilityInterface( Capabilities::Capability::Type type ) const + bool hasCapabilityInterface( Capabilities::Capability::Type type ) const override { return ( type == Capabilities::Capability::Actions ) || ( type == Capabilities::Capability::SourceInfo && hasSourceInfo() ) || ( type == Capabilities::Capability::BookmarkThis ); } - virtual Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ) + Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ) override { if ( type == Capabilities::Capability::Actions ) return new ServiceActionsCapability( this ); @@ -457,13 +456,13 @@ void setId( int id ); int id() const; - void addTrack( TrackPtr track ); + void addTrack( const TrackPtr &track ); int albumId(); void setAlbumId( int albumId ); - void setSourceName( const QString source ) { m_sourceName = source; } - virtual QString sourceName() { return m_sourceName; } + void setSourceName( const QString &source ) { m_sourceName = source; } + QString sourceName() override { return m_sourceName; } private: int m_id; @@ -480,23 +479,23 @@ public BookmarkThisProvider { public: - ServiceComposer( const QString &name ); - virtual ~ServiceComposer(); + explicit ServiceComposer( const QString &name ); + ~ServiceComposer() override; - virtual QString name() const; + QString name() const override; - virtual TrackList tracks(); + TrackList tracks() override; - virtual void processInfoOf( InfoParserBase * infoParser ); + void processInfoOf( InfoParserBase * infoParser ) override; - virtual bool hasCapabilityInterface( Capabilities::Capability::Type type ) const + bool hasCapabilityInterface( Capabilities::Capability::Type type ) const override { return ( type == Capabilities::Capability::Actions ) || ( type == Capabilities::Capability::SourceInfo && hasSourceInfo() ) || ( type == Capabilities::Capability::BookmarkThis ); } - virtual Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ) + Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ) override { if ( type == Capabilities::Capability::Actions ) return new ServiceActionsCapability( this ); @@ -508,7 +507,7 @@ } //ServiceComposer specific methods - void addTrack( ServiceTrackPtr track ); + void addTrack( const ServiceTrackPtr &track ); private: QString m_name; @@ -522,23 +521,23 @@ public BookmarkThisProvider { public: - ServiceYear( const QString &name ); + explicit ServiceYear( const QString &name ); virtual ~ServiceYear(); - virtual QString name() const; + QString name() const override; - virtual TrackList tracks(); + TrackList tracks() override; - virtual void processInfoOf( InfoParserBase * infoParser ); + void processInfoOf( InfoParserBase * infoParser ) override; - virtual bool hasCapabilityInterface( Capabilities::Capability::Type type ) const + bool hasCapabilityInterface( Capabilities::Capability::Type type ) const override { return ( type == Capabilities::Capability::Actions ) || ( type == Capabilities::Capability::SourceInfo && hasSourceInfo() ) || ( type == Capabilities::Capability::BookmarkThis ); } - virtual Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ) + Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ) override { if ( type == Capabilities::Capability::Actions ) return new ServiceActionsCapability( this ); @@ -550,7 +549,7 @@ } //ServiceYear specific methods - void addTrack( ServiceTrackPtr track ); + void addTrack( const ServiceTrackPtr &track ); private: QString m_name; diff --git a/src/services/ServiceMetaBase.cpp b/src/services/ServiceMetaBase.cpp --- a/src/services/ServiceMetaBase.cpp +++ b/src/services/ServiceMetaBase.cpp @@ -30,7 +30,7 @@ } QString -ServiceMetaFactory::tablePrefix() +ServiceMetaFactory::tablePrefix() const { return m_dbTablePrefix; } @@ -426,37 +426,37 @@ } void -ServiceTrack::setAlbumPtr( AlbumPtr album ) +ServiceTrack::setAlbumPtr( const AlbumPtr &album ) { m_album = album; } void -ServiceTrack::setArtist( ArtistPtr artist ) +ServiceTrack::setArtist( const ArtistPtr &artist ) { m_artist = artist; } void -ServiceTrack::setGenre( GenrePtr genre ) +ServiceTrack::setGenre( const GenrePtr &genre ) { m_genre = genre; } void -ServiceTrack::setComposer( ComposerPtr composer ) +ServiceTrack::setComposer( const ComposerPtr &composer ) { m_composer = composer; } void -ServiceTrack::setYear( YearPtr year ) +ServiceTrack::setYear( const YearPtr &year ) { m_year = year; } void -ServiceTrack::setStatisticsProvider( StatisticsPtr provider ) +ServiceTrack::setStatisticsProvider( const StatisticsPtr &provider ) { m_statsStore = provider; } @@ -553,7 +553,7 @@ } void -ServiceArtist::addTrack( TrackPtr track ) +ServiceArtist::addTrack( const TrackPtr &track ) { m_tracks.append( track ); } @@ -700,13 +700,13 @@ } void -ServiceAlbum::addTrack( TrackPtr track ) +ServiceAlbum::addTrack( const TrackPtr &track ) { m_tracks.append( track ); } void -ServiceAlbum::setAlbumArtist( ArtistPtr artist ) +ServiceAlbum::setAlbumArtist( const ArtistPtr &artist ) { m_albumArtist = artist; } @@ -801,7 +801,7 @@ } void -ServiceGenre::addTrack( TrackPtr track ) +ServiceGenre::addTrack( const TrackPtr &track ) { m_tracks.append( track ); } @@ -845,7 +845,7 @@ } void -ServiceComposer::addTrack( ServiceTrackPtr track ) +ServiceComposer::addTrack( const ServiceTrackPtr &track ) { m_tracks.append( TrackPtr::staticCast( track ) ); } @@ -889,7 +889,7 @@ } void -ServiceYear::addTrack( ServiceTrackPtr track ) +ServiceYear::addTrack( const ServiceTrackPtr &track ) { m_tracks.append( TrackPtr::staticCast( track ) ); } diff --git a/src/services/ServicePluginManager.h b/src/services/ServicePluginManager.h --- a/src/services/ServicePluginManager.h +++ b/src/services/ServicePluginManager.h @@ -22,8 +22,6 @@ #include class ServiceBase; -class ServiceBrowser; -class ServiceFactory; namespace Plugins { class PluginFactory; } @@ -45,7 +43,7 @@ * Load any services that are configured to be loaded. * Unload any services that have been switched off. */ - void setFactories( const QList &factories ); + void setFactories( const QList > &factories ); public Q_SLOTS: QStringList loadedServices() const; @@ -64,7 +62,7 @@ /** The list of currently set factories. * Note: the PluginManager owns the pointers. */ - QList m_factories; + QList > m_factories; private Q_SLOTS: void slotNewService( ServiceBase *newService); diff --git a/src/services/ServicePluginManager.cpp b/src/services/ServicePluginManager.cpp --- a/src/services/ServicePluginManager.cpp +++ b/src/services/ServicePluginManager.cpp @@ -28,7 +28,7 @@ #include #include -ServicePluginManager *ServicePluginManager::s_instance = 0; +ServicePluginManager *ServicePluginManager::s_instance = nullptr; ServicePluginManager * ServicePluginManager::instance() @@ -46,7 +46,7 @@ { if( s_instance ) { delete s_instance; - s_instance = 0; + s_instance = nullptr; } } @@ -58,7 +58,7 @@ // ensure this object is created in a main thread Q_ASSERT( thread() == QCoreApplication::instance()->thread() ); - setObjectName( "ServicePluginManager" ); + setObjectName( QStringLiteral("ServicePluginManager") ); } @@ -68,15 +68,15 @@ void -ServicePluginManager::setFactories( const QList &factories ) +ServicePluginManager::setFactories( const QList > &factories ) { - QSet newFactories = factories.toSet(); - QSet oldFactories = m_factories.toSet(); + QSet > newFactories = factories.toSet(); + QSet > oldFactories = m_factories.toSet(); // remove old factories - foreach( Plugins::PluginFactory* pFactory, oldFactories - newFactories ) + for( const auto &pFactory : oldFactories - newFactories ) { - ServiceFactory *factory = qobject_cast( pFactory ); + auto factory = qobject_cast( pFactory ); if( !factory ) continue; @@ -86,14 +86,14 @@ } // create new factories - foreach( Plugins::PluginFactory* pFactory, newFactories - oldFactories ) + for( const auto &pFactory : newFactories - oldFactories ) { - ServiceFactory *factory = qobject_cast( pFactory ); + auto factory = qobject_cast( pFactory ); if( !factory ) continue; - connect( factory, &ServiceFactory::newService, this, &ServicePluginManager::slotNewService ); - connect( factory, &ServiceFactory::removeService, this, &ServicePluginManager::slotRemoveService ); + connect( factory.data(), &ServiceFactory::newService, this, &ServicePluginManager::slotNewService ); + connect( factory.data(), &ServiceFactory::removeService, this, &ServicePluginManager::slotRemoveService ); } m_factories = factories; @@ -119,9 +119,9 @@ ServicePluginManager::loadedServices() const { QStringList names; - foreach( Plugins::PluginFactory *pFactory, m_factories ) + for( const auto &pFactory : m_factories ) { - ServiceFactory *factory = qobject_cast( pFactory ); + auto factory = qobject_cast( pFactory ); if( !factory ) continue; diff --git a/src/services/ServiceSqlCollection.h b/src/services/ServiceSqlCollection.h --- a/src/services/ServiceSqlCollection.h +++ b/src/services/ServiceSqlCollection.h @@ -33,20 +33,20 @@ virtual ~ServiceSqlCollection(); virtual void startFullScan() {} //TODO - virtual QueryMaker* queryMaker(); + QueryMaker* queryMaker() override; - virtual QString collectionId() const; - virtual QString prettyName() const; + QString collectionId() const override; + QString prettyName() const override; - virtual QStringList query( const QString &query ); - virtual int insert( const QString &statement, const QString &table ); + QStringList query( const QString &query ) override; + int insert( const QString &statement, const QString &table ) override; - virtual QString escape( QString text ) const; + QString escape( const QString &text ) const override; - void emitUpdated() { emit( updated() ); } + void emitUpdated() { Q_EMIT( updated() ); } - virtual Meta::TrackPtr trackForUrl( const QUrl &url ); - virtual bool possiblyContainsTrack( const QUrl &url ) const; + Meta::TrackPtr trackForUrl( const QUrl &url ) override; + bool possiblyContainsTrack( const QUrl &url ) const override; private: diff --git a/src/services/ServiceSqlCollection.cpp b/src/services/ServiceSqlCollection.cpp --- a/src/services/ServiceSqlCollection.cpp +++ b/src/services/ServiceSqlCollection.cpp @@ -68,7 +68,7 @@ QString -ServiceSqlCollection::escape( QString text ) const +ServiceSqlCollection::escape(const QString &text ) const { return StorageManager::instance()->sqlStorage()->escape( text ); } @@ -80,7 +80,7 @@ return Meta::TrackPtr(); //split out the parts we can be sure about ( strip username and such info ) - QString trackRows = m_metaFactory->getTrackSqlRows() + ',' + m_metaFactory->getAlbumSqlRows() + ',' + m_metaFactory->getArtistSqlRows() + ',' + m_metaFactory->getGenreSqlRows(); + QString trackRows = m_metaFactory->getTrackSqlRows() + QLatin1Char(',') + m_metaFactory->getAlbumSqlRows() + QLatin1Char(',') + m_metaFactory->getArtistSqlRows() + QLatin1Char(',') + m_metaFactory->getGenreSqlRows(); QString prefix = m_metaFactory->tablePrefix(); @@ -93,12 +93,12 @@ from += " LEFT JOIN " + prefix + "_artists ON " + prefix + "_albums.artist_id = " + prefix + "_artists.id"; from += " LEFT JOIN " + prefix + "_genre ON " + prefix + "_genre.album_id = " + prefix + "_albums.id"; - QString queryString = QString( "select DISTINCT %1 FROM %2 WHERE %3_tracks.preview_url = '%4' GROUP BY %5_tracks.id;" ) - .arg( trackRows) - .arg( from ) - .arg( prefix ) - .arg( sqlDb->escape( pristineUrl ) ) - .arg( prefix ); + QString queryString = QStringLiteral( "select DISTINCT %1 FROM %2 WHERE %3_tracks.preview_url = '%4' GROUP BY %5_tracks.id;" ) + .arg( trackRows, + from, + prefix, + sqlDb->escape( pristineUrl ), + prefix ); //debug() << "Querying for track: " << queryString; QStringList result = sqlDb->query( queryString ); diff --git a/src/services/ServiceSqlQueryMaker.h b/src/services/ServiceSqlQueryMaker.h --- a/src/services/ServiceSqlQueryMaker.h +++ b/src/services/ServiceSqlQueryMaker.h @@ -39,43 +39,43 @@ ServiceSqlQueryMaker( ServiceSqlCollection* collection, ServiceMetaFactory * metaFactory, ServiceSqlRegistry * registry ); virtual ~ServiceSqlQueryMaker(); - virtual void abortQuery(); - virtual void run(); + void abortQuery() override; + void run() override; - virtual QueryMaker* setQueryType( QueryType type ); + QueryMaker* setQueryType( QueryType type ) override; - virtual QueryMaker* addMatch( const Meta::TrackPtr &track ); - virtual QueryMaker* addMatch( const Meta::ArtistPtr &artist, ArtistMatchBehaviour behaviour = TrackArtists ); - virtual QueryMaker* addMatch( const Meta::AlbumPtr &album ); - virtual QueryMaker* addMatch( const Meta::ComposerPtr &composer ); - virtual QueryMaker* addMatch( const Meta::GenrePtr &genre ); - virtual QueryMaker* addMatch( const Meta::YearPtr &year ); - virtual QueryMaker* addMatch( const Meta::LabelPtr &label ); + QueryMaker* addMatch( const Meta::TrackPtr &track ) override; + QueryMaker* addMatch( const Meta::ArtistPtr &artist, ArtistMatchBehaviour behaviour = TrackArtists ) override; + QueryMaker* addMatch( const Meta::AlbumPtr &album ) override; + QueryMaker* addMatch( const Meta::ComposerPtr &composer ) override; + QueryMaker* addMatch( const Meta::GenrePtr &genre ) override; + QueryMaker* addMatch( const Meta::YearPtr &year ) override; + QueryMaker* addMatch( const Meta::LabelPtr &label ) override; - virtual QueryMaker* addFilter( qint64 value, const QString &filter, bool matchBegin, bool matchEnd ); - virtual QueryMaker* excludeFilter( qint64 value, const QString &filter, bool matchBegin, bool matchEnd ); + QueryMaker* addFilter( qint64 value, const QString &filter, bool matchBegin, bool matchEnd ) override; + QueryMaker* excludeFilter( qint64 value, const QString &filter, bool matchBegin, bool matchEnd ) override; - virtual QueryMaker* addNumberFilter( qint64 value, qint64 filter, QueryMaker::NumberComparison compare ); - virtual QueryMaker* excludeNumberFilter( qint64 value, qint64 filter, QueryMaker::NumberComparison compare ); + QueryMaker* addNumberFilter( qint64 value, qint64 filter, QueryMaker::NumberComparison compare ) override; + QueryMaker* excludeNumberFilter( qint64 value, qint64 filter, QueryMaker::NumberComparison compare ) override; - virtual QueryMaker* addReturnValue( qint64 value ); - virtual QueryMaker* addReturnFunction( ReturnFunction function, qint64 value ); - virtual QueryMaker* orderBy( qint64 value, bool descending = false ); + QueryMaker* addReturnValue( qint64 value ) override; + QueryMaker* addReturnFunction( ReturnFunction function, qint64 value ) override; + QueryMaker* orderBy( qint64 value, bool descending = false ) override; - virtual QueryMaker* limitMaxResultSize( int size ); + QueryMaker* limitMaxResultSize( int size ) override; - virtual QueryMaker* beginAnd(); - virtual QueryMaker* beginOr(); - virtual QueryMaker* endAndOr(); + QueryMaker* beginAnd() override; + QueryMaker* beginOr() override; + QueryMaker* endAndOr() override; - virtual QueryMaker* setAlbumQueryMode( AlbumQueryMode mode ); + QueryMaker* setAlbumQueryMode( AlbumQueryMode mode ) override; QString query(); QStringList runQuery( const QString &query ); void handleResult( const QStringList &result ); protected: - virtual QString escape( QString text ) const; + virtual QString escape( const QString &text ) const; virtual QString likeCondition( const QString &text, bool anyBegin, bool anyEnd ) const; public Q_SLOTS: diff --git a/src/services/ServiceSqlQueryMaker.cpp b/src/services/ServiceSqlQueryMaker.cpp --- a/src/services/ServiceSqlQueryMaker.cpp +++ b/src/services/ServiceSqlQueryMaker.cpp @@ -43,7 +43,7 @@ //nothing to do } - virtual void requestAbort() + void requestAbort() override { m_aborted = true; } @@ -59,7 +59,7 @@ protected: - virtual void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) + void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = nullptr) override { Q_UNUSED(self); Q_UNUSED(thread); @@ -74,13 +74,13 @@ setStatus(Status_Running); } - void defaultBegin(const ThreadWeaver::JobPointer& self, ThreadWeaver::Thread *thread) + void defaultBegin(const ThreadWeaver::JobPointer& self, ThreadWeaver::Thread *thread) override { Q_EMIT started(self); ThreadWeaver::Job::defaultBegin(self, thread); } - void defaultEnd(const ThreadWeaver::JobPointer& self, ThreadWeaver::Thread *thread) + void defaultEnd(const ThreadWeaver::JobPointer& self, ThreadWeaver::Thread *thread) override { ThreadWeaver::Job::defaultEnd(self, thread); if (!self->success()) { @@ -96,10 +96,9 @@ struct ServiceSqlQueryMaker::Private { - enum QueryType { NONE, TRACK, ARTIST, ALBUM, ALBUMARTIST, GENRE, COMPOSER, YEAR, CUSTOM }; - enum {TRACKS_TABLE = 1, ALBUMS_TABLE = 2, ARTISTS_TABLE = 4, GENRE_TABLE = 8, ALBUMARTISTS_TABLE = 16 }; + enum { TRACKS_TABLE = 1, ALBUMS_TABLE = 2, ARTISTS_TABLE = 4, GENRE_TABLE = 8, ALBUMARTISTS_TABLE = 16 }; int linkedTables; - QueryType queryType; + QueryMaker::QueryType queryType; QString query; QString queryReturnValues; QString queryFrom; @@ -125,7 +124,7 @@ //d->includedBuilder = true; //d->collectionRestriction = false; - d->queryType = Private::NONE; + d->queryType = QueryMaker::None; d->linkedTables = 0; d->withoutDuplicates = false; d->maxResultSize = -1; @@ -145,7 +144,7 @@ void ServiceSqlQueryMaker::run() { - if( d->queryType == Private::NONE ) + if( d->queryType == QueryMaker::None ) return; //better error handling? if( d->worker && !d->worker->isFinished() ) { @@ -168,26 +167,26 @@ Q_UNUSED( job ) d->worker.clear(); - emit queryDone(); + Q_EMIT queryDone(); } QueryMaker* ServiceSqlQueryMaker::setQueryType( QueryType type) { switch( type ) { case QueryMaker::Track: //make sure to keep this method in sync with handleTracks(QStringList) and the SqlTrack ctor - if( d->queryType == Private::NONE ) + if( d->queryType == QueryMaker::None ) { QString prefix = m_metaFactory->tablePrefix(); //d->queryFrom = ' ' + prefix + "_tracks"; d->withoutDuplicates = true; d->queryFrom = ' ' + prefix + "_tracks"; - d->queryType = Private::TRACK; - d->queryReturnValues = m_metaFactory->getTrackSqlRows() + ',' + - m_metaFactory->getAlbumSqlRows() + ',' + - m_metaFactory->getArtistSqlRows() + ',' + + d->queryType = QueryMaker::Track; + d->queryReturnValues = m_metaFactory->getTrackSqlRows() + QLatin1Char(',') + + m_metaFactory->getAlbumSqlRows() + QLatin1Char(',') + + m_metaFactory->getArtistSqlRows() + QLatin1Char(',') + m_metaFactory->getGenreSqlRows(); d->linkedTables |= Private::GENRE_TABLE; @@ -204,45 +203,45 @@ return this; case QueryMaker::Artist: - if( d->queryType == Private::NONE ) + if( d->queryType == QueryMaker::None ) { QString prefix = m_metaFactory->tablePrefix(); d->queryFrom = ' ' + prefix + "_tracks"; d->linkedTables |= Private::ARTISTS_TABLE; d->linkedTables |= Private::ALBUMS_TABLE; - d->queryType = Private::ARTIST; + d->queryType = QueryMaker::Artist; d->withoutDuplicates = true; d->queryReturnValues = m_metaFactory->getArtistSqlRows(); d->queryOrderBy += " GROUP BY " + prefix + "_tracks.id"; //fixes the same track being shown several times due to being in several genres } return this; case QueryMaker::AlbumArtist: - if( d->queryType == Private::NONE ) + if( d->queryType == QueryMaker::None ) { QString prefix = m_metaFactory->tablePrefix(); d->queryFrom = ' ' + prefix + "_tracks"; d->linkedTables |= Private::ALBUMARTISTS_TABLE; - d->queryType = Private::ALBUMARTIST; + d->queryType = QueryMaker::AlbumArtist; d->withoutDuplicates = true; - d->queryReturnValues = QString( "albumartists.id, " ) + + d->queryReturnValues = QStringLiteral( "albumartists.id, " ) + "albumartists.name, " + "albumartists.description "; d->queryOrderBy += " GROUP BY " + prefix + "_tracks.id"; //fixes the same track being shown several times due to being in several genres } return this; case QueryMaker::Album: - if( d->queryType == Private::NONE ) + if( d->queryType == QueryMaker::None ) { QString prefix = m_metaFactory->tablePrefix(); d->queryFrom = ' ' + prefix + "_tracks"; - d->queryType = Private::ALBUM; + d->queryType = QueryMaker::Album; d->linkedTables |= Private::ALBUMS_TABLE; d->linkedTables |= Private::ARTISTS_TABLE; d->withoutDuplicates = true; - d->queryReturnValues = m_metaFactory->getAlbumSqlRows() + ',' + + d->queryReturnValues = m_metaFactory->getAlbumSqlRows() + QLatin1Char(',') + m_metaFactory->getArtistSqlRows(); d->queryOrderBy += " GROUP BY " + prefix + "_tracks.id"; //fixes the same track being shown several times due to being in several genres @@ -252,21 +251,21 @@ case QueryMaker::Composer: /* if( d->queryType == Private::NONE ) { - d->queryType = Private::COMPOSER; + d->queryType = QueryMaker::Composer; d->withoutDuplicates = true; - d->linkedTables |= Private::COMPOSER_TAB; + d->linkedTables |= QueryMaker::Composer_TAB; d->queryReturnValues = "composer.name, composer.id"; }*/ return this; case QueryMaker::Genre: - if( d->queryType == Private::NONE ) + if( d->queryType == QueryMaker::None ) { QString prefix = m_metaFactory->tablePrefix(); d->queryFrom = ' ' + prefix + "_genre"; - d->queryType = Private::GENRE; - //d->linkedTables |= Private::ALBUMS_TABLE; - //d->linkedTables |= Private::GENRE_TABLE; + d->queryType = QueryMaker::Genre; + //d->linkedTables |= QueryMaker::Albums_TABLE; + //d->linkedTables |= QueryMaker::Genre_TABLE; d->withoutDuplicates = true; d->queryReturnValues = m_metaFactory->getGenreSqlRows(); d->queryOrderBy = " GROUP BY " + prefix +"_genre.name"; // HAVING COUNT ( " + prefix +"_genre.name ) > 10 "; @@ -301,7 +300,7 @@ { //DEBUG_BLOCK Q_UNUSED( track ); - //TODO still pondereing this one... + //TODO still pondering this one... return this; } @@ -327,7 +326,7 @@ d->queryMatch += QString( " AND " + prefix + "_artists.id= '%1'" ).arg( serviceArtist->id() ); break; case AlbumArtists: - d->queryMatch += QString( " AND albumartists.id= '%1'" ).arg( serviceArtist->id() ); + d->queryMatch += QStringLiteral( " AND albumartists.id= '%1'" ).arg( serviceArtist->id() ); break; case AlbumOrTrackArtists: d->queryMatch += QString( " AND ( " + prefix + "_artists.id= '%1' OR albumartists.id= '%1' )" ).arg( serviceArtist->id() ); @@ -342,7 +341,7 @@ d->queryMatch += QString( " AND " + prefix + "_artists.name= '%1'" ).arg( escape( artist->name() ) ); break; case AlbumArtists: - d->queryMatch += QString( " AND albumartists.name= '%1'" ).arg( escape( artist->name() ) ); + d->queryMatch += QStringLiteral( " AND albumartists.name= '%1'" ).arg( escape( artist->name() ) ); break; case AlbumOrTrackArtists: d->queryMatch += QString( " AND ( " + prefix + "_artists.name= '%1' OR albumartists.name= '%1' )" ).arg( escape( artist->name() ) ); @@ -365,7 +364,7 @@ d->linkedTables |= Private::ALBUMS_TABLE; d->linkedTables |= Private::ARTISTS_TABLE; - if( d->queryType == Private::GENRE ) + if( d->queryType == QueryMaker::Genre ) d->linkedTables |= Private::GENRE_TABLE; if( serviceAlbum ) { @@ -392,12 +391,12 @@ // if ( d->queryType == Private::TRACK ) { //d->queryFrom = ' ' + prefix + "_tracks"; - d->linkedTables |= Private::ALBUMS_TABLE; + d->linkedTables |= Private::ALBUMS_TABLE; //} else //d->queryFrom = ' ' + prefix + "_albums"; //if ( d->queryType == Private::ARTIST ) - //d->linkedTables |= Private::ARTISTS_TABLE; + //d->linkedTables |= Private::ARTISTS_TABLE; d->linkedTables |= Private::GENRE_TABLE; d->queryMatch += QString( " AND " + prefix + "_genre.name = '%1'" ).arg( serviceGenre->name() ); @@ -436,16 +435,16 @@ return this; } //a few hacks needed by some of the speedup code: - if ( d->queryType == Private::GENRE ) + if ( d->queryType == QueryMaker::Genre ) { QString prefix = m_metaFactory->tablePrefix(); d->queryFrom = ' ' + prefix + "_tracks"; d->linkedTables |= Private::ALBUMS_TABLE; d->linkedTables |= Private::ARTISTS_TABLE; d->linkedTables |= Private::GENRE_TABLE; } QString like = likeCondition( filter, !matchBegin, !matchEnd ); - d->queryFilter += QString( " %1 %2 %3 " ).arg( andOr(), nameForValue( value ), like ); + d->queryFilter += QStringLiteral( " %1 %2 %3 " ).arg( andOr(), nameForValue( value ), like ); return this; } @@ -456,7 +455,7 @@ if( isValidValue( value ) ) { QString like = likeCondition( filter, !matchBegin, !matchEnd ); - d->queryFilter += QString( " %1 NOT %2 %3 " ).arg( andOr(), nameForValue( value ), like ); + d->queryFilter += QStringLiteral( " %1 NOT %2 %3 " ).arg( andOr(), nameForValue( value ), like ); } return this; } @@ -507,8 +506,8 @@ { Q_UNUSED( value ); if ( d->queryOrderBy.isEmpty() ) - d->queryOrderBy = " ORDER BY name "; //TODO FIX!! - d->queryOrderBy += QString( " %1 " ).arg( descending ? "DESC" : "ASC" ); + d->queryOrderBy = QStringLiteral(" ORDER BY name "); //TODO FIX!! + d->queryOrderBy += QStringLiteral( " %1 " ).arg( descending ? "DESC" : "ASC" ); return this; } @@ -546,25 +545,25 @@ return; linkTables(); - QString query = "SELECT "; + QString query = QStringLiteral("SELECT "); if ( d->withoutDuplicates ) - query += "DISTINCT "; + query += QLatin1String("DISTINCT "); query += d->queryReturnValues; - query += " FROM "; + query += QLatin1String(" FROM "); query += d->queryFrom; - query += " WHERE 1 "; // oh... to not have to bother with the leadig "AND" + query += QLatin1String(" WHERE 1 "); // oh... to not have to bother with the leadig "AND" // that may or may not be needed query += d->queryMatch; if ( !d->queryFilter.isEmpty() ) { - query += " AND ( 1 "; + query += QLatin1String(" AND ( 1 "); query += d->queryFilter; - query += " ) "; + query += QLatin1String(" ) "); } //query += d->queryFilter; query += d->queryOrderBy; if ( d->maxResultSize > -1 ) - query += QString( " LIMIT %1 OFFSET 0 " ).arg( d->maxResultSize ); + query += QStringLiteral( " LIMIT %1 OFFSET 0 " ).arg( d->maxResultSize ); query += ';'; d->query = query; } @@ -593,64 +592,66 @@ { switch( d->queryType ) { /*case Private::CUSTOM: - emit newResultReady( result ); + Q_EMIT newResultReady( result ); break;*/ - case Private::TRACK: + case QueryMaker::Track: handleTracks( result ); break; - case Private::ARTIST: - case Private::ALBUMARTIST: + case QueryMaker::Artist: + case QueryMaker::AlbumArtist: handleArtists( result ); break; - case Private::ALBUM: + case QueryMaker::Album: handleAlbums( result ); break; - case Private::GENRE: + case QueryMaker::Genre: handleGenres( result ); break; - /* case Private::COMPOSER: + /* case QueryMaker::Composer: handleComposers( result ); break; case Private::YEAR: handleYears( result ); break;*/ - case Private::NONE: + case QueryMaker::None: debug() << "Warning: queryResult with queryType == NONE"; default: break; } } else { - switch( d->queryType ) { + switch( d->queryType ) + { case QueryMaker::Custom: - emit newResultReady( QStringList() ); + Q_EMIT newResultReady( QStringList() ); break; case QueryMaker::Track: - emit newTracksReady( Meta::TrackList() ); + Q_EMIT newTracksReady( Meta::TrackList() ); break; case QueryMaker::Artist: - emit newArtistsReady( Meta::ArtistList() ); + Q_EMIT newArtistsReady( Meta::ArtistList() ); break; case QueryMaker::Album: - emit newAlbumsReady( Meta::AlbumList() ); + Q_EMIT newAlbumsReady( Meta::AlbumList() ); break; case QueryMaker::AlbumArtist: - emit newArtistsReady( Meta::ArtistList() ); + Q_EMIT newArtistsReady( Meta::ArtistList() ); break; case QueryMaker::Genre: - emit newGenresReady( Meta::GenreList() ); + Q_EMIT newGenresReady( Meta::GenreList() ); break; case QueryMaker::Composer: - emit newComposersReady( Meta::ComposerList() ); + Q_EMIT newComposersReady( Meta::ComposerList() ); break; case QueryMaker::Year: - emit newYearsReady( Meta::YearList() ); + Q_EMIT newYearsReady( Meta::YearList() ); + break; + case QueryMaker::None: + debug() << "Warning: queryResult with queryType == NONE"; + default: break; - - case QueryMaker::None: - debug() << "Warning: queryResult with queryType == NONE"; } } @@ -713,7 +714,7 @@ tracks.append( trackptr ); } - emit newTracksReady( tracks ); + Q_EMIT newTracksReady( tracks ); } void @@ -728,7 +729,7 @@ QStringList row = result.mid( i*rowCount, rowCount ); artists.append( m_registry->getArtist( row ) ); } - emit newArtistsReady( artists ); + Q_EMIT newArtistsReady( artists ); } void @@ -743,7 +744,7 @@ QStringList row = result.mid( i*rowCount, rowCount ); albums.append( m_registry->getAlbum( row ) ); } - emit newAlbumsReady( albums ); + Q_EMIT newAlbumsReady( albums ); } void @@ -758,7 +759,7 @@ QStringList row = result.mid( i*rowCount, rowCount ); genres.append( m_registry->getGenre( row ) ); } - emit newGenresReady( genres ); + Q_EMIT newGenresReady( genres ); } /*void @@ -772,7 +773,7 @@ QString id = iter.next(); composers.append( reg->getComposer( name, id.toInt() ) ); } - emit newResultReady( composers ); + Q_EMIT newResultReady( composers ); } void @@ -786,11 +787,11 @@ QString id = iter.next(); years.append( reg->getYear( name, id.toInt() ) ); } - emit newResultReady( years ); + Q_EMIT newResultReady( years ); }*/ QString -ServiceSqlQueryMaker::escape( QString text ) const //krazy2:exclude=constref +ServiceSqlQueryMaker::escape( const QString &text ) const //krazy2:exclude=constref { auto storage = StorageManager::instance()->sqlStorage(); if( storage ) @@ -807,9 +808,9 @@ QString escaped = text; escaped = escape( escaped ); //see comments in SqlQueryMaker::likeCondition - escaped.replace( '%', "/%" ).replace( '_', "/_" ); + escaped.replace( '%', QLatin1String("/%") ).replace( '_', QLatin1String("/_") ); - QString ret = " LIKE "; + QString ret = QStringLiteral(" LIKE "); ret += '\''; if ( anyBegin ) @@ -820,33 +821,33 @@ ret += '\''; //Case insensitive collation for queries - ret += " COLLATE utf8_unicode_ci "; + ret += QLatin1String(" COLLATE utf8_unicode_ci "); //Use / as the escape character - ret += " ESCAPE '/' "; + ret += QLatin1String(" ESCAPE '/' "); return ret; } else { - return QString( " = '%1' " ).arg( escape( text ) ); + return QStringLiteral( " = '%1' " ).arg( escape( text ) ); } } QueryMaker* ServiceSqlQueryMaker::beginAnd() { d->queryFilter += andOr(); - d->queryFilter += " ( 1 "; + d->queryFilter += QLatin1String(" ( 1 "); d->andStack.push( true ); return this; } QueryMaker* ServiceSqlQueryMaker::beginOr() { d->queryFilter += andOr(); - d->queryFilter += " ( 0 "; + d->queryFilter += QLatin1String(" ( 0 "); d->andStack.push( false ); return this; } diff --git a/src/services/ServiceSqlRegistry.h b/src/services/ServiceSqlRegistry.h --- a/src/services/ServiceSqlRegistry.h +++ b/src/services/ServiceSqlRegistry.h @@ -37,7 +37,7 @@ Q_OBJECT public: - ServiceSqlRegistry( ServiceMetaFactory * metaFactory ); + explicit ServiceSqlRegistry( ServiceMetaFactory * metaFactory ); virtual ~ServiceSqlRegistry(); void setMetaFactory( ServiceMetaFactory * metaFactory ); diff --git a/src/services/ServiceSqlRegistry.cpp b/src/services/ServiceSqlRegistry.cpp --- a/src/services/ServiceSqlRegistry.cpp +++ b/src/services/ServiceSqlRegistry.cpp @@ -27,10 +27,10 @@ using namespace Meta; ServiceSqlRegistry::ServiceSqlRegistry( ServiceMetaFactory * metaFactory ) - : QObject( 0 ) + : QObject( nullptr ) , m_metaFactory( metaFactory ) { - setObjectName( "ServiceSqlRegistry" ); + setObjectName( QStringLiteral("ServiceSqlRegistry") ); /* m_timer = new QTimer( this ); m_timer->setInterval( 60000 ); //try to clean up every 60 seconds, change if necessary diff --git a/src/services/ampache/AddServerDialog.cpp b/src/services/ampache/AddServerDialog.cpp --- a/src/services/ampache/AddServerDialog.cpp +++ b/src/services/ampache/AddServerDialog.cpp @@ -34,7 +34,7 @@ setLayout(new QVBoxLayout); layout()->addWidget(widget); - auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); + auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this); connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept); connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject); buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); diff --git a/src/services/ampache/AmpacheAccountLogin.h b/src/services/ampache/AmpacheAccountLogin.h --- a/src/services/ampache/AmpacheAccountLogin.h +++ b/src/services/ampache/AmpacheAccountLogin.h @@ -40,7 +40,7 @@ { Q_OBJECT public: - AmpacheAccountLogin ( const QUrl& url, const QString& username, const QString& password, QWidget* parent = 0 ); + AmpacheAccountLogin ( const QUrl& url, const QString& username, const QString& password, QWidget* parent = nullptr ); ~AmpacheAccountLogin(); QUrl server() const { return m_server; } QString sessionId() const { return m_sessionId; } @@ -52,17 +52,17 @@ void finished(); //!authentication was or was not successful private Q_SLOTS: - void authenticate( const QUrl &url, QByteArray data, NetworkAccessManagerProxy::Error e ); - void authenticationComplete( const QUrl &url, QByteArray data, NetworkAccessManagerProxy::Error e ); + void authenticate( const QUrl &url, const QByteArray &data, const NetworkAccessManagerProxy::Error &e ); + void authenticationComplete( const QUrl &url, const QByteArray &data, const NetworkAccessManagerProxy::Error &e ); private: int getVersion( const QDomDocument& doc ) const; /** Does general response verification. Emits finished if something is fishy. @returns true if the check was successful. */ - bool generalVerify( QNetworkReply *reply, const QDomDocument& doc, NetworkAccessManagerProxy::Error e ); + bool generalVerify( QNetworkReply *reply, const QDomDocument& doc, const NetworkAccessManagerProxy::Error &e ); /** Returns the base url. You would need to add query items to use it. */ diff --git a/src/services/ampache/AmpacheAccountLogin.cpp b/src/services/ampache/AmpacheAccountLogin.cpp --- a/src/services/ampache/AmpacheAccountLogin.cpp +++ b/src/services/ampache/AmpacheAccountLogin.cpp @@ -41,8 +41,8 @@ , m_server( url ) , m_username( username ) , m_password( password ) - , m_authRequest( Q_NULLPTR ) - , m_pingRequest( Q_NULLPTR ) + , m_authRequest( nullptr ) + , m_pingRequest( nullptr ) { reauthenticate(); } @@ -62,15 +62,14 @@ debug() << "Verifying Ampache Version Using: " << url.url(); - m_pingRequest = The::networkAccessManager()->getData( url, this, - SLOT(authenticate(QUrl,QByteArray,NetworkAccessManagerProxy::Error)) ); + m_pingRequest = The::networkAccessManager()->getData( url, this, &AmpacheAccountLogin::authenticate ); if( !m_pingRequest ) - emit finished(); + Q_EMIT finished(); } void -AmpacheAccountLogin::authenticate( const QUrl &requestUrl, QByteArray data, NetworkAccessManagerProxy::Error e ) +AmpacheAccountLogin::authenticate( const QUrl &requestUrl, const QByteArray &data, const NetworkAccessManagerProxy::Error &e ) { if( !m_pingRequest ) return; @@ -127,15 +126,14 @@ debug() << "Authenticating with string: " << url.url() << passPhrase; - // TODO: Amarok::Components::logger()->newProgressOperation( m_xmlDownloadJob, i18n( "Authenticating with Ampache" ) ); - m_authRequest = The::networkAccessManager()->getData( url, this, - SLOT(authenticationComplete(QUrl,QByteArray,NetworkAccessManagerProxy::Error)) ); + // TODO: Amarok::Logger::newProgressOperation( m_xmlDownloadJob, i18n( "Authenticating with Ampache" ) ); + m_authRequest = The::networkAccessManager()->getData( url, this, &AmpacheAccountLogin::authenticationComplete ); if( !m_authRequest ) - emit finished(); + Q_EMIT finished(); } -void AmpacheAccountLogin::authenticationComplete( const QUrl &requestUrl, QByteArray data, NetworkAccessManagerProxy::Error e ) +void AmpacheAccountLogin::authenticationComplete( const QUrl &requestUrl, const QByteArray &data, const NetworkAccessManagerProxy::Error &e ) { Q_UNUSED( requestUrl ); @@ -163,15 +161,15 @@ KMessageBox::error( qobject_cast(parent()), i18n( "Authentication failed." ), i18n( "Authentication Error" ) ); - emit finished(); + Q_EMIT finished(); return; } m_sessionId = element.text(); m_authenticated = true; - emit loginSuccessful(); - emit finished(); + Q_EMIT loginSuccessful(); + Q_EMIT finished(); } int @@ -205,7 +203,7 @@ } bool -AmpacheAccountLogin::generalVerify( QNetworkReply *reply, const QDomDocument& doc, NetworkAccessManagerProxy::Error e ) +AmpacheAccountLogin::generalVerify( QNetworkReply *reply, const QDomDocument& doc, const NetworkAccessManagerProxy::Error &e ) { Q_ASSERT( reply ); @@ -215,14 +213,14 @@ reply->attribute( QNetworkRequest::HttpStatusCodeAttribute ).toInt() << reply->attribute( QNetworkRequest::HttpReasonPhraseAttribute ).toString(); - emit finished(); + Q_EMIT finished(); return false; } if( e.code != QNetworkReply::NoError ) { debug() << "authenticate Error:" << e.description; - emit finished(); + Q_EMIT finished(); return false; } @@ -234,7 +232,7 @@ // Default the Version down if it didn't work debug() << "generalVerify error: " << error.text(); KMessageBox::error( qobject_cast(parent()), error.text(), i18n( "Authentication Error" ) ); - emit finished(); + Q_EMIT finished(); return false; } diff --git a/src/services/ampache/AmpacheConfig.h b/src/services/ampache/AmpacheConfig.h --- a/src/services/ampache/AmpacheConfig.h +++ b/src/services/ampache/AmpacheConfig.h @@ -45,8 +45,8 @@ void load(); void save(); - int serverCount(); - AmpacheServerList servers(); + int serverCount() const; + AmpacheServerList servers() const; void addServer( const AmpacheServerEntry &server ); void removeServer( int index); diff --git a/src/services/ampache/AmpacheConfig.cpp b/src/services/ampache/AmpacheConfig.cpp --- a/src/services/ampache/AmpacheConfig.cpp +++ b/src/services/ampache/AmpacheConfig.cpp @@ -86,13 +86,13 @@ } int -AmpacheConfig::serverCount() +AmpacheConfig::serverCount() const { return m_servers.size(); } AmpacheServerList -AmpacheConfig::servers() +AmpacheConfig::servers() const { return m_servers; } diff --git a/src/services/ampache/AmpacheMeta.h b/src/services/ampache/AmpacheMeta.h --- a/src/services/ampache/AmpacheMeta.h +++ b/src/services/ampache/AmpacheMeta.h @@ -46,14 +46,14 @@ Q_UNUSED(m_service); // might be used again later } - virtual QString sourceName() { return "Ampache"; } - virtual QString sourceDescription() { return "The Ampache music server project: http://Ampache.org"; } - virtual QPixmap emblem() { return QPixmap( QStandardPaths::locate( QStandardPaths::GenericDataLocation, "amarok/images/emblem-ampache.png" ) ); } - virtual QString scalableEmblem() { return QStandardPaths::locate( QStandardPaths::GenericDataLocation, "amarok/images/emblem-ampache-scalable.svgz" ); } - virtual QString notPlayableReason() const; + QString sourceName() override { return "Ampache"; } + QString sourceDescription() override { return "The Ampache music server project: http://Ampache.org"; } + QPixmap emblem() override { return QPixmap( QStandardPaths::locate( QStandardPaths::GenericDataLocation, "amarok/images/emblem-ampache.png" ) ); } + QString scalableEmblem() override { return QStandardPaths::locate( QStandardPaths::GenericDataLocation, "amarok/images/emblem-ampache-scalable.svgz" ); } + QString notPlayableReason() const override; - virtual int discNumber() const { return m_discNumber; } - virtual void setDiscNumber( int newDiscNumber ) { m_discNumber = newDiscNumber; } + int discNumber() const override { return m_discNumber; } + void setDiscNumber( int newDiscNumber ) override { m_discNumber = newDiscNumber; } private: ServiceBase * m_service; @@ -68,17 +68,17 @@ QString m_coverURL; public: - AmpacheAlbum( const QString &name ); - AmpacheAlbum( const QStringList &resultRow ); + explicit AmpacheAlbum( const QString &name ); + explicit AmpacheAlbum( const QStringList &resultRow ); ~AmpacheAlbum(); - virtual QString downloadPrefix() const { return "ampache"; } + QString downloadPrefix() const override { return "ampache"; } - virtual void setCoverUrl( const QString &coverURL ); - virtual QString coverUrl() const; + void setCoverUrl( const QString &coverURL ) override; + QString coverUrl() const override; - bool operator==( const Meta::Album &other ) const + bool operator==( const Meta::Album &other ) const override { return name() == other.name(); } @@ -119,11 +119,11 @@ , m_service( service ) {} - virtual bool isBookmarkable() const { return true; } - virtual QString collectionName() const { return m_service->name(); } - virtual bool simpleFiltering() const { return true; } + bool isBookmarkable() const override { return true; } + QString collectionName() const override { return m_service->name(); } + bool simpleFiltering() const override { return true; } - bool operator==( const Meta::Artist &other ) const + bool operator==( const Meta::Artist &other ) const override { return name() == other.name(); } diff --git a/src/services/ampache/AmpacheService.h b/src/services/ampache/AmpacheService.h --- a/src/services/ampache/AmpacheService.h +++ b/src/services/ampache/AmpacheService.h @@ -34,11 +34,11 @@ AmpacheServiceFactory(); virtual ~AmpacheServiceFactory() {} - virtual bool possiblyContainsTrack( const QUrl &url ) const; + bool possiblyContainsTrack( const QUrl &url ) const override; - virtual void init(); - virtual QString name(); - virtual KConfigGroup config(); + void init() override; + QString name() override; + KConfigGroup config() override; }; @@ -59,10 +59,10 @@ ~AmpacheService(); - void polish(); + void polish() override; void reauthenticate(); - virtual Collections::Collection * collection() { return m_collection; } + Collections::Collection * collection() override { return m_collection; } private Q_SLOTS: void onLoginSuccessful(); diff --git a/src/services/ampache/AmpacheService.cpp b/src/services/ampache/AmpacheService.cpp --- a/src/services/ampache/AmpacheService.cpp +++ b/src/services/ampache/AmpacheService.cpp @@ -23,7 +23,7 @@ #include "core/support/Amarok.h" #include "core/support/Components.h" -#include "core/interfaces/Logger.h" +#include "core/logger/Logger.h" #include "browsers/SingleCollectionTreeItemModel.h" #include "core-impl/collections/support/CollectionManager.h" #include @@ -51,20 +51,20 @@ { AmpacheServerEntry server = servers.at( i ); ServiceBase* service = new AmpacheService( this, "Ampache (" + server.name + ')', server.url, server. username, server.password ); - emit newService( service ); + Q_EMIT newService( service ); } } QString AmpacheServiceFactory::name() { - return "Ampache"; + return QStringLiteral("Ampache"); } KConfigGroup AmpacheServiceFactory::config() { - return Amarok::config( "Service_Ampache" ); + return Amarok::config( QStringLiteral("Service_Ampache") ); } bool @@ -82,8 +82,8 @@ AmpacheService::AmpacheService( AmpacheServiceFactory* parent, const QString & name, const QUrl &url, const QString &username, const QString &password ) : ServiceBase( name, parent ) - , m_infoParser( 0 ) - , m_collection( 0 ) + , m_infoParser( nullptr ) + , m_collection( nullptr ) , m_ampacheLogin( new AmpacheAccountLogin( url, username, password, this ) ) { DEBUG_BLOCK diff --git a/src/services/ampache/AmpacheServiceCollection.h b/src/services/ampache/AmpacheServiceCollection.h --- a/src/services/ampache/AmpacheServiceCollection.h +++ b/src/services/ampache/AmpacheServiceCollection.h @@ -25,11 +25,11 @@ { Q_OBJECT public: - AmpacheTrackForUrlWorker( const QUrl &url, MetaProxy::TrackPtr track, + AmpacheTrackForUrlWorker( const QUrl &url, const MetaProxy::TrackPtr &track, const QUrl &server, const QString &sessionId, ServiceBase *service); ~AmpacheTrackForUrlWorker(); - virtual void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0); + void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) override; void parseTrack( const QString &xml ); Q_SIGNALS: void authenticationNeeded(); @@ -66,13 +66,13 @@ virtual ~AmpacheServiceCollection(); - virtual QueryMaker *queryMaker(); + QueryMaker *queryMaker() override; - virtual QString collectionId() const; - virtual QString prettyName() const; + QString collectionId() const override; + QString prettyName() const override; - virtual Meta::TrackPtr trackForUrl( const QUrl &url ); - virtual bool possiblyContainsTrack( const QUrl &url ) const; + Meta::TrackPtr trackForUrl( const QUrl &url ) override; + bool possiblyContainsTrack( const QUrl &url ) const override; Q_SIGNALS: void authenticationNeeded(); diff --git a/src/services/ampache/AmpacheServiceCollection.cpp b/src/services/ampache/AmpacheServiceCollection.cpp --- a/src/services/ampache/AmpacheServiceCollection.cpp +++ b/src/services/ampache/AmpacheServiceCollection.cpp @@ -36,7 +36,7 @@ , m_server( server ) , m_sessionId( sessionId ) { - m_trackForUrlWorker = 0; + m_trackForUrlWorker = nullptr; } AmpacheServiceCollection::~AmpacheServiceCollection() @@ -70,7 +70,7 @@ void AmpacheServiceCollection::slotAuthenticationNeeded() { - emit authenticationNeeded(); + Q_EMIT authenticationNeeded(); } Meta::TrackPtr @@ -139,7 +139,7 @@ } AmpacheTrackForUrlWorker::AmpacheTrackForUrlWorker( const QUrl &url, - MetaProxy::TrackPtr track, + const MetaProxy::TrackPtr &track, const QUrl &server, const QString &sessionId, ServiceBase *service ) @@ -160,18 +160,18 @@ Q_UNUSED( self ) Q_UNUSED( thread ) - m_urlTrack = 0; - m_urlAlbum = 0; - m_urlArtist = 0; + m_urlTrack = nullptr; + m_urlAlbum = nullptr; + m_urlArtist = nullptr; m_urlTrackId = 0; m_urlAlbumId = 0; m_urlArtistId = 0; //send url_to_song to Ampache QUrl requestUrl = m_server; - requestUrl.setPath( m_server.path() + "/server/xml.server.php" ); + requestUrl.setPath( m_server.path() + QStringLiteral("/server/xml.server.php") ); QUrlQuery query; query.addQueryItem( "action", "url_to_song" ); query.addQueryItem( "auth", m_sessionId ); @@ -186,7 +186,7 @@ if( reply->error() == QNetworkReply::ContentAccessDenied ) { debug() << "Trying to re-authenticate Ampache.."; - emit authenticationNeeded(); + Q_EMIT authenticationNeeded(); } } parseTrack( reply->readAll() ); diff --git a/src/services/ampache/AmpacheServiceQueryMaker.h b/src/services/ampache/AmpacheServiceQueryMaker.h --- a/src/services/ampache/AmpacheServiceQueryMaker.h +++ b/src/services/ampache/AmpacheServiceQueryMaker.h @@ -42,21 +42,21 @@ AmpacheServiceQueryMaker( AmpacheServiceCollection * collection, const QUrl &server, const QString &sessionId ); ~AmpacheServiceQueryMaker(); - virtual void run(); - virtual void abortQuery(); + void run() override; + void abortQuery() override; - virtual QueryMaker* setQueryType( QueryType type ); + QueryMaker* setQueryType( QueryType type ) override; using DynamicServiceQueryMaker::addMatch; - virtual QueryMaker* addMatch( const Meta::TrackPtr &track ); - virtual QueryMaker* addMatch( const Meta::ArtistPtr &artist, ArtistMatchBehaviour behaviour = TrackArtists ); - virtual QueryMaker* addMatch( const Meta::AlbumPtr &album ); + QueryMaker* addMatch( const Meta::TrackPtr &track ) override; + QueryMaker* addMatch( const Meta::ArtistPtr &artist, ArtistMatchBehaviour behaviour = TrackArtists ) override; + QueryMaker* addMatch( const Meta::AlbumPtr &album ) override; - virtual QueryMaker* addFilter( qint64 value, const QString &filter, bool matchBegin = false, bool matchEnd = false ); - virtual QueryMaker* addNumberFilter( qint64 value, qint64 filter, QueryMaker::NumberComparison compare ); + QueryMaker* addFilter( qint64 value, const QString &filter, bool matchBegin = false, bool matchEnd = false ) override; + QueryMaker* addNumberFilter( qint64 value, qint64 filter, QueryMaker::NumberComparison compare ) override; - virtual int validFilterMask(); - virtual QueryMaker* limitMaxResultSize( int size ); + int validFilterMask() override; + QueryMaker* limitMaxResultSize( int size ) override; void fetchArtists(); void fetchAlbums(); @@ -67,9 +67,9 @@ Private * const d; public Q_SLOTS: - void artistDownloadComplete( const QUrl &url, QByteArray data, NetworkAccessManagerProxy::Error e ); - void albumDownloadComplete( const QUrl &url, QByteArray data, NetworkAccessManagerProxy::Error e ); - void trackDownloadComplete( const QUrl &url, QByteArray data, NetworkAccessManagerProxy::Error e ); + void artistDownloadComplete( const QUrl &url, const QByteArray &data, const NetworkAccessManagerProxy::Error &e ); + void albumDownloadComplete( const QUrl &url, const QByteArray &data, const NetworkAccessManagerProxy::Error &e ); + void trackDownloadComplete( const QUrl &url, const QByteArray &data, const NetworkAccessManagerProxy::Error &e ); private: // Disable copy constructor and assignment diff --git a/src/services/ampache/AmpacheServiceQueryMaker.cpp b/src/services/ampache/AmpacheServiceQueryMaker.cpp --- a/src/services/ampache/AmpacheServiceQueryMaker.cpp +++ b/src/services/ampache/AmpacheServiceQueryMaker.cpp @@ -207,15 +207,15 @@ // first try the cache if( !d->parentArtistIds.isEmpty() ) { - foreach( int artistId, d->parentArtistIds ) + for( int artistId : qAsConst(d->parentArtistIds) ) artists << d->collection->artistById( artistId ); } if( !artists.isEmpty() ) { debug() << "got" << artists.count() << "artists from the memory collection"; - emit newArtistsReady( artists ); - emit queryDone(); + Q_EMIT newArtistsReady( artists ); + Q_EMIT queryDone(); return; } @@ -229,8 +229,7 @@ } d->expectedReplies.ref(); - The::networkAccessManager()->getData( request, this, - SLOT(artistDownloadComplete(QUrl,QByteArray,NetworkAccessManagerProxy::Error)) ); + The::networkAccessManager()->getData( request, this, &AmpacheServiceQueryMaker::artistDownloadComplete ); } void @@ -249,8 +248,8 @@ if( !albums.isEmpty() ) { debug() << "got" << albums.count() << "albums from the memory collection"; - emit newAlbumsReady( albums ); - emit queryDone(); + Q_EMIT newAlbumsReady( albums ); + Q_EMIT queryDone(); return; } @@ -264,8 +263,7 @@ request.setQuery( query ); d->expectedReplies.ref(); - The::networkAccessManager()->getData( request, this, - SLOT(albumDownloadComplete(QUrl,QByteArray,NetworkAccessManagerProxy::Error)) ); + The::networkAccessManager()->getData( request, this, &AmpacheServiceQueryMaker::albumDownloadComplete ); } } else @@ -280,8 +278,7 @@ } d->expectedReplies.ref(); - The::networkAccessManager()->getData( request, this, - SLOT(albumDownloadComplete(QUrl,QByteArray,NetworkAccessManagerProxy::Error)) ); + The::networkAccessManager()->getData( request, this, &AmpacheServiceQueryMaker::albumDownloadComplete ); } } @@ -325,8 +322,8 @@ if( !tracks.isEmpty() ) { debug() << "got" << tracks.count() << "tracks from the memory collection"; - emit newTracksReady( tracks ); - emit queryDone(); + Q_EMIT newTracksReady( tracks ); + Q_EMIT queryDone(); return; } @@ -343,8 +340,7 @@ request.setQuery( query ); d->expectedReplies.ref(); - The::networkAccessManager()->getData( request, this, - SLOT(trackDownloadComplete(QUrl,QByteArray,NetworkAccessManagerProxy::Error)) ); + The::networkAccessManager()->getData( request, this, &AmpacheServiceQueryMaker::trackDownloadComplete ); } } else if( !d->parentArtistIds.isEmpty() ) @@ -357,30 +353,28 @@ request.setQuery( query ); d->expectedReplies.ref(); - The::networkAccessManager()->getData( request, this, - SLOT(trackDownloadComplete(QUrl,QByteArray,NetworkAccessManagerProxy::Error)) ); + The::networkAccessManager()->getData( request, this, &AmpacheServiceQueryMaker::trackDownloadComplete ); } } else { QUrl request = getRequestUrl( "songs" ); d->expectedReplies.ref(); - The::networkAccessManager()->getData( request, this, - SLOT(trackDownloadComplete(QUrl,QByteArray,NetworkAccessManagerProxy::Error)) ); + The::networkAccessManager()->getData( request, this, &AmpacheServiceQueryMaker::trackDownloadComplete ); } } void -AmpacheServiceQueryMaker::artistDownloadComplete( const QUrl &url, QByteArray data, NetworkAccessManagerProxy::Error e ) +AmpacheServiceQueryMaker::artistDownloadComplete( const QUrl &url, const QByteArray &data, const NetworkAccessManagerProxy::Error &e ) { Q_UNUSED( url ); if( e.code != QNetworkReply::NoError ) { warning() << "Artist download error:" << e.description; if( !d->expectedReplies.deref() ) - emit queryDone(); + Q_EMIT queryDone(); return; } @@ -391,7 +385,7 @@ doc.setContent( data ); QDomElement root = doc.firstChildElement( "root" ); - // Is this an error, if so we need to 'un-ready' the service and re-authenticate before contiuning + // Is this an error, if so we need to 'un-ready' the service and re-authenticate before continuing QDomElement domError = root.firstChildElement( "error" ); if ( !domError.isNull() ) @@ -435,22 +429,22 @@ if( !d->expectedReplies.deref() ) { - emit newArtistsReady( d->artistResults ); - emit queryDone(); + Q_EMIT newArtistsReady( d->artistResults ); + Q_EMIT queryDone(); d->artistResults.clear(); } } void -AmpacheServiceQueryMaker::albumDownloadComplete( const QUrl &url, QByteArray data, NetworkAccessManagerProxy::Error e ) +AmpacheServiceQueryMaker::albumDownloadComplete( const QUrl &url, const QByteArray &data, const NetworkAccessManagerProxy::Error &e ) { Q_UNUSED( url ); if( e.code != QNetworkReply::NoError ) { warning() << "Album download error:" << e.description; if( !d->expectedReplies.deref() ) - emit queryDone(); + Q_EMIT queryDone(); return; } @@ -461,14 +455,14 @@ doc.setContent( data ); QDomElement root = doc.firstChildElement( "root" ); - // Is this an error, if so we need to 'un-ready' the service and re-authenticate before contiuning + // Is this an error, if so we need to 'un-ready' the service and re-authenticate before continuing QDomElement domError = root.firstChildElement( "error" ); if( !domError.isNull() ) { warning() << "Error getting Album List" << domError.text() << "Code:" << domError.attribute("code"); AmpacheService *parentService = dynamic_cast< AmpacheService * >(d->collection->service()); - if( parentService == 0 ) + if( parentService == nullptr ) return; else parentService->reauthenticate(); @@ -553,22 +547,22 @@ if( !d->expectedReplies.deref() ) { - emit newAlbumsReady( d->albumResults ); - emit queryDone(); + Q_EMIT newAlbumsReady( d->albumResults ); + Q_EMIT queryDone(); d->albumResults.clear(); } } void -AmpacheServiceQueryMaker::trackDownloadComplete( const QUrl &url, QByteArray data, NetworkAccessManagerProxy::Error e ) +AmpacheServiceQueryMaker::trackDownloadComplete( const QUrl &url, const QByteArray &data, const NetworkAccessManagerProxy::Error &e ) { Q_UNUSED( url ); if( e.code != QNetworkReply::NoError ) { warning() << "Track download error:" << e.description; if( !d->expectedReplies.deref() ) - emit queryDone(); + Q_EMIT queryDone(); return; } @@ -579,14 +573,14 @@ doc.setContent( data ); QDomElement root = doc.firstChildElement( "root" ); - // Is this an error, if so we need to 'un-ready' the service and re-authenticate before contiuning + // Is this an error, if so we need to 'un-ready' the service and re-authenticate before continuing QDomElement domError = root.firstChildElement( "error" ); if( !domError.isNull() ) { warning() << "Error getting Track Download " << domError.text() << "Code:" << domError.attribute("code"); AmpacheService *parentService = dynamic_cast< AmpacheService * >( d->collection->service() ); - if( parentService == 0 ) + if( parentService == nullptr ) return; else parentService->reauthenticate(); @@ -664,8 +658,8 @@ if( !d->expectedReplies.deref() ) { - emit newTracksReady( d->trackResults ); - emit queryDone(); + Q_EMIT newTracksReady( d->trackResults ); + Q_EMIT queryDone(); d->trackResults.clear(); } } @@ -712,7 +706,7 @@ int AmpacheServiceQueryMaker::validFilterMask() { - //we only supprt artist and album filters for now... + //we only support artist and album filters for now... return ArtistFilter | AlbumFilter; } diff --git a/src/services/ampache/AmpacheSettings.h b/src/services/ampache/AmpacheSettings.h --- a/src/services/ampache/AmpacheSettings.h +++ b/src/services/ampache/AmpacheSettings.h @@ -36,9 +36,9 @@ virtual ~AmpacheSettings(); - virtual void save() Q_DECL_OVERRIDE; - virtual void load() Q_DECL_OVERRIDE; - virtual void defaults() Q_DECL_OVERRIDE; + void save() override; + void load() override; + void defaults() override; private: diff --git a/src/services/ampache/AmpacheSettings.cpp b/src/services/ampache/AmpacheSettings.cpp --- a/src/services/ampache/AmpacheSettings.cpp +++ b/src/services/ampache/AmpacheSettings.cpp @@ -115,7 +115,7 @@ m_config.addServer( server ); } loadList(); - emit changed( true ); + Q_EMIT changed( true ); } void @@ -125,7 +125,7 @@ m_configDialog->serverList->removeRow( index ); m_config.removeServer( index ); - emit changed( true ); + Q_EMIT changed( true ); } void @@ -165,7 +165,7 @@ } m_config.updateServer(row, server); m_configDialog->serverList->resizeColumnToContents(column); - emit changed( true ); + Q_EMIT changed( true ); } diff --git a/src/services/ampache/CMakeLists.txt b/src/services/ampache/CMakeLists.txt --- a/src/services/ampache/CMakeLists.txt +++ b/src/services/ampache/CMakeLists.txt @@ -63,7 +63,7 @@ endif() -install(TARGETS amarok_service_ampache DESTINATION ${PLUGIN_INSTALL_DIR} ) +install(TARGETS amarok_service_ampache DESTINATION ${KDE_INSTALL_PLUGINDIR} ) install(FILES amarok_service_ampache.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}) kcoreaddons_desktop_to_json(amarok_service_ampache amarok_service_ampache.desktop SERVICE_TYPES ${CMAKE_SOURCE_DIR}/src/amarok-plugin.desktop) @@ -83,7 +83,7 @@ KF5::ConfigWidgets ) -install(TARGETS kcm_amarok_service_ampache DESTINATION ${PLUGIN_INSTALL_DIR}) +install(TARGETS kcm_amarok_service_ampache DESTINATION ${KDE_INSTALL_PLUGINDIR}) install(FILES amarok_service_ampache_config.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}) kcoreaddons_desktop_to_json(kcm_amarok_service_ampache amarok_service_ampache_config.desktop SERVICE_TYPES kcmodule.desktop) diff --git a/src/services/ampache/LastfmInfoParser.h b/src/services/ampache/LastfmInfoParser.h --- a/src/services/ampache/LastfmInfoParser.h +++ b/src/services/ampache/LastfmInfoParser.h @@ -31,9 +31,9 @@ public: LastfmInfoParser() : InfoParserBase() {} ~LastfmInfoParser() {} - virtual void getInfo(Meta::TrackPtr track); - virtual void getInfo(Meta::AlbumPtr album); - virtual void getInfo(Meta::ArtistPtr artist); + virtual void getInfo(const Meta::TrackPtr &track); + virtual void getInfo(const Meta::AlbumPtr &album); + virtual void getInfo(const Meta::ArtistPtr &artist); private Q_SLOTS: void onGetTrackInfo(); diff --git a/src/services/ampache/LastfmInfoParser.cpp b/src/services/ampache/LastfmInfoParser.cpp --- a/src/services/ampache/LastfmInfoParser.cpp +++ b/src/services/ampache/LastfmInfoParser.cpp @@ -27,7 +27,7 @@ #include -void LastfmInfoParser::getInfo(Meta::TrackPtr track) +void LastfmInfoParser::getInfo(const Meta::TrackPtr &track) { DEBUG_BLOCK QMap query; @@ -63,7 +63,7 @@ QString html; if( !contentText.isEmpty() ) - html = QString("

%1

Updated: %2

").arg( contentText, publishedDate ); + html = QStringLiteral("

%2

%1

").arg( i18n("Updated: %1", publishedDate), contentText ); else html = i18n( "

No information found for this track.

" ); emit info( html ); @@ -73,10 +73,10 @@ break; } m_jobs["getTrackInfo"]->deleteLater(); - m_jobs["getTrackInfo"] = 0; + m_jobs["getTrackInfo"] = nullptr; } -void LastfmInfoParser::getInfo(Meta::AlbumPtr album) +void LastfmInfoParser::getInfo(const Meta::AlbumPtr &album) { DEBUG_BLOCK QMap query; @@ -125,11 +125,11 @@ break; } m_jobs["getAlbumInfo"]->deleteLater(); - m_jobs["getAlbumInfo"] = 0; + m_jobs["getAlbumInfo"] = nullptr; } -void LastfmInfoParser::getInfo(Meta::ArtistPtr artist) +void LastfmInfoParser::getInfo(const Meta::ArtistPtr &artist) { QMap query; query[ "method" ] = "artist.getInfo"; @@ -180,6 +180,6 @@ break; } m_jobs["getArtistInfo"]->deleteLater(); - m_jobs["getArtistInfo"] = 0; + m_jobs["getArtistInfo"] = nullptr; } diff --git a/src/services/ampache/amarok_service_ampache.desktop b/src/services/ampache/amarok_service_ampache.desktop --- a/src/services/ampache/amarok_service_ampache.desktop +++ b/src/services/ampache/amarok_service_ampache.desktop @@ -51,7 +51,6 @@ Name[uk]=Ampache Name[wa]=Ampache Name[x-test]=xxAmpachexx -Name[zh_CN]=Ampache Name[zh_TW]=Ampache Comment=Listen to music from an Ampache server Comment[bg]=Слушане на музика от Ampache сървър @@ -102,7 +101,6 @@ Comment[uk]=Прослуховування музики з сервера Ampache Comment[wa]=Schoûter del muzike d' on sierveu Ampache Comment[x-test]=xxListen to music from an Ampache serverxx -Comment[zh_CN]=聆听来自 Ampache 服务器的音乐 Comment[zh_TW]=從 Ampache 伺服器上聽音樂 diff --git a/src/services/ampache/amarok_service_ampache_config.desktop b/src/services/ampache/amarok_service_ampache_config.desktop --- a/src/services/ampache/amarok_service_ampache_config.desktop +++ b/src/services/ampache/amarok_service_ampache_config.desktop @@ -32,7 +32,7 @@ Name[it]=Configurazione servizio Ampache Name[ja]=Ampache サービスの設定 Name[km]=កំណត់​រចនាសម្ព័ន្ធ​សេវា​របស់ Ampache -Name[ko]=Ampache 서비스 설정 +Name[ko]=Ampache 서비스 구성 Name[ku]=Veavakirina Servîsa Ampache Name[lt]=Ampache tarnybos parinktys Name[lv]=Ampache pakalpojuma konfigurācija @@ -58,7 +58,6 @@ Name[uk]=Налаштування служби Ampache Name[wa]=Apontiaedje siervice Ampache Name[x-test]=xxAmpache Service Configxx -Name[zh_CN]=Ampache 服务配置 Name[zh_TW]=Ampache 服務設定 Comment=Sets up the ampache server(s) to connect to Comment[bg]=Настройване на ampache сървър/и @@ -109,7 +108,6 @@ Comment[uk]=Встановлює сервер ampache, з яким слід з’єднуватися Comment[wa]=Aponteye li/les sierveu(s) ampache po s' raloyî a Comment[x-test]=xxSets up the ampache server(s) to connect toxx -Comment[zh_CN]=设定要连接的 Ampache 服务器 Comment[zh_TW]=設定要連結的 ampache 伺服器 diff --git a/src/services/ampache/images/CMakeLists.txt b/src/services/ampache/images/CMakeLists.txt --- a/src/services/ampache/images/CMakeLists.txt +++ b/src/services/ampache/images/CMakeLists.txt @@ -1,5 +1,5 @@ install( FILES hover_info_ampache.png - DESTINATION ${DATA_INSTALL_DIR}/amarok/images + DESTINATION ${KDE_INSTALL_DATADIR}/amarok/images ) diff --git a/src/services/gpodder/CMakeLists.txt b/src/services/gpodder/CMakeLists.txt --- a/src/services/gpodder/CMakeLists.txt +++ b/src/services/gpodder/CMakeLists.txt @@ -9,10 +9,6 @@ ../../dynamic # for CustomBias.h ../../browsers/playlistbrowser ${CMAKE_CURRENT_BINARY_DIR}/../.. #for amarokconfig.h - - - ${LIBMYGPO_QT5_INCLUDE_DIRS} - ${LIBMYGPO_QT5_INCLUDE_DIRS}/../ ) add_subdirectory( images ) @@ -53,13 +49,13 @@ amaroklib amarokpud gpodder_service_config - ${LIBMYGPO_QT_LIBRARIES} + mygpo-qt5 KF5::KIOCore KF5::ThreadWeaver Qt5::Network ) -install( TARGETS amarok_service_gpodder DESTINATION ${PLUGIN_INSTALL_DIR} ) +install( TARGETS amarok_service_gpodder DESTINATION ${KDE_INSTALL_PLUGINDIR} ) kcoreaddons_desktop_to_json(amarok_service_gpodder amarok_service_gpodder.desktop SERVICE_TYPES ${CMAKE_SOURCE_DIR}/src/amarok-plugin.desktop) @@ -76,13 +72,13 @@ amarokcore amaroklib gpodder_service_config - ${LIBMYGPO_QT_LIBRARIES} + mygpo-qt5 KF5::ConfigWidgets KF5::KIOCore Qt5::Network ) -install(TARGETS kcm_amarok_service_gpodder DESTINATION ${PLUGIN_INSTALL_DIR}) +install(TARGETS kcm_amarok_service_gpodder DESTINATION ${KDE_INSTALL_PLUGINDIR}) install(FILES amarok_service_gpodder_config.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR} ) kcoreaddons_desktop_to_json(kcm_amarok_service_gpodder amarok_service_gpodder_config.desktop SERVICE_TYPES kcmodule.desktop) diff --git a/src/services/gpodder/GpodderPodcastMeta.h b/src/services/gpodder/GpodderPodcastMeta.h --- a/src/services/gpodder/GpodderPodcastMeta.h +++ b/src/services/gpodder/GpodderPodcastMeta.h @@ -35,7 +35,7 @@ class GpodderPodcastChannel : public PodcastChannel { public: - GpodderPodcastChannel( GpodderProvider *provider ); + explicit GpodderPodcastChannel( GpodderProvider *provider ); //Copy a PodcastChannel GpodderPodcastChannel( GpodderProvider *provider, PodcastChannelPtr channel ); diff --git a/src/services/gpodder/GpodderPodcastRequestHandler.h b/src/services/gpodder/GpodderPodcastRequestHandler.h --- a/src/services/gpodder/GpodderPodcastRequestHandler.h +++ b/src/services/gpodder/GpodderPodcastRequestHandler.h @@ -28,7 +28,7 @@ { Q_OBJECT public: - GpodderPodcastRequestHandler( mygpo::PodcastListPtr podcasts, QModelIndex parentItem, GpodderServiceModel *model ); + GpodderPodcastRequestHandler( mygpo::PodcastListPtr podcasts, const QModelIndex &parentItem, GpodderServiceModel *model ); virtual ~GpodderPodcastRequestHandler(); public Q_SLOTS: diff --git a/src/services/gpodder/GpodderPodcastRequestHandler.cpp b/src/services/gpodder/GpodderPodcastRequestHandler.cpp --- a/src/services/gpodder/GpodderPodcastRequestHandler.cpp +++ b/src/services/gpodder/GpodderPodcastRequestHandler.cpp @@ -20,7 +20,7 @@ #include "core/support/Debug.h" -GpodderPodcastRequestHandler::GpodderPodcastRequestHandler( mygpo::PodcastListPtr podcasts, QModelIndex parentItem, +GpodderPodcastRequestHandler::GpodderPodcastRequestHandler( mygpo::PodcastListPtr podcasts, const QModelIndex &parentItem, GpodderServiceModel *model ) : QObject( model ) , m_podcasts( podcasts ) diff --git a/src/services/gpodder/GpodderPodcastTreeItem.h b/src/services/gpodder/GpodderPodcastTreeItem.h --- a/src/services/gpodder/GpodderPodcastTreeItem.h +++ b/src/services/gpodder/GpodderPodcastTreeItem.h @@ -26,7 +26,7 @@ { Q_OBJECT public: - GpodderPodcastTreeItem( mygpo::PodcastPtr podcast, GpodderTreeItem *parent = 0 ); + explicit GpodderPodcastTreeItem( mygpo::PodcastPtr podcast, GpodderTreeItem *parent = nullptr ); virtual ~GpodderPodcastTreeItem(); virtual QVariant displayData() const; diff --git a/src/services/gpodder/GpodderProvider.h b/src/services/gpodder/GpodderProvider.h --- a/src/services/gpodder/GpodderProvider.h +++ b/src/services/gpodder/GpodderProvider.h @@ -17,8 +17,8 @@ * this program. If not, see . * ****************************************************************************************/ -#ifndef GPODDERPODCASTPROVIDER_H -#define GPODDERPODCASTPROVIDER_H +#ifndef GPODDERPROVIDER_H +#define GPODDERPROVIDER_H #include "core/podcasts/PodcastProvider.h" #include "core/podcasts/PodcastReader.h" @@ -49,35 +49,35 @@ ~GpodderProvider(); //TrackProvider methods - bool possiblyContainsTrack( const QUrl &url ) const; - Meta::TrackPtr trackForUrl( const QUrl &url ); + bool possiblyContainsTrack( const QUrl &url ) const override; + Meta::TrackPtr trackForUrl( const QUrl &url ) override; //PodcastProvider methods /** Special function to get an episode for a given guid. * * note: this functions is required because QUrl does not preserve every possible guids. * This means we can not use trackForUrl(). * Problematic guids contain non-latin characters, percent encoded parts, capitals, etc. */ - virtual PodcastEpisodePtr episodeForGuid( const QString &guid ); + PodcastEpisodePtr episodeForGuid( const QString &guid ) override; virtual void addPodcast( const QUrl &url ); - virtual Podcasts::PodcastChannelPtr addChannel( Podcasts::PodcastChannelPtr channel ); - virtual Podcasts::PodcastEpisodePtr addEpisode( Podcasts::PodcastEpisodePtr episode ); + Podcasts::PodcastChannelPtr addChannel( const Podcasts::PodcastChannelPtr &channel ) override; + Podcasts::PodcastEpisodePtr addEpisode( Podcasts::PodcastEpisodePtr episode ) override; - virtual Podcasts::PodcastChannelList channels(); + Podcasts::PodcastChannelList channels() override; // PlaylistProvider methods - virtual QString prettyName() const; - virtual QIcon icon() const; - virtual Playlists::PlaylistList playlists(); - virtual void completePodcastDownloads(); + QString prettyName() const override; + QIcon icon() const override; + Playlists::PlaylistList playlists() override; + void completePodcastDownloads() override; /** Copy a playlist to the provider. */ - virtual Playlists::PlaylistPtr addPlaylist( Playlists::PlaylistPtr playlist ); - virtual QActionList playlistActions( const Playlists::PlaylistList &playlists ); + Playlists::PlaylistPtr addPlaylist( Playlists::PlaylistPtr playlist ) override; + QActionList playlistActions( const Playlists::PlaylistList &playlists ) override; private Q_SLOTS: void requestDeviceUpdates(); diff --git a/src/services/gpodder/GpodderProvider.cpp b/src/services/gpodder/GpodderProvider.cpp --- a/src/services/gpodder/GpodderProvider.cpp +++ b/src/services/gpodder/GpodderProvider.cpp @@ -23,7 +23,7 @@ #include "core-impl/capabilities/timecode/TimecodeWriteCapability.h" #include "core-impl/podcasts/sql/SqlPodcastProvider.h" -#include "core/interfaces/Logger.h" +#include "core/logger/Logger.h" #include "core/support/Amarok.h" #include "core/support/Components.h" #include "core/support/Debug.h" @@ -54,7 +54,7 @@ , m_episodeActionListResult() , m_timestampStatus( 0 ) , m_timestampSubscription( subscriptionTimestamp() ) - , m_removeAction( 0 ) + , m_removeAction( nullptr ) , m_addList() , m_removeList() , m_timerGeneratePlayAction( new QTimer( this ) ) @@ -243,13 +243,13 @@ PodcastChannelPtr -GpodderProvider::addChannel( PodcastChannelPtr channel ) +GpodderProvider::addChannel( const PodcastChannelPtr &channel ) { DEBUG_BLOCK GpodderPodcastChannelPtr gpodderChannel( new GpodderPodcastChannel( this, channel ) ); - m_channels << PodcastChannelPtr::dynamicCast( gpodderChannel );; + m_channels << PodcastChannelPtr::dynamicCast( gpodderChannel ); emit playlistAdded( Playlists::PlaylistPtr::dynamicCast( gpodderChannel ) ); @@ -412,7 +412,7 @@ GpodderProvider::slotSyncPlaylistRemoved( Playlists::PlaylistPtr playlist ) { Podcasts::PodcastChannelPtr channel = Podcasts::PodcastChannelPtr::dynamicCast( playlist ); - //If gpodder channels doesn't contais the removed channel from default + //If gpodder channels doesn't contains the removed channel from default //podcast provider, then we don't have to remove it from gpodder.net foreach( PodcastChannelPtr tempChannel, m_channels ) if( channel->url() == tempChannel->url() ) @@ -465,7 +465,7 @@ connect( m_episodeActionsResult.data(), SIGNAL(parseError()), SLOT(synchronizeStatusParseError()) ); - Amarok::Components::logger()->shortMessage( i18n( "Trying to synchronize statuses with gpodder.net" ) ); + Amarok::Logger::shortMessage( i18n( "Trying to synchronize statuses with gpodder.net" ) ); } else m_timerSynchronizeStatus->stop(); @@ -525,7 +525,7 @@ connect( m_addRemoveResult.data(), SIGNAL(finished()), this, SLOT(slotSuccessfulSubscriptionSynchronisation()) ); - Amarok::Components::logger()->shortMessage( i18n( "Trying to synchronize subscriptions with gpodder.net" ) ); + Amarok::Logger::shortMessage( i18n( "Trying to synchronize subscriptions with gpodder.net" ) ); } else m_timerSynchronizeSubscriptions->stop(); @@ -553,7 +553,7 @@ void GpodderProvider::slotTrackChanged( Meta::TrackPtr track ) { - m_trackToSyncStatus = NULL; + m_trackToSyncStatus = nullptr; if( track != Meta::TrackPtr( 0 ) ) { @@ -774,7 +774,7 @@ QTimer::singleShot( 10000, this, SLOT(requestDeviceUpdates()) ); debug() << "deviceUpdates [Subscription Synchronization] - Parse error"; - Amarok::Components::logger()->shortMessage( i18n( "GPodder Service failed to get data from the server. Will retry in 10 seconds..." ) ); + Amarok::Logger::shortMessage( i18n( "GPodder Service failed to get data from the server. Will retry in 10 seconds..." ) ); } void @@ -785,7 +785,7 @@ QTimer::singleShot( 10000, this, SLOT(requestDeviceUpdates()) ); debug() << "deviceUpdates [Subscription Synchronization] - Request error nr.: " << error; - Amarok::Components::logger()->shortMessage( i18n( "GPodder Service failed to get data from the server. Will retry in 10 seconds..." ) ); + Amarok::Logger::shortMessage( i18n( "GPodder Service failed to get data from the server. Will retry in 10 seconds..." ) ); } void @@ -899,7 +899,7 @@ { //For some reason the podcast and/or episode for this action //wasn't found - debug() << QString( "Episode and/or channel not found" );; + debug() << QString( "Episode and/or channel not found" ); } } diff --git a/src/services/gpodder/GpodderService.cpp b/src/services/gpodder/GpodderService.cpp --- a/src/services/gpodder/GpodderService.cpp +++ b/src/services/gpodder/GpodderService.cpp @@ -58,7 +58,7 @@ QString GpodderServiceFactory::name() { - return "gpodder.net"; + return QStringLiteral("gpodder.net"); } KConfigGroup @@ -102,19 +102,19 @@ GpodderService::GpodderService( GpodderServiceFactory *parent, const QString &name ) : ServiceBase( name, parent, false ) , m_inited( false ) - , m_apiRequest( 0 ) - , m_podcastProvider( 0 ) - , m_proxyModel( 0 ) - , m_subscribeButton( 0 ) - , m_selectionModel( 0 ) + , m_apiRequest( nullptr ) + , m_podcastProvider( nullptr ) + , m_proxyModel( nullptr ) + , m_subscribeButton( nullptr ) + , m_selectionModel( nullptr ) { DEBUG_BLOCK setShortDescription( i18n( "gpodder.net: Podcast Directory Service" ) ); - setIcon( QIcon::fromTheme( "view-services-gpodder-amarok" ) ); + setIcon( QIcon::fromTheme( QStringLiteral("view-services-gpodder-amarok") ) ); setLongDescription( i18n( "gpodder.net is an online Podcast Directory & Synchonisation Service." ) ); - setImagePath( QStandardPaths::locate( QStandardPaths::GenericDataLocation, "amarok/images/mygpo.png" ) ); + setImagePath( QStandardPaths::locate( QStandardPaths::GenericDataLocation, QStringLiteral("amarok/images/mygpo.png") ) ); init(); } @@ -221,7 +221,7 @@ m_subscribeButton->setParent( m_bottomPanel ); m_subscribeButton->setText( i18n( "Subscribe" ) ); m_subscribeButton->setObjectName( "subscribeButton" ); - m_subscribeButton->setIcon( QIcon::fromTheme( "get-hot-new-stuff-amarok" ) ); + m_subscribeButton->setIcon( QIcon::fromTheme( QStringLiteral("get-hot-new-stuff-amarok") ) ); m_subscribeButton->setEnabled( true ); diff --git a/src/services/gpodder/GpodderServiceConfig.cpp b/src/services/gpodder/GpodderServiceConfig.cpp --- a/src/services/gpodder/GpodderServiceConfig.cpp +++ b/src/services/gpodder/GpodderServiceConfig.cpp @@ -35,13 +35,11 @@ GpodderServiceConfig::GpodderServiceConfig() - : m_username( "" ) - , m_password( "" ) - , m_enableProvider( false ) + : m_enableProvider( false ) , m_ignoreWallet( false ) , m_isDataLoaded( false ) - , m_askDiag( 0 ) - , m_wallet( 0 ) + , m_askDiag( nullptr ) + , m_wallet( nullptr ) { DEBUG_BLOCK @@ -139,7 +137,7 @@ { if( m_enableProvider ) { - debug() << "Couldnt access the wallet to save the gpodder.net credentials"; + debug() << "Couldn't access the wallet to save the gpodder.net credentials"; askAboutMissingKWallet(); } else @@ -154,7 +152,7 @@ { if ( !m_askDiag ) { - m_askDiag = new QMessageBox( Q_NULLPTR ); + m_askDiag = new QMessageBox( nullptr ); m_askDiag->setWindowTitle( i18n( "gpodder.net credentials" ) ); m_askDiag->setText( i18n( "No running KWallet found. Would you like Amarok to save your gpodder.net credentials in plaintext?" ) ); @@ -186,7 +184,7 @@ else { debug() << "The wallet was ignored or is not needed."; - m_wallet = 0; + m_wallet = nullptr; } } diff --git a/src/services/gpodder/GpodderServiceModel.h b/src/services/gpodder/GpodderServiceModel.h --- a/src/services/gpodder/GpodderServiceModel.h +++ b/src/services/gpodder/GpodderServiceModel.h @@ -33,7 +33,7 @@ { Q_OBJECT public: - explicit GpodderServiceModel( mygpo::ApiRequest *request, QObject *parent = 0 ); + explicit GpodderServiceModel( mygpo::ApiRequest *request, QObject *parent = nullptr ); virtual ~GpodderServiceModel(); // QAbstractItemModel methods diff --git a/src/services/gpodder/GpodderServiceModel.cpp b/src/services/gpodder/GpodderServiceModel.cpp --- a/src/services/gpodder/GpodderServiceModel.cpp +++ b/src/services/gpodder/GpodderServiceModel.cpp @@ -35,11 +35,11 @@ GpodderServiceModel::GpodderServiceModel( ApiRequest *request, QObject *parent ) : QAbstractItemModel( parent ) - , m_rootItem( 0 ) - , m_topTagsItem( 0 ) - , m_topPodcastsItem( 0 ) - , m_suggestedPodcastsItem( 0 ) - , m_topTags( 0 ) + , m_rootItem( nullptr ) + , m_topTagsItem( nullptr ) + , m_topPodcastsItem( nullptr ) + , m_suggestedPodcastsItem( nullptr ) + , m_topTags( nullptr ) , m_apiRequest( request ) { GpodderServiceConfig config; @@ -78,7 +78,7 @@ else parentItem = static_cast( parent.internalPointer() ); - if( parentItem == 0 ) + if( parentItem == nullptr ) return QModelIndex(); GpodderTreeItem *childItem = parentItem->child( row ); @@ -96,12 +96,12 @@ GpodderTreeItem *childItem = static_cast( index.internalPointer() ); - if( childItem == 0 || childItem->isRoot() ) + if( childItem == nullptr || childItem->isRoot() ) return QModelIndex(); GpodderTreeItem *parentItem = childItem->parent(); - if( parentItem == 0 ) + if( parentItem == nullptr ) return QModelIndex(); int childIndex; @@ -125,7 +125,7 @@ parentItem = static_cast( parent.internalPointer() ); - if( parentItem == 0 ) + if( parentItem == nullptr ) return 0; return parentItem->childCount(); @@ -148,7 +148,7 @@ return QVariant(); GpodderTreeItem *item = static_cast( index.internalPointer() ); - if( item == 0 ) + if( item == nullptr ) { return QVariant(); } @@ -159,7 +159,7 @@ void GpodderServiceModel::insertTagList() { - if( m_rootItem != 0 ) + if( m_rootItem != nullptr ) { beginInsertRows( createIndex( 0,0, m_topTagsItem), 0, m_topTags->list().count() - 1 ); m_topTagsItem->appendTags( m_topTags ); @@ -236,7 +236,7 @@ emit layoutAboutToBeChanged(); beginInsertRows( parentItem, 0, podcasts->list().count() - 1 ); GpodderTreeItem *item = static_cast( parentItem.internalPointer() ); - if( item != 0 ) + if( item != nullptr ) { debug() << "Appending Podcasts..."; item->appendPodcasts( podcasts ); @@ -254,7 +254,7 @@ GpodderTreeItem *treeItem = static_cast( parent.internalPointer() ); - if( treeItem == 0 ) + if( treeItem == nullptr ) return false; if( treeItem->childCount() > 0 ) @@ -306,7 +306,7 @@ { requestTopTags(); requestTopPodcasts(); - if ( m_suggestedPodcastsItem != 0 ) + if ( m_suggestedPodcastsItem != nullptr ) requestSuggestedPodcasts(); } diff --git a/src/services/gpodder/GpodderServiceSettings.h b/src/services/gpodder/GpodderServiceSettings.h --- a/src/services/gpodder/GpodderServiceSettings.h +++ b/src/services/gpodder/GpodderServiceSettings.h @@ -38,9 +38,9 @@ virtual ~GpodderServiceSettings(); - void save() Q_DECL_OVERRIDE; - void load() Q_DECL_OVERRIDE; - void defaults() Q_DECL_OVERRIDE; + void save() override; + void load() override; + void defaults() override; private Q_SLOTS: void testLogin(); diff --git a/src/services/gpodder/GpodderServiceSettings.cpp b/src/services/gpodder/GpodderServiceSettings.cpp --- a/src/services/gpodder/GpodderServiceSettings.cpp +++ b/src/services/gpodder/GpodderServiceSettings.cpp @@ -42,7 +42,7 @@ GpodderServiceSettings::GpodderServiceSettings( QWidget *parent, const QVariantList &args ) : KCModule( parent, args ) , m_enableProvider( false ) - , m_createDevice( 0 ) + , m_createDevice( nullptr ) { debug() << "Creating gpodder.net config object"; @@ -238,8 +238,8 @@ { m_config.reset(); - m_configDialog->kcfg_GpodderUsername->setText( "" ); - m_configDialog->kcfg_GpodderPassword->setText( "" ); + m_configDialog->kcfg_GpodderUsername->clear(); + m_configDialog->kcfg_GpodderPassword->clear(); m_enableProvider = false; } diff --git a/src/services/gpodder/GpodderServiceView.h b/src/services/gpodder/GpodderServiceView.h --- a/src/services/gpodder/GpodderServiceView.h +++ b/src/services/gpodder/GpodderServiceView.h @@ -16,16 +16,16 @@ * this program. If not, see . * ****************************************************************************************/ -#ifndef GPODDERSERVIECEVIEW_H_ -#define GPODDERSERVIECEVIEW_H_ +#ifndef GPODDERSERVICEVIEW_H_ +#define GPODDERSERVICEVIEW_H_ #include "PrettyTreeView.h" class GpodderServiceView: public Amarok::PrettyTreeView { Q_OBJECT public: - explicit GpodderServiceView( QWidget *parent = 0 ); + explicit GpodderServiceView( QWidget *parent = nullptr ); }; -#endif /* GPODDERSERVIECEVIEW_H_ */ +#endif /* GPODDERSERVICEVIEW_H_ */ diff --git a/src/services/gpodder/GpodderSortFilterProxyModel.h b/src/services/gpodder/GpodderSortFilterProxyModel.h --- a/src/services/gpodder/GpodderSortFilterProxyModel.h +++ b/src/services/gpodder/GpodderSortFilterProxyModel.h @@ -28,11 +28,11 @@ Q_OBJECT public: - GpodderSortFilterProxyModel( QObject *parent = 0 ); - virtual ~GpodderSortFilterProxyModel(); + explicit GpodderSortFilterProxyModel( QObject *parent = nullptr ); + ~GpodderSortFilterProxyModel() override; protected: - virtual bool filterAcceptsRow( int sourceRow, const QModelIndex &sourceParent ) const; + bool filterAcceptsRow( int sourceRow, const QModelIndex &sourceParent ) const override; }; #endif /* GPODDERSORTFILTERPROXYMODEL_H_ */ diff --git a/src/services/gpodder/GpodderTagTreeItem.h b/src/services/gpodder/GpodderTagTreeItem.h --- a/src/services/gpodder/GpodderTagTreeItem.h +++ b/src/services/gpodder/GpodderTagTreeItem.h @@ -28,7 +28,7 @@ { Q_OBJECT public: - GpodderTagTreeItem( mygpo::TagPtr tag, GpodderTreeItem *parent = 0 ); + explicit GpodderTagTreeItem( mygpo::TagPtr tag, GpodderTreeItem *parent = nullptr ); virtual ~GpodderTagTreeItem(); virtual QVariant displayData() const; mygpo::TagPtr tag() const; diff --git a/src/services/gpodder/GpodderTreeItem.h b/src/services/gpodder/GpodderTreeItem.h --- a/src/services/gpodder/GpodderTreeItem.h +++ b/src/services/gpodder/GpodderTreeItem.h @@ -26,13 +26,12 @@ #include #include -class GpodderServiceModel; class GpodderTreeItem : public QObject { Q_OBJECT public: - GpodderTreeItem( GpodderTreeItem *parent = 0, QString name = "" ); + explicit GpodderTreeItem( GpodderTreeItem *parent = nullptr, const QString &name = QString() ); virtual ~GpodderTreeItem(); void appendChild( GpodderTreeItem *child ); diff --git a/src/services/gpodder/GpodderTreeItem.cpp b/src/services/gpodder/GpodderTreeItem.cpp --- a/src/services/gpodder/GpodderTreeItem.cpp +++ b/src/services/gpodder/GpodderTreeItem.cpp @@ -22,7 +22,7 @@ #include "GpodderServiceModel.h" #include "GpodderTagTreeItem.h" -GpodderTreeItem::GpodderTreeItem( GpodderTreeItem *parent, QString name ) +GpodderTreeItem::GpodderTreeItem( GpodderTreeItem *parent, const QString &name ) : QObject( parent ) , m_parentItem( parent ) , m_name( name ) @@ -80,7 +80,7 @@ bool GpodderTreeItem::isRoot() const { - return ( m_parentItem == 0 ); + return ( m_parentItem == nullptr ); } void diff --git a/src/services/gpodder/amarok_service_gpodder.desktop b/src/services/gpodder/amarok_service_gpodder.desktop --- a/src/services/gpodder/amarok_service_gpodder.desktop +++ b/src/services/gpodder/amarok_service_gpodder.desktop @@ -23,6 +23,7 @@ Name[it]=gpodder.net Name[ja]=gpodder.net Name[km]=gpodder.net +Name[ko]=gpodder.net Name[lt]=gpodder.net Name[lv]=gpodder.net Name[nb]=gpodder.net @@ -44,7 +45,6 @@ Name[tr]=gpodder.net Name[uk]=gpodder.net Name[x-test]=xxgpodder.netxx -Name[zh_CN]=gpodder.net Name[zh_TW]=gpodder.net Comment=Podcast Service Comment[bg]=Услуга за подкастове @@ -68,6 +68,7 @@ Comment[it]=Servizio Podcast Comment[ja]=ポッドキャストサービス Comment[km]=សេវា​ផតខាស់ +Comment[ko]=팟캐스트 서비스 Comment[lt]=Garso prenumeratų tarnyba Comment[lv]=Podraižu serviss Comment[nb]=Podkast-tjeneste @@ -89,7 +90,6 @@ Comment[tr]=Podcast Servisi Comment[uk]=Служба трансляцій Comment[x-test]=xxPodcast Servicexx -Comment[zh_CN]=播客服务 Comment[zh_TW]=Podcast 服務 ServiceTypes=Amarok/Plugin diff --git a/src/services/gpodder/amarok_service_gpodder_config.desktop b/src/services/gpodder/amarok_service_gpodder_config.desktop --- a/src/services/gpodder/amarok_service_gpodder_config.desktop +++ b/src/services/gpodder/amarok_service_gpodder_config.desktop @@ -28,7 +28,8 @@ Name[it]=Configurazione servizio gpodder.net Name[ja]=gpodder.net サービスの設定 Name[km]=កំណត់​រចនាសម្ព័ន្ធ​សេវាកម្ម gpodder.net -Name[lt]=gpodder.net Service nustatymai +Name[ko]=gpodder.net 서비스 구성 +Name[lt]=gpodder.net Service nuostatos Name[lv]=gpodder.net pakalpojuma konfigurācija Name[nb]=Innstillinger for gpodder.net-tjenesten Name[nl]=Instellingen van de service gpodder.net @@ -47,7 +48,6 @@ Name[tr]=gpodder.net Hizmet Yapılandırması Name[uk]=Налаштування служби gpodder.net Name[x-test]=xxgpodder.net Service Configxx -Name[zh_CN]=gpodder.net 服务配置 Name[zh_TW]=gpodder.net 服務設定 Comment=Configure gpodder.net Credentials Comment[bs]=Postavi gpodder.net akreditiv @@ -61,14 +61,15 @@ Comment[es]=Configurar credenciales de gpodder.net Comment[et]=gpodder.net-i kasutajatunnuste määramine Comment[fi]=Määritä gpodder.net-palvelun tilitiedot -Comment[fr]=Configuration des références de « gpodder.net » +Comment[fr]=Configuration des identifiants « gpodder.net » Comment[ga]=Cumraigh dintiúir gpodder.net Comment[gl]=Configurar as credenciais de gpodder.net Comment[hu]=Bejelentkezési adatok beállítása a gpodder.net szolgáltatáshoz -Comment[id]=Konfigurasi surat kuasa gpodder.net +Comment[id]=Konfigurasikan surat kuasa gpodder.net Comment[it]=Configura credenziali gpodder.net Comment[ja]=gpodder.net の資格情報を設定 Comment[km]=កំណត់​រចនាសម្ព័ន្ធ​ការ​អនុញ្ញាត​ gpodder.net +Comment[ko]=gpodder.net 인증 정보 설정 Comment[lt]=Konfigūruoti gpodder.net prisijungimo duomenis Comment[lv]=Konfigurēt gpodder.net lietotāja kontu Comment[nb]=Sett opp gpodder.net-akkreditiver @@ -88,5 +89,4 @@ Comment[tr]=gpodder.net üyelik ayarlarını yapılandır Comment[uk]=Налаштувати реєстраційні дані у gpodder.net Comment[x-test]=xxConfigure gpodder.net Credentialsxx -Comment[zh_CN]=配置 gpodder.net 证件 Comment[zh_TW]=設定 gpodder.net 的憑證 diff --git a/src/services/gpodder/images/CMakeLists.txt b/src/services/gpodder/images/CMakeLists.txt --- a/src/services/gpodder/images/CMakeLists.txt +++ b/src/services/gpodder/images/CMakeLists.txt @@ -1,5 +1,5 @@ install( FILES mygpo.png - DESTINATION ${DATA_INSTALL_DIR}/amarok/images + DESTINATION ${KDE_INSTALL_DATADIR}/amarok/images ) diff --git a/src/services/jamendo/CMakeLists.txt b/src/services/jamendo/CMakeLists.txt --- a/src/services/jamendo/CMakeLists.txt +++ b/src/services/jamendo/CMakeLists.txt @@ -29,6 +29,6 @@ ) - install(TARGETS amarok_service_jamendo DESTINATION ${PLUGIN_INSTALL_DIR} ) + install(TARGETS amarok_service_jamendo DESTINATION ${KDE_INSTALL_PLUGINDIR} ) kcoreaddons_desktop_to_json(amarok_service_jamendo amarok_service_jamendo.desktop SERVICE_TYPES ${CMAKE_SOURCE_DIR}/src/amarok-plugin.desktop) diff --git a/src/services/jamendo/JamendoMeta.h b/src/services/jamendo/JamendoMeta.h --- a/src/services/jamendo/JamendoMeta.h +++ b/src/services/jamendo/JamendoMeta.h @@ -64,8 +64,8 @@ class JamendoTrack : public ServiceTrack { public: - JamendoTrack( const QString &name ); - JamendoTrack( const QStringList &resultRow ); + explicit JamendoTrack( const QString &name ); + explicit JamendoTrack( const QStringList &resultRow ); void setService( JamendoService * service ); @@ -100,8 +100,8 @@ QString m_homeURL; public: - JamendoArtist( const QString &name ); - JamendoArtist( const QStringList &resultRow ); + explicit JamendoArtist( const QString &name ); + explicit JamendoArtist( const QStringList &resultRow ); void setPhotoURL( const QString &photoURL ); QString photoURL() const; @@ -131,8 +131,8 @@ public: - JamendoAlbum( const QString &name ); - JamendoAlbum( const QStringList &resultRow ); + explicit JamendoAlbum( const QString &name ); + explicit JamendoAlbum( const QStringList &resultRow ); virtual QString downloadPrefix() const { return "jamendo"; } @@ -168,8 +168,8 @@ { public: - JamendoGenre( const QString &name ); - JamendoGenre( const QStringList &resultRow ); + explicit JamendoGenre( const QString &name ); + explicit JamendoGenre( const QStringList &resultRow ); virtual bool isBookmarkable() const { return true; } virtual QString collectionName() const { return "Jamendo.com"; } diff --git a/src/services/jamendo/JamendoService.cpp b/src/services/jamendo/JamendoService.cpp --- a/src/services/jamendo/JamendoService.cpp +++ b/src/services/jamendo/JamendoService.cpp @@ -22,7 +22,7 @@ #include "core-impl/collections/support/CollectionManager.h" #include "core/support/Debug.h" #include "core/support/Components.h" -#include "core/interfaces/Logger.h" +#include "core/logger/Logger.h" #include "EngineController.h" #include "JamendoInfoParser.h" #include "ServiceSqlRegistry.h" @@ -190,7 +190,7 @@ /* Deprecated */ QUrl("http://imgjam.com/data/dbdump_artistalbumtrack.xml.gz"), QUrl::fromLocalFile( m_tempFileName ), 0700 , KIO::HideProgressInfo | KIO::Overwrite ); - Amarok::Components::logger()->newProgressOperation( m_listDownloadJob, i18n( "Downloading Jamendo.com database..." ), this, SLOT(listDownloadCancelled()) ); + Amarok::Logger::newProgressOperation( m_listDownloadJob, i18n( "Downloading Jamendo.com database..." ), this, SLOT(listDownloadCancelled()) ); connect( m_listDownloadJob, &KJob::result, this, &JamendoService::listDownloadComplete ); @@ -212,7 +212,7 @@ return; } - Amarok::Components::logger()->shortMessage( i18n( "Updating the local Jamendo database." ) ); + Amarok::Logger::shortMessage( i18n( "Updating the local Jamendo database." ) ); debug() << "JamendoService: create xml parser"; if( m_xmlParser == 0 ) diff --git a/src/services/jamendo/JamendoXmlParser.h b/src/services/jamendo/JamendoXmlParser.h --- a/src/services/jamendo/JamendoXmlParser.h +++ b/src/services/jamendo/JamendoXmlParser.h @@ -42,13 +42,13 @@ * Constructor * @param fileName The file to parse */ - JamendoXmlParser( const QString &fileName ); + explicit JamendoXmlParser( const QString &fileName ); /** * The function that starts the actual work. Inherited from ThreadWeaver::Job * Note the work is performed in a separate thread */ - void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) Q_DECL_OVERRIDE; + void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) override; /** * Destructor @@ -121,8 +121,8 @@ bool m_aborted; protected: - void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; - void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; + void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; + void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; }; #endif diff --git a/src/services/jamendo/JamendoXmlParser.cpp b/src/services/jamendo/JamendoXmlParser.cpp --- a/src/services/jamendo/JamendoXmlParser.cpp +++ b/src/services/jamendo/JamendoXmlParser.cpp @@ -19,7 +19,7 @@ #include "core/support/Amarok.h" #include "core/support/Debug.h" #include "core/support/Components.h" -#include "core/interfaces/Logger.h" +#include "core/logger/Logger.h" #include @@ -167,7 +167,7 @@ if( m_aborted ) return; - Amarok::Components::logger()->longMessage( + Amarok::Logger::longMessage( i18ncp( "First part of: Jamendo.com database update complete. Added 3 tracks on 4 albums from 5 artists.", "Jamendo.com database update complete. Added 1 track on ", "Jamendo.com database update complete. Added %1 tracks on ", m_nNumberOfTracks) + i18ncp( "Middle part of: Jamendo.com database update complete. Added 3 tracks on 4 albums from 5 artists.", "1 album from ", "%1 albums from ", m_nNumberOfAlbums) + i18ncp( "Last part of: Jamendo.com database update complete. Added 3 tracks on 4 albums from 5 artists.", "1 artist.", "%1 artists.", m_nNumberOfArtists ) @@ -287,7 +287,7 @@ // debug() << " Photo: " << currentArtist.photoURL(); // debug() << " J_url: " << currentArtist.jamendoURL(); // debug() << " H_url: " << currentArtist.homeURL(); -// debug() << " Decription: " << currentArtist.description(); +// debug() << " Description:" << currentArtist.description(); } @@ -331,7 +331,7 @@ readTrack(); // else if ( currentChildElement.tagName() == "description" ) // description = currentChildElement.text(); - //we use tags instad of genres for creating genres in the database, as the + //we use tags instead of genres for creating genres in the database, as the //Jamendo.com genres are messy at best // else if ( currentChildElement.tagName() == "tags" ) // tags = currentChildElement.text().split(' ', QString::SkipEmptyParts); diff --git a/src/services/jamendo/amarok_service_jamendo.desktop b/src/services/jamendo/amarok_service_jamendo.desktop --- a/src/services/jamendo/amarok_service_jamendo.desktop +++ b/src/services/jamendo/amarok_service_jamendo.desktop @@ -81,7 +81,7 @@ Comment[it]=Ascoltare e scaricare musica inviata da artisti indipendenti Comment[ja]=無所属のアーティストによってアップロードされた音楽を聴いたりダウンロードしたりできます Comment[km]=ស្ដាប់ និង​ទាញ​យក​តន្ត្រី​ដែល​បាន​ផ្ទុក​ឡើង​ដោយ​សិល្បករ​ឯករាជ្យ -Comment[ko]=독립된 가수가 만든 음악을 듣고 내려받기 +Comment[ko]=독립 아티스트가 업로드한 음악 듣기 및 다운로드 Comment[ku]=Muzîkên, alî yê hunermendê azad ve hatine bar kirin, guhdarî bike û bi daxe Comment[lt]=Klausyti ir atsisiųsti muziką, atsiųstą nepriklausomų atlikėjų Comment[lv]=Klausieties un lejupielādējiet mūziku, kuru augšupielādē neatkarīgie mākslinieki @@ -106,7 +106,6 @@ Comment[uk]=Прослухайте і отримайте музику, записану незалежними виконавцями Comment[wa]=Schoûter eyet aberweter del muzike eberwetêye pa des årtisses dislaxhîs Comment[x-test]=xxListen to and download music uploaded by independent artistsxx -Comment[zh_CN]=收听并下载由独立艺术家上传的音乐 Comment[zh_TW]=聆聽並下載由獨立藝人所上傳的音樂 diff --git a/src/services/jamendo/images/CMakeLists.txt b/src/services/jamendo/images/CMakeLists.txt --- a/src/services/jamendo/images/CMakeLists.txt +++ b/src/services/jamendo/images/CMakeLists.txt @@ -1,5 +1,5 @@ install( FILES hover_info_jamendo.png - DESTINATION ${DATA_INSTALL_DIR}/amarok/images + DESTINATION ${KDE_INSTALL_DATADIR}/amarok/images ) diff --git a/src/services/lastfm/AvatarDownloader.h b/src/services/lastfm/AvatarDownloader.h --- a/src/services/lastfm/AvatarDownloader.h +++ b/src/services/lastfm/AvatarDownloader.h @@ -41,6 +41,7 @@ /** * Start the download + * @param username The username for which avatar should be downloaded. * @param url The url that should be downloaded. */ void downloadAvatar( const QString& username, const QUrl &url ); diff --git a/src/services/lastfm/CMakeLists.txt b/src/services/lastfm/CMakeLists.txt --- a/src/services/lastfm/CMakeLists.txt +++ b/src/services/lastfm/CMakeLists.txt @@ -13,7 +13,7 @@ ) add_library( amarok_service_lastfm_config SHARED ${amarok_service_lastfm_config_SRCS} ) - +generate_export_header(amarok_service_lastfm_config BASE_NAME amarok_service_lastfm_config) target_link_libraries( amarok_service_lastfm_config amarokcore KF5::Wallet @@ -58,7 +58,7 @@ Qt5::Network ) -install( TARGETS amarok_service_lastfm DESTINATION ${PLUGIN_INSTALL_DIR} ) +install( TARGETS amarok_service_lastfm DESTINATION ${KDE_INSTALL_PLUGINDIR} ) kcoreaddons_desktop_to_json( amarok_service_lastfm amarok_service_lastfm.desktop SERVICE_TYPES ${CMAKE_SOURCE_DIR}/src/amarok-plugin.desktop ) @@ -82,7 +82,7 @@ Qt5::Network ) -install( TARGETS kcm_amarok_service_lastfm DESTINATION ${PLUGIN_INSTALL_DIR} ) +install( TARGETS kcm_amarok_service_lastfm DESTINATION ${KDE_INSTALL_PLUGINDIR} ) kcoreaddons_desktop_to_json( kcm_amarok_service_lastfm amarok_service_lastfm_config.desktop SERVICE_TYPES kcmodule.desktop ) diff --git a/src/services/lastfm/LastFmService.cpp b/src/services/lastfm/LastFmService.cpp --- a/src/services/lastfm/LastFmService.cpp +++ b/src/services/lastfm/LastFmService.cpp @@ -34,7 +34,7 @@ #include "ScrobblerAdapter.h" #include "GlobalCurrentTrackActions.h" #include "core/support/Components.h" -#include "core/interfaces/Logger.h" +#include "core/logger/Logger.h" #include "meta/LastFmMeta.h" #include "SynchronizationAdapter.h" #include "statsyncing/Controller.h" @@ -235,7 +235,7 @@ if( m_scrobbler && (!authenticated || !m_config->scrobble()) ) { - debug() << __PRETTY_FUNCTION__ << "unregistering and destorying ScrobblerAdapter"; + debug() << __PRETTY_FUNCTION__ << "unregistering and destroying ScrobblerAdapter"; controller->unregisterScrobblingService( StatSyncing::ScrobblingServicePtr( m_scrobbler.data() ) ); m_scrobbler.clear(); } @@ -248,7 +248,7 @@ if( m_synchronizationAdapter && !authenticated ) { - debug() << __PRETTY_FUNCTION__ << "unregistering and destorying SynchronizationAdapter"; + debug() << __PRETTY_FUNCTION__ << "unregistering and destroying SynchronizationAdapter"; controller->unregisterProvider( m_synchronizationAdapter ); m_synchronizationAdapter = 0; } @@ -294,12 +294,12 @@ break; } case QNetworkReply::AuthenticationRequiredError: - Amarok::Components::logger()->longMessage( i18nc("Last.fm: errorMessage", + Amarok::Logger::longMessage( i18nc("Last.fm: errorMessage", "Either the username was not recognized, or the password was incorrect." ) ); break; default: - Amarok::Components::logger()->longMessage( i18nc("Last.fm: errorMessage", + Amarok::Logger::longMessage( i18nc("Last.fm: errorMessage", "There was a problem communicating with the Last.fm services. Please try again later." ) ); break; } diff --git a/src/services/lastfm/LastFmServiceCollection.h b/src/services/lastfm/LastFmServiceCollection.h --- a/src/services/lastfm/LastFmServiceCollection.h +++ b/src/services/lastfm/LastFmServiceCollection.h @@ -33,7 +33,7 @@ { Q_OBJECT public: - LastFmServiceCollection( const QString &userName ); + explicit LastFmServiceCollection( const QString &userName ); virtual ~LastFmServiceCollection(); virtual bool possiblyContainsTrack( const QUrl &url ) const; diff --git a/src/services/lastfm/LastFmServiceCollection.cpp b/src/services/lastfm/LastFmServiceCollection.cpp --- a/src/services/lastfm/LastFmServiceCollection.cpp +++ b/src/services/lastfm/LastFmServiceCollection.cpp @@ -95,7 +95,7 @@ connect( m_jobs[ "user.getFriends" ], &QNetworkReply::finished, this, &LastFmServiceCollection::slotAddFriendsLoved ); //connect( m_jobs[ "user.getFriends" ], &QNetworkReply::finished, this, &LastFmServiceCollection::slotAddFriendsPersonal ); - //TODO Automatically add simmilar artist streams for the users favorite artists. + //TODO Automatically add similar artist streams for the users favorite artists. } LastFmServiceCollection::~LastFmServiceCollection() diff --git a/src/services/lastfm/LastFmServiceConfig.h b/src/services/lastfm/LastFmServiceConfig.h --- a/src/services/lastfm/LastFmServiceConfig.h +++ b/src/services/lastfm/LastFmServiceConfig.h @@ -115,7 +115,7 @@ void prepareOpenedWallet(); void askAboutMissingKWallet(); - // don't remove or reorder entires, would break saved config + // don't remove or reorder entries, would break saved config enum KWalletUsage { NoPasswordEnteredYet, PasswodInKWallet, diff --git a/src/services/lastfm/LastFmServiceConfig.cpp b/src/services/lastfm/LastFmServiceConfig.cpp --- a/src/services/lastfm/LastFmServiceConfig.cpp +++ b/src/services/lastfm/LastFmServiceConfig.cpp @@ -20,7 +20,7 @@ #include "LastFmServiceConfig.h" #include "App.h" -#include "core/interfaces/Logger.h" +#include "core/logger/Logger.h" #include "core/support/Amarok.h" #include "core/support/Components.h" #include "core/support/Debug.h" @@ -216,7 +216,7 @@ { warning() << __PRETTY_FUNCTION__ << "failed to open wallet"; QString message = i18n( "Failed to open KDE Wallet to read Last.fm credentials" ); - Amarok::Components::logger()->longMessage( message, Amarok::Logger::Warning ); + Amarok::Logger::longMessage( message, Amarok::Logger::Warning ); if( m_wallet ) m_wallet->deleteLater(); // no point in having invalid wallet around m_wallet = 0; diff --git a/src/services/lastfm/LastFmServiceSettings.h b/src/services/lastfm/LastFmServiceSettings.h --- a/src/services/lastfm/LastFmServiceSettings.h +++ b/src/services/lastfm/LastFmServiceSettings.h @@ -32,7 +32,7 @@ Q_OBJECT public: - explicit LastFmServiceSettings( QWidget *parent = 0, const QVariantList &args = QVariantList() ); + explicit LastFmServiceSettings( QWidget *parent = nullptr, const QVariantList &args = QVariantList() ); virtual ~LastFmServiceSettings(); diff --git a/src/services/lastfm/LastFmTreeModel.h b/src/services/lastfm/LastFmTreeModel.h --- a/src/services/lastfm/LastFmTreeModel.h +++ b/src/services/lastfm/LastFmTreeModel.h @@ -28,7 +28,6 @@ #include -class QNetworkReply; namespace LastFm { @@ -86,15 +85,14 @@ class LastFmTreeItem; class QUrl; -class WsReply; class LastFmTreeModel : public QAbstractItemModel { Q_OBJECT public: - explicit LastFmTreeModel( QObject *parent = 0 ); + explicit LastFmTreeModel( QObject *parent = nullptr ); ~LastFmTreeModel(); QVariant data( const QModelIndex &index, int role ) const; @@ -137,10 +135,10 @@ class LastFmTreeItem { public: - LastFmTreeItem ( const LastFm::Type &type, const QVariant &data, LastFmTreeItem *parent = 0 ); - LastFmTreeItem ( const QString &url, const LastFm::Type &type, const QVariant &data, LastFmTreeItem *parent = 0 ); - explicit LastFmTreeItem ( const LastFm::Type &type, LastFmTreeItem *parent = 0 ); - LastFmTreeItem ( const QString &url, const LastFm::Type &type, LastFmTreeItem *parent = 0 ); + LastFmTreeItem ( const LastFm::Type &type, const QVariant &data, LastFmTreeItem *parent = nullptr ); + LastFmTreeItem ( const QString &url, const LastFm::Type &type, const QVariant &data, LastFmTreeItem *parent = nullptr ); + explicit LastFmTreeItem ( const LastFm::Type &type, LastFmTreeItem *parent = nullptr ); + LastFmTreeItem ( const QString &url, const LastFm::Type &type, LastFmTreeItem *parent = nullptr ); ~LastFmTreeItem(); void appendChild ( LastFmTreeItem *child ); diff --git a/src/services/lastfm/LastFmTreeView.h b/src/services/lastfm/LastFmTreeView.h --- a/src/services/lastfm/LastFmTreeView.h +++ b/src/services/lastfm/LastFmTreeView.h @@ -40,7 +40,7 @@ Q_OBJECT public: - LastFmTreeView ( QWidget* parent = 0 ); + explicit LastFmTreeView ( QWidget* parent = nullptr ); ~LastFmTreeView(); Q_SIGNALS: @@ -61,7 +61,7 @@ enum ContextMenuActionType { ExecQMenu, DoQMenuDefaultAction }; void playChildTracks ( const QModelIndex &item, Playlist::AddOptions insertMode ); void playChildTracks ( const QModelIndexList &items, Playlist::AddOptions insertMode ); - QActionList createBasicActions( const QModelIndexList &indcies ); + QActionList createBasicActions( const QModelIndexList &indices ); QTimer* m_timer; LastFmTreeModel* m_model; diff --git a/src/services/lastfm/LoveTrackAction.h b/src/services/lastfm/LoveTrackAction.h --- a/src/services/lastfm/LoveTrackAction.h +++ b/src/services/lastfm/LoveTrackAction.h @@ -30,7 +30,7 @@ { Q_OBJECT public: - LoveTrackAction( LastFmService * service ); + explicit LoveTrackAction( LastFmService * service ); private Q_SLOTS: void slotTriggered(); diff --git a/src/services/lastfm/ScrobblerAdapter.cpp b/src/services/lastfm/ScrobblerAdapter.cpp --- a/src/services/lastfm/ScrobblerAdapter.cpp +++ b/src/services/lastfm/ScrobblerAdapter.cpp @@ -23,7 +23,7 @@ #include "MainWindow.h" #include "core/collections/Collection.h" -#include "core/interfaces/Logger.h" +#include "core/logger/Logger.h" #include "core/meta/Meta.h" #include "core/meta/support/MetaConstants.h" #include "core/support/Components.h" @@ -155,7 +155,7 @@ lastfm::MutableTrack trackInfo; copyTrackMetadata( trackInfo, track ); trackInfo.love(); - Amarok::Components::logger()->shortMessage( i18nc( "As in Last.fm", "Loved Track: %1", track->prettyName() ) ); + Amarok::Logger::shortMessage( i18nc( "As in Last.fm", "Loved Track: %1", track->prettyName() ) ); } void @@ -167,7 +167,7 @@ lastfm::MutableTrack trackInfo; copyTrackMetadata( trackInfo, track ); trackInfo.ban(); - Amarok::Components::logger()->shortMessage( i18nc( "As in Last.fm", "Banned Track: %1", track->prettyName() ) ); + Amarok::Logger::shortMessage( i18nc( "As in Last.fm", "Banned Track: %1", track->prettyName() ) ); } void @@ -282,7 +282,7 @@ line = printCorrected( Meta::valAlbumArtist, track.albumArtist( orig ), track.albumArtist( correct ) ); if( !line.isEmpty() ) lines << line; - Amarok::Components::logger()->longMessage( lines.join( "
" ) ); + Amarok::Logger::longMessage( lines.join( "
" ) ); } bool diff --git a/src/services/lastfm/SimilarArtistsAction.h b/src/services/lastfm/SimilarArtistsAction.h --- a/src/services/lastfm/SimilarArtistsAction.h +++ b/src/services/lastfm/SimilarArtistsAction.h @@ -23,7 +23,7 @@ { Q_OBJECT public: - SimilarArtistsAction( QObject *parent ); + explicit SimilarArtistsAction( QObject *parent ); private Q_SLOTS: void slotTriggered(); diff --git a/src/services/lastfm/SynchronizationAdapter.h b/src/services/lastfm/SynchronizationAdapter.h --- a/src/services/lastfm/SynchronizationAdapter.h +++ b/src/services/lastfm/SynchronizationAdapter.h @@ -30,9 +30,9 @@ public: /** - * @param user Last.fm username + * @param config a pointer to Last.fm config */ - SynchronizationAdapter( const LastFmServiceConfigPtr &config ); + explicit SynchronizationAdapter( const LastFmServiceConfigPtr &config ); virtual ~SynchronizationAdapter(); virtual QString id() const; diff --git a/src/services/lastfm/amarok_lastfm_shared_export.h b/src/services/lastfm/amarok_lastfm_shared_export.h deleted file mode 100644 --- a/src/services/lastfm/amarok_lastfm_shared_export.h +++ /dev/null @@ -1,36 +0,0 @@ -/**************************************************************************************** - * Copyright (c) 2010 Téo Mrnjavac * - * Copyright (c) 2012 Matěj Laitl * - * * - * This program is free software; you can redistribute it and/or modify it under * - * the terms of the GNU General Public License as published by the Free Software * - * Foundation; either version 2 of the License, or (at your option) any later * - * version. * - * * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY * - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * - * PARTICULAR PURPOSE. See the GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License along with * - * this program. If not, see . * - ****************************************************************************************/ - -#ifndef AMAROK_LASTFM_SHARED_EXPORT_H -#define AMAROK_LASTFM_SHARED_EXPORT_H - -/* needed for Q_DECL_EXPORT and Q_DECL_IMPORT macros */ -#include - -#ifndef AMAROK_LASTFM_SHARED_EXPORT -# ifdef MAKE_AMAROK_SERVICE_LASTFM_SHARED_LIB - /* We are building this library */ -# define AMAROK_LASTFM_SHARED_EXPORT Q_DECL_EXPORT - -# else - /* We are using this library */ -# define AMAROK_LASTFM_SHARED_EXPORT Q_DECL_IMPORT - -# endif // MAKE_AMAROK_SERVICE_LASTFM_SHARED_LIB -#endif // AMAROK_LASTFM_SHARED_EXPORT - -#endif //AMAROK_LASTFM_SHARED_EXPORT_H diff --git a/src/services/lastfm/amarok_service_lastfm.desktop b/src/services/lastfm/amarok_service_lastfm.desktop --- a/src/services/lastfm/amarok_service_lastfm.desktop +++ b/src/services/lastfm/amarok_service_lastfm.desktop @@ -53,7 +53,6 @@ Name[uk]=Last.fm Name[wa]=Last.fm Name[x-test]=xxLast.fmxx -Name[zh_CN]=Last.fm Name[zh_TW]=Last.fm Comment=A service that integrates Last.fm functionality into Amarok Comment[bg]=Услуга, която вгражда Last.fm в Amarok @@ -99,7 +98,6 @@ Comment[tr]=Last.fm işlevlerini Amarok ile bütünleştiren bir hizmet Comment[uk]=Служба, яка інтегрує функціональність Last.fm до Amarok Comment[x-test]=xxA service that integrates Last.fm functionality into Amarokxx -Comment[zh_CN]=一个在 Amarok 中集成 Last.fm 功能的服务 Comment[zh_TW]=一種將 Last.fm 其功能性整合到 Amarok 中的服務 diff --git a/src/services/lastfm/amarok_service_lastfm_config.desktop b/src/services/lastfm/amarok_service_lastfm_config.desktop --- a/src/services/lastfm/amarok_service_lastfm_config.desktop +++ b/src/services/lastfm/amarok_service_lastfm_config.desktop @@ -36,7 +36,7 @@ Name[it]=Configurazione servizio Last.fm Name[ja]=Last.fm サービスの設定 Name[km]=កំណត់​រចនាសម្ព័ន្ធ​​សេវា Last.fm -Name[ko]=Last.fm 서비스 설정 +Name[ko]=Last.fm 서비스 구성 Name[ku]=Veavakirina Servisa Last.fm Name[lt]=Last.fm tarnybos parinktys Name[lv]=Last.gm pakalpojuma konfigurācija @@ -62,7 +62,6 @@ Name[uk]=Налаштування служби Last.fm Name[wa]=Apontiaedje do siervice Last.fm Name[x-test]=xxLast.fm Service Configxx -Name[zh_CN]=Last.fm 服务配置 Name[zh_TW]=Last.fm 服務設定 Comment=Set up Last.fm username and password Comment[bg]=Настройване на потребител и парола за Last.fm @@ -84,7 +83,7 @@ Comment[gl]=Configura o nome de usuario e contrasinal de Last.fm Comment[hne]=लास्ट.एफएम कमइया-नाम अउ पासवर्ड सेट करव Comment[hu]=Last.fm-felhasználónév és -jelszó beállítása -Comment[id]=Persiapan nama pengguna dan kata sandi di Last.fm +Comment[id]=Pengesetan nama pengguna dan kata sandi di Last.fm Comment[is]=Setja upp Last.fm notendanafn og lykilorð Comment[it]=Configura nome utente e password Last.fm Comment[ja]=Last.fm のユーザ名とパスワードを設定 @@ -115,5 +114,4 @@ Comment[uk]=Встановіть назву користувача і пароль Last.fm Comment[wa]=Apontyî no d' uzeu eyet sicret di Last.fm Comment[x-test]=xxSet up Last.fm username and passwordxx -Comment[zh_CN]=设置 Last.fm 的用户名和密码 Comment[zh_TW]=設定 Last.fm 的使用者名稱與密碼 diff --git a/src/services/lastfm/biases/LastFmBias.h b/src/services/lastfm/biases/LastFmBias.h --- a/src/services/lastfm/biases/LastFmBias.h +++ b/src/services/lastfm/biases/LastFmBias.h @@ -49,7 +49,7 @@ virtual QString name() const; virtual QString toString() const; - virtual QWidget* widget( QWidget* parent = 0 ); + virtual QWidget* widget( QWidget* parent = nullptr ); virtual Dynamic::TrackSet matchingTracks( const Meta::TrackList& playlist, int contextCount, int finalCount, diff --git a/src/services/lastfm/biases/WeeklyTopBias.h b/src/services/lastfm/biases/WeeklyTopBias.h --- a/src/services/lastfm/biases/WeeklyTopBias.h +++ b/src/services/lastfm/biases/WeeklyTopBias.h @@ -20,7 +20,6 @@ #include "dynamic/biases/TagMatchBias.h" -class KJob; class QNetworkReply; namespace Dynamic @@ -53,7 +52,7 @@ virtual QString name() const; virtual QString toString() const; - virtual QWidget* widget( QWidget* parent = 0 ); + virtual QWidget* widget( QWidget* parent = nullptr ); virtual bool trackMatches( int position, const Meta::TrackList& playlist, diff --git a/src/services/lastfm/images/CMakeLists.txt b/src/services/lastfm/images/CMakeLists.txt --- a/src/services/lastfm/images/CMakeLists.txt +++ b/src/services/lastfm/images/CMakeLists.txt @@ -1,6 +1,6 @@ install( FILES hover_info_lastfm.png - DESTINATION ${DATA_INSTALL_DIR}/amarok/images + DESTINATION ${KDE_INSTALL_DATADIR}/amarok/images ) diff --git a/src/services/lastfm/meta/LastFmMeta.h b/src/services/lastfm/meta/LastFmMeta.h --- a/src/services/lastfm/meta/LastFmMeta.h +++ b/src/services/lastfm/meta/LastFmMeta.h @@ -35,8 +35,8 @@ public: class Private; - Track( const QString &lastFmUri ); - Track( lastfm::Track track ); //Convienience Constructor to allow constructing a Meta::LastFmTrack from a LastFmTrack (confusing?) + explicit Track( const QString &lastFmUri ); + explicit Track( lastfm::Track track ); //Convenience Constructor to allow constructing a Meta::LastFmTrack from a LastFmTrack (confusing?) virtual ~Track(); // methods inherited from Meta::Base diff --git a/src/services/lastfm/meta/LastFmMeta_p.h b/src/services/lastfm/meta/LastFmMeta_p.h --- a/src/services/lastfm/meta/LastFmMeta_p.h +++ b/src/services/lastfm/meta/LastFmMeta_p.h @@ -198,7 +198,7 @@ class LastFmArtist : public Meta::Artist { public: - LastFmArtist( Track::Private *dptr ) + explicit LastFmArtist( Track::Private *dptr ) : Meta::Artist() , d( dptr ) {} @@ -212,7 +212,7 @@ { if( d ) return d->artist; - return QString( "Last.fm" ); + return QStringLiteral( "Last.fm" ); } Track::Private * const d; @@ -223,7 +223,7 @@ class LastFmAlbum : public Meta::Album { public: - LastFmAlbum( Track::Private *dptr ) + explicit LastFmAlbum( Track::Private *dptr ) : Meta::Album() , d( dptr ) {} @@ -296,7 +296,7 @@ class LastFmGenre : public Meta::Genre { public: - LastFmGenre( Track::Private *dptr ) + explicit LastFmGenre( Track::Private *dptr ) : Meta::Genre() , d( dptr ) {} @@ -319,7 +319,7 @@ class LastFmComposer : public Meta::Composer { public: - LastFmComposer( Track::Private *dptr ) + explicit LastFmComposer( Track::Private *dptr ) : Meta::Composer() , d( dptr ) {} @@ -342,7 +342,7 @@ class LastFmYear : public Meta::Year { public: - LastFmYear( Track::Private *dptr ) + explicit LastFmYear( Track::Private *dptr ) : Meta::Year() , d( dptr ) {} diff --git a/src/services/lastfm/meta/LastFmMultiPlayableCapability.h b/src/services/lastfm/meta/LastFmMultiPlayableCapability.h --- a/src/services/lastfm/meta/LastFmMultiPlayableCapability.h +++ b/src/services/lastfm/meta/LastFmMultiPlayableCapability.h @@ -14,10 +14,9 @@ * this program. If not, see . * ****************************************************************************************/ -#ifndef AMAROK_MULTIPLAYABLECAPABILITYIMPL_P_H -#define AMAROK_MULTIPLAYABLECAPABILITYIMPL_P_H +#ifndef AMAROK_LASTFM_MULTIPLAYABLECAPABILITY_H +#define AMAROK_LASTFM_MULTIPLAYABLECAPABILITY_H -#include "core/interfaces/Logger.h" #include "core/support/Components.h" #include "core/support/Debug.h" #include "MainWindow.h" @@ -37,7 +36,7 @@ Q_OBJECT public: - LastFmMultiPlayableCapability( LastFm::Track *track ); + explicit LastFmMultiPlayableCapability( LastFm::Track *track ); virtual ~LastFmMultiPlayableCapability(); // Capabilities::MultiPlayableCapability methods diff --git a/src/services/lastfm/meta/LastFmMultiPlayableCapability.cpp b/src/services/lastfm/meta/LastFmMultiPlayableCapability.cpp --- a/src/services/lastfm/meta/LastFmMultiPlayableCapability.cpp +++ b/src/services/lastfm/meta/LastFmMultiPlayableCapability.cpp @@ -76,7 +76,7 @@ if( m_currentTrack.isNull() ) // we only force a track change at the beginning { fetchNext(); - // we update metadata immediatelly for the very first track + // we update metadata immediately for the very first track m_track->setTrackInfo( m_currentTrack ); } } @@ -95,14 +95,14 @@ // a subscriber, even if the credentials are OK if( e == lastfm::ws::SubscribersOnly || e == lastfm::ws::AuthenticationFailed ) { - Amarok::Components::logger()->longMessage( i18n( "To listen to Last.fm streams " + Amarok::Logger::longMessage( i18n( "To listen to Last.fm streams " "and radio you need to be a paying Last.fm subscriber and you need to " "stream from a supported " "country. All other Last.fm features work fine." ) ); } else { - Amarok::Components::logger()->longMessage( + Amarok::Logger::longMessage( i18n( "Error starting track from Last.fm radio" ) ); } } diff --git a/src/services/lastfm/meta/LastFmStreamInfoCapability.h b/src/services/lastfm/meta/LastFmStreamInfoCapability.h --- a/src/services/lastfm/meta/LastFmStreamInfoCapability.h +++ b/src/services/lastfm/meta/LastFmStreamInfoCapability.h @@ -27,7 +27,7 @@ { Q_OBJECT public: - LastFmStreamInfoCapability( LastFm::Track *track ); + explicit LastFmStreamInfoCapability( LastFm::Track *track ); ~LastFmStreamInfoCapability(); virtual QString streamName() const; diff --git a/src/services/magnatune/CMakeLists.txt b/src/services/magnatune/CMakeLists.txt --- a/src/services/magnatune/CMakeLists.txt +++ b/src/services/magnatune/CMakeLists.txt @@ -51,7 +51,7 @@ Qt5::Widgets ) -install(TARGETS amarok_service_magnatunestore DESTINATION ${PLUGIN_INSTALL_DIR} ) +install(TARGETS amarok_service_magnatunestore DESTINATION ${KDE_INSTALL_PLUGINDIR} ) kcoreaddons_desktop_to_json(amarok_service_magnatunestore amarok_service_magnatunestore.desktop SERVICE_TYPES ${CMAKE_SOURCE_DIR}/src/amarok-plugin.desktop) @@ -76,7 +76,7 @@ Qt5::Gui ) -install(TARGETS kcm_amarok_service_magnatunestore DESTINATION ${PLUGIN_INSTALL_DIR}) +install(TARGETS kcm_amarok_service_magnatunestore DESTINATION ${KDE_INSTALL_PLUGINDIR}) kcoreaddons_desktop_to_json(kcm_amarok_service_magnatunestore amarok_service_magnatunestore_config.desktop SERVICE_TYPES kcmodule.desktop) diff --git a/src/services/magnatune/MagnatuneActions.cpp b/src/services/magnatune/MagnatuneActions.cpp --- a/src/services/magnatune/MagnatuneActions.cpp +++ b/src/services/magnatune/MagnatuneActions.cpp @@ -40,7 +40,7 @@ MagnatuneAddToFavoritesAction::MagnatuneAddToFavoritesAction( const QString &text, Meta::MagnatuneAlbum * album ) - : QAction( QIcon::fromTheme("favorites" ), text, album ) + : QAction( QIcon::fromTheme(QStringLiteral("favorites") ), text, album ) , m_album( album ) { setProperty( "popupdropper_svg_id", "append" ); diff --git a/src/services/magnatune/MagnatuneAlbumDownloader.cpp b/src/services/magnatune/MagnatuneAlbumDownloader.cpp --- a/src/services/magnatune/MagnatuneAlbumDownloader.cpp +++ b/src/services/magnatune/MagnatuneAlbumDownloader.cpp @@ -19,7 +19,7 @@ #include "core/support/Amarok.h" #include "core/support/Components.h" #include "core/support/Debug.h" -#include "core/interfaces/Logger.h" +#include "core/logger/Logger.h" #include "MagnatuneMeta.h" #include @@ -29,8 +29,8 @@ MagnatuneAlbumDownloader::MagnatuneAlbumDownloader() : QObject() - , m_albumDownloadJob( Q_NULLPTR ) - , m_coverDownloadJob( Q_NULLPTR ) + , m_albumDownloadJob( nullptr ) + , m_coverDownloadJob( nullptr ) , m_currentAlbumFileName() { m_tempDir = new QTemporaryDir(); @@ -55,9 +55,9 @@ m_currentAlbumFileName = info.albumCode() + ".zip"; - debug() << "Using temporary location: " << m_tempDir->path() + '/' + m_currentAlbumFileName; + debug() << "Using temporary location: " << m_tempDir->path() + QLatin1Char('/') + m_currentAlbumFileName; - m_albumDownloadJob = KIO::file_copy( downloadUrl, QUrl::fromLocalFile( m_tempDir->path() + '/' + m_currentAlbumFileName ), -1, KIO::Overwrite | KIO::HideProgressInfo ); + m_albumDownloadJob = KIO::file_copy( downloadUrl, QUrl::fromLocalFile( m_tempDir->path() + QLatin1Char('/') + m_currentAlbumFileName ), -1, KIO::Overwrite | KIO::HideProgressInfo ); connect( m_albumDownloadJob, &KJob::result, this, &MagnatuneAlbumDownloader::albumDownloadComplete ); @@ -71,7 +71,7 @@ msgText = i18n( "Downloading album from Magnatune.com" ); } - Amarok::Components::logger()->newProgressOperation( m_albumDownloadJob, msgText, this, SLOT(albumDownloadAborted()) ); + Amarok::Logger::newProgressOperation( m_albumDownloadJob, msgText, this, &MagnatuneAlbumDownloader::albumDownloadAborted ); } void @@ -89,24 +89,24 @@ if ( downloadJob != m_albumDownloadJob ) return ; //not the right job, so let's ignore it - const QString finalAlbumPath = m_currentAlbumUnpackLocation + '/' + m_currentAlbumInfo.artistName() + '/' + m_currentAlbumInfo.albumName(); + const QString finalAlbumPath = m_currentAlbumUnpackLocation + QLatin1Char('/') + m_currentAlbumInfo.artistName() + QLatin1Char('/') + m_currentAlbumInfo.albumName(); //ok, now we have the .zip file downloaded. All we need is to unpack it to the desired location and add it to the collection. - KZip kzip( m_tempDir->path() + '/' + m_currentAlbumFileName ); + KZip kzip( m_tempDir->path() + QLatin1Char('/') + m_currentAlbumFileName ); if ( !kzip.open( QIODevice::ReadOnly ) ) { - Amarok::Components::logger()->shortMessage( i18n( "Magnatune download seems to have failed. Cannot read zip file" ) ); - emit( downloadComplete( false ) ); + Amarok::Logger::shortMessage( i18n( "Magnatune download seems to have failed. Cannot read zip file" ) ); + Q_EMIT( downloadComplete( false ) ); return; } - debug() << m_tempDir->path() + '/' + m_currentAlbumFileName << " opened for decompression"; + debug() << m_tempDir->path() + QLatin1Char('/') + m_currentAlbumFileName << " opened for decompression"; const KArchiveDirectory * directory = kzip.directory(); - Amarok::Components::logger()->shortMessage( i18n( "Uncompressing Magnatune.com download..." ) ); + Amarok::Logger::shortMessage( i18n( "Uncompressing Magnatune.com download..." ) ); //Is this really blocking with no progress status!? Why is it not a KJob? @@ -130,9 +130,9 @@ connect( m_coverDownloadJob, &KJob::result, this, &MagnatuneAlbumDownloader::coverDownloadComplete ); - Amarok::Components::logger()->newProgressOperation( m_coverDownloadJob, i18n( "Adding album cover to collection" ), this, SLOT(coverAddAborted()) ); + Amarok::Logger::newProgressOperation( m_coverDownloadJob, i18n( "Adding album cover to collection" ), this, &MagnatuneAlbumDownloader::coverAddAborted ); - emit( downloadComplete( true ) ); + Q_EMIT( downloadComplete( true ) ); } void @@ -159,21 +159,21 @@ DEBUG_BLOCK m_albumDownloadJob->kill(); - m_albumDownloadJob = Q_NULLPTR; + m_albumDownloadJob = nullptr; debug() << "Aborted album download"; - emit( downloadComplete( false ) ); + Q_EMIT( downloadComplete( false ) ); } void MagnatuneAlbumDownloader::coverAddAborted() { DEBUG_BLOCK m_coverDownloadJob->kill(); - m_coverDownloadJob = Q_NULLPTR; + m_coverDownloadJob = nullptr; debug() << "Aborted cover download"; - emit( downloadComplete( false ) ); + Q_EMIT( downloadComplete( false ) ); } diff --git a/src/services/magnatune/MagnatuneCollectionLocation.h b/src/services/magnatune/MagnatuneCollectionLocation.h --- a/src/services/magnatune/MagnatuneCollectionLocation.h +++ b/src/services/magnatune/MagnatuneCollectionLocation.h @@ -30,11 +30,11 @@ class MagnatuneCollectionLocation : public ServiceCollectionLocation { public: - MagnatuneCollectionLocation( MagnatuneSqlCollection *parentCollection ); + explicit MagnatuneCollectionLocation( MagnatuneSqlCollection *parentCollection ); virtual ~MagnatuneCollectionLocation(); - virtual void showSourceDialog( const Meta::TrackList &tracks, bool removeSources ); + void showSourceDialog( const Meta::TrackList &tracks, bool removeSources ) override; }; diff --git a/src/services/magnatune/MagnatuneConfig.h b/src/services/magnatune/MagnatuneConfig.h --- a/src/services/magnatune/MagnatuneConfig.h +++ b/src/services/magnatune/MagnatuneConfig.h @@ -54,19 +54,19 @@ void setMembershipType( int membershipType ); QString membershipPrefix(); - QString email(); + QString email() const; void setEmail( const QString &email ); - QString username(); - QString password(); + QString username() const; + QString password() const; void setUsername( const QString &username ); void setPassword( const QString &password ); void setStreamType( int theValue ); int streamType() const; - qulonglong lastUpdateTimestamp(); + qulonglong lastUpdateTimestamp() const; void setLastUpdateTimestamp( qulonglong timestamp ); diff --git a/src/services/magnatune/MagnatuneConfig.cpp b/src/services/magnatune/MagnatuneConfig.cpp --- a/src/services/magnatune/MagnatuneConfig.cpp +++ b/src/services/magnatune/MagnatuneConfig.cpp @@ -39,7 +39,7 @@ // qDebug() << "load"; - KConfigGroup config = Amarok::config( "Service_Magnatune" ); + KConfigGroup config = Amarok::config( QStringLiteral("Service_Magnatune") ); m_isMember = config.readEntry( "isMember", false ); @@ -50,10 +50,10 @@ if( m_membershipType == -1 ) { //try to read the old style string version if that is present and valid. - QString oldMEmbershipType = config.readEntry( "membershipType", QString() ); - if( oldMEmbershipType.toLower() == "stream" ) + const QString oldMEmbershipType = config.readEntry( "membershipType", QString() ).toLower(); + if( oldMEmbershipType == QLatin1String("stream") ) m_membershipType = MagnatuneConfig::STREAM; - else if ( oldMEmbershipType.toLower() == "download" ) + else if ( oldMEmbershipType == QLatin1String("download") ) m_membershipType = MagnatuneConfig::DOWNLOAD; else m_membershipType = MagnatuneConfig::DOWNLOAD; @@ -68,13 +68,13 @@ qulonglong defaultLong = 0; m_lastUpdateTimestamp = config.readEntry( "lastUpdate", defaultLong ); - QString streamTypeString = config.readEntry( "streamType", QString() ); + const QString streamTypeString = config.readEntry( "streamType", QString() ); //make ogg the default - if ( streamTypeString == "mp3" ) + if ( streamTypeString == QLatin1String("mp3") ) m_streamType = MagnatuneMetaFactory::MP3; - else if ( streamTypeString == "lofi_mp3" ) + else if ( streamTypeString == QLatin1String("lofi_mp3") ) m_streamType = MagnatuneMetaFactory::LOFI; else m_streamType = MagnatuneMetaFactory::OGG; @@ -86,7 +86,7 @@ { qDebug() << "save"; if ( m_hasChanged ) { - KConfigGroup config = Amarok::config( "Service_Magnatune" ); + KConfigGroup config = Amarok::config( QStringLiteral("Service_Magnatune") ); config.writeEntry( "isMember", m_isMember ); config.writeEntry( "autoUpdateDatabase", m_autoUpdate ); @@ -98,11 +98,11 @@ QString streamTypeString; if ( m_streamType == MagnatuneMetaFactory::MP3 ) - streamTypeString = "mp3"; + streamTypeString = QStringLiteral("mp3"); else if ( m_streamType == MagnatuneMetaFactory::LOFI ) - streamTypeString = "lofi_mp3"; + streamTypeString = QStringLiteral("lofi_mp3"); else - streamTypeString = "ogg"; + streamTypeString = QStringLiteral("ogg"); config.writeEntry( "streamType", streamTypeString ); @@ -153,21 +153,21 @@ { QString prefix; if( m_membershipType == MagnatuneConfig::STREAM ) - prefix = "stream"; + prefix = QStringLiteral("stream"); else - prefix = "download"; + prefix = QStringLiteral("download"); return prefix; } QString -MagnatuneConfig::username() +MagnatuneConfig::username() const { return m_username; } QString -MagnatuneConfig::password() +MagnatuneConfig::password() const { return m_password; } @@ -202,7 +202,7 @@ qulonglong -MagnatuneConfig::lastUpdateTimestamp() +MagnatuneConfig::lastUpdateTimestamp() const { return m_lastUpdateTimestamp; } @@ -215,7 +215,7 @@ } QString -MagnatuneConfig::email() +MagnatuneConfig::email() const { return m_email; } diff --git a/src/services/magnatune/MagnatuneDatabaseHandler.cpp b/src/services/magnatune/MagnatuneDatabaseHandler.cpp --- a/src/services/magnatune/MagnatuneDatabaseHandler.cpp +++ b/src/services/magnatune/MagnatuneDatabaseHandler.cpp @@ -39,17 +39,17 @@ // create table containing tracks QString queryString = "CREATE TABLE magnatune_tracks (" - "id INTEGER PRIMARY KEY " + autoIncrement + ',' + - "name " + sqlDb->textColumnType() + ',' + + "id INTEGER PRIMARY KEY " + autoIncrement + QLatin1Char(',') + + "name " + sqlDb->textColumnType() + QLatin1Char(',') + "track_number INTEGER," "length INTEGER," "album_id INTEGER," "artist_id INTEGER," - "preview_lofi " + sqlDb->exactTextColumnType() + ',' + - "preview_ogg " + sqlDb->exactTextColumnType() + ',' + + "preview_lofi " + sqlDb->exactTextColumnType() + QLatin1Char(',') + + "preview_ogg " + sqlDb->exactTextColumnType() + QLatin1Char(',') + "preview_url " + sqlDb->exactTextColumnType() + ") ENGINE = MyISAM;"; - debug() << "Creating mangnatune_tracks: " << queryString; + debug() << "Creating magnatune_tracks: " << queryString; QStringList result = sqlDb->query( queryString ); @@ -59,15 +59,15 @@ //Create album table queryString = "CREATE TABLE magnatune_albums (" - "id INTEGER PRIMARY KEY " + autoIncrement + ',' + - "name " + sqlDb->textColumnType() + ',' + + "id INTEGER PRIMARY KEY " + autoIncrement + QLatin1Char(',') + + "name " + sqlDb->textColumnType() + QLatin1Char(',') + "year INTEGER," "artist_id INTEGER," - "album_code " + sqlDb->textColumnType() + ',' + - "cover_url " + sqlDb->exactTextColumnType() + ',' + + "album_code " + sqlDb->textColumnType() + QLatin1Char(',') + + "cover_url " + sqlDb->exactTextColumnType() + QLatin1Char(',') + "description " + sqlDb->exactTextColumnType() + ") ENGINE = MyISAM;"; - debug() << "Creating Mangnatune_albums: " << queryString; + debug() << "Creating Magnatune_albums: " << queryString; result = sqlDb->query( queryString ); @@ -77,22 +77,22 @@ //Create artist table queryString = "CREATE TABLE magnatune_artists (" - "id INTEGER PRIMARY KEY " + autoIncrement + ',' + - "name " + sqlDb->textColumnType() + ',' + - "artist_page " + sqlDb->exactTextColumnType() + ',' + - "description " + sqlDb->textColumnType() + ',' + + "id INTEGER PRIMARY KEY " + autoIncrement + QLatin1Char(',') + + "name " + sqlDb->textColumnType() + QLatin1Char(',') + + "artist_page " + sqlDb->exactTextColumnType() + QLatin1Char(',') + + "description " + sqlDb->textColumnType() + QLatin1Char(',') + "photo_url " + sqlDb->exactTextColumnType() + ") ENGINE = MyISAM;"; - debug() << "Creating mangnatune_artist: " << queryString; + debug() << "Creating magnatune_artist: " << queryString; result = sqlDb->query( queryString ); sqlDb->query( "CREATE INDEX magnatune_artists_name ON magnatune_artists(name);" ); //create genre table queryString = "CREATE TABLE magnatune_genre (" - "id INTEGER PRIMARY KEY " + autoIncrement + ',' + - "name " + sqlDb->textColumnType() + ',' + + "id INTEGER PRIMARY KEY " + autoIncrement + QLatin1Char(',') + + "name " + sqlDb->textColumnType() + QLatin1Char(',') + "album_id INTEGER" + ") ENGINE = MyISAM;"; result = sqlDb->query( queryString ); @@ -103,11 +103,11 @@ //create moods table queryString = "CREATE TABLE magnatune_moods (" - "id INTEGER PRIMARY KEY " + autoIncrement + ',' + + "id INTEGER PRIMARY KEY " + autoIncrement + QLatin1Char(',') + "track_id INTEGER," + "mood " + sqlDb->textColumnType() + ") ENGINE = MyISAM;"; - debug() << "Creating mangnatune_moods: " << queryString; + debug() << "Creating magnatune_moods: " << queryString; result = sqlDb->query( queryString ); @@ -164,7 +164,7 @@ // debug() << "Adding Magnatune track " << queryString; - int trackId = sqlDb->insert( queryString, NULL ); + int trackId = sqlDb->insert( queryString, nullptr ); return trackId; @@ -249,7 +249,7 @@ //debug() << "Adding Magnatune mood: " << queryString; - sqlDb->insert( queryString, NULL ); + sqlDb->insert( queryString, nullptr ); } } diff --git a/src/services/magnatune/MagnatuneDatabaseWorker.h b/src/services/magnatune/MagnatuneDatabaseWorker.h --- a/src/services/magnatune/MagnatuneDatabaseWorker.h +++ b/src/services/magnatune/MagnatuneDatabaseWorker.h @@ -24,7 +24,7 @@ #include /** -A small helper class to do some simple asynchroneous database queries +A small helper class to do some simple asynchronous database queries @author Nikolaj Hald Nielsen */ @@ -37,7 +37,7 @@ ~MagnatuneDatabaseWorker(); - void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) Q_DECL_OVERRIDE; + void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) override; void fetchMoodMap(); void fetchTrackswithMood( const QString &mood, int noOfTracks, ServiceSqlRegistry * registry ); @@ -52,8 +52,8 @@ * This signal is emitted when success() returns false after the job is executed. */ void failed(ThreadWeaver::JobPointer); - void gotMoodMap( QMap map ); - void gotMoodyTracks( Meta::TrackList tracks ); + void gotMoodMap( const QMap &map ); + void gotMoodyTracks( const Meta::TrackList &tracks ); void gotAlbumBySku( Meta::MagnatuneAlbum * album ); private Q_SLOTS: @@ -80,8 +80,8 @@ ServiceSqlRegistry * m_registry; protected: - void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; - void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; + void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; + void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; }; #endif diff --git a/src/services/magnatune/MagnatuneDatabaseWorker.cpp b/src/services/magnatune/MagnatuneDatabaseWorker.cpp --- a/src/services/magnatune/MagnatuneDatabaseWorker.cpp +++ b/src/services/magnatune/MagnatuneDatabaseWorker.cpp @@ -77,13 +77,13 @@ DEBUG_BLOCK switch ( m_task ) { case FETCH_MODS: - emit( gotMoodMap( m_moodMap ) ); + Q_EMIT( gotMoodMap( m_moodMap ) ); break; case FETCH_MOODY_TRACKS: - emit( gotMoodyTracks( m_moodyTracks ) ); + Q_EMIT( gotMoodyTracks( m_moodyTracks ) ); break; case ALBUM_BY_SKU: - emit( gotAlbumBySku( m_album ) ); + Q_EMIT( gotAlbumBySku( m_album ) ); break; default: break; @@ -156,9 +156,9 @@ QString queryString = "SELECT DISTINCT "; - queryString += m_registry->factory()->getTrackSqlRows() + ',' + - m_registry->factory()->getAlbumSqlRows() + ',' + - m_registry->factory()->getArtistSqlRows() + ',' + + queryString += m_registry->factory()->getTrackSqlRows() + QLatin1Char(',') + + m_registry->factory()->getAlbumSqlRows() + QLatin1Char(',') + + m_registry->factory()->getArtistSqlRows() + QLatin1Char(',') + m_registry->factory()->getGenreSqlRows(); queryString += " FROM magnatune_tracks LEFT JOIN magnatune_albums ON magnatune_tracks.album_id = magnatune_albums.id LEFT JOIN magnatune_artists ON magnatune_albums.artist_id = magnatune_artists.id LEFT JOIN magnatune_genre ON magnatune_genre.album_id = magnatune_albums.id"; diff --git a/src/services/magnatune/MagnatuneDownloadDialog.h b/src/services/magnatune/MagnatuneDownloadDialog.h --- a/src/services/magnatune/MagnatuneDownloadDialog.h +++ b/src/services/magnatune/MagnatuneDownloadDialog.h @@ -38,7 +38,7 @@ * @param parent Pointer to the parent QWidget. * @param fl Additional dialog flags. */ - explicit MagnatuneDownloadDialog( QWidget* parent = 0, Qt::WindowFlags fl = 0 ); + explicit MagnatuneDownloadDialog( QWidget* parent = nullptr, Qt::WindowFlags fl = 0 ); /** * Destructor @@ -51,16 +51,16 @@ * @param info The MagnatuneDownloadInfo class containing the information abut the * download to display */ - void setDownloadInfo( MagnatuneDownloadInfo info ); + void setDownloadInfo(const MagnatuneDownloadInfo &info ); Q_SIGNALS: /** * Signal emitted when all needed info has been gathered and handler * should start album download. * @param completedInfo A DownloadInfo object containing all needed information */ - void downloadAlbum( MagnatuneDownloadInfo completedInfo ); + void downloadAlbum( const MagnatuneDownloadInfo &completedInfo ); public Q_SLOTS: /*$PUBLIC_SLOTS$*/ @@ -72,7 +72,7 @@ protected Q_SLOTS: /*$PROTECTED_SLOTS$*/ /** - * Slot for recieving notification when the download button is clicked. + * Slot for receiving notification when the download button is clicked. */ void downloadButtonClicked(); diff --git a/src/services/magnatune/MagnatuneDownloadDialog.cpp b/src/services/magnatune/MagnatuneDownloadDialog.cpp --- a/src/services/magnatune/MagnatuneDownloadDialog.cpp +++ b/src/services/magnatune/MagnatuneDownloadDialog.cpp @@ -54,22 +54,20 @@ QUrl unpackLocation = downloadTargetURLRequester->url(); m_currentDownloadInfo.setUnpackUrl( unpackLocation.path() ); - emit( downloadAlbum( m_currentDownloadInfo ) ); + Q_EMIT( downloadAlbum( m_currentDownloadInfo ) ); close(); } -void MagnatuneDownloadDialog::setDownloadInfo( MagnatuneDownloadInfo info ) +void MagnatuneDownloadDialog::setDownloadInfo( const MagnatuneDownloadInfo &info ) { m_currentDownloadInfo = info; DownloadFormatMap formatMap = info.formatMap(); - DownloadFormatMap::Iterator it; - - for ( it = formatMap.begin(); it != formatMap.end(); ++it ) + for (DownloadFormatMap::Iterator it = formatMap.begin(), total = formatMap.end(); it != total; ++it ) { formatComboBox->addItem( it.key() ); } diff --git a/src/services/magnatune/MagnatuneDownloadHandler.h b/src/services/magnatune/MagnatuneDownloadHandler.h --- a/src/services/magnatune/MagnatuneDownloadHandler.h +++ b/src/services/magnatune/MagnatuneDownloadHandler.h @@ -27,7 +27,7 @@ /** -The main class responcible for handling of downloads from Magnatune.com +The main class responsible for handling of downloads from Magnatune.com @author Nikolaj Hald Nielsen */ @@ -69,7 +69,7 @@ * or acquire an album in a different file format. Note that no personal information * or credit card number is stored. The information is saved to the amarok config * directory in the sub folder magnatune.com/purchases. The name of each info file - * is genereated from the artist and album names. + * is generated from the artist and album names. * @param infoXml The info to store. */ void saveDownloadInfo(const QString &infoXml); diff --git a/src/services/magnatune/MagnatuneDownloadHandler.cpp b/src/services/magnatune/MagnatuneDownloadHandler.cpp --- a/src/services/magnatune/MagnatuneDownloadHandler.cpp +++ b/src/services/magnatune/MagnatuneDownloadHandler.cpp @@ -16,7 +16,7 @@ #include "MagnatuneDownloadHandler.h" -#include "core/interfaces/Logger.h" +#include "core/logger/Logger.h" #include "core/support/Amarok.h" #include "core/support/Components.h" #include "core/support/Debug.h" @@ -34,9 +34,9 @@ MagnatuneDownloadHandler::MagnatuneDownloadHandler() : QObject() - , m_downloadDialog( 0 ) - , m_albumDownloader( 0 ) - , m_currentAlbum( 0 ) + , m_downloadDialog( nullptr ) + , m_albumDownloader( nullptr ) + , m_currentAlbum( nullptr ) , m_membershipDownload( false ) { } @@ -79,7 +79,7 @@ m_membershipDownload = true; m_resultDownloadJob = KIO::storedGet( purchaseURL, KIO::NoReload, KIO::HideProgressInfo ); - Amarok::Components::logger()->newProgressOperation( m_resultDownloadJob, + Amarok::Logger::newProgressOperation( m_resultDownloadJob, i18n( "Processing download" ) ); connect( m_resultDownloadJob, &KJob::result, this, &MagnatuneDownloadHandler::xmlDownloadComplete ); } @@ -106,13 +106,13 @@ debug() << endl << endl << "result: " << resultXml; - if ( m_albumDownloader == 0 ) + if ( !m_albumDownloader ) { m_albumDownloader = new MagnatuneAlbumDownloader(); connect( m_albumDownloader, &MagnatuneAlbumDownloader::downloadComplete, this, &MagnatuneDownloadHandler::albumDownloadComplete ); } - if ( m_downloadDialog == 0 ) + if ( !m_downloadDialog ) { m_downloadDialog = new MagnatuneDownloadDialog( m_parent ); m_downloadDialog->setModal( true ); @@ -173,7 +173,7 @@ QString fileName = m_currentAlbum->albumArtist()->name() + " - " + m_currentAlbum->name(); - QFile file( purchaseDir.absolutePath() + '/' + fileName ); + QFile file( purchaseDir.absolutePath() + QLatin1Char('/') + fileName ); //Skip if file already exists if ( file.exists () ) @@ -195,9 +195,9 @@ debug() << "MagnatuneDownloadHandler::albumDownloadComplete"; delete m_downloadDialog; - m_downloadDialog = 0; + m_downloadDialog = nullptr; - emit( downloadCompleted( success ) ); + Q_EMIT( downloadCompleted( success ) ); } diff --git a/src/services/magnatune/MagnatuneDownloadInfo.h b/src/services/magnatune/MagnatuneDownloadInfo.h --- a/src/services/magnatune/MagnatuneDownloadInfo.h +++ b/src/services/magnatune/MagnatuneDownloadInfo.h @@ -40,17 +40,14 @@ bool initFromRedownloadXml( const QDomElement &element ); void setMembershipInfo( const QString &username, const QString &password ); - bool isMembershipDownload(); + bool isMembershipDownload() const; - DownloadFormatMap formatMap(); - QString userName(); - QString password(); - QString downloadMessage(); - QString albumCode(); + DownloadFormatMap formatMap() const; + QString userName() const; + QString password() const; + QString downloadMessage() const; + QString albumCode() const; - QString albumName(); - QString artistName(); - QString coverUrl(); const QString albumName() const; const QString artistName() const; const QString coverUrl() const; @@ -63,7 +60,7 @@ void setAlbumCode( const QString & albumCode ); bool isReadyForDownload(); QUrl completeDownloadUrl(); - QString unpackLocation(); + QString unpackLocation() const; diff --git a/src/services/magnatune/MagnatuneDownloadInfo.cpp b/src/services/magnatune/MagnatuneDownloadInfo.cpp --- a/src/services/magnatune/MagnatuneDownloadInfo.cpp +++ b/src/services/magnatune/MagnatuneDownloadInfo.cpp @@ -46,7 +46,7 @@ if ( testIndex == -1 ) { return false; - }; + } int startIndex; int endIndex; @@ -214,25 +214,25 @@ } QString -MagnatuneDownloadInfo::userName( ) +MagnatuneDownloadInfo::userName( ) const { return m_userName; } QString -MagnatuneDownloadInfo::password( ) +MagnatuneDownloadInfo::password( ) const { return m_password; } QString -MagnatuneDownloadInfo::downloadMessage( ) +MagnatuneDownloadInfo::downloadMessage( ) const { return m_downloadMessage; } DownloadFormatMap -MagnatuneDownloadInfo::formatMap() +MagnatuneDownloadInfo::formatMap() const { return m_downloadFormats; } @@ -267,15 +267,15 @@ } QString -MagnatuneDownloadInfo::unpackLocation( ) +MagnatuneDownloadInfo::unpackLocation( ) const { return m_unpackUrl; } QString -MagnatuneDownloadInfo::albumCode() +MagnatuneDownloadInfo::albumCode() const { return m_albumCode; } @@ -289,7 +289,7 @@ } bool -MagnatuneDownloadInfo::isMembershipDownload() +MagnatuneDownloadInfo::isMembershipDownload() const { return m_membershipDownload; } @@ -301,36 +301,19 @@ m_password = password; } -QString -MagnatuneDownloadInfo::albumName() -{ - return m_albumName; -} const QString MagnatuneDownloadInfo::albumName() const { return m_albumName; } -QString -MagnatuneDownloadInfo::artistName() -{ - return m_artistName; -} - const QString MagnatuneDownloadInfo::artistName() const { return m_artistName; } -QString -MagnatuneDownloadInfo::coverUrl() -{ - return m_coverUrl; -} - const QString MagnatuneDownloadInfo::coverUrl() const { diff --git a/src/services/magnatune/MagnatuneInfoParser.h b/src/services/magnatune/MagnatuneInfoParser.h --- a/src/services/magnatune/MagnatuneInfoParser.h +++ b/src/services/magnatune/MagnatuneInfoParser.h @@ -24,7 +24,6 @@ #include #include -class MagnatuneStore; /** Handles the fetching and processing of Jamendo specific information for meta items @@ -39,13 +38,13 @@ MagnatuneInfoParser() : InfoParserBase() {} - ~MagnatuneInfoParser() {} + ~MagnatuneInfoParser() override {} - virtual void getInfo( Meta::ArtistPtr artist ); - virtual void getInfo( Meta::AlbumPtr album ); - virtual void getInfo( Meta::TrackPtr track ); + void getInfo( const Meta::ArtistPtr &artist ) override; + void getInfo( const Meta::AlbumPtr &album ) override; + void getInfo( const Meta::TrackPtr &track ) override; void getFrontPage(); void getFavoritesPage(); diff --git a/src/services/magnatune/MagnatuneInfoParser.cpp b/src/services/magnatune/MagnatuneInfoParser.cpp --- a/src/services/magnatune/MagnatuneInfoParser.cpp +++ b/src/services/magnatune/MagnatuneInfoParser.cpp @@ -17,34 +17,34 @@ #include "MagnatuneInfoParser.h" #include "core/support/Components.h" -#include "core/interfaces/Logger.h" +#include "core/logger/Logger.h" #include "MagnatuneConfig.h" #include using namespace Meta; -void MagnatuneInfoParser::getInfo(ArtistPtr artist) +void MagnatuneInfoParser::getInfo(const ArtistPtr &artist) { showLoading( i18n( "Loading artist info..." ) ); MagnatuneArtist * magnatuneArtist = dynamic_cast( artist.data() ); - if ( magnatuneArtist == 0) return; + if ( !magnatuneArtist ) return; // first get the entire artist html page /* QString tempFile; QString orgHtml;*/ m_infoDownloadJob = KIO::storedGet( magnatuneArtist->magnatuneUrl(), KIO::Reload, KIO::HideProgressInfo ); - Amarok::Components::logger()->newProgressOperation( m_infoDownloadJob, i18n( "Fetching %1 Artist Info", magnatuneArtist->prettyName() ) ); + Amarok::Logger::newProgressOperation( m_infoDownloadJob, i18n( "Fetching %1 Artist Info", magnatuneArtist->prettyName() ) ); connect( m_infoDownloadJob, &KJob::result, this, &MagnatuneInfoParser::artistInfoDownloadComplete ); } -void MagnatuneInfoParser::getInfo(AlbumPtr album) +void MagnatuneInfoParser::getInfo(const AlbumPtr &album) { showLoading( i18n( "Loading album info..." ) ); @@ -81,10 +81,10 @@ infoHtml += "



" + i18n( "From Magnatune.com" ) + ""; infoHtml += ""; - emit ( info( infoHtml ) ); + Q_EMIT ( info( infoHtml ) ); } -void MagnatuneInfoParser::getInfo(TrackPtr track) +void MagnatuneInfoParser::getInfo(const TrackPtr &track) { Q_UNUSED( track ); return; @@ -113,7 +113,7 @@ //debug() << "html: " << trimmedInfo; - emit ( info( infoString ) ); + Q_EMIT ( info( infoString ) ); } @@ -156,14 +156,14 @@ if( !m_cachedFrontpage.isEmpty() ) { - emit ( info( m_cachedFrontpage ) ); + Q_EMIT ( info( m_cachedFrontpage ) ); return; } showLoading( i18n( "Loading Magnatune.com frontpage..." ) ); m_pageDownloadJob = KIO::storedGet( QUrl("http://magnatune.com/amarok_frontpage.html"), KIO::Reload, KIO::HideProgressInfo ); - Amarok::Components::logger()->newProgressOperation( m_pageDownloadJob, i18n( "Fetching Magnatune.com front page" ) ); + Amarok::Logger::newProgressOperation( m_pageDownloadJob, i18n( "Fetching Magnatune.com front page" ) ); connect( m_pageDownloadJob, &KJob::result, this, &MagnatuneInfoParser::frontpageDownloadComplete ); } @@ -188,7 +188,7 @@ QUrl url = QUrl::fromUserInput( "http://" + user + ":" + password + "@" + type.toLower() + ".magnatune.com/member/amarok_favorites.php" ); m_pageDownloadJob = KIO::storedGet( url, KIO::Reload, KIO::HideProgressInfo ); - Amarok::Components::logger()->newProgressOperation( m_pageDownloadJob, i18n( "Loading your Magnatune.com favorites page..." ) ); + Amarok::Logger::newProgressOperation( m_pageDownloadJob, i18n( "Loading your Magnatune.com favorites page..." ) ); connect( m_pageDownloadJob, &KJob::result, this, &MagnatuneInfoParser::userPageDownloadComplete ); } @@ -213,7 +213,7 @@ QUrl url = QUrl::fromUserInput( "http://" + user + ":" + password + "@" + type.toLower() + ".magnatune.com/member/amarok_recommendations.php" ); m_pageDownloadJob = KIO::storedGet( url, KIO::Reload, KIO::HideProgressInfo ); - Amarok::Components::logger()->newProgressOperation( m_pageDownloadJob, i18n( "Loading your personal Magnatune.com recommendations page..." ) ); + Amarok::Logger::newProgressOperation( m_pageDownloadJob, i18n( "Loading your personal Magnatune.com recommendations page..." ) ); connect( m_pageDownloadJob, &KJob::result, this, &MagnatuneInfoParser::userPageDownloadComplete ); } @@ -240,12 +240,12 @@ if( m_cachedFrontpage.isEmpty() ) m_cachedFrontpage = infoString; - emit ( info( infoString ) ); + Q_EMIT ( info( infoString ) ); } void MagnatuneInfoParser::userPageDownloadComplete( KJob * downLoadJob ) { - if ( !downLoadJob->error() == 0 ) + if ( downLoadJob->error() ) { //TODO: error handling here return ; @@ -265,7 +265,7 @@ //make sure that any pages that use the old command name "service_magnatune" replaces it with "service-magnatune" infoString.replace( "service_magnatune", "service-magnatune" ); - emit ( info( infoString ) ); + Q_EMIT ( info( infoString ) ); } @@ -302,7 +302,7 @@ QString returnPage = page; - int startTokenLength = QString( "" ).length(); + int startTokenLength = QStringLiteral( "" ).length(); int offset = 0; int startTokenIndex = page.indexOf( "", offset ); diff --git a/src/services/magnatune/MagnatuneMeta.h b/src/services/magnatune/MagnatuneMeta.h --- a/src/services/magnatune/MagnatuneMeta.h +++ b/src/services/magnatune/MagnatuneMeta.h @@ -26,7 +26,6 @@ #include #include -class MagnatuneAlbumCoverDownloader; class MagnatuneStore; namespace Meta @@ -36,29 +35,29 @@ { Q_OBJECT public: - MagnatuneTrack( const QString &name ); - MagnatuneTrack( const QStringList &resultRow ); + explicit MagnatuneTrack( const QString &name ); + explicit MagnatuneTrack( const QStringList &resultRow ); QString lofiUrl(); void setLofiUrl( const QString &url ); - QList moods(); - void setMoods( QList moods ); + QList moods() const; + void setMoods( const QList &moods ); void setDownloadMembership(); - virtual QString sourceName(); - virtual QString sourceDescription(); - virtual QPixmap emblem(); + QString sourceName() override; + QString sourceDescription() override; + QPixmap emblem() override; - virtual bool isBookmarkable() const { return true; } - virtual QString collectionName() const { return "Magnatune.com"; } - virtual bool simpleFiltering() const { return false; } + bool isBookmarkable() const override { return true; } + QString collectionName() const override { return QStringLiteral("Magnatune.com"); } + bool simpleFiltering() const override { return false; } void setOggUrl( const QString& url ); QString oggUrl() const; - void setAlbumPtr( Meta::AlbumPtr album ); + void setAlbumPtr( const Meta::AlbumPtr &album ) override; public Q_SLOTS: void download(); @@ -79,18 +78,18 @@ QUrl m_magnatuneUrl; public: - MagnatuneArtist( const QString &name ); - MagnatuneArtist( const QStringList &resultRow ); + explicit MagnatuneArtist( const QString &name ); + explicit MagnatuneArtist( const QStringList &resultRow ); void setPhotoUrl( const QUrl &photoUrl ); QUrl photoUrl() const; void setMagnatuneUrl( const QUrl &url ); QUrl magnatuneUrl() const; - virtual bool isBookmarkable() const { return true; } - virtual QString collectionName() const { return "Magnatune.com"; } - virtual bool simpleFiltering() const { return false; } + bool isBookmarkable() const override { return true; } + QString collectionName() const override { return QStringLiteral("Magnatune.com"); } + bool simpleFiltering() const override { return false; } }; class MagnatuneAlbum : public ServiceAlbumWithCover @@ -105,20 +104,20 @@ public: - MagnatuneAlbum( const QString &name ); - MagnatuneAlbum( const QStringList &resultRow ); + explicit MagnatuneAlbum( const QString &name ); + explicit MagnatuneAlbum( const QStringList &resultRow ); ~MagnatuneAlbum(); - virtual QString downloadPrefix() const { return "magnatune"; } + QString downloadPrefix() const override { return QStringLiteral("magnatune"); } void setLaunchYear( int launchYear ); int launchYear() const; - virtual void setCoverUrl( const QString &coverUrl ); - virtual QString coverUrl() const; + void setCoverUrl( const QString &coverUrl ) override; + QString coverUrl() const override; - virtual QUrl imageLocation( int size = 1 ) { Q_UNUSED( size ); return QUrl( coverUrl() ); } + QUrl imageLocation( int size = 1 ) override { Q_UNUSED( size ); return QUrl( coverUrl() ); } void setAlbumCode( const QString &albumCode ); QString albumCode(); @@ -128,9 +127,9 @@ void setDownloadMembership(); - virtual bool isBookmarkable() const { return true; } - virtual QString collectionName() const { return "Magnatune.com"; } - virtual bool simpleFiltering() const { return false; } + bool isBookmarkable() const override { return true; } + QString collectionName() const override { return QStringLiteral("Magnatune.com"); } + bool simpleFiltering() const override { return false; } public Q_SLOTS: void download(); @@ -141,12 +140,12 @@ { public: - MagnatuneGenre( const QString &name ); - MagnatuneGenre( const QStringList &resultRow ); + explicit MagnatuneGenre( const QString &name ); + explicit MagnatuneGenre( const QStringList &resultRow ); - virtual bool isBookmarkable() const { return true; } - virtual QString collectionName() const { return "Magnatune.com"; } - virtual bool simpleFiltering() const { return false; } + bool isBookmarkable() const override { return true; } + QString collectionName() const override { return QStringLiteral("Magnatune.com"); } + bool simpleFiltering() const override { return false; } }; } @@ -160,21 +159,21 @@ MagnatuneMetaFactory( const QString &dbPrefix, MagnatuneStore * store ); virtual ~MagnatuneMetaFactory() {} - virtual int getTrackSqlRowCount(); - virtual QString getTrackSqlRows(); - virtual Meta::TrackPtr createTrack( const QStringList &rows ); + int getTrackSqlRowCount() override; + QString getTrackSqlRows() override; + Meta::TrackPtr createTrack( const QStringList &rows ) override; - virtual int getAlbumSqlRowCount(); - virtual QString getAlbumSqlRows(); - virtual Meta::AlbumPtr createAlbum( const QStringList &rows ); + int getAlbumSqlRowCount() override; + QString getAlbumSqlRows() override; + Meta::AlbumPtr createAlbum( const QStringList &rows ) override; - virtual int getArtistSqlRowCount(); - virtual QString getArtistSqlRows(); - virtual Meta::ArtistPtr createArtist( const QStringList &rows ); + int getArtistSqlRowCount() override; + QString getArtistSqlRows() override; + Meta::ArtistPtr createArtist( const QStringList &rows ) override; //virtual int getGenreSqlRowCount(); //virtual QString getGenreSqlRows(); - virtual Meta::GenrePtr createGenre( const QStringList &rows ); + Meta::GenrePtr createGenre( const QStringList &rows ) override; //stuff for supporting the new membership services at Magnatune.com diff --git a/src/services/magnatune/MagnatuneMeta.cpp b/src/services/magnatune/MagnatuneMeta.cpp --- a/src/services/magnatune/MagnatuneMeta.cpp +++ b/src/services/magnatune/MagnatuneMeta.cpp @@ -221,12 +221,12 @@ } -QList< QString > Meta::MagnatuneTrack::moods() +QList< QString > Meta::MagnatuneTrack::moods() const { return m_moods; } -void Meta::MagnatuneTrack::setMoods(QList< QString > moods) +void Meta::MagnatuneTrack::setMoods(const QList &moods) { m_moods = moods; } @@ -239,11 +239,11 @@ mAlbum->store()->downloadTrack( this ); } -void Meta::MagnatuneTrack::setAlbumPtr( Meta::AlbumPtr album ) +void Meta::MagnatuneTrack::setAlbumPtr(const AlbumPtr &album ) { ServiceTrack::setAlbumPtr( album ); - //get year from magnatue album: + //get year from magnatune album: MagnatuneAlbum * ma = dynamic_cast( album.data() ); if ( ma ) { diff --git a/src/services/magnatune/MagnatuneNeedUpdateWidget.h b/src/services/magnatune/MagnatuneNeedUpdateWidget.h --- a/src/services/magnatune/MagnatuneNeedUpdateWidget.h +++ b/src/services/magnatune/MagnatuneNeedUpdateWidget.h @@ -25,7 +25,8 @@ { Q_OBJECT public: - explicit MagnatuneNeedUpdateWidget(QWidget *parent = 0); + explicit MagnatuneNeedUpdateWidget(QWidget *parent = nullptr); + ~MagnatuneNeedUpdateWidget(); protected: Ui::MagnatuneNeedUpdateWidget* ui; diff --git a/src/services/magnatune/MagnatuneNeedUpdateWidget.cpp b/src/services/magnatune/MagnatuneNeedUpdateWidget.cpp --- a/src/services/magnatune/MagnatuneNeedUpdateWidget.cpp +++ b/src/services/magnatune/MagnatuneNeedUpdateWidget.cpp @@ -30,7 +30,12 @@ connect(ui->autoUpdate, &QCheckBox::stateChanged, this, &MagnatuneNeedUpdateWidget::saveSettings ); ui->autoUpdate->setCheckState( MagnatuneConfig().autoUpdateDatabase()? - Qt::Checked : Qt::Unchecked ); + Qt::Checked : Qt::Unchecked ); +} + +MagnatuneNeedUpdateWidget::~MagnatuneNeedUpdateWidget() +{ + delete ui; } void @@ -49,7 +54,7 @@ MagnatuneNeedUpdateWidget::startUpdate() { disable(); - emit wantUpdate(); + Q_EMIT wantUpdate(); } void diff --git a/src/services/magnatune/MagnatuneRedownloadDialog.h b/src/services/magnatune/MagnatuneRedownloadDialog.h --- a/src/services/magnatune/MagnatuneRedownloadDialog.h +++ b/src/services/magnatune/MagnatuneRedownloadDialog.h @@ -28,17 +28,17 @@ Q_OBJECT public: - explicit MagnatuneRedownloadDialog( QWidget* parent = 0, const char* name = 0, bool modal = false, Qt::WindowFlags fl = 0 ); + explicit MagnatuneRedownloadDialog( QWidget* parent = nullptr, const char* name = 0, bool modal = false, Qt::WindowFlags fl = 0 ); ~MagnatuneRedownloadDialog(); /*$PUBLIC_FUNCTIONS$*/ void setRedownloadItems( const QStringList &items ); - void setRedownloadItems( QList previousPurchases ); + void setRedownloadItems(const QList &previousPurchases ); Q_SIGNALS: // void redownload( const QString &downloadInfoFileName ); - void redownload( MagnatuneDownloadInfo info ); + void redownload( const MagnatuneDownloadInfo &info ); void cancelled(); public Q_SLOTS: @@ -51,7 +51,7 @@ /*$PROTECTED_SLOTS$*/ void slotRedownload(); void selectionChanged(); - void reject(); + void reject() override; }; diff --git a/src/services/magnatune/MagnatuneRedownloadDialog.cpp b/src/services/magnatune/MagnatuneRedownloadDialog.cpp --- a/src/services/magnatune/MagnatuneRedownloadDialog.cpp +++ b/src/services/magnatune/MagnatuneRedownloadDialog.cpp @@ -43,16 +43,16 @@ QStringListIterator it(items); while ( it.hasNext() ) { - QString currentItem = it.next(); + const QString currentItem = it.next(); debug() << "Adding item to redownload dialog: " << currentItem; redownloadListView->addTopLevelItem( new QTreeWidgetItem( QStringList(currentItem) ) ); } debug() << "Nothing more to add..."; } -void MagnatuneRedownloadDialog::setRedownloadItems( QList previousPurchases ) +void MagnatuneRedownloadDialog::setRedownloadItems( const QList &previousPurchases ) { m_infoMap.clear(); @@ -72,23 +72,23 @@ QTreeWidgetItem * current = redownloadListView->currentItem(); if ( m_infoMap.keys().contains( current ) ) { - emit( redownload( m_infoMap.value( current ) ) ); + Q_EMIT( redownload( m_infoMap.value( current ) ) ); } - //emit ( redownload( redownloadListView->currentItem()->text( 0 ) ) ); + //Q_EMIT ( redownload( redownloadListView->currentItem()->text( 0 ) ) ); hide(); } void MagnatuneRedownloadDialog::reject( ) { hide(); - emit(cancelled()); + Q_EMIT(cancelled()); } void MagnatuneRedownloadDialog::selectionChanged( ) { - if (redownloadListView->currentItem() != 0) { + if (redownloadListView->currentItem()) { redownloadButton->setEnabled ( true ); } else { redownloadButton->setEnabled ( false ); diff --git a/src/services/magnatune/MagnatuneRedownloadHandler.h b/src/services/magnatune/MagnatuneRedownloadHandler.h --- a/src/services/magnatune/MagnatuneRedownloadHandler.h +++ b/src/services/magnatune/MagnatuneRedownloadHandler.h @@ -34,7 +34,7 @@ { Q_OBJECT public: - MagnatuneRedownloadHandler(QWidget * parent); + explicit MagnatuneRedownloadHandler(QWidget * parent); ~MagnatuneRedownloadHandler(); @@ -67,7 +67,7 @@ protected Q_SLOTS: - void redownload( MagnatuneDownloadInfo info ); + void redownload(const MagnatuneDownloadInfo &info ); void selectionDialogCancelled(); void albumDownloadComplete( bool success ); void redownloadApiResult( KJob* job ); diff --git a/src/services/magnatune/MagnatuneRedownloadHandler.cpp b/src/services/magnatune/MagnatuneRedownloadHandler.cpp --- a/src/services/magnatune/MagnatuneRedownloadHandler.cpp +++ b/src/services/magnatune/MagnatuneRedownloadHandler.cpp @@ -20,7 +20,7 @@ #include "core/support/Amarok.h" #include "core/support/Debug.h" #include "core/support/Components.h" -#include "core/interfaces/Logger.h" +#include "core/logger/Logger.h" #include #include @@ -78,17 +78,17 @@ } -void MagnatuneRedownloadHandler::redownload( MagnatuneDownloadInfo info ) +void MagnatuneRedownloadHandler::redownload( const MagnatuneDownloadInfo &info ) { - if ( m_albumDownloader == 0 ) + if ( m_albumDownloader == nullptr ) { m_albumDownloader = new MagnatuneAlbumDownloader(); connect( m_albumDownloader, &MagnatuneAlbumDownloader::downloadComplete, this, &MagnatuneRedownloadHandler::albumDownloadComplete ); } - if ( m_downloadDialog == 0 ) + if ( m_downloadDialog == nullptr ) { m_downloadDialog = new MagnatuneDownloadDialog(m_parent); connect( m_downloadDialog, &MagnatuneDownloadDialog::downloadAlbum, m_albumDownloader, &MagnatuneAlbumDownloader::downloadAlbum ); @@ -102,10 +102,10 @@ void MagnatuneRedownloadHandler::selectionDialogCancelled( ) { - if (m_redownloadDialog != 0) { + if (m_redownloadDialog != nullptr) { m_redownloadDialog->hide(); delete m_redownloadDialog; - m_redownloadDialog = 0; + m_redownloadDialog = nullptr; } } @@ -115,13 +115,13 @@ Q_UNUSED( success ); //cleanup time! - if (m_downloadDialog != 0) { + if (m_downloadDialog != nullptr) { delete m_downloadDialog; - m_downloadDialog = 0; + m_downloadDialog = nullptr; } - if (m_albumDownloader != 0) { + if (m_albumDownloader != nullptr) { delete m_albumDownloader; - m_albumDownloader = 0; + m_albumDownloader = nullptr; } } @@ -146,7 +146,7 @@ QUrl redownloadApiUrl = QUrl::fromUserInput( "http://magnatune.com/buy/redownload_xml?email=" + email ); m_redownloadApiJob = KIO::storedGet( redownloadApiUrl, KIO::NoReload, KIO::HideProgressInfo ); - Amarok::Components::logger()->newProgressOperation( m_redownloadApiJob, i18n( "Getting list of previous Magnatune.com purchases" ) ); + Amarok::Logger::newProgressOperation( m_redownloadApiJob, i18n( "Getting list of previous Magnatune.com purchases" ) ); connect( m_redownloadApiJob, &KIO::TransferJob::result, this, &MagnatuneRedownloadHandler::redownloadApiResult ); } diff --git a/src/services/magnatune/MagnatuneSettingsModule.h b/src/services/magnatune/MagnatuneSettingsModule.h --- a/src/services/magnatune/MagnatuneSettingsModule.h +++ b/src/services/magnatune/MagnatuneSettingsModule.h @@ -32,13 +32,13 @@ { Q_OBJECT public: - explicit MagnatuneSettingsModule( QWidget *parent = 0, const QVariantList &args = QVariantList() ); + explicit MagnatuneSettingsModule( QWidget *parent = nullptr, const QVariantList &args = QVariantList() ); ~MagnatuneSettingsModule(); - virtual void save(); - virtual void load(); - virtual void defaults(); + void save() override; + void load() override; + void defaults() override; private Q_SLOTS: diff --git a/src/services/magnatune/MagnatuneSettingsModule.cpp b/src/services/magnatune/MagnatuneSettingsModule.cpp --- a/src/services/magnatune/MagnatuneSettingsModule.cpp +++ b/src/services/magnatune/MagnatuneSettingsModule.cpp @@ -66,7 +66,6 @@ m_config.setEmail( m_configDialog->emailEdit->text() ); - QString streamTypeString = m_configDialog->streamTypeComboBox->currentText(); m_config.setStreamType( m_configDialog->streamTypeComboBox->currentIndex() ); m_config.save(); @@ -103,7 +102,7 @@ void MagnatuneSettingsModule::settingsChanged() { - emit changed( true ); + Q_EMIT changed( true ); } #include diff --git a/src/services/magnatune/MagnatuneSqlCollection.h b/src/services/magnatune/MagnatuneSqlCollection.h --- a/src/services/magnatune/MagnatuneSqlCollection.h +++ b/src/services/magnatune/MagnatuneSqlCollection.h @@ -22,7 +22,7 @@ namespace Collections { /** -A simple ServiceSqlCollection subclass for providing a magnatune membership specific implementaion of trackForUrl +A simple ServiceSqlCollection subclass for providing a magnatune membership specific implementation of trackForUrl @author Nikolaj Hald Nielsen */ @@ -32,9 +32,9 @@ MagnatuneSqlCollection( const QString &id, const QString &prettyName, ServiceMetaFactory * metaFactory, ServiceSqlRegistry * registry ); - virtual Meta::TrackPtr trackForUrl( const QUrl &url ); + Meta::TrackPtr trackForUrl( const QUrl &url ) override; - virtual CollectionLocation* location(); + CollectionLocation* location() override; }; diff --git a/src/services/magnatune/MagnatuneStore.h b/src/services/magnatune/MagnatuneStore.h --- a/src/services/magnatune/MagnatuneStore.h +++ b/src/services/magnatune/MagnatuneStore.h @@ -45,13 +45,13 @@ public: MagnatuneServiceFactory(); - virtual ~MagnatuneServiceFactory() {} + ~MagnatuneServiceFactory() override {} - virtual void init(); - virtual QString name(); - virtual KConfigGroup config(); + void init() override; + QString name() override; + KConfigGroup config() override; - virtual bool possiblyContainsTrack( const QUrl &url ) const { return url.url().contains( "magnatune.com", Qt::CaseInsensitive ); } + bool possiblyContainsTrack( const QUrl &url ) const override { return url.url().contains( "magnatune.com", Qt::CaseInsensitive ); } }; @@ -69,11 +69,11 @@ /** * Constructor */ - MagnatuneStore( MagnatuneServiceFactory* parent, const char *name ); + explicit MagnatuneStore( MagnatuneServiceFactory* parent, const char *name ); /** * Destructor */ - ~MagnatuneStore(); + ~MagnatuneStore() override; void setMembership( int type, const QString &username, const QString &password ); @@ -85,13 +85,13 @@ /** * Do not do expensive initializations before we are actually shown */ - void polish(); + void polish() override; // bool updateContextView(); - virtual Collections::Collection * collection() { return m_collection; } + Collections::Collection * collection() override { return m_collection; } - virtual QString messages(); - virtual QString sendMessage( const QString &message ); + QString messages() override; + QString sendMessage( const QString &message ) override; public Q_SLOTS: /** @@ -119,21 +119,21 @@ void downloadSku( const QString &sku ); /** - * Slot for recieving notification that the update button has been clicked. + * Slot for receiving notification that the update button has been clicked. */ void updateButtonClicked(); /** - * Slot for recieving notification when the Magnatune xml file has been downloaded. - * Triggers a parse of the file to get the info added to the databse + * Slot for receiving notification when the Magnatune xml file has been downloaded. + * Triggers a parse of the file to get the info added to the database * @param downLoadJob The calling download Job */ void listDownloadComplete( KJob* downLoadJob ); /** - * Slot called when the parsing of the Magnatuin xml file is completed. + * Slot called when the parsing of the Magnatune xml file is completed. * Triggers an update of the list view and the genre combo box */ void doneParsing(); @@ -144,7 +144,7 @@ void processRedownload(); /** - * Slot for recieving notifications of completed download operations + * Slot for receiving notifications of completed download operations * @param success Was the operation a success? */ void downloadCompleted( bool success ); @@ -164,8 +164,8 @@ void itemSelected( CollectionTreeItem * selectedItem ); - void moodMapReady( QMap map ); - void moodyTracksReady( Meta::TrackList tracks ); + void moodMapReady(const QMap &map ); + void moodyTracksReady( const Meta::TrackList &tracks ); void timestampDownloadComplete( KJob * job ); void favoritesResult( KJob* addToFavoritesJob ); diff --git a/src/services/magnatune/MagnatuneStore.cpp b/src/services/magnatune/MagnatuneStore.cpp --- a/src/services/magnatune/MagnatuneStore.cpp +++ b/src/services/magnatune/MagnatuneStore.cpp @@ -18,7 +18,7 @@ #include "core/support/Amarok.h" #include "core/support/Components.h" -#include "core/interfaces/Logger.h" +#include "core/logger/Logger.h" #include "amarokurls/AmarokUrlHandler.h" #include "browsers/CollectionTreeItem.h" #include "browsers/CollectionTreeView.h" @@ -67,7 +67,7 @@ DEBUG_BLOCK MagnatuneStore* service = new MagnatuneStore( this, "Magnatune.com" ); m_initialized = true; - emit newService( service ); + Q_EMIT newService( service ); } QString MagnatuneServiceFactory::name() @@ -116,7 +116,7 @@ //do this stuff now to make us function properly as a track provider on startup. The expensive stuff will - //not happen untill the model is added to the view anyway. + //not happen until the model is added to the view anyway. MagnatuneMetaFactory * metaFactory = new MagnatuneMetaFactory( "magnatune", this ); MagnatuneConfig config; @@ -209,7 +209,7 @@ void MagnatuneStore::initTopPanel( ) { - QMenu *filterMenu = new QMenu( 0 ); + QMenu *filterMenu = new QMenu( nullptr ); QAction *action = filterMenu->addAction( i18n("Artist") ); connect( action, &QAction::triggered, this, &MagnatuneStore::sortByArtist ); @@ -236,7 +236,7 @@ if( tbutton ) tbutton->setPopupMode( QToolButton::InstantPopup ); - QMenu * actionsMenu = new QMenu( 0 ); + QMenu * actionsMenu = new QMenu( nullptr ); action = actionsMenu->addAction( i18n( "Re-download" ) ); connect( action, &QAction::triggered, this, &MagnatuneStore::processRedownload ); @@ -323,7 +323,7 @@ m_tempFileName = tempFile.fileName(); m_listDownloadJob = KIO::file_copy( QUrl("http://magnatune.com/info/album_info_xml.bz2"), QUrl::fromLocalFile( m_tempFileName ), 0700 , KIO::HideProgressInfo | KIO::Overwrite ); - Amarok::Components::logger()->newProgressOperation( m_listDownloadJob, i18n( "Downloading Magnatune.com database..." ), this, SLOT(listDownloadCancelled()) ); + Amarok::Logger::newProgressOperation( m_listDownloadJob, i18n( "Downloading Magnatune.com database..." ), this, &MagnatuneStore::listDownloadCancelled ); connect( m_listDownloadJob, &KJob::result, this, &MagnatuneStore::listDownloadComplete ); @@ -352,7 +352,7 @@ } - Amarok::Components::logger()->shortMessage( i18n( "Updating the local Magnatune database." ) ); + Amarok::Logger::shortMessage( i18n( "Updating the local Magnatune database." ) ); MagnatuneXmlParser * parser = new MagnatuneXmlParser( m_tempFileName ); parser->setDbHandler( new MagnatuneDatabaseHandler() ); connect( parser, &MagnatuneXmlParser::doneParsing, this, &MagnatuneStore::doneParsing ); @@ -440,24 +440,23 @@ //be an album or a track Meta::DataPtr dataPtr = selectedItem->data(); - if ( typeid( * dataPtr.data() ) == typeid( Meta::MagnatuneTrack ) ) { - + if ( auto track = AmarokSharedPointer::dynamicCast( dataPtr ) ) + { debug() << "is right type (track)"; - Meta::MagnatuneTrack * track = static_cast ( dataPtr.data() ); m_currentAlbum = static_cast ( track->album().data() ); m_downloadAlbumButton->setEnabled( true ); - - } else if ( typeid( * dataPtr.data() ) == typeid( Meta::MagnatuneAlbum ) ) { - - m_currentAlbum = static_cast ( dataPtr.data() ); + } + else if ( auto album = AmarokSharedPointer::dynamicCast( dataPtr ) ) + { + m_currentAlbum = album.data(); debug() << "is right type (album) named " << m_currentAlbum->name(); m_downloadAlbumButton->setEnabled( true ); - } else { - + } + else + { debug() << "is wrong type"; m_downloadAlbumButton->setEnabled( false ); - } } @@ -505,9 +504,6 @@ The::amarokUrlHandler()->registerRunner( runner, runner->command() ); } - QString imagePath = QStandardPaths::locate( QStandardPaths::GenericDataLocation, "amarok/data/" ); - const QUrl url = QUrl::fromLocalFile( imagePath ); - MagnatuneInfoParser * parser = dynamic_cast ( infoParser() ); if ( parser ) parser->getFrontPage(); @@ -534,7 +530,7 @@ } -void MagnatuneStore::moodMapReady(QMap< QString, int > map) +void MagnatuneStore::moodMapReady(const QMap< QString, int > &map) { QVariantMap variantMap; QList strings; @@ -551,8 +547,8 @@ QVariantMap action; action["component"] = "/ServicePluginManager"; action["function"] = "sendMessage"; - action["arg1"] = QString( "Magnatune.com"); - action["arg2"] = QString( "addMoodyTracks %1 10").arg( escapedKey ); + action["arg1"] = QStringLiteral( "Magnatune.com"); + action["arg2"] = QStringLiteral( "addMoodyTracks %1 10").arg( escapedKey ); dbusActions[key] = action; @@ -610,7 +606,7 @@ } -void MagnatuneStore::moodyTracksReady( Meta::TrackList tracks ) +void MagnatuneStore::moodyTracksReady( const Meta::TrackList &tracks ) { DEBUG_BLOCK The::playlistController()->insertOptioned( tracks, Playlist::Replace ); @@ -725,7 +721,7 @@ QString result = m_favoritesJob->data(); - Amarok::Components::logger()->longMessage( result ); + Amarok::Logger::longMessage( result ); //show the favorites page showFavoritesPage(); diff --git a/src/services/magnatune/MagnatuneUrlRunner.h b/src/services/magnatune/MagnatuneUrlRunner.h --- a/src/services/magnatune/MagnatuneUrlRunner.h +++ b/src/services/magnatune/MagnatuneUrlRunner.h @@ -34,10 +34,10 @@ virtual ~MagnatuneUrlRunner(); - virtual QString command() const; - virtual QString prettyCommand() const; - virtual QIcon icon() const; - virtual bool run( AmarokUrl url ); + QString command() const override; + QString prettyCommand() const override; + QIcon icon() const override; + bool run( const AmarokUrl &url ) override; Q_SIGNALS: void showFavorites(); diff --git a/src/services/magnatune/MagnatuneUrlRunner.cpp b/src/services/magnatune/MagnatuneUrlRunner.cpp --- a/src/services/magnatune/MagnatuneUrlRunner.cpp +++ b/src/services/magnatune/MagnatuneUrlRunner.cpp @@ -43,24 +43,24 @@ return QIcon::fromTheme( "view-services-magnatune-amarok" ); } -bool MagnatuneUrlRunner::run( AmarokUrl url ) +bool MagnatuneUrlRunner::run( const AmarokUrl &url ) { DEBUG_BLOCK if ( !url.isNull() ) { QString command = url.args().value( "command" ); if( command == "show_favorites" ) { - emit( showFavorites() ); + Q_EMIT( showFavorites() ); } else if ( command == "show_home" ) { - emit( showHome() ); + Q_EMIT( showHome() ); } else if ( command == "show_recommendations" ) { - emit( showRecommendations() ); + Q_EMIT( showRecommendations() ); } else if ( command == "download" || command == "purchase" || command == "buy" ) { @@ -72,16 +72,16 @@ if ( url.args().keys().contains( "sku" ) ) { QString sku = url.args().value( "sku" ); - emit( buyOrDownload( sku ) ); + Q_EMIT( buyOrDownload( sku ) ); } } else if ( command == "remove_favorite" ) { if ( url.args().keys().contains( "sku" ) ) { QString sku = url.args().value( "sku" ); debug() << "remove from favorites sku: " << sku; - emit( removeFromFavorites( sku ) ); + Q_EMIT( removeFromFavorites( sku ) ); } } diff --git a/src/services/magnatune/MagnatuneXmlParser.h b/src/services/magnatune/MagnatuneXmlParser.h --- a/src/services/magnatune/MagnatuneXmlParser.h +++ b/src/services/magnatune/MagnatuneXmlParser.h @@ -44,13 +44,13 @@ * @param fileName The file to parse * @return Pointer to new object */ - MagnatuneXmlParser( const QString &fileName ); + explicit MagnatuneXmlParser( const QString &fileName ); /** * The function that starts the actual work. Inherited from ThreadWeaver::Job * Note the work is performed in a separate thread */ - void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) Q_DECL_OVERRIDE; + void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) override; /** * Destructor @@ -77,7 +77,7 @@ void failed(ThreadWeaver::JobPointer); /** - * Signal emmited when parsing is complete. + * Signal emitted when parsing is complete. */ void doneParsing(); @@ -139,8 +139,8 @@ MagnatuneDatabaseHandler * m_dbHandler; protected: - void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; - void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; + void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; + void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; }; #endif diff --git a/src/services/magnatune/MagnatuneXmlParser.cpp b/src/services/magnatune/MagnatuneXmlParser.cpp --- a/src/services/magnatune/MagnatuneXmlParser.cpp +++ b/src/services/magnatune/MagnatuneXmlParser.cpp @@ -19,7 +19,7 @@ #include "core/support/Amarok.h" #include "core/support/Debug.h" #include "core/support/Components.h" -#include "core/interfaces/Logger.h" +#include "core/logger/Logger.h" #include #include @@ -72,7 +72,7 @@ void MagnatuneXmlParser::completeJob( ) { - Amarok::Components::logger()->longMessage( + Amarok::Logger::longMessage( i18ncp( "First part of: Magnatune.com database update complete. Database contains 3 tracks on 4 albums from 5 artists.", "Magnatune.com database update complete. Database contains 1 track on ", "Magnatune.com database update complete. Database contains %1 tracks on ", @@ -83,7 +83,7 @@ "1 artist.", "%1 artists.", m_nNumberOfArtists ) , Amarok::Logger::Information ); - emit doneParsing(); + Q_EMIT doneParsing(); deleteLater(); } @@ -103,20 +103,18 @@ return; } - QFile file( filename ); - auto device = new KCompressionDevice( &file, true, KCompressionDevice::BZip2 ); - if ( !device || !device->open( QIODevice::ReadOnly ) ) { + KCompressionDevice device( filename, KCompressionDevice::BZip2 ); + if ( !device.open( QIODevice::ReadOnly ) ) { debug() << "MagnatuneXmlParser::readConfigFile error reading file"; return ; } - if ( !doc.setContent( device ) ) + if ( !doc.setContent( &device ) ) { debug() << "MagnatuneXmlParser::readConfigFile error parsing file"; - device->close(); + device.close(); return ; } - device->close(); - delete device; + device.close(); m_dbHandler->destroyDatabase(); m_dbHandler->createDatabase(); @@ -128,7 +126,7 @@ parseElement( docElem ); m_dbHandler->commit(); //complete transaction - return ; + return; } @@ -161,8 +159,6 @@ MagnatuneXmlParser::parseAlbum( const QDomElement &e ) { //DEBUG_BLOCK - QString sElementName; - QString name; QString albumCode; @@ -332,12 +328,7 @@ //DEBUG_BLOCK m_currentTrackMoodList.clear(); - QString trackName; - QString trackNumber; - QString streamingUrl; - - QString sElementName; QDomElement childElement; MagnatuneTrack * pCurrentTrack = new MagnatuneTrack( QString() ); diff --git a/src/services/magnatune/amarok_service_magnatunestore.desktop b/src/services/magnatune/amarok_service_magnatunestore.desktop --- a/src/services/magnatune/amarok_service_magnatunestore.desktop +++ b/src/services/magnatune/amarok_service_magnatunestore.desktop @@ -56,7 +56,6 @@ Name[uk]=Магазин Magnatune Name[wa]=Botike Magnatune Name[x-test]=xxMagnatune Storexx -Name[zh_CN]=Magnatune 商店 Name[zh_TW]=Magnatune 商店 Comment=Preview and buy music from the non-evil Magnatune record label Comment[bg]=Обзор и купуване на музика от Magnatune @@ -106,7 +105,6 @@ Comment[uk]=Прослухайте і купіть музику з ненав’язливої агенції звукозапису Magnatune Comment[wa]=Prévey eyet atchter del muzike do nén må label d' eredjistraedje Magnatune Comment[x-test]=xxPreview and buy music from the non-evil Magnatune record labelxx -Comment[zh_CN]=预览并购买来自不作恶的 Magnatune 唱片公司的音乐 Comment[zh_TW]=從標為 non-evil 的 Magnatune 唱片標籤的音樂中,預聽並購買 diff --git a/src/services/magnatune/amarok_service_magnatunestore_config.desktop b/src/services/magnatune/amarok_service_magnatunestore_config.desktop --- a/src/services/magnatune/amarok_service_magnatunestore_config.desktop +++ b/src/services/magnatune/amarok_service_magnatunestore_config.desktop @@ -33,7 +33,7 @@ Name[it]=Configurazione servizio Magnatune Name[ja]=Magnatune ストアサービスの設定 Name[km]=កំណត់​រចនាសម្ព័ន្ធ​សេវា MagnatuneStore -Name[ko]=MagnatuneStore 서비스 설정 +Name[ko]=MagnatuneStore 서비스 구성 Name[ku]=Veava kirina Servisa MagnatuneStore Name[lt]=Magnatune parduotuvės tarnybos parinktys Name[lv]=MagnatuneStore pakalpojuma konfigurācija @@ -59,7 +59,6 @@ Name[uk]=Налаштування служби MagnatuneStore Name[wa]=Apontiaedje do siervice MagnatuneStore Name[x-test]=xxMagnatuneStore Service Configxx -Name[zh_CN]=Magnatune 商店服务配置 Name[zh_TW]=Magnatune商店服務設定 Comment=Configure Magnatune store settings and memberships credentials Comment[bg]=Настройване на членството в Magnatune @@ -76,11 +75,11 @@ Comment[et]=Magnatune kaupluse seadistuste ja liikmesuse määramine Comment[eu]=Konfiguratu Magnatune dendako ezarpenak eta kideen kredentzialak Comment[fi]=Määritä Magnatunen asetukset ja jäsenyystiedot -Comment[fr]=Configurer les paramètres de la boutique « Magnatune » et les références de membre +Comment[fr]=Configurer les paramètres de la boutique « Magnatune » et les identifiants de membre Comment[ga]=Cumraigh socruithe siopa Magnatune agus do chuid dintiúr Comment[gl]=Configura os parámetros da tenda Magnatune e as credenciais de membresía Comment[hu]=A Magnatune áruház beállításainak módosítása, tagsági bejelentkezési adatok -Comment[id]=Konfigurasi setelan Magnatune store dan surat kuasa keanggotaan +Comment[id]=Konfigurasikan pengaturan Magnatune store dan surat kuasa keanggotaan Comment[is]=Setja inn auðkennisupplýsingar og stillingar fyrir Magnatune verslunina Comment[it]=Configura le impostazione del negozio Magnatune e le credenziali di iscrizione Comment[ja]=Magnatune ストアの設定と会員の資格情報を設定 @@ -110,6 +109,5 @@ Comment[uk]=Налаштувати параметри і членських даних Magnatune Comment[wa]=Apontyî les tchuzes del botike Magnatune eyet les credits des mimbes Comment[x-test]=xxConfigure Magnatune store settings and memberships credentialsxx -Comment[zh_CN]=配置 Magnatune 商店的设置和会员证件 Comment[zh_TW]=調整 Magnatune 商店設定與會員憑證 diff --git a/src/services/magnatune/images/CMakeLists.txt b/src/services/magnatune/images/CMakeLists.txt --- a/src/services/magnatune/images/CMakeLists.txt +++ b/src/services/magnatune/images/CMakeLists.txt @@ -1,5 +1,5 @@ install( FILES hover_info_magnatune.png - DESTINATION ${DATA_INSTALL_DIR}/amarok/images + DESTINATION ${KDE_INSTALL_DATADIR}/amarok/images ) diff --git a/src/services/mp3tunes/CMakeLists.txt b/src/services/mp3tunes/CMakeLists.txt --- a/src/services/mp3tunes/CMakeLists.txt +++ b/src/services/mp3tunes/CMakeLists.txt @@ -112,7 +112,7 @@ endif() -install(TARGETS amarok_service_mp3tunes DESTINATION ${PLUGIN_INSTALL_DIR} ) +install(TARGETS amarok_service_mp3tunes DESTINATION ${KDE_INSTALL_PLUGINDIR} ) kcoreaddons_desktop_to_json(amarok_service_mp3tunes amarok_service_mp3tunes.desktop SERVICE_TYPES ${CMAKE_SOURCE_DIR}/src/amarok-plugin.desktop) @@ -133,7 +133,7 @@ KF5::ConfigWidgets ) -install(TARGETS kcm_amarok_service_mp3tunes DESTINATION ${PLUGIN_INSTALL_DIR}) +install(TARGETS kcm_amarok_service_mp3tunes DESTINATION ${KDE_INSTALL_PLUGINDIR}) install( FILES amarok_service_mp3tunes_config.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}) kcoreaddons_desktop_to_json(kcm_amarok_service_mp3tunes amarok_service_mp3tunes_config.desktop SERVICE_TYPES kcmodule.desktop) diff --git a/src/services/mp3tunes/Mp3tunesLocker.h b/src/services/mp3tunes/Mp3tunesLocker.h --- a/src/services/mp3tunes/Mp3tunesLocker.h +++ b/src/services/mp3tunes/Mp3tunesLocker.h @@ -28,7 +28,7 @@ #include /** - * A psudeo type to encapsulate the various return types from a search query. + * A pseudo type to encapsulate the various return types from a search query. */ class Mp3tunesSearchResult { public: @@ -54,7 +54,7 @@ * Initialize the connection, but do not login. * @param partnerToken your partnerToken to access the mp3tunes API. */ - Mp3tunesLocker( const QString & partnerToken ); + explicit Mp3tunesLocker( const QString & partnerToken ); /** * Initialize the connection, and login. @@ -71,7 +71,7 @@ * Logs into the locker. * for testing use demo@mp3tunes.com:demo * @param userName the username - * @param passowrd username's password + * @param password username's password * @return if login successful, the sessionId is returned * if login failed, an empty QString is returned */ @@ -164,7 +164,7 @@ * of tracks be in the same order as the supplied filekeys. * Might return an empty List. */ - QList tracksWithFileKeys( QStringList filekeys ) const; + QList tracksWithFileKeys(const QStringList &filekeys ) const; /** * Get a single track from a single filekey. @@ -185,8 +185,9 @@ * search results. If the search returned empty, then the * QLists will be empty. * @param container contains the QList's to be filled with search results - * @return true if search succeeded. Note: Zero search results is not failure. - * false if search failed. + * @param query the query string + * @return @c true if search succeeded. Note: Zero search results is not a failure. + * @c false if search failed. */ bool search( Mp3tunesSearchResult &container, const QString &query ) const; @@ -213,7 +214,7 @@ * and password can be transferred in the URL to retrieve the * file. Any access control based on user sessions cannot be * used in locker loading. - * @param the full URL to the track + * @param url the full URL to the track * @return true if the lockerload succeeded * false if the lockerload failed. * @pre The URL must be accessible by the MP3tunes servers, diff --git a/src/services/mp3tunes/Mp3tunesLocker.cpp b/src/services/mp3tunes/Mp3tunesLocker.cpp --- a/src/services/mp3tunes/Mp3tunesLocker.cpp +++ b/src/services/mp3tunes/Mp3tunesLocker.cpp @@ -338,7 +338,7 @@ } QList -Mp3tunesLocker::tracksWithFileKeys( QStringList filekeys ) const +Mp3tunesLocker::tracksWithFileKeys( const QStringList &filekeys ) const { QString keys; foreach( const QString &key, filekeys ) diff --git a/src/services/mp3tunes/Mp3tunesLockerMeta.h b/src/services/mp3tunes/Mp3tunesLockerMeta.h --- a/src/services/mp3tunes/Mp3tunesLockerMeta.h +++ b/src/services/mp3tunes/Mp3tunesLockerMeta.h @@ -32,7 +32,7 @@ class Mp3tunesLockerPlaylist { public: - Mp3tunesLockerPlaylist( mp3tunes_locker_playlist_t *playlist ); + explicit Mp3tunesLockerPlaylist( mp3tunes_locker_playlist_t *playlist ); ~Mp3tunesLockerPlaylist(); QString playlistId() const; @@ -47,7 +47,7 @@ class Mp3tunesLockerArtist { public: - Mp3tunesLockerArtist( mp3tunes_locker_artist_t *artist ); + explicit Mp3tunesLockerArtist( mp3tunes_locker_artist_t *artist ); ~Mp3tunesLockerArtist(); int artistId() const; @@ -65,7 +65,7 @@ class Mp3tunesLockerAlbum { public: - Mp3tunesLockerAlbum( mp3tunes_locker_album_t *album ); + explicit Mp3tunesLockerAlbum( mp3tunes_locker_album_t *album ); ~Mp3tunesLockerAlbum(); int albumId() const; QString albumTitle() const; @@ -86,7 +86,7 @@ class Mp3tunesLockerTrack { public: - Mp3tunesLockerTrack( mp3tunes_locker_track_t *track = 0 ); + explicit Mp3tunesLockerTrack( mp3tunes_locker_track_t *track = 0 ); ~Mp3tunesLockerTrack(); int trackId() const; diff --git a/src/services/mp3tunes/Mp3tunesMeta.h b/src/services/mp3tunes/Mp3tunesMeta.h --- a/src/services/mp3tunes/Mp3tunesMeta.h +++ b/src/services/mp3tunes/Mp3tunesMeta.h @@ -35,7 +35,7 @@ public: - Mp3TunesTrack( const QString& title ); + explicit Mp3TunesTrack( const QString& title ); virtual QString sourceName(); virtual QString sourceDescription(); @@ -53,8 +53,8 @@ QString m_coverURL; public: - Mp3TunesAlbum( const QString &name ); - Mp3TunesAlbum( const QStringList &resultRow ); + explicit Mp3TunesAlbum( const QString &name ); + explicit Mp3TunesAlbum( const QStringList &resultRow ); ~Mp3TunesAlbum(); diff --git a/src/services/mp3tunes/Mp3tunesService.cpp b/src/services/mp3tunes/Mp3tunesService.cpp --- a/src/services/mp3tunes/Mp3tunesService.cpp +++ b/src/services/mp3tunes/Mp3tunesService.cpp @@ -21,7 +21,7 @@ #include "browsers/SingleCollectionTreeItemModel.h" #include "core-impl/collections/support/CollectionManager.h" -#include "core/interfaces/Logger.h" +#include "core/logger/Logger.h" #include "core/support/Components.h" #include "core/support/Debug.h" #include "Mp3tunesConfig.h" @@ -214,7 +214,7 @@ debug() << "Daemon running"; m_harmonyEnabled = true; - Amarok::Components::logger()->shortMessage( i18n( "MP3tunes AutoSync Enabled" ) ); + Amarok::Logger::shortMessage( i18n( "MP3tunes AutoSync Enabled" ) ); polish(); } @@ -230,7 +230,7 @@ m_harmonyEnabled = false; polish(); - Amarok::Components::logger()->shortMessage( i18n( "MP3tunes AutoSync Disabled" ) ); + Amarok::Logger::shortMessage( i18n( "MP3tunes AutoSync Disabled" ) ); } void Mp3tunesService::authenticate( const QString & uname, const QString & passwd ) @@ -250,7 +250,7 @@ //debug() << "Connection complete. Enqueueing.."; ThreadWeaver::Queue::instance()->enqueue( QSharedPointer(m_loginWorker) ); //debug() << "LoginWorker queue"; - Amarok::Components::logger()->shortMessage( i18n( "Authenticating" ) ); + Amarok::Logger::shortMessage( i18n( "Authenticating" ) ); } @@ -267,7 +267,7 @@ { error = m_locker->errorMessage(); // Not sure how to i18n this } - Amarok::Components::logger()->longMessage( error ); + Amarok::Logger::longMessage( error ); setServiceReady( false ); m_authenticationFailed = true; @@ -292,14 +292,14 @@ { DEBUG_BLOCK debug() << "Harmony Disconnected!"; - Amarok::Components::logger()->shortMessage( i18n( "MP3tunes Harmony: Disconnected" ) ); + Amarok::Logger::shortMessage( i18n( "MP3tunes Harmony: Disconnected" ) ); } void Mp3tunesService::harmonyWaitingForEmail( const QString &pin ) { DEBUG_BLOCK debug() << "Waiting for user to input PIN: " << pin; - Amarok::Components::logger()->shortMessage( i18n( "MP3tunes Harmony: Waiting for PIN Input" ) ); + Amarok::Logger::shortMessage( i18n( "MP3tunes Harmony: Waiting for PIN Input" ) ); KMessageBox::information( this, "Please go to mp3tunes.com/pin and enter the following pin.\n\tPIN: " + pin, "MP3tunes Harmony", @@ -312,7 +312,7 @@ DEBUG_BLOCK QString pin = m_harmony->pin(); debug() << "Waiting for user to input PIN: " << pin; - Amarok::Components::logger()->shortMessage( i18n( "MP3tunes Harmony: Waiting for PIN Input" ) ); + Amarok::Logger::shortMessage( i18n( "MP3tunes Harmony: Waiting for PIN Input" ) ); KMessageBox::information( this, "Please go to mp3tunes.com/pin and enter the following pin.\n\tPIN: " + pin, "MP3tunes Harmony", @@ -324,7 +324,7 @@ { DEBUG_BLOCK debug() << "Harmony Connected!"; - Amarok::Components::logger()->shortMessage( i18n( "MP3tunes Harmony: Successfully Connected" ) ); + Amarok::Logger::shortMessage( i18n( "MP3tunes Harmony: Successfully Connected" ) ); /* at this point since the user has input the pin, we will save the info for later authentication*/ Mp3tunesConfig config; @@ -339,7 +339,7 @@ { DEBUG_BLOCK debug() << "Harmony Error: " << error; - Amarok::Components::logger()->longMessage( i18n( "MP3tunes Harmony Error\n%1", error ) ); + Amarok::Logger::longMessage( i18n( "MP3tunes Harmony Error\n%1", error ) ); } void Mp3tunesService::harmonyDownloadReady( const QVariantMap &download ) diff --git a/src/services/mp3tunes/Mp3tunesServiceCollectionLocation.h b/src/services/mp3tunes/Mp3tunesServiceCollectionLocation.h --- a/src/services/mp3tunes/Mp3tunesServiceCollectionLocation.h +++ b/src/services/mp3tunes/Mp3tunesServiceCollectionLocation.h @@ -30,7 +30,7 @@ { Q_OBJECT public: - Mp3tunesServiceCollectionLocation( Mp3tunesServiceCollection *parentCollection ); + explicit Mp3tunesServiceCollectionLocation( Mp3tunesServiceCollection *parentCollection ); virtual ~Mp3tunesServiceCollectionLocation(); virtual QString prettyLocation() const; diff --git a/src/services/mp3tunes/Mp3tunesServiceCollectionLocation.cpp b/src/services/mp3tunes/Mp3tunesServiceCollectionLocation.cpp --- a/src/services/mp3tunes/Mp3tunesServiceCollectionLocation.cpp +++ b/src/services/mp3tunes/Mp3tunesServiceCollectionLocation.cpp @@ -17,7 +17,7 @@ #include "Mp3tunesServiceCollectionLocation.h" #include "Mp3tunesWorkers.h" -#include "core/interfaces/Logger.h" +#include "core/logger/Logger.h" #include "core/support/Components.h" #include @@ -76,11 +76,11 @@ else { error = i18n( "Only the following types of tracks can be uploaded to MP3tunes: mp3, mp4, m4a, m4p, aac, wma, and ogg. " ); - debug() << "File type not supprted " << track->type(); + debug() << "File type not supported " << track->type(); } } if( !error.isEmpty() ) - Amarok::Components::logger()->longMessage( error ); + Amarok::Logger::longMessage( error ); Mp3tunesSimpleUploader * uploadWorker = new Mp3tunesSimpleUploader( m_collection->locker(), urls ); connect( uploadWorker, &Mp3tunesSimpleUploader::uploadComplete, this, &Mp3tunesServiceCollectionLocation::slotCopyOperationFinished ); ThreadWeaver::Queue::instance()->enqueue( QSharedPointer(uploadWorker) ); diff --git a/src/services/mp3tunes/Mp3tunesServiceQueryMaker.cpp b/src/services/mp3tunes/Mp3tunesServiceQueryMaker.cpp --- a/src/services/mp3tunes/Mp3tunesServiceQueryMaker.cpp +++ b/src/services/mp3tunes/Mp3tunesServiceQueryMaker.cpp @@ -458,7 +458,7 @@ int Mp3tunesServiceQueryMaker::validFilterMask() { - //we only supprt artist filters for now... + //we only support artist filters for now... return ArtistFilter; } diff --git a/src/services/mp3tunes/Mp3tunesSettingsModule.h b/src/services/mp3tunes/Mp3tunesSettingsModule.h --- a/src/services/mp3tunes/Mp3tunesSettingsModule.h +++ b/src/services/mp3tunes/Mp3tunesSettingsModule.h @@ -33,7 +33,7 @@ { Q_OBJECT public: - explicit Mp3tunesSettingsModule( QWidget *parent = 0, const QVariantList &args = QVariantList() ); + explicit Mp3tunesSettingsModule( QWidget *parent = nullptr, const QVariantList &args = QVariantList() ); ~Mp3tunesSettingsModule(); diff --git a/src/services/mp3tunes/Mp3tunesWorkers.h b/src/services/mp3tunes/Mp3tunesWorkers.h --- a/src/services/mp3tunes/Mp3tunesWorkers.h +++ b/src/services/mp3tunes/Mp3tunesWorkers.h @@ -34,7 +34,7 @@ Mp3tunesLoginWorker( Mp3tunesLocker* locker, const QString &username, const QString &password ); ~Mp3tunesLoginWorker(); - void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) Q_DECL_OVERRIDE; + void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) override; Q_SIGNALS: /** This signal is emitted when this job is being processed by a thread. */ @@ -56,8 +56,8 @@ QString m_username; QString m_password; protected: - void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; - void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; + void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; + void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; }; /** @@ -67,10 +67,10 @@ { Q_OBJECT public: - Mp3tunesArtistFetcher( Mp3tunesLocker * locker ); + explicit Mp3tunesArtistFetcher( Mp3tunesLocker * locker ); ~Mp3tunesArtistFetcher(); - void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) Q_DECL_OVERRIDE; + void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) override; Q_SIGNALS: /** This signal is emitted when this job is being processed by a thread. */ @@ -90,8 +90,8 @@ Mp3tunesLocker* m_locker; QList m_artists; protected: - void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; - void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; + void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; + void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; }; /** @@ -104,7 +104,7 @@ Mp3tunesAlbumWithArtistIdFetcher( Mp3tunesLocker * locker, int artistId ); ~Mp3tunesAlbumWithArtistIdFetcher(); - void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) Q_DECL_OVERRIDE; + void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) override; Q_SIGNALS: /** This signal is emitted when this job is being processed by a thread. */ @@ -125,8 +125,8 @@ Mp3tunesLocker* m_locker; QList m_albums; protected: - void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; - void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; + void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; + void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; }; /** @@ -139,7 +139,7 @@ Mp3tunesTrackWithAlbumIdFetcher( Mp3tunesLocker * locker, int albumId ); ~Mp3tunesTrackWithAlbumIdFetcher(); - void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) Q_DECL_OVERRIDE; + void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) override; Q_SIGNALS: /** This signal is emitted when this job is being processed by a thread. */ @@ -160,8 +160,8 @@ Mp3tunesLocker* m_locker; QList m_tracks; protected: - void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; - void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; + void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; + void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; }; /** @@ -174,7 +174,7 @@ Mp3tunesTrackWithArtistIdFetcher( Mp3tunesLocker * locker, int artistId ); ~Mp3tunesTrackWithArtistIdFetcher(); - void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) Q_DECL_OVERRIDE; + void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) override; Q_SIGNALS: /** This signal is emitted when this job is being processed by a thread. */ @@ -194,8 +194,8 @@ Mp3tunesLocker* m_locker; QList m_tracks; protected: - void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; - void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; + void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; + void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; }; @@ -209,7 +209,7 @@ Mp3tunesSearchMonkey( Mp3tunesLocker * locker, QString query, int searchFor ); ~Mp3tunesSearchMonkey(); - void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) Q_DECL_OVERRIDE; + void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) override; Q_SIGNALS: /** This signal is emitted when this job is being processed by a thread. */ @@ -233,8 +233,8 @@ Mp3tunesLocker* m_locker; Mp3tunesSearchResult m_result; protected: - void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; - void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; + void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; + void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; }; /** @@ -244,10 +244,10 @@ { Q_OBJECT public: - Mp3tunesSimpleUploader( Mp3tunesLocker * locker, QStringList tracklist ); - ~Mp3tunesSimpleUploader(); + Mp3tunesSimpleUploader( Mp3tunesLocker * locker, const QStringList &tracklist ); + ~Mp3tunesSimpleUploader() override; - void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) Q_DECL_OVERRIDE; + void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) override; Q_SIGNALS: /** This signal is emitted when this job is being processed by a thread. */ @@ -269,8 +269,8 @@ Mp3tunesLocker* m_locker; QStringList m_tracklist; protected: - void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; - void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; + void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; + void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; }; /** @@ -283,7 +283,7 @@ Mp3tunesTrackFromFileKeyFetcher( Mp3tunesLocker * locker, QString filekey ); ~Mp3tunesTrackFromFileKeyFetcher(); - void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) Q_DECL_OVERRIDE; + void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) override; Q_SIGNALS: /** This signal is emitted when this job is being processed by a thread. */ @@ -305,8 +305,8 @@ QString m_filekey; protected: - void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; - void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; + void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; + void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; }; #endif diff --git a/src/services/mp3tunes/Mp3tunesWorkers.cpp b/src/services/mp3tunes/Mp3tunesWorkers.cpp --- a/src/services/mp3tunes/Mp3tunesWorkers.cpp +++ b/src/services/mp3tunes/Mp3tunesWorkers.cpp @@ -16,7 +16,7 @@ #include "Mp3tunesWorkers.h" -#include "core/interfaces/Logger.h" +#include "core/logger/Logger.h" #include "core/support/Components.h" #include "core/support/Debug.h" #include "Mp3tunesMeta.h" @@ -333,15 +333,15 @@ } /* SIMPLE UPLOADER */ -Mp3tunesSimpleUploader:: Mp3tunesSimpleUploader( Mp3tunesLocker * locker, QStringList tracklist ) +Mp3tunesSimpleUploader:: Mp3tunesSimpleUploader( Mp3tunesLocker * locker, const QStringList &tracklist ) { DEBUG_BLOCK connect( this, &Mp3tunesSimpleUploader::done, this, &Mp3tunesSimpleUploader::completeJob ); m_locker = locker; m_tracklist = tracklist; - Amarok::Components::logger()->newProgressOperation( this, i18n( "Upload to MP3tunes Initiated" ), m_tracklist.count() ); + Amarok::Logger::newProgressOperation( this, i18n( "Upload to MP3tunes Initiated" ), m_tracklist.count() ); //TODO: port to Amarok::Logger signals // connect( this, SIGNAL(incrementProgress()), The::statusBar(), SLOT(incrementProgress()), Qt::QueuedConnection ); } diff --git a/src/services/mp3tunes/amarok_service_mp3tunes.desktop b/src/services/mp3tunes/amarok_service_mp3tunes.desktop --- a/src/services/mp3tunes/amarok_service_mp3tunes.desktop +++ b/src/services/mp3tunes/amarok_service_mp3tunes.desktop @@ -46,7 +46,6 @@ Name[tr]=MP3tunes Name[uk]=MP3tunes Name[x-test]=xxMP3tunesxx -Name[zh_CN]=MP3tunes Name[zh_TW]=Mp3tunes Comment=Browse and listen to the music stored in your MP3tunes account Comment[bg]=Преглед и слушане на музиката от сметката ви в MP3tunes @@ -92,7 +91,6 @@ Comment[tr]=MP3tunes hesabınızdaki müzikleri inceleyin ve dinleyin Comment[uk]=Перегляньте і прослухайте музику з вашого рахунку у MP3tunes Comment[x-test]=xxBrowse and listen to the music stored in your MP3tunes accountxx -Comment[zh_CN]=浏览并收听储存在您的 MP3tunes 账户中的音乐 Comment[zh_TW]=瀏覽並聆聽儲存在您 MP3tunes 帳戶中的音樂 ServiceTypes=Amarok/Plugin diff --git a/src/services/mp3tunes/amarok_service_mp3tunes_config.desktop b/src/services/mp3tunes/amarok_service_mp3tunes_config.desktop --- a/src/services/mp3tunes/amarok_service_mp3tunes_config.desktop +++ b/src/services/mp3tunes/amarok_service_mp3tunes_config.desktop @@ -31,7 +31,7 @@ Name[it]=Configurazione servizio MP3tunes Name[ja]=Mp3tunes サービスの設定 Name[km]=កំណត់​រចនាសម្ព័ន្ធ​សេវា MP3tunes -Name[ko]=MP3tunes 서비스 설정 +Name[ko]=MP3tunes 서비스 구성 Name[lt]=MP3tunes tarnybos parinktys Name[lv]=Mp3tunes pakalpojuma konfigurācija Name[nb]=Innstillinger for Mp3tunes-tjenesten @@ -53,7 +53,6 @@ Name[tr]=Mp3tunes Hizmet Yapılandırması Name[uk]=Налаштування служби MP3tunes Name[x-test]=xxMP3tunes Service Configxx -Name[zh_CN]=MP3tunes 服务配置 Name[zh_TW]=Mp3tunes 服務設定 Comment=Configure mp3tunes credentials Comment[bg]=Настройване на mp3tunes @@ -70,16 +69,16 @@ Comment[et]=Mp3Tunesi kasutajatunnuste määramine Comment[eu]=Konfiguratu mp3tunes-en kredentzialak Comment[fi]=Määritä Mp3tunes-palvelun tilitiedot -Comment[fr]=Configuration des références « MP3tunes » +Comment[fr]=Configuration des identifiants « MP3tunes » Comment[ga]=Cumraíocht dintiúir MP3tunes Comment[gl]=Configura as credenciais de mp3tunes Comment[hu]=Bejelentkezési adatok beállítása az MP3tunes szolgáltatáshoz -Comment[id]=Konfigurasi surat kuasa mp3tunes +Comment[id]=Konfigurasikan surat kuasa mp3tunes Comment[is]=Stilla mp3tunes auðkenni Comment[it]=Configura credenziali mp3tunes Comment[ja]=Mp3tunes の資格情報を設定 Comment[km]=កំណត់​រចនាសម្ព័ន្ធ​លិខិត​សម្គាល់​ mp3tunes -Comment[ko]=mp3tunes 개인 정보 설정 +Comment[ko]=mp3tunes 인증 정보 설정 Comment[ku]=Ewlayî yên mp3tunes ava bike Comment[lt]=Keisti mp3tunes prisijungimo duomenis Comment[lv]=Konfigurēt mp3tune lietotāja kontu @@ -104,6 +103,5 @@ Comment[uk]=Налаштувати реєстраційні дані у mp3tunes Comment[wa]=Aponteye les credits mp3tunes Comment[x-test]=xxConfigure mp3tunes credentialsxx -Comment[zh_CN]=配置 Mp3tunes 证件 Comment[zh_TW]=設定 mp3tunes 的憑證 diff --git a/src/services/mp3tunes/harmonydaemon/Mp3tunesHarmonyDaemon.h b/src/services/mp3tunes/harmonydaemon/Mp3tunesHarmonyDaemon.h --- a/src/services/mp3tunes/harmonydaemon/Mp3tunesHarmonyDaemon.h +++ b/src/services/mp3tunes/harmonydaemon/Mp3tunesHarmonyDaemon.h @@ -36,14 +36,14 @@ } /** - * A daemon that receives notfications from mp3tunes' + * A daemon that receives notifications from mp3tunes' * servers about new/changed tracks that can be synced. * * Because this classes implements libmp3tunes which uses * GLIB's c-style callbacks, all the callbacks must be static. * This requires some black magic on my part to keep the OO * facade intact. The solution is a global variable: theDaemon - * delcared after this class. Your code must #define DEFINE_HARMONY + * declared after this class. Your code must \#define DEFINE_HARMONY * and instantiate a new Mp3tunesHarmonyDaemon for theDaemon. * @author Casey Link */ @@ -64,7 +64,7 @@ ~Mp3tunesHarmonyDaemon(); /** - * Stats the daemon by intiating the connection Harmony connection. + * Stats the daemon by initiating the connection Harmony connection. */ int init(); @@ -75,7 +75,7 @@ /** * The possible states the daemon can be in. - * Before init() it is DISONNECTED + * Before init() it is DISCONNECTED */ enum HarmonyState { DISCONNECTED, diff --git a/src/services/mp3tunes/harmonydaemon/Mp3tunesHarmonyDaemon.cpp b/src/services/mp3tunes/harmonydaemon/Mp3tunesHarmonyDaemon.cpp --- a/src/services/mp3tunes/harmonydaemon/Mp3tunesHarmonyDaemon.cpp +++ b/src/services/mp3tunes/harmonydaemon/Mp3tunesHarmonyDaemon.cpp @@ -346,7 +346,7 @@ theDaemon->setState( Mp3tunesHarmonyDaemon::CONNECTED ); theDaemon->emitConnected(); /* At this point, it would be best to store the pin, if you haven't - * already, and the email in some somewhat permenant storage for + * already, and the email in some somewhat permanent storage for * when reauthenticating. */ break; diff --git a/src/services/mp3tunes/harmonydaemon/Mp3tunesHarmonyDownload.h b/src/services/mp3tunes/harmonydaemon/Mp3tunesHarmonyDownload.h --- a/src/services/mp3tunes/harmonydaemon/Mp3tunesHarmonyDownload.h +++ b/src/services/mp3tunes/harmonydaemon/Mp3tunesHarmonyDownload.h @@ -35,8 +35,8 @@ * Default constructor does nothing. */ Mp3tunesHarmonyDownload(); - Mp3tunesHarmonyDownload( const QVariantMap &map ); - Mp3tunesHarmonyDownload( mp3tunes_harmony_download_t *download ); + explicit Mp3tunesHarmonyDownload( const QVariantMap &map ); + explicit Mp3tunesHarmonyDownload( mp3tunes_harmony_download_t *download ); ~Mp3tunesHarmonyDownload(); QString fileKey() const; diff --git a/src/services/mp3tunes/libmp3tunes/locker.h b/src/services/mp3tunes/libmp3tunes/locker.h --- a/src/services/mp3tunes/libmp3tunes/locker.h +++ b/src/services/mp3tunes/libmp3tunes/locker.h @@ -15,7 +15,7 @@ ****************************************************************************************/ /** - * \file oboe.h + * \file locker.h * \brief The \e liboboe public header. */ diff --git a/src/services/mp3tunes/libmp3tunes/md5.h b/src/services/mp3tunes/libmp3tunes/md5.h --- a/src/services/mp3tunes/libmp3tunes/md5.h +++ b/src/services/mp3tunes/libmp3tunes/md5.h @@ -40,7 +40,7 @@ * * signature - a 16 byte buffer that contains the MD5 signature. * - * str - a string of charactes which should be at least 33 bytes long (2 + * str - a string of characters which should be at least 33 bytes long (2 * characters per MD5 byte and 1 for the \0). * * str_len - the length of the string. diff --git a/src/services/opmldirectory/CMakeLists.txt b/src/services/opmldirectory/CMakeLists.txt --- a/src/services/opmldirectory/CMakeLists.txt +++ b/src/services/opmldirectory/CMakeLists.txt @@ -28,10 +28,10 @@ KF5::ThreadWeaver ) - install(TARGETS amarok_service_opmldirectory DESTINATION ${PLUGIN_INSTALL_DIR} ) + install(TARGETS amarok_service_opmldirectory DESTINATION ${KDE_INSTALL_PLUGINDIR} ) kcoreaddons_desktop_to_json(amarok_service_opmldirectory amarok_service_opmldirectory.desktop SERVICE_TYPES ${CMAKE_SOURCE_DIR}/src/amarok-plugin.desktop) ########### install files ############### - install( FILES podcast_directory.opml DESTINATION ${DATA_INSTALL_DIR}/amarok/data) + install( FILES podcast_directory.opml DESTINATION ${KDE_INSTALL_DATADIR}/amarok/data) diff --git a/src/services/opmldirectory/OpmlDirectoryDelegate.h b/src/services/opmldirectory/OpmlDirectoryDelegate.h --- a/src/services/opmldirectory/OpmlDirectoryDelegate.h +++ b/src/services/opmldirectory/OpmlDirectoryDelegate.h @@ -23,7 +23,7 @@ { Q_OBJECT public: - explicit OpmlDirectoryDelegate(QObject *parent = 0); + explicit OpmlDirectoryDelegate(QObject *parent = nullptr); Q_SIGNALS: diff --git a/src/services/opmldirectory/OpmlDirectoryInfoParser.h b/src/services/opmldirectory/OpmlDirectoryInfoParser.h --- a/src/services/opmldirectory/OpmlDirectoryInfoParser.h +++ b/src/services/opmldirectory/OpmlDirectoryInfoParser.h @@ -31,11 +31,11 @@ public: OpmlDirectoryInfoParser(); - ~OpmlDirectoryInfoParser(); + ~OpmlDirectoryInfoParser() override; - virtual void getInfo( Meta::ArtistPtr artist ); - virtual void getInfo( Meta::AlbumPtr album ); - virtual void getInfo( Meta::TrackPtr track ); + void getInfo( const Meta::ArtistPtr &artist ) override; + void getInfo( const Meta::AlbumPtr &album ) override; + void getInfo( const Meta::TrackPtr &track ) override; private: KJob * m_rssDownloadJob; diff --git a/src/services/opmldirectory/OpmlDirectoryInfoParser.cpp b/src/services/opmldirectory/OpmlDirectoryInfoParser.cpp --- a/src/services/opmldirectory/OpmlDirectoryInfoParser.cpp +++ b/src/services/opmldirectory/OpmlDirectoryInfoParser.cpp @@ -18,7 +18,7 @@ #include "core/support/Debug.h" #include "core/support/Components.h" -#include "core/interfaces/Logger.h" +#include "core/logger/Logger.h" #include "OpmlDirectoryMeta.h" #include @@ -29,28 +29,28 @@ OpmlDirectoryInfoParser::OpmlDirectoryInfoParser() : InfoParserBase() - , m_rssDownloadJob( Q_NULLPTR ) + , m_rssDownloadJob( nullptr ) { } OpmlDirectoryInfoParser::~OpmlDirectoryInfoParser() { } -void OpmlDirectoryInfoParser::getInfo(ArtistPtr artist) +void OpmlDirectoryInfoParser::getInfo(const ArtistPtr &artist) { AMAROK_NOTIMPLEMENTED Q_UNUSED( artist ); } -void OpmlDirectoryInfoParser::getInfo(AlbumPtr album) +void OpmlDirectoryInfoParser::getInfo(const AlbumPtr &album) { AMAROK_NOTIMPLEMENTED Q_UNUSED( album ); } -void OpmlDirectoryInfoParser::getInfo( TrackPtr track ) +void OpmlDirectoryInfoParser::getInfo(const TrackPtr &track ) { DEBUG_BLOCK showLoading( i18n( "Loading Podcast Info..." ) ); @@ -62,7 +62,7 @@ debug() << "OpmlDirectoryInfoParser: getInfo about feed: " << feed->uidUrl(); m_rssDownloadJob = KIO::storedGet( QUrl( feed->uidUrl() ), KIO::Reload, KIO::HideProgressInfo ); - Amarok::Components::logger()->newProgressOperation( m_rssDownloadJob, + Amarok::Logger::newProgressOperation( m_rssDownloadJob, i18n( "Fetching Podcast Info" ) ); connect( m_rssDownloadJob, &KJob::result, this, &OpmlDirectoryInfoParser::rssDownloadComplete ); } @@ -121,7 +121,7 @@ infoHtml += "

" + description; infoHtml += ""; - emit ( info( infoHtml ) ); + Q_EMIT ( info( infoHtml ) ); downLoadJob->deleteLater(); } diff --git a/src/services/opmldirectory/OpmlDirectoryMeta.h b/src/services/opmldirectory/OpmlDirectoryMeta.h --- a/src/services/opmldirectory/OpmlDirectoryMeta.h +++ b/src/services/opmldirectory/OpmlDirectoryMeta.h @@ -33,8 +33,8 @@ OpmlDirectoryMetaFactory( const QString &dbPrefix, OpmlDirectoryService *service ); virtual ~OpmlDirectoryMetaFactory() {} - virtual Meta::TrackPtr createTrack( const QStringList &rows ); - virtual Meta::AlbumPtr createAlbum( const QStringList &rows ); + Meta::TrackPtr createTrack( const QStringList &rows ) override; + Meta::AlbumPtr createAlbum( const QStringList &rows ) override; }; @@ -50,15 +50,15 @@ public: - OpmlDirectoryFeed( const QString &name ); - OpmlDirectoryFeed( const QStringList &resultRow ); + explicit OpmlDirectoryFeed( const QString &name ); + explicit OpmlDirectoryFeed( const QStringList &resultRow ); }; class OpmlDirectoryCategory : public ServiceAlbum { public: - OpmlDirectoryCategory( const QString &name ); - OpmlDirectoryCategory( const QStringList &resultRow ); + explicit OpmlDirectoryCategory( const QString &name ); + explicit OpmlDirectoryCategory( const QStringList &resultRow ); }; } diff --git a/src/services/opmldirectory/OpmlDirectoryModel.h b/src/services/opmldirectory/OpmlDirectoryModel.h --- a/src/services/opmldirectory/OpmlDirectoryModel.h +++ b/src/services/opmldirectory/OpmlDirectoryModel.h @@ -37,22 +37,22 @@ { ActionRole = Qt::UserRole, //list of QActions for the index DecorationUriRole, //a URI for the decoration to be fetched by the view. - CustomRoleOffset //first role that can be used by sublasses for their own data + CustomRoleOffset //first role that can be used by subclasses for their own data }; - explicit OpmlDirectoryModel( QUrl outlineUrl, QObject *parent = 0 ); + explicit OpmlDirectoryModel( QUrl outlineUrl, QObject *parent = nullptr ); ~OpmlDirectoryModel(); // QAbstractItemModel methods - virtual QModelIndex index( int row, int column, const QModelIndex &parent = QModelIndex() ) const; - virtual Qt::ItemFlags flags( const QModelIndex &index ) const; - virtual QModelIndex parent( const QModelIndex &index ) const; - virtual int rowCount( const QModelIndex &parent = QModelIndex() ) const; - virtual bool hasChildren( const QModelIndex &parent = QModelIndex() ) const; - virtual int columnCount( const QModelIndex &parent = QModelIndex() ) const; - virtual QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const; - virtual bool setData( const QModelIndex &index, const QVariant &value, int role = Qt::EditRole ); - virtual bool removeRows( int row, int count, const QModelIndex &parent = QModelIndex() ); + QModelIndex index( int row, int column, const QModelIndex &parent = QModelIndex() ) const override; + Qt::ItemFlags flags( const QModelIndex &index ) const override; + QModelIndex parent( const QModelIndex &index ) const override; + int rowCount( const QModelIndex &parent = QModelIndex() ) const override; + bool hasChildren( const QModelIndex &parent = QModelIndex() ) const override; + int columnCount( const QModelIndex &parent = QModelIndex() ) const override; + QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const override; + bool setData( const QModelIndex &index, const QVariant &value, int role = Qt::EditRole ) override; + bool removeRows( int row, int count, const QModelIndex &parent = QModelIndex() ) override; // OpmlDirectoryModel methods virtual void saveOpml( const QUrl &saveLocation ); @@ -68,17 +68,17 @@ void slotAddFolderAction(); protected: - virtual bool canFetchMore( const QModelIndex &parent ) const; - virtual void fetchMore( const QModelIndex &parent ); + bool canFetchMore( const QModelIndex &parent ) const override; + void fetchMore( const QModelIndex &parent ) override; private Q_SLOTS: void slotOpmlHeaderDone(); void slotOpmlOutlineParsed( OpmlOutline * ); void slotOpmlParsingDone(); void slotOpmlWriterDone( int result ); private: - QModelIndex addOutlineToModel( QModelIndex parentIdx, OpmlOutline *oultine ); + QModelIndex addOutlineToModel( const QModelIndex &parentIdx, OpmlOutline *oultine ); QUrl m_rootOpmlUrl; QList m_rootOutlines; diff --git a/src/services/opmldirectory/OpmlDirectoryModel.cpp b/src/services/opmldirectory/OpmlDirectoryModel.cpp --- a/src/services/opmldirectory/OpmlDirectoryModel.cpp +++ b/src/services/opmldirectory/OpmlDirectoryModel.cpp @@ -65,7 +65,7 @@ if( !parentOutline->hasChildren() || parentOutline->children().count() <= row ) return QModelIndex(); - return createIndex( row, column, parentOutline->children()[row] ); + return createIndex( row, column, parentOutline->children().at(row) ); } Qt::ItemFlags @@ -161,7 +161,7 @@ switch( role ) { case Qt::DisplayRole: - return outline->attributes()["text"]; + return outline->attributes().value("text"); case Qt::DecorationRole: return m_imageMap.contains( outline ) ? m_imageMap.value( outline ) : QVariant(); case ActionRole: @@ -301,8 +301,10 @@ connect( buttonBox, &QDialogButtonBox::accepted, dialog, &QDialog::accept ); connect( buttonBox, &QDialogButtonBox::rejected, dialog, &QDialog::reject ); - if( dialog->exec() != QDialog::Accepted ) + if( dialog->exec() != QDialog::Accepted ) { + delete dialog; return; + } QString url = widget.urlEdit->url().url(); QString title = widget.titleEdit->text(); @@ -384,7 +386,7 @@ return; if( outline->attributes().value( "type" ) != "include" ) return; - urlToFetch = QUrl( outline->attributes()["url"] ); + urlToFetch = QUrl( outline->attributes().value("url") ); } if( !urlToFetch.isValid() ) @@ -415,12 +417,12 @@ if( !outline->attributes().contains("text") ) { if( parser->headerData().contains( "title" ) ) - outline->addAttribute( "text", parser->headerData()["title"] ); + outline->addAttribute( "text", parser->headerData().value("title") ); else outline->addAttribute( "text", parser->url().fileName() ); //force a view update - emit dataChanged( idx, idx ); + Q_EMIT dataChanged( idx, idx ); saveOpml( m_rootOpmlUrl ); } @@ -475,9 +477,9 @@ QUrl url; if( outline->attributes().contains( "xmlUrl" ) ) - url = QUrl( outline->attributes()["xmlUrl"] ); + url = QUrl( outline->attributes().value("xmlUrl") ); else if( outline->attributes().contains( "url" ) ) - url = QUrl( outline->attributes()["url"] ); + url = QUrl( outline->attributes().value("url") ); if( url.isEmpty() ) continue; @@ -487,7 +489,7 @@ } QModelIndex -OpmlDirectoryModel::addOutlineToModel( QModelIndex parentIdx, OpmlOutline *outline ) +OpmlDirectoryModel::addOutlineToModel(const QModelIndex &parentIdx, OpmlOutline *outline ) { int newRow = rowCount( parentIdx ); beginInsertRows( parentIdx, newRow, newRow ); diff --git a/src/services/opmldirectory/OpmlDirectoryService.h b/src/services/opmldirectory/OpmlDirectoryService.h --- a/src/services/opmldirectory/OpmlDirectoryService.h +++ b/src/services/opmldirectory/OpmlDirectoryService.h @@ -26,7 +26,6 @@ #include "core/support/Amarok.h" #include -class OpmlOutline; class OpmlDirectoryServiceFactory: public ServiceFactory { @@ -38,9 +37,9 @@ OpmlDirectoryServiceFactory(); virtual ~OpmlDirectoryServiceFactory(); - virtual void init(); - virtual QString name(); - virtual KConfigGroup config(); + void init() override; + QString name() override; + KConfigGroup config() override; }; /** @@ -55,17 +54,17 @@ OpmlDirectoryService( OpmlDirectoryServiceFactory* parent, const QString &name, const QString &prettyName ); - ~OpmlDirectoryService(); + ~OpmlDirectoryService() override; - void polish(); + void polish() override; - virtual Collections::Collection * collection() { return 0; } + Collections::Collection * collection() override { return nullptr; } /* UrlRunnerBase methods */ - virtual QString command() const; - virtual QString prettyCommand() const; - virtual bool run( AmarokUrl url ); - virtual QIcon icon() const { return QIcon::fromTheme( "view-services-opml-amarok" ); } + QString command() const override; + QString prettyCommand() const override; + bool run( const AmarokUrl &url ) override; + QIcon icon() const override { return QIcon::fromTheme( QStringLiteral("view-services-opml-amarok") ); } private Q_SLOTS: void subscribe(); diff --git a/src/services/opmldirectory/OpmlDirectoryService.cpp b/src/services/opmldirectory/OpmlDirectoryService.cpp --- a/src/services/opmldirectory/OpmlDirectoryService.cpp +++ b/src/services/opmldirectory/OpmlDirectoryService.cpp @@ -19,7 +19,7 @@ #include "amarokurls/AmarokUrlHandler.h" #include "core/support/Debug.h" #include "core/support/Components.h" -#include "core/interfaces/Logger.h" +#include "core/logger/Logger.h" #include "browsers/CollectionTreeItem.h" #include "browsers/SingleCollectionTreeItemModel.h" #include "OpmlDirectoryInfoParser.h" @@ -49,7 +49,7 @@ { ServiceBase* service = new OpmlDirectoryService( this, "OpmlDirectory", i18n( "Podcast Directory" ) ); m_initialized = true; - emit newService( service ); + Q_EMIT newService( service ); } @@ -126,16 +126,16 @@ m_subscribeButton = new QPushButton( m_bottomPanel ); m_subscribeButton->setText( i18n( "Subscribe" ) ); m_subscribeButton->setObjectName( "subscribeButton" ); - m_subscribeButton->setIcon( QIcon::fromTheme( "get-hot-new-stuff-amarok" ) ); + m_subscribeButton->setIcon( QIcon::fromTheme( QStringLiteral("get-hot-new-stuff-amarok") ) ); m_subscribeButton->setEnabled( false ); connect( m_subscribeButton, &QPushButton::clicked, this, &OpmlDirectoryService::subscribe ); m_addOpmlButton = new QPushButton( m_bottomPanel ); m_addOpmlButton->setText( i18n( "Add OPML" ) ); - m_addOpmlButton->setObjectName( "addOpmlButton" ); - m_addOpmlButton->setIcon( QIcon::fromTheme( "list-add-amarok" ) ); + m_addOpmlButton->setObjectName( QStringLiteral("addOpmlButton") ); + m_addOpmlButton->setIcon( QIcon::fromTheme( QStringLiteral("list-add-amarok") ) ); connect( m_addOpmlButton, &QPushButton::clicked, dynamic_cast( model() ), &OpmlDirectoryModel::slotAddOpmlAction ); @@ -161,7 +161,7 @@ } bool -OpmlDirectoryService::run( AmarokUrl url ) +OpmlDirectoryService::run(const AmarokUrl &url ) { //make sure this category is shown. AmarokUrl( "amarok://navigate/internet/OpmlDirectory" ).run(); diff --git a/src/services/opmldirectory/OpmlDirectoryView.h b/src/services/opmldirectory/OpmlDirectoryView.h --- a/src/services/opmldirectory/OpmlDirectoryView.h +++ b/src/services/opmldirectory/OpmlDirectoryView.h @@ -26,15 +26,15 @@ { Q_OBJECT public: - explicit OpmlDirectoryView( QWidget *parent = 0 ); + explicit OpmlDirectoryView( QWidget *parent = nullptr ); - virtual void contextMenuEvent( QContextMenuEvent *event ); - virtual void keyPressEvent( QKeyEvent *event ); + void contextMenuEvent( QContextMenuEvent *event ) override; + void keyPressEvent( QKeyEvent *event ) override; protected: //reimplemented to allow only leaf nodes to be selected - virtual QItemSelectionModel::SelectionFlags selectionCommand( const QModelIndex &index, - const QEvent *event = 0 ) const; + QItemSelectionModel::SelectionFlags selectionCommand( const QModelIndex &index, + const QEvent *event = nullptr ) const override; }; diff --git a/src/services/opmldirectory/amarok_service_opmldirectory.desktop b/src/services/opmldirectory/amarok_service_opmldirectory.desktop --- a/src/services/opmldirectory/amarok_service_opmldirectory.desktop +++ b/src/services/opmldirectory/amarok_service_opmldirectory.desktop @@ -50,7 +50,6 @@ Name[uk]=Каталог трансляцій Name[wa]=Ridant des podcasts Name[x-test]=xxPodcast Directoryxx -Name[zh_CN]=播客目录 Name[zh_TW]=Podcast 資料夾 Comment=Browse and subscribe to a huge list of podcasts Comment[bg]=Разглеждане и абониране за голям брой подкастове @@ -100,7 +99,6 @@ Comment[uk]=Перегляньте і підпишіться на трансляції з величезного списку Comment[wa]=Foyter eyet s' abouner a ene djivêye di podcast foû mezeure Comment[x-test]=xxBrowse and subscribe to a huge list of podcastsxx -Comment[zh_CN]=浏览并订阅大量播客列表 Comment[zh_TW]=瀏覽並訂閱大量的 podcast 清單 diff --git a/src/services/scriptable/ScriptableService.h b/src/services/scriptable/ScriptableService.h --- a/src/services/scriptable/ScriptableService.h +++ b/src/services/scriptable/ScriptableService.h @@ -48,18 +48,18 @@ /** * Constructor */ - ScriptableService( const QString &name ); + explicit ScriptableService( const QString &name ); /** * Destructor */ - ~ScriptableService(); + ~ScriptableService() override; void init( int levels, const QString &rootHtml, bool showSearchBar ); - void polish(); + void polish() override; - Collections::ServiceCollection * collection(); + Collections::ServiceCollection * collection() override; int insertItem( int level, int parentId, const QString &name, const QString &infoHtml, const QString &callbackData, const QString &playableUrl, const QString & albumOverride, const QString & artistOverride, const QString & genreOverride, @@ -78,8 +78,8 @@ void setCurrentInfo( const QString & info ); - int contentLevels() { return m_levels; } - bool hasSearchBar() { return m_hasSearchBar; } + int contentLevels() const { return m_levels; } + bool hasSearchBar() const { return m_hasSearchBar; } private Q_SLOTS: diff --git a/src/services/scriptable/ScriptableService.cpp b/src/services/scriptable/ScriptableService.cpp --- a/src/services/scriptable/ScriptableService.cpp +++ b/src/services/scriptable/ScriptableService.cpp @@ -31,7 +31,7 @@ using namespace Meta; ScriptableService::ScriptableService( const QString & name ) - : ServiceBase( name, 0 ) + : ServiceBase( name, nullptr ) , m_polished( false ) , m_name( name ) , m_trackIdCounter( 0 ) @@ -41,7 +41,7 @@ { DEBUG_BLOCK debug() << "creating ScriptableService " << name; - m_collection = 0; + m_collection = nullptr; m_bottomPanel->hide(); } @@ -109,12 +109,12 @@ if ( !m_customEmblem.isNull() ) track->setServiceEmblem( m_customEmblem ); else - track->setServiceEmblem( QPixmap( QStandardPaths::locate( QStandardPaths::GenericDataLocation, "amarok/images/emblem-scripted.png" ) ) ); + track->setServiceEmblem( QPixmap( QStandardPaths::locate( QStandardPaths::GenericDataLocation, QStringLiteral("amarok/images/emblem-scripted.png") ) ) ); if ( !m_customScalableEmblem.isEmpty() ) track->setServiceScalableEmblem( m_customScalableEmblem ); else - track->setServiceEmblem( QStandardPaths::locate( QStandardPaths::GenericDataLocation, "amarok/images/emblem-scripted-scalable.svgz" ) ); + track->setServiceEmblem( QStandardPaths::locate( QStandardPaths::GenericDataLocation, QStringLiteral("amarok/images/emblem-scripted-scalable.svgz") ) ); if ( !albumOverride.isEmpty() ) track->setAlbumName( albumOverride ); @@ -151,12 +151,12 @@ if ( !m_customEmblem.isNull() ) album->setServiceEmblem( m_customEmblem ); else - album->setServiceEmblem( QPixmap( QStandardPaths::locate( QStandardPaths::GenericDataLocation, "amarok/images/emblem-scripted.png" ) ) ); + album->setServiceEmblem( QPixmap( QStandardPaths::locate( QStandardPaths::GenericDataLocation, QStringLiteral("amarok/images/emblem-scripted.png") ) ) ); if ( !m_customScalableEmblem.isEmpty() ) album->setServiceScalableEmblem( m_customScalableEmblem ); else - album->setServiceEmblem( QStandardPaths::locate( QStandardPaths::GenericDataLocation, "amarok/images/emblem-scripted-scalable.svgz" ) ); + album->setServiceEmblem( QStandardPaths::locate( QStandardPaths::GenericDataLocation, QStringLiteral("amarok/images/emblem-scripted-scalable.svgz") ) ); return addAlbum( album ); @@ -177,12 +177,12 @@ if ( !m_customEmblem.isNull() ) artist->setServiceEmblem( m_customEmblem ); else - artist->setServiceEmblem( QPixmap( QStandardPaths::locate( QStandardPaths::GenericDataLocation, "amarok/images/emblem-scripted.png" ) ) ); + artist->setServiceEmblem( QPixmap( QStandardPaths::locate( QStandardPaths::GenericDataLocation, QStringLiteral("amarok/images/emblem-scripted.png") ) ) ); if ( !m_customScalableEmblem.isEmpty() ) artist->setServiceScalableEmblem( m_customScalableEmblem ); else - artist->setServiceEmblem( QStandardPaths::locate( QStandardPaths::GenericDataLocation, "amarok/images/emblem-scripted-scalable.svgz" ) ); + artist->setServiceEmblem( QStandardPaths::locate( QStandardPaths::GenericDataLocation, QStringLiteral("amarok/images/emblem-scripted-scalable.svgz") ) ); return addArtist( artist ); @@ -204,12 +204,12 @@ if ( !m_customEmblem.isNull() ) genre->setServiceEmblem( m_customEmblem ); else - genre->setServiceEmblem( QPixmap( QStandardPaths::locate( QStandardPaths::GenericDataLocation, "amarok/images/emblem-scripted.png" ) ) ); + genre->setServiceEmblem( QPixmap( QStandardPaths::locate( QStandardPaths::GenericDataLocation, QStringLiteral("amarok/images/emblem-scripted.png") ) ) ); if ( !m_customScalableEmblem.isEmpty() ) genre->setServiceScalableEmblem( m_customScalableEmblem ); else - genre->setServiceEmblem( QStandardPaths::locate( QStandardPaths::GenericDataLocation, "amarok/images/emblem-scripted-scalable.svgz" ) ); + genre->setServiceEmblem( QStandardPaths::locate( QStandardPaths::GenericDataLocation, QStringLiteral("amarok/images/emblem-scripted-scalable.svgz") ) ); return addGenre( genre ); diff --git a/src/services/scriptable/ScriptableServiceCollection.h b/src/services/scriptable/ScriptableServiceCollection.h --- a/src/services/scriptable/ScriptableServiceCollection.h +++ b/src/services/scriptable/ScriptableServiceCollection.h @@ -31,11 +31,11 @@ { Q_OBJECT public: - ScriptableServiceCollection( const QString &name ); + explicit ScriptableServiceCollection( const QString &name ); - ~ScriptableServiceCollection(); + ~ScriptableServiceCollection() override; - virtual Collections::QueryMaker* queryMaker(); + Collections::QueryMaker* queryMaker() override; void donePopulating( int parentId ); diff --git a/src/services/scriptable/ScriptableServiceCollection.cpp b/src/services/scriptable/ScriptableServiceCollection.cpp --- a/src/services/scriptable/ScriptableServiceCollection.cpp +++ b/src/services/scriptable/ScriptableServiceCollection.cpp @@ -22,7 +22,7 @@ using namespace Collections; ScriptableServiceCollection::ScriptableServiceCollection( const QString &name ) - : ServiceCollection( 0, name, name ) + : ServiceCollection( nullptr, name, name ) { DEBUG_BLOCK m_name = name; @@ -42,7 +42,7 @@ { DEBUG_BLOCK Q_UNUSED( parentId ); - emit updateComplete(); + Q_EMIT updateComplete(); } void ScriptableServiceCollection::clear() diff --git a/src/services/scriptable/ScriptableServiceCollectionTreeModel.h b/src/services/scriptable/ScriptableServiceCollectionTreeModel.h --- a/src/services/scriptable/ScriptableServiceCollectionTreeModel.h +++ b/src/services/scriptable/ScriptableServiceCollectionTreeModel.h @@ -34,7 +34,7 @@ /** * Overridden to masquerade playlist tracks as MultiTracks */ - virtual QMimeData* mimeData( const QList &items ) const; + QMimeData* mimeData( const QList &items ) const override; }; #endif // SCRIPTABLESERVICECOLLECTIONTREEMODEL_H diff --git a/src/services/scriptable/ScriptableServiceInfoParser.h b/src/services/scriptable/ScriptableServiceInfoParser.h --- a/src/services/scriptable/ScriptableServiceInfoParser.h +++ b/src/services/scriptable/ScriptableServiceInfoParser.h @@ -24,21 +24,21 @@ /** Info parser for the scriptable services - @author +@author Nikolaj Hald Nielsen */ class ScriptableServiceInfoParser : public InfoParserBase { Q_OBJECT public: - ScriptableServiceInfoParser( const QString &serviceName ); + explicit ScriptableServiceInfoParser( const QString &serviceName ); - ~ScriptableServiceInfoParser(); + ~ScriptableServiceInfoParser() override; - virtual void getInfo( Meta::GenrePtr genre ); - virtual void getInfo( Meta::ArtistPtr artist ); - virtual void getInfo( Meta::AlbumPtr album ) ; - virtual void getInfo( Meta::TrackPtr track ); + virtual void getInfo( const Meta::GenrePtr &genre ); + void getInfo( const Meta::ArtistPtr &artist ) override; + void getInfo( const Meta::AlbumPtr &album ) override; + void getInfo( const Meta::TrackPtr &track ) override; private: QString m_serviceName; diff --git a/src/services/scriptable/ScriptableServiceInfoParser.cpp b/src/services/scriptable/ScriptableServiceInfoParser.cpp --- a/src/services/scriptable/ScriptableServiceInfoParser.cpp +++ b/src/services/scriptable/ScriptableServiceInfoParser.cpp @@ -32,56 +32,56 @@ { } -void ScriptableServiceInfoParser::getInfo( ArtistPtr artist ) +void ScriptableServiceInfoParser::getInfo( const ArtistPtr &artist ) { ScriptableServiceArtist * serviceArtist = dynamic_cast< ScriptableServiceArtist * >( artist.data() ); - if (serviceArtist == 0) return; + if (!serviceArtist) return; - emit( info( serviceArtist->description() ) ); + Q_EMIT( info( serviceArtist->description() ) ); if ( serviceArtist->description().isEmpty() ) { showLoading( i18n( "Loading info..." ) ); ScriptManager::instance()->ServiceScriptRequestInfo( m_serviceName, serviceArtist->level(), serviceArtist->callbackString() ); } } -void ScriptableServiceInfoParser::getInfo(AlbumPtr album) +void ScriptableServiceInfoParser::getInfo(const AlbumPtr &album) { DEBUG_BLOCK ScriptableServiceAlbum * serviceAlbum = dynamic_cast< ScriptableServiceAlbum * >( album.data() ); if (serviceAlbum == 0) return; - emit( info( serviceAlbum->description() ) ); + Q_EMIT( info( serviceAlbum->description() ) ); if ( serviceAlbum->description().isEmpty() ) { showLoading( i18n( "Loading info..." ) ); ScriptManager::instance()->ServiceScriptRequestInfo( m_serviceName, serviceAlbum->level(), serviceAlbum->callbackString() ); } } -void ScriptableServiceInfoParser::getInfo(TrackPtr track) +void ScriptableServiceInfoParser::getInfo(const TrackPtr &track) { DEBUG_BLOCK ScriptableServiceTrack * serviceTrack = dynamic_cast< ScriptableServiceTrack * >( track.data() ); - if (serviceTrack == 0) return; + if (!serviceTrack) return; - emit( info( serviceTrack->description() ) ); + Q_EMIT info( serviceTrack->description() ); if ( serviceTrack->description().isEmpty() ) { showLoading( i18n( "Loading info..." ) ); ScriptManager::instance()->ServiceScriptRequestInfo( m_serviceName, serviceTrack->level(), serviceTrack->callbackString() ); } } -void ScriptableServiceInfoParser::getInfo( Meta::GenrePtr genre ) +void ScriptableServiceInfoParser::getInfo( const Meta::GenrePtr &genre ) { ScriptableServiceGenre * serviceGenre = dynamic_cast< ScriptableServiceGenre * >( genre.data() ); - if (serviceGenre == 0) return; + if (!serviceGenre) return; - emit( info( serviceGenre->description() ) ); + Q_EMIT info( serviceGenre->description() ); if ( serviceGenre->description().isEmpty() ) { diff --git a/src/services/scriptable/ScriptableServiceManager.h b/src/services/scriptable/ScriptableServiceManager.h --- a/src/services/scriptable/ScriptableServiceManager.h +++ b/src/services/scriptable/ScriptableServiceManager.h @@ -55,9 +55,11 @@ /** * Initialzises a new service. This method is exported to DBUS - * @param name the name of the service to create. Mujst be the same as the name of the script + * @param name the name of the service to create. Must be the same as the name of the script * @param levels How many levels of items should be added ( 1 - 4 ) + * @param shortDescription Some short description * @param rootHtml The html to display when the service is selected + * @param showSearchBar Determines whether to show search bar * @return returns true if successful and false otherwise */ bool initService( const QString &name, int levels, const QString &shortDescription, const QString &rootHtml, bool showSearchBar ); @@ -71,6 +73,12 @@ * @param infoHtml The html info to display when this item is selected * @param callbackData The callback data needed to let the script know how to populate this items children ( Empty string if leaf item ) * @param playableUrl The url to play if added to the playlist ( Empty string if not leaf node ) + * @param albumOverride The album override + * @param artistOverride The artist override + * @param genreOverride The genre override + * @param composerOverride The composer override + * @param yearOverride The year override + * @param coverUrl The cover URL * @return the id of the created item ( or -1 on failure ) */ int insertItem( const QString &serviceName, int level, int parentId, const QString &name, const QString &infoHtml, const QString &callbackData, const QString &playableUrl, diff --git a/src/services/scriptable/ScriptableServiceManager.cpp b/src/services/scriptable/ScriptableServiceManager.cpp --- a/src/services/scriptable/ScriptableServiceManager.cpp +++ b/src/services/scriptable/ScriptableServiceManager.cpp @@ -28,7 +28,7 @@ using namespace Meta; -ScriptableServiceManager * ScriptableServiceManager::s_instance = 0; +ScriptableServiceManager * ScriptableServiceManager::s_instance = nullptr; ScriptableServiceManager::ScriptableServiceManager() @@ -50,13 +50,13 @@ ScriptableService * service = new ScriptableService ( name ); m_serviceMap[name] = service; - service->setIcon( QIcon::fromTheme( "view-services-scripted-amarok" ) ); + service->setIcon( QIcon::fromTheme( QStringLiteral("view-services-scripted-amarok") ) ); service->setShortDescription( shortDescription ); service->init( levels, rootHtml, showSearchBar ); m_rootHtml = rootHtml; debug() << "emitting scripted service " << name; - emit addService( service ); + Q_EMIT addService( service ); return true; } @@ -123,7 +123,7 @@ m_serviceMap[serviceName]->setIcon( QIcon( icon ) ); - emit( serviceUpdated( m_serviceMap[serviceName] ) ); + Q_EMIT( serviceUpdated( m_serviceMap[serviceName] ) ); } void ScriptableServiceManager::setEmblem( const QString & serviceName, const QPixmap & emblem ) @@ -134,7 +134,7 @@ } m_serviceMap[serviceName]->setCustomEmblem( emblem ); - emit( serviceUpdated( m_serviceMap[serviceName] ) ); + Q_EMIT( serviceUpdated( m_serviceMap[serviceName] ) ); } @@ -146,7 +146,7 @@ } m_serviceMap[serviceName]->setCustomScalableEmblem( emblemPath ); - emit( serviceUpdated( m_serviceMap[serviceName] ) ); + Q_EMIT( serviceUpdated( m_serviceMap[serviceName] ) ); } @@ -165,7 +165,7 @@ ScriptableServiceManager* scriptableServiceManager() { - if ( ScriptableServiceManager::s_instance == 0 ) + if ( ScriptableServiceManager::s_instance == nullptr ) ScriptableServiceManager::s_instance = new ScriptableServiceManager(); return ScriptableServiceManager::s_instance; diff --git a/src/services/scriptable/ScriptableServiceMeta.h b/src/services/scriptable/ScriptableServiceMeta.h --- a/src/services/scriptable/ScriptableServiceMeta.h +++ b/src/services/scriptable/ScriptableServiceMeta.h @@ -36,7 +36,7 @@ class ScriptableServiceMetaItem { public: - ScriptableServiceMetaItem( int level ); + explicit ScriptableServiceMetaItem( int level ); void setCallbackString( const QString &callbackString ); QString callbackString() const; @@ -64,13 +64,13 @@ class ScriptableServiceTrack : public Meta::ServiceTrack, public ScriptableServiceMetaItem { public: - ScriptableServiceTrack( const QString &name ); - ScriptableServiceTrack( const QStringList &resultRow ); + explicit ScriptableServiceTrack( const QString &name ); + explicit ScriptableServiceTrack( const QStringList &resultRow ); - virtual QString sourceName(); - virtual QString sourceDescription(); - virtual QPixmap emblem(); - virtual QString scalableEmblem(); + QString sourceName() override; + QString sourceDescription() override; + QPixmap emblem() override; + QString scalableEmblem() override; void setAlbumName( const QString &newAlbum ); void setArtistName( const QString &newArtist ); @@ -80,8 +80,8 @@ void setCustomAlbumCoverUrl( const QString &coverurl ); - virtual QString collectionName() const { return m_serviceName; } - virtual void setUidUrl( const QString &url ); + QString collectionName() const override { return m_serviceName; } + void setUidUrl( const QString &url ) override; /** * If this track is in fact a remote playlist, return Meta::MultiTrack that wraps @@ -96,23 +96,23 @@ class ScriptableServiceAlbum : public Meta::ServiceAlbumWithCover, public ScriptableServiceMetaItem { public: - ScriptableServiceAlbum( const QString &name ); - ScriptableServiceAlbum( const QStringList &resultRow ); + explicit ScriptableServiceAlbum( const QString &name ); + explicit ScriptableServiceAlbum( const QStringList &resultRow ); - virtual QString downloadPrefix() const { return "script"; } - virtual void setCoverUrl( const QString &coverUrl ) { m_coverUrl = coverUrl; } - virtual QString coverUrl() const { return m_coverUrl; } + QString downloadPrefix() const override { return QStringLiteral("script"); } + void setCoverUrl( const QString &coverUrl ) override { m_coverUrl = coverUrl; } + QString coverUrl() const override { return m_coverUrl; } - virtual QUrl imageLocation( int size = 1 ) { Q_UNUSED( size ); return QUrl( coverUrl() ); } + QUrl imageLocation( int size = 1 ) override { Q_UNUSED( size ); return QUrl( coverUrl() ); } - virtual QString sourceName(); - virtual QString sourceDescription(); - virtual QPixmap emblem(); - virtual QString scalableEmblem(); + QString sourceName() override; + QString sourceDescription() override; + QPixmap emblem() override; + QString scalableEmblem() override; - virtual bool isBookmarkable() const; - virtual QString collectionName() const { return m_serviceName; } - virtual bool simpleFiltering() const { return true; } + bool isBookmarkable() const override; + QString collectionName() const override { return m_serviceName; } + bool simpleFiltering() const override { return true; } private: QString m_coverUrl; @@ -122,20 +122,20 @@ class ScriptableServiceArtist : public Meta::ServiceArtist, public ScriptableServiceMetaItem { public: - ScriptableServiceArtist( const QString &name ); - ScriptableServiceArtist( const QStringList &resultRow ); + explicit ScriptableServiceArtist( const QString &name ); + explicit ScriptableServiceArtist( const QStringList &resultRow ); void setGenreId( int artistId ); int genreId() const; - virtual QString sourceName(); - virtual QString sourceDescription(); - virtual QPixmap emblem(); - virtual QString scalableEmblem(); + QString sourceName() override; + QString sourceDescription() override; + QPixmap emblem() override; + QString scalableEmblem() override; - virtual bool isBookmarkable() const; - virtual QString collectionName() const { return m_serviceName; } - virtual bool simpleFiltering() const { return true; } + bool isBookmarkable() const override; + QString collectionName() const override { return m_serviceName; } + bool simpleFiltering() const override { return true; } private: int m_genreId; @@ -145,16 +145,16 @@ class ScriptableServiceGenre : public Meta::ServiceGenre, public ScriptableServiceMetaItem { public: - ScriptableServiceGenre( const QString &name ); - ScriptableServiceGenre( const QStringList &resultRow ); + explicit ScriptableServiceGenre( const QString &name ); + explicit ScriptableServiceGenre( const QStringList &resultRow ); void setDescription( const QString &description ); QString description(); - virtual QString sourceName(); - virtual QString sourceDescription(); - virtual QPixmap emblem(); - virtual QString scalableEmblem(); + QString sourceName() override; + QString sourceDescription() override; + QPixmap emblem() override; + QString scalableEmblem() override; private: QString m_description; diff --git a/src/services/scriptable/ScriptableServiceMeta_p.h b/src/services/scriptable/ScriptableServiceMeta_p.h --- a/src/services/scriptable/ScriptableServiceMeta_p.h +++ b/src/services/scriptable/ScriptableServiceMeta_p.h @@ -37,7 +37,7 @@ /** - * Base class for the private meta types. This is used to give these private items source info capability which is neede in some cases,for instance when bookmarking. + * Base class for the private meta types. This is used to give these private items source info capability which is needed in some cases,for instance when bookmarking. */ class ScriptableServiceInternalMetaItem { @@ -64,16 +64,16 @@ class AMAROK_EXPORT ScriptableServiceInternalSourceInfoCapability : public Capabilities::SourceInfoCapability { public: - ScriptableServiceInternalSourceInfoCapability( ScriptableServiceInternalMetaItem * sourceInfoProvider ) + explicit ScriptableServiceInternalSourceInfoCapability( ScriptableServiceInternalMetaItem * sourceInfoProvider ) { m_sourceInfoProvider = sourceInfoProvider; } - ~ScriptableServiceInternalSourceInfoCapability() {}; + ~ScriptableServiceInternalSourceInfoCapability() {} - QString sourceName() { return m_sourceInfoProvider->serviceName(); } - QString sourceDescription() { return m_sourceInfoProvider->serviceDescription(); } - QPixmap emblem() { return m_sourceInfoProvider->serviceEmblem(); } - QString scalableEmblem() { return m_sourceInfoProvider->serviceScalableEmblem(); } + QString sourceName() override { return m_sourceInfoProvider->serviceName(); } + QString sourceDescription() override { return m_sourceInfoProvider->serviceDescription(); } + QPixmap emblem() override { return m_sourceInfoProvider->serviceEmblem(); } + QString scalableEmblem() override { return m_sourceInfoProvider->serviceScalableEmblem(); } private: @@ -85,35 +85,35 @@ class ScriptableServiceInternalArtist : public Meta::Artist, public ScriptableServiceInternalMetaItem { public: - ScriptableServiceInternalArtist( const QString &name = QString() ) + explicit ScriptableServiceInternalArtist( const QString &name = QString() ) : Meta::Artist() , m_name( name ) {} - Meta::TrackList tracks() + Meta::TrackList tracks() override { return Meta::TrackList(); } - QString name() const + QString name() const override { if( !m_name.isEmpty() ) return m_name; else return i18nc( "The value is not known", "Unknown" ); } - QString prettyName() const + QString prettyName() const override { return name(); } - virtual bool hasCapabilityInterface( Capabilities::Capability::Type type ) const + bool hasCapabilityInterface( Capabilities::Capability::Type type ) const override { return ( type == Capabilities::Capability::SourceInfo ); } - virtual Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ) + Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ) override { if ( type == Capabilities::Capability::SourceInfo ) return new ScriptableServiceInternalSourceInfoCapability( this ); @@ -128,56 +128,56 @@ class ScriptableServiceInternalAlbum : public Meta::ServiceAlbumWithCover, public ScriptableServiceInternalMetaItem { public: - ScriptableServiceInternalAlbum( const QString &name = QString() ) + explicit ScriptableServiceInternalAlbum( const QString &name = QString() ) : Meta::ServiceAlbumWithCover( QString() ) , m_name( name ) {} - bool isCompilation() const + bool isCompilation() const override { return false; } - bool hasAlbumArtist() const + bool hasAlbumArtist() const override { return false; } - Meta::ArtistPtr albumArtist() const + Meta::ArtistPtr albumArtist() const override { return Meta::ArtistPtr(); } - Meta::TrackList tracks() + Meta::TrackList tracks() override { return Meta::TrackList(); } - QString name() const + QString name() const override { if( !m_name.isEmpty() ) return m_name; else return i18nc( "The value is not known", "Unknown" ); } - QString prettyName() const + QString prettyName() const override { return name(); } - virtual QString downloadPrefix() const { return "script"; } - virtual void setCoverUrl( const QString &coverUrl ) { m_coverUrl = coverUrl; } - virtual QString coverUrl() const { return m_coverUrl; } + QString downloadPrefix() const override { return QStringLiteral("script"); } + void setCoverUrl( const QString &coverUrl ) override { m_coverUrl = coverUrl; } + QString coverUrl() const override { return m_coverUrl; } - virtual QUrl imageLocation( int size = 1 ) { Q_UNUSED( size ); return QUrl( coverUrl() ); } + QUrl imageLocation( int size = 1 ) override { Q_UNUSED( size ); return QUrl( coverUrl() ); } - virtual bool hasCapabilityInterface( Capabilities::Capability::Type type ) const + bool hasCapabilityInterface( Capabilities::Capability::Type type ) const override { return ( type == Capabilities::Capability::SourceInfo ); } - virtual Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ) + Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ) override { if ( type == Capabilities::Capability::SourceInfo ) return new ScriptableServiceInternalSourceInfoCapability( this ); @@ -192,35 +192,35 @@ class ScriptableServiceInternalGenre : public Meta::Genre, public ScriptableServiceInternalMetaItem { public: - ScriptableServiceInternalGenre( const QString &name = QString() ) + explicit ScriptableServiceInternalGenre( const QString &name = QString() ) : Meta::Genre() , m_name( name ) {} - Meta::TrackList tracks() + Meta::TrackList tracks() override { return Meta::TrackList(); } - QString name() const + QString name() const override { if( !m_name.isEmpty() ) return m_name; else return i18nc( "The value is not known", "Unknown" ); } - QString prettyName() const + QString prettyName() const override { return name(); } - virtual bool hasCapabilityInterface( Capabilities::Capability::Type type ) const + bool hasCapabilityInterface( Capabilities::Capability::Type type ) const override { return ( type == Capabilities::Capability::SourceInfo ); } - virtual Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ) + Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ) override { if ( type == Capabilities::Capability::SourceInfo ) return new ScriptableServiceInternalSourceInfoCapability( this ); @@ -234,36 +234,36 @@ class ScriptableServiceInternalComposer : public Meta::Composer, public ScriptableServiceInternalMetaItem { public: - ScriptableServiceInternalComposer( const QString &name = QString() ) + explicit ScriptableServiceInternalComposer( const QString &name = QString() ) : Meta::Composer() , m_name( name ) {} - Meta::TrackList tracks() + Meta::TrackList tracks() override { return Meta::TrackList(); } - QString name() const + QString name() const override { if( !m_name.isEmpty() ) return m_name; else return i18nc( "The value is not known", "Unknown" ); } - QString prettyName() const + QString prettyName() const override { return name(); } - virtual bool hasCapabilityInterface( Capabilities::Capability::Type type ) const + bool hasCapabilityInterface( Capabilities::Capability::Type type ) const override { return ( type == Capabilities::Capability::SourceInfo ); } - virtual Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ) + Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ) override { if ( type == Capabilities::Capability::SourceInfo ) return new ScriptableServiceInternalSourceInfoCapability( this ); @@ -277,35 +277,35 @@ class ScriptableServiceInternalYear : public Meta::Year, public ScriptableServiceInternalMetaItem { public: - ScriptableServiceInternalYear( const QString &name = QString() ) + explicit ScriptableServiceInternalYear( const QString &name = QString() ) : Meta::Year() , m_name( name ) {} - Meta::TrackList tracks() + Meta::TrackList tracks() override { return Meta::TrackList(); } - QString name() const + QString name() const override { if( !m_name.isEmpty() ) return m_name; else return i18nc( "The value is not known", "Unknown" ); } - QString prettyName() const + QString prettyName() const override { return name(); } - virtual bool hasCapabilityInterface( Capabilities::Capability::Type type ) const + bool hasCapabilityInterface( Capabilities::Capability::Type type ) const override { return ( type == Capabilities::Capability::SourceInfo ); } - virtual Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ) + Capabilities::Capability* createCapabilityInterface( Capabilities::Capability::Type type ) override { if ( type == Capabilities::Capability::SourceInfo ) return new ScriptableServiceInternalSourceInfoCapability( this ); diff --git a/src/services/scriptable/ScriptableServiceQueryMaker.h b/src/services/scriptable/ScriptableServiceQueryMaker.h --- a/src/services/scriptable/ScriptableServiceQueryMaker.h +++ b/src/services/scriptable/ScriptableServiceQueryMaker.h @@ -26,29 +26,29 @@ namespace Collections { /** - * A query maker for fetching external data from scripred services. + * A query maker for fetching external data from scripted services. */ class ScriptableServiceQueryMaker : public DynamicServiceQueryMaker { Q_OBJECT public: - ScriptableServiceQueryMaker( ScriptableServiceCollection * collection, QString name ); + ScriptableServiceQueryMaker( ScriptableServiceCollection * collection, const QString &name ); ~ScriptableServiceQueryMaker(); - virtual void run(); - virtual void abortQuery(); + void run() override; + void abortQuery() override; - virtual QueryMaker* setQueryType( QueryType type ); + QueryMaker* setQueryType( QueryType type ) override; - virtual QueryMaker* addFilter( qint64 value, const QString &filter, bool matchBegin = false, bool matchEnd = false ); + QueryMaker* addFilter( qint64 value, const QString &filter, bool matchBegin = false, bool matchEnd = false ) override; using QueryMaker::addMatch; - virtual QueryMaker* addMatch( const Meta::GenrePtr &genre ); - virtual QueryMaker* addMatch( const Meta::ArtistPtr &artist, ArtistMatchBehaviour behaviour = TrackArtists ); - virtual QueryMaker* addMatch( const Meta::AlbumPtr &album ); + QueryMaker* addMatch( const Meta::GenrePtr &genre ) override; + QueryMaker* addMatch( const Meta::ArtistPtr &artist, ArtistMatchBehaviour behaviour = TrackArtists ) override; + QueryMaker* addMatch( const Meta::AlbumPtr &album ) override; - virtual QueryMaker* setAlbumQueryMode( AlbumQueryMode mode ); + QueryMaker* setAlbumQueryMode( AlbumQueryMode mode ) override; // ScriptableServiceQueryMaker-specific methods diff --git a/src/services/scriptable/ScriptableServiceQueryMaker.cpp b/src/services/scriptable/ScriptableServiceQueryMaker.cpp --- a/src/services/scriptable/ScriptableServiceQueryMaker.cpp +++ b/src/services/scriptable/ScriptableServiceQueryMaker.cpp @@ -41,7 +41,7 @@ QString lastFilter; }; -ScriptableServiceQueryMaker::ScriptableServiceQueryMaker( ScriptableServiceCollection * collection, QString name ) +ScriptableServiceQueryMaker::ScriptableServiceQueryMaker( ScriptableServiceCollection * collection, const QString &name ) : DynamicServiceQueryMaker() , d( new Private ) , m_convertToMultiTracks( false ) @@ -76,7 +76,7 @@ return; if ( d->callbackString.isEmpty() ) - d->callbackString = "none"; + d->callbackString = QStringLiteral("none"); if ( d->type == Private::GENRE ) { @@ -196,25 +196,25 @@ void ScriptableServiceQueryMaker::handleResult( const Meta::GenreList & genres ) { if ( d->maxsize >= 0 && genres.count() > d->maxsize ) - emit newGenresReady( genres.mid( 0, d->maxsize ) ); + Q_EMIT newGenresReady( genres.mid( 0, d->maxsize ) ); else - emit newGenresReady( genres ); + Q_EMIT newGenresReady( genres ); } void ScriptableServiceQueryMaker::handleResult( const Meta::AlbumList & albums ) { if ( d->maxsize >= 0 && albums.count() > d->maxsize ) - emit newAlbumsReady( albums.mid( 0, d->maxsize ) ); + Q_EMIT newAlbumsReady( albums.mid( 0, d->maxsize ) ); else - emit newAlbumsReady( albums ); + Q_EMIT newAlbumsReady( albums ); } void ScriptableServiceQueryMaker::handleResult( const Meta::ArtistList & artists ) { if ( d->maxsize >= 0 && artists.count() > d->maxsize ) - emit newArtistsReady( artists.mid( 0, d->maxsize ) ); + Q_EMIT newArtistsReady( artists.mid( 0, d->maxsize ) ); else - emit newArtistsReady( artists ); + Q_EMIT newArtistsReady( artists ); } void ScriptableServiceQueryMaker::handleResult( const Meta::TrackList &tracks ) @@ -239,9 +239,9 @@ ret = tracks; if ( d->maxsize >= 0 && ret.count() > d->maxsize ) - emit newTracksReady( ret.mid( 0, d->maxsize ) ); + Q_EMIT newTracksReady( ret.mid( 0, d->maxsize ) ); else - emit newTracksReady( ret ); + Q_EMIT newTracksReady( ret ); } void ScriptableServiceQueryMaker::fetchGenre() @@ -252,7 +252,7 @@ if ( genre.count() > 0 ) { handleResult( genre ); - emit( queryDone() ); + Q_EMIT( queryDone() ); } else //this is where we call the script to get it to add more stuff! @@ -284,7 +284,7 @@ if ( artists.count() > 0 ) { handleResult( artists ); - emit( queryDone() ); + Q_EMIT( queryDone() ); } else //this is where we call the script to get it to add more stuff! @@ -310,7 +310,7 @@ if ( albums.count() > 0 ) { handleResult( albums ); - emit( queryDone() ); + Q_EMIT( queryDone() ); } else //this is where we call the script to get it to add more stuff! @@ -336,7 +336,7 @@ if ( tracks.count() > 0 ) { handleResult( tracks ); - emit( queryDone() ); + Q_EMIT( queryDone() ); } else //this is where we call the script to get it to add more stuff! @@ -410,7 +410,7 @@ debug() << "there are " << tracks.count() << " tracks"; handleResult( tracks ); } - emit( queryDone() ); + Q_EMIT( queryDone() ); } QueryMaker * ScriptableServiceQueryMaker::setAlbumQueryMode( AlbumQueryMode mode ) @@ -430,7 +430,7 @@ { //I am sure there is a really good reason to add this space, as nothing works if it is removed, but WHY?!? d->filter += filter + ' '; - d->filter = d->filter.replace( ' ', "%20" ); + d->filter = d->filter.replace( ' ', QLatin1String("%20") ); } int level = 0; diff --git a/src/statemanagement/ApplicationController.h b/src/statemanagement/ApplicationController.h --- a/src/statemanagement/ApplicationController.h +++ b/src/statemanagement/ApplicationController.h @@ -26,7 +26,7 @@ { Q_OBJECT public: - ApplicationController( QObject *parent ) : QObject( parent ) {} + explicit ApplicationController( QObject *parent ) : QObject( parent ) {} virtual ~ ApplicationController() {} public Q_SLOTS: diff --git a/src/statemanagement/DefaultApplicationController.h b/src/statemanagement/DefaultApplicationController.h --- a/src/statemanagement/DefaultApplicationController.h +++ b/src/statemanagement/DefaultApplicationController.h @@ -25,15 +25,14 @@ { Q_OBJECT public: - DefaultApplicationController( QObject *parent ); - virtual ~ DefaultApplicationController(); + explicit DefaultApplicationController( QObject *parent ); + ~DefaultApplicationController() override; public Q_SLOTS: - virtual void start(); - virtual void shutdown(); + void start() override; + void shutdown() override; private: - void initCoreServiceProxies(); void initSqlStorage(); void initEngineController(); void initCollectionManager(); diff --git a/src/statemanagement/DefaultApplicationController.cpp b/src/statemanagement/DefaultApplicationController.cpp --- a/src/statemanagement/DefaultApplicationController.cpp +++ b/src/statemanagement/DefaultApplicationController.cpp @@ -20,7 +20,6 @@ #include "EngineController.h" #include "core-impl/collections/support/CollectionLocationDelegateImpl.h" -#include "core-impl/logger/ProxyLogger.h" #include @@ -44,7 +43,6 @@ DefaultApplicationController::start() { //construct all central components - initCoreServiceProxies(); initSqlStorage(); initEngineController(); initCollectionManager(); @@ -60,19 +58,6 @@ delete Components::setEngineController( 0 ); delete Components::setCollectionLocationDelegate( 0 ); - delete Components::setLogger( 0 ); -} - -void -DefaultApplicationController::initCoreServiceProxies() -{ - //we have core services that (e.g. StatusBar) that - //basically all other components could sensibly use - //unfortunately some of these components are GUI - //components and can only be constructed quite late - //therefore we provide proxies here that won't do anything, but forward - //to the real implementation as soon as possible - Components::setLogger( new ProxyLogger() ); } void diff --git a/src/statsyncing/Config.h b/src/statsyncing/Config.h --- a/src/statsyncing/Config.h +++ b/src/statsyncing/Config.h @@ -38,13 +38,13 @@ enum { ProviderIdRole = Qt::UserRole }; - virtual ~Config(); + ~Config() override; // QAbstractListModel methods: - virtual int rowCount( const QModelIndex &parent = QModelIndex() ) const; - virtual QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const; - virtual bool setData( const QModelIndex &index, const QVariant &value, int role = Qt::EditRole ); - virtual Qt::ItemFlags flags( const QModelIndex &index ) const; + int rowCount( const QModelIndex &parent = QModelIndex() ) const override; + QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const override; + bool setData( const QModelIndex &index, const QVariant &value, int role = Qt::EditRole ) override; + Qt::ItemFlags flags( const QModelIndex &index ) const override; // own methods: /** @@ -127,7 +127,7 @@ friend class Controller; // Only StatSyncing::Controller can construct config - Config( QObject *parent = 0 ); + Config( QObject *parent = nullptr ); QList m_providerData; qint64 m_checkedFields; diff --git a/src/statsyncing/Config.cpp b/src/statsyncing/Config.cpp --- a/src/statsyncing/Config.cpp +++ b/src/statsyncing/Config.cpp @@ -25,13 +25,12 @@ #include #include -#include #include namespace StatSyncing { struct ProviderData { - ProviderData( QString id_, QString name_, QIcon icon_, bool online_, bool enabled_ ) + ProviderData( const QString &id_, const QString &name_, const QIcon &icon_, bool online_, bool enabled_ ) : id( id_ ), name( name_ ), icon( icon_ ), online( online_ ), enabled( enabled_ ) {} @@ -118,7 +117,7 @@ Qt::CheckState state = Qt::CheckState( value.toInt() ); m_providerData[ index.row() ].enabled = ( state == Qt::Checked ) ? true : false; m_hasChanged = true; - emit dataChanged( index, index ); + Q_EMIT dataChanged( index, index ); return true; } @@ -149,7 +148,7 @@ { m_providerData[ i ] = providerData; m_hasChanged = true; - emit dataChanged( index( i ), index( i ) ); + Q_EMIT dataChanged( index( i ), index( i ) ); return; } } @@ -181,7 +180,7 @@ it.remove(); m_hasChanged = true; endRemoveRows(); - emit providerForgotten( id ); + Q_EMIT providerForgotten( id ); return true; } i++; @@ -268,7 +267,7 @@ void Config::read() { - KConfigGroup group = Amarok::config( "StatSyncing" ); + KConfigGroup group = Amarok::config( QStringLiteral("StatSyncing") ); QStringList providerIds = group.readEntry( "providerIds", QStringList() ); QStringList providerNames = group.readEntry( "providerNames", QStringList() ); @@ -288,8 +287,8 @@ endResetModel(); m_checkedFields = 0; - QStringList fieldNames = group.readEntry( "checkedFields", QStringList( "FIRST" ) ); - if( fieldNames == QStringList( "FIRST" ) ) + QStringList fieldNames = group.readEntry( "checkedFields", QStringList( QStringLiteral("FIRST") ) ); + if( fieldNames == QStringList( QStringLiteral("FIRST") ) ) m_checkedFields = Meta::valRating | Meta::valFirstPlayed | Meta::valLastPlayed | Meta::valPlaycount | Meta::valLabel; else @@ -316,7 +315,7 @@ providerEnabledStatuses << data.enabled; } - KConfigGroup group = Amarok::config( "StatSyncing" ); + KConfigGroup group = Amarok::config( QStringLiteral("StatSyncing") ); group.writeEntry( "providerIds", providerIds ); group.writeEntry( "providerNames", providerNames ); group.writeEntry( "providerEnabledStatuses", providerEnabledStatuses ); diff --git a/src/statsyncing/Controller.h b/src/statsyncing/Controller.h --- a/src/statsyncing/Controller.h +++ b/src/statsyncing/Controller.h @@ -18,7 +18,7 @@ #define STATSYNCING_CONTROLLER_H #include "amarok_export.h" -// for CollectionManager::CollectionStatus that cannont be fwd-declared +// for CollectionManager::CollectionStatus that cannot be fwd-declared #include "core-impl/collections/support/CollectionManager.h" #include @@ -49,7 +49,7 @@ Q_OBJECT public: - explicit Controller( QObject *parent = 0 ); + explicit Controller( QObject *parent = nullptr ); ~Controller(); /** @@ -67,19 +67,20 @@ virtual void registerProvider( const ProviderPtr &provider ); /** - * Forget about StatSyncing::Provider @param provider. + * Forget about StatSyncing::Provider @p provider. + * @param provider the provider */ virtual void unregisterProvider( const ProviderPtr &provider ); /** * Handle plugin factories derived from ProviderFactory, used for creating * multiple provider instances. This method is called by Amarok's plugin * infrastructure. */ - void setFactories( const QList &factories ); + void setFactories( const QList > &factories ); /** - * Returns true if any instantiable provider types are registered with the + * Returns true if any instantiatable provider types are registered with the * controller. */ bool hasProviderFactories() const; @@ -164,8 +165,10 @@ void trackScrobbled( const ScrobblingServicePtr &service, const Meta::TrackPtr &track ); /** - * Emitted when a scrobbling service @service was unable to scrobble() a track. + * Emitted when a scrobbling service @p service was unable to scrobble() a track. * + * @param service the service + * @param track the track * @param error is a ScrobblingService::ScrobbleError enum value. */ void scrobbleFailed( const ScrobblingServicePtr &service, const Meta::TrackPtr &track, int error ); @@ -175,13 +178,13 @@ * Creates new instance of provider type identified by @param type * with configuration stored in @param config. */ - void createProvider( QString type, QVariantMap config ); + void createProvider( const QString &type, const QVariantMap &config ); /** * Reconfigures provider identified by @param id with configuration * stored in @param config. */ - void reconfigureProvider( QString id, QVariantMap config ); + void reconfigureProvider( const QString &id, const QVariantMap &config ); /** * Can only be connected to provider changed() signal @@ -212,7 +215,7 @@ * Return true if important metadata of both tracks is equal. */ bool tracksVirtuallyEqual( const Meta::TrackPtr &first, const Meta::TrackPtr &second ); - QMap m_providerFactories; + QMap > m_providerFactories; // synchronization-related ProviderPtrList m_providers; @@ -226,7 +229,7 @@ * milliseconds to let the collection settle down. Moreover, if the newly * added collection emits updated(), the timeout will run from start again. * - * (reason: e.g. iPod Collectin appears quickly, but with no tracks, which + * (reason: e.g. iPod Collection appears quickly, but with no tracks, which * are added gradually as they are parsed. This "ensures" we only start * syncing as soon as all tracks are parsed.) */ diff --git a/src/statsyncing/Controller.cpp b/src/statsyncing/Controller.cpp --- a/src/statsyncing/Controller.cpp +++ b/src/statsyncing/Controller.cpp @@ -21,7 +21,7 @@ #include "ProviderFactory.h" #include "amarokconfig.h" #include "core/collections/Collection.h" -#include "core/interfaces/Logger.h" +#include "core/logger/Logger.h" #include "core/meta/Meta.h" #include "core/support/Amarok.h" #include "core/support/Components.h" @@ -70,7 +70,7 @@ // little to prevent frequent updates of rapidly - changing metadata connect( engine, &EngineController::trackChanged, m_updateNowPlayingTimer, QOverload<>::of(&QTimer::start) ); - // following is needed for streams that don't emit newTrackPlaying on song change + // following is needed for streams that don't Q_EMIT newTrackPlaying on song change connect( engine, &EngineController::trackMetadataChanged, m_updateNowPlayingTimer, QOverload<>::of(&QTimer::start) ); connect( m_updateNowPlayingTimer, &QTimer::timeout, @@ -149,11 +149,11 @@ } void -Controller::setFactories( const QList &factories ) +Controller::setFactories( const QList > &factories ) { - foreach( Plugins::PluginFactory *pFactory, factories ) + for( const auto &pFactory : factories ) { - ProviderFactory *factory = qobject_cast( pFactory ); + auto factory = qobject_cast( pFactory ); if( !factory ) continue; @@ -200,7 +200,7 @@ Controller::providerCreationDialog() const { CreateProviderDialog *dialog = new CreateProviderDialog( The::mainWindow() ); - foreach( ProviderFactory * const factory, m_providerFactories ) + for( const auto &factory : m_providerFactories ) dialog->addProviderType( factory->type(), factory->prettyName(), factory->icon(), factory->createConfigWidget() ); @@ -213,14 +213,14 @@ } void -Controller::createProvider( QString type, QVariantMap config ) +Controller::createProvider( const QString &type, const QVariantMap &config ) { Q_ASSERT( m_providerFactories.contains( type ) ); m_providerFactories[type]->createProvider( config ); } void -Controller::reconfigureProvider( QString id, QVariantMap config ) +Controller::reconfigureProvider( const QString &id, const QVariantMap &config ) { ProviderPtr provider = findRegisteredProvider( id ); if( provider ) @@ -269,9 +269,9 @@ { ScrobblingService::ScrobbleError error = service->scrobble( track, playedFraction, time ); if( error == ScrobblingService::NoError ) - emit trackScrobbled( service, track ); + Q_EMIT trackScrobbled( service, track ); else - emit scrobbleFailed( service, track, error ); + Q_EMIT scrobbleFailed( service, track, error ); } } @@ -371,13 +371,13 @@ } if( usedProviders.isEmpty() ) return; // nothing to do - if( usedProviders.count() == 1 && usedProviders.first()->id() == "localCollection" ) + if( usedProviders.count() == 1 && usedProviders.first()->id() == QLatin1String("localCollection") ) { if( mode == StatSyncing::Process::Interactive ) { QString text = i18n( "You only seem to have the Local Collection. Statistics " "synchronization only makes sense if there is more than one collection." ); - Amarok::Components::logger()->longMessage( text ); + Amarok::Logger::longMessage( text ); } return; } diff --git a/src/statsyncing/Process.h b/src/statsyncing/Process.h --- a/src/statsyncing/Process.h +++ b/src/statsyncing/Process.h @@ -59,13 +59,18 @@ /** * Creates the synchronization process that will offer user to synchronize - * @param fields of @param providers. If @param mode is Interactive, + * @p checkedFields of @p providers. If @p mode is Interactive, * introductory dialog will be shown that allows subset of fields and - * providers to be chosen. Otherwise performs the syncing ing the background + * providers to be chosen. Otherwise performs the syncing in the background * and shows a window only if conflict occurs. + * @param providers the providers + * @param preSelectedProviders the preselected providers + * @param checkedFields the fields + * @param mode the mode + * @param parent the parent QObject */ Process( const ProviderPtrList &providers, const ProviderPtrSet &preSelectedProviders, - qint64 checkedFields, Mode mode, QObject *parent = 0 ); + qint64 checkedFields, Mode mode, QObject *parent = nullptr ); virtual ~Process(); public Q_SLOTS: diff --git a/src/statsyncing/Process.cpp b/src/statsyncing/Process.cpp --- a/src/statsyncing/Process.cpp +++ b/src/statsyncing/Process.cpp @@ -18,7 +18,7 @@ #include "MainWindow.h" #include "MetaValues.h" -#include "core/interfaces/Logger.h" +#include "core/logger/Logger.h" #include "core/support/Amarok.h" #include "core/support/Debug.h" #include "core/support/Components.h" @@ -47,7 +47,7 @@ { m_dialog->setWindowTitle( i18n( "Synchronize Statistics" ) ); m_dialog->resize( QSize( 860, 500 ) ); - KWindowConfig::restoreWindowSize( m_dialog->windowHandle(), Amarok::config( "StatSyncingDialog" ) ); + KWindowConfig::restoreWindowSize( m_dialog->windowHandle(), Amarok::config( QStringLiteral("StatSyncingDialog") ) ); // delete this process when user hits the close button connect( m_dialog.data(), &QDialog::finished, this, &Process::slotSaveSizeAndDelete ); @@ -127,7 +127,7 @@ } else // background operation { - Amarok::Components::logger()->newProgressOperation( job, text, 100, job, SLOT(abort()) ); + Amarok::Logger::newProgressOperation( job, text, 100, job, &MatchTracksJob::abort ); } connect( job, &StatSyncing::MatchTracksJob::done, this, &Process::slotTracksMatched ); @@ -228,7 +228,7 @@ SynchronizeTracksJob *job = new SynchronizeTracksJob( m_matchedTracksModel->matchedTuples(), m_tracksToScrobble, m_options ); QString text = i18n( "Synchronizing Track Statistics" ); - Amarok::Components::logger()->newProgressOperation( job, text, 100, job, SLOT(abort()) ); + Amarok::Logger::newProgressOperation( job, text, 100, job, &SynchronizeTracksJob::abort ); connect( job, &StatSyncing::SynchronizeTracksJob::done, this, &Process::slotLogSynchronization ); connect( job, &StatSyncing::SynchronizeTracksJob::done, job, &StatSyncing::SynchronizeTracksJob::deleteLater ); ThreadWeaver::Queue::instance()->enqueue( QSharedPointer(job) ); @@ -297,15 +297,15 @@ "Scrobbling of %1 tracks was skipped as configured by the user.", scrobbleErrorCounts[ ScrobblingService::SkippedByUser ] ); - Amarok::Components::logger()->longMessage( text.join( "
\n" ) ); + Amarok::Logger::longMessage( text.join( QStringLiteral("
\n") ) ); } void Process::slotSaveSizeAndDelete() { if( m_dialog ) { - KConfigGroup group = Amarok::config( "StatSyncingDialog" ); + KConfigGroup group = Amarok::config( QStringLiteral("StatSyncingDialog") ); group.writeEntry( "geometry", m_dialog->saveGeometry() ); } deleteLater(); diff --git a/src/statsyncing/Provider.h b/src/statsyncing/Provider.h --- a/src/statsyncing/Provider.h +++ b/src/statsyncing/Provider.h @@ -37,7 +37,7 @@ Q_OBJECT public: - explicit ProviderConfigWidget( QWidget *parent, Qt::WindowFlags f = 0 ); + explicit ProviderConfigWidget( QWidget *parent, Qt::WindowFlags f = {} ); virtual ~ProviderConfigWidget(); /** @@ -53,7 +53,7 @@ * * Instances of subclasses are guaranteed to be created in the main thread. * Providers are memory-managed as explicitly shared data, always use ProviderPtr - * to stora a reference to Provider. + * to store a reference to Provider. */ class AMAROK_EXPORT Provider : public QObject { @@ -76,7 +76,7 @@ /** * User-visible short localized description. Default implementation returns - * an empy string. + * an empty string. */ virtual QString description() const; @@ -100,8 +100,10 @@ virtual ProviderConfigWidget *configWidget(); /** - * Reconfigure the provider using configuration stored in @param config. + * Reconfigure the provider using configuration stored in @p config. * Does nothing by default. + * + * @param config the configuration */ virtual void reconfigure( const QVariantMap &config ); diff --git a/src/statsyncing/ProviderFactory.h b/src/statsyncing/ProviderFactory.h --- a/src/statsyncing/ProviderFactory.h +++ b/src/statsyncing/ProviderFactory.h @@ -56,7 +56,7 @@ /** * User-visible short localized description. This is the default description - * of created providers. Default implementation returns an empy string. + * of created providers. Default implementation returns an empty string. */ virtual QString description() const; @@ -77,7 +77,7 @@ /** * Create a new provider instance using configuration stored in @param config */ - virtual ProviderPtr createProvider( QVariantMap config ) = 0; + virtual ProviderPtr createProvider( const QVariantMap &config ) = 0; }; } // namespace StatSyncing diff --git a/src/statsyncing/ScrobblingService.h b/src/statsyncing/ScrobblingService.h --- a/src/statsyncing/ScrobblingService.h +++ b/src/statsyncing/ScrobblingService.h @@ -79,10 +79,10 @@ * Update the "Now Playing" info on the scrobbling site without scrobbling the * track permanently. Scrobbler may check certain criteria and refuse to update * Now Playing if they are not met. If track is null, it means that no track is - * playing and scrobbler shoudl clear the Now Playing status. You may safely + * playing and scrobbler should clear the Now Playing status. You may safely * assume this is not called too frequently. * - * @param track that is currently playing or null if playbak was stopped + * @param track that is currently playing or null if playback was stopped */ virtual void updateNowPlaying( const Meta::TrackPtr &track ) = 0; }; diff --git a/src/statsyncing/SimpleTrack.h b/src/statsyncing/SimpleTrack.h --- a/src/statsyncing/SimpleTrack.h +++ b/src/statsyncing/SimpleTrack.h @@ -36,22 +36,22 @@ public: explicit SimpleTrack( const Meta::FieldHash &metadata, const QSet &labels = QSet() ); - virtual ~SimpleTrack(); + ~SimpleTrack() override; - virtual QString name() const; - virtual QString album() const; - virtual QString artist() const; - virtual QString composer() const; - virtual int year() const; - virtual int trackNumber() const; - virtual int discNumber() const; + QString name() const override; + QString album() const override; + QString artist() const override; + QString composer() const override; + int year() const override; + int trackNumber() const override; + int discNumber() const override; - virtual QDateTime firstPlayed() const; - virtual QDateTime lastPlayed() const; - virtual int playCount() const; - virtual int rating() const; + QDateTime firstPlayed() const override; + QDateTime lastPlayed() const override; + int playCount() const override; + int rating() const override; - virtual QSet labels() const; + QSet labels() const override; protected: QDateTime getDateTime( const QVariant &v ) const; diff --git a/src/statsyncing/SimpleWritableTrack.h b/src/statsyncing/SimpleWritableTrack.h --- a/src/statsyncing/SimpleWritableTrack.h +++ b/src/statsyncing/SimpleWritableTrack.h @@ -36,34 +36,34 @@ public: explicit SimpleWritableTrack( const Meta::FieldHash &metadata, const QSet &labels = QSet() ); - virtual ~SimpleWritableTrack(); + ~SimpleWritableTrack() override; - virtual QDateTime firstPlayed() const; + QDateTime firstPlayed() const override; /** * Sets the First Played statistic. This method saves @param firstPlayed in the form * of unix timestamp. */ - virtual void setFirstPlayed( const QDateTime &firstPlayed ); + void setFirstPlayed( const QDateTime &firstPlayed ) override; - virtual QDateTime lastPlayed() const; + QDateTime lastPlayed() const override; /** * Sets the Last Played statistic. This method saves @param lastPlayed in the form * of unix timestamp. */ - virtual void setLastPlayed( const QDateTime &lastPlayed ); + void setLastPlayed( const QDateTime &lastPlayed ) override; - virtual int playCount() const; - virtual void setPlayCount( int playCount ); + int playCount() const override; + void setPlayCount( int playCount ) override; - virtual int rating() const; - virtual void setRating( int rating ); + int rating() const override; + void setRating( int rating ) override; - virtual QSet labels() const; - virtual void setLabels( const QSet &labels ); + QSet labels() const override; + void setLabels( const QSet &labels ) override; - void commit(); + void commit() override; protected: /** diff --git a/src/statsyncing/Track.h b/src/statsyncing/Track.h --- a/src/statsyncing/Track.h +++ b/src/statsyncing/Track.h @@ -195,8 +195,8 @@ * Comparison function that compares track delegate pointer by pointed value. * Useful if you want to semantically sort TrackDelegateList using qSort() * - * @template param ControllingClass: class name that implements static - * ::comparisonFields() method that returns binary OR of Meta::val* fields + * @p ControllingClass class name that implements static + * \::comparisonFields() method that returns binary OR of Meta::val* fields * (as qint64) that should be used when comparing tracks. */ template diff --git a/src/statsyncing/TrackTuple.h b/src/statsyncing/TrackTuple.h --- a/src/statsyncing/TrackTuple.h +++ b/src/statsyncing/TrackTuple.h @@ -39,11 +39,14 @@ TrackTuple(); /** - * Inserts a track into this tuple; if it already contains a track from @param + * Inserts a track into this tuple; if it already contains a track from * provider, the old track si replaced with the new one. * * It does make sense to only add tracks that are in some sence equal to tracks - * alredy present in the tuple. + * already present in the tuple. + * + * @param provider the provider + * @param track the track */ void insert( ProviderPtr provider, const TrackPtr &track ); @@ -59,7 +62,7 @@ ProviderPtr provider( int i ) const; /** - * Returns track associated with @provider provider. Asserts that there's + * Returns track associated with @p provider. Asserts that there's * a track from @param provider */ TrackPtr track( const ProviderPtr &provider ) const; @@ -75,9 +78,13 @@ bool isEmpty() const; /** - * Return true if Meta::val* field @param field is going to be updated. - * If @param provider is null, returns true if at least one child track - * is going to be updated; otherwise works on a track from @param provider. + * Return true if Meta::val* field @p field is going to be updated. + * If @p provider is null, returns true if at least one child track + * is going to be updated; otherwise works on a track from @p provider. + * + * @param field the field. + * @param options the options. + * @param provider the provider. */ bool fieldUpdated( qint64 field, const Options &options, ProviderPtr provider = ProviderPtr() ) const; diff --git a/src/statsyncing/collection/CollectionProvider.h b/src/statsyncing/collection/CollectionProvider.h --- a/src/statsyncing/collection/CollectionProvider.h +++ b/src/statsyncing/collection/CollectionProvider.h @@ -30,7 +30,7 @@ namespace StatSyncing { /** - * Provider that has Collections::Colections as a back-end. + * Provider that has Collections::Collections as a back-end. */ class CollectionProvider : public Provider { @@ -40,27 +40,27 @@ /** * Construct provider that has @param collection as a back-end. */ - CollectionProvider( Collections::Collection *collection ); - virtual ~CollectionProvider(); + explicit CollectionProvider( Collections::Collection *collection ); + ~CollectionProvider() override; - virtual QString id() const; - virtual QString prettyName() const; - virtual QIcon icon() const; - virtual qint64 reliableTrackMetaData() const; - virtual qint64 writableTrackStatsData() const; - virtual Preference defaultPreference(); - virtual QSet artists(); - virtual TrackList artistTracks( const QString &artistName ); + QString id() const override; + QString prettyName() const override; + QIcon icon() const override; + qint64 reliableTrackMetaData() const override; + qint64 writableTrackStatsData() const override; + Preference defaultPreference() override; + QSet artists() override; + TrackList artistTracks( const QString &artistName ) override; Q_SIGNALS: /// hacks to create and start QueryMaker in main eventloop void startArtistSearch(); - void startTrackSearch( QString artistName ); + void startTrackSearch( const QString &artistName ); private Q_SLOTS: /// @see startArtistSearch void slotStartArtistSearch(); - void slotStartTrackSearch( QString artistName ); + void slotStartTrackSearch(const QString &artistName ); void slotNewArtistsReady( Meta::ArtistList list ); void slotNewTracksReady( Meta::TrackList list ); diff --git a/src/statsyncing/collection/CollectionProvider.cpp b/src/statsyncing/collection/CollectionProvider.cpp --- a/src/statsyncing/collection/CollectionProvider.cpp +++ b/src/statsyncing/collection/CollectionProvider.cpp @@ -59,7 +59,7 @@ qint64 CollectionProvider::reliableTrackMetaData() const { - if( id().startsWith("amarok-nepomuk:") ) + if( id().startsWith(QLatin1String("amarok-nepomuk:")) ) return Meta::valTitle | Meta::valArtist | Meta::valAlbum | Meta::valComposer | Meta::valTrackNr; else @@ -71,7 +71,7 @@ CollectionProvider::writableTrackStatsData() const { // TODO: this is unreliable and hacky, but serves for now: - if( id() == "localCollection" ) + if( id() == QLatin1String("localCollection") ) return Meta::valRating | Meta::valFirstPlayed | Meta::valLastPlayed | Meta::valPlaycount | Meta::valLabel; else return Meta::valRating | Meta::valFirstPlayed | Meta::valLastPlayed | Meta::valPlaycount; @@ -81,9 +81,9 @@ CollectionProvider::defaultPreference() { // currently only Local Collection and iPod one have good syncing capabilities - if( id() == "localCollection" ) + if( id() == QLatin1String("localCollection") ) return YesByDefault; - if( id().startsWith( "amarok-ipodtrackuid" ) ) + if( id().startsWith( QLatin1String("amarok-ipodtrackuid") ) ) return Ask; return NoByDefault; } @@ -95,7 +95,7 @@ return QSet(); m_foundArtists.clear(); - emit startArtistSearch(); + Q_EMIT startArtistSearch(); m_queryMakerSemaphore.acquire(); // blocks until slotQueryDone() releases the semaphore QSet ret = m_foundArtists; m_foundArtists.clear(); // don't waste memory @@ -110,7 +110,7 @@ return TrackList(); m_foundTracks.clear(); - emit startTrackSearch( artistName ); + Q_EMIT startTrackSearch( artistName ); m_queryMakerSemaphore.acquire(); // blocks until slotQueryDone() releases the semaphore TrackList ret = m_foundTracks; m_foundTracks.clear(); // don't waste memory @@ -138,7 +138,7 @@ } void -CollectionProvider::slotStartTrackSearch( QString artistName ) +CollectionProvider::slotStartTrackSearch( const QString &artistName ) { if( !m_coll ) { diff --git a/src/statsyncing/collection/CollectionTrack.h b/src/statsyncing/collection/CollectionTrack.h --- a/src/statsyncing/collection/CollectionTrack.h +++ b/src/statsyncing/collection/CollectionTrack.h @@ -26,31 +26,31 @@ class CollectionTrack : public Track { public: - explicit CollectionTrack( Meta::TrackPtr track ); - virtual ~CollectionTrack(); + explicit CollectionTrack(Meta::TrackPtr track ); + ~CollectionTrack() override; - virtual QString name() const; - virtual QString album() const; - virtual QString artist() const; - virtual QString composer() const; - virtual int year() const; - virtual int trackNumber() const; - virtual int discNumber() const; + QString name() const override; + QString album() const override; + QString artist() const override; + QString composer() const override; + int year() const override; + int trackNumber() const override; + int discNumber() const override; - virtual int rating() const; - virtual void setRating( int rating ); - virtual QDateTime firstPlayed() const; - virtual void setFirstPlayed( const QDateTime &firstPlayed ); - virtual QDateTime lastPlayed() const; - virtual void setLastPlayed( const QDateTime &lastPlayed ); - virtual int playCount() const; - virtual int recentPlayCount() const; - virtual void setPlayCount( int playCount ); - virtual QSet labels() const; - virtual void setLabels( const QSet &labels ); + int rating() const override; + void setRating( int rating ) override; + QDateTime firstPlayed() const override; + void setFirstPlayed( const QDateTime &firstPlayed ) override; + QDateTime lastPlayed() const override; + void setLastPlayed( const QDateTime &lastPlayed ) override; + int playCount() const override; + int recentPlayCount() const override; + void setPlayCount( int playCount ) override; + QSet labels() const override; + void setLabels( const QSet &labels ) override; - virtual Meta::TrackPtr metaTrack() const; - virtual void commit(); + Meta::TrackPtr metaTrack() const override; + void commit() override; private: Q_DISABLE_COPY( CollectionTrack ) diff --git a/src/statsyncing/jobs/MatchTracksJob.h b/src/statsyncing/jobs/MatchTracksJob.h --- a/src/statsyncing/jobs/MatchTracksJob.h +++ b/src/statsyncing/jobs/MatchTracksJob.h @@ -36,9 +36,9 @@ Q_OBJECT public: - MatchTracksJob( const ProviderPtrList &providers, QObject *parent = 0 ); + explicit MatchTracksJob( const ProviderPtrList &providers, QObject *parent = nullptr ); - virtual bool success() const; + bool success() const override; /** * Binary OR of MetaValues.h Meta::val* flags that are used to compare tracks @@ -90,9 +90,9 @@ void failed(ThreadWeaver::JobPointer); protected: - void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; - void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; - void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) Q_DECL_OVERRIDE; + void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; + void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; + void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = nullptr) override; private: /** diff --git a/src/statsyncing/jobs/MatchTracksJob.cpp b/src/statsyncing/jobs/MatchTracksJob.cpp --- a/src/statsyncing/jobs/MatchTracksJob.cpp +++ b/src/statsyncing/jobs/MatchTracksJob.cpp @@ -127,7 +127,7 @@ } Q_UNUSED( requiredFields ) // silence gcc warning about unused var in non-debug build Q_ASSERT( ( s_comparisonFields & requiredFields ) == requiredFields ); - emit totalSteps( providerArtists.size() ); + Q_EMIT totalSteps( providerArtists.size() ); #ifdef VERBOSE_DEBUG debug() << "Matching using:" << comparisonFieldNames( s_comparisonFields ).toLocal8Bit().constData(); #endif @@ -137,9 +137,9 @@ if( m_abort ) break; matchTracksFromArtist( artistProviders ); - emit incrementProgress(); + Q_EMIT incrementProgress(); } - emit endProgressOperation( this ); + Q_EMIT endProgressOperation( this ); #ifdef VERBOSE_DEBUG debug(); diff --git a/src/statsyncing/jobs/SynchronizeTracksJob.h b/src/statsyncing/jobs/SynchronizeTracksJob.h --- a/src/statsyncing/jobs/SynchronizeTracksJob.h +++ b/src/statsyncing/jobs/SynchronizeTracksJob.h @@ -41,7 +41,7 @@ public: explicit SynchronizeTracksJob( const QList &tuples, const TrackList &trackToScrobble, - const Options &options, QObject *parent = 0 ); + const Options &options, QObject *parent = nullptr ); /** * Return count of tracks that were updated during synchronization @@ -92,9 +92,9 @@ void failed(ThreadWeaver::JobPointer); protected: - void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; - void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE; - void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = 0) Q_DECL_OVERRIDE; + void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; + void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; + void run(ThreadWeaver::JobPointer self = QSharedPointer(), ThreadWeaver::Thread *thread = nullptr) override; private Q_SLOTS: void slotTrackScrobbled( const ScrobblingServicePtr &service, const Meta::TrackPtr &track ); diff --git a/src/statsyncing/jobs/SynchronizeTracksJob.cpp b/src/statsyncing/jobs/SynchronizeTracksJob.cpp --- a/src/statsyncing/jobs/SynchronizeTracksJob.cpp +++ b/src/statsyncing/jobs/SynchronizeTracksJob.cpp @@ -27,7 +27,7 @@ using namespace StatSyncing; -static const int denom = 20; // emit incementProgress() signal each N tracks +static const int denom = 20; // Q_EMIT incementProgress() signal each N tracks static const int fuzz = denom / 2; SynchronizeTracksJob::SynchronizeTracksJob( const QList &tuples, @@ -54,7 +54,7 @@ { Q_UNUSED(self); Q_UNUSED(thread); - emit totalSteps( ( m_tuples.size() + fuzz ) / denom ); + Q_EMIT totalSteps( ( m_tuples.size() + fuzz ) / denom ); Controller *controller = Amarok::Components::statSyncingController(); if( controller ) @@ -79,7 +79,7 @@ if( metaTrack && playcount > 0 ) { m_scrobbledTracks << metaTrack; - emit scrobble( metaTrack, playcount, track->lastPlayed() ); + Q_EMIT scrobble( metaTrack, playcount, track->lastPlayed() ); } } @@ -95,7 +95,7 @@ updatedProviders |= tupleUpdatedProviders; m_updatedTracksCount += tupleUpdatedProviders.count(); if( ( i + fuzz ) % denom == 0 ) - emit incrementProgress(); + Q_EMIT incrementProgress(); i++; } @@ -117,7 +117,7 @@ disconnect( controller, &StatSyncing::Controller::trackScrobbled, this, 0 ); disconnect( controller, &StatSyncing::Controller::scrobbleFailed, this, 0 ); - emit endProgressOperation( this ); + Q_EMIT endProgressOperation( this ); } void SynchronizeTracksJob::defaultBegin(const ThreadWeaver::JobPointer& self, ThreadWeaver::Thread *thread) diff --git a/src/statsyncing/models/CommonModel.cpp b/src/statsyncing/models/CommonModel.cpp --- a/src/statsyncing/models/CommonModel.cpp +++ b/src/statsyncing/models/CommonModel.cpp @@ -100,7 +100,7 @@ QStyleOptionViewItem opt; opt.features = QStyleOptionViewItem::HasDisplay; opt.state = QStyle::State_Enabled; - opt.text = "88.88.8888 88:88"; + opt.text = QLatin1String("88.88.8888 88:88"); QStyle *style = QApplication::style(); size = style->sizeFromContents( QStyle::CT_ItemViewItem, &opt, QSize(), 0 ); @@ -114,7 +114,7 @@ QStyleOptionViewItem opt; opt.features = QStyleOptionViewItem::HasDisplay; opt.state = QStyle::State_Enabled; - opt.text = "888 (88)"; + opt.text = QLatin1String("888 (88)"); opt.font.setBold( true ); QStyle *style = QApplication::style(); @@ -165,7 +165,7 @@ return QStringList( ( track->labels() - m_options.excludedLabels() ).toList() ).join( i18nc( "comma between list words", ", " ) ); default: - return QString( "Unknown field!" ); + return QStringLiteral( "Unknown field!" ); } break; case Qt::ToolTipRole: @@ -188,7 +188,7 @@ if( !excludedLabels.isEmpty() ) texts << i18n( "Ignored labels: %1", QStringList( excludedLabels.toList() ).join( i18nc( "comma between list words", ", " ) ) ); - return texts.isEmpty() ? QVariant() : texts.join( "\n" ); + return texts.isEmpty() ? QVariant() : texts.join( QStringLiteral("\n") ); } } break; diff --git a/src/statsyncing/models/MatchedTracksModel.h b/src/statsyncing/models/MatchedTracksModel.h --- a/src/statsyncing/models/MatchedTracksModel.h +++ b/src/statsyncing/models/MatchedTracksModel.h @@ -55,24 +55,25 @@ * must include Meta::valTitle, may include: valRating, * valFirstPlayed, valLastPlayed, valPlaycount, valLabel. * @param options options for synchronizing individual tracks + * @param parent parent QObject */ MatchedTracksModel( const QList &matchedTuples, const QList &columns, const Options &options, - QObject *parent = 0 ); + QObject *parent = nullptr ); QModelIndex index( int row, int column, - const QModelIndex &parent = QModelIndex() ) const; - QModelIndex parent( const QModelIndex &child ) const; + const QModelIndex &parent = QModelIndex() ) const override; + QModelIndex parent( const QModelIndex &child ) const override; - bool hasChildren( const QModelIndex &parent = QModelIndex() ) const; - int rowCount( const QModelIndex &parent = QModelIndex() ) const; - int columnCount( const QModelIndex &parent = QModelIndex() ) const; + bool hasChildren( const QModelIndex &parent = QModelIndex() ) const override; + int rowCount( const QModelIndex &parent = QModelIndex() ) const override; + int columnCount( const QModelIndex &parent = QModelIndex() ) const override; QVariant headerData( int section, Qt::Orientation orientation, - int role = Qt::DisplayRole ) const; - QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const; - bool setData( const QModelIndex &index, const QVariant &value, int role = Qt::EditRole ); - Qt::ItemFlags flags( const QModelIndex &index ) const; + int role = Qt::DisplayRole ) const override; + QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const override; + bool setData( const QModelIndex &index, const QVariant &value, int role = Qt::EditRole ) override; + Qt::ItemFlags flags( const QModelIndex &index ) const override; // MatchedTracksModel-specific methods: /** @@ -95,8 +96,8 @@ /** * Go through all tuples with (both resolved and unresolved) rating conflict - * and (re)set their preferred rating provider to @param provider. Null - * @param provider resets all tuples to "undecided". If @param provider is + * and (re)set their preferred rating provider to @p provider. Null + * @param provider resets all tuples to "undecided". If @p provider is * not null and given tuple has no track from provider, its state remains * unchanged. */ @@ -114,7 +115,7 @@ * and remove @param provider from their list of label sources. Tracks that * don't have @param provider in their label sources remain unchanged. * - * If @param provider is null, this methods resets all tubles to "undecided" + * If @param provider is null, this methods resets all tuples to "undecided" * wrt labels (clears their list of label sources). */ void excludeLabelsFrom( const ProviderPtr &provider ); diff --git a/src/statsyncing/models/MatchedTracksModel.cpp b/src/statsyncing/models/MatchedTracksModel.cpp --- a/src/statsyncing/models/MatchedTracksModel.cpp +++ b/src/statsyncing/models/MatchedTracksModel.cpp @@ -183,12 +183,12 @@ // parent changes: QModelIndex parent = idx.parent(); QModelIndex parentRating = index( parent.row(), idx.column(), parent.parent() ); - emit dataChanged( parentRating, parentRating ); + Q_EMIT dataChanged( parentRating, parentRating ); // children change: QModelIndex topLeft = index( 0, idx.column(), parent ); QModelIndex bottomRight = index( tuple.count() - 1, idx.column(), parent ); - emit dataChanged( topLeft, bottomRight ); + Q_EMIT dataChanged( topLeft, bottomRight ); return true; } @@ -245,13 +245,13 @@ // parent changes: int ratingColumn = m_columns.indexOf( Meta::valRating ); QModelIndex parentRating = index( i, ratingColumn ); - emit dataChanged( parentRating, parentRating ); + Q_EMIT dataChanged( parentRating, parentRating ); // children change: QModelIndex parent = index( i, 0 ); QModelIndex topLeft = index( 0, ratingColumn, parent ); QModelIndex bottomRight = index( tuple.count() - 1, ratingColumn, parent ); - emit dataChanged( topLeft, bottomRight ); + Q_EMIT dataChanged( topLeft, bottomRight ); } } @@ -275,13 +275,13 @@ // parent changes: int ratingColumn = m_columns.indexOf( Meta::valRating ); QModelIndex parentRating = index( i, ratingColumn ); - emit dataChanged( parentRating, parentRating ); + Q_EMIT dataChanged( parentRating, parentRating ); // children change: QModelIndex parent = index( i, 0 ); QModelIndex topLeft = index( 0, ratingColumn, parent ); QModelIndex bottomRight = index( tuple.count() - 1, ratingColumn, parent ); - emit dataChanged( topLeft, bottomRight ); + Q_EMIT dataChanged( topLeft, bottomRight ); } } @@ -308,13 +308,13 @@ // parent changes: int ratingColumn = m_columns.indexOf( Meta::valRating ); QModelIndex parentRating = index( i, ratingColumn ); - emit dataChanged( parentRating, parentRating ); + Q_EMIT dataChanged( parentRating, parentRating ); // children change: QModelIndex parent = index( i, 0 ); QModelIndex topLeft = index( 0, ratingColumn, parent ); QModelIndex bottomRight = index( tuple.count() - 1, ratingColumn, parent ); - emit dataChanged( topLeft, bottomRight ); + Q_EMIT dataChanged( topLeft, bottomRight ); } } @@ -344,7 +344,7 @@ return QStringList( tuple.syncedLabels( m_options ).toList() ).join( i18nc( "comma between list words", ", " ) ); default: - return QString( "Unknown field!" ); + return QStringLiteral( "Unknown field!" ); } break; case Qt::ToolTipRole: diff --git a/src/statsyncing/models/ProvidersModel.h b/src/statsyncing/models/ProvidersModel.h --- a/src/statsyncing/models/ProvidersModel.h +++ b/src/statsyncing/models/ProvidersModel.h @@ -32,13 +32,13 @@ Q_OBJECT public: - ProvidersModel( const ProviderPtrList &providers, - const ProviderPtrSet &preSelectedProviders, QObject *parent = 0 ); - virtual ~ProvidersModel(); + explicit ProvidersModel( const ProviderPtrList &providers, + const ProviderPtrSet &preSelectedProviders, QObject *parent = nullptr ); + ~ProvidersModel() override; // QAbstractItemModel methods: - QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const; - int rowCount( const QModelIndex &parent = QModelIndex() ) const; + QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const override; + int rowCount( const QModelIndex &parent = QModelIndex() ) const override; // ProvidersModel methods: ProviderPtrList selectedProviders() const; diff --git a/src/statsyncing/models/SingleTracksModel.h b/src/statsyncing/models/SingleTracksModel.h --- a/src/statsyncing/models/SingleTracksModel.h +++ b/src/statsyncing/models/SingleTracksModel.h @@ -36,24 +36,26 @@ /** * Construct model of single tracks. * - * @param matchedTuples list of tracks + * @param tracks list of tracks * @param columns list of Meta::val* fields that will form columns of the model * must include Meta::valTitle, may include: valRating, * valFirstPlayed, valLastPlayed, valPlaycount, valLabel. + * @param options the options + * @param parent the parent QObject */ SingleTracksModel( const TrackList &tracks, const QList &columns, - const Options &options, QObject *parent = 0 ); + const Options &options, QObject *parent = nullptr ); - int rowCount( const QModelIndex &parent = QModelIndex() ) const; - int columnCount( const QModelIndex &parent = QModelIndex() ) const; + int rowCount( const QModelIndex &parent = QModelIndex() ) const override; + int columnCount( const QModelIndex &parent = QModelIndex() ) const override; - QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const; + QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const override; - QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const; - Qt::ItemFlags flags( const QModelIndex &index ) const; + QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const override; + Qt::ItemFlags flags( const QModelIndex &index ) const override; - QStringList mimeTypes() const; - QMimeData *mimeData( const QModelIndexList &indexes ) const; + QStringList mimeTypes() const override; + QMimeData *mimeData( const QModelIndexList &indexes ) const override; private: TrackList m_tracks; diff --git a/src/statsyncing/models/SingleTracksModel.cpp b/src/statsyncing/models/SingleTracksModel.cpp --- a/src/statsyncing/models/SingleTracksModel.cpp +++ b/src/statsyncing/models/SingleTracksModel.cpp @@ -73,7 +73,7 @@ QStringList SingleTracksModel::mimeTypes() const { - return QStringList() << AmarokMimeData::TRACK_MIME << "text/uri-list" << "text/plain"; + return QStringList() << AmarokMimeData::TRACK_MIME << QStringLiteral("text/uri-list") << QStringLiteral("text/plain"); } QMimeData * diff --git a/src/statsyncing/ui/ChooseProvidersPage.h b/src/statsyncing/ui/ChooseProvidersPage.h --- a/src/statsyncing/ui/ChooseProvidersPage.h +++ b/src/statsyncing/ui/ChooseProvidersPage.h @@ -28,7 +28,7 @@ Q_OBJECT public: - explicit ChooseProvidersPage( QWidget *parent = 0, Qt::WindowFlags f = 0 ); + explicit ChooseProvidersPage( QWidget *parent = nullptr, Qt::WindowFlags f = {} ); virtual ~ChooseProvidersPage(); void setFields( const QList &fields, qint64 checkedFields ); diff --git a/src/statsyncing/ui/ChooseProvidersPage.cpp b/src/statsyncing/ui/ChooseProvidersPage.cpp --- a/src/statsyncing/ui/ChooseProvidersPage.cpp +++ b/src/statsyncing/ui/ChooseProvidersPage.cpp @@ -182,5 +182,5 @@ { App *app = pApp; if( app ) - app->slotConfigAmarok( "MetadataConfig" ); + app->slotConfigAmarok( QStringLiteral("MetadataConfig") ); } diff --git a/src/statsyncing/ui/ConfigureProviderDialog.h b/src/statsyncing/ui/ConfigureProviderDialog.h --- a/src/statsyncing/ui/ConfigureProviderDialog.h +++ b/src/statsyncing/ui/ConfigureProviderDialog.h @@ -29,19 +29,18 @@ namespace StatSyncing { - class ProviderConfigWidget; class ConfigureProviderDialog : public KPageDialog { Q_OBJECT public: explicit ConfigureProviderDialog( const QString &providerId, QWidget *configWidget, - QWidget *parent = 0, Qt::WindowFlags f = 0 ); + QWidget *parent = nullptr, Qt::WindowFlags f = {} ); virtual ~ConfigureProviderDialog(); Q_SIGNALS: - void providerConfigured( QString id, QVariantMap config ); + void providerConfigured( const QString &id, const QVariantMap &config ); private: QString m_providerId; diff --git a/src/statsyncing/ui/ConfigureProviderDialog.cpp b/src/statsyncing/ui/ConfigureProviderDialog.cpp --- a/src/statsyncing/ui/ConfigureProviderDialog.cpp +++ b/src/statsyncing/ui/ConfigureProviderDialog.cpp @@ -54,7 +54,7 @@ { const ProviderConfigWidget *configWidget = qobject_cast(mainWidget); - emit providerConfigured( m_providerId, configWidget->config() ); + Q_EMIT providerConfigured( m_providerId, configWidget->config() ); } } // namespace StatSyncing diff --git a/src/statsyncing/ui/CreateProviderDialog.h b/src/statsyncing/ui/CreateProviderDialog.h --- a/src/statsyncing/ui/CreateProviderDialog.h +++ b/src/statsyncing/ui/CreateProviderDialog.h @@ -38,7 +38,7 @@ Q_OBJECT public: - explicit CreateProviderDialog( QWidget *parent = 0, Qt::WindowFlags f = 0 ); + explicit CreateProviderDialog( QWidget *parent = nullptr, Qt::WindowFlags f = {} ); virtual ~CreateProviderDialog(); public Q_SLOTS: diff --git a/src/statsyncing/ui/CreateProviderDialog.cpp b/src/statsyncing/ui/CreateProviderDialog.cpp --- a/src/statsyncing/ui/CreateProviderDialog.cpp +++ b/src/statsyncing/ui/CreateProviderDialog.cpp @@ -130,7 +130,7 @@ const ProviderConfigWidget *configWidget = qobject_cast( configPage->widget() ); - emit providerConfigured( id, configWidget->config() ); + Q_EMIT providerConfigured( id, configWidget->config() ); } } // namespace StatSyncing diff --git a/src/statsyncing/ui/MatchedTracksPage.h b/src/statsyncing/ui/MatchedTracksPage.h --- a/src/statsyncing/ui/MatchedTracksPage.h +++ b/src/statsyncing/ui/MatchedTracksPage.h @@ -33,16 +33,16 @@ Q_OBJECT public: - explicit MatchedTracksPage( QWidget *parent = 0, Qt::WindowFlags f = 0 ); + explicit MatchedTracksPage( QWidget *parent = nullptr, Qt::WindowFlags f = {} ); virtual ~MatchedTracksPage(); /** * Set provider, you must call this before showing the widget. */ void setProviders( const ProviderPtrList &providers ); /** - * Set mathed tracks model. MatchedTracksPage does _not_ take ownership of + * Set matched tracks model. MatchedTracksPage does _not_ take ownership of * the pointer. */ void setMatchedTracksModel( MatchedTracksModel *model ); diff --git a/src/statsyncing/ui/MatchedTracksPage.cpp b/src/statsyncing/ui/MatchedTracksPage.cpp --- a/src/statsyncing/ui/MatchedTracksPage.cpp +++ b/src/statsyncing/ui/MatchedTracksPage.cpp @@ -37,7 +37,7 @@ class SortFilterProxyModel : public QSortFilterProxyModel { public: - SortFilterProxyModel( QObject *parent = 0 ) + SortFilterProxyModel( QObject *parent = nullptr ) : QSortFilterProxyModel( parent ) , m_tupleFilter( -1 ) { @@ -57,7 +57,7 @@ } protected: - bool filterAcceptsRow( int source_row, const QModelIndex &source_parent ) const + bool filterAcceptsRow( int source_row, const QModelIndex &source_parent ) const override { if( source_parent.isValid() ) return true; // we match all child items, we filter only root ones @@ -71,7 +71,7 @@ return QSortFilterProxyModel::filterAcceptsRow( source_row, source_parent ); } - bool lessThan( const QModelIndex &left, const QModelIndex &right ) const + bool lessThan( const QModelIndex &left, const QModelIndex &right ) const override { if( left.parent().isValid() ) // we are comparing childs, special mode: { @@ -81,7 +81,7 @@ QString leftProvider = sourceModel()->data( l, Qt::DisplayRole ).toString(); QString rightProvider = sourceModel()->data( r, Qt::DisplayRole ).toString(); - // make this sorting ignore the sort order, always sort acsendingly: + // make this sorting ignore the sort order, always sort ascendingly: if( sortOrder() == Qt::AscendingOrder ) return leftProvider.localeAwareCompare( rightProvider ) < 0; else @@ -144,7 +144,7 @@ connect( buttonBox, &QDialogButtonBox::accepted, this, &MatchedTracksPage::accepted ); connect( buttonBox, &QDialogButtonBox::rejected, this, &MatchedTracksPage::rejected ); - tabWidget->setTabEnabled( 1, false );; + tabWidget->setTabEnabled( 1, false ); tabWidget->setTabToolTip( 1, i18n( "There are no tracks unique to one of the sources " "participating in the synchronization" ) ); tabWidget->setTabEnabled( 2, false ); @@ -512,7 +512,7 @@ { App *app = pApp; if( app ) - app->slotConfigAmarok( "MetadataConfig" ); + app->slotConfigAmarok( QStringLiteral("MetadataConfig") ); } void diff --git a/src/statsyncing/ui/TrackDelegate.h b/src/statsyncing/ui/TrackDelegate.h --- a/src/statsyncing/ui/TrackDelegate.h +++ b/src/statsyncing/ui/TrackDelegate.h @@ -24,11 +24,11 @@ class TrackDelegate : public QStyledItemDelegate { public: - explicit TrackDelegate( QObject *parent = 0 ); + explicit TrackDelegate( QObject *parent = nullptr ); void paint( QPainter *painter, const QStyleOptionViewItem &option, - const QModelIndex &index ) const; - QString displayText( const QVariant &value, const QLocale &locale ) const; + const QModelIndex &index ) const override; + QString displayText( const QVariant &value, const QLocale &locale ) const override; }; } diff --git a/src/statsyncing/ui/TrackDelegate.cpp b/src/statsyncing/ui/TrackDelegate.cpp --- a/src/statsyncing/ui/TrackDelegate.cpp +++ b/src/statsyncing/ui/TrackDelegate.cpp @@ -59,7 +59,7 @@ if( rating < 0 ) // unresolved conflict { rating = 0; - ratingPainter.setIcon( QIcon::fromTheme( "status_unknown" ) ); + ratingPainter.setIcon( QIcon::fromTheme( QStringLiteral("status_unknown") ) ); ratingPainter.setEnabled( false ); ratingPainter.setMaxRating( 2 ); } diff --git a/src/statusbar/CompoundProgressBar.h b/src/statusbar/CompoundProgressBar.h --- a/src/statusbar/CompoundProgressBar.h +++ b/src/statusbar/CompoundProgressBar.h @@ -28,28 +28,25 @@ /** * A progress bar that wraps a number of simple progress bars and displays their * overall progress. Also features an expanded mode that allows the user to view - * and canceld individual operations + * and canceled individual operations */ class AMAROK_EXPORT CompoundProgressBar : public ProgressBar { Q_OBJECT public: - CompoundProgressBar( QWidget *parent ); + explicit CompoundProgressBar( QWidget *parent ); - ~CompoundProgressBar(); + ~CompoundProgressBar() override; void addProgressBar( ProgressBar *progressBar, QObject *owner ); void incrementProgress( const QObject *owner ); void setProgressTotalSteps( const QObject *owner, int value ); void setProgressStatus( const QObject *owner, const QString &text ); void setProgress( const QObject *owner, int steps ); - /* reimplemented from QWidget for correct positioning of progressDetailsWidget */ - virtual void setParent( QWidget *parent ); - /* reimplemented from QWidget to open/close the details widget */ - virtual void mousePressEvent( QMouseEvent *event ); + void mousePressEvent( QMouseEvent *event ) override; public Q_SLOTS: void endProgressOperation( QObject *owner ); diff --git a/src/statusbar/CompoundProgressBar.cpp b/src/statusbar/CompoundProgressBar.cpp --- a/src/statusbar/CompoundProgressBar.cpp +++ b/src/statusbar/CompoundProgressBar.cpp @@ -28,7 +28,7 @@ : ProgressBar( parent ) , m_mutex( QMutex::Recursive ) { - m_progressDetailsWidget = new PopupWidget( parent ); + m_progressDetailsWidget = new PopupWidget(); m_progressDetailsWidget->hide(); connect( cancelButton(), &QAbstractButton::clicked, this, &CompoundProgressBar::cancelAll ); @@ -139,18 +139,6 @@ m_progressMap.value( owner )->setMaximum( value ); } -void CompoundProgressBar::setParent( QWidget *parent ) -{ - QMutexLocker locker( &m_mutex ); - - delete m_progressDetailsWidget; - m_progressDetailsWidget = new PopupWidget( parent ); - m_progressDetailsWidget->hide(); - - ProgressBar::setParent( parent ); -} - - void CompoundProgressBar::setProgressStatus( const QObject *owner, const QString &text ) { QMutexLocker locker( &m_mutex ); @@ -212,7 +200,7 @@ { progressBar()->setValue( 0 ); hideDetails(); - emit( allDone() ); + Q_EMIT( allDone() ); return; } else diff --git a/src/statusbar/KJobProgressBar.h b/src/statusbar/KJobProgressBar.h --- a/src/statusbar/KJobProgressBar.h +++ b/src/statusbar/KJobProgressBar.h @@ -29,12 +29,12 @@ Q_OBJECT public: - KJobProgressBar( QWidget *parent, KJob * job ); + explicit KJobProgressBar( QWidget *parent, KJob * job ); ~KJobProgressBar(); private Q_SLOTS: void updateJobStatus( KJob*, unsigned long ); - void infoMessage( KJob*, QString plain, QString rich ); + void infoMessage( KJob*, const QString &plain, const QString &rich ); }; #endif diff --git a/src/statusbar/KJobProgressBar.cpp b/src/statusbar/KJobProgressBar.cpp --- a/src/statusbar/KJobProgressBar.cpp +++ b/src/statusbar/KJobProgressBar.cpp @@ -33,10 +33,10 @@ { Q_UNUSED( job ); setValue( value ); - emit( percentageChanged( percentage() ) ); + Q_EMIT( percentageChanged( percentage() ) ); } -void KJobProgressBar::infoMessage( KJob* job, QString plain, QString rich ) +void KJobProgressBar::infoMessage(KJob* job, const QString &plain, const QString &rich ) { Q_UNUSED( job ); Q_UNUSED( rich ); diff --git a/src/statusbar/LongMessageWidget.h b/src/statusbar/LongMessageWidget.h --- a/src/statusbar/LongMessageWidget.h +++ b/src/statusbar/LongMessageWidget.h @@ -19,15 +19,15 @@ #define LONGMESSAGEWIDGET_H #include "PopupWidget.h" -#include "core/interfaces/Logger.h" + class CountdownFrame : public QFrame { public: - CountdownFrame( QWidget *parent = 0 ); + explicit CountdownFrame( QWidget *parent = nullptr ); void setFilledRatio( float filled ); // 0 to 1 - virtual void paintEvent( QPaintEvent *e ); + void paintEvent( QPaintEvent *e ) override; protected: float m_filled; @@ -39,15 +39,15 @@ { Q_OBJECT public: - LongMessageWidget( QWidget *anchor, const QString &message, Amarok::Logger::MessageType type ); + explicit LongMessageWidget( const QString &message ); - ~LongMessageWidget(); + ~LongMessageWidget() override; Q_SIGNALS: void closed(); protected: - void timerEvent( QTimerEvent * ); + void timerEvent( QTimerEvent * ) override; private Q_SLOTS: void close(); diff --git a/src/statusbar/LongMessageWidget.cpp b/src/statusbar/LongMessageWidget.cpp --- a/src/statusbar/LongMessageWidget.cpp +++ b/src/statusbar/LongMessageWidget.cpp @@ -19,22 +19,21 @@ #include "core/support/Debug.h" +#include + #include #include #include #include #include -LongMessageWidget::LongMessageWidget( QWidget *anchor, const QString &message, - Amarok::Logger::MessageType type ) - : PopupWidget( anchor ) - , m_counter( 0 ) +LongMessageWidget::LongMessageWidget( const QString &message ) + : m_counter( 0 ) , m_timeout( 6000 ) { DEBUG_BLOCK - Q_UNUSED( type ) setFrameStyle( QFrame::StyledPanel | QFrame::Raised ); @@ -51,25 +50,26 @@ hbox->layout()->setSpacing( 12 ); m_countdownFrame = new CountdownFrame( hbox ); - m_countdownFrame->setObjectName( "counterVisual" ); - m_countdownFrame->setFixedWidth( fontMetrics().width( "X" ) ); + m_countdownFrame->setObjectName( QStringLiteral("counterVisual") ); + m_countdownFrame->setFixedWidth( fontMetrics().width( QStringLiteral("X") ) ); m_countdownFrame->setFrameStyle( QFrame::Plain | QFrame::Box ); QPalette pal; pal.setColor( m_countdownFrame->foregroundRole(), p.dark().color() ); m_countdownFrame->setPalette( pal ); QLabel *alabel = new QLabel( message, hbox ); alabel->setWordWrap( true ); alabel->setOpenExternalLinks( true ); - alabel->setObjectName( "label" ); + alabel->setObjectName( QStringLiteral("label") ); alabel->setTextFormat( Qt::RichText ); alabel->setTextInteractionFlags( Qt::TextBrowserInteraction ); alabel->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Preferred ); alabel->setPalette( p ); hbox = new BoxWidget( false, this ); - QPushButton *button = new QPushButton( QStringLiteral( "closeButton" ), hbox ); + QPushButton *button = new QPushButton( hbox ); + KStandardGuiItem::assign( button, KStandardGuiItem::Close ); connect( button, &QAbstractButton::clicked, this, &LongMessageWidget::close ); reposition(); @@ -84,7 +84,7 @@ void LongMessageWidget::close() { hide(); - emit( closed() ); + Q_EMIT( closed() ); } void LongMessageWidget::timerEvent( QTimerEvent* ) diff --git a/src/statusbar/NetworkProgressBar.h b/src/statusbar/NetworkProgressBar.h --- a/src/statusbar/NetworkProgressBar.h +++ b/src/statusbar/NetworkProgressBar.h @@ -29,7 +29,7 @@ Q_OBJECT public: - NetworkProgressBar( QWidget *parent, QNetworkReply *reply ); + explicit NetworkProgressBar( QWidget *parent, QNetworkReply *reply ); ~NetworkProgressBar(); private Q_SLOTS: diff --git a/src/statusbar/PopupWidget.h b/src/statusbar/PopupWidget.h --- a/src/statusbar/PopupWidget.h +++ b/src/statusbar/PopupWidget.h @@ -22,7 +22,7 @@ class PopupWidget : public BoxWidget { public: - explicit PopupWidget( QWidget *anchor, const QString &name = QString() ); + explicit PopupWidget( const QString &name = QString() ); ~PopupWidget(); void reposition(); diff --git a/src/statusbar/PopupWidget.cpp b/src/statusbar/PopupWidget.cpp --- a/src/statusbar/PopupWidget.cpp +++ b/src/statusbar/PopupWidget.cpp @@ -23,11 +23,10 @@ #include -PopupWidget::PopupWidget( QWidget *anchor, const QString &name ) - : BoxWidget( true, The::mainWindow() ) +PopupWidget::PopupWidget( const QString &name ) + : BoxWidget( true ) { Q_UNUSED( name ); - Q_UNUSED( anchor ); setBackgroundRole( QPalette::Window ); setAutoFillBackground( true ); @@ -39,8 +38,6 @@ setContentsMargins( 4, 4, 4, 4 ); setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ); - - reposition(); } PopupWidget::~PopupWidget() @@ -52,6 +49,9 @@ { adjustSize(); + if( !The::mainWindow() ) + return; + //HACK: put longmessage popup in the bottom right of the window. QPoint p; p.setX( The::mainWindow()->width() - width() ); diff --git a/src/statusbar/ProgressBar.h b/src/statusbar/ProgressBar.h --- a/src/statusbar/ProgressBar.h +++ b/src/statusbar/ProgressBar.h @@ -25,6 +25,8 @@ #include #include +#include + #define POST_COMPLETION_DELAY 2000 /** @@ -35,15 +37,13 @@ Q_OBJECT public: - ProgressBar( QWidget *parent ); + explicit ProgressBar( QWidget *parent ); ~ProgressBar(); void setDescription( const QString &description ); - ProgressBar *setAbortSlot( QObject *receiver, const char *slot, - Qt::ConnectionType type = Qt::AutoConnection ); - template - ProgressBar *setAbortSlot( const typename QtPrivate::FunctionPointer::Object *receiver, Func slot, + template + ProgressBar *setAbortSlot( Receiver receiver, Func slot, Qt::ConnectionType type = Qt::AutoConnection ) { cancelButton()->setHidden( false ); diff --git a/src/statusbar/ProgressBar.cpp b/src/statusbar/ProgressBar.cpp --- a/src/statusbar/ProgressBar.cpp +++ b/src/statusbar/ProgressBar.cpp @@ -44,7 +44,7 @@ descriptionLayout->addWidget( m_descriptionLabel, 1 ); m_cancelButton = new QToolButton; - m_cancelButton->setIcon( QIcon::fromTheme( "dialog-cancel-amarok" ) ); + m_cancelButton->setIcon( QIcon::fromTheme( QStringLiteral("dialog-cancel-amarok") ) ); m_cancelButton->setToolTip( i18n( "Abort" ) ); m_cancelButton->setHidden( true ); m_cancelButton->setFixedWidth( 16 ); @@ -79,28 +79,17 @@ m_descriptionLabel->setText( description ); } -ProgressBar * -ProgressBar::setAbortSlot( QObject *receiver, const char *slot, Qt::ConnectionType type ) -{ - cancelButton()->setHidden( false ); - if( receiver ) - connect( this, SIGNAL(cancelled(ProgressBar*)), receiver, slot, type ); - connect( cancelButton(), &QAbstractButton::clicked, this, &ProgressBar::cancel ); - - return this; -} - void ProgressBar::cancel() { DEBUG_BLOCK debug() << "cancelling operation: " << m_descriptionLabel->text(); - emit( cancelled( this ) ); + Q_EMIT( cancelled( this ) ); } void ProgressBar::setValue( int percentage ) { progressBar()->setValue( percentage ); - emit( percentageChanged( percentage ) ); + Q_EMIT( percentageChanged( percentage ) ); //this safety check has to be removed as KJobs sometimes start out //by showing 100%, thus removing the progress info before it even gets started @@ -110,7 +99,7 @@ void ProgressBar::delayedDone() { - emit( complete( this ) ); + Q_EMIT( complete( this ) ); } int ProgressBar::percentage() diff --git a/src/synchronization/MasterSlaveSynchronizationJob.h b/src/synchronization/MasterSlaveSynchronizationJob.h --- a/src/synchronization/MasterSlaveSynchronizationJob.h +++ b/src/synchronization/MasterSlaveSynchronizationJob.h @@ -36,16 +36,16 @@ Q_OBJECT public: MasterSlaveSynchronizationJob(); - ~MasterSlaveSynchronizationJob(); + ~MasterSlaveSynchronizationJob() override; //master/slave are not settable in the ctor //to make explicit which collection is the master and which is the slave //for this synchronization void setMaster( Collections::Collection *master ); void setSlave( Collections::Collection *slave ); protected: - void doSynchronization( const Meta::TrackList &tracks, InSet syncDirection, Collections::Collection *collA, Collections::Collection *collB ); + void doSynchronization( const Meta::TrackList &tracks, InSet syncDirection, Collections::Collection *collA, Collections::Collection *collB ) override; private: Collections::Collection *m_master; diff --git a/src/synchronization/OneWaySynchronizationJob.h b/src/synchronization/OneWaySynchronizationJob.h --- a/src/synchronization/OneWaySynchronizationJob.h +++ b/src/synchronization/OneWaySynchronizationJob.h @@ -35,16 +35,16 @@ Q_OBJECT public: OneWaySynchronizationJob(); - ~OneWaySynchronizationJob(); + ~OneWaySynchronizationJob() override; //source/target are not settable in the ctor //to make explicit which collection is the source and which is the target //for this synchronization void setSource( Collections::Collection *source ); void setTarget( Collections::Collection *target ); protected: - void doSynchronization( const Meta::TrackList &tracks, InSet syncDirection, Collections::Collection *collA, Collections::Collection *collB ); + void doSynchronization( const Meta::TrackList &tracks, InSet syncDirection, Collections::Collection *collA, Collections::Collection *collB ) override; private: Collections::Collection *m_source; diff --git a/src/synchronization/SynchronizationBaseJob.h b/src/synchronization/SynchronizationBaseJob.h --- a/src/synchronization/SynchronizationBaseJob.h +++ b/src/synchronization/SynchronizationBaseJob.h @@ -35,8 +35,6 @@ class SynchronizationBaseJob : public QObject { Q_OBJECT - Q_ENUMS( State ) - Q_ENUMS( InSet ) public: enum State { @@ -46,13 +44,15 @@ ComparingTracks, Syncing }; + Q_ENUM( State ) enum InSet { OnlyInA, OnlyInB, InBoth }; + Q_ENUM( InSet ) SynchronizationBaseJob(); ~SynchronizationBaseJob(); diff --git a/src/synchronization/SynchronizationBaseJob.cpp b/src/synchronization/SynchronizationBaseJob.cpp --- a/src/synchronization/SynchronizationBaseJob.cpp +++ b/src/synchronization/SynchronizationBaseJob.cpp @@ -83,7 +83,7 @@ DEBUG_BLOCK if( !m_collectionA || !m_collectionB ) { - debug() << "aborting synchronization, at least one collecton is missing"; + debug() << "aborting synchronization, at least one collection is missing"; deleteLater(); return; } diff --git a/src/synchronization/UnionJob.h b/src/synchronization/UnionJob.h --- a/src/synchronization/UnionJob.h +++ b/src/synchronization/UnionJob.h @@ -42,10 +42,10 @@ Q_OBJECT public: UnionJob( Collections::Collection *collA, Collections::Collection *collB ); - virtual ~UnionJob(); + ~UnionJob() override; protected: - void doSynchronization( const Meta::TrackList &tracks, InSet syncDirection, Collections::Collection *collA, Collections::Collection *collB ); + void doSynchronization( const Meta::TrackList &tracks, InSet syncDirection, Collections::Collection *collA, Collections::Collection *collB ) override; }; diff --git a/src/toolbar/CurrentTrackToolbar.h b/src/toolbar/CurrentTrackToolbar.h --- a/src/toolbar/CurrentTrackToolbar.h +++ b/src/toolbar/CurrentTrackToolbar.h @@ -26,7 +26,7 @@ Q_OBJECT public: - CurrentTrackToolbar( QWidget * parent ); + explicit CurrentTrackToolbar( QWidget * parent ); ~CurrentTrackToolbar(); diff --git a/src/toolbar/MainToolbar.h b/src/toolbar/MainToolbar.h --- a/src/toolbar/MainToolbar.h +++ b/src/toolbar/MainToolbar.h @@ -20,7 +20,6 @@ class AnimatedLabelStack; class PlayPauseButton; -class QBoxLayout; class QLabel; class QSpacerItem; class VolumeDial; @@ -35,15 +34,15 @@ Q_OBJECT public: - MainToolbar( QWidget *parent = 0 ); + explicit MainToolbar( QWidget *parent = nullptr ); protected: - bool eventFilter( QObject *o, QEvent *ev ); - void showEvent( QShowEvent *ev ); - void hideEvent( QHideEvent *ev ); - void paintEvent( QPaintEvent *ev ); - void resizeEvent( QResizeEvent *ev ); - void timerEvent( QTimerEvent *ev ); + bool eventFilter( QObject *o, QEvent *ev ) override; + void showEvent( QShowEvent *ev ) override; + void hideEvent( QHideEvent *ev ) override; + void paintEvent( QPaintEvent *ev ) override; + void resizeEvent( QResizeEvent *ev ) override; + void timerEvent( QTimerEvent *ev ) override; private: void animateTrackLabels(); diff --git a/src/toolbar/MainToolbar.cpp b/src/toolbar/MainToolbar.cpp --- a/src/toolbar/MainToolbar.cpp +++ b/src/toolbar/MainToolbar.cpp @@ -327,7 +327,7 @@ MainToolbar::layoutTrackBar() { m_dummy.label->hide(); - // this is the label parenting widge ("info") offset + // this is the label parenting widget ("info") offset const QPoint off = m_current.label->parentWidget()->geometry().topLeft(); QRect r = m_trackBarSpacer->geometry(); r.setWidth( r.width() / 3); @@ -882,7 +882,7 @@ tf = timeFrame( remainingSecs ); if( m_lastRemainingTime < 0 || tf != timeFrame( m_lastRemainingTime ) ) { - const int w = QFontMetrics( m_remainingTimeLabel->font() ).width( QString("-") + timeString[tf] ); + const int w = QFontMetrics( m_remainingTimeLabel->font() ).width( QStringLiteral("-") + timeString[tf] ); m_remainingTimeLabel->setFixedWidth( w ); relayout = true; } diff --git a/src/toolbar/SlimToolbar.h b/src/toolbar/SlimToolbar.h --- a/src/toolbar/SlimToolbar.h +++ b/src/toolbar/SlimToolbar.h @@ -33,10 +33,10 @@ Q_OBJECT public: - SlimToolbar( QWidget * parent ); - ~SlimToolbar(); + explicit SlimToolbar( QWidget * parent ); + ~SlimToolbar() override; - virtual bool eventFilter( QObject* object, QEvent* event ); + bool eventFilter( QObject* object, QEvent* event ) override; private: CurrentTrackToolbar * m_currentTrackToolbar; diff --git a/src/toolbar/VolumePopupButton.h b/src/toolbar/VolumePopupButton.h --- a/src/toolbar/VolumePopupButton.h +++ b/src/toolbar/VolumePopupButton.h @@ -21,7 +21,6 @@ #include class QAction; -class QEvent; class QLabel; class QMenu; class QMouseEvent; @@ -35,11 +34,11 @@ Q_OBJECT public: - VolumePopupButton( QWidget * parent ); + explicit VolumePopupButton( QWidget * parent ); protected: - virtual void mouseReleaseEvent( QMouseEvent * event ); - virtual void wheelEvent( QWheelEvent * event ); + void mouseReleaseEvent( QMouseEvent * event ) override; + void wheelEvent( QWheelEvent * event ) override; private Q_SLOTS: void volumeChanged( int newVolume ); diff --git a/src/toolbar/VolumePopupButton.cpp b/src/toolbar/VolumePopupButton.cpp --- a/src/toolbar/VolumePopupButton.cpp +++ b/src/toolbar/VolumePopupButton.cpp @@ -86,11 +86,11 @@ VolumePopupButton::volumeChanged( int newVolume ) { if ( newVolume < 34 ) - setIcon( QIcon::fromTheme( "audio-volume-low" ) ); + setIcon( QIcon::fromTheme( QStringLiteral("audio-volume-low") ) ); else if ( newVolume < 67 ) - setIcon( QIcon::fromTheme( "audio-volume-medium" ) ); + setIcon( QIcon::fromTheme( QStringLiteral("audio-volume-medium") ) ); else - setIcon( QIcon::fromTheme( "audio-volume-high" ) ); + setIcon( QIcon::fromTheme( QStringLiteral("audio-volume-high") ) ); m_volumeLabel->setText( QString::number( newVolume ) + '%' ); @@ -101,8 +101,7 @@ if ( newVolume ) m_muteAction->setChecked( false ); - const KLocalizedString tip = m_muteAction->isChecked() ? ki18n( "Volume: %1% (muted)" ) : ki18n( "Volume: %1%" ); - setToolTip( tip.subs( newVolume ).toString() ); + setToolTip( m_muteAction->isChecked() ? i18n( "Volume: %1% (muted)", newVolume ) : i18n( "Volume: %1%", newVolume )); } void @@ -112,7 +111,7 @@ if ( muted ) { - setIcon( QIcon::fromTheme( "audio-volume-muted" ) ); + setIcon( QIcon::fromTheme( QStringLiteral("audio-volume-muted") ) ); setToolTip( i18n( "Volume: %1% (muted)", volume ) ); } else diff --git a/src/transcoding/CMakeLists.txt b/src/transcoding/CMakeLists.txt --- a/src/transcoding/CMakeLists.txt +++ b/src/transcoding/CMakeLists.txt @@ -22,13 +22,13 @@ ) add_library(amarok-transcoding SHARED ${amarok_transcoding_SRCS}) - +generate_export_header(amarok-transcoding BASE_NAME amarok_transcoding) target_link_libraries(amarok-transcoding KF5::KIOCore KF5::ThreadWeaver Qt5::Core Qt5::Gui - ${CMAKE_THREAD_LIBS_INIT} + Threads::Threads amarokcore ) diff --git a/src/transcoding/TranscodingAssistantDialog.h b/src/transcoding/TranscodingAssistantDialog.h --- a/src/transcoding/TranscodingAssistantDialog.h +++ b/src/transcoding/TranscodingAssistantDialog.h @@ -41,16 +41,19 @@ public: /** * Create transcoding assistant dialog. Only encoders that encode to one of the - * @param playableFileTypes will be enabled. + * @p playableFileTypes will be enabled. + * @param playableFileTypes the playable file types * @param saveSupported true if transcoding config preference can be saved * @param operation whether this is copying or moving * @param destCollectionName name of the destination collection + * @param prevConfiguration previous configuration + * @param parent the parent widget */ AssistantDialog( const QStringList &playableFileTypes, bool saveSupported, Collections::CollectionLocationDelegate::OperationType operation, const QString &destCollectionName, const Configuration &prevConfiguration, - QWidget *parent = 0 ); + QWidget *parent = nullptr ); Configuration configuration() const { return m_configuration; } diff --git a/src/transcoding/TranscodingAssistantDialog.cpp b/src/transcoding/TranscodingAssistantDialog.cpp --- a/src/transcoding/TranscodingAssistantDialog.cpp +++ b/src/transcoding/TranscodingAssistantDialog.cpp @@ -50,8 +50,7 @@ QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel); QWidget *mainWidget = new QWidget(this); - QVBoxLayout *mainLayout = new QVBoxLayout; - setLayout(mainLayout); + QVBoxLayout *mainLayout = new QVBoxLayout(this); mainLayout->addWidget(mainWidget); QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok); okButton->setDefault(true); @@ -75,7 +74,7 @@ "format with an encoder (codec). This can be done to save space or to " "make your files readable by a portable music player or a particular " "software program." ); - justCopyIcon = QIcon::fromTheme( "edit-copy" ); + justCopyIcon = QIcon::fromTheme( QStringLiteral("edit-copy") ); justCopyText = i18n( "&Copy" ); justCopyDescription = i18n( "Just copy the tracks without transcoding them." ); break; @@ -86,7 +85,7 @@ "make your files readable by a portable music player or a particular " "software program. Only successfully transcoded files will be removed " "from their original location." ); - justCopyIcon = QIcon::fromTheme( "go-jump" ); // Dolphin uses this icon for "move" + justCopyIcon = QIcon::fromTheme( QStringLiteral("go-jump") ); // Dolphin uses this icon for "move" justCopyText = i18n( "&Move" ); justCopyDescription = i18n( "Just move the tracks without transcoding them." ); break; @@ -151,7 +150,7 @@ item->setToolTip( format->description() ); item->setData( Qt::UserRole, encoder ); - // can be disabled due to unavailabilty + // can be disabled due to unavailability bool enabled = available.contains( encoder ); if( !enabled ) item->setToolTip( i18nc( "Tooltip of a disabled transcoding encoder option", diff --git a/src/transcoding/TranscodingJob.h b/src/transcoding/TranscodingJob.h --- a/src/transcoding/TranscodingJob.h +++ b/src/transcoding/TranscodingJob.h @@ -44,20 +44,20 @@ * @param dest the path of the destination file, to be created. * @param configuration the string of parameters to be fed to the encoder. This implementation * uses the FFmpeg executable, @see http://ffmpeg.org/ffmpeg-doc.html#SEC6 - * @param the parent QObject. + * @param parent the parent QObject. */ explicit Job( const QUrl &src, const QUrl &dest, const Transcoding::Configuration &configuration, - QObject *parent = 0 ); + QObject *parent = nullptr ); /** * Convenience constructor. Creates a Transcoding::Job with the destination file to be * placed in the same directory as the source. */ explicit Job( QUrl &src, const Transcoding::Configuration &configuration, - QObject *parent = 0 ); + QObject *parent = nullptr ); /** * Sets the path of the source file. @@ -74,7 +74,7 @@ /** * Starts the transcoding job. */ - void start(); + void start() override; /** * Get the source url. diff --git a/src/transcoding/TranscodingJob.cpp b/src/transcoding/TranscodingJob.cpp --- a/src/transcoding/TranscodingJob.cpp +++ b/src/transcoding/TranscodingJob.cpp @@ -53,7 +53,7 @@ if( !( fileExtension.isEmpty() ) ) { QString destPath = src.path(); - destPath.truncate( destPath.lastIndexOf( '.' ) + 1 ); + destPath.truncate( destPath.lastIndexOf( QLatin1Char('.') ) + 1 ); destPath.append( fileExtension ); m_dest.setPath( destPath ); } @@ -68,14 +68,14 @@ m_transcoder->setOutputChannelMode( KProcess::MergedChannels ); //First the executable... - m_transcoder->setProgram( "ffmpeg" ); + m_transcoder->setProgram( QStringLiteral("ffmpeg") ); //... prevent ffmpeg from being interactive when destination file already exists. We - // would use -n to exit immediatelly, but libav's ffmpeg doesn't support it, so we + // would use -n to exit immediately, but libav's ffmpeg doesn't support it, so we // check for destination file existence manually and pass -y (overwrite) to avoid // race condition - *m_transcoder << QString( "-y" ); + *m_transcoder << QStringLiteral( "-y" ); //... then we'd have the infile configuration followed by "-i" and the infile path... - *m_transcoder << QString( "-i" ) + *m_transcoder << QStringLiteral( "-i" ) << m_src.path(); //... and finally, outfile configuration followed by the outfile path. const Transcoding::Format *format = Amarok::Components::transcodingController()->format( m_configuration.encoder() ); @@ -99,7 +99,7 @@ } else { - QString commandline = QString( "'" ) + m_transcoder->program().join("' '") + QString( "'" ); + QString commandline = QStringLiteral( "'" ) + m_transcoder->program().join(QStringLiteral("' '")) + QStringLiteral( "'" ); debug()<< "Calling" << commandline.toLocal8Bit().constData(); m_transcoder->start(); } @@ -114,7 +114,7 @@ { debug() << "NAY, transcoding fail!"; setError( KJob::UserDefinedError ); - setErrorText( QString( "Calling `" ) + m_transcoder->program().join(" ") + "` failed" ); + setErrorText( QStringLiteral( "Calling `" ) + m_transcoder->program().join(QStringLiteral(" ")) + "` failed" ); } emitResult(); } diff --git a/src/transcoding/TranscodingOptionsStackedWidget.h b/src/transcoding/TranscodingOptionsStackedWidget.h --- a/src/transcoding/TranscodingOptionsStackedWidget.h +++ b/src/transcoding/TranscodingOptionsStackedWidget.h @@ -31,7 +31,7 @@ { Q_OBJECT public: - explicit OptionsStackedWidget( QWidget *parent = 0 ); + explicit OptionsStackedWidget( QWidget *parent = nullptr ); const Configuration configuration( const Configuration::TrackSelection trackSelection ) const; diff --git a/src/transcoding/TranscodingOptionsStackedWidget.cpp b/src/transcoding/TranscodingOptionsStackedWidget.cpp --- a/src/transcoding/TranscodingOptionsStackedWidget.cpp +++ b/src/transcoding/TranscodingOptionsStackedWidget.cpp @@ -51,7 +51,7 @@ vbl->addLayout( hbl ); hbl->addStretch(); QLabel *arrow = new QLabel( welcomeWidget ); - arrow->setPixmap( QIcon::fromTheme( "arrow-left" ).pixmap( 16, 16 ) ); + arrow->setPixmap( QIcon::fromTheme( QStringLiteral("arrow-left") ).pixmap( 16, 16 ) ); QLabel *message = new QLabel( i18n( "In order to configure the parameters of the transcoding operation, please " "pick an encoder from the list." ), this ); @@ -104,7 +104,7 @@ OptionsStackedWidget::switchPage( Encoder encoder) { setCurrentIndex( m_pagesMap.value( encoder ) ); - emit formatChanged( encoder ); + Q_EMIT formatChanged( encoder ); } } //namespace Transcoding diff --git a/src/transcoding/TranscodingPropertySliderWidget.h b/src/transcoding/TranscodingPropertySliderWidget.h --- a/src/transcoding/TranscodingPropertySliderWidget.h +++ b/src/transcoding/TranscodingPropertySliderWidget.h @@ -33,11 +33,11 @@ { Q_OBJECT public: - explicit PropertySliderWidget( Property property, QWidget * parent = 0 ); + explicit PropertySliderWidget(const Property &property, QWidget * parent = nullptr ); - QVariant value() const; + QVariant value() const override; - QWidget *widget() { return qobject_cast< QWidget *>( this ); } + QWidget *widget() override { return qobject_cast< QWidget *>( this ); } private Q_SLOTS: void onSliderChanged( int value ); diff --git a/src/transcoding/TranscodingPropertySliderWidget.cpp b/src/transcoding/TranscodingPropertySliderWidget.cpp --- a/src/transcoding/TranscodingPropertySliderWidget.cpp +++ b/src/transcoding/TranscodingPropertySliderWidget.cpp @@ -25,17 +25,16 @@ namespace Transcoding { -PropertySliderWidget::PropertySliderWidget( Property property, QWidget * parent ) +PropertySliderWidget::PropertySliderWidget( const Property &property, QWidget * parent ) : QWidget( parent ) , m_property( property ) { m_name = property.name(); - QBoxLayout *mainLayout; m_mainLabel = new QLabel( m_property.prettyName(), this ); m_mainLabel->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred ); - mainLayout = new QVBoxLayout( this ); + QBoxLayout *mainLayout = new QVBoxLayout( this ); QBoxLayout *secondaryTopLayout = new QHBoxLayout( this ); QBoxLayout *secondaryBotLayout = new QHBoxLayout( this ); mainLayout->addWidget( m_mainLabel ); diff --git a/src/transcoding/TranscodingPropertyWidget.h b/src/transcoding/TranscodingPropertyWidget.h --- a/src/transcoding/TranscodingPropertyWidget.h +++ b/src/transcoding/TranscodingPropertyWidget.h @@ -32,7 +32,7 @@ class PropertyWidget { public: - static PropertyWidget * create( Property &property, QWidget * parent = 0 ); + static PropertyWidget * create( Property &property, QWidget * parent = nullptr ); virtual ~PropertyWidget(){} diff --git a/src/transcoding/TranscodingPropertyWidget.cpp b/src/transcoding/TranscodingPropertyWidget.cpp --- a/src/transcoding/TranscodingPropertyWidget.cpp +++ b/src/transcoding/TranscodingPropertyWidget.cpp @@ -32,7 +32,7 @@ return new PropertySliderWidget( property, parent ); default: debug() << "Muy bad!"; - return 0; + return nullptr; } } diff --git a/src/transcoding/TranscodingSelectConfigWidget.h b/src/transcoding/TranscodingSelectConfigWidget.h --- a/src/transcoding/TranscodingSelectConfigWidget.h +++ b/src/transcoding/TranscodingSelectConfigWidget.h @@ -34,7 +34,7 @@ Q_OBJECT public: - explicit SelectConfigWidget( QWidget *parent = 0 ); + explicit SelectConfigWidget( QWidget *parent = nullptr ); /** * Fills the combobox widget with appropriate transcoding configurations. diff --git a/src/transcoding/TranscodingSelectConfigWidget.cpp b/src/transcoding/TranscodingSelectConfigWidget.cpp --- a/src/transcoding/TranscodingSelectConfigWidget.cpp +++ b/src/transcoding/TranscodingSelectConfigWidget.cpp @@ -32,21 +32,21 @@ SelectConfigWidget::fillInChoices( const Configuration &savedConfiguration ) { clear(); - addItem( QIcon::fromTheme( "edit-copy" ), i18n( "Never" ), JustCopy ); - addItem( QIcon::fromTheme( "view-choose" ), i18n( "Ask before each transfer" ), Invalid ); + addItem( QIcon::fromTheme( QStringLiteral("edit-copy") ), i18n( "Never" ), JustCopy ); + addItem( QIcon::fromTheme( QStringLiteral("view-choose") ), i18n( "Ask before each transfer" ), Invalid ); if( savedConfiguration.isValid() ) { if( !savedConfiguration.isJustCopy() ) { Configuration temp = savedConfiguration; temp.setTrackSelection( Configuration::TranscodeAll ); - addItem( QIcon::fromTheme( "audio-x-generic" ), temp.prettyName(), + addItem( QIcon::fromTheme( QStringLiteral("audio-x-generic") ), temp.prettyName(), TranscodeAll ); temp.setTrackSelection( Configuration::TranscodeUnlessSameType ); - addItem( QIcon::fromTheme( "audio-x-generic" ), temp.prettyName(), + addItem( QIcon::fromTheme( QStringLiteral("audio-x-generic") ), temp.prettyName(), TranscodeUnlessSameType ); temp.setTrackSelection( Configuration::TranscodeOnlyIfNeeded ); - addItem( QIcon::fromTheme( "audio-x-generic" ),temp.prettyName(), + addItem( QIcon::fromTheme( QStringLiteral("audio-x-generic") ),temp.prettyName(), TranscodeOnlyIfNeeded ); setCurrentIndex( savedConfiguration.trackSelection() + 2 ); } diff --git a/src/transcoding/amarok_transcoding_export.h b/src/transcoding/amarok_transcoding_export.h deleted file mode 100644 --- a/src/transcoding/amarok_transcoding_export.h +++ /dev/null @@ -1,35 +0,0 @@ -/**************************************************************************************** - * Copyright (c) 2010 Téo Mrnjavac * - * * - * This program is free software; you can redistribute it and/or modify it under * - * the terms of the GNU General Public License as published by the Free Software * - * Foundation; either version 2 of the License, or (at your option) any later * - * version. * - * * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY * - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * - * PARTICULAR PURPOSE. See the GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License along with * - * this program. If not, see . * - ****************************************************************************************/ - -#ifndef AMAROK_TRANSCODING_EXPORT_H -#define AMAROK_TRANSCODING_EXPORT_H - -/* needed for Q_DECL_EXPORT and Q_DECL_IMPORT macros */ -#include - -#ifndef AMAROK_TRANSCODING_EXPORT -# ifdef MAKE_AMAROK_TRANSCODING_LIB - /* We are building this library */ -# define AMAROK_TRANSCODING_EXPORT Q_DECL_EXPORT - -# else - /* We are using this library */ -# define AMAROK_TRANSCODING_EXPORT Q_DECL_IMPORT - -# endif//MAKE_TRANSCODING_LIB -#endif// AMAROK_EXPORT - -#endif //AMAROK_TRANSCODING_EXPORT_H diff --git a/src/widgets/AlbumBreadcrumbWidget.h b/src/widgets/AlbumBreadcrumbWidget.h --- a/src/widgets/AlbumBreadcrumbWidget.h +++ b/src/widgets/AlbumBreadcrumbWidget.h @@ -42,10 +42,10 @@ Q_OBJECT public: - explicit AlbumBreadcrumbWidget( const Meta::AlbumPtr album, QWidget *parent = 0 ); + explicit AlbumBreadcrumbWidget( const Meta::AlbumPtr &album, QWidget *parent = nullptr ); ~AlbumBreadcrumbWidget(); - void setAlbum( const Meta::AlbumPtr album ); + void setAlbum( const Meta::AlbumPtr &album ); Q_SIGNALS: void artistClicked( const QString& ); diff --git a/src/widgets/AlbumBreadcrumbWidget.cpp b/src/widgets/AlbumBreadcrumbWidget.cpp --- a/src/widgets/AlbumBreadcrumbWidget.cpp +++ b/src/widgets/AlbumBreadcrumbWidget.cpp @@ -24,7 +24,7 @@ #include -AlbumBreadcrumbWidget::AlbumBreadcrumbWidget( const Meta::AlbumPtr album, QWidget *parent ) +AlbumBreadcrumbWidget::AlbumBreadcrumbWidget( const Meta::AlbumPtr &album, QWidget *parent ) : BoxWidget( false, parent ) , m_album( album ) { @@ -52,7 +52,7 @@ { } -void AlbumBreadcrumbWidget::setAlbum( const Meta::AlbumPtr album ) +void AlbumBreadcrumbWidget::setAlbum(const Meta::AlbumPtr &album ) { m_album = album; updateBreadcrumbs(); @@ -70,11 +70,11 @@ void AlbumBreadcrumbWidget::slotArtistClicked() { if( m_album->hasAlbumArtist() ) - emit artistClicked( m_album->albumArtist()->name() ); + Q_EMIT artistClicked( m_album->albumArtist()->name() ); } void AlbumBreadcrumbWidget::slotAlbumClicked() { - emit albumClicked( m_album->name() ); + Q_EMIT albumClicked( m_album->name() ); } diff --git a/src/widgets/AmarokDockWidget.h b/src/widgets/AmarokDockWidget.h --- a/src/widgets/AmarokDockWidget.h +++ b/src/widgets/AmarokDockWidget.h @@ -25,7 +25,7 @@ Q_OBJECT public: - explicit AmarokDockWidget( const QString & title, QWidget * parent = 0, Qt::WindowFlags flags = 0 ); + explicit AmarokDockWidget( const QString & title, QWidget * parent = nullptr, Qt::WindowFlags flags = {} ); void setMovable( bool movable ); diff --git a/src/widgets/AnalyzerWidget.h b/src/widgets/AnalyzerWidget.h --- a/src/widgets/AnalyzerWidget.h +++ b/src/widgets/AnalyzerWidget.h @@ -27,11 +27,11 @@ { Q_OBJECT public: - AnalyzerWidget( QWidget *parent ); + explicit AnalyzerWidget( QWidget *parent ); protected: - virtual void resizeEvent( QResizeEvent* ); - virtual void mousePressEvent( QMouseEvent* ); - virtual void contextMenuEvent( QContextMenuEvent* ); + void resizeEvent( QResizeEvent* ) override; + void mousePressEvent( QMouseEvent* ) override; + void contextMenuEvent( QContextMenuEvent* ) override; private: void changeAnalyzer(); QWidget *m_child; diff --git a/src/widgets/AnimatedLabelStack.h b/src/widgets/AnimatedLabelStack.h --- a/src/widgets/AnimatedLabelStack.h +++ b/src/widgets/AnimatedLabelStack.h @@ -25,7 +25,7 @@ Q_OBJECT public: - explicit AnimatedLabelStack( const QStringList &data, QWidget *parent = 0, Qt::WindowFlags f = 0 ); + explicit AnimatedLabelStack( const QStringList &data, QWidget *parent = nullptr, Qt::WindowFlags f = {} ); inline const QStringList &data() const { return m_data; } inline int opacity() { return m_targetOpacity; } void pulse( int cycles = -1, int minimum = 3 ); @@ -48,15 +48,15 @@ void clicked( const QString ¤t ); protected: - void enterEvent( QEvent * ); - void hideEvent( QHideEvent * ); - void leaveEvent( QEvent * ); - void paintEvent( QPaintEvent * ); - void mouseReleaseEvent( QMouseEvent * ); - void mousePressEvent( QMouseEvent * ); - void showEvent( QShowEvent * ); - void timerEvent( QTimerEvent * ); - void wheelEvent( QWheelEvent * ); + void enterEvent( QEvent * ) override; + void hideEvent( QHideEvent * ) override; + void leaveEvent( QEvent * ) override; + void paintEvent( QPaintEvent * ) override; + void mouseReleaseEvent( QMouseEvent * ) override; + void mousePressEvent( QMouseEvent * ) override; + void showEvent( QShowEvent * ) override; + void timerEvent( QTimerEvent * ) override; + void wheelEvent( QWheelEvent * ) override; private: void ensureAnimationStatus(); diff --git a/src/widgets/AnimatedLabelStack.cpp b/src/widgets/AnimatedLabelStack.cpp --- a/src/widgets/AnimatedLabelStack.cpp +++ b/src/widgets/AnimatedLabelStack.cpp @@ -139,7 +139,7 @@ { m_isClick = false; if ( !m_data.isEmpty() ) - emit clicked ( m_data.at( m_visibleIndex ) ); + Q_EMIT clicked ( m_data.at( m_visibleIndex ) ); } } @@ -281,7 +281,7 @@ m_time = m_fadeTime + 1; } ensureAnimationStatus(); - emit pulsing( on ); + Q_EMIT pulsing( on ); } void diff --git a/src/widgets/BookmarkPopup.h b/src/widgets/BookmarkPopup.h --- a/src/widgets/BookmarkPopup.h +++ b/src/widgets/BookmarkPopup.h @@ -31,22 +31,22 @@ Q_OBJECT public: - BookmarkPopup ( QWidget* parent, QString label, BookmarkTriangle* triangle ); + explicit BookmarkPopup ( QWidget* parent, const QString &label, BookmarkTriangle* triangle ); - virtual QSize sizeHint () const; + QSize sizeHint () const override; virtual QSizePolicy sizePolicy () const; - virtual QSize minimumSizeHint () const; + QSize minimumSizeHint () const override; - virtual void mouseReleaseEvent ( QMouseEvent * event ); - virtual void mouseMoveEvent ( QMouseEvent * event ); - virtual void enterEvent ( QEvent* ); - virtual void leaveEvent ( QEvent* ); + void mouseReleaseEvent ( QMouseEvent * event ) override; + void mouseMoveEvent ( QMouseEvent * event ) override; + void enterEvent ( QEvent* ) override; + void leaveEvent ( QEvent* ) override; virtual void displayNeeded ( bool value ); protected: - virtual void paintEvent ( QPaintEvent* event ); + void paintEvent ( QPaintEvent* event ) override; protected Q_SLOTS: virtual void editValueChanged(); diff --git a/src/widgets/BookmarkPopup.cpp b/src/widgets/BookmarkPopup.cpp --- a/src/widgets/BookmarkPopup.cpp +++ b/src/widgets/BookmarkPopup.cpp @@ -27,7 +27,7 @@ #include #include -BookmarkPopup::BookmarkPopup ( QWidget* parent, QString label, BookmarkTriangle* triangle ) +BookmarkPopup::BookmarkPopup (QWidget* parent, const QString &label, BookmarkTriangle* triangle ) : QWidget ( parent ) , m_label ( label ) , m_triangle ( triangle ) diff --git a/src/widgets/BookmarkTriangle.h b/src/widgets/BookmarkTriangle.h --- a/src/widgets/BookmarkTriangle.h +++ b/src/widgets/BookmarkTriangle.h @@ -34,30 +34,32 @@ { Q_OBJECT public: - BookmarkTriangle( QWidget *parent, int milliseconds, QString name, int sliderwidth, + BookmarkTriangle( QWidget *parent, int milliseconds, const QString &name, int sliderwidth, bool showPopup = false ); - ~BookmarkTriangle(); - virtual QSize sizeHint() const; + ~BookmarkTriangle() override; + QSize sizeHint() const override; virtual QSizePolicy sizePolicy() const; - virtual QSize minimumSizeHint() const; + QSize minimumSizeHint() const override; - virtual void showEvent ( QShowEvent * event ); - virtual void mousePressEvent ( QMouseEvent * event ); - virtual void mouseMoveEvent ( QMouseEvent * event ); - virtual void mouseReleaseEvent (QMouseEvent *); - virtual void enterEvent ( QEvent * event ); - virtual void leaveEvent ( QEvent * event ); - virtual void paintEvent ( QPaintEvent* ); + void showEvent ( QShowEvent * event ) override; + void mousePressEvent ( QMouseEvent * event ) override; + void mouseMoveEvent ( QMouseEvent * event ) override; + void mouseReleaseEvent (QMouseEvent *) override; + void enterEvent ( QEvent * event ) override; + void leaveEvent ( QEvent * event ) override; + void paintEvent ( QPaintEvent* ) override; virtual void hidePopup(); /** - * Updates the position of the bookmark named @param name to @param newMiliseconds. + * Updates the position of the bookmark named @p name to @p newMilliseconds. * * The name should be a valid existing bookmark name and should include the trailing * "- m:ss" + * @param name the name + * @param newMilliseconds the new position in milliseconds */ - virtual void moveBookmark( qint64 newMilliseconds, QString name ); + virtual void moveBookmark( qint64 newMilliseconds, const QString &name ); virtual void deleteBookmark(); virtual int getTimeValue(); @@ -72,8 +74,8 @@ int m_mseconds; /// position of the bookmark on the slider in terms of milliseconds QString m_name; /// name of the bookmark int m_sliderwidth; /// width of the slider on which the bookmark will appear - bool m_showPopup; /// used to determine whether to show the Pop-up on focussing the bookmark - BookmarkPopup* m_tooltip; /// the tooltip that appears on focussing the bookmark + bool m_showPopup; /// used to determine whether to show the Pop-up on focusing the bookmark + BookmarkPopup* m_tooltip; /// the tooltip that appears on focusing the bookmark QPoint m_offset; /// used while moving the bookmark, holds the position of the bookmark before moving int m_pos; /// used while moving the bookmark, holds the x co-ordinate of the bookmark after moving }; diff --git a/src/widgets/BookmarkTriangle.cpp b/src/widgets/BookmarkTriangle.cpp --- a/src/widgets/BookmarkTriangle.cpp +++ b/src/widgets/BookmarkTriangle.cpp @@ -34,7 +34,7 @@ #include #include -BookmarkTriangle::BookmarkTriangle ( QWidget *parent, int milliseconds, QString name, +BookmarkTriangle::BookmarkTriangle (QWidget *parent, int milliseconds, const QString &name, int sliderwidth, bool showPopup ) : QWidget ( parent ), m_mseconds ( milliseconds ), @@ -109,7 +109,7 @@ event->accept(); if( this->x() == m_pos ){ - emit clicked ( m_mseconds ); + Q_EMIT clicked ( m_mseconds ); } else { @@ -127,7 +127,7 @@ } } -void BookmarkTriangle::moveBookmark ( qint64 newMilliseconds, QString name ) +void BookmarkTriangle::moveBookmark ( qint64 newMilliseconds, const QString &name ) { hidePopup(); Meta::TrackPtr track = The::engineController()->currentTrack(); @@ -149,7 +149,7 @@ DEBUG_BLOCK Q_UNUSED ( event ) - emit focused ( m_mseconds ); + Q_EMIT focused ( m_mseconds ); initPopup(); } diff --git a/src/widgets/BoxWidget.h b/src/widgets/BoxWidget.h --- a/src/widgets/BoxWidget.h +++ b/src/widgets/BoxWidget.h @@ -38,14 +38,15 @@ * Constructor * @param vertical defines if this BoxWidget has a vertical Layout. * Has a horizontal if false. + * @param parent the parent widget. */ - explicit BoxWidget( bool vertical = true, QWidget *parent = Q_NULLPTR ); - virtual ~BoxWidget() {} + explicit BoxWidget( bool vertical = true, QWidget *parent = nullptr ); + ~BoxWidget() override {} QBoxLayout* layout() const; protected: - virtual void childEvent(QChildEvent* event) Q_DECL_OVERRIDE; + void childEvent(QChildEvent* event) override; }; #endif // BOXWIDGET_H diff --git a/src/widgets/BreadcrumbItemButton.h b/src/widgets/BreadcrumbItemButton.h --- a/src/widgets/BreadcrumbItemButton.h +++ b/src/widgets/BreadcrumbItemButton.h @@ -23,9 +23,7 @@ #include "widgets/ElidingButton.h" -class QUrl; class QEvent; -class KUrlNavigator; /** * @brief Base class for buttons of the URL navigator. @@ -38,14 +36,14 @@ Q_OBJECT public: - BreadcrumbItemButton( QWidget* parent ); + explicit BreadcrumbItemButton( QWidget* parent ); BreadcrumbItemButton( const QString &text, QWidget *parent ); BreadcrumbItemButton( const QIcon &icon, const QString &text, QWidget *parent ); - virtual ~BreadcrumbItemButton(); + ~BreadcrumbItemButton() override; void setActive( const bool active ); - virtual QSize sizeHint() const; + QSize sizeHint() const override; protected: enum DisplayHint @@ -57,10 +55,10 @@ void setDisplayHintEnabled(DisplayHint hint, bool enable); bool isDisplayHintEnabled(DisplayHint hint) const; - virtual void enterEvent(QEvent* event); - virtual void leaveEvent(QEvent* event); + void enterEvent(QEvent* event) override; + void leaveEvent(QEvent* event) override; - virtual void paintEvent(QPaintEvent* event); + void paintEvent(QPaintEvent* event) override; virtual void drawHoverBackground(QPainter* painter); /** Returns the foreground color by respecting the current display hint. */ @@ -77,10 +75,10 @@ public: explicit BreadcrumbItemMenuButton( QWidget* parent ); - virtual ~BreadcrumbItemMenuButton() { } + ~BreadcrumbItemMenuButton() override { } protected: - virtual void paintEvent(QPaintEvent* event); + void paintEvent(QPaintEvent* event) override; }; class BreadcrumbUrlMenuButton : public BreadcrumbItemButton diff --git a/src/widgets/ClearSpinBox.h b/src/widgets/ClearSpinBox.h --- a/src/widgets/ClearSpinBox.h +++ b/src/widgets/ClearSpinBox.h @@ -24,12 +24,12 @@ class ClearSpinBox : public QSpinBox { public: - ClearSpinBox( QWidget* parent = 0 ); + explicit ClearSpinBox( QWidget* parent = nullptr ); protected: - virtual QValidator::State validate( QString &input, int &pos ) const; - virtual int valueFromText( const QString& text ) const; - virtual QString textFromValue( int val ) const; + QValidator::State validate( QString &input, int &pos ) const override; + int valueFromText( const QString& text ) const override; + QString textFromValue( int val ) const override; }; #endif // CLEARSPINBOX_H diff --git a/src/widgets/ComboBox.h b/src/widgets/ComboBox.h --- a/src/widgets/ComboBox.h +++ b/src/widgets/ComboBox.h @@ -37,11 +37,11 @@ Q_OBJECT public: - ComboBox( QWidget *parent = 0 ); - virtual ~ComboBox() {}; + explicit ComboBox( QWidget *parent = nullptr ); + ~ComboBox() override {} protected: - virtual void keyPressEvent( QKeyEvent *event ); + void keyPressEvent( QKeyEvent *event ) override; Q_SIGNALS: void downPressed(); diff --git a/src/widgets/ComboBox.cpp b/src/widgets/ComboBox.cpp --- a/src/widgets/ComboBox.cpp +++ b/src/widgets/ComboBox.cpp @@ -39,7 +39,7 @@ else if( event->key() == Qt::Key_Down ) { event->accept(); - emit downPressed(); + Q_EMIT downPressed(); return; } KComboBox::keyPressEvent( event ); diff --git a/src/widgets/CoverLabel.h b/src/widgets/CoverLabel.h --- a/src/widgets/CoverLabel.h +++ b/src/widgets/CoverLabel.h @@ -26,12 +26,12 @@ class CoverLabel : public QLabel { public: - explicit CoverLabel( QWidget * parent, Qt::WindowFlags f = 0 ); + explicit CoverLabel( QWidget * parent, Qt::WindowFlags f = {} ); void setInformation( const QString &artist, const QString &album ); protected: - virtual void mouseReleaseEvent( QMouseEvent *pEvent ); + void mouseReleaseEvent( QMouseEvent *pEvent ) override; private: QString m_artist; diff --git a/src/widgets/EditDeleteComboBoxView.h b/src/widgets/EditDeleteComboBoxView.h --- a/src/widgets/EditDeleteComboBoxView.h +++ b/src/widgets/EditDeleteComboBoxView.h @@ -29,14 +29,14 @@ Q_OBJECT public: - EditDeleteComboBoxView( QWidget* parent = 0 ); + explicit EditDeleteComboBoxView( QWidget* parent = nullptr ); Q_SIGNALS: void editItem( const QString &itemName ); void deleteItem( const QString &itemName ); protected: - virtual void mousePressEvent( QMouseEvent* ); + void mousePressEvent( QMouseEvent* ) override; }; #endif diff --git a/src/widgets/EditDeleteComboBoxView.cpp b/src/widgets/EditDeleteComboBoxView.cpp --- a/src/widgets/EditDeleteComboBoxView.cpp +++ b/src/widgets/EditDeleteComboBoxView.cpp @@ -37,9 +37,9 @@ mousePressPos.ry() += verticalOffset(); if ( EditDeleteDelegate::hitsEdit( mousePressPos, rectForIndex( index ) ) ) - emit( editItem( index.data().toString() ) ); + Q_EMIT( editItem( index.data().toString() ) ); else if ( EditDeleteDelegate::hitsDelete( mousePressPos, rectForIndex( index ) ) ) - emit( deleteItem( index.data().toString() ) ); + Q_EMIT( deleteItem( index.data().toString() ) ); QListView::mousePressEvent( event ); } diff --git a/src/widgets/EditDeleteDelegate.h b/src/widgets/EditDeleteDelegate.h --- a/src/widgets/EditDeleteDelegate.h +++ b/src/widgets/EditDeleteDelegate.h @@ -26,10 +26,10 @@ class EditDeleteDelegate : public QStyledItemDelegate { public: - EditDeleteDelegate( QObject *parent ); + explicit EditDeleteDelegate( QObject *parent ); - virtual void paint ( QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index ) const; - virtual QSize sizeHint ( const QStyleOptionViewItem & option, const QModelIndex & index ) const; + void paint ( QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index ) const override; + QSize sizeHint ( const QStyleOptionViewItem & option, const QModelIndex & index ) const override; static bool hitsEdit( const QPoint &point, const QRect &rect ); static bool hitsDelete( const QPoint &point, const QRect &rect ); diff --git a/src/widgets/EditDeleteDelegate.cpp b/src/widgets/EditDeleteDelegate.cpp --- a/src/widgets/EditDeleteDelegate.cpp +++ b/src/widgets/EditDeleteDelegate.cpp @@ -68,16 +68,16 @@ bool EditDeleteDelegate::hitsEdit( const QPoint &point, const QRect &rect ) { DEBUG_BLOCK - //we considder the icon to be full height, so we just count from the right edge. + //we consider the icon to be full height, so we just count from the right edge. int right = ( rect.x() + rect.width() ) - ( MARGIN * 2 + ICON_WIDTH ); int left = right - ICON_WIDTH; return ( point.x() > left ) && ( point.x() < right ); } bool EditDeleteDelegate::hitsDelete( const QPoint &point, const QRect &rect ) { DEBUG_BLOCK - //we considder the icon to be full height, so we just count from the right edge. + //we consider the icon to be full height, so we just count from the right edge. int right = ( rect.x() + rect.width() ) - MARGIN; int left = right - ICON_WIDTH; return ( point.x() > left ) && ( point.x() < right ); diff --git a/src/widgets/ElidingButton.h b/src/widgets/ElidingButton.h --- a/src/widgets/ElidingButton.h +++ b/src/widgets/ElidingButton.h @@ -34,16 +34,16 @@ Q_OBJECT public: - ElidingButton( QWidget *parent ); + explicit ElidingButton( QWidget *parent ); ElidingButton( const QString & text, QWidget *parent ); ElidingButton( const QIcon & icon, const QString & text, QWidget *parent ); - ~ElidingButton(); + ~ElidingButton() override; bool isElided() const; QSizePolicy sizePolicy() const; virtual void setText( const QString &text ); - virtual void resizeEvent( QResizeEvent *event ); + void resizeEvent( QResizeEvent *event ) override; Q_SIGNALS: void sizePolicyChanged(); diff --git a/src/widgets/ElidingButton.cpp b/src/widgets/ElidingButton.cpp --- a/src/widgets/ElidingButton.cpp +++ b/src/widgets/ElidingButton.cpp @@ -122,7 +122,7 @@ if( m_isElided != elided ) { m_isElided = elided; - emit( sizePolicyChanged() ); + Q_EMIT( sizePolicyChanged() ); } } diff --git a/src/widgets/FilenameLayoutWidget.h b/src/widgets/FilenameLayoutWidget.h --- a/src/widgets/FilenameLayoutWidget.h +++ b/src/widgets/FilenameLayoutWidget.h @@ -16,8 +16,8 @@ * this program. If not, see . * ****************************************************************************************/ -#ifndef FILENAMELAYOUTDIALOG_H -#define FILENAMELAYOUTDIALOG_H +#ifndef FILENAMELAYOUTWIDGET_H +#define FILENAMELAYOUTWIDGET_H #include "amarok_export.h" @@ -27,7 +27,6 @@ class TokenPool; class TokenDropTarget; -class QFileInfo; class QStackedWidget; class QLabel; class QFrame; @@ -70,7 +69,7 @@ , CollectionRoot }; - explicit FilenameLayoutWidget( QWidget *parent = 0 ); + explicit FilenameLayoutWidget( QWidget *parent = nullptr ); virtual ~FilenameLayoutWidget() {} QString getParsableScheme() const; @@ -149,5 +148,5 @@ }; -#endif //FILENAMELAYOUTDIALOG_H +#endif //FILENAMELAYOUTWIDGET_H diff --git a/src/widgets/FilenameLayoutWidget.cpp b/src/widgets/FilenameLayoutWidget.cpp --- a/src/widgets/FilenameLayoutWidget.cpp +++ b/src/widgets/FilenameLayoutWidget.cpp @@ -255,7 +255,7 @@ inferScheme( scheme ); slotUpdatePresetButton(); - emit schemeChanged(); + Q_EMIT schemeChanged(); } //Handles the modifications to the dialog to toggle between advanced and basic editing mode. diff --git a/src/widgets/FlowLayout.h b/src/widgets/FlowLayout.h --- a/src/widgets/FlowLayout.h +++ b/src/widgets/FlowLayout.h @@ -35,19 +35,19 @@ { public: explicit FlowLayout(QWidget *parent, int margin = 0, int spacing = -1); - FlowLayout(int spacing = -1); - ~FlowLayout(); - - void addItem(QLayoutItem *item); - Qt::Orientations expandingDirections() const; - bool hasHeightForWidth() const; - int heightForWidth(int) const; - int count() const; - QLayoutItem *itemAt(int index) const; - QSize minimumSize() const; - void setGeometry(const QRect &rect); - QSize sizeHint() const; - QLayoutItem *takeAt(int index); + explicit FlowLayout(int spacing = -1); + ~FlowLayout() override; + + void addItem(QLayoutItem *item) override; + Qt::Orientations expandingDirections() const override; + bool hasHeightForWidth() const override; + int heightForWidth(int) const override; + int count() const override; + QLayoutItem *itemAt(int index) const override; + QSize minimumSize() const override; + void setGeometry(const QRect &rect) override; + QSize sizeHint() const override; + QLayoutItem *takeAt(int index) override; private: int doLayout(const QRect &rect, bool testOnly) const; diff --git a/src/widgets/HintLineEdit.h b/src/widgets/HintLineEdit.h --- a/src/widgets/HintLineEdit.h +++ b/src/widgets/HintLineEdit.h @@ -28,9 +28,9 @@ Q_OBJECT public: - explicit HintLineEdit( const QString &hint, const QString &text, QWidget *parent = 0 ); - explicit HintLineEdit( const QString &text, QWidget *parent = 0 ); - HintLineEdit( QWidget *parent = 0 ); + explicit HintLineEdit( const QString &hint, const QString &text, QWidget *parent = nullptr ); + explicit HintLineEdit( const QString &text, QWidget *parent = nullptr ); + explicit HintLineEdit( QWidget *parent = nullptr ); virtual ~HintLineEdit(); virtual QObject *parent(); diff --git a/src/widgets/HorizontalDivider.h b/src/widgets/HorizontalDivider.h --- a/src/widgets/HorizontalDivider.h +++ b/src/widgets/HorizontalDivider.h @@ -27,12 +27,12 @@ class HorizontalDivider : public QWidget { public: - HorizontalDivider( QWidget * parent ); + explicit HorizontalDivider( QWidget * parent ); - ~HorizontalDivider(); + ~HorizontalDivider() override; protected: - virtual void paintEvent ( QPaintEvent* event ); + void paintEvent ( QPaintEvent* event ) override; }; diff --git a/src/widgets/IconButton.h b/src/widgets/IconButton.h --- a/src/widgets/IconButton.h +++ b/src/widgets/IconButton.h @@ -26,19 +26,19 @@ Q_OBJECT public: - IconButton( QWidget *parent = 0 ); - virtual QSize sizeHint() const; + explicit IconButton( QWidget *parent = nullptr ); + QSize sizeHint() const override; void setIcon( const QImage &img, int steps = 0 ); Q_SIGNALS: void clicked(); protected: - virtual void mousePressEvent( QMouseEvent * ); - virtual void mouseReleaseEvent( QMouseEvent * ); - virtual void paintEvent( QPaintEvent * ); - virtual void resizeEvent(QResizeEvent *); - virtual void timerEvent ( QTimerEvent * ); + void mousePressEvent( QMouseEvent * ) override; + void mouseReleaseEvent( QMouseEvent * ) override; + void paintEvent( QPaintEvent * ) override; + void resizeEvent(QResizeEvent *) override; + void timerEvent ( QTimerEvent * ) override; /** Reload the content for the given size diff --git a/src/widgets/IconButton.cpp b/src/widgets/IconButton.cpp --- a/src/widgets/IconButton.cpp +++ b/src/widgets/IconButton.cpp @@ -66,7 +66,7 @@ if ( m_isClick && rect().contains( me->pos() ) ) { m_isClick = false; - emit clicked(); + Q_EMIT clicked(); } } diff --git a/src/widgets/LineEdit.h b/src/widgets/LineEdit.h --- a/src/widgets/LineEdit.h +++ b/src/widgets/LineEdit.h @@ -35,10 +35,10 @@ Q_OBJECT public: - LineEdit( QWidget *parent = 0 ); - virtual ~LineEdit() {}; + explicit LineEdit( QWidget *parent = nullptr ); + ~LineEdit() override {} - void keyPressEvent( QKeyEvent *event ); + void keyPressEvent( QKeyEvent *event ) override; Q_SIGNALS: void downPressed(); diff --git a/src/widgets/LineEdit.cpp b/src/widgets/LineEdit.cpp --- a/src/widgets/LineEdit.cpp +++ b/src/widgets/LineEdit.cpp @@ -37,13 +37,13 @@ else if( event->key() == Qt::Key_Down ) { event->accept(); - emit downPressed(); + Q_EMIT downPressed(); return; } else if ( event->key() == Qt::Key_Up ) { event->accept(); - emit upPressed(); + Q_EMIT upPressed(); return; } QLineEdit::keyPressEvent( event ); diff --git a/src/widgets/MetaQueryWidget.h b/src/widgets/MetaQueryWidget.h --- a/src/widgets/MetaQueryWidget.h +++ b/src/widgets/MetaQueryWidget.h @@ -18,8 +18,8 @@ * this program. If not, see . * ****************************************************************************************/ -#ifndef AMAROK_METAQUERY_H -#define AMAROK_METAQUERY_H +#ifndef AMAROK_METAQUERYWIDGET_H +#define AMAROK_METAQUERYWIDGET_H #include #include @@ -29,13 +29,9 @@ #include #include -class QFrame; -class QGridLayout; class QHBoxLayout; class QLabel; -class QToolButton; class QVBoxLayout; -class KToolBar; namespace Collections { @@ -50,12 +46,12 @@ Q_OBJECT public: - TimeDistanceWidget( QWidget *parent = 0 ); + explicit TimeDistanceWidget( QWidget *parent = nullptr ); qint64 timeDistance() const; void setTimeDistance( qint64 value ); - template - void connectChanged( typename QtPrivate::FunctionPointer::Object *receiver, Func slot ) + template + void connectChanged( Receiver receiver, Func slot ) { connect( m_timeEdit, QOverload::of(&QSpinBox::valueChanged), receiver, slot ); @@ -79,10 +75,11 @@ public: /** Creates a MetaQueryWidget which can be used to select one meta query filter. + * @param parent The parent widget * @param onlyNumeric If set to true the widget will only display numeric fields. * @param noCondition If set to true no condition can be selected. */ - explicit MetaQueryWidget( QWidget* parent = 0, bool onlyNumeric = false, bool noCondition = false ); + explicit MetaQueryWidget( QWidget* parent = nullptr, bool onlyNumeric = false, bool noCondition = false ); ~MetaQueryWidget(); enum FilterCondition @@ -149,7 +146,8 @@ static bool isDate( qint64 field ); /** Returns a localized text of the condition. - @param field Needed in order to test whether the field is a date, numeric or a string since the texts differ slightly + * @param condition The condition + * @param field Needed in order to test whether the field is a date, numeric or a string since the texts differ slightly */ static QString conditionToString( FilterCondition condition, qint64 field ); @@ -181,7 +179,7 @@ void numValueTimeDistanceChanged(); void numValueFormatChanged( int ); - void populateComboBox( QStringList ); + void populateComboBox(const QStringList & ); void comboBoxPopulated(); private: @@ -199,7 +197,7 @@ void makeMetaComboSelection( qint64 field ); void makeFormatComboSelection(); - void makeGenericNumberSelection( qint64 field, const QString& unit = "" ); + void makeGenericNumberSelection( qint64 field, const QString& unit = QLatin1String("") ); void makePlaycountSelection(); void makeRatingSelection(); void makeLengthSelection(); diff --git a/src/widgets/MetaQueryWidget.cpp b/src/widgets/MetaQueryWidget.cpp --- a/src/widgets/MetaQueryWidget.cpp +++ b/src/widgets/MetaQueryWidget.cpp @@ -95,7 +95,7 @@ void TimeDistanceWidget::setTimeDistance( qint64 value ) { - // as we don't store the time unit we try to reconstuct it + // as we don't store the time unit we try to reconstruct it int unit = 0; if( value > 600 || !(value % 60) ) { unit = 1; @@ -298,7 +298,7 @@ setValueSelection(); m_settingFilter = false; - emit changed(m_filter); + Q_EMIT changed(m_filter); } static void addIconItem( QComboBox *box, qint64 field ) @@ -375,7 +375,7 @@ setValueSelection(); - emit changed(m_filter); + Q_EMIT changed(m_filter); } void @@ -392,7 +392,7 @@ && m_filter.condition != OlderThan && m_filter.condition != NewerThan ) { - // fix some inaccuracies caused by the conversion absoulte/relative time specifications + // fix some inaccuracies caused by the conversion absolute/relative time specifications // this is actually just for visual consistency int unit = 0; qint64 value = QDateTime::currentDateTime().toTime_t() - m_filter.numValue; @@ -459,63 +459,63 @@ setValueSelection(); - emit changed(m_filter); + Q_EMIT changed(m_filter); } void MetaQueryWidget::valueChanged( const QString& value ) { m_filter.value = value; - emit changed(m_filter); + Q_EMIT changed(m_filter); } void MetaQueryWidget::numValueChanged( int value ) { m_filter.numValue = value; - emit changed(m_filter); + Q_EMIT changed(m_filter); } void MetaQueryWidget::numValue2Changed( int value ) { m_filter.numValue2 = value; - emit changed(m_filter); + Q_EMIT changed(m_filter); } void MetaQueryWidget::numValueChanged( qint64 value ) { m_filter.numValue = value; - emit changed(m_filter); + Q_EMIT changed(m_filter); } void MetaQueryWidget::numValue2Changed( qint64 value ) { m_filter.numValue2 = value; - emit changed(m_filter); + Q_EMIT changed(m_filter); } void MetaQueryWidget::numValueChanged( const QTime& value ) { m_filter.numValue = qAbs( value.secsTo( QTime(0,0,0) ) ); - emit changed(m_filter); + Q_EMIT changed(m_filter); } void MetaQueryWidget::numValue2Changed( const QTime& value ) { m_filter.numValue2 = qAbs( value.secsTo( QTime(0,0,0) ) ); - emit changed(m_filter); + Q_EMIT changed(m_filter); } void @@ -528,7 +528,7 @@ dateSelection->getDate( &date ); m_filter.numValue = QDateTime( date ).toTime_t(); - emit changed(m_filter); + Q_EMIT changed(m_filter); } } @@ -542,7 +542,7 @@ dateSelection->getDate( &date ); m_filter.numValue2 = QDateTime( date ).toTime_t(); - emit changed(m_filter); + Q_EMIT changed(m_filter); } } @@ -558,7 +558,7 @@ { m_filter.numValue = distanceSelection->timeDistance(); - emit changed(m_filter); + Q_EMIT changed(m_filter); } } @@ -569,7 +569,7 @@ if( combo ) { m_filter.numValue = combo->itemData( index ).toInt(); - emit changed(m_filter); + Q_EMIT changed(m_filter); } } @@ -747,7 +747,7 @@ } void -MetaQueryWidget::populateComboBox( QStringList results ) +MetaQueryWidget::populateComboBox( const QStringList &results ) { QObject* query = sender(); if( !query ) @@ -1037,7 +1037,7 @@ ; // fall through } } - return QString( i18n("unknown comparison") ); + return i18n("unknown comparison"); } QString diff --git a/src/widgets/Osd.h b/src/widgets/Osd.h --- a/src/widgets/Osd.h +++ b/src/widgets/Osd.h @@ -54,7 +54,7 @@ /** reimplemented, hide the OSD */ virtual void hide(); - virtual void setVisible( bool visible ); + void setVisible( bool visible ) override; /** * For the sake of simplicity, when these settings are @@ -86,7 +86,7 @@ protected: explicit OSDWidget( QWidget *parent, const char *name = "osd" ); - virtual ~OSDWidget(); + ~OSDWidget() override; // work-around to get default point size on this platform, Qt API does not offer this directly inline qreal defaultPointSize() const { return QFont(font().family()).pointSizeF(); } @@ -108,9 +108,9 @@ void unsetColors(); // Reimplemented from QWidget - virtual void paintEvent( QPaintEvent* ); - virtual void mousePressEvent( QMouseEvent* ); - virtual void changeEvent( QEvent* ); + void paintEvent( QPaintEvent* ) override; + void mousePressEvent( QMouseEvent* ) override; + void changeEvent( QEvent* ) override; /** distance from screen edge */ static const int MARGIN = 15; @@ -141,7 +141,7 @@ Q_OBJECT public: - OSDPreviewWidget( QWidget *parent ); + explicit OSDPreviewWidget( QWidget *parent ); public Q_SLOTS: void setTextColor( const QColor &color ) { OSDWidget::setTextColor( color ); doUpdate(); } @@ -151,18 +151,18 @@ void setUseCustomColors( const bool use, const QColor &fg ); - virtual void hide() { QWidget::hide(); } + void hide() override { QWidget::hide(); } private: inline void doUpdate() { if( !isHidden() ) show(); } Q_SIGNALS: void positionChanged(); protected: - void mousePressEvent( QMouseEvent * ); - void mouseReleaseEvent( QMouseEvent * ); - void mouseMoveEvent( QMouseEvent * ); + void mousePressEvent( QMouseEvent * ) override; + void mouseReleaseEvent( QMouseEvent * ) override; + void mouseMoveEvent( QMouseEvent * ) override; private: bool m_dragging; @@ -185,11 +185,11 @@ virtual void show( Meta::TrackPtr track ); // Don't hide baseclass methods - prevent compiler warnings - virtual void show() { OSDWidget::show(); } + void show() override { OSDWidget::show(); } protected Q_SLOTS: void muteStateChanged( bool mute ); - void trackPlaying( Meta::TrackPtr track ); + void trackPlaying( const Meta::TrackPtr &track ); void stopped(); void paused(); void metadataChanged(); @@ -203,7 +203,7 @@ private: OSD(); - ~OSD(); + ~OSD() override; static OSD* s_instance; diff --git a/src/widgets/Osd.cpp b/src/widgets/Osd.cpp --- a/src/widgets/Osd.cpp +++ b/src/widgets/Osd.cpp @@ -185,7 +185,7 @@ void OSDWidget::ratingChanged( const short rating ) { - m_text = '\n' + i18n( "Rating changed" ); + m_text = QLatin1Char('\n') + i18n( "Rating changed" ); setRating( rating ); //Checks isEnabled() before doing anything show(); @@ -199,8 +199,7 @@ if ( isEnabled() ) { m_showVolume = true; - const KLocalizedString text = The::engineController()->isMuted() ? ki18n( "Volume: %1% (muted)" ) : ki18n( "Volume: %1%" ); - m_text = text.subs( m_volume ).toString(); + m_text = The::engineController()->isMuted() ? i18n( "Volume: %1% (muted)", m_volume) : i18n( "Volume: %1%", m_volume); show(); } @@ -541,7 +540,7 @@ m_dragging = false; releaseMouse(); - emit positionChanged(); + Q_EMIT positionChanged(); } } @@ -607,7 +606,7 @@ // Class OSD ///////////////////////////////////////////////////////////////////////////////////////// -Amarok::OSD* Amarok::OSD::s_instance = 0; +Amarok::OSD* Amarok::OSD::s_instance = nullptr; Amarok::OSD* Amarok::OSD::instance() @@ -621,7 +620,7 @@ if ( s_instance ) { delete s_instance; - s_instance = 0; + s_instance = nullptr; } } @@ -744,7 +743,7 @@ } void -Amarok::OSD::trackPlaying( Meta::TrackPtr track ) +Amarok::OSD::trackPlaying( const Meta::TrackPtr &track ) { m_currentTrack = track; diff --git a/src/widgets/PixmapViewer.h b/src/widgets/PixmapViewer.h --- a/src/widgets/PixmapViewer.h +++ b/src/widgets/PixmapViewer.h @@ -24,17 +24,16 @@ #include #include -class QMouseEvent; class QPixmap; class PixmapViewer : public QWidget { Q_OBJECT Q_PROPERTY( qreal zoomFactor READ zoomFactor WRITE setZoomFactor NOTIFY zoomFactorChanged ) public: - PixmapViewer( QWidget *parent, const QPixmap &pixmap, int screenNumber ); - virtual ~PixmapViewer(); + explicit PixmapViewer( QWidget *parent, const QPixmap &pixmap, int screenNumber ); + ~PixmapViewer() override; qreal zoomFactor() const; @@ -45,8 +44,8 @@ void zoomFactorChanged( qreal ); protected: - void paintEvent( QPaintEvent *event ); - void wheelEvent( QWheelEvent *event ); + void paintEvent( QPaintEvent *event ) override; + void wheelEvent( QWheelEvent *event ) override; private: const QPixmap m_pixmap; diff --git a/src/widgets/PixmapViewer.cpp b/src/widgets/PixmapViewer.cpp --- a/src/widgets/PixmapViewer.cpp +++ b/src/widgets/PixmapViewer.cpp @@ -65,7 +65,7 @@ return; m_zoomFactor = f; - emit( zoomFactorChanged( m_zoomFactor ) ); + Q_EMIT( zoomFactorChanged( m_zoomFactor ) ); w = m_pixmap.width() * m_zoomFactor; h = m_pixmap.height() * m_zoomFactor; diff --git a/src/widgets/PlayPauseButton.h b/src/widgets/PlayPauseButton.h --- a/src/widgets/PlayPauseButton.h +++ b/src/widgets/PlayPauseButton.h @@ -26,18 +26,18 @@ Q_OBJECT public: - PlayPauseButton( QWidget *parent = 0 ); + explicit PlayPauseButton( QWidget *parent = nullptr ); inline bool playing() const { return m_isPlaying; } void setPlaying( bool playing ); Q_SIGNALS: void toggled(bool playing); protected: - void enterEvent( QEvent * ); - void leaveEvent( QEvent * ); - void mousePressEvent( QMouseEvent * ); - void reloadContent( const QSize &sz ); + void enterEvent( QEvent * ) override; + void leaveEvent( QEvent * ) override; + void mousePressEvent( QMouseEvent * ) override; + void reloadContent( const QSize &sz ) override; private Q_SLOTS: void toggle(); diff --git a/src/widgets/PlayPauseButton.cpp b/src/widgets/PlayPauseButton.cpp --- a/src/widgets/PlayPauseButton.cpp +++ b/src/widgets/PlayPauseButton.cpp @@ -49,7 +49,7 @@ void PlayPauseButton::toggle() { - emit toggled( !m_isPlaying ); + Q_EMIT toggled( !m_isPlaying ); } void PlayPauseButton::reloadContent( const QSize &sz ) diff --git a/src/widgets/PrettyTreeDelegate.h b/src/widgets/PrettyTreeDelegate.h --- a/src/widgets/PrettyTreeDelegate.h +++ b/src/widgets/PrettyTreeDelegate.h @@ -42,11 +42,11 @@ Q_OBJECT public: - PrettyTreeDelegate( Amarok::PrettyTreeView *view ); - ~PrettyTreeDelegate(); + explicit PrettyTreeDelegate( Amarok::PrettyTreeView *view ); + ~PrettyTreeDelegate() override; - void paint( QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index ) const; - QSize sizeHint( const QStyleOptionViewItem &option, const QModelIndex &index ) const; + void paint( QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index ) const override; + QSize sizeHint( const QStyleOptionViewItem &option, const QModelIndex &index ) const override; /** Returns the rectangle where the action icon with the specific nr is located. */ QRect decoratorRect( const QRect &itemRect, int nr ) const; diff --git a/src/widgets/PrettyTreeDelegate.cpp b/src/widgets/PrettyTreeDelegate.cpp --- a/src/widgets/PrettyTreeDelegate.cpp +++ b/src/widgets/PrettyTreeDelegate.cpp @@ -246,7 +246,7 @@ PrettyTreeDelegate::sizeHint( const QStyleOptionViewItem &option, const QModelIndex &index ) const { - // note: the QStyledItemDelegage::sizeHint seems to be extremly slow. don't call it + // note: the QStyledItemDelegage::sizeHint seems to be extremely slow. don't call it updateFonts( option ); QStyle *style = m_view->style(); diff --git a/src/widgets/PrettyTreeRoles.h b/src/widgets/PrettyTreeRoles.h --- a/src/widgets/PrettyTreeRoles.h +++ b/src/widgets/PrettyTreeRoles.h @@ -41,7 +41,9 @@ DecoratorRole = Qt::UserRole + 58, /** True if the item has a cover that should be displayed */ - HasCoverRole = Qt::UserRole + 59 + HasCoverRole = Qt::UserRole + 59, + + YearRole = Qt::UserRole + 60 }; } diff --git a/src/widgets/PrettyTreeView.h b/src/widgets/PrettyTreeView.h --- a/src/widgets/PrettyTreeView.h +++ b/src/widgets/PrettyTreeView.h @@ -41,50 +41,50 @@ Q_OBJECT public: - PrettyTreeView( QWidget *parent = 0 ); - virtual ~PrettyTreeView(); + explicit PrettyTreeView( QWidget *parent = nullptr ); + ~PrettyTreeView() override; + /** + * Return pointer to decorator action which was most recently mouse-pressed + * or null it mouse button was released since then. Used by PrettyTreeDelegate. + */ + QAction *pressedDecoratorAction() const; public Q_SLOTS: /* There is a need to overload even this edit() variant, otherwise it hides - * QAbstactItemView's implementation. Note that it is NOT safe to do anything + * QAbstractItemView's implementation. Note that it is NOT safe to do anything * special in this method, as it is not virtual. * bool edit( const QModelIndex &index, EditTrigger trigger, QEvent *event ) * IS virtual. */ void edit( const QModelIndex &index ); - /** - * Return pointer to decorator action which was most recently mouse-pressed - * or null it mouse buttom was released since then. Used by PrettyTreeDelegate. - */ - QAction *pressedDecoratorAction() const; protected: - bool edit( const QModelIndex &index, EditTrigger trigger, QEvent *event ); - void drawRow( QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index ) const; + bool edit( const QModelIndex &index, EditTrigger trigger, QEvent *event ) override; + void drawRow( QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index ) const override; /** * Reimplemented to trigger item redraw in case mouse is over an item which * has decorator actions. */ - void mouseMoveEvent( QMouseEvent *event ); + void mouseMoveEvent( QMouseEvent *event ) override; /** * Reimplemented to handle expanding with single-click mouse setting event * when it is clicked outside the arrow and for consistency with * mouseReleaseEvent() in case of decorator actions. */ - void mousePressEvent( QMouseEvent *event ); + void mousePressEvent( QMouseEvent *event ) override; /** * Reimplemented to handle expanding with single-click mouse setting event * when it is clicked outside the arrow and to handle clicking on decorator * actions */ - void mouseReleaseEvent( QMouseEvent *event ); + void mouseReleaseEvent( QMouseEvent *event ) override; /** * Reimplemented to show proper tooltips for decorator actions. */ - bool viewportEvent( QEvent *event ); + bool viewportEvent( QEvent *event ) override; /** * Get dectorator action (little action icon as seen for example in collection diff --git a/src/widgets/PrettyTreeView.cpp b/src/widgets/PrettyTreeView.cpp --- a/src/widgets/PrettyTreeView.cpp +++ b/src/widgets/PrettyTreeView.cpp @@ -228,20 +228,20 @@ { const int actionsCount = index.data( PrettyTreeRoles::DecoratorRoleCount ).toInt(); if( actionsCount <= 0 ) - return 0; + return nullptr; PrettyTreeDelegate* ptd = qobject_cast( itemDelegate( index ) ); if( !ptd ) - return 0; + return nullptr; - QList actions = index.data( PrettyTreeRoles::DecoratorRole ).value >(); + const QList actions = index.data( PrettyTreeRoles::DecoratorRole ).value >(); QRect rect = visualRect( index ); for( int i = 0; i < actions.count(); i++ ) if( ptd->decoratorRect( rect, i ).contains( pos ) ) return actions.at( i ); - return 0; + return nullptr; } QAction * diff --git a/src/widgets/ProgressWidget.h b/src/widgets/ProgressWidget.h --- a/src/widgets/ProgressWidget.h +++ b/src/widgets/ProgressWidget.h @@ -19,7 +19,7 @@ #include "core/meta/forward_declarations.h" -#include +#include #include #include @@ -34,9 +34,9 @@ Q_OBJECT public: - ProgressWidget( QWidget* ); + explicit ProgressWidget( QWidget* ); - virtual QSize sizeHint() const; + QSize sizeHint() const override; void addBookmark( const QString &name, int milliSeconds , bool instantDisplayPopUp ); Amarok::TimeSlider* slider() const { return m_slider; } @@ -51,11 +51,11 @@ void trackPositionChanged( qint64 position ); protected: - virtual void mousePressEvent( QMouseEvent * ); + void mousePressEvent( QMouseEvent * ) override; private Q_SLOTS: void addBookmarkNoPopup( const QString &name, int milliSeconds ); - void redrawBookmarks(const QString *BookmarkName = 0); + void redrawBookmarks(const QString *BookmarkName = nullptr); private: void updateTimeLabelTooltips(); diff --git a/src/widgets/ProgressWidget.cpp b/src/widgets/ProgressWidget.cpp --- a/src/widgets/ProgressWidget.cpp +++ b/src/widgets/ProgressWidget.cpp @@ -203,7 +203,7 @@ QFontMetrics tFm( m_timeLabelRight->font() ); const int labelSize = tFm.width(QChar('0')) * timeLength; - //set the sizes of the labesl to the max needed by the length of the track + //set the sizes of the labels to the max needed by the length of the track //this way the progressbar will not change size during playback of a track m_timeLabelRight->setFixedWidth( labelSize ); m_timeLabelLeft->setFixedWidth( labelSize ); @@ -221,7 +221,7 @@ { m_slider->setSliderValue( position ); - // update the enabled state. Phonon determines isSeekable somtimes too late. + // update the enabled state. Phonon determines isSeekable sometimes too late. m_slider->setEnabled( (m_slider->maximum() > 0) && The::engineController()->isSeekable() ); if ( !m_slider->isEnabled() ) drawTimeDisplay( position ); diff --git a/src/widgets/SearchWidget.h b/src/widgets/SearchWidget.h --- a/src/widgets/SearchWidget.h +++ b/src/widgets/SearchWidget.h @@ -25,18 +25,18 @@ #include class QToolBar; -class QPushButton; // A Custom Widget that can be used globally to implement // searching a treeview. class AMAROK_EXPORT SearchWidget : public QWidget { Q_OBJECT public: /** Creates a search widget. - @param advanced If true generates a button that opens a edit filter dialog. + * @param parent The parent widget + * @param advanced If true generates a button that opens a edit filter dialog. */ - explicit SearchWidget( QWidget *parent = Q_NULLPTR, bool advanced = true ); + explicit SearchWidget( QWidget *parent = nullptr, bool advanced = true ); QString currentText() const { return m_sw->currentText(); } Amarok::ComboBox *comboBox() { return m_sw; } @@ -65,7 +65,7 @@ * Tells the widget that a search operation has started. As a consequence the * "search" icon changes to a progress animation. * - * Note: You can call this slot several times if you ahve several search operations + * Note: You can call this slot several times if you have several search operations * simultaneously. The widget has an internal counter to track them. */ void searchStarted(); diff --git a/src/widgets/SearchWidget.cpp b/src/widgets/SearchWidget.cpp --- a/src/widgets/SearchWidget.cpp +++ b/src/widgets/SearchWidget.cpp @@ -95,7 +95,7 @@ { m_filterTimer.stop(); addCompletion( m_sw->currentText() ); - emit filterChanged( m_sw->currentText() ); + Q_EMIT filterChanged( m_sw->currentText() ); } void @@ -243,7 +243,7 @@ } -// private slots: +// private Q_SLOTS: void SearchWidget::nextAnimationTick() diff --git a/src/widgets/SliderWidget.h b/src/widgets/SliderWidget.h --- a/src/widgets/SliderWidget.h +++ b/src/widgets/SliderWidget.h @@ -24,8 +24,6 @@ #include #include -class QPalette; -class QTimer; class BookmarkTriangle; @@ -36,24 +34,24 @@ Q_OBJECT public: - explicit Slider( Qt::Orientation, uint max = 0, QWidget* parent = 0 ); + explicit Slider( Qt::Orientation, uint max = 0, QWidget* parent = nullptr ); virtual void setValue( int ); Q_SIGNALS: - //we emit this when the user has specifically changed the slider + //we Q_EMIT this when the user has specifically changed the slider //so connect to it if valueChanged() is too generic //Qt also emits valueChanged( int ) void sliderReleased( int ); protected: - virtual void wheelEvent( QWheelEvent* ); - virtual void mouseMoveEvent( QMouseEvent* ); - virtual void mouseReleaseEvent( QMouseEvent* ); - virtual void mousePressEvent( QMouseEvent* ); + void wheelEvent( QWheelEvent* ) override; + void mouseMoveEvent( QMouseEvent* ) override; + void mouseReleaseEvent( QMouseEvent* ) override; + void mousePressEvent( QMouseEvent* ) override; virtual void slideEvent( QMouseEvent* ); QRect sliderHandleRect( const QRect &slider, qreal percent ) const; - virtual void resizeEvent( QResizeEvent * ) { m_needsResize = true; } + void resizeEvent( QResizeEvent * ) override { m_needsResize = true; } void paintCustomSlider( QPainter *p, bool paintMoodbar = false ); @@ -92,12 +90,12 @@ explicit VolumeSlider( uint max, QWidget *parent, bool customStyle = true ); // VolumePopupButton needs to access this - virtual void wheelEvent( QWheelEvent *e ); + void wheelEvent( QWheelEvent *e ) override; protected: - virtual void paintEvent( QPaintEvent* ); - virtual void mousePressEvent( QMouseEvent* ); - virtual void contextMenuEvent( QContextMenuEvent* ); + void paintEvent( QPaintEvent* ) override; + void mousePressEvent( QMouseEvent* ) override; + void contextMenuEvent( QContextMenuEvent* ) override; private: Q_DISABLE_COPY( VolumeSlider ) @@ -108,18 +106,18 @@ Q_OBJECT public: - TimeSlider( QWidget *parent ); + explicit TimeSlider( QWidget *parent ); void setSliderValue( int value ); void drawTriangle( const QString &name, int milliSeconds, bool showPopup = false); void clearTriangles(); protected: - virtual void paintEvent( QPaintEvent* ); - virtual void mousePressEvent( QMouseEvent* ); - virtual void resizeEvent( QResizeEvent * event ); - virtual void sliderChange( SliderChange change ); - virtual bool event( QEvent * event ); + void paintEvent( QPaintEvent* ) override; + void mousePressEvent( QMouseEvent* ) override; + void resizeEvent( QResizeEvent * event ) override; + void sliderChange( SliderChange change ) override; + bool event( QEvent * event ) override; private Q_SLOTS: void slotTriangleClicked( int ); diff --git a/src/widgets/SliderWidget.cpp b/src/widgets/SliderWidget.cpp --- a/src/widgets/SliderWidget.cpp +++ b/src/widgets/SliderWidget.cpp @@ -104,7 +104,7 @@ QSlider::setValue( nval ); - emit sliderReleased( value() ); + Q_EMIT sliderReleased( value() ); } void @@ -120,16 +120,16 @@ if ( !m_outside ) { QSlider::setValue( m_prevValue ); - //if mouse released outside of slider, emit sliderMoved to previous value - emit sliderMoved( m_prevValue ); + //if mouse released outside of slider, Q_EMIT sliderMoved to previous value + Q_EMIT sliderMoved( m_prevValue ); } m_outside = true; } else { m_outside = false; slideEvent( e ); - emit sliderMoved( value() ); + Q_EMIT sliderMoved( value() ); } } else @@ -181,7 +181,7 @@ Amarok::Slider::mouseReleaseEvent( QMouseEvent* ) { if( !m_outside && value() != m_prevValue ) - emit sliderReleased( value() ); + Q_EMIT sliderReleased( value() ); m_sliding = false; m_outside = false; @@ -261,7 +261,7 @@ if( n >= 0 ) { QSlider::setValue( n ); - emit sliderReleased( n ); + Q_EMIT sliderReleased( n ); } } } @@ -272,7 +272,7 @@ const uint step = e->delta() / Amarok::VOLUME_SENSITIVITY; QSlider::setValue( QSlider::value() + step ); - emit sliderReleased( value() ); + Q_EMIT sliderReleased( value() ); } void @@ -364,7 +364,7 @@ void Amarok::TimeSlider::slotTriangleClicked( int seconds ) { - emit sliderReleased( seconds ); + Q_EMIT sliderReleased( seconds ); } void Amarok::TimeSlider::slotTriangleFocused( int seconds ) diff --git a/src/widgets/StackedWidget.h b/src/widgets/StackedWidget.h --- a/src/widgets/StackedWidget.h +++ b/src/widgets/StackedWidget.h @@ -29,7 +29,7 @@ class StackedWidget : public QStackedWidget { public: - StackedWidget( QWidget * parent = 0 ) + explicit StackedWidget( QWidget * parent = nullptr ) : QStackedWidget( parent ) {} ~StackedWidget( ) {} diff --git a/src/widgets/StarManager.h b/src/widgets/StarManager.h --- a/src/widgets/StarManager.h +++ b/src/widgets/StarManager.h @@ -46,7 +46,7 @@ void ratingsColorsChanged(); private: - StarManager( QObject* parent ); + explicit StarManager( QObject* parent ); ~StarManager(); static StarManager* s_instance; diff --git a/src/widgets/StarManager.cpp b/src/widgets/StarManager.cpp --- a/src/widgets/StarManager.cpp +++ b/src/widgets/StarManager.cpp @@ -28,7 +28,7 @@ #include -StarManager* StarManager::s_instance = 0; +StarManager* StarManager::s_instance = nullptr; StarManager* StarManager::instance() { @@ -106,7 +106,7 @@ if( CollectionView::instance() && CollectionView::instance()->viewMode() == CollectionView::modeFlatView ) CollectionView::instance()->triggerUpdate(); */ - emit ratingsColorsChanged(); + Q_EMIT ratingsColorsChanged(); } QPixmap* diff --git a/src/widgets/TimeLabel.h b/src/widgets/TimeLabel.h --- a/src/widgets/TimeLabel.h +++ b/src/widgets/TimeLabel.h @@ -20,7 +20,6 @@ #include -class QMouseEvent; class TimeLabel : public QLabel { @@ -36,7 +35,7 @@ void setText( const QString &text ); protected: - virtual QSize sizeHint() const; + QSize sizeHint() const override; private: bool m_showTime; diff --git a/src/widgets/Token.h b/src/widgets/Token.h --- a/src/widgets/Token.h +++ b/src/widgets/Token.h @@ -35,8 +35,8 @@ public: virtual ~TokenFactory() {} - virtual Token* createToken( const QString &text, const QString &iconName, qint64 value, QWidget* parent = 0 ) const; - virtual Token* createTokenFromMime( const QMimeData* mimeData, QWidget* parent = 0 ) const; + virtual Token* createToken( const QString &text, const QString &iconName, qint64 value, QWidget* parent = nullptr ) const; + virtual Token* createTokenFromMime( const QMimeData* mimeData, QWidget* parent = nullptr ) const; }; /** A widget that is used in the FilenameLayoutWidget to display part of a filename @@ -50,7 +50,7 @@ public: - explicit Token( const QString &text, const QString &iconName, qint64 value, QWidget *parent = 0 ); + explicit Token( const QString &text, const QString &iconName, qint64 value, QWidget *parent = nullptr ); QIcon icon() const; QString iconName() const; @@ -61,7 +61,7 @@ void setTextColor( QColor textColor ); /** Return true if somebody has previously set the text color */ - bool hasCustomColor() const { return m_customColor; }; + bool hasCustomColor() const { return m_customColor; } /** Returns the mime data for this token. Caller has to free the QMimeData object. @@ -71,8 +71,8 @@ /** Returns the mime type for an amarok tag token */ static QString mimeType(); - QSize sizeHint() const; - QSize minimumSizeHint() const; + QSize sizeHint() const override; + QSize minimumSizeHint() const override; Q_SIGNALS: void changed(); @@ -82,19 +82,19 @@ protected: /** overloaded to update the cursor in case the token is set to inactive */ - void changeEvent( QEvent* event = 0 ); + void changeEvent( QEvent* event = nullptr ) override; - void focusInEvent( QFocusEvent* event ); + void focusInEvent( QFocusEvent* event ) override; void updateCursor(); /** Handles start of drag. */ - void mousePressEvent( QMouseEvent* event ); + void mousePressEvent( QMouseEvent* event ) override; /** Handles start of drag. */ - void mouseMoveEvent( QMouseEvent* event ); + void mouseMoveEvent( QMouseEvent* event ) override; - void paintEvent(QPaintEvent *pe); + void paintEvent(QPaintEvent *pe) override; void performDrag(); diff --git a/src/widgets/Token.cpp b/src/widgets/Token.cpp --- a/src/widgets/Token.cpp +++ b/src/widgets/Token.cpp @@ -187,7 +187,7 @@ Token::focusInEvent( QFocusEvent* event ) { QWidget::focusInEvent( event ); - emit gotFocus( this ); + Q_EMIT gotFocus( this ); } void diff --git a/src/widgets/TokenDropTarget.h b/src/widgets/TokenDropTarget.h --- a/src/widgets/TokenDropTarget.h +++ b/src/widgets/TokenDropTarget.h @@ -1,5 +1,5 @@ /**************************************************************************************** - * Copyright (c) 2009 Thomas Lbking * + * Copyright (c) 2009 Thomas Luebking * * Copyright (c) 2012 Ralf Engels * * * * This program is free software; you can redistribute it and/or modify it under * @@ -24,7 +24,6 @@ class QHBoxLayout; class QDropEvent; class Token; -class TokenDragger; class TokenFactory; /** A widget that accepts dragging Tokens into it. @@ -37,11 +36,11 @@ { Q_OBJECT public: - explicit TokenDropTarget( QWidget *parent = 0 ); - virtual ~TokenDropTarget(); + explicit TokenDropTarget( QWidget *parent = nullptr ); + ~TokenDropTarget() override; - QSize sizeHint() const; - QSize minimumSizeHint() const; + QSize sizeHint() const override; + QSize minimumSizeHint() const override; /** Removes all tokens from the drop target. */ void clear(); @@ -56,7 +55,7 @@ int row ( Token* ) const; /** Returns the number of rows that this layout has. */ - uint rows() const { return m_rows; }; + uint rows() const { return m_rows; } /** Returns the maximum allowed number of rows. A number of 0 means that the row count is not limited at all. @@ -93,14 +92,14 @@ void tokenSelected( Token* ); protected: - void dragEnterEvent( QDragEnterEvent *event ); - void dropEvent( QDropEvent *event ); + void dragEnterEvent( QDragEnterEvent *event ) override; + void dropEvent( QDropEvent *event ) override; /** Draws a "drop here" text if empty */ - void paintEvent(QPaintEvent *); + void paintEvent(QPaintEvent *) override; /** Return the enclosing box layout and the row and column position of the widget \p w. */ - QBoxLayout *rowBox( QWidget *w, QPoint *idx = 0 ) const; + QBoxLayout *rowBox( QWidget *w, QPoint *idx = nullptr ) const; /** Return the box layout at the position \p pt. */ QBoxLayout *rowBox( const QPoint &pt ) const; diff --git a/src/widgets/TokenDropTarget.cpp b/src/widgets/TokenDropTarget.cpp --- a/src/widgets/TokenDropTarget.cpp +++ b/src/widgets/TokenDropTarget.cpp @@ -1,5 +1,5 @@ /**************************************************************************************** - * Copyright (c) 2009 Thomas Lbking * + * Copyright (c) 2009 Thomas Luebking * * Copyright (c) 2012 Ralf Engels * * * * This program is free software; you can redistribute it and/or modify it under * @@ -207,7 +207,7 @@ connect( token, &Token::destroyed, this, &TokenDropTarget::changed ); connect( token, &Token::destroyed, this, &TokenDropTarget::deleteEmptyRows ); - emit changed(); + Q_EMIT changed(); } diff --git a/src/widgets/TokenPool.h b/src/widgets/TokenPool.h --- a/src/widgets/TokenPool.h +++ b/src/widgets/TokenPool.h @@ -29,27 +29,27 @@ Q_OBJECT public: - TokenPool( QWidget *parent = 0 ); + explicit TokenPool( QWidget *parent = nullptr ); /** Adds the \p token into the token pool. The TokenPool takes ownership of the token. Note: The color of the token representation is determined by the text color of the token at the time it is added. */ void addToken( Token * token ); - QSize sizeHint() const; + QSize sizeHint() const override; protected: - void mouseDoubleClickEvent( QMouseEvent *event ); + void mouseDoubleClickEvent( QMouseEvent *event ) override; /** Handles start of drag. */ - void mousePressEvent( QMouseEvent *event ); + void mousePressEvent( QMouseEvent *event ) override; /** Handles start of drag. */ - void mouseMoveEvent( QMouseEvent *event ); - void dragEnterEvent( QDragEnterEvent *event ); + void mouseMoveEvent( QMouseEvent *event ) override; + void dragEnterEvent( QDragEnterEvent *event ) override; // void dragMoveEvent( QDragMoveEvent *event ); - void dropEvent( QDropEvent *event ); + void dropEvent( QDropEvent *event ) override; Q_SIGNALS: /** Emitted if somebody double clicks a token. diff --git a/src/widgets/TokenPool.cpp b/src/widgets/TokenPool.cpp --- a/src/widgets/TokenPool.cpp +++ b/src/widgets/TokenPool.cpp @@ -1,7 +1,7 @@ /**************************************************************************************** * Copyright (c) 2008 Téo Mrnjavac * * Copyright (c) 2009 Seb Ruiz * - * Copyright (c) 2009 Thomas Lbking * + * Copyright (c) 2009 Thomas Luebking * * Copyright (c) 2009 Daniel Dewald * * * * This program is free software; you can redistribute it and/or modify it under * @@ -80,7 +80,7 @@ { QListWidgetItem *tokenItem = itemAt( event->pos() ); if( tokenItem ) - emit onDoubleClick( m_itemTokenMap.value( tokenItem ) ); + Q_EMIT onDoubleClick( m_itemTokenMap.value( tokenItem ) ); } //Executed on mouse press, handles start of drag. diff --git a/src/widgets/TokenWithLayout.h b/src/widgets/TokenWithLayout.h --- a/src/widgets/TokenWithLayout.h +++ b/src/widgets/TokenWithLayout.h @@ -27,21 +27,21 @@ { Q_OBJECT public: - Wrench( QWidget *parent ); + explicit Wrench( QWidget *parent ); protected: - void enterEvent(QEvent *); - void leaveEvent(QEvent *); - void mousePressEvent( QMouseEvent *e ); - void mouseReleaseEvent( QMouseEvent *e ); - void paintEvent( QPaintEvent *pe ); + void enterEvent(QEvent *) override; + void leaveEvent(QEvent *) override; + void mousePressEvent( QMouseEvent *e ) override; + void mouseReleaseEvent( QMouseEvent *e ) override; + void paintEvent( QPaintEvent *pe ) override; Q_SIGNALS: void clicked(); }; class TokenWithLayoutFactory : public TokenFactory { public: - virtual Token * createToken( const QString &text, const QString &iconName, qint64 value, QWidget *parent = 0 ) const; + Token * createToken( const QString &text, const QString &iconName, qint64 value, QWidget *parent = nullptr ) const override; }; /** @@ -53,8 +53,8 @@ { Q_OBJECT public: - TokenWithLayout( const QString &text, const QString &iconName, qint64 value, QWidget *parent = 0 ); - ~TokenWithLayout(); + TokenWithLayout( const QString &text, const QString &iconName, qint64 value, QWidget *parent = nullptr ); + ~TokenWithLayout() override; Qt::Alignment alignment(); bool bold() const; @@ -88,10 +88,10 @@ void setWidth( int width ); protected: - virtual void enterEvent(QEvent *); - virtual bool eventFilter( QObject*, QEvent* ); - virtual void leaveEvent(QEvent *); - virtual void timerEvent( QTimerEvent* ); + void enterEvent(QEvent *) override; + bool eventFilter( QObject*, QEvent* ) override; + void leaveEvent(QEvent *) override; + void timerEvent( QTimerEvent* ) override; private Q_SLOTS: void showConfig(); diff --git a/src/widgets/TokenWithLayout.cpp b/src/widgets/TokenWithLayout.cpp --- a/src/widgets/TokenWithLayout.cpp +++ b/src/widgets/TokenWithLayout.cpp @@ -34,7 +34,7 @@ Wrench::Wrench( QWidget *parent ) : QLabel( parent ) { setCursor( Qt::ArrowCursor ); - setPixmap( QIcon::fromTheme( "configure" ).pixmap( 64 ) ); + setPixmap( QIcon::fromTheme( QStringLiteral("configure") ).pixmap( 64 ) ); setScaledContents( true ); setMargin( 4 ); } @@ -55,14 +55,14 @@ { setMargin( 4 ); update(); - emit clicked(); + Q_EMIT clicked(); } void Wrench::mouseReleaseEvent( QMouseEvent * ) { setMargin( 1 ); update(); - emit clicked(); + Q_EMIT clicked(); } void Wrench::paintEvent( QPaintEvent *pe ) @@ -196,7 +196,7 @@ m_alignment = alignment; m_label->setAlignment( alignment ); - emit changed(); + Q_EMIT changed(); } bool TokenWithLayout::bold() const @@ -213,7 +213,7 @@ QFont font = m_label->font(); font.setBold( bold ); m_label->setFont( font ); - emit changed(); + Q_EMIT changed(); } void TokenWithLayout::setPrefix( const QString& string ) @@ -224,7 +224,7 @@ m_prefix.clear(); else m_prefix = string; - emit changed(); + Q_EMIT changed(); } void TokenWithLayout::setSuffix( const QString& string ) @@ -235,14 +235,14 @@ m_suffix.clear(); else m_suffix = string; - emit changed(); + Q_EMIT changed(); } void TokenWithLayout::setWidth( int size ) { m_width = qMax( qMin( 1.0, size/100.0 ), 0.0 ) ; - emit changed(); + Q_EMIT changed(); } qreal TokenWithLayout::width() const @@ -270,7 +270,7 @@ font.setItalic( italic ); m_label->setFont( font ); - emit changed(); + Q_EMIT changed(); } void TokenWithLayout::setUnderline( bool underline ) @@ -283,7 +283,7 @@ font.setUnderline( underline ); m_label->setFont( font ); - emit changed(); + Q_EMIT changed(); } diff --git a/src/widgets/TrackActionButton.h b/src/widgets/TrackActionButton.h --- a/src/widgets/TrackActionButton.h +++ b/src/widgets/TrackActionButton.h @@ -28,14 +28,14 @@ Q_OBJECT public: - explicit TrackActionButton( QWidget *parent = 0, const QAction *act = 0 ); + explicit TrackActionButton( QWidget *parent = nullptr, const QAction *act = nullptr ); void setAction( const QAction *act ); - QSize sizeHint() const; + QSize sizeHint() const override; protected: - bool eventFilter( QObject *o, QEvent *e ); - void enterEvent( QEvent * ); - void leaveEvent( QEvent * ); - void reloadContent( const QSize &sz ); + bool eventFilter( QObject *o, QEvent *e ) override; + void enterEvent( QEvent * ) override; + void leaveEvent( QEvent * ) override; + void reloadContent( const QSize &sz ) override; private Q_SLOTS: void updateAction(); void init(); diff --git a/src/widgets/TrackSelectWidget.h b/src/widgets/TrackSelectWidget.h --- a/src/widgets/TrackSelectWidget.h +++ b/src/widgets/TrackSelectWidget.h @@ -33,7 +33,7 @@ Q_OBJECT public: - TrackSelectWidget( QWidget* parent ); + explicit TrackSelectWidget( QWidget* parent ); ~TrackSelectWidget(); void setData( const Meta::DataPtr& ); diff --git a/src/widgets/TrackSelectWidget.cpp b/src/widgets/TrackSelectWidget.cpp --- a/src/widgets/TrackSelectWidget.cpp +++ b/src/widgets/TrackSelectWidget.cpp @@ -79,22 +79,22 @@ if ( data != Meta::DataPtr() ) { setData( data ); debug() << "new selection" << data->prettyName(); - emit selectionChanged( data ); + Q_EMIT selectionChanged( data ); } } } const QString TrackSelectWidget::dataToLabel( const Meta::DataPtr& data ) const { if ( data != Meta::DataPtr() ) { if ( Meta::TrackPtr track = Meta::TrackPtr::dynamicCast( data ) ) { - return QString( i18n("Track: %1", track->prettyName() ) ); + return i18n("Track: %1", track->prettyName() ); } else if ( Meta::AlbumPtr album = Meta::AlbumPtr::dynamicCast( data ) ) { - return QString( i18n("Album: %1", album->prettyName() ) ); + return i18n("Album: %1", album->prettyName() ); } else if ( Meta::ArtistPtr artist = Meta::ArtistPtr::dynamicCast( data ) ) { - return QString( i18n("Artist: %1", artist->prettyName() ) ); + return i18n("Artist: %1", artist->prettyName() ); } // TODO: can things other than tracks, artists, and albums end up here? } - return QString( i18n("empty") ); + return i18n("empty"); } diff --git a/src/widgets/VolumeDial.h b/src/widgets/VolumeDial.h --- a/src/widgets/VolumeDial.h +++ b/src/widgets/VolumeDial.h @@ -25,14 +25,14 @@ Q_OBJECT public: - VolumeDial( QWidget *parent = 0 ); + explicit VolumeDial( QWidget *parent = nullptr ); /** Add a list of widgets that should not hide the tooltip on wheelevents, but instead cause wheelevents on the dial You do NOT have to remove them on deconstruction. */ - void addWheelProxies( QList proxies ); - QSize sizeHint() const; + void addWheelProxies( const QList &proxies ); + QSize sizeHint() const override; public Q_SLOTS: /** @@ -46,18 +46,18 @@ void muteToggled( bool mute ); protected: - void enterEvent( QEvent * ); - bool eventFilter( QObject *o, QEvent *e ); - void leaveEvent( QEvent * ); - void paintEvent( QPaintEvent * ); - void mouseMoveEvent( QMouseEvent * ); - void mousePressEvent( QMouseEvent * ); - void mouseReleaseEvent( QMouseEvent * ); - void resizeEvent(QResizeEvent *); - void sliderChange( SliderChange change ); - void timerEvent ( QTimerEvent * ); + void enterEvent( QEvent * ) override; + bool eventFilter( QObject *o, QEvent *e ) override; + void leaveEvent( QEvent * ) override; + void paintEvent( QPaintEvent * ) override; + void mouseMoveEvent( QMouseEvent * ) override; + void mousePressEvent( QMouseEvent * ) override; + void mouseReleaseEvent( QMouseEvent * ) override; + void resizeEvent(QResizeEvent *) override; + void sliderChange( SliderChange change ) override; + void timerEvent ( QTimerEvent * ) override; friend class MainToolbar; - void wheelEvent( QWheelEvent * ); + void wheelEvent( QWheelEvent * ) override; private: void startFade(); diff --git a/src/widgets/VolumeDial.cpp b/src/widgets/VolumeDial.cpp --- a/src/widgets/VolumeDial.cpp +++ b/src/widgets/VolumeDial.cpp @@ -44,7 +44,7 @@ connect( The::paletteHandler(), &PaletteHandler::newPalette, this, &VolumeDial::paletteChanged ); } -void VolumeDial::addWheelProxies( QList proxies ) +void VolumeDial::addWheelProxies(const QList &proxies ) { foreach ( QWidget *proxy, proxies ) { @@ -157,7 +157,7 @@ { m_isClick = !onRing( rect(), me->pos() ); if ( m_isClick ) - emit muteToggled( !m_muted ); + Q_EMIT muteToggled( !m_muted ); } m_isClick = false; @@ -323,8 +323,8 @@ d = -5; m_formerValue += d; blockSignals( false ); - emit sliderMoved( m_formerValue ); - emit valueChanged( m_formerValue ); + Q_EMIT sliderMoved( m_formerValue ); + Q_EMIT valueChanged( m_formerValue ); blockSignals( true ); } if ( d ) diff --git a/src/widgets/kdatecombo.h b/src/widgets/kdatecombo.h --- a/src/widgets/kdatecombo.h +++ b/src/widgets/kdatecombo.h @@ -32,9 +32,9 @@ Q_OBJECT public: - KDateCombo(QWidget *parent=0); - explicit KDateCombo(const QDate & date, QWidget *parent=0); - ~KDateCombo(); + explicit KDateCombo(QWidget *parent=nullptr); + explicit KDateCombo(const QDate & date, QWidget *parent=nullptr); + ~KDateCombo() override; QDate & getDate(QDate *currentDate); bool setDate(const QDate & newDate); @@ -49,8 +49,8 @@ QDate & string2Date(const QString &, QDate * ); protected: - bool eventFilter (QObject*, QEvent*); - virtual void mousePressEvent (QMouseEvent * e); + bool eventFilter (QObject*, QEvent*) override; + void mousePressEvent (QMouseEvent * e) override; protected Q_SLOTS: void dateEnteredEvent(const QDate &d); diff --git a/supplementary_scripts/amarok_live/CMakeLists.txt b/supplementary_scripts/amarok_live/CMakeLists.txt --- a/supplementary_scripts/amarok_live/CMakeLists.txt +++ b/supplementary_scripts/amarok_live/CMakeLists.txt @@ -1,2 +1,2 @@ -install( PROGRAMS amarok_live.py README amarok.live.remaster.part1.sh amarok.live.remaster.part2.sh DESTINATION ${DATA_INSTALL_DIR}/amarok/scripts/amarok_live) +install( PROGRAMS amarok_live.py README amarok.live.remaster.part1.sh amarok.live.remaster.part2.sh DESTINATION ${KDE_INSTALL_DATADIR}/amarok/scripts/amarok_live) diff --git a/supplementary_scripts/licenseChecker/log.h b/supplementary_scripts/licenseChecker/log.h --- a/supplementary_scripts/licenseChecker/log.h +++ b/supplementary_scripts/licenseChecker/log.h @@ -38,12 +38,12 @@ HTML }; - LogEntry( QString filename, QString message, Type type ); + LogEntry( const QString &filename, const QString &message, Type type ); ~LogEntry(); - QString getFilename() { return m_filename; }; - QString getMessage() { return m_message; }; - Type getType() { return m_type; }; + QString getFilename() { return m_filename; } + QString getMessage() { return m_message; } + Type getType() { return m_type; } private: QString m_filename; @@ -59,13 +59,13 @@ class CopyHolder { public: - CopyHolder( QString a, QString b ) + CopyHolder( const QString &a, const QString &b ) { name = a; email = b; - }; + } - void addFile( QString a ) + void addFile( const QString &a ) { files.append( a ); files.sort(); @@ -76,14 +76,14 @@ QStringList files; }; - Log() {}; - ~Log() {}; + Log() {} + ~Log() {} - void printFullReport( LogEntry::PrintStyle style, QString filename ) { print( style, true, true, true, true, filename ); }; - void printErrorReport( LogEntry::PrintStyle style, bool warnings, QString filename ) { print( style, true, warnings, true, false, filename ); }; - void writeShellScript( QString filename ); - void addCopyHolder( QString a, QString b, QString filename ); - void addProblemFile( QString a ) { problemFiles.append( a ); }; + void printFullReport( LogEntry::PrintStyle style, const QString &filename ) { print( style, true, true, true, true, filename ); } + void printErrorReport( LogEntry::PrintStyle style, bool warnings, const QString &filename ) { print( style, true, warnings, true, false, filename ); } + void writeShellScript( const QString & filename ); + void addCopyHolder( const QString &a, const QString & b, const QString & filename ); + void addProblemFile( const QString &a ) { problemFiles.append( a ); } private: void print( LogEntry::PrintStyle style, bool errors, bool warnings, bool information, bool success, QString filename ); diff --git a/supplementary_scripts/neon/tools/desktopfiles/amarok-nightly-kcm-phonon.desktop b/supplementary_scripts/neon/tools/desktopfiles/amarok-nightly-kcm-phonon.desktop --- a/supplementary_scripts/neon/tools/desktopfiles/amarok-nightly-kcm-phonon.desktop +++ b/supplementary_scripts/neon/tools/desktopfiles/amarok-nightly-kcm-phonon.desktop @@ -51,7 +51,6 @@ Name[uk]=Налаштування звуку для нічної версії Amarok Name[wa]=Apontiaedje do son d' Amarok al nute Name[x-test]=xxAmarok Nightly Audio Configurationxx -Name[zh_CN]=Amarok Nightly 音频配置 Name[zh_TW]=Amarok Nightly 音效設定 Exec=amarok-nightly-phonon TryExec=amarok-nightly-phonon diff --git a/supplementary_scripts/neon/tools/desktopfiles/amarok-nightly.desktop b/supplementary_scripts/neon/tools/desktopfiles/amarok-nightly.desktop --- a/supplementary_scripts/neon/tools/desktopfiles/amarok-nightly.desktop +++ b/supplementary_scripts/neon/tools/desktopfiles/amarok-nightly.desktop @@ -52,7 +52,6 @@ Name[uk]=Нічна версія Amarok Name[wa]=Amarok al nute Name[x-test]=xxAmarok Nightlyxx -Name[zh_CN]=Amarok Nightly Name[zh_TW]=Amarok Nightly Exec=amarok-nightly %U TryExec=amarok-nightly diff --git a/supplementary_scripts/neon/tools/kde/xsessions/kde4-neon.desktop b/supplementary_scripts/neon/tools/kde/xsessions/kde4-neon.desktop --- a/supplementary_scripts/neon/tools/kde/xsessions/kde4-neon.desktop +++ b/supplementary_scripts/neon/tools/kde/xsessions/kde4-neon.desktop @@ -1,5 +1,4 @@ [Desktop Entry] -Encoding=UTF-8 Type=XSession Exec=/usr/bin/startneonkde TryExec=/usr/bin/startneonkde @@ -53,7 +52,6 @@ Name[uk]=Нічний KDE (Неон) Name[wa]=KDE al nute (Neon) Name[x-test]=xxKDE Nightly (Neon)xx -Name[zh_CN]=KDE Nightly (Neon) Name[zh_TW]=KDE Nightly (霓虹) Comment=The K Desktop Environment. A powerful Open Source graphical desktop environment Comment[bg]=KDE - мощна графична среда с отворен код @@ -104,5 +102,4 @@ Comment[uk]=Стільничне середовище KDE. Потужне графічне середовище з відкритими кодами Comment[wa]=L' evironmint d' sicribanne K. On pouxhant evironmint d' sicribanne grafike et libe. Comment[x-test]=xxThe K Desktop Environment. A powerful Open Source graphical desktop environmentxx -Comment[zh_CN]=K 桌面环境。强大的开源图形桌面环境 Comment[zh_TW]=KDE,一個強大的開放源碼圖形化桌面環境 diff --git a/supplementary_scripts/performance/plot-timeline.py b/supplementary_scripts/performance/plot-timeline.py --- a/supplementary_scripts/performance/plot-timeline.py +++ b/supplementary_scripts/performance/plot-timeline.py @@ -15,7 +15,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Cambridge, MA 02110-1301, USA. # # Authors: Federico Mena-Quintero # Johan Dahlin diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,8 +1,5 @@ set( EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR} ) -find_package(Googlemock REQUIRED) -set_package_properties( GOOGLEMOCK PROPERTIES DESCRIPTION "Used in Amarok's tests." URL "http://code.google.com/p/googlemock/" TYPE REQUIRED ) - set( AMAROK_SOURCE_TREE ${CMAKE_SOURCE_DIR}/src ) set( AMAROK_TEST_TREE ${CMAKE_SOURCE_DIR}/tests ) set( AMAROK_UTILITY_TREE ${CMAKE_SOURCE_DIR}/utilities ) @@ -111,19 +108,6 @@ target_link_libraries(testqstringx Qt5::Test) -#------------------------ Test SmartPointerList ----------------------------- - -set( testsmartpointerlist_SRCS - TestSmartPointerList.cpp - ${AMAROK_SOURCE_TREE}/core/support/SmartPointerList.cpp - ) - -add_executable( testsmartpointerlist ${testsmartpointerlist_SRCS} ) -add_test(NAME testsmartpointerlist COMMAND $) -ecm_mark_as_test(testsmartpointerlist) - -target_link_libraries(testsmartpointerlist Qt5::Test) - #------------------------ Test TagGuesser ----------------------------- set( testtagguesser_SRCS diff --git a/tests/TestAmarok.cpp b/tests/TestAmarok.cpp --- a/tests/TestAmarok.cpp +++ b/tests/TestAmarok.cpp @@ -242,17 +242,48 @@ QCOMPARE( Amarok::vfatPath( "test .ext " ), QString( "test _.ext _" ) ); QCOMPARE( Amarok::vfatPath( " test .ext " ), QString( " test _.ext _" ) ); // yes, really! -#ifdef Q_WS_WIN // interpret / as part of the name, not directory separator - QCOMPARE( Amarok::vfatPath( "\\some\\folder \\" ), QString( "\\some\\folder _\\" ) ); - QCOMPARE( Amarok::vfatPath( "\\some \\folder \\" ), QString( "\\some _\\folder _\\" ) ); - QCOMPARE( Amarok::vfatPath( "\\...some \\ev il \\folders...\\" ), QString( "\\...some _\\ev il _\\folders...\\" ) ); - QCOMPARE( Amarok::vfatPath( "\\some\\fol/der \\" ), QString( "\\some\\fol_der _\\" ) ); -#else // interpret \ as part of the name, not directory separator - QCOMPARE( Amarok::vfatPath( "/some/folder /" ), QString( "/some/folder _/" ) ); - QCOMPARE( Amarok::vfatPath( "/some /folder /" ), QString( "/some _/folder _/" ) ); - QCOMPARE( Amarok::vfatPath( "/...some /ev il /folders.../" ), QString( "/...some _/ev il _/folders.../" ) ); - QCOMPARE( Amarok::vfatPath( "/some/fol\\der /" ), QString( "/some/fol_der _/" ) ); -#endif + /* trailing dot in directory and file names are unsupported are being ignored (!) */ + QCOMPARE( Amarok::vfatPath( "test..." ), QString( "test.._" ) ); + QCOMPARE( Amarok::vfatPath( "...test..." ), QString( "...test.._" ) ); + QCOMPARE( Amarok::vfatPath( "test.ext..." ), QString( "test.ext.._" ) ); + QCOMPARE( Amarok::vfatPath( "test....ext..." ), QString( "test....ext.._" ) ); + QCOMPARE( Amarok::vfatPath( "...test....ext..." ), QString( "...test....ext.._" ) ); + + /* more tests of trailing spaces and dot in directory names for Windows */ + QCOMPARE( Amarok::vfatPath( "\\some\\folder \\", Amarok::WindowsBehaviour ), QString( "\\some\\folder _\\" ) ); + QCOMPARE( Amarok::vfatPath( "\\some \\folder \\", Amarok::WindowsBehaviour ), QString( "\\some _\\folder _\\" ) ); + QCOMPARE( Amarok::vfatPath( "\\...some \\ev il \\folders...\\", Amarok::WindowsBehaviour ), QString( "\\...some _\\ev il _\\folders.._\\" ) ); + QCOMPARE( Amarok::vfatPath( "\\some\\fol/der \\", Amarok::WindowsBehaviour ), QString( "\\some\\fol_der _\\" ) ); + QCOMPARE( Amarok::vfatPath( "\\some...\\folder...\\", Amarok::WindowsBehaviour ), QString( "\\some.._\\folder.._\\" ) ); + QCOMPARE( Amarok::vfatPath( "\\some\\fol/der...\\", Amarok::WindowsBehaviour ), QString( "\\some\\fol_der.._\\" ) ); + QCOMPARE( Amarok::vfatPath( "\\so..me.\\folder .\\", Amarok::WindowsBehaviour ), QString( "\\so..me_\\folder _\\" ) ); + QCOMPARE( Amarok::vfatPath( ".\\any", Amarok::WindowsBehaviour ), QString( ".\\any" ) ); + QCOMPARE( Amarok::vfatPath( "..\\any", Amarok::WindowsBehaviour ), QString( "..\\any" ) ); + QCOMPARE( Amarok::vfatPath( "...\\any", Amarok::WindowsBehaviour ), QString( ".._\\any" ) ); + QCOMPARE( Amarok::vfatPath( "a..\\any", Amarok::WindowsBehaviour ), QString( "a._\\any" ) ); + QCOMPARE( Amarok::vfatPath( "any\\.\\any.", Amarok::WindowsBehaviour ), QString( "any\\.\\any_" ) ); + QCOMPARE( Amarok::vfatPath( "any\\..\\any ", Amarok::WindowsBehaviour ), QString( "any\\..\\any_" ) ); + QCOMPARE( Amarok::vfatPath( "any.\\...\\any", Amarok::WindowsBehaviour ), QString( "any_\\.._\\any" ) ); + QCOMPARE( Amarok::vfatPath( "any \\a..\\any", Amarok::WindowsBehaviour ), QString( "any_\\a._\\any" ) ); + QCOMPARE( Amarok::vfatPath( "Music\\R.E.M.\\Automatic for the people", Amarok::WindowsBehaviour ), QString( "Music\\R.E.M_\\Automatic for the people" ) ); + + /* more tests of trailing spaces and dot in directory names for Unix */ + QCOMPARE( Amarok::vfatPath( "/some/folder /", Amarok::UnixBehaviour ), QString( "/some/folder _/" ) ); + QCOMPARE( Amarok::vfatPath( "/some /folder /", Amarok::UnixBehaviour ), QString( "/some _/folder _/" ) ); + QCOMPARE( Amarok::vfatPath( "/...some /ev il /folders.../", Amarok::UnixBehaviour ), QString( "/...some _/ev il _/folders.._/" ) ); + QCOMPARE( Amarok::vfatPath( "/some/fol\\der /", Amarok::UnixBehaviour ), QString( "/some/fol_der _/" ) ); + QCOMPARE( Amarok::vfatPath( "/some.../folder.../", Amarok::UnixBehaviour ), QString( "/some.._/folder.._/" ) ); + QCOMPARE( Amarok::vfatPath( "/some/fol\\der.../", Amarok::UnixBehaviour ), QString( "/some/fol_der.._/" ) ); + QCOMPARE( Amarok::vfatPath( "/so..me./folder ./", Amarok::UnixBehaviour ), QString( "/so..me_/folder _/" ) ); + QCOMPARE( Amarok::vfatPath( "./any", Amarok::UnixBehaviour ), QString( "./any" ) ); + QCOMPARE( Amarok::vfatPath( "../any", Amarok::UnixBehaviour ), QString( "../any" ) ); + QCOMPARE( Amarok::vfatPath( ".../any", Amarok::UnixBehaviour ), QString( ".._/any" ) ); + QCOMPARE( Amarok::vfatPath( "a../any", Amarok::UnixBehaviour ), QString( "a._/any" ) ); + QCOMPARE( Amarok::vfatPath( "any/./any.", Amarok::UnixBehaviour ), QString( "any/./any_" ) ); + QCOMPARE( Amarok::vfatPath( "any/../any ", Amarok::UnixBehaviour ), QString( "any/../any_" ) ); + QCOMPARE( Amarok::vfatPath( "any./.../any", Amarok::UnixBehaviour ), QString( "any_/.._/any" ) ); + QCOMPARE( Amarok::vfatPath( "any /a../any", Amarok::UnixBehaviour ), QString( "any_/a._/any" ) ); + QCOMPARE( Amarok::vfatPath( "Music/R.E.M./Automatic for the people", Amarok::UnixBehaviour ), QString( "Music/R.E.M_/Automatic for the people" ) ); /* Stepping deeper into M$ hell: reserved device names * See http://msdn.microsoft.com/en-us/library/aa365247(VS.85).aspx */ diff --git a/tests/TestQStringx.cpp b/tests/TestQStringx.cpp --- a/tests/TestQStringx.cpp +++ b/tests/TestQStringx.cpp @@ -38,59 +38,59 @@ { QStringList testArgs; - m_testString = ""; + m_testString = Amarok::QStringx(""); QCOMPARE( m_testString.args( testArgs ) , QString( "" ) ); - m_testString = "test"; + m_testString = Amarok::QStringx("test"); QCOMPARE( m_testString.args( testArgs ), QString( "test" ) ); - m_testString = ""; + m_testString = Amarok::QStringx(""); testArgs.append( "test" ); QCOMPARE( m_testString.args( testArgs ), QString( "" ) ); - m_testString = "test%12abc"; + m_testString = Amarok::QStringx("test%12abc"); QCOMPARE( m_testString.args( testArgs ) , QString( "testtestabc" ) ); - m_testString = "%12test abc"; + m_testString = Amarok::QStringx("%12test abc"); QCOMPARE( m_testString.args( testArgs ) , QString( "testtest abc" ) ); - m_testString = "te%st%12abc"; + m_testString = Amarok::QStringx("te%st%12abc"); QCOMPARE( m_testString.args( testArgs ) , QString( "te%sttestabc" ) ); testArgs.clear(); testArgs.append( "test" ); testArgs.append( "abc" ); - m_testString = "test%12abc%2xyz"; + m_testString = Amarok::QStringx("test%12abc%2xyz"); QCOMPARE( m_testString.args( testArgs ) , QString( "testtestabcabcxyz" ) ); - m_testString = "%12test%23abc"; + m_testString = Amarok::QStringx("%12test%23abc"); QCOMPARE( m_testString.args( testArgs ) , QString( "testtestabcabc" ) ); } void TestQStringx::testNamedArgs() { QMap testArgs; - m_testString = ""; + m_testString = Amarok::QStringx(""); QCOMPARE( m_testString.namedArgs( testArgs ) , QString( "" ) ); - m_testString = "test"; + m_testString = Amarok::QStringx("test"); QCOMPARE( m_testString.namedArgs( testArgs ) , QString( "test" ) ); testArgs[ "artist" ] = "Pornophonique"; - m_testString = "test"; + m_testString = Amarok::QStringx("test"); QCOMPARE( m_testString.namedArgs( testArgs ) , QString( "test" ) ); - m_testString = "artist: %artist%"; + m_testString = Amarok::QStringx("artist: %artist%"); QCOMPARE( m_testString.namedArgs( testArgs ) , QString( "artist: Pornophonique" ) ); - m_testString = "artist: %artist% - %album%"; + m_testString = Amarok::QStringx("artist: %artist% - %album%"); QCOMPARE( m_testString.namedArgs( testArgs ) , QString( "artist: Pornophonique - " ) ); testArgs[ "album" ] = "8-Bit Lagerfeuer"; QCOMPARE( m_testString.namedArgs( testArgs ) , QString( "artist: Pornophonique - 8-Bit Lagerfeuer" ) ); - m_testString = "%artist%: %artist% - %album%"; + m_testString = Amarok::QStringx("%artist%: %artist% - %album%"); QCOMPARE( m_testString.namedArgs( testArgs ) , QString( "Pornophonique: Pornophonique - 8-Bit Lagerfeuer" ) ); testArgs[ "year" ] = "2007"; @@ -101,72 +101,72 @@ { QMap testArgs; - m_testString = ""; + m_testString = Amarok::QStringx(""); QCOMPARE( m_testString.namedOptArgs( testArgs ) , QString( "" ) ); - m_testString = "test"; + m_testString = Amarok::QStringx("test"); QCOMPARE( m_testString.namedOptArgs( testArgs ) , QString( "test" ) ); - m_testString = "%test%"; + m_testString = Amarok::QStringx("%test%"); QCOMPARE( m_testString.namedOptArgs( testArgs ) , QString( "" ) ); - m_testString = "{ %test% }"; + m_testString = Amarok::QStringx("{ %test% }"); QCOMPARE( m_testString.namedOptArgs( testArgs ) , QString( "" ) ); - m_testString = "test{%test%}"; + m_testString = Amarok::QStringx("test{%test%}"); QCOMPARE( m_testString.namedOptArgs( testArgs ) , QString( "test" ) ); - m_testString = "{test{%test%}}"; + m_testString = Amarok::QStringx("{test{%test%}}"); QCOMPARE( m_testString.namedOptArgs( testArgs ) , QString( "test" ) ); - m_testString = "%test%{%test%}"; + m_testString = Amarok::QStringx("%test%{%test%}"); QCOMPARE( m_testString.namedOptArgs( testArgs ) , QString( "" ) ); - m_testString = "test%test% "; + m_testString = Amarok::QStringx("test%test% "); QCOMPARE( m_testString.namedOptArgs( testArgs ) , QString( "test " ) ); testArgs[ "artist" ] = "All:My:Faults"; - m_testString = "%artist%"; + m_testString = Amarok::QStringx("%artist%"); QCOMPARE( m_testString.namedOptArgs( testArgs ) , QString( "All:My:Faults" ) ); - m_testString = "{%test% }{%artist%}"; + m_testString = Amarok::QStringx("{%test% }{%artist%}"); QCOMPARE( m_testString.namedOptArgs( testArgs ) , QString( "All:My:Faults" ) ); - m_testString = "{%test% {%artist%}}"; + m_testString = Amarok::QStringx("{%test% {%artist%}}"); QCOMPARE( m_testString.namedOptArgs( testArgs ) , QString( "" ) ); - m_testString = "{%artist% {%test%}}"; + m_testString = Amarok::QStringx("{%artist% {%test%}}"); QCOMPARE( m_testString.namedOptArgs( testArgs ) , QString( "All:My:Faults " ) ); testArgs[ "track" ] = "Some track"; - m_testString = "{%test% {%artist%}}%track%"; + m_testString = Amarok::QStringx("{%test% {%artist%}}%track%"); QCOMPARE( m_testString.namedOptArgs( testArgs ) , QString( "Some track" ) ); - m_testString = "{%artist% {%track%}} %test%"; + m_testString = Amarok::QStringx("{%artist% {%track%}} %test%"); QCOMPARE( m_testString.namedOptArgs( testArgs ) , QString( "All:My:Faults Some track " ) ); testArgs[ "test" ] = ""; - m_testString = "{%test%}"; + m_testString = Amarok::QStringx("{%test%}"); QCOMPARE( m_testString.namedOptArgs( testArgs ) , QString( "" ) ); - m_testString = "before{%test%}"; + m_testString = Amarok::QStringx("before{%test%}"); QCOMPARE( m_testString.namedOptArgs( testArgs ) , QString( "before" ) ); - m_testString = "{%test%}after"; + m_testString = Amarok::QStringx("{%test%}after"); QCOMPARE( m_testString.namedOptArgs( testArgs ) , QString( "after" ) ); - m_testString = "before{%test%}after"; + m_testString = Amarok::QStringx("before{%test%}after"); QCOMPARE( m_testString.namedOptArgs( testArgs ) , QString( "beforeafter" ) ); - m_testString = "{%test% }{%artist%}"; + m_testString = Amarok::QStringx("{%test% }{%artist%}"); QCOMPARE( m_testString.namedOptArgs( testArgs ) , QString( "All:My:Faults" ) ); - m_testString = "{%test% {%artist%}}"; + m_testString = Amarok::QStringx("{%test% {%artist%}}"); QCOMPARE( m_testString.namedOptArgs( testArgs ) , QString( "" ) ); - m_testString = "{%artist% {%test%}}"; + m_testString = Amarok::QStringx("{%artist% {%test%}}"); QCOMPARE( m_testString.namedOptArgs( testArgs ) , QString( "All:My:Faults " ) ); - m_testString = "[%test2%:test {%artist%}%test%{ [%test%]}]"; + m_testString = Amarok::QStringx("[%test2%:test {%artist%}%test%{ [%test%]}]"); QCOMPARE( m_testString.namedOptArgs( testArgs ), QString( "test All:My:Faults Unknown test" ) ); } diff --git a/tests/TestSmartPointerList.h b/tests/TestSmartPointerList.h deleted file mode 100644 --- a/tests/TestSmartPointerList.h +++ /dev/null @@ -1,45 +0,0 @@ -/*************************************************************************** - * Copyright (c) 2009 Max Howell * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - ***************************************************************************/ - -#ifndef TESTSMARTPOINTERLIST_H -#define TESTSMARTPOINTERLIST_H - -#include -#include - -class TestSmartPointerList : public QObject -{ -Q_OBJECT - -public: - TestSmartPointerList(); - -private Q_SLOTS: - void testCount(); - void testCopy(); - void testCopyAndThenDelete(); - void testRemove(); - void testRemoveAt(); - void testMultipleOrgasms(); - void testForeach(); - void testOperatorPlus(); - void testOperatorPlusEquals(); -}; - -#endif // TESTSMARTPOINTERLIST_H diff --git a/tests/TestSmartPointerList.cpp b/tests/TestSmartPointerList.cpp deleted file mode 100644 --- a/tests/TestSmartPointerList.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/*************************************************************************** - * Copyright (c) 2009 Max Howell * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - ***************************************************************************/ - -#include "TestSmartPointerList.h" - -#include "core/support/SmartPointerList.h" - -#include -#include -#include - -QTEST_GUILESS_MAIN( TestSmartPointerList ) - -// use a macro, as we don't want to test copy ctor early -#define THREE_TIMERS( x ) SmartPointerList x; x << new QTimer << new QTimer << new QTimer - -TestSmartPointerList::TestSmartPointerList() -{ -} - -void TestSmartPointerList::testCount() -{ - THREE_TIMERS( objects ); - QCOMPARE( objects.count(), 3 ); -} - -void TestSmartPointerList::testCopy() -{ - THREE_TIMERS( objects1 ); - SmartPointerList objects2 = objects1; - - for (int x = 0; x < 3; ++x) - QVERIFY( objects1[x] == objects2[x] ); - - QCOMPARE( objects1.count(), 3 ); - QCOMPARE( objects2.count(), 3 ); - delete objects1.last(); - QCOMPARE( objects1.count(), 2 ); - QCOMPARE( objects2.count(), 2 ); -} - -void TestSmartPointerList::testCopyAndThenDelete() -{ - THREE_TIMERS( os1 ); - SmartPointerList* os2 = new SmartPointerList( os1 ); - SmartPointerList os3( *os2 ); - - delete os2; - - QCOMPARE( os1.count(), 3 ); - QCOMPARE( os3.count(), 3 ); - - delete os1[1]; - - QCOMPARE( os1.count(), 2 ); - QCOMPARE( os3.count(), 2 ); -} - -void TestSmartPointerList::testRemove() -{ - THREE_TIMERS( objects ); - delete objects.last(); - QCOMPARE( objects.count(), 2 ); -} - -void TestSmartPointerList::testRemoveAt() -{ - THREE_TIMERS( os ); - QTimer* t = os[1]; - os.removeAt( 1 ); - os << t; - QCOMPARE( os.count(), 3 ); - delete t; - QCOMPARE( os.count(), 2 ); -} - -void TestSmartPointerList::testMultipleOrgasms() -{ - THREE_TIMERS( os ); - for (int x = 0; x < 10; ++x) - os << os.last(); - QCOMPARE( os.count(), 13 ); - delete os.last(); - QCOMPARE( os.count(), 2 ); -} - -void TestSmartPointerList::testForeach() -{ - THREE_TIMERS( objects ); - int x = 0; - foreach (QTimer* o, objects) { - (void) o; - x++; - } - QCOMPARE( x, 3 ); -} - -void TestSmartPointerList::testOperatorPlus() -{ - THREE_TIMERS( os1 ); - SmartPointerList os2 = os1; - - QCOMPARE( (os1 + os2).count(), 6 ); - delete os1.last(); - QCOMPARE( (os1 + os2).count(), 4 ); -} - -void TestSmartPointerList::testOperatorPlusEquals() -{ - THREE_TIMERS( os ); - os += os; - os += os; - QCOMPARE( os.count(), 12 ); - QTimer* t = os.takeLast(); - QCOMPARE( os.count(), 11 ); - delete t; - QCOMPARE( os.count(), 8 ); -} - diff --git a/tests/context/engines/TestDataEngine.h b/tests/context/engines/TestDataEngine.h --- a/tests/context/engines/TestDataEngine.h +++ b/tests/context/engines/TestDataEngine.h @@ -23,8 +23,10 @@ class TestDataEngine : public QObject { + Q_OBJECT + public: - TestDataEngine(QObject* parent = 0); + TestDataEngine(QObject* parent = nullptr); private: }; diff --git a/tests/context/engines/similarartists/TestSimilarArtistsEngine.h b/tests/context/engines/similarartists/TestSimilarArtistsEngine.h --- a/tests/context/engines/similarartists/TestSimilarArtistsEngine.h +++ b/tests/context/engines/similarartists/TestSimilarArtistsEngine.h @@ -26,7 +26,7 @@ { Q_OBJECT public: - TestSimilarArtistsEngine(QObject* parent = 0); + TestSimilarArtistsEngine(QObject* parent = nullptr); private Q_SLOTS: void initTestCase(); void testDataEngineMethod(); diff --git a/tests/context/engines/upcomingevents/TestUpcomingEventsEngine.h b/tests/context/engines/upcomingevents/TestUpcomingEventsEngine.h --- a/tests/context/engines/upcomingevents/TestUpcomingEventsEngine.h +++ b/tests/context/engines/upcomingevents/TestUpcomingEventsEngine.h @@ -27,7 +27,7 @@ Q_OBJECT public: - TestUpcomingEventsEngine(QObject* parent = 0); + TestUpcomingEventsEngine(QObject* parent = nullptr); private Q_SLOTS: void initTestCase(); diff --git a/tests/core-impl/CMakeLists.txt b/tests/core-impl/CMakeLists.txt --- a/tests/core-impl/CMakeLists.txt +++ b/tests/core-impl/CMakeLists.txt @@ -1,5 +1,4 @@ add_subdirectory( collections ) -add_subdirectory( logger ) add_subdirectory( meta ) add_subdirectory( playlists ) add_subdirectory( support ) diff --git a/tests/core-impl/collections/aggregate/TestAggregateMeta.cpp b/tests/core-impl/collections/aggregate/TestAggregateMeta.cpp --- a/tests/core-impl/collections/aggregate/TestAggregateMeta.cpp +++ b/tests/core-impl/collections/aggregate/TestAggregateMeta.cpp @@ -492,7 +492,7 @@ //the signal is delayed a bit, but that is ok QTest::qWait( 50 ); - //required so that the colleection browser refreshes itself + //required so that the collection browser refreshes itself QCOMPARE( spy.count(), 1 ); } diff --git a/tests/core-impl/collections/db/sql/CMakeLists.txt b/tests/core-impl/collections/db/sql/CMakeLists.txt --- a/tests/core-impl/collections/db/sql/CMakeLists.txt +++ b/tests/core-impl/collections/db/sql/CMakeLists.txt @@ -1,8 +1,6 @@ # macro function to build a test target. macro(add_database_test test_target test_sources) - add_definitions(${MYSQL_CFLAGS}) - set( test_sources_internal ${test_sources} ${AMAROK_SOURCE_TREE}/core-impl/storage/sql/mysql-shared/MySqlStorage.cpp @@ -31,14 +29,16 @@ ${ZLIB_LIBRARIES} ${GOOGLEMOCK_LIBRARIES} ) + if(${CMAKE_HOST_SYSTEM_NAME} MATCHES "FreeBSD") + target_link_libraries(${test_target} ${MYSQL_LIBRARIES} crypt) + endif() endmacro(add_database_test) include_directories( ${AMAROK_TEST_TREE} ${AMAROK_SOURCE_TREE} ${AMAROK_SOURCE_TREE}/core-impl/collections/db/sql - ${AMAROK_SOURCE_TREE}/core-impl/logger ${AMAROK_UTILITY_TREE} ${CMAKE_BINARY_DIR}/src ${CMAKE_BINARY_DIR}/tests @@ -117,8 +117,7 @@ set( testsqlcollectionlocation_SRCS TestSqlCollectionLocation.cpp - ${AMAROK_SOURCE_TREE}/core/interfaces/Logger.cpp - ${AMAROK_SOURCE_TREE}/core-impl/logger/ProxyLogger.cpp + ${AMAROK_SOURCE_TREE}/core/logger/Logger.cpp ${GOOGLEMOCK_SRCS} ) diff --git a/tests/core-impl/collections/db/sql/SqlMountPointManagerMock.h b/tests/core-impl/collections/db/sql/SqlMountPointManagerMock.h --- a/tests/core-impl/collections/db/sql/SqlMountPointManagerMock.h +++ b/tests/core-impl/collections/db/sql/SqlMountPointManagerMock.h @@ -89,12 +89,12 @@ void emitDeviceAdded( int id ) { - emit deviceAdded( id ); + Q_EMIT deviceAdded( id ); } void emitDeviceRemoved( int id ) { - emit deviceRemoved( id ); + Q_EMIT deviceRemoved( id ); } QMap m_mountPoints; diff --git a/tests/core-impl/collections/db/sql/TestDatabaseUpdater.h b/tests/core-impl/collections/db/sql/TestDatabaseUpdater.h --- a/tests/core-impl/collections/db/sql/TestDatabaseUpdater.h +++ b/tests/core-impl/collections/db/sql/TestDatabaseUpdater.h @@ -14,8 +14,8 @@ * this program. If not, see . * ****************************************************************************************/ -#ifndef DATABASEUPDATERTEST_H -#define DATABASEUPDATERTEST_H +#ifndef TEST_DATABASEUPDATER_H +#define TEST_DATABASEUPDATER_H #include #include @@ -52,4 +52,4 @@ QTemporaryDir *m_tmpDir; }; -#endif // DATABASEUPDATERTEST_H +#endif // TEST_DATABASEUPDATER_H diff --git a/tests/core-impl/collections/db/sql/TestSqlAlbum.cpp b/tests/core-impl/collections/db/sql/TestSqlAlbum.cpp --- a/tests/core-impl/collections/db/sql/TestSqlAlbum.cpp +++ b/tests/core-impl/collections/db/sql/TestSqlAlbum.cpp @@ -265,7 +265,7 @@ // now the track should be in the compilation album = track->album(); sqlAlbum = static_cast( album.data() ); - QCOMPARE( sqlAlbum->id(), 2 ); // the exisitng compilation album + QCOMPARE( sqlAlbum->id(), 2 ); // the existing compilation album QVERIFY( !album->hasAlbumArtist() ); QVERIFY( album->isCompilation() ); QCOMPARE( album, compilation ); //track returns new album, but the same object that we retrieved above diff --git a/tests/core-impl/collections/db/sql/TestSqlCollectionLocation.cpp b/tests/core-impl/collections/db/sql/TestSqlCollectionLocation.cpp --- a/tests/core-impl/collections/db/sql/TestSqlCollectionLocation.cpp +++ b/tests/core-impl/collections/db/sql/TestSqlCollectionLocation.cpp @@ -19,7 +19,6 @@ #include "DatabaseUpdater.h" #include "core/support/Debug.h" #include "core/support/Components.h" -#include "core-impl/logger/ProxyLogger.h" #include "DefaultSqlQueryMakerFactory.h" #include "core/meta/Meta.h" #include "core-impl/storage/sql/mysqlestorage/MySqlEmbeddedStorage.h" @@ -111,7 +110,6 @@ void TestSqlCollectionLocation::initTestCase() { - Amarok::Components::setLogger( new ProxyLogger() ); m_tmpDir = new QTemporaryDir(); m_storage = QSharedPointer( new MySqlEmbeddedStorage() ); QVERIFY( m_storage->init( m_tmpDir->path() ) ); @@ -137,7 +135,6 @@ TestSqlCollectionLocation::cleanupTestCase() { delete m_collection; - delete Amarok::Components::setLogger( 0 ); //m_storage is deleted by SqlCollection delete m_tmpDir; } diff --git a/tests/core-impl/collections/db/sql/TestSqlScanManager.h b/tests/core-impl/collections/db/sql/TestSqlScanManager.h --- a/tests/core-impl/collections/db/sql/TestSqlScanManager.h +++ b/tests/core-impl/collections/db/sql/TestSqlScanManager.h @@ -114,7 +114,7 @@ /** * Test images */ - void testAlbumImage();; + void testAlbumImage(); /** * Test merging of the result with an incremental scan. @@ -163,8 +163,8 @@ void createCompilationTrack(); /** - * Album that looks alike compillation: various track's artists - * but single album artist and no compillation flag. + * Album that looks alike compilation: various track's artists + * but single album artist and no compilation flag. */ void createCompilationLookAlikeAlbum(); diff --git a/tests/core-impl/collections/db/sql/TestSqlScanManager.cpp b/tests/core-impl/collections/db/sql/TestSqlScanManager.cpp --- a/tests/core-impl/collections/db/sql/TestSqlScanManager.cpp +++ b/tests/core-impl/collections/db/sql/TestSqlScanManager.cpp @@ -52,7 +52,7 @@ m_autoGetCoverArt = AmarokConfig::autoGetCoverArt(); AmarokConfig::setAutoGetCoverArt( false ); - // setenv( "LC_ALL", "", 1 ); // this breakes the test + // setenv( "LC_ALL", "", 1 ); // this breaks the test // Amarok does not force LC_ALL=C but obviously the test does it which // will prevent scanning of files with umlauts. @@ -184,7 +184,7 @@ QVERIFY( track->modifyDate().secsTo( aDate ) < 5 ); // I just wrote the file QVERIFY( track->modifyDate().secsTo( aDate ) >= 0 ); Meta::StatisticsPtr statistics = track->statistics(); - qFuzzyCompare( statistics->score(), 0.875 ); + QVERIFY( qFuzzyCompare( statistics->score(), 0.875 ) ); QCOMPARE( statistics->playCount(), 5 ); QVERIFY( !statistics->firstPlayed().isValid() ); QVERIFY( !statistics->lastPlayed().isValid() ); @@ -737,7 +737,7 @@ QCOMPARE( track->sampleRate(), 44100 ); QCOMPARE( track->filesize(), 389679 ); Meta::StatisticsPtr statistics = track->statistics(); - qFuzzyCompare( statistics->score(), 0.875 ); + QVERIFY( qFuzzyCompare( statistics->score(), 0.875 ) ); QCOMPARE( statistics->playCount(), 5 ); QVERIFY( !statistics->firstPlayed().isValid() ); QVERIFY( !statistics->lastPlayed().isValid() ); @@ -1145,7 +1145,7 @@ { // -- copy the file from our original QVERIFY( values.contains( Meta::valUrl ) ); - const QString targetPath = m_tmpCollectionDir->path() + "/" + values.value( Meta::valUrl ).toString(); + const QString targetPath = m_tmpCollectionDir->path() + '/' + values.value( Meta::valUrl ).toString(); QVERIFY( QDir( m_tmpCollectionDir->path() ).mkpath( QFileInfo( values.value( Meta::valUrl ).toString() ).path() ) ); QVERIFY( QFile::copy( m_sourcePath, targetPath ) ); diff --git a/tests/core-impl/collections/support/TestMemoryQueryMaker.h b/tests/core-impl/collections/support/TestMemoryQueryMaker.h --- a/tests/core-impl/collections/support/TestMemoryQueryMaker.h +++ b/tests/core-impl/collections/support/TestMemoryQueryMaker.h @@ -18,7 +18,7 @@ #ifndef TESTMEMORYQUERYMAKER_H #define TESTMEMORYQUERYMAKER_H -#include +#include #include "core/meta/forward_declarations.h" #include "core/collections/QueryMaker.h" diff --git a/tests/core-impl/collections/support/TestMemoryQueryMaker.cpp b/tests/core-impl/collections/support/TestMemoryQueryMaker.cpp --- a/tests/core-impl/collections/support/TestMemoryQueryMaker.cpp +++ b/tests/core-impl/collections/support/TestMemoryQueryMaker.cpp @@ -135,7 +135,7 @@ TestStringMemoryFilter() : StringMemoryFilter() {} protected: - QString value( Meta::TrackPtr track ) const { Q_UNUSED(track); return "abcdef"; } + QString value( const Meta::TrackPtr &track ) const { Q_UNUSED(track); return "abcdef"; } }; diff --git a/tests/core-impl/logger/CMakeLists.txt b/tests/core-impl/logger/CMakeLists.txt deleted file mode 100644 --- a/tests/core-impl/logger/CMakeLists.txt +++ /dev/null @@ -1,35 +0,0 @@ -include_directories( - ${AMAROK_TEST_TREE} - ${AMAROK_SOURCE_TREE} - ${AMAROK_UTILITY_TREE} - ${CMAKE_BINARY_DIR}/src - ${CMAKE_BINARY_DIR}/tests - - - ${GOOGLEMOCK_INCLUDE_DIR} - ) - -#------------------------ Test ProxyLogger ----------------------------- - -set( testproxylogger_SRCS - TestProxyLogger.cpp - ${AMAROK_SOURCE_TREE}/core/interfaces/Logger.cpp - ${AMAROK_SOURCE_TREE}/core-impl/logger/ProxyLogger.cpp - ${GOOGLEMOCK_SRCS} - ) - - -add_executable( testproxylogger - ${testproxylogger_SRCS} - ) -add_test(NAME testproxylogger COMMAND $) -ecm_mark_as_test(testproxylogger) - -target_link_libraries( testproxylogger - Qt5::Test - Qt5::Core - Qt5::Network - KF5::CoreAddons - KF5::ThreadWeaver - ${GOOGLEMOCK_LIBRARIES} - ${CMAKE_DL_LIBS}) diff --git a/tests/core-impl/meta/multi/TestMetaMultiTrack.h b/tests/core-impl/meta/multi/TestMetaMultiTrack.h --- a/tests/core-impl/meta/multi/TestMetaMultiTrack.h +++ b/tests/core-impl/meta/multi/TestMetaMultiTrack.h @@ -39,7 +39,7 @@ virtual void tracksLoaded( Playlists::PlaylistPtr playlist ); Q_SIGNALS: - void tracksLoadedSignal( Playlists::PlaylistPtr playlist ); + void tracksLoadedSignal( const Playlists::PlaylistPtr &playlist ); private Q_SLOTS: void initTestCase(); @@ -66,13 +66,13 @@ Q_OBJECT public: - NotifyObserversWaiter( const QSet &tracks, QObject *parent = 0 ); + NotifyObserversWaiter( const QSet &tracks, QObject *parent = nullptr ); Q_SIGNALS: void done(); private Q_SLOTS: - void slotFilterResovled(); + void slotFilterResolved(); private: using Observer::metadataChanged; // silence gcc warning diff --git a/tests/core-impl/meta/multi/TestMetaMultiTrack.cpp b/tests/core-impl/meta/multi/TestMetaMultiTrack.cpp --- a/tests/core-impl/meta/multi/TestMetaMultiTrack.cpp +++ b/tests/core-impl/meta/multi/TestMetaMultiTrack.cpp @@ -144,13 +144,13 @@ : QObject( parent ) , m_tracks( tracks ) { - // we need to filter already resovled tracks in the next event loop iteration because + // we need to filter already resolved tracks in the next event loop iteration because // the user wouldn't be able to get the done() signal yet. - QTimer::singleShot( 0, this, &NotifyObserversWaiter::slotFilterResovled ); + QTimer::singleShot( 0, this, &NotifyObserversWaiter::slotFilterResolved ); } void -NotifyObserversWaiter::slotFilterResovled() +NotifyObserversWaiter::slotFilterResolved() { QMutexLocker locker( &m_mutex ); QMutableSetIterator it( m_tracks ); diff --git a/tests/core-impl/playlists/types/file/asx/TestASXPlaylist.cpp b/tests/core-impl/playlists/types/file/asx/TestASXPlaylist.cpp --- a/tests/core-impl/playlists/types/file/asx/TestASXPlaylist.cpp +++ b/tests/core-impl/playlists/types/file/asx/TestASXPlaylist.cpp @@ -126,7 +126,7 @@ TestASXPlaylist::testUidUrl() { QString tempPath = m_tempDir->path() + "/test.asx"; - //we have chaged the name around so much, better reset it + //we have changed the name around so much, better reset it m_testPlaylist->setName( "test" ); QCOMPARE( m_testPlaylist->uidUrl().toLocalFile(), tempPath ); } diff --git a/tests/core-impl/playlists/types/file/m3u/TestM3UPlaylist.cpp b/tests/core-impl/playlists/types/file/m3u/TestM3UPlaylist.cpp --- a/tests/core-impl/playlists/types/file/m3u/TestM3UPlaylist.cpp +++ b/tests/core-impl/playlists/types/file/m3u/TestM3UPlaylist.cpp @@ -114,7 +114,7 @@ void TestM3UPlaylist::testUidUrl() { QString tempPath = m_tempDir->path() + "/test.m3u"; - //we have chaged the name around so much, better reset it + //we have changed the name around so much, better reset it m_testPlaylist->setName( "test" ); QCOMPARE( m_testPlaylist->uidUrl().toLocalFile(), tempPath ); } diff --git a/tests/core-impl/playlists/types/file/xspf/TestXSPFPlaylist.cpp b/tests/core-impl/playlists/types/file/xspf/TestXSPFPlaylist.cpp --- a/tests/core-impl/playlists/types/file/xspf/TestXSPFPlaylist.cpp +++ b/tests/core-impl/playlists/types/file/xspf/TestXSPFPlaylist.cpp @@ -322,7 +322,7 @@ { QString tempPath = m_tempDir->path() + "/test.xspf"; - //we have chaged the name around so much, better reset it + //we have changed the name around so much, better reset it m_testPlaylist1->setName( "test" ); QCOMPARE( m_testPlaylist1->uidUrl().toLocalFile(), tempPath ); } diff --git a/tests/core/CMakeLists.txt b/tests/core/CMakeLists.txt --- a/tests/core/CMakeLists.txt +++ b/tests/core/CMakeLists.txt @@ -1,5 +1,6 @@ add_subdirectory( capabilities ) add_subdirectory( collections ) add_subdirectory( interfaces ) +add_subdirectory( logger ) add_subdirectory( meta ) add_subdirectory( playlists ) diff --git a/tests/core/logger/CMakeLists.txt b/tests/core/logger/CMakeLists.txt new file mode 100644 --- /dev/null +++ b/tests/core/logger/CMakeLists.txt @@ -0,0 +1,34 @@ +include_directories( + ${AMAROK_TEST_TREE} + ${AMAROK_SOURCE_TREE} + ${AMAROK_UTILITY_TREE} + ${CMAKE_BINARY_DIR}/src + ${CMAKE_BINARY_DIR}/tests + + + ${GOOGLEMOCK_INCLUDE_DIR} + ) + +#------------------------ Test Logger ----------------------------- + +set( testlogger_SRCS + TestLogger.cpp + ${AMAROK_SOURCE_TREE}/core/logger/Logger.cpp + ${GOOGLEMOCK_SRCS} + ) + + +add_executable( testlogger + ${testlogger_SRCS} + ) +add_test(NAME testlogger COMMAND $) +ecm_mark_as_test(testlogger) + +target_link_libraries( testlogger + Qt5::Test + Qt5::Core + Qt5::Network + KF5::CoreAddons + KF5::ThreadWeaver + ${GOOGLEMOCK_LIBRARIES} + ${CMAKE_DL_LIBS}) diff --git a/tests/core-impl/logger/TestProxyLogger.h b/tests/core/logger/TestLogger.h rename from tests/core-impl/logger/TestProxyLogger.h rename to tests/core/logger/TestLogger.h --- a/tests/core-impl/logger/TestProxyLogger.h +++ b/tests/core/logger/TestLogger.h @@ -14,16 +14,16 @@ * this program. If not, see . * ****************************************************************************************/ -#ifndef TEST_PROXY_LOGGER_H -#define TEST_PROXY_LOGGER_H +#ifndef TEST_LOGGER_H +#define TEST_LOGGER_H #include -class TestProxyLogger : public QObject +class TestLogger : public QObject { Q_OBJECT public: - TestProxyLogger(); + TestLogger(); private Q_SLOTS: void init(); diff --git a/tests/core-impl/logger/TestProxyLogger.cpp b/tests/core/logger/TestLogger.cpp rename from tests/core-impl/logger/TestProxyLogger.cpp rename to tests/core/logger/TestLogger.cpp --- a/tests/core-impl/logger/TestProxyLogger.cpp +++ b/tests/core/logger/TestLogger.cpp @@ -14,36 +14,36 @@ * this program. If not, see . * ****************************************************************************************/ -#include "TestProxyLogger.h" +#include "TestLogger.h" -#include "core/interfaces/Logger.h" -#include "core-impl/logger/ProxyLogger.h" +#include "core/logger/Logger.h" #include "mocks/MockLogger.h" #include #include #include +#include + #include -QTEST_GUILESS_MAIN( TestProxyLogger ) +QTEST_GUILESS_MAIN( TestLogger ) using ::testing::Return; using ::testing::AnyNumber; using ::testing::_; using ::testing::Mock; -static ProxyLogger *s_logger; class DummyJob : public KJob { public: virtual void start() {} }; -TestProxyLogger::TestProxyLogger() +TestLogger::TestLogger() { int argc = 1; char **argv = (char **) malloc(sizeof(char *)); @@ -53,15 +53,13 @@ } void -TestProxyLogger::init() +TestLogger::init() { - s_logger = 0; } void -TestProxyLogger::cleanup() +TestLogger::cleanup() { - delete s_logger; } class ProgressJob : public QObject, public ThreadWeaver::Job @@ -75,7 +73,7 @@ Q_UNUSED(thread); KJob *job = new DummyJob(); QObject *obj = new QObject(); - s_logger->newProgressOperation( job, QString( "foo" ), obj, "foo()" ); + Amarok::Logger::newProgressOperation( job, QString( "foo" ), obj ); if( deleteJob ) delete job; if( deleteObject ) delete obj; @@ -111,99 +109,79 @@ }; void -TestProxyLogger::testDoNotForwardDeletedJob() +TestLogger::testDoNotForwardDeletedJob() { - s_logger = new ProxyLogger(); - Amarok::MockLogger *mock = new Amarok::MockLogger(); - EXPECT_CALL( *mock, newProgressOperation( An(), _, _, _, _ ) ).Times( 0 ); - - s_logger->setLogger( mock ); + EXPECT_CALL( *mock, newProgressOperationImpl( An(), _, _, _, _ ) ).Times( 0 ); ProgressJob *job = new ProgressJob(); job->deleteJob = true; ThreadWeaver::Queue::instance()->enqueue( QSharedPointer(job) ); QTest::qSleep( 10 ); //ensure that the job has time to run - QTest::qWait( 20 ); //give the ProxyLogger-internal timer time to fire + QTest::qWait( 20 ); //give the Logger-internal timer time to fire QVERIFY( Mock::VerifyAndClearExpectations( &mock ) ); delete mock; } void -TestProxyLogger::testDoNotForwardDeletedSlot() +TestLogger::testDoNotForwardDeletedSlot() { - s_logger = new ProxyLogger(); - Amarok::MockLogger *mock = new Amarok::MockLogger(); - EXPECT_CALL( *mock, newProgressOperation( An(), _, 0, 0, _ ) ).Times( 1 ).WillOnce( Return() ); - - s_logger->setLogger( mock ); + EXPECT_CALL( *mock, newProgressOperationImpl( An(), _, nullptr, _, _ ) ).Times( 1 ).WillOnce( Return() ); ProgressJob *job = new ProgressJob(); job->deleteObject = true; ThreadWeaver::Queue::instance()->enqueue( QSharedPointer(job) ); QTest::qSleep( 10 ); //ensure that the job has time to run - QTest::qWait( 20 ); //give the ProxyLogger-internal timer time to fire + QTest::qWait( 20 ); //give the Logger-internal timer time to fire QVERIFY( Mock::VerifyAndClearExpectations( &mock ) ); delete mock; } void -TestProxyLogger::testForwardLongMessage() +TestLogger::testForwardLongMessage() { - s_logger = new ProxyLogger(); - Amarok::MockLogger *mock = new Amarok::MockLogger(); - EXPECT_CALL( *mock, longMessage( _, _ ) ).Times( 1 ).WillOnce( Return() ); + EXPECT_CALL( *mock, longMessageImpl( _, _ ) ).Times( 1 ).WillOnce( Return() ); - s_logger->setLogger( mock ); - - s_logger->longMessage( "foo", Amarok::Logger::Information ); + Amarok::Logger::longMessage( "foo", Amarok::Logger::Information ); QTest::qWait( 20 ); QVERIFY( Mock::VerifyAndClearExpectations( &mock ) ); delete mock; } void -TestProxyLogger::testForwardProgressOperation() +TestLogger::testForwardProgressOperation() { - s_logger = new ProxyLogger(); - Amarok::MockLogger *mock = new Amarok::MockLogger(); - EXPECT_CALL( *mock, newProgressOperation( An(), _, _, _, _ ) ).Times( 1 ).WillOnce( Return() ); - - s_logger->setLogger( mock ); + EXPECT_CALL( *mock, newProgressOperationImpl( An(), _, _, _, _ ) ).Times( 1 ).WillOnce( Return() ); - s_logger->newProgressOperation( new DummyJob(), QString( "foo" ) ); + Amarok::Logger::newProgressOperation( new DummyJob(), QString( "foo" ) ); QTest::qWait( 20 ); QVERIFY( Mock::VerifyAndClearExpectations( &mock ) ); delete mock; } void -TestProxyLogger::testForwardShortMessage() +TestLogger::testForwardShortMessage() { - s_logger = new ProxyLogger(); - Amarok::MockLogger *mock = new Amarok::MockLogger(); - EXPECT_CALL( *mock, shortMessage( _ ) ).Times( 1 ).WillOnce( Return() ); - - s_logger->setLogger( mock ); + EXPECT_CALL( *mock, shortMessageImpl( _ ) ).Times( 1 ).WillOnce( Return() ); - s_logger->shortMessage( "foo" ); + Amarok::Logger::shortMessage( "foo" ); QTest::qWait( 20 ); QVERIFY( Mock::VerifyAndClearExpectations( &mock ) ); delete mock; } -#include "TestProxyLogger.moc" +#include "TestLogger.moc" diff --git a/tests/core/meta/support/TestPrivateMetaRegistry.h b/tests/core/meta/support/TestPrivateMetaRegistry.h --- a/tests/core/meta/support/TestPrivateMetaRegistry.h +++ b/tests/core/meta/support/TestPrivateMetaRegistry.h @@ -13,8 +13,8 @@ * this program. If not, see . * ****************************************************************************************/ -#ifndef TESTMETAPRIVATEMETAREGISTRY_H -#define TESTMETAPRIVATEMETAREGISTRY_H +#ifndef TESTPRIVATEMETAREGISTRY_H +#define TESTPRIVATEMETAREGISTRY_H #include "core/meta/forward_declarations.h" @@ -71,4 +71,4 @@ TrackPtr m_track1, m_track2, m_track3, m_track4, m_track5; }; -#endif // TESTMETAPRIVATEMETAREGISTRY_H +#endif // TESTPRIVATEMETAREGISTRY_H diff --git a/tests/core/playlists/TestPlaylistObserver.h b/tests/core/playlists/TestPlaylistObserver.h --- a/tests/core/playlists/TestPlaylistObserver.h +++ b/tests/core/playlists/TestPlaylistObserver.h @@ -30,19 +30,19 @@ public: virtual void metadataChanged( Playlists::PlaylistPtr ) { - emit metadataChangedSignal(); + Q_EMIT metadataChangedSignal(); } virtual void tracksLoaded( Playlists::PlaylistPtr ) { - emit tracksLoadedSignal(); + Q_EMIT tracksLoadedSignal(); } virtual void trackAdded( Playlists::PlaylistPtr, Meta::TrackPtr, int ) { - emit trackAddedSignal(); + Q_EMIT trackAddedSignal(); } virtual void trackRemoved( Playlists::PlaylistPtr, int ) { - emit trackRemovedSignal(); + Q_EMIT trackRemovedSignal(); } Q_SIGNALS: diff --git a/tests/dynamic/CMakeLists.txt b/tests/dynamic/CMakeLists.txt --- a/tests/dynamic/CMakeLists.txt +++ b/tests/dynamic/CMakeLists.txt @@ -1,7 +1,4 @@ macro(link_database_test test_target) - - add_definitions(${MYSQL_CFLAGS}) - if(APPLE) set_target_properties(${test_target} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") endif() diff --git a/tests/dynamic/TestTrackSet.h b/tests/dynamic/TestTrackSet.h --- a/tests/dynamic/TestTrackSet.h +++ b/tests/dynamic/TestTrackSet.h @@ -14,8 +14,8 @@ * this program. If not, see . * ****************************************************************************************/ -#ifndef TESTDYNAMICMODEL_H -#define TESTDYNAMICMODEL_H +#ifndef TEST_TRACKSET_H +#define TEST_TRACKSET_H #include "dynamic/TrackSet.h" diff --git a/tests/importers/ImporterMocks.h b/tests/importers/ImporterMocks.h --- a/tests/importers/ImporterMocks.h +++ b/tests/importers/ImporterMocks.h @@ -66,7 +66,7 @@ class MockController : public StatSyncing::Controller { public: - MockController( QObject *parent = 0 ); + MockController( QObject *parent = nullptr ); MOCK_METHOD1( registerProvider, void(const StatSyncing::ProviderPtr&) ); MOCK_METHOD1( unregisterProvider, void(const StatSyncing::ProviderPtr&) ); diff --git a/tests/importers/ImporterMocks.cpp b/tests/importers/ImporterMocks.cpp --- a/tests/importers/ImporterMocks.cpp +++ b/tests/importers/ImporterMocks.cpp @@ -113,6 +113,7 @@ void ImporterMocks::cleanupTestCase() { + Amarok::config( "StatSyncing" ).deleteGroup(); Amarok::Components::setEngineController( 0 ); delete m_engineController; } diff --git a/tests/importers/TestImporterBase.h b/tests/importers/TestImporterBase.h --- a/tests/importers/TestImporterBase.h +++ b/tests/importers/TestImporterBase.h @@ -84,7 +84,7 @@ virtual StatSyncing::ProviderPtr getWritableProvider(); /** - * Return a binary or of Meta::val* representing statistics suported + * Return a binary or of Meta::val* representing statistics supported * by the provider being tested. */ virtual qint64 reliableStatistics() const = 0; diff --git a/tests/importers/TestImporterProvider.h b/tests/importers/TestImporterProvider.h --- a/tests/importers/TestImporterProvider.h +++ b/tests/importers/TestImporterProvider.h @@ -14,8 +14,8 @@ * this program. If not, see . * ****************************************************************************************/ -#ifndef TEST_IMPORTER_MANAGER -#define TEST_IMPORTER_MANAGER +#ifndef TEST_IMPORTER_PROVIDER_H +#define TEST_IMPORTER_PROVIDER_H #include "ImporterMocks.h" @@ -38,4 +38,4 @@ void defaultPreferenceShouldReturnNoByDefault(); }; -#endif // TEST_IMPORTER_MANAGER +#endif // TEST_IMPORTER_PROVIDER_H diff --git a/tests/mocks/MetaMock.h b/tests/mocks/MetaMock.h --- a/tests/mocks/MetaMock.h +++ b/tests/mocks/MetaMock.h @@ -46,7 +46,7 @@ QUrl playableUrl() const { return m_data.value( Meta::Field::URL ).value(); } QString prettyUrl() const { return playableUrl().url(); } QString uidUrl() const { return m_data.value( Meta::Field::UNIQUEID ).toString(); } - QString notPlayableReason() const { return QString( "dummy reason" ); } + QString notPlayableReason() const { return QStringLiteral( "dummy reason" ); } QString comment() const { return m_data.value( Meta::Field::COMMENT ).toString(); } qreal bpm() const { return m_data.value( Meta::Field::BPM ).toDouble(); } qint64 length() const { return m_data.value( Meta::Field::LENGTH ).toInt(); } diff --git a/tests/mocks/MockLogger.h b/tests/mocks/MockLogger.h --- a/tests/mocks/MockLogger.h +++ b/tests/mocks/MockLogger.h @@ -19,7 +19,7 @@ #include -#include "core/interfaces/Logger.h" +#include "core/logger/Logger.h" using ::testing::Return; using ::testing::An; @@ -32,21 +32,21 @@ public: MockLogger() : Amarok::Logger() { - ON_CALL( *this, shortMessage( _ ) ).WillByDefault( Return() ); - ON_CALL( *this, longMessage( _, _ ) ).WillByDefault( Return() ); - ON_CALL( *this, newProgressOperation( An(), _, _, _, _ ) ).WillByDefault( Return() ); - ON_CALL( *this, newProgressOperation( An(), _, _, _, _ ) ).WillByDefault( Return() ); - ON_CALL( *this, newProgressOperation( An(), _, _, _, _, _ ) ).WillByDefault( Return() ); + ON_CALL( *this, shortMessageImpl( _ ) ).WillByDefault( Return() ); + ON_CALL( *this, longMessageImpl( _, _ ) ).WillByDefault( Return() ); + ON_CALL( *this, newProgressOperationImpl( An(), _, _, _, _ ) ).WillByDefault( Return() ); + ON_CALL( *this, newProgressOperationImpl( An(), _, _, _, _ ) ).WillByDefault( Return() ); + ON_CALL( *this, newProgressOperationImpl( An(), _, _, _, _, _, _, _ ) ).WillByDefault( Return() ); } - MOCK_METHOD1( shortMessage, void( const QString& ) ); - MOCK_METHOD2( longMessage, void( const QString&, Amarok::Logger::MessageType ) ); - MOCK_METHOD5( newProgressOperation, void( KJob*, const QString&, QObject*, const char*, - Qt::ConnectionType ) ); - MOCK_METHOD5( newProgressOperation, void( QNetworkReply*, const QString&, QObject*, - const char*, Qt::ConnectionType ) ); - MOCK_METHOD6( newProgressOperation, void( QObject *, const QString&, int, QObject*, - const char*, Qt::ConnectionType ) ); + MOCK_METHOD1( shortMessageImpl, void( const QString& ) ); + MOCK_METHOD2( longMessageImpl, void( const QString&, Amarok::Logger::MessageType ) ); + MOCK_METHOD5( newProgressOperationImpl, void( KJob*, const QString&, QObject*, const std::function&, + Qt::ConnectionType ) ); + MOCK_METHOD5( newProgressOperationImpl, void( QNetworkReply*, const QString&, QObject*, + const std::function&, Qt::ConnectionType ) ); + MOCK_METHOD8( newProgressOperationImpl, void( QObject *, const QMetaMethod &, const QMetaMethod &, const QString&, + int, QObject*, const std::function&, Qt::ConnectionType ) ); }; } diff --git a/tests/mocks/MockQueryMaker.h b/tests/mocks/MockQueryMaker.h --- a/tests/mocks/MockQueryMaker.h +++ b/tests/mocks/MockQueryMaker.h @@ -168,7 +168,7 @@ */ virtual void emitQueryDone() { - emit queryDone(); + Q_EMIT queryDone(); } public Q_SLOTS: @@ -179,7 +179,7 @@ */ virtual void deleteLater() { - emit destroyed(); + Q_EMIT destroyed(); } }; diff --git a/tests/qt-modeltest/modeltest.h b/tests/qt-modeltest/modeltest.h --- a/tests/qt-modeltest/modeltest.h +++ b/tests/qt-modeltest/modeltest.h @@ -33,7 +33,7 @@ Q_OBJECT public: - ModelTest(QAbstractItemModel *model, QObject *parent = 0); + ModelTest(QAbstractItemModel *model, QObject *parent = nullptr); private Q_SLOTS: void nonDestructiveBasicTest(); diff --git a/tests/scanner/TestGenericScanManager.h b/tests/scanner/TestGenericScanManager.h --- a/tests/scanner/TestGenericScanManager.h +++ b/tests/scanner/TestGenericScanManager.h @@ -60,7 +60,7 @@ /** * Test images */ - void testAlbumImage();; + void testAlbumImage(); public Q_SLOTS: diff --git a/tests/scanner/TestGenericScanManager.cpp b/tests/scanner/TestGenericScanManager.cpp --- a/tests/scanner/TestGenericScanManager.cpp +++ b/tests/scanner/TestGenericScanManager.cpp @@ -42,7 +42,7 @@ { AmarokConfig::instance("amarokrc"); - // setenv( "LC_ALL", "", 1 ); // this breakes the test + // setenv( "LC_ALL", "", 1 ); // this breaks the test // Amarok does not force LC_ALL=C but obviously the test does it which // will prevent scanning of files with umlauts. diff --git a/utilities/afttagger/AFTTagger.h b/utilities/afttagger/AFTTagger.h --- a/utilities/afttagger/AFTTagger.h +++ b/utilities/afttagger/AFTTagger.h @@ -44,7 +44,7 @@ public: AFTTagger( int &argc, char **argv ); - ~AFTTagger() {}; + ~AFTTagger() {} void processPath( const QString &path ); bool handleMPEG( TagLib::MPEG::File *file ); @@ -55,7 +55,7 @@ bool handleXiphComment( TagLib::Ogg::XiphComment *comment, TagLib::File *file ); QString createCurrentUID( TagLib::File *file ); QString createV1UID( TagLib::File *file ); - QString upgradeUID( int version, QString currValue ); + QString upgradeUID( int version, const QString &currValue ); void readArgs(); void displayHelp(); diff --git a/utilities/afttagger/AFTTagger.cpp b/utilities/afttagger/AFTTagger.cpp --- a/utilities/afttagger/AFTTagger.cpp +++ b/utilities/afttagger/AFTTagger.cpp @@ -71,7 +71,7 @@ , m_textStream( stderr ) { - setObjectName( "amarok_afttagger" ); + setObjectName( QStringLiteral("amarok_afttagger") ); readArgs(); @@ -134,8 +134,8 @@ m_textStream << tr( "INFO: Processing directory %1" ).arg( path ) << endl; foreach( const QString &pathEntry, QDir( path ).entryList() ) { - if( pathEntry != "." && pathEntry != ".." ) - processPath( QDir( path ).canonicalPath() + '/' + pathEntry ); + if( pathEntry != QLatin1String(".") && pathEntry != QLatin1String("..") ) + processPath( QDir( path ).canonicalPath() + QLatin1Char('/') + pathEntry ); } } } @@ -164,7 +164,7 @@ SafeFileSaver sfs( filePath ); sfs.setVerbose( false ); - sfs.setPrefix( "amarok-afttagger" ); + sfs.setPrefix( QStringLiteral("amarok-afttagger") ); QString tempFilePath = sfs.prepareToSave(); if( tempFilePath.isEmpty() ) { @@ -258,7 +258,7 @@ if( currFrame ) { QString owner = TStringToQString( currFrame->owner() ).toUpper(); - if( owner.startsWith( "AMAROK - REDISCOVER YOUR MUSIC" ) ) + if( owner.startsWith( QLatin1String("AMAROK - REDISCOVER YOUR MUSIC") ) ) { nothingfound = false; if( m_verbose ) @@ -272,7 +272,7 @@ else return true; } - if( owner.startsWith( "AMAROK 2 AFT" ) ) + if( owner.startsWith( QLatin1String("AMAROK 2 AFT") ) ) { nothingfound = false; if( m_verbose ) @@ -410,7 +410,7 @@ { TagLib::String key = iter->first; QString qkey = TStringToQString( key ).toUpper(); - if( qkey.startsWith( "AMAROK - REDISCOVER YOUR MUSIC" ) ) + if( qkey.startsWith( QLatin1String("AMAROK - REDISCOVER YOUR MUSIC") ) ) { nothingfound = false; @@ -421,7 +421,7 @@ if( !m_delete ) newUid = true; } - else if( qkey.startsWith( "AMAROK 2 AFT" ) ) + else if( qkey.startsWith( QLatin1String("AMAROK 2 AFT") ) ) { nothingfound = false; @@ -515,7 +515,7 @@ { TagLib::String key = it->first; QString qkey = TStringToQString( key ).toUpper(); - if( qkey.startsWith( "AMAROK - REDISCOVER YOUR MUSIC" ) ) + if( qkey.startsWith( QLatin1String("AMAROK - REDISCOVER YOUR MUSIC") ) ) { nothingfound = false; @@ -526,7 +526,7 @@ if( !m_delete ) newUid = true; } - else if( qkey.startsWith( "AMAROK 2 AFT" ) ) + else if( qkey.startsWith( QLatin1String("AMAROK 2 AFT") ) ) { nothingfound = false; @@ -617,7 +617,7 @@ { TagLib::String key = it->first; const QString qkey = TStringToQString( key ).toUpper(); - if( qkey.contains( "AMAROK - REDISCOVER YOUR MUSIC" ) ) + if( qkey.contains( QLatin1String("AMAROK - REDISCOVER YOUR MUSIC") ) ) { nothingfound = false; @@ -628,7 +628,7 @@ if( !m_delete ) newUid = true; } - else if( qkey.contains( "AMAROK 2 AFT" ) ) + else if( qkey.contains( QLatin1String("AMAROK 2 AFT") ) ) { nothingfound = false; @@ -643,7 +643,7 @@ } else { - int version = qkey.at( qkey.indexOf( "AMAROK 2 AFT" ) + 13 ).digitValue(); + int version = qkey.at( qkey.indexOf( QLatin1String("AMAROK 2 AFT") ) + 13 ).digitValue(); if( m_verbose ) m_textStream << tr( "INFO: AFT identifier is version %1" ).arg( version ) << endl; if( version < s_currentVersion ) @@ -724,7 +724,7 @@ } QString -AFTTagger::upgradeUID( int version, QString currValue ) +AFTTagger::upgradeUID( int version, const QString &currValue ) { Q_UNUSED(version) return currValue + "abcd"; @@ -747,18 +747,18 @@ { m_fileFolderList.append( arg ); } - else if( arg.startsWith( "--" ) ) + else if( arg.startsWith( QLatin1String("--") ) ) { QString myarg = QString( arg ).remove( 0, 2 ); - if ( myarg == "recurse" || myarg == "recursively" ) + if ( myarg == QLatin1String("recurse") || myarg == QLatin1String("recursively") ) m_recurse = true; - else if( myarg == "verbose" ) + else if( myarg == QLatin1String("verbose") ) m_verbose = true; - else if( myarg == "quiet" ) + else if( myarg == QLatin1String("quiet") ) m_quiet = true; - else if( myarg == "newid" ) + else if( myarg == QLatin1String("newid") ) m_newid = true; - else if( myarg == "delete" ) + else if( myarg == QLatin1String("delete") ) m_delete = true; else displayHelp(); diff --git a/utilities/afttagger/CMakeLists.txt b/utilities/afttagger/CMakeLists.txt --- a/utilities/afttagger/CMakeLists.txt +++ b/utilities/afttagger/CMakeLists.txt @@ -27,7 +27,7 @@ if(APPLE) set_target_properties(amarok_afttagger PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") # install to app bundle on os x, otherwise amarok fails to load it - install(TARGETS amarok_afttagger DESTINATION ${BUNDLE_INSTALL_DIR}/Amarok.app/Contents/MacOS ) + install(TARGETS amarok_afttagger DESTINATION ${KDE_INSTALL_BUNDLEDIR}/Amarok.app/Contents/MacOS ) else() install(TARGETS amarok_afttagger RUNTIME DESTINATION ${KDE_INSTALL_BINDIR} ) endif() diff --git a/utilities/afttagger/SafeFileSaver.h b/utilities/afttagger/SafeFileSaver.h --- a/utilities/afttagger/SafeFileSaver.h +++ b/utilities/afttagger/SafeFileSaver.h @@ -30,7 +30,7 @@ class SafeFileSaver { public: - SafeFileSaver( const QString &origPath ); + explicit SafeFileSaver( const QString &origPath ); ~SafeFileSaver(); QString prepareToSave(); diff --git a/utilities/afttagger/SafeFileSaver.cpp b/utilities/afttagger/SafeFileSaver.cpp --- a/utilities/afttagger/SafeFileSaver.cpp +++ b/utilities/afttagger/SafeFileSaver.cpp @@ -37,7 +37,7 @@ , m_origRenamedSavePath() , m_cleanupNeeded( false ) , m_verbose( false ) - , m_prefix( "safefilesaver" ) + , m_prefix( QStringLiteral("safefilesaver") ) { } @@ -77,8 +77,8 @@ QString randomString = str; - m_tempSavePath = m_origPath + '.' + m_prefix + "temp.pid-" + pid + ".random-" + randomString + '.' + QFileInfo( m_origPath ).suffix(); - m_origRenamedSavePath = m_origPath + '.' + m_prefix + "original.pid-" + pid + ".random-" + randomString + '.' + QFileInfo( m_origPath ).suffix(); + m_tempSavePath = m_origPath + QLatin1Char('.') + m_prefix + "temp.pid-" + pid + ".random-" + randomString + QLatin1Char('.') + QFileInfo( m_origPath ).suffix(); + m_origRenamedSavePath = m_origPath + QLatin1Char('.') + m_prefix + "original.pid-" + pid + ".random-" + randomString + QLatin1Char('.') + QFileInfo( m_origPath ).suffix(); if( m_verbose ) diff --git a/utilities/collectionscanner/CMakeLists.txt b/utilities/collectionscanner/CMakeLists.txt --- a/utilities/collectionscanner/CMakeLists.txt +++ b/utilities/collectionscanner/CMakeLists.txt @@ -15,7 +15,7 @@ if(APPLE) set_target_properties(amarokcollectionscanner PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") # install to app bundle on os x, otherwise amarok fails to load it - install(TARGETS amarokcollectionscanner DESTINATION ${BUNDLE_INSTALL_DIR}/amarok.app/Contents/MacOS ) + install(TARGETS amarokcollectionscanner DESTINATION ${KDE_INSTALL_BUNDLEDIR}/amarok.app/Contents/MacOS ) else() install(TARGETS amarokcollectionscanner RUNTIME DESTINATION ${KDE_INSTALL_BINDIR} ) endif() diff --git a/utilities/collectionscanner/CollectionScanner.cpp b/utilities/collectionscanner/CollectionScanner.cpp --- a/utilities/collectionscanner/CollectionScanner.cpp +++ b/utilities/collectionscanner/CollectionScanner.cpp @@ -81,7 +81,7 @@ , m_restart( false ) , m_idlePriority( false ) { - setObjectName( "amarokcollectionscanner" ); + setObjectName( QStringLiteral("amarokcollectionscanner") ); readArgs(); @@ -165,9 +165,9 @@ // Make sure that all paths are absolute, not relative if( QDir::isRelativePath( dir ) ) - dir = QDir::cleanPath( QDir::currentPath() + '/' + dir ); + dir = QDir::cleanPath( QDir::currentPath() + QLatin1Char('/') + dir ); - if( !dir.endsWith( '/' ) ) + if( !dir.endsWith( QLatin1Char('/') ) ) dir += '/'; addDir( dir, &entriesSet ); // checks m_recursively @@ -196,10 +196,10 @@ m_scanningState.writeFull(); // just trigger write to initialise memory xmlWriter.writeStartDocument(); - xmlWriter.writeStartElement("scanner"); - xmlWriter.writeAttribute("count", QString::number( entries.count() ) ); + xmlWriter.writeStartElement(QStringLiteral("scanner")); + xmlWriter.writeAttribute(QStringLiteral("count"), QString::number( entries.count() ) ); if( m_incremental ) - xmlWriter.writeAttribute("incremental", QString()); + xmlWriter.writeAttribute(QStringLiteral("incremental"), QString()); // write some information into the file and close previous tag xmlWriter.writeComment("Created by amarokcollectionscanner " AMAROK_VERSION " on "+QDateTime::currentDateTime().toString()); xmlFile.flush(); @@ -211,7 +211,7 @@ CollectionScanner::Directory dir( path, &m_scanningState, m_incremental && !isModified( path ) ); - xmlWriter.writeStartElement( "directory" ); + xmlWriter.writeStartElement( QStringLiteral("directory") ); dir.toXml( &xmlWriter ); xmlWriter.writeEndElement(); xmlFile.flush(); @@ -227,7 +227,7 @@ CollectionScanner::Scanner::addDir( const QString& dir, QSet* entries ) { // Linux specific, but this fits the 90% rule - if( dir.startsWith( "/dev" ) || dir.startsWith( "/sys" ) || dir.startsWith( "/proc" ) ) + if( dir.startsWith( QLatin1String("/dev") ) || dir.startsWith( QLatin1String("/sys") ) || dir.startsWith( QLatin1String("/proc") ) ) return; if( entries->contains( dir ) ) @@ -247,9 +247,9 @@ return; // finished d.setFilter( QDir::NoDotAndDotDot | QDir::Dirs ); - QFileInfoList fileInfos = d.entryInfoList(); + const QFileInfoList fileInfos = d.entryInfoList(); - foreach( const QFileInfo &fi, fileInfos ) + for ( const QFileInfo &fi : fileInfos ) { if( !fi.exists() ) continue; @@ -294,44 +294,44 @@ { QString arg = argslist.at( argnum ); - if( arg.startsWith( "--" ) ) + if( arg.startsWith( QLatin1String("--") ) ) { QString myarg = QString( arg ).remove( 0, 2 ); - if( myarg == "newer" ) + if( myarg == QLatin1String("newer") ) { if( argslist.count() > argnum + 1 ) readNewerTime( argslist.at( argnum + 1 ) ); else missingArg = true; argnum++; } - else if( myarg == "batch" ) + else if( myarg == QLatin1String("batch") ) { if( argslist.count() > argnum + 1 ) readBatchFile( argslist.at( argnum + 1 ) ); else missingArg = true; argnum++; } - else if( myarg == "sharedmemory" ) + else if( myarg == QLatin1String("sharedmemory") ) { if( argslist.count() > argnum + 1 ) m_scanningState.setKey( argslist.at( argnum + 1 ) ); else missingArg = true; argnum++; } - else if( myarg == "version" ) + else if( myarg == QLatin1String("version") ) displayVersion(); - else if( myarg == "incremental" ) + else if( myarg == QLatin1String("incremental") ) m_incremental = true; - else if( myarg == "recursive" ) + else if( myarg == QLatin1String("recursive") ) m_recursively = true; - else if( myarg == "restart" ) + else if( myarg == QLatin1String("restart") ) m_restart = true; - else if( myarg == "idlepriority" ) + else if( myarg == QLatin1String("idlepriority") ) m_idlePriority = true; - else if( myarg == "charset" ) + else if( myarg == QLatin1String("charset") ) m_charset = true; else displayHelp(); diff --git a/utilities/collectionscanner/charset-detector/include/chardet.h b/utilities/collectionscanner/charset-detector/include/chardet.h --- a/utilities/collectionscanner/charset-detector/include/chardet.h +++ b/utilities/collectionscanner/charset-detector/include/chardet.h @@ -79,7 +79,7 @@ int chardet_handle_data(chardet_t det, const char* data, unsigned int len); /** - * Notify an end of data to an encoding detctor. + * Notify an end of data to an encoding detector. * @param det [in] the encoding detector handle * @return CHARDET_RESULT_OK if succeeded. * CHARDET_RESULT_INVALID_DETECTOR if det was invalid. diff --git a/utilities/collectionscanner/charset-detector/src/CharDistribution.h b/utilities/collectionscanner/charset-detector/src/CharDistribution.h --- a/utilities/collectionscanner/charset-detector/src/CharDistribution.h +++ b/utilities/collectionscanner/charset-detector/src/CharDistribution.h @@ -85,7 +85,7 @@ //This function is for future extension. Caller can use this function to control //analyser's behavior - void SetOpion(){}; + void SetOpion(){} //It is not necessary to receive all data to draw conclusion. For charset detection, // certain amount of data is enough diff --git a/utilities/collectionscanner/charset-detector/src/JpCntx.h b/utilities/collectionscanner/charset-detector/src/JpCntx.h --- a/utilities/collectionscanner/charset-detector/src/JpCntx.h +++ b/utilities/collectionscanner/charset-detector/src/JpCntx.h @@ -77,14 +77,14 @@ float GetConfidence(); void Reset(void); - void SetOpion(){}; + void SetOpion(){} PRBool GotEnoughData() {return mTotalRel > ENOUGH_REL_THRESHOLD;}; protected: virtual PRInt32 GetOrder(const char* str, PRUint32 *charLen) = 0; virtual PRInt32 GetOrder(const char* str) = 0; - //category counters, each interger counts sequence in its category + //category counters, each integer counts sequence in its category PRUint32 mRelSample[NUM_OF_CATEGORY]; //total sequence received @@ -104,7 +104,7 @@ class SJISContextAnalysis : public JapaneseContextAnalysis { - //SJISContextAnalysis(){}; + //SJISContextAnalysis(){} protected: PRInt32 GetOrder(const char* str, PRUint32 *charLen); diff --git a/utilities/collectionscanner/charset-detector/src/nsBig5Prober.h b/utilities/collectionscanner/charset-detector/src/nsBig5Prober.h --- a/utilities/collectionscanner/charset-detector/src/nsBig5Prober.h +++ b/utilities/collectionscanner/charset-detector/src/nsBig5Prober.h @@ -52,7 +52,7 @@ nsProbingState GetState(void) {return mState;}; void Reset(void); float GetConfidence(void); - void SetOpion() {}; + void SetOpion() {} protected: void GetDistribution(PRUint32 aCharLen, const char* aStr); diff --git a/utilities/collectionscanner/charset-detector/src/nsCharSetProber.h b/utilities/collectionscanner/charset-detector/src/nsCharSetProber.h --- a/utilities/collectionscanner/charset-detector/src/nsCharSetProber.h +++ b/utilities/collectionscanner/charset-detector/src/nsCharSetProber.h @@ -52,16 +52,16 @@ class nsCharSetProber { public: - virtual ~nsCharSetProber() {}; + virtual ~nsCharSetProber() {} virtual const char* GetCharSetName() = 0; virtual nsProbingState HandleData(const char* aBuf, PRUint32 aLen) = 0; virtual nsProbingState GetState(void) = 0; virtual void Reset(void) = 0; virtual float GetConfidence(void) = 0; virtual void SetOpion() = 0; #ifdef DEBUG_chardet - virtual void DumpStatus() {}; + virtual void DumpStatus() {} #endif // Helper functions used in the Latin1 and Group probers. diff --git a/utilities/collectionscanner/charset-detector/src/nsEUCJPProber.h b/utilities/collectionscanner/charset-detector/src/nsEUCJPProber.h --- a/utilities/collectionscanner/charset-detector/src/nsEUCJPProber.h +++ b/utilities/collectionscanner/charset-detector/src/nsEUCJPProber.h @@ -35,8 +35,8 @@ * * ***** END LICENSE BLOCK ***** */ -// for S-JIS encoding, obeserve characteristic: -// 1, kana character (or hankaku?) often have hight frequency of appereance +// for S-JIS encoding, observed characteristic: +// 1, kana character (or hankaku?) often have hight frequency of appearance // 2, kana character often exist in group // 3, certain combination of kana is never used in japanese language @@ -58,7 +58,7 @@ nsProbingState GetState(void) {return mState;}; void Reset(void); float GetConfidence(void); - void SetOpion() {}; + void SetOpion() {} protected: nsCodingStateMachine* mCodingSM; diff --git a/utilities/collectionscanner/charset-detector/src/nsEUCJPProber.cpp b/utilities/collectionscanner/charset-detector/src/nsEUCJPProber.cpp --- a/utilities/collectionscanner/charset-detector/src/nsEUCJPProber.cpp +++ b/utilities/collectionscanner/charset-detector/src/nsEUCJPProber.cpp @@ -35,8 +35,8 @@ * * ***** END LICENSE BLOCK ***** */ -// for japanese encoding, obeserve characteristic: -// 1, kana character (or hankaku?) often have hight frequency of appereance +// for japanese encoding, observe characteristic: +// 1, kana character (or hankaku?) often have hight frequency of appearance // 2, kana character often exist in group // 3, certain combination of kana is never used in japanese language diff --git a/utilities/collectionscanner/charset-detector/src/nsEUCKRProber.h b/utilities/collectionscanner/charset-detector/src/nsEUCKRProber.h --- a/utilities/collectionscanner/charset-detector/src/nsEUCKRProber.h +++ b/utilities/collectionscanner/charset-detector/src/nsEUCKRProber.h @@ -52,7 +52,7 @@ nsProbingState GetState(void) {return mState;}; void Reset(void); float GetConfidence(void); - void SetOpion() {}; + void SetOpion() {} protected: void GetDistribution(PRUint32 aCharLen, const char* aStr); diff --git a/utilities/collectionscanner/charset-detector/src/nsEUCTWProber.h b/utilities/collectionscanner/charset-detector/src/nsEUCTWProber.h --- a/utilities/collectionscanner/charset-detector/src/nsEUCTWProber.h +++ b/utilities/collectionscanner/charset-detector/src/nsEUCTWProber.h @@ -52,7 +52,7 @@ nsProbingState GetState(void) {return mState;}; void Reset(void); float GetConfidence(void); - void SetOpion() {}; + void SetOpion() {} protected: void GetDistribution(PRUint32 aCharLen, const char* aStr); diff --git a/utilities/collectionscanner/charset-detector/src/nsEscCharsetProber.h b/utilities/collectionscanner/charset-detector/src/nsEscCharsetProber.h --- a/utilities/collectionscanner/charset-detector/src/nsEscCharsetProber.h +++ b/utilities/collectionscanner/charset-detector/src/nsEscCharsetProber.h @@ -52,7 +52,7 @@ nsProbingState GetState(void) {return mState;}; void Reset(void); float GetConfidence(void){return (float)0.99;}; - void SetOpion() {}; + void SetOpion() {} protected: void GetDistribution(PRUint32 aCharLen, const char* aStr); diff --git a/utilities/collectionscanner/charset-detector/src/nsGB2312Prober.h b/utilities/collectionscanner/charset-detector/src/nsGB2312Prober.h --- a/utilities/collectionscanner/charset-detector/src/nsGB2312Prober.h +++ b/utilities/collectionscanner/charset-detector/src/nsGB2312Prober.h @@ -54,7 +54,7 @@ nsProbingState GetState(void) {return mState;}; void Reset(void); float GetConfidence(void); - void SetOpion() {}; + void SetOpion() {} protected: void GetDistribution(PRUint32 aCharLen, const char* aStr); diff --git a/utilities/collectionscanner/charset-detector/src/nsGB2312Prober.cpp b/utilities/collectionscanner/charset-detector/src/nsGB2312Prober.cpp --- a/utilities/collectionscanner/charset-detector/src/nsGB2312Prober.cpp +++ b/utilities/collectionscanner/charset-detector/src/nsGB2312Prober.cpp @@ -35,8 +35,8 @@ * * ***** END LICENSE BLOCK ***** */ -// for S-JIS encoding, obeserve characteristic: -// 1, kana character (or hankaku?) often have hight frequency of appereance +// for S-JIS encoding, observed characteristic: +// 1, kana character (or hankaku?) often have hight frequency of appearance // 2, kana character often exist in group // 3, certain combination of kana is never used in japanese language diff --git a/utilities/collectionscanner/charset-detector/src/nsHebrewProber.h b/utilities/collectionscanner/charset-detector/src/nsHebrewProber.h --- a/utilities/collectionscanner/charset-detector/src/nsHebrewProber.h +++ b/utilities/collectionscanner/charset-detector/src/nsHebrewProber.h @@ -55,7 +55,7 @@ virtual nsProbingState GetState(void); virtual float GetConfidence(void) { return (float)0.0; } - virtual void SetOpion() {}; + virtual void SetOpion() {} void SetModelProbers(nsCharSetProber *logicalPrb, nsCharSetProber *visualPrb) { mLogicalProb = logicalPrb; mVisualProb = visualPrb; } diff --git a/utilities/collectionscanner/charset-detector/src/nsLatin1Prober.h b/utilities/collectionscanner/charset-detector/src/nsLatin1Prober.h --- a/utilities/collectionscanner/charset-detector/src/nsLatin1Prober.h +++ b/utilities/collectionscanner/charset-detector/src/nsLatin1Prober.h @@ -46,13 +46,13 @@ class nsLatin1Prober: public nsCharSetProber { public: nsLatin1Prober(void){Reset();}; - virtual ~nsLatin1Prober(void){}; + virtual ~nsLatin1Prober(void){} nsProbingState HandleData(const char* aBuf, PRUint32 aLen); const char* GetCharSetName() {return "windows-1252";}; nsProbingState GetState(void) {return mState;}; void Reset(void); float GetConfidence(void); - void SetOpion() {}; + void SetOpion() {} #ifdef DEBUG_chardet virtual void DumpStatus(); diff --git a/utilities/collectionscanner/charset-detector/src/nsMBCSGroupProber.h b/utilities/collectionscanner/charset-detector/src/nsMBCSGroupProber.h --- a/utilities/collectionscanner/charset-detector/src/nsMBCSGroupProber.h +++ b/utilities/collectionscanner/charset-detector/src/nsMBCSGroupProber.h @@ -57,7 +57,7 @@ nsProbingState GetState(void) {return mState;}; void Reset(void); float GetConfidence(void); - void SetOpion() {}; + void SetOpion() {} #ifdef DEBUG_chardet void DumpStatus(); diff --git a/utilities/collectionscanner/charset-detector/src/nsMBCSSM.cpp b/utilities/collectionscanner/charset-detector/src/nsMBCSSM.cpp --- a/utilities/collectionscanner/charset-detector/src/nsMBCSSM.cpp +++ b/utilities/collectionscanner/charset-detector/src/nsMBCSSM.cpp @@ -366,7 +366,7 @@ // To be accurate, the length of class 6 can be either 2 or 4. // But it is not necessary to discriminate between the two since -// it is used for frequency analysis only, and we are validing +// it is used for frequency analysis only, and we are validating // each code range there as well. So it is safe to set it to be // 2 here. static const PRUint32 GB18030CharLenTable[] = {0, 1, 1, 1, 1, 1, 2}; diff --git a/utilities/collectionscanner/charset-detector/src/nsSBCSGroupProber.h b/utilities/collectionscanner/charset-detector/src/nsSBCSGroupProber.h --- a/utilities/collectionscanner/charset-detector/src/nsSBCSGroupProber.h +++ b/utilities/collectionscanner/charset-detector/src/nsSBCSGroupProber.h @@ -52,7 +52,7 @@ nsProbingState GetState(void) {return mState;}; void Reset(void); float GetConfidence(void); - void SetOpion() {}; + void SetOpion() {} #ifdef DEBUG_chardet void DumpStatus(); diff --git a/utilities/collectionscanner/charset-detector/src/nsSBCharSetProber.h b/utilities/collectionscanner/charset-detector/src/nsSBCharSetProber.h --- a/utilities/collectionscanner/charset-detector/src/nsSBCharSetProber.h +++ b/utilities/collectionscanner/charset-detector/src/nsSBCharSetProber.h @@ -71,7 +71,7 @@ virtual nsProbingState GetState(void) {return mState;}; virtual void Reset(void); virtual float GetConfidence(void); - virtual void SetOpion() {}; + virtual void SetOpion() {} // This feature is not implemented yet. any current language model // contain this parameter as PR_FALSE. No one is looking at this diff --git a/utilities/collectionscanner/charset-detector/src/nsSJISProber.h b/utilities/collectionscanner/charset-detector/src/nsSJISProber.h --- a/utilities/collectionscanner/charset-detector/src/nsSJISProber.h +++ b/utilities/collectionscanner/charset-detector/src/nsSJISProber.h @@ -35,8 +35,8 @@ * * ***** END LICENSE BLOCK ***** */ -// for S-JIS encoding, obeserve characteristic: -// 1, kana character (or hankaku?) often have hight frequency of appereance +// for S-JIS encoding, observed characteristic: +// 1, kana character (or hankaku?) often have hight frequency of appearance // 2, kana character often exist in group // 3, certain combination of kana is never used in japanese language @@ -59,7 +59,7 @@ nsProbingState GetState(void) {return mState;}; void Reset(void); float GetConfidence(void); - void SetOpion() {}; + void SetOpion() {} protected: nsCodingStateMachine* mCodingSM; diff --git a/utilities/collectionscanner/charset-detector/src/nsSJISProber.cpp b/utilities/collectionscanner/charset-detector/src/nsSJISProber.cpp --- a/utilities/collectionscanner/charset-detector/src/nsSJISProber.cpp +++ b/utilities/collectionscanner/charset-detector/src/nsSJISProber.cpp @@ -35,8 +35,8 @@ * * ***** END LICENSE BLOCK ***** */ -// for S-JIS encoding, obeserve characteristic: -// 1, kana character (or hankaku?) often have hight frequency of appereance +// for S-JIS encoding, observed characteristic: +// 1, kana character (or hankaku?) often have hight frequency of appearance // 2, kana character often exist in group // 3, certain combination of kana is never used in japanese language diff --git a/utilities/collectionscanner/charset-detector/src/nsUTF8Prober.h b/utilities/collectionscanner/charset-detector/src/nsUTF8Prober.h --- a/utilities/collectionscanner/charset-detector/src/nsUTF8Prober.h +++ b/utilities/collectionscanner/charset-detector/src/nsUTF8Prober.h @@ -45,14 +45,14 @@ public: nsUTF8Prober(){mNumOfMBChar = 0; mCodingSM = new nsCodingStateMachine(&UTF8SMModel); - Reset(); }; + Reset(); } virtual ~nsUTF8Prober(){delete mCodingSM;}; nsProbingState HandleData(const char* aBuf, PRUint32 aLen); const char* GetCharSetName() {return "UTF-8";}; nsProbingState GetState(void) {return mState;}; void Reset(void); float GetConfidence(void); - void SetOpion() {}; + void SetOpion() {} protected: nsCodingStateMachine* mCodingSM; diff --git a/utilities/collectionscanner/charset-detector/src/nsUniversalDetector.cpp b/utilities/collectionscanner/charset-detector/src/nsUniversalDetector.cpp --- a/utilities/collectionscanner/charset-detector/src/nsUniversalDetector.cpp +++ b/utilities/collectionscanner/charset-detector/src/nsUniversalDetector.cpp @@ -156,7 +156,7 @@ PRUint32 i; for (i = 0; i < aLen; i++) { - //other than 0xa0, if every othe character is ascii, the page is ascii + //other than 0xa0, if every other character is ascii, the page is ascii if (aBuf[i] & '\x80' && aBuf[i] != '\xA0') //Since many Ascii only page contains NBSP { //we got a non-ascii byte (high-byte) diff --git a/utilities/updatesigner/CMakeLists.txt b/utilities/updatesigner/CMakeLists.txt --- a/utilities/updatesigner/CMakeLists.txt +++ b/utilities/updatesigner/CMakeLists.txt @@ -22,7 +22,7 @@ if(APPLE) set_target_properties(amarok-update-signer PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") # install to app bundle on os x, otherwise amarok fails to load it - install(TARGETS amarok-update-signer DESTINATION ${BUNDLE_INSTALL_DIR}/Amarok.app/Contents/MacOS ) + install(TARGETS amarok-update-signer DESTINATION ${KDE_INSTALL_BUNDLEDIR}/Amarok.app/Contents/MacOS ) else() install(TARGETS amarok-update-signer RUNTIME DESTINATION ${KDE_INSTALL_BINDIR} ) endif() diff --git a/utilities/updatesigner/signer.cpp b/utilities/updatesigner/signer.cpp --- a/utilities/updatesigner/signer.cpp +++ b/utilities/updatesigner/signer.cpp @@ -122,7 +122,7 @@ file.close(); QFile versionFile( versionFilename ); if ( !versionFile.open( QIODevice::ReadOnly ) ) { - std::cout << "faild to open version file for reading!\n"; + std::cout << "failed to open version file for reading!\n"; continue; } QCA::Hash versionHash( "sha1" ); @@ -176,7 +176,7 @@ file.close(); QFile versionFile( versionFilename ); if ( !versionFile.open( QIODevice::ReadOnly ) ) { - std::cout << "Faild to open version file for reading!\n"; + std::cout << "Failed to open version file for reading!\n"; continue; } QCA::Hash versionHash( "sha1" );