Skip to content

Commit

Permalink
Merge pull request psychs#145 from stevenleeg/master
Browse files Browse the repository at this point in the history
  • Loading branch information
dburkart committed Sep 6, 2015
2 parents 6c98d64 + 724f42a commit 4ed8eb5
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 19 deletions.
2 changes: 2 additions & 0 deletions Classes/Controllers/MenuController.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,15 @@
@property (nonatomic) IBOutlet NSMenuItem* closeWindowItem;
@property (nonatomic) IBOutlet NSMenuItem* closeCurrentPanelItem;
@property (nonatomic) IBOutlet NSMenuItem* checkForUpdateItem;
@property (nonatomic) IBOutlet NSMenuItem* toggleMuteSounds;

- (void)setUp;
- (void)terminate;
- (void)startPasteSheetWithContent:(NSString*)content nick:(NSString*)nick uid:(int)uid cid:(int)cid editMode:(BOOL)editMode;
- (void)showServerPropertyDialog:(IRCClient*)client ignore:(BOOL)ignore;

- (void)onPreferences:(id)sender;
- (void)onMute:(id)sender;
- (void)onAutoOp:(id)sender;
- (void)onDcc:(id)sender;
- (void)onMainWindow:(id)sender;
Expand Down
19 changes: 19 additions & 0 deletions Classes/Controllers/MenuController.m
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ - (id)init
return self;
}

- (IBAction)toggleMuteSounds:(id)sender {
}

- (void)setUp
{
#ifdef TARGET_APP_STORE
Expand Down Expand Up @@ -103,6 +106,7 @@ - (BOOL)validateMenuItem:(NSMenuItem *)item
switch (tag) {
case 102: // preferences
case 104: // auto op
case 108: // sound toggle
case 201: // dcc
return YES;
case 202: // close current panel without confirmation
Expand Down Expand Up @@ -335,6 +339,21 @@ - (void)onPreferences:(id)sender
[_preferencesController show];
}

- (void)onMute:(id)sender
{
NSUserDefaults* ud = [NSUserDefaults standardUserDefaults];
BOOL current = [ud boolForKey:@"Preferences.General.muteSounds"];

if(current) {
[_toggleMuteSounds setState: NSOffState];
[ud setBool: NO forKey:@"Preferences.General.muteSounds"];
}
else {
[_toggleMuteSounds setState: NSOnState];
[ud setBool: YES forKey:@"Preferences.General.muteSounds"];
}
}

- (void)preferencesDialogWillClose:(PreferencesController*)sender
{
[_world preferencesChanged];
Expand Down
5 changes: 5 additions & 0 deletions Classes/Helpers/SoundPlayer.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ + (void)play:(NSString*)name
if (!name.length) {
return;
}

NSUserDefaults* ud = [NSUserDefaults standardUserDefaults];
if([ud boolForKey:@"Preferences.General.muteSounds"]) {
return;
}

if ([name isEqualToString:@"Beep"]) {
NSBeep();
Expand Down
2 changes: 2 additions & 0 deletions Classes/Preferences/Preferences.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ typedef enum {
+ (NSString*)titleForEvent:(UserNotificationType)event;
+ (NSString*)soundForEvent:(UserNotificationType)event;
+ (void)setSound:(NSString*)value forEvent:(UserNotificationType)event;
+ (BOOL)isMuted;
+ (void)setMuted:(BOOL)value;
+ (BOOL)userNotificationEnabledForEvent:(UserNotificationType)event;
+ (void)setUserNotificationEnabled:(BOOL)value forEvent:(UserNotificationType)event;

Expand Down
12 changes: 12 additions & 0 deletions Classes/Preferences/Preferences.m
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,18 @@ + (void)setSound:(NSString*)value forEvent:(UserNotificationType)event
[ud setObject:value forKey:key];
}

+ (BOOL)isMuted
{
NSUserDefaults* ud = [NSUserDefaults standardUserDefaults];
return [ud boolForKey:@"Preferences.General.muteSounds"];
}

+ (void)setMuted:(BOOL)value
{
NSUserDefaults* ud = [NSUserDefaults standardUserDefaults];
[ud setBool:value forKey:@"Preferences.General.muteSounds"];
}

+ (BOOL)userNotificationEnabledForEvent:(UserNotificationType)event
{
NSString* key = [[self keyForEvent:event] stringByAppendingString:@"Growl"];
Expand Down
20 changes: 10 additions & 10 deletions English.lproj/ListDialog.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="4510" systemVersion="12F45" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="7706" systemVersion="14B25" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<dependencies>
<deployment version="1070" defaultVersion="1080" identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="4510"/>
<deployment version="1070" identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="7706"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="ListDialog">
Expand All @@ -14,8 +14,8 @@
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application"/>
<window title="Channel List" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" wantsToBeColor="NO" visibleAtLaunch="NO" animationBehavior="default" id="5" userLabel="Window" customClass="DialogWindow">
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window title="Channel List" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="5" userLabel="Window" customClass="DialogWindow">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="719" y="385" width="434" height="396"/>
Expand All @@ -36,7 +36,7 @@
<rect key="frame" x="0.0" y="0.0" width="432" height="281"/>
<autoresizingMask key="autoresizingMask"/>
<size key="intercellSpacing" width="3" height="2"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
<color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
<tableColumns>
<tableColumn identifier="chname" editable="NO" width="124" minWidth="40" maxWidth="1000" id="70">
Expand Down Expand Up @@ -87,11 +87,11 @@
</subviews>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
</clipView>
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" id="115">
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="115">
<rect key="frame" x="1" y="279" width="432" height="15"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
<scroller key="verticalScroller" hidden="YES" verticalHuggingPriority="750" id="114">
<scroller key="verticalScroller" hidden="YES" verticalHuggingPriority="750" doubleValue="1" horizontal="NO" id="114">
<rect key="frame" x="418" y="17" width="15" height="262"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
Expand Down Expand Up @@ -125,7 +125,7 @@ Gw
<action selector="onUpdate:" target="-2" id="122"/>
</connections>
</button>
<searchField verticalHuggingPriority="750" id="103">
<searchField wantsLayer="YES" verticalHuggingPriority="750" id="103">
<rect key="frame" x="260" y="367" width="166" height="19"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
<searchFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" borderStyle="bezel" bezelStyle="round" sendsSearchStringImmediately="YES" maximumRecents="0" recentsAutosaveName="" id="113">
Expand All @@ -145,4 +145,4 @@ Gw
</connections>
</window>
</objects>
</document>
</document>
24 changes: 15 additions & 9 deletions English.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="4514" systemVersion="13B42" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="7706" systemVersion="14B25" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<dependencies>
<deployment version="1070" defaultVersion="1080" identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="4514"/>
<deployment version="1070" identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="7706"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="LimeChatApplication">
Expand All @@ -11,8 +11,8 @@
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application"/>
<window title="LimeChat" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" wantsToBeColor="NO" visibleAtLaunch="NO" animationBehavior="default" id="21" userLabel="Window" customClass="MainWindow">
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window title="LimeChat" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="21" userLabel="Window" customClass="MainWindow">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES" unifiedTitleAndToolbar="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="605" y="249" width="632" height="501"/>
Expand Down Expand Up @@ -109,10 +109,10 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView focusRingType="none" verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnReordering="NO" columnResizing="NO" autosaveColumns="NO" id="258" customClass="MemberListView">
<rect key="frame" x="0.0" y="0.0" width="177" height="328"/>
<rect key="frame" x="0.0" y="0.0" width="177" height="19"/>
<autoresizingMask key="autoresizingMask"/>
<size key="intercellSpacing" width="3" height="2"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
<color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
<tableColumns>
<tableColumn identifier="nick" editable="NO" width="174" minWidth="40" maxWidth="1000" id="260">
Expand Down Expand Up @@ -160,7 +160,7 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<outlineView focusRingType="none" verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnReordering="NO" columnResizing="NO" multipleSelection="NO" emptySelection="NO" autosaveColumns="NO" indentationPerLevel="16" autoresizesOutlineColumn="YES" outlineTableColumn="539" id="536" customClass="ServerTreeView">
<rect key="frame" x="0.0" y="0.0" width="177" height="164"/>
<rect key="frame" x="0.0" y="0.0" width="177" height="19"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<size key="intercellSpacing" width="3" height="2"/>
<color key="backgroundColor" red="0.92549020000000004" green="0.94117647000000004" blue="0.97254901999999999" alpha="1" colorSpace="calibratedRGB"/>
Expand Down Expand Up @@ -242,6 +242,11 @@
<action selector="onPreferences:" target="267" id="413"/>
</connections>
</menuItem>
<menuItem title="Mute Sounds" keyEquivalent="M" id="108">
<connections>
<action selector="onMute:" target="267" id="hmK-3X-qvu"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="143">
<modifierMask key="keyEquivalentModifierMask" command="YES"/>
</menuItem>
Expand Down Expand Up @@ -699,6 +704,7 @@
<outlet property="checkForUpdateItem" destination="1000" id="1009"/>
<outlet property="closeCurrentPanelItem" destination="820" id="824"/>
<outlet property="closeWindowItem" destination="723" id="823"/>
<outlet property="toggleMuteSounds" destination="108" id="gKD-Yk-Nha"/>
</connections>
</customObject>
<customObject id="419" userLabel="SingleLineFormatter" customClass="SingleLineFormatter"/>
Expand Down Expand Up @@ -952,4 +958,4 @@
</items>
</menu>
</objects>
</document>
</document>

0 comments on commit 4ed8eb5

Please sign in to comment.