From 2088e1b7aa6419dec58800bc1d0cb24f5808affe Mon Sep 17 00:00:00 2001
From: Ferenc Szontágh <szf@fsociety.hu>
Date: Sat, 03 Feb 2024 21:19:43 +0000
Subject: [PATCH] added queue handler against simple start
---
ui/QueueManager.h | 23 ++++++++++++++++++-----
1 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/ui/QueueManager.h b/ui/QueueManager.h
index f7b3e02..baaf7fb 100644
--- a/ui/QueueManager.h
+++ b/ui/QueueManager.h
@@ -17,27 +17,34 @@
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)
{
@@ -47,6 +54,7 @@
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
@@ -55,9 +63,10 @@
}
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)
@@ -67,6 +76,7 @@
{"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}};
}
@@ -76,6 +86,7 @@
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>();
@@ -105,6 +116,8 @@
void onItemAdded(QM::QueueItem item);
void LodJobsFromFile();
void SaveJobsToFile();
+ // @brief check if something is running or not
+ bool isRunning = false;
wxEvtHandler *eventHandler;
wxWindow *parent;
--
Gitblit v1.9.3