Commit 345a9faa authored by Alexander Stippich's avatar Alexander Stippich
Browse files

delete unused file

parent 2281a0e7
......@@ -26,7 +26,6 @@ set(elisaLib_SOURCES
models/abstractmediaproxymodel.cpp
models/gridviewproxymodel.cpp
models/alltracksproxymodel.cpp
models/singlealbumproxymodel.cpp
models/trackmetadatamodel.cpp
models/editabletrackmetadatamodel.cpp
models/trackcontextmetadatamodel.cpp
......
......@@ -53,7 +53,6 @@
#include "models/viewsmodel.h"
#include "models/gridviewproxymodel.h"
#include "models/alltracksproxymodel.h"
#include "models/singlealbumproxymodel.h"
#include "localFileConfiguration/elisaconfigurationdialog.h"
#if defined KF5FileMetaData_FOUND && KF5FileMetaData_FOUND
......@@ -131,7 +130,6 @@ void ElisaQmlTestPlugin::registerTypes(const char *uri)
qmlRegisterType<ViewsModel>(uri, 1, 0, "ViewsModel");
qmlRegisterType<GridViewProxyModel>(uri, 1, 0, "GridViewProxyModel");
qmlRegisterType<AllTracksProxyModel>(uri, 1, 0, "AllTracksProxyModel");
qmlRegisterType<SingleAlbumProxyModel>(uri, 1, 0, "SingleAlbumProxyModel");
#if defined KF5KIO_FOUND && KF5KIO_FOUND
qmlRegisterType<FileBrowserModel>(uri, 1, 0, "FileBrowserModel");
......
/*
* Copyright 2017 Alexander Stippich <a.stippich@gmx.net>
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "singlealbumproxymodel.h"
#include "datatypes.h"
#include <QReadLocker>
#include <QtConcurrent>
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, DataTypes::ColumnsRoles::TitleRole).toString();
const auto maximumRatingValue = sourceModel()->data(currentIndex, DataTypes::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, DataTypes::FullDataRole).value<DataTypes::TrackDataType>(),
data(currentIndex, DataTypes::ColumnsRoles::TitleRole).toString(), {}});
}
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"
/*
* Copyright 2017 Alexander Stippich <a.stippich@gmx.net>
* Copyright 2018 Matthieu Gallien <matthieu_gallien@yahoo.fr>
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef SINGLEALBUMPROXYMODEL_H
#define SINGLEALBUMPROXYMODEL_H
#include "elisaLib_export.h"
#include "abstractmediaproxymodel.h"
#include "elisautils.h"
class ELISALIB_EXPORT SingleAlbumProxyModel : public AbstractMediaProxyModel
{
Q_OBJECT
public:
explicit SingleAlbumProxyModel(QObject *parent = nullptr);
~SingleAlbumProxyModel() override;
Q_SIGNALS:
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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment