-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainWindow.h
More file actions
158 lines (99 loc) · 2.86 KB
/
MainWindow.h
File metadata and controls
158 lines (99 loc) · 2.86 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
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
#ifndef OPENNOTE_LINUX_MAINWINDOW_H
#define OPENNOTE_LINUX_MAINWINDOW_H
#pragma once
#include <QActionGroup>
#include <QLabel>
#include <QMainWindow>
#include <QSplitter>
#include <QTimer>
#include "EditorTabWidget.h"
#include "FileTreeWidget.h"
#include "Language.h"
class FindReplaceDialog;
class PreferencesDialog;
class MainWindow : public QMainWindow {
Q_OBJECT
public:
explicit MainWindow(QWidget* parent = nullptr);
~MainWindow() override = default;
bool hasTabOpenWithPath(const QString& filePath);
protected:
void closeEvent(QCloseEvent* event) override;
private
slots :
// File
void onNewFile();
void onOpenFile();
void onOpenFolder();
void onSave();
void onSaveAs();
void onSaveAll();
void onRevertFile();
void onCloseTab();
void onCloseAllTabs();
void onOpenRecentFile(const QString& path);
void onQuit();
// Edit
void onUndo();
void onRedo();
void onCut();
void onCopy();
void onPaste();
void onSelectAll();
void onFindReplace();
void onZoomIn();
void onZoomOut();
void onZoomReset();
// View
void onToggleFileTree();
void onFontSelected(const QString& family);
// Bookmarks
void onToggleBookmark();
void onNextBookmark();
void onPrevBookmark();
void onClearBookmarks();
// Language override
void onLanguageOverride(Language lang);
// Preferences
void onPreferences();
void onAbout();
// Status bar updates
void onCurrentFileChanged(const QString& filePath, Language lang);
void onCursorPositionChanged(int line, int col);
// File tree
void onFileSelected(const QString& filePath);
// Autosave timer
void onAutoSaveTick();
// Settings applied from PreferencesDialog
void applyAllSettings();
private:
void setupMenuBar();
void setupCentralWidget();
void setupStatusBar();
void refreshRecentFilesMenu();
void buildLanguageMenu();
void buildFontMenu();
void applyFontToAllEditors(const QString& family, int pointSize);
QString autoDetectFileUnicode(const QString& filePath);
void onFilePathChanged(const QString& oldPath, const QString& newPath);
void onFilePathDeleted(const QString& path);
// Widgets
QSplitter* m_splitter = nullptr;
FileTreeWidget* m_fileTree = nullptr;
EditorTabWidget* m_tabWidget = nullptr;
// Dialogs
FindReplaceDialog* m_findReplace = nullptr;
// Status bar
QLabel* m_langLabel = nullptr;
QLabel* m_fileUnicode = nullptr;
QLabel* m_cursorLabel = nullptr;
// Menus
QMenu* m_recentMenu = nullptr;
QMenu* m_languageMenu = nullptr;
QMenu* m_fontMenu = nullptr;
QActionGroup* m_langGroup = nullptr;
QActionGroup* m_fontGroup = nullptr;
// Autosave
QTimer* m_autoSaveTimer = nullptr;
};
#endif // OPENNOTE_LINUX_MAINWINDOW_H