Added Typedefs.h and Job/JobQueue interfaces.
This commit is contained in:
parent
1d0dfa5215
commit
f1da3373a8
@ -26,4 +26,7 @@ Job::Job( QObject* parent )
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Job::~Job()
|
||||||
|
{}
|
||||||
|
|
||||||
} // namespace Calamares
|
} // namespace Calamares
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#define CALAMARES_JOB_H
|
#define CALAMARES_JOB_H
|
||||||
|
|
||||||
#include "DllMacro.h"
|
#include "DllMacro.h"
|
||||||
|
#include "Typedefs.h"
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
@ -29,7 +30,21 @@ class DLLEXPORT Job : public QObject
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
enum State
|
||||||
|
{
|
||||||
|
Pending = 0,
|
||||||
|
Running,
|
||||||
|
Finished
|
||||||
|
};
|
||||||
|
|
||||||
explicit Job( QObject* parent = nullptr );
|
explicit Job( QObject* parent = nullptr );
|
||||||
|
virtual ~Job();
|
||||||
|
|
||||||
|
virtual QString prettyName() = 0;
|
||||||
|
virtual void exec() = 0;
|
||||||
|
signals:
|
||||||
|
void running( const Calamares::job_ptr& );
|
||||||
|
void finished( const Calamares::job_ptr& );
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Calamares
|
} // namespace Calamares
|
||||||
|
@ -20,6 +20,14 @@
|
|||||||
namespace Calamares
|
namespace Calamares
|
||||||
{
|
{
|
||||||
|
|
||||||
|
JobQueue* JobQueue::s_instance = nullptr;
|
||||||
|
|
||||||
|
JobQueue*
|
||||||
|
JobQueue::instance()
|
||||||
|
{
|
||||||
|
return s_instance;
|
||||||
|
}
|
||||||
|
|
||||||
JobQueue::JobQueue( QObject* parent )
|
JobQueue::JobQueue( QObject* parent )
|
||||||
: QObject( parent )
|
: QObject( parent )
|
||||||
{
|
{
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#define CALAMARES_JOBQUEUE_H
|
#define CALAMARES_JOBQUEUE_H
|
||||||
|
|
||||||
#include "DllMacro.h"
|
#include "DllMacro.h"
|
||||||
|
#include "Typedefs.h"
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
@ -31,6 +32,18 @@ class DLLEXPORT JobQueue : public QObject
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit JobQueue( QObject* parent = nullptr );
|
explicit JobQueue( QObject* parent = nullptr );
|
||||||
|
|
||||||
|
static JobQueue* instance();
|
||||||
|
|
||||||
|
void enqueue( const Calamares::job_ptr& job );
|
||||||
|
void enqueue( const QList< Calamares::job_ptr >& jobs );
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void jobRunning( const Calamares::job_ptr& );
|
||||||
|
void jobFinished( const Calamares::job_ptr& );
|
||||||
|
|
||||||
|
private:
|
||||||
|
static JobQueue* s_instance;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
32
src/libcalamares/Typedefs.h
Normal file
32
src/libcalamares/Typedefs.h
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
||||||
|
*
|
||||||
|
* Copyright 2014, Teo Mrnjavac <teo@kde.org>
|
||||||
|
*
|
||||||
|
* Calamares 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.
|
||||||
|
*
|
||||||
|
* Calamares 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 Calamares. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef TYPEDEFS_H
|
||||||
|
#define TYPEDEFS_H
|
||||||
|
|
||||||
|
#include <QSharedPointer>
|
||||||
|
|
||||||
|
namespace Calamares
|
||||||
|
{
|
||||||
|
class Job;
|
||||||
|
|
||||||
|
typedef QSharedPointer< Job > job_ptr;
|
||||||
|
|
||||||
|
} //ns
|
||||||
|
|
||||||
|
#endif // TYPEDEFS_H
|
Loading…
Reference in New Issue
Block a user