-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmainwindow.h
More file actions
52 lines (42 loc) · 1.28 KB
/
Copy pathmainwindow.h
File metadata and controls
52 lines (42 loc) · 1.28 KB
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
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <qmainwindow.h>
#include <qboxlayout.h>
#include <QFileSystemModel>
#include <QTreeView>
#include <QTextDocument>
#include <QLabel>
#include "GTextEdit.h"
class MainWindow : public QWidget{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = nullptr);
private:
void setupToolbar(QVBoxLayout* layout);
void setupOptionsDialog();
void setupTreeView(QString path);
void showTreeViewContextMenu(const QPoint &pos);
private slots:
void setFontSize(int font_size);
void createFile(QDir dir, QString filename);
void deleteFile(const QModelIndex &index);
void createFolder(QDir dir, QString folderName);
void openFile(QString filename);
void saveFile(QString filename);
void openFileDialog();
void saveFileDialog();
void saveCurrentFile();
void setCurrentFilePath(QString filename);
void setDocNameHints();
private:
QFont m_mainFont;
static constexpr int m_default_font_pt = 11;
QHash<QString, QTextDocument*> m_documentCache;
QString m_currentFilePath;
GTextEdit *m_editor = nullptr;
QLabel *m_docName = nullptr;
QFileSystemModel *m_fileModel = nullptr;
QTreeView *m_treeView = nullptr;
QDialog *m_optionsDialog = nullptr;
};
#endif // MAINWINDOW_H