diff --git a/src/plugins/qnx/CMakeLists.txt b/src/plugins/qnx/CMakeLists.txt index 0cd7aa08718..aca75bc578f 100644 --- a/src/plugins/qnx/CMakeLists.txt +++ b/src/plugins/qnx/CMakeLists.txt @@ -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 diff --git a/src/plugins/qnx/qnx.qbs b/src/plugins/qnx/qnx.qbs index 664a54367e3..acad1ef2ccc 100644 --- a/src/plugins/qnx/qnx.qbs +++ b/src/plugins/qnx/qnx.qbs @@ -16,7 +16,6 @@ QtcPlugin { files: [ "qnxdeployqtlibrariesdialog.cpp", "qnxdeployqtlibrariesdialog.h", - "qnxdeployqtlibrariesdialog.ui", "qnxtoolchain.cpp", "qnxtoolchain.h", "qnx.qrc", diff --git a/src/plugins/qnx/qnxdeployqtlibrariesdialog.cpp b/src/plugins/qnx/qnxdeployqtlibrariesdialog.cpp index 3fa29a35a66..e60bcc5cc54 100644 --- a/src/plugins/qnx/qnxdeployqtlibrariesdialog.cpp +++ b/src/plugins/qnx/qnxdeployqtlibrariesdialog.cpp @@ -24,7 +24,6 @@ ****************************************************************************/ #include "qnxdeployqtlibrariesdialog.h" -#include "ui_qnxdeployqtlibrariesdialog.h" #include "qnxconstants.h" #include "qnxqtversion.h" @@ -37,8 +36,20 @@ #include #include +#include +#include #include +#include +#include +#include +#include #include +#include +#include +#include +#include +#include +#include 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 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 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 QnxDeployQtLibrariesDialog::gatherFiles() { QList 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(QtVersionManager::version(qtVersionId)); @@ -253,14 +295,14 @@ QList 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 diff --git a/src/plugins/qnx/qnxdeployqtlibrariesdialog.h b/src/plugins/qnx/qnxdeployqtlibrariesdialog.h index 56f8c3ce154..6af0507120c 100644 --- a/src/plugins/qnx/qnxdeployqtlibrariesdialog.h +++ b/src/plugins/qnx/qnxdeployqtlibrariesdialog.h @@ -30,14 +30,20 @@ #include #include +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; diff --git a/src/plugins/qnx/qnxdeployqtlibrariesdialog.ui b/src/plugins/qnx/qnxdeployqtlibrariesdialog.ui deleted file mode 100644 index 5b2e0f9b76c..00000000000 --- a/src/plugins/qnx/qnxdeployqtlibrariesdialog.ui +++ /dev/null @@ -1,124 +0,0 @@ - - - Qnx::Internal::QnxDeployQtLibrariesDialog - - - - 0 - 0 - 520 - 479 - - - - Deploy Qt to QNX Device - - - - - - - - Qt library to deploy: - - - - - - - - - - - - - 0 - 0 - - - - Deploy - - - - - - - - - Remote directory: - - - - - - - 0 - - - - - - - - - - - - - - - - - - - - - - - 0 - - - true - - - - - - - - - - - - Qt::Horizontal - - - - 218 - 20 - - - - - - - - Close - - - - - - - - - qtLibraryCombo - deployButton - remoteDirectory - deployLogWindow - closeButton - - - -