diff options
author | Saturneric <[email protected]> | 2022-05-12 16:36:57 +0000 |
---|---|---|
committer | Saturneric <[email protected]> | 2022-05-12 16:36:57 +0000 |
commit | baa3b65f16bf7c9ea7e5d6d3e25b9e2361cef8e1 (patch) | |
tree | 28205b29120c0ad99f1e8e262a9898f486bd10c2 /src/ui/widgets/PlainTextEditorPage.h | |
parent | fix: solve problem on .gitignore (diff) | |
download | GpgFrontend-baa3b65f16bf7c9ea7e5d6d3e25b9e2361cef8e1.tar.gz GpgFrontend-baa3b65f16bf7c9ea7e5d6d3e25b9e2361cef8e1.zip |
feat(ui): more advanced charset functions
1. support dealing more type of files with different charsets
2. solve cash cause by reading file thread
3. improve ui operations
Diffstat (limited to 'src/ui/widgets/PlainTextEditorPage.h')
-rw-r--r-- | src/ui/widgets/PlainTextEditorPage.h | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/ui/widgets/PlainTextEditorPage.h b/src/ui/widgets/PlainTextEditorPage.h index e76c11e3..0009b7d6 100644 --- a/src/ui/widgets/PlainTextEditorPage.h +++ b/src/ui/widgets/PlainTextEditorPage.h @@ -29,6 +29,8 @@ #ifndef __EDITORPAGE_H__ #define __EDITORPAGE_H__ +#include <string> + #include "core/GpgConstants.h" #include "ui/GpgFrontendUI.h" @@ -49,7 +51,7 @@ class PlainTextEditorPage : public QWidget { * @param file_path Path of the file handled in this tab * @param parent Pointer to the parent widget */ - explicit PlainTextEditorPage(QString file_path = "", + explicit PlainTextEditorPage(QString file_path = {}, QWidget* parent = nullptr); /** @@ -104,6 +106,18 @@ class PlainTextEditorPage : public QWidget { */ void PrepareToDestroy(); + /** + * @brief detect if the charset of the file will change + * + */ + bool WillCharsetChange() const; + + /** + * @brief notify the user that the file has been saved. + * + */ + void NotifyFileSaved(); + private: std::shared_ptr<Ui_PlainTextEditor> ui_; ///< QString full_file_path_; ///< The path to the file handled in the tab @@ -112,6 +126,10 @@ class PlainTextEditorPage : public QWidget { QThread* read_thread_ = nullptr; ///< 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; ///< /** * @brief @@ -125,7 +143,7 @@ class PlainTextEditorPage : public QWidget { * * @param data */ - void detect_cr_lf(const QString& data); + void detect_cr_lf(const std::string& data); private slots: |