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()
{
QSettings settings;
settings.setIniCodec("UTF-8");
QFileDialog open_dialog;
QString filename;
QFile file;

View File

@ -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;

View File

@ -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();

View File

@ -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;