Skip to content

Commit f9bfe53

Browse files
committed
新增功能限制的进度条展示和表格说明;增加任务列表和同时运行任务数量限制;新增全选任务按钮、应用参数到全部任务按钮
1 parent 66d8b0e commit f9bfe53

File tree

17 files changed

+263
-40
lines changed

17 files changed

+263
-40
lines changed

WindowsInstaller/FFBox.iss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
33

44
#define MyAppName "FFBox"
5-
#define MyAppVersion "4.4"
5+
#define MyAppVersion "4.5"
66
#define MyAppPublisher "滔滔清风"
77
#define MyAppURL "http://ttqf.tech"
88
; #define MyCopyright "版权所有"
@@ -11,7 +11,7 @@
1111

1212
; 安装包输出文件夹
1313
#define MySetupOutDir "./output"
14-
#define MySetupOutBaseFilename "Windows_x86-64_FFBox_4.4"
14+
#define MySetupOutBaseFilename "Windows_x86-64_FFBox_4.5"
1515

1616
; 安装包所用的资源文件夹
1717
#define MyResDir "./res"

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "FFBox",
3-
"version": "4.5.0-alpha",
3+
"version": "4.5.0",
44
"description": "",
55
"main": "app/main/index.cjs",
66
"scripts": {

src/backend/FFBoxService.ts

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,20 @@ export class FFBoxService extends (EventEmitter as new () => TypedEventEmitter<F
255255
* @emits tasklistUpdate
256256
*/
257257
public taskAdd(taskName: string, outputParams: OutputParams): Promise<number> {
258+
const maxTaskCount = this.functionLevel < 40 ? 66 : this.functionLevel < 60 ? 99 : Number.MAX_SAFE_INTEGER;
259+
if (Object.keys(this.tasklist).length - 1 >= maxTaskCount) { // 全局任务占了一个位置
260+
this.setNotification(
261+
-1,
262+
`😞任务数量达到上限了(后端)\n` +
263+
`💔您的用户等级最高支持在任务列表中放入 ${maxTaskCount} 个任务,您可以先删除一些任务再添加\n` +
264+
'🤫开发者设计该项限制的意图是避免超出合理范围的操作导致前端卡顿(实测 100 个任务同时运行一遍或能导致前端卡顿半小时),\n' +
265+
' 并给“伸手党”和“白嫖党”制造一些不便😞谁知盘中餐,粒粒皆辛苦!\n' +
266+
'☺️探访一下 FFBox 官网或作者发布媒介,或许就能发现激活方式了✅',
267+
NotificationLevel.warning,
268+
);
269+
return;
270+
}
271+
258272
const id = this.latestTaskId++;
259273
// 目前只处理单输入的情况
260274
const filePath = outputParams.input.files[0].filePath;
@@ -408,7 +422,7 @@ export class FFBoxService extends (EventEmitter as new () => TypedEventEmitter<F
408422
`任务「${task.fileBaseName}」设置的视频码率已被限制\n` +
409423
'💔您的用户等级在 ABR/CBR 模式下的视频码率仅支持 500Kbps ~ 32Mbps\n' +
410424
'🤫开发者设计该项限制的意图是为了给“伸手党”和“白嫖党”制造一些不便😞谁知盘中餐,粒粒皆辛苦!\n' +
411-
'☺️探访一下 FFBox 官网或作者发布媒介,或许就能发现激活方式了,记得保持微笑✅',
425+
'☺️探访一下 FFBox 官网或作者发布媒介,或许就能发现激活方式了✅',
412426
NotificationLevel.warning,
413427
);
414428
videoParam.ratevalue = ratevalue > 0.75 ? 0.75 : 0.25;
@@ -451,14 +465,14 @@ export class FFBoxService extends (EventEmitter as new () => TypedEventEmitter<F
451465
const startTime = ((startTime1 === -1 ? 0 : startTime1) + (startTime2 === -1 ? 0 : startTime2)) * 1000;
452466
const duration = (getOutputDuration(task) || 0) * 1000;
453467
if (task.after.output.keepFileTime === 'autoShift') {
454-
// 复制修正后的文件时间。输出文件的访问时间将从输入文件的时间原样复制,创建时间、修改时间将按照剪裁位置自动调整后进行修改
468+
// 复制修正后的文件时间(依创建时间)。输出文件的创建时间、修改时间将以创建时间为基准,按照剪裁位置自动调整后进行修改
455469
const newCreateTime = birthtime.getTime() + startTime;
456470
const newModifyTime = birthtime.getTime() + startTime + duration;
457471
await utimes(task.outputFile, { btime: newCreateTime, mtime: newModifyTime, atime });
458472
} else if (task.after.output.keepFileTime === 'fixCTbyMTandShift' && task.before.duration > 0) {
459-
// 根据修改时间修正新文件时间。用于修复拷贝后创建时间丢失的问题,将通过修改时间和剪裁位置自动调整后进行修改
460-
const newModifyTime = mtime.getTime() - task.before.duration * 1000 + startTime;
461-
const newCreateTime = mtime.getTime() - task.before.duration * 1000 + startTime + duration;
473+
// 复制修正后的文件时间(依修改时间)。输出文件的创建时间、修改时间将以修改时间为基准,按照剪裁位置自动调整后进行修改,用于修复拷贝后创建时间丢失的问题
474+
const newCreateTime = mtime.getTime() - task.before.duration * 1000 + startTime;
475+
const newModifyTime = mtime.getTime() - task.before.duration * 1000 + startTime + duration;
462476
await utimes(task.outputFile, { btime: newCreateTime, mtime: newModifyTime, atime });
463477
} else if (task.after.output.keepFileTime === 'fixByFilenameAndShift') {
464478
// 根据文件名修正新文件时间。用于修复文件时间丢失的问题,将通过文件名作为创建时间,根据剪裁位置自动调整后进行修改
@@ -675,8 +689,9 @@ export class FFBoxService extends (EventEmitter as new () => TypedEventEmitter<F
675689
private queueAssign(): number {
676690
if (this.workingStatus === WorkingStatus.running) {
677691
let runningCount = Object.values(this.tasklist).reduce((prev, curr) => curr.status === TaskStatus.running ? prev + 1 : prev, 0);
692+
const maxThreads = Math.min(this.maxThreads, this.functionLevel < 40 ? 6 : this.functionLevel < 60 ? 9 : Number.MAX_SAFE_INTEGER);
678693
for (const [id, task] of Object.entries(this.tasklist)) {
679-
if (runningCount >= this.maxThreads || id === '-1') {
694+
if (runningCount >= maxThreads || id === '-1') {
680695
break;
681696
}
682697
if (task.status === TaskStatus.idle_queued) {
@@ -839,7 +854,7 @@ export class FFBoxService extends (EventEmitter as new () => TypedEventEmitter<F
839854
`任务「${task.fileBaseName}」转码达到时长上限了${byFrontend ? '(前端)' : '(后端)'}\n` +
840855
'💔您的用户等级最高支持 11:11 的媒体时长和 11:11 的处理耗时\n' +
841856
'🤫开发者设计该项限制的意图是为了给“伸手党”和“白嫖党”制造一些不便😞谁知盘中餐,粒粒皆辛苦!\n' +
842-
'☺️探访一下 FFBox 官网或作者发布媒介,或许就能发现激活方式了,记得保持微笑✅',
857+
'☺️探访一下 FFBox 官网或作者发布媒介,或许就能发现激活方式了✅',
843858
NotificationLevel.error,
844859
);
845860
task.status = TaskStatus.stopping;

src/common/constants.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
export const version = (() => {
2-
let ret = '4.5_alpha';
2+
let ret = '4.5';
33
if (!buildInfo) {
44
ret += ' *'
55
} else if (buildInfo.isDev) {
66
ret += ` ${buildInfo.gitCommit}`
77
}
88
return ret;
99
})();
10-
export const buildNumber = 15;
11-
// 1.0 1.1 2.0 2.1 2.2 2.3 2.4 2.5 2.6 3.0 4.0 4.1 4.2 4.3 4.4
10+
export const buildNumber = 16;
11+
// 1.0 1.1 2.0 2.1 2.2 2.3 2.4 2.5 2.6 3.0 4.0 4.1 4.2 4.3 4.4 4.5

src/common/params/formats.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,14 +173,14 @@ const keepFileTimeList: NarrowedMenuItem[] = [
173173
{
174174
type: 'normal',
175175
value: 'autoShift',
176-
label: '复制修正后的文件时间',
177-
tooltip: '输出文件的访问时间将从输入文件的时间原样复制,创建时间、修改时间将按照剪裁位置自动调整后进行修改',
176+
label: '复制修正后的文件时间(依创建时间)',
177+
tooltip: '输出文件的创建时间、修改时间将以创建时间为基准,按照剪裁位置自动调整后进行修改',
178178
},
179179
{
180180
type: 'normal',
181181
value: 'fixCTbyMTandShift',
182-
label: '根据修改时间修正新文件时间',
183-
tooltip: '用于修复拷贝后创建时间丢失的问题,将通过修改时间和剪裁位置自动调整后进行修改',
182+
label: '复制修正后的文件时间(依修改时间)',
183+
tooltip: '输出文件的创建时间、修改时间将以修改时间为基准,按照剪裁位置自动调整后进行修改,用于修复拷贝后创建时间丢失的问题',
184184
},
185185
{
186186
type: 'normal',
Lines changed: 1 addition & 0 deletions
Loading

src/renderer/src/components/Button/Button.module.less

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,31 @@
121121
0 4px 6px hwb(0 0% 100% / 0.2) inset; // 内部凹陷阴影
122122
}
123123
}
124+
.noBg[data-color_theme="themeLight"] {
125+
background: none;
126+
box-shadow: none;
127+
&:hover {
128+
box-shadow: 0 1.5px 4px 0 hwb(var(--hoverShadow) / 0.15), // 外部阴影
129+
0 1px 0.5px 0px hwb(var(--hoverLightBg)) inset; // 上高光
130+
}
131+
&:active {
132+
box-shadow: 0 0 2px 1px hwb(var(--hoverShadow) / 0.05), // 外部阴影
133+
0 6px 12px hwb(var(--hoverShadow) / 0.1) inset; // 内部凹陷阴影
134+
}
135+
}
136+
.noBg[data-color_theme="themeDark"] {
137+
background: none;
138+
box-shadow: none;
139+
&:hover {
140+
box-shadow: 0 0 1.5px 0.5px hwb(var(--hoverLightBg)), // 包边
141+
0 1.5px 4px 0 hwb(var(--hoverShadow) / 0.3), // 外部阴影
142+
0 1px 0.5px 0px hwb(var(--hoverLightBg)) inset; // 上高光
143+
}
144+
&:active {
145+
box-shadow: 0 0 2px 1px hwb(var(--hoverShadow) / 0.05), // 外部阴影
146+
0 6px 18px hwb(var(--hoverShadow) / 0.4) inset; // 内部凹陷阴影
147+
}
148+
}
124149
.disabled {
125150
pointer-events: none;
126151
opacity: 0.6;

src/renderer/src/components/Button/Button.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ export interface ButtonProps {
99
size?: 'small' | 'normal' | 'large';
1010
}[];
1111
export enum ButtonType {
12-
Normal = 0,
13-
Primary = 1,
14-
Danger = 2,
12+
Normal = 'normal',
13+
Primary = 'primary',
14+
Danger = 'danger',
15+
NoBg = 'noBg',
1516
};
1617

1718
const getButtonClass = (type?: ButtonType, disabled?: boolean, size?: ButtonProps['size']) => {
@@ -21,6 +22,8 @@ const getButtonClass = (type?: ButtonType, disabled?: boolean, size?: ButtonProp
2122
classText += style['primary'];
2223
} else if (type === ButtonType.Danger) {
2324
classText += style['danger'];
25+
} else if (type === ButtonType.NoBg) {
26+
classText += style['noBg'];
2427
}
2528
classText += ' ';
2629
if (size) {

src/renderer/src/components/misc/AddTasks.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ interface P {
3434
exportFunctions: (fs: any) => void;
3535
}
3636
const Comp = defineComponent((props: P) => {
37+
const appStore = useAppStore();
3738
const text = ref('');
3839
const computing = ref(0); // 0:空闲 负随机数:正在计算 正整数:等待下一次触发计算的计时器序号
3940
const confirming = ref(false);
@@ -58,9 +59,10 @@ const Comp = defineComponent((props: P) => {
5859
// const u = categorized.value.unknowns.length;
5960
const { localFilesCount: lf, localDirsCount: ld, remotesCount: r, unknownsCount: u } = categorized.value;
6061
if (lf + ld + r + u === 0) {
61-
return '您未添加文件';
62+
return '您未填入文件';
6263
} else {
63-
return `您已添加${lf ? ` ${lf} 个本地${window.jsb ? '文件' : '路径'},` : ''}${ld ? ` ${ld} 个本地文件夹,` : ''}${r ? ` ${r} 个远程路径,` : ''}${u ? ` ${u} 个未知文件,` : ''}`.slice(0, -1);
64+
return `您已填入${lf ? ` ${lf} 个本地${window.jsb ? '文件' : '路径'},` : ''}${ld ? ` ${ld} 个本地文件夹,` : ''}${r ? ` ${r} 个远程路径,` : ''}${u ? ` ${u} 个未知文件,` : ''}`.slice(0, -1) +
65+
(appStore.functionLevel < 40 ? '。(上限 66 个)' : appStore.functionLevel < 60 ? '。(上限 99 个)' : '');
6466
}
6567
}
6668
});

src/renderer/src/components/misc/ServerConfig.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { defineComponent, onMounted, ref } from "vue";
1+
import { computed, defineComponent, onMounted, ref } from "vue";
22
import { Server } from "@renderer/types";
33
import { useAppStore } from "@renderer/stores/appStore";
44
import { useTooltip } from "@renderer/common/tooltipUtil";
@@ -46,6 +46,7 @@ interface P {
4646
exportFunctions: (fs: any) => void;
4747
}
4848
const Comp = defineComponent((props: P) => {
49+
const appStore = useAppStore();
4950
const maxThreadsValue = ref<string>();
5051
const customFFmpegPathValue = ref<string>();
5152
const preserveUnfinishedTasksValue = ref(true);
@@ -60,6 +61,8 @@ const Comp = defineComponent((props: P) => {
6061
}
6162
};
6263

64+
const maxThreadsLimit = computed(() => appStore.functionLevel < 40 ? 6 : appStore.functionLevel < 60 ? 9 : 0);
65+
6366
onMounted(() => {
6467
props.exportFunctions(exports);
6568
(async () => {
@@ -76,7 +79,7 @@ const Comp = defineComponent((props: P) => {
7679
<div class={style.serverConfig}>
7780
<BoxedNormalInput
7881
title="同时转码任务数量" value={maxThreadsValue.value} onChange={(value: string) => maxThreadsValue.value = value} inputFixer={posIntegerFixer} placeholder="1"
79-
{ ...useTooltip('开始转码队列后,会使所有未完成任务进入排队状态,并持续挑选最靠前的任务开始运行。同时运行的任务数量受此控制', 't') }
82+
{ ...useTooltip(`开始转码队列后,会使所有未完成任务进入排队状态,并持续挑选最靠前的任务开始运行。同时运行的任务数量受此控制${maxThreadsLimit.value ? `\n(您的用户等级最高支持同时运行 ${maxThreadsLimit.value} 个任务)` : ''}`, 't') }
8083
/>
8184
<BoxedSwitch
8285
title="保留未完成任务" checked={preserveUnfinishedTasksValue.value} onChange={(value: boolean) => preserveUnfinishedTasksValue.value = value}

0 commit comments

Comments
 (0)