Compare commits
2 Commits
be65e275b3
...
6b645dedf0
| Author | SHA1 | Date | |
|---|---|---|---|
|
6b645dedf0
|
|||
|
3cb14be4bc
|
@@ -250,6 +250,7 @@
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
@@ -259,6 +260,7 @@
|
||||
ENABLE_PREVIEWS = YES;
|
||||
ENABLE_USER_SELECTED_FILES = readonly;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_KEY_LSUIElement = YES;
|
||||
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
@@ -274,7 +276,6 @@
|
||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||
SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES;
|
||||
SWIFT_VERSION = 5.0;
|
||||
INFOPLIST_KEY_LSUIElement = YES;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@@ -283,6 +284,7 @@
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
@@ -292,6 +294,7 @@
|
||||
ENABLE_PREVIEWS = YES;
|
||||
ENABLE_USER_SELECTED_FILES = readonly;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_KEY_LSUIElement = YES;
|
||||
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
@@ -307,7 +310,6 @@
|
||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||
SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES;
|
||||
SWIFT_VERSION = 5.0;
|
||||
INFOPLIST_KEY_LSUIElement = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
||||
@@ -55,12 +55,15 @@ struct MenuContent: View {
|
||||
// 主要操作按钮:切换功能
|
||||
Button(action: {
|
||||
// 点击按钮,切换功能的开关状态
|
||||
appState.toggleFunction()
|
||||
withAnimation(.easeInOut(duration: 0.3)) {
|
||||
appState.toggleFunction()
|
||||
}
|
||||
}) {
|
||||
HStack(spacing: 12) {
|
||||
Image(systemName: appState.isFunctionEnabled ? "stop.circle.fill" : "play.circle.fill")
|
||||
.foregroundColor(appState.isFunctionEnabled ? .red : .green)
|
||||
.font(.title2)
|
||||
.transition(.scale(scale: 0.8, anchor: .center))
|
||||
VStack(alignment: .leading, spacing: 2) {
|
||||
Text(appState.isFunctionEnabled ? "关闭常亮" : "开启常亮")
|
||||
.font(.body)
|
||||
@@ -74,11 +77,14 @@ struct MenuContent: View {
|
||||
.background(
|
||||
RoundedRectangle(cornerRadius: 8)
|
||||
.fill(appState.isFunctionEnabled ? Color.red.opacity(0.1) : Color.green.opacity(0.1))
|
||||
.transition(.opacity)
|
||||
)
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
|
||||
Divider()
|
||||
.transition(.opacity)
|
||||
.animation(.easeInOut(duration: 0.3), value: appState.isFunctionEnabled)
|
||||
|
||||
// 状态显示
|
||||
VStack(alignment: .leading, spacing: 4) {
|
||||
@@ -91,6 +97,7 @@ struct MenuContent: View {
|
||||
Circle()
|
||||
.fill(appState.isUserIdle ? Color.orange : Color.green)
|
||||
.frame(width: 8, height: 8)
|
||||
.transition(.scale(scale: 0.5, anchor: .center))
|
||||
Text(appState.isUserIdle ? "空闲" : "活动中")
|
||||
.font(.body)
|
||||
|
||||
@@ -112,6 +119,8 @@ struct MenuContent: View {
|
||||
}
|
||||
Spacer()
|
||||
}
|
||||
.transition(.opacity)
|
||||
.animation(.easeInOut(duration: 0.3), value: appState.isFunctionEnabled || appState.isUserIdle)
|
||||
}
|
||||
.padding(8)
|
||||
.background(
|
||||
@@ -122,7 +131,7 @@ struct MenuContent: View {
|
||||
Divider()
|
||||
|
||||
// 权限管理
|
||||
VStack(alignment: .leading, spacing: 4) {
|
||||
VStack(alignment: .leading, spacing: 8) {
|
||||
Text("权限管理")
|
||||
.font(.caption)
|
||||
.foregroundColor(.secondary)
|
||||
@@ -147,9 +156,15 @@ struct MenuContent: View {
|
||||
.font(.caption)
|
||||
.foregroundColor(.blue)
|
||||
}
|
||||
.padding(8)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.background(
|
||||
RoundedRectangle(cornerRadius: 8)
|
||||
.fill(Color.blue.opacity(0.05))
|
||||
)
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
.padding(4)
|
||||
|
||||
|
||||
// 打开用户与群组设置,用于管理登录项
|
||||
Button(action: {
|
||||
@@ -164,11 +179,16 @@ struct MenuContent: View {
|
||||
.font(.caption)
|
||||
.foregroundColor(.blue)
|
||||
}
|
||||
.padding(8)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.background(
|
||||
RoundedRectangle(cornerRadius: 8)
|
||||
.fill(Color.blue.opacity(0.05))
|
||||
)
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
.padding(4)
|
||||
}
|
||||
.padding(4)
|
||||
.padding(8)
|
||||
|
||||
Divider()
|
||||
|
||||
@@ -185,7 +205,7 @@ struct MenuContent: View {
|
||||
}
|
||||
.toggleStyle(.checkbox)
|
||||
.font(.caption)
|
||||
.padding(4)
|
||||
.padding(8)
|
||||
|
||||
Divider()
|
||||
|
||||
@@ -197,7 +217,7 @@ struct MenuContent: View {
|
||||
.buttonStyle(.plain)
|
||||
.font(.caption)
|
||||
.foregroundColor(.secondary)
|
||||
.padding(4)
|
||||
.padding(8)
|
||||
|
||||
Divider()
|
||||
|
||||
@@ -208,7 +228,7 @@ struct MenuContent: View {
|
||||
.buttonStyle(.plain)
|
||||
.font(.caption)
|
||||
.foregroundColor(.secondary)
|
||||
.padding(4)
|
||||
.padding(8)
|
||||
}
|
||||
.padding(12)
|
||||
.frame(minWidth: 280)
|
||||
@@ -239,6 +259,8 @@ struct MenuContent: View {
|
||||
window.title = "PowerBar 使用指南"
|
||||
window.contentView = NSHostingView(rootView: GuideView())
|
||||
window.center()
|
||||
|
||||
// 显示窗口
|
||||
window.makeKeyAndOrderFront(nil)
|
||||
|
||||
// 记录已显示指引
|
||||
@@ -246,16 +268,6 @@ struct MenuContent: View {
|
||||
|
||||
// 保存窗口引用
|
||||
guideWindow = window
|
||||
|
||||
// 添加窗口关闭通知监听
|
||||
NotificationCenter.default.addObserver(
|
||||
forName: NSWindow.willCloseNotification,
|
||||
object: window,
|
||||
queue: nil
|
||||
) { _ in
|
||||
// 窗口关闭时清除引用
|
||||
guideWindow = nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -308,7 +320,7 @@ struct GuideView: View {
|
||||
}
|
||||
|
||||
HStack(spacing: 12) {
|
||||
Image(systemName: "power.on.circle")
|
||||
Image(systemName: "power.circle")
|
||||
.font(.title)
|
||||
.foregroundColor(.orange)
|
||||
.frame(width: 40)
|
||||
@@ -415,6 +427,8 @@ struct GuideView: View {
|
||||
RoundedRectangle(cornerRadius: 8)
|
||||
.fill(.blue)
|
||||
)
|
||||
.transition(.scale(scale: 0.9, anchor: .center))
|
||||
.animation(.easeInOut(duration: 0.2), value: UUID())
|
||||
}
|
||||
.padding(.bottom, 20)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user