summaryrefslogtreecommitdiff
path: root/controller.cxx
blob: 015d4ac3ebcfc68f21edcbb6f12a100d399f0266 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include "worker.hxx"
#include "controller.hxx"

Controller::Controller()
{
	Worker* worker = new Worker{};
	worker->moveToThread(&thread);
	connect(&thread, &QThread::finished, worker, &QObject::deleteLater);
	connect(this, &Controller::credentialsObtained, worker, &Worker::logIn);
	thread.start();
}

void Controller::logIn(QString const& name, QString const& password)
{
	emit credentialsObtained(name, password);
}

Controller::~Controller()
{
	thread.quit();
	thread.wait();
}