diff --git a/app/about.html b/app/about.html new file mode 100644 index 0000000..ff649d1 --- /dev/null +++ b/app/about.html @@ -0,0 +1,50 @@ + + + + + About + + + + + + + + + + + + +

Fontman Desktop

+

Version {{abtData.version}} {{abtData.platform}}

+ +

Fontman Desktop is a cross-platform desktop font package manager which brings latest and greatest Libre, open source fonts to your desktop.

+

Fontman is a free software project and welcomes bug reports, suggestions, contributions and code contributions. See FAQ for more information.

+

This software is licensed under GNU GPL version 3 and the source code is hosted on Github. See the LICENSE for more information.

+ +
© Copyright {{abtData.year}} Fontman Project Authors.
+ + + \ No newline at end of file diff --git a/app/index.html b/app/index.html index 6fbd37f..8040eb3 100755 --- a/app/index.html +++ b/app/index.html @@ -98,5 +98,7 @@ + + diff --git a/app/main.js b/app/main.js index e5b00ca..5862d82 100755 --- a/app/main.js +++ b/app/main.js @@ -6,9 +6,17 @@ const app = electron.app; // Module to create native browser window. const BrowserWindow = electron.BrowserWindow; +const path = require('path'); +const url = require('url'); + +// Keep a global reference of the window object, if you don't, the window will +// be closed automatically when the JavaScript object is garbage collected. +let mainWindow; + + // build app native menus const {Menu} = require('electron'); - +const ipc = require('electron').ipcRenderer; // native menu template const nativeMenus = [ @@ -16,7 +24,8 @@ const nativeMenus = [ label: 'Fonts', submenu: [ { - label: 'Check for updates' + label: 'Check for updates', + click () {openCheckFontsUpdate();} } ] @@ -36,22 +45,27 @@ const nativeMenus = [ label: 'Settings' }, { - label: 'About' + label: 'About', + click () {openAbout();} }, { label: 'Help', submenu: [ { - label: 'Help' + label: 'Help', + click () { require('electron').shell.openExternal('http://fontman.io/help') } }, { - label: 'Interface guide' + label: 'Interface guide', + click () { require('electron').shell.openExternal('http://fontman.io/help#desktop-interface') } }, { - label: 'Report a bug' + label: 'Report a bug', + click () { require('electron').shell.openExternal('http://github.com/fontman/fontman-desktop/issues/new') } }, { - label: 'Ask a question' + label: 'Ask a question', + click () { require('electron').shell.openExternal('http://github.com/fontman/fontman-desktop/issues/new') } }, { label: 'Updates from @fontmanApp' @@ -64,16 +78,59 @@ const menu = Menu.buildFromTemplate(nativeMenus); Menu.setApplicationMenu(menu); -// Module to control tray application. -const Tray = electron.Tray; +// font updates window +var checkFontsUpdates = null; -const path = require('path'); -const url = require('url'); +function openCheckFontsUpdate() { + if (checkFontsUpdates) { + checkFontsUpdates.focus(); + return; + } + + checkFontsUpdates = new BrowserWindow({ + height: 400, + resizable: false, + width: 400, + title: "Check for font updates", + minimizable: true, + fullscreenable: false + }); + + checkFontsUpdates.loadURL('file://' + __dirname + '/views/font_updates.html'); + checkFontsUpdates.setMenu(null); + + checkFontsUpdates.on('closed', function () { + checkFontsUpdates = null; + }); +} + + +// about window +var about = null; + +function openAbout() { + if (about) { + about.focus(); + return; + } + + about = new BrowserWindow({ + height: 500, + resizable: false, + width: 600, + title: "About", + minimizable: false, + fullscreenable: false + }); + + about.loadURL('file://' + __dirname + '/about.html'); + about.setMenu(null); + + about.on('closed', function () { + about = null; + }); +} -// Keep a global reference of the window object, if you don't, the window will -// be closed automatically when the JavaScript object is garbage collected. -let mainWindow; -let appIcon = null; function createWindow () { @@ -88,7 +145,7 @@ function createWindow () { })); // remove default main menu - //mainWindow.setMenu(null); + // mainWindow.setMenu('js/menu.js'); // Open the DevTools. mainWindow.webContents.openDevTools(); diff --git a/app/menu/menu.js b/app/menu/menu.js new file mode 100644 index 0000000..9437420 --- /dev/null +++ b/app/menu/menu.js @@ -0,0 +1,63 @@ +/** + * Created by lpsandaruwan on 2/5/17. + */ + +// build app native menus +const {Menu} = require('electron'); +const ipc = require('electron').ipcRenderer; + +// native menu template +const nativeMenus = [ + { + label: 'Fonts', + submenu: [ + { + label: 'Check for updates' + } + ] + + }, + { + label: 'Account', + submenu: [ + { + label: 'Register' + }, + { + label: "Sign In" + } + ] + }, + { + label: 'Settings' + }, + { + label: 'About' + }, + { + label: 'Help', + submenu: [ + { + label: 'Help', + click () { require('electron').shell.openExternal('http://fontman.io/help') } + }, + { + label: 'Interface guide', + click () { require('electron').shell.openExternal('http://fontman.io/help#desktop-interface') } + }, + { + label: 'Report a bug', + click () { require('electron').shell.openExternal('http://github.com/fontman/fontman-desktop/issues/new') } + }, + { + label: 'Ask a question', + click () { require('electron').shell.openExternal('http://github.com/fontman/fontman-desktop/issues/new') } + }, + { + label: 'Updates from @fontmanApp' + } + ] + } +]; + +const menu = Menu.buildFromTemplate(nativeMenus); diff --git a/app/package.json b/app/package.json index 8e8bdfa..819b9cd 100755 --- a/app/package.json +++ b/app/package.json @@ -24,6 +24,6 @@ "textangular": "^1.5.16" }, "devDependencies": { - "electron": "^1.4.1" + "electron": "^1.4.15" } } diff --git a/app/views/font_updates.html b/app/views/font_updates.html new file mode 100644 index 0000000..ad0f69f --- /dev/null +++ b/app/views/font_updates.html @@ -0,0 +1,10 @@ + + + + + Check for fonts updates + + + + + \ No newline at end of file