Skip to content

Commit

Permalink
update app icon, add text in QR
Browse files Browse the repository at this point in the history
  • Loading branch information
github-xiaogang committed Nov 4, 2023
1 parent c95130b commit 4c9c80b
Show file tree
Hide file tree
Showing 25 changed files with 183 additions and 266 deletions.
Binary file modified .DS_Store
Binary file not shown.
13 changes: 1 addition & 12 deletions Commander/Commander.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
1BB3934E22812A0300E09525 /* SettingCellView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1BB3934D22812A0300E09525 /* SettingCellView.xib */; };
1BB393522282939900E09525 /* BaseOutlineView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1BB393512282939900E09525 /* BaseOutlineView.swift */; };
1BB39354228293B100E09525 /* BaseCellView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1BB39353228293B100E09525 /* BaseCellView.swift */; };
1BB393AC2283D25800E09525 /* AutorunUtil.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1BB393AB2283D25800E09525 /* AutorunUtil.swift */; };
1BB393AF2283F78F00E09525 /* menubar in Resources */ = {isa = PBXBuildFile; fileRef = 1BB393AE2283F78F00E09525 /* menubar */; };
1BB62931227EC742005B1295 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1BB62930227EC742005B1295 /* AppDelegate.swift */; };
1BB62933227EC745005B1295 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1BB62932227EC745005B1295 /* Assets.xcassets */; };
Expand Down Expand Up @@ -49,7 +48,6 @@
1BB3934D22812A0300E09525 /* SettingCellView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = SettingCellView.xib; sourceTree = "<group>"; };
1BB393512282939900E09525 /* BaseOutlineView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseOutlineView.swift; sourceTree = "<group>"; };
1BB39353228293B100E09525 /* BaseCellView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseCellView.swift; sourceTree = "<group>"; };
1BB393AB2283D25800E09525 /* AutorunUtil.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AutorunUtil.swift; sourceTree = "<group>"; };
1BB393AE2283F78F00E09525 /* menubar */ = {isa = PBXFileReference; lastKnownFileType = folder; path = menubar; sourceTree = "<group>"; };
1BB6292D227EC742005B1295 /* Commander.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Commander.app; sourceTree = BUILT_PRODUCTS_DIR; };
1BB62930227EC742005B1295 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -117,14 +115,6 @@
path = common;
sourceTree = "<group>";
};
1BB393A82283D17E00E09525 /* autorun */ = {
isa = PBXGroup;
children = (
1BB393AB2283D25800E09525 /* AutorunUtil.swift */,
);
path = autorun;
sourceTree = "<group>";
};
1BB393AD2283F78100E09525 /* resource */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -187,7 +177,6 @@
1BB62944227FE383005B1295 /* components */ = {
isa = PBXGroup;
children = (
1BB393A82283D17E00E09525 /* autorun */,
1BB393A72283D15500E09525 /* common */,
);
path = components;
Expand Down Expand Up @@ -260,6 +249,7 @@
TargetAttributes = {
1BB6292C227EC742005B1295 = {
CreatedOnToolsVersion = 10.1;
LastSwiftMigration = "";
SystemCapabilities = {
com.apple.Sandbox = {
enabled = 0;
Expand Down Expand Up @@ -320,7 +310,6 @@
1BB3934C228129F300E09525 /* SettingCellView.swift in Sources */,
1B7AA406233CBC6700F723A9 /* AppAddViewController.swift in Sources */,
1BB39348228128FA00E09525 /* SettingViewController.swift in Sources */,
1BB393AC2283D25800E09525 /* AutorunUtil.swift in Sources */,
1B7AA3FE233CA50E00F723A9 /* QROutputViewController.swift in Sources */,
1B7AA403233CAE2900F723A9 /* AppItem.swift in Sources */,
1BB393522282939900E09525 /* BaseOutlineView.swift in Sources */,
Expand Down
Binary file modified Commander/Commander/.DS_Store
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -2,58 +2,58 @@
"images" : [
{
"idiom" : "mac",
"size" : "16x16",
"scale" : "1x"
"scale" : "1x",
"size" : "16x16"
},
{
"idiom" : "mac",
"size" : "16x16",
"scale" : "2x"
"scale" : "2x",
"size" : "16x16"
},
{
"idiom" : "mac",
"size" : "32x32",
"scale" : "1x"
"scale" : "1x",
"size" : "32x32"
},
{
"idiom" : "mac",
"size" : "32x32",
"scale" : "2x"
"scale" : "2x",
"size" : "32x32"
},
{
"idiom" : "mac",
"size" : "128x128",
"scale" : "1x"
"scale" : "1x",
"size" : "128x128"
},
{
"idiom" : "mac",
"size" : "128x128",
"scale" : "2x"
"scale" : "2x",
"size" : "128x128"
},
{
"idiom" : "mac",
"size" : "256x256",
"scale" : "1x"
"scale" : "1x",
"size" : "256x256"
},
{
"idiom" : "mac",
"size" : "256x256",
"scale" : "2x"
"scale" : "2x",
"size" : "256x256"
},
{
"idiom" : "mac",
"size" : "512x512",
"scale" : "1x"
"scale" : "1x",
"size" : "512x512"
},
{
"size" : "512x512",
"filename" : "appicon.png",
"idiom" : "mac",
"filename" : "AppIconicon.png",
"scale" : "2x"
"scale" : "2x",
"size" : "512x512"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
"author" : "xcode",
"version" : 1
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions Commander/Commander/Base.lproj/MainMenu.xib
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21225" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14490.70"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21225"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
Expand All @@ -23,7 +23,7 @@
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="131" y="158" width="356" height="236"/>
<rect key="screenRect" x="0.0" y="0.0" width="1920" height="1057"/>
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1415"/>
<view key="contentView" id="9zt-Ns-Slo">
<rect key="frame" x="0.0" y="0.0" width="356" height="236"/>
<autoresizingMask key="autoresizingMask"/>
Expand Down
45 changes: 26 additions & 19 deletions Commander/Commander/apps/text2qr/QROutputViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,36 +14,43 @@ class QROutputViewController: NSViewController {

@IBOutlet weak var imageView: NSImageView!

@IBOutlet weak var textTextField: NSTextField!
override func viewDidLoad() {
super.viewDidLoad()
if(self.text == nil) {
return
}
textTextField.maximumNumberOfLines = 6
genQR()
}

func genQR() {
if let filter = CIFilter.init(name: "CIQRCodeGenerator") {
filter.setDefaults()
if let text = self.text {
if let data = text.data(using: String.Encoding.utf8) {
filter.setValue(data, forKey: "inputMessage")
filter.setValue("H", forKey: "inputCorrectionLevel");
}
}
if let ciImage = filter.outputImage {
//scale qr 10x
let scale = 10.0 as CGFloat
let transform = CGAffineTransform.init(scaleX: scale, y: scale)
let scaledImage = ciImage.transformed(by: transform)
let context = CIContext(options: nil)
if let cgImage = context.createCGImage(scaledImage, from: scaledImage.extent) {
let size = scaledImage.extent.size
let image = NSImage.init(cgImage: cgImage, size: size)
self.imageView.image = image
}
guard let text = text else {
return
}
guard let filter = CIFilter.init(name: "CIQRCodeGenerator") else {
textTextField.stringValue = "convert to qr failed"
return
}
filter.setDefaults()
if let data = text.data(using: String.Encoding.utf8) {
filter.setValue(data, forKey: "inputMessage")
filter.setValue("H", forKey: "inputCorrectionLevel");
}
if let ciImage = filter.outputImage {
//scale qr 10x
let scale = 10.0 as CGFloat
let transform = CGAffineTransform.init(scaleX: scale, y: scale)
let scaledImage = ciImage.transformed(by: transform)
let context = CIContext(options: nil)
if let cgImage = context.createCGImage(scaledImage, from: scaledImage.extent) {
let size = scaledImage.extent.size
let image = NSImage.init(cgImage: cgImage, size: size)
self.imageView.image = image
}
}
textTextField.stringValue = text
textTextField.toolTip = text
}

}
48 changes: 39 additions & 9 deletions Commander/Commander/apps/text2qr/QROutputViewController.xib
Original file line number Diff line number Diff line change
@@ -1,30 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21225" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14490.70"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21225"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="QROutputViewController" customModule="Commander" customModuleProvider="target">
<connections>
<outlet property="imageView" destination="bEK-Qq-Fzg" id="N3d-p5-szN"/>
<outlet property="textTextField" destination="5hM-rp-R3r" id="8sh-pB-wcs"/>
<outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<customView id="Hz6-mo-xeY">
<rect key="frame" x="0.0" y="0.0" width="320" height="273"/>
<rect key="frame" x="0.0" y="0.0" width="570" height="492"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="bEK-Qq-Fzg">
<rect key="frame" x="40" y="16" width="240" height="240"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" id="I21-ol-0zT"/>
</imageView>
<stackView distribution="fill" orientation="vertical" alignment="centerX" spacing="32" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="3g1-Zx-Y4s">
<rect key="frame" x="48" y="102" width="474" height="288"/>
<subviews>
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="bEK-Qq-Fzg">
<rect key="frame" x="117" y="48" width="240" height="240"/>
<constraints>
<constraint firstAttribute="height" constant="240" id="J1V-M2-wjU"/>
<constraint firstAttribute="width" constant="240" id="Ntc-aP-0TY"/>
</constraints>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" id="I21-ol-0zT"/>
</imageView>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="5hM-rp-R3r">
<rect key="frame" x="191" y="0.0" width="92" height="16"/>
<textFieldCell key="cell" selectable="YES" title="Multiline Label" id="UHp-Jj-izO">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
</subviews>
<visibilityPriorities>
<integer value="1000"/>
<integer value="1000"/>
</visibilityPriorities>
<customSpacing>
<real value="3.4028234663852886e+38"/>
<real value="3.4028234663852886e+38"/>
</customSpacing>
</stackView>
</subviews>
<point key="canvasLocation" x="60" y="154.5"/>
<constraints>
<constraint firstItem="3g1-Zx-Y4s" firstAttribute="centerY" secondItem="Hz6-mo-xeY" secondAttribute="centerY" id="FJI-ih-WS5"/>
<constraint firstAttribute="trailing" secondItem="3g1-Zx-Y4s" secondAttribute="trailing" constant="48" id="hmM-Xx-xUj"/>
<constraint firstItem="3g1-Zx-Y4s" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="48" id="qya-fh-UVI"/>
</constraints>
<point key="canvasLocation" x="-282" y="184"/>
</customView>
</objects>
</document>
86 changes: 0 additions & 86 deletions Commander/Commander/components/autorun/AutorunUtil.swift

This file was deleted.

5 changes: 2 additions & 3 deletions Commander/Commander/pages/menu/MenuController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,8 @@ class MenuController: NSObject {
menuItem.title = toolItem.title
let iconPath = toolItem.iconPath()
if let image = NSImage.init(contentsOfFile: iconPath) {
let roundImage = image.roundImage()
roundImage.size = NSMakeSize(16, 16)
menuItem.image = roundImage
image.size = NSMakeSize(16, 16)
menuItem.image = image
}
menuItem.representedObject = toolItem
menuItem.target = self
Expand Down
Loading

0 comments on commit 4c9c80b

Please sign in to comment.