Page MenuHomePhorge

No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None
diff --git a/src/effects-example/main.cpp b/src/effects-example/main.cpp
index 835816c..cc0964d 100644
--- a/src/effects-example/main.cpp
+++ b/src/effects-example/main.cpp
@@ -1,50 +1,49 @@
#include <iostream>
-#include <boost/asio.hpp>
#include <lager/event_loop/qt.hpp>
#include <lager/store.hpp>
#include <QObject>
#include <QCoreApplication>
#include <QTimer>
#include "model.hpp"
void repl(QObject *obj, lager::context<Action> ctx)
{
std::cout << "?" << std::endl;
std::string a;
std::cin >> a;
if (a == "1") {
ctx.dispatch(IncrementAction{});
} else if (a == "2") {
ctx.dispatch(IncrementTwiceAction{});
} else {
std::cout << "unrecognized action" << std::endl;
}
// XXX Why can't I just use QMetaObject::invokeMethod
// with QueuedConnection?
// Let's bear with it now. Will go back to this later.
QTimer::singleShot(100, obj, [=]() {
repl(obj, ctx);
});
}
int main(int argc, char *argv[])
{
QCoreApplication app(argc, argv);
QObject mainObject;
IOHandler handler;
auto store = lager::make_store<Action>(
Model{},
lager::with_qt_event_loop{mainObject},
lager::with_deps(std::ref(handler)));
auto context = static_cast<lager::context<Action>>(store);
QTimer::singleShot(0, &mainObject,
[obj=&mainObject, context]() {
repl(obj, context);
});
return app.exec();
}

File Metadata

Mime Type
text/x-diff
Expires
Sat, Nov 23, 4:39 PM (23 h, 8 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
39023
Default Alt Text
(1 KB)

Event Timeline