Skip to content

Commit

Permalink
Add on / off state images.
Browse files Browse the repository at this point in the history
It's ugly but you get the idea here...
  • Loading branch information
luosheng committed Nov 11, 2015
1 parent b7ccb03 commit e593e29
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 1 deletion.
5 changes: 4 additions & 1 deletion OpenSim/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ class AppDelegate: NSObject, NSApplicationDelegate {
DeviceManager.defaultManager.reload()
let iOSDevices = DeviceManager.defaultManager.deviceMapping.filter { $0.0.containsString("iOS") }.flatMap { $0.1 }
iOSDevices.forEach { device in
let deviceMenuItem = statusItem.menu?.addItemWithTitle("\(device.name) (\(device.state))", action: nil, keyEquivalent: "")
let deviceMenuItem = statusItem.menu?.addItemWithTitle("\(device.name)", action: nil, keyEquivalent: "")
deviceMenuItem?.onStateImage = NSImage(named: "active")
deviceMenuItem?.offStateImage = NSImage(named: "inactive")
deviceMenuItem?.state = device.state == .Booted ? NSOnState : NSOffState
deviceMenuItem?.submenu = NSMenu()
device.applications.forEach { app in
let appMenuItem = deviceMenuItem?.submenu?.addItemWithTitle(app.bundleDisplayName, action: "appMenuItemClicked:", keyEquivalent: "")
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions OpenSim/Assets.xcassets/active.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "1447274192_status.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions OpenSim/Assets.xcassets/inactive.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "1447274176_status-offline.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

0 comments on commit e593e29

Please sign in to comment.