Set placeholder text to original artist/album/etc
This commit is contained in:
@@ -442,6 +442,7 @@ void TagEditor::setIndex(int idx)
|
||||
Song s=edited.at(!haveMultiple || idx==0 ? 0 : idx);
|
||||
setSong(s);
|
||||
currentSongIndex=idx;
|
||||
setPlaceholderTexts();
|
||||
|
||||
bool isMultiple=haveMultiple && 0==idx;
|
||||
title->setEnabled(!isMultiple);
|
||||
@@ -496,6 +497,32 @@ void TagEditor::applyUpdates()
|
||||
}
|
||||
}
|
||||
|
||||
void TagEditor::setPlaceholderTexts()
|
||||
{
|
||||
bool isAll=0==currentSongIndex && original.count()>1;
|
||||
|
||||
if (isAll) {
|
||||
Song all=original.at(0);
|
||||
if (!all.artist.isEmpty()) {
|
||||
artist->setPlaceholderText(all.artist);
|
||||
}
|
||||
if (!all.album.isEmpty()) {
|
||||
album->setPlaceholderText(all.album);
|
||||
}
|
||||
if (!all.albumartist.isEmpty()) {
|
||||
albumArtist->setPlaceholderText(all.albumartist);
|
||||
}
|
||||
if (!all.genre.isEmpty()) {
|
||||
genre->setPlaceholderText(all.genre);
|
||||
}
|
||||
} else {
|
||||
artist->setPlaceholderText(QString());
|
||||
album->setPlaceholderText(QString());
|
||||
albumArtist->setPlaceholderText(QString());
|
||||
genre->setPlaceholderText(QString());
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef ENABLE_KDE_SUPPORT
|
||||
void TagEditor::slotButtonClicked(int button)
|
||||
{
|
||||
|
||||
@@ -65,6 +65,7 @@ private:
|
||||
void updateTrackName(int index, bool edited);
|
||||
void updateEditedStatus(int index);
|
||||
void applyUpdates();
|
||||
void setPlaceholderTexts();
|
||||
|
||||
private Q_SLOTS:
|
||||
void applyVa();
|
||||
|
||||
@@ -61,6 +61,10 @@ public:
|
||||
QString text() const {
|
||||
return qobject_cast<KLineEdit*>(lineEdit())->text();
|
||||
}
|
||||
|
||||
void setPlaceholderText(const QString &text) {
|
||||
qobject_cast<KLineEdit*>(lineEdit())->setPlaceholderText(text);
|
||||
}
|
||||
};
|
||||
#else
|
||||
#include <QtGui/QComboBox>
|
||||
@@ -83,6 +87,10 @@ public:
|
||||
QString text() const {
|
||||
return qobject_cast<QLineEdit*>(lineEdit())->text();
|
||||
}
|
||||
|
||||
void setPlaceholderText(const QString &text) {
|
||||
qobject_cast<QLineEdit*>(lineEdit())->setPlaceholderText(text);
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user