iOS: Inline simulatoroperationdialog.ui

Change-Id: I6b1e770a3882b156ea9061c7f2b370258a06a573
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
hjk
2022-07-25 09:03:38 +02:00
parent a663473f8f
commit ffd0558773
5 changed files with 46 additions and 110 deletions

View File

@@ -22,7 +22,7 @@ add_qtc_plugin(Ios
iostoolhandler.cpp iostoolhandler.h
simulatorcontrol.cpp simulatorcontrol.h
simulatorinfomodel.cpp simulatorinfomodel.h
simulatoroperationdialog.cpp simulatoroperationdialog.h simulatoroperationdialog.ui
simulatoroperationdialog.cpp simulatoroperationdialog.h
)
extend_qtc_plugin(Ios

View File

@@ -57,6 +57,5 @@ QtcPlugin {
"simulatorinfomodel.h",
"simulatoroperationdialog.cpp",
"simulatoroperationdialog.h",
"simulatoroperationdialog.ui"
]
}

View File

@@ -24,31 +24,55 @@
****************************************************************************/
#include "simulatoroperationdialog.h"
#include "ui_simulatoroperationdialog.h"
#include <utils/layoutbuilder.h>
#include <utils/outputformatter.h>
#include <utils/qtcassert.h>
#include <QApplication>
#include <QDialogButtonBox>
#include <QFutureWatcher>
#include <QLoggingCategory>
#include <QPlainTextEdit>
#include <QProgressBar>
#include <QPushButton>
namespace {
Q_LOGGING_CATEGORY(iosCommon, "qtc.ios.common", QtWarningMsg)
}
namespace Ios {
namespace Internal {
namespace Ios::Internal {
SimulatorOperationDialog::SimulatorOperationDialog(QWidget *parent) :
// TODO: Maximize buttong only because of QTBUG-41932
QDialog(parent,Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowMaximizeButtonHint),
m_ui(new Ui::SimulatorOperationDialog)
QDialog(parent,Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowMaximizeButtonHint)
{
m_ui->setupUi(this);
resize(580, 320);
setModal(true);
setWindowTitle(tr("Simulator Operation Status"));
auto messageEdit = new QPlainTextEdit;
messageEdit->setReadOnly(true);
m_progressBar = new QProgressBar;
m_progressBar->setMaximum(0);
m_progressBar->setValue(-1);
m_buttonBox = new QDialogButtonBox(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
m_formatter = new Utils::OutputFormatter;
m_formatter->setPlainTextEdit(m_ui->messageEdit);
m_formatter->setPlainTextEdit(messageEdit);
using namespace Utils::Layouting;
Column {
messageEdit,
m_progressBar,
m_buttonBox
}.attachTo(this);
connect(m_buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
connect(m_buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
}
SimulatorOperationDialog::~SimulatorOperationDialog()
@@ -68,7 +92,6 @@ SimulatorOperationDialog::~SimulatorOperationDialog()
}
delete m_formatter;
delete m_ui;
}
void SimulatorOperationDialog::addFutures(const QList<QFuture<void> > &futureList)
@@ -114,13 +137,12 @@ void SimulatorOperationDialog::addMessage(const SimulatorInfo &siminfo,
void SimulatorOperationDialog::updateInputs()
{
bool enableOk = m_futureWatchList.isEmpty();
m_ui->buttonBox->button(QDialogButtonBox::Cancel)->setEnabled(!enableOk);
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(enableOk);
m_buttonBox->button(QDialogButtonBox::Cancel)->setEnabled(!enableOk);
m_buttonBox->button(QDialogButtonBox::Ok)->setEnabled(enableOk);
if (enableOk) {
addMessage(tr("Done."), Utils::NormalMessageFormat);
m_ui->progressBar->setMaximum(1); // Stop progress bar.
m_progressBar->setMaximum(1); // Stop progress bar.
}
}
} // namespace Internal
} // namespace Ios
} // Ios::Internal

View File

@@ -33,12 +33,14 @@
#include <QFuture>
#include <QList>
QT_BEGIN_NAMESPACE
class QDialogButtonBox;
class QProgressBar;
QT_END_NAMESPACE
namespace Utils { class OutputFormatter; }
namespace Ios {
namespace Internal {
namespace Ui { class SimulatorOperationDialog; }
namespace Ios::Internal {
class SimulatorOperationDialog : public QDialog
{
@@ -56,11 +58,11 @@ public:
private:
void updateInputs();
private:
Ui::SimulatorOperationDialog *m_ui = nullptr;
Utils::OutputFormatter *m_formatter = nullptr;
QList<QFutureWatcher<void> *> m_futureWatchList;
QProgressBar *m_progressBar;
QDialogButtonBox *m_buttonBox;
};
} // namespace Internal
} // namespace Ios
} // Ios::Internal

View File

@@ -1,87 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Ios::Internal::SimulatorOperationDialog</class>
<widget class="QDialog" name="Ios::Internal::SimulatorOperationDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>580</width>
<height>320</height>
</rect>
</property>
<property name="windowTitle">
<string>Simulator Operation Status</string>
</property>
<property name="modal">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QPlainTextEdit" name="messageEdit">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QProgressBar" name="progressBar">
<property name="maximum">
<number>0</number>
</property>
<property name="value">
<number>-1</number>
</property>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="enabled">
<bool>true</bool>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>Ios::Internal::SimulatorOperationDialog</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>Ios::Internal::SimulatorOperationDialog</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>