dRonin  adbada4
dRonin GCS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
authorsdialog.cpp
Go to the documentation of this file.
1 
14 /*
15  * This program is free software; you can redistribute it and/or modify
16  * it under the terms of the GNU General Public License as published by
17  * the Free Software Foundation; either version 3 of the License, or
18  * (at your option) any later version.
19  *
20  * This program is distributed in the hope that it will be useful, but
21  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
22  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23  * for more details.
24  *
25  * You should have received a copy of the GNU General Public License along
26  * with this program; if not, see <http://www.gnu.org/licenses/>
27  */
28 
29 #include "authorsdialog.h"
30 
31 #include "coreconstants.h"
32 #include "icore.h"
33 
34 #include <utils/qtcassert.h>
35 #include <utils/pathutils.h>
36 
37 #include <QtCore/QDate>
38 #include <QtCore/QFile>
39 #include <QtCore/QSysInfo>
40 
41 #include <QDialogButtonBox>
42 #include <QGridLayout>
43 #include <QLabel>
44 #include <QPushButton>
45 #include <QTextBrowser>
46 
47 using namespace Core;
48 using namespace Core::Internal;
49 using namespace Core::Constants;
50 
52  : QDialog(parent)
53 {
54  // We need to set the window icon explicitly here since for some reason the
55  // application icon isn't used when the size of the dialog is fixed (at least not on X11/GNOME)
56  setWindowIcon(QIcon(":/core/gcs_nontrans_128"));
57 
58  setWindowTitle(tr("About GCS Authors"));
59  setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
60  auto layout = new QGridLayout(this);
61  layout->setSizeConstraint(QLayout::SetFixedSize);
62 
63  QString version = QLatin1String(GCS_VERSION_LONG);
64  version += QDate(2007, 25, 10).toString(Qt::SystemLocaleDate);
65 
66  QLabel *mainLabel = new QLabel(
67  tr("%0 proudly brought to you by this fine team:").arg(GCS_PROJECT_BRANDING_PRETTY));
68 
69  QLabel *relCreditsLabel = new QLabel(tr("Current release:"));
70  relCreditsLabel->setWordWrap(true);
71  QTextBrowser *relCreditsArea = new QTextBrowser(this);
72  relCreditsArea->setSource(
73  QUrl::fromLocalFile(Utils::PathUtils::InsertDataPath("%%DATAPATH%%gcsrelauthors.html")));
74 
75  QLabel *creditsLabel =
76  new QLabel(tr("All time (including previous contributions under OpenPilot and Tau Labs):"));
77  creditsLabel->setWordWrap(true);
78  QTextBrowser *creditsArea = new QTextBrowser(this);
79  creditsArea->setSource(
80  QUrl::fromLocalFile(Utils::PathUtils::InsertDataPath("%%DATAPATH%%gcsauthors.html")));
81 
82  QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
83  QPushButton *closeButton = buttonBox->button(QDialogButtonBox::Close);
84  QTC_ASSERT(closeButton, );
85  buttonBox->addButton(closeButton, QDialogButtonBox::ButtonRole(QDialogButtonBox::RejectRole
86  | QDialogButtonBox::AcceptRole));
87  connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
88 
89  QLabel *logoLabel = new QLabel;
90  logoLabel->setPixmap(QPixmap(QLatin1String(":/core/gcs_logo_128")));
91 
92  layout->addWidget(logoLabel, 0, 0, 1, 2, Qt::AlignHCenter);
93  layout->addWidget(mainLabel, 1, 0, 1, 2, Qt::AlignHCenter);
94  layout->addWidget(relCreditsLabel, 2, 0, 1, 1, Qt::AlignBottom);
95  layout->addWidget(relCreditsArea, 3, 0, 1, 1, Qt::AlignTop);
96  layout->addWidget(creditsLabel, 2, 1, 1, 1, Qt::AlignBottom);
97  layout->addWidget(creditsArea, 3, 1, 1, 1, Qt::AlignTop);
98  layout->addWidget(buttonBox, 4, 0, 1, 2);
99 }
const char *const GCS_VERSION_LONG
Definition: coreconstants.h:51
static QString InsertDataPath(QString path)
Definition: pathutils.cpp:84