Commit 3fbe4ad6 authored by Matthieu Gallien's avatar Matthieu Gallien

Merge branch 'reallyRemoveMusicAudioTrack' into 'release/19.12'

really remove MusicAudioTrack

See merge request kde/elisa!28
parents 37102970 56235515
......@@ -22,7 +22,6 @@ target_include_directories(viewManagerTest PRIVATE ${CMAKE_SOURCE_DIR}/src)
set(databaseInterfaceTest_SOURCES
databaseinterfacetest.cpp
databasetestdata.h
../src/musicaudiotrack.cpp
)
ecm_add_test(${databaseInterfaceTest_SOURCES}
......@@ -34,7 +33,6 @@ target_include_directories(databaseInterfaceTest PRIVATE ${CMAKE_SOURCE_DIR}/src
set(managemediaplayercontrolTest_SOURCES
managemediaplayercontroltest.cpp
../src/musicaudiotrack.cpp
../src/elisautils.cpp
)
......@@ -46,7 +44,6 @@ ecm_add_test(${managemediaplayercontrolTest_SOURCES}
set(manageheaderbarTest_SOURCES
manageheaderbartest.cpp
../src/musicaudiotrack.cpp
../src/elisautils.cpp
)
......@@ -72,7 +69,6 @@ target_include_directories(manageaudioplayerTest PRIVATE ${CMAKE_SOURCE_DIR}/src
set(mediaplaylistTest_SOURCES
mediaplaylisttest.cpp
../src/elisautils.cpp
../src/musicaudiotrack.cpp
)
ecm_qt_declare_logging_category(mediaplaylistTest_SOURCES HEADER elisa_debug.h IDENTIFIER lcModelTest CATEGORY_NAME qt.modeltest)
......@@ -88,7 +84,6 @@ target_include_directories(mediaplaylistTest PRIVATE ${CMAKE_SOURCE_DIR}/src)
set(trackslistenertest_SOURCES
trackslistenertest.cpp
../src/elisautils.cpp
../src/musicaudiotrack.cpp
)
ecm_add_test(${trackslistenertest_SOURCES}
......@@ -101,7 +96,6 @@ target_include_directories(trackslistenertest PRIVATE ${CMAKE_SOURCE_DIR}/src)
set(datamodeltest_SOURCES
datamodeltest.cpp
../src/musicaudiotrack.cpp
)
ecm_qt_declare_logging_category(datamodeltest_SOURCES HEADER elisa_debug.h IDENTIFIER lcModelTest CATEGORY_NAME qt.modeltest)
......@@ -116,7 +110,6 @@ target_include_directories(datamodeltest PRIVATE ${CMAKE_SOURCE_DIR}/src)
set(trackmetadatamodeltest_SOURCES
trackmetadatamodeltest.cpp
../src/musicaudiotrack.cpp
)
ecm_qt_declare_logging_category(trackmetadatamodeltest_SOURCES HEADER elisa_debug.h IDENTIFIER lcModelTest CATEGORY_NAME qt.modeltest)
......@@ -131,7 +124,6 @@ target_include_directories(trackmetadatamodeltest PRIVATE ${CMAKE_SOURCE_DIR}/sr
set(alltracksproxymodeltest_SOURCES
alltracksproxymodeltest.cpp
../src/musicaudiotrack.cpp
)
ecm_qt_declare_logging_category(alltracksproxymodeltest_SOURCES HEADER elisa_debug.h IDENTIFIER lcModelTest CATEGORY_NAME qt.modeltest)
......@@ -147,7 +139,6 @@ target_include_directories(alltracksproxymodeltest PRIVATE ${CMAKE_SOURCE_DIR}/s
if (KF5FileMetaData_FOUND)
set(localfilelistingtest_SOURCES
localfilelistingtest.cpp
../src/musicaudiotrack.cpp
)
ecm_add_test(${localfilelistingtest_SOURCES}
......
......@@ -17,7 +17,6 @@
#include "databasetestdata.h"
#include "musicaudiotrack.h"
#include "databaseinterface.h"
#include "models/datamodel.h"
#include "models/alltracksproxymodel.h"
......@@ -48,7 +47,6 @@ private Q_SLOTS:
{
qRegisterMetaType<QHash<qulonglong,int>>("QHash<qulonglong,int>");
qRegisterMetaType<QHash<QString,QUrl>>("QHash<QString,QUrl>");
qRegisterMetaType<QHash<QString,QVector<MusicAudioTrack>>>("QHash<QString,QVector<MusicAudioTrack>>");
qRegisterMetaType<QVector<qlonglong>>("QVector<qlonglong>");
qRegisterMetaType<QHash<qlonglong,int>>("QHash<qlonglong,int>");
}
......@@ -91,7 +89,7 @@ private Q_SLOTS:
QCOMPARE(endRemoveRowsSpy.count(), 0);
QCOMPARE(dataChangedSpy.count(), 0);
musicDb.insertTracksList(MusicAudioTrack::tracksToListData(mNewTracks), mNewCovers);
musicDb.insertTracksList(mNewTracks, mNewCovers);
QCOMPARE(beginInsertRowsSpy.count(), 1);
QCOMPARE(endInsertRowsSpy.count(), 1);
......@@ -155,7 +153,7 @@ private Q_SLOTS:
QCOMPARE(endRemoveRowsSpy.count(), 0);
QCOMPARE(dataChangedSpy.count(), 0);
musicDb.insertTracksList(MusicAudioTrack::tracksToListData(mNewTracks), mNewCovers);
musicDb.insertTracksList(mNewTracks, mNewCovers);
QCOMPARE(beginInsertRowsSpy.count(), 1);
QCOMPARE(endInsertRowsSpy.count(), 1);
......@@ -227,7 +225,7 @@ private Q_SLOTS:
QCOMPARE(endRemoveRowsSpy.count(), 0);
QCOMPARE(dataChangedSpy.count(), 0);
musicDb.insertTracksList(MusicAudioTrack::tracksToListData(mNewTracks), mNewCovers);
musicDb.insertTracksList(mNewTracks, mNewCovers);
QCOMPARE(beginInsertRowsSpy.count(), 1);
QCOMPARE(endInsertRowsSpy.count(), 1);
......@@ -237,16 +235,16 @@ private Q_SLOTS:
QCOMPARE(proxyTracksModel.rowCount(), 23);
auto newTrack = MusicAudioTrack{true, QStringLiteral("$23"), QStringLiteral("0"), QStringLiteral("track23"),
auto newTrack = DataTypes::TrackDataType{true, QStringLiteral("$23"), QStringLiteral("0"), QStringLiteral("track23"),
QStringLiteral("artist2"), QStringLiteral("album4"), QStringLiteral("artist2"), 23, 1, QTime::fromMSecsSinceStartOfDay(23),
{QUrl::fromLocalFile(QStringLiteral("/$23"))},
QDateTime::fromMSecsSinceEpoch(23),
{QUrl::fromLocalFile(QStringLiteral("file://image$23"))}, 5, true,
{}, QStringLiteral("composer1"), QStringLiteral("lyricist1"), false};
auto newTracks = QList<MusicAudioTrack>();
auto newTracks = DataTypes::ListTrackDataType();
newTracks.push_back(newTrack);
musicDb.insertTracksList(MusicAudioTrack::tracksToListData(newTracks), mNewCovers);
musicDb.insertTracksList(newTracks, mNewCovers);
QCOMPARE(beginInsertRowsSpy.count(), 2);
QCOMPARE(endInsertRowsSpy.count(), 2);
......@@ -301,7 +299,7 @@ private Q_SLOTS:
newFiles.push_back(oneTrack.resourceURI());
}
musicDb.insertTracksList(MusicAudioTrack::tracksToListData(mNewTracks), mNewCovers);
musicDb.insertTracksList(mNewTracks, mNewCovers);
QCOMPARE(beginInsertRowsSpy.count(), 1);
QCOMPARE(endInsertRowsSpy.count(), 1);
......@@ -311,13 +309,13 @@ private Q_SLOTS:
QCOMPARE(proxyTracksModel.rowCount(), 23);
auto newTrack = MusicAudioTrack{true, QStringLiteral("$23"), QStringLiteral("0"), QStringLiteral("track23"),
auto newTrack = DataTypes::TrackDataType{true, QStringLiteral("$23"), QStringLiteral("0"), QStringLiteral("track23"),
QStringLiteral("artist2"), QStringLiteral("album4"), QStringLiteral("artist2"), 23, 1, QTime::fromMSecsSinceStartOfDay(23),
{QUrl::fromLocalFile(QStringLiteral("/$23"))},
QDateTime::fromMSecsSinceEpoch(23),
{QUrl::fromLocalFile(QStringLiteral("file://image$23"))}, 5, true,
{}, QStringLiteral("composer1"), QStringLiteral("lyricist1"), false};
auto newTracks = QList<MusicAudioTrack>();
auto newTracks = DataTypes::ListTrackDataType();
newTracks.push_back(newTrack);
auto newCover = QUrl::fromLocalFile(QStringLiteral("album5"));
......@@ -329,7 +327,7 @@ private Q_SLOTS:
newFiles2.push_back(oneTrack.resourceURI());
}
musicDb.insertTracksList(MusicAudioTrack::tracksToListData(newTracks), newCovers);
musicDb.insertTracksList(newTracks, newCovers);
QCOMPARE(beginInsertRowsSpy.count(), 2);
QCOMPARE(endInsertRowsSpy.count(), 2);
......@@ -378,7 +376,7 @@ private Q_SLOTS:
QCOMPARE(endRemoveRowsSpy.count(), 0);
QCOMPARE(dataChangedSpy.count(), 0);
musicDb.insertTracksList(MusicAudioTrack::tracksToListData(mNewTracks), mNewCovers);
musicDb.insertTracksList(mNewTracks, mNewCovers);
QCOMPARE(beginInsertRowsSpy.count(), 1);
QCOMPARE(endInsertRowsSpy.count(), 1);
......@@ -388,15 +386,15 @@ private Q_SLOTS:
QCOMPARE(proxyTracksModel.rowCount(), 23);
auto newTrack = MusicAudioTrack{true, QStringLiteral("$1"), QStringLiteral("0"), QStringLiteral("track1"),
auto newTrack = DataTypes::TrackDataType{true, QStringLiteral("$1"), QStringLiteral("0"), QStringLiteral("track1"),
QStringLiteral("artist1"), QStringLiteral("album1"), QStringLiteral("Various Artists"),
1, 1, QTime::fromMSecsSinceStartOfDay(1), {QUrl::fromLocalFile(QStringLiteral("/$1"))},
QDateTime::fromMSecsSinceEpoch(1),
{QUrl::fromLocalFile(QStringLiteral("file://image$1"))}, 5, true, {}, QStringLiteral("composer1"), QStringLiteral("lyricist1"), false};
auto newTracks = QList<MusicAudioTrack>();
auto newTracks = DataTypes::ListTrackDataType();
newTracks.push_back(newTrack);
musicDb.insertTracksList(MusicAudioTrack::tracksToListData(newTracks), mNewCovers);
musicDb.insertTracksList(newTracks, mNewCovers);
QCOMPARE(beginInsertRowsSpy.count(), 1);
QCOMPARE(endInsertRowsSpy.count(), 1);
......@@ -487,7 +485,7 @@ private Q_SLOTS:
QCOMPARE(endRemoveRowsSpy.count(), 0);
QCOMPARE(dataChangedSpy.count(), 0);
musicDb.insertTracksList(MusicAudioTrack::tracksToListData(mNewTracks), mNewCovers);
musicDb.insertTracksList(mNewTracks, mNewCovers);
QCOMPARE(beginInsertRowsSpy.count(), 1);
QCOMPARE(endInsertRowsSpy.count(), 1);
......@@ -497,16 +495,16 @@ private Q_SLOTS:
QCOMPARE(proxyTracksModel.rowCount(), 23);
auto newTrack = MusicAudioTrack{true, QStringLiteral("$23"), QStringLiteral("0"), QStringLiteral("track23"),
auto newTrack = DataTypes::TrackDataType{true, QStringLiteral("$23"), QStringLiteral("0"), QStringLiteral("track23"),
QStringLiteral("artist2"), QStringLiteral("album4"), QStringLiteral("artist2"), 23, 1, QTime::fromMSecsSinceStartOfDay(23),
{QUrl::fromLocalFile(QStringLiteral("/$23"))},
QDateTime::fromMSecsSinceEpoch(23),
{QUrl::fromLocalFile(QStringLiteral("file://image$23"))}, 5, true, {}, QStringLiteral("composer1"), QStringLiteral("lyricist1"), false};
auto newTracks = QList<MusicAudioTrack>();
auto newTracks = DataTypes::ListTrackDataType();
newTracks.push_back(newTrack);
musicDb.insertTracksList(MusicAudioTrack::tracksToListData(newTracks), mNewCovers);
musicDb.insertTracksList(newTracks, mNewCovers);
QCOMPARE(beginInsertRowsSpy.count(), 2);
QCOMPARE(endInsertRowsSpy.count(), 2);
......
This diff is collapsed.
......@@ -18,7 +18,7 @@
#ifndef DATABASETESTDATA_H
#define DATABASETESTDATA_H
#include "musicaudiotrack.h"
#include "datatypes.h"
#include <QList>
#include <QUrl>
......@@ -35,7 +35,7 @@ public:
protected:
QList<MusicAudioTrack> mNewTracks = {
DataTypes::ListTrackDataType mNewTracks = {
{true, QStringLiteral("$1"), QStringLiteral("0"), QStringLiteral("track1"),
QStringLiteral("artist1"), QStringLiteral("album1"), QStringLiteral("Various Artists"),
1, 1, QTime::fromMSecsSinceStartOfDay(1), {QUrl::fromLocalFile(QStringLiteral("/$1"))}, QDateTime::fromMSecsSinceEpoch(1),
......
This diff is collapsed.
......@@ -15,7 +15,6 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "musicaudiotrack.h"
#include "filescanner.h"
#include "config-upnp-qt.h"
......
......@@ -18,7 +18,6 @@
#include "databasetestdata.h"
#include "file/localfilelisting.h"
#include "musicaudiotrack.h"
#include "config-upnp-qt.h"
......@@ -57,7 +56,6 @@ private Q_SLOTS:
{
qRegisterMetaType<QHash<qulonglong,int>>("QHash<qulonglong,int>");
qRegisterMetaType<QHash<QString,QUrl>>("QHash<QString,QUrl>");
qRegisterMetaType<QList<MusicAudioTrack>>("QList<MusicAudioTrack>");
qRegisterMetaType<QVector<qlonglong>>("QVector<qlonglong>");
qRegisterMetaType<QHash<qlonglong,int>>("QHash<qlonglong,int>");
qRegisterMetaType<QList<QUrl>>("QList<QUrl>");
......@@ -415,7 +413,7 @@ private Q_SLOTS:
QCOMPARE(modifiedTracksListSpy.count(), 0);
auto newTracksSignalLast = tracksListSpy.at(1);
auto newTracksLast = newTracksSignalLast.at(0).value<QList<MusicAudioTrack>>();
auto newTracksLast = newTracksSignalLast.at(0).value<DataTypes::ListTrackDataType>();
auto newCoversLast = newTracksSignalLast.at(1).value<QHash<QString, QUrl>>();
QCOMPARE(newTracksLast.count(), 1);
......
......@@ -22,8 +22,6 @@
#include "databasetestdata.h"
#include "musicaudiotrack.h"
#include <QList>
#include <QHash>
#include <QString>
......
......@@ -20,7 +20,6 @@
#include "managemediaplayercontrol.h"
#include "mediaplaylist.h"
#include "databaseinterface.h"
#include "musicaudiotrack.h"
#include "trackslistener.h"
#include <QHash>
......
......@@ -22,8 +22,6 @@
#include "databasetestdata.h"
#include "musicaudiotrack.h"
#include <QList>
#include <QHash>
#include <QString>
......
This diff is collapsed.
......@@ -20,8 +20,6 @@
#include "databasetestdata.h"
#include "musicaudiotrack.h"
#include <QObject>
#include <QHash>
#include <QVector>
......
......@@ -82,7 +82,7 @@ private Q_SLOTS:
musicDb.init(QStringLiteral("testDb"), databaseFile.fileName());
musicDb.insertTracksList(MusicAudioTrack::tracksToListData(mNewTracks), mNewCovers);
musicDb.insertTracksList(mNewTracks, mNewCovers);
TrackMetadataModel myModel;
QAbstractItemModelTester testModel(&myModel);
......
......@@ -55,7 +55,6 @@ private Q_SLOTS:
{
qRegisterMetaType<QHash<qulonglong,int>>("QHash<qulonglong,int>");
qRegisterMetaType<QHash<QString,QUrl>>("QHash<QString,QUrl>");
qRegisterMetaType<QList<MusicAudioTrack>>("QList<MusicAudioTrack>");
qRegisterMetaType<QVector<qlonglong>>("QVector<qlonglong>");
qRegisterMetaType<QHash<qlonglong,int>>("QHash<qlonglong,int>");
qRegisterMetaType<QList<QUrl>>("QList<QUrl>");
......@@ -95,7 +94,7 @@ private Q_SLOTS:
QCOMPARE(trackHasBeenRemovedSpy.count(), 0);
QCOMPARE(tracksListAddedSpy.count(), 0);
myDatabaseContent.insertTracksList(MusicAudioTrack::tracksToListData(mNewTracks), mNewCovers);
myDatabaseContent.insertTracksList(mNewTracks, mNewCovers);
QCOMPARE(trackHasChangedSpy.count(), 0);
QCOMPARE(trackHasBeenRemovedSpy.count(), 0);
......@@ -217,7 +216,7 @@ private Q_SLOTS:
QCOMPARE(trackHasBeenRemovedSpy.count(), 0);
QCOMPARE(tracksListAddedSpy.count(), 0);
myDatabaseContent.insertTracksList(MusicAudioTrack::tracksToListData(mNewTracks), mNewCovers);
myDatabaseContent.insertTracksList(mNewTracks, mNewCovers);
QCOMPARE(trackHasChangedSpy.count(), 0);
QCOMPARE(trackHasBeenRemovedSpy.count(), 0);
......@@ -284,7 +283,7 @@ private Q_SLOTS:
QCOMPARE(trackHasBeenRemovedSpy.count(), 0);
QCOMPARE(tracksListAddedSpy.count(), 0);
myDatabaseContent.insertTracksList(MusicAudioTrack::tracksToListData(mNewTracks), mNewCovers);
myDatabaseContent.insertTracksList(mNewTracks, mNewCovers);
QCOMPARE(trackHasChangedSpy.count(), 0);
QCOMPARE(trackHasBeenRemovedSpy.count(), 0);
......@@ -363,7 +362,7 @@ private Q_SLOTS:
QCOMPARE(myPlayList.data(myPlayList.index(0, 0), MediaPlayList::ColumnsRoles::TrackNumberRole).toInt(), -1);
QCOMPARE(myPlayList.data(myPlayList.index(0, 0), MediaPlayList::ColumnsRoles::DiscNumberRole).toInt(), 0);
myDatabaseContent.insertTracksList(MusicAudioTrack::tracksToListData(mNewTracks), mNewCovers);
myDatabaseContent.insertTracksList(mNewTracks, mNewCovers);
QCOMPARE(trackHasChangedSpy.count(), 1);
QCOMPARE(trackHasBeenRemovedSpy.count(), 0);
......@@ -417,7 +416,7 @@ private Q_SLOTS:
QCOMPARE(trackHasBeenRemovedSpy.count(), 0);
QCOMPARE(tracksListAddedSpy.count(), 0);
myDatabaseContent.insertTracksList(MusicAudioTrack::tracksToListData(mNewTracks), mNewCovers);
myDatabaseContent.insertTracksList(mNewTracks, mNewCovers);
QCOMPARE(trackHasChangedSpy.count(), 0);
QCOMPARE(trackHasBeenRemovedSpy.count(), 0);
......@@ -440,14 +439,14 @@ private Q_SLOTS:
QCOMPARE(myPlayList.data(myPlayList.index(0, 0), MediaPlayList::ColumnsRoles::TrackNumberRole).toInt(), 1);
QCOMPARE(myPlayList.data(myPlayList.index(0, 0), MediaPlayList::ColumnsRoles::DiscNumberRole).toInt(), 1);
myDatabaseContent.insertTracksList(MusicAudioTrack::tracksToListData({
myDatabaseContent.insertTracksList({
{true, QStringLiteral("$1"), QStringLiteral("0"), QStringLiteral("track1"),
QStringLiteral("artist1"), QStringLiteral("album1"), QStringLiteral("Various Artists"),
2, 3, QTime::fromMSecsSinceStartOfDay(1000), {QUrl::fromLocalFile(QStringLiteral("/$1"))},
QDateTime::fromMSecsSinceEpoch(1),
{QUrl::fromLocalFile(QStringLiteral("file://image$1"))}, 1, false,
{}, {}, QStringLiteral("lyricist1"), false}
}), mNewCovers);
}, mNewCovers);
QCOMPARE(trackHasChangedSpy.count(), 2);
QCOMPARE(trackHasBeenRemovedSpy.count(), 0);
......
......@@ -62,6 +62,7 @@ public:
SampleRateRole,
ResourceRole,
IdRole,
ParentIdRole,
DatabaseIdRole,
IsSingleDiscAlbumRole,
ContainerDataRole,
......@@ -91,6 +92,23 @@ public:
using DataType::DataType;
TrackDataType(bool aValid, QString aId, QString aParentId, QString aTitle, QString aArtist, QString aAlbumName,
QString aAlbumArtist, int aTrackNumber, int aDiscNumber, QTime aDuration, QUrl aResourceURI,
const QDateTime &fileModificationTime, QUrl aAlbumCover, int rating, bool aIsSingleDiscAlbum,
QString aGenre, QString aComposer, QString aLyricist, bool aHasEmbeddedCover)
: DataType({{key_type::TitleRole, aTitle}, {key_type::AlbumRole, aAlbumName},
{key_type::ArtistRole, aArtist}, {key_type::AlbumArtistRole, aAlbumArtist},
{key_type::IdRole, aId}, {key_type::ParentIdRole, aParentId},
{key_type::TrackNumberRole, aTrackNumber}, {key_type::DiscNumberRole, aDiscNumber},
{key_type::DurationRole, aDuration}, {key_type::ResourceRole, aResourceURI},
{key_type::FileModificationTime, fileModificationTime}, {key_type::ImageUrlRole, aAlbumCover},
{key_type::RatingRole, rating}, {key_type::IsSingleDiscAlbumRole, aIsSingleDiscAlbum},
{key_type::GenreRole, aGenre}, {key_type::ComposerRole, aComposer},
{key_type::LyricistRole, aLyricist}, {key_type::HasEmbeddedCover, aHasEmbeddedCover},})
{
Q_UNUSED(aValid)
}
bool isValid() const
{
return !isEmpty() && duration().isValid();
......
......@@ -17,8 +17,6 @@
#include "localfilelisting.h"
#include "musicaudiotrack.h"
#include "abstractfile/indexercommon.h"
#include <QThread>
......
......@@ -19,7 +19,6 @@
#include "playListLogging.h"
#include "datatypes.h"
#include "musicaudiotrack.h"
#include "musiclistenersmanager.h"
#include <QUrl>
......
......@@ -20,7 +20,6 @@
#include "elisaLib_export.h"
#include "musicaudiotrack.h"
#include "elisautils.h"
#include "datatypes.h"
......@@ -30,6 +29,7 @@
#include <utility>
#include <tuple>
#include <memory>
class MediaPlayListPrivate;
class MusicListenersManager;
......@@ -113,6 +113,7 @@ public:
SampleRateRole,
ResourceRole,
IdRole,
ParentIdRole,
DatabaseIdRole,
IsSingleDiscAlbumRole,
ContainerDataRole,
......@@ -363,11 +364,6 @@ public:
mTrackNumber(trackNumber), mDiscNumber(discNumber), mId(id), mEntryType(entryType) {
}
explicit MediaPlayListEntry(const MusicAudioTrack &track)
: mTitle(track.title()), mAlbum(track.albumName()), mTrackNumber(track.trackNumber()),
mDiscNumber(track.discNumber()), mId(track.databaseId()), mIsValid(true) {
}
explicit MediaPlayListEntry(const MediaPlayList::TrackDataType &track)
: mTitle(track[DataTypes::TitleRole]),
mAlbum(track[DataTypes::AlbumRole]),
......
......@@ -22,7 +22,6 @@
#include "elisaLib_export.h"
#include "abstractmediaproxymodel.h"
#include "musicaudiotrack.h"
#include "elisautils.h"
class ELISALIB_EXPORT AllTracksProxyModel : public AbstractMediaProxyModel
......
......@@ -21,7 +21,6 @@
#include "elisaLib_export.h"
#include "musicaudiotrack.h"
#include "filescanner.h"
#include "elisautils.h"
......
......@@ -22,7 +22,6 @@
#include "elisaLib_export.h"
#include "abstractmediaproxymodel.h"
#include "musicaudiotrack.h"
#include "elisautils.h"
class ELISALIB_EXPORT SingleAlbumProxyModel : public AbstractMediaProxyModel
......
......@@ -174,6 +174,7 @@ QVariant TrackMetadataModel::data(const QModelIndex &index, int role) const
case DataTypes::AllArtistsRole:
case DataTypes::HighestTrackRating:
case DataTypes::IdRole:
case DataTypes::ParentIdRole:
case DataTypes::DatabaseIdRole:
case DataTypes::IsSingleDiscAlbumRole:
case DataTypes::ContainerDataRole:
......@@ -251,6 +252,7 @@ QVariant TrackMetadataModel::data(const QModelIndex &index, int role) const
case DataTypes::AllArtistsRole:
case DataTypes::HighestTrackRating:
case DataTypes::IdRole:
case DataTypes::ParentIdRole:
case DataTypes::DatabaseIdRole:
case DataTypes::IsSingleDiscAlbumRole:
case DataTypes::ContainerDataRole:
......
This diff is collapsed.
/*
* Copyright 2016-2017 Matthieu Gallien <matthieu_gallien@yahoo.fr>
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef MUSICAUDIOTRACK_H
#define MUSICAUDIOTRACK_H
#include "elisaLib_export.h"
#include "datatypes.h"
#include <QString>
#include <QTime>
#include <QUrl>
#include <QMetaType>
#include <QSharedDataPointer>
#include <memory>
class MusicAudioTrackPrivate;
class QDebug;
class ELISALIB_EXPORT MusicAudioTrack
{
public:
using TrackDataType = DataTypes::TrackDataType;
MusicAudioTrack();
MusicAudioTrack(bool aValid, QString aId, QString aParentId, QString aTitle, QString aArtist, QString aAlbumName,
QString aAlbumArtist, int aTrackNumber, int aDiscNumber, QTime aDuration, QUrl aResourceURI,
const QDateTime &fileModificationTime, QUrl aAlbumCover, int rating, bool aIsSingleDiscAlbum,
QString aGenre, QString aComposer, QString aLyricist, bool aHasEmbeddedCover);
MusicAudioTrack(MusicAudioTrack &&other) noexcept;
MusicAudioTrack(const MusicAudioTrack &other);
~MusicAudioTrack();
MusicAudioTrack& operator=(MusicAudioTrack &&other) noexcept;
MusicAudioTrack& operator=(const MusicAudioTrack &other);
bool operator <(const MusicAudioTrack &other) const;
bool operator ==(const MusicAudioTrack &other) const;
bool operator !=(const MusicAudioTrack &other) const;
static MusicAudioTrack trackFromData(const DataTypes::TrackDataType &data);
static QList<MusicAudioTrack> trackFromListData(const DataTypes::ListTrackDataType &list);
static DataTypes::ListTrackDataType tracksToListData(const QList<MusicAudioTrack> &list);
void setValid(bool value);
bool isValid() const;
void setDatabaseId(qulonglong value);
qulonglong databaseId() const;
void setAlbumId(qulonglong value);
qulonglong albumId() const;
void setId(const QString &value);
QString id() const;
void setParentId(const QString &value);
QString parentId() const;
void setTitle(const QString &value);
QString title() const;
void setArtist(const QString &value);
QString artist() const;
void setAlbumName(const QString &value);
QString albumName() const;
void setAlbumArtist(const QString &value);
QString albumArtist() const;
void setGenre(const QString &value);
QString genre() const;
void setComposer(const QString &value);
QString composer() const;
void setLyricist(const QString &value);
QString lyricist() const;
void setLyrics(const QString &value);
QString lyrics() const;
void setComment(const QString &value);
QString comment() const;
bool isValidAlbumArtist() const;
void setAlbumCover(const QUrl &value);
QUrl albumCover() const;
void setTrackNumber(int value);
int trackNumber() const;
bool trackNumberIsValid() const;
void setDiscNumber(int value);
int discNumber() const;
bool discNumberIsValid() const;
void setYear(int value);
int year() const;
void setChannels(int value);
int channels() const;
bool channelsIsValid() const;
void setBitRate(int value);
int bitRate() const;
bool bitRateIsValid() const;
void setSampleRate(int value);