Fix the selected text color in the global search popup

This commit is contained in:
David Sansome 2011-09-17 15:03:56 +01:00
parent d9533fca26
commit 61b3493c01
5 changed files with 45 additions and 39 deletions

View File

@ -344,5 +344,6 @@
<file>providers/skyfm.png</file>
<file>providers/digitallyimported-32.png</file>
<file>allthethings.png</file>
<file>globalsearch.css</file>
</qresource>
</RCC>

32
data/globalsearch.css Normal file
View File

@ -0,0 +1,32 @@
#search, QToolButton {
color: white;
font-weight: bold;
font-size: 7.5pt;
}
#search:disabled {
color: rgba(255, 255, 255, 75%);
}
#search {
border: 1px groove rgba(128, 128, 128, 60%);
border-radius: 4px 4px;
background-color: rgba(0, 0, 0, 20%)
}
QToolButton {
font-weight: normal;
font-weight: bold;
color: rgba(255, 255, 255, 50%);
}
QToolButton:hover {
background-color: black;
border: 2px solid rgba(255, 255, 255, 20%);
border-radius: 3px;
}
QToolButton:pressed {
border: 2px solid rgba(255, 255, 255, 20%);
background-color: rgba(255, 255, 255, 10%);
}

View File

@ -54,13 +54,14 @@ void GlobalSearchItemDelegate::paint(QPainter* p,
const SearchProvider::Result result =
index.data(GlobalSearchWidget::Role_Result).value<SearchProvider::Result>();
const Song& m = result.metadata_;
const bool selected = option.state & QStyle::State_Selected;
widget_->LazyLoadArt(index);
QFont bold_font = option.font;
bold_font.setBold(true);
QColor pen = option.palette.color(QPalette::Text);
QColor pen = option.palette.color(selected ? QPalette::HighlightedText : QPalette::Text);
QColor light_pen = pen;
pen.setAlpha(200);
light_pen.setAlpha(128);

View File

@ -23,6 +23,7 @@
#include "librarysearchprovider.h"
#include "ui_globalsearchwidget.h"
#include "core/logging.h"
#include "core/stylesheetloader.h"
#include "core/utilities.h"
#include "playlist/songmimedata.h"
#include "widgets/stylehelper.h"
@ -55,10 +56,13 @@ GlobalSearchWidget::GlobalSearchWidget(QWidget* parent)
{
ui_->setupUi(this);
// Set up the sorting proxy model
proxy_->setSourceModel(model_);
proxy_->setDynamicSortFilter(true);
proxy_->sort(0);
// Set up the popup
view_->setObjectName("popup");
view_->setWindowFlags(Qt::Popup);
view_->setFocusPolicy(Qt::NoFocus);
view_->setFocusProxy(ui_->search);
@ -71,6 +75,10 @@ GlobalSearchWidget::GlobalSearchWidget(QWidget* parent)
ui_->search->installEventFilter(this);
// Load style sheets
StyleSheetLoader* style_loader = new StyleSheetLoader(this);
style_loader->SetStyleSheet(this, ":globalsearch.css");
connect(ui_->search, SIGNAL(textEdited(QString)), SLOT(TextEdited(QString)));
connect(engine_, SIGNAL(ResultsAvailable(int,SearchProvider::ResultList)),
SLOT(AddResults(int,SearchProvider::ResultList)));
@ -96,7 +104,8 @@ void GlobalSearchWidget::Init(LibraryBackendInterface* library) {
// The style helper's base color doesn't get initialised until after the
// constructor.
QPalette view_palette = view_->palette();
view_palette.setColor(QPalette::Text, Qt::white);
view_palette.setColor(QPalette::Text, Utils::StyleHelper::panelTextColor());
view_palette.setColor(QPalette::HighlightedText, QColor(60, 60, 60));
view_palette.setColor(QPalette::Base, Utils::StyleHelper::shadowColor().darker(109));
QFont view_font = view_->font();

View File

@ -13,43 +13,6 @@
<property name="windowTitle">
<string>Form</string>
</property>
<property name="styleSheet">
<string notr="true">* {
color: white;
font-weight: bold;
font-size: 7.5pt;
}
#search:disabled {
color: rgba(255, 255, 255, 75%);
}
#search {
border: 1px groove rgba(128, 128, 128, 60%);
border-radius: 4px 4px;
background-color: rgba(0, 0, 0, 20%)
}
QToolButton {
font-weight: normal;
font-weight: bold;
color: rgba(255, 255, 255, 50%);
}
QToolButton:hover {
background-color: black;
border: 2px solid rgba(255, 255, 255, 20%);
border-radius: 3px;
}
QToolButton:pressed {
border: 2px solid rgba(255, 255, 255, 20%);
background-color: rgba(255, 255, 255, 10%);
}
</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="LineEdit" name="search">