Skip to content

Commit 3035e05

Browse files
committed
Implementing #9. Fixing #34. Adding a "pre-release" badge.
1 parent b40904b commit 3035e05

File tree

6 files changed

+67
-22
lines changed

6 files changed

+67
-22
lines changed

index.html

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
</head>
1313
<body>
1414

15+
<!-- Pre-release warning -->
16+
<div style="color:#f00;background-color:#fff;font-weight:bold;position:fixed;right:0;bottom:0;z-index:1000;padding:5px;border-top-left-radius:5px;opacity:0.4">Pre-release</div>
17+
1518
<!-- Sidebar -->
1619
<div id="sidebar">
1720
<!-- Menu -->
@@ -77,6 +80,19 @@ <h4 class="modal-title" data-string="Settings"></h4>
7780
</select>
7881
</div>
7982
</div>
83+
84+
<!-- Mode -->
85+
<div class="form-group">
86+
<label for="inputEmail3" class="col-sm-3 control-label" data-string="Mode"></label>
87+
<div class="col-sm-9">
88+
<select class="form-control" data-settings="general.mode">
89+
<option value="regular" data-string="Regular application"></option>
90+
<option value="tray" data-string="Tray only"></option>
91+
<option value="both" data-string="Regular + Tray"></option>
92+
</select>
93+
</div>
94+
</div>
95+
8096
</form>
8197
</div>
8298

js/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ const settings_default = {
2020
"php.path": null,
2121
// Defaults
2222
"general.locale": "en",
23+
"general.mode": "both",
2324
"editor.font-size": "16",
2425
"editor.theme": "monokai",
2526
"editor.wordwrap": "true",
@@ -48,7 +49,7 @@ function renderApp(refresh) {
4849
// @TODO Do a "wait" screen with a progress bar or something
4950

5051
// Render editor
51-
editor.setTheme(Path.join("ace", "theme", conf.get("editor.theme")));
52+
editor.setTheme("ace/theme/" + conf.get("editor.theme")); // This is not a path
5253
editor.setShowPrintMargin(false);
5354
editor.getSession().setMode("ace/mode/php");
5455
$("#editor").css("font-size", conf.get("editor.font-size") + "px");

locales/en.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,9 @@
2626
"This software is free and open source.": "This software is free and open source.",
2727
"The source is available at": "The source is available at",
2828
"Created by Rafael Jaques (rafael@phpit.com.br) with": "Created by Rafael Jaques (rafael@phpit.com.br) with",
29-
"Quit": "Quit"
29+
"Quit": "Quit",
30+
"Mode": "Mode",
31+
"Regular application": "Regular application",
32+
"Tray only": "Tray only",
33+
"Regular + Tray": "Regular + Tray"
3034
}

locales/fr.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,8 @@
2626
"This software is free and open source.": "Ce logiciel est gratuit et open source.",
2727
"The source is available at": "La source est disponible au",
2828
"Created by Rafael Jaques (rafael@phpit.com.br) with": "Créé par Rafael Jaques (rafael@phpit.com.br) avec",
29-
"Quit": "Quitter"
29+
"Quit": "Quitter",
30+
"Regular application": "Application normale",
31+
"Tray only": "Seulement tray",
32+
"Regular + Tray": "Normale + Tray"
3033
}

locales/pt-BR.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,8 @@
2626
"This software is free and open source.": "Este software é gratuito e seu código é livre.",
2727
"The source is available at": "Código-fonte disponível no",
2828
"Created by Rafael Jaques (rafael@phpit.com.br) with": "Criado por Rafael Jaques (rafael@phpit.com.br) com",
29-
"Quit": "Sair"
29+
"Quit": "Sair",
30+
"Regular application": "Aplicação normal",
31+
"Tray only": "Apenas tray",
32+
"Regular + Tray": "Normal + Tray"
3033
}

main.js

Lines changed: 36 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ var mainWindow = null;
1818
app.on('ready', function() {
1919
// Creates window
2020
mainWindow = new BrowserWindow({
21-
height: 600,
22-
width: 900,
23-
icon: Path.join(__dirname, 'gfx', 'app-icon.png'),
21+
"height": 600,
22+
"width": 900,
23+
"icon": Path.join(__dirname, "gfx", "app-icon.png"),
24+
"skip-taskbar": conf.get("general.mode") == "tray" ? true : false
2425
});
2526

2627
// Check if php_path is already known
@@ -31,29 +32,46 @@ app.on('ready', function() {
3132
// Nope! Go and find it!
3233
runCheck();
3334
}
35+
3436
});
3537

3638
function startApp() {
37-
mainWindow.loadURL('file://' + Path.join(__dirname, 'index.html'));
39+
// Loading main HTML
40+
mainWindow.loadURL("file://" + Path.join(__dirname, 'index.html'));
41+
42+
// Checks app mode (regular, tray, both)
43+
var mode = conf.get("general.mode");
44+
if (!mode) mode = "both"
45+
46+
switch (mode) {
47+
case "both":
48+
createTrayIcon();
49+
break;
50+
case "tray":
51+
createTrayIcon();
52+
hideAppIcon();
53+
break;
54+
}
55+
}
3856

57+
function createTrayIcon() {
3958
// Set tray icon
40-
var trayIcon = Path.join(__dirname, 'gfx');
41-
if (process.platform !== 'darwin')
42-
trayIcon = Path.join(trayIcon, 'tray.png');
59+
var trayIcon = Path.join(__dirname, "gfx");
60+
if (process.platform !== "darwin")
61+
trayIcon = Path.join(trayIcon, "tray.png");
4362
else
44-
trayIcon = Path.join(trayIcon, 'tray-black.png');
63+
trayIcon = Path.join(trayIcon, "tray-black.png");
4564

4665
appIcon = new Tray(trayIcon);
47-
// var contextMenu = Menu.buildFromTemplate([
48-
// {
49-
// label: 'Show assistant'
50-
// },
51-
// { label: 'Quit',
52-
// selector: 'terminate:',
53-
// }
54-
// ]);
55-
appIcon.setToolTip('PHP Assistant');
56-
appIcon.on('click', focusBehavior);
66+
67+
appIcon.setToolTip("PHP Assistant");
68+
appIcon.on("click", focusBehavior);
69+
}
70+
71+
// Hides app from taskbar/dock
72+
function hideAppIcon() {
73+
if (app.dock)
74+
app.dock.hide();
5775
}
5876

5977
function runCheck() {

0 commit comments

Comments
 (0)