Skip to content

Commit

Permalink
Add "QuickFuture 1.0" package name
Browse files Browse the repository at this point in the history
  • Loading branch information
benlau committed Apr 19, 2017
1 parent ef451a2 commit 95d872a
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 8 deletions.
31 changes: 30 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ QuickFuture is a QML wrapper of QFuture. It allows user to access and listen fro
**Example**

```
import Future 1.0
import QuickFuture 1.0
...
Expand Down Expand Up @@ -85,10 +85,39 @@ API

Returns true if the asynchronous computation represented by this future has finished; otherwise returns false.

**Future.isRunning(future)**

**Future.isCanceled(future)**

**Future.onFinished(future, callback)**

The callback will be invoked when the watched future finishes.

**Future.onCanceled(future, callback)**

**Future.promise(future)**

Create a promise object which will be resolved when the future has finished. It must have QuickPromise installed and setup properly before using this function.

**Future.result(future)**

Object the result of a Future object.

**Future.sync(future, propertyAtFuture, target, propertyAtTarget)**

Synchronize a property in future object to target object.

Example:
```
QtObject {
id: target1
property var isRunning
property var isFinished
}
// Future.sync(future,"isRunning", target1, "isRunning");
```

Supported properties: "isRunning", "isCanceled", "isFinished"

4 changes: 2 additions & 2 deletions qffuture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ void Future::setEngine(QQmlEngine *engine)

QString qml = "import QtQuick 2.0\n"
"import QuickPromise 1.0\n"
"import Future 1.0\n"
"import QuickFuture 1.0\n"
"QtObject { \n"
"function create(future) {\n"
" var promise = Q.promise();\n"
Expand Down Expand Up @@ -184,6 +184,7 @@ static void init() {
});

qmlRegisterSingletonType<Future>("Future", 1, 0, "Future", provider);
qmlRegisterSingletonType<Future>("QuickFuture", 1, 0, "Future", provider);

Future::registerType<QString>();
Future::registerType<int>();
Expand All @@ -196,7 +197,6 @@ static void init() {
Future::registerType<QSize>();
}


Q_COREAPP_STARTUP_FUNCTION(init)

} // End of namespace
2 changes: 1 addition & 1 deletion qpm.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"url": "[email protected]:benlau/quickfuture.git"
},
"version": {
"label": "1.0.1",
"label": "1.0.2",
"revision": "",
"fingerprint": ""
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import QtQuick 2.0
import Future 1.0
import QuickFuture 1.0

Item {

Expand Down
2 changes: 1 addition & 1 deletion tests/quickfutureunittests/qmltests/tst_Callback.qml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import QtQuick 2.0
import QtTest 1.1
import Testable 1.0
import Future 1.0
import QuickFuture 1.0
import FutureTests 1.0

CustomTestCase {
Expand Down
2 changes: 1 addition & 1 deletion tests/quickfutureunittests/qmltests/tst_Promise.qml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import QtQuick 2.0
import Testable 1.0
import Future 1.0
import QuickFuture 1.0
import FutureTests 1.0
import QtTest 1.1

Expand Down
2 changes: 1 addition & 1 deletion tests/quickfutureunittests/qmltests/tst_Sync.qml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import QtQuick 2.0
import QtTest 1.1
import Testable 1.0
import Future 1.0
import QuickFuture 1.0
import FutureTests 1.0

CustomTestCase {
Expand Down

0 comments on commit 95d872a

Please sign in to comment.