forked from qt-creator/qt-creator
DeviceCheckBuildStep: Employ task tree for running
Task-number: QTCREATORBUG-29168 Change-Id: I3506663263d8ebdc922bd6ac1b11357f4a6dba8f Reviewed-by: hjk <hjk@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -8,9 +8,10 @@
|
||||
#include "../projectexplorertr.h"
|
||||
|
||||
#include "devicemanager.h"
|
||||
#include "idevice.h"
|
||||
#include "idevicefactory.h"
|
||||
|
||||
#include <solutions/tasking/tasktree.h>
|
||||
|
||||
#include <QMessageBox>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
@@ -26,12 +27,17 @@ public:
|
||||
|
||||
bool init() override
|
||||
{
|
||||
if (!BuildStep::init())
|
||||
return false;
|
||||
|
||||
IDevice::ConstPtr device = DeviceKitAspect::device(kit());
|
||||
if (!device) {
|
||||
if (device)
|
||||
return true;
|
||||
|
||||
Utils::Id deviceTypeId = DeviceTypeKitAspect::deviceTypeId(kit());
|
||||
IDeviceFactory *factory = IDeviceFactory::find(deviceTypeId);
|
||||
if (!factory || !factory->canCreate()) {
|
||||
emit addOutput(Tr::tr("No device configured."), BuildStep::OutputFormat::ErrorMessage);
|
||||
emit addOutput(Tr::tr("No device configured."), OutputFormat::ErrorMessage);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -40,26 +46,24 @@ public:
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
msgBox.setDefaultButton(QMessageBox::Yes);
|
||||
if (msgBox.exec() == QMessageBox::No) {
|
||||
emit addOutput(Tr::tr("No device configured."), BuildStep::OutputFormat::ErrorMessage);
|
||||
emit addOutput(Tr::tr("No device configured."), OutputFormat::ErrorMessage);
|
||||
return false;
|
||||
}
|
||||
|
||||
IDevice::Ptr newDevice = factory->create();
|
||||
if (newDevice.isNull()) {
|
||||
emit addOutput(Tr::tr("No device configured."), BuildStep::OutputFormat::ErrorMessage);
|
||||
emit addOutput(Tr::tr("No device configured."), OutputFormat::ErrorMessage);
|
||||
return false;
|
||||
}
|
||||
|
||||
DeviceManager *dm = DeviceManager::instance();
|
||||
dm->addDevice(newDevice);
|
||||
|
||||
DeviceKitAspect::setDevice(kit(), newDevice);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void doRun() override { emit finished(true); }
|
||||
private:
|
||||
Tasking::GroupItem runRecipe() final { return Tasking::Group{}; }
|
||||
};
|
||||
|
||||
// Factory
|
||||
|
Reference in New Issue
Block a user