forked from Public-Mirror/Textractor
more consistent use of qsettings
This commit is contained in:
parent
9216548848
commit
8880d27dc5
@ -37,11 +37,10 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
connect(ui->ttCombo, (void(QComboBox::*)(int))&QComboBox::activated, this, &MainWindow::ViewThread);
|
connect(ui->ttCombo, (void(QComboBox::*)(int))&QComboBox::activated, this, &MainWindow::ViewThread);
|
||||||
|
|
||||||
QSettings settings(CONFIG_FILE, QSettings::IniFormat);
|
QSettings settings(CONFIG_FILE, QSettings::IniFormat);
|
||||||
if (settings.contains(WINDOW)) setGeometry(settings.value(WINDOW).toRect());
|
setGeometry(settings.value(WINDOW, geometry()).toRect());
|
||||||
if (settings.contains(FLUSH_DELAY)) TextThread::flushDelay = settings.value(FLUSH_DELAY).toInt();
|
TextThread::flushDelay = settings.value(FLUSH_DELAY, TextThread::flushDelay).toInt();
|
||||||
if (settings.contains(MAX_BUFFER_SIZE)) TextThread::maxBufferSize = settings.value(MAX_BUFFER_SIZE).toInt();
|
TextThread::maxBufferSize = settings.value(MAX_BUFFER_SIZE, TextThread::maxBufferSize).toInt();
|
||||||
if (settings.contains(DEFAULT_CODEPAGE)) TextThread::defaultCodepage = settings.value(DEFAULT_CODEPAGE).toInt();
|
TextThread::defaultCodepage = settings.value(DEFAULT_CODEPAGE, TextThread::defaultCodepage).toInt();
|
||||||
settings.sync();
|
|
||||||
|
|
||||||
Host::Start(
|
Host::Start(
|
||||||
[this](DWORD processId) { ProcessConnected(processId); },
|
[this](DWORD processId) { ProcessConnected(processId); },
|
||||||
@ -252,7 +251,7 @@ void MainWindow::Settings()
|
|||||||
spinBox->setMaximum(INT_MAX);
|
spinBox->setMaximum(INT_MAX);
|
||||||
spinBox->setValue(value);
|
spinBox->setValue(value);
|
||||||
layout->insertRow(0, label, spinBox);
|
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);
|
connect(save, &QPushButton::clicked, this, &QDialog::accept);
|
||||||
setWindowTitle(SETTINGS);
|
setWindowTitle(SETTINGS);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user