Sayonara Player
Toggle main menu visibility
Loading...
Searching...
No Matches
src
Gui
Library
DirectoryView
DirectoryModel.h
1
2
/* Copyright (C) 2011-2024 Michael Lugmair (Lucio Carreras)
3
*
4
* This file is part of sayonara player
5
*
6
* This program is free software: you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation, either version 3 of the License, or
9
* (at your option) any later version.
10
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
15
16
* You should have received a copy of the GNU General Public License
17
* along with this program. If not, see <http://www.gnu.org/licenses/>.
18
*/
19
20
#ifndef SEARCHABLEFILETREEMODEL_H
21
#define SEARCHABLEFILETREEMODEL_H
22
23
#include "Gui/Utils/SearchableWidget/SearchableModel.h"
24
#include "Utils/Pimpl.h"
25
26
#include <QTreeView>
27
#include <QFileSystemModel>
28
#include <QSortFilterProxyModel>
29
30
namespace
Library
31
{
32
class
Info
;
33
class
InfoAccessor
;
34
}
35
36
namespace
Directory
37
{
42
class
Model :
43
public
QSortFilterProxyModel
44
{
45
Q_OBJECT
46
PIMPL(Model)
47
48
signals:
49
void
sigBusy(
bool
b);
50
51
public
:
52
explicit
Model(
Library::InfoAccessor
* libraryInfoAccessor, QObject* parent =
nullptr
);
53
~Model()
override
;
54
55
QModelIndex setDataSource(LibraryId libraryId);
56
QModelIndex setDataSource(
const
QString& path);
57
LibraryId libraryDataSource()
const
;
58
59
QString filePath(
const
QModelIndex& index)
const
;
60
QModelIndex indexOfPath(
const
QString& path)
const
;
61
62
void
setFilter(
const
QString& filter);
63
64
int
columnCount(
const
QModelIndex& parent)
const override
;
65
QMimeData* mimeData(
const
QModelIndexList& indexes)
const override
;
66
67
private
slots:
68
void
filterTimerTimeout();
69
70
protected
:
71
using
QSortFilterProxyModel::setFilterRegExp;
72
using
QSortFilterProxyModel::setFilterWildcard;
73
using
QSortFilterProxyModel::setFilterFixedString;
74
75
bool
filterAcceptsRow(
int
sourceRow,
const
QModelIndex& sourceParent)
const override
;
76
};
77
}
78
79
#endif
// SEARCHABLEFileTreeView_H
Library::InfoAccessor
Definition
LibraryManager.h:36
Library::Info
The Info class.
Definition
LibraryInfo.h:38
Generated on
for Sayonara Player by
1.17.0