3 This file is part of Minitube.
4 Copyright 2009, Flavio Tordini <flavio.tordini@gmail.com>
6 Minitube is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 Minitube is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with Minitube. If not, see <http://www.gnu.org/licenses/>.
21 #include "aboutview.h"
22 #include "constants.h"
27 #include "activation.h"
31 #include "mac_startup.h"
33 #include "fontutils.h"
34 #include "iconutils.h"
36 AboutView::AboutView(QWidget *parent) : View(parent) {
38 QBoxLayout *hLayout = new QHBoxLayout(this);
39 hLayout->setAlignment(Qt::AlignCenter);
40 hLayout->setMargin(30);
41 hLayout->setSpacing(30);
43 QLabel *logo = new QLabel(this);
44 logo->setPixmap(IconUtils::pixmap(":/images/app.png"));
45 hLayout->addWidget(logo, 0, Qt::AlignTop);
47 QBoxLayout *layout = new QVBoxLayout();
48 layout->setAlignment(Qt::AlignCenter);
49 layout->setSpacing(30);
50 hLayout->addLayout(layout);
52 QString css = "a { color: palette(text); text-decoration: none; font-weight: bold } h1 { font-weight: 100 }";
54 css += " h1 { font-family: 'Helvetica Neue' }";
57 QString info = "<html><style>" + css + "</style><body>"
58 "<h1>" + QString(Constants::NAME) + "</h1>"
59 "<p>" + tr("There's life outside the browser!") + "</p>"
60 "<p>" + tr("Version %1").arg(Constants::VERSION) + "</p>"
61 + QString("<p><a href=\"%1/\">%1</a></p>").arg(Constants::WEBSITE);
64 if (Activation::instance().isActivated())
65 info += "<p>" + tr("Licensed to: %1").arg("<b>" + Activation::instance().getEmail() + "</b>");
69 info += "<p>" + tr("%1 is Free Software but its development takes precious time.").arg(Constants::NAME) + "<br/>"
70 + tr("Please <a href='%1'>donate</a> to support the continued development of %2.")
71 .arg(QString(Constants::WEBSITE).append("#donate"), Constants::NAME) + "</p>";
74 info += "<p>" + tr("You may want to try my other apps as well:") + "</p>"
77 "<li>" + tr("%1, a YouTube music player")
78 .arg("<a href='http://flavio.tordini.org/musictube'>Musictube</a>")
81 "<li>" + tr("%1, a music player")
82 .arg("<a href='http://flavio.tordini.org/musique'>Musique</a>")
87 "<p>" + tr("Translate %1 to your native language using %2").arg(Constants::NAME)
88 .arg("<a href='http://www.transifex.net/projects/p/" + QString(Constants::UNIX_NAME) + "/'>Transifex</a>")
92 + tr("Icon designed by %1.").arg("<a href='http://www.kolorguild.co.za/'>David Nel</a>")
96 "<p>" + tr("Released under the <a href='%1'>GNU General Public License</a>")
97 .arg("http://www.gnu.org/licenses/gpl.html") + "</p>"
99 "<p>© 2009-2015 " + Constants::ORG_NAME + "</p>"
101 QLabel *infoLabel = new QLabel(info, this);
102 infoLabel->setOpenExternalLinks(true);
103 infoLabel->setWordWrap(true);
104 layout->addWidget(infoLabel);
106 QLayout *buttonLayout = new QHBoxLayout();
107 buttonLayout->setMargin(0);
108 buttonLayout->setSpacing(0);
109 buttonLayout->setAlignment(Qt::AlignLeft);
111 closeButton = new QPushButton(tr("&Close"));
112 closeButton->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
113 closeButton->setDefault(true);
114 connect(closeButton, SIGNAL(clicked()), parent, SLOT(goBack()));
115 buttonLayout->addWidget(closeButton);
117 layout->addLayout(buttonLayout);
120 void AboutView::appear() {
122 mac::uncloseWindow(window()->winId());
123 #ifdef APP_ACTIVATION
124 mac::CheckForUpdates();
127 closeButton->setFocus();
130 void AboutView::paintEvent(QPaintEvent *event) {
131 QWidget::paintEvent(event);
132 #if defined(APP_MAC) | defined(APP_WIN)
134 if (window()->isActiveWindow()) {
137 brush = palette().window();
139 QPainter painter(this);
140 painter.fillRect(0, 0, width(), height(), brush);
147 style()->drawPrimitive(QStyle::PE_Widget, &o, &p, this);