#ifndef __MainWindowUI__ #define __MainWindowUI__ /** @file Subclass of UI, which is generated by wxFormBuilder. */ #include "MainWindow.h" //// end generated include #include "ver.hpp" #include "MainWindowSettings.h" #include "MainWindowImageViewer.h" #include "QueueManager.h" #include #include #include #include #include #include #include "utils.hpp" #include #include #include #include #include #include /** Implementing UI */ class MainWindowUI : public UI { protected: // Handlers for UI events. void onSettings(wxCommandEvent &event); void onModelsRefresh(wxCommandEvent &event); void onModelSelect(wxCommandEvent &event); void onVaeSelect(wxCommandEvent &event); void onSamplerSelect(wxCommandEvent &event); void onResolutionSwap(wxCommandEvent &event); void onJobsStart(wxCommandEvent &event); void onJobsPause(wxCommandEvent &event); void onJobsDelete(wxCommandEvent &event); void onJoblistItemActivated(wxDataViewEvent &event); void onJoblistSelectionChanged(wxDataViewEvent &event); void onGenerate(wxCommandEvent &event); void onSavePreset(wxCommandEvent &event); void onLoadPreset(wxCommandEvent &event); void onSelectPreset(wxCommandEvent &event); void onDeletePreset(wxCommandEvent &event); public: /** Constructor */ MainWindowUI(wxWindow *parent); //// end generated class members ~MainWindowUI(); void OnThreadMessage(wxThreadEvent &e); private: wxFileConfig *fileConfig; sd_gui_utils::config *cfg; wxString ini_path; MainWindowSettings *settingsWindow; sd_gui_utils::SDParams *sd_params; std::map ModelFiles; std::map VaeFiles; std::map Presets; // the queue manager QM::QueueManager *qmanager; bool modelLoaded = false; std::string currentModel; sd_ctx_t *sd_ctx; std::streambuf *buffer; std::vector threads; // row,QueueItem std::map *JobTableItems; void initConfig(); void loadModelList(); void loadVaeList(); void OnCloseSettings(wxCloseEvent &event); void LoadFileList(sd_gui_utils::DirTypes type = sd_gui_utils::DirTypes::CHECKPOINT); void LoadPresets(); static void HandleSDLog(sd_log_level_t level, const char *text, void *data); // load the model in a new thread void LoadModel(wxEvtHandler *eventHandler, QM::QueueItem myItem); // generate in another thread void Generate(wxEvtHandler *eventHandler, QM::QueueItem myItem); // start a thread for model loading... void StartLoadModel(); // start a thread to generate image void StartGeneration(QM::QueueItem myJob); // handle queue managers events, manipulate data table by events void OnQueueItemManagerItemAdded(QM::QueueItem item); void OnQueueItemManagerItemUpdated(QM::QueueItem item); void OnQueueItemManagerItemStatusChanged(QM::QueueItem item); wxNotificationMessage *notification; }; #endif // __MainWindowUI__