Fixed playlist disappearing on remove or clear.
authordruid23 <usr@dru-id.co.uk>
Tue, 17 Aug 2010 01:18:09 +0000 (02:18 +0100)
committerdruid23 <usr@dru-id.co.uk>
Tue, 17 Aug 2010 01:18:09 +0000 (02:18 +0100)
modified:   playlistmainwindow.cpp

playlistmainwindow.cpp

index 4af4b7a..8ba4412 100644 (file)
@@ -109,7 +109,7 @@ void PlayListMainWindow::onListSelectionChanged() {
 void PlayListMainWindow::onRemove() {
     if (0 < this->mCurrentVlcIndex) {
         /*QNetworkReply * reply = */ mNetManager->get(QNetworkRequest(QUrl("http://"+mIp+"/requests/status.xml?command=pl_delete&id=" + QString::number(this->mCurrentVlcIndex))));
 void PlayListMainWindow::onRemove() {
     if (0 < this->mCurrentVlcIndex) {
         /*QNetworkReply * reply = */ mNetManager->get(QNetworkRequest(QUrl("http://"+mIp+"/requests/status.xml?command=pl_delete&id=" + QString::number(this->mCurrentVlcIndex))));
-        this->requestPlayList();
+        connect(mNetManager,SIGNAL(finished(QNetworkReply *)),this,SLOT(requestPlayList()));
     }
 }
 void PlayListMainWindow::onPlay() {
     }
 }
 void PlayListMainWindow::onPlay() {
@@ -128,7 +128,7 @@ void PlayListMainWindow::onShuffle() {
 }
 void PlayListMainWindow::onClear() {
     /*QNetworkReply * reply = */ mNetManager->get(QNetworkRequest(QUrl("http://"+mIp+"/requests/status.xml?command=pl_empty")));
 }
 void PlayListMainWindow::onClear() {
     /*QNetworkReply * reply = */ mNetManager->get(QNetworkRequest(QUrl("http://"+mIp+"/requests/status.xml?command=pl_empty")));
-                                 this->requestPlayList();
+    connect(mNetManager,SIGNAL(finished(QNetworkReply *)),this,SLOT(requestPlayList()));
 }
 void PlayListMainWindow::requestPlayList() {
   mContents->clear();
 }
 void PlayListMainWindow::requestPlayList() {
   mContents->clear();
@@ -137,6 +137,7 @@ void PlayListMainWindow::requestPlayList() {
   ui->removeButton->setDisabled(true);
   ui->playButton->setDisabled(true);
   QNetworkReply * reply =  mNetManager->get(QNetworkRequest(QUrl("http://"+mIp+"/requests/playlist.xml")));
   ui->removeButton->setDisabled(true);
   ui->playButton->setDisabled(true);
   QNetworkReply * reply =  mNetManager->get(QNetworkRequest(QUrl("http://"+mIp+"/requests/playlist.xml")));
+  disconnect(mNetManager,SIGNAL(finished(QNetworkReply *)),this,SLOT(requestPlayList()));
   connect(reply,SIGNAL(readyRead()),this,SLOT(readReady()));
   connect(mNetManager,SIGNAL(finished(QNetworkReply *)),this,SLOT(finished(QNetworkReply *)));
 }
   connect(reply,SIGNAL(readyRead()),this,SLOT(readReady()));
   connect(mNetManager,SIGNAL(finished(QNetworkReply *)),this,SLOT(finished(QNetworkReply *)));
 }