diff --git a/rtdata/languages/default b/rtdata/languages/default index 403fccdf0..2f22b4642 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -2101,6 +2101,8 @@ QINFO_PIXELSHIFT;Pixel Shift / %2 frame(s) QUEUE_AUTOSTART;Auto-start QUEUE_AUTOSTART_TOOLTIP;Start processing automatically when a new job arrives. QUEUE_DESTFILENAME;Path and file name +QUEUE_DESTPREVIEW_TITLE;Select a thumbnail to preview its destination path here +QUEUE_DESTPREVIEW_TOOLTIP;Destination path for the first selected image appears here QUEUE_FORMAT_TITLE;File Format QUEUE_LOCATION_FOLDER;Save to folder QUEUE_LOCATION_TEMPLATE;Use template diff --git a/rtgui/batchqueue.cc b/rtgui/batchqueue.cc index 6ab75bd47..8d2ad176e 100644 --- a/rtgui/batchqueue.cc +++ b/rtgui/batchqueue.cc @@ -567,6 +567,41 @@ void BatchQueue::openLastSelectedItemInEditor() } } +void BatchQueue::updateDestinationPathPreview() +{ + MYWRITERLOCK(l, entryRW); + + if (selected.size()) + { + auto &entry = *selected.at(0); + int sequence = 0; // Sequence during subsequent queue processing can't be determined here + Glib::ustring baseDestination; + if (options.saveUsePathTemplate) + { + baseDestination = calcAutoFileNameBase(entry.filename, sequence); + } + else + { + Glib::ustring baseFilename; + int extpos = entry.filename.size() - 1; + for (; extpos >= 0 && entry.filename[extpos] != '.'; extpos--) + { + } + for (int k = extpos - 1; k >= 0 && entry.filename[k] != '/' && entry.filename[k] != '\\'; k--) + { + baseFilename = entry.filename[k] + baseFilename; + } + baseDestination = options.savePathFolder + '/' + baseFilename; + } + Glib::ustring destination = Glib::ustring::compose ("%1.%2", baseDestination, options.saveFormatBatch.format); + + if (listener) + { + listener->setDestinationPreviewText(destination); + } + } +} + void BatchQueue::openItemInEditor(ThumbBrowserEntryBase* item) { if (item) { @@ -1021,3 +1056,8 @@ void BatchQueue::redrawNeeded (LWButton* button) GThreadLock lock; queue_draw (); } + +void BatchQueue::selectionChanged() +{ + updateDestinationPathPreview(); +} diff --git a/rtgui/batchqueue.h b/rtgui/batchqueue.h index 5cde37748..f8f1cf255 100644 --- a/rtgui/batchqueue.h +++ b/rtgui/batchqueue.h @@ -38,6 +38,7 @@ public: virtual ~BatchQueueListener() = default; virtual void queueSizeChanged(int qsize, bool queueRunning, bool queueError, const Glib::ustring& queueErrorMessage) = 0; virtual bool canStartNext() = 0; + virtual void setDestinationPreviewText(const Glib::ustring& destinationPath) = 0; }; class FileCatalog; @@ -59,6 +60,7 @@ public: void selectAll (); void openItemInEditor(ThumbBrowserEntryBase* item); void openLastSelectedItemInEditor(); + void updateDestinationPathPreview(); void startProcessing (); @@ -79,6 +81,7 @@ public: bool keyPressed (GdkEventKey* event) override; void buttonPressed (LWButton* button, int actionCode, void* actionData) override; void redrawNeeded (LWButton* button) override; + void selectionChanged () override; void setBatchQueueListener (BatchQueueListener* l) { diff --git a/rtgui/batchqueuepanel.cc b/rtgui/batchqueuepanel.cc index 8a6dd25b4..59201d9f3 100644 --- a/rtgui/batchqueuepanel.cc +++ b/rtgui/batchqueuepanel.cc @@ -108,6 +108,9 @@ BatchQueuePanel::BatchQueuePanel (FileCatalog* aFileCatalog) : parent(nullptr) #endif odvb->pack_start (*hb3, Gtk::PACK_SHRINK, 4); + destinationPreviewLabel = Gtk::manage (new Gtk::Label ()); + destinationPreviewLabel->set_tooltip_markup(M("QUEUE_DESTPREVIEW_TOOLTIP")); + odvb->pack_start (*destinationPreviewLabel); Gtk::RadioButton::Group g = useTemplate->get_group(); useFolder->set_group (g); fdir->add (*odvb); @@ -122,6 +125,7 @@ BatchQueuePanel::BatchQueuePanel (FileCatalog* aFileCatalog) : parent(nullptr) outdirTemplate->set_text (options.savePathTemplate); useTemplate->set_active (options.saveUsePathTemplate); useFolder->set_active (!options.saveUsePathTemplate); + destinationPreviewLabel->set_text (M("QUEUE_DESTPREVIEW_TITLE")); // setup signal handlers outdirTemplate->signal_changed().connect (sigc::mem_fun(*this, &BatchQueuePanel::saveOptions)); @@ -329,6 +333,7 @@ void BatchQueuePanel::saveOptions () options.savePathTemplate = outdirTemplate->get_text(); options.saveUsePathTemplate = useTemplate->get_active(); options.procQueueEnabled = qAutoStart->get_active(); + batchQueue->updateDestinationPathPreview(); } bool BatchQueuePanel::handleShortcutKey (GdkEventKey* event) @@ -358,6 +363,11 @@ bool BatchQueuePanel::canStartNext () return queueShouldRun; } +void BatchQueuePanel::setDestinationPreviewText(const Glib::ustring &destinationPath) +{ + destinationPreviewLabel->set_text(destinationPath); +} + void BatchQueuePanel::pathFolderButtonPressed () { @@ -381,6 +391,7 @@ void BatchQueuePanel::pathFolderButtonPressed () void BatchQueuePanel::pathFolderChanged () { options.savePathFolder = outdirFolder->get_filename(); + batchQueue->updateDestinationPathPreview(); } void BatchQueuePanel::formatChanged(const Glib::ustring& format) diff --git a/rtgui/batchqueuepanel.h b/rtgui/batchqueuepanel.h index db4e243e9..d73f8b893 100644 --- a/rtgui/batchqueuepanel.h +++ b/rtgui/batchqueuepanel.h @@ -42,6 +42,7 @@ class BatchQueuePanel : public Gtk::Box, Gtk::CheckButton* qAutoStart; Gtk::Entry* outdirTemplate; + Gtk::Label* destinationPreviewLabel; MyFileChooserButton* outdirFolder; Gtk::Button* outdirFolderButton; Gtk::RadioButton* useTemplate; @@ -72,6 +73,7 @@ public: // batchqueuelistener interface void queueSizeChanged(int qsize, bool queueRunning, bool queueError, const Glib::ustring& queueErrorMessage) override; bool canStartNext() override; + void setDestinationPreviewText(const Glib::ustring& destinationPath) override; private: void startBatchProc ();