From: Flavio Tordini Date: Tue, 4 Aug 2015 15:38:49 +0000 (+0200) Subject: Style and font tweaks X-Git-Tag: 2.5~45 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=b4f6a314c8daf9cf10fb7a3915fed3d3a1869f7a;p=minitube Style and font tweaks --- diff --git a/src/aboutview.cpp b/src/aboutview.cpp index f817ade..69e227f 100644 --- a/src/aboutview.cpp +++ b/src/aboutview.cpp @@ -30,6 +30,7 @@ $END_LICENSE */ #include "macutils.h" #include "mac_startup.h" #endif +#include "fontutils.h" AboutView::AboutView(QWidget *parent) : QWidget(parent) { @@ -47,8 +48,13 @@ AboutView::AboutView(QWidget *parent) : QWidget(parent) { layout->setSpacing(30); hLayout->addLayout(layout); - QString info = "" - "

" + QString(Constants::NAME) + "

" + 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 = "" + "

" + QString(Constants::NAME) + "

" "

" + tr("There's life outside the browser!") + "

" "

" + tr("Version %1").arg(Constants::VERSION) + "

" + QString("

%1

").arg(Constants::WEBSITE); @@ -119,3 +125,24 @@ void AboutView::appear() { #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 +} diff --git a/src/aboutview.h b/src/aboutview.h index 23ce933..a8e7572 100644 --- a/src/aboutview.h +++ b/src/aboutview.h @@ -41,6 +41,9 @@ public: return metadata; } +protected: + void paintEvent(QPaintEvent *e); + private: QPushButton *closeButton; diff --git a/src/searchview.cpp b/src/searchview.cpp index e3cadcf..60cc7a4 100644 --- a/src/searchview.cpp +++ b/src/searchview.cpp @@ -48,17 +48,12 @@ static const int PADDING = 30; 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); @@ -112,6 +107,7 @@ SearchView::SearchView(QWidget *parent) : QWidget(parent) { //: "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); @@ -170,11 +166,10 @@ SearchView::SearchView(QWidget *parent) : QWidget(parent) { 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); @@ -183,11 +178,10 @@ SearchView::SearchView(QWidget *parent) : QWidget(parent) { 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); @@ -212,8 +206,7 @@ void SearchView::appear() { MainWindow::instance()->showActionInStatusBar(The::globalActions()->value("definition"), true); - queryEdit->setFocus(); - QTimer::singleShot(100, queryEdit, SLOT(setFocus())); + if (!queryEdit->hasFocus()) queryEdit->setFocus(); } void SearchView::disappear() { @@ -384,7 +377,6 @@ void SearchView::paintEvent(QPaintEvent *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(); @@ -399,7 +391,6 @@ void SearchView::paintEvent(QPaintEvent *event) { QPainter p(this); style()->drawPrimitive(QStyle::PE_Widget, &o, &p, this); #endif - // PainterUtils::topShadow(this); } void SearchView::searchTypeChanged(int index) {