forked from qt-creator/qt-creator
Use Utils::FutureSynchronizer instead of QFutureSynchronizer
Change-Id: Iecfa676f58e5ca82be7c9c94233dcc8d3654c2d7 Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
@@ -62,14 +62,14 @@ CreateSimulatorDialog::CreateSimulatorDialog(QWidget *parent) :
|
||||
});
|
||||
|
||||
m_futureSync.setCancelOnWait(true);
|
||||
m_futureSync.addFuture(QFuture<void>(Utils::onResultReady(SimulatorControl::updateDeviceTypes(), this,
|
||||
&CreateSimulatorDialog::populateDeviceTypes)));
|
||||
m_futureSync.addFuture(Utils::onResultReady(SimulatorControl::updateDeviceTypes(), this,
|
||||
&CreateSimulatorDialog::populateDeviceTypes));
|
||||
|
||||
QFuture<QList<RuntimeInfo>> runtimesfuture = SimulatorControl::updateRuntimes();
|
||||
Utils::onResultReady(runtimesfuture, this, [this](const QList<RuntimeInfo> &runtimes) {
|
||||
m_runtimes = runtimes;
|
||||
});
|
||||
m_futureSync.addFuture(QFuture<void>(runtimesfuture));
|
||||
m_futureSync.addFuture(runtimesfuture);
|
||||
populateRuntimes(DeviceTypeInfo());
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,8 @@
|
||||
#pragma once
|
||||
|
||||
#include <QDialog>
|
||||
#include <QFutureSynchronizer>
|
||||
|
||||
#include <utils/futuresynchronizer.h>
|
||||
|
||||
namespace Ios {
|
||||
namespace Internal {
|
||||
@@ -57,7 +58,7 @@ private:
|
||||
void populateRuntimes(const DeviceTypeInfo &deviceType);
|
||||
|
||||
private:
|
||||
QFutureSynchronizer<void> m_futureSync;
|
||||
Utils::FutureSynchronizer m_futureSync;
|
||||
Ui::CreateSimulatorDialog *m_ui = nullptr;
|
||||
SimulatorControl *m_simControl = nullptr;
|
||||
QList<RuntimeInfo> m_runtimes;
|
||||
|
||||
@@ -126,13 +126,12 @@ QModelIndex SimulatorInfoModel::parent(const QModelIndex &) const
|
||||
|
||||
void SimulatorInfoModel::requestSimulatorInfo()
|
||||
{
|
||||
if (!m_fetchFuture.futures().isEmpty() && !m_fetchFuture.futures().at(0).isFinished())
|
||||
m_fetchFuture.flushFinishedFutures();
|
||||
if (!m_fetchFuture.isEmpty())
|
||||
return; // Ignore the request if the last request is still pending.
|
||||
|
||||
m_fetchFuture.clearFutures();
|
||||
m_fetchFuture.addFuture(QFuture<void>(Utils::onResultReady(
|
||||
SimulatorControl::updateAvailableSimulators(),
|
||||
this, &SimulatorInfoModel::populateSimulators)));
|
||||
m_fetchFuture.addFuture(Utils::onResultReady(SimulatorControl::updateAvailableSimulators(),
|
||||
this, &SimulatorInfoModel::populateSimulators));
|
||||
}
|
||||
|
||||
void SimulatorInfoModel::populateSimulators(const SimulatorInfoList &simulatorList)
|
||||
|
||||
@@ -27,8 +27,10 @@
|
||||
|
||||
#include "simulatorcontrol.h"
|
||||
|
||||
#include <utils/futuresynchronizer.h>
|
||||
|
||||
#include <QAbstractListModel>
|
||||
#include <QFutureSynchronizer>
|
||||
|
||||
|
||||
namespace Ios {
|
||||
namespace Internal {
|
||||
@@ -55,7 +57,7 @@ private:
|
||||
void populateSimulators(const SimulatorInfoList &simulatorList);
|
||||
|
||||
private:
|
||||
QFutureSynchronizer<void> m_fetchFuture;
|
||||
Utils::FutureSynchronizer m_fetchFuture;
|
||||
SimulatorInfoList m_simList;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user