Skip to content

Commit 42485e0

Browse files
committed
working with menu
1 parent 6702cd7 commit 42485e0

File tree

6 files changed

+110
-52
lines changed

6 files changed

+110
-52
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
dist
1+
dist/
22
node_modules/
33
publish.sh
44
todo.md

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,5 @@ build_prod:
3434
./node_modules/webpack/bin/webpack.js -p
3535

3636
# cp -r lib/ electron/
37-
cp lib/main.js electron/main.js
38-
cp lib/renderer.js electron/render.js
37+
cp -r lib/main.js electron/main.js
38+
cp -r lib/renderer.js electron/render.js

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
## oTranscribe
1+
## oTranscribe-electron
2+
3+
Modified version to run inside electron as a desktop app to enable text to audio/video auto alignement to create captions(srt) files.
4+
5+
----
26

37
**[oTranscribe](http://oTranscribe.com/)** is a free web app designed to take the pain out of transcribing recorded interviews.
48

lib/main.js

Lines changed: 71 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
const electron = require('electron')
1+
// const electron = require('electron')
2+
const {app, BrowserWindow, dialog, shell, Menu} = require('electron');
23
// Module to control application life.
3-
const app = electron.app
4+
// const app = electron.app
45
// Module to create native browser window.
5-
const BrowserWindow = electron.BrowserWindow
6+
// const BrowserWindow = electron.BrowserWindow
7+
// const Menu = require('electron').Menu
68

79
const path = require('path')
810
const url = require('url')
@@ -22,6 +24,65 @@ function createWindow () {
2224
slashes: true
2325
}))
2426

27+
// MENU
28+
// Create the Application's main menu
29+
var template = [{
30+
label: "Application",
31+
submenu: [
32+
{ label: "About Application", selector: "orderFrontStandardAboutPanel:" },
33+
{ type: "separator" },
34+
{ label: "Quit", accelerator: "Command+Q", click: function() { app.quit(); }}
35+
]}, {
36+
label: "Edit",
37+
submenu: [
38+
{ label: "Undo", accelerator: "CmdOrCtrl+Z", selector: "undo:" },
39+
{ label: "Redo", accelerator: "Shift+CmdOrCtrl+Z", selector: "redo:" },
40+
{ type: "separator" },
41+
{ label: "Cut", accelerator: "CmdOrCtrl+X", selector: "cut:" },
42+
{ label: "Copy", accelerator: "CmdOrCtrl+C", selector: "copy:" },
43+
{ label: "Paste", accelerator: "CmdOrCtrl+V", selector: "paste:" },
44+
{role: 'pasteandmatchstyle'},
45+
{role: 'delete'},
46+
{ label: "Select All", accelerator: "CmdOrCtrl+A", selector: "selectAll:" },
47+
{type: 'separator'},
48+
{label: 'Speech',
49+
submenu: [
50+
{role: 'startspeaking'}, //perhaps add keyboard shortcut?
51+
{role: 'stopspeaking'} //perhaps add keyboard shortcut?
52+
]}
53+
]},{
54+
label: 'View',
55+
submenu: [
56+
{role: 'reload'},
57+
{role: 'forcereload'},
58+
{role: 'toggledevtools', accelerator: "CmdOrCtrl+Alt+I"},
59+
{type: 'separator'},
60+
{role: 'resetzoom'},
61+
{role: 'zoomin'},
62+
{role: 'zoomout'},
63+
{type: 'separator'},
64+
{role: 'togglefullscreen'}
65+
]},{
66+
role: 'window',
67+
submenu: [
68+
{role: 'minimize'},
69+
{role: 'close'}
70+
]},{
71+
role: 'help',
72+
submenu: [
73+
{
74+
label: 'Project Page',
75+
click () { require('electron').shell.openExternal('https://github.com/OpenNewsLabs/oTranscribe-electron') }
76+
},
77+
{
78+
label: 'User Manual',
79+
click () { require('electron').shell.openExternal('https://github.com/OpenNewsLabs/oTranscribe-electron') }
80+
}
81+
]}
82+
];
83+
84+
Menu.setApplicationMenu(Menu.buildFromTemplate(template));
85+
2586
// Open the DevTools.
2687
// mainWindow.webContents.openDevTools()
2788

@@ -34,6 +95,10 @@ function createWindow () {
3495
})
3596
}
3697

98+
99+
100+
101+
37102
// This method will be called when Electron has finished
38103
// initialization and is ready to create browser windows.
39104
// Some APIs can only be used after this event occurs.
@@ -58,3 +123,6 @@ app.on('activate', function () {
58123

59124
// In this file you can include the rest of your app's specific main process
60125
// code. You can also put them in separate files and require them here.
126+
//
127+
//
128+

npm-debug.log

Lines changed: 0 additions & 45 deletions
This file was deleted.

package.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,38 @@
55
"scripts": {
66
"postinstall": "cd ./node_modules/jakecache/ && npm install && node ./scripts/build.js && cd ../..",
77
"build": "make build_prod",
8+
"pack:mac": "npm run build && build --dir --mac --x64",
9+
"build:mac": "npm run build && build --mac --x64",
810
"start": "electron ."
911
},
12+
"build": {
13+
"appId": "org.otranscribe.otranscribe-electron",
14+
15+
"dmg": {
16+
"contents": [
17+
{
18+
"x": 110,
19+
"y": 150
20+
},
21+
{
22+
"x": 240,
23+
"y": 150,
24+
"type": "link",
25+
"path": "/Applications"
26+
}
27+
]
28+
},
29+
"linux": {
30+
"target": [
31+
"AppImage",
32+
"deb"
33+
]
34+
},
35+
"win": {
36+
"target": "squirrel",
37+
"icon": "build/icon.ico"
38+
}
39+
},
1040
"devDependencies": {
1141
"babel-core": "^6.24.1",
1242
"babel-eslint": "^4.1.3",
@@ -17,6 +47,7 @@
1747
"chai": "^3.5.0",
1848
"copy-webpack-plugin": "^3.0.1",
1949
"css-loader": "^0.23.1",
50+
"electron-builder": "^19.16.2",
2051
"eslint": "^1.7.3",
2152
"extract-text-webpack-plugin": "^2.0.0-beta.4",
2253
"html-loader": "^0.4.3",

0 commit comments

Comments
 (0)