Commit 25b23eb5 authored by Aral Balkan's avatar Aral Balkan

Working on the control panel for the Profile Image Component. Progress towards #27

parent 9b7cf000
......@@ -36,6 +36,7 @@
A78DAE861A7FCADD009FDB15 /* laura-and-osky.jpg in Resources */ = {isa = PBXBuildFile; fileRef = A78DAE811A7FCADD009FDB15 /* laura-and-osky.jpg */; };
A78DAE871A7FCADD009FDB15 /* aral-balkan-by-christina-von-poser.png in Resources */ = {isa = PBXBuildFile; fileRef = A78DAE821A7FCADD009FDB15 /* aral-balkan-by-christina-von-poser.png */; };
A78DAE8A1A7FE5A9009FDB15 /* Collaboration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A78DAE891A7FE5A9009FDB15 /* Collaboration.framework */; };
A78DAE8D1A800177009FDB15 /* ProfileImageComponentControlPanelViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A78DAE8B1A800177009FDB15 /* ProfileImageComponentControlPanelViewController.swift */; };
A7CC1FFA1A6C8FEB00B49AA9 /* MASShortcut.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A7CC1FF91A6C8FEB00B49AA9 /* MASShortcut.framework */; };
A7CC20071A6C992F00B49AA9 /* SwiftyJSON.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7CC20061A6C992F00B49AA9 /* SwiftyJSON.swift */; };
A7CD7F121A6FBB2400BE31D6 /* node.js in Resources */ = {isa = PBXBuildFile; fileRef = A7CD7F111A6FBB2400BE31D6 /* node.js */; };
......@@ -111,6 +112,7 @@
A78DAE811A7FCADD009FDB15 /* laura-and-osky.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "laura-and-osky.jpg"; sourceTree = "<group>"; };
A78DAE821A7FCADD009FDB15 /* aral-balkan-by-christina-von-poser.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "aral-balkan-by-christina-von-poser.png"; sourceTree = "<group>"; };
A78DAE891A7FE5A9009FDB15 /* Collaboration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Collaboration.framework; path = System/Library/Frameworks/Collaboration.framework; sourceTree = SDKROOT; };
A78DAE8B1A800177009FDB15 /* ProfileImageComponentControlPanelViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProfileImageComponentControlPanelViewController.swift; sourceTree = "<group>"; };
A7CC1FF91A6C8FEB00B49AA9 /* MASShortcut.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MASShortcut.framework; path = "../../../../../Library/Developer/Xcode/DerivedData/Heartbeat-bwptofoniwaoqzcgkxzhjtbmtjak/Build/Products/Debug/MASShortcut.framework"; sourceTree = "<group>"; };
A7CC1FFB1A6C8FF700B49AA9 /* SwiftyJSON.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SwiftyJSON.framework; path = ../../sandbox/SwiftyJSON/build/Debug/SwiftyJSON.framework; sourceTree = "<group>"; };
A7CC1FFD1A6C901400B49AA9 /* SwiftyJSON.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SwiftyJSON.framework; path = ../../sandbox/SwiftyJSON/build/Debug/SwiftyJSON.framework; sourceTree = "<group>"; };
......@@ -317,6 +319,7 @@
children = (
A78DAE7D1A7FCABB009FDB15 /* Images for testing */,
A78DAE751A7FC9BE009FDB15 /* ProfileImageComponentViewController.swift */,
A78DAE8B1A800177009FDB15 /* ProfileImageComponentControlPanelViewController.swift */,
);
name = "Profile Image Component";
sourceTree = "<group>";
......@@ -612,6 +615,7 @@
A7F0320E1A77D67500F3A28E /* SetupMessageViewController.swift in Sources */,
A7E7D7B31A616B0B003501C1 /* HorizontalSplitViewController.swift in Sources */,
A7F0320C1A76F35A00F3A28E /* SetupAccountCheckProgressViewController.swift in Sources */,
A78DAE8D1A800177009FDB15 /* ProfileImageComponentControlPanelViewController.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......
......@@ -1375,10 +1375,10 @@
</objects>
<point key="canvasLocation" x="3665" y="1035.5"/>
</scene>
<!--View Controller-->
<!--Profile Image Component Control Panel View Controller-->
<scene sceneID="hsN-EA-BJx">
<objects>
<viewController id="UNz-20-7RR" sceneMemberID="viewController">
<viewController id="UNz-20-7RR" customClass="ProfileImageComponentControlPanelViewController" customModule="Heartbeat" customModuleProvider="target" sceneMemberID="viewController">
<visualEffectView key="view" appearanceType="vibrantDark" blendingMode="behindWindow" material="appearanceBased" state="followsWindowActiveState" id="wZP-Qc-B9l">
<rect key="frame" x="0.0" y="0.0" width="593" height="273"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
......
......@@ -27,6 +27,16 @@ func delay(delay:Double, closure:()->())
dispatch_get_main_queue(), closure)
}
//
// Allows graceful overriding of an NSViewController subclass’s initialisation
// using a common initialiser.
//
extension NSViewController {
enum InitMethod {
case Default
case Coder(NSCoder)
}
}
//
// Coverted to Swift from Cameron Lowell Palmer’s Obj-C category
......
//
// ProfileImageComponentControlPanelViewController.swift
// Heartbeat
//
// Created by Aral Balkan on 02/02/2015.
// Copyright (c) 2015 Ind.ie. All rights reserved.
//
import Cocoa
class ProfileImageComponentControlPanelViewController: NSViewController {
var images:[String]
// Outlets
@IBOutlet weak var visibleX: NSTextField!
@IBOutlet weak var visibleY: NSTextField!
@IBOutlet weak var visibleWidth: NSTextField!
@IBOutlet weak var visibleHeight: NSTextField!
@IBOutlet weak var imagesComboBox: NSComboBox!
@IBOutlet weak var outlineFacesCheckbox: NSButton!
@IBOutlet weak var secondImageView: NSImageView!
//
// MARK: - Object lifecycle
//
override convenience init() {
self.init(.Default)
}
required convenience init(coder aDecoder: NSCoder) {
self.init(.Coder(aDecoder))
}
// Common initialiser.
private init(_ initMethod:InitMethod) {
images = ["laura-and-osky.jpg", "aral-balkan-by-christina-von-poser.png", "burger.jpg", "laura.jpg", "aral-100-100.jpg"]
switch initMethod {
case .Default:
super.init()
case let .Coder(coder):
super.init(coder: coder)
}
}
//
// MARK: - View lifecycle
//
override func viewDidLoad() {
super.viewDidLoad()
if let secondImageViewLayer = secondImageView.layer {
secondImageViewLayer.borderWidth = 1.0
secondImageViewLayer.cornerRadius = 75.0
secondImageViewLayer.masksToBounds = true
}
}
//
// MARK: - Actions
//
@IBAction func saveAction(sender: AnyObject) {
// TODO: Fire a notification to ask for the image.
// var image = self.croppedImage()
// self.secondImageView.image = image
// TODO: Actually save the image
}
@IBAction func outlineFacesCheckboxChanged(sender:NSButton) {
if sender.state == NSOnState {
println("Control panel: TODO: Outlining faces and facial features on the image.")
} else {
println("Control panel: TODO: Removing face outlienes")
}
}
//
// MARK: - NSComboBoxDataSource methods
//
func numberOfItemsInComboBox(aComboBox: NSComboBox) -> Int {
return self.images.count
}
func comboBox(aComboBox: NSComboBox, objectValueForItemAtIndex index: Int) -> AnyObject {
return self.images[index]
}
//
// MARK: - NSComboBoxDelegate methods
//
func comboBoxSelectionDidChange(notification: NSNotification) {
let comboBox:NSComboBox? = notification.object as? NSComboBox
if let comboBox = comboBox {
let selectedImageName:String = self.images[comboBox.indexOfSelectedItem]
// TODO: Fire off a notification to make the panel load the named image.
println("TODO: Load image named: \(selectedImageName)")
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment