1
0
mirror of https://github.com/clementine-player/Clementine synced 2025-02-01 11:56:45 +01:00

Only create one global search popup.

This commit is contained in:
John Maguire 2011-09-01 16:30:42 +01:00
parent 551a85cb9b
commit 395c487250
2 changed files with 12 additions and 7 deletions

View File

@ -2244,11 +2244,13 @@ void MainWindow::HandleNotificationPreview(OSD::Behaviour type, QString line1, Q
}
void MainWindow::ShowGlobalSearch() {
GlobalSearchPopup* popup = new GlobalSearchPopup;
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*)));
popup->show();
popup->setFocus();
if (!search_popup_) {
search_popup_.reset(new GlobalSearchPopup);
search_popup_->Init(library_->backend(), player_);
StyleSheetLoader* css_loader = new StyleSheetLoader(search_popup_.get());
css_loader->SetStyleSheet(search_popup_.get(), ":mainwindow.css");
connect(search_popup_.get(), SIGNAL(AddToPlaylist(QMimeData*)), SLOT(AddToPlaylist(QMimeData*)));
}
search_popup_->show();
search_popup_->setFocus();
}

View File

@ -46,6 +46,7 @@ class EditTagDialog;
class Equalizer;
class ErrorDialog;
class FileView;
class GlobalSearchPopup;
class GlobalShortcuts;
class GroupByDialog;
class Library;
@ -301,6 +302,8 @@ class MainWindow : public QMainWindow, public PlatformInterface {
boost::scoped_ptr<TrackSelectionDialog> track_selection_dialog_;
PlaylistItemList autocomplete_tag_items_;
boost::scoped_ptr<GlobalSearchPopup> search_popup_;
#ifdef ENABLE_VISUALISATIONS
boost::scoped_ptr<VisualisationContainer> visualisation_;
#endif