Split all the source files up into seven new directories.
This commit is contained in:
parent
481dbae992
commit
1aee5e4667
|
@ -25,15 +25,15 @@ macro(add_engine engine lib_list src_list moc_list supported)
|
||||||
endif(NOT supported)
|
endif(NOT supported)
|
||||||
|
|
||||||
# add define -DHAVE_<engine> so we can clutter the code with #ifdefs
|
# add define -DHAVE_<engine> so we can clutter the code with #ifdefs
|
||||||
add_definitions(-DHAVE_${name})
|
set("HAVE_${name}" 1 CACHE INTERNAL ${name})
|
||||||
|
|
||||||
# add sources and MOC headers
|
# add sources and MOC headers
|
||||||
list(APPEND CLEMENTINE-SOURCES ${src_list})
|
list(APPEND ENGINES-SOURCES ${src_list})
|
||||||
list(APPEND CLEMENTINE-MOC-HEADERS ${moc_list})
|
list(APPEND ENGINES-HEADERS ${moc_list})
|
||||||
|
|
||||||
# add libraries to link against
|
# add libraries to link against
|
||||||
foreach(lib ${lib_list})
|
foreach(lib ${lib_list})
|
||||||
set(ENGINE_LIBRARIES ${ENGINE_LIBRARIES} ${${lib}_LIBRARIES})
|
set(ENGINE_LIBRARIES ${ENGINE_LIBRARIES} ${${lib}_LIBRARIES} CACHE INTERNAL libraries)
|
||||||
endforeach(lib ${lib_list})
|
endforeach(lib ${lib_list})
|
||||||
|
|
||||||
# add to list of enabled engines
|
# add to list of enabled engines
|
||||||
|
@ -72,6 +72,6 @@ endmacro(print_engines)
|
||||||
|
|
||||||
# print the pig :)
|
# print the pig :)
|
||||||
macro(pig)
|
macro(pig)
|
||||||
file(READ pig.txt pig)
|
file(READ ${CMAKE_SOURCE_DIR}/pig.txt pig)
|
||||||
message(${pig})
|
message(${pig})
|
||||||
endmacro(pig)
|
endmacro(pig)
|
|
@ -3,294 +3,109 @@ cmake_minimum_required(VERSION 2.6)
|
||||||
set(CMAKE_C_FLAGS "-Wall")
|
set(CMAKE_C_FLAGS "-Wall")
|
||||||
set(CMAKE_CXX_FLAGS "-Wnon-virtual-dtor -Woverloaded-virtual -Wall")
|
set(CMAKE_CXX_FLAGS "-Wnon-virtual-dtor -Woverloaded-virtual -Wall")
|
||||||
|
|
||||||
# Source files
|
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
set(CLEMENTINE-SOURCES
|
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/qtsingleapplication")
|
||||||
mainwindow.cpp
|
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/qtiocompressor")
|
||||||
player.cpp
|
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/qxt")
|
||||||
library.cpp
|
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/gmock/gtest/include")
|
||||||
librarybackend.cpp
|
|
||||||
playlist.cpp
|
|
||||||
playlistitem.cpp
|
|
||||||
engines/enginebase.cpp
|
|
||||||
analyzers/baranalyzer.cpp
|
|
||||||
analyzers/analyzerbase.cpp
|
|
||||||
fht.cpp
|
|
||||||
analyzers/blockanalyzer.cpp
|
|
||||||
analyzers/analyzercontainer.cpp
|
|
||||||
analyzers/boomanalyzer.cpp
|
|
||||||
analyzers/sonogram.cpp
|
|
||||||
analyzers/turbine.cpp
|
|
||||||
sliderwidget.cpp
|
|
||||||
playlistview.cpp
|
|
||||||
librarywatcher.cpp
|
|
||||||
song.cpp
|
|
||||||
songplaylistitem.cpp
|
|
||||||
libraryview.cpp
|
|
||||||
libraryconfig.cpp
|
|
||||||
systemtrayicon.cpp
|
|
||||||
libraryquery.cpp
|
|
||||||
fileview.cpp
|
|
||||||
fileviewlist.cpp
|
|
||||||
playlistheader.cpp
|
|
||||||
radioitem.cpp
|
|
||||||
radioservice.cpp
|
|
||||||
lastfmservice.cpp
|
|
||||||
radiomodel.cpp
|
|
||||||
lastfmconfig.cpp
|
|
||||||
busyindicator.cpp
|
|
||||||
radioplaylistitem.cpp
|
|
||||||
radioview.cpp
|
|
||||||
lastfmstationdialog.cpp
|
|
||||||
osd.cpp
|
|
||||||
trackslider.cpp
|
|
||||||
edittagdialog.cpp
|
|
||||||
lineedit.cpp
|
|
||||||
multiloadingindicator.cpp
|
|
||||||
somafmservice.cpp
|
|
||||||
settingsdialog.cpp
|
|
||||||
librarydirectorymodel.cpp
|
|
||||||
libraryconfigdialog.cpp
|
|
||||||
lastfmconfigdialog.cpp
|
|
||||||
about.cpp
|
|
||||||
albumcoverfetcher.cpp
|
|
||||||
addstreamdialog.cpp
|
|
||||||
savedradio.cpp
|
|
||||||
stylesheetloader.cpp
|
|
||||||
albumcovermanager.cpp
|
|
||||||
albumcoverloader.cpp
|
|
||||||
m3uparser.cpp
|
|
||||||
playlistsequence.cpp
|
|
||||||
xspfparser.cpp
|
|
||||||
globalshortcuts/globalshortcuts.cpp
|
|
||||||
fixlastfm.cpp
|
|
||||||
backgroundthread.cpp
|
|
||||||
osdpretty.cpp
|
|
||||||
playlistdelegates.cpp
|
|
||||||
groupbydialog.cpp
|
|
||||||
equalizer.cpp
|
|
||||||
equalizerslider.cpp
|
|
||||||
tracksliderslider.cpp
|
|
||||||
stickyslider.cpp
|
|
||||||
commandlineoptions.cpp
|
|
||||||
settingsprovider.cpp
|
|
||||||
libraryplaylistitem.cpp
|
|
||||||
scopedtransaction.cpp
|
|
||||||
playlistundocommands.cpp
|
|
||||||
spinbox.cpp
|
|
||||||
transcoder.cpp
|
|
||||||
transcoderformats.cpp
|
|
||||||
transcodedialog.cpp
|
|
||||||
magnatuneservice.cpp
|
|
||||||
database.cpp
|
|
||||||
librarymodel.cpp
|
|
||||||
playlistbackend.cpp
|
|
||||||
mergedproxymodel.cpp
|
|
||||||
libraryfilterwidget.cpp
|
|
||||||
radioviewcontainer.cpp
|
|
||||||
networkaccessmanager.cpp
|
|
||||||
magnatuneplaylistitem.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
# Header files that have Q_OBJECT in
|
# These can be seen from child scopes
|
||||||
set(CLEMENTINE-MOC-HEADERS
|
set(CLEMENTINE-TRANSLATION-SOURCE CACHE INTERNAL foo)
|
||||||
mainwindow.h
|
set(CLEMENTINE-TRANSLATION-DEPS CACHE INTERNAL foo)
|
||||||
player.h
|
|
||||||
library.h
|
|
||||||
librarybackend.h
|
|
||||||
playlist.h
|
|
||||||
engines/enginebase.h
|
|
||||||
sliderwidget.h
|
|
||||||
playlistview.h
|
|
||||||
backgroundthread.h
|
|
||||||
librarywatcher.h
|
|
||||||
songmimedata.h
|
|
||||||
libraryview.h
|
|
||||||
libraryconfig.h
|
|
||||||
systemtrayicon.h
|
|
||||||
fileview.h
|
|
||||||
fileviewlist.h
|
|
||||||
playlistheader.h
|
|
||||||
radioservice.h
|
|
||||||
lastfmservice.h
|
|
||||||
radiomodel.h
|
|
||||||
lastfmconfig.h
|
|
||||||
busyindicator.h
|
|
||||||
radiomimedata.h
|
|
||||||
radioview.h
|
|
||||||
lastfmstationdialog.h
|
|
||||||
osd.h
|
|
||||||
trackslider.h
|
|
||||||
edittagdialog.h
|
|
||||||
lineedit.h
|
|
||||||
multiloadingindicator.h
|
|
||||||
somafmservice.h
|
|
||||||
settingsdialog.h
|
|
||||||
librarydirectorymodel.h
|
|
||||||
libraryconfigdialog.h
|
|
||||||
lastfmconfigdialog.h
|
|
||||||
about.h
|
|
||||||
albumcoverfetcher.h
|
|
||||||
addstreamdialog.h
|
|
||||||
savedradio.h
|
|
||||||
albumcovermanager.h
|
|
||||||
albumcoverloader.h
|
|
||||||
m3uparser.h
|
|
||||||
playlistsequence.h
|
|
||||||
xspfparser.h
|
|
||||||
analyzers/analyzercontainer.h
|
|
||||||
analyzers/baranalyzer.h
|
|
||||||
analyzers/blockanalyzer.h
|
|
||||||
analyzers/analyzerbase.h
|
|
||||||
analyzers/boomanalyzer.h
|
|
||||||
analyzers/sonogram.h
|
|
||||||
analyzers/turbine.h
|
|
||||||
globalshortcuts/globalshortcuts.h
|
|
||||||
osdpretty.h
|
|
||||||
playlistdelegates.h
|
|
||||||
groupbydialog.h
|
|
||||||
equalizer.h
|
|
||||||
equalizerslider.h
|
|
||||||
stickyslider.h
|
|
||||||
spinbox.h
|
|
||||||
transcoder.h
|
|
||||||
transcodedialog.h
|
|
||||||
magnatuneservice.h
|
|
||||||
librarymodel.h
|
|
||||||
playlistbackend.h
|
|
||||||
database.h
|
|
||||||
mergedproxymodel.h
|
|
||||||
libraryfilterwidget.h
|
|
||||||
radioviewcontainer.h
|
|
||||||
networkaccessmanager.h
|
|
||||||
)
|
|
||||||
|
|
||||||
# lists of engine source files
|
macro(add_translation_source subdirectory)
|
||||||
set(GST_ENGINE_SRC
|
get_filename_component(_translations_dir ${CMAKE_CURRENT_SOURCE_DIR}/../translations ABSOLUTE)
|
||||||
engines/gstengine.cpp
|
foreach(_file ${ARGN})
|
||||||
engines/gstequalizer.cpp
|
get_filename_component(_dep ${_file} ABSOLUTE)
|
||||||
engines/gstenginepipeline.cpp
|
if (IS_ABSOLUTE ${_file})
|
||||||
)
|
file(RELATIVE_PATH _relative ${_translations_dir} ${_file})
|
||||||
set(GST_ENGINE_MOC
|
else (IS_ABSOLUTE ${_file})
|
||||||
engines/gstengine.h
|
set(_relative "../${subdirectory}/${_file}")
|
||||||
engines/gstenginepipeline.h
|
endif (IS_ABSOLUTE ${_file})
|
||||||
)
|
set(CLEMENTINE-TRANSLATION-SOURCE ${CLEMENTINE-TRANSLATION-SOURCE} ${_relative} CACHE INTERNAL foo)
|
||||||
set(GST_ENGINE_LIB
|
set(CLEMENTINE-TRANSLATION-DEPS ${CLEMENTINE-TRANSLATION-DEPS} ${_dep} CACHE INTERNAL foo)
|
||||||
GSTREAMER
|
endforeach(_file)
|
||||||
GSTREAMER_BASE
|
endmacro(add_translation_source)
|
||||||
)
|
|
||||||
set(XINE_ENGINE_SRC
|
|
||||||
engines/xine-engine.cpp
|
|
||||||
engines/xine-scope.c
|
|
||||||
)
|
|
||||||
set(XINE_ENGINE_MOC
|
|
||||||
engines/xine-engine.h
|
|
||||||
)
|
|
||||||
|
|
||||||
# try to add engines
|
add_subdirectory(analyzers)
|
||||||
include(AddEngine.cmake)
|
add_subdirectory(core)
|
||||||
add_engine(gst "${GST_ENGINE_LIB}" "${GST_ENGINE_SRC}" "${GST_ENGINE_MOC}" ON)
|
add_subdirectory(engines)
|
||||||
add_engine(vlc LIBVLC engines/vlcengine.cpp engines/vlcengine.h OFF)
|
add_subdirectory(library)
|
||||||
add_engine(xine LIBXINE "${XINE_ENGINE_SRC}" "${XINE_ENGINE_MOC}" OFF)
|
add_subdirectory(playlist)
|
||||||
add_engine(qt-phonon QT_PHONON engines/phononengine.cpp engines/phononengine.h OFF)
|
add_subdirectory(radio)
|
||||||
print_engines()
|
add_subdirectory(transcoder)
|
||||||
|
add_subdirectory(ui)
|
||||||
|
add_subdirectory(widgets)
|
||||||
|
add_subdirectory(translations)
|
||||||
|
|
||||||
# need at least 1 engine
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
|
||||||
if(NOT ENGINES_ENABLED)
|
${CMAKE_CURRENT_BINARY_DIR}/config.h)
|
||||||
message(FATAL_ERROR "no engine enabled!")
|
|
||||||
endif(NOT ENGINES_ENABLED)
|
|
||||||
|
|
||||||
# UI files
|
|
||||||
set(CLEMENTINE-UI
|
|
||||||
mainwindow.ui
|
|
||||||
libraryconfig.ui
|
|
||||||
fileview.ui
|
|
||||||
lastfmconfig.ui
|
|
||||||
lastfmstationdialog.ui
|
|
||||||
trackslider.ui
|
|
||||||
edittagdialog.ui
|
|
||||||
multiloadingindicator.ui
|
|
||||||
settingsdialog.ui
|
|
||||||
libraryconfigdialog.ui
|
|
||||||
lastfmconfigdialog.ui
|
|
||||||
about.ui
|
|
||||||
addstreamdialog.ui
|
|
||||||
albumcovermanager.ui
|
|
||||||
playlistsequence.ui
|
|
||||||
osdpretty.ui
|
|
||||||
groupbydialog.ui
|
|
||||||
equalizer.ui
|
|
||||||
equalizerslider.ui
|
|
||||||
transcodedialog.ui
|
|
||||||
transcodelogdialog.ui
|
|
||||||
libraryfilterwidget.ui
|
|
||||||
radioviewcontainer.ui
|
|
||||||
)
|
|
||||||
|
|
||||||
# Resource files
|
|
||||||
set(CLEMENTINE-RESOURCES
|
set(CLEMENTINE-RESOURCES
|
||||||
../data/data.qrc
|
../data/data.qrc
|
||||||
)
|
)
|
||||||
|
|
||||||
set(CLEMENTINE-LANGUAGES
|
qt4_wrap_cpp(CLEMENTINE-SOURCES-MOC ${CLEMENTINE-MOC-HEADERS})
|
||||||
cs
|
qt4_wrap_ui(CLEMENTINE-SOURCES-UI ${CLEMENTINE-UI})
|
||||||
da
|
qt4_add_resources(CLEMENTINE-SOURCES-RESOURCE ${CLEMENTINE-RESOURCES})
|
||||||
de
|
|
||||||
el
|
add_library(clementine_lib
|
||||||
en_GB
|
${CLEMENTINE-SOURCES-RESOURCE}
|
||||||
es
|
|
||||||
fi
|
|
||||||
fr
|
|
||||||
gl
|
|
||||||
it
|
|
||||||
kk
|
|
||||||
nb
|
|
||||||
pl
|
|
||||||
pt
|
|
||||||
pt_BR
|
|
||||||
ro
|
|
||||||
ru
|
|
||||||
sk
|
|
||||||
sv
|
|
||||||
tr
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Configured header file that contains various macros
|
target_link_libraries(clementine_lib
|
||||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
|
clementine_analyzers
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/config.h)
|
clementine_core
|
||||||
|
clementine_engines
|
||||||
|
clementine_library
|
||||||
|
clementine_playlist
|
||||||
|
clementine_radio
|
||||||
|
clementine_transcoder
|
||||||
|
clementine_ui
|
||||||
|
clementine_widgets
|
||||||
|
clementine_translations
|
||||||
|
qtsingleapplication
|
||||||
|
qtiocompressor
|
||||||
|
lastfm
|
||||||
|
chardet
|
||||||
|
${GOBJECT_LIBRARIES}
|
||||||
|
${GLIB_LIBRARIES}
|
||||||
|
${TAGLIB_LIBRARIES}
|
||||||
|
${QT_LIBRARIES}
|
||||||
|
${ENGINE_LIBRARIES}
|
||||||
|
)
|
||||||
|
|
||||||
# OSD and DBus.
|
if (APPLE)
|
||||||
if(APPLE)
|
target_link_libraries(clementine_lib
|
||||||
set(CLEMENTINE-SOURCES ${CLEMENTINE-SOURCES} osd_mac.mm mac_startup.mm)
|
${GROWL}
|
||||||
else(APPLE)
|
${SPARKLE}
|
||||||
if(WIN32)
|
/System/Library/Frameworks/Carbon.framework
|
||||||
set(CLEMENTINE-SOURCES ${CLEMENTINE-SOURCES} osd_win.cpp)
|
/System/Library/Frameworks/Foundation.framework
|
||||||
else(WIN32)
|
/System/Library/Frameworks/AppKit.framework
|
||||||
set(CLEMENTINE-SOURCES ${CLEMENTINE-SOURCES} osd_x11.cpp)
|
)
|
||||||
# MPRIS
|
include_directories(${GROWL}/Headers)
|
||||||
qt4_add_dbus_adaptor(MPRIS-PLAYER-SOURCES
|
include_directories(${SPARKLE}/Headers)
|
||||||
../data/org.freedesktop.MediaPlayer.player.xml
|
else (APPLE)
|
||||||
player.h Player mpris_player MprisPlayer)
|
target_link_libraries(clementine_lib qxt)
|
||||||
qt4_add_dbus_adaptor(MPRIS-ROOT-SOURCES
|
endif (APPLE)
|
||||||
../data/org.freedesktop.MediaPlayer.root.xml
|
|
||||||
mpris.h MPRIS mpris_root MprisRoot)
|
|
||||||
qt4_add_dbus_adaptor(MPRIS-TRACKLIST-SOURCES
|
|
||||||
../data/org.freedesktop.MediaPlayer.tracklist.xml
|
|
||||||
player.h Player mpris_tracklist MprisTrackList)
|
|
||||||
|
|
||||||
# org.freedesktop.Notifications
|
# Link against the qsqlite plugin on windows and mac
|
||||||
qt4_add_dbus_interface(NOTIFICATION-SOURCES
|
if(WIN32 OR APPLE)
|
||||||
../data/org.freedesktop.Notifications.xml
|
set(3RDPARTY_SQLITE_LIBRARY qsqlite)
|
||||||
notification)
|
target_link_libraries(clementine_lib qsqlite)
|
||||||
set(CLEMENTINE-SOURCES ${CLEMENTINE-SOURCES}
|
endif(WIN32 OR APPLE)
|
||||||
${MPRIS-PLAYER-SOURCES}
|
|
||||||
${MPRIS-ROOT-SOURCES}
|
add_dependencies(clementine_lib qtsingleapplication)
|
||||||
${MPRIS-TRACKLIST-SOURCES}
|
|
||||||
${NOTIFICATION-SOURCES}
|
|
||||||
mpris.cpp
|
###############################################################################
|
||||||
)
|
|
||||||
set(CLEMENTINE-MOC-HEADERS ${CLEMENTINE-MOC-HEADERS} mpris.h)
|
set(EXECUTABLE_OUTPUT_PATH ..)
|
||||||
endif(WIN32)
|
|
||||||
endif(APPLE)
|
# Show the console window in debug mode on Windows
|
||||||
|
if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||||
|
set(CLEMENTINE-WIN32-FLAG WIN32)
|
||||||
|
endif (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||||
|
|
||||||
# resource file for windows
|
# resource file for windows
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
|
@ -299,162 +114,44 @@ if(WIN32)
|
||||||
set(CLEMENTINE-WIN32-RESOURCES windres.rc)
|
set(CLEMENTINE-WIN32-RESOURCES windres.rc)
|
||||||
endif(WIN32)
|
endif(WIN32)
|
||||||
|
|
||||||
qt4_wrap_cpp(CLEMENTINE-SOURCES-MOC ${CLEMENTINE-MOC-HEADERS})
|
|
||||||
qt4_wrap_ui(CLEMENTINE-SOURCES-UI ${CLEMENTINE-UI})
|
|
||||||
qt4_add_resources(CLEMENTINE-SOURCES-RESOURCE ${CLEMENTINE-RESOURCES})
|
|
||||||
|
|
||||||
# Translations
|
|
||||||
set (FILES_TO_TRANSLATE ${CLEMENTINE-SOURCES} ${CLEMENTINE-SOURCES-UI} ${CLEMENTINE-SOURCES-MOC})
|
|
||||||
|
|
||||||
# Make all the filenames relative
|
|
||||||
foreach (_file ${FILES_TO_TRANSLATE})
|
|
||||||
if (IS_ABSOLUTE ${_file})
|
|
||||||
file(RELATIVE_PATH _rel ${CMAKE_CURRENT_SOURCE_DIR} ${_file})
|
|
||||||
else (IS_ABSOLUTE ${_file})
|
|
||||||
set(_rel ${_file})
|
|
||||||
endif (IS_ABSOLUTE ${_file})
|
|
||||||
set(FILES_TO_TRANSLATE_REL ${FILES_TO_TRANSLATE_REL} ${_rel})
|
|
||||||
endforeach (_file)
|
|
||||||
|
|
||||||
set (XGETTEXT_OPTIONS --qt --keyword=tr --flag=tr:1:pass-c-format --flag=tr:1:pass-qt-format
|
|
||||||
--keyword=trUtf8 --flag=tr:1:pass-c-format --flag=tr:1:pass-qt-format
|
|
||||||
--keyword=translate:2 --flag=translate:2:pass-c-format --flag=translate:2:pass-qt-format
|
|
||||||
--keyword=QT_TR_NOOP --flag=QT_TR_NOOP:1:pass-c-format --flag=QT_TR_NOOP:1:pass-qt-format
|
|
||||||
--keyword=QT_TRANSLATE_NOOP:2 --flag=QT_TRANSLATE_NOOP:2:pass-c-format --flag=QT_TRANSLATE_NOOP:2:pass-qt-format
|
|
||||||
--keyword=_ --flag=_:1:pass-c-format --flag=_:1:pass-qt-format
|
|
||||||
--keyword=N_ --flag=N_:1:pass-c-format --flag=N_:1:pass-qt-format
|
|
||||||
--from-code=utf-8)
|
|
||||||
|
|
||||||
# Generate the .pot
|
|
||||||
set (CLEMENTINE-POT "${CMAKE_CURRENT_SOURCE_DIR}/translations/translations.pot")
|
|
||||||
add_custom_target(pot ALL
|
|
||||||
COMMAND ${GETTEXT_XGETTEXT_EXECUTABLE}
|
|
||||||
${XGETTEXT_OPTIONS} -C --omit-header --no-location
|
|
||||||
--directory=${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
--output=${CMAKE_CURRENT_BINARY_DIR}/translations.pot
|
|
||||||
${FILES_TO_TRANSLATE_REL}
|
|
||||||
COMMAND cat ${CMAKE_CURRENT_SOURCE_DIR}/translations/header ${CMAKE_CURRENT_BINARY_DIR}/translations.pot > ${CLEMENTINE-POT}
|
|
||||||
DEPENDS ${FILES_TO_TRANSLATE})
|
|
||||||
|
|
||||||
add_custom_target(po_all ALL)
|
|
||||||
|
|
||||||
# Merge the .pot into .po files
|
|
||||||
foreach (_lang ${CLEMENTINE-LANGUAGES})
|
|
||||||
set(_po ${CMAKE_CURRENT_SOURCE_DIR}/translations/${_lang}.po)
|
|
||||||
add_custom_target("po_${_lang}"
|
|
||||||
COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet -U --no-location --no-fuzzy-matching --backup=off
|
|
||||||
${_po} ${CLEMENTINE-POT}
|
|
||||||
DEPENDS ${_po})
|
|
||||||
add_dependencies("po_${_lang}" pot)
|
|
||||||
add_dependencies(po_all "po_${_lang}")
|
|
||||||
endforeach (_lang)
|
|
||||||
|
|
||||||
# Convert the .po files to .qm files
|
|
||||||
foreach (_lang ${CLEMENTINE-LANGUAGES})
|
|
||||||
set(_po_filename "${_lang}.po")
|
|
||||||
set(_po_filepath "${CMAKE_CURRENT_SOURCE_DIR}/translations/${_po_filename}")
|
|
||||||
set(_qm_filename "clementine_${_lang}.qm")
|
|
||||||
set(_qm_filepath "${CMAKE_CURRENT_BINARY_DIR}/${_qm_filename}")
|
|
||||||
|
|
||||||
add_custom_command(OUTPUT ${_qm_filepath}
|
|
||||||
COMMAND ${QT_LCONVERT_EXECUTABLE} ARGS ${_po_filepath} -o ${_qm_filepath} -of qm
|
|
||||||
MAIN_DEPENDENCY ${_po_filepath}
|
|
||||||
)
|
|
||||||
set(CLEMENTINE-QM-FILES ${CLEMENTINE-QM-FILES} ${_qm_filepath})
|
|
||||||
endforeach (_lang)
|
|
||||||
|
|
||||||
# Generate a qrc file for the translations
|
|
||||||
set(CLEMENTINE-QM-RESOURCE ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc)
|
|
||||||
file(WRITE ${CLEMENTINE-QM-RESOURCE} "<RCC><qresource prefix=\"/translations\">")
|
|
||||||
foreach(QM-FILE ${CLEMENTINE-QM-FILES})
|
|
||||||
file(RELATIVE_PATH QM-RELATIVE-PATH ${CMAKE_CURRENT_BINARY_DIR} ${QM-FILE})
|
|
||||||
file(APPEND ${CLEMENTINE-QM-RESOURCE} "<file>" ${QM-RELATIVE-PATH} "</file>")
|
|
||||||
endforeach(QM-FILE)
|
|
||||||
file(APPEND ${CLEMENTINE-QM-RESOURCE} "</qresource></RCC>")
|
|
||||||
qt4_add_resources(CLEMENTINE-SOURCES-RESOURCE ${CLEMENTINE-QM-RESOURCE})
|
|
||||||
|
|
||||||
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
|
|
||||||
|
|
||||||
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/qtsingleapplication")
|
|
||||||
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/qtiocompressor")
|
|
||||||
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/qxt")
|
|
||||||
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/gmock/gtest/include")
|
|
||||||
|
|
||||||
set(EXECUTABLE_OUTPUT_PATH ..)
|
|
||||||
add_library(clementine_lib
|
|
||||||
${CLEMENTINE-SOURCES}
|
|
||||||
${CLEMENTINE-SOURCES-MOC}
|
|
||||||
${CLEMENTINE-SOURCES-UI}
|
|
||||||
${CLEMENTINE-SOURCES-RESOURCE}
|
|
||||||
)
|
|
||||||
target_link_libraries(clementine_lib
|
|
||||||
qtsingleapplication
|
|
||||||
qtiocompressor
|
|
||||||
lastfm
|
|
||||||
chardet
|
|
||||||
${GOBJECT_LIBRARIES}
|
|
||||||
${GLIB_LIBRARIES}
|
|
||||||
${TAGLIB_LIBRARIES}
|
|
||||||
${QT_LIBRARIES}
|
|
||||||
${ENGINE_LIBRARIES}
|
|
||||||
)
|
|
||||||
if (APPLE)
|
|
||||||
target_link_libraries(clementine_lib
|
|
||||||
${GROWL}
|
|
||||||
${SPARKLE}
|
|
||||||
/System/Library/Frameworks/Carbon.framework
|
|
||||||
/System/Library/Frameworks/Foundation.framework
|
|
||||||
/System/Library/Frameworks/AppKit.framework
|
|
||||||
)
|
|
||||||
include_directories(${GROWL}/Headers)
|
|
||||||
include_directories(${SPARKLE}/Headers)
|
|
||||||
else (APPLE)
|
|
||||||
target_link_libraries(clementine_lib qxt)
|
|
||||||
endif (APPLE)
|
|
||||||
add_dependencies(clementine_lib qtsingleapplication)
|
|
||||||
|
|
||||||
# Link against the qsqlite plugin on windows
|
|
||||||
if(WIN32 OR APPLE)
|
|
||||||
set(3RDPARTY_SQLITE_LIBRARY qsqlite)
|
|
||||||
target_link_libraries(clementine_lib qsqlite)
|
|
||||||
endif(WIN32 OR APPLE)
|
|
||||||
|
|
||||||
# Show the console window in debug mode on Windows
|
|
||||||
if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
||||||
set(CLEMENTINE-WIN32-FLAG WIN32)
|
|
||||||
endif (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
||||||
|
|
||||||
add_executable(clementine
|
add_executable(clementine
|
||||||
MACOSX_BUNDLE
|
MACOSX_BUNDLE
|
||||||
${CLEMENTINE-WIN32-FLAG}
|
${CLEMENTINE-WIN32-FLAG}
|
||||||
${CLEMENTINE-WIN32-RESOURCES}
|
${CLEMENTINE-WIN32-RESOURCES}
|
||||||
main.cpp
|
main.cpp
|
||||||
)
|
)
|
||||||
target_link_libraries(clementine clementine_lib)
|
target_link_libraries(clementine
|
||||||
|
clementine_lib
|
||||||
|
)
|
||||||
|
|
||||||
set_target_properties(clementine PROPERTIES
|
set_target_properties(clementine PROPERTIES
|
||||||
MACOSX_BUNDLE_INFO_PLIST "../dist/Info.plist"
|
MACOSX_BUNDLE_INFO_PLIST "../dist/Info.plist"
|
||||||
)
|
)
|
||||||
|
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
configure_file(
|
configure_file(
|
||||||
../dist/clementine.icns
|
../dist/clementine.icns
|
||||||
${PROJECT_BINARY_DIR}/clementine.app/Contents/Resources/clementine.icns
|
${PROJECT_BINARY_DIR}/clementine.app/Contents/Resources/clementine.icns
|
||||||
COPY_ONLY)
|
COPY_ONLY
|
||||||
|
)
|
||||||
configure_file(
|
configure_file(
|
||||||
../dist/qt.conf
|
../dist/qt.conf
|
||||||
${PROJECT_BINARY_DIR}/clementine.app/Contents/Resources/qt.conf
|
${PROJECT_BINARY_DIR}/clementine.app/Contents/Resources/qt.conf
|
||||||
COPY_ONLY)
|
COPY_ONLY
|
||||||
|
)
|
||||||
configure_file(
|
configure_file(
|
||||||
../dist/sparkle_pub.pem
|
../dist/sparkle_pub.pem
|
||||||
${PROJECT_BINARY_DIR}/clementine.app/Contents/Resources/sparkle_pub.pem
|
${PROJECT_BINARY_DIR}/clementine.app/Contents/Resources/sparkle_pub.pem
|
||||||
COPY_ONLY)
|
COPY_ONLY
|
||||||
|
)
|
||||||
add_custom_target(bundle
|
add_custom_target(bundle
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../macdeploy.py ${PROJECT_BINARY_DIR}/clementine.app -f
|
${CMAKE_CURRENT_SOURCE_DIR}/../macdeploy.py ${PROJECT_BINARY_DIR}/clementine.app -f
|
||||||
DEPENDS clementine
|
DEPENDS clementine
|
||||||
)
|
)
|
||||||
add_custom_target(dmg
|
add_custom_target(dmg
|
||||||
macdeployqt ${PROJECT_BINARY_DIR}/clementine.app -dmg
|
macdeployqt ${PROJECT_BINARY_DIR}/clementine.app -dmg
|
||||||
DEPENDS clementine)
|
DEPENDS clementine
|
||||||
|
)
|
||||||
endif (APPLE)
|
endif (APPLE)
|
||||||
|
|
||||||
install(TARGETS clementine
|
install(TARGETS clementine
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
cmake_minimum_required(VERSION 2.6)
|
||||||
|
|
||||||
|
set(SOURCES
|
||||||
|
analyzerbase.cpp
|
||||||
|
analyzercontainer.cpp
|
||||||
|
baranalyzer.cpp
|
||||||
|
blockanalyzer.cpp
|
||||||
|
boomanalyzer.cpp
|
||||||
|
sonogram.cpp
|
||||||
|
turbine.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
set(HEADERS
|
||||||
|
analyzerbase.h
|
||||||
|
analyzercontainer.h
|
||||||
|
baranalyzer.h
|
||||||
|
blockanalyzer.h
|
||||||
|
boomanalyzer.h
|
||||||
|
sonogram.h
|
||||||
|
turbine.h
|
||||||
|
)
|
||||||
|
|
||||||
|
qt4_wrap_cpp(MOC ${HEADERS})
|
||||||
|
|
||||||
|
add_library(clementine_analyzers
|
||||||
|
${SOURCES}
|
||||||
|
${MOC}
|
||||||
|
)
|
||||||
|
|
||||||
|
add_translation_source(analyzers ${SOURCES} ${MOC})
|
|
@ -9,8 +9,8 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "core/fht.h" //stack allocated and convenience
|
||||||
#include "engines/engine_fwd.h"
|
#include "engines/engine_fwd.h"
|
||||||
#include "fht.h" //stack allocated and convenience
|
|
||||||
#include <QPixmap> //stack allocated and convenience
|
#include <QPixmap> //stack allocated and convenience
|
||||||
#include <QBasicTimer> //stack allocated
|
#include <QBasicTimer> //stack allocated
|
||||||
#include <QWidget> //baseclass
|
#include <QWidget> //baseclass
|
||||||
|
|
|
@ -23,4 +23,9 @@
|
||||||
#define CLEMENTINE_VERSION_STRING "${CLEMENTINE_VERSION_STRING}"
|
#define CLEMENTINE_VERSION_STRING "${CLEMENTINE_VERSION_STRING}"
|
||||||
#define CLEMENTINE_VERSION_SHORT_STRING "${CLEMENTINE_VERSION_SHORT_STRING}"
|
#define CLEMENTINE_VERSION_SHORT_STRING "${CLEMENTINE_VERSION_SHORT_STRING}"
|
||||||
|
|
||||||
|
#cmakedefine HAVE_GSTREAMER
|
||||||
|
#cmakedefine HAVE_LIBVLC
|
||||||
|
#cmakedefine HAVE_LIBXINE
|
||||||
|
#cmakedefine HAVE_QT_PHONON
|
||||||
|
|
||||||
#endif // CONFIG_H_IN
|
#endif // CONFIG_H_IN
|
||||||
|
|
|
@ -0,0 +1,72 @@
|
||||||
|
cmake_minimum_required(VERSION 2.6)
|
||||||
|
|
||||||
|
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
|
||||||
|
set(SOURCES
|
||||||
|
albumcoverfetcher.cpp
|
||||||
|
albumcoverloader.cpp
|
||||||
|
backgroundthread.cpp
|
||||||
|
commandlineoptions.cpp
|
||||||
|
database.cpp
|
||||||
|
fht.cpp
|
||||||
|
globalshortcuts.cpp
|
||||||
|
m3uparser.cpp
|
||||||
|
mergedproxymodel.cpp
|
||||||
|
networkaccessmanager.cpp
|
||||||
|
player.cpp
|
||||||
|
scopedtransaction.cpp
|
||||||
|
settingsprovider.cpp
|
||||||
|
song.cpp
|
||||||
|
stylesheetloader.cpp
|
||||||
|
utilities.cpp
|
||||||
|
xspfparser.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
set(HEADERS
|
||||||
|
albumcoverfetcher.h
|
||||||
|
albumcoverloader.h
|
||||||
|
backgroundthread.h
|
||||||
|
database.h
|
||||||
|
globalshortcuts.h
|
||||||
|
m3uparser.h
|
||||||
|
mergedproxymodel.h
|
||||||
|
networkaccessmanager.h
|
||||||
|
player.h
|
||||||
|
xspfparser.h
|
||||||
|
)
|
||||||
|
|
||||||
|
if(NOT APPLE AND NOT WIN32)
|
||||||
|
# MPRIS
|
||||||
|
qt4_add_dbus_adaptor(MPRIS-PLAYER-SOURCES
|
||||||
|
../../data/org.freedesktop.MediaPlayer.player.xml
|
||||||
|
core/player.h Player mpris_player MprisPlayer)
|
||||||
|
qt4_add_dbus_adaptor(MPRIS-ROOT-SOURCES
|
||||||
|
../../data/org.freedesktop.MediaPlayer.root.xml
|
||||||
|
core/mpris.h MPRIS mpris_root MprisRoot)
|
||||||
|
qt4_add_dbus_adaptor(MPRIS-TRACKLIST-SOURCES
|
||||||
|
../../data/org.freedesktop.MediaPlayer.tracklist.xml
|
||||||
|
core/player.h Player mpris_tracklist MprisTrackList)
|
||||||
|
|
||||||
|
# org.freedesktop.Notifications
|
||||||
|
qt4_add_dbus_interface(NOTIFICATION-SOURCES
|
||||||
|
../../data/org.freedesktop.Notifications.xml
|
||||||
|
notification)
|
||||||
|
list(APPEND SOURCES
|
||||||
|
${MPRIS-PLAYER-SOURCES}
|
||||||
|
${MPRIS-ROOT-SOURCES}
|
||||||
|
${MPRIS-TRACKLIST-SOURCES}
|
||||||
|
${NOTIFICATION-SOURCES}
|
||||||
|
mpris.cpp
|
||||||
|
)
|
||||||
|
list(APPEND HEADERS mpris.h)
|
||||||
|
endif(NOT APPLE AND NOT WIN32)
|
||||||
|
|
||||||
|
|
||||||
|
qt4_wrap_cpp(MOC ${HEADERS})
|
||||||
|
|
||||||
|
add_library(clementine_core
|
||||||
|
${SOURCES}
|
||||||
|
${MOC}
|
||||||
|
)
|
||||||
|
|
||||||
|
add_translation_source(core ${SOURCES} ${MOC})
|
|
@ -14,6 +14,7 @@
|
||||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
#include "commandlineoptions.h"
|
#include "commandlineoptions.h"
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
|
@ -14,10 +14,11 @@
|
||||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
#include "player.h"
|
#include "player.h"
|
||||||
#include "playlist.h"
|
|
||||||
#include "lastfmservice.h"
|
|
||||||
#include "engines/enginebase.h"
|
#include "engines/enginebase.h"
|
||||||
|
#include "playlist/playlist.h"
|
||||||
|
#include "radio/lastfmservice.h"
|
||||||
|
|
||||||
#ifdef HAVE_GSTREAMER
|
#ifdef HAVE_GSTREAMER
|
||||||
# include "engines/gstengine.h"
|
# include "engines/gstengine.h"
|
|
@ -20,9 +20,9 @@
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
|
||||||
|
#include "core/song.h"
|
||||||
#include "engines/engine_fwd.h"
|
#include "engines/engine_fwd.h"
|
||||||
#include "playlistitem.h"
|
#include "playlist/playlistitem.h"
|
||||||
#include "song.h"
|
|
||||||
|
|
||||||
class Playlist;
|
class Playlist;
|
||||||
class Settings;
|
class Settings;
|
|
@ -15,6 +15,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "song.h"
|
#include "song.h"
|
||||||
|
#include "utilities.h"
|
||||||
|
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
@ -37,7 +38,7 @@
|
||||||
#include <taglib/textidentificationframe.h>
|
#include <taglib/textidentificationframe.h>
|
||||||
#include <taglib/xiphcomment.h>
|
#include <taglib/xiphcomment.h>
|
||||||
|
|
||||||
#include "fixlastfm.h"
|
#include "radio/fixlastfm.h"
|
||||||
#include <lastfm/Track>
|
#include <lastfm/Track>
|
||||||
|
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
@ -50,9 +51,9 @@
|
||||||
#include <boost/scoped_ptr.hpp>
|
#include <boost/scoped_ptr.hpp>
|
||||||
using boost::scoped_ptr;
|
using boost::scoped_ptr;
|
||||||
|
|
||||||
#include "trackslider.h"
|
|
||||||
#include "engines/enginebase.h"
|
|
||||||
#include "albumcoverloader.h"
|
#include "albumcoverloader.h"
|
||||||
|
#include "engines/enginebase.h"
|
||||||
|
#include "widgets/trackslider.h"
|
||||||
|
|
||||||
static QStringList Prepend(const QString& text, const QStringList& list) {
|
static QStringList Prepend(const QString& text, const QStringList& list) {
|
||||||
QStringList ret(list);
|
QStringList ret(list);
|
||||||
|
@ -481,7 +482,7 @@ QString Song::PrettyLength() const {
|
||||||
if (d->length_ == -1)
|
if (d->length_ == -1)
|
||||||
return QString::null;
|
return QString::null;
|
||||||
|
|
||||||
return TrackSlider::PrettyTime(d->length_);
|
return Utilities::PrettyTime(d->length_);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Song::IsMetadataEqual(const Song& other) const {
|
bool Song::IsMetadataEqual(const Song& other) const {
|
|
@ -0,0 +1,39 @@
|
||||||
|
/* This file is part of Clementine.
|
||||||
|
|
||||||
|
Clementine is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "utilities.h"
|
||||||
|
|
||||||
|
namespace Utilities {
|
||||||
|
|
||||||
|
QString PrettyTime(int seconds) {
|
||||||
|
// last.fm sometimes gets the track length wrong, so you end up with
|
||||||
|
// negative times.
|
||||||
|
seconds = qAbs(seconds);
|
||||||
|
|
||||||
|
int hours = seconds / (60*60);
|
||||||
|
int minutes = (seconds / 60) % 60;
|
||||||
|
seconds %= 60;
|
||||||
|
|
||||||
|
QString ret;
|
||||||
|
if (hours)
|
||||||
|
ret.sprintf("%d:%02d:%02d", hours, minutes, seconds);
|
||||||
|
else
|
||||||
|
ret.sprintf("%d:%02d", minutes, seconds);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
|
@ -0,0 +1,26 @@
|
||||||
|
/* This file is part of Clementine.
|
||||||
|
|
||||||
|
Clementine is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef UTILITIES_H
|
||||||
|
#define UTILITIES_H
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
namespace Utilities {
|
||||||
|
QString PrettyTime(int seconds);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // UTILITIES_H
|
|
@ -1,143 +0,0 @@
|
||||||
/* This file is part of Clementine.
|
|
||||||
|
|
||||||
Clementine is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "playlistdelegates.h"
|
|
||||||
#include "edittagdialog.h"
|
|
||||||
#include "library.h"
|
|
||||||
|
|
||||||
#include <QtDebug>
|
|
||||||
|
|
||||||
const char* EditTagDialog::kHintText = QT_TR_NOOP("[click to edit]");
|
|
||||||
|
|
||||||
EditTagDialog::EditTagDialog(QWidget* parent)
|
|
||||||
: QDialog(parent)
|
|
||||||
{
|
|
||||||
ui_.setupUi(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool EditTagDialog::SetSongs(const SongList &s) {
|
|
||||||
SongList songs;
|
|
||||||
|
|
||||||
foreach (const Song& song, s) {
|
|
||||||
if (song.IsEditable())
|
|
||||||
songs << song;
|
|
||||||
}
|
|
||||||
songs_ = songs;
|
|
||||||
|
|
||||||
if (songs.count() == 0)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Don't allow editing of fields that don't make sense for multiple items
|
|
||||||
ui_.title->setEnabled(songs.count() == 1);
|
|
||||||
ui_.track->setEnabled(songs.count() == 1);
|
|
||||||
ui_.comment->setEnabled(songs.count() == 1);
|
|
||||||
|
|
||||||
common_artist_ = songs[0].artist();
|
|
||||||
common_album_ = songs[0].album();
|
|
||||||
common_genre_ = songs[0].genre();
|
|
||||||
common_year_ = songs[0].year();
|
|
||||||
|
|
||||||
if (songs.count() == 1) {
|
|
||||||
const Song& song = songs[0];
|
|
||||||
|
|
||||||
ui_.title->setText(song.title());
|
|
||||||
ui_.artist->setText(song.artist());
|
|
||||||
ui_.album->setText(song.album());
|
|
||||||
ui_.genre->setText(song.genre());
|
|
||||||
ui_.year->setValue(song.year());
|
|
||||||
ui_.track->setValue(song.track());
|
|
||||||
ui_.comment->setPlainText(song.comment());
|
|
||||||
|
|
||||||
ui_.filename->setText(song.filename());
|
|
||||||
|
|
||||||
ui_.artist->ClearHint();
|
|
||||||
ui_.album->ClearHint();
|
|
||||||
ui_.genre->ClearHint();
|
|
||||||
} else {
|
|
||||||
// Find any fields that are common to all items
|
|
||||||
|
|
||||||
ui_.title->clear();
|
|
||||||
ui_.track->clear();
|
|
||||||
ui_.comment->clear();
|
|
||||||
|
|
||||||
foreach (const Song& song, songs) {
|
|
||||||
if (common_artist_ != song.artist()) {
|
|
||||||
common_artist_ = QString::null;
|
|
||||||
ui_.artist->SetHint(kHintText);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (common_album_ != song.album()) {
|
|
||||||
common_album_ = QString::null;
|
|
||||||
ui_.album->SetHint(kHintText);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (common_genre_ != song.genre()) {
|
|
||||||
common_genre_ = QString::null;
|
|
||||||
ui_.genre->SetHint(kHintText);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (common_year_ != song.year())
|
|
||||||
common_year_ = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
ui_.artist->setText(common_artist_);
|
|
||||||
ui_.album->setText(common_album_);
|
|
||||||
ui_.genre->setText(common_genre_);
|
|
||||||
ui_.year->setValue(common_year_);
|
|
||||||
|
|
||||||
ui_.filename->setText(tr("Editing %n tracks", "", songs.count()));
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void EditTagDialog::SetTagCompleter(LibraryBackend* backend) {
|
|
||||||
new TagCompleter(backend, Playlist::Column_Artist, ui_.artist);
|
|
||||||
new TagCompleter(backend, Playlist::Column_Album, ui_.album);
|
|
||||||
}
|
|
||||||
|
|
||||||
void EditTagDialog::accept() {
|
|
||||||
foreach (const Song& old, songs_) {
|
|
||||||
Song song(old);
|
|
||||||
|
|
||||||
int track = ui_.track->text().isEmpty() ? -1 : ui_.track->value();
|
|
||||||
int year = ui_.year->text().isEmpty() ? -1 : ui_.year->value();
|
|
||||||
|
|
||||||
if (ui_.title->isEnabled())
|
|
||||||
song.set_title(ui_.title->text());
|
|
||||||
|
|
||||||
if (ui_.artist->isEnabled() && !(common_artist_.isNull() && ui_.artist->text().isEmpty()))
|
|
||||||
song.set_artist(ui_.artist->text());
|
|
||||||
if (ui_.album->isEnabled() && !(common_album_.isNull() && ui_.album->text().isEmpty()))
|
|
||||||
song.set_album(ui_.album->text());
|
|
||||||
if (ui_.genre->isEnabled() && !(common_genre_.isNull() && ui_.genre->text().isEmpty()))
|
|
||||||
song.set_genre(ui_.genre->text());
|
|
||||||
if (ui_.year->isEnabled() && !(common_year_ == -1 && year == -1))
|
|
||||||
song.set_year(year);
|
|
||||||
|
|
||||||
if (ui_.track->isEnabled())
|
|
||||||
song.set_track(track);
|
|
||||||
|
|
||||||
if (ui_.comment->isEnabled())
|
|
||||||
song.set_comment(ui_.comment->toPlainText());
|
|
||||||
|
|
||||||
song.Save();
|
|
||||||
|
|
||||||
emit SongEdited(old, song);
|
|
||||||
}
|
|
||||||
|
|
||||||
QDialog::accept();
|
|
||||||
}
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
cmake_minimum_required(VERSION 2.6)
|
||||||
|
|
||||||
|
set(ENGINES-SOURCES
|
||||||
|
enginebase.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
set(ENGINES-HEADERS
|
||||||
|
enginebase.h
|
||||||
|
)
|
||||||
|
|
||||||
|
# lists of engine source files
|
||||||
|
set(GST_ENGINE_SRC
|
||||||
|
gstengine.cpp
|
||||||
|
gstequalizer.cpp
|
||||||
|
gstenginepipeline.cpp
|
||||||
|
)
|
||||||
|
set(GST_ENGINE_MOC
|
||||||
|
gstengine.h
|
||||||
|
gstenginepipeline.h
|
||||||
|
)
|
||||||
|
set(GST_ENGINE_LIB
|
||||||
|
GSTREAMER
|
||||||
|
GSTREAMER_BASE
|
||||||
|
)
|
||||||
|
|
||||||
|
set(XINE_ENGINE_SRC
|
||||||
|
xine-engine.cpp
|
||||||
|
xine-scope.c
|
||||||
|
)
|
||||||
|
set(XINE_ENGINE_MOC
|
||||||
|
xine-engine.h
|
||||||
|
)
|
||||||
|
|
||||||
|
# try to add engines
|
||||||
|
include(../../AddEngine.cmake)
|
||||||
|
add_engine(gst "${GST_ENGINE_LIB}" "${GST_ENGINE_SRC}" "${GST_ENGINE_MOC}" ON)
|
||||||
|
add_engine(vlc LIBVLC vlcengine.cpp vlcengine.h OFF)
|
||||||
|
add_engine(xine LIBXINE "${XINE_ENGINE_SRC}" "${XINE_ENGINE_MOC}" OFF)
|
||||||
|
add_engine(qt-phonon QT_PHONON phononengine.cpp phononengine.h OFF)
|
||||||
|
print_engines()
|
||||||
|
|
||||||
|
# need at least 1 engine
|
||||||
|
if(NOT ENGINES_ENABLED)
|
||||||
|
message(FATAL_ERROR "no engine enabled!")
|
||||||
|
endif(NOT ENGINES_ENABLED)
|
||||||
|
|
||||||
|
|
||||||
|
qt4_wrap_cpp(ENGINES-MOC ${ENGINES-HEADERS})
|
||||||
|
|
||||||
|
add_library(clementine_engines
|
||||||
|
${ENGINES-SOURCES}
|
||||||
|
${ENGINES-MOC}
|
||||||
|
)
|
||||||
|
|
||||||
|
add_translation_source(engines ${ENGINES-SOURCES} ${ENGINES-MOC})
|
|
@ -0,0 +1,55 @@
|
||||||
|
cmake_minimum_required(VERSION 2.6)
|
||||||
|
|
||||||
|
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
|
||||||
|
set(SOURCES
|
||||||
|
groupbydialog.cpp
|
||||||
|
library.cpp
|
||||||
|
librarybackend.cpp
|
||||||
|
libraryconfig.cpp
|
||||||
|
libraryconfigdialog.cpp
|
||||||
|
librarydirectorymodel.cpp
|
||||||
|
libraryfilterwidget.cpp
|
||||||
|
librarymodel.cpp
|
||||||
|
libraryplaylistitem.cpp
|
||||||
|
libraryquery.cpp
|
||||||
|
libraryview.cpp
|
||||||
|
librarywatcher.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
set(HEADERS
|
||||||
|
groupbydialog.h
|
||||||
|
library.h
|
||||||
|
librarybackend.h
|
||||||
|
libraryconfig.h
|
||||||
|
libraryconfigdialog.h
|
||||||
|
librarydirectorymodel.h
|
||||||
|
libraryfilterwidget.h
|
||||||
|
librarymodel.h
|
||||||
|
libraryview.h
|
||||||
|
librarywatcher.h
|
||||||
|
)
|
||||||
|
|
||||||
|
set(UI
|
||||||
|
groupbydialog.ui
|
||||||
|
libraryconfig.ui
|
||||||
|
libraryconfigdialog.ui
|
||||||
|
libraryfilterwidget.ui
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
qt4_wrap_cpp(MOC ${HEADERS})
|
||||||
|
qt4_wrap_ui(UIC ${UI})
|
||||||
|
|
||||||
|
add_library(clementine_library
|
||||||
|
${SOURCES}
|
||||||
|
${MOC}
|
||||||
|
${UIC}
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(clementine_library
|
||||||
|
clementine_core
|
||||||
|
clementine_playlist
|
||||||
|
)
|
||||||
|
|
||||||
|
add_translation_source(library ${SOURCES} ${MOC} ${UIC})
|
|
@ -15,13 +15,15 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "groupbydialog.h"
|
#include "groupbydialog.h"
|
||||||
|
#include "ui_groupbydialog.h"
|
||||||
|
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
|
||||||
GroupByDialog::GroupByDialog(QWidget *parent)
|
GroupByDialog::GroupByDialog(QWidget *parent)
|
||||||
: QDialog(parent)
|
: QDialog(parent),
|
||||||
|
ui_(new Ui_GroupByDialog)
|
||||||
{
|
{
|
||||||
ui_.setupUi(this);
|
ui_->setupUi(this);
|
||||||
Reset();
|
Reset();
|
||||||
|
|
||||||
mapping_.insert(Mapping(LibraryModel::GroupBy_None, 0));
|
mapping_.insert(Mapping(LibraryModel::GroupBy_None, 0));
|
||||||
|
@ -33,26 +35,30 @@ GroupByDialog::GroupByDialog(QWidget *parent)
|
||||||
mapping_.insert(Mapping(LibraryModel::GroupBy_Year, 6));
|
mapping_.insert(Mapping(LibraryModel::GroupBy_Year, 6));
|
||||||
mapping_.insert(Mapping(LibraryModel::GroupBy_YearAlbum, 7));
|
mapping_.insert(Mapping(LibraryModel::GroupBy_YearAlbum, 7));
|
||||||
|
|
||||||
connect(ui_.button_box->button(QDialogButtonBox::Reset), SIGNAL(clicked()),
|
connect(ui_->button_box->button(QDialogButtonBox::Reset), SIGNAL(clicked()),
|
||||||
SLOT(Reset()));
|
SLOT(Reset()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GroupByDialog::~GroupByDialog() {
|
||||||
|
delete ui_;
|
||||||
|
}
|
||||||
|
|
||||||
void GroupByDialog::Reset() {
|
void GroupByDialog::Reset() {
|
||||||
ui_.first->setCurrentIndex(2); // Artist
|
ui_->first->setCurrentIndex(2); // Artist
|
||||||
ui_.second->setCurrentIndex(1); // Album
|
ui_->second->setCurrentIndex(1); // Album
|
||||||
ui_.third->setCurrentIndex(0); // None
|
ui_->third->setCurrentIndex(0); // None
|
||||||
}
|
}
|
||||||
|
|
||||||
void GroupByDialog::accept() {
|
void GroupByDialog::accept() {
|
||||||
emit Accepted(LibraryModel::Grouping(
|
emit Accepted(LibraryModel::Grouping(
|
||||||
mapping_.get<tag_index>().find(ui_.first->currentIndex())->group_by,
|
mapping_.get<tag_index>().find(ui_->first->currentIndex())->group_by,
|
||||||
mapping_.get<tag_index>().find(ui_.second->currentIndex())->group_by,
|
mapping_.get<tag_index>().find(ui_->second->currentIndex())->group_by,
|
||||||
mapping_.get<tag_index>().find(ui_.third->currentIndex())->group_by));
|
mapping_.get<tag_index>().find(ui_->third->currentIndex())->group_by));
|
||||||
QDialog::accept();
|
QDialog::accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GroupByDialog::LibraryGroupingChanged(const LibraryModel::Grouping& g) {
|
void GroupByDialog::LibraryGroupingChanged(const LibraryModel::Grouping& g) {
|
||||||
ui_.first->setCurrentIndex(mapping_.get<tag_group_by>().find(g[0])->combo_box_index);
|
ui_->first->setCurrentIndex(mapping_.get<tag_group_by>().find(g[0])->combo_box_index);
|
||||||
ui_.second->setCurrentIndex(mapping_.get<tag_group_by>().find(g[1])->combo_box_index);
|
ui_->second->setCurrentIndex(mapping_.get<tag_group_by>().find(g[1])->combo_box_index);
|
||||||
ui_.third->setCurrentIndex(mapping_.get<tag_group_by>().find(g[2])->combo_box_index);
|
ui_->third->setCurrentIndex(mapping_.get<tag_group_by>().find(g[2])->combo_box_index);
|
||||||
}
|
}
|
|
@ -24,7 +24,8 @@
|
||||||
#include <boost/multi_index/ordered_index.hpp>
|
#include <boost/multi_index/ordered_index.hpp>
|
||||||
|
|
||||||
#include "librarymodel.h"
|
#include "librarymodel.h"
|
||||||
#include "ui_groupbydialog.h"
|
|
||||||
|
class Ui_GroupByDialog;
|
||||||
|
|
||||||
using boost::multi_index_container;
|
using boost::multi_index_container;
|
||||||
using boost::multi_index::indexed_by;
|
using boost::multi_index::indexed_by;
|
||||||
|
@ -37,6 +38,7 @@ class GroupByDialog : public QDialog {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GroupByDialog(QWidget *parent = 0);
|
GroupByDialog(QWidget *parent = 0);
|
||||||
|
~GroupByDialog();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void LibraryGroupingChanged(const LibraryModel::Grouping& g);
|
void LibraryGroupingChanged(const LibraryModel::Grouping& g);
|
||||||
|
@ -69,7 +71,7 @@ class GroupByDialog : public QDialog {
|
||||||
> MappingContainer;
|
> MappingContainer;
|
||||||
|
|
||||||
MappingContainer mapping_;
|
MappingContainer mapping_;
|
||||||
Ui_GroupByDialog ui_;
|
Ui_GroupByDialog* ui_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // GROUPBYDIALOG_H
|
#endif // GROUPBYDIALOG_H
|
|
@ -17,7 +17,7 @@
|
||||||
#ifndef LIBRARY_H
|
#ifndef LIBRARY_H
|
||||||
#define LIBRARY_H
|
#define LIBRARY_H
|
||||||
|
|
||||||
#include "backgroundthread.h"
|
#include "core/backgroundthread.h"
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
|
|
||||||
#include "librarybackend.h"
|
#include "librarybackend.h"
|
||||||
#include "libraryquery.h"
|
#include "libraryquery.h"
|
||||||
#include "scopedtransaction.h"
|
#include "core/database.h"
|
||||||
#include "database.h"
|
#include "core/scopedtransaction.h"
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QVariant>
|
#include <QVariant>
|
|
@ -21,8 +21,8 @@
|
||||||
#include <QSet>
|
#include <QSet>
|
||||||
|
|
||||||
#include "directory.h"
|
#include "directory.h"
|
||||||
#include "song.h"
|
|
||||||
#include "libraryquery.h"
|
#include "libraryquery.h"
|
||||||
|
#include "core/song.h"
|
||||||
|
|
||||||
class Database;
|
class Database;
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include "libraryconfig.h"
|
#include "libraryconfig.h"
|
||||||
#include "librarydirectorymodel.h"
|
#include "librarydirectorymodel.h"
|
||||||
#include "libraryview.h"
|
#include "libraryview.h"
|
||||||
|
#include "ui_libraryconfig.h"
|
||||||
|
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
@ -26,25 +27,30 @@ const char* LibraryConfig::kSettingsGroup = "LibraryConfig";
|
||||||
|
|
||||||
LibraryConfig::LibraryConfig(QWidget* parent)
|
LibraryConfig::LibraryConfig(QWidget* parent)
|
||||||
: QWidget(parent),
|
: QWidget(parent),
|
||||||
|
ui_(new Ui_LibraryConfig),
|
||||||
model_(NULL)
|
model_(NULL)
|
||||||
{
|
{
|
||||||
ui_.setupUi(this);
|
ui_->setupUi(this);
|
||||||
|
|
||||||
connect(ui_.add, SIGNAL(clicked()), SLOT(Add()));
|
connect(ui_->add, SIGNAL(clicked()), SLOT(Add()));
|
||||||
connect(ui_.remove, SIGNAL(clicked()), SLOT(Remove()));
|
connect(ui_->remove, SIGNAL(clicked()), SLOT(Remove()));
|
||||||
|
}
|
||||||
|
|
||||||
|
LibraryConfig::~LibraryConfig() {
|
||||||
|
delete ui_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LibraryConfig::SetModel(LibraryDirectoryModel *model) {
|
void LibraryConfig::SetModel(LibraryDirectoryModel *model) {
|
||||||
if (ui_.list->selectionModel()) {
|
if (ui_->list->selectionModel()) {
|
||||||
disconnect(ui_.list->selectionModel(),
|
disconnect(ui_->list->selectionModel(),
|
||||||
SIGNAL(currentRowChanged(QModelIndex, QModelIndex)),
|
SIGNAL(currentRowChanged(QModelIndex, QModelIndex)),
|
||||||
this, SLOT(CurrentRowChanged(QModelIndex)));
|
this, SLOT(CurrentRowChanged(QModelIndex)));
|
||||||
}
|
}
|
||||||
|
|
||||||
model_ = model;
|
model_ = model;
|
||||||
ui_.list->setModel(model_);
|
ui_->list->setModel(model_);
|
||||||
|
|
||||||
connect(ui_.list->selectionModel(),
|
connect(ui_->list->selectionModel(),
|
||||||
SIGNAL(currentRowChanged(QModelIndex, QModelIndex)),
|
SIGNAL(currentRowChanged(QModelIndex, QModelIndex)),
|
||||||
SLOT(CurrentRowChanged(QModelIndex)));
|
SLOT(CurrentRowChanged(QModelIndex)));
|
||||||
}
|
}
|
||||||
|
@ -64,18 +70,18 @@ void LibraryConfig::Add() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void LibraryConfig::Remove() {
|
void LibraryConfig::Remove() {
|
||||||
model_->RemoveDirectory(ui_.list->currentIndex());
|
model_->RemoveDirectory(ui_->list->currentIndex());
|
||||||
}
|
}
|
||||||
|
|
||||||
void LibraryConfig::CurrentRowChanged(const QModelIndex& index) {
|
void LibraryConfig::CurrentRowChanged(const QModelIndex& index) {
|
||||||
ui_.remove->setEnabled(index.isValid());
|
ui_->remove->setEnabled(index.isValid());
|
||||||
}
|
}
|
||||||
|
|
||||||
void LibraryConfig::Save() {
|
void LibraryConfig::Save() {
|
||||||
QSettings s;
|
QSettings s;
|
||||||
s.beginGroup(LibraryView::kSettingsGroup);
|
s.beginGroup(LibraryView::kSettingsGroup);
|
||||||
|
|
||||||
s.setValue("auto_open", ui_.auto_open->isChecked());
|
s.setValue("auto_open", ui_->auto_open->isChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
void LibraryConfig::showEvent(QShowEvent *) {
|
void LibraryConfig::showEvent(QShowEvent *) {
|
||||||
|
@ -86,5 +92,5 @@ void LibraryConfig::Load() {
|
||||||
QSettings s;
|
QSettings s;
|
||||||
s.beginGroup(LibraryView::kSettingsGroup);
|
s.beginGroup(LibraryView::kSettingsGroup);
|
||||||
|
|
||||||
ui_.auto_open->setChecked(s.value("auto_open", true).toBool());
|
ui_->auto_open->setChecked(s.value("auto_open", true).toBool());
|
||||||
}
|
}
|
|
@ -19,15 +19,17 @@
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
#include "ui_libraryconfig.h"
|
class Ui_LibraryConfig;
|
||||||
|
|
||||||
class LibraryDirectoryModel;
|
class LibraryDirectoryModel;
|
||||||
|
|
||||||
|
class QModelIndex;
|
||||||
|
|
||||||
class LibraryConfig : public QWidget {
|
class LibraryConfig : public QWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LibraryConfig(QWidget* parent = 0);
|
LibraryConfig(QWidget* parent = 0);
|
||||||
|
~LibraryConfig();
|
||||||
|
|
||||||
void SetModel(LibraryDirectoryModel* model);
|
void SetModel(LibraryDirectoryModel* model);
|
||||||
|
|
||||||
|
@ -47,7 +49,7 @@ class LibraryConfig : public QWidget {
|
||||||
private:
|
private:
|
||||||
static const char* kSettingsGroup;
|
static const char* kSettingsGroup;
|
||||||
|
|
||||||
Ui::LibraryConfig ui_;
|
Ui_LibraryConfig* ui_;
|
||||||
LibraryDirectoryModel* model_;
|
LibraryDirectoryModel* model_;
|
||||||
};
|
};
|
||||||
|
|
|
@ -15,18 +15,24 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "libraryconfigdialog.h"
|
#include "libraryconfigdialog.h"
|
||||||
|
#include "ui_libraryconfigdialog.h"
|
||||||
|
|
||||||
LibraryConfigDialog::LibraryConfigDialog(QWidget *parent)
|
LibraryConfigDialog::LibraryConfigDialog(QWidget *parent)
|
||||||
: QDialog(parent)
|
: QDialog(parent),
|
||||||
|
ui_(new Ui_LibraryConfigDialog)
|
||||||
{
|
{
|
||||||
ui_.setupUi(this);
|
ui_->setupUi(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
LibraryConfigDialog::~LibraryConfigDialog() {
|
||||||
|
delete ui_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LibraryConfigDialog::SetModel(LibraryDirectoryModel* model) {
|
void LibraryConfigDialog::SetModel(LibraryDirectoryModel* model) {
|
||||||
ui_.config->SetModel(model);
|
ui_->config->SetModel(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LibraryConfigDialog::accept() {
|
void LibraryConfigDialog::accept() {
|
||||||
ui_.config->Save();
|
ui_->config->Save();
|
||||||
QDialog::accept();
|
QDialog::accept();
|
||||||
}
|
}
|
|
@ -19,14 +19,14 @@
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
|
||||||
#include "ui_libraryconfigdialog.h"
|
class Ui_LibraryConfigDialog;
|
||||||
|
|
||||||
class LibraryDirectoryModel;
|
class LibraryDirectoryModel;
|
||||||
|
|
||||||
class LibraryConfigDialog : public QDialog {
|
class LibraryConfigDialog : public QDialog {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
LibraryConfigDialog(QWidget* parent = 0);
|
LibraryConfigDialog(QWidget* parent = 0);
|
||||||
|
~LibraryConfigDialog();
|
||||||
|
|
||||||
void SetModel(LibraryDirectoryModel* model);
|
void SetModel(LibraryDirectoryModel* model);
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ class LibraryConfigDialog : public QDialog {
|
||||||
void accept();
|
void accept();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::LibraryConfigDialog ui_;
|
Ui_LibraryConfigDialog* ui_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // LIBRARYCONFIGDIALOG_H
|
#endif // LIBRARYCONFIGDIALOG_H
|
|
@ -18,6 +18,7 @@
|
||||||
#include "librarymodel.h"
|
#include "librarymodel.h"
|
||||||
#include "groupbydialog.h"
|
#include "groupbydialog.h"
|
||||||
#include "libraryconfigdialog.h"
|
#include "libraryconfigdialog.h"
|
||||||
|
#include "ui_libraryfilterwidget.h"
|
||||||
|
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QActionGroup>
|
#include <QActionGroup>
|
||||||
|
@ -26,62 +27,63 @@
|
||||||
|
|
||||||
LibraryFilterWidget::LibraryFilterWidget(QWidget *parent)
|
LibraryFilterWidget::LibraryFilterWidget(QWidget *parent)
|
||||||
: QWidget(parent),
|
: QWidget(parent),
|
||||||
|
ui_(new Ui_LibraryFilterWidget),
|
||||||
model_(NULL),
|
model_(NULL),
|
||||||
group_by_dialog_(new GroupByDialog),
|
group_by_dialog_(new GroupByDialog),
|
||||||
library_config_dialog_(new LibraryConfigDialog)
|
library_config_dialog_(new LibraryConfigDialog)
|
||||||
{
|
{
|
||||||
ui_.setupUi(this);
|
ui_->setupUi(this);
|
||||||
|
|
||||||
// Filter by age
|
// Filter by age
|
||||||
QActionGroup* filter_age_group = new QActionGroup(this);
|
QActionGroup* filter_age_group = new QActionGroup(this);
|
||||||
filter_age_group->addAction(ui_.filter_age_all);
|
filter_age_group->addAction(ui_->filter_age_all);
|
||||||
filter_age_group->addAction(ui_.filter_age_today);
|
filter_age_group->addAction(ui_->filter_age_today);
|
||||||
filter_age_group->addAction(ui_.filter_age_week);
|
filter_age_group->addAction(ui_->filter_age_week);
|
||||||
filter_age_group->addAction(ui_.filter_age_month);
|
filter_age_group->addAction(ui_->filter_age_month);
|
||||||
filter_age_group->addAction(ui_.filter_age_three_months);
|
filter_age_group->addAction(ui_->filter_age_three_months);
|
||||||
filter_age_group->addAction(ui_.filter_age_year);
|
filter_age_group->addAction(ui_->filter_age_year);
|
||||||
|
|
||||||
filter_age_menu_ = new QMenu(tr("Show"), this);
|
filter_age_menu_ = new QMenu(tr("Show"), this);
|
||||||
filter_age_menu_->addActions(filter_age_group->actions());
|
filter_age_menu_->addActions(filter_age_group->actions());
|
||||||
|
|
||||||
filter_age_mapper_ = new QSignalMapper(this);
|
filter_age_mapper_ = new QSignalMapper(this);
|
||||||
filter_age_mapper_->setMapping(ui_.filter_age_all, -1);
|
filter_age_mapper_->setMapping(ui_->filter_age_all, -1);
|
||||||
filter_age_mapper_->setMapping(ui_.filter_age_today, 60*60*24);
|
filter_age_mapper_->setMapping(ui_->filter_age_today, 60*60*24);
|
||||||
filter_age_mapper_->setMapping(ui_.filter_age_week, 60*60*24*7);
|
filter_age_mapper_->setMapping(ui_->filter_age_week, 60*60*24*7);
|
||||||
filter_age_mapper_->setMapping(ui_.filter_age_month, 60*60*24*30);
|
filter_age_mapper_->setMapping(ui_->filter_age_month, 60*60*24*30);
|
||||||
filter_age_mapper_->setMapping(ui_.filter_age_three_months, 60*60*24*30*3);
|
filter_age_mapper_->setMapping(ui_->filter_age_three_months, 60*60*24*30*3);
|
||||||
filter_age_mapper_->setMapping(ui_.filter_age_year, 60*60*24*365);
|
filter_age_mapper_->setMapping(ui_->filter_age_year, 60*60*24*365);
|
||||||
|
|
||||||
connect(ui_.filter_age_all, SIGNAL(triggered()), filter_age_mapper_, SLOT(map()));
|
connect(ui_->filter_age_all, SIGNAL(triggered()), filter_age_mapper_, SLOT(map()));
|
||||||
connect(ui_.filter_age_today, SIGNAL(triggered()), filter_age_mapper_, SLOT(map()));
|
connect(ui_->filter_age_today, SIGNAL(triggered()), filter_age_mapper_, SLOT(map()));
|
||||||
connect(ui_.filter_age_week, SIGNAL(triggered()), filter_age_mapper_, SLOT(map()));
|
connect(ui_->filter_age_week, SIGNAL(triggered()), filter_age_mapper_, SLOT(map()));
|
||||||
connect(ui_.filter_age_month, SIGNAL(triggered()), filter_age_mapper_, SLOT(map()));
|
connect(ui_->filter_age_month, SIGNAL(triggered()), filter_age_mapper_, SLOT(map()));
|
||||||
connect(ui_.filter_age_three_months, SIGNAL(triggered()), filter_age_mapper_, SLOT(map()));
|
connect(ui_->filter_age_three_months, SIGNAL(triggered()), filter_age_mapper_, SLOT(map()));
|
||||||
connect(ui_.filter_age_year, SIGNAL(triggered()), filter_age_mapper_, SLOT(map()));
|
connect(ui_->filter_age_year, SIGNAL(triggered()), filter_age_mapper_, SLOT(map()));
|
||||||
connect(ui_.clear, SIGNAL(clicked()), SLOT(ClearFilter()));
|
connect(ui_->clear, SIGNAL(clicked()), SLOT(ClearFilter()));
|
||||||
|
|
||||||
// "Group by ..."
|
// "Group by ..."
|
||||||
ui_.group_by_artist->setProperty("group_by", QVariant::fromValue(
|
ui_->group_by_artist->setProperty("group_by", QVariant::fromValue(
|
||||||
LibraryModel::Grouping(LibraryModel::GroupBy_Artist)));
|
LibraryModel::Grouping(LibraryModel::GroupBy_Artist)));
|
||||||
ui_.group_by_artist_album->setProperty("group_by", QVariant::fromValue(
|
ui_->group_by_artist_album->setProperty("group_by", QVariant::fromValue(
|
||||||
LibraryModel::Grouping(LibraryModel::GroupBy_Artist, LibraryModel::GroupBy_Album)));
|
LibraryModel::Grouping(LibraryModel::GroupBy_Artist, LibraryModel::GroupBy_Album)));
|
||||||
ui_.group_by_artist_yearalbum->setProperty("group_by", QVariant::fromValue(
|
ui_->group_by_artist_yearalbum->setProperty("group_by", QVariant::fromValue(
|
||||||
LibraryModel::Grouping(LibraryModel::GroupBy_Artist, LibraryModel::GroupBy_YearAlbum)));
|
LibraryModel::Grouping(LibraryModel::GroupBy_Artist, LibraryModel::GroupBy_YearAlbum)));
|
||||||
ui_.group_by_album->setProperty("group_by", QVariant::fromValue(
|
ui_->group_by_album->setProperty("group_by", QVariant::fromValue(
|
||||||
LibraryModel::Grouping(LibraryModel::GroupBy_Album)));
|
LibraryModel::Grouping(LibraryModel::GroupBy_Album)));
|
||||||
ui_.group_by_genre_album->setProperty("group_by", QVariant::fromValue(
|
ui_->group_by_genre_album->setProperty("group_by", QVariant::fromValue(
|
||||||
LibraryModel::Grouping(LibraryModel::GroupBy_Genre, LibraryModel::GroupBy_Album)));
|
LibraryModel::Grouping(LibraryModel::GroupBy_Genre, LibraryModel::GroupBy_Album)));
|
||||||
ui_.group_by_genre_artist_album->setProperty("group_by", QVariant::fromValue(
|
ui_->group_by_genre_artist_album->setProperty("group_by", QVariant::fromValue(
|
||||||
LibraryModel::Grouping(LibraryModel::GroupBy_Genre, LibraryModel::GroupBy_Artist, LibraryModel::GroupBy_Album)));
|
LibraryModel::Grouping(LibraryModel::GroupBy_Genre, LibraryModel::GroupBy_Artist, LibraryModel::GroupBy_Album)));
|
||||||
|
|
||||||
group_by_group_ = new QActionGroup(this);
|
group_by_group_ = new QActionGroup(this);
|
||||||
group_by_group_->addAction(ui_.group_by_artist);
|
group_by_group_->addAction(ui_->group_by_artist);
|
||||||
group_by_group_->addAction(ui_.group_by_artist_album);
|
group_by_group_->addAction(ui_->group_by_artist_album);
|
||||||
group_by_group_->addAction(ui_.group_by_artist_yearalbum);
|
group_by_group_->addAction(ui_->group_by_artist_yearalbum);
|
||||||
group_by_group_->addAction(ui_.group_by_album);
|
group_by_group_->addAction(ui_->group_by_album);
|
||||||
group_by_group_->addAction(ui_.group_by_genre_album);
|
group_by_group_->addAction(ui_->group_by_genre_album);
|
||||||
group_by_group_->addAction(ui_.group_by_genre_artist_album);
|
group_by_group_->addAction(ui_->group_by_genre_artist_album);
|
||||||
group_by_group_->addAction(ui_.group_by_advanced);
|
group_by_group_->addAction(ui_->group_by_advanced);
|
||||||
|
|
||||||
group_by_menu_ = new QMenu(tr("Group by"), this);
|
group_by_menu_ = new QMenu(tr("Group by"), this);
|
||||||
group_by_menu_->addActions(group_by_group_->actions());
|
group_by_menu_->addActions(group_by_group_->actions());
|
||||||
|
@ -95,11 +97,12 @@ LibraryFilterWidget::LibraryFilterWidget(QWidget *parent)
|
||||||
library_menu->addSeparator();
|
library_menu->addSeparator();
|
||||||
config_action_ = library_menu->addAction(
|
config_action_ = library_menu->addAction(
|
||||||
tr("Configure library..."), library_config_dialog_.get(), SLOT(show()));
|
tr("Configure library..."), library_config_dialog_.get(), SLOT(show()));
|
||||||
ui_.options->setMenu(library_menu);
|
ui_->options->setMenu(library_menu);
|
||||||
connect(library_config_dialog_.get(), SIGNAL(accepted()), SIGNAL(LibraryConfigChanged()));
|
connect(library_config_dialog_.get(), SIGNAL(accepted()), SIGNAL(LibraryConfigChanged()));
|
||||||
}
|
}
|
||||||
|
|
||||||
LibraryFilterWidget::~LibraryFilterWidget() {
|
LibraryFilterWidget::~LibraryFilterWidget() {
|
||||||
|
delete ui_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LibraryFilterWidget::SetLibraryModel(LibraryModel *model) {
|
void LibraryFilterWidget::SetLibraryModel(LibraryModel *model) {
|
||||||
|
@ -107,7 +110,7 @@ void LibraryFilterWidget::SetLibraryModel(LibraryModel *model) {
|
||||||
disconnect(model_, 0, this, 0);
|
disconnect(model_, 0, this, 0);
|
||||||
disconnect(model_, 0, group_by_dialog_.get(), 0);
|
disconnect(model_, 0, group_by_dialog_.get(), 0);
|
||||||
disconnect(group_by_dialog_.get(), 0, model_, 0);
|
disconnect(group_by_dialog_.get(), 0, model_, 0);
|
||||||
disconnect(ui_.filter, 0, model_, 0);
|
disconnect(ui_->filter, 0, model_, 0);
|
||||||
disconnect(filter_age_mapper_, 0, model_, 0);
|
disconnect(filter_age_mapper_, 0, model_, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,7 +123,7 @@ void LibraryFilterWidget::SetLibraryModel(LibraryModel *model) {
|
||||||
SLOT(GroupingChanged(LibraryModel::Grouping)));
|
SLOT(GroupingChanged(LibraryModel::Grouping)));
|
||||||
connect(group_by_dialog_.get(), SIGNAL(Accepted(LibraryModel::Grouping)),
|
connect(group_by_dialog_.get(), SIGNAL(Accepted(LibraryModel::Grouping)),
|
||||||
model_, SLOT(SetGroupBy(LibraryModel::Grouping)));
|
model_, SLOT(SetGroupBy(LibraryModel::Grouping)));
|
||||||
connect(ui_.filter, SIGNAL(textChanged(QString)), model_, SLOT(SetFilterText(QString)));
|
connect(ui_->filter, SIGNAL(textChanged(QString)), model_, SLOT(SetFilterText(QString)));
|
||||||
connect(filter_age_mapper_, SIGNAL(mapped(int)), model_, SLOT(SetFilterAge(int)));
|
connect(filter_age_mapper_, SIGNAL(mapped(int)), model_, SLOT(SetFilterAge(int)));
|
||||||
|
|
||||||
// Set up the dialogs
|
// Set up the dialogs
|
||||||
|
@ -167,12 +170,12 @@ void LibraryFilterWidget::GroupingChanged(const LibraryModel::Grouping& g) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ui_.group_by_advanced->setChecked(true);
|
ui_->group_by_advanced->setChecked(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LibraryFilterWidget::ClearFilter() {
|
void LibraryFilterWidget::ClearFilter() {
|
||||||
ui_.filter->clear();
|
ui_->filter->clear();
|
||||||
ui_.filter->setFocus();
|
ui_->filter->setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LibraryFilterWidget::ShowConfigDialog() {
|
void LibraryFilterWidget::ShowConfigDialog() {
|
||||||
|
@ -180,7 +183,7 @@ void LibraryFilterWidget::ShowConfigDialog() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void LibraryFilterWidget::SetFilterHint(const QString& hint) {
|
void LibraryFilterWidget::SetFilterHint(const QString& hint) {
|
||||||
ui_.filter->SetHint(hint);
|
ui_->filter->SetHint(hint);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LibraryFilterWidget::SetAgeFilterEnabled(bool enabled) {
|
void LibraryFilterWidget::SetAgeFilterEnabled(bool enabled) {
|
|
@ -21,11 +21,11 @@
|
||||||
|
|
||||||
#include <boost/scoped_ptr.hpp>
|
#include <boost/scoped_ptr.hpp>
|
||||||
|
|
||||||
#include "ui_libraryfilterwidget.h"
|
|
||||||
#include "librarymodel.h"
|
#include "librarymodel.h"
|
||||||
|
|
||||||
class GroupByDialog;
|
class GroupByDialog;
|
||||||
class LibraryConfigDialog;
|
class LibraryConfigDialog;
|
||||||
|
class Ui_LibraryFilterWidget;
|
||||||
|
|
||||||
class QMenu;
|
class QMenu;
|
||||||
class QActionGroup;
|
class QActionGroup;
|
||||||
|
@ -58,7 +58,7 @@ class LibraryFilterWidget : public QWidget {
|
||||||
void ClearFilter();
|
void ClearFilter();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::LibraryFilterWidget ui_;
|
Ui_LibraryFilterWidget* ui_;
|
||||||
LibraryModel* model_;
|
LibraryModel* model_;
|
||||||
|
|
||||||
boost::scoped_ptr<GroupByDialog> group_by_dialog_;
|
boost::scoped_ptr<GroupByDialog> group_by_dialog_;
|
|
@ -23,7 +23,7 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="QToolButton" name="clear">
|
<widget class="QToolButton" name="clear">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="../data/data.qrc">
|
<iconset resource="../../data/data.qrc">
|
||||||
<normaloff>:/clear.png</normaloff>:/clear.png</iconset>
|
<normaloff>:/clear.png</normaloff>:/clear.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize">
|
<property name="iconSize">
|
||||||
|
@ -47,7 +47,7 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="QToolButton" name="options">
|
<widget class="QToolButton" name="options">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="../data/data.qrc">
|
<iconset resource="../../data/data.qrc">
|
||||||
<normaloff>:/configure.png</normaloff>:/configure.png</iconset>
|
<normaloff>:/configure.png</normaloff>:/configure.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize">
|
<property name="iconSize">
|
||||||
|
@ -177,11 +177,11 @@
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>LineEdit</class>
|
<class>LineEdit</class>
|
||||||
<extends>QLineEdit</extends>
|
<extends>QLineEdit</extends>
|
||||||
<header>lineedit.h</header>
|
<header>widgets/lineedit.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../data/data.qrc"/>
|
<include location="../../data/data.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
|
@ -20,8 +20,8 @@
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
|
|
||||||
#include "song.h"
|
#include "core/simpletreeitem.h"
|
||||||
#include "simpletreeitem.h"
|
#include "core/song.h"
|
||||||
|
|
||||||
class LibraryItem : public SimpleTreeItem<LibraryItem> {
|
class LibraryItem : public SimpleTreeItem<LibraryItem> {
|
||||||
public:
|
public:
|
|
@ -17,8 +17,8 @@
|
||||||
#include "librarymodel.h"
|
#include "librarymodel.h"
|
||||||
#include "librarybackend.h"
|
#include "librarybackend.h"
|
||||||
#include "libraryitem.h"
|
#include "libraryitem.h"
|
||||||
#include "songmimedata.h"
|
|
||||||
#include "librarydirectorymodel.h"
|
#include "librarydirectorymodel.h"
|
||||||
|
#include "playlist/songmimedata.h"
|
||||||
|
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
|
@ -20,13 +20,13 @@
|
||||||
#include <QAbstractItemModel>
|
#include <QAbstractItemModel>
|
||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
|
|
||||||
#include "backgroundthread.h"
|
|
||||||
#include "librarywatcher.h"
|
#include "librarywatcher.h"
|
||||||
#include "libraryquery.h"
|
#include "libraryquery.h"
|
||||||
#include "engines/engine_fwd.h"
|
|
||||||
#include "song.h"
|
|
||||||
#include "libraryitem.h"
|
#include "libraryitem.h"
|
||||||
#include "simpletreemodel.h"
|
#include "core/backgroundthread.h"
|
||||||
|
#include "core/simpletreemodel.h"
|
||||||
|
#include "core/song.h"
|
||||||
|
#include "engines/engine_fwd.h"
|
||||||
|
|
||||||
#include <boost/scoped_ptr.hpp>
|
#include <boost/scoped_ptr.hpp>
|
||||||
|
|
|
@ -17,8 +17,8 @@
|
||||||
#ifndef LIBRARYPLAYLISTITEM_H
|
#ifndef LIBRARYPLAYLISTITEM_H
|
||||||
#define LIBRARYPLAYLISTITEM_H
|
#define LIBRARYPLAYLISTITEM_H
|
||||||
|
|
||||||
#include "playlistitem.h"
|
#include "core/song.h"
|
||||||
#include "song.h"
|
#include "playlist/playlistitem.h"
|
||||||
|
|
||||||
class LibraryPlaylistItem : public PlaylistItem {
|
class LibraryPlaylistItem : public PlaylistItem {
|
||||||
public:
|
public:
|
|
@ -15,7 +15,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "libraryquery.h"
|
#include "libraryquery.h"
|
||||||
#include "song.h"
|
#include "core/song.h"
|
||||||
|
|
||||||
#include <QtDebug>
|
#include <QtDebug>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
|
@ -18,7 +18,7 @@
|
||||||
#define LIBRARYWATCHER_H
|
#define LIBRARYWATCHER_H
|
||||||
|
|
||||||
#include "directory.h"
|
#include "directory.h"
|
||||||
#include "song.h"
|
#include "core/song.h"
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
27
src/main.cpp
27
src/main.cpp
|
@ -20,17 +20,18 @@
|
||||||
# include <iostream>
|
# include <iostream>
|
||||||
#endif // Q_OS_WIN32
|
#endif // Q_OS_WIN32
|
||||||
|
|
||||||
#include "directory.h"
|
|
||||||
#include "lastfmservice.h"
|
|
||||||
#include "mainwindow.h"
|
|
||||||
#include "player.h"
|
|
||||||
#include "song.h"
|
|
||||||
#include "equalizer.h"
|
|
||||||
#include "potranslator.h"
|
|
||||||
#include "commandlineoptions.h"
|
|
||||||
#include "engines/enginebase.h"
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "networkaccessmanager.h"
|
#include "core/commandlineoptions.h"
|
||||||
|
#include "core/mac_startup.h"
|
||||||
|
#include "core/networkaccessmanager.h"
|
||||||
|
#include "core/player.h"
|
||||||
|
#include "core/potranslator.h"
|
||||||
|
#include "core/song.h"
|
||||||
|
#include "engines/enginebase.h"
|
||||||
|
#include "library/directory.h"
|
||||||
|
#include "radio/lastfmservice.h"
|
||||||
|
#include "ui/equalizer.h"
|
||||||
|
#include "ui/mainwindow.h"
|
||||||
|
|
||||||
#include <QtSingleApplication>
|
#include <QtSingleApplication>
|
||||||
#include <QtDebug>
|
#include <QtDebug>
|
||||||
|
@ -43,12 +44,10 @@
|
||||||
#ifdef Q_WS_X11
|
#ifdef Q_WS_X11
|
||||||
# include <QDBusConnection>
|
# include <QDBusConnection>
|
||||||
# include <QDBusMetaType>
|
# include <QDBusMetaType>
|
||||||
# include "mpris.h"
|
# include "core/mpris.h"
|
||||||
# include "osd.h"
|
# include "widgets/osd.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "mac_startup.h"
|
|
||||||
|
|
||||||
// Load sqlite plugin on windows and mac.
|
// Load sqlite plugin on windows and mac.
|
||||||
#ifndef Q_WS_X11
|
#ifndef Q_WS_X11
|
||||||
# include <QtPlugin>
|
# include <QtPlugin>
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
cmake_minimum_required(VERSION 2.6)
|
||||||
|
|
||||||
|
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
|
||||||
|
set(SOURCES
|
||||||
|
playlist.cpp
|
||||||
|
playlistbackend.cpp
|
||||||
|
playlistdelegates.cpp
|
||||||
|
playlistheader.cpp
|
||||||
|
playlistitem.cpp
|
||||||
|
playlistsequence.cpp
|
||||||
|
playlistundocommands.cpp
|
||||||
|
playlistview.cpp
|
||||||
|
songplaylistitem.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
set(HEADERS
|
||||||
|
playlist.h
|
||||||
|
playlistbackend.h
|
||||||
|
playlistdelegates.h
|
||||||
|
playlistheader.h
|
||||||
|
playlistsequence.h
|
||||||
|
playlistview.h
|
||||||
|
songmimedata.h
|
||||||
|
)
|
||||||
|
|
||||||
|
set(UI
|
||||||
|
playlistsequence.ui
|
||||||
|
)
|
||||||
|
|
||||||
|
qt4_wrap_cpp(MOC ${HEADERS})
|
||||||
|
qt4_wrap_ui(UIC ${UI})
|
||||||
|
|
||||||
|
add_library(clementine_playlist
|
||||||
|
${SOURCES}
|
||||||
|
${MOC}
|
||||||
|
${UIC}
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(clementine_playlist
|
||||||
|
clementine_core
|
||||||
|
clementine_library
|
||||||
|
clementine_radio
|
||||||
|
)
|
||||||
|
|
||||||
|
add_translation_source(playlist ${SOURCES} ${MOC} ${UIC})
|
|
@ -17,17 +17,17 @@
|
||||||
#include "playlist.h"
|
#include "playlist.h"
|
||||||
#include "songmimedata.h"
|
#include "songmimedata.h"
|
||||||
#include "songplaylistitem.h"
|
#include "songplaylistitem.h"
|
||||||
#include "radiomimedata.h"
|
|
||||||
#include "radioplaylistitem.h"
|
|
||||||
#include "radiomodel.h"
|
|
||||||
#include "savedradio.h"
|
|
||||||
#include "playlistbackend.h"
|
#include "playlistbackend.h"
|
||||||
#include "libraryplaylistitem.h"
|
|
||||||
#include "playlistundocommands.h"
|
#include "playlistundocommands.h"
|
||||||
#include "library.h"
|
#include "library/library.h"
|
||||||
#include "librarybackend.h"
|
#include "library/librarybackend.h"
|
||||||
#include "magnatuneservice.h"
|
#include "library/libraryplaylistitem.h"
|
||||||
#include "magnatuneplaylistitem.h"
|
#include "radio/magnatuneservice.h"
|
||||||
|
#include "radio/magnatuneplaylistitem.h"
|
||||||
|
#include "radio/radiomimedata.h"
|
||||||
|
#include "radio/radiomodel.h"
|
||||||
|
#include "radio/radioplaylistitem.h"
|
||||||
|
#include "radio/savedradio.h"
|
||||||
|
|
||||||
#include <QtDebug>
|
#include <QtDebug>
|
||||||
#include <QMimeData>
|
#include <QMimeData>
|
|
@ -23,10 +23,10 @@
|
||||||
#include <boost/shared_ptr.hpp>
|
#include <boost/shared_ptr.hpp>
|
||||||
|
|
||||||
#include "playlistitem.h"
|
#include "playlistitem.h"
|
||||||
#include "song.h"
|
|
||||||
#include "radioitem.h"
|
|
||||||
#include "playlistsequence.h"
|
#include "playlistsequence.h"
|
||||||
#include "settingsprovider.h"
|
#include "core/settingsprovider.h"
|
||||||
|
#include "core/song.h"
|
||||||
|
#include "radio/radioitem.h"
|
||||||
|
|
||||||
class RadioService;
|
class RadioService;
|
||||||
class PlaylistBackend;
|
class PlaylistBackend;
|
|
@ -15,9 +15,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "playlistbackend.h"
|
#include "playlistbackend.h"
|
||||||
#include "database.h"
|
#include "core/database.h"
|
||||||
#include "scopedtransaction.h"
|
#include "core/scopedtransaction.h"
|
||||||
#include "song.h"
|
#include "core/song.h"
|
||||||
|
|
||||||
#include <QtDebug>
|
#include <QtDebug>
|
||||||
#include <QSqlQuery>
|
#include <QSqlQuery>
|
|
@ -15,8 +15,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "playlistdelegates.h"
|
#include "playlistdelegates.h"
|
||||||
#include "trackslider.h"
|
#include "core/utilities.h"
|
||||||
#include "librarybackend.h"
|
#include "library/librarybackend.h"
|
||||||
|
#include "widgets/trackslider.h"
|
||||||
|
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
|
@ -24,6 +25,7 @@
|
||||||
#include <QToolTip>
|
#include <QToolTip>
|
||||||
#include <QWhatsThis>
|
#include <QWhatsThis>
|
||||||
#include <QHelpEvent>
|
#include <QHelpEvent>
|
||||||
|
#include <QHeaderView>
|
||||||
|
|
||||||
const int PlaylistDelegateBase::kMinHeight = 19;
|
const int PlaylistDelegateBase::kMinHeight = 19;
|
||||||
|
|
||||||
|
@ -145,7 +147,7 @@ QString LengthItemDelegate::displayText(const QVariant& value, const QLocale&) c
|
||||||
int seconds = value.toInt(&ok);
|
int seconds = value.toInt(&ok);
|
||||||
|
|
||||||
if (ok && seconds > 0)
|
if (ok && seconds > 0)
|
||||||
return TrackSlider::PrettyTime(seconds);
|
return Utilities::PrettyTime(seconds);
|
||||||
return QString::null;
|
return QString::null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#define PLAYLISTDELEGATES_H
|
#define PLAYLISTDELEGATES_H
|
||||||
|
|
||||||
#include "playlist.h"
|
#include "playlist.h"
|
||||||
#include "library.h"
|
#include "library/library.h"
|
||||||
|
|
||||||
#include <QStyledItemDelegate>
|
#include <QStyledItemDelegate>
|
||||||
#include <QTreeView>
|
#include <QTreeView>
|
|
@ -16,9 +16,9 @@
|
||||||
|
|
||||||
#include "playlistitem.h"
|
#include "playlistitem.h"
|
||||||
#include "songplaylistitem.h"
|
#include "songplaylistitem.h"
|
||||||
#include "radioplaylistitem.h"
|
#include "library/libraryplaylistitem.h"
|
||||||
#include "libraryplaylistitem.h"
|
#include "radio/magnatuneplaylistitem.h"
|
||||||
#include "magnatuneplaylistitem.h"
|
#include "radio/radioplaylistitem.h"
|
||||||
|
|
||||||
#include <QtDebug>
|
#include <QtDebug>
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "playlistsequence.h"
|
#include "playlistsequence.h"
|
||||||
|
#include "ui_playlistsequence.h"
|
||||||
|
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QActionGroup>
|
#include <QActionGroup>
|
||||||
|
@ -25,6 +26,7 @@ const char* PlaylistSequence::kSettingsGroup = "PlaylistSequence";
|
||||||
|
|
||||||
PlaylistSequence::PlaylistSequence(QWidget *parent, SettingsProvider *settings)
|
PlaylistSequence::PlaylistSequence(QWidget *parent, SettingsProvider *settings)
|
||||||
: QWidget(parent),
|
: QWidget(parent),
|
||||||
|
ui_(new Ui_PlaylistSequence),
|
||||||
settings_(settings ? settings : new DefaultSettingsProvider),
|
settings_(settings ? settings : new DefaultSettingsProvider),
|
||||||
repeat_menu_(new QMenu(this)),
|
repeat_menu_(new QMenu(this)),
|
||||||
shuffle_menu_(new QMenu(this)),
|
shuffle_menu_(new QMenu(this)),
|
||||||
|
@ -32,24 +34,24 @@ PlaylistSequence::PlaylistSequence(QWidget *parent, SettingsProvider *settings)
|
||||||
repeat_mode_(Repeat_Off),
|
repeat_mode_(Repeat_Off),
|
||||||
shuffle_mode_(Shuffle_Off)
|
shuffle_mode_(Shuffle_Off)
|
||||||
{
|
{
|
||||||
ui_.setupUi(this);
|
ui_->setupUi(this);
|
||||||
|
|
||||||
settings_->set_group(kSettingsGroup);
|
settings_->set_group(kSettingsGroup);
|
||||||
|
|
||||||
QActionGroup* repeat_group = new QActionGroup(this);
|
QActionGroup* repeat_group = new QActionGroup(this);
|
||||||
repeat_group->addAction(ui_.action_repeat_off);
|
repeat_group->addAction(ui_->action_repeat_off);
|
||||||
repeat_group->addAction(ui_.action_repeat_track);
|
repeat_group->addAction(ui_->action_repeat_track);
|
||||||
repeat_group->addAction(ui_.action_repeat_album);
|
repeat_group->addAction(ui_->action_repeat_album);
|
||||||
repeat_group->addAction(ui_.action_repeat_playlist);
|
repeat_group->addAction(ui_->action_repeat_playlist);
|
||||||
repeat_menu_->addActions(repeat_group->actions());
|
repeat_menu_->addActions(repeat_group->actions());
|
||||||
ui_.repeat->setMenu(repeat_menu_);
|
ui_->repeat->setMenu(repeat_menu_);
|
||||||
|
|
||||||
QActionGroup* shuffle_group = new QActionGroup(this);
|
QActionGroup* shuffle_group = new QActionGroup(this);
|
||||||
shuffle_group->addAction(ui_.action_shuffle_off);
|
shuffle_group->addAction(ui_->action_shuffle_off);
|
||||||
shuffle_group->addAction(ui_.action_shuffle_all);
|
shuffle_group->addAction(ui_->action_shuffle_all);
|
||||||
shuffle_group->addAction(ui_.action_shuffle_album);
|
shuffle_group->addAction(ui_->action_shuffle_album);
|
||||||
shuffle_menu_->addActions(shuffle_group->actions());
|
shuffle_menu_->addActions(shuffle_group->actions());
|
||||||
ui_.shuffle->setMenu(shuffle_menu_);
|
ui_->shuffle->setMenu(shuffle_menu_);
|
||||||
|
|
||||||
connect(repeat_group, SIGNAL(triggered(QAction*)), SLOT(RepeatActionTriggered(QAction*)));
|
connect(repeat_group, SIGNAL(triggered(QAction*)), SLOT(RepeatActionTriggered(QAction*)));
|
||||||
connect(shuffle_group, SIGNAL(triggered(QAction*)), SLOT(ShuffleActionTriggered(QAction*)));
|
connect(shuffle_group, SIGNAL(triggered(QAction*)), SLOT(ShuffleActionTriggered(QAction*)));
|
||||||
|
@ -57,6 +59,10 @@ PlaylistSequence::PlaylistSequence(QWidget *parent, SettingsProvider *settings)
|
||||||
Load();
|
Load();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PlaylistSequence::~PlaylistSequence() {
|
||||||
|
delete ui_;
|
||||||
|
}
|
||||||
|
|
||||||
void PlaylistSequence::Load() {
|
void PlaylistSequence::Load() {
|
||||||
loading_ = true; // Stops these setter functions calling Save()
|
loading_ = true; // Stops these setter functions calling Save()
|
||||||
SetShuffleMode(ShuffleMode(settings_->value("shuffle_mode", Shuffle_Off).toInt()));
|
SetShuffleMode(ShuffleMode(settings_->value("shuffle_mode", Shuffle_Off).toInt()));
|
||||||
|
@ -73,29 +79,29 @@ void PlaylistSequence::Save() {
|
||||||
|
|
||||||
void PlaylistSequence::RepeatActionTriggered(QAction* action) {
|
void PlaylistSequence::RepeatActionTriggered(QAction* action) {
|
||||||
RepeatMode mode = Repeat_Off;
|
RepeatMode mode = Repeat_Off;
|
||||||
if (action == ui_.action_repeat_track) mode = Repeat_Track;
|
if (action == ui_->action_repeat_track) mode = Repeat_Track;
|
||||||
if (action == ui_.action_repeat_album) mode = Repeat_Album;
|
if (action == ui_->action_repeat_album) mode = Repeat_Album;
|
||||||
if (action == ui_.action_repeat_playlist) mode = Repeat_Playlist;
|
if (action == ui_->action_repeat_playlist) mode = Repeat_Playlist;
|
||||||
|
|
||||||
SetRepeatMode(mode);
|
SetRepeatMode(mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlaylistSequence::ShuffleActionTriggered(QAction* action) {
|
void PlaylistSequence::ShuffleActionTriggered(QAction* action) {
|
||||||
ShuffleMode mode = Shuffle_Off;
|
ShuffleMode mode = Shuffle_Off;
|
||||||
if (action == ui_.action_shuffle_all) mode = Shuffle_All;
|
if (action == ui_->action_shuffle_all) mode = Shuffle_All;
|
||||||
if (action == ui_.action_shuffle_album) mode = Shuffle_Album;
|
if (action == ui_->action_shuffle_album) mode = Shuffle_Album;
|
||||||
|
|
||||||
SetShuffleMode(mode);
|
SetShuffleMode(mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlaylistSequence::SetRepeatMode(RepeatMode mode) {
|
void PlaylistSequence::SetRepeatMode(RepeatMode mode) {
|
||||||
ui_.repeat->setChecked(mode != Repeat_Off);
|
ui_->repeat->setChecked(mode != Repeat_Off);
|
||||||
|
|
||||||
switch(mode) {
|
switch(mode) {
|
||||||
case Repeat_Off: ui_.action_repeat_off->setChecked(true); break;
|
case Repeat_Off: ui_->action_repeat_off->setChecked(true); break;
|
||||||
case Repeat_Track: ui_.action_repeat_track->setChecked(true); break;
|
case Repeat_Track: ui_->action_repeat_track->setChecked(true); break;
|
||||||
case Repeat_Album: ui_.action_repeat_album->setChecked(true); break;
|
case Repeat_Album: ui_->action_repeat_album->setChecked(true); break;
|
||||||
case Repeat_Playlist: ui_.action_repeat_playlist->setChecked(true); break;
|
case Repeat_Playlist: ui_->action_repeat_playlist->setChecked(true); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode != repeat_mode_)
|
if (mode != repeat_mode_)
|
||||||
|
@ -105,12 +111,12 @@ void PlaylistSequence::SetRepeatMode(RepeatMode mode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlaylistSequence::SetShuffleMode(ShuffleMode mode) {
|
void PlaylistSequence::SetShuffleMode(ShuffleMode mode) {
|
||||||
ui_.shuffle->setChecked(mode != Shuffle_Off);
|
ui_->shuffle->setChecked(mode != Shuffle_Off);
|
||||||
|
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case Shuffle_Off: ui_.action_shuffle_off->setChecked(true); break;
|
case Shuffle_Off: ui_->action_shuffle_off->setChecked(true); break;
|
||||||
case Shuffle_All: ui_.action_shuffle_all->setChecked(true); break;
|
case Shuffle_All: ui_->action_shuffle_all->setChecked(true); break;
|
||||||
case Shuffle_Album: ui_.action_shuffle_album->setChecked(true); break;
|
case Shuffle_Album: ui_->action_shuffle_album->setChecked(true); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode != shuffle_mode_)
|
if (mode != shuffle_mode_)
|
|
@ -19,18 +19,20 @@
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
#include "ui_playlistsequence.h"
|
#include "core/settingsprovider.h"
|
||||||
#include "settingsprovider.h"
|
|
||||||
|
|
||||||
#include <boost/scoped_ptr.hpp>
|
#include <boost/scoped_ptr.hpp>
|
||||||
|
|
||||||
class QMenu;
|
class QMenu;
|
||||||
|
|
||||||
|
class Ui_PlaylistSequence;
|
||||||
|
|
||||||
class PlaylistSequence : public QWidget {
|
class PlaylistSequence : public QWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PlaylistSequence(QWidget *parent = 0, SettingsProvider* settings = 0);
|
PlaylistSequence(QWidget *parent = 0, SettingsProvider* settings = 0);
|
||||||
|
~PlaylistSequence();
|
||||||
|
|
||||||
enum RepeatMode {
|
enum RepeatMode {
|
||||||
Repeat_Off = 0,
|
Repeat_Off = 0,
|
||||||
|
@ -69,7 +71,7 @@ class PlaylistSequence : public QWidget {
|
||||||
void Save();
|
void Save();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::PlaylistSequence ui_;
|
Ui_PlaylistSequence* ui_;
|
||||||
boost::scoped_ptr<SettingsProvider> settings_;
|
boost::scoped_ptr<SettingsProvider> settings_;
|
||||||
|
|
||||||
QMenu* repeat_menu_;
|
QMenu* repeat_menu_;
|
|
@ -26,6 +26,7 @@
|
||||||
#include <QtDebug>
|
#include <QtDebug>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
|
#include <QApplication>
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue