diff options
Diffstat (limited to 'client/Dialog.cpp')
-rw-r--r-- | client/Dialog.cpp | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/client/Dialog.cpp b/client/Dialog.cpp index a5d205c..4ce48be 100644 --- a/client/Dialog.cpp +++ b/client/Dialog.cpp @@ -25,7 +25,7 @@ ProxyDialog::ProxyDialog(QWidget *parent): QDialog(parent) vector<string> countries = cfg->GetCountries(); for (unsigned i = 0; i < countries.size(); i++) { - QString country = QString::fromUtf8(countries[i].c_str()); + QString country = QString::fromLocal8Bit(countries[i].c_str()); countryBox->addItem(country); } countryBox->setCurrentIndex(-1); @@ -75,8 +75,12 @@ ProxyDialog::ProxyDialog(QWidget *parent): QDialog(parent) QLabel *btnLabel = new QLabel(btnStr); btnLabel->setAttribute(Qt::WA_TransparentForMouseEvents); QHBoxLayout *btnLayout = new QHBoxLayout; + // insert spacers at the beginning and + // the end to center-align button content + btnLayout->addStretch(); btnLayout->addWidget(btnLabel); btnLayout->setSizeConstraint(QLayout::SetMinimumSize); + btnLayout->addStretch(); QPushButton *btn = new QPushButton(); btn->setObjectName("bottomBtn"); btn->setCheckable(true); @@ -115,7 +119,7 @@ void ProxyDialog::CountryActivated(int index) return; } - string country(countryBox->currentText().toUtf8().constData()); + string country(countryBox->currentText().toLocal8Bit().constData()); Logger::Info("Country %s was selected\n", country.c_str()); UpdatedConfig *cfg = UpdatedConfig::CurrentConfig(); @@ -127,7 +131,7 @@ void ProxyDialog::CountryActivated(int index) cityBox->clear(); for (unsigned i = 0; i < cities.size(); i++) { - QString city = QString::fromUtf8(cities[i].c_str()); + QString city = QString::fromLocal8Bit(cities[i].c_str()); cityBox->addItem(city); } cityBox->setCurrentIndex(-1); @@ -139,7 +143,7 @@ void ProxyDialog::CountryActivated(int index) stateBox->clear(); for (unsigned i = 0; i < states.size(); i++) { - QString state = QString::fromUtf8(states[i].c_str()); + QString state = QString::fromLocal8Bit(states[i].c_str()); stateBox->addItem(state); } stateBox->setCurrentIndex(-1); @@ -157,8 +161,8 @@ void ProxyDialog::StateActivated(int index) return; } - string country(countryBox->currentText().toUtf8().constData()); - string state(stateBox->currentText().toUtf8().constData()); + string country(countryBox->currentText().toLocal8Bit().constData()); + string state(stateBox->currentText().toLocal8Bit().constData()); Logger::Info("State %s was selected\n", state.c_str()); UpdatedConfig *cfg = UpdatedConfig::CurrentConfig(); @@ -166,7 +170,7 @@ void ProxyDialog::StateActivated(int index) cityBox->clear(); for (unsigned i = 0; i < cities.size(); i++) { - QString city = QString::fromUtf8(cities[i].c_str()); + QString city = QString::fromLocal8Bit(cities[i].c_str()); cityBox->addItem(city); } cityBox->setCurrentIndex(-1); @@ -184,11 +188,11 @@ void ProxyDialog::CityActivated(int index) vector<string> proxies; UpdatedConfig *cfg = UpdatedConfig::CurrentConfig(); - string country(countryBox->currentText().toUtf8().constData()); - string city(cityBox->currentText().toUtf8().constData()); + string country(countryBox->currentText().toLocal8Bit().constData()); + string city(cityBox->currentText().toLocal8Bit().constData()); if (stateBox->isVisible()) { - string state(stateBox->currentText().toUtf8().constData()); + string state(stateBox->currentText().toLocal8Bit().constData()); proxies = cfg->GetProxies(country, state, city); } else @@ -210,7 +214,7 @@ void ProxyDialog::CityActivated(int index) Logger::Trace("Adding new buttons\n"); for (unsigned i = 0; i < proxies.size(); i++) { - QString btnStr = QString::fromUtf8(proxies[i].c_str()); + QString btnStr = QString::fromLocal8Bit(proxies[i].c_str()); QPushButton *btn = new QPushButton(btnStr); btn->setCheckable(true); genericProxyGroup->addButton(btn); |