Skip to content

Commit

Permalink
move jukebox_api into gem, and start looking at custom views
Browse files Browse the repository at this point in the history
  • Loading branch information
whomwah committed Dec 2, 2013
1 parent 3dbd798 commit 5cbf441
Show file tree
Hide file tree
Showing 15 changed files with 163 additions and 1,213 deletions.
4 changes: 3 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ source 'https://rubygems.org'
gem 'rake'
gem "motion-cocoapods", "~> 1.4.0"
gem "motion-sparkle", "~> 0.0.3"
gem "bubble-wrap", "~> 1.4.0"
gem "bubble-wrap", "~> 1.4.0"
gem "motion-stump", "~> 0.3.0"
gem "kyan_jukebox", :path => "/Users/duncan/_dev/kyan/gems/kyan_jukebox"
8 changes: 8 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
PATH
remote: /Users/duncan/_dev/kyan/gems/kyan_jukebox
specs:
kyan_jukebox (0.0.1)

GEM
remote: https://rubygems.org/
specs:
Expand Down Expand Up @@ -31,6 +36,7 @@ GEM
motion-cocoapods (1.4.0)
cocoapods (>= 0.26.2)
motion-sparkle (0.0.3)
motion-stump (0.3.0)
multi_json (1.8.2)
nap (0.5.1)
open4 (1.3.0)
Expand All @@ -45,6 +51,8 @@ PLATFORMS

DEPENDENCIES
bubble-wrap (~> 1.4.0)
kyan_jukebox!
motion-cocoapods (~> 1.4.0)
motion-sparkle (~> 0.0.3)
motion-stump (~> 0.3.0)
rake
10 changes: 8 additions & 2 deletions app/app_delegate.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
class AppDelegate

attr_accessor :reconn_interval
attr_accessor :reconn_interval, :jukebox

def applicationDidFinishLaunching(notification)
build_jukebox
buildStatus
handle_notifications

Expand Down Expand Up @@ -30,8 +31,13 @@ def build_preferences(sender)
App.shared.activateIgnoringOtherApps(true)
end

def build_jukebox
@jukebox ||= KyanJukebox::Notify.new([:track])
@jukebox.json_parser = BW::JSON
end

def connect_to_websocket_server
url = NSURL.URLWithString("ws://jukebox.local:8080")
url = NSURL.URLWithString(WEBSOCKET_URL)
@websocket = SRWebSocket.new
@websocket.initWithURL(url)
@websocket.delegate = SRWebSocketDelegate
Expand Down
1 change: 1 addition & 0 deletions app/config/constants.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
WEBSOCKET_URL = 'ws://jukebox.local:8080'
7 changes: 7 additions & 0 deletions app/controllers/jukebox_view_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class JukeboxViewController < NSViewController

def track
"duncan"
end

end
9 changes: 4 additions & 5 deletions app/lib/SRWebSocketDelegate.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
class SRWebSocketDelegate

def self.webSocket(webSocket, didReceiveMessage:msg)
@jukebox = JukeBox::Notify.new(msg)

puts msg

@jukebox.notifications.each do |message|
puts "Message: #{msg}"
jukebox = App.shared.delegate.jukebox
jukebox.update!(msg.dataUsingEncoding(NSUTF8StringEncoding))
jukebox.notifications.each do |message|
notification = NSUserNotification.alloc.init
notification.title = message.heading
notification.subtitle = message.subtitle
Expand Down
109 changes: 0 additions & 109 deletions app/lib/jukebox.rb

This file was deleted.

8 changes: 8 additions & 0 deletions app/menu.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ def setupMenu
menu = NSMenu.new
menu.initWithTitle App.name

# mi = NSMenuItem.new
# @jukebox_menu = JukeboxViewController.alloc.initWithNibName("Jukebox", bundle:nil)
# @jukebox_menu.setRepresentedObject(App.shared.delegate.jukebox)
# mi.view = @jukebox_menu.view
# menu.addItem mi

# add_seperator(menu)

links.each_with_index do |data, i|
m = NSMenuItem.new
m.title = data.first
Expand Down
66 changes: 66 additions & 0 deletions resources/Jukebox.xib
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="4514" systemVersion="13A603" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="4514"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="JukeboxViewController">
<connections>
<outlet property="view" destination="1" id="PyE-kc-Raw"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application"/>
<customView id="1">
<rect key="frame" x="0.0" y="0.0" width="300" height="82"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="tjJ-fc-hr3">
<rect key="frame" x="17" y="17" width="48" height="48"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" imageFrameStyle="photo" id="AdW-rr-O8j"/>
<connections>
<binding destination="-2" name="valueURL" keyPath="track.artwork_url" id="pHR-cc-uXC"/>
</connections>
</imageView>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Imb-ce-OY7">
<rect key="frame" x="70" y="45" width="212" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Label" id="far-w2-2lo">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<connections>
<binding destination="-2" name="value" keyPath="track.title" id="Hj3-q5-Gdg"/>
</connections>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="LmO-9R-jVU">
<rect key="frame" x="70" y="29" width="212" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Label" id="PQM-WN-fam">
<font key="font" size="11" name="LucidaGrande"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<connections>
<binding destination="-2" name="value" keyPath="track.artist" id="zLi-bs-fbl"/>
</connections>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="rtE-JI-KQJ">
<rect key="frame" x="70" y="15" width="212" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Label" id="imu-Dq-tCk">
<font key="font" size="11" name="LucidaGrande"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<connections>
<binding destination="-2" name="value" keyPath="track.album" id="WsG-bA-dzN"/>
</connections>
</textField>
</subviews>
</customView>
<userDefaultsController representsSharedInstance="YES" id="pbm-fd-DUz"/>
</objects>
</document>
20 changes: 16 additions & 4 deletions resources/xcode/Dummy/Dummy.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
objects = {

/* Begin PBXBuildFile section */
AE1FAC861843EFDF001CDEB9 /* Jukebox.xib in Resources */ = {isa = PBXBuildFile; fileRef = AE1FAC851843EFDE001CDEB9 /* Jukebox.xib */; };
AE1FAC891843F017001CDEB9 /* JukeboxViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = AE1FAC881843F017001CDEB9 /* JukeboxViewController.m */; };
AE6856BE184003490096F02D /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AE6856BD184003490096F02D /* Cocoa.framework */; };
AE6856DD184003490096F02D /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AE6856DC184003490096F02D /* XCTest.framework */; };
AE6856DE184003490096F02D /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AE6856BD184003490096F02D /* Cocoa.framework */; };
Expand All @@ -25,12 +27,15 @@
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
AE6856BA184003490096F02D /* Dummy.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; name = Dummy.app; path = /Users/duncan/_dev/osx/KyanBar/resources/xcode/Dummy/build/Debug/Dummy.app; sourceTree = "<absolute>"; };
AE1FAC831843EF8E001CDEB9 /* Dummy.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Dummy.app; sourceTree = BUILT_PRODUCTS_DIR; };
AE1FAC841843EF8E001CDEB9 /* DummyTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DummyTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
AE1FAC851843EFDE001CDEB9 /* Jukebox.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = Jukebox.xib; path = ../../Jukebox.xib; sourceTree = "<group>"; };
AE1FAC871843F017001CDEB9 /* JukeboxViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JukeboxViewController.h; sourceTree = "<group>"; };
AE1FAC881843F017001CDEB9 /* JukeboxViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JukeboxViewController.m; sourceTree = "<group>"; };
AE6856BD184003490096F02D /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
AE6856C0184003490096F02D /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
AE6856C1184003490096F02D /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; };
AE6856C2184003490096F02D /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
AE6856DB184003490096F02D /* DummyTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; name = DummyTests.xctest; path = /Users/duncan/_dev/osx/KyanBar/resources/xcode/Dummy/build/Debug/DummyTests.xctest; sourceTree = "<absolute>"; };
AE6856DC184003490096F02D /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; };
AE6856F11840036F0096F02D /* Preferences.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = Preferences.xib; path = ../../Preferences.xib; sourceTree = "<group>"; };
AE6856F3184003A40096F02D /* PreferencesController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PreferencesController.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -61,10 +66,15 @@
AE6856B1184003490096F02D = {
isa = PBXGroup;
children = (
AE1FAC871843F017001CDEB9 /* JukeboxViewController.h */,
AE1FAC881843F017001CDEB9 /* JukeboxViewController.m */,
AE6856F3184003A40096F02D /* PreferencesController.h */,
AE6856F4184003A40096F02D /* PreferencesController.m */,
AE6856F11840036F0096F02D /* Preferences.xib */,
AE1FAC851843EFDE001CDEB9 /* Jukebox.xib */,
AE6856BC184003490096F02D /* Frameworks */,
AE1FAC831843EF8E001CDEB9 /* Dummy.app */,
AE1FAC841843EF8E001CDEB9 /* DummyTests.xctest */,
);
sourceTree = "<group>";
};
Expand Down Expand Up @@ -105,7 +115,7 @@
);
name = Dummy;
productName = Dummy;
productReference = AE6856BA184003490096F02D /* Dummy.app */;
productReference = AE1FAC831843EF8E001CDEB9 /* Dummy.app */;
productType = "com.apple.product-type.application";
};
AE6856DA184003490096F02D /* DummyTests */ = {
Expand All @@ -123,7 +133,7 @@
);
name = DummyTests;
productName = DummyTests;
productReference = AE6856DB184003490096F02D /* DummyTests.xctest */;
productReference = AE1FAC841843EF8E001CDEB9 /* DummyTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
/* End PBXNativeTarget section */
Expand Down Expand Up @@ -164,6 +174,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
AE1FAC861843EFDF001CDEB9 /* Jukebox.xib in Resources */,
AE6856F21840036F0096F02D /* Preferences.xib in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -183,6 +194,7 @@
buildActionMask = 2147483647;
files = (
AE6856F5184003A40096F02D /* PreferencesController.m in Sources */,
AE1FAC891843F017001CDEB9 /* JukeboxViewController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
Binary file not shown.
16 changes: 16 additions & 0 deletions resources/xcode/Dummy/JukeboxViewController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// JukeboxViewController.h
// Dummy
//
// Created by Duncan Robertson on 25/11/2013.
// Copyright (c) 2013 Kyan.com. All rights reserved.
//

#import <Cocoa/Cocoa.h>

@interface JukeboxViewController : NSViewController

IBAction artist;
IBAction title;

@end
Loading

0 comments on commit 5cbf441

Please sign in to comment.