diff --git a/AUTHORS b/AUTHORS index d1c401b0a..ef76e79b5 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,9 +1,5 @@ Craig Drummond ---------- Ubuntu Version --------- - -Niklas Wenzel - ---------- QtMPC Authors ---------- Sander Knopper Roeland Douma diff --git a/CMakeLists.txt b/CMakeLists.txt index 5cb1bcef2..0a8520bca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,8 +24,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README") set(CPACK_GENERATOR "DEB;RPM;TBZ2") -set(DEBIAN_PACKAGE_DESCRIPTION "Qt/KDE Client for MPD") -set(DEBIAN_PACKAGE_SECTION "kde4") +set(DEBIAN_PACKAGE_DESCRIPTION "Qt Client for MPD") set(CPACK_SOURCE_GENERATOR "TBZ2") set(CPACK_PACKAGE_VERSION_MAJOR "2") set(CPACK_PACKAGE_VERSION_MINOR "0") @@ -49,10 +48,7 @@ if (WIN32 OR APPLE) else (WIN32 OR APPLE) option(ENABLE_LIBVLC "Use libVLC for MPD HTTP stream playback (if ENABLE_HTTP_STREAM_PLAYBACK=ON)" ON) endif (WIN32 OR APPLE) -option(ENABLE_KDE "Enable KDE libraries" OFF) option(ENABLE_QT5 "Build against Qt5" ON) -option(ENABLE_UBUNTU "Build for the Ubuntu SDK" OFF) -option(ENABLE_UBUNTU_COMMAND_LINE "Build for the Ubuntu SDK from the command line" OFF) option(ENABLE_FFMPEG "Enable ffmpeg/libav libraries (required for replaygain calculation)" ON) option(ENABLE_MPG123 "Enable mpg123 libraries (required for replaygain calculation)" ON) option(ENABLE_PROXY_CONFIG "Enable proxy config in settings dialog" OFF) @@ -109,32 +105,9 @@ if (ENABLE_UBUNTU_COMMAND_LINE) set(ENABLE_UBUNTU ON) endif (ENABLE_UBUNTU_COMMAND_LINE) -if (NOT APPLE AND NOT WIN32 AND NOT ENABLE_UBUNTU AND NOT ENABLE_KDE_SUPPORT) +if (NOT APPLE AND NOT WIN32) set(UNITY_MENU_HACK ON) -endif (NOT APPLE AND NOT WIN32 AND NOT ENABLE_UBUNTU AND NOT ENABLE_KDE_SUPPORT) - -if (ENABLE_UBUNTU) - set(ENABLE_QT5 ON) - set(ENABLE_TAGLIB OFF) - set(ENABLE_TAGLIB_EXTRAS OFF) - set(ENABLE_FFMPEG OFF) - set(ENABLE_MPG123 OFF) - set(ENABLE_EXTERNAL_TAGS OFF) - set(ENABLE_HTTP_SERVER OFF) - set(ENABLE_CDPARANOIA OFF) - set(ENABLE_CDDB OFF) - set(ENABLE_MUSICBRAINZ OFF) - set(ENABLE_UDISKS2 OFF) - set(ENABLE_DEVICES_SUPPORT OFF) - set(ENABLE_REMOTE_DEVICES OFF) - set(ENABLE_MTP OFF) - set(ENABLE_UNCACHED_MTP OFF) - set(USE_SYSTEM_MENU_ICON OFF) -endif (ENABLE_UBUNTU) - -if (ENABLE_KDE) - set(ENABLE_QT5 OFF) -endif (ENABLE_KDE) +endif (NOT APPLE AND NOT WIN32) if (NOT WIN32 AND NOT APPLE AND ENABLE_DEVICES_SUPPORT AND ENABLE_UDISKS2) set(WITH_SOLID_UDISKS2 ON) @@ -146,35 +119,18 @@ if (NOT CMAKE_BUILD_TYPE) endif (NOT CMAKE_BUILD_TYPE) if (NOT APPLE AND NOT WIN32) - if (CANTATA_HELPERS_LIB_DIR AND NOT ENABLE_KDE AND CMAKE_SIZEOF_VOID_P EQUAL 8) + if (CANTATA_HELPERS_LIB_DIR AND CMAKE_SIZEOF_VOID_P EQUAL 8) set(LINUX_LIB_DIR ${CANTATA_HELPERS_LIB_DIR}) - else (CANTATA_HELPERS_LIB_DIR AND NOT ENABLE_KDE AND CMAKE_SIZEOF_VOID_P EQUAL 8) + else (CANTATA_HELPERS_LIB_DIR AND CMAKE_SIZEOF_VOID_P EQUAL 8) set(LINUX_LIB_DIR lib) - endif (CANTATA_HELPERS_LIB_DIR AND NOT ENABLE_KDE AND CMAKE_SIZEOF_VOID_P EQUAL 8) + endif (CANTATA_HELPERS_LIB_DIR AND CMAKE_SIZEOF_VOID_P EQUAL 8) endif (NOT APPLE AND NOT WIN32) -if (ENABLE_UBUNTU) - if (ENABLE_UBUNTU_COMMAND_LINE) - set(CMAKE_INSTALL_PREFIX click) - else (ENABLE_UBUNTU_COMMAND_LINE) - set(CMAKE_INSTALL_PREFIX /) - endif (ENABLE_UBUNTU_COMMAND_LINE) -elseif (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) - if (ENABLE_KDE) - find_program(KDE4_KDECONFIG_EXECUTABLE NAMES kde4-config - PATHS ${CMAKE_INSTALL_PREFIX}/bin ${_KDEDIRS} /opt/kde4/bin NO_DEFAULT_PATH) - if (NOT KDE4_KDECONFIG_EXECUTABLE) - find_program(KDE4_KDECONFIG_EXECUTABLE NAMES kde4-config ) - endif (NOT KDE4_KDECONFIG_EXECUTABLE) - if (KDE4_KDECONFIG_EXECUTABLE) - exec_program(${KDE4_KDECONFIG_EXECUTABLE} ARGS --prefix OUTPUT_VARIABLE CMAKE_INSTALL_PREFIX) - message("-- Set install prefix to ${CMAKE_INSTALL_PREFIX}") - endif (KDE4_KDECONFIG_EXECUTABLE) - elseif (NOT APPLE AND NOT WIN32) - set(CMAKE_INSTALL_PREFIX "/usr") - message("-- Set install prefix to ${CMAKE_INSTALL_PREFIX}") - endif (ENABLE_KDE) -endif (ENABLE_UBUNTU) + +if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND NOT APPLE AND NOT WIN32) + set(CMAKE_INSTALL_PREFIX "/usr") + message("-- Set install prefix to ${CMAKE_INSTALL_PREFIX}") +endif (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND NOT APPLE AND NOT WIN32) if (NOT ENABLE_QT5 AND NOT APPLE AND NOT WIN32) find_package(X11) @@ -349,14 +305,6 @@ if (ENABLE_HTTP_STREAM_PLAYBACK) set(CANTATA_MOC_HDRS ${CANTATA_MOC_HDRS} mpd-interface/httpstream.h) endif (ENABLE_HTTP_STREAM_PLAYBACK) -if (ENABLE_KDE) - find_package(KDE4 REQUIRED) - add_definitions(-DENABLE_KDE_SUPPORT) - include_directories(${KDE4_INCLUDES}) - add_definitions(${KDE4_DEFINITIONS}) - set(ENABLE_KDE_SUPPORT TRUE) -endif (ENABLE_KDE) - find_package(ZLIB REQUIRED) if (APPLE) @@ -401,19 +349,15 @@ endif (QJSON_FOUND) # QJSon and MusicBrainz require exceptions to be enabled! if (MUSICBRAINZ5_FOUND OR NOT ENABLE_QT5) message("-- Enabling exceptions") - if (ENABLE_KDE) - add_definitions(${KDE4_ENABLE_EXCEPTIONS}) - else (ENABLE_KDE) - if (CMAKE_COMPILER_IS_GNUCXX) - add_definitions("-fexceptions -UQT_NO_EXCEPTIONS") - endif (CMAKE_COMPILER_IS_GNUCXX) - if (CMAKE_C_COMPILER MATCHES "icc") - add_definitions(-fexceptions) - endif (CMAKE_C_COMPILER MATCHES "icc") - if (MSVC) - add_definitions(-EHsc) - endif (MSVC) - endif (ENABLE_KDE) + if (CMAKE_COMPILER_IS_GNUCXX) + add_definitions("-fexceptions -UQT_NO_EXCEPTIONS") + endif (CMAKE_COMPILER_IS_GNUCXX) + if (CMAKE_C_COMPILER MATCHES "icc") + add_definitions(-fexceptions) + endif (CMAKE_C_COMPILER MATCHES "icc") + if (MSVC) + add_definitions(-EHsc) + endif (MSVC) endif (MUSICBRAINZ5_FOUND OR NOT ENABLE_QT5) include_directories(${CMAKE_SOURCE_DIR}/3rdparty ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${QTINCLUDES} ${ZLIB_INCLUDE_DIRS}) @@ -526,19 +470,17 @@ if (ENABLE_HTTP_SERVER) set(CANTATA_MOC_HDRS ${CANTATA_MOC_HDRS} http/httpserver.h http/httpsocket.h) endif (ENABLE_HTTP_SERVER) -if (ENABLE_MODEL_TEST AND NOT ENABLE_KDE AND NOT ENABLE_QT5) +if (ENABLE_MODEL_TEST AND NOT ENABLE_QT5) set(QTLIBS ${QTLIBS} ${QT_QTTEST_LIBRARY}) set(CANTATA_SRCS ${CANTATA_SRCS} models/modeltest.cpp) set(CANTATA_MOC_HDRS ${CANTATA_MOC_HDRS} models/modeltest.h) set(CMAKE_BUILD_TYPE "Debug") -endif (ENABLE_MODEL_TEST AND NOT ENABLE_KDE AND NOT ENABLE_QT5) +endif (ENABLE_MODEL_TEST AND NOT ENABLE_QT5) if (QT_QTDBUS_FOUND) - if (NOT ENABLE_KDE) - set(CANTATA_SRCS ${CANTATA_SRCS} dbus/gnomemediakeys.cpp) - set(CANTATA_MOC_HDRS ${CANTATA_MOC_HDRS} dbus/gnomemediakeys.h) - set_SOURCE_FILES_PROPERTIES(dbus/org.gnome.SettingsDaemon.xml dbus/org.gnome.SettingsDaemon.MediaKeys.xml PROPERTIES NO_NAMESPACE TRUE) - endif (NOT ENABLE_KDE) + set(CANTATA_SRCS ${CANTATA_SRCS} dbus/gnomemediakeys.cpp) + set(CANTATA_MOC_HDRS ${CANTATA_MOC_HDRS} dbus/gnomemediakeys.h) + set_SOURCE_FILES_PROPERTIES(dbus/org.gnome.SettingsDaemon.xml dbus/org.gnome.SettingsDaemon.MediaKeys.xml PROPERTIES NO_NAMESPACE TRUE) set(CANTATA_SRCS ${CANTATA_SRCS} dbus/mpris.cpp dbus/powermanagement.cpp) set(CANTATA_MOC_HDRS ${CANTATA_MOC_HDRS} dbus/mpris.h dbus/powermanagement.h) set(CANTATA_SRCS ${CANTATA_SRCS} dbus/notify.cpp) @@ -566,12 +508,10 @@ if (QT_QTDBUS_FOUND) qt4_add_dbus_adaptor(CANTATA_SRCS dbus/org.mpris.MediaPlayer2.root.xml dbus/mpris.h Mpris) qt4_add_dbus_adaptor(CANTATA_SRCS dbus/${PROJECT_REV_URL}.xml gui/mainwindow.h MainWindow) - if (NOT ENABLE_KDE) - qt4_add_dbus_interfaces(CANTATA_SRCS dbus/org.freedesktop.UPower.xml) - qt4_add_dbus_interfaces(CANTATA_SRCS dbus/org.freedesktop.login1.xml) - qt4_add_dbus_interfaces(CANTATA_SRCS dbus/org.gnome.SettingsDaemon.xml) - qt4_add_dbus_interfaces(CANTATA_SRCS dbus/org.gnome.SettingsDaemon.MediaKeys.xml) - endif (NOT ENABLE_KDE) + qt4_add_dbus_interfaces(CANTATA_SRCS dbus/org.freedesktop.UPower.xml) + qt4_add_dbus_interfaces(CANTATA_SRCS dbus/org.freedesktop.login1.xml) + qt4_add_dbus_interfaces(CANTATA_SRCS dbus/org.gnome.SettingsDaemon.xml) + qt4_add_dbus_interfaces(CANTATA_SRCS dbus/org.gnome.SettingsDaemon.MediaKeys.xml) qt4_add_dbus_interfaces(CANTATA_SRCS dbus/org.kde.Solid.PowerManagement.PolicyAgent.xml) qt4_add_dbus_interfaces(CANTATA_SRCS dbus/org.freedesktop.PowerManagement.Inhibit.xml) endif (ENABLE_QT5) @@ -603,9 +543,9 @@ if (TAGLIB_FOUND) set(CANTATA_LIBS ${CANTATA_LIBS} ${TAGLIB-EXTRAS_LIBRARIES}) include_directories(${TAGLIB-EXTRAS_INCLUDES}) endif (NOT ENABLE_EXTERNAL_TAGS AND TAGLIB-EXTRAS_FOUND) - if (NOT ENABLE_KDE AND ENABLE_DEVICES_SUPPORT) + if (ENABLE_DEVICES_SUPPORT) set(CANTATA_LIBS ${CANTATA_LIBS} solidlite) - endif (NOT ENABLE_KDE AND ENABLE_DEVICES_SUPPORT) + endif (ENABLE_DEVICES_SUPPORT) if (ENABLE_DEVICES_SUPPORT AND ENABLE_REMOTE_DEVICES AND NOT WIN32 AND NOT APPLE) set(CANTATA_LIBS ${CANTATA_LIBS} avahi) endif (ENABLE_DEVICES_SUPPORT AND ENABLE_REMOTE_DEVICES AND NOT WIN32 AND NOT APPLE) @@ -625,9 +565,7 @@ if (TAGLIB_FOUND) endif (ENABLE_EXTERNAL_TAGS) if (ENABLE_DEVICES_SUPPORT) - if (NOT ENABLE_KDE) - add_subdirectory(3rdparty/solid-lite) - endif (NOT ENABLE_KDE) + add_subdirectory(3rdparty/solid-lite) if (MTP_FOUND) set(CANTATA_SRCS ${CANTATA_SRCS} devices/mtpdevice.cpp) set(CANTATA_MOC_HDRS ${CANTATA_MOC_HDRS} devices/mtpdevice.h) @@ -655,9 +593,6 @@ if (TAGLIB_FOUND) # If CDDB/MusicBrainz5 found - then CDParanoia must have been! set(CANTATA_LIBS ${CANTATA_LIBS} ${CDPARANOIA_LIBRARIES}) include_directories(${CDPARANOIA_INCLUDE_DIR}) - if (ENABLE_KDE) - install(FILES cantata-play-audiocd.desktop DESTINATION ${DATA_INSTALL_DIR}/solid/actions) - endif (ENABLE_KDE) endif (CDDB_FOUND OR MUSICBRAINZ5_FOUND) set(CANTATA_SRCS ${CANTATA_SRCS} devices/devicespage.cpp devices/filejob.cpp @@ -702,119 +637,101 @@ if (ENABLE_PROXY_CONFIG) set(CANTATA_UIS ${CANTATA_UIS} network/proxysettings.ui) endif (ENABLE_PROXY_CONFIG) -if (ENABLE_KDE) - qt4_add_resources(CANTATA_RC_SRCS ${CANTATA_RCS}) - kde4_add_ui_files(CANTATA_UI_HDRS ${CANTATA_UIS}) - set(CANTATA_SRCS ${CANTATA_SRCS} gui/plurals_kde.cpp gui/application_kde.cpp) - kde4_add_executable(cantata ${CANTATA_SRCS} ${CANTATA_MOC_SRCS} ${CANTATA_RC_SRCS} ${CANTATA_UI_HDRS}) - target_link_libraries(cantata ${KDE4_KDECORE_LIBS} ${KDE4_KDEUI_LIBS} ${KDE4_SOLID_LIBS} ${KDE4_KIO_LIBRARY}) - if (NOT WIN32 AND NOT APPLE AND TAGLIB_FOUND AND ENABLE_REMOTE_DEVICES) - target_link_libraries(cantata ${KDE4_KFILE_LIBS}) - endif (NOT WIN32 AND NOT APPLE AND TAGLIB_FOUND AND ENABLE_REMOTE_DEVICES) - install(TARGETS cantata ${INSTALL_TARGETS_DEFAULT_ARGS}) -elseif (ENABLE_UBUNTU) - set(CANTATA_RCS ubuntu/ubuntu.qrc) +set(CANTATA_SRCS ${CANTATA_SRCS} gui/plurals_qt.cpp) +if (WIN32 OR APPLE) + set(CANTATA_MOC_HDRS ${CANTATA_MOC_HDRS} gui/singleapplication.h) + set(CANTATA_SRCS ${CANTATA_SRCS} gui/singleapplication.cpp) +endif (WIN32 OR APPLE) +if (WIN32) + set(CANTATA_SRCS ${CANTATA_SRCS} gui/application_win.cpp) +elseif (APPLE) + set(CANTATA_SRCS ${CANTATA_SRCS} gui/application_mac.cpp) +else (WIN32) + set(CANTATA_SRCS ${CANTATA_SRCS} gui/application_qt.cpp) +endif (WIN32) +if (WIN32) + add_definitions(-DWIN32) + add_subdirectory(windows) + if (NOT CANTATA_WINDOWS_INSTALLER_DEST) + set(CANTATA_WINDOWS_INSTALLER_DEST z:\ ) + endif (NOT CANTATA_WINDOWS_INSTALLER_DEST) + if (MINGW) + # resource compilation for MinGW + ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/cantataico.o + COMMAND windres.exe -I${CMAKE_CURRENT_SOURCE_DIR} -i${CMAKE_SOURCE_DIR}/windows/cantataico.rc + -o ${CMAKE_CURRENT_BINARY_DIR}/cantataico.o) + set(CANTATA_SRCS ${CANTATA_SRCS} ${CMAKE_CURRENT_BINARY_DIR}/cantataico.o) + else (MINGW) + set(CANTATA_SRCS ${CANTATA_SRCS} windows/cantataico.rc) + endif (MINGW) +elseif (APPLE) + add_definitions(-D__APPLE__) +endif (WIN32) + +set(CANTATA_SRCS ${CANTATA_SRCS} gui/shortcutssettingspage.cpp gui/mediakeys.cpp) +set(CANTATA_MOC_HDRS ${CANTATA_MOC_HDRS} gui/multimediakeysinterface.h) + +if (ENABLE_QT5) QT5_ADD_RESOURCES(CANTATA_RC_SRCS ${CANTATA_RCS}) - qt5_wrap_cpp(UBUNTU_MOC_SRCS ${UBUNTU_MOC_HDRS}) - add_executable(cantata ${CMAKE_CURRENT_SOURCE_DIR}/ubuntu ${UBUNTU_SRCS} ${UBUNTU_MOC_SRCS} ${CANTATA_RC_SRCS}) - qt5_use_modules(cantata Network Core Qml Quick Gui) -else (ENABLE_KDE) - set(CANTATA_SRCS ${CANTATA_SRCS} gui/plurals_qt.cpp) - if (WIN32 OR APPLE) - set(CANTATA_MOC_HDRS ${CANTATA_MOC_HDRS} gui/singleapplication.h) - set(CANTATA_SRCS ${CANTATA_SRCS} gui/singleapplication.cpp) - endif (WIN32 OR APPLE) - if (WIN32) - set(CANTATA_SRCS ${CANTATA_SRCS} gui/application_win.cpp) - elseif (APPLE) - set(CANTATA_SRCS ${CANTATA_SRCS} gui/application_mac.cpp) - else (WIN32) - set(CANTATA_SRCS ${CANTATA_SRCS} gui/application_qt.cpp) - endif (WIN32) - if (WIN32) - add_definitions(-DWIN32) - add_subdirectory(windows) - if (NOT CANTATA_WINDOWS_INSTALLER_DEST) - set(CANTATA_WINDOWS_INSTALLER_DEST z:\ ) - endif (NOT CANTATA_WINDOWS_INSTALLER_DEST) - if (MINGW) - # resource compilation for MinGW - ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/cantataico.o - COMMAND windres.exe -I${CMAKE_CURRENT_SOURCE_DIR} -i${CMAKE_SOURCE_DIR}/windows/cantataico.rc - -o ${CMAKE_CURRENT_BINARY_DIR}/cantataico.o) - set(CANTATA_SRCS ${CANTATA_SRCS} ${CMAKE_CURRENT_BINARY_DIR}/cantataico.o) - else (MINGW) - set(CANTATA_SRCS ${CANTATA_SRCS} windows/cantataico.rc) - endif (MINGW) - elseif (APPLE) - add_definitions(-D__APPLE__) - endif (WIN32) + QT5_WRAP_UI(CANTATA_UI_HDRS ${CANTATA_UIS}) + QT5_WRAP_CPP(CANTATA_MOC_SRCS ${CANTATA_MOC_HDRS}) +else (ENABLE_QT5) + qt4_add_resources(CANTATA_RC_SRCS ${CANTATA_RCS}) + QT4_WRAP_UI(CANTATA_UI_HDRS ${CANTATA_UIS}) + INCLUDE(${QT_USE_FILE}) + QT4_WRAP_CPP(CANTATA_MOC_SRCS ${CANTATA_MOC_HDRS}) +endif (ENABLE_QT5) - set(CANTATA_SRCS ${CANTATA_SRCS} gui/shortcutssettingspage.cpp gui/mediakeys.cpp) - set(CANTATA_MOC_HDRS ${CANTATA_MOC_HDRS} gui/multimediakeysinterface.h) +if (WIN32 OR (NOT APPLE AND NOT ENABLE_QT5)) + add_definitions(-DQXT_STATIC) + add_subdirectory(3rdparty/qxt) + set(CANTATA_SRCS ${CANTATA_SRCS} gui/qxtmediakeys.cpp) +endif (WIN32 OR (NOT APPLE AND NOT ENABLE_QT5)) - if (ENABLE_QT5) - QT5_ADD_RESOURCES(CANTATA_RC_SRCS ${CANTATA_RCS}) - QT5_WRAP_UI(CANTATA_UI_HDRS ${CANTATA_UIS}) - QT5_WRAP_CPP(CANTATA_MOC_SRCS ${CANTATA_MOC_HDRS}) - else (ENABLE_QT5) - qt4_add_resources(CANTATA_RC_SRCS ${CANTATA_RCS}) - QT4_WRAP_UI(CANTATA_UI_HDRS ${CANTATA_UIS}) - INCLUDE(${QT_USE_FILE}) - QT4_WRAP_CPP(CANTATA_MOC_SRCS ${CANTATA_MOC_HDRS}) - endif (ENABLE_QT5) +if (WIN32) + set(CMAKE_BUILD_TYPE "Release") + ADD_EXECUTABLE(cantata WIN32 ${CANTATA_SRCS} ${CANTATA_MOC_SRCS} ${CANTATA_RC_SRCS} ${CANTATA_UI_HDRS} ${CANTATA_PO}) + install(TARGETS cantata DESTINATION ${CMAKE_INSTALL_PREFIX}) +elseif (APPLE) + ADD_EXECUTABLE(cantata MACOSX_BUNDLE ${CANTATA_SRCS} ${CANTATA_MOC_SRCS} ${CANTATA_RC_SRCS} ${CANTATA_UI_HDRS} ${CANTATA_PO}) + add_subdirectory(mac) + include(DeployQt5) + install(PROGRAMS ${CMAKE_BINARY_DIR}/cantata.app/Contents/MacOS/cantata DESTINATION ${MACOSX_BUNDLE_APP_DIR}) + # Create our own plist file to enable HighDPI support + configure_file(mac/Info.plist.cmake ${CMAKE_CURRENT_BINARY_DIR}/mac/Info.plist) + configure_file(mac/dmg/create-dmg.sh.in ${CMAKE_CURRENT_BINARY_DIR}/mac/create-dmg.sh) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/mac/Info.plist DESTINATION ${CANTATA_APP_CONTENTS_DIR}) + if (TAGLIB_FOUND) + # *NEED* to install cantata-replagain/cantata-tags *before* install_qt5_executable fix'es the bundle + # If we install from their own CMakeLists.txt then they are installed *after* the fix-up, and so link + # to the build libs not the packaged ones! + if (FFMPEG_FOUND OR MPG123_FOUND) + install(PROGRAMS ${CMAKE_BINARY_DIR}/replaygain/cantata-replaygain DESTINATION ${MACOSX_BUNDLE_APP_DIR}) + endif (FFMPEG_FOUND OR MPG123_FOUND) + if (ENABLE_EXTERNAL_TAGS) + install(PROGRAMS ${CMAKE_BINARY_DIR}/tags/cantata-tags DESTINATION ${MACOSX_BUNDLE_APP_DIR}) + endif (ENABLE_EXTERNAL_TAGS) + endif (TAGLIB_FOUND) + if (ENABLE_HTTP_STREAM_PLAYBACK AND NOT ENABLE_LIBVLC) + install_qt5_executable(cantata.app "qjpeg;qsvg;qsvgicon;qcocoa;qsqlite;qavfmediaplayer") + else (ENABLE_HTTP_STREAM_PLAYBACK AND NOT ENABLE_LIBVLC) + install_qt5_executable(cantata.app "qjpeg;qsvg;qsvgicon;qcocoa;qsqlite") + endif (ENABLE_HTTP_STREAM_PLAYBACK AND NOT ENABLE_LIBVLC) +elseif (NOT ENABLE_UBUNTU) + ADD_EXECUTABLE(cantata ${CANTATA_SRCS} ${CANTATA_MOC_SRCS} ${CANTATA_RC_SRCS} ${CANTATA_UI_HDRS}) + install(TARGETS cantata RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) +endif (WIN32) - if (WIN32 OR (NOT APPLE AND NOT ENABLE_QT5)) - add_definitions(-DQXT_STATIC) - add_subdirectory(3rdparty/qxt) - set(CANTATA_SRCS ${CANTATA_SRCS} gui/qxtmediakeys.cpp) - endif (WIN32 OR (NOT APPLE AND NOT ENABLE_QT5)) - - if (WIN32) - set(CMAKE_BUILD_TYPE "Release") - ADD_EXECUTABLE(cantata WIN32 ${CANTATA_SRCS} ${CANTATA_MOC_SRCS} ${CANTATA_RC_SRCS} ${CANTATA_UI_HDRS} ${CANTATA_PO}) - install(TARGETS cantata DESTINATION ${CMAKE_INSTALL_PREFIX}) - elseif (APPLE) - ADD_EXECUTABLE(cantata MACOSX_BUNDLE ${CANTATA_SRCS} ${CANTATA_MOC_SRCS} ${CANTATA_RC_SRCS} ${CANTATA_UI_HDRS} ${CANTATA_PO}) - add_subdirectory(mac) - include(DeployQt5) - install(PROGRAMS ${CMAKE_BINARY_DIR}/cantata.app/Contents/MacOS/cantata DESTINATION ${MACOSX_BUNDLE_APP_DIR}) - # Create our own plist file to enable HighDPI support - configure_file(mac/Info.plist.cmake ${CMAKE_CURRENT_BINARY_DIR}/mac/Info.plist) - configure_file(mac/dmg/create-dmg.sh.in ${CMAKE_CURRENT_BINARY_DIR}/mac/create-dmg.sh) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/mac/Info.plist DESTINATION ${CANTATA_APP_CONTENTS_DIR}) - if (TAGLIB_FOUND) - # *NEED* to install cantata-replagain/cantata-tags *before* install_qt5_executable fix'es the bundle - # If we install from their own CMakeLists.txt then they are installed *after* the fix-up, and so link - # to the build libs not the packaged ones! - if (FFMPEG_FOUND OR MPG123_FOUND) - install(PROGRAMS ${CMAKE_BINARY_DIR}/replaygain/cantata-replaygain DESTINATION ${MACOSX_BUNDLE_APP_DIR}) - endif (FFMPEG_FOUND OR MPG123_FOUND) - if (ENABLE_EXTERNAL_TAGS) - install(PROGRAMS ${CMAKE_BINARY_DIR}/tags/cantata-tags DESTINATION ${MACOSX_BUNDLE_APP_DIR}) - endif (ENABLE_EXTERNAL_TAGS) - endif (TAGLIB_FOUND) - if (ENABLE_HTTP_STREAM_PLAYBACK AND NOT ENABLE_LIBVLC) - install_qt5_executable(cantata.app "qjpeg;qsvg;qsvgicon;qcocoa;qsqlite;qavfmediaplayer") - else (ENABLE_HTTP_STREAM_PLAYBACK AND NOT ENABLE_LIBVLC) - install_qt5_executable(cantata.app "qjpeg;qsvg;qsvgicon;qcocoa;qsqlite") - endif (ENABLE_HTTP_STREAM_PLAYBACK AND NOT ENABLE_LIBVLC) - elseif (NOT ENABLE_UBUNTU) - ADD_EXECUTABLE(cantata ${CANTATA_SRCS} ${CANTATA_MOC_SRCS} ${CANTATA_RC_SRCS} ${CANTATA_UI_HDRS}) - install(TARGETS cantata RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) - endif (WIN32) - - if (NOT ENABLE_UBUNTU) - set(XDG_APPS_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/applications") - endif (NOT ENABLE_UBUNTU) - if (WIN32 OR APPLE) - add_subdirectory(3rdparty/qtsingleapplication) - target_link_libraries(cantata qtsingleapplication) - endif (WIN32 OR APPLE) - if (WIN32 OR (NOT APPLE AND NOT ENABLE_QT5)) - target_link_libraries(cantata qxt) - endif (WIN32 OR (NOT APPLE AND NOT ENABLE_QT5)) -endif (ENABLE_KDE) +if (NOT ENABLE_UBUNTU) + set(XDG_APPS_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/applications") +endif (NOT ENABLE_UBUNTU) +if (WIN32 OR APPLE) + add_subdirectory(3rdparty/qtsingleapplication) + target_link_libraries(cantata qtsingleapplication) +endif (WIN32 OR APPLE) +if (WIN32 OR (NOT APPLE AND NOT ENABLE_QT5)) + target_link_libraries(cantata qxt) +endif (WIN32 OR (NOT APPLE AND NOT ENABLE_QT5)) if (WIN32) install(FILES tags/tag_fixes.xml context/lyrics_providers.xml context/weblinks.xml online/podcast_directories.xml scrobbling/scrobblers.xml @@ -822,16 +739,13 @@ if (WIN32) elseif (APPLE) install(FILES tags/tag_fixes.xml context/lyrics_providers.xml context/weblinks.xml online/podcast_directories.xml scrobbling/scrobblers.xml DESTINATION ${MACOSX_BUNDLE_RESOURCES}/config/) -elseif (NOT ENABLE_UBUNTU) +elseif () install(FILES tags/tag_fixes.xml context/lyrics_providers.xml context/weblinks.xml online/podcast_directories.xml scrobbling/scrobblers.xml DESTINATION ${SHARE_INSTALL_PREFIX}/${CMAKE_PROJECT_NAME}/config/) install(FILES mpd-interface/mpd.conf.template DESTINATION ${SHARE_INSTALL_PREFIX}/${CMAKE_PROJECT_NAME}/mpd) endif (WIN32) -if (NOT ENABLE_UBUNTU) - add_subdirectory(po) -endif (NOT ENABLE_UBUNTU) - +add_subdirectory(po) add_subdirectory(support) add_subdirectory(3rdparty/qtiocompressor) add_subdirectory(streams/icons) @@ -853,83 +767,51 @@ endif (UNIX AND NOT APPLE) configure_file(config.h.cmake ${CMAKE_BINARY_DIR}/config.h) -if (NOT WIN32 AND NOT APPLE AND NOT ENABLE_UBUNTU AND NOT ENABLE_KDE) +if (NOT WIN32 AND NOT APPLE) # uninstall target configure_file("${CMAKE_SOURCE_DIR}/cmake_uninstall.cmake.in" "${CMAKE_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY) configure_file(install_dirs.cmake ${CMAKE_BINARY_DIR}/install_dirs) add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}/cmake_uninstall.cmake) -endif (NOT WIN32 AND NOT APPLE AND NOT ENABLE_UBUNTU AND NOT ENABLE_KDE) +endif (NOT WIN32 AND NOT APPLE) -if (ENABLE_KDE) - message("-- Building KDE version") -elseif (ENABLE_UBUNTU) - message("-- Building Ubuntu version") -elseif (ENABLE_QT5) +if (ENABLE_QT5) message("-- Building Qt5 version") -else (ENABLE_KDE) +else (ENABLE_QT5) message("-- Building Qt4 version") -endif (ENABLE_KDE) +endif (ENABLE_QT5) macro_display_feature_log() -if (ENABLE_UBUNTU) - set(UBUNTU_PROJECT_TYPE "ClickApp" CACHE INTERNAL "Tells QtCreator this is a Click application project") - add_custom_target(components_QmlFiles ALL SOURCES - ubuntu/qml/cantata/main.qml ubuntu/qml/cantata/AboutPage.qml ubuntu/qml/cantata/ListViewPage.qml - ubuntu/qml/cantata/SubListViewPage.qml ubuntu/qml/cantata/CurrentlyPlayingPage.qml - ubuntu/qml/cantata/settings/SettingsPage.qml ubuntu/qml/cantata/settings/SettingsCategories.qml - ubuntu/qml/cantata/settings/HostSettingsContent.qml ubuntu/qml/cantata/settings/HostSettingsPage.qml - ubuntu/qml/cantata/settings/UiSettingsContent.qml ubuntu/qml/cantata/settings/UiSettingsPage.qml - ubuntu/qml/cantata/settings/PlaybackSettingsContent.qml ubuntu/qml/cantata/settings/PlaybackSettingsPage.qml - ubuntu/qml/cantata/components/ControlButtonsRow.qml ubuntu/qml/cantata/components/ListItemDelegate.qml - ubuntu/qml/cantata/components/PlayQueueListItemDelegate.qml ubuntu/qml/cantata/components/LabelVisual.qml - ubuntu/qml/cantata/components/Notification.qml ubuntu/qml/cantata/backend/SettingsBackend.qml - ubuntu/qml/cantata/components/PageWithBottomEdge.qml ubuntu/qml/cantata/CurrentlyPlayingContent.qml - ) - add_custom_target(click_files ALL SOURCES - ubuntu/manifest.json - ubuntu/cantata-ubuntu.json - ubuntu/cantata-ubuntu.desktop - ) - add_custom_target(images ALL SOURCES #TODO: Add other icons - ubuntu/icons/desktop/cantata.png - ) +if ((NOT ENABLE_DEVICES_SUPPORT AND NOT WIN32 AND NOT APPLE) OR (NOT ENABLE_HTTP_STREAM_PLAYBACK)) + message("-----------------------------------------------------------------------------") + message("-- The following STANDARD options have been DISABLED.") + message("-----------------------------------------------------------------------------") + if (NOT ENABLE_DEVICES_SUPPORT) + message(" * Devices Tab - Media device support (UMS, MTP, AudioCD).") + endif (NOT ENABLE_DEVICES_SUPPORT) + if (NOT ENABLE_HTTP_STREAM_PLAYBACK) + message(" * MPD HTTP Streams - Playback MPD HTTP output stream via libVLC.") + endif (NOT ENABLE_HTTP_STREAM_PLAYBACK) + message("") +endif ((NOT ENABLE_DEVICES_SUPPORT AND NOT WIN32 AND NOT APPLE) OR (NOT ENABLE_HTTP_STREAM_PLAYBACK)) - install(TARGETS cantata RUNTIME DESTINATION .) - install(FILES ubuntu/manifest.json ubuntu/cantata-ubuntu.json ubuntu/cantata-ubuntu.desktop ubuntu/icons/desktop/cantata.png DESTINATION .) +if ((ENABLE_DEVICES_SUPPORT AND ENABLE_REMOTE_DEVICES) OR (NOT ENABLE_KDE AND ENABLE_PROXY_CONFIG)) + message("-----------------------------------------------------------------------------") + message("-- The following NON STANDARD options have been ENABLED.") + message("-----------------------------------------------------------------------------") + if (ENABLE_PROXY_CONFIG) + message(" * Proxy Configuration") + endif (ENABLE_PROXY_CONFIG) + if (ENABLE_REMOTE_DEVICES) + message(" * Remote Devices - Access sshfs, Samba, and local folders as devices. (EXPERIMENTAL)") + endif (ENABLE_REMOTE_DEVICES) + message("") +endif ((ENABLE_DEVICES_SUPPORT AND ENABLE_REMOTE_DEVICES) OR (ENABLE_PROXY_CONFIG)) -else (ENABLE_UBUNTU) - if ((NOT ENABLE_DEVICES_SUPPORT AND NOT WIN32 AND NOT APPLE) OR (NOT ENABLE_HTTP_STREAM_PLAYBACK)) - message("-----------------------------------------------------------------------------") - message("-- The following STANDARD options have been DISABLED.") - message("-----------------------------------------------------------------------------") - if (NOT ENABLE_DEVICES_SUPPORT) - message(" * Devices Tab - Media device support (UMS, MTP, AudioCD).") - endif (NOT ENABLE_DEVICES_SUPPORT) - if (NOT ENABLE_HTTP_STREAM_PLAYBACK) - message(" * MPD HTTP Streams - Playback MPD HTTP output stream via libVLC.") - endif (NOT ENABLE_HTTP_STREAM_PLAYBACK) - message("") - endif ((NOT ENABLE_DEVICES_SUPPORT AND NOT WIN32 AND NOT APPLE) OR (NOT ENABLE_HTTP_STREAM_PLAYBACK)) - - if ((ENABLE_DEVICES_SUPPORT AND ENABLE_REMOTE_DEVICES) OR (NOT ENABLE_KDE AND ENABLE_PROXY_CONFIG)) - message("-----------------------------------------------------------------------------") - message("-- The following NON STANDARD options have been ENABLED.") - message("-----------------------------------------------------------------------------") - if (ENABLE_PROXY_CONFIG) - message(" * Proxy Configuration") - endif (ENABLE_PROXY_CONFIG) - if (ENABLE_REMOTE_DEVICES) - message(" * Remote Devices - Access sshfs, Samba, and local folders as devices. (EXPERIMENTAL)") - endif (ENABLE_REMOTE_DEVICES) - message("") - endif ((ENABLE_DEVICES_SUPPORT AND ENABLE_REMOTE_DEVICES) OR (NOT ENABLE_KDE AND ENABLE_PROXY_CONFIG)) - - if (ENABLE_MODEL_TEST AND NOT ENABLE_KDE AND NOT ENABLE_QT5) - message("-----------------------------------------------------------------------------") - message("-- ENABLING MODEL TESTS!!! RUN UNDER A DEBUGGER, AND DO NOT USE AS RELEASE!!!") - message("-----------------------------------------------------------------------------") - message("") - endif (ENABLE_MODEL_TEST AND NOT ENABLE_KDE AND NOT ENABLE_QT5) -endif (ENABLE_UBUNTU) +if (ENABLE_MODEL_TEST AND NOT ENABLE_QT5) + message("-----------------------------------------------------------------------------") + message("-- ENABLING MODEL TESTS!!! RUN UNDER A DEBUGGER, AND DO NOT USE AS RELEASE!!!") + message("-----------------------------------------------------------------------------") + message("") +endif (ENABLE_MODEL_TEST AND NOT ENABLE_QT5) diff --git a/ChangeLog b/ChangeLog index f7f369952..61fb5dda7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -64,6 +64,7 @@ 48. Show podcast descriptions in tooltips. 49. Parse name field in playlists. 50. Use 32-bit int for bitrate and samplerate staus values. +51. Remove KDE4 and Ubuntu touch support. 2.0.1 ----- diff --git a/INSTALL b/INSTALL index dbb84677f..698e9acd7 100644 --- a/INSTALL +++ b/INSTALL @@ -17,22 +17,6 @@ Qt5 4. make 5. sudo make install -KDE4 ----- -1. mkdir build -2. cd build -3. cmake .. -DENABLE_KDE=ON -4. make -5. sudo make install - -Ubuntu **NOTE: No longer actively maintained** ------- -1. mkdir build -2. cd build -3. cmake .. -DENABLE_UBUNTU_COMMAND_LINE=ON -4. make -5. make install -6. click build click Mac/Windows ----------- @@ -89,13 +73,6 @@ The following options may be passed to CMake: really works under Windows. Default: Windows:ON, Others:OFF - - Specific to Qt-only builds:: - - -DENABLE_KDE=OFF - Link against KDE libraries, use KDE dialogs, etc. - Default: OFF - -DENABLE_QT5=ON Build against Qt5, not Qt4 Default: ON @@ -128,14 +105,14 @@ The following options may be passed to CMake: Default: OFF -DENABLE_UDISKS2=ON - Build UDisks2 backend for solid-lite. (Non-KDE builds only) + Build UDisks2 backend for solid-lite. Default: ON -DINSTALL_UBUNTU_ICONS= Install monochrome system tray icons for Ubuntu. -DCANTATA_HELPERS_LIB_DIR= - For non-KDE 64 bit builds, this may be used to control the lib sub-dir + For 64 bit builds, this may be used to control the lib sub-dir where Cantata helper apps will be placed. e.g. setting this to lib64 will cause the helper apps (cantata-tags, cantata-replaygain) to be install into /usr/lib64/cantata instead of /usr/lib/cantata @@ -161,17 +138,6 @@ The following options may be passed to CMake: Default: - Ubuntu specific: - - -DENABLE_UBUNTU=ON - Build for Ubuntu Touch. - Default: OFF - - -DENABLE_UBUNTU_COMMAND_LINE=ON - Build for the Ubuntu SDK from the command line. - Default: OFF - - Testing ONLY options: -DENABLE_MODEL_TEST=ON diff --git a/README b/README index 35e3f0787..eed131e2c 100644 --- a/README +++ b/README @@ -26,7 +26,7 @@ Table of Contents Cantata is a graphical client for MPD. It contains the following features: - 1. Support for Qt4, Qt5, KDE, MacOSX, and Windows. + 1. Support for Qt4, Qt5, MacOSX, and Windows. 2. Multiple MPD collections. 3. Highly customisable layout. 4. Songs grouped by album in play queue. @@ -46,19 +46,12 @@ Cantata is a graphical client for MPD. It contains the following features: 14. Playback of non-MPD songs - via simple in-built HTTP server if connected to MPD via a standard socket, otherwise filepath is sent to MPD. 15. MPRISv2 DBUS interface. -16. Support for KDE global shortcuts (KDE builds), GNOME media keys - (Linux only), and standard media keys (via Qxt) -17. Ubuntu/ambiance theme integration - including dragging of window via - toolbar. -18. Basic support for touch-style interface (views are made 'flickable') -19. Scrobbling. -20. Ratings support. +16. Basic support for touch-style interface (views are made 'flickable') +17. Scrobbling. +18. Ratings support. -Cantata started off as a fork of QtMPC, mainly to provide better KDE -integration - by using KDE libraries/classes wherever possible. However, the -code (and user interface) is now *very* different to that of QtMPC, and both -KDE and Qt (Linux) builds have the same feature set. Also, as of 1.4.0, by -default Cantata is built as a Qt-only application (with no KDE dependencies) +Cantata started off as a fork of QtMPC, however, the code (and user interface) +is now *very* different to that of QtMPC. Unlike most other MPD clients, Cantata caches a copy of the MPD music library. This is so that it can create a proper hierarchy of artists and albums (where @@ -85,19 +78,18 @@ Cantata requires the following Qt libraries: Cantata may also use the following optional libraries: - 1. KDElibs4 - 2. TagLib - Tag edit dialog, replaygain, track organizer, and UMS device + 1. TagLib - Tag edit dialog, replaygain, track organizer, and UMS device support. - 3. LibMTP - MTP devices. - 4. FFMPEG (libavcodec) - ReplayGain detection code. - 5. SpeexDSP - ReplayGain detection code. - 6. MPG123 - ReplayGain detection code. - 7. CDParanoia - Read/rip Audio CDs. - 8. CDDB - either this or MusicBrainz5 required for Audio CDs - 9. MusicBrainz5 - either this or CDDB required for Audio CDs -10. LibQJson - only for Qt4, and KDE4, builds. If this is not found on the + 2. LibMTP - MTP devices. + 3. FFMPEG (libavcodec) - ReplayGain detection code. + 4. SpeexDSP - ReplayGain detection code. + 5. MPG123 - ReplayGain detection code. + 6. CDParanoia - Read/rip Audio CDs. + 7. CDDB - either this or MusicBrainz5 required for Audio CDs + 8. MusicBrainz5 - either this or CDDB required for Audio CDs + 9. LibQJson - only for Qt4, builds. If this is not found on the system then Cantata will use its own bundled copy. -11. LibEbur128 - ReplayGain detection code. If this is not found on the +10. LibEbur128 - ReplayGain detection code. If this is not found on the system then Cantata will use its own bundled copy. @@ -124,7 +116,7 @@ such as MPDroid, GMPC, etc. To report bugs please visit https://github.com/CDrummond/cantata When reporting a bug, please mention the Cantata version number, the Cantata -build type (Linux/KDE, Linux/Qt, Windows), any cmake options you specified +build type (Linux, Windows, Mac), any cmake options you specified (other than the defaults listed at the top of the INSTALL file), and the version of MPD you are using. @@ -387,10 +379,8 @@ graphical way to control the setting. For these, you will need to edit Cantata's config by hand - whilst Cantata is NOT running! Under Linux, the Cantata config file will be: - Qt builds: ~/.config/cantata/cantata.conf ( Current User ) - /etc/xdg/cantata.conf ( All Users ) - KDE builds: ~/.kde/share/config/cantatarc ( Current User ) - /etc/kde4/cantatarc ( All Users ) + ~/.config/cantata/cantata.conf ( Current User ) + /etc/xdg/cantata.conf ( All Users ) The following config items should be added to the "[General]" section. @@ -657,9 +647,6 @@ file. 10. MultiMedia Keys =================== -Cantata may be controlled via the media keys on some keyboards. To enable this, -the KDE version can be configured to use KDE's global shortcuts. - Linux Qt4 and Windows builds, as of 1.2, now also support basic media-keys shortcuts. @@ -804,7 +791,7 @@ The Cantata source folder contains the following structure: replaygain - ReplayGain calculation streams - Internet radio streams support - Generic classes that /may/ be useful to other projects. - Mainly used for Qt/KDE and Gtk support. + Mainly used for Qt and Gtk support. tags - Tag reading, editing, etc. ubuntu - Convergent Ubuntu version (requires the Ubuntu SDK); cmake option: -DENABLE_UBUNTU=ON diff --git a/README.md b/README.md index 5e5611090..4ba2f69bd 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Introduction Cantata is a graphical client for MPD, supporting the following features: - 1. Support for Qt4, Qt5, KDE, MacOSX, and Windows. + 1. Support for Qt4, Qt5, MacOSX, and Windows. 2. Multiple MPD collections. 3. Highly customisable layout. 4. Songs grouped by album in play queue. @@ -23,23 +23,16 @@ Cantata is a graphical client for MPD, supporting the following features: 14. Playback of non-MPD songs - via simple in-built HTTP server if connected to MPD via a standard socket, otherwise filepath is sent to MPD. 15. MPRISv2 DBUS interface. - 16. Support for KDE global shortcuts (KDE builds), GNOME media keys - (Linux only), and standard media keys (via Qxt) - 17. Ubuntu/ambiance theme integration - including dragging of window via - toolbar. - 18. Basic support for touch-style interface (views are made 'flickable') - 19. Scrobbling. - 20. Ratings support. - -Cantata started off as a fork of QtMPC, mainly to provide better KDE -integration - by using KDE libraries/classes wherever possible. However, the -code (and user interface) is now *very* different to that of QtMPC, and both -KDE and Qt (Linux) builds have the same feature set. Also, as of 1.4.0, by -default Cantata is built as a Qt-only application (with no KDE dependencies) + 16. Basic support for touch-style interface (views are made 'flickable') + 17. Scrobbling. + 18. Ratings support. +Cantata started off as a fork of QtMPC, however, the code (and user interface) +is now *very* different to that of QtMPC. For more detailed information, please refer to the main [README](https://raw.githubusercontent.com/CDrummond/cantata/master/README) Screenshots + =========== Some (outdated, 1.x) screenshots can be found at the [kde-apps](http://kde-apps.org/content/show.php/Cantata?content=147733) page. diff --git a/cantata-play-audiocd.desktop b/cantata-play-audiocd.desktop deleted file mode 100644 index 9c61450ab..000000000 --- a/cantata-play-audiocd.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -X-KDE-Solid-Predicate=OpticalDisc.availableContent & 'Audio' -Type=Service -Actions=Play; -X-KDE-Priority=TopLevel - -[Desktop Action Play] -Name=Play Audio CD with Cantata -Name[de]=Audio CD mit Cantata abspielen -Name[pl]=Odtwarzaj płytę audio przy użyciu Cantaty -Icon=cantata -Exec=cantata cdda://?dev=%d diff --git a/context/othersettings.cpp b/context/othersettings.cpp index fdf295ee9..f78ea8838 100644 --- a/context/othersettings.cpp +++ b/context/othersettings.cpp @@ -39,11 +39,7 @@ OtherSettings::OtherSettings(QWidget *p) contextBackdrop_artist->setProperty(constValueProperty, PlayQueueView::BI_Cover); contextBackdrop_custom->setProperty(constValueProperty, PlayQueueView::BI_Custom); contextBackdropFile->setDirMode(false); - #ifdef ENABLE_KDE_SUPPORT - contextBackdropFile->setFilter("image/jpeg image/png"); - #else contextBackdropFile->setFilter(i18n("Images (*.png *.jpg)")); - #endif int labelWidth=qMax(fontMetrics().width(QLatin1String("100%")), fontMetrics().width(i18nc("pixels", "10px"))); contextBackdropOpacityLabel->setFixedWidth(labelWidth); contextBackdropBlurLabel->setFixedWidth(labelWidth); diff --git a/db/librarydb.cpp b/db/librarydb.cpp index 6520ab673..794450b94 100644 --- a/db/librarydb.cpp +++ b/db/librarydb.cpp @@ -603,7 +603,6 @@ bool LibraryDb::init(const QString &dbFile) "type integer, " "lastModified integer, " "primary key (file))")) { - #ifndef CANTATA_WEB QSqlQuery fts(*db); if (!fts.exec("create virtual table if not exists songs_fts using fts4(fts_artist, fts_artistId, fts_album, fts_albumId, fts_title, tokenize=unicode61)")) { DBUG << "Failed to create FTS table" << fts.lastError().text() << "trying again with simple tokenizer"; @@ -611,7 +610,6 @@ bool LibraryDb::init(const QString &dbFile) DBUG << "Failed to create FTS table" << fts.lastError().text(); } } - #endif } else { DBUG << "Failed to create songs table"; return false; @@ -903,7 +901,6 @@ int LibraryDb::trackCount() return query.next() ? query.value(0).toInt() : 0; } -#ifndef CANTATA_WEB QList LibraryDb::songs(const QStringList &files, bool allowPlaylists) const { QList songList; @@ -1077,7 +1074,6 @@ bool LibraryDb::setFilter(const QString &f, const QString &genre) genreFilter=genre; return modified; } -#endif void LibraryDb::updateStarted(time_t ver) { @@ -1112,11 +1108,9 @@ void LibraryDb::updateFinished() return; } DBUG << timer.elapsed(); - #ifndef CANTATA_WEB DBUG << "update fts" << timer.elapsed(); QSqlQuery(*db).exec("insert into songs_fts(fts_artist, fts_artistId, fts_album, fts_albumId, fts_title) " "select artist, artistId, album, albumId, title from songs"); - #endif QSqlQuery(*db).exec("update versions set collection ="+QString::number(newVersion)); DBUG << "commit" << timer.elapsed(); db->commit(); @@ -1208,10 +1202,8 @@ void LibraryDb::clearSongs(bool startTransaction) db->transaction(); } QSqlQuery(*db).exec("delete from songs"); - #ifndef CANTATA_WEB QSqlQuery(*db).exec("delete from songs_fts"); detailsCache.clear(); - #endif if (startTransaction) { db->commit(); } diff --git a/db/librarydb.h b/db/librarydb.h index bc72bed7c..4257ff918 100644 --- a/db/librarydb.h +++ b/db/librarydb.h @@ -123,7 +123,6 @@ public: QList getTracks(const QString &artistId, const QString &albumId, const QString &genre=QString(), AlbumSort sort=AS_YrAlAr, bool useFilter=true); QList getTracks(int rowFrom, int count); int trackCount(); - #ifndef CANTATA_WEB QList songs(const QStringList &files, bool allowPlaylists=false) const; QList getAlbumsWithArtist(const QString &artist); Album getRandomAlbum(const QString &genre, const QString &artist); @@ -134,7 +133,6 @@ public: bool setFilter(const QString &f, const QString &genre=QString()); const QString & getFilter() const { return filter; } int getCurrentVersion() const { return currentVersion; } - #endif Q_SIGNALS: void libraryUpdated(); @@ -166,9 +164,7 @@ protected: QElapsedTimer timer; QString filter; QString genreFilter; - #ifndef CANTATA_WEB QMap > detailsCache; - #endif }; #endif diff --git a/db/mpdlibrarydb.cpp b/db/mpdlibrarydb.cpp index 50a273c03..b010218a2 100644 --- a/db/mpdlibrarydb.cpp +++ b/db/mpdlibrarydb.cpp @@ -23,9 +23,7 @@ #include "mpdlibrarydb.h" #include "support/globalstatic.h" -#ifndef CANTATA_WEB #include "support/utils.h" -#endif #include "mpd-interface/mpdconnection.h" #include "gui/settings.h" #include @@ -36,9 +34,6 @@ #define DBUG if (LibraryDb::debugEnabled()) qWarning() << metaObject()->className() << __FUNCTION__ -#ifdef CANTATA_WEB -GLOBAL_STATIC(MpdLibraryDb, instance) -#else static const QLatin1String constDirName("library"); static QString databaseName(const MPDConnectionDetails &details) { @@ -69,8 +64,6 @@ void MpdLibraryDb::removeUnusedDbs() } } -#endif - MpdLibraryDb::MpdLibraryDb(QObject *p) : LibraryDb(p, "MPD") , loading(false) @@ -82,9 +75,7 @@ MpdLibraryDb::MpdLibraryDb(QObject *p) connect(MPDConnection::self(), SIGNAL(updatedLibrary()), this, SLOT(updateFinished())); connect(MPDConnection::self(), SIGNAL(statsUpdated(MPDStatsValues)), this, SLOT(statsUpdated(MPDStatsValues))); connect(this, SIGNAL(loadLibrary()), MPDConnection::self(), SLOT(loadLibrary())); - #ifndef CANTATA_WEB connect(MPDConnection::self(), SIGNAL(connectionChanged(MPDConnectionDetails)), this, SLOT(connectionChanged(MPDConnectionDetails))); - #endif DBUG; } @@ -123,16 +114,12 @@ Song MpdLibraryDb::getCoverSong(const QString &artistId, const QString &albumId) void MpdLibraryDb::connectionChanged(const MPDConnectionDetails &details) { - #ifdef CANTATA_WEB - Q_UNUSED(details) - #else QString dbFile=databaseName(details); if (dbFile!=dbFileName) { init(dbFile); } else { emit libraryUpdated(); } - #endif } void MpdLibraryDb::reset() diff --git a/db/mpdlibrarydb.h b/db/mpdlibrarydb.h index 903d274aa..105f5678b 100644 --- a/db/mpdlibrarydb.h +++ b/db/mpdlibrarydb.h @@ -43,11 +43,7 @@ class MpdLibraryDb : public LibraryDb Q_OBJECT public: - #ifndef CANTATA_WEB static void removeUnusedDbs(); - #else - static MpdLibraryDb * self(); - #endif MpdLibraryDb(QObject *p=0); ~MpdLibraryDb(); diff --git a/dbus/mpris.h b/dbus/mpris.h index a1578b9d1..99aea7bfd 100644 --- a/dbus/mpris.h +++ b/dbus/mpris.h @@ -104,18 +104,7 @@ public: bool CanRaise() const { return true; } bool HasTrackList() const { return false; } QString Identity() const { return QLatin1String("Cantata"); } - QString DesktopEntry() const { - #ifdef ENABLE_KDE_SUPPORT - // Desktop file is installed in $prefix/share/applications/kde4/ - // rather than in $prefix/share/applications. The standard way to - // represent this dir is with a "kde4-" prefix. See: - // http://standards.freedesktop.org/menu-spec/1.0/go01.html#term-desktop-file-id - return QLatin1String("kde4-cantata"); - #else - return QLatin1String("cantata"); - #endif - } - + QString DesktopEntry() const { return QLatin1String("cantata"); } QStringList SupportedUriSchemes() const { return QStringList(); } QStringList SupportedMimeTypes() const { return QStringList(); } diff --git a/dbus/powermanagement.cpp b/dbus/powermanagement.cpp index 8c5b2c387..95d756815 100644 --- a/dbus/powermanagement.cpp +++ b/dbus/powermanagement.cpp @@ -23,15 +23,10 @@ #include "powermanagement.h" #include "support/globalstatic.h" -#ifdef ENABLE_KDE_SUPPORT -#include -#include -#else #include "inhibitinterface.h" #include "policyagentinterface.h" #include "upowerinterface.h" #include "login1interface.h" -#endif #include "support/localize.h" #include "mpd-interface/mpdstatus.h" @@ -41,11 +36,6 @@ PowerManagement::PowerManagement() : inhibitSuspendWhilstPlaying(false) , cookie(-1) { - #ifdef ENABLE_KDE_SUPPORT - #if KDE_IS_VERSION(4, 7, 0) - connect(Solid::PowerManagement::notifier(), SIGNAL(resumingFromSuspend()), this, SIGNAL(resuming())); - #endif - #else policy = new OrgKdeSolidPowerManagementPolicyAgentInterface(OrgKdeSolidPowerManagementPolicyAgentInterface::staticInterfaceName(), QLatin1String("/org/kde/Solid/PowerManagement/PolicyAgent"), QDBusConnection::sessionBus(), this); @@ -58,7 +48,6 @@ PowerManagement::PowerManagement() QLatin1String("/org/freedesktop/login1"), QDBusConnection::systemBus(), this); connect(upower, SIGNAL(Resuming()), this, SIGNAL(resuming())); connect(login1, SIGNAL(PrepareForSleep(bool)), this, SLOT(prepareForSleep(bool))); - #endif } void PowerManagement::setInhibitSuspend(bool i) @@ -85,9 +74,6 @@ void PowerManagement::beginSuppressingSleep() return; } QString reason=i18n("Cantata is playing a track"); - #ifdef ENABLE_KDE_SUPPORT - cookie=Solid::PowerManagement::beginSuppressingSleep(reason); - #else QDBusReply reply; if (policy->isValid()) { reply = policy->AddInhibition((uint)1, QCoreApplication::applicationName(), reason); @@ -96,7 +82,6 @@ void PowerManagement::beginSuppressingSleep() reply = inhibit->Inhibit(QCoreApplication::applicationName(), reason); } cookie=reply.isValid() ? reply : -1; - #endif } void PowerManagement::stopSuppressingSleep() @@ -105,16 +90,12 @@ void PowerManagement::stopSuppressingSleep() return; } - #ifdef ENABLE_KDE_SUPPORT - Solid::PowerManagement::stopSuppressingSleep(cookie); - #else if (policy->isValid()) { policy->ReleaseInhibition(cookie); } else { // Fallback to the fd.o Inhibit interface inhibit->UnInhibit(cookie); } - #endif cookie=-1; } @@ -131,11 +112,7 @@ void PowerManagement::mpdStatusUpdated() void PowerManagement::prepareForSleep(bool s) { - #ifdef ENABLE_KDE_SUPPORT - Q_UNUSED(s) - #else if (!s) { emit resuming(); } - #endif } diff --git a/dbus/powermanagement.h b/dbus/powermanagement.h index 2d421dc02..f7610c702 100644 --- a/dbus/powermanagement.h +++ b/dbus/powermanagement.h @@ -27,12 +27,10 @@ #include #include -#ifndef ENABLE_KDE_SUPPORT class OrgKdeSolidPowerManagementPolicyAgentInterface; class OrgFreedesktopPowerManagementInhibitInterface; class OrgFreedesktopUPowerInterface; class OrgFreedesktopLogin1ManagerInterface; -#endif class PowerManagement : public QObject { @@ -56,12 +54,10 @@ private Q_SLOTS: private: bool inhibitSuspendWhilstPlaying; int cookie; - #ifndef ENABLE_KDE_SUPPORT OrgKdeSolidPowerManagementPolicyAgentInterface *policy; OrgFreedesktopPowerManagementInhibitInterface *inhibit; OrgFreedesktopUPowerInterface *upower; OrgFreedesktopLogin1ManagerInterface *login1; - #endif }; #endif diff --git a/devices/audiocddevice.cpp b/devices/audiocddevice.cpp index 403e1fd3e..06f38cb7c 100644 --- a/devices/audiocddevice.cpp +++ b/devices/audiocddevice.cpp @@ -43,11 +43,7 @@ #if QT_VERSION >= 0x050000 #include #endif -#ifdef ENABLE_KDE_SUPPORT -#include -#else #include "solid-lite/block.h" -#endif const QLatin1String AudioCdDevice::constAnyDev("-"); diff --git a/devices/audiocddevice.h b/devices/audiocddevice.h index 06c03c755..86ca10320 100644 --- a/devices/audiocddevice.h +++ b/devices/audiocddevice.h @@ -27,11 +27,7 @@ #include "device.h" #include "gui/covers.h" #include "http/httpserver.h" -#ifdef ENABLE_KDE_SUPPORT -#include -#else #include "solid-lite/opticaldrive.h" -#endif #include class CddbInterface; diff --git a/devices/device.cpp b/devices/device.cpp index f676906c2..15c1f9bba 100644 --- a/devices/device.cpp +++ b/devices/device.cpp @@ -48,19 +48,11 @@ #include "models/musiclibraryitemsong.h" #include "models/musiclibrarymodel.h" #include "support/localize.h" -#ifdef ENABLE_KDE_SUPPORT -#include -#include -#include -#include -#include -#else // ENABLE_KDE_SUPPORT #include "solid-lite/portablemediaplayer.h" #include "solid-lite/storageaccess.h" #include "solid-lite/storagedrive.h" #include "solid-lite/opticaldisc.h" #include "solid-lite/genericinterface.h" -#endif // ENABLE_KDE_SUPPORT #endif // ENABLE_DEVICES_SUPPORT void Device::moveDir(const QString &from, const QString &to, const QString &base, const QString &coverFile) diff --git a/devices/device.h b/devices/device.h index 1890eba68..9be0bfff1 100644 --- a/devices/device.h +++ b/devices/device.h @@ -30,12 +30,8 @@ #include "config.h" #ifdef ENABLE_DEVICES_SUPPORT #include "deviceoptions.h" -#ifdef ENABLE_KDE_SUPPORT -#include -#else #include "solid-lite/device.h" #endif -#endif class QWidget; class QImage; diff --git a/devices/freespaceinfo.cpp b/devices/freespaceinfo.cpp index ab354755b..66c0a584c 100644 --- a/devices/freespaceinfo.cpp +++ b/devices/freespaceinfo.cpp @@ -23,9 +23,7 @@ #include "freespaceinfo.h" #include "support/utils.h" -#ifdef ENABLE_KDE_SUPPORT -#include -#elif defined(Q_OS_UNIX) +#if defined(Q_OS_UNIX) #include #elif defined Q_OS_WIN #include "windows.h" @@ -65,11 +63,7 @@ qulonglong FreeSpaceInfo::used() void FreeSpaceInfo::update() { - #ifdef ENABLE_KDE_SUPPORT - KDiskFreeSpaceInfo inf=KDiskFreeSpaceInfo::freeSpaceInfo(location); - totalSize=inf.size(); - usedSpace=inf.used(); - #elif defined(Q_OS_UNIX) + #if defined(Q_OS_UNIX) struct statvfs fs_info; if (0==statvfs(location.toLocal8Bit().constData(), &fs_info)) { totalSize=quint64(fs_info.f_blocks) * quint64(fs_info.f_bsize); diff --git a/devices/mtpdevice.cpp b/devices/mtpdevice.cpp index 4b79d0410..8106a918a 100644 --- a/devices/mtpdevice.cpp +++ b/devices/mtpdevice.cpp @@ -44,9 +44,6 @@ #include #include #include -#ifdef ENABLE_KDE_SUPPORT -#include -#endif #include #include #include @@ -810,37 +807,6 @@ static char * createString(const QString &str) static LIBMTP_filetype_t mtpFileType(const QString &f) { - #ifdef ENABLE_KDE_SUPPORT - KMimeType::Ptr mime=KMimeType::findByPath(f); - - if (mime->is("audio/mpeg")) { - return LIBMTP_FILETYPE_MP3; - } - if (mime->is("audio/ogg")) { - return LIBMTP_FILETYPE_OGG; - } - if (mime->is("audio/x-ms-wma")) { - return LIBMTP_FILETYPE_WMA; - } - if (mime->is("audio/mp4")) { - return LIBMTP_FILETYPE_M4A; // LIBMTP_FILETYPE_MP4 - } - if (mime->is("audio/aac")) { - return LIBMTP_FILETYPE_AAC; - } - if (mime->is("audio/flac")) { - return LIBMTP_FILETYPE_FLAC; - } - if (mime->is("audio/x-wav")) { - return LIBMTP_FILETYPE_WAV; - } - if (mime->is("image/jpeg")) { - return LIBMTP_FILETYPE_JPEG; - } - if (mime->is("image/png")) { - return LIBMTP_FILETYPE_PNG; - } - #else if (f.endsWith(".mp3", Qt::CaseInsensitive)) { return LIBMTP_FILETYPE_MP3; } @@ -868,7 +834,6 @@ static LIBMTP_filetype_t mtpFileType(const QString &f) if (f.endsWith(".png", Qt::CaseInsensitive)) { return LIBMTP_FILETYPE_PNG; } - #endif return LIBMTP_FILETYPE_UNDEF_AUDIO; } diff --git a/devices/mtpdevice.h b/devices/mtpdevice.h index c600bd14d..549f7f85c 100644 --- a/devices/mtpdevice.h +++ b/devices/mtpdevice.h @@ -27,11 +27,7 @@ #include "fsdevice.h" #include "mpd-interface/song.h" #include "config.h" -#ifdef ENABLE_KDE_SUPPORT -#include -#else #include "solid-lite/portablemediaplayer.h" -#endif #include class MusicLibraryItemRoot; diff --git a/devices/umsdevice.cpp b/devices/umsdevice.cpp index 48cd70366..e8689fbe8 100644 --- a/devices/umsdevice.cpp +++ b/devices/umsdevice.cpp @@ -31,11 +31,7 @@ #include #include #include -#ifdef ENABLE_KDE_SUPPORT -#include -#else #include "solid-lite/storagedrive.h" -#endif static const QLatin1String constSettingsFile("/.is_audio_player"); static const QLatin1String constMusicFolderKey("audio_folder"); diff --git a/devices/umsdevice.h b/devices/umsdevice.h index b02ad4585..10fc54934 100644 --- a/devices/umsdevice.h +++ b/devices/umsdevice.h @@ -25,11 +25,7 @@ #define UMSDEVICE_H #include "fsdevice.h" -#ifdef ENABLE_KDE_SUPPORT -#include -#else #include "solid-lite/storageaccess.h" -#endif class UmsDevice : public FsDevice { diff --git a/dynamic/dynamicruledialog.cpp b/dynamic/dynamicruledialog.cpp index 67b5c17b8..ad17fed02 100644 --- a/dynamic/dynamicruledialog.cpp +++ b/dynamic/dynamicruledialog.cpp @@ -150,13 +150,7 @@ bool DynamicRuleDialog::edit(const Dynamic::Rule &rule, bool isAdd) setButtons(isAdd ? User1|Ok|Close : Ok|Cancel); setButtonText(User1, i18n("Add")); - setButtonGuiItem(User1, GuiItem(i18n("Add"), - #ifdef ENABLE_KDE_SUPPORT - "list-add" - #else - FontAwesome::plus - #endif - )); + setButtonGuiItem(User1, GuiItem(i18n("Add"), FontAwesome::plus)); enableOkButton(); return QDialog::Accepted==exec(); } diff --git a/gui/application.h b/gui/application.h index 3ffd321dd..3ebfe63d5 100644 --- a/gui/application.h +++ b/gui/application.h @@ -27,9 +27,7 @@ #include "config.h" #include -#ifdef ENABLE_KDE_SUPPORT - #include "application_kde.h" -#elif defined Q_OS_WIN +#if defined Q_OS_WIN #include "application_win.h" #elif defined Q_OS_MAC #include "application_mac.h" diff --git a/gui/application_kde.cpp b/gui/application_kde.cpp deleted file mode 100644 index cab6ced68..000000000 --- a/gui/application_kde.cpp +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Cantata - * - * Copyright (c) 2011-2016 Craig Drummond - * - * ---- - * - * 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; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#include "application_kde.h" -#include "initialsettingswizard.h" -#include "mainwindow.h" -#include "settings.h" -#include -#include - -#ifdef Q_WS_X11 -Application::Application(Display *display, Qt::HANDLE visual, Qt::HANDLE colormap) - : KUniqueApplication(display, visual, colormap) - , w(0) -{ - #if QT_VERSION >= 0x050400 - if (Settings::self()->retinaSupport()) { - setAttribute(Qt::AA_UseHighDpiPixmaps); - } - #endif -} -#endif - -Application::Application() - : KUniqueApplication() - , w(0) -{ - #if QT_VERSION >= 0x050400 - if (Settings::self()->retinaSupport()) { - setAttribute(Qt::AA_UseHighDpiPixmaps); - } - #endif -} - -Application::~Application() { - if (w) { - disconnect(w, SIGNAL(destroyed(QObject *)), this, SLOT(mwDestroyed(QObject *))); - delete w; - w=0; - } -} - -int Application::newInstance() { - static bool in=false; - if (in) { - return 0; - } else { - in=true; - } - - if (w) { - w->restoreWindow(); - } else { - initObjects(); - if (Settings::self()->firstRun()) { - InitialSettingsWizard wz; - if (QDialog::Rejected==wz.exec()) { - QApplication::exit(0); - return 0; - } - } - w=new MainWindow(); - connect(w, SIGNAL(destroyed(QObject *)), this, SLOT(mwDestroyed(QObject *))); - if (!Settings::self()->startHidden()) { - w->show(); - } - } - - KCmdLineArgs *args=KCmdLineArgs::parsedArgs(); - if (args && args->count()>0) { - QStringList urls; - for (int i = 0; i < args->count(); ++i) { - urls.append(args->arg(i)); - } - if (!urls.isEmpty()) { - w->load(urls); - } - } - KStartupInfo::appStarted(startupId()); - in=false; - return 0; -} - -void Application::mwDestroyed(QObject *obj) -{ - if (obj==w) { - w=0; - } -} - diff --git a/gui/application_kde.h b/gui/application_kde.h deleted file mode 100644 index 0d7ac1976..000000000 --- a/gui/application_kde.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Cantata - * - * Copyright (c) 2011-2016 Craig Drummond - * - * ---- - * - * 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; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#ifndef APPLICATION_KDE_H -#define APPLICATION_KDE_H - -#include -#include -class MainWindow; -class Application : public KUniqueApplication -{ - Q_OBJECT - -public: - static void initObjects(); - #ifdef Q_WS_X11 - Application(Display *display, Qt::HANDLE visual, Qt::HANDLE colormap); - #endif - Application(); - ~Application(); - - int newInstance(); - -private Q_SLOTS: - void mwDestroyed(QObject *obj); - -private: - MainWindow *w; -}; - -#endif diff --git a/gui/coverdialog.cpp b/gui/coverdialog.cpp index 92f3e0f03..dc656190e 100644 --- a/gui/coverdialog.cpp +++ b/gui/coverdialog.cpp @@ -50,11 +50,7 @@ #include #include #include -#ifdef ENABLE_KDE_SUPPORT -#include -#else #include -#endif #include #include #if QT_VERSION >= 0x050000 @@ -837,11 +833,7 @@ void CoverDialog::cancelQuery() void CoverDialog::addLocalFile() { - #ifdef ENABLE_KDE_SUPPORT - QString fileName=KFileDialog::getOpenFileName(KUrl(), "image/jpeg image/png", this, i18n("Load Local Cover")); - #else QString fileName=QFileDialog::getOpenFileName(this, i18n("Load Local Cover"), QDir::homePath(), i18n("Images (*.png *.jpg)")); - #endif if (!fileName.isEmpty()) { if (currentLocalCovers.contains(fileName)) { diff --git a/gui/covers.cpp b/gui/covers.cpp index 7299b6a75..324140776 100644 --- a/gui/covers.cpp +++ b/gui/covers.cpp @@ -56,9 +56,6 @@ #include #include #include -#ifdef ENABLE_KDE_SUPPORT -#include -#endif GLOBAL_STATIC(Covers, instance) @@ -170,7 +167,6 @@ static QString save(const QString &mimeType, const QString &extension, const QSt static QImage loadImage(const QString &fileName) { QImage img(fileName); - #ifndef ENABLE_UBUNTU if (img.isNull()) { // Failed to load, perhaps extension is wrong? If so try PNG for .jpg, and vice versa... QFile f(fileName); @@ -183,7 +179,6 @@ static QImage loadImage(const QString &fileName) } } } - #endif return img; } @@ -363,12 +358,6 @@ QString Covers::encodeName(QString name) name=name.left(255); } #else // Linux - #ifdef ENABLE_UBUNTU - // qrc:/ does not seem to like ? - name.replace(QLatin1Char('?'), QLatin1Char('_')); - name.replace(QLatin1Char(':'), QLatin1Char('_')); - name.replace(QLatin1Char('%'), QLatin1Char('_')); - #endif // ENABLE_UBUNTU if (name.startsWith(QLatin1Char('.'))) { name[0]=QLatin1Char('_'); } @@ -382,14 +371,12 @@ QString Covers::albumFileName(const Song &song) if (coverName.isEmpty()) { coverName=Covers::constFileName; } - #ifndef ENABLE_UBUNTU else if (coverName.contains(QLatin1Char('%'))) { coverName.replace(DeviceOptions::constAlbumArtist, encodeName(song.albumArtist())); coverName.replace(DeviceOptions::constTrackArtist, encodeName(song.albumArtist())); coverName.replace(DeviceOptions::constAlbumTitle, encodeName(song.album)); coverName.replace(QLatin1String("%"), QLatin1String("")); } - #endif return coverName; } @@ -397,7 +384,10 @@ QString Covers::artistFileName(const Song &song) { QString coverName=MPDConnection::self()->getDetails().coverName; if (coverName.contains(QLatin1Char('%'))) { - return encodeName(song.isVariousArtists() ? song.basicArtist() : song.albumArtist()); + QString rv=encodeName(song.isVariousArtists() ? song.basicArtist() : song.albumArtist()); + if (!rv.isEmpty()) { + return rv; + } } return constArtistImage; } @@ -406,7 +396,10 @@ QString Covers::composerFileName(const Song &song) { QString coverName=MPDConnection::self()->getDetails().coverName; if (coverName.contains(QLatin1Char('%'))) { - return encodeName(song.composer()); + QString rv=encodeName(song.composer()); + if (!rv.isEmpty()) { + return rv; + } } return constComposerImage; } @@ -1100,29 +1093,16 @@ Covers::Covers() devicePixelRatio=qApp->devicePixelRatio(); } #endif - #ifdef ENABLE_UBUNTU - cache.setMaxCost(20*1024*1024); // Not used? - cacheScaledCovers=false; - saveInMpdDir=false; - #else maxCoverUpdatePerIteration=Settings::self()->maxCoverUpdatePerIteration(); cache.setMaxCost(Settings::self()->coverCacheSize()*1024*1024); - #endif } -#ifdef ENABLE_UBUNTU -void Covers::setFetchCovers(bool f) -{ - fetchCovers=f; -} -#else void Covers::readConfig() { saveInMpdDir=Settings::self()->storeCoversInMpdDir(); cacheScaledCovers=Settings::self()->cacheScaledCovers(); fetchCovers=Settings::self()->fetchCovers(); } -#endif void Covers::stop() { @@ -1220,7 +1200,6 @@ QPixmap * Covers::defaultPix(const Song &song, int size, int origSize) key+=QString::number(size); QPixmap *pix=cache.object(key); - #ifndef ENABLE_UBUNTU if (!pix) { const Icon &icn=song.isArtistImageRequest() || song.isComposerImageRequest() ? Icons::self()->artistIcon @@ -1237,7 +1216,6 @@ QPixmap * Covers::defaultPix(const Song &song, int size, int origSize) cache.insert(key, pix, 1); cacheSizes.insert(size); } - #endif return pix; } @@ -1260,7 +1238,6 @@ QPixmap * Covers::get(const Song &song, int size, bool urgent) key=cacheKey(song, size); pix=cache.object(key); - #ifndef ENABLE_UBUNTU if (!pix) { if (song.isArtistImageRequest() && song.isVariousArtists()) { // Load artist image... @@ -1286,7 +1263,6 @@ QPixmap * Covers::get(const Song &song, int size, bool urgent) cacheSizes.insert(size); } } - #endif if (!pix) { if (urgent) { QImage cached=loadScaledCover(song, size); diff --git a/gui/covers.h b/gui/covers.h index 77882326e..8a7e5eff8 100644 --- a/gui/covers.h +++ b/gui/covers.h @@ -40,9 +40,6 @@ class Thread; class NetworkJob; class QMutex; class QTimer; -#ifdef ENABLE_KDE_SUPPORT -class KUrl; -#endif class NetworkAccessManager; class CoverDownloader : public QObject @@ -214,11 +211,7 @@ public: static const char * imageFormat(const QByteArray &data); Covers(); - #ifdef ENABLE_UBUNTU - void setFetchCovers(bool f); - #else void readConfig(); - #endif void stop(); void clearNameCache(); diff --git a/gui/currentcover.cpp b/gui/currentcover.cpp index def300d56..058d6c8f9 100644 --- a/gui/currentcover.cpp +++ b/gui/currentcover.cpp @@ -133,9 +133,6 @@ const QImage & CurrentCover::stdImage(bool stream) { QImage &img=stream ? noStreamCover : noCover; - #ifdef ENABLE_UBUNTU - // TODO: Just return qrc file Touch... - #else if (img.isNull()) { int iconSize=Icon::stdSize(Utils::scaleForDpi(128)); img = (stream ? Icons::self()->streamIcon : Icons::self()->albumIcon(iconSize)).pixmap(iconSize, iconSize).toImage(); @@ -153,7 +150,6 @@ const QImage & CurrentCover::stdImage(bool stream) } #endif } - #endif return img; } diff --git a/gui/initialsettingswizard.cpp b/gui/initialsettingswizard.cpp index a83386b5d..5fc6742f8 100644 --- a/gui/initialsettingswizard.cpp +++ b/gui/initialsettingswizard.cpp @@ -77,11 +77,7 @@ InitialSettingsWizard::InitialSettingsWizard(QWidget *p) storeCoversInMpdDir->setChecked(Settings::self()->storeCoversInMpdDir()); storeLyricsInMpdDir->setChecked(Settings::self()->storeLyricsInMpdDir()); storeBackdropsInMpdDir->setChecked(Settings::self()->storeBackdropsInMpdDir()); - #ifdef ENABLE_KDE_SUPPORT - introPage->setBackground(Icon("cantata")); - #else introPage->setBackground(Icons::self()->appIcon); - #endif connectionPage->setBackground(Icons::self()->audioFileIcon); filesPage->setBackground(Icons::self()->filesIcon); finishedPage->setBackground(Icon("dialog-ok")); diff --git a/gui/interfacesettings.cpp b/gui/interfacesettings.cpp index bdb4b2db3..b8e0d6fe3 100644 --- a/gui/interfacesettings.cpp +++ b/gui/interfacesettings.cpp @@ -33,19 +33,15 @@ #include "widgets/itemview.h" #include "db/librarydb.h" #include -#ifndef ENABLE_KDE_SUPPORT #include #include #include #include -#endif #ifdef QT_QTDBUS_FOUND #include #include #endif -#ifndef ENABLE_KDE_SUPPORT #include -#endif #include #define REMOVE(w) \ @@ -111,9 +107,7 @@ static const char * constSep=","; InterfaceSettings::InterfaceSettings(QWidget *p) : QWidget(p) - #ifndef ENABLE_KDE_SUPPORT , loadedLangs(false) - #endif { #ifdef Q_OS_MAC // OSX always displays an entry in the taskbar - and the tray seems to confuse things. @@ -127,14 +121,12 @@ InterfaceSettings::InterfaceSettings(QWidget *p) bool enableNotifications=true; #endif // QT_QTDBUS_FOUND bool enableTrayItem=true; - #ifndef ENABLE_KDE_SUPPORT if (!QSystemTrayIcon::isSystemTrayAvailable()) { enableTrayItem=false; #ifndef QT_QTDBUS_FOUND enableNotifications=false; #endif } - #endif // !ENABLE_KDE_SUPPORT #endif // Q_MAC_OS setupUi(this); @@ -164,12 +156,6 @@ InterfaceSettings::InterfaceSettings(QWidget *p) #endif connect(views, SIGNAL(itemChanged(QListWidgetItem*)), SLOT(viewItemChanged(QListWidgetItem*))); - #ifdef ENABLE_KDE_SUPPORT - REMOVE(lang) - REMOVE(langLabel) - REMOVE(langNoteLabel) - #endif - sbStyle->addItem(i18n("Large"), FancyTabWidget::Large); sbStyle->addItem(i18n("Small"), FancyTabWidget::Small); sbStyle->addItem(i18n("Tab-bar"), FancyTabWidget::Tab); @@ -182,11 +168,7 @@ InterfaceSettings::InterfaceSettings(QWidget *p) playQueueBackground_cover->setProperty(constValueProperty, PlayQueueView::BI_Cover); playQueueBackground_custom->setProperty(constValueProperty, PlayQueueView::BI_Custom); playQueueBackgroundFile->setDirMode(false); - #ifdef ENABLE_KDE_SUPPORT - playQueueBackgroundFile->setFilter("image/jpeg image/png"); - #else playQueueBackgroundFile->setFilter(i18n("Images (*.png *.jpg)")); - #endif int labelWidth=qMax(fontMetrics().width(QLatin1String("100%")), fontMetrics().width(i18nc("pixels", "10px"))); playQueueBackgroundOpacityLabel->setFixedWidth(labelWidth); playQueueBackgroundBlurLabel->setFixedWidth(labelWidth); @@ -368,11 +350,9 @@ void InterfaceSettings::save() Settings::self()->saveStartupState(Settings::SS_Previous); } Settings::self()->saveFetchCovers(fetchCovers->isChecked()); - #ifndef ENABLE_KDE_SUPPORT if (loadedLangs && lang) { Settings::self()->saveLang(lang->itemData(lang->currentIndex()).toString()); } - #endif QStringList hiddenPages; for (int i=0; icount(); ++i) { @@ -393,7 +373,6 @@ void InterfaceSettings::save() } } -#ifndef ENABLE_KDE_SUPPORT static bool localeAwareCompare(const QString &a, const QString &b) { return a.localeAwareCompare(b) < 0; @@ -462,7 +441,6 @@ void InterfaceSettings::showEvent(QShowEvent *e) } QWidget::showEvent(e); } -#endif void InterfaceSettings::showPage(const QString &page) { @@ -519,9 +497,7 @@ void InterfaceSettings::enableStartupState() void InterfaceSettings::langChanged() { - #ifndef ENABLE_KDE_SUPPORT langNoteLabel->setOn(lang->itemData(lang->currentIndex()).toString()!=Settings::self()->lang()); - #endif } void InterfaceSettings::viewItemChanged(QListWidgetItem *changedItem) diff --git a/gui/interfacesettings.h b/gui/interfacesettings.h index fab8c2964..dccba4872 100644 --- a/gui/interfacesettings.h +++ b/gui/interfacesettings.h @@ -39,9 +39,7 @@ public: void load(); void save(); - #ifndef ENABLE_KDE_SUPPORT void showEvent(QShowEvent *e); - #endif void showPage(const QString &page); QSize sizeHint() const; @@ -64,9 +62,7 @@ private Q_SLOTS: void systemTrayPopupToggled(); private: - #ifndef ENABLE_KDE_SUPPORT bool loadedLangs; - #endif }; #endif diff --git a/gui/main.cpp b/gui/main.cpp index 6fafc1d30..17ae5ca3d 100644 --- a/gui/main.cpp +++ b/gui/main.cpp @@ -22,18 +22,12 @@ */ #include "application.h" -#ifdef ENABLE_KDE_SUPPORT -#include -#include -#include -#else #include #include #include #include #include #include -#endif #include "support/utils.h" #include "config.h" #include "settings.h" @@ -64,9 +58,7 @@ #endif #include "context/contextwidget.h" #include "scrobbling/scrobbler.h" -#ifndef ENABLE_KDE_SUPPORT #include "gui/mediakeys.h" -#endif #include #include @@ -92,7 +84,6 @@ static void cantataQtMsgHandler(QtMsgType, const QMessageLogContext &, const QSt } } -#ifndef ENABLE_KDE_SUPPORT // Taken from Clementine! // // We convert from .po files to .qm files, which loses context information. @@ -141,7 +132,6 @@ static void loadTranslation(const QString &prefix, const QString &path, const QS QTextCodec::setCodecForTr(QTextCodec::codecForLocale()); #endif } -#endif static void removeOldFiles(const QString &d, const QStringList &types) { @@ -267,11 +257,9 @@ static void installDebugMessageHandler() if (dbg&Dbg_Sql) { LibraryDb::enableDebug(); } - #ifndef ENABLE_KDE_SUPPORT if (dbg&DBG_Other) { MediaKeys::enableDebug(); } - #endif if (dbg&Dbg_All && logToFile) { #if QT_VERSION < 0x050000 qInstallMsgHandler(cantataQtMsgHandler); @@ -285,41 +273,6 @@ static void installDebugMessageHandler() int main(int argc, char *argv[]) { QThread::currentThread()->setObjectName("GUI"); - #ifdef ENABLE_KDE_SUPPORT - KAboutData aboutData(PACKAGE_NAME, 0, - ki18n("Cantata"), PACKAGE_VERSION_STRING, - ki18n("A KDE client for MPD"), - KAboutData::License_GPL_V3, - ki18n("© 2011-2016 Craig Drummond"), - KLocalizedString(), - "https://github.com/CDrummond/cantata", "craig.p.drummond@gmail.com"); - - aboutData.addAuthor(ki18n("Craig Drummond"), ki18n("Maintainer"), "craig.p.drummond@gmail.com"); - aboutData.addAuthor(ki18n("Piotr Wicijowski"), ki18n("UI Improvements"), "piotr.wicijowski@gmail.com"); - aboutData.addAuthor(ki18n("Sander Knopper"), ki18n("QtMPC author"), QByteArray(), "http://lowblog.nl"); - aboutData.addAuthor(ki18n("Roeland Douma"), ki18n("QtMPC author"), QByteArray(), "http://lowblog.nl"); - aboutData.addAuthor(ki18n("Daniel Selinger"), ki18n("QtMPC author"), QByteArray(), "http://lowblog.nl"); - aboutData.addAuthor(ki18n("Armin Walland"), ki18n("QtMPC author"), QByteArray(), "http://lowblog.nl"); - aboutData.addCredit(ki18n("FanArt.tv"), ki18n("Context view backdrops (please consider uploading your own music fan-art to fanart.tv)"), QByteArray(), "www.fanart.tv"); - aboutData.addCredit(ki18n("Wikipedia"), ki18n("Context view metadata"), QByteArray(), "www.wikipedia.org"); - aboutData.addCredit(ki18n("Last.fm"), ki18n("Context view metadata"), QByteArray(), "www.last.fm"); - KCmdLineArgs::init(argc, argv, &aboutData); - #ifdef TAGLIB_FOUND - KCmdLineOptions options; - options.add("+[URL]", ki18n("URL to open")); - KCmdLineArgs::addCmdLineOptions(options); - KUniqueApplication::addCmdLineOptions(); - #endif - if (!KUniqueApplication::start()) { - exit(0); - } - - Application app; - - removeOldFiles(); - installDebugMessageHandler(); - - #else // ENABLE_KDE_SUPPORT QCoreApplication::setApplicationName(PACKAGE_NAME); QCoreApplication::setOrganizationName(ORGANIZATION_NAME); @@ -369,7 +322,6 @@ int main(int argc, char *argv[]) app.setActivationWindow(&mw); #endif // !defined Q_OS_MAC app.loadFiles(); - #endif // ENABLE_KDE_SUPPORT return app.exec(); } diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 5d0f2c628..44b583354 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -118,17 +118,8 @@ #include #include #include -#ifdef ENABLE_KDE_SUPPORT -#include -#include -#include -#include -#include -#include -#else #include #include "mediakeys.h" -#endif #include static int nextKey(int &key) @@ -145,7 +136,7 @@ static int nextKey(int &key) static const char *constRatingKey="rating"; MainWindow::MainWindow(QWidget *parent) - : MAIN_WINDOW_BASE_CLASS(parent) + : QMainWindow(parent) , prevPage(-1) , lastState(MPDState_Inactive) , lastSongId(-1) @@ -260,16 +251,6 @@ void MainWindow::init() Icons::self()->initSidebarIcons(); QColor iconCol=Utils::monoIconColor(); - #ifdef ENABLE_KDE_SUPPORT - prefAction=static_cast(KStandardAction::preferences(this, SLOT(showPreferencesDialog()), ActionCollection::get())); - quitAction=static_cast(KStandardAction::quit(this, SLOT(quit()), ActionCollection::get())); - shortcutsAction=static_cast(KStandardAction::keyBindings(this, SLOT(configureShortcuts()), ActionCollection::get())); - StdActions::self()->prevTrackAction->setGlobalShortcut(KShortcut(Qt::Key_MediaPrevious)); - StdActions::self()->nextTrackAction->setGlobalShortcut(KShortcut(Qt::Key_MediaNext)); - StdActions::self()->playPauseTrackAction->setGlobalShortcut(KShortcut(Qt::Key_MediaPlay)); - StdActions::self()->stopPlaybackAction->setGlobalShortcut(KShortcut(Qt::Key_MediaStop)); - StdActions::self()->stopAfterCurrentTrackAction->setGlobalShortcut(KShortcut()); - #else setWindowIcon(Icons::self()->appIcon); prefAction=ActionCollection::get()->createAction("configure", Utils::KDE==Utils::currentDe() ? i18n("Configure Cantata...") : i18n("Preferences"), @@ -285,7 +266,6 @@ void MainWindow::init() quitAction->setMenuRole(QAction::QuitRole); aboutAction->setMenuRole(QAction::AboutRole); #endif - #endif // ENABLE_KDE_SUPPORT restoreAction = new Action(i18n("Show Window"), this); connect(restoreAction, SIGNAL(triggered()), this, SLOT(restoreWindow())); @@ -556,10 +536,6 @@ void MainWindow::init() expandedSize=Settings::self()->mainWindowSize(); collapsedSize=Settings::self()->mainWindowCollapsedSize(); - #ifdef ENABLE_KDE_SUPPORT - setupGUI(KXmlGuiWindow::Keys); - #endif - if (Settings::self()->firstRun() || (expandInterfaceAction->isChecked() && expandedSize.isEmpty())) { int width=playPauseTrackButton->width()*25; resize(playPauseTrackButton->width()*25, playPauseTrackButton->height()*18); @@ -599,14 +575,10 @@ void MainWindow::init() int menuCfg=Settings::self()->menu(); #ifndef Q_OS_MAC if (Utils::Unity!=Utils::currentDe() && menuCfg&Settings::MC_Bar && menuCfg&Settings::MC_Button) { - #ifdef ENABLE_KDE_SUPPORT - showMenuAction=KStandardAction::showMenubar(this, SLOT(toggleMenubar()), ActionCollection::get()); - #else showMenuAction=ActionCollection::get()->createAction("showmenubar", i18n("Show Menubar")); showMenuAction->setShortcut(Qt::ControlModifier+Qt::Key_M); showMenuAction->setCheckable(true); connect(showMenuAction, SIGNAL(toggled(bool)), this, SLOT(toggleMenubar())); - #endif } #endif @@ -623,17 +595,6 @@ void MainWindow::init() if (showMenuAction) { mainMenu->addAction(showMenuAction); } - #ifdef ENABLE_KDE_SUPPORT - mainMenu->addAction(prefAction); - mainMenu->addAction(refreshDbAction); - mainMenu->addAction(shortcutsAction); - mainMenu->addSeparator(); - mainMenu->addAction(StdActions::self()->searchAction); - mainMenu->addAction(searchPlayQueueAction); - mainMenu->addSeparator(); - mainMenu->addAction(serverInfoAction); - mainMenu->addMenu(helpMenu()); - #else mainMenu->addAction(prefAction); mainMenu->addAction(refreshDbAction); mainMenu->addSeparator(); @@ -642,7 +603,6 @@ void MainWindow::init() mainMenu->addSeparator(); mainMenu->addAction(serverInfoAction); mainMenu->addAction(aboutAction); - #endif mainMenu->addSeparator(); mainMenu->addAction(quitAction); menuButton->setIcon(Icons::self()->toolbarMenuIcon); @@ -670,14 +630,11 @@ void MainWindow::init() menu->addSeparator(); addMenuAction(menu, StdActions::self()->searchAction); addMenuAction(menu, searchPlayQueueAction); - #ifndef ENABLE_KDE_SUPPORT if (Utils::KDE!=Utils::currentDe()) { menu->addSeparator(); addMenuAction(menu, prefAction); } - #endif menuBar()->addMenu(menu); - #ifndef ENABLE_KDE_SUPPORT if (Utils::KDE!=Utils::currentDe()) { menu=new QMenu(i18n("&View"), this); if (showMenuAction) { @@ -690,7 +647,6 @@ void MainWindow::init() addMenuAction(menu, fullScreenAction); menuBar()->addMenu(menu); } - #endif menu=new QMenu(i18n("&Queue"), this); addMenuAction(menu, clearPlayQueueAction); addMenuAction(menu, StdActions::self()->savePlayQueueAction); @@ -699,10 +655,7 @@ void MainWindow::init() addMenuAction(menu, PlayQueueModel::self()->shuffleAct()); addMenuAction(menu, PlayQueueModel::self()->sortAct()); menuBar()->addMenu(menu); - #ifndef ENABLE_KDE_SUPPORT - if (Utils::KDE==Utils::currentDe()) - #endif - { + if (Utils::KDE==Utils::currentDe()) { menu=new QMenu(i18n("&Settings"), this); if (showMenuAction) { addMenuAction(menu, showMenuAction); @@ -711,9 +664,6 @@ void MainWindow::init() addMenuAction(menu, fullScreenAction); addMenuAction(menu, songInfoAction); menu->addSeparator(); - #ifdef ENABLE_KDE_SUPPORT - addMenuAction(menu, shortcutsAction); - #endif addMenuAction(menu, prefAction); menuBar()->addMenu(menu); } @@ -722,14 +672,7 @@ void MainWindow::init() #endif menu=new QMenu(i18n("&Help"), this); addMenuAction(menu, serverInfoAction); - #ifdef ENABLE_KDE_SUPPORT - menu->addSeparator(); - foreach (QAction *act, helpMenu()->actions()) { - addMenuAction(menu, act); - } - #else addMenuAction(menu, aboutAction); - #endif menuBar()->addMenu(menu); } @@ -940,9 +883,7 @@ void MainWindow::init() if (Settings::self()->firstRun() && MPDConnection::self()->isConnected()) { mpdConnectionStateChanged(true); } - #ifndef ENABLE_KDE_SUPPORT MediaKeys::self()->start(); - #endif #ifdef Q_OS_MAC dockMenu=new DockMenu(this); #endif @@ -1007,9 +948,7 @@ MainWindow::~MainWindow() Covers::self()->cleanCdda(); #endif #endif - #ifndef ENABLE_KDE_SUPPORT MediaKeys::self()->stop(); - #endif #ifdef TAGLIB_FOUND Tags::stop(); #endif @@ -1104,7 +1043,7 @@ void MainWindow::showEvent(QShowEvent *event) if (!thumbnailTooolbar) { thumbnailTooolbar=new ThumbnailToolBar(this); } - MAIN_WINDOW_BASE_CLASS::showEvent(event); + QMainWindow::showEvent(event); } #endif @@ -1117,7 +1056,7 @@ void MainWindow::closeEvent(QCloseEvent *event) event->ignore(); } } else if (canClose()) { - MAIN_WINDOW_BASE_CLASS::closeEvent(event); + QMainWindow::closeEvent(event); } } @@ -1192,20 +1131,6 @@ void MainWindow::refreshDbPromp() expand(); } -#ifdef ENABLE_KDE_SUPPORT -void MainWindow::configureShortcuts() -{ - KShortcutsDialog dlg(KShortcutsEditor::AllActions, KShortcutsEditor::LetterShortcutsDisallowed, this); - dlg.addCollection(ActionCollection::get()); - connect(&dlg, SIGNAL(okClicked()), this, SLOT(saveShortcuts())); - dlg.exec(); -} - -void MainWindow::saveShortcuts() -{ - ActionCollection::get()->writeSettings(); -} -#else void MainWindow::showAboutDialog() { QMessageBox::about(this, i18nc("Qt-only", "About Cantata"), @@ -1217,7 +1142,6 @@ void MainWindow::showAboutDialog() QLatin1String("

")+i18n("Please consider uploading your own music fan-art to FanArt.tv")+ QLatin1String("")); } -#endif bool MainWindow::canClose() { @@ -1296,11 +1220,7 @@ void MainWindow::quit() return; } #endif - #ifdef ENABLE_KDE_SUPPORT - kapp->quit(); - #else qApp->quit(); - #endif } void MainWindow::checkMpdDir() diff --git a/gui/mainwindow.h b/gui/mainwindow.h index 44c449377..210f87e4a 100644 --- a/gui/mainwindow.h +++ b/gui/mainwindow.h @@ -28,14 +28,7 @@ #define MAIN_WINDOW_H #include -#ifdef ENABLE_KDE_SUPPORT -#include -#define MAIN_WINDOW_BASE_CLASS KXmlGuiWindow -class KToggleAction; -#else #include -#define MAIN_WINDOW_BASE_CLASS QMainWindow -#endif #include #include #include "ui_mainwindow.h" @@ -93,7 +86,7 @@ public: ContextPage(QWidget *p) : QWidget(p) { } }; -class MainWindow : public MAIN_WINDOW_BASE_CLASS, private Ui::MainWindow +class MainWindow : public QMainWindow, private Ui::MainWindow { Q_OBJECT @@ -157,12 +150,7 @@ public Q_SLOTS: void hideWindow(); void restoreWindow(); void load(const QStringList &urls) { PlayQueueModel::self()->load(urls); } - #ifdef ENABLE_KDE_SUPPORT - void configureShortcuts(); - void saveShortcuts(); - #else void showAboutDialog(); - #endif void mpdConnectionStateChanged(bool connected); void playQueueItemsSelected(bool s); void showSidebarPreferencesPage() { showPreferencesDialog("interface:sidebar"); } @@ -279,12 +267,7 @@ private: qint32 lastSongId; PlayQueueProxyModel playQueueProxyModel; bool autoScrollPlayQueue; - #ifdef ENABLE_KDE_SUPPORT - KToggleAction *showMenuAction; - Action *shortcutsAction; - #else Action *showMenuAction; - #endif Action *prefAction; Action *refreshDbAction; Action *doDbRefreshAction; diff --git a/gui/playlistspage.cpp b/gui/playlistspage.cpp index 5094b875c..784895f30 100644 --- a/gui/playlistspage.cpp +++ b/gui/playlistspage.cpp @@ -39,11 +39,7 @@ #include "dynamic/dynamicpage.h" #include "settings.h" #include -#ifdef ENABLE_KDE_SUPPORT -#include -#else #include -#endif class PlaylistTableView : public TableView { @@ -290,12 +286,7 @@ void StoredPlaylistsPage::removeDuplicates() void StoredPlaylistsPage::itemDoubleClicked(const QModelIndex &index) { - if ( - #ifdef ENABLE_KDE_SUPPORT - KGlobalSettings::singleClick() - #else - style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, 0, this) - #endif + if (style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, 0, this) || !static_cast(proxy.mapToSource(index).internalPointer())->isPlaylist()) { QModelIndexList indexes; indexes.append(index); diff --git a/gui/preferencesdialog.cpp b/gui/preferencesdialog.cpp index 141dd9349..5171811b5 100644 --- a/gui/preferencesdialog.cpp +++ b/gui/preferencesdialog.cpp @@ -36,15 +36,11 @@ #ifdef ENABLE_PROXY_CONFIG #include "network/proxysettings.h" #endif -#ifndef ENABLE_KDE_SUPPORT #include "shortcutssettingspage.h" -#endif #if defined CDDB_FOUND || defined MUSICBRAINZ5_FOUND #include "devices/audiocdsettings.h" #endif -#ifndef ENABLE_KDE_SUPPORT #include "shortcutssettingspage.h" -#endif #include "scrobbling/scrobblingsettings.h" #include #include @@ -91,12 +87,10 @@ PreferencesDialog::PreferencesDialog(QWidget *parent) proxy->load(); addPage(QLatin1String("proxy"), proxy, i18n("Proxy"), Icon("preferences-system-network"), i18nc("Qt-only", "Proxy Settings")); #endif - #ifndef ENABLE_KDE_SUPPORT shortcuts = new ShortcutsSettingsPage(0); addPage(QLatin1String("shortcuts"), shortcuts, i18nc("Qt-only", "Shortcuts"), Icon(QStringList() << "preferences-desktop-keyboard" << "keyboard"), i18nc("Qt-only", "Keyboard Shortcut Settings")); shortcuts->load(); - #endif addPage(QLatin1String("cache"), cache, i18n("Cache"), Icon(QStringList() << "folder-temp" << "folder"), i18n("Cached Items")); addPage(QLatin1String("custom"), custom, i18n("Custom Actions"), Icon(QStringList() << "fork" << "gtk-execute"), i18n("Custom Actions")); #ifdef Q_OS_MAC @@ -135,12 +129,10 @@ void PreferencesDialog::writeSettings() playback->save(); files->save(); interface->save(); - #ifndef ENABLE_KDE_SUPPORT #ifdef ENABLE_PROXY_CONFIG proxy->save(); #endif shortcuts->save(); - #endif #if defined CDDB_FOUND || defined MUSICBRAINZ5_FOUND audiocd->save(); #endif diff --git a/gui/preferencesdialog.h b/gui/preferencesdialog.h index fb0fb34dd..f352e6e15 100644 --- a/gui/preferencesdialog.h +++ b/gui/preferencesdialog.h @@ -27,11 +27,8 @@ #include "config.h" #include "support/configdialog.h" -#ifndef ENABLE_KDE_SUPPORT class ProxySettings; class ShortcutsSettingsPage; -#endif - class ServerSettings; class PlaybackSettings; class FileSettings; @@ -81,9 +78,7 @@ private: #ifdef ENABLE_PROXY_CONFIG ProxySettings *proxy; #endif - #ifndef ENABLE_KDE_SUPPORT ShortcutsSettingsPage *shortcuts; - #endif CacheSettings *cache; #if defined CDDB_FOUND || defined MUSICBRAINZ5_FOUND AudioCdSettings *audiocd; diff --git a/gui/settings.cpp b/gui/settings.cpp index 4bad85f0d..c181678cd 100644 --- a/gui/settings.cpp +++ b/gui/settings.cpp @@ -186,11 +186,7 @@ MPDConnectionDetails Settings::connectionDetails(const QString &name) QList Settings::allConnections() { - #ifdef ENABLE_KDE_SUPPORT - QStringList groups=KGlobal::config()->groupList(); - #else QStringList groups=cfg.childGroups(); - #endif QList connections; foreach (const QString &grp, groups) { if (cfg.hasGroup(grp) && grp.startsWith("Connection")) { @@ -670,12 +666,10 @@ int Settings::mpdPoll() } -#ifndef ENABLE_KDE_SUPPORT QString Settings::lang() { return cfg.get("lang", QString()); } -#endif bool Settings::showMenubar() { @@ -890,11 +884,6 @@ void Settings::saveWikipediaIntroOnly(bool v) void Settings::saveContextBackdrop(int v) { - #ifdef ENABLE_KDE_SUPPORT - if (cfg.get("contextBackdrop", QString()).length()>1) { - cfg.removeEntry("contextBackdrop"); - } - #endif cfg.set("contextBackdrop", v); } @@ -1012,11 +1001,6 @@ void Settings::savePlayQueueScroll(bool v) void Settings::savePlayQueueBackground(int v) { - #ifdef ENABLE_KDE_SUPPORT - if (cfg.get("playQueueBackground", QString()).length()>1) { - cfg.removeEntry("playQueueBackground"); - } - #endif cfg.set("playQueueBackground", v); } @@ -1168,12 +1152,10 @@ void Settings::saveFetchCovers(bool v) cfg.set("fetchCovers", v); } -#ifndef ENABLE_KDE_SUPPORT void Settings::saveLang(const QString &v) { cfg.set("lang", v); } -#endif void Settings::saveShowMenubar(bool v) { diff --git a/gui/settings.h b/gui/settings.h index 15d40c804..056183809 100644 --- a/gui/settings.h +++ b/gui/settings.h @@ -148,9 +148,7 @@ public: bool cacheScaledCovers(); bool fetchCovers(); int mpdPoll(); - #ifndef ENABLE_KDE_SUPPORT QString lang(); - #endif bool showMenubar(); int menu(); bool touchFriendly(); @@ -252,9 +250,7 @@ public: void saveStartupState(int v); void saveSearchCategory(const QString &v); void saveFetchCovers(bool v); - #ifndef ENABLE_KDE_SUPPORT void saveLang(const QString &v); - #endif void saveShowMenubar(bool v); void saveTouchFriendly(bool v); void saveShowCoverWidget(bool v); diff --git a/gui/trayitem.cpp b/gui/trayitem.cpp index c2b6b0284..bcf87003b 100644 --- a/gui/trayitem.cpp +++ b/gui/trayitem.cpp @@ -35,10 +35,6 @@ #include "stdactions.h" #include "support/utils.h" #include "currentcover.h" -#ifdef ENABLE_KDE_SUPPORT -#include -#include -#endif #include #include #ifdef Q_OS_MAC @@ -120,9 +116,7 @@ void TrayItem::setup() #ifndef Q_OS_MAC if (!Settings::self()->useSystemTray()) { if (trayItem) { - #ifndef ENABLE_KDE_SUPPORT trayItem->setVisible(false); - #endif trayItem->deleteLater(); trayItem=0; trayItemMenu->deleteLater(); @@ -144,34 +138,6 @@ void TrayItem::setup() updateOutputs(); #endif - #ifdef ENABLE_KDE_SUPPORT - trayItem = new KStatusNotifierItem(this); - trayItem->setCategory(KStatusNotifierItem::ApplicationStatus); - trayItem->setTitle(i18n("Cantata")); - trayItem->setIconByName(QIcon::hasThemeIcon("cantata-panel") ? QLatin1String("cantata-panel") : QLatin1String("cantata")); - trayItem->setToolTip("cantata", i18n("Cantata"), QString()); - trayItem->setStandardActionsEnabled(false); - - trayItemMenu = new KMenu(0); - trayItemMenu->addAction(StdActions::self()->prevTrackAction); - trayItemMenu->addAction(StdActions::self()->playPauseTrackAction); - trayItemMenu->addAction(StdActions::self()->stopPlaybackAction); - trayItemMenu->addAction(StdActions::self()->stopAfterCurrentTrackAction); - trayItemMenu->addAction(StdActions::self()->nextTrackAction); - trayItem->setContextMenu(trayItemMenu); - trayItem->setStatus(KStatusNotifierItem::Active); - trayItemMenu->addSeparator(); - trayItemMenu->addAction(connectionsAction); - trayItemMenu->addAction(outputsAction); - trayItemMenu->addSeparator(); - trayItemMenu->addAction(mw->restoreAction); - trayItemMenu->addSeparator(); - trayItemMenu->addAction(copyAction(mw->quitAction)); - - connect(trayItem, SIGNAL(scrollRequested(int, Qt::Orientation)), this, SLOT(trayItemScrollRequested(int, Qt::Orientation))); - connect(trayItem, SIGNAL(secondaryActivateRequested(const QPoint &)), mw, SLOT(playPauseTrack())); - connect(trayItem, SIGNAL(activateRequested(bool, const QPoint &)), this, SLOT(clicked())); - #else // What systems DONT have a system tray? Also, isSytemTrayAvailable is checked in config dialog, so // useSystemTray should not be set if there is none. // Checking here seems to cause the icon not to appear if Cantata is autostarted in Plasma5 - #759 @@ -215,30 +181,8 @@ void TrayItem::setup() trayItem->show(); connect(trayItem, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(trayItemClicked(QSystemTrayIcon::ActivationReason))); #endif - #endif } -#ifdef ENABLE_KDE_SUPPORT -void TrayItem::clicked() -{ - if (mw->isHidden()) { - mw->restoreWindow(); - } else { - mw->hideWindow(); - } -} - -void TrayItem::trayItemScrollRequested(int delta, Qt::Orientation orientation) -{ - if (Qt::Vertical==orientation) { - if (delta>0) { - StdActions::self()->increaseVolumeAction->trigger(); - } else if(delta<0) { - StdActions::self()->decreaseVolumeAction->trigger(); - } - } -} -#else void TrayItem::trayItemClicked(QSystemTrayIcon::ActivationReason reason) { #ifdef Q_OS_MAC @@ -260,7 +204,6 @@ void TrayItem::trayItemClicked(QSystemTrayIcon::ActivationReason reason) } #endif } -#endif void TrayItem::songChanged(const Song &song, bool isPlaying) { @@ -289,14 +232,7 @@ void TrayItem::songChanged(const Song &song, bool isPlaying) } if (trayItem) { - #ifdef ENABLE_KDE_SUPPORT - trayItem->setToolTip("cantata", i18n("Cantata"), text); - - // Use the cover as icon pixmap. - if (CurrentCover::self()->isValid() && !CurrentCover::self()->image().isNull()) { - trayItem->setToolTipIconByPixmap(QPixmap::fromImage(CurrentCover::self()->image())); - } - #elif defined Q_OS_WIN || defined Q_OS_MAC || !defined QT_QTDBUS_FOUND + #if defined Q_OS_WIN || defined Q_OS_MAC || !defined QT_QTDBUS_FOUND trayItem->setToolTip(i18n("Cantata")+"\n\n"+text); // The pure Qt implementation needs both the tray icon and the setting checked. if (Settings::self()->showPopups() && isPlaying) { @@ -304,7 +240,7 @@ void TrayItem::songChanged(const Song &song, bool isPlaying) } #else trayItem->setToolTip(i18n("Cantata")+"\n\n"+text); - #endif // ENABLE_KDE_SUPPORT + #endif } #ifdef QT_QTDBUS_FOUND if (Settings::self()->showPopups() && isPlaying) { @@ -315,11 +251,7 @@ void TrayItem::songChanged(const Song &song, bool isPlaying) } #endif } else if (trayItem) { - #ifdef ENABLE_KDE_SUPPORT - trayItem->setToolTip("cantata", i18n("Cantata"), QString()); - #else trayItem->setToolTip(i18n("Cantata")); - #endif } } #endif diff --git a/gui/trayitem.h b/gui/trayitem.h index e9ea7f5b0..73107496c 100644 --- a/gui/trayitem.h +++ b/gui/trayitem.h @@ -25,14 +25,9 @@ #define TRAYITEM_H #include -#ifdef ENABLE_KDE_SUPPORT -#include -class KMenu; -#else #include #include "support/icon.h" class QMenu; -#endif #include "config.h" #ifdef QT_QTDBUS_FOUND @@ -58,13 +53,6 @@ public: void setToolTip(const QString &, const QString &, const QString &) { } #else bool isActive() const { return 0!=trayItem; } - #ifdef ENABLE_KDE_SUPPORT - void setIconByName(const QString &name) { - if (trayItem) { - trayItem->setIconByName(name); - } - } - #else void setIcon(const QIcon &icon) { if (trayItem) { trayItem->setIcon(icon); @@ -73,39 +61,24 @@ public: #endif void setToolTip(const QString &iconName, const QString &title, const QString &subTitle) { if (trayItem) { - #ifdef ENABLE_KDE_SUPPORT - trayItem->setToolTip(iconName, title, subTitle); - #else Q_UNUSED(iconName) Q_UNUSED(subTitle) trayItem->setToolTip(title); - #endif } } - #endif void songChanged(const Song &song, bool isPlaying); void updateConnections(); void updateOutputs(); private Q_SLOTS: - #ifdef ENABLE_KDE_SUPPORT - void clicked(); - void trayItemScrollRequested(int delta, Qt::Orientation orientation); - #else void trayItemClicked(QSystemTrayIcon::ActivationReason reason); - #endif private: #ifndef Q_OS_MAC MainWindow *mw; - #ifdef ENABLE_KDE_SUPPORT - KStatusNotifierItem *trayItem; - KMenu *trayItemMenu; - #else QSystemTrayIcon *trayItem; QMenu *trayItemMenu; - #endif #ifdef QT_QTDBUS_FOUND Notify *notification; #endif diff --git a/http/httpserver.h b/http/httpserver.h index 833d92b34..53b46d376 100644 --- a/http/httpserver.h +++ b/http/httpserver.h @@ -37,7 +37,7 @@ class QTimer; class HttpServer : public QObject { - #if defined ENABLE_HTTP_SERVER || defined ENABLE_KDE_SUPPORT + #if defined ENABLE_HTTP_SERVER Q_OBJECT #endif diff --git a/http/httpsocket.cpp b/http/httpsocket.cpp index efe0dc174..89eaacdd5 100644 --- a/http/httpsocket.cpp +++ b/http/httpsocket.cpp @@ -38,9 +38,6 @@ #if QT_VERSION >= 0x050000 #include #endif -#ifdef ENABLE_KDE_SUPPORT -#include -#endif #include #if defined TAGLIB_FOUND && !defined ENABLE_EXTERNAL_TAGS #include "tags/tags.h" @@ -50,12 +47,6 @@ static QString detectMimeType(const QString &file) { - #ifdef ENABLE_KDE_SUPPORT - QString km=KMimeType::findByPath(file)->name(); - if (!km.isEmpty() && (km.startsWith("audio/") || km.startsWith("application/"))) { - return QLatin1String("audio/x-ape")==km ? QLatin1String("audio/x-monkeys-audio") : km; - } - #endif QString suffix = QFileInfo(file).suffix().toLower(); if (suffix == QLatin1String("mp3")) { return QLatin1String("audio/mpeg"); diff --git a/models/actionmodel.cpp b/models/actionmodel.cpp index 92dfad895..ac7b4b0be 100644 --- a/models/actionmodel.cpp +++ b/models/actionmodel.cpp @@ -25,18 +25,9 @@ #include "gui/stdactions.h" #include "roles.h" -#ifdef ENABLE_UBUNTU -static const int Role_HasChildren = Qt::UserRole+500; -#endif - QVariant ActionModel::data(const QModelIndex &index, int role) const { QVariant v; - #ifdef ENABLE_UBUNTU - if (Role_HasChildren==role) { - return rowCount(index)>0; - } - #else Q_UNUSED(index) switch(role) { case Cantata::Role_Actions: @@ -49,20 +40,6 @@ QVariant ActionModel::data(const QModelIndex &index, int role) const default: break; } - #endif return v; } -#ifdef ENABLE_UBUNTU -//Expose role names, so that they can be accessed via QML -QHash ActionModel::roleNames() const -{ - QHash roles; - roles[Cantata::Role_MainText] = "mainText"; - roles[Cantata::Role_SubText] = "subText"; - roles[Cantata::Role_TitleText] = "titleText"; - roles[Cantata::Role_Image] = "image"; - roles[Role_HasChildren] = "hasChildren"; - return roles; -} -#endif diff --git a/models/actionmodel.h b/models/actionmodel.h index 837c4e249..11b9e7084 100644 --- a/models/actionmodel.h +++ b/models/actionmodel.h @@ -39,10 +39,6 @@ public: virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; virtual void resetModel() { beginResetModel(); endResetModel(); } - #ifdef ENABLE_UBUNTU - QHash roleNames() const; - virtual QStringList filenames(const QModelIndexList &indexes, bool allowPlaylists=false) const { Q_UNUSED(indexes) Q_UNUSED(allowPlaylists) return QStringList(); } - #endif }; Q_DECLARE_METATYPE(QList) diff --git a/models/devicesmodel.cpp b/models/devicesmodel.cpp index d68f4b817..4741c8325 100644 --- a/models/devicesmodel.cpp +++ b/models/devicesmodel.cpp @@ -48,16 +48,6 @@ #include #include #include -#ifdef ENABLE_KDE_SUPPORT -#include -#include -#include -#include -#include -#include -#include -#include -#else #include "solid-lite/device.h" #include "solid-lite/deviceinterface.h" #include "solid-lite/devicenotifier.h" @@ -66,7 +56,6 @@ #include "solid-lite/storagedrive.h" #include "solid-lite/storagevolume.h" #include "solid-lite/opticaldisc.h" -#endif #if defined ENABLE_MODEL_TEST #include "modeltest.h" #endif diff --git a/models/mpdsearchmodel.cpp b/models/mpdsearchmodel.cpp index 6383cef06..e44217297 100644 --- a/models/mpdsearchmodel.cpp +++ b/models/mpdsearchmodel.cpp @@ -34,9 +34,7 @@ MpdSearchModel::MpdSearchModel(QObject *parent) connect(this, SIGNAL(search(QString,QString,int)), MPDConnection::self(), SLOT(search(QString,QString,int))); connect(MPDConnection::self(), SIGNAL(searchResponse(int,QList)), this, SLOT(searchFinished(int,QList))); connect(MPDConnection::self(), SIGNAL(rating(QString,quint8)), SLOT(ratingResult(QString,quint8))); - #ifndef ENABLE_UBUNTU connect(Covers::self(), SIGNAL(loaded(Song,int)), this, SLOT(coverLoaded(Song,int))); - #endif } MpdSearchModel::~MpdSearchModel() @@ -102,9 +100,6 @@ void MpdSearchModel::searchFinished(int id, const QList &result) void MpdSearchModel::coverLoaded(const Song &song, int s) { Q_UNUSED(s) - #ifdef ENABLE_UBUNTU - Q_UNUSED(song) - #else if (!song.isArtistImageRequest() && !song.isComposerImageRequest()) { int row=0; foreach (const Song &s, songList) { @@ -115,7 +110,6 @@ void MpdSearchModel::coverLoaded(const Song &song, int s) row++; } } - #endif } void MpdSearchModel::ratingResult(const QString &file, quint8 r) diff --git a/models/musiclibrarymodel.cpp b/models/musiclibrarymodel.cpp index 3d9b97b60..68babbf00 100644 --- a/models/musiclibrarymodel.cpp +++ b/models/musiclibrarymodel.cpp @@ -169,7 +169,6 @@ QVariant MusicLibraryModel::data(const QModelIndex &index, int role) const MusicLibraryItem *item = static_cast(index.internalPointer()); switch (role) { - #ifndef ENABLE_UBUNTU case Qt::DecorationRole: switch (item->itemType()) { case MusicLibraryItem::Type_Root: @@ -183,7 +182,6 @@ QVariant MusicLibraryModel::data(const QModelIndex &index, int role) const default: return QVariant(); } - #endif case Cantata::Role_BriefMainText: if (MusicLibraryItem::Type_Album==item->itemType()) { return item->data(); @@ -239,17 +237,6 @@ QVariant MusicLibraryModel::data(const QModelIndex &index, int role) const default: return false; } - #ifdef ENABLE_UBUNTU - case Cantata::Role_Image: - switch (item->itemType()) { - case MusicLibraryItem::Type_Album: - return static_cast(item)->cover(); - case MusicLibraryItem::Type_Artist: - return static_cast(item)->cover(); - default: - return QString(); - } - #endif case Cantata::Role_CoverSong: { QVariant v; switch (item->itemType()) { diff --git a/models/playlistsmodel.cpp b/models/playlistsmodel.cpp index b8da332ad..26feb19ae 100644 --- a/models/playlistsmodel.cpp +++ b/models/playlistsmodel.cpp @@ -53,7 +53,6 @@ #include "modeltest.h" #endif -#ifndef ENABLE_UBUNTU QString PlaylistsModel::headerText(int col) { switch (col) { @@ -68,17 +67,14 @@ QString PlaylistsModel::headerText(int col) default: return QString(); } } -#endif GLOBAL_STATIC(PlaylistsModel, instance) PlaylistsModel::PlaylistsModel(QObject *parent) : ActionModel(parent) , multiCol(false) - #ifndef ENABLE_UBUNTU , itemMenu(0) , dropAdjust(0) - #endif { icn=Icon(QStringList() << "playlist" << "view-media-playlist" << "audio-x-mp3-playlist" << "audio-x-generic"); connect(MPDConnection::self(), SIGNAL(stateChanged(bool)), SLOT(mpdConnectionStateChanged(bool))); @@ -95,14 +91,12 @@ PlaylistsModel::PlaylistsModel(QObject *parent) connect(this, SIGNAL(addToPlaylist(const QString &, const QStringList, quint32, quint32)), MPDConnection::self(), SLOT(addToPlaylist(const QString &, const QStringList, quint32, quint32))); connect(this, SIGNAL(moveInPlaylist(const QString &, const QList &, quint32, quint32)), MPDConnection::self(), SLOT(moveInPlaylist(const QString &, const QList &, quint32, quint32))); - #ifndef ENABLE_UBUNTU connect(Covers::self(), SIGNAL(loaded(Song,int)), this, SLOT(coverLoaded(Song,int))); newAction=new QAction(Icon("document-new"), i18n("New Playlist..."), this); connect(newAction, SIGNAL(triggered()), this, SIGNAL(addToNew())); Action::initIcon(newAction); alignments[COL_TITLE]=alignments[COL_ARTIST]=alignments[COL_ALBUM]=alignments[COL_GENRE]=alignments[COL_COMPOSER]=alignments[COL_PERFORMER]=int(Qt::AlignVCenter|Qt::AlignLeft); alignments[COL_LENGTH]=alignments[COL_YEAR]=int(Qt::AlignVCenter|Qt::AlignRight); - #endif #if defined ENABLE_MODEL_TEST new ModelTest(this, this); #endif @@ -110,12 +104,10 @@ PlaylistsModel::PlaylistsModel(QObject *parent) PlaylistsModel::~PlaylistsModel() { - #ifndef ENABLE_UBUNTU if (itemMenu) { itemMenu->deleteLater(); itemMenu=0; } - #endif } QString PlaylistsModel::name() const @@ -216,7 +208,6 @@ QModelIndex PlaylistsModel::index(int row, int col, const QModelIndex &parent) c return row(index.internalPointer()); @@ -287,10 +275,6 @@ QVariant PlaylistsModel::data(const QModelIndex &index, int role) const PlaylistItem *pl=static_cast(item); switch(role) { - #ifdef ENABLE_UBUNTU - case Cantata::Role_Image: - return QString(); - #endif case Cantata::Role_ListImage: return false; case Cantata::Role_IsCollection: @@ -358,10 +342,8 @@ QVariant PlaylistsModel::data(const QModelIndex &index, int role) const return 0==pl->songs.count() ? pl->visibleName() : pl->visibleName()+"\n"+Plurals::tracksWithDuration(pl->songs.count(), Utils::formatTime(pl->totalTime())); - #ifndef ENABLE_UBUNTU case Qt::DecorationRole: return multiCol ? QVariant() : (pl->isSmartPlaylist ? Icons::self()->dynamicRuleIcon : Icons::self()->playlistListIcon); - #endif case Cantata::Role_SubText: if (!pl->loaded) { pl->loaded=true; @@ -380,10 +362,6 @@ QVariant PlaylistsModel::data(const QModelIndex &index, int role) const SongItem *s=static_cast(item); switch (role) { - #ifdef ENABLE_UBUNTU - case Cantata::Role_Image: - return QString(); - #endif case Cantata::Role_ListImage: return true; case Cantata::Role_IsCollection: @@ -480,10 +458,8 @@ QVariant PlaylistsModel::data(const QModelIndex &index, int role) const return QVariant(); } return s->toolTip(); - #ifndef ENABLE_UBUNTU case Qt::DecorationRole: return multiCol ? QVariant() : (s->title.isEmpty() ? Icons::self()->streamIcon : Icons::self()->audioListIcon); - #endif case Cantata::Role_MainText: return s->title.isEmpty() ? s->name().isEmpty() ? s->file : s->name() : s->title; case Cantata::Role_SubText: @@ -498,7 +474,6 @@ QVariant PlaylistsModel::data(const QModelIndex &index, int role) const return QVariant(); } -#ifndef ENABLE_UBUNTU bool PlaylistsModel::setData(const QModelIndex &index, const QVariant &value, int role) { if (Cantata::Role_DropAdjust==role) { @@ -508,7 +483,6 @@ bool PlaylistsModel::setData(const QModelIndex &index, const QVariant &value, in return QAbstractItemModel::setData(index, value, role); } } -#endif Qt::ItemFlags PlaylistsModel::flags(const QModelIndex &index) const { @@ -582,7 +556,6 @@ QList PlaylistsModel::songs(const QModelIndexList &indexes) const return songs; } -#ifndef ENABLE_UBUNTU static const QLatin1String constPlaylistNameMimeType("cantata/playlistnames"); static const QLatin1String constPositionsMimeType("cantata/positions"); static const char *constPlaylistProp="hasPlaylist"; @@ -712,7 +685,6 @@ QStringList PlaylistsModel::mimeTypes() const types << PlayQueueModel::constFileNameMimeType; return types; } -#endif void PlaylistsModel::getPlaylists() { @@ -727,7 +699,6 @@ void PlaylistsModel::clear() endResetModel(); } -#ifndef ENABLE_UBUNTU MirrorMenu * PlaylistsModel::menu() { if (!itemMenu) { @@ -735,7 +706,6 @@ MirrorMenu * PlaylistsModel::menu() } return itemMenu; } -#endif void PlaylistsModel::setPlaylists(const QList &playlists) { @@ -749,14 +719,8 @@ void PlaylistsModel::setPlaylists(const QList &playlists) } endResetModel(); updateItemMenu(); - #ifdef ENABLE_UBUNTU - emit updated(); - #endif } else if (playlists.isEmpty()) { clear(); - #ifdef ENABLE_UBUNTU - emit updated(); - #endif } else { QModelIndex parent=QModelIndex(); QSet existing; @@ -809,9 +773,6 @@ void PlaylistsModel::setPlaylists(const QList &playlists) if (added.count() || removed.count()) { updateItemMenu(); - #ifdef ENABLE_UBUNTU - emit updated(); - #endif } } } @@ -944,9 +905,6 @@ void PlaylistsModel::mpdConnectionStateChanged(bool connected) void PlaylistsModel::coverLoaded(const Song &song, int s) { Q_UNUSED(s) - #ifdef ENABLE_UBUNTU - Q_UNUSED(song) - #else if (!song.isArtistImageRequest() && !song.isComposerImageRequest()) { int plRow=0; foreach (const PlaylistItem *pl, items) { @@ -965,12 +923,10 @@ void PlaylistsModel::coverLoaded(const Song &song, int s) plRow++; } } - #endif } void PlaylistsModel::updateItemMenu(bool create) { - #ifndef ENABLE_UBUNTU if (!itemMenu) { if (!create) { return; @@ -990,7 +946,6 @@ void PlaylistsModel::updateItemMenu(bool create) foreach (const QString &n, names) { itemMenu->addAction(n, this, SLOT(emitAddToExisting())); } - #endif } PlaylistsModel::PlaylistItem * PlaylistsModel::getPlaylist(const QString &name) diff --git a/models/playlistsmodel.h b/models/playlistsmodel.h index 3b4039ed4..ca6118623 100644 --- a/models/playlistsmodel.h +++ b/models/playlistsmodel.h @@ -110,26 +110,20 @@ public: QModelIndex parent(const QModelIndex &index) const; QModelIndex index(int row, int col, const QModelIndex &parent) const; QVariant data(const QModelIndex &, int) const; - #ifndef ENABLE_UBUNTU QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role = Qt::EditRole); bool setData(const QModelIndex &index, const QVariant &value, int role); - #endif Qt::ItemFlags flags(const QModelIndex &index) const; Qt::DropActions supportedDropActions() const; QStringList filenames(const QModelIndexList &indexes, bool filesOnly=false) const; QList songs(const QModelIndexList &indexes) const; - #ifndef ENABLE_UBUNTU QMimeData * mimeData(const QModelIndexList &indexes) const; bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int /*col*/, const QModelIndex &parent); QStringList mimeTypes() const; - #endif void getPlaylists(); void clear(); bool exists(const QString &n) { return 0!=getPlaylist(n); } - #ifndef ENABLE_UBUNTU MirrorMenu * menu(); - #endif static QString strippedText(QString s); void setMultiColumn(bool m) { multiCol=m; } @@ -170,12 +164,10 @@ private: bool multiCol; QList items; QSet usedKeys; - #ifndef ENABLE_UBUNTU MirrorMenu *itemMenu; quint32 dropAdjust; QAction *newAction; QMap alignments; - #endif }; #endif diff --git a/models/playqueuemodel.cpp b/models/playqueuemodel.cpp index cb6f45892..92c65b351 100644 --- a/models/playqueuemodel.cpp +++ b/models/playqueuemodel.cpp @@ -69,7 +69,6 @@ GLOBAL_STATIC(PlayQueueModel, instance) -#ifndef ENABLE_UBUNTU const QLatin1String PlayQueueModel::constMoveMimeType("cantata/move"); const QLatin1String PlayQueueModel::constFileNameMimeType("cantata/filename"); const QLatin1String PlayQueueModel::constUriMimeType("text/uri-list"); @@ -187,7 +186,6 @@ QString PlayQueueModel::headerText(int col) default: return QString(); } } -#endif PlayQueueModel::PlayQueueModel(QObject *parent) : QAbstractItemModel(parent) @@ -197,16 +195,10 @@ PlayQueueModel::PlayQueueModel(QObject *parent) , mpdState(MPDState_Inactive) , stopAfterCurrent(false) , stopAfterTrackId(-1) - #ifdef ENABLE_UBUNTU - , undoLimit(0) - #else , undoLimit(Settings::self()->undoSteps()) - #endif , undoEnabled(undoLimit>0) , lastCommand(Cmd_Other) - #ifndef ENABLE_UBUNTU , dropAdjust(0) - #endif { fetcher=new StreamFetcher(this); connect(this, SIGNAL(modelReset()), this, SLOT(stats())); @@ -238,11 +230,6 @@ PlayQueueModel::PlayQueueModel(QObject *parent) new ModelTest(this, this); #endif - #ifdef ENABLE_UBUNTU - connect(Covers::self(), SIGNAL(cover(const Song &, const QImage &, const QString &)), this, - SLOT(setCover(const Song &, const QImage &, const QString &))); - #else - UNITY_MENU_ICON_CHECK removeDuplicatesAction=new Action(i18n("Remove Duplicates"), this); removeDuplicatesAction->setEnabled(false); @@ -280,7 +267,6 @@ PlayQueueModel::PlayQueueModel(QObject *parent) alignments[COL_TITLE]=alignments[COL_ARTIST]=alignments[COL_ALBUM]=alignments[COL_GENRE]=alignments[COL_COMPOSER]=alignments[COL_PERFORMER]=int(Qt::AlignVCenter|Qt::AlignLeft); alignments[COL_TRACK]=alignments[COL_LENGTH]=alignments[COL_DISC]=alignments[COL_YEAR]=alignments[COL_PRIO]=int(Qt::AlignVCenter|Qt::AlignRight); alignments[COL_RATING]=int(Qt::AlignVCenter|Qt::AlignHCenter); - #endif } PlayQueueModel::~PlayQueueModel() @@ -298,7 +284,6 @@ QModelIndex PlayQueueModel::parent(const QModelIndex &idx) const return QModelIndex(); } -#ifndef ENABLE_UBUNTU QVariant PlayQueueModel::headerData(int section, Qt::Orientation orientation, int role) const { if (Qt::Horizontal==orientation) { @@ -348,7 +333,6 @@ bool PlayQueueModel::setHeaderData(int section, Qt::Orientation orientation, con } return false; } -#endif int PlayQueueModel::rowCount(const QModelIndex &idx) const { @@ -370,21 +354,6 @@ static QString basicPath(const Song &song) return -1==marker ? path : path.left(marker); } -#ifdef ENABLE_UBUNTU -static const QString constDefaultCover=QLatin1String("qrc:/album.svg"); - -//Expose role names, so that they can be accessed via QML -QHash PlayQueueModel::roleNames() const -{ - QHash roles; - roles[Cantata::Role_MainText] = "mainText"; - roles[Cantata::Role_SubText] = "subText"; - roles[Cantata::Role_Image] = "image"; - roles[Cantata::Role_Time] = "time"; - return roles; -} -#endif - QVariant PlayQueueModel::data(const QModelIndex &index, int role) const { if (!index.isValid() && Cantata::Role_RatingCol==role) { @@ -408,22 +377,6 @@ QVariant PlayQueueModel::data(const QModelIndex &index, int role) const const Song &s=songs.at(index.row()); return s.time>0 ? Utils::formatTime(s.time) : QLatin1String(""); } - #ifdef ENABLE_UBUNTU - case Cantata::Role_Image: { - Song s=songs.at(index.row()); - QMap::ConstIterator it=covers.find(s.key); - if (it!=covers.constEnd()) { - return it.value().isEmpty() ? constDefaultCover : it.value(); - } - QString fileName=Covers::self()->requestImage(s).fileName; - covers.insert(s.key, fileName); - if (fileName.isEmpty()) { - coverRequests.insert(s.key, s); - return constDefaultCover; - } - return fileName; - } - #endif case Cantata::Role_IsCollection: return false; case Cantata::Role_CollectionId: @@ -611,7 +564,6 @@ QVariant PlayQueueModel::data(const QModelIndex &index, int role) const return s.toolTip(); } } - #ifndef ENABLE_UBUNTU case Qt::TextAlignmentRole: return alignments[index.column()]; case Cantata::Role_Decoration: { @@ -628,7 +580,6 @@ QVariant PlayQueueModel::data(const QModelIndex &index, int role) const } break; } - #endif default: break; } @@ -636,7 +587,6 @@ QVariant PlayQueueModel::data(const QModelIndex &index, int role) const return QVariant(); } -#ifndef ENABLE_UBUNTU bool PlayQueueModel::setData(const QModelIndex &index, const QVariant &value, int role) { if (Cantata::Role_DropAdjust==role) { @@ -646,7 +596,6 @@ bool PlayQueueModel::setData(const QModelIndex &index, const QVariant &value, in return QAbstractItemModel::setData(index, value, role); } } -#endif Qt::DropActions PlayQueueModel::supportedDropActions() const { @@ -661,7 +610,6 @@ Qt::ItemFlags PlayQueueModel::flags(const QModelIndex &index) const return Qt::ItemIsDropEnabled; } -#ifndef ENABLE_UBUNTU /** * @return A QStringList with the mimetypes we support */ @@ -733,18 +681,13 @@ bool PlayQueueModel::dropMimeData(const QMimeData *data, } return false; } -#endif void PlayQueueModel::load(const QStringList &urls) { - #ifdef ENABLE_UBUNTU - Q_UNUSED(urls) - #else QStringList useable=parseUrls(urls, false); if (useable.count()) { addItems(useable, songs.count(), songs.isEmpty(), 0); } - #endif } void PlayQueueModel::addItems(const QStringList &items, int row, int action, quint8 priority) @@ -922,24 +865,15 @@ void PlayQueueModel::update(const QList &songList, bool isComplete) currentSongRowNum=-1; if (songList.isEmpty()) { Song::clearKeyStore(MPDParseUtils::Loc_PlayQueue); - #ifdef ENABLE_UBUNTU - covers.clear(); - coverRequests.clear(); - #endif } - #ifndef ENABLE_UBUNTU removeDuplicatesAction->setEnabled(songList.count()>1); - #endif QList prev; if (undoEnabled) { prev=songs; } QSet newIds; - #ifdef ENABLE_UBUNTU - QSet currentKeys; - #endif foreach (const Song &s, songList) { newIds.insert(s.id); } @@ -957,12 +891,6 @@ void PlayQueueModel::update(const QList &songList, bool isComplete) if (songList.isEmpty()) { stopAfterTrackId=-1; } - - #ifdef ENABLE_UBUNTU - foreach (const Song &s, songs) { - currentKeys.insert(s.key); - } - #endif } else { time = 0; @@ -986,9 +914,6 @@ void PlayQueueModel::update(const QList &songList, bool isComplete) if (-1==existingPos) { beginInsertRows(QModelIndex(), i, i); songs.insert(i, s); - #ifdef ENABLE_UBUNTU - currentKeys.insert(s.key); - #endif endInsertRows(); } else { beginMoveRows(QModelIndex(), existingPos, existingPos, QModelIndex(), i>existingPos ? i+1 : i); @@ -996,22 +921,13 @@ void PlayQueueModel::update(const QList &songList, bool isComplete) // old.pos=s.pos; s.rating=old.rating; songs.insert(i, isEmpty ? old : s); - #ifdef ENABLE_UBUNTU - currentKeys.insert(isEmpty ? old.key : s.key); - #endif endMoveRows(); } } else if (isEmpty) { s=currentSongAtPos; - #ifdef ENABLE_UBUNTU - currentKeys.insert(s.key); - #endif } else { s.key=currentSongAtPos.key; s.rating=currentSongAtPos.rating; - #ifdef ENABLE_UBUNTU - currentKeys.insert(s.key); - #endif songs.replace(i, s); if (s.title!=currentSongAtPos.title || s.artist!=currentSongAtPos.artist || s.name()!=currentSongAtPos.name()) { emit dataChanged(index(i, 0), index(i, columnCount(QModelIndex())-1)); @@ -1041,18 +957,8 @@ void PlayQueueModel::update(const QList &songList, bool isComplete) } saveHistory(prev); - #ifdef ENABLE_UBUNTU - QSet removedKeys=covers.keys().toSet()-currentKeys; - if (!removedKeys.isEmpty()) { - foreach (quint16 k, removedKeys) { - covers.remove(k); - coverRequests.remove(k); - } - } - #else shuffleAction->setEnabled(songs.count()>1); sortAction->setEnabled(songs.count()>1); - #endif } void PlayQueueModel::setStopAfterTrack(qint32 track) @@ -1150,9 +1056,7 @@ void PlayQueueModel::enableUndo(bool e) undoStack.clear(); redoStack.clear(); } - #ifndef ENABLE_UBUNTU controlActions(); - #endif } static PlayQueueModel::UndoItem getState(const QList &songs) @@ -1231,13 +1135,10 @@ void PlayQueueModel::saveHistory(const QList &prevList) } } - #ifndef ENABLE_UBUNTU controlActions(); - #endif lastCommand=Cmd_Other; } -#ifndef ENABLE_UBUNTU void PlayQueueModel::controlActions() { undoAction->setEnabled(!undoStack.isEmpty()); @@ -1310,11 +1211,9 @@ static bool titleSort(const Song *s1, const Song *s2) int c=s1->title.localeAwareCompare(s2->title); return c<0 || (c==0 && (*s1)<(*s2)); } -#endif void PlayQueueModel::sortBy() { - #ifndef ENABLE_UBUNTU Action *act=qobject_cast(sender()); if (act) { QString key=act->property(constSortByKey).toString(); @@ -1347,7 +1246,6 @@ void PlayQueueModel::sortBy() } emit setOrder(positions); } - #endif } void PlayQueueModel::removeDuplicates() @@ -1401,60 +1299,6 @@ void PlayQueueModel::stickerDbChanged() } } -void PlayQueueModel::setCover(const Song &song, const QImage &img, const QString &file) -{ - Q_UNUSED(img) - #ifdef ENABLE_UBUNTU - if (file.isEmpty() || coverRequests.isEmpty()) { - return; - } - - // In case of multi-disc albums we will have multiple 'keys' mapped to a single artist+album combo. - // Therefore, we need to find all keys that have this mapping. - // - // Also, library and albums models might have requested the cover at the same time as playqueue, in which - // case the incomming song would have no key set - QList keys; - QMap::ConstIterator it=coverRequests.constBegin(); - QMap::ConstIterator end=coverRequests.constEnd(); - for (; it!=end; ++it) { - if (song.albumArtist()==it.value().albumArtist() && song.album==it.value().album) { - keys.append(it.key()); - } - } - - foreach (quint16 key, keys) { - coverRequests.remove(key); - QMap::ConstIterator it=covers.find(key); - if (it!=covers.end() && it.value().isEmpty()) { - coverRequests.remove(it.key()); - covers[key]="file://"+file; - int start=-1; - int end=-1; - for (int i=0; i priority; }; - #ifndef ENABLE_UBUNTU static const QLatin1String constMoveMimeType; static const QLatin1String constFileNameMimeType; static const QLatin1String constUriMimeType; @@ -82,7 +81,6 @@ public: static QStringList decode(const QMimeData &mimeData, const QString &mime); static QList decodeInts(const QMimeData &mimeData, const QString &mime); static QString headerText(int col); - #endif static PlayQueueModel * self(); @@ -90,19 +88,12 @@ public: ~PlayQueueModel(); QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const; QModelIndex parent(const QModelIndex &idx) const; - #ifndef ENABLE_UBUNTU QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role = Qt::EditRole); - #endif int rowCount(const QModelIndex &parent = QModelIndex()) const; int columnCount(const QModelIndex &) const { return COL_COUNT; } - #ifdef ENABLE_UBUNTU - QHash roleNames() const; - #endif QVariant data(const QModelIndex &, int) const; - #ifndef ENABLE_UBUNTU bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); - #endif void updateCurrentSong(quint32 id); qint32 getIdByRow(qint32 row) const; qint32 getSongId(const QString &file) const; @@ -112,11 +103,9 @@ public: Song getSongById(qint32 id) const; Qt::DropActions supportedDropActions() const; Qt::ItemFlags flags(const QModelIndex &index) const; - #ifndef ENABLE_UBUNTU QStringList mimeTypes() const; QMimeData *mimeData(const QModelIndexList &indexes) const; bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent); - #endif QStringList filenames(); void clear(); qint32 currentSong() const { return currentSongId; } @@ -130,13 +119,11 @@ public: void remove(const QList &rowsToRemove); void crop(const QList &rowsToKeep); void setRating(const QList &rows, quint8 rating) const; - #ifndef ENABLE_UBUNTU Action * shuffleAct() { return shuffleAction; } Action * removeDuplicatesAct() { return removeDuplicatesAction; } Action * sortAct() { return sortAction; } Action * undoAct() { return undoAction; } Action * redoAct() { return redoAction; } - #endif void enableUndo(bool e); bool lastCommandWasUnodOrRedo() const { return Cmd_Other!=lastCommand; } qint32 totalTime() const { return time; } @@ -167,8 +154,6 @@ private Q_SLOTS: void removeDuplicates(); void ratingResult(const QString &file, quint8 r); void stickerDbChanged(); - // Touch version... - void setCover(const Song &song, const QImage &img, const QString &file); Q_SIGNALS: void stop(bool afterCurrent); @@ -213,10 +198,6 @@ private: Command lastCommand; QStack undoStack; QStack redoStack; - #ifdef ENABLE_UBUNTU - mutable QMap covers; - mutable QMap coverRequests; - #else quint32 dropAdjust; Action *removeDuplicatesAction; Action *undoAction; @@ -224,7 +205,6 @@ private: Action *shuffleAction; Action *sortAction; QMap alignments; - #endif }; #endif diff --git a/models/playqueueproxymodel.cpp b/models/playqueueproxymodel.cpp index 7ddbefeaf..5aa4406c3 100644 --- a/models/playqueueproxymodel.cpp +++ b/models/playqueueproxymodel.cpp @@ -49,7 +49,6 @@ bool PlayQueueProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &sou return index.isValid() && matchesFilter(*static_cast(index.internalPointer())); } -#ifndef ENABLE_UBUNTU QMimeData *PlayQueueProxyModel::mimeData(const QModelIndexList &indexes) const { QModelIndexList sourceIndexes; @@ -66,4 +65,3 @@ bool PlayQueueProxyModel::dropMimeData(const QMimeData *data, Qt::DropAction act const QModelIndex sourceIndex = mapToSource(index(row, column, parent)); return sourceModel()->dropMimeData(data, action, sourceIndex.row(), sourceIndex.column(), sourceIndex.parent()); } -#endif diff --git a/models/playqueueproxymodel.h b/models/playqueueproxymodel.h index 178ed82ab..bced49483 100644 --- a/models/playqueueproxymodel.h +++ b/models/playqueueproxymodel.h @@ -38,10 +38,8 @@ public: PlayQueueProxyModel(QObject *parent = 0); bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const; - #ifndef ENABLE_UBUNTU QMimeData *mimeData(const QModelIndexList &indexes) const; bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent); - #endif }; #endif diff --git a/models/proxymodel.cpp b/models/proxymodel.cpp index 8afe3afb2..16ae31e98 100644 --- a/models/proxymodel.cpp +++ b/models/proxymodel.cpp @@ -22,9 +22,7 @@ */ #include "proxymodel.h" -#ifndef ENABLE_UBUNTU #include "gui/settings.h" -#endif #include #include #include @@ -187,7 +185,6 @@ QModelIndexList ProxyModel::mapToSource(const QModelIndexList &list, bool leaves return mapped; } -#ifndef ENABLE_UBUNTU QMimeData * ProxyModel::mimeData(const QModelIndexList &indexes) const { QModelIndexList nodes=leaves(indexes); @@ -197,7 +194,6 @@ QMimeData * ProxyModel::mimeData(const QModelIndexList &indexes) const } return sourceModel()->mimeData(sourceIndexes); } -#endif QModelIndexList ProxyModel::leaves(const QModelIndexList &list) const { diff --git a/models/proxymodel.h b/models/proxymodel.h index c5af32103..44a1f6b2e 100644 --- a/models/proxymodel.h +++ b/models/proxymodel.h @@ -51,9 +51,7 @@ public: QList mapToSourceRows(const QModelIndexList &list) const; QModelIndex mapToSource(const QModelIndex &idx) const { return QSortFilterProxyModel::mapToSource(idx); } QModelIndexList mapToSource(const QModelIndexList &list, bool leavesOnly=true) const; - #ifndef ENABLE_UBUNTU QMimeData * mimeData(const QModelIndexList &indexes) const; - #endif QModelIndexList leaves(const QModelIndexList &list) const; protected: diff --git a/models/searchmodel.cpp b/models/searchmodel.cpp index 1cee71bdd..6efac0e7f 100644 --- a/models/searchmodel.cpp +++ b/models/searchmodel.cpp @@ -39,7 +39,6 @@ #include "modeltest.h" #endif -#ifndef ENABLE_UBUNTU QString SearchModel::headerText(int col) { switch (col) { @@ -57,17 +56,14 @@ QString SearchModel::headerText(int col) default: return QString(); } } -#endif SearchModel::SearchModel(QObject *parent) : ActionModel(parent) , multiCol(false) { - #ifndef ENABLE_UBUNTU alignments[COL_TITLE]=alignments[COL_ARTIST]=alignments[COL_ALBUM]=alignments[COL_GENRE]=alignments[COL_COMPOSER]=alignments[COL_PERFORMER]=int(Qt::AlignVCenter|Qt::AlignLeft); alignments[COL_TRACK]=alignments[COL_LENGTH]=alignments[COL_DISC]=alignments[COL_YEAR]=int(Qt::AlignVCenter|Qt::AlignRight); alignments[COL_RATING]=int(Qt::AlignVCenter|Qt::AlignHCenter); - #endif } SearchModel::~SearchModel() @@ -90,7 +86,6 @@ QModelIndex SearchModel::parent(const QModelIndex &index) const return QModelIndex(); } -#ifndef ENABLE_UBUNTU QVariant SearchModel::headerData(int section, Qt::Orientation orientation, int role) const { if (Qt::Horizontal==orientation) { @@ -138,7 +133,6 @@ bool SearchModel::setHeaderData(int section, Qt::Orientation orientation, const } return false; } -#endif int SearchModel::rowCount(const QModelIndex &parent) const { @@ -158,7 +152,6 @@ QVariant SearchModel::data(const QModelIndex &index, int role) const } switch (role) { - #ifndef ENABLE_UBUNTU case Qt::DecorationRole: if (multiCol) { return QVariant(); @@ -170,7 +163,6 @@ QVariant SearchModel::data(const QModelIndex &index, int role) const : Icons::self()->audioListIcon; case Qt::TextAlignmentRole: return alignments[index.column()]; - #endif case Qt::DisplayRole: if (multiCol) { switch (index.column()) { @@ -295,7 +287,6 @@ QList SearchModel::songs(const QModelIndexList &indexes, bool allowPlaylis return list; } -#ifndef ENABLE_UBUNTU QMimeData * SearchModel::mimeData(const QModelIndexList &indexes) const { QMimeData *mimeData = new QMimeData(); @@ -309,7 +300,6 @@ QStringList SearchModel::mimeTypes() const types << PlayQueueModel::constFileNameMimeType; return types; } -#endif void SearchModel::refresh() { diff --git a/models/searchmodel.h b/models/searchmodel.h index ba1ddfcbc..10fe2942e 100644 --- a/models/searchmodel.h +++ b/models/searchmodel.h @@ -58,10 +58,8 @@ public: ~SearchModel(); QModelIndex index(int, int, const QModelIndex & = QModelIndex()) const; QModelIndex parent(const QModelIndex &) const; - #ifndef ENABLE_UBUNTU QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role = Qt::EditRole); - #endif int rowCount(const QModelIndex &parent = QModelIndex()) const; int columnCount(const QModelIndex &) const { return COL_COUNT; } QVariant data(const QModelIndex &, int) const; @@ -69,10 +67,8 @@ public: QStringList filenames(const QModelIndexList &indexes, bool allowPlaylists=false) const; QList songs(const QModelIndexList &indexes, bool allowPlaylists=false) const; - #ifndef ENABLE_UBUNTU QMimeData * mimeData(const QModelIndexList &indexes) const; QStringList mimeTypes() const; - #endif void refresh(); virtual void clear(); @@ -94,9 +90,7 @@ protected: QList songList; QString currentKey; QString currentValue; - #ifndef ENABLE_UBUNTU QMap alignments; - #endif }; #endif diff --git a/models/streamsmodel.cpp b/models/streamsmodel.cpp index d38d147ac..1ffe6a581 100644 --- a/models/streamsmodel.cpp +++ b/models/streamsmodel.cpp @@ -24,9 +24,6 @@ #include "streamsmodel.h" #include "mpd-interface/mpdconnection.h" #include "mpd-interface/mpdparseutils.h" -#include - -#ifndef CANTATA_WEB #include "widgets/icons.h" #include "network/networkaccessmanager.h" #include "support/localize.h" @@ -56,6 +53,7 @@ #include #include #include +#include #if QT_VERSION >= 0x050000 #include #include @@ -1880,8 +1878,6 @@ QModelIndex StreamsModel::categoryIndex(const CategoryItem *cat) const return -1==row ? QModelIndex() : createIndex(row, 0, (void *)cat); } -#endif // ifndef CANTATA_WEB - const QString StreamsModel::constPrefix=QLatin1String("cantata-stream-"); QString StreamsModel::modifyUrl(const QString &u, bool addPrefix, const QString &name) diff --git a/models/streamsmodel.h b/models/streamsmodel.h index de7505d1c..f8e416ef6 100644 --- a/models/streamsmodel.h +++ b/models/streamsmodel.h @@ -27,8 +27,6 @@ #include "config.h" #include - -#ifndef CANTATA_WEB #include "actionmodel.h" #include "mpd-interface/stream.h" #include "mpd-interface/playlist.h" @@ -331,25 +329,4 @@ private: Icon icn; }; -#elif defined ENABLE_KDE_SUPPORT -#include -class StreamsModel : public QObject -{ - Q_OBJECT -public: - static const QString constPrefix; - static const QString constPlayListName; - static QString modifyUrl(const QString &u, bool addPrefix=true, const QString &name=QString()); - static bool validProtocol(const QString &file); -}; -#else -namespace StreamsModel -{ - extern const QString constPrefix; - extern const QString constPlayListName; - extern QString modifyUrl(const QString &u, bool addPrefix=true, const QString &name=QString()); - extern bool validProtocol(const QString &file); -} - -#endif // ifndef CANTATA_WEB #endif diff --git a/models/streamsproxymodel.h b/models/streamsproxymodel.h index 0f0f782ce..8fee0815e 100644 --- a/models/streamsproxymodel.h +++ b/models/streamsproxymodel.h @@ -26,7 +26,6 @@ #include "proxymodel.h" - class StreamsProxyModel : public ProxyModel { public: diff --git a/mpd-interface/cuefile.cpp b/mpd-interface/cuefile.cpp index e5fb338d0..4b465a249 100644 --- a/mpd-interface/cuefile.cpp +++ b/mpd-interface/cuefile.cpp @@ -24,9 +24,7 @@ #include "cuefile.h" #include "mpdconnection.h" #include "support/utils.h" -#if !defined ENABLE_UBUNTU && !defined CANTATA_WEB #include "gui/settings.h" -#endif #include #include #include @@ -208,7 +206,6 @@ static const QList & codecList() codecs.append(codec); } - #if !defined ENABLE_UBUNTU && !defined CANTATA_WEB QStringList configCodecs=Settings::self()->cueFileCodecs(); foreach (const QString &cfg, configCodecs) { codec=QTextCodec::codecForName(cfg.toLatin1()); @@ -216,7 +213,6 @@ static const QList & codecList() codecs.append(codec); } } - #endif } return codecs; } diff --git a/mpd-interface/mpdconnection.cpp b/mpd-interface/mpdconnection.cpp index 864a61c0d..b797fa84f 100644 --- a/mpd-interface/mpdconnection.cpp +++ b/mpd-interface/mpdconnection.cpp @@ -26,18 +26,14 @@ #include "mpdconnection.h" #include "mpdparseutils.h" -#ifndef CANTATA_WEB #include "models/streamsmodel.h" -#endif #ifdef ENABLE_SIMPLE_MPD_SUPPORT #include "mpduser.h" #include "gui/settings.h" #endif #include "support/localize.h" #include "support/globalstatic.h" -#if !defined ENABLE_UBUNTU && !defined CANTATA_WEB #include "support/configuration.h" -#endif #include #include #include @@ -87,10 +83,8 @@ static const QByteArray constIdleOutputValue("output"); static const QByteArray constIdleStickerValue("sticker"); static const QByteArray constIdleSubscriptionValue("subscription"); static const QByteArray constIdleMessageValue("message"); -#ifndef CANTATA_WEB static const QByteArray constDynamicIn("cantata-dynamic-in"); static const QByteArray constDynamicOut("cantata-dynamic-out"); -#endif static const QByteArray constRatingSticker("rating"); static inline int socketTimeout(int dataSize) @@ -274,12 +268,10 @@ MPDConnection::MPDConnection() #if (defined Q_OS_LINUX && defined QT_QTDBUS_FOUND) || (defined Q_OS_MAC && defined IOKIT_FOUND) connect(PowerManagement::self(), SIGNAL(resuming()), this, SLOT(reconnect())); #endif - #if !defined ENABLE_UBUNTU && !defined CANTATA_WEB Configuration cfg; maxFilesPerAddCommand=cfg.get("mpdListSize", 10000, 100, 65535); seekStep=cfg.get("seekStep", 5, 2, 60); MPDParseUtils::setSingleTracksFolders(cfg.get("singleTracksFolders", QStringList()).toSet()); - #endif } MPDConnection::~MPDConnection() @@ -379,10 +371,8 @@ MPDConnection::ConnectionReturn MPDConnection::connectToMPD(MpdSocket &socket, b } if (enableIdle) { - #ifndef CANTATA_WEB dynamicId.clear(); setupRemoteDynamic(); - #endif connect(&socket, SIGNAL(readyRead()), this, SLOT(idleDataReady()), Qt::QueuedConnection); connect(&socket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(onSocketStateChanged(QAbstractSocket::SocketState)), Qt::QueuedConnection); DBUG << (void *)(&socket) << "Enabling idle"; @@ -609,12 +599,7 @@ void MPDConnection::setDetails(const MPDConnectionDetails &d) emit stateChanged(true); break; default: - #ifdef CANTATA_WEB - qWarning() << "Could not connect to MPD" << details.hostname << details.port; - ::exit(-1); - #else emit error(errorString(status), true); - #endif } } else if (diffName) { emit stateChanged(true); @@ -1525,16 +1510,13 @@ void MPDConnection::parseIdleReturn(const QByteArray &data) outputs(); } else if (constIdleStickerValue==value) { emit stickerDbChanged(); - } - #ifndef CANTATA_WEB - else if (constIdleSubscriptionValue==value) { + } else if (constIdleSubscriptionValue==value) { //if (dynamicId.isEmpty()) { setupRemoteDynamic(); //} } else if (constIdleMessageValue==value) { readRemoteDynamicMessages(); } - #endif } } @@ -1860,7 +1842,6 @@ void MPDConnection::sendClientMessage(const QString &channel, const QString &msg void MPDConnection::sendDynamicMessage(const QStringList &msg) { - #ifndef CANTATA_WEB // Check whether cantata-dynamic is still alive, by seeing if its channel is still open... if (1==msg.count() && QLatin1String("ping")==msg.at(0)) { Response response=sendCommand("channels"); @@ -1888,9 +1869,6 @@ void MPDConnection::sendDynamicMessage(const QStringList &msg) if (!sendCommand("sendmessage "+constDynamicIn+" "+data).ok) { emit dynamicSupport(false); } - #else - Q_UNUSED(msg) - #endif } void MPDConnection::moveInPlaylist(const QString &name, const QList &items, quint32 pos, quint32 size) @@ -2039,7 +2017,6 @@ QStringList MPDConnection::getAllFiles(const QString &dir) return files; } -#ifndef CANTATA_WEB bool MPDConnection::checkRemoteDynamicSupport() { if (ver>=CANTATA_MAKE_VERSION(0,17,0)) { @@ -2124,8 +2101,6 @@ void MPDConnection::readRemoteDynamicMessages() } } -#endif - int MPDConnection::getVolume() { Response response=sendCommand("status"); diff --git a/mpd-interface/mpdconnection.h b/mpd-interface/mpdconnection.h index c23f4892c..294f86846 100644 --- a/mpd-interface/mpdconnection.h +++ b/mpd-interface/mpdconnection.h @@ -405,12 +405,10 @@ private: bool recursivelyListDir(const QString &dir, QList &songs); QStringList getPlaylistFiles(const QString &name); QStringList getAllFiles(const QString &dir); - #ifndef CANTATA_WEB bool checkRemoteDynamicSupport(); bool subscribe(const QByteArray &channel); void setupRemoteDynamic(); void readRemoteDynamicMessages(); - #endif bool fadingVolume(); bool startVolumeFade(); void stopVolumeFade(); @@ -435,9 +433,7 @@ private: MpdSocket sock; MpdSocket idleSocket; QTimer *connTimer; - #ifndef CANTATA_WEB QByteArray dynamicId; - #endif // The three items are used so that we can do quick playqueue updates... QList playQueueIds; diff --git a/mpd-interface/mpdparseutils.cpp b/mpd-interface/mpdparseutils.cpp index 69d189e27..ee4037738 100644 --- a/mpd-interface/mpdparseutils.cpp +++ b/mpd-interface/mpdparseutils.cpp @@ -29,10 +29,8 @@ #include #include #include -#ifndef CANTATA_WEB #include "online/onlineservice.h" #include "online/podcastservice.h" -#endif #include "mpdparseutils.h" #include "mpdstatus.h" #include "mpdstats.h" @@ -109,10 +107,8 @@ static const QByteArray constStatusBitrateKey("bitrate: "); static const QByteArray constStatusAudioKey("audio: "); static const QByteArray constStatusUpdatingDbKey("updating_db: "); static const QByteArray constStatusErrorKey("error: "); -#ifndef CANTATA_WEB static const QByteArray constChannel("channel: "); static const QByteArray constMessage("message: "); -#endif static const QByteArray constOkValue("OK"); static const QByteArray constSetValue("1"); @@ -411,13 +407,9 @@ Song MPDParseUtils::parseSong(const QList &lines, Location location) } } } else { - #ifndef CANTATA_WEB if (OnlineService::decode(song)) { modifiedFile=true; - } - else - #endif - { + } else { QString name=getAndRemoveStreamName(song.file); if (!name.isEmpty()) { song.setName(name); @@ -440,13 +432,11 @@ Song MPDParseUtils::parseSong(const QList &lines, Location location) song.file=origFile; song.setKey(location); - #ifndef CANTATA_WEB // Check for downloaded podcasts played via local file playback if (Song::OnlineSvrTrack!=song.type && PodcastService::isPodcastFile(song.file)) { song.setIsFromOnlineService(PodcastService::constName); song.albumartist=song.artist=PodcastService::constName; } - #endif } return song; } @@ -537,7 +527,6 @@ QStringList MPDParseUtils::parseList(const QByteArray &data, const QByteArray &k return items; } -#ifndef CANTATA_WEB MPDParseUtils::MessageMap MPDParseUtils::parseMessages(const QByteArray &data) { MPDParseUtils::MessageMap messages; @@ -557,7 +546,6 @@ MPDParseUtils::MessageMap MPDParseUtils::parseMessages(const QByteArray &data) } return messages; } -#endif void MPDParseUtils::parseDirItems(const QByteArray &data, const QString &mpdDir, long mpdVersion, QList &songList, const QString &dir, QStringList &subDirs, Location loc) { diff --git a/mpd-interface/mpdparseutils.h b/mpd-interface/mpdparseutils.h index f2040de12..8492bc29e 100644 --- a/mpd-interface/mpdparseutils.h +++ b/mpd-interface/mpdparseutils.h @@ -80,10 +80,8 @@ namespace MPDParseUtils extern QList parseSongs(const QByteArray &data, Location location); extern QList parseChanges(const QByteArray &data); extern QStringList parseList(const QByteArray &data, const QByteArray &key); - #ifndef CANTATA_WEB typedef QMap MessageMap; extern MessageMap parseMessages(const QByteArray &data); - #endif extern void parseDirItems(const QByteArray &data, const QString &mpdDir, long mpdVersion, QList &songList, const QString &dir, QStringList &subDirs, Location loc); extern QList parseOuputs(const QByteArray &data); extern QByteArray parseSticker(const QByteArray &data, const QByteArray &sticker); diff --git a/mpd-interface/mpduser.cpp b/mpd-interface/mpduser.cpp index da5af6432..179f6d33c 100644 --- a/mpd-interface/mpduser.cpp +++ b/mpd-interface/mpduser.cpp @@ -52,7 +52,7 @@ QString MPDUser::translatedName() GLOBAL_STATIC(MPDUser, instance) -#if !defined Q_OS_WIN && !defined Q_OS_MAC && !defined ENABLE_UBUNTU +#if !defined Q_OS_WIN && !defined Q_OS_MAC static void moveConfig() { QString oldName=QDir::homePath()+"/.config/cantata/"+constDir+"/"+constConfigFile; @@ -70,7 +70,7 @@ static void moveConfig() MPDUser::MPDUser() { - #if !defined Q_OS_WIN && !defined Q_OS_MAC && !defined ENABLE_UBUNTU + #if !defined Q_OS_WIN && !defined Q_OS_MAC moveConfig(); #endif // For now, per-user MPD support is disabled for windows builds diff --git a/mpd-interface/song.cpp b/mpd-interface/song.cpp index bfd7513d8..29285f7f2 100644 --- a/mpd-interface/song.cpp +++ b/mpd-interface/song.cpp @@ -28,7 +28,7 @@ #include "config.h" #include "song.h" #include "support/localize.h" -#if !defined CANTATA_NO_UI_FUNCTIONS && !defined CANTATA_WEB +#if !defined CANTATA_NO_UI_FUNCTIONS #include "online/onlineservice.h" #endif #include @@ -500,7 +500,7 @@ QString Song::artistSong() const QString Song::trackAndTitleStr(bool showArtistIfDifferent) const { - #if !defined CANTATA_NO_UI_FUNCTIONS && !defined CANTATA_WEB + #if !defined CANTATA_NO_UI_FUNCTIONS if ((OnlineSvrTrack==type || Song::CantataStream) && OnlineService::showLogoAsCover(*this)) { return artistSong(); } @@ -684,7 +684,7 @@ bool Song::capitalise() QString Song::albumKey() const { - #if !defined CANTATA_NO_UI_FUNCTIONS && !defined CANTATA_WEB + #if !defined CANTATA_NO_UI_FUNCTIONS if ((OnlineSvrTrack==type || Song::CantataStream) && OnlineService::showLogoAsCover(*this)) { return onlineService(); } diff --git a/network/networkaccessmanager.cpp b/network/networkaccessmanager.cpp index 73bdb9550..ce539cb25 100644 --- a/network/networkaccessmanager.cpp +++ b/network/networkaccessmanager.cpp @@ -23,9 +23,7 @@ #include "networkaccessmanager.h" #include "networkproxyfactory.h" -#if !defined ENABLE_UBUNTU && !defined CANTATA_WEB #include "gui/settings.h" -#endif #include "config.h" #include "support/globalstatic.h" #include @@ -130,7 +128,7 @@ void NetworkJob::jobFinished() QVariant redirect = j->header(QNetworkRequest::LocationHeader); if (redirect.isValid() && ++numRedirects(j->manager())->get(QNetworkRequest(redirect.toUrl())); + QNetworkReply *newJob=static_cast(j->manager())->get(QNetworkRequest(redirect.toUrl())); DBUG << j->url().toString() << "redirected to" << newJob->url().toString(); cancelJob(); job=newJob; @@ -176,20 +174,12 @@ void NetworkJob::handleReadyRead() GLOBAL_STATIC(NetworkAccessManager, instance) NetworkAccessManager::NetworkAccessManager(QObject *parent) - : BASE_NETWORK_ACCESS_MANAGER(parent) + : QNetworkAccessManager(parent) { - #if defined ENABLE_UBUNTU || defined CANTATA_WEB - enabled=true; - #else enabled=Settings::self()->networkAccessEnabled(); - #endif - //#ifdef ENABLE_KDE_SUPPORT - // TODO: Not sure if NetworkProxyFactory is required if building KDE support - // with KIO::Integration::AccessManager. But, as we dont use that anyway... if (enabled) { NetworkProxyFactory::self(); } - //#endif } NetworkJob * NetworkAccessManager::get(const QNetworkRequest &req, int timeout) @@ -214,10 +204,10 @@ NetworkJob * NetworkAccessManager::get(const QNetworkRequest &req, int timeout) httpUrl.setScheme(QLatin1String("http")); request.setUrl(httpUrl); DBUG << "no ssl, use" << httpUrl.toString(); - reply = new NetworkJob(BASE_NETWORK_ACCESS_MANAGER::get(request)); + reply = new NetworkJob(QNetworkAccessManager::get(request)); reply->setOrigUrl(req.url()); } else { - reply = new NetworkJob(BASE_NETWORK_ACCESS_MANAGER::get(request)); + reply = new NetworkJob(QNetworkAccessManager::get(request)); } if (0!=timeout) { @@ -247,7 +237,7 @@ QNetworkReply * NetworkAccessManager::postFormData(QNetworkRequest req, const QB if (!data.isEmpty()) { req.setRawHeader("Content-Type", "application/x-www-form-urlencoded"); } - return BASE_NETWORK_ACCESS_MANAGER::post(req, data); + return QNetworkAccessManager::post(req, data); } else { return new FakeNetworkReply(); } diff --git a/network/networkaccessmanager.h b/network/networkaccessmanager.h index b3180dcee..a00a029be 100644 --- a/network/networkaccessmanager.h +++ b/network/networkaccessmanager.h @@ -24,15 +24,7 @@ #ifndef NETWORK_ACCESS_MANAGER_H #define NETWORK_ACCESS_MANAGER_H -// KIO is not thread safe, and we get segfaults if it is used in non-gui thread. -// Therefore, we dont use KIO::Integration::AccessManager :-( -//#ifdef ENABLE_KDE_SUPPORT -//#include -//#define BASE_NETWORK_ACCESS_MANAGER KIO::Integration::AccessManager -//#else #include -#define BASE_NETWORK_ACCESS_MANAGER QNetworkAccessManager -//#endif #include #include @@ -93,7 +85,7 @@ private: friend class NetworkAccessManager; }; -class NetworkAccessManager : public BASE_NETWORK_ACCESS_MANAGER +class NetworkAccessManager : public QNetworkAccessManager { Q_OBJECT diff --git a/replaygain/rgdialog.cpp b/replaygain/rgdialog.cpp index 9dbb5ef41..dd774b7ca 100644 --- a/replaygain/rgdialog.cpp +++ b/replaygain/rgdialog.cpp @@ -131,14 +131,7 @@ RgDialog::RgDialog(QWidget *parent) setMainWidget(mainWidget); setButtonGuiItem(Ok, StdGuiItem::save()); setButtonGuiItem(Cancel, StdGuiItem::close()); - setButtonGuiItem(User1, GuiItem(i18n("Scan"), - #ifdef ENABLE_KDE_SUPPORT - "edit-find" - #else - FontAwesome::search - #endif - )); - + setButtonGuiItem(User1, GuiItem(i18n("Scan"), FontAwesome::search)); enableButton(Ok, false); enableButton(User1, false); qRegisterMetaType("Tags::ReplayGain"); diff --git a/streams/streamspage.cpp b/streams/streamspage.cpp index f92f64b1b..0463d706c 100644 --- a/streams/streamspage.cpp +++ b/streams/streamspage.cpp @@ -41,12 +41,8 @@ #include "models/playqueuemodel.h" #include "digitallyimportedsettings.h" #include -#ifdef ENABLE_KDE_SUPPORT -#include -#else #include #include -#endif #include #include #if QT_VERSION >= 0x050000 @@ -257,12 +253,8 @@ void StreamsBrowsePage::diSettings() void StreamsBrowsePage::importXml() { - #ifdef ENABLE_KDE_SUPPORT - QString fileName=KFileDialog::getOpenFileName(KUrl(), i18n("*.xml *.xml.gz *.cantata|XML Streams"), this, i18n("Import Streams")); - #else QString fileName=QFileDialog::getOpenFileName(this, i18n("Import Streams"), QDir::homePath(), i18n("XML Streams (*.xml *.xml.gz *.cantata)")); - #endif if (fileName.isEmpty()) { return; @@ -273,11 +265,7 @@ void StreamsBrowsePage::importXml() void StreamsBrowsePage::exportXml() { QLatin1String ext(".xml.gz"); - #ifdef ENABLE_KDE_SUPPORT - QString fileName=KFileDialog::getSaveFileName(QLatin1String("streams")+ext, i18n("*.xml|XML Streams"), this, i18n("Export Streams")); - #else QString fileName=QFileDialog::getSaveFileName(this, i18n("Export Streams"), QDir::homePath()+QLatin1String("/streams")+ext, i18n("XML Streams (*.xml.gz)")); - #endif if (fileName.isEmpty()) { return; diff --git a/streams/streamssettings.cpp b/streams/streamssettings.cpp index 2c10d1320..31b3381f5 100644 --- a/streams/streamssettings.cpp +++ b/streams/streamssettings.cpp @@ -35,11 +35,7 @@ #include #include #include -#ifdef ENABLE_KDE_SUPPORT -#include -#else #include -#endif #include enum Roles { @@ -138,11 +134,7 @@ void StreamsSettings::currentCategoryChanged(int row) void StreamsSettings::installFromFile() { - #ifdef ENABLE_KDE_SUPPORT - QString fileName=KFileDialog::getOpenFileName(KUrl(), i18n("*.streams|Cantata Streams"), this, i18n("Install Streams")); - #else QString fileName=QFileDialog::getOpenFileName(this, i18n("Install Streams"), QDir::homePath(), i18n("Cantata Streams (*.streams)")); - #endif if (fileName.isEmpty()) { return; } diff --git a/support/acceleratormanager.h b/support/acceleratormanager.h index 5ac36474d..0e726acba 100644 --- a/support/acceleratormanager.h +++ b/support/acceleratormanager.h @@ -21,14 +21,6 @@ #ifndef K_ACCELERATORMANAGER_H #define K_ACCELERATORMANAGER_H -#ifdef ENABLE_KDE_SUPPORT -namespace AcceleratorManager -{ - inline void manage(QWidget *) { } -}; - -#else - class QWidget; class QString; @@ -77,6 +69,5 @@ public: */ static void setNoAccel( QWidget *widget ); }; -#endif #endif // K_ACCELERATORMANAGER_H diff --git a/support/action.cpp b/support/action.cpp index dc15a7911..4ec319ad2 100644 --- a/support/action.cpp +++ b/support/action.cpp @@ -28,27 +28,15 @@ #include Action::Action(QObject *parent) -#ifdef ENABLE_KDE_SUPPORT -: KAction(parent) -#else -: QAction(parent) -#endif + : QAction(parent) { - #ifndef ENABLE_KDE_SUPPORT init(); - #endif } Action::Action(const QString &text, QObject *parent, const QObject *receiver, const char *slot, const QKeySequence &shortcut) -#ifdef ENABLE_KDE_SUPPORT -: KAction(parent) -#else -: QAction(parent) -#endif + : QAction(parent) { - #ifndef ENABLE_KDE_SUPPORT init(); - #endif setText(text); setShortcut(shortcut); if(receiver && slot) @@ -56,15 +44,9 @@ Action::Action(const QString &text, QObject *parent, const QObject *receiver, co } Action::Action(const QIcon &icon, const QString &text, QObject *parent, const QObject *receiver, const char *slot, const QKeySequence &shortcut) -#ifdef ENABLE_KDE_SUPPORT -: KAction(parent) -#else -: QAction(parent) -#endif + : QAction(parent) { - #ifndef ENABLE_KDE_SUPPORT init(); - #endif setIcon(icon); setText(text); setShortcut(shortcut); @@ -74,11 +56,9 @@ Action::Action(const QIcon &icon, const QString &text, QObject *parent, const QO void Action::initIcon(QAction *act) { - #ifndef ENABLE_UBUNTU if (GtkStyle::isActive() && act) { act->setIconVisibleInMenu(false); } - #endif } static const char *constPlainToolTipProperty="plain-tt"; @@ -120,7 +100,6 @@ QString Action::settingsText(QAction *act) return Utils::stripAcceleratorMarkers(act->text()); } -#ifndef ENABLE_KDE_SUPPORT void Action::init() { connect(this, SIGNAL(triggered(bool)), this, SLOT(slotTriggered())); @@ -161,5 +140,3 @@ void Action::setShortcut(const QKeySequence &key, ShortcutTypes type) { if(type & ActiveShortcut) QAction::setShortcut(key); } - -#endif // !ENABLE_KDE_SUPPORT diff --git a/support/action.h b/support/action.h index f1291f24e..1b9d02d65 100644 --- a/support/action.h +++ b/support/action.h @@ -23,22 +23,6 @@ #ifndef ACTION_H_ #define ACTION_H_ -#ifdef ENABLE_KDE_SUPPORT -#include -class Action : public KAction { - Q_OBJECT - -public: - static void initIcon(QAction *act); - static void updateToolTip(QAction *act); - static QString settingsText(QAction *act); - static const char * constTtForSettings; - - explicit Action(QObject *parent); - Action(const QString &text, QObject *parent, const QObject *receiver = 0, const char *slot = 0, const QKeySequence &shortcut = 0); - Action(const QIcon &icon, const QString &text, QObject *parent, const QObject *receiver = 0, const char *slot = 0, const QKeySequence &shortcut = 0); -}; -#else #include #include @@ -87,6 +71,5 @@ private slots: }; Q_DECLARE_OPERATORS_FOR_FLAGS(Action::ShortcutTypes) -#endif #endif diff --git a/support/actioncollection.cpp b/support/actioncollection.cpp index 243fc6674..9e11fd1bc 100644 --- a/support/actioncollection.cpp +++ b/support/actioncollection.cpp @@ -24,6 +24,7 @@ #include "action.h" #include "icon.h" #include +#include static const char *constProp="Category"; static ActionCollection *coll=0; @@ -50,12 +51,11 @@ Action * ActionCollection::createAction(const QString &name, const QString &text Action *act = static_cast(addAction(name)); act->setText(text); if (0!=icon) { - #ifndef ENABLE_KDE_SUPPORT if ('m'==icon[0] && 'e'==icon[1] && 'd'==icon[2] && 'i'==icon[3] && 'a'==icon[4] && '-'==icon[5]) { act->setIcon(Icon::getMediaIcon(icon)); - } else - #endif - act->setIcon(Icon(icon)); + } else { + act->setIcon(Icon(icon)); + } } if (!whatsThis.isEmpty()) { act->setWhatsThis(whatsThis); @@ -89,10 +89,6 @@ void ActionCollection::updateToolTips() } } -#ifndef ENABLE_KDE_SUPPORT - -#include - ActionCollection::ActionCollection(QObject *parent) : QObject(parent) { _connectTriggered = _connectHovered = false; } @@ -350,5 +346,3 @@ bool ActionCollection::unlistAction(QAction *action) { return true; } - -#endif /* HAVE_KDE */ diff --git a/support/actioncollection.h b/support/actioncollection.h index 7914e63a6..51cd91a26 100644 --- a/support/actioncollection.h +++ b/support/actioncollection.h @@ -23,38 +23,15 @@ #ifndef ACTIONCOLLECTION_H_ #define ACTIONCOLLECTION_H_ -class Action; -class QIcon; - -#ifdef ENABLE_KDE_SUPPORT -#include - -class ActionCollection : public KActionCollection { - Q_OBJECT - -public: - explicit ActionCollection(QObject *parent) : KActionCollection(parent) {}; - - static void setMainWidget(QWidget *w); - static ActionCollection * get(); - Action * createAction(const QString &name, const QString &text, const char *icon=0, const QString &whatsThis=QString()); - Action * createAction(const QString &name, const QString &text, const QIcon &icon, const QString &whatsThis=QString()); - - void updateToolTips(); - -Q_SIGNALS: - void tooltipUpdated(QAction *); -}; - -#else - #include #include #include #include -class QWidget; +class Action; class QAction; +class QWidget; +class QIcon; class ActionCollection : public QObject { Q_OBJECT @@ -147,5 +124,3 @@ private: }; #endif - -#endif diff --git a/support/buddylabel.cpp b/support/buddylabel.cpp index 7ec8e7b2b..c1a02b919 100644 --- a/support/buddylabel.cpp +++ b/support/buddylabel.cpp @@ -22,9 +22,7 @@ */ #include "buddylabel.h" -#ifndef ENABLE_KDE_SUPPORT #include "pathrequester.h" -#endif #include #include #include @@ -60,13 +58,11 @@ bool BuddyLabel::event(QEvent *e) void BuddyLabel::mouseReleaseEvent(QMouseEvent *) { if (buddy() && buddy()->isEnabled()) { - #ifndef ENABLE_KDE_SUPPORT PathRequester *pr=qobject_cast(buddy()); if (pr) { pr->setFocus(); return; } - #endif buddy()->setFocus(); diff --git a/support/capacitybar.h b/support/capacitybar.h index 2c0c62cb5..20dc699de 100644 --- a/support/capacitybar.h +++ b/support/capacitybar.h @@ -24,25 +24,8 @@ #ifndef CAPACITY_BAR_H #define CAPACITY_BAR_H -#ifdef ENABLE_KDE_SUPPORT -#include - -class CapacityBar : public KCapacityBar -{ -public: - CapacityBar(QWidget *p) - : KCapacityBar(KCapacityBar::DrawTextInline, p) { - } - - void update(const QString &text, double value) { - setText(text); - setValue(value); - setDrawTextMode(KCapacityBar::DrawTextInline); - } -}; - -#else #include + class CapacityBar : public QProgressBar { public: @@ -56,6 +39,5 @@ public: setValue(value*100); } }; -#endif #endif diff --git a/support/combobox.cpp b/support/combobox.cpp index 41beceac2..e81eba077 100644 --- a/support/combobox.cpp +++ b/support/combobox.cpp @@ -33,11 +33,7 @@ static int maxPopupItemCount=-1; ComboBox::ComboBox(QWidget *p) - #ifdef ENABLE_KDE_SUPPORT - : KComboBox(p) - #else : QComboBox(p) - #endif , toggleState(false) { #if !defined Q_OS_WIN && !defined Q_OS_MAC @@ -107,14 +103,12 @@ void ComboBox::showPopup() } view()->parentWidget()->setGeometry(geo); - #ifndef ENABLE_KDE_SUPPORT // Hide scrollers - these look ugly... foreach (QObject *c, view()->parentWidget()->children()) { if (0==qstrcmp("QComboBoxPrivateScroller", c->metaObject()->className())) { static_cast(c)->setMaximumHeight(0); } } - #endif } } diff --git a/support/combobox.h b/support/combobox.h index 1945a1d8a..d0ce4939b 100644 --- a/support/combobox.h +++ b/support/combobox.h @@ -26,15 +26,7 @@ #include -#ifdef ENABLE_KDE_SUPPORT -#include -#endif -class ComboBox - #ifdef ENABLE_KDE_SUPPORT - : public KComboBox - #else - : public QComboBox - #endif +class ComboBox : public QComboBox { #if QT_VERSION >= 0x050000 Q_OBJECT diff --git a/support/configuration.cpp b/support/configuration.cpp index 763797873..94e6c58b2 100644 --- a/support/configuration.cpp +++ b/support/configuration.cpp @@ -26,24 +26,14 @@ QLatin1String Configuration::constMainGroup("General"); Configuration::Configuration(const QString &group) - #ifdef ENABLE_KDE_SUPPORT - : topCfg(KGlobal::config(), group) - #endif { - #ifdef ENABLE_KDE_SUPPORT - cfg=&topCfg; - #else if (group!=constMainGroup) { beginGroup(group); } - #endif } Configuration::~Configuration() { - #ifdef ENABLE_KDE_SUPPORT - endGroup(); - #endif } int Configuration::get(const QString &key, int def, int min, int max) @@ -70,23 +60,3 @@ QString Configuration::getDirPath(const QString &key, const QString &def) #endif } -#ifdef ENABLE_KDE_SUPPORT -void Configuration::beginGroup(const QString &group) -{ - if (group==constMainGroup) { - cfg=&topCfg; - } else { - cfg=new KConfigGroup(KGlobal::config(), group); - } -} - -void Configuration::endGroup() -{ - if (cfg!=&topCfg) { - cfg->sync(); - delete cfg; - } - cfg=&topCfg; -} -#endif - diff --git a/support/configuration.h b/support/configuration.h index 97710497c..98e8fe7f5 100644 --- a/support/configuration.h +++ b/support/configuration.h @@ -29,52 +29,16 @@ #include #include #include -#ifdef ENABLE_KDE_SUPPORT -#include -#include -#include -#else #include -#endif #include "utils.h" -class Configuration - #ifndef ENABLE_KDE_SUPPORT - : public QSettings - #endif +class Configuration : public QSettings { public: static QLatin1String constMainGroup; Configuration(const QString &group=constMainGroup); ~Configuration(); - #ifdef ENABLE_KDE_SUPPORT - QString get(const QString &key, const QString &def) { return cfg->readEntry(key, def); } - QStringList get(const QString &key, const QStringList &def) { return cfg->readEntry(key, def); } - bool get(const QString &key, bool def) { return cfg->readEntry(key, def); } - int get(const QString &key, int def) { return cfg->readEntry(key, def); } - unsigned int get(const QString &key, unsigned int def) { return cfg->readEntry(key, def); } - QByteArray get(const QString &key, const QByteArray &def) { return cfg->readEntry(key, def); } - QSize get(const QString &key, const QSize &def) { return cfg->readEntry(key, def); } - QDateTime get(const QString &key, const QDateTime &def) { return cfg->readEntry(key, def); } - void set(const QString &key, const QString &val) { if (!hasEntry(key) || get(key, val)!=val) cfg->writeEntry(key, val); } - void set(const QString &key, const char *val) { if (!hasEntry(key) || get(key, QLatin1String(val))!=QLatin1String(val)) cfg->writeEntry(key, val); } - void set(const QString &key, const QStringList &val) { if (!hasEntry(key) || get(key, val)!=val) cfg->writeEntry(key, val); } - void set(const QString &key, bool val) { if (!hasEntry(key) || get(key, val)!=val) cfg->writeEntry(key, val); } - void set(const QString &key, int val) { if (!hasEntry(key) || get(key, val)!=val) cfg->writeEntry(key, val); } - void set(const QString &key, unsigned int val) { if (!hasEntry(key) || get(key, val)!=val) cfg->writeEntry(key, val); } - void set(const QString &key, const QByteArray &val) { if (!hasEntry(key) || get(key, val)!=val) cfg->writeEntry(key, val); } - void set(const QString &key, const QSize &val) { if (!hasEntry(key) || get(key, val)!=val) cfg->writeEntry(key, val); } - void set(const QString &key, const QDateTime &val) { if (!hasEntry(key) || get(key, val)!=val) cfg->writeEntry(key, val); } - bool hasGroup(const QString &grp) { return KGlobal::config()->hasGroup(grp); } - void removeGroup(const QString &grp) { KGlobal::config()->deleteGroup(grp); } - bool hasEntry(const QString &key) { return cfg->hasKey(key); } - void removeEntry(const QString &key) { cfg->deleteEntry(key); } - void beginGroup(const QString &group); - void endGroup(); - QStringList childGroups() { return cfg->groupList(); } - void sync() { KGlobal::config()->sync(); } - #else QString get(const QString &key, const QString &def) { return contains(key) ? value(key).toString() : def; } QStringList get(const QString &key, const QStringList &def) { return contains(key) ? value(key).toStringList() : def; } bool get(const QString &key, bool def) { return contains(key) ? value(key).toBool() : def; } @@ -96,18 +60,11 @@ public: void removeGroup(const QString &grp) { remove(grp); } bool hasEntry(const QString &key) { return contains(key); } void removeEntry(const QString &key) { remove(key); } - #endif int get(const QString &key, int def, int min, int max); QString getFilePath(const QString &key, const QString &def); void setFilePath(const QString &key, const QString &val) { return set(key, Utils::homeToTilda(val)); } QString getDirPath(const QString &key, const QString &def); void setDirPath(const QString &key, const QString &val) { return set(key, Utils::homeToTilda(val)); } - -private: - #ifdef ENABLE_KDE_SUPPORT - KConfigGroup topCfg; - KConfigGroup *cfg; - #endif }; #endif diff --git a/support/dialog.cpp b/support/dialog.cpp index 56fb66c74..d2bbde8b5 100644 --- a/support/dialog.cpp +++ b/support/dialog.cpp @@ -28,21 +28,20 @@ #ifdef Q_OS_MAC #include "osxstyle.h" #endif - -#ifdef ENABLE_KDE_SUPPORT -#define DLG_BASE KDialog -#else -#define DLG_BASE QDialog -#endif +#include "icon.h" +#include "acceleratormanager.h" +#include +#include +#include +#include +#include Dialog::Dialog(QWidget *parent, const QString &name, const QSize &defSize) - : DLG_BASE(parent) - #ifndef ENABLE_KDE_SUPPORT + : QDialog(parent) , defButton(0) , buttonTypes(0) , mw(0) , buttonBox(0) - #endif , shown(false) { if (!name.isEmpty()) { @@ -50,9 +49,9 @@ Dialog::Dialog(QWidget *parent, const QString &name, const QSize &defSize) Configuration cfg(name); cfgSize=cfg.get("size", QSize()); if (!cfgSize.isEmpty()) { - DLG_BASE::resize(cfgSize); + QDialog::resize(cfgSize); } else if (!defSize.isEmpty()) { - DLG_BASE::resize(defSize); + QDialog::resize(defSize); } } #ifdef Q_OS_MAC @@ -74,54 +73,11 @@ Dialog::~Dialog() void Dialog::resize(const QSize &sz) { if (cfgSize.isEmpty()) { - DLG_BASE::resize(sz); + QDialog::resize(sz); cfgSize=sz; } } -#ifdef ENABLE_KDE_SUPPORT -#include -#include - -void Dialog::showEvent(QShowEvent *e) -{ - if (!shown) { - shown=true; - QSize mwSize=mainWidget()->minimumSize(); - - if (mwSize.width()<16 || mwSize.height()<16) { - mwSize=mainWidget()->minimumSizeHint(); - } - - if (mwSize.width()>15 && mwSize.height()>15) { - QSize btnSize(24, 32); - for (int i=0; i<15; ++i) { - int code=1<sizeHint(); - break; - } - } - QLayout *lay=layout(); - int sp=lay ? layout()->spacing() : KDialog::spacingHint(); - int mar=lay ? layout()->margin() : KDialog::marginHint(); - setMinimumHeight(qMax(minimumHeight(), btnSize.height()+sp+mwSize.height()+(2*mar))); - setMinimumWidth(qMax(minimumWidth(), mwSize.width()+(2*mar))); - } - } - KDialog::showEvent(e); -} -#else - -#include "icon.h" -#include "acceleratormanager.h" -#include -#include -#include -#include -#include - #ifdef Q_OS_MAC Dialog::ButtonProxyStyle::ButtonProxyStyle() : QProxyStyle() @@ -481,5 +437,3 @@ void Dialog::closeEvent(QCloseEvent *e) QDialog::closeEvent(e); } #endif - -#endif diff --git a/support/dialog.h b/support/dialog.h index ecc2e6561..0ad9cc04b 100644 --- a/support/dialog.h +++ b/support/dialog.h @@ -25,46 +25,6 @@ #define DIALOG_H #include "config.h" - -#ifdef ENABLE_KDE_SUPPORT -#include -#include -class Dialog : public KDialog { -public: - Dialog(QWidget *parent, const QString &name=QString(), const QSize &defSize=QSize()); - virtual ~Dialog(); - - const QSize & configuredSize() const { return cfgSize; } - void resize(int w, int h) { resize(QSize(w, h)); } - void resize(const QSize &sz); -private: - void showEvent(QShowEvent *e); -private: - QSize cfgSize; - bool shown; -}; -typedef KGuiItem GuiItem; -namespace StdGuiItem { - inline KGuiItem ok() { return KStandardGuiItem::ok(); } - inline KGuiItem cancel() { return KStandardGuiItem::cancel(); } - inline KGuiItem yes() { return KStandardGuiItem::yes(); } - inline KGuiItem no() { return KStandardGuiItem::no(); } - inline KGuiItem discard() { return KStandardGuiItem::discard(); } - inline KGuiItem save() { return KStandardGuiItem::save(); } - inline KGuiItem apply() { return KStandardGuiItem::apply(); } - inline KGuiItem close() { return KStandardGuiItem::close(); } - inline KGuiItem help() { return KStandardGuiItem::help(); } - inline KGuiItem overwrite() { return KStandardGuiItem::overwrite(); } - inline KGuiItem reset() { return KStandardGuiItem::reset(); } - inline KGuiItem cont() { return KStandardGuiItem::cont(); } - inline KGuiItem del() { return KStandardGuiItem::del(); } - inline KGuiItem stop() { return KStandardGuiItem::stop(); } - inline KGuiItem remove() { return KStandardGuiItem::remove(); } - inline KGuiItem back(bool useRtl=false) { return KStandardGuiItem::back(useRtl ? KStandardGuiItem::UseRTL : KStandardGuiItem::IgnoreRTL); } - inline KGuiItem forward(bool useRtl=false) { return KStandardGuiItem::forward(useRtl ? KStandardGuiItem::UseRTL : KStandardGuiItem::IgnoreRTL); } -}; - -#else #include #include #include @@ -203,5 +163,3 @@ private: Q_DECLARE_OPERATORS_FOR_FLAGS(Dialog::ButtonCodes) #endif - -#endif diff --git a/support/globalstatic.h b/support/globalstatic.h index 8c306e449..139d41e9a 100644 --- a/support/globalstatic.h +++ b/support/globalstatic.h @@ -26,21 +26,6 @@ #include -#ifdef ENABLE_KDE_SUPPORT - -#include -#define GLOBAL_STATIC(CLASS, VAR) \ - K_GLOBAL_STATIC(CLASS, VAR) \ - CLASS * CLASS::self() { return VAR; } - -#elif QT_VERSION >= 0x050100 || (QT_VERSION < 0x050000 && QT_VERSION >= 0x040800) - -#define GLOBAL_STATIC(CLASS, VAR) \ - Q_GLOBAL_STATIC(CLASS, VAR) \ - CLASS * CLASS::self() { return VAR(); } - -#else - #define GLOBAL_STATIC(CLASS, VAR) \ CLASS * CLASS::self() \ { \ @@ -52,5 +37,3 @@ } #endif - -#endif diff --git a/support/gtkproxystyle.cpp b/support/gtkproxystyle.cpp index db3d8d7fd..f6239c7d6 100644 --- a/support/gtkproxystyle.cpp +++ b/support/gtkproxystyle.cpp @@ -24,9 +24,7 @@ #include "gtkproxystyle.h" #include "gtkstyle.h" #include "shortcuthandler.h" -#ifndef ENABLE_KDE_SUPPORT #include "acceleratormanager.h" -#endif #include #include #include @@ -35,9 +33,7 @@ #include #include -#ifndef ENABLE_KDE_SUPPORT static const char * constAccelProp="catata-accel"; -#endif static inline void addEventFilter(QObject *object, QObject *filter) { @@ -72,12 +68,10 @@ int GtkProxyStyle::styleHint(StyleHint hint, const QStyleOption *option, const Q void GtkProxyStyle::polish(QWidget *widget) { - #ifndef ENABLE_KDE_SUPPORT if (widget && qobject_cast(widget) && !widget->property(constAccelProp).isValid()) { AcceleratorManager::manage(widget); widget->setProperty(constAccelProp, true); } - #endif TouchProxyStyle::polish(widget); } diff --git a/support/gtkstyle.cpp b/support/gtkstyle.cpp index 26677c163..0d1d8dff8 100644 --- a/support/gtkstyle.cpp +++ b/support/gtkstyle.cpp @@ -126,11 +126,9 @@ void GtkStyle::applyTheme(QWidget *widget) if (!proxyStyle && Utils::touchFriendly()) { proxyStyle=new TouchProxyStyle(modViewFrame); } - #ifndef ENABLE_KDE_SUPPORT if (!proxyStyle && modViewFrame) { proxyStyle=new ProxyStyle(modViewFrame); } - #endif if (proxyStyle) { qApp->setStyle(proxyStyle); } diff --git a/support/icon.cpp b/support/icon.cpp index 1f125d539..885dd0f5d 100644 --- a/support/icon.cpp +++ b/support/icon.cpp @@ -89,7 +89,6 @@ void Icon::init(QToolButton *btn, bool setFlat) } } -#ifndef ENABLE_KDE_SUPPORT Icon Icon::getMediaIcon(const QString &name) { static QList modes=QList() << QIcon::Normal << QIcon::Disabled << QIcon::Active << QIcon::Selected; @@ -107,7 +106,6 @@ Icon Icon::getMediaIcon(const QString &name) return icn; } -#endif Icon Icon::create(const QString &name, const QList &sizes, bool andSvg) { diff --git a/support/icon.h b/support/icon.h index 8e493492e..b1b8ea321 100644 --- a/support/icon.h +++ b/support/icon.h @@ -24,44 +24,23 @@ #ifndef ICON_H #define ICON_H -#ifdef ENABLE_KDE_SUPPORT -#include -#include -#include -#else #include -#endif class QToolButton; -class Icon : public - #ifdef ENABLE_KDE_SUPPORT - KIcon - #else - QIcon - #endif +class Icon : public QIcon { public: - #ifdef ENABLE_KDE_SUPPORT - explicit Icon(const QString &icon) : KIcon(icon) { } - Icon(const QIcon &i) : KIcon(i) { } - #else explicit Icon(const QString &icon) : QIcon(QIcon::fromTheme(icon)) { } Icon(const QIcon &i) : QIcon(i) { } - #endif Icon(const QStringList &names); Icon() { } static int stdSize(int s); static int dlgIconSize(); static void init(QToolButton *btn, bool setFlat=true); - #ifdef ENABLE_KDE_SUPPORT - static Icon getMediaIcon(const QString &name) { return Icon(name); } - static QString currentTheme() { return KIconLoader::global()->theme()->name(); } - #else static Icon getMediaIcon(const QString &name); static QString currentTheme() { return QIcon::themeName(); } - #endif static Icon create(const QString &name, const QList &sizes, bool andSvg=false); enum Std { diff --git a/support/kmessagewidget.cpp b/support/kmessagewidget.cpp index 45f67fd16..fa43a7bf6 100644 --- a/support/kmessagewidget.cpp +++ b/support/kmessagewidget.cpp @@ -20,17 +20,6 @@ #include "kmessagewidget.h" #include "localize.h" #include "utils.h" - -#ifdef ENABLE_KDE_SUPPORT -#include -#include -#include -#include -#include -#include -#include -#endif - #include "icon.h" #include "squeezedtextlabel.h" #include "flattoolbutton.h" @@ -105,14 +94,10 @@ void KMsgWidgetPrivate::init(KMsgWidget *q_ptr) textLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); textLabel->setTextInteractionFlags(Qt::TextBrowserInteraction); - #ifdef ENABLE_KDE_SUPPORT - KAction* closeAction = KStandardAction::close(q, SLOT(animatedHide()), q); - #else QAction* closeAction = new QAction(q); closeAction->setIcon(Icon::std(Icon::Close)); closeAction->setToolTip(i18n("Close")); QObject::connect(closeAction, SIGNAL(triggered()), q, SLOT(animatedHide())); - #endif closeButton = new FlatToolButton(content); closeButton->setDefaultAction(closeAction); @@ -243,19 +228,6 @@ int KMsgWidgetPrivate::bestContentHeight() const return height; } -#ifdef ENABLE_KDE_SUPPORT -void KMsgWidgetPrivate::updateAnimationDuration() -{ - if (!(KGlobalSettings::graphicEffectsLevel() & KGlobalSettings::SimpleAnimationEffects)) { - if (1!=timeLine->duration()) { - timeLine->setDuration(1); - } - } else if (500!=timeLine->duration()) { - timeLine->setDuration(500); - } -} -#endif - //--------------------------------------------------------------------- // KMsgWidget //--------------------------------------------------------------------- @@ -295,14 +267,6 @@ KMsgWidget::MessageType KMsgWidget::messageType() const return d->messageType; } -#ifdef ENABLE_KDE_SUPPORT -static void getColorsFromColorScheme(KColorScheme::BackgroundRole bgRole, QColor* bg, QColor* fg) -{ - KColorScheme scheme(QPalette::Active, KColorScheme::Window); - *bg = scheme.background(bgRole).color(); - *fg = scheme.foreground().color(); -} -#endif void KMsgWidget::setMessageType(KMsgWidget::MessageType type) { d->messageType = type; @@ -314,13 +278,9 @@ void KMsgWidget::setMessageType(KMsgWidget::MessageType type) if (useIcon) { icon = QIcon::fromTheme("dialog-ok"); } - #ifdef ENABLE_KDE_SUPPORT - getColorsFromColorScheme(KColorScheme::PositiveBackground, &bg1, &fg); - #else bg1=QColor(0xAB, 0xC7, 0xED); fg=Qt::black; border = Qt::blue; - #endif break; case Information: if (useIcon) { @@ -328,48 +288,31 @@ void KMsgWidget::setMessageType(KMsgWidget::MessageType type) } // There is no "information" background role in KColorScheme, use the // colors of highlighted items instead - #ifdef ENABLE_KDE_SUPPORT - bg1 = palette().highlight().color(); - fg = palette().highlightedText().color(); - border = bg1.darker(150); - #else bg1=QColor(0x98, 0xBC, 0xE3); fg=Qt::black; border = Qt::blue; - #endif break; case Warning: if (useIcon) { icon = QIcon::fromTheme("dialog-warning"); } - #ifdef ENABLE_KDE_SUPPORT - getColorsFromColorScheme(KColorScheme::NeutralBackground, &bg1, &fg); - #else bg1=QColor(0xED, 0xC6, 0x62); fg=Qt::black; border = Qt::red; - #endif break; case Error: if (useIcon) { icon = QIcon::fromTheme("dialog-error"); } - #ifdef ENABLE_KDE_SUPPORT - getColorsFromColorScheme(KColorScheme::NegativeBackground, &bg1, &fg); - #else bg1=QColor(0xeb, 0xbb, 0xbb); fg=Qt::black; border = Qt::red; - #endif break; } // Colors bg0 = bg1.lighter(110); bg2 = bg1.darker(110); - #ifdef ENABLE_KDE_SUPPORT - border = KColorScheme::shade(bg1, KColorScheme::DarkShade); - #endif d->content->setStyleSheet( QString(".QFrame {" @@ -377,9 +320,6 @@ void KMsgWidget::setMessageType(KMsgWidget::MessageType type) " stop: 0 %1," " stop: 0.1 %2," " stop: 1.0 %3);" - #ifdef ENABLE_KDE_SUPPORT - "border-radius: 5px;" - #endif "border: 1px solid %4;" "margin: %5px;" "}" @@ -396,11 +336,7 @@ void KMsgWidget::setMessageType(KMsgWidget::MessageType type) if (useIcon && !icon.isNull()) { // Icon - #ifdef ENABLE_KDE_SUPPORT - const int size = KIconLoader::global()->currentSize(KIconLoader::MainToolbar); - #else const int size = Icon::stdSize(fontMetrics().height()*1.5); - #endif d->iconLabel->setPixmap(icon.pixmap(size)); } } @@ -493,14 +429,6 @@ void KMsgWidget::removeAction(QAction* action) void KMsgWidget::animatedShow() { - #ifdef ENABLE_KDE_SUPPORT - //if (!(KGlobalSettings::graphicEffectsLevel() & KGlobalSettings::SimpleAnimationEffects)) { - // show(); - // return; - //} - d->updateAnimationDuration(); - #endif - if (isVisible()) { return; } @@ -520,14 +448,6 @@ void KMsgWidget::animatedShow() void KMsgWidget::animatedHide() { - #ifdef ENABLE_KDE_SUPPORT - //if (!(KGlobalSettings::graphicEffectsLevel() & KGlobalSettings::SimpleAnimationEffects)) { - // hide(); - // return; - //} - d->updateAnimationDuration(); - #endif - if (!isVisible()) { return; } diff --git a/support/kmessagewidget.h b/support/kmessagewidget.h index b72fad6ca..3696dd586 100644 --- a/support/kmessagewidget.h +++ b/support/kmessagewidget.h @@ -196,9 +196,6 @@ public: void slotTimeLineChanged(qreal); void slotTimeLineFinished(); int bestContentHeight() const; - #ifdef ENABLE_KDE_SUPPORT - void updateAnimationDuration(); - #endif }; #endif /* KMESSAGEWIDGET_H */ diff --git a/support/lineedit.cpp b/support/lineedit.cpp index 0cf71faa9..0458805d7 100644 --- a/support/lineedit.cpp +++ b/support/lineedit.cpp @@ -25,11 +25,7 @@ void LineEdit::setReadOnly(bool e) { - #ifdef ENABLE_KDE_SUPPORT - KLineEdit::setReadOnly(e); - #else QLineEdit::setReadOnly(e); - #endif if (e) { QPalette p(palette()); p.setColor(QPalette::Active, QPalette::Base, p.color(QPalette::Active, QPalette::Window)); @@ -41,7 +37,7 @@ void LineEdit::setReadOnly(bool e) } } -#if !defined ENABLE_KDE_SUPPORT && QT_VERSION < 0x050200 +#if QT_VERSION < 0x050200 /**************************************************************************** ** diff --git a/support/lineedit.h b/support/lineedit.h index d9ba398e9..022a2c517 100644 --- a/support/lineedit.h +++ b/support/lineedit.h @@ -43,27 +43,6 @@ public: void setReadOnly(bool e); }; -#else -#ifdef ENABLE_KDE_SUPPORT -#include -class LineEdit : public KLineEdit -{ -public: - LineEdit(QWidget *parent = 0) : KLineEdit(parent) { setClearButtonShown(true); } - virtual ~LineEdit() { } - void setReadOnly(bool e); -}; - -//#elif QT_VERSION >= 0x050200 -// -//class LineEdit : public QLineEdit -//{ -//public: -// LineEdit(QWidget *parent = 0) : QLineEdit(parent) { setClearButtonEnabled(true); } -// virtual ~LineEdit() { } -// void setReadOnly(bool e); -//}; - #else class QToolButton; @@ -86,7 +65,6 @@ private: QToolButton *clearButton; }; -#endif #endif #endif // LIENEDIT_H diff --git a/support/localize.h b/support/localize.h index 720c1a772..628386960 100644 --- a/support/localize.h +++ b/support/localize.h @@ -24,9 +24,6 @@ #ifndef LOCALIZE_H #define LOCALIZE_H -#ifdef ENABLE_KDE_SUPPORT -#include -#else #include inline QString i18n(const char *text) @@ -148,5 +145,3 @@ inline QString i18nc(const char *ctxt, const char *text, const A1 &a1, const A2 } #endif - -#endif diff --git a/support/messagebox.cpp b/support/messagebox.cpp index 5add928ca..abce546c0 100644 --- a/support/messagebox.cpp +++ b/support/messagebox.cpp @@ -31,7 +31,6 @@ #include #include #include -#ifndef ENABLE_KDE_SUPPORT #include #include @@ -114,11 +113,7 @@ MessageBox::ButtonCode MessageBox::questionYesNoCancel(QWidget *parent, const QS AcceleratorManager::manage(&box); return -1==box.exec() ? Cancel : map(box.standardButton(box.clickedButton())); } -#endif -#ifdef ENABLE_KDE_SUPPORT -void MessageBox::errorListEx(QWidget *parent, const QString &message, const QStringList &strlist, const QString &title) -#else namespace MessageBox { class YesNoListDialog : public Dialog @@ -140,24 +135,14 @@ public: } MessageBox::ButtonCode MessageBox::msgListEx(QWidget *parent, Type type, const QString &message, const QStringList &strlist, const QString &title) -#endif { - #ifdef ENABLE_KDE_SUPPORT - Dialog *dlg=new Dialog(parent); - #else MessageBox::YesNoListDialog *dlg=new MessageBox::YesNoListDialog(parent); - #endif dlg->setAttribute(Qt::WA_DeleteOnClose); QWidget *wid=new QWidget(dlg); QGridLayout *lay=new QGridLayout(wid); QLabel *iconLabel=new QLabel(wid); int iconSize=Icon::dlgIconSize(); iconLabel->setFixedSize(iconSize, iconSize); - #ifdef ENABLE_KDE_SUPPORT - dlg->setCaption(title.isEmpty() ? i18n("Error") : title); - dlg->setButtons(Dialog::Ok); - iconLabel->setPixmap(Icon("dialog-error").pixmap(iconSize, iconSize)); - #else switch(type) { case Error: dlg->setCaption(title.isEmpty() ? i18n("Error") : title); @@ -180,7 +165,6 @@ MessageBox::ButtonCode MessageBox::msgListEx(QWidget *parent, Type type, const Q iconLabel->setPixmap(Icon("dialog-information").pixmap(iconSize, iconSize)); break; } - #endif lay->addWidget(iconLabel, 0, 0, 1, 1); QLabel *msgLabel=new QLabel(message, wid); msgLabel->setWordWrap(true); @@ -194,9 +178,5 @@ MessageBox::ButtonCode MessageBox::msgListEx(QWidget *parent, Type type, const Q #ifdef Q_OS_MAC dlg->setWindowFlags((dlg->windowFlags()&(~Qt::WindowType_Mask))|Qt::Sheet); #endif - #ifdef ENABLE_KDE_SUPPORT - dlg->exec(); - #else return QDialog::Accepted==dlg->exec() ? Yes : No; - #endif } diff --git a/support/messagebox.h b/support/messagebox.h index cb16c04c0..5d368fe27 100644 --- a/support/messagebox.h +++ b/support/messagebox.h @@ -25,14 +25,8 @@ #define MESSAGEBOX_H #include "dialog.h" -#ifdef ENABLE_KDE_SUPPORT -#include -struct MessageBox: public KMessageBox { - static void errorListEx(QWidget *parent, const QString &message, const QStringList &strlist, const QString &title=QString()); -}; -#else -#include #include "localize.h" +#include namespace MessageBox { enum ButtonCode { @@ -87,6 +81,5 @@ namespace MessageBox { msgListEx(parent, Information, message, strlist, title); } } -#endif #endif diff --git a/support/messagewidget.cpp b/support/messagewidget.cpp index 131ba1c93..fa964ec0f 100644 --- a/support/messagewidget.cpp +++ b/support/messagewidget.cpp @@ -34,13 +34,6 @@ MessageWidget::~MessageWidget() { } -//#if defined ENABLE_KDE_SUPPORT -//#if KDE_IS_VERSION(4, 9, 4) && !KDE_IS_VERSION(4, 9, 5) -//// BUG:142 -//#define NO_ANIMATED_SHOW -//#endif -//#endif - void MessageWidget::setMessage(const QString &msg, MessageType type, bool showCloseButton) { if (isActive() && !msg.isEmpty() && type!=msgType) { diff --git a/support/messagewidget.h b/support/messagewidget.h index 255579999..6df0fc0a2 100644 --- a/support/messagewidget.h +++ b/support/messagewidget.h @@ -24,18 +24,7 @@ #ifndef MESSAGEWIDGET_H #define MESSAGEWIDGET_H -//#ifdef ENABLE_KDE_SUPPORT -//#include -//#if KDE_IS_VERSION(4, 7, 0) -//#include -//typedef KMessageWidget KMsgWidget; -//#else // KDE_IS_VERSION(4, 7, 0) -//#include "kmessagewidget.h" -//#endif // KDE_IS_VERSION(4, 7, 0) -//#else // ENABLE_KDE_SUPPORT #include "kmessagewidget.h" -//#endif // ENABLE_KDE_SUPPORT - #include class MessageWidget : public KMsgWidget diff --git a/support/pagewidget.cpp b/support/pagewidget.cpp index 9018d1f9e..22c7209e1 100644 --- a/support/pagewidget.cpp +++ b/support/pagewidget.cpp @@ -22,35 +22,6 @@ */ #include "pagewidget.h" - -//#ifdef ENABLE_KDE_SUPPORT -//PageWidget::PageWidget(QWidget *p, bool listView, bool headers) -// : KPageWidget(p) -// , showHeaders(headers) -//{ -// setFaceType(listView ? Tree : List); -// connect(this, SIGNAL(currentPageChanged(KPageWidgetItem *, KPageWidgetItem *)), this, SIGNAL(currentPageChanged())); -//} - -//PageWidgetItem * PageWidget::addPage(QWidget *widget, const QString &name, const Icon &icon, const QString &header) -//{ -// widget->adjustSize(); -// PageWidgetItem *item=KPageWidget::addPage(widget, name); -// item->setIcon(icon); -// item->setHeader(header); -// return item; -//} - -//QAbstractItemView * PageWidget::createView() -//{ -// QAbstractItemView *v=KPageWidget::createView(); -// if (Tree==faceType()) { -// static_cast(v)->setIndentation(0); -// } -// return v; -//} -//#else - #include "icon.h" #include "gtkstyle.h" #include "dialog.h" @@ -341,11 +312,6 @@ PageWidget::PageWidget(QWidget *p, bool listView, bool headers) layout->addWidget(list); layout->addWidget(stack); layout->setMargin(0); - #ifdef ENABLE_KDE_SUPPORT - QFont f=list->font(); - f.setBold(true); - list->setFont(f); - #endif list->setViewMode(QListView::ListMode); list->setVerticalScrollMode(QListView::ScrollPerPixel); list->setMovement(QListView::Static); @@ -423,4 +389,3 @@ void PageWidget::setFocus() list->setFocus(); } -//#endif // ENABLE_KDE_SUPPORT diff --git a/support/pagewidget.h b/support/pagewidget.h index d1c4d531c..c090c394c 100644 --- a/support/pagewidget.h +++ b/support/pagewidget.h @@ -25,31 +25,6 @@ #define PAGEWIDGET_H #include "icon.h" - -//#ifdef ENABLE_KDE_SUPPORT -//#include -//#include -//typedef KPageWidgetItem PageWidgetItem; - -//class PageWidget : public KPageWidget -//{ -// Q_OBJECT -//public: -// PageWidget(QWidget *p, bool listView=false, bool headers=true); -// virtual ~PageWidget() { } - -// PageWidgetItem * addPage(QWidget *widget, const QString &name, const Icon &icon, const QString &header); -// QAbstractItemView * createView(); -// bool showPageHeader() const { return showHeaders; } - -//Q_SIGNALS: -// void currentPageChanged(); - -//private: -// bool showHeaders; -//}; - -//#else #include #include @@ -93,6 +68,4 @@ private: QMap pages; }; -//#endif - #endif diff --git a/support/pathrequester.h b/support/pathrequester.h index 485151505..31349368e 100644 --- a/support/pathrequester.h +++ b/support/pathrequester.h @@ -24,23 +24,6 @@ #ifndef PATH_REQUESER_H #define PATH_REQUESER_H -#ifdef ENABLE_KDE_SUPPORT -#include -#include -#include -class PathRequester : public KUrlRequester -{ -public: - PathRequester(QWidget *parent) : KUrlRequester(parent) { - setMode(KFile::Directory|KFile::ExistingOnly|KFile::LocalOnly); - button()->setFlat(true); - } - - void setButtonVisible(bool v) { button()->setVisible(v); } - void setDirMode(bool m) { setMode((m ? KFile::Directory : KFile::File)|KFile::ExistingOnly|KFile::LocalOnly); } -}; - -#else #include "lineedit.h" #include "flattoolbutton.h" #include @@ -77,6 +60,5 @@ private: bool dirMode; QString filter; }; -#endif #endif diff --git a/support/proxystyle.cpp b/support/proxystyle.cpp index 7195c7415..3ab9f369b 100644 --- a/support/proxystyle.cpp +++ b/support/proxystyle.cpp @@ -30,14 +30,14 @@ #include #include -#if !defined Q_OS_MAC && !defined ENABLE_KDE_SUPPORT +#if !defined Q_OS_MAC static const char * constAccelProp="managed-accel"; #endif const char * ProxyStyle::constModifyFrameProp="mod-frame"; void ProxyStyle::polish(QWidget *widget) { - #if !defined Q_OS_MAC && !defined ENABLE_KDE_SUPPORT + #if !defined Q_OS_MAC if (widget && qobject_cast(widget) && !widget->property(constAccelProp).isValid()) { AcceleratorManager::manage(widget); widget->setProperty(constAccelProp, true); diff --git a/support/spinner.cpp b/support/spinner.cpp index e696c82c1..87e14f78c 100644 --- a/support/spinner.cpp +++ b/support/spinner.cpp @@ -22,46 +22,13 @@ */ #include "spinner.h" +#include "utils.h" #include #include - -#ifdef ENABLE_KDE_SUPPORT - -Spinner::Spinner(QObject *p, bool inMiddle) - : KPixmapSequenceOverlayPainter(p) - , active(false) -{ - setSequence(KPixmapSequence("process-working", KIconLoader::SizeSmallMedium)); - setAlignment(inMiddle ? Qt::AlignCenter : (Qt::AlignTop | (QApplication::isRightToLeft() ? Qt::AlignLeft : Qt::AlignRight))); -} - -void Spinner::start() -{ - active=true; - KPixmapSequenceOverlayPainter::start(); -} - -void Spinner::stop() -{ - active=false; - KPixmapSequenceOverlayPainter::stop(); -} - -void Spinner::setWidget(QWidget *widget) -{ - if (qobject_cast(widget)) { - KPixmapSequenceOverlayPainter::setWidget(static_cast(widget)->viewport()); - } else { - KPixmapSequenceOverlayPainter::setWidget(widget); - } -} - -#else #include #include #include #include -#include "utils.h" Spinner::Spinner(QObject *p, bool inMiddle) : QWidget(0) @@ -156,4 +123,3 @@ void Spinner::setPosition() move(desired); } } -#endif diff --git a/support/spinner.h b/support/spinner.h index 7e701327e..aec3ca88a 100644 --- a/support/spinner.h +++ b/support/spinner.h @@ -21,23 +21,9 @@ * Boston, MA 02110-1301, USA. */ -#ifdef ENABLE_KDE_SUPPORT -#include -#include +#ifndef SPINNER_H +#define SPINNER_H -class Spinner : public KPixmapSequenceOverlayPainter -{ -public: - Spinner(QObject *p, bool inMiddle=false); - bool isActive() const { return active; } - void start(); - void stop(); - void setWidget(QWidget *widget); - -private: - bool active; -}; -#else #include class QTimer; class Spinner : public QWidget @@ -68,4 +54,5 @@ private: bool central; bool onView; }; + #endif diff --git a/support/squeezedtextlabel.cpp b/support/squeezedtextlabel.cpp index ce0b41f06..d92f4c96a 100644 --- a/support/squeezedtextlabel.cpp +++ b/support/squeezedtextlabel.cpp @@ -23,17 +23,6 @@ #include "squeezedtextlabel.h" -#ifdef ENABLE_KDE_SUPPORT - -SqueezedTextLabel::SqueezedTextLabel(QWidget *p) - : KSqueezedTextLabel(p) -{ - setTextElideMode(isRightToLeft() ? Qt::ElideLeft : Qt::ElideRight); - setAlignment((isRightToLeft() ? Qt::AlignRight : Qt::AlignLeft) | Qt::AlignVCenter); -} - -#else - SqueezedTextLabel::SqueezedTextLabel(QWidget *p) : QLabel(p) { @@ -61,5 +50,3 @@ void SqueezedTextLabel::elideText() setToolTip(QString()); } } - -#endif diff --git a/support/squeezedtextlabel.h b/support/squeezedtextlabel.h index ed36d403a..b70cfce74 100644 --- a/support/squeezedtextlabel.h +++ b/support/squeezedtextlabel.h @@ -24,14 +24,6 @@ #ifndef SQUEEZEDTEXTLABEL_H #define SQUEEZEDTEXTLABEL_H -#ifdef ENABLE_KDE_SUPPORT -#include -class SqueezedTextLabel : public KSqueezedTextLabel -{ -public: - SqueezedTextLabel(QWidget *p); -}; -#else #include #include class QResizeEvent; @@ -61,6 +53,5 @@ private: QString originalText; Qt::TextElideMode elideMode; }; -#endif #endif // SQUEEZEDTEXTLABEL_H diff --git a/support/urllabel.h b/support/urllabel.h index ee25e8c17..432d57515 100644 --- a/support/urllabel.h +++ b/support/urllabel.h @@ -24,10 +24,6 @@ #ifndef URLLABEL_H #define URLLABEL_H -#ifdef ENABLE_KDE_SUPPORT -#include -typedef KUrlLabel UrlLabel; -#else #include #include @@ -52,6 +48,5 @@ protected: private: bool pressed; }; -#endif #endif // URLLABEL_H diff --git a/support/utils.cpp b/support/utils.cpp index 4fad46c23..677d74520 100644 --- a/support/utils.cpp +++ b/support/utils.cpp @@ -27,7 +27,6 @@ #include #include #include -#ifndef CANTATA_WEB #include #include #include @@ -41,9 +40,6 @@ #else #include #endif -#ifdef ENABLE_KDE_SUPPORT -#include -#endif #include #include #include @@ -53,7 +49,6 @@ #endif #include #include -#endif const QLatin1Char Utils::constDirSep('/'); const QLatin1String Utils::constDirSepStr("/"); @@ -176,7 +171,6 @@ bool Utils::isDirReadable(const QString &dir) #endif } -#ifndef CANTATA_WEB QString Utils::strippedText(QString s) { s.remove(QString::fromLatin1("...")); @@ -343,7 +337,6 @@ bool Utils::createWorldReadableDir(const QString &dir, const QString &base, cons #endif } -#ifndef ENABLE_KDE_SUPPORT // Copied from KDE... START #include #include @@ -629,8 +622,6 @@ QString Utils::findExe(const QString &appname, const QString &pstr) } // Copied from KDE... END -#endif - QString Utils::formatDuration(const quint32 totalseconds) { //Get the days,hours,minutes and seconds out of the total seconds @@ -644,15 +635,9 @@ QString Utils::formatDuration(const quint32 totalseconds) //Convert hour,minutes and seconds to a QTime for easier parsing QTime time(hours, minutes, seconds); - #ifdef ENABLE_KDE_SUPPORT - return 0==days - ? time.toString("h:mm:ss") - : i18np("1 day %2", "%1 days %2", days, time.toString("h:mm:ss")); - #else return 0==days ? time.toString("h:mm:ss") : QString("%1:%2").arg(days).arg(time.toString("hh:mm:ss")); - #endif } QString Utils::formatTime(const quint32 seconds, bool zeroIsUnknown) @@ -695,7 +680,7 @@ static QString userDir(const QString &mainDir, const QString &sub, bool create) QString Utils::dataDir(const QString &sub, bool create) { - #if defined Q_OS_WIN || defined Q_OS_MAC || defined ENABLE_UBUNTU + #if defined Q_OS_WIN || defined Q_OS_MAC #if QT_VERSION >= 0x050000 return userDir(QStandardPaths::writableLocation(QStandardPaths::DataLocation)+constDirSep, sub, create); @@ -728,7 +713,7 @@ QString Utils::dataDir(const QString &sub, bool create) QString Utils::cacheDir(const QString &sub, bool create) { - #if defined Q_OS_WIN || defined Q_OS_MAC || defined ENABLE_UBUNTU + #if defined Q_OS_WIN || defined Q_OS_MAC #if QT_VERSION >= 0x050000 return userDir(QStandardPaths::writableLocation(QStandardPaths::CacheLocation)+constDirSep, sub, create); @@ -988,9 +973,6 @@ QColor Utils::monoIconColor() return clampColor(QApplication::palette().color(QPalette::Active, QPalette::WindowText)); } -#ifdef ENABLE_KDE_SUPPORT -#include -#endif #ifdef Q_OS_WIN // This is down here, because windows.h includes ALL windows stuff - and we get conflicts with MessageBox :-( #include @@ -1043,10 +1025,6 @@ void Utils::raiseWindow(QWidget *w) QProcess::execute(wmctrl, QStringList() << QLatin1String("-i") << QLatin1String("-a") << QString::number(w->effectiveWinId())); } #endif // QT_VERSION < 0x050000 - #ifdef ENABLE_KDE_SUPPORT - KWindowSystem::forceActiveWindow(w->effectiveWinId()); - #endif #endif } -#endif // CANTATA_WEB diff --git a/support/utils.h b/support/utils.h index 46f227be8..af6040f86 100644 --- a/support/utils.h +++ b/support/utils.h @@ -31,19 +31,12 @@ #include #include #include -#ifndef CANTATA_WEB #include #include -#ifdef ENABLE_KDE_SUPPORT -#include -#include -#include -#endif #include #ifdef Q_OS_WIN #include #endif -#endif #include class QString; @@ -81,7 +74,6 @@ namespace Utils inline void msleep(int msecs) { Thread::msleep(msecs); } inline void sleep() { msleep(100); } - #ifndef CANTATA_WEB extern QString strippedText(QString s); extern QString stripAcceleratorMarkers(QString label); @@ -93,22 +85,12 @@ namespace Utils extern gid_t getGroupId(const char *groupName="users"); // Return 0 if user is not in group, otherwise returns group ID #endif extern void setFilePerms(const QString &file, const char *groupName="users"); - #ifdef ENABLE_KDE_SUPPORT - inline bool makeDir(const QString &dir, int mode) { return KStandardDirs::makeDir(dir, mode); } - #else extern bool makeDir(const QString &dir, int mode); - #endif extern bool createWorldReadableDir(const QString &dir, const QString &base, const char *groupName="users"); - #ifdef ENABLE_KDE_SUPPORT - inline QString findExe(const QString &appname, const QString &pathstr=QString()) { return KStandardDirs::findExe(appname, pathstr); } - inline QString formatByteSize(double size) { return KGlobal::locale()->formatByteSize(size, 1); } - inline QString formatNumber(double number, int precision) { return KGlobal::locale()->formatNumber(number, precision); } - #else extern QString findExe(const QString &appname, const QString &pathstr=QString()); extern QString formatByteSize(double size); inline QString formatNumber(double number, int precision) { return QString::number(number, 'f', precision); } - #endif extern QString formatDuration(const quint32 totalseconds); extern QString formatTime(const quint32 seconds, bool zeroIsUnknown=false); @@ -144,8 +126,6 @@ namespace Utils extern QPainterPath buildPath(const QRectF &r, double radius); extern QColor clampColor(const QColor &col); extern QColor monoIconColor(); - - #endif } #endif diff --git a/support/windowmanager.cpp b/support/windowmanager.cpp index f5c9f1617..ee86042e2 100644 --- a/support/windowmanager.cpp +++ b/support/windowmanager.cpp @@ -56,15 +56,10 @@ #include #include #include -#ifdef ENABLE_KDE_SUPPORT -#include -#endif #if defined Q_WS_X11 && QT_VERSION < 0x050000 #include -#ifdef ENABLE_KDE_SUPPORT -#include -#elif QT_VERSION < 0x050000 +#if QT_VERSION < 0x050000 #include #include #endif @@ -116,11 +111,7 @@ WindowManager::WindowManager(QObject *parent) , _useWMMoveResize(false) #endif , _dragMode(WM_DRAG_NONE) - #ifdef ENABLE_KDE_SUPPORT - , _dragDistance(KGlobalSettings::dndEventDelay()) - #else , _dragDistance(QApplication::startDragDistance()) - #endif , _dragDelay(QApplication::startDragTime()) , _dragAboutToStart(false) , _dragInProgress(false) @@ -137,9 +128,6 @@ WindowManager::WindowManager(QObject *parent) void WindowManager::initialize(int windowDrag) { setDragMode(windowDrag); - #ifdef ENABLE_KDE_SUPPORT - setDragDistance(KGlobalSettings::dndEventDelay()); - #endif setDragDelay(QApplication::startDragTime()); } @@ -576,7 +564,6 @@ void WindowManager::startDrag(QWidget *widget, const QPoint& position) // ungrab pointer if (useWMMoveResize()) { #if defined Q_WS_X11 && QT_VERSION < 0x050000 - #ifndef ENABLE_KDE_SUPPORT static const Atom constNetMoveResize = XInternAtom(QX11Info::display(), "_NET_WM_MOVERESIZE", False); //...Taken from bespin... // stolen... errr "adapted!" from QSizeGrip @@ -596,11 +583,6 @@ void WindowManager::startDrag(QWidget *widget, const QPoint& position) XSendEvent(QX11Info::display(), QX11Info::appRootWindow(info.screen()), False, SubstructureRedirectMask | SubstructureNotifyMask, &xev); #else - XUngrabPointer(QX11Info::display(), QX11Info::appTime()); - NETRootInfo rootInfo(QX11Info::display(), NET::WMMoveResize); - rootInfo.moveResizeRequest(widget->window()->winId(), position.x(), position.y(), NET::Move); - #endif // !ENABLE_KDE_SUPPORT - #else Q_UNUSED(position) #endif } diff --git a/tags/filetyperesolver.cpp b/tags/filetyperesolver.cpp index 678f6b65f..902be41e6 100644 --- a/tags/filetyperesolver.cpp +++ b/tags/filetyperesolver.cpp @@ -25,9 +25,6 @@ #include #include -#ifdef ENABLE_KDE_SUPPORT -#include -#endif #ifdef TAGLIB_EXTRAS_FOUND #include #include @@ -59,56 +56,6 @@ TagLib::File *Meta::Tag::FileTypeResolver::createFile(TagLib::FileName fileName, QString fn = QFile::decodeName(fileName); QString suffix = QFileInfo(fn).suffix(); - #ifdef ENABLE_KDE_SUPPORT - KMimeType::Ptr mimetype = KMimeType::findByPath(fn); - - // -- check by mime type - if (mimetype->is(QLatin1String("audio/mpeg")) || mimetype->is(QLatin1String("audio/x-mpegurl")) - || mimetype->is(QLatin1String("audio/mpeg"))) { - result = new TagLib::MPEG::File(fileName, readProperties, propertiesStyle); - } else if (mimetype->is(QLatin1String("audio/mp4")) || mimetype->is(QLatin1String("video/mp4"))) { - result = new TagLib::MP4::File(fileName, readProperties, propertiesStyle); - } else if (mimetype->is(QLatin1String("audio/x-ms-wma")) /*|| mimetype->is(QLatin1String("video/x-ms-asf")) - || mimetype->is(QLatin1String("video/x-msvideo")) || mimetype->is(QLatin1String("video/x-ms-wmv"))*/) { - result = new TagLib::ASF::File(fileName, readProperties, propertiesStyle); - } - #ifdef TAGLIB_EXTRAS_FOUND - else if (mimetype->is(QLatin1String("audio/vnd.rn-realaudio")) || mimetype->is(QLatin1String("audio/x-pn-realaudioplugin")) - /*|| mimetype->is(QLatin1String("audio/vnd.rn-realvideo"))*/) { - result = new TagLibExtras::RealMedia::File(fileName, readProperties, propertiesStyle); - } - #endif - #ifdef TAGLIB_OPUS_FOUND - else if (mimetype->is(QLatin1String("audio/opus")) || mimetype->is(QLatin1String("audio/x-opus+ogg"))) { - result = new TagLib::Ogg::Opus::File(fileName, readProperties, propertiesStyle); - } - #endif - else if (mimetype->is(QLatin1String("audio/x-vorbis+ogg"))) { - result = new TagLib::Ogg::Vorbis::File(fileName, readProperties, propertiesStyle); - } else if (mimetype->is(QLatin1String("audio/x-flac+ogg"))) { - result = new TagLib::Ogg::FLAC::File(fileName, readProperties, propertiesStyle); - } else if (mimetype->is(QLatin1String("audio/x-aiff"))) { - result = new TagLib::RIFF::AIFF::File(fileName, readProperties, propertiesStyle); - } else if (mimetype->is(QLatin1String("audio/x-flac"))) { - result = new TagLib::FLAC::File(fileName, readProperties, propertiesStyle); - } else if (mimetype->is(QLatin1String("audio/x-musepack"))) { - result = new TagLib::MPC::File(fileName, readProperties, propertiesStyle); - } else if (mimetype->is(QLatin1String("audio/x-wav"))) { - result = new TagLib::RIFF::WAV::File(fileName, readProperties, propertiesStyle); - } else if (mimetype->is(QLatin1String("audio/x-wavpack"))) { - result = new TagLib::WavPack::File(fileName, readProperties, propertiesStyle); - } else if (mimetype->is(QLatin1String("audio/x-tta"))) { - result = new TagLib::TrueAudio::File(fileName, readProperties, propertiesStyle); - } else if (mimetype->is(QLatin1String("audio/x-speex")) || mimetype->is(QLatin1String("audio/x-speex+ogg"))) { - result = new TagLib::TrueAudio::File(fileName, readProperties, propertiesStyle); - } else if (mimetype->is(QLatin1String("audio/x-speex")) || mimetype->is(QLatin1String("audio/x-speex+ogg"))) { - result = new TagLib::TrueAudio::File(fileName, readProperties, propertiesStyle); - } else if (mimetype->is(QLatin1String("audio/x-ape"))) { - result = new TagLib::APE::File(fileName, readProperties, propertiesStyle); - } - - // -- check by extension - #else // ENABLE_KDE_SUPPORT if (suffix == QLatin1String("mp3")) { result = new TagLib::MPEG::File(fileName, readProperties, propertiesStyle); } else if (suffix == QLatin1String("flac")) { @@ -129,9 +76,7 @@ TagLib::File *Meta::Tag::FileTypeResolver::createFile(TagLib::FileName fileName, result = new TagLib::Ogg::Opus::File(fileName, readProperties, propertiesStyle); } #endif - } - #endif // - else if (suffix == QLatin1String("m4a") || suffix == QLatin1String("m4b") + } else if (suffix == QLatin1String("m4a") || suffix == QLatin1String("m4b") || suffix == QLatin1String("m4p") || suffix == QLatin1String("mp4") /*|| suffix == QLatin1String("m4v") || suffix == QLatin1String("mp4v") */) { result = new TagLib::MP4::File(fileName, readProperties, propertiesStyle); diff --git a/tags/tageditor.cpp b/tags/tageditor.cpp index 1c4e6638a..eea1c5b5f 100644 --- a/tags/tageditor.cpp +++ b/tags/tageditor.cpp @@ -205,13 +205,7 @@ TagEditor::TagEditor(QWidget *parent, const QList &songs, enableButton(User2, false); } setButtonGuiItem(Ok, StdGuiItem::save()); - setButtonGuiItem(User3, GuiItem(i18n("Tools"), - #ifdef ENABLE_KDE_SUPPORT - "tools-wizard" - #else - FontAwesome::magic - #endif - )); + setButtonGuiItem(User3, GuiItem(i18n("Tools"), FontAwesome::magic)); QMenu *toolsMenu=new QMenu(this); toolsMenu->addAction(i18n("Apply \"Various Artists\" Workaround"), this, SLOT(applyVa())); toolsMenu->addAction(i18n("Revert \"Various Artists\" Workaround"), this, SLOT(revertVa())); diff --git a/ubuntu/backend/mpdbackend.cpp b/ubuntu/backend/mpdbackend.cpp deleted file mode 100644 index 1bceb0c9e..000000000 --- a/ubuntu/backend/mpdbackend.cpp +++ /dev/null @@ -1,677 +0,0 @@ -/* - * Cantata - * - * Copyright (c) 2014 Niklas Wenzel - * Copyright (c) 2014 Craig Drummond - * - * ---- - * - * 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; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#include "mpdbackend.h" -#include "mpd-interface/mpdconnection.h" -#include "gui/currentcover.h" -#include "gui/covers.h" -#include "support/localize.h" -#include "gui/plurals.h" -#include -#include - -MPDBackend::MPDBackend(QObject *parent) : QObject(parent) - , lastState(MPDState_Inactive) - , lastSongId(-1) - , statusTimer(0) - , connectedState(CS_Init) - , stopAfterCurrent(false) -{ - connect(this, SIGNAL(goToNextSong()), MPDConnection::self(), SLOT(goToNext())); - connect(this, SIGNAL(goToPreviousSong()), MPDConnection::self(), SLOT(goToPrevious())); - connect(this, SIGNAL(loadLibrary()), MPDConnection::self(), SLOT(loadLibrary())); - connect(this, SIGNAL(loadFolders()), MPDConnection::self(), SLOT(loadFolders())); - - connect(MPDConnection::self(), SIGNAL(stateChanged(bool)), this, SLOT(onConnected(bool))); - - AlbumsModel::self()->setEnabled(true); - DirViewModel::self()->setEnabled(true); - PlaylistsModel::self()->setEnabled(true); - - playQueueProxyModel.setSourceModel(&playQueueModel); - artistsProxyModel.setSourceModel(MusicLibraryModel::self()); - albumsProxyModel.setSourceModel(AlbumsModel::self()); - foldersProxyModel.setSourceModel(DirViewModel::self()); - playlistsProxyModel.setSourceModel(PlaylistsModel::self()); - - -// connect(this, SIGNAL(enableOutput(int, bool)), MPDConnection::self(), SLOT(enableOutput(int, bool))); -// connect(this, SIGNAL(outputs()), MPDConnection::self(), SLOT(outputs())); - connect(this, SIGNAL(pause(bool)), MPDConnection::self(), SLOT(setPause(bool))); - connect(this, SIGNAL(play()), MPDConnection::self(), SLOT(play())); - connect(this, SIGNAL(stop(bool)), MPDConnection::self(), SLOT(stopPlaying(bool))); - connect(this, SIGNAL(getStatus()), MPDConnection::self(), SLOT(getStatus())); - connect(this, SIGNAL(playListInfo()), MPDConnection::self(), SLOT(playListInfo())); - connect(this, SIGNAL(currentSong()), MPDConnection::self(), SLOT(currentSong())); -// connect(this, SIGNAL(setSeekId(qint32, quint32)), MPDConnection::self(), SLOT(setSeekId(qint32, quint32))); - connect(this, SIGNAL(startPlayingSongId(qint32)), MPDConnection::self(), SLOT(startPlayingSongId(qint32))); - connect(this, SIGNAL(setDetails(const MPDConnectionDetails &)), MPDConnection::self(), SLOT(setDetails(const MPDConnectionDetails &))); - connect(this, SIGNAL(clear()), MPDConnection::self(), SLOT(clear())); - connect(this, SIGNAL(enableOutput(int, bool)), MPDConnection::self(), SLOT(enableOutput(int, bool))); - connect(this, SIGNAL(getOutputSetting()), MPDConnection::self(), SLOT(outputs())); - connect(this, SIGNAL(setReplayGain(const QString &)), MPDConnection::self(), SLOT(setReplayGain(const QString &))); - connect(this, SIGNAL(setCrossFade(int)), MPDConnection::self(), SLOT(setCrossFade(int))); - connect(this, SIGNAL(getReplayGainSetting()), MPDConnection::self(), SLOT(getReplayGain())); - -// connect(this, SIGNAL(setPriority(const QList &, quint8 )), MPDConnection::self(), SLOT(setPriority(const QList &, quint8))); -// connect(this, SIGNAL(addSongsToPlaylist(const QString &, const QStringList &)), MPDConnection::self(), SLOT(addToPlaylist(const QString &, const QStringList &))); - -// connect(&playQueueModel, SIGNAL(statsUpdated(int, quint32)), this, SLOT(updatePlayQueueStats(int, quint32))); //Just UI - connect(&playQueueModel, SIGNAL(updateCurrent(Song)), SLOT(updateCurrentSong(Song))); - - connect(MPDStats::self(), SIGNAL(updated()), this, SLOT(updateStats())); - connect(MPDStatus::self(), SIGNAL(updated()), this, SLOT(updateStatus())); - - connect(MPDConnection::self(), SIGNAL(playlistUpdated(const QList &)), this, SLOT(updatePlayQueue(const QList &))); - connect(MPDConnection::self(), SIGNAL(currentSongUpdated(const Song &)), this, SLOT(updateCurrentSong(const Song &))); - connect(MPDConnection::self(), SIGNAL(stateChanged(bool)), SLOT(mpdConnectionStateChanged(bool))); - connect(MPDConnection::self(), SIGNAL(replayGain(QString)), SLOT(replayGainUpdated(QString))); - connect(MPDConnection::self(), SIGNAL(outputsUpdated(const QList &)), SLOT(outputsUpdated(const QList &))); - -// connect(MPDConnection::self(), SIGNAL(error(const QString &, bool)), SLOT(showError(const QString &, bool))); -// connect(MPDConnection::self(), SIGNAL(info(const QString &)), SLOT(showInformation(const QString &))); - -// connect(this, SIGNAL(setVolume(int)), MPDConnection::self(), SLOT(setVolume(int))); - -// connect(context, SIGNAL(playSong(QString)), &playQueueModel, SLOT(playSong(QString))); - -// connect(PlaylistsModel::self(), SIGNAL(addToNew()), this, SLOT(addToNewStoredPlaylist())); -// connect(PlaylistsModel::self(), SIGNAL(addToExisting(const QString &)), this, SLOT(addToExistingStoredPlaylist(const QString &))); - - - - connect(this, SIGNAL(add(const QStringList &, bool, quint8)), MPDConnection::self(), SLOT(add(const QStringList &, bool, quint8))); - connect(this, SIGNAL(setVolume(int)), MPDConnection::self(), SLOT(setVolume(int))); - connect(this, SIGNAL(setRandomOrder(bool)), MPDConnection::self(), SLOT(setRandom(bool))); - connect(this, SIGNAL(setRepeating(bool)), MPDConnection::self(), SLOT(setRepeat(bool))); - connect(this, SIGNAL(loadPlaylist(const QString &, bool)), MPDConnection::self(), SLOT(loadPlaylist(const QString &, bool))); - connect(this, SIGNAL(removePlaylist(const QString &)), MPDConnection::self(), SLOT(removePlaylist(const QString &))); - connect(this, SIGNAL(renamePlaylist(const QString &, const QString &)), MPDConnection::self(), SLOT(renamePlaylist(const QString &, const QString &))); - connect(this, SIGNAL(removeFromPlaylist(const QString &, const QList &)), MPDConnection::self(), SLOT(removeFromPlaylist(const QString &, const QList &))); - - - connect(MusicLibraryModel::self(), SIGNAL(updated()), this, SLOT(artistsUpdated())); - connect(AlbumsModel::self(), SIGNAL(updated()), this, SLOT(albumsUpdated())); - connect(DirViewModel::self(), SIGNAL(updated()), this, SLOT(foldersUpdated())); - connect(PlaylistsModel::self(), SIGNAL(updated()), this, SLOT(playlistsUpdated())); - - MPDConnection::self()->start(); -} - -void MPDBackend::connectTo(QString hostname, quint16 port, QString password, QString folder) { - MPDConnectionDetails details; - details.hostname = hostname; - details.port = port; - details.password = password; - details.dir = folder.isEmpty() ? folder : Utils::fixPath(folder); - emit setDetails(details); - MusicLibraryModel::self()->clear(); - //emit loadLibrary(); -} - -void MPDBackend::enableAlbumsView(bool en) { - AlbumsModel::self()->setEnabled(en); -} - -void MPDBackend::enableFoldersView(bool en) { - DirViewModel::self()->setEnabled(en); -} - -void MPDBackend::enablePlaylistsView(bool en) { - PlaylistsModel::self()->setEnabled(en); -} - -void MPDBackend::setArtistSortYear(bool s) { - MusicLibraryItemAlbum::setSortByDate(s); -} - -void MPDBackend::setAlbumViewSort(int s) { - AlbumsModel::self()->setAlbumSort(s); -} - -void MPDBackend::setCoverFetch(bool s) { - Covers::self()->setFetchCovers(s); -} - -void MPDBackend::playPause() { - switch (MPDStatus::self()->state()) { - case MPDState_Playing: - emit pause(true); - break; - case MPDState_Paused: -// stopVolumeFade(); - emit pause(false); - break; - default: - if (playQueueModel.rowCount()>0) { -// stopVolumeFade(); - if (-1!=playQueueModel.currentSong() && -1!=playQueueModel.currentSongRow()) { - emit startPlayingSongId(playQueueModel.currentSong()); - } else { - emit play(); - } - } - } -} - -void MPDBackend::nextSong() { - emit goToNextSong(); -} - -void MPDBackend::previousSong() { - emit goToPreviousSong(); -} - -void MPDBackend::startPlayingSongAtPos(int index) { - emit startPlayingSongId(playQueueModel.getIdByRow(index)); -} - -void MPDBackend::onConnected(bool connected) { - emit onConnectedChanged(); -} - -void MPDBackend::setMpdVolume(quint8 volume) { - emit setVolume(volume); -} - -void MPDBackend::setIsRandomOrder(bool random) { - emit setRandomOrder(random); -} - -void MPDBackend::setIsRepeating(bool repeating) { - emit setRepeating(repeating); -} - -void MPDBackend::getPlaybackSettings() { - emit getOutputSetting(); - emit getReplayGainSetting(); -} - -void MPDBackend::setPlaybackSettings(const QString &replayGain, int crossfade, const QStringList &outputs) { - if (replayGain!=replayGainSetting) { - replayGainSetting=replayGain; - emit setReplayGain(replayGainSetting); - } - - if (MPDStatus::self()->crossFade()!=crossfade) { - emit setCrossFade(crossfade); - } - - if (outputs!=outputSettings) { - outputSettings=outputs; - foreach (const QString &o, outputs) { - QStringList parts=o.split(':'); - if (parts.size()>2) { - bool enabled=parts.at(parts.size()-1)=="1"; - int id=parts.at(parts.size()-2).toInt(); - emit enableOutput(id, enabled); - } - } - } -} - -void MPDBackend::outputsUpdated(const QList &outputs) { - QStringList setting; - - foreach (const Output &o, outputs) { - setting.append(o.name+":"+o.id+":"+(o.enabled ? 1 : 0)); - } - - if (setting!=outputSettings) { - outputSettings=setting; - emit outputsChanged(); - } -} - -void MPDBackend::replayGainUpdated(const QString &v) { - if (v!=replayGainSetting) { - replayGainSetting=v; - emit replayGainChanged(); - } -} - -// TODO: Why are the sorts required below? e.g. If we don't call sort, the items are only sorted string-wise. This -// means that 'Various Artists' is not placed at the top, and "The XXX" is not sorted as "XXX" -void MPDBackend::artistsUpdated() { - artistsProxyModel.sort(); - emit onArtistsModelChanged(); -} - -void MPDBackend::albumsUpdated() { - albumsProxyModel.sort(); - emit onAlbumsModelChanged(); -} - -void MPDBackend::foldersUpdated() { - foldersProxyModel.sort(); - emit onFoldersModelChanged(); -} - -void MPDBackend::playlistsUpdated() { - playlistsProxyModel.sort(); - emit onPlaylistsModelChanged(); -} - -void MPDBackend::add(const QString &modelName, const QVariant &rows, bool replace) { - if (QVariant::Int==rows.type() && "playlists"==modelName) { - loadPlaylist(rows.toInt(), replace); - return; - } - - ProxyModel *proxy=0; - ActionModel *model=0; - if ("artists"==modelName) { - proxy=&artistsProxyModel; - model=MusicLibraryModel::self(); - } else if ("albums"==modelName) { - proxy=&albumsProxyModel; - model=AlbumsModel::self(); - } else if ("playlists"==modelName) { - proxy=&playlistsProxyModel; - model=PlaylistsModel::self(); - } else if ("folders"==modelName) { - proxy=&foldersProxyModel; - model=DirViewModel::self(); - } - - if (model) { - QList rowList; - if (QVariant::Int==rows.type()) { - rowList.append(rows.toInt()); - } else if (QVariant::List==rows.type()) { - foreach (const QVariant &v, rows.toList()) { - rowList.append(v.toInt()); - } - } - if (rowList.count()) { - QModelIndex idx; - foreach (int r, rowList) { - idx=proxy->index(r, 0, idx); - if (!idx.isValid()) { - return; - } - } - QStringList fileNames = model->filenames(QModelIndexList() << proxy->mapToSource(idx), false); - if (!fileNames.isEmpty()) { - emit add(fileNames, replace, 0); - } - } - } -} - -void MPDBackend::remove(const QString &modelName, const QVariant &rows) { - if ("playlists"!=modelName) { - return; - } - - if (QVariant::Int==rows.type()) { - QModelIndex index=playlistsProxyModel.index(rows.toInt(), 0); - if (index.isValid()) { - index=playlistsProxyModel.mapToSource(index); - if (index.isValid() && static_cast(index.internalPointer())->isPlaylist()) { - emit removePlaylist(static_cast(index.internalPointer())->name); - } - } - } else if (QVariant::List==rows.type()) { - QVariantList rowList=rows.toList(); - if (2==rowList.count()) { - QModelIndex playListIndex=playlistsProxyModel.index(rowList.at(0).toInt(), 0); - if (playListIndex.isValid()) { - QModelIndex songIndex=playlistsProxyModel.index(rowList.at(1).toInt(), 0, playListIndex); - if (songIndex.isValid()) { - playListIndex=playlistsProxyModel.mapToSource(playListIndex); - songIndex=playlistsProxyModel.mapToSource(songIndex); - if (playListIndex.isValid() && songIndex.isValid() && - static_cast(playListIndex.internalPointer())->isPlaylist() && - !static_cast(songIndex.internalPointer())->isPlaylist()) { - emit removeFromPlaylist(static_cast(playListIndex.internalPointer())->name, - QList() << songIndex.row()); - } - } - } - } - } -} - -void MPDBackend::loadPlaylist(int index, bool replace) { - if (index<0) { - return; - } - QModelIndex idx=playlistsProxyModel.mapToSource(playlistsProxyModel.index(index, 0)); - if (idx.isValid()) { - PlaylistsModel::Item *i=static_cast(idx.internalPointer()); - if (i->isPlaylist()) { - emit loadPlaylist(static_cast(i)->name, replace); - } - } -} - -void MPDBackend::removeFromPlayQueue(int index) { - QList removeIndexList; - removeIndexList << index; - playQueueModel.remove(removeIndexList); -} - -//Methods ported from MainWindow class: - -void MPDBackend::updateCurrentSong(const Song &song) -{ -// if (fadeWhenStop() && StopState_None!=stopState) { -// if (StopState_Stopping==stopState) { -// emit stop(); -// } -// } - - current=song; - if (current.isCdda()) { - emit getStatus(); - if (current.isUnknown()) { - Song pqSong=playQueueModel.getSongById(current.id); - if (!pqSong.isEmpty()) { - current=pqSong; - } - } - } - -// if (current.isCantataStream()) { -// Song mod=HttpServer::self()->decodeUrl(current.file); -// if (!mod.title.isEmpty()) { -// current=mod; -// current.id=song.id; -// } -// } - - QString name=current.name(); - if (current.isStream() && !current.isCantataStream() && !current.isCdda()) { - mainText=name.isEmpty() ? Song::unknown() : name; - if (current.artist.isEmpty() && current.title.isEmpty() && !name.isEmpty()) { - subText=i18n("(Stream)"); - } else { - subText=current.artist.isEmpty() ? current.title : (current.artist+QLatin1String(" - ")+current.title); - } - } else { - if (current.title.isEmpty() && current.artist.isEmpty() && (!name.isEmpty() || !current.file.isEmpty())) { - mainText=name.isEmpty() ? current.file : name; - } else { - mainText=current.title; - } - if (current.album.isEmpty() && current.artist.isEmpty()) { - subText=mainText.isEmpty() ? QString() : Song::unknown(); - } else if (current.album.isEmpty()) { - subText=current.artist; - } else { - subText=current.artist+QLatin1String(" - ")+current.displayAlbum(); - } - } - -// #ifdef QT_QTDBUS_FOUND -// mpris->updateCurrentSong(current); -// #endif - if (current.time<5 && MPDStatus::self()->songId()==current.id && MPDStatus::self()->timeTotal()>5) { - current.time=MPDStatus::self()->timeTotal(); - } -// positionSlider->setEnabled(-1!=current.id && !current.isCdda() && (!currentIsStream() || current.time>5)); - -// TODO: Touch is not currently displaying covers - and 'current cover' is only required for playqueue or notifications. -// If update is called, this will cause a cove to be downloaded, and saved! -// CurrentCover::self()->update(current); - -// trackLabel->update(current); -// bool isPlaying=MPDState_Playing==MPDStatus::self()->state(); - playQueueModel.updateCurrentSong(current.id); -// QModelIndex idx=playQueueProxyModel.mapFromSource(playQueueModel.index(playQueueModel.currentSongRow(), 0)); -// playQueue->updateRows(idx.row(), current.key, autoScrollPlayQueue && playQueueProxyModel.isEmpty() && isPlaying); -// scrollPlayQueue(); -// context->update(current); -// trayItem->songChanged(song, isPlaying); - - - //Ubuntu specific: - - emit onCurrentSongChanged(); -} - -void MPDBackend::updateStats() //Does nothing right now... -{ - // Check if remote db is more recent than local one - if (!MusicLibraryModel::self()->lastUpdate().isValid() || MPDStats::self()->dbUpdate() > MusicLibraryModel::self()->lastUpdate()) { - if (!MusicLibraryModel::self()->lastUpdate().isValid()) { - MusicLibraryModel::self()->clear(); -// libraryPage->clear(); -// //albumsPage->clear(); -// folderPage->clear(); -// playlistsPage->clear(); - } - if (!MusicLibraryModel::self()->fromXML()) { - emit loadLibrary(); - } - if (DirViewModel::self()->isEnabled() && !DirViewModel::self()->fromXML()) { - emit loadFolders(); - } -// albumsPage->goTop(); -// libraryPage->refresh(); -// folderPage->refresh(); - } -} - -void MPDBackend::updateStatus() -{ - updateStatus(MPDStatus::self()); -} - -void MPDBackend::updateStatus(MPDStatus * const status) -{ -// if (!status->error().isEmpty()) { -// showError(i18n("MPD reported the following error: %1", status->error())); -// } - - if (MPDState_Stopped==status->state() || MPDState_Inactive==status->state()) { -// positionSlider->clearTimes(); - playQueueModel.clearStopAfterTrack(); - if (statusTimer) { - statusTimer->stop(); - statusTimer->setProperty("count", 0); - } - } else { -// positionSlider->setRange(0, 0==status->timeTotal() && 0!=current.time && (current.isCdda() || current.isCantataStream()) -// ? current.time : status->timeTotal()); -// positionSlider->setValue(status->timeElapsed()); - if (0==status->timeTotal() && 0==status->timeElapsed()) { - if (!statusTimer) { - statusTimer=new QTimer(this); - statusTimer->setSingleShot(true); - connect(statusTimer, SIGNAL(timeout()), SIGNAL(getStatus())); - } - QVariant id=statusTimer->property("id"); - if (!id.isValid() || id.toInt()!=current.id) { - statusTimer->setProperty("id", current.id); - statusTimer->setProperty("count", 0); - statusTimer->start(250); - } else if (statusTimer->property("count").toInt()<12) { - statusTimer->setProperty("count", statusTimer->property("count").toInt()+1); - statusTimer->start(250); - } -// } else if (!positionSlider->isEnabled()) { -// positionSlider->setEnabled(-1!=current.id && !current.isCdda() && (!currentIsStream() || status->timeTotal()>5)); - } - } - -// randomPlayQueueAction->setChecked(status->random()); -// repeatPlayQueueAction->setChecked(status->repeat()); -// singlePlayQueueAction->setChecked(status->single()); -// consumePlayQueueAction->setChecked(status->consume()); -// updateNextTrack(status->nextSongId()); - -// if (status->timeElapsed()<172800 && (!currentIsStream() || (status->timeTotal()>0 && status->timeElapsed()<=status->timeTotal()))) { -// if (status->state() == MPDState_Stopped || status->state() == MPDState_Inactive) { -// positionSlider->setRange(0, 0); -// } else { -// positionSlider->setValue(status->timeElapsed()); -// } -// } - - playQueueModel.setState(status->state()); - switch (status->state()) { - case MPDState_Playing: -// StdActions::self()->playPauseTrackAction->setIcon(Icons::self()->toolbarPauseIcon); -// StdActions::self()->playPauseTrackAction->setEnabled(0!=status->playlistLength()); -// if (StopState_Stopping!=stopState) { -// enableStopActions(true); -// StdActions::self()->nextTrackAction->setEnabled(status->playlistLength()>1); -// StdActions::self()->prevTrackAction->setEnabled(status->playlistLength()>1); -// } -// positionSlider->startTimer(); - break; - case MPDState_Inactive: - case MPDState_Stopped: -// StdActions::self()->playPauseTrackAction->setIcon(Icons::self()->toolbarPlayIcon); -// StdActions::self()->playPauseTrackAction->setEnabled(0!=status->playlistLength()); -// enableStopActions(false); -// StdActions::self()->nextTrackAction->setEnabled(false); -// StdActions::self()->prevTrackAction->setEnabled(false); -// if (!StdActions::self()->playPauseTrackAction->isEnabled()) { - current=Song(); -// trackLabel->update(current); - CurrentCover::self()->update(current); -// } - current.id=0; -// trayItem->setToolTip("cantata", i18n("Cantata"), QLatin1String("")+i18n("Playback stopped")+QLatin1String("")); -// positionSlider->stopTimer(); - break; - case MPDState_Paused: -// StdActions::self()->playPauseTrackAction->setIcon(Icons::self()->toolbarPlayIcon); -// StdActions::self()->playPauseTrackAction->setEnabled(0!=status->playlistLength()); -// enableStopActions(0!=status->playlistLength()); -// StdActions::self()->nextTrackAction->setEnabled(status->playlistLength()>1); -// StdActions::self()->prevTrackAction->setEnabled(status->playlistLength()>1); -// positionSlider->stopTimer(); - default: - break; - } - - // Check if song has changed or we're playing again after being stopped, and update song info if needed - if (MPDState_Inactive!=status->state() && - (MPDState_Inactive==lastState || (MPDState_Stopped==lastState && MPDState_Playing==status->state()) || lastSongId != status->songId())) { - emit currentSong(); - } -// if (status->state()!=lastState && (MPDState_Playing==status->state() || MPDState_Stopped==status->state())) { -// startContextTimer(); -// } - - // Update status info - lastState = status->state(); - lastSongId = status->songId(); - - - //Touch specific: - - emit onPlayingStatusChanged(); - emit onMpdStatusChanged(); -} - -void MPDBackend::updatePlayQueue(const QList &songs) -{ -// StdActions::self()->playPauseTrackAction->setEnabled(!songs.isEmpty()); -// StdActions::self()->nextTrackAction->setEnabled(StdActions::self()->stopPlaybackAction->isEnabled() && songs.count()>1); -// StdActions::self()->prevTrackAction->setEnabled(StdActions::self()->stopPlaybackAction->isEnabled() && songs.count()>1); -// StdActions::self()->savePlayQueueAction->setEnabled(!songs.isEmpty()); -// promptClearPlayQueueAction->setEnabled(!songs.isEmpty()); - -// int topRow=-1; -// QModelIndex topIndex=playQueueModel.lastCommandWasUnodOrRedo() ? playQueue->indexAt(QPoint(0, 0)) : QModelIndex(); -// if (topIndex.isValid()) { -// topRow=playQueueProxyModel.mapToSource(topIndex).row(); -// } -// bool wasEmpty=0==playQueueModel.rowCount(); - playQueueModel.update(songs); -// QModelIndex idx=playQueueProxyModel.mapFromSource(playQueueModel.index(playQueueModel.currentSongRow(), 0)); -// bool scroll=autoScrollPlayQueue && playQueueProxyModel.isEmpty() && wasEmpty && MPDState_Playing==MPDStatus::self()->state(); -// playQueue->updateRows(idx.row(), current.key, scroll); -// if (!scroll && topRow>0 && topRowscrollTo(playQueueProxyModel.mapFromSource(playQueueModel.index(topRow, 0)), QAbstractItemView::PositionAtTop); -// } - - if (songs.isEmpty()) { - updateCurrentSong(Song()); - } else if (current.isStandardStream()) { - // Check to see if it has been updated... - Song pqSong=playQueueModel.getSongByRow(playQueueModel.currentSongRow()); - if (pqSong.artist!=current.artist || pqSong.album!=current.album || pqSong.name()!=current.name() || pqSong.title!=current.title || pqSong.year!=current.year) { - updateCurrentSong(pqSong); - } - } -// playQueueItemsSelected(playQueue->haveSelectedItems()); -// updateNextTrack(MPDStatus::self()->nextSongId()); - - //Touch specific: - - if (0==songs.count()) { - playQueueStatus=QString(); - } else if (0==playQueueModel.totalTime()) { - playQueueStatus=Plurals::tracks(songs.count()); - } else { - playQueueStatus=Plurals::tracksWithDuration(songs.count(), Utils::formatDuration(playQueueModel.totalTime())); - } - - emit onPlayQueueChanged(); -} - -void MPDBackend::mpdConnectionStateChanged(bool connected) -{ -// serverInfoAction->setEnabled(connected && !MPDConnection::self()->isMopdidy()); -// refreshDbAction->setEnabled(connected); -// addStreamToPlayQueueAction->setEnabled(connected); - if (connected) { -// messageWidget->hide(); - if (CS_Connected!=connectedState) { - emit playListInfo(); -// emit outputs(); -// if (CS_Init!=connectedState) { -// currentTabChanged(tabWidget->currentIndex()); -// } - connectedState=CS_Connected; -// StdActions::self()->addWithPriorityAction->setVisible(MPDConnection::self()->canUsePriority()); -// setPriorityAction->setVisible(StdActions::self()->addWithPriorityAction->isVisible()); - } -// updateWindowTitle(); - } else { -// libraryPage->clear(); -// albumsPage->clear(); -// folderPage->clear(); -// playlistsPage->clear(); - playQueueModel.clear(); - MusicLibraryModel::self()->clear(); - //AlbumsModel::self()->clear(); //Ubuntu specific -// searchPage->clear(); - connectedState=CS_Disconnected; -// outputsAction->setVisible(false); - MPDStatus dummyStatus; - updateStatus(&dummyStatus); - } -// controlPlaylistActions(); - - //Ubuntu specific: - - emit onCurrentSongChanged(); -} diff --git a/ubuntu/backend/mpdbackend.h b/ubuntu/backend/mpdbackend.h deleted file mode 100644 index 9d880c876..000000000 --- a/ubuntu/backend/mpdbackend.h +++ /dev/null @@ -1,204 +0,0 @@ -/* - * Cantata - * - * Copyright (c) 2014 Niklas Wenzel - * Copyright (c) 2014 Craig Drummond - * - * ---- - * - * 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; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#ifndef MPDBACKEND_H -#define MPDBACKEND_H - -#include -#include -#include - -#include "mpd-interface/mpdconnection.h" -#include "models/albumsmodel.h" -#include "models/musiclibrarymodel.h" -#include "models/playlistsmodel.h" -#include "models/playqueuemodel.h" -#include "models/playqueueproxymodel.h" -#include "models/musiclibraryproxymodel.h" -#include "models/albumsproxymodel.h" -#include "models/playlistsproxymodel.h" -#include "models/dirviewmodel.h" -#include "models/dirviewproxymodel.h" - -class MPDBackend : public QObject -{ - Q_OBJECT - Q_PROPERTY(bool isConnected READ getIsConnected NOTIFY onConnectedChanged) - Q_PROPERTY(bool isPlaying READ getIsPlaying NOTIFY onPlayingStatusChanged) - Q_PROPERTY(bool isStopped READ getIsStopped NOTIFY onPlayingStatusChanged) - Q_PROPERTY(bool isPaused READ getIsPaused NOTIFY onPlayingStatusChanged) - Q_PROPERTY(int crossfade READ getCrossfade NOTIFY onPlayingStatusChanged) - Q_PROPERTY(QStringList outputs READ getOutputs NOTIFY outputsChanged) - Q_PROPERTY(QString replayGain READ getReplayGain NOTIFY replayGainChanged) - - //Information about current song - Q_PROPERTY(QString currentSongMainText READ getCurrentSongMainText NOTIFY onCurrentSongChanged) - Q_PROPERTY(QString currentSongSubText READ getCurrentSongSubText NOTIFY onCurrentSongChanged) - Q_PROPERTY(quint32 currentSongPlayqueuePosition READ getCurrentSongPlayqueuePosition NOTIFY onCurrentSongChanged) - - Q_PROPERTY(bool isRandomOrder READ getIsRandomOrder WRITE setIsRandomOrder NOTIFY onMpdStatusChanged) - Q_PROPERTY(bool isRepeating READ getIsRepeating WRITE setIsRepeating NOTIFY onMpdStatusChanged) - Q_PROPERTY(quint8 mpdVolume READ getMpdVolume WRITE setMpdVolume NOTIFY onMpdStatusChanged) - - Q_PROPERTY(bool playQueueEmpty READ isPlayQueueEmpty NOTIFY onPlayQueueChanged) - Q_PROPERTY(QString playQueueStatus READ getPlayQueueStatus NOTIFY onPlayQueueChanged) - Q_PROPERTY(bool artistsFound READ getArtistsFound NOTIFY onArtistsModelChanged) - Q_PROPERTY(bool albumsFound READ getAlbumsFound NOTIFY onAlbumsModelChanged) - Q_PROPERTY(bool foldersFound READ getFoldersFound NOTIFY onFoldersModelChanged) - Q_PROPERTY(bool playlistsFound READ getPlaylistsFound NOTIFY onPlaylistsModelChanged) - -public: - explicit MPDBackend(QObject *parent = 0); - - Q_INVOKABLE void connectTo(QString hostname, quint16 port, QString password, QString folder); - Q_INVOKABLE void enableAlbumsView(bool en); - Q_INVOKABLE void enableFoldersView(bool en); - Q_INVOKABLE void enablePlaylistsView(bool en); - Q_INVOKABLE void setArtistSortYear(bool s); - Q_INVOKABLE void setAlbumViewSort(int s); - Q_INVOKABLE void setCoverFetch(bool s); - Q_INVOKABLE void playPause(); - Q_INVOKABLE void nextSong(); - Q_INVOKABLE void previousSong(); - Q_INVOKABLE void clearPlayQueue() { emit clear(); } - Q_INVOKABLE bool getIsConnected() { return MPDConnection::self()->isConnected(); } - Q_INVOKABLE void add(const QString &modelName, const QVariant &rows, bool replace); - Q_INVOKABLE void remove(const QString &modelName, const QVariant &rows); - Q_INVOKABLE void loadPlaylist(int index, bool replace); - Q_INVOKABLE void removeFromPlayQueue(int index); - Q_INVOKABLE bool getIsPlaying() { return MPDStatus::self()->state() == MPDState_Playing; } - Q_INVOKABLE bool getIsStopped() { return MPDStatus::self()->state() == MPDState_Stopped; } - Q_INVOKABLE bool getIsPaused() { return MPDStatus::self()->state() == MPDState_Paused; } - Q_INVOKABLE void startPlayingSongAtPos(int index); - Q_INVOKABLE QString getCurrentSongMainText() { return mainText; } - Q_INVOKABLE QString getCurrentSongSubText() { return subText; } - Q_INVOKABLE quint32 getCurrentSongPlayqueuePosition() { return playQueueModel.currentSongRow(); } - Q_INVOKABLE quint8 getMpdVolume() { return MPDStatus::self()->volume(); } - Q_INVOKABLE QString getPlayQueueStatus() { return playQueueStatus; } - Q_INVOKABLE void setMpdVolume(quint8 volume); - Q_INVOKABLE bool isPlayQueueEmpty() { return playQueueModel.rowCount() == 0; } - Q_INVOKABLE bool getArtistsFound() { return MusicLibraryModel::self()->rowCount()>0; } - Q_INVOKABLE bool getAlbumsFound() { return AlbumsModel::self()->rowCount()>0; } - Q_INVOKABLE bool getFoldersFound() { return DirViewModel::self()->rowCount()>0; } - Q_INVOKABLE bool getPlaylistsFound() { return PlaylistsModel::self()->rowCount()>0; } - Q_INVOKABLE bool getIsRandomOrder() { return MPDStatus::self()->random(); } - Q_INVOKABLE void setIsRandomOrder(bool random); - Q_INVOKABLE bool getIsRepeating() { return MPDStatus::self()->repeat(); } - Q_INVOKABLE void setIsRepeating(bool repeating); - Q_INVOKABLE void getPlaybackSettings(); - Q_INVOKABLE void setPlaybackSettings(const QString &replayGain, int crossfade, const QStringList &outputs); - Q_INVOKABLE int getCrossfade() { return MPDStatus::self()->crossFade(); } - Q_INVOKABLE QStringList getOutputs () { return outputSettings; } - Q_INVOKABLE QString getReplayGain () { return replayGainSetting; } - - PlayQueueProxyModel * getPlayQueueProxyModel() { return &playQueueProxyModel; } - MusicLibraryProxyModel * getArtistsProxyModel() { return &artistsProxyModel; } - AlbumsProxyModel * getAlbumsProxyModel() { return &albumsProxyModel; } - DirViewProxyModel * getFoldersProxyModel() { return &foldersProxyModel; } - PlaylistsProxyModel * getPlaylistsProxyModel() { return &playlistsProxyModel; } - -Q_SIGNALS: - void onConnectedChanged(); - void onPlayingStatusChanged(); - void onCurrentSongChanged(); - void onPlayQueueChanged(); - void onArtistsModelChanged(); - void onAlbumsModelChanged(); - void onFoldersModelChanged(); - void onPlaylistsModelChanged(); - void onMpdStatusChanged(); - void outputsChanged(); - void replayGainChanged(); - -public Q_SLOTS: - void onConnected(bool connected); - void updateCurrentSong(const Song &song); - void updateStats(); - void updateStatus(); - void updatePlayQueue(const QList &songs); - void mpdConnectionStateChanged(bool connected); - void artistsUpdated(); - void albumsUpdated(); - void foldersUpdated(); - void playlistsUpdated(); - -private Q_SLOTS: - void outputsUpdated(const QList &outputs); - void replayGainUpdated(const QString &v); - -Q_SIGNALS: - // These are for communicating with MPD object (which is in its own thread, so need to talk via signal/slots) - void setDetails(const MPDConnectionDetails &det); - void pause(bool p); - void play(); - void stop(bool afterCurrent=false); - void getStatus(); - void playListInfo(); - void currentSong(); - void startPlayingSongId(qint32); - void goToNextSong(); - void goToPreviousSong(); - void loadFolders(); - void loadLibrary(); - void add(const QStringList &files, bool replace, quint8 priorty); // Songs - void loadPlaylist(const QString &name, bool replace); - void removePlaylist(const QString &name); - void renamePlaylist(const QString &oldname, const QString &newname); - void removeFromPlaylist(const QString &name, const QList &positions); - - void setVolume(int volume); - void clear(); - void setRandomOrder(bool random); - void setRepeating(bool repeat); - void getReplayGainSetting(); - void setReplayGain(const QString &); - void setCrossFade(int secs); - void getOutputSetting(); - void enableOutput(int id, bool); - -private: - void updateStatus(MPDStatus * const status); - -private: - MPDState lastState; - qint32 lastSongId; - enum { CS_Init, CS_Connected, CS_Disconnected } connectedState; - bool stopAfterCurrent; - - Song current; - QString mainText; - QString subText; - QString playQueueStatus; - QStringList outputSettings; - QString replayGainSetting; - QTimer *statusTimer; - PlayQueueModel playQueueModel; - PlayQueueProxyModel playQueueProxyModel; - MusicLibraryProxyModel artistsProxyModel; - AlbumsProxyModel albumsProxyModel; - DirViewProxyModel foldersProxyModel; - PlaylistsProxyModel playlistsProxyModel; -}; - -#endif // MPDBACKEND_H diff --git a/ubuntu/cantata-ubuntu.desktop b/ubuntu/cantata-ubuntu.desktop deleted file mode 100644 index 9f38be6fe..000000000 --- a/ubuntu/cantata-ubuntu.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Application -Terminal=false -X-Ubuntu-Touch=true -Name=Cantata Reboot -Icon=cantata.png -GenericName=MPD Client -Exec=./cantata -Categories=Qt;KDE;AudioVideo;Player; -X-DBUS-StartupType=Unique -X-DBUS-ServiceName=com.ubuntu.developer.nikwen.cantata-touch-reboot -Keywords=Music;MPD; diff --git a/ubuntu/cantata-ubuntu.json b/ubuntu/cantata-ubuntu.json deleted file mode 100644 index 87a8f8a24..000000000 --- a/ubuntu/cantata-ubuntu.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "policy_groups": [ - "networking" - ], - "policy_version": 1.2 -} diff --git a/ubuntu/icons/desktop/cantata.png b/ubuntu/icons/desktop/cantata.png deleted file mode 100644 index 1d039e3f3..000000000 Binary files a/ubuntu/icons/desktop/cantata.png and /dev/null differ diff --git a/ubuntu/icons/items/album.svg b/ubuntu/icons/items/album.svg deleted file mode 100644 index d180385f7..000000000 --- a/ubuntu/icons/items/album.svg +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/ubuntu/icons/items/artist.svg b/ubuntu/icons/items/artist.svg deleted file mode 100644 index 8487e7a09..000000000 --- a/ubuntu/icons/items/artist.svg +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/ubuntu/icons/items/folder.svg b/ubuntu/icons/items/folder.svg deleted file mode 100644 index 9bd56ae1a..000000000 --- a/ubuntu/icons/items/folder.svg +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ubuntu/icons/items/variousartists.svg b/ubuntu/icons/items/variousartists.svg deleted file mode 100644 index 14adac71b..000000000 --- a/ubuntu/icons/items/variousartists.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/ubuntu/icons/toolbar/add.svg b/ubuntu/icons/toolbar/add.svg deleted file mode 100644 index d050f2533..000000000 --- a/ubuntu/icons/toolbar/add.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/ubuntu/icons/toolbar/chevron@27.png b/ubuntu/icons/toolbar/chevron@27.png deleted file mode 100644 index 9ea9d4840..000000000 Binary files a/ubuntu/icons/toolbar/chevron@27.png and /dev/null differ diff --git a/ubuntu/icons/toolbar/clear.svg b/ubuntu/icons/toolbar/clear.svg deleted file mode 100644 index bf6684a89..000000000 --- a/ubuntu/icons/toolbar/clear.svg +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - diff --git a/ubuntu/icons/toolbar/help.svg b/ubuntu/icons/toolbar/help.svg deleted file mode 100644 index d6372737d..000000000 --- a/ubuntu/icons/toolbar/help.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/ubuntu/icons/toolbar/media-playback-pause.svg b/ubuntu/icons/toolbar/media-playback-pause.svg deleted file mode 100644 index 09783d7c6..000000000 --- a/ubuntu/icons/toolbar/media-playback-pause.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/ubuntu/icons/toolbar/media-playback-start-light.svg b/ubuntu/icons/toolbar/media-playback-start-light.svg deleted file mode 100644 index c1ceb9b96..000000000 --- a/ubuntu/icons/toolbar/media-playback-start-light.svg +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/ubuntu/icons/toolbar/media-playback-start.svg b/ubuntu/icons/toolbar/media-playback-start.svg deleted file mode 100644 index 4fea9e90b..000000000 --- a/ubuntu/icons/toolbar/media-playback-start.svg +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/ubuntu/icons/toolbar/media-skip-backward.svg b/ubuntu/icons/toolbar/media-skip-backward.svg deleted file mode 100644 index bd4c64a2c..000000000 --- a/ubuntu/icons/toolbar/media-skip-backward.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/ubuntu/icons/toolbar/media-skip-forward.svg b/ubuntu/icons/toolbar/media-skip-forward.svg deleted file mode 100644 index eca6aea89..000000000 --- a/ubuntu/icons/toolbar/media-skip-forward.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/ubuntu/icons/toolbar/navigation-menu.svg b/ubuntu/icons/toolbar/navigation-menu.svg deleted file mode 100644 index a0004ca6f..000000000 --- a/ubuntu/icons/toolbar/navigation-menu.svg +++ /dev/null @@ -1,3 +0,0 @@ - - -image/svg+xml diff --git a/ubuntu/icons/toolbar/settings.svg b/ubuntu/icons/toolbar/settings.svg deleted file mode 100644 index 0a037f18e..000000000 --- a/ubuntu/icons/toolbar/settings.svg +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/ubuntu/icons/toolbar/speaker.svg b/ubuntu/icons/toolbar/speaker.svg deleted file mode 100644 index c0765f0cd..000000000 --- a/ubuntu/icons/toolbar/speaker.svg +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - diff --git a/ubuntu/main.cpp b/ubuntu/main.cpp deleted file mode 100644 index 5b6bb3620..000000000 --- a/ubuntu/main.cpp +++ /dev/null @@ -1,214 +0,0 @@ -/* - * Cantata - * - * Copyright (c) 2014 Niklas Wenzel - * - * ---- - * - * 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; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#include -#include -#include -#include -#include -#include -#include - -#include "mpd-interface/mpdconnection.h" -#include "mpd-interface/song.h" -#include "mpd-interface/mpdparseutils.h" -#include "gui/settings.h" -#include "support/thread.h" -#include "ubuntu/backend/mpdbackend.h" -#include "support/utils.h" -#include "models/musiclibrarymodel.h" -#include "models/albumsmodel.h" -#include "models/playlistsmodel.h" -#include "gui/currentcover.h" -#include "config.h" - -// To enable debug... -#include "gui/covers.h" -//#include "wikipediaengine.h" -//#include "lastfmengine.h" -//#include "metaengine.h" -//#include "backdropcreator.h" -//#ifdef ENABLE_DYNAMIC -//#include "dynamic.h" -//#endif -//#include "streamfetcher.h" -//#include "httpserver.h" -//#include "songdialog.h" -#include "network/networkaccessmanager.h" -//#include "ultimatelyricsprovider.h" -//#ifdef ENABLE_EXTERNAL_TAGS -//#include "taghelperiface.h" -//#endif -//#include "contextwidget.h" - -#include - -#include -#include -#include -#include -static QMutex msgMutex; -static bool firstMsg=true; -static void cantataQtMsgHandler(QtMsgType, const QMessageLogContext &, const QString &msg) -{ - QMutexLocker locker(&msgMutex); - QFile f(Utils::cacheDir(QString(), true)+"cantata.log"); - if (f.open(QIODevice::WriteOnly|QIODevice::Append|QIODevice::Text)) { - QTextStream stream(&f); - if (firstMsg) { - stream << "------------START------------" << endl; - firstMsg=false; - } - stream << QDateTime::currentDateTime().toString(Qt::ISODate).replace("T", " ") << " - " << msg << endl; - } -} - -enum Debug { - Dbg_Mpd = 0x0001, - Dbg_MpdParse = 0x0002, - Dbg_Covers = 0x0004, - //Dbg_Context_Wikipedia = 0x0008, - //Dbg_Context_LastFm = 0x0010, - //Dbg_Context_Meta = 0x0020, - //Dbg_Context_Widget = 0x0040, - //Dbg_Context_Backdrop = 0x0080, - //Dbg_Dynamic = 0x0100, - //Dbg_StreamFetching = 0x0200, - //Dbg_HttpServer = 0x0400, - //Dbg_SongDialogs = 0x0800, - Dbg_NetworkAccess = 0x1000, - //Dbg_Context_Lyrics = 0x2000, - Dbg_Threads = 0x4000, - //Dbg_Tags = 0x8000, - - // NOTE: MUST UPDATE Dbg_All IF ADD NEW ITEMS!!! - Dbg_All = 0x5007 -}; - -static void installDebugMessageHandler() -{ - QString debug=qgetenv("CANTATA_DEBUG"); - if (!debug.isEmpty()) { - int dbg=debug.toInt(); - bool logToFile=dbg>0; - if (dbg<0) { - dbg*=-1; - } - if (dbg&Dbg_Mpd) { - MPDConnection::enableDebug(); - } - if (dbg&Dbg_MpdParse) { - MPDParseUtils::enableDebug(); - } - if (dbg&Dbg_Covers) { - Covers::enableDebug(); - } -// if (dbg&Dbg_Context_Wikipedia) { -// WikipediaEngine::enableDebug(); -// } -// if (dbg&Dbg_Context_LastFm) { -// LastFmEngine::enableDebug(); -// } -// if (dbg&Dbg_Context_Meta) { -// MetaEngine::enableDebug(); -// } -// if (dbg&Dbg_Context_Widget) { -// ContextWidget::enableDebug(); -// } -// if (dbg&Dbg_Context_Backdrop) { -// BackdropCreator::enableDebug(); -// } -// #ifdef ENABLE_DYNAMIC -// if (dbg&Dbg_Dynamic) { -// Dynamic::enableDebug(); -// } -// #endif -// if (dbg&Dbg_StreamFetching) { -// StreamFetcher::enableDebug(); -// } -// if (dbg&Dbg_HttpServer) { -// HttpServer::enableDebug(); -// } -// if (dbg&Dbg_SongDialogs) { -// SongDialog::enableDebug(); -// } - if (dbg&Dbg_NetworkAccess) { - NetworkAccessManager::enableDebug(); - } -// if (dbg&Dbg_Context_Lyrics) { -// UltimateLyricsProvider::enableDebug(); -// } - if (dbg&Dbg_Threads) { - ThreadCleaner::enableDebug(); - } -// #ifdef ENABLE_EXTERNAL_TAGS -// if (dbg&Dbg_Tags) { -// TagHelperIface::enableDebug(); -// } -// #endif - if (dbg&Dbg_All && logToFile) { - #if QT_VERSION < 0x050000 - qInstallMsgHandler(cantataQtMsgHandler); - #else - qInstallMessageHandler(cantataQtMsgHandler); - #endif - } - } -} - -int main(int argc, char *argv[]) -{ - QThread::currentThread()->setObjectName("GUI"); - - Utils::initRand(); - Song::initTranslations(); - - // Ensure these objects are created in the GUI thread... - ThreadCleaner::self(); - MPDStatus::self(); - MPDStats::self(); - MPDConnection::self(); - - MPDBackend backend; - QGuiApplication app(argc, argv); - app.setApplicationName(PACKAGE_NAME); - app.setOrganizationName(PACKAGE_NAME); - app.setOrganizationDomain(CANTATA_URL); - installDebugMessageHandler(); - qDebug() << "Organization: " << app.organizationName(); - qmlRegisterType("MPDBackend", 1, 0, "MPDBackend"); - QQuickView view; - view.setMinimumSize(QSize(360, 540)); - view.rootContext()->setContextProperty("backend", &backend); - view.rootContext()->setContextProperty("artistsProxyModel", backend.getArtistsProxyModel()); - view.rootContext()->setContextProperty("albumsProxyModel", backend.getAlbumsProxyModel()); - view.rootContext()->setContextProperty("foldersProxyModel", backend.getFoldersProxyModel()); - view.rootContext()->setContextProperty("playlistsProxyModel", backend.getPlaylistsProxyModel()); - view.rootContext()->setContextProperty("playQueueProxyModel", backend.getPlayQueueProxyModel()); - view.rootContext()->setContextProperty("currentCover", CurrentCover::self()); - view.rootContext()->setContextProperty("appDir", Utils::dataDir(QString(), true)); - view.setResizeMode(QQuickView::SizeRootObjectToView); - view.setSource(QUrl("qrc:qml/cantata/main.qml")); - view.show(); - return app.exec(); -} diff --git a/ubuntu/manifest.json b/ubuntu/manifest.json deleted file mode 100644 index 7c373ff3e..000000000 --- a/ubuntu/manifest.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "com.ubuntu.developer.nikwen.cantata-touch-reboot", - "framework": "ubuntu-sdk-14.10-dev2", - "architecture": "armhf", - "hooks": { - "cantata": { - "apparmor": "cantata-ubuntu.json", - "desktop": "cantata-ubuntu.desktop" - } - }, - "title": "Cantata", - "description": "MPD Client for Ubuntu", - "maintainer": "Niklas Wenzel ", - "version": "0.2.0" -} diff --git a/ubuntu/qml/cantata/AboutPage.qml b/ubuntu/qml/cantata/AboutPage.qml deleted file mode 100644 index bec35f190..000000000 --- a/ubuntu/qml/cantata/AboutPage.qml +++ /dev/null @@ -1,342 +0,0 @@ -/************************************************************************* -** Cantata -** -** Copyright (c) 2014 Niklas Wenzel -** -** $QT_BEGIN_LICENSE:GPL$ -** 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; see the file COPYING. If not, write to -** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -** Boston, MA 02110-1301, USA. -** -** -** $QT_END_LICENSE$ -** -*************************************************************************/ - -import QtQuick 2.2 -import Ubuntu.Components 1.1 -import Ubuntu.Layouts 1.0 - -Page { - id: aboutPage - title: i18n.tr("About") - - Layouts { - id: aboutTabLayout - anchors.fill: parent - - layouts: [ -// ConditionalLayout { -// id: conditionalLayout -// name: "tablet" -// when: root.width > units.gu(80) -// Row { -// anchors { -// left: parent!=null?parent.left:conditionalLayout.left -// leftMargin: root.width*0.1 -// top: parent!=null?parent.top:conditionalLayout.top -// topMargin: root.height*0.2 - -// } -// spacing: units.gu(5) -// ItemLayout { -// item: "icon" -// id: iconTabletItem -// property real maxWidth: units.gu(80) -// width: Math.min(parent.width, maxWidth)/2 -// height: Math.min(parent.width, maxWidth)/2 - -// } -// Column { -// spacing: 1 -// ItemLayout { -// item: "info" -// width: aboutTabLayout.width*0.25 -// height: iconTabletItem.height*0.75 -// } -// ItemLayout { -// item: "link" -// width: aboutTabLayout.width*0.25 -// height: units.gu(3) -// } -// ItemLayout { -// item: "version" -// width: aboutTabLayout.width*0.25 -// height: units.gu(2) -// } -// ItemLayout { -// item: "year" -// width: aboutTabLayout.width*0.25 -// height: units.gu(2) -// } -// } -// } -// }, - ConditionalLayout { - id: conditionalLayout - name: "tablet" - when: root.width > units.gu(80) - Row { - anchors { - left: parent!=null?parent.left:conditionalLayout.left - leftMargin: root.width*0.1 - top: parent!=null?parent.top:conditionalLayout.top - topMargin: root.height*0.2 - - } - spacing: units.gu(5) - - UbuntuShape { - id: iconTabletItem - property real maxWidth: units.gu(80) - width: Math.min(parent.width, maxWidth)/2 - height: Math.min(parent.width, maxWidth)/2 - image: Image { - source: "../../icons/cantata.svg" - smooth: true - fillMode: Image.PreserveAspectFit - - } - } - - Column { - spacing: 1 - Grid { - anchors.horizontalCenter: parent.horizontalCenter - columns: 2 - rowSpacing: units.gu(2) - columnSpacing: root.width/10 - width: aboutTabLayout.width*0.25 - height: iconTabletItem.height*0.75 - Label { - text: i18n.tr("Authors: ") - - } - Label { - text: "Niklas Wenzel
Craig Drummond

Sander Knopper
Roeland Douma
Daniel Selinger
Armin Walland" - } - Label { - text: i18n.tr("Contact: ") - } - Label { - font.bold: true; - text: "nikwen.developer@gmail.com" - } - - } - Row { - anchors.horizontalCenter: parent.horizontalCenter - width: aboutTabLayout.width*0.25 - height: units.gu(3) - Label { - font.bold: true - text: "https://github.com/CDrummond/cantata" - onLinkActivated: Qt.openUrlExternally(link) - } - } - Row { - anchors.horizontalCenter: parent.horizontalCenter - width: aboutTabLayout.width*0.25 - height: units.gu(2) - Label { - text: i18n.tr("Version: ") - } - Label { - font.bold: true; - text: "0.2.0" - } - } - Row { - anchors.horizontalCenter: parent.horizontalCenter - width: aboutTabLayout.width*0.25 - height: units.gu(2) - Label { - font.bold: true; - text: "2014" - } - } - } - } - }, - ConditionalLayout { - id: quickFixConditionalLayoutPhone - name: "phone" - when: root.width <= units.gu(80) - - Flickable { - id: flickable2 - anchors.fill: parent - clip: true - - contentHeight: aboutColumn2.height + 2 * aboutColumn2.marginTop //doubled marginTop to get the same margin at the bottom - - Column { - id: aboutColumn2 - spacing: units.gu(3) - width: parent.width - property real marginTop: units.gu(3) - y: marginTop - - UbuntuShape { - property real maxWidth: units.gu(45) - anchors.horizontalCenter: parent.horizontalCenter - width: Math.min(parent.width, maxWidth)/2 - height: Math.min(parent.width, maxWidth)/2 - image: Image { - source: "../../icons/cantata.svg" - smooth: true - fillMode: Image.PreserveAspectFit - - } - } - - Grid { - anchors.horizontalCenter: parent.horizontalCenter - columns: 2 - rowSpacing: units.gu(2) - columnSpacing: root.width/10 - Label { - text: i18n.tr("Authors: ") - - } - Label { - text: "Niklas Wenzel
Craig Drummond

Sander Knopper
Roeland Douma
Daniel Selinger
Armin Walland" - } - Label { - text: i18n.tr("Contact: ") - } - Label { - font.bold: true; - text: "nikwen.developer@gmail.com" - } - - } - - Row { - id: homepage2 - anchors.horizontalCenter: parent.horizontalCenter - Label { - font.bold: true - text: "https://github.com/CDrummond/cantata" - onLinkActivated: Qt.openUrlExternally(link) - } - } - Row { - anchors.horizontalCenter: parent.horizontalCenter - Label { - text: i18n.tr("Version: ") - } - Label { - font.bold: true; - text: "0.2.0" - } - } - Row { - anchors.horizontalCenter: parent.horizontalCenter - Label { - font.bold: true; - text: "2014" - } - } - } - } - } - - - ] - - Flickable { - id: flickable - anchors.fill: parent - clip: true - - contentHeight: aboutColumn.height + 2 * aboutColumn.marginTop + root.header.height //doubled marginTop to get the same margin at the bottom - - Column { - id: aboutColumn - spacing: units.gu(3) - width: parent.width - property real marginTop: units.gu(6) - y: marginTop + root.header.height - - UbuntuShape { - Layouts.item: "icon" - property real maxWidth: units.gu(45) - anchors.horizontalCenter: parent.horizontalCenter - width: Math.min(parent.width, maxWidth)/2 - height: Math.min(parent.width, maxWidth)/2 - image: Image { - source: "../../icons/cantata.svg" - smooth: true - fillMode: Image.PreserveAspectFit - - } - } - - Grid { - anchors.horizontalCenter: parent.horizontalCenter - columns: 2 - rowSpacing: units.gu(2) - columnSpacing: root.width/10 - Layouts.item: "info" - Label { - text: i18n.tr("Authors: ") - - } - Label { - text: "Niklas Wenzel
Craig Drummond

Sander Knopper
Roeland Douma
Daniel Selinger
Armin Walland" - } - Label { - text: i18n.tr("Contact: ") - } - Label { - font.bold: true; - text: "nikwen.developer@gmail.com" - } - - } - - Row { - id: homepage - anchors.horizontalCenter: parent.horizontalCenter - Layouts.item: "link" - Label { - font.bold: true - text: "https://github.com/CDrummond/cantata" - onLinkActivated: Qt.openUrlExternally(link) - } - } - Row { - anchors.horizontalCenter: parent.horizontalCenter - Layouts.item: "version" - Label { - text: i18n.tr("Version: ") - } - Label { - font.bold: true; - text: "0.2.0" - } - } - Row { - Layouts.item: "year" - anchors.horizontalCenter: parent.horizontalCenter - Label { - font.bold: true; - text: "2014" - } - } - } - } - } -} diff --git a/ubuntu/qml/cantata/CurrentlyPlayingContent.qml b/ubuntu/qml/cantata/CurrentlyPlayingContent.qml deleted file mode 100644 index 5505c4e3c..000000000 --- a/ubuntu/qml/cantata/CurrentlyPlayingContent.qml +++ /dev/null @@ -1,162 +0,0 @@ -/************************************************************************* -** Cantata -** -** Copyright (c) 2014 Niklas Wenzel - * Copyright (c) 2014 Craig Drummond -** -** $QT_BEGIN_LICENSE:GPL$ -** 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; see the file COPYING. If not, write to -** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -** Boston, MA 02110-1301, USA. -** -** -** $QT_END_LICENSE$ -** -*************************************************************************/ - -import QtQuick 2.2 -import Ubuntu.Components 1.1 -import Ubuntu.Components.ListItems 1.0 as ListItem -import Ubuntu.Components.Popups 1.0 -import Qt.labs.settings 1.0 -import 'qrc:/qml/cantata/components' - -Item { - id: currentlyPlayingContent - - property int buttonSize: isPhone ? units.gu(6) : units.gu(7) - - Column { - id: currentSongInfoColumn - anchors { - top: parent.top - topMargin: units.gu(1) - } - width: parent.width - spacing: units.gu(0.5) - visible: !(backend.playQueueEmpty || backend.isStopped) && backend.isConnected - - Label { - id: titleLabel - width: parent.width - text: backend.currentSongMainText - wrapMode: Text.NoWrap - elide: Text.ElideRight - horizontalAlignment: Text.AlignHCenter - fontSize: "large" - } - - Label { - id: artistLabel - width: parent.width - text: backend.currentSongSubText - wrapMode: Text.NoWrap - elide: Text.ElideRight - horizontalAlignment: Text.AlignHCenter - } - } - - ControlButtonsRow { - id: buttonsRow - visible: currentSongInfoColumn.visible - - anchors { - top: currentSongInfoColumn.bottom - horizontalCenter: parent.horizontalCenter - } - } - - Label { - id: playQueueLabel - text: i18n.tr("Play Queue:") - anchors { - top: buttonsRow.visible?buttonsRow.bottom:parent.top - left: parent.left - topMargin: units.gu(1) - leftMargin: units.gu(1) - } - } - - Label { - id: playQueueStatusLabel - text: backend.playQueueStatus - anchors { - top: playQueueLabel.top - right: parent.right - rightMargin: units.gu(1) - } - visible: !backend.playQueueEmpty && backend.isConnected; - } - - ListView { - id: playqueueListView - clip: true - model: playQueueProxyModel - - anchors { - top: playQueueLabel.bottom - left: parent.left - right: parent.right - bottom: parent.bottom - } - - Connections { - target: backend - onCurrentSongPlayqueuePositionChanged: { - playqueueListView.scrollToCurrent() - } - } - - Component.onCompleted: { //TODO-r: Scroll to current position, but wrong numbers during swipe gesture - scrollToCurrent() - } - - function scrollToCurrent() { - if (settingsBackend.scrollPlayQueue) { - console.log("pos: " + backend.getCurrentSongPlayqueuePosition()) - playqueueListView.positionViewAtIndex(backend.getCurrentSongPlayqueuePosition(), ListView.Contain) - } - } - - delegate: PlayQueueListItemDelegate { - id: delegate - text: model.mainText - subText: model.subText - timeText: model.time - iconSource: model.image - confirmRemoval: true - removable: true - currentTrack: index === backend.getCurrentSongPlayqueuePosition() - onItemRemoved: { - backend.removeFromPlayQueue(index) - } - - onClicked: backend.startPlayingSongAtPos(index) - - Connections { - target: backend - onCurrentSongPlayqueuePositionChanged: { - delegate.currentTrack = (index === backend.getCurrentSongPlayqueuePosition()) - } - } - } - } - - Label { - anchors.centerIn: playqueueListView - text: i18n.tr("No songs queued for playing") - fontSize: "large" - visible: backend.playQueueEmpty || !backend.isConnected - } -} diff --git a/ubuntu/qml/cantata/CurrentlyPlayingPage.qml b/ubuntu/qml/cantata/CurrentlyPlayingPage.qml deleted file mode 100644 index 0166a7ed9..000000000 --- a/ubuntu/qml/cantata/CurrentlyPlayingPage.qml +++ /dev/null @@ -1,239 +0,0 @@ -/************************************************************************* -** Cantata -** -** Copyright (c) 2014 Niklas Wenzel - * Copyright (c) 2014 Craig Drummond -** -** $QT_BEGIN_LICENSE:GPL$ -** 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; see the file COPYING. If not, write to -** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -** Boston, MA 02110-1301, USA. -** -** -** $QT_END_LICENSE$ -** -*************************************************************************/ - -import QtQuick 2.2 -import Ubuntu.Components 1.1 -import Ubuntu.Components.ListItems 1.0 as ListItem -import Ubuntu.Components.Popups 1.0 -import 'qrc:/qml/cantata/components' - -Page { - id: currentlyPlayingPage - - title: i18n.tr("Currently Playing") - - property Dialog actionsDialog - - Component { - id: dialog - Dialog { - id: dialogue - title: i18n.tr("Clear Play Queue") - - Button { - text: i18n.tr("Yes") - color: UbuntuColors.orange - onClicked: (backend.clearPlayQueue(), PopupUtils.close(dialogue)) - } - Button { - text: i18n.tr("No") - color: UbuntuColors.coolGrey - onClicked: PopupUtils.close(dialogue) - } - } - } - - head.actions: [ //TODO: Better solution when using just the content - Action { - iconName: "edit-clear" - text: i18n.tr("Clear") - onTriggered: PopupUtils.open(dialog) - }, - - Action { - iconName: "stock_music" - text: i18n.tr("Actions") - onTriggered: actionsDialog = PopupUtils.open(actionsDialogComponent) - } - ] - - Component { - id: actionsDialogComponent - - Dialog { - id: actionsDialog - - title: i18n.tr("Playback Options") - - contents: [ - Column { - id: containerLayout - - ListItem.Header { text: i18n.tr("Playback") } - ListItem.Standard { - Label { - anchors { - left: parent.left - leftMargin: units.gu(1) - verticalCenter: parent.verticalCenter - } - - color: volumeHeader.color - - text: i18n.tr("Repeat") - } - - CheckBox { - id: repeatCheckBox - anchors { - right: parent.right - rightMargin: units.gu(1) - verticalCenter: parent.verticalCenter - } - - checked: backend.isRepeating - - Connections { - target: backend - onIsRepeatingChanged: repeatCheckBox.checked = backend.isRepeating - } - - onTriggered: { - if (checked !== backend.isRepeating) { - backend.setIsRepeating(checked) - } - } - } - } - ListItem.Standard { - Label { - anchors { - left: parent.left - leftMargin: units.gu(1) - verticalCenter: parent.verticalCenter - } - - color: volumeHeader.color - - text: i18n.tr("Random") - } - - CheckBox { - id: randomCheckBox - anchors { - right: parent.right - rightMargin: units.gu(1) - verticalCenter: parent.verticalCenter - } - - checked: backend.isRandomOrder - - Connections { - target: backend - onIsRandomOrderChanged: randomCheckBox.checked = backend.isRandomOrder - } - - onTriggered: { - if (checked !== backend.isRandomOrder) { - backend.setIsRandomOrder(checked) - } - } - } - } - - ListItem.Header { - id: volumeHeader - text: i18n.tr("Volume") - } - - ListItem.Standard { - anchors { - left: parent.left - right: parent.right - leftMargin: units.gu(1) - rightMargin: units.gu(1) - } - Row { - width: parent.width - spacing: units.gu(1) - - Image { - id: speakerImage - height: units.gu(3) - width: units.gu(3) - smooth: true - anchors.verticalCenter: parent.verticalCenter - source: "../../icons/toolbar/speaker.svg" - } - - Slider { - id: volumeSlider2 - width: parent.width - speakerImage.width - parent.spacing - live: false - minimumValue: 0 - maximumValue: 100 - value: backend.mpdVolume - - onValueChanged: { - backend.setMpdVolume(value) - } - - Connections { - target: backend - onMpdVolumeChanged: volumeSlider2.value = backend.mpdVolume - } - - function formatValue(v) { - return Math.round(v) + "%" - } - } - } - } - - Item { - id: dialogSpacer - - height: units.gu(3) - width: parent.width - } - - Button { - text: i18n.tr("Ready") - color: UbuntuColors.orange - - anchors { - left: parent.left - right: parent.right - leftMargin: units.gu(1) - rightMargin: units.gu(1) - } - - onClicked: PopupUtils.close(actionsDialog) - } - } - - - ] - } - } - - CurrentlyPlayingContent { - id: currentlyPlayingContent - - anchors.fill: parent - } -} diff --git a/ubuntu/qml/cantata/ListViewPage.qml b/ubuntu/qml/cantata/ListViewPage.qml deleted file mode 100644 index 20487357f..000000000 --- a/ubuntu/qml/cantata/ListViewPage.qml +++ /dev/null @@ -1,201 +0,0 @@ -/************************************************************************* -** Cantata -** -** Copyright (c) 2014 Niklas Wenzel -** Copyright (c) 2014 Craig Drummond -** -** $QT_BEGIN_LICENSE:GPL$ -** 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; see the file COPYING. If not, write to -** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -** Boston, MA 02110-1301, USA. -** -** -** $QT_END_LICENSE$ -** -*************************************************************************/ - -import QtQuick 2.2 -import Ubuntu.Components 1.1 -import Ubuntu.Components.ListItems 1.0 as ListItem -import Ubuntu.Layouts 1.0 -import 'qrc:/qml/cantata/' -import 'qrc:/qml/cantata/components' - -PageWithBottomEdge { - id: listViewPage - - property string modelName - property bool editable: false - property alias model: listView.model - property alias emptyViewVisible: emptyLabel.visible - property alias emptyViewText: emptyLabel.text //TODO: Fix position in tablet view - - function add(index, replace, mainText) { - backend.add(modelName, index, replace) - if (replace && isPhone) { - pageStack.push(Qt.resolvedUrl("CurrentlyPlayingPage.qml")) - } else if (mainText !== undefined && mainText !== "") { - notification.show(qsTr(replace ? i18n.tr("Playing \"%1\"") : i18n.tr("Added \"%1\"")).arg(mainText)) - } - } - - function remove(index) { - backend.remove(modelName, index) - } - - function onDelegateClicked(index, text) { - var component = Qt.createComponent("SubListViewPage.qml") - if (component.status === Component.Ready) { - var page = component.createObject(parent, {"model": model, "title": text, "modelName": modelName}) - page.init([index]) - page.editable=editable - pageStack.push(page) - } - } - - head.actions: [ - Action { - iconName: "settings" - text: i18n.tr("Settings") - onTriggered: pageStack.push(settingsPage) - }, - - Action { - iconName: "info" - text: i18n.tr("About") - onTriggered: pageStack.push(aboutPage) - } - ] - - bottomEdgePageSource: Qt.resolvedUrl("CurrentlyPlayingPage.qml") - bottomEdgeTitle: i18n.tr("Currently Playing") - bottomEdgeEnabled: isPhone - - Connections { - target: settingsBackend - - onFetchCoversChanged: { - var saveModel = listView.model - listView.model = undefined - listView.model = saveModel - } - } - - Layouts { //TODO: Same for SubListViewPage - id: layouts - - height: parent.height //NOT "anchors.fill: parent" as otherwise the bottom edge gesture will continue behind the header - width: parent.width - - anchors { - top: parent.top - left: parent.left - } - - layouts: [ - ConditionalLayout { - id: tabletLayout - name: "tablet" - when: !isPhone //TODO: Fix width of isPhone - - Item { - anchors.fill: parent - - property real spacing: units.gu(2) //TODO: Visual divider? - - ItemLayout { - item: "listView" - - width: (parent.width - spacing) / 2 - anchors { - top: parent.top - bottom: parent.bottom - left: parent.left - } - } - - ItemLayout { - item: "emptyView" - anchors.centerIn: parent - } - - CurrentlyPlayingContent { //TODO: Is it possible to use the same page for all ListViewPages? - id: currentlyPlayingPage - - width: (parent.width - spacing) / 2 - anchors { - top: parent.top - bottom: parent.bottom - right: parent.right - } - } - } - - - } - - ] - - ListView { - id: listView - Layouts.item: "listView" - - height: parent.height - width: parent.width - - anchors { - top: parent.top - left: parent.left - } - - clip: true - - property bool hasProgression: false - - delegate: ListItemDelegate { - id: delegate - text: model.mainText - subText: model.subText - iconSource: model.image - confirmRemoval: true - removable: listViewPage.editable - - progression: model.hasChildren; - forceProgressionSpacing: listView.hasProgression - - firstButtonIconName: "media-playback-start" - secondButtonIconName: "add" - - onFirstImageButtonClicked: listViewPage.add(index, true, model.mainText) - onSecondImageButtonClicked: listViewPage.add(index, false, model.mainText) - - onClicked: model.hasChildren ? listViewPage.onDelegateClicked(index, model.titleText) : ""; - onItemRemoved: listViewPage.remove(index) - - onProgressionChanged: { - if (progression) { - listView.hasProgression = true - } - } - } - } - - Label { - id: emptyLabel - Layouts.item: "emptyView" - anchors.centerIn: listView - fontSize: "large" - } - } -} diff --git a/ubuntu/qml/cantata/SubListViewPage.qml b/ubuntu/qml/cantata/SubListViewPage.qml deleted file mode 100644 index 3e5d018cc..000000000 --- a/ubuntu/qml/cantata/SubListViewPage.qml +++ /dev/null @@ -1,169 +0,0 @@ -/************************************************************************* -** Cantata -** -** Copyright (c) 2014 Niklas Wenzel -** Copyright (c) 2014 Craig Drummond -** -** $QT_BEGIN_LICENSE:GPL$ -** 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; see the file COPYING. If not, write to -** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -** Boston, MA 02110-1301, USA. -** -** -** $QT_END_LICENSE$ -** -*************************************************************************/ - -import QtQuick 2.2 -import Ubuntu.Components 1.1 -import Ubuntu.Components.ListItems 1.0 as ListItem -import 'qrc:/qml/cantata/' -import 'qrc:/qml/cantata/components' - -PageWithBottomEdge { - id: subListViewPage - - property bool editable: false - property variant rows - property string modelName - property alias model: visualDataModel.model - - function hierarchy(index) { - var newRows = [] - for (var i = 0; i < rows.length; i++) { - newRows[i] = rows[i] - } - newRows[rows.length] = index - return newRows - } - - function add(index, replace, mainText) { - backend.add(modelName, hierarchy(index), replace) - if (replace && isPhone) { - pageStack.push(Qt.resolvedUrl("CurrentlyPlayingPage.qml")) - } else if (mainText !== undefined && mainText !== "") { - notification.show(qsTr(replace ? i18n.tr("Playing \"%1\"") : i18n.tr("Added \"%1\"")).arg(mainText)) - } - } - - function addAll(replace) { - backend.add(modelName, rows, replace) - if (replace && isPhone) { - pageStack.push(Qt.resolvedUrl("CurrentlyPlayingPage.qml")) - } else if (mainText !== undefined && mainText !== "") { - notification.show(qsTr(replace ? i18n.tr("Playing all \"%1\"") : i18n.tr("Added all \"%1\"")).arg(title)) - } - } - - function remove(index) { - backend.remove(modelName, hierarchy(index)) - } - - function onDelegateClicked(index, text) { - var component = Qt.createComponent("SubListViewPage.qml") - if (component.status === Component.Ready) { - var page = component.createObject(parent, {"model": model, "title": text, "modelName": modelName}) - page.init(hierarchy(index)) - pageStack.push(page) - } - } - - function init(rows) { - this.rows = rows - subListView.model.rootIndex = -1 - for (var i = 0; i < this.rows.length; i++) { - subListView.model.rootIndex = subListView.model.modelIndex(this.rows[i]) - } - } - - head.actions: [ - Action { - iconName: "media-playback-start" - text: i18n.tr("Play all") - onTriggered: addAll(true) - }, - Action { - iconName: "add" - text: i18n.tr("Add all") - onTriggered: addAll(false) - }, - Action { - iconName: "settings" - text: i18n.tr("Settings") - onTriggered: pageStack.push(settingsPage) - }, - - Action { - iconName: "info" - text: i18n.tr("About") - onTriggered: pageStack.push(aboutPage) - } - ] - - bottomEdgePageSource: Qt.resolvedUrl("CurrentlyPlayingPage.qml") - bottomEdgeTitle: i18n.tr("Currently Playing") - - Connections { - target: settingsBackend - - onFetchCoversChanged: { - var saveModel = listView.model - listView.model = undefined - listView.model = saveModel - } - } - - ListView { - id: subListView - - height: parent.height //NOT "anchors.fill: parent" as otherwise the bottom edge gesture will continue behind the header - width: parent.width - - clip: true - - property bool hasProgression: false - - model: VisualDataModel { - id: visualDataModel - - onRootIndexChanged: subListView.hasProgression = false - - delegate: ListItemDelegate { - id: delegate - text: model.mainText - subText: model.subText - iconSource: model.image - confirmRemoval: true - removable: subListViewPage.editable - - firstButtonIconName: "media-playback-start" - secondButtonIconName: "add" - progression: model.hasChildren - forceProgressionSpacing: subListView.hasProgression - - onFirstImageButtonClicked: subListViewPage.add(index, true, model.mainText) - onSecondImageButtonClicked: subListViewPage.add(index, false, model.mainText) - - onClicked: model.hasChildren ? subListViewPage.onDelegateClicked(index, model.titleText) : ""; - onItemRemoved: subListViewPage.remove(index) - - onProgressionChanged: { - if (progression) { - subListView.hasProgression = true - } - } - } - } - } -} diff --git a/ubuntu/qml/cantata/backend/SettingsBackend.qml b/ubuntu/qml/cantata/backend/SettingsBackend.qml deleted file mode 100644 index 4f64fd3b4..000000000 --- a/ubuntu/qml/cantata/backend/SettingsBackend.qml +++ /dev/null @@ -1,56 +0,0 @@ -/************************************************************************* -** Cantata -** -** Copyright (c) 2014 Niklas Wenzel -** Copyright (c) 2014 Craig Drummond -** -** $QT_BEGIN_LICENSE:GPL$ -** 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; see the file COPYING. If not, write to -** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -** Boston, MA 02110-1301, USA. -** -** -** $QT_END_LICENSE$ -** -*************************************************************************/ - -import QtQuick 2.2 -import Ubuntu.Components 1.1 -import Qt.labs.settings 1.0 -import 'qrc:/qml/cantata/' - -Item { - - readonly property alias uiSettings: uiSettings - - readonly property alias scrollPlayQueue: uiSettings.scrollPlayQueue - readonly property alias fetchCovers: uiSettings.fetchCovers - - Component.onCompleted: { - backend.setCoverFetch(fetchCovers) - } - - onFetchCoversChanged: { - backend.setCoverFetch(fetchCovers) - } - - Settings { - id: uiSettings - - category: "ui" - property bool scrollPlayQueue: true - property bool fetchCovers: true - } - -} diff --git a/ubuntu/qml/cantata/components/ControlButtonsRow.qml b/ubuntu/qml/cantata/components/ControlButtonsRow.qml deleted file mode 100644 index 7cd9f69dc..000000000 --- a/ubuntu/qml/cantata/components/ControlButtonsRow.qml +++ /dev/null @@ -1,83 +0,0 @@ -/************************************************************************* -** Cantata -** -** Copyright (c) 2014 Niklas Wenzel -** -** $QT_BEGIN_LICENSE:GPL$ -** 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; see the file COPYING. If not, write to -** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -** Boston, MA 02110-1301, USA. -** -** -** $QT_END_LICENSE$ -** -*************************************************************************/ - -import QtQuick 2.2 -import Ubuntu.Components 1.1 -import 'qrc:/qml/cantata' - -Row { - id: buttonsRow - height: Math.max(previousSongButton.height, playPauseButton.height, nextSongButton.height) - width: 3 * currentlyPlayingPage.buttonSize + 2 * spacing - - Image { - id: previousSongButton - width: currentlyPlayingContent.buttonSize - height: currentlyPlayingContent.buttonSize - smooth: true - source: "../../../icons/toolbar/media-skip-backward.svg" - - MouseArea { - onClicked: { - backend.previousSong() - } - anchors.fill: parent - preventStealing: true - } - } - - Image { - id: playPauseButton - width: currentlyPlayingContent.buttonSize - height: currentlyPlayingContent.buttonSize - smooth: true - source: backend.isPlaying?"../../../icons/toolbar/media-playback-pause.svg":"../../../icons/toolbar/media-playback-start.svg" - - MouseArea { - onClicked: { - backend.playPause() - } - anchors.fill: parent - preventStealing: true - } - } - - Image { - id: nextSongButton - width: currentlyPlayingContent.buttonSize - height: currentlyPlayingContent.buttonSize - smooth: true - source: "../../../icons/toolbar/media-skip-forward.svg" - - MouseArea { - onClicked: { - backend.nextSong() - } - anchors.fill: parent - preventStealing: true - } - } -} diff --git a/ubuntu/qml/cantata/components/LabelVisual.qml b/ubuntu/qml/cantata/components/LabelVisual.qml deleted file mode 100644 index 4bb0b86bf..000000000 --- a/ubuntu/qml/cantata/components/LabelVisual.qml +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2012 Canonical Ltd. - * - * This program 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; version 3. - * - * 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 Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -import QtQuick 2.2 -import Ubuntu.Components 1.1 - -// internal helper class for text inside the list items. -Label { - id: label - property bool selected: false - property bool secondary: false - - // FIXME: very ugly hack to detect whether the list item is inside a Popover - property bool overlay: isInsideOverlay(label) - function isInsideOverlay(item) { - if (!item.parent) return false; - return item.parent.hasOwnProperty("pointerTarget") || label.isInsideOverlay(item.parent) - } - - fontSize: "medium" - elide: Text.ElideRight - color: selected ? UbuntuColors.orange : secondary ? overlay ? Theme.palette.normal.overlayText : Theme.palette.normal.backgroundText - : overlay ? Theme.palette.selected.overlayText : Theme.palette.selected.backgroundText - opacity: label.enabled ? 1.0 : 0.5 -} diff --git a/ubuntu/qml/cantata/components/ListItemDelegate.qml b/ubuntu/qml/cantata/components/ListItemDelegate.qml deleted file mode 100644 index b9b393278..000000000 --- a/ubuntu/qml/cantata/components/ListItemDelegate.qml +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright 2012 Canonical Ltd. - * Copyright 2014 Niklas Wenzel - * - * This program 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; version 3. - * - * 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 Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -import QtQuick 2.2 -import Ubuntu.Components 1.1 -import Ubuntu.Components.ListItems 1.0 - -Empty { - id: listItemDelegate - __height: Math.max(middleVisuals.height, units.gu(6)) - - property alias text: label.text - - property alias subText: subLabel.text - - property alias iconSource: iconImage.source - - property bool progression: false - property bool forceProgressionSpacing: false - - property alias firstButtonIconName: firstIcon.name - property alias secondButtonIconName: secondIcon.name - property alias firstButtonIconSource: firstIcon.source - property alias secondButtonIconSource: secondIcon.source - - signal firstImageButtonClicked() - signal secondImageButtonClicked() - - property bool firstButtonShown: firstIcon.source !== "" || firstIcon.name !== "" - property bool secondButtonShown: secondIcon.source !== "" || secondIcon.name !== "" - property bool iconShown: iconImage.source !== "" - - UbuntuShape { - id: iconShape - width: units.gu(5.5) - height: units.gu(5.5) - anchors { - left: parent.left - leftMargin: units.gu(2) - verticalCenter: parent.verticalCenter - } - visible: iconShown - - image: Image { - id: iconImage - smooth: true - opacity: 0.9 - anchors.fill: parent - } - } - - Item { - id: middleVisuals - anchors { - left: iconShown?iconShape.right:parent.left - right: secondButtonShown?secondIcon.left:(firstButtonShown?firstIcon.left:((listItemDelegate.progression || listItemDelegate.forceProgressionSpacing)?progressionImage.right:parent.right)) - leftMargin: units.gu(iconShown?1:2) - rightMargin: units.gu(firstButtonShown?1:2) - verticalCenter: parent.verticalCenter - } - height: childrenRect.height + label.anchors.topMargin + subLabel.anchors.bottomMargin - - LabelVisual { - id: label - selected: listItemDelegate.selected - anchors { - top: parent.top - left: parent.left - right: parent.right - } - } - LabelVisual { - id: subLabel - selected: listItemDelegate.selected - secondary: true - anchors { - left: parent.left - right: parent.right - top: label.bottom - } - fontSize: "small" - } - } - - Icon { //TODO: Revert changes regarding icons! - id: secondIcon - width: units.gu(3) - height: units.gu(3) - visible: secondButtonShown - - anchors { - right: firstIcon.left - rightMargin: units.gu(1) - verticalCenter: parent.verticalCenter - } - - MouseArea { - id: secondTarget - onClicked: secondImageButtonClicked() - anchors.fill: parent - preventStealing: true - } - } - - Icon { - id: firstIcon - width: units.gu(3) - height: units.gu(3) - visible: firstButtonShown - - anchors { - right: (listItemDelegate.progression || listItemDelegate.forceProgressionSpacing)?progressionImage.left:parent.right - rightMargin: (listItemDelegate.progression || listItemDelegate.forceProgressionSpacing)?units.gu(1.5):units.gu(2) - verticalCenter: parent.verticalCenter - } - - MouseArea { - id: firstTarget - onClicked: firstImageButtonClicked() - - anchors.fill: parent - preventStealing: true - } - } - - Image { - id: progressionImage - anchors { - verticalCenter: parent.verticalCenter - right: parent.right - rightMargin: units.gu(2) - } - - opacity: enabled ? 1.0 : 0.5 - source: "../../../icons/toolbar/chevron.png" - - visible: listItemDelegate.progression - } -} diff --git a/ubuntu/qml/cantata/components/Notification.qml b/ubuntu/qml/cantata/components/Notification.qml deleted file mode 100644 index 64bc72c05..000000000 --- a/ubuntu/qml/cantata/components/Notification.qml +++ /dev/null @@ -1,81 +0,0 @@ -import QtQuick 2.2 -import Ubuntu.Components 1.1 - -Rectangle { - id: notification - - anchors { - horizontalCenter: parent.horizontalCenter - bottom: parent.bottom - margins: (mainView.useDeprecatedToolbar && toolbar.opened && !toolbar.locked ? toolbar.height : 0) + units.gu(2) + ((!mainView.anchorToKeyboard && Qt.inputMethod.visible) ? Qt.inputMethod.keyboardRectangle.height : 0) - } - - height: label.height + units.gu(3) - width: label.width + units.gu(4.5) - radius: height/2 - color: Qt.rgba(0,0,0,0.7) - - opacity: showing ? 1 : 0 - - Behavior on opacity { - UbuntuNumberAnimation {} - } - - property bool showing: false - property string text - property MainView mainView - property var queue: [] - - Component.onCompleted: mainView = findMainView() //This cannot be done as a property binding because the method will later return the QQuickRootItem. - - function show(text) { - queue.push(text) - if (!showing) { - update() - } - } - - function update() { - notification.text = queue.pop() - notification.showing = true - } - - onShowingChanged: { - if (showing) { - timer.restart() - } else { - if (queue.length > 0) { - timer.interval = 800 - timer.restart() - } - } - } - - Label { - id: label - anchors.centerIn: parent - text: notification.text - fontSize: "medium" - } - - Timer { - id: timer - interval: 2000 - onTriggered: { - if (interval === 2000) { - showing = false - } else { - interval = 2000 - update() - } - } - } - - function findMainView() { - var up = parent - while (up.parent !== null) { - up = up.parent - } - return up - } -} diff --git a/ubuntu/qml/cantata/components/PageWithBottomEdge.qml b/ubuntu/qml/cantata/components/PageWithBottomEdge.qml deleted file mode 100644 index bd204d4dc..000000000 --- a/ubuntu/qml/cantata/components/PageWithBottomEdge.qml +++ /dev/null @@ -1,396 +0,0 @@ -/* - * Copyright (C) 2014 Canonical, Ltd. - * - * 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; version 3. - * - * 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 . - */ - -/* - Example: - - MainView { - objectName: "mainView" - - applicationName: "com.ubuntu.developer.boiko.bottomedge" - - width: units.gu(100) - height: units.gu(75) - - Component { - id: pageComponent - - PageWithBottomEdge { - id: mainPage - title: i18n.tr("Main Page") - - Rectangle { - anchors.fill: parent - color: "white" - } - - bottomEdgePageComponent: Page { - title: "Contents" - anchors.fill: parent - //anchors.topMargin: contentsPage.flickable.contentY - - ListView { - anchors.fill: parent - model: 50 - delegate: ListItems.Standard { - text: "One Content Item: " + index - } - } - } - bottomEdgeTitle: i18n.tr("Bottom edge action") - } - } - - PageStack { - id: stack - Component.onCompleted: stack.push(pageComponent) - } - } - -*/ - -import QtQuick 2.2 -import Ubuntu.Components 1.1 - -Page { - id: page - - property alias bottomEdgePageComponent: edgeLoader.sourceComponent - property alias bottomEdgePageSource: edgeLoader.source - property alias bottomEdgeTitle: tipLabel.text - property alias bottomEdgeEnabled: bottomEdge.visible - property int bottomEdgeExpandThreshold: page.height * 0.2 - property int bottomEdgeExposedArea: bottomEdge.state !== "expanded" ? (page.height - bottomEdge.y - bottomEdge.tipHeight) : _areaWhenExpanded - property bool reloadBottomEdgePage: true - - readonly property alias bottomEdgePage: edgeLoader.item - readonly property bool isReady: ((bottomEdge.y === 0) && bottomEdgePageLoaded && edgeLoader.item.active) - readonly property bool isCollapsed: (bottomEdge.y === page.height) - readonly property bool bottomEdgePageLoaded: (edgeLoader.status == Loader.Ready) - - property bool _showEdgePageWhenReady: false - property int _areaWhenExpanded: 0 - - signal bottomEdgeReleased() - signal bottomEdgeDismissed() - - - function showBottomEdgePage(source, properties) - { - edgeLoader.setSource(source, properties) - _showEdgePageWhenReady = true - } - - function setBottomEdgePage(source, properties) - { - edgeLoader.setSource(source, properties) - } - - function _pushPage() - { - if (edgeLoader.status === Loader.Ready) { - edgeLoader.item.active = true - page.pageStack.push(edgeLoader.item) - if (edgeLoader.item.flickable) { - edgeLoader.item.flickable.contentY = -page.header.height - edgeLoader.item.flickable.returnToBounds() - } - if (edgeLoader.item.ready) - edgeLoader.item.ready() - } - } - - - Component.onCompleted: { - // avoid a binding on the expanded height value - var expandedHeight = height; - _areaWhenExpanded = expandedHeight; - } - - onActiveChanged: { - if (active) { - bottomEdge.state = "collapsed" - } - } - - onBottomEdgePageLoadedChanged: { - if (_showEdgePageWhenReady && bottomEdgePageLoaded) { - bottomEdge.state = "expanded" - _showEdgePageWhenReady = false - } - } - - Rectangle { - id: bgVisual - - color: "black" - anchors.fill: page - opacity: 0.7 * ((page.height - bottomEdge.y) / page.height) - z: 1 - } - - Timer { - id: hideIndicator - - interval: 3000 - running: true - repeat: false - onTriggered: tip.hiden = true - } - - Rectangle { - id: bottomEdge - objectName: "bottomEdge" - - readonly property int tipHeight: units.gu(3) - readonly property int pageStartY: 0 - - z: 1 - color: Theme.palette.normal.background - parent: page - anchors { - left: parent.left - right: parent.right - } - height: page.height - y: height - - UbuntuShape { - id: tip - objectName: "bottomEdgeTip" - - property bool hiden: false - - readonly property double visiblePosition: (page.height - bottomEdge.y) < units.gu(1) ? -bottomEdge.tipHeight + (page.height - bottomEdge.y) : 0 - readonly property double invisiblePosition: (page.height - bottomEdge.y) < units.gu(1) ? -units.gu(1) : 0 - - z: -1 - anchors.horizontalCenter: parent.horizontalCenter - y: hiden ? invisiblePosition : visiblePosition - - width: tipLabel.paintedWidth + units.gu(6) - height: bottomEdge.tipHeight + units.gu(1) - color: Theme.palette.normal.overlay - Label { - id: tipLabel - - anchors { - top: parent.top - left: parent.left - right: parent.right - } - height: bottomEdge.tipHeight - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - opacity: tip.hiden ? 0.0 : 1.0 - Behavior on opacity { - UbuntuNumberAnimation { - duration: UbuntuAnimation.SnapDuration - } - } - } - Behavior on y { - UbuntuNumberAnimation { - duration: UbuntuAnimation.SnapDuration - } - } - } - - Rectangle { - id: shadow - - anchors { - left: parent.left - right: parent.right - } - height: units.gu(1) - y: -height - z: -2 - opacity: 0.0 - gradient: Gradient { - GradientStop { position: 0.0; color: "transparent" } - GradientStop { position: 1.0; color: Qt.rgba(0, 0, 0, 0.2) } - } - } - - MouseArea { - id: mouseArea - - preventStealing: true - drag { - axis: Drag.YAxis - target: bottomEdge - minimumY: bottomEdge.pageStartY - maximumY: page.height - threshold: 100 - } - - anchors { - left: parent.left - right: parent.right - } - height: bottomEdge.tipHeight - y: -height - - onReleased: { - page.bottomEdgeReleased() - if (bottomEdge.y < (page.height - bottomEdgeExpandThreshold - bottomEdge.tipHeight)) { - bottomEdge.state = "expanded" - } else { - bottomEdge.state = "collapsed" - bottomEdge.y = bottomEdge.height - } - } - - onClicked: { - tip.hiden = false - hideIndicator.restart() - } - } - - state: "collapsed" - states: [ - State { - name: "collapsed" - PropertyChanges { - target: bottomEdge - y: bottomEdge.height - } - PropertyChanges { - target: tip - opacity: 1.0 - } - PropertyChanges { - target: hideIndicator - running: true - } - }, - State { - name: "expanded" - PropertyChanges { - target: bottomEdge - y: bottomEdge.pageStartY - } - PropertyChanges { - target: hideIndicator - running: false - } - }, - State { - name: "floating" - when: mouseArea.drag.active - PropertyChanges { - target: shadow - opacity: 1.0 - } - PropertyChanges { - target: hideIndicator - running: false - } - PropertyChanges { - target: tip - hiden: false - } - } - ] - - transitions: [ - Transition { - to: "expanded" - SequentialAnimation { - UbuntuNumberAnimation { - target: bottomEdge - property: "y" - duration: UbuntuAnimation.SlowDuration - } - ScriptAction { - script: page._pushPage() - } - } - }, - Transition { - from: "expanded" - to: "collapsed" - SequentialAnimation { - ScriptAction { - script: { - Qt.inputMethod.hide() - edgeLoader.item.parent = edgeLoader - edgeLoader.item.anchors.fill = edgeLoader - edgeLoader.item.active = false - } - } - UbuntuNumberAnimation { - target: bottomEdge - property: "y" - duration: UbuntuAnimation.SlowDuration - } - ScriptAction { - script: { - // destroy current bottom page - if (page.reloadBottomEdgePage) { - edgeLoader.active = false - } - - // notify - page.bottomEdgeDismissed() - - edgeLoader.active = true - tip.hiden = false - hideIndicator.restart() - } - } - } - }, - Transition { - from: "floating" - to: "collapsed" - UbuntuNumberAnimation { - target: bottomEdge - property: "opacity" - } - } - ] - - Item { - anchors.fill: parent - clip: true - - Loader { - id: edgeLoader - - z: 1 - active: true - asynchronous: true - anchors.fill: parent - - //WORKAROUND: The SDK move the page contents down to allocate space for the header we need to avoid that during the page dragging - Binding { - target: edgeLoader.status === Loader.Ready ? edgeLoader : null - property: "anchors.topMargin" - value: edgeLoader.item && edgeLoader.item.flickable ? edgeLoader.item.flickable.contentY : 0 - when: !page.isReady - } - - onLoaded: { - if (page.isReady && edgeLoader.item.active !== true) { - page._pushPage() - } - } - } - } - } -} diff --git a/ubuntu/qml/cantata/components/PlayQueueListItemDelegate.qml b/ubuntu/qml/cantata/components/PlayQueueListItemDelegate.qml deleted file mode 100644 index afba84e1c..000000000 --- a/ubuntu/qml/cantata/components/PlayQueueListItemDelegate.qml +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright 2012 Canonical Ltd. - * Copyright (c) 2014 Craig Drummond - * - * This program 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; version 3. - * - * 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 Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -import QtQuick 2.2 -import Ubuntu.Components 1.1 -import Ubuntu.Components.ListItems 1.0 - -Empty { - id: playQueueListItemDelegate - __height: Math.max(middleVisuals.height, units.gu(6)) - - property alias text: label.text - - property alias subText: subLabel.text - property alias timeText: timeLabel.text - property alias iconSource: iconImage.source - - property bool currentTrack: false - property bool iconShown: iconImage.source != "" - - UbuntuShape { - id: iconShape - width: units.gu(5.5) - height: units.gu(5.5) - anchors { - left: image.right - verticalCenter: parent.verticalCenter - } - visible: iconShown - - image: Image { - id: iconImage - smooth: true - opacity: 0.9 - anchors.fill: parent - } - } - - Image { - id: image - width: units.gu(3) - height: units.gu(3) - smooth: true - opacity: 0.9 - visible: currentTrack - source: "../../../icons/toolbar/media-playback-start.svg" - - anchors { - left: parent.left - verticalCenter: parent.verticalCenter - } - } - - Item { - id: middleVisuals - anchors { - left: iconShown?iconShape.right:parent.left - right: parent.right - leftMargin: units.gu(iconShown?1:2) - rightMargin: units.gu(2) - verticalCenter: parent.verticalCenter - } - height: childrenRect.height + label.anchors.topMargin + subLabel.anchors.bottomMargin - - LabelVisual { - id: label - selected: playQueueListItemDelegate.selected - font.bold: currentTrack - anchors { - top: parent.top - left: parent.left - right: parent.right - } - } - LabelVisual { - id: subLabel - selected: playQueueListItemDelegate.selected - secondary: true - anchors { - left: parent.left - right: timeLabel.left - top: label.bottom - } - } - - LabelVisual { - id: timeLabel - selected: playQueueListItemDelegate.selected - secondary: true - anchors { - top: subLabel.top - right: parent.right - } - } - } -} diff --git a/ubuntu/qml/cantata/main.qml b/ubuntu/qml/cantata/main.qml deleted file mode 100644 index 9e88bc977..000000000 --- a/ubuntu/qml/cantata/main.qml +++ /dev/null @@ -1,149 +0,0 @@ -/************************************************************************* -** Cantata -** -** Copyright (c) 2014 Niklas Wenzel -** Copyright (c) 2014 Craig Drummond -** -** $QT_BEGIN_LICENSE:GPL$ -** 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; see the file COPYING. If not, write to -** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -** Boston, MA 02110-1301, USA. -** -** -** $QT_END_LICENSE$ -** -*************************************************************************/ - -import QtQuick 2.2 -import Ubuntu.Components 1.1 -import Ubuntu.Components.ListItems 1.0 as ListItem -import Ubuntu.Layouts 1.0 -import 'qrc:/qml/cantata/' -import 'qrc:/qml/cantata/backend' -import 'qrc:/qml/cantata/components' -import 'qrc:/qml/cantata/settings' - -MainView { - id: root - - applicationName: "com.ubuntu.developer.nikwen.cantata-touch-reboot" - -// width: units.gu(100) -// height: units.gu(75) - - useDeprecatedToolbar: false //displays the new header - - property bool isPhone: width < units.gu(60) - - PageStack { - id: pageStack - - Component.onCompleted: { - push(tabs) - push(hostSettingsPage) - } - - Tabs { - id: tabs - visible: false - - Tab { - id: artistTab - title: i18n.tr("Artists") - - page: ListViewPage { //TODO: Vanishes quite often - id: artistPage - model: artistsProxyModel - modelName: "artists" - emptyViewVisible: !backend.artistsFound - emptyViewText: i18n.tr("No artists found") - } - } - - Tab { - id: albumsTab - title: i18n.tr("Albums") - - page: ListViewPage { - id: albumPage - model: albumsProxyModel - modelName: "albums" - emptyViewVisible: !backend.albumsFound - emptyViewText: i18n.tr("No albums found") - } - } - - Tab { - id: foldersTab - title: i18n.tr("Folders") - - page: ListViewPage { - id: foldersPage - model: foldersProxyModel - modelName: "folders" - emptyViewVisible: !backend.foldersFound - emptyViewText: i18n.tr("No folders found") - } - } - - Tab { - id: playlistsTab - title: i18n.tr("Playlists") - - page: ListViewPage { - id: playlistsPage - model: playlistsProxyModel - modelName: "playlists" - editable: true - emptyViewVisible: !backend.playlistsFound - emptyViewText: i18n.tr("No playlists found") - } - } - } - - SettingsPage { - id: settingsPage - visible: false - } - - HostSettingsPage { - id: hostSettingsPage - visible: false - } - - UiSettingsPage { - id: uiSettingsPage - visible: false - } - -// PlaybackSettingsPage { -// id: playbackSettingsPage -// visible: false -// } - - AboutPage { - id: aboutPage - visible: false - } - - } - - Notification { - id: notification - } - - SettingsBackend { - id: settingsBackend - } -} diff --git a/ubuntu/qml/cantata/settings/HostSettingsContent.qml b/ubuntu/qml/cantata/settings/HostSettingsContent.qml deleted file mode 100644 index 056233fc7..000000000 --- a/ubuntu/qml/cantata/settings/HostSettingsContent.qml +++ /dev/null @@ -1,190 +0,0 @@ -/************************************************************************* -** Cantata -** -** Copyright (c) 2014 Niklas Wenzel -** Copyright (c) 2014 Craig Drummond -** -** $QT_BEGIN_LICENSE:GPL$ -** 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; see the file COPYING. If not, write to -** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -** Boston, MA 02110-1301, USA. -** -** -** $QT_END_LICENSE$ -** -*************************************************************************/ - -import QtQuick 2.2 -import Ubuntu.Components 1.1 -import Ubuntu.Components.ListItems 1.0 as ListItem -import Qt.labs.settings 1.0 - -Flickable { - clip: true - - contentHeight: connectionDetailsColumn.height - - property color textFieldColor: "#c2c2b8" //#f3f3e7 * 0.8 (#f3f3e7: label color) - - Column { - id: connectionDetailsColumn - spacing: units.gu(1) - - width: Math.round(parent.width / 1.3) - height: parent.parent.height - root.header.height - y: units.gu(2) - anchors.horizontalCenter: parent.horizontalCenter - - Component.onCompleted: { - tryToConnect() - } - - Settings { //Here as it is not needed anywhere else (easier here) - id: settings - category: "connection" - property alias host: hostTextField.text - property alias port: portTextField.text - property alias password: passwordTextField.text - property alias musicfolder: musicfolderTextField.text - } - - Label { - id: hostLabel - text: i18n.tr("Host:") - anchors { - left: connectionDetailsColumn.left; - right: connectionDetailsColumn.right; - } - - fontSize: "medium" - } - - TextField { - id: hostTextField - color: textFieldColor - anchors { - left: connectionDetailsColumn.left; - right: connectionDetailsColumn.right; - } - - KeyNavigation.priority: KeyNavigation.BeforeItem - KeyNavigation.tab: portTextField - } - - Label { - id: portLabel - text: i18n.tr("Port:") - anchors { - left: connectionDetailsColumn.left; - right: connectionDetailsColumn.right; - } - - fontSize: "medium" - } - - TextField { - id: portTextField - color: textFieldColor - anchors { - left: connectionDetailsColumn.left; - right: connectionDetailsColumn.right; - } - validator: IntValidator { bottom: 1; top: 65535 } - - KeyNavigation.priority: KeyNavigation.BeforeItem - KeyNavigation.tab: passwordTextField - KeyNavigation.backtab: hostTextField - - placeholderText: "6600" - } - - Label { - id: passwordLabel - text: i18n.tr("Password:") - - fontSize: "medium" - } - - TextField { - id: passwordTextField - color: textFieldColor - anchors { - left: connectionDetailsColumn.left; - right: connectionDetailsColumn.right; - } - - KeyNavigation.priority: KeyNavigation.BeforeItem - KeyNavigation.tab: musicfolderTextField - KeyNavigation.backtab: portTextField - - echoMode: TextInput.Password - - onAccepted: { //Invoked when the enter key is pressed - connectButton.clicked() - } - } - - Label { - id: musicfolderLabel - text: i18n.tr("Music Folder:") - anchors { - left: connectionDetailsColumn.left; - right: connectionDetailsColumn.right; - } - - fontSize: "medium" - } - - TextField { - id: musicfolderTextField - color: textFieldColor - anchors { - left: connectionDetailsColumn.left; - right: connectionDetailsColumn.right; - } - - KeyNavigation.priority: KeyNavigation.BeforeItem - KeyNavigation.backtab: passwordTextField - placeholderText: "http://HOST/music" // TODO: Update this when hostTextField changes? - } - - Item { - height: units.gu(0.5) - anchors { - left: connectionDetailsColumn.left; - right: connectionDetailsColumn.right; - } - } - - Button { - id: connectButton - text: i18n.tr("Connect") - color: UbuntuColors.orange - - width: parent.width - anchors { - horizontalCenter: parent.horizontalCenter - } - - onClicked: { - console.log("Org: " + Qt.application.organization) - connectionDetailsColumn.tryToConnect() - } - } - - function tryToConnect() { - backend.connectTo(settings.host, (settings.port === "")?6600:settings.port, settings.password, settings.musicfolder) - } - } -} diff --git a/ubuntu/qml/cantata/settings/HostSettingsPage.qml b/ubuntu/qml/cantata/settings/HostSettingsPage.qml deleted file mode 100644 index 2a285059a..000000000 --- a/ubuntu/qml/cantata/settings/HostSettingsPage.qml +++ /dev/null @@ -1,43 +0,0 @@ -/************************************************************************* -** Cantata -** -** Copyright (c) 2014 Niklas Wenzel -** Copyright (c) 2014 Craig Drummond -** -** $QT_BEGIN_LICENSE:GPL$ -** 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; see the file COPYING. If not, write to -** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -** Boston, MA 02110-1301, USA. -** -** -** $QT_END_LICENSE$ -** -*************************************************************************/ - -import QtQuick 2.2 -import Ubuntu.Components 1.1 -import Ubuntu.Components.ListItems 1.0 as ListItem -import U1db 1.0 as U1db - -Page { - id: hostSettingsPage - - width: parent.width - title: qsTr(i18n.tr("Connection %1")).arg(backend.isConnected?i18n.tr("(Connected)"):i18n.tr("(Not Connected)")) - - HostSettingsContent { - anchors.fill: parent - } - -} diff --git a/ubuntu/qml/cantata/settings/PlaybackSettingsContent.qml b/ubuntu/qml/cantata/settings/PlaybackSettingsContent.qml deleted file mode 100644 index cbf24d86b..000000000 --- a/ubuntu/qml/cantata/settings/PlaybackSettingsContent.qml +++ /dev/null @@ -1,132 +0,0 @@ -/************************************************************************* -** Cantata -** -** Copyright (c) 2014 Craig Drummond -** Copyright (c) 2014 Niklas Wenzel -** -** $QT_BEGIN_LICENSE:GPL$ -** 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; see the file COPYING. If not, write to -** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -** Boston, MA 02110-1301, USA. -** -** -** $QT_END_LICENSE$ -** -*************************************************************************/ - -import QtQuick 2.2 -import Ubuntu.Components 1.1 -import Ubuntu.Components.ListItems 1.0 as ListItem -Column { - id: column - spacing: units.gu(1) - - Component.onCompleted: { - // TODO: Is this called each time page is made visible??? - Nope, it's called when the component is created - backend.getPlaybackSettings(); - } - - Label { - id: crossfadeLabel - text: i18n.tr("Crossfade between tracks:") - anchors { - left: column.left; - right: column.right; - } - fontSize: "medium" - } - - Label { - id: todo - text: "TODO: SpinBox - "+backend.crossfade - anchors { - left: column.left; - right: column.right; - } - fontSize: "medium" - } -/* - SpinBox { - id: crossfade - anchors { - left: column.left; - right: column.right; - } - fontSize: "medium" - //KeyNavigation.priority: KeyNavigation.BeforeItem - //KeyNavigation.tab: replaygain - } -*/ - - Label { - id: replaygainLabel - text: i18n.tr("ReplayGain:") - anchors { - left: column.left; - right: column.right; - } - fontSize: "medium" - } - - Label { - id: todo2 - text: "TODO: ComboBox - "+backend.replayGain - } - /* - ComboBox { - currentIndex: 2 - model: ListModel { - id: cbItems - ListElement { text: i18n.tr("None") } - ListElement { text: i18n.tr("Track") } - ListElement { text: i18n.tr("Album") } - ListElement { text: i18n.tr("Auto") } - } - } - */ - - Label { - id: outputsLabel - text: i18n.tr("Outputs:") - anchors { - left: column.left; - right: column.right; - } - fontSize: "medium" - } - - Label { - id: todoV - text: i18n.tr("TODO: Want checkable list of outputs???:") - } - - ListView { - contentHeight: ouptutsColumn.height - - Column { - id: ouptutsColumn - width: parent.width - - ListItem.Standard { - id: o1 - text: "Ouptut 1" - } - - ListItem.Standard { - id: o2 - text: "Ouptut 2" - } - } - } -} diff --git a/ubuntu/qml/cantata/settings/PlaybackSettingsPage.qml b/ubuntu/qml/cantata/settings/PlaybackSettingsPage.qml deleted file mode 100644 index 560c82d68..000000000 --- a/ubuntu/qml/cantata/settings/PlaybackSettingsPage.qml +++ /dev/null @@ -1,51 +0,0 @@ -/************************************************************************* -** Cantata -** -** Copyright (c) 2014 Craig Drummond -** Copyright (c) 2014 Niklas Wenzel -** -** $QT_BEGIN_LICENSE:GPL$ -** 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; see the file COPYING. If not, write to -** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -** Boston, MA 02110-1301, USA. -** -** -** $QT_END_LICENSE$ -** -*************************************************************************/ - -import QtQuick 2.2 -import Ubuntu.Components 1.1 -import Ubuntu.Components.ListItems 1.0 as ListItem - -Page { - id: playbackSettingsPage - - anchors { - fill: parent - topMargin: root.header.height + units.gu(2) - } - title: i18n.tr("Playback Settings") - - property color textFieldColor: "#c2c2b8" //#f3f3e7 * 0.8 (#f3f3e7: label color) - - PlaybackSettingsContent { - anchors { - top: parent.top - topMargin: units.gu(2) - horizontalCenter: parent.horizontalCenter - } - } -} - diff --git a/ubuntu/qml/cantata/settings/SettingsCategories.qml b/ubuntu/qml/cantata/settings/SettingsCategories.qml deleted file mode 100644 index bda7ac097..000000000 --- a/ubuntu/qml/cantata/settings/SettingsCategories.qml +++ /dev/null @@ -1,80 +0,0 @@ -/************************************************************************* -** Cantata -** -** Copyright (c) 2014 Craig Drummond -** Copyright (c) 2014 Niklas Wenzel -** -** $QT_BEGIN_LICENSE:GPL$ -** 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; see the file COPYING. If not, write to -** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -** Boston, MA 02110-1301, USA. -** -** -** $QT_END_LICENSE$ -** -*************************************************************************/ - -import QtQuick 2.2 -import Ubuntu.Components 1.1 -import Ubuntu.Components.ListItems 1.0 as ListItem - -Flickable { - contentHeight: column.height - clip: true - - property bool push: true - property int selectedIndex: -1 //-1 indicates that the menu will be shown on phones, while the first entry is shown on tablets - - Column { - id: column - width: parent.width - height: childrenRect.height - - ListItem.Standard { - id: connectionSettingsLabel - text: i18n.tr("Connection") - progression: true - selected: tabletSettings && (selectedIndex === 0 || selectedIndex === -1) - onClicked: { - selectedIndex = 0 - if (push) pageStack.push(hostSettingsPage) - } - } - - ListItem.Standard { - id: uiSettingsLabel - text: i18n.tr("UI") - progression: true - selected: tabletSettings && selectedIndex === 1 - onClicked: { - selectedIndex = 1 - if (push) pageStack.push(uiSettingsPage) - } - } - - //Let's hide those as long as they aren't implemented. - -// ListItem.Standard { -// id: playbackSettingsLabel -// enabled: false -// text: i18n.tr("Playback") -// progression: true -// selected: tabletSettings && selectedIndex === 2 -// onClicked: { -// selectedIndex = 2 -// if (push) pageStack.push(playbackSettingsPage) -// } -// } - } -} diff --git a/ubuntu/qml/cantata/settings/SettingsPage.qml b/ubuntu/qml/cantata/settings/SettingsPage.qml deleted file mode 100644 index 8a54dac0b..000000000 --- a/ubuntu/qml/cantata/settings/SettingsPage.qml +++ /dev/null @@ -1,162 +0,0 @@ -/************************************************************************* -** Cantata -** -** Copyright (c) 2014 Craig Drummond -** Copyright (c) 2014 Niklas Wenzel -** -** $QT_BEGIN_LICENSE:GPL$ -** 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; see the file COPYING. If not, write to -** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -** Boston, MA 02110-1301, USA. -** -** -** $QT_END_LICENSE$ -** -*************************************************************************/ - -import QtQuick 2.2 -import Ubuntu.Components 1.1 -import Ubuntu.Components.ListItems 1.0 as ListItem -import Ubuntu.Layouts 1.0 - -Page { - id: settingsPage - objectName: "settingsPage" - - title: qsTr(i18n.tr("Settings %1")).arg((layouts.currentLayout === "tablet" && (categories.selectedIndex === 0 || categories.selectedIndex === -1)) ? backend.isConnected?i18n.tr("(Connected)"):i18n.tr("(Not Connected)") : "") - - property bool tabletSettings: layouts.width > units.gu(80) - - Layouts { - id: layouts - anchors.fill: parent - - layouts: [ - ConditionalLayout { - name: "tablet" - when: tabletSettings - - Item { - anchors.fill: parent - - ItemLayout { - id: tabletCategories - item: "categories" - - width: Math.min(parent.width / 3, units.gu(50)) - - anchors { - top: parent.top - left: parent.left - bottom: parent.bottom - } - - Connections { - target: categories - - onSelectedIndexChanged: stack.updateSource() - } - } - - Loader { - id: stack - - Component.onCompleted: { - updateSource() - } - - function updateSource() { - switch (categories.selectedIndex) { - case -1: - case 0: - setSource("HostSettingsContent.qml") - break - case 1: - setSource("UiSettingsContent.qml") - break -// case 2: -// setSource("PlaybackSettingsContent.qml") -// break - } - } - - anchors { - top: parent.top - bottom: parent.bottom - left: tabletCategories.right - right: parent.right - topMargin: units.gu(2) - rightMargin: units.gu(2) - bottomMargin: units.gu(2) - leftMargin: units.gu(2) - } - } - } - } - ] - - onCurrentLayoutChanged: { - if (pageStack === null || pageStack.currentPage === null) { //TODO: Find out why this happens (quick fix here) - return - } - - if (pageStack.currentPage.objectName === settingsPage.objectName) { - if (categories.selectedIndex >= 0 && currentLayout === "") { - switch (categories.selectedIndex) { - case 0: - pageStack.push(hostSettingsPage) - break - case 1: - pageStack.push(uiSettingsPage) - break -// case 2: -// pageStack.setSource(playbackSettingsPage) -// break - } - } - } else if (tabletSettings) { //Not in foreground and tabletSettings - while (pageStack.currentPage.objectName !== settingsPage.objectName) { - pageStack.pop() - } - if (pageStack.currentPage.objectName === hostSettingsPage.objectName) { - categories.selectedIndex = 0 - } else if (pageStack.currentPage.objectName === uiSettingsPage.objectName) { - categories.selectedIndex = 1 -// } else if (pageStack.currentPage.objectName === playbackSettingsPage.objectName) { -// categories.selectedIndex = 2 - } - } - } - - Connections { - target: pageStack - - onCurrentPageChanged: { - if (!tabletSettings && pageStack.currentPage.objectName === settingsPage.objectName) { - categories.selectedIndex = -1 - } - } - } - - SettingsCategories { - id: categories - Layouts.item: "categories" - push: layouts.currentLayout === "" - anchors.fill: parent - } - - } - -} - diff --git a/ubuntu/qml/cantata/settings/UiSettingsContent.qml b/ubuntu/qml/cantata/settings/UiSettingsContent.qml deleted file mode 100644 index 7eac6e0a5..000000000 --- a/ubuntu/qml/cantata/settings/UiSettingsContent.qml +++ /dev/null @@ -1,83 +0,0 @@ -/************************************************************************* -** Cantata -** -** Copyright (c) 2014 Craig Drummond -** Copyright (c) 2014 Niklas Wenzel -** -** $QT_BEGIN_LICENSE:GPL$ -** 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; see the file COPYING. If not, write to -** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -** Boston, MA 02110-1301, USA. -** -** -** $QT_END_LICENSE$ -** -*************************************************************************/ - -import QtQuick 2.2 -import Ubuntu.Components 1.1 -import Ubuntu.Components.ListItems 1.0 as ListItem -import Qt.labs.settings 1.0 - -Flickable { - clip: true - - contentHeight: column.height - - Column { - id: column - height: childrenRect.height - width: parent.width - - ListItem.Standard { - text: i18n.tr("Scroll play queue to active track") - width: parent.width - - control: CheckBox { - id: scrollPlayQueueCheckBox - checked: true - KeyNavigation.priority: KeyNavigation.BeforeItem - KeyNavigation.tab: fetchCoversCheckBox - - Component.onCompleted: { - scrollPlayQueueCheckBox.checked = settingsBackend.scrollPlayQueue - } - - onCheckedChanged: { - settingsBackend.uiSettings.scrollPlayQueue = scrollPlayQueueCheckBox.checked - } - } - } - - ListItem.Standard { - text: i18n.tr("Fetch missing covers from last.fm") - width: parent.width - - control: CheckBox { - id: fetchCoversCheckBox - checked: true - KeyNavigation.priority: KeyNavigation.BeforeItem - KeyNavigation.backtab: scrollPlayQueueCheckBox - - Component.onCompleted: { - fetchCoversCheckBox.checked = settingsBackend.fetchCovers - } - - onCheckedChanged: { - settingsBackend.uiSettings.fetchCovers = fetchCoversCheckBox.checked - } - } - } - } -} diff --git a/ubuntu/qml/cantata/settings/UiSettingsPage.qml b/ubuntu/qml/cantata/settings/UiSettingsPage.qml deleted file mode 100644 index 771b13919..000000000 --- a/ubuntu/qml/cantata/settings/UiSettingsPage.qml +++ /dev/null @@ -1,43 +0,0 @@ -/************************************************************************* -** Cantata -** -** Copyright (c) 2014 Craig Drummond -** Copyright (c) 2014 Niklas Wenzel -** -** $QT_BEGIN_LICENSE:GPL$ -** 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; see the file COPYING. If not, write to -** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -** Boston, MA 02110-1301, USA. -** -** -** $QT_END_LICENSE$ -** -*************************************************************************/ - -import QtQuick 2.2 -import Ubuntu.Components 1.1 -import Ubuntu.Components.ListItems 1.0 as ListItem -import U1db 1.0 as U1db - -Page { - id: uiSettingsPage - - anchors.fill: parent - title: i18n.tr("UI Settings") - - UiSettingsContent { - anchors.fill: parent - } -} - diff --git a/ubuntu/ubuntu.qrc b/ubuntu/ubuntu.qrc deleted file mode 100644 index dd6d7b804..000000000 --- a/ubuntu/ubuntu.qrc +++ /dev/null @@ -1,42 +0,0 @@ - - - qml/cantata/main.qml - qml/cantata/AboutPage.qml - qml/cantata/CurrentlyPlayingPage.qml - icons/toolbar/settings.svg - icons/toolbar/add.svg - icons/toolbar/help.svg - icons/toolbar/media-playback-start.svg - icons/toolbar/media-playback-start-light.svg - icons/toolbar/media-skip-backward.svg - icons/toolbar/media-skip-forward.svg - icons/toolbar/media-playback-pause.svg - ../icons/cantata.svg - icons/items/album.svg - icons/items/artist.svg - icons/items/folder.svg - icons/items/variousartists.svg - icons/toolbar/navigation-menu.svg - icons/toolbar/clear.svg - icons/toolbar/speaker.svg - qml/cantata/components/LabelVisual.qml - qml/cantata/components/ListItemDelegate.qml - qml/cantata/components/PlayQueueListItemDelegate.qml - qml/cantata/ListViewPage.qml - qml/cantata/SubListViewPage.qml - qml/cantata/components/ControlButtonsRow.qml - icons/toolbar/chevron@27.png - qml/cantata/settings/HostSettingsContent.qml - qml/cantata/settings/HostSettingsPage.qml - qml/cantata/settings/PlaybackSettingsContent.qml - qml/cantata/settings/PlaybackSettingsPage.qml - qml/cantata/settings/SettingsCategories.qml - qml/cantata/settings/SettingsPage.qml - qml/cantata/settings/UiSettingsContent.qml - qml/cantata/settings/UiSettingsPage.qml - qml/cantata/components/Notification.qml - qml/cantata/backend/SettingsBackend.qml - qml/cantata/components/PageWithBottomEdge.qml - qml/cantata/CurrentlyPlayingContent.qml - - diff --git a/widgets/completioncombo.h b/widgets/completioncombo.h index 16bcbab90..5bffef44d 100644 --- a/widgets/completioncombo.h +++ b/widgets/completioncombo.h @@ -24,49 +24,6 @@ #ifndef COMPLETION_COMBO_H #define COMPLETION_COMBO_H -// #ifdef ENABLE_KDE_SUPPORT -// #include -// #include -// #include -// #include -// -// class CompletionCombo : public KComboBox -// { -// public: -// CompletionCombo(QWidget *p) -// : KComboBox(p) { -// completionObject()->setIgnoreCase(true); -// setCompletionMode(KGlobalSettings::CompletionPopup); -// setEditable(true); -// setAutoCompletion(false); -// setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); -// setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLength); -// view()->setTextElideMode(Qt::ElideRight); -// } -// -// void setEnabled(bool e) { -// KComboBox::setEnabled(e); -// qobject_cast(lineEdit())->setClearButtonShown(e); -// } -// -// void insertItems(int index, const QStringList &items) { -// KComboBox::insertItems(index, items); -// completionObject()->setItems(items); -// } -// -// void setText(const QString &text) { -// qobject_cast(lineEdit())->setText(text); -// } -// -// QString text() const { -// return qobject_cast(lineEdit())->text(); -// } -// -// void setPlaceholderText(const QString &text) { -// qobject_cast(lineEdit())->setPlaceholderText(text); -// } -// }; -// #else #include "support/combobox.h" #include "support/lineedit.h" #include @@ -76,29 +33,12 @@ class CompletionCombo : public ComboBox public: CompletionCombo(QWidget *p) : ComboBox(p) { - #ifdef ENABLE_KDE_SUPPORT - completionObject()->setIgnoreCase(true); - setCompletionMode(KGlobalSettings::CompletionPopup); - setAutoCompletion(false); - #endif setEditable(true); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLength); view()->setTextElideMode(Qt::ElideRight); } - #ifdef ENABLE_KDE_SUPPORT - void setEnabled(bool e) { - ComboBox::setEnabled(e); - qobject_cast(lineEdit())->setClearButtonShown(e); - } - - void insertItems(int index, const QStringList &items) { - ComboBox::insertItems(index, items); - completionObject()->setItems(items); - } - #endif - void setText(const QString &text) { if (lineEdit()) qobject_cast(lineEdit())->setText(text); } diff --git a/widgets/icons.cpp b/widgets/icons.cpp index 05cc95a71..fa6a78749 100644 --- a/widgets/icons.cpp +++ b/widgets/icons.cpp @@ -27,7 +27,7 @@ #include "support/utils.h" #include "support/pathrequester.h" #include "support/monoicon.h" -#if !defined Q_OS_WIN && !defined Q_OS_MAC && !defined ENABLE_UBUNTU +#if !defined Q_OS_WIN && !defined Q_OS_MAC #include "support/gtkstyle.h" #endif #ifdef Q_OS_MAC @@ -42,7 +42,7 @@ GLOBAL_STATIC(Icons, instance) static QList constStdSizes=QList() << 16 << 22 << 32 << 48; // << 64; -#if !defined ENABLE_KDE_SUPPORT || defined Q_OS_MAC || defined Q_OS_WIN +#if defined Q_OS_MAC || defined Q_OS_WIN #define ALWAYS_USE_MONO_ICONS #endif @@ -79,9 +79,7 @@ Icons::Icons() albumMonoIcon=MonoIcon::icon(":mono-album.svg", stdColor); artistIcon=MonoIcon::icon(":artist.svg", stdColor); genreIcon=MonoIcon::icon(":genre.svg", stdColor); - #if !defined ENABLE_KDE_SUPPORT && !defined ENABLE_UBUNTU appIcon=Icon("cantata"); - #endif lastFmIcon=MonoIcon::icon(FontAwesome::lastfmsquare, MonoIcon::constRed, MonoIcon::constRed); replacePlayQueueIcon=MonoIcon::icon(FontAwesome::play, stdColor); @@ -123,12 +121,10 @@ Icons::Icons() rightIcon=MonoIcon::icon(FontAwesome::chevronright, stdColor); upIcon=MonoIcon::icon(FontAwesome::chevronup, stdColor); downIcon=MonoIcon::icon(FontAwesome::chevrondown, stdColor); - #ifndef ENABLE_KDE_SUPPORT PathRequester::setIcon(folderListIcon); - #endif cancelIcon=MonoIcon::icon(FontAwesome::close, MonoIcon::constRed, MonoIcon::constRed); - #if !defined ENABLE_KDE_SUPPORT && !defined Q_OS_WIN + #if !defined Q_OS_WIN if (QLatin1String("gnome")==QIcon::themeName()) { QColor col=QApplication::palette().color(QPalette::Active, QPalette::WindowText); contextIcon=MonoIcon::icon(QLatin1String(":sidebar-info"), col); diff --git a/widgets/icons.h b/widgets/icons.h index afd13595b..726e9c2dc 100644 --- a/widgets/icons.h +++ b/widgets/icons.h @@ -35,9 +35,7 @@ public: Icons(); void initSidebarIcons(); void initToolbarIcons(QColor toolbarText); - #ifndef ENABLE_KDE_SUPPORT Icon appIcon; - #endif Icon genreIcon; Icon artistIcon; const Icon &albumIcon(int size, bool mono=false) const; diff --git a/widgets/treeview.cpp b/widgets/treeview.cpp index 7ff57c9f3..f0c280b53 100644 --- a/widgets/treeview.cpp +++ b/widgets/treeview.cpp @@ -39,12 +39,7 @@ #include #include -#ifdef ENABLE_KDE_SUPPORT -#include -#define SINGLE_CLICK KGlobalSettings::singleClick() -#else #define SINGLE_CLICK style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, 0, this) -#endif QImage TreeView::setOpacity(const QImage &orig, double opacity) { diff --git a/widgets/volumeslider.cpp b/widgets/volumeslider.cpp index 06569dd3f..8674d341d 100644 --- a/widgets/volumeslider.cpp +++ b/widgets/volumeslider.cpp @@ -39,9 +39,6 @@ #include #include #include -#ifdef ENABLE_KDE_SUPPORT -#include -#endif class VolumeSliderProxyStyle : public QProxyStyle { @@ -114,11 +111,6 @@ void VolumeSlider::initActions() } muteAction = ActionCollection::get()->createAction("mute", i18n("Mute")); addAction(muteAction); - #ifdef ENABLE_KDE_SUPPORT - muteAction->setGlobalShortcut(KShortcut(Qt::Key_VolumeMute)); - StdActions::self()->increaseVolumeAction->setGlobalShortcut(KShortcut(Qt::Key_VolumeUp)); - StdActions::self()->decreaseVolumeAction->setGlobalShortcut(KShortcut(Qt::Key_VolumeDown)); - #endif connect(muteAction, SIGNAL(triggered()), MPDConnection::self(), SLOT(toggleMute())); connect(MPDStatus::self(), SIGNAL(updated()), this, SLOT(updateMpdStatus())); connect(StdActions::self()->increaseVolumeAction, SIGNAL(triggered()), this, SLOT(increaseVolume()));