summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--controller.cxx2
-rw-r--r--worker.cxx12
-rw-r--r--worker.hxx6
3 files changed, 7 insertions, 13 deletions
diff --git a/controller.cxx b/controller.cxx
index 4962072..7f8d2a0 100644
--- a/controller.cxx
+++ b/controller.cxx
@@ -4,7 +4,7 @@
Controller::Controller(QObject* parent) : QObject{parent}
{
- Worker* worker = new Worker{parent};
+ Worker* worker = new Worker;
worker->moveToThread(&thread);
connect(&thread, &QThread::finished, worker, &QObject::deleteLater);
diff --git a/worker.cxx b/worker.cxx
index df0e832..5af91fb 100644
--- a/worker.cxx
+++ b/worker.cxx
@@ -3,27 +3,21 @@
#include "user.hxx"
#include "worker.hxx"
-Worker::Worker(QObject* parent) :
- QObject{parent}
+Worker::Worker()
{
rtclient_init("https://darapsa.co.id/rt");
}
void Worker::logIn(QString const& name, QString const& password)
{
- auto engine = dynamic_cast<QQmlApplicationEngine*>(this->parent());
- auto user = engine->singletonInstance<User*>(User::typeId);
- user->setName(name);
rtclient_login(name.toLatin1().constData(), password.toLatin1().constData());
rtclient_user(name.toLatin1().constData());
}
-void Worker::getTaskList()
+void Worker::search(QString const& owner)
{
- auto engine = dynamic_cast<QQmlApplicationEngine*>(this->parent());
- auto user = engine->singletonInstance<User*>(User::typeId);
QString query{"Owner='"};
- query.append(user->name());
+ query.append(owner);
query.append("'");
rtclient_search(query.toLatin1().constData());
}
diff --git a/worker.hxx b/worker.hxx
index ee5f027..130d1c6 100644
--- a/worker.hxx
+++ b/worker.hxx
@@ -8,12 +8,12 @@ class Worker : public QObject
Q_OBJECT
public:
- explicit Worker(QObject* parent = nullptr);
- virtual ~Worker();
+ Worker();
+ ~Worker();
public slots:
void logIn(QString const& name, QString const& password);
- void getTaskList();
+ void search(QString const& owner);
};
#endif // WORKER_HXX