-
Notifications
You must be signed in to change notification settings - Fork 0
/
directoryinfomanager.h
61 lines (47 loc) · 1.48 KB
/
directoryinfomanager.h
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
#ifndef DIRECTORYINFOMANAGER_H
#define DIRECTORYINFOMANAGER_H
#include <QObject>
#include <QDebug>
#include <QList>
#include <QDir>
#include <QFileInfoList>
#include <QDataStream>
#include <QMetaProperty>
class DirectoryInfo;
//Q_DECLARE_METATYPE(QList<DirectoryInfo>)
class DirectoryInfoManager : public QObject
{
Q_OBJECT
Q_PROPERTY(QList<DirectoryInfo> directoryList READ getDirectoryList WRITE setDirectoryList NOTIFY directoryListChanged)
public:
DirectoryInfoManager();
DirectoryInfoManager(QString&);
DirectoryInfoManager(const DirectoryInfoManager&);
QList<DirectoryInfo> getDirectoryList() const { return directoryList; }
void setDirectoryList(QList<DirectoryInfo> newDirectoryList){
directoryList = newDirectoryList;
}
private:
QList<DirectoryInfo> directoryList;
signals:
void directoryListChanged();
};
class DirectoryInfo : public QObject
{
Q_OBJECT
Q_PROPERTY(QString name READ getName WRITE setName NOTIFY nameChanged)
public:
DirectoryInfo();
DirectoryInfo(const DirectoryInfo&);
QString getName() const { return name; }
void setName(QString newName) { name = newName; }
private:
QString name;
signals:
void nameChanged();
};
QDataStream &operator<<(QDataStream&, const DirectoryInfoManager&);
QDataStream &operator>>(QDataStream&, DirectoryInfoManager&);
QDataStream &operator<<(QDataStream&, const DirectoryInfo&);
QDataStream &operator>>(QDataStream&, DirectoryInfo&);
#endif // DIRECTORYINFOMANAGER_H