1
0

Added estimated storage

This commit is contained in:
Scott E. Graves
2017-02-18 16:31:24 -06:00
parent 720cbcf601
commit 1f75127359
6 changed files with 32 additions and 4 deletions

View File

@@ -170,22 +170,23 @@
<td style="text-align: right">Host Count:</td>
<td id="ID_Renter_HostCount"></td>
</tr>
<tr><td><br/></td></tr>
<tr>
<td style="text-align: right">Total Space:</td>
<td style="text-align: right">Total GB:</td>
<td id="ID_Renter_EstimatedSpace"></td>
<td colspan="40%"></td>
<td style="text-align: right">Price (per GB):</td>
<td id="ID_Renter_EstimatedCost"></td>
</tr>
<tr>
<td style="text-align: right">Available Space:</td>
<td style="text-align: right">Available GB:</td>
<td id="ID_Renter_AvailablSpace"></td>
<td colspan="40%"></td>
<td style="text-align: right">Download (per GB):</td>
<td id="ID_Renter_EstimatedDownlodCost"></td>
</tr>
<tr>
<td style="text-align: right">Used Space:</td>
<td style="text-align: right">Used GB:</td>
<td id="ID_Renter_UsedSpace"></td>
<td colspan="40%"></td>
<td style="text-align: right">Upload (per GB):</td>

Binary file not shown.

View File

@@ -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;
}

View File

@@ -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<void()> action);
void ProcessUiActionQueue();
void ClearDisplay();

View File

@@ -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);