Add destination path preview label to batch queue panel.
Label initially says "Destination path for the first selected image appears here" so the feature is discoverable. Select a file and it shows the destination path that would be used if it is the first file to be processed and the file does not already exist. Label is updated as the template is edited, so you can see the effect of the edits. If "Save to folder" is selected, the previewed path uses that folder.
This commit is contained in:
@@ -2101,6 +2101,8 @@ QINFO_PIXELSHIFT;Pixel Shift / %2 frame(s)
|
|||||||
QUEUE_AUTOSTART;Auto-start
|
QUEUE_AUTOSTART;Auto-start
|
||||||
QUEUE_AUTOSTART_TOOLTIP;Start processing automatically when a new job arrives.
|
QUEUE_AUTOSTART_TOOLTIP;Start processing automatically when a new job arrives.
|
||||||
QUEUE_DESTFILENAME;Path and file name
|
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_FORMAT_TITLE;File Format
|
||||||
QUEUE_LOCATION_FOLDER;Save to folder
|
QUEUE_LOCATION_FOLDER;Save to folder
|
||||||
QUEUE_LOCATION_TEMPLATE;Use template
|
QUEUE_LOCATION_TEMPLATE;Use template
|
||||||
|
@@ -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)
|
void BatchQueue::openItemInEditor(ThumbBrowserEntryBase* item)
|
||||||
{
|
{
|
||||||
if (item) {
|
if (item) {
|
||||||
@@ -1021,3 +1056,8 @@ void BatchQueue::redrawNeeded (LWButton* button)
|
|||||||
GThreadLock lock;
|
GThreadLock lock;
|
||||||
queue_draw ();
|
queue_draw ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BatchQueue::selectionChanged()
|
||||||
|
{
|
||||||
|
updateDestinationPathPreview();
|
||||||
|
}
|
||||||
|
@@ -38,6 +38,7 @@ public:
|
|||||||
virtual ~BatchQueueListener() = default;
|
virtual ~BatchQueueListener() = default;
|
||||||
virtual void queueSizeChanged(int qsize, bool queueRunning, bool queueError, const Glib::ustring& queueErrorMessage) = 0;
|
virtual void queueSizeChanged(int qsize, bool queueRunning, bool queueError, const Glib::ustring& queueErrorMessage) = 0;
|
||||||
virtual bool canStartNext() = 0;
|
virtual bool canStartNext() = 0;
|
||||||
|
virtual void setDestinationPreviewText(const Glib::ustring& destinationPath) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class FileCatalog;
|
class FileCatalog;
|
||||||
@@ -59,6 +60,7 @@ public:
|
|||||||
void selectAll ();
|
void selectAll ();
|
||||||
void openItemInEditor(ThumbBrowserEntryBase* item);
|
void openItemInEditor(ThumbBrowserEntryBase* item);
|
||||||
void openLastSelectedItemInEditor();
|
void openLastSelectedItemInEditor();
|
||||||
|
void updateDestinationPathPreview();
|
||||||
|
|
||||||
void startProcessing ();
|
void startProcessing ();
|
||||||
|
|
||||||
@@ -79,6 +81,7 @@ public:
|
|||||||
bool keyPressed (GdkEventKey* event) override;
|
bool keyPressed (GdkEventKey* event) override;
|
||||||
void buttonPressed (LWButton* button, int actionCode, void* actionData) override;
|
void buttonPressed (LWButton* button, int actionCode, void* actionData) override;
|
||||||
void redrawNeeded (LWButton* button) override;
|
void redrawNeeded (LWButton* button) override;
|
||||||
|
void selectionChanged () override;
|
||||||
|
|
||||||
void setBatchQueueListener (BatchQueueListener* l)
|
void setBatchQueueListener (BatchQueueListener* l)
|
||||||
{
|
{
|
||||||
|
@@ -108,6 +108,9 @@ BatchQueuePanel::BatchQueuePanel (FileCatalog* aFileCatalog) : parent(nullptr)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
odvb->pack_start (*hb3, Gtk::PACK_SHRINK, 4);
|
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();
|
Gtk::RadioButton::Group g = useTemplate->get_group();
|
||||||
useFolder->set_group (g);
|
useFolder->set_group (g);
|
||||||
fdir->add (*odvb);
|
fdir->add (*odvb);
|
||||||
@@ -122,6 +125,7 @@ BatchQueuePanel::BatchQueuePanel (FileCatalog* aFileCatalog) : parent(nullptr)
|
|||||||
outdirTemplate->set_text (options.savePathTemplate);
|
outdirTemplate->set_text (options.savePathTemplate);
|
||||||
useTemplate->set_active (options.saveUsePathTemplate);
|
useTemplate->set_active (options.saveUsePathTemplate);
|
||||||
useFolder->set_active (!options.saveUsePathTemplate);
|
useFolder->set_active (!options.saveUsePathTemplate);
|
||||||
|
destinationPreviewLabel->set_text (M("QUEUE_DESTPREVIEW_TITLE"));
|
||||||
|
|
||||||
// setup signal handlers
|
// setup signal handlers
|
||||||
outdirTemplate->signal_changed().connect (sigc::mem_fun(*this, &BatchQueuePanel::saveOptions));
|
outdirTemplate->signal_changed().connect (sigc::mem_fun(*this, &BatchQueuePanel::saveOptions));
|
||||||
@@ -329,6 +333,7 @@ void BatchQueuePanel::saveOptions ()
|
|||||||
options.savePathTemplate = outdirTemplate->get_text();
|
options.savePathTemplate = outdirTemplate->get_text();
|
||||||
options.saveUsePathTemplate = useTemplate->get_active();
|
options.saveUsePathTemplate = useTemplate->get_active();
|
||||||
options.procQueueEnabled = qAutoStart->get_active();
|
options.procQueueEnabled = qAutoStart->get_active();
|
||||||
|
batchQueue->updateDestinationPathPreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BatchQueuePanel::handleShortcutKey (GdkEventKey* event)
|
bool BatchQueuePanel::handleShortcutKey (GdkEventKey* event)
|
||||||
@@ -358,6 +363,11 @@ bool BatchQueuePanel::canStartNext ()
|
|||||||
return queueShouldRun;
|
return queueShouldRun;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BatchQueuePanel::setDestinationPreviewText(const Glib::ustring &destinationPath)
|
||||||
|
{
|
||||||
|
destinationPreviewLabel->set_text(destinationPath);
|
||||||
|
}
|
||||||
|
|
||||||
void BatchQueuePanel::pathFolderButtonPressed ()
|
void BatchQueuePanel::pathFolderButtonPressed ()
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -381,6 +391,7 @@ void BatchQueuePanel::pathFolderButtonPressed ()
|
|||||||
void BatchQueuePanel::pathFolderChanged ()
|
void BatchQueuePanel::pathFolderChanged ()
|
||||||
{
|
{
|
||||||
options.savePathFolder = outdirFolder->get_filename();
|
options.savePathFolder = outdirFolder->get_filename();
|
||||||
|
batchQueue->updateDestinationPathPreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BatchQueuePanel::formatChanged(const Glib::ustring& format)
|
void BatchQueuePanel::formatChanged(const Glib::ustring& format)
|
||||||
|
@@ -42,6 +42,7 @@ class BatchQueuePanel : public Gtk::Box,
|
|||||||
Gtk::CheckButton* qAutoStart;
|
Gtk::CheckButton* qAutoStart;
|
||||||
|
|
||||||
Gtk::Entry* outdirTemplate;
|
Gtk::Entry* outdirTemplate;
|
||||||
|
Gtk::Label* destinationPreviewLabel;
|
||||||
MyFileChooserButton* outdirFolder;
|
MyFileChooserButton* outdirFolder;
|
||||||
Gtk::Button* outdirFolderButton;
|
Gtk::Button* outdirFolderButton;
|
||||||
Gtk::RadioButton* useTemplate;
|
Gtk::RadioButton* useTemplate;
|
||||||
@@ -72,6 +73,7 @@ public:
|
|||||||
// batchqueuelistener interface
|
// batchqueuelistener interface
|
||||||
void queueSizeChanged(int qsize, bool queueRunning, bool queueError, const Glib::ustring& queueErrorMessage) override;
|
void queueSizeChanged(int qsize, bool queueRunning, bool queueError, const Glib::ustring& queueErrorMessage) override;
|
||||||
bool canStartNext() override;
|
bool canStartNext() override;
|
||||||
|
void setDestinationPreviewText(const Glib::ustring& destinationPath) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void startBatchProc ();
|
void startBatchProc ();
|
||||||
|
Reference in New Issue
Block a user