diff --git a/.gitignore b/.gitignore index 0fd002c..0a4495e 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,7 @@ object_script.*.Debug *.qbs.user *.qbs.user.* *.moc +*.qm moc_*.cpp moc_*.h qrc_*.cpp @@ -58,6 +59,9 @@ sharedQtWin32/ sharedQtWin64/ distro/ +Distro/ +deployTests/ +installer/packages/cqtdeployer/data/ staticQt/ staticQtWin32/ diff --git a/CQtDeployer.pro b/CQtDeployer.pro index 9db5f9a..f28005a 100644 --- a/CQtDeployer.pro +++ b/CQtDeployer.pro @@ -32,6 +32,8 @@ QuasarAppLib.file = $$PWD/QuasarAppLib/QuasarApp.pro Pe.file = $$PWD/pe/pe-parser-library/pe-parser-library.pro win32:include('$$PWD/CQtDeployerWinBuild.pri') +include('$$PWD/installer/installer.pri') +include($$PWD/test.pri) DISTFILES += \ snapBuild.sh \ diff --git a/QuasarAppLib b/QuasarAppLib index a984e8d..9556d4d 160000 --- a/QuasarAppLib +++ b/QuasarAppLib @@ -1 +1 @@ -Subproject commit a984e8d6d0387d32cbbc39483a68aa8cc64f0302 +Subproject commit 9556d4d100bc79f9851ee9e8553fb2c73cc6cc3e diff --git a/installer/config/banner.png b/installer/config/banner.png new file mode 100644 index 0000000..732ab31 Binary files /dev/null and b/installer/config/banner.png differ diff --git a/installer/config/configLinux.xml b/installer/config/configLinux.xml new file mode 100644 index 0000000..c5e039f --- /dev/null +++ b/installer/config/configLinux.xml @@ -0,0 +1,27 @@ + + + 640px + 400px + CQtDeployer + 1.2.1 + CQtDeployer + QuasarApp + CQtDeployer + @HomeDir@/CQtDeployer + true + true + controlScript.js + CQtDeployerTool + Classic + style.css + banner.png + logo.png + + + + http://178.124.160.6:3030/CQtDeployer/Linux + 1 + QuasarApp + + + diff --git a/installer/config/configWin.xml b/installer/config/configWin.xml new file mode 100644 index 0000000..7fe9316 --- /dev/null +++ b/installer/config/configWin.xml @@ -0,0 +1,27 @@ + + + 640px + 400px + CQtDeployer + 1.2.1 + CQtDeployer + QuasarApp + CQtDeployer + @HomeDir@/CQtDeployer + true + true + controlScript.js + CQtDeployerTool + Classic + style.css + banner.png + logo.png + + + + http://178.124.160.6:3030/CQtDeployer/Windows + 1 + QuasarApp + + + diff --git a/installer/config/controlScript.js b/installer/config/controlScript.js new file mode 100644 index 0000000..e04a6a2 --- /dev/null +++ b/installer/config/controlScript.js @@ -0,0 +1,73 @@ +function Controller() +{ + generateTr(); + + installer.setMessageBoxAutomaticAnswer("OverwriteTargetDirectory", QMessageBox.Yes); + installer.uninstallationFinished.connect(this, Controller.prototype.uninstallationFinished); + installer.installationFinished.connect(this, Controller.prototype.installationFinished); +} + +function generateTr() { + console.log("generate tr start ") + + installer.setValue("Name", qsTr("CQtDeployer")); + installer.setValue("Title", qsTr("Install CQtDeployer")); +} + +Controller.prototype.uninstallationFinished = function() +{ + console.log("hometDir " + homeDir) + + if (systemInfo.kernelType === "winnt") { + if (!installer.gainAdminRights()) { + QMessageBox["warning"](qsTr("install in system"), qsTr("Installer"), + qsTr("To uninstall cqtdeployer on your system, you need administrator rights!. "), QMessageBox.Ok); + + return; + } + + installer.execute("DELETE", ["C:\Windows\system32\cqtdeployer.exe"]) + + installer.dropAdminRights(); + + } else { + installer.execute("rm", ["-f", homeDir + "/.local/bin/cqtdeployer"]) + } + +} + + +Controller.prototype.installationFinished = function() +{ + + targetDir = installer.value("TargetDir", ""); + homeDir = installer.value("HomeDir", ""); + + console.log("targetDir " + targetDir) + console.log("hometDir " + homeDir) + + if (systemInfo.kernelType === "winnt") { + if (!installer.gainAdminRights()) { + QMessageBox["warning"](qsTr("install in system"), qsTr("Installer"), + qsTr("To install cqtdeployer on your system, you need administrator rights!. ") + + qsTr("The installation was successful, but cqtdeployer will not be available from the console. ") + + qsTr("To take advantage of this program you will need to enter the full path to it. ") + + qsTr("Example: ") + targetDir + "\cqtdeployer.exe", QMessageBox.Ok); + + return; + } + + installer.execute("DELETE", ["C:\Windows\system32\cqtdeployer.exe"]) + installer.execute("mklink", [targetDir + "\cqtdeployer.exe", "C:\Windows\system32\cqtdeployer.exe"]) + + installer.dropAdminRights(); + + } else { + installer.execute("ln", ["-sf", targetDir + "/cqtdeployer.sh", + homeDir + "/.local/bin/cqtdeployer"]) + } + + QMessageBox["information"](qsTr("install in system"), qsTr("Installer"), + qsTr("CQtDeployer successfully installed on your computer to use the call \"cqtdeployer\"."), + QMessageBox.Ok); +} diff --git a/installer/config/icon.ico b/installer/config/icon.ico new file mode 100644 index 0000000..8bee168 Binary files /dev/null and b/installer/config/icon.ico differ diff --git a/installer/config/logo.png b/installer/config/logo.png new file mode 100644 index 0000000..732ab31 Binary files /dev/null and b/installer/config/logo.png differ diff --git a/installer/config/ru.ts b/installer/config/ru.ts new file mode 100644 index 0000000..7ab6b19 --- /dev/null +++ b/installer/config/ru.ts @@ -0,0 +1,62 @@ + + + + + controlScript + + + CQtDeployer + + + + + Install CQtDeployer + Install Snake + + + + + + + install in system + + + + + + + Installer + + + + + To uninstall cqtdeployer on your system, you need administrator rights!. + + + + + To install cqtdeployer on your system, you need administrator rights!. + + + + + The installation was successful, but cqtdeployer will not be available from the console. + + + + + To take advantage of this program you will need to enter the full path to it. + + + + + Example: + + + + + CQtDeployer successfully installed on your computer to use the call "cqtdeployer". + + + + diff --git a/installer/config/style.css b/installer/config/style.css new file mode 100644 index 0000000..f5282ce --- /dev/null +++ b/installer/config/style.css @@ -0,0 +1,62 @@ +.QWidget { + background-color: rgb(255, 255, 255); + min-width: 640px; +} + +.QLabel { + color: #000000; +} + +.QPushButton { + background-color: transparent; + border: 2px solid #ffffff; + border-radius: 3px; + height: 30px; + min-width: 100px; + padding: 0 15px; +} + +.QPushButton:pressed, +.QPushButton:checked { + background-color: #2ed3ed; +} + +.QPushButton:focus { + background-color: #aaf2ff; +} + +.QPushButton:hover { + border: 2px solid #2ed3ed; +} + + +.QProgressBar { + background: #b1dbcc; + border: 1px solid #cdcdcd; + border-radius: 2px; + padding: 0; + margin: 0; + color: #ffffff; + height: 30px; + text-align: center; +} + +.QProgressBar::chunk { + background: #16dbcc; + border-radius: 2px; + margin: 0; +} + +.QProgressBar:hover { + border-color: #2ed3ed; +} + +.QLineEdit { + background-color: transparent; + border-color: #cdcdcd; + height: 30px; +} + +.QLineEdit:hover { + border-color: #2ed3ed; +} diff --git a/installer/install_prefix.pri b/installer/install_prefix.pri new file mode 100644 index 0000000..db34b97 --- /dev/null +++ b/installer/install_prefix.pri @@ -0,0 +1,33 @@ +!isEmpty(INSTALL_REFIX_PRI_INCLUDED):error("install_prefix.pri already included") +INSTALL_REFIX_PRI_INCLUDED = 1 + +unix:libfiletype=*.so* +win32:libfiletype=*.dll +unix:runfiletype=* +win32:runfiletype=*.exe + +isEmpty(PREFIX_BIN) { + isEmpty(PREFIX) { + PREFIX_BIN = $$PWD/distro + } else { + unix:PREFIX_BIN = $$PREFIX/bin + win32:PREFIX_BIN = $$PREFIX + } +} + +isEmpty(PREFIX_LIB) { + isEmpty(PREFIX) { + PREFIX_LIB = $$PWD/distro + } else { + unix:PREFIX_LIB = $$PREFIX/lib + win32:PREFIX_LIB = $$PREFIX + } +} + +target_bin.path = $$PREFIX_BIN +target_bin.CONFIG += no_check_exist +target_lib.path = $$PREFIX_LIB +target_lib.CONFIG += no_check_exist + +INSTALLS += target_bin target_lib + diff --git a/installer/installer.pri b/installer/installer.pri new file mode 100644 index 0000000..68445f0 --- /dev/null +++ b/installer/installer.pri @@ -0,0 +1,148 @@ +QT_DIR = $$dirname(QMAKE_QMAKE) +#QML_DIR = $$PWD/../Snake/ +DEPLOY_TARGET = $$PWD/../CQtDeployer/build/release + +win32:LUPDATE = $$QT_DIR/lupdate.exe +win32:LRELEASE = $$QT_DIR/lrelease.exe + +win32:DEPLOYER = cqtdeployer.exe + +win32:OUT_FILE = CQtDeployerInstaller.exe + +contains(QMAKE_HOST.os, Linux):{ + LUPDATE = $$QT_DIR/lupdate + LRELEASE = $$QT_DIR/lrelease + + DEPLOYER = cqtdeployer + + OUT_FILE = CQtDeployerInstaller + +} + +BINARY_LIST +REPO_LIST +exists( $$QT_DIR/../../../Tools/QtInstallerFramework/3.0/bin/ ) { + message( "QtInstallerFramework v3.0: yes" ) + BINARY_LIST += $$QT_DIR/../../../Tools/QtInstallerFramework/3.0/bin/binarycreator + REPO_LIST += $$QT_DIR/../../../Tools/QtInstallerFramework/3.0/bin/repogen + +} +exists( $$QT_DIR/../../../Tools/QtInstallerFramework/2.0/bin/ ) { + message( "QtInstallerFramework v2.0: yes" ) + BINARY_LIST += $$QT_DIR/../../../Tools/QtInstallerFramework/2.0/bin/binarycreator + REPO_LIST += $$QT_DIR/../../../Tools/QtInstallerFramework/2.0/bin/repogen +} + +isEmpty (BINARY_LIST) { + error( "QtInstallerFramework not found!" ) +} + +win32:EXEC=$$first(BINARY_LIST).exe + +win32:REPOGEN=$$first(REPO_LIST).exe + +contains(QMAKE_HOST.os, Linux):{ + unix:EXEC=$$first(BINARY_LIST) + win32:EXEC=wine $$first(BINARY_LIST).exe + + REPOGEN=$$first(REPO_LIST) +} + +message( selected $$EXEC and $$REPOGEN) + + +SUPPORT_LANGS = ru + +defineReplace(findFiles) { + patern = $$1 + path = $$2 + + all_files = $$files(*$${patern}, true) + win32:all_files ~= s|\\\\|/|g + win32:path ~= s|\\\\|/|g + + for(file, all_files) { + result += $$find(file, $$path) + } + + return($$result) +} + +XML_FILES = $$files(*.xml, true) + +for(LANG, SUPPORT_LANGS) { + for(XML, XML_FILES) { + FILE_PATH = $$dirname(XML) + + JS_FILES = $$findFiles(".js", $$FILE_PATH) + UI_FILES = $$findFiles(".ui", $$FILE_PATH) + + commands += "$$LUPDATE $$JS_FILES $$UI_FILES -ts $$FILE_PATH/$${LANG}.ts" + TS_FILES += $$FILE_PATH/$${LANG}.ts + + } + + for(TS, TS_FILES) { + commands += "$$LRELEASE $$TS" + } +} + +for(command, commands) { + system($$command)|error("Failed to run: $$command") +} + +BASE_DEPLOY_FLAGS = clear -qmake $$QMAKE_QMAKE -libDir $$PWD/../ -recursiveDepth 3 +BASE_DEPLOY_FLAGS_SNAKE = $$BASE_DEPLOY_FLAGS -targetDir $$PWD/packages/cqtdeployer/data + +deploy_dep.commands += $$DEPLOYER -bin $$DEPLOY_TARGET $$BASE_DEPLOY_FLAGS_SNAKE + +mkpath( $$PWD/../Distro) + +win32:CONFIG_FILE = $$PWD/config/configWin.xml +unix:CONFIG_FILE = $$PWD/config/configLinux.xml + +deploy.commands = $$EXEC \ + --offline-only \ + -c $$CONFIG_FILE \ + -p $$PWD/packages \ + $$PWD/../Distro/$$OUT_FILE + +deploy.depends = deploy_dep + +win32:ONLINE_REPO_DIR = $$ONLINE/CQtDeployer/Windows +unix:ONLINE_REPO_DIR = $$ONLINE/CQtDeployer/Linux + +create_repo.commands = $$REPOGEN \ + --update-new-components \ + -p $$PWD/packages \ + $$ONLINE_REPO_DIR + +message( ONLINE_REPO_DIR $$ONLINE_REPO_DIR) +!isEmpty( ONLINE ) { + + message(online) + + release.depends = create_repo + + deploy.commands = $$EXEC \ + --online-only \ + -c $$CONFIG_FILE \ + -p $$PWD/packages \ + $$PWD/../Distro/$$OUT_FILE +} + +OTHER_FILES += \ + $$PWD/config/*.xml \ + $$PWD/config/*.js \ + $$PWD/config/*.ts \ + $$PWD/config/*.css \ + $$PWD/packages/Installer/meta/* \ + $$PWD/packages/Installer/data/app.check \ + $$PWD/packages/cqtdeployer/meta/* \ + + +QMAKE_EXTRA_TARGETS += \ + deploy_dep \ + deploy \ + create_repo \ + release \ diff --git a/installer/packages/Installer/data/icon.ico b/installer/packages/Installer/data/icon.ico new file mode 100644 index 0000000..8bee168 Binary files /dev/null and b/installer/packages/Installer/data/icon.ico differ diff --git a/installer/packages/Installer/data/logo.png b/installer/packages/Installer/data/logo.png new file mode 100644 index 0000000..732ab31 Binary files /dev/null and b/installer/packages/Installer/data/logo.png differ diff --git a/installer/packages/Installer/meta/installscript.js b/installer/packages/Installer/meta/installscript.js new file mode 100644 index 0000000..74fa43b --- /dev/null +++ b/installer/packages/Installer/meta/installscript.js @@ -0,0 +1,13 @@ +// Constructor +function Component() +{ + generateTr(); +} + +function generateTr() { + console.log("generate tr start ") + + component.setValue("DisplayName", qsTr("Installer")); + component.setValue("Description", qsTr("This package contains information of installer")); +} + diff --git a/installer/packages/Installer/meta/package.xml b/installer/packages/Installer/meta/package.xml new file mode 100644 index 0000000..95c3415 --- /dev/null +++ b/installer/packages/Installer/meta/package.xml @@ -0,0 +1,14 @@ + + + from script + from script + 1.0.0 + true + true + + 2018-08-25 + 201 + + ru.qm + + diff --git a/installer/packages/Installer/meta/ru.ts b/installer/packages/Installer/meta/ru.ts new file mode 100644 index 0000000..60ae83d --- /dev/null +++ b/installer/packages/Installer/meta/ru.ts @@ -0,0 +1,17 @@ + + + + + installscript + + + Installer + + + + + This package contains information of installer + + + + diff --git a/installer/packages/cqtdeployer/meta/installscript.js b/installer/packages/cqtdeployer/meta/installscript.js new file mode 100644 index 0000000..652dc4f --- /dev/null +++ b/installer/packages/cqtdeployer/meta/installscript.js @@ -0,0 +1,17 @@ +function Component() +{ + generateTr(); +} + +function generateTr() { + component.setValue("DisplayName", qsTr("CQtDeployer")); + component.setValue("Description", qsTr("This package contains CQtDeployer")); +} + + +Component.prototype.createOperations = function() +{ +// // call default implementation to actually install README.txt! + component.createOperations(); + +} diff --git a/installer/packages/cqtdeployer/meta/package.xml b/installer/packages/cqtdeployer/meta/package.xml new file mode 100644 index 0000000..474386b --- /dev/null +++ b/installer/packages/cqtdeployer/meta/package.xml @@ -0,0 +1,14 @@ + + + CQtDeployer + CQtDeployer + 1.2.1 + true + false + + 2019-05-14 + 200 + + ru.qm + + diff --git a/installer/packages/cqtdeployer/meta/ru.ts b/installer/packages/cqtdeployer/meta/ru.ts new file mode 100644 index 0000000..1e96f16 --- /dev/null +++ b/installer/packages/cqtdeployer/meta/ru.ts @@ -0,0 +1,18 @@ + + + + + installscript + + + CQtDeployer + + + + + This package contains CQtDeployer + This package contains Snake + + + + diff --git a/test.pri b/test.pri new file mode 100644 index 0000000..94390d4 --- /dev/null +++ b/test.pri @@ -0,0 +1,12 @@ +unix:exec = $$PWD/UnitTests/build/release/UnitTests +win32:exec = $$PWD/UnitTests/build/release/UnitTests.exe + +deployTest.commands = cqtdeployer -bin $$exec clear -qmake $$QMAKE_QMAKE -targetDir $$PWD/deployTests -libDir $$PWD -recursiveDepth 3 + +test.depends = deployTest +unix:test.commands = $$PWD/deployTests/UnitTests.sh +win32:test.commands = $$PWD/deployTests/UnitTests.exe + +QMAKE_EXTRA_TARGETS += \ + deployTest \ + test