$END_LICENSE */
#include "refinesearchwidget.h"
-#include "fontutils.h"
#include "searchparams.h"
#ifdef APP_EXTRA
#include "extra.h"
#endif
+#include "iconutils.h"
namespace The {
QHash<QString, QAction*>* globalActions();
if (isSetup) return;
isSetup = true;
- static const int spacing = 15;
- setFont(FontUtils::medium());
+ const int spacing = 15;
QBoxLayout *layout = new QVBoxLayout(this);
layout->setAlignment(Qt::AlignTop | Qt::AlignHCenter);
- layout->setMargin(spacing*2);
+ layout->setMargin(spacing);
layout->setSpacing(spacing);
QString paramName = "sortBy";
<< tr("View Count")
<< tr("Rating");
int i = 0;
- foreach (QString actionName, sortOptions) {
+ foreach (const QString &actionName, sortOptions) {
QAction *action = new QAction(actionName, sortBar);
action->setCheckable(true);
- action->setFont(FontUtils::medium());
action->setProperty("paramValue", i);
sortGroup->addAction(action);
sortBar->addAction(action);
<< tr("7 Days")
<< tr("30 Days");
i = 0;
- foreach (QString actionName, timeSpans) {
+ foreach (const QString &actionName, timeSpans) {
QAction *action = new QAction(actionName, timeBar);
action->setCheckable(true);
- action->setFont(FontUtils::medium());
action->setProperty("paramValue", i);
timeGroup->addAction(action);
timeBar->addAction(action);
<< tr("Between 4 and 20 minutes")
<< tr("Longer than 20 minutes");
i = 0;
- foreach (QString actionName, lengthOptions) {
+ foreach (const QString &actionName, lengthOptions) {
QAction *action = new QAction(actionName, timeBar);
action->setStatusTip(tips.at(i));
action->setCheckable(true);
- action->setFont(FontUtils::medium());
action->setProperty("paramValue", i);
lengthGroup->addAction(action);
lengthBar->addAction(action);
<< ""
<< tr("720p or higher");
i = 0;
- foreach (QString actionName, qualityOptions) {
+ foreach (const QString &actionName, qualityOptions) {
QAction *action = new QAction(actionName, timeBar);
action->setStatusTip(tips.at(i));
action->setCheckable(true);
- action->setFont(FontUtils::medium());
action->setProperty("paramValue", i);
qualityGroup->addAction(action);
qualityBar->addAction(action);
doneButton->setDefault(true);
doneButton->setAutoDefault(true);
doneButton->setFocusPolicy(Qt::StrongFocus);
- doneButton->setFont(FontUtils::medium());
+#ifndef APP_MAC
doneButton->setProperty("custom", true);
doneButton->setProperty("important", true);
doneButton->setProperty("big", true);
+#endif
connect(doneButton, SIGNAL(clicked()), SLOT(doneClicked()));
layout->addWidget(doneButton, 0, Qt::AlignLeft);
}
-void RefineSearchWidget::setupLabel(QString text, QBoxLayout *layout, QString paramName) {
+void RefineSearchWidget::setupLabel(const QString &text, QBoxLayout *layout, const QString ¶mName) {
QBoxLayout* hLayout = new QHBoxLayout();
hLayout->setSpacing(8);
hLayout->setMargin(0);
QLabel *icon = new QLabel(this);
icon->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
QString resource = paramName;
- QPixmap pixmap = QPixmap(":/images/search-" + resource + ".png");
+ QPixmap pixmap = IconUtils::pixmap(":/images/search-" + resource + ".png");
+ /*
QPixmap translucentPixmap(pixmap.size());
translucentPixmap.fill(Qt::transparent);
QPainter painter;
painter.setOpacity(0.5);
painter.drawPixmap(0, 0, pixmap);
painter.end();
- icon->setPixmap(translucentPixmap);
+ */
+ icon->setPixmap(pixmap);
hLayout->addWidget(icon);
- QLabel *label = new QLabel(text.toUpper(), this);
- label->setFont(FontUtils::mediumBold());
- label->setStyleSheet("color: rgba(0, 0, 0, 128);");
+ QLabel *label = new QLabel(text, this);
hLayout->addWidget(label);
icon->setMaximumHeight(label->height());
layout->addLayout(hLayout);
}
-QToolBar* RefineSearchWidget::setupBar(QString paramName) {
+QToolBar* RefineSearchWidget::setupBar(const QString ¶mName) {
QToolBar* bar = new QToolBar(this);
bar->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
// bar->setProperty("segmented", true);
- bar->setFont(FontUtils::medium());
bar->setProperty("paramName", paramName);
- connect(bar, SIGNAL(actionTriggered(QAction*)),
- SLOT(actionTriggered(QAction*)));
+ connect(bar, SIGNAL(actionTriggered(QAction*)), SLOT(actionTriggered(QAction*)));
bars.insert(paramName, bar);
layout()->addWidget(bar);
return bar;
}
-void RefineSearchWidget::paintEvent(QPaintEvent * /*event*/) {
-#if defined(APP_MAC) | defined(APP_WIN)
- QBrush brush;
- if (window()->isActiveWindow()) {
- brush = QBrush(QColor(0xdd, 0xe4, 0xeb));
- } else {
- brush = palette().window();
- }
- QPainter painter(this);
- painter.fillRect(0, 0, width(), height(), brush);
-#endif
-}
-
void RefineSearchWidget::actionTriggered(QAction *action) {
QToolBar *bar = static_cast<QToolBar *>(sender());
if (!bar) {