]> git.sur5r.net Git - minitube/blob - src/AboutView.cpp
4114631821fea54af5a55a9c60d7a83453e9bdd9
[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::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
25         #if !defined(APP_MAC) && !defined(APP_WIN)
26             "<p>" +  tr("%1 is Free Software but its development takes precious time.").arg(Constants::NAME) + "<br/>"
27             + tr("Please <a href='%1'>donate</a> to support the continued development of %2.")
28             .arg(QString(Constants::WEBSITE).append("#donate"), Constants::NAME) + "</p>"
29         #endif
30
31             "<p>" + tr("You may want to try my other apps as well:") + "</p>"
32             + "<ul>"
33
34             + "<li>" + tr("%1, a YouTube music player")
35             .arg("<a href='http://flavio.tordini.org/musictube'>Musictube</a>")
36             + "</li>"
37
38             + "<li>" + tr("%1, a music player")
39             .arg("<a href='http://flavio.tordini.org/musique'>Musique</a>")
40             + "</li>"
41
42             + "</ul>"
43
44             "<p>" + tr("Translate %1 to your native language using %2").arg(Constants::NAME)
45             .arg("<a href='http://www.transifex.net/projects/p/" + QString(Constants::UNIX_NAME) + "/resource/main/'>Transifex</a>")
46             + "</p>"
47
48             "<p>"
49             + tr("Icon designed by %1.").arg("<a href='http://www.kolorguild.com/'>David Nel</a>")
50             + "</p>"
51
52         #if !defined(APP_MAC) && !defined(APP_WIN)
53             "<p>" + tr("Released under the <a href='%1'>GNU General Public License</a>")
54             .arg("http://www.gnu.org/licenses/gpl.html") + "</p>"
55         #endif
56             "<p>&copy; 2009-2012 " + Constants::ORG_NAME + "</p>"
57             "</body></html>";
58     QLabel *infoLabel = new QLabel(info, this);
59     infoLabel->setOpenExternalLinks(true);
60     infoLabel->setWordWrap(true);
61     layout->addWidget(infoLabel);
62
63     QLayout *buttonLayout = new QHBoxLayout();
64     buttonLayout->setAlignment(Qt::AlignLeft);
65     QPushButton *closeButton = new QPushButton(tr("&Close"), this);
66     closeButton->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
67
68     closeButton->setDefault(true);
69     closeButton->setFocus(Qt::OtherFocusReason);
70     connect(closeButton, SIGNAL(clicked()), parent, SLOT(goBack()));
71     buttonLayout->addWidget(closeButton);
72
73     layout->addLayout(buttonLayout);
74
75 }
76
77 void AboutView::paintEvent(QPaintEvent * /*event*/) {
78 #if defined(APP_MAC) | defined(APP_WIN)
79     QBrush brush;
80     if (window()->isActiveWindow()) {
81         brush = QBrush(QColor(0xdd, 0xe4, 0xeb));
82     } else {
83         brush = palette().window();
84     }
85     QPainter painter(this);
86     painter.fillRect(0, 0, width(), height(), brush);
87 #endif
88 }