From ed5792bb9f496968007a0fbb39779c6d0668c4a7 Mon Sep 17 00:00:00 2001 From: Scott Gilbertson Date: Sat, 10 Feb 2024 13:49:19 -0500 Subject: [PATCH] Make populateTemplateHelpBuffer a private member of class BatchQueuePanel --- rtgui/batchqueuepanel.cc | 97 +++++++++++++++++++--------------------- rtgui/batchqueuepanel.h | 1 + 2 files changed, 47 insertions(+), 51 deletions(-) diff --git a/rtgui/batchqueuepanel.cc b/rtgui/batchqueuepanel.cc index 439134977..d150adc94 100644 --- a/rtgui/batchqueuepanel.cc +++ b/rtgui/batchqueuepanel.cc @@ -23,57 +23,6 @@ #include "soundman.h" #include "rtimage.h" -namespace // helper functions -{ - - // Populate the buffer of a Gtk::TextView with help text for the location template field - void populateTemplateHelpBuffer(Glib::RefPtr buffer) - { - auto pos = buffer->begin(); - auto insertHeading1 = [&pos, buffer](const Glib::ustring& text) { - pos = buffer->insert_markup(pos, Glib::ustring::format("", text, "\n")); - }; - auto insertHeading2 = [&pos, buffer](const Glib::ustring& text) { - pos = buffer->insert_markup(pos, Glib::ustring::format("\n\n", text, "\n")); - }; - insertHeading1(M("QUEUE_LOCATION_TEMPLATE_HELP_TITLE")); - pos = buffer->insert_markup(pos, M("QUEUE_LOCATION_TEMPLATE_HELP_INTRO")); - insertHeading2(M("QUEUE_LOCATION_TEMPLATE_HELP_PATHS_TITLE")); - printf("[[[%s]]]", M("QUEUE_LOCATION_TEMPLATE_HELP_PATHS_INTRO").c_str()); - pos = buffer->insert_markup(pos, M("QUEUE_LOCATION_TEMPLATE_HELP_PATHS_INTRO")); - pos = buffer->insert(pos, "\n"); - pos = buffer->insert_markup(pos, M("QUEUE_LOCATION_TEMPLATE_HELP_PATHS_BODY_1")); -#ifdef _WIN32 - auto exampleString = M("QUEUE_LOCATION_TEMPLATE_HELP_PATHS_EXAMPLE_WINDOWS"); -#else - auto exampleString = M("QUEUE_LOCATION_TEMPLATE_HELP_PATHS_EXAMPLE_LINUX"); -#endif - pos = buffer->insert_markup(pos, Glib::ustring::format("\n ", exampleString, "\n")); - pos = buffer->insert_markup(pos, M("QUEUE_LOCATION_TEMPLATE_HELP_PATHS_BODY_2")); - pos = buffer->insert(pos, "\n"); - /* FIXME: Still to do here: - Generate text like the original below, but use the actual conversion function to create it: - %d4 = %d-1 = home - %d3 = %d-2 = tom - %d2 = %d-3 = photos - %d1 = %d-4 = 2010-10-31 - %p1 = %p-4 = /home/tom/photos/2010-10-31/ - %p2 = %p-3 = /home/tom/photos/ - %p3 = %p-2 = /home/tom/ - %p4 = %p-1 = /home/ - %P1 = %P-4 = 2010-10-31/ - %P2 = %P-3 = photos/2010-10-31/ - %P3 = %P-2 = tom/photos/2010-10-31/ - %P4 = %P-1 = /home/tom/photos/2010-10-31/ - %f = photo1 - Insert sections for the remaining specifiers: - %r = rank - %s# = queue position, with padding - Insert an examples section - */ - } -} - static Glib::ustring makeFolderLabel(Glib::ustring path) { if (!Glib::file_test (path, Glib::FILE_TEST_IS_DIR)) { @@ -401,6 +350,52 @@ void BatchQueuePanel::templateHelpButtonToggled() templateHelpTextView->set_visible(visible); } +void BatchQueuePanel::populateTemplateHelpBuffer(Glib::RefPtr buffer) +{ + auto pos = buffer->begin(); + auto insertHeading1 = [&pos, buffer](const Glib::ustring& text) { + pos = buffer->insert_markup(pos, Glib::ustring::format("", text, "\n")); + }; + auto insertHeading2 = [&pos, buffer](const Glib::ustring& text) { + pos = buffer->insert_markup(pos, Glib::ustring::format("\n\n", text, "\n")); + }; + insertHeading1(M("QUEUE_LOCATION_TEMPLATE_HELP_TITLE")); + pos = buffer->insert_markup(pos, M("QUEUE_LOCATION_TEMPLATE_HELP_INTRO")); + insertHeading2(M("QUEUE_LOCATION_TEMPLATE_HELP_PATHS_TITLE")); + printf("[[[%s]]]", M("QUEUE_LOCATION_TEMPLATE_HELP_PATHS_INTRO").c_str()); + pos = buffer->insert_markup(pos, M("QUEUE_LOCATION_TEMPLATE_HELP_PATHS_INTRO")); + pos = buffer->insert(pos, "\n"); + pos = buffer->insert_markup(pos, M("QUEUE_LOCATION_TEMPLATE_HELP_PATHS_BODY_1")); +#ifdef _WIN32 + auto exampleString = M("QUEUE_LOCATION_TEMPLATE_HELP_PATHS_EXAMPLE_WINDOWS"); +#else + auto exampleString = M("QUEUE_LOCATION_TEMPLATE_HELP_PATHS_EXAMPLE_LINUX"); +#endif + pos = buffer->insert_markup(pos, Glib::ustring::format("\n ", exampleString, "\n")); + pos = buffer->insert_markup(pos, M("QUEUE_LOCATION_TEMPLATE_HELP_PATHS_BODY_2")); + pos = buffer->insert(pos, "\n"); + /* FIXME: Still to do here: + Generate text like the original below, but use the actual conversion function to create it: + %d4 = %d-1 = home + %d3 = %d-2 = tom + %d2 = %d-3 = photos + %d1 = %d-4 = 2010-10-31 + %p1 = %p-4 = /home/tom/photos/2010-10-31/ + %p2 = %p-3 = /home/tom/photos/ + %p3 = %p-2 = /home/tom/ + %p4 = %p-1 = /home/ + %P1 = %P-4 = 2010-10-31/ + %P2 = %P-3 = photos/2010-10-31/ + %P3 = %P-2 = tom/photos/2010-10-31/ + %P4 = %P-1 = /home/tom/photos/2010-10-31/ + %f = photo1 + Insert sections for the remaining specifiers: + %r = rank + %s# = queue position, with padding + Insert an examples section + */ +} + void BatchQueuePanel::addBatchQueueJobs(const std::vector& entries, bool head) { batchQueue->addEntries(entries, head); diff --git a/rtgui/batchqueuepanel.h b/rtgui/batchqueuepanel.h index bdd4ef6de..417d8a4cb 100644 --- a/rtgui/batchqueuepanel.h +++ b/rtgui/batchqueuepanel.h @@ -85,6 +85,7 @@ private: void startOrStopBatchProc(); void setGuiFromBatchState(bool queueRunning, int qsize); void templateHelpButtonToggled(); + void populateTemplateHelpBuffer(Glib::RefPtr buffer); void pathFolderChanged (); void pathFolderButtonPressed ();