Skip to content
Permalink
Browse files

Fix regression introduced in 83a2f8c, #2360

Can't hide side bar when current tab is audio or subtitles
  • Loading branch information...
lhc70000 committed Mar 13, 2019
1 parent aa34c3f commit b0623738c2f057efd4728d054cc442c0040a310a
Showing with 13 additions and 7 deletions.
  1. +4 −4 iina/PlaylistViewController.swift
  2. +8 −2 iina/QuickSettingViewController.swift
  3. +1 −1 iina/Utility.swift
@@ -208,12 +208,12 @@ class PlaylistViewController: NSViewController, NSTableViewDataSource, NSTableVi
switch tab {
case .playlist:
tabView.selectTabViewItem(at: 0)
Utility.setActive(playlistBtn, true)
Utility.setActive(chaptersBtn, false)
Utility.setBoldTitle(for: playlistBtn, true)
Utility.setBoldTitle(for: chaptersBtn, false)
case .chapters:
tabView.selectTabViewItem(at: 1)
Utility.setActive(chaptersBtn, true)
Utility.setActive(playlistBtn, false)
Utility.setBoldTitle(for: chaptersBtn, true)
Utility.setBoldTitle(for: playlistBtn, false)
}

currentTab = tab
@@ -8,6 +8,12 @@
import Cocoa

fileprivate extension QuickSettingViewController.TabViewType {
init(buttonTag: Int) {
self = [.video, .audio, .sub][at: buttonTag] ?? .video
}
}

class QuickSettingViewController: NSViewController, NSTableViewDataSource, NSTableViewDelegate, SidebarViewController {

override var nibName: NSNib.Name {
@@ -375,8 +381,8 @@ class QuickSettingViewController: NSViewController, NSTableViewDataSource, NSTab
@IBAction func tabBtnAction(_ sender: NSButton) {
tabView.selectTabViewItem(at: sender.tag)
[videoTabBtn, audioTabBtn, subTabBtn].forEach { Utility.setActive($0, false) }
Utility.setActive(sender, true)
[videoTabBtn, audioTabBtn, subTabBtn].forEach { Utility.setBoldTitle(for: $0, $0 == sender) }
currentTab = .init(buttonTag: sender.tag)
reload()
}

@@ -384,7 +384,7 @@ class Utility {

// MARK: - Util functions
static func setActive(_ button: NSButton, _ active: Bool) {
static func setBoldTitle(for button: NSButton, _ active: Bool) {
button.attributedTitle = NSAttributedString(string: button.title,
attributes: FontAttributes(font: active ? .systemBold : .system, size: .system, align: .center).value)
}

0 comments on commit b062373

Please sign in to comment.
You can’t perform that action at this time.