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 4fbdee2..b2c755f 100644 Binary files a/SiaDrive/SiaDrive.rc and b/SiaDrive/SiaDrive.rc differ diff --git a/SiaDrive/SiaDriveDlg.cpp b/SiaDrive/SiaDriveDlg.cpp index 051971b..461593b 100644 --- a/SiaDrive/SiaDriveDlg.cpp +++ b/SiaDrive/SiaDriveDlg.cpp @@ -440,7 +440,9 @@ void CSiaDriveDlg::ClearDisplay() SetRenterAvailableFunds(0); SetRenterUsedFunds(0); SetRenterHosts(0); + SetRenterTotalAvailable(0.0); SetRenterTotalUsed(0); + SetRenterTotalRemain(0.0); SetConsensusHeight(0); } @@ -674,6 +676,16 @@ void CSiaDriveDlg::SetRenterHosts(const std::uint64_t& hosts) CallClientScript(L"setRenterHosts", std::to_wstring(hosts), nullptr); } +void CSiaDriveDlg::SetRenterTotalAvailable(const double& total) +{ + CallClientScript(L"setRenterTotalAvailGb", std::to_wstring(total), nullptr); +} + +void CSiaDriveDlg::SetRenterTotalRemain(const double& total) +{ + CallClientScript(L"setRenterTotalRemainGb", std::to_wstring(total), nullptr); +} + void CSiaDriveDlg::SetRenterTotalUsed(const std::uint64_t& bytes) { double total = bytes ? bytes / (1024.0 * 1024.0 * 1024.0) : 0.0; @@ -755,6 +767,11 @@ bool CSiaDriveDlg::UpdateSiaInfo() SetRenterHosts(_siaApi->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);