[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
v3.5.13-sru
samelian 14 years ago
parent 844e4d4e91
commit 75c0180e44

@ -22,6 +22,7 @@ project( amarok )
include( CheckCXXSourceCompiles ) include( CheckCXXSourceCompiles )
include( CheckFunctionExists ) include( CheckFunctionExists )
include( CheckIncludeFileCXX ) include( CheckIncludeFileCXX )
include( CheckLibraryExists )
include( CheckStructHasMember ) include( CheckStructHasMember )
include( CheckSymbolExists ) include( CheckSymbolExists )
include( CheckTypeSize ) include( CheckTypeSize )
@ -45,7 +46,12 @@ tde_setup_paths( )
option( WITH_LIBVISUAL "Enable libvisual support" OFF ) option( WITH_LIBVISUAL "Enable libvisual support" OFF )
option( WITH_KONQSIDEBAR "Enable konqsidebar plugin" OFF ) option( WITH_KONQSIDEBAR "Enable konqsidebar plugin" OFF )
option( WITH_XINE "Enable xine-engine support" 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 #################### ##### user requested modules ####################

@ -112,32 +112,32 @@ if( WITH_XINE )
tde_message_fatal( "your xine version is too old; at least 1.0.2 is required" ) tde_message_fatal( "your xine version is too old; at least 1.0.2 is required" )
endif( ) endif( )
else( ) 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( )
endif( ) endif( )
# iPod # iPod
if( WITH_LIBGPOD ) if( WITH_IPOD )
# tde_message_fatal( "iPod support is outdated, cannot be compiled against newer libgpod" ) pkg_search_module( GPOD libgpod-1.0 )
if( GPOD_FOUND )
pkg_search_module( LIBGPOD libgpod-1.0 ) if( ${GPOD_VERSION} VERSION_LESS "0.4.2" )
if( LIBGPOD_FOUND )
if( ${LIBGPOD_VERSION} VERSION_LESS "0.4.2" )
tde_message_fatal( "your libgpod version is too old; at least 0.4.2 is required" ) 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" ) elseif( NOT ${GPOD_VERSION} VERSION_LESS "0.6.0" )
set( HAVE_LIBGPOD_060 1 ) set( HAVE_GPOD_060 1 )
endif( ) endif( )
else( ) 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( ) endif( )
tde_save( CMAKE_REQUIRED_INCLUDES ) 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 ) check_struct_has_member( "struct _Itdb_Track" mediatype "gpod/itdb.h" HAVE_ITDB_MEDIATYPE )
tde_restore( CMAKE_REQUIRED_INCLUDES ) tde_restore( CMAKE_REQUIRED_INCLUDES )
set( GPOD_LIBRARY gpod )
endif( ) endif( )
@ -159,7 +159,7 @@ tde_restore( CMAKE_REQUIRED_INCLUDES CMAKE_REQUIRED_LIBRARIES )
# konqsidebarplugin.h # konqsidebarplugin.h
if( WITH_KONQSIDEBAR ) 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_DEFINITIONS ${TQT_CFLAGS_OTHER} )
set( CMAKE_REQUIRED_INCLUDES ${TDE_INCLUDE_DIR};${TQT_INCLUDE_DIRS};${CMAKE_INCLUDE_PATH} ) set( CMAKE_REQUIRED_INCLUDES ${TDE_INCLUDE_DIR};${TQT_INCLUDE_DIRS};${CMAKE_INCLUDE_PATH} )
set( CMAKE_REQUIRED_FLAGS "-include tqt.h" ) set( CMAKE_REQUIRED_FLAGS "-include tqt.h" )
@ -168,7 +168,7 @@ if( WITH_KONQSIDEBAR )
#include <konqsidebarplugin.h> #include <konqsidebarplugin.h>
int main(int, char**) { return 0; } " int main(int, char**) { return 0; } "
HAVE_KONQSIDEBARPLUGIN_H ) 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 ) if( NOT HAVE_KONQSIDEBARPLUGIN_H )
tde_message_fatal( "konqsidebarplugin.h are requested, but not found on your system" ) tde_message_fatal( "konqsidebarplugin.h are requested, but not found on your system" )
endif( ) endif( )

@ -9,12 +9,10 @@
# #
################################################# #################################################
# FIXME optional devices are not ported yet
add_subdirectory( generic ) 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_IFP ifp )
tde_conditional_add_subdirectory( WITH_LIBNJB njb ) tde_conditional_add_subdirectory( WITH_NJB njb )
tde_conditional_add_subdirectory( WITH_LIBMTP mtp ) tde_conditional_add_subdirectory( WITH_MTP mtp )
tde_conditional_add_subdirectory( WITH_LIBKARMA riokarma ) tde_conditional_add_subdirectory( WITH_RIOKARMA riokarma )
tde_conditional_add_subdirectory( WITH_DAAP daap ) tde_conditional_add_subdirectory( WITH_DAAP daap )

@ -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
)

@ -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( )

@ -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
)

@ -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
)

@ -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 )

@ -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
)

@ -250,7 +250,7 @@ VALUE HttpParser_finish(VALUE self)
DATA_GET(self, http_parser, http); DATA_GET(self, http_parser, http);
http_parser_finish(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; http_parser *http = NULL;
DATA_GET(self, http_parser, http); 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; http_parser *http = NULL;
DATA_GET(self, http_parser, http); DATA_GET(self, http_parser, http);
return http_parser_is_finished(http) ? TQtrue : Qfalse; return http_parser_is_finished(http) ? Qtrue : Qfalse;
} }

@ -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 )

@ -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 )

@ -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 )

@ -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 )

@ -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}
)

@ -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( )

@ -11,16 +11,14 @@
include_directories( include_directories(
${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}
#${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}/amarok/src ${CMAKE_BINARY_DIR}/amarok/src
${CMAKE_SOURCE_DIR}/amarok/src ${CMAKE_SOURCE_DIR}/amarok/src
${CMAKE_SOURCE_DIR}/amarok/src/amarokcore ${CMAKE_SOURCE_DIR}/amarok/src/amarokcore
${CMAKE_BINARY_DIR}/amarok/src/amarokcore ${CMAKE_BINARY_DIR}/amarok/src/amarokcore
#${CMAKE_SOURCE_DIR}
${TDE_INCLUDE_DIR} ${TDE_INCLUDE_DIR}
${TQT_INCLUDE_DIRS} ${TQT_INCLUDE_DIRS}
${LIBGPOD_INCLUDE_DIRS} ${GPOD_INCLUDE_DIRS}
) )
link_directories( link_directories(
@ -39,6 +37,6 @@ install( FILES
tde_add_kpart( libamarok_ipod-mediadevice AUTOMOC tde_add_kpart( libamarok_ipod-mediadevice AUTOMOC
SOURCES ipodmediadevice.cpp SOURCES ipodmediadevice.cpp
LINK amarok-shared glib-2.0 gpod LINK amarok-shared glib-2.0 ${GPOD_LIBRARY}
DESTINATION ${PLUGIN_INSTALL_DIR} DESTINATION ${PLUGIN_INSTALL_DIR}
) )

@ -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}
)

@ -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( )

@ -273,11 +273,11 @@ MediaItem
trackmeta->filesize = bundle.filesize(); trackmeta->filesize = bundle.filesize();
// try and create the requested folder structure // try and create the requested folder structure
uint32_t tqparent_id = 0; uint32_t parent_id = 0;
if( !m_folderStructure.isEmpty() ) if( !m_folderStructure.isEmpty() )
{ {
tqparent_id = checkFolderStructure( bundle ); parent_id = checkFolderStructure( bundle );
if( tqparent_id == 0 ) if( parent_id == 0 )
{ {
debug() << "Couldn't create new tqparent (" << m_folderStructure << ")" << endl; debug() << "Couldn't create new tqparent (" << m_folderStructure << ")" << endl;
Amarok::StatusBar::instance()->shortLongMessage( Amarok::StatusBar::instance()->shortLongMessage(
@ -290,10 +290,10 @@ MediaItem
} }
else else
{ {
tqparent_id = getDefaultParentId(); parent_id = getDefaultParentId();
} }
debug() << "Parent id : " << tqparent_id << endl; debug() << "Parent id : " << parent_id << endl;
trackmeta->tqparent_id = tqparent_id; trackmeta->parent_id = parent_id;
m_critical_mutex.lock(); m_critical_mutex.lock();
debug() << "Sending track... " << bundle.url().path().utf8() << endl; debug() << "Sending track... " << bundle.url().path().utf8() << endl;
@ -317,7 +317,7 @@ MediaItem
MetaBundle temp( bundle ); MetaBundle temp( bundle );
MtpTrack *taggedTrack = new MtpTrack( trackmeta ); MtpTrack *taggedTrack = new MtpTrack( trackmeta );
taggedTrack->setBundle( temp ); taggedTrack->setBundle( temp );
taggedTrack->setFolderId( tqparent_id ); taggedTrack->setFolderId( parent_id );
LIBMTP_destroy_track_t( trackmeta ); LIBMTP_destroy_track_t( trackmeta );
@ -373,16 +373,16 @@ MtpMediaDevice::getDefaultParentId( void )
{ {
// Decide which folder to send it to: // Decide which folder to send it to:
// If the device gave us a tqparent_folder setting, we use it // 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 ) if( m_default_tqparent_folder )
{ {
tqparent_id = m_default_tqparent_folder; parent_id = m_default_tqparent_folder;
} }
// Otherwise look for a folder called "Music" // Otherwise look for a folder called "Music"
else if( m_folders != 0 ) else if( m_folders != 0 )
{ {
tqparent_id = folderNameToID( "Music", m_folders ); parent_id = folderNameToID( "Music", m_folders );
if( !tqparent_id ) if( !parent_id )
{ {
debug() << "Parent folder could not be found. Going to use top level." << endl; 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; 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() ) if( genre.isEmpty() )
genre = i18n( "Unknown Genre" ); genre = i18n( "Unknown Genre" );
m_critical_mutex.lock(); 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 TQStringList folders = TQStringList::split( "/", m_folderStructure ); // use slash as a dir separator
TQString completePath; TQString completePath;
for( TQStringList::Iterator it = folders.begin(); it != folders.end(); ++it ) 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( "%b" ), album )
.tqreplace( TQRegExp( "%g" ), genre ); .tqreplace( TQRegExp( "%g" ), genre );
// check if it exists // 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) // create if not exists (if requested)
if( check_folder == 0 ) if( check_folder == 0 )
{ {
if( create ) if( create )
{ {
check_folder = createFolder( (*it).utf8() , tqparent_id ); check_folder = createFolder( (*it).utf8() , parent_id );
if( check_folder == 0 ) if( check_folder == 0 )
{ {
m_critical_mutex.unlock(); m_critical_mutex.unlock();
@ -593,23 +593,23 @@ MtpMediaDevice::checkFolderStructure( const MetaBundle &bundle, bool create )
} }
completePath += (*it).utf8() + '/'; completePath += (*it).utf8() + '/';
// set new tqparent // set new tqparent
tqparent_id = check_folder; parent_id = check_folder;
} }
m_critical_mutex.unlock(); m_critical_mutex.unlock();
debug() << "Folder path : " << completePath << endl; debug() << "Folder path : " << completePath << endl;
// return tqparent // return tqparent
return tqparent_id; return parent_id;
} }
/** /**
* Create a new mtp folder * Create a new mtp folder
*/ */
uint32_t 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 ); 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); delete(name_copy);
debug() << "New folder ID: " << new_folder_id << endl; debug() << "New folder ID: " << new_folder_id << endl;
if( new_folder_id == 0 ) 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 * tqparent ID and return the child's ID
*/ */
uint32_t 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; uint32_t i;
if( folderlist == 0 ) if( folderlist == 0 )
return 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; return folderlist->folder_id;
if( ( i = ( subfolderNameToID( name, folderlist->child, tqparent_id ) ) ) ) if( ( i = ( subfolderNameToID( name, folderlist->child, parent_id ) ) ) )
return i; return i;
if( ( i = ( subfolderNameToID( name, folderlist->sibling, tqparent_id ) ) ) ) if( ( i = ( subfolderNameToID( name, folderlist->sibling, parent_id ) ) ) )
return i; return i;
return 0; return 0;
@ -678,7 +678,7 @@ MtpMediaDevice::downloadSelectedItemsToCollection()
TQPtrList<MediaItem> items; TQPtrList<MediaItem> items;
m_view->getSelectedLeaves( 0, &items ); m_view->getSelectedLeaves( 0, &items );
KTempDir tempdir( TQString() ); KTempDir tempdir;
tempdir.setAutoDelete( true ); tempdir.setAutoDelete( true );
KURL::List urls; KURL::List urls;
TQString genericError = i18n( "Could not copy track from device." ); TQString genericError = i18n( "Could not copy track from device." );
@ -1645,7 +1645,7 @@ MtpTrack::readMetaData( LIBMTP_track_t *track )
if( track->duration > 0 ) if( track->duration > 0 )
bundle->setLength( track->duration / 1000 ); // Divide by 1000 since this is in milliseconds 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 ); this->setBundle( *bundle );
} }
@ -1667,3 +1667,5 @@ MtpAlbum::MtpAlbum( LIBMTP_album_t *album )
m_id = album->album_id; m_id = album->album_id;
m_album = TQString::fromUtf8( album->name ); m_album = TQString::fromUtf8( album->name );
} }
#include "mtpmediadevice.moc"

@ -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}
)

@ -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( )

@ -380,7 +380,7 @@ NjbMediaDevice::downloadToCollection()
TQPtrList<MediaItem> items; TQPtrList<MediaItem> items;
m_view->getSelectedLeaves( 0, &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. tempdir.setAutoDelete( true ); // We don't need it once the work is done.
TQString path = tempdir.name(), filepath; TQString path = tempdir.name(), filepath;
KURL::List urls; KURL::List urls;
@ -910,3 +910,6 @@ NjbMediaDevice::customClicked()
KMessageBox::information(0, Information, i18n("Device information") ); KMessageBox::information(0, Information, i18n("Device information") );
} }
#include "njbmediadevice.moc"

@ -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}
)

@ -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( )

@ -608,3 +608,5 @@ RioKarmaTrack::removeItem( const RioKarmaMediaItem *item )
m_itemList.remove( item ); m_itemList.remove( item );
return m_itemList.isEmpty(); return m_itemList.isEmpty();
} }
#include "riokarmamediadevice.moc"

Loading…
Cancel
Save