Skip to content

Commit f905859

Browse files
committed
Remove duration slider tick marks + other general UI cleanup
1 parent 512bdf8 commit f905859

File tree

3 files changed

+7
-44
lines changed

3 files changed

+7
-44
lines changed

Base.lproj/DomainList.xib

+3-3
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
<point key="canvasLocation" x="140" y="152"/>
9292
</menu>
9393
<window title="Domain Blocklist" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="1">
94-
<windowStyleMask key="styleMask" titled="YES" closable="YES"/>
94+
<windowStyleMask key="styleMask" titled="YES" closable="YES" texturedBackground="YES"/>
9595
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
9696
<rect key="contentRect" x="342" y="259" width="449" height="315"/>
9797
<rect key="screenRect" x="0.0" y="0.0" width="2048" height="1255"/>
@@ -275,8 +275,8 @@ CA
275275
<userDefaultsController representsSharedInstance="YES" id="113"/>
276276
</objects>
277277
<resources>
278-
<image name="NSAddTemplate" width="15" height="13"/>
279-
<image name="NSRemoveTemplate" width="15" height="4"/>
278+
<image name="NSAddTemplate" width="14" height="13"/>
279+
<image name="NSRemoveTemplate" width="14" height="4"/>
280280
<image name="buttonCell:80:image" width="1" height="1">
281281
<mutableData key="keyedArchiveRepresentation">
282282
YnBsaXN0MDDUAQIDBAUGBwpYJHZlcnNpb25ZJGFyY2hpdmVyVCR0b3BYJG9iamVjdHMSAAGGoF8QD05T

Base.lproj/TimerWindow.xib

+4-4
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ DQ
197197
<windowPositionMask key="initialPositionMask" leftStrut="YES" bottomStrut="YES"/>
198198
<rect key="contentRect" x="196" y="418" width="338" height="170"/>
199199
<rect key="screenRect" x="0.0" y="0.0" width="2048" height="1255"/>
200-
<view key="contentView" misplaced="YES" id="mZd-qZ-baN">
200+
<view key="contentView" id="mZd-qZ-baN">
201201
<rect key="frame" x="0.0" y="0.0" width="359" height="170"/>
202202
<autoresizingMask key="autoresizingMask"/>
203203
<subviews>
@@ -220,7 +220,7 @@ DQ
220220
</connections>
221221
</button>
222222
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="V5b-TT-ZSv">
223-
<rect key="frame" x="271" y="13" width="76" height="32"/>
223+
<rect key="frame" x="270" y="13" width="76" height="32"/>
224224
<buttonCell key="cell" type="push" title="Extend" bezelStyle="rounded" alignment="center" borderStyle="border" inset="2" id="HNV-5F-fhQ">
225225
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
226226
<font key="font" metaFont="system"/>
@@ -233,7 +233,7 @@ DQ
233233
</connections>
234234
</button>
235235
<slider verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Rd1-Af-eXQ" customClass="SCDurationSlider">
236-
<rect key="frame" x="18" y="74" width="324" height="30"/>
236+
<rect key="frame" x="18" y="74" width="323" height="30"/>
237237
<constraints>
238238
<constraint firstAttribute="height" constant="22" id="xty-Ul-pJS"/>
239239
</constraints>
@@ -245,7 +245,7 @@ DQ
245245
</connections>
246246
</slider>
247247
<textField verticalHuggingPriority="750" id="ljO-W1-kqG">
248-
<rect key="frame" x="110" y="61" width="140" height="17"/>
248+
<rect key="frame" x="-2" y="61" width="363" height="17"/>
249249
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
250250
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" alignment="center" title="1 minute" id="ikq-N5-jYi">
251251
<font key="font" metaFont="system"/>

SCDurationSlider.m

-37
Original file line numberDiff line numberDiff line change
@@ -42,45 +42,8 @@ - (void)initializeDurationProperties {
4242

4343
- (void)setMaxDuration:(NSInteger)maxDuration {
4444
_maxDuration = maxDuration;
45-
[self recalculateSliderIntervals];
46-
}
47-
48-
- (void)recalculateSliderIntervals {
4945
[self setMinValue: 1]; // never start a block shorter than 1 minute
5046
[self setMaxValue: self.maxDuration];
51-
52-
// how many tick marks should we have? it's based on the max block duration
53-
// TODO: can we make this work better with the start at 1-minute (vs 0)? if not, should we just eliminate ticks?
54-
long tickInterval = 1;
55-
if (self.maxDuration >= 5256000) {
56-
// if max block duration is at least 10 years, tick marks are per-year
57-
tickInterval = 525600;
58-
} else if (self.maxDuration >= 525600) {
59-
// if max block duration is at least 1 year, tick marks are per-month
60-
tickInterval = 43800;
61-
} else if (self.maxDuration >= 131400) {
62-
// if max block duration is at least 3 months, tick marks are per-week
63-
tickInterval = 10080;
64-
} else if (self.maxDuration >= 10080) {
65-
// if max block duration is at least 1 week, tick marks are per-day
66-
tickInterval = 1440;
67-
} else if (self.maxDuration >= 5760) {
68-
// if max block duration is at least 4 days, tick marks are per 6 hours
69-
tickInterval = 360;
70-
} else if (self.maxDuration >= 1440) {
71-
// if max block duration is at least 1 day, tick marks are per hour
72-
tickInterval = 60;
73-
} else if (self.maxDuration >= 720) {
74-
// if max block duration is at least 12 hours, tick marks are per 30 minutes
75-
tickInterval = 30;
76-
} else if (self.maxDuration >= 60) {
77-
// if max block duration is at least 1 hour, tick marks are per minute
78-
tickInterval = 1;
79-
}
80-
81-
// no more than 72 ticks max
82-
long numTicks = MIN(self.maxDuration / tickInterval, 72) + 1;
83-
[self setNumberOfTickMarks: numTicks];
8447
}
8548

8649
- (void)registerMinutesValueTransformer {

0 commit comments

Comments
 (0)