Publish VCC Plus OSS source distribution for 3.6.2 build 60
This commit is contained in:
commit
c652a5276d
1192 files changed
+272368
No files matched your search
@@ -0,0 +1,46 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
import SwiftUI
|
||||
import UniformTypeIdentifiers
|
||||
|
||||
struct MediaDropTarget: ViewModifier {
|
||||
let machine: MachineModel
|
||||
var destination: MediaDestination?
|
||||
@State private var targeted = false
|
||||
func body(content: Content) -> some View {
|
||||
content.overlay { if targeted { RoundedRectangle(cornerRadius: 10).strokeBorder(Color.accentColor, lineWidth: 3).allowsHitTesting(false) } }
|
||||
.onDrop(of: [UTType.fileURL], isTargeted: $targeted) { providers in
|
||||
guard providers.count == 1, let provider = providers.first else {
|
||||
machine.reportMediaError("Drop one media file at a time so its destination is explicit."); return false
|
||||
}
|
||||
guard !machine.busy, !machine.diskSaving else { return false }
|
||||
provider.loadItem(forTypeIdentifier: UTType.fileURL.identifier, options: nil) { item, _ in
|
||||
let url: URL?
|
||||
if let value = item as? URL { url = value }
|
||||
else if let data = item as? Data { url = URL(dataRepresentation: data, relativeTo: nil) }
|
||||
else { url = nil }
|
||||
Task { @MainActor in
|
||||
guard let url, url.isFileURL else { machine.reportMediaError("Drop a local media file from Finder."); return }
|
||||
machine.offerMedia(url, preferred: destination)
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct RecentMediaCommands: View {
|
||||
let machine: MachineModel
|
||||
@ObservedObject var recent: RecentMedia
|
||||
@ObservedObject var menu: MachineMenuState
|
||||
var body: some View {
|
||||
Menu("Open Recent Media") {
|
||||
if recent.entries.isEmpty { Text("No Recent Media") }
|
||||
ForEach(recent.entries) { entry in
|
||||
Button(entry.label) { machine.offerMedia(entry.url, preferred: entry.destination, fromHistory: true) }
|
||||
.help(entry.url.path).disabled(menu.values.busy || menu.values.diskSaving)
|
||||
}
|
||||
Divider()
|
||||
Button("Clear Recent Media") { recent.clear() }.disabled(recent.entries.isEmpty)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user