Pencil2D  ff90c0872e88be3bf81c548cd60f01983012ec49
Pencil2D is an animation software for both bitmap and vector graphics. It is free, multi-platform, and open source.
 All Classes Functions
aboutdialog.cpp
1 /*
2 
3 Pencil - Traditional Animation Software
4 Copyright (C) 2012-2017 Matthew Chiawen Chang
5 
6 This program is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public License
8 as published by the Free Software Foundation; version 2 of the License.
9 
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14 
15 */
16 
17 #include <QtWidgets>
18 #include <QSpinBox>
19 #include <QGridLayout>
20 #include <QGroupBox>
21 
22 #include "aboutdialog.h"
23 
24 
25 AboutDialog::AboutDialog(QWidget* parent ) : QDialog(parent)
26 {
27  setWindowTitle(tr("About"));
28  setFixedSize(450,450);
29 }
30 
31 void AboutDialog::init()
32 {
33  QVBoxLayout* lay = new QVBoxLayout;
34  QPushButton *okButton = new QPushButton(tr("OK"));
35 
36  QHBoxLayout* buttonsLayout = new QHBoxLayout;
37 
38  devInfoText = new QLabel(this);
39  aboutText = new QLabel(this);
40  logo = new QLabel(this);
41  logoText = new QLabel(this);
42 
43  logo->setPixmap(QPixmap(":icons/logo.png"));
44  logo->setAlignment(Qt::AlignCenter);
45  logoText->setAlignment(Qt::AlignCenter);
46 
47  logoText->setText(tr("<b>Pencil2D</b>"));
48  aboutText->setTextInteractionFlags(Qt::TextBrowserInteraction); //FIXME: links clickable but doesn't open browser.
49  aboutText->setWordWrap(true);
50  aboutText->setText(tr("Official site: <a href=\"http://pencil2d.org\">pencil2d.org</a>"
51  "<br>Developed by: <b>Pascal Naidon, Patrick Corrieri, Matt Chang, Cirus</b></>"
52  "<br>Thanks to: Qt Framework <a href=\"http://qt-project.org\">qt-project.org</a></>"
53  "<br>Distributed under the <a href=\"http://www.gnu.org/licenses/gpl-2.0.html\">GNU General Public License, version 2</a></>"));
54 
55  connect(okButton, &QAbstractButton::clicked, this, &QDialog::accept);
56 
57  buttonsLayout->addWidget(okButton);
58 
59  lay->addWidget(logo);
60  lay->addWidget(logoText);
61  lay->addWidget(aboutText);
62 
63 #define STRINGIFY(x) #x
64 #define TOSTRING(x) STRINGIFY(x)
65 #define S__GIT_TIMESTAMP__ TOSTRING(GIT_TIMESTAMP)
66 #define S__GIT_COMMIT_HASH__ TOSTRING(GIT_CURRENT_SHA1)
67 
68 #ifdef GIT_EXISTS
69  devInfoText->setStyleSheet("QLabel { background-color: #ffffff;"
70  "border-style: solid; border-width: 1px; border-color: gray;}");
71  devInfoText->setTextInteractionFlags(Qt::TextSelectableByMouse);
72  devInfoText->setFixedHeight(60);
73  devInfoText->setAlignment(Qt::AlignCenter);
74  devInfoText->setText(tr("commit: " S__GIT_COMMIT_HASH__ /*"<br> version: " APP_VERSION*/ "<br> date: " S__GIT_TIMESTAMP__)) ;
75  lay->addWidget(devInfoText);
76 #endif
77 
78 
79  lay->addLayout(buttonsLayout);
80 
81  setLayout(lay);
82 }