#include "macutils.h"
#include "mac_startup.h"
#endif
+#include "fontutils.h"
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>"
- "<h1 style='font-weight:normal'>" + QString(Constants::NAME) + "</h1>"
+ 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>"
+ QString("<p><a href=\"%1/\">%1</a></p>").arg(Constants::WEBSITE);
#endif
closeButton->setFocus();
}
+
+void AboutView::paintEvent(QPaintEvent *event) {
+ QWidget::paintEvent(event);
+#if defined(APP_MAC) | defined(APP_WIN)
+ QBrush brush;
+ if (window()->isActiveWindow()) {
+ brush = Qt::white;
+ } else {
+ brush = palette().window();
+ }
+ QPainter painter(this);
+ painter.fillRect(0, 0, width(), height(), brush);
+ painter.end();
+#endif
+#ifdef APP_UBUNTU
+ QStyleOption o;
+ o.initFrom(this);
+ QPainter p(this);
+ style()->drawPrimitive(QStyle::PE_Widget, &o, &p, this);
+#endif
+}
SearchView::SearchView(QWidget *parent) : QWidget(parent) {
- QFont biggerFont = FontUtils::big();
- QFont smallerFont = FontUtils::small();
-
#if defined(APP_MAC) | defined(APP_WIN)
// speedup painting since we'll paint the whole background
// by ourselves anyway in paintEvent()
setAttribute(Qt::WA_OpaquePaintEvent);
#endif
- setAutoFillBackground(true);
-
QBoxLayout *mainLayout = new QVBoxLayout(this);
mainLayout->setMargin(PADDING);
mainLayout->setSpacing(0);
//: "Enter", as in "type". The whole phrase says: "Enter a keyword to start watching videos"
QLabel *tipLabel = new QLabel(tr("Enter"), this);
#ifndef APP_MAC
+ const QFont &biggerFont = FontUtils::big();
tipLabel->setFont(biggerFont);
#endif
tipLayout->addWidget(tipLabel);
recentKeywordsLayout = new QVBoxLayout();
recentKeywordsLayout->setSpacing(5);
recentKeywordsLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft);
- recentKeywordsLabel = new QLabel(tr("Recent keywords").toUpper(), this);
+ recentKeywordsLabel = new QLabel(tr("Recent keywords"), this);
recentKeywordsLabel->setProperty("recentHeader", true);
recentKeywordsLabel->setForegroundRole(QPalette::Dark);
recentKeywordsLabel->hide();
- recentKeywordsLabel->setFont(smallerFont);
recentKeywordsLayout->addWidget(recentKeywordsLabel);
otherLayout->addLayout(recentKeywordsLayout);
recentChannelsLayout = new QVBoxLayout();
recentChannelsLayout->setSpacing(5);
recentChannelsLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft);
- recentChannelsLabel = new QLabel(tr("Recent channels").toUpper(), this);
+ recentChannelsLabel = new QLabel(tr("Recent channels"), this);
recentChannelsLabel->setProperty("recentHeader", true);
recentChannelsLabel->setForegroundRole(QPalette::Dark);
recentChannelsLabel->hide();
- recentChannelsLabel->setFont(smallerFont);
recentChannelsLayout->addWidget(recentChannelsLabel);
otherLayout->addLayout(recentChannelsLayout);
MainWindow::instance()->showActionInStatusBar(The::globalActions()->value("definition"), true);
- queryEdit->setFocus();
- QTimer::singleShot(100, queryEdit, SLOT(setFocus()));
+ if (!queryEdit->hasFocus()) queryEdit->setFocus();
}
void SearchView::disappear() {
#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 p(this);
style()->drawPrimitive(QStyle::PE_Widget, &o, &p, this);
#endif
- // PainterUtils::topShadow(this);
}
void SearchView::searchTypeChanged(int index) {