From 8bd4d8a15fce9ce0ca3954ee26200264618936e7 Mon Sep 17 00:00:00 2001 From: Hjalti Kolbeinsson Date: Tue, 17 Nov 2020 14:05:40 +0000 Subject: [PATCH 1/8] Rewrite of the build scripts --- build.bat | 16 ------ build.ps1 | 116 +++++++++++++++++++++++++++++++++++++++++++ build_helper.bat | 19 +++++++ clean.bat | 20 -------- clean.ps1 | 90 +++++++++++++++++++++++++++++++++ create_framework.bat | 13 ----- 6 files changed, 225 insertions(+), 49 deletions(-) delete mode 100644 build.bat create mode 100644 build.ps1 create mode 100644 build_helper.bat delete mode 100644 clean.bat create mode 100644 clean.ps1 delete mode 100644 create_framework.bat diff --git a/build.bat b/build.bat deleted file mode 100644 index 23be6d1d0..000000000 --- a/build.bat +++ /dev/null @@ -1,16 +0,0 @@ -@ECHO ON - -SET CLEAN=%1 - -if "%TOOLS_PREFIX%"=="" ( - SET TOOLS_PREFIX=C: -) - -SET JOM=%TOOLS_PREFIX%\jom\jom.exe -SET QMAKE=%TOOLS_PREFIX%\Qt_static\v5.12.7\bin\qmake.exe -SET WIN_SDK=10.0.17763.0 - -if "%CLEAN%"=="" call clean.bat 1 -call "C:\%BUILDTOOLS_PREFIX%\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" x86 %WIN_SDK% -call create_framework.bat -if "%CLEAN%"=="" call clean.bat 0 \ No newline at end of file diff --git a/build.ps1 b/build.ps1 new file mode 100644 index 000000000..726139d6a --- /dev/null +++ b/build.ps1 @@ -0,0 +1,116 @@ +param +( + [switch]$DeepClean, + [String]$ToolsPrefix = "C:", + [String]$WinSdk = "10.0.17763.0", + [String]$BuildToolsPrefix = "", + [switch]$Verbose, + [switch]$SkipCleaning, + [switch]$SkipPreClean, + [switch]$SkipPostClean +) + +$DeepCleanSwitch = "" +if ($DeepClean) { $DeepCleanSwitch = "-DeepClean" } +$VerboseSwitch = "" +if ($Verbose) { $VerboseSwitch = "-Verbose" } + +$jom = "$ToolsPrefix\jom\jom.exe" +$qmake = "$ToolsPrefix\Qt_static\v5.12.7\bin\qmake.exe" +$varsall = "C:\$BuildToolsPrefix\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" + +Write-Output "Start building installer framework" +Write-Output "---" + +if (!(Test-Path $jom)) { + Write-Output "Jom was not found at '$jom'! Exiting..." + Return +} else { + if ($Verbose) { Write-Output "Jom was found at '$jom'." } +} +if (!(Test-Path $qmake)) { + Write-Output "Qmake was not found at '$qmake'! Exiting..." +} else { + if ($Verbose) { Write-Output "Qmake was found at '$qmake'." } +} +if (!(Test-Path $varsall)) { + Write-Output "vcvarsall not found at '$varsall'! Exiting..." +} else { + if ($Verbose) { Write-Output "vcvarsall was found at '$varsall'." } +} + +$buildDir = "$PSScriptRoot\build" + +if ($SkipCleaning -Or $SkipPreClean) { + if ($Verbose) { Write-Output "Skipping pre cleaning" } + if (Test-Path $buildDir) { + Remove-Item $buildDir -Force -Recurse + if ($Verbose) { Write-Output "Build dir removed" } + } +} else { + Invoke-Expression -Command "$PSScriptRoot\clean.ps1 $DeepCleanSwitch $VerboseSwitch" +} + +# Create the build folder +if ($Verbose) { + New-Item -Path $buildDir -ItemType "directory" + Write-Output "Build dir created" +} else { + $null = New-Item -Path $buildDir -ItemType "directory" +} + +# # Invokes a Cmd.exe shell script and updates the environment. +# function Invoke-CmdScript { +# param( +# [String] $ScriptName +# ) +# $cmdLine = """$ScriptName"" $args & set" +# & $Env:SystemRoot\system32\cmd.exe /c $cmdLine | +# Select-String '^([^=]*)=(.*)$' | Foreach-Object { +# $varName = $_.Matches[0].Groups[1].Value +# $varValue = $_.Matches[0].Groups[2].Value +# Set-Item Env:$varName $varValue +# } +# } + +# $location = Get-Location + +# We need to run this from this folder +# Set-Location $PSScriptRoot + +# # Store the environment vars from vcvarsall.bat +# Invoke-CmdScript "$varsall" "x86" "$WinSdk" + +# # Create the makefiles +# & "$qmake" "-r" + +# # Build the makefiels +# & "$jom" "release" + +# $params = """$varsall"" $WinSdk ""$qmake"" ""$jom""" +# Write-Output $params +$buildHelper = """$PSScriptRoot\build_helper.bat"" ""$varsall"" $WinSdk ""$qmake"" ""$jom""" + +if ($Verbose) { + Write-Output "Start creating the framework: " $buildHelper + cmd.exe /c $buildHelper + Write-Output "Framework created" +} else { + $null = cmd.exe /c $buildHelper +} +# Set-Location $location + +# Copy the output to the build folder +Copy-Item "$PSScriptRoot\bin\binarycreator.exe" $buildDir +Copy-Item "$PSScriptRoot\bin\installerbase.exe" $buildDir + +if ($Verbose) { Write-Output "Framework output to build" } + +if ($SkipCleaning -Or $SkipPostClean) { + if ($Verbose) { Write-Output "Skipping post cleaning" } +} else { + Invoke-Expression -Command "$PSScriptRoot\clean.ps1 $DeepCleanSwitch $VerboseSwitch -SkipBuildDir" +} + +Write-Output "---" +Write-Output "Framework built successfully. You'll find it under \build" diff --git a/build_helper.bat b/build_helper.bat new file mode 100644 index 000000000..25b1096da --- /dev/null +++ b/build_helper.bat @@ -0,0 +1,19 @@ +SETLOCAL + +CD /d %~dp0 + +SET VARSALL=%1 +SET WINSDK=%2 +SET QMAKE=%3 +SET JOM=%4 + +rem Set up the required cmd environment +call %VARSALL% x86 %WINSDK% + +rem Create the makefiles +%QMAKE% -r + +rem Build the makefiles +%JOM% release + +ENDLOCAL \ No newline at end of file diff --git a/clean.bat b/clean.bat deleted file mode 100644 index 9f48acc22..000000000 --- a/clean.bat +++ /dev/null @@ -1,20 +0,0 @@ -@ECHO ON - -SET REMOVE_BUILD_DIR=%1 - -IF %REMOVE_BUILD_DIR% NEQ 0 ( - IF EXIST build RMDIR /Q /S build -) - -IF EXIST bin RMDIR /Q /S bin -IF EXIST .qmake.stash DEL .qmake.stash -IF EXIST src\libs\7zip\mocinclude.opt DEL src\libs\7zip\mocinclude.opt -IF EXIST src\libs\installer\mocinclude.opt DEL src\libs\installer\mocinclude.opt -IF EXIST src\sdk\installerbase.qrc DEL src\sdk\installerbase.qrc -IF EXIST src\sdk\mocinclude.opt DEL src\sdk\mocinclude.opt -IF EXIST src\sdk\translations\ifw_en.ts DEL src\sdk\translations\ifw_en.ts -IF EXIST tools\archivegen\mocinclude.opt DEL tools\archivegen\mocinclude.opt -IF EXIST tools\binarycreator\mocinclude.opt DEL tools\binarycreator\mocinclude.opt -IF EXIST tools\devtool\mocinclude.opt DEL tools\devtool\mocinclude.opt -IF EXIST tools\repocompare\mocinclude.opt DEL tools\repocompare\mocinclude.opt -IF EXIST tools\repogen\mocinclude.opt DEL tools\repogen\mocinclude.opt diff --git a/clean.ps1 b/clean.ps1 new file mode 100644 index 000000000..882b15719 --- /dev/null +++ b/clean.ps1 @@ -0,0 +1,90 @@ +param +( + [switch]$SkipBuildDir, + [switch]$DeepClean, + [switch]$Verbose +) + +function RemoveDir ($dir) { + if (Test-Path "$PSScriptRoot\$dir") { + Remove-Item "$PSScriptRoot\$dir" -Force -Recurse + if ($Verbose) { Write-Output " -> d: $dir" } + } +} + +function RemoveFile ($file) { + if (Test-Path "$PSScriptRoot\$file") { + Remove-Item "$PSScriptRoot\$file" -Force + if ($Verbose) { Write-Output " -> f: $file" } + } +} + +if ($Verbose) { Write-Output "Cleanup starting" } +if ($Verbose) { Write-Output "Removing the following (f)iles and (d)irectories:" } + +if (!$SkipBuildDir) { RemoveDir "build" } + +RemoveDir "bin" + +$baseFiles = ".qmake.stash", + "src\libs\7zip\mocinclude.opt", + "src\libs\installer\mocinclude.opt", + "src\sdk\installerbase.qrc", + "src\sdk\mocinclude.opt", + "src\sdk\translations\ifw_en.ts", + "tools\archivegen\mocinclude.opt", + "tools\binarycreator\mocinclude.opt", + "tools\devtool\mocinclude.opt", + "tools\repocompare\mocinclude.opt", + "tools\repogen\mocinclude.opt" + +foreach ($file in $baseFiles) { + RemoveFile $file +} + +if ($DeepClean) { + if ($Verbose) { + Write-Output "---" + Write-Output "Removing additional (f)iles and (d)irectories since -DeepClean was provided:" + } + + $sources = "libs\7zip", "libs\installer", "sdk", "sdk\translations" + $tools = "archivegen", "binarycreator", "devtool", "repocompare", "repogen" + $alldirs = @{ "src" = $sources; "tools" = $tools } + + foreach ($pair in $alldirs.GetEnumerator()) { + RemoveFile "$($pair.Name)\Makefile" + foreach ($subDir in ($pair.Value)) { + # Dirs + RemoveDir "$($pair.Name)\$subDir\debug" + RemoveDir "$($pair.Name)\$subDir\release" + + # Files + RemoveFile "$($pair.Name)\$subDir\Makefile" + RemoveFile "$($pair.Name)\$subDir\Makefile.Debug" + RemoveFile "$($pair.Name)\$subDir\Makefile.Release" + + if (($pair.Name) -eq "tools") { + RemoveFile "$($pair.Name)\$tool\${tool}_plugin_import.cpp" + } + } + } + + RemoveDir "lib" + + $additionalFiles = "src\libs\Makefile", + "Makefile", + "src\libs\installer\ui_authenticationdialog.h", + "src\libs\installer\ui_proxycredentialsdialog.h", + "src\libs\installer\ui_serverauthenticationdialog.h", + "src\sdk\installerbase_plugin_import.cpp", + "src\sdk\ui_settingsdialog.h", + "tools\repocompare\ui_mainwindow.h" + + foreach ($file in $additionalFiles) { + RemoveFile $file + } +} + +if ($Verbose) { Write-Output "---" } +if ($Verbose) { Write-Output "Cleanup completed" } diff --git a/create_framework.bat b/create_framework.bat deleted file mode 100644 index f7b3ea95e..000000000 --- a/create_framework.bat +++ /dev/null @@ -1,13 +0,0 @@ -@ECHO ON - -MKDIR build - -REM Create the makefiles -CALL %QMAKE% -r - -REM Build the makefiles -CALL %JOM% release - -REM Copy the output to the build folder -COPY bin\binarycreator.exe build\binarycreator.exe -COPY bin\installerbase.exe build\installerbase.exe From 5eae248ab4dbc262a270cb391a9209788efb194f Mon Sep 17 00:00:00 2001 From: Hjalti Kolbeinsson Date: Tue, 17 Nov 2020 14:38:57 +0000 Subject: [PATCH 2/8] Cleanup --- build.ps1 | 33 +-------------------------------- 1 file changed, 1 insertion(+), 32 deletions(-) diff --git a/build.ps1 b/build.ps1 index 726139d6a..08a668b50 100644 --- a/build.ps1 +++ b/build.ps1 @@ -59,38 +59,8 @@ if ($Verbose) { $null = New-Item -Path $buildDir -ItemType "directory" } -# # Invokes a Cmd.exe shell script and updates the environment. -# function Invoke-CmdScript { -# param( -# [String] $ScriptName -# ) -# $cmdLine = """$ScriptName"" $args & set" -# & $Env:SystemRoot\system32\cmd.exe /c $cmdLine | -# Select-String '^([^=]*)=(.*)$' | Foreach-Object { -# $varName = $_.Matches[0].Groups[1].Value -# $varValue = $_.Matches[0].Groups[2].Value -# Set-Item Env:$varName $varValue -# } -# } - -# $location = Get-Location - -# We need to run this from this folder -# Set-Location $PSScriptRoot - -# # Store the environment vars from vcvarsall.bat -# Invoke-CmdScript "$varsall" "x86" "$WinSdk" - -# # Create the makefiles -# & "$qmake" "-r" - -# # Build the makefiels -# & "$jom" "release" - -# $params = """$varsall"" $WinSdk ""$qmake"" ""$jom""" -# Write-Output $params +# Build the framework (this is done via bat because of vcvarsall) $buildHelper = """$PSScriptRoot\build_helper.bat"" ""$varsall"" $WinSdk ""$qmake"" ""$jom""" - if ($Verbose) { Write-Output "Start creating the framework: " $buildHelper cmd.exe /c $buildHelper @@ -98,7 +68,6 @@ if ($Verbose) { } else { $null = cmd.exe /c $buildHelper } -# Set-Location $location # Copy the output to the build folder Copy-Item "$PSScriptRoot\bin\binarycreator.exe" $buildDir From f3d13e5bf2ff0f69357b86f05cca74ad893f4e96 Mon Sep 17 00:00:00 2001 From: Hjalti Kolbeinsson Date: Tue, 24 Nov 2020 15:32:59 +0000 Subject: [PATCH 3/8] EO-11039 - Updated translations --- src/sdk/translations/ifw_ca.ts | 34 +++++ src/sdk/translations/ifw_da.ts | 46 +++++++ src/sdk/translations/ifw_de.ts | 46 +++++++ src/sdk/translations/ifw_es.ts | 46 +++++++ src/sdk/translations/ifw_fr.ts | 46 +++++++ src/sdk/translations/ifw_hr.ts | 40 ++++++ src/sdk/translations/ifw_it.ts | 46 +++++++ src/sdk/translations/ifw_ja.ts | 46 +++++++ src/sdk/translations/ifw_pl.ts | 46 +++++++ src/sdk/translations/ifw_ru.ts | 40 ++++++ src/sdk/translations/ifw_zh_CN.ts | 210 ++++++++++++++++++++++++++++++ 11 files changed, 646 insertions(+) diff --git a/src/sdk/translations/ifw_ca.ts b/src/sdk/translations/ifw_ca.ts index 2b7ac4739..8ac5494cd 100644 --- a/src/sdk/translations/ifw_ca.ts +++ b/src/sdk/translations/ifw_ca.ts @@ -2507,4 +2507,38 @@ amb un usuari amb els permisos apropiats i després feu clic a D'acord. Ha fallat en canviar el nom del fitxer «%1» a «%2»: %3 + + + + + + + + + + + + diff --git a/src/sdk/translations/ifw_da.ts b/src/sdk/translations/ifw_da.ts index 17e5e4ac3..ef379803a 100644 --- a/src/sdk/translations/ifw_da.ts +++ b/src/sdk/translations/ifw_da.ts @@ -2463,4 +2463,50 @@ som en bruger med de fornødne rettigheder og klik så på OK. Omdøbning af filen "%1" til "%2" mislykkedes: %3 + + + + + QInstaller::PackageManagerCore + + Installation will use %1 of disk space. + Installationen vil bruge %1 diskplads. + + + + + + + + QInstaller::ExtractArchiveOperation + + Extracting "%1" + + + + + + diff --git a/src/sdk/translations/ifw_de.ts b/src/sdk/translations/ifw_de.ts index 18bf64159..0d63540ef 100644 --- a/src/sdk/translations/ifw_de.ts +++ b/src/sdk/translations/ifw_de.ts @@ -2473,4 +2473,50 @@ Brechen Sie entweder die Installation ab, oder verwenden Sie die Fallback-Lösun Verbleibende Datei "%1" wegen "%2": %3 + + + + + QInstaller::PackageManagerCore + + Installation will use %1 of disk space. + Die Installation wird %1 Festplattenplatz verwenden. + + + + + + + + QInstaller::ExtractArchiveOperation + + Extracting "%1" + + + + + + diff --git a/src/sdk/translations/ifw_es.ts b/src/sdk/translations/ifw_es.ts index 760adaf98..438239a15 100644 --- a/src/sdk/translations/ifw_es.ts +++ b/src/sdk/translations/ifw_es.ts @@ -2444,4 +2444,50 @@ como usuario con los derechos adecuados y, luego, haga clic en Aceptar.Error al cambiar el nombre de archivo de "%1" a "%2": %3 + + + + + QInstaller::PackageManagerCore + + Installation will use %1 of disk space. + La instalación usará %1 de espacio de disco. + + + + + + + + QInstaller::ExtractArchiveOperation + + Extracting "%1" + + + + + + diff --git a/src/sdk/translations/ifw_fr.ts b/src/sdk/translations/ifw_fr.ts index 504d0f37e..2bb6b1d51 100644 --- a/src/sdk/translations/ifw_fr.ts +++ b/src/sdk/translations/ifw_fr.ts @@ -2444,4 +2444,50 @@ en tant qu’utilisateur doté des droits appropriés, puis cliquez sur OK.Le changement de nom du fichier "%1" en "%2" a échoué : %3 + + + + + QInstaller::PackageManagerCore + + Installation will use %1 of disk space. + L’installation va utiliser %1 de l’espace disque. + + + + + + + + QInstaller::ExtractArchiveOperation + + Extracting "%1" + + + + + + diff --git a/src/sdk/translations/ifw_hr.ts b/src/sdk/translations/ifw_hr.ts index fcef08d0e..efeb19669 100644 --- a/src/sdk/translations/ifw_hr.ts +++ b/src/sdk/translations/ifw_hr.ts @@ -2465,4 +2465,44 @@ u modusu korisnika s odgovarajućim pravima. Zatim klikni "U redu".Već je pokrenuta jedna instanca za %1. Pričekaj da završi, zatvori je ili ponovo pokreni sustav. + + + + + QInstaller::PackageManagerCore + + Installation will use %1 of disk space. + Instalacija će zauzeti otprilike %1 na tvom tvrdom disku. + + + + + + + + + + diff --git a/src/sdk/translations/ifw_it.ts b/src/sdk/translations/ifw_it.ts index 5be3c8218..d8ebe9336 100644 --- a/src/sdk/translations/ifw_it.ts +++ b/src/sdk/translations/ifw_it.ts @@ -2444,4 +2444,50 @@ come utente con i diritti appropriati, quindi fare clic su OK. Impossibile rinominare il file "%1" "%2": %3 + + + + + QInstaller::PackageManagerCore + + Installation will use %1 of disk space. + L'installazione utilizzerà %1 di spazio su disco. + + + + + + + + QInstaller::ExtractArchiveOperation + + Extracting "%1" + + + + + + diff --git a/src/sdk/translations/ifw_ja.ts b/src/sdk/translations/ifw_ja.ts index 47d865520..23c74b708 100644 --- a/src/sdk/translations/ifw_ja.ts +++ b/src/sdk/translations/ifw_ja.ts @@ -2444,4 +2444,50 @@ as a user with the appropriate rights and then clicking OK. ファイル名を "%1" から "%2" に変更できませんでした: %3 + + + + + QInstaller::PackageManagerCore + + Installation will use %1 of disk space. + ディスク空き容量の %1 がインストールに使用されます。 + + + + + + + + QInstaller::ExtractArchiveOperation + + Extracting "%1" + + + + + + diff --git a/src/sdk/translations/ifw_pl.ts b/src/sdk/translations/ifw_pl.ts index b557bfdce..dad811370 100644 --- a/src/sdk/translations/ifw_pl.ts +++ b/src/sdk/translations/ifw_pl.ts @@ -2444,4 +2444,50 @@ jako użytkownik z odpowiednimi prawami, a następnie kliknij przycisk OK.Zmiana nazwy pliku "%1" na "%2" nie powiodła się: %3 + + + + + QInstaller::PackageManagerCore + + Installation will use %1 of disk space. + Instalacja zajmie %1 miejsca na dysku. + + + + + + + + QInstaller::ExtractArchiveOperation + + Extracting "%1" + + + + + + diff --git a/src/sdk/translations/ifw_ru.ts b/src/sdk/translations/ifw_ru.ts index 1227dbb8b..06dd14105 100644 --- a/src/sdk/translations/ifw_ru.ts +++ b/src/sdk/translations/ifw_ru.ts @@ -2496,4 +2496,44 @@ as a user with the appropriate rights and then clicking OK. Не удалось переименовать «%1» в «%2»: %3 + + + + + QInstaller::PackageManagerCore + + Installation will use %1 of disk space. + Для установки потребуется %1 дискового пространства. + + + + + + + + + + diff --git a/src/sdk/translations/ifw_zh_CN.ts b/src/sdk/translations/ifw_zh_CN.ts index 363a46fd2..511e33fd2 100644 --- a/src/sdk/translations/ifw_zh_CN.ts +++ b/src/sdk/translations/ifw_zh_CN.ts @@ -2444,4 +2444,214 @@ as a user with the appropriate rights and then clicking OK. 将文件“%1”重命名为“%2”失败:%3 + + + + + QInstaller::PackageManagerCore + + Installation will use %1 of disk space. + 安装程序将使用 %1 的磁盘空间。 + + + + + + + + QInstaller::ExtractArchiveOperation + + Extracting "%1" + 正在解压缩 “%1” + + + + + + + + + + + QPlatformTheme + + &Yes + &是 + + + &No + &否 + + + OK + 确定 + + + Cancel + 取消 + + + + + + + + + + + From 4aaebd32a9955aaee04139c347e27db9329a8163 Mon Sep 17 00:00:00 2001 From: Hjalti Kolbeinsson Date: Tue, 24 Nov 2020 15:50:52 +0000 Subject: [PATCH 4/8] EO-11039 - ChinaInstaller main config option added --- src/libs/installer/component.cpp | 7 ++- src/libs/installer/constants.h | 1 + src/libs/installer/settings.cpp | 7 ++- src/libs/installer/settings.h | 1 + src/sdk/installerbase.cpp | 80 ++++++++++++++++++++------------ 5 files changed, 65 insertions(+), 31 deletions(-) diff --git a/src/libs/installer/component.cpp b/src/libs/installer/component.cpp index 5fc321df3..2dffd8dae 100644 --- a/src/libs/installer/component.cpp +++ b/src/libs/installer/component.cpp @@ -587,10 +587,15 @@ void Component::loadTranslations(const QDir &directory, const QStringList &qms) QDirIterator it(directory.path(), qms, QDir::Files); const QStringList translations = d->m_core->settings().translations(); const QString uiLanguage = QLocale().uiLanguages().value(0, QLatin1String("en")); + const bool isChinaInstaller = d->m_core->settings().isChinaInstaller(); + const QString chineese = QLatin1String("zh"); while (it.hasNext()) { const QString filename = it.next(); const QString basename = QFileInfo(filename).baseName(); - if (!uiLanguage.startsWith(QFileInfo(filename).baseName(), Qt::CaseInsensitive)) + if (isChinaInstaller && !chineese.startsWith(basename, Qt::CaseInsensitive)) + continue; // do not load the file if it does not match Chineese + + if (!isChinaInstaller && !uiLanguage.startsWith(basename, Qt::CaseInsensitive)) continue; // do not load the file if it does not match the UI language if (!translations.isEmpty()) { diff --git a/src/libs/installer/constants.h b/src/libs/installer/constants.h index 26c2a7dfe..be21c82e4 100644 --- a/src/libs/installer/constants.h +++ b/src/libs/installer/constants.h @@ -89,6 +89,7 @@ static const QLatin1String scUrlQueryString("UrlQueryString"); static const QLatin1String scProductUUID("ProductUUID"); static const QLatin1String scAllUsers("AllUsers"); static const QLatin1String scSupportsModify("SupportsModify"); +static const QLatin1String scChinaInstaller("ChinaInstaller"); static const QLatin1String scAllowUnstableComponents("AllowUnstableComponents"); static const QLatin1String scSaveDefaultRepositories("SaveDefaultRepositories"); static const QLatin1String scRepositoryCategoryDisplayName("RepositoryCategoryDisplayName"); diff --git a/src/libs/installer/settings.cpp b/src/libs/installer/settings.cpp index 3aa0baf18..50f984f4b 100644 --- a/src/libs/installer/settings.cpp +++ b/src/libs/installer/settings.cpp @@ -290,7 +290,7 @@ Settings Settings::fromFileAndPrefix(const QString &path, const QString &prefix, << scWizardStyle << scStyleSheet << scTitleColor << scWizardDefaultWidth << scWizardDefaultHeight << scRepositorySettingsPageVisible << scTargetConfigurationFile - << scRemoteRepositories << scTranslations << scUrlQueryString << QLatin1String(scControlScript) + << scRemoteRepositories << scTranslations << scChinaInstaller << scUrlQueryString << QLatin1String(scControlScript) << scCreateLocalRepository << scInstallActionColumnVisible << scSupportsModify << scAllowUnstableComponents << scSaveDefaultRepositories << scRepositoryCategories; @@ -838,6 +838,11 @@ QString Settings::controlScript() const return d->m_data.value(QLatin1String(scControlScript)).toString(); } +bool Settings::isChinaInstaller() const +{ + return d->m_data.value(scChinaInstaller, false).toBool(); +} + bool Settings::supportsModify() const { return d->m_data.value(scSupportsModify, true).toBool(); diff --git a/src/libs/installer/settings.h b/src/libs/installer/settings.h index fff2324f1..79b9bb0dc 100644 --- a/src/libs/installer/settings.h +++ b/src/libs/installer/settings.h @@ -160,6 +160,7 @@ class INSTALLER_EXPORT Settings QString controlScript() const; bool supportsModify() const; + bool isChinaInstaller() const; bool allowUnstableComponents() const; void setAllowUnstableComponents(bool allow); diff --git a/src/sdk/installerbase.cpp b/src/sdk/installerbase.cpp index 75fdaa92b..40a811432 100644 --- a/src/sdk/installerbase.cpp +++ b/src/sdk/installerbase.cpp @@ -276,37 +276,59 @@ int InstallerBase::run() // to easily provide corrected translations to Qt/IFW for their installers const QString newDirectory = QLatin1String(":/translations_new"); const QStringList translations = m_core->settings().translations(); - - if (translations.isEmpty()) { - foreach (const QLocale locale, QLocale().uiLanguages()) { - QScopedPointer qtTranslator(new QTranslator(QCoreApplication::instance())); - bool qtLoaded = qtTranslator->load(locale, QLatin1String("qt"), - QLatin1String("_"), newDirectory); - if (!qtLoaded) - qtLoaded = qtTranslator->load(locale, QLatin1String("qt"), - QLatin1String("_"), directory); - - if (qtLoaded || locale.language() == QLocale::English) { - if (qtLoaded) - QCoreApplication::instance()->installTranslator(qtTranslator.take()); - - QScopedPointer ifwTranslator(new QTranslator(QCoreApplication::instance())); - bool ifwLoaded = ifwTranslator->load(locale, QLatin1String("ifw"), QLatin1String("_"), newDirectory); - if (!ifwLoaded) - ifwLoaded = ifwTranslator->load(locale, QLatin1String("ifw"), QLatin1String("_"), directory); - if (ifwLoaded) - QCoreApplication::instance()->installTranslator(ifwTranslator.take()); - - // To stop loading other translations it's sufficient that - // qt was loaded successfully or we hit English as system language - break; - } + const bool isChinaInstaller = m_core->settings().isChinaInstaller(); + + if (isChinaInstaller) { + QLocale locale = QLocale::Chinese; + QScopedPointer qtTranslator(new QTranslator(QCoreApplication::instance())); + bool qtLoaded = qtTranslator->load(locale, QLatin1String("qt"), + QLatin1String("_"), newDirectory); + if (!qtLoaded) + qtLoaded = qtTranslator->load(locale, QLatin1String("qt"), + QLatin1String("_"), directory); + + if (qtLoaded) { + QCoreApplication::instance()->installTranslator(qtTranslator.take()); } + + QScopedPointer ifwTranslator(new QTranslator(QCoreApplication::instance())); + bool ifwLoaded = ifwTranslator->load(locale, QLatin1String("ifw"), QLatin1String("_"), newDirectory); + if (!ifwLoaded) + ifwLoaded = ifwTranslator->load(locale, QLatin1String("ifw"), QLatin1String("_"), directory); + if (ifwLoaded) + QCoreApplication::instance()->installTranslator(ifwTranslator.take()); } else { - foreach (const QString &translation, translations) { - QScopedPointer translator(new QTranslator(QCoreApplication::instance())); - if (translator->load(translation, QLatin1String(":/translations"))) - QCoreApplication::instance()->installTranslator(translator.take()); + if (translations.isEmpty()) { + foreach (const QLocale locale, QLocale().uiLanguages()) { + QScopedPointer qtTranslator(new QTranslator(QCoreApplication::instance())); + bool qtLoaded = qtTranslator->load(locale, QLatin1String("qt"), + QLatin1String("_"), newDirectory); + if (!qtLoaded) + qtLoaded = qtTranslator->load(locale, QLatin1String("qt"), + QLatin1String("_"), directory); + + if (qtLoaded || locale.language() == QLocale::English) { + if (qtLoaded) + QCoreApplication::instance()->installTranslator(qtTranslator.take()); + + QScopedPointer ifwTranslator(new QTranslator(QCoreApplication::instance())); + bool ifwLoaded = ifwTranslator->load(locale, QLatin1String("ifw"), QLatin1String("_"), newDirectory); + if (!ifwLoaded) + ifwLoaded = ifwTranslator->load(locale, QLatin1String("ifw"), QLatin1String("_"), directory); + if (ifwLoaded) + QCoreApplication::instance()->installTranslator(ifwTranslator.take()); + + // To stop loading other translations it's sufficient that + // qt was loaded successfully or we hit English as system language + break; + } + } + } else { + foreach (const QString &translation, translations) { + QScopedPointer translator(new QTranslator(QCoreApplication::instance())); + if (translator->load(translation, QLatin1String(":/translations"))) + QCoreApplication::instance()->installTranslator(translator.take()); + } } } From b7cdbda17513f0fce53fda31cda7dc784986f2ee Mon Sep 17 00:00:00 2001 From: Hjalti Kolbeinsson Date: Tue, 24 Nov 2020 16:30:28 +0000 Subject: [PATCH 5/8] EO-11039 Clean up translation files --- build.ps1 | 26 ++++++++++++++++---------- clean.ps1 | 27 +++++++++++++++++---------- 2 files changed, 33 insertions(+), 20 deletions(-) diff --git a/build.ps1 b/build.ps1 index 08a668b50..4535448ca 100644 --- a/build.ps1 +++ b/build.ps1 @@ -10,6 +10,10 @@ param [switch]$SkipPostClean ) +if ($Verbose) { + $DebugPreference = 'Continue' +} + $DeepCleanSwitch = "" if ($DeepClean) { $DeepCleanSwitch = "-DeepClean" } $VerboseSwitch = "" @@ -26,26 +30,26 @@ if (!(Test-Path $jom)) { Write-Output "Jom was not found at '$jom'! Exiting..." Return } else { - if ($Verbose) { Write-Output "Jom was found at '$jom'." } + Write-Debug "Jom was found at '$jom'." } if (!(Test-Path $qmake)) { Write-Output "Qmake was not found at '$qmake'! Exiting..." } else { - if ($Verbose) { Write-Output "Qmake was found at '$qmake'." } + Write-Debug "Qmake was found at '$qmake'." } if (!(Test-Path $varsall)) { Write-Output "vcvarsall not found at '$varsall'! Exiting..." } else { - if ($Verbose) { Write-Output "vcvarsall was found at '$varsall'." } + Write-Debug "vcvarsall was found at '$varsall'." } $buildDir = "$PSScriptRoot\build" if ($SkipCleaning -Or $SkipPreClean) { - if ($Verbose) { Write-Output "Skipping pre cleaning" } + Write-Debug "Skipping pre cleaning" if (Test-Path $buildDir) { Remove-Item $buildDir -Force -Recurse - if ($Verbose) { Write-Output "Build dir removed" } + Write-Debug "Build dir removed" } } else { Invoke-Expression -Command "$PSScriptRoot\clean.ps1 $DeepCleanSwitch $VerboseSwitch" @@ -54,32 +58,34 @@ if ($SkipCleaning -Or $SkipPreClean) { # Create the build folder if ($Verbose) { New-Item -Path $buildDir -ItemType "directory" - Write-Output "Build dir created" } else { $null = New-Item -Path $buildDir -ItemType "directory" } +Write-Debug "Build dir created" # Build the framework (this is done via bat because of vcvarsall) $buildHelper = """$PSScriptRoot\build_helper.bat"" ""$varsall"" $WinSdk ""$qmake"" ""$jom""" +Write-Debug "Start creating the framework: $buildHelper" if ($Verbose) { - Write-Output "Start creating the framework: " $buildHelper cmd.exe /c $buildHelper - Write-Output "Framework created" } else { $null = cmd.exe /c $buildHelper } +Write-Debug "Framework created" # Copy the output to the build folder Copy-Item "$PSScriptRoot\bin\binarycreator.exe" $buildDir Copy-Item "$PSScriptRoot\bin\installerbase.exe" $buildDir -if ($Verbose) { Write-Output "Framework output to build" } +Write-Debug "Framework output to build" if ($SkipCleaning -Or $SkipPostClean) { - if ($Verbose) { Write-Output "Skipping post cleaning" } + Write-Debug "Skipping post cleaning" } else { Invoke-Expression -Command "$PSScriptRoot\clean.ps1 $DeepCleanSwitch $VerboseSwitch -SkipBuildDir" } Write-Output "---" Write-Output "Framework built successfully. You'll find it under \build" + +$DebugPreference = 'SilentlyContinue' \ No newline at end of file diff --git a/clean.ps1 b/clean.ps1 index 882b15719..7b20b1612 100644 --- a/clean.ps1 +++ b/clean.ps1 @@ -5,22 +5,26 @@ param [switch]$Verbose ) +if ($Verbose) { + $DebugPreference = 'Continue' +} + function RemoveDir ($dir) { if (Test-Path "$PSScriptRoot\$dir") { Remove-Item "$PSScriptRoot\$dir" -Force -Recurse - if ($Verbose) { Write-Output " -> d: $dir" } + Write-Debug " -> d: $dir" } } function RemoveFile ($file) { if (Test-Path "$PSScriptRoot\$file") { Remove-Item "$PSScriptRoot\$file" -Force - if ($Verbose) { Write-Output " -> f: $file" } + Write-Debug " -> f: $file" } } -if ($Verbose) { Write-Output "Cleanup starting" } -if ($Verbose) { Write-Output "Removing the following (f)iles and (d)irectories:" } +Write-Debug "Cleanup starting" +Write-Debug "Removing the following (f)iles and (d)irectories:" if (!$SkipBuildDir) { RemoveDir "build" } @@ -42,11 +46,12 @@ foreach ($file in $baseFiles) { RemoveFile $file } +# Remove the built translation files +Get-ChildItem -Path "$PSScriptRoot\src\sdk\translations" *.qm | ForEach-Object { Remove-Item -Path $_.FullName -Force } + if ($DeepClean) { - if ($Verbose) { - Write-Output "---" - Write-Output "Removing additional (f)iles and (d)irectories since -DeepClean was provided:" - } + Write-Debug "---" + Write-Debug "Removing additional (f)iles and (d)irectories since -DeepClean was provided:" $sources = "libs\7zip", "libs\installer", "sdk", "sdk\translations" $tools = "archivegen", "binarycreator", "devtool", "repocompare", "repogen" @@ -86,5 +91,7 @@ if ($DeepClean) { } } -if ($Verbose) { Write-Output "---" } -if ($Verbose) { Write-Output "Cleanup completed" } +Write-Debug "---" +Write-Debug "Cleanup completed" + +$DebugPreference = 'SilentlyContinue' \ No newline at end of file From a4b1c186c8b9a32797edde13cbd869863a302df4 Mon Sep 17 00:00:00 2001 From: Hjalti Kolbeinsson Date: Tue, 24 Nov 2020 16:34:06 +0000 Subject: [PATCH 6/8] EO-11039 - Newlines --- build.ps1 | 2 +- clean.ps1 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.ps1 b/build.ps1 index 4535448ca..96fbafcd3 100644 --- a/build.ps1 +++ b/build.ps1 @@ -88,4 +88,4 @@ if ($SkipCleaning -Or $SkipPostClean) { Write-Output "---" Write-Output "Framework built successfully. You'll find it under \build" -$DebugPreference = 'SilentlyContinue' \ No newline at end of file +$DebugPreference = 'SilentlyContinue' diff --git a/clean.ps1 b/clean.ps1 index 7b20b1612..13c8c2ae0 100644 --- a/clean.ps1 +++ b/clean.ps1 @@ -94,4 +94,4 @@ if ($DeepClean) { Write-Debug "---" Write-Debug "Cleanup completed" -$DebugPreference = 'SilentlyContinue' \ No newline at end of file +$DebugPreference = 'SilentlyContinue' From 31518103a0a731c03b4a5c4ce6fc059e5eadcc64 Mon Sep 17 00:00:00 2001 From: Hjalti Kolbeinsson Date: Tue, 24 Nov 2020 16:36:24 +0000 Subject: [PATCH 7/8] EO-11039 - One more newline --- build_helper.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_helper.bat b/build_helper.bat index 25b1096da..1f28a0cc0 100644 --- a/build_helper.bat +++ b/build_helper.bat @@ -16,4 +16,4 @@ rem Create the makefiles rem Build the makefiles %JOM% release -ENDLOCAL \ No newline at end of file +ENDLOCAL From 7005aec5aa184eedf4387b38a72366d14e4dd9a5 Mon Sep 17 00:00:00 2001 From: Hjalti Kolbeinsson Date: Tue, 24 Nov 2020 21:21:41 +0000 Subject: [PATCH 8/8] EO-11039 - Added some missing translations --- src/sdk/translations/ifw_ca.ts | 26 +++++++ src/sdk/translations/ifw_da.ts | 30 ++++++++ src/sdk/translations/ifw_de.ts | 34 ++++++++ src/sdk/translations/ifw_es.ts | 30 ++++++++ src/sdk/translations/ifw_fr.ts | 30 ++++++++ src/sdk/translations/ifw_hr.ts | 26 +++++++ src/sdk/translations/ifw_it.ts | 30 ++++++++ src/sdk/translations/ifw_ja.ts | 30 ++++++++ src/sdk/translations/ifw_pl.ts | 30 ++++++++ src/sdk/translations/ifw_ru.ts | 26 +++++++ src/sdk/translations/ifw_zh_CN.ts | 124 ++++-------------------------- 11 files changed, 305 insertions(+), 111 deletions(-) diff --git a/src/sdk/translations/ifw_ca.ts b/src/sdk/translations/ifw_ca.ts index 8ac5494cd..e33feed08 100644 --- a/src/sdk/translations/ifw_ca.ts +++ b/src/sdk/translations/ifw_ca.ts @@ -2541,4 +2541,30 @@ amb un usuari amb els permisos apropiats i després feu clic a D'acord. --> + + + QInstaller::PackageManagerCorePrivate + + +Installing component %1... + +S'instal·la el component %1... + + + + + diff --git a/src/sdk/translations/ifw_da.ts b/src/sdk/translations/ifw_da.ts index ef379803a..b33d3e792 100644 --- a/src/sdk/translations/ifw_da.ts +++ b/src/sdk/translations/ifw_da.ts @@ -2509,4 +2509,34 @@ som en bruger med de fornødne rettigheder og klik så på OK. --> + + + QInstaller::PackageManagerCorePrivate + + +Installing component %1... + +Installerer komponenten %1... + + + Done + Færdig + + + + + diff --git a/src/sdk/translations/ifw_de.ts b/src/sdk/translations/ifw_de.ts index 0d63540ef..8c0740283 100644 --- a/src/sdk/translations/ifw_de.ts +++ b/src/sdk/translations/ifw_de.ts @@ -2519,4 +2519,38 @@ Brechen Sie entweder die Installation ab, oder verwenden Sie die Fallback-Lösun --> + + + QInstaller::PackageManagerCorePrivate + + +Installing component %1... + +Komponente %1 wird installiert... + + + Done + Fertig + + + Creating Maintenance Tool + + + + + + diff --git a/src/sdk/translations/ifw_es.ts b/src/sdk/translations/ifw_es.ts index 438239a15..b2de694f0 100644 --- a/src/sdk/translations/ifw_es.ts +++ b/src/sdk/translations/ifw_es.ts @@ -2490,4 +2490,34 @@ como usuario con los derechos adecuados y, luego, haga clic en Aceptar. + + + QInstaller::PackageManagerCorePrivate + + +Installing component %1... + +Instalando componente %1... + + + Done + Hecho + + + + + diff --git a/src/sdk/translations/ifw_fr.ts b/src/sdk/translations/ifw_fr.ts index 2bb6b1d51..cf37dc582 100644 --- a/src/sdk/translations/ifw_fr.ts +++ b/src/sdk/translations/ifw_fr.ts @@ -2490,4 +2490,34 @@ en tant qu’utilisateur doté des droits appropriés, puis cliquez sur OK. + + + QInstaller::PackageManagerCorePrivate + + +Installing component %1... + +Installation du composant %1... + + + Done + Terminer + + + + + diff --git a/src/sdk/translations/ifw_hr.ts b/src/sdk/translations/ifw_hr.ts index efeb19669..53ffb3762 100644 --- a/src/sdk/translations/ifw_hr.ts +++ b/src/sdk/translations/ifw_hr.ts @@ -2505,4 +2505,30 @@ u modusu korisnika s odgovarajućim pravima. Zatim klikni "U redu". + + + QInstaller::PackageManagerCorePrivate + + +Installing component %1... + +Instaliranje komponente %1... + + + + + diff --git a/src/sdk/translations/ifw_it.ts b/src/sdk/translations/ifw_it.ts index d8ebe9336..183069b29 100644 --- a/src/sdk/translations/ifw_it.ts +++ b/src/sdk/translations/ifw_it.ts @@ -2490,4 +2490,34 @@ come utente con i diritti appropriati, quindi fare clic su OK. --> + + + QInstaller::PackageManagerCorePrivate + + +Installing component %1... + +Installazione componente %1... + + + Done + Fatto + + + + + diff --git a/src/sdk/translations/ifw_ja.ts b/src/sdk/translations/ifw_ja.ts index 23c74b708..b853ee132 100644 --- a/src/sdk/translations/ifw_ja.ts +++ b/src/sdk/translations/ifw_ja.ts @@ -2490,4 +2490,34 @@ as a user with the appropriate rights and then clicking OK. --> + + + QInstaller::PackageManagerCorePrivate + + +Installing component %1... + +コンポーネント %1 をインストールしています... + + + Done + 終了 + + + + + diff --git a/src/sdk/translations/ifw_pl.ts b/src/sdk/translations/ifw_pl.ts index dad811370..eea530c88 100644 --- a/src/sdk/translations/ifw_pl.ts +++ b/src/sdk/translations/ifw_pl.ts @@ -2490,4 +2490,34 @@ jako użytkownik z odpowiednimi prawami, a następnie kliknij przycisk OK. + + + QInstaller::PackageManagerCorePrivate + + +Installing component %1... + +Trwa instalowanie elementu %1... + + + Done + Zrobione + + + + + diff --git a/src/sdk/translations/ifw_ru.ts b/src/sdk/translations/ifw_ru.ts index 06dd14105..9446d8e28 100644 --- a/src/sdk/translations/ifw_ru.ts +++ b/src/sdk/translations/ifw_ru.ts @@ -2536,4 +2536,30 @@ as a user with the appropriate rights and then clicking OK. --> + + + QInstaller::PackageManagerCorePrivate + + +Installing component %1... + +Установка компонента %1... + + + + + diff --git a/src/sdk/translations/ifw_zh_CN.ts b/src/sdk/translations/ifw_zh_CN.ts index 511e33fd2..d7cbc27e5 100644 --- a/src/sdk/translations/ifw_zh_CN.ts +++ b/src/sdk/translations/ifw_zh_CN.ts @@ -2492,71 +2492,30 @@ as a user with the appropriate rights and then clicking OK. - QWizard - - Go Back - 返回 - - - Continue - 继续 - + QInstaller::PackageManagerCorePrivate - Commit - 提交 + +Installing component %1... + +正在安装组件 %1... Done 完成 - - Quit - 退出 - - - Help - 帮助 - - - < &Back - < 上一步(&B) - - - &Finish - 完成(&F) - - - Cancel - 取消 - - - &Cancel - 取消(&C) - - - &Help - 帮助(&H) - - - &Next - 下一步(&N) - - - &Next > - 下一步(&N) > - - @@ -2597,61 +2556,4 @@ as a user with the appropriate rights and then clicking OK. --> - - - - - -