#include "macutils.h"
#include "mac_startup.h"
#endif
+#include "fontutils.h"
+#include "iconutils.h"
+#include "appwidget.h"
+#include "clickablelabel.h"
+#include "mainwindow.h"
-AboutView::AboutView(QWidget *parent) : QWidget(parent) {
+AboutView::AboutView(QWidget *parent) : View(parent) {
- QBoxLayout *hLayout = new QHBoxLayout(this);
- hLayout->setAlignment(Qt::AlignCenter);
- hLayout->setMargin(30);
- hLayout->setSpacing(30);
+ const int padding = 30;
+ const char *buildYear = __DATE__ + 7;
- QLabel *logo = new QLabel(this);
- logo->setPixmap(QPixmap(":/images/app.png"));
- hLayout->addWidget(logo, 0, Qt::AlignTop);
+ // speedup painting since we'll paint the whole background
+ // by ourselves anyway in paintEvent()
+ setAttribute(Qt::WA_OpaquePaintEvent);
+
+ QBoxLayout *verticalLayout = new QVBoxLayout(this);
+ verticalLayout->setMargin(0);
+ verticalLayout->setSpacing(0);
+
+ QBoxLayout *aboutlayout = new QHBoxLayout();
+ verticalLayout->addLayout(aboutlayout, 1);
+ aboutlayout->setAlignment(Qt::AlignCenter);
+ aboutlayout->setMargin(padding);
+ aboutlayout->setSpacing(padding);
+
+ logo = new ClickableLabel();
+ logo->setPixmap(IconUtils::pixmap(":/images/app.png"));
+ connect(logo, &ClickableLabel::clicked, MainWindow::instance(), &MainWindow::visitSite);
+ aboutlayout->addWidget(logo, 0, Qt::AlignTop);
QBoxLayout *layout = new QVBoxLayout();
layout->setAlignment(Qt::AlignCenter);
- layout->setSpacing(30);
- hLayout->addLayout(layout);
+ layout->setSpacing(padding);
+ aboutlayout->addLayout(layout);
- QString info = "<html><style>a { color: palette(text); text-decoration: none; font-weight: bold }</style><body>"
- "<h1 style='font-weight:normal'>" + QString(Constants::NAME) + "</h1>"
+ QString css = "a { color: palette(text); text-decoration: none; font-weight: bold } h1 { font-weight: 300 }";
+
+ 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);
#ifdef APP_ACTIVATION
- if (Activation::instance().isActivated())
- info += "<p>" + tr("Licensed to: %1").arg("<b>" + Activation::instance().getEmail() + "</b>");
+ QString email = Activation::instance().getEmail();
+ if (!email.isEmpty())
+ info += "<p>" + tr("Licensed to: %1").arg("<b>" + email + "</b>");
#endif
#ifndef APP_EXTRA
.arg(QString(Constants::WEBSITE).append("#donate"), Constants::NAME) + "</p>";
#endif
- info += "<p>" + tr("You may want to try my other apps as well:") + "</p>"
- "<ul>"
-
- "<li>" + tr("%1, a YouTube music player")
- .arg("<a href='http://flavio.tordini.org/musictube'>Musictube</a>")
- + "</li>"
-
- "<li>" + tr("%1, a music player")
- .arg("<a href='http://flavio.tordini.org/musique'>Musique</a>")
- + "</li>"
-
- "</ul>"
-
- "<p>" + tr("Translate %1 to your native language using %2").arg(Constants::NAME)
+ 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>"
"<p>" + tr("Released under the <a href='%1'>GNU General Public License</a>")
.arg("http://www.gnu.org/licenses/gpl.html") + "</p>"
#endif
- "<p>© 2009-2014 " + Constants::ORG_NAME + "</p>"
+ "<p>© " + buildYear + " " + Constants::ORG_NAME + "</p>"
"</body></html>";
+
QLabel *infoLabel = new QLabel(info, this);
infoLabel->setOpenExternalLinks(true);
infoLabel->setWordWrap(true);
layout->addWidget(infoLabel);
QLayout *buttonLayout = new QHBoxLayout();
- buttonLayout->setMargin(0);
- buttonLayout->setSpacing(0);
buttonLayout->setAlignment(Qt::AlignLeft);
-
- closeButton = new QPushButton(tr("&Close"));
+ closeButton = new QPushButton(tr("&Close"), this);
closeButton->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
+
closeButton->setDefault(true);
+ closeButton->setFocus();
connect(closeButton, SIGNAL(clicked()), parent, SLOT(goBack()));
buttonLayout->addWidget(closeButton);
layout->addLayout(buttonLayout);
+
+ verticalLayout->addWidget(new AppsWidget());
+}
+
+void AboutView::appear() {
+ closeButton->setFocus();
+ connect(window()->windowHandle(), SIGNAL(screenChanged(QScreen*)), SLOT(screenChanged()), Qt::UniqueConnection);
}
-void AboutView::paintEvent(QPaintEvent * /*event*/) {
-#if defined(APP_MAC) | defined(APP_WIN)
+void AboutView::paintEvent(QPaintEvent *event) {
+ QWidget::paintEvent(event);
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);
-#endif
+ painter.end();
}
-void AboutView::appear() {
-#ifdef APP_MAC
- mac::uncloseWindow(window()->winId());
-#ifdef APP_ACTIVATION
- mac::CheckForUpdates();
-#endif
-#endif
- closeButton->setFocus();
+void AboutView::screenChanged() {
+ logo->setPixmap(IconUtils::pixmap(":/images/app.png"));
}