From a929c9a3b465db8b7e17b9b39936c612c2621a7c Mon Sep 17 00:00:00 2001 From: "John (J5) Palmieri" Date: Fri, 14 Jul 2006 16:20:12 +0000 Subject: * Remove all bindings --- qt/examples/.cvsignore | 11 -- qt/examples/Makefile.am | 42 ------- qt/examples/chat.cpp | 136 -------------------- qt/examples/chat.h | 62 --------- qt/examples/chatadaptor.cpp | 36 ------ qt/examples/chatadaptor.h | 40 ------ qt/examples/chatmainwindow.ui | 188 ---------------------------- qt/examples/chatsetnickname.ui | 149 ---------------------- qt/examples/com.trolltech.ChatInterface.xml | 15 --- qt/examples/complexping.cpp | 91 -------------- qt/examples/complexping.h | 37 ------ qt/examples/complexpong.cpp | 86 ------------- qt/examples/complexpong.h | 46 ------- qt/examples/hello.cpp | 33 ----- qt/examples/listnames.cpp | 61 --------- qt/examples/ping-common.h | 22 ---- qt/examples/ping.cpp | 48 ------- qt/examples/pong.cpp | 54 -------- qt/examples/pong.h | 34 ----- 19 files changed, 1191 deletions(-) delete mode 100644 qt/examples/.cvsignore delete mode 100644 qt/examples/Makefile.am delete mode 100644 qt/examples/chat.cpp delete mode 100644 qt/examples/chat.h delete mode 100644 qt/examples/chatadaptor.cpp delete mode 100644 qt/examples/chatadaptor.h delete mode 100644 qt/examples/chatmainwindow.ui delete mode 100644 qt/examples/chatsetnickname.ui delete mode 100644 qt/examples/com.trolltech.ChatInterface.xml delete mode 100644 qt/examples/complexping.cpp delete mode 100644 qt/examples/complexping.h delete mode 100644 qt/examples/complexpong.cpp delete mode 100644 qt/examples/complexpong.h delete mode 100644 qt/examples/hello.cpp delete mode 100644 qt/examples/listnames.cpp delete mode 100644 qt/examples/ping-common.h delete mode 100644 qt/examples/ping.cpp delete mode 100644 qt/examples/pong.cpp delete mode 100644 qt/examples/pong.h (limited to 'qt/examples') diff --git a/qt/examples/.cvsignore b/qt/examples/.cvsignore deleted file mode 100644 index f6454f28..00000000 --- a/qt/examples/.cvsignore +++ /dev/null @@ -1,11 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -*.lo -*.la -*.bb -*.bbg -*.da -*.gcov -*.moc diff --git a/qt/examples/Makefile.am b/qt/examples/Makefile.am deleted file mode 100644 index 0d4c6eba..00000000 --- a/qt/examples/Makefile.am +++ /dev/null @@ -1,42 +0,0 @@ -INCLUDES=-I$(top_srcdir)/qt $(DBUS_CLIENT_CFLAGS) $(DBUS_QT_CFLAGS) -DDBUS_COMPILATION -LDADD = ../src/libdbus-qt4-1.la - -if HAVE_QT_GUI -chat_LDADD = $(LDADD) $(DBUS_QT_GUI_LIBS) -dist_chat_SOURCES = chat.cpp chat.h chatadaptor.cpp -nodist_chat_SOURCES = chatinterface.cpp -chat.o: ui_chatmainwindow.h ui_chatsetnickname.h chatinterface.h chatadaptor.h chat.moc chatadaptor.moc -ui_chatmainwindow.h: chatmainwindow.ui -ui_chatsetnickname.h: chatsetnickname.ui -chatinterface.cpp chatinterface.h: com.trolltech.ChatInterface.xml - ../tools/dbusidl2cpp -m -p chatinterface $? - $(QT_MOC) -o chatinterface.moc chatinterface.h - -CHAT=chat -endif - - -noinst_PROGRAMS = hello listnames ping pong complexping complexpong $(CHAT) -hello_SOURCES = hello.cpp -listnames_SOURCES = listnames.cpp - -ping_SOURCES = ping.cpp -pong_SOURCES = pong.cpp pong.h -pong.o: pong.moc - -complexping_SOURCES = complexping.cpp complexping.h -complexpong_SOURCES = complexpong.cpp complexpong.h -complexpong.o: complexpong.moc -complexping.o: complexping.moc - -EXTRA_DIST = ping-common.h chatmainwindow.ui chatsetnickname.ui com.trolltech.ChatInterface.xml chatadaptor.h - -CLEANFILES = chat.moc chatadaptor.moc complexping.moc complexpong.moc pong.moc \ - chatinterface.cpp chatinterface.h chatinterface.moc \ - ui_chatmainwindow.h ui_chatsetnickname.h - -%.moc: %.h - $(QT_MOC) $< > $@ -ui_%.h: %.ui - $(QT_UIC) -o $@ $? - diff --git a/qt/examples/chat.cpp b/qt/examples/chat.cpp deleted file mode 100644 index 86ff873b..00000000 --- a/qt/examples/chat.cpp +++ /dev/null @@ -1,136 +0,0 @@ -/* -*- C++ -*- - * - * Copyright (C) 2006 Trolltech AS. All rights reserved. - * Author: Thiago Macieira - * - * 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 2 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, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "chat.h" -#include -#include - -#include "chatadaptor.h" -#include "chatinterface.h" - -ChatMainWindow::ChatMainWindow() - : m_nickname(QLatin1String("nickname")) -{ - setupUi(this); - sendButton->setEnabled(false); - - connect(messageLineEdit, SIGNAL(textChanged(QString)), - this, SLOT(textChangedSlot(QString))); - connect(sendButton, SIGNAL(clicked(bool)), this, SLOT(sendClickedSlot())); - connect(actionChangeNickname, SIGNAL(triggered(bool)), this, SLOT(changeNickname())); - connect(actionAboutQt, SIGNAL(triggered(bool)), this, SLOT(aboutQt())); - connect(qApp, SIGNAL(lastWindowClosed()), this, SLOT(exiting())); - - // add our D-Bus interface and connect to D-Bus - new ChatInterfaceAdaptor(this); - QDBus::systemBus().registerObject("/", this); - - com::trolltech::ChatInterface *iface; - iface = QDBus::systemBus().findInterface(QString(), QString()); - connect(iface, SIGNAL(message(QString,QString)), this, SLOT(messageSlot(QString,QString))); - connect(iface, SIGNAL(action(QString,QString)), this, SLOT(actionSlot(QString,QString))); - - NicknameDialog dialog; - dialog.cancelButton->setVisible(false); - dialog.exec(); - m_nickname = dialog.nickname->text().trimmed(); - emit action(m_nickname, QLatin1String("joins the chat")); -} - -ChatMainWindow::~ChatMainWindow() -{ -} - -void ChatMainWindow::rebuildHistory() -{ - QString history = m_messages.join( QLatin1String("\n" ) ); - chatHistory->setPlainText(history); -} - -void ChatMainWindow::messageSlot(const QString &nickname, const QString &text) -{ - QString msg( QLatin1String("<%1> %2") ); - msg = msg.arg(nickname, text); - m_messages.append(msg); - - if (m_messages.count() > 100) - m_messages.removeFirst(); - rebuildHistory(); -} - -void ChatMainWindow::actionSlot(const QString &nickname, const QString &text) -{ - QString msg( QLatin1String("* %1 %2") ); - msg = msg.arg(nickname, text); - m_messages.append(msg); - - if (m_messages.count() > 100) - m_messages.removeFirst(); - rebuildHistory(); -} - -void ChatMainWindow::textChangedSlot(const QString &newText) -{ - sendButton->setEnabled(!newText.isEmpty()); -} - -void ChatMainWindow::sendClickedSlot() -{ - emit message(m_nickname, messageLineEdit->text()); - messageLineEdit->setText(QString()); -} - -void ChatMainWindow::changeNickname() -{ - NicknameDialog dialog(this); - if (dialog.exec() == QDialog::Accepted) { - QString old = m_nickname; - m_nickname = dialog.nickname->text().trimmed(); - emit action(old, QString("is now known as %1").arg(m_nickname)); - } -} - -void ChatMainWindow::aboutQt() -{ - QMessageBox::aboutQt(this); -} - -void ChatMainWindow::exiting() -{ - emit action(m_nickname, QLatin1String("leaves the chat")); -} - -NicknameDialog::NicknameDialog(QWidget *parent) - : QDialog(parent) -{ - setupUi(this); -} - -int main(int argc, char **argv) -{ - QApplication app(argc, argv); - - ChatMainWindow chat; - chat.show(); - return app.exec(); -} - -#include "chat.moc" diff --git a/qt/examples/chat.h b/qt/examples/chat.h deleted file mode 100644 index b0e50a35..00000000 --- a/qt/examples/chat.h +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- C++ -*- - * - * Copyright (C) 2006 Trolltech AS. All rights reserved. - * Author: Thiago Macieira - * - * 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 2 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, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef CHAT_H -#define CHAT_H - -#include -#include -#include "ui_chatmainwindow.h" -#include "ui_chatsetnickname.h" - -class ChatMainWindow: public QMainWindow, Ui::ChatMainWindow -{ - Q_OBJECT - QString m_nickname; - QStringList m_messages; -public: - ChatMainWindow(); - ~ChatMainWindow(); - - void rebuildHistory(); - -signals: - void message(const QString &nickname, const QString &text); - void action(const QString &nickname, const QString &text); - -private slots: - void messageSlot(const QString &nickname, const QString &text); - void actionSlot(const QString &nickname, const QString &text); - void textChangedSlot(const QString &newText); - void sendClickedSlot(); - void changeNickname(); - void aboutQt(); - void exiting(); -}; - -class NicknameDialog: public QDialog, public Ui::NicknameDialog -{ - Q_OBJECT -public: - NicknameDialog(QWidget *parent = 0); -}; - -#endif diff --git a/qt/examples/chatadaptor.cpp b/qt/examples/chatadaptor.cpp deleted file mode 100644 index 525b9aad..00000000 --- a/qt/examples/chatadaptor.cpp +++ /dev/null @@ -1,36 +0,0 @@ -/* - * This file was generated by dbusidl2cpp version 0.3 - * when processing input file /home/tjmaciei/src/kde4/playground/libs/qt-dbus/examples/com.trolltech.ChatInterface.xml - * - * dbusidl2cpp is Copyright (C) 2006 Trolltech AS. All rights reserved. - * - * This is an auto-generated file. - */ - -#include "chatadaptor.h" -#include -#include -#include -#include -#include -#include -#include - -/* - * Implementation of adaptor class ChatInterfaceAdaptor - */ - -ChatInterfaceAdaptor::ChatInterfaceAdaptor(QObject *parent) - : QDBusAbstractAdaptor(parent) -{ - // constructor - setAutoRelaySignals(true); -} - -ChatInterfaceAdaptor::~ChatInterfaceAdaptor() -{ - // destructor -} - - -#include "chatadaptor.moc" diff --git a/qt/examples/chatadaptor.h b/qt/examples/chatadaptor.h deleted file mode 100644 index cbec0120..00000000 --- a/qt/examples/chatadaptor.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * This file was generated by dbusidl2cpp version 0.3 - * when processing input file /home/tjmaciei/src/kde4/playground/libs/qt-dbus/examples/com.trolltech.ChatInterface.xml - * - * dbusidl2cpp is Copyright (C) 2006 Trolltech AS. All rights reserved. - * - * This is an auto-generated file. - */ - -#ifndef CHATADAPTOR_H_88051142890130 -#define CHATADAPTOR_H_88051142890130 - -#include -#include -class QByteArray; -template class QList; -template class QMap; -class QString; -class QStringList; -class QVariant; - -/* - * Adaptor class for interface com.trolltech.ChatInterface - */ -class ChatInterfaceAdaptor: public QDBusAbstractAdaptor -{ - Q_OBJECT - Q_CLASSINFO("D-Bus Interface", "com.trolltech.ChatInterface") -public: - ChatInterfaceAdaptor(QObject *parent); - virtual ~ChatInterfaceAdaptor(); - -public: // PROPERTIES -public slots: // METHODS -signals: // SIGNALS - void action(const QString &nickname, const QString &text); - void message(const QString &nickname, const QString &text); -}; - -#endif diff --git a/qt/examples/chatmainwindow.ui b/qt/examples/chatmainwindow.ui deleted file mode 100644 index 0e4461c3..00000000 --- a/qt/examples/chatmainwindow.ui +++ /dev/null @@ -1,188 +0,0 @@ - - - - - ChatMainWindow - - - - 0 - 0 - 800 - 600 - - - - QtDBus Chat - - - - - 9 - - - 6 - - - - - 0 - - - 6 - - - - - false - - - Messages sent and received from other users - - - true - - - - - - - 0 - - - 6 - - - - - Message: - - - messageLineEdit - - - - - - - - - - - 1 - 0 - 0 - 0 - - - - Sends a message to other people - - - - - - Send - - - - - - - - - - - - - 0 - 0 - 800 - 31 - - - - - Help - - - - - - File - - - - - - - - - - - - Quit - - - Ctrl+Q - - - - - - - - About Qt... - - - - - Change nickname... - - - Ctrl+N - - - - - - chatHistory - messageLineEdit - sendButton - - - - - messageLineEdit - returnPressed() - sendButton - animateClick() - - - 299 - 554 - - - 744 - 551 - - - - - actionQuit - triggered(bool) - ChatMainWindow - close() - - - -1 - -1 - - - 399 - 299 - - - - - diff --git a/qt/examples/chatsetnickname.ui b/qt/examples/chatsetnickname.ui deleted file mode 100644 index fb9894e0..00000000 --- a/qt/examples/chatsetnickname.ui +++ /dev/null @@ -1,149 +0,0 @@ - - - - - NicknameDialog - - - - 0 - 0 - 396 - 105 - - - - - 1 - 1 - 0 - 0 - - - - Set nickname - - - - 9 - - - 6 - - - - - 0 - - - 6 - - - - - - 1 - 1 - 0 - 0 - - - - New nickname: - - - - - - - - - - - - 0 - - - 6 - - - - - Qt::Horizontal - - - - 131 - 31 - - - - - - - - OK - - - - - - - Cancel - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - okButton - clicked() - NicknameDialog - accept() - - - 278 - 253 - - - 96 - 254 - - - - - cancelButton - clicked() - NicknameDialog - reject() - - - 369 - 253 - - - 179 - 282 - - - - - diff --git a/qt/examples/com.trolltech.ChatInterface.xml b/qt/examples/com.trolltech.ChatInterface.xml deleted file mode 100644 index 666a9e35..00000000 --- a/qt/examples/com.trolltech.ChatInterface.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - diff --git a/qt/examples/complexping.cpp b/qt/examples/complexping.cpp deleted file mode 100644 index b977edfc..00000000 --- a/qt/examples/complexping.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* -*- C++ -*- - * - * Copyright (C) 2006 Trolltech AS. All rights reserved. - * Author: Thiago Macieira - * - * 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 2 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, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include - -#include -#include -#include -#include -#include - -#include "ping-common.h" -#include "complexping.h" - -void Ping::start(const QString &name, const QString &oldValue, const QString &newValue) -{ - Q_UNUSED(oldValue); - - if (name != SERVICE_NAME || newValue.isEmpty()) - return; - - // open stdin for reading - qstdin.open(stdin, QIODevice::ReadOnly); - - // find our remote - iface = QDBus::sessionBus().findInterface(SERVICE_NAME, "/"); - if (!iface) { - fprintf(stderr, "%s\n", - qPrintable(QDBus::sessionBus().lastError().message())); - QCoreApplication::instance()->quit(); - } - - connect(iface, SIGNAL(aboutToQuit()), QCoreApplication::instance(), SLOT(quit())); - - while (true) { - qDebug() << "Ready"; - - QString line = QString::fromLocal8Bit(qstdin.readLine()).trimmed(); - if (line.isEmpty()) { - iface->call("quit"); - return; - } else if (line == "value") { - QVariant reply = iface->property("value"); - if (!reply.isNull()) - qDebug() << "value =" << reply.toString(); - } else if (line.startsWith("value=")) { - iface->setProperty("value", line.mid(6)); - } else { - QDBusReply reply = iface->call("query", line); - if (reply.isSuccess()) - qDebug() << "Reply was:" << reply.value(); - } - - if (iface->lastError().isValid()) - fprintf(stderr, "Call failed: %s\n", qPrintable(iface->lastError().message())); - } -} - -int main(int argc, char **argv) -{ - QCoreApplication app(argc, argv); - Ping ping; - ping.connect(QDBus::sessionBus().busService(), - SIGNAL(nameOwnerChanged(QString,QString,QString)), - SLOT(start(QString,QString,QString))); - - QProcess pong; - pong.start("./complexpong"); - - app.exec(); -} - -#include "complexping.moc" diff --git a/qt/examples/complexping.h b/qt/examples/complexping.h deleted file mode 100644 index 4332ef8a..00000000 --- a/qt/examples/complexping.h +++ /dev/null @@ -1,37 +0,0 @@ -/* -*- C++ -*- - * - * Copyright (C) 2006 Trolltech AS. All rights reserved. - * Author: Thiago Macieira - * - * 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 2 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, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef COMPLEXPING_H -#define COMPLEXPING_H - -#include - -class Ping: public QObject -{ - Q_OBJECT -public slots: - void start(const QString &, const QString &, const QString &); -public: - QFile qstdin; - QDBusInterface *iface; -}; - -#endif diff --git a/qt/examples/complexpong.cpp b/qt/examples/complexpong.cpp deleted file mode 100644 index ff767407..00000000 --- a/qt/examples/complexpong.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* -*- C++ -*- - * - * Copyright (C) 2006 Trolltech AS. All rights reserved. - * Author: Thiago Macieira - * - * 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 2 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, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include -#include - -#include -#include -#include - -#include "ping-common.h" -#include "complexpong.h" - -// the property -QString Pong::value() const -{ - return m_value; -} - -void Pong::setValue(const QString &newValue) -{ - m_value = newValue; -} - -void Pong::quit() -{ - QTimer::singleShot(0, QCoreApplication::instance(), SLOT(quit())); -} - -QVariant Pong::query(const QString &query) -{ - QString q = query.toLower(); - if (q == "hello") - return "World"; - if (q == "ping") - return "Pong"; - if (q == "the answer to life, the universe and everything") - return 42; - if (q.indexOf("unladen swallow") != -1) { - if (q.indexOf("european") != -1) - return 11.0; - return QByteArray("african or european?"); - } - - return "Sorry, I don't know the answer"; -} - -int main(int argc, char **argv) -{ - QCoreApplication app(argc, argv); - - QDBusBusService *bus = QDBus::sessionBus().busService(); - - QObject obj; - Pong *pong = new Pong(&obj); - pong->connect(&app, SIGNAL(aboutToQuit()), SIGNAL(aboutToQuit())); - pong->setProperty("value", "initial value"); - QDBus::sessionBus().registerObject("/", &obj); - - if (bus->requestName(SERVICE_NAME, QDBusBusService::AllowReplacingName) != - QDBusBusService::PrimaryOwnerReply) - exit(1); - - app.exec(); - return 0; -} - -#include "complexpong.moc" diff --git a/qt/examples/complexpong.h b/qt/examples/complexpong.h deleted file mode 100644 index c6ad2dbb..00000000 --- a/qt/examples/complexpong.h +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- C++ -*- - * - * Copyright (C) 2006 Trolltech AS. All rights reserved. - * Author: Thiago Macieira - * - * 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 2 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, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef COMPLEXPONG_H -#define COMPLEXPONG_H - -#include - -class Pong: public QDBusAbstractAdaptor -{ - Q_OBJECT - Q_CLASSINFO("D-Bus Interface", "com.trolltech.QtDBus.ComplexPong.Pong") - Q_PROPERTY(QString value READ value WRITE setValue) -public: - QString m_value; - QString value() const; - void setValue(const QString &newValue); - - Pong(QObject *obj) : QDBusAbstractAdaptor(obj) - { } -signals: - void aboutToQuit(); -public slots: - QVariant query(const QString &query); - Q_ASYNC void quit(); -}; - -#endif diff --git a/qt/examples/hello.cpp b/qt/examples/hello.cpp deleted file mode 100644 index a287bcb0..00000000 --- a/qt/examples/hello.cpp +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- C++ -*- - * - * Copyright (C) 2006 Trolltech AS. All rights reserved. - * Author: Thiago Macieira - * - * 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 2 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, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include - -#include -#include - -int main(int argc, char **argv) -{ - QCoreApplication app(argc, argv); - - printf("Hello, World\n"); - return 0; -} diff --git a/qt/examples/listnames.cpp b/qt/examples/listnames.cpp deleted file mode 100644 index 27703f5a..00000000 --- a/qt/examples/listnames.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/* -*- C++ -*- - * - * Copyright (C) 2006 Trolltech AS. All rights reserved. - * Author: Thiago Macieira - * - * 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 2 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, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include -#include -#include -#include - -void method1() -{ - QDBusReply reply = QDBus::sessionBus().busService()->listNames(); - if (reply.isError()) { - qDebug() << "Error:" << reply.error().message(); - exit(1); - } - foreach (QString name, reply.value()) - qDebug() << name; -} - -void method2() -{ - QDBusInterface *dbus_iface; - QDBusConnection &bus = QDBus::sessionBus(); - dbus_iface = bus.findInterface("org.freedesktop.DBus", "/org/freedesktop/DBus", - "org.freedesktop.DBus"); - qDebug() << dbus_iface->call("ListNames").first(); -} - -void method3() -{ - qDebug() << QDBus::sessionBus().busService()->listNames().value(); -} - -int main(int argc, char **argv) -{ - QCoreApplication app(argc, argv); - - method1(); - method2(); - method3(); - - return 0; -} diff --git a/qt/examples/ping-common.h b/qt/examples/ping-common.h deleted file mode 100644 index 1870275d..00000000 --- a/qt/examples/ping-common.h +++ /dev/null @@ -1,22 +0,0 @@ -/* -*- C++ -*- - * - * Copyright (C) 2006 Trolltech AS. All rights reserved. - * Author: Thiago Macieira - * - * 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 2 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, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#define SERVICE_NAME "com.trolltech.QtDBus.PingExample" diff --git a/qt/examples/ping.cpp b/qt/examples/ping.cpp deleted file mode 100644 index ffa53a42..00000000 --- a/qt/examples/ping.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* -*- C++ -*- - * - * Copyright (C) 2006 Trolltech AS. All rights reserved. - * Author: Thiago Macieira - * - * 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 2 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, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include - -#include -#include - -#include "ping-common.h" - -int main(int argc, char **argv) -{ - QCoreApplication app(argc, argv); - - QDBusInterface *iface = QDBus::sessionBus().findInterface(SERVICE_NAME, "/"); - if (iface) { - QDBusReply reply = iface->call("ping", argc > 1 ? argv[1] : ""); - if (reply.isSuccess()) { - printf("Reply was: %s\n", qPrintable(reply.value())); - return 0; - } - - fprintf(stderr, "Call failed: %s\n", qPrintable(reply.error().message())); - return 1; - } - - fprintf(stderr, "%s\n", - qPrintable(QDBus::sessionBus().lastError().message())); - return 1; -} diff --git a/qt/examples/pong.cpp b/qt/examples/pong.cpp deleted file mode 100644 index b85f1f0c..00000000 --- a/qt/examples/pong.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- C++ -*- - * - * Copyright (C) 2006 Trolltech AS. All rights reserved. - * Author: Thiago Macieira - * - * 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 2 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, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include -#include - -#include -#include -#include - -#include "ping-common.h" -#include "pong.h" - -QString Pong::ping(const QString &arg) -{ - QTimer::singleShot(0, QCoreApplication::instance(), SLOT(quit())); - return QString("ping(\"%1\") got called").arg(arg); -} - -int main(int argc, char **argv) -{ - QCoreApplication app(argc, argv); - - QDBusBusService *bus = QDBus::sessionBus().busService(); - if (bus->requestName(SERVICE_NAME, QDBusBusService::AllowReplacingName) != - QDBusBusService::PrimaryOwnerReply) - exit(1); - - Pong pong; - QDBus::sessionBus().registerObject("/", &pong, QDBusConnection::ExportSlots); - - app.exec(); - return 0; -} - -#include "pong.moc" diff --git a/qt/examples/pong.h b/qt/examples/pong.h deleted file mode 100644 index de89598f..00000000 --- a/qt/examples/pong.h +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- C++ -*- - * - * Copyright (C) 2006 Trolltech AS. All rights reserved. - * Author: Thiago Macieira - * - * 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 2 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, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef PONG_H -#define PONG_H - -#include - -class Pong: public QObject -{ - Q_OBJECT -public slots: - Q_SCRIPTABLE QString ping(const QString &arg); -}; - -#endif -- cgit