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"
30 #include "mac_startup.h"
33 #include "appwidget.h"
34 #include "clickablelabel.h"
35 #include "fontutils.h"
36 #include "iconutils.h"
37 #include "mainwindow.h"
39 AboutView::AboutView(QWidget *parent) : View(parent) {
40 const int padding = 30;
41 const char *buildYear = __DATE__ + 7;
43 setBackgroundRole(QPalette::Base);
44 setForegroundRole(QPalette::Text);
45 setAutoFillBackground(true);
47 QBoxLayout *verticalLayout = new QVBoxLayout(this);
48 verticalLayout->setMargin(0);
49 verticalLayout->setSpacing(0);
51 QBoxLayout *aboutlayout = new QHBoxLayout();
52 verticalLayout->addLayout(aboutlayout, 1);
53 aboutlayout->setAlignment(Qt::AlignCenter);
54 aboutlayout->setMargin(padding);
55 aboutlayout->setSpacing(padding);
57 ClickableLabel *logo = new ClickableLabel();
58 auto setLogoPixmap = [logo] {
59 logo->setPixmap(IconUtils::pixmap(":/images/app.png", logo->devicePixelRatioF()));
62 connect(window()->windowHandle(), &QWindow::screenChanged, this, setLogoPixmap);
64 connect(logo, &ClickableLabel::clicked, MainWindow::instance(), &MainWindow::visitSite);
65 aboutlayout->addWidget(logo, 0, Qt::AlignTop);
67 QBoxLayout *layout = new QVBoxLayout();
68 layout->setAlignment(Qt::AlignCenter);
69 layout->setSpacing(padding);
70 aboutlayout->addLayout(layout);
72 QColor lightTextColor = palette().text().color();
74 lightTextColor.setAlphaF(.75);
77 QColor linkColor = mac::accentColor();
79 QColor linkColor = palette().highlight().color();
82 QString info = "<html><style>"
84 lightTextColor.name(QColor::HexArgb) +
86 "h1 { color: palette(text); font-weight: 100; } "
88 linkColor.name(QColor::HexArgb) +
89 "; text-decoration: none; font-weight: normal; }"
92 info += "<h1>" + QString(Constants::NAME) +
95 tr("There's life outside the browser!") +
98 tr("Version %1").arg(Constants::VERSION) + "</p>" +
99 QString("<p><a href=\"%1/\">%1</a></p>").arg(Constants::WEBSITE);
101 #ifdef APP_ACTIVATION
102 QString email = Activation::instance().getEmail();
103 if (!email.isEmpty()) info += "<p>" + tr("Licensed to: %1").arg("<b>" + email + "</b>");
108 tr("%1 is Free Software but its development takes precious time.")
109 .arg(Constants::NAME) +
111 tr("Please <a href='%1'>donate</a> to support the continued development of %2.")
112 .arg(QString(Constants::WEBSITE).append("#donate"), Constants::NAME) +
117 tr("Translate %1 to your native language using %2")
118 .arg(Constants::NAME)
119 .arg("<a href='http://www.transifex.net/projects/p/" +
120 QString(Constants::UNIX_NAME) + "/'>Transifex</a>") +
125 .arg("<a href='https://" + QLatin1String(Constants::ORG_DOMAIN) +
126 "/opensource'>" + tr("Open-source software") + "</a>") +
130 tr("Icon designed by %1.").arg("<a href='http://www.kolorguild.co.za/'>David Nel</a>") +
135 tr("Released under the <a href='%1'>GNU General Public License</a>")
136 .arg("http://www.gnu.org/licenses/gpl.html") +
140 buildYear + " " + Constants::ORG_NAME +
144 QLabel *infoLabel = new QLabel(info, this);
145 infoLabel->setOpenExternalLinks(true);
146 infoLabel->setWordWrap(true);
147 layout->addWidget(infoLabel);
149 QLayout *buttonLayout = new QHBoxLayout();
150 buttonLayout->setAlignment(Qt::AlignLeft);
151 closeButton = new QPushButton(tr("&Close"), this);
152 closeButton->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
153 closeButton->setDefault(true);
154 closeButton->setShortcut(Qt::Key_Escape);
155 closeButton->setFocus();
156 connect(closeButton, SIGNAL(clicked()), MainWindow::instance(), SLOT(goBack()));
157 buttonLayout->addWidget(closeButton);
159 layout->addLayout(buttonLayout);
161 verticalLayout->addWidget(new AppsWidget());
164 void AboutView::appear() {
165 closeButton->setFocus();