From 8375f92802d3aa7667bfc6f22f6d2a72361c9808 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Mon, 4 Nov 2024 11:46:24 -0500 Subject: Websockets server! --- wizard.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'wizard.cpp') diff --git a/wizard.cpp b/wizard.cpp index 1541fed..a1d7df4 100644 --- a/wizard.cpp +++ b/wizard.cpp @@ -50,6 +50,10 @@ wizard::wizard(const cardset& cards, const imagestore& images, std::string text, std::cout << std::endl; } +void wizard::set_status_callback(status_callback_type callback) { + status_callback_ = callback; +} + Magick::Image wizard::run() { std::string text = text_; //"what the heck, it's just some gay guy"; // getline(std::cin, text); @@ -58,6 +62,9 @@ Magick::Image wizard::run() { } std::cout << "Calculating card list..." << std::endl; + if (status_callback_) { + status_callback_("Calculating card list..."); + } std::string canonText = hatkirby::lowercase(text); designer des(canonText, cards_.getTitles()); @@ -76,10 +83,16 @@ Magick::Image wizard::run() { << cardName.substr(u.strIndex + u.strLen) << std::endl; std::cout << "Downloading image..." << std::endl; + if (status_callback_) { + status_callback_("Downloading image..."); + } Magick::Image cardImg = images_.get(theCard.uuid, theCard.imageUri); std::cout << "Reading text..." << std::endl; + if (status_callback_) { + status_callback_("Reading text..."); + } Magick::Image titleImg = cardImg; titleImg.magick("TIFF"); @@ -139,9 +152,10 @@ Magick::Image wizard::run() { size_t leadin = hatkirby::lowercase(lineStr).find( hatkirby::lowercase((cardName))); - if (leadin != std::string::npos) { + // if (leadin != std::string::npos) + { foundName = true; - extraChars = leadin; + // extraChars = leadin; break; } /* else { -- cgit 1.4.1