Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
* dev: (25 commits)
  add Japanese lanuage to project
  New translations InfoPlist.strings (Chinese Simplified)
  New translations Perference.strings (Japanese)
  New translations InfoPlist.strings (Japanese)
  New translations Perference.strings (Japanese)
  New translations Main.strings (Japanese)
  New translations Localizable.strings (Japanese)
  New translations Localizable.strings (Japanese)
  New translations Perference.strings (Japanese)
  New translations Main.strings (Japanese)
  New translations InfoPlist.strings (Japanese)
  New translations Localizable.strings (Japanese)
  New translations Perference.strings (German)
  New translations Main.strings (German)
  New translations InfoPlist.strings (German)
  New translations Localizable.strings (German)
  fix: importing lyrics should remove wrong lyrics mark
  fix: selected search result doesn't persist, fix #203
  hide karaoke lyrics completely as mouse hovering
  save karaoke window frame with name
  ...
  • Loading branch information
ddddxxx committed Nov 13, 2018
2 parents 17ae623 + 634b67d commit 49f2164
Show file tree
Hide file tree
Showing 37 changed files with 631 additions and 116 deletions.
9 changes: 9 additions & 0 deletions LyricsX.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,10 @@
E97AFB54215CAF4400AF74CD /* TouchBarHelper.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = TouchBarHelper.framework; path = Carthage/Build/Mac/TouchBarHelper.framework; sourceTree = "<group>"; };
E97AFB5A215CBF0300AF74CD /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
E97AFB5C215CBF0500AF74CD /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/InfoPlist.strings"; sourceTree = "<group>"; };
E9AAA388219564F50006EBC2 /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ja; path = ja.lproj/InfoPlist.strings; sourceTree = "<group>"; };
E9AAA389219565010006EBC2 /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ja; path = ja.lproj/Localizable.strings; sourceTree = "<group>"; };
E9AAA38A219565080006EBC2 /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ja; path = ja.lproj/Perference.strings; sourceTree = "<group>"; };
E9AAA38B2195650D0006EBC2 /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ja; path = ja.lproj/Main.strings; sourceTree = "<group>"; };
E9E5512F207C4B7600F9958A /* DFRFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = DFRFoundation.framework; path = ../../../../System/Library/PrivateFrameworks/DFRFoundation.framework; sourceTree = "<group>"; };
E9E55137207C4CB000F9958A /* TouchBarLyrics.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TouchBarLyrics.swift; sourceTree = "<group>"; };
E9EBDA2421115A150019FDF9 /* Observation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Observation.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -472,6 +476,7 @@
en,
Base,
"zh-Hans",
ja,
);
mainGroup = BB4141A11E458BA800A51775;
productRefGroup = BB4141AB1E458BA800A51775 /* Products */;
Expand Down Expand Up @@ -627,6 +632,7 @@
children = (
BB0BE9591F444CA00068FF67 /* zh-Hans */,
BB0BE95A1F444CAA0068FF67 /* en */,
E9AAA389219565010006EBC2 /* ja */,
);
name = Localizable.strings;
sourceTree = "<group>";
Expand All @@ -637,6 +643,7 @@
BB4141B41E458BA900A51775 /* Base */,
BB3D1E911E8A2A2A00CA5B8F /* zh-Hans */,
BB335B112057BCE3003A69F8 /* en */,
E9AAA38B2195650D0006EBC2 /* ja */,
);
name = Main.storyboard;
sourceTree = "<group>";
Expand All @@ -655,6 +662,7 @@
BB6139751FCCFA6700CBD808 /* Base */,
BB6139781FCCFAC800CBD808 /* zh-Hans */,
BB335B132057BD03003A69F8 /* en */,
E9AAA38A219565080006EBC2 /* ja */,
);
name = Perference.storyboard;
sourceTree = "<group>";
Expand All @@ -664,6 +672,7 @@
children = (
E97AFB5A215CBF0300AF74CD /* en */,
E97AFB5C215CBF0500AF74CD /* zh-Hans */,
E9AAA388219564F50006EBC2 /* ja */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"images" : [
{
"idiom" : "mac",
"filename" : "now_playing_icon.png",
"scale" : "1x"
},
{
"idiom" : "mac",
"filename" : "now_playing_icon@2x.png",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 0 additions & 6 deletions LyricsX/Assets.xcassets/gap/Contents.json

This file was deleted.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.
12 changes: 0 additions & 12 deletions LyricsX/Assets.xcassets/gap/rect_center.imageset/Contents.json

This file was deleted.

Binary file not shown.
3 changes: 3 additions & 0 deletions LyricsX/Component/AppController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -268,5 +268,8 @@ extension AppController {
lrc.metadata.artist = track.artist
lrc.metadata.needsPersist = true
currentLyrics = lrc
if let index = defaults[.NoSearchingTrackIds].firstIndex(of: track.id) {
defaults[.NoSearchingTrackIds].remove(at: index)
}
}
}
54 changes: 30 additions & 24 deletions LyricsX/Controller/KaraokeLyricsController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,31 +27,27 @@ import SnapKit

class KaraokeLyricsWindowController: NSWindowController {

private var lyricsView = KaraokeLyricsView(frame: .zero)
static private let windowFrame = NSWindow.FrameAutosaveName("KaraokeWindow")

private var screen: NSScreen {
didSet {
defaults[.DesktopLyricsScreenRect] = screen.frame
updateWindowFrame(animate: false)
}
}
private var lyricsView = KaraokeLyricsView(frame: .zero)

init() {
let rect = defaults[.DesktopLyricsScreenRect]
screen = NSScreen.screens.first { $0.frame.contains(rect) } ?? NSScreen.screens[0]
let window = NSWindow(contentRect: screen.visibleFrame, styleMask: .borderless, backing: .buffered, defer: true)
let window = NSWindow(contentRect: .zero, styleMask: .borderless, backing: .buffered, defer: true)
window.backgroundColor = .clear
window.hasShadow = false
window.isOpaque = false
window.level = .floating
window.collectionBehavior = [.canJoinAllSpaces, .stationary]
window.setFrameUsingName(KaraokeLyricsWindowController.windowFrame, force: true)
super.init(window: window)

window.contentView?.addSubview(lyricsView)

addObserver()
makeConstraints()

updateWindowFrame(animate: false)

lyricsView.displayLrc("LyricsX")
DispatchQueue.main.asyncAfter(deadline: .now() + 3) {
self.lyricsView.displayLrc("")
Expand Down Expand Up @@ -81,10 +77,7 @@ class KaraokeLyricsWindowController: NSWindowController {
window?.contentView?.bind(.hidden, withDefaultName: .DesktopLyricsEnabled, options: negateOption)

observeDefaults(key: .DisableLyricsWhenSreenShot, options: [.new, .initial]) { [unowned self] _, change in
switch change.newValue {
case true: self.window?.sharingType = .none
case false: self.window?.sharingType = .readOnly
}
self.window?.sharingType = change.newValue ? .none : .readOnly
}
observeDefaults(keys: [
.HideLyricsWhenMousePassingBy,
Expand All @@ -100,14 +93,19 @@ class KaraokeLyricsWindowController: NSWindowController {
self.lyricsView.font = defaults.desktopLyricsFont
}

observeNotification(name: NSApplication.didChangeScreenParametersNotification, queue: .main) { [unowned self] _ in
self.updateWindowFrame(animate: true)
}
observeNotification(center: workspaceNC, name: NSWorkspace.activeSpaceDidChangeNotification, queue: .main) { [unowned self] _ in
self.updateWindowFrame(animate: true)
}
}

private func updateWindowFrame(animate: Bool) {
let frame = isFullScreen() == true ? screen.frame : screen.visibleFrame
private func updateWindowFrame(toScreen: NSScreen? = nil, animate: Bool) {
let screen = toScreen ?? window?.screen ?? NSScreen.screens[0]
let frame = screen.isFullScreen ? screen.frame : screen.visibleFrame
window?.setFrame(frame, display: false, animate: animate)
window?.saveFrame(usingName: KaraokeLyricsWindowController.windowFrame)
}

@objc private func handleLyricsDisplay() {
Expand Down Expand Up @@ -178,7 +176,7 @@ class KaraokeLyricsWindowController: NSWindowController {
let centerInScreen = window.convertToScreen(CGRect(origin: center, size: .zero)).origin
if let screen = NSScreen.screens.first(where: { $0.frame.contains(centerInScreen) }),
screen != window.screen {
self.screen = screen
updateWindowFrame(toScreen: screen, animate: false)
center = window.convertFromScreen(CGRect(origin: centerInScreen, size: .zero)).origin
return
}
Expand All @@ -199,13 +197,21 @@ class KaraokeLyricsWindowController: NSWindowController {

}

private func isFullScreen() -> Bool? {
guard let windowInfoList = CGWindowListCopyWindowInfo(.optionOnScreenOnly, kCGNullWindowID) as? [[String: Any]] else {
return nil
}
return !windowInfoList.contains { info in
info[kCGWindowOwnerName as String] as? String == "Window Server" &&
info[kCGWindowName as String] as? String == "Menubar"
private extension NSScreen {

var isFullScreen: Bool {
guard let windowInfoList = CGWindowListCopyWindowInfo(.optionOnScreenOnly, kCGNullWindowID) as? [[String: Any]] else {
return false
}
return !windowInfoList.contains { info in
guard info[kCGWindowOwnerName as String] as? String == "Window Server",
info[kCGWindowName as String] as? String == "Menubar",
let boundsDict = info[kCGWindowBounds as String] as? NSDictionary as CFDictionary?,
let bounds = CGRect(dictionaryRepresentation: boundsDict) else {
return false
}
return frame.contains(bounds)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ class FilterKey: NSObject, NSCoding {

@objc var keyword = "keyword"

override init() {
super.init()
}

init(keyword: String) {
self.keyword = keyword
super.init()
Expand Down
3 changes: 2 additions & 1 deletion LyricsX/Controller/SearchLyricsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class SearchLyricsViewController: NSViewController, NSTableViewDelegate, NSTable
}

if let id = AppController.shared.playerManager.player?.currentTrack?.id,
let index = defaults[.NoSearchingTrackIds].index(where: { $0 == id }) {
let index = defaults[.NoSearchingTrackIds].firstIndex(of: id) {
defaults[.NoSearchingTrackIds].remove(at: index)
}

Expand All @@ -136,6 +136,7 @@ class SearchLyricsViewController: NSViewController, NSTableViewDelegate, NSTable
guard lyrics.metadata.request == searchTask?.request else {
return
}
lyrics.metadata.needsPersist = true
if let idx = searchResult.index(where: { lyrics.quality > $0.quality }) {
searchResult.insert(lyrics, at: idx)
} else {
Expand Down
Binary file modified LyricsX/Frameworks/Crashlytics.framework/Versions/A/Crashlytics
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>15G31</string>
<string>17G65</string>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
Expand All @@ -17,36 +17,36 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>3.10.1</string>
<string>3.10.9</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
</array>
<key>CFBundleVersion</key>
<string>129</string>
<string>131</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>8C1002</string>
<string>9F2000</string>
<key>DTPlatformVersion</key>
<string>GM</string>
<key>DTSDKBuild</key>
<string>16C58</string>
<string>17E189</string>
<key>DTSDKName</key>
<string>macosx10.12</string>
<string>macosx10.13</string>
<key>DTXcode</key>
<string>0821</string>
<string>0941</string>
<key>DTXcodeBuild</key>
<string>8C1002</string>
<string>9F2000</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2016 Crashlytics, Inc. All rights reserved.</string>
<key>UIDeviceFamily</key>
<array>
<integer>3</integer>
<integer>2</integer>
<integer>1</integer>
<integer>2</integer>
<integer>3</integer>
<integer>4</integer>
</array>
</dict>
Expand Down
Binary file modified LyricsX/Frameworks/Crashlytics.framework/submit
Binary file not shown.
Binary file modified LyricsX/Frameworks/Crashlytics.framework/uploadDSYM
Binary file not shown.
Binary file modified LyricsX/Frameworks/Fabric.framework/Versions/A/Fabric
Binary file not shown.
Loading

0 comments on commit 49f2164

Please sign in to comment.