nextpnr/gui/ice40/worker.h

56 lines
979 B
C
Raw Normal View History

#ifndef WORKER_H
#define WORKER_H
2018-06-22 18:11:22 +08:00
#include <QMutex>
#include <QThread>
#include "nextpnr.h"
2018-06-22 19:10:27 +08:00
NEXTPNR_NAMESPACE_BEGIN
2018-06-22 18:11:22 +08:00
class TaskManager;
class Worker : public QObject
{
Q_OBJECT
public:
2018-06-22 18:11:22 +08:00
Worker(Context *ctx, TaskManager *parent);
public Q_SLOTS:
void parsejson(const std::string &filename);
Q_SIGNALS:
void log(const std::string &text);
private:
Context *ctx;
};
class TaskManager : public QObject
{
Q_OBJECT
QThread workerThread;
public:
TaskManager(Context *ctx);
~TaskManager();
2018-06-22 18:11:22 +08:00
bool shouldTerminate();
void clearTerminate();
2018-06-22 18:49:20 +08:00
bool isPaused();
public Q_SLOTS:
void info(const std::string &text);
2018-06-22 18:11:22 +08:00
void terminate_thread();
2018-06-22 18:49:20 +08:00
void pause_thread();
void continue_thread();
Q_SIGNALS:
2018-06-22 18:11:22 +08:00
void terminate();
void parsejson(const std::string &);
void log(const std::string &text);
2018-06-22 18:11:22 +08:00
private:
QMutex mutex;
bool toTerminate;
2018-06-22 18:49:20 +08:00
bool toPause;
};
2018-06-22 19:10:27 +08:00
NEXTPNR_NAMESPACE_END
#endif // WORKER_H