Enough with the political posts!
Planet maemo
When I’m not in Flowhub-land, I’m used to developing software in a quite customized command line based development environment. Like for many, the cornerstones of this for me are vim and tmux.

With asynchronous commands we have typical commands from the Model View ViewModel world that return asynchronously.
Whenever that happens we want result reporting and progress reporting. We basically want something like this in QML:
Item { id: container property ViewModel viewModel: ViewModel {} Connections { target: viewModel.asyncHelloCommand onExecuteProgressed: { progressBar.value = value progressBar.maximumValue = maximum } } ProgressBar { id: progressBar } Button { enabled: viewModel.asyncHelloCommand.canExecute onClicked: viewModel.asyncHelloCommand.execute() } }
How do we do this? First we start with defining a AbstractAsyncCommand (impl. of protected APIs here):
class AbstractAsyncCommand : public AbstractCommand { Q_OBJECT public: AbstractAsyncCommand(QObject *parent=0); Q_INVOKABLE virtual QFuture<void*> executeAsync() = 0; virtual void execute() Q_DECL_OVERRIDE; signals: void executeFinished(void* result); void executeProgressed(int value, int maximum); protected: QSharedPointer<QFutureInterface<void*>> start(); void progress(QSharedPointer<QFutureInterface<void*>> fut, int value, int total); void finish(QSharedPointer<QFutureInterface<void*>> fut, void* result); private: QVector<QSharedPointer<QFutureInterface<void*>>> m_futures; };
After that we provide an implementation:
#include <QThreadPool> #include <QRunnable> #include <MVVM/Commands/AbstractAsyncCommand.h> class AsyncHelloCommand: public AbstractAsyncCommand { Q_OBJECT public: AsyncHelloCommand(QObject *parent=0); bool canExecute() const Q_DECL_OVERRIDE { return true; } QFuture<void*> executeAsync() Q_DECL_OVERRIDE; private: void* executeAsyncTaskFunc(); QSharedPointer<QFutureInterface<void*>> current; QMutex mutex; }; #include "asynchellocommand.h" #include <QtConcurrent/QtConcurrent> AsyncHelloCommand::AsyncHelloCommand(QObject* parent) : AbstractAsyncCommand(parent) { } void* AsyncHelloCommand::executeAsyncTaskFunc() { for (int i=0; i<10; i++) { QThread::sleep(1); qDebug() << "Hello Async!"; mutex.lock(); progress(current, i, 10); mutex.unlock(); } return nullptr; } QFuture<void*> AsyncHelloCommand::executeAsync() { mutex.lock(); current = start(); QFutureWatcher<void*>* watcher = new QFutureWatcher<void*>(this); connect(watcher, &QFutureWatcher<void*>::progressValueChanged, this, [=]{ mutex.lock(); progress(current, watcher->progressValue(), watcher->progressMaximum()); mutex.unlock(); }); connect(watcher, &QFutureWatcher<void*>::finished, this, [=]{ void* result=watcher->result(); mutex.lock(); finish(current, result); mutex.unlock(); watcher->deleteLater(); }); watcher->setFuture(QtConcurrent::run(this, &AsyncHelloCommand::executeAsyncTaskFunc)); QFuture<void*> future = current->future(); mutex.unlock(); return future; }
You can find the complete working example here.
A few days ago I explained how we can do MVVM techniques like ICommand in Qt.
In the .NET XAML world, you have the ICommand, the CompositeCommand and the DelegateCommand. You use these commands to in a declarative way bind them as properties to XAML components like menu items and buttons. You can find an excellent book on this titled Prism 5.0 for WPF.

Dear Maemo community, I have the great honor of introducing the new Community Council for the upcoming Q2/2017 period.
**The members of the new council are (in alphabetical order):**
- Juiceme (Jussi Ohenoja)
- Mosen (Timo Könnecke)
- Sicelo (Sicelo Mhlongo)
The voting results can be seen on the [voting page]
I want to thank warmly all the members of the community who participated in this most important action of choosing a new council for us!
The new council shall meet on the #maemo-meeting IRC channel next tuesday 18.06 at 20:00 UTC for the formal handover with the passing council.
Jussi Ohenoja, On behalf of the outgoing Maemo Community Council
I’m at home now. I don’t do non-public unpaid work. So let’s blog the example I’m making for him.

The photos below are taken in fifteen minutes, walking about 200m.
The post Fifteen minutes in a Venetian park appeared first on René Seindal.
Imagine we want an editor that has undo and redo capability. But the operations on the editor are all asynchronous. This implies that also undo and redo are asynchronous operations.