diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 53937b2de4..f4bd498a60 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -69,7 +69,7 @@ jobs: run: | ARCH=32 PLATFORM=i686 - pacman --verbose --noconfirm -S msys/zlib-devel dos2unix ccache rsync unzip mingw$ARCH/mingw-w64-$PLATFORM-libzip mingw$ARCH/mingw-w64-$PLATFORM-libusb mingw$ARCH/mingw-w64-$PLATFORM-zlib mingw$ARCH/mingw-w64-$PLATFORM-pkg-config + pacman --verbose --noconfirm -S msys/zlib-devel dos2unix ccache rsync unzip openssh mingw$ARCH/mingw-w64-$PLATFORM-libzip mingw$ARCH/mingw-w64-$PLATFORM-libusb mingw$ARCH/mingw-w64-$PLATFORM-zlib mingw$ARCH/mingw-w64-$PLATFORM-pkg-config - name: Inject slug/short variables uses: rlespinasse/github-slug-action@v3.x @@ -233,10 +233,9 @@ jobs: - name: Deploy installer if: ${{ matrix.deploy-installer && github.event_name != 'pull_request' && github.repository_owner == 'trikset' }} run: | - INSTALLER_PATH=$(ls -1b installer/trik-studio*installer*.exe | head -n 1) - [ -r "$INSTALLER_PATH" ] || INSTALLER_PATH=/dev/null - export INSTALLER_PATH - echo "${{ secrets.DL_PASSWORD }}"| script -E never -q -c "rsync -ve 'ssh -o StrictHostKeyChecking=no' $INSTALLER_PATH ${{ secrets.DL_USERNAME }}@${{ secrets.DL_HOST }}:~/dl/ts/fresh/installer/trik-studio-${{ env.GITHUB_REF_SLUG }}-i686-installer.exe" + install -m 600 -D /dev/null ~/.ssh/id_rsa + echo "${{ secrets.DL_PRIVATE_SSH_KEY }}" > ~/.ssh/id_rsa + rsync -v --rsh="ssh -o StrictHostKeyChecking=no" installer/trik-studio*installer*.exe ${{ secrets.DL_USERNAME }}@${{ secrets.DL_HOST }}:~/dl/ts/fresh/installer/trik-studio-${{ env.GITHUB_REF_SLUG }}-i686-installer.exe - name: Prepare for RDP connection if: false #comment this line to create RDP session diff --git a/plugins/robots/common/twoDModel/include/twoDModel/engine/view/twoDModelWidget.h b/plugins/robots/common/twoDModel/include/twoDModel/engine/view/twoDModelWidget.h index 7fca4267ac..5f404eec30 100644 --- a/plugins/robots/common/twoDModel/include/twoDModel/engine/view/twoDModelWidget.h +++ b/plugins/robots/common/twoDModel/include/twoDModel/engine/view/twoDModelWidget.h @@ -234,6 +234,8 @@ private slots: void incrementTimelineCounter(); + const QDomDocument loadXmlWithConversion(const QString &loadFileName) const; + Ui::TwoDModelWidget *mUi {}; QScopedPointer mScene; QScopedPointer mActions; diff --git a/plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp b/plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp index d9030f10ee..e21377ec33 100644 --- a/plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp +++ b/plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp @@ -506,16 +506,7 @@ void TwoDModelWidget::loadWorldModel() return; } - QString errorMessage; - int errorLine = 0; - int errorColumn = 0; - const QDomDocument save = utils::xmlUtils::loadDocument(loadFileName, &errorMessage, &errorLine, &errorColumn); - if (!errorMessage.isEmpty()) { - mModel.errorReporter()->addError(QString("%1:%2: %3") - .arg(QString::number(errorLine), QString::number(errorColumn), errorMessage)); - } - - auto command = new commands::LoadWorldCommand(*this, save); + auto command = new commands::LoadWorldCommand(*this, loadXmlWithConversion(loadFileName)); if (mController) { mController->execute(command); } @@ -528,14 +519,7 @@ void TwoDModelWidget::loadWorldModelWithoutRobot() return; } - QString errorMessage; - int errorLine = 0; - int errorColumn = 0; - QDomDocument save = utils::xmlUtils::loadDocument(loadFileName, &errorMessage, &errorLine, &errorColumn); - if (!errorMessage.isEmpty()) { - mModel.errorReporter()->addError(QString("%1:%2: %3") - .arg(QString::number(errorLine), QString::number(errorColumn), errorMessage)); - } + QDomDocument save = loadXmlWithConversion(loadFileName); auto newWorld = save.firstChildElement("root"); auto oldWorld = generateWorldModelXml().firstChildElement("root"); @@ -1131,3 +1115,40 @@ void TwoDModelWidget::incrementTimelineCounter() { mUi->timelineBox->stepBy(1); } + +const QDomDocument TwoDModelWidget::loadXmlWithConversion(const QString &loadFileName) const +{ + QString errorMessage; + int errorLine = 0; + int errorColumn = 0; + const QDomDocument save = utils::xmlUtils::loadDocument(loadFileName, &errorMessage, &errorLine, &errorColumn); + if (!errorMessage.isEmpty()) { + mModel.errorReporter()->addError(QString("%1:%2: %3") + .arg(QString::number(errorLine), QString::number(errorColumn), errorMessage)); + return save; + } + + QDomElement root = save.firstChildElement("root"); + + QDomElement oldRobot = root.firstChildElement("robots").firstChildElement("robot"); + if (oldRobot.hasAttribute("position") || oldRobot.hasAttribute("direction") + || !oldRobot.firstChildElement("startPosition").isNull()) { + QDomElement world = root.firstChildElement("world"); + if (world.isNull()) { + world = root.ownerDocument().createElement("world"); + root.appendChild(world); + } + + QDomElement robot = world.ownerDocument().createElement("robot"); + robot.setAttribute("position", oldRobot.attribute("position", "0:0")); + robot.setAttribute("direction", oldRobot.attribute("direction", "0")); + robot.appendChild(oldRobot.firstChildElement("startPosition")); + world.appendChild(robot); + + oldRobot.removeAttribute("position"); + oldRobot.removeAttribute("direction"); + // start position reparented automatically + } + + return save; +} diff --git a/qrtranslations/fr/plugins/robots/twoDModel_fr.ts b/qrtranslations/fr/plugins/robots/twoDModel_fr.ts index ad74462dce..fc4e41cb10 100644 --- a/qrtranslations/fr/plugins/robots/twoDModel_fr.ts +++ b/qrtranslations/fr/plugins/robots/twoDModel_fr.ts @@ -763,22 +763,22 @@ - + 2D model saves (*.xml) Fichiers de sauvegarde du modèle 2D (*.xml) - + Loading world and robot model Chargement des modèles du monde et du robot - + Loading world without robot model - + Hide details diff --git a/qrtranslations/ru/plugins/robots/twoDModel_ru.ts b/qrtranslations/ru/plugins/robots/twoDModel_ru.ts index f4beed7293..5dfeeb7ceb 100644 --- a/qrtranslations/ru/plugins/robots/twoDModel_ru.ts +++ b/qrtranslations/ru/plugins/robots/twoDModel_ru.ts @@ -1106,17 +1106,17 @@ - + 2D model saves (*.xml) Файлы 2D модели (*.xml) - + Loading world and robot model Загрузка модели мира - + Loading world without robot model Загрузка модели мира без модели робота @@ -1133,7 +1133,7 @@ Попытка загрузить слишком большое изображение может заморозить выполнение на некоторое время. Продолжить? - + Hide details Скрыть детали