aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui/widgets/PlainTextEditorPage.cpp
diff options
context:
space:
mode:
authorsaturneric <[email protected]>2024-11-26 16:23:46 +0000
committersaturneric <[email protected]>2024-11-26 16:23:46 +0000
commitf19beee8e28621bb045e45d71c963fbba1307f4b (patch)
tree20a8f52df99724f10bb20aa5273fe506f08e614e /src/ui/widgets/PlainTextEditorPage.cpp
parentfix: change "Advance" to "Advanced" (diff)
downloadGpgFrontend-f19beee8e28621bb045e45d71c963fbba1307f4b.tar.gz
GpgFrontend-f19beee8e28621bb045e45d71c963fbba1307f4b.zip
refactor: optimum code and reduce duplicate
Diffstat (limited to 'src/ui/widgets/PlainTextEditorPage.cpp')
-rw-r--r--src/ui/widgets/PlainTextEditorPage.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/ui/widgets/PlainTextEditorPage.cpp b/src/ui/widgets/PlainTextEditorPage.cpp
index c1c679a6..ac41c9ab 100644
--- a/src/ui/widgets/PlainTextEditorPage.cpp
+++ b/src/ui/widgets/PlainTextEditorPage.cpp
@@ -81,7 +81,13 @@ const QString &PlainTextEditorPage::GetFilePath() const {
return full_file_path_;
}
-QPlainTextEdit *PlainTextEditorPage::GetTextPage() { return ui_->textPage; }
+auto PlainTextEditorPage::GetTextPage() -> QPlainTextEdit * {
+ return ui_->textPage;
+}
+
+auto PlainTextEditorPage::GetPlainText() -> QString {
+ return ui_->textPage->toPlainText();
+}
void PlainTextEditorPage::NotifyFileSaved() {
this->is_crlf_ = false;
@@ -212,7 +218,7 @@ void PlainTextEditorPage::slot_insert_text(QByteArray bytes_data) {
read_bytes_ += bytes_data.size();
// insert the text to the text page
- this->GetTextPage()->insertPlainText(bytes_data);
+ this->ui_->textPage->insertPlainText(bytes_data);
this->ui_->characterLabel->setText(
tr("%1 character(s)").arg(this->GetTextPage()->toPlainText().size()));