mirror of
https://github.com/transmission/transmission.git
synced 2025-12-24 20:35:36 +00:00
User can now choose the sound that plays.
This commit is contained in:
@@ -900,7 +900,7 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
|
||||
if ([fDefaults boolForKey: @"PlayDownloadSound"])
|
||||
{
|
||||
NSSound * sound;
|
||||
if ((sound = [NSSound soundNamed: @"Glass"]))
|
||||
if ((sound = [NSSound soundNamed: [fDefaults stringForKey: @"DownloadSound"]]))
|
||||
[sound play];
|
||||
}
|
||||
|
||||
@@ -1347,7 +1347,7 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
|
||||
if ([fDefaults boolForKey: @"PlaySeedingSound"])
|
||||
{
|
||||
NSSound * sound;
|
||||
if ((sound = [NSSound soundNamed: @"Submarine"]))
|
||||
if ((sound = [NSSound soundNamed: [fDefaults stringForKey: @"SeedingSound"]]))
|
||||
[sound play];
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,8 @@
|
||||
<string>~/Desktop</string>
|
||||
<key>DownloadLimit</key>
|
||||
<integer>100</integer>
|
||||
<key>DownloadSound</key>
|
||||
<string>Glass</string>
|
||||
<key>Filter</key>
|
||||
<string>None</string>
|
||||
<key>FilterBar</key>
|
||||
@@ -60,6 +62,8 @@
|
||||
<integer>86400</integer>
|
||||
<key>SavePrivateTorrent</key>
|
||||
<true/>
|
||||
<key>SeedingSound</key>
|
||||
<string>Submarine</string>
|
||||
<key>ShowInspector</key>
|
||||
<false/>
|
||||
<key>SmallStatusRegular</key>
|
||||
|
||||
3
macosx/English.lproj/PrefsWindow.nib/classes.nib
generated
3
macosx/English.lproj/PrefsWindow.nib/classes.nib
generated
@@ -18,6 +18,7 @@
|
||||
setRatio = id;
|
||||
setRatioCheck = id;
|
||||
setShowMessage = id;
|
||||
setSound = id;
|
||||
setSpeedLimit = id;
|
||||
setStartSetting = id;
|
||||
setUpdate = id;
|
||||
@@ -35,6 +36,7 @@
|
||||
fDeleteOriginalTorrentCheck = NSButton;
|
||||
fDownloadCheck = NSButton;
|
||||
fDownloadField = NSTextField;
|
||||
fDownloadSoundPopUp = NSPopUpButton;
|
||||
fFolderPopUp = NSPopUpButton;
|
||||
fGeneralView = NSView;
|
||||
fImportFolderPopUp = NSPopUpButton;
|
||||
@@ -48,6 +50,7 @@
|
||||
fRatioField = NSTextField;
|
||||
fRemoveCheck = NSButton;
|
||||
fRemoveDownloadingCheck = NSButton;
|
||||
fSeedingSoundPopUp = NSPopUpButton;
|
||||
fSpeedLimitDownloadField = NSTextField;
|
||||
fSpeedLimitUploadField = NSTextField;
|
||||
fStartMatrix = NSMatrix;
|
||||
|
||||
2
macosx/English.lproj/PrefsWindow.nib/info.nib
generated
2
macosx/English.lproj/PrefsWindow.nib/info.nib
generated
@@ -11,7 +11,7 @@
|
||||
<key>28</key>
|
||||
<string>139 281 538 290 0 0 1152 842 </string>
|
||||
<key>41</key>
|
||||
<string>115 371 538 378 0 0 1152 842 </string>
|
||||
<string>307 386 538 386 0 0 1152 842 </string>
|
||||
<key>66</key>
|
||||
<string>353 613 538 104 0 0 1152 842 </string>
|
||||
</dict>
|
||||
|
||||
BIN
macosx/English.lproj/PrefsWindow.nib/keyedobjects.nib
generated
BIN
macosx/English.lproj/PrefsWindow.nib/keyedobjects.nib
generated
Binary file not shown.
@@ -33,7 +33,8 @@
|
||||
NSToolbar * fToolbar;
|
||||
IBOutlet NSView * fGeneralView, * fTransfersView, * fBandwidthView, * fNetworkView;
|
||||
|
||||
IBOutlet NSPopUpButton * fFolderPopUp, * fImportFolderPopUp;
|
||||
IBOutlet NSPopUpButton * fFolderPopUp, * fImportFolderPopUp,
|
||||
* fDownloadSoundPopUp, * fSeedingSoundPopUp;
|
||||
IBOutlet NSButton * fQuitCheck, * fRemoveCheck,
|
||||
* fQuitDownloadingCheck, * fRemoveDownloadingCheck,
|
||||
* fBadgeDownloadRateCheck, * fBadgeUploadRateCheck,
|
||||
@@ -66,6 +67,7 @@
|
||||
- (void) setShowMessage: (id) sender;
|
||||
- (void) setBadge: (id) sender;
|
||||
- (void) setPlaySound: (id) sender;
|
||||
- (void) setSound: (id) sender;
|
||||
- (void) setUpdate: (id) sender;
|
||||
- (void) checkUpdate;
|
||||
|
||||
|
||||
@@ -192,8 +192,51 @@
|
||||
[fBadgeUploadRateCheck setState: [fDefaults boolForKey: @"BadgeUploadRate"]];
|
||||
|
||||
//set play sound
|
||||
[fPlayDownloadSoundCheck setState: [fDefaults boolForKey: @"PlayDownloadSound"]];
|
||||
[fPlaySeedingSoundCheck setState: [fDefaults boolForKey: @"PlaySeedingSound"]];
|
||||
NSMutableArray * sounds = [NSMutableArray array];
|
||||
NSEnumerator * soundEnumerator,
|
||||
* soundDirectoriesEnumerator = [[NSArray arrayWithObjects: @"System/Library/Sounds", @"Library/Sounds",
|
||||
[NSHomeDirectory() stringByAppendingPathComponent: @"Library/Sounds"], nil] objectEnumerator];
|
||||
NSString * soundPath, * sound;
|
||||
|
||||
//get list of all sounds and sort alphabetically
|
||||
while ((soundPath = [soundDirectoriesEnumerator nextObject]))
|
||||
if (soundEnumerator = [[NSFileManager defaultManager] enumeratorAtPath: soundPath])
|
||||
while ((sound = [soundEnumerator nextObject]))
|
||||
{
|
||||
sound = [sound stringByDeletingPathExtension];
|
||||
if ([NSSound soundNamed: sound])
|
||||
[sounds addObject: sound];
|
||||
}
|
||||
|
||||
[sounds sortUsingSelector: @selector(caseInsensitiveCompare:)];
|
||||
|
||||
//set download sound
|
||||
[fDownloadSoundPopUp removeAllItems];
|
||||
[fDownloadSoundPopUp addItemsWithTitles: sounds];
|
||||
|
||||
BOOL playDownloadSound = [fDefaults boolForKey: @"PlayDownloadSound"];
|
||||
[fPlayDownloadSoundCheck setState: playDownloadSound];
|
||||
[fDownloadSoundPopUp setEnabled: playDownloadSound];
|
||||
|
||||
int downloadSoundIndex = [fDownloadSoundPopUp indexOfItemWithTitle: [fDefaults stringForKey: @"DownloadSound"]];
|
||||
if (downloadSoundIndex >= 0)
|
||||
[fDownloadSoundPopUp selectItemAtIndex: downloadSoundIndex];
|
||||
else
|
||||
[fDefaults setObject: [fDownloadSoundPopUp titleOfSelectedItem] forKey: @"DownloadSound"];
|
||||
|
||||
//set seeding sound
|
||||
[fSeedingSoundPopUp removeAllItems];
|
||||
[fSeedingSoundPopUp addItemsWithTitles: sounds];
|
||||
|
||||
BOOL playSeedingSound = [fDefaults boolForKey: @"PlaySeedingSound"];
|
||||
[fPlaySeedingSoundCheck setState: playSeedingSound];
|
||||
[fSeedingSoundPopUp setEnabled: playSeedingSound];
|
||||
|
||||
int seedingSoundIndex = [fDownloadSoundPopUp indexOfItemWithTitle: [fDefaults stringForKey: @"SeedingSound"]];
|
||||
if (seedingSoundIndex >= 0)
|
||||
[fSeedingSoundPopUp selectItemAtIndex: seedingSoundIndex];
|
||||
else
|
||||
[fDefaults setObject: [fSeedingSoundPopUp titleOfSelectedItem] forKey: @"SeedingSound"];
|
||||
|
||||
//set start setting
|
||||
NSString * startSetting = [fDefaults stringForKey: @"StartSetting"];
|
||||
@@ -516,10 +559,33 @@
|
||||
|
||||
- (void) setPlaySound: (id) sender
|
||||
{
|
||||
BOOL state = [sender state];
|
||||
|
||||
if (sender == fPlayDownloadSoundCheck)
|
||||
[fDefaults setBool: [sender state] forKey: @"PlayDownloadSound"];
|
||||
{
|
||||
[fDownloadSoundPopUp setEnabled: state];
|
||||
[fDefaults setBool: state forKey: @"PlayDownloadSound"];
|
||||
}
|
||||
else if (sender == fPlaySeedingSoundCheck)
|
||||
[fDefaults setBool: [sender state] forKey: @"PlaySeedingSound"];
|
||||
{
|
||||
[fSeedingSoundPopUp setEnabled: state];
|
||||
[fDefaults setBool: state forKey: @"PlaySeedingSound"];
|
||||
}
|
||||
else;
|
||||
}
|
||||
|
||||
- (void) setSound: (id) sender
|
||||
{
|
||||
//play sound when selecting
|
||||
NSString * soundName = [sender titleOfSelectedItem];
|
||||
NSSound * sound;
|
||||
if ((sound = [NSSound soundNamed: soundName]))
|
||||
[sound play];
|
||||
|
||||
if (sender == fDownloadSoundPopUp)
|
||||
[fDefaults setObject: soundName forKey: @"DownloadSound"];
|
||||
else if (sender == fSeedingSoundPopUp)
|
||||
[fDefaults setObject: soundName forKey: @"SeedingSound"];
|
||||
else;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user