[vlc-devel] [RFC 40/82] qt: provide QML model for about/info dialog

Pierre Lamot pierre at videolabs.io
Fri Feb 1 14:01:44 CET 2019


---
 modules/gui/qt/Makefile.am               |  3 ++
 modules/gui/qt/components/aboutmodel.cpp | 50 ++++++++++++++++++++++++
 modules/gui/qt/components/aboutmodel.hpp | 40 +++++++++++++++++++
 3 files changed, 93 insertions(+)
 create mode 100644 modules/gui/qt/components/aboutmodel.cpp
 create mode 100644 modules/gui/qt/components/aboutmodel.hpp

diff --git a/modules/gui/qt/Makefile.am b/modules/gui/qt/Makefile.am
index 526eb8b183..d48aa0c1e2 100644
--- a/modules/gui/qt/Makefile.am
+++ b/modules/gui/qt/Makefile.am
@@ -77,6 +77,8 @@ libqt_plugin_la_SOURCES = \
 	gui/qt/dialogs/fingerprintdialog.hpp \
 	gui/qt/components/qml_main_context.cpp \
 	gui/qt/components/qml_main_context.hpp \
+	gui/qt/components/aboutmodel.cpp \
+	gui/qt/components/aboutmodel.hpp \
 	gui/qt/components/dialogmodel.cpp \
 	gui/qt/components/dialogmodel.hpp \
 	gui/qt/components/extended_panels.cpp \
@@ -200,6 +202,7 @@ nodist_libqt_plugin_la_SOURCES = \
 	gui/qt/dialogs/extensions.moc.cpp \
 	gui/qt/dialogs/fingerprintdialog.moc.cpp \
 	gui/qt/components/qml_main_context.moc.cpp \
+	gui/qt/components/aboutmodel.moc.cpp \
 	gui/qt/components/dialogmodel.moc.cpp \
 	gui/qt/components/extended_panels.moc.cpp \
 	gui/qt/components/info_panels.moc.cpp \
diff --git a/modules/gui/qt/components/aboutmodel.cpp b/modules/gui/qt/components/aboutmodel.cpp
new file mode 100644
index 0000000000..3322f76989
--- /dev/null
+++ b/modules/gui/qt/components/aboutmodel.cpp
@@ -0,0 +1,50 @@
+/*****************************************************************************
+ * Copyright (C) 2019 VLC authors and VideoLAN
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * ( at your option ) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "aboutmodel.hpp"
+
+#include "vlc_about.h"
+
+
+AboutModel::AboutModel(QObject *parent) : QObject(parent)
+{
+}
+
+QString AboutModel::getLicense() const
+{
+    return QString::fromUtf8(psz_license);
+}
+
+QString AboutModel::getAuthors() const
+{
+    return QString::fromUtf8(psz_authors);
+}
+
+QString AboutModel::getThanks() const
+{
+    return QString::fromUtf8(psz_thanks);
+}
+
+QString AboutModel::getVersion() const
+{
+    return QString::fromUtf8(VERSION_MESSAGE);
+
+}
diff --git a/modules/gui/qt/components/aboutmodel.hpp b/modules/gui/qt/components/aboutmodel.hpp
new file mode 100644
index 0000000000..65b5e8c98c
--- /dev/null
+++ b/modules/gui/qt/components/aboutmodel.hpp
@@ -0,0 +1,40 @@
+/*****************************************************************************
+ * Copyright (C) 2019 VLC authors and VideoLAN
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * ( at your option ) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+#ifndef ABOUTMODEL_HPP
+#define ABOUTMODEL_HPP
+
+#include <QObject>
+
+class AboutModel : public QObject
+{
+    Q_OBJECT
+
+    Q_PROPERTY(QString license READ getLicense CONSTANT)
+    Q_PROPERTY(QString authors READ getAuthors CONSTANT)
+    Q_PROPERTY(QString thanks  READ getThanks  CONSTANT)
+    Q_PROPERTY(QString version  READ getVersion  CONSTANT)
+public:
+    explicit AboutModel(QObject *parent = nullptr);
+
+    QString getLicense() const;
+    QString getAuthors() const;
+    QString getThanks() const;
+    QString getVersion() const;
+};
+
+#endif // ABOUTMODEL_HPP
-- 
2.19.1



More information about the vlc-devel mailing list