Open batch result file with OS default program; See issue #372
This commit is contained in:
parent
25759b48d9
commit
411cb1470c
@ -292,7 +292,8 @@ rtengine::ProcessingJob* BatchQueue::imageReady (rtengine::IImage16* img) {
|
||||
Glib::ustring fname;
|
||||
SaveFormat saveFormat;
|
||||
if (processing->outFileName=="") { // auto file name
|
||||
fname = obtainFileName (processing->filename);
|
||||
Glib::ustring s = calcAutoFileNameBase (processing->filename);
|
||||
fname = autoCompleteFileName (s, options.saveFormat.format);
|
||||
saveFormat = options.saveFormat;
|
||||
}
|
||||
else { // use the save-as filename with automatic completion for uniqueness
|
||||
@ -300,6 +301,7 @@ rtengine::ProcessingJob* BatchQueue::imageReady (rtengine::IImage16* img) {
|
||||
saveFormat = processing->saveFormat;
|
||||
}
|
||||
//printf ("fname=%s, %s\n", fname.c_str(), removeExtension(fname).c_str());
|
||||
|
||||
if (img && fname!="") {
|
||||
int err = 0;
|
||||
if (saveFormat.format=="tif")
|
||||
@ -333,6 +335,7 @@ rtengine::ProcessingJob* BatchQueue::imageReady (rtengine::IImage16* img) {
|
||||
delete processing;
|
||||
processing = NULL;
|
||||
fd.erase (fd.begin());
|
||||
|
||||
// return next job
|
||||
if (fd.size()==0) {
|
||||
if (listener)
|
||||
@ -371,7 +374,9 @@ rtengine::ProcessingJob* BatchQueue::imageReady (rtengine::IImage16* img) {
|
||||
return processing ? processing->job : NULL;
|
||||
}
|
||||
|
||||
Glib::ustring BatchQueue::obtainFileName (const Glib::ustring& origFileName) {
|
||||
// Calculates automatic filename of processed batch entry, but just the base name
|
||||
// example output: "c:\out\converted\dsc0121"
|
||||
Glib::ustring BatchQueue::calcAutoFileNameBase (const Glib::ustring& origFileName) {
|
||||
|
||||
std::vector<Glib::ustring> pa;
|
||||
std::vector<Glib::ustring> da;
|
||||
@ -445,7 +450,7 @@ Glib::ustring BatchQueue::obtainFileName (const Glib::ustring& origFileName) {
|
||||
else
|
||||
path = Glib::build_filename (options.savePathFolder, filename);
|
||||
|
||||
return autoCompleteFileName (path, options.saveFormat.format);
|
||||
return path;
|
||||
}
|
||||
|
||||
Glib::ustring BatchQueue::autoCompleteFileName (const Glib::ustring& fileName, const Glib::ustring& format) {
|
||||
|
@ -1,7 +1,6 @@
|
||||
/*
|
||||
* This file is part of RawTherapee.
|
||||
*
|
||||
* Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
|
||||
*
|
||||
* RawTherapee is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -54,7 +53,6 @@ class BatchQueue : public ThumbBrowserBase,
|
||||
|
||||
BatchQueueListener* listener;
|
||||
|
||||
Glib::ustring obtainFileName (const Glib::ustring& origFileName);
|
||||
Glib::ustring autoCompleteFileName (const Glib::ustring& fileName, const Glib::ustring& format);
|
||||
Glib::ustring getTempFilenameForParams( const Glib::ustring filename );
|
||||
bool saveBatchQueue( );
|
||||
@ -81,6 +79,8 @@ class BatchQueue : public ThumbBrowserBase,
|
||||
void setBatchQueueListener (BatchQueueListener* l) { listener = l; }
|
||||
void notifyListener ();
|
||||
bool loadBatchQueue ();
|
||||
|
||||
static Glib::ustring calcAutoFileNameBase (const Glib::ustring& origFileName);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -672,6 +672,10 @@ bool EditorPanel::handleShortcutKey (GdkEventKey* event) {
|
||||
case GDK_F:
|
||||
iarea->imageArea->zoomPanel->zoomFitClicked();
|
||||
return true;
|
||||
|
||||
case GDK_F5:
|
||||
openThm->openBatchResultDefaultViewer();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -392,6 +392,11 @@ void FileBrowser::partPasteProfile () {
|
||||
partialPasteDlg.hide ();
|
||||
}
|
||||
|
||||
void FileBrowser::openBatchResultDefaultViewer () {
|
||||
if (selected.size()==1)
|
||||
((FileBrowserEntry*)selected[0])->thumbnail->openBatchResultDefaultViewer();
|
||||
}
|
||||
|
||||
bool FileBrowser::keyPressed (GdkEventKey* event) {
|
||||
|
||||
if ((event->keyval==GDK_C || event->keyval==GDK_c) && event->state & GDK_CONTROL_MASK) {
|
||||
@ -422,6 +427,10 @@ bool FileBrowser::keyPressed (GdkEventKey* event) {
|
||||
menuItemActivated (selall);
|
||||
return true;
|
||||
}
|
||||
else if (event->keyval==GDK_F5) {
|
||||
openBatchResultDefaultViewer ();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -113,6 +113,8 @@ class FileBrowser : public ThumbBrowserBase, public LWButtonListener {
|
||||
void pasteProfile ();
|
||||
void partPasteProfile ();
|
||||
|
||||
void openBatchResultDefaultViewer ();
|
||||
|
||||
void redrawNeeded (ThumbBrowserEntryBase* entry);
|
||||
void thumbRearrangementNeeded ();
|
||||
void _thumbRearrangementNeeded ();
|
||||
|
@ -1,7 +1,6 @@
|
||||
/*
|
||||
* This file is part of RawTherapee.
|
||||
*
|
||||
* Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
|
||||
*
|
||||
* RawTherapee is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -29,6 +28,7 @@
|
||||
#include <glib/gstdio.h>
|
||||
#include <guiutils.h>
|
||||
#include <profilestore.h>
|
||||
#include <batchqueue.h>
|
||||
|
||||
using namespace rtengine::procparams;
|
||||
|
||||
@ -503,3 +503,27 @@ void Thumbnail::removeThumbnailListener (ThumbnailListener* tnl) {
|
||||
}
|
||||
}
|
||||
|
||||
// Calculates the standard filename for the automatically named batch result
|
||||
// and opens it in OS default viewer
|
||||
// Return: Success?
|
||||
bool Thumbnail::openBatchResultDefaultViewer() {
|
||||
Glib::ustring openFName = Glib::ustring::compose ("%1.%2", BatchQueue::calcAutoFileNameBase(fname), options.saveFormat.format);
|
||||
|
||||
printf ("Try opening %s\n", openFName.c_str());
|
||||
|
||||
if (Glib::file_test (openFName, Glib::FILE_TEST_EXISTS)) {
|
||||
|
||||
#ifdef WIN32
|
||||
ShellExecute(NULL, "open", openFName.c_str(), NULL, NULL, SW_SHOWMAXIMIZED);
|
||||
return true;
|
||||
#else
|
||||
// TODO: Add more OSes here
|
||||
printf("Automatic opening not supported on this OS\n");
|
||||
return false;
|
||||
#endif
|
||||
|
||||
} else {
|
||||
printf("File not found\n");
|
||||
return false;
|
||||
}
|
||||
}
|
@ -127,6 +127,8 @@ class Thumbnail {
|
||||
|
||||
void updateCache ();
|
||||
void saveThumbnail ();
|
||||
|
||||
bool openBatchResultDefaultViewer();
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user