forked from n9dyfi/TextEditor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtexteditor.h
69 lines (56 loc) · 1.94 KB
/
texteditor.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
#ifndef TEXTEDITOR_H
#define TEXTEDITOR_H
#include <QDeclarativeItem>
#include <QFile>
//#include <QDesktopServices>
#include "recentfiles.h"
#include "qmlapplicationviewer.h"
#define SAVE 0
#define SAVE_AS 1
class TextEditor : public QObject
{
Q_OBJECT
public:
explicit TextEditor(QObject *qml, RecentFiles *recentfiles, QObject *parent = 0);
private:
static const char *UNTITLED; // default file name for File>New
QString currentFolder;
QString currentFile;
QString currentContent;
// File info for open/save as, copied to current if operation is succesfull
QString newFolder;
QString newFile;
RecentFiles *recentFiles;
private slots:
void saveCurrentContent(int);
public slots:
void menuNewClicked(QString);
void menuOpenClicked(QString);
void menuSaveAsClicked();
void menuQuitClicked(QString);
void toolSaveClicked(QString);
void toolRecentClicked();
void saveAsRequested(QString,QString);
void newFolderChanged(QString);
void fileOpenRequested(QString);
void saveAsConfirmed(QString);
void newOrOpenConfirmed(QString);
void openRecentConfirmed();
void saveBeforeClosed(QString);
void recentFileClicked(QString,QString,QString);
signals:
void browseRequested(QString currentFolder, bool saveRequested);
void recentRequested();
void openCompleted(QString content, QString currentFolder, QString currentFile);
void openFailed(QString fileName, QString errorString);
void saveCompleted();
void saveFailed(QString fileName, QString errorString);
void saveAsCompleted(QString currentFolder, QString currentFile);
void saveAsToBeConfirmed(QString fileName);
void newOrOpenToBeConfirmed(QString op, QString fileName);
void openRecentToBeConfirmed(QString fileName);
void appCloseToBeConfirmed(QString fileName);
void appToBeClosed();
void editorCleared(QString currentFolder, QString currentFile);
};
#endif // TEXTEDITOR_H