diff options
author | Saturneric <[email protected]> | 2022-09-03 12:11:36 +0000 |
---|---|---|
committer | Saturneric <[email protected]> | 2022-09-03 12:11:36 +0000 |
commit | 4201e3d55cc3bd467c2e49f694a445744f9af93f (patch) | |
tree | 281aa2ad51b2753d6295e821a14d8b1737484855 /src | |
parent | feat(project): support freebsd build (diff) | |
download | GpgFrontend-4201e3d55cc3bd467c2e49f694a445744f9af93f.tar.gz GpgFrontend-4201e3d55cc3bd467c2e49f694a445744f9af93f.zip |
fix(ui): fix user feedback issues.
1. add the font size settings of text editor.
2. fix exception under Russia lang when doing verification.
Diffstat (limited to 'src')
-rw-r--r-- | src/ui/UserInterfaceUtils.cpp | 2 | ||||
-rw-r--r-- | src/ui/dialog/GeneralDialog.cpp | 57 | ||||
-rw-r--r-- | src/ui/dialog/GeneralDialog.h | 5 | ||||
-rw-r--r-- | src/ui/dialog/import_export/KeyUploadDialog.cpp | 50 | ||||
-rw-r--r-- | src/ui/dialog/settings/SettingsAppearance.cpp | 156 | ||||
-rw-r--r-- | src/ui/dialog/settings/SettingsAppearance.h | 14 | ||||
-rw-r--r-- | src/ui/dialog/settings/SettingsKeyServer.cpp | 5 | ||||
-rw-r--r-- | src/ui/main_window/GeneralMainWindow.cpp | 43 | ||||
-rw-r--r-- | src/ui/widgets/InfoBoardWidget.cpp | 6 | ||||
-rw-r--r-- | src/ui/widgets/KeyList.cpp | 6 | ||||
-rw-r--r-- | src/ui/widgets/PlainTextEditorPage.cpp | 9 | ||||
-rw-r--r-- | src/ui/widgets/PlainTextEditorPage.h | 2 |
12 files changed, 214 insertions, 141 deletions
diff --git a/src/ui/UserInterfaceUtils.cpp b/src/ui/UserInterfaceUtils.cpp index 586d72ab..25b37a9b 100644 --- a/src/ui/UserInterfaceUtils.cpp +++ b/src/ui/UserInterfaceUtils.cpp @@ -53,7 +53,7 @@ void show_verify_details(QWidget *parent, InfoBoardWidget *info_board, GpgError error, const GpgVerifyResult &verify_result) { // take out result info_board->ResetOptionActionsMenu(); - info_board->AddOptionalAction("Show Verify Details", [=]() { + info_board->AddOptionalAction(_("Show Verify Details"), [=]() { VerifyDetailsDialog(parent, error, verify_result); }); } diff --git a/src/ui/dialog/GeneralDialog.cpp b/src/ui/dialog/GeneralDialog.cpp index d07c2497..9ec30628 100644 --- a/src/ui/dialog/GeneralDialog.cpp +++ b/src/ui/dialog/GeneralDialog.cpp @@ -50,7 +50,6 @@ void GpgFrontend::UI::GeneralDialog::slot_restore_settings() noexcept { int x = general_windows_state.Check("window_pos").Check("x", 100), y = general_windows_state.Check("window_pos").Check("y", 100); - this->move({x, y}); pos_ = {x, y}; int width = @@ -58,9 +57,49 @@ void GpgFrontend::UI::GeneralDialog::slot_restore_settings() noexcept { height = general_windows_state.Check("window_size").Check("height", 247); - this->resize({width, height}); size_ = {width, height}; + if (this->parent() != nullptr) { + LOG(INFO) << "parent address" << this->parent(); + + QPoint parent_pos = {0, 0}; + QSize parent_size = {0, 0}; + + auto *parent_widget = qobject_cast<QWidget *>(this->parent()); + if (parent_widget != nullptr) { + parent_pos = parent_widget->pos(); + parent_size = parent_widget->size(); + } + + auto *parent_dialog = qobject_cast<QDialog *>(this->parent()); + if (parent_dialog != nullptr) { + parent_pos = parent_dialog->pos(); + parent_size = parent_dialog->size(); + } + + auto *parent_window = qobject_cast<QMainWindow *>(this->parent()); + if (parent_window != nullptr) { + parent_pos = parent_window->pos(); + parent_size = parent_window->size(); + } + + LOG(INFO) << "parent pos x:" << parent_pos.x() + << "y:" << parent_pos.y(); + + LOG(INFO) << "parent size width:" << parent_size.width() + << "height:" << parent_size.height(); + + if (parent_pos != QPoint{0, 0}) { + QPoint parent_center{parent_pos.x() + parent_size.width() / 2, + parent_pos.y() + parent_size.height() / 2}; + + pos_ = {parent_center.x() - size_.width() / 2, + parent_center.y() - size_.height() / 2}; + } + } + + this->move(pos_); + this->resize(size_); } } catch (...) { @@ -86,3 +125,17 @@ void GpgFrontend::UI::GeneralDialog::slot_save_settings() noexcept { LOG(ERROR) << name_ << "error"; } } + +void GpgFrontend::UI::GeneralDialog::setPosCenterOfScreen() { + auto* screen = QGuiApplication::primaryScreen(); + QRect geo = screen->availableGeometry(); + int screen_width = geo.width(); + int screen_height = geo.height(); + + LOG(INFO) << "primary screen available geometry" << screen_width + << screen_height; + + pos_ = QPoint((screen_width - QWidget::width()) / 2, + (screen_height - QWidget::height()) / 2); + this->move(pos_); +} diff --git a/src/ui/dialog/GeneralDialog.h b/src/ui/dialog/GeneralDialog.h index ca480c8b..ed6fdb1b 100644 --- a/src/ui/dialog/GeneralDialog.h +++ b/src/ui/dialog/GeneralDialog.h @@ -45,6 +45,11 @@ class GeneralDialog : public QDialog { */ ~GeneralDialog() override; + /** + * + */ + void setPosCenterOfScreen(); + private slots: /** * diff --git a/src/ui/dialog/import_export/KeyUploadDialog.cpp b/src/ui/dialog/import_export/KeyUploadDialog.cpp index 055f2e1f..ad4be0cb 100644 --- a/src/ui/dialog/import_export/KeyUploadDialog.cpp +++ b/src/ui/dialog/import_export/KeyUploadDialog.cpp @@ -33,6 +33,7 @@ #include "core/function/GlobalSettingStation.h" #include "core/function/gpg/GpgKeyGetter.h" #include "core/function/gpg/GpgKeyImportExporter.h" +#include "ui/struct/SettingsObject.h" namespace GpgFrontend::UI { @@ -40,6 +41,7 @@ KeyUploadDialog::KeyUploadDialog(const KeyIdArgsListPtr& keys_ids, QWidget* parent) : GeneralDialog(typeid(KeyUploadDialog).name(), parent), m_keys_(GpgKeyGetter::GetInstance().GetKeys(keys_ids)) { + auto* pb = new QProgressBar(); pb->setRange(0, 0); pb->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); @@ -54,33 +56,47 @@ KeyUploadDialog::KeyUploadDialog(const KeyIdArgsListPtr& keys_ids, this->setModal(true); this->setWindowTitle(_("Uploading Public Key")); this->setFixedSize(240, 42); + this->setPosCenterOfScreen(); } void KeyUploadDialog::SlotUpload() { auto out_data = std::make_unique<ByteArray>(); GpgKeyImportExporter::GetInstance().ExportKeys(*m_keys_, out_data); slot_upload_key_to_server(*out_data); + + // Done + this->hide(); + this->close(); } void KeyUploadDialog::slot_upload_key_to_server( const GpgFrontend::ByteArray& keys_data) { + std::string target_keyserver; - if (target_keyserver.empty()) { - try { - auto& settings = GlobalSettingStation::GetInstance().GetUISettings(); - - target_keyserver = settings.lookup("keyserver.default_server").c_str(); - - LOG(INFO) << _("Set target Key Server to default Key Server") - << target_keyserver; - } catch (...) { - LOG(ERROR) << _("Cannot read default_keyserver From Settings"); - QMessageBox::critical( - nullptr, _("Default Keyserver Not Found"), - _("Cannot read default keyserver from your settings, " - "please set a default keyserver first")); - return; + + try { + SettingsObject key_server_json("key_server"); + + const auto key_server_list = + key_server_json.Check("server_list", nlohmann::json::array()); + + int default_key_server_index = key_server_json.Check("default_server", 0); + if (default_key_server_index >= key_server_list.size()) { + throw std::runtime_error("default_server index out of range"); } + + target_keyserver = + key_server_list[default_key_server_index].get<std::string>(); + + LOG(INFO) << _("Set target Key Server to default Key Server") + << target_keyserver; + + } catch (...) { + LOG(ERROR) << _("Cannot read default_keyserver From Settings"); + QMessageBox::critical(nullptr, _("Default Keyserver Not Found"), + _("Cannot read default keyserver from your settings, " + "please set a default keyserver first")); + return; } QUrl req_url(QString::fromStdString(target_keyserver + "/pks/add")); @@ -117,10 +133,6 @@ void KeyUploadDialog::slot_upload_key_to_server( while (reply->isRunning()) { QApplication::processEvents(); } - - // Done - this->hide(); - this->close(); } void KeyUploadDialog::slot_upload_finished() { diff --git a/src/ui/dialog/settings/SettingsAppearance.cpp b/src/ui/dialog/settings/SettingsAppearance.cpp index 17471a0d..b5fbc6a3 100644 --- a/src/ui/dialog/settings/SettingsAppearance.cpp +++ b/src/ui/dialog/settings/SettingsAppearance.cpp @@ -30,89 +30,48 @@ #include "core/function/GlobalSettingStation.h" #include "ui/struct/SettingsObject.h" +#include "ui_AppearanceSettings.h" namespace GpgFrontend::UI { -AppearanceTab::AppearanceTab(QWidget* parent) : QWidget(parent) { - /***************************************** - * Icon-Size-Box - *****************************************/ - auto* iconSizeBox = new QGroupBox(_("Icon Size")); - icon_size_group_ = new QButtonGroup(); - icon_size_small_ = new QRadioButton(_("small")); - icon_size_medium_ = new QRadioButton(_("medium")); - icon_size_large_ = new QRadioButton(_("large")); - - icon_size_group_->addButton(icon_size_small_, 1); - icon_size_group_->addButton(icon_size_medium_, 2); - icon_size_group_->addButton(icon_size_large_, 3); - - auto* iconSizeBoxLayout = new QHBoxLayout(); - iconSizeBoxLayout->addWidget(icon_size_small_); - iconSizeBoxLayout->addWidget(icon_size_medium_); - iconSizeBoxLayout->addWidget(icon_size_large_); - - iconSizeBox->setLayout(iconSizeBoxLayout); - - /***************************************** - * Icon-Style-Box - *****************************************/ - auto* iconStyleBox = new QGroupBox(_("Icon Style")); - icon_style_group_ = new QButtonGroup(); - icon_text_button_ = new QRadioButton(_("just text")); - icon_icons_button_ = new QRadioButton(_("just icons")); - icon_all_button_ = new QRadioButton(_("text and icons")); - - icon_style_group_->addButton(icon_text_button_, 1); - icon_style_group_->addButton(icon_icons_button_, 2); - icon_style_group_->addButton(icon_all_button_, 3); - - auto* iconStyleBoxLayout = new QHBoxLayout(); - iconStyleBoxLayout->addWidget(icon_text_button_); - iconStyleBoxLayout->addWidget(icon_icons_button_); - iconStyleBoxLayout->addWidget(icon_all_button_); - - iconStyleBox->setLayout(iconStyleBoxLayout); - - /***************************************** - * Window-Size-Box - *****************************************/ - auto* windowSizeBox = new QGroupBox(_("Window State")); - auto* windowSizeBoxLayout = new QHBoxLayout(); - window_size_check_box_ = - new QCheckBox(_("Save window size and position on exit."), this); - windowSizeBoxLayout->addWidget(window_size_check_box_); - windowSizeBox->setLayout(windowSizeBoxLayout); - - /***************************************** - * Info-Board-Font-Size-Box - *****************************************/ - - auto* infoBoardBox = new QGroupBox(_("Information Board")); - auto* infoBoardLayout = new QHBoxLayout(); - info_board_font_size_spin_ = new QSpinBox(); - info_board_font_size_spin_->setRange(9, 18); - info_board_font_size_spin_->setValue(10); - info_board_font_size_spin_->setSingleStep(1); - infoBoardLayout->addWidget(new QLabel(_("Font Size in Information Board"))); - infoBoardLayout->addWidget(info_board_font_size_spin_); - infoBoardBox->setLayout(infoBoardLayout); - - auto* mainLayout = new QVBoxLayout; - mainLayout->addWidget(iconSizeBox); - mainLayout->addWidget(iconStyleBox); - mainLayout->addWidget(windowSizeBox); - mainLayout->addWidget(infoBoardBox); - mainLayout->addStretch(1); +AppearanceTab::AppearanceTab(QWidget* parent) + : QWidget(parent), ui_(std::make_shared<Ui_AppearanceSettings>()) { + ui_->setupUi(this); + + ui_->iconSizeBox->setTitle(_("Icon Size")); + ui_->smallRadioButton->setText(_("small")); + ui_->mediumRadioButton->setText(_("medium")); + ui_->largeRadioButton->setText(_("large")); + + ui_->iconStyleBox->setTitle(_("Icon Style")); + ui_->justTextRadioButton->setText(_("just text")); + ui_->justIconRadioButton->setText(_("just icons")); + ui_->textAndIconsRadioButton->setText(_("text and icons")); + + ui_->windowStateBox->setTitle(_("Window State")); + ui_->windowStateCheckBox->setText( + _("Save window size and position on exit.")); + + ui_->textEditorBox->setTitle(_("Text Editor")); + ui_->fontSizeTextEditorLabel->setText(_("Font Size in Text Editor")); + + ui_->informationBoardBox->setTitle(_("Information Board")); + ui_->fontSizeInformationBoardLabel->setText( + _("Font Size in Information Board")); + + icon_size_group_ = new QButtonGroup(this); + icon_size_group_->addButton(ui_->smallRadioButton, 1); + icon_size_group_->addButton(ui_->mediumRadioButton, 2); + icon_size_group_->addButton(ui_->largeRadioButton, 3); + + icon_style_group_ = new QButtonGroup(this); + icon_style_group_->addButton(ui_->justTextRadioButton, 1); + icon_style_group_->addButton(ui_->justIconRadioButton, 2); + icon_style_group_->addButton(ui_->textAndIconsRadioButton, 3); + SetSettings(); - setLayout(mainLayout); } -/********************************** - * Read the settings from config - * and set the buttons and checkboxes - * appropriately - **********************************/ void AppearanceTab::SetSettings() { SettingsObject general_settings_state("general_settings_state"); @@ -123,13 +82,13 @@ void AppearanceTab::SetSettings() { switch (icon_size.width()) { case 12: - icon_size_small_->setChecked(true); + ui_->smallRadioButton->setChecked(true); break; case 24: - icon_size_medium_->setChecked(true); + ui_->mediumRadioButton->setChecked(true); break; case 32: - icon_size_large_->setChecked(true); + ui_->largeRadioButton->setChecked(true); break; } @@ -140,32 +99,35 @@ void AppearanceTab::SetSettings() { switch (icon_style) { case Qt::ToolButtonTextOnly: - icon_text_button_->setChecked(true); + ui_->justTextRadioButton->setChecked(true); break; case Qt::ToolButtonIconOnly: - icon_icons_button_->setChecked(true); + ui_->justIconRadioButton->setChecked(true); break; case Qt::ToolButtonTextUnderIcon: - icon_all_button_->setChecked(true); + ui_->textAndIconsRadioButton->setChecked(true); break; default: break; } bool window_save = general_settings_state.Check("window_save", true); - if (window_save) window_size_check_box_->setCheckState(Qt::Checked); - - auto info_font_size = general_settings_state.Check("font_size", 10); - if (info_font_size < 9 || info_font_size > 18) info_font_size = 10; - info_board_font_size_spin_->setValue(info_font_size); + if (window_save) ui_->windowStateCheckBox->setCheckState(Qt::Checked); + + auto info_board_info_font_size = + general_settings_state.Check("info_board").Check("font_size", 10); + if (info_board_info_font_size < 9 || info_board_info_font_size > 18) + info_board_info_font_size = 10; + ui_->fontSizeInformationBoardSpinBox->setValue(info_board_info_font_size); + + auto text_editor_info_font_size = + general_settings_state.Check("text_editor").Check("font_size", 10); + if (text_editor_info_font_size < 9 || text_editor_info_font_size > 18) + text_editor_info_font_size = 10; + ui_->fontSizeTextEditorLabelSpinBox->setValue(text_editor_info_font_size); } -/*********************************** - * get the values of the buttons and - * write them to settings-file - *************************************/ void AppearanceTab::ApplySettings() { - SettingsObject general_settings_state("general_settings_state"); int icon_size = 24; @@ -199,9 +161,13 @@ void AppearanceTab::ApplySettings() { general_settings_state["icon_style"] = icon_style; - general_settings_state["window_save"] = window_size_check_box_->isChecked(); + general_settings_state["window_save"] = ui_->windowStateCheckBox->isChecked(); + + general_settings_state["info_board"]["font_size"] = + ui_->fontSizeInformationBoardSpinBox->value(); - general_settings_state["info_font_size"] = info_board_font_size_spin_->value(); + general_settings_state["text_editor"]["font_size"] = + ui_->fontSizeTextEditorLabelSpinBox->value(); } } // namespace GpgFrontend::UI diff --git a/src/ui/dialog/settings/SettingsAppearance.h b/src/ui/dialog/settings/SettingsAppearance.h index 7110d992..8a38c666 100644 --- a/src/ui/dialog/settings/SettingsAppearance.h +++ b/src/ui/dialog/settings/SettingsAppearance.h @@ -31,6 +31,8 @@ #include "ui/GpgFrontendUI.h" +class Ui_AppearanceSettings; + namespace GpgFrontend::UI { class AppearanceTab : public QWidget { @@ -57,16 +59,10 @@ class AppearanceTab : public QWidget { void ApplySettings(); private: + std::shared_ptr<Ui_AppearanceSettings> ui_; ///< + QButtonGroup* icon_style_group_; ///< - QRadioButton* icon_size_small_; ///< - QRadioButton* icon_size_medium_; ///< - QRadioButton* icon_size_large_; ///< - QButtonGroup* icon_size_group_; ///< - QRadioButton* icon_text_button_; ///< - QRadioButton* icon_icons_button_; ///< - QRadioButton* icon_all_button_; ///< - QSpinBox* info_board_font_size_spin_; ///< - QCheckBox* window_size_check_box_; ///< + QButtonGroup* icon_size_group_; signals: diff --git a/src/ui/dialog/settings/SettingsKeyServer.cpp b/src/ui/dialog/settings/SettingsKeyServer.cpp index 2c09b66c..365e19d4 100644 --- a/src/ui/dialog/settings/SettingsKeyServer.cpp +++ b/src/ui/dialog/settings/SettingsKeyServer.cpp @@ -114,11 +114,6 @@ KeyserverTab::KeyserverTab(QWidget* parent) slot_refresh_table(); } -/********************************** - * Read the settings from config - * and set the buttons and checkboxes - * appropriately - **********************************/ void KeyserverTab::SetSettings() { try { SettingsObject key_server_json("key_server"); diff --git a/src/ui/main_window/GeneralMainWindow.cpp b/src/ui/main_window/GeneralMainWindow.cpp index 7df73aba..73d9fcc3 100644 --- a/src/ui/main_window/GeneralMainWindow.cpp +++ b/src/ui/main_window/GeneralMainWindow.cpp @@ -33,14 +33,14 @@ #include "ui/struct/SettingsObject.h" GpgFrontend::UI::GeneralMainWindow::GeneralMainWindow(std::string name, - QWidget* parent) + QWidget *parent) : name_(std::move(name)), QMainWindow(parent) { slot_restore_settings(); } GpgFrontend::UI::GeneralMainWindow::~GeneralMainWindow() = default; -void GpgFrontend::UI::GeneralMainWindow::closeEvent(QCloseEvent* event) { +void GpgFrontend::UI::GeneralMainWindow::closeEvent(QCloseEvent *event) { slot_save_settings(); QMainWindow::closeEvent(event); } @@ -65,7 +65,6 @@ void GpgFrontend::UI::GeneralMainWindow::slot_restore_settings() noexcept { int x = general_windows_state.Check("window_pos").Check("x", 100), y = general_windows_state.Check("window_pos").Check("y", 100); - this->move({x, y}); pos_ = {x, y}; int width = @@ -73,10 +72,44 @@ void GpgFrontend::UI::GeneralMainWindow::slot_restore_settings() noexcept { height = general_windows_state.Check("window_size").Check("height", 450); - this->resize({width, height}); size_ = {width, height}; - } + if (this->parent() != nullptr) { + LOG(INFO) << "parent address" << this->parent(); + + QPoint parent_pos = {0, 0}; + QSize parent_size = {0, 0}; + + auto *parent_dialog = qobject_cast<QDialog *>(this->parent()); + if (parent_dialog != nullptr) { + parent_pos = parent_dialog->pos(); + parent_size = parent_dialog->size(); + } + + auto *parent_window = qobject_cast<QMainWindow *>(this->parent()); + if (parent_window != nullptr) { + parent_pos = parent_window->pos(); + parent_size = parent_window->size(); + } + + LOG(INFO) << "parent pos x:" << parent_pos.x() + << "y:" << parent_pos.y(); + + LOG(INFO) << "parent size width:" << parent_size.width() + << "height:" << parent_size.height(); + + if (parent_pos != QPoint{0, 0}) { + QPoint parent_center{parent_pos.x() + parent_size.width() / 2, + parent_pos.y() + parent_size.height() / 2}; + + pos_ = {parent_center.x() - size_.width() / 2, + parent_center.y() - size_.height() / 2}; + } + } + + this->move(pos_); + this->resize(size_); + } // appearance SettingsObject general_settings_state("general_settings_state"); diff --git a/src/ui/widgets/InfoBoardWidget.cpp b/src/ui/widgets/InfoBoardWidget.cpp index 264a67d1..74ead2ce 100644 --- a/src/ui/widgets/InfoBoardWidget.cpp +++ b/src/ui/widgets/InfoBoardWidget.cpp @@ -79,11 +79,13 @@ void InfoBoardWidget::SetInfoBoard(const QString& text, status.setColor(QPalette::Text, color); ui_->infoBoard->setPalette(status); - SettingsObject main_windows_state("main_windows_state"); + SettingsObject general_settings_state("general_settings_state"); // info board font size - auto info_font_size = main_windows_state.Check("info_font_size", 10); + auto info_font_size = + general_settings_state.Check("text_editor").Check("font_size", 10); ui_->infoBoard->setFont(QFont("Times", info_font_size)); + } void InfoBoardWidget::SlotRefresh(const QString& text, InfoBoardStatus status) { diff --git a/src/ui/widgets/KeyList.cpp b/src/ui/widgets/KeyList.cpp index 0bd65f25..ad76467e 100644 --- a/src/ui/widgets/KeyList.cpp +++ b/src/ui/widgets/KeyList.cpp @@ -379,7 +379,9 @@ void KeyList::dragEnterEvent(QDragEnterEvent* event) { * */ [[maybe_unused]] void KeyList::MarkKeys(QStringList* keyIds) { - foreach (QString id, *keyIds) { qDebug() << "marked: " << id; } + foreach (QString id, *keyIds) { + qDebug() << "marked: " << id; + } } void KeyList::import_keys(const QByteArray& inBuffer) { @@ -442,6 +444,8 @@ void KeyList::slot_sync_with_key_server() { } } + if (key_ids.empty()) return; + ui_->refreshKeyListButton->setDisabled(true); ui_->syncButton->setDisabled(true); diff --git a/src/ui/widgets/PlainTextEditorPage.cpp b/src/ui/widgets/PlainTextEditorPage.cpp index 7eb682cc..10e19b8b 100644 --- a/src/ui/widgets/PlainTextEditorPage.cpp +++ b/src/ui/widgets/PlainTextEditorPage.cpp @@ -34,6 +34,7 @@ #include "core/thread/FileReadTask.h" #include "core/thread/Task.h" #include "core/thread/TaskRunnerGetter.h" +#include "ui/struct/SettingsObject.h" #include "ui_PlainTextEditor.h" namespace GpgFrontend::UI { @@ -48,7 +49,13 @@ PlainTextEditorPage::PlainTextEditorPage(QString file_path, QWidget *parent) ui_->loadingLabel->setHidden(true); // Front in same width - this->setFont({"Courier"}); + SettingsObject general_settings_state("general_settings_state"); + + // font size + auto editor_font_size = + general_settings_state.Check("text_editor").Check("font_size", 10); + ui_->textPage->setFont(QFont("Courier", editor_font_size)); + this->setAttribute(Qt::WA_DeleteOnClose); this->ui_->characterLabel->setText(_("0 character")); diff --git a/src/ui/widgets/PlainTextEditorPage.h b/src/ui/widgets/PlainTextEditorPage.h index e5c1c89d..ffa31762 100644 --- a/src/ui/widgets/PlainTextEditorPage.h +++ b/src/ui/widgets/PlainTextEditorPage.h @@ -129,7 +129,7 @@ class PlainTextEditorPage : public QWidget { size_t read_bytes_ = 0; ///< std::string charset_name_; ///< std::string language_name_; ///< - int32_t charset_confidence_; ///< + int32_t charset_confidence_{}; ///< bool is_crlf_ = false; ///< /** |