[app] A few BooksTask tweaks

1. Added QThread attribute to the constructor
2. Made isCanceled() public
This commit is contained in:
Slava Monich 2018-01-30 00:24:17 +02:00
parent 4f293dd7ff
commit 26510f1d9e
2 changed files with 8 additions and 8 deletions

View file

@ -1,6 +1,6 @@
/*
* Copyright (C) 2015-2017 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
* Copyright (C) 2015-2018 Jolla Ltd.
* Copyright (C) 2015-2018 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of the BSD license as follows:
*
@ -38,7 +38,7 @@
#include <QCoreApplication>
BooksTask::BooksTask() :
BooksTask::BooksTask(QThread* aThread) :
iAboutToQuit(false),
iSubmitted(false),
iStarted(false),
@ -46,6 +46,7 @@ BooksTask::BooksTask() :
iDone(false)
{
setAutoDelete(false);
if (aThread) moveToThread(aThread);
connect(qApp, SIGNAL(aboutToQuit()), SLOT(onAboutToQuit()));
connect(this, SIGNAL(runFinished()), SLOT(onRunFinished()),
Qt::QueuedConnection);

View file

@ -1,6 +1,6 @@
/*
* Copyright (C) 2015-2017 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
* Copyright (C) 2015-2018 Jolla Ltd.
* Copyright (C) 2015-2018 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of the BSD license as follows:
*
@ -45,17 +45,16 @@ class BooksTask : public QObject, public QRunnable
friend class BooksTaskQueue;
protected:
BooksTask();
BooksTask(QThread* aThread = NULL);
public:
virtual ~BooksTask();
bool isStarted() const;
bool isCanceled() const;
void release(QObject* aHandler);
protected:
bool isCanceled() const;
virtual void run();
virtual void performTask() = 0;