forked from qt-creator/qt-creator
ProjectExplorer: inline devicetestdialog.ui
Change-Id: I55ff1c6bc5f870268b8fd092a2e4472da49894c7 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -58,7 +58,7 @@ add_qtc_plugin(ProjectExplorer
|
||||
devicesupport/deviceprocesslist.cpp devicesupport/deviceprocesslist.h
|
||||
devicesupport/devicesettingspage.cpp devicesupport/devicesettingspage.h
|
||||
devicesupport/devicesettingswidget.cpp devicesupport/devicesettingswidget.h devicesupport/devicesettingswidget.ui
|
||||
devicesupport/devicetestdialog.cpp devicesupport/devicetestdialog.h devicesupport/devicetestdialog.ui
|
||||
devicesupport/devicetestdialog.cpp devicesupport/devicetestdialog.h
|
||||
devicesupport/deviceusedportsgatherer.cpp devicesupport/deviceusedportsgatherer.h
|
||||
devicesupport/filetransfer.cpp devicesupport/filetransfer.h
|
||||
devicesupport/filetransferinterface.h
|
||||
|
@@ -2,13 +2,15 @@
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "devicetestdialog.h"
|
||||
#include "ui_devicetestdialog.h"
|
||||
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/layoutbuilder.h>
|
||||
|
||||
#include <QBrush>
|
||||
#include <QColor>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QFont>
|
||||
#include <QPlainTextEdit>
|
||||
#include <QPushButton>
|
||||
#include <QTextCharFormat>
|
||||
|
||||
@@ -23,9 +25,10 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
Ui::DeviceTestDialog ui;
|
||||
DeviceTester * const deviceTester;
|
||||
bool finished;
|
||||
QPlainTextEdit *textEdit;
|
||||
QDialogButtonBox *buttonBox;
|
||||
};
|
||||
|
||||
DeviceTestDialog::DeviceTestDialog(const IDevice::Ptr &deviceConfiguration,
|
||||
@@ -33,9 +36,19 @@ DeviceTestDialog::DeviceTestDialog(const IDevice::Ptr &deviceConfiguration,
|
||||
: QDialog(parent)
|
||||
, d(std::make_unique<DeviceTestDialogPrivate>(deviceConfiguration->createDeviceTester()))
|
||||
{
|
||||
d->ui.setupUi(this);
|
||||
resize(620, 580);
|
||||
d->textEdit = new QPlainTextEdit;
|
||||
d->textEdit->setReadOnly(true);
|
||||
d->buttonBox = new QDialogButtonBox(QDialogButtonBox::Cancel);
|
||||
|
||||
using namespace Utils::Layouting;
|
||||
Column {
|
||||
d->textEdit,
|
||||
d->buttonBox,
|
||||
}.attachTo(this);
|
||||
|
||||
d->deviceTester->setParent(this);
|
||||
connect(d->buttonBox, &QDialogButtonBox::rejected, this, &DeviceTestDialog::reject);
|
||||
connect(d->deviceTester, &DeviceTester::progressMessage,
|
||||
this, &DeviceTestDialog::handleProgressMessage);
|
||||
connect(d->deviceTester, &DeviceTester::errorMessage,
|
||||
@@ -69,7 +82,7 @@ void DeviceTestDialog::handleErrorMessage(const QString &message)
|
||||
void DeviceTestDialog::handleTestFinished(DeviceTester::TestResult result)
|
||||
{
|
||||
d->finished = true;
|
||||
d->ui.buttonBox->button(QDialogButtonBox::Cancel)->setText(tr("Close"));
|
||||
d->buttonBox->button(QDialogButtonBox::Cancel)->setText(tr("Close"));
|
||||
|
||||
if (result == DeviceTester::TestSuccess)
|
||||
addText(tr("Device test finished successfully."),
|
||||
@@ -82,13 +95,13 @@ void DeviceTestDialog::addText(const QString &text, Utils::Theme::Color color, b
|
||||
{
|
||||
Utils::Theme *theme = Utils::creatorTheme();
|
||||
|
||||
QTextCharFormat format = d->ui.textEdit->currentCharFormat();
|
||||
QTextCharFormat format = d->textEdit->currentCharFormat();
|
||||
format.setForeground(QBrush(theme->color(color)));
|
||||
QFont font = format.font();
|
||||
font.setBold(bold);
|
||||
format.setFont(font);
|
||||
d->ui.textEdit->setCurrentCharFormat(format);
|
||||
d->ui.textEdit->appendPlainText(text);
|
||||
d->textEdit->setCurrentCharFormat(format);
|
||||
d->textEdit->appendPlainText(text);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -1,71 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ProjectExplorer::Internal::DeviceTestDialog</class>
|
||||
<widget class="QDialog" name="ProjectExplorer::Internal::DeviceTestDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>607</width>
|
||||
<height>580</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Device Test</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QPlainTextEdit" name="textEdit">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>ProjectExplorer::Internal::DeviceTestDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>ProjectExplorer::Internal::DeviceTestDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
@@ -218,7 +218,7 @@ Project {
|
||||
"deviceprocesslist.cpp", "deviceprocesslist.h",
|
||||
"devicesettingspage.cpp", "devicesettingspage.h",
|
||||
"devicesettingswidget.cpp", "devicesettingswidget.h", "devicesettingswidget.ui",
|
||||
"devicetestdialog.cpp", "devicetestdialog.h", "devicetestdialog.ui",
|
||||
"devicetestdialog.cpp", "devicetestdialog.h",
|
||||
"deviceusedportsgatherer.cpp", "deviceusedportsgatherer.h",
|
||||
"filetransfer.cpp", "filetransfer.h",
|
||||
"filetransferinterface.h",
|
||||
|
Reference in New Issue
Block a user