diff --git a/src/models/allalbumsproxymodel.cpp b/src/models/allalbumsproxymodel.cpp index 0d65336f..e8af9fb2 100644 --- a/src/models/allalbumsproxymodel.cpp +++ b/src/models/allalbumsproxymodel.cpp @@ -1,108 +1,108 @@ /* * 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 "databaseinterface.h" #include #include AllAlbumsProxyModel::AllAlbumsProxyModel(QObject *parent) : AbstractMediaProxyModel(parent) { setSortRole(DatabaseInterface::ColumnsRoles::TitleRole); setSortCaseSensitivity(Qt::CaseInsensitive); sortModel(Qt::AscendingOrder); } AllAlbumsProxyModel::~AllAlbumsProxyModel() = default; bool AllAlbumsProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const { bool result = false; for (int column = 0, columnCount = sourceModel()->columnCount(source_parent); column < columnCount; ++column) { auto currentIndex = sourceModel()->index(source_row, column, source_parent); const auto &titleValue = sourceModel()->data(currentIndex, DatabaseInterface::ColumnsRoles::TitleRole).toString(); const auto &artistValue = sourceModel()->data(currentIndex, DatabaseInterface::ColumnsRoles::ArtistRole).toString(); const auto &allArtistsValue = sourceModel()->data(currentIndex, DatabaseInterface::ColumnsRoles::AllArtistsRole).toStringList(); const auto maximumRatingValue = sourceModel()->data(currentIndex, DatabaseInterface::ColumnsRoles::HighestTrackRating).toInt(); if (maximumRatingValue < mFilterRating) { result = false; continue; } if (mFilterExpression.match(titleValue).hasMatch()) { result = true; continue; } if (mFilterExpression.match(artistValue).hasMatch()) { result = true; continue; } for (const auto &oneArtist : allArtistsValue) { if (mFilterExpression.match(oneArtist).hasMatch()) { result = true; break; } } if (result) { continue; } if (!result) { break; } } return result; } void AllAlbumsProxyModel::genericEnqueueToPlayList(ElisaUtils::PlayListEnqueueMode enqueueMode, ElisaUtils::PlayListEnqueueTriggerPlay triggerPlay) { QtConcurrent::run(&mThreadPool, [=] () { QReadLocker locker(&mDataLock); auto allAlbums = ElisaUtils::EntryDataList{}; allAlbums.reserve(rowCount()); for (int rowIndex = 0, maxRowCount = rowCount(); rowIndex < maxRowCount; ++rowIndex) { auto currentIndex = index(rowIndex, 0); allAlbums.push_back(ElisaUtils::EntryData{data(currentIndex, DatabaseInterface::ColumnsRoles::DatabaseIdRole).toULongLong(), data(currentIndex, DatabaseInterface::ColumnsRoles::TitleRole).toString()}); } - Q_EMIT albumToEnqueue(allAlbums, ElisaUtils::Album, enqueueMode, triggerPlay); + Q_EMIT entriesToEnqueue(allAlbums, ElisaUtils::Album, enqueueMode, triggerPlay); }); } void AllAlbumsProxyModel::enqueueToPlayList() { genericEnqueueToPlayList(ElisaUtils::AppendPlayList, ElisaUtils::DoNotTriggerPlay); } void AllAlbumsProxyModel::replaceAndPlayOfPlayList() { genericEnqueueToPlayList(ElisaUtils::ReplacePlayList, ElisaUtils::TriggerPlay); } #include "moc_allalbumsproxymodel.cpp" diff --git a/src/models/allalbumsproxymodel.h b/src/models/allalbumsproxymodel.h index ff137c18..9edffbcc 100644 --- a/src/models/allalbumsproxymodel.h +++ b/src/models/allalbumsproxymodel.h @@ -1,62 +1,62 @@ /* * 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 #include "elisaLib_export.h" #include "abstractmediaproxymodel.h" #include "elisautils.h" class ELISALIB_EXPORT AllAlbumsProxyModel : public AbstractMediaProxyModel { Q_OBJECT public: explicit AllAlbumsProxyModel(QObject *parent = nullptr); ~AllAlbumsProxyModel() override; Q_SIGNALS: - void albumToEnqueue(const ElisaUtils::EntryDataList &newEntries, - ElisaUtils::PlayListEntryType databaseIdType, - ElisaUtils::PlayListEnqueueMode enqueueMode, - ElisaUtils::PlayListEnqueueTriggerPlay triggerPlay); + 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 // ALLALBUMSPROXYMODEL_H diff --git a/src/models/allartistsproxymodel.cpp b/src/models/allartistsproxymodel.cpp index c2c8edb6..b5591db3 100644 --- a/src/models/allartistsproxymodel.cpp +++ b/src/models/allartistsproxymodel.cpp @@ -1,92 +1,89 @@ /* * 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 "elisautils.h" #include "databaseinterface.h" #include #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; for (int column = 0, columnCount = sourceModel()->columnCount(source_parent); column < columnCount; ++column) { auto currentIndex = sourceModel()->index(source_row, column, source_parent); const auto &artistValue = sourceModel()->data(currentIndex, Qt::DisplayRole).toString(); if (mFilterExpression.match(artistValue).hasMatch()) { result = true; continue; } if (result) { continue; } if (!result) { break; } } return result; } void AllArtistsProxyModel::genericEnqueueToPlayList(ElisaUtils::PlayListEnqueueMode enqueueMode, ElisaUtils::PlayListEnqueueTriggerPlay triggerPlay) { QtConcurrent::run(&mThreadPool, [=] () { QReadLocker locker(&mDataLock); auto allArtists = ElisaUtils::EntryDataList{}; allArtists.reserve(rowCount()); for (int rowIndex = 0, maxRowCount = rowCount(); rowIndex < maxRowCount; ++rowIndex) { auto currentIndex = index(rowIndex, 0); allArtists.push_back(ElisaUtils::EntryData{data(currentIndex, DatabaseInterface::DatabaseIdRole).toULongLong(), data(currentIndex, Qt::DisplayRole).toString()}); } - Q_EMIT artistToEnqueue(allArtists, - ElisaUtils::Artist, - enqueueMode, - triggerPlay); + Q_EMIT entriesToEnqueue(allArtists, 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 index 46b4320a..420d6a50 100644 --- a/src/models/allartistsproxymodel.h +++ b/src/models/allartistsproxymodel.h @@ -1,62 +1,62 @@ /* * 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 artistToEnqueue(const ElisaUtils::EntryDataList &newEntries, - ElisaUtils::PlayListEntryType databaseIdType, - ElisaUtils::PlayListEnqueueMode enqueueMode, - ElisaUtils::PlayListEnqueueTriggerPlay triggerPlay); + 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/alltracksproxymodel.cpp b/src/models/alltracksproxymodel.cpp index d7668883..c46f211d 100644 --- a/src/models/alltracksproxymodel.cpp +++ b/src/models/alltracksproxymodel.cpp @@ -1,98 +1,98 @@ /* * 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 "alltracksproxymodel.h" #include "databaseinterface.h" #include #include AllTracksProxyModel::AllTracksProxyModel(QObject *parent) : AbstractMediaProxyModel(parent) { setSortCaseSensitivity(Qt::CaseInsensitive); sortModel(Qt::AscendingOrder); } AllTracksProxyModel::~AllTracksProxyModel() = default; bool AllTracksProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const { bool result = false; for (int column = 0, columnCount = sourceModel()->columnCount(source_parent); column < columnCount; ++column) { auto currentIndex = sourceModel()->index(source_row, column, source_parent); const auto &titleValue = sourceModel()->data(currentIndex, Qt::DisplayRole).toString(); const auto &artistValue = sourceModel()->data(currentIndex, DatabaseInterface::ColumnsRoles::ArtistRole).toString(); const auto maximumRatingValue = sourceModel()->data(currentIndex, DatabaseInterface::ColumnsRoles::RatingRole).toInt(); if (maximumRatingValue < mFilterRating) { result = false; continue; } if (mFilterExpression.match(titleValue).hasMatch()) { result = true; continue; } if (mFilterExpression.match(artistValue).hasMatch()) { result = true; continue; } if (result) { continue; } if (!result) { break; } } return result; } void AllTracksProxyModel::genericEnqueueToPlayList(ElisaUtils::PlayListEnqueueMode enqueueMode, ElisaUtils::PlayListEnqueueTriggerPlay triggerPlay) { QtConcurrent::run(&mThreadPool, [=] () { QReadLocker locker(&mDataLock); auto allTracks = ElisaUtils::EntryDataList(); allTracks.reserve(rowCount()); for (int rowIndex = 0, maxRowCount = rowCount(); rowIndex < maxRowCount; ++rowIndex) { auto currentIndex = index(rowIndex, 0); allTracks.push_back(ElisaUtils::EntryData{data(currentIndex, DatabaseInterface::ColumnsRoles::DatabaseIdRole).toULongLong(), data(currentIndex, DatabaseInterface::ColumnsRoles::TitleRole).toString()}); } - Q_EMIT trackToEnqueue(allTracks, ElisaUtils::Track, enqueueMode, triggerPlay); + Q_EMIT entriesToEnqueue(allTracks, ElisaUtils::Track, enqueueMode, triggerPlay); }); } void AllTracksProxyModel::enqueueToPlayList() { genericEnqueueToPlayList(ElisaUtils::AppendPlayList, ElisaUtils::DoNotTriggerPlay); } void AllTracksProxyModel::replaceAndPlayOfPlayList() { genericEnqueueToPlayList(ElisaUtils::ReplacePlayList, ElisaUtils::TriggerPlay); } #include "moc_alltracksproxymodel.cpp" diff --git a/src/models/alltracksproxymodel.h b/src/models/alltracksproxymodel.h index e6cf9680..57b75832 100644 --- a/src/models/alltracksproxymodel.h +++ b/src/models/alltracksproxymodel.h @@ -1,62 +1,62 @@ /* * 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 ALLTRACKSPROXYMODEL_H #define ALLTRACKSPROXYMODEL_H #include "elisaLib_export.h" #include "abstractmediaproxymodel.h" #include "musicaudiotrack.h" #include "elisautils.h" class ELISALIB_EXPORT AllTracksProxyModel : public AbstractMediaProxyModel { Q_OBJECT public: explicit AllTracksProxyModel(QObject *parent = nullptr); ~AllTracksProxyModel() override; Q_SIGNALS: - void trackToEnqueue(const ElisaUtils::EntryDataList &newEntries, - ElisaUtils::PlayListEntryType databaseIdType, - ElisaUtils::PlayListEnqueueMode enqueueMode, - ElisaUtils::PlayListEnqueueTriggerPlay triggerPlay); + 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 // ALLTRACKSPROXYMODEL_H diff --git a/src/models/singlealbumproxymodel.cpp b/src/models/singlealbumproxymodel.cpp index 6dca21e6..79dcdc07 100644 --- a/src/models/singlealbumproxymodel.cpp +++ b/src/models/singlealbumproxymodel.cpp @@ -1,76 +1,76 @@ /* * 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 "singlealbumproxymodel.h" #include "databaseinterface.h" #include #include SingleAlbumProxyModel::SingleAlbumProxyModel(QObject *parent) : AbstractMediaProxyModel(parent) { } SingleAlbumProxyModel::~SingleAlbumProxyModel() = default; bool SingleAlbumProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const { bool result = false; auto currentIndex = sourceModel()->index(source_row, 0, source_parent); const auto &titleValue = sourceModel()->data(currentIndex, DatabaseInterface::ColumnsRoles::TitleRole).toString(); const auto maximumRatingValue = sourceModel()->data(currentIndex, DatabaseInterface::ColumnsRoles::RatingRole).toInt(); if (maximumRatingValue < mFilterRating) { return result; } if (mFilterExpression.match(titleValue).hasMatch()) { result = true; } return result; } void SingleAlbumProxyModel::genericEnqueueToPlayList(ElisaUtils::PlayListEnqueueMode enqueueMode, ElisaUtils::PlayListEnqueueTriggerPlay triggerPlay) { QtConcurrent::run(&mThreadPool, [=] () { QReadLocker locker(&mDataLock); auto allTracks = ElisaUtils::EntryDataList{}; allTracks.reserve(rowCount()); for (int rowIndex = 0, maxRowCount = rowCount(); rowIndex < maxRowCount; ++rowIndex) { auto currentIndex = index(rowIndex, 0); allTracks.push_back(ElisaUtils::EntryData{data(currentIndex, DatabaseInterface::ColumnsRoles::DatabaseIdRole).toULongLong(), data(currentIndex, DatabaseInterface::ColumnsRoles::TitleRole).toString()}); } - Q_EMIT trackToEnqueue(allTracks, ElisaUtils::Track, enqueueMode, triggerPlay); + Q_EMIT entriesToEnqueue(allTracks, ElisaUtils::Track, enqueueMode, triggerPlay); }); } void SingleAlbumProxyModel::enqueueToPlayList() { genericEnqueueToPlayList(ElisaUtils::AppendPlayList, ElisaUtils::DoNotTriggerPlay); } void SingleAlbumProxyModel::replaceAndPlayOfPlayList() { genericEnqueueToPlayList(ElisaUtils::ReplacePlayList, ElisaUtils::TriggerPlay); } #include "moc_singlealbumproxymodel.cpp" diff --git a/src/models/singlealbumproxymodel.h b/src/models/singlealbumproxymodel.h index a01dee54..5ea57e84 100644 --- a/src/models/singlealbumproxymodel.h +++ b/src/models/singlealbumproxymodel.h @@ -1,62 +1,62 @@ /* * 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 SINGLEALBUMPROXYMODEL_H #define SINGLEALBUMPROXYMODEL_H #include "elisaLib_export.h" #include "abstractmediaproxymodel.h" #include "musicaudiotrack.h" #include "elisautils.h" class ELISALIB_EXPORT SingleAlbumProxyModel : public AbstractMediaProxyModel { Q_OBJECT public: explicit SingleAlbumProxyModel(QObject *parent = nullptr); ~SingleAlbumProxyModel() override; Q_SIGNALS: - void trackToEnqueue(const ElisaUtils::EntryDataList &newEntries, - ElisaUtils::PlayListEntryType databaseIdType, - ElisaUtils::PlayListEnqueueMode enqueueMode, - ElisaUtils::PlayListEnqueueTriggerPlay triggerPlay); + 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 // SINGLEALBUMPROXYMODEL_H diff --git a/src/qml/AlbumView.qml b/src/qml/AlbumView.qml index 5e4aa145..4e217a30 100644 --- a/src/qml/AlbumView.qml +++ b/src/qml/AlbumView.qml @@ -1,106 +1,106 @@ /* * 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: albumView + id: viewHeader property alias mainTitle: albumGridView.mainTitle property alias secondaryTitle: albumGridView.secondaryTitle property alias image: albumGridView.image DataModel { id: realModel } SingleAlbumProxyModel { id: proxyModel sourceModel: realModel - onTrackToEnqueue: elisa.mediaPlayList.enqueue(newEntries, databaseIdType, enqueueMode, triggerPlay) + onEntriesToEnqueue: elisa.mediaPlayList.enqueue(newEntries, databaseIdType, enqueueMode, triggerPlay) } ListBrowserView { id: albumGridView anchors.fill: parent contentModel: proxyModel isSubPage: true enableSorting: false delegate: MediaAlbumTrackDelegate { id: entry width: albumGridView.delegateWidth height: ((true && !true) ? elisaTheme.delegateHeight*2 : elisaTheme.delegateHeight) focus: true databaseId: model.databaseId title: model.title artist: model.artist album: (model.album !== undefined && model.album !== '' ? model.album : '') albumArtist: model.albumArtist duration: model.duration imageUrl: (model.imageUrl !== undefined && model.imageUrl !== '' ? model.imageUrl : '') trackNumber: model.trackNumber discNumber: model.discNumber rating: model.rating isFirstTrackOfDisc: true isSingleDiscAlbum: true isAlternateColor: (index % 2) === 1 mediaTrack.onEnqueue: elisa.mediaPlayList.enqueue(databaseId, name, ElisaUtils.Track, ElisaUtils.AppendPlayList, ElisaUtils.DoNotTriggerPlay) mediaTrack.onReplaceAndPlay: elisa.mediaPlayList.enqueue(databaseId, name, ElisaUtils.Track, ElisaUtils.ReplacePlayList, ElisaUtils.TriggerPlay) mediaTrack.onClicked: albumGridView.currentIndex = index } allowArtistNavigation: true onShowArtist: { viewManager.openOneArtist(name, elisaTheme.artistIcon, 0) } onGoBack: viewManager.goBack() } Connections { target: elisa onMusicManagerChanged: realModel.initializeByAlbumTitleAndArtist(elisa.musicManager, ElisaUtils.Track, mainTitle, secondaryTitle) } Component.onCompleted: { if (elisa.musicManager) { realModel.initializeByAlbumTitleAndArtist(elisa.musicManager, ElisaUtils.Track, mainTitle, secondaryTitle) } } } diff --git a/src/qml/AlbumsView.qml b/src/qml/AlbumsView.qml index 27057e23..9d6a4d12 100644 --- a/src/qml/AlbumsView.qml +++ b/src/qml/AlbumsView.qml @@ -1,78 +1,78 @@ /* * 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: allAlbums + id: viewHeader property alias mainTitle: gridView.mainTitle property alias image: gridView.image property var modelType focus: true DataModel { id: realModel } AllAlbumsProxyModel { id: proxyModel sourceModel: realModel - onAlbumToEnqueue: elisa.mediaPlayList.enqueue(newEntries, databaseIdType, enqueueMode, triggerPlay) + onEntriesToEnqueue: elisa.mediaPlayList.enqueue(newEntries, databaseIdType, enqueueMode, triggerPlay) } GridBrowserView { id: gridView focus: true anchors.fill: parent defaultIcon: elisaTheme.albumCoverIcon 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.openOneAlbum(innerMainTitle, innerSecondaryTitle, innerImage, databaseId) onGoBack: viewManager.goBack() } Connections { target: elisa onMusicManagerChanged: realModel.initialize(elisa.musicManager, modelType) } Component.onCompleted: { if (elisa.musicManager) { realModel.initialize(elisa.musicManager, modelType) } } } diff --git a/src/qml/ArtistsView.qml b/src/qml/ArtistsView.qml index 9a7114c7..018f67f8 100644 --- a/src/qml/ArtistsView.qml +++ b/src/qml/ArtistsView.qml @@ -1,81 +1,81 @@ /* * 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: allArtists + id: viewHeader property alias mainTitle: gridView.mainTitle property alias image: gridView.image property var modelType focus: true DataModel { id: realModel } AllArtistsProxyModel { id: proxyModel sourceModel: realModel - onArtistToEnqueue: elisa.mediaPlayList.enqueue(newEntries, databaseIdType, enqueueMode, triggerPlay) + onEntriesToEnqueue: elisa.mediaPlayList.enqueue(newEntries, databaseIdType, enqueueMode, triggerPlay) } GridBrowserView { id: gridView focus: true anchors.fill: parent showRating: false delegateDisplaySecondaryText: false defaultIcon: elisaTheme.artistIcon 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.openOneArtist(innerMainTitle, innerImage, 0) onGoBack: viewManager.goBack() } Connections { target: elisa onMusicManagerChanged: realModel.initialize(elisa.musicManager, modelType) } Component.onCompleted: { if (elisa.musicManager) { realModel.initialize(elisa.musicManager, modelType) } } } diff --git a/src/qml/FrequentlyPlayedTracks.qml b/src/qml/FrequentlyPlayedTracks.qml index 6c3277f6..1527a8af 100644 --- a/src/qml/FrequentlyPlayedTracks.qml +++ b/src/qml/FrequentlyPlayedTracks.qml @@ -1,99 +1,99 @@ /* * 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: localTracks + id: viewHeader property alias mainTitle: listView.mainTitle property alias image: listView.image property var modelType focus: true DataModel { id: realModel } AllTracksProxyModel { id: proxyModel sortRole: DatabaseInterface.PlayFrequency sourceModel: realModel - onTrackToEnqueue: elisa.mediaPlayList.enqueue(newEntries, databaseIdType, enqueueMode, triggerPlay) + onEntriesToEnqueue: elisa.mediaPlayList.enqueue(newEntries, databaseIdType, enqueueMode, triggerPlay) } ListBrowserView { id: listView focus: true anchors.fill: parent contentModel: proxyModel delegate: MediaTrackDelegate { id: entry width: listView.delegateWidth height: elisaTheme.trackDelegateHeight focus: true databaseId: model.databaseId title: model.title artist: model.artist album: (model.album !== undefined && model.album !== '' ? model.album : '') albumArtist: model.albumArtist duration: model.duration imageUrl: (model.imageUrl !== undefined && model.imageUrl !== '' ? model.imageUrl : '') trackNumber: model.trackNumber discNumber: model.discNumber rating: model.rating isFirstTrackOfDisc: false isSingleDiscAlbum: model.isSingleDiscAlbum onEnqueue: elisa.mediaPlayList.enqueue(databaseId, name, modelType, ElisaUtils.AppendPlayList, ElisaUtils.DoNotTriggerPlay) onReplaceAndPlay: elisa.mediaPlayList.enqueue(databaseId, name, modelType, ElisaUtils.ReplacePlayList, ElisaUtils.TriggerPlay) onClicked: contentDirectoryView.currentIndex = index } } Connections { target: elisa onMusicManagerChanged: realModel.initializeFrequentlyPlayed(elisa.musicManager, modelType) } Component.onCompleted: { if (elisa.musicManager) { realModel.initializeFrequentlyPlayed(elisa.musicManager, modelType) } proxyModel.sortModel(Qt.DescendingOrder) } } diff --git a/src/qml/GenresView.qml b/src/qml/GenresView.qml index 7767c3f7..8545e35e 100644 --- a/src/qml/GenresView.qml +++ b/src/qml/GenresView.qml @@ -1,80 +1,80 @@ /* * 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: localGenres + id: viewHeader property alias mainTitle: gridView.mainTitle property alias image: gridView.image property var modelType focus: true DataModel { id: realModel } AllArtistsProxyModel { id: proxyModel sourceModel: realModel - onArtistToEnqueue: elisa.mediaPlayList.enqueue(newEntries, databaseIdType, enqueueMode, triggerPlay) + onEntriesToEnqueue: elisa.mediaPlayList.enqueue(newEntries, databaseIdType, enqueueMode, triggerPlay) } GridBrowserView { id: gridView focus: true anchors.fill: parent showRating: false delegateDisplaySecondaryText: false defaultIcon: elisaTheme.genresIcon 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.openAllArtistsFromGenre(innerMainTitle) onGoBack: viewManager.goBack() } Connections { target: elisa onMusicManagerChanged: realModel.initialize(elisa.musicManager, modelType) } Component.onCompleted: { if (elisa.musicManager) { realModel.initialize(elisa.musicManager, modelType) } } } diff --git a/src/qml/OneArtistView.qml b/src/qml/OneArtistView.qml index eaccab84..80c871bc 100644 --- a/src/qml/OneArtistView.qml +++ b/src/qml/OneArtistView.qml @@ -1,90 +1,90 @@ /* * 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: oneArtist + id: viewHeader property alias mainTitle: gridView.mainTitle property alias secondaryTitle: gridView.secondaryTitle property alias image: gridView.image property string genreFilterText property string artistFilter DataModel { id: realModel } AllAlbumsProxyModel { id: proxyModel sourceModel: realModel - onAlbumToEnqueue: elisa.mediaPlayList.enqueue(newEntries, databaseIdType, enqueueMode, triggerPlay) + onEntriesToEnqueue: elisa.mediaPlayList.enqueue(newEntries, databaseIdType, enqueueMode, triggerPlay) } GridBrowserView { id: gridView focus: true anchors.fill: parent defaultIcon: elisaTheme.albumCoverIcon contentModel: proxyModel isSubPage: true onEnqueue: elisa.mediaPlayList.enqueue(databaseId, name, ElisaUtils.Album, ElisaUtils.AppendPlayList, ElisaUtils.DoNotTriggerPlay) onReplaceAndPlay: elisa.mediaPlayList.enqueue(databaseId, name, ElisaUtils.Album, ElisaUtils.ReplacePlayList, ElisaUtils.TriggerPlay) onOpen: viewManager.openOneAlbum(innerMainTitle, innerSecondaryTitle, innerImage, databaseId) onGoBack: viewManager.goBack() } Connections { target: elisa onMusicManagerChanged: { if (genreFilterText) { realModel.initializeByGenreAndArtist(elisa.musicManager, ElisaUtils.Album, genreFilterText, artistFilter) } else { realModel.initializeByArtist(elisa.musicManager, ElisaUtils.Album, artistFilter) } } } Component.onCompleted: { if (elisa.musicManager) { if (genreFilterText) { realModel.initializeByGenreAndArtist(elisa.musicManager, ElisaUtils.Album, genreFilterText, artistFilter) } else { realModel.initializeByArtist(elisa.musicManager, ElisaUtils.Album, artistFilter) } } } } diff --git a/src/qml/OneGenreView.qml b/src/qml/OneGenreView.qml index f3081ff8..bf0ea35c 100644 --- a/src/qml/OneGenreView.qml +++ b/src/qml/OneGenreView.qml @@ -1,81 +1,81 @@ /* * 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: oneGenre + id: viewHeader property alias mainTitle: gridView.mainTitle property alias secondaryTitle: gridView.secondaryTitle property alias image: gridView.image property string genreFilterText DataModel { id: realModel } AllArtistsProxyModel { id: proxyModel sourceModel: realModel - onArtistToEnqueue: elisa.mediaPlayList.enqueue(newEntries, databaseIdType, enqueueMode, triggerPlay) + onEntriesToEnqueue: elisa.mediaPlayList.enqueue(newEntries, databaseIdType, enqueueMode, triggerPlay) } GridBrowserView { id: gridView contentModel: proxyModel focus: true anchors.fill: parent defaultIcon: elisaTheme.artistIcon delegateDisplaySecondaryText: false isSubPage: true onEnqueue: elisa.mediaPlayList.enqueue(databaseId, name, ElisaUtils.Artist, ElisaUtils.AppendPlayList, ElisaUtils.DoNotTriggerPlay) onReplaceAndPlay: elisa.mediaPlayList.enqueue(databaseId, name, ElisaUtils.Artist, ElisaUtils.ReplacePlayList, ElisaUtils.TriggerPlay) onOpen: viewManager.openOneArtist(innerMainTitle, innerImage, 0) onGoBack: viewManager.goBack() } Connections { target: elisa onMusicManagerChanged: realModel.initializeByGenre(elisa.musicManager, ElisaUtils.Artist, genreFilterText) } Component.onCompleted: { if (elisa.musicManager) { realModel.initializeByGenre(elisa.musicManager, ElisaUtils.Artist, genreFilterText) } } } diff --git a/src/qml/RecentlyPlayedTracks.qml b/src/qml/RecentlyPlayedTracks.qml index ae965873..a7057422 100644 --- a/src/qml/RecentlyPlayedTracks.qml +++ b/src/qml/RecentlyPlayedTracks.qml @@ -1,99 +1,99 @@ /* * 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: localTracks + id: viewHeader property alias mainTitle: listView.mainTitle property alias image: listView.image property var modelType focus: true DataModel { id: realModel } AllTracksProxyModel { id: proxyModel sortRole: DatabaseInterface.LastPlayDate sourceModel: realModel - onTrackToEnqueue: elisa.mediaPlayList.enqueue(newEntries, databaseIdType, enqueueMode, triggerPlay) + onEntriesToEnqueue: elisa.mediaPlayList.enqueue(newEntries, databaseIdType, enqueueMode, triggerPlay) } ListBrowserView { id: listView focus: true anchors.fill: parent contentModel: proxyModel delegate: MediaTrackDelegate { id: entry width: listView.delegateWidth height: elisaTheme.trackDelegateHeight focus: true databaseId: model.databaseId title: model.title artist: model.artist album: (model.album !== undefined && model.album !== '' ? model.album : '') albumArtist: model.albumArtist duration: model.duration imageUrl: (model.imageUrl !== undefined && model.imageUrl !== '' ? model.imageUrl : '') trackNumber: model.trackNumber discNumber: model.discNumber rating: model.rating isFirstTrackOfDisc: false isSingleDiscAlbum: model.isSingleDiscAlbum onEnqueue: elisa.mediaPlayList.enqueue(databaseId, name, modelType, ElisaUtils.AppendPlayList, ElisaUtils.DoNotTriggerPlay) onReplaceAndPlay: elisa.mediaPlayList.enqueue(databaseId, name, modelType, ElisaUtils.ReplacePlayList, ElisaUtils.TriggerPlay) onClicked: contentDirectoryView.currentIndex = index } } Connections { target: elisa onMusicManagerChanged: realModel.initializeRecentlyPlayed(elisa.musicManager, modelType) } Component.onCompleted: { if (elisa.musicManager) { realModel.initializeRecentlyPlayed(elisa.musicManager, modelType) } proxyModel.sortModel(Qt.DescendingOrder) } } diff --git a/src/qml/TracksView.qml b/src/qml/TracksView.qml index cc37eb1c..ca1209a6 100644 --- a/src/qml/TracksView.qml +++ b/src/qml/TracksView.qml @@ -1,97 +1,97 @@ /* * 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: localTracks + id: viewHeader property alias mainTitle: listView.mainTitle property alias image: listView.image property var modelType focus: true DataModel { id: realModel } AllTracksProxyModel { id: proxyModel sortRole: Qt.DisplayRole sourceModel: realModel - onTrackToEnqueue: elisa.mediaPlayList.enqueue(newEntries, databaseIdType, enqueueMode, triggerPlay) + onEntriesToEnqueue: elisa.mediaPlayList.enqueue(newEntries, databaseIdType, enqueueMode, triggerPlay) } ListBrowserView { id: listView focus: true anchors.fill: parent contentModel: proxyModel delegate: MediaTrackDelegate { id: entry width: listView.delegateWidth height: elisaTheme.trackDelegateHeight focus: true databaseId: model.databaseId title: model.title artist: model.artist album: (model.album !== undefined && model.album !== '' ? model.album : '') albumArtist: model.albumArtist duration: model.duration imageUrl: (model.imageUrl !== undefined && model.imageUrl !== '' ? model.imageUrl : '') trackNumber: model.trackNumber discNumber: model.discNumber rating: model.rating isFirstTrackOfDisc: false isSingleDiscAlbum: model.isSingleDiscAlbum onEnqueue: elisa.mediaPlayList.enqueue(databaseId, name, modelType, ElisaUtils.AppendPlayList, ElisaUtils.DoNotTriggerPlay) onReplaceAndPlay: elisa.mediaPlayList.enqueue(databaseId, name, modelType, ElisaUtils.ReplacePlayList, ElisaUtils.TriggerPlay) onClicked: contentDirectoryView.currentIndex = index } } Connections { target: elisa onMusicManagerChanged: realModel.initialize(elisa.musicManager, modelType) } Component.onCompleted: { if (elisa.musicManager) { realModel.initialize(elisa.musicManager, modelType) } } }