Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
ddddxxx committed May 31, 2021
2 parents 5ffab14 + a7a03e8 commit b719b82
Show file tree
Hide file tree
Showing 31 changed files with 64 additions and 72 deletions.
28 changes: 11 additions & 17 deletions LyricsX.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,6 @@
BB60F3091E889A1B00BA1FD2 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = BB60F3071E889A1B00BA1FD2 /* MainMenu.xib */; };
BB60F3121E889FCD00BA1FD2 /* LyricsXHelper.app in Copy Helper */ = {isa = PBXBuildFile; fileRef = BB60F3011E889A1B00BA1FD2 /* LyricsXHelper.app */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
BB6139741FCCFA6700CBD808 /* Preferences.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BB6139761FCCFA6700CBD808 /* Preferences.storyboard */; };
BB63C24C226AFCE7008CFFBB /* Dictionary in Resources */ = {isa = PBXBuildFile; fileRef = BB63C24B226AFCE7008CFFBB /* Dictionary */; };
BB63C24D226AFCE7008CFFBB /* Dictionary in Resources */ = {isa = PBXBuildFile; fileRef = BB63C24B226AFCE7008CFFBB /* Dictionary */; };
BB63C24F22774B47008CFFBB /* TouchBarPlaybackControlViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB63C24E22774B47008CFFBB /* TouchBarPlaybackControlViewController.swift */; };
BB6C75E8248B908500804AEB /* TouchBarHelper in Frameworks */ = {isa = PBXBuildFile; productRef = BB6C75E7248B908500804AEB /* TouchBarHelper */; };
BB6C75EA248B908F00804AEB /* TouchBarHelper in Frameworks */ = {isa = PBXBuildFile; productRef = BB6C75E9248B908F00804AEB /* TouchBarHelper */; };
Expand Down Expand Up @@ -259,7 +257,6 @@
BB60F30E1E889C5400BA1FD2 /* LyricsXHelper.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = LyricsXHelper.entitlements; sourceTree = "<group>"; };
BB6139751FCCFA6700CBD808 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Preferences.storyboard; sourceTree = "<group>"; };
BB6139781FCCFAC800CBD808 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Preferences.strings"; sourceTree = "<group>"; };
BB63C24B226AFCE7008CFFBB /* Dictionary */ = {isa = PBXFileReference; lastKnownFileType = folder; path = Dictionary; sourceTree = "<group>"; };
BB63C24E22774B47008CFFBB /* TouchBarPlaybackControlViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TouchBarPlaybackControlViewController.swift; sourceTree = "<group>"; };
BB71941C247FCDB3003F1D1B /* ko */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ko; path = ko.lproj/Main.strings; sourceTree = "<group>"; };
BB71941D247FCDB3003F1D1B /* ko */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ko; path = ko.lproj/Preferences.strings; sourceTree = "<group>"; };
Expand Down Expand Up @@ -429,7 +426,6 @@
isa = PBXGroup;
children = (
BB4141B11E458BA800A51775 /* Assets.xcassets */,
BB63C24B226AFCE7008CFFBB /* Dictionary */,
BB0BE9581F444C9E0068FF67 /* Localizable.strings */,
E97AFB5B215CBF0300AF74CD /* InfoPlist.strings */,
BB9BCEB81E84120D001BC54B /* LyricsX.entitlements */,
Expand Down Expand Up @@ -734,7 +730,6 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
BB63C24C226AFCE7008CFFBB /* Dictionary in Resources */,
BB0BE9561F444C9E0068FF67 /* Localizable.strings in Resources */,
E97AFB59215CBF0300AF74CD /* InfoPlist.strings in Resources */,
BB6139741FCCFA6700CBD808 /* Preferences.storyboard in Resources */,
Expand All @@ -749,7 +744,6 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
BB63C24D226AFCE7008CFFBB /* Dictionary in Resources */,
BB50789522014C3900B695C3 /* Localizable.strings in Resources */,
BB50789622014C3900B695C3 /* InfoPlist.strings in Resources */,
BB50789722014C3900B695C3 /* Preferences.storyboard in Resources */,
Expand Down Expand Up @@ -1462,10 +1456,10 @@
};
BB22681A234C9085008FAFED /* XCRemoteSwiftPackageReference "SwiftCF" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/ddddxxx/SwiftCF.git";
repositoryURL = "https://github.com/ddddxxx/SwiftCF";
requirement = {
kind = upToNextMinorVersion;
minimumVersion = 0.1.4;
minimumVersion = 0.2.1;
};
};
BB350ABC23D0613D00500146 /* XCRemoteSwiftPackageReference "CXExtensions" */ = {
Expand All @@ -1488,8 +1482,8 @@
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/ddddxxx/MusicPlayer";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 0.7.0;
kind = upToNextMinorVersion;
minimumVersion = 0.7.2;
};
};
BBA82EF9256AB1490076831F /* XCRemoteSwiftPackageReference "appcenter-sdk-apple" */ = {
Expand All @@ -1510,34 +1504,34 @@
};
BBB03F2B232FB3AF00A3879E /* XCRemoteSwiftPackageReference "GenericID" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/ddddxxx/GenericID.git";
repositoryURL = "https://github.com/ddddxxx/GenericID";
requirement = {
kind = upToNextMinorVersion;
minimumVersion = 0.6.0;
};
};
BBB03F2E232FB40400A3879E /* XCRemoteSwiftPackageReference "Semver" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/ddddxxx/Semver.git";
repositoryURL = "https://github.com/ddddxxx/Semver";
requirement = {
kind = upToNextMinorVersion;
minimumVersion = 0.2.0;
};
};
BBB03F382331D8A800A3879E /* XCRemoteSwiftPackageReference "SwiftyOpenCC" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/ddddxxx/SwiftyOpenCC.git";
repositoryURL = "https://github.com/ddddxxx/SwiftyOpenCC";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 1.0.1;
branch = "v2.0.0-beta";
kind = branch;
};
};
BBB03F3B2331DACD00A3879E /* XCRemoteSwiftPackageReference "LyricsKit" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/ddddxxx/LyricsKit.git";
repositoryURL = "https://github.com/ddddxxx/LyricsKit";
requirement = {
kind = upToNextMinorVersion;
minimumVersion = 0.9.0;
minimumVersion = 0.10.0;
};
};
/* End XCRemoteSwiftPackageReference section */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@
"object": {
"pins": [
{
"package": "App Center",
"package": "AppCenter",
"repositoryURL": "https://github.com/microsoft/appcenter-sdk-apple",
"state": {
"branch": null,
"revision": "79d99eaff599d1b38adf81884fe220c75fd38867",
"version": "4.0.0"
"revision": "013bffe628b49433d7bc334146a4ed8c507c0e32",
"version": "4.1.1"
}
},
{
"package": "CombineX",
"repositoryURL": "https://github.com/cx-org/CombineX",
"state": {
"branch": null,
"revision": "96cd76ccddac5d0493ebd91d69f1e6e9ccb58f5f",
"version": "0.3.0"
"revision": "b9afefe14653f02a80a9f5aa546859e99073d0c8",
"version": "0.3.1"
}
},
{
Expand All @@ -30,7 +30,7 @@
},
{
"package": "GenericID",
"repositoryURL": "https://github.com/ddddxxx/GenericID.git",
"repositoryURL": "https://github.com/ddddxxx/GenericID",
"state": {
"branch": null,
"revision": "31594c0f73306bb338316d7beec505e9b8b40dc1",
Expand All @@ -48,25 +48,25 @@
},
{
"package": "LyricsKit",
"repositoryURL": "https://github.com/ddddxxx/LyricsKit.git",
"repositoryURL": "https://github.com/ddddxxx/LyricsKit",
"state": {
"branch": null,
"revision": "18e01e4d8a3685fe4403a06f295c3c8ae9d5655c",
"version": "0.9.0"
"revision": "1f8a3b3f40ff8b040d18fc8b402561bb3effed6c",
"version": "0.10.0"
}
},
{
"package": "MusicPlayer",
"repositoryURL": "https://github.com/ddddxxx/MusicPlayer",
"state": {
"branch": null,
"revision": "e652b184bc91b003dfc34cce88aaaf20b33fb33a",
"version": "0.7.0"
"revision": "06e040a3403c0fb84da1da17be5b3279d9d5156f",
"version": "0.7.2"
}
},
{
"package": "PLCrashReporter",
"repositoryURL": "https://github.com/microsoft/plcrashreporter.git",
"repositoryURL": "https://github.com/microsoft/PLCrashReporter.git",
"state": {
"branch": null,
"revision": "de6b8f9db4b2a0aa859a5507550a70548e4da936",
Expand All @@ -78,13 +78,13 @@
"repositoryURL": "https://github.com/ddddxxx/Regex",
"state": {
"branch": null,
"revision": "739734521806e17a60ba8c439050ae7ada062551",
"version": "0.2.0"
"revision": "df530c4955725c04190a88e09b9756ae5b0b8e95",
"version": "1.0.0"
}
},
{
"package": "Semver",
"repositoryURL": "https://github.com/ddddxxx/Semver.git",
"repositoryURL": "https://github.com/ddddxxx/Semver",
"state": {
"branch": null,
"revision": "6094e6f23a02b52b5d211fd114a4750c4f3ecef3",
Expand All @@ -96,26 +96,26 @@
"repositoryURL": "https://github.com/sparkle-project/Sparkle",
"state": {
"branch": null,
"revision": "891afd44c7075e699924ed9b81d8dc94a5111dfd",
"version": null
"revision": "c0933a516b420806e9216e71bd13ba76c54f0de6",
"version": "1.26.0"
}
},
{
"package": "SwiftCF",
"repositoryURL": "https://github.com/ddddxxx/SwiftCF.git",
"repositoryURL": "https://github.com/ddddxxx/SwiftCF",
"state": {
"branch": null,
"revision": "de40c892f92eaf043ac795ed1a04e2a9ecea0d9c",
"version": "0.1.4"
"revision": "72775c4b4dfceba8f6f43820d50f9286dc97160d",
"version": "0.2.1"
}
},
{
"package": "SwiftyOpenCC",
"repositoryURL": "https://github.com/ddddxxx/SwiftyOpenCC.git",
"repositoryURL": "https://github.com/ddddxxx/SwiftyOpenCC",
"state": {
"branch": null,
"revision": "64a4534c17480b15b87cfa114ffcc5aa26a2d35f",
"version": "1.0.1"
"branch": "v2.0.0-beta",
"revision": "1d8105a0f7199c90af722bff62728050c858e777",
"version": null
}
},
{
Expand Down
4 changes: 2 additions & 2 deletions LyricsX/Component/AppController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class AppController: NSObject {
if defaults[.writeiTunesWithTranslation] {
// TODO: tagged translation
let code = currentLyrics.metadata.translationLanguages.first
if var translation = line.attachments.translation(languageCode: code) {
if var translation = line.attachments[.translation(languageCode: code)] {
if let converter = ChineseConverter.shared {
translation = converter.convert(translation)
}
Expand All @@ -119,7 +119,7 @@ class AppController: NSObject {
return content
}.joined(separator: "\n")
// swiftlint:disable:next force_try
let regex = try! Regex(#"\n{3,}"#)
let regex = Regex(#"\n{3,}"#)
let replaced = content.replacingMatches(of: regex, with: "\n\n")
sbTrack.setValue(replaced, forKey: "lyrics")
}
Expand Down
4 changes: 2 additions & 2 deletions LyricsX/Component/ChineseConverter+Singleton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ extension ChineseConverter {

private static let observer = defaults.observe(.chineseConversionIndex, options: [.new, .initial]) { _, change in
switch change.newValue {
case 1: ChineseConverter._shared = try! ChineseConverter(option: [.simplify])
case 2: ChineseConverter._shared = try! ChineseConverter(option: [.traditionalize])
case 1: ChineseConverter._shared = try! ChineseConverter(options: [.simplify])
case 2: ChineseConverter._shared = try! ChineseConverter(options: [.traditionalize])
case 0, _: ChineseConverter._shared = nil
}
}
Expand Down
4 changes: 2 additions & 2 deletions LyricsX/Component/Lyrics+Language.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ extension Lyrics {
}
for idx in lines.indices {
if let trans = lines[idx].attachments.translation() {
lines[idx].attachments[.translation] = nil
lines[idx].attachments.setTranslation(trans, languageCode: transLan)
lines[idx].attachments[.translation()] = nil
lines[idx].attachments[.translation(languageCode: transLan)] = trans
}
}
metadata.attachmentTags.insert(tag)
Expand Down
3 changes: 2 additions & 1 deletion LyricsX/Controller/KaraokeLyricsController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import MusicPlayer
import OpenCC
import SnapKit
import SwiftCF
import CoreGraphicsExt

class KaraokeLyricsWindowController: NSWindowController {

Expand Down Expand Up @@ -136,7 +137,7 @@ class KaraokeLyricsWindowController: NSWindowController {
if defaults[.desktopLyricsOneLineMode] {
secondLine = ""
} else if defaults[.preferBilingualLyrics],
let translation = lrc.attachments.translation(languageCode: languageCode) {
let translation = lrc.attachments[.translation(languageCode: languageCode)] {
secondLine = translation
secondLineIsTranslation = true
} else {
Expand Down
1 change: 1 addition & 0 deletions LyricsX/Controller/MenuBarLyricsController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import LyricsCore
import MusicPlayer
import OpenCC
import SwiftCF
import AccessibilityExt

class MenuBarLyricsController {

Expand Down
Binary file removed LyricsX/Supporting Files/Dictionary/HKVariants.ocd
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed LyricsX/Supporting Files/Dictionary/JPVariants.ocd
Binary file not shown.
Binary file not shown.
Binary file removed LyricsX/Supporting Files/Dictionary/STPhrases.ocd
Binary file not shown.
Binary file not shown.
Binary file removed LyricsX/Supporting Files/Dictionary/TSPhrases.ocd
Binary file not shown.
Binary file removed LyricsX/Supporting Files/Dictionary/TWPhrases.ocd
Binary file not shown.
Binary file removed LyricsX/Supporting Files/Dictionary/TWPhrasesRev.ocd
Binary file not shown.
Binary file removed LyricsX/Supporting Files/Dictionary/TWVariants.ocd
Binary file not shown.
Binary file not shown.
Binary file not shown.
6 changes: 3 additions & 3 deletions LyricsX/Supporting Files/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.6.0</string>
<string>1.6.1</string>
<key>CFBundleVersion</key>
<string>2337</string>
<string>2341</string>
<key>Fabric</key>
<dict>
<key>APIKey</key>
Expand All @@ -58,7 +58,7 @@
<key>LSUIElement</key>
<true/>
<key>LX_BUILD_TIME</key>
<integer>1614931047</integer>
<integer>1622446048</integer>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
Expand Down
2 changes: 1 addition & 1 deletion LyricsX/Supporting Files/id.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* title of download button on the update alert. Download new version of the app. */
"Download" = "Unduh";
"Download" = "Download";

/* No comment provided by engineer. */
"Font Fallback: %@" = "Fon Sandaran (fallback): %@";
Expand Down
4 changes: 2 additions & 2 deletions LyricsX/Utility/CFExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import SwiftCF
extension NSString {

var dominantLanguage: String? {
return CFStringTokenizer.bestLanguage(for: .from(self))?.asSwift
return CFStringTokenizer.bestLanguage(for: .from(self))?.asSwift()
}
}

Expand All @@ -25,7 +25,7 @@ extension CFStringTokenizer {
let range = currentTokenRange()
let tokenStr = string.substring(with: range.asNS)
guard tokenStr.unicodeScalars.contains(where: CharacterSet.kanji.contains),
let latin = currentTokenAttribute(.latinTranscription)?.asNS,
let latin = currentTokenAttribute(.latinTranscription)?.asNS(),
let hiragana = latin.applyingTransform(.latinToHiragana, reverse: false),
let (rangeToAnnotate, rangeInAnnotation) = rangeOfUncommonContent(tokenStr, hiragana) else {
return nil
Expand Down
2 changes: 1 addition & 1 deletion LyricsX/View/DragNDropView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import Cocoa

protocol DragNDropDelegate: class {
protocol DragNDropDelegate: AnyObject {
func dragFinished(content: String)
}

Expand Down
2 changes: 1 addition & 1 deletion LyricsX/View/FontSelectTextField.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import Cocoa
import SnapKit

protocol FontSelectTextFieldDelegate: class {
protocol FontSelectTextFieldDelegate: AnyObject {

func fontChanged(from oldFont: NSFont, to newFont: NSFont, sender: FontSelectTextField)
}
Expand Down
10 changes: 3 additions & 7 deletions LyricsX/View/KaraokeLabel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

import Cocoa
import SwiftCF
import CoreGraphicsExt
import CoreTextExt

class KaraokeLabel: NSTextField {

Expand Down Expand Up @@ -81,7 +83,7 @@ class KaraokeLabel: NSTextField {
var attr: [CFAttributedString.Key: Any] = [.ctRubySizeFactor: 0.5]
attr[.ctForegroundColor] = textColor
let annotation = CTRubyAnnotation.create(furigana, attributes: attr)
attrString.addAttribute(.ctRubyAnnotation, value: annotation, range: range)
attrString.addAttribute(.cf(.ctRubyAnnotation), value: annotation, range: range)
}
}
textColor?.do { attrString.addAttributes([.foregroundColor: $0], range: attrString.fullRange) }
Expand Down Expand Up @@ -210,9 +212,3 @@ class KaraokeLabel: NSTextField {
CATransaction.commit()
}
}

import CoreText

extension CFAttributedString.Key {
static let ctForegroundColor = kCTForegroundColorAttributeName as CFAttributedString.Key
}
Loading

0 comments on commit b719b82

Please sign in to comment.