Skip to content

The swiss army knife of lossless video/audio editing

improve about dialog

Mikael Finstada4190662b9d9
diff --git a/src/main/aboutPanel.ts b/src/main/aboutPanel.ts
new file mode 100644
index 00000000..43a29edd
--- /dev/null
+++ b/src/main/aboutPanel.ts
@@ -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;
+}
diff --git a/src/main/index.ts b/src/main/index.ts
index f2cc6853..5649d881 100644
--- a/src/main/index.ts
+++ b/src/main/index.ts
@@ -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[] = [];
diff --git a/src/main/isStoreBuild.ts b/src/main/isStoreBuild.ts
new file mode 100644
index 00000000..b9e39ed4
--- /dev/null
+++ b/src/main/isStoreBuild.ts
@@ -0,0 +1,3 @@
+const isStoreBuild = process.windowsStore || process.mas;
+
+export default isStoreBuild;