diff options
author | Alex Borisov <b0ric.alex@gmail.com> | 2012-03-25 22:16:30 +0300 |
---|---|---|
committer | Alex Borisov <b0ric.alex@gmail.com> | 2012-03-25 22:16:30 +0300 |
commit | ec80c67bcfec64177910f39d31c4b20974629096 (patch) | |
tree | 7132d5c394e0e62d3d17a40ce7587d270f3706b6 | |
parent | fc68a17bda76f7ffe8493bb8f9593631b9d05ba1 (diff) |
Three color speed values
-rw-r--r-- | client/Config.cpp | 2 | ||||
-rw-r--r-- | client/Config.h | 10 | ||||
-rw-r--r-- | client/Dialog.cpp | 7 | ||||
-rw-r--r-- | client/Logger.cpp | 6 | ||||
-rw-r--r-- | client/SslClient.cpp | 2 |
5 files changed, 22 insertions, 5 deletions
diff --git a/client/Config.cpp b/client/Config.cpp index 45d8f72..8b4f67d 100644 --- a/client/Config.cpp +++ b/client/Config.cpp @@ -90,7 +90,7 @@ Config::ServerEntry::ServerEntry(string& entry): host("127.0.0.1"), timeout(120) /* * Config nested class section */ -Config::Config(): StaticProxySpeedLow(50) +Config::Config(): StaticProxySpeedLow(125000), StaticProxySpeedLowCrucial(25000) { Logger::Info("Parsing config.cfg to determine initial configuration\n"); QString configPath = this_app->applicationDirPath()+ "/config.cfg"; diff --git a/client/Config.h b/client/Config.h index ac2ed31..67d5cde 100644 --- a/client/Config.h +++ b/client/Config.h @@ -237,9 +237,15 @@ public: /** * @brief Static proxy speed value limit.<br/> * This value is used to determine speed label color. - * All speed value below this constant will be red, higher values will be green + * All speed value below this constant will be yellow, higher values will be green */ const unsigned StaticProxySpeedLow; + /** + * @brief Static proxy speed value limit.<br/> + * This value is used to determine speed label color. + * All speed value below this constant will be red, higher values will be yellow + */ + const unsigned StaticProxySpeedLowCrucial; protected: /** * @brief Class to represend 'server' record in the config file @@ -330,4 +336,4 @@ private: vector<FileEntry> fileActions; }; -#endif
\ No newline at end of file +#endif diff --git a/client/Dialog.cpp b/client/Dialog.cpp index 169d33e..3e96784 100644 --- a/client/Dialog.cpp +++ b/client/Dialog.cpp @@ -74,6 +74,12 @@ ProxyDialog::ProxyDialog(QWidget *parent): QDialog(parent, Qt::Tool | Qt::Framel QString::number(speed, 'f', 3) + QString("</b></font>"); } + else if (staticProxyLine[j].speed > cfg->StaticProxySpeedLowCrucial) + { + btnStr = QString("<font color=\"orange\"><b>") + + QString::number(speed, 'f', 3) + + QString("</b></font>"); + } else { btnStr = QString("<font color=\"red\"><b>") + @@ -126,7 +132,6 @@ bool ProxyDialog::event(QEvent* event) { if (event->type() == QEvent::ActivationChange) { - Logger::Debug("Activation change\n"); if(QApplication::activeWindow() != this) { this->close(); diff --git a/client/Logger.cpp b/client/Logger.cpp index 63c4d8f..e0e769f 100644 --- a/client/Logger.cpp +++ b/client/Logger.cpp @@ -15,11 +15,13 @@ FILE* Logger::logFile = NULL; void Logger::InitLogFile() { + /* if (logFile == NULL) { logFile = fopen("client.log", "a"); setbuf(logFile, NULL); } + */ } void Logger::Trace(string msg, ...) @@ -109,10 +111,12 @@ void Logger::Log(LogLevelType logLevel, string msg, va_list args) sprintf(newfmt, "[%s] %-6s: %s", time_str, log_level_str.c_str(), msg.c_str()); vsprintf(logstr, newfmt, args); fprintf(stderr, logstr); - if (logFile != NULL) + /* + if (logFile != NULL) { fprintf(logFile, logstr); } + */ delete [] newfmt; } diff --git a/client/SslClient.cpp b/client/SslClient.cpp index d3eb9a9..64f63ac 100644 --- a/client/SslClient.cpp +++ b/client/SslClient.cpp @@ -220,6 +220,7 @@ void SslClient::DataRecieved() return; } + /* fprintf(Logger::logFile, "[ "); const char * tmp = pkt.constData(); for (int i = 0; i < pkt.size(); i++) @@ -234,6 +235,7 @@ void SslClient::DataRecieved() } } fprintf(Logger::logFile, "]\n"); + */ /* remove header and tail */ pkt.remove(pkt.size()-3, 3); |