Better QRCode window.
This commit is contained in:
@ -261,6 +261,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
|
|||||||
}
|
}
|
||||||
qrcodeWinCtrl = SWBQRCodeWindowController(windowNibName: "SWBQRCodeWindowController")
|
qrcodeWinCtrl = SWBQRCodeWindowController(windowNibName: "SWBQRCodeWindowController")
|
||||||
qrcodeWinCtrl.qrCode = profile.URL()!.absoluteString
|
qrcodeWinCtrl.qrCode = profile.URL()!.absoluteString
|
||||||
|
qrcodeWinCtrl.title = profile.title()
|
||||||
qrcodeWinCtrl.showWindow(self)
|
qrcodeWinCtrl.showWindow(self)
|
||||||
NSApp.activate(ignoringOtherApps: true)
|
NSApp.activate(ignoringOtherApps: true)
|
||||||
qrcodeWinCtrl.window?.makeKeyAndOrderFront(nil)
|
qrcodeWinCtrl.window?.makeKeyAndOrderFront(nil)
|
||||||
@ -486,11 +487,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
|
|||||||
for p in mgr.profiles {
|
for p in mgr.profiles {
|
||||||
let item = NSMenuItem()
|
let item = NSMenuItem()
|
||||||
item.tag = i + kProfileMenuItemIndexBase
|
item.tag = i + kProfileMenuItemIndexBase
|
||||||
if p.remark.isEmpty {
|
item.title = p.title()
|
||||||
item.title = "\(p.serverHost):\(p.serverPort)"
|
|
||||||
} else {
|
|
||||||
item.title = "\(p.remark) (\(p.serverHost):\(p.serverPort))"
|
|
||||||
}
|
|
||||||
if mgr.activeProfileId == p.uuid {
|
if mgr.activeProfileId == p.uuid {
|
||||||
item.state = 1
|
item.state = 1
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,9 @@
|
|||||||
@interface SWBQRCodeWindowController : NSWindowController
|
@interface SWBQRCodeWindowController : NSWindowController
|
||||||
|
|
||||||
@property (nonatomic, copy) NSString *qrCode;
|
@property (nonatomic, copy) NSString *qrCode;
|
||||||
|
@property (nonatomic, copy) NSString *title;
|
||||||
|
|
||||||
|
@property (nonatomic, weak) NSTextField *titleTextField;
|
||||||
@property (nonatomic, weak) NSImageView *imageView;
|
@property (nonatomic, weak) NSImageView *imageView;
|
||||||
|
|
||||||
- (IBAction) copyQRCode: (id) sender;
|
- (IBAction) copyQRCode: (id) sender;
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11762" systemVersion="16C67" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11762" systemVersion="16D32" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<deployment identifier="macosx"/>
|
<deployment identifier="macosx"/>
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11762"/>
|
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11762"/>
|
||||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||||
|
<capability name="system font weights other than Regular or Bold" minToolsVersion="7.0"/>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<objects>
|
<objects>
|
||||||
<customObject id="-2" userLabel="File's Owner" customClass="SWBQRCodeWindowController">
|
<customObject id="-2" userLabel="File's Owner" customClass="SWBQRCodeWindowController">
|
||||||
@ -16,22 +17,46 @@
|
|||||||
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
||||||
<window title="QR Code" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" restorable="NO" oneShot="NO" animationBehavior="default" id="QvC-M9-y7g">
|
<window title="QR Code" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" restorable="NO" oneShot="NO" animationBehavior="default" id="QvC-M9-y7g">
|
||||||
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES"/>
|
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES"/>
|
||||||
<rect key="contentRect" x="566" y="456" width="250" height="250"/>
|
<rect key="contentRect" x="566" y="456" width="290" height="359"/>
|
||||||
<rect key="screenRect" x="0.0" y="0.0" width="1920" height="1057"/>
|
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1027"/>
|
||||||
<view key="contentView" id="EiT-Mj-1SZ">
|
<view key="contentView" id="EiT-Mj-1SZ">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="250" height="250"/>
|
<rect key="frame" x="0.0" y="0.0" width="290" height="359"/>
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="yRy-QH-TEe">
|
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="yRy-QH-TEe">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="250" height="250"/>
|
<rect key="frame" x="20" y="61" width="250" height="250"/>
|
||||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" id="iAJ-tw-LNU"/>
|
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" id="iAJ-tw-LNU"/>
|
||||||
<connections>
|
<connections>
|
||||||
<outlet property="menu" destination="5h4-gO-Rh7" id="Ps3-TP-31Y"/>
|
<outlet property="menu" destination="5h4-gO-Rh7" id="Ps3-TP-31Y"/>
|
||||||
</connections>
|
</connections>
|
||||||
</imageView>
|
</imageView>
|
||||||
|
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="9f5-sB-jlD">
|
||||||
|
<rect key="frame" x="18" y="322" width="254" height="17"/>
|
||||||
|
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||||
|
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="Title For Server" id="fHU-xF-zyc">
|
||||||
|
<font key="font" metaFont="systemSemibold" size="13"/>
|
||||||
|
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||||
|
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||||
|
</textFieldCell>
|
||||||
|
<connections>
|
||||||
|
<binding destination="-2" name="value" keyPath="self.title" id="VU2-sZ-3fH"/>
|
||||||
|
</connections>
|
||||||
|
</textField>
|
||||||
|
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="fAd-u3-u8m">
|
||||||
|
<rect key="frame" x="14" y="13" width="262" height="32"/>
|
||||||
|
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||||
|
<buttonCell key="cell" type="push" title="Copy To Pasteboard" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="3q0-EO-Vug">
|
||||||
|
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||||
|
<font key="font" metaFont="system"/>
|
||||||
|
</buttonCell>
|
||||||
|
<connections>
|
||||||
|
<action selector="copyQRCode:" target="-2" id="4fF-ID-p1E"/>
|
||||||
|
</connections>
|
||||||
|
</button>
|
||||||
</subviews>
|
</subviews>
|
||||||
</view>
|
</view>
|
||||||
|
<point key="canvasLocation" x="152" y="-70.5"/>
|
||||||
</window>
|
</window>
|
||||||
<menu id="5h4-gO-Rh7">
|
<menu id="5h4-gO-Rh7">
|
||||||
<items>
|
<items>
|
||||||
@ -43,5 +68,6 @@
|
|||||||
</menuItem>
|
</menuItem>
|
||||||
</items>
|
</items>
|
||||||
</menu>
|
</menu>
|
||||||
|
<userDefaultsController representsSharedInstance="YES" id="owc-dp-6hu"/>
|
||||||
</objects>
|
</objects>
|
||||||
</document>
|
</document>
|
||||||
|
@ -252,4 +252,12 @@ class ServerProfile: NSObject, NSCopying {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func title() -> String {
|
||||||
|
if remark.isEmpty {
|
||||||
|
return "\(serverHost):\(serverPort)"
|
||||||
|
} else {
|
||||||
|
return "\(remark) (\(serverHost):\(serverPort))"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user