mirror of
				https://github.com/flynx/ImageGrid.git
				synced 2025-10-30 19:00:09 +00:00 
			
		
		
		
	added splash screen...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									b5f28773dd
								
							
						
					
					
						commit
						2e9a9e267f
					
				| @ -28,8 +28,42 @@ var url = require('url') | |||||||
| 
 | 
 | ||||||
| var win | var win | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| function createWindow(){ | function createWindow(){ | ||||||
|  | 	// XXX move this to splash.js and use both here and in app.js...
 | ||||||
|  | 	// XXX also show load progress here...
 | ||||||
|  | 	var splash = global.splash = new BrowserWindow({ | ||||||
|  | 		// let the window to get ready before we show it to the user...
 | ||||||
|  | 		show: false, | ||||||
|  | 
 | ||||||
|  | 		transparent: true, | ||||||
|  | 		frame: false, | ||||||
|  | 		center: true, | ||||||
|  | 		width: 800,  | ||||||
|  | 		height: 500, | ||||||
|  | 		//backgroundColor: '#333333',
 | ||||||
|  | 
 | ||||||
|  | 		alwaysOnTop: true, | ||||||
|  | 
 | ||||||
|  | 		resizable: false, | ||||||
|  | 		movable: false, | ||||||
|  | 		minimizable: false, | ||||||
|  | 		maximizable: false, | ||||||
|  | 		fullscreenable: false, | ||||||
|  | 
 | ||||||
|  | 		autoHideMenuBar: true, | ||||||
|  | 	}) | ||||||
|  | 	splash.loadURL(url.format({ | ||||||
|  | 		// XXX unify this with index.html
 | ||||||
|  | 		//pathname: path.join(__dirname, 'index.html'),
 | ||||||
|  | 		pathname: path.join(__dirname, 'splash.html'), | ||||||
|  | 		protocol: 'file:', | ||||||
|  | 		slashes: true | ||||||
|  | 	})) | ||||||
|  | 	splash.once('ready-to-show', function(){ | ||||||
|  | 		splash.show() | ||||||
|  | 	}) | ||||||
|  | 	//*/
 | ||||||
|  | 
 | ||||||
| 	// 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...
 | ||||||
| @ -47,7 +81,6 @@ function createWindow(){ | |||||||
| 
 | 
 | ||||||
| 		//autoHideMenuBar: true,
 | 		//autoHideMenuBar: true,
 | ||||||
| 	}) | 	}) | ||||||
| 
 |  | ||||||
| 	// disable default menu...
 | 	// disable default menu...
 | ||||||
| 	win.setMenu(null) | 	win.setMenu(null) | ||||||
| 
 | 
 | ||||||
| @ -60,6 +93,11 @@ function createWindow(){ | |||||||
| 		slashes: true | 		slashes: true | ||||||
| 	})) | 	})) | ||||||
| 
 | 
 | ||||||
|  | 	// XXX HACK: pass this in a formal way...
 | ||||||
|  | 	win.once('ready-to-show', function(){ | ||||||
|  | 		global.readyToShow = true | ||||||
|  | 	}) | ||||||
|  | 
 | ||||||
| 	// Open the DevTools.
 | 	// Open the DevTools.
 | ||||||
| 	//win.webContents.openDevTools()
 | 	//win.webContents.openDevTools()
 | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -9,6 +9,7 @@ | |||||||
| 
 | 
 | ||||||
| if(typeof(process) != 'undefined'){ | if(typeof(process) != 'undefined'){ | ||||||
| 	var pathlib = requirejs('path') | 	var pathlib = requirejs('path') | ||||||
|  | 	var url = require('url') | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| var electron | var electron | ||||||
| @ -178,7 +179,16 @@ var ElectronHostActions = actions.Actions({ | |||||||
| 
 | 
 | ||||||
| 	show: ['- Window/', | 	show: ['- Window/', | ||||||
| 		function(){ | 		function(){ | ||||||
| 			electron.remote.getCurrentWindow().show() }], | 			if(electron.remote.getGlobal('readyToShow')){ | ||||||
|  | 				electron.remote.getCurrentWindow().show() | ||||||
|  | 
 | ||||||
|  | 			} else { | ||||||
|  | 				var win = electron.remote.getCurrentWindow() | ||||||
|  | 				win.once('ready-to-show', function(){ | ||||||
|  | 					win.show() | ||||||
|  | 				}) | ||||||
|  | 			} | ||||||
|  | 		}], | ||||||
| 	minimize: ['Window/Minimize', | 	minimize: ['Window/Minimize', | ||||||
| 		function(){ | 		function(){ | ||||||
| 			electron.remote.getCurrentWindow().minimize() }], | 			electron.remote.getCurrentWindow().minimize() }], | ||||||
| @ -256,16 +266,29 @@ var ElectronHostActions = actions.Actions({ | |||||||
| 
 | 
 | ||||||
| 	// XXX make this a real toggler...
 | 	// XXX make this a real toggler...
 | ||||||
| 	toggleSplashScreen: ['Interface/', | 	toggleSplashScreen: ['Interface/', | ||||||
| 		function(){ | 		function(action){ | ||||||
| 			var splash = this.splash = new electron.BrowserWindow({ | 			var splash = this.splash = (!this.splash || this.splash.isDestroyed()) ? | ||||||
|  | 				electron.remote.getGlobal('splash') | ||||||
|  | 				: this.splash | ||||||
|  | 
 | ||||||
|  | 			if(action == '?'){ | ||||||
|  | 				return !splash || splash.isDestroyed() ? 'off' : 'on' | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
|  | 			// XXX HACK: use real toggler protocol...
 | ||||||
|  | 			if(action != 'off' && (!splash || splash.isDestroyed())){ | ||||||
|  | 				var splash = this.splash =  | ||||||
|  | 					// XXX move this to splash.js and use both here and in e.js...
 | ||||||
|  | 					new electron.remote.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...
 | ||||||
| 						//show: false,
 | 						//show: false,
 | ||||||
| 
 | 
 | ||||||
|  | 						transparent: true, | ||||||
| 						frame: false, | 						frame: false, | ||||||
| 						center: true, | 						center: true, | ||||||
| 				//backgroundColor: XXX,
 | 						width: 800,  | ||||||
| 				width: 500,  |  | ||||||
| 						height: 500, | 						height: 500, | ||||||
|  | 						//backgroundColor: '#333333',
 | ||||||
| 
 | 
 | ||||||
| 						alwaysOnTop: true, | 						alwaysOnTop: true, | ||||||
| 
 | 
 | ||||||
| @ -283,10 +306,14 @@ var ElectronHostActions = actions.Actions({ | |||||||
| 				// and load the index.html of the app.
 | 				// and load the index.html of the app.
 | ||||||
| 				splash.loadURL(url.format({ | 				splash.loadURL(url.format({ | ||||||
| 					// XXX unify this with index.html
 | 					// XXX unify this with index.html
 | ||||||
| 				pathname: path.join(__dirname, 'splash.html'), | 					pathname: pathlib.join(__dirname, 'splash.html'), | ||||||
| 					protocol: 'file:', | 					protocol: 'file:', | ||||||
| 					slashes: true | 					slashes: true | ||||||
| 				})) | 				})) | ||||||
|  | 
 | ||||||
|  | 			} else if(action != 'on' && splash){ | ||||||
|  | 				splash.destroy() | ||||||
|  | 			} | ||||||
| 		}], | 		}], | ||||||
| }) | }) | ||||||
| 
 | 
 | ||||||
| @ -393,7 +420,8 @@ module.PortableAppControl = core.ImageGridFeatures.Feature({ | |||||||
| 
 | 
 | ||||||
| var WindowedAppControlActions = actions.Actions({ | var WindowedAppControlActions = actions.Actions({ | ||||||
| 	config: { | 	config: { | ||||||
| 		'window-delay-initial-display': 200, | 		'window-delay-initial-display': 500, | ||||||
|  | 		'splash-screen-delay-hide': 200, | ||||||
| 
 | 
 | ||||||
| 		'show-splash-screen': 'on', | 		'show-splash-screen': 'on', | ||||||
| 	}, | 	}, | ||||||
| @ -475,11 +503,6 @@ var WindowedAppControlActions = actions.Actions({ | |||||||
| 				|| this.toggleInterfaceScale('??')[0]) | 				|| this.toggleInterfaceScale('??')[0]) | ||||||
| 			*/ | 			*/ | ||||||
| 
 | 
 | ||||||
| 			// NOTE: we delay this to enable the browser time to render
 |  | ||||||
| 			// 		things before we show them to the user...
 |  | ||||||
| 			setTimeout(function(){ |  | ||||||
| 				that.show() |  | ||||||
| 
 |  | ||||||
| 			// XXX check if we are full screen...
 | 			// XXX check if we are full screen...
 | ||||||
| 			if(cfg != null && cfg.fullscreen){ | 			if(cfg != null && cfg.fullscreen){ | ||||||
| 				that.toggleFullScreen('on') | 				that.toggleFullScreen('on') | ||||||
| @ -488,6 +511,14 @@ var WindowedAppControlActions = actions.Actions({ | |||||||
| 			// declare we are ready...
 | 			// declare we are ready...
 | ||||||
| 			$(function(){ that.declareReady() }) | 			$(function(){ that.declareReady() }) | ||||||
| 
 | 
 | ||||||
|  | 			// NOTE: we delay this to enable the browser time to render
 | ||||||
|  | 			// 		things before we show them to the user...
 | ||||||
|  | 			setTimeout(function(){ | ||||||
|  | 				that.show() | ||||||
|  | 
 | ||||||
|  | 				setTimeout(function(){ | ||||||
|  | 					that.toggleSplashScreen('off') | ||||||
|  | 				}, that.config['splash-screen-delay-hide'] || 0) | ||||||
| 			}, this.config['window-delay-initial-display'] || 0) | 			}, this.config['window-delay-initial-display'] || 0) | ||||||
| 		}], | 		}], | ||||||
| 
 | 
 | ||||||
|  | |||||||
							
								
								
									
										
											BIN
										
									
								
								ui (gen4)/images/splash-800x500.jpg
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								ui (gen4)/images/splash-800x500.jpg
									
									
									
									
									
										Executable file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 21 KiB | 
							
								
								
									
										
											BIN
										
									
								
								ui (gen4)/images/splash-800x500.png
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								ui (gen4)/images/splash-800x500.png
									
									
									
									
									
										Executable file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 204 KiB | 
							
								
								
									
										
											BIN
										
									
								
								ui (gen4)/images/splash.png
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								ui (gen4)/images/splash.png
									
									
									
									
									
										Executable file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 408 KiB | 
							
								
								
									
										50
									
								
								ui (gen4)/splash.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								ui (gen4)/splash.html
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,50 @@ | |||||||
|  | <html> | ||||||
|  | 
 | ||||||
|  | <link rel="prefetch" href="css/fonts/Open_Sans/OpenSans-Regular.ttf" /> | ||||||
|  | <link rel="stylesheet" href="css/fonts.css" /> | ||||||
|  | 
 | ||||||
|  | <style> | ||||||
|  | body { | ||||||
|  | 	font-family: OpenSans, sans-serif; | ||||||
|  | 	background-color: transparent; | ||||||
|  | } | ||||||
|  | .block { | ||||||
|  | 	position: absolute; | ||||||
|  | 	top: 40px; | ||||||
|  | 	left: 40px; | ||||||
|  | 	right: 40px; | ||||||
|  | 	bottom: 40px; | ||||||
|  | 	background-image: url('images/splash-800x500.jpg'); | ||||||
|  | 	background-size: cover; | ||||||
|  | 	background-color: #333333; | ||||||
|  | 	box-shadow: inset 0px 0px 100px 0px rgba(0,0,0,1), | ||||||
|  | 		10px 10px 60px 0px rgba(0,0,0,0.7);	 | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | .title { | ||||||
|  | 	position: absolute; | ||||||
|  | 	bottom: 10pt; | ||||||
|  | 	right: 20pt; | ||||||
|  | 	color: white; | ||||||
|  | 	font-size: 20pt; | ||||||
|  | 	text-align: right; | ||||||
|  | } | ||||||
|  | .title span { | ||||||
|  | 	display: block; | ||||||
|  | 	margin-top: -8pt; | ||||||
|  | 	margin-right: -8pt; | ||||||
|  | 	font-size: 10pt; | ||||||
|  | 	font-style: italic; | ||||||
|  | 	opacity: 0.3; | ||||||
|  | } | ||||||
|  | </style> | ||||||
|  | 
 | ||||||
|  | <body> | ||||||
|  | 	<div class="block"> | ||||||
|  | 		<div class="title"> | ||||||
|  | 			ImageGrid.Viewer | ||||||
|  | 			<span>v4.0.0a</span> | ||||||
|  | 		</div> | ||||||
|  | 	</div> | ||||||
|  | </body> | ||||||
|  | </html> | ||||||
| @ -190,6 +190,11 @@ $(function(){ | |||||||
| 			} | 			} | ||||||
| 		}) | 		}) | ||||||
| 		//*/
 | 		//*/
 | ||||||
|  | 		/* XXX should this be here??? | ||||||
|  | 		.run(function(){ | ||||||
|  | 			this.toggleSplashScreen  | ||||||
|  | 				&& this.toggleSplashScreen('on') }) | ||||||
|  | 		//*/
 | ||||||
| 		.start() | 		.start() | ||||||
| }) | }) | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user