Sayonara Player
Toggle main menu visibility
Loading...
Searching...
No Matches
src
Gui
Library
ItemModel.h
1
/* ItemModel.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 LIBRARYITEMMODEL_H_
22
#define LIBRARYITEMMODEL_H_
23
24
#include "Gui/Utils/SearchableWidget/SearchableModel.h"
25
#include "Utils/Pimpl.h"
26
27
#include <QModelIndex>
28
29
namespace
Cover
30
{
31
class
Location
;
32
}
33
34
class
AbstractLibrary
;
35
36
namespace
Library
37
{
38
class
ItemModel :
39
public
SearchableTableModel
40
{
41
Q_OBJECT
42
PIMPL(ItemModel)
43
44
public
:
45
ItemModel(
int
columnCount, QObject* parent,
AbstractLibrary
* library);
46
~ItemModel()
override
;
47
48
[[nodiscard]] QVariant
49
headerData(
int
section, Qt::Orientation orientation,
int
role = Qt::DisplayRole)
const override
;
50
51
bool
setHeaderData(
int
section, Qt::Orientation orientation,
const
QVariant& value,
52
int
role = Qt::EditRole)
override
;
53
54
[[nodiscard]]
int
columnCount(
const
QModelIndex& parent = QModelIndex())
const override
;
55
56
[[nodiscard]]
virtual
Id mapIndexToId(
int
row)
const
= 0;
57
58
[[nodiscard]]
virtual
Cover::Location
cover(
const
QModelIndexList& indexList)
const
= 0;
59
60
[[nodiscard]]
virtual
const
MetaDataList
& selectedMetadata()
const
= 0;
61
62
[[nodiscard]] QMimeData* mimeData(
const
QModelIndexList& indexList)
const override
;
63
64
[[nodiscard]]
virtual
QString mergeSuggestion(
int
row)
const
;
65
66
virtual
void
refreshData();
67
68
protected
:
69
[[nodiscard]]
AbstractLibrary
* library();
70
[[nodiscard]]
const
AbstractLibrary
* library()
const
;
71
72
private
:
73
bool
removeRows(
int
position,
int
rows,
const
QModelIndex& index = QModelIndex())
override
;
74
bool
insertRows(
int
row,
int
count,
const
QModelIndex& parent = QModelIndex())
override
;
75
};
76
}
77
78
#endif
/* LIBRARYITEMMODEL_H_ */
AbstractLibrary
Definition
AbstractLibrary.h:41
Cover::Location
Definition
CoverLocation.h:39
MetaDataList
Definition
MetaDataList.h:34
Generated on
for Sayonara Player by
1.17.0