]> git.sur5r.net Git - minitube/blobdiff - src/aboutview.cpp
HiDPI support
[minitube] / src / aboutview.cpp
index 78d4a34178948696293b277028c204e8a7e75ff3..19c5ee547ea88b41d94464e35dfc269c79931563 100644 (file)
@@ -1,6 +1,26 @@
+/* $BEGIN_LICENSE
+
+This file is part of Minitube.
+Copyright 2009, Flavio Tordini <flavio.tordini@gmail.com>
+
+Minitube is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+Minitube is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with Minitube.  If not, see <http://www.gnu.org/licenses/>.
+
+$END_LICENSE */
+
 #include "aboutview.h"
 #include "constants.h"
-#ifndef Q_WS_X11
+#ifdef APP_EXTRA
 #include "extra.h"
 #endif
 #ifdef APP_ACTIVATION
 #include "macutils.h"
 #include "mac_startup.h"
 #endif
+#include "fontutils.h"
+#include "iconutils.h"
 
-AboutView::AboutView(QWidget *parent) : QWidget(parent) {
+AboutView::AboutView(QWidget *parent) : View(parent) {
 
     QBoxLayout *hLayout = new QHBoxLayout(this);
     hLayout->setAlignment(Qt::AlignCenter);
@@ -19,7 +41,7 @@ AboutView::AboutView(QWidget *parent) : QWidget(parent) {
     hLayout->setSpacing(30);
 
     QLabel *logo = new QLabel(this);
-    logo->setPixmap(QPixmap(":/images/app.png"));
+    logo->setPixmap(IconUtils::pixmap(":/images/app.png"));
     hLayout->addWidget(logo, 0, Qt::AlignTop);
 
     QBoxLayout *layout = new QVBoxLayout();
@@ -27,7 +49,12 @@ AboutView::AboutView(QWidget *parent) : QWidget(parent) {
     layout->setSpacing(30);
     hLayout->addLayout(layout);
 
-    QString info = "<html><style>a { color: palette(text); text-decoration: none; font-weight: bold }</style><body>"
+    QString css = "a { color: palette(text); text-decoration: none; font-weight: bold } h1 { font-weight: 100 }";
+#ifdef APP_MAC
+    css += " h1 { font-family: 'Helvetica Neue' }";
+#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>"
@@ -38,7 +65,7 @@ AboutView::AboutView(QWidget *parent) : QWidget(parent) {
         info += "<p>" + tr("Licensed to: %1").arg("<b>" + Activation::instance().getEmail() + "</b>");
 #endif
 
-#ifdef Q_WS_X11
+#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>";
@@ -58,18 +85,18 @@ AboutView::AboutView(QWidget *parent) : QWidget(parent) {
             "</ul>"
 
             "<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) + "/resource/main/'>Transifex</a>")
+            .arg("<a href='http://www.transifex.net/projects/p/" + QString(Constants::UNIX_NAME) + "/'>Transifex</a>")
             + "</p>"
 
             "<p>"
-            + tr("Icon designed by %1.").arg("<a href='http://www.kolorguild.com/'>David Nel</a>")
+            + tr("Icon designed by %1.").arg("<a href='http://www.kolorguild.co.za/'>David Nel</a>")
             + "</p>"
 
-        #ifdef Q_WS_X11
+        #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>&copy; 2009-2013 " + Constants::ORG_NAME + "</p>"
+            "<p>&copy; 2009-2015 " + Constants::ORG_NAME + "</p>"
             "</body></html>";
     QLabel *infoLabel = new QLabel(info, this);
     infoLabel->setOpenExternalLinks(true);
@@ -81,34 +108,42 @@ AboutView::AboutView(QWidget *parent) : QWidget(parent) {
     buttonLayout->setSpacing(0);
     buttonLayout->setAlignment(Qt::AlignLeft);
 
-    QPushButton *closeButton = new QPushButton(tr("&Close"), this);
+    closeButton = new QPushButton(tr("&Close"));
     closeButton->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
     closeButton->setDefault(true);
-    closeButton->setFocus(Qt::OtherFocusReason);
     connect(closeButton, SIGNAL(clicked()), parent, SLOT(goBack()));
     buttonLayout->addWidget(closeButton);
 
     layout->addLayout(buttonLayout);
 }
 
-void AboutView::paintEvent(QPaintEvent * /*event*/) {
+void AboutView::appear() {
+#ifdef APP_MAC
+    mac::uncloseWindow(window()->winId());
+#ifdef APP_ACTIVATION
+    mac::CheckForUpdates();
+#endif
+#endif
+    closeButton->setFocus();
+}
+
+void AboutView::paintEvent(QPaintEvent *event) {
+    QWidget::paintEvent(event);
 #if defined(APP_MAC) | defined(APP_WIN)
     QBrush brush;
     if (window()->isActiveWindow()) {
-        brush = QBrush(QColor(0xdd, 0xe4, 0xeb));
+        brush = Qt::white;
     } else {
         brush = palette().window();
     }
     QPainter painter(this);
     painter.fillRect(0, 0, width(), height(), brush);
+    painter.end();
 #endif
-}
-
-void AboutView::appear() {
-#ifdef APP_MAC
-    mac::uncloseWindow(window()->winId());
-#ifdef APP_ACTIVATION
-    mac::CheckForUpdates();
-#endif
+#ifdef APP_UBUNTU
+    QStyleOption o;
+    o.initFrom(this);
+    QPainter p(this);
+    style()->drawPrimitive(QStyle::PE_Widget, &o, &p, this);
 #endif
 }