-
Notifications
You must be signed in to change notification settings - Fork 0
/
filedreader.h
71 lines (47 loc) · 1.76 KB
/
filedreader.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
62
63
64
65
66
67
68
69
70
71
#ifndef FILEDREADER_H
#define FILEDREADER_H
#include <QAbstractListModel>
#include <QFile>
#include <iostream>
#include <fstream>
#include <QTextStream>
#include <string>
#include <vector>
#include <QColor>
class FileDreader : public QAbstractListModel
{
Q_OBJECT
private:
QString pathNotesNames = "/home/andrew/Документи/data/notesNames";
QString pathArchiveNotesNames = "/home/andrew/Документи/data/archiveNotesNames";
QString pathNotes = "/home/andrew/Документи/data/notes/";
QString pathArchiveNotes = "/home/andrew/Документи/data/archive/";
std::vector<QString> notesName;
std::vector<QString> notesText;
std::vector<QColor> notesColor;
std::vector<QString> archiveNotesName;
std::vector<QString> archiveNotesText;
std::vector<QColor> archiveNotesColor;
int countOfFiles = -1;
int saveIndex = -1;
public:
explicit FileDreader(QObject* parent = nullptr);
void initNotes();
void initArchiveNotes();
int rowCount( const QModelIndex& parent ) const override;
QVariant data( const QModelIndex& index, int role ) const override;
Q_INVOKABLE int getSize();
Q_INVOKABLE int getArchiveSize();
Q_INVOKABLE QString getText(int index = -1);
Q_INVOKABLE QColor getNoteColor(int index);
Q_INVOKABLE QString getArchiveNoteText(int index = -1);
Q_INVOKABLE QColor getArchiveNoteColor(int index);
Q_INVOKABLE void saveThisIndex(int index);
Q_INVOKABLE void save(int index, QString text, QColor color);
Q_INVOKABLE void archive(int index);
Q_INVOKABLE void unarchive(int index);
Q_INVOKABLE void removeFromAll(int index);
Q_INVOKABLE void removeFromArchive(int index);
//void removeName(QString line);
};
#endif // FILEDREADER_H