| | |
| | | PENDING,
|
| | | RUNNING,
|
| | | PAUSED,
|
| | | FAILED
|
| | | FAILED,
|
| | | MODEL_LOADING,
|
| | | DONE
|
| | | };
|
| | | inline const char *QueueStatus_str[] = {
|
| | | "pending",
|
| | | "running",
|
| | | "paused",
|
| | | "failed"};
|
| | | "failed",
|
| | | "model loading...",
|
| | | "finished"
|
| | | };
|
| | |
|
| | | enum QueueEvents
|
| | | {
|
| | | ITEM_DELETED,
|
| | | ITEM_ADDED,
|
| | | ITEM_STATUS_CHANGED,
|
| | | ITEM_UPDATED
|
| | | ITEM_UPDATED,
|
| | | ITEM_START,
|
| | | ITEM_FINISHED
|
| | | };
|
| | | struct QueueItem
|
| | | {
|
| | | QueueItem() = default;
|
| | | QueueItem(const QueueItem &other)
|
| | | : id(other.id), created_at(other.created_at), updated_at(other.updated_at),
|
| | | finished_at(other.finished_at), params(other.params), status(other.status) {}
|
| | | finished_at(other.finished_at), params(other.params), status(other.status), images(other.images) {}
|
| | |
|
| | | QueueItem &operator=(const QueueItem &other)
|
| | | {
|
| | |
| | | created_at = other.created_at;
|
| | | updated_at = other.updated_at;
|
| | | finished_at = other.finished_at;
|
| | | images = other.images;
|
| | | // Másolatot készítünk a params referenciáról
|
| | | // Ha a params referenciához tartozó SDParams objektum módosulna,
|
| | | // akkor ebben az esetben másolatban marad az eredeti QueueItem-ben
|
| | |
| | | }
|
| | | return *this;
|
| | | }
|
| | | int id, created_at, updated_at, finished_at;
|
| | | int id, created_at = 0, updated_at = 0, finished_at = 0;
|
| | | sd_gui_utils::SDParams params;
|
| | | QM::QueueStatus status = QM::QueueStatus::PENDING;
|
| | | std::vector<std::string> images;
|
| | | };
|
| | |
|
| | | inline void to_json(nlohmann::json &j, const QueueItem &p)
|
| | |
| | | {"created_at", p.created_at},
|
| | | {"updated_at", p.updated_at},
|
| | | {"finished_at", p.finished_at},
|
| | | {"images", p.images},
|
| | | // {"params", p.params},
|
| | | {"status", (int)p.status}};
|
| | | }
|
| | |
| | | j.at("id").get_to(p.id);
|
| | | j.at("created_at").get_to(p.created_at);
|
| | | j.at("updated_at").get_to(p.updated_at);
|
| | | j.at("images").get_to(p.images);
|
| | | j.at("finished_at").get_to(p.finished_at);
|
| | | // j.at("params").get_to(p.params);
|
| | | p.status = j.at("status").get<QM::QueueStatus>();
|
| | |
| | | void onItemAdded(QM::QueueItem item);
|
| | | void LodJobsFromFile();
|
| | | void SaveJobsToFile();
|
| | | // @brief check if something is running or not
|
| | | bool isRunning = false;
|
| | |
|
| | | wxEvtHandler *eventHandler;
|
| | | wxWindow *parent;
|