summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@digia.com>2013-05-06 13:43:18 +0300
committerMiikka Heikkinen <miikka.heikkinen@digia.com>2013-05-06 13:59:32 +0300
commit65acb111b085568597ebf8a83241f4b0ab63a037 (patch)
tree553783409702c90c4867933ff46bfadb0be68a43 /tools
parent764230e0c100818773896ce8a1fcee94532797a3 (diff)
Bring back the once removed demoLauncher.
Since it is bit of a quick-and-dirty application, it now resides under tools dir, which is not included in releases. Change-Id: Iecfcbd761fc8e1ae371836fbd4f95d2489fbe39a Reviewed-by: Tomi Korpipää <tomi.korpipaa@digia.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/demoLauncher/demoLauncher.pro9
-rw-r--r--tools/demoLauncher/graphicsbutton.cpp55
-rw-r--r--tools/demoLauncher/graphicsbutton.h48
-rw-r--r--tools/demoLauncher/main.cpp31
-rw-r--r--tools/demoLauncher/widget.cpp81
-rw-r--r--tools/demoLauncher/widget.h39
6 files changed, 263 insertions, 0 deletions
diff --git a/tools/demoLauncher/demoLauncher.pro b/tools/demoLauncher/demoLauncher.pro
new file mode 100644
index 00000000..a8b8b122
--- /dev/null
+++ b/tools/demoLauncher/demoLauncher.pro
@@ -0,0 +1,9 @@
+!include( ../../demos/demos.pri ):error( "Couldn't find the demos.pri file!" )
+
+TARGET = demoLauncher
+SOURCES += main.cpp\
+ widget.cpp \
+ graphicsbutton.cpp
+
+HEADERS += widget.h \
+ graphicsbutton.h
diff --git a/tools/demoLauncher/graphicsbutton.cpp b/tools/demoLauncher/graphicsbutton.cpp
new file mode 100644
index 00000000..4ec16f42
--- /dev/null
+++ b/tools/demoLauncher/graphicsbutton.cpp
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "graphicsbutton.h"
+#include <QPainter>
+#include <QProcess>
+#include <QMouseEvent>
+
+GraphicsButton::GraphicsButton(const QString &path, QDir appFolder, const QString &app, QWidget *parent) :
+ QWidget(parent),
+ m_path(path),
+ m_appFolder(appFolder),
+ m_app(app),
+ m_demoApp(0)
+{
+ m_pixmap = QPixmap(path);
+}
+
+GraphicsButton::~GraphicsButton()
+{
+ if (m_demoApp)
+ m_demoApp->close();
+}
+
+void GraphicsButton::mousePressEvent(QMouseEvent *event)
+{
+ QString program = m_appFolder.absolutePath() + QDir::separator() + m_app;
+ m_demoApp = new QProcess(this);
+ m_demoApp->start(program);
+ event->accept();
+}
+
+void GraphicsButton::paintEvent(QPaintEvent *event)
+{
+ QPainter painter(this);
+ painter.drawPixmap(0, 0, this->width(), this->height(), m_pixmap);
+ QWidget::paintEvent(event);
+}
diff --git a/tools/demoLauncher/graphicsbutton.h b/tools/demoLauncher/graphicsbutton.h
new file mode 100644
index 00000000..4fd0ab4e
--- /dev/null
+++ b/tools/demoLauncher/graphicsbutton.h
@@ -0,0 +1,48 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef GRAPHICSBUTTON_H
+#define GRAPHICSBUTTON_H
+
+#include <QWidget>
+#include <QDir>
+
+class QProcess;
+
+class GraphicsButton : public QWidget
+{
+ Q_OBJECT
+public:
+ explicit GraphicsButton(const QString &path, QDir appFolder, const QString &app, QWidget *parent = 0);
+ ~GraphicsButton();
+q
+protected:
+ void mousePressEvent(QMouseEvent *event);
+ void paintEvent(QPaintEvent *event);
+
+private:
+ QPixmap m_pixmap;
+ QString m_path;
+ QDir m_appFolder;
+ QString m_app;
+ QProcess *m_demoApp;
+};
+
+#endif // GRAPHICSBUTTON_H
diff --git a/tools/demoLauncher/main.cpp b/tools/demoLauncher/main.cpp
new file mode 100644
index 00000000..dcf3dbac
--- /dev/null
+++ b/tools/demoLauncher/main.cpp
@@ -0,0 +1,31 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#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/tools/demoLauncher/widget.cpp b/tools/demoLauncher/widget.cpp
new file mode 100644
index 00000000..01b21f94
--- /dev/null
+++ b/tools/demoLauncher/widget.cpp
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "widget.h"
+#include <QDir>
+#include <QGridLayout>
+#include <QApplication>
+#include "graphicsbutton.h"
+
+Widget::Widget(QWidget *parent)
+ : QWidget(parent)
+{
+ setMinimumSize(800, 600);
+
+ m_appFolder = QDir(QApplication::applicationDirPath());
+#ifdef Q_OS_MAC
+ // The executable is inside an application bundle (a folder) on OSX
+ m_appFolder.cdUp();
+ m_appFolder.cdUp();
+ m_appFolder.cdUp();
+#endif
+
+ QDir imageFolder = m_appFolder;
+ imageFolder.cdUp();
+ imageFolder.cdUp();
+ imageFolder.cd("doc");
+ imageFolder.cd("images");
+
+ // Create push buttons for starting the executables
+ QGridLayout* demosLayout = new QGridLayout;
+
+ GraphicsButton *button = new GraphicsButton(imageFolder.absolutePath() + QDir::separator() + "demos_audio.png", m_appFolder, "audio", this);
+ demosLayout->addWidget(button, 0, 0);
+
+ button = new GraphicsButton(imageFolder.absolutePath() + QDir::separator() +"demos_callout.png", m_appFolder, "callout", this);
+ demosLayout->addWidget(button, 0, 1);
+
+ button = new GraphicsButton(imageFolder.absolutePath() + QDir::separator() +"demo_chartthemes_blue_cerulean.png", m_appFolder, "chartthemes", this);
+ demosLayout->addWidget(button, 0, 2);
+
+ button = new GraphicsButton(imageFolder.absolutePath() + QDir::separator() +"demos_nesteddonuts.png", m_appFolder, "nesteddonuts", this);
+ demosLayout->addWidget(button, 1, 0);
+
+ button = new GraphicsButton(imageFolder.absolutePath() + QDir::separator() +"examples_zoomlinechart1.png", m_appFolder, "zoomlinechart", this);
+ demosLayout->addWidget(button, 1, 1);
+
+ button = new GraphicsButton(imageFolder.absolutePath() + QDir::separator() +"examples_stackedbarchartdrilldown1.png", m_appFolder, "stackedbarchartdrilldown", this);
+ demosLayout->addWidget(button, 1, 2);
+
+ button = new GraphicsButton(imageFolder.absolutePath() + QDir::separator() +"piechart_customization.png", m_appFolder, "piechartcustomization", this);
+ demosLayout->addWidget(button, 2, 0);
+
+ button = new GraphicsButton(imageFolder.absolutePath() + QDir::separator() +"examples_datetimeaxis.png", m_appFolder, "datetimeaxis", this);
+ demosLayout->addWidget(button, 2, 1);
+
+ button = new GraphicsButton(imageFolder.absolutePath() + QDir::separator() +"examples_donutbreakdown.png", m_appFolder, "donutbreakdown", this);
+ demosLayout->addWidget(button, 2, 2);
+
+ setLayout(demosLayout);
+}
+
+Widget::~Widget()
+{
+}
diff --git a/tools/demoLauncher/widget.h b/tools/demoLauncher/widget.h
new file mode 100644
index 00000000..dc957626
--- /dev/null
+++ b/tools/demoLauncher/widget.h
@@ -0,0 +1,39 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef WIDGET_H
+#define WIDGET_H
+
+#include <QWidget>
+#include <QDir>
+
+class Widget : public QWidget
+{
+ Q_OBJECT
+
+public:
+ Widget(QWidget *parent = 0);
+ ~Widget();
+
+private:
+ QDir m_appFolder;
+};
+
+#endif // WIDGET_H