From d2f86e01e6d42461f5ee057e99ad416f5d4c8b31 Mon Sep 17 00:00:00 2001 From: gitlost Date: Tue, 27 Oct 2020 15:11:33 +0000 Subject: [PATCH] GUI: Use UTF-8 for QSettings (non-ASCII was getting garbled on restore) --- frontend_qt/datawindow.cpp | 1 + frontend_qt/exportwindow.cpp | 3 +++ frontend_qt/mainwindow.cpp | 4 ++++ frontend_qt/sequencewindow.cpp | 5 ++++- 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/frontend_qt/datawindow.cpp b/frontend_qt/datawindow.cpp index 4be91c42..6fe2c8b8 100644 --- a/frontend_qt/datawindow.cpp +++ b/frontend_qt/datawindow.cpp @@ -73,6 +73,7 @@ void DataWindow::okay() void DataWindow::from_file() { QSettings settings; + settings.setIniCodec("UTF-8"); QFileDialog open_dialog; QString filename; QFile file; diff --git a/frontend_qt/exportwindow.cpp b/frontend_qt/exportwindow.cpp index 12ac3e8b..42ceda95 100644 --- a/frontend_qt/exportwindow.cpp +++ b/frontend_qt/exportwindow.cpp @@ -29,6 +29,7 @@ ExportWindow::ExportWindow() { QSettings settings; + settings.setIniCodec("UTF-8"); setupUi(this); linDestPath->setText(settings.value("studio/export/destination", QDir::toNativeSeparators(QDir::homePath())).toString()); @@ -44,6 +45,7 @@ ExportWindow::ExportWindow() ExportWindow::~ExportWindow() { QSettings settings; + settings.setIniCodec("UTF-8"); settings.setValue("studio/export/destination", linDestPath->text()); settings.setValue("studio/export/file_prefix", linPrefix->text()); @@ -59,6 +61,7 @@ void ExportWindow::quit_now() void ExportWindow::get_directory() { QSettings settings; + settings.setIniCodec("UTF-8"); QString directory; QFileDialog fdialog; diff --git a/frontend_qt/mainwindow.cpp b/frontend_qt/mainwindow.cpp index 4133facd..bff1b6f1 100644 --- a/frontend_qt/mainwindow.cpp +++ b/frontend_qt/mainwindow.cpp @@ -46,6 +46,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags fl) QCoreApplication::setApplicationName("Barcode Studio"); QSettings settings; + settings.setIniCodec("UTF-8"); char bstyle_text[][50] = { "Australia Post Redirect Code", @@ -224,6 +225,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags fl) MainWindow::~MainWindow() { QSettings settings; + settings.setIniCodec("UTF-8"); settings.setValue("studio/window_geometry", saveGeometry()); settings.setValue("studio/tab_index", tabMain->currentIndex()); @@ -276,6 +278,7 @@ void MainWindow::reset_view() bool MainWindow::save() { QSettings settings; + settings.setIniCodec("UTF-8"); QFileDialog save_dialog; QString filename; QString suffix; @@ -569,6 +572,7 @@ void MainWindow::change_options() { QUiLoader uiload; QSettings settings; + settings.setIniCodec("UTF-8"); bool initial_load = m_symbology == 0; int original_tab_count = tabMain->count(); diff --git a/frontend_qt/sequencewindow.cpp b/frontend_qt/sequencewindow.cpp index 10070f45..60e2ec74 100644 --- a/frontend_qt/sequencewindow.cpp +++ b/frontend_qt/sequencewindow.cpp @@ -31,7 +31,8 @@ SequenceWindow::SequenceWindow() { setupUi(this); - QSettings settings; + QSettings settings; + settings.setIniCodec("UTF-8"); QValidator *intvalid = new QIntValidator(this); linStartVal->setText(settings.value("studio/sequence/start_value", "1").toString()); @@ -53,6 +54,7 @@ SequenceWindow::SequenceWindow() SequenceWindow::~SequenceWindow() { QSettings settings; + settings.setIniCodec("UTF-8"); settings.setValue("studio/sequence/start_value", linStartVal->text()); settings.setValue("studio/sequence/end_value", linEndVal->text()); @@ -168,6 +170,7 @@ void SequenceWindow::check_generate() void SequenceWindow::import() { QSettings settings; + settings.setIniCodec("UTF-8"); QFileDialog import_dialog; QString filename; QFile file;