diff --git a/src/QUSongSupport.cpp b/src/QUSongSupport.cpp index cddacbd..2a92110 100644 --- a/src/QUSongSupport.cpp +++ b/src/QUSongSupport.cpp @@ -21,6 +21,7 @@ QStringList QUSongSupport::availableTags() { result << GENRE_TAG; result << YEAR_TAG; result << CREATOR_TAG; + result << TAGS_TAG; result << MP3_TAG; result << COVER_TAG; result << BACKGROUND_TAG; @@ -487,6 +488,19 @@ QStringList QUSongSupport::availableSongYears() { return result; } +QStringList QUSongSupport::availableSongTags() { + QStringList result; + + result << "Christmas"; + result << "Clean"; + result << "Duet"; + result << "Explicit"; + result << "Eurovision"; + result << "Kids"; + + return result; +} + QString QUSongSupport::defaultInputEncoding() { QStringList result = registryKey("defaultInputEncoding", "CP1252"); return result.first(); diff --git a/src/QUSongSupport.h b/src/QUSongSupport.h index 62f6b50..04e6561 100644 --- a/src/QUSongSupport.h +++ b/src/QUSongSupport.h @@ -32,6 +32,7 @@ class QUSongSupport: QObject { static QStringList availableSongEditions(); static QStringList availableSongGenres(); static QStringList availableSongYears(); + static QStringList availableSongTags(); static QString defaultInputEncoding(); diff --git a/src/report/QUAbstractReportData.h b/src/report/QUAbstractReportData.h index f9427d1..598123a 100644 --- a/src/report/QUAbstractReportData.h +++ b/src/report/QUAbstractReportData.h @@ -14,19 +14,20 @@ #define GENRE_COL 4 #define YEAR_COL 5 #define CREATOR_COL 6 -#define AUDIO_EXISTS_COL 7 -#define COVER_EXISTS_COL 8 -#define BACKGROUND_EXISTS_COL 9 -#define VIDEO_EXISTS_COL 10 -#define MEDLEY_EXISTS_COL 11 -#define GOLDEN_NOTES_EXIST_COL 12 -#define RAP_NOTES_EXIST_COL 13 -#define SONG_PATH_COL 14 -#define SONG_FILE_PATH_COL 15 -#define REL_SONG_FILE_PATH_COL 16 -#define LENGTH_COL 17 -#define SPEED_COL 18 -#define CUSTOM_TAG_COL 19 +#define TAGS_COL 7 +#define AUDIO_EXISTS_COL 8 +#define COVER_EXISTS_COL 9 +#define BACKGROUND_EXISTS_COL 10 +#define VIDEO_EXISTS_COL 11 +#define MEDLEY_EXISTS_COL 12 +#define GOLDEN_NOTES_EXIST_COL 13 +#define RAP_NOTES_EXIST_COL 14 +#define SONG_PATH_COL 15 +#define SONG_FILE_PATH_COL 16 +#define REL_SONG_FILE_PATH_COL 17 +#define LENGTH_COL 18 +#define SPEED_COL 19 +#define CUSTOM_TAG_COL 20 class QUAbstractReportData: public QObject { Q_OBJECT diff --git a/src/report/QUReportDialog.cpp b/src/report/QUReportDialog.cpp index 99ad3db..f207fa1 100644 --- a/src/report/QUReportDialog.cpp +++ b/src/report/QUReportDialog.cpp @@ -103,6 +103,7 @@ void QUReportDialog::initReportList() { reportList->addItem(new QUReportItem(new QUSongTagData(GENRE_TAG))); reportList->addItem(new QUReportItem(new QUSongTagData(YEAR_TAG))); reportList->addItem(new QUReportItem(new QUSongTagData(CREATOR_TAG))); + reportList->addItem(new QUReportItem(new QUSongTagData(TAGS_TAG))); reportList->addItem(new QUReportItem(new QUBooleanSongData(MP3_TAG))); reportList->addItem(new QUReportItem(new QUBooleanSongData(COVER_TAG))); diff --git a/src/report/QUSongTagData.cpp b/src/report/QUSongTagData.cpp index 9463062..5ae8f22 100644 --- a/src/report/QUSongTagData.cpp +++ b/src/report/QUSongTagData.cpp @@ -32,6 +32,10 @@ QUSongTagData::QUSongTagData(const QString &tag, QObject *parent): QUAbstractRep this->setIcon(QIcon(":/types/creator.png")); this->setDescription(tr("Creator")); this->setID(CREATOR_COL); + } else if(QString::compare(_tag, TAGS_TAG, Qt::CaseInsensitive) == 0) { + this->setIcon(QIcon(":/types/tags.png")); + this->setDescription(tr("Tags")); + this->setID(TAGS_COL); } else if(QUSongSupport::availableCustomTags().contains(tag, Qt::CaseInsensitive)) { this->setIcon(QIcon(":/bullets/bullet_star.png")); this->setDescription(tag); @@ -54,6 +58,8 @@ QString QUSongTagData::textData(QUSongFile *song) { return song->year(); if(QString::compare(_tag, CREATOR_TAG, Qt::CaseInsensitive) == 0) return song->creator(); + if(QString::compare(_tag, TAGS_TAG, Qt::CaseInsensitive) == 0) + return song->tags(); if(QUSongSupport::availableCustomTags().contains(_tag, Qt::CaseInsensitive)) return song->customTag(_tag); @@ -82,6 +88,8 @@ void QUSongTagData::sort(QList &songs) { std::stable_sort(songs.begin(), songs.end(), QUSongFile::yearLessThan); else if(QString::compare(_tag, CREATOR_TAG, Qt::CaseInsensitive) == 0) std::stable_sort(songs.begin(), songs.end(), QUSongFile::creatorLessThan); + else if(QString::compare(_tag, TAGS_TAG, Qt::CaseInsensitive) == 0) + std::stable_sort(songs.begin(), songs.end(), QUSongFile::tagsLessThan); // TODO: sort custom tag columns } diff --git a/src/resources/UltraStar-Manager.qrc b/src/resources/UltraStar-Manager.qrc index 2345fc8..337bea7 100644 --- a/src/resources/UltraStar-Manager.qrc +++ b/src/resources/UltraStar-Manager.qrc @@ -275,6 +275,7 @@ rap_notes.png writeID3.png sync.png + tags.png save_big.png diff --git a/src/resources/tags.png b/src/resources/tags.png new file mode 100644 index 0000000..feb51fa Binary files /dev/null and b/src/resources/tags.png differ diff --git a/src/song/QUSongFile.cpp b/src/song/QUSongFile.cpp index 4b5fa02..15b0d85 100644 --- a/src/song/QUSongFile.cpp +++ b/src/song/QUSongFile.cpp @@ -107,6 +107,7 @@ bool QUSongFile::editionLessThan (QUSongFile *s1, QUSongFile *s2) { return QSt bool QUSongFile::genreLessThan (QUSongFile *s1, QUSongFile *s2) { return QString::compare(s1->genre(), s2->genre(), Qt::CaseInsensitive) < 0; } bool QUSongFile::yearLessThan (QUSongFile *s1, QUSongFile *s2) { return QString::compare(s1->year(), s2->year(), Qt::CaseInsensitive) < 0; } bool QUSongFile::creatorLessThan (QUSongFile *s1, QUSongFile *s2) { return QString::compare(s1->creator(), s2->creator(), Qt::CaseInsensitive) < 0; } +bool QUSongFile::tagsLessThan (QUSongFile *s1, QUSongFile *s2) { return QString::compare(s1->tags(), s2->tags(), Qt::CaseInsensitive) < 0; } bool QUSongFile::pathLessThan (QUSongFile *s1, QUSongFile *s2) { return QString::compare(s1->path(), s2->path(), Qt::CaseInsensitive) < 0; } bool QUSongFile::filePathLessThan (QUSongFile *s1, QUSongFile *s2) { return QString::compare(s1->filePath(), s2->filePath(), Qt::CaseInsensitive) < 0; } diff --git a/src/song/QUSongFile.h b/src/song/QUSongFile.h index 5391a72..b1b3ffc 100644 --- a/src/song/QUSongFile.h +++ b/src/song/QUSongFile.h @@ -43,6 +43,7 @@ class QUSongFile: public QUSongInterface { static bool genreLessThan (QUSongFile *s1, QUSongFile *s2); static bool yearLessThan (QUSongFile *s1, QUSongFile *s2); static bool creatorLessThan (QUSongFile *s1, QUSongFile *s2); + static bool tagsLessThan (QUSongFile *s1, QUSongFile *s2); static bool pathLessThan (QUSongFile *s1, QUSongFile *s2); static bool filePathLessThan (QUSongFile *s1, QUSongFile *s2); @@ -77,6 +78,7 @@ public slots: QString year() const {return _info.value(YEAR_TAG, QString(N_A));} QString end() const {return _info.value(END_TAG, QString(N_A));} QString creator() const {return _info.value(CREATOR_TAG, QString(N_A));} + QString tags() const {return _info.value(TAGS_TAG, QString(N_A));} QString encoding() const {return _info.value(ENCODING_TAG, QString(N_A));} QString previewstart() const {return _info.value(PREVIEWSTART_TAG, QString(N_A));} QString calcmedley() const {return _info.value(CALCMEDLEY_TAG, QString(N_A));} diff --git a/src/song/QUSongInterface.h b/src/song/QUSongInterface.h index 994d34b..804d4df 100644 --- a/src/song/QUSongInterface.h +++ b/src/song/QUSongInterface.h @@ -17,6 +17,7 @@ class QFileInfo; #define GENRE_TAG "GENRE" #define YEAR_TAG "YEAR" #define CREATOR_TAG "CREATOR" +#define TAGS_TAG "TAGS" #define MP3_TAG "MP3" #define COVER_TAG "COVER" #define BACKGROUND_TAG "BACKGROUND" @@ -134,6 +135,7 @@ class QUSongInterface: public QObject { Q_PROPERTY(QString year READ year) Q_PROPERTY(QString end READ end) Q_PROPERTY(QString creator READ creator) + Q_PROPERTY(QString tags READ tags) Q_PROPERTY(QString encoding READ encoding) Q_PROPERTY(QString previewstart READ previewstart) Q_PROPERTY(QString calcmedley READ calcmedley) @@ -192,6 +194,7 @@ class QUSongInterface: public QObject { virtual QString year() const = 0; virtual QString end() const = 0; virtual QString creator() const = 0; + virtual QString tags() const = 0; virtual QString encoding() const = 0; virtual QString previewstart() const = 0; virtual QString calcmedley() const = 0; diff --git a/src/songdetails/QUDetailItem.cpp b/src/songdetails/QUDetailItem.cpp index 6282876..385d54f 100644 --- a/src/songdetails/QUDetailItem.cpp +++ b/src/songdetails/QUDetailItem.cpp @@ -73,6 +73,10 @@ void QUDetailItem::reset() { _hasDynamicDefaultData = false; } else if(QString::compare(_tag, CREATOR_TAG) == 0) { _flagsForMultipleSongs = Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable; + } else if(QString::compare(_tag, TAGS_TAG) == 0) { + _flagsForMultipleSongs = Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable; + setData(Qt::UserRole, QUSongSupport::availableSongTags()); // static default data + _hasDynamicDefaultData = false; // } else if(QString::compare(_tag, MP3_TAG) == 0) { // } else if(QString::compare(_tag, COVER_TAG) == 0) { // } else if(QString::compare(_tag, BACKGROUND_TAG) == 0) { diff --git a/src/songdetails/QUDetailsTable.cpp b/src/songdetails/QUDetailsTable.cpp index 5595eb1..b8f6826 100644 --- a/src/songdetails/QUDetailsTable.cpp +++ b/src/songdetails/QUDetailsTable.cpp @@ -48,6 +48,7 @@ void QUDetailsTable::initTagColumn() { this->setItem(row++, 0, new QUTagItem(QIcon(":/types/genre.png"), tr("Genre"))); this->setItem(row++, 0, new QUTagItem(QIcon(":/types/date.png"), tr("Year"))); this->setItem(row++, 0, new QUTagItem(QIcon(":/types/creator.png"), tr("Creator"))); + this->setItem(row++, 0, new QUTagItem(QIcon(":/types/tags.png"), tr("Tags"))); this->setItem(row++, 0, new QUTagItem(QIcon(":/types/album.png"), tr("Album"))); this->setItem(row++, 0, new QUTagItem(QIcon(":/types/comment.png"), tr("Comment"))); this->setItem(row++, 0, new QUTagItem(QIcon(":/types/source.png"), tr("Source"))); @@ -98,6 +99,7 @@ void QUDetailsTable::initValueColumn() { this->setItem(row++, 1, new QUDetailItem(GENRE_TAG)); this->setItem(row++, 1, new QUDetailItem(YEAR_TAG)); this->setItem(row++, 1, new QUDetailItem(CREATOR_TAG)); + this->setItem(row++, 1, new QUDetailItem(TAGS_TAG)); this->setItem(row++, 1, new QUDetailItem(ALBUM_TAG)); this->setItem(row++, 1, new QUDetailItem(COMMENT_TAG)); this->setItem(row++, 1, new QUDetailItem(SOURCE_TAG)); diff --git a/src/songtree/QUSongItem.cpp b/src/songtree/QUSongItem.cpp index 50b405e..0c4736c 100644 --- a/src/songtree/QUSongItem.cpp +++ b/src/songtree/QUSongItem.cpp @@ -905,6 +905,7 @@ void QUSongItem::updateTextColumns() { this->setText(GENRE_COLUMN, song()->genre()); if(song()->genre() != N_A) this->setToolTip(GENRE_COLUMN, song()->genre()); this->setText(YEAR_COLUMN, song()->year()); if(song()->year() != N_A) this->setToolTip(YEAR_COLUMN, song()->year()); this->setText(CREATOR_COLUMN, song()->creator()); if(song()->creator() != N_A) this->setToolTip(CREATOR_COLUMN, song()->creator()); + this->setText(TAGS_COLUMN, song()->tags()); if(song()->tags() != N_A) this->setToolTip(TAGS_COLUMN, song()->tags()); // show custom tags int i = 0; diff --git a/src/songtree/QUSongItem.h b/src/songtree/QUSongItem.h index c4fd889..2159fc9 100644 --- a/src/songtree/QUSongItem.h +++ b/src/songtree/QUSongItem.h @@ -44,14 +44,15 @@ #define GENRE_COLUMN 28 #define YEAR_COLUMN 29 #define CREATOR_COLUMN 30 +#define TAGS_COLUMN 31 -#define RELATIVE_COLUMN 31 -#define BPM_COLUMN 32 -#define GAP_COLUMN 33 +#define RELATIVE_COLUMN 32 +#define BPM_COLUMN 33 +#define GAP_COLUMN 34 -#define DUPLICATE_ID_COLUMN 34 +#define DUPLICATE_ID_COLUMN 35 -#define FIRST_CUSTOM_TAG_COLUMN 35 +#define FIRST_CUSTOM_TAG_COLUMN 36 /*! * This class encapsulates a pointer to a QUSongFile object to be able diff --git a/src/songtree/QUSongTree.cpp b/src/songtree/QUSongTree.cpp index 9ef8cf1..274d483 100644 --- a/src/songtree/QUSongTree.cpp +++ b/src/songtree/QUSongTree.cpp @@ -135,6 +135,8 @@ void QUSongTree::initHorizontalHeader() { header->setIcon(YEAR_COLUMN, QIcon(":/types/date.png")); header->setText(CREATOR_COLUMN, tr("Creator")); header->setIcon(CREATOR_COLUMN, QIcon(":/types/creator.png")); + header->setText(TAGS_COLUMN, tr("Tags")); + header->setIcon(TAGS_COLUMN, QIcon(":/types/tags.png")); header->setText(LENGTH_COLUMN, tr("Song")); header->setIcon(LENGTH_COLUMN, QIcon(":/types/time_song.png")); @@ -424,6 +426,7 @@ void QUSongTree::filterItems(const QString ®exp, QU::FilterModes mode) { song->year().contains(rx) || song->edition().contains(rx) || song->creator().contains(rx) || + song->tags().contains(rx) || song->language().contains(rx); if(!matchesInfoTag) @@ -732,6 +735,7 @@ void QUSongTree::showDefaultColumns(bool save) { this->header()->showSection(GENRE_COLUMN); this->header()->showSection(YEAR_COLUMN); this->header()->showSection(CREATOR_COLUMN); + this->header()->showSection(TAGS_COLUMN); int customTagsCount = QUSongSupport::availableCustomTags().size(); for(int i = 0; i < customTagsCount; ++i)