Sayonara Player
Toggle main menu visibility
Loading...
Searching...
No Matches
src
Gui
Library
CoverView
CoverModel.h
1
/* CoverModel.h */
2
3
/* Copyright (C) 2011-2024 Michael Lugmair (Lucio Carreras)
4
*
5
* This file is part of sayonara player
6
*
7
* This program is free software: you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation, either version 3 of the License, or
10
* (at your option) any later version.
11
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
16
17
* You should have received a copy of the GNU General Public License
18
* along with this program. If not, see <http://www.gnu.org/licenses/>.
19
*/
20
21
#ifndef ALBUMCOVERMODEL_H
22
#define ALBUMCOVERMODEL_H
23
24
#include "Gui/Library/ItemModel.h"
25
#include "Utils/Pimpl.h"
26
#include <QtGlobal>
27
28
class
Album
;
29
class
AlbumList
;
30
31
class
QSize;
32
33
namespace
Cover
34
{
35
class
Location
;
36
class
Lookup
;
37
}
38
39
namespace
Library
40
{
41
class
CoverModel :
42
public
ItemModel
43
{
44
Q_OBJECT
45
PIMPL(CoverModel)
46
47
public
:
48
enum
Role
49
{
50
AlbumRole = Qt::UserRole,
51
ArtistRole = Qt::UserRole + 1,
52
CoverRole = Qt::UserRole + 2,
53
YearRole = Qt::UserRole + 3,
54
DurationRole = Qt::UserRole + 4
55
};
56
57
explicit
CoverModel(QObject* parent,
AbstractLibrary
* library);
58
~CoverModel()
override
;
59
60
[[nodiscard]]
int
rowCount(
const
QModelIndex& parent = QModelIndex())
const override
;
61
[[nodiscard]]
int
columnCount(
const
QModelIndex& paren = QModelIndex())
const override
;
62
[[nodiscard]] QVariant data(
const
QModelIndex& index,
int
role)
const override
;
63
[[nodiscard]] Qt::ItemFlags flags(
const
QModelIndex& index)
const override
;
64
[[nodiscard]] QModelIndex
65
index(
int
row,
int
column,
const
QModelIndex& parent = QModelIndex())
const override
;
66
67
[[nodiscard]] QSize itemSize()
const
;
68
[[nodiscard]]
int
zoom()
const
;
69
70
[[nodiscard]] QString mergeSuggestion(
int
index)
const override
;
71
72
protected
:
73
[[nodiscard]]
const
MetaDataList
& selectedMetadata()
const override
;
74
[[nodiscard]]
int
mapIndexToId(
int
index)
const override
;
75
[[nodiscard]]
Cover::Location
cover(
const
QModelIndexList& indexes)
const override
;
76
[[nodiscard]]
int
itemCount()
const override
;
77
[[nodiscard]] QString searchableString(
int
index,
const
QString& prefix)
const override
;
78
[[nodiscard]]
QMap<QString, QString>
searchOptions()
const override
;
79
80
private
:
81
[[nodiscard]]
const
AlbumList
& albums()
const
;
82
bool
insertRows(
int
row,
int
count,
const
QModelIndex& parent = QModelIndex())
override
;
83
bool
removeRows(
int
row,
int
count,
const
QModelIndex& parent = QModelIndex())
override
;
84
bool
insertColumns(
int
column,
int
count,
const
QModelIndex& parent = QModelIndex())
override
;
85
bool
removeColumns(
int
column,
int
count,
const
QModelIndex& parent = QModelIndex())
override
;
86
void
refreshData()
override
;
87
88
public
slots:
89
void
setZoom(
int
zoom, QSize view_size);
90
void
reload();
91
void
clear();
92
93
private
slots:
94
void
nextHash();
95
void
coverLookupFinished(
bool
success);
96
void
showArtistsChanged();
97
};
98
}
99
100
#endif
// ALBUMCOVERMODEL_H
AbstractLibrary
Definition
AbstractLibrary.h:41
AlbumList
Definition
Album.h:91
Album
Definition
Album.h:37
Cover::Location
Definition
CoverLocation.h:39
Cover::Lookup
The CoverLookup class.
Definition
CoverLookup.h:50
MetaDataList
Definition
MetaDataList.h:34
QMap
Definition
org_mpris_media_player2_adaptor.h:21
Generated on
for Sayonara Player by
1.17.0