Sayonara Player
Loading...
Searching...
No Matches
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
29class QPixmap;
30class QVariant;
31
32class LocalLibrary;
33
34namespace Directory
35{
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);
48
49 QPixmap pixmap() const;
50
51 public slots:
52 void start();
53 };
54
61 {
62 Q_OBJECT
63 PIMPL(FileListModel)
64
65 public:
66 explicit FileListModel(LocalLibrary* localLibrary, QObject* parent = nullptr);
67 ~FileListModel() override;
68
69 QString parentDirectory() const;
70 void setParentDirectory(const QString& dir);
71
72 LibraryId libraryId() const;
73 QStringList files() const;
74
75 QModelIndexList searchResults(const QString& substr) override;
76
77 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
78 QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
79
80 int rowCount(const QModelIndex& parent = QModelIndex()) const override;
81 int columnCount(const QModelIndex& parent = QModelIndex()) const override;
82
83 QMimeData* mimeData(const QModelIndexList& indexes) const override;
84 Qt::ItemFlags flags(const QModelIndex& index) const override;
85
86 private:
87 bool checkRowForSearchstring(int row, const QString& substr) const;
88
89 private slots:
90 void pixmapFetched(const QString& path);
91 };
92}
93
94#endif
The FileListModel class.
Definition: FileListModel.h:61
Definition: FileListModel.h:38
Definition: LocalLibrary.h:38
Definition: SearchableModel.h:50