forked from KolibriOS/kolibrios
nsinstall: add notify dialog to show downloading progress;
TODO (not for me): change 'nsinstall' icon to 'netsurf' git-svn-id: svn://kolibrios.org@7106 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
6cf659fe71
commit
5161f3acf0
2
programs/network/netsurf/build.bat
Normal file
2
programs/network/netsurf/build.bat
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
fasm nsinstall.asm nsinstall
|
||||||
|
pause
|
147
programs/network/netsurf/notify.asm
Normal file
147
programs/network/netsurf/notify.asm
Normal file
@ -0,0 +1,147 @@
|
|||||||
|
NOTIFY_RUN:
|
||||||
|
|
||||||
|
;; Make param
|
||||||
|
stdcall string.copy, sz_quote, params
|
||||||
|
stdcall string.copy, filelist_first, current_filename
|
||||||
|
call make_text
|
||||||
|
stdcall string.concatenate, sz_quote, params
|
||||||
|
stdcall string.concatenate, sz_flags, params
|
||||||
|
;; RUN NOTIFY
|
||||||
|
mcall 70, fi_launch
|
||||||
|
|
||||||
|
;; CONVERT PID TO STR
|
||||||
|
mov ebx, 10
|
||||||
|
mov ecx, 0
|
||||||
|
@@:
|
||||||
|
mov edx, 0
|
||||||
|
div ebx
|
||||||
|
push edx
|
||||||
|
inc ecx
|
||||||
|
cmpne eax, 0, @b
|
||||||
|
|
||||||
|
mov ebx, ctrl.name
|
||||||
|
@@:
|
||||||
|
pop eax
|
||||||
|
add al, "0"
|
||||||
|
mov [ebx], al
|
||||||
|
inc ebx
|
||||||
|
loop @b
|
||||||
|
|
||||||
|
;; ADD POSTFIX TO STR
|
||||||
|
mov dword [ebx + 0], "-NOT"
|
||||||
|
mov dword [ebx + 4], "IFY"
|
||||||
|
|
||||||
|
;; OPEN CONTROLLER (0x08 + 0x01 -- CREATE AND READ/WRITE)
|
||||||
|
mcall 68, 22, ctrl.name, 2048, 0x09
|
||||||
|
mov [ctrl.addr], eax
|
||||||
|
|
||||||
|
;; WAIT UNTIL CONTROLLER BECOMES READY TO USE
|
||||||
|
add eax, NTCTRL_READY
|
||||||
|
@@:
|
||||||
|
mcall 5, 1
|
||||||
|
cmpe byte [eax], 0, @b
|
||||||
|
|
||||||
|
;; CONFIG PBAR
|
||||||
|
mov eax, [ctrl.addr]
|
||||||
|
add eax, NTCTRL_PBAR_MAX
|
||||||
|
mov dword [eax], 55
|
||||||
|
|
||||||
|
mov eax, [ctrl.addr]
|
||||||
|
add eax, NTCTRL_PBAR_CUR
|
||||||
|
mov dword [eax], 0
|
||||||
|
|
||||||
|
mov eax, [ctrl.addr]
|
||||||
|
add eax, NTCTRL_APPLY_PBAR
|
||||||
|
mov byte [eax], 1
|
||||||
|
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
NOTIFY_CHANGE:
|
||||||
|
|
||||||
|
;; CHANGE TIMER
|
||||||
|
inc dword [timer]
|
||||||
|
mov ebx, dword [timer]
|
||||||
|
|
||||||
|
;; SEND TIMER TO PBAR
|
||||||
|
mov eax, [ctrl.addr]
|
||||||
|
add eax, NTCTRL_PBAR_CUR
|
||||||
|
mov dword [eax], ebx
|
||||||
|
|
||||||
|
;; APPLY PBAR
|
||||||
|
mov eax, [ctrl.addr]
|
||||||
|
add eax, NTCTRL_APPLY_PBAR
|
||||||
|
mov byte [eax], 1
|
||||||
|
|
||||||
|
;; CNANGE TEXT
|
||||||
|
mov byte [params], 0
|
||||||
|
call make_text
|
||||||
|
|
||||||
|
;; SEND TEXT TO NOTIFY
|
||||||
|
mov eax, [ctrl.addr]
|
||||||
|
add eax, NTCTRL_TEXT
|
||||||
|
stdcall string.copy, params, eax
|
||||||
|
|
||||||
|
;; APPLY NEW TEXT
|
||||||
|
mov eax, [ctrl.addr]
|
||||||
|
add eax, NTCTRL_APPLY_TEXT
|
||||||
|
mov byte [eax], 1
|
||||||
|
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
EXIT:
|
||||||
|
;; CHANGE ICON
|
||||||
|
mov eax, [ctrl.addr]
|
||||||
|
add eax, NTCTRL_ICON
|
||||||
|
mov byte [eax], 4
|
||||||
|
|
||||||
|
;; APPLY NEW ICON
|
||||||
|
mov eax, [ctrl.addr]
|
||||||
|
add eax, NTCTRL_APPLY_ICON
|
||||||
|
mov byte [eax], 1
|
||||||
|
|
||||||
|
;; CNANGE TEXT
|
||||||
|
mov byte [params], 0
|
||||||
|
stdcall string.concatenate, sz_final_text, params
|
||||||
|
|
||||||
|
;; SEND TEXT TO NOTIFY
|
||||||
|
mov eax, [ctrl.addr]
|
||||||
|
add eax, NTCTRL_TEXT
|
||||||
|
stdcall string.copy, params, eax
|
||||||
|
|
||||||
|
;; APPLY NEW TEXT
|
||||||
|
mov eax, [ctrl.addr]
|
||||||
|
add eax, NTCTRL_APPLY_TEXT
|
||||||
|
mov byte [eax], 1
|
||||||
|
|
||||||
|
mcall 5, 300
|
||||||
|
|
||||||
|
mcall 70, fileopen
|
||||||
|
|
||||||
|
;; CLOSE NOTIFY
|
||||||
|
mov eax, [ctrl.addr]
|
||||||
|
add eax, NTCTRL_CLOSE
|
||||||
|
mov byte [eax], 1
|
||||||
|
|
||||||
|
mcall -1
|
||||||
|
|
||||||
|
;-------------------------------------------------------------------------------
|
||||||
|
make_text:
|
||||||
|
stdcall string.concatenate, sz_text, params
|
||||||
|
stdcall string.concatenate, sz_sec_line_start, params
|
||||||
|
stdcall string.concatenate, current_filename, params
|
||||||
|
|
||||||
|
ret
|
||||||
|
;-------------------------------------------------------------------------------
|
@ -34,6 +34,10 @@ include '../../proc32.inc'
|
|||||||
include '../../dll.inc'
|
include '../../dll.inc'
|
||||||
include '../../debug-fdo.inc'
|
include '../../debug-fdo.inc'
|
||||||
include '../../develop/libraries/http/http.inc'
|
include '../../develop/libraries/http/http.inc'
|
||||||
|
include '../../notify.inc'
|
||||||
|
include '../../string.inc'
|
||||||
|
|
||||||
|
include 'notify.asm'
|
||||||
|
|
||||||
virtual at 0
|
virtual at 0
|
||||||
http_msg http_msg
|
http_msg http_msg
|
||||||
@ -106,11 +110,11 @@ proc get_file_over_http targeturl, targetfilename
|
|||||||
|
|
||||||
.file_error:
|
.file_error:
|
||||||
DEBUGF 1, "file_erroR with eax = %u!", eax
|
DEBUGF 1, "file_erroR with eax = %u!", eax
|
||||||
mcall -1
|
call EXIT
|
||||||
|
|
||||||
.http_error:
|
.http_error:
|
||||||
DEBUGF 1, "http_erroR!"
|
DEBUGF 1, "http_erroR!"
|
||||||
mcall -1
|
call EXIT
|
||||||
|
|
||||||
.http_transfer_done:
|
.http_transfer_done:
|
||||||
;; Write any remaining bytes from the http buffer into the file
|
;; Write any remaining bytes from the http buffer into the file
|
||||||
@ -158,7 +162,7 @@ proc make_new_folder newfolder
|
|||||||
jz .success
|
jz .success
|
||||||
|
|
||||||
DEBUGF 1, "Failed to create folder: %s\n", [newfolder]
|
DEBUGF 1, "Failed to create folder: %s\n", [newfolder]
|
||||||
mcall -1
|
call EXIT
|
||||||
|
|
||||||
.success:
|
.success:
|
||||||
popa
|
popa
|
||||||
@ -167,6 +171,7 @@ endp
|
|||||||
|
|
||||||
START:
|
START:
|
||||||
mcall 68, 11 ; init heap
|
mcall 68, 11 ; init heap
|
||||||
|
call NOTIFY_RUN
|
||||||
|
|
||||||
; load libraries
|
; load libraries
|
||||||
stdcall dll.Load, @IMPORT
|
stdcall dll.Load, @IMPORT
|
||||||
@ -225,6 +230,9 @@ START:
|
|||||||
;; current_filename is now set to the name of the file
|
;; current_filename is now set to the name of the file
|
||||||
;; current_url is now set to the name of the file we will get after download
|
;; current_url is now set to the name of the file we will get after download
|
||||||
DEBUGF 2, "Fetching : %s", current_filename
|
DEBUGF 2, "Fetching : %s", current_filename
|
||||||
|
pusha
|
||||||
|
call NOTIFY_CHANGE
|
||||||
|
popa
|
||||||
stdcall get_file_over_http, current_url, current_filename
|
stdcall get_file_over_http, current_url, current_filename
|
||||||
DEBUGF 2, "...DONE!\n"
|
DEBUGF 2, "...DONE!\n"
|
||||||
jmp .get_next_file
|
jmp .get_next_file
|
||||||
@ -233,12 +241,12 @@ START:
|
|||||||
DEBUGF 2, "-------------------------\n"
|
DEBUGF 2, "-------------------------\n"
|
||||||
DEBUGF 2, "NETSURF INSTALLED. Enjoy!\n"
|
DEBUGF 2, "NETSURF INSTALLED. Enjoy!\n"
|
||||||
DEBUGF 2, "-------------------------\n"
|
DEBUGF 2, "-------------------------\n"
|
||||||
mcall -1
|
call EXIT
|
||||||
;; Inform user that all files are done
|
;; Inform user that all files are done
|
||||||
|
|
||||||
.all_files_done_error:
|
.all_files_done_error:
|
||||||
DEBUGF 1, "FATAL ERROR: FAILED.\n", eax
|
DEBUGF 1, "FATAL ERROR: FAILED.\n", eax
|
||||||
mcall -1
|
call EXIT
|
||||||
|
|
||||||
;---------------------------------------------------------------------
|
;---------------------------------------------------------------------
|
||||||
; Data area
|
; Data area
|
||||||
@ -262,6 +270,10 @@ dirname_res_icons db '/tmp0/1/res/icons', 0
|
|||||||
|
|
||||||
url db 'www.ashmew2.me/',0
|
url db 'www.ashmew2.me/',0
|
||||||
|
|
||||||
|
; I don't know why NOTIFY_CHANGE doesn't work for the first file
|
||||||
|
; so I use this small shit to fix it at NOTIFY_RUN phase
|
||||||
|
filelist_first db '/tmp0/1/netsurf-kolibrios', 0
|
||||||
|
|
||||||
filelist db 'netsurf-kolibrios', 0
|
filelist db 'netsurf-kolibrios', 0
|
||||||
db 'netsurf-kolibrios.map', 0
|
db 'netsurf-kolibrios.map', 0
|
||||||
db 'res/adblock.css', 0
|
db 'res/adblock.css', 0
|
||||||
@ -340,4 +352,38 @@ write_to_file dd 3
|
|||||||
socketdata rb 4096
|
socketdata rb 4096
|
||||||
current_url rb URLMAXLEN
|
current_url rb URLMAXLEN
|
||||||
current_filename rb FILENAMEMAXLEN
|
current_filename rb FILENAMEMAXLEN
|
||||||
|
|
||||||
|
;=====================================================================
|
||||||
|
; NOTIFY DATA
|
||||||
|
timer dd 0
|
||||||
|
params rb 256
|
||||||
|
ctrl:
|
||||||
|
.name rb 32
|
||||||
|
.addr rd 1
|
||||||
|
rb 2048
|
||||||
|
|
||||||
|
sz_text:
|
||||||
|
db "Netsurf installer ", 0
|
||||||
|
sz_quote:
|
||||||
|
db "'", 0
|
||||||
|
sz_sec_line_start:
|
||||||
|
db 10, "Fetching:",10, 0
|
||||||
|
sz_flags:
|
||||||
|
db "Ddcpt", 0
|
||||||
|
|
||||||
|
sz_final_text:
|
||||||
|
db "Netsurf installer",10,"Download complete.",10,"Enjoy!",0
|
||||||
|
|
||||||
|
fi_launch:
|
||||||
|
dd 7, 0, params, 0, 0
|
||||||
|
db "@notify", 0
|
||||||
|
|
||||||
|
fileopen dd 7
|
||||||
|
dd 0 ; flags
|
||||||
|
dd 0 ; parameters
|
||||||
|
dd 0 ; reserved
|
||||||
|
dd 0 ; reserved
|
||||||
|
db "/tmp0/1/netsurf-kolibrios", 0 ; path
|
||||||
|
;=====================================================================
|
||||||
|
|
||||||
I_END:
|
I_END:
|
||||||
|
Loading…
Reference in New Issue
Block a user