From 1f75127359397432623f56f1e409a8eca54ffe4b Mon Sep 17 00:00:00 2001 From: "Scott E. Graves" Date: Sat, 18 Feb 2017 16:31:24 -0600 Subject: [PATCH] Added estimated storage --- SiaDrive.Api/SiaRenter.cpp | 2 +- SiaDrive/SiaDrive.htm | 7 ++++--- SiaDrive/SiaDrive.rc | Bin 11706 -> 11706 bytes SiaDrive/SiaDriveDlg.cpp | 17 +++++++++++++++++ SiaDrive/SiaDriveDlg.h | 2 ++ SiaDrive/res/code.js | 8 ++++++++ 6 files changed, 32 insertions(+), 4 deletions(-) diff --git a/SiaDrive.Api/SiaRenter.cpp b/SiaDrive.Api/SiaRenter.cpp index 24144da..d0490e5 100644 --- a/SiaDrive.Api/SiaRenter.cpp +++ b/SiaDrive.Api/SiaRenter.cpp @@ -83,7 +83,7 @@ void CSiaApi::_CSiaRenter::AutoThreadCallback(const CSiaCurl& siaCurl) { return sz + file->GetFileSize(); }); - SetTotalUsedBytes(total); + SetTotalUsedBytes(total); } else { diff --git a/SiaDrive/SiaDrive.htm b/SiaDrive/SiaDrive.htm index 6ce82ef..e9a9a58 100644 --- a/SiaDrive/SiaDrive.htm +++ b/SiaDrive/SiaDrive.htm @@ -170,22 +170,23 @@ Host Count: +
- Total Space: + Total GB: Price (per GB): - Available Space: + Available GB: Download (per GB): - Used Space: + Used GB: Upload (per GB): diff --git a/SiaDrive/SiaDrive.rc b/SiaDrive/SiaDrive.rc index 4fbdee246cf528869a864847758aacdd2ae9b2ab..b2c755f3a8cbc70ef7697188ca3e9a7489296638 100644 GIT binary patch delta 35 rcmdlLy(@Zyn+U5hg8_r_GetRenter()->GetHosts()); SetRenterTotalUsed(_siaApi->GetRenter()->GetTotalUsedBytes()); + SiaCurrency t = _siaApi->GetRenter()->GetTotalUsedBytes() ? _siaApi->GetRenter()->GetTotalUsedBytes() / (1024.0 * 1024.0 * 1024.0) : 0.0; + auto a = (t / (allocatedFunds - unspentFunds) * allocatedFunds) * 1024.0; + SetRenterTotalAvailable(a.ToDouble()); + SetRenterTotalRemain((a-t).ToDouble()); + SetConsensusHeight(_siaApi->GetConsensus()->GetHeight()); return true; } diff --git a/SiaDrive/SiaDriveDlg.h b/SiaDrive/SiaDriveDlg.h index 286a38d..0610bd6 100644 --- a/SiaDrive/SiaDriveDlg.h +++ b/SiaDrive/SiaDriveDlg.h @@ -83,6 +83,8 @@ private: void SetRenterUsedFunds(const SiaCurrency& currency); void SetRenterHosts(const std::uint64_t& hosts); void SetRenterTotalUsed(const std::uint64_t& bytes); + void SetRenterTotalAvailable(const double& gb); + void SetRenterTotalRemain(const double& total); void QueueUiAction(std::function action); void ProcessUiActionQueue(); void ClearDisplay(); diff --git a/SiaDrive/res/code.js b/SiaDrive/res/code.js index 06fe600..bc3d223 100644 --- a/SiaDrive/res/code.js +++ b/SiaDrive/res/code.js @@ -80,6 +80,14 @@ function setRenterTotalUsedGb(gb) { setInnerText("ID_Renter_UsedSpace", gb); } +function setRenterTotalAvailGb(gb) { + setInnerText("ID_Renter_EstimatedSpace", gb); +} + +function setRenterTotalRemainGb(gb) { + setInnerText("ID_Renter_AvailablSpace", gb); +} + function setAvailableDrives(driveList) { driveList = Array.isArray(driveList) ? driveList : JSON.parse(driveList);