added select field to formDialog(), added target size to export dialog...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2013-07-08 07:07:26 +04:00
parent e90641e255
commit 8c340780f0
2 changed files with 65 additions and 9 deletions

View File

@ -107,13 +107,13 @@ Roadmap
[_] index and group ALL files in an archive [_] index and group ALL files in an archive
[_] import metadata [_] import metadata
[_] real GIDs [_] real GIDs
[_] % Thumbnail generation strategies [_] 33% Thumbnail generation strategies
[_] extract existing raw thumbnails [_] 0% pass 1: generate really fast previews
[_] make a preview just bigger than the screen first [_] ~1/3 screen - for ribbon
| ...to prevent loading the high-res [_] ~1 screen - for single image mode
| [X] pass 2: generate normal previews
| this should be done BEFORE loading the image -- pre-load phase... [_] extract existing raw thumbnails/previews (for RAW files)
[_] prioritize making thumbs for the ribbon (~350px) [_] add option to export either original or preview (exportDialog)
[_] BUG: shifting last image out of a ribbon misaligns the current ribbon [_] BUG: shifting last image out of a ribbon misaligns the current ribbon
| i.e. the prev ribbon was deleted and the new focused ribbon | i.e. the prev ribbon was deleted and the new focused ribbon
| is aligned as if it was not current... | is aligned as if it was not current...

View File

@ -540,6 +540,53 @@ var FIELD_TYPES = {
}, },
}, },
// format:
// {
// select: ['a', 'b', 'c', ...]
// // default option (optional)...
// default: <number> | <text>
// }
select: {
type: 'select',
text: null,
default: false,
html: '<div class="field choice">'+
'<span class="text"></span>'+
'<select>'+
'<option class="option"></option>'+
'</select>'+
'</div>',
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... // NOTE: a button can have state...
// format: // format:
// { // {
@ -787,16 +834,25 @@ function exportPreviewsDialog(state, dfl){
'%I - global order\n'+ '%I - global order\n'+
'%i - current selection order'] = '%f' '%i - current selection order'] = '%f'
cfg['Fav directory name'] = 'fav' 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} cfg['Destination'] = {ndir: dfl}
var keys = Object.keys(cfg) var keys = Object.keys(cfg)
formDialog(null, '<b>Export:</b> '+ state +'.', cfg, 'OK', 'exportPreviewsDialog') formDialog(null, '<b>Export:</b> '+ state +'.', cfg, 'OK', 'exportPreviewsDialog')
.done(function(data){ .done(function(data){
var s = data[keys[2]]
s = s == 'Original image' ? Math.max.apply(null, PREVIEW_SIZES)*2 : parseInt(s)-5
exportTo( exportTo(
normalizePath(data[keys[2]]), normalizePath(data[keys[3]]),
data[keys[0]], data[keys[0]],
data[keys[1]]) data[keys[1]],
s)
// XXX do real reporting... // XXX do real reporting...
showStatusQ('Copying data...') showStatusQ('Copying data...')
res.resolve(data['']) res.resolve(data[''])