-
Notifications
You must be signed in to change notification settings - Fork 351
/
Copy pathsession.h
70 lines (51 loc) · 1.87 KB
/
session.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
#ifndef Header_Session
#define Header_Session
#include "bookmarks.h"
#include "mostQtHeaders.h"
struct FileInSession
{
QString fileName;
int editorGroup;
int cursorLine;
int cursorCol;
int firstLine;
QList<int> foldedLines;
};
Q_DECLARE_METATYPE(FileInSession)
class ConfigManager;
class Session
{
public:
Session(): m_pdfEmbedded(false) {}
Session(const Session &s);
Session & operator=(const Session &) = default; // Avoid GCC9 -Wdeprecated-copy warning
bool load(const QString &fileName);
bool save(const QString &fileName, bool relPaths=true) const;
const QList<FileInSession> files() const { return m_files; }
void addFile(FileInSession f);
void setMasterFile(const QString &file) { m_masterFile = file; }
QString masterFile() const { return m_masterFile; }
void setCurrentFile(const QString &file) { m_currentFile = file; }
QString currentFile() const { return m_currentFile; }
void setBookmarks(const QList<Bookmark> &bookmarkList) { m_bookmarks = bookmarkList; }
QList<Bookmark> bookmarks() const { return m_bookmarks; }
void setPDFFile(const QString &pdf) { m_pdfFile = pdf; }
QString PDFFile() const { return m_pdfFile; }
void setPDFEmbedded(bool b) { m_pdfEmbedded = b; }
bool PDFEmbedded() const { return m_pdfEmbedded; }
void setSplitVertical(bool setting) { m_splitVertical = setting; }
bool getSplitVertical() const { return m_splitVertical; }
static QString fileExtension() { return QString("txss2"); }
static QString fmtPath(const QDir &dir, const QString &file, bool relPath=true);
private:
bool load_v1(const QString &file);
bool load_v2(const QString &file);
QList<FileInSession> m_files;
QString m_masterFile;
QString m_currentFile;
QList<Bookmark> m_bookmarks;
QString m_pdfFile;
bool m_pdfEmbedded;
bool m_splitVertical;
};
#endif // SESSION_H