From f27cf5b19d818bee0e27409d84937e0d44127b89 Mon Sep 17 00:00:00 2001 From: Khushboo Mehta Date: Tue, 29 Mar 2022 00:14:57 +0200 Subject: [PATCH] feat: Add support for downloading and copying an image by url --- src/nimqml/private/dotherside.nim | 4 +++- src/nimqml/private/qguiapplication.nim | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/nimqml/private/dotherside.nim b/src/nimqml/private/dotherside.nim index 1bb0727..5f60955 100644 --- a/src/nimqml/private/dotherside.nim +++ b/src/nimqml/private/dotherside.nim @@ -141,6 +141,8 @@ proc dos_qguiapplication_clipboard_setText(content: cstring) {.cdecl, dynlib: dy proc dos_qguiapplication_installEventFilter(engine: DosStatusEvent) {.cdecl, dynlib: dynLibName, importc.} proc dos_qguiapplication_clipboard_setImage(content: cstring) {.cdecl, dynlib: dynLibName, importc.} proc dos_qguiapplication_download_image(imageSource: cstring, filePath: cstring) {.cdecl, dynlib: dynLibName, importc.} +proc dos_qguiapplication_clipboard_setImageByUrl(url: cstring) {.cdecl, dynlib: dynLibName, importc.} +proc dos_qguiapplication_download_imageByUrl(url: cstring, filePath: cstring) {.cdecl, dynlib: dynLibName, importc.} proc dos_add_self_signed_certificate(content: cstring) {.cdecl, dynlib: dynLibName, importc.} @@ -392,4 +394,4 @@ proc dos_from_local_file(filePath: cstring): cstring {.cdecl, dynlib: dynLibName, importc.} proc dos_app_is_active(engine: DosQQmlApplicationEngine): bool {.cdecl, dynlib: dynLibName, importc.} -proc dos_app_make_it_active(engine: DosQQmlApplicationEngine) {.cdecl, dynlib: dynLibName, importc.} \ No newline at end of file +proc dos_app_make_it_active(engine: DosQQmlApplicationEngine) {.cdecl, dynlib: dynLibName, importc.} diff --git a/src/nimqml/private/qguiapplication.nim b/src/nimqml/private/qguiapplication.nim index 83e469e..2c274fb 100644 --- a/src/nimqml/private/qguiapplication.nim +++ b/src/nimqml/private/qguiapplication.nim @@ -41,9 +41,15 @@ proc installSelfSignedCertificate*(certificate: string) = proc setClipboardImage*(text: string = "") = dos_qguiapplication_clipboard_setImage(text.cstring) +proc setClipboardImageByUrl*(url: string = "") = + dos_qguiapplication_clipboard_setImageByUrl(url.cstring) + proc downloadImage*(imageSource: string = "", filePath = "") = dos_qguiapplication_download_image(imageSource.cstring, filePath.cstring) +proc downloadImageByUrl*(url: string = "", filePath = "") = + dos_qguiapplication_download_imageByUrl(url.cstring, filePath.cstring) + proc enableHDPI*(uiScaleFilePath: string) = dos_qguiapplication_enable_hdpi(uiScaleFilePath)