aboutsummaryrefslogtreecommitdiff
path: root/examples/GuiClient
diff options
context:
space:
mode:
authorManjeet Dahiya <manjeetdahiya@gmail.com>2010-10-10 07:00:14 +0000
committerManjeet Dahiya <manjeetdahiya@gmail.com>2010-10-10 07:00:14 +0000
commit3b60dc4e32446afed425bd35f15b8000503c2788 (patch)
treec84487d5d0a75954bdef1324ae7406a60d102d24 /examples/GuiClient
parent0a028cd53598276d375cde1d09e870294ad4d626 (diff)
downloadqxmpp-3b60dc4e32446afed425bd35f15b8000503c2788.tar.gz
first version of xml console
Diffstat (limited to 'examples/GuiClient')
-rw-r--r--examples/GuiClient/GuiClient.pro9
-rw-r--r--examples/GuiClient/mainDialog.cpp11
-rw-r--r--examples/GuiClient/xmlConsoleDialog.cpp20
-rw-r--r--examples/GuiClient/xmlConsoleDialog.h26
-rw-r--r--examples/GuiClient/xmlConsoleDialog.ui67
5 files changed, 129 insertions, 4 deletions
diff --git a/examples/GuiClient/GuiClient.pro b/examples/GuiClient/GuiClient.pro
index 1f518795..09591c5e 100644
--- a/examples/GuiClient/GuiClient.pro
+++ b/examples/GuiClient/GuiClient.pro
@@ -23,7 +23,8 @@ SOURCES += main.cpp \
vCardCache.cpp \
profileDialog.cpp \
capabilitiesCache.cpp \
- accountsCache.cpp
+ accountsCache.cpp \
+ xmlConsoleDialog.cpp
HEADERS += messageGraphicsItem.h \
chatGraphicsScene.h \
@@ -44,12 +45,14 @@ HEADERS += messageGraphicsItem.h \
vCardCache.h \
profileDialog.h \
capabilitiesCache.h \
- accountsCache.h
+ accountsCache.h \
+ xmlConsoleDialog.h
FORMS += mainDialog.ui \
chatDialog.ui \
statusWidget.ui \
- profileDialog.ui
+ profileDialog.ui \
+ xmlConsoleDialog.ui
QT += network \
xml
diff --git a/examples/GuiClient/mainDialog.cpp b/examples/GuiClient/mainDialog.cpp
index 8272e023..3d4dc49a 100644
--- a/examples/GuiClient/mainDialog.cpp
+++ b/examples/GuiClient/mainDialog.cpp
@@ -38,6 +38,7 @@
#include "QXmppRosterIq.h"
#include "profileDialog.h"
+#include "xmlConsoleDialog.h"
#include <QMovie>
#include <QCompleter>
@@ -89,7 +90,7 @@ mainDialog::mainDialog(QWidget *parent): QDialog(parent, Qt::Window),
this, SLOT(presenceReceived(const QXmppPresence&)));
Q_ASSERT(check);
- QXmppLogger::getLogger()->setLoggingType(QXmppLogger::FileLogging);
+ QXmppLogger::getLogger()->setLoggingType(QXmppLogger::SignalLogging);
check = connect(&m_xmppClient.rosterManager(),
@@ -803,4 +804,12 @@ void mainDialog::errorClient(QXmppClient::Error error)
void mainDialog::action_showXml()
{
+ xmlConsoleDialog dlg(this);
+ bool check = connect(QXmppLogger::getLogger(),
+ SIGNAL(message(QXmppLogger::MessageType, const QString &)),
+ &dlg,
+ SLOT(message(QXmppLogger::MessageType, const QString &)));
+ Q_ASSERT(check);
+ Q_UNUSED(check);
+ dlg.exec();
}
diff --git a/examples/GuiClient/xmlConsoleDialog.cpp b/examples/GuiClient/xmlConsoleDialog.cpp
new file mode 100644
index 00000000..bad3cd49
--- /dev/null
+++ b/examples/GuiClient/xmlConsoleDialog.cpp
@@ -0,0 +1,20 @@
+#include "xmlConsoleDialog.h"
+#include "ui_xmlConsoleDialog.h"
+
+xmlConsoleDialog::xmlConsoleDialog(QWidget *parent) :
+ QDialog(parent),
+ ui(new Ui::xmlConsoleDialog)
+{
+ ui->setupUi(this);
+}
+
+xmlConsoleDialog::~xmlConsoleDialog()
+{
+ delete ui;
+}
+
+void xmlConsoleDialog::message(QXmppLogger::MessageType type, const QString& text)
+{
+ ui->textBrowser->append(text);
+ ui->textBrowser->append("\n");
+}
diff --git a/examples/GuiClient/xmlConsoleDialog.h b/examples/GuiClient/xmlConsoleDialog.h
new file mode 100644
index 00000000..08caec59
--- /dev/null
+++ b/examples/GuiClient/xmlConsoleDialog.h
@@ -0,0 +1,26 @@
+#ifndef XMLCONSOLEDIALOG_H
+#define XMLCONSOLEDIALOG_H
+
+#include <QDialog>
+#include "QXmppLogger.h"
+
+namespace Ui {
+ class xmlConsoleDialog;
+}
+
+class xmlConsoleDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ explicit xmlConsoleDialog(QWidget *parent = 0);
+ ~xmlConsoleDialog();
+
+public slots:
+ void message(QXmppLogger::MessageType, const QString &);
+
+private:
+ Ui::xmlConsoleDialog *ui;
+};
+
+#endif // XMLCONSOLEDIALOG_H
diff --git a/examples/GuiClient/xmlConsoleDialog.ui b/examples/GuiClient/xmlConsoleDialog.ui
new file mode 100644
index 00000000..a4586d7e
--- /dev/null
+++ b/examples/GuiClient/xmlConsoleDialog.ui
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>xmlConsoleDialog</class>
+ <widget class="QDialog" name="xmlConsoleDialog">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Dialog</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QTextBrowser" name="textBrowser"/>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>xmlConsoleDialog</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>248</x>
+ <y>254</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>157</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>xmlConsoleDialog</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>316</x>
+ <y>260</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>286</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>