GpgFrontend Project A Free, Powerful, Easy-to-Use, Compact, Cross-Platform, and Installation-Free OpenPGP(pgp) Crypto Tool.

TextEdit.h
1
29 #ifndef __TEXTEDIT_H__
30 #define __TEXTEDIT_H__
31
32 #include "ui/dialog/QuitDialog.h"
33 #include "ui/widgets/FilePage.h"
34 #include "ui/widgets/HelpPage.h"
35 #include "ui/widgets/PlainTextEditorPage.h"
36
37 namespace GpgFrontend::UI {
41 class TextEdit : public QWidget {
42 Q_OBJECT
43 public:
47 TextEdit(QWidget* parent);
48
55 void LoadFile(const QString& fileName);
56
64 bool MaybeSaveAnyTab();
65
71 [[nodiscard]] int TabCount() const;
72
78 [[nodiscard]] PlainTextEditorPage* CurTextPage() const;
79
85 [[nodiscard]] FilePage* CurFilePage() const;
86
91 [[nodiscard]] QHash<int, QString> UnsavedDocuments() const;
92
93 QTabWidget* tab_widget_;
95 public slots:
96
101 PlainTextEditorPage* SlotCurPageTextEdit() const;
102
107 FilePage* SlotCurPageFileTreeView() const;
108
112 void SlotQuote() const;
113
118 void SlotFillTextEditWithText(const QString& text) const;
119
124 void SlotSave();
125
132 bool SlotSaveAs();
133
139 void SlotOpen();
140
144 void SlotPrint();
145
151 void SlotNewTab();
152
156 void SlotOpenFile(const QString& path);
157
164 void slotNewHelpTab(const QString& title, const QString& path) const;
165
169 void SlotNewFileTab() const;
170
175 void SlotShowModified(bool) const;
176
181 void SlotCloseTab();
182
187 void SlotSwitchTabUp() const;
188
193 void SlotSwitchTabDown() const;
194
195 private:
196 uint text_page_data_modified_count_ = 0;
197
204 static QString stripped_name(const QString& full_file_name);
205
211 bool maybe_save_current_tab(bool askToSave);
212
213 int count_page_;
214
215 private slots:
216
217 void slot_file_page_path_changed(const QString& path) const;
218
224 void slot_remove_tab(int index);
225
231 void slot_save_status_to_cache_for_revovery();
232
233 public slots:
234
238 void SlotCut() const;
239
243 void SlotCopy() const;
244
248 void SlotPaste() const;
249
254 void SlotUndo() const;
255
260 void SlotRedo() const;
261
266 void SlotZoomIn() const;
267
272 void SlotZoomOut() const;
273
278 void SlotSelectAll() const;
279
280 protected:
286 bool save_file(const QString& fileName);
287 };
288
289 } // namespace GpgFrontend::UI
290
291 #endif // __TEXTEDIT_H__
GpgFrontend::UI::FilePage
Definition: FilePage.h:43
GpgFrontend::UI::PlainTextEditorPage
Class for handling a single tab of the tabwidget.
Definition: PlainTextEditorPage.h:45
GpgFrontend::UI::TextEdit
TextEdit class.
Definition: TextEdit.h:41
GpgFrontend::UI::TextEdit::SlotSaveAs
bool SlotSaveAs()
Definition: TextEdit.cpp:201
GpgFrontend::UI::TextEdit::TabCount
int TabCount() const
Definition: TextEdit.cpp:372
GpgFrontend::UI::TextEdit::slot_remove_tab
void slot_remove_tab(int index)
Definition: TextEdit.cpp:225
GpgFrontend::UI::TextEdit::SlotOpen
void SlotOpen()
Definition: TextEdit.cpp:120
GpgFrontend::UI::TextEdit::slot_save_status_to_cache_for_revovery
void slot_save_status_to_cache_for_revovery()
Definition: TextEdit.cpp:601
GpgFrontend::UI::TextEdit::SlotCopy
void SlotCopy() const
Definition: TextEdit.cpp:527
GpgFrontend::UI::TextEdit::slotNewHelpTab
void slotNewHelpTab(const QString &title, const QString &path) const
Definition: TextEdit.cpp:73
GpgFrontend::UI::TextEdit::MaybeSaveAnyTab
bool MaybeSaveAnyTab()
Definition: TextEdit.cpp:304
GpgFrontend::UI::TextEdit::SlotCurPageTextEdit
PlainTextEditorPage * SlotCurPageTextEdit() const
Definition: TextEdit.cpp:374
GpgFrontend::UI::TextEdit::SlotUndo
void SlotUndo() const
Definition: TextEdit.cpp:545
GpgFrontend::UI::TextEdit::SlotSwitchTabDown
void SlotSwitchTabDown() const
Definition: TextEdit.cpp:489
GpgFrontend::UI::TextEdit::SlotNewTab
void SlotNewTab()
Definition: TextEdit.cpp:59
GpgFrontend::UI::TextEdit::SlotOpenFile
void SlotOpenFile(const QString &path)
Definition: TextEdit.cpp:89
GpgFrontend::UI::TextEdit::save_file
bool save_file(const QString &fileName)
Saves the content of currentTab to the file filename.
Definition: TextEdit.cpp:146
GpgFrontend::UI::TextEdit::SlotQuote
void SlotQuote() const
Definition: TextEdit.cpp:385
GpgFrontend::UI::TextEdit::SlotSelectAll
void SlotSelectAll() const
select all in current text page
Definition: TextEdit.cpp:581
GpgFrontend::UI::TextEdit::SlotCurPageFileTreeView
FilePage * SlotCurPageFileTreeView() const
Definition: TextEdit.cpp:380
GpgFrontend::UI::TextEdit::LoadFile
void LoadFile(const QString &fileName)
Definition: TextEdit.cpp:415
GpgFrontend::UI::TextEdit::count_page_
int count_page_
int containing the number of added tabs
Definition: TextEdit.h:213
GpgFrontend::UI::TextEdit::CurTextPage
PlainTextEditorPage * CurTextPage() const
Definition: TextEdit.cpp:359
GpgFrontend::UI::TextEdit::UnsavedDocuments
QHash< int, QString > UnsavedDocuments() const
Definition: TextEdit.cpp:500
GpgFrontend::UI::TextEdit::maybe_save_current_tab
bool maybe_save_current_tab(bool askToSave)
Definition: TextEdit.cpp:258
GpgFrontend::UI::TextEdit::SlotCloseTab
void SlotCloseTab()
Definition: TextEdit.cpp:218
GpgFrontend::UI::TextEdit::SlotPaste
void SlotPaste() const
Definition: TextEdit.cpp:537
GpgFrontend::UI::TextEdit::CurFilePage
FilePage * CurFilePage() const
Definition: TextEdit.cpp:363
GpgFrontend::UI::TextEdit::SlotShowModified
void SlotShowModified(bool) const
Definition: TextEdit.cpp:462
GpgFrontend::UI::TextEdit::SlotSave
void SlotSave()
Definition: TextEdit.cpp:130
GpgFrontend::UI::TextEdit::SlotPrint
void SlotPrint()
Definition: TextEdit.cpp:440
GpgFrontend::UI::TextEdit::SlotCut
void SlotCut() const
Definition: TextEdit.cpp:519
GpgFrontend::UI::TextEdit::SlotNewFileTab
void SlotNewFileTab() const
Definition: TextEdit.cpp:79
GpgFrontend::UI::TextEdit::SlotRedo
void SlotRedo() const
redo last change in current text page
Definition: TextEdit.cpp:553
GpgFrontend::UI::TextEdit::SlotSwitchTabUp
void SlotSwitchTabUp() const
Definition: TextEdit.cpp:482
GpgFrontend::UI::TextEdit::SlotFillTextEditWithText
void SlotFillTextEditWithText(const QString &text) const
Definition: TextEdit.cpp:407
GpgFrontend::UI::TextEdit::stripped_name
static QString stripped_name(const QString &full_file_name)
Definition: TextEdit.cpp:436
GpgFrontend::UI
Definition: FileReadTask.cpp:29