nextpnr/gui/ice40/worker.h

78 lines
1.5 KiB
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:
2018-06-22 21:35:07 +08:00
void loadfile(const std::string &);
void pack();
void place();
void route();
Q_SIGNALS:
void log(const std::string &text);
2018-06-22 21:35:07 +08:00
void loadfile_finished(bool status);
void pack_finished(bool status);
void place_finished(bool status);
void route_finished(bool status);
void taskCanceled();
void taskStarted();
void taskPaused();
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();
2018-06-22 21:35:07 +08:00
void loadfile(const std::string &);
void pack();
void place();
void route();
// redirected signals
void log(const std::string &text);
2018-06-22 21:35:07 +08:00
void loadfile_finished(bool status);
void pack_finished(bool status);
void place_finished(bool status);
void route_finished(bool status);
void taskCanceled();
void taskStarted();
void taskPaused();
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