精简主窗口为四张操作卡片并准备135正式构建

这个提交包含在:
mac 于 2026-11-14 23:31:40 +08:00 提交
1 父节点 5adb9a20c7
当前提交 a084d9d5b8
10 个文件已更改
+5529 -144

没有与搜索条件相匹配的文件

+1 -1
查看文件
@@ -19,7 +19,7 @@
<key>CFBundleShortVersionString</key>
<string>1.22.2</string>
<key>CFBundleVersion</key>
<string>134</string>
<string>135</string>
<key>NSHumanReadableCopyright</key>
<string></string>
<key>PlugInKit</key>
+142 -114
查看文件
@@ -26,9 +26,9 @@ static NSColor *DYSecondary(void) { return DYColor(.70,.74,.81); }
- (BOOL)isFlipped { return YES; }
- (void)drawRect:(NSRect)dirty {
BOOL contrast = NSWorkspace.sharedWorkspace.accessibilityDisplayShouldIncreaseContrast;
NSBezierPath *shape = [NSBezierPath bezierPathWithRoundedRect:NSInsetRect(self.bounds,1,1) xRadius:self.backdrop ? 0 : 22 yRadius:self.backdrop ? 0 : 22];
NSBezierPath *shape = [NSBezierPath bezierPathWithRoundedRect:NSInsetRect(self.bounds,1,1) xRadius:self.backdrop ? 0 : 14 yRadius:self.backdrop ? 0 : 14];
NSColor *base = DYColor(.105,.115,.14);
NSColor *start = self.backdrop ? DYColor(.105,.14,.20) : [base blendedColorWithFraction:.17 ofColor:self.tint];
NSColor *start = self.backdrop ? DYColor(.105,.14,.20) : [base blendedColorWithFraction:.07 ofColor:self.tint];
NSColor *end = self.backdrop ? DYColor(.105,.115,.115) : base;
NSGradient *gradient = [[[NSGradient alloc] initWithStartingColor:start endingColor:end] autorelease];
[gradient drawInBezierPath:shape angle:35];
@@ -72,7 +72,7 @@ static NSTextField *DYLabel(NSString *text, CGFloat size, NSFontWeight weight, N
}
static NSStackView *DYStack(NSArray *views, NSUserInterfaceLayoutOrientation orientation, CGFloat spacing) {
NSStackView *stack = [NSStackView stackViewWithViews:views];
stack.orientation = orientation; stack.spacing = spacing;
stack.orientation = orientation; stack.spacing = spacing; stack.detachesHiddenViews = YES;
stack.alignment = orientation == NSUserInterfaceLayoutOrientationVertical ? NSLayoutAttributeLeading : NSLayoutAttributeTop;
stack.translatesAutoresizingMaskIntoConstraints = NO;
if (orientation == NSUserInterfaceLayoutOrientationHorizontal) stack.distribution = NSStackViewDistributionFillEqually;
@@ -90,13 +90,13 @@ static DYActionButton *DYButton(NSString *title, NSColor *tint, BOOL prominent,
DYActionButton *button = [DYActionButton buttonWithTitle:title target:target action:action];
button.tint = tint; button.prominent = prominent; button.bordered = NO;
button.translatesAutoresizingMaskIntoConstraints = NO;
[button.heightAnchor constraintEqualToConstant:42].active = YES;
[button.widthAnchor constraintGreaterThanOrEqualToConstant:124].active = YES;
[button.heightAnchor constraintEqualToConstant:34].active = YES;
[button.widthAnchor constraintGreaterThanOrEqualToConstant:100].active = YES;
return button;
}
static DYSurface *DYCard(NSColor *tint, NSStackView *content) {
DYSurface *card = [[[DYSurface alloc] initWithFrame:NSZeroRect] autorelease];
card.tint = tint; card.translatesAutoresizingMaskIntoConstraints = NO; DYPin(content,card,22);
card.tint = tint; card.translatesAutoresizingMaskIntoConstraints = NO; DYPin(content,card,18);
for (NSView *view in content.arrangedSubviews) [view.widthAnchor constraintEqualToAnchor:content.widthAnchor].active = YES;
return card;
}
@@ -117,8 +117,8 @@ static NSTextField *DYHeading(NSString *symbol, NSString *text, NSColor *color)
typedef NS_ENUM(NSInteger,DYRegistrationState) { DYChecking, DYRegistering, DYReady, DYFailed };
@interface AppDelegate ()
@property(weak) IBOutlet NSWindow *window;
@property(assign) NSTextField *statusTitle, *statusDetail, *exitDetail;
@property(assign) DYActionButton *retryButton, *keepButton, *confirmationButton;
@property(assign) NSTextField *statusTitle, *statusDetail;
@property(assign) DYActionButton *retryButton, *confirmationButton;
@property(assign) NSProgressIndicator *progress;
@property(assign) DYSurface *registrationCard;
@property DYRegistrationState registrationState;
@@ -126,7 +126,7 @@ typedef NS_ENUM(NSInteger,DYRegistrationState) { DYChecking, DYRegistering, DYRe
@property(retain) NSStatusItem *statusItem;
@property(retain) NSMutableDictionary *diagnostics;
@property(retain) DYBetaUpdater *updater;
@property(assign) NSTextField *updateTitle, *updateDetail, *diagnosticDetail, *reportID;
@property(assign) NSTextField *updateTitle, *diagnosticDetail;
@property(assign) DYActionButton *updateCheckButton, *updateInstallButton, *updateCancelButton, *sendSummaryButton;
@property(assign) NSButton *diagnosticToggle;
@property(assign) NSProgressIndicator *updateProgress;
@@ -147,7 +147,7 @@ typedef NS_ENUM(NSInteger,DYRegistrationState) { DYChecking, DYRegistering, DYRe
self.window.title = @"大鱼调色";
self.window.appearance = [NSAppearance appearanceNamed:NSAppearanceNameDarkAqua];
self.window.titlebarAppearsTransparent = YES; self.window.backgroundColor = DYColor(.105,.14,.20);
self.window.contentMinSize = NSMakeSize(760,620); [self.window setContentSize:NSMakeSize(920,850)]; [self.window center];
self.window.contentMinSize = NSMakeSize(720,560); [self.window setContentSize:NSMakeSize(840,620)]; [self.window center];
DYBetaStart();
[self buildInterface]; [self buildMenu]; [self buildStatusItem];
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(refreshDiagnostics:) name:DYBetaDiagnosticsChanged object:nil];
@@ -177,7 +177,7 @@ typedef NS_ENUM(NSInteger,DYRegistrationState) { DYChecking, DYRegistering, DYRe
NSMenuItem *root = [[[NSMenuItem alloc] initWithTitle:@"大鱼调色" action:NULL keyEquivalent:@""] autorelease]; [menu addItem:root];
NSMenu *app = [[[NSMenu alloc] initWithTitle:@"大鱼调色"] autorelease]; root.submenu = app;
for (NSArray *entry in @[@[@"关于大鱼调色",NSStringFromSelector(@selector(orderFrontStandardAboutPanel:)),@""],
@[@"查看功能介绍",NSStringFromSelector(@selector(keepIntroduction:)),@"i"],
@[@"使用帮助",NSStringFromSelector(@selector(showUsage:)),@"i"],
@[@"重新检查插件",NSStringFromSelector(@selector(checkRegistration:)),@"r"],
@[@"检查公测更新",NSStringFromSelector(@selector(checkUpdate:)),@"u"],
@[@"访问发布地址",NSStringFromSelector(@selector(openWebsite:)),@""],
@@ -189,98 +189,129 @@ typedef NS_ENUM(NSInteger,DYRegistrationState) { DYChecking, DYRegistering, DYRe
NSApp.mainMenu = menu;
}
- (void)buildInterface {
DYSurface *backdrop = [[[DYSurface alloc] initWithFrame:NSZeroRect] autorelease]; backdrop.backdrop = YES; self.window.contentView = backdrop;
DYSurface *backdrop = [[[DYSurface alloc] initWithFrame:NSZeroRect] autorelease];
backdrop.backdrop = YES;
self.window.contentView = backdrop;
NSScrollView *scroll = [[[NSScrollView alloc] initWithFrame:NSZeroRect] autorelease];
scroll.drawsBackground = NO; scroll.hasVerticalScroller = YES; scroll.autohidesScrollers = YES; DYPin(scroll,backdrop,0);
scroll.drawsBackground = NO;
scroll.hasVerticalScroller = YES;
scroll.autohidesScrollers = YES;
DYPin(scroll,backdrop,0);
DYSurface *document = [[[DYSurface alloc] initWithFrame:NSZeroRect] autorelease];
document.backdrop = YES; document.translatesAutoresizingMaskIntoConstraints = NO; scroll.documentView = document;
document.backdrop = YES;
document.translatesAutoresizingMaskIntoConstraints = NO;
scroll.documentView = document;
[NSLayoutConstraint activateConstraints:@[
[document.leadingAnchor constraintEqualToAnchor:scroll.contentView.leadingAnchor],
[document.topAnchor constraintEqualToAnchor:scroll.contentView.topAnchor],
[document.widthAnchor constraintEqualToAnchor:scroll.contentView.widthAnchor]]];
NSButton *website = [NSButton buttonWithTitle:@"发布地址 https://dayu.media ↗" target:self action:@selector(openWebsite:)];
website.bordered = NO; website.translatesAutoresizingMaskIntoConstraints = NO;
website.attributedTitle = [[[NSAttributedString alloc] initWithString:website.title attributes:@{
NSFontAttributeName:[NSFont systemFontOfSize:13 weight:NSFontWeightMedium],NSForegroundColorAttributeName:DYBlue()}] autorelease];
[website.heightAnchor constraintEqualToConstant:28].active = YES;
NSDictionary *info = NSBundle.mainBundle.infoDictionary;
NSArray *heroLabels = @[DYLabel(@"FINAL CUT PRO / MOTION",11,NSFontWeightSemibold,DYBlue()),
DYLabel(@"大鱼调色",42,NSFontWeightBold,NSColor.whiteColor),
DYLabel(@"从色彩还原到胶片质感,让每一次调色更从容。",15,NSFontWeightRegular,DYSecondary()),
DYLabel([NSString stringWithFormat:@"v%@ · 构建 %@ / 原生 FxPlug 4 · Apple Silicon",info[@"CFBundleShortVersionString"],info[@"CFBundleVersion"]],11,NSFontWeightMedium,DYSecondary())];
NSStackView *hero = DYStack(heroLabels,NSUserInterfaceLayoutOrientationVertical,8);
for (NSTextField *label in heroLabels) { label.alignment = NSTextAlignmentCenter; [label.widthAnchor constraintEqualToAnchor:hero.widthAnchor].active = YES; }
self.statusTitle = DYLabel(@"正在检查插件…",22,NSFontWeightSemibold,NSColor.whiteColor);
self.statusDetail = DYLabel(@"正在检查本机插件登记,随后自动提交注册。",13,NSFontWeightRegular,DYSecondary());
[self.statusDetail.heightAnchor constraintGreaterThanOrEqualToConstant:42].active = YES;
NSStackView *title = DYStack(@[
DYLabel(@"大鱼调色",28,NSFontWeightSemibold,NSColor.whiteColor),
DYLabel([NSString stringWithFormat:@"%@ · %@",info[@"CFBundleShortVersionString"],info[@"CFBundleVersion"]],11,NSFontWeightRegular,DYSecondary())
],NSUserInterfaceLayoutOrientationVertical,4);
NSButton *help = [NSButton buttonWithTitle:@"使用帮助 ↗" target:self action:@selector(showUsage:)];
help.bordered = NO;
help.contentTintColor = DYBlue();
NSStackView *header = DYStack(@[title,help],NSUserInterfaceLayoutOrientationHorizontal,12);
header.distribution = NSStackViewDistributionFill;
header.alignment = NSLayoutAttributeCenterY;
self.accountTitle = DYLabel(@"正在检查…",20,NSFontWeightSemibold,NSColor.whiteColor);
self.accountDetail = DYLabel(@"",13,NSFontWeightRegular,DYSecondary());
self.loginButton = DYButton(@"微信登录",DYBlue(),YES,self,@selector(loginOnlineAccount:));
self.accessButton = DYButton(@"刷新权限",DYBlue(),NO,self,@selector(refreshOnlineAccount:));
self.logoutButton = DYButton(@"退出登录",DYSecondary(),NO,self,@selector(logoutOnlineAccount:));
self.logoutButton.hidden = YES;
NSButton *accountInfo = [NSButton buttonWithTitle:@"权限与预览说明" target:self action:@selector(showAccountInfo:)];
accountInfo.bordered = NO;
accountInfo.contentTintColor = DYSecondary();
DYSurface *accountCard = DYCard(DYBlue(),DYStack(@[
DYHeading(@"person.crop.circle",@"在线 LUT",DYBlue()),self.accountTitle,self.accountDetail,
DYStack(@[self.loginButton,self.accessButton,self.logoutButton],NSUserInterfaceLayoutOrientationHorizontal,8),accountInfo
],NSUserInterfaceLayoutOrientationVertical,12));
self.statusTitle = DYLabel(@"正在检查…",20,NSFontWeightSemibold,NSColor.whiteColor);
self.statusDetail = DYLabel(@"",13,NSFontWeightRegular,DYSecondary());
self.progress = [[[NSProgressIndicator alloc] initWithFrame:NSZeroRect] autorelease];
self.progress.style = NSProgressIndicatorStyleBar; self.progress.indeterminate = YES; self.progress.translatesAutoresizingMaskIntoConstraints = NO;
self.retryButton = DYButton(@"检查中…",DYBlue(),NO,self,@selector(checkRegistration:));
self.keepButton = DYButton(@"查看功能介绍",DYColor(.20,.46,.94),YES,self,@selector(keepIntroduction:));
self.exitDetail = DYLabel(@"应用会保持运行,关闭窗口后继续后台诊断。",15,NSFontWeightSemibold,DYGreen());
[self.exitDetail.heightAnchor constraintGreaterThanOrEqualToConstant:38].active = YES;
NSStackView *registration = DYStack(@[DYHeading(@"puzzlepiece.extension",@"插件连接",DYBlue()),self.statusTitle,self.statusDetail,self.progress,
self.exitDetail,DYStack(@[self.retryButton,self.keepButton],NSUserInterfaceLayoutOrientationHorizontal,8)],NSUserInterfaceLayoutOrientationVertical,13);
self.registrationCard = DYCard(DYBlue(),registration);
self.confirmationButton = DYButton(@"已确认,后台运行",DYGreen(),NO,self,@selector(confirmHost:));
self.progress.style = NSProgressIndicatorStyleBar;
self.progress.indeterminate = YES;
self.progress.translatesAutoresizingMaskIntoConstraints = NO;
self.retryButton = DYButton(@"重新检查",DYBlue(),NO,self,@selector(checkRegistration:));
self.confirmationButton = DYButton(@"已确认,后台运行",DYSecondary(),NO,self,@selector(confirmHost:));
self.confirmationButton.enabled = NO;
self.confirmationButton.toolTip = @"请先在 Final Cut Pro 中应用大鱼调色并确认效果正常,再点击此按钮。";
NSStackView *host = DYStack(@[DYHeading(@"play.rectangle",@"在 Final Cut Pro 中检查",DYGreen()),
DYLabel(@"调色,留在时间线里。",22,NSFontWeightSemibold,NSColor.whiteColor),
DYLabel(@"Final Cut Pro:效果 → 大鱼调色\n将效果应用到片段,确认画面与调节正常。\n打开宿主检查会保留本窗口,等待你确认。",13,NSFontWeightRegular,DYSecondary()),
DYStack(@[DYButton(@"打开 FCP 检查",DYColor(.20,.46,.94),YES,self,@selector(openFinalCut:)),DYButton(@"打开 Motion",DYGreen(),NO,self,@selector(openMotion:))],NSUserInterfaceLayoutOrientationHorizontal,8),
self.confirmationButton],NSUserInterfaceLayoutOrientationVertical,13);
DYSurface *hostCard = DYCard(DYGreen(),host);
NSStackView *top = DYStack(@[self.registrationCard,hostCard],NSUserInterfaceLayoutOrientationHorizontal,14);
[self.registrationCard.heightAnchor constraintEqualToAnchor:hostCard.heightAnchor].active = YES;
self.updateTitle = DYLabel(@"公测更新",20,NSFontWeightSemibold,NSColor.whiteColor);
self.updateDetail = DYLabel(@"启动时自动检查,新版本由你确认安装。",13,NSFontWeightRegular,DYSecondary());
[self.updateDetail.heightAnchor constraintGreaterThanOrEqualToConstant:42].active = YES;
self.confirmationButton.toolTip = @"在宿主中确认效果正常后,可收起此窗口。";
self.registrationCard = DYCard(DYGreen(),DYStack(@[
DYHeading(@"puzzlepiece.extension",@"插件连接",DYGreen()),self.statusTitle,self.statusDetail,self.progress,
DYStack(@[DYButton(@"打开 FCP",DYBlue(),YES,self,@selector(openFinalCut:)),
DYButton(@"打开 Motion",DYSecondary(),NO,self,@selector(openMotion:))],NSUserInterfaceLayoutOrientationHorizontal,8),
DYStack(@[self.retryButton,self.confirmationButton],NSUserInterfaceLayoutOrientationHorizontal,8)
],NSUserInterfaceLayoutOrientationVertical,12));
NSStackView *top = DYStack(@[accountCard,self.registrationCard],NSUserInterfaceLayoutOrientationHorizontal,14);
[accountCard.heightAnchor constraintEqualToAnchor:self.registrationCard.heightAnchor].active = YES;
self.updateTitle = DYLabel(@"检查中…",18,NSFontWeightSemibold,NSColor.whiteColor);
self.updateProgress = [[[NSProgressIndicator alloc] initWithFrame:NSZeroRect] autorelease];
self.updateProgress.style=NSProgressIndicatorStyleBar; self.updateProgress.indeterminate=NO;
self.updateProgress.minValue=0; self.updateProgress.maxValue=1; self.updateProgress.translatesAutoresizingMaskIntoConstraints=NO;
self.updateCheckButton=DYButton(@"检查更新",DYBlue(),NO,self,@selector(checkUpdate:));
self.updateInstallButton=DYButton(@"下载更新",DYColor(.20,.46,.94),YES,self,@selector(installUpdate:));
self.updateInstallButton.enabled=NO;
self.updateCancelButton=DYButton(@"取消下载",DYBlue(),NO,self,@selector(cancelUpdate:)); self.updateCancelButton.hidden=YES;
DYSurface *updateCard=DYCard(DYBlue(),DYStack(@[DYHeading(@"arrow.triangle.2.circlepath",@"持续改进,及时更新",DYBlue()),self.updateTitle,self.updateDetail,self.updateProgress,
DYStack(@[self.updateCheckButton,self.updateInstallButton],NSUserInterfaceLayoutOrientationHorizontal,8),self.updateCancelButton],NSUserInterfaceLayoutOrientationVertical,10));
self.diagnosticToggle=[NSButton checkboxWithTitle:@"参与公测诊断" target:self action:@selector(toggleDiagnostics:)];
self.diagnosticToggle.font=[NSFont systemFontOfSize:16 weight:NSFontWeightSemibold]; self.diagnosticToggle.state=DYBetaEnabled()?NSControlStateValueOn:NSControlStateValueOff;
self.diagnosticDetail=DYLabel(@"诊断准备中…",12,NSFontWeightRegular,DYSecondary());
self.reportID=DYLabel(@"报告标识准备中…",10,NSFontWeightRegular,DYSecondary());self.reportID.selectable=YES;
self.sendSummaryButton=DYButton(@"发送诊断摘要",DYColor(.67,.59,1),NO,self,@selector(sendSummary:));
DYSurface *diagnosticCard=DYCard(DYColor(.67,.59,1),DYStack(@[DYHeading(@"waveform.path.ecg",@"一起完善大鱼调色",DYColor(.67,.59,1)),self.diagnosticToggle,
DYLabel(@"后台自动发送版本、系统环境、阶段耗时、内存及本产品崩溃/卡顿调用栈摘要到 dayu.media;不发送素材、预设或账号。可随时关闭,保留 30 天。",12,NSFontWeightRegular,DYSecondary()),
self.reportID,self.diagnosticDetail,self.sendSummaryButton],NSUserInterfaceLayoutOrientationVertical,10));
NSStackView *beta=DYStack(@[updateCard,diagnosticCard],NSUserInterfaceLayoutOrientationHorizontal,14);
[updateCard.heightAnchor constraintEqualToAnchor:diagnosticCard.heightAnchor].active=YES;
self.accountTitle=DYLabel(@"在线 LUT",22,NSFontWeightSemibold,NSColor.whiteColor);
self.accountDetail=DYLabel(@"在主 APP 登录后,即可在插件 LUT 浏览器中使用在线分类。",13,NSFontWeightRegular,DYSecondary());
self.loginButton=DYButton(@"微信登录",DYBlue(),YES,self,@selector(loginOnlineAccount:));
self.accessButton=DYButton(@"刷新权限",DYBlue(),NO,self,@selector(refreshOnlineAccount:));
self.logoutButton=DYButton(@"退出登录",DYSecondary(),NO,self,@selector(logoutOnlineAccount:));
DYSurface *accountCard=DYCard(DYBlue(),DYStack(@[DYHeading(@"person.crop.circle",@"大鱼账号 · 在线 LUT",DYBlue()),self.accountTitle,self.accountDetail,
DYLabel(@"有效会员,或已购买文章 14421 / 15792,即可浏览和下载全部已发布在线 LUT。\n打开插件的 LUT 浏览器时,会自动发送当前缓存帧缩略图到 dayu.media 并批量加载在线预览;服务器不保存预览帧。点击在线 LUT 后安装到本地分类,可离线使用。",12,NSFontWeightRegular,DYSecondary()),
DYStack(@[self.loginButton,self.accessButton,self.logoutButton],NSUserInterfaceLayoutOrientationHorizontal,8)],NSUserInterfaceLayoutOrientationVertical,12));
NSArray *features = @[
@[@"slider.horizontal.3",@"完整调色",@"精准还原,自由塑造",@"CST 色彩管理、光影与曲线\nHSL、色轮、蜘蛛盘与白平衡",DYBlue()],
@[@"square.grid.2x2",@"LUT 与风格",@"灵感,所见即所得",@"LUT 缩略图浏览与实时预览\n快速收藏,管理常用风格",DYColor(.67,.59,1)],
@[@"film",@"胶片质感",@"让画面更有温度",@"八种印片外观、颗粒与晕光\n辉光、暗角及通道混合器",DYColor(1,.67,.30)],
@[@"square.on.circle",@"局部与叠层",@"每个细节,都有层次",@"独立工具层、逐层蒙版\n画面控件与关键帧跟踪",DYGreen()]];
NSMutableArray *cards = [NSMutableArray array];
for (NSArray *feature in features) [cards addObject:DYCard(feature[4],DYStack(@[DYHeading(feature[0],feature[1],feature[4]),
DYLabel(feature[2],17,NSFontWeightSemibold,NSColor.whiteColor),DYLabel(feature[3],13,NSFontWeightRegular,DYSecondary())],NSUserInterfaceLayoutOrientationVertical,12))];
NSStackView *row1 = DYStack(@[cards[0],cards[1]],NSUserInterfaceLayoutOrientationHorizontal,14);
NSStackView *row2 = DYStack(@[cards[2],cards[3]],NSUserInterfaceLayoutOrientationHorizontal,14);
[((NSView *)cards[0]).heightAnchor constraintEqualToAnchor:((NSView *)cards[1]).heightAnchor].active = YES;
[((NSView *)cards[2]).heightAnchor constraintEqualToAnchor:((NSView *)cards[3]).heightAnchor].active = YES;
NSStackView *content = DYStack(@[website,hero,accountCard,top,beta,DYHeading(@"sparkles",@"一套工具,完成你的色彩表达",NSColor.whiteColor),row1,row2],NSUserInterfaceLayoutOrientationVertical,18);
DYPin(content,document,30);
for (NSView *view in content.arrangedSubviews) [view.widthAnchor constraintEqualToAnchor:content.widthAnchor].active = YES;
self.updateProgress.style = NSProgressIndicatorStyleBar;
self.updateProgress.minValue = 0;
self.updateProgress.maxValue = 1;
self.updateProgress.translatesAutoresizingMaskIntoConstraints = NO;
self.updateProgress.hidden = YES;
self.updateCheckButton = DYButton(@"检查更新",DYBlue(),NO,self,@selector(checkUpdate:));
self.updateInstallButton = DYButton(@"下载更新",DYBlue(),YES,self,@selector(installUpdate:));
self.updateInstallButton.hidden = YES;
self.updateInstallButton.enabled = NO;
self.updateCancelButton = DYButton(@"取消下载",DYSecondary(),NO,self,@selector(cancelUpdate:));
self.updateCancelButton.hidden = YES;
DYSurface *updateCard = DYCard(DYBlue(),DYStack(@[
DYHeading(@"arrow.triangle.2.circlepath",@"版本更新",DYBlue()),self.updateTitle,self.updateProgress,
DYStack(@[self.updateCheckButton,self.updateInstallButton],NSUserInterfaceLayoutOrientationHorizontal,8),self.updateCancelButton
],NSUserInterfaceLayoutOrientationVertical,12));
self.diagnosticToggle = [NSButton checkboxWithTitle:@"参与公测诊断" target:self action:@selector(toggleDiagnostics:)];
self.diagnosticToggle.font = [NSFont systemFontOfSize:13 weight:NSFontWeightMedium];
self.diagnosticToggle.state = DYBetaEnabled()?NSControlStateValueOn:NSControlStateValueOff;
self.diagnosticDetail = DYLabel(@"",12,NSFontWeightRegular,DYSecondary());
self.sendSummaryButton = DYButton(@"发送摘要",DYSecondary(),NO,self,@selector(sendSummary:));
NSButton *privacy = [NSButton buttonWithTitle:@"隐私说明" target:self action:@selector(showDiagnosticsInfo:)];
privacy.bordered = NO;
privacy.contentTintColor = DYSecondary();
DYSurface *diagnosticCard = DYCard(DYSecondary(),DYStack(@[
DYHeading(@"waveform.path.ecg",@"诊断",DYSecondary()),self.diagnosticToggle,self.diagnosticDetail,
DYStack(@[self.sendSummaryButton,privacy],NSUserInterfaceLayoutOrientationHorizontal,8)
],NSUserInterfaceLayoutOrientationVertical,12));
NSStackView *bottom = DYStack(@[updateCard,diagnosticCard],NSUserInterfaceLayoutOrientationHorizontal,14);
[updateCard.heightAnchor constraintEqualToAnchor:diagnosticCard.heightAnchor].active = YES;
NSStackView *content = DYStack(@[header,top,bottom],NSUserInterfaceLayoutOrientationVertical,18);
DYPin(content,document,24);
for (NSView *view in content.arrangedSubviews)
[view.widthAnchor constraintEqualToAnchor:content.widthAnchor].active = YES;
[document.heightAnchor constraintGreaterThanOrEqualToAnchor:scroll.contentView.heightAnchor].active = YES;
}
- (void)showUsage:(id)sender {
NSAlert *alert = [[[NSAlert alloc] init] autorelease];
alert.messageText = @"使用大鱼调色";
alert.informativeText = @"在 Final Cut Pro 的“效果 → 大鱼调色”中,将效果拖到片段。Motion 中可使用原生滤镜。\n\n更新或重新注册插件后,请保存项目并重新打开宿主。关闭主窗口后,应用仍在后台运行,可从菜单栏重新打开或退出。";
[alert addButtonWithTitle:@"好"];
[alert beginSheetModalForWindow:self.window completionHandler:nil];
}
- (void)showAccountInfo:(id)sender {
NSAlert *alert = [[[NSAlert alloc] init] autorelease];
alert.messageText = @"在线 LUT";
alert.informativeText = @"有效会员,或已购买文章 14421 / 15792,可使用全部已发布在线 LUT。请在插件 LUT 浏览器中展开“在线 LUT”。\n\n浏览器会发送当前缓存帧缩略图到 dayu.media 生成预览,服务器仅在内存处理。点击 LUT 后下载到本地分类,可离线使用。";
[alert addButtonWithTitle:@"好"];
[alert beginSheetModalForWindow:self.window completionHandler:nil];
}
- (void)showDiagnosticsInfo:(id)sender {
NSAlert *alert = [[[NSAlert alloc] init] autorelease];
alert.messageText = @"公测诊断与隐私";
alert.informativeText = [NSString stringWithFormat:@"诊断向 dayu.media 发送版本、系统环境、阶段耗时、内存和本产品崩溃/卡顿调用栈摘要,保留30天。素材、预设和账号不在诊断内容中。可随时关闭。\n\n报告标识\n%@",DYBetaStatus()[@"installation_id"]?:@"准备中"];
[alert addButtonWithTitle:@"好"];
[alert beginSheetModalForWindow:self.window completionHandler:nil];
}
- (void)stopAccountLogin {
self.accountGeneration++;[self.accountTask cancel];self.accountTask=nil;
[self.loginTimer invalidate];self.loginTimer=nil;self.loginSessionKey=nil;self.pollingLogin=NO;
@@ -289,15 +320,16 @@ typedef NS_ENUM(NSInteger,DYRegistrationState) { DYChecking, DYRegistering, DYRe
- (void)showOnlineAccount:(NSDictionary *)value {
self.accessButton.enabled=YES;self.logoutButton.enabled=YES;
BOOL allowed=[value[@"allowed"]isKindOfClass:NSNumber.class]&&[value[@"allowed"]boolValue];
self.accountTitle.stringValue=allowed?@"在线 LUT 已开放":@"账号已登录,尚无在线 LUT 权限";
self.accountTitle.stringValue=allowed?@"已开通":@"尚未开通";
self.loginButton.hidden=YES;self.logoutButton.hidden=NO;
NSString *name=[value[@"username"]isKindOfClass:NSString.class]?value[@"username"]:@"大鱼用户";
self.accountDetail.stringValue=[NSString stringWithFormat:@"%@\n%@",name,allowed?@"已识别本机绑定账号。在 FCP 的 LUT 浏览器分类栏中展开“在线 LUT”即可使用。":@"需要有效会员,或购买文章 14421 / 15792。购买后点击刷新权限。"];
self.accountDetail.stringValue=name;
}
- (void)restoreBoundOnlineAccount {
NSUInteger generation=++self.accountGeneration;[self.accountTask cancel];
NSString *device=[DYOnlineLUTClient deviceUUID];
if(!device){self.accountTitle.stringValue=@"无法识别本机";self.accountDetail.stringValue=@"无法读取 macOS 硬件 UUID,请稍后重试。";return;}
self.accountTitle.stringValue=@"正在识别本机已绑定的大鱼账号…";self.accessButton.enabled=NO;
self.accountTitle.stringValue=@"正在识别账号…";self.accessButton.enabled=NO;
self.accountTask=[DYOnlineLUTClient request:@"/device-login" body:@{@"device_uuid":device} authenticated:NO completion:^(NSData *data,NSError *error){
if(generation!=self.accountGeneration)return;self.accountTask=nil;self.accessButton.enabled=YES;
NSDictionary *value=[DYOnlineLUTClient JSON:data error:&error];
@@ -318,8 +350,9 @@ typedef NS_ENUM(NSInteger,DYRegistrationState) { DYChecking, DYRegistering, DYRe
if(sender)[NSUserDefaults.standardUserDefaults setBool:NO forKey:@"DYOnlineLUTAutomaticLoginDisabled"];
NSUInteger generation=++self.accountGeneration;[self.accountTask cancel];
self.logoutButton.enabled=[DYOnlineLUTClient credential]!=nil;
self.logoutButton.hidden=!self.logoutButton.enabled;self.loginButton.hidden=self.logoutButton.enabled;
if(!self.logoutButton.enabled){if(![NSUserDefaults.standardUserDefaults boolForKey:@"DYOnlineLUTAutomaticLoginDisabled"]){[self restoreBoundOnlineAccount];return;}self.accountTitle.stringValue=@"已退出登录";self.accountDetail.stringValue=@"点击刷新权限可识别本机已绑定账号,也可以重新微信登录。";return;}
self.accountTitle.stringValue=@"正在验证在线 LUT 权限…";self.accessButton.enabled=NO;
self.accountTitle.stringValue=@"正在检查权限…";self.accessButton.enabled=NO;
self.accountTask=[DYOnlineLUTClient request:@"/dayu-color/v1/lut/status" body:@{} authenticated:YES completion:^(NSData *data,NSError *error){
if(generation!=self.accountGeneration)return;self.accountTask=nil;self.accessButton.enabled=YES;
NSDictionary *value=[DYOnlineLUTClient JSON:data error:&error];
@@ -421,7 +454,6 @@ typedef NS_ENUM(NSInteger,DYRegistrationState) { DYChecking, DYRegistering, DYRe
[self.updater stopForIntegrityFailure];
[self finishRegistration:NO details:DYIntegrityRecoveryMessage results:results];
self.retryButton.enabled = NO;
self.exitDetail.stringValue = @"此副本的自动更新已停用。请安装原始安装包后重新打开。";
NSString *path = [NSBundle.mainBundle.bundlePath stringByAppendingPathComponent:DYPluginRelativePath];
dispatch_async(DYPluginRegistrationQueue(), ^{
@@ -441,7 +473,7 @@ typedef NS_ENUM(NSInteger,DYRegistrationState) { DYChecking, DYRegistering, DYRe
self.retryButton.enabled = NO; self.retryButton.title = @"检查中…";
self.statusTitle.stringValue = @"正在检查插件…"; self.statusTitle.textColor = NSColor.whiteColor;
self.statusDetail.stringValue = @"正在检查本机插件登记,随后自动提交注册。";
self.progress.indeterminate = YES; [self.progress startAnimation:nil];
self.progress.hidden = NO; self.progress.indeterminate = YES; [self.progress startAnimation:nil];
NSString *path = [NSBundle.mainBundle.bundlePath stringByAppendingPathComponent:DYPluginRelativePath];
self.diagnostics = [NSMutableDictionary dictionaryWithDictionary:@{
@"bundleID":NSBundle.mainBundle.bundleIdentifier ?: @"",@"version":[NSBundle.mainBundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"] ?: @"",
@@ -487,7 +519,7 @@ typedef NS_ENUM(NSInteger,DYRegistrationState) { DYChecking, DYRegistering, DYRe
}
BOOL submissionAccepted = [add[@"code"] intValue] == 0;
NSString *message = registered ?
@"已确认当前插件登记。请在 Final Cut Pro 中实际应用并确认效果正常;若宿主已打开,请保存后重新打开。" :
@"在宿主中应用效果并确认画面正常。" :
@"插件注册尚未完成。请点击“重新检查”,或重新安装后再试。窗口将保持打开。";
NSDictionary *results = @{@"integrity":@"verified",@"before":before,@"submission":add,@"after":after ?: @{},@"registered":@(registered),
@"discoveryVerified":@(registered),@"submissionAccepted":@(submissionAccepted),@"hostVerification":@"awaiting-user-confirmation",
@@ -501,9 +533,9 @@ typedef NS_ENUM(NSInteger,DYRegistrationState) { DYChecking, DYRegistering, DYRe
- (void)finishRegistration:(BOOL)success details:(NSString *)details results:(NSDictionary *)results {
if (self.terminating) return;
self.registrationState = success ? DYReady : DYFailed;
[self.progress stopAnimation:nil]; self.progress.indeterminate = NO; self.progress.doubleValue = success ? 100 : 0;
[self.progress stopAnimation:nil]; self.progress.hidden = YES; self.progress.indeterminate = NO; self.progress.doubleValue = success ? 100 : 0;
self.registrationCard.tint = success ? DYGreen() : DYColor(1,.67,.30); [self.registrationCard setNeedsDisplay:YES];
self.statusTitle.stringValue = success ? @"✓ 插件注册成功" : (self.integrityRejected ? @"安装完整性验证失败" : @"需要重新检查");
self.statusTitle.stringValue = success ? @"已连接" : (self.integrityRejected ? @"安装完整性验证失败" : @"需要重新检查");
self.statusTitle.textColor = success ? DYGreen() : DYColor(1,.75,.4); self.statusDetail.stringValue = details;
self.retryButton.title = @"重新检查"; self.retryButton.enabled = YES;
self.confirmationButton.enabled = success;
@@ -511,11 +543,6 @@ typedef NS_ENUM(NSInteger,DYRegistrationState) { DYChecking, DYRegistering, DYRe
NSAccessibilityPostNotificationWithUserInfo(self.window,NSAccessibilityAnnouncementRequestedNotification,
@{NSAccessibilityAnnouncementKey:self.statusTitle.stringValue,NSAccessibilityPriorityKey:@(NSAccessibilityPriorityHigh)});
DYBetaEvent(@"registration",@{@"status":success?@"registered":@"failed"});
if(success)[self refreshBackgroundState];
else self.exitDetail.stringValue=@"注册尚未完成,应用会保留此窗口以便重试。";
}
- (void)refreshBackgroundState {
if(self.registrationState==DYReady)self.exitDetail.stringValue=DYBetaEnabled()?@"后台诊断已开启。关闭窗口后继续运行,可从菜单栏重新打开或退出。":@"诊断已关闭。应用保持运行,可从菜单栏退出。";
}
- (void)buildStatusItem {
self.statusItem=[NSStatusBar.systemStatusBar statusItemWithLength:NSVariableStatusItemLength];
@@ -538,8 +565,9 @@ typedef NS_ENUM(NSInteger,DYRegistrationState) { DYChecking, DYRegistering, DYRe
BOOL busy=[@[@"checking",@"downloading",@"validating"]containsObject:phase];
BOOL available=[@[@"available",@"ready",@"host_wait",@"installer"]containsObject:phase];
if(![phase isEqual:@"checking"]){self.updateCheckDone=YES;if(available)[self keepIntroduction:nil];}
self.updateTitle.stringValue=[phase isEqual:@"available"]?state[@"message"]:@"公测更新";
self.updateDetail.stringValue=state[@"message"]?:@"";
self.updateTitle.stringValue=state[@"message"]?:@"版本更新";
self.updateInstallButton.hidden=!available;
self.updateProgress.hidden=!busy;
self.updateCheckButton.enabled=!busy && !rejected;
self.updateInstallButton.enabled=[@[@"available",@"ready",@"host_wait",@"installer"]containsObject:phase];
self.updateInstallButton.title=[phase isEqual:@"available"]?@"下载更新":@"安装更新";
@@ -549,7 +577,7 @@ typedef NS_ENUM(NSInteger,DYRegistrationState) { DYChecking, DYRegistering, DYRe
self.updateProgress.indeterminate=[@[@"checking",@"validating"]containsObject:phase];
if(self.updateProgress.indeterminate)[self.updateProgress startAnimation:nil];else [self.updateProgress stopAnimation:nil];
self.updateProgress.doubleValue=[@[@"ready",@"host_wait",@"installer"]containsObject:phase]?1:0;
[self refreshBackgroundState];
}
- (void)refreshUpdateProgress:(NSTimer *)timer {
if([self.updater.state[@"phase"]isEqual:@"downloading"])self.updateProgress.doubleValue=self.updater.downloadFraction;
@@ -562,18 +590,18 @@ typedef NS_ENUM(NSInteger,DYRegistrationState) { DYChecking, DYRegistering, DYRe
- (void)cancelUpdate:(id)sender { [self keepIntroduction:nil];[self.updater cancel]; }
- (void)refreshDiagnostics:(NSNotification *)note {
NSDictionary *state=DYBetaStatus();BOOL enabled=DYBetaEnabled();self.diagnosticToggle.state=enabled?NSControlStateValueOn:NSControlStateValueOff;
self.sendSummaryButton.enabled=enabled; [self refreshBackgroundState];
self.reportID.stringValue=[NSString stringWithFormat:@"报告标识:%@",state[@"installation_id"]?:@"准备中…"];
self.sendSummaryButton.enabled=enabled;
NSNumber *uploaded=state[@"last_upload"];
if(!enabled)self.diagnosticDetail.stringValue=@"诊断已关闭。不会继续上传,待发送摘要已清除。";
if(!enabled)self.diagnosticDetail.stringValue=@"已关闭";
else if(uploaded){NSDateFormatter *format=[[[NSDateFormatter alloc]init]autorelease];format.dateFormat=@"HH:mm:ss";
self.diagnosticDetail.stringValue=[NSString stringWithFormat:@"最近送达 %@ · 待发送 %@ 条",[format stringFromDate:[NSDate dateWithTimeIntervalSince1970:uploaded.doubleValue]],state[@"pending"]?:@0];}
else self.diagnosticDetail.stringValue=@"诊断将在后台发送,离线时暂存并稍后重试。";
self.diagnosticDetail.stringValue=[NSString stringWithFormat:@"最近发送 %@ · 待发送 %@",[format stringFromDate:[NSDate dateWithTimeIntervalSince1970:uploaded.doubleValue]],state[@"pending"]?:@0];}
else self.diagnosticDetail.stringValue=@"等待发送";
}
- (void)toggleDiagnostics:(id)sender { [self keepIntroduction:nil];DYBetaSetEnabled(self.diagnosticToggle.state==NSControlStateValueOn);[self refreshDiagnostics:nil]; }
- (void)sendSummary:(id)sender { [self keepIntroduction:nil];DYBetaSendSummary();self.diagnosticDetail.stringValue=@"已加入后台发送队列,送达后会显示时间。"; }
- (void)sendSummary:(id)sender { [self keepIntroduction:nil];DYBetaSendSummary();self.diagnosticDetail.stringValue=@"已加入发送队列"; }
- (void)keepIntroduction:(id)sender {
[self showMainWindow:sender]; [self refreshBackgroundState];
[self showMainWindow:sender];
}
- (void)confirmHost:(id)sender {
if (self.registrationState != DYReady) return;
+1 -1
查看文件
@@ -19,7 +19,7 @@
<key>CFBundleShortVersionString</key>
<string>1.22.2</string>
<key>CFBundleVersion</key>
<string>134</string>
<string>135</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSHumanReadableCopyright</key>