mirror of
https://github.com/wownero/wowlet.git
synced 2026-10-17 23:31:32 +02:00
Misc networking fixes
- connecting to nodes is much faster and more reliable now - reduced the amount of spaghetti in libwalletqt and greatly simplified the logic in nodes.cpp - Settings -> Node dialog should feel slightly more responsive - during synchronization the status bar will now display the amount of data downloaded - fixed some edge cases that could cause unreasonably long hangs - Help -> Debug Info screen now auto-updates every 5 seconds - Don't use SSL over Tor
This commit is contained in:
+20
-2
@@ -541,9 +541,8 @@ QFont Utils::relativeFont(int delta) {
|
||||
double Utils::roundSignificant(double N, double n)
|
||||
{
|
||||
int h;
|
||||
double l, a, b, c, d, e, i, j, m, f, g;
|
||||
double b, d, e, i, j, m, f;
|
||||
b = N;
|
||||
c = floor(N);
|
||||
|
||||
for (i = 0; b >= 1; ++i)
|
||||
b = b / 10;
|
||||
@@ -564,3 +563,22 @@ double Utils::roundSignificant(double N, double n)
|
||||
j = j / m;
|
||||
return j;
|
||||
}
|
||||
|
||||
QString Utils::formatBytes(quint64 bytes)
|
||||
{
|
||||
QVector<QString> sizes = { "B", "KB", "MB", "GB", "TB" };
|
||||
|
||||
int i;
|
||||
double _data;
|
||||
for (i = 0; i < sizes.count() && bytes >= 1000; i++, bytes /= 1000)
|
||||
_data = bytes / 1000.0;
|
||||
|
||||
if (_data < 0)
|
||||
_data = 0;
|
||||
|
||||
// unrealistic
|
||||
if (_data > 1000)
|
||||
_data = 0;
|
||||
|
||||
return QString("%1 %2").arg(QString::number(_data, 'f', 1), sizes[i]);
|
||||
}
|
||||
Reference in New Issue
Block a user