Skip to content

Commit 81d6bf7

Browse files
committed
Added implementation of native app with nw.js
1 parent 5b1bd4a commit 81d6bf7

25 files changed

+988
-13
lines changed

.gitignore

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,14 @@
44
/blackbox-chrome-app.zip
55
.idea/workspace.xml
66
.idea/tasks.xml
7-
/.idea/
7+
/.idea/
8+
node_modules/
9+
npm-debug.log
10+
cache/
11+
apps/
12+
dist/
13+
debug/
14+
release/
15+
16+
# artefacts for Visual Studio Code
17+
/.vscode/

Readme.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,45 @@ This tool is currently in the Beta stage, so a number of key features have yet t
6969
- There is no control over the amount of smoothing applied to the graph lines
7070
- There is no way to single-step between loop iterations with the arrow keys
7171

72+
## Native app build via NW.js
73+
74+
### Development
75+
76+
1. Install node.js
77+
2. Change to project folder and run `npm install`.
78+
3. Run `npm start` to build & run the debug flavor.
79+
80+
### App build and release
81+
82+
The tasks are defined in `gulpfile.js` and can be run either via `gulp <task-name>` (if the command is in PATH or via `../node_modules/gulp/bin/gulp.js <task-name>`:
83+
84+
1. Optional, install gulp `npm install --global gulp-cli`.
85+
2. Run `gulp <taskname> [[platform] [platform] ...]`.
86+
87+
List of possible values of `<task-name>`:
88+
* **dist** copies all the JS and CSS files in the `./dist` folder.
89+
* **apps** builds the apps in the `./apps` folder [1].
90+
* **debug** builds debug version of the apps in the `./debug` folder [1].
91+
* **release** zips up the apps into individual archives in the `./release` folder [1].
92+
93+
[1] Running this task on macOS or Linux requires Wine, since it's needed to set the icon for the Windows app (build for specific platform to avoid errors).
94+
95+
#### Build or release app for one specific platform
96+
To build or release only for one specific platform you can append the plaform after the `task-name`.
97+
If no platform is provided, only for the platform you are builing from will be build.
98+
99+
* **MacOS** use `gulp <task-name> --osx64`
100+
* **Linux** use `gulp <task-name> --linux64`
101+
* **Windows** use `gulp <task-name> --win32`
102+
* **ChromeOS** use `gulp <task-name> --chromeos`
103+
104+
You can also use multiple platforms e.g. `gulp <taskname> --osx64 --linux64`.
105+
106+
#### macOS DMG installation background image
107+
108+
The release distribution for macOS uses a DMG file to install the application.
109+
The PSD source for the DMG backgound image can be found in the root (`dmg-background.png`). After changing the source, export the image to PNG format in folder `./images/`.
110+
72111
## Flight video won't load, or jumpy flight video upon export
73112

74113
Some flight video formats aren't supported by Chrome, so the viewer can't open them. You can fix this by re-encoding

_locales/en/messages.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"translation_version": {
3+
"message": "0"
4+
},
5+
"noticeTitle": {
6+
"message": "Notice"
7+
},
8+
"checkForUnstableVersions": {
9+
"message": "Show update notifications for unstable versions of the configurator"
10+
},
11+
"updateNotice": {
12+
"message": "You are using an outdated version of the <b>Betaflight Blackbox Explorer</b>.<br>Version <b>$1</b> is available online, please visit <a href=\"$2\" target=\"_blank\">the release page</a> to download and install the latest version with fixes and improvements.<br><br>Please close the app before updating."
13+
},
14+
"updateWebsite": {
15+
"message": "Go to Release Website"
16+
},
17+
"close": {
18+
"message": "Close"
19+
}
20+
}

background.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
1-
chrome.app.runtime.onLaunched.addListener(function() {
1+
'use strict';
2+
3+
function startApplication() {
24
chrome.app.window.create('index.html', {
3-
'id': 'main',
4-
'innerBounds' : {
5+
id: 'main',
6+
frame: 'chrome',
7+
innerBounds : {
58
'width' : 1340,
6-
'height' : 900
7-
}
9+
'height' : 920
10+
},
11+
title: 'Betaflight - Blackbox Explorer'
812
});
9-
});
13+
}
14+
15+
chrome.app.runtime.onLaunched.addListener(startApplication);

changelog.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<meta charset="utf-8">
55
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
66
<title>Betaflight - Blackbox Explorer Changelog</title>
7-
<link rel="icon" type="image/png" href="images/icon-128.png">
7+
<link rel="icon" type="image/png" href="images/bf_icon_128.png">
88
<link rel="stylesheet" href="css/bootstrap.min.css">
99
<link rel="stylesheet" href="css/bootstrap-theme.min.css">
1010
<style>
@@ -39,6 +39,11 @@
3939
</head>
4040
<body>
4141
<div class="log">
42+
<h2> 3.0.0 - Standalone app</h2>
43+
44+
<ul>
45+
<li>Release of standalone app</li>
46+
</ul>
4247
<h2> 2.5.13 - Minor Fixes</h2>
4348

4449
<ul>

css/main.css

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,17 @@ html, body {
77
overflow-y: visible; /* Show page scrollbar when packaged as a Chrome app */
88
}
99

10+
a:hover {
11+
text-decoration: none;
12+
color: inherit;
13+
}
14+
15+
a.disabled {
16+
pointer-events: none;
17+
cursor: default;
18+
color: #999;
19+
}
20+
1021
/* Add an extended wide size to the page container for large monitors */
1122
@media (min-width: 1400px) {
1223
.container.main-pane {
@@ -1278,3 +1289,46 @@ html.log_open #changelog .wrapper {
12781289
height: calc(100% - 20px);
12791290
margin: 10px 10px 10px 10px;
12801291
}
1292+
1293+
1294+
dialog {
1295+
background-color: white;
1296+
padding: 1em;
1297+
height: auto;
1298+
margin: auto auto;
1299+
position: absolute;
1300+
width: 50%;
1301+
border-radius: 3px;
1302+
border: 1px solid silver;
1303+
}
1304+
1305+
dialog h3 {
1306+
display: block;
1307+
font-size: 1.17em;
1308+
-webkit-margin-before: 1em;
1309+
-webkit-margin-after: 1em;
1310+
-webkit-margin-start: 0px;
1311+
-webkit-margin-end: 0px;
1312+
font-weight: bold;
1313+
}
1314+
1315+
.regular-button {
1316+
margin-top: 8px;
1317+
margin-bottom: 8px;
1318+
margin-right: 10px;
1319+
background-color: #ffbb00;
1320+
border-radius: 3px;
1321+
border: 1px solid #dba718;
1322+
color: #000;
1323+
font-family: 'open_sansbold', Arial;
1324+
font-size: 12px;
1325+
font-weight: bold;
1326+
text-shadow: 0px 1px rgba(255, 255, 255, 0.25);
1327+
display: inline-block;
1328+
cursor: pointer;
1329+
transition: all ease 0.2s;
1330+
padding: 0px;
1331+
padding-left: 9px;
1332+
padding-right: 9px;
1333+
line-height: 28px;
1334+
}

dmg-background.psd

10.9 MB
Binary file not shown.

0 commit comments

Comments
 (0)