some work on splashscreen mechanics...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2017-11-03 03:22:02 +03:00
parent a3f5579faa
commit 86f75e1b68
2 changed files with 49 additions and 1 deletions

View File

@ -27,7 +27,7 @@ var url = require('url')
var win var win
function createWindow() { function createWindow(){
// Create the browser window. // Create the browser window.
win = new BrowserWindow({ win = new BrowserWindow({
// let the window to get ready before we show it to the user... // let the window to get ready before we show it to the user...
@ -66,6 +66,10 @@ function createWindow() {
}) })
} }
//---------------------------------------------------------------------
// This method will be called when Electron has finished // This method will be called when Electron has finished
// initialization and is ready to create browser windows. // initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs. // Some APIs can only be used after this event occurs.

View File

@ -120,6 +120,10 @@ var NWHostActions = actions.Actions({
nw.Shell.showItemInFolder(path) nw.Shell.showItemInFolder(path)
}], }],
toggleSplashScreen: ['Interface/',
function(){
}],
}) })
var NWHost = var NWHost =
@ -226,6 +230,41 @@ var ElectronHostActions = actions.Actions({
.exec('explorer.exe /select,'+JSON.stringify(path.replace(/\//g, '\\'))) .exec('explorer.exe /select,'+JSON.stringify(path.replace(/\//g, '\\')))
//.exec('open -R '+JSON.stringify(path)) //.exec('open -R '+JSON.stringify(path))
}], }],
// XXX make this a real toggler...
toggleSplashScreen: ['Interface/',
function(){
var splash = this.splash = new electron.BrowserWindow({
// let the window to get ready before we show it to the user...
//show: false,
frame: false,
center: true,
//backgroundColor: XXX,
width: 500,
height: 500,
alwaysOnTop: true,
resizable: false,
movable: false,
minimizable: false,
maximizable: false,
fullscreenable: false,
autoHideMenuBar: true,
})
splash.setMenu(null)
// and load the index.html of the app.
splash.loadURL(url.format({
// XXX unify this with index.html
pathname: path.join(__dirname, 'splash.html'),
protocol: 'file:',
slashes: true
}))
}],
}) })
var ElectronHost = var ElectronHost =
@ -252,6 +291,8 @@ var AppControlActions = actions.Actions({
'window-title': '${FILENAME} - ImageGrid.Viewer (${VERSION})', 'window-title': '${FILENAME} - ImageGrid.Viewer (${VERSION})',
'window-delay-initial-display': 200, 'window-delay-initial-display': 200,
'show-splash-screen': 'on',
}, },
// XXX revise these... // XXX revise these...
@ -346,6 +387,9 @@ var AppControlActions = actions.Actions({
}, this.config['window-delay-initial-display'] || 0) }, this.config['window-delay-initial-display'] || 0)
}], }],
toggleSplashScreenShowing: ['Interface/Splash screen on start',
core.makeConfigToggler('show-splash-screen', ['on', 'off'])],
}) })
// XXX store/load window state... // XXX store/load window state...