summaryrefslogtreecommitdiffstats
path: root/demos/multiuser/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'demos/multiuser/main.cpp')
-rwxr-xr-xdemos/multiuser/main.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/demos/multiuser/main.cpp b/demos/multiuser/main.cpp
new file mode 100755
index 0000000..026d765
--- /dev/null
+++ b/demos/multiuser/main.cpp
@@ -0,0 +1,40 @@
+#include <QtGui>
+#include <QUiLoader>
+#include <multiuserserver.h>
+
+QWidget *loadui(const QString &filename)
+{
+ QUiLoader loader;
+ QFile file(filename);
+ bool ok = file.open(QFile::ReadOnly);
+ if (!ok)
+ qWarning("WARNING: Could not open file %s", filename.toLocal8Bit().constData());
+ return loader.load(&file, 0);
+}
+
+class MyApplicationObject : public QObject
+{
+Q_OBJECT
+public slots:
+ void instantiateUi(QWidget **root, Session *session)
+ {
+ Q_UNUSED(session);
+ *root = loadui("widgets.ui");
+ }
+};
+
+int main(int argc, char **argv)
+{
+ QApplication app(argc, argv);
+ app.setStyle("cleanlooks");
+
+ MultiUserServer server;
+
+ MyApplicationObject object;
+ QObject::connect(&server, SIGNAL(newSession(QWidget **, Session *)),
+ &object, SLOT(instantiateUi(QWidget **, Session *)));
+
+ return app.exec();
+}
+
+#include "main.moc"