mirror of
				https://github.com/flynx/ImageGrid.git
				synced 2025-11-04 05:10:07 +00:00 
			
		
		
		
	moved preview processing to loadRawDir(...), more tweaking...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									5e5d4cd5c8
								
							
						
					
					
						commit
						16abec2615
					
				@ -358,6 +358,7 @@ if(window.CEF_dumpJSON != null){
 | 
			
		||||
	// NOTE: this will remove the old deferred if it us resolved, thus
 | 
			
		||||
	// 		clearing the "log" of previous operations, unless keep_log
 | 
			
		||||
	// 		is set to true...
 | 
			
		||||
	// XXX need a way to cancel this...
 | 
			
		||||
	window.makeImagesPreviewsQ = function(gids, sizes, mode, keep_log){
 | 
			
		||||
		gids = gids == null ? getClosestGIDs() : gids
 | 
			
		||||
		var previews = []
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										42
									
								
								ui/files.js
									
									
									
									
									
								
							
							
						
						
									
										42
									
								
								ui/files.js
									
									
									
									
									
								
							@ -457,7 +457,7 @@ function saveFileState(name, no_normalize_path){
 | 
			
		||||
// Load a directory as-is
 | 
			
		||||
//
 | 
			
		||||
// 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 === false ? null : prefix
 | 
			
		||||
 | 
			
		||||
@ -485,7 +485,9 @@ function loadRawDir(path, prefix){
 | 
			
		||||
	DATA = dataFromImages(IMAGES)
 | 
			
		||||
	res.notify(prefix, 'Loaded', 'Data.')
 | 
			
		||||
 | 
			
		||||
	updateRibbonsFromFavDirs()
 | 
			
		||||
	// XXX this will reload viewer...
 | 
			
		||||
	//updateRibbonsFromFavDirs()
 | 
			
		||||
	DATA.ribbons = ribbonsFromFavDirs(null, null, imageOrderCmp)
 | 
			
		||||
	res.notify(prefix, 'Loaded', 'Fav dirs.')
 | 
			
		||||
 | 
			
		||||
	MARKED = []
 | 
			
		||||
@ -493,10 +495,30 @@ function loadRawDir(path, prefix){
 | 
			
		||||
	reloadViewer()
 | 
			
		||||
 | 
			
		||||
	// XXX is this the correct place for this???
 | 
			
		||||
	updateImagesOrientationQ()
 | 
			
		||||
	//makeImagesPreviewsQ()
 | 
			
		||||
	res.notify(prefix, 'Loading', 'Images orientation.')
 | 
			
		||||
	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()
 | 
			
		||||
	/*
 | 
			
		||||
	$.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 
 | 
			
		||||
// 		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 === false ? null : prefix
 | 
			
		||||
 | 
			
		||||
@ -543,7 +565,7 @@ function loadDir(path, prefix){
 | 
			
		||||
			res.resolve()
 | 
			
		||||
		})
 | 
			
		||||
		.fail(function(){
 | 
			
		||||
			bubbleProgress('Raw directory', loadRawDir(orig_path), res)
 | 
			
		||||
			bubbleProgress('Raw directory', loadRawDir(orig_path, no_preview_processing), 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(...)
 | 
			
		||||
function updateImageOrientation(gid, no_update_loaded){
 | 
			
		||||
	gid = gid == null ? getImageGID() : gid
 | 
			
		||||
@ -680,14 +704,12 @@ function updateImagesOrientation(gids, no_update_loaded){
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
// queued version of updateImagesOrientation(...)
 | 
			
		||||
//
 | 
			
		||||
// XXX need a way to cancel this...
 | 
			
		||||
function updateImagesOrientationQ(gids, no_update_loaded){
 | 
			
		||||
	gids = gids == null ? getClosestGIDs() : gids
 | 
			
		||||
	var res = []
 | 
			
		||||
 | 
			
		||||
	if(window.getImageOrientation == null){
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	var last = $.Deferred().resolve()
 | 
			
		||||
 | 
			
		||||
	$.each(gids, function(_, gid){
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										4
									
								
								ui/ui.js
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								ui/ui.js
									
									
									
									
									
								
							@ -829,7 +829,8 @@ function loadDirectoryDialog(dfl){
 | 
			
		||||
			toggleMarkedOnlyView('off')
 | 
			
		||||
 | 
			
		||||
			// do the loading...
 | 
			
		||||
			statusNotify(loadDir(path))
 | 
			
		||||
			statusNotify(loadDir(path, !process_previews))
 | 
			
		||||
				/*
 | 
			
		||||
				.done(function(){
 | 
			
		||||
					if(process_previews){ 
 | 
			
		||||
						showStatusQ('Previews: processing started...')
 | 
			
		||||
@ -840,6 +841,7 @@ function loadDirectoryDialog(dfl){
 | 
			
		||||
							})
 | 
			
		||||
					}
 | 
			
		||||
				})
 | 
			
		||||
				*/
 | 
			
		||||
		})
 | 
			
		||||
		.fail(function(){
 | 
			
		||||
			showStatusQ('Open: canceled.')
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user