Skip to content

Commit

Permalink
Bring back setting to ignore notifications while in focus
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Morris committed Oct 13, 2013
1 parent cea3e8d commit 8751e97
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 23 deletions.
2 changes: 2 additions & 0 deletions Classes/Headers/TPCPreferences.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ typedef enum TXMainTextBoxFontSize : NSInteger {
+ (BOOL)logTranscript;
+ (BOOL)logTranscriptInBatches;

+ (BOOL)postNotificationsWhileInFocus;

+ (NSURL *)transcriptFolder;
+ (void)setTranscriptFolder:(id)value;

Expand Down
10 changes: 6 additions & 4 deletions Classes/IRC/IRCClient.m
Original file line number Diff line number Diff line change
Expand Up @@ -760,9 +760,11 @@ - (BOOL)notifyText:(TXNotificationType)type lineType:(TVCLogLineType)ltype targe
return YES;
}

//if (self.masterController.mainWindowIsActive) {
// return YES;
//}
if ([TPCPreferences postNotificationsWhileInFocus] == NO) {
if (NSDissimilarObjects(type, TXNotificationAddressBookMatchType)) {
return YES;
}
}

if ([TPCPreferences disabledWhileAwayForEvent:type] && self.isAway) {
return YES;
Expand Down Expand Up @@ -814,7 +816,7 @@ - (BOOL)notifyEvent:(TXNotificationType)type lineType:(TVCLogLineType)ltype targ
return YES;
}

if (self.masterController.mainWindowIsActive) {
if ([TPCPreferences postNotificationsWhileInFocus] == NO && self.masterController.mainWindowIsActive) {
if (NSDissimilarObjects(type, TXNotificationAddressBookMatchType)) {
return YES;
}
Expand Down
10 changes: 8 additions & 2 deletions Classes/Preferences/TPCPreferences.m
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,11 @@ + (BOOL)memberListSortFavorsServerStaff
return [RZUserDefaults() boolForKey:@"MemberListSortFavorsServerStaff"];
}

+ (BOOL)postNotificationsWhileInFocus
{
return [RZUserDefaults() boolForKey:@"PostNotificationsWhileInFocus"];
}

+ (BOOL)nickAllConnections
{
return [RZUserDefaults() boolForKey:@"ApplyCommandToAllConnections -> nick"];
Expand Down Expand Up @@ -1386,18 +1391,19 @@ + (void)initPreferences
NSMutableDictionary *d = [NSMutableDictionary dictionary];

d[@"AutomaticallyAddScrollbackMarker"] = @(YES);
d[@"ConfirmApplicationQuit"] = @(YES);
d[@"AutomaticallyDetectHighlightSpam"] = @(YES);
d[@"ChannelNavigationIsServerSpecific"] = @(YES);
d[@"CommandReturnSendsMessageAsAction"] = @(YES);
d[@"ConfirmApplicationQuit"] = @(YES);
d[@"DisplayDockBadges"] = @(YES);
d[@"DisplayEventInLogView -> Join, Part, Quit"] = @(YES);
d[@"DisplayMainWindowWithAntialiasing"] = @(YES);
d[@"DisplayServerMessageOfTheDayOnConnect"] = @(YES);
d[@"DisplayUserListNoModeSymbol"] = @(YES);
d[@"FocusSelectionOnMessageCommandExecution"] = @(YES);
d[@"LogHighlights"] = @(YES);
d[@"AutomaticallyDetectHighlightSpam"] = @(YES);
d[@"LogTranscriptInBatches"] = @(YES);
d[@"PostNotificationsWhileInFocus"] = @(YES);
d[@"ReloadScrollbackOnLaunch"] = @(YES);
d[@"ReplyUnignoredExternalCTCPRequests"] = @(YES);
d[@"TrackNicknameHighlightsOfLocalUser"] = @(YES);
Expand Down
52 changes: 35 additions & 17 deletions Resources/Localization/English.lproj/TDCPreferences.xib
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
<popUpButton key="view" tag="13" id="6451">
<rect key="frame" x="3" y="14" width="43" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<popUpButtonCell key="cell" type="bevel" bezelStyle="regularSquare" image="TPWTB_Extensions" imagePosition="right" lineBreakMode="truncatingTail" borderStyle="bezel" inset="2" pullsDown="YES" selectedItem="6455" id="6452">
<popUpButtonCell key="cell" type="bevel" bezelStyle="regularSquare" imagePosition="right" lineBreakMode="truncatingTail" borderStyle="bezel" inset="2" pullsDown="YES" selectedItem="6455" id="6452">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
<menu key="menu" title="OtherViews" showsStateColumn="NO" id="6453">
Expand Down Expand Up @@ -718,7 +718,7 @@
</subviews>
</customView>
<customView id="4790" userLabel="Alert Settings">
<rect key="frame" x="0.0" y="0.0" width="531" height="317"/>
<rect key="frame" x="0.0" y="0.0" width="531" height="374"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<userGuides>
<userLayoutGuide location="502" affinity="minX"/>
Expand All @@ -728,7 +728,7 @@
</userGuides>
<subviews>
<button id="5343">
<rect key="frame" x="33" y="53" width="465" height="18"/>
<rect key="frame" x="33" y="110" width="465" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" title="Display a badge on the dock to indicate a new highlight or private message." bezelStyle="regularSquare" imagePosition="left" alignment="left" state="on" inset="2" id="5344">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
Expand All @@ -739,7 +739,7 @@
</connections>
</button>
<button id="6142">
<rect key="frame" x="34" y="25" width="436" height="18"/>
<rect key="frame" x="34" y="82" width="436" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" title="Include public channel messages in the above mentioned badge count." bezelStyle="regularSquare" imagePosition="left" alignment="left" state="on" inset="2" id="6143">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
Expand All @@ -753,7 +753,7 @@
</connections>
</button>
<popUpButton verticalHuggingPriority="750" id="6614">
<rect key="frame" x="205" y="277" width="208" height="26"/>
<rect key="frame" x="205" y="334" width="208" height="26"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" borderStyle="borderAndBezel" inset="2" id="6615">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
Expand All @@ -771,7 +771,7 @@
</connections>
</popUpButton>
<textField verticalHuggingPriority="750" id="6621">
<rect key="frame" x="117" y="282" width="86" height="17"/>
<rect key="frame" x="117" y="339" width="86" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" controlSize="mini" sendsActionOnEndEditing="YES" title="Current Alert:" id="6622">
<font key="font" metaFont="cellTitle"/>
Expand All @@ -780,7 +780,7 @@
</textFieldCell>
</textField>
<button id="6623">
<rect key="frame" x="101" y="244" width="252" height="18"/>
<rect key="frame" x="101" y="301" width="252" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" title="Display notification for alert." bezelStyle="regularSquare" imagePosition="left" alignment="left" state="on" inset="2" id="6624">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
Expand All @@ -791,7 +791,7 @@
</connections>
</button>
<button id="6627">
<rect key="frame" x="101" y="169" width="322" height="18"/>
<rect key="frame" x="101" y="226" width="322" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" title="Disable alert when /away command is set." bezelStyle="regularSquare" imagePosition="left" alignment="left" state="on" inset="2" id="6628">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
Expand All @@ -802,7 +802,7 @@
</connections>
</button>
<textField verticalHuggingPriority="750" id="6629">
<rect key="frame" x="119" y="114" width="129" height="17"/>
<rect key="frame" x="119" y="171" width="129" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Play sound on alert:" id="6630">
<font key="font" metaFont="system"/>
Expand All @@ -811,7 +811,7 @@
</textFieldCell>
</textField>
<popUpButton verticalHuggingPriority="750" id="6633">
<rect key="frame" x="250" y="108" width="141" height="26"/>
<rect key="frame" x="250" y="165" width="141" height="26"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" borderStyle="borderAndBezel" inset="2" id="6634">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
Expand All @@ -829,7 +829,7 @@
</connections>
</popUpButton>
<textField verticalHuggingPriority="750" id="6744">
<rect key="frame" x="239" y="170" width="43" height="16"/>
<rect key="frame" x="239" y="227" width="43" height="16"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="/away" id="6745">
<font key="font" metaFont="systemBold" size="12"/>
Expand All @@ -838,14 +838,14 @@
</textFieldCell>
</textField>
<box autoresizesSubviews="NO" verticalHuggingPriority="750" alphaValue="0.5" title="Box" boxType="separator" titlePosition="noTitle" id="7341">
<rect key="frame" x="33" y="287" width="79" height="5"/>
<rect key="frame" x="33" y="344" width="79" height="5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<color key="borderColor" white="0.0" alpha="0.41999999999999998" colorSpace="calibratedWhite"/>
<color key="fillColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<font key="titleFont" metaFont="system"/>
</box>
<button id="7592">
<rect key="frame" x="101" y="197" width="234" height="18"/>
<rect key="frame" x="101" y="254" width="234" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" title="Speak using system voice." bezelStyle="regularSquare" imagePosition="left" alignment="left" state="on" inset="2" id="7593">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
Expand All @@ -856,7 +856,7 @@
</connections>
</button>
<button id="7708">
<rect key="frame" x="101" y="141" width="161" height="18"/>
<rect key="frame" x="101" y="198" width="161" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" title="Bounce dock icon." bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="7709">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
Expand All @@ -867,28 +867,46 @@
</connections>
</button>
<box autoresizesSubviews="NO" verticalHuggingPriority="750" alphaValue="0.5" title="Box" boxType="separator" titlePosition="noTitle" id="5ca-pM-S2H">
<rect key="frame" x="418" y="287" width="84" height="5"/>
<rect key="frame" x="418" y="344" width="84" height="5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<color key="borderColor" white="0.0" alpha="0.41999999999999998" colorSpace="calibratedWhite"/>
<color key="fillColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<font key="titleFont" metaFont="system"/>
</box>
<box autoresizesSubviews="NO" verticalHuggingPriority="750" alphaValue="0.5" title="Box" boxType="separator" titlePosition="noTitle" id="YYQ-mg-BrA">
<rect key="frame" x="44" y="88" width="442" height="5"/>
<rect key="frame" x="44" y="145" width="442" height="5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<color key="borderColor" white="0.0" alpha="0.41999999999999998" colorSpace="calibratedWhite"/>
<color key="fillColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<font key="titleFont" metaFont="system"/>
</box>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="Xnn-X9-iyC">
<rect key="frame" x="116" y="221" width="386" height="17"/>
<rect key="frame" x="116" y="278" width="386" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Growl is running. Notifications will be forwarded to it." id="5Wq-vi-reG">
<font key="font" size="11" name="LucidaGrande"/>
<color key="textColor" name="disabledControlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<box autoresizesSubviews="NO" verticalHuggingPriority="750" alphaValue="0.5" title="Box" boxType="separator" titlePosition="noTitle" id="Omb-qa-9gJ">
<rect key="frame" x="44" y="60" width="442" height="5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<color key="borderColor" white="0.0" alpha="0.41999999999999998" colorSpace="calibratedWhite"/>
<color key="fillColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<font key="titleFont" metaFont="system"/>
</box>
<button id="liP-6Z-ihF">
<rect key="frame" x="33" y="25" width="465" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" title="Display notifications when Textual is the selected application." bezelStyle="regularSquare" imagePosition="left" alignment="left" state="on" inset="2" id="ecm-va-TPk">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="titleBar" size="12"/>
</buttonCell>
<connections>
<binding destination="1247" name="value" keyPath="values.PostNotificationsWhileInFocus" id="UJq-fB-d8E"/>
</connections>
</button>
</subviews>
</customView>
<customView id="4791" userLabel="Style Settings">
Expand Down

0 comments on commit 8751e97

Please sign in to comment.