preferences: use std::string in struct preferences

This is a messy commit, because the "qPref" system relies
heavily on QString, which means lots of conversions between
the two worlds. Ultimately, I plan to base the preferences
system on std::string and only convert to QString when
pushing through Qt's property system or when writing into
Qt's settings.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-06-13 22:59:32 +02:00 committed by bstoeger
parent 82fc9de40b
commit ccdd92aeb7
78 changed files with 645 additions and 694 deletions

View file

@ -27,11 +27,11 @@ PreferencesNetwork::~PreferencesNetwork()
void PreferencesNetwork::refreshSettings()
{
ui->proxyHost->setText(prefs.proxy_host);
ui->proxyHost->setText(QString::fromStdString(prefs.proxy_host));
ui->proxyPort->setValue(prefs.proxy_port);
ui->proxyAuthRequired->setChecked(prefs.proxy_auth);
ui->proxyUsername->setText(prefs.proxy_user);
ui->proxyPassword->setText(prefs.proxy_pass);
ui->proxyUsername->setText(QString::fromStdString(prefs.proxy_user));
ui->proxyPassword->setText(QString::fromStdString(prefs.proxy_pass));
ui->proxyType->setCurrentIndex(ui->proxyType->findData(prefs.proxy_type));
}
@ -49,9 +49,8 @@ void PreferencesNetwork::syncSettings()
void PreferencesNetwork::proxyType_changed(int idx)
{
if (idx == -1) {
if (idx < 0)
return;
}
int proxyType = ui->proxyType->itemData(idx).toInt();
bool hpEnabled = (proxyType == QNetworkProxy::Socks5Proxy || proxyType == QNetworkProxy::HttpProxy);