]> git.sur5r.net Git - minitube/blob - src/AboutView.cpp
1725ca8bfb53e8e6e0a8bddee56aadffc0314f71
[minitube] / src / AboutView.cpp
1 #include "AboutView.h"
2 #include "constants.h"
3
4 AboutView::AboutView(QWidget *parent) : QWidget(parent) {
5
6     QBoxLayout *aboutlayout = new QHBoxLayout(this);
7     aboutlayout->setAlignment(Qt::AlignCenter);
8     aboutlayout->setMargin(30);
9     aboutlayout->setSpacing(30);
10
11     QLabel *logo = new QLabel(this);
12     logo->setPixmap(QPixmap(":/images/app.png"));
13     aboutlayout->addWidget(logo, 0, Qt::AlignTop);
14
15     QBoxLayout *layout = new QVBoxLayout();
16     layout->setAlignment(Qt::AlignCenter);
17     layout->setSpacing(30);
18     aboutlayout->addLayout(layout);
19
20     QString info = "<html><style>a { color: palette(text); text-decoration: none; font-weight: bold }</style><body><h1>" + QString(Constants::APP_NAME) + "</h1>"
21                    "<p>" + tr("There's life outside the browser!") + "</p>"
22                    "<p>" + tr("Version %1").arg(Constants::VERSION) + "</p>"
23                    + QString("<p><a href=\"%1/\">%1</a></p>").arg(Constants::WEBSITE) +
24 #if !defined(APP_MAC) && !defined(APP_WIN)
25                    "<p>" +  tr("%1 is Free Software but its development takes precious time.").arg(Constants::APP_NAME) + "<br/>"
26                    + tr("Please <a href='%1'>donate</a> to support the continued development of %2.")
27                    .arg(QString(Constants::WEBSITE).append("#donate"), Constants::APP_NAME) + "</p>"
28 #endif
29                    "<p>" + tr("Report bugs and send in your ideas to %1")
30                    .arg(QString("<a href=\"mailto:%1\">%1</a>").arg(Constants::EMAIL)) + "</p>"
31
32                    "<p>"
33                    + tr("Icon designed by %1.").arg("<a href='http://www.kolorguild.com/'>David Nel</a>")
34                    + "<br>" + tr("Compact mode contributed by %1.").arg("Stefan Brück")
35                    + "<br>" + tr("HTTP proxy support contributed by %1.").arg("Kiwamu Okabe")
36                    + "</p>"
37
38                    "<p>" + tr("Translated by the cool people at %1")
39                    .arg("<a href='http://www.transifex.net/projects/p/minitube/resource/main/'>Transifex</a>")
40                    + "</p>"
41
42 #if !defined(APP_MAC) && !defined(APP_WIN)
43                    "<p>" + tr("Released under the <a href='%1'>GNU General Public License</a>")
44                    .arg("http://www.gnu.org/licenses/gpl.html") + "</p>"
45 #endif
46                    "<p>&copy; 2009-2011 " + Constants::ORG_NAME + "</p>"
47                    "</body></html>";;
48     QLabel *infoLabel = new QLabel(info, this);
49     infoLabel->setOpenExternalLinks(true);
50     infoLabel->setWordWrap(true);
51     layout->addWidget(infoLabel);
52
53     QLayout *buttonLayout = new QHBoxLayout();
54     buttonLayout->setAlignment(Qt::AlignLeft);
55     QPushButton *closeButton = new QPushButton(tr("&Close"), this);
56     closeButton->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
57
58     closeButton->setDefault(true);
59     closeButton->setFocus(Qt::OtherFocusReason);
60     connect(closeButton, SIGNAL(clicked()), parent, SLOT(goBack()));
61     buttonLayout->addWidget(closeButton);
62
63     layout->addLayout(buttonLayout);
64
65 }
66
67 void AboutView::paintEvent(QPaintEvent * /*event*/) {
68 #if defined(APP_MAC) | defined(APP_WIN)
69     QBrush brush;
70     if (window()->isActiveWindow()) {
71         brush = QBrush(QColor(0xdd, 0xe4, 0xeb));
72     } else {
73         brush = palette().window();
74     }
75     QPainter painter(this);
76     painter.fillRect(0, 0, width(), height(), brush);
77 #endif
78 }