Skip to content

Commit c20d28e

Browse files
committed
Add label clarifying why block extension/addition is disabled on running legacy blocks
1 parent dc2b549 commit c20d28e

File tree

3 files changed

+29
-15
lines changed

3 files changed

+29
-15
lines changed

Base.lproj/TimerWindow.xib

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="17701" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
2+
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="19162" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
33
<dependencies>
44
<deployment identifier="macosx"/>
5-
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="17701"/>
5+
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="19162"/>
66
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
77
</dependencies>
88
<objects>
@@ -17,9 +17,9 @@
1717
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES"/>
1818
<windowPositionMask key="initialPositionMask" leftStrut="YES" bottomStrut="YES"/>
1919
<rect key="contentRect" x="196" y="428" width="346" height="214"/>
20-
<rect key="screenRect" x="0.0" y="0.0" width="2048" height="1255"/>
20+
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1025"/>
2121
<view key="contentView" id="32">
22-
<rect key="frame" x="0.0" y="0.0" width="432" height="214"/>
22+
<rect key="frame" x="0.0" y="0.0" width="431" height="214"/>
2323
<autoresizingMask key="autoresizingMask"/>
2424
<subviews>
2525
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="JxB-rO-FdX">
@@ -31,7 +31,7 @@
3131
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="SelfControlIcon" id="tP8-FX-23L"/>
3232
</imageView>
3333
<button horizontalHuggingPriority="500" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="G4j-rB-Cgr">
34-
<rect key="frame" x="323" y="0.0" width="102" height="27"/>
34+
<rect key="frame" x="323" y="0.0" width="101" height="27"/>
3535
<buttonCell key="cell" type="push" title="View Blocklist" bezelStyle="rounded" alignment="center" controlSize="small" state="on" borderStyle="border" inset="2" id="B4i-6r-MIh">
3636
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
3737
<font key="font" metaFont="menu" size="11"/>
@@ -41,7 +41,7 @@
4141
</connections>
4242
</button>
4343
<button hidden="YES" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="100">
44-
<rect key="frame" x="119" y="45" width="194" height="27"/>
44+
<rect key="frame" x="118" y="45" width="195" height="27"/>
4545
<buttonCell key="cell" type="push" title="Stuck? Stop block manually" bezelStyle="rounded" alignment="center" controlSize="small" state="on" borderStyle="border" inset="2" id="101">
4646
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
4747
<font key="font" metaFont="smallSystem"/>
@@ -59,15 +59,15 @@
5959
</textFieldCell>
6060
</textField>
6161
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="1000" verticalCompressionResistancePriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="33">
62-
<rect key="frame" x="-2" y="86" width="436" height="50"/>
62+
<rect key="frame" x="-2" y="86" width="435" height="50"/>
6363
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="00:00:00" id="34">
6464
<font key="font" metaFont="system" size="42"/>
6565
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
6666
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
6767
</textFieldCell>
6868
</textField>
6969
<button horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="49">
70-
<rect key="frame" x="96" y="45" width="112" height="27"/>
70+
<rect key="frame" x="96" y="45" width="111" height="27"/>
7171
<buttonCell key="cell" type="push" title="Add to Blocklist" bezelStyle="rounded" alignment="center" controlSize="small" state="on" borderStyle="border" inset="2" id="50">
7272
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
7373
<font key="font" metaFont="menu" size="11"/>
@@ -77,7 +77,7 @@
7777
</connections>
7878
</button>
7979
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="6wT-hW-OYG">
80-
<rect key="frame" x="206" y="45" width="130" height="27"/>
80+
<rect key="frame" x="205" y="45" width="130" height="27"/>
8181
<buttonCell key="cell" type="push" title="Extend Block Timer" bezelStyle="rounded" alignment="center" controlSize="small" state="on" borderStyle="border" inset="2" id="i3S-hJ-1V7">
8282
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
8383
<font key="font" metaFont="menu" size="11"/>
@@ -86,6 +86,15 @@
8686
<action selector="extendBlockTime:" target="7" id="6Xu-rQ-ikP"/>
8787
</connections>
8888
</button>
89+
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="zgk-dw-f88">
90+
<rect key="frame" x="-1" y="38" width="434" height="39"/>
91+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
92+
<textFieldCell key="cell" selectable="YES" alignment="center" title="You can't add to the blocklist or extend the block timer, because this block was started on an older version of SelfControl." id="XVK-Sr-Ukx">
93+
<font key="font" usesAppearanceFont="YES"/>
94+
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
95+
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
96+
</textFieldCell>
97+
</textField>
8998
</subviews>
9099
<constraints>
91100
<constraint firstItem="49" firstAttribute="centerY" secondItem="100" secondAttribute="centerY" id="1fA-oF-2yT"/>
@@ -109,7 +118,7 @@
109118
</constraints>
110119
</view>
111120
<contentBorderThickness minY="32"/>
112-
<point key="canvasLocation" x="-33" y="7"/>
121+
<point key="canvasLocation" x="-33.5" y="7"/>
113122
</window>
114123
<customObject id="7" customClass="TimerWindowController">
115124
<connections>
@@ -122,6 +131,7 @@
122131
<outlet property="extendDurationLabel_" destination="ljO-W1-kqG" id="rIK-W9-GGf"/>
123132
<outlet property="extendDurationSlider_" destination="Rd1-Af-eXQ" id="Ojq-Qb-DxI"/>
124133
<outlet property="killBlockButton_" destination="100" id="105"/>
134+
<outlet property="legacyBlockWarningLabel_" destination="zgk-dw-f88" id="PcD-VR-Fx9"/>
125135
<outlet property="timerLabel_" destination="33" id="91"/>
126136
<outlet property="window" destination="31" id="89"/>
127137
</connections>
@@ -130,7 +140,7 @@
130140
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" utility="YES"/>
131141
<windowPositionMask key="initialPositionMask" leftStrut="YES" bottomStrut="YES"/>
132142
<rect key="contentRect" x="196" y="418" width="334" height="92"/>
133-
<rect key="screenRect" x="0.0" y="0.0" width="2048" height="1255"/>
143+
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1025"/>
134144
<view key="contentView" id="64">
135145
<rect key="frame" x="0.0" y="0.0" width="334" height="89"/>
136146
<autoresizingMask key="autoresizingMask"/>
@@ -189,14 +199,14 @@ DQ
189199
<constraint firstAttribute="bottom" secondItem="66" secondAttribute="bottom" constant="14" id="yqD-Ax-O82"/>
190200
</constraints>
191201
</view>
192-
<point key="canvasLocation" x="191" y="91"/>
202+
<point key="canvasLocation" x="449" y="85"/>
193203
</window>
194204
<userDefaultsController representsSharedInstance="YES" id="77"/>
195205
<window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" visibleAtLaunch="NO" animationBehavior="default" id="N5B-KG-X2q" userLabel="Extend Block Sheet" customClass="NSPanel">
196206
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" utility="YES"/>
197207
<windowPositionMask key="initialPositionMask" leftStrut="YES" bottomStrut="YES"/>
198208
<rect key="contentRect" x="196" y="418" width="338" height="170"/>
199-
<rect key="screenRect" x="0.0" y="0.0" width="2048" height="1255"/>
209+
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1025"/>
200210
<view key="contentView" id="mZd-qZ-baN">
201211
<rect key="frame" x="0.0" y="0.0" width="359" height="170"/>
202212
<autoresizingMask key="autoresizingMask"/>

TimerWindowController.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
IBOutlet NSButton* addToBlockButton_;
3838
IBOutlet NSButton* killBlockButton_;
3939
IBOutlet NSButton* extendBlockButton_;
40+
IBOutlet NSTextField* legacyBlockWarningLabel_;
4041

4142
IBOutlet NSPanel* addSheet_;
4243
IBOutlet NSTextField* addToBlockTextField_;

TimerWindowController.m

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ - (void)awakeFromNib {
7575
killBlockButton_.hidden = YES;
7676
addToBlockButton_.hidden = NO;
7777
extendBlockButton_.hidden = NO;
78+
legacyBlockWarningLabel_.hidden = YES;
7879

7980
// set up extend block dialog
8081
extendDurationSlider_.maxDuration = [defaults integerForKey: @"MaxBlockLength"];
@@ -89,8 +90,9 @@ - (void)awakeFromNib {
8990
// since it's too difficult to get these working across versions.
9091
// the user will just have to wait until their next block to do these things!
9192
if ([SCBlockUtilities legacyBlockIsRunning]) {
92-
addToBlockButton_.enabled = NO;
93-
extendBlockButton_.enabled = NO;
93+
addToBlockButton_.hidden = YES;
94+
extendBlockButton_.hidden = YES;
95+
legacyBlockWarningLabel_.hidden = NO;
9496
}
9597
}
9698

@@ -170,6 +172,7 @@ - (void)updateTimerDisplay:(NSTimer*)timer {
170172

171173
addToBlockButton_.hidden = YES;
172174
extendBlockButton_.hidden = YES;
175+
legacyBlockWarningLabel_.hidden = YES;
173176
killBlockButton_.hidden = NO;
174177
}
175178

0 commit comments

Comments
 (0)