diff options
author | Alex Borisov <b0ric.alex@gmail.com> | 2012-03-24 00:28:40 +0200 |
---|---|---|
committer | Alex Borisov <b0ric.alex@gmail.com> | 2012-03-24 00:28:40 +0200 |
commit | db10b50c84a4aaf5014e0f164b3f4f79ca222429 (patch) | |
tree | 8d4e05390d478046d9bc602f5bee91e07b6e8170 /client/Dialog.cpp | |
parent | 05712da90682fed84e2ecf7e3037d8aed29ecf83 (diff) |
FIX: speed calc problem, tray click fix, other
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; |