diff options
author | samelian <samelian@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-05-02 23:06:07 +0000 |
---|---|---|
committer | samelian <samelian@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-05-02 23:06:07 +0000 |
commit | 75c0180e447ff3602e2340c6bf043835838c7997 (patch) | |
tree | 03d24dd04c376d76177924d738e4405b63b29393 | |
parent | 844e4d4e9175ce1dc2d2c4c0bd39ca67e02d6a64 (diff) | |
download | amarok-75c0180e447ff3602e2340c6bf043835838c7997.tar.gz amarok-75c0180e447ff3602e2340c6bf043835838c7997.zip |
[amarok] all media devices ported to cmake
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/amarok@1230244 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
26 files changed, 568 insertions, 54 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 8feed576..e214d289 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,6 +22,7 @@ project( amarok ) include( CheckCXXSourceCompiles ) include( CheckFunctionExists ) include( CheckIncludeFileCXX ) +include( CheckLibraryExists ) include( CheckStructHasMember ) include( CheckSymbolExists ) include( CheckTypeSize ) @@ -45,7 +46,12 @@ tde_setup_paths( ) option( WITH_LIBVISUAL "Enable libvisual support" OFF ) option( WITH_KONQSIDEBAR "Enable konqsidebar plugin" OFF ) option( WITH_XINE "Enable xine-engine support" OFF ) -option( WITH_LIBGPOD "Enable iPod support from libgpod" OFF ) +option( WITH_IPOD "Enable iPod support from libgpod" OFF ) +option( WITH_IFP "Enable ifp support" OFF ) +option( WITH_NJB "Enable njb support" OFF ) +option( WITH_MTP "Enable mtp support" OFF ) +option( WITH_RIOKARMA "Enable riokarma support" OFF ) +option( WITH_DAAP "Enable daap support" OFF ) ##### user requested modules #################### diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake index 5c71a919..0e143112 100644 --- a/ConfigureChecks.cmake +++ b/ConfigureChecks.cmake @@ -112,32 +112,32 @@ if( WITH_XINE ) tde_message_fatal( "your xine version is too old; at least 1.0.2 is required" ) endif( ) else( ) - tde_message_fatal( "xine are requested, but not found on your system" ) + tde_message_fatal( "xine is requested, but was not found on your system" ) endif( ) endif( ) # iPod -if( WITH_LIBGPOD ) +if( WITH_IPOD ) -# tde_message_fatal( "iPod support is outdated, cannot be compiled against newer libgpod" ) - - pkg_search_module( LIBGPOD libgpod-1.0 ) - if( LIBGPOD_FOUND ) - if( ${LIBGPOD_VERSION} VERSION_LESS "0.4.2" ) + pkg_search_module( GPOD libgpod-1.0 ) + if( GPOD_FOUND ) + if( ${GPOD_VERSION} VERSION_LESS "0.4.2" ) tde_message_fatal( "your libgpod version is too old; at least 0.4.2 is required" ) - elseif( NOT ${LIBGPOD_VERSION} VERSION_LESS "0.6.0" ) - set( HAVE_LIBGPOD_060 1 ) + elseif( NOT ${GPOD_VERSION} VERSION_LESS "0.6.0" ) + set( HAVE_GPOD_060 1 ) endif( ) else( ) - tde_message_fatal( "libgpod-1.0 are requested, but not found on your system" ) + tde_message_fatal( "libgpod-1.0 is requested, but was not found on your system" ) endif( ) tde_save( CMAKE_REQUIRED_INCLUDES ) - set( CMAKE_REQUIRED_INCLUDES ${LIBGPOD_INCLUDE_DIRS} ) + set( CMAKE_REQUIRED_INCLUDES ${GPOD_INCLUDE_DIRS} ) check_struct_has_member( "struct _Itdb_Track" mediatype "gpod/itdb.h" HAVE_ITDB_MEDIATYPE ) tde_restore( CMAKE_REQUIRED_INCLUDES ) + set( GPOD_LIBRARY gpod ) + endif( ) @@ -159,7 +159,7 @@ tde_restore( CMAKE_REQUIRED_INCLUDES CMAKE_REQUIRED_LIBRARIES ) # konqsidebarplugin.h if( WITH_KONQSIDEBAR ) - tde_save( CMAKE_REQUIRED_DEFINITIONS CMAKE_REQUIRED_INCLUDES CMAKE_REQUIRED_LIBRARIES CMAKE_REQUIRED_LIBRARIES ) + tde_save( CMAKE_REQUIRED_DEFINITIONS CMAKE_REQUIRED_FLAGS CMAKE_REQUIRED_INCLUDES CMAKE_REQUIRED_LIBRARIES ) set( CMAKE_REQUIRED_DEFINITIONS ${TQT_CFLAGS_OTHER} ) set( CMAKE_REQUIRED_INCLUDES ${TDE_INCLUDE_DIR};${TQT_INCLUDE_DIRS};${CMAKE_INCLUDE_PATH} ) set( CMAKE_REQUIRED_FLAGS "-include tqt.h" ) @@ -168,7 +168,7 @@ if( WITH_KONQSIDEBAR ) #include <konqsidebarplugin.h> int main(int, char**) { return 0; } " HAVE_KONQSIDEBARPLUGIN_H ) - tde_restore( CMAKE_REQUIRED_DEFINITIONS CMAKE_REQUIRED_INCLUDES CMAKE_REQUIRED_LIBRARIES CMAKE_REQUIRED_LIBRARIES ) + tde_restore( CMAKE_REQUIRED_DEFINITIONS CMAKE_REQUIRED_FLAGS CMAKE_REQUIRED_INCLUDES CMAKE_REQUIRED_LIBRARIES ) if( NOT HAVE_KONQSIDEBARPLUGIN_H ) tde_message_fatal( "konqsidebarplugin.h are requested, but not found on your system" ) endif( ) diff --git a/amarok/src/mediadevice/CMakeLists.txt b/amarok/src/mediadevice/CMakeLists.txt index 6f90b616..7c0d2117 100644 --- a/amarok/src/mediadevice/CMakeLists.txt +++ b/amarok/src/mediadevice/CMakeLists.txt @@ -9,12 +9,10 @@ # ################################################# -# FIXME optional devices are not ported yet - add_subdirectory( generic ) -tde_conditional_add_subdirectory( WITH_LIBGPOD ipod ) +tde_conditional_add_subdirectory( WITH_IPOD ipod ) tde_conditional_add_subdirectory( WITH_IFP ifp ) -tde_conditional_add_subdirectory( WITH_LIBNJB njb ) -tde_conditional_add_subdirectory( WITH_LIBMTP mtp ) -tde_conditional_add_subdirectory( WITH_LIBKARMA riokarma ) +tde_conditional_add_subdirectory( WITH_NJB njb ) +tde_conditional_add_subdirectory( WITH_MTP mtp ) +tde_conditional_add_subdirectory( WITH_RIOKARMA riokarma ) tde_conditional_add_subdirectory( WITH_DAAP daap ) diff --git a/amarok/src/mediadevice/daap/CMakeLists.txt b/amarok/src/mediadevice/daap/CMakeLists.txt new file mode 100644 index 00000000..d3d510ff --- /dev/null +++ b/amarok/src/mediadevice/daap/CMakeLists.txt @@ -0,0 +1,57 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +include( ConfigureChecks.cmake ) + +add_subdirectory( daapreader ) +add_subdirectory( mongrel ) + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_BINARY_DIR} + ${CMAKE_BINARY_DIR}/amarok/src + ${CMAKE_BINARY_DIR}/amarok/src/amarokcore + ${CMAKE_SOURCE_DIR}/amarok/src + ${CMAKE_SOURCE_DIR}/amarok/src/amarokcore + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + + +##### other data ################################ + +install( FILES + amarok_daap-mediadevice.desktop + DESTINATION ${SERVICES_INSTALL_DIR} ) + +install( PROGRAMS + amarok_daapserver.rb + DESTINATION ${BIN_INSTALL_DIR} ) + +install( FILES + codes.rb + DESTINATION ${DATA_INSTALL_DIR}/amarok/ruby_lib ) + + +##### libamarok_daap-mediadevice (module) ####### + +tde_add_kpart( libamarok_daap-mediadevice AUTOMOC + SOURCES + addhostbase.ui daapclient.cpp daapserver.cpp proxy.cpp + LINK daapreader-static amarok-shared kdnssd-shared + DESTINATION ${PLUGIN_INSTALL_DIR} + DEPENDENCIES amarokcore-static +) diff --git a/amarok/src/mediadevice/daap/ConfigureChecks.cmake b/amarok/src/mediadevice/daap/ConfigureChecks.cmake new file mode 100644 index 00000000..0cc9bdb4 --- /dev/null +++ b/amarok/src/mediadevice/daap/ConfigureChecks.cmake @@ -0,0 +1,39 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +find_program( RUBY_EXECUTABLE "ruby" ) +if( NOT RUBY_EXECUTABLE ) + tde_message_fatal( "ruby is required, but was not found on your system" ) +endif( ) + +execute_process( + COMMAND ${RUBY_EXECUTABLE} -rrbconfig -e "puts Config.expand( Config::MAKEFILE_CONFIG['archdir'] )" + OUTPUT_VARIABLE RUBY_INCLUDE_DIR + RESULT_VARIABLE _result + OUTPUT_STRIP_TRAILING_WHITESPACE ) +if( _result ) + tde_message_fatal( "Unable to run ${RUBY_EXECUTABLE}!\n RUBY is correctly installed?" ) +endif( ) + +execute_process( + COMMAND ${RUBY_EXECUTABLE} -rrbconfig -e "puts Config.expand( Config::MAKEFILE_CONFIG['LIBRUBYARG_SHARED'] )" + OUTPUT_VARIABLE RUBY_LDFLAGS + RESULT_VARIABLE _result + OUTPUT_STRIP_TRAILING_WHITESPACE ) +if( _result ) + tde_message_fatal( "Unable to run ${RUBY_EXECUTABLE}!\n RUBY is correctly installed?" ) +endif( ) + +if( RUBY_INCLUDE_DIR AND RUBY_LDFLAGS ) + message( STATUS "Found RUBY: ${RUBY_EXECUTABLE}" ) + message( STATUS " RUBY_INCLUDE_DIR: ${RUBY_INCLUDE_DIR}" ) + message( STATUS " RUBY_LDFLAGS: ${RUBY_LDFLAGS}" ) +endif( ) diff --git a/amarok/src/mediadevice/daap/daapreader/CMakeLists.txt b/amarok/src/mediadevice/daap/daapreader/CMakeLists.txt new file mode 100644 index 00000000..e948db14 --- /dev/null +++ b/amarok/src/mediadevice/daap/daapreader/CMakeLists.txt @@ -0,0 +1,28 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +add_subdirectory( authentication ) + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/amarok/src + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} +) + + +##### daapreader (static) ####################### + +tde_add_library( daapreader STATIC_PIC AUTOMOC + SOURCES reader.cpp + LINK authentication-static +) diff --git a/amarok/src/mediadevice/daap/daapreader/authentication/CMakeLists.txt b/amarok/src/mediadevice/daap/daapreader/authentication/CMakeLists.txt new file mode 100644 index 00000000..805c5a5f --- /dev/null +++ b/amarok/src/mediadevice/daap/daapreader/authentication/CMakeLists.txt @@ -0,0 +1,26 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/amarok/src + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} +) + + +##### authentication (static) ################### + +tde_add_library( authentication STATIC_PIC AUTOMOC + SOURCES + contentfetcher.cpp md5.c hasher.c +) diff --git a/amarok/src/mediadevice/daap/mongrel/CMakeLists.txt b/amarok/src/mediadevice/daap/mongrel/CMakeLists.txt new file mode 100644 index 00000000..48f2a65f --- /dev/null +++ b/amarok/src/mediadevice/daap/mongrel/CMakeLists.txt @@ -0,0 +1,13 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +add_subdirectory( http11 ) +add_subdirectory( lib ) diff --git a/amarok/src/mediadevice/daap/mongrel/http11/CMakeLists.txt b/amarok/src/mediadevice/daap/mongrel/http11/CMakeLists.txt new file mode 100644 index 00000000..7ef27eca --- /dev/null +++ b/amarok/src/mediadevice/daap/mongrel/http11/CMakeLists.txt @@ -0,0 +1,36 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +add_definitions( + -Dinline=__inline__ + -Dasm=__asm__ +) + +include_directories( + ${RUBY_INCLUDE_DIR} +) + +##### other data ################################ + +install( FILES + http11.rb + DESTINATION ${LIB_INSTALL_DIR}/ruby_lib ) + + +##### http11 (shared) ########################### + +tde_add_library( http11 SHARED + SOURCES + http11.c http11_parser.c tst_cleanup.c tst_delete.c + tst_grow_node_free_list.c tst_init.c tst_insert.c tst_search.c + LINK ${RUBY_LDFLAGS} + DESTINATION ${LIB_INSTALL_DIR}/ruby_lib +) diff --git a/amarok/src/mediadevice/daap/mongrel/http11/http11.c b/amarok/src/mediadevice/daap/mongrel/http11/http11.c index 3b2ea6c9..74742f3c 100644 --- a/amarok/src/mediadevice/daap/mongrel/http11/http11.c +++ b/amarok/src/mediadevice/daap/mongrel/http11/http11.c @@ -250,7 +250,7 @@ VALUE HttpParser_finish(VALUE self) DATA_GET(self, http_parser, http); http_parser_finish(http); - return http_parser_is_finished(http) ? TQtrue : Qfalse; + return http_parser_is_finished(http) ? Qtrue : Qfalse; } @@ -313,7 +313,7 @@ VALUE HttpParser_has_error(VALUE self) http_parser *http = NULL; DATA_GET(self, http_parser, http); - return http_parser_has_error(http) ? TQtrue : Qfalse; + return http_parser_has_error(http) ? Qtrue : Qfalse; } @@ -328,7 +328,7 @@ VALUE HttpParser_is_finished(VALUE self) http_parser *http = NULL; DATA_GET(self, http_parser, http); - return http_parser_is_finished(http) ? TQtrue : Qfalse; + return http_parser_is_finished(http) ? Qtrue : Qfalse; } diff --git a/amarok/src/mediadevice/daap/mongrel/lib/CMakeLists.txt b/amarok/src/mediadevice/daap/mongrel/lib/CMakeLists.txt new file mode 100644 index 00000000..afd12d56 --- /dev/null +++ b/amarok/src/mediadevice/daap/mongrel/lib/CMakeLists.txt @@ -0,0 +1,18 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +add_subdirectory( mongrel ) +add_subdirectory( rubygems ) +add_subdirectory( rbconfig ) + +install( FILES + gem_plugin.rb gemconfigure.rb mongrel.rb rubygems.rb + DESTINATION ${DATA_INSTALL_DIR}/amarok/ruby_lib ) diff --git a/amarok/src/mediadevice/daap/mongrel/lib/mongrel/CMakeLists.txt b/amarok/src/mediadevice/daap/mongrel/lib/mongrel/CMakeLists.txt new file mode 100644 index 00000000..8882cb88 --- /dev/null +++ b/amarok/src/mediadevice/daap/mongrel/lib/mongrel/CMakeLists.txt @@ -0,0 +1,15 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +install( FILES + cgi.rb command.rb configurator.rb debug.rb handlers.rb init.rb + mime_types.yml stats.rb tcphack.rb + DESTINATION ${DATA_INSTALL_DIR}/amarok/ruby_lib/mongrel ) diff --git a/amarok/src/mediadevice/daap/mongrel/lib/rbconfig/CMakeLists.txt b/amarok/src/mediadevice/daap/mongrel/lib/rbconfig/CMakeLists.txt new file mode 100644 index 00000000..a7effc31 --- /dev/null +++ b/amarok/src/mediadevice/daap/mongrel/lib/rbconfig/CMakeLists.txt @@ -0,0 +1,14 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +install( FILES + datadir.rb + DESTINATION ${DATA_INSTALL_DIR}/amarok/ruby_lib/rbconfig ) diff --git a/amarok/src/mediadevice/daap/mongrel/lib/rubygems/CMakeLists.txt b/amarok/src/mediadevice/daap/mongrel/lib/rubygems/CMakeLists.txt new file mode 100644 index 00000000..f31bcf49 --- /dev/null +++ b/amarok/src/mediadevice/daap/mongrel/lib/rubygems/CMakeLists.txt @@ -0,0 +1,19 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +install( FILES + ._gem_commands.rb builder.rb cmd_manager.rb command.rb config_file.rb + custom_require.rb dependency_list.rb doc_manager.rb format.rb + gem_commands.rb gem_openssl.rb gem_runner.rb incremental_fetcher.rb + installer.rb loadpath_manager.rb old_format.rb open-uri.rb package.rb + remote_installer.rb rubygems_version.rb security.rb source_index.rb + specification.rb timer.rb user_interaction.rb validator.rb version.rb + DESTINATION ${DATA_INSTALL_DIR}/amarok/ruby_lib/rubygems ) diff --git a/amarok/src/mediadevice/ifp/CMakeLists.txt b/amarok/src/mediadevice/ifp/CMakeLists.txt new file mode 100644 index 00000000..6e24a602 --- /dev/null +++ b/amarok/src/mediadevice/ifp/CMakeLists.txt @@ -0,0 +1,40 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +include( ConfigureChecks.cmake ) + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/amarok/src + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + + +##### other data ################################ + +install( FILES + amarok_ifp-mediadevice.desktop + DESTINATION ${SERVICES_INSTALL_DIR} ) + + +##### libamarok_ifp-mediadevice (module) ######## + +tde_add_kpart( libamarok_ifp-mediadevice AUTOMOC + SOURCES ifpmediadevice.cpp + LINK amarok-shared kio-shared ${IFP_LIBRARY} ${USB_LIBRARIES} + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/amarok/src/mediadevice/ifp/ConfigureChecks.cmake b/amarok/src/mediadevice/ifp/ConfigureChecks.cmake new file mode 100644 index 00000000..e9c7bc83 --- /dev/null +++ b/amarok/src/mediadevice/ifp/ConfigureChecks.cmake @@ -0,0 +1,28 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +# libifp +check_include_file( ifp.h HAVE_IFP_H ) +if( HAVE_IFP_H ) + check_library_exists( ifp ifp_init "" HAVE_IFP ) +endif( ) +if( HAVE_IFP_H AND HAVE_IFP ) + set( IFP_LIBRARY ifp ) +else( ) + tde_message_fatal( "libifp is required, but was not found on your system" ) +endif( ) + + +# libusb +pkg_search_module( USB libusb ) +if( NOT USB_FOUND ) + tde_message_fatal( "libusb is required, but was not found on your system" ) +endif( ) diff --git a/amarok/src/mediadevice/ipod/CMakeLists.txt b/amarok/src/mediadevice/ipod/CMakeLists.txt index 4e672447..b07e5ddd 100644 --- a/amarok/src/mediadevice/ipod/CMakeLists.txt +++ b/amarok/src/mediadevice/ipod/CMakeLists.txt @@ -11,16 +11,14 @@ include_directories( ${CMAKE_CURRENT_BINARY_DIR} - #${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/amarok/src ${CMAKE_SOURCE_DIR}/amarok/src ${CMAKE_SOURCE_DIR}/amarok/src/amarokcore ${CMAKE_BINARY_DIR}/amarok/src/amarokcore - #${CMAKE_SOURCE_DIR} ${TDE_INCLUDE_DIR} ${TQT_INCLUDE_DIRS} - ${LIBGPOD_INCLUDE_DIRS} + ${GPOD_INCLUDE_DIRS} ) link_directories( @@ -39,6 +37,6 @@ install( FILES tde_add_kpart( libamarok_ipod-mediadevice AUTOMOC SOURCES ipodmediadevice.cpp - LINK amarok-shared glib-2.0 gpod + LINK amarok-shared glib-2.0 ${GPOD_LIBRARY} DESTINATION ${PLUGIN_INSTALL_DIR} ) diff --git a/amarok/src/mediadevice/mtp/CMakeLists.txt b/amarok/src/mediadevice/mtp/CMakeLists.txt new file mode 100644 index 00000000..e93e5c58 --- /dev/null +++ b/amarok/src/mediadevice/mtp/CMakeLists.txt @@ -0,0 +1,40 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +include( ConfigureChecks.cmake ) + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/amarok/src + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + + +##### other data ################################ + +install( FILES + amarok_mtp-mediadevice.desktop + DESTINATION ${SERVICES_INSTALL_DIR} ) + + +##### libamarok_mtp-mediadevice (module) ######## + +tde_add_kpart( libamarok_mtp-mediadevice AUTOMOC + SOURCES mtpmediadevice.cpp + LINK amarok-shared ${MTP_LIBRARIES} + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/amarok/src/mediadevice/mtp/ConfigureChecks.cmake b/amarok/src/mediadevice/mtp/ConfigureChecks.cmake new file mode 100644 index 00000000..547ebb13 --- /dev/null +++ b/amarok/src/mediadevice/mtp/ConfigureChecks.cmake @@ -0,0 +1,16 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +# libmtp +pkg_search_module( MTP libmtp ) +if( NOT MTP_FOUND ) + tde_message_fatal( "libmtp is required, but was not found on your system" ) +endif( ) diff --git a/amarok/src/mediadevice/mtp/mtpmediadevice.cpp b/amarok/src/mediadevice/mtp/mtpmediadevice.cpp index dc579b38..54acfb6d 100644 --- a/amarok/src/mediadevice/mtp/mtpmediadevice.cpp +++ b/amarok/src/mediadevice/mtp/mtpmediadevice.cpp @@ -273,11 +273,11 @@ MediaItem trackmeta->filesize = bundle.filesize(); // try and create the requested folder structure - uint32_t tqparent_id = 0; + uint32_t parent_id = 0; if( !m_folderStructure.isEmpty() ) { - tqparent_id = checkFolderStructure( bundle ); - if( tqparent_id == 0 ) + parent_id = checkFolderStructure( bundle ); + if( parent_id == 0 ) { debug() << "Couldn't create new tqparent (" << m_folderStructure << ")" << endl; Amarok::StatusBar::instance()->shortLongMessage( @@ -290,10 +290,10 @@ MediaItem } else { - tqparent_id = getDefaultParentId(); + parent_id = getDefaultParentId(); } - debug() << "Parent id : " << tqparent_id << endl; - trackmeta->tqparent_id = tqparent_id; + debug() << "Parent id : " << parent_id << endl; + trackmeta->parent_id = parent_id; m_critical_mutex.lock(); debug() << "Sending track... " << bundle.url().path().utf8() << endl; @@ -317,7 +317,7 @@ MediaItem MetaBundle temp( bundle ); MtpTrack *taggedTrack = new MtpTrack( trackmeta ); taggedTrack->setBundle( temp ); - taggedTrack->setFolderId( tqparent_id ); + taggedTrack->setFolderId( parent_id ); LIBMTP_destroy_track_t( trackmeta ); @@ -373,16 +373,16 @@ MtpMediaDevice::getDefaultParentId( void ) { // Decide which folder to send it to: // If the device gave us a tqparent_folder setting, we use it - uint32_t tqparent_id = 0; + uint32_t parent_id = 0; if( m_default_tqparent_folder ) { - tqparent_id = m_default_tqparent_folder; + parent_id = m_default_tqparent_folder; } // Otherwise look for a folder called "Music" else if( m_folders != 0 ) { - tqparent_id = folderNameToID( "Music", m_folders ); - if( !tqparent_id ) + parent_id = folderNameToID( "Music", m_folders ); + if( !parent_id ) { debug() << "Parent folder could not be found. Going to use top level." << endl; } @@ -392,7 +392,7 @@ MtpMediaDevice::getDefaultParentId( void ) { debug() << "No folders found. Going to use top level." << endl; } - return tqparent_id; + return parent_id; } /** @@ -560,7 +560,7 @@ MtpMediaDevice::checkFolderStructure( const MetaBundle &bundle, bool create ) if( genre.isEmpty() ) genre = i18n( "Unknown Genre" ); m_critical_mutex.lock(); - uint32_t tqparent_id = getDefaultParentId(); + uint32_t parent_id = getDefaultParentId(); TQStringList folders = TQStringList::split( "/", m_folderStructure ); // use slash as a dir separator TQString completePath; for( TQStringList::Iterator it = folders.begin(); it != folders.end(); ++it ) @@ -572,13 +572,13 @@ MtpMediaDevice::checkFolderStructure( const MetaBundle &bundle, bool create ) .tqreplace( TQRegExp( "%b" ), album ) .tqreplace( TQRegExp( "%g" ), genre ); // check if it exists - uint32_t check_folder = subfolderNameToID( (*it).utf8(), m_folders, tqparent_id ); + uint32_t check_folder = subfolderNameToID( (*it).utf8(), m_folders, parent_id ); // create if not exists (if requested) if( check_folder == 0 ) { if( create ) { - check_folder = createFolder( (*it).utf8() , tqparent_id ); + check_folder = createFolder( (*it).utf8() , parent_id ); if( check_folder == 0 ) { m_critical_mutex.unlock(); @@ -593,23 +593,23 @@ MtpMediaDevice::checkFolderStructure( const MetaBundle &bundle, bool create ) } completePath += (*it).utf8() + '/'; // set new tqparent - tqparent_id = check_folder; + parent_id = check_folder; } m_critical_mutex.unlock(); debug() << "Folder path : " << completePath << endl; // return tqparent - return tqparent_id; + return parent_id; } /** * Create a new mtp folder */ uint32_t -MtpMediaDevice::createFolder( const char *name, uint32_t tqparent_id ) +MtpMediaDevice::createFolder( const char *name, uint32_t parent_id ) { - debug() << "Creating new folder '" << name << "' as a child of "<< tqparent_id << endl; + debug() << "Creating new folder '" << name << "' as a child of "<< parent_id << endl; char *name_copy = qstrdup( name ); - uint32_t new_folder_id = LIBMTP_Create_Folder( m_device, name_copy, tqparent_id, 0 ); + uint32_t new_folder_id = LIBMTP_Create_Folder( m_device, name_copy, parent_id, 0 ); delete(name_copy); debug() << "New folder ID: " << new_folder_id << endl; if( new_folder_id == 0 ) @@ -627,19 +627,19 @@ MtpMediaDevice::createFolder( const char *name, uint32_t tqparent_id ) * tqparent ID and return the child's ID */ uint32_t -MtpMediaDevice::subfolderNameToID( const char *name, LIBMTP_folder_t *folderlist, uint32_t tqparent_id ) +MtpMediaDevice::subfolderNameToID( const char *name, LIBMTP_folder_t *folderlist, uint32_t parent_id ) { uint32_t i; if( folderlist == 0 ) return 0; - if( !strcasecmp( name, folderlist->name ) && folderlist->tqparent_id == tqparent_id ) + if( !strcasecmp( name, folderlist->name ) && folderlist->parent_id == parent_id ) return folderlist->folder_id; - if( ( i = ( subfolderNameToID( name, folderlist->child, tqparent_id ) ) ) ) + if( ( i = ( subfolderNameToID( name, folderlist->child, parent_id ) ) ) ) return i; - if( ( i = ( subfolderNameToID( name, folderlist->sibling, tqparent_id ) ) ) ) + if( ( i = ( subfolderNameToID( name, folderlist->sibling, parent_id ) ) ) ) return i; return 0; @@ -678,7 +678,7 @@ MtpMediaDevice::downloadSelectedItemsToCollection() TQPtrList<MediaItem> items; m_view->getSelectedLeaves( 0, &items ); - KTempDir tempdir( TQString() ); + KTempDir tempdir; tempdir.setAutoDelete( true ); KURL::List urls; TQString genericError = i18n( "Could not copy track from device." ); @@ -1645,7 +1645,7 @@ MtpTrack::readMetaData( LIBMTP_track_t *track ) if( track->duration > 0 ) bundle->setLength( track->duration / 1000 ); // Divide by 1000 since this is in milliseconds - this->setFolderId( track->tqparent_id ); + this->setFolderId( track->parent_id ); this->setBundle( *bundle ); } @@ -1667,3 +1667,5 @@ MtpAlbum::MtpAlbum( LIBMTP_album_t *album ) m_id = album->album_id; m_album = TQString::fromUtf8( album->name ); } + +#include "mtpmediadevice.moc" diff --git a/amarok/src/mediadevice/njb/CMakeLists.txt b/amarok/src/mediadevice/njb/CMakeLists.txt new file mode 100644 index 00000000..c145859b --- /dev/null +++ b/amarok/src/mediadevice/njb/CMakeLists.txt @@ -0,0 +1,41 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +include( ConfigureChecks.cmake ) + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/amarok/src + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + + +##### other data ################################ + +install( FILES + amarok_njb-mediadevice.desktop + DESTINATION ${SERVICES_INSTALL_DIR} ) + + +##### libamarok_njb-mediadevice (module) ######## + +tde_add_kpart( libamarok_njb-mediadevice AUTOMOC + SOURCES + njbmediadevice.cpp playlist.cpp track.cpp + LINK amarok-shared ${NJB_LIBRARIES} + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/amarok/src/mediadevice/njb/ConfigureChecks.cmake b/amarok/src/mediadevice/njb/ConfigureChecks.cmake new file mode 100644 index 00000000..5203cb36 --- /dev/null +++ b/amarok/src/mediadevice/njb/ConfigureChecks.cmake @@ -0,0 +1,16 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +# libnjb +pkg_search_module( NJB libnjb ) +if( NOT NJB_FOUND ) + tde_message_fatal( "libnjb is required, but was not found on your system" ) +endif( ) diff --git a/amarok/src/mediadevice/njb/njbmediadevice.cpp b/amarok/src/mediadevice/njb/njbmediadevice.cpp index 90c5e851..67eb44e9 100644 --- a/amarok/src/mediadevice/njb/njbmediadevice.cpp +++ b/amarok/src/mediadevice/njb/njbmediadevice.cpp @@ -380,7 +380,7 @@ NjbMediaDevice::downloadToCollection() TQPtrList<MediaItem> items; m_view->getSelectedLeaves( 0, &items ); - KTempDir tempdir( TQString() ); // Default prefix is fine with us + KTempDir tempdir; // Default prefix is fine with us tempdir.setAutoDelete( true ); // We don't need it once the work is done. TQString path = tempdir.name(), filepath; KURL::List urls; @@ -910,3 +910,6 @@ NjbMediaDevice::customClicked() KMessageBox::information(0, Information, i18n("Device information") ); } + +#include "njbmediadevice.moc" + diff --git a/amarok/src/mediadevice/riokarma/CMakeLists.txt b/amarok/src/mediadevice/riokarma/CMakeLists.txt new file mode 100644 index 00000000..70916900 --- /dev/null +++ b/amarok/src/mediadevice/riokarma/CMakeLists.txt @@ -0,0 +1,43 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +tde_message_fatal( "riokarma support is not buildable, it needs to link to karma-sharp.dll" ) + +include( ConfigureChecks.cmake ) + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/amarok/src + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} + ${KARMA_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + + +##### other data ################################ + +install( FILES + amarok_riokarma-mediadevice.desktop + DESTINATION ${SERVICES_INSTALL_DIR} ) + + +##### libamarok_riokarma-mediadevice (module) ### + +tde_add_kpart( libamarok_riokarma-mediadevice AUTOMOC + SOURCES riokarmamediadevice.cpp + LINK amarok-shared ${KARMA_LIBRARIES} + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/amarok/src/mediadevice/riokarma/ConfigureChecks.cmake b/amarok/src/mediadevice/riokarma/ConfigureChecks.cmake new file mode 100644 index 00000000..70d343d1 --- /dev/null +++ b/amarok/src/mediadevice/riokarma/ConfigureChecks.cmake @@ -0,0 +1,16 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +# libkarma +pkg_search_module( KARMA karma-sharp ) +if( NOT KARMA_FOUND ) + tde_message_fatal( "libkarma is required, but was not found on your system" ) +endif( ) diff --git a/amarok/src/mediadevice/riokarma/riokarmamediadevice.cpp b/amarok/src/mediadevice/riokarma/riokarmamediadevice.cpp index 01d67a90..954053cf 100644 --- a/amarok/src/mediadevice/riokarma/riokarmamediadevice.cpp +++ b/amarok/src/mediadevice/riokarma/riokarmamediadevice.cpp @@ -608,3 +608,5 @@ RioKarmaTrack::removeItem( const RioKarmaMediaItem *item ) m_itemList.remove( item ); return m_itemList.isEmpty(); } + +#include "riokarmamediadevice.moc" |