2020-08-10 15:17:29 +03:00
|
|
|
/*
|
|
|
|
Copyright (C) 2020 Sebastian J. Wolf
|
|
|
|
|
|
|
|
This file is part of Fernschreiber.
|
|
|
|
|
|
|
|
fernschreiber is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
fernschreiber is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with Fernschreiber. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "tdlibwrapper.h"
|
|
|
|
|
|
|
|
TDLibWrapper::TDLibWrapper(QObject *parent) : QObject(parent)
|
|
|
|
{
|
|
|
|
qDebug() << "[TDLibWrapper] Initializing TD Lib...";
|
|
|
|
this->tdLibClient = td_json_client_create();
|
2020-08-10 21:17:13 +03:00
|
|
|
this->tdLibReceiver = new TDLibReceiver(this->tdLibClient, this);
|
|
|
|
this->tdLibReceiver->start();
|
2020-08-10 15:17:29 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
TDLibWrapper::~TDLibWrapper()
|
|
|
|
{
|
|
|
|
qDebug() << "[TDLibWrapper] Destroying TD Lib...";
|
2020-08-10 21:17:13 +03:00
|
|
|
this->tdLibReceiver->setActive(false);
|
|
|
|
while (this->tdLibReceiver->isRunning()) {
|
|
|
|
QCoreApplication::processEvents(QEventLoop::AllEvents, 1000);
|
|
|
|
}
|
2020-08-10 15:17:29 +03:00
|
|
|
td_json_client_destroy(this->tdLibClient);
|
|
|
|
}
|
|
|
|
|