forked from Silverfish/proton-bridge
GODT-1351: Cache and update of space bytes in user object.
This commit is contained in:
@ -42,7 +42,7 @@ Item {
|
||||
|
||||
function spaceWithUnits(bytes){
|
||||
if (bytes*1 !== bytes ) return "0 kB"
|
||||
var units = ['B',"kB", "MB", "TB"];
|
||||
var units = ['B',"kB", "MB", "GB", "TB"];
|
||||
var i = parseInt(Math.floor(Math.log(bytes)/Math.log(1024)));
|
||||
|
||||
return Math.round(bytes*10 / Math.pow(1024, i))/10 + " " + units[i]
|
||||
|
||||
@ -287,8 +287,8 @@ func (qu *QMLUser) update(user types.User) {
|
||||
qu.SetLoggedIn(user.IsConnected())
|
||||
qu.SetSplitMode(!user.IsCombinedAddressMode())
|
||||
qu.SetSetupGuideSeen(false)
|
||||
qu.SetUsedBytes(1.0) // TODO
|
||||
qu.SetTotalBytes(10000.0) // TODO
|
||||
qu.SetUsedBytes(float32(user.UsedBytes()))
|
||||
qu.SetTotalBytes(float32(user.TotalBytes()))
|
||||
qu.SetPassword(user.GetBridgePassword())
|
||||
qu.SetAddresses(user.GetAddresses())
|
||||
}
|
||||
|
||||
@ -60,6 +60,8 @@ type UserManager interface {
|
||||
// User is an interface of user needed by frontend.
|
||||
type User interface {
|
||||
ID() string
|
||||
UsedBytes() int64
|
||||
TotalBytes() int64
|
||||
Username() string
|
||||
IsConnected() bool
|
||||
IsCombinedAddressMode() bool
|
||||
|
||||
Reference in New Issue
Block a user