Sayonara Player
Toggle main menu visibility
Loading...
Searching...
No Matches
src
Gui
Library
DirectoryView
FileListModel.h
1
/* FileListModel.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 FILE_LIST_MODEL_H
22
#define FILE_LIST_MODEL_H
23
24
#include "Gui/Utils/SearchableWidget/SearchableModel.h"
25
#include "Utils/Pimpl.h"
26
27
#include <QModelIndex>
28
29
class
QPixmap;
30
class
QVariant;
31
32
class
LocalLibrary
;
33
34
namespace
Directory
35
{
36
class
IconWorkerThread :
37
public
QObject
38
{
39
Q_OBJECT
40
PIMPL(IconWorkerThread)
41
42
signals:
43
void
sigFinished(
const
QString& path);
44
45
public
:
46
IconWorkerThread(
const
QSize& targetSize,
const
QString& filename);
47
~IconWorkerThread()
override
;
48
49
[[nodiscard]] QPixmap pixmap()
const
;
50
51
public
slots:
52
void
start();
53
};
54
55
class
FileListModel :
56
public
SearchableTableModel
57
{
58
Q_OBJECT
59
PIMPL(FileListModel)
60
61
public
:
62
explicit
FileListModel(
LocalLibrary
* localLibrary, QObject* parent =
nullptr
);
63
~FileListModel()
override
;
64
65
[[nodiscard]] QString parentDirectory()
const
;
66
void
setParentDirectory(
const
QString& dir);
67
68
[[nodiscard]] LibraryId libraryId()
const
;
69
[[nodiscard]] QStringList files()
const
;
70
71
[[nodiscard]] QVariant data(
const
QModelIndex& index,
int
role = Qt::DisplayRole)
const override
;
72
[[nodiscard]] QVariant headerData(
int
section, Qt::Orientation orientation,
int
role)
const override
;
73
74
[[nodiscard]]
int
rowCount(
const
QModelIndex& parent = QModelIndex())
const override
;
75
[[nodiscard]]
int
columnCount(
const
QModelIndex& parent = QModelIndex())
const override
;
76
77
[[nodiscard]] QMimeData* mimeData(
const
QModelIndexList& indexes)
const override
;
78
[[nodiscard]] Qt::ItemFlags flags(
const
QModelIndex& index)
const override
;
79
80
[[nodiscard]]
int
itemCount()
const override
;
81
[[nodiscard]] QString searchableString(
int
index,
const
QString& prefix)
const override
;
82
83
private
slots:
84
void
pixmapFetched(
const
QString& path);
85
};
86
}
87
88
#endif
LocalLibrary
Definition
LocalLibrary.h:38
Generated on
for Sayonara Player by
1.17.0