Added help for time/date template specifiers

This commit is contained in:
Scott Gilbertson 2024-02-11 15:07:50 -05:00
parent 353a4d472a
commit bc054ea506
2 changed files with 21 additions and 7 deletions

View File

@ -2121,6 +2121,8 @@ QUEUE_LOCATION_TEMPLATE_HELP_RANK_TITLE;Rank
QUEUE_LOCATION_TEMPLATE_HELP_RANK_BODY;<b>%r</b> will be replaced by the photo's rank. If the photo is unranked, '<i>0</i>' is used. If the photo is in the trash, '<i>x</i>' is used.
QUEUE_LOCATION_TEMPLATE_HELP_SEQUENCE_TITLE;Position/sequence in queue
QUEUE_LOCATION_TEMPLATE_HELP_SEQUENCE_BODY;<b>%s1</b>, ..., <b>%s9</b> will be replaced by the photo's initial position in the queue at the time the queue is started. The number specifies the padding, e.g. <b>%s3</b> results in '<i>001</i>'.
QUEUE_LOCATION_TEMPLATE_HELP_TIMESTAMP_TITLE;Date and time
QUEUE_LOCATION_TEMPLATE_HELP_TIMESTAMP_BODY;Three different date/time values may be used in templates:\n <b>%tE"%Y-%m-%d"</b> = when export started\n <b>%tF"%Y-%m-%d"</b> = when file was last saved\n <b>%tP"%Y-%m-%d"</b> = when photo was taken\nThe quoted string defines the format of the resulting date and/or time. The format string <b>%tF"%Y-%m-%d"</b> is just one example. The string can use all conversion specifiers defined for the g_date_time_format function (see https://docs.gtk.org/glib/method.DateTime.format.html).\n\nExample format strings:
QUEUE_LOCATION_TEMPLATE_HELP_EXAMPLES_TITLE;Common examples
QUEUE_LOCATION_TEMPLATE_HELP_EXAMPLES_BODY;If you want to save the output image alongside the source image, write:\n<b>%p1/%f</b>\n\nIf you want to save the output image in a folder named '<i>converted</i>' located in the source photo's folder, write:\n<b>%p1/converted/%f</b>\n\nIf you want to save the output image in\n'<i>/home/tom/photos/converted/2010-10-31</i>', write:\n<b>%p-3/converted/%P-4/%f</b>
QUEUE_LOCATION_TITLE;Output Location

View File

@ -1,4 +1,3 @@
#define CHECKPOINT printf("CHECKPOINT: %d\n", __LINE__); // FIXME: REMOVE
/*
* This file is part of RawTherapee.
*
@ -365,6 +364,10 @@ void BatchQueuePanel::populateTemplateHelpBuffer(Glib::RefPtr<Gtk::TextBuffer> b
auto mainTitle = M("QUEUE_LOCATION_TEMPLATE_HELP_TITLE");
pos = buffer->insert_markup(pos, Glib::ustring::format("<big><b>", mainTitle, "</b></big>\n"));
pos = buffer->insert_markup(pos, M("QUEUE_LOCATION_TEMPLATE_HELP_INTRO"));
insertTopicHeading(M("QUEUE_LOCATION_TEMPLATE_HELP_EXAMPLES_TITLE"));
pos = buffer->insert_markup(pos, M("QUEUE_LOCATION_TEMPLATE_HELP_EXAMPLES_BODY"));
insertTopicHeading(M("QUEUE_LOCATION_TEMPLATE_HELP_PATHS_TITLE"));
pos = buffer->insert_markup(pos, M("QUEUE_LOCATION_TEMPLATE_HELP_PATHS_INTRO"));
pos = buffer->insert(pos, "\n");
@ -441,12 +444,21 @@ void BatchQueuePanel::populateTemplateHelpBuffer(Glib::RefPtr<Gtk::TextBuffer> b
insertTopicHeading(M("QUEUE_LOCATION_TEMPLATE_HELP_SEQUENCE_TITLE"));
pos = buffer->insert_markup(pos, M("QUEUE_LOCATION_TEMPLATE_HELP_SEQUENCE_BODY"));
insertTopicHeading(M("QUEUE_LOCATION_TEMPLATE_HELP_EXAMPLES_TITLE"));
pos = buffer->insert_markup(pos, M("QUEUE_LOCATION_TEMPLATE_HELP_EXAMPLES_BODY"));
/* FIXME: Still to do here:
Insert section for time/date specifiers
*/
options = savedOptions;
insertTopicHeading(M("QUEUE_LOCATION_TEMPLATE_HELP_TIMESTAMP_TITLE"));
pos = buffer->insert_markup(pos, M("QUEUE_LOCATION_TEMPLATE_HELP_TIMESTAMP_BODY"));
Glib::ustring dateTimeFormatExamples[] = {
"%Y-%m-%d",
"%Y%m%d_%H%M%S",
"%y/%b/%-d/"
};
auto timeNow = Glib::DateTime::create_now_local();
for (auto fmt : dateTimeFormatExamples) {
auto result = timeNow.format(fmt);
pos = buffer->insert_markup(pos, Glib::ustring::format("\n<tt> <b>%tE\"", fmt, "\"</b> = <i>", result, "</i></tt>"));
}
pos = buffer->insert(pos, "\n");
options = savedOptions; // Do not add any lines in this function below here
}
void BatchQueuePanel::addBatchQueueJobs(const std::vector<BatchQueueEntry*>& entries, bool head)