2 ******************************************************************************
5 * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
6 * Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009.
7 *****************************************************************************/
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 3 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #include "aboutdialog.h"
26 #include "version_info/version_info.h"
27 #include "coreconstants.h"
30 #include <QtCore/QDate>
31 #include <QtCore/QFile>
32 #include <QtCore/QSysInfo>
33 #include <QDesktopServices>
35 #include <QVBoxLayout>
40 #include <QQmlContext>
42 using namespace Core::Constants
;
44 AboutDialog::AboutDialog(QWidget
*parent
) :
47 setWindowIcon(QIcon(":/core/images/librepilot_logo_32.png"));
48 setWindowTitle(tr("About %1").arg(ORG_BIG_NAME
));
49 setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint
);
50 setMinimumSize(600, 400);
51 setMaximumSize(800, 600);
53 const QString description
= tr(
54 "Revision: <b>%1</b><br/>"
55 "UAVO Hash: <b>%2</b><br/>"
58 "Built on %4 at %5<br/>"
59 "Based on Qt %6 (%7 bit)<br/>"
61 "\u00A9 The %8 Project, 2015-%9. All rights reserved.<br/>"
62 "\u00A9 The OpenPilot Project, 2010-2015. All rights reserved.<br/>"
64 VersionInfo::revision().left(60), // %1
65 VersionInfo::uavoHash().left(8), // %2
66 VersionInfo::origin(), // $3
67 QLatin1String(__DATE__
), // %4
68 QLatin1String(__TIME__
), // %5
69 QLatin1String(QT_VERSION_STR
), // %6
70 QString::number(QSysInfo::WordSize
), // %7
71 QLatin1String(ORG_BIG_NAME
), // %8
72 VersionInfo::year() // %9
75 // %1 = name, %2 = description, %3 = url, %4 = image url (not used)
76 // <td><img src=\"%4\" size=\"32\"></td>
77 QString creditRow
= "<tr padding=10><td><b>%1</b>%2<br/></td><td><a href=\"%3\">%3</a></td></tr>";
79 // uses Text.StyledText (see http://doc.qt.io/qt-5/qml-qtquick-text.html#textFormat-prop)
80 const QString credits
= "<table width=\"100%\">"
81 + creditRow
.arg("Tau Labs", "", "http://www.taulabs.org")
82 + creditRow
.arg("dRonin", "", "http://www.dronin.org")
83 + creditRow
.arg("OpenSceneGraph", "<br/>Open source high performance 3D graphics toolkit", "http://www.openscenegraph.org")
84 + creditRow
.arg("osgEarth", "<br/>Geospatial SDK for OpenSceneGraph", "http://osgearth.org")
85 + creditRow
.arg("gstreamer", "<br/>Open source multimedia framework", "https://gstreamer.freedesktop.org/")
86 + creditRow
.arg("MSYS2", "<br/>An independent rewrite of MSYS", "https://github.com/msys2/msys2/wiki")
87 + creditRow
.arg("The Qt Company", "", "https://www.qt.io")
90 // uses Text.StyledText (see http://doc.qt.io/qt-5/qml-qtquick-text.html#textFormat-prop)
91 const QString license
= tr("This program is free software; you can redistribute it and/or "
92 "modify it under the terms of the GNU General Public License "
93 "as published by the Free Software Foundation; either version 3 "
94 "of the License, or (at your option) any later version.\n"
95 "The program is provided AS IS with NO WARRANTY OF ANY KIND, "
96 "INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE."
100 QQuickView
*view
= new QQuickView();
101 view
->rootContext()->setContextProperty("dialog", this);
102 view
->rootContext()->setContextProperty("version", description
);
103 view
->rootContext()->setContextProperty("credits", credits
);
104 view
->rootContext()->setContextProperty("license", license
);
105 view
->setResizeMode(QQuickView::SizeRootObjectToView
);
106 view
->setSource(QUrl("qrc:/core/qml/AboutDialog.qml"));
108 QWidget
*container
= QWidget::createWindowContainer(view
);
109 container
->setMinimumSize(600, 400);
110 container
->setMaximumSize(800, 600);
111 container
->setSizePolicy(QSizePolicy::Expanding
, QSizePolicy::Expanding
);
112 QVBoxLayout
*lay
= new QVBoxLayout();
113 lay
->setContentsMargins(0, 0, 0, 0);
115 layout()->addWidget(container
);
118 void AboutDialog::openUrl(const QString
&url
)
120 QDesktopServices::openUrl(QUrl(url
));
123 AboutDialog::~AboutDialog()