summaryrefslogtreecommitdiff
path: root/client/Dialog.cpp
diff options
context:
space:
mode:
authorAlex <b0ris@b0ris-satellite.localdomain>2011-11-02 00:44:21 +0200
committerAlex <b0ris@b0ris-satellite.localdomain>2011-11-02 00:44:21 +0200
commitd4feb36aac09cb7d1d66cb069bb438daaea68705 (patch)
treee3222c2da2d438af7cc3695133fcb49cfca0a0d1 /client/Dialog.cpp
parent0b167475b3d838bc0a71d30e0356ccff2d819d8f (diff)
Resource files w certs. Fix static proxy labels and order. Panel label alignment
Diffstat (limited to 'client/Dialog.cpp')
-rw-r--r--client/Dialog.cpp32
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);
}