1
0
mirror of https://github.com/mifi/lossless-cut.git synced 2024-11-21 18:02:35 +01:00

improve about dialog

closes #2138
This commit is contained in:
Mikael Finstad 2024-09-02 23:29:42 +02:00
parent b86c1b15e8
commit a4190662b9
No known key found for this signature in database
GPG Key ID: 25AB36E3E81CBC26
3 changed files with 47 additions and 26 deletions

38
src/main/aboutPanel.ts Normal file
View File

@ -0,0 +1,38 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import { AboutPanelOptionsOptions, app } from 'electron';
import { appName, copyrightYear } from './common.js';
import { isLinux } from './util.js';
import isStoreBuild from './isStoreBuild.js';
import { githubLink, homepage } from './constants.js';
// eslint-disable-next-line import/prefer-default-export
export function getAboutPanelOptions() {
const showVersion = !isStoreBuild;
const appVersion = app.getVersion();
const aboutPanelLines = [
isStoreBuild ? homepage : githubLink,
'',
`Copyright © 2016-${copyrightYear} Mikael Finstad ❤️ 🇳🇴`,
];
const aboutPanelOptions: AboutPanelOptionsOptions = {
applicationName: appName,
copyright: aboutPanelLines.join('\n'),
version: '', // not very useful (supported on MacOS only, and same as applicationVersion)
};
// https://github.com/electron/electron/issues/18918
// https://github.com/mifi/lossless-cut/issues/1537
if (isLinux) {
aboutPanelOptions.applicationVersion = appVersion;
} else if (!showVersion) {
// https://github.com/mifi/lossless-cut/issues/1882
aboutPanelOptions.applicationVersion = `${process.windowsStore ? 'Microsoft Store' : 'App Store'} edition, based on GitHub v${appVersion}`;
}
return aboutPanelOptions;
}

View File

@ -3,7 +3,7 @@ process.traceProcessWarnings = true;
/* eslint-disable import/first */
// eslint-disable-next-line import/no-extraneous-dependencies
import electron, { AboutPanelOptionsOptions, BrowserWindow, BrowserWindowConstructorOptions, nativeTheme, shell, app, ipcMain, Notification, NotificationConstructorOptions } from 'electron';
import electron, { BrowserWindow, BrowserWindowConstructorOptions, nativeTheme, shell, app, ipcMain, Notification, NotificationConstructorOptions } from 'electron';
import i18n from 'i18next';
import debounce from 'lodash.debounce';
import yargsParser from 'yargs-parser';
@ -16,11 +16,13 @@ import timers from 'node:timers/promises';
import logger from './logger.js';
import menu from './menu.js';
import * as configStore from './configStore.js';
import { isLinux, isWindows } from './util.js';
import { appName, copyrightYear } from './common.js';
import { isWindows } from './util.js';
import { appName } from './common.js';
import attachContextMenu from './contextMenu.js';
import HttpServer from './httpServer.js';
import isDev from './isDev.js';
import isStoreBuild from './isStoreBuild.js';
import { getAboutPanelOptions } from './aboutPanel.js';
import { checkNewVersion } from './updateChecker.js';
@ -67,8 +69,6 @@ app.commandLine.appendSwitch('enable-blink-features', 'AudioVideoTracks');
remote.initialize();
const appVersion = app.getVersion();
app.name = appName;
if (isWindows) {
@ -78,28 +78,8 @@ if (isWindows) {
app.setAppUserModelId(app.name);
}
const isStoreBuild = process.windowsStore || process.mas;
const showVersion = !isStoreBuild;
const aboutPanelOptions: AboutPanelOptionsOptions = {
applicationName: appName,
copyright: `Copyright © ${copyrightYear} Mikael Finstad ❤️ 🇳🇴`,
version: '', // not very useful (MacOS only, and same as applicationVersion)
};
// https://github.com/electron/electron/issues/18918
// https://github.com/mifi/lossless-cut/issues/1537
if (isLinux) {
aboutPanelOptions.version = appVersion;
}
if (!showVersion) {
// https://github.com/mifi/lossless-cut/issues/1882
aboutPanelOptions.applicationVersion = `${process.windowsStore ? 'Microsoft Store' : 'App Store'} edition, based on GitHub v${appVersion}`;
}
// https://www.electronjs.org/docs/latest/api/app#appsetaboutpaneloptionsoptions
app.setAboutPanelOptions(aboutPanelOptions);
app.setAboutPanelOptions(getAboutPanelOptions());
let filesToOpen: string[] = [];

3
src/main/isStoreBuild.ts Normal file
View File

@ -0,0 +1,3 @@
const isStoreBuild = process.windowsStore || process.mas;
export default isStoreBuild;