diff --git a/release/antos-1.2.0.tar.gz b/release/antos-1.2.0.tar.gz index 348062e..7f2a751 100644 Binary files a/release/antos-1.2.0.tar.gz and b/release/antos-1.2.0.tar.gz differ diff --git a/src/core/tags/AppDockTag.ts b/src/core/tags/AppDockTag.ts index c7384cc..6c174a3 100644 --- a/src/core/tags/AppDockTag.ts +++ b/src/core/tags/AppDockTag.ts @@ -61,10 +61,10 @@ namespace OS { * process in the dock * * @private - * @type {application.BaseApplication} + * @type {AppDockItemType} * @memberof AppDockTag */ - private _selectedApp: application.BaseApplication; + private _selectedItem: AppDockItemType; /** *Creates an instance of AppDockTag. @@ -152,24 +152,39 @@ namespace OS { * @memberof AppDockTag */ set selectedApp(v: application.BaseApplication) { - this._selectedApp = v; let el = undefined; for (let it of this.items) { it.app.blur(); $(it.domel).removeClass(); if (v && v === it.app) { - el = it.domel; + el = it; } } + this._selectedItem = el; if (!el) { return; } - $(el).addClass("selected"); + $(el.domel).addClass("selected"); ($(Ant.OS.GUI.workspace)[0] as FloatListTag).unselect(); } get selectedApp(): application.BaseApplication { - return this._selectedApp; + if(!this._selectedItem) + return undefined; + return this._selectedItem.app; + } + + + /** + * Get selected item of the dock + * + * @readonly + * @type {AppDockItemType} + * @memberof AppDockTag + */ + get selectedItem(): AppDockItemType + { + return this._selectedItem; } /** @@ -267,6 +282,41 @@ namespace OS { return m.show(e); }; announcer.trigger("sysdockloaded", undefined); + GUI.bindKey("CTRL-ALT-2", (e) =>{ + if(!this.items || this.items.length === 0) + { + return; + } + let index = this.items.indexOf(this.selectedItem); + if(index < 0) + { + index = 0; + } + else + { + index++; + } + if(index >= this.items.length) + index = 0; + this.items[index].app.trigger("focus"); + }); + GUI.bindKey("CTRL-ALT-1", (e) =>{ + if(!this.items || this.items.length === 0) + { + return; + } + let index = this.items.indexOf(this.selectedItem); + index--; + if(index < 0) + { + index = this.items.length - 1; + } + if(index < 0) + { + return; + } + this.items[index].app.trigger("focus"); + }); } } define("afx-apps-dock", AppDockTag); diff --git a/src/core/tags/SystemPanelTag.ts b/src/core/tags/SystemPanelTag.ts index 6aba64f..faa8d6f 100644 --- a/src/core/tags/SystemPanelTag.ts +++ b/src/core/tags/SystemPanelTag.ts @@ -30,6 +30,21 @@ namespace OS { */ private _view: boolean; + /** + * Store pending loading task + * + * @private + * @type {number[]} + * @memberof SystemPanelTag + */ + private _pending_task: number[]; + + /** + * Loading animation check timeout + * + * @memberof SystemPanelTag + */ + private _loading_toh: any; /** * Place holder for a private callback function * @@ -49,6 +64,8 @@ namespace OS { iconclass: "fa fa-circle", }; this._view = false; + this._pending_task = []; + this._loading_toh = undefined; } /** @@ -342,6 +359,23 @@ namespace OS { }); } + /** + * Check if the loading tasks ended, + * if it the case, stop the animation + * + * @private + * @memberof SystemPanelTag + */ + private animation_check(): void { + if(this._pending_task.length === 0) + { + $(this.refs.panel).removeClass("loading"); + $(GUI.workspace).css("cursor", "auto"); + } + if(this._loading_toh) + clearTimeout(this._loading_toh); + this._loading_toh = undefined; + } /** * Mount the tag bind some basic event * @@ -435,6 +469,24 @@ namespace OS { announcer.observable.on("app-pinned", (d) => { this.RefreshPinnedApp(); }); + announcer.observable.on("loading", (o) => { + this._pending_task.push(o.id); + if(!$(this.refs.panel).hasClass("loading")) + $(this.refs.panel).addClass("loading"); + $(GUI.workspace).css("cursor", "wait"); + }); + + announcer.observable.on("loaded", (o) => { + const i = this._pending_task.indexOf(o.id); + if (i >= 0) { + this._pending_task.splice(i, 1); + } + if (this._pending_task.length === 0) { + // set time out + if(!this._loading_toh) + this._loading_toh = setTimeout(() => this.animation_check(),1000); + } + }); this.RefreshPinnedApp(); } } diff --git a/src/packages/Syslog/PushNotification.ts b/src/packages/Syslog/PushNotification.ts index 1d5e62e..a5e1671 100644 --- a/src/packages/Syslog/PushNotification.ts +++ b/src/packages/Syslog/PushNotification.ts @@ -75,11 +75,9 @@ namespace OS { if (b && this.iconclass === "fa fa-bars") { this.iconclass = "fa fa-spinner fa-spin"; this.update(); - $(this._gui.workspace).css("cursor", "wait"); } else if (!b && this.iconclass === "fa fa-spinner fa-spin") { this.iconclass = "fa fa-bars"; this.update(); - $(this._gui.workspace).css("cursor", "auto"); } } diff --git a/src/themes/system/afx-sys-panel.css b/src/themes/system/afx-sys-panel.css index 1d34a47..dde958d 100644 --- a/src/themes/system/afx-sys-panel.css +++ b/src/themes/system/afx-sys-panel.css @@ -8,7 +8,50 @@ afx-sys-panel > div{ margin:0; padding: 0; position:absolute; - } +} + +afx-sys-panel > div.loading::before{ + background-color: orangered; + content: ""; + position: absolute; + height: 2px; + width: 0%; +} + +afx-sys-panel > div.loading::before { + right: 0; + bottom:0; + animation: sys-loading 1s linear infinite; +} + +@keyframes sys-loading { + 0% { + right: auto; + left: 0; + width: 25%; + } + 25% { + right: auto; + left: 25%; + width: 25%; + } + 50% { + right: auto; + left: 50%; + width: 25%; + } + 75% { + right: auto; + left: 75%; + width: 25%; + } + 100% { + right: auto; + left: 100%; + width: 12.5%; + } +} + afx-sys-panel .afx-panel-os-menu { padding:0; margin: 0;