nextpnr/gui/ice40/worker.h

51 lines
873 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"
// FIXME
USING_NEXTPNR_NAMESPACE
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();
public Q_SLOTS:
void info(const std::string &text);
2018-06-22 18:11:22 +08:00
void terminate_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;
};
#endif // WORKER_H