moved preview processing to loadRawDir(...), more tweaking...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2013-07-08 04:11:04 +04:00
parent 5e5d4cd5c8
commit 16abec2615
3 changed files with 36 additions and 11 deletions

View File

@ -358,6 +358,7 @@ if(window.CEF_dumpJSON != null){
// NOTE: this will remove the old deferred if it us resolved, thus // NOTE: this will remove the old deferred if it us resolved, thus
// clearing the "log" of previous operations, unless keep_log // clearing the "log" of previous operations, unless keep_log
// is set to true... // is set to true...
// XXX need a way to cancel this...
window.makeImagesPreviewsQ = function(gids, sizes, mode, keep_log){ window.makeImagesPreviewsQ = function(gids, sizes, mode, keep_log){
gids = gids == null ? getClosestGIDs() : gids gids = gids == null ? getClosestGIDs() : gids
var previews = [] var previews = []

View File

@ -457,7 +457,7 @@ function saveFileState(name, no_normalize_path){
// Load a directory as-is // Load a directory as-is
// //
// XXX check if we need to pass down sorting settings to the generators... // XXX check if we need to pass down sorting settings to the generators...
function loadRawDir(path, prefix){ function loadRawDir(path, no_preview_processing, prefix){
prefix = prefix == null ? 'Data' : prefix prefix = prefix == null ? 'Data' : prefix
prefix = prefix === false ? null : prefix prefix = prefix === false ? null : prefix
@ -485,7 +485,9 @@ function loadRawDir(path, prefix){
DATA = dataFromImages(IMAGES) DATA = dataFromImages(IMAGES)
res.notify(prefix, 'Loaded', 'Data.') res.notify(prefix, 'Loaded', 'Data.')
updateRibbonsFromFavDirs() // XXX this will reload viewer...
//updateRibbonsFromFavDirs()
DATA.ribbons = ribbonsFromFavDirs(null, null, imageOrderCmp)
res.notify(prefix, 'Loaded', 'Fav dirs.') res.notify(prefix, 'Loaded', 'Fav dirs.')
MARKED = [] MARKED = []
@ -493,10 +495,30 @@ function loadRawDir(path, prefix){
reloadViewer() reloadViewer()
// XXX is this the correct place for this??? // XXX is this the correct place for this???
updateImagesOrientationQ() res.notify(prefix, 'Loading', 'Images orientation.')
//makeImagesPreviewsQ() var o = updateImagesOrientationQ()
.done(function(){
res.notify(prefix, 'Loaded', 'Images orientation.')
})
if(!no_preview_processing){
res.notify(prefix, 'Loading/Generating', 'Previews.')
var p = makeImagesPreviewsQ()
.done(function(){
res.notify(prefix, 'Loaded', 'Previews.')
})
} else {
var p = 0
}
// XXX we are not waiting for previews and orientation...
return res.resolve() return res.resolve()
/*
$.when(o, p).done(function(){
res.resolve()
})
return res
*/
} }
@ -510,7 +532,7 @@ function loadRawDir(path, prefix){
// //
// NOTE: this will create an images.json file in cache on opening an // NOTE: this will create an images.json file in cache on opening an
// un-cached dir (XXX is this correct???) // un-cached dir (XXX is this correct???)
function loadDir(path, prefix){ function loadDir(path, no_preview_processing, prefix){
prefix = prefix == null ? 'Data' : prefix prefix = prefix == null ? 'Data' : prefix
prefix = prefix === false ? null : prefix prefix = prefix === false ? null : prefix
@ -543,7 +565,7 @@ function loadDir(path, prefix){
res.resolve() res.resolve()
}) })
.fail(function(){ .fail(function(){
bubbleProgress('Raw directory', loadRawDir(orig_path), res) bubbleProgress('Raw directory', loadRawDir(orig_path, no_preview_processing), res)
}) })
return res return res
@ -637,6 +659,8 @@ function exportTo(path, im_name, dir_name, size){
/*********************************************************************/ /*********************************************************************/
// NOTE: this will overwrite current image orientation...
//
// XXX this depends on getImageOrientation(...) // XXX this depends on getImageOrientation(...)
function updateImageOrientation(gid, no_update_loaded){ function updateImageOrientation(gid, no_update_loaded){
gid = gid == null ? getImageGID() : gid gid = gid == null ? getImageGID() : gid
@ -680,14 +704,12 @@ function updateImagesOrientation(gids, no_update_loaded){
// queued version of updateImagesOrientation(...) // queued version of updateImagesOrientation(...)
//
// XXX need a way to cancel this...
function updateImagesOrientationQ(gids, no_update_loaded){ function updateImagesOrientationQ(gids, no_update_loaded){
gids = gids == null ? getClosestGIDs() : gids gids = gids == null ? getClosestGIDs() : gids
var res = [] var res = []
if(window.getImageOrientation == null){
return
}
var last = $.Deferred().resolve() var last = $.Deferred().resolve()
$.each(gids, function(_, gid){ $.each(gids, function(_, gid){

View File

@ -829,7 +829,8 @@ function loadDirectoryDialog(dfl){
toggleMarkedOnlyView('off') toggleMarkedOnlyView('off')
// do the loading... // do the loading...
statusNotify(loadDir(path)) statusNotify(loadDir(path, !process_previews))
/*
.done(function(){ .done(function(){
if(process_previews){ if(process_previews){
showStatusQ('Previews: processing started...') showStatusQ('Previews: processing started...')
@ -840,6 +841,7 @@ function loadDirectoryDialog(dfl){
}) })
} }
}) })
*/
}) })
.fail(function(){ .fail(function(){
showStatusQ('Open: canceled.') showStatusQ('Open: canceled.')