mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 02:10:08 +00:00
added spinners to save history and sub-index list + some tweaking and fxes...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
639d3c9edc
commit
dc93052a93
@ -549,20 +549,69 @@ var FileSystemLoaderUIActions = actions.Actions({
|
|||||||
browseIndex: ['File/Load index...', makeBrowseProxy('loadIndex')],
|
browseIndex: ['File/Load index...', makeBrowseProxy('loadIndex')],
|
||||||
browseImages: ['File/Load images...', makeBrowseProxy('loadImages')],
|
browseImages: ['File/Load images...', makeBrowseProxy('loadImages')],
|
||||||
|
|
||||||
// XXX add dialog to list sub-indexes...
|
browseSubIndexes: ['File/List sub-indexes...',
|
||||||
// XXX
|
widgets.makeUIDialog(function(){
|
||||||
|
var that = this
|
||||||
|
var index_dir = this.config['index-dir']
|
||||||
|
|
||||||
|
var o = browse.makeLister(null, function(path, make){
|
||||||
|
var dialog = this
|
||||||
|
var path = that.location.path
|
||||||
|
|
||||||
|
if(that.location.method != 'loadIndex'){
|
||||||
|
make('No indexes loaded...', null, true)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// indicate that we are working...
|
||||||
|
var spinner = make($('<center><div class="loader"/></center>'))
|
||||||
|
|
||||||
|
// XXX we do not need to actually read anything....
|
||||||
|
//file.loadIndex(path, that.config['index-dir'], this.logger)
|
||||||
|
// XXX we need to prune the indexes -- avoid loading nested indexes...
|
||||||
|
file.listIndexes(path, index_dir)
|
||||||
|
.on('end', function(res){
|
||||||
|
|
||||||
|
// we got the data, we can now remove the spinner...
|
||||||
|
spinner.remove()
|
||||||
|
|
||||||
|
res.forEach(function(p){
|
||||||
|
// trim local paths and keep external paths as-is...
|
||||||
|
p = p.split(index_dir)[0]
|
||||||
|
var txt = p.split(path).pop()
|
||||||
|
txt = txt != p ? './'+pathlib.join('.', txt) : txt
|
||||||
|
|
||||||
|
make(txt)
|
||||||
|
.on('open', function(){
|
||||||
|
that.loadIndex(p)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.on('open', function(){
|
||||||
|
o.parent.close()
|
||||||
|
})
|
||||||
|
|
||||||
|
return o
|
||||||
|
})],
|
||||||
|
|
||||||
// NOTE: for multiple indexes this will show the combined history
|
// NOTE: for multiple indexes this will show the combined history
|
||||||
// and selecting a postion will load all the participating
|
// and selecting a postion will load all the participating
|
||||||
// indexes to that date.
|
// indexes to that date.
|
||||||
// NOTE: this will show nothing if .location.method is not loadIndex..
|
// NOTE: this will show nothing if .location.method is not loadIndex..
|
||||||
//
|
//
|
||||||
|
// XXX should this affect .changes ???
|
||||||
// XXX handle named saves...
|
// XXX handle named saves...
|
||||||
// XXX add ability to name a save...
|
// XXX add ability to name a save...
|
||||||
// XXX need to handle saves when loaded a specific history position...
|
// XXX need to handle saves (saveIndex(..) and friends) when loaded
|
||||||
|
// a specific history position...
|
||||||
|
// ...in theory saving and old index will create an incremental
|
||||||
|
// save which should not damage the history and can be fixed
|
||||||
|
// either by removing the actual .json files or simply loading
|
||||||
|
// from a previous position and re-saving... (XXX test)
|
||||||
// XXX should this also list journal stuff or have the ability for
|
// XXX should this also list journal stuff or have the ability for
|
||||||
// extending???
|
// extending???
|
||||||
listSaveHistoryDialog: ['File/History...',
|
listSaveHistory: ['File/History...',
|
||||||
widgets.makeUIDialog(function(){
|
widgets.makeUIDialog(function(){
|
||||||
var that = this
|
var that = this
|
||||||
|
|
||||||
@ -585,6 +634,9 @@ var FileSystemLoaderUIActions = actions.Actions({
|
|||||||
|
|
||||||
make('---')
|
make('---')
|
||||||
|
|
||||||
|
// indicate that we are working...
|
||||||
|
var spinner = make($('<center><div class="loader"/></center>'))
|
||||||
|
|
||||||
that.loadSaveHistoryList()
|
that.loadSaveHistoryList()
|
||||||
.catch(function(err){
|
.catch(function(err){
|
||||||
// XXX
|
// XXX
|
||||||
@ -593,6 +645,9 @@ var FileSystemLoaderUIActions = actions.Actions({
|
|||||||
.then(function(data){
|
.then(function(data){
|
||||||
var list = []
|
var list = []
|
||||||
|
|
||||||
|
// got the data, remove the spinner...
|
||||||
|
spinner.remove()
|
||||||
|
|
||||||
Object.keys(data).forEach(function(path){
|
Object.keys(data).forEach(function(path){
|
||||||
Object.keys(data[path]).forEach(function(d){
|
Object.keys(data[path]).forEach(function(d){
|
||||||
list.push(d)
|
list.push(d)
|
||||||
@ -618,8 +673,9 @@ var FileSystemLoaderUIActions = actions.Actions({
|
|||||||
|
|
||||||
// NOTE: here we will select 'Latest' if nothing
|
// NOTE: here we will select 'Latest' if nothing
|
||||||
// was selected...
|
// was selected...
|
||||||
o.select()
|
dialog.select()
|
||||||
.addClass('highlighted')
|
.addClass('highlighted')
|
||||||
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.on('open', function(){
|
.on('open', function(){
|
||||||
|
|||||||
@ -140,7 +140,7 @@ module.GLOBAL_KEYBOARD = {
|
|||||||
H: {
|
H: {
|
||||||
default: 'flipHorizontal',
|
default: 'flipHorizontal',
|
||||||
ctrl: 'listURLHistory',
|
ctrl: 'listURLHistory',
|
||||||
'ctrl+shift': 'listSaveHistoryDialog',
|
'ctrl+shift': 'listSaveHistory',
|
||||||
alt: 'browseActions: "/History/" -- Open history menu',
|
alt: 'browseActions: "/History/" -- Open history menu',
|
||||||
},
|
},
|
||||||
V: 'flipVertical',
|
V: 'flipVertical',
|
||||||
|
|||||||
@ -25,6 +25,7 @@ var keyboard = require('lib/keyboard')
|
|||||||
var actions = require('lib/actions')
|
var actions = require('lib/actions')
|
||||||
var core = require('features/core')
|
var core = require('features/core')
|
||||||
var base = require('features/base')
|
var base = require('features/base')
|
||||||
|
var widgets = require('features/ui-widgets')
|
||||||
|
|
||||||
var browse = require('lib/widget/browse')
|
var browse = require('lib/widget/browse')
|
||||||
var overlay = require('lib/widget/overlay')
|
var overlay = require('lib/widget/overlay')
|
||||||
@ -327,7 +328,8 @@ var MetadataUIActions = actions.Actions({
|
|||||||
// XXX should we replace 'mode' with nested set of metadata???
|
// XXX should we replace 'mode' with nested set of metadata???
|
||||||
// XXX make this support multiple images...
|
// XXX make this support multiple images...
|
||||||
showMetadata: ['Image/Show metadata',
|
showMetadata: ['Image/Show metadata',
|
||||||
function(image, mode){
|
widgets.makeUIDialog(function(image, mode){
|
||||||
|
//function(image, mode){
|
||||||
var that = this
|
var that = this
|
||||||
image = this.data.getImage(image)
|
image = this.data.getImage(image)
|
||||||
mode = mode || 'disabled'
|
mode = mode || 'disabled'
|
||||||
@ -445,65 +447,65 @@ var MetadataUIActions = actions.Actions({
|
|||||||
}
|
}
|
||||||
|
|
||||||
// XXX might be a good idea to directly bind ctrl-c to copy value...
|
// XXX might be a good idea to directly bind ctrl-c to copy value...
|
||||||
var o = overlay.Overlay(this.ribbons.viewer,
|
var o = browse.makeList(
|
||||||
browse.makeList(
|
null,
|
||||||
null,
|
_buildInfoList(image, metadata),
|
||||||
_buildInfoList(image, metadata),
|
{
|
||||||
{
|
showDisabled: false,
|
||||||
showDisabled: false,
|
|
||||||
})
|
|
||||||
// select value of current item...
|
|
||||||
.on('select', function(evt, elem){
|
|
||||||
if(that.config['metadata-auto-select-mode'] == 'on select'){
|
|
||||||
$(elem).find('.text').last().selectText()
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
// XXX start editing onkeydown...
|
// select value of current item...
|
||||||
.on('keydown', function(){
|
.on('select', function(evt, elem){
|
||||||
// XXX Enter + editable -> edit (only this???)
|
if(that.config['metadata-auto-select-mode'] == 'on select'){
|
||||||
})
|
$(elem).find('.text').last().selectText()
|
||||||
// path selected...
|
}
|
||||||
.open(function(evt, path){
|
})
|
||||||
var editable = RegExp(that.config['metadata-editable-fields']
|
// XXX start editing onkeydown...
|
||||||
.map(function(f){ return util.quoteRegExp(f) })
|
.on('keydown', function(){
|
||||||
.join('|'))
|
// XXX Enter + editable -> edit (only this???)
|
||||||
|
})
|
||||||
|
// path selected...
|
||||||
|
.open(function(evt, path){
|
||||||
|
var editable = RegExp(that.config['metadata-editable-fields']
|
||||||
|
.map(function(f){ return util.quoteRegExp(f) })
|
||||||
|
.join('|'))
|
||||||
|
|
||||||
var elem = o.client.filter(path).find('.text').last()
|
var elem = o.filter(path).find('.text').last()
|
||||||
|
|
||||||
// handle select...
|
// handle select...
|
||||||
if(that.config['metadata-auto-select-mode'] == 'on open'){
|
if(that.config['metadata-auto-select-mode'] == 'on open'){
|
||||||
elem.selectText()
|
elem.selectText()
|
||||||
}
|
}
|
||||||
|
|
||||||
// skip non-editable fields...
|
// skip non-editable fields...
|
||||||
if(editable.test(path)){
|
if(editable.test(path)){
|
||||||
elem
|
elem
|
||||||
.prop('contenteditable', true)
|
.prop('contenteditable', true)
|
||||||
.focus()
|
.focus()
|
||||||
.keydown(function(){
|
.keydown(function(){
|
||||||
event.stopPropagation()
|
event.stopPropagation()
|
||||||
|
|
||||||
var n = keyboard.toKeyName(event.keyCode)
|
var n = keyboard.toKeyName(event.keyCode)
|
||||||
|
|
||||||
// reset to original value...
|
// reset to original value...
|
||||||
if(n == 'Esc'){
|
if(n == 'Esc'){
|
||||||
// XXX
|
// XXX
|
||||||
|
|
||||||
// save value...
|
// save value...
|
||||||
} else if(n == 'Enter' && event.ctrlKey){
|
} else if(n == 'Enter' && event.ctrlKey){
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
|
|
||||||
// XXX
|
// XXX
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}))
|
})
|
||||||
.close(function(){
|
.on('close', function(){
|
||||||
// XXX
|
// XXX
|
||||||
})
|
})
|
||||||
o.client.dom.addClass('metadata-view')
|
|
||||||
|
|
||||||
o.client.updateMetadata = function(metadata){
|
o.dom.addClass('metadata-view')
|
||||||
|
|
||||||
|
o.updateMetadata = function(metadata){
|
||||||
metadata = metadata || that.getMetadata()
|
metadata = metadata || that.getMetadata()
|
||||||
|
|
||||||
// build new data set and update view...
|
// build new data set and update view...
|
||||||
@ -514,7 +516,7 @@ var MetadataUIActions = actions.Actions({
|
|||||||
}
|
}
|
||||||
|
|
||||||
return o
|
return o
|
||||||
}]
|
})]
|
||||||
})
|
})
|
||||||
|
|
||||||
var MetadataUI =
|
var MetadataUI =
|
||||||
@ -556,14 +558,12 @@ module.MetadataFSUI = core.ImageGridFeatures.Feature({
|
|||||||
var that = this
|
var that = this
|
||||||
var reader = this.readMetadata(image)
|
var reader = this.readMetadata(image)
|
||||||
|
|
||||||
return reader && function(overlay){
|
return reader && function(client){
|
||||||
var client = overlay.client
|
|
||||||
var data = client.options.data
|
var data = client.options.data
|
||||||
|
|
||||||
// add a loading indicator...
|
// add a loading indicator...
|
||||||
// NOTE: this will get removed when calling .updateMetadata()
|
// NOTE: this will get overwritten when calling .updateMetadata()
|
||||||
data.push('---')
|
data.push('---')
|
||||||
//data.push($('<center>Loading...</center>'))
|
|
||||||
data.push($('<center><div class="loader"/></center>'))
|
data.push($('<center><div class="loader"/></center>'))
|
||||||
client.update()
|
client.update()
|
||||||
|
|
||||||
|
|||||||
@ -551,23 +551,9 @@ var BrowserPrototype = {
|
|||||||
var skip = false
|
var skip = false
|
||||||
return this.dom.find('.path .dir:not(.cur)')
|
return this.dom.find('.path .dir:not(.cur)')
|
||||||
.map(function(i, e){ return $(e).text() })
|
.map(function(i, e){ return $(e).text() })
|
||||||
.toArray()
|
.toArray() },
|
||||||
},
|
|
||||||
set path(value){
|
set path(value){
|
||||||
this.update(value)
|
this.update(value) },
|
||||||
|
|
||||||
/*
|
|
||||||
// XXX check if path has changed...
|
|
||||||
value = this.path2list(value)
|
|
||||||
var cur = this.path
|
|
||||||
|
|
||||||
// update only if path is different...
|
|
||||||
value.length == cur.length
|
|
||||||
&& cur
|
|
||||||
.filter(function(e, i){ return e == value[i] }).length != cur.length
|
|
||||||
&& this.update(value)
|
|
||||||
*/
|
|
||||||
},
|
|
||||||
|
|
||||||
// String path...
|
// String path...
|
||||||
//
|
//
|
||||||
@ -960,7 +946,7 @@ var BrowserPrototype = {
|
|||||||
.click(function(){
|
.click(function(){
|
||||||
if(!$(this).hasClass('disabled')){
|
if(!$(this).hasClass('disabled')){
|
||||||
//that.push(quoteWS($(this).find('.text').text()))
|
//that.push(quoteWS($(this).find('.text').text()))
|
||||||
that.push($(this).find('.text').text())
|
that.push('"'+ $(this).find('.text').text() +'"')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
// append text elements...
|
// append text elements...
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user