mirror of
https://github.com/clementine-player/Clementine
synced 2024-12-17 12:02:48 +01:00
Make searching and adding work from global search popup.
This commit is contained in:
parent
c2d68fd697
commit
914eb59215
@ -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*)));
|
||||
}
|
||||
|
@ -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_;
|
||||
};
|
||||
|
@ -6,84 +6,108 @@
|
||||
<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">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<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">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit"/>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="previous">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="play_pause">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="stop">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="next">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
<widget class="QToolButton" name="previous">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="play_pause">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="stop">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="next">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</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>
|
||||
|
@ -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();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user