#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! Config *cfg = Config::CurrentConfig(); cfg->AcquireConfig(); if (! cfg->IsConfigValid()) { 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; for (unsigned i = 0; i < countries.size(); i++) { countryBox->addItem(countries[i].c_str()); } stateBox = new QComboBox; for (unsigned i = 0; i < states.size(); i++) { stateBox->addItem(states[i].c_str()); } cityBox = new QComboBox; for (unsigned i = 0; i < cities.size(); i++) { cityBox->addItem(cities[i].c_str()); } /* proxy buttons */ QPushButton *topProxy1 = new QPushButton("proxy 1"); QPushButton *topProxy2 = new QPushButton("proxy 2"); QPushButton *bottomProxy1 = new QPushButton("proxy 3"); QPushButton *bottomProxy2 = new QPushButton("proxy 4"); bottomLabel = new QLabel(tr("Bottom Panel")); /* setup layouting */ QVBoxLayout *comboBoxLayout = new QVBoxLayout; comboBoxLayout->addWidget(countryBox); comboBoxLayout->addWidget(stateBox); comboBoxLayout->addWidget(cityBox); QVBoxLayout *proxyButtonLayout = new QVBoxLayout; proxyButtonLayout->addWidget(topProxy1); proxyButtonLayout->addWidget(topProxy2); QHBoxLayout *topPanelLayout = new QHBoxLayout; topPanelLayout->addLayout(comboBoxLayout); topPanelLayout->addLayout(proxyButtonLayout); QHBoxLayout *bottomPanelLayout = new QHBoxLayout; bottomPanelLayout->addWidget(bottomProxy1); bottomPanelLayout->addWidget(bottomProxy2); QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->addWidget(topLabel); mainLayout->addLayout(topPanelLayout); mainLayout->addWidget(bottomLabel); mainLayout->addLayout(bottomPanelLayout); setLayout(mainLayout); }