mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 18:30:09 +00:00
refactoring...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
fbebdd035f
commit
6725f2fab1
@ -291,12 +291,92 @@ module.ElectronHost = core.ImageGridFeatures.Feature({
|
|||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
|
// XXX this needs to trigger only when fullwindow browser mode and not
|
||||||
|
// get loaded when in widget mode...
|
||||||
|
|
||||||
|
var BrowserHostActions = actions.Actions({
|
||||||
|
// window stuff...
|
||||||
|
get title(){
|
||||||
|
return $('title').text() },
|
||||||
|
set title(value){
|
||||||
|
$('title').text(value) },
|
||||||
|
})
|
||||||
|
|
||||||
|
// NOTE: keep this defined last as a fallback...
|
||||||
|
var BrowserHost =
|
||||||
|
module.BrowserHost = core.ImageGridFeatures.Feature({
|
||||||
|
title: '',
|
||||||
|
doc: '',
|
||||||
|
|
||||||
|
tag: 'ui-browser-host',
|
||||||
|
exclusive: 'ui-host',
|
||||||
|
depends: [],
|
||||||
|
|
||||||
|
actions: BrowserHostActions,
|
||||||
|
|
||||||
|
isApplicable: function(){ return !this.runtime.widget },
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------
|
||||||
|
|
||||||
|
var PortableAppControl =
|
||||||
|
module.PortableAppControl = core.ImageGridFeatures.Feature({
|
||||||
|
title: '',
|
||||||
|
doc: '',
|
||||||
|
|
||||||
|
tag: 'ui-portable-app-control',
|
||||||
|
depends: [
|
||||||
|
'ui',
|
||||||
|
'ui-host',
|
||||||
|
],
|
||||||
|
|
||||||
|
isApplicable: function(){ return this.runtime.browser },
|
||||||
|
|
||||||
var AppControlActions = actions.Actions({
|
|
||||||
config: {
|
config: {
|
||||||
//'window-title': 'ImageGrid.Viewer (${VERSION}): ${FILENAME}',
|
//'window-title': 'ImageGrid.Viewer (${VERSION}): ${FILENAME}',
|
||||||
'window-title': '${FILENAME} - ImageGrid.Viewer (${VERSION})',
|
'window-title': '${FILENAME} - ImageGrid.Viewer (${VERSION})',
|
||||||
|
},
|
||||||
|
|
||||||
|
handlers: [
|
||||||
|
// update window title...
|
||||||
|
// XXX make this generic...
|
||||||
|
['focusImage',
|
||||||
|
function(){
|
||||||
|
if(this.images){
|
||||||
|
var img = this.images[this.current]
|
||||||
|
this.title = (this.config['window-title']
|
||||||
|
|| 'ImageGrid.Viewer (${VERSION}): ${FILENAME}')
|
||||||
|
// XXX get this from the viewer...
|
||||||
|
.replace('${VERSION}', this.version || 'gen4')
|
||||||
|
.replace('${FILENAME}',
|
||||||
|
img ?
|
||||||
|
(img.name
|
||||||
|
|| (img.path && img.path.replace(/\.[\\\/]/, ''))
|
||||||
|
|| this.current
|
||||||
|
|| '')
|
||||||
|
: (this.current || ''))
|
||||||
|
.replace('${PATH}',
|
||||||
|
(img && img.path) ?
|
||||||
|
(img.base_path || '.')
|
||||||
|
+'/'+ img.path.replace(/\.[\\\/]/, '')
|
||||||
|
: '')
|
||||||
|
/*
|
||||||
|
.replace('${DIR}',
|
||||||
|
pathlib.dirname((img.base_path || '.')
|
||||||
|
+'/'+ img.path.replace(/\.[\\\/]/, '')))
|
||||||
|
*/
|
||||||
|
// XXX add ...
|
||||||
|
}
|
||||||
|
}],
|
||||||
|
],
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------
|
||||||
|
|
||||||
|
var WindowedAppControlActions = actions.Actions({
|
||||||
|
config: {
|
||||||
'window-delay-initial-display': 200,
|
'window-delay-initial-display': 200,
|
||||||
|
|
||||||
'show-splash-screen': 'on',
|
'show-splash-screen': 'on',
|
||||||
@ -402,18 +482,18 @@ var AppControlActions = actions.Actions({
|
|||||||
// XXX store/load window state...
|
// XXX store/load window state...
|
||||||
// - size
|
// - size
|
||||||
// - state (fullscreen/normal)
|
// - state (fullscreen/normal)
|
||||||
var AppControl =
|
var WindowedAppControl =
|
||||||
module.AppControl = core.ImageGridFeatures.Feature({
|
module.WindowedAppControl = core.ImageGridFeatures.Feature({
|
||||||
title: '',
|
title: '',
|
||||||
doc: '',
|
doc: '',
|
||||||
|
|
||||||
tag: 'ui-app-control',
|
tag: 'ui-windowed-app-control',
|
||||||
depends: [
|
depends: [
|
||||||
'ui',
|
'ui',
|
||||||
'ui-host',
|
'ui-host',
|
||||||
],
|
],
|
||||||
|
|
||||||
actions: AppControlActions,
|
actions: WindowedAppControlActions,
|
||||||
|
|
||||||
// XXX BUG: when running in electron:
|
// XXX BUG: when running in electron:
|
||||||
// - loading this breaks the other buttons (menu, collections, ...)
|
// - loading this breaks the other buttons (menu, collections, ...)
|
||||||
@ -440,40 +520,18 @@ module.AppControl = core.ImageGridFeatures.Feature({
|
|||||||
'toggleFullScreen',
|
'toggleFullScreen',
|
||||||
],
|
],
|
||||||
function(){ this.storeWindowGeometry() }],
|
function(){ this.storeWindowGeometry() }],
|
||||||
|
|
||||||
// update window title...
|
|
||||||
// XXX make this generic...
|
|
||||||
['focusImage',
|
|
||||||
function(){
|
|
||||||
if(this.images){
|
|
||||||
var img = this.images[this.current]
|
|
||||||
this.title = (this.config['window-title']
|
|
||||||
|| 'ImageGrid.Viewer (${VERSION}): ${FILENAME}')
|
|
||||||
// XXX get this from the viewer...
|
|
||||||
.replace('${VERSION}', this.version || 'gen4')
|
|
||||||
.replace('${FILENAME}',
|
|
||||||
img ?
|
|
||||||
(img.name
|
|
||||||
|| (img.path && img.path.replace(/\.[\\\/]/, ''))
|
|
||||||
|| '')
|
|
||||||
: '')
|
|
||||||
.replace('${PATH}',
|
|
||||||
(img && img.path) ?
|
|
||||||
(img.base_path || '.')
|
|
||||||
+'/'+ img.path.replace(/\.[\\\/]/, '')
|
|
||||||
: '')
|
|
||||||
/*
|
|
||||||
.replace('${DIR}',
|
|
||||||
pathlib.dirname((img.base_path || '.')
|
|
||||||
+'/'+ img.path.replace(/\.[\\\/]/, '')))
|
|
||||||
*/
|
|
||||||
// XXX add ...
|
|
||||||
}
|
|
||||||
}],
|
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------
|
||||||
|
|
||||||
|
var AppControl =
|
||||||
|
module.AppControl = core.ImageGridFeatures.Feature('ui-app-control', [
|
||||||
|
'ui-windowed-app-control',
|
||||||
|
'ui-portable-app-control',
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
// Fullscreen app control buttons...
|
// Fullscreen app control buttons...
|
||||||
|
|||||||
@ -147,9 +147,10 @@ ImageGridFeatures.__actions__ =
|
|||||||
|
|
||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
// Setup runtime info...
|
// Setup runtime info...
|
||||||
// XXX add test if chrome-app...
|
// XXX add chrome-app...
|
||||||
// XXX add test if cordova...
|
// XXX add cordova...
|
||||||
// XXX add test if mobile...
|
// XXX add mobile...
|
||||||
|
// XXX add widget...
|
||||||
|
|
||||||
// XXX should this contain feature versions???
|
// XXX should this contain feature versions???
|
||||||
var runtime = ImageGridFeatures.runtime = {}
|
var runtime = ImageGridFeatures.runtime = {}
|
||||||
|
|||||||
@ -2,6 +2,8 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
|
||||||
|
<title></title>
|
||||||
|
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="msapplication-tap-highlight" content="no" />
|
<meta name="msapplication-tap-highlight" content="no" />
|
||||||
<meta name="viewport" content="width=device-width, user-scalable=no" />
|
<meta name="viewport" content="width=device-width, user-scalable=no" />
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user