Skip to content

Commit

Permalink
Big Sur: Tab icons in sidebar - quick settings
Browse files Browse the repository at this point in the history
  • Loading branch information
lhc70000 committed Oct 4, 2020
1 parent 8a161fc commit 6459844
Show file tree
Hide file tree
Showing 8 changed files with 143 additions and 50 deletions.
15 changes: 15 additions & 0 deletions iina/Assets.xcassets/Icons/tab_audio.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"images" : [
{
"filename" : "tab_audio.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}
Binary file not shown.
15 changes: 15 additions & 0 deletions iina/Assets.xcassets/Icons/tab_sub.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"images" : [
{
"filename" : "tab_sub.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}
Binary file not shown.
15 changes: 15 additions & 0 deletions iina/Assets.xcassets/Icons/tab_video.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"images" : [
{
"filename" : "tab_video.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}
Binary file not shown.
132 changes: 84 additions & 48 deletions iina/Base.lproj/QuickSettingViewController.xib

Large diffs are not rendered by default.

16 changes: 14 additions & 2 deletions iina/QuickSettingViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,9 @@ class QuickSettingViewController: NSViewController, NSTableViewDataSource, NSTab
withAllTableViews { tableView, _ in tableView.backgroundColor = NSColor(named: .sidebarTableBackground)! }
}

if pendingSwitchRequest != nil {
if pendingSwitchRequest == nil {
updateTabActiveStatus(withCurrentButton: videoTabBtn)
} else {
switchToTab(pendingSwitchRequest!)
pendingSwitchRequest = nil
}
Expand Down Expand Up @@ -374,6 +376,16 @@ class QuickSettingViewController: NSViewController, NSTableViewDataSource, NSTab
updateControlsState()
}

private func updateTabActiveStatus(withCurrentButton sender: NSButton) {
[videoTabBtn, audioTabBtn, subTabBtn].forEach { btn in
if #available(OSX 10.14, *) {
btn!.contentTintColor = btn == sender ? .white : NSColor.white.withAlphaComponent(0.5)
} else {
Utility.setBoldTitle(for: btn!, btn == sender)
}
}
}

private func withAllTableViews(_ block: (NSTableView, MPVTrack.TrackType) -> Void) {
block(audioTableView, .audio)
block(subTableView, .sub)
Expand All @@ -394,7 +406,7 @@ class QuickSettingViewController: NSViewController, NSTableViewDataSource, NSTab

@IBAction func tabBtnAction(_ sender: NSButton) {
tabView.selectTabViewItem(at: sender.tag)
[videoTabBtn, audioTabBtn, subTabBtn].forEach { Utility.setBoldTitle(for: $0, $0 == sender) }
updateTabActiveStatus(withCurrentButton: sender)
currentTab = .init(buttonTag: sender.tag)
reload()
}
Expand Down

0 comments on commit 6459844

Please sign in to comment.