aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Kampas <martin.kampas@jolla.com>2016-09-22 08:47:20 +0200
committerJuergen Bocklage-Ryannel <juergen.bocklage-ryannel@pelagicore.com>2016-10-06 06:52:24 +0000
commit4d30e91bff1cbd8f2411bda769fdce594ee38b1a (patch)
tree409f952d66eaecb9f3b5d383b24a8f955f31dfac
parent8fc5ef93055b42cad1067299f742bbe2d9a10b7d (diff)
Bench: Add About dialog
Change-Id: Ibf215c4f85f136798ae817b33854da316219e5b8 Reviewed-by: Juergen Bocklage-Ryannel <juergen.bocklage-ryannel@pelagicore.com>
-rw-r--r--doc/installation.qdoc8
-rw-r--r--qmllive.pri4
-rw-r--r--src/bench/aboutdialog.cpp90
-rw-r--r--src/bench/aboutdialog.h45
-rw-r--r--src/bench/bench.pro2
-rw-r--r--src/bench/mainwindow.cpp6
-rw-r--r--src/qmllive_version.h50
-rw-r--r--src/src.pri1
8 files changed, 206 insertions, 0 deletions
diff --git a/doc/installation.qdoc b/doc/installation.qdoc
index 6a3f8b7..47c950c 100644
--- a/doc/installation.qdoc
+++ b/doc/installation.qdoc
@@ -135,6 +135,14 @@ The following custom qmake variables are recognized:
\li EXAMPLES_PREFIX
\li Installation prefix for examples. Defaults to
\c{$$[QT_INSTALL_LIBS]/qmllive/examples}.
+
+\row
+ \li QMLLIVE_VERSION_EXTRA
+ \li Distribution specific version description (spaces allowed).
+
+\row
+ \li QMLLIVE_REVISION
+ \li The VCS revision number.
\endtable
diff --git a/qmllive.pri b/qmllive.pri
index fa615d6..1d15253 100644
--- a/qmllive.pri
+++ b/qmllive.pri
@@ -11,6 +11,10 @@ VERSIONS = $$split(VERSION, ".")
VERSION_MAJOR = $$member(VERSIONS, 0)
unset(VERSIONS)
+DEFINES += QMLLIVE_VERSION=$$VERSION
+!isEmpty(QMLLIVE_VERSION_EXTRA): DEFINES += QMLLIVE_VERSION_EXTRA="\"$$QMLLIVE_VERSION_EXTRA\""
+!isEmpty(QMLLIVE_REVISION): DEFINES += QMLLIVE_REVISION=$$QMLLIVE_REVISION
+
# from qtcreator.pri
defineTest(minQtVersion) {
maj = $$1
diff --git a/src/bench/aboutdialog.cpp b/src/bench/aboutdialog.cpp
new file mode 100644
index 0000000..ca6b3a5
--- /dev/null
+++ b/src/bench/aboutdialog.cpp
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Pelagicore AG
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QmlLive tool.
+**
+** $QT_BEGIN_LICENSE:GPL-QTAS$
+** Commercial License Usage
+** Licensees holding valid commercial Qt Automotive Suite licenses may use
+** this file in accordance with the commercial license agreement provided
+** with the Software or, alternatively, in accordance with the terms
+** contained in a written agreement between you and The Qt Company. For
+** licensing terms and conditions see https://www.qt.io/terms-conditions.
+** For further information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: GPL-3.0
+**
+****************************************************************************/
+
+#include "aboutdialog.h"
+
+#include <QApplication>
+#include <QDialogButtonBox>
+#include <QLabel>
+#include <QVBoxLayout>
+
+#include "qmllive_version.h"
+
+AboutDialog::AboutDialog(QWidget *parent)
+ : QDialog(parent)
+{
+ setWindowTitle(tr("About Qt QML Live"));
+ setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
+
+ QVBoxLayout *layout = new QVBoxLayout(this);
+
+ QString versionExtra;
+#ifdef QMLLIVE_VERSION_EXTRA
+ versionExtra = QLatin1String(" (") + QLatin1String(QMLLIVE_VERSION_EXTRA_STR) + QLatin1String(")");
+#endif
+
+ QString buildInfo;
+#ifdef QMLLIVE_REVISION
+ buildInfo = tr("<p>Built on %1 %2 from revision %3.</p>")
+ .arg(QLatin1String(__DATE__),
+ QLatin1String(__TIME__),
+ QString::fromLatin1(QMLLIVE_REVISION_STR).left(7));
+#endif
+
+ QString about = tr(
+ "<h3>Qt QML Live %1%2</h3>"
+ "%3"
+ "<p>%4</p>"
+ "<p>The program is provided AS IS with NO WARRANTY OF ANY KIND, "
+ "INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A "
+ "PARTICULAR PURPOSE.</p>")
+ .arg(QLatin1String(QMLLIVE_VERSION_STR),
+ versionExtra,
+ buildInfo,
+ QLatin1String(QMLLIVE_COPYRIGHT_NOTICE));
+
+ QLabel *label = new QLabel(about);
+ label->setWordWrap(true);
+ label->setTextInteractionFlags(Qt::TextBrowserInteraction);
+
+ QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
+ connect(buttonBox , &QDialogButtonBox::rejected, this, &QDialog::reject);
+
+ layout->addWidget(label);
+ layout->addWidget(buttonBox);
+}
+
+void AboutDialog::exec(QWidget *parent)
+{
+ AboutDialog *dialog = new AboutDialog(parent);
+ dialog->setAttribute(Qt::WA_DeleteOnClose);
+ dialog->exec();
+}
diff --git a/src/bench/aboutdialog.h b/src/bench/aboutdialog.h
new file mode 100644
index 0000000..e44f707
--- /dev/null
+++ b/src/bench/aboutdialog.h
@@ -0,0 +1,45 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Pelagicore AG
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QmlLive tool.
+**
+** $QT_BEGIN_LICENSE:GPL-QTAS$
+** Commercial License Usage
+** Licensees holding valid commercial Qt Automotive Suite licenses may use
+** this file in accordance with the commercial license agreement provided
+** with the Software or, alternatively, in accordance with the terms
+** contained in a written agreement between you and The Qt Company. For
+** licensing terms and conditions see https://www.qt.io/terms-conditions.
+** For further information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: GPL-3.0
+**
+****************************************************************************/
+
+#pragma once
+
+#include <QDialog>
+
+class AboutDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ explicit AboutDialog(QWidget *parent = 0);
+
+ using QDialog::exec;
+ static void exec(QWidget *parent);
+};
diff --git a/src/bench/bench.pro b/src/bench/bench.pro
index 13ada8a..d6a94ae 100644
--- a/src/bench/bench.pro
+++ b/src/bench/bench.pro
@@ -8,6 +8,7 @@ CONFIG += c++11
QT *= gui core quick widgets core-private
SOURCES += \
+ aboutdialog.cpp \
main.cpp \
mainwindow.cpp \
optionsdialog.cpp \
@@ -29,6 +30,7 @@ SOURCES += \
options.cpp
HEADERS += \
+ aboutdialog.h \
mainwindow.h \
optionsdialog.h \
benchlivenodeengine.h \
diff --git a/src/bench/mainwindow.cpp b/src/bench/mainwindow.cpp
index 73375f3..e534668 100644
--- a/src/bench/mainwindow.cpp
+++ b/src/bench/mainwindow.cpp
@@ -38,6 +38,7 @@
#include "widgets/workspaceview.h"
#include "widgets/logview.h"
+#include "aboutdialog.h"
#include "livehubengine.h"
#include "benchlivenodeengine.h"
#include "qmlhelper.h"
@@ -201,6 +202,11 @@ void MainWindow::setupMenuBar()
view->addAction(m_hostDock->toggleViewAction());
m_logDockMenu = view->addMenu("Logs");
m_logDockMenu->addAction(m_logDock->toggleViewAction());
+
+ QMenu *help = menuBar()->addMenu(tr("&Help"));
+ QAction *about = help->addAction(tr("About Qt QML Live..."));
+ connect(about, &QAction::triggered, this, [this]() { AboutDialog::exec(this); });
+ about->setMenuRole(QAction::AboutRole);
}
void MainWindow::init(Options *options)
diff --git a/src/qmllive_version.h b/src/qmllive_version.h
new file mode 100644
index 0000000..96ad1c2
--- /dev/null
+++ b/src/qmllive_version.h
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Pelagicore AG
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QmlLive tool.
+**
+** $QT_BEGIN_LICENSE:GPL-QTAS$
+** Commercial License Usage
+** Licensees holding valid commercial Qt Automotive Suite licenses may use
+** this file in accordance with the commercial license agreement provided
+** with the Software or, alternatively, in accordance with the terms
+** contained in a written agreement between you and The Qt Company. For
+** licensing terms and conditions see https://www.qt.io/terms-conditions.
+** For further information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: GPL-3.0
+**
+****************************************************************************/
+
+#pragma once
+
+#include <QtGlobal>
+
+const char *const QMLLIVE_COPYRIGHT_NOTICE = "Copyright 2016 Pelagicore AG. All rights reserved.";
+
+const char *const QMLLIVE_VERSION_STR = QT_STRINGIFY(QMLLIVE_VERSION);
+
+#ifdef QMLLIVE_VERSION_EXTRA
+const char *const QMLLIVE_VERSION_EXTRA_STR = QT_STRINGIFY(QMLLIVE_VERSION_EXTRA);
+#else
+const char *const QMLLIVE_VERSION_EXTRA_STR = "";
+#endif
+
+#ifdef QMLLIVE_REVISION
+const char *const QMLLIVE_REVISION_STR = QT_STRINGIFY(QMLLIVE_REVISION);
+#else
+const char *const QMLLIVE_REVISION_STR = "";
+#endif
diff --git a/src/src.pri b/src/src.pri
index 55dd139..8a629e6 100644
--- a/src/src.pri
+++ b/src/src.pri
@@ -35,6 +35,7 @@ public_headers += \
HEADERS += \
$$public_headers \
+ $$PWD/qmllive_version.h \
$$PWD/watcher.h \
$$PWD/imageadapter.h \
$$PWD/contentpluginfactory.h \