~ubuntu-branches/ubuntu/quantal/shotwell/quantal

« back to all changes in this revision

Viewing changes to src/photos/RawSupport.vala

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2011-08-24 11:45:16 UTC
  • mfrom: (1.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20110824114516-01cf7d83qvc9nse1
Tags: 0.11.0-0ubuntu1
New upstream version, drop patches which are in the new version

Show diffs side-by-side

added added

removed removed

Lines of Context:
136
136
    }
137
137
 
138
138
    public override PhotoFileFormatFlags get_flags() {
139
 
        return PhotoFileFormatFlags.MIMIC_RECOMMENDED;
 
139
        return PhotoFileFormatFlags.NONE;
140
140
    }
141
141
    
142
142
    public override string get_default_extension() {
256
256
    }
257
257
}
258
258
 
 
259
// Development mode of a RAW photo.
 
260
public enum RawDeveloper {
 
261
    SHOTWELL = 0,  // Developed internally by Shotwell
 
262
    CAMERA,        // JPEG from RAW+JPEG pair (if available)
 
263
    EMBEDDED;      // Largest-size
 
264
    
 
265
    public static RawDeveloper[] as_array() {
 
266
        return { SHOTWELL, CAMERA, EMBEDDED };
 
267
    }
 
268
    
 
269
    public string to_string() {
 
270
        switch (this) {
 
271
            case SHOTWELL:
 
272
                return "SHOTWELL";
 
273
            case CAMERA:
 
274
                return "CAMERA";
 
275
            case EMBEDDED:
 
276
                return "EMBEDDED";
 
277
            default:
 
278
                assert_not_reached();
 
279
        }
 
280
    }
 
281
    
 
282
    public static RawDeveloper from_string(string value) {
 
283
        switch (value) {
 
284
            case "SHOTWELL":
 
285
                return SHOTWELL;
 
286
            case "CAMERA":
 
287
                return CAMERA;
 
288
            case "EMBEDDED":
 
289
                return EMBEDDED;
 
290
            default:
 
291
                assert_not_reached();
 
292
        }
 
293
    }
 
294
    
 
295
    public string get_label() {
 
296
        switch (this) {
 
297
            case SHOTWELL:
 
298
                return _("Shotwell");
 
299
            case CAMERA:
 
300
            case EMBEDDED:
 
301
                return _("Camera");
 
302
            default:
 
303
                assert_not_reached();
 
304
        }
 
305
    }
 
306
    
 
307
    // Creates a backing JPEG.
 
308
    // raw_filepath is the full path of the imported RAW file.
 
309
    public BackingPhotoRow create_backing_row_for_development(string raw_filepath) throws Error {
 
310
        BackingPhotoRow ns = new BackingPhotoRow();
 
311
        File master = File.new_for_path(raw_filepath);
 
312
        string name, ext;
 
313
        disassemble_filename(master.get_basename(), out name, out ext);
 
314
        
 
315
        string basename = name + "_" + ext + (this != CAMERA ? ("_" + this.to_string().down()) : "") 
 
316
            + ".jpg";
 
317
        bool c;
 
318
        File? new_back = generate_unique_file(master.get_parent(), basename, out c);
 
319
        claim_file(new_back);
 
320
        ns.file_format = PhotoFileFormat.JFIF;
 
321
        ns.filepath = new_back.get_path();
 
322
        
 
323
        return ns;
 
324
    }
 
325
}