Skip to content

Commit

Permalink
Updated the Deterministic View
Browse files Browse the repository at this point in the history
  • Loading branch information
kaunteya committed Oct 4, 2015
1 parent cbf82a6 commit b96197e
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 59 deletions.
2 changes: 1 addition & 1 deletion Determinate/ProgressBar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class ProgressBar: DeterminateAnimation {

override func notifyViewRedesigned() {
super.notifyViewRedesigned()
self.layer?.backgroundColor = NSColor.clearColor().CGColor
self.layer?.cornerRadius = self.frame.height / 2
borderLayer.borderColor = borderColor.CGColor
progressLayer.backgroundColor = foreground.CGColor
}
Expand Down
104 changes: 63 additions & 41 deletions ProgressKit/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,7 @@
</viewController>
<customObject id="qek-pA-X3K" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="477" y="457.5"/>
<point key="canvasLocation" x="804" y="492.5"/>
</scene>
<!--Determinate View Controller-->
<scene sceneID="hIz-AP-VOD">
Expand All @@ -850,37 +850,6 @@
<binding destination="XfG-lQ-9wD" name="value" keyPath="liveProgress" id="HLe-KU-Em3"/>
</connections>
</button>
<box autoresizesSubviews="NO" fixedFrame="YES" title="Box" boxType="oldStyle" borderType="line" titlePosition="noTitle" translatesAutoresizingMaskIntoConstraints="NO" id="g6f-cv-RfC">
<rect key="frame" x="20" y="135" width="460" height="118"/>
<view key="contentView">
<rect key="frame" x="1" y="1" width="458" height="116"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="dYN-D7-hBy" customClass="CircularProgressView" customModule="ProgressKit" customModuleProvider="target">
<rect key="frame" x="15" y="8" width="101" height="101"/>
</customView>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="S81-p1-vGt" customClass="CircularProgressView" customModule="ProgressKit" customModuleProvider="target">
<rect key="frame" x="151" y="26" width="64" height="64"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="color" keyPath="background">
<color key="value" red="0.83921569585800171" green="0.44705882668495178" blue="0.43921568989753723" alpha="1" colorSpace="calibratedRGB"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="color" keyPath="foreground">
<color key="value" red="0.29411765933036804" green="0.22352941334247589" blue="0.5372549295425415" alpha="1" colorSpace="calibratedRGB"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="number" keyPath="strokeWidth">
<real key="value" value="5"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="number" keyPath="progress">
<real key="value" value="0.34999999999999998"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</customView>
</subviews>
</view>
<color key="borderColor" white="0.0" alpha="0.41999999999999998" colorSpace="calibratedWhite"/>
<color key="fillColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</box>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="0tx-N3-gG1">
<rect key="frame" x="437" y="265" width="45" height="17"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="100 %" id="7Nr-gz-yTj">
Expand All @@ -893,29 +862,82 @@
</connections>
</textField>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="fRz-hN-yoj" customClass="ProgressBar" customModule="ProgressKit" customModuleProvider="target">
<rect key="frame" x="20" y="20" width="416" height="42"/>
<rect key="frame" x="26" y="37" width="454" height="17"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="color" keyPath="foreground">
<color key="value" red="0.29411765933036804" green="0.22352941334247589" blue="0.5372549295425415" alpha="1" colorSpace="calibratedRGB"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="color" keyPath="background">
<color key="value" white="1" alpha="0.0" colorSpace="calibratedWhite"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</customView>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ejA-gs-jO8" customClass="ProgressBar" customModule="ProgressKit" customModuleProvider="target">
<rect key="frame" x="48" y="91" width="416" height="15"/>
<rect key="frame" x="26" y="91" width="454" height="15"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="progress">
<real key="value" value="0.34999999999999998"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</customView>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="dYN-D7-hBy" customClass="CircularProgressView" customModule="ProgressKit" customModuleProvider="target">
<rect key="frame" x="26" y="132" width="101" height="101"/>
</customView>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="S81-p1-vGt" customClass="CircularProgressView" customModule="ProgressKit" customModuleProvider="target">
<rect key="frame" x="171" y="150" width="64" height="64"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="color" keyPath="background">
<color key="value" red="0.83921569585800171" green="0.44705882668495178" blue="0.43921568989753723" alpha="1" colorSpace="calibratedRGB"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="color" keyPath="foreground">
<color key="value" red="0.29411765933036804" green="0.22352941334247589" blue="0.5372549295425415" alpha="1" colorSpace="calibratedRGB"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="number" keyPath="strokeWidth">
<real key="value" value="5"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="number" keyPath="progress">
<real key="value" value="0.34999999999999998"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</customView>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Bbh-Em-IM9" customClass="CircularProgressView" customModule="ProgressKit" customModuleProvider="target">
<rect key="frame" x="265" y="132" width="101" height="101"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="color" keyPath="background">
<color key="value" white="1" alpha="0.0" colorSpace="calibratedWhite"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="number" keyPath="strokeWidth">
<real key="value" value="7"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="boolean" keyPath="showPercent" value="NO"/>
</userDefinedRuntimeAttributes>
</customView>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="4q2-PV-rE0" customClass="ProgressBar" customModule="ProgressKit" customModuleProvider="target">
<rect key="frame" x="26" y="67" width="454" height="11"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="progress">
<real key="value" value="0.34999999999999998"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="color" keyPath="borderColor">
<color key="value" red="0.92941176891326904" green="0.39215686917304993" blue="0.14509804546833038" alpha="1" colorSpace="calibratedRGB"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="color" keyPath="background">
<color key="value" white="0.72216796875" alpha="1" colorSpace="calibratedWhite"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="color" keyPath="foreground">
<color key="value" red="0.070588238537311554" green="0.40392157435417175" blue="0.60392159223556519" alpha="1" colorSpace="calibratedRGB"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</customView>
</subviews>
</view>
<connections>
<outlet property="circularView1" destination="dYN-D7-hBy" id="Y18-e9-Ky4"/>
<outlet property="circularView2" destination="S81-p1-vGt" id="nZ9-do-IMz"/>
<outlet property="progressBar1" destination="ejA-gs-jO8" id="tvB-Pi-yaR"/>
<outlet property="progressBar2" destination="fRz-hN-yoj" id="H6b-sx-niy"/>
<outlet property="slider" destination="vwx-DU-bI3" id="esn-lC-yUN"/>
</connections>
</viewController>
<customObject id="rPt-NT-nkU" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-57" y="279"/>
<point key="canvasLocation" x="-151" y="337"/>
</scene>
<!--In Determinate View Controller-->
<scene sceneID="0yA-Up-0Gd">
Expand Down Expand Up @@ -1110,7 +1132,7 @@
</viewController>
<customObject id="aXo-xa-gLk" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-32" y="576.5"/>
<point key="canvasLocation" x="328" y="518.5"/>
</scene>
<!--In Determinate View Controller-->
<scene sceneID="7yv-As-dUl">
Expand Down Expand Up @@ -1177,7 +1199,7 @@
</viewController>
<customObject id="puf-Qu-TvG" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="425.5" y="688"/>
<point key="canvasLocation" x="558.5" y="716"/>
</scene>
</scenes>
</document>
22 changes: 5 additions & 17 deletions ProgressKit/DeterminateVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,7 @@ class DeterminateViewController: NSViewController {
}

@IBOutlet weak var slider: NSSlider!

@IBOutlet weak var circularView1: CircularProgressView?
@IBOutlet weak var circularView2: CircularProgressView?
@IBOutlet weak var circularView3: CircularProgressView?
@IBOutlet weak var circularView4: CircularProgressView?
@IBOutlet weak var circularView5: CircularProgressView?

@IBOutlet weak var progressBar1: ProgressBar?
@IBOutlet weak var progressBar2: ProgressBar?


@IBAction func sliderDragged(sender: NSSlider) {

let event = NSApplication.sharedApplication().currentEvent
Expand All @@ -43,13 +33,11 @@ class DeterminateViewController: NSViewController {
}

func setProgress(progress: CGFloat) {
circularView1?.progress = progress
circularView2?.progress = progress
circularView3?.progress = progress
circularView4?.progress = progress
circularView5?.progress = progress
progressBar1?.progress = progress
progressBar2?.progress = progress
for view in self.view.subviews {
if view is DeterminateAnimation {
(view as! DeterminateAnimation).progress = progress
}
}
}

}
Expand Down

0 comments on commit b96197e

Please sign in to comment.