Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add spacing between preference tabs #1223

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/Contributors.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ They helped [localize the app](https://poeditor.com/join/project/8AOEZ0eAZE):
* Julian Nowaczyk
* Kagurazaka Tsuki
* kal
* kant
* Kevinsevinche
* Klara
* Kushnee5
Expand Down
30 changes: 15 additions & 15 deletions resources/l10n/es.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
"Close window" = "Cerrar ventana";

/*No comment provided by engineer.*/
"Conflicting shortcut" = "Conflicting shortcut";
"Conflicting shortcut" = "Atajo conflictivo";

/*No comment provided by engineer.*/
"Controls" = "Controles";
Expand Down Expand Up @@ -126,16 +126,16 @@
"Focus selected window" = "Dar el foco a la ventana seleccionada";

/*No comment provided by engineer.*/
"Fullscreen windows:" = "Fullscreen windows:";
"Fullscreen windows:" = "Ventanas a pantalla completa:";

/*No comment provided by engineer.*/
"General" = "General";

/*No comment provided by engineer.*/
"Hidden windows:" = "Hidden windows:";
"Hidden windows:" = "Ventanas ocultas:";

/*No comment provided by engineer.*/
"Hide" = "Hide";
"Hide" = "Ocultar";

/*No comment provided by engineer.*/
"Hide app badges:" = "Ocultar emblemas de aplicación:";
Expand Down Expand Up @@ -174,10 +174,10 @@
"Left" = "Izquierda";

/*No comment provided by engineer.*/
"Max height on screen:" = "Max height on screen:";
"Max height on screen:" = "Altura máxima en pantalla:";

/*No comment provided by engineer.*/
"Max width on screen:" = "Max width on screen:";
"Max width on screen:" = "Ancho máximo en pantalla:";

/*No comment provided by engineer.*/
"Menubar icon:" = "Icono de barra de menú:";
Expand All @@ -189,7 +189,7 @@
"Minimize/Deminimize window" = "Minimizar/Desminimizar ventana";

/*No comment provided by engineer.*/
"Minimized windows:" = "Minimized windows:";
"Minimized windows:" = "Ventanas minimizadas:";

/*No comment provided by engineer.*/
"Mouse hover" = "Al pasar el ratón";
Expand Down Expand Up @@ -234,7 +234,7 @@
"Remember my choice" = "Recordar mi elección";

/*No comment provided by engineer.*/
"Rows of thumbnails:" = "Rows of thumbnails:";
"Rows of thumbnails:" = "Filas de miniaturas:";

/*No comment provided by engineer.*/
"Screen including menu bar" = "Pantalla que incluye la barra de menú";
Expand Down Expand Up @@ -282,13 +282,13 @@
"Shortcut 2" = "Atajo 2";

/*No comment provided by engineer.*/
"Shortcut already assigned to another action: %@" = "Shortcut already assigned to another action: %@";
"Shortcut already assigned to another action: %@" = "Atajo ya asignado a otra acción: %@";

/*No comment provided by engineer.*/
"Show" = "Mostrar";

/*No comment provided by engineer.*/
"Show at the end" = "Show at the end";
"Show at the end" = "Mostrar al final";

/*No comment provided by engineer.*/
"Show on:" = "Mostrar en:";
Expand All @@ -297,7 +297,7 @@
"Show standard tabs as windows:" = "Mostrar pestañas como ventanas:";

/*No comment provided by engineer.*/
"Show windows from:" = "Show windows from:";
"Show windows from:" = "Mostrar ventanas desde:";

/*No comment provided by engineer.*/
"Source code repository" = "Repositorio de código fuente";
Expand All @@ -321,7 +321,7 @@
"This permission is needed to show screenshots and titles of open windows" = "Este permiso es necesario para mostrar capturas de pantalla y títulos de ventanas abiertas";

/*No comment provided by engineer.*/
"Unassign existing shortcut and continue" = "Unassign existing shortcut and continue";
"Unassign existing shortcut and continue" = "Anular la asignación del atajo existente y continuar";

/*No comment provided by engineer.*/
"Updates policy:" = "Política de actualizaciones:";
Expand All @@ -333,7 +333,7 @@
"View existing discussions" = "Ver discusiones existentes";

/*No comment provided by engineer.*/
"Visible Spaces" = "Visible Spaces";
"Visible Spaces" = "Spaces visible";

/*No comment provided by engineer.*/
"While open, press:" = "Mientras esté abierto, pulsar:";
Expand All @@ -342,10 +342,10 @@
"Window app icon size:" = "Tamaño del icono de la ventana de aplicación:";

/*No comment provided by engineer.*/
"Window max width in row:" = "Window max width in row:";
"Window max width in row:" = "Ancho máximo de ventana en fila";

/*No comment provided by engineer.*/
"Window min width in row:" = "Window min width in row:";
"Window min width in row:" = "Ancho mínimo de ventana en fila";

/*No comment provided by engineer.*/
"Window title font size:" = "Tamaño de fuente del título de la ventana:";
Expand Down
38 changes: 25 additions & 13 deletions src/ui/preferences-window/PreferencesWindow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,21 @@ class PreferencesWindow: NSWindow, NSToolbarDelegate {
toolbar!.displayMode = .iconAndLabel
toolbar!.showsBaselineSeparator = true
[
(-1, "", NSToolbarItem.Identifier.flexibleSpace.rawValue, nil),
(0, NSLocalizedString("General", comment: ""), "general", GeneralTab.initTab()),
(-1, "", NSToolbarItem.Identifier.flexibleSpace.rawValue, nil),
(1, NSLocalizedString("Controls", comment: ""), "controls", ControlsTab.initTab()),
(-1, "", NSToolbarItem.Identifier.flexibleSpace.rawValue, nil),
(2, NSLocalizedString("Appearance", comment: ""), "appearance", AppearanceTab.initTab()),
(-1, "", NSToolbarItem.Identifier.flexibleSpace.rawValue, nil),
(3, NSLocalizedString("Policies", comment: ""), "policies", PoliciesTab.initTab()),
(-1, "", NSToolbarItem.Identifier.flexibleSpace.rawValue, nil),
(4, NSLocalizedString("Blacklists", comment: ""), "blacklists", BlacklistsTab.initTab()),
(-1, "", NSToolbarItem.Identifier.flexibleSpace.rawValue, nil),
(5, NSLocalizedString("About", comment: ""), "about", AboutTab.initTab()),
(-1, "", NSToolbarItem.Identifier.flexibleSpace.rawValue, nil),
(6, NSLocalizedString("Acknowledgments", comment: ""), "acknowledgments", AcknowledgmentsTab.initTab()),
(-1, "", NSToolbarItem.Identifier.flexibleSpace.rawValue, nil),
]
.forEach { makeToolbarItem($0.0, $0.1, $0.2, $0.3) }

Expand All @@ -56,19 +64,23 @@ class PreferencesWindow: NSWindow, NSToolbarDelegate {
tabItemClicked(toolbarItems[toolbar!.selectedItemIdentifier!]!.1)
}

func makeToolbarItem(_ index: Int, _ label: String, _ image: String, _ view: NSView) {
let id = NSToolbarItem.Identifier(rawValue: image)
let item = NSToolbarItem(itemIdentifier: id)
item.label = label
item.image = NSImage.initTemplateCopy(image)
item.target = self
item.action = #selector(tabItemClicked)
let wrapView = NSView(frame: .zero)
wrapView.translatesAutoresizingMaskIntoConstraints = false
wrapView.subviews = [view]
view.centerXAnchor.constraint(equalTo: wrapView.centerXAnchor).isActive = true
toolbarItems[id] = (index, item, wrapView)
toolbar!.insertItem(withItemIdentifier: id, at: index)
func makeToolbarItem(_ index: Int, _ label: String, _ image: String, _ view: NSView?) {
if view != nil {
let id = NSToolbarItem.Identifier(rawValue: image)
let item = NSToolbarItem(itemIdentifier: id)
item.label = label
item.target = self
item.action = #selector(tabItemClicked)
item.image = NSImage.initTemplateCopy(image)
let wrapView = NSView(frame: .zero)
wrapView.translatesAutoresizingMaskIntoConstraints = false
wrapView.subviews = [view!]
view!.centerXAnchor.constraint(equalTo: wrapView.centerXAnchor).isActive = true
toolbarItems[id] = (index, item, wrapView)
toolbar!.insertItem(withItemIdentifier: id, at: toolbar!.items.capacity)
} else {
toolbar!.insertItem(withItemIdentifier: .flexibleSpace, at: toolbar!.items.capacity)
}
}

@objc func tabItemClicked(_ item: NSToolbarItem) {
Expand Down