#define SHOW_UNKNOWN_FILETYPES false
#endif
+#ifndef SHOW_ALBUM_ART
+#define SHOW_ALBUM_ART true
+#endif
+
+#ifndef ALERT_ON_CLOSE
+#define ALERT_ON_CLOSE false
+#endif
+
struct VlcDirectory {
QString name;
static int getRetrieveArtTimeout();
static int getRetryNetworkTimeout();
static bool getShowUnknownFileTypes();
+ static bool getShowAlbumArt();
+ static bool getAlertOnClose();
+
};
#endif // APPSETTINGS_H
ui->setupUi(this);
setWindowTitle("Vlc remote");
-
+ mIsFirstStatusCall = true;
mTimer = new QTimer(this);
mNetManager = new QNetworkAccessManager(this);
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();
}
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;
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