Merge pull request #79 from feross/ui

Fix Windows UX issues
This commit is contained in:
Feross Aboukhadijeh
2016-03-07 19:42:45 -08:00
3 changed files with 19 additions and 15 deletions

View File

@@ -49,7 +49,7 @@ function addTorrentFromPaste () {
function setBounds (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)
}
}

View File

@@ -16,13 +16,14 @@ app.on('before-quit', function () {
function createMainWindow (menu) {
var win = windows.main = new electron.BrowserWindow({
autoHideMenuBar: true, // Hide top menu bar unless Alt key is pressed (Windows, Linux)
backgroundColor: '#282828',
darkTheme: true,
darkTheme: true, // Forces dark theme (GTK+3 only)
minWidth: 375,
minHeight: 158,
show: false,
show: false, // Hide window until DOM finishes loading
title: config.APP_NAME,
titleBarStyle: 'hidden-inset',
titleBarStyle: 'hidden-inset', // Hide OS chrome, except traffic light buttons (OS X)
width: 450,
height: 300
})
@@ -33,10 +34,8 @@ function createMainWindow (menu) {
})
win.webContents.on('did-finish-load', function () {
setTimeout(function () {
debug('startup time: %sms', Date.now() - app.startTime)
win.show()
}, 50)
debug('startup time: %sms', Date.now() - app.startTime)
win.show()
})
win.on('blur', menu.onWindowHide)

View File

@@ -163,13 +163,7 @@ function dispatch (action, ...args) {
if (action === 'back') {
// TODO
// window.history.back()
if (state.url === '/player') {
restoreBounds()
closeServer()
}
state.url = '/'
state.title = config.APP_NAME
update()
closePlayer()
}
if (action === 'forward') {
// 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) {
var ix = state.saved.torrents.findIndex((x) => x.infoHash === torrent.infoHash)
if (ix > -1) state.saved.torrents.splice(ix, 1)