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

View File

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