-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c0e484c
commit 7619702
Showing
12 changed files
with
247 additions
and
172 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,33 @@ | |
"filter": ["**/*"] | ||
} | ||
], | ||
|
||
"mac": { | ||
"type": "distribution", | ||
"hardenedRuntime": true, | ||
"entitlements": "main/resources/entitlements.mac.plist", | ||
"entitlementsInherit": "main/resources/entitlements.mac.plist", | ||
"gatekeeperAssess": false, | ||
"target": [ | ||
{ | ||
"target": "dmg", | ||
"arch": ["x64"] | ||
} | ||
] | ||
}, | ||
"dmg": { | ||
"contents": [ | ||
{ | ||
"x": 130, | ||
"y": 220 | ||
}, | ||
{ | ||
"x": 410, | ||
"y": 220, | ||
"type": "link", | ||
"path": "/Applications" | ||
} | ||
] | ||
}, | ||
"linux": { | ||
"target": ["deb", "rpm"], | ||
"maintainer": "Urij Horuzij <[email protected]>", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
const path = require('path'); | ||
const isDev = require('electron-is-dev'); | ||
const createWindow = require('./createWindow'); | ||
|
||
const allWindows = async () => { | ||
let splashWindow = createWindow( | ||
'splash', | ||
{ | ||
icon: path.join(__dirname, '../resources/icon.png'), | ||
width: 750, | ||
height: 500, | ||
show: false, | ||
center: true, | ||
frame: false, | ||
resizable: false, | ||
backgroundColor: '#171918', | ||
webPreferences: { | ||
preload: path.join(__dirname, '../preload.js'), | ||
}, | ||
}, | ||
true, | ||
); | ||
splashWindow.once('ready-to-show', () => { | ||
splashWindow.show(); | ||
}); | ||
if (isDev) { | ||
await splashWindow.loadURL(`http:https://localhost:3000/splash`); | ||
} else { | ||
await splashWindow.loadURL('app:https://./splash.html'); | ||
} | ||
let mainWindow = createWindow('main', { | ||
icon: path.join(__dirname, '../resources/icon.png'), | ||
width: 1000, | ||
height: 600, | ||
show: false, | ||
frame: false, | ||
backgroundColor: '#171918', | ||
webPreferences: { | ||
nodeIntegration: true, | ||
webSecurity: false, | ||
preload: path.join(__dirname, '../preload.js'), | ||
}, | ||
}); | ||
if (isDev) { | ||
mainWindow.webContents.openDevTools(); | ||
} | ||
mainWindow.once('ready-to-show', () => { | ||
splashWindow.close(); | ||
mainWindow.show(); | ||
}); | ||
if (isDev) { | ||
await mainWindow.loadURL(`http:https://localhost:3000/`); | ||
} else { | ||
await mainWindow.loadURL('app:https://./index.html'); | ||
} | ||
return mainWindow; | ||
}; | ||
|
||
module.exports = allWindows; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
const { app, ipcMain, dialog, remote } = require('electron'); | ||
const path = require('path'); | ||
const upscayl = require('./upscayl'); | ||
const utils = require('./utils'); | ||
|
||
const ipc = (mainWindow, temp) => { | ||
const userDataPath = (app || remote.app).getPath('userData'); | ||
let file = []; | ||
let filePathPosix = []; | ||
let flag = false; | ||
ipcMain.on('upscayl', async (e, scale) => { | ||
if (!flag && file.length > 0) { | ||
flag = true; | ||
const percentFunc = (percent) => { | ||
mainWindow.setProgressBar(percent / 100); | ||
mainWindow.webContents.send('upscayl-progress', percent); | ||
}; | ||
try { | ||
mainWindow.setProgressBar(0.01); | ||
mainWindow.webContents.send('upscayl-progress', 1); | ||
const upscale = await upscayl(file[0], userDataPath, percentFunc); | ||
temp = upscale; | ||
if (scale === 8) { | ||
await upscayl(temp, userDataPath, percentFunc); | ||
} | ||
mainWindow.webContents.send('upscayl-done', temp); | ||
} catch (err) { | ||
mainWindow.webContents.send('upscayl-error'); | ||
} finally { | ||
mainWindow.setProgressBar(-1); | ||
} | ||
flag = false; | ||
} | ||
}); | ||
ipcMain.on('drag-file', async (e, filePaths) => { | ||
file = [...filePaths]; | ||
filePathPosix = [filePaths[0].split(path.sep).join(path.posix.sep)]; | ||
e.reply('open-file', true); | ||
}); | ||
ipcMain.on('open-file', async (e) => { | ||
const { filePaths } = await dialog.showOpenDialog({ | ||
filters: [{ name: 'Изображения', extensions: ['jpg', 'png', 'gif'] }], | ||
properties: ['openFile'], | ||
}); | ||
file = [...filePaths]; | ||
filePathPosix = [filePaths[0].split(path.sep).join(path.posix.sep)]; | ||
e.reply('open-file', true); | ||
}); | ||
ipcMain.on('opened-file', async (e) => { | ||
e.reply('opened-file', filePathPosix[0]); | ||
}); | ||
ipcMain.on('save-file', async () => { | ||
const { filePath } = await dialog.showSaveDialog({ | ||
filters: [ | ||
{ name: 'JPEG', extensions: ['jpg', 'jpeg'] }, | ||
{ name: 'PNG', extensions: ['png'] }, | ||
{ name: 'GIF', extensions: ['gif'] }, | ||
], | ||
}); | ||
await utils.previews(previews, userDataPath, temp); | ||
await utils.copy(temp, filePath); | ||
temp = null; | ||
}); | ||
// ipcMain.on('open-directory', async () => { | ||
// const { filePaths } = await dialog.showOpenDialog({ | ||
// properties: ['openDirectory'], | ||
// }); | ||
// saveDirectory = filePaths; | ||
// }); | ||
}; | ||
module.exports = ipc; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
const menu = () => {}; | ||
module.exports = menu; |
Oops, something went wrong.