From 3899450af16a0162aac8e91c5487c2a802c609d7 Mon Sep 17 00:00:00 2001 From: Alex Borisov Date: Tue, 25 Oct 2011 03:55:49 +0300 Subject: Config method to acquire country/state/city names. Doxygen docs --- client/Dialog.cpp | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) (limited to 'client/Dialog.cpp') diff --git a/client/Dialog.cpp b/client/Dialog.cpp index 375fd98..3b477e1 100644 --- a/client/Dialog.cpp +++ b/client/Dialog.cpp @@ -1,11 +1,14 @@ #include +#include #include "client.h" #include "Config.h" #include "Dialog.h" #include "Proxy.h" +using namespace std; + ProxyDialog::ProxyDialog(QWidget *parent): QDialog(parent) { //WIPE it out!!! COnfig shoud be reread by timer event! @@ -16,22 +19,31 @@ ProxyDialog::ProxyDialog(QWidget *parent): QDialog(parent) Logger::Fatal("No valid configuration found! Can't proceed."); return ; } + vector countries = cfg->GetCountries(); + string country = "Ukraine"; + vector states = cfg->GetStates(country); + string state = "AR Krym"; + vector cities = cfg->GetCities(country, state); + topLabel = new QLabel(tr("Top Panel")); countryBox = new QComboBox; - countryBox->addItem(tr("Ukraine")); - countryBox->addItem(tr("Russia")); + for (unsigned i = 0; i < countries.size(); i++) + { + countryBox->addItem(countries[i].c_str()); + } stateBox = new QComboBox; - stateBox->addItem("AR Krym"); - stateBox->addItem("Kharkovskaya obl."); - stateBox->addItem("Odesskaya obl."); + for (unsigned i = 0; i < states.size(); i++) + { + stateBox->addItem(states[i].c_str()); + } cityBox = new QComboBox; - cityBox->addItem("Alushta"); - cityBox->addItem("Simferopol"); - cityBox->addItem("Yalta"); - cityBox->addItem("Sevastopol"); + for (unsigned i = 0; i < cities.size(); i++) + { + cityBox->addItem(cities[i].c_str()); + } /* proxy buttons */ QPushButton *topProxy1 = new QPushButton("proxy 1"); -- cgit v1.2.3