Commit cc176b06 authored by Matthieu Gallien's avatar Matthieu Gallien 🎵
Browse files

move EntryData and EntryDataList from ElisaUtils to DataTypes

parent c5606f6d
......@@ -38,7 +38,7 @@ private Q_SLOTS:
qRegisterMetaType<QVector<qlonglong>>("QVector<qlonglong>");
qRegisterMetaType<QHash<qlonglong,int>>("QHash<qlonglong,int>");
qRegisterMetaType<QList<QUrl>>("QList<QUrl>");
qRegisterMetaType<ElisaUtils::EntryDataList>("ElisaUtils::EntryDataList");
qRegisterMetaType<DataTypes::EntryDataList>("DataTypes::EntryDataList");
qRegisterMetaType<ElisaUtils::PlayListEntryType>("ElisaUtils::PlayListEntryType");
qRegisterMetaType<ElisaUtils::PlayListEnqueueMode>("ElisaUtils::PlayListEnqueueMode");
qRegisterMetaType<ElisaUtils::PlayListEnqueueTriggerPlay>("ElisaUtils::PlayListEnqueueTriggerPlay");
......@@ -81,7 +81,7 @@ private Q_SLOTS:
QCOMPARE(enqueueSpy.count(), 1);
QCOMPARE(enqueueSpy.at(0).count(), 4);
QCOMPARE(std::get<2>(enqueueSpy.at(0).at(0).value<ElisaUtils::EntryDataList>().at(0)), QUrl::fromLocalFile(myTestFile.canonicalFilePath()));
QCOMPARE(std::get<2>(enqueueSpy.at(0).at(0).value<DataTypes::EntryDataList>().at(0)), QUrl::fromLocalFile(myTestFile.canonicalFilePath()));
}
};
......
......@@ -8,6 +8,7 @@
#include "mediaplaylistproxymodeltest.h"
#include "mediaplaylisttestconfig.h"
#include "datatypes.h"
#include "mediaplaylist.h"
#include "mediaplaylistproxymodel.h"
#include "databaseinterface.h"
......@@ -3511,7 +3512,7 @@ void MediaPlayListProxyModelTest::testRemoveSelection()
QCOMPARE(newTrackByNameInListSpy.count(), 0);
QCOMPARE(newEntryInListSpy.count(), 0);
myPlayListProxyModel.enqueue(ElisaUtils::EntryData{{}, QStringLiteral("artist1"), {}}, ElisaUtils::Artist, ElisaUtils::PlayListEnqueueMode::ReplacePlayList, ElisaUtils::PlayListEnqueueTriggerPlay::TriggerPlay);
myPlayListProxyModel.enqueue(DataTypes::EntryData{{}, QStringLiteral("artist1"), {}}, ElisaUtils::Artist, ElisaUtils::PlayListEnqueueMode::ReplacePlayList, ElisaUtils::PlayListEnqueueTriggerPlay::TriggerPlay);
QCOMPARE(rowsAboutToBeRemovedSpy.count(), 0);
QCOMPARE(rowsAboutToBeMovedSpy.count(), 0);
......@@ -3686,7 +3687,7 @@ void MediaPlayListProxyModelTest::testReplaceAndPlayArtist()
QCOMPARE(newTrackByNameInListSpy.count(), 0);
QCOMPARE(newEntryInListSpy.count(), 0);
myPlayListProxyModel.enqueue(ElisaUtils::EntryData{{}, QStringLiteral("artist3"), {}}, ElisaUtils::Artist, ElisaUtils::PlayListEnqueueMode::ReplacePlayList, ElisaUtils::PlayListEnqueueTriggerPlay::TriggerPlay);
myPlayListProxyModel.enqueue(DataTypes::EntryData{{}, QStringLiteral("artist3"), {}}, ElisaUtils::Artist, ElisaUtils::PlayListEnqueueMode::ReplacePlayList, ElisaUtils::PlayListEnqueueTriggerPlay::TriggerPlay);
QCOMPARE(rowsAboutToBeRemovedSpy.count(), 0);
QCOMPARE(rowsAboutToBeMovedSpy.count(), 0);
......@@ -3727,7 +3728,7 @@ void MediaPlayListProxyModelTest::testReplaceAndPlayArtist()
QCOMPARE(myPlayListProxyModel.data(myPlayListProxyModel.index(0, 0), MediaPlayList::ColumnsRoles::IsPlayingRole).toBool(), false);
QCOMPARE(myPlayListProxyModel.data(myPlayListProxyModel.index(0, 0), MediaPlayList::ColumnsRoles::IsSingleDiscAlbumRole).toBool(), false);
myPlayListProxyModel.enqueue(ElisaUtils::EntryData{{}, QStringLiteral("artist4"), {}}, ElisaUtils::Artist, ElisaUtils::PlayListEnqueueMode::ReplacePlayList, ElisaUtils::PlayListEnqueueTriggerPlay::TriggerPlay);
myPlayListProxyModel.enqueue(DataTypes::EntryData{{}, QStringLiteral("artist4"), {}}, ElisaUtils::Artist, ElisaUtils::PlayListEnqueueMode::ReplacePlayList, ElisaUtils::PlayListEnqueueTriggerPlay::TriggerPlay);
QCOMPARE(rowsAboutToBeRemovedSpy.count(), 2);
QCOMPARE(rowsAboutToBeMovedSpy.count(), 0);
......@@ -3840,7 +3841,7 @@ void MediaPlayListProxyModelTest::testReplaceAndPlayTrackId()
QCOMPARE(firstTrackId != 0, true);
myPlayListProxyModel.enqueue(ElisaUtils::EntryData{{{DataTypes::DatabaseIdRole, firstTrackId}}, {}, {}}, ElisaUtils::Track, ElisaUtils::PlayListEnqueueMode::ReplacePlayList, ElisaUtils::PlayListEnqueueTriggerPlay::TriggerPlay);
myPlayListProxyModel.enqueue(DataTypes::EntryData{{{DataTypes::DatabaseIdRole, firstTrackId}}, {}, {}}, ElisaUtils::Track, ElisaUtils::PlayListEnqueueMode::ReplacePlayList, ElisaUtils::PlayListEnqueueTriggerPlay::TriggerPlay);
QCOMPARE(rowsAboutToBeRemovedSpy.count(), 0);
QCOMPARE(rowsAboutToBeMovedSpy.count(), 0);
......@@ -3886,7 +3887,7 @@ void MediaPlayListProxyModelTest::testReplaceAndPlayTrackId()
QCOMPARE(secondTrackId != 0, true);
myPlayListProxyModel.enqueue(ElisaUtils::EntryData{{{DataTypes::DatabaseIdRole, secondTrackId}}, {}, {}}, ElisaUtils::Track, ElisaUtils::PlayListEnqueueMode::ReplacePlayList, ElisaUtils::PlayListEnqueueTriggerPlay::TriggerPlay);
myPlayListProxyModel.enqueue(DataTypes::EntryData{{{DataTypes::DatabaseIdRole, secondTrackId}}, {}, {}}, ElisaUtils::Track, ElisaUtils::PlayListEnqueueMode::ReplacePlayList, ElisaUtils::PlayListEnqueueTriggerPlay::TriggerPlay);
QCOMPARE(rowsAboutToBeRemovedSpy.count(), 1);
QCOMPARE(rowsAboutToBeMovedSpy.count(), 0);
......@@ -3994,7 +3995,7 @@ void MediaPlayListProxyModelTest::testTrackBeenRemoved()
QCOMPARE(newTrackByNameInListSpy.count(), 0);
QCOMPARE(newEntryInListSpy.count(), 0);
myPlayListProxyModel.enqueue(ElisaUtils::EntryData{{}, QStringLiteral("artist1"), {}}, ElisaUtils::Artist, ElisaUtils::PlayListEnqueueMode::ReplacePlayList, ElisaUtils::PlayListEnqueueTriggerPlay::TriggerPlay);
myPlayListProxyModel.enqueue(DataTypes::EntryData{{}, QStringLiteral("artist1"), {}}, ElisaUtils::Artist, ElisaUtils::PlayListEnqueueMode::ReplacePlayList, ElisaUtils::PlayListEnqueueTriggerPlay::TriggerPlay);
QCOMPARE(rowsAboutToBeRemovedSpy.count(), 0);
QCOMPARE(rowsAboutToBeMovedSpy.count(), 0);
......@@ -4832,7 +4833,7 @@ void MediaPlayListProxyModelTest::testSetData()
auto firstTrackId = myDatabaseContent.trackIdFromTitleAlbumTrackDiscNumber(QStringLiteral("track1"), QStringLiteral("artist2"),
QStringLiteral("album3"), 1, 1);
myPlayListProxyModel.enqueue(ElisaUtils::EntryData{{{DataTypes::DatabaseIdRole, firstTrackId}}, {}, {}}, ElisaUtils::Track);
myPlayListProxyModel.enqueue(DataTypes::EntryData{{{DataTypes::DatabaseIdRole, firstTrackId}}, {}, {}}, ElisaUtils::Track);
QCOMPARE(rowsAboutToBeRemovedSpy.count(), 0);
QCOMPARE(rowsAboutToBeMovedSpy.count(), 0);
......@@ -4862,7 +4863,7 @@ void MediaPlayListProxyModelTest::testSetData()
auto secondTrackId = myDatabaseContent.trackIdFromTitleAlbumTrackDiscNumber(QStringLiteral("track1"), QStringLiteral("artist1"),
QStringLiteral("album1"), 1, 1);
myPlayListProxyModel.enqueue(ElisaUtils::EntryData{{{DataTypes::DatabaseIdRole, secondTrackId}}, {}, {}}, ElisaUtils::Track);
myPlayListProxyModel.enqueue(DataTypes::EntryData{{{DataTypes::DatabaseIdRole, secondTrackId}}, {}, {}}, ElisaUtils::Track);
QCOMPARE(rowsAboutToBeRemovedSpy.count(), 0);
QCOMPARE(rowsAboutToBeMovedSpy.count(), 0);
......@@ -4893,7 +4894,7 @@ void MediaPlayListProxyModelTest::testSetData()
auto thirdTrackId = myDatabaseContent.trackIdFromTitleAlbumTrackDiscNumber(QStringLiteral("track2"), QStringLiteral("artist2"),
QStringLiteral("album3"), 2, 1);
myPlayListProxyModel.enqueue(ElisaUtils::EntryData{{{DataTypes::DatabaseIdRole, thirdTrackId}}, {}, {}}, ElisaUtils::Track);
myPlayListProxyModel.enqueue(DataTypes::EntryData{{{DataTypes::DatabaseIdRole, thirdTrackId}}, {}, {}}, ElisaUtils::Track);
QCOMPARE(rowsAboutToBeRemovedSpy.count(), 0);
QCOMPARE(rowsAboutToBeMovedSpy.count(), 0);
......@@ -6866,7 +6867,7 @@ void MediaPlayListProxyModelTest::enqueueEmpty()
QCOMPARE(newTrackByNameInListSpy.count(), 0);
QCOMPARE(newEntryInListSpy.count(), 0);
myPlayListProxyModel.enqueue(ElisaUtils::EntryDataList{}, ElisaUtils::Track);
myPlayListProxyModel.enqueue(DataTypes::EntryDataList{}, ElisaUtils::Track);
QCOMPARE(rowsAboutToBeRemovedSpy.count(), 0);
QCOMPARE(rowsAboutToBeMovedSpy.count(), 0);
......@@ -6879,7 +6880,7 @@ void MediaPlayListProxyModelTest::enqueueEmpty()
QCOMPARE(newTrackByNameInListSpy.count(), 0);
QCOMPARE(newEntryInListSpy.count(), 0);
myPlayListProxyModel.enqueue(ElisaUtils::EntryDataList{}, ElisaUtils::FileName);
myPlayListProxyModel.enqueue(DataTypes::EntryDataList{}, ElisaUtils::FileName);
QCOMPARE(rowsAboutToBeRemovedSpy.count(), 0);
QCOMPARE(rowsAboutToBeMovedSpy.count(), 0);
......@@ -6892,7 +6893,7 @@ void MediaPlayListProxyModelTest::enqueueEmpty()
QCOMPARE(newTrackByNameInListSpy.count(), 0);
QCOMPARE(newEntryInListSpy.count(), 0);
myPlayListProxyModel.enqueue(ElisaUtils::EntryDataList{}, ElisaUtils::Track, ElisaUtils::AppendPlayList, ElisaUtils::DoNotTriggerPlay);
myPlayListProxyModel.enqueue(DataTypes::EntryDataList{}, ElisaUtils::Track, ElisaUtils::AppendPlayList, ElisaUtils::DoNotTriggerPlay);
QCOMPARE(rowsAboutToBeRemovedSpy.count(), 0);
QCOMPARE(rowsAboutToBeMovedSpy.count(), 0);
......@@ -6905,7 +6906,7 @@ void MediaPlayListProxyModelTest::enqueueEmpty()
QCOMPARE(newTrackByNameInListSpy.count(), 0);
QCOMPARE(newEntryInListSpy.count(), 0);
myPlayListProxyModel.enqueue(ElisaUtils::EntryDataList{}, ElisaUtils::Album, ElisaUtils::AppendPlayList, ElisaUtils::DoNotTriggerPlay);
myPlayListProxyModel.enqueue(DataTypes::EntryDataList{}, ElisaUtils::Album, ElisaUtils::AppendPlayList, ElisaUtils::DoNotTriggerPlay);
QCOMPARE(rowsAboutToBeRemovedSpy.count(), 0);
QCOMPARE(rowsAboutToBeMovedSpy.count(), 0);
......@@ -6918,7 +6919,7 @@ void MediaPlayListProxyModelTest::enqueueEmpty()
QCOMPARE(newTrackByNameInListSpy.count(), 0);
QCOMPARE(newEntryInListSpy.count(), 0);
myPlayListProxyModel.enqueue(ElisaUtils::EntryDataList{},
myPlayListProxyModel.enqueue(DataTypes::EntryDataList{},
ElisaUtils::Artist,
ElisaUtils::AppendPlayList,
ElisaUtils::DoNotTriggerPlay);
......
......@@ -843,7 +843,7 @@ void MediaPlayListTest::enqueueEmpty()
QCOMPARE(newTrackByNameInListSpy.count(), 0);
QCOMPARE(newEntryInListSpy.count(), 0);
myPlayList.enqueueOneEntry(ElisaUtils::EntryData{}, ElisaUtils::Track);
myPlayList.enqueueOneEntry(DataTypes::EntryData{}, ElisaUtils::Track);
QCOMPARE(rowsAboutToBeRemovedSpy.count(), 0);
QCOMPARE(rowsAboutToBeMovedSpy.count(), 0);
......@@ -855,7 +855,7 @@ void MediaPlayListTest::enqueueEmpty()
QCOMPARE(newTrackByNameInListSpy.count(), 0);
QCOMPARE(newEntryInListSpy.count(), 0);
myPlayList.enqueueOneEntry(ElisaUtils::EntryData{}, ElisaUtils::FileName);
myPlayList.enqueueOneEntry(DataTypes::EntryData{}, ElisaUtils::FileName);
QCOMPARE(rowsAboutToBeRemovedSpy.count(), 0);
QCOMPARE(rowsAboutToBeMovedSpy.count(), 0);
......@@ -867,7 +867,7 @@ void MediaPlayListTest::enqueueEmpty()
QCOMPARE(newTrackByNameInListSpy.count(), 0);
QCOMPARE(newEntryInListSpy.count(), 0);
myPlayList.enqueueOneEntry(ElisaUtils::EntryData{}, ElisaUtils::Track);
myPlayList.enqueueOneEntry(DataTypes::EntryData{}, ElisaUtils::Track);
QCOMPARE(rowsAboutToBeRemovedSpy.count(), 0);
QCOMPARE(rowsAboutToBeMovedSpy.count(), 0);
......@@ -879,7 +879,7 @@ void MediaPlayListTest::enqueueEmpty()
QCOMPARE(newTrackByNameInListSpy.count(), 0);
QCOMPARE(newEntryInListSpy.count(), 0);
myPlayList.enqueueOneEntry(ElisaUtils::EntryData{}, ElisaUtils::Album);
myPlayList.enqueueOneEntry(DataTypes::EntryData{}, ElisaUtils::Album);
QCOMPARE(rowsAboutToBeRemovedSpy.count(), 0);
QCOMPARE(rowsAboutToBeMovedSpy.count(), 0);
......@@ -891,7 +891,7 @@ void MediaPlayListTest::enqueueEmpty()
QCOMPARE(newTrackByNameInListSpy.count(), 0);
QCOMPARE(newEntryInListSpy.count(), 0);
myPlayList.enqueueOneEntry(ElisaUtils::EntryData{}, ElisaUtils::Artist);
myPlayList.enqueueOneEntry(DataTypes::EntryData{}, ElisaUtils::Artist);
QCOMPARE(rowsAboutToBeRemovedSpy.count(), 0);
QCOMPARE(rowsAboutToBeMovedSpy.count(), 0);
......@@ -1053,7 +1053,7 @@ void MediaPlayListTest::testTrackBeenRemoved()
QCOMPARE(newTrackByNameInListSpy.count(), 0);
QCOMPARE(newEntryInListSpy.count(), 0);
myPlayList.enqueueOneEntry(ElisaUtils::EntryData{{}, QStringLiteral("artist1"), {}}, ElisaUtils::Artist);
myPlayList.enqueueOneEntry(DataTypes::EntryData{{}, QStringLiteral("artist1"), {}}, ElisaUtils::Artist);
QCOMPARE(rowsAboutToBeRemovedSpy.count(), 0);
QCOMPARE(rowsAboutToBeMovedSpy.count(), 0);
......@@ -1251,7 +1251,7 @@ void MediaPlayListTest::testSetData()
auto firstTrackId = myDatabaseContent.trackIdFromTitleAlbumTrackDiscNumber(QStringLiteral("track1"), QStringLiteral("artist2"),
QStringLiteral("album3"), 1, 1);
myPlayList.enqueueOneEntry(ElisaUtils::EntryData{{{DataTypes::DatabaseIdRole, firstTrackId}}, {}, {}}, ElisaUtils::Track);
myPlayList.enqueueOneEntry(DataTypes::EntryData{{{DataTypes::DatabaseIdRole, firstTrackId}}, {}, {}}, ElisaUtils::Track);
QCOMPARE(rowsAboutToBeRemovedSpy.count(), 0);
QCOMPARE(rowsAboutToBeMovedSpy.count(), 0);
......@@ -1279,7 +1279,7 @@ void MediaPlayListTest::testSetData()
auto secondTrackId = myDatabaseContent.trackIdFromTitleAlbumTrackDiscNumber(QStringLiteral("track1"), QStringLiteral("artist1"),
QStringLiteral("album1"), 1, 1);
myPlayList.enqueueOneEntry(ElisaUtils::EntryData{{{DataTypes::DatabaseIdRole, secondTrackId}}, {}, {}}, ElisaUtils::Track);
myPlayList.enqueueOneEntry(DataTypes::EntryData{{{DataTypes::DatabaseIdRole, secondTrackId}}, {}, {}}, ElisaUtils::Track);
QCOMPARE(rowsAboutToBeRemovedSpy.count(), 0);
QCOMPARE(rowsAboutToBeMovedSpy.count(), 0);
......@@ -1308,7 +1308,7 @@ void MediaPlayListTest::testSetData()
auto thirdTrackId = myDatabaseContent.trackIdFromTitleAlbumTrackDiscNumber(QStringLiteral("track2"), QStringLiteral("artist2"),
QStringLiteral("album3"), 2, 1);
myPlayList.enqueueOneEntry(ElisaUtils::EntryData{{{DataTypes::DatabaseIdRole, thirdTrackId}}, {}, {}}, ElisaUtils::Track);
myPlayList.enqueueOneEntry(DataTypes::EntryData{{{DataTypes::DatabaseIdRole, thirdTrackId}}, {}, {}}, ElisaUtils::Track);
QCOMPARE(rowsAboutToBeRemovedSpy.count(), 0);
QCOMPARE(rowsAboutToBeMovedSpy.count(), 0);
......
......@@ -85,7 +85,7 @@ private Q_SLOTS:
QCOMPARE(trackHasBeenRemovedSpy.count(), 0);
QCOMPARE(tracksListAddedSpy.count(), 0);
myPlayList.enqueueOneEntry(ElisaUtils::EntryData{{}, QStringLiteral("artist1"), {}}, ElisaUtils::Artist);
myPlayList.enqueueOneEntry(DataTypes::EntryData{{}, QStringLiteral("artist1"), {}}, ElisaUtils::Artist);
QCOMPARE(trackHasChangedSpy.count(), 0);
QCOMPARE(trackHasBeenRemovedSpy.count(), 0);
......@@ -212,7 +212,7 @@ private Q_SLOTS:
QCOMPARE(trackId != 0, true);
myPlayList.enqueueOneEntry(ElisaUtils::EntryData{{{DataTypes::DatabaseIdRole, trackId}}, {}, {}}, ElisaUtils::Track);
myPlayList.enqueueOneEntry(DataTypes::EntryData{{{DataTypes::DatabaseIdRole, trackId}}, {}, {}}, ElisaUtils::Track);
QCOMPARE(trackHasChangedSpy.count(), 1);
QCOMPARE(trackHasBeenRemovedSpy.count(), 0);
......@@ -275,8 +275,8 @@ private Q_SLOTS:
QCOMPARE(tracksListAddedSpy.count(), 0);
myPlayList.enqueueOneEntry({{{DataTypes::DatabaseIdRole, myDatabaseContent.trackIdFromTitleAlbumTrackDiscNumber(QStringLiteral("track1"), QStringLiteral("artist1"), QStringLiteral("album1"), 1, 1)}},
QStringLiteral("track1"), {}},
ElisaUtils::Track);
QStringLiteral("track1"), {}},
ElisaUtils::Track);
QCOMPARE(trackHasChangedSpy.count(), 1);
QCOMPARE(trackHasBeenRemovedSpy.count(), 0);
......@@ -408,8 +408,8 @@ private Q_SLOTS:
QCOMPARE(tracksListAddedSpy.count(), 0);
myPlayList.enqueueOneEntry({{{DataTypes::DatabaseIdRole, myDatabaseContent.trackIdFromTitleAlbumTrackDiscNumber(QStringLiteral("track1"), QStringLiteral("artist1"), QStringLiteral("album1"), 1, 1)}},
QStringLiteral("track1"), {}},
ElisaUtils::Track);
QStringLiteral("track1"), {}},
ElisaUtils::Track);
QCOMPARE(trackHasChangedSpy.count(), 1);
QCOMPARE(trackHasBeenRemovedSpy.count(), 0);
......
......@@ -356,6 +356,9 @@ public:
using ListGenreDataType = QList<GenreDataType>;
using EntryData = std::tuple<TrackDataType, QString, QUrl>;
using EntryDataList = QList<EntryData>;
};
Q_DECLARE_METATYPE(DataTypes::TrackDataType)
......@@ -368,4 +371,7 @@ Q_DECLARE_METATYPE(DataTypes::ListAlbumDataType)
Q_DECLARE_METATYPE(DataTypes::ListArtistDataType)
Q_DECLARE_METATYPE(DataTypes::ListGenreDataType)
Q_DECLARE_METATYPE(DataTypes::EntryData)
Q_DECLARE_METATYPE(DataTypes::EntryDataList)
#endif // DATATYPES_H
......@@ -74,7 +74,7 @@ public:
KActionCollection mCollection;
#endif
ElisaUtils::EntryDataList mArguments;
DataTypes::EntryDataList mArguments;
std::unique_ptr<MusicListenersManager> mMusicManager;
......@@ -179,7 +179,7 @@ void ElisaApplication::setupActions(const QString &actionName)
#endif
}
void ElisaApplication::setArguments(const ElisaUtils::EntryDataList &newArguments)
void ElisaApplication::setArguments(const DataTypes::EntryDataList &newArguments)
{
if (d->mArguments == newArguments) {
return;
......@@ -204,7 +204,7 @@ void ElisaApplication::activateActionRequested(const QString &actionName, const
void ElisaApplication::activateRequested(const QStringList &arguments, const QString &workingDirectory)
{
if (arguments.size() > 1) {
auto realArguments = ElisaUtils::EntryDataList{};
auto realArguments = DataTypes::EntryDataList{};
bool isFirst = true;
for (const auto &oneArgument : arguments) {
......@@ -213,7 +213,7 @@ void ElisaApplication::activateRequested(const QStringList &arguments, const QSt
continue;
}
realArguments.push_back(ElisaUtils::EntryData{{}, {}, QUrl(oneArgument)});
realArguments.push_back(DataTypes::EntryData{{}, {}, QUrl(oneArgument)});
}
Q_EMIT enqueue(checkFileListAndMakeAbsolute(realArguments, workingDirectory),
......@@ -302,10 +302,10 @@ void ElisaApplication::configChanged()
Q_EMIT showSystemTrayIconChanged();
}
ElisaUtils::EntryDataList ElisaApplication::checkFileListAndMakeAbsolute(const ElisaUtils::EntryDataList &filesList,
DataTypes::EntryDataList ElisaApplication::checkFileListAndMakeAbsolute(const DataTypes::EntryDataList &filesList,
const QString &workingDirectory) const
{
auto filesToOpen = ElisaUtils::EntryDataList{};
auto filesToOpen = DataTypes::EntryDataList{};
for (const auto &oneFile : filesList) {
if (std::get<2>(oneFile).scheme().isEmpty() || std::get<2>(oneFile).isLocalFile()) {
......@@ -323,10 +323,10 @@ ElisaUtils::EntryDataList ElisaApplication::checkFileListAndMakeAbsolute(const E
}
if (newFile.exists()) {
filesToOpen.push_back(ElisaUtils::EntryData{{}, {}, QUrl::fromLocalFile(newFile.canonicalFilePath())});
filesToOpen.push_back(DataTypes::EntryData{{}, {}, QUrl::fromLocalFile(newFile.canonicalFilePath())});
}
} else {
filesToOpen.push_back(ElisaUtils::EntryData{{}, {}, std::get<2>(oneFile)});
filesToOpen.push_back(DataTypes::EntryData{{}, {}, std::get<2>(oneFile)});
}
}
......@@ -362,10 +362,10 @@ void ElisaApplication::initializeModels()
d->mMusicManager->setElisaApplication(this);
QObject::connect(this, &ElisaApplication::enqueue,
d->mMediaPlayListProxyModel.get(), static_cast<void (MediaPlayListProxyModel::*)(const ElisaUtils::EntryDataList&,
ElisaUtils::PlayListEntryType,
ElisaUtils::PlayListEnqueueMode,
ElisaUtils::PlayListEnqueueTriggerPlay)>(&MediaPlayListProxyModel::enqueue));
d->mMediaPlayListProxyModel.get(), static_cast<void (MediaPlayListProxyModel::*)(const DataTypes::EntryDataList&,
ElisaUtils::PlayListEntryType,
ElisaUtils::PlayListEnqueueMode,
ElisaUtils::PlayListEnqueueTriggerPlay)>(&MediaPlayListProxyModel::enqueue));
}
void ElisaApplication::initializePlayer()
......@@ -491,7 +491,7 @@ bool ElisaApplication::eventFilter(QObject *object, QEvent *event)
return false;
}
const ElisaUtils::EntryDataList &ElisaApplication::arguments() const
const DataTypes::EntryDataList &ElisaApplication::arguments() const
{
return d->mArguments;
}
......
......@@ -36,7 +36,7 @@ class ELISALIB_EXPORT ElisaApplication : public QObject
Q_OBJECT
Q_PROPERTY(ElisaUtils::EntryDataList arguments
Q_PROPERTY(DataTypes::EntryDataList arguments
READ arguments
WRITE setArguments
NOTIFY argumentsChanged)
......@@ -92,7 +92,7 @@ public:
bool eventFilter(QObject *object, QEvent *event) override;
const ElisaUtils::EntryDataList &arguments() const;
const DataTypes::EntryDataList &arguments() const;
MusicListenersManager *musicManager() const;
......@@ -130,7 +130,7 @@ Q_SIGNALS:
void manageHeaderBarChanged();
void enqueue(const ElisaUtils::EntryDataList &newEntries,
void enqueue(const DataTypes::EntryDataList &newEntries,
ElisaUtils::PlayListEntryType databaseIdType,
ElisaUtils::PlayListEnqueueMode enqueueMode,
ElisaUtils::PlayListEnqueueTriggerPlay triggerPlay);
......@@ -155,7 +155,7 @@ public Q_SLOTS:
void configureElisa();
void setArguments(const ElisaUtils::EntryDataList &newArguments);
void setArguments(const DataTypes::EntryDataList &newArguments);
void activateActionRequested(const QString &actionName, const QVariant &parameter);
......@@ -193,7 +193,7 @@ private:
void setupActions(const QString &actionName);
ElisaUtils::EntryDataList checkFileListAndMakeAbsolute(const ElisaUtils::EntryDataList &filesList,
DataTypes::EntryDataList checkFileListAndMakeAbsolute(const DataTypes::EntryDataList &filesList,
const QString &workingDirectory) const;
std::unique_ptr<ElisaApplicationPrivate> d;
......
......@@ -158,8 +158,8 @@ void ElisaQmlTestPlugin::registerTypes(const char *uri)
qRegisterMetaType<ElisaUtils::PlayListEnqueueMode>("ElisaUtils::PlayListEnqueueMode");
qRegisterMetaType<ElisaUtils::PlayListEnqueueTriggerPlay>("ElisaUtils::PlayListEnqueueTriggerPlay");
qRegisterMetaType<ElisaUtils::PlayListEntryType>("ElisaUtils::PlayListEntryType");
qRegisterMetaType<ElisaUtils::EntryData>("ElisaUtils::EntryData");
qRegisterMetaType<ElisaUtils::EntryDataList>("ElisaUtils::EntryDataList");
qRegisterMetaType<DataTypes::EntryData>("DataTypes::EntryData");
qRegisterMetaType<DataTypes::EntryDataList>("DataTypes::EntryDataList");
qRegisterMetaType<ElisaUtils::FilterType>("ElisaUtils::FilterType");
qRegisterMetaType<DataTypes::TrackDataType>("DataTypes::TrackDataType");
qRegisterMetaType<DataTypes::AlbumDataType>("DataTypes::AlbumDataType");
......
......@@ -34,9 +34,6 @@ enum PlayListEnqueueTriggerPlay {
Q_ENUM_NS(PlayListEnqueueTriggerPlay)
using EntryData = std::tuple<DataTypes::TrackDataType, QString, QUrl>;
using EntryDataList = QList<EntryData>;
enum PlayListEntryType {
Album,
Artist,
......@@ -66,7 +63,4 @@ Q_ENUM_NS(FilterType)
}
Q_DECLARE_METATYPE(ElisaUtils::EntryData)
Q_DECLARE_METATYPE(ElisaUtils::EntryDataList)
#endif // ELISAUTILS_H
......@@ -156,11 +156,11 @@ int main(int argc, char *argv[])
QObject::connect(&elisaService, &KDBusService::openRequested, myApp.get(), &ElisaApplication::openRequested);
#endif
auto arguments = ElisaUtils::EntryDataList{};
auto arguments = DataTypes::EntryDataList{};
auto realArgumentsList = parser.positionalArguments();
for (const auto &oneArgument : realArgumentsList) {
arguments.push_back(ElisaUtils::EntryData{{}, {}, QUrl(oneArgument)});
arguments.push_back(DataTypes::EntryData{{}, {}, QUrl(oneArgument)});
}
myApp->setArguments(arguments);
......
......@@ -335,7 +335,7 @@ void MediaPlayList::enqueueRestoredEntries(const QVariantList &newEntries)
endInsertRows();
}
void MediaPlayList::enqueueFilesList(const ElisaUtils::EntryDataList &newEntries, ElisaUtils::PlayListEntryType databaseIdType)
void MediaPlayList::enqueueFilesList(const DataTypes::EntryDataList &newEntries, ElisaUtils::PlayListEntryType databaseIdType)
{
qCDebug(orgKdeElisaPlayList()) << "MediaPlayList::enqueueFilesList";
......@@ -382,7 +382,7 @@ void MediaPlayList::enqueueFilesList(const ElisaUtils::EntryDataList &newEntries
endInsertRows();
}
void MediaPlayList::enqueueTracksListById(const ElisaUtils::EntryDataList &newEntries, ElisaUtils::PlayListEntryType type)
void MediaPlayList::enqueueTracksListById(const DataTypes::EntryDataList &newEntries, ElisaUtils::PlayListEntryType type)
{
qCDebug(orgKdeElisaPlayList()) << "MediaPlayList::enqueueTracksListById" << newEntries.size() << type;
......@@ -396,7 +396,7 @@ void MediaPlayList::enqueueTracksListById(const ElisaUtils::EntryDataList &newEn
endInsertRows();
}
void MediaPlayList::enqueueOneEntry(const ElisaUtils::EntryData &entryData, ElisaUtils::PlayListEntryType type)
void MediaPlayList::enqueueOneEntry(const DataTypes::EntryData &entryData, ElisaUtils::PlayListEntryType type)
{
qCDebug(orgKdeElisaPlayList()) << "MediaPlayList::enqueueOneEntry" << std::get<0>(entryData) << std::get<1>(entryData) << type;
......@@ -409,7 +409,7 @@ void MediaPlayList::enqueueOneEntry(const ElisaUtils::EntryData &entryData, Elis
}
}
void MediaPlayList::enqueueMultipleEntries(const ElisaUtils::EntryDataList &entriesData, ElisaUtils::PlayListEntryType type)
void MediaPlayList::enqueueMultipleEntries(const DataTypes::EntryDataList &entriesData, ElisaUtils::PlayListEntryType type)
{
qCDebug(orgKdeElisaPlayList()) << "MediaPlayList::enqueueMultipleEntries" << entriesData.size() << type;
......
......@@ -137,13 +137,13 @@ public Q_SLOTS:
void trackInError(const QUrl &sourceInError, QMediaPlayer::Error playerError);
void enqueueFilesList(const ElisaUtils::EntryDataList &newEntries, ElisaUtils::PlayListEntryType databaseIdType);
void enqueueFilesList(const DataTypes::EntryDataList &newEntries, ElisaUtils::PlayListEntryType databaseIdType);
void enqueueTracksListById(const ElisaUtils::EntryDataList &newEntries, ElisaUtils::PlayListEntryType type);
void enqueueTracksListById(const DataTypes::EntryDataList &newEntries, ElisaUtils::PlayListEntryType type);
void enqueueOneEntry(const ElisaUtils::EntryData &entryData, ElisaUtils::PlayListEntryType type);
void enqueueOneEntry(const DataTypes::EntryData &entryData, ElisaUtils::PlayListEntryType type);
void enqueueMultipleEntries(const ElisaUtils::EntryDataList &entriesData, ElisaUtils::PlayListEntryType type);
void enqueueMultipleEntries(const DataTypes::EntryDataList &entriesData, ElisaUtils::PlayListEntryType type);
private:
......
......@@ -470,12 +470,12 @@ int MediaPlayListProxyModel::currentTrackRow() const
return d->mCurrentTrack.row();
}
void MediaPlayListProxyModel::enqueue(const ElisaUtils::EntryData &newEntry, ElisaUtils::PlayListEntryType databaseIdType)
void MediaPlayListProxyModel::enqueue(const DataTypes::EntryData &newEntry, ElisaUtils::PlayListEntryType databaseIdType)
{
enqueue(newEntry, databaseIdType, ElisaUtils::PlayListEnqueueMode::AppendPlayList, ElisaUtils::PlayListEnqueueTriggerPlay::DoNotTriggerPlay);
}
void MediaPlayListProxyModel::enqueue(const ElisaUtils::EntryDataList &newEntries, ElisaUtils::PlayListEntryType databaseIdType)
void MediaPlayListProxyModel::enqueue(const DataTypes::EntryDataList &newEntries, ElisaUtils::PlayListEntryType databaseIdType)
{
enqueue(newEntries, databaseIdType, ElisaUtils::PlayListEnqueueMode::AppendPlayList, ElisaUtils::PlayListEnqueueTriggerPlay::DoNotTriggerPlay);
}
......@@ -486,17 +486,17 @@ void MediaPlayListProxyModel::enqueue(qulonglong newEntryDatabaseId,
ElisaUtils::PlayListEnqueueMode enqueueMode,
ElisaUtils::PlayListEnqueueTriggerPlay triggerPlay)
{
enqueue(ElisaUtils::EntryData{{{DataTypes::DatabaseIdRole, newEntryDatabaseId}}, newEntryTitle, {}}, databaseIdType, enqueueMode, triggerPlay);
enqueue(DataTypes::EntryData{{{DataTypes::DatabaseIdRole, newEntryDatabaseId}}, newEntryTitle, {}}, databaseIdType, enqueueMode, triggerPlay);
}
void MediaPlayListProxyModel::enqueue(const QUrl &entryUrl, ElisaUtils::PlayListEntryType databaseIdType,
ElisaUtils::PlayListEnqueueMode enqueueMode,
ElisaUtils::PlayListEnqueueTriggerPlay triggerPlay)
{
enqueue(ElisaUtils::EntryData{{}, {}, entryUrl}, databaseIdType, enqueueMode, triggerPlay);
enqueue(DataTypes::EntryData{{}, {}, entryUrl}, databaseIdType, enqueueMode, triggerPlay);
}
void MediaPlayListProxyModel::enqueue(const ElisaUtils::EntryData &newEntry,
void MediaPlayListProxyModel::enqueue(const DataTypes::EntryData &newEntry,
ElisaUtils::PlayListEntryType databaseIdType,
ElisaUtils::PlayListEnqueueMode enqueueMode,
ElisaUtils::PlayListEnqueueTriggerPlay triggerPlay)
......@@ -536,7 +536,7 @@ void MediaPlayListProxyModel::enqueue(const ElisaUtils::EntryData &newEntry,
}
}
void MediaPlayListProxyModel::enqueue(const ElisaUtils::EntryDataList &newEntries,
void MediaPlayListProxyModel::enqueue(const DataTypes::EntryDataList &newEntries,
ElisaUtils::PlayListEntryType databaseIdType,
ElisaUtils::PlayListEnqueueMode enqueueMode,
ElisaUtils::PlayListEnqueueTriggerPlay triggerPlay)
......@@ -777,9 +777,9 @@ void MediaPlayListProxyModel::loadPlayListLoaded()
clearPlayList();
for (int i = 0; i < d->mLoadPlaylist.mediaCount(); ++i) {
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
enqueue(ElisaUtils::EntryData{{}, {}, d->mLoadPlaylist.media(i).canonicalUrl()}, ElisaUtils::FileName);
enqueue(DataTypes::EntryData{{}, {}, d->mLoadPlaylist.media(i).canonicalUrl()}, ElisaUtils::FileName);
#else
enqueue(ElisaUtils::EntryData{{}, {}, d->mLoadPlaylist.media(i).request().url()}, ElisaUtils::FileName);
enqueue(DataTypes::EntryData{{}, {}, d->mLoadPlaylist.media(i).request().url()}, ElisaUtils::FileName);
#endif
}
......@@ -853,13 +853,13 @@ void MediaPlayListProxyModel::enqueueDirectory(const QUrl &fileName, ElisaUtils:
// get contents of directory
QDir dirInfo = QDir(fileName.toLocalFile());
auto files = dirInfo.entryInfoList(QDir::NoDotAndDotDot | QDir::Readable | QDir::Files | QDir::Dirs, QDir::Name);
auto newFiles = ElisaUtils::EntryDataList();
auto newFiles = DataTypes::EntryDataList();
for (auto file : files)
{
auto fileUrl = QUrl::fromLocalFile(file.filePath());
if (file.isFile() && d->mMimeDb.mimeTypeForUrl(fileUrl).name().startsWith(QLatin1String("audio/")))
{
newFiles.append({ElisaUtils::EntryData{{},{},fileUrl}});
newFiles.append({DataTypes::EntryData{{},{},fileUrl}});
}
else if (file.isDir() && depth > 1)
{
......
......@@ -113,9 +113,9 @@ public:
public Q_SLOTS:
void enqueue(const ElisaUtils::EntryData &newEntry, ElisaUtils::PlayListEntryType databaseIdType);
void enqueue(const DataTypes::EntryData &newEntry, ElisaUtils::PlayListEntryType databaseIdType);
void enqueue(const ElisaUtils::EntryDataList &newEntries, ElisaUtils::PlayListEntryType databaseIdType);