blob: 40e9875331ed40aff9cfcbc0991b7a6e1a4d20a2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
//===========================================
// Lumina-DE source code
// Copyright (c) 2016, Ken Moore
// Available under the 3-clause BSD license
// See the LICENSE file for full details
//===========================================
// This is the main browsing backend for the file manager
//===========================================
#ifndef _LUMINA_FM_BROWSE_BACKEND_H
#define _LUMINA_FM_BROWSE_BACKEND_H
#include <QObject>
#include <QString>
#include <QFileSystemWatcher>
#include <QIcon>
//#include <QFutureWatcher>
#include <LuminaXDG.h>
/*class FileItem{
public:
QString name;
QByteArray icon;
FileItem(){}
~FileItem(){};
};*/
class Browser : public QObject{
Q_OBJECT
public:
Browser(QObject *parent = 0);
~Browser();
QString currentDirectory();
void showHiddenFiles(bool);
bool showingHiddenFiles();
void showThumbnails(bool);
bool showingThumbnails();
//FileItem loadItem(QString info); //this is the main loader class - multiple instances each run in a separate thread
private:
QString currentDir;
QFileSystemWatcher *watcher;
bool showHidden, showThumbs;
QStringList imageFormats, oldFiles;
QHash<QString, QIcon> mimeIcons; //cache for quickly re-using QIcons
void loadItem(QString info, Browser *obj); //this is the main loader class - multiple instances each run in a separate thread
QIcon loadIcon(QString icon); //simplification for using/populating the mimIcons cache
private slots:
void fileChanged(QString); //tied into the watcher - for file change notifications
void dirChanged(QString); // tied into the watcher - for new/removed files in the current dir
void futureFinished(QString, QImage);
public slots:
void loadDirectory(QString dir = "");
signals:
//Main Signals
void itemRemoved(QString item); //emitted if a file was removed from the underlying
void clearItems(); //emitted when dirs change for example
void itemDataAvailable(QIcon, LFileInfo);
//Start/Stop signals for loading of data
void itemsLoading(int); //number of items which are getting loaded
//Internal signal for the alternate threads
void threadDone(QString, QImage);
};
#endif
|