-
Notifications
You must be signed in to change notification settings - Fork 0
/
notefile.h
executable file
·104 lines (83 loc) · 2.7 KB
/
notefile.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/* This file is part of Misli.
Misli is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Misli is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Misli. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef NOTEFILE_H
#define NOTEFILE_H
#include "note.h"
#include "util.h"
#include <QObject>
class Library;
class NoteFile : public QObject
{
Q_OBJECT
Q_PROPERTY(QString filePath READ filePath WRITE setPathAndLoad NOTIFY filePathChanged)
public:
//Functions
NoteFile();
~NoteFile();
QString name();
Note *getFirstSelectedNote();
Note *getLowestIdNote();
Note *getNoteById(int id);
void selectAllNotes();
void clearNoteSelection();
void clearLinkSelection();
int linkSelectedNotesTo(Note *nt);
void arrangeLinksGeometry(Note *nt);
void checkForInvalidLinks(Note *nt);
void makeCoordsRelativeTo(double x,double y);
void makeAllIDsNegative();
int getNewId();
void addNote(Note* nt);
Note *loadNote(Note* nt);
Note *cloneNote(Note* nt);
void deleteSelected();
int loadFromFilePath();
int loadFromIniString(QString fileString);
void loadFromJsonString(QString jsonString);
bool loadFileAsJson();
QString toIniString();
QString toJsonString();
void saveStateToHistory();
void saveLastInHistoryToFile();
void undo();
void redo();
//Properties
QString filePath();
//Variables
QList<Note*> notes; //all the notes are stored here
int lastNoteId;
std::vector<QString> comment; //the comments in the file
QString filePath_m; //note file path
double eyeX, eyeY, eyeZ; //camera position for the GUI cases (can't be QPointF, it has z)
QStringList undoHistory, redoHistory; //The current state is on the back of undoHistory
bool isDisplayedFirstOnStartup;
bool isTimelineNoteFile;
bool isReadable;
bool saveWithRequest;
bool keepHistoryViaGit;
bool indexedForSearch;
signals:
//Property changes
void filePathChanged(QString);
//Other
void visualChange();
void requestingSave(NoteFile*);
void noteTextChanged(NoteFile*);
public slots:
//Set properties
void setPathAndLoad(QString newPath);
//Other
void save();
void arrangeLinksGeometry();
};
#endif // NOTEFILE_H