1
0
This commit is contained in:
Scott E. Graves
2017-04-11 13:41:21 -05:00
parent fe50099c00
commit e7d11e5b14
4 changed files with 27 additions and 24 deletions

View File

@@ -161,7 +161,7 @@
<p>Your storage allowance automatically refills every 6 weeks. Your computer must be online with your wallet unlocked to complete the refill. If Sia fails to refill the allowance by the end of the lock-in period, your data may be lost.</p>
<p class="footnote">*contract fees are non-refundable. They will be subtracted from the allowance that you set.</p>
<h2>Allocated Funds</h2>
<input type="number" id="ID_RenterSetFunds"><label id="ID_RenterCalcStorage"></label><br><br>
<input type="number" id="ID_RenterSetFunds">&nbsp;<label id="ID_RenterCalcStorage"></label><br><br>
<h2>Number of Hosts</h2>
<input type="number" id="ID_RenterSetHosts"><br><br>
<h2>Contract Period</h2>

View File

@@ -64,7 +64,7 @@
setValue('ID_RenterSetPeriod', allowance.Period);
setValue('ID_RenterSetRenewWindow', allowance.RenewWindowInBlocks);
AppActions.calculateEstimatedStorage(allowance.Funds, (res)=> {
setInnerText('ID_RenterCalcStorage', res);
setInnerText('ID_RenterCalcStorage', '~' + res);
});
}
}
@@ -279,7 +279,7 @@
const funds = document.getElementById('ID_RenterSetFunds');
funds.oninput = () => {
AppActions.calculateEstimatedStorage(funds.value, (res)=> {
setInnerText('ID_RenterCalcStorage', res);
setInnerText('ID_RenterCalcStorage', '~' + res);
});
};

View File

@@ -90,9 +90,9 @@ const std::uint8_t SIA_BLOCK_TIME_MINS = 10;
const std::uint32_t MINUTES_PER_MONTH = (730 * 60);
const std::uint32_t SIA_BLOCKS_PER_MONTH = MINUTES_PER_MONTH / SIA_BLOCK_TIME_MINS;
const std::uint32_t SIA_DEFAULT_HOST_COUNT = 24;
const std::uint32_t SIA_DEFAULT_RENEW_WINDOW = ((1440 / SIA_BLOCK_TIME_MINS) * 14);
const SiaCurrency SIA_DEFAULT_MINIMUM_FUNDS = 4000;
const std::uint32_t SIA_DEFAULT_CONTRACT_LENGTH = SIA_BLOCKS_PER_MONTH * 3;
const std::uint32_t SIA_DEFAULT_RENEW_WINDOW = SIA_DEFAULT_CONTRACT_LENGTH / 3;
#define DEFAULT_CONFIG_FILE_PATH L"./config/siadriveconfig.json"
#define DEFAULT_RENTER_DB_FILE_PATH L"./config/renter_upload.db3"
@@ -202,26 +202,8 @@ inline static SString SiaCurrencyToGB(const SiaCurrency& value)
return value.ToWString(conv);
}
inline static SString BytesToFriendlyDisplay(const SiaCurrency& bytes)
{
SString units[] = { "B", "KB", "MB", "GB", "TB", "PB" };
SString readableunit = "B";
SiaCurrency readablesize = bytes;
for (const auto& unit : units)
{
if (readablesize < 1000)
{
readableunit = unit;
break;
}
readablesize /= 1000;
}
ttmath::Conv conv;
conv.scient_from = 256;
conv.base = 10;
conv.round = 2;
return readablesize.ToWString(conv) + ' ' + readableunit;
}
SString SIADRIVE_EXPORTABLE BytesToFriendlyDisplay(const SiaCurrency& bytes);
BOOL SIADRIVE_EXPORTABLE RetryAction(std::function<BOOL()> func, std::uint16_t retryCount, const DWORD& retryDelay);

View File

@@ -148,6 +148,27 @@ BOOL RetryAction(std::function<BOOL()> func, std::uint16_t retryCount, const DWO
#endif
}
SString BytesToFriendlyDisplay(const SiaCurrency& bytes)
{
SString units[] = { "B", "KB", "MB", "GB", "TB", "PB" };
SString readableunit = "B";
SiaCurrency readablesize = bytes;
for (const auto& unit : units)
{
if (readablesize < 1000)
{
readableunit = unit;
break;
}
readablesize /= 1000;
}
ttmath::Conv conv;
conv.scient_from = 256;
conv.base = 10;
conv.round = 2;
return readablesize.ToWString(conv) + ' ' + readableunit;
}
#ifdef _WIN32
std::vector<SString> GetAvailableDrives()
{