blob: 3b477e104d8ff99b41b32a3991690565bcc8c435 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
#include <QtGui>
#include <iostream>
#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<string> countries = cfg->GetCountries();
string country = "Ukraine";
vector<string> states = cfg->GetStates(country);
string state = "AR Krym";
vector<string> 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);
}
|