From 19c043ed848f4b7233f6bb4d1f5b16dac22d91ae Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Fri, 31 Dec 2010 19:44:51 +0000 Subject: [PATCH] (trunk qt) #3836 "libevent2 support" -- add a mechanism to make it easier to build the Qt client with custom installs of libevent2 --- qt/qtr.pro | 6 +++++- qt/session.cc | 6 ++++-- qt/session.h | 3 ++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/qt/qtr.pro b/qt/qtr.pro index b634a122b..732c24d1b 100644 --- a/qt/qtr.pro +++ b/qt/qtr.pro @@ -15,13 +15,17 @@ CONFIG += qt qdbus thread debug link_pkgconfig QT += network PKGCONFIG = fontconfig libcurl openssl dbus-1 +# if you have libevent2 installed in a custom path, specify it here +EVENT_TOP = /usr +INCLUDEPATH = $${EVENT_TOP}/include $${INCLUDEPATH} + TRANSMISSION_TOP = .. INCLUDEPATH += $${TRANSMISSION_TOP} LIBS += $${TRANSMISSION_TOP}/libtransmission/libtransmission.a LIBS += $${TRANSMISSION_TOP}/third-party/dht/libdht.a LIBS += $${TRANSMISSION_TOP}/third-party/miniupnp/libminiupnp.a LIBS += $${TRANSMISSION_TOP}/third-party/libnatpmp/libnatpmp.a -unix: LIBS += -levent -lz +unix: LIBS += -L$${EVENT_TOP}/lib -levent -lz win32:DEFINES += QT_DBUS win32:LIBS += -levent -lws2_32 -lintl win32:LIBS += -lidn -liconv -lwldap32 -liphlpapi diff --git a/qt/session.cc b/qt/session.cc index fd84bdd87..37e4f473e 100644 --- a/qt/session.cc +++ b/qt/session.cc @@ -30,6 +30,8 @@ #include +#include + #include #include #include @@ -662,11 +664,11 @@ Session :: exec( const tr_benc * request ) } void -Session :: localSessionCallback( tr_session * session, const char * json, size_t len, void * self ) +Session :: localSessionCallback( tr_session * session, struct evbuffer * json, void * self ) { Q_UNUSED( session ); - ((Session*)self)->parseResponse( json, len ); + ((Session*)self)->parseResponse( (const char*) evbuffer_pullup( json, -1 ), evbuffer_get_length( json ) ); } #define REQUEST_DATA_PROPERTY_KEY "requestData" diff --git a/qt/session.h b/qt/session.h index eaa9a412a..7ca329e0e 100644 --- a/qt/session.h +++ b/qt/session.h @@ -29,6 +29,7 @@ class AddData; extern "C" { + struct evbuffer; struct tr_benc; } @@ -74,7 +75,7 @@ class Session: public QObject void updateStats( struct tr_benc * args ); void updateInfo( struct tr_benc * args ); void parseResponse( const char * json, size_t len ); - static void localSessionCallback( tr_session *, const char *, size_t, void * ); + static void localSessionCallback( tr_session *, struct evbuffer *, void * ); public: void exec( const char * json );