diff options
author | Javier S. Pedro <maemo@javispedro.com> | 2011-09-11 00:22:17 +0200 |
---|---|---|
committer | Javier <javier@pcjavier.(none)> | 2011-09-11 00:22:17 +0200 |
commit | ff57a31b95c48d75e49641177a8805193ea7ddaf (patch) | |
tree | 6ce607bcc4813bc8fbd15f841754a4a77f013e3d | |
download | glol-ff57a31b95c48d75e49641177a8805193ea7ddaf.tar.gz glol-ff57a31b95c48d75e49641177a8805193ea7ddaf.zip |
Initial import.
-rw-r--r-- | com.javispedro.glol.context | 6 | ||||
-rw-r--r-- | fakeproperty.cpp | 16 | ||||
-rw-r--r-- | fakeproperty.h | 24 | ||||
-rw-r--r-- | fakepropertyadaptor.cpp | 36 | ||||
-rw-r--r-- | fakepropertyadaptor.h | 30 | ||||
-rw-r--r-- | glol.pro | 38 | ||||
-rw-r--r-- | main.cpp | 19 | ||||
-rw-r--r-- | qtc_packaging/debian_harmattan/README | 6 | ||||
-rw-r--r-- | qtc_packaging/debian_harmattan/changelog | 5 | ||||
-rw-r--r-- | qtc_packaging/debian_harmattan/compat | 1 | ||||
-rw-r--r-- | qtc_packaging/debian_harmattan/control | 16 | ||||
-rw-r--r-- | qtc_packaging/debian_harmattan/copyright | 40 | ||||
-rwxr-xr-x | qtc_packaging/debian_harmattan/rules | 91 |
13 files changed, 328 insertions, 0 deletions
diff --git a/com.javispedro.glol.context b/com.javispedro.glol.context new file mode 100644 index 0000000..7d3a878 --- /dev/null +++ b/com.javispedro.glol.context @@ -0,0 +1,6 @@ +<?xml version="1.0"?> +<provider + xmlns="http://contextkit.freedesktop.org/Provider" + bus="session" service="com.javispedro.glol"> + <key name="Screen.TopEdge"/> +</provider> diff --git a/fakeproperty.cpp b/fakeproperty.cpp new file mode 100644 index 0000000..38d9040 --- /dev/null +++ b/fakeproperty.cpp @@ -0,0 +1,16 @@ +#include "fakeproperty.h" + +FakeProperty::FakeProperty(const QString& key, const QVariant& value, QObject *parent) : + QObject(parent), _key(key), _value(value) +{ +} + +const QString& FakeProperty::key() const +{ + return _key; +} + +const QVariant& FakeProperty::value() const +{ + return _value; +} diff --git a/fakeproperty.h b/fakeproperty.h new file mode 100644 index 0000000..4509b83 --- /dev/null +++ b/fakeproperty.h @@ -0,0 +1,24 @@ +#ifndef FAKEPROPERTY_H +#define FAKEPROPERTY_H + +#include <QtCore/QVariant> + +class FakeProperty : public QObject +{ + Q_OBJECT +public: + explicit FakeProperty(const QString& key, const QVariant& value, QObject *parent = 0); + const QString& key() const; + const QVariant& value() const; + +signals: + +public slots: + +private: + QString _key; + QVariant _value; + +}; + +#endif // FAKEPROPERTY_H diff --git a/fakepropertyadaptor.cpp b/fakepropertyadaptor.cpp new file mode 100644 index 0000000..0a65c31 --- /dev/null +++ b/fakepropertyadaptor.cpp @@ -0,0 +1,36 @@ +#include <QtCore/QRegExp> +#include <QtCore/QDebug> +#include <QtDBus/QDBusMessage> + +#include "fakepropertyadaptor.h" + +FakePropertyAdaptor::FakePropertyAdaptor(FakeProperty* property) : + QDBusAbstractAdaptor(property), _property(property) +{ +} + +QString FakePropertyAdaptor::objectPath() const +{ + if (_property->key().startsWith("/")) + return QString(_property->key()); + + return QString("/org/maemo/contextkit/") + + QString(_property->key()).replace(".", "/").replace(QRegExp("[^A-Za-z0-9_/]"), "_"); +} + +void FakePropertyAdaptor::Subscribe(const QDBusMessage& msg, QVariantList& values, quint64& timestamp) +{ + qDebug() << "subscribe from " << msg.service(); + Get(values, timestamp); +} + +void FakePropertyAdaptor::Unsubscribe(const QDBusMessage& msg) +{ + qDebug() << "unsubscribe from " << msg.service(); +} + +void FakePropertyAdaptor::Get(QVariantList& values, quint64& timestamp) +{ + values << _property->value(); + timestamp = -1LL; +} diff --git a/fakepropertyadaptor.h b/fakepropertyadaptor.h new file mode 100644 index 0000000..8293042 --- /dev/null +++ b/fakepropertyadaptor.h @@ -0,0 +1,30 @@ +#ifndef FAKEPROPERTYADAPTOR_H +#define FAKEPROPERTYADAPTOR_H + +#include <QtDBus/QDBusAbstractAdaptor> +#include <QtDBus/QDBusConnection> + +#include "fakeproperty.h" + +class FakePropertyAdaptor : public QDBusAbstractAdaptor +{ + Q_OBJECT + Q_CLASSINFO("D-Bus Interface", "org.maemo.contextkit.Property") + +public: + explicit FakePropertyAdaptor(FakeProperty* property); + QString objectPath() const; + +signals: + void ValueChanged(const QVariantList &values, const quint64& timestamp); + +public slots: + void Subscribe(const QDBusMessage& msg, QVariantList& values, quint64& timestamp); + void Unsubscribe(const QDBusMessage& msg); + void Get(QVariantList& values, quint64& timestamp); + +private: + FakeProperty* _property; +}; + +#endif // FAKEPROPERTYADAPTOR_H diff --git a/glol.pro b/glol.pro new file mode 100644 index 0000000..0f1033c --- /dev/null +++ b/glol.pro @@ -0,0 +1,38 @@ +QT += core dbus +QT -= gui + +TARGET = glol +CONFIG += console +CONFIG -= app_bundle + +unix { + CONFIG += link_pkgconfig + PKGCONFIG += contextprovider-1.0 contextsubscriber-1.0 +} + +TEMPLATE = app + +SOURCES += main.cpp \ + fakepropertyadaptor.cpp \ + fakeproperty.cpp + +HEADERS += \ + fakepropertyadaptor.h \ + fakeproperty.h + +OTHER_FILES += \ + com.javispedro.glol.context \ + qtc_packaging/debian_harmattan/rules \ + qtc_packaging/debian_harmattan/README \ + qtc_packaging/debian_harmattan/copyright \ + qtc_packaging/debian_harmattan/control \ + qtc_packaging/debian_harmattan/compat \ + qtc_packaging/debian_harmattan/changelog + +unix:!symbian:!maemo5 { + target.path = /usr/bin + INSTALLS += target + contextfiles.path += /usr/share/contextkit/providers + contextfiles.files = com.javispedro.glol.context + INSTALLS += contextfiles +} diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..d112d28 --- /dev/null +++ b/main.cpp @@ -0,0 +1,19 @@ +#include <QtCore/QCoreApplication> +#include <QtCore/QDebug> +#include <QtDBus/QDBusConnection> + +#include "fakeproperty.h" +#include "fakepropertyadaptor.h" + +int main(int argc, char *argv[]) +{ + QCoreApplication a(argc, argv); + QDBusConnection bus = QDBusConnection::sessionBus(); + FakeProperty *property = new FakeProperty("Screen.TopEdge", QString("top")); + FakePropertyAdaptor *adaptor = new FakePropertyAdaptor(property); + + bus.registerObject(adaptor->objectPath(), property); + bus.registerService("com.javispedro.glol"); + + return a.exec(); +} diff --git a/qtc_packaging/debian_harmattan/README b/qtc_packaging/debian_harmattan/README new file mode 100644 index 0000000..784a0c3 --- /dev/null +++ b/qtc_packaging/debian_harmattan/README @@ -0,0 +1,6 @@ +The Debian Package glol +---------------------------- + +Comments regarding the Package + + -- Javier <javier@unknown> Sat, 10 Sep 2011 22:43:24 +0200 diff --git a/qtc_packaging/debian_harmattan/changelog b/qtc_packaging/debian_harmattan/changelog new file mode 100644 index 0000000..d9e6320 --- /dev/null +++ b/qtc_packaging/debian_harmattan/changelog @@ -0,0 +1,5 @@ +glol (1.0.0) unstable; urgency=low + + * Initial Release. + + -- Javier <javier@unknown> Sat, 10 Sep 2011 22:43:24 +0200 diff --git a/qtc_packaging/debian_harmattan/compat b/qtc_packaging/debian_harmattan/compat new file mode 100644 index 0000000..7f8f011 --- /dev/null +++ b/qtc_packaging/debian_harmattan/compat @@ -0,0 +1 @@ +7 diff --git a/qtc_packaging/debian_harmattan/control b/qtc_packaging/debian_harmattan/control new file mode 100644 index 0000000..5148ff9 --- /dev/null +++ b/qtc_packaging/debian_harmattan/control @@ -0,0 +1,16 @@ +Source: glol +Section: user/other +Priority: optional +Maintainer: Javier <javier@unknown> +Build-Depends: debhelper (>= 5), libqt4-dev +Standards-Version: 3.7.3 +Homepage: <insert the upstream URL, if relevant> + +Package: glol +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: Global orientation lock + glol is a small command line application that helps set a system-global + orientation lock that all compatible applications will follow. +XB-Maemo-Flags: visible +XSBC-Maemo-Display-Name: glol diff --git a/qtc_packaging/debian_harmattan/copyright b/qtc_packaging/debian_harmattan/copyright new file mode 100644 index 0000000..9fd9c05 --- /dev/null +++ b/qtc_packaging/debian_harmattan/copyright @@ -0,0 +1,40 @@ +This package was debianized by Javier <javier@unknown> on +Sat, 10 Sep 2011 22:43:24 +0200. + +It was downloaded from <url://example.com> + +Upstream Author(s): + + <put author's name and email here> + <likewise for another author> + +Copyright: + + <Copyright (C) YYYY Name OfAuthor> + <likewise for another author> + +License: + + This package is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This package 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this package; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +On Debian systems, the complete text of the GNU General +Public License can be found in `/usr/share/common-licenses/GPL'. + +The Debian packaging is (C) 2011, Javier <javier@unknown> and +is licensed under the GPL, see above. + + +# Please also look if there are files or directories which have a +# different copyright/license attached and list them here. diff --git a/qtc_packaging/debian_harmattan/rules b/qtc_packaging/debian_harmattan/rules new file mode 100755 index 0000000..bae9734 --- /dev/null +++ b/qtc_packaging/debian_harmattan/rules @@ -0,0 +1,91 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + + + + + +configure: configure-stamp +configure-stamp: + dh_testdir + # qmake PREFIX=/usr# Uncomment this line for use without Qt Creator + + touch configure-stamp + + +build: build-stamp + +build-stamp: configure-stamp + dh_testdir + + # Add here commands to compile the package. + # $(MAKE) # Uncomment this line for use without Qt Creator + #docbook-to-man debian/glol.sgml > glol.1 + + touch $@ + +clean: + dh_testdir + dh_testroot + rm -f build-stamp configure-stamp + + # Add here commands to clean up after the build process. + $(MAKE) clean + + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + # Add here commands to install the package into debian/glol. + $(MAKE) INSTALL_ROOT="$(CURDIR)"/debian/glol install + + +# Build architecture-independent files here. +binary-indep: build install +# We have nothing to do by default. + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + dh_installchangelogs + dh_installdocs + dh_installexamples +# dh_install +# dh_installmenu +# dh_installdebconf +# dh_installlogrotate +# dh_installemacsen +# dh_installpam +# dh_installmime +# dh_python +# dh_installinit +# dh_installcron +# dh_installinfo + dh_installman + dh_link + dh_strip + dh_compress + dh_fixperms +# dh_perl +# dh_makeshlibs + dh_installdeb + # dh_shlibdeps # Uncomment this line for use without Qt Creator + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install configure |