summaryrefslogtreecommitdiff
path: root/qt4/TelepathyQt4/Farsight
diff options
context:
space:
mode:
Diffstat (limited to 'qt4/TelepathyQt4/Farsight')
-rw-r--r--qt4/TelepathyQt4/Farsight/CMakeLists.txt52
-rw-r--r--qt4/TelepathyQt4/Farsight/Channel13
-rw-r--r--qt4/TelepathyQt4/Farsight/channel.cpp87
-rw-r--r--qt4/TelepathyQt4/Farsight/channel.h43
-rw-r--r--qt4/TelepathyQt4/Farsight/global.h46
5 files changed, 241 insertions, 0 deletions
diff --git a/qt4/TelepathyQt4/Farsight/CMakeLists.txt b/qt4/TelepathyQt4/Farsight/CMakeLists.txt
new file mode 100644
index 000000000..f32831e42
--- /dev/null
+++ b/qt4/TelepathyQt4/Farsight/CMakeLists.txt
@@ -0,0 +1,52 @@
+if(FARSIGHT_COMPONENTS_FOUND)
+ include_directories(${TELEPATHY_FARSIGHT_INCLUDE_DIR}
+ ${GSTREAMER_INCLUDE_DIR}
+ ${GLIB2_INCLUDE_DIR}
+ ${LIBXML2_INCLUDE_DIR}
+ ${DBUS_INCLUDE_DIR})
+
+ # It gets inherited from the previous directory, hence it has to be removed explicitely
+ remove_definitions(-DBUILDING_TELEPATHY_QT4)
+ # We are building Telepathy-Qt4-Farsight
+ add_definitions(-DBUILDING_TELEPATHY_QT4_FARSIGHT -DQT_NO_KEYWORDS)
+
+ set(telepathy_qt4_farsight_SRCS
+ channel.cpp)
+
+ set(telepathy_qt4_farsight_HEADERS
+ Channel
+ channel.h
+ global.h)
+
+ # Create the library
+ if (ENABLE_COMPILER_COVERAGE)
+ add_library(telepathy-qt4-farsight STATIC ${telepathy_qt4_farsight_SRCS})
+ else (ENABLE_COMPILER_COVERAGE)
+ add_library(telepathy-qt4-farsight SHARED ${telepathy_qt4_farsight_SRCS})
+ endif (ENABLE_COMPILER_COVERAGE)
+ # Link
+ target_link_libraries(telepathy-qt4-farsight
+ ${QT_QTDBUS_LIBRARY}
+ ${QT_QTCORE_LIBRARY}
+ ${TELEPATHY_FARSIGHT_LIBRARIES}
+ ${GSTREAMER_INTERFACE_LIBRARY}
+ telepathy-qt4)
+
+ # Set the correct version number
+ set_target_properties(telepathy-qt4-farsight PROPERTIES
+ SOVERSION ${TP_QT4_ABI_VERSION}
+ VERSION ${TP_QT4_LIBRARY_VERSION})
+
+ # Install the library - watch out for the correct components
+ if (WIN32)
+ install(TARGETS telepathy-qt4-farsight RUNTIME DESTINATION ${LIB_INSTALL_DIR} COMPONENT farsight
+ ARCHIVE DESTINATION ${LIB_INSTALL_DIR} COMPONENT farsight_headers)
+ else (WIN32)
+ install(TARGETS telepathy-qt4-farsight LIBRARY DESTINATION ${LIB_INSTALL_DIR} COMPONENT farsight
+ ARCHIVE DESTINATION ${LIB_INSTALL_DIR} COMPONENT farsight_headers)
+ endif (WIN32)
+
+ # Install headers
+ install(FILES ${telepathy_qt4_farsight_HEADERS} DESTINATION ${INCLUDE_INSTALL_DIR}/telepathy-1.0/TelepathyQt4/Farsight
+ COMPONENT farsight_headers)
+endif(FARSIGHT_COMPONENTS_FOUND)
diff --git a/qt4/TelepathyQt4/Farsight/Channel b/qt4/TelepathyQt4/Farsight/Channel
new file mode 100644
index 000000000..aa4c93ef5
--- /dev/null
+++ b/qt4/TelepathyQt4/Farsight/Channel
@@ -0,0 +1,13 @@
+#ifndef _TelepathyQt4_Farsight_Channel_HEADER_GUARD_
+#define _TelepathyQt4_Farsight_Channel_HEADER_GUARD_
+
+#ifndef IN_TELEPATHY_QT4_HEADER
+#define IN_TELEPATHY_QT4_HEADER
+#endif
+
+#include <TelepathyQt4/Farsight/channel.h>
+
+#undef IN_TELEPATHY_QT4_HEADER
+
+#endif
+// vim:set ft=cpp:
diff --git a/qt4/TelepathyQt4/Farsight/channel.cpp b/qt4/TelepathyQt4/Farsight/channel.cpp
new file mode 100644
index 000000000..069fb8048
--- /dev/null
+++ b/qt4/TelepathyQt4/Farsight/channel.cpp
@@ -0,0 +1,87 @@
+/**
+ * This file is part of TelepathyQt4
+ *
+ * @copyright Copyright (C) 2009 Collabora Ltd. <http://www.collabora.co.uk/>
+ * @copyright Copyright (C) 2009 Nokia Corporation
+ * @license LGPL 2.1
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <TelepathyQt4/Farsight/Channel>
+
+#include "TelepathyQt4/debug-internal.h"
+
+#include <TelepathyQt4/Channel>
+#include <TelepathyQt4/Connection>
+#include <TelepathyQt4/StreamedMediaChannel>
+
+#include <telepathy-glib/channel.h>
+#include <telepathy-glib/connection.h>
+#include <telepathy-glib/dbus.h>
+
+namespace Tp
+{
+
+TfChannel *createFarsightChannel(const StreamedMediaChannelPtr &channel)
+{
+ if (!channel->handlerStreamingRequired()) {
+ warning() << "Handler streaming not required";
+ return 0;
+ }
+
+ TpDBusDaemon *dbus = tp_dbus_daemon_dup(0);
+
+ if (!dbus) {
+ warning() << "Unable to connect to D-Bus";
+ return 0;
+ }
+
+ ConnectionPtr connection = channel->connection();
+
+ TpConnection *gconnection = tp_connection_new(dbus,
+ connection->busName().toAscii(),
+ connection->objectPath().toAscii(),
+ 0);
+ g_object_unref(dbus);
+ dbus = 0;
+
+ if (!gconnection) {
+ warning() << "Unable to construct TpConnection";
+ return 0;
+ }
+
+ TpChannel *gchannel = tp_channel_new(gconnection,
+ channel->objectPath().toAscii(),
+ TELEPATHY_INTERFACE_CHANNEL_TYPE_STREAMED_MEDIA,
+ (TpHandleType) channel->targetHandleType(),
+ channel->targetHandle(),
+ 0);
+ g_object_unref(gconnection);
+ gconnection = 0;
+
+ if (!gchannel) {
+ warning() << "Unable to construct TpChannel";
+ return 0;
+ }
+
+ TfChannel *ret = tf_channel_new(gchannel);
+ g_object_unref(gchannel);
+ gchannel = 0;
+
+ return ret;
+}
+
+} // Tp
diff --git a/qt4/TelepathyQt4/Farsight/channel.h b/qt4/TelepathyQt4/Farsight/channel.h
new file mode 100644
index 000000000..8476d0d75
--- /dev/null
+++ b/qt4/TelepathyQt4/Farsight/channel.h
@@ -0,0 +1,43 @@
+/**
+ * This file is part of TelepathyQt4
+ *
+ * @copyright Copyright (C) 2009 Collabora Ltd. <http://www.collabora.co.uk/>
+ * @copyright Copyright (C) 2009 Nokia Corporation
+ * @license LGPL 2.1
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef _TelepathyQt4_Farsight_channel_h_HEADER_GUARD_
+#define _TelepathyQt4_Farsight_channel_h_HEADER_GUARD_
+
+#ifndef IN_TELEPATHY_QT4_HEADER
+#error IN_TELEPATHY_QT4_HEADER
+#endif
+
+#include <TelepathyQt4/Farsight/global.h>
+
+#include <TelepathyQt4/Types>
+
+#include <telepathy-farsight/channel.h>
+
+namespace Tp
+{
+
+TELEPATHY_QT4_FS_EXPORT TfChannel *createFarsightChannel(const StreamedMediaChannelPtr &channel);
+
+} // Tp
+
+#endif
diff --git a/qt4/TelepathyQt4/Farsight/global.h b/qt4/TelepathyQt4/Farsight/global.h
new file mode 100644
index 000000000..f3754ae31
--- /dev/null
+++ b/qt4/TelepathyQt4/Farsight/global.h
@@ -0,0 +1,46 @@
+/**
+ * This file is part of TelepathyQt4
+ *
+ * @copyright Copyright (C) 2009 Collabora Ltd. <http://www.collabora.co.uk/>
+ * @copyright Copyright (C) 2009 Nokia Corporation
+ * @license LGPL 2.1
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef _TelepathyQt4_Farsight_global_h_HEADER_GUARD_
+#define _TelepathyQt4_Farsight_global_h_HEADER_GUARD_
+
+#ifndef IN_TELEPATHY_QT4_HEADER
+#error IN_TELEPATHY_QT4_HEADER
+#endif
+
+#include <QtGlobal>
+
+#ifdef BUILDING_TELEPATHY_QT4_FARSIGHT
+# define TELEPATHY_QT4_FS_EXPORT Q_DECL_EXPORT
+#else
+# define TELEPATHY_QT4_FS_EXPORT Q_DECL_IMPORT
+#endif
+
+#if !defined(Q_OS_WIN) && defined(QT_VISIBILITY_AVAILABLE)
+# define TELEPATHY_QT4_FS_NO_EXPORT __attribute__((visibility("hidden")))
+#endif
+
+#ifndef TELEPATHY_QT4_FS_NO_EXPORT
+# define TELEPATHY_QT4_FS_NO_EXPORT
+#endif
+
+#endif