Show song details in window titlebar
This commit is contained in:
@@ -1725,31 +1725,19 @@ void MainWindow::updatePlayQueue(const QList<Song> &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)
|
||||
|
||||
11
mpd/song.cpp
11
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;
|
||||
|
||||
@@ -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!
|
||||
|
||||
Reference in New Issue
Block a user