1
0
mirror of https://github.com/clementine-player/Clementine synced 2024-12-17 20:09:50 +01:00

Make searching and adding work from global search popup.

This commit is contained in:
John Maguire 2011-09-01 15:10:36 +01:00
parent c2d68fd697
commit 914eb59215
4 changed files with 114 additions and 65 deletions

View File

@ -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*)));
}

View File

@ -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_GlobalSearchPopup> ui_;
};

View File

@ -6,21 +6,39 @@
<rect>
<x>0</x>
<y>0</y>
<width>268</width>
<height>100</height>
<width>446</width>
<height>253</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::FieldsStayAtSizeHint</enum>
</property>
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLineEdit" name="lineEdit"/>
<widget class="GlobalSearchWidget" name="search_widget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Minimum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
@ -81,9 +99,15 @@
</layout>
</item>
</layout>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>GlobalSearchWidget</class>
<extends>QWidget</extends>
<header>globalsearch/globalsearchwidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View File

@ -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();
}