From 8c340780f06ecdee853386364a19faec0a2bd376 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Mon, 8 Jul 2013 07:07:26 +0400 Subject: [PATCH] added select field to formDialog(), added target size to export dialog... Signed-off-by: Alex A. Naanou --- ui/TODO.otl | 14 ++++++------- ui/ui.js | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 65 insertions(+), 9 deletions(-) diff --git a/ui/TODO.otl b/ui/TODO.otl index f50cfb15..4841b3c9 100755 --- a/ui/TODO.otl +++ b/ui/TODO.otl @@ -107,13 +107,13 @@ Roadmap [_] index and group ALL files in an archive [_] import metadata [_] real GIDs - [_] % Thumbnail generation strategies - [_] extract existing raw thumbnails - [_] make a preview just bigger than the screen first - | ...to prevent loading the high-res - | - | this should be done BEFORE loading the image -- pre-load phase... - [_] prioritize making thumbs for the ribbon (~350px) + [_] 33% Thumbnail generation strategies + [_] 0% pass 1: generate really fast previews + [_] ~1/3 screen - for ribbon + [_] ~1 screen - for single image mode + [X] pass 2: generate normal previews + [_] extract existing raw thumbnails/previews (for RAW files) + [_] add option to export either original or preview (exportDialog) [_] BUG: shifting last image out of a ribbon misaligns the current ribbon | i.e. the prev ribbon was deleted and the new focused ribbon | is aligned as if it was not current... diff --git a/ui/ui.js b/ui/ui.js index 165f4aae..80ce11f0 100755 --- a/ui/ui.js +++ b/ui/ui.js @@ -540,6 +540,53 @@ var FIELD_TYPES = { }, }, + // format: + // { + // select: ['a', 'b', 'c', ...] + // // default option (optional)... + // default: | + // } + select: { + type: 'select', + text: null, + default: false, + html: '
'+ + ''+ + ''+ + '
', + test: function(val){ + return 'select' in val + }, + set: function(field, value){ + var t = field.find('.text').text() + var item = field.find('.option').last() + var select = field.find('select') + for(var i=0; i < value.select.length; i++){ + item + .text(value.select[i]) + .val(value.select[i]) + item.appendTo(select) + + item = item.clone() + } + if(value.default != null){ + if(typeof(value.default) == typeof(123)){ + field.find('.option') + .eq(value.default) + .attr('selected', '') + } else { + field.find('.option[value="'+ value.default +'"]') + .attr('selected', '') + } + } + }, + get: function(field){ + return $(field).find('.option:selected').val() + }, + }, + // NOTE: a button can have state... // format: // { @@ -787,16 +834,25 @@ function exportPreviewsDialog(state, dfl){ '%I - global order\n'+ '%i - current selection order'] = '%f' cfg['Fav directory name'] = 'fav' + cfg['Size | '+ + 'The selected size is aproximate, the actual\n'+ + 'preview will be copied from cache.'] = { + select: ['Original image'].concat(PREVIEW_SIZES.slice().sort()), + default: 1 + } cfg['Destination'] = {ndir: dfl} var keys = Object.keys(cfg) formDialog(null, 'Export: '+ state +'.', cfg, 'OK', 'exportPreviewsDialog') .done(function(data){ + var s = data[keys[2]] + s = s == 'Original image' ? Math.max.apply(null, PREVIEW_SIZES)*2 : parseInt(s)-5 exportTo( - normalizePath(data[keys[2]]), + normalizePath(data[keys[3]]), data[keys[0]], - data[keys[1]]) + data[keys[1]], + s) // XXX do real reporting... showStatusQ('Copying data...') res.resolve(data[''])