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

PlainTextEditorPage.h
1
29 #ifndef __EDITORPAGE_H__
30 #define __EDITORPAGE_H__
31
32 #include "core/GpgConstants.h"
33 #include "ui/GpgFrontendUI.h"
34
35 class Ui_PlainTextEditor;
36
37 namespace GpgFrontend::UI {
38
43 class PlainTextEditorPage : public QWidget {
44 Q_OBJECT
45 public:
52 explicit PlainTextEditorPage(QString file_path = "",
53 QWidget* parent = nullptr);
54
58 [[nodiscard]] const QString& GetFilePath() const;
59
65 void SetFilePath(const QString& filePath);
66
70 QPlainTextEdit* GetTextPage();
71
78 void ShowNotificationWidget(QWidget* widget, const char* className);
79
85 void CloseNoteByClass(const char* className);
86
91 void ReadFile();
92
99 [[nodiscard]] bool ReadDone() const { return this->read_done_; }
100
105 void PrepareToDestroy();
106
107 private:
108 std::shared_ptr<Ui_PlainTextEditor> ui_;
109 QString full_file_path_;
110 bool sign_marked_{};
111 bool read_done_ = false;
112 QThread* read_thread_ = nullptr;
113 bool binary_mode_ = false;
114 size_t read_bytes_ = 0;
115
121 void detect_encoding(const std::string& data);
122
128 void detect_cr_lf(const QString& data);
129
130 private slots:
131
135 void slot_format_gpg_header();
136
142 void slot_insert_text(const std::string& data);
143 };
144
145 } // namespace GpgFrontend::UI
146
147 #endif // __EDITORPAGE_H__
GpgFrontend::UI::PlainTextEditorPage::SetFilePath
void SetFilePath(const QString &filePath)
Definition: PlainTextEditorPage.cpp:78
GpgFrontend::UI
Definition: VerifyDetailsDialog.cpp:33
GpgFrontend::UI::PlainTextEditorPage::GetFilePath
const QString & GetFilePath() const
Definition: PlainTextEditorPage.cpp:72
GpgFrontend::UI::PlainTextEditorPage::ShowNotificationWidget
void ShowNotificationWidget(QWidget *widget, const char *className)
Definition: PlainTextEditorPage.cpp:82
GpgFrontend::UI::PlainTextEditorPage::slot_insert_text
void slot_insert_text(const std::string &data)
Definition: PlainTextEditorPage.cpp:184
GpgFrontend::UI::FileReadThread
Definition: FileReadThread.h:38
GpgFrontend::UI::PlainTextEditorPage::CloseNoteByClass
void CloseNoteByClass(const char *className)
Definition: PlainTextEditorPage.cpp:88
GpgFrontend::UI::PlainTextEditorPage::sign_marked_
bool sign_marked_
true, if the signed header is marked, false if not
Definition: PlainTextEditorPage.h:110
GpgFrontend::UI::PlainTextEditorPage::PlainTextEditorPage
PlainTextEditorPage(QString file_path="", QWidget *parent=nullptr)
Definition: PlainTextEditorPage.cpp:39
GpgFrontend::UI::PlainTextEditorPage::detect_cr_lf
void detect_cr_lf(const QString &data)
Definition: PlainTextEditorPage.cpp:248
GpgFrontend::UI::PlainTextEditorPage
Class for handling a single tab of the tabwidget.
Definition: PlainTextEditorPage.h:43
GpgFrontend::UI::PlainTextEditorPage::detect_encoding
void detect_encoding(const std::string &data)
Definition: PlainTextEditorPage.cpp:224
GpgFrontend::UI::FileReadThread::SignalSendReadBlock
void SignalSendReadBlock(const std::string &block)
GpgFrontend::UI::PlainTextEditorPage::slot_format_gpg_header
void slot_format_gpg_header()
Definition: PlainTextEditorPage.cpp:97
GpgFrontend::UI::PlainTextEditorPage::GetTextPage
QPlainTextEdit * GetTextPage()
Definition: PlainTextEditorPage.cpp:76
GpgFrontend::UI::PlainTextEditorPage::full_file_path_
QString full_file_path_
The path to the file handled in the tab.
Definition: PlainTextEditorPage.h:109
GpgFrontend::UI::PlainTextEditorPage::ReadDone
bool ReadDone() const
Definition: PlainTextEditorPage.h:99