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

Hook up the popup's buttons to the Player.

This commit is contained in:
John Maguire 2011-09-01 15:56:56 +01:00
parent ee9b9501ed
commit 2dc7c3ea8e
3 changed files with 10 additions and 3 deletions

View File

@ -2,6 +2,7 @@
#include <QShortcut>
#include "core/player.h"
#include "ui/iconloader.h"
GlobalSearchPopup::GlobalSearchPopup(QWidget* parent)
@ -21,12 +22,17 @@ GlobalSearchPopup::GlobalSearchPopup(QWidget* parent)
connect(shortcut, SIGNAL(activated()), SLOT(close()));
}
void GlobalSearchPopup::Init(LibraryBackendInterface* library) {
void GlobalSearchPopup::Init(LibraryBackendInterface* library, Player* player) {
ui_->search_widget->Init(library);
// Forward AddToPlaylist signal.
connect(ui_->search_widget, SIGNAL(AddToPlaylist(QMimeData*)),
SIGNAL(AddToPlaylist(QMimeData*)));
connect(ui_->previous, SIGNAL(clicked(bool)), player, SLOT(Previous()));
connect(ui_->next, SIGNAL(clicked(bool)), player, SLOT(Next()));
connect(ui_->play_pause, SIGNAL(clicked(bool)), player, SLOT(PlayPause()));
connect(ui_->stop, SIGNAL(clicked(bool)), player, SLOT(Stop()));
}
void GlobalSearchPopup::setFocus(Qt::FocusReason reason) {

View File

@ -8,13 +8,14 @@
#include "ui_globalsearchpopup.h"
class LibraryBackendInterface;
class Player;
class GlobalSearchPopup : public QDialog {
Q_OBJECT
public:
explicit GlobalSearchPopup(QWidget* parent = 0);
void Init(LibraryBackendInterface* library);
void Init(LibraryBackendInterface* library, Player* player);
// QWidget
void setFocus(Qt::FocusReason reason = Qt::PopupFocusReason);

View File

@ -2245,7 +2245,7 @@ void MainWindow::HandleNotificationPreview(OSD::Behaviour type, QString line1, Q
void MainWindow::ShowGlobalSearch() {
GlobalSearchPopup* popup = new GlobalSearchPopup;
popup->Init(library_->backend());
popup->Init(library_->backend(), player_);
StyleSheetLoader* css_loader = new StyleSheetLoader(popup);
css_loader->SetStyleSheet(popup, ":mainwindow.css");
connect(popup, SIGNAL(AddToPlaylist(QMimeData*)), SLOT(AddToPlaylist(QMimeData*)));