Skip to content

Commit

Permalink
v1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
alienator88 committed Jul 8, 2024
1 parent a58bc56 commit 6a7e20d
Show file tree
Hide file tree
Showing 3 changed files with 140 additions and 141 deletions.
10 changes: 4 additions & 6 deletions Viz.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
C73944B92BC4499700EE7EBF /* AboutCommand.swift in Sources */ = {isa = PBXBuildFile; fileRef = C73944B82BC4499700EE7EBF /* AboutCommand.swift */; };
C73944BD2BC449C800EE7EBF /* AboutView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C73944BB2BC449C800EE7EBF /* AboutView.swift */; };
C73944BE2BC449C800EE7EBF /* AboutWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = C73944BC2BC449C800EE7EBF /* AboutWindow.swift */; };
C766D28A2C34D0F100F51BB9 /* Builds in Resources */ = {isa = PBXBuildFile; fileRef = C766D2892C34D0F100F51BB9 /* Builds */; };
C76920112BC5EB5E00D23CEC /* MainView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C76920102BC5EB5E00D23CEC /* MainView.swift */; };
C783473E2C0E1B1400F4EE76 /* Styles.swift in Sources */ = {isa = PBXBuildFile; fileRef = C783473D2C0E1B1400F4EE76 /* Styles.swift */; };
C7E780DE2BC700060053B311 /* KeyboardShortcuts in Frameworks */ = {isa = PBXBuildFile; productRef = C7E780DD2BC700060053B311 /* KeyboardShortcuts */; };
Expand Down Expand Up @@ -181,7 +180,6 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
C766D28A2C34D0F100F51BB9 /* Builds in Resources */,
C7174CAF2BC0C14900DBEF75 /* printscreen.mp3 in Resources */,
C7174C982BC06EE600DBEF75 /* Assets.xcassets in Resources */,
);
Expand Down Expand Up @@ -342,7 +340,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Developer ID Application";
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 6;
CURRENT_PROJECT_VERSION = 7;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = "";
Expand All @@ -360,7 +358,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 13.0;
MARKETING_VERSION = 1.5;
MARKETING_VERSION = 1.6;
PRODUCT_BUNDLE_IDENTIFIER = com.alienator88.Viz;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -379,7 +377,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Developer ID Application";
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 6;
CURRENT_PROJECT_VERSION = 7;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = "";
Expand All @@ -397,7 +395,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 13.0;
MARKETING_VERSION = 1.5;
MARKETING_VERSION = 1.6;
PRODUCT_BUNDLE_IDENTIFIER = com.alienator88.Viz;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
269 changes: 135 additions & 134 deletions Viz/MainView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,177 +19,178 @@ struct ContentView: View {
@Environment(\.dismiss) private var dismiss

var body: some View {
VisualEffectView(material: .hudWindow, blendingMode: .behindWindow)
.overlay{
VStack(alignment: .center, spacing: 15) {
// VisualEffectView(material: .hudWindow, blendingMode: .behindWindow)
// .overlay{
//
//
// }
VStack(alignment: .center, spacing: 15) {

Spacer()
Spacer()

HStack(spacing: 0) {
HStack(spacing: 0) {

Spacer()
Spacer()

Text("V I Z")
.font(.system(size: 18, design: .rounded))
.bold()
.foregroundStyle(
LinearGradient(
colors: [.red, .purple, .blue],
startPoint: .leading,
endPoint: .trailing
)
)
.shadow(color: .black, radius: 2, x: 0, y: 0)
Text("V I Z")
.font(.system(size: 18, design: .rounded))
.bold()
.foregroundStyle(
LinearGradient(
colors: [.red, .purple, .blue],
startPoint: .leading,
endPoint: .trailing
)
)
.shadow(color: .black, radius: 2, x: 0, y: 0)

Spacer()
}
Spacer()
}



HStack(spacing: 15) {
VStack {
Button("Text") {
CaptureService.shared.captureText()
dismiss()
}
.help("Capture section of screen to extract text from")
.keyboardShortcut("1", modifiers: [.command, .shift])
.buttonStyle(RoundedRectangleButtonStyle(image: "text.viewfinder", size: 30))
HStack(spacing: 15) {
VStack {
Button("Text") {
CaptureService.shared.captureText()
dismiss()
}
.help("Capture section of screen to extract text from")
.keyboardShortcut("1", modifiers: [.command, .shift])
.buttonStyle(RoundedRectangleButtonStyle(image: "text.viewfinder", size: 30))

KeyboardShortcuts.Recorder(for: .captureText)
}
KeyboardShortcuts.Recorder(for: .captureText)
}


VStack(alignment: .center) {
Button("QR/Barcode") {
CaptureService.shared.captureBarcodes()
dismiss()
}
.help("Capture QR Code or Barcode to extract text from")
.keyboardShortcut("2", modifiers: [.command, .shift])
.buttonStyle(RoundedRectangleButtonStyle(image: "qrcode.viewfinder", size: 30))
VStack(alignment: .center) {
Button("QR/Barcode") {
CaptureService.shared.captureBarcodes()
dismiss()
}
.help("Capture QR Code or Barcode to extract text from")
.keyboardShortcut("2", modifiers: [.command, .shift])
.buttonStyle(RoundedRectangleButtonStyle(image: "qrcode.viewfinder", size: 30))

KeyboardShortcuts.Recorder(for: .captureBarcode)
}
KeyboardShortcuts.Recorder(for: .captureBarcode)
}

}
}


Button("Clear Clipboard") {
clearClipboard()
dismiss()
Button("Clear Clipboard") {
clearClipboard()
dismiss()
}
.help("Clear clipboard contents and stored captures")
.buttonStyle(RoundedRectangleButtonStyle(image: "delete.left", size: 30))

if processing {
GroupBox(label: {
HStack(alignment: .center, spacing: 5) {
Text("Post-Processing")
InfoButton(text: "Execute any shell commands after capture is completed. You may also use the [ocr] token in the commands. Example:\nsay [ocr]; echo [ocr] >> saved.txt")
Spacer()
}
.help("Clear clipboard contents and stored captures")
.buttonStyle(RoundedRectangleButtonStyle(image: "delete.left", size: 30))

if processing {
GroupBox(label: {
HStack(alignment: .center, spacing: 5) {
Text("Post-Processing")
InfoButton(text: "Execute any shell commands after capture is completed. You may also use the [ocr] token in the commands. Example:\nsay [ocr]; echo [ocr] >> saved.txt")
Spacer()
}
}().font(.title2)) {
HStack(alignment: .center, spacing: 10) {
TextEditor(text: $postCommands)
.frame(height: 50)
.focusable(false)
.font(.title3)
.overlay {
if postCommands.isEmpty {
VStack {
HStack {
Text("Example: say [ocr]; echo [ocr] >> file.txt").opacity(0.5)
Spacer()
}
.padding(.leading, 8)
.padding(.top, 2)
Spacer()
}
.frame(height: 50)
}().font(.title2)) {
HStack(alignment: .center, spacing: 10) {
TextEditor(text: $postCommands)
.frame(height: 50)
.focusable(false)
.font(.title3)
.overlay {
if postCommands.isEmpty {
VStack {
HStack {
Text("Example: say [ocr]; echo [ocr] >> file.txt").opacity(0.5)
Spacer()
}
.padding(.leading, 8)
.padding(.top, 2)
Spacer()
}


.frame(height: 50)
}
}
.padding(6)
.padding(.vertical, 4)
.frame(maxWidth: .infinity, alignment: .leading)

}
.frame(maxWidth: .infinity, maxHeight: .infinity)

}
.padding(6)
.padding(.vertical, 4)
.frame(maxWidth: .infinity, alignment: .leading)

}
.frame(maxWidth: .infinity, maxHeight: .infinity)
}


GroupBox(label: Text("Settings").font(.title2)) {
VStack(alignment: .leading, spacing: 10) {
Toggle("Append consecutive captures", isOn: $appendRecognizedText)
.toggleStyle(SpacedToggle())
.help("When enabled, consecutive captures will be appended to the clipboard")
Toggle("Keep line breaks in captures", isOn: $keepLineBreaks)
.toggleStyle(SpacedToggle())
.help("When enabled, new lines will be added in scanned text")
Toggle("Auto-hide capture window (3s)", isOn: $closePreview)
.toggleStyle(SpacedToggle())
.help("When enabled, captured content preview will close after 3 seconds")
Toggle("Post-processing", isOn: $processing)
.toggleStyle(SpacedToggle())
.help("When enabled, you can execute shell functions after capture")
Toggle("Launch at login", isOn: Binding(
get: { appState.isLaunchAtLoginEnabled },
set: { newValue in
updateOnMain {
appState.isLaunchAtLoginEnabled = newValue
updateLaunchAtLoginStatus(newValue: newValue)
}

}
))
.toggleStyle(SpacedToggle())
GroupBox(label: Text("Settings").font(.title2)) {
VStack(alignment: .leading, spacing: 10) {
Toggle("Append consecutive captures", isOn: $appendRecognizedText)
.toggleStyle(SpacedToggle())
.help("When enabled, consecutive captures will be appended to the clipboard")
Toggle("Keep line breaks in captures", isOn: $keepLineBreaks)
.toggleStyle(SpacedToggle())
.help("When enabled, new lines will be added in scanned text")
Toggle("Auto-hide capture window (3s)", isOn: $closePreview)
.toggleStyle(SpacedToggle())
.help("When enabled, captured content preview will close after 3 seconds")
Toggle("Post-processing", isOn: $processing)
.toggleStyle(SpacedToggle())
.help("When enabled, you can execute shell functions after capture")
Toggle("Launch at login", isOn: Binding(
get: { appState.isLaunchAtLoginEnabled },
set: { newValue in
updateOnMain {
appState.isLaunchAtLoginEnabled = newValue
updateLaunchAtLoginStatus(newValue: newValue)
}

}
.padding(6)
.padding(.vertical, 4)
.frame(maxWidth: .infinity, alignment: .leading)

}
.frame(maxWidth: .infinity, maxHeight: .infinity)
))
.toggleStyle(SpacedToggle())

}
.padding(6)
.padding(.vertical, 4)
.frame(maxWidth: .infinity, alignment: .leading)

HStack() {

Button {
AboutWindow.show()
dismiss()
} label: {
Text("About")
}
.buttonStyle(RoundedRectangleButtonStyle(image: "info.circle", size: 15))
}
.frame(maxWidth: .infinity, maxHeight: .infinity)

Button {
loadGithubReleases(appState: appState, manual: true)
dismiss()
} label: {
Text("Update")
}
.buttonStyle(RoundedRectangleButtonStyle(image: "arrow.down.circle", size: 15))

HStack() {

Button("Quit") {
NSApp.terminate(nil)
}
.buttonStyle(RoundedRectangleButtonStyle(image: "x.circle", size: 15))
Button {
AboutWindow.show()
dismiss()
} label: {
Text("About")
}
.buttonStyle(RoundedRectangleButtonStyle(image: "info.circle", size: 15))

}
Button {
loadGithubReleases(appState: appState, manual: true)
dismiss()
} label: {
Text("Update")
}
.buttonStyle(RoundedRectangleButtonStyle(image: "arrow.down.circle", size: 15))

Spacer()

Button("Quit") {
NSApp.terminate(nil)
}
.padding()
.background(Color("bg"))
.buttonStyle(RoundedRectangleButtonStyle(image: "x.circle", size: 15))

}
.frame(width: 330, height: processing ? 710 : 590)

Spacer()

}
.padding()
.background(Color("bg"))
.frame(width: 330, height: processing ? 710 : 590)
}
}
2 changes: 1 addition & 1 deletion Viz/VizApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ struct VizApp: App {
var body: some Scene {
MenuBarExtra("Viz", systemImage: "eye", content: {
ContentView()
// .environment(\.colorScheme, .dark)
.environment(\.colorScheme, .dark)
.preferredColorScheme(.dark)
.onAppear {
#if !DEBUG
Expand Down

0 comments on commit 6a7e20d

Please sign in to comment.