Skip to content

Commit f442622

Browse files
committed
feat: Add quick switcher functionality
Adds a new "Quick Switcher" feature accessible via a keyboard shortcut (⌘P) and a toolbar button. This allows users to quickly switch between connections and tabs within the application.
1 parent 5fa7be8 commit f442622

4 files changed

Lines changed: 21 additions & 2 deletions

File tree

TablePro.xcodeproj/xcshareddata/xcschemes/TablePro.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
33
LastUpgradeVersion = "2640"
4-
version = "1.8">
4+
version = "1.7">
55
<BuildAction
66
parallelizeBuildables = "YES"
77
buildImplicitDependencies = "YES"

TablePro/Models/UI/KeyboardShortcutModels.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ enum ShortcutAction: String, Codable, CaseIterable, Identifiable {
4747
case explainQuery
4848
case export
4949
case importData
50+
case quickSwitcher
5051

5152
// Edit
5253
case undo
@@ -84,7 +85,7 @@ enum ShortcutAction: String, Codable, CaseIterable, Identifiable {
8485
switch self {
8586
case .newConnection, .newTab, .openDatabase, .switchConnection,
8687
.saveChanges, .previewSQL, .closeTab, .refresh,
87-
.explainQuery, .export, .importData:
88+
.explainQuery, .export, .importData, .quickSwitcher:
8889
return .file
8990
case .undo, .redo, .cut, .copy, .copyWithHeaders, .paste,
9091
.delete, .selectAll, .clearSelection, .addRow,
@@ -113,6 +114,7 @@ enum ShortcutAction: String, Codable, CaseIterable, Identifiable {
113114
case .explainQuery: return String(localized: "Explain Query")
114115
case .export: return String(localized: "Export")
115116
case .importData: return String(localized: "Import")
117+
case .quickSwitcher: return String(localized: "Quick Switcher")
116118
case .undo: return String(localized: "Undo")
117119
case .redo: return String(localized: "Redo")
118120
case .cut: return String(localized: "Cut")
@@ -408,6 +410,7 @@ struct KeyboardSettings: Codable, Equatable {
408410
.explainQuery: KeyCombo(key: "e", command: true, option: true),
409411
.export: KeyCombo(key: "e", command: true, shift: true),
410412
.importData: KeyCombo(key: "i", command: true, shift: true),
413+
.quickSwitcher: KeyCombo(key: "p", command: true),
411414

412415
// Edit
413416
.undo: KeyCombo(key: "z", command: true),

TablePro/TableProApp.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,12 @@ struct AppMenuCommands: Commands {
179179
.optionalKeyboardShortcut(shortcut(for: .switchConnection))
180180
.disabled(!appState.isConnected || appState.isRedis)
181181

182+
Button("Quick Switcher...") {
183+
actions?.openQuickSwitcher()
184+
}
185+
.optionalKeyboardShortcut(shortcut(for: .quickSwitcher))
186+
.disabled(!appState.isConnected)
187+
182188
Divider()
183189

184190
Button("Save Changes") {

TablePro/Views/Toolbar/TableProToolbarView.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,16 @@ struct TableProToolbar: ViewModifier {
106106

107107
// MARK: - Primary Action (Right)
108108

109+
ToolbarItem(placement: .primaryAction) {
110+
Button {
111+
actions?.openQuickSwitcher()
112+
} label: {
113+
Label("Quick Switcher", systemImage: "magnifyingglass")
114+
}
115+
.help("Quick Switcher (⌘P)")
116+
.disabled(state.connectionState != .connected)
117+
}
118+
109119
ToolbarItem(placement: .primaryAction) {
110120
Button {
111121
actions?.newTab()

0 commit comments

Comments
 (0)