2016-01-15 14:57:40 +01:00
|
|
|
/****************************************************************************
|
2014-02-10 14:16:55 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 BlackBerry Limited. All rights reserved.
|
|
|
|
|
** Contact: BlackBerry (qt@blackberry.com), KDAB (info@kdab.com)
|
2014-02-10 14:16:55 +01:00
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator.
|
|
|
|
|
**
|
|
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2016-01-15 14:57:40 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2014-02-10 14:16:55 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2014-02-10 14:16:55 +01:00
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
2014-05-27 12:46:24 +02:00
|
|
|
#include "qnxdeployqtlibrariesdialog.h"
|
2014-02-10 14:16:55 +01:00
|
|
|
|
2017-01-11 14:43:48 +01:00
|
|
|
#include "qnxconstants.h"
|
2014-05-27 12:46:24 +02:00
|
|
|
#include "qnxqtversion.h"
|
2014-02-10 14:16:55 +01:00
|
|
|
|
|
|
|
|
#include <projectexplorer/deployablefile.h>
|
2022-04-12 21:01:45 +02:00
|
|
|
#include <projectexplorer/devicesupport/idevice.h>
|
2014-02-10 14:16:55 +01:00
|
|
|
#include <qtsupport/qtversionmanager.h>
|
|
|
|
|
#include <remotelinux/genericdirectuploadservice.h>
|
2017-01-11 14:43:48 +01:00
|
|
|
|
|
|
|
|
#include <utils/algorithm.h>
|
2014-02-10 14:16:55 +01:00
|
|
|
#include <utils/qtcassert.h>
|
|
|
|
|
|
2022-07-11 12:29:52 +02:00
|
|
|
#include <QComboBox>
|
|
|
|
|
#include <QDialog>
|
2014-02-10 14:16:55 +01:00
|
|
|
#include <QDir>
|
2022-07-11 12:29:52 +02:00
|
|
|
#include <QFormLayout>
|
|
|
|
|
#include <QHBoxLayout>
|
|
|
|
|
#include <QLabel>
|
|
|
|
|
#include <QLineEdit>
|
2014-02-10 14:16:55 +01:00
|
|
|
#include <QMessageBox>
|
2022-07-11 12:29:52 +02:00
|
|
|
#include <QPlainTextEdit>
|
|
|
|
|
#include <QProgressBar>
|
|
|
|
|
#include <QPushButton>
|
|
|
|
|
#include <QSpacerItem>
|
|
|
|
|
#include <QVBoxLayout>
|
|
|
|
|
#include <QVariant>
|
2014-02-10 14:16:55 +01:00
|
|
|
|
2016-03-15 09:26:34 +01:00
|
|
|
using namespace ProjectExplorer;
|
2022-05-04 19:08:32 +02:00
|
|
|
using namespace QtSupport;
|
2016-03-15 09:26:34 +01:00
|
|
|
using namespace RemoteLinux;
|
2022-05-04 19:08:32 +02:00
|
|
|
using namespace Utils;
|
2015-04-24 10:31:27 +02:00
|
|
|
|
|
|
|
|
namespace Qnx {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2016-03-15 09:26:34 +01:00
|
|
|
QnxDeployQtLibrariesDialog::QnxDeployQtLibrariesDialog(const IDevice::ConstPtr &device,
|
2022-05-04 19:08:32 +02:00
|
|
|
QWidget *parent)
|
|
|
|
|
: QDialog(parent)
|
|
|
|
|
, m_device(device)
|
2014-02-10 14:16:55 +01:00
|
|
|
{
|
2022-07-11 12:29:52 +02:00
|
|
|
setWindowTitle(tr("Deploy Qt to QNX Device"));
|
2014-02-10 14:16:55 +01:00
|
|
|
|
2022-07-11 12:29:52 +02:00
|
|
|
m_qtLibraryCombo = new QComboBox(this);
|
2022-05-04 19:08:32 +02:00
|
|
|
const QList<QtVersion*> qtVersions = QtVersionManager::sortVersions(
|
|
|
|
|
QtVersionManager::versions(QtVersion::isValidPredicate(
|
|
|
|
|
equal(&QtVersion::type, QString::fromLatin1(Constants::QNX_QNX_QT)))));
|
2022-01-21 16:06:36 +01:00
|
|
|
for (QtVersion *v : qtVersions)
|
2022-07-11 12:29:52 +02:00
|
|
|
m_qtLibraryCombo->addItem(v->displayName(), v->uniqueId());
|
2014-02-10 14:16:55 +01:00
|
|
|
|
2022-07-11 12:29:52 +02:00
|
|
|
m_deployButton = new QPushButton(tr("Deploy"), this);
|
|
|
|
|
m_deployButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
|
|
|
|
|
|
|
|
|
m_basePathLabel = new QLabel(this);
|
|
|
|
|
|
|
|
|
|
m_remoteDirectory = new QLineEdit(this);
|
|
|
|
|
m_remoteDirectory->setText(QLatin1String("/qt"));
|
|
|
|
|
|
|
|
|
|
m_deployProgress = new QProgressBar(this);
|
|
|
|
|
m_deployProgress->setValue(0);
|
|
|
|
|
m_deployProgress->setTextVisible(true);
|
|
|
|
|
|
|
|
|
|
m_deployLogWindow = new QPlainTextEdit(this);
|
|
|
|
|
|
|
|
|
|
m_closeButton = new QPushButton(tr("Close"), this);
|
2014-05-27 12:46:24 +02:00
|
|
|
|
2022-05-04 19:08:32 +02:00
|
|
|
m_uploadService = new GenericDirectUploadService(this);
|
2014-02-10 14:16:55 +01:00
|
|
|
m_uploadService->setDevice(m_device);
|
|
|
|
|
|
2022-07-11 12:29:52 +02:00
|
|
|
auto horizontalLayout = new QHBoxLayout();
|
|
|
|
|
horizontalLayout->addWidget(m_qtLibraryCombo);
|
|
|
|
|
horizontalLayout->addWidget(m_deployButton);
|
|
|
|
|
|
|
|
|
|
auto horizontalLayout_3 = new QHBoxLayout();
|
|
|
|
|
horizontalLayout_3->setSpacing(0);
|
|
|
|
|
horizontalLayout_3->addWidget(m_basePathLabel);
|
|
|
|
|
horizontalLayout_3->addWidget(m_remoteDirectory);
|
|
|
|
|
|
|
|
|
|
auto formLayout = new QFormLayout();
|
|
|
|
|
formLayout->addRow(tr("Qt library to deploy:"), horizontalLayout);
|
|
|
|
|
formLayout->addRow(tr("Remote directory:"), horizontalLayout_3);
|
|
|
|
|
|
|
|
|
|
auto horizontalLayout_2 = new QHBoxLayout();
|
|
|
|
|
horizontalLayout_2->addItem(new QSpacerItem(218, 20, QSizePolicy::Expanding, QSizePolicy::Minimum));
|
|
|
|
|
horizontalLayout_2->addWidget(m_closeButton);
|
|
|
|
|
|
|
|
|
|
auto verticalLayout = new QVBoxLayout(this);
|
|
|
|
|
verticalLayout->addLayout(formLayout);
|
|
|
|
|
verticalLayout->addWidget(m_deployProgress);
|
|
|
|
|
verticalLayout->addWidget(m_deployLogWindow);
|
|
|
|
|
verticalLayout->addLayout(horizontalLayout_2);
|
|
|
|
|
|
2016-03-15 09:26:34 +01:00
|
|
|
connect(m_uploadService, &AbstractRemoteLinuxDeployService::progressMessage,
|
|
|
|
|
this, &QnxDeployQtLibrariesDialog::updateProgress);
|
|
|
|
|
connect(m_uploadService, &AbstractRemoteLinuxDeployService::progressMessage,
|
2022-07-11 12:29:52 +02:00
|
|
|
m_deployLogWindow, &QPlainTextEdit::appendPlainText);
|
2016-03-15 09:26:34 +01:00
|
|
|
connect(m_uploadService, &AbstractRemoteLinuxDeployService::errorMessage,
|
2022-07-11 12:29:52 +02:00
|
|
|
m_deployLogWindow, &QPlainTextEdit::appendPlainText);
|
2016-03-15 09:26:34 +01:00
|
|
|
connect(m_uploadService, &AbstractRemoteLinuxDeployService::warningMessage,
|
2019-10-01 14:53:03 +02:00
|
|
|
this, [this](const QString &message) {
|
|
|
|
|
if (!message.contains("stat:"))
|
2022-07-11 12:29:52 +02:00
|
|
|
m_deployLogWindow->appendPlainText(message);
|
2019-10-01 14:53:03 +02:00
|
|
|
});
|
2016-03-15 09:26:34 +01:00
|
|
|
connect(m_uploadService, &AbstractRemoteLinuxDeployService::stdOutData,
|
2022-07-11 12:29:52 +02:00
|
|
|
m_deployLogWindow, &QPlainTextEdit::appendPlainText);
|
2016-03-15 09:26:34 +01:00
|
|
|
connect(m_uploadService, &AbstractRemoteLinuxDeployService::stdErrData,
|
2022-07-11 12:29:52 +02:00
|
|
|
m_deployLogWindow, &QPlainTextEdit::appendPlainText);
|
2016-03-15 09:26:34 +01:00
|
|
|
connect(m_uploadService, &AbstractRemoteLinuxDeployService::finished,
|
|
|
|
|
this, &QnxDeployQtLibrariesDialog::handleUploadFinished);
|
2014-02-10 14:16:55 +01:00
|
|
|
|
2022-05-04 19:08:32 +02:00
|
|
|
connect(&m_checkDirProcess, &QtcProcess::done,
|
|
|
|
|
this, &QnxDeployQtLibrariesDialog::handleCheckDirDone);
|
|
|
|
|
connect(&m_removeDirProcess, &QtcProcess::done,
|
|
|
|
|
this, &QnxDeployQtLibrariesDialog::handleRemoveDirDone);
|
2016-03-15 09:26:34 +01:00
|
|
|
|
2022-07-11 12:29:52 +02:00
|
|
|
connect(m_deployButton, &QAbstractButton::clicked,
|
2016-03-15 09:26:34 +01:00
|
|
|
this, &QnxDeployQtLibrariesDialog::deployLibraries);
|
2022-07-11 12:29:52 +02:00
|
|
|
connect(m_closeButton, &QAbstractButton::clicked,
|
2016-03-15 09:26:34 +01:00
|
|
|
this, &QWidget::close);
|
2014-02-10 14:16:55 +01:00
|
|
|
}
|
|
|
|
|
|
2022-07-11 12:29:52 +02:00
|
|
|
QnxDeployQtLibrariesDialog::~QnxDeployQtLibrariesDialog() = default;
|
2014-02-10 14:16:55 +01:00
|
|
|
|
2014-05-27 12:46:24 +02:00
|
|
|
int QnxDeployQtLibrariesDialog::execAndDeploy(int qtVersionId, const QString &remoteDirectory)
|
2014-02-10 14:16:55 +01:00
|
|
|
{
|
2022-07-11 12:29:52 +02:00
|
|
|
m_remoteDirectory->setText(remoteDirectory);
|
|
|
|
|
m_qtLibraryCombo->setCurrentIndex(m_qtLibraryCombo->findData(qtVersionId));
|
2014-02-10 14:16:55 +01:00
|
|
|
|
|
|
|
|
deployLibraries();
|
|
|
|
|
return exec();
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-27 12:46:24 +02:00
|
|
|
void QnxDeployQtLibrariesDialog::closeEvent(QCloseEvent *event)
|
2014-02-10 14:16:55 +01:00
|
|
|
{
|
|
|
|
|
// A disabled Deploy button indicates the upload is still running
|
2022-07-11 12:29:52 +02:00
|
|
|
if (!m_deployButton->isEnabled()) {
|
2022-05-04 19:08:32 +02:00
|
|
|
const int answer = QMessageBox::question(this, windowTitle(),
|
|
|
|
|
tr("Closing the dialog will stop the deployment. Are you sure you want to do this?"),
|
|
|
|
|
QMessageBox::Yes | QMessageBox::No);
|
2014-02-10 14:16:55 +01:00
|
|
|
if (answer == QMessageBox::No)
|
|
|
|
|
event->ignore();
|
|
|
|
|
else if (answer == QMessageBox::Yes)
|
|
|
|
|
m_uploadService->stop();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-27 12:46:24 +02:00
|
|
|
void QnxDeployQtLibrariesDialog::deployLibraries()
|
2014-02-10 14:16:55 +01:00
|
|
|
{
|
|
|
|
|
QTC_ASSERT(m_state == Inactive, return);
|
|
|
|
|
|
2022-07-11 12:29:52 +02:00
|
|
|
if (m_remoteDirectory->text().isEmpty()) {
|
2014-02-10 14:16:55 +01:00
|
|
|
QMessageBox::warning(this, windowTitle(),
|
|
|
|
|
tr("Please input a remote directory to deploy to."));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QTC_ASSERT(!m_device.isNull(), return);
|
|
|
|
|
|
|
|
|
|
m_progressCount = 0;
|
2022-07-11 12:29:52 +02:00
|
|
|
m_deployProgress->setValue(0);
|
|
|
|
|
m_remoteDirectory->setEnabled(false);
|
|
|
|
|
m_deployButton->setEnabled(false);
|
|
|
|
|
m_qtLibraryCombo->setEnabled(false);
|
|
|
|
|
m_deployLogWindow->clear();
|
2014-02-10 14:16:55 +01:00
|
|
|
|
2022-05-04 19:08:32 +02:00
|
|
|
startCheckDirProcess();
|
2014-02-10 14:16:55 +01:00
|
|
|
}
|
|
|
|
|
|
2014-05-27 12:46:24 +02:00
|
|
|
void QnxDeployQtLibrariesDialog::startUpload()
|
2014-02-10 14:16:55 +01:00
|
|
|
{
|
|
|
|
|
QTC_CHECK(m_state == CheckingRemoteDirectory || m_state == RemovingRemoteDirectory);
|
|
|
|
|
|
|
|
|
|
m_state = Uploading;
|
|
|
|
|
|
2016-03-15 09:26:34 +01:00
|
|
|
QList<DeployableFile> filesToUpload = gatherFiles();
|
2014-02-10 14:16:55 +01:00
|
|
|
|
2022-07-11 12:29:52 +02:00
|
|
|
m_deployProgress->setRange(0, filesToUpload.count());
|
2014-02-10 14:16:55 +01:00
|
|
|
|
|
|
|
|
m_uploadService->setDeployableFiles(filesToUpload);
|
|
|
|
|
m_uploadService->start();
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-27 12:46:24 +02:00
|
|
|
void QnxDeployQtLibrariesDialog::updateProgress(const QString &progressMessage)
|
2014-02-10 14:16:55 +01:00
|
|
|
{
|
|
|
|
|
QTC_CHECK(m_state == Uploading);
|
|
|
|
|
|
2022-04-01 13:25:06 +10:00
|
|
|
const int progress = progressMessage.count("sftp> put") + progressMessage.count("sftp> ln -s");
|
2019-10-01 15:07:40 +02:00
|
|
|
if (progress != 0) {
|
|
|
|
|
m_progressCount += progress;
|
2022-07-11 12:29:52 +02:00
|
|
|
m_deployProgress->setValue(m_progressCount);
|
2019-10-01 15:07:40 +02:00
|
|
|
}
|
2014-02-10 14:16:55 +01:00
|
|
|
}
|
|
|
|
|
|
2014-05-27 12:46:24 +02:00
|
|
|
void QnxDeployQtLibrariesDialog::handleUploadFinished()
|
2014-02-10 14:16:55 +01:00
|
|
|
{
|
2022-07-11 12:29:52 +02:00
|
|
|
m_remoteDirectory->setEnabled(true);
|
|
|
|
|
m_deployButton->setEnabled(true);
|
|
|
|
|
m_qtLibraryCombo->setEnabled(true);
|
2014-02-10 14:16:55 +01:00
|
|
|
|
|
|
|
|
m_state = Inactive;
|
|
|
|
|
}
|
|
|
|
|
|
2016-03-15 09:26:34 +01:00
|
|
|
QList<DeployableFile> QnxDeployQtLibrariesDialog::gatherFiles()
|
2014-02-10 14:16:55 +01:00
|
|
|
{
|
2016-03-15 09:26:34 +01:00
|
|
|
QList<DeployableFile> result;
|
2014-02-10 14:16:55 +01:00
|
|
|
|
2022-07-11 12:29:52 +02:00
|
|
|
const int qtVersionId = m_qtLibraryCombo->itemData(m_qtLibraryCombo->currentIndex()).toInt();
|
2014-05-27 12:46:24 +02:00
|
|
|
|
2018-11-24 15:03:28 +01:00
|
|
|
auto qtVersion = dynamic_cast<const QnxQtVersion *>(QtVersionManager::version(qtVersionId));
|
2014-02-10 14:16:55 +01:00
|
|
|
|
|
|
|
|
QTC_ASSERT(qtVersion, return result);
|
|
|
|
|
|
2022-05-04 19:08:32 +02:00
|
|
|
if (HostOsInfo::isWindowsHost()) {
|
2019-09-30 14:34:31 +02:00
|
|
|
result.append(gatherFiles(qtVersion->libraryPath().toString(),
|
|
|
|
|
QString(),
|
|
|
|
|
QStringList() << QLatin1String("*.so.?")));
|
|
|
|
|
result.append(gatherFiles(qtVersion->libraryPath().toString() + QLatin1String("/fonts")));
|
2014-12-04 11:45:06 -02:00
|
|
|
} else {
|
2019-09-30 14:34:31 +02:00
|
|
|
result.append(gatherFiles(qtVersion->libraryPath().toString()));
|
2014-12-04 11:45:06 -02:00
|
|
|
}
|
|
|
|
|
|
2019-09-30 14:34:31 +02:00
|
|
|
result.append(gatherFiles(qtVersion->pluginPath().toString()));
|
|
|
|
|
result.append(gatherFiles(qtVersion->importsPath().toString()));
|
2017-09-27 16:10:13 +02:00
|
|
|
result.append(gatherFiles(qtVersion->qmlPath().toString()));
|
2014-02-10 14:16:55 +01:00
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2016-03-15 09:26:34 +01:00
|
|
|
QList<DeployableFile> QnxDeployQtLibrariesDialog::gatherFiles(
|
2014-12-04 11:45:06 -02:00
|
|
|
const QString &dirPath, const QString &baseDirPath, const QStringList &nameFilters)
|
2014-02-10 14:16:55 +01:00
|
|
|
{
|
2016-03-15 09:26:34 +01:00
|
|
|
QList<DeployableFile> result;
|
2014-02-13 10:46:14 +01:00
|
|
|
if (dirPath.isEmpty())
|
|
|
|
|
return result;
|
|
|
|
|
|
2019-06-21 13:51:56 +02:00
|
|
|
static const QStringList unusedDirs = {"include", "mkspecs", "cmake", "pkgconfig"};
|
|
|
|
|
const QString dp = dirPath.endsWith('/') ? dirPath.left(dirPath.size() - 1) : dirPath;
|
|
|
|
|
if (unusedDirs.contains(dp))
|
|
|
|
|
return result;
|
|
|
|
|
|
2022-05-04 19:08:32 +02:00
|
|
|
const QDir dir(dirPath);
|
2014-12-04 11:45:06 -02:00
|
|
|
QFileInfoList list = dir.entryInfoList(nameFilters,
|
|
|
|
|
QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot);
|
2014-02-10 14:16:55 +01:00
|
|
|
|
2018-11-24 15:03:28 +01:00
|
|
|
for (auto &fileInfo : list) {
|
2014-02-10 14:16:55 +01:00
|
|
|
if (fileInfo.isDir()) {
|
|
|
|
|
result.append(gatherFiles(fileInfo.absoluteFilePath(), baseDirPath.isEmpty() ?
|
|
|
|
|
dirPath : baseDirPath));
|
|
|
|
|
} else {
|
2019-06-21 13:51:56 +02:00
|
|
|
static const QStringList unusedSuffixes = {"cmake", "la", "prl", "a", "pc"};
|
|
|
|
|
if (unusedSuffixes.contains(fileInfo.suffix()))
|
|
|
|
|
continue;
|
|
|
|
|
|
2014-02-10 14:16:55 +01:00
|
|
|
QString remoteDir;
|
|
|
|
|
if (baseDirPath.isEmpty()) {
|
|
|
|
|
remoteDir = fullRemoteDirectory() + QLatin1Char('/') +
|
|
|
|
|
QFileInfo(dirPath).baseName();
|
|
|
|
|
} else {
|
|
|
|
|
QDir baseDir(baseDirPath);
|
|
|
|
|
baseDir.cdUp();
|
|
|
|
|
remoteDir = fullRemoteDirectory() + QLatin1Char('/') +
|
|
|
|
|
baseDir.relativeFilePath(dirPath);
|
|
|
|
|
}
|
2022-05-04 19:08:32 +02:00
|
|
|
result.append(DeployableFile(FilePath::fromString(fileInfo.absoluteFilePath()),
|
2021-09-13 12:55:01 +02:00
|
|
|
remoteDir));
|
2014-02-10 14:16:55 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-27 12:46:24 +02:00
|
|
|
QString QnxDeployQtLibrariesDialog::fullRemoteDirectory() const
|
2014-02-10 14:16:55 +01:00
|
|
|
{
|
2022-07-11 12:29:52 +02:00
|
|
|
return m_remoteDirectory->text();
|
2014-02-10 14:16:55 +01:00
|
|
|
}
|
|
|
|
|
|
2022-05-04 19:08:32 +02:00
|
|
|
void QnxDeployQtLibrariesDialog::startCheckDirProcess()
|
2014-02-10 14:16:55 +01:00
|
|
|
{
|
|
|
|
|
QTC_CHECK(m_state == Inactive);
|
|
|
|
|
m_state = CheckingRemoteDirectory;
|
2022-07-11 12:29:52 +02:00
|
|
|
m_deployLogWindow->appendPlainText(tr("Checking existence of \"%1\"")
|
2014-02-10 14:16:55 +01:00
|
|
|
.arg(fullRemoteDirectory()));
|
2022-05-10 15:33:33 +02:00
|
|
|
m_checkDirProcess.setCommand({m_device->filePath("test"),
|
2022-05-04 19:08:32 +02:00
|
|
|
{"-d", fullRemoteDirectory()}});
|
|
|
|
|
m_checkDirProcess.start();
|
2014-02-10 14:16:55 +01:00
|
|
|
}
|
|
|
|
|
|
2022-05-04 19:08:32 +02:00
|
|
|
void QnxDeployQtLibrariesDialog::startRemoveDirProcess()
|
2014-02-10 14:16:55 +01:00
|
|
|
{
|
|
|
|
|
QTC_CHECK(m_state == CheckingRemoteDirectory);
|
|
|
|
|
m_state = RemovingRemoteDirectory;
|
2022-07-11 12:29:52 +02:00
|
|
|
m_deployLogWindow->appendPlainText(tr("Removing \"%1\"").arg(fullRemoteDirectory()));
|
2022-05-10 15:33:33 +02:00
|
|
|
m_removeDirProcess.setCommand({m_device->filePath("rm"),
|
2022-05-04 19:08:32 +02:00
|
|
|
{"-rf", fullRemoteDirectory()}});
|
|
|
|
|
m_removeDirProcess.start();
|
2014-02-10 14:16:55 +01:00
|
|
|
}
|
2015-04-24 10:31:27 +02:00
|
|
|
|
2022-05-04 19:08:32 +02:00
|
|
|
void QnxDeployQtLibrariesDialog::handleCheckDirDone()
|
|
|
|
|
{
|
|
|
|
|
QTC_CHECK(m_state == CheckingRemoteDirectory);
|
|
|
|
|
if (handleError(m_checkDirProcess))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (m_checkDirProcess.exitCode() == 0) { // Directory exists
|
|
|
|
|
const int answer = QMessageBox::question(this, windowTitle(),
|
|
|
|
|
tr("The remote directory \"%1\" already exists.\n"
|
|
|
|
|
"Deploying to that directory will remove any files already present.\n\n"
|
|
|
|
|
"Are you sure you want to continue?").arg(fullRemoteDirectory()),
|
|
|
|
|
QMessageBox::Yes | QMessageBox::No);
|
|
|
|
|
if (answer == QMessageBox::Yes)
|
|
|
|
|
startRemoveDirProcess();
|
|
|
|
|
else
|
|
|
|
|
handleUploadFinished();
|
|
|
|
|
} else {
|
|
|
|
|
startUpload();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QnxDeployQtLibrariesDialog::handleRemoveDirDone()
|
|
|
|
|
{
|
|
|
|
|
QTC_CHECK(m_state == RemovingRemoteDirectory);
|
|
|
|
|
if (handleError(m_removeDirProcess))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
QTC_ASSERT(m_removeDirProcess.exitCode() == 0, return);
|
|
|
|
|
startUpload();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Returns true if the error appeared, false when finished with success
|
|
|
|
|
bool QnxDeployQtLibrariesDialog::handleError(const QtcProcess &process)
|
|
|
|
|
{
|
|
|
|
|
if (process.result() == ProcessResult::FinishedWithSuccess)
|
|
|
|
|
return false;
|
|
|
|
|
|
2022-07-11 12:29:52 +02:00
|
|
|
m_deployLogWindow->appendPlainText(tr("Connection failed: %1").arg(process.errorString()));
|
2022-05-04 19:08:32 +02:00
|
|
|
handleUploadFinished();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2015-04-24 10:31:27 +02:00
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Qnx
|