summaryrefslogtreecommitdiffstats
path: root/demos
diff options
context:
space:
mode:
authorMarek Rosa <marek.rosa@digia.com>2012-11-05 12:26:47 +0200
committerMarek Rosa <marek.rosa@digia.com>2012-11-05 12:26:47 +0200
commitbee5513889003e257b568e4eda036b2457fd2827 (patch)
tree55acf5bc6c52e68477895fe413c9dcf8c36845ba /demos
parentc51862848e08d39039db9cba4114192ceeeca7c0 (diff)
Added simple demoLauncher application
Diffstat (limited to 'demos')
-rwxr-xr-xdemos/demoLauncher/demoLauncherbin0 -> 30146 bytes
-rw-r--r--demos/demoLauncher/demoLauncher.pro7
-rw-r--r--demos/demoLauncher/main.cpp11
-rw-r--r--demos/demoLauncher/widget.cpp42
-rw-r--r--demos/demoLauncher/widget.h24
-rw-r--r--demos/demos.pro3
6 files changed, 86 insertions, 1 deletions
diff --git a/demos/demoLauncher/demoLauncher b/demos/demoLauncher/demoLauncher
new file mode 100755
index 00000000..e6435682
--- /dev/null
+++ b/demos/demoLauncher/demoLauncher
Binary files differ
diff --git a/demos/demoLauncher/demoLauncher.pro b/demos/demoLauncher/demoLauncher.pro
new file mode 100644
index 00000000..8353a8d9
--- /dev/null
+++ b/demos/demoLauncher/demoLauncher.pro
@@ -0,0 +1,7 @@
+!include( ../demos.pri ):error( "Couldn't find the demos.pri file!" )
+include(charts/charts.pri)
+
+TARGET = demoLauncher
+SOURCES += main.cpp\
+ widget.cpp
+HEADERS += widget.h
diff --git a/demos/demoLauncher/main.cpp b/demos/demoLauncher/main.cpp
new file mode 100644
index 00000000..7b1f424b
--- /dev/null
+++ b/demos/demoLauncher/main.cpp
@@ -0,0 +1,11 @@
+#include <QApplication>
+#include "widget.h"
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+ Widget w;
+ w.show();
+
+ return a.exec();
+}
diff --git a/demos/demoLauncher/widget.cpp b/demos/demoLauncher/widget.cpp
new file mode 100644
index 00000000..a1bc1435
--- /dev/null
+++ b/demos/demoLauncher/widget.cpp
@@ -0,0 +1,42 @@
+#include "widget.h"
+#include <QPushButton>
+#include <QDir>
+#include <QGridLayout>
+#include <QApplication>
+#include <QProcess>
+#include <QTimer>
+
+Widget::Widget(QWidget *parent)
+ : QWidget(parent),
+ m_demoApp(0)
+{
+ QList<QFileInfo> appList;
+
+ QDir appFolder(QApplication::applicationDirPath());
+ QStringList nameFilters;
+ nameFilters << "[^t][^s][^t]*";
+ appFolder.setNameFilters(nameFilters);
+ appList = appFolder.entryInfoList(QDir::Files);
+
+ QGridLayout* demosLayout = new QGridLayout;
+ for( int i = 0; i < appList.count(); i++) {
+ QPushButton *button = new QPushButton(appList[i].fileName());
+ connect(button, SIGNAL(clicked()), this, SLOT (runApp()));
+ demosLayout->addWidget(button, i%10, i/10);
+ }
+ setLayout(demosLayout);
+}
+
+Widget::~Widget()
+{
+ m_demoApp->close();
+}
+
+void Widget::runApp()
+{
+ QString name = qobject_cast<QPushButton *>(sender())->text();
+ QString program = QApplication::applicationDirPath() + QDir::separator() + name;
+
+ m_demoApp = new QProcess(this);
+ m_demoApp->start(program);
+}
diff --git a/demos/demoLauncher/widget.h b/demos/demoLauncher/widget.h
new file mode 100644
index 00000000..1a8a7858
--- /dev/null
+++ b/demos/demoLauncher/widget.h
@@ -0,0 +1,24 @@
+#ifndef WIDGET_H
+#define WIDGET_H
+
+#include <QWidget>
+
+class QProcess;
+
+class Widget : public QWidget
+{
+ Q_OBJECT
+
+public:
+ Widget(QWidget *parent = 0);
+ ~Widget();
+
+public slots:
+ void runApp();
+// void runAppShow();
+
+private:
+ QProcess *m_demoApp;
+};
+
+#endif // WIDGET_H
diff --git a/demos/demos.pro b/demos/demos.pro
index 1af6225d..e4e0cd0e 100644
--- a/demos/demos.pro
+++ b/demos/demos.pro
@@ -14,7 +14,8 @@ SUBDIRS += piechartcustomization \
qmlcustommodel \
chartinteractions \
qmlaxes \
- qmlcustomlegend
+ qmlcustomlegend \
+ demoLauncher
contains(QT_CONFIG, opengl) {
SUBDIRS += chartthemes \