f-spot r4189 - trunk/extensions/DevelopInUFraw
- From: sdelcroix svn gnome org
- To: svn-commits-list gnome org
- Subject: f-spot r4189 - trunk/extensions/DevelopInUFraw
- Date: Fri, 18 Jul 2008 09:22:01 +0000 (UTC)
Author: sdelcroix
Date: Fri Jul 18 09:22:00 2008
New Revision: 4189
URL: http://svn.gnome.org/viewvc/f-spot?rev=4189&view=rev
Log:
apply the patch attached to #521393 from pmjdebruijn
Modified:
trunk/extensions/DevelopInUFraw/DevelopInUFRaw.addin.xml
trunk/extensions/DevelopInUFraw/DevelopInUFRaw.cs
Modified: trunk/extensions/DevelopInUFraw/DevelopInUFRaw.addin.xml
==============================================================================
--- trunk/extensions/DevelopInUFraw/DevelopInUFRaw.addin.xml (original)
+++ trunk/extensions/DevelopInUFraw/DevelopInUFRaw.addin.xml Fri Jul 18 09:22:00 2008
@@ -1,6 +1,6 @@
<Addin namespace="FSpot"
id="DevelopInUFraw"
- version="0.4.4.100"
+ version="0.4.4.101"
name="DevelopInUFRaw"
description="Develop the image in UFRaw, saves the result as a new version\n\nNote: Require ufraw 0.13 or CVS version newer than 2007-09-06 !!!"
author="Stephane Delcroix"
Modified: trunk/extensions/DevelopInUFraw/DevelopInUFRaw.cs
==============================================================================
--- trunk/extensions/DevelopInUFraw/DevelopInUFRaw.cs (original)
+++ trunk/extensions/DevelopInUFraw/DevelopInUFRaw.cs Fri Jul 18 09:22:00 2008
@@ -65,6 +65,16 @@
// The executable used for developing RAWs
private string executable;
+ public const string APP_FSPOT_EXTENSION = Preferences.APP_FSPOT + "extension/";
+ public const string EXTENSION_DEVELOPINUFRAW = "developinufraw/";
+ public const string UFRAW_JPEG_QUALITY_KEY = APP_FSPOT_EXTENSION + EXTENSION_DEVELOPINUFRAW + "ufraw_jpeg_quality";
+ public const string UFRAW_ARGUMENTS_KEY = APP_FSPOT_EXTENSION + EXTENSION_DEVELOPINUFRAW + "ufraw_arguments";
+ public const string UFRAW_BATCH_ARGUMENTS_KEY = APP_FSPOT_EXTENSION + EXTENSION_DEVELOPINUFRAW + "ufraw_batch_arguments";
+
+ int ufraw_jpeg_quality;
+ string ufraw_args;
+ string ufraw_batch_args;
+
public AbstractDevelopInUFRaw(string executable)
{
this.executable = executable;
@@ -74,6 +84,10 @@
protected void DevelopPhoto (Photo p)
{
+ LoadPreference (UFRAW_JPEG_QUALITY_KEY);
+ LoadPreference (UFRAW_ARGUMENTS_KEY);
+ LoadPreference (UFRAW_BATCH_ARGUMENTS_KEY);
+
PhotoVersion raw = p.GetVersion (Photo.OriginalVersionId) as PhotoVersion;
if (!ImageFile.IsRaw (raw.Uri.AbsolutePath)) {
Log.Warning ("The original version of this image is not a (supported) RAW file");
@@ -89,7 +103,23 @@
idfile = "--conf=" + Path.ChangeExtension (raw.Uri.LocalPath, ".ufraw");
}
- string args = String.Format("--overwrite --create-id=also --compression=98 --out-type=jpeg {0} --output={1} {2}",
+ if (ufraw_jpeg_quality < 1 || ufraw_jpeg_quality > 100) {
+ Log.Debug ("Invalid JPEG quality specified, defaulting to quality 98");
+ ufraw_jpeg_quality = 98;
+ }
+
+ string args = "";
+ switch (executable) {
+ case "ufraw":
+ args += ufraw_args;
+ break;
+ case "ufraw-batch":
+ args += ufraw_batch_args;
+ break;
+ }
+
+ args += String.Format(" --overwrite --create-id=also --compression={0} --out-type=jpeg {1} --output={2} {3}",
+ ufraw_jpeg_quality,
idfile,
CheapEscape (developed.LocalPath),
CheapEscape (raw.Uri.ToString ()));
@@ -149,5 +179,28 @@
System.Uri uri = p.VersionUri (Photo.OriginalVersionId);
return uri.Scheme + "://" + uri.Host + System.IO.Path.GetDirectoryName (uri.AbsolutePath);
}
+
+ void LoadPreference (string key)
+ {
+ object val = Preferences.Get (key);
+
+ if (val == null)
+ return;
+
+ Log.Debug (String.Format ("Setting {0} to {1}", key, val));
+
+ switch (key) {
+ case UFRAW_JPEG_QUALITY_KEY:
+ ufraw_jpeg_quality = (int) val;
+ break;
+ case UFRAW_ARGUMENTS_KEY:
+ ufraw_args = (string) val;
+ break;
+ case UFRAW_BATCH_ARGUMENTS_KEY:
+ ufraw_batch_args = (string) val;
+ break;
+ }
+ }
+
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]