0
0
mirror of https://github.com/Doodle3D/doodle3d-client.git synced 2024-11-22 17:27:57 +01:00

Restore status text #152

This commit is contained in:
peteruithoven 2014-01-02 15:09:36 +01:00
parent dfcd3ee2c2
commit d5220225cc
2 changed files with 19 additions and 1 deletions

View File

@ -32,6 +32,7 @@ function SettingsWindow() {
this.apFieldSet; this.apFieldSet;
this.clientFieldSet; this.clientFieldSet;
this.restoreStateField;
this.networks; this.networks;
this.currentNetwork; // the ssid of the network the box is on this.currentNetwork; // the ssid of the network the box is on
this.selectedNetwork; // the ssid of the selected network in the client mode settings this.selectedNetwork; // the ssid of the selected network in the client mode settings
@ -45,6 +46,9 @@ function SettingsWindow() {
this.retrieveNetworkStatusDelay; // setTimout delay this.retrieveNetworkStatusDelay; // setTimout delay
this.retrieveNetworkStatusDelayTime = 1000; this.retrieveNetworkStatusDelayTime = 1000;
this.restoredStateHideDelayTime = 3000;
this.restoredStateHideDelay // setTimout instance
// Events // Events
SettingsWindow.SETTINGS_LOADED = "settingsLoaded"; SettingsWindow.SETTINGS_LOADED = "settingsLoaded";
@ -115,6 +119,7 @@ function SettingsWindow() {
self.apFieldSet = self.form.find("#apSettings"); self.apFieldSet = self.form.find("#apSettings");
self.clientFieldSet = self.form.find("#clientSettings"); self.clientFieldSet = self.form.find("#clientSettings");
self.btnRestoreSettings = self.form.find("#restoreSettings"); self.btnRestoreSettings = self.form.find("#restoreSettings");
self.restoreStateField = self.form.find("#restoreState");
btnAP.on('touchstart mousedown',self.showAPSettings); btnAP.on('touchstart mousedown',self.showAPSettings);
btnClient.on('touchstart mousedown',self.showClientSettings); btnClient.on('touchstart mousedown',self.showClientSettings);
@ -276,6 +281,10 @@ function SettingsWindow() {
//$("#restoreSettings").addClass("disabled"); //$("#restoreSettings").addClass("disabled");
self.btnRestoreSettings.attr("disabled", true); self.btnRestoreSettings.attr("disabled", true);
clearTimeout(self.restoredStateHideDelay);
self.setRestoreState("Restoring...");
//console.log(" self.wifiboxURL: ",self.wifiboxURL); //console.log(" self.wifiboxURL: ",self.wifiboxURL);
if (communicateWithWifibox) { if (communicateWithWifibox) {
@ -296,6 +305,10 @@ function SettingsWindow() {
$(document).trigger(SettingsWindow.SETTINGS_LOADED); $(document).trigger(SettingsWindow.SETTINGS_LOADED);
self.btnRestoreSettings.removeAttr("disabled"); self.btnRestoreSettings.removeAttr("disabled");
self.setRestoreState("Settings restored");
// auto hide status
clearTimeout(self.restoredStateHideDelay);
self.restoredStateHideDelay = setTimeout(function() { self.setRestoreState(""); },self.restoredStateHideDelayTime);
} }
} }
}).fail(function() { }).fail(function() {
@ -305,6 +318,9 @@ function SettingsWindow() {
}); });
} }
} }
this.setRestoreState = function(text) {
self.restoreStateField.html(text);
}
this.displayValidationError = function(key,msg) { this.displayValidationError = function(key,msg) {
var formElement = self.form.find("[name|='"+key+"']"); var formElement = self.form.find("[name|='"+key+"']");
formElement.addClass("error"); formElement.addClass("error");

View File

@ -175,9 +175,11 @@
<input type="button" onclick="settingsWindow.downloadGcode()" name="downloadGcode" value="Download GCODE" class="button" id="downloadGcode"/> <input type="button" onclick="settingsWindow.downloadGcode()" name="downloadGcode" value="Download GCODE" class="button" id="downloadGcode"/>
<input type="button" onclick="settingsWindow.downloadSvg()" name="downloadSvg" value="Download SVG" class="button" id="downloadSvg"/> <input type="button" onclick="settingsWindow.downloadSvg()" name="downloadSvg" value="Download SVG" class="button" id="downloadSvg"/>
</fieldset> </fieldset>
<fieldset id="restorePanel"> <fieldset id="restorePanel">
<legend>Restore</legend> <legend>Restore</legend>
<input type="button" name="restoresettings" value="Restore settings to defaults" class="button" id="restoreSettings"/> <input type="button" name="restoresettings" value="Restore settings to defaults" class="button" id="restoreSettings"/>
<span id="restoreState"></span>
</fieldset> </fieldset>
</form><br/> </form><br/>
</div> </div>