From 914eb59215a4326aeb0c3a9482c9679c57e35bd6 Mon Sep 17 00:00:00 2001 From: John Maguire Date: Thu, 1 Sep 2011 15:10:36 +0100 Subject: [PATCH] Make searching and adding work from global search popup. --- src/globalsearch/globalsearchpopup.cpp | 14 +++ src/globalsearch/globalsearchpopup.h | 7 ++ src/globalsearch/globalsearchpopup.ui | 154 ++++++++++++++----------- src/ui/mainwindow.cpp | 4 + 4 files changed, 114 insertions(+), 65 deletions(-) diff --git a/src/globalsearch/globalsearchpopup.cpp b/src/globalsearch/globalsearchpopup.cpp index f140a3055..443ae526a 100644 --- a/src/globalsearch/globalsearchpopup.cpp +++ b/src/globalsearch/globalsearchpopup.cpp @@ -1,8 +1,22 @@ #include "globalsearchpopup.h" +#include "ui/iconloader.h" GlobalSearchPopup::GlobalSearchPopup(QWidget* parent) : QDialog(parent), ui_(new Ui_GlobalSearchPopup) { ui_->setupUi(this); + + ui_->previous->setIcon(IconLoader::Load("media-skip-backward")); + ui_->next->setIcon(IconLoader::Load("media-skip-forward")); + ui_->play_pause->setIcon(IconLoader::Load("media-playback-start")); + ui_->stop->setIcon(IconLoader::Load("media-playback-stop")); +} + +void GlobalSearchPopup::Init(LibraryBackendInterface* library) { + ui_->search_widget->Init(library); + + // Forward AddToPlaylist signal. + connect(ui_->search_widget, SIGNAL(AddToPlaylist(QMimeData*)), + SIGNAL(AddToPlaylist(QMimeData*))); } diff --git a/src/globalsearch/globalsearchpopup.h b/src/globalsearch/globalsearchpopup.h index adc1e067c..2ffd040f9 100644 --- a/src/globalsearch/globalsearchpopup.h +++ b/src/globalsearch/globalsearchpopup.h @@ -7,11 +7,18 @@ #include "ui_globalsearchpopup.h" +class LibraryBackendInterface; + class GlobalSearchPopup : public QDialog { Q_OBJECT public: explicit GlobalSearchPopup(QWidget* parent = 0); + void Init(LibraryBackendInterface* library); + + signals: + void AddToPlaylist(QMimeData*); + private: boost::scoped_ptr ui_; }; diff --git a/src/globalsearch/globalsearchpopup.ui b/src/globalsearch/globalsearchpopup.ui index 8fd1b51cc..83d802ee3 100644 --- a/src/globalsearch/globalsearchpopup.ui +++ b/src/globalsearch/globalsearchpopup.ui @@ -6,84 +6,108 @@ 0 0 - 268 - 100 + 446 + 253 Dialog - - - QFormLayout::FieldsStayAtSizeHint - - - + + + + + + 0 + 0 + + + + + + + + Qt::Vertical + + + QSizePolicy::Minimum + + + + 20 + 40 + + + + + + - + + + Qt::Horizontal + + + + 40 + 20 + + + - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - ... - - - - - - - ... - - - - - - - ... - - - - - - - ... - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - + + + ... + + + + + + + ... + + + + + + + ... + + + + + + + ... + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + GlobalSearchWidget + QWidget +
globalsearch/globalsearchwidget.h
+ 1 +
+
diff --git a/src/ui/mainwindow.cpp b/src/ui/mainwindow.cpp index 2f8266364..6f5526149 100644 --- a/src/ui/mainwindow.cpp +++ b/src/ui/mainwindow.cpp @@ -2245,5 +2245,9 @@ void MainWindow::HandleNotificationPreview(OSD::Behaviour type, QString line1, Q void MainWindow::ShowGlobalSearch() { GlobalSearchPopup* popup = new GlobalSearchPopup; + popup->Init(library_->backend()); + StyleSheetLoader* css_loader = new StyleSheetLoader(popup); + css_loader->SetStyleSheet(popup, ":mainwindow.css"); + connect(popup, SIGNAL(AddToPlaylist(QMimeData*)), SLOT(AddToPlaylist(QMimeData*))); popup->show(); }