diff options
| author | Michele Calgaro <michele.calgaro@yahoo.it> | 2025-03-10 20:36:49 +0900 |
|---|---|---|
| committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2025-03-21 19:05:50 +0900 |
| commit | 73da215882d7f96b6010fa99361c7cc10ec18bfb (patch) | |
| tree | cea1a5016a94a9dac26cab8227e2513224288be3 /src/libktorrent | |
| parent | bb099158e6c9fd0f1c2771cb9350d3b0a0b51a27 (diff) | |
| download | ktorrent-73da2158.tar.gz ktorrent-73da2158.zip | |
Conversion to cmake building system
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
(cherry picked from commit bf204e931c605c73d761ec84943bb0cc94d7e7e4)
Diffstat (limited to 'src/libktorrent')
69 files changed, 365 insertions, 112 deletions
diff --git a/src/libktorrent/CMakeLists.txt b/src/libktorrent/CMakeLists.txt new file mode 100644 index 0000000..4bcf0ba --- /dev/null +++ b/src/libktorrent/CMakeLists.txt @@ -0,0 +1,54 @@ +##### generate settings.h + +add_custom_command( + OUTPUT settings.cpp settings.h + COMMAND "${BIN_INSTALL_DIR}/tdeconfig_compiler" + ARGS "${CMAKE_CURRENT_SOURCE_DIR}/ktorrent.kcfg" + "${CMAKE_CURRENT_SOURCE_DIR}/settings.kcfgc" +) + +add_custom_target( SettingsH DEPENDS settings.h ) + + +##### subfolders + +add_subdirectory( datachecker ) +add_subdirectory( interfaces ) +add_subdirectory( kademlia ) +add_subdirectory( migrate ) +add_subdirectory( mse ) +add_subdirectory( net ) +add_subdirectory( torrent ) +add_subdirectory( util ) + + +##### current folder + +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_BINARY_DIR} +) + + +##### ktorrent library (static) + +tde_add_library( ktorrent SHARED AUTOMOC + SOURCES + expandablewidget.cpp functions.cpp labelview.cpp labelviewitembase.ui pluginmanager.cpp + pluginmanagerprefpage.cpp pluginmanagerwidget.ui settings.cpp + EMBED + torrent-static net-static datachecker-static mse-static migrate-static + kademlia-static interfaces-static util-static + LINK + tdecore-shared tdeio-shared tdeui-shared tdeparts-shared + VERSION 2.2.8 + DESTINATION ${LIB_INSTALL_DIR} +) + + +##### other files + +install( + FILES ktorrent.kcfg + DESTINATION ${KCFG_INSTALL_DIR} +) diff --git a/src/libktorrent/Makefile.am b/src/libktorrent/Makefile.am index d5537c5..6238869 100644 --- a/src/libktorrent/Makefile.am +++ b/src/libktorrent/Makefile.am @@ -11,7 +11,7 @@ kde_kcfg_DATA = ktorrent.kcfg BUILT_SOURCES=settings.h noinst_HEADERS = expandablewidget.h functions.h ktversion.h labelview.h \ - pluginmanager.h pluginmanagerprefpage.h + pluginmanager.h pluginmanagerprefpage.h libktorrent_export.h libktorrent_la_SOURCES = expandablewidget.cpp functions.cpp labelview.cpp \ labelviewitembase.ui pluginmanager.cpp pluginmanagerprefpage.cpp pluginmanagerwidget.ui \ settings.kcfgc diff --git a/src/libktorrent/datachecker/CMakeLists.txt b/src/libktorrent/datachecker/CMakeLists.txt new file mode 100644 index 0000000..f09dd85 --- /dev/null +++ b/src/libktorrent/datachecker/CMakeLists.txt @@ -0,0 +1,13 @@ +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/.. +) + + +##### datachecker library (static) + +tde_add_library( datachecker STATIC_PIC AUTOMOC + SOURCES + datachecker.cpp multidatachecker.cpp singledatachecker.cpp + datacheckerlistener.cpp datacheckerthread.cpp +) diff --git a/src/libktorrent/datachecker/datachecker.h b/src/libktorrent/datachecker/datachecker.h index e038152..edc53f5 100644 --- a/src/libktorrent/datachecker/datachecker.h +++ b/src/libktorrent/datachecker/datachecker.h @@ -22,6 +22,7 @@ #include <util/bitset.h> #include "datacheckerlistener.h" +#include <libktorrent_export.h> class TQString; @@ -37,7 +38,7 @@ namespace bt * Checks which data is downloaded, given a torrent and a file or directory containing * files of the torrent. */ - class DataChecker + class LIBKTORRENT_EXPORT DataChecker { public: DataChecker(); diff --git a/src/libktorrent/datachecker/datacheckerlistener.h b/src/libktorrent/datachecker/datacheckerlistener.h index a770bab..abadc21 100644 --- a/src/libktorrent/datachecker/datacheckerlistener.h +++ b/src/libktorrent/datachecker/datacheckerlistener.h @@ -21,6 +21,7 @@ #define BTDATACHECKERLISTENER_H #include <util/constants.h> +#include <libktorrent_export.h> namespace bt { @@ -28,7 +29,7 @@ namespace bt /** @author Joris Guisson <joris.guisson@gmail.com> */ - class DataCheckerListener + class LIBKTORRENT_EXPORT DataCheckerListener { public: DataCheckerListener(bool auto_import); diff --git a/src/libktorrent/datachecker/multidatachecker.h b/src/libktorrent/datachecker/multidatachecker.h index bb68a06..f6271dd 100644 --- a/src/libktorrent/datachecker/multidatachecker.h +++ b/src/libktorrent/datachecker/multidatachecker.h @@ -28,7 +28,7 @@ namespace bt /** @author Joris Guisson */ - class MultiDataChecker : public DataChecker + class LIBKTORRENT_EXPORT MultiDataChecker : public DataChecker { public: MultiDataChecker(); diff --git a/src/libktorrent/datachecker/singledatachecker.h b/src/libktorrent/datachecker/singledatachecker.h index 3b86829..d0d15b4 100644 --- a/src/libktorrent/datachecker/singledatachecker.h +++ b/src/libktorrent/datachecker/singledatachecker.h @@ -30,7 +30,7 @@ namespace bt * * Data checker for single file torrents. */ - class SingleDataChecker : public DataChecker + class LIBKTORRENT_EXPORT SingleDataChecker : public DataChecker { public: SingleDataChecker(); diff --git a/src/libktorrent/functions.h b/src/libktorrent/functions.h index 4b2a9ee..4076d9e 100644 --- a/src/libktorrent/functions.h +++ b/src/libktorrent/functions.h @@ -22,6 +22,7 @@ #include <tqstring.h> #include <util/constants.h> +#include <libktorrent_export.h> namespace kt { @@ -29,7 +30,7 @@ namespace kt * Will return the data directory * @return ~/.trinity/share/apps/ktorrent/ */ - TQString DataDir(); + LIBKTORRENT_EXPORT TQString DataDir(); } #endif diff --git a/src/libktorrent/interfaces/CMakeLists.txt b/src/libktorrent/interfaces/CMakeLists.txt new file mode 100644 index 0000000..e2b6e12 --- /dev/null +++ b/src/libktorrent/interfaces/CMakeLists.txt @@ -0,0 +1,16 @@ +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/.. + ${CMAKE_CURRENT_BINARY_DIR} +) + + +##### interfaces library (static) + +tde_add_library( interfaces STATIC_PIC AUTOMOC + SOURCES + plugin.cpp coreinterface.cpp guiinterface.cpp prefpageinterface.cpp torrentinterface.cpp + monitorinterface.cpp chunkdownloadinterface.cpp peerinterface.cpp torrentfileinterface.cpp + filetreeitem.cpp filetreediritem.cpp functions.cpp logmonitorinterface.cpp + ipblockinginterface.cpp trackerslist.cpp peersource.cpp exitoperation.cpp +) diff --git a/src/libktorrent/interfaces/coreinterface.h b/src/libktorrent/interfaces/coreinterface.h index f42c966..6e779f9 100644 --- a/src/libktorrent/interfaces/coreinterface.h +++ b/src/libktorrent/interfaces/coreinterface.h @@ -24,6 +24,7 @@ #include <tqobject.h> #include <util/constants.h> #include <torrent/queuemanager.h> +#include <libktorrent_export.h> ///Stats struct struct CurrentStats @@ -50,7 +51,7 @@ namespace kt * the applications core, the core is responsible for managing all * TorrentControl objects. */ - class CoreInterface : public TQObject + class LIBKTORRENT_EXPORT CoreInterface : public TQObject { TQ_OBJECT diff --git a/src/libktorrent/interfaces/exitoperation.h b/src/libktorrent/interfaces/exitoperation.h index e9c0ae5..655b344 100644 --- a/src/libktorrent/interfaces/exitoperation.h +++ b/src/libktorrent/interfaces/exitoperation.h @@ -22,6 +22,7 @@ #include <tqobject.h> #include <tdeio/job.h> +#include <libktorrent_export.h> namespace kt { @@ -35,7 +36,7 @@ namespace kt * ExitOperation's can be used in combination with a WaitJob, to wait for a certain amount of time * to give serveral ExitOperation's the time time to finish up. */ - class ExitOperation : public TQObject + class LIBKTORRENT_EXPORT ExitOperation : public TQObject { TQ_OBJECT diff --git a/src/libktorrent/interfaces/filetreediritem.h b/src/libktorrent/interfaces/filetreediritem.h index 6b35031..6f60070 100644 --- a/src/libktorrent/interfaces/filetreediritem.h +++ b/src/libktorrent/interfaces/filetreediritem.h @@ -23,6 +23,7 @@ #include <tdelistview.h> #include <util/constants.h> #include <util/ptrmap.h> +#include <libktorrent_export.h> namespace kt { @@ -44,7 +45,7 @@ namespace kt * * Directory item the file tree showing the files in a multifile torrent */ - class FileTreeDirItem : public TQCheckListItem + class LIBKTORRENT_EXPORT FileTreeDirItem : public TQCheckListItem { protected: TQString name; diff --git a/src/libktorrent/interfaces/filetreeitem.h b/src/libktorrent/interfaces/filetreeitem.h index 5cc17f9..af7759e 100644 --- a/src/libktorrent/interfaces/filetreeitem.h +++ b/src/libktorrent/interfaces/filetreeitem.h @@ -22,6 +22,7 @@ #include <tdelistview.h> #include <util/constants.h> +#include <libktorrent_export.h> using namespace bt; @@ -40,7 +41,7 @@ namespace kt * This is derived from TQCheckListItem, if the user checks or unchecks the box, * wether or not to download a file will be changed. */ - class FileTreeItem : public TQCheckListItem + class LIBKTORRENT_EXPORT FileTreeItem : public TQCheckListItem { protected: TQString name; diff --git a/src/libktorrent/interfaces/functions.h b/src/libktorrent/interfaces/functions.h index 4ffe9a9..4836a6f 100644 --- a/src/libktorrent/interfaces/functions.h +++ b/src/libktorrent/interfaces/functions.h @@ -22,6 +22,7 @@ #include <tqstring.h> #include <util/constants.h> +#include <libktorrent_export.h> namespace kt { @@ -29,9 +30,9 @@ namespace kt const double TO_MEG = (1024.0 * 1024.0); const double TO_GIG = (1024.0 * 1024.0 * 1024.0); - TQString BytesToString(bt::Uint64 bytes,int precision = -1); - TQString KBytesPerSecToString(double speed,int precision = 1); - TQString DurationToString(bt::Uint32 nsecs); + LIBKTORRENT_EXPORT TQString BytesToString(bt::Uint64 bytes,int precision = -1); + LIBKTORRENT_EXPORT TQString KBytesPerSecToString(double speed,int precision = 1); + LIBKTORRENT_EXPORT TQString DurationToString(bt::Uint32 nsecs); template<class T> int CompareVal(T a,T b) { diff --git a/src/libktorrent/interfaces/guiinterface.h b/src/libktorrent/interfaces/guiinterface.h index 69d168b..d94559e 100644 --- a/src/libktorrent/interfaces/guiinterface.h +++ b/src/libktorrent/interfaces/guiinterface.h @@ -21,6 +21,7 @@ #define KTGUIINTERFACE_H #include <tqptrlist.h> +#include <libktorrent_export.h> class TQWidget; class TQIconSet; @@ -77,7 +78,7 @@ namespace kt * * This interface allows plugins and others to modify the GUI. */ - class GUIInterface + class LIBKTORRENT_EXPORT GUIInterface { TQPtrList<ViewListener> listeners; public: diff --git a/src/libktorrent/interfaces/ipblockinginterface.h b/src/libktorrent/interfaces/ipblockinginterface.h index 236a549..87a544c 100644 --- a/src/libktorrent/interfaces/ipblockinginterface.h +++ b/src/libktorrent/interfaces/ipblockinginterface.h @@ -22,6 +22,8 @@ #ifndef IPBLOCKINGINTERFACE_H #define IPBLOCKINGINTERFACE_H +#include <libktorrent_export.h> + class TQString; namespace kt @@ -30,7 +32,7 @@ namespace kt * @author Ivan Vasic * @brief Interface for IPBlocklist to communicate with IPBlockingPlugin */ - class IPBlockingInterface + class LIBKTORRENT_EXPORT IPBlockingInterface { public: IPBlockingInterface(); diff --git a/src/libktorrent/interfaces/logmonitorinterface.h b/src/libktorrent/interfaces/logmonitorinterface.h index 54e1a21..7ee6498 100644 --- a/src/libktorrent/interfaces/logmonitorinterface.h +++ b/src/libktorrent/interfaces/logmonitorinterface.h @@ -20,6 +20,8 @@ #ifndef KTLOGMONITORINTERFACE_H #define KTLOGMONITORINTERFACE_H +#include <libktorrent_export.h> + class TQString; namespace kt @@ -32,7 +34,7 @@ namespace kt * This class is an interface for all classes which want to know, * what is written to the log. */ - class LogMonitorInterface + class LIBKTORRENT_EXPORT LogMonitorInterface { public: LogMonitorInterface(); diff --git a/src/libktorrent/interfaces/monitorinterface.h b/src/libktorrent/interfaces/monitorinterface.h index a199800..0f864de 100644 --- a/src/libktorrent/interfaces/monitorinterface.h +++ b/src/libktorrent/interfaces/monitorinterface.h @@ -20,6 +20,7 @@ #ifndef KTMONITORINTERFACE_H #define KTMONITORINTERFACE_H +#include <libktorrent_export.h> namespace kt { @@ -33,7 +34,7 @@ namespace kt * Classes who want to keep track of all peers currently connected for a given * torrent and all chunks who are currently downloading can implement this interface. */ - class MonitorInterface + class LIBKTORRENT_EXPORT MonitorInterface { public: MonitorInterface(); diff --git a/src/libktorrent/interfaces/peersource.h b/src/libktorrent/interfaces/peersource.h index 0b8a852..a6f2e79 100644 --- a/src/libktorrent/interfaces/peersource.h +++ b/src/libktorrent/interfaces/peersource.h @@ -23,6 +23,7 @@ #include <tqobject.h> #include <tqvaluelist.h> #include <util/constants.h> +#include <libktorrent_export.h> namespace bt { @@ -47,7 +48,7 @@ namespace kt * for torrents. PeerSources should work independently and should emit a signal when they * have peers ready. */ - class PeerSource : public TQObject + class LIBKTORRENT_EXPORT PeerSource : public TQObject { TQ_OBJECT diff --git a/src/libktorrent/interfaces/plugin.h b/src/libktorrent/interfaces/plugin.h index c2446e9..1c185cc 100644 --- a/src/libktorrent/interfaces/plugin.h +++ b/src/libktorrent/interfaces/plugin.h @@ -21,6 +21,7 @@ #define KTPLUGIN_H #include <ktversion.h> +#include <libktorrent_export.h> #include <tdeparts/plugin.h> namespace bt @@ -45,7 +46,7 @@ namespace kt * (setting an int to 0 is ok, creating widgets isn't). * Only the name, author and description may be set in the constructor. */ - class Plugin : public KParts::Plugin + class LIBKTORRENT_EXPORT Plugin : public KParts::Plugin { TQ_OBJECT diff --git a/src/libktorrent/interfaces/prefpageinterface.h b/src/libktorrent/interfaces/prefpageinterface.h index 850a344..665cdac 100644 --- a/src/libktorrent/interfaces/prefpageinterface.h +++ b/src/libktorrent/interfaces/prefpageinterface.h @@ -21,6 +21,7 @@ #define PREFPAGEINTERFACE_H #include <tqpixmap.h> +#include <libktorrent_export.h> class TQWidget; @@ -32,7 +33,7 @@ namespace kt * * This interface allows plugins and others to add their own pages in Configuration dialog */ - class PrefPageInterface + class LIBKTORRENT_EXPORT PrefPageInterface { public: /** diff --git a/src/libktorrent/interfaces/torrentfileinterface.h b/src/libktorrent/interfaces/torrentfileinterface.h index c9381a9..2590fa7 100644 --- a/src/libktorrent/interfaces/torrentfileinterface.h +++ b/src/libktorrent/interfaces/torrentfileinterface.h @@ -23,6 +23,7 @@ #include <tqobject.h> #include <tqstring.h> #include <util/constants.h> +#include <libktorrent_export.h> namespace kt { @@ -41,7 +42,7 @@ namespace kt * * This class is the interface for a file in a multifile torrent. */ - class TorrentFileInterface : public TQObject + class LIBKTORRENT_EXPORT TorrentFileInterface : public TQObject { TQ_OBJECT diff --git a/src/libktorrent/interfaces/torrentinterface.h b/src/libktorrent/interfaces/torrentinterface.h index 92b5f2c..464a640 100644 --- a/src/libktorrent/interfaces/torrentinterface.h +++ b/src/libktorrent/interfaces/torrentinterface.h @@ -22,9 +22,9 @@ #include <tqobject.h> #include <util/constants.h> -#include <interfaces/trackerslist.h> - #include <kurl.h> +#include <interfaces/trackerslist.h> +#include <libktorrent_export.h> namespace bt { @@ -179,7 +179,7 @@ namespace kt * This class is the interface for an object which controls the * up- and download of one torrent. */ - class TorrentInterface : public TQObject + class LIBKTORRENT_EXPORT TorrentInterface : public TQObject { TQ_OBJECT @@ -503,7 +503,7 @@ namespace kt * @param stats The stats of the torrent * @return The share ratio */ - float ShareRatio(const TorrentStats & stats); + LIBKTORRENT_EXPORT float ShareRatio(const TorrentStats & stats); } diff --git a/src/libktorrent/kademlia/CMakeLists.txt b/src/libktorrent/kademlia/CMakeLists.txt new file mode 100644 index 0000000..83c1fd1 --- /dev/null +++ b/src/libktorrent/kademlia/CMakeLists.txt @@ -0,0 +1,15 @@ +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/.. + ${CMAKE_CURRENT_BINARY_DIR} +) + + +##### kademlia library (static) + +tde_add_library( kademlia STATIC_PIC AUTOMOC + SOURCES + key.cpp node.cpp kbucket.cpp rpccall.cpp rpcserver.cpp database.cpp dht.cpp rpcmsg.cpp + kclosestnodessearch.cpp nodelookup.cpp task.cpp pack.cpp taskmanager.cpp announcetask.cpp + dhttrackerbackend.cpp dhtbase.cpp +) diff --git a/src/libktorrent/libktorrent_export.h b/src/libktorrent/libktorrent_export.h new file mode 100644 index 0000000..fa80a7b --- /dev/null +++ b/src/libktorrent/libktorrent_export.h @@ -0,0 +1,12 @@ +#ifndef _LIBKTORRENT_EXPORT_H +#define _LIBKTORRENT_EXPORT_H + +#include <tdemacros.h> + +#ifdef __TDE_HAVE_GCC_VISIBILITY +#define LIBKTORRENT_EXPORT TDE_EXPORT +#else +#define LIBKTORRENT_EXPORT +#endif + +#endif diff --git a/src/libktorrent/migrate/CMakeLists.txt b/src/libktorrent/migrate/CMakeLists.txt new file mode 100644 index 0000000..9213efc --- /dev/null +++ b/src/libktorrent/migrate/CMakeLists.txt @@ -0,0 +1,11 @@ +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/.. +) + + +##### migrate library (static) + +tde_add_library( migrate STATIC_PIC AUTOMOC + SOURCES migrate.cpp ccmigrate.cpp cachemigrate.cpp +) diff --git a/src/libktorrent/mse/CMakeLists.txt b/src/libktorrent/mse/CMakeLists.txt new file mode 100644 index 0000000..2d0d01c --- /dev/null +++ b/src/libktorrent/mse/CMakeLists.txt @@ -0,0 +1,16 @@ +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/.. + ${CMAKE_CURRENT_BINARY_DIR} +) + + +##### mse library (static) + +tde_add_library( mse STATIC_PIC AUTOMOC + SOURCES + bigint.cpp rc4encryptor.cpp streamsocket.cpp encryptedauthenticate.cpp + encryptedserverauthenticate.cpp functions.cpp + LINK + ${GMP_LIBRARIES} +) diff --git a/src/libktorrent/mse/streamsocket.h b/src/libktorrent/mse/streamsocket.h index c653e5d..0b3c234 100644 --- a/src/libktorrent/mse/streamsocket.h +++ b/src/libktorrent/mse/streamsocket.h @@ -23,6 +23,7 @@ #include <tqobject.h> #include <util/constants.h> #include <net/bufferedsocket.h> +#include <libktorrent_export.h> class TQString; @@ -52,7 +53,7 @@ namespace mse * not be used anymore, a SocketReader and SocketWriter should be provided, * so that reading and writing is controlled from the monitor thread. */ - class StreamSocket : public TQObject,public net::SocketReader,public net::SocketWriter + class LIBKTORRENT_EXPORT StreamSocket : public TQObject,public net::SocketReader,public net::SocketWriter { TQ_OBJECT diff --git a/src/libktorrent/net/CMakeLists.txt b/src/libktorrent/net/CMakeLists.txt new file mode 100644 index 0000000..27f84f8 --- /dev/null +++ b/src/libktorrent/net/CMakeLists.txt @@ -0,0 +1,13 @@ +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/.. +) + + +##### net library (static) + +tde_add_library( net STATIC_PIC AUTOMOC + SOURCES + address.cpp bufferedsocket.cpp circularbuffer.cpp downloadthread.cpp networkthread.cpp + portlist.cpp socket.cpp socketgroup.cpp socketmonitor.cpp speed.cpp uploadthread.cpp +) diff --git a/src/libktorrent/net/portlist.h b/src/libktorrent/net/portlist.h index c1a6e99..e4a6976 100644 --- a/src/libktorrent/net/portlist.h +++ b/src/libktorrent/net/portlist.h @@ -22,6 +22,7 @@ #include <tqvaluelist.h> #include <util/constants.h> +#include <libktorrent_export.h> namespace net { @@ -31,7 +32,7 @@ namespace net UDP }; - struct Port + struct LIBKTORRENT_EXPORT Port { bt::Uint16 number; Protocol proto; @@ -69,7 +70,7 @@ namespace net * List of ports which are currently being used. * */ - class PortList : public TQValueList<Port> + class LIBKTORRENT_EXPORT PortList : public TQValueList<Port> { PortListener* lst; public: diff --git a/src/libktorrent/net/socketmonitor.h b/src/libktorrent/net/socketmonitor.h index 6fc63c1..aa2aa56 100644 --- a/src/libktorrent/net/socketmonitor.h +++ b/src/libktorrent/net/socketmonitor.h @@ -20,10 +20,10 @@ #ifndef NETSOCKETMONITOR_H #define NETSOCKETMONITOR_H - #include <tqmutex.h> #include <tqptrlist.h> #include <util/constants.h> +#include <libktorrent_export.h> namespace net @@ -40,7 +40,7 @@ namespace net * Monitors all sockets for upload and download traffic. * It uses two threads to do this. */ - class SocketMonitor + class LIBKTORRENT_EXPORT SocketMonitor { static SocketMonitor self; diff --git a/src/libktorrent/pluginmanager.h b/src/libktorrent/pluginmanager.h index b86e521..27511c5 100644 --- a/src/libktorrent/pluginmanager.h +++ b/src/libktorrent/pluginmanager.h @@ -24,6 +24,7 @@ #include <util/ptrmap.h> #include <interfaces/plugin.h> #include <tqstringlist.h> +#include <libktorrent_export.h> namespace kt @@ -38,7 +39,7 @@ namespace kt * * This class manages all plugins. Plugins are stored in a map */ - class PluginManager + class LIBKTORRENT_EXPORT PluginManager { bt::PtrMap<TQString,Plugin> plugins,unloaded; CoreInterface* core; diff --git a/src/libktorrent/pluginmanagerprefpage.cpp b/src/libktorrent/pluginmanagerprefpage.cpp index a426ca4..20651d5 100644 --- a/src/libktorrent/pluginmanagerprefpage.cpp +++ b/src/libktorrent/pluginmanagerprefpage.cpp @@ -211,3 +211,5 @@ namespace kt } } + +#include "pluginmanagerprefpage.moc" diff --git a/src/libktorrent/settings.kcfgc b/src/libktorrent/settings.kcfgc index f6817f5..b283270 100644 --- a/src/libktorrent/settings.kcfgc +++ b/src/libktorrent/settings.kcfgc @@ -4,3 +4,5 @@ ClassName=Settings Singleton=true Mutators=true # will create the necessary code for setting those variables +IncludeFiles=libktorrent_export.h +Visibility=LIBKTORRENT_EXPORT diff --git a/src/libktorrent/torrent/CMakeLists.txt b/src/libktorrent/torrent/CMakeLists.txt new file mode 100644 index 0000000..5760582 --- /dev/null +++ b/src/libktorrent/torrent/CMakeLists.txt @@ -0,0 +1,29 @@ +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/.. + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR}/.. +) + + +##### torrent library (static) + +tde_add_library( torrent STATIC_PIC AUTOMOC + SOURCES + advancedchokealgorithm.cpp announcelist.cpp + authenticate.cpp authenticatebase.cpp authenticationmonitor.cpp bdecoder.cpp + bencoder.cpp bnode.cpp cache.cpp cachefile.cpp cap.cpp choker.cpp chunk.cpp + chunkcounter.cpp chunkdownload.cpp chunkmanager.cpp chunkselector.cpp dndfile.cpp + downloadcap.cpp downloader.cpp globals.cpp httptracker.cpp ipblocklist.cpp + movedatafilesjob.cpp multifilecache.cpp newchokealgorithm.cpp packet.cpp packetreader.cpp + packetwriter.cpp peer.cpp peerdownloader.cpp peerid.cpp peermanager.cpp + peersourcemanager.cpp peeruploader.cpp piece.cpp preallocationthread.cpp queuemanager.cpp + request.cpp server.cpp serverauthenticate.cpp singlefilecache.cpp + speedestimater.cpp statsfile.cpp timeestimator.cpp torrent.cpp torrentcontrol.cpp + torrentcreator.cpp torrentfile.cpp tracker.cpp udptracker.cpp udptrackersocket.cpp + uploadcap.cpp uploader.cpp upspeedestimater.cpp utpex.cpp value.cpp + LINK + net-static datachecker-static mse-static migrate-static util-static + kademlia-static interfaces-static + DEPENDENCIES torrent-static +) diff --git a/src/libktorrent/torrent/authenticationmonitor.h b/src/libktorrent/torrent/authenticationmonitor.h index 43a4ebb..64d824d 100644 --- a/src/libktorrent/torrent/authenticationmonitor.h +++ b/src/libktorrent/torrent/authenticationmonitor.h @@ -22,6 +22,8 @@ #include <list> #include <vector> + +#include <libktorrent_export.h> struct pollfd; @@ -34,7 +36,7 @@ namespace bt Monitors ongoing authentication attempts. This class is a singleton. */ - class AuthenticationMonitor + class LIBKTORRENT_EXPORT AuthenticationMonitor { std::list<AuthenticateBase*> auths; std::vector<struct pollfd> fd_vec; diff --git a/src/libktorrent/torrent/bdecoder.h b/src/libktorrent/torrent/bdecoder.h index 438a656..57bcdf0 100644 --- a/src/libktorrent/torrent/bdecoder.h +++ b/src/libktorrent/torrent/bdecoder.h @@ -22,6 +22,7 @@ #include <tqstring.h> #include <util/constants.h> +#include <libktorrent_export.h> namespace bt { @@ -37,7 +38,7 @@ namespace bt * * Class to decode b-encoded data. */ - class BDecoder + class LIBKTORRENT_EXPORT BDecoder { const TQByteArray & data; Uint32 pos; diff --git a/src/libktorrent/torrent/bencoder.h b/src/libktorrent/torrent/bencoder.h index eb84c39..1338681 100644 --- a/src/libktorrent/torrent/bencoder.h +++ b/src/libktorrent/torrent/bencoder.h @@ -22,6 +22,7 @@ #include <util/file.h> +#include <libktorrent_export.h> namespace bt @@ -79,7 +80,7 @@ namespace bt * the BitTorrent protocol docs. The data gets written to a BEncoderOutput * thing. */ - class BEncoder + class LIBKTORRENT_EXPORT BEncoder { BEncoderOutput* out; bool del; diff --git a/src/libktorrent/torrent/bnode.h b/src/libktorrent/torrent/bnode.h index 84b306e..c8482cd 100644 --- a/src/libktorrent/torrent/bnode.h +++ b/src/libktorrent/torrent/bnode.h @@ -24,6 +24,7 @@ #include <tqvaluelist.h> #include <util/constants.h> #include "value.h" +#include <libktorrent_export.h> namespace bt @@ -37,7 +38,7 @@ namespace bt * There are 3 possible pieces of data in b-encoded piece of data. * This is the base class for all those 3 things. */ - class BNode + class LIBKTORRENT_EXPORT BNode { public: enum Type @@ -79,7 +80,7 @@ namespace bt * * @todo Use TQVariant */ - class BValueNode : public BNode + class LIBKTORRENT_EXPORT BValueNode : public BNode { Value v; public: @@ -95,7 +96,7 @@ namespace bt * @brief Represents a dictionary in bencoded data * */ - class BDictNode : public BNode + class LIBKTORRENT_EXPORT BDictNode : public BNode { struct DictEntry { @@ -157,7 +158,7 @@ namespace bt * @brief Represents a list in bencoded data * */ - class BListNode : public BNode + class LIBKTORRENT_EXPORT BListNode : public BNode { TQPtrList<BNode> children; public: diff --git a/src/libktorrent/torrent/choker.h b/src/libktorrent/torrent/choker.h index b44fc48..9dd4bba 100644 --- a/src/libktorrent/torrent/choker.h +++ b/src/libktorrent/torrent/choker.h @@ -23,6 +23,7 @@ #include <tqptrlist.h> #include <util/constants.h> #include "peer.h" +#include <libktorrent_export.h> namespace kt { @@ -91,7 +92,7 @@ namespace bt * This class handles the choking and unchoking of Peer's. * This class needs to be updated every 10 seconds. */ - class Choker + class LIBKTORRENT_EXPORT Choker { ChokeAlgorithm* choke; PeerManager & pman; diff --git a/src/libktorrent/torrent/chunkmanager.h b/src/libktorrent/torrent/chunkmanager.h index bbf81df..6cb320f 100644 --- a/src/libktorrent/torrent/chunkmanager.h +++ b/src/libktorrent/torrent/chunkmanager.h @@ -27,6 +27,7 @@ #include <util/bitset.h> #include "chunk.h" #include "globals.h" +#include <libktorrent_export.h> class TQStringList; @@ -58,7 +59,7 @@ namespace bt * The chunks are stored in the cache file in the correct order. Eliminating * the need for a file reconstruction algorithm for single files. */ - class ChunkManager : public TQObject + class LIBKTORRENT_EXPORT ChunkManager : public TQObject { TQ_OBJECT diff --git a/src/libktorrent/torrent/downloader.h b/src/libktorrent/torrent/downloader.h index 5cafc6f..9ad8910 100644 --- a/src/libktorrent/torrent/downloader.h +++ b/src/libktorrent/torrent/downloader.h @@ -64,7 +64,7 @@ namespace bt * This class manages the downloading of the file. It should * regurarly be updated. */ - class Downloader : public TQObject + class LIBKTORRENT_EXPORT Downloader : public TQObject { TQ_OBJECT diff --git a/src/libktorrent/torrent/globals.h b/src/libktorrent/torrent/globals.h index 16de41e..11eb051 100644 --- a/src/libktorrent/torrent/globals.h +++ b/src/libktorrent/torrent/globals.h @@ -20,6 +20,7 @@ #ifndef BTGLOBALS_H #define BTGLOBALS_H +#include <libktorrent_export.h> #include <util/constants.h> class TQString; @@ -39,9 +40,7 @@ namespace bt class Log; class Server; - - - class Globals + class LIBKTORRENT_EXPORT Globals { public: virtual ~Globals(); diff --git a/src/libktorrent/torrent/ipblocklist.h b/src/libktorrent/torrent/ipblocklist.h index 6439972..a6a0008 100644 --- a/src/libktorrent/torrent/ipblocklist.h +++ b/src/libktorrent/torrent/ipblocklist.h @@ -21,6 +21,7 @@ #ifndef IPBLOCKLIST_H #define IPBLOCKLIST_H +#include <libktorrent_export.h> #include <interfaces/ipblockinginterface.h> #include <tqmap.h> @@ -31,7 +32,7 @@ class TQString; namespace bt { - class IPKey + class LIBKTORRENT_EXPORT IPKey { public: IPKey(); @@ -60,7 +61,7 @@ namespace bt * * Peers that have sent >= 3 bad chunks are blocked. */ - class IPBlocklist + class LIBKTORRENT_EXPORT IPBlocklist { IPBlocklist(); IPBlocklist(const IPBlocklist & ); diff --git a/src/libktorrent/torrent/peer.h b/src/libktorrent/torrent/peer.h index 549ab5d..8e8b11a 100644 --- a/src/libktorrent/torrent/peer.h +++ b/src/libktorrent/torrent/peer.h @@ -27,6 +27,7 @@ #include <util/bitset.h> #include "globals.h" #include "peerid.h" +#include <libktorrent_export.h> namespace net { @@ -64,7 +65,7 @@ namespace bt * It provides functions for sending packets. Packets it receives * get relayed to the outside world using a bunch of signals. */ - class Peer : public TQObject, public kt::PeerInterface + class LIBKTORRENT_EXPORT Peer : public TQObject, public kt::PeerInterface //,public Object { TQ_OBJECT diff --git a/src/libktorrent/torrent/peerid.cpp b/src/libktorrent/torrent/peerid.cpp index f15d5f2..66e9533 100644 --- a/src/libktorrent/torrent/peerid.cpp +++ b/src/libktorrent/torrent/peerid.cpp @@ -74,7 +74,7 @@ namespace bt return *this; } - bool operator == (const PeerID & a,const PeerID & b) + LIBKTORRENT_EXPORT bool operator == (const PeerID & a,const PeerID & b) { for (int i = 0;i < 20;i++) if (a.id[i] != b.id[i]) @@ -83,12 +83,12 @@ namespace bt return true; } - bool operator != (const PeerID & a,const PeerID & b) + LIBKTORRENT_EXPORT bool operator != (const PeerID & a,const PeerID & b) { return ! operator == (a,b); } - bool operator < (const PeerID & a,const PeerID & b) + LIBKTORRENT_EXPORT bool operator < (const PeerID & a,const PeerID & b) { for (int i = 0;i < 20;i++) if (a.id[i] < b.id[i]) diff --git a/src/libktorrent/torrent/peerid.h b/src/libktorrent/torrent/peerid.h index 8ebea9a..e1bb479 100644 --- a/src/libktorrent/torrent/peerid.h +++ b/src/libktorrent/torrent/peerid.h @@ -21,6 +21,7 @@ #define BTPEERID_H #include <tqstring.h> +#include <libktorrent_export.h> namespace bt { @@ -28,7 +29,7 @@ namespace bt /** @author Joris Guisson */ - class PeerID + class LIBKTORRENT_EXPORT PeerID { char id[20]; TQString client_name; diff --git a/src/libktorrent/torrent/peermanager.h b/src/libktorrent/torrent/peermanager.h index 1a87dbb..5bc785d 100644 --- a/src/libktorrent/torrent/peermanager.h +++ b/src/libktorrent/torrent/peermanager.h @@ -53,7 +53,7 @@ namespace bt * This class manages all Peer objects. * It can also open connections to other peers. */ - class PeerManager : public TQObject + class LIBKTORRENT_EXPORT PeerManager : public TQObject { TQ_OBJECT diff --git a/src/libktorrent/torrent/queuemanager.h b/src/libktorrent/torrent/queuemanager.h index 96bc586..3618c7a 100644 --- a/src/libktorrent/torrent/queuemanager.h +++ b/src/libktorrent/torrent/queuemanager.h @@ -26,6 +26,7 @@ #include <tqptrlist.h> #include <interfaces/torrentinterface.h> +#include <libktorrent_export.h> namespace kt { @@ -53,7 +54,7 @@ namespace bt * @author Ivan Vasic * @brief This class contains list of all TorrentControls and is responsible for starting/stopping them */ - class QueueManager : public TQObject + class LIBKTORRENT_EXPORT QueueManager : public TQObject { TQ_OBJECT diff --git a/src/libktorrent/torrent/server.h b/src/libktorrent/torrent/server.h index 6d994a2..600685c 100644 --- a/src/libktorrent/torrent/server.h +++ b/src/libktorrent/torrent/server.h @@ -23,6 +23,7 @@ #include <tqptrlist.h> #include <tqobject.h> #include "globals.h" +#include <libktorrent_export.h> namespace bt { @@ -42,7 +43,7 @@ namespace bt * All PeerManager's should register with this class when they * are created and should unregister when they are destroyed. */ - class Server : public TQObject + class LIBKTORRENT_EXPORT Server : public TQObject { TQ_OBJECT diff --git a/src/libktorrent/torrent/serverauthenticate.h b/src/libktorrent/torrent/serverauthenticate.h index 63ebff8..bb82e39 100644 --- a/src/libktorrent/torrent/serverauthenticate.h +++ b/src/libktorrent/torrent/serverauthenticate.h @@ -21,6 +21,7 @@ #define BTSERVERAUTHENTICATE_H #include "authenticatebase.h" +#include <libktorrent_export.h> namespace bt { @@ -35,7 +36,7 @@ namespace bt * Once the authentication is finished, the socket gets handed over * to the right PeerManager. */ - class ServerAuthenticate : public AuthenticateBase + class LIBKTORRENT_EXPORT ServerAuthenticate : public AuthenticateBase { TQ_OBJECT diff --git a/src/libktorrent/torrent/torrent.h b/src/libktorrent/torrent/torrent.h index 05c28cc..5ed623c 100644 --- a/src/libktorrent/torrent/torrent.h +++ b/src/libktorrent/torrent/torrent.h @@ -29,6 +29,7 @@ #include "globals.h" #include "peerid.h" #include "torrentfile.h" +#include <libktorrent_export.h> @@ -62,7 +63,7 @@ namespace bt * Loads a torrent file and calculates some miscelanious other data, * like the info_hash and the peer_id. */ - class Torrent + class LIBKTORRENT_EXPORT Torrent { public: Torrent(); diff --git a/src/libktorrent/torrent/torrentcontrol.h b/src/libktorrent/torrent/torrentcontrol.h index 14fd6f6..def2361 100644 --- a/src/libktorrent/torrent/torrentcontrol.h +++ b/src/libktorrent/torrent/torrentcontrol.h @@ -30,6 +30,7 @@ #include <interfaces/torrentinterface.h> #include <interfaces/monitorinterface.h> #include <interfaces/trackerslist.h> +#include <libktorrent_export.h> class TQStringList; class TQString; @@ -65,7 +66,7 @@ namespace bt * This class controls the uploading, downloading, choking, * updating the tracker and chunk management. */ - class TorrentControl : public kt::TorrentInterface + class LIBKTORRENT_EXPORT TorrentControl : public kt::TorrentInterface { TQ_OBJECT diff --git a/src/libktorrent/torrent/torrentcreator.h b/src/libktorrent/torrent/torrentcreator.h index e1e2545..4f1599c 100644 --- a/src/libktorrent/torrent/torrentcreator.h +++ b/src/libktorrent/torrent/torrentcreator.h @@ -23,6 +23,7 @@ #include <tqstringlist.h> #include "torrent.h" #include <util/sha1hash.h> +#include <libktorrent_export.h> namespace bt { @@ -37,7 +38,7 @@ namespace bt * It also allows to create a TorrentControl object, so * that we immediately can start to share the torrent. */ - class TorrentCreator + class LIBKTORRENT_EXPORT TorrentCreator { // input values TQString target; diff --git a/src/libktorrent/torrent/tracker.h b/src/libktorrent/torrent/tracker.h index 72c9468..5f35b04 100644 --- a/src/libktorrent/torrent/tracker.h +++ b/src/libktorrent/torrent/tracker.h @@ -41,7 +41,7 @@ namespace bt /** * Base class for all tracker classes. */ - class Tracker : public kt::PeerSource + class LIBKTORRENT_EXPORT Tracker : public kt::PeerSource { TQ_OBJECT diff --git a/src/libktorrent/torrent/udptrackersocket.h b/src/libktorrent/torrent/udptrackersocket.h index 5b48f18..fadbc38 100644 --- a/src/libktorrent/torrent/udptrackersocket.h +++ b/src/libktorrent/torrent/udptrackersocket.h @@ -24,6 +24,7 @@ #include <tqmap.h> #include <tqcstring.h> #include <util/constants.h> +#include <libktorrent_export.h> namespace KNetwork @@ -51,7 +52,7 @@ namespace bt * * Class which handles communication with one or more UDP trackers. */ - class UDPTrackerSocket : public TQObject + class LIBKTORRENT_EXPORT UDPTrackerSocket : public TQObject { TQ_OBJECT diff --git a/src/libktorrent/util/CMakeLists.txt b/src/libktorrent/util/CMakeLists.txt new file mode 100644 index 0000000..fb8fa30 --- /dev/null +++ b/src/libktorrent/util/CMakeLists.txt @@ -0,0 +1,24 @@ +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/.. + ${CMAKE_CURRENT_BINARY_DIR} +) + + +##### check for profiling support + +if( WITH_PROFILING_SUPPORT ) + add_definitions(-DKT_PROFILE ) +endif( ) + + +##### util library (static) + +tde_add_library( util STATIC_PIC AUTOMOC + SOURCES + array.cpp autorotatelogjob.cpp bitset.cpp error.cpp file.cpp fileops.cpp functions.cpp + httprequest.cpp log.cpp mmapfile.cpp profiler.cpp ptrmap.cpp sha1hash.cpp sha1hashgen.cpp + timer.cpp urlencoder.cpp waitjob.cpp + LINK + torrent-static +) diff --git a/src/libktorrent/util/bitset.h b/src/libktorrent/util/bitset.h index 32e7e48..54910ec 100644 --- a/src/libktorrent/util/bitset.h +++ b/src/libktorrent/util/bitset.h @@ -21,6 +21,7 @@ #define BTBITSET_H #include "constants.h" +#include <libktorrent_export.h> namespace bt { @@ -32,7 +33,7 @@ namespace bt * Simple implementation of a BitSet, can only turn on and off bits. * BitSet's are used to indicate which chunks we have or not. */ - class BitSet + class LIBKTORRENT_EXPORT BitSet { Uint32 num_bits,num_bytes; Uint8* data; diff --git a/src/libktorrent/util/error.h b/src/libktorrent/util/error.h index 49aa95d..337c01a 100644 --- a/src/libktorrent/util/error.h +++ b/src/libktorrent/util/error.h @@ -21,6 +21,7 @@ #define BTERROR_H #include <tqstring.h> +#include <libktorrent_export.h> namespace bt { @@ -28,7 +29,7 @@ namespace bt /** @author Joris Guisson */ - class Error + class LIBKTORRENT_EXPORT Error { TQString msg; public: diff --git a/src/libktorrent/util/file.h b/src/libktorrent/util/file.h index c6567f8..40fd18b 100644 --- a/src/libktorrent/util/file.h +++ b/src/libktorrent/util/file.h @@ -23,6 +23,7 @@ #include <stdio.h> #include <tqstring.h> #include "constants.h" +#include <libktorrent_export.h> namespace bt { @@ -33,7 +34,7 @@ namespace bt * * Wrapper class for stdio's FILE. */ - class File + class LIBKTORRENT_EXPORT File { FILE* fptr; TQString file; diff --git a/src/libktorrent/util/fileops.h b/src/libktorrent/util/fileops.h index d1c3437..592ecd3 100644 --- a/src/libktorrent/util/fileops.h +++ b/src/libktorrent/util/fileops.h @@ -25,6 +25,8 @@ #endif #include <util/constants.h> +#include <libktorrent_export.h> + class TQString; namespace bt @@ -37,7 +39,7 @@ namespace bt * @param nothrow wether or not we shouldn't throw an Error upon failure * @throw Error upon error */ - void MakeDir(const TQString & dir,bool nothrow = false); + LIBKTORRENT_EXPORT void MakeDir(const TQString & dir,bool nothrow = false); /** * Create a symbolic link @a link_url which links to @a link_to @@ -45,7 +47,7 @@ namespace bt * @param link_url The link url * @param nothrow wether or not we shouldn't throw an Error upon failure */ - void SymLink(const TQString & link_to,const TQString & link_url,bool nothrow = false); + LIBKTORRENT_EXPORT void SymLink(const TQString & link_to,const TQString & link_url,bool nothrow = false); /** * Move a file/dir from one location to another @@ -53,7 +55,7 @@ namespace bt * @param dst The destination file / directory * @param nothrow wether or not we shouldn't throw an Error upon failure */ - void Move(const TQString & src,const TQString & dst,bool nothrow = false); + LIBKTORRENT_EXPORT void Move(const TQString & src,const TQString & dst,bool nothrow = false); /** * Copy a file. @@ -61,7 +63,7 @@ namespace bt * @param dst The destination dir/file * @param nothrow wether or not we shouldn't throw an Error upon failure */ - void CopyFile(const TQString & src,const TQString & dst,bool nothrow = false); + LIBKTORRENT_EXPORT void CopyFile(const TQString & src,const TQString & dst,bool nothrow = false); /** * Copy a file or directory @@ -69,21 +71,21 @@ namespace bt * @param dst The destination dir/file * @param nothrow wether or not we shouldn't throw an Error upon failure */ - void CopyDir(const TQString & src,const TQString & dst,bool nothrow = false); + LIBKTORRENT_EXPORT void CopyDir(const TQString & src,const TQString & dst,bool nothrow = false); /** * Check wether a file/dir exists * @param url The file/dir * @return true if it exits */ - bool Exists(const TQString & url); + LIBKTORRENT_EXPORT bool Exists(const TQString & url); /** * Delete a file or directory. * @param url The url of the file/dir * @param nothrow wether or not we shouldn't throw an Error upon failure */ - void Delete(const TQString & url,bool nothrow = false); + LIBKTORRENT_EXPORT void Delete(const TQString & url,bool nothrow = false); /** * Try to create a file. Doesn't do anything if the file @@ -91,7 +93,7 @@ namespace bt * @param url The url of the file * @param nothrow wether or not we shouldn't throw an Error upon failure */ - void Touch(const TQString & url,bool nothrow = false); + LIBKTORRENT_EXPORT void Touch(const TQString & url,bool nothrow = false); /** * Calculates the size of a file @@ -99,7 +101,7 @@ namespace bt * @return The size of the file * @throw Error if the file doesn't exist, or something else goes wrong */ - Uint64 FileSize(const TQString & url); + LIBKTORRENT_EXPORT Uint64 FileSize(const TQString & url); /** * Get the size of a file. @@ -107,7 +109,7 @@ namespace bt * @return The size * @throw Error if the file doesn't exist, or something else goes wrong */ - Uint64 FileSize(int fd); + LIBKTORRENT_EXPORT Uint64 FileSize(int fd); /** * Truncate a file (wrapper around ftruncate) @@ -115,7 +117,7 @@ namespace bt * @param size The size to truncate to * @throw Error if the file doesn't exist, or something else goes wrong */ - void TruncateFile(int fd,Uint64 size,bool quick); + LIBKTORRENT_EXPORT void TruncateFile(int fd,Uint64 size,bool quick); /** * Truncate a file (wrapper around ftruncate) @@ -124,28 +126,28 @@ namespace bt * @param quick Use the quick way (doesn't prevent fragmentationt) * @throw Error if the file doesn't exist, or something else goes wrong */ - void TruncateFile(const TQString & path,Uint64 size); + LIBKTORRENT_EXPORT void TruncateFile(const TQString & path,Uint64 size); /** * Special truncate for FAT file systems. */ - bool FatPreallocate(int fd,Uint64 size); + LIBKTORRENT_EXPORT bool FatPreallocate(int fd,Uint64 size); /** * Special truncate for FAT file systems. */ - bool FatPreallocate(const TQString & path,Uint64 size); + LIBKTORRENT_EXPORT bool FatPreallocate(const TQString & path,Uint64 size); #ifdef HAVE_XFS_XFS_H /** * Special truncate for XFS file systems. */ - bool XfsPreallocate(int fd,Uint64 size); + LIBKTORRENT_EXPORT bool XfsPreallocate(int fd,Uint64 size); /** * Special truncate for XFS file systems. */ - bool XfsPreallocate(const TQString & path,Uint64 size); + LIBKTORRENT_EXPORT bool XfsPreallocate(const TQString & path,Uint64 size); #endif @@ -156,10 +158,10 @@ namespace bt * @param whence Position to seek from * @throw Error if something else goes wrong */ - void SeekFile(int fd,Int64 off,int whence); + LIBKTORRENT_EXPORT void SeekFile(int fd,Int64 off,int whence); /// Calculate the number of bytes free on the filesystem path is located - bool FreeDiskSpace(const TQString & path,Uint64 & bytes_free); + LIBKTORRENT_EXPORT bool FreeDiskSpace(const TQString & path,Uint64 & bytes_free); } #endif diff --git a/src/libktorrent/util/functions.h b/src/libktorrent/util/functions.h index 9295b83..97bb3fe 100644 --- a/src/libktorrent/util/functions.h +++ b/src/libktorrent/util/functions.h @@ -21,6 +21,7 @@ #define BTFUNCTIONS_H #include "constants.h" +#include <libktorrent_export.h> class TQString; class TQHostAddress; @@ -29,44 +30,43 @@ class KURL; namespace bt { - void WriteUint64(Uint8* buf,Uint32 off,Uint64 val); - Uint64 ReadUint64(const Uint8* buf,Uint64 off); + LIBKTORRENT_EXPORT void WriteUint64(Uint8* buf,Uint32 off,Uint64 val); + LIBKTORRENT_EXPORT Uint64 ReadUint64(const Uint8* buf,Uint64 off); - void WriteUint32(Uint8* buf,Uint32 off,Uint32 val); - Uint32 ReadUint32(const Uint8* buf,Uint32 off); + LIBKTORRENT_EXPORT void WriteUint32(Uint8* buf,Uint32 off,Uint32 val); + LIBKTORRENT_EXPORT Uint32 ReadUint32(const Uint8* buf,Uint32 off); - void WriteUint16(Uint8* buf,Uint32 off,Uint16 val); - Uint16 ReadUint16(const Uint8* buf,Uint32 off); - + LIBKTORRENT_EXPORT void WriteUint16(Uint8* buf,Uint32 off,Uint16 val); + LIBKTORRENT_EXPORT Uint16 ReadUint16(const Uint8* buf,Uint32 off); - void WriteInt64(Uint8* buf,Uint32 off,Int64 val); - Int64 ReadInt64(const Uint8* buf,Uint32 off); + LIBKTORRENT_EXPORT void WriteInt64(Uint8* buf,Uint32 off,Int64 val); + LIBKTORRENT_EXPORT Int64 ReadInt64(const Uint8* buf,Uint32 off); - void WriteInt32(Uint8* buf,Uint32 off,Int32 val); - Int32 ReadInt32(const Uint8* buf,Uint32 off); + LIBKTORRENT_EXPORT void WriteInt32(Uint8* buf,Uint32 off,Int32 val); + LIBKTORRENT_EXPORT Int32 ReadInt32(const Uint8* buf,Uint32 off); - void WriteInt16(Uint8* buf,Uint32 off,Int16 val); - Int16 ReadInt16(const Uint8* buf,Uint32 off); + LIBKTORRENT_EXPORT void WriteInt16(Uint8* buf,Uint32 off,Int16 val); + LIBKTORRENT_EXPORT Int16 ReadInt16(const Uint8* buf,Uint32 off); - void UpdateCurrentTime(); + LIBKTORRENT_EXPORT void UpdateCurrentTime(); - extern TimeStamp global_time_stamp; + LIBKTORRENT_EXPORT extern TimeStamp global_time_stamp; inline TimeStamp GetCurrentTime() {return global_time_stamp;} - TimeStamp Now(); + LIBKTORRENT_EXPORT TimeStamp Now(); - TQHostAddress LookUpHost(const TQString & host); - TQString DirSeparator(); - bool IsMultimediaFile(const TQString & filename); + LIBKTORRENT_EXPORT TQHostAddress LookUpHost(const TQString & host); + LIBKTORRENT_EXPORT TQString DirSeparator(); + LIBKTORRENT_EXPORT bool IsMultimediaFile(const TQString & filename); /** * Maximize the file and memory limits using setrlimit. */ - bool MaximizeLimits(); + LIBKTORRENT_EXPORT bool MaximizeLimits(); /// Get the maximum number of open files - Uint32 MaxOpenFiles(); + LIBKTORRENT_EXPORT Uint32 MaxOpenFiles(); } #endif diff --git a/src/libktorrent/util/httprequest.h b/src/libktorrent/util/httprequest.h index fd9e7b7..0116e79 100644 --- a/src/libktorrent/util/httprequest.h +++ b/src/libktorrent/util/httprequest.h @@ -38,7 +38,7 @@ namespace bt * connect to the right signals and forget about it. After the reply has been received or * an error occurred, the appropriate signal will be emitted. */ - class HTTPRequest : public kt::ExitOperation + class LIBKTORRENT_EXPORT HTTPRequest : public kt::ExitOperation { TQ_OBJECT diff --git a/src/libktorrent/util/log.cpp b/src/libktorrent/util/log.cpp index ff83f1d..281122b 100644 --- a/src/libktorrent/util/log.cpp +++ b/src/libktorrent/util/log.cpp @@ -119,7 +119,7 @@ namespace bt *out << TQDateTime::currentDateTime().toString() << ": " << tmp << ::endl; fptr.flush(); if (to_cout) - std::cout << TQString(tmp.local8Bit()) << std::endl; + std::cout << tmp.local8Bit() << std::endl; if (monitors.count() > 0) { diff --git a/src/libktorrent/util/log.h b/src/libktorrent/util/log.h index 742b753..62260b7 100644 --- a/src/libktorrent/util/log.h +++ b/src/libktorrent/util/log.h @@ -23,6 +23,7 @@ #include "constants.h" +#include <libktorrent_export.h> #include <tqstring.h> // LOG MESSAGES CONSTANTS @@ -75,7 +76,7 @@ namespace bt * There is also the possibility to monitor what is written to the log using * the LogMonitorInterface class. */ - class Log + class LIBKTORRENT_EXPORT Log { class Private; @@ -195,10 +196,10 @@ namespace bt void logRotateDone(); }; - Log & endl(Log & lg); + LIBKTORRENT_EXPORT Log & endl(Log & lg); - Log & Out(unsigned int arg = 0x00); + LIBKTORRENT_EXPORT Log & Out(unsigned int arg = 0x00); inline Log & GenOut(unsigned int arg) {return Out(SYS_GEN|arg);} inline Log & DHTOut(unsigned int arg) {return Out(SYS_DHT|arg);} inline Log & ConOut(unsigned int arg) {return Out(SYS_CON|arg);} diff --git a/src/libktorrent/util/mmapfile.h b/src/libktorrent/util/mmapfile.h index 4d68fd2..78ccf4c 100644 --- a/src/libktorrent/util/mmapfile.h +++ b/src/libktorrent/util/mmapfile.h @@ -21,6 +21,7 @@ #define BTMMAPFILE_H +#include <libktorrent_export.h> #include <tqstring.h> #include <util/constants.h> @@ -35,11 +36,12 @@ namespace bt * File. * TODO: make sure large files work (not really needed for the blocklist) */ - class MMapFile + class LIBKTORRENT_EXPORT MMapFile { public: MMapFile(); - virtual ~MMapFile(); + //virtual + ~MMapFile(); enum Mode { diff --git a/src/libktorrent/util/sha1hash.cpp b/src/libktorrent/util/sha1hash.cpp index 6cdbbc4..00a1bb2 100644 --- a/src/libktorrent/util/sha1hash.cpp +++ b/src/libktorrent/util/sha1hash.cpp @@ -115,7 +115,7 @@ namespace bt return k; } - bool operator < (const SHA1Hash & a,const SHA1Hash & b) + LIBKTORRENT_EXPORT bool operator < (const SHA1Hash & a,const SHA1Hash & b) { for (int i = 0;i < 20;i++) { diff --git a/src/libktorrent/util/sha1hash.h b/src/libktorrent/util/sha1hash.h index dba66c9..5363555 100644 --- a/src/libktorrent/util/sha1hash.h +++ b/src/libktorrent/util/sha1hash.h @@ -22,6 +22,7 @@ #include <tqcstring.h> #include "constants.h" +#include <libktorrent_export.h> class TQString; @@ -36,7 +37,7 @@ namespace bt * This class keeps track of a SHA1 hash. A SHA1 hash is a 20 byte * array of bytes. */ - class SHA1Hash + class LIBKTORRENT_EXPORT SHA1Hash { protected: Uint8 hash[20]; diff --git a/src/libktorrent/util/waitjob.h b/src/libktorrent/util/waitjob.h index 6f9bdd5..04508f4 100644 --- a/src/libktorrent/util/waitjob.h +++ b/src/libktorrent/util/waitjob.h @@ -35,7 +35,7 @@ namespace bt * Job to wait for a certain amount of time or until one or more ExitOperation's have * finished. */ - class WaitJob : public TDEIO::Job + class LIBKTORRENT_EXPORT WaitJob : public TDEIO::Job { TQ_OBJECT |
