|
View:
New views
1 Messages
—
Rating Filter:
Alert me
|
|
|
[patch] dbus support for kaffeine
Hello guys,
I am since the very beginning of kaffeine a great fan of this application and use it for watching movies and TV. In the new version, I miss a dbus interface to be able to use my remote control for watching TV. As I know a little bit of C++ and Qt, I decided to implement the dbus features for kaffeine, btw. giving me the occasion to learn how to do this. Here is a small patch which makes two functions of dvbtab.cpp available for dbus: previousChannel() and nextChannel(). It is just a minimal proof of principle, to show you how I would implement the dbus functionality. I would be really happy to contribute to this cool project, so if you are interested in my code, please tell me. I would add dbus support for all functions which should be accessible from the outside world. For my developer background, I like to contribute with mostly small patches to various open-source projects, and I am the guy from this project: http://www.bongosoft.de (german page!). Newly, I also started this one: http://www.kde-look.org/content/show.php/Babeleo+translator?content=110491 In "real life" I am about to finalize a Ph.D. in bioinformatics in the nice town of Freiburg/Germany... I am both French and German, so you can talk to me in any of these languages, naturally also in English. The patch is against revision 1042616 of the SVN tree. greetings, Pascal diff -Naur ../kaffeine_ori/src/CMakeLists.txt ./src/CMakeLists.txt --- ../kaffeine_ori/src/CMakeLists.txt 2009-10-30 10:34:30.000000000 +0100 +++ ./src/CMakeLists.txt 2009-10-30 11:08:47.000000000 +0100 @@ -2,6 +2,7 @@ dvb/dvbchannel.cpp dvb/dvbchannelui.cpp dvb/dvbconfigdialog.cpp + dvb/dvbdbusadaptor.cpp dvb/dvbdevice.cpp dvb/dvbepg.cpp dvb/dvbmanager.cpp diff -Naur ../kaffeine_ori/src/dvb/dvbdbusadaptor.cpp ./src/dvb/dvbdbusadaptor.cpp --- ../kaffeine_ori/src/dvb/dvbdbusadaptor.cpp 1970-01-01 01:00:00.000000000 +0100 +++ ./src/dvb/dvbdbusadaptor.cpp 2009-10-30 11:08:47.000000000 +0100 @@ -0,0 +1,19 @@ +#include "dvbdbusadaptor.h" +#include "dvbtab.h" + + +dvbdbusadaptor::dvbdbusadaptor(QWidget* dvbtab) +: QDBusAbstractAdaptor(dvbtab) +{ + dtab = dynamic_cast<DvbTab*>(dvbtab); +} + +Q_NOREPLY void dvbdbusadaptor::previousTvChannel() +{ + dtab->previousChannel(); +} + +Q_NOREPLY void dvbdbusadaptor::nextTvChannel() +{ + dtab->nextChannel(); +} diff -Naur ../kaffeine_ori/src/dvb/dvbdbusadaptor.h ./src/dvb/dvbdbusadaptor.h --- ../kaffeine_ori/src/dvb/dvbdbusadaptor.h 1970-01-01 01:00:00.000000000 +0100 +++ ./src/dvb/dvbdbusadaptor.h 2009-10-30 11:08:47.000000000 +0100 @@ -0,0 +1,19 @@ +#include <QDBusAbstractAdaptor> + +class DvbTab; + +class dvbdbusadaptor: public QDBusAbstractAdaptor +{ + Q_OBJECT + Q_CLASSINFO("D-Bus Interface", "org.kde.kaffeine") + +private: + DvbTab* dtab; + +public: + dvbdbusadaptor(QWidget* dvbTab); + +public slots: + void nextTvChannel(); + void previousTvChannel(); +}; diff -Naur ../kaffeine_ori/src/dvb/dvbtab.cpp ./src/dvb/dvbtab.cpp --- ../kaffeine_ori/src/dvb/dvbtab.cpp 2009-10-30 10:34:30.000000000 +0100 +++ ./src/dvb/dvbtab.cpp 2009-10-30 11:08:47.000000000 +0100 @@ -21,6 +21,7 @@ #include "dvbtab.h" #include <QBoxLayout> +#include <QDBusConnection> #include <QDir> #include <QHeaderView> #include <QPainter> @@ -37,6 +38,7 @@ #include "../osdwidget.h" #include "dvbchannelui.h" #include "dvbconfigdialog.h" +#include "dvbdbusadaptor.h" #include "dvbepg.h" #include "dvbmanager.h" #include "dvbrecording.h" @@ -424,6 +426,10 @@ dvbOsdTimer = new QTimer(this); connect(dvbOsdTimer, SIGNAL(timeout()), this, SLOT(osdTimeout())); + + new dvbdbusadaptor(this); + QDBusConnection::sessionBus().registerObject("/DVB", this); + QDBusConnection::sessionBus().registerService("org.kde.kaffeine"); } DvbTab::~DvbTab() diff -Naur ../kaffeine_ori/src/dvb/dvbtab.h ./src/dvb/dvbtab.h --- ../kaffeine_ori/src/dvb/dvbtab.h 2009-10-30 10:34:30.000000000 +0100 +++ ./src/dvb/dvbtab.h 2009-10-30 11:08:47.000000000 +0100 @@ -42,6 +42,8 @@ class DvbTab : public TabBase { Q_OBJECT + friend class dvbdbusadaptor; + public: DvbTab(KMenu *menu, KActionCollection *collection, MediaWidget *mediaWidget_); ~DvbTab(); ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ kaffeine-devel mailing list kaffeine-devel@... https://lists.sourceforge.net/lists/listinfo/kaffeine-devel |
| Free embeddable forum powered by Nabble | Forum Help |