GUI: Use UTF-8 for QSettings (non-ASCII was getting garbled on restore)

This commit is contained in:
gitlost 2020-10-27 15:11:33 +00:00
parent 943ba79866
commit d2f86e01e6
4 changed files with 12 additions and 1 deletions

View File

@ -73,6 +73,7 @@ void DataWindow::okay()
void DataWindow::from_file() void DataWindow::from_file()
{ {
QSettings settings; QSettings settings;
settings.setIniCodec("UTF-8");
QFileDialog open_dialog; QFileDialog open_dialog;
QString filename; QString filename;
QFile file; QFile file;

View File

@ -29,6 +29,7 @@
ExportWindow::ExportWindow() ExportWindow::ExportWindow()
{ {
QSettings settings; QSettings settings;
settings.setIniCodec("UTF-8");
setupUi(this); setupUi(this);
linDestPath->setText(settings.value("studio/export/destination", QDir::toNativeSeparators(QDir::homePath())).toString()); linDestPath->setText(settings.value("studio/export/destination", QDir::toNativeSeparators(QDir::homePath())).toString());
@ -44,6 +45,7 @@ ExportWindow::ExportWindow()
ExportWindow::~ExportWindow() ExportWindow::~ExportWindow()
{ {
QSettings settings; QSettings settings;
settings.setIniCodec("UTF-8");
settings.setValue("studio/export/destination", linDestPath->text()); settings.setValue("studio/export/destination", linDestPath->text());
settings.setValue("studio/export/file_prefix", linPrefix->text()); settings.setValue("studio/export/file_prefix", linPrefix->text());
@ -59,6 +61,7 @@ void ExportWindow::quit_now()
void ExportWindow::get_directory() void ExportWindow::get_directory()
{ {
QSettings settings; QSettings settings;
settings.setIniCodec("UTF-8");
QString directory; QString directory;
QFileDialog fdialog; QFileDialog fdialog;

View File

@ -46,6 +46,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags fl)
QCoreApplication::setApplicationName("Barcode Studio"); QCoreApplication::setApplicationName("Barcode Studio");
QSettings settings; QSettings settings;
settings.setIniCodec("UTF-8");
char bstyle_text[][50] = { char bstyle_text[][50] = {
"Australia Post Redirect Code", "Australia Post Redirect Code",
@ -224,6 +225,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags fl)
MainWindow::~MainWindow() MainWindow::~MainWindow()
{ {
QSettings settings; QSettings settings;
settings.setIniCodec("UTF-8");
settings.setValue("studio/window_geometry", saveGeometry()); settings.setValue("studio/window_geometry", saveGeometry());
settings.setValue("studio/tab_index", tabMain->currentIndex()); settings.setValue("studio/tab_index", tabMain->currentIndex());
@ -276,6 +278,7 @@ void MainWindow::reset_view()
bool MainWindow::save() bool MainWindow::save()
{ {
QSettings settings; QSettings settings;
settings.setIniCodec("UTF-8");
QFileDialog save_dialog; QFileDialog save_dialog;
QString filename; QString filename;
QString suffix; QString suffix;
@ -569,6 +572,7 @@ void MainWindow::change_options()
{ {
QUiLoader uiload; QUiLoader uiload;
QSettings settings; QSettings settings;
settings.setIniCodec("UTF-8");
bool initial_load = m_symbology == 0; bool initial_load = m_symbology == 0;
int original_tab_count = tabMain->count(); int original_tab_count = tabMain->count();

View File

@ -31,7 +31,8 @@
SequenceWindow::SequenceWindow() SequenceWindow::SequenceWindow()
{ {
setupUi(this); setupUi(this);
QSettings settings; QSettings settings;
settings.setIniCodec("UTF-8");
QValidator *intvalid = new QIntValidator(this); QValidator *intvalid = new QIntValidator(this);
linStartVal->setText(settings.value("studio/sequence/start_value", "1").toString()); linStartVal->setText(settings.value("studio/sequence/start_value", "1").toString());
@ -53,6 +54,7 @@ SequenceWindow::SequenceWindow()
SequenceWindow::~SequenceWindow() SequenceWindow::~SequenceWindow()
{ {
QSettings settings; QSettings settings;
settings.setIniCodec("UTF-8");
settings.setValue("studio/sequence/start_value", linStartVal->text()); settings.setValue("studio/sequence/start_value", linStartVal->text());
settings.setValue("studio/sequence/end_value", linEndVal->text()); settings.setValue("studio/sequence/end_value", linEndVal->text());
@ -168,6 +170,7 @@ void SequenceWindow::check_generate()
void SequenceWindow::import() void SequenceWindow::import()
{ {
QSettings settings; QSettings settings;
settings.setIniCodec("UTF-8");
QFileDialog import_dialog; QFileDialog import_dialog;
QString filename; QString filename;
QFile file; QFile file;