UI tweaks to the global search help page

This commit is contained in:
David Sansome 2012-06-10 20:14:16 +01:00
parent 6e41a20e61
commit 99463215bf
2 changed files with 52 additions and 24 deletions

View File

@ -69,6 +69,18 @@ GlobalSearchView::GlobalSearchView(Application* app, QWidget* parent)
enabled_layout->setContentsMargins(16, 0, 16, 6);
disabled_layout->setContentsMargins(16, 0, 16, 6);
// Set the colour of the help text to the disabled text colour
QPalette help_palette = ui_->help_text->palette();
const QColor help_color = help_palette.color(QPalette::Disabled, QPalette::Text);
help_palette.setColor(QPalette::Normal, QPalette::Text, help_color);
help_palette.setColor(QPalette::Inactive, QPalette::Text, help_color);
ui_->help_text->setPalette(help_palette);
// Make it bold
QFont help_font = ui_->help_text->font();
help_font.setBold(true);
ui_->help_text->setFont(help_font);
group_by_[0] = LibraryModel::GroupBy_Artist;
group_by_[1] = LibraryModel::GroupBy_Album;
group_by_[2] = LibraryModel::GroupBy_None;
@ -114,16 +126,22 @@ namespace {
}
void GlobalSearchView::ReloadSettings() {
// Delete any old status widgets
qDeleteAll(provider_status_widgets_);
provider_status_widgets_.clear();
// Sort the list of providers alphabetically
QList<SearchProvider*> providers = engine_->providers();
qSort(providers.begin(), providers.end(), CompareProviderName);
bool any_disabled = false;
foreach (SearchProvider* provider, providers) {
QWidget* parent = engine_->is_provider_usable(provider)
? ui_->enabled_list
: ui_->disabled_list;
QWidget* parent = ui_->enabled_list;
if (!engine_->is_provider_usable(provider)) {
parent = ui_->disabled_list;
any_disabled = true;
}
SearchProviderStatusWidget* widget =
new SearchProviderStatusWidget(engine_, provider);
@ -131,6 +149,8 @@ void GlobalSearchView::ReloadSettings() {
parent->layout()->addWidget(widget);
provider_status_widgets_ << widget;
}
ui_->disabled_label->setVisible(any_disabled);
}
void GlobalSearchView::StartSearch(const QString& query) {

View File

@ -10,16 +10,6 @@
<height>633</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<property name="styleSheet">
<string notr="true">#help_text {
color: gray;
font-weight: bold;
margin: 1em 1em 4em 1em;
}</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
@ -89,16 +79,34 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="help_text">
<property name="text">
<string>Enter search terms above to find music on your computer and on the internet</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<widget class="QWidget" name="widget" native="true">
<layout class="QVBoxLayout" name="verticalLayout_4">
<property name="leftMargin">
<number>32</number>
</property>
<property name="topMargin">
<number>16</number>
</property>
<property name="rightMargin">
<number>32</number>
</property>
<property name="bottomMargin">
<number>64</number>
</property>
<item>
<widget class="QLabel" name="help_text">
<property name="text">
<string>Enter search terms above to find music on your computer and on the internet</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
@ -115,7 +123,7 @@
<widget class="QWidget" name="enabled_list" native="true"/>
</item>
<item>
<widget class="QLabel" name="label_3">
<widget class="QLabel" name="disabled_label">
<property name="text">
<string>But these sources are disabled:</string>
</property>