1
0
mirror of https://github.com/clementine-player/Clementine synced 2024-12-16 19:31:02 +01:00

Port InternetModel to closures.

This commit is contained in:
John Maguire 2012-10-12 14:18:47 +02:00
parent ff86e07a4b
commit 42fb7f9b42
2 changed files with 4 additions and 3 deletions

View File

@ -103,6 +103,8 @@ void InternetModel::AddService(InternetService *service) {
connect(service, SIGNAL(AddToPlaylistSignal(QMimeData*)), SIGNAL(AddToPlaylist(QMimeData*)));
connect(service, SIGNAL(ScrollToIndex(QModelIndex)), SIGNAL(ScrollToIndex(QModelIndex)));
connect(service, SIGNAL(destroyed()), SLOT(ServiceDeleted()));
NewClosure(service, SIGNAL(destroyed()), this,
SLOT(ServiceDeleted(InternetService*)), service);
service->ReloadSettings();
}
@ -127,8 +129,7 @@ void InternetModel::RemoveService(InternetService* service) {
disconnect(service, 0, this, 0);
}
void InternetModel::ServiceDeleted() {
InternetService* service = qobject_cast<InternetService*>(sender());
void InternetModel::ServiceDeleted(InternetService* service) {
if (service)
RemoveService(service);
}

View File

@ -166,7 +166,7 @@ signals:
void ScrollToIndex(const QModelIndex& index);
private slots:
void ServiceDeleted();
void ServiceDeleted(InternetService* service);
private:
static QMap<QString, InternetService*>* sServices;