diff options
Diffstat (limited to 'client/Dialog.cpp')
-rw-r--r-- | client/Dialog.cpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/client/Dialog.cpp b/client/Dialog.cpp index 3ae26aa..2610bea 100644 --- a/client/Dialog.cpp +++ b/client/Dialog.cpp @@ -11,15 +11,16 @@ using namespace std; -ProxyDialog::ProxyDialog(QWidget *parent): QDialog(parent, Qt::Popup) +ProxyDialog::ProxyDialog(QWidget *parent): QDialog(parent, Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint) { UpdatedConfig *cfg = UpdatedConfig::CurrentConfig(); + Proxifier *proxifier = Proxifier::GetInstance(); if (!proxifier->IsValid()) { Logger::Error("No valid proxifier configuration file found!\n"); } - + connect(this, SIGNAL(finished(int)), this, SLOT(Closed(int))); /* generic proxy panel */ @@ -65,22 +66,26 @@ ProxyDialog::ProxyDialog(QWidget *parent): QDialog(parent, Qt::Popup) vector<ProxyEntryStatic> staticProxyLine = cfg->GetStaticProxyGuiLine(i+1); for (unsigned j = 0; j < staticProxyLine.size(); j++) { - stringstream ss; + QString btnStr; if (cfg->IsSpeedVisible) { + double speed = 1.0 * staticProxyLine[j].speed * 8 / 1000000; if (staticProxyLine[j].speed > cfg->StaticProxySpeedLow) { - ss << "<font color=\"green\"><b>" << staticProxyLine[j].speed << "</b></font>"; + btnStr = QString("<font color=\"green\"><b>") + + QString::number(speed, 'f', 3) + + QString("</b></font>"); } else { - ss << "<font color=\"red\"><b>" << staticProxyLine[j].speed << "</b></font>"; + btnStr = QString("<font color=\"red\"><b>") + + QString::number(speed, 'f', 3) + + QString("</b></font>"); } - ss << " "; + btnStr += " "; } - ss << staticProxyLine[j].name; + btnStr += QString::fromLocal8Bit(staticProxyLine[j].name.c_str()); - QString btnStr = QString::fromLocal8Bit(ss.str().c_str()); QLabel *btnLabel = new QLabel(btnStr); btnLabel->setAttribute(Qt::WA_TransparentForMouseEvents); QHBoxLayout *btnLayout = new QHBoxLayout; |