diff --git a/res/skins/Deere/deck_small.xml b/res/skins/Deere/deck_small.xml index a3c04c50dda..ef693901199 100644 --- a/res/skins/Deere/deck_small.xml +++ b/res/skins/Deere/deck_small.xml @@ -63,7 +63,7 @@ track_title TitleTextSmall 100me,23f - title + titleInfo left right @@ -89,7 +89,7 @@ - + track_time PlayPositionTextSmall diff --git a/res/skins/Deere/deck_text_row.xml b/res/skins/Deere/deck_text_row.xml index c98eb251316..d09a52f1837 100644 --- a/res/skins/Deere/deck_text_row.xml +++ b/res/skins/Deere/deck_text_row.xml @@ -49,7 +49,7 @@ track_title me,min - title + titleInfo right diff --git a/res/skins/Deere/sampler_text_row.xml b/res/skins/Deere/sampler_text_row.xml index 9d69f868c00..aae0ec267cb 100644 --- a/res/skins/Deere/sampler_text_row.xml +++ b/res/skins/Deere/sampler_text_row.xml @@ -83,7 +83,7 @@ track_title me,min - title + titleInfo right diff --git a/res/skins/LateNight/deck_mini.xml b/res/skins/LateNight/deck_mini.xml index aed4e0e7aea..67424c81822 100644 --- a/res/skins/LateNight/deck_mini.xml +++ b/res/skins/LateNight/deck_mini.xml @@ -60,12 +60,12 @@ track_title TitleTextSmall 100me,23f - title + titleInfo left right - + track_time PlayPositionTextSmall diff --git a/res/skins/LateNight/deck_row_2_3_TitleArtistTime.xml b/res/skins/LateNight/deck_row_2_3_TitleArtistTime.xml index f71d480adda..2ae390c394b 100644 --- a/res/skins/LateNight/deck_row_2_3_TitleArtistTime.xml +++ b/res/skins/LateNight/deck_row_2_3_TitleArtistTime.xml @@ -28,7 +28,7 @@ TitleText 0me,22f track_title - title + titleInfo Left right diff --git a/res/skins/LateNight/sampler.xml b/res/skins/LateNight/sampler.xml index 12624b3268c..4fa253635d9 100644 --- a/res/skins/LateNight/sampler.xml +++ b/res/skins/LateNight/sampler.xml @@ -23,7 +23,7 @@ track_title SamplerTitle me,me - title + titleInfo right diff --git a/res/skins/LateNight/sampler_mini.xml b/res/skins/LateNight/sampler_mini.xml index e4ed10f1668..120a70c976e 100644 --- a/res/skins/LateNight/sampler_mini.xml +++ b/res/skins/LateNight/sampler_mini.xml @@ -41,7 +41,7 @@ track_title SamplerTitleSmall me,min - title + titleInfo right diff --git a/res/skins/Shade/deck.xml b/res/skins/Shade/deck.xml index 5a7f0a91fea..d96d70f42fe 100644 --- a/res/skins/Shade/deck.xml +++ b/res/skins/Shade/deck.xml @@ -61,7 +61,7 @@ padding-top: 4px; } - title + titleInfo 0e,20f right diff --git a/res/skins/Shade/deck_small.xml b/res/skins/Shade/deck_small.xml index e374dfbe17f..63019cb0eb6 100644 --- a/res/skins/Shade/deck_small.xml +++ b/res/skins/Shade/deck_small.xml @@ -58,7 +58,7 @@ padding: 0px 2px; } - title + titleInfo me,f 50,19 @@ -184,7 +184,7 @@ 1f,38f style/style_component_border.png - + 41f,38f @@ -246,4 +246,3 @@ - diff --git a/res/skins/Shade/sampler.xml b/res/skins/Shade/sampler.xml index 32f610ef643..1cda079d4e0 100644 --- a/res/skins/Shade/sampler.xml +++ b/res/skins/Shade/sampler.xml @@ -44,7 +44,7 @@ text-align: left; padding-left: 1px; } - title + titleInfo me,max right @@ -405,4 +405,3 @@ - diff --git a/res/skins/Shade/samplersmall.xml b/res/skins/Shade/samplersmall.xml index 110e71a106b..b5358c84a0d 100644 --- a/res/skins/Shade/samplersmall.xml +++ b/res/skins/Shade/samplersmall.xml @@ -77,7 +77,7 @@ text-align: left; padding-left: 1px; } - title + titleInfo [Sampler] me,max right @@ -172,4 +172,3 @@ - diff --git a/res/skins/Tango/deck_left_mini.xml b/res/skins/Tango/deck_left_mini.xml index 2a25c3f3fea..7af4c1b7f16 100644 --- a/res/skins/Tango/deck_left_mini.xml +++ b/res/skins/Tango/deck_left_mini.xml @@ -1,6 +1,6 @@ @@ -165,7 +165,7 @@ Variables: text i,18f - title + titleInfo right @@ -228,7 +228,7 @@ Variables: - + SamplerPitchSlider rate diff --git a/src/library/dlgtrackinfo.cpp b/src/library/dlgtrackinfo.cpp index 82926fb97ca..ea998a073fd 100644 --- a/src/library/dlgtrackinfo.cpp +++ b/src/library/dlgtrackinfo.cpp @@ -237,7 +237,7 @@ void DlgTrackInfo::loadPrevTrack() { } void DlgTrackInfo::populateFields(const Track& track) { - setWindowTitle(track.getArtist() % " - " % track.getTitle()); + setWindowTitle(track.getInfo()); // Editable fields txtTrackName->setText(track.getTitle()); diff --git a/src/track/track.cpp b/src/track/track.cpp index d15bd512600..24781b18dfa 100644 --- a/src/track/track.cpp +++ b/src/track/track.cpp @@ -362,9 +362,25 @@ bool Track::isMetadataSynchronized() const { QString Track::getInfo() const { QMutexLocker lock(&m_qMutex); if (m_record.getMetadata().getTrackInfo().getArtist().trimmed().isEmpty()) { - return m_record.getMetadata().getTrackInfo().getTitle(); + if (m_record.getMetadata().getTrackInfo().getTitle().trimmed().isEmpty()) { + return m_fileInfo.fileName(); + } else { + return m_record.getMetadata().getTrackInfo().getTitle(); + } } else { - return m_record.getMetadata().getTrackInfo().getArtist() + ", " + m_record.getMetadata().getTrackInfo().getTitle(); + return m_record.getMetadata().getTrackInfo().getArtist() + + QStringLiteral(" - ") + + m_record.getMetadata().getTrackInfo().getTitle(); + } +} + +QString Track::getTitleInfo() const { + QMutexLocker lock(&m_qMutex); + if (m_record.getMetadata().getTrackInfo().getArtist().trimmed().isEmpty() && + m_record.getMetadata().getTrackInfo().getTitle().trimmed().isEmpty()) { + return m_fileInfo.fileName(); + } else { + return m_record.getMetadata().getTrackInfo().getTitle(); } } diff --git a/src/track/track.h b/src/track/track.h index 5d4b64f609d..7d7c0c6ba7c 100644 --- a/src/track/track.h +++ b/src/track/track.h @@ -74,6 +74,8 @@ class Track : public QObject { Q_PROPERTY(QString durationFormatted READ getDurationTextSeconds STORED false) Q_PROPERTY(QString durationFormattedCentiseconds READ getDurationTextCentiseconds STORED false) Q_PROPERTY(QString durationFormattedMilliseconds READ getDurationTextMilliseconds STORED false) + Q_PROPERTY(QString info READ getInfo STORED false) + Q_PROPERTY(QString titleInfo READ getTitleInfo STORED false) TrackFile getFileInfo() const { // Copying TrackFile/QFileInfo is thread-safe (implicit sharing), no locking needed. @@ -233,9 +235,13 @@ class Track : public QObject { // Set URL for track void setURL(const QString& url); - // Output a formatted string with artist and title. + /// Formatted string with artist and title. QString getInfo() const; + /// The filename if BOTH artist AND title are empty, e.g. for tracks without + /// any metadata in file tags. Otherwise just the title (even if it is empty). + QString getTitleInfo() const; + ConstWaveformPointer getWaveform() const; void setWaveform(ConstWaveformPointer pWaveform);