diff options
Diffstat (limited to 'client/Dialog.cpp')
-rw-r--r-- | client/Dialog.cpp | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/client/Dialog.cpp b/client/Dialog.cpp index 63a3c63..86fecdf 100644 --- a/client/Dialog.cpp +++ b/client/Dialog.cpp @@ -1,13 +1,13 @@ #include <QtGui> #include <iostream> +#include <sstream> #include <typeinfo> #include "client.h" #include "Config.h" #include "Dialog.h" #include "Proxy.h" - using namespace std; ProxyDialog::ProxyDialog(QWidget *parent): QDialog(parent) @@ -23,6 +23,7 @@ ProxyDialog::ProxyDialog(QWidget *parent): QDialog(parent) /* generic proxy panel */ topLabel = new QLabel("Top Panel"); + topLabel->setAlignment(Qt::AlignHCenter); countryBox = new QComboBox; stateBox = new QComboBox; stateBox->setVisible(false); @@ -51,7 +52,8 @@ ProxyDialog::ProxyDialog(QWidget *parent): QDialog(parent) genericProxyGroup = new QButtonGroup; /* static proxy panel */ - bottomLabel = new QLabel(tr("Bottom Panel")); + bottomLabel = new QLabel("Bottom Panel"); + bottomLabel->setAlignment(Qt::AlignHCenter); QGridLayout *bottomPanelLayout = new QGridLayout; unsigned nlines = cfg->GetStaticProxyGuiLines(); for (unsigned i = 0; i < nlines; i++) @@ -59,16 +61,24 @@ ProxyDialog::ProxyDialog(QWidget *parent): QDialog(parent) vector<ProxyEntryStatic> staticProxyLine = cfg->GetStaticProxyGuiLine(i+1); for (unsigned j = 0; j < staticProxyLine.size(); j++) { - //char speed[8]; - //sprintf(speed, "%d", staticProxyLine[j].speed); - //QLabel *speedLabel = new QLabel(speed); + stringstream ss; + if (staticProxyLine[j].speed > cfg->StaticProxySpeedLow) + { + ss << "<font color=\"green\"><b>" << staticProxyLine[j].speed << "</b></font>"; + } + else + { + ss << "<font color=\"red\"><b>" << staticProxyLine[j].speed << "</b></font>"; + } + QLabel *speedLabel = new QLabel(ss.str().c_str()); QString btnStr = QString::fromUtf8(staticProxyLine[j]. name.c_str()); - //QLabel *btnLabel = new QLabel(btnStr); - //QHBoxLayout *btnLayout = new QHBoxLayout; - //btnLayout->addWidget(speedLabel); - //btnLayout->addWidget(btnLabel); - QPushButton *btn = new QPushButton(btnStr); - //btn->setLayout(btnLayout); + QLabel *btnLabel = new QLabel(btnStr); + QHBoxLayout *btnLayout = new QHBoxLayout; + btnLayout->setSizeConstraint(QLayout::SetMinimumSize); + btnLayout->addWidget(speedLabel); + btnLayout->addWidget(btnLabel); + QPushButton *btn = new QPushButton(); + btn->setLayout(btnLayout); btn->setCheckable(true); bottomPanelLayout->addWidget(btn, i, j); } |