36 #include <QtCore/QDate>
37 #include <QtCore/QFile>
38 #include <QtCore/QSysInfo>
40 #include <QDialogButtonBox>
41 #include <QGridLayout>
43 #include <QPushButton>
44 #include <QTextBrowser>
45 #include <QApplication>
49 using namespace Core::Internal;
50 using namespace Core::Constants;
57 setWindowIcon(QIcon(
":/core/gcs_nontrans_128"));
59 setWindowTitle(tr(
"About " GCS_PROJECT_BRANDING_PRETTY
" GCS"));
60 setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
61 QGridLayout *layout =
new QGridLayout(
this);
62 layout->setSizeConstraint(QLayout::SetFixedSize);
67 if (versionData.split(QLatin1String(
"%@%")).length() >= 2) {
68 versionName = versionData.split(QLatin1String(
"%@%")).at(0);
69 versionHash = versionData.split(QLatin1String(
"%@%")).at(1);
71 qWarning() <<
"Invalid GCS version information:" << versionData;
79 ideRev = tr(
"From revision %1<br/>").arg(revision);
84 QByteArray uavoHashArray;
87 uavoHash.remove(0, 2);
88 uavoHash = uavoHash.trimmed();
90 foreach (QString str, uavoHash.split(
",")) {
91 uavoHashArray.append(str.toInt(&ok, 16));
93 QString gcsUavoHashStr;
94 foreach (
char i, uavoHashArray) {
95 gcsUavoHashStr.append(QString::number(i, 16).right(2));
97 uavoHashStr = tr(
"UAVO hash %1<br/>").arg(gcsUavoHashStr.left(8));
99 const QString version_name = tr(
"<h3><center>" GCS_PROJECT_BRANDING_PRETTY
"GCS<center></h3>"
100 "<h4><center>%1: %2</center></h4>")
101 .arg(versionName, versionHash);
102 const QString version_description =
103 tr(
"Based on Qt %1 (%2 bit)<br/>"
105 "Built on %3 at %4<br />"
111 .arg(QLatin1String(QT_VERSION_STR), QString::number(QSysInfo::WordSize),
112 QLatin1String(__DATE__), QLatin1String(__TIME__), ideRev, uavoHashStr);
115 tr(
"Copyright %0 %1, 2012-2015 Tau Labs, 2010-2012 OpenPilot. All rights reserved.<br/>"
117 "Between 2010 and 2012, a significant part of this application was designed "
118 "and implemented within the OpenPilot project.<br/>"
119 "This work was further based on work from the Nokia Corporation for Qt Creator.<br/>"
121 "<small>This program is free software; you can redistribute it and/or modify"
122 "it under the terms of the GNU General Public License as published by"
123 "the Free Software Foundation; either version 3 of the License, or"
124 "(at your option) any later version.<br/><br/>"
125 "The program is provided AS IS with NO WARRANTY OF ANY KIND, "
126 "INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A "
127 "PARTICULAR PURPOSE.</small><br/>")
130 QLabel *versionNameLabel =
new QLabel(version_name);
131 QLabel *versionDescription =
new QLabel(version_description);
132 versionDescription->setWordWrap(
true);
133 versionDescription->setOpenExternalLinks(
true);
134 versionDescription->setTextInteractionFlags(Qt::TextBrowserInteraction);
135 versionNameLabel->setWordWrap(
true);
136 versionNameLabel->setOpenExternalLinks(
true);
137 versionNameLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
139 QDialogButtonBox *buttonBox =
new QDialogButtonBox(QDialogButtonBox::Close);
140 QPushButton *closeButton = buttonBox->button(QDialogButtonBox::Close);
141 QTC_ASSERT(closeButton, );
142 buttonBox->addButton(closeButton, QDialogButtonBox::ButtonRole(QDialogButtonBox::RejectRole
143 | QDialogButtonBox::AcceptRole));
144 connect(buttonBox, SIGNAL(rejected()),
this, SLOT(reject()));
146 QLabel *logoLabel =
new QLabel;
147 logoLabel->setPixmap(QPixmap(QLatin1String(
":/core/gcs_logo_128")));
149 QLabel *copyRightLabel =
new QLabel(copyright);
150 copyRightLabel->setWordWrap(
true);
151 copyRightLabel->setOpenExternalLinks(
true);
152 copyRightLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
154 layout->addWidget(versionNameLabel, 0, 0, 1, 2);
155 layout->addWidget(logoLabel, 1, 1, 1, 1);
156 layout->addWidget(versionDescription, 1, 0, 1, 1);
157 layout->addWidget(copyRightLabel, 3, 0, 1, 2);
158 layout->addWidget(buttonBox, 5, 0, 1, 2);
const char *const UAVOSHA1_STR
const char *const GCS_REVISION_PRETTY_STR
const char *const GCS_YEAR
const char *const GCS_AUTHOR
const char *const GCS_REVISION_STR
VersionDialog(QWidget *parent)