PlainTextEditorPage.h
#ifndef __EDITORPAGE_H__
#define __EDITORPAGE_H__
#include <string>
#include "core/GpgConstants.h"
#include "ui/GpgFrontendUI.h"
class Ui_PlainTextEditor;
namespace GpgFrontend::UI {
class PlainTextEditorPage : public QWidget {
Q_OBJECT
public:
explicit PlainTextEditorPage(QString file_path = {},
QWidget* parent = nullptr);
[[nodiscard]] const QString& GetFilePath() const;
void SetFilePath(const QString& filePath);
QPlainTextEdit* GetTextPage();
void ShowNotificationWidget(QWidget* widget, const char* className);
void CloseNoteByClass(const char* className);
void ReadFile();
[[nodiscard]] bool ReadDone() const { return this->read_done_; }
bool WillCharsetChange() const;
void NotifyFileSaved();
signals:
void SignalUIBytesDisplayed();
private:
std::shared_ptr<Ui_PlainTextEditor> ui_;
QString full_file_path_;
bool sign_marked_{};
bool read_done_ = false;
bool binary_mode_ = false;
size_t read_bytes_ = 0;
std::string charset_name_;
std::string language_name_;
int32_t charset_confidence_;
bool is_crlf_ = false;
void detect_encoding(const std::string& data);
void detect_cr_lf(const std::string& data);
private slots:
void slot_format_gpg_header();
void slot_insert_text(QByteArray bytes_data);
};
} // namespace GpgFrontend::UI
#endif // __EDITORPAGE_H__
GpgFrontend::UI::PlainTextEditorPage::SetFilePath
void SetFilePath(const QString &filePath)
Definition: PlainTextEditorPage.cpp:103
GpgFrontend::UI
Definition: FileReadTask.cpp:31
GpgFrontend::UI::PlainTextEditorPage::GetFilePath
const QString & GetFilePath() const
Definition: PlainTextEditorPage.cpp:77
GpgFrontend::UI::PlainTextEditorPage::ShowNotificationWidget
void ShowNotificationWidget(QWidget *widget, const char *className)
Definition: PlainTextEditorPage.cpp:107
GpgFrontend::UI::PlainTextEditorPage::SignalUIBytesDisplayed
void SignalUIBytesDisplayed()
this signal is emitted when the bytes has been append in texteditor.
GpgFrontend::UI::PlainTextEditorPage::PlainTextEditorPage
PlainTextEditorPage(QString file_path={}, QWidget *parent=nullptr)
Definition: PlainTextEditorPage.cpp:41
GpgFrontend::SingletonFunctionObject< TaskRunnerGetter >::GetInstance
static TaskRunnerGetter & GetInstance(int channel=GpgFrontend::GPGFRONTEND_DEFAULT_CHANNEL)
Get the Instance object.
Definition: GpgFunctionObject.h:170
GpgFrontend::UI::PlainTextEditorPage::detect_cr_lf
void detect_cr_lf(const std::string &data)
Definition: PlainTextEditorPage.cpp:283
GpgFrontend::UI::PlainTextEditorPage::CloseNoteByClass
void CloseNoteByClass(const char *className)
Definition: PlainTextEditorPage.cpp:113
GpgFrontend::UI::FileReadTask
Definition: FileReadTask.h:39
GpgFrontend::UI::PlainTextEditorPage::sign_marked_
bool sign_marked_
true, if the signed header is marked, false if not
Definition: PlainTextEditorPage.h:126
GpgFrontend::UI::PlainTextEditorPage
Class for handling a single tab of the tabwidget.
Definition: PlainTextEditorPage.h:45
GpgFrontend::UI::PlainTextEditorPage::detect_encoding
void detect_encoding(const std::string &data)
Definition: PlainTextEditorPage.cpp:259
GpgFrontend::CharsetOperator::Detect
static CharsetInfo Detect(const std::string &buffer)
Definition: CharsetOperator.cpp:42
GpgFrontend::UI::PlainTextEditorPage::slot_format_gpg_header
void slot_format_gpg_header()
Definition: PlainTextEditorPage.cpp:122
GpgFrontend::UI::PlainTextEditorPage::GetTextPage
QPlainTextEdit * GetTextPage()
Definition: PlainTextEditorPage.cpp:81
GpgFrontend::UI::PlainTextEditorPage::WillCharsetChange
bool WillCharsetChange() const
detect if the charset of the file will change
Definition: PlainTextEditorPage.cpp:83
GpgFrontend::UI::PlainTextEditorPage::full_file_path_
QString full_file_path_
The path to the file handled in the tab.
Definition: PlainTextEditorPage.h:125
GpgFrontend::UI::PlainTextEditorPage::ReadDone
bool ReadDone() const
Definition: PlainTextEditorPage.h:101
GpgFrontend::UI::PlainTextEditorPage::slot_insert_text
void slot_insert_text(QByteArray bytes_data)
Definition: PlainTextEditorPage.cpp:206
GpgFrontend::UI::PlainTextEditorPage::NotifyFileSaved
void NotifyFileSaved()
notify the user that the file has been saved.
Definition: PlainTextEditorPage.cpp:94