From 52328acdcfb60461e72f210ac7345781ec297eb7 Mon Sep 17 00:00:00 2001 From: druid23 Date: Sun, 22 Aug 2010 14:08:08 +0100 Subject: [PATCH] Improved some memory handling. modified: playermainwindow.cpp modified: playlistmainwindow.cpp --- playermainwindow.cpp | 14 +++++++++++--- playlistmainwindow.cpp | 1 + 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/playermainwindow.cpp b/playermainwindow.cpp index 9ee1480..5ffb274 100644 --- a/playermainwindow.cpp +++ b/playermainwindow.cpp @@ -95,7 +95,6 @@ connect(ui->playpauseButton,SIGNAL(clicked()),this,SLOT(playpause())); connect(ui->stopButton,SIGNAL(clicked()),this,SLOT(stop())); - //connect(ui->pauseButton,SIGNAL(clicked()),this,SLOT(playpause())); connect(ui->previousButton,SIGNAL(clicked()),this,SLOT(previous())); connect(ui->nextButton,SIGNAL(clicked()),this,SLOT(next())); connect(ui->fullscreenButton,SIGNAL(clicked()),this,SLOT(fullscreen())); @@ -297,7 +296,7 @@ void PlayerMainWindow::askStatus() { - qDebug() << "Status requested. at:" << QTime::currentTime().toString("hh::mm:ss"); + //qDebug() << "Status requested. at:" << QTime::currentTime().toString("hh::mm:ss"); QNetworkReply * reply = mNetManager->get(QNetworkRequest(QUrl("http://"+mIp+"/requests/status.xml"))); connect(reply,SIGNAL(readyRead()),this,SLOT(parseXmlStatus())); } @@ -334,6 +333,10 @@ QString album = metaInfoNode.namedItem("album").toElement().text(); QString now_playing = metaInfoNode.namedItem("now_playing").toElement().text(); QString art_url = metaInfoNode.namedItem("art_url").toElement().text(); + //metaInfoNode.clear(); + //infoNode.clear(); + //docElem.clear(); + //doc.clear(); // Populate the current status structure // now would be a good time to work out if we are a new track / file or not. // key if we are going to look for album art later @@ -403,8 +406,11 @@ } - if (mCurrentStatus.position >= 0 && mCurrentStatus.position <= 100) + if (mCurrentStatus.position >= 0 && mCurrentStatus.position <= 100) { + ui->slider->blockSignals(true); ui->slider->setValue(mCurrentStatus.position); + ui->slider->blockSignals(false); + } ui->labelTitle->setText(mCurrentStatus.title); ui->labelArtist->setText(mCurrentStatus.artist); @@ -454,6 +460,7 @@ this->setCoverArt(mResponse); // only interested in finished signals disconnect(mNetManager,SIGNAL(finished(QNetworkReply *)),this,SLOT(finished(QNetworkReply *))); + delete reply; } void PlayerMainWindow::getCoverArt(int id) { qDebug() << "getCoverArt id=!" << id; @@ -485,6 +492,7 @@ ui->labelArtPortrait->setVisible(false); ui->labelArtLandscape->setVisible(false); } + delete image; } void PlayerMainWindow::setCoverArtFromPixmap(QPixmap image) { mHasImage = true; diff --git a/playlistmainwindow.cpp b/playlistmainwindow.cpp index fd2569a..15789d6 100644 --- a/playlistmainwindow.cpp +++ b/playlistmainwindow.cpp @@ -185,6 +185,7 @@ void PlayListMainWindow::finished(QNetworkReply * reply) { #if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) this->setAttribute(Qt::WA_Maemo5ShowProgressIndicator, false); #endif + delete reply; } void PlayListMainWindow::parseXmlPlayList() { -- 1.7.9.5