forked from qt-creator/qt-creator
Qnx: Inline QnxDeployQtLibrariesDialog
Change-Id: Ia3b31ab630affc2069831ed377bc8c1bb19aa410 Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -9,7 +9,7 @@ add_qtc_plugin(Qnx
|
||||
qnxconfigurationmanager.cpp qnxconfigurationmanager.h
|
||||
qnxconstants.h
|
||||
qnxdebugsupport.cpp qnxdebugsupport.h
|
||||
qnxdeployqtlibrariesdialog.cpp qnxdeployqtlibrariesdialog.h qnxdeployqtlibrariesdialog.ui
|
||||
qnxdeployqtlibrariesdialog.cpp qnxdeployqtlibrariesdialog.h
|
||||
qnxdevice.cpp qnxdevice.h
|
||||
qnxdeviceprocesslist.cpp qnxdeviceprocesslist.h
|
||||
qnxdeviceprocesssignaloperation.cpp qnxdeviceprocesssignaloperation.h
|
||||
|
||||
@@ -16,7 +16,6 @@ QtcPlugin {
|
||||
files: [
|
||||
"qnxdeployqtlibrariesdialog.cpp",
|
||||
"qnxdeployqtlibrariesdialog.h",
|
||||
"qnxdeployqtlibrariesdialog.ui",
|
||||
"qnxtoolchain.cpp",
|
||||
"qnxtoolchain.h",
|
||||
"qnx.qrc",
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "qnxdeployqtlibrariesdialog.h"
|
||||
#include "ui_qnxdeployqtlibrariesdialog.h"
|
||||
|
||||
#include "qnxconstants.h"
|
||||
#include "qnxqtversion.h"
|
||||
@@ -37,8 +36,20 @@
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QDialog>
|
||||
#include <QDir>
|
||||
#include <QFormLayout>
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QMessageBox>
|
||||
#include <QPlainTextEdit>
|
||||
#include <QProgressBar>
|
||||
#include <QPushButton>
|
||||
#include <QSpacerItem>
|
||||
#include <QVBoxLayout>
|
||||
#include <QVariant>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
using namespace QtSupport;
|
||||
@@ -51,38 +62,74 @@ namespace Internal {
|
||||
QnxDeployQtLibrariesDialog::QnxDeployQtLibrariesDialog(const IDevice::ConstPtr &device,
|
||||
QWidget *parent)
|
||||
: QDialog(parent)
|
||||
, m_ui(new Ui::QnxDeployQtLibrariesDialog)
|
||||
, m_device(device)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
setWindowTitle(tr("Deploy Qt to QNX Device"));
|
||||
|
||||
m_qtLibraryCombo = new QComboBox(this);
|
||||
const QList<QtVersion*> qtVersions = QtVersionManager::sortVersions(
|
||||
QtVersionManager::versions(QtVersion::isValidPredicate(
|
||||
equal(&QtVersion::type, QString::fromLatin1(Constants::QNX_QNX_QT)))));
|
||||
for (QtVersion *v : qtVersions)
|
||||
m_ui->qtLibraryCombo->addItem(v->displayName(), v->uniqueId());
|
||||
m_qtLibraryCombo->addItem(v->displayName(), v->uniqueId());
|
||||
|
||||
m_ui->basePathLabel->setText(QString());
|
||||
m_ui->remoteDirectory->setText(QLatin1String("/qt"));
|
||||
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);
|
||||
|
||||
m_uploadService = new GenericDirectUploadService(this);
|
||||
m_uploadService->setDevice(m_device);
|
||||
|
||||
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);
|
||||
|
||||
connect(m_uploadService, &AbstractRemoteLinuxDeployService::progressMessage,
|
||||
this, &QnxDeployQtLibrariesDialog::updateProgress);
|
||||
connect(m_uploadService, &AbstractRemoteLinuxDeployService::progressMessage,
|
||||
m_ui->deployLogWindow, &QPlainTextEdit::appendPlainText);
|
||||
m_deployLogWindow, &QPlainTextEdit::appendPlainText);
|
||||
connect(m_uploadService, &AbstractRemoteLinuxDeployService::errorMessage,
|
||||
m_ui->deployLogWindow, &QPlainTextEdit::appendPlainText);
|
||||
m_deployLogWindow, &QPlainTextEdit::appendPlainText);
|
||||
connect(m_uploadService, &AbstractRemoteLinuxDeployService::warningMessage,
|
||||
this, [this](const QString &message) {
|
||||
if (!message.contains("stat:"))
|
||||
m_ui->deployLogWindow->appendPlainText(message);
|
||||
m_deployLogWindow->appendPlainText(message);
|
||||
});
|
||||
connect(m_uploadService, &AbstractRemoteLinuxDeployService::stdOutData,
|
||||
m_ui->deployLogWindow, &QPlainTextEdit::appendPlainText);
|
||||
m_deployLogWindow, &QPlainTextEdit::appendPlainText);
|
||||
connect(m_uploadService, &AbstractRemoteLinuxDeployService::stdErrData,
|
||||
m_ui->deployLogWindow, &QPlainTextEdit::appendPlainText);
|
||||
m_deployLogWindow, &QPlainTextEdit::appendPlainText);
|
||||
connect(m_uploadService, &AbstractRemoteLinuxDeployService::finished,
|
||||
this, &QnxDeployQtLibrariesDialog::handleUploadFinished);
|
||||
|
||||
@@ -91,21 +138,18 @@ QnxDeployQtLibrariesDialog::QnxDeployQtLibrariesDialog(const IDevice::ConstPtr &
|
||||
connect(&m_removeDirProcess, &QtcProcess::done,
|
||||
this, &QnxDeployQtLibrariesDialog::handleRemoveDirDone);
|
||||
|
||||
connect(m_ui->deployButton, &QAbstractButton::clicked,
|
||||
connect(m_deployButton, &QAbstractButton::clicked,
|
||||
this, &QnxDeployQtLibrariesDialog::deployLibraries);
|
||||
connect(m_ui->closeButton, &QAbstractButton::clicked,
|
||||
connect(m_closeButton, &QAbstractButton::clicked,
|
||||
this, &QWidget::close);
|
||||
}
|
||||
|
||||
QnxDeployQtLibrariesDialog::~QnxDeployQtLibrariesDialog()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
QnxDeployQtLibrariesDialog::~QnxDeployQtLibrariesDialog() = default;
|
||||
|
||||
int QnxDeployQtLibrariesDialog::execAndDeploy(int qtVersionId, const QString &remoteDirectory)
|
||||
{
|
||||
m_ui->remoteDirectory->setText(remoteDirectory);
|
||||
m_ui->qtLibraryCombo->setCurrentIndex(m_ui->qtLibraryCombo->findData(qtVersionId));
|
||||
m_remoteDirectory->setText(remoteDirectory);
|
||||
m_qtLibraryCombo->setCurrentIndex(m_qtLibraryCombo->findData(qtVersionId));
|
||||
|
||||
deployLibraries();
|
||||
return exec();
|
||||
@@ -114,7 +158,7 @@ int QnxDeployQtLibrariesDialog::execAndDeploy(int qtVersionId, const QString &re
|
||||
void QnxDeployQtLibrariesDialog::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
// A disabled Deploy button indicates the upload is still running
|
||||
if (!m_ui->deployButton->isEnabled()) {
|
||||
if (!m_deployButton->isEnabled()) {
|
||||
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);
|
||||
@@ -129,7 +173,7 @@ void QnxDeployQtLibrariesDialog::deployLibraries()
|
||||
{
|
||||
QTC_ASSERT(m_state == Inactive, return);
|
||||
|
||||
if (m_ui->remoteDirectory->text().isEmpty()) {
|
||||
if (m_remoteDirectory->text().isEmpty()) {
|
||||
QMessageBox::warning(this, windowTitle(),
|
||||
tr("Please input a remote directory to deploy to."));
|
||||
return;
|
||||
@@ -138,11 +182,11 @@ void QnxDeployQtLibrariesDialog::deployLibraries()
|
||||
QTC_ASSERT(!m_device.isNull(), return);
|
||||
|
||||
m_progressCount = 0;
|
||||
m_ui->deployProgress->setValue(0);
|
||||
m_ui->remoteDirectory->setEnabled(false);
|
||||
m_ui->deployButton->setEnabled(false);
|
||||
m_ui->qtLibraryCombo->setEnabled(false);
|
||||
m_ui->deployLogWindow->clear();
|
||||
m_deployProgress->setValue(0);
|
||||
m_remoteDirectory->setEnabled(false);
|
||||
m_deployButton->setEnabled(false);
|
||||
m_qtLibraryCombo->setEnabled(false);
|
||||
m_deployLogWindow->clear();
|
||||
|
||||
startCheckDirProcess();
|
||||
}
|
||||
@@ -155,7 +199,7 @@ void QnxDeployQtLibrariesDialog::startUpload()
|
||||
|
||||
QList<DeployableFile> filesToUpload = gatherFiles();
|
||||
|
||||
m_ui->deployProgress->setRange(0, filesToUpload.count());
|
||||
m_deployProgress->setRange(0, filesToUpload.count());
|
||||
|
||||
m_uploadService->setDeployableFiles(filesToUpload);
|
||||
m_uploadService->start();
|
||||
@@ -168,15 +212,15 @@ void QnxDeployQtLibrariesDialog::updateProgress(const QString &progressMessage)
|
||||
const int progress = progressMessage.count("sftp> put") + progressMessage.count("sftp> ln -s");
|
||||
if (progress != 0) {
|
||||
m_progressCount += progress;
|
||||
m_ui->deployProgress->setValue(m_progressCount);
|
||||
m_deployProgress->setValue(m_progressCount);
|
||||
}
|
||||
}
|
||||
|
||||
void QnxDeployQtLibrariesDialog::handleUploadFinished()
|
||||
{
|
||||
m_ui->remoteDirectory->setEnabled(true);
|
||||
m_ui->deployButton->setEnabled(true);
|
||||
m_ui->qtLibraryCombo->setEnabled(true);
|
||||
m_remoteDirectory->setEnabled(true);
|
||||
m_deployButton->setEnabled(true);
|
||||
m_qtLibraryCombo->setEnabled(true);
|
||||
|
||||
m_state = Inactive;
|
||||
}
|
||||
@@ -185,9 +229,7 @@ QList<DeployableFile> QnxDeployQtLibrariesDialog::gatherFiles()
|
||||
{
|
||||
QList<DeployableFile> result;
|
||||
|
||||
const int qtVersionId =
|
||||
m_ui->qtLibraryCombo->itemData(m_ui->qtLibraryCombo->currentIndex()).toInt();
|
||||
|
||||
const int qtVersionId = m_qtLibraryCombo->itemData(m_qtLibraryCombo->currentIndex()).toInt();
|
||||
|
||||
auto qtVersion = dynamic_cast<const QnxQtVersion *>(QtVersionManager::version(qtVersionId));
|
||||
|
||||
@@ -253,14 +295,14 @@ QList<DeployableFile> QnxDeployQtLibrariesDialog::gatherFiles(
|
||||
|
||||
QString QnxDeployQtLibrariesDialog::fullRemoteDirectory() const
|
||||
{
|
||||
return m_ui->remoteDirectory->text();
|
||||
return m_remoteDirectory->text();
|
||||
}
|
||||
|
||||
void QnxDeployQtLibrariesDialog::startCheckDirProcess()
|
||||
{
|
||||
QTC_CHECK(m_state == Inactive);
|
||||
m_state = CheckingRemoteDirectory;
|
||||
m_ui->deployLogWindow->appendPlainText(tr("Checking existence of \"%1\"")
|
||||
m_deployLogWindow->appendPlainText(tr("Checking existence of \"%1\"")
|
||||
.arg(fullRemoteDirectory()));
|
||||
m_checkDirProcess.setCommand({m_device->filePath("test"),
|
||||
{"-d", fullRemoteDirectory()}});
|
||||
@@ -271,7 +313,7 @@ void QnxDeployQtLibrariesDialog::startRemoveDirProcess()
|
||||
{
|
||||
QTC_CHECK(m_state == CheckingRemoteDirectory);
|
||||
m_state = RemovingRemoteDirectory;
|
||||
m_ui->deployLogWindow->appendPlainText(tr("Removing \"%1\"").arg(fullRemoteDirectory()));
|
||||
m_deployLogWindow->appendPlainText(tr("Removing \"%1\"").arg(fullRemoteDirectory()));
|
||||
m_removeDirProcess.setCommand({m_device->filePath("rm"),
|
||||
{"-rf", fullRemoteDirectory()}});
|
||||
m_removeDirProcess.start();
|
||||
@@ -314,11 +356,10 @@ bool QnxDeployQtLibrariesDialog::handleError(const QtcProcess &process)
|
||||
if (process.result() == ProcessResult::FinishedWithSuccess)
|
||||
return false;
|
||||
|
||||
m_ui->deployLogWindow->appendPlainText(tr("Connection failed: %1").arg(process.errorString()));
|
||||
m_deployLogWindow->appendPlainText(tr("Connection failed: %1").arg(process.errorString()));
|
||||
handleUploadFinished();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Qnx
|
||||
|
||||
@@ -30,14 +30,20 @@
|
||||
#include <projectexplorer/devicesupport/idevicefwd.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QComboBox;
|
||||
class QLabel;
|
||||
class QLineEdit;
|
||||
class QPlainTextEdit;
|
||||
class QProgressBar;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace ProjectExplorer { class DeployableFile; }
|
||||
namespace RemoteLinux { class GenericDirectUploadService; }
|
||||
|
||||
namespace Qnx {
|
||||
namespace Internal {
|
||||
|
||||
namespace Ui { class QnxDeployQtLibrariesDialog; }
|
||||
|
||||
class QnxDeployQtLibrariesDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -79,7 +85,13 @@ private:
|
||||
QString fullRemoteDirectory() const;
|
||||
void startUpload();
|
||||
|
||||
Ui::QnxDeployQtLibrariesDialog *m_ui;
|
||||
QComboBox *m_qtLibraryCombo;
|
||||
QPushButton *m_deployButton;
|
||||
QLabel *m_basePathLabel;
|
||||
QLineEdit *m_remoteDirectory;
|
||||
QProgressBar *m_deployProgress;
|
||||
QPlainTextEdit *m_deployLogWindow;
|
||||
QPushButton *m_closeButton;
|
||||
|
||||
Utils::QtcProcess m_checkDirProcess;
|
||||
Utils::QtcProcess m_removeDirProcess;
|
||||
|
||||
@@ -1,124 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Qnx::Internal::QnxDeployQtLibrariesDialog</class>
|
||||
<widget class="QDialog" name="Qnx::Internal::QnxDeployQtLibrariesDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>520</width>
|
||||
<height>479</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Deploy Qt to QNX Device</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Qt library to deploy:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QComboBox" name="qtLibraryCombo"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="deployButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Deploy</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Remote directory:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="basePathLabel">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="remoteDirectory">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QProgressBar" name="deployProgress">
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="textVisible">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPlainTextEdit" name="deployLogWindow"/>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>218</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="closeButton">
|
||||
<property name="text">
|
||||
<string>Close</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>qtLibraryCombo</tabstop>
|
||||
<tabstop>deployButton</tabstop>
|
||||
<tabstop>remoteDirectory</tabstop>
|
||||
<tabstop>deployLogWindow</tabstop>
|
||||
<tabstop>closeButton</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
Reference in New Issue
Block a user