#include "activation.h"
#endif
#ifdef APP_MAC
-#include "macutils.h"
#include "mac_startup.h"
+#include "macutils.h"
#endif
-#include "fontutils.h"
-#include "iconutils.h"
#include "appwidget.h"
#include "clickablelabel.h"
+#include "fontutils.h"
+#include "iconutils.h"
#include "mainwindow.h"
AboutView::AboutView(QWidget *parent) : View(parent) {
-
const int padding = 30;
const char *buildYear = __DATE__ + 7;
- // speedup painting since we'll paint the whole background
- // by ourselves anyway in paintEvent()
- setAttribute(Qt::WA_OpaquePaintEvent);
+ setBackgroundRole(QPalette::Base);
+ setForegroundRole(QPalette::Text);
+ setAutoFillBackground(true);
QBoxLayout *verticalLayout = new QVBoxLayout(this);
verticalLayout->setMargin(0);
aboutlayout->setMargin(padding);
aboutlayout->setSpacing(padding);
- logo = new ClickableLabel();
- logo->setPixmap(IconUtils::pixmap(":/images/app.png"));
+ ClickableLabel *logo = new ClickableLabel();
+ auto setLogoPixmap = [logo] {
+ logo->setPixmap(IconUtils::pixmap(":/images/app.png", logo->devicePixelRatioF()));
+ };
+ setLogoPixmap();
+ connect(window()->windowHandle(), &QWindow::screenChanged, this, setLogoPixmap);
+
connect(logo, &ClickableLabel::clicked, MainWindow::instance(), &MainWindow::visitSite);
aboutlayout->addWidget(logo, 0, Qt::AlignTop);
layout->setSpacing(padding);
aboutlayout->addLayout(layout);
- QString css = "a { color: palette(text); text-decoration: none; font-weight: bold } h1 { font-weight: 300 }";
+ QColor lightTextColor = palette().text().color();
+#ifdef APP_MAC
+ lightTextColor.setAlphaF(.75);
+#endif
+#ifdef APP_MAC
+ QColor linkColor = mac::accentColor();
+#else
+ QColor linkColor = palette().highlight().color();
+#endif
- QString info = "<html><style>" + css + "</style><body>"
- "<h1>" + QString(Constants::NAME) + "</h1>"
- "<p>" + tr("There's life outside the browser!") + "</p>"
- "<p>" + tr("Version %1").arg(Constants::VERSION) + "</p>"
- + QString("<p><a href=\"%1/\">%1</a></p>").arg(Constants::WEBSITE);
+ QString info = "<html><style>"
+ "body { color: " +
+ lightTextColor.name(QColor::HexArgb) +
+ "; } "
+ "h1 { color: palette(text); font-weight: 100; } "
+ "a { color: " +
+ linkColor.name(QColor::HexArgb) +
+ "; text-decoration: none; font-weight: normal; }"
+ "</style><body>";
+
+ info += "<h1>" + QString(Constants::NAME) +
+ "</h1>"
+ "<p>" +
+ tr("There's life outside the browser!") +
+ "</p>"
+ "<p>" +
+ tr("Version %1").arg(Constants::VERSION) + "</p>" +
+ QString("<p><a href=\"%1/\">%1</a></p>").arg(Constants::WEBSITE);
#ifdef APP_ACTIVATION
QString email = Activation::instance().getEmail();
- if (!email.isEmpty())
- info += "<p>" + tr("Licensed to: %1").arg("<b>" + email + "</b>");
+ if (!email.isEmpty()) info += "<p>" + tr("Licensed to: %1").arg("<b>" + email + "</b>");
#endif
#ifndef APP_EXTRA
- info += "<p>" + tr("%1 is Free Software but its development takes precious time.").arg(Constants::NAME) + "<br/>"
- + tr("Please <a href='%1'>donate</a> to support the continued development of %2.")
- .arg(QString(Constants::WEBSITE).append("#donate"), Constants::NAME) + "</p>";
+ info += "<p>" +
+ tr("%1 is Free Software but its development takes precious time.")
+ .arg(Constants::NAME) +
+ "<br/>" +
+ tr("Please <a href='%1'>donate</a> to support the continued development of %2.")
+ .arg(QString(Constants::WEBSITE).append("#donate"), Constants::NAME) +
+ "</p>";
#endif
- info += "<p>" + tr("Translate %1 to your native language using %2").arg(Constants::NAME)
- .arg("<a href='http://www.transifex.net/projects/p/" + QString(Constants::UNIX_NAME) + "/'>Transifex</a>")
- + "</p>"
+ info += "<p>" +
+ tr("Translate %1 to your native language using %2")
+ .arg(Constants::NAME)
+ .arg("<a href='http://www.transifex.net/projects/p/" +
+ QString(Constants::UNIX_NAME) + "/'>Transifex</a>") +
+ "</p>";
+
+ info += "<p>" +
+ tr("Powered by %1")
+ .arg("<a href='https://" + QLatin1String(Constants::ORG_DOMAIN) +
+ "/opensource'>" + tr("Open-source software") + "</a>") +
+ "</p>";
- "<p>"
- + tr("Icon designed by %1.").arg("<a href='http://www.kolorguild.co.za/'>David Nel</a>")
- + "</p>"
+ info += "<p>" +
+ tr("Icon designed by %1.").arg("<a href='http://www.kolorguild.co.za/'>David Nel</a>") +
+ "</p>"
- #ifndef APP_EXTRA
- "<p>" + tr("Released under the <a href='%1'>GNU General Public License</a>")
- .arg("http://www.gnu.org/licenses/gpl.html") + "</p>"
- #endif
- "<p>© " + buildYear + " " + Constants::ORG_NAME + "</p>"
+#ifndef APP_EXTRA
+ "<p>" +
+ tr("Released under the <a href='%1'>GNU General Public License</a>")
+ .arg("http://www.gnu.org/licenses/gpl.html") +
+ "</p>"
+#endif
+ "<p>© " +
+ buildYear + " " + Constants::ORG_NAME +
+ "</p>"
"</body></html>";
QLabel *infoLabel = new QLabel(info, this);
closeButton->setDefault(true);
closeButton->setFocus();
- connect(closeButton, SIGNAL(clicked()), parent, SLOT(goBack()));
+ connect(closeButton, SIGNAL(clicked()), MainWindow::instance(), SLOT(goBack()));
buttonLayout->addWidget(closeButton);
layout->addLayout(buttonLayout);
void AboutView::appear() {
closeButton->setFocus();
- connect(window()->windowHandle(), SIGNAL(screenChanged(QScreen*)), SLOT(screenChanged()), Qt::UniqueConnection);
-}
-
-void AboutView::paintEvent(QPaintEvent *event) {
- QWidget::paintEvent(event);
- QBrush brush;
- if (window()->isActiveWindow()) {
- brush = Qt::white;
- } else {
- brush = palette().window();
- }
- QPainter painter(this);
- painter.fillRect(0, 0, width(), height(), brush);
- painter.end();
-}
-
-void AboutView::screenChanged() {
- logo->setPixmap(IconUtils::pixmap(":/images/app.png"));
}