Create Torrent dialog

This commit is contained in:
DC
2016-04-20 22:25:56 -07:00
committed by DC
parent 6b70554e63
commit 31ef283e7b
5 changed files with 60 additions and 76 deletions

View File

@@ -120,7 +120,7 @@ function sliceArgv (argv) {
function processArgv (argv) {
argv.forEach(function (arg) {
if (arg === '-n') {
windows.main.send('dispatch', 'showCreateTorrent')
windows.main.send('dispatch', 'showOpenSeedFiles')
} else if (arg === '-o') {
windows.main.send('dispatch', 'showOpenTorrentFile')
} else if (arg === '-u') {

View File

@@ -36,7 +36,7 @@ function init () {
})
ipcMain.on('showOpenTorrentFile', menu.showOpenTorrentFile)
ipcMain.on('showCreateTorrent', menu.showCreateTorrent)
ipcMain.on('showOpenSeedFiles', menu.showOpenSeedFiles)
ipcMain.on('setBounds', function (e, bounds, maximize) {
setBounds(bounds, maximize)

View File

@@ -5,7 +5,7 @@ module.exports = {
onWindowShow,
onPlayerOpen,
onPlayerClose,
showCreateTorrent,
showOpenSeedFiles,
showOpenTorrentFile,
toggleFullScreen
}
@@ -109,7 +109,7 @@ function getMenuItem (label) {
}
// Prompts the user for a file or folder, then makes a torrent out of the data
function showCreateTorrent () {
function showOpenSeedFiles () {
// Allow only a single selection
// To create a multi-file torrent, the user must select a folder
electron.dialog.showOpenDialog({
@@ -117,10 +117,8 @@ function showCreateTorrent () {
properties: [ 'openFile', 'openDirectory' ]
}, function (filenames) {
if (!Array.isArray(filenames)) return
var options = {
files: filenames[0]
}
windows.main.send('dispatch', 'createTorrent', options)
var fileOrFolder = filenames[0]
windows.main.send('dispatch', 'showCreateTorrent', fileOrFolder)
})
}
@@ -148,7 +146,7 @@ function getAppMenuTemplate () {
{
label: 'Create New Torrent...',
accelerator: 'CmdOrCtrl+N',
click: showCreateTorrent
click: showOpenSeedFiles
},
{
label: 'Open Torrent File...',
@@ -373,7 +371,7 @@ function getDockMenuTemplate () {
{
label: 'Create New Torrent...',
accelerator: 'CmdOrCtrl+N',
click: showCreateTorrent
click: showOpenSeedFiles
},
{
label: 'Open Torrent File...',