ui: move translation credentials into settings

This commit is contained in:
2026-10-17 22:17:21 +02:00
parent b847a483f0
commit 9eb16ddd5a
7 changed files with 186 additions and 86 deletions
@@ -8,6 +8,7 @@ final class LauncherWindowController: NSWindowController, NSWindowDelegate, NSSe
private let searchField = NSSearchField()
private let searchSymbol = IconView(font: .systemFont(ofSize: 20))
private let commandBack = NSButton(title: "", target: nil, action: nil)
private let translationHeader = NSStackView()
private let tableView = ApplicationTableView()
private let statusLabel = NSTextField(labelWithString: "Finding applications…")
private let emptyLabel = NSTextField(labelWithString: "Finding applications…")
@@ -276,7 +277,8 @@ final class LauncherWindowController: NSWindowController, NSWindowDelegate, NSSe
commandBack.widthAnchor.constraint(equalToConstant: IconStyle.applicationSize(for: searchFont)),
commandBack.heightAnchor.constraint(equalToConstant: IconStyle.applicationSize(for: searchFont)),
])
let header = NSStackView(views: [searchSymbol, commandBack, searchField])
translationHeader.isHidden = true
let header = NSStackView(views: [searchSymbol, commandBack, searchField, translationHeader])
header.orientation = .horizontal
header.alignment = .centerY
header.spacing = 12
@@ -861,6 +863,8 @@ final class LauncherWindowController: NSWindowController, NSWindowDelegate, NSSe
let close: () -> Void = { [weak self, weak controller] in
guard let self, let controller else { return }
controller.view.removeFromSuperview()
self.translation?.providerPicker.removeFromSuperview()
self.translationHeader.isHidden = true
self.translation = nil
self.emojiPicker = nil
self.notes = nil
@@ -907,6 +911,10 @@ final class LauncherWindowController: NSWindowController, NSWindowDelegate, NSSe
}
controller.view.translatesAutoresizingMaskIntoConstraints = false
content.addSubview(controller.view)
if let translation {
translationHeader.addArrangedSubview(translation.providerPicker)
translationHeader.isHidden = false
}
NSLayoutConstraint.activate([
controller.view.leadingAnchor.constraint(equalTo: content.leadingAnchor),
controller.view.trailingAnchor.constraint(equalTo: content.trailingAnchor),