diff options
author | axis <qt-info@nokia.com> | 2009-04-24 11:34:15 (GMT) |
---|---|---|
committer | axis <qt-info@nokia.com> | 2009-04-24 11:34:15 (GMT) |
commit | 8f427b2b914d5b575a4a7c0ed65d2fb8f45acc76 (patch) | |
tree | a17e1a767a89542ab59907462206d7dcf2e504b2 /examples/dbus/dbus-chat | |
download | Qt-8f427b2b914d5b575a4a7c0ed65d2fb8f45acc76.zip Qt-8f427b2b914d5b575a4a7c0ed65d2fb8f45acc76.tar.gz Qt-8f427b2b914d5b575a4a7c0ed65d2fb8f45acc76.tar.bz2 |
Long live Qt for S60!
Diffstat (limited to 'examples/dbus/dbus-chat')
-rw-r--r-- | examples/dbus/dbus-chat/chat.cpp | 164 | ||||
-rw-r--r-- | examples/dbus/dbus-chat/chat.h | 82 | ||||
-rw-r--r-- | examples/dbus/dbus-chat/chat_adaptor.cpp | 35 | ||||
-rw-r--r-- | examples/dbus/dbus-chat/chat_adaptor.h | 57 | ||||
-rw-r--r-- | examples/dbus/dbus-chat/chat_interface.cpp | 25 | ||||
-rw-r--r-- | examples/dbus/dbus-chat/chat_interface.h | 49 | ||||
-rw-r--r-- | examples/dbus/dbus-chat/chatmainwindow.ui | 185 | ||||
-rw-r--r-- | examples/dbus/dbus-chat/chatsetnickname.ui | 149 | ||||
-rw-r--r-- | examples/dbus/dbus-chat/com.trolltech.chat.xml | 15 | ||||
-rw-r--r-- | examples/dbus/dbus-chat/dbus-chat.pro | 21 |
10 files changed, 782 insertions, 0 deletions
diff --git a/examples/dbus/dbus-chat/chat.cpp b/examples/dbus/dbus-chat/chat.cpp new file mode 100644 index 0000000..1dbc764 --- /dev/null +++ b/examples/dbus/dbus-chat/chat.cpp @@ -0,0 +1,164 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "chat.h" +#include <QtGui/QApplication> +#include <QtGui/QMessageBox> + +#include "chat_adaptor.h" +#include "chat_interface.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 ChatAdaptor(this); + QDBusConnection::sessionBus().registerObject("/", this); + + com::trolltech::chat *iface; + iface = new com::trolltech::chat(QString(), QString(), QDBusConnection::sessionBus(), this); + //connect(iface, SIGNAL(message(QString,QString)), this, SLOT(messageSlot(QString,QString))); + QDBusConnection::sessionBus().connect(QString(), QString(), "com.trolltech.chat", "message", 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()); + QDBusMessage msg = QDBusMessage::createSignal("/", "com.trolltech.chat", "message"); + msg << m_nickname << messageLineEdit->text(); + QDBusConnection::sessionBus().send(msg); + 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); + + if (!QDBusConnection::sessionBus().isConnected()) { + qWarning("Cannot connect to the D-Bus session bus.\n" + "Please check your system settings and try again.\n"); + return 1; + } + + ChatMainWindow chat; + chat.show(); + return app.exec(); +} diff --git a/examples/dbus/dbus-chat/chat.h b/examples/dbus/dbus-chat/chat.h new file mode 100644 index 0000000..48b549e --- /dev/null +++ b/examples/dbus/dbus-chat/chat.h @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef CHAT_H +#define CHAT_H + +#include <QtCore/QStringList> +#include <QtDBus/QtDBus> +#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/examples/dbus/dbus-chat/chat_adaptor.cpp b/examples/dbus/dbus-chat/chat_adaptor.cpp new file mode 100644 index 0000000..4292a58 --- /dev/null +++ b/examples/dbus/dbus-chat/chat_adaptor.cpp @@ -0,0 +1,35 @@ +/* + * This file was generated by dbusxml2cpp version 0.6 + * Command line was: dbusxml2cpp -i chat_adaptor.h -a :chat_adaptor.cpp com.trolltech.chat.xml + * + * dbusxml2cpp is Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). + * + * This is an auto-generated file. + * Do not edit! All changes made to it will be lost. + */ + +#include "chat_adaptor.h" +#include <QtCore/QMetaObject> +#include <QtCore/QByteArray> +#include <QtCore/QList> +#include <QtCore/QMap> +#include <QtCore/QString> +#include <QtCore/QStringList> +#include <QtCore/QVariant> + +/* + * Implementation of adaptor class ChatAdaptor + */ + +ChatAdaptor::ChatAdaptor(QObject *parent) + : QDBusAbstractAdaptor(parent) +{ + // constructor + setAutoRelaySignals(true); +} + +ChatAdaptor::~ChatAdaptor() +{ + // destructor +} + diff --git a/examples/dbus/dbus-chat/chat_adaptor.h b/examples/dbus/dbus-chat/chat_adaptor.h new file mode 100644 index 0000000..9d8e7a6 --- /dev/null +++ b/examples/dbus/dbus-chat/chat_adaptor.h @@ -0,0 +1,57 @@ +/* + * This file was generated by dbusxml2cpp version 0.6 + * Command line was: dbusxml2cpp -a chat_adaptor.h: com.trolltech.chat.xml + * + * dbusxml2cpp is Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). + * + * This is an auto-generated file. + * This file may have been hand-edited. Look for HAND-EDIT comments + * before re-generating it. + */ + +#ifndef CHAT_ADAPTOR_H_142741156243605 +#define CHAT_ADAPTOR_H_142741156243605 + +#include <QtCore/QObject> +#include <QtDBus/QtDBus> + +QT_BEGIN_NAMESPACE +class QByteArray; +template<class T> class QList; +template<class Key, class Value> class QMap; +class QString; +class QStringList; +class QVariant; +QT_END_NAMESPACE + +/* + * Adaptor class for interface com.trolltech.chat + */ +class ChatAdaptor: public QDBusAbstractAdaptor +{ + Q_OBJECT + Q_CLASSINFO("D-Bus Interface", "com.trolltech.chat") + Q_CLASSINFO("D-Bus Introspection", "" +" <interface name=\"com.trolltech.chat\" >\n" +" <signal name=\"message\" >\n" +" <arg direction=\"out\" type=\"s\" name=\"nickname\" />\n" +" <arg direction=\"out\" type=\"s\" name=\"text\" />\n" +" </signal>\n" +" <signal name=\"action\" >\n" +" <arg direction=\"out\" type=\"s\" name=\"nickname\" />\n" +" <arg direction=\"out\" type=\"s\" name=\"text\" />\n" +" </signal>\n" +" </interface>\n" + "") +public: + ChatAdaptor(QObject *parent); + virtual ~ChatAdaptor(); + +public: // PROPERTIES +public Q_SLOTS: // METHODS +Q_SIGNALS: // SIGNALS + void action(const QString &nickname, const QString &text); + void message(const QString &nickname, const QString &text); +}; + +#endif diff --git a/examples/dbus/dbus-chat/chat_interface.cpp b/examples/dbus/dbus-chat/chat_interface.cpp new file mode 100644 index 0000000..5e2d2a7 --- /dev/null +++ b/examples/dbus/dbus-chat/chat_interface.cpp @@ -0,0 +1,25 @@ +/* + * This file was generated by dbusxml2cpp version 0.6 + * Command line was: dbusxml2cpp -i chat_interface.h -p :chat_interface.cpp chat/com.trolltech.chat.xml + * + * dbusxml2cpp is Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). + * + * This is an auto-generated file. + * This file may have been hand-edited. Look for HAND-EDIT comments + * before re-generating it. + */ + +#include "chat_interface.h" +/* + * Implementation of interface class ComTrolltechChatInterface + */ + +ComTrolltechChatInterface::ComTrolltechChatInterface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent) + : QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent) +{ +} + +ComTrolltechChatInterface::~ComTrolltechChatInterface() +{ +} + diff --git a/examples/dbus/dbus-chat/chat_interface.h b/examples/dbus/dbus-chat/chat_interface.h new file mode 100644 index 0000000..75140cc --- /dev/null +++ b/examples/dbus/dbus-chat/chat_interface.h @@ -0,0 +1,49 @@ +/* + * This file was generated by dbusxml2cpp version 0.6 + * Command line was: dbusxml2cpp -p chat_interface.h: com.trolltech.chat.xml + * + * dbusxml2cpp is Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). + * + * This is an auto-generated file. + * Do not edit! All changes made to it will be lost. + */ + +#ifndef CHAT_INTERFACE_H_143021156243606 +#define CHAT_INTERFACE_H_143021156243606 + +#include <QtCore/QObject> +#include <QtCore/QByteArray> +#include <QtCore/QList> +#include <QtCore/QMap> +#include <QtCore/QString> +#include <QtCore/QStringList> +#include <QtCore/QVariant> +#include <QtDBus/QtDBus> + +/* + * Proxy class for interface com.trolltech.chat + */ +class ComTrolltechChatInterface: public QDBusAbstractInterface +{ + Q_OBJECT +public: + static inline const char *staticInterfaceName() + { return "com.trolltech.chat"; } + +public: + ComTrolltechChatInterface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = 0); + + ~ComTrolltechChatInterface(); + +public Q_SLOTS: // METHODS +Q_SIGNALS: // SIGNALS + void action(const QString &nickname, const QString &text); + void message(const QString &nickname, const QString &text); +}; + +namespace com { + namespace trolltech { + typedef ::ComTrolltechChatInterface chat; + } +} +#endif diff --git a/examples/dbus/dbus-chat/chatmainwindow.ui b/examples/dbus/dbus-chat/chatmainwindow.ui new file mode 100644 index 0000000..0616dcb --- /dev/null +++ b/examples/dbus/dbus-chat/chatmainwindow.ui @@ -0,0 +1,185 @@ +<ui version="4.0" > + <author></author> + <comment></comment> + <exportmacro></exportmacro> + <class>ChatMainWindow</class> + <widget class="QMainWindow" name="ChatMainWindow" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>800</width> + <height>600</height> + </rect> + </property> + <property name="windowTitle" > + <string>QtDBus Chat</string> + </property> + <widget class="QWidget" name="centralwidget" > + <layout class="QHBoxLayout" > + <property name="margin" > + <number>9</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <layout class="QVBoxLayout" > + <property name="margin" > + <number>0</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QTextBrowser" name="chatHistory" > + <property name="acceptDrops" > + <bool>false</bool> + </property> + <property name="toolTip" > + <string>Messages sent and received from other users</string> + </property> + <property name="acceptRichText" > + <bool>true</bool> + </property> + </widget> + </item> + <item> + <layout class="QHBoxLayout" > + <property name="margin" > + <number>0</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QLabel" name="label" > + <property name="text" > + <string>Message:</string> + </property> + <property name="buddy" > + <cstring>messageLineEdit</cstring> + </property> + </widget> + </item> + <item> + <widget class="QLineEdit" name="messageLineEdit" /> + </item> + <item> + <widget class="QPushButton" name="sendButton" > + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="toolTip" > + <string>Sends a message to other people</string> + </property> + <property name="whatsThis" > + <string/> + </property> + <property name="text" > + <string>Send</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </item> + </layout> + </widget> + <widget class="QMenuBar" name="menubar" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>800</width> + <height>31</height> + </rect> + </property> + <widget class="QMenu" name="menuQuit" > + <property name="title" > + <string>Help</string> + </property> + <addaction name="actionAboutQt" /> + </widget> + <widget class="QMenu" name="menuFile" > + <property name="title" > + <string>File</string> + </property> + <addaction name="actionChangeNickname" /> + <addaction name="separator" /> + <addaction name="actionQuit" /> + </widget> + <addaction name="menuFile" /> + <addaction name="menuQuit" /> + </widget> + <widget class="QStatusBar" name="statusbar" /> + <action name="actionQuit" > + <property name="text" > + <string>Quit</string> + </property> + <property name="shortcut" > + <string>Ctrl+Q</string> + </property> + </action> + <action name="actionAboutQt" > + <property name="text" > + <string>About Qt...</string> + </property> + </action> + <action name="actionChangeNickname" > + <property name="text" > + <string>Change nickname...</string> + </property> + <property name="shortcut" > + <string>Ctrl+N</string> + </property> + </action> + </widget> + <pixmapfunction></pixmapfunction> + <tabstops> + <tabstop>chatHistory</tabstop> + <tabstop>messageLineEdit</tabstop> + <tabstop>sendButton</tabstop> + </tabstops> + <resources/> + <connections> + <connection> + <sender>messageLineEdit</sender> + <signal>returnPressed()</signal> + <receiver>sendButton</receiver> + <slot>animateClick()</slot> + <hints> + <hint type="sourcelabel" > + <x>299</x> + <y>554</y> + </hint> + <hint type="destinationlabel" > + <x>744</x> + <y>551</y> + </hint> + </hints> + </connection> + <connection> + <sender>actionQuit</sender> + <signal>triggered(bool)</signal> + <receiver>ChatMainWindow</receiver> + <slot>close()</slot> + <hints> + <hint type="sourcelabel" > + <x>-1</x> + <y>-1</y> + </hint> + <hint type="destinationlabel" > + <x>399</x> + <y>299</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/examples/dbus/dbus-chat/chatsetnickname.ui b/examples/dbus/dbus-chat/chatsetnickname.ui new file mode 100644 index 0000000..fb9894e --- /dev/null +++ b/examples/dbus/dbus-chat/chatsetnickname.ui @@ -0,0 +1,149 @@ +<ui version="4.0" > + <author></author> + <comment></comment> + <exportmacro></exportmacro> + <class>NicknameDialog</class> + <widget class="QDialog" name="NicknameDialog" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>396</width> + <height>105</height> + </rect> + </property> + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="windowTitle" > + <string>Set nickname</string> + </property> + <layout class="QVBoxLayout" > + <property name="margin" > + <number>9</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <layout class="QVBoxLayout" > + <property name="margin" > + <number>0</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QLabel" name="label" > + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text" > + <string>New nickname:</string> + </property> + </widget> + </item> + <item> + <widget class="QLineEdit" name="nickname" /> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" > + <property name="margin" > + <number>0</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <spacer> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" > + <size> + <width>131</width> + <height>31</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="okButton" > + <property name="text" > + <string>OK</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="cancelButton" > + <property name="text" > + <string>Cancel</string> + </property> + </widget> + </item> + <item> + <spacer> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" > + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + </layout> + </widget> + <pixmapfunction></pixmapfunction> + <resources/> + <connections> + <connection> + <sender>okButton</sender> + <signal>clicked()</signal> + <receiver>NicknameDialog</receiver> + <slot>accept()</slot> + <hints> + <hint type="sourcelabel" > + <x>278</x> + <y>253</y> + </hint> + <hint type="destinationlabel" > + <x>96</x> + <y>254</y> + </hint> + </hints> + </connection> + <connection> + <sender>cancelButton</sender> + <signal>clicked()</signal> + <receiver>NicknameDialog</receiver> + <slot>reject()</slot> + <hints> + <hint type="sourcelabel" > + <x>369</x> + <y>253</y> + </hint> + <hint type="destinationlabel" > + <x>179</x> + <y>282</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/examples/dbus/dbus-chat/com.trolltech.chat.xml b/examples/dbus/dbus-chat/com.trolltech.chat.xml new file mode 100644 index 0000000..618c8c4 --- /dev/null +++ b/examples/dbus/dbus-chat/com.trolltech.chat.xml @@ -0,0 +1,15 @@ +<!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="com.trolltech.chat"> + <signal name="message"> + <arg name="nickname" type="s" direction="out"/> + <arg name="text" type="s" direction="out"/> + </signal> + <signal name="action"> + <arg name="nickname" type="s" direction="out"/> + <arg name="text" type="s" direction="out"/> + </signal> + </interface> +</node> + diff --git a/examples/dbus/dbus-chat/dbus-chat.pro b/examples/dbus/dbus-chat/dbus-chat.pro new file mode 100644 index 0000000..e04c641 --- /dev/null +++ b/examples/dbus/dbus-chat/dbus-chat.pro @@ -0,0 +1,21 @@ +TEMPLATE = app +TARGET = +DEPENDPATH += . +INCLUDEPATH += . +CONFIG += qdbus + +# Input +HEADERS += chat.h chat_adaptor.h chat_interface.h +SOURCES += chat.cpp chat_adaptor.cpp chat_interface.cpp +FORMS += chatmainwindow.ui chatsetnickname.ui + +#DBUS_ADAPTORS += com.trolltech.chat.xml +#DBUS_INTERFACES += com.trolltech.chat.xml + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/dbus/chat +sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS *.pro *.xml +sources.path = $$[QT_INSTALL_EXAMPLES]/dbus/chat +INSTALLS += target sources + +include($$QT_SOURCE_TREE/examples/examplebase.pri) |