Implement the global search tooltip options
This commit is contained in:
parent
fafee5af7c
commit
a9e1fe0075
@ -15,6 +15,7 @@
|
||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "globalsearch.h"
|
||||
#include "globalsearchtooltip.h"
|
||||
#include "tooltipactionwidget.h"
|
||||
#include "tooltipresultwidget.h"
|
||||
@ -27,6 +28,7 @@
|
||||
#include <QKeyEvent>
|
||||
#include <QLayoutItem>
|
||||
#include <QPainter>
|
||||
#include <QSettings>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
const qreal GlobalSearchTooltip::kBorderRadius = 8.0;
|
||||
@ -40,7 +42,8 @@ GlobalSearchTooltip::GlobalSearchTooltip(QWidget* event_target)
|
||||
: QWidget(NULL),
|
||||
desktop_(qApp->desktop()),
|
||||
event_target_(event_target),
|
||||
active_result_(0)
|
||||
active_result_(0),
|
||||
show_tooltip_help_(true)
|
||||
{
|
||||
setWindowFlags(Qt::Popup);
|
||||
setFocusPolicy(Qt::NoFocus);
|
||||
@ -50,6 +53,8 @@ GlobalSearchTooltip::GlobalSearchTooltip(QWidget* event_target)
|
||||
switch_action_ = new QAction(tr("Switch provider"), this);
|
||||
switch_action_->setShortcut(QKeySequence(Qt::Key_Tab));
|
||||
connect(switch_action_, SIGNAL(triggered()), SLOT(SwitchProvider()));
|
||||
|
||||
ReloadSettings();
|
||||
}
|
||||
|
||||
void GlobalSearchTooltip::SetResults(const SearchProvider::ResultList& results) {
|
||||
@ -78,6 +83,7 @@ void GlobalSearchTooltip::SetResults(const SearchProvider::ResultList& results)
|
||||
result_buttons_ << widget;
|
||||
}
|
||||
|
||||
if (show_tooltip_help_) {
|
||||
// Add the action widget
|
||||
QList<QAction*> actions;
|
||||
if (results_.count() > 1) {
|
||||
@ -88,6 +94,7 @@ void GlobalSearchTooltip::SetResults(const SearchProvider::ResultList& results)
|
||||
action_widget_ = new TooltipActionWidget(this);
|
||||
action_widget_->SetActions(actions);
|
||||
AddWidget(action_widget_, &w, &y);
|
||||
}
|
||||
|
||||
// Set the width of each widget
|
||||
foreach (QWidget* widget, widgets_) {
|
||||
@ -246,3 +253,9 @@ void GlobalSearchTooltip::SwitchProvider() {
|
||||
result_buttons_[active_result_]->setChecked(true);
|
||||
}
|
||||
|
||||
void GlobalSearchTooltip::ReloadSettings() {
|
||||
QSettings s;
|
||||
s.beginGroup(GlobalSearch::kSettingsGroup);
|
||||
|
||||
show_tooltip_help_ = s.value("tooltip_help", true).toBool();
|
||||
}
|
||||
|
@ -48,6 +48,9 @@ public:
|
||||
|
||||
bool event(QEvent* e);
|
||||
|
||||
public slots:
|
||||
void ReloadSettings();
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent*);
|
||||
|
||||
@ -73,6 +76,8 @@ private:
|
||||
QWidgetList widgets_;
|
||||
QList<QAbstractButton*> result_buttons_;
|
||||
int active_result_;
|
||||
|
||||
bool show_tooltip_help_;
|
||||
};
|
||||
|
||||
#endif // GLOBALSEARCHTOOLTIP_H
|
||||
|
@ -63,6 +63,7 @@ GlobalSearchWidget::GlobalSearchWidget(QWidget* parent)
|
||||
swap_models_timer_(new QTimer(this)),
|
||||
background_(":allthethings.png"),
|
||||
desktop_(qApp->desktop()),
|
||||
show_tooltip_(true),
|
||||
combine_identical_results_(true)
|
||||
{
|
||||
ui_->setupUi(this);
|
||||
@ -566,8 +567,13 @@ void GlobalSearchWidget::ReloadSettings() {
|
||||
QSettings s;
|
||||
s.beginGroup(GlobalSearch::kSettingsGroup);
|
||||
|
||||
show_tooltip_ = s.value("tooltip", true).toBool();
|
||||
combine_identical_results_ = s.value("combine_identical_results", true).toBool();
|
||||
provider_order_ = s.value("provider_order", QStringList() << "library").toStringList();
|
||||
|
||||
if (tooltip_) {
|
||||
tooltip_->ReloadSettings();
|
||||
}
|
||||
}
|
||||
|
||||
GlobalSearchWidget::CombineAction GlobalSearchWidget::CanCombineResults(
|
||||
@ -629,7 +635,7 @@ void GlobalSearchWidget::HidePopup() {
|
||||
}
|
||||
|
||||
void GlobalSearchWidget::UpdateTooltip() {
|
||||
if (!view_->isVisible()) {
|
||||
if (!view_->isVisible() || !show_tooltip_) {
|
||||
if (tooltip_)
|
||||
tooltip_->hide();
|
||||
return;
|
||||
|
@ -147,6 +147,7 @@ private:
|
||||
|
||||
QDesktopWidget* desktop_;
|
||||
|
||||
bool show_tooltip_;
|
||||
bool combine_identical_results_;
|
||||
QStringList provider_order_;
|
||||
|
||||
|
@ -335,7 +335,7 @@ msgstr ""
|
||||
msgid "Add action"
|
||||
msgstr ""
|
||||
|
||||
#: globalsearch/globalsearchwidget.cpp:96
|
||||
#: globalsearch/globalsearchwidget.cpp:97
|
||||
msgid "Add and play now"
|
||||
msgstr ""
|
||||
|
||||
@ -347,7 +347,7 @@ msgstr ""
|
||||
msgid "Add directory..."
|
||||
msgstr ""
|
||||
|
||||
#: ui/mainwindow.cpp:1575
|
||||
#: ui/mainwindow.cpp:1576
|
||||
msgid "Add file"
|
||||
msgstr ""
|
||||
|
||||
@ -359,7 +359,7 @@ msgstr ""
|
||||
msgid "Add files to transcode"
|
||||
msgstr ""
|
||||
|
||||
#: ui/mainwindow.cpp:1600
|
||||
#: ui/mainwindow.cpp:1601
|
||||
msgid "Add folder"
|
||||
msgstr ""
|
||||
|
||||
@ -427,11 +427,11 @@ msgstr ""
|
||||
msgid "Add stream..."
|
||||
msgstr ""
|
||||
|
||||
#: ui/mainwindow.cpp:1404
|
||||
#: ui/mainwindow.cpp:1405
|
||||
msgid "Add to another playlist"
|
||||
msgstr ""
|
||||
|
||||
#: globalsearch/globalsearchwidget.cpp:95
|
||||
#: globalsearch/globalsearchwidget.cpp:96
|
||||
#: ../bin/src/ui_albumcovermanager.h:152
|
||||
msgid "Add to playlist"
|
||||
msgstr ""
|
||||
@ -1257,7 +1257,7 @@ msgid "Delete Grooveshark playlist"
|
||||
msgstr ""
|
||||
|
||||
#: devices/deviceview.cpp:393 library/libraryview.cpp:450
|
||||
#: ui/mainwindow.cpp:1838 widgets/fileview.cpp:185
|
||||
#: ui/mainwindow.cpp:1839 widgets/fileview.cpp:185
|
||||
msgid "Delete files"
|
||||
msgstr ""
|
||||
|
||||
@ -1286,11 +1286,11 @@ msgstr ""
|
||||
msgid "Deleting files"
|
||||
msgstr ""
|
||||
|
||||
#: ui/mainwindow.cpp:1349
|
||||
#: ui/mainwindow.cpp:1350
|
||||
msgid "Dequeue selected tracks"
|
||||
msgstr ""
|
||||
|
||||
#: ui/mainwindow.cpp:1347
|
||||
#: ui/mainwindow.cpp:1348
|
||||
msgid "Dequeue track"
|
||||
msgstr ""
|
||||
|
||||
@ -1472,7 +1472,7 @@ msgstr ""
|
||||
msgid "Edit smart playlist..."
|
||||
msgstr ""
|
||||
|
||||
#: ui/mainwindow.cpp:1382
|
||||
#: ui/mainwindow.cpp:1383
|
||||
#, qt-format
|
||||
msgid "Edit tag \"%1\"..."
|
||||
msgstr ""
|
||||
@ -1579,8 +1579,8 @@ msgid "Equivalent to --log-levels *:3"
|
||||
msgstr ""
|
||||
|
||||
#: internet/magnatunedownloaddialog.cpp:225 library/libraryview.cpp:444
|
||||
#: ui/edittagdialog.cpp:719 ui/mainwindow.cpp:1806 ui/mainwindow.cpp:1911
|
||||
#: ui/mainwindow.cpp:2129
|
||||
#: ui/edittagdialog.cpp:719 ui/mainwindow.cpp:1807 ui/mainwindow.cpp:1912
|
||||
#: ui/mainwindow.cpp:2130
|
||||
msgid "Error"
|
||||
msgstr ""
|
||||
|
||||
@ -2275,7 +2275,7 @@ msgstr ""
|
||||
msgid "Library advanced grouping"
|
||||
msgstr ""
|
||||
|
||||
#: ui/mainwindow.cpp:2031
|
||||
#: ui/mainwindow.cpp:2032
|
||||
msgid "Library rescan notice"
|
||||
msgstr ""
|
||||
|
||||
@ -2621,7 +2621,7 @@ msgstr ""
|
||||
msgid "Never start playing"
|
||||
msgstr ""
|
||||
|
||||
#: ui/mainwindow.cpp:1421 ../bin/src/ui_mainwindow.h:680
|
||||
#: ui/mainwindow.cpp:1422 ../bin/src/ui_mainwindow.h:680
|
||||
msgid "New playlist"
|
||||
msgstr ""
|
||||
|
||||
@ -2672,7 +2672,7 @@ msgstr ""
|
||||
msgid "None"
|
||||
msgstr ""
|
||||
|
||||
#: library/libraryview.cpp:445 ui/mainwindow.cpp:1807 ui/mainwindow.cpp:1912
|
||||
#: library/libraryview.cpp:445 ui/mainwindow.cpp:1808 ui/mainwindow.cpp:1913
|
||||
msgid "None of the selected songs were suitable for copying to a device"
|
||||
msgstr ""
|
||||
|
||||
@ -2864,7 +2864,7 @@ msgstr ""
|
||||
msgid "Password Protected"
|
||||
msgstr ""
|
||||
|
||||
#: core/globalshortcuts.cpp:46 ui/mainwindow.cpp:886 ui/mainwindow.cpp:1272
|
||||
#: core/globalshortcuts.cpp:46 ui/mainwindow.cpp:887 ui/mainwindow.cpp:1273
|
||||
#: ui/qtsystemtrayicon.cpp:178 wiimotedev/wiimotesettingspage.cpp:106
|
||||
msgid "Pause"
|
||||
msgstr ""
|
||||
@ -2881,8 +2881,8 @@ msgstr ""
|
||||
msgid "Plain sidebar"
|
||||
msgstr ""
|
||||
|
||||
#: core/globalshortcuts.cpp:45 ui/mainwindow.cpp:520 ui/mainwindow.cpp:854
|
||||
#: ui/mainwindow.cpp:873 ui/mainwindow.cpp:1275 ui/qtsystemtrayicon.cpp:166
|
||||
#: core/globalshortcuts.cpp:45 ui/mainwindow.cpp:520 ui/mainwindow.cpp:855
|
||||
#: ui/mainwindow.cpp:874 ui/mainwindow.cpp:1276 ui/qtsystemtrayicon.cpp:166
|
||||
#: ui/qtsystemtrayicon.cpp:192 wiimotedev/wiimotesettingspage.cpp:101
|
||||
#: ../bin/src/ui_mainwindow.h:631
|
||||
msgid "Play"
|
||||
@ -3090,12 +3090,12 @@ msgstr ""
|
||||
msgid "Queue Manager"
|
||||
msgstr ""
|
||||
|
||||
#: ui/mainwindow.cpp:1353
|
||||
#: ui/mainwindow.cpp:1354
|
||||
msgid "Queue selected tracks"
|
||||
msgstr ""
|
||||
|
||||
#: globalsearch/globalsearchwidget.cpp:97 library/libraryview.cpp:244
|
||||
#: ui/mainwindow.cpp:1351
|
||||
#: globalsearch/globalsearchwidget.cpp:98 library/libraryview.cpp:244
|
||||
#: ui/mainwindow.cpp:1352
|
||||
msgid "Queue track"
|
||||
msgstr ""
|
||||
|
||||
@ -3233,11 +3233,11 @@ msgstr ""
|
||||
msgid "Repeat track"
|
||||
msgstr ""
|
||||
|
||||
#: globalsearch/globalsearchwidget.cpp:99
|
||||
#: globalsearch/globalsearchwidget.cpp:100
|
||||
msgid "Replace and play now"
|
||||
msgstr ""
|
||||
|
||||
#: devices/deviceview.cpp:218 globalsearch/globalsearchwidget.cpp:98
|
||||
#: devices/deviceview.cpp:218 globalsearch/globalsearchwidget.cpp:99
|
||||
#: internet/internetservice.cpp:63 library/libraryview.cpp:238
|
||||
#: widgets/fileviewlist.cpp:33
|
||||
msgid "Replace current playlist"
|
||||
@ -3448,7 +3448,7 @@ msgstr ""
|
||||
msgid "Service offline"
|
||||
msgstr ""
|
||||
|
||||
#: ui/mainwindow.cpp:1380
|
||||
#: ui/mainwindow.cpp:1381
|
||||
#, qt-format
|
||||
msgid "Set %1 to \"%2\"..."
|
||||
msgstr ""
|
||||
@ -3799,7 +3799,7 @@ msgstr ""
|
||||
msgid "Supported formats"
|
||||
msgstr ""
|
||||
|
||||
#: globalsearch/globalsearchtooltip.cpp:50
|
||||
#: globalsearch/globalsearchtooltip.cpp:53
|
||||
msgid "Switch provider"
|
||||
msgstr ""
|
||||
|
||||
@ -3874,7 +3874,7 @@ msgstr ""
|
||||
msgid "The site you requested is not an image!"
|
||||
msgstr ""
|
||||
|
||||
#: ui/mainwindow.cpp:2024
|
||||
#: ui/mainwindow.cpp:2025
|
||||
msgid ""
|
||||
"The version of Clementine you've just updated to requires a full library "
|
||||
"rescan because of the new features listed below:"
|
||||
@ -3896,7 +3896,7 @@ msgid ""
|
||||
"deleted:"
|
||||
msgstr ""
|
||||
|
||||
#: library/libraryview.cpp:451 ui/mainwindow.cpp:1839 widgets/fileview.cpp:186
|
||||
#: library/libraryview.cpp:451 ui/mainwindow.cpp:1840 widgets/fileview.cpp:186
|
||||
msgid ""
|
||||
"These files will be deleted from disk, are you sure you want to continue?"
|
||||
msgstr ""
|
||||
@ -4001,7 +4001,7 @@ msgstr ""
|
||||
msgid "Toggle fullscreen"
|
||||
msgstr ""
|
||||
|
||||
#: ui/mainwindow.cpp:1355
|
||||
#: ui/mainwindow.cpp:1356
|
||||
msgid "Toggle queue status"
|
||||
msgstr ""
|
||||
|
||||
@ -4324,7 +4324,7 @@ msgstr ""
|
||||
msgid "Windows Media audio"
|
||||
msgstr ""
|
||||
|
||||
#: ui/mainwindow.cpp:2029
|
||||
#: ui/mainwindow.cpp:2030
|
||||
msgid "Would you like to run a full rescan right now?"
|
||||
msgstr ""
|
||||
|
||||
@ -4443,7 +4443,7 @@ msgstr ""
|
||||
msgid "Your Magnatune credentials were incorrect"
|
||||
msgstr ""
|
||||
|
||||
#: ui/edittagdialog.cpp:719 ui/mainwindow.cpp:2129
|
||||
#: ui/edittagdialog.cpp:719 ui/mainwindow.cpp:2130
|
||||
msgid ""
|
||||
"Your gstreamer installation is missing the 'ofa' plugin. This is required "
|
||||
"for automatic tag fetching. Try installing the 'gstreamer-plugins-bad' "
|
||||
|
@ -826,6 +826,7 @@ void MainWindow::ReloadAllSettings() {
|
||||
|
||||
// Other settings
|
||||
global_search_->ReloadSettings();
|
||||
ui_->global_search->ReloadSettings();
|
||||
library_->ReloadSettings();
|
||||
player_->ReloadSettings();
|
||||
osd_->ReloadSettings();
|
||||
|
Loading…
x
Reference in New Issue
Block a user