mirror of
https://github.com/clementine-player/Clementine
synced 2024-12-16 11:19:18 +01:00
Template magic \o/
This commit is contained in:
parent
791534703c
commit
98c97d13d6
@ -44,6 +44,14 @@ class RadioModel : public SimpleTreeModel<RadioItem> {
|
||||
// Needs to be static for RadioPlaylistItem::restore
|
||||
static RadioService* ServiceByName(const QString& name);
|
||||
|
||||
template<typename T>
|
||||
static T* Service() {
|
||||
if (sServices.contains(T::kServiceName)) {
|
||||
return static_cast<T*>(sServices[T::kServiceName]);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// This is special because Player needs it for scrobbling
|
||||
LastFMService* GetLastFMService() const;
|
||||
|
||||
|
@ -327,11 +327,10 @@ MainWindow::MainWindow(NetworkAccessManager* network, Engine::Type engine, QWidg
|
||||
LastFMButtonVisibilityChanged(radio_model_->GetLastFMService()->AreButtonsVisible());
|
||||
|
||||
// Connections to the saved streams service
|
||||
SavedRadio* saved_radio_ = qobject_cast<SavedRadio*>(
|
||||
RadioModel::ServiceByName(SavedRadio::kServiceName));
|
||||
add_stream_dialog_->set_add_on_accept(saved_radio_);
|
||||
SavedRadio* saved_radio = RadioModel::Service<SavedRadio>();
|
||||
add_stream_dialog_->set_add_on_accept(saved_radio);
|
||||
|
||||
connect(saved_radio_, SIGNAL(ShowAddStreamDialog()),
|
||||
connect(saved_radio, SIGNAL(ShowAddStreamDialog()),
|
||||
add_stream_dialog_.get(), SLOT(show()));
|
||||
|
||||
// Tray icon
|
||||
|
Loading…
Reference in New Issue
Block a user