|
| 1 | +// This file is part of Simple Normal Mapper. |
| 2 | +// Copyright (c) 2013 Simple Normal Mapper developers. |
| 3 | +// |
| 4 | +// Simple Normal Mapper is free software: you can redistribute it and/or modify |
| 5 | +// it under the terms of the GNU General Public License as published by |
| 6 | +// the Free Software Foundation, either version 3 of the License, or |
| 7 | +// (at your option) any later version. |
| 8 | +// Simple Normal Mapper is distributed in the hope that it will be useful, |
| 9 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | +// GNU General Public License for more details. |
| 12 | +// |
| 13 | +// You should have received a copy of the GNU General Public License |
| 14 | +// along with Simple Normal Mapper. If not, see <http://www.gnu.org/licenses/>. |
| 15 | + |
| 16 | +#include "AboutDlg.hpp" |
| 17 | +#include "Config.hpp" |
| 18 | + |
| 19 | +#include <QHBoxLayout> |
| 20 | +#include <QLabel> |
| 21 | +#include <QPixmap> |
| 22 | +#include <QPushButton> |
| 23 | +#include <QVBoxLayout> |
| 24 | + |
| 25 | +AboutDlg::AboutDlg(QWidget * parent) |
| 26 | +: QDialog(parent) |
| 27 | +{ |
| 28 | + setWindowTitle(tr("About") + " " + Config::name()); |
| 29 | + initWidgets(); |
| 30 | +} |
| 31 | + |
| 32 | +void AboutDlg::initWidgets() |
| 33 | +{ |
| 34 | + QVBoxLayout * vLayout = new QVBoxLayout(this); |
| 35 | + QHBoxLayout * hLayout = new QHBoxLayout(); |
| 36 | + QLabel * pixmapLabel = new QLabel(this); |
| 37 | + |
| 38 | + pixmapLabel->setPixmap(QPixmap(":/about.png").scaledToWidth(256)); |
| 39 | + hLayout->addWidget(pixmapLabel); |
| 40 | + |
| 41 | + QLabel * infoLabel = new QLabel(this); |
| 42 | + infoLabel->setText(QString("<h2>") + Config::name() + " v" + Config::version() + "</h2>" |
| 43 | + + "<p>" + Config::name() + " is licenced under GNU GPLv3.</p>" |
| 44 | + + "<p>Copyright (c) 2013 " + Config::name() + " developers.</p>" |
| 45 | + + "<a href='http://sourceforge.net/projects/simplenormalmapper'>" |
| 46 | + + "http://sourceforge.net/projects/simplenormalmapper</a>"); |
| 47 | + |
| 48 | + hLayout->addWidget(infoLabel); |
| 49 | + vLayout->addLayout(hLayout); |
| 50 | + QHBoxLayout * buttonLayout = new QHBoxLayout(); |
| 51 | + QPushButton * button = new QPushButton("&Ok", this); |
| 52 | + connect(button, SIGNAL(clicked()), this, SLOT(accept())); |
| 53 | + buttonLayout->addWidget(button); |
| 54 | + buttonLayout->insertStretch(0); |
| 55 | + vLayout->addLayout(buttonLayout); |
| 56 | +} |
0 commit comments