Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelRow authored and MichaelRow committed Dec 31, 2015
1 parent fd4dec9 commit 268ffbb
Show file tree
Hide file tree
Showing 12 changed files with 44 additions and 46 deletions.
22 changes: 18 additions & 4 deletions Lyrics/AppController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class AppController: NSObject, NSUserNotificationCenterDelegate {
var timeDly:Int = 0
var timeDlyInFile:Int = 0

private var isTrackingThreadRunning = false
private var hasDiglossiaLrc:Bool = false
private var lyricsWindow:LyricsWindowController!
private var menuBarLyrics:MenuBarLyrics!
Expand Down Expand Up @@ -109,9 +110,11 @@ class AppController: NSObject, NSUserNotificationCenterDelegate {
}

currentLyrics = "LyricsVox"
isTrackingThreadRunning = true
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)) { () -> Void in
self.voxTrackingThread()
}

if vox.running() && vox.playing() {
currentSongID = vox.currentPersistentID().copy() as! NSString
currentSongTitle = vox.currentTitle().copy() as! NSString
Expand Down Expand Up @@ -395,10 +398,7 @@ class AppController: NSObject, NSUserNotificationCenterDelegate {

private func voxTrackingThread() {
var currentPosition: Int = 0
while true {
if vox.running() {
break
}
while !vox.running() {
NSThread.sleepForTimeInterval(1.5)
}

Expand Down Expand Up @@ -427,7 +427,15 @@ class AppController: NSObject, NSUserNotificationCenterDelegate {
//Check whether terminate.
if userDefaults.boolForKey(LyricsQuitWithVox) {
NSApp.terminate(nil)
return
}
if currentLyrics != nil {
currentLyrics = nil
dispatch_async(dispatch_get_main_queue(), { () -> Void in
self.lyricsWindow.displayLyrics(nil, secondLyrics: nil)
})
}
isTrackingThreadRunning = false
return
}
NSThread.sleepForTimeInterval(0.2)
Expand All @@ -437,6 +445,12 @@ class AppController: NSObject, NSUserNotificationCenterDelegate {

func voxPlayerInfoChanged (n:NSNotification){
// check whether song is changed
if !isTrackingThreadRunning {
isTrackingThreadRunning = true
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), { () -> Void in
self.voxTrackingThread()
})
}
if currentSongID == vox.currentPersistentID() {
return
} else {
Expand Down
4 changes: 2 additions & 2 deletions Lyrics/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
LyricsSavingPathPopUpIndex : NSNumber(integer: 0),
LyricsUserSavingPath : userSavingPath,
LyricsAutoLaunches : NSNumber(bool: true),
LyricsLaunchTpyePopUpIndex : NSNumber(integer: 2),
LyricsLaunchTpyePopUpIndex : NSNumber(integer: 1),
LyricsServerIndex : NSNumber(integer: 0),
LyricsQuitWithVox : NSNumber(bool: false),
LyricsDisableAllAlert : NSNumber(bool: false),
Expand Down Expand Up @@ -62,7 +62,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {

NSColorPanel.sharedColorPanel().showsAlpha = true

let lyricsXHelpers = NSRunningApplication.runningApplicationsWithBundleIdentifier("Eru.LyricsX-Helper")
let lyricsXHelpers = NSRunningApplication.runningApplicationsWithBundleIdentifier("Eru.LyricsVox-Helper")
for helper in lyricsXHelpers {
helper.forceTerminate()
}
Expand Down
4 changes: 2 additions & 2 deletions Lyrics/Base.lproj/LyricsEditWindow.xib
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9531"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="LyricsEditWindowController" customModule="LyricsX" customModuleProvider="target">
<customObject id="-2" userLabel="File's Owner" customClass="LyricsEditWindowController" customModule="LyricsVox" customModuleProvider="target">
<connections>
<outlet property="textView" destination="DdJ-zl-cNn" id="4cz-qu-ebd"/>
<outlet property="window" destination="ar1-cr-ly1" id="1GL-PC-jIM"/>
Expand Down Expand Up @@ -40,7 +40,7 @@
<rect key="frame" x="1" y="1" width="407" height="428"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textView drawsBackground="NO" importsGraphics="NO" findStyle="panel" allowsUndo="YES" usesRuler="YES" usesFontPanel="YES" verticallyResizable="YES" allowsNonContiguousLayout="YES" quoteSubstitution="YES" dashSubstitution="YES" spellingCorrection="YES" smartInsertDelete="YES" id="DdJ-zl-cNn" customClass="LyricsEditView" customModule="LyricsX" customModuleProvider="target">
<textView drawsBackground="NO" importsGraphics="NO" findStyle="panel" allowsUndo="YES" usesRuler="YES" usesFontPanel="YES" verticallyResizable="YES" allowsNonContiguousLayout="YES" quoteSubstitution="YES" dashSubstitution="YES" spellingCorrection="YES" smartInsertDelete="YES" id="DdJ-zl-cNn" customClass="LyricsEditView" customModule="LyricsVox" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="392" height="428"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
Expand Down
6 changes: 3 additions & 3 deletions Lyrics/Base.lproj/MainMenu.xib
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9059" systemVersion="15B42" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9531" systemVersion="15C50" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9059"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9531"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
Expand All @@ -12,7 +12,7 @@
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<customObject id="Voe-Tx-rLC" customClass="AppDelegate" customModule="LyricsX" customModuleProvider="target"/>
<customObject id="Voe-Tx-rLC" customClass="AppDelegate" customModule="LyricsVox" customModuleProvider="target"/>
<customObject id="YLy-65-1bz" customClass="NSFontManager"/>
</objects>
</document>
7 changes: 2 additions & 5 deletions Lyrics/Base.lproj/Preferences.xib
Original file line number Diff line number Diff line change
Expand Up @@ -318,16 +318,13 @@
<popUpButton verticalHuggingPriority="750" id="DaO-06-BZN">
<rect key="frame" x="181" y="177" width="148" height="26"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<popUpButtonCell key="cell" type="push" title="Vox Playing" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="F0g-b3-j9x" id="Q9V-sw-d2o">
<popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" id="Q9V-sw-d2o">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
<menu key="menu" id="bCO-9r-R0L">
<items>
<menuItem title="User Login" id="aNq-Pa-I1J"/>
<menuItem title="Vox Launched" id="kLu-hK-K4n"/>
<menuItem title="Vox Playing" state="on" id="F0g-b3-j9x">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
</items>
</menu>
</popUpButtonCell>
Expand Down Expand Up @@ -1085,7 +1082,7 @@
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" id="AAK-6G-7y1">
<font key="font" metaFont="system"/>
<string key="title"> Hi from the developer of LricsX. I hope you enjoy using LricsX!
 LyricsX is a open source app based on some code of DynamicLyrics and other third party libraries. Its maintenance and developing needs time and money. In fact, I'm concidering set up a server to deal with the update thing. If you love this app, you can support me by donating using Wechat or Alipay. Thank you for being awesome!</string>
<mutableString key="title"> Hi from the developer of LricsVox. I hope you enjoy using LricsVox!
 LyricsVox is a open source app based on some third party libraries. Its maintenance and developing needs time and money. In fact, I'm concidering set up a server to deal with the update thing. If you love this app, you can support me by donating using Wechat or Alipay. Thank you for being awesome!</mutableString>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
Expand Down
4 changes: 2 additions & 2 deletions Lyrics/Base.lproj/StatusMenu.xib
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="txX-dr-HGn"/>
<menuItem title="About LyricsX..." id="QoB-2y-8a4">
<menuItem title="About LyricsVox..." id="QoB-2y-8a4">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="orderFrontStandardAboutPanel:" target="-1" id="UVr-pZ-Hc1"/>
Expand All @@ -162,7 +162,7 @@
<action selector="checkForUpdate:" target="-2" id="J20-89-mLG"/>
</connections>
</menuItem>
<menuItem title="Quit LyricsX" id="V6J-Hi-T0z">
<menuItem title="Quit LyricsVox" id="V6J-Hi-T0z">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="terminate:" target="-1" id="KYg-M6-JfZ"/>
Expand Down
2 changes: 1 addition & 1 deletion Lyrics/LyricsWindowController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class LyricsWindowController: NSWindowController {
backgroundLayer.addSublayer(secondLyricsLayer)
setAttributes()
setScreenResolution()
displayLyrics("LyricsX", secondLyrics: nil)
displayLyrics("LyricsVox", secondLyrics: nil)

let nc:NSNotificationCenter = NSNotificationCenter.defaultCenter()
nc.addObserver(self, selector: "handleAttributesUpdate", name: LyricsAttributesChangedNotification, object: nil)
Expand Down
11 changes: 4 additions & 7 deletions Lyrics/zh-Hans.lproj/Preferences.xib
Original file line number Diff line number Diff line change
Expand Up @@ -341,16 +341,13 @@
<popUpButton verticalHuggingPriority="750" id="DaO-06-BZN">
<rect key="frame" x="162" y="182" width="154" height="26"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<popUpButtonCell key="cell" type="push" title="Vox开始播放时" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="F0g-b3-j9x" id="Q9V-sw-d2o">
<popUpButtonCell key="cell" type="push" title="Vox启动时" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="kLu-hK-K4n" id="Q9V-sw-d2o">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
<menu key="menu" id="bCO-9r-R0L">
<items>
<menuItem title="开机启动时" id="aNq-Pa-I1J"/>
<menuItem title="Vox启动时" id="kLu-hK-K4n"/>
<menuItem title="Vox开始播放时" state="on" id="F0g-b3-j9x">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="Vox启动时" state="on" id="kLu-hK-K4n"/>
</items>
</menu>
</popUpButtonCell>
Expand Down Expand Up @@ -1095,8 +1092,8 @@
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" id="AAK-6G-7y1">
<font key="font" metaFont="system"/>
<string key="title"> 您好,我是LyricsX的开发者。很高兴能给你带来一款为您提供便利的软件,希望您在使用过程中度过愉快的每一天!
LyricsX是一款开源的软件,并基于DynamicLyrics的部分代码以及一些第三方库。它仍需要花费时间维护与后期开发,并且将来可能需要搭建服务器以提供更便捷的更新支持。如果您喜爱这款软件,您可以通过微信以及支付宝向我提供捐赠以支持后续的开发维护。感谢您的慷慨捐赠!</string>
<string key="title"> 您好,我是LyricsVox的开发者。很高兴能给你带来一款为您提供便利的软件,希望您在使用过程中度过愉快的每一天!
LyricsVox是一款开源的软件,并基于一些第三方库。它仍需要花费时间维护与后期开发,并且将来可能需要搭建服务器以提供更便捷的更新支持。如果您喜爱这款软件,您可以通过微信以及支付宝向我提供捐赠以支持后续的开发维护。感谢您的慷慨捐赠!</string>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
Expand Down
4 changes: 2 additions & 2 deletions Lyrics/zh-Hans.lproj/StatusMenu.xib
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="NeM-rI-mss"/>
<menuItem title="关于LyricsX..." id="QoB-2y-8a4">
<menuItem title="关于LyricsVox..." id="QoB-2y-8a4">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="orderFrontStandardAboutPanel:" target="-1" id="UVr-pZ-Hc1"/>
Expand All @@ -163,7 +163,7 @@
<action selector="checkForUpdate:" target="-2" id="J20-89-mLG"/>
</connections>
</menuItem>
<menuItem title="结束LyricsX" id="V6J-Hi-T0z">
<menuItem title="结束LyricsVox" id="V6J-Hi-T0z">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="terminate:" target="-1" id="KYg-M6-JfZ"/>
Expand Down
9 changes: 3 additions & 6 deletions Lyrics/zh-Hant.lproj/Preferences.xib
Original file line number Diff line number Diff line change
Expand Up @@ -343,16 +343,13 @@
<popUpButton verticalHuggingPriority="750" id="DaO-06-BZN">
<rect key="frame" x="162" y="183" width="155" height="26"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<popUpButtonCell key="cell" type="push" title="Vox開始播放時" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="F0g-b3-j9x" id="Q9V-sw-d2o">
<popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" id="Q9V-sw-d2o">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
<menu key="menu" id="bCO-9r-R0L">
<items>
<menuItem title="開機啟動時" id="aNq-Pa-I1J"/>
<menuItem title="Vox啟動時" id="kLu-hK-K4n"/>
<menuItem title="Vox開始播放時" state="on" id="F0g-b3-j9x">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
</items>
</menu>
</popUpButtonCell>
Expand Down Expand Up @@ -1101,8 +1098,8 @@
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" id="AAK-6G-7y1">
<font key="font" metaFont="system"/>
<string key="title"> 您好,我是LyricsX的開發者。很高興能給你帶來一款為您提供便利的軟體,希望您在使用過程中度過愉快的每一天!
LyricsX是一款開源的軟體,並基於DynamicLyrics的部分程式碼以及一些第三方庫。它仍需要花費時間維護與後期開發,並且將來可能需要搭建伺服器以提供更便捷的更新支援。如果您喜愛這款軟體,您可以通過微信以及支付寶向我提供捐贈以支援後續的開發維護。感謝您的慷慨捐贈!</string>
<string key="title"> 您好,我是LyricsVox的開發者。很高興能給你帶來一款為您提供便利的軟體,希望您在使用過程中度過愉快的每一天!
LyricsVox是一款開源的軟體,並基於一些第三方庫。它仍需要花費時間維護與後期開發,並且將來可能需要搭建伺服器以提供更便捷的更新支援。如果您喜愛這款軟體,您可以通過微信以及支付寶向我提供捐贈以支援後續的開發維護。感謝您的慷慨捐贈!</string>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
Expand Down
4 changes: 2 additions & 2 deletions Lyrics/zh-Hant.lproj/StatusMenu.xib
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="lfR-h4-Fcs"/>
<menuItem title="關於LyricsX..." id="QoB-2y-8a4">
<menuItem title="關於LyricsVox..." id="QoB-2y-8a4">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="orderFrontStandardAboutPanel:" target="-1" id="UVr-pZ-Hc1"/>
Expand All @@ -162,7 +162,7 @@
<action selector="checkForUpdate:" target="-2" id="J20-89-mLG"/>
</connections>
</menuItem>
<menuItem title="退出LyricsX" id="V6J-Hi-T0z">
<menuItem title="退出LyricsVox" id="V6J-Hi-T0z">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="terminate:" target="-1" id="KYg-M6-JfZ"/>
Expand Down
Loading

0 comments on commit 268ffbb

Please sign in to comment.