[app] A few BooksTask tweaks
1. Added QThread attribute to the constructor 2. Made isCanceled() public
This commit is contained in:
parent
4f293dd7ff
commit
26510f1d9e
2 changed files with 8 additions and 8 deletions
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2015-2017 Jolla Ltd.
|
* Copyright (C) 2015-2018 Jolla Ltd.
|
||||||
* Contact: Slava Monich <slava.monich@jolla.com>
|
* Copyright (C) 2015-2018 Slava Monich <slava.monich@jolla.com>
|
||||||
*
|
*
|
||||||
* You may use this file under the terms of the BSD license as follows:
|
* You may use this file under the terms of the BSD license as follows:
|
||||||
*
|
*
|
||||||
|
@ -38,7 +38,7 @@
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
|
|
||||||
BooksTask::BooksTask() :
|
BooksTask::BooksTask(QThread* aThread) :
|
||||||
iAboutToQuit(false),
|
iAboutToQuit(false),
|
||||||
iSubmitted(false),
|
iSubmitted(false),
|
||||||
iStarted(false),
|
iStarted(false),
|
||||||
|
@ -46,6 +46,7 @@ BooksTask::BooksTask() :
|
||||||
iDone(false)
|
iDone(false)
|
||||||
{
|
{
|
||||||
setAutoDelete(false);
|
setAutoDelete(false);
|
||||||
|
if (aThread) moveToThread(aThread);
|
||||||
connect(qApp, SIGNAL(aboutToQuit()), SLOT(onAboutToQuit()));
|
connect(qApp, SIGNAL(aboutToQuit()), SLOT(onAboutToQuit()));
|
||||||
connect(this, SIGNAL(runFinished()), SLOT(onRunFinished()),
|
connect(this, SIGNAL(runFinished()), SLOT(onRunFinished()),
|
||||||
Qt::QueuedConnection);
|
Qt::QueuedConnection);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2015-2017 Jolla Ltd.
|
* Copyright (C) 2015-2018 Jolla Ltd.
|
||||||
* Contact: Slava Monich <slava.monich@jolla.com>
|
* Copyright (C) 2015-2018 Slava Monich <slava.monich@jolla.com>
|
||||||
*
|
*
|
||||||
* You may use this file under the terms of the BSD license as follows:
|
* 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;
|
friend class BooksTaskQueue;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
BooksTask();
|
BooksTask(QThread* aThread = NULL);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual ~BooksTask();
|
virtual ~BooksTask();
|
||||||
|
|
||||||
bool isStarted() const;
|
bool isStarted() const;
|
||||||
|
bool isCanceled() const;
|
||||||
void release(QObject* aHandler);
|
void release(QObject* aHandler);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool isCanceled() const;
|
|
||||||
|
|
||||||
virtual void run();
|
virtual void run();
|
||||||
virtual void performTask() = 0;
|
virtual void performTask() = 0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue