Commit 8bb8eb35 authored by Matthieu Gallien's avatar Matthieu Gallien 🎵

compatibility with newer version of upnp lib and Elisa master branch

Summary:
make it build again against latest UpnpLibQt

update repository address for UpnpLibQt

starts to put back visible UPnP DLNA integration

add more integration for remote UPnP/DLNA servers

try to integrate DLNA servers discovery in the existing code

bring some form of browsing of remote dlna servers

sync with latest commit of upnp qt lib

allow wome sort of discovery of servers along with display in a
dedicated view

adapt to API changes in UpnpQtLib

use a logging category for all UPnP related code

fix REUSE compliance

mostly fix browsing by using single level models
parent 01982fcf
......@@ -135,13 +135,13 @@ set_package_properties(KF5KIO PROPERTIES
DESCRIPTION "File management libraries used for file browsing."
TYPE RECOMMENDED)
find_package(UPNPQT CONFIG QUIET)
set_package_properties(UPNPQT PROPERTIES
find_package(UpnpLibQt CONFIG QUIET)
set_package_properties(UpnpLibQt PROPERTIES
DESCRIPTION "UPNP layer build with Qt 5. UPnP support is currently broken. You should probably avoid this dependency."
URL "https://gitlab.com/homeautomationqt/upnp-player-qt"
URL "https://cgit.kde.org/scratch/mgallien/upnp-lib-qt.git"
TYPE OPTIONAL)
if (UPNPQT_FOUND)
if (UpnpLibQt_FOUND)
message(WARNING "UPnP support is experimental and may not work.")
endif()
......
......@@ -64,7 +64,7 @@ private Q_SLOTS:
QCOMPARE(beginRemoveRowsSpy.count(), 0);
QCOMPARE(endRemoveRowsSpy.count(), 0);
QCOMPARE(dataChangedSpy.count(), 0);
QCOMPARE(viewsModel.rowCount(), 9);
QCOMPARE(viewsModel.rowCount(), 10);
musicDb.insertTracksList(mNewTracks, mNewCovers);
......@@ -73,7 +73,7 @@ private Q_SLOTS:
QCOMPARE(beginRemoveRowsSpy.count(), 0);
QCOMPARE(endRemoveRowsSpy.count(), 0);
QCOMPARE(dataChangedSpy.count(), 0);
QCOMPARE(viewsModel.rowCount(), 9);
QCOMPARE(viewsModel.rowCount(), 10);
viewsModel.viewsData()->setEmbeddedCategory(ElisaUtils::Genre);
......@@ -82,7 +82,7 @@ private Q_SLOTS:
QCOMPARE(beginRemoveRowsSpy.count(), 1);
QCOMPARE(endRemoveRowsSpy.count(), 1);
QCOMPARE(dataChangedSpy.count(), 0);
QCOMPARE(viewsModel.rowCount(), 12);
QCOMPARE(viewsModel.rowCount(), 13);
viewsModel.viewsData()->setEmbeddedCategory(ElisaUtils::Unknown);
......@@ -91,7 +91,7 @@ private Q_SLOTS:
QCOMPARE(beginRemoveRowsSpy.count(), 5);
QCOMPARE(endRemoveRowsSpy.count(), 5);
QCOMPARE(dataChangedSpy.count(), 0);
QCOMPARE(viewsModel.rowCount(), 9);
QCOMPARE(viewsModel.rowCount(), 10);
}
void switchToEmbeddedGenreCategoryWithInsert()
......@@ -118,7 +118,7 @@ private Q_SLOTS:
QCOMPARE(beginRemoveRowsSpy.count(), 0);
QCOMPARE(endRemoveRowsSpy.count(), 0);
QCOMPARE(dataChangedSpy.count(), 0);
QCOMPARE(viewsModel.rowCount(), 9);
QCOMPARE(viewsModel.rowCount(), 10);
viewsModel.viewsData()->setEmbeddedCategory(ElisaUtils::Genre);
......@@ -127,7 +127,7 @@ private Q_SLOTS:
QCOMPARE(beginRemoveRowsSpy.count(), 1);
QCOMPARE(endRemoveRowsSpy.count(), 1);
QCOMPARE(dataChangedSpy.count(), 0);
QCOMPARE(viewsModel.rowCount(), 8);
QCOMPARE(viewsModel.rowCount(), 9);
musicDb.insertTracksList(mNewTracks, mNewCovers);
......@@ -136,7 +136,7 @@ private Q_SLOTS:
QCOMPARE(beginRemoveRowsSpy.count(), 1);
QCOMPARE(endRemoveRowsSpy.count(), 1);
QCOMPARE(dataChangedSpy.count(), 0);
QCOMPARE(viewsModel.rowCount(), 12);
QCOMPARE(viewsModel.rowCount(), 13);
auto newTracks = DataTypes::ListTrackDataType{
{true, QStringLiteral("$23"), QStringLiteral("0"), QStringLiteral("track6"),
......@@ -170,7 +170,7 @@ private Q_SLOTS:
QCOMPARE(beginRemoveRowsSpy.count(), 1);
QCOMPARE(endRemoveRowsSpy.count(), 1);
QCOMPARE(dataChangedSpy.count(), 0);
QCOMPARE(viewsModel.rowCount(), 15);
QCOMPARE(viewsModel.rowCount(), 16);
viewsModel.viewsData()->setEmbeddedCategory(ElisaUtils::Unknown);
......@@ -179,7 +179,7 @@ private Q_SLOTS:
QCOMPARE(beginRemoveRowsSpy.count(), 8);
QCOMPARE(endRemoveRowsSpy.count(), 8);
QCOMPARE(dataChangedSpy.count(), 0);
QCOMPARE(viewsModel.rowCount(), 9);
QCOMPARE(viewsModel.rowCount(), 10);
}
void switchToEmbeddedAlbumCategoryWithInsertAndRemove()
......@@ -206,7 +206,7 @@ private Q_SLOTS:
QCOMPARE(beginRemoveRowsSpy.count(), 0);
QCOMPARE(endRemoveRowsSpy.count(), 0);
QCOMPARE(dataChangedSpy.count(), 0);
QCOMPARE(viewsModel.rowCount(), 9);
QCOMPARE(viewsModel.rowCount(), 10);
viewsModel.viewsData()->setEmbeddedCategory(ElisaUtils::Album);
......@@ -215,7 +215,7 @@ private Q_SLOTS:
QCOMPARE(beginRemoveRowsSpy.count(), 1);
QCOMPARE(endRemoveRowsSpy.count(), 1);
QCOMPARE(dataChangedSpy.count(), 0);
QCOMPARE(viewsModel.rowCount(), 8);
QCOMPARE(viewsModel.rowCount(), 9);
musicDb.insertTracksList(mNewTracks, mNewCovers);
......@@ -224,7 +224,7 @@ private Q_SLOTS:
QCOMPARE(beginRemoveRowsSpy.count(), 1);
QCOMPARE(endRemoveRowsSpy.count(), 1);
QCOMPARE(dataChangedSpy.count(), 0);
QCOMPARE(viewsModel.rowCount(), 13);
QCOMPARE(viewsModel.rowCount(), 14);
auto newTracks = DataTypes::ListTrackDataType{
{true, QStringLiteral("$23"), QStringLiteral("0"), QStringLiteral("track6"),
......@@ -258,7 +258,7 @@ private Q_SLOTS:
QCOMPARE(beginRemoveRowsSpy.count(), 1);
QCOMPARE(endRemoveRowsSpy.count(), 1);
QCOMPARE(dataChangedSpy.count(), 0);
QCOMPARE(viewsModel.rowCount(), 16);
QCOMPARE(viewsModel.rowCount(), 17);
musicDb.removeTracksList({{QUrl::fromLocalFile(QStringLiteral("/test/$23"))},
{QUrl::fromLocalFile(QStringLiteral("/test/$24"))},
......@@ -269,7 +269,7 @@ private Q_SLOTS:
QCOMPARE(beginRemoveRowsSpy.count(), 4);
QCOMPARE(endRemoveRowsSpy.count(), 4);
QCOMPARE(dataChangedSpy.count(), 0);
QCOMPARE(viewsModel.rowCount(), 13);
QCOMPARE(viewsModel.rowCount(), 14);
viewsModel.viewsData()->setEmbeddedCategory(ElisaUtils::Unknown);
......@@ -278,7 +278,7 @@ private Q_SLOTS:
QCOMPARE(beginRemoveRowsSpy.count(), 9);
QCOMPARE(endRemoveRowsSpy.count(), 9);
QCOMPARE(dataChangedSpy.count(), 0);
QCOMPARE(viewsModel.rowCount(), 9);
QCOMPARE(viewsModel.rowCount(), 10);
}
void simpleSwitchToEmbeddedAlbumCategory()
......@@ -305,7 +305,7 @@ private Q_SLOTS:
QCOMPARE(beginRemoveRowsSpy.count(), 0);
QCOMPARE(endRemoveRowsSpy.count(), 0);
QCOMPARE(dataChangedSpy.count(), 0);
QCOMPARE(viewsModel.rowCount(), 9);
QCOMPARE(viewsModel.rowCount(), 10);
viewsModel.viewsData()->setEmbeddedCategory(ElisaUtils::Album);
......@@ -314,7 +314,7 @@ private Q_SLOTS:
QCOMPARE(beginRemoveRowsSpy.count(), 1);
QCOMPARE(endRemoveRowsSpy.count(), 1);
QCOMPARE(dataChangedSpy.count(), 0);
QCOMPARE(viewsModel.rowCount(), 8);
QCOMPARE(viewsModel.rowCount(), 9);
QCOMPARE(viewsModel.data(viewsModel.index(0, 0), Qt::DisplayRole), QStringLiteral("Now Playing"));
QCOMPARE(viewsModel.data(viewsModel.index(1, 0), Qt::DisplayRole), QStringLiteral("Recently Played"));
......@@ -324,6 +324,7 @@ private Q_SLOTS:
QCOMPARE(viewsModel.data(viewsModel.index(5, 0), Qt::DisplayRole), QStringLiteral("Genres"));
QCOMPARE(viewsModel.data(viewsModel.index(6, 0), Qt::DisplayRole), QStringLiteral("Files"));
QCOMPARE(viewsModel.data(viewsModel.index(7, 0), Qt::DisplayRole), QStringLiteral("Radios"));
QCOMPARE(viewsModel.data(viewsModel.index(8, 0), Qt::DisplayRole), QStringLiteral("UPnP Shares"));
}
void simpleSwitchToEmbeddedArtistCategory()
......@@ -350,7 +351,7 @@ private Q_SLOTS:
QCOMPARE(beginRemoveRowsSpy.count(), 0);
QCOMPARE(endRemoveRowsSpy.count(), 0);
QCOMPARE(dataChangedSpy.count(), 0);
QCOMPARE(viewsModel.rowCount(), 9);
QCOMPARE(viewsModel.rowCount(), 10);
viewsModel.viewsData()->setEmbeddedCategory(ElisaUtils::Artist);
......@@ -359,7 +360,7 @@ private Q_SLOTS:
QCOMPARE(beginRemoveRowsSpy.count(), 1);
QCOMPARE(endRemoveRowsSpy.count(), 1);
QCOMPARE(dataChangedSpy.count(), 0);
QCOMPARE(viewsModel.rowCount(), 8);
QCOMPARE(viewsModel.rowCount(), 9);
QCOMPARE(viewsModel.data(viewsModel.index(0, 0), Qt::DisplayRole), QStringLiteral("Now Playing"));
QCOMPARE(viewsModel.data(viewsModel.index(1, 0), Qt::DisplayRole), QStringLiteral("Recently Played"));
......@@ -369,6 +370,7 @@ private Q_SLOTS:
QCOMPARE(viewsModel.data(viewsModel.index(5, 0), Qt::DisplayRole), QStringLiteral("Genres"));
QCOMPARE(viewsModel.data(viewsModel.index(6, 0), Qt::DisplayRole), QStringLiteral("Files"));
QCOMPARE(viewsModel.data(viewsModel.index(7, 0), Qt::DisplayRole), QStringLiteral("Radios"));
QCOMPARE(viewsModel.data(viewsModel.index(8, 0), Qt::DisplayRole), QStringLiteral("UPnP Shares"));
}
void simpleSwitchToEmbeddedGenreCategory()
......@@ -395,7 +397,7 @@ private Q_SLOTS:
QCOMPARE(beginRemoveRowsSpy.count(), 0);
QCOMPARE(endRemoveRowsSpy.count(), 0);
QCOMPARE(dataChangedSpy.count(), 0);
QCOMPARE(viewsModel.rowCount(), 9);
QCOMPARE(viewsModel.rowCount(), 10);
viewsModel.viewsData()->setEmbeddedCategory(ElisaUtils::Genre);
......@@ -404,7 +406,7 @@ private Q_SLOTS:
QCOMPARE(beginRemoveRowsSpy.count(), 1);
QCOMPARE(endRemoveRowsSpy.count(), 1);
QCOMPARE(dataChangedSpy.count(), 0);
QCOMPARE(viewsModel.rowCount(), 8);
QCOMPARE(viewsModel.rowCount(), 9);
QCOMPARE(viewsModel.data(viewsModel.index(0, 0), Qt::DisplayRole), QStringLiteral("Now Playing"));
QCOMPARE(viewsModel.data(viewsModel.index(1, 0), Qt::DisplayRole), QStringLiteral("Recently Played"));
......@@ -414,6 +416,7 @@ private Q_SLOTS:
QCOMPARE(viewsModel.data(viewsModel.index(5, 0), Qt::DisplayRole), QStringLiteral("Tracks"));
QCOMPARE(viewsModel.data(viewsModel.index(6, 0), Qt::DisplayRole), QStringLiteral("Files"));
QCOMPARE(viewsModel.data(viewsModel.index(7, 0), Qt::DisplayRole), QStringLiteral("Radios"));
QCOMPARE(viewsModel.data(viewsModel.index(8, 0), Qt::DisplayRole), QStringLiteral("UPnP Shares"));
}
void simpleSwitchToEmbeddedAlbumCategoryWithoutDatabase()
......@@ -435,7 +438,7 @@ private Q_SLOTS:
QCOMPARE(beginRemoveRowsSpy.count(), 0);
QCOMPARE(endRemoveRowsSpy.count(), 0);
QCOMPARE(dataChangedSpy.count(), 0);
QCOMPARE(viewsModel.rowCount(), 9);
QCOMPARE(viewsModel.rowCount(), 10);
viewsModel.viewsData()->setEmbeddedCategory(ElisaUtils::Album);
......@@ -444,7 +447,7 @@ private Q_SLOTS:
QCOMPARE(beginRemoveRowsSpy.count(), 1);
QCOMPARE(endRemoveRowsSpy.count(), 1);
QCOMPARE(dataChangedSpy.count(), 0);
QCOMPARE(viewsModel.rowCount(), 8);
QCOMPARE(viewsModel.rowCount(), 9);
QCOMPARE(viewsModel.data(viewsModel.index(0, 0), Qt::DisplayRole), QStringLiteral("Now Playing"));
QCOMPARE(viewsModel.data(viewsModel.index(1, 0), Qt::DisplayRole), QStringLiteral("Recently Played"));
......@@ -454,6 +457,7 @@ private Q_SLOTS:
QCOMPARE(viewsModel.data(viewsModel.index(5, 0), Qt::DisplayRole), QStringLiteral("Genres"));
QCOMPARE(viewsModel.data(viewsModel.index(6, 0), Qt::DisplayRole), QStringLiteral("Files"));
QCOMPARE(viewsModel.data(viewsModel.index(7, 0), Qt::DisplayRole), QStringLiteral("Radios"));
QCOMPARE(viewsModel.data(viewsModel.index(8, 0), Qt::DisplayRole), QStringLiteral("UPnP Shares"));
}
void simpleSwitchToEmbeddedArtistCategoryWithoutDatabase()
......@@ -475,7 +479,7 @@ private Q_SLOTS:
QCOMPARE(beginRemoveRowsSpy.count(), 0);
QCOMPARE(endRemoveRowsSpy.count(), 0);
QCOMPARE(dataChangedSpy.count(), 0);
QCOMPARE(viewsModel.rowCount(), 9);
QCOMPARE(viewsModel.rowCount(), 10);
viewsModel.viewsData()->setEmbeddedCategory(ElisaUtils::Artist);
......@@ -484,7 +488,7 @@ private Q_SLOTS:
QCOMPARE(beginRemoveRowsSpy.count(), 1);
QCOMPARE(endRemoveRowsSpy.count(), 1);
QCOMPARE(dataChangedSpy.count(), 0);
QCOMPARE(viewsModel.rowCount(), 8);
QCOMPARE(viewsModel.rowCount(), 9);
QCOMPARE(viewsModel.data(viewsModel.index(0, 0), Qt::DisplayRole), QStringLiteral("Now Playing"));
QCOMPARE(viewsModel.data(viewsModel.index(1, 0), Qt::DisplayRole), QStringLiteral("Recently Played"));
......@@ -494,6 +498,7 @@ private Q_SLOTS:
QCOMPARE(viewsModel.data(viewsModel.index(5, 0), Qt::DisplayRole), QStringLiteral("Genres"));
QCOMPARE(viewsModel.data(viewsModel.index(6, 0), Qt::DisplayRole), QStringLiteral("Files"));
QCOMPARE(viewsModel.data(viewsModel.index(7, 0), Qt::DisplayRole), QStringLiteral("Radios"));
QCOMPARE(viewsModel.data(viewsModel.index(8, 0), Qt::DisplayRole), QStringLiteral("UPnP Shares"));
}
void simpleSwitchToEmbeddedGenreCategoryWithoutDatabase()
......@@ -515,7 +520,7 @@ private Q_SLOTS:
QCOMPARE(beginRemoveRowsSpy.count(), 0);
QCOMPARE(endRemoveRowsSpy.count(), 0);
QCOMPARE(dataChangedSpy.count(), 0);
QCOMPARE(viewsModel.rowCount(), 9);
QCOMPARE(viewsModel.rowCount(), 10);
viewsModel.viewsData()->setEmbeddedCategory(ElisaUtils::Genre);
......@@ -524,7 +529,7 @@ private Q_SLOTS:
QCOMPARE(beginRemoveRowsSpy.count(), 1);
QCOMPARE(endRemoveRowsSpy.count(), 1);
QCOMPARE(dataChangedSpy.count(), 0);
QCOMPARE(viewsModel.rowCount(), 8);
QCOMPARE(viewsModel.rowCount(), 9);
QCOMPARE(viewsModel.data(viewsModel.index(0, 0), Qt::DisplayRole), QStringLiteral("Now Playing"));
QCOMPARE(viewsModel.data(viewsModel.index(1, 0), Qt::DisplayRole), QStringLiteral("Recently Played"));
......@@ -534,6 +539,7 @@ private Q_SLOTS:
QCOMPARE(viewsModel.data(viewsModel.index(5, 0), Qt::DisplayRole), QStringLiteral("Tracks"));
QCOMPARE(viewsModel.data(viewsModel.index(6, 0), Qt::DisplayRole), QStringLiteral("Files"));
QCOMPARE(viewsModel.data(viewsModel.index(7, 0), Qt::DisplayRole), QStringLiteral("Radios"));
QCOMPARE(viewsModel.data(viewsModel.index(8, 0), Qt::DisplayRole), QStringLiteral("UPnP Shares"));
}
void switchToEmbeddedAlbumCategoryAndToEmbeddedArtistCategory()
......@@ -560,7 +566,7 @@ private Q_SLOTS:
QCOMPARE(beginRemoveRowsSpy.count(), 0);
QCOMPARE(endRemoveRowsSpy.count(), 0);
QCOMPARE(dataChangedSpy.count(), 0);
QCOMPARE(viewsModel.rowCount(), 9);
QCOMPARE(viewsModel.rowCount(), 10);
musicDb.insertTracksList(mNewTracks, mNewCovers);
......@@ -569,7 +575,7 @@ private Q_SLOTS:
QCOMPARE(beginRemoveRowsSpy.count(), 0);
QCOMPARE(endRemoveRowsSpy.count(), 0);
QCOMPARE(dataChangedSpy.count(), 0);
QCOMPARE(viewsModel.rowCount(), 9);
QCOMPARE(viewsModel.rowCount(), 10);
QCOMPARE(viewsModel.data(viewsModel.index(0, 0), Qt::DisplayRole), QStringLiteral("Now Playing"));
QCOMPARE(viewsModel.data(viewsModel.index(1, 0), Qt::DisplayRole), QStringLiteral("Recently Played"));
......@@ -580,6 +586,7 @@ private Q_SLOTS:
QCOMPARE(viewsModel.data(viewsModel.index(6, 0), Qt::DisplayRole), QStringLiteral("Genres"));
QCOMPARE(viewsModel.data(viewsModel.index(7, 0), Qt::DisplayRole), QStringLiteral("Files"));
QCOMPARE(viewsModel.data(viewsModel.index(8, 0), Qt::DisplayRole), QStringLiteral("Radios"));
QCOMPARE(viewsModel.data(viewsModel.index(9, 0), Qt::DisplayRole), QStringLiteral("UPnP Shares"));
viewsModel.viewsData()->setEmbeddedCategory(ElisaUtils::Album);
......@@ -590,7 +597,7 @@ private Q_SLOTS:
QCOMPARE(beginRemoveRowsSpy.count(), 1);
QCOMPARE(endRemoveRowsSpy.count(), 1);
QCOMPARE(dataChangedSpy.count(), 0);
QCOMPARE(viewsModel.rowCount(), 13);
QCOMPARE(viewsModel.rowCount(), 14);
QCOMPARE(viewsModel.data(viewsModel.index(0, 0), Qt::DisplayRole), QStringLiteral("Now Playing"));
QCOMPARE(viewsModel.data(viewsModel.index(1, 0), Qt::DisplayRole), QStringLiteral("Recently Played"));
......@@ -600,11 +607,12 @@ private Q_SLOTS:
QCOMPARE(viewsModel.data(viewsModel.index(5, 0), Qt::DisplayRole), QStringLiteral("Genres"));
QCOMPARE(viewsModel.data(viewsModel.index(6, 0), Qt::DisplayRole), QStringLiteral("Files"));
QCOMPARE(viewsModel.data(viewsModel.index(7, 0), Qt::DisplayRole), QStringLiteral("Radios"));
QCOMPARE(viewsModel.data(viewsModel.index(8, 0), Qt::DisplayRole), QStringLiteral("album1"));
QCOMPARE(viewsModel.data(viewsModel.index(9, 0), Qt::DisplayRole), QStringLiteral("album2"));
QCOMPARE(viewsModel.data(viewsModel.index(10, 0), Qt::DisplayRole), QStringLiteral("album3"));
QCOMPARE(viewsModel.data(viewsModel.index(8, 0), Qt::DisplayRole), QStringLiteral("UPnP Shares"));
QCOMPARE(viewsModel.data(viewsModel.index(9, 0), Qt::DisplayRole), QStringLiteral("album1"));
QCOMPARE(viewsModel.data(viewsModel.index(10, 0), Qt::DisplayRole), QStringLiteral("album2"));
QCOMPARE(viewsModel.data(viewsModel.index(11, 0), Qt::DisplayRole), QStringLiteral("album3"));
QCOMPARE(viewsModel.data(viewsModel.index(12, 0), Qt::DisplayRole), QStringLiteral("album4"));
QCOMPARE(viewsModel.data(viewsModel.index(12, 0), Qt::DisplayRole), QStringLiteral("album3"));
QCOMPARE(viewsModel.data(viewsModel.index(13, 0), Qt::DisplayRole), QStringLiteral("album4"));
viewsModel.viewsData()->setEmbeddedCategory(ElisaUtils::Artist);
......@@ -615,7 +623,7 @@ private Q_SLOTS:
QCOMPARE(beginRemoveRowsSpy.count(), 7);
QCOMPARE(endRemoveRowsSpy.count(), 7);
QCOMPARE(dataChangedSpy.count(), 0);
QCOMPARE(viewsModel.rowCount(), 15);
QCOMPARE(viewsModel.rowCount(), 16);
QCOMPARE(viewsModel.data(viewsModel.index(0, 0), Qt::DisplayRole), QStringLiteral("Now Playing"));
QCOMPARE(viewsModel.data(viewsModel.index(1, 0), Qt::DisplayRole), QStringLiteral("Recently Played"));
......@@ -625,13 +633,14 @@ private Q_SLOTS:
QCOMPARE(viewsModel.data(viewsModel.index(5, 0), Qt::DisplayRole), QStringLiteral("Genres"));
QCOMPARE(viewsModel.data(viewsModel.index(6, 0), Qt::DisplayRole), QStringLiteral("Files"));
QCOMPARE(viewsModel.data(viewsModel.index(7, 0), Qt::DisplayRole), QStringLiteral("Radios"));
QCOMPARE(viewsModel.data(viewsModel.index(8, 0), Qt::DisplayRole), QStringLiteral("artist1"));
QCOMPARE(viewsModel.data(viewsModel.index(9, 0), Qt::DisplayRole), QStringLiteral("artist1 and artist2"));
QCOMPARE(viewsModel.data(viewsModel.index(10, 0), Qt::DisplayRole), QStringLiteral("artist2"));
QCOMPARE(viewsModel.data(viewsModel.index(11, 0), Qt::DisplayRole), QStringLiteral("artist3"));
QCOMPARE(viewsModel.data(viewsModel.index(12, 0), Qt::DisplayRole), QStringLiteral("artist4"));
QCOMPARE(viewsModel.data(viewsModel.index(13, 0), Qt::DisplayRole), QStringLiteral("artist7"));
QCOMPARE(viewsModel.data(viewsModel.index(14, 0), Qt::DisplayRole), QStringLiteral("Various Artists"));
QCOMPARE(viewsModel.data(viewsModel.index(8, 0), Qt::DisplayRole), QStringLiteral("UPnP Shares"));
QCOMPARE(viewsModel.data(viewsModel.index(9, 0), Qt::DisplayRole), QStringLiteral("artist1"));
QCOMPARE(viewsModel.data(viewsModel.index(10, 0), Qt::DisplayRole), QStringLiteral("artist1 and artist2"));
QCOMPARE(viewsModel.data(viewsModel.index(11, 0), Qt::DisplayRole), QStringLiteral("artist2"));
QCOMPARE(viewsModel.data(viewsModel.index(12, 0), Qt::DisplayRole), QStringLiteral("artist3"));
QCOMPARE(viewsModel.data(viewsModel.index(13, 0), Qt::DisplayRole), QStringLiteral("artist4"));
QCOMPARE(viewsModel.data(viewsModel.index(14, 0), Qt::DisplayRole), QStringLiteral("artist7"));
QCOMPARE(viewsModel.data(viewsModel.index(15, 0), Qt::DisplayRole), QStringLiteral("Various Artists"));
viewsModel.viewsData()->setEmbeddedCategory(ElisaUtils::Unknown);
......@@ -642,7 +651,7 @@ private Q_SLOTS:
QCOMPARE(beginRemoveRowsSpy.count(), 14);
QCOMPARE(endRemoveRowsSpy.count(), 14);
QCOMPARE(dataChangedSpy.count(), 0);
QCOMPARE(viewsModel.rowCount(), 9);
QCOMPARE(viewsModel.rowCount(), 10);
QCOMPARE(viewsModel.data(viewsModel.index(0, 0), Qt::DisplayRole), QStringLiteral("Now Playing"));
QCOMPARE(viewsModel.data(viewsModel.index(1, 0), Qt::DisplayRole), QStringLiteral("Recently Played"));
......@@ -653,6 +662,7 @@ private Q_SLOTS:
QCOMPARE(viewsModel.data(viewsModel.index(6, 0), Qt::DisplayRole), QStringLiteral("Genres"));
QCOMPARE(viewsModel.data(viewsModel.index(7, 0), Qt::DisplayRole), QStringLiteral("Files"));
QCOMPARE(viewsModel.data(viewsModel.index(8, 0), Qt::DisplayRole), QStringLiteral("Radios"));
QCOMPARE(viewsModel.data(viewsModel.index(9, 0), Qt::DisplayRole), QStringLiteral("UPnP Shares"));
}
};
......
......@@ -10,7 +10,7 @@
#cmakedefine01 KF5Crash_FOUND
#cmakedefine01 UPNPQT_FOUND
#cmakedefine01 UpnpLibQt_FOUND
#cmakedefine01 Qt5DBus_FOUND
......
......@@ -4,3 +4,4 @@ org.kde.elisa.indexer elisa (indexer) DEFAULT_SEVERITY [INFO] IDENTIFIER [orgKde
org.kde.elisa.player.vlc elisa (vlc) DEFAULT_SEVERITY [INFO] IDENTIFIER [orgKdeElisaPlayerVlc]
org.kde.elisa.player.qtMultimedia elisa (qtmultimedia) DEFAULT_SEVERITY [INFO] IDENTIFIER [orgKdeElisaPlayerQtMultimedia]
org.kde.elisa.baloo elisa (baloo) DEFAULT_SEVERITY [INFO] IDENTIFIER [orgKdeElisaBaloo]
org.kde.elisa.upnp elisa (UPnP) DEFAULT_SEVERITY [INFO] IDENTIFIER [orgKdeElisaUpnp]
......@@ -165,7 +165,14 @@ if (Qt5DBus_FOUND)
)
endif()
if (UPNPQT_FOUND)
if (UpnpLibQt_FOUND)
ecm_qt_declare_logging_category(elisaLib_SOURCES
HEADER "upnpLogging.h"
IDENTIFIER "orgKdeElisaUpnp"
CATEGORY_NAME "org.kde.elisa.upnp"
DEFAULT_SEVERITY Info
)
set(elisaLib_SOURCES
${elisaLib_SOURCES}
upnp/upnpcontrolcontentdirectory.cpp
......@@ -173,8 +180,8 @@ if (UPNPQT_FOUND)
upnp/upnpcontrolconnectionmanager.cpp
upnp/upnpcontrolmediaserver.cpp
upnp/didlparser.cpp
upnp/upnplistener.cpp
upnp/upnpdiscoverallmusic.cpp
models/upnpalbummodel.cpp
)
endif()
......@@ -281,6 +288,13 @@ if (ANDROID)
)
endif()
if (UpnpLibQt_FOUND)
target_link_libraries(elisaLib
LINK_PUBLIC
UPNP::UpnpLibQt
)
endif()
generate_export_header(elisaLib BASE_NAME ElisaLib EXPORT_FILE_NAME elisaLib_export.h)
set_target_properties(elisaLib PROPERTIES
......
......@@ -71,6 +71,9 @@ public:
IsDirectoryRole,
IsPlayListRole,
FilePathRole,
UUIDRole,
ChildCountRole,
HasModelChildrenRole,
};
Q_ENUM(ColumnsRoles)
......@@ -148,6 +151,16 @@ public:
return operator[](key_type::AlbumIdRole).toULongLong();
}
[[nodiscard]] QString id() const
{
return operator[](key_type::IdRole).toString();
}
[[nodiscard]] QString parentId() const
{
return operator[](key_type::ParentIdRole).toString();
}
bool hasAlbum() const
{
return find(key_type::AlbumRole) != end();
......@@ -289,6 +302,70 @@ public:
using ListRadioDataType = QList<TrackDataType>;
class UpnpTrackDataType : public TrackDataType
{
public:
using TrackDataType::TrackDataType;
[[nodiscard]] QString id() const
{
return operator[](key_type::IdRole).toString();
}
void setId(const QString &id)
{
operator[](key_type::IdRole) = id;
}
[[nodiscard]] QString parentId() const
{
return operator[](key_type::ParentIdRole).toString();
}
void setParentId(const QString &parentId)
{
operator[](key_type::ParentIdRole) = parentId;
}
void setTitle(const QString &title)
{
operator[](key_type::TitleRole) = title;
}
void setArtist(const QString &artist)
{
operator[](key_type::ArtistRole) = artist;
}
void setAlbumArtist(const QString &albumArtist)
{
operator[](key_type::AlbumArtistRole) = albumArtist;
}
void setAlbum(const QString &album)
{
operator[](key_type::AlbumRole) = album;
}
void setResourceURI(const QUrl &resourceURI)
{
operator[](key_type::ResourceRole) = resourceURI;
}
void setDuration(QTime duration)
{
operator[](key_type::DurationRole) = duration;
}
void setTrackNumber(int track)
{
operator[](key_type::TrackNumberRole) = track;
}
};
using ListUpnpTrackDataType = QList<UpnpTrackDataType>;
class AlbumDataType : public MusicDataType
{
public:
......@@ -373,6 +450,21 @@ public:
using EntryData = std::tuple<MusicDataType, QString, QUrl>;
using EntryDataList = QList<EntryData>;
class NetworkServiceDataType : public MusicDataType
{
public:
using MusicDataType::MusicDataType;
QString title() const
{
return operator[](key_type::TitleRole).toString();
}
};
using ListNetworkServiceDataType = QList<NetworkServiceDataType>;
};
Q_DECLARE_METATYPE(DataTypes::MusicDataType)
......@@ -380,11 +472,13 @@ Q_DECLARE_METATYPE(DataTypes::TrackDataType)
Q_DECLARE_METATYPE(DataTypes::AlbumDataType)
Q_DECLARE_METATYPE(DataTypes::ArtistDataType)
Q_DECLARE_METATYPE(DataTypes::GenreDataType)
Q_DECLARE_METATYPE(DataTypes::UpnpTrackDataType)
Q_DECLARE_METATYPE(DataTypes::ListTrackDataType)
Q_DECLARE_METATYPE(DataTypes::ListAlbumDataType)
Q_DECLARE_METATYPE(DataTypes::ListArtistDataType)
Q_DECLARE_METATYPE(DataTypes::ListGenreDataType)
Q_DECLARE_METATYPE(DataTypes::ListUpnpTrackDataType)
Q_DECLARE_METATYPE(DataTypes::EntryData)
Q_DECLARE_METATYPE(DataTypes::EntryDataList)
......
......@@ -34,6 +34,7 @@
<choice name="AllAlbums" />
<choice name="AllArtists" />
<choice name="AllGenres" />
<choice name="AllUpnpMediaServers" />
</choices>
</entry>
<entry key="InitialView" type="Enum">
......
......@@ -24,6 +24,10 @@
#include "upnpbasictypes.h"
#endif
#if defined UpnpLibQt_FOUND && UpnpLibQt_FOUND
#include <UpnpLibQt/UpnpDiscoveryResult>
#endif
#if defined KF5DBusAddons_FOUND && KF5DBusAddons_FOUND
#include <KDBusService>
#endif
......@@ -112,6 +116,7 @@ void ElisaQmlTestPlugin::registerTypes(const char *uri)
qRegisterMetaType<UpnpControlConnectionManager*>();
qRegisterMetaType<UpnpContentDirectoryModel*>();
qRegisterMetaType<UpnpDeviceDescription*>();
qRegisterMetaType<UpnpDiscoveryResult>("UpnpDiscoveryResult");
#endif
qmlRegisterType<MediaPlayList>(uri, 1, 0, "MediaPlayList");
......@@ -158,12 +163,15 @@ void ElisaQmlTestPlugin::registerTypes(const char *uri)
qRegisterMetaType<DataTypes::ListAlbumDataType>("DataTypes::ListAlbumDataType");
qRegisterMetaType<DataTypes::ListArtistDataType>("DataTypes::ListArtistDataType");
qRegisterMetaType<DataTypes::ListGenreDataType>("DataTypes::ListGenreDataType");
qRegisterMetaType<DataTypes::ListNetworkServiceDataType>("DataTypes::ListNetworkServiceDataType");
qRegisterMetaType<ModelDataLoader::ListTrackDataType>("ModelDataLoader::ListTrackDataType");
qRegisterMetaType<ModelDataLoader::ListRadioDataType>("ModelDataLoader::ListRadioDataType");
qRegisterMetaType<ModelDataLoader::ListAlbumDataType>("ModelDataLoader::ListAlbumDataType");
qRegisterMetaType<ModelDataLoader::ListArtistDataType>("ModelDataLoader::ListArtistDataType");
qRegisterMetaType<ModelDataLoader::ListGenreDataType>("ModelDataLoader::ListGenreDataType");
qRegisterMetaType<ModelDataLoader::ListNetworkServiceDataType>("ModelDataLoader::ListNetworkServiceDataType");