io.qt.core.QFutureSynchronizer Maven / Gradle / Ivy
The newest version!
package io.qt.core;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* Convenience class that simplifies QFuture synchronization
* Java wrapper for Qt class QFutureSynchronizer
*/
public final class QFutureSynchronizer
{
static {
QtJambi_LibraryUtilities.initialize();
}
/**
*
*/
public QFutureSynchronizer(){
super();
}
/**
*
*/
public QFutureSynchronizer(QFuture future){
super();
addFuture(future);
}
/**
*
*/
@io.qt.QtUninvokable
public final void addFuture(QFuture future){
m_futures.add(future);
}
/**
*
*/
@io.qt.QtUninvokable
public final boolean cancelOnWait(){
return m_cancelOnWait;
}
/**
*
*/
@io.qt.QtUninvokable
public final void clearFutures(){
m_futures.clear();
}
/**
*
*/
@io.qt.QtUninvokable
public final void setCancelOnWait(boolean enabled){
this.m_cancelOnWait = enabled;
}
/**
*
*/
@io.qt.QtUninvokable
public final void setFuture(QFuture future){
waitForFinished();
m_futures.clear();
addFuture(future);
}
/**
*
*/
@io.qt.QtUninvokable
public final void waitForFinished(){
if (m_cancelOnWait) {
for (int i = 0; i < m_futures.size(); ++i) {
m_futures.get(i).cancel();
}
}
for (int i = 0; i < m_futures.size(); ++i) {
m_futures.get(i).waitForFinished();
}
}
/**
* See QFutureSynchronizer::futures() const
*/
@io.qt.QtUninvokable
public final List> futures() {
return Collections.unmodifiableList(m_futures);
}
private final List> m_futures = new ArrayList<>();
private boolean m_cancelOnWait;
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy