Skip to content

Commit

Permalink
fix ui shaking; allow pause when recording system-audio
Browse files Browse the repository at this point in the history
  • Loading branch information
lihaoyun6 committed Jul 10, 2024
1 parent 6e002e9 commit bc998ca
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
8 changes: 4 additions & 4 deletions QuickRecorder.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@
CODE_SIGN_ENTITLEMENTS = QuickRecorder/QuickRecorder.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 142;
CURRENT_PROJECT_VERSION = 143;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "\"QuickRecorder/Preview Content\"";
DEVELOPMENT_TEAM = L4T783637F;
Expand All @@ -446,7 +446,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 12.3;
MARKETING_VERSION = 1.4.2;
MARKETING_VERSION = 1.4.3;
PRODUCT_BUNDLE_IDENTIFIER = com.lihaoyun6.QuickRecorder;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
Expand All @@ -462,7 +462,7 @@
CODE_SIGN_ENTITLEMENTS = QuickRecorder/QuickRecorder.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 142;
CURRENT_PROJECT_VERSION = 143;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "\"QuickRecorder/Preview Content\"";
DEVELOPMENT_TEAM = L4T783637F;
Expand All @@ -480,7 +480,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 12.3;
MARKETING_VERSION = 1.4.2;
MARKETING_VERSION = 1.4.3;
PRODUCT_BUNDLE_IDENTIFIER = com.lihaoyun6.QuickRecorder;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
Expand Down
10 changes: 5 additions & 5 deletions QuickRecorder/ViewModel/ScreenSelector.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ struct ScreenSelector: View {
ScrollView(.vertical) {
VStack(spacing: 14){
ForEach(0..<viewModel.screenThumbnails.count/2 + 1, id: \.self) { rowIndex in
HStack(spacing: 40) {
HStack(spacing: 30) {
ForEach(0..<2, id: \.self) { columnIndex in
let index = 2 * rowIndex + columnIndex
if index <= viewModel.screenThumbnails.count - 1 {
Expand Down Expand Up @@ -54,7 +54,7 @@ struct ScreenSelector: View {
Image(nsImage: viewModel.screenThumbnails[index].image)
.resizable()
.aspectRatio(contentMode: .fit)
}.frame(width: count == 1 ? 640 : 288, height: count == 1 ? 360 : 162, alignment: .center)
}.frame(width: count == 1 ? 672 : 320, height: count == 1 ? 378 : 180, alignment: .center)
let screenName = NSScreen.screens.first(where: { $0.displayID == viewModel.screenThumbnails[index].screen.displayID })?.localizedName ?? "Display ".local + "\(viewModel.screenThumbnails[index].screen.displayID)"
Text(screenName)
.foregroundStyle(.secondary)
Expand Down Expand Up @@ -85,11 +85,11 @@ struct ScreenSelector: View {
}
}
.frame(maxWidth: .infinity, alignment: .leading)
.padding(.leading, count == 1 ? 51 : 61)
.padding(.leading, 35)
}
}
}
.frame(height: 420)
.frame(height: 445)

HStack(spacing: 4) {
Button(action: {
Expand Down Expand Up @@ -147,7 +147,7 @@ struct ScreenSelector: View {
Spacer()
}
.padding(.top, -5)
}.frame(width: 780, height:530)
}.frame(width: 780, height:555)
}

func startRecording() {
Expand Down
8 changes: 5 additions & 3 deletions QuickRecorder/ViewModel/StatusBar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ struct StatusBarItem: View {
.foregroundStyle(.white)
.frame(width: 16, alignment: .center)
}).buttonStyle(.plain)
if SCContext.streamType != .idevice && SCContext.streamType != .systemaudio {
if SCContext.streamType != .idevice {//&& SCContext.streamType != .systemaudio {
Button(action: {
SCContext.pauseRecording()
isPassed = SCContext.isPaused
Expand All @@ -54,7 +54,8 @@ struct StatusBarItem: View {
.offset(x: 0.5)
}
}
.frame(width: (SCContext.streamType == .idevice || SCContext.streamType == .systemaudio) ? 86 : 106)
//.frame(width: (SCContext.streamType == .idevice || SCContext.streamType == .systemaudio) ? 86 : 106)
.frame(width: SCContext.streamType == .idevice ? 86 : 106)
.padding([.leading,.trailing], 4)
.onReceive(updateTimer) { t in
recordingLength = SCContext.getRecordingLength()
Expand Down Expand Up @@ -150,7 +151,8 @@ extension AppDelegate: NSMenuDelegate {
switch SCContext.streamType {
case nil: width = 36
case .idevice: width = 138
case .systemaudio: width = 94
case .systemaudio: width = 114
//case .systemaudio: width = 94
default: width = 158
}
//let width = SCContext.streamType == nil ? 36 : ((SCContext.streamType == .idevice || SCContext.streamType == .systemaudio) ? 138 : 158)
Expand Down

0 comments on commit bc998ca

Please sign in to comment.