diff --git a/win-linux/extras/online-installer/OnlineInstaller.pro b/win-linux/extras/online-installer/OnlineInstaller.pro deleted file mode 100644 index 43b5621ca..000000000 --- a/win-linux/extras/online-installer/OnlineInstaller.pro +++ /dev/null @@ -1,19 +0,0 @@ -DESTDIR = $$PWD -include(common.pri) - -DEFINES += COPYRIGHT_YEAR=$${CURRENT_YEAR} -DEFINES += APP_ICON_PATH=\"./icons/desktopeditors.ico\" -DEFINES += APP_LANG_PATH=\"./langs/langs.iss\" - -OTHER_FILES += $$PWD/res/langs/langs.iss - -ENV_URL_INSTALL = $$(DESKTOP_URL_UPDATES_MAIN_CHANNEL) -isEmpty(ENV_URL_INSTALL): DEFINES += URL_INSTALL=\\\"\\\" -else: DEFINES += URL_INSTALL=\\\"$${ENV_URL_INSTALL}\\\" - -ENV_URL_INSTALL_DEV = $$(DESKTOP_URL_UPDATES_DEV_CHANNEL) -isEmpty(ENV_URL_INSTALL_DEV): DEFINES += URL_INSTALL_DEV=\\\"\\\" -else: DEFINES += URL_INSTALL_DEV=\\\"$${ENV_URL_INSTALL_DEV}\\\" - -message(install url: \\\"$$ENV_URL_INSTALL\\\") -message(install dev url: \\\"$$ENV_URL_INSTALL_DEV\\\") diff --git a/win-linux/extras/online-installer/common.pri b/win-linux/extras/online-installer/common.pri deleted file mode 100644 index 44b906e6e..000000000 --- a/win-linux/extras/online-installer/common.pri +++ /dev/null @@ -1,129 +0,0 @@ - -TARGET = online-installer -CONFIG += c++11 utf8_source static_runtime -CONFIG -= app_bundle -CONFIG -= qt -CONFIG -= debug_and_release debug_and_release_target - -TEMPLATE = app - -CORE_ROOT_DIR = $$PWD/../../../../core -UICLASSES = $$PWD/src/uiclasses - -CONFIG += core_no_dst -include($$CORE_ROOT_DIR/Common/base.pri) - -INCLUDEPATH += $$PWD/src \ - $$UICLASSES -INCLUDEPATH += $$PWD/../../src/prop - -HEADERS += $$PWD/src/version.h \ - $$PWD/src/resource.h \ - $$PWD/src/mainwindow.h \ - $$PWD/src/cdownloader.h \ - $$PWD/src/translator.h \ - $$PWD/src/cjson_p.h \ - $$PWD/src/cjson.h \ - $$PWD/src/utils.h \ - $$UICLASSES/commondefines.h \ - $$UICLASSES/baseutils.h \ - $$UICLASSES/common.h \ - $$UICLASSES/metrics.h \ - $$UICLASSES/palette.h \ - $$UICLASSES/drawningengine.h \ - $$UICLASSES/drawingsurface.h \ - $$UICLASSES/object.h \ - $$UICLASSES/application.h \ - $$UICLASSES/window.h \ - $$UICLASSES/widget.h \ - $$UICLASSES/label.h \ - $$UICLASSES/caption.h \ - $$UICLASSES/abstractbutton.h \ - $$UICLASSES/button.h \ - $$UICLASSES/checkbox.h \ - $$UICLASSES/radiobutton.h \ - $$UICLASSES/progressbar.h \ - $$UICLASSES/layoutitem.h \ - $$UICLASSES/layout.h \ - $$UICLASSES/boxlayout.h - -SOURCES += $$PWD/src/main.cpp \ - $$PWD/src/mainwindow.cpp \ - $$PWD/src/cdownloader.cpp \ - $$PWD/src/translator.cpp \ - $$PWD/src/cjson.cpp \ - $$PWD/src/utils.cpp \ - $$UICLASSES/baseutils.cpp \ - $$UICLASSES/common.cpp \ - $$UICLASSES/metrics.cpp \ - $$UICLASSES/palette.cpp \ - $$UICLASSES/drawningengine.cpp \ - $$UICLASSES/drawingsurface.cpp \ - $$UICLASSES/object.cpp \ - $$UICLASSES/application.cpp \ - $$UICLASSES/window.cpp \ - $$UICLASSES/widget.cpp \ - $$UICLASSES/label.cpp \ - $$UICLASSES/caption.cpp \ - $$UICLASSES/abstractbutton.cpp \ - $$UICLASSES/button.cpp \ - $$UICLASSES/checkbox.cpp \ - $$UICLASSES/radiobutton.cpp \ - $$UICLASSES/progressbar.cpp \ - $$UICLASSES/layoutitem.cpp \ - $$UICLASSES/layout.cpp \ - $$UICLASSES/boxlayout.cpp - -OTHER_FILES += $$PWD/res/version.rc \ - $$PWD/res/manifest/online-installer.exe.manifest - -ENV_PRODUCT_VERSION = "2.0.0" # $$(PRODUCT_VERSION) -!isEmpty(ENV_PRODUCT_VERSION) { - FULL_PRODUCT_VERSION = $${ENV_PRODUCT_VERSION}.$$(BUILD_NUMBER) - DEFINES += VER_PRODUCT_VERSION=$$FULL_PRODUCT_VERSION \ - VER_PRODUCT_VERSION_COMMAS=$$replace(FULL_PRODUCT_VERSION, \., ",") -} - -CONFIG -= embed_manifest_exe -RC_FILE = $$PWD/res/version.rc -QMAKE_CXXFLAGS += -D_UNICODE - -contains(QMAKE_TARGET.arch, x86_64):{ - QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWS,5.02 -} else { - QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWS,5.01 -} - -core_release:DESTDIR = $$DESTDIR/build -core_debug:DESTDIR = $$DESTDIR/build/debug - -!isEmpty(OO_BUILD_BRANDING) { - DESTDIR = $$DESTDIR/$$OO_BUILD_BRANDING -} - -DESTDIR = $$DESTDIR/$$CORE_BUILDS_PLATFORM_PREFIX - -build_xp { - DESTDIR = $$DESTDIR/xp - DEFINES += __OS_WIN_XP -} - -DEFINES -= NOMINMAX - -LIBS += -luser32 \ - -lshell32 \ - -lshlwapi \ - -lwinhttp \ - -lwintrust \ - -lgdi32 \ - -lgdiplus \ - -ladvapi32 \ - -lrpcrt4 \ - -lole32 \ - -lmsi \ - -lwinmm \ - -lcomctl32 - -OBJECTS_DIR = $$DESTDIR/obj -MOC_DIR = $$DESTDIR/moc -RCC_DIR = $$DESTDIR/rcc diff --git a/win-linux/extras/online-installer/res/icons/desktopeditors.ico b/win-linux/extras/online-installer/res/icons/desktopeditors.ico deleted file mode 100644 index 4307e1c5d..000000000 Binary files a/win-linux/extras/online-installer/res/icons/desktopeditors.ico and /dev/null differ diff --git a/win-linux/extras/online-installer/res/icons/welcome.emf b/win-linux/extras/online-installer/res/icons/welcome.emf deleted file mode 100644 index 2e4651bdb..000000000 Binary files a/win-linux/extras/online-installer/res/icons/welcome.emf and /dev/null differ diff --git a/win-linux/extras/online-installer/res/langs/langs.iss b/win-linux/extras/online-installer/res/langs/langs.iss deleted file mode 100644 index 69a235aaa..000000000 --- a/win-linux/extras/online-installer/res/langs/langs.iss +++ /dev/null @@ -1,1546 +0,0 @@ - -en.CAPTION =ONLYOFFICE Online Installer -en_GB.CAPTION =ONLYOFFICE Online Installer -ru.CAPTION =ONLYOFFICE Онлайн Установщик -de.CAPTION =ONLYOFFICE Online-Installationsprogramm -fr.CAPTION =Programme d'installation ONLYOFFICE en ligne -es.CAPTION = Instalador online ONLYOFFICE -it.CAPTION =Programma di installazione online di ONLYOFFICE -ja.CAPTION =ONLYOFFICE オンラインインストーラー -zh_CN.CAPTION =ONLYOFFICE 在线安装程序 -ro.CAPTION =Asistent de Instalare Online ONLYOFFICE -ar_SA.CAPTION =ONLYOFFICE المثبت عبر الإنترنت -bg.CAPTION =Онлайн инсталатор на ONLYOFFICE -cs.CAPTION =Online instalátor ONLYOFFICE -el.CAPTION =Διαδικτυακό πρόγραμμα εγκατάστασης ONLYOFFICE -fi.CAPTION =ONLYOFFICE verkkoasennus -hy.CAPTION =ONLYOFFICE առցանց տեղադրող -ko.CAPTION =ONLYOFFICE 온라인 설치 프로그램 -lv.CAPTION =ONLYOFFICE tiešsaistes instalētājs -nl.CAPTION =ONLYOFFICE Online Installatieprogramma -pl.CAPTION =Instalator ONLYOFFICE online -pt_BR.CAPTION =Instalador on-line do ONLYOFFICE -pt_PT.CAPTION =Instalador on-line do ONLYOFFICE -sk.CAPTION =Online inštalátor ONLYOFFICE -sl.CAPTION =ONLYOFFICE Spletni namestitveni program -tr.CAPTION =ONLYOFFICE Çevrimiçi Yükleyici -uk.CAPTION =Онлайн-інсталятор ONLYOFFICE -vi.CAPTION =Trình cài đặt trực tuyến ONLYOFFICE -sr_Latn_RS.CAPTION =ONLYOFFICE Onlajn Instalater -si.CAPTION =ඔන්ලිඔෆිස් මාර්ගගත ස්ථාපකය -be.CAPTION =Анлайн усталёўшчык ONLYOFFICE -ca.CAPTION =Instal·lador online ONLYOFFICE -da.CAPTION =ONLYOFFICE Onlineinstallatør -gl.CAPTION =Instalador en liña de ONLYOFFICE -hu.CAPTION =ONLYOFFICE Online Telepítő -id.CAPTION =Installer Online ONLYOFFICE -no.CAPTION =ONLYOFFICE nettbasert installasjonsprogram -et.CAPTION =ONLYOFFICE veebipaigaldus -lt.CAPTION =ONLYOFFICE diegimas internetu -hr.CAPTION =Mrežni instalacijski program ONLYOFFICE -hi.CAPTION =ओनलीऑफिस ऑनलाइन इंस्टॉलर -sv.CAPTION =ONLYOFFICE onlineinstallationsprogram -sr_Cyrl_RS.CAPTION =ONLYOFFICE Онлајн Инсталатер -he.CAPTION_TEXT =תוכנת ההתקנה המקוונת של ONLYOFFICE -sq.CAPTION =Instaluesi i ONLYOFFICE Onlie -ur.CAPTION =ONLYOFFICE آن لائن انسٹالر - -en.MSG_ERR_SYSTEM =The current version of the operating system is not supported. %1 requires Microsoft Windows 7 or newer. -ru.MSG_ERR_SYSTEM =Текущая версия операционной системы не поддерживается. Для работы %1 требуется Microsoft Windows 7 или более новая версия. -en_GB.MSG_ERR_SYSTEM =The current version of the operating system is not supported. %1 requires Microsoft Windows 7 or newer. -de.MSG_ERR_SYSTEM =Die aktuelle Version des Betriebssystems wird nicht unterstützt. Für %1 ist Microsoft Windows 7 oder neuer erforderlich. -fr.MSG_ERR_SYSTEM =La version actuelle du système d'exploitation n'est pas prise en charge. %1 nécessite Microsoft Windows 7 ou une version plus récente. -es.MSG_ERR_SYSTEM =La versión actual del sistema operativo no es compatible. %1 requiere Microsoft Windows 7 o posterior. -it.MSG_ERR_SYSTEM =La versione attuale del sistema operativo non è supportata. %1 richiede Microsoft Windows 7 o una versione più recente. -ja.MSG_ERR_SYSTEM =現在のオペレーティング・システムのバージョンはサポートされていません。%1には Microsoft Windows 7 以降が必要です。 -zh_CN.MSG_ERR_SYSTEM =当前操作系统版本不受支持。%1 仅适用于 Microsoft Windows 7 或更高版本。 -ur.MSG_ERR_SYSTEM =آپریٹنگ سسٹم کا موجودہ ورژن تعاون یافتہ نہیں ہے۔ %1 کو Microsoft Windows 7 یا جدید تر درکار ہے۔ - -en.MSG_ERR_ALREADY_RUNNING =The application is already running. -en_GB.MSG_ERR_ALREADY_RUNNING =The application is already running. -ru.MSG_ERR_ALREADY_RUNNING =Приложение уже запущено. -de.MSG_ERR_ALREADY_RUNNING =Die Anwendung läuft bereits. -fr.MSG_ERR_ALREADY_RUNNING =Cette application est déjà en cours d'exécution. -es.MSG_ERR_ALREADY_RUNNING =La aplicación ya se está ejecutando. -it.MSG_ERR_ALREADY_RUNNING =L'applicazione sta già funzionando. -ja.MSG_ERR_ALREADY_RUNNING =アプリケーションはすでに実行されています。 -zh_CN.MSG_ERR_ALREADY_RUNNING =应用程序已在运行。 -ro.MSG_ERR_ALREADY_RUNNING =Aplicația este deja în desfășurare. -ar_SA.MSG_ERR_ALREADY_RUNNING =التطبيق قيد التشغيل بالفعل. -bg.MSG_ERR_ALREADY_RUNNING =Приложението вече работи. -cs.MSG_ERR_ALREADY_RUNNING =Aplikace již běží. -el.MSG_ERR_ALREADY_RUNNING =Η εφαρμογή εκτελείται ήδη. -fi.MSG_ERR_ALREADY_RUNNING =Sovellus on jo käynnissä. -hy.MSG_ERR_ALREADY_RUNNING =Հավելվածն արդեն աշխատում է։ -ko.MSG_ERR_ALREADY_RUNNING =애플리케이션이 이미 실행 중입니다. -lv.MSG_ERR_ALREADY_RUNNING =Lietojumprogramma jau darbojas. -nl.MSG_ERR_ALREADY_RUNNING =De toepassing draait al. -pl.MSG_ERR_ALREADY_RUNNING =Aplikacja jest już uruchomiona. -pt_BR.MSG_ERR_ALREADY_RUNNING =O aplicativo já está em execução. -pt_PT.MSG_ERR_ALREADY_RUNNING =O aplicativo já está em execução. -sk.MSG_ERR_ALREADY_RUNNING =Aplikácia je už spustená. -sl.MSG_ERR_ALREADY_RUNNING =Aplikacija se že izvaja. -tr.MSG_ERR_ALREADY_RUNNING =Uygulama zaten çalışıyor. -uk.MSG_ERR_ALREADY_RUNNING =Застосунок вже запущений. -vi.MSG_ERR_ALREADY_RUNNING =Ứng dụng đang chạy. -sr_Latn_RS.MSG_ERR_ALREADY_RUNNING =Aplikacija već radi. -si.MSG_ERR_ALREADY_RUNNING =මෘදුකාංගය දැනටමත් ධාවනය වේ. -be.MSG_ERR_ALREADY_RUNNING =Прыкладанне ўжо запушчана. -ca.MSG_ERR_ALREADY_RUNNING =L'aplicació ja s'està executant. -da.MSG_ERR_ALREADY_RUNNING =Applikationen kører allerede. -gl.MSG_ERR_ALREADY_RUNNING =A aplicación xa se está executando. -hu.MSG_ERR_ALREADY_RUNNING =Az alkalmazás már fut. -id.MSG_ERR_ALREADY_RUNNING =Aplikasi sedang berjalan. -no.MSG_ERR_ALREADY_RUNNING =Applikasjonen kjører allerede. -et.MSG_ERR_ALREADY_RUNNING =Rakendus juba töötab. -lt.MSG_ERR_ALREADY_RUNNING =Programa jau paleista. -hr.MSG_ERR_ALREADY_RUNNING =Aplikacija je već pokrenuta. -hi.MSG_ERR_ALREADY_RUNNING =एप्लीकेशन पहले से ही चल रही है। -sv.MSG_ERR_ALREADY_RUNNING =Applikationen körs redan. -sr_Cyrl_RS.MSG_ERR_ALREADY_RUNNING =Апликација већ ради. -he.MSG_ERR_ALREADY_RUNNING =היישום כבר פועל. -sq.MSG_ERR_ALREADY_RUNNING =Aplikacioni tashmë po funksionon. -ur.MSG_ERR_ALREADY_RUNNING =ایپلیکیشن پہلے ہی چل رہی ہے۔ - -en.MSG_ERR_TRY_CLOSE_APP =Setup has detected that %1 is currently running. It'll be closed automatically. -ru.MSG_ERR_TRY_CLOSE_APP =Обнаружен запущенный экземпляр %1. Он будет закрыт автоматически. -en_GB.MSG_ERR_TRY_CLOSE_APP =Setup has detected that %1 is currently running. It'll be closed automatically. -de.MSG_ERR_TRY_CLOSE_APP =Setup hat festgestellt, dass %1 derzeit ausgeführt wird. Es wird automatisch geschlossen. -fr.MSG_ERR_TRY_CLOSE_APP =L'installation a détecté que %1 est en cours d'exécution. Il sera fermé automatiquement. -es.MSG_ERR_TRY_CLOSE_APP =La instalación ha detectado que %1 se está ejecutando actualmente. Se cerrará automáticamente. -it.MSG_ERR_TRY_CLOSE_APP =L'installazione ha rilevato che %1 è attualmente in esecuzione. Verrà chiuso automaticamente. -ja.MSG_ERR_TRY_CLOSE_APP =セットアップは、%1 が現在実行中であることを検出しました。自動的に終了されます。 -zh_CN.MSG_ERR_TRY_CLOSE_APP =安装程序检测到 %1 正在运行,将自动关闭该程序。 - -en.MSG_ERR_CLOSE_APP =Setup has detected that %1 is currently running. Please close all instances of it. -en_GB.MSG_ERR_CLOSE_APP =Setup has detected that %1 is currently running. Please close all instances of it. -ru.MSG_ERR_CLOSE_APP =Обнаружен запущенный экземпляр %1. Пожалуйста, закройте все экземпляры приложения. -de.MSG_ERR_CLOSE_APP =Setup hat festgestellt, dass %1 derzeit ausgeführt wird. Bitte schließen Sie alle Instanzen des Programms. -fr.MSG_ERR_CLOSE_APP =L'installateur a détecté que %1 est en cours d'exécution. Veuillez fermer toutes les fenêtres de cette application. -es.MSG_ERR_CLOSE_APP =La instalación ha detectado que %1 está actualmente funcionando. Por favor, cierre todas sus instancias. -it.MSG_ERR_CLOSE_APP =L'installazione ha rilevato che %1 è attualmente in esecuzione. Chiudi tutte le istanze. -ja.MSG_ERR_CLOSE_APP =セットアップにより、%1 が現在実行中であることが検出されました。すべてのインスタンスを閉じてください。 -zh_CN.MSG_ERR_CLOSE_APP =安装程序检测到%1正在运行。请关闭所有实例。 -ro.MSG_ERR_CLOSE_APP =Programul de instalare a detectat că %1 rulează acum. Închideți toate instanțele asociate. -hy.MSG_ERR_CLOSE_APP =Կարգավորումը հայտնաբերել է, որ %1-ը ներկայումս աշխատում է: Խնդրում ենք փակել դրա բոլոր օրինակները: -PT_BR.MSG_ERR_CLOSE_APP =A instalação detectou que %1 está em execução no momento. Feche todas as instâncias dele. -sr_Latn_RS.MSG_ERR_CLOSE_APP =Instalacija je otkrila da je %1 trenutno pokrenut. Molimo vas da zatvorite sve njegove primere. -sr_Cyrl_RS.MSG_ERR_CLOSE_APP =Инсталација је открила да је %1 тренутно покренут. Молимо вас да затворите све његове примере. -ar_SA.MSG_ERR_CLOSE_APP =اكتشف برنامج الإعداد أن %1 قيد التشغيل حاليًا. الرجاء إغلاق كافة الحالات منه. -nl.MSG_ERR_CLOSE_APP =Setup heeft geconstateerd dat %1 momenteel actief is. Sluit alle instanties hiervan. -sl.MSG_ERR_CLOSE_APP =Namestitev je zaznala, da se %1 trenutno izvaja. Zaprite vse njegove instance. -bg.MSG_ERR_CLOSE_APP =Настройващата програма откри, че %1 работи в момента. Моля, затворете всичките му екземпляри. -cs.MSG_ERR_CLOSE_APP =Nastavení zjistilo, že %1 je právě spuštěno. Ukončete prosím všechny jeho instance. -el.MSG_ERR_CLOSE_APP =Η εγκατάσταση εντόπισε ότι εκτελείται το %1 επί του παρόντος. Κλείστε όλες τις λειτουργίες του. -fi.MSG_ERR_CLOSE_APP =Asetusohjelma on havainnut, että %1 on parhaillaan käynnissä. Ole hyvä ja sulje kaikki sen esiintymät. -ko.MSG_ERR_CLOSE_APP =설치 프로그램에서 현재 %1이/가 실행 중임을 감지했습니다. 모든 인스턴스를 종료해 주세요. -pt_PT.MSG_ERR_CLOSE_APP =O programa de instalação detetou que %1 está em execução no momento. Feche todas as instâncias. -tr.MSG_ERR_CLOSE_APP =Kurulum, %1'in şu anda çalıştığını tespit etti. Lütfen tüm örneklerini kapatın. -uk.MSG_ERR_CLOSE_APP =Виявлено, що зараз запущено %1. Закрийте всі екземпляри. -pl.MSG_ERR_CLOSE_APP =Instalator wykrył, że %1 jest aktualnie uruchomiona. Zamknij wszystkie jej instancje. -sk.MSG_ERR_CLOSE_APP =Nastavenie zistilo, že momentálne je spustené %1. Zatvorte všetky jeho kópie. -vi.MSG_ERR_CLOSE_APP =Thiết lập đã phát hiện ra rằng %1 hiện đang chạy. Vui lòng đóng tất cả các bản sao đang hoạt động. -he.MSG_ERR_CLOSE_APP =ההתקנה זיהתה ש-%1 פועל כרגע. אנא סגור את כל המופעים הפתוחים שלו. -lv.MSG_ERR_CLOSE_APP =Sistēma ir konstatējusi, ka pašlaik darbojas programma %1. Lūdzu, aizveriet visus tās logus. -sq.MSG_ERR_CLOSE_APP =Konfigurimi ka zbuluar se %1 po ekzekutohet aktualisht. Ju lutem mbyllni të gjitha rastet e tij. -id.MSG_ERR_CLOSE_APP =Setup mendeteksi %1 sedang berjalan. Mohon untuk ditutup. -sv.MSG_ERR_CLOSE_APP =Installationsprogrammet har upptäckt att %1 körs. Stäng alla instanser av programmet. -ur.MSG_ERR_CLOSE_APP =سیٹ اپ نے پتہ لگایا ہے کہ فی الحال %1 چل رہا ہے۔ براہ کرم اس کی تمام مثالیں بند کریں۔ - -en.MSG_REMOVE =This will remove %1 and its components. -en_GB.MSG_REMOVE =This will remove %1 and its components. -ru.MSG_REMOVE =Это приведет к удалению %1 и его компонентов. -de.MSG_REMOVE =Dadurch werden %1 und die Komponenten entfernt. -fr.MSG_REMOVE =Cette opération supprimera %1 et ses composants. -es.MSG_REMOVE =Esto eliminará %1 y sus componentes. -it.MSG_REMOVE =Questo rimuoverà %1 e i suoi componenti. -ja.MSG_ERR_CLOSE_APP =これにより、%1 およびそのコンポーネントが削除されます。 -zh_CN.MSG_ERR_CLOSE_APP =此操作将移除%1及其组件。 -ro.MSG_REMOVE =%1 și componentele sale vor fi eliminate. -hy.MSG_REMOVE =Սա կհեռացնի %1-ը և դրա բաղադրիչները: -PT_BR.MSG_REMOVE =Isso removerá %1 e seus componentes. -sr_Latn_RS.MSG_REMOVE =Ovo će ukloniti %1 i njegove komponente. -sr_Cyrl_RS.MSG_REMOVE =Ово ће уклонити %1 и његове компоненте. -ar_SA.MSG_REMOVE =سيؤدي هذا إلى إزالة %1 ومكوناته. -nl.MSG_REMOVE =Dit zal %1 en haar componenten verwijderen. -sl.MSG_REMOVE =S tem boste odstranili %1 in njegove komponente. -bg.MSG_REMOVE =Това ще премахне %1 и компонентите му. -cs.MSG_REMOVE =Tímto se odstraní %1 a jeho součásti. -el.MSG_REMOVE =Η διαδικασία αυτή θα αφαιρέσει το %1 και τα στοιχεία του. -fi.MSG_REMOVE =Tämä poistaa %1:n ja sen komponentit. -ko.MSG_REMOVE =이렇게 하면 %1 및 컴포넌트가 제거됩니다. -pt_PT.MSG_REMOVE =Isso removerá %1 e seus componentes. -tr.MSG_REMOVE =Bu, %1'i ve bileşenlerini kaldıracaktır. -uk.MSG_REMOVE =Буде видалено %1 з компонентами. -pl.MSG_REMOVE =Spowoduje to usunięcie %1 i jej komponentów. -sk.MSG_REMOVE =Tým sa odstráni %1 a jeho komponenty. -vi.MSG_REMOVE =Thao tác này sẽ xóa %1 và các thành phần của nó. -he.MSG_REMOVE =פעולה זו תסיר את %1 ואת כל הרכיבים שלו. -lv.MSG_REMOVE =Tādējādi %1 un tās sastāvdaļas tiks dzēstas. -sq.MSG_REMOVE =Kjo do të heqë %1 dhe përbërësit e tij. -id.MSG_REMOVE =Ini akan menghapus %1 beserta komponennya. -sv.MSG_REMOVE =Detta tar bort %1 och dess komponenter. -ur.MSG_REMOVE =یہ %1 اور اس کے اجزاء کو ہٹا دے گا۔ - -en.MSG_REPAIR =This will repair the current version of %1. -en_GB.MSG_REPAIR =This will repair the current version of %1. -ru.MSG_REPAIR =Это восстановит текущую версию %1. -de.MSG_REPAIR =Dadurch wird die aktuelle Version von %1 repariert. -fr.MSG_REPAIR =Cette opération répare la version actuelle de %1. -es.MSG_REPAIR =Esto reparará la versión actual de %1. -it.MSG_REPAIR =Questo riparerà la versione corrente di %1. -ja.MSG_REPAIR =これにより、%1 の現在のバージョンが修復されます。 -zh_CN.MSG_REPAIR =此操作将修复当前版本的%1。 -ro.MSG_REPAIR =Versiunea actuală a %1 va fi reparată. -hy.MSG_REPAIR =Սա կվերականգնի %1-ի ընթացիկ տարբերակը: -PT_BR.MSG_REPAIR =Isso reparará a versão atual de %1. -sr_Latn_RS.MSG_REPAIR =Ovo će popraviti trenutnu verziju %1. -sr_Cyrl_RS.MSG_REPAIR =Ово ће поправити тренутну верзију %1. -ar_SA.MSG_REPAIR =سيؤدي هذا إلى إصلاح الإصدار الحالي من %1. -nl.MSG_REPAIR =Dit repareert de huidige versie van %1. -sl.MSG_REPAIR =To bo popravilo trenutno različico %1. -bg.MSG_REPAIR =Това ще поправи текущата версия на %1. -cs.MSG_REPAIR =Tímto se opraví aktuální verze %1. -el.MSG_REPAIR =Η διαδικασία αυτή θα επιδιορθώσει την τρέχουσα έκδοση του %1. -fi.MSG_REPAIR =Tämä korjaa %1:n nykyisen version. -ko.MSG_REPAIR =이렇게 하면 %1의 현재 버전이 복구됩니다. -pt_PT.MSG_REPAIR =Isso reparará a versão atual de %1. -tr.MSG_REPAIR =Bu, %1'in geçerli sürümünü onaracaktır. -uk.MSG_REPAIR =Буде відновлено поточну версію %1. -pl.MSG_REPAIR =Spowoduje to naprawę aktualnej wersji %1. -sk.MSG_REPAIR =Tým sa opraví aktuálna verzia %1. -vi.MSG_REPAIR =Thao tác này sẽ sửa chữa phiên bản hiện tại của %1. -he.MSG_REPAIR =פעולה זו תתקן את הגרסה הנוכחית של %1. -lv.MSG_REPAIR =Tādējādi pašreizējā %1 versija tiks salabota. -sq.MSG_REPAIR =Kjo do të riparojë versionin aktual të %1. -id.MSG_REPAIR =Ini akan memperbaiki versi terbaru %1. -sv.MSG_REPAIR =Detta reparerar den aktuella versionen av %1. -ur.MSG_REPAIR =یہ %1 کے موجودہ ورژن کو ٹھیک کر دے گا۔ - -en.MSG_UPDATE =This will update %1 to the latest version available. -en_GB.MSG_UPDATE =This will update %1 to the latest version available. -ru.MSG_UPDATE =Это обновит %1 до последней доступной версии. -de.MSG_UPDATE =Dadurch wird %1 auf die neueste verfügbare Version aktualisiert. -fr.MSG_UPDATE =Cette opération met à jour %1 vers la dernière version disponible. -es.MSG_UPDATE =Esto actualizará %1 a la última versión disponible. -it.MSG_UPDATE =Questo aggiornerà %1 all'ultima versione disponibile. -ja.MSG_UPDATE =これにより、%1 が利用可能な最新バージョンに更新されます。 -zh_CN.MSG_UPDATE =此操作将更新%1到最新可用版本。 -ro.MSG_UPDATE =%1 va fi actualizată la cea mai recentă versiune disponibilă. -hy.MSG_UPDATE =Սա կթարմացնի %1-ը հասանելի վերջին տարբերակով: -PT_BR.MSG_UPDATE =Isso atualizará %1 para a versão mais recente disponível. -sr_Latn_RS.MSG_UPDATE =Ovo će ažurirati %1 na najnoviju dostupnu verziju. -sr_Cyrl_RS.MSG_UPDATE =Ово ће ажурирати %1 на најновију доступну верзију. -ar_SA.MSG_UPDATE =سيؤدي هذا إلى تحديث %1 إلى الإصدار الأحدث المتوفر. -nl.MSG_UPDATE =Dit zal %1 bijwerken naar de laatst beschikbare versie. -sl.MSG_UPDATE =To bo posodobilo %1 na najnovejšo razpoložljivo različico. -bg.MSG_UPDATE =Това ще актуализира %1 до най-новата налична версия. -cs.MSG_UPDATE =Tímto se aktualizuje %1 na nejnovější dostupnou verzi. -el.MSG_UPDATE =Η διαδικασία αυτή θα ενημερώσει την %1 στην τελευταία διαθέσιμη έκδοση. -fi.MSG_UPDATE =Tämä päivittää %1:n viimeisimpään saatavilla olevaan versioon. -ko.MSG_UPDATE =이렇게 하면 사용 가능한 %1의 최신 버전으로 업데이트됩니다. -pt_PT.MSG_UPDATE =Isso atualizará %1 para a versão mais recente disponível. -tr.MSG_UPDATE =Bu, %1'i mevcut en son sürüme güncelleyecektir. -uk.MSG_UPDATE =%1 буде оновлено до останньої доступної версії. -pl.MSG_UPDATE =Spowoduje to aktualizację %1 do najnowszej dostępnej wersji. -sk.MSG_UPDATE =Týmto sa %1 aktualizuje na najnovšiu dostupnú verziu. -vi.MSG_UPDATE =Thao tác này sẽ cập nhật %1 lên phiên bản mới nhất hiện có. -he.MSG_UPDATE =פעולה זו תעדכן את %1 לגרסה העדכנית ביותר הזמינה. -lv.MSG_UPDATE =Tādējādi %1 tiks atjaunināta uz jaunāko pieejamo versiju. -sq.MSG_UPDATE =Kjo do të përditësojë %1 në versionin më të fundit të disponueshëm. -id.MSG_UPDATE =Ini akan melakukan update %1 ke versi terbaru yang tersedia. -sv.MSG_UPDATE =Detta uppdaterar %1 till den senaste tillgängliga versionen. -ur.MSG_UPDATE =یہ %1 کو دستیاب تازہ ترین ورژن میں اپ ڈیٹ کر دے گا۔ - -en.LABEL_DOWNLOAD =Downloading -en_GB.LABEL_DOWNLOAD =Downloading -ru.LABEL_DOWNLOAD =Загрузка -de.LABEL_DOWNLOAD =Downloadvorgang -fr.LABEL_DOWNLOAD =Téléchargement -es.LABEL_DOWNLOAD =Descargando -it.LABEL_DOWNLOAD =Download in corso -ja.LABEL_DOWNLOAD =ダウンロード中 -zh_CN.LABEL_DOWNLOAD =正在下载 -ro.LABEL_DOWNLOAD =Descărcare -hy.LABEL_DOWNLOAD =Ներբեռնում -PT_BR.LABEL_DOWNLOAD =Baixando -sr_Latn_RS.LABEL_DOWNLOAD =Preuzimanje -sr_Cyrl_RS.LABEL_DOWNLOAD =Преузимање -ar_SA.LABEL_DOWNLOAD =جارٍ التنزيل -nl.LABEL_DOWNLOAD =Downloaden -sl.LABEL_DOWNLOAD =Prenašanje -bg.LABEL_DOWNLOAD =Изтегляне -cs.LABEL_DOWNLOAD =Stahování -el.LABEL_DOWNLOAD =Γίνεται λήψη -fi.LABEL_DOWNLOAD =Lataa -ko.LABEL_DOWNLOAD =다운로드 중입니다 -pt_PT.LABEL_DOWNLOAD =Transferir -tr.LABEL_DOWNLOAD =İndiriliyor -uk.LABEL_DOWNLOAD =Завантаження -pl.LABEL_DOWNLOAD =Pobieranie -sk.LABEL_DOWNLOAD =Stiahnutie -vi.LABEL_DOWNLOAD =Đang tải về -he.LABEL_DOWNLOAD =מתבצע הורדה -lv.LABEL_DOWNLOAD =Lejupielādē -sq.LABEL_DOWNLOAD =Po shkarkohet -id.LABEL_DOWNLOAD =Mendownload -sv.LABEL_DOWNLOAD =Hämtar -ur.LABEL_DOWNLOAD =ڈاؤن لوڈ ہو رہا ہے۔ - -en.LABEL_INSTALL =Installing -en_GB.LABEL_INSTALL =Installing -ru.LABEL_INSTALL =Установка -de.LABEL_INSTALL =Installation -fr.LABEL_INSTALL =Installation -es.LABEL_INSTALL =Instalando -it.LABEL_INSTALL =Installazione -ja.LABEL_INSTALL =インストール中 -zh_CN.LABEL_INSTALL =正在安装 -ro.LABEL_INSTALL =Instalare -hy.LABEL_INSTALL =Տեղադրում -PT_BR.LABEL_INSTALL =Instalação -sr_Latn_RS.LABEL_INSTALL =Instaliranje -sr_Cyrl_RS.LABEL_INSTALL =Инсталирање -ar_SA.LABEL_INSTALL =تثبيت -nl.LABEL_INSTALL =Installeren -sl.LABEL_INSTALL =Namestitev -bg.LABEL_INSTALL =Инсталиране -cs.LABEL_INSTALL =Instalace -el.LABEL_INSTALL =Γίνεται εγκατάσταση -fi.LABEL_INSTALL =Asentaa -ko.LABEL_INSTALL =설치 중입니다 -pt_PT.LABEL_INSTALL =Instalação -tr.LABEL_INSTALL =Yükleniyor -uk.LABEL_INSTALL =Інсталювання -pl.LABEL_INSTALL =Instalowanie -sk.LABEL_INSTALL =Inštalácia -vi.LABEL_INSTALL =Đang cài đặt -he.LABEL_INSTALL =מתבצעת התקנה -lv.LABEL_INSTALL =Instalē -sq.LABEL_INSTALL =Po instalohet -id.LABEL_INSTALL =Menginstall -sv.LABEL_INSTALL =Installerar -ur.LABEL_INSTALL =انسٹال کرنا - -en.LABEL_UPDATING =Updating -en_GB.LABEL_UPDATING =Updating -ru.LABEL_UPDATING =Обновление -de.LABEL_UPDATING =Aktualisierung -fr.LABEL_UPDATING =Mise à jour -es.LABEL_UPDATING =Actualizando -it.LABEL_UPDATING =Aggiornamento -ja.LABEL_UPDATING =更新中 -zh_CN.LABEL_UPDATING =正在更新 -ro.LABEL_UPDATING =Actualizare -hy.LABEL_UPDATING =Թարմացում -PT_BR.LABEL_UPDATING =Atualizando -sr_Latn_RS.LABEL_UPDATING =Ažuriranje -sr_Cyrl_RS.LABEL_UPDATING =Ажурирање -ar_SA.LABEL_UPDATING =تحديث -nl.LABEL_UPDATING =Updaten -sl.LABEL_UPDATING =Posodabljanje -bg.LABEL_UPDATING =Актуализиране -cs.LABEL_UPDATING =Aktualizace -el.LABEL_UPDATING =Γίνεται ενημέρωση -fi.LABEL_UPDATING =Päivittää -ko.LABEL_UPDATING =업데이트 중입니다 -pt_PT.LABEL_UPDATING =Atualização -tr.LABEL_UPDATING =Güncelleniyor -uk.LABEL_UPDATING =Оновлення -pl.LABEL_UPDATING =Aktualizowanie -sk.LABEL_UPDATING =Aktualizácia -vi.LABEL_UPDATING =Đang cập nhật -he.LABEL_UPDATING =מתבצע עדכון -lv.LABEL_UPDATING =Atjaunina -sq.LABEL_UPDATING =Po përditësohet -id.LABEL_UPDATING =Mengupdate -sv.LABEL_UPDATING =Uppdaterar -ur.LABEL_UPDATING =اپ ڈیٹ کر رہا ہے۔ - -en.LABEL_REPAIRING =Repairing -en_GB.LABEL_REPAIRING =Repairing -ru.LABEL_REPAIRING =Восстановление -de.LABEL_REPAIRING =Reparaturvorgang -fr.LABEL_REPAIRING =Réparation -es.LABEL_REPAIRING =Reparando -it.LABEL_REPAIRING =Riparazione -ja.LABEL_REPAIRING =修復中 -zh_CN.LABEL_REPAIRING =正在修复 -ro.LABEL_REPAIRING =Reparare -hy.LABEL_REPAIRING =Վերականգնում -PT_BR.LABEL_REPAIRING =Reparando -sr_Latn_RS.LABEL_REPAIRING =Popravljanje -sr_Cyrl_RS.LABEL_REPAIRING =Поправљање -ar_SA.LABEL_REPAIRING =إصلاح -nl.LABEL_REPAIRING =Herstellen -sl.LABEL_REPAIRING =Popravljanje -bg.LABEL_REPAIRING =Поправяне -cs.LABEL_REPAIRING =Oprava -el.LABEL_REPAIRING =Γίνεται επισκευή -fi.LABEL_REPAIRING =Korjaa -ko.LABEL_REPAIRING =복구 중입니다 -pt_PT.LABEL_REPAIRING =Reparação -tr.LABEL_REPAIRING =Onarılıyor -uk.LABEL_REPAIRING =Відновлення -pl.LABEL_REPAIRING =Naprawa -sk.LABEL_REPAIRING =Oprava -vi.LABEL_REPAIRING =Đang sửa chữa -he.LABEL_REPAIRING =מתבצע תיקון -lv.LABEL_REPAIRING =Labo -sq.LABEL_REPAIRING =Po riparohet -id.LABEL_REPAIRING =Memperbaiki -sv.LABEL_REPAIRING =Reparerar -ur.LABEL_REPAIRING =مرمت کرنا - -en.LABEL_UNINSTLING =Uninstalling -en_GB.LABEL_UNINSTLING =Uninstalling -ru.LABEL_UNINSTLING =Удаление -de.LABEL_UNINSTLING =Deinstallation -fr.LABEL_UNINSTLING =Désinstallation -es.LABEL_UNINSTLING =Desinstalando -it.LABEL_UNINSTLING =Disinstallazione -ja.LABEL_UNINSTLING =アンインストール中 -zh_CN.LABEL_UNINSTLING =正在卸载 -ro.LABEL_UNINSTLING =Dezinstalare -hy.LABEL_UNINSTLING =Ապատեղադրում -PT_BR.LABEL_UNINSTLING =Desinstalação -sr_Latn_RS.LABEL_UNINSTLING =Deinstaliranje -sr_Cyrl_RS.LABEL_UNINSTLING =Деинсталирање -ar_SA.LABEL_UNINSTLING =إلغاء التثبيت -nl.LABEL_UNINSTLING =Verwijderen -sl.LABEL_UNINSTLING =Odstranjevanje -bg.LABEL_UNINSTLING =Деинсталиране -cs.LABEL_UNINSTLING =Probíhá odinstalace -el.LABEL_UNINSTLING =Γίνεται απεγκατάσταση -fi.LABEL_UNINSTLING =Poistaa asennusta -ko.LABEL_UNINSTLING =삭제 중입니다 -pt_PT.LABEL_UNINSTLING =Desinstalação -tr.LABEL_UNINSTLING =Kaldırılıyor -uk.LABEL_UNINSTLING =Видалення -pl.LABEL_UNINSTLING =Odinstalowywanie -sk.LABEL_UNINSTLING =Odinštalovanie -vi.LABEL_UNINSTLING =Đang hủy cài đặt -he.LABEL_UNINSTLING =מתבצעת הסרה -lv.LABEL_UNINSTLING =Atinstalē -sq.LABEL_UNINSTLING =Po çinstalohet -id.LABEL_UNINSTLING =Menghapus -sv.LABEL_UNINSTLING =Avinstallerar -ur.LABEL_UNINSTLING =ان انسٹال کرنا - -en.LABEL_UPDATE_COMPL =Update complete! -en_GB.LABEL_UPDATE_COMPL =Update complete! -ru.LABEL_UPDATE_COMPL =Обновление завершено! -de.LABEL_UPDATE_COMPL =Aktualisierung abgeschlossen! -fr.LABEL_UPDATE_COMPL =Mise à jour terminée ! -es.LABEL_UPDATE_COMPL =¡Actualización finalizada! -it.LABEL_UPDATE_COMPL =Aggiornamento completato! -ja.LABEL_UPDATE_COMPL =更新が完了しました! -zh_CN.LABEL_UPDATE_COMPL =更新完成! -ro.LABEL_UPDATE_COMPL =Actualizarea s-a finalizat -hy.LABEL_UPDATE_COMPL =Թարմացումն ավարտված է: -PT_BR.LABEL_UPDATE_COMPL =Atualização concluída! -sr_Latn_RS.LABEL_UPDATE_COMPL =Ažuriranje završeno! -sr_Cyrl_RS.LABEL_UPDATE_COMPL =Ажурирање завршено! -ar_SA.LABEL_UPDATE_COMPL =اكتمل التحديث -nl.LABEL_UPDATE_COMPL =Update voltooid! -sl.LABEL_UPDATE_COMPL =Posodobitev končana! -bg.LABEL_UPDATE_COMPL =Актуализацията е завършена! -cs.LABEL_UPDATE_COMPL =Aktualizace dokončena! -el.LABEL_UPDATE_COMPL =Η ενημέρωση ολοκληρώθηκε! -fi.LABEL_UPDATE_COMPL =Päivitys valmis! -ko.LABEL_UPDATE_COMPL =업데이트가 완료되었습니다! -pt_PT.LABEL_UPDATE_COMPL =Atualização completa! -tr.LABEL_UPDATE_COMPL =Güncelleme tamamlandı! -uk.LABEL_UPDATE_COMPL =Оновлення виконано! -pl.LABEL_UPDATE_COMPL =Zakończono aktualizowanie! -sk.LABEL_UPDATE_COMPL =Aktualizácia dokončená! -vi.LABEL_UPDATE_COMPL =Đã hoàn thành cập nhật! -he.LABEL_UPDATE_COMPL =העדכון הושלם בהצלחה! -lv.LABEL_UPDATE_COMPL =Atjaunināšana pabeigta! -sq.LABEL_UPDATE_COMPL =Përditësimi përfundoj! -id.LABEL_UPDATE_COMPL =Update selesai! -sv.LABEL_UPDATE_COMPL =Uppdatering slutförd! -ur.LABEL_UPDATE_COMPL =اپ ڈیٹ مکمل! - -en.LABEL_REPAIR_COMPL =Repairing completed! -en_GB.LABEL_REPAIR_COMPL =Repairing completed! -ru.LABEL_REPAIR_COMPL =Восстановление завершено! -de.LABEL_REPAIR_COMPL =Reparatur abgeschlossen! -fr.LABEL_REPAIR_COMPL =Réparation terminée ! -es.LABEL_REPAIR_COMPL =¡Reparación finalizada! -it.LABEL_REPAIR_COMPL =Riparazione completata! -ja.LABEL_REPAIR_COMPL =修復が完了しました! -zh_CN.LABEL_REPAIR_COMPL =修复完成! -ro.LABEL_REPAIR_COMPL =Repararea s-a finalizat -hy.LABEL_REPAIR_COMPL =Վերականգնումն ավարտված է: -PT_BR.LABEL_REPAIR_COMPL =Reparo concluído! -sr_Latn_RS.LABEL_REPAIR_COMPL =Popravljanje završena! -sr_Cyrl_RS.LABEL_REPAIR_COMPL =Поправљање завршена! -ar_SA.LABEL_REPAIR_COMPL =تم الانتهاء من الإصلاح! -nl.LABEL_REPAIR_COMPL =Herstellen voltooid! -sl.LABEL_REPAIR_COMPL =Popravljanje končano! -bg.LABEL_REPAIR_COMPL =Поправката е завършена! -cs.LABEL_REPAIR_COMPL =Oprava dokončena! -el.LABEL_REPAIR_COMPL =Η επισκευή ολοκληρώθηκε! -fi.LABEL_REPAIR_COMPL =Korjaus valmis! -ko.LABEL_REPAIR_COMPL =복구가 완료되었습니다! -pt_PT.LABEL_REPAIR_COMPL =Reparação concluída! -tr.LABEL_REPAIR_COMPL =Onarım tamamlandı! -uk.LABEL_REPAIR_COMPL =Відновлення виконано! -pl.LABEL_REPAIR_COMPL =Zakończono naprawę! -sk.LABEL_REPAIR_COMPL =Oprava dokončená! -vi.LABEL_REPAIR_COMPL =Đã hoàn thành sửa chữa! -he.LABEL_REPAIR_COMPL =התיקון הושלם בהצלחה!! -lv.LABEL_REPAIR_COMPL =Labošana pabeigta! -sq.LABEL_REPAIR_COMPL =Riparimi përfundoj! -id.LABEL_REPAIR_COMPL =Perbaikan selesai! -sv.LABEL_REPAIR_COMPL =Reparation slutförd! -ur.LABEL_REPAIR_COMPL =مرمت مکمل! - -en.LABEL_UNINST_COMPL =Uninstalling completed! -en_GB.LABEL_UNINST_COMPL =Uninstalling completed! -ru.LABEL_UNINST_COMPL =Удаление завершено! -de.LABEL_UNINST_COMPL =Deinstallation abgeschlossen! -fr.LABEL_UNINST_COMPL =Désinstallation terminée ! -es.LABEL_UNINST_COMPL =¡Desinstalación finalizada! -it.LABEL_UNINST_COMPL =Disinstallazione completata! -ja.LABEL_UNINST_COMPL =アンインストールが完了しました! -zh_CN.LABEL_UNINST_COMPL =卸载完成! -ro.LABEL_UNINST_COMPL =Dezinstalarea s-a finalizat -hy.LABEL_UNINST_COMPL =Ապատեղադրումն ավարտված է: -PT_BR.LABEL_UNINST_COMPL =Desinstalação concluída! -sr_Latn_RS.LABEL_UNINST_COMPL =Deinstaliranje završeno! -sr_Cyrl_RS.LABEL_UNINST_COMPL =Деинсталирање завршено! -ar_SA.LABEL_UNINST_COMPL =اكتملت عملية إلغاء التثبيت! -nl.LABEL_UNINST_COMPL =Verwijderen voltooid! -sl.LABEL_UNINST_COMPL =Odstranjevanje končano! -bg.LABEL_UNINST_COMPL =Деинсталирането е завършено! -cs.LABEL_UNINST_COMPL =Odinstalace dokončena! -el.LABEL_UNINST_COMPL =Η απεγκατάσταση ολοκληρώθηκε! -fi.LABEL_UNINST_COMPL =Asennus poistettu! -ko.LABEL_UNINST_COMPL =삭제가 완료되었습니다! -pt_PT.LABEL_UNINST_COMPL =Desinstalação concluída! -tr.LABEL_UNINST_COMPL =Kaldırma tamamlandı! -uk.LABEL_UNINST_COMPL =Видалення виконано! -pl.LABEL_UNINST_COMPL =Zakończono odinstalowywanie! -sk.LABEL_UNINST_COMPL =Odinštalovanie dokončené! -vi.LABEL_UNINST_COMPL =Đã hoàn thành gỡ cài đặt! -he.LABEL_UNINST_COMPL =ההסרה הושלמה בהצלחה! -lv.LABEL_UNINST_COMPL =Atinstalēšana pabeigta! -sq.LABEL_UNINST_COMPL =Çinstalimi përfundoj! -id.LABEL_UNINST_COMPL =Uninstall selesai! -sv.LABEL_UNINST_COMPL =Avinstallation slutförd! -ur.LABEL_UNINST_COMPL =اَن انسٹال کرنا مکمل ہو گیا! - -en.LABEL_VERSION =%1 %2 (%3 %4) is installed -en_GB.LABEL_VERSION =%1 %2 (%3 %4) is installed -ru.LABEL_VERSION =%1 %2 (%3 %4) установлен -de.LABEL_VERSION =%1 %2 (%3 %4) ist installiert -fr.LABEL_VERSION =%1 %2 (%3 %4) est installé -es.LABEL_VERSION =%1 %2 (%3 %4) está instalado -it.LABEL_VERSION =%1 %2 (%3 %4) è installato -ja.LABEL_VERSION =%1 %2 (%3 %4) がインストールされています -zh_CN.LABEL_VERSION =%1 %2(%3 %4)已安装 -ro.LABEL_VERSION =%1 %2 (%3 %4) este instalată -hy.LABEL_VERSION =%1 %2 (%3 %4) տեղադրված է -PT_BR.LABEL_VERSION =%1 %2 (%3 %4) está instalado -sr_Latn_RS.LABEL_VERSION =%1 %2 (%3 %4) je instaliran -sr_Cyrl_RS.LABEL_VERSION =%1 %2 (%3 %4) је инсталиран -ar_SA.LABEL_VERSION =تم تثبيت %1 %2 (%3 %4). -nl.LABEL_VERSION =%1 %2 (%3 %4) is geïnstalleerd -sl.LABEL_VERSION =%1 %2 (%3 %4) je nameščen -bg.LABEL_VERSION =%1 %2 (%3 %4) е инсталиран -cs.LABEL_VERSION =%1 %2 (%3 %4) je nainstalováno -el.LABEL_VERSION =Τα %1 %2 (%3 %4) έχουν εγκατασταθεί -fi.LABEL_VERSION =%1 %2 (%3 %4) on asennettu -ko.LABEL_VERSION =%1 %2 (%3 %4) 설치가 완료되었습니다 -pt_PT.LABEL_VERSION =%1 %2 (%3 %4) está instalado -tr.LABEL_VERSION =%1 %2 (%3 %4) yüklendi -uk.LABEL_VERSION =%1 %2 (%3 %4) інстальовано -pl.LABEL_VERSION =Trwa instalowanie %1 %2 (%3 %4) -sk.LABEL_VERSION =%1 %2 (%3 %4) je nainštalovaný -vi.LABEL_VERSION =%1 %2 (%3 %4) đã được cài đặt -he.LABEL_VERSION =%1 %2 (%3 %4) מותקן -lv.LABEL_VERSION =%1 %2 (%3 %4) ir instalēts -sq.LABEL_VERSION =%1 %2 (%3 %4) është instaluar -id.LABEL_VERSION =%1 %2 (%3 %4) sudah terinstall -sv.LABEL_VERSION =%1 %2 (%3 %4) är installerad -ur.LABEL_VERSION =%1 %2 (%3 %4) انسٹال ہے۔ - -en.LABEL_UNKN_VER =unknown version -en_GB.LABEL_UNKN_VER =unknown version -ru.LABEL_UNKN_VER =неизвестная версия -de.LABEL_UNKN_VER =unbekannte Version -fr.LABEL_UNKN_VER =version inconnue -es.LABEL_UNKN_VER =versión desconocida -it.LABEL_UNKN_VER =versione sconosciuta -ja.LABEL_UNKN_VER =不明なバージョン -zh_CN.LABEL_UNKN_VER =未知版本 -ro.LABEL_UNKN_VER =versiunea necunoscută -hy.LABEL_UNKN_VER =անհայտ տարբերակ -PT_BR.LABEL_UNKN_VER =versão desconhecida -sr_Latn_RS.LABEL_UNKN_VER =nepoznata verzija -sr_Cyrl_RS.LABEL_UNKN_VER =непозната верзија -ar_SA.LABEL_UNKN_VER =نسخة غير معروفة -nl.LABEL_UNKN_VER =onbekende versie -sl.LABEL_UNKN_VER =neznana verzija -bg.LABEL_UNKN_VER =непозната версия -cs.LABEL_UNKN_VER =neznámá verze -el.LABEL_UNKN_VER =άγνωστη έκδοση -fi.LABEL_UNKN_VER =tuntematon versio -ko.LABEL_UNKN_VER =알 수 없는 버전입니다 -pt_PT.LABEL_UNKN_VER =versão desconhecida -tr.LABEL_UNKN_VER =bilinmeyen sürüm -uk.LABEL_UNKN_VER =невідома версія -pl.LABEL_UNKN_VER =nieznana wersja -sk.LABEL_UNKN_VER =neznáma verzia -vi.LABEL_UNKN_VER =phiên bản không xác định -he.LABEL_UNKN_VER =גרסה לא ידועה -lv.LABEL_UNKN_VER =nezināma versija -sq.LABEL_UNKN_VER =version i panjohur -id.LABEL_UNKN_VER =versi tidak dikenal -sv.LABEL_UNKN_VER =okänd version -ur.LABEL_UNKN_VER =نامعلوم ورژن - -en.LABEL_UNKN_PACK =unknown package -en_GB.LABEL_UNKN_PACK =unknown package -ru.LABEL_UNKN_PACK =неизвестный пакет -de.LABEL_UNKN_PACK =unbekanntes Paket -fr.LABEL_UNKN_PACK =package inconnu -es.LABEL_UNKN_PACK =paquete desconocido -it.LABEL_UNKN_PACK =pacchetto sconosciuto -ja.LABEL_UNKN_PACK =不明なパッケージ -zh_CN.LABEL_UNKN_PACK =未知包 -ro.LABEL_UNKN_PACK =pachet necunoscut -hy.LABEL_UNKN_PACK =անհայտ փաթեթ -PT_BR.LABEL_UNKN_PACK =pacote desconhecido -sr_Latn_RS.LABEL_UNKN_PACK =nepoznat paket -sr_Cyrl_RS.LABEL_UNKN_PACK =непознат пакет -ar_SA.LABEL_UNKN_PACK =حزمة غير معروفة -nl.LABEL_UNKN_PACK =onbekend pakket -sl.LABEL_UNKN_PACK =neznan paket -bg.LABEL_UNKN_PACK =непознат пакет -cs.LABEL_UNKN_PACK =neznámý balíček -el.LABEL_UNKN_PACK =άγνωστο πακέτο -fi.LABEL_UNKN_PACK =tuntematon paketti -ko.LABEL_UNKN_PACK =알 수 없는 패키지입니다 -pt_PT.LABEL_UNKN_PACK =pacote desconhecido -tr.LABEL_UNKN_PACK =bilinmeyen paket -uk.LABEL_UNKN_PACK =невідомий пакет -pl.LABEL_UNKN_PACK =nieznany pakiet -sk.LABEL_UNKN_PACK =neznámy balík -vi.LABEL_UNKN_PACK =gói không xác định -he.LABEL_UNKN_PACK =חבילה לא ידועה -lv.LABEL_UNKN_PACK =nezināma pakotne -sq.LABEL_UNKN_PACK =paketë e panjohur -id.LABEL_UNKN_PACK =paket tidak dikenal -sv.LABEL_UNKN_PACK =okänt paket -ur.LABEL_UNKN_PACK =نامعلوم پیکج - -en.LABEL_NO_OPTIONS =No additional options available. -en_GB.LABEL_NO_OPTIONS =No additional options available. -ru.LABEL_NO_OPTIONS =Дополнительные опции недоступны. -de.LABEL_NO_OPTIONS =Keine zusätzlichen Optionen verfügbar. -fr.LABEL_NO_OPTIONS =Aucune option supplémentaire n'est disponible. -es.LABEL_NO_OPTIONS =No hay opciones adicionales disponibles. -it.LABEL_NO_OPTIONS =Nessuna opzione aggiuntiva disponibile -ja.LABEL_NO_OPTIONS =追加オプションはありません。 -zh_CN.LABEL_NO_OPTIONS =无额外选项可用。 -ro.LABEL_NO_OPTIONS =Nicio opțiune suplimentară nu este disponibilă. -hy.LABEL_NO_OPTIONS =Լրացուցիչ տարբերակներ չկան: -PT_BR.LABEL_NO_OPTIONS =Não há opções adicionais disponíveis. -sr_Latn_RS.LABEL_NO_OPTIONS =Nema dodatnih opcija na raspolaganju. -sr_Cyrl_RS.LABEL_NO_OPTIONS =Нема додатних опција на располагању. -ar_SA.LABEL_NO_OPTIONS =لا توجد خيارات إضافية متاحة. -nl.LABEL_NO_OPTIONS =Geen extra opties beschikbaar. -sl.LABEL_NO_OPTIONS =Dodatne možnosti niso na voljo. -bg.LABEL_NO_OPTIONS =Няма налични допълнителни опции. -cs.LABEL_NO_OPTIONS =Nejsou k dispozici žádné další možnosti -el.LABEL_NO_OPTIONS =Δεν υπάρχουν διαθέσιμες επιπλέον επιλογές. -fi.LABEL_NO_OPTIONS =Ei lisävaihtoehtoja saatavilla -ko.LABEL_NO_OPTIONS =패키지 추가 옵션이 없습니다. -pt_PT.LABEL_NO_OPTIONS =Não há opções adicionais disponíveis. -tr.LABEL_NO_OPTIONS =Ek seçenek mevcut değil. -uk.LABEL_NO_OPTIONS =Немає додаткових опцій. -pl.LABEL_NO_OPTIONS =Brak dostępnych dodatkowych opcji. -sk.LABEL_NO_OPTIONS =Nie sú k dispozícii žiadne ďalšie možnosti. -vi.LABEL_NO_OPTIONS =Không có tùy chọn bổ sung nào. -he.LABEL_NO_OPTIONS =אין אפשרויות נוספות זמינות. -lv.LABEL_NO_OPTIONS =Papildu opcijas nav pieejamas. -sq.LABEL_NO_OPTIONS =Nuk ka opsione shtesë të disponueshme. -id.LABEL_NO_OPTIONS =Tidak ada opsi tambahan yang tersedia. -sv.LABEL_NO_OPTIONS =Inga ytterligare alternativ tillgängliga. -ur.LABEL_NO_OPTIONS =کوئی اضافی اختیارات دستیاب نہیں ہیں۔ - -en.LABEL_NO_VER_AVAIL =No version available -en_GB.LABEL_NO_VER_AVAIL =No version available -ru.LABEL_NO_VER_AVAIL =Нет доступной версии -de.LABEL_NO_VER_AVAIL =Keine Version verfügbar -fr.LABEL_NO_VER_AVAIL =Aucune version disponible -es.LABEL_NO_VER_AVAIL =No hay versión disponible -it.LABEL_NO_VER_AVAIL =Nessuna versione disponibile -ja.LABEL_NO_VER_AVAIL =利用可能なバージョンはありません -zh_CN.LABEL_NO_VER_AVAIL =无可用版本 -ro.LABEL_NO_VER_AVAIL =Nicio versiune nu este disponibilă -hy.LABEL_NO_VER_AVAIL =Հասանելի տարբերակ չկա -PT_BR.LABEL_NO_VER_AVAIL =Nenhuma versão disponível -sr_Latn_RS.LABEL_NO_VER_AVAIL =Nema dostupne verzije -sr_Cyrl_RS.LABEL_NO_VER_AVAIL =Нема доступне верзије -ar_SA.LABEL_NO_VER_AVAIL =لا يوجد إصدار متاح -nl.LABEL_NO_VER_AVAIL =Geen versie beschikbaar -sl.LABEL_NO_VER_AVAIL =Verzija ni na voljo -bg.LABEL_NO_VER_AVAIL =Няма налична версия -cs.LABEL_NO_VER_AVAIL =Žádná dostupná verze -el.LABEL_NO_VER_AVAIL =Δεν υπάρχει διαθέσιμη έκδοση -fi.LABEL_NO_VER_AVAIL =Ei versiota saatavilla -ko.LABEL_NO_VER_AVAIL =사용 가능한 버전이 없습니다 -pt_PT.LABEL_NO_VER_AVAIL =Nenhuma versão disponível -tr.LABEL_NO_VER_AVAIL =Sürüm mevcut değil -uk.LABEL_NO_VER_AVAIL =Немає доступних версій -pl.LABEL_NO_VER_AVAIL =Brak dostępnej wersji -sk.LABEL_NO_VER_AVAIL =Nie je k dispozícii žiadna verzia -vi.LABEL_NO_VER_AVAIL =Không có phiên bản nào -he.LABEL_NO_VER_AVAIL =אין גרסה זמינה -lv.LABEL_NO_VER_AVAIL =Versijas nav pieejamas -sq.LABEL_NO_VER_AVAIL =Asnjë version i disponueshëm -id.LABEL_NO_VER_AVAIL =Tidak ada versi yang tersedia -sv.LABEL_NO_VER_AVAIL =Ingen version tillgänglig -ur.LABEL_NO_VER_AVAIL =کوئی ورژن دستیاب نہیں ہے۔ - -en.LABEL_WARN_CLOSE =This will install %1 on your computer.\nIt is recommended that you close all other applications before continuing. -en_GB.LABEL_WARN_CLOSE =This will install %1 on your computer.\nIt is recommended that you close all other applications before continuing. -ru.LABEL_WARN_CLOSE =Программа установит %1 на ваш компьютер.\nРекомендуется закрыть все прочие приложения перед тем, как продолжить. -de.LABEL_WARN_CLOSE =Dadurch werden %1 auf Ihrem Computer installiert.\nEs wird empfohlen, dass Sie alle anderen Apps schließen, bevor Sie fortfahren. -fr.LABEL_WARN_CLOSE =Ceci installera %1 sur votre ordinateur.\nIl est recommandé de fermer toutes les autres applications avant de continuer. -es.LABEL_WARN_CLOSE =Esto instalará %1 en su ordenador.\nSe recomienda que cierre todas las demás aplicaciones antes de continuar. -it.LABEL_WARN_CLOSE =Questo installerà %1 sul tuo computer.\nSi consiglia di chiudere tutte le altre applicazioni prima di procedere. -ja.LABEL_WARN_CLOSE =ONLYOFFICEデスクトップエディタがコンピュータにインストールされます。\n続行する前に、他のアプリケーションをすべて終了することをお勧めします。 -zh_CN.LABEL_WARN_CLOSE =此操作将在您的计算机上安装 ONLYOFFICE 桌面编辑器。\n建议您在继续之前关闭所有其他应用程序。 -ro.LABEL_WARN_CLOSE =%1 va fi instalat pe calculatorul dvs.\nEste recomandat să închideți toate celelalte aplicații înainte de a continua. -hy.LABEL_WARN_CLOSE =Սա ձեր համակարգչում կտեղադրի %1-ը:\nIt շարունակելուց առաջ խորհուրդ է տրվում փակել բոլոր մյուս հավելվածները: -PT_BR.LABEL_WARN_CLOSE =Isso instalará o %1 em seu computador.\nÉ recomendável que você feche todos os outros aplicativos antes de continuar. -sr_Latn_RS.LABEL_WARN_CLOSE =Ovo će instalirati %1 na vašem računaru.\nIt preporučuje se da zatvorite sve ostale aplikacije pre nego što nastavite. -sr_Cyrl_RS.LABEL_WARN_CLOSE =Ово ће инсталирати %1 на вашем рачунару. \nИт препоручује се да затворите све остале апликације пре него што наставите. -ar_SA.LABEL_WARN_CLOSE =سيؤدي ذلك إلى تثبيت محرري سطح المكتب ONLYOFFICE على جهاز الكمبيوتر الخاص بك.\n يوصى بإغلاق جميع التطبيقات الأخرى قبل المتابعة. -nl.LABEL_WARN_CLOSE =Hiermee installeert u %1 op uw computer.\nHet wordt aanbevolen om alle andere toepassingen te sluiten voordat u verder gaat. -sl.LABEL_WARN_CLOSE =S tem boste na vaš računalnik namestili %1.\nPriporočamo, da pred nadaljevanjem zaprete vse druge aplikacije. -bg.LABEL_WARN_CLOSE =Това ще инсталира %1 на вашия компютър.\nПрепоръчително е да затворите всички други приложения, преди да продължите. -cs.LABEL_WARN_CLOSE =Tímto se do počítače nainstaluje aplikace %1.\nPřed pokračováním doporučujeme zavřít všechny ostatní aplikace. -el.LABEL_WARN_CLOSE =Η διαδικασία αυτή θα εγκαταστήσει στον υπολογιστή σας το %1.\nΣυνιστάται να κλείσετε όλες τις άλλες εφαρμογές πριν συνεχίσετε. -fi.LABEL_WARN_CLOSE =Tämä asentaa ONLYOFFICE työpöytäeditorit tietokoneeseesi.\nOn suositeltavaa, että suljet kaikki muut sovellukset ennen jatkamista. -ko.LABEL_WARN_CLOSE =이렇게 하면 컴퓨터에 %1가 설치됩니다.\n계속하기 전에 다른 모든 애플리케이션을 종료하는 것이 좋습니다. -pt_PT.LABEL_WARN_CLOSE =Isso instalará o %1 no seu computador.\nÉ recomendável que você feche todos os outros aplicativos antes de continuar. -tr.LABEL_WARN_CLOSE =Bu, bilgisayarınıza %1 yükleyecektir.\nDevam etmeden önce diğer tüm uygulamaları kapatmanız önerilmektedir. -uk.LABEL_WARN_CLOSE =%1 буде інстальовано на ваш комп'ютер.\nПерш ніж продовжити, рекомендується закрити інші застосунки. -pl.LABEL_WARN_CLOSE =Spowoduje to zainstalowanie %1 na Twoim komputerze.\nZalecamy zamknięcie wszystkich innych aplikacji przed kontynuowaniem. -sk.LABEL_WARN_CLOSE =Na váš počítač sa nainštalujú aplikácie %1.\nIt Pred pokračovaním sa odporúča zatvoriť všetky ostatné aplikácie. -vi.LABEL_WARN_CLOSE =Thao tác này sẽ cài đặt %1 trên máy tính của bạn.\nBạn nên đóng tất cả các ứng dụng khác trước khi tiếp tục. -he.LABEL_WARN_CLOSE =פעולה זו תתקין את %1 במחשב שלך.\nמומלץ לסגור את כל היישומים האחרים לפני המשך ההתקנה. -lv.LABEL_WARN_CLOSE =Tādējādi datorā tiks instalēta programma %1.\nPirms turpināšanas ieteicams aizvērt visas pārējās programmas. -sq.LABEL_WARN_CLOSE =Kjo do të instalojë %1 në kompjuterin tuaj.\nRekomandohet që të mbyllni të gjitha aplikacionet e tjera përpara se të vazhdoni. -id.LABEL_WARN_CLOSE =Ini akan menjalankan instalasi %1 di komputer Anda.\nDirekomendasikan untuk menutup semua aplikasi sebelum melanjutkan. -sv.LABEL_WARN_CLOSE =Detta installerar %1 på din dator.\nDet rekommenderas att du stänger alla andra program innan du fortsätter. -ur.LABEL_WARN_CLOSE =یہ آپ کے کمپیوٹر پر %1 انسٹال کر دے گا۔\nیہ تجویز کی جاتی ہے کہ آپ جاری رکھنے سے پہلے دیگر تمام ایپلیکیشنز کو بند کر دیں۔ - -en.LABEL_ALMOST_DONE =Just a bit more and we're done -en_GB.LABEL_ALMOST_DONE =Just a bit more and we're done -ru.LABEL_ALMOST_DONE =Еще немного и мы закончим -de.LABEL_ALMOST_DONE =Noch ein wenig mehr und wir sind fertig -fr.LABEL_ALMOST_DONE =Encore un peu et c'est fini -es.LABEL_ALMOST_DONE =Un poco más y ya está. -it.LABEL_ALMOST_DONE =Ancora poco e abbiamo finito. -ja.LABEL_ALMOST_DONE =もう少しで完了です -zh_CN.LABEL_ALMOST_DONE =即将完成 -ro.LABEL_ALMOST_DONE =Încă un pic și suntem gata -hy.LABEL_ALMOST_DONE =Մի քիչ էլ, և պատրաստ կլինի -PT_BR.LABEL_ALMOST_DONE =Só mais um pouco e pronto -sr_Latn_RS.LABEL_ALMOST_DONE =Još samo malo i gotovi smo -sr_Cyrl_RS.LABEL_ALMOST_DONE =Још само мало и готови смо -ar_SA.LABEL_ALMOST_DONE =فقط أكثر قليلاً وانتهينا -nl.LABEL_ALMOST_DONE =Nog even en dan zijn we klaar -sl.LABEL_ALMOST_DONE =Še malo in smo končali -bg.LABEL_ALMOST_DONE =Още малко и сме готови -cs.LABEL_ALMOST_DONE =Ještě chvíli a je hotovo -el.LABEL_ALMOST_DONE =Λίγο ακόμα και τελειώσαμε -fi.LABEL_ALMOST_DONE =Vielä vähän ja sitten olemme valmiit -ko.LABEL_ALMOST_DONE =조금만 더 하면 끝입니다 -pt_PT.LABEL_ALMOST_DONE =Apenas um pouco mais e estamos prontos -tr.LABEL_ALMOST_DONE =Az kaldı, işimiz bitiyor -uk.LABEL_ALMOST_DONE =Ще трохи — і готово -pl.LABEL_ALMOST_DONE =Jeszcze chwila i kończymy -sk.LABEL_ALMOST_DONE =Ešte chvíľu a sme hotoví -vi.LABEL_ALMOST_DONE =Chỉ cần thêm một chút nữa là chúng ta sẽ hoàn thành -he.LABEL_ALMOST_DONE =רק עוד קצת וסיימנו -lv.LABEL_ALMOST_DONE =Vēl tikai nedaudz un viss būs pabeigts -sq.LABEL_ALMOST_DONE =Edhe pak dhe kemi mbaruar -id.LABEL_ALMOST_DONE =Sedikit lagi dan kita akan selesai -sv.LABEL_ALMOST_DONE =Bara lite till så är vi klara -ur.LABEL_ALMOST_DONE =بس تھوڑا سا اور اور ہم کر چکے ہیں۔ - -en.LABEL_INSTALL_COMPL =%1 has been successfully installed on your computer.\nTo run the application after closing this installer, select the check box. -en_GB.LABEL_INSTALL_COMPL =%1 has been successfully installed on your computer.\nTo run the application after closing this installer, select the check box. -ru.LABEL_INSTALL_COMPL =%1 успешно установлен на вашем компьютере.\nЧтобы запустить приложение после закрытия этого установщика, установите флажок. -de.LABEL_INSTALL_COMPL =%1 wurde erfolgreich auf Ihrem Computer installiert.\nUm die App nach dem Schließen dieses Installationsprogramms auszuführen, aktivieren Sie das Kontrollkästchen. -fr.LABEL_INSTALL_COMPL =%1 a été installé avec succès sur votre ordinateur.\nPour exécuter l'application après avoir fermé ce programme d'installation, cochez la case. -es.LABEL_INSTALL_COMPL =%1 se ha instalado correctamente en su ordenador.\nPara ejecutar la aplicación después de cerrar este instalador, seleccione la casilla de verificación. -it.LABEL_INSTALL_COMPL =%1 è stato installato con successo sul tuo computer. \nPer avviare l'applicazione dopo aver chiuso questo programma di installazione, seleziona la casella di controllo. -ja.LABEL_INSTALL_COMPL =%1デスクトップエディタがコンピュータにインストールされます。\n続行する前に、他のアプリケーションをすべて終了することをお勧めします。 -zh_CN.LABEL_INSTALL_COMPL =%1 已成功安装到您的计算机上。\n若要在关闭此安装程序后运行该应用程序,请勾选复选框。 -ro.LABEL_INSTALL_COMPL =%1 a fost instalat cu succes pe calculatorul dvs.\nPentru a porni aplicația după închiderea asistentului de instalare, faceți clic pe caseta de selectare. -hy.LABEL_INSTALL_COMPL =%1 հաջողությամբ տեղադրվել է ձեր համակարգչում:\nԱյս տեղադրիչը փակելուց հետո հավելվածը գործարկելու համար ընտրեք վանդակը: -PT_BR.LABEL_INSTALL_COMPL =%1 foi instalado com êxito em seu computador.\nPara executar o aplicativo após fechar esse instalador, marque a caixa de seleção. -sr_Latn_RS.LABEL_INSTALL_COMPL =%1 je uspešno instaliran na vašem računaru.\nDa biste pokrenuli aplikaciju nakon zatvaranja ovog instalacionog programa, označite polje za potvrdu. -sr_Cyrl_RS.LABEL_INSTALL_COMPL =%1 је успешно инсталиран на вашем рачунару.\nДа бисте покренули апликацију након затварања овог инсталационог програма, означите поље за потврду. -ar_SA.LABEL_INSTALL_COMPL =تم تثبيت٪ 1 بنجاح على جهاز الكمبيوتر .\n لتشغيل التطبيق بعد إنهاء التثبيت ، حدد مربع الاختيار. -nl.LABEL_INSTALL_COMPL =%1 is met succes op uw computer geïnstalleerd.\nOm de toepassing uit te voeren na het sluiten van dit installatieprogramma, schakelt u het selectievakje in. -sl.LABEL_INSTALL_COMPL =%1 je bil uspešno nameščen na vaš računalnik.\nČe želite zagnati aplikacijo po zaprtju tega namestitvenega programa, izberite potrditveno polje. -bg.LABEL_INSTALL_COMPL =%1 е успешно инсталиран на вашия компютър.\nЗа да стартирате приложението след затваряне на този инсталатор, поставете отметка в квадратчето. -cs.LABEL_INSTALL_COMPL =%1 bylo úspěšně nainstalováno do vašeho počítače.\nChcete-li aplikaci spustit po zavření tohoto instalačního programu, zaškrtněte políčko. -el.LABEL_INSTALL_COMPL =Το %1 εγκαταστάθηκε με επιτυχία στον υπολογιστή σας.\nΓια να εκτελέσετε την εφαρμογή μετά το κλείσιμο αυτού του προγράμματος εγκατάστασης, επιλέξτε το κουτάκι. -fi.LABEL_INSTALL_COMPL =%1 on onnistuneesti asennettu tietokoneeseesi. \nValitse valintaruutu suorittaaksesi sovelluksen tämän asennusohjelman sulkemisen jälkeen. -ko.LABEL_INSTALL_COMPL =컴퓨터에 %1 설치가 완료되었습니다.\n이 인스톨러를 종료한 후 애플리케이션을 실행하려면 확인란을 선택하세요. -pt_PT.LABEL_INSTALL_COMPL =%1 foi instalado com êxito no seu computador.\nPara executar o aplicativo depois de fechar este instalador, marque a caixa de seleção. -tr.LABEL_INSTALL_COMPL =%1 bilgisayarınıza başarıyla yüklendi.\nBu yükleyiciyi kapattıktan sonra uygulamayı çalıştırmak için onay kutusuna tıklayın. -uk.LABEL_INSTALL_COMPL =%1 успішно інстальовано на ваш комп'ютер.\nЩоб запустити застосунок після закриття цього інсталятора, установіть прапорець. -pl.LABEL_INSTALL_COMPL =Pomyślnie zainstalowano %1 na Twoim komputerze.\nAby uruchomić aplikację po zamknięciu tego instalatora, zaznacz pole wyboru. -sk.LABEL_INSTALL_COMPL =%1 bol úspešne nainštalovaný na váš počítač.\nAk chcete spustiť aplikáciu po zatvorení inštalácie, označte zaškrtávacie políčko. -vi.LABEL_INSTALL_COMPL =%1 đã được cài đặt thành công trên máy tính của bạn.\nĐể chạy ứng dụng sau khi đóng trình cài đặt này, hãy nhấp chọn vào ô. -he.LABEL_INSTALL_COMPL =%1 הותקן בהצלחה במחשב שלך.\nכדי להפעיל את היישום לאחר סגירת מתקין זה, בחר בתיבת הסימון. -lv.LABEL_INSTALL_COMPL =%1 ir veiksmīgi instalēta jūsu datorā.\nLai palaistu programmu pēc instalatora aizvēršanas, atzīmējiet izvēles rūtiņu. -sq.LABEL_INSTALL_COMPL =%1 është instaluar me sukses në kompjuterin tuaj.\nPër të ekzekutuar aplikacionin pas mbylljes së këtir instaluesi, zgjidhni kutinë e kontrollit. -id.LABEL_INSTALL_COMPL =%1 berhasil terpasang ke komputer Anda.\nSetelah menutup installer, centang kotak untuk menjalankan aplikasi. -sv.LABEL_INSTALL_COMPL =%1 har installerats framgångsrikt på din dator.\nOm du vill köra programmet efter att du har stängt det här installationsprogrammet markerar du kryssrutan. -ur.LABEL_INSTALL_COMPL =آپ کے کمپیوٹر پر %1 کامیابی کے ساتھ انسٹال ہو گیا ہے۔\nاس انسٹالر کو بند کرنے کے بعد ایپلیکیشن چلانے کے لیے، چیک باکس کو منتخب کریں۔ - -en.LABEL_ERR_PROD_CODE =Error while retrieving product code. -en_GB.LABEL_ERR_PROD_CODE =Error while retrieving product code. -ru.LABEL_ERR_PROD_CODE =Ошибка при получении кода продукта. -de.LABEL_ERR_PROD_CODE =Fehler beim Abrufen des Produktcodes. -fr.LABEL_ERR_PROD_CODE =Erreur lors de la récupération du code produit. -es.LABEL_ERR_PROD_CODE =Error al recuperar el código de producto. -it.LABEL_ERR_PROD_CODE =Errore durante il recupero del codice prodotto. -ja.LABEL_ERR_PROD_CODE =製品コードの取得中にエラーが発生しました。 -zh_CN.LABEL_ERR_PROD_CODE =检索产品代码时出错。 -ro.LABEL_ERR_PROD_CODE =Eroare la redobândirea codului de produs. -hy.LABEL_ERR_PROD_CODE =Ապրանքի կոդը ստանալիս սխալ է տեղի ունեցել: -PT_BR.LABEL_ERR_PROD_CODE =Erro ao recuperar o código do produto. -sr_Latn_RS.LABEL_ERR_PROD_CODE =Greška prilikom preuzimanja koda proizvoda. -sr_Cyrl_RS.LABEL_ERR_PROD_CODE =Грешка приликом преузимања кода производа. -ar_SA.LABEL_ERR_PROD_CODE =خطأ أثناء استرداد رمز المنتج. -nl.LABEL_ERR_PROD_CODE =Fout bij het ophalen van de productcode. -sl.LABEL_ERR_PROD_CODE =Napaka pri pridobivanju kode izdelka. -bg.LABEL_ERR_PROD_CODE =Грешка при извличане на продуктовия код. -cs.LABEL_ERR_PROD_CODE =Chyba při načítání kódu produktu. -el.LABEL_ERR_PROD_CODE =Σφάλμα κατά την ανάκτηση του κωδικού προϊόντος. -fi.LABEL_ERR_PROD_CODE =Virhe haettaessa tuotekoodia. -ko.LABEL_ERR_PROD_CODE =제품 코드 검색 중 오류가 발생했습니다. -pt_PT.LABEL_ERR_PROD_CODE =Erro ao recuperar o código do produto. -tr.LABEL_ERR_PROD_CODE =Ürün kodunu alırken hata oluştu. -uk.LABEL_ERR_PROD_CODE =Помилка під час отримання коду продукту. -pl.LABEL_ERR_PROD_CODE =Błąd podczas pobierania kodu produktu. -sk.LABEL_ERR_PROD_CODE =Chyba pri načítaní kódu produktu. -vi.LABEL_ERR_PROD_CODE =Đã xảy ra lỗi khi truy xuất mã sản phẩm. -he.LABEL_ERR_PROD_CODE =שגיאה במהלך אחזור קוד המוצר. -lv.LABEL_ERR_PROD_CODE =Kļūda produkta koda izgūšanas laikā. -sq.LABEL_ERR_PROD_CODE =Gabim gjatë marrjes së kodit të produktit. -id.LABEL_ERR_PROD_CODE =Kesalahan saat mengakses kode produk. -sv.LABEL_ERR_PROD_CODE =Fel vid hämtning av produktkod. -ur.LABEL_ERR_PROD_CODE =پروڈکٹ کوڈ بازیافت کرتے وقت خرابی۔ - -en.LABEL_ERR_PACK_NAME =Error while retrieving package name. -en_GB.LABEL_ERR_PACK_NAME =Error while retrieving package name. -ru.LABEL_ERR_PACK_NAME =Ошибка при получении имени пакета. -de.LABEL_ERR_PACK_NAME =Fehler beim Abrufen des Paketnamens. -fr.LABEL_ERR_PACK_NAME =Erreur lors de la récupération du nom du package. -es.LABEL_ERR_PACK_NAME =Error al recuperar el nombre del paquete. -it.LABEL_ERR_PACK_NAME =Errore durante il recupero del nome del pacchetto. -ja.LABEL_ERR_PACK_NAME =パッケージ名取得中にエラーが発生しました。 -zh_CN.LABEL_ERR_PACK_NAME =检索包名称时出错。 -ro.LABEL_ERR_PACK_NAME =Eroare la redobândirea denumirii pachetului. -hy.LABEL_ERR_PACK_NAME =Փաթեթի անունը ստանալիս սխալ առաջացավ: -PT_BR.LABEL_ERR_PACK_NAME =Erro ao recuperar o nome do pacote. -sr_Latn_RS.LABEL_ERR_PACK_NAME =Greška prilikom preuzimanja imena paketa. -sr_Cyrl_RS.LABEL_ERR_PACK_NAME =Грешка приликом преузимања имена пакета. -ar_SA.LABEL_ERR_PACK_NAME =خطأ أثناء استرداد اسم الحزمة. -nl.LABEL_ERR_PACK_NAME =Fout bij het ophalen van de pakketnaam. -sl.LABEL_ERR_PACK_NAME =Napaka pri pridobivanju imena paketa. -bg.LABEL_ERR_PACK_NAME =Грешка при извличане на името на пакета. -cs.LABEL_ERR_PACK_NAME =Chyba při načítání názvu balíčku. -el.LABEL_ERR_PACK_NAME =Σφάλμα κατά την ανάκτηση του ονόματος του πακέτου. -fi.LABEL_ERR_PACK_NAME =Virhe haettaessa paketin nimeä. -ko.LABEL_ERR_PACK_NAME =패키지 이름 검색 중 오류가 발생했습니다. -pt_PT.LABEL_ERR_PACK_NAME =Erro ao recuperar o nome do pacote. -tr.LABEL_ERR_PACK_NAME =Paket adını alırken hata oluştu. -uk.LABEL_ERR_PACK_NAME =Помилка під час отримання імені пакету. -pl.LABEL_ERR_PACK_NAME =Błąd podczas pobierania nazwy pakietu. -sk.LABEL_ERR_PACK_NAME =Chyba pri načítaní názvu balíka. -vi.LABEL_ERR_PACK_NAME =Đã xảy ra lỗi khi truy xuất tên gói. -he.LABEL_ERR_PACK_NAME =שגיאה במהלך אחזור שם החבילה. -lv.LABEL_ERR_PACK_NAME =Kļūda pakotnes nosaukuma izgūšanas laikā. -sq.LABEL_ERR_PACK_NAME =Gabim gjatë marrjes së emrit të paketës. -id.LABEL_ERR_PACK_NAME =Kesalahan saat mengakses nama paket. -sv.LABEL_ERR_PACK_NAME =Fel vid hämtning av paketnamn. -ur.LABEL_ERR_PACK_NAME =پیکیج کا نام بازیافت کرتے وقت خرابی۔ - -en.LABEL_ERR_INSTALL =An error occurred during installation. -en_GB.LABEL_ERR_INSTALL =An error occurred during installation. -ru.LABEL_ERR_INSTALL =Во время установки произошла ошибка. -de.LABEL_ERR_INSTALL =Bei der Installation ist ein Fehler aufgetreten. -fr.LABEL_ERR_INSTALL =Une erreur s'est produite lors de l'installation. -es.LABEL_ERR_INSTALL =Se ha producido un error durante la instalación. -it.LABEL_ERR_INSTALL =Si è verificato un errore durante l'installazione. -ja.LABEL_ERR_INSTALL =インストール中にエラーが発生しました。 -zh_CN.LABEL_ERR_INSTALL =安装过程中发生错误。 -ro.LABEL_ERR_INSTALL =A intervenit o eroare în timpul instalării. -hy.LABEL_ERR_INSTALL =Տեղադրման ժամանակ սխալ է տեղի ունեցել: -PT_BR.LABEL_ERR_INSTALL =Ocorreu um erro durante a instalação. -sr_Latn_RS.LABEL_ERR_INSTALL =Došlo je do greške tokom instalacije. -sr_Cyrl_RS.LABEL_ERR_INSTALL =Дошло је до грешке током инсталације. -ar_SA.LABEL_ERR_INSTALL =حدث خطأ أثناء التثبيت. -nl.LABEL_ERR_INSTALL =Er is een fout opgetreden tijdens de installatie. -sl.LABEL_ERR_INSTALL =Med namestitvijo je prišlo do napake. -bg.LABEL_ERR_INSTALL =Възникна грешка по време на инсталацията. -cs.LABEL_ERR_INSTALL =Při instalaci došlo k chybě. -el.LABEL_ERR_INSTALL =Προέκυψε σφάλμα κατά την εγκατάσταση. -fi.LABEL_ERR_INSTALL =Virhe asennuksen aikana. -ko.LABEL_ERR_INSTALL =설치 중 오류가 발생했습니다. -pt_PT.LABEL_ERR_INSTALL =Ocorreu um erro durante a instalação. -tr.LABEL_ERR_INSTALL =Yükleme esnasında bir hata oluştu. -uk.LABEL_ERR_INSTALL =Під час інсталювання сталася помилка. -pl.LABEL_ERR_INSTALL =Wystąpił błąd podczas instalowania. -sk.LABEL_ERR_INSTALL =Počas inštalácie došlo k chybe. -vi.LABEL_ERR_INSTALL =Đã xảy ra lỗi trong khi cài đặt. -he.LABEL_ERR_INSTALL =אירעה שגיאה במהלך ההתקנה. -lv.LABEL_ERR_INSTALL =Instalēšanas laikā notika kļūda. -sq.LABEL_ERR_INSTALL =Ndodhi një gabim gjatë instalimit. -id.LABEL_ERR_INSTALL =Ada kesalahan saat instalasi. -sv.LABEL_ERR_INSTALL =Ett fel uppstod under installationen. -ur.LABEL_ERR_INSTALL =تنصیب کے دوران ایک خرابی پیش آگئی۔ - -en.LABEL_ERR_UNINST =An error occurred during uninstalling. -en_GB.LABEL_ERR_UNINST =An error occurred during uninstalling. -ru.LABEL_ERR_UNINST =Во время удаления произошла ошибка. -de.LABEL_ERR_UNINST =Bei der Deinstallation ist ein Fehler aufgetreten. -fr.LABEL_ERR_UNINST =Une erreur s'est produite lors de la désinstallation. -es.LABEL_ERR_UNINST =Se ha producido un error durante la desinstalación. -it.LABEL_ERR_UNINST =Si è verificato un errore durante la disinstallazione. -ja.LABEL_ERR_UNINST =アンインストール中にエラーが発生しました。 -zh_CN.LABEL_ERR_UNINST =卸载过程中发生错误。 -ro.LABEL_ERR_UNINST =A intervenit o eroare în timpul dezinstalării. -hy.LABEL_ERR_UNINST =Ապատեղադրման ժամանակ սխալ է տեղի ունեցել: -PT_BR.LABEL_ERR_UNINST =Ocorreu um erro durante a desinstalação. -sr_Latn_RS.LABEL_ERR_UNINST =Došlo je do greške tokom deinstalacije. -sr_Cyrl_RS.LABEL_ERR_UNINST =Дошло је до грешке током деинсталације. -ar_SA.LABEL_ERR_UNINST =حدث خطأ أثناء إلغاء التثبيت. -nl.LABEL_ERR_UNINST =Er is een fout opgetreden tijdens het verwijderen. -sl.LABEL_ERR_UNINST =Med odstranitvijo je prišlo do napake. -bg.LABEL_ERR_UNINST =Възникна грешка по време на деинсталацията. -cs.LABEL_ERR_UNINST =Během odinstalace došlo k chybě. -el.LABEL_ERR_UNINST =Προέκυψε σφάλμα κατά την απεγκατάσταση. -fi.LABEL_ERR_UNINST =Virhe asennuksen poiston aikana. -ko.LABEL_ERR_UNINST =삭제 중 오류가 발생했습니다. -pt_PT.LABEL_ERR_UNINST =Ocorreu um erro durante a desinstalação. -tr.LABEL_ERR_UNINST =Kaldırma esnasında bir hata oluştu. -uk.LABEL_ERR_UNINST =Під час видалення сталася помилка. -pl.LABEL_ERR_UNINST =Wystąpił błąd podczas odinstalowywania. -sk.LABEL_ERR_UNINST =Počas odinštalovania došlo k chybe. -vi.LABEL_ERR_UNINST =Đã xảy ra lỗi trong quá trình gỡ cài đặt. -he.LABEL_ERR_UNINST =אירעה שגיאה במהלך ההסרה. -lv.LABEL_ERR_UNINST =Atinstalēšanas laikā notika kļūda. -sq.LABEL_ERR_UNINST =Ndodhi një gabim gjatë çinstalimit. -id.LABEL_ERR_UNINST =Ada kesalahan saat uninstall. -sv.LABEL_ERR_UNINST =Ett fel uppstod under avinstallationen. -ur.LABEL_ERR_UNINST =ان انسٹال کرنے کے دوران ایک خرابی پیش آگئی۔ - -en.LABEL_ERR_COMMON =An error occurred: -en_GB.LABEL_ERR_COMMON =An error occurred: -ru.LABEL_ERR_COMMON =Произошла ошибка: -de.LABEL_ERR_COMMON =Ein Fehler ist aufgetreten: -fr.LABEL_ERR_COMMON =Une erreur s'est produite : -es.LABEL_ERR_COMMON =Se ha producido un error: -it.LABEL_ERR_COMMON =Si è verificato un errore: -ja.LABEL_ERR_COMMON =次のようなエラーが発生しました: -zh_CN.LABEL_ERR_COMMON =发生错误: -ro.LABEL_ERR_COMMON =A intervenit o eroare: -hy.LABEL_ERR_COMMON =Սխալ է տեղի ունեցել՝ -PT_BR.LABEL_ERR_COMMON =Ocorreu um erro: -sr_Latn_RS.LABEL_ERR_COMMON =Došlo je do greške: -sr_Cyrl_RS.LABEL_ERR_COMMON =Дошло је до грешке: -ar_SA.LABEL_ERR_COMMON =حدث خطأ: -nl.LABEL_ERR_COMMON =Er is een fout opgetreden: -sl.LABEL_ERR_COMMON =Prišlo je do napake: -bg.LABEL_ERR_COMMON =Възникна грешка: -cs.LABEL_ERR_COMMON =Došlo k chybě: -el.LABEL_ERR_COMMON =Εμφανίστηκε σφάλμα: -fi.LABEL_ERR_COMMON =Virhe: -ko.LABEL_ERR_COMMON =오류가 발생했습니다: -pt_PT.LABEL_ERR_COMMON =Ocorreu um erro: -tr.LABEL_ERR_COMMON =Bir hata oluştu: -uk.LABEL_ERR_COMMON =Сталася помилка: -pl.LABEL_ERR_COMMON =Wystąpił błąd: -sk.LABEL_ERR_COMMON =Vyskytla sa chyba: -vi.LABEL_ERR_COMMON =Đã xảy ra lỗi: -he.LABEL_ERR_COMMON =אירעה שגיאה: -lv.LABEL_ERR_COMMON =Notika kļūda: -sq.LABEL_ERR_COMMON =Një gabim ka ndodhur: -id.LABEL_ERR_COMMON =Ada kesalahan: -sv.LABEL_ERR_COMMON =Ett fel uppstod: -ur.LABEL_ERR_COMMON =ایک خرابی پیش آگئی: - -en.LABEL_ERR_RUNNING =An error occurred while running the package.\nPlease try restarting the app later. -en_GB.LABEL_ERR_RUNNING =An error occurred while running the package.\nPlease try restarting the app later. -ru.LABEL_ERR_RUNNING =Произошла ошибка при запуске установщика.\nПопробуйте перезапустить приложение позже. -de.LABEL_ERR_RUNNING =Beim Ausführen des Pakets ist ein Fehler aufgetreten.\nBitte versuchen Sie, die App später neu zu starten. -fr.LABEL_ERR_RUNNING =Une erreur s'est produit lors de l'exécution du paquet.\nVeuillez réessayer de redémarrer l'application plus tard. -es.LABEL_ERR_RUNNING =Se ha producido un error al ejecutar el paquete.\nIntente reiniciar la aplicación más tarde. -it.LABEL_ERR_RUNNING =Si è verificato un errore durante l'esecuzione del pacchetto.\nProva a riavviare l'app più tardi. -ja.LABEL_ERR_RUNNING =パッケージの実行中にエラーが発生しました。\nアプリを後で再起動してみてください。 -zh_CN.LABEL_ERR_RUNNING =运行软件包时发生错误。\n请稍后尝试重新启动应用程序。 -ro.LABEL_ERR_RUNNING =A intervenit o eroare în timpul executării pachetului.\nÎncercaţi să reporniți aplicația mai târziu. -ar_SA.LABEL_ERR_RUNNING =حدث خطأ أثناء تشغيل الحزمة.\nالرجاء محاولة إعادة تشغيل التطبيق لاحقا. -bg.LABEL_ERR_RUNNING =Възникна грешка при стартиране на пакета.\nМоля, опитайте да рестартирате приложението по-късно. -cs.LABEL_ERR_RUNNING =Při spouštění balíčku došlo k chybě.\nProsím, zkuste aplikaci restartovat později. -el.LABEL_ERR_RUNNING =Προέκυψε σφάλμα κατά την εκτέλεση του πακέτου.\nΔοκιμάστε να επανεκκινήσετε την εφαρμογή αργότερα. -fi.LABEL_ERR_RUNNING =Paketin suorittamisen aikana tapahtui virhe. \nOle hyvä ja yritä käynnistää sovellus myöhemmin uudelleen. -hy.LABEL_ERR_RUNNING =Փաթեթը գործարկելիս սխալ է տեղի ունեցել.\nՓորձեք ավելի ուշ վերագործարկել հավելվածը: -ko.LABEL_ERR_RUNNING =패키지를 실행하는 동안 오류가 발생했습니다.\n나중에 앱을 다시 시작하세요. -lv.LABEL_ERR_RUNNING =Palaižot pakotni, radās kļūda.\nMēģiniet restartēt lietotni vēlāk. -nl.LABEL_ERR_RUNNING =Er is een fout opgetreden tijdens het uitvoeren van het pakket.\nProbeer de app later opnieuw te starten. -pl.LABEL_ERR_RUNNING =Wystąpił błąd podczas uruchamiania pakietu.\nSpróbuj ponownie uruchomić aplikację później. -pt_PT.LABEL_ERR_RUNNING =Ocorreu um erro ao executar o pacote.\nTente reiniciar o aplicativo mais tarde. -sk.LABEL_ERR_RUNNING =Počas spúšťania balíka došlo k chybe.\nProsím, skúste reštartovať aplikáciu neskôr. -sl.LABEL_ERR_RUNNING =Med izvajanjem paketa je prišlo do napake.\nPoskusite znova zagnati aplikacijo pozneje. -tr.LABEL_ERR_RUNNING =Paket çalıştırılırken bir hata oluştu.\nLütfen uygulamayı daha sonra yeniden başlatmayı deneyin. -uk.LABEL_ERR_RUNNING =Під час запуску пакету сталася помилка. \nСпробуйте перезапустити застосунок пізніше. -vi.LABEL_ERR_RUNNING =Đã xảy ra lỗi khi chạy gói.\nVui lòng thử khởi động lại ứng dụng sau. -sr_Latn_RS.LABEL_ERR_RUNNING =Došlo je do greške prilikom pokretanja paketa.\nMolimo pokušajte da restartujete aplikaciju kasnije. -si.LABEL_ERR_RUNNING =ඇසුරුම ධාවනයේ දී දෝෂයක් සිදු විය.\nකරුණාකර මෘදුකාංගය නැවත ආරම්භ කර බලන්න. -be.LABEL_ERR_RUNNING =Падчас запуску пакета адбылася памылка.\nПаспрабуйце перазапусціць прыкладанне пазней. -ca.LABEL_ERR_RUNNING =S'ha produït un error en executar el paquet.\nProveu de reiniciar l'aplicació més tard. -da.LABEL_ERR_RUNNING =Der opstod en fejl under drift af pakken.\nPrøv venligst at genstarte appen senere. -gl.LABEL_ERR_RUNNING =Produciuse un erro ao executar o paquete.\nPor favor, tente reiniciar a aplicación máis tarde. -hu.LABEL_ERR_RUNNING =Hiba történt a csomag futtatása közben.\nKérjük, próbálja meg később újraindítani az alkalmazást. -id.LABEL_ERR_RUNNING =Ada kesalahan saat menjalankan paket.\nMohon restart app lagi nanti. -no.LABEL_ERR_RUNNING =Det oppstod en feil under kjøring av pakken.\nVennligst prøv å starte appen på nytt senere. -et.LABEL_ERR_RUNNING =Paketi käivitamisel tekkis viga.\nPalun proovige rakenduse taaskäivitamist hiljem. -lt.LABEL_ERR_RUNNING =Paleidus paketą, įvyko klaida.\nPabandykite kiek vėliau iš naujo paleisti programą. -hr.LABEL_ERR_RUNNING =Došlo je do pogreške prilikom pokretanja paketa.\nPokušajte ponovno pokrenuti aplikaciju kasnije. -hi.LABEL_ERR_RUNNING =पैकेज चलाने के दौरान एक त्रुटि उत्पन्न हुई।\nकृपया बाद में ऐप को रीस्टार्ट करने का प्रयास करें। -sv.LABEL_ERR_RUNNING =Ett fel inträffade vid körning av paketet.\nFörsök starta om appen senare. -sr_Cyrl_RS.LABEL_ERR_RUNNING =Дошло је до грешке приликом покретања пакета.\nМолимо покушајте да рестартујете апликацију касније. -he.LABEL_ERR_RUNNING =אירעה שגיאה בעת הפעלת החבילה.\nאנא נסה להפעיל מחדש את היישום מאוחר יותר. -sq.LABEL_ERR_RUNNING =Ndodhi një gabim gjatë ekzekutimit të paketës.\nJu lutem, provoni ta rinisni aplikacionin më vonë. -ur.LABEL_ERR_RUNNING =پیکیج چلاتے وقت ایک خرابی پیش آگئی۔\nبراہ کرم بعد میں ایپ کو دوبارہ شروع کرنے کی کوشش کریں۔ - -en.LABEL_ERR_CANCELLED =Cancelled! -en_GB.LABEL_ERR_CANCELLED =Cancelled! -ru.LABEL_ERR_CANCELLED =Отменено! -de.LABEL_ERR_CANCELLED =Abgebrochen! -fr.LABEL_ERR_CANCELLED =Annulé ! -es.LABEL_ERR_CANCELLED =¡Cancelado! -it.LABEL_ERR_CANCELLED =Cancellato! -ja.LABEL_ERR_CANCELLED =キャンセルされました! -zh_CN.LABEL_ERR_CANCELLED =已取消! -ro.LABEL_ERR_CANCELLED =A fost anulat! -hy.LABEL_ERR_CANCELLED =Չեղարկված է -PT_BR.LABEL_ERR_CANCELLED =Cancelado! -sr_Latn_RS.LABEL_ERR_CANCELLED =Otkazan! -sr_Cyrl_RS.LABEL_ERR_CANCELLED =Отказан! -nl.LABEL_ERR_CANCELLED =Geannuleerd! -sl.LABEL_ERR_CANCELLED =Preklicano! -bg.LABEL_ERR_CANCELLED =Отменено! -cs.LABEL_ERR_CANCELLED =Zrušeno! -el.LABEL_ERR_CANCELLED =Ακυρώθηκε! -fi.LABEL_ERR_CANCELLED =Peruutettu! -ko.LABEL_ERR_CANCELLED =취소! -pt_PT.LABEL_ERR_CANCELLED =Cancelado! -uk.LABEL_ERR_CANCELLED =Скасовано! -pl.LABEL_ERR_CANCELLED =Skasowany! -sk.LABEL_ERR_CANCELLED =Zrušené! -vi.LABEL_ERR_CANCELLED =Đã hủy! -he.LABEL_ERR_CANCELLED =בוטל! -lv.LABEL_ERR_CANCELLED =Atcelts! -sq.LABEL_ERR_CANCELLED =Anuluar! -id.LABEL_ERR_CANCELLED =Dibatalkan! -sv.LABEL_ERR_CANCELLED =Avbrutet! -ur.LABEL_ERR_CANCELLED =منسوخ کر دیا گیا! -ar_SA.LABEL_ERR_CANCELLED =ألغيت! - -en.BUTTON_INSTALL =Install -en_GB.BUTTON_INSTALL =Install -ru.BUTTON_INSTALL =Установить -de.BUTTON_INSTALL =Installieren -fr.BUTTON_INSTALL =Installer -es.BUTTON_INSTALL =Instalar -it.BUTTON_INSTALL =Installa -ja.BUTTON_INSTALL =インストール -zh_CN.BUTTON_INSTALL =安装 -ro.BUTTON_INSTALL =Instalare -hy.BUTTON_INSTALL =Տեղադրել -PT_BR.BUTTON_INSTALL =Instalar -sr_Latn_RS.BUTTON_INSTALL =Instaliraj -sr_Cyrl_RS.BUTTON_INSTALL =Инсталирај -nl.BUTTON_INSTALL =Installeren -sl.BUTTON_INSTALL =Namesti -bg.BUTTON_INSTALL =Инсталирайте -cs.BUTTON_INSTALL =Instalovat -el.BUTTON_INSTALL =Εγκαθιστώ -fi.BUTTON_INSTALL =Asentaa -ko.BUTTON_INSTALL =설치하다 -pt_PT.BUTTON_INSTALL =Instalar -tr.BUTTON_INSTALL =Kurulum -uk.BUTTON_INSTALL =Установити -pl.BUTTON_INSTALL =Zainstalować -sk.BUTTON_INSTALL =Inštalovať -vi.BUTTON_INSTALL =Cài đặt -he.BUTTON_INSTALL =התקן -lv.BUTTON_INSTALL =Instalēt -sq.BUTTON_INSTALL =Instaloni -id.BUTTON_INSTALL =Install -sv.BUTTON_INSTALL =Installera -ur.BUTTON_INSTALL =انسٹال کریں۔ -ar_SA.BUTTON_INSTALL =يثبت - -en.BUTTON_CANCEL =Cancel -en_GB.BUTTON_CANCEL =Cancel -ru.BUTTON_CANCEL =Отмена -de.BUTTON_CANCEL =Abbrechen -fr.BUTTON_CANCEL =Annuler -es.BUTTON_CANCEL =Cancelar -it.BUTTON_CANCEL =Annulla -ja.BUTTON_CANCEL =キャンセル -zh_CN.BUTTON_CANCEL =取消 -ro.BUTTON_CANCEL =Anulare -ar_SA.BUTTON_CANCEL =إلغاء -bg.BUTTON_CANCEL =Отказ -cs.BUTTON_CANCEL =Zrušit -el.BUTTON_CANCEL =Ακύρωση -fi.BUTTON_CANCEL =Peruuta -hy.BUTTON_CANCEL =Չեղարկել -ko.BUTTON_CANCEL =취소 -lv.BUTTON_CANCEL =Atcelt -nl.BUTTON_CANCEL =Annuleren -pl.BUTTON_CANCEL =Anuluj -PT_BR.BUTTON_CANCEL =Cancelar -pt_PT.BUTTON_CANCEL =Cancelar -sk.BUTTON_CANCEL =Zrušiť -sl.BUTTON_CANCEL =Prekliči -tr.BUTTON_CANCEL =İptal -uk.BUTTON_CANCEL =Скасувати -vi.BUTTON_CANCEL =Hủy -sr_Latn_RS.BUTTON_CANCEL =Otkaži -si.BUTTON_CANCEL =අවලංගු -be.BUTTON_CANCEL =Адмяніць -ca.BUTTON_CANCEL =Cancel·lar -da.BUTTON_CANCEL =Annuller -gl.BUTTON_CANCEL =Cancelar -hu.BUTTON_CANCEL =Törlés -id.BUTTON_CANCEL =Batal -no.BUTTON_CANCEL =Avbryt -et.BUTTON_CANCEL =Tühista -lt.BUTTON_CANCEL =Atšaukti -hr.BUTTON_CANCEL =Otkaži -hi.BUTTON_CANCEL =रद्द करें -sv.BUTTON_CANCEL =Avbryt -sr_Cyrl_RS.BUTTON_CANCEL =Откажи -he.BUTTON_CANCEL =ביטול -sq.BUTTON_CANCEL =Anuloni -ur.BUTTON_CANCEL =منسوخ کریں۔ - -en.BUTTON_APPLY =Apply -en_GB.BUTTON_APPLY =Apply -ru.BUTTON_APPLY =Применить -de.BUTTON_APPLY =Anwenden -fr.BUTTON_APPLY =Appliquer -es.BUTTON_APPLY =Aplicar -it.BUTTON_APPLY =Applica -ja.BUTTON_APPLY =適用 -zh_CN.BUTTON_APPLY =应用 -ro.BUTTON_APPLY =Aplicare -hy.BUTTON_APPLY =Գործադրել -PT_BR.BUTTON_APPLY =Aplicar -sr_Latn_RS.BUTTON_APPLY =Primeni -sr_Cyrl_RS.BUTTON_APPLY =Примени -ar_SA.BUTTON_APPLY =تطبيق -nl.BUTTON_APPLY =Toepassen -sl.BUTTON_APPLY =Uporabi -bg.BUTTON_APPLY =Приложи -cs.BUTTON_APPLY =Použít -el.BUTTON_APPLY =Εφαρμογή -fi.BUTTON_APPLY =Käytä -ko.BUTTON_APPLY =적용 -pt_PT.BUTTON_APPLY =Aplicar -tr.BUTTON_APPLY =Uygula -uk.BUTTON_APPLY =Застосувати -pl.BUTTON_APPLY =Zatwierdź -sk.BUTTON_APPLY =Použiť -vi.BUTTON_APPLY =Áp dụng -he.BUTTON_APPLY =החל -lv.BUTTON_APPLY =Piemērot -sq.BUTTON_APPLY =Aplikoni -id.BUTTON_APPLY =Terapkan -sv.BUTTON_APPLY =Verkställ -ur.BUTTON_APPLY =لگائیں - -en.BUTTON_CLOSE =Close -en_GB.BUTTON_CLOSE =Close -ru.BUTTON_CLOSE =Закрыть -de.BUTTON_CLOSE =Schließen -fr.BUTTON_CLOSE =Fermer -es.BUTTON_CLOSE =Cerrar -it.BUTTON_CLOSE =Chiudo -ja.BUTTON_CLOSE =閉じる -zh_CN.BUTTON_CLOSE =关闭 -ro.BUTTON_CLOSE =Închidere -hy.BUTTON_CLOSE =Փակել -PT_BR.BUTTON_CLOSE =Fechar -sr_Latn_RS.BUTTON_CLOSE =Zatvori -sr_Cyrl_RS.BUTTON_CLOSE =Затвори -ar_SA.BUTTON_CLOSE =إغلاق -nl.BUTTON_CLOSE =Sluiten -sl.BUTTON_CLOSE =Zapri -bg.BUTTON_CLOSE =Затвори -cs.BUTTON_CLOSE =Zavřít -el.BUTTON_CLOSE =Κλείσιμο -fi.BUTTON_CLOSE =Sulje -ko.BUTTON_CLOSE =닫기 -pt_PT.BUTTON_CLOSE =Fechar -tr.BUTTON_CLOSE =Kapat -uk.BUTTON_CLOSE =Закрити -pl.BUTTON_CLOSE =Zamknij -sk.BUTTON_CLOSE =Zatvoriť -vi.BUTTON_CLOSE =Đóng -he.BUTTON_CLOSE =סגור -lv.BUTTON_CLOSE =Aizvērt -sq.BUTTON_CLOSE =Mbyllni -id.BUTTON_CLOSE =Tutup -sv.BUTTON_CLOSE =Stäng -ur.BUTTON_CLOSE =بند - -en.BUTTON_BACK =Back -en_GB.BUTTON_BACK =Back -ru.BUTTON_BACK =Назад -de.BUTTON_BACK =Zurück -fr.BUTTON_BACK =Retour -es.BUTTON_BACK =Volver -it.BUTTON_BACK =Indietro -ja.BUTTON_BACK =戻る -zh_CN.BUTTON_BACK =后退 -ro.BUTTON_BACK =Înapoi -hy.BUTTON_BACK =Ետ -PT_BR.BUTTON_BACK =Voltar -sr_Latn_RS.BUTTON_BACK =Nazad -sr_Cyrl_RS.BUTTON_BACK =Назад -ar_SA.BUTTON_BACK =عودة -nl.BUTTON_BACK =Terug -sl.BUTTON_BACK =Nazaj -bg.BUTTON_BACK =Обратно -cs.BUTTON_BACK =Zpět -el.BUTTON_BACK =Πίσω -fi.BUTTON_BACK =Takaisin -ko.BUTTON_BACK =뒤로 -pt_PT.BUTTON_BACK =Voltar -tr.BUTTON_BACK =Geri -uk.BUTTON_BACK =Назад -pl.BUTTON_BACK =Wstecz -sk.BUTTON_BACK =Späť -vi.BUTTON_BACK =Quay lại -he.BUTTON_BACK =חזור -lv.BUTTON_BACK =Atpakaļ -sq.BUTTON_BACK =Mbrapa -id.BUTTON_BACK =Kembali -sv.BUTTON_BACK =Tillbaka -ur.BUTTON_BACK =پیچھے - -en.RADIO_UPDATE =Update/Repair -en_GB.RADIO_UPDATE =Update/Repair -ru.RADIO_UPDATE =Обновить/Восстановить -de.RADIO_UPDATE =Aktualisierung/Reparatur -fr.RADIO_UPDATE =Mettre à jour/Réparer -es.RADIO_UPDATE =Actualizar/Reparar -it.RADIO_UPDATE =Aggiornare/Riparare -ja.RADIO_UPDATE =アップデート/修理 -zh_CN.RADIO_UPDATE =更新/修复 -ro.RADIO_UPDATE =Actualizare/Reparare -hy.RADIO_UPDATE =Թարմացնել/Վերանորոգում -PT_BR.RADIO_UPDATE =Atualizar/Reparar -sr_Latn_RS.RADIO_UPDATE =Ažuriraj/Popravka -sr_Cyrl_RS.RADIO_UPDATE =Ажурирај/Поправка -ar_SA.RADIO_UPDATE =تحديث/يصلح -nl.RADIO_UPDATE =Update/Repareren -sl.RADIO_UPDATE =Posodobi/Popravilo -bg.RADIO_UPDATE =Актуализация/Поправка -cs.RADIO_UPDATE =Aktualizace/Opravit -el.RADIO_UPDATE =Ενημέρωση/Επισκευή -fi.RADIO_UPDATE =Päivitä/Korjaus -ko.RADIO_UPDATE =업데이트/수리 -pt_PT.RADIO_UPDATE =Atualizar/Reparar -tr.RADIO_UPDATE =Güncelle/Tamir -uk.RADIO_UPDATE =Оновити/Ремонтувати -pl.RADIO_UPDATE =Aktualizacja/Naprawiać -sk.RADIO_UPDATE =Aktualizácia/Opraviť -vi.RADIO_UPDATE =Cập nhật/Sửa chữa -he.RADIO_UPDATE =עדכן/תיקן -lv.RADIO_UPDATE =Atjaunināt/Remonts -sq.RADIO_UPDATE =Përditësim/Riparim -id.RADIO_UPDATE =Update/Perbaiki -sv.RADIO_UPDATE =Uppdatera/Reparera -ur.RADIO_UPDATE =اپ ڈیٹ کریں۔ - -en.RADIO_REPAIR =Repair -en_GB.RADIO_REPAIR =Repair -ru.RADIO_REPAIR =Восстановить -de.RADIO_REPAIR =Reparieren -fr.RADIO_REPAIR =Réparer -es.RADIO_REPAIR =Reparar -it.RADIO_REPAIR =Ripara -ja.RADIO_REPAIR =修復 -zh_CN.RADIO_REPAIR =修复 -ro.RADIO_REPAIR =Reparare -hy.RADIO_REPAIR =Վերականգնել -PT_BR.RADIO_REPAIR =Reparar -sr_Latn_RS.RADIO_REPAIR =Popravka -sr_Cyrl_RS.RADIO_REPAIR =Поправка -nl.RADIO_REPAIR =Repareren -sl.RADIO_REPAIR =Popravilo -bg.RADIO_REPAIR =Поправка -cs.RADIO_REPAIR =Opravit -el.RADIO_REPAIR =Επισκευή -fi.RADIO_REPAIR =Korjaus -ko.RADIO_REPAIR =수리 -pt_PT.RADIO_REPAIR =Reparar -tr.RADIO_REPAIR =Tamir -uk.RADIO_REPAIR =Ремонтувати -pl.RADIO_REPAIR =Naprawiać -sk.RADIO_REPAIR =Opraviť -vi.RADIO_REPAIR =Sửa chữa -he.RADIO_REPAIR =תיקן -lv.RADIO_REPAIR =Remonts -sq.RADIO_REPAIR =Riparim -id.RADIO_REPAIR =Perbaiki -sv.RADIO_REPAIR =Reparera -ur.RADIO_REPAIR =مرمت - -en.RADIO_UNINST =Uninstall -en_GB.RADIO_UNINST =Uninstall -ru.RADIO_UNINST =Удалить -de.RADIO_UNINST =Deinstallieren -fr.RADIO_UNINST =Désinstaller -es.RADIO_UNINST =Desinstalar -it.RADIO_UNINST =Disinstalla -ja.RADIO_UNINST =アンインストール -zh_CN.RADIO_UNINST =卸载 -ro.RADIO_UNINST =Dezinstalare -hy.RADIO_UNINST =Հեռացնել -PT_BR.RADIO_UNINST =Desinstalar -sr_Latn_RS.RADIO_UNINST =Deinstaliraj -sr_Cyrl_RS.RADIO_UNINST =Деинсталирај -nl.RADIO_UNINST =Verwijderen -sl.RADIO_UNINST =Odstrani -bg.RADIO_UNINST =Деинсталиране -cs.RADIO_UNINST =Odinstalovat -el.RADIO_UNINST =Απεγκατάσταση -fi.RADIO_UNINST =Poista asennus -ko.RADIO_UNINST =제거 -pt_PT.RADIO_UNINST =Desinstalar -tr.RADIO_UNINST =Kaldır -uk.RADIO_UNINST =Деінсталювати -pl.RADIO_UNINST =Odinstaluj -sk.RADIO_UNINST =Odinštalovať -vi.RADIO_UNINST =Gỡ bỏ -he.RADIO_UNINST =הסר -lv.RADIO_UNINST =Atinstalēt -sq.RADIO_UNINST =Çinstaloni -id.RADIO_UNINST =Uninstall -sv.RADIO_UNINST =Avinstallera -ur.RADIO_UNINST =ان انسٹال کریں۔ -ar_SA.RADIO_UNINST =إلغاء التثبيت -be.RADIO_UNINST =Выдаленне -ca.RADIO_UNINST =Desinstal·la -da.RADIO_UNINST =Afinstaller -et.RADIO_UNINST =Desinstalli -gl.RADIO_UNINST =Desinstalar -ga.RADIO_UNINST =Díshuiteáil -hi.RADIO_UNINST =स्थापना रद्द करें -hr.RADIO_UNINST =Deinstalirati -hu.RADIO_UNINST =Eltávolítás -lt.RADIO_UNINST =Išdiegti -no.RADIO_UNINST =Avinstaller - -en.CHECK_SILENT =Silent Installation -en_GB.CHECK_SILENT =Silent Installation -ru.CHECK_SILENT =Тихая установка -de.CHECK_SILENT =Silent Installation -fr.CHECK_SILENT =Installation sans assistance -es.CHECK_SILENT =Instalación silenciosa -it.CHECK_SILENT =Installazione silenziosa -ja.CHECK_SILENT =サイレントインストール -zh_CN.CHECK_SILENT =静默安装 -ro.CHECK_SILENT =Instalare nesupravegheată -ar_SA.CHECK_SILENT =التثبيت الصامت -bg.CHECK_SILENT =Тихо инсталиране -cs.CHECK_SILENT =Tichá instalace -el.CHECK_SILENT =Αθόρυβη εγκατάσταση -fi.CHECK_SILENT =Äänetön asennus -hy.CHECK_SILENT =Լուռ տեղադրում -ko.CHECK_SILENT =비대화형 방식 설치 -lv.CHECK_SILENT =Klusā instalēšana -nl.CHECK_SILENT =Stille installatie -pl.CHECK_SILENT =Instalacja dyskretna -pt_BR.CHECK_SILENT =Instalação silenciosa -pt_PT.CHECK_SILENT =Instalação silenciosa -sk.CHECK_SILENT =Tichá inštalácia -sl.CHECK_SILENT =Tiha namestitev -tr.CHECK_SILENT =Sessiz Kurulum -uk.CHECK_SILENT =Автоматичне інсталювання -vi.CHECK_SILENT =Cài đặt im lặng -sr_Latn_RS.CHECK_SILENT =Tiha instalacija -si.CHECK_SILENT =නිහඬ ස්ථාපනය -be.CHECK_SILENT =Ціхая ўстаноўка -ca.CHECK_SILENT =Instal·lació silenciosa -da.CHECK_SILENT =Lydløs installation -gl.CHECK_SILENT =Instalación silenciosa -hu.CHECK_SILENT =Beavatkozás nélküli telepítés -id.CHECK_SILENT =Instalasi senyap -no.CHECK_SILENT =Stille installering -et.CHECK_SILENT =Vaikne paigaldus -lt.CHECK_SILENT =Tylus diegimas -hr.CHECK_SILENT =Tiha instalacija -hi.CHECK_SILENT =मौन इंस्टॉलेशन -sv.CHECK_SILENT =Obevakad installation -sr_Cyrl_RS.CHECK_SILENT =Тиха инсталација -he.CHECK_SILENT =התקנה שקטה -sq.CHECK_SILENT =Silent Installation -ur.CHECK_SILENT =خاموش تنصیب - -en.CHECK_LAUNCH =Launch app -en_GB.CHECK_LAUNCH =Launch app -ru.CHECK_LAUNCH =Запустить приложение -de.CHECK_LAUNCH =App starten -fr.CHECK_LAUNCH =Lancer l'application -es.CHECK_LAUNCH =Iniciar la app -it.CHECK_LAUNCH =Lancia l’app -ja.CHECK_LAUNCH =アプリの起動 -zh_CN.CHECK_LAUNCH =启动应用 -ro.CHECK_LAUNCH =Lansare aplicație -hy.CHECK_LAUNCH =Գործարկել հավելվածը -PT_BR.CHECK_LAUNCH =Iniciar o aplicativo -sr_Latn_RS.CHECK_LAUNCH =Pokreni aplikaciju -sr_Cyrl_RS.CHECK_LAUNCH =Покрени апликацију -he.CHECK_LAUNCH =הפעל אפליקציה -sq.CHECK_LAUNCH =Hapni aplikacionin -id.CHECK_LAUNCH =Jalankan app -sv.CHECK_LAUNCH =Starta app -ar_SA.CHECK_LAUNCH =تشغيل التطبيق -ur.CHECK_LAUNCH =ایپ لانچ کریں۔ - -en.CHECK_CLR_DATA =Clear cached data -en_GB.CHECK_CLR_DATA =Clear cached data -ru.CHECK_CLR_DATA =Очистить кэшированные данные -de.CHECK_CLR_DATA =Zwischengespeicherte Daten löschen -fr.CHECK_CLR_DATA =Effacer les données en cache -es.CHECK_CLR_DATA =Borrar los datos de la caché -it.CHECK_CLR_DATA =Cancella i dati nella cache -ja.CHECK_CLR_DATA =キャッシュデータをクリアする -zh_CN.CHECK_CLR_DATA =清除缓存数据 -ro.CHECK_CLR_DATA =Golire datele memorate în cache -hy.CHECK_CLR_DATA =Մաքրել քեշային տվյալները -PT_BR.CHECK_CLR_DATA =Limpar dados em cache -sr_Latn_RS.CHECK_CLR_DATA =Obriši keširane podatke -sr_Cyrl_RS.CHECK_CLR_DATA =Обриши кеширане податке -he.CHECK_CLR_DATA =נקה נתונים זמניים -sq.CHECK_CLR_DATA =Pastroni të dhënat e memories së ruajtur -ur.CHECK_CLR_DATA =کیش شدہ ڈیٹا کو صاف کریں۔ -id.CHECK_CLR_DATA =Hapus data cache -sv.CHECK_CLR_DATA =Rensa cachelagrade data -ar_SA.CHECK_CLR_DATA =مسح البيانات المخزنة مؤقتًا -be.CHECK_CLR_DATA =Ачысціць кэшаваныя дадзеныя -bg.CHECK_CLR_DATA =Изчистете кешираните данни -ca.CHECK_CLR_DATA =Esborra les dades de la memòria cau -cs.CHECK_CLR_DATA =Vymazat data v mezipaměti -fi.CHECK_CLR_DATA =Tyhjennä välimuistissa olevat tiedot -gl.CHECK_CLR_DATA =Limpar os datos almacenados na caché -ko.CHECK_CLR_DATA =캐시된 데이터를 삭제 -lv.CHECK_CLR_DATA =Notīrīt kešatmiņā saglabātos datus -nl.CHECK_CLR_DATA =Wis gegevens in de cache -pl.CHECK_CLR_DATA =Wyczyść buforowane dane -pt_PT.CHECK_CLR_DATA =Limpar dados em cache -sk.CHECK_CLR_DATA =Vymazať údaje vo vyrovnávacej pamäti -sl.CHECK_CLR_DATA =Počisti predpomnjene podatke -tr.CHECK_CLR_DATA =Önbelleğe alınan verileri temizleyin -uk.CHECK_CLR_DATA =Очистити кешовані дані -vi.CHECK_CLR_DATA =Xóa dữ liệu đã lưu vào bộ nhớ đệm - -en.CHECK_CLR_STNGS =Clear user settings -en_GB.CHECK_CLR_STNGS =Clear user settings -ru.CHECK_CLR_STNGS =Очистить пользовательские настройки -de.CHECK_CLR_STNGS =Benutzereinstellungen löschen -fr.CHECK_CLR_STNGS =Effacer les paramètres de l'utilisateur -es.CHECK_CLR_STNGS =Borrar la configuración del usuario -it.CHECK_CLR_STNGS =Cancella le impostazioni dell'utente -ja.CHECK_CLR_STNGS =ユーザー設定をクリアする -zh_CN.CHECK_CLR_STNGS =清楚用户设置 -ro.CHECK_CLR_STNGS =Golire setări utilizator -hy.CHECK_CLR_STNGS =Մաքրել օգտվողի կարգավորումները -PT_BR.CHECK_CLR_STNGS =Limpar configurações do usuário -sr_Latn_RS.CHECK_CLR_STNGS =Obriši korisnička podešavanja -sr_Cyrl_RS.CHECK_CLR_STNGS =Обриши корисничка подешавања -he.CHECK_CLR_STNGS =נקה הגדרות משתמש -sq.CHECK_CLR_STNGS =Pastroni cilësimet e përdoruesit -id.CHECK_CLR_STNGS =Hapus pengaturan user -sv.CHECK_CLR_STNGS =Rensa användarinställningar -ur.CHECK_CLR_STNGS =صارف کی ترتیبات کو صاف کریں۔ -ar_SA.CHECK_CLR_STNGS =مسح إعدادات المستخدم -be.CHECK_CLR_STNGS =Ачысціць налады карыстальніка -bg.CHECK_CLR_STNGS =Изчистете настройките на потребителя -ca.CHECK_CLR_STNGS =Esborra la configuració de l'usuari -cs.CHECK_CLR_STNGS =Vymazat uživatelská nastavení -fi.CHECK_CLR_STNGS =Tyhjennä käyttäjäasetukset -gl.CHECK_CLR_STNGS =Limpar a configuración do usuario -ko.CHECK_CLR_STNGS =사용자 설정 지우기 -lv.CHECK_CLR_STNGS =Notīrīt lietotāja iestatījumus -nl.CHECK_CLR_STNGS =Wis gebruikersinstellingen -pl.CHECK_CLR_STNGS =Wyczyść ustawienia użytkownika -pt_PT.CHECK_CLR_STNGS =Limpar as definições do utilizador -sk.CHECK_CLR_STNGS =Vymazať nastavenia používateľa -sl.CHECK_CLR_STNGS =Počisti nastavitve uporabnika -tr.CHECK_CLR_STNGS =Kullanıcı ayarlarını temizle -uk.CHECK_CLR_STNGS =Очистити параметри користувача -vi.CHECK_CLR_STNGS =Xóa cài đặt người dùng - -en.CHECK_CLR_ALL =Clear user settings and cached data -en_GB.CHECK_CLR_ALL =Clear user settings and cached data -ru.CHECK_CLR_ALL =Очистить пользовательские настройки и кэшированные данные -de.CHECK_CLR_ALL =Benutzereinstellungen und zwischengespeicherte Daten löschen -fr.CHECK_CLR_ALL =Effacer les paramètres de l'utilisateur et les données en cache -es.CHECK_CLR_ALL =Borrar la configuración del usuario y los datos de la caché -it.CHECK_CLR_ALL =Cancella le impostazioni dell’utente e i dati nella cache -ja.CHECK_CLR_ALL =ユーザー設定とキャッシュデータをクリアする -zh_CN.CHECK_CLR_ALL =清除用户设置和缓存数据 -ro.CHECK_CLR_ALL =Golire setări utilizator și datele memorate în cache -hy.CHECK_CLR_ALL =Մաքրել օգտատիրոջ կարգավորումները և քեշավորված տվյալները -PT_BR.CHECK_CLR_ALL =Limpar configurações do usuário e dados armazenados em cache -sr_Latn_RS.CHECK_CLR_ALL =Obriši korisnička podešavanja i keširane podatke -sr_Cyrl_RS.CHECK_CLR_ALL =Обриши корисничка подешавања и кеширане податке -he.CHECK_CLR_ALL =נקה הגדרות משתמש ונתונים זמניים -sq.CHECK_CLR_ALL =Pastroni cilësimet e përdoruesit dhe të dhënat e memories së ruajtur -id.CHECK_CLR_ALL =Hapus pengaturan user dan data cache -sv.CHECK_CLR_ALL =Rensa användarinställningar och cachelagrade data -ur.CHECK_CLR_ALL =صارف کی ترتیبات اور کیشڈ ڈیٹا کو صاف کریں۔ -ar_SA.CHECK_CLR_ALL =مسح إعدادات المستخدم والبيانات المخزنة مؤقتًا -be.CHECK_CLR_ALL =Ачысціць карыстальніцкія налады і кэшаваныя даныя -bg.CHECK_CLR_ALL =Изчистете настройките на потребителя и кешираните данни -ca.CHECK_CLR_ALL =Esborra la configuració de l'usuari i les dades de la memòria cau -cs.CHECK_CLR_ALL =Vymazat uživatelská nastavení a data z mezipaměti -fi.CHECK_CLR_ALL =Tyhjennä käyttäjäasetukset ja välimuistissa olevat tiedot -gl.CHECK_CLR_ALL =Limpar a configuración do usuario e os datos almacenados na caché -ko.CHECK_CLR_ALL =사용자 설정 및 캐시된 데이터 지우기 -lv.CHECK_CLR_ALL =Notīrīt lietotāja iestatījumus un kešatmiņā saglabātos datus -nl.CHECK_CLR_ALL =Wis gebruikersinstellingen en gegevens in de cache -pl.CHECK_CLR_ALL =Wyczyść ustawienia użytkownika i dane z pamięci podręcznej -pt_PT.CHECK_CLR_ALL =Limpar as definições do utilizador e dados em cache -sk.CHECK_CLR_ALL =Vymazať nastavenia používateľa a údaje z vyrovnávacej pamäte -sl.CHECK_CLR_ALL =Počisti nastavitve uporabnika in predpomnjene podatke -tr.CHECK_CLR_ALL =Kullanıcı ayarlarını ve önbelleğe alınmış verileri temizle -uk.CHECK_CLR_ALL =Очистити параметри користувача та кешовані дані -vi.CHECK_CLR_ALL =Xóa cài đặt người dùng và dữ liệu được lưu trữ \ No newline at end of file diff --git a/win-linux/extras/online-installer/res/manifest/online-installer.exe.manifest b/win-linux/extras/online-installer/res/manifest/online-installer.exe.manifest deleted file mode 100644 index 463123114..000000000 --- a/win-linux/extras/online-installer/res/manifest/online-installer.exe.manifest +++ /dev/null @@ -1,58 +0,0 @@ - - - - - Online Installer. - - - - - - - - - - - - - - - - - - - - - - - - - SegmentHeap - - - true - - - - - - - - - - - diff --git a/win-linux/extras/online-installer/res/version.rc b/win-linux/extras/online-installer/res/version.rc deleted file mode 100644 index c2b1fc4fe..000000000 --- a/win-linux/extras/online-installer/res/version.rc +++ /dev/null @@ -1,37 +0,0 @@ -#pragma code_page(65001) -#include -#include "../src/version.h" -#include "../src/resource.h" - -IDI_MAINICON ICON DISCARDABLE APP_ICON_PATH -IDI_WELCOME RCDATA "./icons/welcome.emf" -IDT_TRANSLATIONS RCDATA APP_LANG_PATH -CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "./manifest/online-installer.exe.manifest" - - -VS_VERSION_INFO VERSIONINFO -FILEVERSION VER_FILEVERSION -PRODUCTVERSION VER_PRODUCTVERSION -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK VER_LANG_AND_CHARSET_STR - BEGIN - VALUE "CompanyName", VER_COMPANYNAME_STR - VALUE "FileDescription", VER_FILEDESCRIPTION_STR - VALUE "FileVersion", VER_FILEVERSION_STR - VALUE "InternalName", VER_INTERNALNAME_STR - VALUE "LegalCopyright", VER_LEGALCOPYRIGHT_STR - VALUE "LegalTrademarks1", VER_LEGALTRADEMARKS1_STR - VALUE "LegalTrademarks2", VER_LEGALTRADEMARKS2_STR - VALUE "OriginalFilename", VER_ORIGINALFILENAME_STR - VALUE "ProductName", VER_PRODUCTNAME_STR - VALUE "ProductVersion", VER_PRODUCTVERSION_STR - END - END - - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", VER_LANG_ID, VER_CHARSET_ID - END -END diff --git a/win-linux/extras/online-installer/src/cdownloader.cpp b/win-linux/extras/online-installer/src/cdownloader.cpp deleted file mode 100644 index a86ff654d..000000000 --- a/win-linux/extras/online-installer/src/cdownloader.cpp +++ /dev/null @@ -1,279 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ - -#include "cdownloader.h" -#include -#include -#include - - -struct Connection { - ~Connection() { - if (hRequest) WinHttpCloseHandle(hRequest); - if (hConnect) WinHttpCloseHandle(hConnect); - if (hSession) WinHttpCloseHandle(hSession); - } - HINTERNET hSession = NULL, hConnect = NULL, hRequest = NULL; -}; - -static DWORD initConnection(const wstring &url, DWORD &dwFileSize, Connection &conn) -{ - URL_COMPONENTS urlComp; - ZeroMemory(&urlComp, sizeof(urlComp)); - urlComp.dwStructSize = sizeof(urlComp); - urlComp.dwHostNameLength = 1; - urlComp.dwUrlPathLength = 1; - if (!WinHttpCrackUrl(url.c_str(), (DWORD)url.length(), 0, &urlComp)) - return GetLastError(); - - wstring url_host(urlComp.lpszHostName, urlComp.dwHostNameLength); - wstring url_path(urlComp.lpszUrlPath, urlComp.dwUrlPathLength); - - conn.hSession = WinHttpOpen(L"WinHTTP Example/1.0", WINHTTP_ACCESS_TYPE_DEFAULT_PROXY, WINHTTP_NO_PROXY_NAME, WINHTTP_NO_PROXY_BYPASS, 0); - if (!conn.hSession) - return GetLastError(); - - DWORD dwEnabledProtocols = WINHTTP_FLAG_SECURE_PROTOCOL_TLS1 | WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_1 | WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_2; - WinHttpSetOption(conn.hSession, WINHTTP_OPTION_SECURE_PROTOCOLS, &dwEnabledProtocols, sizeof(DWORD)); - -#ifdef IGNORE_CERTIFICATE_REQUIREMENTS - DWORD dwSecurity = SECURITY_FLAG_IGNORE_UNKNOWN_CA | SECURITY_FLAG_IGNORE_CERT_CN_INVALID | SECURITY_FLAG_IGNORE_CERT_DATE_INVALID; - WinHttpSetOption(conn.hSession, WINHTTP_OPTION_SECURITY_FLAGS, &dwSecurity, sizeof(DWORD)); -#endif - - conn.hConnect = WinHttpConnect(conn.hSession, url_host.c_str(), INTERNET_DEFAULT_HTTPS_PORT, 0); - if (!conn.hConnect) - return GetLastError(); - - conn.hRequest = WinHttpOpenRequest(conn.hConnect, L"GET", url_path.c_str(), NULL, WINHTTP_NO_REFERER, WINHTTP_DEFAULT_ACCEPT_TYPES, WINHTTP_FLAG_SECURE); - if (!conn.hRequest) - return GetLastError(); - - if (!WinHttpSendRequest(conn.hRequest, WINHTTP_NO_ADDITIONAL_HEADERS, 0, WINHTTP_NO_REQUEST_DATA, 0, 0, 0)) - return GetLastError(); - - if (!WinHttpReceiveResponse(conn.hRequest, NULL)) - return GetLastError(); - - DWORD dwStatusCode = 0, dwSize = sizeof(DWORD); - if (!WinHttpQueryHeaders(conn.hRequest, WINHTTP_QUERY_STATUS_CODE | WINHTTP_QUERY_FLAG_NUMBER, NULL, &dwStatusCode, &dwSize, WINHTTP_NO_HEADER_INDEX)) - return GetLastError(); - - if (dwStatusCode >= HTTP_STATUS_BAD_REQUEST) - return ERROR_BAD_FORMAT; - - if (!WinHttpQueryHeaders(conn.hRequest, WINHTTP_QUERY_CONTENT_LENGTH | WINHTTP_QUERY_FLAG_NUMBER, NULL, &dwFileSize, &dwSize, WINHTTP_NO_HEADER_INDEX)) - dwFileSize = 0; - - return ERROR_SUCCESS; -} - -class CDownloaderPrivate -{ -public: - CDownloaderPrivate() - {} - ~CDownloaderPrivate() - {} - - DWORD downloadToFile() - { - DWORD dwSize = 0, dwProgress = 0, dwProgressMax = 0; - Connection conn; - DWORD result = initConnection(m_url, dwProgressMax, conn); - if (result != ERROR_SUCCESS) - return result; - - HANDLE hFile = CreateFile(m_filePath.c_str(), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - if (hFile == INVALID_HANDLE_VALUE) - return GetLastError(); - - int prev_percent = -1; - do { - if (!m_run) { - result = ERROR_CANCELLED; - break; - } - - dwSize = 0; - if (!WinHttpQueryDataAvailable(conn.hRequest, &dwSize)) { - result = GetLastError(); - break; - } - - LPSTR lpBuffer = new char[dwSize]; - if (!lpBuffer) { - result = ERROR_NOT_ENOUGH_MEMORY; - break; - } - - DWORD dwDownloaded = 0; - if (!WinHttpReadData(conn.hRequest, (LPVOID)lpBuffer, dwSize, &dwDownloaded)) { - result = GetLastError(); - delete[] lpBuffer; - break; - } - - DWORD dwBytesWritten = 0; - BOOL write_res = WriteFile(hFile, lpBuffer, dwDownloaded, &dwBytesWritten, NULL); - delete[] lpBuffer; - if (!write_res) { - result = GetLastError(); - break; - } - - if (dwBytesWritten != dwDownloaded) { - result = ERROR_OUTOFMEMORY; - break; - } - - if (dwProgressMax != 0 && m_progress_callback) { - dwProgress += dwDownloaded; - int percent = static_cast((100.0 * dwProgress) / dwProgressMax); - if (percent != prev_percent) { - m_progress_callback(percent); - prev_percent = percent; - } - } - - } while (dwSize > 0); - - CloseHandle(hFile); - if (result == ERROR_CANCELLED) - DeleteFile(m_filePath.c_str()); - return result; - } - FnVoidUlUl m_query_callback = nullptr; - FnVoidUl m_complete_callback = nullptr; - FnVoidInt m_progress_callback = nullptr; - wstring m_url, - m_filePath; - std::future m_future; - std::atomic_bool m_run, - m_lock; -}; - -CDownloader::CDownloader() : - pimpl(new CDownloaderPrivate) -{ - pimpl->m_run = true; - pimpl->m_lock = false; -} - -CDownloader::~CDownloader() -{ - pimpl->m_run = false; - if (pimpl->m_future.valid()) - pimpl->m_future.wait(); - delete pimpl, pimpl = nullptr; -} - -bool CDownloader::isUrlAccessible(const wstring &url) -{ - if (url.empty()) - return false; - - DWORD dwFileSize = 0; - Connection conn; - int hr = initConnection(url, dwFileSize, conn); - return hr == ERROR_SUCCESS; -} - -void CDownloader::queryContentLenght(const wstring &url) -{ - if (url.empty() || pimpl->m_lock) - return; - - pimpl->m_lock = true; - pimpl->m_future = std::async(std::launch::async, [=]() { - DWORD dwFileSize = 0; - Connection conn; - DWORD error = initConnection(url, dwFileSize, conn); - if (pimpl->m_query_callback) - pimpl->m_query_callback(error, dwFileSize); - pimpl->m_lock = false; - }); -} - -void CDownloader::downloadFile(const std::wstring &url, const std::wstring &filePath) -{ - pimpl->m_url.clear(); - pimpl->m_filePath.clear(); - if (url.empty() || filePath.empty() || pimpl->m_lock) - return; - - pimpl->m_url = url; - pimpl->m_filePath = filePath; - start(); -} - -void CDownloader::start() -{ - if (pimpl->m_url.empty() || pimpl->m_filePath.empty() || pimpl->m_lock) - return; - - pimpl->m_run = true; - pimpl->m_lock = true; - pimpl->m_future = std::async(std::launch::async, [=]() { - DWORD error = pimpl->downloadToFile(); - if (pimpl->m_complete_callback) - pimpl->m_complete_callback(error); - pimpl->m_lock = false; - }); -} - -void CDownloader::stop() -{ - pimpl->m_run = false; - if (pimpl->m_future.valid()) - pimpl->m_future.wait(); -} - -wstring CDownloader::GetFilePath() -{ - return pimpl->m_filePath; -} - -void CDownloader::onQueryResponse(FnVoidUlUl callback) -{ - pimpl->m_query_callback = callback; -} - -void CDownloader::onComplete(FnVoidUl callback) -{ - pimpl->m_complete_callback = callback; -} - -void CDownloader::onProgress(FnVoidInt callback) -{ - pimpl->m_progress_callback = callback; -} diff --git a/win-linux/extras/online-installer/src/cdownloader.h b/win-linux/extras/online-installer/src/cdownloader.h deleted file mode 100644 index adc8f3da7..000000000 --- a/win-linux/extras/online-installer/src/cdownloader.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ - -#ifndef CDOWNLOADER_H -#define CDOWNLOADER_H - -#include -#include - -typedef unsigned long ulong; -typedef std::function FnVoidInt; -typedef std::function FnVoidUl; -typedef std::function FnVoidUlUl; - -using std::wstring; - - -class CDownloaderPrivate; - -class CDownloader -{ -public: - CDownloader(); - ~CDownloader(); - - bool isUrlAccessible(const wstring &url); - void queryContentLenght(const wstring &url); - void downloadFile(const wstring &url, const wstring &filePath); - void start(); - void stop(); - wstring GetFilePath(); - - /* callback */ - void onQueryResponse(FnVoidUlUl callback); - void onComplete(FnVoidUl callback); - void onProgress(FnVoidInt callback); - -private: - CDownloaderPrivate *pimpl = nullptr; -}; - -#endif // CDOWNLOADER_H diff --git a/win-linux/extras/online-installer/src/cjson.cpp b/win-linux/extras/online-installer/src/cjson.cpp deleted file mode 100644 index aedcfbe12..000000000 --- a/win-linux/extras/online-installer/src/cjson.cpp +++ /dev/null @@ -1,185 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ - -#include "cjson.h" -#include "cjson_p.h" -#include - - -static std::string TStrToUtf8(const tstring &str) -{ -#ifdef _WIN32 - std::wstring_convert, wchar_t> utf8_conv; - return utf8_conv.to_bytes(str); -#else - return str; -#endif -} - -class JsonObjectPrivate -{ -public: - json_object_s *obj = nullptr; -}; - -class JsonValuePrivate -{ -public: - json_value_s *val = nullptr; -}; - -class JsonDocumentPrivate -{ -public: - json_value_s *root = nullptr; -}; - - -JsonValue::JsonValue() : pimpl(new JsonValuePrivate) -{} - -JsonValue::JsonValue(const JsonValue &jval) : JsonValue() -{ - pimpl->val = jval.pimpl->val; -} - -JsonValue::~JsonValue() -{ - delete pimpl, pimpl = nullptr; -} - -JsonValue& JsonValue::operator=(const JsonValue &jval) -{ - if (this == &jval) - return *this; - pimpl->val = jval.pimpl->val; - return *this; -} - -JsonObject JsonValue::toObject() -{ - JsonObject jobj; - if (pimpl->val && pimpl->val->type == json_type_object) - jobj.pimpl->obj = (json_object_s*)pimpl->val->payload; - return jobj; -} - -tstring JsonValue::toTString() -{ - tstring str; - if (pimpl->val && pimpl->val->type == json_type_string) { - json_string_s *jstr = (json_string_s*)pimpl->val->payload; -#ifdef _WIN32 - std::wstring_convert> converter; - str = converter.from_bytes(std::string(jstr->string, jstr->string_size)); -#else - str = std::string(jstr->string, jstr->string_size); -#endif - } - return str; -} - - -JsonObject::JsonObject() : pimpl(new JsonObjectPrivate) -{} - -JsonObject::JsonObject(const JsonObject &jobj) : JsonObject() -{ - pimpl->obj = jobj.pimpl->obj; -} - -JsonObject::~JsonObject() -{ - delete pimpl, pimpl = nullptr; -} - -JsonObject& JsonObject::operator=(const JsonObject &jobj) -{ - if (this == &jobj) - return *this; - pimpl->obj = jobj.pimpl->obj; - return *this; -} - -JsonValue JsonObject::value(const tstring &key) -{ - std::string utf8_key = TStrToUtf8(key); - JsonValue jval; - json_object_element_s *element; - if (pimpl->obj && (element = pimpl->obj->start) != NULL) { - do { - if (strcmp(element->name->string, utf8_key.c_str()) == 0) { - jval.pimpl->val = element->value; - break; - } - } while ((element = element->next) != NULL); - } - return jval; -} - -bool JsonObject::contains(const tstring &key) -{ - std::string utf8_key = TStrToUtf8(key); - json_object_element_s *element; - if (pimpl->obj && (element = pimpl->obj->start) != NULL) { - do { - if (strcmp(element->name->string, utf8_key.c_str()) == 0) - return true; - } while ((element = element->next) != NULL); - } - return false; -} - - -JsonDocument::JsonDocument() : pimpl(new JsonDocumentPrivate) -{} - -JsonDocument::JsonDocument(const tstring &json) : JsonDocument() -{ - std::string utf8_json = TStrToUtf8(json); - pimpl->root = json_parse(utf8_json.c_str(), utf8_json.length()); -} - -JsonDocument::~JsonDocument() -{ - if (pimpl->root) - free(pimpl->root); - delete pimpl, pimpl = nullptr; -} - -JsonObject JsonDocument::object() -{ - JsonObject obj; - if (pimpl->root && pimpl->root->type == json_type_object && pimpl->root->payload) - obj.pimpl->obj = (json_object_s*)pimpl->root->payload; - return obj; -} diff --git a/win-linux/extras/online-installer/src/cjson.h b/win-linux/extras/online-installer/src/cjson.h deleted file mode 100644 index 7c511c929..000000000 --- a/win-linux/extras/online-installer/src/cjson.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ - -#ifndef CJSON_H -#define CJSON_H - -#include -#ifdef _WIN32 -# include -# define tstring std::wstring -#else -# define _T(str) str -# define tstring std::string -#endif - -class JsonObject; -class JsonObjectPrivate; -class JsonValuePrivate; -class JsonDocumentPrivate; - -class JsonValue -{ -public: - JsonValue(); - JsonValue(const JsonValue&); - ~JsonValue(); - - JsonValue& operator=(const JsonValue&); - JsonObject toObject(); - tstring toTString(); - -private: - friend class JsonObject; - JsonValuePrivate *pimpl; -}; - -class JsonObject -{ -public: - JsonObject(); - JsonObject(const JsonObject&); - ~JsonObject(); - - JsonObject& operator=(const JsonObject&); - JsonValue value(const tstring&); - bool contains(const tstring&); - -private: - friend class JsonDocument; - friend class JsonValue; - JsonObjectPrivate *pimpl; -}; - -class JsonDocument -{ -public: - JsonDocument(const tstring&); - ~JsonDocument(); - - JsonObject object(); - -private: - JsonDocument(); - JsonDocumentPrivate *pimpl; -}; - -#endif // CJSON_H diff --git a/win-linux/extras/online-installer/src/cjson_p.h b/win-linux/extras/online-installer/src/cjson_p.h deleted file mode 100644 index 0419c6b60..000000000 --- a/win-linux/extras/online-installer/src/cjson_p.h +++ /dev/null @@ -1,3431 +0,0 @@ - -#ifndef SHEREDOM_JSON_H_INCLUDED -#define SHEREDOM_JSON_H_INCLUDED - -#if defined(_MSC_VER) -#pragma warning(push) - -/* disable warning: no function prototype given: converting '()' to '(void)' */ -#pragma warning(disable : 4255) - -/* disable warning: '__cplusplus' is not defined as a preprocessor macro, - * replacing with '0' for '#if/#elif' */ -#pragma warning(disable : 4668) - -/* disable warning: 'bytes padding added after construct' */ -#pragma warning(disable : 4820) -#endif - -#include -#include - -#if defined(__TINYC__) -#define JSON_ATTRIBUTE(a) __attribute((a)) -#else -#define JSON_ATTRIBUTE(a) __attribute__((a)) -#endif - -#if defined(_MSC_VER) || defined(__WATCOMC__) -#define json_weak __inline -#elif defined(__clang__) || defined(__GNUC__) || defined(__TINYC__) -#define json_weak JSON_ATTRIBUTE(weak) -#else -#error Non clang, non gcc, non MSVC, non tcc, non WATCOM compiler found! -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -struct json_value_s; -struct json_parse_result_s; - -enum json_parse_flags_e { - json_parse_flags_default = 0, - - /* allow trailing commas in objects and arrays. For example, both [true,] and - {"a" : null,} would be allowed with this option on. */ - json_parse_flags_allow_trailing_comma = 0x1, - - /* allow unquoted keys for objects. For example, {a : null} would be allowed - with this option on. */ - json_parse_flags_allow_unquoted_keys = 0x2, - - /* allow a global unbracketed object. For example, a : null, b : true, c : {} - would be allowed with this option on. */ - json_parse_flags_allow_global_object = 0x4, - - /* allow objects to use '=' instead of ':' between key/value pairs. For - example, a = null, b : true would be allowed with this option on. */ - json_parse_flags_allow_equals_in_object = 0x8, - - /* allow that objects don't have to have comma separators between key/value - pairs. */ - json_parse_flags_allow_no_commas = 0x10, - - /* allow c-style comments (either variants) to be ignored in the input JSON - file. */ - json_parse_flags_allow_c_style_comments = 0x20, - - /* deprecated flag, unused. */ - json_parse_flags_deprecated = 0x40, - - /* record location information for each value. */ - json_parse_flags_allow_location_information = 0x80, - - /* allow strings to be 'single quoted'. */ - json_parse_flags_allow_single_quoted_strings = 0x100, - - /* allow numbers to be hexadecimal. */ - json_parse_flags_allow_hexadecimal_numbers = 0x200, - - /* allow numbers like +123 to be parsed. */ - json_parse_flags_allow_leading_plus_sign = 0x400, - - /* allow numbers like .0123 or 123. to be parsed. */ - json_parse_flags_allow_leading_or_trailing_decimal_point = 0x800, - - /* allow Infinity, -Infinity, NaN, -NaN. */ - json_parse_flags_allow_inf_and_nan = 0x1000, - - /* allow multi line string values. */ - json_parse_flags_allow_multi_line_strings = 0x2000, - - /* allow simplified JSON to be parsed. Simplified JSON is an enabling of a set - of other parsing options. */ - json_parse_flags_allow_simplified_json = - (json_parse_flags_allow_trailing_comma | - json_parse_flags_allow_unquoted_keys | - json_parse_flags_allow_global_object | - json_parse_flags_allow_equals_in_object | - json_parse_flags_allow_no_commas), - - /* allow JSON5 to be parsed. JSON5 is an enabling of a set of other parsing - options. */ - json_parse_flags_allow_json5 = - (json_parse_flags_allow_trailing_comma | - json_parse_flags_allow_unquoted_keys | - json_parse_flags_allow_c_style_comments | - json_parse_flags_allow_single_quoted_strings | - json_parse_flags_allow_hexadecimal_numbers | - json_parse_flags_allow_leading_plus_sign | - json_parse_flags_allow_leading_or_trailing_decimal_point | - json_parse_flags_allow_inf_and_nan | - json_parse_flags_allow_multi_line_strings) -}; - -/* Parse a JSON text file, returning a pointer to the root of the JSON - * structure. json_parse performs 1 call to malloc for the entire encoding. - * Returns 0 if an error occurred (malformed JSON input, or malloc failed). */ -json_weak struct json_value_s *json_parse(const void *src, size_t src_size); - -/* Parse a JSON text file, returning a pointer to the root of the JSON - * structure. json_parse performs 1 call to alloc_func_ptr for the entire - * encoding. Returns 0 if an error occurred (malformed JSON input, or malloc - * failed). If an error occurred, the result struct (if not NULL) will explain - * the type of error, and the location in the input it occurred. If - * alloc_func_ptr is null then malloc is used. */ -json_weak struct json_value_s * -json_parse_ex(const void *src, size_t src_size, size_t flags_bitset, - void *(*alloc_func_ptr)(void *, size_t), void *user_data, - struct json_parse_result_s *result); - -/* Extracts a value and all the data that makes it up into a newly created - * value. json_extract_value performs 1 call to malloc for the entire encoding. - */ -json_weak struct json_value_s * -json_extract_value(const struct json_value_s *value); - -/* Extracts a value and all the data that makes it up into a newly created - * value. json_extract_value performs 1 call to alloc_func_ptr for the entire - * encoding. If alloc_func_ptr is null then malloc is used. */ -json_weak struct json_value_s * -json_extract_value_ex(const struct json_value_s *value, - void *(*alloc_func_ptr)(void *, size_t), void *user_data); - -/* Write out a minified JSON utf-8 string. This string is an encoding of the - * minimal string characters required to still encode the same data. - * json_write_minified performs 1 call to malloc for the entire encoding. Return - * 0 if an error occurred (malformed JSON input, or malloc failed). The out_size - * parameter is optional as the utf-8 string is null terminated. */ -json_weak void *json_write_minified(const struct json_value_s *value, - size_t *out_size); - -/* Write out a pretty JSON utf-8 string. This string is encoded such that the - * resultant JSON is pretty in that it is easily human readable. The indent and - * newline parameters allow a user to specify what kind of indentation and - * newline they want (two spaces / three spaces / tabs? \r, \n, \r\n ?). Both - * indent and newline can be NULL, indent defaults to two spaces (" "), and - * newline defaults to linux newlines ('\n' as the newline character). - * json_write_pretty performs 1 call to malloc for the entire encoding. Return 0 - * if an error occurred (malformed JSON input, or malloc failed). The out_size - * parameter is optional as the utf-8 string is null terminated. */ -json_weak void *json_write_pretty(const struct json_value_s *value, - const char *indent, const char *newline, - size_t *out_size); - -/* Reinterpret a JSON value as a string. Returns null is the value was not a - * string. */ -json_weak struct json_string_s * -json_value_as_string(struct json_value_s *const value); - -/* Reinterpret a JSON value as a number. Returns null is the value was not a - * number. */ -json_weak struct json_number_s * -json_value_as_number(struct json_value_s *const value); - -/* Reinterpret a JSON value as an object. Returns null is the value was not an - * object. */ -json_weak struct json_object_s * -json_value_as_object(struct json_value_s *const value); - -/* Reinterpret a JSON value as an array. Returns null is the value was not an - * array. */ -json_weak struct json_array_s * -json_value_as_array(struct json_value_s *const value); - -/* Whether the value is true. */ -json_weak int json_value_is_true(const struct json_value_s *const value); - -/* Whether the value is false. */ -json_weak int json_value_is_false(const struct json_value_s *const value); - -/* Whether the value is null. */ -json_weak int json_value_is_null(const struct json_value_s *const value); - -/* The various types JSON values can be. Used to identify what a value is. */ -typedef enum json_type_e { - json_type_string, - json_type_number, - json_type_object, - json_type_array, - json_type_true, - json_type_false, - json_type_null - -} json_type_t; - -/* A JSON string value. */ -typedef struct json_string_s { - /* utf-8 string */ - const char *string; - /* The size (in bytes) of the string */ - size_t string_size; - -} json_string_t; - -/* A JSON string value (extended). */ -typedef struct json_string_ex_s { - /* The JSON string this extends. */ - struct json_string_s string; - - /* The character offset for the value in the JSON input. */ - size_t offset; - - /* The line number for the value in the JSON input. */ - size_t line_no; - - /* The row number for the value in the JSON input, in bytes. */ - size_t row_no; - -} json_string_ex_t; - -/* A JSON number value. */ -typedef struct json_number_s { - /* ASCII string containing representation of the number. */ - const char *number; - /* the size (in bytes) of the number. */ - size_t number_size; - -} json_number_t; - -/* an element of a JSON object. */ -typedef struct json_object_element_s { - /* the name of this element. */ - struct json_string_s *name; - /* the value of this element. */ - struct json_value_s *value; - /* the next object element (can be NULL if the last element in the object). */ - struct json_object_element_s *next; - -} json_object_element_t; - -/* a JSON object value. */ -typedef struct json_object_s { - /* a linked list of the elements in the object. */ - struct json_object_element_s *start; - /* the number of elements in the object. */ - size_t length; - -} json_object_t; - -/* an element of a JSON array. */ -typedef struct json_array_element_s { - /* the value of this element. */ - struct json_value_s *value; - /* the next array element (can be NULL if the last element in the array). */ - struct json_array_element_s *next; - -} json_array_element_t; - -/* a JSON array value. */ -typedef struct json_array_s { - /* a linked list of the elements in the array. */ - struct json_array_element_s *start; - /* the number of elements in the array. */ - size_t length; - -} json_array_t; - -/* a JSON value. */ -typedef struct json_value_s { - /* a pointer to either a json_string_s, json_number_s, json_object_s, or. */ - /* json_array_s. Should be cast to the appropriate struct type based on what. - */ - /* the type of this value is. */ - void *payload; - /* must be one of json_type_e. If type is json_type_true, json_type_false, or. - */ - /* json_type_null, payload will be NULL. */ - size_t type; - -} json_value_t; - -/* a JSON value (extended). */ -typedef struct json_value_ex_s { - /* the JSON value this extends. */ - struct json_value_s value; - - /* the character offset for the value in the JSON input. */ - size_t offset; - - /* the line number for the value in the JSON input. */ - size_t line_no; - - /* the row number for the value in the JSON input, in bytes. */ - size_t row_no; - -} json_value_ex_t; - -/* a parsing error code. */ -enum json_parse_error_e { - /* no error occurred (huzzah!). */ - json_parse_error_none = 0, - - /* expected either a comma or a closing '}' or ']' to close an object or. */ - /* array! */ - json_parse_error_expected_comma_or_closing_bracket, - - /* colon separating name/value pair was missing! */ - json_parse_error_expected_colon, - - /* expected string to begin with '"'! */ - json_parse_error_expected_opening_quote, - - /* invalid escaped sequence in string! */ - json_parse_error_invalid_string_escape_sequence, - - /* invalid number format! */ - json_parse_error_invalid_number_format, - - /* invalid value! */ - json_parse_error_invalid_value, - - /* reached end of buffer before object/array was complete! */ - json_parse_error_premature_end_of_buffer, - - /* string was malformed! */ - json_parse_error_invalid_string, - - /* a call to malloc, or a user provider allocator, failed. */ - json_parse_error_allocator_failed, - - /* the JSON input had unexpected trailing characters that weren't part of the. - JSON value. */ - json_parse_error_unexpected_trailing_characters, - - /* catch-all error for everything else that exploded (real bad chi!). */ - json_parse_error_unknown -}; - -/* error report from json_parse_ex(). */ -typedef struct json_parse_result_s { - /* the error code (one of json_parse_error_e). */ - size_t error; - - /* the character offset for the error in the JSON input. */ - size_t error_offset; - - /* the line number for the error in the JSON input. */ - size_t error_line_no; - - /* the row number for the error, in bytes. */ - size_t error_row_no; - -} json_parse_result_t; - -#ifdef __cplusplus -} /* extern "C". */ -#endif - -#include - -#if defined(_MSC_VER) -#pragma warning(pop) -#endif - -#if defined(_MSC_VER) && (_MSC_VER < 1920) -#define json_uintmax_t unsigned __int64 -#else -#include -#define json_uintmax_t uintmax_t -#endif - -#if defined(_MSC_VER) -#define json_strtoumax _strtoui64 -#else -#define json_strtoumax strtoumax -#endif - -#if defined(__cplusplus) && (__cplusplus >= 201103L) -#define json_null nullptr -#else -#define json_null 0 -#endif - -#if defined(__clang__) -#pragma clang diagnostic push - -/* we do one big allocation via malloc, then cast aligned slices of this for. */ -/* our structures - we don't have a way to tell the compiler we know what we. */ -/* are doing, so disable the warning instead! */ -#pragma clang diagnostic ignored "-Wcast-align" - -/* We use C style casts everywhere. */ -#pragma clang diagnostic ignored "-Wold-style-cast" - -/* We need long long for strtoull. */ -#pragma clang diagnostic ignored "-Wc++11-long-long" - -/* Who cares if nullptr doesn't work with C++98, we don't use it there! */ -#pragma clang diagnostic ignored "-Wc++98-compat" -#pragma clang diagnostic ignored "-Wc++98-compat-pedantic" - -#if __has_warning("-Wunsafe-buffer-usage") -#pragma clang diagnostic ignored "-Wunsafe-buffer-usage" -#endif - -#elif defined(_MSC_VER) -#pragma warning(push) - -/* disable 'function selected for inline expansion' warning. */ -#pragma warning(disable : 4711) - -/* disable '#pragma warning: there is no warning number' warning. */ -#pragma warning(disable : 4619) - -/* disable 'warning number not a valid compiler warning' warning. */ -#pragma warning(disable : 4616) - -/* disable 'Compiler will insert Spectre mitigation for memory load if - * /Qspectre. */ -/* switch specified' warning. */ -#pragma warning(disable : 5045) -#endif - -struct json_parse_state_s { - const char *src; - size_t size; - size_t offset; - size_t flags_bitset; - char *data; - char *dom; - size_t dom_size; - size_t data_size; - size_t line_no; /* line counter for error reporting. */ - size_t line_offset; /* (offset-line_offset) is the character number (in - bytes). */ - size_t error; -}; - -json_weak int json_hexadecimal_digit(const char c); -int json_hexadecimal_digit(const char c) { - if ('0' <= c && c <= '9') { - return c - '0'; - } - if ('a' <= c && c <= 'f') { - return c - 'a' + 10; - } - if ('A' <= c && c <= 'F') { - return c - 'A' + 10; - } - return -1; -} - -json_weak int json_hexadecimal_value(const char *c, const unsigned long size, - unsigned long *result); -int json_hexadecimal_value(const char *c, const unsigned long size, - unsigned long *result) { - const char *p; - int digit; - - if (size > sizeof(unsigned long) * 2) { - return 0; - } - - *result = 0; - for (p = c; (unsigned long)(p - c) < size; ++p) { - *result <<= 4; - digit = json_hexadecimal_digit(*p); - if (digit < 0 || digit > 15) { - return 0; - } - *result |= (unsigned char)digit; - } - return 1; -} - -json_weak int json_skip_whitespace(struct json_parse_state_s *state); -int json_skip_whitespace(struct json_parse_state_s *state) { - size_t offset = state->offset; - const size_t size = state->size; - const char *const src = state->src; - - if (offset >= state->size) { - return 0; - } - - /* the only valid whitespace according to ECMA-404 is ' ', '\n', '\r' and - * '\t'. */ - switch (src[offset]) { - default: - return 0; - case ' ': - case '\r': - case '\t': - case '\n': - break; - } - - do { - switch (src[offset]) { - default: - /* Update offset. */ - state->offset = offset; - return 1; - case ' ': - case '\r': - case '\t': - break; - case '\n': - state->line_no++; - state->line_offset = offset; - break; - } - - offset++; - } while (offset < size); - - /* Update offset. */ - state->offset = offset; - return 1; -} - -json_weak int json_skip_c_style_comments(struct json_parse_state_s *state); -int json_skip_c_style_comments(struct json_parse_state_s *state) { - /* to have a C-style comment we need at least 2 characters of space */ - if ((state->offset + 2) > state->size) { - return 0; - } - - /* do we have a comment? */ - if ('/' == state->src[state->offset]) { - if ('/' == state->src[state->offset + 1]) { - /* we had a comment of the form // */ - - /* skip first '/' */ - state->offset++; - - /* skip second '/' */ - state->offset++; - - while (state->offset < state->size) { - switch (state->src[state->offset]) { - default: - /* skip the character in the comment */ - state->offset++; - break; - case '\n': - /* if we have a newline, our comment has ended! Skip the newline */ - state->offset++; - - /* we entered a newline, so move our line info forward */ - state->line_no++; - state->line_offset = state->offset; - return 1; - } - } - - /* we reached the end of the JSON file! */ - return 1; - } else if ('*' == state->src[state->offset + 1]) { - /* we had a comment in the C-style long form */ - - /* skip '/' */ - state->offset++; - - /* skip '*' */ - state->offset++; - - while (state->offset + 1 < state->size) { - if (('*' == state->src[state->offset]) && - ('/' == state->src[state->offset + 1])) { - /* we reached the end of our comment! */ - state->offset += 2; - return 1; - } else if ('\n' == state->src[state->offset]) { - /* we entered a newline, so move our line info forward */ - state->line_no++; - state->line_offset = state->offset; - } - - /* skip character within comment */ - state->offset++; - } - - /* comment wasn't ended correctly which is a failure */ - return 1; - } - } - - /* we didn't have any comment, which is ok too! */ - return 0; -} - -json_weak int json_skip_all_skippables(struct json_parse_state_s *state); -int json_skip_all_skippables(struct json_parse_state_s *state) { - /* skip all whitespace and other skippables until there are none left. note - * that the previous version suffered from read past errors should. the - * stream end on json_skip_c_style_comments eg. '{"a" ' with comments flag. - */ - - int did_consume = 0; - const size_t size = state->size; - - if (json_parse_flags_allow_c_style_comments & state->flags_bitset) { - do { - if (state->offset == size) { - state->error = json_parse_error_premature_end_of_buffer; - return 1; - } - - did_consume = json_skip_whitespace(state); - - /* This should really be checked on access, not in front of every call. - */ - if (state->offset >= size) { - state->error = json_parse_error_premature_end_of_buffer; - return 1; - } - - did_consume |= json_skip_c_style_comments(state); - } while (0 != did_consume); - } else { - do { - if (state->offset == size) { - state->error = json_parse_error_premature_end_of_buffer; - return 1; - } - - did_consume = json_skip_whitespace(state); - } while (0 != did_consume); - } - - if (state->offset == size) { - state->error = json_parse_error_premature_end_of_buffer; - return 1; - } - - return 0; -} - -json_weak int json_get_value_size(struct json_parse_state_s *state, - int is_global_object); - -json_weak int json_get_string_size(struct json_parse_state_s *state, - size_t is_key); -int json_get_string_size(struct json_parse_state_s *state, size_t is_key) { - size_t offset = state->offset; - const size_t size = state->size; - size_t data_size = 0; - const char *const src = state->src; - const int is_single_quote = '\'' == src[offset]; - const char quote_to_use = is_single_quote ? '\'' : '"'; - const size_t flags_bitset = state->flags_bitset; - unsigned long codepoint; - unsigned long high_surrogate = 0; - - if ((json_parse_flags_allow_location_information & flags_bitset) != 0 && - is_key != 0) { - state->dom_size += sizeof(struct json_string_ex_s); - } else { - state->dom_size += sizeof(struct json_string_s); - } - - if ('"' != src[offset]) { - /* if we are allowed single quoted strings check for that too. */ - if (!((json_parse_flags_allow_single_quoted_strings & flags_bitset) && - is_single_quote)) { - state->error = json_parse_error_expected_opening_quote; - state->offset = offset; - return 1; - } - } - - /* skip leading '"' or '\''. */ - offset++; - - while ((offset < size) && (quote_to_use != src[offset])) { - /* add space for the character. */ - data_size++; - - switch (src[offset]) { - default: - break; - case '\0': - case '\t': - state->error = json_parse_error_invalid_string; - state->offset = offset; - return 1; - } - - if ('\\' == src[offset]) { - /* skip reverse solidus character. */ - offset++; - - if (offset == size) { - state->error = json_parse_error_premature_end_of_buffer; - state->offset = offset; - return 1; - } - - switch (src[offset]) { - default: - state->error = json_parse_error_invalid_string_escape_sequence; - state->offset = offset; - return 1; - case '"': - case '\\': - case '/': - case 'b': - case 'f': - case 'n': - case 'r': - case 't': - /* all valid characters! */ - offset++; - break; - case 'u': - if (!(offset + 5 < size)) { - /* invalid escaped unicode sequence! */ - state->error = json_parse_error_invalid_string_escape_sequence; - state->offset = offset; - return 1; - } - - codepoint = 0; - if (!json_hexadecimal_value(&src[offset + 1], 4, &codepoint)) { - /* escaped unicode sequences must contain 4 hexadecimal digits! */ - state->error = json_parse_error_invalid_string_escape_sequence; - state->offset = offset; - return 1; - } - - /* Valid sequence! - * see: https://en.wikipedia.org/wiki/UTF-8#Invalid_code_points. - * 1 7 U + 0000 U + 007F 0xxxxxxx. - * 2 11 U + 0080 U + 07FF 110xxxxx - * 10xxxxxx. - * 3 16 U + 0800 U + FFFF 1110xxxx - * 10xxxxxx 10xxxxxx. - * 4 21 U + 10000 U + 10FFFF 11110xxx - * 10xxxxxx 10xxxxxx 10xxxxxx. - * Note: the high and low surrogate halves used by UTF-16 (U+D800 - * through U+DFFF) and code points not encodable by UTF-16 (those after - * U+10FFFF) are not legal Unicode values, and their UTF-8 encoding must - * be treated as an invalid byte sequence. */ - - if (high_surrogate != 0) { - /* we previously read the high half of the \uxxxx\uxxxx pair, so now - * we expect the low half. */ - if (codepoint >= 0xdc00 && - codepoint <= 0xdfff) { /* low surrogate range. */ - data_size += 3; - high_surrogate = 0; - } else { - state->error = json_parse_error_invalid_string_escape_sequence; - state->offset = offset; - return 1; - } - } else if (codepoint <= 0x7f) { - data_size += 0; - } else if (codepoint <= 0x7ff) { - data_size += 1; - } else if (codepoint >= 0xd800 && - codepoint <= 0xdbff) { /* high surrogate range. */ - /* The codepoint is the first half of a "utf-16 surrogate pair". so we - * need the other half for it to be valid: \uHHHH\uLLLL. */ - if (offset + 11 > size || '\\' != src[offset + 5] || - 'u' != src[offset + 6]) { - state->error = json_parse_error_invalid_string_escape_sequence; - state->offset = offset; - return 1; - } - high_surrogate = codepoint; - } else if (codepoint >= 0xd800 && - codepoint <= 0xdfff) { /* low surrogate range. */ - /* we did not read the other half before. */ - state->error = json_parse_error_invalid_string_escape_sequence; - state->offset = offset; - return 1; - } else { - data_size += 2; - } - /* escaped codepoints after 0xffff are supported in json through utf-16 - * surrogate pairs: \uD83D\uDD25 for U+1F525. */ - - offset += 5; - break; - } - } else if (('\r' == src[offset]) || ('\n' == src[offset])) { - if (!(json_parse_flags_allow_multi_line_strings & flags_bitset)) { - /* invalid escaped unicode sequence! */ - state->error = json_parse_error_invalid_string_escape_sequence; - state->offset = offset; - return 1; - } - - offset++; - } else { - /* skip character (valid part of sequence). */ - offset++; - } - } - - /* If the offset is equal to the size, we had a non-terminated string! */ - if (offset == size) { - state->error = json_parse_error_premature_end_of_buffer; - state->offset = offset - 1; - return 1; - } - - /* skip trailing '"' or '\''. */ - offset++; - - /* add enough space to store the string. */ - state->data_size += data_size; - - /* one more byte for null terminator ending the string! */ - state->data_size++; - - /* update offset. */ - state->offset = offset; - - return 0; -} - -json_weak int is_valid_unquoted_key_char(const char c); -int is_valid_unquoted_key_char(const char c) { - return (('0' <= c && c <= '9') || ('a' <= c && c <= 'z') || - ('A' <= c && c <= 'Z') || ('_' == c)); -} - -json_weak int json_get_key_size(struct json_parse_state_s *state); -int json_get_key_size(struct json_parse_state_s *state) { - const size_t flags_bitset = state->flags_bitset; - - if (json_parse_flags_allow_unquoted_keys & flags_bitset) { - size_t offset = state->offset; - const size_t size = state->size; - const char *const src = state->src; - size_t data_size = state->data_size; - - /* if we are allowing unquoted keys, first grok for a quote... */ - if ('"' == src[offset]) { - /* ... if we got a comma, just parse the key as a string as normal. */ - return json_get_string_size(state, 1); - } else if ((json_parse_flags_allow_single_quoted_strings & flags_bitset) && - ('\'' == src[offset])) { - /* ... if we got a comma, just parse the key as a string as normal. */ - return json_get_string_size(state, 1); - } else { - while ((offset < size) && is_valid_unquoted_key_char(src[offset])) { - offset++; - data_size++; - } - - /* one more byte for null terminator ending the string! */ - data_size++; - - if (json_parse_flags_allow_location_information & flags_bitset) { - state->dom_size += sizeof(struct json_string_ex_s); - } else { - state->dom_size += sizeof(struct json_string_s); - } - - /* update offset. */ - state->offset = offset; - - /* update data_size. */ - state->data_size = data_size; - - return 0; - } - } else { - /* we are only allowed to have quoted keys, so just parse a string! */ - return json_get_string_size(state, 1); - } -} - -json_weak int json_get_object_size(struct json_parse_state_s *state, - int is_global_object); -int json_get_object_size(struct json_parse_state_s *state, - int is_global_object) { - const size_t flags_bitset = state->flags_bitset; - const char *const src = state->src; - const size_t size = state->size; - size_t elements = 0; - int allow_comma = 0; - int found_closing_brace = 0; - - if (is_global_object) { - /* if we found an opening '{' of an object, we actually have a normal JSON - * object at the root of the DOM... */ - if (!json_skip_all_skippables(state) && '{' == state->src[state->offset]) { - /* . and we don't actually have a global object after all! */ - is_global_object = 0; - } - } - - if (!is_global_object) { - if ('{' != src[state->offset]) { - state->error = json_parse_error_unknown; - return 1; - } - - /* skip leading '{'. */ - state->offset++; - } - - state->dom_size += sizeof(struct json_object_s); - - if ((state->offset == size) && !is_global_object) { - state->error = json_parse_error_premature_end_of_buffer; - return 1; - } - - do { - if (!is_global_object) { - if (json_skip_all_skippables(state)) { - state->error = json_parse_error_premature_end_of_buffer; - return 1; - } - - if ('}' == src[state->offset]) { - /* skip trailing '}'. */ - state->offset++; - - found_closing_brace = 1; - - /* finished the object! */ - break; - } - } else { - /* we don't require brackets, so that means the object ends when the input - * stream ends! */ - if (json_skip_all_skippables(state)) { - break; - } - } - - /* if we parsed at least one element previously, grok for a comma. */ - if (allow_comma) { - if (',' == src[state->offset]) { - /* skip comma. */ - state->offset++; - allow_comma = 0; - } else if (json_parse_flags_allow_no_commas & flags_bitset) { - /* we don't require a comma, and we didn't find one, which is ok! */ - allow_comma = 0; - } else { - /* otherwise we are required to have a comma, and we found none. */ - state->error = json_parse_error_expected_comma_or_closing_bracket; - return 1; - } - - if (json_parse_flags_allow_trailing_comma & flags_bitset) { - continue; - } else { - if (json_skip_all_skippables(state)) { - state->error = json_parse_error_premature_end_of_buffer; - return 1; - } - } - } - - if (json_get_key_size(state)) { - /* key parsing failed! */ - state->error = json_parse_error_invalid_string; - return 1; - } - - if (json_skip_all_skippables(state)) { - state->error = json_parse_error_premature_end_of_buffer; - return 1; - } - - if (json_parse_flags_allow_equals_in_object & flags_bitset) { - const char current = src[state->offset]; - if ((':' != current) && ('=' != current)) { - state->error = json_parse_error_expected_colon; - return 1; - } - } else { - if (':' != src[state->offset]) { - state->error = json_parse_error_expected_colon; - return 1; - } - } - - /* skip colon. */ - state->offset++; - - if (json_skip_all_skippables(state)) { - state->error = json_parse_error_premature_end_of_buffer; - return 1; - } - - if (json_get_value_size(state, /* is_global_object = */ 0)) { - /* value parsing failed! */ - return 1; - } - - /* successfully parsed a name/value pair! */ - elements++; - allow_comma = 1; - } while (state->offset < size); - - if ((state->offset == size) && !is_global_object && !found_closing_brace) { - state->error = json_parse_error_premature_end_of_buffer; - return 1; - } - - state->dom_size += sizeof(struct json_object_element_s) * elements; - - return 0; -} - -json_weak int json_get_array_size(struct json_parse_state_s *state); -int json_get_array_size(struct json_parse_state_s *state) { - const size_t flags_bitset = state->flags_bitset; - size_t elements = 0; - int allow_comma = 0; - const char *const src = state->src; - const size_t size = state->size; - - if ('[' != src[state->offset]) { - /* expected array to begin with leading '['. */ - state->error = json_parse_error_unknown; - return 1; - } - - /* skip leading '['. */ - state->offset++; - - state->dom_size += sizeof(struct json_array_s); - - while (state->offset < size) { - if (json_skip_all_skippables(state)) { - state->error = json_parse_error_premature_end_of_buffer; - return 1; - } - - if (']' == src[state->offset]) { - /* skip trailing ']'. */ - state->offset++; - - state->dom_size += sizeof(struct json_array_element_s) * elements; - - /* finished the object! */ - return 0; - } - - /* if we parsed at least once element previously, grok for a comma. */ - if (allow_comma) { - if (',' == src[state->offset]) { - /* skip comma. */ - state->offset++; - allow_comma = 0; - } else if (!(json_parse_flags_allow_no_commas & flags_bitset)) { - state->error = json_parse_error_expected_comma_or_closing_bracket; - return 1; - } - - if (json_parse_flags_allow_trailing_comma & flags_bitset) { - allow_comma = 0; - continue; - } else { - if (json_skip_all_skippables(state)) { - state->error = json_parse_error_premature_end_of_buffer; - return 1; - } - } - } - - if (json_get_value_size(state, /* is_global_object = */ 0)) { - /* value parsing failed! */ - return 1; - } - - /* successfully parsed an array element! */ - elements++; - allow_comma = 1; - } - - /* we consumed the entire input before finding the closing ']' of the array! - */ - state->error = json_parse_error_premature_end_of_buffer; - return 1; -} - -json_weak int json_get_number_size(struct json_parse_state_s *state); -int json_get_number_size(struct json_parse_state_s *state) { - const size_t flags_bitset = state->flags_bitset; - size_t offset = state->offset; - const size_t size = state->size; - int had_leading_digits = 0; - const char *const src = state->src; - - state->dom_size += sizeof(struct json_number_s); - - if ((json_parse_flags_allow_hexadecimal_numbers & flags_bitset) && - (offset + 1 < size) && ('0' == src[offset]) && - (('x' == src[offset + 1]) || ('X' == src[offset + 1]))) { - /* skip the leading 0x that identifies a hexadecimal number. */ - offset += 2; - - /* consume hexadecimal digits. */ - while ((offset < size) && (('0' <= src[offset] && src[offset] <= '9') || - ('a' <= src[offset] && src[offset] <= 'f') || - ('A' <= src[offset] && src[offset] <= 'F'))) { - offset++; - } - } else { - int found_sign = 0; - int inf_or_nan = 0; - - if ((offset < size) && - (('-' == src[offset]) || - ((json_parse_flags_allow_leading_plus_sign & flags_bitset) && - ('+' == src[offset])))) { - /* skip valid leading '-' or '+'. */ - offset++; - - found_sign = 1; - } - - if (json_parse_flags_allow_inf_and_nan & flags_bitset) { - const char inf[9] = "Infinity"; - const size_t inf_strlen = sizeof(inf) - 1; - const char nan[4] = "NaN"; - const size_t nan_strlen = sizeof(nan) - 1; - - if (offset + inf_strlen < size) { - int found = 1; - size_t i; - for (i = 0; i < inf_strlen; i++) { - if (inf[i] != src[offset + i]) { - found = 0; - break; - } - } - - if (found) { - /* We found our special 'Infinity' keyword! */ - offset += inf_strlen; - - inf_or_nan = 1; - } - } - - if (offset + nan_strlen < size) { - int found = 1; - size_t i; - for (i = 0; i < nan_strlen; i++) { - if (nan[i] != src[offset + i]) { - found = 0; - break; - } - } - - if (found) { - /* We found our special 'NaN' keyword! */ - offset += nan_strlen; - - inf_or_nan = 1; - } - } - - if (inf_or_nan) { - if (offset < size) { - switch (src[offset]) { - default: - break; - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'e': - case 'E': - /* cannot follow an inf or nan with digits! */ - state->error = json_parse_error_invalid_number_format; - state->offset = offset; - return 1; - } - } - } - } - - if (found_sign && !inf_or_nan && (offset < size) && - !('0' <= src[offset] && src[offset] <= '9')) { - /* check if we are allowing leading '.'. */ - if (!(json_parse_flags_allow_leading_or_trailing_decimal_point & - flags_bitset) || - ('.' != src[offset])) { - /* a leading '-' must be immediately followed by any digit! */ - state->error = json_parse_error_invalid_number_format; - state->offset = offset; - return 1; - } - } - - if ((offset < size) && ('0' == src[offset])) { - /* skip valid '0'. */ - offset++; - - /* we need to record whether we had any leading digits for checks later. - */ - had_leading_digits = 1; - - if ((offset < size) && ('0' <= src[offset] && src[offset] <= '9')) { - /* a leading '0' must not be immediately followed by any digit! */ - state->error = json_parse_error_invalid_number_format; - state->offset = offset; - return 1; - } - } - - /* the main digits of our number next. */ - while ((offset < size) && ('0' <= src[offset] && src[offset] <= '9')) { - offset++; - - /* we need to record whether we had any leading digits for checks later. - */ - had_leading_digits = 1; - } - - if ((offset < size) && ('.' == src[offset])) { - offset++; - - if ((offset >= size) || !('0' <= src[offset] && src[offset] <= '9')) { - if (!(json_parse_flags_allow_leading_or_trailing_decimal_point & - flags_bitset) || - !had_leading_digits) { - /* a decimal point must be followed by at least one digit. */ - state->error = json_parse_error_invalid_number_format; - state->offset = offset; - return 1; - } - } - - /* a decimal point can be followed by more digits of course! */ - while ((offset < size) && ('0' <= src[offset] && src[offset] <= '9')) { - offset++; - } - } - - if ((offset < size) && ('e' == src[offset] || 'E' == src[offset])) { - /* our number has an exponent! Skip 'e' or 'E'. */ - offset++; - - if ((offset < size) && ('-' == src[offset] || '+' == src[offset])) { - /* skip optional '-' or '+'. */ - offset++; - } - - if ((offset < size) && !('0' <= src[offset] && src[offset] <= '9')) { - /* an exponent must have at least one digit! */ - state->error = json_parse_error_invalid_number_format; - state->offset = offset; - return 1; - } - - /* consume exponent digits. */ - do { - offset++; - } while ((offset < size) && ('0' <= src[offset] && src[offset] <= '9')); - } - } - - if (offset < size) { - switch (src[offset]) { - case ' ': - case '\t': - case '\r': - case '\n': - case '}': - case ',': - case ']': - /* all of the above are ok. */ - break; - case '=': - if (json_parse_flags_allow_equals_in_object & flags_bitset) { - break; - } - - state->error = json_parse_error_invalid_number_format; - state->offset = offset; - return 1; - default: - state->error = json_parse_error_invalid_number_format; - state->offset = offset; - return 1; - } - } - - state->data_size += offset - state->offset; - - /* one more byte for null terminator ending the number string! */ - state->data_size++; - - /* update offset. */ - state->offset = offset; - - return 0; -} - -json_weak int json_get_value_size(struct json_parse_state_s *state, - int is_global_object); -int json_get_value_size(struct json_parse_state_s *state, - int is_global_object) { - const size_t flags_bitset = state->flags_bitset; - const char *const src = state->src; - size_t offset; - const size_t size = state->size; - - if (json_parse_flags_allow_location_information & flags_bitset) { - state->dom_size += sizeof(struct json_value_ex_s); - } else { - state->dom_size += sizeof(struct json_value_s); - } - - if (is_global_object) { - return json_get_object_size(state, /* is_global_object = */ 1); - } else { - if (json_skip_all_skippables(state)) { - state->error = json_parse_error_premature_end_of_buffer; - return 1; - } - - /* can cache offset now. */ - offset = state->offset; - - switch (src[offset]) { - case '"': - return json_get_string_size(state, 0); - case '\'': - if (json_parse_flags_allow_single_quoted_strings & flags_bitset) { - return json_get_string_size(state, 0); - } else { - /* invalid value! */ - state->error = json_parse_error_invalid_value; - return 1; - } - case '{': - return json_get_object_size(state, /* is_global_object = */ 0); - case '[': - return json_get_array_size(state); - case '-': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - return json_get_number_size(state); - case '+': - if (json_parse_flags_allow_leading_plus_sign & flags_bitset) { - return json_get_number_size(state); - } else { - /* invalid value! */ - state->error = json_parse_error_invalid_number_format; - return 1; - } - case '.': - if (json_parse_flags_allow_leading_or_trailing_decimal_point & - flags_bitset) { - return json_get_number_size(state); - } else { - /* invalid value! */ - state->error = json_parse_error_invalid_number_format; - return 1; - } - default: - if ((offset + 4) <= size && 't' == src[offset + 0] && - 'r' == src[offset + 1] && 'u' == src[offset + 2] && - 'e' == src[offset + 3]) { - state->offset += 4; - return 0; - } else if ((offset + 5) <= size && 'f' == src[offset + 0] && - 'a' == src[offset + 1] && 'l' == src[offset + 2] && - 's' == src[offset + 3] && 'e' == src[offset + 4]) { - state->offset += 5; - return 0; - } else if ((offset + 4) <= size && 'n' == state->src[offset + 0] && - 'u' == state->src[offset + 1] && - 'l' == state->src[offset + 2] && - 'l' == state->src[offset + 3]) { - state->offset += 4; - return 0; - } else if ((json_parse_flags_allow_inf_and_nan & flags_bitset) && - (offset + 3) <= size && 'N' == src[offset + 0] && - 'a' == src[offset + 1] && 'N' == src[offset + 2]) { - return json_get_number_size(state); - } else if ((json_parse_flags_allow_inf_and_nan & flags_bitset) && - (offset + 8) <= size && 'I' == src[offset + 0] && - 'n' == src[offset + 1] && 'f' == src[offset + 2] && - 'i' == src[offset + 3] && 'n' == src[offset + 4] && - 'i' == src[offset + 5] && 't' == src[offset + 6] && - 'y' == src[offset + 7]) { - return json_get_number_size(state); - } - - /* invalid value! */ - state->error = json_parse_error_invalid_value; - return 1; - } - } -} - -json_weak void json_parse_value(struct json_parse_state_s *state, - int is_global_object, - struct json_value_s *value); - -json_weak void json_parse_string(struct json_parse_state_s *state, - struct json_string_s *string); -void json_parse_string(struct json_parse_state_s *state, - struct json_string_s *string) { - size_t offset = state->offset; - size_t bytes_written = 0; - const char *const src = state->src; - const char quote_to_use = '\'' == src[offset] ? '\'' : '"'; - char *data = state->data; - unsigned long high_surrogate = 0; - unsigned long codepoint; - - string->string = data; - - /* skip leading '"' or '\''. */ - offset++; - - while (quote_to_use != src[offset]) { - if ('\\' == src[offset]) { - /* skip the reverse solidus. */ - offset++; - - switch (src[offset++]) { - default: - return; /* we cannot ever reach here. */ - case 'u': { - codepoint = 0; - if (!json_hexadecimal_value(&src[offset], 4, &codepoint)) { - return; /* this shouldn't happen as the value was already validated. - */ - } - - offset += 4; - - if (codepoint <= 0x7fu) { - data[bytes_written++] = (char)codepoint; /* 0xxxxxxx. */ - } else if (codepoint <= 0x7ffu) { - data[bytes_written++] = - (char)(0xc0u | (codepoint >> 6)); /* 110xxxxx. */ - data[bytes_written++] = - (char)(0x80u | (codepoint & 0x3fu)); /* 10xxxxxx. */ - } else if (codepoint >= 0xd800 && - codepoint <= 0xdbff) { /* high surrogate. */ - high_surrogate = codepoint; - continue; /* we need the low half to form a complete codepoint. */ - } else if (codepoint >= 0xdc00 && - codepoint <= 0xdfff) { /* low surrogate. */ - /* combine with the previously read half to obtain the complete - * codepoint. */ - const unsigned long surrogate_offset = - 0x10000u - (0xD800u << 10) - 0xDC00u; - codepoint = (high_surrogate << 10) + codepoint + surrogate_offset; - high_surrogate = 0; - data[bytes_written++] = - (char)(0xF0u | (codepoint >> 18)); /* 11110xxx. */ - data[bytes_written++] = - (char)(0x80u | ((codepoint >> 12) & 0x3fu)); /* 10xxxxxx. */ - data[bytes_written++] = - (char)(0x80u | ((codepoint >> 6) & 0x3fu)); /* 10xxxxxx. */ - data[bytes_written++] = - (char)(0x80u | (codepoint & 0x3fu)); /* 10xxxxxx. */ - } else { - /* we assume the value was validated and thus is within the valid - * range. */ - data[bytes_written++] = - (char)(0xe0u | (codepoint >> 12)); /* 1110xxxx. */ - data[bytes_written++] = - (char)(0x80u | ((codepoint >> 6) & 0x3fu)); /* 10xxxxxx. */ - data[bytes_written++] = - (char)(0x80u | (codepoint & 0x3fu)); /* 10xxxxxx. */ - } - } break; - case '"': - data[bytes_written++] = '"'; - break; - case '\\': - data[bytes_written++] = '\\'; - break; - case '/': - data[bytes_written++] = '/'; - break; - case 'b': - data[bytes_written++] = '\b'; - break; - case 'f': - data[bytes_written++] = '\f'; - break; - case 'n': - data[bytes_written++] = '\n'; - break; - case 'r': - data[bytes_written++] = '\r'; - break; - case 't': - data[bytes_written++] = '\t'; - break; - case '\r': - data[bytes_written++] = '\r'; - - /* check if we have a "\r\n" sequence. */ - if ('\n' == src[offset]) { - data[bytes_written++] = '\n'; - offset++; - } - - break; - case '\n': - data[bytes_written++] = '\n'; - break; - } - } else { - /* copy the character. */ - data[bytes_written++] = src[offset++]; - } - } - - /* skip trailing '"' or '\''. */ - offset++; - - /* record the size of the string. */ - string->string_size = bytes_written; - - /* add null terminator to string. */ - data[bytes_written++] = '\0'; - - /* move data along. */ - state->data += bytes_written; - - /* update offset. */ - state->offset = offset; -} - -json_weak void json_parse_key(struct json_parse_state_s *state, - struct json_string_s *string); -void json_parse_key(struct json_parse_state_s *state, - struct json_string_s *string) { - if (json_parse_flags_allow_unquoted_keys & state->flags_bitset) { - const char *const src = state->src; - char *const data = state->data; - size_t offset = state->offset; - - /* if we are allowing unquoted keys, check for quoted anyway... */ - if (('"' == src[offset]) || ('\'' == src[offset])) { - /* ... if we got a quote, just parse the key as a string as normal. */ - json_parse_string(state, string); - } else { - size_t size = 0; - - string->string = state->data; - - while (is_valid_unquoted_key_char(src[offset])) { - data[size++] = src[offset++]; - } - - /* add null terminator to string. */ - data[size] = '\0'; - - /* record the size of the string. */ - string->string_size = size++; - - /* move data along. */ - state->data += size; - - /* update offset. */ - state->offset = offset; - } - } else { - /* we are only allowed to have quoted keys, so just parse a string! */ - json_parse_string(state, string); - } -} - -json_weak void json_parse_object(struct json_parse_state_s *state, - int is_global_object, - struct json_object_s *object); -void json_parse_object(struct json_parse_state_s *state, int is_global_object, - struct json_object_s *object) { - const size_t flags_bitset = state->flags_bitset; - const size_t size = state->size; - const char *const src = state->src; - size_t elements = 0; - int allow_comma = 0; - struct json_object_element_s *previous = json_null; - - if (is_global_object) { - /* if we skipped some whitespace, and then found an opening '{' of an. */ - /* object, we actually have a normal JSON object at the root of the DOM... - */ - if ('{' == src[state->offset]) { - /* . and we don't actually have a global object after all! */ - is_global_object = 0; - } - } - - if (!is_global_object) { - /* skip leading '{'. */ - state->offset++; - } - - (void)json_skip_all_skippables(state); - - /* reset elements. */ - elements = 0; - - while (state->offset < size) { - struct json_object_element_s *element = json_null; - struct json_string_s *string = json_null; - struct json_value_s *value = json_null; - - if (!is_global_object) { - (void)json_skip_all_skippables(state); - - if ('}' == src[state->offset]) { - /* skip trailing '}'. */ - state->offset++; - - /* finished the object! */ - break; - } - } else { - if (json_skip_all_skippables(state)) { - /* global object ends when the file ends! */ - break; - } - } - - /* if we parsed at least one element previously, grok for a comma. */ - if (allow_comma) { - if (',' == src[state->offset]) { - /* skip comma. */ - state->offset++; - allow_comma = 0; - continue; - } - } - - element = (struct json_object_element_s *)state->dom; - - state->dom += sizeof(struct json_object_element_s); - - if (json_null == previous) { - /* this is our first element, so record it in our object. */ - object->start = element; - } else { - previous->next = element; - } - - previous = element; - - if (json_parse_flags_allow_location_information & flags_bitset) { - struct json_string_ex_s *string_ex = - (struct json_string_ex_s *)state->dom; - state->dom += sizeof(struct json_string_ex_s); - - string_ex->offset = state->offset; - string_ex->line_no = state->line_no; - string_ex->row_no = state->offset - state->line_offset; - - string = &(string_ex->string); - } else { - string = (struct json_string_s *)state->dom; - state->dom += sizeof(struct json_string_s); - } - - element->name = string; - - (void)json_parse_key(state, string); - - (void)json_skip_all_skippables(state); - - /* skip colon or equals. */ - state->offset++; - - (void)json_skip_all_skippables(state); - - if (json_parse_flags_allow_location_information & flags_bitset) { - struct json_value_ex_s *value_ex = (struct json_value_ex_s *)state->dom; - state->dom += sizeof(struct json_value_ex_s); - - value_ex->offset = state->offset; - value_ex->line_no = state->line_no; - value_ex->row_no = state->offset - state->line_offset; - - value = &(value_ex->value); - } else { - value = (struct json_value_s *)state->dom; - state->dom += sizeof(struct json_value_s); - } - - element->value = value; - - json_parse_value(state, /* is_global_object = */ 0, value); - - /* successfully parsed a name/value pair! */ - elements++; - allow_comma = 1; - } - - /* if we had at least one element, end the linked list. */ - if (previous) { - previous->next = json_null; - } - - if (0 == elements) { - object->start = json_null; - } - - object->length = elements; -} - -json_weak void json_parse_array(struct json_parse_state_s *state, - struct json_array_s *array); -void json_parse_array(struct json_parse_state_s *state, - struct json_array_s *array) { - const char *const src = state->src; - const size_t size = state->size; - size_t elements = 0; - int allow_comma = 0; - struct json_array_element_s *previous = json_null; - - /* skip leading '['. */ - state->offset++; - - (void)json_skip_all_skippables(state); - - /* reset elements. */ - elements = 0; - - do { - struct json_array_element_s *element = json_null; - struct json_value_s *value = json_null; - - (void)json_skip_all_skippables(state); - - if (']' == src[state->offset]) { - /* skip trailing ']'. */ - state->offset++; - - /* finished the array! */ - break; - } - - /* if we parsed at least one element previously, grok for a comma. */ - if (allow_comma) { - if (',' == src[state->offset]) { - /* skip comma. */ - state->offset++; - allow_comma = 0; - continue; - } - } - - element = (struct json_array_element_s *)state->dom; - - state->dom += sizeof(struct json_array_element_s); - - if (json_null == previous) { - /* this is our first element, so record it in our array. */ - array->start = element; - } else { - previous->next = element; - } - - previous = element; - - if (json_parse_flags_allow_location_information & state->flags_bitset) { - struct json_value_ex_s *value_ex = (struct json_value_ex_s *)state->dom; - state->dom += sizeof(struct json_value_ex_s); - - value_ex->offset = state->offset; - value_ex->line_no = state->line_no; - value_ex->row_no = state->offset - state->line_offset; - - value = &(value_ex->value); - } else { - value = (struct json_value_s *)state->dom; - state->dom += sizeof(struct json_value_s); - } - - element->value = value; - - json_parse_value(state, /* is_global_object = */ 0, value); - - /* successfully parsed an array element! */ - elements++; - allow_comma = 1; - } while (state->offset < size); - - /* end the linked list. */ - if (previous) { - previous->next = json_null; - } - - if (0 == elements) { - array->start = json_null; - } - - array->length = elements; -} - -json_weak void json_parse_number(struct json_parse_state_s *state, - struct json_number_s *number); -void json_parse_number(struct json_parse_state_s *state, - struct json_number_s *number) { - const size_t flags_bitset = state->flags_bitset; - size_t offset = state->offset; - const size_t size = state->size; - size_t bytes_written = 0; - const char *const src = state->src; - char *data = state->data; - - number->number = data; - - if (json_parse_flags_allow_hexadecimal_numbers & flags_bitset) { - if (('0' == src[offset]) && - (('x' == src[offset + 1]) || ('X' == src[offset + 1]))) { - /* consume hexadecimal digits. */ - while ((offset < size) && - (('0' <= src[offset] && src[offset] <= '9') || - ('a' <= src[offset] && src[offset] <= 'f') || - ('A' <= src[offset] && src[offset] <= 'F') || - ('x' == src[offset]) || ('X' == src[offset]))) { - data[bytes_written++] = src[offset++]; - } - } - } - - while (offset < size) { - int end = 0; - - switch (src[offset]) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case '.': - case 'e': - case 'E': - case '+': - case '-': - data[bytes_written++] = src[offset++]; - break; - default: - end = 1; - break; - } - - if (0 != end) { - break; - } - } - - if (json_parse_flags_allow_inf_and_nan & flags_bitset) { - const size_t inf_strlen = 8; /* = strlen("Infinity");. */ - const size_t nan_strlen = 3; /* = strlen("NaN");. */ - - if (offset + inf_strlen < size) { - if ('I' == src[offset]) { - size_t i; - /* We found our special 'Infinity' keyword! */ - for (i = 0; i < inf_strlen; i++) { - data[bytes_written++] = src[offset++]; - } - } - } - - if (offset + nan_strlen < size) { - if ('N' == src[offset]) { - size_t i; - /* We found our special 'NaN' keyword! */ - for (i = 0; i < nan_strlen; i++) { - data[bytes_written++] = src[offset++]; - } - } - } - } - - /* record the size of the number. */ - number->number_size = bytes_written; - /* add null terminator to number string. */ - data[bytes_written++] = '\0'; - /* move data along. */ - state->data += bytes_written; - /* update offset. */ - state->offset = offset; -} - -json_weak void json_parse_value(struct json_parse_state_s *state, - int is_global_object, - struct json_value_s *value); -void json_parse_value(struct json_parse_state_s *state, int is_global_object, - struct json_value_s *value) { - const size_t flags_bitset = state->flags_bitset; - const char *const src = state->src; - const size_t size = state->size; - size_t offset; - - (void)json_skip_all_skippables(state); - - /* cache offset now. */ - offset = state->offset; - - if (is_global_object) { - value->type = json_type_object; - value->payload = state->dom; - state->dom += sizeof(struct json_object_s); - json_parse_object(state, /* is_global_object = */ 1, - (struct json_object_s *)value->payload); - } else { - switch (src[offset]) { - case '"': - case '\'': - value->type = json_type_string; - value->payload = state->dom; - state->dom += sizeof(struct json_string_s); - json_parse_string(state, (struct json_string_s *)value->payload); - break; - case '{': - value->type = json_type_object; - value->payload = state->dom; - state->dom += sizeof(struct json_object_s); - json_parse_object(state, /* is_global_object = */ 0, - (struct json_object_s *)value->payload); - break; - case '[': - value->type = json_type_array; - value->payload = state->dom; - state->dom += sizeof(struct json_array_s); - json_parse_array(state, (struct json_array_s *)value->payload); - break; - case '-': - case '+': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case '.': - value->type = json_type_number; - value->payload = state->dom; - state->dom += sizeof(struct json_number_s); - json_parse_number(state, (struct json_number_s *)value->payload); - break; - default: - if ((offset + 4) <= size && 't' == src[offset + 0] && - 'r' == src[offset + 1] && 'u' == src[offset + 2] && - 'e' == src[offset + 3]) { - value->type = json_type_true; - value->payload = json_null; - state->offset += 4; - } else if ((offset + 5) <= size && 'f' == src[offset + 0] && - 'a' == src[offset + 1] && 'l' == src[offset + 2] && - 's' == src[offset + 3] && 'e' == src[offset + 4]) { - value->type = json_type_false; - value->payload = json_null; - state->offset += 5; - } else if ((offset + 4) <= size && 'n' == src[offset + 0] && - 'u' == src[offset + 1] && 'l' == src[offset + 2] && - 'l' == src[offset + 3]) { - value->type = json_type_null; - value->payload = json_null; - state->offset += 4; - } else if ((json_parse_flags_allow_inf_and_nan & flags_bitset) && - (offset + 3) <= size && 'N' == src[offset + 0] && - 'a' == src[offset + 1] && 'N' == src[offset + 2]) { - value->type = json_type_number; - value->payload = state->dom; - state->dom += sizeof(struct json_number_s); - json_parse_number(state, (struct json_number_s *)value->payload); - } else if ((json_parse_flags_allow_inf_and_nan & flags_bitset) && - (offset + 8) <= size && 'I' == src[offset + 0] && - 'n' == src[offset + 1] && 'f' == src[offset + 2] && - 'i' == src[offset + 3] && 'n' == src[offset + 4] && - 'i' == src[offset + 5] && 't' == src[offset + 6] && - 'y' == src[offset + 7]) { - value->type = json_type_number; - value->payload = state->dom; - state->dom += sizeof(struct json_number_s); - json_parse_number(state, (struct json_number_s *)value->payload); - } - break; - } - } -} - -struct json_value_s * -json_parse_ex(const void *src, size_t src_size, size_t flags_bitset, - void *(*alloc_func_ptr)(void *user_data, size_t size), - void *user_data, struct json_parse_result_s *result) { - struct json_parse_state_s state; - void *allocation; - struct json_value_s *value; - size_t total_size; - int input_error; - - if (result) { - result->error = json_parse_error_none; - result->error_offset = 0; - result->error_line_no = 0; - result->error_row_no = 0; - } - - if (json_null == src) { - /* invalid src pointer was null! */ - return json_null; - } - - state.src = (const char *)src; - state.size = src_size; - state.offset = 0; - state.line_no = 1; - state.line_offset = 0; - state.error = json_parse_error_none; - state.dom_size = 0; - state.data_size = 0; - state.flags_bitset = flags_bitset; - - input_error = json_get_value_size( - &state, (int)(json_parse_flags_allow_global_object & state.flags_bitset)); - - if (0 == input_error) { - json_skip_all_skippables(&state); - - if (state.offset != state.size) { - /* our parsing didn't have an error, but there are characters remaining in - * the input that weren't part of the JSON! */ - - state.error = json_parse_error_unexpected_trailing_characters; - input_error = 1; - } - } - - if (input_error) { - /* parsing value's size failed (most likely an invalid JSON DOM!). */ - if (result) { - result->error = state.error; - result->error_offset = state.offset; - result->error_line_no = state.line_no; - result->error_row_no = state.offset - state.line_offset; - } - return json_null; - } - - /* our total allocation is the combination of the dom and data sizes (we. */ - /* first encode the structure of the JSON, and then the data referenced by. */ - /* the JSON values). */ - total_size = state.dom_size + state.data_size; - - if (json_null == alloc_func_ptr) { - allocation = malloc(total_size); - } else { - allocation = alloc_func_ptr(user_data, total_size); - } - - if (json_null == allocation) { - /* malloc failed! */ - if (result) { - result->error = json_parse_error_allocator_failed; - result->error_offset = 0; - result->error_line_no = 0; - result->error_row_no = 0; - } - - return json_null; - } - - /* reset offset so we can reuse it. */ - state.offset = 0; - - /* reset the line information so we can reuse it. */ - state.line_no = 1; - state.line_offset = 0; - - state.dom = (char *)allocation; - state.data = state.dom + state.dom_size; - - if (json_parse_flags_allow_location_information & state.flags_bitset) { - struct json_value_ex_s *value_ex = (struct json_value_ex_s *)state.dom; - state.dom += sizeof(struct json_value_ex_s); - - value_ex->offset = state.offset; - value_ex->line_no = state.line_no; - value_ex->row_no = state.offset - state.line_offset; - - value = &(value_ex->value); - } else { - value = (struct json_value_s *)state.dom; - state.dom += sizeof(struct json_value_s); - } - - json_parse_value( - &state, (int)(json_parse_flags_allow_global_object & state.flags_bitset), - value); - - return (struct json_value_s *)allocation; -} - -struct json_value_s *json_parse(const void *src, size_t src_size) { - return json_parse_ex(src, src_size, json_parse_flags_default, json_null, - json_null, json_null); -} - -struct json_extract_result_s { - size_t dom_size; - size_t data_size; -}; - -struct json_value_s *json_extract_value(const struct json_value_s *value) { - return json_extract_value_ex(value, json_null, json_null); -} - -json_weak struct json_extract_result_s -json_extract_get_number_size(const struct json_number_s *const number); -json_weak struct json_extract_result_s -json_extract_get_string_size(const struct json_string_s *const string); -json_weak struct json_extract_result_s -json_extract_get_object_size(const struct json_object_s *const object); -json_weak struct json_extract_result_s -json_extract_get_array_size(const struct json_array_s *const array); -json_weak struct json_extract_result_s -json_extract_get_value_size(const struct json_value_s *const value); - -struct json_extract_result_s -json_extract_get_number_size(const struct json_number_s *const number) { - struct json_extract_result_s result; - result.dom_size = sizeof(struct json_number_s); - result.data_size = number->number_size; - return result; -} - -struct json_extract_result_s -json_extract_get_string_size(const struct json_string_s *const string) { - struct json_extract_result_s result; - result.dom_size = sizeof(struct json_string_s); - result.data_size = string->string_size + 1; - return result; -} - -struct json_extract_result_s -json_extract_get_object_size(const struct json_object_s *const object) { - struct json_extract_result_s result; - size_t i; - const struct json_object_element_s *element = object->start; - - result.dom_size = sizeof(struct json_object_s) + - (sizeof(struct json_object_element_s) * object->length); - result.data_size = 0; - - for (i = 0; i < object->length; i++) { - const struct json_extract_result_s string_result = - json_extract_get_string_size(element->name); - const struct json_extract_result_s value_result = - json_extract_get_value_size(element->value); - - result.dom_size += string_result.dom_size; - result.data_size += string_result.data_size; - - result.dom_size += value_result.dom_size; - result.data_size += value_result.data_size; - - element = element->next; - } - - return result; -} - -struct json_extract_result_s -json_extract_get_array_size(const struct json_array_s *const array) { - struct json_extract_result_s result; - size_t i; - const struct json_array_element_s *element = array->start; - - result.dom_size = sizeof(struct json_array_s) + - (sizeof(struct json_array_element_s) * array->length); - result.data_size = 0; - - for (i = 0; i < array->length; i++) { - const struct json_extract_result_s value_result = - json_extract_get_value_size(element->value); - - result.dom_size += value_result.dom_size; - result.data_size += value_result.data_size; - - element = element->next; - } - - return result; -} - -struct json_extract_result_s -json_extract_get_value_size(const struct json_value_s *const value) { - struct json_extract_result_s result = {0, 0}; - - switch (value->type) { - default: - break; - case json_type_object: - result = json_extract_get_object_size( - (const struct json_object_s *)value->payload); - break; - case json_type_array: - result = json_extract_get_array_size( - (const struct json_array_s *)value->payload); - break; - case json_type_number: - result = json_extract_get_number_size( - (const struct json_number_s *)value->payload); - break; - case json_type_string: - result = json_extract_get_string_size( - (const struct json_string_s *)value->payload); - break; - } - - result.dom_size += sizeof(struct json_value_s); - - return result; -} - -struct json_extract_state_s { - char *dom; - char *data; -}; - -json_weak void json_extract_copy_value(struct json_extract_state_s *const state, - const struct json_value_s *const value); -void json_extract_copy_value(struct json_extract_state_s *const state, - const struct json_value_s *const value) { - struct json_string_s *string; - struct json_number_s *number; - struct json_object_s *object; - struct json_array_s *array; - struct json_value_s *new_value; - - memcpy(state->dom, value, sizeof(struct json_value_s)); - new_value = (struct json_value_s *)state->dom; - state->dom += sizeof(struct json_value_s); - new_value->payload = state->dom; - - if (json_type_string == value->type) { - memcpy(state->dom, value->payload, sizeof(struct json_string_s)); - string = (struct json_string_s *)state->dom; - state->dom += sizeof(struct json_string_s); - - memcpy(state->data, string->string, string->string_size + 1); - string->string = state->data; - state->data += string->string_size + 1; - } else if (json_type_number == value->type) { - memcpy(state->dom, value->payload, sizeof(struct json_number_s)); - number = (struct json_number_s *)state->dom; - state->dom += sizeof(struct json_number_s); - - memcpy(state->data, number->number, number->number_size); - number->number = state->data; - state->data += number->number_size; - } else if (json_type_object == value->type) { - struct json_object_element_s *element; - size_t i; - - memcpy(state->dom, value->payload, sizeof(struct json_object_s)); - object = (struct json_object_s *)state->dom; - state->dom += sizeof(struct json_object_s); - - element = object->start; - object->start = (struct json_object_element_s *)state->dom; - - for (i = 0; i < object->length; i++) { - struct json_value_s *previous_value; - struct json_object_element_s *previous_element; - - memcpy(state->dom, element, sizeof(struct json_object_element_s)); - element = (struct json_object_element_s *)state->dom; - state->dom += sizeof(struct json_object_element_s); - - string = element->name; - memcpy(state->dom, string, sizeof(struct json_string_s)); - string = (struct json_string_s *)state->dom; - state->dom += sizeof(struct json_string_s); - element->name = string; - - memcpy(state->data, string->string, string->string_size + 1); - string->string = state->data; - state->data += string->string_size + 1; - - previous_value = element->value; - element->value = (struct json_value_s *)state->dom; - json_extract_copy_value(state, previous_value); - - previous_element = element; - element = element->next; - - if (element) { - previous_element->next = (struct json_object_element_s *)state->dom; - } - } - } else if (json_type_array == value->type) { - struct json_array_element_s *element; - size_t i; - - memcpy(state->dom, value->payload, sizeof(struct json_array_s)); - array = (struct json_array_s *)state->dom; - state->dom += sizeof(struct json_array_s); - - element = array->start; - array->start = (struct json_array_element_s *)state->dom; - - for (i = 0; i < array->length; i++) { - struct json_value_s *previous_value; - struct json_array_element_s *previous_element; - - memcpy(state->dom, element, sizeof(struct json_array_element_s)); - element = (struct json_array_element_s *)state->dom; - state->dom += sizeof(struct json_array_element_s); - - previous_value = element->value; - element->value = (struct json_value_s *)state->dom; - json_extract_copy_value(state, previous_value); - - previous_element = element; - element = element->next; - - if (element) { - previous_element->next = (struct json_array_element_s *)state->dom; - } - } - } -} - -struct json_value_s *json_extract_value_ex(const struct json_value_s *value, - void *(*alloc_func_ptr)(void *, - size_t), - void *user_data) { - void *allocation; - struct json_extract_result_s result; - struct json_extract_state_s state; - size_t total_size; - - if (json_null == value) { - /* invalid value was null! */ - return json_null; - } - - result = json_extract_get_value_size(value); - total_size = result.dom_size + result.data_size; - - if (json_null == alloc_func_ptr) { - allocation = malloc(total_size); - } else { - allocation = alloc_func_ptr(user_data, total_size); - } - - state.dom = (char *)allocation; - state.data = state.dom + result.dom_size; - - json_extract_copy_value(&state, value); - - return (struct json_value_s *)allocation; -} - -struct json_string_s *json_value_as_string(struct json_value_s *const value) { - if (value->type != json_type_string) { - return json_null; - } - - return (struct json_string_s *)value->payload; -} - -struct json_number_s *json_value_as_number(struct json_value_s *const value) { - if (value->type != json_type_number) { - return json_null; - } - - return (struct json_number_s *)value->payload; -} - -struct json_object_s *json_value_as_object(struct json_value_s *const value) { - if (value->type != json_type_object) { - return json_null; - } - - return (struct json_object_s *)value->payload; -} - -struct json_array_s *json_value_as_array(struct json_value_s *const value) { - if (value->type != json_type_array) { - return json_null; - } - - return (struct json_array_s *)value->payload; -} - -int json_value_is_true(const struct json_value_s *const value) { - return value->type == json_type_true; -} - -int json_value_is_false(const struct json_value_s *const value) { - return value->type == json_type_false; -} - -int json_value_is_null(const struct json_value_s *const value) { - return value->type == json_type_null; -} - -json_weak int -json_write_minified_get_value_size(const struct json_value_s *value, - size_t *size); - -json_weak int json_write_get_number_size(const struct json_number_s *number, - size_t *size); -int json_write_get_number_size(const struct json_number_s *number, - size_t *size) { - json_uintmax_t parsed_number; - size_t i; - - if (number->number_size >= 2) { - switch (number->number[1]) { - default: - break; - case 'x': - case 'X': - /* the number is a json_parse_flags_allow_hexadecimal_numbers hexadecimal - * so we have to do extra work to convert it to a non-hexadecimal for JSON - * output. */ - parsed_number = json_strtoumax(number->number, json_null, 0); - - i = 0; - - while (0 != parsed_number) { - parsed_number /= 10; - i++; - } - - *size += i; - return 0; - } - } - - /* check to see if the number has leading/trailing decimal point. */ - i = 0; - - /* skip any leading '+' or '-'. */ - if ((i < number->number_size) && - (('+' == number->number[i]) || ('-' == number->number[i]))) { - i++; - } - - /* check if we have infinity. */ - if ((i < number->number_size) && ('I' == number->number[i])) { - const char *inf = "Infinity"; - size_t k; - - for (k = i; k < number->number_size; k++) { - const char c = *inf++; - - /* Check if we found the Infinity string! */ - if ('\0' == c) { - break; - } else if (c != number->number[k]) { - break; - } - } - - if ('\0' == *inf) { - /* Inf becomes 1.7976931348623158e308 because JSON can't support it. */ - *size += 22; - - /* if we had a leading '-' we need to record it in the JSON output. */ - if ('-' == number->number[0]) { - *size += 1; - } - } - - return 0; - } - - /* check if we have nan. */ - if ((i < number->number_size) && ('N' == number->number[i])) { - const char *nan = "NaN"; - size_t k; - - for (k = i; k < number->number_size; k++) { - const char c = *nan++; - - /* Check if we found the NaN string! */ - if ('\0' == c) { - break; - } else if (c != number->number[k]) { - break; - } - } - - if ('\0' == *nan) { - /* NaN becomes 1 because JSON can't support it. */ - *size += 1; - - return 0; - } - } - - /* if we had a leading decimal point. */ - if ((i < number->number_size) && ('.' == number->number[i])) { - /* 1 + because we had a leading decimal point. */ - *size += 1; - goto cleanup; - } - - for (; i < number->number_size; i++) { - const char c = number->number[i]; - if (!('0' <= c && c <= '9')) { - break; - } - } - - /* if we had a trailing decimal point. */ - if ((i + 1 == number->number_size) && ('.' == number->number[i])) { - /* 1 + because we had a trailing decimal point. */ - *size += 1; - goto cleanup; - } - -cleanup: - *size += number->number_size; /* the actual string of the number. */ - - /* if we had a leading '+' we don't record it in the JSON output. */ - if ('+' == number->number[0]) { - *size -= 1; - } - - return 0; -} - -json_weak int json_write_get_string_size(const struct json_string_s *string, - size_t *size); -int json_write_get_string_size(const struct json_string_s *string, - size_t *size) { - size_t i; - for (i = 0; i < string->string_size; i++) { - switch (string->string[i]) { - case '"': - case '\\': - case '\b': - case '\f': - case '\n': - case '\r': - case '\t': - *size += 2; - break; - default: - *size += 1; - break; - } - } - - *size += 2; /* need to encode the surrounding '"' characters. */ - - return 0; -} - -json_weak int -json_write_minified_get_array_size(const struct json_array_s *array, - size_t *size); -int json_write_minified_get_array_size(const struct json_array_s *array, - size_t *size) { - struct json_array_element_s *element; - - *size += 2; /* '[' and ']'. */ - - if (1 < array->length) { - *size += array->length - 1; /* ','s seperate each element. */ - } - - for (element = array->start; json_null != element; element = element->next) { - if (json_write_minified_get_value_size(element->value, size)) { - /* value was malformed! */ - return 1; - } - } - - return 0; -} - -json_weak int -json_write_minified_get_object_size(const struct json_object_s *object, - size_t *size); -int json_write_minified_get_object_size(const struct json_object_s *object, - size_t *size) { - struct json_object_element_s *element; - - *size += 2; /* '{' and '}'. */ - - *size += object->length; /* ':'s seperate each name/value pair. */ - - if (1 < object->length) { - *size += object->length - 1; /* ','s seperate each element. */ - } - - for (element = object->start; json_null != element; element = element->next) { - if (json_write_get_string_size(element->name, size)) { - /* string was malformed! */ - return 1; - } - - if (json_write_minified_get_value_size(element->value, size)) { - /* value was malformed! */ - return 1; - } - } - - return 0; -} - -json_weak int -json_write_minified_get_value_size(const struct json_value_s *value, - size_t *size); -int json_write_minified_get_value_size(const struct json_value_s *value, - size_t *size) { - switch (value->type) { - default: - /* unknown value type found! */ - return 1; - case json_type_number: - return json_write_get_number_size((struct json_number_s *)value->payload, - size); - case json_type_string: - return json_write_get_string_size((struct json_string_s *)value->payload, - size); - case json_type_array: - return json_write_minified_get_array_size( - (struct json_array_s *)value->payload, size); - case json_type_object: - return json_write_minified_get_object_size( - (struct json_object_s *)value->payload, size); - case json_type_true: - *size += 4; /* the string "true". */ - return 0; - case json_type_false: - *size += 5; /* the string "false". */ - return 0; - case json_type_null: - *size += 4; /* the string "null". */ - return 0; - } -} - -json_weak char *json_write_minified_value(const struct json_value_s *value, - char *data); - -json_weak char *json_write_number(const struct json_number_s *number, - char *data); -char *json_write_number(const struct json_number_s *number, char *data) { - json_uintmax_t parsed_number, backup; - size_t i; - - if (number->number_size >= 2) { - switch (number->number[1]) { - default: - break; - case 'x': - case 'X': - /* The number is a json_parse_flags_allow_hexadecimal_numbers hexadecimal - * so we have to do extra work to convert it to a non-hexadecimal for JSON - * output. */ - parsed_number = json_strtoumax(number->number, json_null, 0); - - /* We need a copy of parsed number twice, so take a backup of it. */ - backup = parsed_number; - - i = 0; - - while (0 != parsed_number) { - parsed_number /= 10; - i++; - } - - /* Restore parsed_number to its original value stored in the backup. */ - parsed_number = backup; - - /* Now use backup to take a copy of i, or the length of the string. */ - backup = i; - - do { - *(data + i - 1) = '0' + (char)(parsed_number % 10); - parsed_number /= 10; - i--; - } while (0 != parsed_number); - - data += backup; - - return data; - } - } - - /* check to see if the number has leading/trailing decimal point. */ - i = 0; - - /* skip any leading '-'. */ - if ((i < number->number_size) && - (('+' == number->number[i]) || ('-' == number->number[i]))) { - i++; - } - - /* check if we have infinity. */ - if ((i < number->number_size) && ('I' == number->number[i])) { - const char *inf = "Infinity"; - size_t k; - - for (k = i; k < number->number_size; k++) { - const char c = *inf++; - - /* Check if we found the Infinity string! */ - if ('\0' == c) { - break; - } else if (c != number->number[k]) { - break; - } - } - - if ('\0' == *inf++) { - const char *dbl_max; - - /* if we had a leading '-' we need to record it in the JSON output. */ - if ('-' == number->number[0]) { - *data++ = '-'; - } - - /* Inf becomes 1.7976931348623158e308 because JSON can't support it. */ - for (dbl_max = "1.7976931348623158e308"; '\0' != *dbl_max; dbl_max++) { - *data++ = *dbl_max; - } - - return data; - } - } - - /* check if we have nan. */ - if ((i < number->number_size) && ('N' == number->number[i])) { - const char *nan = "NaN"; - size_t k; - - for (k = i; k < number->number_size; k++) { - const char c = *nan++; - - /* Check if we found the NaN string! */ - if ('\0' == c) { - break; - } else if (c != number->number[k]) { - break; - } - } - - if ('\0' == *nan++) { - /* NaN becomes 0 because JSON can't support it. */ - *data++ = '0'; - return data; - } - } - - /* if we had a leading decimal point. */ - if ((i < number->number_size) && ('.' == number->number[i])) { - i = 0; - - /* skip any leading '+'. */ - if ('+' == number->number[i]) { - i++; - } - - /* output the leading '-' if we had one. */ - if ('-' == number->number[i]) { - *data++ = '-'; - i++; - } - - /* insert a '0' to fix the leading decimal point for JSON output. */ - *data++ = '0'; - - /* and output the rest of the number as normal. */ - for (; i < number->number_size; i++) { - *data++ = number->number[i]; - } - - return data; - } - - for (; i < number->number_size; i++) { - const char c = number->number[i]; - if (!('0' <= c && c <= '9')) { - break; - } - } - - /* if we had a trailing decimal point. */ - if ((i + 1 == number->number_size) && ('.' == number->number[i])) { - i = 0; - - /* skip any leading '+'. */ - if ('+' == number->number[i]) { - i++; - } - - /* output the leading '-' if we had one. */ - if ('-' == number->number[i]) { - *data++ = '-'; - i++; - } - - /* and output the rest of the number as normal. */ - for (; i < number->number_size; i++) { - *data++ = number->number[i]; - } - - /* insert a '0' to fix the trailing decimal point for JSON output. */ - *data++ = '0'; - - return data; - } - - i = 0; - - /* skip any leading '+'. */ - if ('+' == number->number[i]) { - i++; - } - - for (; i < number->number_size; i++) { - *data++ = number->number[i]; - } - - return data; -} - -json_weak char *json_write_string(const struct json_string_s *string, - char *data); -char *json_write_string(const struct json_string_s *string, char *data) { - size_t i; - - *data++ = '"'; /* open the string. */ - - for (i = 0; i < string->string_size; i++) { - switch (string->string[i]) { - case '"': - *data++ = '\\'; /* escape the control character. */ - *data++ = '"'; - break; - case '\\': - *data++ = '\\'; /* escape the control character. */ - *data++ = '\\'; - break; - case '\b': - *data++ = '\\'; /* escape the control character. */ - *data++ = 'b'; - break; - case '\f': - *data++ = '\\'; /* escape the control character. */ - *data++ = 'f'; - break; - case '\n': - *data++ = '\\'; /* escape the control character. */ - *data++ = 'n'; - break; - case '\r': - *data++ = '\\'; /* escape the control character. */ - *data++ = 'r'; - break; - case '\t': - *data++ = '\\'; /* escape the control character. */ - *data++ = 't'; - break; - default: - *data++ = string->string[i]; - break; - } - } - - *data++ = '"'; /* close the string. */ - - return data; -} - -json_weak char *json_write_minified_array(const struct json_array_s *array, - char *data); -char *json_write_minified_array(const struct json_array_s *array, char *data) { - struct json_array_element_s *element = json_null; - - *data++ = '['; /* open the array. */ - - for (element = array->start; json_null != element; element = element->next) { - if (element != array->start) { - *data++ = ','; /* ','s seperate each element. */ - } - - data = json_write_minified_value(element->value, data); - - if (json_null == data) { - /* value was malformed! */ - return json_null; - } - } - - *data++ = ']'; /* close the array. */ - - return data; -} - -json_weak char *json_write_minified_object(const struct json_object_s *object, - char *data); -char *json_write_minified_object(const struct json_object_s *object, - char *data) { - struct json_object_element_s *element = json_null; - - *data++ = '{'; /* open the object. */ - - for (element = object->start; json_null != element; element = element->next) { - if (element != object->start) { - *data++ = ','; /* ','s seperate each element. */ - } - - data = json_write_string(element->name, data); - - if (json_null == data) { - /* string was malformed! */ - return json_null; - } - - *data++ = ':'; /* ':'s seperate each name/value pair. */ - - data = json_write_minified_value(element->value, data); - - if (json_null == data) { - /* value was malformed! */ - return json_null; - } - } - - *data++ = '}'; /* close the object. */ - - return data; -} - -json_weak char *json_write_minified_value(const struct json_value_s *value, - char *data); -char *json_write_minified_value(const struct json_value_s *value, char *data) { - switch (value->type) { - default: - /* unknown value type found! */ - return json_null; - case json_type_number: - return json_write_number((struct json_number_s *)value->payload, data); - case json_type_string: - return json_write_string((struct json_string_s *)value->payload, data); - case json_type_array: - return json_write_minified_array((struct json_array_s *)value->payload, - data); - case json_type_object: - return json_write_minified_object((struct json_object_s *)value->payload, - data); - case json_type_true: - data[0] = 't'; - data[1] = 'r'; - data[2] = 'u'; - data[3] = 'e'; - return data + 4; - case json_type_false: - data[0] = 'f'; - data[1] = 'a'; - data[2] = 'l'; - data[3] = 's'; - data[4] = 'e'; - return data + 5; - case json_type_null: - data[0] = 'n'; - data[1] = 'u'; - data[2] = 'l'; - data[3] = 'l'; - return data + 4; - } -} - -void *json_write_minified(const struct json_value_s *value, size_t *out_size) { - size_t size = 0; - char *data = json_null; - char *data_end = json_null; - - if (json_null == value) { - return json_null; - } - - if (json_write_minified_get_value_size(value, &size)) { - /* value was malformed! */ - return json_null; - } - - size += 1; /* for the '\0' null terminating character. */ - - data = (char *)malloc(size); - - if (json_null == data) { - /* malloc failed! */ - return json_null; - } - - data_end = json_write_minified_value(value, data); - - if (json_null == data_end) { - /* bad chi occurred! */ - free(data); - return json_null; - } - - /* null terminated the string. */ - *data_end = '\0'; - - if (json_null != out_size) { - *out_size = size; - } - - return data; -} - -json_weak int json_write_pretty_get_value_size(const struct json_value_s *value, - size_t depth, size_t indent_size, - size_t newline_size, - size_t *size); - -json_weak int json_write_pretty_get_array_size(const struct json_array_s *array, - size_t depth, size_t indent_size, - size_t newline_size, - size_t *size); -int json_write_pretty_get_array_size(const struct json_array_s *array, - size_t depth, size_t indent_size, - size_t newline_size, size_t *size) { - struct json_array_element_s *element; - - *size += 1; /* '['. */ - - if (0 < array->length) { - /* if we have any elements we need to add a newline after our '['. */ - *size += newline_size; - - *size += array->length - 1; /* ','s seperate each element. */ - - for (element = array->start; json_null != element; - element = element->next) { - /* each element gets an indent. */ - *size += (depth + 1) * indent_size; - - if (json_write_pretty_get_value_size(element->value, depth + 1, - indent_size, newline_size, size)) { - /* value was malformed! */ - return 1; - } - - /* each element gets a newline too. */ - *size += newline_size; - } - - /* since we wrote out some elements, need to add a newline and indentation. - */ - /* to the trailing ']'. */ - *size += depth * indent_size; - } - - *size += 1; /* ']'. */ - - return 0; -} - -json_weak int -json_write_pretty_get_object_size(const struct json_object_s *object, - size_t depth, size_t indent_size, - size_t newline_size, size_t *size); -int json_write_pretty_get_object_size(const struct json_object_s *object, - size_t depth, size_t indent_size, - size_t newline_size, size_t *size) { - struct json_object_element_s *element; - - *size += 1; /* '{'. */ - - if (0 < object->length) { - *size += newline_size; /* need a newline next. */ - - *size += object->length - 1; /* ','s seperate each element. */ - - for (element = object->start; json_null != element; - element = element->next) { - /* each element gets an indent and newline. */ - *size += (depth + 1) * indent_size; - *size += newline_size; - - if (json_write_get_string_size(element->name, size)) { - /* string was malformed! */ - return 1; - } - - *size += 3; /* seperate each name/value pair with " : ". */ - - if (json_write_pretty_get_value_size(element->value, depth + 1, - indent_size, newline_size, size)) { - /* value was malformed! */ - return 1; - } - } - - *size += depth * indent_size; - } - - *size += 1; /* '}'. */ - - return 0; -} - -json_weak int json_write_pretty_get_value_size(const struct json_value_s *value, - size_t depth, size_t indent_size, - size_t newline_size, - size_t *size); -int json_write_pretty_get_value_size(const struct json_value_s *value, - size_t depth, size_t indent_size, - size_t newline_size, size_t *size) { - switch (value->type) { - default: - /* unknown value type found! */ - return 1; - case json_type_number: - return json_write_get_number_size((struct json_number_s *)value->payload, - size); - case json_type_string: - return json_write_get_string_size((struct json_string_s *)value->payload, - size); - case json_type_array: - return json_write_pretty_get_array_size( - (struct json_array_s *)value->payload, depth, indent_size, newline_size, - size); - case json_type_object: - return json_write_pretty_get_object_size( - (struct json_object_s *)value->payload, depth, indent_size, - newline_size, size); - case json_type_true: - *size += 4; /* the string "true". */ - return 0; - case json_type_false: - *size += 5; /* the string "false". */ - return 0; - case json_type_null: - *size += 4; /* the string "null". */ - return 0; - } -} - -json_weak char *json_write_pretty_value(const struct json_value_s *value, - size_t depth, const char *indent, - const char *newline, char *data); - -json_weak char *json_write_pretty_array(const struct json_array_s *array, - size_t depth, const char *indent, - const char *newline, char *data); -char *json_write_pretty_array(const struct json_array_s *array, size_t depth, - const char *indent, const char *newline, - char *data) { - size_t k, m; - struct json_array_element_s *element; - - *data++ = '['; /* open the array. */ - - if (0 < array->length) { - for (k = 0; '\0' != newline[k]; k++) { - *data++ = newline[k]; - } - - for (element = array->start; json_null != element; - element = element->next) { - if (element != array->start) { - *data++ = ','; /* ','s seperate each element. */ - - for (k = 0; '\0' != newline[k]; k++) { - *data++ = newline[k]; - } - } - - for (k = 0; k < depth + 1; k++) { - for (m = 0; '\0' != indent[m]; m++) { - *data++ = indent[m]; - } - } - - data = json_write_pretty_value(element->value, depth + 1, indent, newline, - data); - - if (json_null == data) { - /* value was malformed! */ - return json_null; - } - } - - for (k = 0; '\0' != newline[k]; k++) { - *data++ = newline[k]; - } - - for (k = 0; k < depth; k++) { - for (m = 0; '\0' != indent[m]; m++) { - *data++ = indent[m]; - } - } - } - - *data++ = ']'; /* close the array. */ - - return data; -} - -json_weak char *json_write_pretty_object(const struct json_object_s *object, - size_t depth, const char *indent, - const char *newline, char *data); -char *json_write_pretty_object(const struct json_object_s *object, size_t depth, - const char *indent, const char *newline, - char *data) { - size_t k, m; - struct json_object_element_s *element; - - *data++ = '{'; /* open the object. */ - - if (0 < object->length) { - for (k = 0; '\0' != newline[k]; k++) { - *data++ = newline[k]; - } - - for (element = object->start; json_null != element; - element = element->next) { - if (element != object->start) { - *data++ = ','; /* ','s seperate each element. */ - - for (k = 0; '\0' != newline[k]; k++) { - *data++ = newline[k]; - } - } - - for (k = 0; k < depth + 1; k++) { - for (m = 0; '\0' != indent[m]; m++) { - *data++ = indent[m]; - } - } - - data = json_write_string(element->name, data); - - if (json_null == data) { - /* string was malformed! */ - return json_null; - } - - /* " : "s seperate each name/value pair. */ - *data++ = ' '; - *data++ = ':'; - *data++ = ' '; - - data = json_write_pretty_value(element->value, depth + 1, indent, newline, - data); - - if (json_null == data) { - /* value was malformed! */ - return json_null; - } - } - - for (k = 0; '\0' != newline[k]; k++) { - *data++ = newline[k]; - } - - for (k = 0; k < depth; k++) { - for (m = 0; '\0' != indent[m]; m++) { - *data++ = indent[m]; - } - } - } - - *data++ = '}'; /* close the object. */ - - return data; -} - -json_weak char *json_write_pretty_value(const struct json_value_s *value, - size_t depth, const char *indent, - const char *newline, char *data); -char *json_write_pretty_value(const struct json_value_s *value, size_t depth, - const char *indent, const char *newline, - char *data) { - switch (value->type) { - default: - /* unknown value type found! */ - return json_null; - case json_type_number: - return json_write_number((struct json_number_s *)value->payload, data); - case json_type_string: - return json_write_string((struct json_string_s *)value->payload, data); - case json_type_array: - return json_write_pretty_array((struct json_array_s *)value->payload, depth, - indent, newline, data); - case json_type_object: - return json_write_pretty_object((struct json_object_s *)value->payload, - depth, indent, newline, data); - case json_type_true: - data[0] = 't'; - data[1] = 'r'; - data[2] = 'u'; - data[3] = 'e'; - return data + 4; - case json_type_false: - data[0] = 'f'; - data[1] = 'a'; - data[2] = 'l'; - data[3] = 's'; - data[4] = 'e'; - return data + 5; - case json_type_null: - data[0] = 'n'; - data[1] = 'u'; - data[2] = 'l'; - data[3] = 'l'; - return data + 4; - } -} - -void *json_write_pretty(const struct json_value_s *value, const char *indent, - const char *newline, size_t *out_size) { - size_t size = 0; - size_t indent_size = 0; - size_t newline_size = 0; - char *data = json_null; - char *data_end = json_null; - - if (json_null == value) { - return json_null; - } - - if (json_null == indent) { - indent = " "; /* default to two spaces. */ - } - - if (json_null == newline) { - newline = "\n"; /* default to linux newlines. */ - } - - while ('\0' != indent[indent_size]) { - ++indent_size; /* skip non-null terminating characters. */ - } - - while ('\0' != newline[newline_size]) { - ++newline_size; /* skip non-null terminating characters. */ - } - - if (json_write_pretty_get_value_size(value, 0, indent_size, newline_size, - &size)) { - /* value was malformed! */ - return json_null; - } - - size += 1; /* for the '\0' null terminating character. */ - - data = (char *)malloc(size); - - if (json_null == data) { - /* malloc failed! */ - return json_null; - } - - data_end = json_write_pretty_value(value, 0, indent, newline, data); - - if (json_null == data_end) { - /* bad chi occurred! */ - free(data); - return json_null; - } - - /* null terminated the string. */ - *data_end = '\0'; - - if (json_null != out_size) { - *out_size = size; - } - - return data; -} - -#if defined(__clang__) -#pragma clang diagnostic pop -#elif defined(_MSC_VER) -#pragma warning(pop) -#endif - -#endif /* SHEREDOM_JSON_H_INCLUDED. */ diff --git a/win-linux/extras/online-installer/src/main.cpp b/win-linux/extras/online-installer/src/main.cpp deleted file mode 100644 index ecbd81afc..000000000 --- a/win-linux/extras/online-installer/src/main.cpp +++ /dev/null @@ -1,70 +0,0 @@ -#include "application.h" -#include "mainwindow.h" -#include -#include "resource.h" -#include "utils.h" -#include "baseutils.h" -#include "translator.h" -#include "../../src/defines.h" -#include "../../src/prop/defines_p.h" - -#define WINDOW_SIZE Size(768, 480) - - -int WINAPI _tWinMain(_In_ HINSTANCE hInst, _In_opt_ HINSTANCE hPrevInstance, _In_ LPTSTR lpCmdLine, _In_ int nCmdShow) -{ - UNREFERENCED_PARAMETER(hPrevInstance); - int num_args = 0; - if (LPTSTR *args = CommandLineToArgvW(lpCmdLine, &num_args)) { - NS_Utils::parseCmdArgs(num_args, args); - LocalFree(args); - } - if (NS_Utils::cmdArgContains(_T("--log"))) - NS_Logger::AllowWriteLog(); - - std::locale::global(std::locale("")); - LCID lcid = MAKELCID(GetUserDefaultUILanguage(), SORT_DEFAULT); - Translator lang(lcid, IDT_TRANSLATIONS); - HANDLE hMutex = CreateMutex(NULL, FALSE, _T(VER_PRODUCTNAME_STR)); - if (GetLastError() == ERROR_ALREADY_EXISTS) { - NS_Utils::ShowMessage(_TR(MSG_ERR_ALREADY_RUNNING)); - return 0; - } - - if (Utils::getWinVersion() < Utils::Win7) { - wstring msg(_TR(MSG_ERR_SYSTEM)); - NS_Utils::Replace(msg, L"%1", _TR(CAPTION)); - NS_Utils::ShowMessage(msg); - CloseHandle(hMutex); - return 0; - } - - if (!NS_Utils::checkAndWaitForAppClosure()) { - CloseHandle(hMutex); - return 0; - } - - wstring path, arch; - bool app_installed = NS_Utils::IsAppInstalled(path, &arch); - - Application app(hInst, lpCmdLine, nCmdShow); - app.setFont(L"Segoe UI"); - if (NS_Utils::IsRtlLanguage(lcid)) - app.setLayoutDirection(LayoutDirection::RightToLeft); - int scrWidth = GetSystemMetrics(SM_CXSCREEN); - int scrHeight = GetSystemMetrics(SM_CYSCREEN); - int x = (scrWidth - WINDOW_SIZE.width) / 2; - int y = (scrHeight - WINDOW_SIZE.height) / 2; - MainWindow w(nullptr, Rect(x, y, WINDOW_SIZE.width, WINDOW_SIZE.height)); - w.onAboutToDestroy([&app]() { - app.exit(0); - }); - if (!app_installed) - w.initInstallationMode(); - else - w.initControlMode(arch); - w.showAll(); - int exit_code = app.exec(); - CloseHandle(hMutex); - return exit_code; -} diff --git a/win-linux/extras/online-installer/src/mainwindow.cpp b/win-linux/extras/online-installer/src/mainwindow.cpp deleted file mode 100644 index 0de45d181..000000000 --- a/win-linux/extras/online-installer/src/mainwindow.cpp +++ /dev/null @@ -1,916 +0,0 @@ -#include "mainwindow.h" -#include "application.h" -#include "utils.h" -#include "checkbox.h" -#include "button.h" -#include "label.h" -#include "boxlayout.h" -#include "radiobutton.h" -#include "progressbar.h" -#include "metrics.h" -#include "palette.h" -#include "caption.h" -#include "resource.h" -#include "translator.h" -#include "cdownloader.h" -#include "baseutils.h" -#include "cjson.h" -#include -#include -#include -#include -#include "../../src/defines.h" -#include "../../src/prop/defines_p.h" - - -template -static void setSelectorStyle(T *sel) // style for CheckBox and RadioButton -{ - sel->metrics()->setMetrics(Metrics::TextMarginLeft, 6); - sel->metrics()->setMetrics(Metrics::TextMarginRight, 6); - sel->metrics()->setMetrics(Metrics::PrimitiveRadius, 1); - sel->metrics()->setMetrics(Metrics::AlternatePrimitiveWidth, 2); - sel->palette()->setColor(Palette::Text, Palette::Disabled, 0x888888); - sel->palette()->setColor(Palette::Text, Palette::Normal, 0x333333); - sel->palette()->setColor(Palette::Text, Palette::Hover, 0x333333); - sel->palette()->setColor(Palette::Text, Palette::Pressed, 0x333333); - sel->palette()->setColor(Palette::Background, Palette::Disabled, 0xfefefe); - sel->palette()->setColor(Palette::Background, Palette::Normal, 0xfefefe); - sel->palette()->setColor(Palette::Background, Palette::Hover, 0xfefefe); - sel->palette()->setColor(Palette::Background, Palette::Pressed, 0xfefefe); - sel->palette()->setColor(Palette::Primitive, Palette::Disabled, 0x888888); - sel->palette()->setColor(Palette::Primitive, Palette::Normal, 0x888888); - sel->palette()->setColor(Palette::Primitive, Palette::Hover, 0x0055ff); - sel->palette()->setColor(Palette::Primitive, Palette::Pressed, 0x0055ff); -} - -static void setButtonStyle(Button *btn) -{ - btn->palette()->setColor(Palette::Text, Palette::Disabled, 0x888888); - btn->palette()->setColor(Palette::Text, Palette::Normal, 0x333333); - btn->palette()->setColor(Palette::Text, Palette::Hover, 0x333333); - btn->palette()->setColor(Palette::Text, Palette::Pressed, 0x333333); - btn->palette()->setColor(Palette::Background, Palette::Disabled, 0xeeeeee); - btn->palette()->setColor(Palette::Background, Palette::Normal, 0xeeeeee); - btn->palette()->setColor(Palette::Background, Palette::Hover, 0xe0e0e0); - btn->palette()->setColor(Palette::Background, Palette::Pressed, 0xd0d0d0); - btn->palette()->setColor(Palette::Border, Palette::Disabled, 0xbebebe); - btn->palette()->setColor(Palette::Border, Palette::Normal, 0xbebebe); - btn->palette()->setColor(Palette::Border, Palette::Hover, 0xbebebe); - btn->palette()->setColor(Palette::Border, Palette::Pressed, 0xbebebe); - btn->metrics()->setMetrics(Metrics::BorderWidth, 1); -} - -static void setProgressStyle(ProgressBar *bar) -{ - bar->palette()->setColor(Palette::Background, Palette::Normal, 0xfefefe); - bar->palette()->setColor(Palette::Base, Palette::Normal, 0xcccccc); - bar->palette()->setColor(Palette::AlternateBase, Palette::Normal, 0x1e7aaa); -} - -static void setLabelStyle(Label *lb) -{ - lb->palette()->setColor(Palette::Background, Palette::Normal, 0xfefefe); - lb->palette()->setColor(Palette::Text, Palette::Normal, 0x888888); -} - -static void setControlLabelStyle(Label *lb) -{ - lb->resize(50, 36); - lb->palette()->setColor(Palette::Background, Palette::Normal, 0xfefefe); - lb->palette()->setColor(Palette::Text, Palette::Normal, 0x333333); - lb->metrics()->setMetrics(Metrics::TextAlignment, Metrics::AlignHLeft | Metrics::AlignVTop); -} - -MainWindow::MainWindow(Widget *parent, const Rect &rc) : - Window(parent, rc), - m_comntLbl(nullptr), - m_versionLbl(nullptr), - m_comntInfoLbl(nullptr), - m_bar(nullptr), - m_launchCheck(nullptr), - m_updRadio(nullptr), - // m_repRadio(nullptr), - m_uninsRadio(nullptr), - m_cancelBtn(nullptr), - m_mode(Mode::Install), - m_resize_conn(0), - m_checkState(UpdateRadio | LaunchCheck), - m_is_checked(false), - m_is_completed(false) -{ - setWindowTitle(_TR(CAPTION)); - setResizable(false); - setIcon(IDI_MAINICON); - palette()->setColor(Palette::Background, Palette::Normal, 0xfefefe); - palette()->setColor(Palette::Border, Palette::Normal, 0x888888); - if (Utils::getWinVersion() > Utils::WinXP && Utils::getWinVersion() < Utils::Win10) - metrics()->setMetrics(Metrics::BorderWidth, 1); - - Widget *cw = new Widget(this); - cw->palette()->setColor(Palette::Background, Palette::Normal, 0xfefefe); - setCentralWidget(cw); - setContentsMargins(0,0,0,0); - - BoxLayout *cenVlut = new BoxLayout(BoxLayout::Vertical); - cenVlut->setContentMargins(0, 0, 0, 0); - cenVlut->setSpacing(0); - cw->setLayout(cenVlut); - - /* Caption section*/ - Widget *topPanel = new Widget(cw); - topPanel->resize(50,28); - topPanel->palette()->setColor(Palette::Background, Palette::Normal, 0xfefefe); - topPanel->setProperty(Widget::HSizeBehavior, Widget::Expanding); - topPanel->setProperty(Widget::VSizeBehavior, Widget::Fixed); - cenVlut->addWidget(topPanel); - - BoxLayout *topHlut = new BoxLayout(BoxLayout::Horizontal); - topHlut->setContentMargins(0, 0, 0, 0); - topHlut->setSpacing(0); - topPanel->setLayout(topHlut); - - Caption *cap = new Caption(topPanel); - cap->setResizingAvailable(false); - cap->palette()->setColor(Palette::Background, Palette::Normal, 0xfefefe); - cap->metrics()->setMetrics(Metrics::TextMarginLeft, 12); - cap->metrics()->setMetrics(Metrics::TextAlignment, Metrics::AlignHLeft| Metrics::AlignVCenter); - cap->resize(50,28); - cap->setProperty(Widget::HSizeBehavior, Widget::Expanding); - cap->setProperty(Widget::VSizeBehavior, Widget::Fixed); - - Button *closeBtn = new Button(topPanel); - closeBtn->resize(40,28); - closeBtn->setProperty(Widget::HSizeBehavior, Widget::Fixed); - closeBtn->setProperty(Widget::VSizeBehavior, Widget::Fixed); - closeBtn->palette()->setColor(Palette::Background, Palette::Normal, 0xfefefe); - closeBtn->palette()->setColor(Palette::Background, Palette::Hover, 0xe81123); - closeBtn->palette()->setColor(Palette::Background, Palette::Pressed, 0x8b0a14); - closeBtn->palette()->setColor(Palette::Background, Palette::Disabled, 0x2b2b2b); - closeBtn->palette()->setColor(Palette::Primitive, Palette::Normal, 0x000000); - closeBtn->metrics()->setMetrics(Metrics::PrimitiveWidth, 1); - closeBtn->setStockIcon(Button::CloseIcon); - closeBtn->setIconSize(10, 10); - closeBtn->onClick([this]() { - close(); - }); - topHlut->addWidget(cap); - topHlut->addWidget(closeBtn); - - /* Central section */ - m_cenPanel = new Widget(cw); - m_cenPanel->palette()->setColor(Palette::Background, Palette::Normal, 0xfefefe); - m_cenPanel->setProperty(Widget::HSizeBehavior, Widget::Expanding); - m_cenPanel->setProperty(Widget::VSizeBehavior, Widget::Expanding); - cenVlut->addWidget(m_cenPanel); - - m_cenPanelVlut = new BoxLayout(BoxLayout::Vertical); - m_cenPanelVlut->setContentMargins(6, 12, 6, 48); - m_cenPanelVlut->setSpacing(6); - m_cenPanel->setLayout(m_cenPanelVlut); -} - -MainWindow::~MainWindow() -{ - if (m_future.valid()) - m_future.wait(); -} - -void MainWindow::initInstallationMode() -{ - m_is_checked = true; - m_mode = Mode::Install; - /* Image section*/ - Label *wlcLbl = new Label(m_cenPanel); - wlcLbl->resize(282, 200); - wlcLbl->setEMFIcon(IDI_WELCOME, 282, 200); - wlcLbl->palette()->setColor(Palette::Background, Palette::Normal, 0xfefefe); - wlcLbl->setProperty(Widget::HSizeBehavior, Widget::Expanding); - wlcLbl->setProperty(Widget::VSizeBehavior, Widget::Fixed); - m_cenPanelVlut->addWidget(wlcLbl); - - /* Check box section*/ - CheckBox *chkBox = new CheckBox(m_cenPanel, _TR(CHECK_SILENT)); - chkBox->setChecked(m_is_checked); - setSelectorStyle(chkBox); - chkBox->adjustSizeBasedOnContent(); - int chkMargin = 2 + (chkBox->metrics()->value(Metrics::IconWidth) + chkBox->metrics()->value(Metrics::TextMarginLeft))/2; - chkBox->move(chkMargin + m_cenPanel->size().width/2 - chkBox->size().width/2, 254); - chkBox->onClick([chkBox, this]() { - m_is_checked = chkBox->isChecked(); - }); - - /* Comment section */ - wstring warn_text = _TR(LABEL_WARN_CLOSE); - NS_Utils::Replace(warn_text, L"%1", _T(WINDOW_NAME)); - Label *comntLbl = new Label(m_cenPanel); - comntLbl->setText(warn_text, true); - comntLbl->setGeometry(0, m_cenPanel->size().height - 130, m_cenPanel->size().width, 48); - setLabelStyle(comntLbl); - - /* Install button section */ - Button *instlBtn = new Button(m_cenPanel); - instlBtn->setText(_TR(BUTTON_INSTALL)); - instlBtn->setGeometry(m_cenPanel->size().width/2 - 50, m_cenPanel->size().height - 76, 100, 28); - setButtonStyle(instlBtn); - instlBtn->onClick([=]() { - m_cenPanel->disconnect(m_resize_conn); - chkBox->close(); - comntLbl->close(); - instlBtn->close(); - startInstall(); - }); - - m_resize_conn = m_cenPanel->onResize([chkBox, comntLbl, instlBtn, chkMargin](int w, int h) { - chkBox->move(chkMargin + w/2 - chkBox->size().width/2, 254); - comntLbl->setGeometry(0, h - 130, w, 48); - instlBtn->setGeometry(w/2 - 50, h - 76, 100, 28); - }); -} - -void MainWindow::initControlMode(const std::wstring &_arch) -{ - m_mode = Mode::Control; - /* Comment section */ - m_versionLbl = new Label(m_cenPanel); - setControlLabelStyle(m_versionLbl); - m_versionLbl->setText(fillInstalledVerInfo()); - m_versionLbl->setProperty(Widget::HSizeBehavior, Widget::Expanding); - m_versionLbl->setProperty(Widget::VSizeBehavior, Widget::Fixed); - m_versionLbl->metrics()->setMetrics(Metrics::TextMarginLeft, 12); - m_cenPanelVlut->setContentMargins(18, 6, 6, 6); - m_cenPanelVlut->addWidget(m_versionLbl); - - if (m_package == _TR(LABEL_UNKN_PACK) || m_ver == _TR(LABEL_UNKN_VER) || _arch.empty() || m_arch != _arch) { - Label *errLbl = new Label(m_cenPanel); - setControlLabelStyle(errLbl); - errLbl->setText(_TR(LABEL_NO_OPTIONS)); - errLbl->setProperty(Widget::HSizeBehavior, Widget::Expanding); - errLbl->setProperty(Widget::VSizeBehavior, Widget::Expanding); - errLbl->metrics()->setMetrics(Metrics::TextMarginLeft, 24); - m_cenPanelVlut->addWidget(errLbl); - return; - } - createSelectionPage(); -} - -bool MainWindow::event(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT *result) -{ - switch (msg) { - case WM_INVOKEMETHOD: { - if (std::function *func = (std::function*)wParam) { - if (*func) - (*func)(); - delete func; - } - break; - } - } - return Window::event(msg, wParam, lParam, result); -} - -void MainWindow::startInstall() -{ - /* Comment section */ - m_comntLbl = new Label(m_cenPanel); - m_comntLbl->setText(_TR(LABEL_DOWNLOAD), true); - m_comntLbl->setGeometry(0, m_cenPanel->size().height - 156, m_cenPanel->size().width, 24); - m_comntLbl->metrics()->setMetrics(Metrics::FontHeight, 20); - setLabelStyle(m_comntLbl); - - m_comntInfoLbl = new Label(m_cenPanel); - m_comntInfoLbl->setText(_TR(LABEL_ALMOST_DONE), true); - m_comntInfoLbl->setGeometry(0, m_cenPanel->size().height - 112, m_cenPanel->size().width, 40); - setLabelStyle(m_comntInfoLbl); - - /* Progress section */ - m_bar = new ProgressBar(m_cenPanel); - m_bar->setGeometry(0, m_cenPanel->size().height - 126, m_cenPanel->size().width, 5); - setProgressStyle(m_bar); - m_bar->metrics()->setMetrics(Metrics::IconMarginLeft, 108); - m_bar->metrics()->setMetrics(Metrics::IconMarginRight, 108); - - m_resize_conn = m_cenPanel->onResize([this](int w, int h) { - m_comntLbl->setGeometry(0, h - 156, w, 24); - m_comntInfoLbl->setGeometry(0, h - 112, w, 40); - m_bar->setGeometry(0, m_cenPanel->size().height - 126, m_cenPanel->size().width, 5); - }); - m_comntLbl->show(); - m_comntInfoLbl->show(); - m_bar->show(); - - wstring path = NS_File::generateTmpFileName(L".exe"); - startDownload(L"iss", NS_Utils::IsWin64() ? _T("x64") : _T("x86"), path, [=]() { - wstring args; - if (m_is_checked) { - args = _T("/VERYSILENT"); - m_comntLbl->setText(_TR(LABEL_INSTALL), true); - m_bar->pulse(true); - } else { - hide(); - } - DWORD status = NS_File::runProcess(path, args); - if (status != 0) { - if (!m_is_checked) - show(); - m_bar->pulse(false); - m_bar->setProgress(0); - m_comntInfoLbl->setText((status & ERROR_LAUNCH) ? _TR(LABEL_ERR_RUNNING) : _TR(LABEL_ERR_COMMON) + wstring(L" ") + std::to_wstring(status), true); - } else { - if (m_is_checked) { - wstring app_path; - if (NS_Utils::IsAppInstalled(app_path)) { - m_cenPanel->disconnect(m_resize_conn); - m_comntLbl->close(); - m_comntInfoLbl->close(); - m_bar->close(); - invokeMethod(&MainWindow::finishInstall, this, app_path); - } else { - m_bar->pulse(false); - m_bar->setProgress(0); - m_comntLbl->setText(_TR(LABEL_ERR_INSTALL), true); - } - } else { - close(); - } - } - }); -} - -void MainWindow::finishInstall(const std::wstring &app_path) -{ - /* Check box section*/ - m_is_checked = true; - CheckBox *chkBox = new CheckBox(m_cenPanel, _TR(CHECK_LAUNCH)); - chkBox->setChecked(m_is_checked); - setSelectorStyle(chkBox); - chkBox->adjustSizeBasedOnContent(); - int chkMargin = 2 + (chkBox->metrics()->value(Metrics::IconWidth) + chkBox->metrics()->value(Metrics::TextMarginLeft))/2; - chkBox->move(chkMargin + m_cenPanel->size().width/2 - chkBox->size().width/2, 254); - chkBox->onClick([chkBox, this]() { - m_is_checked = chkBox->isChecked(); - }); - - /* Comment section */ - wstring compl_text = _TR(LABEL_INSTALL_COMPL); - NS_Utils::Replace(compl_text, L"%1", _T(WINDOW_NAME)); - Label *comntLbl = new Label(m_cenPanel); - comntLbl->setText(compl_text, true); - comntLbl->setGeometry(0, m_cenPanel->size().height - 130, m_cenPanel->size().width, 48); - setLabelStyle(comntLbl); - - /* Install button section */ - Button *closeBtn = new Button(m_cenPanel); - closeBtn->setText(_TR(BUTTON_CLOSE)); - closeBtn->setGeometry(m_cenPanel->size().width/2 - 50, m_cenPanel->size().height - 76, 100, 28); - setButtonStyle(closeBtn); - closeBtn->onClick([=]() { - if (m_is_checked) - NS_File::runProcess(L"explorer.exe", app_path + _T(APP_LAUNCH_NAME), false); - close(); - }); - - m_resize_conn = m_cenPanel->onResize([chkBox, comntLbl, closeBtn, chkMargin](int w, int h) { - chkBox->move(chkMargin + w/2 - chkBox->size().width/2, 254); - comntLbl->setGeometry(0, h - 130, w, 48); - closeBtn->setGeometry(w/2 - 50, h - 76, 100, 28); - }); - chkBox->show(); - comntLbl->show(); - closeBtn->show(); -} - -void MainWindow::startUpdate() -{ - wstring tmp_path; - if (m_package == L"msi") { - wstring prodCode = NS_Utils::MsiProductCode(_T(REG_UNINST_KEY)); - if (prodCode.empty()) - prodCode = NS_Utils::MsiProductCode(_T(REG_GROUP_KEY)); - if (prodCode.empty()) { - m_comntInfoLbl->setText(_TR(LABEL_ERR_PROD_CODE), true); - createCloseAndBackButtons(); - return; - } - wstring packageName = NS_Utils::MsiGetProperty(prodCode.c_str(), INSTALLPROPERTY_PACKAGENAME); - if (packageName.empty()) { - m_comntInfoLbl->setText(_TR(LABEL_ERR_PACK_NAME), true); - createCloseAndBackButtons(); - return; - } - tmp_path = NS_File::toNativeSeparators(NS_File::tempPath() + _T("/") + packageName); - } else { - tmp_path = NS_File::toNativeSeparators(NS_File::generateTmpFileName(L"." + m_package)); - } - - CDownloader *dnl = startDownload(m_package == L"msi" ? L"msi" : L"iss", m_arch, tmp_path, [=]() { - if (!NS_Utils::checkAndWaitForAppClosure(nativeWindowHandle())) { - m_bar->setProgress(0); - m_comntInfoLbl->setText(_TR(LABEL_ERR_CANCELLED), true); - return; - } - m_bar->pulse(true); - m_comntLbl->setText(_TR(LABEL_UPDATING)); - wstring args = L"/c call \"" + tmp_path; - args += (m_package == L"msi") ? L"\" /qn /norestart" : L"\" /UPDATE /VERYSILENT /NOLAUNCH"; - DWORD status = NS_File::runProcess(L"cmd", args, true); - if (status != 0) { - m_bar->pulse(false); - m_bar->setProgress(0); - m_comntInfoLbl->setText((status & ERROR_LAUNCH) ? _TR(LABEL_ERR_RUNNING) : _TR(LABEL_ERR_COMMON) + wstring(L" ") + std::to_wstring(status), true); - } else { - if (m_checkState & ClrDataCheck) { - wstring dataPath = NS_File::appDataPath(); - if (!dataPath.empty()) - NS_File::removeDirRecursively(dataPath); - } - if (m_checkState & ClrStnCheck) { - wstring key(L"SOFTWARE\\"); - key.append(_T(REG_GROUP_KEY)); - SHDeleteKey(HKEY_CURRENT_USER, key.c_str()); - } - m_bar->pulse(false); - m_bar->setProgress(100); - m_comntLbl->setText(_TR(LABEL_UPDATE_COMPL)); - m_versionLbl->setText(fillInstalledVerInfo()); - m_is_completed = true; - } - }); - - m_cancelBtn->onClick([=]() { - dnl->stop(); - }); -} - -// void MainWindow::startRepair() -// { -// wstring tmp_path; -// if (m_package == L"msi") { -// wstring prodCode = NS_Utils::MsiProductCode(_T(REG_UNINST_KEY)); -// if (prodCode.empty()) -// prodCode = NS_Utils::MsiProductCode(_T(REG_GROUP_KEY)); -// if (prodCode.empty()) { -// m_comntInfoLbl->setText(_TR(LABEL_ERR_PROD_CODE), true); -// createCloseAndBackButtons(); -// return; -// } -// wstring packageName = NS_Utils::MsiGetProperty(prodCode.c_str(), INSTALLPROPERTY_PACKAGENAME); -// if (packageName.empty()) { -// m_comntInfoLbl->setText(_TR(LABEL_ERR_PACK_NAME), true); -// createCloseAndBackButtons(); -// return; -// } -// tmp_path = NS_File::toNativeSeparators(NS_File::tempPath() + _T("/") + packageName); -// } else { -// tmp_path = NS_File::toNativeSeparators(NS_File::generateTmpFileName(L"." + m_package)); -// } - -// wstring url = L"https://github.com/%1/%2/releases/download/%3/%4"; -// { -// wstring url_filename = L"DesktopEditors_" + m_arch; -// url_filename.append(L"." + m_package); - -// wstring url_ver = L"v" + m_ver; -// size_t pos = url_ver.find_last_of(L'.'); -// if (pos != std::wstring::npos) -// url_ver = url_ver.substr(0, pos); - -// NS_Utils::Replace(url, L"%1", _T(REG_GROUP_KEY)); -// NS_Utils::Replace(url, L"%2", _T(APP_NAME)); -// NS_Utils::Replace(url, L"%3", url_ver); -// NS_Utils::Replace(url, L"%4", url_filename); -// } - -// CDownloader *dnl = startDownload(m_package == L"msi" ? L"msi" : L"iss", m_arch, tmp_path, [=]() { -// if (!NS_Utils::checkAndWaitForAppClosure(nativeWindowHandle())) { -// m_bar->setProgress(0); -// m_comntInfoLbl->setText(_TR(LABEL_ERR_CANCELLED), true); -// return; -// } -// m_bar->pulse(true); -// wstring cmd = (m_package == L"msi") ? L"msiexec" : L"cmd", -// args = (m_package == L"msi") ? L"/fvamus \"" : L"/c \""; -// args += tmp_path; -// args += (m_package == L"msi") ? L"\" /qn" : L" /VERYSILENT\""; -// DWORD status = NS_File::runProcess(cmd, args, true); -// if (status != 0) { -// m_bar->pulse(false); -// m_bar->setProgress(0); -// m_comntInfoLbl->setText((status & ERROR_LAUNCH) ? _TR(LABEL_ERR_RUNNING) : _TR(LABEL_ERR_COMMON) + wstring(L" ") + std::to_wstring(status), true); -// } else { -// if (m_checkState & ClrDataCheck) { -// wstring dataPath = NS_File::appDataPath(); -// if (!dataPath.empty()) -// NS_File::removeDirRecursively(dataPath); -// } -// if (m_checkState & ClrStnCheck) { -// wstring key(L"SOFTWARE\\"); -// key.append(_T(REG_GROUP_KEY)); -// SHDeleteKey(HKEY_CURRENT_USER, key.c_str()); -// } -// m_bar->pulse(false); -// m_bar->setProgress(100); -// m_comntLbl->setText(_TR(LABEL_REPAIR_COMPL)); -// m_is_completed = true; -// } -// }); - -// m_cancelBtn->onClick([=]() { -// dnl->stop(); -// }); -// } - -void MainWindow::startUninstall() -{ - m_cancelBtn->setDisabled(true); - if (!NS_Utils::checkAndWaitForAppClosure(nativeWindowHandle())) { - m_bar->setProgress(0); - m_comntInfoLbl->setText(_TR(LABEL_ERR_CANCELLED), true); - createCloseAndBackButtons(); - return; - } - m_bar->pulse(true); - wstring args = L"/c \"" + m_uninst_cmd; - args += (m_package == L"msi") ? L" /qn\"" : L" /VERYSILENT\""; - m_future = std::async(std::launch::async, [=]() { - DWORD status = NS_File::runProcess(L"cmd", args, true); - if (status != 0) { - m_bar->pulse(false); - m_bar->setProgress(0); - m_comntInfoLbl->setText(_TR(LABEL_ERR_UNINST)); - createCloseAndBackButtons(); - } else { - if (m_checkState & ClrAllCheck) { - wstring dataPath = NS_File::appDataPath(); - if (!dataPath.empty()) - NS_File::removeDirRecursively(dataPath); - - wstring key(L"SOFTWARE\\"); - key.append(_T(REG_GROUP_KEY)); - SHDeleteKey(HKEY_CURRENT_USER, key.c_str()); - } - m_bar->pulse(false); - m_bar->setProgress(100); - m_comntLbl->setText(_TR(LABEL_UNINST_COMPL)); - // m_is_completed = true; - createCloseButton(); - } - }); -} - -void MainWindow::createSelectionPage() -{ - m_is_completed = false; - /* Check box section*/ - CheckBox *clrChkBox = new CheckBox(m_cenPanel, _TR(CHECK_CLR_DATA)); - clrChkBox->setDisabled(!(m_checkState & UpdateRadio)); - clrChkBox->setChecked(m_checkState & ClrDataCheck); - setSelectorStyle(clrChkBox); - clrChkBox->adjustSizeBasedOnContent(); - clrChkBox->move(79, 80); - clrChkBox->onClick([=]() { - m_checkState = (m_checkState & ~ClrDataCheck) | (clrChkBox->isChecked() * ClrDataCheck); - }); - - CheckBox *stnChkBox = new CheckBox(m_cenPanel, _TR(CHECK_CLR_STNGS)); - stnChkBox->setDisabled(!(m_checkState & UpdateRadio)); - stnChkBox->setChecked(m_checkState & ClrStnCheck); - setSelectorStyle(stnChkBox); - stnChkBox->adjustSizeBasedOnContent(); - stnChkBox->move(79, 112); - stnChkBox->onClick([stnChkBox, this]() { - m_checkState = (m_checkState & ~ClrStnCheck) | (stnChkBox->isChecked() * ClrStnCheck); - }); - - CheckBox *clrAllChkBox = new CheckBox(m_cenPanel, _TR(CHECK_CLR_ALL)); - clrAllChkBox->setDisabled(!(m_checkState & UninstRadio)); - clrAllChkBox->setChecked(m_checkState & ClrAllCheck); - setSelectorStyle(clrAllChkBox); - clrAllChkBox->adjustSizeBasedOnContent(); - clrAllChkBox->move(79, 182); - clrAllChkBox->onClick([clrAllChkBox, this]() { - m_checkState = (m_checkState & ~ClrAllCheck) | (clrAllChkBox->isChecked() * ClrAllCheck); - }); - - /* Update radio button section*/ - m_updRadio = new RadioButton(m_cenPanel, _TR(RADIO_UPDATE)); - m_updRadio->setChecked(m_checkState & UpdateRadio); - setSelectorStyle(m_updRadio); - m_updRadio->adjustSizeBasedOnContent(); - m_updRadio->move(50, 48); - m_updRadio->onClick([=]() { - clrChkBox->setDisabled(false); - stnChkBox->setDisabled(false); - clrAllChkBox->setDisabled(true); - // if (m_repRadio->isChecked()) - // m_repRadio->setChecked(false); - if (m_uninsRadio->isChecked()) - m_uninsRadio->setChecked(false); - m_checkState = (m_checkState | UpdateRadio) & ~(RepairRadio | UninstRadio); - }); - - /* Repair radio button section*/ - // m_repRadio = new RadioButton(m_cenPanel, _TR(RADIO_REPAIR)); - // m_repRadio->setChecked(m_checkState & RepairRadio); - // setSelectorStyle(m_repRadio); - // m_repRadio->adjustSizeBasedOnContent(); - // m_repRadio->move(50, 82); - // m_repRadio->onClick([=]() { - // clrChkBox->setDisabled(false); - // stnChkBox->setDisabled(false); - // clrAllChkBox->setDisabled(true); - // if (m_updRadio->isChecked()) - // m_updRadio->setChecked(false); - // if (m_uninsRadio->isChecked()) - // m_uninsRadio->setChecked(false); - // m_checkState = (m_checkState | RepairRadio) & ~(UninstRadio | UpdateRadio); - // }); - - /* Uninstall radio button section*/ - m_uninsRadio = new RadioButton(m_cenPanel, _TR(RADIO_UNINST)); - m_uninsRadio->setChecked(m_checkState & UninstRadio); - setSelectorStyle(m_uninsRadio); - m_uninsRadio->adjustSizeBasedOnContent(); - m_uninsRadio->move(50, 150); - m_uninsRadio->onClick([=]() { - clrChkBox->setDisabled(true); - stnChkBox->setDisabled(true); - clrAllChkBox->setDisabled(false); - // if (m_repRadio->isChecked()) - // m_repRadio->setChecked(false); - if (m_updRadio->isChecked()) - m_updRadio->setChecked(false); - m_checkState = (m_checkState | UninstRadio) & ~(UpdateRadio | RepairRadio); - }); - - /* Apply button section */ - Button *applyBtn = new Button(m_cenPanel); - applyBtn->setText(_TR(BUTTON_APPLY)); - applyBtn->setGeometry(m_cenPanel->size().width - 100 - 12, m_cenPanel->size().height - 28 - 12, 100, 28); - setButtonStyle(applyBtn); - applyBtn->onClick([=]() { - wstring msg = m_uninsRadio->isChecked() ? _TR(MSG_REMOVE) : /*m_repRadio->isChecked() ? _TR(MSG_REPAIR) :*/ _TR(MSG_UPDATE); - NS_Utils::Replace(msg, L"%1", _T(WINDOW_NAME)); - if (IDOK == NS_Utils::ShowTaskDialog(nativeWindowHandle(), msg.c_str(), TD_WARNING_ICON)) { - if (!NS_Utils::checkAndWaitForAppClosure(nativeWindowHandle())) - return; - m_cenPanel->disconnect(m_resize_conn); - m_updRadio->close(); - // m_repRadio->close(); - clrChkBox->close(); - stnChkBox->close(); - m_uninsRadio->close(); - clrAllChkBox->close(); - applyBtn->close(); - msg = m_uninsRadio->isChecked() ? _TR(LABEL_UNINSTLING) : /*m_repRadio->isChecked() ? _TR(LABEL_REPAIRING) :*/ _TR(LABEL_DOWNLOAD); - createProgressPage(msg); - if (m_updRadio->isChecked() /*|| m_repRadio->isChecked()*/) { - /* Check box section*/ - m_launchCheck = new CheckBox(m_cenPanel, _TR(CHECK_LAUNCH)); - m_launchCheck->setChecked(m_checkState & LaunchCheck); - setSelectorStyle(m_launchCheck); - m_launchCheck->adjustSizeBasedOnContent(); - m_launchCheck->move(42, 100); - m_launchCheck->onClick([this]() { - m_checkState = (m_checkState & ~LaunchCheck) | (m_launchCheck->isChecked() * LaunchCheck); - }); - } - if (m_uninsRadio->isChecked()) - startUninstall(); - else - // if (m_repRadio->isChecked()) - // startRepair(); - // else - startUpdate(); - } - }); - m_resize_conn = m_cenPanel->onResize([applyBtn](int w, int h) { - applyBtn->setGeometry(w - 100 - 12, h - 28 - 12, 100, 28); - }); - m_updRadio->show(); - // m_repRadio->show(); - clrChkBox->show(); - stnChkBox->show(); - m_uninsRadio->show(); - clrAllChkBox->show(); - applyBtn->show(); -} - -void MainWindow::createProgressPage(const std::wstring &text) -{ - m_comntLbl = new Label(m_cenPanel); - setControlLabelStyle(m_comntLbl); - m_comntLbl->setText(text); - m_comntLbl->metrics()->setMetrics(Metrics::TextMarginLeft, 12); - m_comntLbl->setGeometry(30, 50, size().width - 30, 24); - - m_comntInfoLbl = new Label(m_cenPanel); - setControlLabelStyle(m_comntInfoLbl); - m_comntInfoLbl->metrics()->setMetrics(Metrics::TextMarginLeft, 12); - m_comntInfoLbl->setGeometry(30, 92, m_cenPanel->size().width - 30, 40); - - /* Progress section */ - m_bar = new ProgressBar(m_cenPanel); - m_bar->setGeometry(42, 80, 250, 5); - setProgressStyle(m_bar); - - m_cancelBtn = new Button(m_cenPanel); - m_cancelBtn->setText(_TR(BUTTON_CANCEL)); - m_cancelBtn->setGeometry(m_cenPanel->size().width - 100 - 12, m_cenPanel->size().height - 28 - 12, 100, 28); - setButtonStyle(m_cancelBtn); - m_resize_conn = m_cenPanel->onResize([this](int w, int h) { - m_cancelBtn->setGeometry(w - 100 - 12, h - 28 - 12, 100, 28); - }); - - m_comntLbl->show(); - m_comntInfoLbl->show(); - m_bar->show(); - m_cancelBtn->show(); -} - -void MainWindow::createCloseButton() -{ - invokeMethod([=]() { - m_cenPanel->disconnect(m_resize_conn); - m_cancelBtn->close(); - Button *closeBtn = new Button(m_cenPanel); - closeBtn->setText(_TR(BUTTON_CLOSE)); - closeBtn->setGeometry(m_cenPanel->size().width - 100 - 12, m_cenPanel->size().height - 28 - 12, 100, 28); - setButtonStyle(closeBtn); - closeBtn->onClick([=]() { - m_cenPanel->disconnect(m_resize_conn); - close(); - }); - m_resize_conn = m_cenPanel->onResize([closeBtn](int w, int h) { - closeBtn->setGeometry(w - 100 - 12, h - 28 - 12, 100, 28); - }); - closeBtn->show(); - }); -} - -void MainWindow::createCloseAndBackButtons() -{ - invokeMethod([=]() { - m_cenPanel->disconnect(m_resize_conn); - m_cancelBtn->close(); - - if (m_launchCheck) { - if (m_is_completed) { - m_comntInfoLbl->hide(); - m_launchCheck->show(); - } else { - m_launchCheck->close(); - m_launchCheck = nullptr; - } - } - - Button *closeBtn = new Button(m_cenPanel); - closeBtn->setText(_TR(BUTTON_CLOSE)); - closeBtn->setGeometry(m_cenPanel->size().width - 100 - 12, m_cenPanel->size().height - 28 - 12, 100, 28); - setButtonStyle(closeBtn); - closeBtn->onClick([=]() { - m_cenPanel->disconnect(m_resize_conn); - if (m_launchCheck && m_is_completed && (m_checkState & LaunchCheck)) { - wstring app_path; - if (NS_Utils::IsAppInstalled(app_path)) - NS_File::runProcess(L"explorer.exe", app_path + _T(APP_LAUNCH_NAME), false); - } - close(); - }); - - Button *backBtn = new Button(m_cenPanel); - backBtn->setText(_TR(BUTTON_BACK)); - backBtn->setGeometry(m_cenPanel->size().width - 100 - 12 - 106, m_cenPanel->size().height - 28 - 12, 100, 28); - setButtonStyle(backBtn); - backBtn->onClick([=]() { - m_cenPanel->disconnect(m_resize_conn); - if (m_launchCheck) { - m_launchCheck->close(); - m_launchCheck = nullptr; - } - m_comntLbl->close(); - m_comntInfoLbl->close(); - m_bar->close(); - closeBtn->close(); - backBtn->close(); - createSelectionPage(); - }); - - m_resize_conn = m_cenPanel->onResize([closeBtn, backBtn](int w, int h) { - closeBtn->setGeometry(w - 100 - 12, h - 28 - 12, 100, 28); - backBtn->setGeometry(w - 100 - 12 - 106, h - 28 - 12, 100, 28); - }); - - closeBtn->show(); - backBtn->show(); - }); -} - -wstring MainWindow::fillInstalledVerInfo() -{ - wstring text = _TR(LABEL_VERSION); - NS_Utils::InstalledVerInfo(L"DisplayVersion", m_ver, m_arch); - if (m_ver.empty()) - m_ver = _TR(LABEL_UNKN_VER); - - NS_Utils::InstalledVerInfo(L"UninstallString", m_uninst_cmd, m_arch); - m_package = (m_uninst_cmd.find(L"msiexec") != std::wstring::npos) ? L"msi" : (m_uninst_cmd.find(L".exe") != std::wstring::npos) ? L"exe" : _TR(LABEL_UNKN_PACK); - - NS_Utils::Replace(text, L"%1", _T(WINDOW_NAME)); - NS_Utils::Replace(text, L"%2", m_ver); - NS_Utils::Replace(text, L"%3", m_arch); - NS_Utils::Replace(text, L"%4", m_package); - return text; -} - -CDownloader* MainWindow::startDownload(const std::wstring &install_type, const std::wstring &arch, const std::wstring &path, const std::function &onComplete) -{ - wstring appcast_url = NS_Utils::cmdArgContains(_T("--appcast-dev-channel")) ? _T(URL_INSTALL_DEV) : _T(URL_INSTALL); - wstring tmp_path = NS_File::toNativeSeparators(NS_File::generateTmpFileName(L".json")); - NS_Logger::WriteLog(_T("\nAppcast URL:\n") + appcast_url); - CDownloader *dnl = new CDownloader(); - dnl->onComplete([=](ulong error) { - if (error == ERROR_SUCCESS) { - list lst; - if (NS_File::readFile(tmp_path, lst)) { - tstring json = std::accumulate(lst.begin(), lst.end(), tstring()); - JsonDocument doc(json); - JsonObject root = doc.object(); - - // tstring version = root.value(_T("version")).toTString(); - JsonObject package = root.value(_T("package")).toObject(); -#ifdef _WIN32 - JsonObject win = package.value(arch == _T("x64") ? _T("win_64") : _T("win_32")).toObject(); -#else - JsonObject win = package.value(_T("linux_64")).toObject(); -#endif - JsonObject package_type = win.value(install_type).toObject(); - tstring url = package_type.value(_T("url")).toTString(); - tstring url2 = package_type.value(_T("url2")).toTString(); - NS_Logger::WriteLog(_T("\nPrimary package URL:\n") + url + _T("\nSecondary package URL:\n") + url2); - if ((url.empty() || !dnl->isUrlAccessible(url)) && !url2.empty()) - url = url2; - NS_Logger::WriteLog(_T("\nDownload from URL:\n") + url); - // tstring hash = package_type.value(_T("md5")).toTString(); - // std::transform(hash.begin(), hash.end(), hash.begin(), ::tolower); - NS_File::removeFile(tmp_path); - - invokeMethod([=]() { - dnl->stop(); - dnl->onProgress([=](int percent) { - m_bar->setProgress(percent); - }); - dnl->onComplete([=](ulong error) { - if (m_mode == Mode::Control) - m_cancelBtn->setDisabled(true); - if (error == ERROR_SUCCESS) { - if (NS_File::verifyEmbeddedSignature(path)) { - onComplete(); - } else { - m_bar->setProgress(0); - m_comntInfoLbl->setText(_TR(LABEL_NO_VER_AVAIL), true); - } - if (NS_File::fileExists(path)) - NS_File::removeFile(path); - } else - if (error == ERROR_CANCELLED) { - m_comntInfoLbl->setText(_TR(LABEL_ERR_CANCELLED), true); - } else { - m_comntInfoLbl->setText(NS_Utils::GetLastErrorAsString(error), true); - } - - if (m_mode == Mode::Control) - createCloseAndBackButtons(); - }); - dnl->downloadFile(url, path); - }); - } else { - NS_File::removeFile(tmp_path); - m_comntInfoLbl->setText(_TR(LABEL_ERR_COMMON), true); - if (m_mode == Mode::Control) - createCloseAndBackButtons(); - } - } else - if (error == ERROR_CANCELLED) { - m_comntInfoLbl->setText(_TR(LABEL_ERR_CANCELLED), true); - if (m_mode == Mode::Control) - createCloseAndBackButtons(); - } else { - m_comntInfoLbl->setText(NS_Utils::GetLastErrorAsString(error), true); - if (m_mode == Mode::Control) - createCloseAndBackButtons(); - } - }); - dnl->downloadFile(appcast_url, tmp_path); - onAboutToDestroy([=]() { - delete dnl; - }); - return dnl; -} - -template -void MainWindow::invokeMethod(Fn&& fn, Args&&... args) -{ - std::function *func = new std::function(std::bind(std::forward(fn), std::forward(args)...)); - PostMessage(m_hWnd, WM_INVOKEMETHOD, (WPARAM)func, 0); -} // NOLINT diff --git a/win-linux/extras/online-installer/src/mainwindow.h b/win-linux/extras/online-installer/src/mainwindow.h deleted file mode 100644 index a3ee707e0..000000000 --- a/win-linux/extras/online-installer/src/mainwindow.h +++ /dev/null @@ -1,68 +0,0 @@ -#ifndef MAINWINDOW_H -#define MAINWINDOW_H - -#include "window.h" -#include - - -class Label; -class ProgressBar; -class Widget; -class BoxLayout; -class CheckBox; -class RadioButton; -class Button; -class CDownloader; -class MainWindow : public Window -{ -public: - MainWindow(Widget *parent, const Rect &rc); - ~MainWindow(); - - void initInstallationMode(); - void initControlMode(const std::wstring &arch); - -protected: - virtual bool event(UINT, WPARAM, LPARAM, LRESULT*) override; - -private: - void startInstall(); - void finishInstall(const std::wstring &app_path); - void startUpdate(); - // void startRepair(); - void startUninstall(); - void createSelectionPage(); - void createProgressPage(const std::wstring &text); - void createCloseButton(); - void createCloseAndBackButtons(); - std::wstring fillInstalledVerInfo(); - CDownloader* startDownload(const std::wstring &install_type, const std::wstring &arch, const std::wstring &path, const std::function &onComplete); - template - void invokeMethod(Fn&& fn, Args&&... args); - - enum class Mode : BYTE {Install, Control}; - enum Selectors : BYTE {UpdateRadio = 1, RepairRadio = 2, UninstRadio = 4, ClrDataCheck = 8, ClrStnCheck = 16, ClrAllCheck = 32, LaunchCheck = 64}; - std::future m_future; - std::wstring m_uninst_cmd, - m_ver, - m_arch, - m_package; - Label *m_comntLbl, - *m_versionLbl, - *m_comntInfoLbl; - ProgressBar *m_bar; - Widget *m_cenPanel; - BoxLayout *m_cenPanelVlut; - CheckBox *m_launchCheck; - RadioButton *m_updRadio, - // *m_repRadio, - *m_uninsRadio; - Button *m_cancelBtn; - Mode m_mode; - int m_resize_conn; - BYTE m_checkState; - bool m_is_checked, - m_is_completed; -}; - -#endif // MAINWINDOW_H diff --git a/win-linux/extras/online-installer/src/resource.h b/win-linux/extras/online-installer/src/resource.h deleted file mode 100644 index 5fceb8471..000000000 --- a/win-linux/extras/online-installer/src/resource.h +++ /dev/null @@ -1,53 +0,0 @@ -#include "version.h" - -#define IDI_MAINICON 101 -#define IDI_WELCOME 102 - -#define IDT_TRANSLATIONS 10001 - -#define APP_LAUNCH_NAME "\\DesktopEditors.exe" - -#define CAPTION -#define MSG_ERR_SYSTEM -#define MSG_ERR_ALREADY_RUNNING -#define MSG_ERR_TRY_CLOSE_APP -#define MSG_ERR_CLOSE_APP -#define MSG_REMOVE -#define MSG_REPAIR -#define MSG_UPDATE -#define LABEL_DOWNLOAD -#define LABEL_INSTALL -#define LABEL_UPDATING -#define LABEL_REPAIRING -#define LABEL_UNINSTLING -#define LABEL_UPDATE_COMPL -#define LABEL_REPAIR_COMPL -#define LABEL_UNINST_COMPL -#define LABEL_VERSION -#define LABEL_UNKN_VER -#define LABEL_UNKN_PACK -#define LABEL_NO_OPTIONS -#define LABEL_NO_VER_AVAIL -#define LABEL_WARN_CLOSE -#define LABEL_ALMOST_DONE -#define LABEL_INSTALL_COMPL -#define LABEL_ERR_PROD_CODE -#define LABEL_ERR_PACK_NAME -#define LABEL_ERR_INSTALL -#define LABEL_ERR_UNINST -#define LABEL_ERR_COMMON -#define LABEL_ERR_RUNNING -#define LABEL_ERR_CANCELLED -#define BUTTON_INSTALL -#define BUTTON_CANCEL -#define BUTTON_APPLY -#define BUTTON_CLOSE -#define BUTTON_BACK -#define RADIO_UPDATE -// #define RADIO_REPAIR -#define RADIO_UNINST -#define CHECK_SILENT -#define CHECK_LAUNCH -#define CHECK_CLR_DATA -#define CHECK_CLR_STNGS -#define CHECK_CLR_ALL diff --git a/win-linux/extras/online-installer/src/translator.cpp b/win-linux/extras/online-installer/src/translator.cpp deleted file mode 100644 index 4915a2699..000000000 --- a/win-linux/extras/online-installer/src/translator.cpp +++ /dev/null @@ -1,270 +0,0 @@ - -#define WIN32_LEAN_AND_MEAN -#include "translator.h" -#include "resource.h" -#include "utils.h" -#include -#include -#include -#include -#include - - -bool isSeparator(wchar_t c) -{ - return c == L' ' || c == L'\t' || c == L'\r' || c == L'\n'; -} - -bool isValidStringIdCharacter(wchar_t c) -{ - return std::iswalnum(c) || std::iswalpha(c) || c == L'_'; -} - -bool isValidLocaleCharacter(wchar_t c) -{ - return iswalpha(c) || c == L'_'; -} - -wstring getPrimaryLang(const wstring &lang, bool withScript = false) -{ - if (lang.empty()) { - NS_Logger::WriteLog(_T("An error occurred:\n") + wstring(_T(__FUNCTION__))); - return L"en"; - } - std::wistringstream iss(lang); - wstring primlang, script; - std::getline(iss, primlang, L'_'); - if (primlang.length() == 2 || primlang.length() == 3) { - if (!withScript) - return primlang; - std::getline(iss, script, L'_'); - return (script.length() == 4) ? primlang + L"_" + script : primlang; - } - NS_Logger::WriteLog(_T("An error occurred:\n") + wstring(_T(__FUNCTION__))); - return L"en"; -} - -wstring StrToWStr(const string &str) -{ - std::wstring_convert> converter; - return converter.from_bytes(str); -} - -TranslationsMap Translator::translMap = TranslationsMap(); -wstring Translator::langName = _T("en_EN"); -bool Translator::is_translations_valid = false; - -Translator::Translator(unsigned long langId, int resourceId) -{ - TCHAR _langName[LOCALE_NAME_MAX_LENGTH] = {0}; - if (GetLocaleInfo(langId, LOCALE_SNAME, _langName, LOCALE_NAME_MAX_LENGTH) > 0) { - langName = _langName; - std::replace(langName.begin(), langName.end(), L'-', L'_'); - } else - NS_Logger::WriteLog(ADVANCED_ERROR_MESSAGE); - - NS_Logger::WriteLog(_T("\nCurrent locale:\n") + langName); - - HMODULE hInst = GetModuleHandle(NULL); - if (HRSRC hRes = FindResource(hInst, MAKEINTRESOURCE(resourceId), RT_RCDATA)) { - if (HGLOBAL hResData = LoadResource(hInst, hRes)) { - if (LPVOID pData = LockResource(hResData)) { - DWORD dataSize = SizeofResource(hInst, hRes); - if (dataSize > 0) { - string text((const char*)pData, dataSize); - translations = StrToWStr(text); - } else - NS_Logger::WriteLog(ADVANCED_ERROR_MESSAGE); - } else - NS_Logger::WriteLog(ADVANCED_ERROR_MESSAGE); - FreeResource(hResData); - } else - NS_Logger::WriteLog(ADVANCED_ERROR_MESSAGE); - } else - NS_Logger::WriteLog(ADVANCED_ERROR_MESSAGE); - - if (!translations.empty()) { - parseTranslations(); - if (!is_translations_valid) - NS_Logger::WriteLog(_T("Cannot parse translations, error in string:\n") + error_substr + L" <---"); - } else - NS_Logger::WriteLog(_T("Error: translations is empty.")); -} - -Translator::~Translator() -{ - -} - -wstring Translator::tr(const char *str) -{ - wstring translatedStr = StrToWStr(str); - if (is_translations_valid) { - for (auto &strIdPair : translMap) { - //LocaleMap locMap = strIdPair.second; - // for (LocaleMap::const_iterator it = strIdPair.second.begin(); it != strIdPair.second.end(); ++it) { - //wcout << L"\n\n" << translatedStr << L"\n" << it->second; - if (strIdPair.first == translatedStr) { - if (strIdPair.second.find(langName) != strIdPair.second.end()) - return strIdPair.second[langName]; - else { - wstring primaryLangAndScript = getPrimaryLang(langName, true); - if (strIdPair.second.find(primaryLangAndScript) != strIdPair.second.end()) - return strIdPair.second[primaryLangAndScript]; - else { - wstring primaryLang = getPrimaryLang(langName); - if (strIdPair.second.find(primaryLang) != strIdPair.second.end()) - return strIdPair.second[primaryLang]; - } - } - if (strIdPair.second.find(L"en") != strIdPair.second.end()) - return strIdPair.second[L"en"]; - break; - } - // } - } - } - return translatedStr; -} - -void Translator::parseTranslations() -{ - int token = TOKEN_BEGIN_DOCUMENT; - wstring stringId, currentLocale; - size_t pos = 0, len = translations.length(); - while (pos < len) { - size_t incr = 1; - wchar_t ch = translations.at(pos); - - switch (token) { - case TOKEN_BEGIN_DOCUMENT: - case TOKEN_END_VALUE: - if (!isSeparator(ch)) { - if (ch == L';') { - // string is comment - size_t end = translations.find_first_of(L'\n', pos); - incr = (end == wstring::npos) ? len - pos : end - pos + 1; - } else { - size_t end; - for (end = pos; end < len; end++) { - wchar_t c = translations.at(end); - if (!isValidLocaleCharacter(c)) - break; - } - size_t locale_len = end - pos; - if (locale_len < 12 && locale_len != 0 && locale_len != 1 && locale_len != 4 && locale_len != 9) { - token = TOKEN_BEGIN_LOCALE; - continue; - } else { - // TOKEN_ERROR - error_substr = translations.substr(0, pos + 1); - return; - } - } - } - break; - - case TOKEN_BEGIN_STRING_ID: - if (!isSeparator(ch)) { - size_t end; - wchar_t c; - for (end = pos; end < len; end++) { - c = translations.at(end); - if (!isValidStringIdCharacter(c)) - break; - } - c = translations.at(end); - if (end < len && !isSeparator(c) && c != L'=') { - // TOKEN_ERROR - error_substr = translations.substr(0, end + 1); - return; - } - stringId = translations.substr(pos, end - pos); - if (!stringId.empty() && translMap.find(stringId) == translMap.end()) - translMap[stringId] = LocaleMap(); - - token = TOKEN_END_STRING_ID; - incr = end - pos; - } - break; - - case TOKEN_END_STRING_ID: - if (!isSeparator(ch)) { - if (ch == L'=') { - token = TOKEN_BEGIN_VALUE; - } else { - // TOKEN_ERROR - error_substr = translations.substr(0, pos + 1); - return; - } - } - break; - - case TOKEN_BEGIN_LOCALE: { - size_t end; - for (end = pos; end < len; end++) { - wchar_t c = translations.at(end); - if (!isValidLocaleCharacter(c)) - break; - } - size_t locale_len = end - pos; - currentLocale = translations.substr(pos, locale_len); - if (pos + locale_len == len) { - error_substr = translations.substr(0, pos + locale_len); - return; - } - token = TOKEN_END_LOCALE; - incr = locale_len; - break; - } - - case TOKEN_END_LOCALE: - if (!isSeparator(ch)) { - if (ch == L'.') { - token = TOKEN_BEGIN_STRING_ID; - } else { - // TOKEN_ERROR - error_substr = translations.substr(0, pos + 1); - return; - } - } - break; - - case TOKEN_BEGIN_VALUE: { - size_t end = translations.find_first_of(L'\n', pos); - wstring val; - if (end == wstring::npos) { - val = translations.substr(pos); - incr = len - pos; - } else { - val = translations.substr(pos, end - pos); - incr = end - pos; - } - - if (!val.empty() && val.back() == L'\r') - val.pop_back(); - - size_t p = val.find(L"\\n"); - while (p != std::string::npos) { - val.replace(p, 2, L"\\"); - val[p] = L'\n'; - p = val.find(L"\\n", p + 1); - } - if (!currentLocale.empty() && translMap.find(stringId) != translMap.end()) - translMap[stringId][currentLocale] = val; - - token = TOKEN_END_VALUE; - break; - } - - default: - break; - } - pos += incr; - if (pos == len) - token = TOKEN_END_DOCUMENT; - } - - if (token == TOKEN_END_DOCUMENT) - is_translations_valid = true; -} diff --git a/win-linux/extras/online-installer/src/translator.h b/win-linux/extras/online-installer/src/translator.h deleted file mode 100644 index ff83841fa..000000000 --- a/win-linux/extras/online-installer/src/translator.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef TRANSLATOR_H -#define TRANSLATOR_H - -#include -#include -#include - -#define _TR(str) Translator::tr(#str).c_str() - -using std::wstring; -using std::unordered_map; - -typedef unordered_map LocaleMap; -typedef unordered_map TranslationsMap; - - -class Translator -{ -public: - Translator(unsigned long langId, int resourceId); - ~Translator(); - - static wstring tr(const char*); - -private: - void parseTranslations(); - - static TranslationsMap translMap; - wstring translations, - error_substr; - static wstring langName; - static bool is_translations_valid; - - enum TokenType : unsigned char { - TOKEN_BEGIN_DOCUMENT = 0, - TOKEN_END_DOCUMENT, - TOKEN_BEGIN_STRING_ID, - TOKEN_END_STRING_ID, - TOKEN_BEGIN_LOCALE, - TOKEN_END_LOCALE, - TOKEN_BEGIN_VALUE, - TOKEN_END_VALUE - }; -}; - -#endif // TRANSLATOR_H diff --git a/win-linux/extras/online-installer/src/uiclasses/abstractbutton.cpp b/win-linux/extras/online-installer/src/uiclasses/abstractbutton.cpp deleted file mode 100644 index c8a786f7c..000000000 --- a/win-linux/extras/online-installer/src/uiclasses/abstractbutton.cpp +++ /dev/null @@ -1,103 +0,0 @@ -#include "abstractbutton.h" -#include "palette.h" -#include "metrics.h" -#include - - -AbstractButton::AbstractButton(Widget *parent, const std::wstring &text) : - Widget(parent, ObjectType::WidgetType), - m_text(text) -{ - -} - -AbstractButton::~AbstractButton() -{ - -} - -void AbstractButton::setText(const std::wstring &text) -{ - m_text = text; - update(); -} - -void AbstractButton::adjustSizeBasedOnContent() -{ - HDC hdc = GetDC(nativeWindowHandle()); - Gdiplus::Graphics gr(hdc); - LOGFONTW logFont = {0}; - GetObject(m_hFont, sizeof(LOGFONTW), &logFont); - Gdiplus::Font font(hdc, &logFont); - Gdiplus::RectF lutRc, boxRc; - gr.MeasureString(m_text.c_str(), m_text.length(), &font, lutRc, &boxRc); - ReleaseDC(nativeWindowHandle(), hdc); - int w = boxRc.Width + 2*metrics()->value(Metrics::IconWidth) + metrics()->value(Metrics::TextMarginLeft) + metrics()->value(Metrics::TextMarginRight); - int h = max(boxRc.Height + metrics()->value(Metrics::TextMarginTop) + metrics()->value(Metrics::TextMarginBottom), metrics()->value(Metrics::IconHeight)); - resize(w, h); -} - -int AbstractButton::onClick(const FnVoidVoid &callback) -{ - m_click_callbacks[++m_connectionId] = callback; - return m_connectionId; -} - -void AbstractButton::disconnect(int connectionId) -{ - auto it = m_click_callbacks.find(connectionId); - if (it != m_click_callbacks.end()) - m_click_callbacks.erase(it); -} - -bool AbstractButton::event(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT *result) -{ - switch (msg) { - case WM_LBUTTONDOWN: { - if (!m_disabled) { - palette()->setCurrentState(Palette::Pressed); - repaint(); - } - return false; - } - - case WM_LBUTTONUP: { - if (!m_disabled) { - palette()->setCurrentState(Palette::Hover); - repaint(); - click(); - } - break; - } - - case WM_MOUSEENTER: { - if (!m_disabled) { - palette()->setCurrentState(Palette::Hover); - repaint(); - } - break; - } - - case WM_MOUSELEAVE: { - if (!m_disabled) { - palette()->setCurrentState(Palette::Normal); - repaint(); - } - break; - } - - default: - break; - } - return Widget::event(msg, wParam, lParam, result); -} - -void AbstractButton::click() -{ - if (underMouse()) { - for (auto it = m_click_callbacks.begin(); it != m_click_callbacks.end(); it++) { - if (it->second) - (it->second)(); - } - } -} diff --git a/win-linux/extras/online-installer/src/uiclasses/abstractbutton.h b/win-linux/extras/online-installer/src/uiclasses/abstractbutton.h deleted file mode 100644 index 54ea998b5..000000000 --- a/win-linux/extras/online-installer/src/uiclasses/abstractbutton.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef ABSTRACTBUTTON_H -#define ABSTRACTBUTTON_H - -#include "widget.h" -#include - - -class AbstractButton : public Widget -{ -public: - AbstractButton(Widget *parent = nullptr, const std::wstring &text = L""); - virtual ~AbstractButton(); - - void setText(const std::wstring &text); - void adjustSizeBasedOnContent(); - - /* callback */ - int onClick(const FnVoidVoid &callback); - virtual void disconnect(int) override; - -protected: - virtual bool event(UINT, WPARAM, LPARAM, LRESULT*) override; - virtual void click(); - - std::wstring m_text; - -private: - std::unordered_map m_click_callbacks; -}; - -#endif // ABSTRACTBUTTON_H diff --git a/win-linux/extras/online-installer/src/uiclasses/application.cpp b/win-linux/extras/online-installer/src/uiclasses/application.cpp deleted file mode 100644 index ec2525098..000000000 --- a/win-linux/extras/online-installer/src/uiclasses/application.cpp +++ /dev/null @@ -1,191 +0,0 @@ -#include "application.h" -#include "widget.h" -#include "src/resource.h" -#include - - -class Application::ApplicationPrivate -{ -public: - ApplicationPrivate(); - ~ApplicationPrivate(); - - std::wstring font; - ULONG_PTR gdi_token; - HINSTANCE hInstance; - LayoutDirection layoutDirection; - int windowId; - ATOM registerClass(LPCWSTR className, HINSTANCE hInstance); - static LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); -}; - -Application::ApplicationPrivate::ApplicationPrivate() : - gdi_token(0), - hInstance(nullptr), - layoutDirection(LayoutDirection::LeftToRight), - windowId(0) -{ - Gdiplus::GdiplusStartupInput gdiplusStartupInput; - Gdiplus::GdiplusStartup(&gdi_token, &gdiplusStartupInput, nullptr); -} - -Application::ApplicationPrivate::~ApplicationPrivate() -{ - Gdiplus::GdiplusShutdown(gdi_token); -} - -ATOM Application::ApplicationPrivate::registerClass(LPCWSTR className, HINSTANCE hInstance) -{ - WNDCLASSEX wcx; - memset(&wcx, 0, sizeof(wcx)); - wcx.cbSize = sizeof(WNDCLASSEX); - wcx.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS; - wcx.hInstance = hInstance; - wcx.lpfnWndProc = WndProc; - wcx.cbClsExtra = 0; - wcx.cbWndExtra = 0; - // wcx.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_MAINICON)); - // wcx.hIconSm = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_MAINICON)); - wcx.lpszClassName = className; - wcx.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); - wcx.hCursor = LoadCursor(NULL, IDC_ARROW); - return RegisterClassEx(&wcx); -} - -LRESULT CALLBACK Application::ApplicationPrivate::WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - if (msg == WM_CREATE) { - if (CREATESTRUCT *cs = (CREATESTRUCT*)lParam) { - if (Widget *wgt = (Widget*)cs->lpCreateParams) { - wgt->setNativeWindowHandle(hWnd); - SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)wgt); - LRESULT result = 0; - if (wgt->event(msg, wParam, lParam, &result)) - return result; - } - } - } else - if (Widget *wgt = (Widget*)GetWindowLongPtr(hWnd, GWLP_USERDATA)) { - LRESULT result = 0; - if (wgt->event(msg, wParam, lParam, &result)) - return result; - } - return DefWindowProc(hWnd, msg, wParam, lParam); -} - -Application *Application::inst = nullptr; - -Application::Application(HINSTANCE hInstance, PWSTR cmdline, int cmdshow) : - Application() -{ - d_ptr->hInstance = hInstance; - if (!d_ptr->hInstance) - d_ptr->hInstance = GetModuleHandle(NULL); - inst = this; -} - -Application::Application() : - Object(nullptr), - d_ptr(new ApplicationPrivate) -{ - -} - -Application *Application::instance() -{ - return inst; -} - -HINSTANCE Application::moduleHandle() -{ - return d_ptr->hInstance; -} - -void Application::setLayoutDirection(LayoutDirection layoutDirection) -{ - d_ptr->layoutDirection = layoutDirection; -} - -void Application::setFont(const std::wstring &font) const -{ - d_ptr->font = font; -} - -std::wstring Application::font() const -{ - return d_ptr->font; -} - -Application::~Application() -{ - delete d_ptr, d_ptr = nullptr; -} - -int Application::exec() -{ - MSG msg; - BOOL res; - while ((res = GetMessage(&msg, NULL, 0, 0)) != 0 && res != -1) { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - return (int)msg.wParam; -} - -void Application::exit(int code) -{ - PostQuitMessage(code); -} - -void Application::registerWidget(Widget *wgt, ObjectType objType, const Rect &rc) -{ - std::wstring className; - DWORD style = WS_CLIPCHILDREN; - DWORD exStyle = d_ptr->layoutDirection == LayoutDirection::RightToLeft ? WS_EX_LAYOUTRTL : 0; - HWND hWndParent = wgt->parentWidget() ? wgt->parentWidget()->nativeWindowHandle() : HWND_DESKTOP; - - switch (objType) { - case ObjectType::WindowType: - className = L"MainWindow " + std::to_wstring(++d_ptr->windowId); - style |= WS_OVERLAPPEDWINDOW; - exStyle |= WS_EX_APPWINDOW; - break; - - case ObjectType::DialogType: - className = L"Dialog " + std::to_wstring(++d_ptr->windowId); - style |= WS_CAPTION | WS_SYSMENU /*| DS_MODALFRAME*/; - exStyle |= WS_EX_DLGMODALFRAME; - break; - - case ObjectType::PopupType: - className = L"Popup " + std::to_wstring(++d_ptr->windowId); - style |= WS_POPUP; - exStyle |= WS_EX_TOOLWINDOW | WS_EX_LAYERED; - break; - - case ObjectType::WidgetType: - default: - className = L"Widget " + std::to_wstring(++d_ptr->windowId); - style |= WS_CHILD; - break; - } - - // if (wgt->parent()) { - // if (wgt->parentWidget()->isCreated()) { - // d_ptr->registerClass(className.c_str(), hInstance); - // wgt->m_hWnd = CreateWindowEx(exStyle, className.c_str(), wgt->title().c_str(), style, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hWndParent, NULL, hInstance, NULL); - // SetWindowLongPtr(wgt->m_hWnd, GWLP_USERDATA, (LONG_PTR)wgt); - // } else { - // wgt->connectOnCreate([=]() { - // wgt->m_hWnd = CreateWindowEx(exStyle, className.c_str(), wgt->title().c_str(), style, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hWndParent, NULL, hInstance, NULL); - // SetWindowLongPtr(wgt->m_hWnd, GWLP_USERDATA, (LONG_PTR)wgt); - // }); - // } - // } else { - d_ptr->registerClass(className.c_str(), d_ptr->hInstance); - CreateWindowEx(exStyle, className.c_str(), wgt->title().c_str(), style, rc.x, rc.y, rc.width, rc.height, - hWndParent, NULL, d_ptr->hInstance, (LPVOID)wgt); - // } -} - - diff --git a/win-linux/extras/online-installer/src/uiclasses/application.h b/win-linux/extras/online-installer/src/uiclasses/application.h deleted file mode 100644 index 8535d8f67..000000000 --- a/win-linux/extras/online-installer/src/uiclasses/application.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef APPLICATION_H -#define APPLICATION_H - -#include "object.h" -#include "common.h" -#include - - -class Widget; -class Application : public Object -{ -public: - Application(HINSTANCE hInstance, PWSTR cmdline, int cmdshow); - Application(const Application&) = delete; - ~Application(); - - Application& operator=(const Application&) = delete; - static Application *instance(); - HINSTANCE moduleHandle(); - void setLayoutDirection(LayoutDirection); - void setFont(const std::wstring &font) const; - std::wstring font() const; - - int exec(); - void exit(int); - -private: - Application(); - friend class Widget; - void registerWidget(Widget*, ObjectType, const Rect &rc); - class ApplicationPrivate; - ApplicationPrivate *d_ptr; - static Application *inst; -}; - -#endif // APPLICATION_H diff --git a/win-linux/extras/online-installer/src/uiclasses/baseutils.cpp b/win-linux/extras/online-installer/src/uiclasses/baseutils.cpp deleted file mode 100644 index d6d32c0e2..000000000 --- a/win-linux/extras/online-installer/src/uiclasses/baseutils.cpp +++ /dev/null @@ -1,126 +0,0 @@ -#include "baseutils.h" -#include -#include -#include - - -static int getLuma(COLORREF color) -{ - return int(0.299 * GetRValue(color) + 0.587 * GetGValue(color) + 0.114 * GetBValue(color)); -} - -static COLORREF LighterColor(COLORREF color, WORD factor) -{ - WORD h = 0, l = 0, s = 0; - ColorRGBToHLS(color, &h, &l, &s); - double k = (double)factor/100; - l = min(240, (unsigned)round(k * l)); - return ColorHLSToRGB(h, l, s); -} - -static std::wstring GetCurrentUserSID() -{ - static std::wstring user_sid; - if (user_sid.empty()) { - HANDLE hToken = NULL; - if (OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &hToken)) { - DWORD tokenLen = 0; - GetTokenInformation(hToken, TokenUser, NULL, 0, &tokenLen); - if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) { - if (PTOKEN_USER pTokenUser = (PTOKEN_USER)malloc(tokenLen)) { - if (GetTokenInformation(hToken, TokenUser, pTokenUser, tokenLen, &tokenLen)) { - LPWSTR sid = NULL; - if (ConvertSidToStringSid(pTokenUser->User.Sid, &sid)) { - user_sid = sid; - LocalFree(sid); - } - } - free(pTokenUser); - } - } - CloseHandle(hToken); - } - } - return user_sid; -} - -static DWORD RegQueryDwordValue(HKEY rootKey, LPCWSTR subkey, LPCWSTR value) -{ - HKEY hKey; - DWORD dwValue = 0; - if (RegOpenKeyEx(rootKey, subkey, 0, KEY_READ, &hKey) == ERROR_SUCCESS) { - DWORD dwType = REG_DWORD; - DWORD dwSize = sizeof(DWORD); - RegQueryValueEx(hKey, value, nullptr, &dwType, (LPBYTE)&dwValue, &dwSize); - RegCloseKey(hKey); - } - return dwValue; -} - -Utils::WinVer Utils::getWinVersion() -{ - static WinVer winVer = WinVer::Undef; - if (winVer == WinVer::Undef) { - if (HMODULE module = GetModuleHandleA("ntdll")) { - NTSTATUS(WINAPI *RtlGetVersion)(LPOSVERSIONINFOEXW); - *(FARPROC*)&RtlGetVersion = GetProcAddress(module, "RtlGetVersion"); - if (RtlGetVersion) { - OSVERSIONINFOEXW os = {0}; - os.dwOSVersionInfoSize = sizeof(os); - RtlGetVersion(&os); -#define MjrVer os.dwMajorVersion -#define MinVer os.dwMinorVersion -#define BldVer os.dwBuildNumber - winVer = MjrVer == 5L && (MinVer == 1L || MinVer == 2L) ? WinVer::WinXP : - MjrVer == 6L && MinVer == 0L ? WinVer::WinVista : - MjrVer == 6L && MinVer == 1L ? WinVer::Win7 : - MjrVer == 6L && MinVer == 2L ? WinVer::Win8 : - MjrVer == 6L && MinVer == 3L ? WinVer::Win8_1 : - MjrVer == 10L && MinVer == 0L && BldVer < 22000 ? WinVer::Win10 : - MjrVer == 10L && MinVer == 0L && BldVer >= 22000 ? WinVer::Win11 : - MjrVer == 10L && MinVer > 0L ? WinVer::Win11 : - MjrVer > 10L ? WinVer::Win11 : WinVer::Undef; - } - } - } - return winVer; -} - -COLORREF Utils::getColorizationColor(bool isActive, COLORREF topColor) -{ - int luma = getLuma(topColor); - if (isActive) { - if (RegQueryDwordValue(HKEY_CURRENT_USER, L"SOFTWARE\\Microsoft\\Windows\\DWM", L"ColorPrevalence") != 0) { - DWORD dwcolor = 0; - BOOL opaque = TRUE; - HRESULT(WINAPI *DwmGetColorizationColor)(DWORD*, BOOL*) = NULL; - if (HMODULE module = LoadLibrary(L"dwmapi")) { - *(FARPROC*)&DwmGetColorizationColor = GetProcAddress(module, "DwmGetColorizationColor"); - if (DwmGetColorizationColor && !SUCCEEDED(DwmGetColorizationColor(&dwcolor, &opaque))) { - dwcolor = 0; - } - FreeLibrary(module); - if (dwcolor) - return RGB((dwcolor & 0xff0000) >> 16, (dwcolor & 0xff00) >> 8, dwcolor & 0xff); - } - } else { - if (RegQueryDwordValue(HKEY_CURRENT_USER, L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize", L"SystemUsesLightTheme") != 0) { - std::wstring userSid = GetCurrentUserSID(); - if (!userSid.empty()) { - userSid.append(L"\\Control Panel\\Desktop"); - if (RegQueryDwordValue(HKEY_USERS, userSid.c_str(), L"AutoColorization") != 0) - return LighterColor(topColor, 95); - } - } - } - int res = -0.002*luma*luma + 0.93*luma + 6; - return RGB(res, res, res); - } - int res = -0.0007*luma*luma + 0.78*luma + 25; - return RGB(res, res, res); -} - -// bool Utils::isColorDark(COLORREF color) -// { -// return int(0.299 * GetRValue(color) + 0.587 * GetGValue(color) + 0.114 * GetBValue(color)) < 128; -// } diff --git a/win-linux/extras/online-installer/src/uiclasses/baseutils.h b/win-linux/extras/online-installer/src/uiclasses/baseutils.h deleted file mode 100644 index 346c66dcf..000000000 --- a/win-linux/extras/online-installer/src/uiclasses/baseutils.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef BASEUTILS_H -#define BASEUTILS_H - -#include - - -namespace Utils -{ - enum WinVer : BYTE { - Undef, WinXP, WinVista, Win7, Win8, Win8_1, Win10, Win11 - }; - WinVer getWinVersion(); - // bool isColorDark(COLORREF color); - COLORREF getColorizationColor(bool isActive = true, COLORREF topColor = 0x00ffffff); -}; - -#endif // BASEUTILS_H diff --git a/win-linux/extras/online-installer/src/uiclasses/boxlayout.cpp b/win-linux/extras/online-installer/src/uiclasses/boxlayout.cpp deleted file mode 100644 index d882d3627..000000000 --- a/win-linux/extras/online-installer/src/uiclasses/boxlayout.cpp +++ /dev/null @@ -1,211 +0,0 @@ -#include "boxlayout.h" -#include "widget.h" -#include - - -BoxLayout::BoxLayout(Direction direction) : - m_direction(direction) -{ - m_margins = Margins(6,6,6,6); - m_spacing = 6; -} - -BoxLayout::~BoxLayout() -{ - for (auto it = m_destroy_conn.begin(); it != m_destroy_conn.end(); it++) - it->first->disconnect(it->second); -} - -void BoxLayout::addWidget(Widget *wgt) -{ - m_widgets.push_back(wgt); - // int destroy_conn = wgt->onAboutToDestroy([=]() { - // auto it = std::find(m_widgets.begin(), m_widgets.end(), wgt); - // if (it != m_widgets.end()) - // m_widgets.erase(it); - - // auto it_conn = m_destroy_conn.find(wgt); - // if (it_conn != m_destroy_conn.end()) - // m_destroy_conn.erase(it_conn); - // }); - // m_destroy_conn[wgt] = destroy_conn; -} - -void BoxLayout::setContentMargins(int left, int top, int right, int bottom) -{ - m_margins = Margins(left, top, right, bottom); -} - -void BoxLayout::setSpacing(int spacing) -{ - m_spacing = spacing; -} - -void BoxLayout::onResize(int w, int h) -{ - int amount = m_widgets.size(); - if (amount > 0) { - int x = m_margins.left; - int y = m_margins.top; - int sum_width = w - (m_margins.right + m_margins.left); - int sum_height = h - (m_margins.bottom + m_margins.top); - int num_fixed = 0; - int sum_fixed_width_or_height = 0; - int last_expanding = -1; - if (m_direction == Horizontal) { - sum_width -= (amount - 1) * m_spacing; - for (int i = 0; i < amount; i++) { - Widget::SizeBehavior sb = (Widget::SizeBehavior)m_widgets[i]->property(Widget::HSizeBehavior); - if (sb == Widget::SizeBehavior::Fixed) { - int _w = 0, _h = 0; - m_widgets[i]->size(&_w, &_h); - sum_fixed_width_or_height += _w; - ++num_fixed; - } else - if (sb == Widget::SizeBehavior::Expanding) { - last_expanding = i; - } - } - - if (num_fixed != 0 && last_expanding != -1) { - int sep_width = (int)std::round((float)(sum_width - sum_fixed_width_or_height)/(amount - num_fixed)); - for (int i = 0; i < amount; i++) { - if (i == last_expanding) - sep_width = (sum_width - sum_fixed_width_or_height) - (amount - num_fixed - 1)*sep_width; - int _w = 0, _h = 0; - m_widgets[i]->size(&_w, &_h); - Widget::SizeBehavior hsb = (Widget::SizeBehavior)m_widgets[i]->property(Widget::HSizeBehavior); - Widget::SizeBehavior vsb = (Widget::SizeBehavior)m_widgets[i]->property(Widget::VSizeBehavior); - if (hsb == Widget::SizeBehavior::Fixed) { - if (vsb == Widget::SizeBehavior::Fixed) { - m_widgets[i]->move(x, y); - } else - if (vsb == Widget::SizeBehavior::Expanding) { - m_widgets[i]->setGeometry(x, y, _w, sum_height); - } - x += _w + m_spacing; - - } else - if (hsb == Widget::SizeBehavior::Expanding) { - if (vsb == Widget::SizeBehavior::Fixed) { - m_widgets[i]->setGeometry(x, y, sep_width, _h); - } else - if (vsb == Widget::SizeBehavior::Expanding) { - m_widgets[i]->setGeometry(x, y, sep_width, sum_height); - } - x += sep_width + m_spacing; - } - } - - } else { - int sep_width = (int)std::round((float)sum_width/amount); - for (int i = 0; i < amount; i++) { - if (i == amount - 1) - sep_width = sum_width - i*sep_width; - Widget::SizeBehavior hsb = (Widget::SizeBehavior)m_widgets[i]->property(Widget::HSizeBehavior); - Widget::SizeBehavior vsb = (Widget::SizeBehavior)m_widgets[i]->property(Widget::VSizeBehavior); - if (hsb == Widget::SizeBehavior::Fixed) { - if (vsb == Widget::SizeBehavior::Fixed) { - m_widgets[i]->move(x, y); - } else - if (vsb == Widget::SizeBehavior::Expanding) { - int _w = 0, _h = 0; - m_widgets[i]->size(&_w, &_h); - m_widgets[i]->setGeometry(x, y, _w, sum_height); - } - - } else - if (hsb == Widget::SizeBehavior::Expanding) { - if (vsb == Widget::SizeBehavior::Fixed) { - int _w = 0, _h = 0; - m_widgets[i]->size(&_w, &_h); - m_widgets[i]->setGeometry(x, y, sep_width, _h); - } else - if (vsb == Widget::SizeBehavior::Expanding) { - m_widgets[i]->setGeometry(x, y, sep_width, sum_height); - } - } - x += sep_width + m_spacing; - } - } - - } else { - sum_height -= (amount - 1) * m_spacing; - for (int i = 0; i < amount; i++) { - Widget::SizeBehavior sb = (Widget::SizeBehavior)m_widgets[i]->property(Widget::VSizeBehavior); - if (sb == Widget::SizeBehavior::Fixed) { - int _w = 0, _h = 0; - m_widgets[i]->size(&_w, &_h); - sum_fixed_width_or_height += _h; - ++num_fixed; - } else - if (sb == Widget::SizeBehavior::Expanding) { - last_expanding = i; - } - } - - if (num_fixed != 0 && last_expanding != -1) { - int sep_height = (int)std::round((float)(sum_height - sum_fixed_width_or_height)/(amount - num_fixed)); - for (int i = 0; i < amount; i++) { - if (i == last_expanding) - sep_height = (sum_height - sum_fixed_width_or_height) - (amount - num_fixed - 1)*sep_height; - int _w = 0, _h = 0; - m_widgets[i]->size(&_w, &_h); - Widget::SizeBehavior hsb = (Widget::SizeBehavior)m_widgets[i]->property(Widget::HSizeBehavior); - Widget::SizeBehavior vsb = (Widget::SizeBehavior)m_widgets[i]->property(Widget::VSizeBehavior); - if (vsb == Widget::SizeBehavior::Fixed) { - if (hsb == Widget::SizeBehavior::Fixed) { - m_widgets[i]->move(x, y); - } else - if (hsb == Widget::SizeBehavior::Expanding) { - m_widgets[i]->setGeometry(x, y, sum_width, _h); - } - y += _h + m_spacing; - - } else - if (vsb == Widget::SizeBehavior::Expanding) { - if (hsb == Widget::SizeBehavior::Fixed) { - m_widgets[i]->setGeometry(x, y, _w, sep_height); - } else - if (hsb == Widget::SizeBehavior::Expanding) { - m_widgets[i]->setGeometry(x, y, sum_width, sep_height); - } - y += sep_height + m_spacing; - } - } - - } else { - int sep_height = (int)std::round((float)sum_height/amount); - for (int i = 0; i < amount; i++) { - if (i == amount - 1) - sep_height = sum_height - i*sep_height; - Widget::SizeBehavior hsb = (Widget::SizeBehavior)m_widgets[i]->property(Widget::HSizeBehavior); - Widget::SizeBehavior vsb = (Widget::SizeBehavior)m_widgets[i]->property(Widget::VSizeBehavior); - if (vsb == Widget::SizeBehavior::Fixed) { - if (hsb == Widget::SizeBehavior::Fixed) { - m_widgets[i]->move(x, y); - } else - if (hsb == Widget::SizeBehavior::Expanding) { - int _w = 0, _h = 0; - m_widgets[i]->size(&_w, &_h); - m_widgets[i]->setGeometry(x, y, sum_width, _h); - } - - } else - if (vsb == Widget::SizeBehavior::Expanding) { - if (hsb == Widget::SizeBehavior::Fixed) { - int _w = 0, _h = 0; - m_widgets[i]->size(&_w, &_h); - m_widgets[i]->setGeometry(x, y, _w, sep_height); - } else - if (hsb == Widget::SizeBehavior::Expanding) { - m_widgets[i]->setGeometry(x, y, sum_width, sep_height); - } - } - y += sep_height + m_spacing; - } - } - } - } -} - diff --git a/win-linux/extras/online-installer/src/uiclasses/boxlayout.h b/win-linux/extras/online-installer/src/uiclasses/boxlayout.h deleted file mode 100644 index 49f971fb9..000000000 --- a/win-linux/extras/online-installer/src/uiclasses/boxlayout.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef BOXLAYOUT_H -#define BOXLAYOUT_H - -#include "layout.h" -#include - - -class BoxLayout : public Layout -{ -public: - enum Direction : unsigned char { - Horizontal, - Vertical - }; - BoxLayout(Direction); - ~BoxLayout(); - - virtual void addWidget(Widget *wgt) override; - virtual void setContentMargins(int, int, int, int); - virtual void setSpacing(int); - -protected: - -private: - virtual void onResize(int w, int h) override; - std::unordered_map m_destroy_conn; - std::vector m_widgets; - Direction m_direction; - int m_spacing; - int m_total_fixed_size; -}; - -#endif // BOXLAYOUT_H diff --git a/win-linux/extras/online-installer/src/uiclasses/button.cpp b/win-linux/extras/online-installer/src/uiclasses/button.cpp deleted file mode 100644 index 8c7511a54..000000000 --- a/win-linux/extras/online-installer/src/uiclasses/button.cpp +++ /dev/null @@ -1,203 +0,0 @@ -#include "button.h" -#include "baseutils.h" -#include "drawningengine.h" -#include "metrics.h" -#include "palette.h" -#include - - -static bool isArrangingAllowed() { - BOOL arranging = FALSE; - SystemParametersInfoA(SPI_GETWINARRANGING, 0, &arranging, 0); - return (arranging == TRUE); -} - -Button::Button(Widget *parent, const std::wstring &text) : - AbstractButton(parent, text), - m_hIcon(nullptr), - m_hEmfBmp(nullptr), - m_stockIcon(StockIcon::None), - supportSnapLayouts(false), - snapLayoutAllowed(false), - snapLayoutTimerIsSet(false) -{ - -} - -Button::~Button() -{ - if (m_hIcon) { - DestroyIcon(m_hIcon); - m_hIcon = nullptr; - } - if (m_hEmfBmp) { - delete m_hEmfBmp, m_hEmfBmp = nullptr; - } -} - -void Button::setIcon(const std::wstring &path, int w, int h) -{ - if (m_hIcon) { - DestroyIcon(m_hIcon); - m_hIcon = nullptr; - } - metrics()->setMetrics(Metrics::IconWidth, w); - metrics()->setMetrics(Metrics::IconHeight, h); - m_hIcon = (HICON)LoadImage(NULL, path.c_str(), IMAGE_ICON, w, h, LR_LOADFROMFILE | LR_DEFAULTCOLOR | LR_SHARED); - update(); -} - -void Button::setIcon(int id, int w, int h) -{ - if (m_hIcon) { - DestroyIcon(m_hIcon); - m_hIcon = nullptr; - } - metrics()->setMetrics(Metrics::IconWidth, w); - metrics()->setMetrics(Metrics::IconHeight, h); - HMODULE hInst = GetModuleHandle(NULL); - m_hIcon = (HICON)LoadImage(hInst, MAKEINTRESOURCE(id), IMAGE_ICON, w, h, LR_COPYFROMRESOURCE | LR_DEFAULTCOLOR | LR_SHARED); - update(); -} - -void Button::setEMFIcon(const std::wstring &path, int w, int h) -{ - if (m_hEmfBmp) { - delete m_hEmfBmp, m_hEmfBmp = nullptr; - } - metrics()->setMetrics(Metrics::IconWidth, w); - metrics()->setMetrics(Metrics::IconHeight, h); - m_hEmfBmp = new Gdiplus::Bitmap(path.c_str()); - update(); -} - -void Button::setEMFIcon(int id, int w, int h) -{ - if (m_hEmfBmp) { - delete m_hEmfBmp, m_hEmfBmp = nullptr; - } - metrics()->setMetrics(Metrics::IconWidth, w); - metrics()->setMetrics(Metrics::IconHeight, h); - HMODULE hInst = GetModuleHandle(NULL); - if (HRSRC hRes = FindResource(hInst, MAKEINTRESOURCE(id), RT_RCDATA)) { - if (HGLOBAL hResData = LoadResource(hInst, hRes)) { - if (LPVOID pData = LockResource(hResData)) { - DWORD dataSize = SizeofResource(hInst, hRes); - if (dataSize > 0) { - if (HGLOBAL hGlobal = GlobalAlloc(GHND, dataSize)) { - if (LPVOID pBuffer = GlobalLock(hGlobal)) { - memcpy(pBuffer, pData, dataSize); - IStream *pStream = nullptr; - HRESULT hr = CreateStreamOnHGlobal(hGlobal, TRUE, &pStream); - if (SUCCEEDED(hr)) { - m_hEmfBmp = new Gdiplus::Bitmap(pStream); - pStream->Release(); - } - GlobalUnlock(hGlobal); - } - GlobalFree(hGlobal); - } - } - } - FreeResource(hResData); - } - } - update(); -} - -void Button::setIconSize(int w, int h) -{ - metrics()->setMetrics(Metrics::IconWidth, w); - metrics()->setMetrics(Metrics::IconHeight, h); - update(); -} - -void Button::setSupportSnapLayouts() -{ - if (Utils::getWinVersion() > Utils::WinVer::Win10) { - snapLayoutAllowed = isArrangingAllowed(); - supportSnapLayouts = true; - } -} - -void Button::setStockIcon(StockIcon stockIcon) -{ - m_stockIcon = stockIcon; - update(); -} - -bool Button::event(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT *result) -{ - switch (msg) { - case WM_PAINT: { - RECT rc; - GetClientRect(m_hWnd, &rc); - - engine()->Begin(this, m_hWnd, &rc); - engine()->FillBackground(); - // engine()->DrawRoundedRect(); - if (metrics()->value(Metrics::BorderWidth) != 0) - engine()->DrawBorder(); - if (m_hIcon) - engine()->DrawIcon(m_hIcon); - if (m_hEmfBmp) - engine()->DrawEmfIcon(m_hEmfBmp); - if (!m_text.empty()) - engine()->DrawText(rc, m_text, m_hFont); - - if (m_stockIcon == StockIcon::CloseIcon) - engine()->DrawStockCloseIcon(); - else - if (m_stockIcon == StockIcon::RestoreIcon) - engine()->DrawStockRestoreIcon(); - else - if (m_stockIcon == StockIcon::MinimizeIcon) - engine()->DrawStockMinimizeIcon(); - else - if (m_stockIcon == StockIcon::MaximizeIcon) - engine()->DrawStockMaximizeIcon(); - - engine()->End(); - - *result = FALSE; - return true; - } - - case WM_NCHITTEST: { - if (supportSnapLayouts && snapLayoutAllowed) { - if (!snapLayoutTimerIsSet) { - snapLayoutTimerIsSet = true; - palette()->setCurrentState(Palette::Hover); - SetTimer(m_hWnd, SNAP_LAYOUTS_TIMER_ID, 100, NULL); - repaint(); - } - *result = HTMAXBUTTON; - return true; - } - return false; - } - - case WM_TIMER: { - if (wParam == SNAP_LAYOUTS_TIMER_ID) { - if (!underMouse()) { - KillTimer(m_hWnd, wParam); - snapLayoutTimerIsSet = false; - palette()->setCurrentState(Palette::Normal); - repaint(); - } - } - break; - } - - case WM_CAPTURECHANGED: { - if (Utils::getWinVersion() > Utils::WinVer::Win10) { - click(); - } - break; - } - - default: - break; - } - return AbstractButton::event(msg, wParam, lParam, result); -} diff --git a/win-linux/extras/online-installer/src/uiclasses/button.h b/win-linux/extras/online-installer/src/uiclasses/button.h deleted file mode 100644 index 115b2a5df..000000000 --- a/win-linux/extras/online-installer/src/uiclasses/button.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef BUTTON_H -#define BUTTON_H - -#include "abstractbutton.h" -#include - - -class Button : public AbstractButton -{ -public: - Button(Widget *parent = nullptr, const std::wstring &text = L""); - virtual ~Button(); - - enum StockIcon : BYTE { - None, - MinimizeIcon, - MaximizeIcon, - RestoreIcon, - CloseIcon - }; - - void setIcon(const std::wstring &path, int w, int h); - void setIcon(int id, int w, int h); - void setEMFIcon(const std::wstring &path, int w, int h); - void setEMFIcon(int id, int w, int h); - void setIconSize(int w, int h); - void setSupportSnapLayouts(); - void setStockIcon(StockIcon stockIcon); - - /* callback */ - -protected: - virtual bool event(UINT, WPARAM, LPARAM, LRESULT*) override; - -private: - HICON m_hIcon; - Gdiplus::Bitmap *m_hEmfBmp; - int m_stockIcon; - bool supportSnapLayouts, - snapLayoutAllowed; - bool snapLayoutTimerIsSet; -}; - -#endif // BUTTON_H diff --git a/win-linux/extras/online-installer/src/uiclasses/caption.cpp b/win-linux/extras/online-installer/src/uiclasses/caption.cpp deleted file mode 100644 index c8e470829..000000000 --- a/win-linux/extras/online-installer/src/uiclasses/caption.cpp +++ /dev/null @@ -1,117 +0,0 @@ -#include "caption.h" -#include "baseutils.h" -#include "metrics.h" -#include "drawningengine.h" -#include - -#define RESIZE_AREA_PART 0.14 - - -Caption::Caption(Widget *parent) : - Label(parent), - m_isResizingAvailable(true) -{ - m_hwndRoot = GetAncestor(m_hWnd, GA_ROOT); -} - -Caption::~Caption() -{ - -} - -void Caption::setResizingAvailable(bool isResizingAvailable) -{ - m_isResizingAvailable = isResizingAvailable; -} - -bool Caption::event(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT *result) -{ - switch (msg) { - case WM_PAINT: { - RECT rc; - GetClientRect(m_hWnd, &rc); - - engine()->Begin(this, m_hWnd, &rc); - engine()->FillBackground(); - // DrawRoundedRect(); - if (metrics()->value(Metrics::BorderWidth) != 0) - engine()->DrawBorder(); - if (!m_title.empty()) - engine()->DrawText(rc, m_title, m_hFont); - - engine()->End(); - - *result = FALSE; - return true; - } - - case WM_LBUTTONDOWN: - case WM_NCLBUTTONDOWN: { - if (isResizingAvailable()) { - int y = GET_Y_LPARAM(lParam); - if (HCURSOR hCursor = LoadCursor(NULL, isPointInResizeArea(y) ? IDC_SIZENS : IDC_ARROW)) - SetCursor(hCursor); - } - if (postMsg(WM_NCLBUTTONDOWN)) { - *result = TRUE; - return true; - } - return false; - } - - case WM_LBUTTONDBLCLK: { - if (postMsg(WM_NCLBUTTONDBLCLK)) { - *result = TRUE; - return true; - } - return false; - } - - case WM_MOUSEMOVE: - case WM_NCMOUSEMOVE: { - if (isResizingAvailable()) { - int y = GET_Y_LPARAM(lParam); - if (HCURSOR hCursor = LoadCursor(NULL, isPointInResizeArea(y) ? IDC_SIZENS : IDC_ARROW)) - SetCursor(hCursor); - } - break; - } - - case WM_MOUSEENTER: { - //palette()->setCurrentState(Palette::Hover); - repaint(); - break; - } - - case WM_MOUSELEAVE: { - //palette()->setCurrentState(Palette::Normal); - repaint(); - break; - } - - default: - break; - } - return Widget::event(msg, wParam, lParam, result); -} - -bool Caption::isResizingAvailable() -{ - return m_isResizingAvailable && Utils::getWinVersion() >= Utils::WinVer::Win10 && !IsZoomed(m_hwndRoot); -} - -bool Caption::isPointInResizeArea(int posY) -{ - int w = 0, h = 0; - size(&w, &h); - return posY <= RESIZE_AREA_PART * h; -} - -bool Caption::postMsg(DWORD cmd) { - POINT pt; - ::GetCursorPos(&pt); - ScreenToClient(m_hWnd, &pt); - ::ReleaseCapture(); - ::PostMessage(m_hwndRoot, cmd, isResizingAvailable() && isPointInResizeArea(pt.y) ? HTTOP : HTCAPTION, POINTTOPOINTS(pt)); - return true; -} diff --git a/win-linux/extras/online-installer/src/uiclasses/caption.h b/win-linux/extras/online-installer/src/uiclasses/caption.h deleted file mode 100644 index cf56e4985..000000000 --- a/win-linux/extras/online-installer/src/uiclasses/caption.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef CAPTION_H -#define CAPTION_H - -#include "label.h" -#include - - -class Caption : public Label -{ -public: - Caption(Widget *parent = nullptr); - ~Caption(); - - void setResizingAvailable(bool); - - /* callback */ - -protected: - virtual bool event(UINT, WPARAM, LPARAM, LRESULT*) override; - -private: - bool isResizingAvailable(); - bool isPointInResizeArea(int posY); - bool postMsg(DWORD cmd); - - HWND m_hwndRoot; - bool m_isResizingAvailable; -}; - -#endif // CAPTION_H diff --git a/win-linux/extras/online-installer/src/uiclasses/checkbox.cpp b/win-linux/extras/online-installer/src/uiclasses/checkbox.cpp deleted file mode 100644 index 9586d6c7d..000000000 --- a/win-linux/extras/online-installer/src/uiclasses/checkbox.cpp +++ /dev/null @@ -1,59 +0,0 @@ -#include "checkbox.h" -#include "drawningengine.h" -#include "metrics.h" -#include - - -CheckBox::CheckBox(Widget *parent, const std::wstring &text) : - AbstractButton(parent, text), - m_checked(false) -{ - metrics()->setMetrics(Metrics::TextAlignment, Metrics::AlignHLeft | Metrics::AlignVCenter); -} - -CheckBox::~CheckBox() -{ - -} - -void CheckBox::setChecked(bool checked) -{ - m_checked = checked; - update(); -} - -bool CheckBox::isChecked() -{ - return m_checked; -} - -bool CheckBox::event(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT *result) -{ - switch (msg) { - case WM_PAINT: { - RECT rc; - GetClientRect(m_hWnd, &rc); - - engine()->Begin(this, m_hWnd, &rc); - engine()->DrawCheckBox(m_text, m_hFont, m_checked); - if (metrics()->value(Metrics::BorderWidth) != 0) - engine()->DrawBorder(); - - engine()->End(); - - *result = FALSE; - return true; - } - - default: - break; - } - return AbstractButton::event(msg, wParam, lParam, result); -} - -void CheckBox::click() -{ - m_checked = !m_checked; - update(); - AbstractButton::click(); -} diff --git a/win-linux/extras/online-installer/src/uiclasses/checkbox.h b/win-linux/extras/online-installer/src/uiclasses/checkbox.h deleted file mode 100644 index eb7c3f7c8..000000000 --- a/win-linux/extras/online-installer/src/uiclasses/checkbox.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef CHECKBOX_H -#define CHECKBOX_H - -#include "abstractbutton.h" - - -class CheckBox : public AbstractButton -{ -public: - CheckBox(Widget *parent = nullptr, const std::wstring &text = L""); - virtual ~CheckBox(); - - void setChecked(bool checked); - bool isChecked(); - - /* callback */ - -protected: - virtual bool event(UINT, WPARAM, LPARAM, LRESULT*) override; - virtual void click() override; - -private: - bool m_checked; -}; - -#endif // CHECKBOX_H diff --git a/win-linux/extras/online-installer/src/uiclasses/common.cpp b/win-linux/extras/online-installer/src/uiclasses/common.cpp deleted file mode 100644 index ba0660b86..000000000 --- a/win-linux/extras/online-installer/src/uiclasses/common.cpp +++ /dev/null @@ -1,81 +0,0 @@ -#include "common.h" - - -Margins::Margins() : - left(0), top(0), right(0), bottom(0) -{} - -Margins::Margins(int l, int t, int r, int b) : - left(l), top(t), right(r), bottom(b) -{} - -Margins::Margins(const Margins &mrg) -{ - left = mrg.left; - top = mrg.top; - right = mrg.right; - bottom = mrg.bottom; -} - -Margins& Margins::operator=(const Margins &mrg) -{ - if (this == &mrg) - return *this; - left = mrg.left; - top = mrg.top; - right = mrg.right; - bottom = mrg.bottom; - return *this; -} - - -Rect::Rect() : - x(0), y(0), width(0), height(0) -{} - -Rect::Rect(int x, int y, int w, int h) : - x(x), y(y), width(w), height(h) -{} - -Rect::Rect(const Rect &rc) -{ - x = rc.x; - y = rc.y; - width = rc.width; - height = rc.height; -} - -Rect& Rect::operator=(const Rect &rc) -{ - if (this == &rc) - return *this; - x = rc.x; - y = rc.y; - width = rc.width; - height = rc.height; - return *this; -} - - -Size::Size() : - width(0), height(0) -{} - -Size::Size(int w, int h) : - width(w), height(h) -{} - -Size::Size(const Size &sz) -{ - width = sz.width; - height = sz.height; -} - -Size& Size::operator=(const Size &sz) -{ - if (this == &sz) - return *this; - width = sz.width; - height = sz.height; - return *this; -} diff --git a/win-linux/extras/online-installer/src/uiclasses/common.h b/win-linux/extras/online-installer/src/uiclasses/common.h deleted file mode 100644 index 089a15702..000000000 --- a/win-linux/extras/online-installer/src/uiclasses/common.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef COMMON_H -#define COMMON_H - - -struct Margins { - Margins(); - Margins(int, int, int, int); - Margins(const Margins&); - Margins& operator=(const Margins&); - - int left, top, right, bottom; -}; - -struct Rect { - Rect(); - Rect(int, int, int, int); - Rect(const Rect &rc); - Rect& operator=(const Rect &rc); - - int x, y, width, height; -}; - -struct Size { - Size(); - Size(int, int); - Size(const Size&); - Size& operator=(const Size&); - - int width, height; -}; - -enum LayoutDirection : unsigned char { - LeftToRight = 0, - RightToLeft -}; - -#endif // COMMON_H diff --git a/win-linux/extras/online-installer/src/uiclasses/commondefines.h b/win-linux/extras/online-installer/src/uiclasses/commondefines.h deleted file mode 100644 index 7ccd81d0a..000000000 --- a/win-linux/extras/online-installer/src/uiclasses/commondefines.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef COMMONDEFINES_H -#define COMMONDEFINES_H - -#include - -#define SNAP_LAYOUTS_TIMER_ID 0x1f000000 -#define PROGRESS_PULSE_TIMER_ID 0x2f000000 - -#define WM_MOUSEENTER (WM_APP + 1) -#define WM_INVOKEMETHOD (WM_APP + 2) - -typedef std::function FnVoidVoid; -typedef std::function FnVoidInt; -typedef std::function FnVoidIntInt; -typedef std::function FnVoidBoolPtr; - -#endif // COMMONDEFINES_H diff --git a/win-linux/extras/online-installer/src/uiclasses/dialog.cpp b/win-linux/extras/online-installer/src/uiclasses/dialog.cpp deleted file mode 100644 index cb7b2cd12..000000000 --- a/win-linux/extras/online-installer/src/uiclasses/dialog.cpp +++ /dev/null @@ -1,76 +0,0 @@ -#include "dialog.h" -#include "metrics.h" -#include "palette.h" -#include "drawningengine.h" - - -Dialog::Dialog(Widget *parent, const Rect &rc) : - Widget(parent, ObjectType::DialogType, rc) -{ - -} - -Dialog::~Dialog() -{ - -} - -bool Dialog::event(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT *result) -{ - switch (msg) { - case WM_SHOWWINDOW: { - if (wParam) { - if (Widget *parent = parentWidget()) - EnableWindow(parent->nativeWindowHandle(), FALSE); - } - break; - } - - case WM_PAINT: { - RECT rc; - GetClientRect(m_hWnd, &rc); - - engine()->Begin(this, m_hWnd); - engine()->FillBackground(rc); - //engine()->DrawRoundedRect(rc); - if (metrics()->value(Metrics::BorderWidth) != 0) - engine()->DrawBorder(rc); - // if (!m_title.empty()) - // engine()->DrawText(rc, m_title); - - - engine()->End(); - - *result = FALSE; - return true; - } - - case WM_MOUSEENTER: { - palette()->setCurrentState(Palette::Hover); - repaint(); - break; - } - - case WM_NCMOUSELEAVE: - case WM_MOUSELEAVE: { - palette()->setCurrentState(Palette::Normal); - repaint(); - break; - } - - /*case WM_NCHITTEST: { - *result = HTCAPTION; - return true; - }*/ - - case WM_CLOSE: { - if (Widget *parent = parentWidget()) - EnableWindow(parent->nativeWindowHandle(), TRUE); - break; - } - - default: - break; - } - return Widget::event(msg, wParam, lParam, result); -} diff --git a/win-linux/extras/online-installer/src/uiclasses/dialog.h b/win-linux/extras/online-installer/src/uiclasses/dialog.h deleted file mode 100644 index beab8a4b1..000000000 --- a/win-linux/extras/online-installer/src/uiclasses/dialog.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef DIALOG_H -#define DIALOG_H - -#include "widget.h" -#include - -#define DEFAULT_DLG_RECT Rect(100,100,800,600) - - -class Dialog : public Widget -{ -public: - Dialog(Widget *parent = nullptr, const Rect &rc = DEFAULT_DLG_RECT); - virtual ~Dialog(); - - /* callback */ - -protected: - virtual bool event(UINT, WPARAM, LPARAM, LRESULT*) override; - -private: - -}; - -#endif // DIALOG_H diff --git a/win-linux/extras/online-installer/src/uiclasses/drawingsurface.cpp b/win-linux/extras/online-installer/src/uiclasses/drawingsurface.cpp deleted file mode 100644 index b307ce8a8..000000000 --- a/win-linux/extras/online-installer/src/uiclasses/drawingsurface.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#include "drawingsurface.h" -#include "drawningengine.h" -#include "metrics.h" -#include "palette.h" - - -DrawningSurface::DrawningSurface() : - m_metrics(new Metrics), - m_palette(new Palette) -{ - m_engine = DrawingEngine::instance(); -} - -DrawningSurface::~DrawningSurface() -{ - delete m_palette, m_palette = nullptr; - delete m_metrics, m_metrics = nullptr; -} - -Metrics *DrawningSurface::metrics() -{ - return m_metrics; -} - -Palette *DrawningSurface::palette() -{ - return m_palette; -} - -DrawingEngine *DrawningSurface::engine() -{ - return m_engine; -} diff --git a/win-linux/extras/online-installer/src/uiclasses/drawingsurface.h b/win-linux/extras/online-installer/src/uiclasses/drawingsurface.h deleted file mode 100644 index 1dcd8c9ca..000000000 --- a/win-linux/extras/online-installer/src/uiclasses/drawingsurface.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef DRAWNINGSURFACE_H -#define DRAWNINGSURFACE_H - - -class Metrics; -class Palette; -class DrawingEngine; -class DrawningSurface -{ -public: - DrawningSurface(); - virtual ~DrawningSurface(); - - Metrics *metrics(); - Palette *palette(); - -protected: - DrawingEngine *engine(); - -private: - Metrics *m_metrics; - Palette *m_palette; - DrawingEngine *m_engine; -}; - -#endif // DRAWNINGSURFACE_H diff --git a/win-linux/extras/online-installer/src/uiclasses/drawningengine.cpp b/win-linux/extras/online-installer/src/uiclasses/drawningengine.cpp deleted file mode 100644 index 3bac57a60..000000000 --- a/win-linux/extras/online-installer/src/uiclasses/drawningengine.cpp +++ /dev/null @@ -1,573 +0,0 @@ -#include "drawningengine.h" -#include "drawingsurface.h" -#include "palette.h" -#include "metrics.h" -#include - - -static Gdiplus::Color ColorFromColorRef(COLORREF rgb) -{ - Gdiplus::Color color; - color.SetFromCOLORREF(rgb); - return color; -} - -static void RoundedPath(Gdiplus::GraphicsPath &ph, int x, int y, int width, int height, int rad) -{ - ph.AddArc(x, y, rad * 2, rad * 2, 180, 90); - ph.AddLine(x + rad, y, x + width - rad, y); - ph.AddArc(x + width - rad * 2, y, rad * 2, rad * 2, 270, 90); - ph.AddLine(x + width, y + rad, x + width, y + height - rad); - ph.AddArc(x + width - rad * 2, y + height - rad * 2, rad * 2, rad * 2, 0, 90); - ph.AddLine(x + width - rad, y + height, x + rad, y + height); - ph.AddArc(x, y + height - rad * 2, rad * 2, rad * 2, 90, 90); - ph.AddLine(x, y + height - rad, x, y + rad); - ph.CloseFigure(); -} - -DrawingEngine::DrawingEngine() : - m_ds(nullptr), - m_ps(nullptr), - m_hwnd(nullptr), - m_hdc(nullptr), - m_memDC(nullptr), - m_memBmp(nullptr), - m_oldBmp(nullptr), - m_graphics(nullptr) -{ - -} - -DrawingEngine* DrawingEngine::instance() -{ - static DrawingEngine inst; - return &inst; -} - -DrawingEngine::~DrawingEngine() -{ - -} - -DrawningSurface *DrawingEngine::surface() -{ - return m_ds; -} - -void DrawingEngine::Begin(DrawningSurface *ds, HWND hwnd, RECT *rc) -{ - if (m_ds) { - printf("Engine is buisy...\n"); - fflush(stdout); - return; - } - m_ds = ds; - m_rc = rc; - m_hwnd = hwnd; - m_ps = new PAINTSTRUCT; - m_hdc = BeginPaint(hwnd, m_ps); -} - -void DrawingEngine::FillBackground() const -{ - HBRUSH bkgBrush = CreateSolidBrush(m_ds->palette()->color(Palette::Background)); - HBRUSH oldBkgBrush = (HBRUSH)SelectObject(m_hdc, bkgBrush); - FillRect(m_hdc, m_rc, bkgBrush); - SelectObject(m_hdc, oldBkgBrush); - DeleteObject(bkgBrush); -} - -// void DrawingEngine::DrawRoundedRect() -// { -// int x = m_rc->left + m_ds->metrics()->value(Metrics::BorderWidth) - 1; -// int y = m_rc->top + m_ds->metrics()->value(Metrics::BorderWidth) - 1; -// int width = m_rc->right - m_rc->left - m_ds->metrics()->value(Metrics::BorderWidth) * 2 + 1; -// int height = m_rc->bottom - m_rc->top - m_ds->metrics()->value(Metrics::BorderWidth) * 2 + 1; -// int rad = m_ds->metrics()->value(Metrics::BorderRadius); - -// m_memDC = CreateCompatibleDC(m_hdc); -// m_memBmp = CreateCompatibleBitmap(m_hdc, m_rc->right - m_rc->left, m_rc->bottom - m_rc->top); -// m_oldBmp = (HBITMAP)SelectObject(m_memDC, m_memBmp); - -// m_graphics = new Gdiplus::Graphics(m_memDC); -// m_graphics->SetSmoothingMode(Gdiplus::SmoothingModeAntiAlias); -// m_graphics->Clear(ColorFromColorRef(m_ds->palette()->color(Palette::Background))); - -// Gdiplus::GraphicsPath ph; -// RoundedPath(ph, x, y, width, height, rad); - -// Gdiplus::SolidBrush brush(ColorFromColorRef(m_ds->palette()->color(Palette::Base))); -// m_graphics->FillPath(&brush, &ph); - -// if (m_ds->metrics()->value(Metrics::BorderWidth) != 0) { -// Gdiplus::Pen pen(ColorFromColorRef(m_ds->palette()->color(Palette::Border)), m_ds->metrics()->value(Metrics::BorderWidth)); -// m_graphics->DrawPath(&pen, &ph); -// } - -// BitBlt(m_hdc, m_rc->left, m_rc->top, m_rc->right - m_rc->left, m_rc->bottom - m_rc->top, m_memDC, 0, 0, SRCCOPY); - -// delete m_graphics; -// m_graphics = nullptr; -// SelectObject(m_memDC, m_oldBmp); -// m_oldBmp = nullptr; -// DeleteObject(m_memBmp); -// m_memBmp = nullptr; -// DeleteDC(m_memDC); -// m_memDC = nullptr; -// } - -void DrawingEngine::DrawBorder() const -{ - RECT rc; - SetRect(&rc, m_rc->left, m_rc->top, m_rc->right, m_rc->bottom); - DWORD dwOldLayout = GetLayout(m_hdc); - if (dwOldLayout & LAYOUT_RTL) - rc.right -= 1; - HBRUSH brdBrush = CreateSolidBrush(m_ds->palette()->color(Palette::Border)); - HBRUSH oldBrdBrush = (HBRUSH)SelectObject(m_hdc, brdBrush); - for (int i = 0; i < m_ds->metrics()->value(Metrics::BorderWidth); i++) { - FrameRect(m_hdc, &rc, brdBrush); - rc.left += 1; - rc.top += 1; - rc.right -= 1; - rc.bottom -= 1; - } - SelectObject(m_hdc, oldBrdBrush); - DeleteObject(brdBrush); -} - -void DrawingEngine::DrawTopBorder(int brdWidth, COLORREF brdColor) const -{ - HPEN pen = CreatePen(PS_SOLID, brdWidth, brdColor); - HPEN oldPen = (HPEN)SelectObject(m_hdc, pen); - MoveToEx(m_hdc, m_rc->left - 1, m_rc->top + brdWidth - 1, NULL); - LineTo(m_hdc, m_rc->right, m_rc->top + brdWidth - 1); - SelectObject(m_hdc, oldPen); - DeleteObject(pen); -} - -void DrawingEngine::DrawIcon(HICON hIcon) const -{ - int x = m_rc->left + (m_rc->right - m_rc->left - m_ds->metrics()->value(Metrics::IconWidth)) / 2; - int y = m_rc->top + (m_rc->bottom - m_rc->top - m_ds->metrics()->value(Metrics::IconHeight)) / 2; - DrawIconEx(m_hdc, x, y, hIcon, m_ds->metrics()->value(Metrics::IconWidth), m_ds->metrics()->value(Metrics::IconHeight), 0, NULL, DI_NORMAL); -} - -void DrawingEngine::DrawEmfIcon(Gdiplus::Bitmap *hEmfBmp) const -{ - int w = m_ds->metrics()->value(Metrics::IconWidth); - int h = m_ds->metrics()->value(Metrics::IconHeight); - int x = m_rc->left + (m_rc->right - m_rc->left - w) / 2; - int y = m_rc->top + (m_rc->bottom - m_rc->top - h) / 2; - Gdiplus::Graphics gr(m_hdc); - // gr.SetInterpolationMode(Gdiplus::InterpolationModeHighQualityBicubic); - // gr.SetPixelOffsetMode(Gdiplus::PixelOffsetModeHighQuality); - // gr.SetSmoothingMode(Gdiplus::SmoothingModeAntiAlias); - gr.DrawImage(hEmfBmp, x, y, w, h); -} - -void DrawingEngine::DrawImage(Gdiplus::Bitmap *hBmp) const -{ - int x = m_rc->left + (m_rc->right - m_rc->left - m_ds->metrics()->value(Metrics::IconWidth)) / 2; - int y = m_rc->top + (m_rc->bottom - m_rc->top - m_ds->metrics()->value(Metrics::IconHeight)) / 2; - Gdiplus::Graphics gr(m_hdc); - gr.SetInterpolationMode(Gdiplus::InterpolationModeBilinear); - gr.SetPixelOffsetMode(Gdiplus::PixelOffsetModeHighQuality); - gr.SetSmoothingMode(Gdiplus::SmoothingModeAntiAlias); - gr.DrawImage(hBmp, x, y, m_ds->metrics()->value(Metrics::IconWidth), m_ds->metrics()->value(Metrics::IconHeight)); -} - -void DrawingEngine::DrawStockCloseIcon() -{ - HPEN hPen = CreatePen(PS_SOLID, m_ds->metrics()->value(Metrics::PrimitiveWidth), m_ds->palette()->color(Palette::Primitive)); - HPEN oldPen = (HPEN)SelectObject(m_hdc, hPen); - int x = m_rc->left + (m_rc->right - m_rc->left)/2; - int y = m_rc->top + (m_rc->bottom - m_rc->top)/2; - MoveToEx(m_hdc, x, y, NULL); - LineTo(m_hdc, x + m_ds->metrics()->value(Metrics::IconWidth)/2, y + m_ds->metrics()->value(Metrics::IconHeight)/2); - MoveToEx(m_hdc, x, y, NULL); - LineTo(m_hdc, x + m_ds->metrics()->value(Metrics::IconWidth)/2, y - m_ds->metrics()->value(Metrics::IconHeight)/2); - MoveToEx(m_hdc, x, y, NULL); - LineTo(m_hdc, x - m_ds->metrics()->value(Metrics::IconWidth)/2, y + m_ds->metrics()->value(Metrics::IconHeight)/2); - MoveToEx(m_hdc, x, y, NULL); - LineTo(m_hdc, x - m_ds->metrics()->value(Metrics::IconWidth)/2, y - m_ds->metrics()->value(Metrics::IconHeight)/2); - SelectObject(m_hdc, oldPen); - DeleteObject(hPen); -} - -void DrawingEngine::DrawStockMinimizeIcon() -{ - HPEN hPen = CreatePen(PS_SOLID, m_ds->metrics()->value(Metrics::PrimitiveWidth), m_ds->palette()->color(Palette::Primitive)); - HPEN oldPen = (HPEN)SelectObject(m_hdc, hPen); - int x = m_rc->left + (m_rc->right - m_rc->left - m_ds->metrics()->value(Metrics::IconWidth)) / 2; - int y = m_rc->top + (m_rc->bottom - m_rc->top - m_ds->metrics()->value(Metrics::IconHeight)) / 2; - MoveToEx(m_hdc, x, y + m_ds->metrics()->value(Metrics::IconHeight)/2, NULL); - LineTo(m_hdc, x + m_ds->metrics()->value(Metrics::IconWidth), y + m_ds->metrics()->value(Metrics::IconHeight)/2); - SelectObject(m_hdc, oldPen); - DeleteObject(hPen); -} - -void DrawingEngine::DrawStockMaximizeIcon() -{ - HPEN hPen = CreatePen(PS_SOLID, m_ds->metrics()->value(Metrics::PrimitiveWidth), m_ds->palette()->color(Palette::Primitive)); - HPEN oldPen = (HPEN)SelectObject(m_hdc, hPen); - int x = m_rc->left + (m_rc->right - m_rc->left - m_ds->metrics()->value(Metrics::IconWidth)) / 2; - int y = m_rc->top + (m_rc->bottom - m_rc->top - m_ds->metrics()->value(Metrics::IconHeight)) / 2; - int quarterw = m_ds->metrics()->value(Metrics::IconWidth)/4; - int restw = m_ds->metrics()->value(Metrics::IconWidth) - quarterw; - int quarterh = m_ds->metrics()->value(Metrics::IconHeight)/4; - int resth = m_ds->metrics()->value(Metrics::IconHeight) - quarterh; - MoveToEx(m_hdc, x, y + quarterh, NULL); - LineTo(m_hdc, x + restw - 1, y + quarterh); - LineTo(m_hdc, x + restw - 1, y + m_ds->metrics()->value(Metrics::IconHeight) - 1); - LineTo(m_hdc, x, y + m_ds->metrics()->value(Metrics::IconHeight) - 1); - LineTo(m_hdc, x, y + quarterh + m_ds->metrics()->value(Metrics::PrimitiveWidth) - 1); - MoveToEx(m_hdc, x + quarterw, y + quarterh, NULL); - LineTo(m_hdc, x + quarterw, y); - LineTo(m_hdc, x + m_ds->metrics()->value(Metrics::IconWidth) - 1, y); - LineTo(m_hdc, x + m_ds->metrics()->value(Metrics::IconWidth) - 1, y + resth - 1); - LineTo(m_hdc, x + restw - 1, y + resth - 1); - SelectObject(m_hdc, oldPen); - DeleteObject(hPen); -} - -void DrawingEngine::DrawStockRestoreIcon() -{ - HPEN hPen = CreatePen(PS_SOLID, m_ds->metrics()->value(Metrics::PrimitiveWidth), m_ds->palette()->color(Palette::Primitive)); - HPEN oldPen = (HPEN)SelectObject(m_hdc, hPen); - int x = m_rc->left + (m_rc->right - m_rc->left - m_ds->metrics()->value(Metrics::IconWidth)) / 2; - int y = m_rc->top + (m_rc->bottom - m_rc->top - m_ds->metrics()->value(Metrics::IconHeight)) / 2; - MoveToEx(m_hdc, x, y, NULL); - LineTo(m_hdc, x + m_ds->metrics()->value(Metrics::IconWidth) - 1, y); - LineTo(m_hdc, x + m_ds->metrics()->value(Metrics::IconWidth) - 1, y + m_ds->metrics()->value(Metrics::IconHeight) - 1); - LineTo(m_hdc, x, y + m_ds->metrics()->value(Metrics::IconHeight) - 1); - LineTo(m_hdc, x, y + m_ds->metrics()->value(Metrics::PrimitiveWidth) - 1); - SelectObject(m_hdc, oldPen); - DeleteObject(hPen); -} - -void DrawingEngine::DrawCheckBox(const std::wstring &text, HFONT hFont, bool checked) -{ - int x = m_rc->left + 1; - int y = m_rc->top + (m_rc->bottom - m_rc->top - m_ds->metrics()->value(Metrics::IconHeight)) / 2; - - m_memDC = CreateCompatibleDC(m_hdc); - m_memBmp = CreateCompatibleBitmap(m_hdc, m_rc->right - m_rc->left, m_rc->bottom - m_rc->top); - m_oldBmp = (HBITMAP)SelectObject(m_memDC, m_memBmp); - - m_graphics = new Gdiplus::Graphics(m_memDC); - m_graphics->SetSmoothingMode(Gdiplus::SmoothingModeAntiAlias); - m_graphics->Clear(ColorFromColorRef(m_ds->palette()->color(Palette::Background))); - - DWORD dwOldLayout = GetLayout(m_memDC); - Gdiplus::Matrix origMatrix; - m_graphics->GetTransform(&origMatrix); - if (dwOldLayout & LAYOUT_RTL) { - Gdiplus::Matrix rtlMatrix(-1.0f, 0.0f, 0.0f, 1.0f, float(m_rc->right + m_rc->left - 1), 0.0f); - m_graphics->SetTransform(&rtlMatrix); - } - - Gdiplus::Pen pen(ColorFromColorRef(m_ds->palette()->color(Palette::Primitive)), m_ds->metrics()->value(Metrics::PrimitiveWidth)); - Gdiplus::Rect rc(x, y, m_ds->metrics()->value(Metrics::IconWidth) - 1, m_ds->metrics()->value(Metrics::IconHeight) - 1); - // m_graphics->DrawRectangle(&pen, rc); - Gdiplus::GraphicsPath ph; - RoundedPath(ph, rc.X, rc.Y, rc.Width, rc.Height, m_ds->metrics()->value(Metrics::PrimitiveRadius)); - m_graphics->DrawPath(&pen, &ph); - if (checked) { - pen.SetWidth(m_ds->metrics()->value(Metrics::AlternatePrimitiveWidth)); - pen.SetColor(ColorFromColorRef(m_ds->palette()->color(Palette::AlternatePrimitive))); - Gdiplus::PointF pts[3] = { - Gdiplus::PointF(float(x + 2), float(y + m_ds->metrics()->value(Metrics::IconHeight)/2 - 1)), - Gdiplus::PointF(float(x + m_ds->metrics()->value(Metrics::IconWidth)/2 - 2), float(y + m_ds->metrics()->value(Metrics::IconHeight) - 5)), - Gdiplus::PointF(float(x + m_ds->metrics()->value(Metrics::IconWidth) - 3), float(y + 4)) - }; - m_graphics->DrawLines(&pen, pts, 3); - } - if (!text.empty()) { - RECT rc; - int offset = (dwOldLayout & LAYOUT_RTL) ? m_ds->metrics()->value(Metrics::IconWidth) : 0; - SetRect(&rc, m_rc->left + m_ds->metrics()->value(Metrics::IconWidth) - offset, m_rc->top, m_rc->right - offset, m_rc->bottom); - m_graphics->SetSmoothingMode(Gdiplus::SmoothingModeAntiAlias); - m_graphics->SetTransform(&origMatrix); - LayeredDrawText(rc, text, hFont, dwOldLayout & LAYOUT_RTL); - } - StretchBlt(m_hdc, m_rc->left, m_rc->top, m_rc->right - m_rc->left, m_rc->bottom - m_rc->top, m_memDC, 0, 0, m_rc->right - m_rc->left, m_rc->bottom - m_rc->top, SRCCOPY); - - delete m_graphics; - m_graphics = nullptr; - SelectObject(m_memDC, m_oldBmp); - m_oldBmp = nullptr; - DeleteObject(m_memBmp); - m_memBmp = nullptr; - DeleteDC(m_memDC); - m_memDC = nullptr; -} - -void DrawingEngine::DrawRadioButton(const std::wstring &text, HFONT hFont, bool checked) -{ - int x = m_rc->left + 1; - int y = m_rc->top + (m_rc->bottom - m_rc->top - m_ds->metrics()->value(Metrics::IconHeight)) / 2; - - m_memDC = CreateCompatibleDC(m_hdc); - m_memBmp = CreateCompatibleBitmap(m_hdc, m_rc->right - m_rc->left, m_rc->bottom - m_rc->top); - m_oldBmp = (HBITMAP)SelectObject(m_memDC, m_memBmp); - - m_graphics = new Gdiplus::Graphics(m_memDC); - m_graphics->SetSmoothingMode(Gdiplus::SmoothingModeAntiAlias); - m_graphics->Clear(ColorFromColorRef(m_ds->palette()->color(Palette::Background))); - - DWORD dwOldLayout = GetLayout(m_memDC); - Gdiplus::Matrix origMatrix; - m_graphics->GetTransform(&origMatrix); - if (dwOldLayout & LAYOUT_RTL) { - Gdiplus::Matrix rtlMatrix(-1.0f, 0.0f, 0.0f, 1.0f, float(m_rc->right + m_rc->left - 1), 0.0f); - m_graphics->SetTransform(&rtlMatrix); - } - - Gdiplus::Pen pen(ColorFromColorRef(m_ds->palette()->color(Palette::Primitive)), m_ds->metrics()->value(Metrics::PrimitiveWidth)); - m_graphics->DrawEllipse(&pen, x, y, m_ds->metrics()->value(Metrics::IconHeight) - 1, m_ds->metrics()->value(Metrics::IconHeight) - 1); - if (checked) { - Gdiplus::SolidBrush chunkBrush(ColorFromColorRef(m_ds->palette()->color(Palette::AlternatePrimitive))); - m_graphics->FillEllipse(&chunkBrush, float(x) + 2.7f, float(y) + 2.7f, float(m_ds->metrics()->value(Metrics::IconHeight)) - 5.4f - 1.0f, float(m_ds->metrics()->value(Metrics::IconHeight)) - 5.4f - 1.0f); - } - if (!text.empty()) { - RECT rc; - int offset = (dwOldLayout & LAYOUT_RTL) ? m_ds->metrics()->value(Metrics::IconWidth) : 0; - SetRect(&rc, m_rc->left + m_ds->metrics()->value(Metrics::IconWidth) - offset, m_rc->top, m_rc->right - offset, m_rc->bottom); - m_graphics->SetSmoothingMode(Gdiplus::SmoothingModeAntiAlias); - m_graphics->SetTransform(&origMatrix); - LayeredDrawText(rc, text, hFont, dwOldLayout & LAYOUT_RTL); - } - StretchBlt(m_hdc, m_rc->left, m_rc->top, m_rc->right - m_rc->left, m_rc->bottom - m_rc->top, m_memDC, 0, 0, m_rc->right - m_rc->left, m_rc->bottom - m_rc->top, SRCCOPY); - - delete m_graphics; - m_graphics = nullptr; - SelectObject(m_memDC, m_oldBmp); - m_oldBmp = nullptr; - DeleteObject(m_memBmp); - m_memBmp = nullptr; - DeleteDC(m_memDC); - m_memDC = nullptr; -} - -void DrawingEngine::DrawProgressBar(int progress, int pulse_pos) -{ - int x = m_rc->left + m_ds->metrics()->value(Metrics::BorderWidth) + m_ds->metrics()->value(Metrics::IconMarginLeft); - int y = m_rc->top + m_ds->metrics()->value(Metrics::BorderWidth) + m_ds->metrics()->value(Metrics::IconMarginTop); - int width = m_rc->right - m_rc->left - m_ds->metrics()->value(Metrics::BorderWidth) * 2 - - m_ds->metrics()->value(Metrics::IconMarginRight) - m_ds->metrics()->value(Metrics::IconMarginLeft) - 1; - int height = m_rc->bottom - m_rc->top - m_ds->metrics()->value(Metrics::BorderWidth) * 2 - - m_ds->metrics()->value(Metrics::IconMarginBottom) - m_ds->metrics()->value(Metrics::IconMarginTop) - 1; - int rad = m_ds->metrics()->value(Metrics::BorderRadius); - - m_memDC = CreateCompatibleDC(m_hdc); - m_memBmp = CreateCompatibleBitmap(m_hdc, m_rc->right - m_rc->left, m_rc->bottom - m_rc->top); - m_oldBmp = (HBITMAP)SelectObject(m_memDC, m_memBmp); - - m_graphics = new Gdiplus::Graphics(m_memDC); - m_graphics->SetSmoothingMode(Gdiplus::SmoothingModeHighSpeed); - m_graphics->Clear(ColorFromColorRef(m_ds->palette()->color(Palette::Background))); - - Gdiplus::GraphicsPath ph; - RoundedPath(ph, x, y, width, height, rad); - - Gdiplus::SolidBrush prgBrush(ColorFromColorRef(m_ds->palette()->color(Palette::Base))); - m_graphics->FillPath(&prgBrush, &ph); - { - int _x = x, _width; - if (pulse_pos != -1) { - _width = width/5; - _x = x + (int)round(double((width - _width) * pulse_pos)/100); - } else { - if (progress < 0) - progress = 0; - else - if (progress > 100) - progress = 100; - _width = (int)round(double(width * progress)/100); - } - Gdiplus::GraphicsPath _ph; - RoundedPath(_ph, _x, y, _width, height, rad); - - Gdiplus::SolidBrush chunkBrush(ColorFromColorRef(m_ds->palette()->color(Palette::AlternateBase))); - m_graphics->FillPath(&chunkBrush, &_ph); - } - - if (m_ds->metrics()->value(Metrics::BorderWidth) != 0) { - Gdiplus::Pen pen(ColorFromColorRef(m_ds->palette()->color(Palette::Border)), m_ds->metrics()->value(Metrics::BorderWidth)); - m_graphics->DrawPath(&pen, &ph); - } - - StretchBlt(m_hdc, m_rc->left, m_rc->top, m_rc->right - m_rc->left, m_rc->bottom - m_rc->top, m_memDC, 0, 0, m_rc->right - m_rc->left, m_rc->bottom - m_rc->top, SRCCOPY); - - delete m_graphics; - m_graphics = nullptr; - SelectObject(m_memDC, m_oldBmp); - m_oldBmp = nullptr; - DeleteObject(m_memBmp); - m_memBmp = nullptr; - DeleteDC(m_memDC); - m_memDC = nullptr; -} - -void DrawingEngine::DrawText(const RECT &rc, const std::wstring &text, HFONT hFont, bool multiline) const -{ - HFONT hOldFont = (HFONT) SelectObject(m_hdc, hFont); - SetBkMode(m_hdc, TRANSPARENT); - SetTextColor(m_hdc, m_ds->palette()->color(Palette::Text)); - RECT _rc{rc.left + m_ds->metrics()->value(Metrics::TextMarginLeft), rc.top + m_ds->metrics()->value(Metrics::TextMarginTop), - rc.right - m_ds->metrics()->value(Metrics::TextMarginRight), rc.bottom - m_ds->metrics()->value(Metrics::TextMarginBottom)}; - UINT fmt = multiline ? 0 : DT_SINGLELINE; - UINT algn = m_ds->metrics()->value(Metrics::TextAlignment); - if (algn & Metrics::AlignHLeft) - fmt |= DT_LEFT; - if (algn & Metrics::AlignHCenter) - fmt |= DT_CENTER; - if (algn & Metrics::AlignHRight) - fmt |= DT_RIGHT; - if (algn & Metrics::AlignVTop) - fmt |= DT_TOP; - if (algn & Metrics::AlignVCenter) - fmt |= DT_VCENTER; - if (algn & Metrics::AlignVBottom) - fmt |= DT_BOTTOM; - ::DrawText(m_hdc, text.c_str(), text.length(), &_rc, fmt); - SelectObject(m_hdc, hOldFont); - SetBkMode(m_hdc, OPAQUE); -} - -void DrawingEngine::End() -{ - EndPaint(m_hwnd, m_ps); - delete m_ps; - m_ps = nullptr; - m_hdc = nullptr; - m_hwnd = nullptr; - m_rc = nullptr; - m_ds = nullptr; -} - -// void DrawingEngine::LayeredBegin(DrawningSurface *ds, HWND hwnd, RECT *rc) -// { -// if (m_ds) { -// printf("Engine is buisy....\n"); -// fflush(stdout); -// return; -// } -// m_ds = ds; -// m_rc = rc; -// m_hwnd = hwnd; -// m_hdc = GetDC(m_hwnd); -// m_memDC = CreateCompatibleDC(m_hdc); -// m_memBmp = CreateCompatibleBitmap(m_hdc, rc->right - rc->left, rc->bottom - rc->top); -// m_oldBmp = (HBITMAP)SelectObject(m_memDC, m_memBmp); - -// m_graphics = new Gdiplus::Graphics(m_memDC); -// m_graphics->SetSmoothingMode(Gdiplus::SmoothingMode::SmoothingModeAntiAlias); -// // gr->SetCompositingMode(Gdiplus::CompositingMode::CompositingModeSourceOver); -// // gr->SetInterpolationMode(Gdiplus::InterpolationModeHighQuality); -// } - -// void DrawingEngine::LayeredDrawRoundedRect() const -// { -// int x = m_rc->left + m_ds->metrics()->value(Metrics::ShadowWidth) + m_ds->metrics()->value(Metrics::BorderWidth) - 1; -// int y = m_rc->top + m_ds->metrics()->value(Metrics::ShadowWidth) + m_ds->metrics()->value(Metrics::BorderWidth) - 1; -// int width = m_rc->right - m_rc->left - (m_ds->metrics()->value(Metrics::ShadowWidth) + m_ds->metrics()->value(Metrics::BorderWidth)) * 2 + 1; -// int height = m_rc->bottom - m_rc->top - (m_ds->metrics()->value(Metrics::ShadowWidth) + m_ds->metrics()->value(Metrics::BorderWidth)) * 2 + 1; - -// int rad = m_ds->metrics()->value(Metrics::BorderRadius); -// Gdiplus::GraphicsPath ph; -// RoundedPath(ph, x, y, width, height, rad); - -// if (m_ds->metrics()->value(Metrics::BorderWidth) != 0) { -// Gdiplus::Pen pen(ColorFromColorRef(m_ds->palette()->color(Palette::Border)), m_ds->metrics()->value(Metrics::BorderWidth)); -// m_graphics->DrawPath(&pen, &ph); -// } -// Gdiplus::SolidBrush brush(ColorFromColorRef(m_ds->palette()->color(Palette::Background))); -// m_graphics->FillPath(&brush, &ph); -// } - -void DrawingEngine::LayeredDrawText(RECT &rc, const std::wstring &text, HFONT hFont, bool rtl) const -{ -// Gdiplus::FontFamily fntFam(L"Segoe UI"); -// Gdiplus::Font font(&fntFam, m_ds->metrics()->value(Metrics::FontHeight), Gdiplus::FontStyleRegular, Gdiplus::Unit::UnitPixel); - LOGFONTW logFont = {0}; - GetObject(hFont, sizeof(LOGFONTW), &logFont); - Gdiplus::Font font(m_memDC, &logFont); - Gdiplus::RectF rcF(rc.left + m_ds->metrics()->value(Metrics::TextMarginLeft), rc.top + m_ds->metrics()->value(Metrics::TextMarginTop), - rc.right - m_ds->metrics()->value(Metrics::TextMarginRight) - rc.left - m_ds->metrics()->value(Metrics::TextMarginLeft), - rc.bottom - m_ds->metrics()->value(Metrics::TextMarginBottom) - rc.top - m_ds->metrics()->value(Metrics::TextMarginTop)); - Gdiplus::StringAlignment h_algn, v_algn; - UINT algn = m_ds->metrics()->value(Metrics::TextAlignment); - if (algn & Metrics::AlignHLeft) - h_algn = Gdiplus::StringAlignmentNear; - if (algn & Metrics::AlignHCenter) - h_algn = Gdiplus::StringAlignmentCenter; - if (algn & Metrics::AlignHRight) - h_algn = Gdiplus::StringAlignmentFar; - if (algn & Metrics::AlignVTop) - v_algn = Gdiplus::StringAlignmentNear; - if (algn & Metrics::AlignVCenter) - v_algn = Gdiplus::StringAlignmentCenter; - if (algn & Metrics::AlignVBottom) - v_algn = Gdiplus::StringAlignmentFar; - Gdiplus::StringFormat strFmt; - strFmt.SetAlignment(h_algn); - strFmt.SetLineAlignment(v_algn); - if (rtl) - strFmt.SetFormatFlags(Gdiplus::StringFormatFlagsDirectionRightToLeft); - Gdiplus::SolidBrush brush(ColorFromColorRef(m_ds->palette()->color(Palette::Text))); - m_graphics->DrawString(text.c_str(), -1, &font, rcF, &strFmt, &brush); -} - -// void DrawingEngine::LayeredDrawShadow(int shadowWidth, int rad) -// { -// #define SHADOW_TRANSPATENCY 0x26 -// for (int i = 0; i < shadowWidth; i++) { -// int x = m_rc->left + i; -// int y = m_rc->top + i; -// int width = m_rc->right - m_rc->left - i * 2 - 1; -// int height = m_rc->bottom - m_rc->top - i * 2 - 1; - -// Gdiplus::GraphicsPath ph; -// RoundedPath(ph, x, y, width, height, rad); - -// int alpha = shadowWidth > 1 ? SHADOW_TRANSPATENCY * (i * i) / ((shadowWidth - 1) * (shadowWidth - 1)) : SHADOW_TRANSPATENCY; -// Gdiplus::Pen pen(Gdiplus::Color(alpha, 0, 0, 0), 1); -// m_graphics->DrawPath(&pen, &ph); -// } -// } - -// void DrawingEngine::LayeredUpdate(BYTE alpha) -// { -// RECT wrc; -// GetWindowRect(m_hwnd, &wrc); -// HDC scrDC = GetDC(NULL); -// POINT ptSrc = {0, 0}; -// POINT ptDst = {wrc.left, wrc.top}; -// SIZE szDst = {wrc.right - wrc.left, wrc.bottom - wrc.top}; -// BLENDFUNCTION bf; -// bf.AlphaFormat = AC_SRC_ALPHA; -// bf.BlendFlags = 0; -// bf.BlendOp = AC_SRC_OVER; -// bf.SourceConstantAlpha = alpha; -// UpdateLayeredWindow(m_hwnd, scrDC, &ptDst, &szDst, m_memDC, &ptSrc, 0, &bf, ULW_ALPHA); -// ReleaseDC(NULL, scrDC); -// } - -// void DrawingEngine::LayeredEnd() -// { -// delete m_graphics; -// m_graphics = nullptr; -// SelectObject(m_memDC, m_oldBmp); -// m_oldBmp = nullptr; -// DeleteObject(m_memBmp); -// m_memBmp = nullptr; -// DeleteDC(m_memDC); -// m_memDC = nullptr; -// ReleaseDC(m_hwnd, m_hdc); -// m_hdc = nullptr; -// m_hwnd = nullptr; -// m_rc = nullptr; -// m_ds = nullptr; -// } diff --git a/win-linux/extras/online-installer/src/uiclasses/drawningengine.h b/win-linux/extras/online-installer/src/uiclasses/drawningengine.h deleted file mode 100644 index 5f3cae7aa..000000000 --- a/win-linux/extras/online-installer/src/uiclasses/drawningengine.h +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef DRAWNINGENGINE_H -#define DRAWNINGENGINE_H - -#include -#include -#include - - -class DrawningSurface; -class DrawingEngine -{ -public: - DrawingEngine(const DrawingEngine&) = delete; - DrawingEngine& operator=(const DrawingEngine&) = delete; - static DrawingEngine *instance(); - - - DrawningSurface *surface(); - void Begin(DrawningSurface*, HWND, RECT *rc); - void FillBackground() const; - // void DrawRoundedRect(); - void DrawBorder() const; - void DrawTopBorder(int, COLORREF) const; - void DrawIcon(HICON hIcon) const; - void DrawEmfIcon(Gdiplus::Bitmap *hEmfBmp) const; - void DrawImage(Gdiplus::Bitmap *hBmp) const; - void DrawStockCloseIcon(); - void DrawStockMinimizeIcon(); - void DrawStockMaximizeIcon(); - void DrawStockRestoreIcon(); - void DrawCheckBox(const std::wstring &text, HFONT hFont, bool checked = false); - void DrawRadioButton(const std::wstring &text, HFONT hFont, bool checked = false); - void DrawProgressBar(int progress, int pulse_pos); - void DrawText(const RECT &rc, const std::wstring &text, HFONT hFont, bool multiline = false) const; - void End(); - - // void LayeredBegin(DrawningSurface*, HWND, RECT *rc); - // void LayeredDrawRoundedRect() const; - void LayeredDrawText(RECT &rc, const std::wstring &text, HFONT hFont, bool rtl = false) const; - // void LayeredDrawShadow(int shadowWidth, int rad); - // void LayeredUpdate(BYTE alpha); - // void LayeredEnd(); - -private: - DrawingEngine(); - ~DrawingEngine(); - - DrawningSurface *m_ds; - RECT *m_rc; - PAINTSTRUCT *m_ps; - HWND m_hwnd; - HDC m_hdc; - HDC m_memDC; - HBITMAP m_memBmp; - HBITMAP m_oldBmp; - Gdiplus::Graphics *m_graphics; -}; - -#endif // DRAWNINGENGINE_H diff --git a/win-linux/extras/online-installer/src/uiclasses/label.cpp b/win-linux/extras/online-installer/src/uiclasses/label.cpp deleted file mode 100644 index eb28baeb0..000000000 --- a/win-linux/extras/online-installer/src/uiclasses/label.cpp +++ /dev/null @@ -1,191 +0,0 @@ -#include "label.h" -#include "metrics.h" -#include "drawningengine.h" - - -Label::Label(Widget *parent) : - Widget(parent, ObjectType::WidgetType), - m_hIcon(nullptr), - m_hEmfBmp(nullptr), - m_hBmp(nullptr), - m_multiline(false) -{ - -} - -Label::~Label() -{ - if (m_hIcon) { - DestroyIcon(m_hIcon); - m_hIcon = nullptr; - } - if (m_hEmfBmp) { - delete m_hEmfBmp, m_hEmfBmp = nullptr; - } - if (m_hBmp) { - delete m_hBmp, m_hBmp = nullptr; - } -} - -void Label::setText(const std::wstring &text, bool multiline) -{ - m_text = text; - m_multiline = multiline; - update(); -} - -void Label::setIcon(const std::wstring &path, int w, int h) -{ - if (m_hIcon) { - DestroyIcon(m_hIcon); - m_hIcon = nullptr; - } - metrics()->setMetrics(Metrics::IconWidth, w); - metrics()->setMetrics(Metrics::IconHeight, h); - m_hIcon = (HICON)LoadImage(NULL, path.c_str(), IMAGE_ICON, w, h, LR_LOADFROMFILE | LR_DEFAULTCOLOR | LR_SHARED); - update(); -} - -void Label::setIcon(int id, int w, int h) -{ - if (m_hIcon) { - DestroyIcon(m_hIcon); - m_hIcon = nullptr; - } - metrics()->setMetrics(Metrics::IconWidth, w); - metrics()->setMetrics(Metrics::IconHeight, h); - HMODULE hInst = GetModuleHandle(NULL); - m_hIcon = (HICON)LoadImage(hInst, MAKEINTRESOURCE(id), IMAGE_ICON, w, h, LR_COPYFROMRESOURCE | LR_DEFAULTCOLOR | LR_SHARED); - update(); -} - -void Label::setEMFIcon(const std::wstring &path, int w, int h) -{ - if (m_hEmfBmp) { - delete m_hEmfBmp, m_hEmfBmp = nullptr; - } - metrics()->setMetrics(Metrics::IconWidth, w); - metrics()->setMetrics(Metrics::IconHeight, h); - m_hEmfBmp = new Gdiplus::Bitmap(path.c_str()); - update(); -} - -void Label::setEMFIcon(int id, int w, int h) -{ - if (m_hEmfBmp) { - delete m_hEmfBmp, m_hEmfBmp = nullptr; - } - metrics()->setMetrics(Metrics::IconWidth, w); - metrics()->setMetrics(Metrics::IconHeight, h); - HMODULE hInst = GetModuleHandle(NULL); - if (HRSRC hRes = FindResource(hInst, MAKEINTRESOURCE(id), RT_RCDATA)) { - if (HGLOBAL hResData = LoadResource(hInst, hRes)) { - if (LPVOID pData = LockResource(hResData)) { - DWORD dataSize = SizeofResource(hInst, hRes); - if (dataSize > 0) { - if (HGLOBAL hGlobal = GlobalAlloc(GHND, dataSize)) { - if (LPVOID pBuffer = GlobalLock(hGlobal)) { - memcpy(pBuffer, pData, dataSize); - IStream *pStream = nullptr; - HRESULT hr = CreateStreamOnHGlobal(hGlobal, TRUE, &pStream); - if (SUCCEEDED(hr)) { - m_hEmfBmp = new Gdiplus::Bitmap(pStream); - pStream->Release(); - } - GlobalUnlock(hGlobal); - } - GlobalFree(hGlobal); - } - } - } - FreeResource(hResData); - } - } - update(); -} - -void Label::setImage(int id, int w, int h) -{ - if (m_hBmp) { - delete m_hBmp, m_hBmp = nullptr; - } - metrics()->setMetrics(Metrics::IconWidth, w); - metrics()->setMetrics(Metrics::IconHeight, h); - HMODULE hInst = GetModuleHandle(NULL); - if (HRSRC hRes = FindResource(hInst, MAKEINTRESOURCE(id), L"PNG")) { - if (HGLOBAL hResData = LoadResource(hInst, hRes)) { - if (LPVOID pData = LockResource(hResData)) { - DWORD dataSize = SizeofResource(hInst, hRes); - if (dataSize > 0) { - if (HGLOBAL hGlobal = GlobalAlloc(GHND, dataSize)) { - if (LPVOID pBuffer = GlobalLock(hGlobal)) { - memcpy(pBuffer, pData, dataSize); - IStream *pStream = nullptr; - HRESULT hr = CreateStreamOnHGlobal(hGlobal, TRUE, &pStream); - if (SUCCEEDED(hr)) { - m_hBmp = new Gdiplus::Bitmap(pStream); - pStream->Release(); - } - GlobalUnlock(hGlobal); - } - GlobalFree(hGlobal); - } - } - } - FreeResource(hResData); - } - } - update(); -} - -void Label::setIconSize(int w, int h) -{ - metrics()->setMetrics(Metrics::IconWidth, w); - metrics()->setMetrics(Metrics::IconHeight, h); - update(); -} - -bool Label::event(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT *result) -{ - switch (msg) { - case WM_PAINT: { - RECT rc; - GetClientRect(m_hWnd, &rc); - - engine()->Begin(this, m_hWnd, &rc); - engine()->FillBackground(); - // DrawRoundedRect(); - if (metrics()->value(Metrics::BorderWidth) != 0) - engine()->DrawBorder(); - if (m_hBmp) - engine()->DrawImage(m_hBmp); - if (m_hIcon) - engine()->DrawIcon(m_hIcon); - if (m_hEmfBmp) - engine()->DrawEmfIcon(m_hEmfBmp); - if (!m_text.empty()) - engine()->DrawText(rc, m_text, m_hFont, m_multiline); - - engine()->End(); - - *result = FALSE; - return true; - } - - // case WM_MOUSEENTER: { - // palette()->setCurrentState(Palette::Hover); - // repaint(); - // break; - // } - - // case WM_MOUSELEAVE: { - // palette()->setCurrentState(Palette::Normal); - // repaint(); - // break; - // } - - default: - break; - } - return Widget::event(msg, wParam, lParam, result); -} diff --git a/win-linux/extras/online-installer/src/uiclasses/label.h b/win-linux/extras/online-installer/src/uiclasses/label.h deleted file mode 100644 index 84f265bee..000000000 --- a/win-linux/extras/online-installer/src/uiclasses/label.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef LABEL_H -#define LABEL_H - -#include "widget.h" -#include -#include - - -class Label : public Widget -{ -public: - Label(Widget *parent = nullptr); - virtual ~Label(); - - void setText(const std::wstring &text, bool multiline = false); - void setIcon(const std::wstring &path, int w, int h); - void setIcon(int id, int w, int h); - void setEMFIcon(const std::wstring &path, int w, int h); - void setEMFIcon(int id, int w, int h); - void setImage(int id, int w, int h); - void setIconSize(int w, int h); - /* callback */ - -protected: - virtual bool event(UINT, WPARAM, LPARAM, LRESULT*) override; - -private: - std::wstring m_text; - HICON m_hIcon; - Gdiplus::Bitmap *m_hEmfBmp; - Gdiplus::Bitmap *m_hBmp; - bool m_multiline; -}; - -#endif // LABEL_H diff --git a/win-linux/extras/online-installer/src/uiclasses/layout.cpp b/win-linux/extras/online-installer/src/uiclasses/layout.cpp deleted file mode 100644 index c427e35ab..000000000 --- a/win-linux/extras/online-installer/src/uiclasses/layout.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "layout.h" - - -Layout::Layout(Object *parent) -{ - -} - -Layout::~Layout() -{ - -} diff --git a/win-linux/extras/online-installer/src/uiclasses/layout.h b/win-linux/extras/online-installer/src/uiclasses/layout.h deleted file mode 100644 index bc62360b4..000000000 --- a/win-linux/extras/online-installer/src/uiclasses/layout.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef LAYOUT_H -#define LAYOUT_H - -#include "object.h" -#include "layoutitem.h" -#include "common.h" -// #include - - - -class Layout : public LayoutItem -{ -public: - Layout(Object *parent = nullptr); - virtual ~Layout(); - - virtual void addWidget(Widget *wgt) = 0; - -protected: - Margins m_margins; - -private: - friend class Widget; - virtual void onResize(int w, int h) = 0; -}; - -#endif // LAYOUT_H diff --git a/win-linux/extras/online-installer/src/uiclasses/layoutitem.cpp b/win-linux/extras/online-installer/src/uiclasses/layoutitem.cpp deleted file mode 100644 index eaa60ee2e..000000000 --- a/win-linux/extras/online-installer/src/uiclasses/layoutitem.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include "layoutitem.h" - - -LayoutItem::LayoutItem() -{ - -} - -LayoutItem::~LayoutItem() -{ - -} - -Widget *LayoutItem::widget() -{ - return nullptr; -} - -Layout *LayoutItem::layout() -{ - return nullptr; -} diff --git a/win-linux/extras/online-installer/src/uiclasses/layoutitem.h b/win-linux/extras/online-installer/src/uiclasses/layoutitem.h deleted file mode 100644 index 10ef87afc..000000000 --- a/win-linux/extras/online-installer/src/uiclasses/layoutitem.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef LAYOUTITEM_H -#define LAYOUTITEM_H - - -class Widget; -class Layout; - -class LayoutItem -{ -public: - LayoutItem(); - ~LayoutItem(); - - virtual Widget *widget(); - virtual Layout *layout(); - -protected: -}; - -#endif // LAYOUTITEM_H diff --git a/win-linux/extras/online-installer/src/uiclasses/metrics.cpp b/win-linux/extras/online-installer/src/uiclasses/metrics.cpp deleted file mode 100644 index 7dbb7a6f2..000000000 --- a/win-linux/extras/online-installer/src/uiclasses/metrics.cpp +++ /dev/null @@ -1,42 +0,0 @@ -#include "metrics.h" - - -Metrics::Metrics() -{ - metrics[BorderWidth] = 0; - metrics[BorderRadius] = 0; - metrics[IconWidth] = 16; - metrics[IconHeight] = 16; - metrics[IconMarginLeft] = 0; - metrics[IconMarginRight] = 0; - metrics[IconMarginTop] = 0; - metrics[IconMarginBottom] = 0; - metrics[IconAlignment] = Alignment::AlignCenter; - metrics[FontWidth] = 0; - metrics[FontHeight] = 18; - metrics[PrimitiveWidth] = 1; - metrics[PrimitiveRadius] = 0; - metrics[AlternatePrimitiveWidth] = 1; - metrics[ShadowWidth] = 10; - metrics[ShadowRadius] = 10; - metrics[TextMarginLeft] = 0; - metrics[TextMarginTop] = 0; - metrics[TextMarginRight] = 0; - metrics[TextMarginBottom] = 0; - metrics[TextAlignment] = Alignment::AlignCenter; -} - -Metrics::~Metrics() -{ - -} - -int Metrics::value(Role role) -{ - return metrics[role]; -} - -void Metrics::setMetrics(Role role, int value) -{ - metrics[role] = value; -} diff --git a/win-linux/extras/online-installer/src/uiclasses/metrics.h b/win-linux/extras/online-installer/src/uiclasses/metrics.h deleted file mode 100644 index 2d230e281..000000000 --- a/win-linux/extras/online-installer/src/uiclasses/metrics.h +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef METRICS_H -#define METRICS_H - - -class Metrics -{ -public: - Metrics(); - ~Metrics(); - - enum Alignment : unsigned char { - AlignHLeft = 1, - AlignHCenter = 2, - AlignHRight = 4, - AlignVTop = 8, - AlignVCenter = 16, - AlignVBottom = 32, - AlignCenter = AlignHCenter | AlignVCenter - }; - - enum Role : unsigned char { - BorderWidth, - BorderRadius, - IconWidth, - IconHeight, - IconMarginLeft, - IconMarginTop, - IconMarginRight, - IconMarginBottom, - IconAlignment, - FontWidth, - FontHeight, - PrimitiveWidth, - AlternatePrimitiveWidth, - PrimitiveRadius, - ShadowWidth, - ShadowRadius, - TextMarginLeft, - TextMarginTop, - TextMarginRight, - TextMarginBottom, - TextAlignment, - METRICS_COUNT - }; - - void setMetrics(Role, int); - int value(Role); - -protected: - -private: - int metrics[METRICS_COUNT]; -}; - -#endif // METRICS_H diff --git a/win-linux/extras/online-installer/src/uiclasses/object.cpp b/win-linux/extras/online-installer/src/uiclasses/object.cpp deleted file mode 100644 index 0fb88274c..000000000 --- a/win-linux/extras/online-installer/src/uiclasses/object.cpp +++ /dev/null @@ -1,40 +0,0 @@ -#include "object.h" - - -int Object::m_connectionId = 0; - -Object::Object(Object *parent) : - m_parent(parent) -{ - -} - -Object::~Object() -{ - -} - -Object *Object::parent() -{ - return m_parent; -} - -void Object::setParent(Object *parent) -{ - m_parent = parent; -} - -void Object::setObjectName(const std::wstring &object_name) -{ - m_object_name = object_name; -} - -std::wstring Object::objectName() -{ - return m_object_name; -} - -void Object::disconnect(int connectionId) -{ - -} diff --git a/win-linux/extras/online-installer/src/uiclasses/object.h b/win-linux/extras/online-installer/src/uiclasses/object.h deleted file mode 100644 index 02b50fe6a..000000000 --- a/win-linux/extras/online-installer/src/uiclasses/object.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef OBJECT_H -#define OBJECT_H - -#include - - -class Object -{ -public: - Object(Object *parent = nullptr); - virtual ~Object(); - - enum ObjectType : unsigned char { - ApplicationType, - WindowType, - DialogType, - WidgetType, - PopupType - }; - - Object *parent(); - void setParent(Object*); - void setObjectName(const std::wstring&); - std::wstring objectName(); - virtual void disconnect(int); - -protected: - static int m_connectionId; - -private: - Object *m_parent; - std::wstring m_object_name; -}; - -#endif // OBJECT_H diff --git a/win-linux/extras/online-installer/src/uiclasses/palette.cpp b/win-linux/extras/online-installer/src/uiclasses/palette.cpp deleted file mode 100644 index 145bf9d83..000000000 --- a/win-linux/extras/online-installer/src/uiclasses/palette.cpp +++ /dev/null @@ -1,64 +0,0 @@ -#include "palette.h" - - -Palette::Palette() -{ - palette[Background][Disabled] = 0x21252b; - palette[Background][Normal] = 0x21252b; - palette[Background][Hover] = 0x34383f; - palette[Background][Pressed] = 0x30343c; - palette[Border][Disabled] = 0x21252b; - palette[Border][Normal] = 0x21252b; - palette[Border][Hover] = 0x34383f; - palette[Border][Pressed] = 0x30343c; - palette[Base][Disabled] = 0x0000ff; - palette[Base][Normal] = 0x0000ff; - palette[Base][Hover] = 0x0000ff; - palette[Base][Pressed] = 0x0000ff; - palette[AlternateBase][Disabled] = 0xff0000; - palette[AlternateBase][Normal] = 0xff0000; - palette[AlternateBase][Hover] = 0xff0000; - palette[AlternateBase][Pressed] = 0xff0000; - palette[Text][Disabled] = 0xeeeeee; - palette[Text][Normal] = 0xeeeeee; - palette[Text][Hover] = 0xaaaaaa; - palette[Text][Pressed] = 0xaaaaaa; - palette[Primitive][Disabled] = 0xeeeeee; - palette[Primitive][Normal] = 0xeeeeee; - palette[Primitive][Hover] = 0xeeeeee; - palette[Primitive][Pressed] = 0xeeeeee; - palette[AlternatePrimitive][Disabled] = 0x888888; - palette[AlternatePrimitive][Normal] = 0x333333; - palette[AlternatePrimitive][Hover] = 0x333333; - palette[AlternatePrimitive][Pressed] = 0x333333; - - setCurrentState(Normal); -} - -Palette::~Palette() -{ - -} - -COLORREF Palette::color(Role role) -{ - return RGB((currentColors[role] & 0xff0000) >> 16, (currentColors[role] & 0xff00) >> 8, currentColors[role] & 0xff); -} - -void Palette::setColor(Role role, State state, DWORD color) -{ - palette[role][state] = color; - currentColors[role] = palette[role][currentState]; -} - -void Palette::setCurrentState(State state) -{ - currentColors[Background] = palette[Background][state]; - currentColors[Border] = palette[Border][state]; - currentColors[Base] = palette[Base][state]; - currentColors[AlternateBase] = palette[AlternateBase][state]; - currentColors[Text] = palette[Text][state]; - currentColors[Primitive] = palette[Primitive][state]; - currentColors[AlternatePrimitive] = palette[AlternatePrimitive][state]; - currentState = state; -} diff --git a/win-linux/extras/online-installer/src/uiclasses/palette.h b/win-linux/extras/online-installer/src/uiclasses/palette.h deleted file mode 100644 index e16b6f85e..000000000 --- a/win-linux/extras/online-installer/src/uiclasses/palette.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef PALETTE_H -#define PALETTE_H - -#include - - -class Palette -{ -public: - Palette(); - ~Palette(); - - enum Role : BYTE { - Background = 0, - Border, - Base, - AlternateBase, - Text, - Primitive, - AlternatePrimitive, - PALETTE_ROLE_COUNT - }; - - enum State : BYTE { - Disabled = 0, - Normal, - Hover, - Pressed, - PALETTE_STATE_COUNT - }; - - COLORREF color(Role); - void setColor(Role, State, DWORD); - void setCurrentState(State); - -private: - DWORD palette[PALETTE_ROLE_COUNT][PALETTE_STATE_COUNT]; - DWORD currentColors[PALETTE_ROLE_COUNT]; - State currentState; -}; - -#endif // PALETTE_H diff --git a/win-linux/extras/online-installer/src/uiclasses/progressbar.cpp b/win-linux/extras/online-installer/src/uiclasses/progressbar.cpp deleted file mode 100644 index 348bef523..000000000 --- a/win-linux/extras/online-installer/src/uiclasses/progressbar.cpp +++ /dev/null @@ -1,110 +0,0 @@ -#include "progressbar.h" -#include "drawningengine.h" - -#define DEFAULT_PULSE_STEP 1 - - -ProgressBar::ProgressBar(Widget *parent) : - Widget(parent, ObjectType::WidgetType), - m_progress(0), - m_pulse_pos(-1), - m_pulse_direction(1), - m_pulse_step(DEFAULT_PULSE_STEP) -{ - -} - -ProgressBar::~ProgressBar() -{ - -} - -void ProgressBar::setProgress(int progress) -{ - m_progress = progress; - update(); -} - -void ProgressBar::pulse(bool enable) -{ - m_pulse_pos = enable ? 0 : -1; - m_pulse_direction = 1; - if (enable) { - // timeBeginPeriod(1); - SetTimer(m_hWnd, PROGRESS_PULSE_TIMER_ID, 17, NULL); - } else { - KillTimer(m_hWnd, PROGRESS_PULSE_TIMER_ID); - // timeEndPeriod(1); - } -} - -void ProgressBar::setPulseStep(int step) -{ - if (step < 1) - step = 1; - else - if (step > 50) - step = 50; - m_pulse_step = step; -} - -bool ProgressBar::event(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT *result) -{ - switch (msg) { - // case WM_LBUTTONDOWN: { - // palette()->setCurrentState(Palette::Pressed); - // repaint(); - // return false; - // } - - // case WM_LBUTTONUP: { - // palette()->setCurrentState(Palette::Hover); - // repaint(); - // break; - // } - // case WM_MOUSEENTER: { - // palette()->setCurrentState(Palette::Hover); - // repaint(); - // break; - // } - - // case WM_MOUSELEAVE: - // case WM_NCMOUSELEAVE: { - // palette()->setCurrentState(Palette::Normal); - // repaint(); - // break; - // } - - case WM_PAINT: { - RECT rc; - GetClientRect(m_hWnd, &rc); - - engine()->Begin(this, m_hWnd, &rc); - engine()->DrawProgressBar(m_progress, m_pulse_pos); - engine()->End(); - - *result = FALSE; - return true; - } - - case WM_TIMER: { - if (wParam == PROGRESS_PULSE_TIMER_ID) { - m_pulse_pos += m_pulse_direction * m_pulse_step; - if (m_pulse_pos >= 100) { - m_pulse_pos = 100; - m_pulse_direction = -1; - } else - if (m_pulse_pos <= 0) { - m_pulse_pos = 0; - m_pulse_direction = 1; - } - update(); - } - break; - } - - default: - break; - } - return Widget::event(msg, wParam, lParam, result); -} diff --git a/win-linux/extras/online-installer/src/uiclasses/progressbar.h b/win-linux/extras/online-installer/src/uiclasses/progressbar.h deleted file mode 100644 index 31ca56e47..000000000 --- a/win-linux/extras/online-installer/src/uiclasses/progressbar.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef PROGRESSBAR_H -#define PROGRESSBAR_H - -#include "widget.h" -//#include - - -class ProgressBar : public Widget -{ -public: - ProgressBar(Widget *parent = nullptr); - virtual ~ProgressBar(); - - void setProgress(int progress); - void pulse(bool); - void setPulseStep(int); - - /* callback */ - -protected: - virtual bool event(UINT, WPARAM, LPARAM, LRESULT*) override; - -private: - int m_progress, - m_pulse_pos, - m_pulse_direction, - m_pulse_step; -}; - -#endif // PROGRESSBAR_H diff --git a/win-linux/extras/online-installer/src/uiclasses/radiobutton.cpp b/win-linux/extras/online-installer/src/uiclasses/radiobutton.cpp deleted file mode 100644 index 7dfd622b8..000000000 --- a/win-linux/extras/online-installer/src/uiclasses/radiobutton.cpp +++ /dev/null @@ -1,59 +0,0 @@ -#include "radiobutton.h" -#include "drawningengine.h" -#include "metrics.h" -#include - - -RadioButton::RadioButton(Widget *parent, const std::wstring &text) : - AbstractButton(parent, text), - m_checked(false) -{ - metrics()->setMetrics(Metrics::TextAlignment, Metrics::AlignHLeft | Metrics::AlignVCenter); -} - -RadioButton::~RadioButton() -{ - -} - -void RadioButton::setChecked(bool checked) -{ - m_checked = checked; - update(); -} - -bool RadioButton::isChecked() -{ - return m_checked; -} - -bool RadioButton::event(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT *result) -{ - switch (msg) { - case WM_PAINT: { - RECT rc; - GetClientRect(m_hWnd, &rc); - - engine()->Begin(this, m_hWnd, &rc); - engine()->DrawRadioButton(m_text, m_hFont, m_checked); - if (metrics()->value(Metrics::BorderWidth) != 0) - engine()->DrawBorder(); - - engine()->End(); - - *result = FALSE; - return true; - } - - default: - break; - } - return AbstractButton::event(msg, wParam, lParam, result); -} - -void RadioButton::click() -{ - m_checked = true; - update(); - AbstractButton::click(); -} diff --git a/win-linux/extras/online-installer/src/uiclasses/radiobutton.h b/win-linux/extras/online-installer/src/uiclasses/radiobutton.h deleted file mode 100644 index ad76d07b6..000000000 --- a/win-linux/extras/online-installer/src/uiclasses/radiobutton.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef RADIOBUTTON_H -#define RADIOBUTTON_H - -#include "abstractbutton.h" - - -class RadioButton : public AbstractButton -{ -public: - RadioButton(Widget *parent = nullptr, const std::wstring &text = L""); - virtual ~RadioButton(); - - void setChecked(bool checked); - bool isChecked(); - - /* callback */ - -protected: - virtual bool event(UINT, WPARAM, LPARAM, LRESULT*) override; - virtual void click() override; - -private: - bool m_checked; -}; - -#endif // RADIOBUTTON_H diff --git a/win-linux/extras/online-installer/src/uiclasses/widget.cpp b/win-linux/extras/online-installer/src/uiclasses/widget.cpp deleted file mode 100644 index a48a0b55f..000000000 --- a/win-linux/extras/online-installer/src/uiclasses/widget.cpp +++ /dev/null @@ -1,417 +0,0 @@ -#include "widget.h" -#include "application.h" -#include "metrics.h" -#include "palette.h" -#include "drawningengine.h" -#include - - -static bool isAllocOnHeap(void *addr) { - if (HANDLE procHeap = GetProcessHeap()) { - if (HeapLock(procHeap)) { - bool res = false; - PROCESS_HEAP_ENTRY entry = {0}; - while (HeapWalk(procHeap, &entry)) { - if ((entry.wFlags & PROCESS_HEAP_REGION) && addr >= (void*)entry.Region.lpFirstBlock && addr <= (void*)entry.Region.lpLastBlock) { - res = true; - break; - } - } - if (!HeapUnlock(procHeap)) - res = false; - return res; - } - } - return false; -} - - -Widget::Widget(Widget *parent) : - Widget(parent, ObjectType::WidgetType) -{} - -Widget::Widget(Widget *parent, ObjectType type, HWND hwnd, const Rect &rc) : - Object(parent), - DrawningSurface(), - m_hWnd(hwnd), - m_hFont(nullptr), - m_layout(nullptr), - m_disabled(false), - m_is_created(false), - m_is_destroyed(false), - m_is_class_destroyed(false), - m_mouse_entered(false) -{ - m_properties[Properties::HSizeBehavior] = SizeBehavior::Expanding; - m_properties[Properties::VSizeBehavior] = SizeBehavior::Expanding; - if (m_hWnd) { - LONG style = ::GetWindowLong(m_hWnd, GWL_STYLE) | WS_CHILD; - ::SetWindowLong(m_hWnd, GWL_STYLE, style); - SetParent(m_hWnd, parent->nativeWindowHandle()); - } else { - Application::instance()->registerWidget(this, type, rc); - } -} - -Widget::~Widget() -{ - m_is_class_destroyed = true; - if (m_layout) { - if (isAllocOnHeap(m_layout)) - delete m_layout; - m_layout = nullptr; - } - if (!m_is_destroyed) - DestroyWindow(m_hWnd); - if (m_hFont) - DeleteObject(m_hFont); -} - -void Widget::setGeometry(int x, int y, int width, int height) -{ - SetWindowPos(m_hWnd, NULL, x, y, width, height, SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOOWNERZORDER /*| SWP_NOSENDCHANGING*/); -} - -void Widget::setDisabled(bool disable) -{ - m_disabled = disable; - palette()->setCurrentState(disable ? Palette::Disabled : Palette::Normal); - update(); -} - -void Widget::close() -{ - PostMessage(m_hWnd, WM_CLOSE, 0, 0); -} - -void Widget::move(int x, int y) -{ - SetWindowPos(m_hWnd, NULL, x, y, 0, 0, SWP_NOSIZE | SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOOWNERZORDER /*| SWP_NOSENDCHANGING*/); -} - -void Widget::resize(int w, int h) -{ - SetWindowPos(m_hWnd, NULL, 0, 0, w, h, SWP_NOMOVE | SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOOWNERZORDER /*| SWP_NOSENDCHANGING*/); -} - -Widget *Widget::parentWidget() -{ - return dynamic_cast(parent()); -} - -std::wstring Widget::title() -{ - return m_title; -} - -Size Widget::size() -{ - RECT rc; - GetClientRect(m_hWnd, &rc); - return Size(rc.right - rc.left, rc.bottom - rc.top); -} - -void Widget::size(int *width, int *height) -{ - RECT rc; - GetClientRect(m_hWnd, &rc); - *width = rc.right - rc.left; - *height = rc.bottom - rc.top; -} - -void Widget::setWindowTitle(const std::wstring &title) -{ - m_title = title; - SetWindowText(m_hWnd, title.c_str()); -} - -void Widget::setProperty(Properties property, int val) -{ - m_properties[property] = val; -} - -void Widget::setFont(const std::wstring &font) -{ - if (m_hFont) { - DeleteObject(m_hFont); - m_hFont = nullptr; - } - m_hFont = CreateFontW(metrics()->value(Metrics::FontHeight), metrics()->value(Metrics::FontWidth), 0, 0, FW_NORMAL, 0, 0, 0, - DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, CLEARTYPE_QUALITY, DEFAULT_PITCH, - font.empty() ? L"Arial" : font.c_str()); -} - -void Widget::show() -{ - ShowWindow(m_hWnd, SW_SHOWNORMAL); - UpdateWindow(m_hWnd); -} - -void Widget::hide() -{ - ShowWindow(m_hWnd, SW_HIDE); -} - -void Widget::repaint() -{ - if (IsWindowVisible(m_hWnd)) - RedrawWindow(m_hWnd, NULL, NULL, RDW_INVALIDATE | RDW_NOERASE | RDW_INTERNALPAINT | RDW_UPDATENOW); -} - -void Widget::update() -{ - if (IsWindowVisible(m_hWnd)) - RedrawWindow(m_hWnd, NULL, NULL, RDW_INVALIDATE | RDW_NOERASE | RDW_INTERNALPAINT); -} - -void Widget::setLayout(Layout *layout) -{ - if (m_layout) { - // TODO: error: trying to add a layout when the widget contains a layout - } else { - m_layout = layout; - } -} - -bool Widget::isCreated() -{ - return m_is_created; -} - -bool Widget::underMouse() -{ - POINT pt; - GetCursorPos(&pt); - return WindowFromPoint(pt) == m_hWnd; -} - -int Widget::property(Properties property) -{ - return m_properties[property]; -} - -Layout *Widget::layout() -{ - return m_layout; -} - -HWND Widget::nativeWindowHandle() -{ - return m_hWnd; -} - -Widget *Widget::widgetFromHwnd(Widget *parent, HWND hwnd) -{ - return new Widget(parent, Object::WidgetType, hwnd); -} - -int Widget::onResize(const FnVoidIntInt &callback) -{ - m_resize_callbacks[++m_connectionId] = callback; - return m_connectionId; -} - -int Widget::onMove(const FnVoidIntInt &callback) -{ - m_move_callbacks[++m_connectionId] = callback; - return m_connectionId; -} - -int Widget::onAboutToDestroy(const FnVoidVoid &callback) -{ - m_destroy_callbacks[++m_connectionId] = callback; - return m_connectionId; -} - -int Widget::onCreate(const FnVoidVoid &callback) -{ - m_create_callbacks[++m_connectionId] = callback; - return m_connectionId; -} - -int Widget::onClose(const FnVoidBoolPtr &callback) -{ - m_close_callbacks[++m_connectionId] = callback; - return m_connectionId; -} - -void Widget::disconnect(int connectionId) -{ - { - auto it = m_resize_callbacks.find(connectionId); - if (it != m_resize_callbacks.end()) { - m_resize_callbacks.erase(it); - return; - } - } - { - auto it = m_move_callbacks.find(connectionId); - if (it != m_move_callbacks.end()) { - m_move_callbacks.erase(it); - return; - } - } - { - auto it = m_destroy_callbacks.find(connectionId); - if (it != m_destroy_callbacks.end()) { - m_destroy_callbacks.erase(it); - return; - } - } - { - auto it = m_create_callbacks.find(connectionId); - if (it != m_create_callbacks.end()) { - m_create_callbacks.erase(it); - return; - } - } - { - auto it = m_close_callbacks.find(connectionId); - if (it != m_close_callbacks.end()) { - m_close_callbacks.erase(it); - return; - } - } -} - -bool Widget::event(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT *result) -{ - switch (msg) { - case WM_ACTIVATE: - break; - - case WM_CREATE: { - m_is_created = true; - for (auto it = m_create_callbacks.begin(); it != m_create_callbacks.end(); it++) - if (it->second) - (it->second)(); - setFont(Application::instance()->font()); - break; - } - - case WM_SIZE: - if (m_layout) - m_layout->onResize(LOWORD(lParam), HIWORD(lParam)); - for (auto it = m_resize_callbacks.begin(); it != m_resize_callbacks.end(); it++) - if (it->second) - (it->second)(LOWORD(lParam), HIWORD(lParam)); - break; - - case WM_MOVE: - for (auto it = m_move_callbacks.begin(); it != m_move_callbacks.end(); it++) - if (it->second) - (it->second)(LOWORD(lParam), HIWORD(lParam)); - break; - - case WM_PAINT: { - RECT rc; - GetClientRect(m_hWnd, &rc); - engine()->Begin(this, m_hWnd, &rc); - engine()->FillBackground(); - if (metrics()->value(Metrics::BorderWidth) != 0) - engine()->DrawBorder(); - //DrawRoundedRect(); - engine()->End(); - *result = FALSE; - return true; - } - - case WM_LBUTTONDOWN: - case WM_NCLBUTTONDOWN: { - break; - } - - case WM_ERASEBKGND: { - *result = FALSE; - return true; - } - - case WM_LBUTTONDBLCLK: { - break; - } - - case WM_LBUTTONUP: { - break; - } - - case WM_MOUSEMOVE: { - if (!m_mouse_entered) { - m_mouse_entered = true; - PostMessage(m_hWnd, WM_MOUSEENTER, 0, 0); - } - // add here impl onMouseMove - TRACKMOUSEEVENT tme; - tme.cbSize = sizeof(tme); - tme.hwndTrack = m_hWnd; - tme.dwFlags = TME_LEAVE /*| TME_HOVER*/; - tme.dwHoverTime = HOVER_DEFAULT; - _TrackMouseEvent(&tme); - break; - } - - case WM_NCMOUSEMOVE: { - if (!m_mouse_entered) { - m_mouse_entered = true; - PostMessage(m_hWnd, WM_MOUSEENTER, 0, 0); - } - // add here impl onMouseMove - break; - } - - case WM_MOUSEHOVER: - case WM_NCMOUSEHOVER: { - break; - } - - case WM_MOUSEENTER: { - // palette()->setCurrentState(Palette::Hover); - // repaint(); - break; - } - - case WM_MOUSELEAVE: - case WM_NCMOUSELEAVE: { - if (m_mouse_entered) { - m_mouse_entered = false; - } - // palette()->setCurrentState(Palette::Normal); - // repaint(); - break; - } - - case WM_CLOSE: { - bool accept = true; - for (auto it = m_close_callbacks.begin(); it != m_close_callbacks.end(); it++) - if (it->second) - (it->second)(&accept); - if (accept) - DestroyWindow(m_hWnd); - *result = TRUE; - return true; - } - - case WM_DESTROY: { - m_is_destroyed = true; - for (auto it = m_destroy_callbacks.begin(); it != m_destroy_callbacks.end(); it++) - if (it->second) - (it->second)(); - - if (!m_is_class_destroyed) { - if (isAllocOnHeap(this)) { - SetWindowLongPtr(m_hWnd, GWLP_USERDATA, 0); - delete this; - } - } - break; - } - - default: - break; - } - return false; -} - -void Widget::setNativeWindowHandle(HWND hWnd) -{ - m_hWnd = hWnd; -} diff --git a/win-linux/extras/online-installer/src/uiclasses/widget.h b/win-linux/extras/online-installer/src/uiclasses/widget.h deleted file mode 100644 index 6d748cbce..000000000 --- a/win-linux/extras/online-installer/src/uiclasses/widget.h +++ /dev/null @@ -1,90 +0,0 @@ -#ifndef WIDGET_H -#define WIDGET_H - -#include "object.h" -#include "drawingsurface.h" -#include "layout.h" -#include "commondefines.h" -#include -#include - - -class Widget : public Object, public DrawningSurface -{ -public: - Widget(Widget *parent = nullptr); - virtual ~Widget(); - - enum Properties : BYTE { - HSizeBehavior, - VSizeBehavior, - PROPERTIES_COUNT - }; - - enum SizeBehavior : BYTE { - Fixed, - Expanding, - //Preferred - }; - - virtual void setGeometry(int, int, int, int); - void setDisabled(bool); - void close(); - void move(int, int); - void resize(int, int); - Widget* parentWidget(); - std::wstring title(); - Size size(); - void size(int*, int*); - void setWindowTitle(const std::wstring &title); - void setProperty(Properties, int); - void setFont(const std::wstring &font); - void show(); - void hide(); - void repaint(); - void update(); - void setLayout(Layout *lut); - bool isCreated(); - bool underMouse(); - int property(Properties); - Layout* layout(); - HWND nativeWindowHandle(); - static Widget* widgetFromHwnd(Widget *parent, HWND); - - /* callback */ - int onResize(const FnVoidIntInt &callback); - int onMove(const FnVoidIntInt &callback); - int onAboutToDestroy(const FnVoidVoid &callback); - int onCreate(const FnVoidVoid &callback); - int onClose(const FnVoidBoolPtr &callback); - - virtual void disconnect(int) override; - -protected: - friend class Application; - Widget(Widget *parent, ObjectType type, HWND hWnd = nullptr, const Rect &rc = Rect(CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT)); - virtual bool event(UINT, WPARAM, LPARAM, LRESULT*); - - HWND m_hWnd; - HFONT m_hFont; - Layout *m_layout; - std::wstring m_title; - bool m_disabled; - -private: - void setNativeWindowHandle(HWND); - - int m_properties[PROPERTIES_COUNT]; - std::unordered_map m_resize_callbacks, - m_move_callbacks; - std::unordered_map m_create_callbacks, - m_destroy_callbacks; - std::unordered_map m_close_callbacks; - - bool m_is_created, - m_is_destroyed, - m_is_class_destroyed, - m_mouse_entered; -}; - -#endif // WIDGET_H diff --git a/win-linux/extras/online-installer/src/uiclasses/window.cpp b/win-linux/extras/online-installer/src/uiclasses/window.cpp deleted file mode 100644 index 7665e429f..000000000 --- a/win-linux/extras/online-installer/src/uiclasses/window.cpp +++ /dev/null @@ -1,534 +0,0 @@ -#include "window.h" -#include "baseutils.h" -#include "palette.h" -#include "metrics.h" -#include "drawningengine.h" -#include - -#define DCX_USESTYLE 0x00010000 -#define NC_AREA_WIDTH 3 -#define MAIN_WINDOW_BORDER_WIDTH 1 - -using WinVer = Utils::WinVer; - - -static BOOL CALLBACK EnumChildProc(_In_ HWND hwnd, _In_ LPARAM lParam) -{ - ShowWindow(hwnd, SW_SHOWNORMAL); - UpdateWindow(hwnd); - return TRUE; -} - -static double GetLogicalDpi(HWND hWnd) -{ - if (HMODULE module = GetModuleHandleA("user32")) { - UINT(WINAPI *_GetDpiForWindow)(HWND) = NULL; - *(FARPROC*)&_GetDpiForWindow = GetProcAddress(module, "GetDpiForWindow"); - if (_GetDpiForWindow) - return (double)_GetDpiForWindow(hWnd)/96; - } - HDC hdc = GetDC(NULL); - double dpi = (double)GetDeviceCaps(hdc, LOGPIXELSX)/96; - ReleaseDC(NULL, hdc); - return dpi; -} - -static Rect availableGeometry(HWND hwnd) -{ - Rect rc; - if (HMONITOR monitor = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST)) { - MONITORINFOEX monInfo; - ZeroMemory(&monInfo, sizeof(monInfo)); - monInfo.cbSize = sizeof(MONITORINFOEX); - if (GetMonitorInfo(monitor, &monInfo)) - rc = Rect(monInfo.rcWork.left, monInfo.rcWork.top, monInfo.rcWork.right - monInfo.rcWork.left, monInfo.rcWork.bottom - monInfo.rcWork.top); - } - return rc; -} - -static void GetFrameMetricsForDpi(FRAME &frame, double dpi, bool maximized = false) -{ - WinVer ver = Utils::getWinVersion(); - int row = ver == WinVer::WinXP ? 0 : - ver <= WinVer::Win7 ? 1 : - ver <= WinVer::Win8_1 ? 2 : - ver <= WinVer::Win10 ? 3 : 4; - - int column = dpi <= 1.0 ? 0 : - dpi <= 1.25 ? 1 : - dpi <= 1.5 ? 2 : - dpi <= 1.75 ? 3 : - dpi <= 2.0 ? 4 : - dpi <= 2.25 ? 5 : - dpi <= 2.5 ? 6 : - dpi <= 3.0 ? 7 : - dpi <= 3.5 ? 8 : - dpi <= 4.0 ? 9 : - dpi <= 4.5 ? 10 : - dpi <= 5.0 ? 11 : 12; - - const int left[5][13] = { // Left margin for scales 100-500% - {0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 2, 2}, // WinXp: for NC width 3px - {7, 8, 10, 11, 12, 13, 15, 17, 20, 22, 25, 27, 32}, // WinVista - Win7 - {7, 8, 10, 11, 12, 13, 15, 17, 20, 22, 25, 27, 32}, // Win8 - Win8.1 - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, // Win10 - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} // Win11 - }; - frame.left = left[row][column]; - - const int top[5][13] = { // Top margin for scales 100-500% - {0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 2, 2}, // WinXp: for NC width 3px - {7, 8, 10, 11, 12, 13, 15, 17, 20, 22, 25, 27, 32}, // WinVista - Win7 - {7, 8, 10, 11, 12, 13, 15, 17, 20, 22, 25, 27, 32}, // Win8 - Win8.1 - {31, 38, 45, 52, 58, 65, 72, 85, 99, 112, 126, 139, 167}, // Win10 - {30, 37, 43, 50, 56, 63, 69, 82, 95, 108, 121, 134, 161} // Win11 - }; - frame.top = top[row][column]; - - if (!maximized) - return; - - const int left_ofs[5][13] = { // Left offset for scales 100-500% - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, // WinXp - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, // WinVista - Win7 - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, // Win8 - Win8.1 - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, // Win10 - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} // Win11 - }; - frame.left -= left_ofs[row][column]; - - const int top_ofs[5][13] = { // Top offset for scales 100-500% - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, // WinXp - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, // WinVista - Win7 - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, // Win8 - Win8.1 - {8, 9, 11, 12, 13, 14, 16, 18, 21, 24, 27, 30, 36}, // Win10 - {7, 8, 9, 10, 11, 12, 13, 15, 17, 19, 21, 23, 28} // Win11 - }; - frame.top -= top_ofs[row][column]; -} - -static bool isTaskbarAutoHideOn() -{ - APPBARDATA ABData; - ABData.cbSize = sizeof(ABData); - return (SHAppBarMessage(ABM_GETSTATE, &ABData) & ABS_AUTOHIDE) != 0; -} - -static bool isThemeActive() -{ - static BOOL(WINAPI *IsThemeActive)() = NULL; - if (!IsThemeActive) { - if (HMODULE module = GetModuleHandleA("uxtheme")) - *(FARPROC*)&IsThemeActive = GetProcAddress(module, "IsThemeActive"); - } - return IsThemeActive ? (bool)IsThemeActive() : true; -} - -Window::Window(Widget *parent, const Rect &rc) : - Widget(parent, ObjectType::WindowType, nullptr, rc), - m_centralWidget(nullptr), - m_contentMargins(0,0,0,0), - m_resAreaWidth(0), - m_state(-1), - m_borderless(true), - m_isResizable(true), - m_scaleChanged(false), - m_init_size(rc.width, rc.height) -{ - //setLayout(new BoxLayout(BoxLayout::Vertical)); - m_isThemeActive = isThemeActive(); - m_isTaskbarAutoHideOn = isTaskbarAutoHideOn(); - m_borderless = true;//isCustomWindowStyle(); - - if (m_borderless && Utils::getWinVersion() < WinVer::Win10) { - LONG style = ::GetWindowLong(m_hWnd, GWL_STYLE) | WS_OVERLAPPEDWINDOW; - ::SetWindowLong(m_hWnd, GWL_STYLE, style & ~WS_CAPTION); - } - m_isMaximized = IsZoomed(m_hWnd); - m_dpi = GetLogicalDpi(m_hWnd); - GetFrameMetricsForDpi(m_frame, m_dpi, m_isMaximized); - - if (m_borderless && Utils::getWinVersion() == WinVer::Win10) { - HDC hdc = GetDC(NULL); - m_brdWidth = GetSystemMetrics(SM_CXBORDER) * GetDeviceCaps(hdc, LOGPIXELSX)/96; - ReleaseDC(NULL, hdc); - m_brdColor = Utils::getColorizationColor(true, palette()->color(Palette::Background)); - } - SetWindowPos(m_hWnd, NULL, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED); -} - -Window::~Window() -{ - //if (m_layout) - // delete m_layout, m_layout = nullptr; -} - -void Window::setCentralWidget(Widget *wgt) -{ - m_centralWidget = wgt; -} - -void Window::setContentsMargins(int left, int top, int right, int bottom) -{ - m_contentMargins = Margins(left, top, right, bottom); - if (IsWindowVisible(m_hWnd)) - SetWindowPos(m_hWnd, NULL, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED); -} - -void Window::setResizable(bool isResizable) -{ - if (m_isResizable != isResizable) { - m_isResizable = isResizable; - LONG style = ::GetWindowLong(m_hWnd, GWL_STYLE); - ::SetWindowLong(m_hWnd, GWL_STYLE, m_isResizable ? style | WS_MAXIMIZEBOX : style & ~WS_MAXIMIZEBOX); - } -} - -void Window::showAll() -{ - ShowWindow(m_hWnd, SW_SHOWNORMAL); - UpdateWindow(m_hWnd); - EnumChildWindows(m_hWnd, EnumChildProc, 0); - SetForegroundWindow(m_hWnd); -} - -void Window::showNormal() -{ - ShowWindow(m_hWnd, SW_RESTORE); -} - -void Window::showMinimized() -{ - ShowWindow(m_hWnd, SW_SHOWMINIMIZED); -} - -void Window::showMaximized() -{ - ShowWindow(m_hWnd, SW_SHOWMAXIMIZED); -} - -void Window::setIcon(int id) -{ - HMODULE hInstance = GetModuleHandle(NULL); - HICON hIcon = (HICON)LoadImage(hInstance, MAKEINTRESOURCE(id), IMAGE_ICON, 96, 96, LR_DEFAULTCOLOR | LR_SHARED); - SendMessage(m_hWnd, WM_SETICON, ICON_SMALL, (LPARAM)hIcon); - SendMessage(m_hWnd, WM_SETICON, ICON_BIG, (LPARAM)hIcon); -} - -bool Window::isMinimized() -{ - WINDOWPLACEMENT wpl; - wpl.length = sizeof(wpl); - if (GetWindowPlacement(m_hWnd, &wpl)) - return wpl.showCmd == SW_SHOWMINIMIZED; - return false; -} - -bool Window::isMaximized() -{ - WINDOWPLACEMENT wpl; - wpl.length = sizeof(wpl); - if (GetWindowPlacement(m_hWnd, &wpl)) - return wpl.showCmd == SW_SHOWMAXIMIZED; - return false; -} - -Widget *Window::centralWidget() -{ - return m_centralWidget; -} - -int Window::onStateChanged(const FnVoidInt &callback) -{ - m_state_callbacks[++m_connectionId] = callback; - return m_connectionId; -} - -void Window::disconnect(int connectionId) -{ - auto it = m_state_callbacks.find(connectionId); - if (it != m_state_callbacks.end()) - m_state_callbacks.erase(it); -} - -bool Window::event(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT *result) -{ - switch (msg) { - case WM_DPICHANGED: { - m_dpi = (double)HIWORD(wParam)/96; - RECT *prc = (RECT*)lParam; - GetFrameMetricsForDpi(m_frame, m_dpi, m_isMaximized); - SetWindowPos(m_hWnd, NULL, prc->left, prc->top, prc->right - prc->left, prc->bottom - prc->top, SWP_NOZORDER | SWP_NOACTIVATE); - break; - } - - case WM_NCMOUSEMOVE: - case WM_MOUSEMOVE: { - //int x = GET_X_LPARAM(lParam); - //int y = GET_Y_LPARAM(lParam); - //printf("Window Move Event: %d x %d \t %lld\n", x, y, (long long)this); - //fflush(stdout); - break; - } - - case WM_MOUSEHOVER: - case WM_NCMOUSEHOVER: { - //int x = GET_X_LPARAM(lParam); - //int y = GET_Y_LPARAM(lParam); - //printf("Window Hover Event: %d x %d \t %lld\n", x, y, (long long)this); - //fflush(stdout); - break; - } - - case WM_PAINT: { - RECT rc; - GetClientRect(m_hWnd, &rc); - engine()->Begin(this, m_hWnd, &rc); - engine()->FillBackground(); - if (metrics()->value(Metrics::BorderWidth) != 0) - engine()->DrawBorder(); - if (m_brdWidth != 0) - engine()->DrawTopBorder(m_brdWidth, m_brdColor); - engine()->End(); - *result = FALSE; - return true; - } - - case WM_NCPAINT: { - if (Utils::getWinVersion() > WinVer::Win7 || !m_borderless) - return false; - if (HDC hdc = ::GetDCEx(m_hWnd, 0, DCX_WINDOW | DCX_USESTYLE)) { - RECT rcc, rcw; - ::GetClientRect(m_hWnd, &rcc); - ::GetWindowRect(m_hWnd, &rcw); - POINT pt; - pt.x = rcw.left; - pt.y = rcw.top; - ::MapWindowPoints(0, m_hWnd, (LPPOINT)&rcw, (sizeof(RECT)/sizeof(POINT))); - ::OffsetRect(&rcc, -rcw.left, -rcw.top); - ::OffsetRect(&rcw, -rcw.left, -rcw.top); - HRGN rgntemp = NULL; - if (wParam == NULLREGION || wParam == ERROR) { - ::ExcludeClipRect(hdc, rcc.left, rcc.top, rcc.right, rcc.bottom); - } else { - rgntemp = ::CreateRectRgn(rcc.left + pt.x, rcc.top + pt.y, rcc.right + pt.x, rcc.bottom + pt.y); - if (::CombineRgn(rgntemp, (HRGN)wParam, rgntemp, RGN_DIFF) == NULLREGION) { - // nothing to paint - } - ::OffsetRgn(rgntemp, -pt.x, -pt.y); - ::ExtSelectClipRgn(hdc, rgntemp, RGN_AND); - } - HBRUSH hbrushBkg = ::CreateSolidBrush(palette()->color(Palette::Background)); - ::FillRect(hdc, &rcw, hbrushBkg); - ::DeleteObject(hbrushBkg); - - // HRGN hrgn = CreateRectRgn(0, 0, 0, 0); - // GetWindowRgn(msg->hwnd, hrgn); - HBRUSH hbrushBrd = ::CreateSolidBrush(palette()->color(Palette::Border)); - ::FrameRect(hdc, &rcw, hbrushBrd); // Drawing NC border when using ~WS_CAPTION - // ::FrameRgn(hdc, hrgn, hbrushBrd, 1, 1); // Drawing NC border when using WS_CAPTION - ::DeleteObject(hbrushBrd); - // ::DeleteObject(hrgn); - - ::ReleaseDC(m_hWnd, hdc); - if (rgntemp != 0) - ::DeleteObject(rgntemp); - return true; - } - return false; - } - - case WM_NCCALCSIZE: { - if (!m_borderless || !wParam) - return false; - NCCALCSIZE_PARAMS *params = (NCCALCSIZE_PARAMS*)lParam; - if (!m_isThemeActive) { - *result = m_isMaximized ? 0 : DefWindowProc(m_hWnd, WM_NCCALCSIZE, wParam, lParam); - return true; - } - LRESULT res = DefWindowProc(m_hWnd, WM_NCCALCSIZE, wParam, lParam); - params->rgrc[0].left -= m_frame.left; - params->rgrc[0].top -= m_frame.top; - params->rgrc[0].right += m_frame.left; - params->rgrc[0].bottom += m_frame.left; - if (m_isMaximized && m_isTaskbarAutoHideOn && (Utils::getWinVersion() >= WinVer::Win10)) - params->rgrc[0].bottom -= 2; - *result = res; - return true; - } - - case WM_NCHITTEST: { - if (m_isResizable) { - if (m_borderless) { - RECT rect; - GetWindowRect(m_hWnd, &rect); - long x = GET_X_LPARAM(lParam); - long y = GET_Y_LPARAM(lParam); - if (x <= rect.left + m_resAreaWidth) { - if (y <= rect.top + m_resAreaWidth) - *result = HTTOPLEFT; - else - if (y > rect.top + m_resAreaWidth && y < rect.bottom - m_resAreaWidth) - *result = HTLEFT; - else - if (y >= rect.bottom - m_resAreaWidth) - *result = HTBOTTOMLEFT; - } else - if (x > rect.left + m_resAreaWidth && x < rect.right - m_resAreaWidth) { - if (y <= rect.top + m_resAreaWidth) - *result = HTTOP; - else - if (y >= rect.bottom - m_resAreaWidth) - *result = HTBOTTOM; - } else - if (x >= rect.right - m_resAreaWidth) { - if (y <= rect.top + m_resAreaWidth) - *result = HTTOPRIGHT; - else - if (y > rect.top + m_resAreaWidth && y < rect.bottom - m_resAreaWidth) - *result = HTRIGHT; - else - if (y >= rect.bottom - m_resAreaWidth) - *result = HTBOTTOMRIGHT; - } - return *result != 0; - } - } else { - LRESULT hit = DefWindowProc(m_hWnd, msg, wParam, lParam); - if (hit == HTBOTTOM || hit == HTLEFT || hit == HTRIGHT || hit == HTTOP || - hit == HTBOTTOMLEFT || hit == HTBOTTOMRIGHT || hit == HTTOPLEFT || hit == HTTOPRIGHT) { - *result = HTCLIENT; - return true; - } - } - return false; - } - - case WM_NCACTIVATE: { - if (m_borderless) { - if (Utils::getWinVersion() > WinVer::WinXP && Utils::getWinVersion() < WinVer::Win10) { - // Prevent drawing of inactive system frame (needs ~WS_CAPTION or temporary ~WS_VISIBLE to work) - *result = DefWindowProc(m_hWnd, WM_NCACTIVATE, wParam, -1); - return true; - } else - if (Utils::getWinVersion() == WinVer::Win10) { - m_brdColor = Utils::getColorizationColor(LOWORD(wParam), palette()->color(Palette::Background)); - RECT rc; - GetClientRect(m_hWnd, &rc); - rc.bottom = m_brdWidth; - RedrawWindow(m_hWnd, &rc, NULL, RDW_INVALIDATE | RDW_NOERASE | RDW_INTERNALPAINT | RDW_UPDATENOW); - } - } - return false; - } - - case WM_GETMINMAXINFO: { - bool isMaximized = (bool)IsZoomed(m_hWnd); - if (m_isMaximized != isMaximized) { - m_isMaximized = isMaximized; - GetFrameMetricsForDpi(m_frame, m_dpi, isMaximized); - if (m_borderless && Utils::getWinVersion() == WinVer::Win10) { - if (isMaximized) { - m_brdWidth = 0; - } else { - HDC hdc = GetDC(NULL); - m_brdWidth = GetSystemMetrics(SM_CXBORDER) * GetDeviceCaps(hdc, LOGPIXELSX)/96; - ReleaseDC(NULL, hdc); - } - } - } - if (!m_isResizable) { - MINMAXINFO* minMaxInfo = (MINMAXINFO*)lParam; - minMaxInfo->ptMinTrackSize.x = m_init_size.width; - minMaxInfo->ptMinTrackSize.y = m_init_size.height; - minMaxInfo->ptMaxTrackSize.x = m_init_size.width; - minMaxInfo->ptMaxTrackSize.y = m_init_size.height; - } - break; - } - - case WM_THEMECHANGED: { - bool _isThemeActive = isThemeActive(); - if (m_isThemeActive != _isThemeActive) - m_isThemeActive = _isThemeActive; - break; - } - - case WM_SETTINGCHANGE: { - // if (wParam == SPI_SETWINARRANGING) { - // if (Utils::getWinVersion() > Utils::WinVer::Win10) - // SendMessage((HWND)m_boxTitleBtns->winId(), WM_SETTINGCHANGE, 0, 0); - // } - // printf(" Settings...\n"); - // fflush(stdout); - // snapLayoutAllowed = isArrangingAllowed(); - break; - } - - case WM_SIZING: { - // if (m_borderless) - // RedrawWindow(m_hWnd, NULL, NULL, RDW_INVALIDATE | RDW_NOERASE | RDW_INTERNALPAINT); - break; - } - - case WM_SIZE: { - switch (wParam) { - case SIZE_MAXIMIZED: - case SIZE_MINIMIZED: - case SIZE_RESTORED: { - if (m_state != (int)wParam) { - m_state = (int)wParam; - for (auto it = m_state_callbacks.begin(); it != m_state_callbacks.end(); it++) - if (it->second) - (it->second)(m_state); - - if (m_borderless) { - if (m_isMaximized) { - if (Utils::getWinVersion() < WinVer::Win10) { - m_resAreaWidth = 0; - Rect rc = availableGeometry(m_hWnd); - int offset = 0; - if (Utils::getWinVersion() == WinVer::WinXP) { - if (isTaskbarAutoHideOn()) - offset += NC_AREA_WIDTH + 1; - if (m_isThemeActive) { - rc.x += -NC_AREA_WIDTH; - rc.y += -NC_AREA_WIDTH; - rc.width += 2*NC_AREA_WIDTH; - rc.height += 2*NC_AREA_WIDTH; - } - } else - if (Utils::getWinVersion() > WinVer::WinXP && isTaskbarAutoHideOn()) - offset += 2; - SetWindowPos(m_hWnd, NULL, rc.x, rc.y, rc.width, rc.height - offset, SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOSENDCHANGING); - } - } else { - if (Utils::getWinVersion() < WinVer::Win10) { - m_resAreaWidth = (int)round(MAIN_WINDOW_BORDER_WIDTH * m_dpi); - if (Utils::getWinVersion() == WinVer::WinXP) - m_resAreaWidth -= NC_AREA_WIDTH; - } - } - } - } - if (m_centralWidget) { - int top_offset = 0; - if (m_borderless && !m_isMaximized && Utils::getWinVersion() == Utils::WinVer::Win10) - top_offset = m_brdWidth; - m_centralWidget->setGeometry(m_contentMargins.left + m_resAreaWidth, m_contentMargins.top + top_offset + m_resAreaWidth, - LOWORD(lParam) - m_contentMargins.right - m_contentMargins.left - 2*m_resAreaWidth, - HIWORD(lParam) - m_contentMargins.bottom - m_contentMargins.top - top_offset - 2*m_resAreaWidth); - } - break; - } - default: - break; - } - break; - } - - default: - break; - } - return Widget::event(msg, wParam, lParam, result); -} diff --git a/win-linux/extras/online-installer/src/uiclasses/window.h b/win-linux/extras/online-installer/src/uiclasses/window.h deleted file mode 100644 index 13d6ae10d..000000000 --- a/win-linux/extras/online-installer/src/uiclasses/window.h +++ /dev/null @@ -1,67 +0,0 @@ -#ifndef WINDOW_H -#define WINDOW_H - -#include "widget.h" - -#define DEFAULT_WINDOW_RECT Rect(100,100,1368,768) - - -struct FRAME { - FRAME() : left(0), top(0) - {} - FRAME(FRAME &frame) { - left = frame.left; - top = frame.top; - } - int left, top; -}; - -class Window : public Widget -{ -public: - Window(Widget *parent = nullptr, const Rect &rc = DEFAULT_WINDOW_RECT); - virtual ~Window(); - - void setCentralWidget(Widget*); - void setContentsMargins(int, int, int, int); - void setResizable(bool); - void showAll(); - void showNormal(); - void showMinimized(); - void showMaximized(); - void setIcon(int); - void setLayout(Layout*) = delete; - bool isMinimized(); - bool isMaximized(); - Widget *centralWidget(); - Layout *layout() = delete; - - /* callback */ - int onStateChanged(const FnVoidInt &callback); - - virtual void disconnect(int) override; - -protected: - virtual bool event(UINT, WPARAM, LPARAM, LRESULT*) override; - -private: - Widget *m_centralWidget; - Margins m_contentMargins; - COLORREF m_brdColor; - int m_brdWidth, - m_resAreaWidth, - m_state; - double m_dpi; - FRAME m_frame; - bool m_borderless, - m_isResizable, - m_isMaximized, - m_isThemeActive, - m_isTaskbarAutoHideOn, - m_scaleChanged; - Size m_init_size; - - std::unordered_map m_state_callbacks; -}; - -#endif // WINDOW_H diff --git a/win-linux/extras/online-installer/src/utils.cpp b/win-linux/extras/online-installer/src/utils.cpp deleted file mode 100644 index 83d00294e..000000000 --- a/win-linux/extras/online-installer/src/utils.cpp +++ /dev/null @@ -1,520 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * -*/ - -#include "utils.h" -#include "baseutils.h" -#include "resource.h" -#include "translator.h" -#include -#include -#include -#include -#include -#include -#include -// #include -#include "../../src/defines.h" -#include "../../src/prop/defines_p.h" - -#define APP_REG_PATH "\\" REG_GROUP_KEY "\\" REG_APP_NAME -#define BIT123_LAYOUTRTL 0x08000000 -#ifndef LOCALE_IREADINGLAYOUT -# define LOCALE_IREADINGLAYOUT 0x70 -#endif - - -static void RegQueryStringValue(HKEY rootKey, LPCWSTR subkey, REGSAM advFlags, LPCWSTR value, wstring &result) -{ - HKEY hKey; - if (RegOpenKeyExW(rootKey, subkey, 0, KEY_READ | advFlags, &hKey) == ERROR_SUCCESS) { - DWORD type = REG_SZ, cbData = 0; - if (SHGetValue(hKey, L"", value, &type, NULL, &cbData) == ERROR_SUCCESS) { - wchar_t *pvData = (wchar_t*)malloc(cbData); - if (SHGetValue(hKey, L"", value, &type, (void*)pvData, &cbData) == ERROR_SUCCESS) - result = pvData; - free(pvData); - } - RegCloseKey(hKey); - } -} - -namespace NS_Utils -{ - std::vector cmd_args; - - void parseCmdArgs(int argc, wchar_t *argv[]) - { - for (int i = 0; i < argc; i++) - cmd_args.push_back(argv[i]); - } - - bool cmdArgContains(const wstring ¶m) - { - auto len = param.length(); - return std::any_of(cmd_args.cbegin(), cmd_args.cend(), [¶m, len](const wstring &arg) { - return arg.find(param) == 0 && (len == arg.length() || arg[len] == L'=' || arg[len] == L':' || arg[len] == L'|'); - }); - } - - wstring cmdArgValue(const wstring ¶m) - { - auto len = param.length(); - for (const auto &arg : cmd_args) { - if (arg.find(param) == 0 && len < arg.length() && (arg[len] == L'=' || arg[len] == L':' || arg[len] == L'|')) - return arg.substr(len + 1); - } - return L""; - } - - wstring GetLastErrorAsString(DWORD _errID) - { - DWORD errID = _errID != 0 ? _errID : ::GetLastError(); - if (errID == 0) - return _T(""); - - LPTSTR msgBuff = NULL; - size_t size = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, errID, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&msgBuff, 0, NULL); - wstring msg = _TR(LABEL_ERR_COMMON) + wstring(L" ") + std::to_wstring(errID); - if (size > 0) { - msg.append(L"\n" + wstring(msgBuff, (int)size)); - LocalFree(msgBuff); - } - return msg; - } - - void ShowMessage(wstring str, bool showError) - { - if (showError) - str += _T(" ") + GetLastErrorAsString(); - wstring caption(_T(" ")); - caption.append(_TR(CAPTION)); - LCID lcid = MAKELCID(GetUserDefaultUILanguage(), SORT_DEFAULT); - UINT flags = MB_ICONERROR | MB_SERVICE_NOTIFICATION_NT3X | MB_SETFOREGROUND; - if (IsRtlLanguage(lcid)) - flags |= MB_RTLREADING; - MessageBox(NULL, str.c_str(), caption.c_str(), flags); - } - - int ShowTaskDialog(HWND parent, const wstring &msg, PCWSTR icon) - { - HWND fakeParent = NULL; - HMODULE hInst = GetModuleHandle(NULL); - if (!parent) { - WNDCLASS wc = {0}; - wc.lpfnWndProc = DefWindowProc; - wc.hInstance = hInst; - wc.lpszClassName = L"FakeWindowClass"; - RegisterClass(&wc); - fakeParent = CreateWindowEx(0, wc.lpszClassName, _TR(CAPTION), WS_OVERLAPPEDWINDOW, 0, 0, 0, 0, NULL, NULL, hInst, NULL); - HICON hIcon = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_MAINICON), IMAGE_ICON, 96, 96, LR_DEFAULTCOLOR | LR_SHARED); - SendMessage(fakeParent, WM_SETICON, ICON_SMALL, (LPARAM)hIcon); - SendMessage(fakeParent, WM_SETICON, ICON_BIG, (LPARAM)hIcon); - ShowWindow(fakeParent, SW_SHOWMINIMIZED); - UpdateWindow(fakeParent); - parent = fakeParent; - } - - int result = IDCANCEL; - wstring caption(_T(" ")); - caption.append(_TR(CAPTION)); - if (HMODULE lib = LoadLibrary(L"Comctl32")) { - HRESULT (WINAPI *_TaskDialog)(HWND, HINSTANCE, PCWSTR, PCWSTR, PCWSTR, TASKDIALOG_COMMON_BUTTON_FLAGS, PCWSTR, int*); - *(FARPROC*)&_TaskDialog = GetProcAddress(lib, "TaskDialog"); - if (_TaskDialog) - _TaskDialog(parent, hInst, caption.c_str(), msg.c_str(), NULL, TDCBF_OK_BUTTON | TDCBF_CANCEL_BUTTON, icon, &result); - FreeLibrary(lib); - } - - if (fakeParent) - DestroyWindow(fakeParent); - return result; - } - - bool IsRtlLanguage(unsigned long lcid) - { - if (Utils::getWinVersion() >= Utils::WinVer::Win7) { - DWORD layout = 0; - if (GetLocaleInfo(lcid, LOCALE_IREADINGLAYOUT | LOCALE_RETURN_NUMBER, (LPWSTR)&layout, sizeof(layout)/sizeof(WCHAR)) > 0) - return layout == 1; - } else { - LOCALESIGNATURE lsig; - if (GetLocaleInfo(lcid, LOCALE_FONTSIGNATURE, (LPWSTR)&lsig, sizeof(lsig)/sizeof(WCHAR)) > 0) - return (lsig.lsUsb[3] & BIT123_LAYOUTRTL) != 0; - } - return false; - } - - bool IsWin64() - { -#ifdef _WIN64 - return true; -#else - BOOL wow64 = FALSE; - return IsWow64Process(GetCurrentProcess(), &wow64) && wow64; -#endif - } - - bool IsAppInstalled(wstring &path, wstring *arch) - { - std::vector flags{0}; - if (NS_Utils::IsWin64()) { -#ifdef _WIN64 - flags.push_back(KEY_WOW64_32KEY); -#else - flags.push_back(KEY_WOW64_64KEY); -#endif - } - wstring subkey(L"Software"); - subkey += _T(APP_REG_PATH); - for (auto &flag : flags) { - RegQueryStringValue(HKEY_LOCAL_MACHINE, subkey.c_str(), flag, L"AppPath", path); - if (!path.empty() && (path.back() == L'\\' || path.back() == L'/')) - path.pop_back(); - if (!path.empty() /*&& NS_File::fileExists(path + _T(APP_LAUNCH_NAME))*/) { - if (arch) { -#ifdef _WIN64 - *arch = (flag == 0) ? L"x64" : L"x86"; -#else - *arch = (flag == 0) ? L"x86" : L"x64"; -#endif - } - return true; - } - } - return false; - } - - bool checkAndWaitForAppClosure(HWND parent) - { - bool accept = true; - if (HWND app_hwnd = FindWindow(WINDOW_CLASS_NAME, NULL)) { - wstring msg(_TR(MSG_ERR_TRY_CLOSE_APP)); - NS_Utils::Replace(msg, L"%1", _T(WINDOW_NAME)); - accept = (IDOK == NS_Utils::ShowTaskDialog(parent, msg.c_str(), TD_INFORMATION_ICON)); - if (accept) { - PostMessage(app_hwnd, UM_INSTALL_UPDATE, 0, 0); - Sleep(3000); - while(true) { - if ((app_hwnd = FindWindow(WINDOW_CLASS_NAME, NULL)) != nullptr) { - wstring msg(_TR(MSG_ERR_CLOSE_APP)); - NS_Utils::Replace(msg, L"%1", _T(WINDOW_NAME)); - int result = NS_Utils::ShowTaskDialog(parent, msg.c_str(), TD_WARNING_ICON); - if (result != IDOK) { - accept = false; - break; - } - } else { - break; - } - } - } - } - return accept; - } - - void InstalledVerInfo(LPCWSTR value, wstring &name, wstring &arch) - { - if (!name.empty()) - name.clear(); - std::vector flags{0}; - if (NS_Utils::IsWin64()) { -#ifdef _WIN64 - flags.push_back(KEY_WOW64_32KEY); -#else - flags.push_back(KEY_WOW64_64KEY); -#endif - } - for (auto &flag : flags) { - wstring subkey(L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\"); - subkey += _T(REG_UNINST_KEY); - for (int i = 0; i < 2; i++) { - RegQueryStringValue(HKEY_LOCAL_MACHINE, subkey.c_str(), flag, value, name); - if (!name.empty()) { - if (arch.empty()) { -#ifdef _WIN64 - arch = (flag == 0) ? L"x64" : L"x86"; -#else - arch = (flag == 0) ? L"x86" : L"x64"; -#endif - } - return; - } - subkey += L"_is1"; - } - } - } - - void Replace(wstring &str, const wstring &from, const wstring &to) { - if (from.empty()) - return; - size_t start_pos = 0; - while((start_pos = str.find(from, start_pos)) != std::wstring::npos) { - str.replace(start_pos, from.length(), to); - start_pos += to.length(); - } - } - - wstring MsiGetProperty(LPCWSTR prodCode, LPCWSTR propName) - { - DWORD buffSize = 0; - UINT res = MsiGetProductInfoW(prodCode, propName, NULL, &buffSize); - if ((res == ERROR_MORE_DATA || res == ERROR_SUCCESS) && buffSize > 0) { - ++buffSize; - wchar_t *value = new wchar_t[buffSize]; - if (MsiGetProductInfoW(prodCode, propName, value, &buffSize) == ERROR_SUCCESS) { - wstring propValue = value; - delete[] value; - return propValue; - } - delete[] value; - } - return wstring(); - } - - wstring MsiProductCode(const wstring &prodName) - { - DWORD ind = 0; - WCHAR prodCode[39]; - while (MsiEnumProductsEx(NULL, NULL, MSIINSTALLCONTEXT_MACHINE, ind++, prodCode, NULL, NULL, NULL) == ERROR_SUCCESS) { - if (MsiGetProperty(prodCode, INSTALLPROPERTY_PRODUCTNAME) == prodName) - return prodCode; - } - return wstring(); - } -} - -namespace NS_File -{ - DWORD runProcess(const wstring &fileName, const wstring &args, bool runAsAdmin, bool wait) - { - SHELLEXECUTEINFO shExInfo = {0}; - shExInfo.cbSize = sizeof(shExInfo); - shExInfo.fMask = SEE_MASK_NOCLOSEPROCESS | SEE_MASK_NO_CONSOLE /*| SEE_MASK_FLAG_NO_UI*/; - shExInfo.hwnd = NULL; - shExInfo.lpVerb = runAsAdmin ? _T("runas") : _T("open"); - shExInfo.lpFile = fileName.c_str(); - shExInfo.lpParameters = args.c_str(); - shExInfo.lpDirectory = NULL; - shExInfo.nShow = SW_HIDE; - shExInfo.hInstApp = NULL; - if (ShellExecuteEx(&shExInfo)) { - DWORD exitCode = 0; - if (wait && (WaitForSingleObject(shExInfo.hProcess, INFINITE) == WAIT_FAILED || !GetExitCodeProcess(shExInfo.hProcess, &exitCode))) - exitCode = GetLastError(); - CloseHandle(shExInfo.hProcess); - return exitCode; - } - return GetLastError() | ERROR_LAUNCH; - } - -// bool isProcessRunning(const wstring &fileName) -// { -// HANDLE snapShot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); -// if (snapShot == INVALID_HANDLE_VALUE) -// return false; - -// PROCESSENTRY32 entry; -// entry.dwSize = sizeof(PROCESSENTRY32); -// if (!Process32First(snapShot, &entry)) { -// CloseHandle(snapShot); -// return false; -// } - -// do { -// if (lstrcmpi(entry.szExeFile, fileName.c_str()) == 0) { -// CloseHandle(snapShot); -// return true; -// } -// } while (Process32Next(snapShot, &entry)); - -// CloseHandle(snapShot); -// return false; -// } - - bool readFile(const wstring &filePath, list &linesList) - { - std::wifstream file(filePath.c_str(), std::ios_base::in); - if (!file.is_open()) { - NS_Logger::WriteLog(L"An error occurred while opening:\n" + filePath); - return false; - } - wstring line; - while (std::getline(file, line)) - linesList.push_back(line); - - file.close(); - return true; - } - - bool fileExists(const wstring &filePath) - { - DWORD attr = ::GetFileAttributes(filePath.c_str()); - return (attr != INVALID_FILE_ATTRIBUTES && !(attr & FILE_ATTRIBUTE_DIRECTORY)); - } - - bool removeFile(const wstring &filePath) - { - return DeleteFile(filePath.c_str()) != 0; - } - - bool removeDirRecursively(const wstring &dir) - { - WCHAR pFrom[_MAX_PATH + 1] = {0}; - swprintf_s(pFrom, sizeof(pFrom)/sizeof(WCHAR), L"%s%c", dir.c_str(), L'\0'); - SHFILEOPSTRUCT fop = { - NULL, - FO_DELETE, - pFrom, - NULL, - FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_SILENT, - FALSE, - 0, - NULL - }; - return SHFileOperation(&fop) == 0; - } - - wstring fromNativeSeparators(const wstring &path) - { - wstring _path(path); - std::replace(_path.begin(), _path.end(), L'\\', L'/'); - return _path; - } - - wstring toNativeSeparators(const wstring &path) - { - wstring _path(path); - std::replace(_path.begin(), _path.end(), L'/', L'\\'); - return _path; - } - - wstring parentPath(const wstring &path) - { - auto delim = (path.size() > 2) ? path.find_last_of(_T("\\/"), path.size() - 2) : wstring::npos; - return (delim == wstring::npos) ? _T("") : path.substr(0, delim); - } - - wstring tempPath() - { - TCHAR buff[MAX_PATH + 1] = {0}; - DWORD res = ::GetTempPath(MAX_PATH + 1, buff); - if (res != 0) { - buff[res - 1] = '\0'; - return fromNativeSeparators(buff); - } - return _T(""); - } - - wstring appPath() - { - TCHAR buff[MAX_PATH] = {0}; - DWORD res = ::GetModuleFileName(NULL, buff, MAX_PATH); - return (res != 0) ? fromNativeSeparators(parentPath(buff)) : _T(""); - } - - wstring generateTmpFileName(const wstring &ext) - { - wstring uuid_tstr; - UUID uuid = {0}; - RPC_WSTR wszUuid = NULL; - if (UuidCreate(&uuid) == RPC_S_OK && UuidToStringW(&uuid, &wszUuid) == RPC_S_OK) { - uuid_tstr = ((wchar_t*)wszUuid); - RpcStringFreeW(&wszUuid); - } else - uuid_tstr = L"00000000-0000-0000-0000-000000000000"; - return NS_File::tempPath() + _T("/") + _T(FILE_PREFIX) + uuid_tstr + ext; - } - - bool verifyEmbeddedSignature(const wstring &fileName) - { - WINTRUST_FILE_INFO wfi; - ZeroMemory(&wfi, sizeof(wfi)); - wfi.cbStruct = sizeof(WINTRUST_FILE_INFO); - wfi.pcwszFilePath = fileName.c_str(); - wfi.hFile = NULL; - wfi.pgKnownSubject = NULL; - - GUID guidAction = WINTRUST_ACTION_GENERIC_VERIFY_V2; - WINTRUST_DATA wtd; - ZeroMemory(&wtd, sizeof(wtd)); - wtd.cbStruct = sizeof(WINTRUST_DATA); - wtd.pPolicyCallbackData = NULL; - wtd.pSIPClientData = NULL; - wtd.dwUIChoice = WTD_UI_NONE; - wtd.fdwRevocationChecks = WTD_REVOKE_NONE; - wtd.dwUnionChoice = WTD_CHOICE_FILE; - wtd.dwStateAction = WTD_STATEACTION_VERIFY; - wtd.hWVTStateData = NULL; - wtd.pwszURLReference = NULL; - wtd.dwUIContext = 0; - wtd.pFile = &wfi; - return WinVerifyTrust(NULL, &guidAction, &wtd) == ERROR_SUCCESS; - } - - wstring appDataPath() - { - TCHAR buff[MAX_PATH] = {0}; - if (SUCCEEDED(SHGetFolderPathW(NULL, CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, buff))) { - wstring path(buff); - path.append(_T(APP_REG_PATH)); - path.append(_T("\\data")); - return path; - } - return _T(""); - } -} - -namespace NS_Logger -{ - bool allow_write_log = false; - - void AllowWriteLog() - { - allow_write_log = true; - } - - void WriteLog(const wstring &log, bool showMessage) - { - if (allow_write_log) { - wstring filpPath(NS_File::appPath() + _T("/installer_log.txt")); - std::wofstream file(filpPath.c_str(), std::ios::app); - if (!file.is_open()) { - return; - } - file << log << std::endl; - file.close(); - } - if (showMessage) - NS_Utils::ShowMessage(log); - } -} diff --git a/win-linux/extras/online-installer/src/utils.h b/win-linux/extras/online-installer/src/utils.h deleted file mode 100644 index 672250a86..000000000 --- a/win-linux/extras/online-installer/src/utils.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * -*/ - -#ifndef UTILS_H -#define UTILS_H - -#include -#include -#include - -using std::string; -using std::wstring; -using std::to_wstring; -using std::list; - -#define ERROR_LAUNCH 0x20000000 -#define DEFAULT_ERROR_MESSAGE _T("An error occurred:\n") + \ - wstring(_T(__FUNCTION__)) + _T(" Line: ") + to_wstring(__LINE__) -#define ADVANCED_ERROR_MESSAGE DEFAULT_ERROR_MESSAGE + \ - _T(" ") + NS_Utils::GetLastErrorAsString() - - -namespace NS_Utils -{ -void parseCmdArgs(int argc, wchar_t *argv[]); -bool cmdArgContains(const wstring ¶m); -wstring cmdArgValue(const wstring ¶m); -wstring GetLastErrorAsString(DWORD errID = 0); -void ShowMessage(wstring str, bool showError = false); -int ShowTaskDialog(HWND parent, const wstring &msg, PCWSTR icon); -bool IsRtlLanguage(unsigned long lcid); -bool IsWin64(); -bool IsAppInstalled(wstring &path, wstring *arch = nullptr); -bool checkAndWaitForAppClosure(HWND parent = nullptr); -void InstalledVerInfo(LPCWSTR value, wstring &name, wstring &arch); -void Replace(wstring &str, const wstring &from, const wstring &to); -wstring MsiGetProperty(LPCWSTR prodCode, LPCWSTR propName); -wstring MsiProductCode(const wstring &prodName); -} - -namespace NS_File -{ -DWORD runProcess(const wstring &fileName, const wstring &args, bool runAsAdmin = false, bool wait = true); -// bool isProcessRunning(const wstring &fileName); -bool readFile(const wstring &filePath, list &linesList); -bool fileExists(const wstring &filePath); -bool removeFile(const wstring &filePath); -bool removeDirRecursively(const wstring &dir); -wstring fromNativeSeparators(const wstring &path); -wstring toNativeSeparators(const wstring &path); -wstring parentPath(const wstring &path); -wstring tempPath(); -wstring appPath(); -wstring appDataPath(); -wstring generateTmpFileName(const wstring &ext); -bool verifyEmbeddedSignature(const wstring &fileName); -} - -namespace NS_Logger -{ -void AllowWriteLog(); -void WriteLog(const wstring &log, bool showMessage = false); -} - -#endif // UTILS_H diff --git a/win-linux/extras/online-installer/src/version.h b/win-linux/extras/online-installer/src/version.h deleted file mode 100644 index 045d4413f..000000000 --- a/win-linux/extras/online-installer/src/version.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * -*/ - -#ifndef VERSION_H -#define VERSION_H - -#define VER_STRINGIFY(d) #d -#define TO_STR(v) VER_STRINGIFY(v) - -#ifdef VER_PRODUCT_VERSION -# define VER_FILEVERSION VER_PRODUCT_VERSION_COMMAS -# define VER_FILEVERSION_STR TO_STR(VER_PRODUCT_VERSION) - -# define VER_PRODUCTVERSION VER_FILEVERSION -# define VER_PRODUCTVERSION_STR TO_STR(VER_PRODUCT_VERSION) -#else -# define VER_STR_LONG(mj,mn,b,r) VER_STRINGIFY(mj) "." VER_STRINGIFY(mn) "." VER_STRINGIFY(b) "." VER_STRINGIFY(r) "\0" -# define VER_STR_SHORT(mj,mn) VER_STRINGIFY(mj) "." VER_STRINGIFY(mn) "\0" - -# define VER_NUM_MAJOR 5 -# define VER_NUM_MINOR 2 -# define VER_NUM_BUILD 46 -# define VER_NUM_REVISION 24 -# define VER_NUMBER VER_NUM_MAJOR,VER_NUM_MINOR,VER_NUM_BUILD,VER_NUM_REVISION -# define VER_STRING VER_STR_LONG(VER_NUM_MAJOR,VER_NUM_MINOR,VER_NUM_BUILD,VER_NUM_REVISION) -# define VER_STRING_SHORT VER_STR_SHORT(VER_NUM_MAJOR,VER_NUM_MINOR) - -# define VER_FILEVERSION VER_NUMBER -# define VER_FILEVERSION_STR VER_STRING - -# define VER_PRODUCTVERSION VER_FILEVERSION -# define VER_PRODUCTVERSION_STR VER_STRING_SHORT -#endif - -#define VER_LANG_AND_CHARSET_STR "040904E4" -#define VER_LANG_ID 0x0409 -#define VER_CHARSET_ID 1252 - -#define VER_FILEDESCRIPTION_STR "ONLYOFFICE Online Installer\0" -#define VER_PRODUCTNAME_STR "ONLYOFFICE Online Installer\0" -#define VER_COMPANYNAME_STR "Ascensio System SIA\0" -#define VER_LEGALCOPYRIGHT_STR "Copyright (C) Ascensio System SIA " TO_STR(COPYRIGHT_YEAR) ". All rights reserved\0" -#define VER_COMPANYDOMAIN_STR "www.onlyoffice.com\0" - -#define VER_INTERNALNAME_STR "AppIcons\0" -#define VER_LEGALTRADEMARKS1_STR "All rights reserved\0" -#define VER_LEGALTRADEMARKS2_STR VER_LEGALTRADEMARKS1_STR -#define VER_ORIGINALFILENAME_STR "online-installer.exe\0" - -#ifdef APP_USE_PRIVATE_ASSETS -# include "src/version_p.h" -#endif - -#endif - diff --git a/win-linux/package/windows/make.ps1 b/win-linux/package/windows/make.ps1 index c25a32d63..45567b699 100644 --- a/win-linux/package/windows/make.ps1 +++ b/win-linux/package/windows/make.ps1 @@ -123,10 +123,3 @@ if (Test-Path "$BuildDir\desktop\vlc-cache-gen.exe") { Write-Host "DELETE: $BuildDir\desktop\vlc-cache-gen.exe" Remove-Item -Force -LiteralPath "$BuildDir\desktop\vlc-cache-gen.exe" } - -if (Test-Path "$BuildDir\desktop\online-installer.exe") { - Write-Host "MOVE: $BuildDir\desktop\online-installer.exe > OnlineInstaller-$Version-$Arch.exe" - Move-Item ` - -Path "$BuildDir\desktop\online-installer.exe" ` - -Destination "OnlineInstaller-$Version-$Arch.exe" -}