[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: =?utf-8?q?=5Bknights=5D_src=3A_Add_missing_files_for_D-Bus_inter?=
From: Miha Čančula <miha.cancula () gmail ! com>
Date: 2011-03-24 14:11:15
Message-ID: 20110324141115.66F6EA60B4 () git ! kde ! org
[Download RAW message or body]
Git commit ddeb018e7d02bc1f6e3bc91c962ddd4da378adc0 by Miha Čančula.
Committed on 24/03/2011 at 14:55.
Pushed by mihac into branch 'master'.
Add missing files for D-Bus interface.
A +54 -0 src/externalcontrol.cpp [License: GPL (v3+)]
A +52 -0 src/externalcontrol.h [License: GPL (v3+)]
A +23 -0 src/org.kde.Knights.xml [License: UNKNOWN] *
The files marked with a * at the end have a non valid license. Please read: \
http://techbase.kde.org/Policies/Licensing_Policy and use the headers which are \
listed at that page.
http://commits.kde.org/knights/ddeb018e7d02bc1f6e3bc91c962ddd4da378adc0
diff --git a/src/externalcontrol.cpp b/src/externalcontrol.cpp
new file mode 100644
index 0000000..946e340
--- /dev/null
+++ b/src/externalcontrol.cpp
@@ -0,0 +1,54 @@
+/*
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) 2011 Miha Čančula <miha.cancula@gmail.com>
+
+ This program 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 3 of the License, or
+ (at your option) any later version.
+
+ This program 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 program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#include "externalcontrol.h"
+#include "gamemanager.h"
+#include "knightsadaptor.h"
+#include <KDebug>
+
+#define FORWARD_FUNCTION(name, action) void ExternalControl::name() { \
Manager::self()->sendOffer(Action##action, NoColor, qrand()); } +
+using namespace Knights;
+
+ExternalControl::ExternalControl(QObject* parent) : QObject(parent)
+{
+ connect(Manager::self(), SIGNAL(pieceMoved(Move)), SIGNAL(moveMade(QString)));
+ new KnightsAdaptor(this);
+ kDebug() << QDBusConnection::sessionBus().registerObject(QLatin1String("/Knights"), \
this); + kDebug() << \
QDBusConnection::sessionBus().registerService(QLatin1String("org.kde.Knights")); +}
+
+ExternalControl::~ExternalControl()
+{
+
+}
+
+FORWARD_FUNCTION(adjourn,Adjourn)
+FORWARD_FUNCTION(abort,Abort)
+FORWARD_FUNCTION(pauseGame,Pause)
+FORWARD_FUNCTION(resumeGame,Resume)
+FORWARD_FUNCTION(undo,Undo)
+FORWARD_FUNCTION(offerDraw,Draw)
+
+void ExternalControl::movePiece(const QString& move)
+{
+ Manager::self()->moveByExternalControl(move);
+}
+
+
diff --git a/src/externalcontrol.h b/src/externalcontrol.h
new file mode 100644
index 0000000..855d7c6
--- /dev/null
+++ b/src/externalcontrol.h
@@ -0,0 +1,52 @@
+/*
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) 2011 Miha Čančula <miha.cancula@gmail.com>
+
+ This program 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 3 of the License, or
+ (at your option) any later version.
+
+ This program 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 program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#ifndef KNIGHTS_EXTERNALCONTROL_H
+#define KNIGHTS_EXTERNALCONTROL_H
+
+#include <QtCore/QObject>
+#include <QtCore/QPair>
+
+namespace Knights {
+
+class ExternalControl : public QObject
+{
+ Q_OBJECT
+ Q_CLASSINFO("D-Bus Interface", "org.kde.Knights")
+
+public:
+ explicit ExternalControl(QObject* parent = 0);
+ virtual ~ExternalControl();
+
+public Q_SLOTS:
+ void movePiece(const QString& move);
+ void pauseGame();
+ void resumeGame();
+ void undo();
+ void offerDraw();
+ void adjourn();
+ void abort();
+
+Q_SIGNALS:
+ void moveMade(const QString& move);
+};
+
+}
+
+#endif // KNIGHTS_EXTERNALCONTROL_H
diff --git a/src/org.kde.Knights.xml b/src/org.kde.Knights.xml
new file mode 100644
index 0000000..ae7db7b
--- /dev/null
+++ b/src/org.kde.Knights.xml
@@ -0,0 +1,23 @@
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" \
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> +<node>
+ <interface name="org.kde.Knights">
+ <signal name="moveMade">
+ <arg name="move" type="s" direction="out"/>
+ </signal>
+ <method name="movePiece">
+ <arg name="move" type="s" direction="in"/>
+ </method>
+ <method name="pauseGame">
+ </method>
+ <method name="resumeGame">
+ </method>
+ <method name="undo">
+ </method>
+ <method name="offerDraw">
+ </method>
+ <method name="adjourn">
+ </method>
+ <method name="abort">
+ </method>
+ </interface>
+</node>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic