Require Sia 1.2.0 and fix UI available/free storage display
This commit is contained in:
@@ -68,21 +68,21 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="text-align: right">Total GB:</td>
|
<td style="text-align: right">Total:</td>
|
||||||
<td id="ID_Renter_EstimatedSpace"></td>
|
<td id="ID_Renter_EstimatedSpace"></td>
|
||||||
<td colspan="50%"></td>
|
<td colspan="50%"></td>
|
||||||
<td style="text-align: right">Price (per GB):</td>
|
<td style="text-align: right">Price (per GB):</td>
|
||||||
<td id="ID_Renter_EstimatedCost"></td>
|
<td id="ID_Renter_EstimatedCost"></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="text-align: right">Available GB:</td>
|
<td style="text-align: right">Available:</td>
|
||||||
<td id="ID_Renter_AvailablSpace"></td>
|
<td id="ID_Renter_AvailablSpace"></td>
|
||||||
<td colspan="50%"></td>
|
<td colspan="50%"></td>
|
||||||
<td style="text-align: right">Download (per GB):</td>
|
<td style="text-align: right">Download (per GB):</td>
|
||||||
<td id="ID_Renter_EstimatedDownloadCost"></td>
|
<td id="ID_Renter_EstimatedDownloadCost"></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="text-align: right">Used GB:</td>
|
<td style="text-align: right">Used:</td>
|
||||||
<td id="ID_Renter_UsedSpace"></td>
|
<td id="ID_Renter_UsedSpace"></td>
|
||||||
<td colspan="50%"></td>
|
<td colspan="50%"></td>
|
||||||
<td style="text-align: right">Upload (per GB):</td>
|
<td style="text-align: right">Upload (per GB):</td>
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
#define SIDRIVE_VERSION_STRING "0.0.1"
|
#define SIDRIVE_VERSION_STRING "0.0.1"
|
||||||
#define COMPAT_SIAD_VERSION "1.1.2"
|
#define COMPAT_SIAD_VERSION "1.2.0"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
// Disable DLL-interface warnings
|
// Disable DLL-interface warnings
|
||||||
@@ -194,15 +194,6 @@ inline static Hastings SiaCurrencyToHastings(const SiaCurrency& currency)
|
|||||||
return parser.stack[0].value.ToString(conv);
|
return parser.stack[0].value.ToString(conv);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static SString SiaCurrencyToGB(const SiaCurrency& value)
|
|
||||||
{
|
|
||||||
ttmath::Conv conv;
|
|
||||||
conv.base = 10;
|
|
||||||
conv.round = 3;
|
|
||||||
|
|
||||||
return value.ToWString(conv);
|
|
||||||
}
|
|
||||||
|
|
||||||
SString SIADRIVE_EXPORTABLE BytesToFriendlyDisplay(const SiaCurrency& bytes);
|
SString SIADRIVE_EXPORTABLE BytesToFriendlyDisplay(const SiaCurrency& bytes);
|
||||||
|
|
||||||
BOOL SIADRIVE_EXPORTABLE RetryAction(std::function<BOOL()> func, std::uint16_t retryCount, const DWORD& retryDelay);
|
BOOL SIADRIVE_EXPORTABLE RetryAction(std::function<BOOL()> func, std::uint16_t retryCount, const DWORD& retryDelay);
|
||||||
|
@@ -438,12 +438,13 @@ void CSiaDriveApp::SiaApiRefreshCallback(CefRefPtr<CefV8Context> context, const
|
|||||||
global->GetValue("uiState")->SetValue("allocatedRenterFunds", CefV8Value::CreateString(SiaCurrencyToString(allocatedFunds).str()), V8_PROPERTY_ATTRIBUTE_NONE);
|
global->GetValue("uiState")->SetValue("allocatedRenterFunds", CefV8Value::CreateString(SiaCurrencyToString(allocatedFunds).str()), V8_PROPERTY_ATTRIBUTE_NONE);
|
||||||
|
|
||||||
// Space
|
// Space
|
||||||
SiaCurrency totalUsedGb = _siaApi->GetRenter()->GetTotalUsedBytes() ? _siaApi->GetRenter()->GetTotalUsedBytes() / (1024.0 * 1024.0 * 1024.0) : 0.0;
|
SiaCurrency totalUsed = _siaApi->GetRenter()->GetTotalUsedBytes() ? _siaApi->GetRenter()->GetTotalUsedBytes() : 0.0;
|
||||||
auto totalAvailable = (totalUsedGb / (allocatedFunds - unspentFunds)) * allocatedFunds;
|
SiaCurrency totalAvailable;
|
||||||
auto totalRemainGb = totalAvailable - totalUsedGb;
|
_siaApi->GetRenter()->CalculateEstimatedStorage(allocatedFunds, totalAvailable);
|
||||||
ExecuteSetter(context, renterActions, "setEstimatedSpace", SiaCurrencyToGB(totalAvailable));
|
auto totalRemain = totalAvailable > 0 ? totalAvailable - totalUsed : 0;
|
||||||
ExecuteSetter(context, renterActions, "setAvailableSpace", SiaCurrencyToGB(totalRemainGb));
|
ExecuteSetter(context, renterActions, "setEstimatedSpace", BytesToFriendlyDisplay(totalAvailable));
|
||||||
ExecuteSetter(context, renterActions, "setUsedSpace", SiaCurrencyToGB(totalUsedGb));
|
ExecuteSetter(context, renterActions, "setAvailableSpace", BytesToFriendlyDisplay(totalRemain));
|
||||||
|
ExecuteSetter(context, renterActions, "setUsedSpace", BytesToFriendlyDisplay(totalUsed));
|
||||||
|
|
||||||
// Upload Progress
|
// Upload Progress
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user