From 8880d27dc5d3258979c142518e7d49b3192ab67b Mon Sep 17 00:00:00 2001 From: Akash Mozumdar Date: Mon, 31 Dec 2018 15:06:47 -0500 Subject: [PATCH] more consistent use of qsettings --- GUI/mainwindow.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/GUI/mainwindow.cpp b/GUI/mainwindow.cpp index a523c4f..c08ec2d 100644 --- a/GUI/mainwindow.cpp +++ b/GUI/mainwindow.cpp @@ -37,11 +37,10 @@ MainWindow::MainWindow(QWidget *parent) : connect(ui->ttCombo, (void(QComboBox::*)(int))&QComboBox::activated, this, &MainWindow::ViewThread); QSettings settings(CONFIG_FILE, QSettings::IniFormat); - if (settings.contains(WINDOW)) setGeometry(settings.value(WINDOW).toRect()); - if (settings.contains(FLUSH_DELAY)) TextThread::flushDelay = settings.value(FLUSH_DELAY).toInt(); - if (settings.contains(MAX_BUFFER_SIZE)) TextThread::maxBufferSize = settings.value(MAX_BUFFER_SIZE).toInt(); - if (settings.contains(DEFAULT_CODEPAGE)) TextThread::defaultCodepage = settings.value(DEFAULT_CODEPAGE).toInt(); - settings.sync(); + setGeometry(settings.value(WINDOW, geometry()).toRect()); + TextThread::flushDelay = settings.value(FLUSH_DELAY, TextThread::flushDelay).toInt(); + TextThread::maxBufferSize = settings.value(MAX_BUFFER_SIZE, TextThread::maxBufferSize).toInt(); + TextThread::defaultCodepage = settings.value(DEFAULT_CODEPAGE, TextThread::defaultCodepage).toInt(); Host::Start( [this](DWORD processId) { ProcessConnected(processId); }, @@ -252,7 +251,7 @@ void MainWindow::Settings() spinBox->setMaximum(INT_MAX); spinBox->setValue(value); layout->insertRow(0, label, spinBox); - connect(save, &QPushButton::clicked, [=, &value] { settings->setValue(label, value = spinBox->value()); settings->sync(); }); + connect(save, &QPushButton::clicked, [=, &value] { settings->setValue(label, value = spinBox->value()); }); } connect(save, &QPushButton::clicked, this, &QDialog::accept); setWindowTitle(SETTINGS);