diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index b779dc7fa..84adc7c16 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -1725,31 +1725,19 @@ void MainWindow::updatePlayQueue(const QList &songs) void MainWindow::updateWindowTitle() { -// MPDStatus * const status = MPDStatus::self(); -// bool stopped=MPDState_Stopped==status->state() || MPDState_Inactive==status->state(); + MPDStatus * const status = MPDStatus::self(); + bool stopped=MPDState_Stopped==status->state() || MPDState_Inactive==status->state(); bool multipleConnections=connectionsAction->isVisible(); QString connection=MPDConnection::self()->getDetails().getName(); + QString description=stopped ? QString() : current.basicDescription(); -// if (stopped) { + if (stopped || description.isEmpty()) { setWindowTitle(multipleConnections ? i18n("Cantata (%1)", connection) : "Cantata"); -// } else if (current.isStandardStream()) { -// setWindowTitle(multipleConnections -// ? i18nc("track :: Cantata (connection)", "%1 :: Cantata (%2)", trackLabel->fullText(), connection) -// : i18nc("track :: Cantata", "%1 :: Cantata", trackLabel->fullText())); -// } else if (current.artist.isEmpty()) { -// if (trackLabel->fullText().isEmpty()) { -// setWindowTitle(multipleConnections ? i18n("Cantata (%1)", connection) : "Cantata"); -// } else { -// setWindowTitle(multipleConnections -// ? i18nc("track :: Cantata (connection)", "%1 :: Cantata (%2)", trackLabel->fullText(), connection) -// : i18nc("track :: Cantata", "%1 :: Cantata", trackLabel->fullText())); -// } -// } else { -// setWindowTitle(multipleConnections -// ? i18nc("track - artist :: Cantata (connection)", "%1 - %2 :: Cantata (%3)", -// trackLabel->fullText(), current.artist, connection) -// : i18nc("track - artist :: Cantata", "%1 - %2 :: Cantata", trackLabel->fullText(), current.artist)); -// } + } else { + setWindowTitle(multipleConnections + ? i18nc("track :: Cantata (connection)", "%1 :: Cantata (%2)", description, connection) + : i18nc("track :: Cantata", "%1 :: Cantata", description)); + } } void MainWindow::updateCurrentSong(const Song &song) diff --git a/mpd/song.cpp b/mpd/song.cpp index 3092cc03d..bbd86137e 100644 --- a/mpd/song.cpp +++ b/mpd/song.cpp @@ -572,6 +572,17 @@ QString Song::describe(bool withMarkup) const : i18nc("Song by Artist on Album", "%1 by %2 on %3", title, artist, albumText); } +QString Song::basicDescription() const +{ + return isStandardStream() + ? name + : title.isEmpty() + ? QString() + : artist.isEmpty() + ? title + : i18nc("track - artist", "%1 - %2", title, artist); +} + bool Song::isFromOnlineService() const { return constOnlineDiscId==disc && (isCantataStream() || file.startsWith("http://")) && albumartist==album; diff --git a/mpd/song.h b/mpd/song.h index ecf9e7d60..719176f4e 100644 --- a/mpd/song.h +++ b/mpd/song.h @@ -129,6 +129,7 @@ struct Song QString basicArtist() const; QString filePath() const { return decodePath(file); } QString describe(bool withMarkup=false) const; + QString basicDescription() const; // We pass 'Song' around to cover requester. When we want the artist image, and not album image, // then we blank certain fields to indicate this!