fix: code review

This commit is contained in:
Richard Ramos 2020-07-06 10:15:03 -04:00 committed by Iuri Matias
parent 5ee3c6938f
commit f16ee322e1
4 changed files with 16 additions and 14 deletions

View File

@ -120,8 +120,7 @@ QtObject:
proc setDeviceName*(self: ProfileView, deviceName: string) {.slot.} =
devices.setDeviceName(deviceName)
self.isDeviceSetup = true
self.deviceSetupChanged()
self.setDeviceSetup(true)
proc syncAllDevices*(self: ProfileView) {.slot.} =
devices.syncAllDevices()

View File

@ -4,11 +4,9 @@ import libstatus/installations
import json
proc setDeviceName*(name: string) =
discard getSettings()
discard setInstallationMetadata(getSetting[string]("installation-id", "", true), name, hostOs)
proc isDeviceSetup*():bool =
discard getSettings()
let installationId = getSetting[string]("installation-id", "", true)
let responseResult = parseJSON($getOurInstallations())["result"]
if responseResult.kind == JNull:

View File

@ -145,16 +145,6 @@ Item {
Timer {
id: timer
function setTimeout(cb, delayTime) {
timer.interval = delayTime;
timer.repeat = false;
timer.triggered.connect(cb);
timer.triggered.connect(function release () {
timer.triggered.disconnect(cb); // This is important
timer.triggered.disconnect(release); // This is important as well
});
timer.start();
}
}
}

15
ui/shared/Timer.qml Normal file
View File

@ -0,0 +1,15 @@
import QtQuick 2.13
Timer {
id: timer
function setTimeout(cb, delayTime) {
timer.interval = delayTime;
timer.repeat = false;
timer.triggered.connect(cb);
timer.triggered.connect(function release () {
timer.triggered.disconnect(cb); // This is important
timer.triggered.disconnect(release); // This is important as well
});
timer.start();
}
}