X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=src%2Fplayermainwindow.cpp;h=a400cd7aec06c27134d9bd9964975a943c70ee02;hb=b1307f656acc4cb7e0f61b6daf9b0cfa5bed40d6;hp=9e5363bd2d4645fb2980155f488bd4e1f0e5fa5f;hpb=b6351c06eb605ad8a23510f079ec6b6914ebf7c2;p=vlc-remote diff --git a/src/playermainwindow.cpp b/src/playermainwindow.cpp index 9e5363b..a400cd7 100644 --- a/src/playermainwindow.cpp +++ b/src/playermainwindow.cpp @@ -35,7 +35,7 @@ ui->setupUi(this); setWindowTitle("Vlc remote"); - + mIsFirstStatusCall = true; mTimer = new QTimer(this); mNetManager = new QNetworkAccessManager(this); @@ -348,6 +348,7 @@ doc.setContent(reply->readAll()); delete reply; QDomElement docElem = doc.documentElement(); + VlcStatusState oldState = mCurrentStatus.state; // Get the raw values int volume = docElem.namedItem("volume").toElement().text().toInt(); int length = docElem.namedItem("length").toElement().text().toInt(); @@ -389,16 +390,27 @@ } else { mCurrentStatus.state = UNKNOWN; + mIsFirstStatusCall = true; } } else { mCurrentStatus.state = UNKNOWN; + mIsFirstStatusCall = true; } mCurrentStatus.newtrack = true; - if ( (0 == mCurrentStatus.length || STOP == mCurrentStatus.state) // stopped or null - || // same track as current playing - (mCurrentStatus.length == length && !mCurrentStatus.title.isNull() && !title.isNull() && 0 == QString::compare(mCurrentStatus.title, title)) ){ - mCurrentStatus.newtrack = false; + if (mIsFirstStatusCall) { + mIsFirstStatusCall = false; + mCurrentStatus.newtrack = true; // unneeded but self-documenting + } + else if (STOP == oldState && STOP != mCurrentStatus.state) { + mCurrentStatus.newtrack = true; // unneeded but self-documenting + } + else { + if ( (0 == mCurrentStatus.length || STOP == mCurrentStatus.state) // stopped or null + || // same track as current playing + (mCurrentStatus.length == length && !mCurrentStatus.title.isNull() && !title.isNull() && 0 == QString::compare(mCurrentStatus.title, title)) ){ + mCurrentStatus.newtrack = false; + } } mCurrentStatus.volume = volume; mCurrentStatus.length = length; @@ -461,7 +473,12 @@ ui->playpauseButton->setIcon(QIcon::fromTheme("camera_playback")); } - if (mCurrentStatus.newtrack) { + if (STOP == mCurrentStatus.state) { + ui->labelArtPortrait->setVisible(false); + ui->labelArtLandscape->setVisible(false); + } + + if (mCurrentStatus.newtrack && STOP != mCurrentStatus.state) { // potential actions: // rebuild display layout // retrieve album art