diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e252e17a..e9d07185 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,453 +1,452 @@ include_directories(${elisa_BINARY_DIR}) set(elisaLib_SOURCES mediaplaylist.cpp musicaudiotrack.cpp progressindicator.cpp databaseinterface.cpp musiclistenersmanager.cpp managemediaplayercontrol.cpp manageheaderbar.cpp manageaudioplayer.cpp trackslistener.cpp elisaapplication.cpp modeldataloader.cpp notificationitem.cpp topnotificationmanager.cpp elisautils.cpp datatype.cpp abstractfile/abstractfilelistener.cpp abstractfile/abstractfilelisting.cpp filescanner.cpp viewmanager.cpp file/filelistener.cpp file/localfilelisting.cpp models/datamodel.cpp models/abstractmediaproxymodel.cpp - models/allalbumsproxymodel.cpp - models/allartistsproxymodel.cpp + models/gridviewproxymodel.cpp models/alltracksproxymodel.cpp models/singlealbumproxymodel.cpp models/trackmetadatamodel.cpp models/viewsmodel.cpp ) if (LIBVLC_FOUND) set(elisaLib_SOURCES ${elisaLib_SOURCES} audiowrapper_libvlc.cpp ) else() set(elisaLib_SOURCES ${elisaLib_SOURCES} audiowrapper_qtmultimedia.cpp ) endif() if (ANDROID) set(elisaLib_SOURCES ${elisaLib_SOURCES} android/androidmusiclistener.cpp ) endif() if (KF5KIO_FOUND) set(elisaLib_SOURCES ${elisaLib_SOURCES} models/filebrowsermodel.cpp models/filebrowserproxymodel.cpp ) endif() if (KF5Baloo_FOUND) if (Qt5DBus_FOUND) set(elisaLib_SOURCES ${elisaLib_SOURCES} baloo/localbaloofilelisting.cpp baloo/baloolistener.cpp ) qt5_add_dbus_interface(elisaLib_SOURCES ${BALOO_DBUS_INTERFACES_DIR}/org.kde.baloo.main.xml baloo/main) qt5_add_dbus_interface(elisaLib_SOURCES ${BALOO_DBUS_INTERFACES_DIR}/org.kde.baloo.fileindexer.xml baloo/fileindexer) qt5_add_dbus_interface(elisaLib_SOURCES ${BALOO_DBUS_INTERFACES_DIR}/org.kde.baloo.scheduler.xml baloo/scheduler) qt5_add_dbus_adaptor(elisaLib_SOURCES ${BALOO_DBUS_INTERFACES_DIR}/org.kde.BalooWatcherApplication.xml baloo/localbaloofilelisting.h LocalBalooFileListing) endif() endif() if (Qt5DBus_FOUND) set(elisaLib_SOURCES ${elisaLib_SOURCES} mpris2/mpris2.cpp mpris2/mediaplayer2.cpp mpris2/mediaplayer2player.cpp ) endif() if (UPNPQT_FOUND) set(elisaLib_SOURCES ${elisaLib_SOURCES} upnp/upnpcontrolcontentdirectory.cpp upnp/upnpcontentdirectorymodel.cpp upnp/upnpcontrolconnectionmanager.cpp upnp/upnpcontrolmediaserver.cpp upnp/didlparser.cpp upnp/upnplistener.cpp upnp/upnpdiscoverallmusic.cpp ) endif() if (KF5Baloo_FOUND) if (Qt5DBus_FOUND) qt5_add_dbus_interface(elisaLib_SOURCES ${BALOO_DBUS_INTERFACES_DIR}/org.kde.baloo.fileindexer.xml baloo/fileindexer) qt5_add_dbus_interface(elisaLib_SOURCES ${BALOO_DBUS_INTERFACES_DIR}/org.kde.baloo.scheduler.xml baloo/scheduler) set(elisaLib_SOURCES ${elisaLib_SOURCES} ../src/baloo/baloolistener.cpp ../src/baloo/localbaloofilelisting.cpp ) endif() endif() kconfig_add_kcfg_files(elisaLib_SOURCES ../src/elisa_settings.kcfgc ) set(elisaLib_SOURCES ${elisaLib_SOURCES} ../src/elisa_core.kcfg ) add_library(elisaLib ${elisaLib_SOURCES}) target_link_libraries(elisaLib LINK_PUBLIC Qt5::Multimedia LINK_PRIVATE Qt5::Core Qt5::Sql Qt5::Widgets Qt5::Concurrent Qt5::Qml KF5::I18n KF5::CoreAddons KF5::ConfigCore KF5::ConfigGui) if (KF5FileMetaData_FOUND) target_link_libraries(elisaLib LINK_PRIVATE KF5::FileMetaData ) endif() if (KF5KIO_FOUND) target_link_libraries(elisaLib LINK_PUBLIC KF5::KIOCore KF5::KIOFileWidgets KF5::KIOWidgets ) endif() if (KF5XmlGui_FOUND) target_link_libraries(elisaLib LINK_PUBLIC KF5::XmlGui ) endif() if (KF5ConfigWidgets_FOUND) target_link_libraries(elisaLib LINK_PUBLIC KF5::ConfigWidgets ) endif() if (KF5KCMUtils_FOUND) target_link_libraries(elisaLib LINK_PUBLIC KF5::KCMUtils ) endif() if (KF5Baloo_FOUND) if (Qt5DBus_FOUND) target_link_libraries(elisaLib LINK_PUBLIC KF5::Baloo ) endif() endif() if (Qt5DBus_FOUND) target_link_libraries(elisaLib LINK_PUBLIC Qt5::DBus ) if (KF5DBusAddons_FOUND) target_link_libraries(elisaLib LINK_PUBLIC KF5::DBusAddons ) endif() endif() if (LIBVLC_FOUND) target_include_directories(elisaLib PRIVATE ${LIBVLC_INCLUDE_DIR} ) target_link_libraries(elisaLib LINK_PRIVATE ${LIBVLC_LIBRARY} ) endif() if (ANDROID) target_link_libraries(elisaLib LINK_PUBLIC Qt5::AndroidExtras ) endif() generate_export_header(elisaLib BASE_NAME ElisaLib EXPORT_FILE_NAME elisaLib_export.h) set_target_properties(elisaLib PROPERTIES VERSION 0.1 SOVERSION 0 EXPORT_NAME ElisaLib ) if (NOT APPLE AND NOT WIN32) install(TARGETS elisaLib LIBRARY DESTINATION ${KDE_INSTALL_FULL_LIBDIR}/elisa RUNTIME DESTINATION ${KDE_INSTALL_FULL_LIBDIR}/elisa BUNDLE DESTINATION ${KDE_INSTALL_FULL_LIBDIR}/elisa ) else() install(TARGETS elisaLib ${INSTALL_TARGETS_DEFAULT_ARGS}) endif() set(elisaqmlplugin_SOURCES elisaqmlplugin.cpp datatype.cpp elisautils.cpp ) if (KF5FileMetaData_FOUND) set(elisaqmlplugin_SOURCES ${elisaqmlplugin_SOURCES} embeddedcoverageimageprovider.cpp ) endif() add_library(elisaqmlplugin SHARED ${elisaqmlplugin_SOURCES}) target_link_libraries(elisaqmlplugin LINK_PRIVATE Qt5::Quick Qt5::Widgets KF5::ConfigCore KF5::ConfigGui elisaLib ) if (KF5FileMetaData_FOUND) target_link_libraries(elisaqmlplugin LINK_PRIVATE KF5::FileMetaData ) endif() set_target_properties(elisaqmlplugin PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/org/kde/elisa ) if (NOT APPLE AND NOT WIN32) set_target_properties(elisaqmlplugin PROPERTIES INSTALL_RPATH "${KDE_INSTALL_FULL_LIBDIR}/elisa;${CMAKE_INSTALL_RPATH}" ) endif() install(TARGETS elisaqmlplugin DESTINATION ${QML_INSTALL_DIR}/org/kde/elisa/) install(FILES qmldir DESTINATION ${QML_INSTALL_DIR}/org/kde/elisa) add_custom_target(copy) add_custom_target(copy2) file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/bin/org/kde/elisa) add_custom_command(TARGET copy PRE_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/qmldir ${CMAKE_BINARY_DIR}/bin/org/kde/elisa/) add_custom_command(TARGET copy2 PRE_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/plugins.qmltypes ${CMAKE_BINARY_DIR}/bin/org/kde/elisa/) add_dependencies(elisaqmlplugin copy copy2) if (Qt5Quick_FOUND AND Qt5Widgets_FOUND) set(elisa_SOURCES main.cpp windows/WindowsTheme.qml windows/PlatformIntegration.qml android/ElisaMainWindow.qml android/AndroidTheme.qml android/PlatformIntegration.qml android/AlbumsView.qml android/ArtistsView.qml android/TracksView.qml android/GenresView.qml qml/ElisaMainWindow.qml qml/ApplicationMenu.qml qml/BaseTheme.qml qml/Theme.qml qml/PlatformIntegration.qml qml/LabelWithToolTip.qml qml/RatingStar.qml qml/DraggableItem.qml qml/PassiveNotification.qml qml/TopNotification.qml qml/TopNotificationItem.qml qml/TrackImportNotification.qml qml/HeaderBar.qml qml/NavigationActionBar.qml qml/MediaPlayerControl.qml qml/ContextView.qml qml/ContentView.qml qml/ViewSelector.qml qml/AlbumsView.qml qml/ArtistsView.qml qml/GenresView.qml qml/TracksView.qml qml/AlbumView.qml qml/OneArtistView.qml qml/OneGenreView.qml qml/RecentlyPlayedTracks.qml qml/FrequentlyPlayedTracks.qml qml/MediaPlayListView.qml qml/PlayListBasicView.qml qml/PlayListEntry.qml qml/SimplePlayListView.qml qml/SimplePlayListEntry.qml qml/MediaTrackDelegate.qml qml/MediaAlbumTrackDelegate.qml qml/MediaTrackMetadataView.qml qml/GridBrowserView.qml qml/GridBrowserDelegate.qml qml/ListBrowserView.qml qml/FileBrowserDelegate.qml qml/FileBrowserView.qml qml/ScrollHelper.qml qml/FlatButtonWithToolTip.qml qml/AlbumsView.qml qml/ArtistsView.qml qml/TracksView.qml qml/GenresView.qml ) qt5_add_resources(elisa_SOURCES resources.qrc) set_property(SOURCE qrc_resources.cpp PROPERTY SKIP_AUTOMOC ON) set(elisa_ICONS_PNG ../icons/128-apps-elisa.png ../icons/64-apps-elisa.png ../icons/48-apps-elisa.png ../icons/32-apps-elisa.png ../icons/22-apps-elisa.png ../icons/16-apps-elisa.png ) # add icons to application sources, to have them bundled ecm_add_app_icon(elisa_SOURCES ICONS ${elisa_ICONS_PNG}) add_executable(elisa ${elisa_SOURCES}) target_include_directories(elisa PRIVATE ${KDSoap_INCLUDE_DIRS}) target_link_libraries(elisa LINK_PRIVATE elisaLib Qt5::Widgets Qt5::QuickControls2 KF5::I18n KF5::CoreAddons KF5::ConfigCore KF5::ConfigGui ) if (ANDROID) target_link_libraries(elisa LINK_PRIVATE Qt5::AndroidExtras Qt5::Svg Qt5::Sql Qt5::Concurrent KF5::Kirigami2 ) endif() if (KF5Crash_FOUND) target_link_libraries(elisa LINK_PRIVATE KF5::Crash ) endif() if (KF5Declarative_FOUND) target_link_libraries(elisa LINK_PRIVATE KF5::Declarative ) endif() if (NOT APPLE AND NOT WIN32) set_target_properties(elisa PROPERTIES INSTALL_RPATH "${KDE_INSTALL_FULL_LIBDIR}/elisa;${CMAKE_INSTALL_RPATH}" ) endif() install(TARGETS elisa ${INSTALL_TARGETS_DEFAULT_ARGS}) endif() if (KF5ConfigWidgets_FOUND AND KF5Declarative_FOUND) add_subdirectory(localFileConfiguration) endif() set(elisaImport_SOURCES elisaimport.cpp elisaimportapplication.cpp ) kconfig_add_kcfg_files(elisaImport_SOURCES ../src/elisa_settings.kcfgc ) set(elisaImport_SOURCES ${elisaImport_SOURCES} ../src/elisa_core.kcfg ) add_executable(elisaImport ${elisaImport_SOURCES}) target_link_libraries(elisaImport LINK_PRIVATE KF5::ConfigCore KF5::ConfigGui elisaLib ) if (KF5FileMetaData_FOUND) target_link_libraries(elisaImport LINK_PRIVATE KF5::FileMetaData ) endif() set(QML_IMPORT_PATH ${CMAKE_BINARY_DIR}/bin CACHE INTERNAL "qml import path" FORCE) if (ANDROID) kirigami_package_breeze_icons(ICONS elisa) endif() diff --git a/src/elisaqmlplugin.cpp b/src/elisaqmlplugin.cpp index 3a19d783..b64e3550 100644 --- a/src/elisaqmlplugin.cpp +++ b/src/elisaqmlplugin.cpp @@ -1,184 +1,182 @@ /* * Copyright 2018 Matthieu Gallien * * 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 . */ #include "elisaqmlplugin.h" #if defined UPNPQT_FOUND && UPNPQT_FOUND #include "upnp/upnpcontrolconnectionmanager.h" #include "upnp/upnpcontrolmediaserver.h" #include "upnp/upnpcontrolcontentdirectory.h" #include "upnp/upnpcontentdirectorymodel.h" #include "upnpdevicedescription.h" #include "upnp/didlparser.h" #include "upnp/upnpdiscoverallmusic.h" #include "upnpssdpengine.h" #include "upnpabstractservice.h" #include "upnpcontrolabstractdevice.h" #include "upnpcontrolabstractservice.h" #include "upnpbasictypes.h" #endif #include "elisautils.h" #include "elisaapplication.h" #include "progressindicator.h" #include "mediaplaylist.h" #include "managemediaplayercontrol.h" #include "manageheaderbar.h" #include "manageaudioplayer.h" #include "musicaudiotrack.h" #include "musiclistenersmanager.h" #include "trackslistener.h" #include "viewmanager.h" #include "databaseinterface.h" #include "models/datamodel.h" #include "models/trackmetadatamodel.h" #include "models/viewsmodel.h" -#include "models/allalbumsproxymodel.h" +#include "models/gridviewproxymodel.h" #include "models/alltracksproxymodel.h" -#include "models/allartistsproxymodel.h" #include "models/singlealbumproxymodel.h" #if defined KF5FileMetaData_FOUND && KF5FileMetaData_FOUND #include "embeddedcoverageimageprovider.h" #endif #if defined KF5KIO_FOUND && KF5KIO_FOUND #include "models/filebrowsermodel.h" #include "models/filebrowserproxymodel.h" #endif #include "audiowrapper.h" #include "notificationitem.h" #include "topnotificationmanager.h" #include "elisautils.h" #include "datatype.h" #if defined Qt5DBus_FOUND && Qt5DBus_FOUND #include "mpris2/mpris2.h" #include "mpris2/mediaplayer2player.h" #endif #include #include #include #include #include #include void ElisaQmlTestPlugin::initializeEngine(QQmlEngine *engine, const char *uri) { QQmlExtensionPlugin::initializeEngine(engine, uri); #if defined KF5FileMetaData_FOUND && KF5FileMetaData_FOUND engine->addImageProvider(QStringLiteral("cover"), new EmbeddedCoverageImageProvider); #endif } void ElisaQmlTestPlugin::registerTypes(const char *uri) { #if defined UPNPQT_FOUND && UPNPQT_FOUND qmlRegisterType(uri, 1, 0, "UpnpSsdpEngine"); qmlRegisterType(uri, 1, 0, "UpnpDiscoverAllMusic"); qmlRegisterType(uri, 1, 0, "UpnpAbstractDevice"); qmlRegisterType(uri, 1, 0, "UpnpAbstractService"); qmlRegisterType(uri, 1, 0, "UpnpControlAbstractDevice"); qmlRegisterType(uri, 1, 0, "UpnpControlAbstractService"); qmlRegisterType(uri, 1, 0, "UpnpControlConnectionManager"); qmlRegisterType(uri, 1, 0, "UpnpControlMediaServer"); qmlRegisterType(uri, 1, 0, "UpnpContentDirectoryModel"); qmlRegisterType(uri, 1, 0, "DidlParser"); qmlRegisterType(uri, 1, 0, "UpnpControlContentDirectory"); qmlRegisterType(uri, 1, 0, "UpnpDeviceDescription"); qRegisterMetaType(); qRegisterMetaType >(); qRegisterMetaType(); qRegisterMetaType(); qRegisterMetaType(); #endif qRegisterMetaType("DataUtils::DataType"); qmlRegisterType(uri, 1, 0, "MediaPlayList"); qmlRegisterType(uri, 1, 0, "ManageMediaPlayerControl"); qmlRegisterType(uri, 1, 0, "ManageHeaderBar"); qmlRegisterType(uri, 1, 0, "ManageAudioPlayer"); qmlRegisterType(uri, 1, 0, "ProgressIndicator"); qmlRegisterType(uri, 1, 0, "MusicListenersManager"); qmlRegisterType(uri, 1, 0, "ViewManager"); qmlRegisterType(uri, 1, 0, "DataModel"); qmlRegisterType(uri, 1, 0, "TrackMetadataModel"); qmlRegisterType(uri, 1, 0, "ViewsModel"); - qmlRegisterType(uri, 1, 0, "AllAlbumsProxyModel"); - qmlRegisterType(uri, 1, 0, "AllArtistsProxyModel"); + qmlRegisterType(uri, 1, 0, "GridViewProxyModel"); qmlRegisterType(uri, 1, 0, "AllTracksProxyModel"); qmlRegisterType(uri, 1, 0, "SingleAlbumProxyModel"); #if defined KF5KIO_FOUND && KF5KIO_FOUND qmlRegisterType(uri, 1, 0, "FileBrowserModel"); qmlRegisterType(uri, 1, 0, "FileBrowserProxyModel"); #endif qmlRegisterType(uri, 1, 0, "AudioWrapper"); qmlRegisterType(uri, 1, 0, "TopNotificationManager"); qmlRegisterUncreatableMetaObject(DataUtils::staticMetaObject, uri, 1, 0, "DataUtils", QStringLiteral("Only enums")); qmlRegisterUncreatableType(uri, 1, 0, "DatabaseInterface", QStringLiteral("Only created in c++")); #if defined Qt5DBus_FOUND && Qt5DBus_FOUND qmlRegisterType(uri, 1, 0, "Mpris2"); qRegisterMetaType(); #endif qRegisterMetaType(); qRegisterMetaType>("QHash"); qRegisterMetaType>("QHash"); qRegisterMetaType>("QList"); qRegisterMetaType>("QVector"); qRegisterMetaType>("QVector"); qRegisterMetaType>("QHash"); qRegisterMetaType("DatabaseInterface::ListTrackDataType"); qRegisterMetaType("DatabaseInterface::ListAlbumDataType"); qRegisterMetaType("DatabaseInterface::ListArtistDataType"); qRegisterMetaType("DatabaseInterface::ListGenreDataType"); qRegisterMetaType("ModelDataLoader::ListTrackDataType"); qRegisterMetaType("ModelDataLoader::ListAlbumDataType"); qRegisterMetaType("ModelDataLoader::ListArtistDataType"); qRegisterMetaType("ModelDataLoader::ListGenreDataType"); qRegisterMetaType("TracksListener::ListTrackDataType"); qRegisterMetaType>(); qRegisterMetaType(); qRegisterMetaType("NotificationItem"); qRegisterMetaType>("QMap"); qRegisterMetaType("PlayListEnqueueMode"); qRegisterMetaType("PlayListEnqueueTriggerPlay"); qRegisterMetaType("PlayListEntryType"); qRegisterMetaType("EntryData"); qRegisterMetaType("EntryDataList"); qRegisterMetaType("DatabaseInterface::TrackDataType"); qRegisterMetaType("DatabaseInterface::AlbumDataType"); qRegisterMetaType("DatabaseInterface::ArtistDataType"); qRegisterMetaType("DatabaseInterface::GenreDataType"); qRegisterMetaType("ModelDataLoader::TrackDataType"); qRegisterMetaType("TracksListener::TrackDataType"); qRegisterMetaTypeStreamOperators("PlayListControler::PlayerState"); qmlRegisterUncreatableType(uri, 1, 0, "ElisaApplication", QStringLiteral("only one and done in c++")); qmlRegisterUncreatableMetaObject(ElisaUtils::staticMetaObject, uri, 1, 0, "ElisaUtils", QStringLiteral("Namespace ElisaUtils")); } diff --git a/src/models/allartistsproxymodel.cpp b/src/models/allartistsproxymodel.cpp deleted file mode 100644 index 3c40d3ab..00000000 --- a/src/models/allartistsproxymodel.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright 2017 Alexander Stippich - * - * 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 . - */ - -#include "allartistsproxymodel.h" - -#include "databaseinterface.h" -#include "elisautils.h" - -#include -#include -#include - -AllArtistsProxyModel::AllArtistsProxyModel(QObject *parent) : AbstractMediaProxyModel(parent) -{ - setSortRole(Qt::DisplayRole); - setSortCaseSensitivity(Qt::CaseInsensitive); - sortModel(Qt::AscendingOrder); -} - -AllArtistsProxyModel::~AllArtistsProxyModel() = default; - -bool AllArtistsProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const -{ - bool result = false; - - auto currentIndex = sourceModel()->index(source_row, 0, source_parent); - - const auto &mainValue = sourceModel()->data(currentIndex, Qt::DisplayRole).toString(); - - if (mFilterExpression.match(mainValue).hasMatch()) { - result = true; - return result; - } - - return result; -} - -void AllArtistsProxyModel::genericEnqueueToPlayList(ElisaUtils::PlayListEnqueueMode enqueueMode, - ElisaUtils::PlayListEnqueueTriggerPlay triggerPlay) -{ - QtConcurrent::run(&mThreadPool, [=] () { - QReadLocker locker(&mDataLock); - auto allData = ElisaUtils::EntryDataList{}; - allData.reserve(rowCount()); - for (int rowIndex = 0, maxRowCount = rowCount(); rowIndex < maxRowCount; ++rowIndex) { - auto currentIndex = index(rowIndex, 0); - allData.push_back(ElisaUtils::EntryData{data(currentIndex, DatabaseInterface::DatabaseIdRole).toULongLong(), - data(currentIndex, Qt::DisplayRole).toString()}); - } - Q_EMIT entriesToEnqueue(allData, ElisaUtils::Artist, enqueueMode, triggerPlay); - }); -} - -void AllArtistsProxyModel::enqueueToPlayList() -{ - genericEnqueueToPlayList(ElisaUtils::AppendPlayList, ElisaUtils::DoNotTriggerPlay); -} - -void AllArtistsProxyModel::replaceAndPlayOfPlayList() -{ - genericEnqueueToPlayList(ElisaUtils::ReplacePlayList, ElisaUtils::TriggerPlay); -} - - -#include "moc_allartistsproxymodel.cpp" diff --git a/src/models/allartistsproxymodel.h b/src/models/allartistsproxymodel.h deleted file mode 100644 index 420d6a50..00000000 --- a/src/models/allartistsproxymodel.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2017 Alexander Stippich - * Copyright 2018 Matthieu Gallien - * - * 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 . - */ - -#ifndef ALLARTISTSPROXYMODEL_H -#define ALLARTISTSPROXYMODEL_H - -#include "elisaLib_export.h" - -#include "abstractmediaproxymodel.h" -#include "elisautils.h" - -class ELISALIB_EXPORT AllArtistsProxyModel : public AbstractMediaProxyModel -{ - Q_OBJECT - -public: - - explicit AllArtistsProxyModel(QObject *parent = nullptr); - - ~AllArtistsProxyModel() override; - -Q_SIGNALS: - - void entriesToEnqueue(const ElisaUtils::EntryDataList &newEntries, - ElisaUtils::PlayListEntryType databaseIdType, - ElisaUtils::PlayListEnqueueMode enqueueMode, - ElisaUtils::PlayListEnqueueTriggerPlay triggerPlay); - -public Q_SLOTS: - - void enqueueToPlayList(); - - void replaceAndPlayOfPlayList(); - -protected: - - bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override; - -private: - - void genericEnqueueToPlayList(ElisaUtils::PlayListEnqueueMode enqueueMode, - ElisaUtils::PlayListEnqueueTriggerPlay triggerPlay); - -}; - - -#endif // ALLARTISTSPROXYMODEL_H diff --git a/src/models/allalbumsproxymodel.cpp b/src/models/gridviewproxymodel.cpp similarity index 77% rename from src/models/allalbumsproxymodel.cpp rename to src/models/gridviewproxymodel.cpp index 0005b6ff..4311e410 100644 --- a/src/models/allalbumsproxymodel.cpp +++ b/src/models/gridviewproxymodel.cpp @@ -1,100 +1,116 @@ /* * Copyright 2016-2017 Matthieu Gallien * Copyright 2017 Alexander Stippich * * 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 . */ -#include "allalbumsproxymodel.h" +#include "gridviewproxymodel.h" #include "databaseinterface.h" #include "elisautils.h" #include #include #include -AllAlbumsProxyModel::AllAlbumsProxyModel(QObject *parent) : AbstractMediaProxyModel(parent) +GridViewProxyModel::GridViewProxyModel(QObject *parent) : AbstractMediaProxyModel(parent) { setSortRole(Qt::DisplayRole); setSortCaseSensitivity(Qt::CaseInsensitive); sortModel(Qt::AscendingOrder); } -AllAlbumsProxyModel::~AllAlbumsProxyModel() = default; +ElisaUtils::PlayListEntryType GridViewProxyModel::dataType() const +{ + return mDataType; +} + +GridViewProxyModel::~GridViewProxyModel() = default; -bool AllAlbumsProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const +bool GridViewProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const { bool result = false; auto currentIndex = sourceModel()->index(source_row, 0, source_parent); const auto &mainValue = sourceModel()->data(currentIndex, Qt::DisplayRole).toString(); const auto &artistValue = sourceModel()->data(currentIndex, DatabaseInterface::ArtistRole).toString(); const auto &allArtistsValue = sourceModel()->data(currentIndex, DatabaseInterface::AllArtistsRole).toStringList(); const auto maximumRatingValue = sourceModel()->data(currentIndex, DatabaseInterface::HighestTrackRating).toInt(); if (maximumRatingValue < mFilterRating) { result = false; return result; } if (mFilterExpression.match(mainValue).hasMatch()) { result = true; return result; } if (mFilterExpression.match(artistValue).hasMatch()) { result = true; return result; } for (const auto &oneArtist : allArtistsValue) { if (mFilterExpression.match(oneArtist).hasMatch()) { result = true; return result; } } return result; } -void AllAlbumsProxyModel::genericEnqueueToPlayList(ElisaUtils::PlayListEnqueueMode enqueueMode, +void GridViewProxyModel::genericEnqueueToPlayList(ElisaUtils::PlayListEnqueueMode enqueueMode, ElisaUtils::PlayListEnqueueTriggerPlay triggerPlay) { QtConcurrent::run(&mThreadPool, [=] () { QReadLocker locker(&mDataLock); auto allData = ElisaUtils::EntryDataList{}; allData.reserve(rowCount()); for (int rowIndex = 0, maxRowCount = rowCount(); rowIndex < maxRowCount; ++rowIndex) { auto currentIndex = index(rowIndex, 0); allData.push_back(ElisaUtils::EntryData{data(currentIndex, DatabaseInterface::DatabaseIdRole).toULongLong(), data(currentIndex, Qt::DisplayRole).toString()}); } - Q_EMIT entriesToEnqueue(allData, ElisaUtils::Album, enqueueMode, triggerPlay); + Q_EMIT entriesToEnqueue(allData, mDataType, enqueueMode, triggerPlay); }); } -void AllAlbumsProxyModel::enqueueToPlayList() +void GridViewProxyModel::enqueueToPlayList() { genericEnqueueToPlayList(ElisaUtils::AppendPlayList, ElisaUtils::DoNotTriggerPlay); } -void AllAlbumsProxyModel::replaceAndPlayOfPlayList() +void GridViewProxyModel::replaceAndPlayOfPlayList() { genericEnqueueToPlayList(ElisaUtils::ReplacePlayList, ElisaUtils::TriggerPlay); } +void GridViewProxyModel::setDataType(ElisaUtils::PlayListEntryType newDataType) +{ + if (mDataType == newDataType) { + return; + } + + mDataType = newDataType; + + Q_EMIT dataTypeChanged(); +} + -#include "moc_allalbumsproxymodel.cpp" +#include "moc_gridviewproxymodel.cpp" diff --git a/src/models/allalbumsproxymodel.h b/src/models/gridviewproxymodel.h similarity index 73% rename from src/models/allalbumsproxymodel.h rename to src/models/gridviewproxymodel.h index 9edffbcc..61cbe433 100644 --- a/src/models/allalbumsproxymodel.h +++ b/src/models/gridviewproxymodel.h @@ -1,62 +1,72 @@ /* * Copyright 2016-2018 Matthieu Gallien * Copyright 2017 Alexander Stippich * * 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 . */ -#ifndef ALLALBUMSPROXYMODEL_H -#define ALLALBUMSPROXYMODEL_H +#ifndef GRIDVIEWPROXYMODEL_H +#define GRIDVIEWPROXYMODEL_H #include "elisaLib_export.h" #include "abstractmediaproxymodel.h" #include "elisautils.h" -class ELISALIB_EXPORT AllAlbumsProxyModel : public AbstractMediaProxyModel +class ELISALIB_EXPORT GridViewProxyModel : public AbstractMediaProxyModel { Q_OBJECT + Q_PROPERTY(ElisaUtils::PlayListEntryType dataType READ dataType WRITE setDataType NOTIFY dataTypeChanged) + public: - explicit AllAlbumsProxyModel(QObject *parent = nullptr); + explicit GridViewProxyModel(QObject *parent = nullptr); + + ~GridViewProxyModel() override; - ~AllAlbumsProxyModel() override; + ElisaUtils::PlayListEntryType dataType() const; Q_SIGNALS: void entriesToEnqueue(const ElisaUtils::EntryDataList &newEntries, ElisaUtils::PlayListEntryType databaseIdType, ElisaUtils::PlayListEnqueueMode enqueueMode, ElisaUtils::PlayListEnqueueTriggerPlay triggerPlay); + void dataTypeChanged(); + public Q_SLOTS: void enqueueToPlayList(); void replaceAndPlayOfPlayList(); + void setDataType(ElisaUtils::PlayListEntryType newDataType); + protected: bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override; private: void genericEnqueueToPlayList(ElisaUtils::PlayListEnqueueMode enqueueMode, ElisaUtils::PlayListEnqueueTriggerPlay triggerPlay); + ElisaUtils::PlayListEntryType mDataType = ElisaUtils::Unknown; + }; -#endif // ALLALBUMSPROXYMODEL_H +#endif // GRIDVIEWPROXYMODEL_H diff --git a/src/qml/AlbumsView.qml b/src/qml/AlbumsView.qml index 442cab20..06598ad2 100644 --- a/src/qml/AlbumsView.qml +++ b/src/qml/AlbumsView.qml @@ -1,101 +1,102 @@ /* * Copyright 2018 Matthieu Gallien * * 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 . */ import QtQuick 2.10 import QtQuick.Controls 2.3 import org.kde.elisa 1.0 FocusScope { id: viewHeader property alias mainTitle: gridView.mainTitle property alias secondaryTitle: gridView.secondaryTitle property alias image: gridView.image property var modelType property alias defaultIcon: gridView.defaultIcon property alias showRating: gridView.showRating property alias delegateDisplaySecondaryText: gridView.delegateDisplaySecondaryText property alias isSubPage: gridView.isSubPage property string genreFilterText property string artistFilter focus: true DataModel { id: realModel } - AllAlbumsProxyModel { + GridViewProxyModel { id: proxyModel sourceModel: realModel + dataType: modelType onEntriesToEnqueue: elisa.mediaPlayList.enqueue(newEntries, databaseIdType, enqueueMode, triggerPlay) } GridBrowserView { id: gridView focus: true anchors.fill: parent contentModel: proxyModel onEnqueue: elisa.mediaPlayList.enqueue(databaseId, name, modelType, ElisaUtils.AppendPlayList, ElisaUtils.DoNotTriggerPlay) onReplaceAndPlay: elisa.mediaPlayList.enqueue(databaseId, name, modelType, ElisaUtils.ReplacePlayList, ElisaUtils.TriggerPlay) onOpen: viewManager.openChildView(innerMainTitle, innerSecondaryTitle, innerImage, databaseId, dataType) onGoBack: viewManager.goBack() } Connections { target: elisa onMusicManagerChanged: { if (genreFilterText && artistFilter) { realModel.initializeByGenreAndArtist(elisa.musicManager, modelType, genreFilterText, artistFilter) } else if (genreFilterText) { realModel.initializeByGenre(elisa.musicManager, modelType, genreFilterText) } else if (artistFilter) { realModel.initializeByArtist(elisa.musicManager, modelType, artistFilter) } else { realModel.initialize(elisa.musicManager, modelType) } } } Component.onCompleted: { if (elisa.musicManager) { if (genreFilterText && artistFilter) { realModel.initializeByGenreAndArtist(elisa.musicManager, modelType, genreFilterText, artistFilter) } else if (genreFilterText) { realModel.initializeByGenre(elisa.musicManager, modelType, genreFilterText) } else if (artistFilter) { realModel.initializeByArtist(elisa.musicManager, modelType, artistFilter) } else { realModel.initialize(elisa.musicManager, modelType) } } } } diff --git a/src/qml/ArtistsView.qml b/src/qml/ArtistsView.qml index 93aab9a1..06598ad2 100644 --- a/src/qml/ArtistsView.qml +++ b/src/qml/ArtistsView.qml @@ -1,101 +1,102 @@ /* * Copyright 2018 Matthieu Gallien * * 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 . */ import QtQuick 2.10 import QtQuick.Controls 2.3 import org.kde.elisa 1.0 FocusScope { id: viewHeader property alias mainTitle: gridView.mainTitle property alias secondaryTitle: gridView.secondaryTitle property alias image: gridView.image property var modelType property alias defaultIcon: gridView.defaultIcon property alias showRating: gridView.showRating property alias delegateDisplaySecondaryText: gridView.delegateDisplaySecondaryText property alias isSubPage: gridView.isSubPage property string genreFilterText property string artistFilter focus: true DataModel { id: realModel } - AllArtistsProxyModel { + GridViewProxyModel { id: proxyModel sourceModel: realModel + dataType: modelType onEntriesToEnqueue: elisa.mediaPlayList.enqueue(newEntries, databaseIdType, enqueueMode, triggerPlay) } GridBrowserView { id: gridView focus: true anchors.fill: parent contentModel: proxyModel onEnqueue: elisa.mediaPlayList.enqueue(databaseId, name, modelType, ElisaUtils.AppendPlayList, ElisaUtils.DoNotTriggerPlay) onReplaceAndPlay: elisa.mediaPlayList.enqueue(databaseId, name, modelType, ElisaUtils.ReplacePlayList, ElisaUtils.TriggerPlay) onOpen: viewManager.openChildView(innerMainTitle, innerSecondaryTitle, innerImage, databaseId, dataType) onGoBack: viewManager.goBack() } Connections { target: elisa onMusicManagerChanged: { if (genreFilterText && artistFilter) { realModel.initializeByGenreAndArtist(elisa.musicManager, modelType, genreFilterText, artistFilter) } else if (genreFilterText) { realModel.initializeByGenre(elisa.musicManager, modelType, genreFilterText) } else if (artistFilter) { realModel.initializeByArtist(elisa.musicManager, modelType, artistFilter) } else { realModel.initialize(elisa.musicManager, modelType) } } } Component.onCompleted: { if (elisa.musicManager) { if (genreFilterText && artistFilter) { realModel.initializeByGenreAndArtist(elisa.musicManager, modelType, genreFilterText, artistFilter) } else if (genreFilterText) { realModel.initializeByGenre(elisa.musicManager, modelType, genreFilterText) } else if (artistFilter) { realModel.initializeByArtist(elisa.musicManager, modelType, artistFilter) } else { realModel.initialize(elisa.musicManager, modelType) } } } } diff --git a/src/qml/GenresView.qml b/src/qml/GenresView.qml index 93aab9a1..06598ad2 100644 --- a/src/qml/GenresView.qml +++ b/src/qml/GenresView.qml @@ -1,101 +1,102 @@ /* * Copyright 2018 Matthieu Gallien * * 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 . */ import QtQuick 2.10 import QtQuick.Controls 2.3 import org.kde.elisa 1.0 FocusScope { id: viewHeader property alias mainTitle: gridView.mainTitle property alias secondaryTitle: gridView.secondaryTitle property alias image: gridView.image property var modelType property alias defaultIcon: gridView.defaultIcon property alias showRating: gridView.showRating property alias delegateDisplaySecondaryText: gridView.delegateDisplaySecondaryText property alias isSubPage: gridView.isSubPage property string genreFilterText property string artistFilter focus: true DataModel { id: realModel } - AllArtistsProxyModel { + GridViewProxyModel { id: proxyModel sourceModel: realModel + dataType: modelType onEntriesToEnqueue: elisa.mediaPlayList.enqueue(newEntries, databaseIdType, enqueueMode, triggerPlay) } GridBrowserView { id: gridView focus: true anchors.fill: parent contentModel: proxyModel onEnqueue: elisa.mediaPlayList.enqueue(databaseId, name, modelType, ElisaUtils.AppendPlayList, ElisaUtils.DoNotTriggerPlay) onReplaceAndPlay: elisa.mediaPlayList.enqueue(databaseId, name, modelType, ElisaUtils.ReplacePlayList, ElisaUtils.TriggerPlay) onOpen: viewManager.openChildView(innerMainTitle, innerSecondaryTitle, innerImage, databaseId, dataType) onGoBack: viewManager.goBack() } Connections { target: elisa onMusicManagerChanged: { if (genreFilterText && artistFilter) { realModel.initializeByGenreAndArtist(elisa.musicManager, modelType, genreFilterText, artistFilter) } else if (genreFilterText) { realModel.initializeByGenre(elisa.musicManager, modelType, genreFilterText) } else if (artistFilter) { realModel.initializeByArtist(elisa.musicManager, modelType, artistFilter) } else { realModel.initialize(elisa.musicManager, modelType) } } } Component.onCompleted: { if (elisa.musicManager) { if (genreFilterText && artistFilter) { realModel.initializeByGenreAndArtist(elisa.musicManager, modelType, genreFilterText, artistFilter) } else if (genreFilterText) { realModel.initializeByGenre(elisa.musicManager, modelType, genreFilterText) } else if (artistFilter) { realModel.initializeByArtist(elisa.musicManager, modelType, artistFilter) } else { realModel.initialize(elisa.musicManager, modelType) } } } } diff --git a/src/qml/OneArtistView.qml b/src/qml/OneArtistView.qml index 442cab20..06598ad2 100644 --- a/src/qml/OneArtistView.qml +++ b/src/qml/OneArtistView.qml @@ -1,101 +1,102 @@ /* * Copyright 2018 Matthieu Gallien * * 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 . */ import QtQuick 2.10 import QtQuick.Controls 2.3 import org.kde.elisa 1.0 FocusScope { id: viewHeader property alias mainTitle: gridView.mainTitle property alias secondaryTitle: gridView.secondaryTitle property alias image: gridView.image property var modelType property alias defaultIcon: gridView.defaultIcon property alias showRating: gridView.showRating property alias delegateDisplaySecondaryText: gridView.delegateDisplaySecondaryText property alias isSubPage: gridView.isSubPage property string genreFilterText property string artistFilter focus: true DataModel { id: realModel } - AllAlbumsProxyModel { + GridViewProxyModel { id: proxyModel sourceModel: realModel + dataType: modelType onEntriesToEnqueue: elisa.mediaPlayList.enqueue(newEntries, databaseIdType, enqueueMode, triggerPlay) } GridBrowserView { id: gridView focus: true anchors.fill: parent contentModel: proxyModel onEnqueue: elisa.mediaPlayList.enqueue(databaseId, name, modelType, ElisaUtils.AppendPlayList, ElisaUtils.DoNotTriggerPlay) onReplaceAndPlay: elisa.mediaPlayList.enqueue(databaseId, name, modelType, ElisaUtils.ReplacePlayList, ElisaUtils.TriggerPlay) onOpen: viewManager.openChildView(innerMainTitle, innerSecondaryTitle, innerImage, databaseId, dataType) onGoBack: viewManager.goBack() } Connections { target: elisa onMusicManagerChanged: { if (genreFilterText && artistFilter) { realModel.initializeByGenreAndArtist(elisa.musicManager, modelType, genreFilterText, artistFilter) } else if (genreFilterText) { realModel.initializeByGenre(elisa.musicManager, modelType, genreFilterText) } else if (artistFilter) { realModel.initializeByArtist(elisa.musicManager, modelType, artistFilter) } else { realModel.initialize(elisa.musicManager, modelType) } } } Component.onCompleted: { if (elisa.musicManager) { if (genreFilterText && artistFilter) { realModel.initializeByGenreAndArtist(elisa.musicManager, modelType, genreFilterText, artistFilter) } else if (genreFilterText) { realModel.initializeByGenre(elisa.musicManager, modelType, genreFilterText) } else if (artistFilter) { realModel.initializeByArtist(elisa.musicManager, modelType, artistFilter) } else { realModel.initialize(elisa.musicManager, modelType) } } } } diff --git a/src/qml/OneGenreView.qml b/src/qml/OneGenreView.qml index 93aab9a1..06598ad2 100644 --- a/src/qml/OneGenreView.qml +++ b/src/qml/OneGenreView.qml @@ -1,101 +1,102 @@ /* * Copyright 2018 Matthieu Gallien * * 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 . */ import QtQuick 2.10 import QtQuick.Controls 2.3 import org.kde.elisa 1.0 FocusScope { id: viewHeader property alias mainTitle: gridView.mainTitle property alias secondaryTitle: gridView.secondaryTitle property alias image: gridView.image property var modelType property alias defaultIcon: gridView.defaultIcon property alias showRating: gridView.showRating property alias delegateDisplaySecondaryText: gridView.delegateDisplaySecondaryText property alias isSubPage: gridView.isSubPage property string genreFilterText property string artistFilter focus: true DataModel { id: realModel } - AllArtistsProxyModel { + GridViewProxyModel { id: proxyModel sourceModel: realModel + dataType: modelType onEntriesToEnqueue: elisa.mediaPlayList.enqueue(newEntries, databaseIdType, enqueueMode, triggerPlay) } GridBrowserView { id: gridView focus: true anchors.fill: parent contentModel: proxyModel onEnqueue: elisa.mediaPlayList.enqueue(databaseId, name, modelType, ElisaUtils.AppendPlayList, ElisaUtils.DoNotTriggerPlay) onReplaceAndPlay: elisa.mediaPlayList.enqueue(databaseId, name, modelType, ElisaUtils.ReplacePlayList, ElisaUtils.TriggerPlay) onOpen: viewManager.openChildView(innerMainTitle, innerSecondaryTitle, innerImage, databaseId, dataType) onGoBack: viewManager.goBack() } Connections { target: elisa onMusicManagerChanged: { if (genreFilterText && artistFilter) { realModel.initializeByGenreAndArtist(elisa.musicManager, modelType, genreFilterText, artistFilter) } else if (genreFilterText) { realModel.initializeByGenre(elisa.musicManager, modelType, genreFilterText) } else if (artistFilter) { realModel.initializeByArtist(elisa.musicManager, modelType, artistFilter) } else { realModel.initialize(elisa.musicManager, modelType) } } } Component.onCompleted: { if (elisa.musicManager) { if (genreFilterText && artistFilter) { realModel.initializeByGenreAndArtist(elisa.musicManager, modelType, genreFilterText, artistFilter) } else if (genreFilterText) { realModel.initializeByGenre(elisa.musicManager, modelType, genreFilterText) } else if (artistFilter) { realModel.initializeByArtist(elisa.musicManager, modelType, artistFilter) } else { realModel.initialize(elisa.musicManager, modelType) } } } }