@@ -49,7 +49,7 @@ function addTorrentFromPaste () {
|
|||||||
|
|
||||||
function setBounds (bounds) {
|
function setBounds (bounds) {
|
||||||
debug('setBounds %o', bounds)
|
debug('setBounds %o', bounds)
|
||||||
if (windows.main && !windows.main.isFullScreen()) {
|
if (windows.main && !windows.main.isFullScreen() && !windows.main.isMaximized()) {
|
||||||
windows.main.setBounds(bounds, true)
|
windows.main.setBounds(bounds, true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,13 +16,14 @@ app.on('before-quit', function () {
|
|||||||
|
|
||||||
function createMainWindow (menu) {
|
function createMainWindow (menu) {
|
||||||
var win = windows.main = new electron.BrowserWindow({
|
var win = windows.main = new electron.BrowserWindow({
|
||||||
|
autoHideMenuBar: true, // Hide top menu bar unless Alt key is pressed (Windows, Linux)
|
||||||
backgroundColor: '#282828',
|
backgroundColor: '#282828',
|
||||||
darkTheme: true,
|
darkTheme: true, // Forces dark theme (GTK+3 only)
|
||||||
minWidth: 375,
|
minWidth: 375,
|
||||||
minHeight: 158,
|
minHeight: 158,
|
||||||
show: false,
|
show: false, // Hide window until DOM finishes loading
|
||||||
title: config.APP_NAME,
|
title: config.APP_NAME,
|
||||||
titleBarStyle: 'hidden-inset',
|
titleBarStyle: 'hidden-inset', // Hide OS chrome, except traffic light buttons (OS X)
|
||||||
width: 450,
|
width: 450,
|
||||||
height: 300
|
height: 300
|
||||||
})
|
})
|
||||||
@@ -33,10 +34,8 @@ function createMainWindow (menu) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
win.webContents.on('did-finish-load', function () {
|
win.webContents.on('did-finish-load', function () {
|
||||||
setTimeout(function () {
|
|
||||||
debug('startup time: %sms', Date.now() - app.startTime)
|
debug('startup time: %sms', Date.now() - app.startTime)
|
||||||
win.show()
|
win.show()
|
||||||
}, 50)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
win.on('blur', menu.onWindowHide)
|
win.on('blur', menu.onWindowHide)
|
||||||
|
|||||||
@@ -163,13 +163,7 @@ function dispatch (action, ...args) {
|
|||||||
if (action === 'back') {
|
if (action === 'back') {
|
||||||
// TODO
|
// TODO
|
||||||
// window.history.back()
|
// window.history.back()
|
||||||
if (state.url === '/player') {
|
closePlayer()
|
||||||
restoreBounds()
|
|
||||||
closeServer()
|
|
||||||
}
|
|
||||||
state.url = '/'
|
|
||||||
state.title = config.APP_NAME
|
|
||||||
update()
|
|
||||||
}
|
}
|
||||||
if (action === 'forward') {
|
if (action === 'forward') {
|
||||||
// TODO
|
// TODO
|
||||||
@@ -404,6 +398,17 @@ function openPlayer (torrent) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function closePlayer () {
|
||||||
|
state.url = '/'
|
||||||
|
state.title = config.APP_NAME
|
||||||
|
if (state.isFullScreen) {
|
||||||
|
electron.ipcRenderer.send('toggleFullScreen')
|
||||||
|
}
|
||||||
|
restoreBounds()
|
||||||
|
closeServer()
|
||||||
|
update()
|
||||||
|
}
|
||||||
|
|
||||||
function deleteTorrent (torrent) {
|
function deleteTorrent (torrent) {
|
||||||
var ix = state.saved.torrents.findIndex((x) => x.infoHash === torrent.infoHash)
|
var ix = state.saved.torrents.findIndex((x) => x.infoHash === torrent.infoHash)
|
||||||
if (ix > -1) state.saved.torrents.splice(ix, 1)
|
if (ix > -1) state.saved.torrents.splice(ix, 1)
|
||||||
|
|||||||
Reference in New Issue
Block a user