]> git.sur5r.net Git - minitube/blob - src/AboutView.cpp
Imported Upstream version 1.9
[minitube] / src / AboutView.cpp
1 #include "AboutView.h"
2 #include "constants.h"
3 #ifndef Q_WS_X11
4 #include "extra.h"
5 #endif
6
7 AboutView::AboutView(QWidget *parent) : QWidget(parent) {
8
9     QBoxLayout *aboutlayout = new QHBoxLayout(this);
10     aboutlayout->setAlignment(Qt::AlignCenter);
11     aboutlayout->setMargin(30);
12     aboutlayout->setSpacing(30);
13
14     QLabel *logo = new QLabel(this);
15     QString resource = "app";
16 #ifndef Q_WS_X11
17     resource = Extra::resourceName(resource);
18 #endif
19     logo->setPixmap(QPixmap(":/images/" + resource + ".png"));
20     aboutlayout->addWidget(logo, 0, Qt::AlignTop);
21
22     QBoxLayout *layout = new QVBoxLayout();
23     layout->setAlignment(Qt::AlignCenter);
24     layout->setSpacing(30);
25     aboutlayout->addLayout(layout);
26
27     QString info = "<html><style>a { color: palette(text); text-decoration: none; font-weight: bold }</style><body><h1>" + QString(Constants::NAME) + "</h1>"
28             "<p>" + tr("There's life outside the browser!") + "</p>"
29             "<p>" + tr("Version %1").arg(Constants::VERSION) + "</p>"
30             + QString("<p><a href=\"%1/\">%1</a></p>").arg(Constants::WEBSITE) +
31
32         #if !defined(APP_MAC) && !defined(APP_WIN)
33             "<p>" +  tr("%1 is Free Software but its development takes precious time.").arg(Constants::NAME) + "<br/>"
34             + tr("Please <a href='%1'>donate</a> to support the continued development of %2.")
35             .arg(QString(Constants::WEBSITE).append("#donate"), Constants::NAME) + "</p>"
36         #endif
37
38             "<p>" + tr("You may want to try my other apps as well:") + "</p>"
39             + "<ul>"
40
41             + "<li>" + tr("%1, a YouTube music player")
42             .arg("<a href='http://flavio.tordini.org/musictube'>Musictube</a>")
43             + "</li>"
44
45             + "<li>" + tr("%1, a music player")
46             .arg("<a href='http://flavio.tordini.org/musique'>Musique</a>")
47             + "</li>"
48
49             + "</ul>"
50
51             "<p>" + tr("Translate %1 to your native language using %2").arg(Constants::NAME)
52             .arg("<a href='http://www.transifex.net/projects/p/" + QString(Constants::UNIX_NAME) + "/resource/main/'>Transifex</a>")
53             + "</p>"
54
55             "<p>"
56             + tr("Icon designed by %1.").arg("<a href='http://www.kolorguild.com/'>David Nel</a>")
57             + "</p>"
58
59         #if !defined(APP_MAC) && !defined(APP_WIN)
60             "<p>" + tr("Released under the <a href='%1'>GNU General Public License</a>")
61             .arg("http://www.gnu.org/licenses/gpl.html") + "</p>"
62         #endif
63             "<p>&copy; 2009-2012 " + Constants::ORG_NAME + "</p>"
64             "</body></html>";
65     QLabel *infoLabel = new QLabel(info, this);
66     infoLabel->setOpenExternalLinks(true);
67     infoLabel->setWordWrap(true);
68     layout->addWidget(infoLabel);
69
70     QLayout *buttonLayout = new QHBoxLayout();
71     buttonLayout->setAlignment(Qt::AlignLeft);
72
73     QPushButton *closeButton = new QPushButton(tr("&Close"), this);
74     closeButton->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
75     closeButton->setDefault(true);
76     closeButton->setFocus(Qt::OtherFocusReason);
77     connect(closeButton, SIGNAL(clicked()), parent, SLOT(goBack()));
78     buttonLayout->addWidget(closeButton);
79
80     /*
81     QPushButton *issueButton = new QPushButton(tr("&Report an issue"), this);
82     issueButton->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
83     connect(issueButton, SIGNAL(clicked()), window(), SLOT(reportIssue()));
84     buttonLayout->addWidget(issueButton);
85     */
86
87     layout->addLayout(buttonLayout);
88
89 }
90
91 void AboutView::paintEvent(QPaintEvent * /*event*/) {
92 #if defined(APP_MAC) | defined(APP_WIN)
93     QBrush brush;
94     if (window()->isActiveWindow()) {
95         brush = QBrush(QColor(0xdd, 0xe4, 0xeb));
96     } else {
97         brush = palette().window();
98     }
99     QPainter painter(this);
100     painter.fillRect(0, 0, width(), height(), brush);
101 #endif
102 }