About window...

This commit is contained in:
macmade
2018-11-06 23:31:24 +01:00
parent 7d4838c988
commit 78249fbc90
5 changed files with 195 additions and 12 deletions
+24 -8
View File
@@ -22,6 +22,8 @@
05D746E52192315C002CF085 /* Notarize.HistoryViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 05D746E32192315C002CF085 /* Notarize.HistoryViewController.xib */; };
05D746E721923630002CF085 /* HistoryItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05D746E621923630002CF085 /* HistoryItem.swift */; };
05D7471B21924CA6002CF085 /* Icon.icns in Resources */ = {isa = PBXBuildFile; fileRef = 05D7471A21924CA6002CF085 /* Icon.icns */; };
05D7471E21924D18002CF085 /* Notarize.AboutWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 05D7471C21924D18002CF085 /* Notarize.AboutWindowController.xib */; };
05D7472021924D1F002CF085 /* AboutWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05D7471F21924D1F002CF085 /* AboutWindowController.swift */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@@ -84,6 +86,8 @@
05D7471821924850002CF085 /* ccache-config.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "ccache-config.sh"; sourceTree = "<group>"; };
05D7471921924850002CF085 /* ccache.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = ccache.sh; sourceTree = "<group>"; };
05D7471A21924CA6002CF085 /* Icon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = Icon.icns; sourceTree = "<group>"; };
05D7471D21924D18002CF085 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/Notarize.AboutWindowController.xib; sourceTree = "<group>"; };
05D7471F21924D1F002CF085 /* AboutWindowController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AboutWindowController.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -130,9 +134,10 @@
children = (
059A0B6521905325004E1D89 /* Images */,
059A0B592190504B004E1D89 /* MainMenu.xib */,
059A0B6221905107004E1D89 /* Notarize.MainWindowController.xib */,
05D7471C21924D18002CF085 /* Notarize.AboutWindowController.xib */,
059A0B6A2190554D004E1D89 /* Notarize.AccountWindowController.xib */,
05D746E32192315C002CF085 /* Notarize.HistoryViewController.xib */,
059A0B6221905107004E1D89 /* Notarize.MainWindowController.xib */,
);
path = UI;
sourceTree = "<group>";
@@ -140,15 +145,16 @@
059A0B5B2190504B004E1D89 /* Classes */ = {
isa = PBXGroup;
children = (
059A0B6821905534004E1D89 /* AccountWindowController.swift */,
059A0B5C2190504B004E1D89 /* ApplicationDelegate.swift */,
059A0B60219050A3004E1D89 /* MainWindowController.swift */,
05D746E1219230FC002CF085 /* HistoryViewController.swift */,
05D746E621923630002CF085 /* HistoryItem.swift */,
05D7469121919DE7002CF085 /* Preferences.swift */,
05D7471F21924D1F002CF085 /* AboutWindowController.swift */,
05D7469321919F53002CF085 /* Account.swift */,
05D746B92191F0BB002CF085 /* Keychain.swift */,
059A0B6821905534004E1D89 /* AccountWindowController.swift */,
05D746DF21922726002CF085 /* ALTool.swift */,
059A0B5C2190504B004E1D89 /* ApplicationDelegate.swift */,
05D746E621923630002CF085 /* HistoryItem.swift */,
05D746E1219230FC002CF085 /* HistoryViewController.swift */,
05D746B92191F0BB002CF085 /* Keychain.swift */,
059A0B60219050A3004E1D89 /* MainWindowController.swift */,
05D7469121919DE7002CF085 /* Preferences.swift */,
);
path = Classes;
sourceTree = "<group>";
@@ -342,6 +348,7 @@
05D746E52192315C002CF085 /* Notarize.HistoryViewController.xib in Resources */,
059A0B6C2190554D004E1D89 /* Notarize.AccountWindowController.xib in Resources */,
05D7471B21924CA6002CF085 /* Icon.icns in Resources */,
05D7471E21924D18002CF085 /* Notarize.AboutWindowController.xib in Resources */,
059A0B6421905107004E1D89 /* Notarize.MainWindowController.xib in Resources */,
059A0B6721905325004E1D89 /* Accounts.icns in Resources */,
);
@@ -355,6 +362,7 @@
buildActionMask = 2147483647;
files = (
05D7469421919F53002CF085 /* Account.swift in Sources */,
05D7472021924D1F002CF085 /* AboutWindowController.swift in Sources */,
059A0B61219050A3004E1D89 /* MainWindowController.swift in Sources */,
05D746E721923630002CF085 /* HistoryItem.swift in Sources */,
05D746E021922726002CF085 /* ALTool.swift in Sources */,
@@ -401,6 +409,14 @@
name = Notarize.HistoryViewController.xib;
sourceTree = "<group>";
};
05D7471C21924D18002CF085 /* Notarize.AboutWindowController.xib */ = {
isa = PBXVariantGroup;
children = (
05D7471D21924D18002CF085 /* Base */,
);
name = Notarize.AboutWindowController.xib;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
@@ -0,0 +1,54 @@
/*******************************************************************************
* The MIT License (MIT)
*
* Copyright (c) 2018 Jean-David Gadina - www.xs-labs.com
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
******************************************************************************/
import Cocoa
@objc class AboutWindowController: NSWindowController
{
@objc private dynamic var name: String?
@objc private dynamic var version: String?
@objc private dynamic var copyright: String?
override var windowNibName: NSNib.Name?
{
return NSNib.Name( NSStringFromClass( type( of: self ) ) )
}
override func windowDidLoad()
{
super.windowDidLoad()
self.window?.titlebarAppearsTransparent = true
self.window?.titleVisibility = .hidden
self.name = Bundle.main.object( forInfoDictionaryKey: "CFBundleName" ) as? String
self.version = Bundle.main.object( forInfoDictionaryKey: "CFBundleShortVersionString" ) as? String
self.copyright = Bundle.main.object( forInfoDictionaryKey: "NSHumanReadableCopyright" ) as? String
if let rev = Bundle.main.object( forInfoDictionaryKey: "CFBundleVersion" ) as? String
{
self.version?.append( " (" + rev + ")" )
}
}
}
+18 -3
View File
@@ -26,12 +26,15 @@ import Cocoa
@NSApplicationMain class ApplicationDelegate: NSObject, NSApplicationDelegate
{
private var mainWindowController = MainWindowController()
private var mainWindowController: MainWindowController?
private var aboutWindowController: AboutWindowController?
func applicationDidFinishLaunching( _ notification: Notification )
{
self.mainWindowController.window?.center()
self.mainWindowController.window?.makeKeyAndOrderFront( nil )
self.mainWindowController = MainWindowController()
self.mainWindowController?.window?.center()
self.mainWindowController?.window?.makeKeyAndOrderFront( nil )
}
func applicationWillTerminate( _ notification: Notification )
@@ -41,5 +44,17 @@ import Cocoa
{
return true
}
@IBAction func showAboutWindow( _ sender: Any? )
{
if self.aboutWindowController == nil
{
self.aboutWindowController = AboutWindowController()
self.aboutWindowController?.window?.center()
}
self.aboutWindowController?.window?.makeKeyAndOrderFront( sender )
}
}
+1 -1
View File
@@ -22,7 +22,7 @@
<menuItem title="About Notarize" id="5kV-Vb-QxS">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="orderFrontStandardAboutPanel:" target="-1" id="Exp-CZ-Vem"/>
<action selector="showAboutWindow:" target="Voe-Tx-rLC" id="npS-EQ-ndO"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="VOq-y0-SEH"/>
@@ -0,0 +1,98 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14460.31"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="AboutWindowController" customModule="Notarize" customModuleProvider="target">
<connections>
<outlet property="window" destination="QvC-M9-y7g" id="3uC-xA-AhB"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window title="About" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="QvC-M9-y7g">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" fullSizeContentView="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="196" y="240" width="395" height="296"/>
<rect key="screenRect" x="0.0" y="0.0" width="1920" height="1177"/>
<view key="contentView" wantsLayer="YES" id="EiT-Mj-1SZ">
<rect key="frame" x="0.0" y="0.0" width="395" height="296"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<visualEffectView appearanceType="vibrantDark" blendingMode="behindWindow" material="windowBackground" state="followsWindowActiveState" translatesAutoresizingMaskIntoConstraints="NO" id="2na-Z2-u9Y">
<rect key="frame" x="0.0" y="0.0" width="395" height="296"/>
<subviews>
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="H8T-8E-DDN">
<rect key="frame" x="20" y="20" width="256" height="256"/>
<constraints>
<constraint firstAttribute="width" constant="256" id="HER-vU-ej4"/>
<constraint firstAttribute="height" constant="256" id="tEO-yL-v7f"/>
</constraints>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyUpOrDown" image="NSApplicationIcon" id="6bs-kJ-2MD"/>
</imageView>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="eUO-Xh-gcg">
<rect key="frame" x="282" y="176" width="95" height="24"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Label" id="n4t-G6-Fj5">
<font key="font" metaFont="systemThin" size="20"/>
<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="version" id="9GC-rX-a5S"/>
</connections>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="zOn-oh-QdP">
<rect key="frame" x="282" y="50" width="95" height="17"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Label" id="JEk-lW-tk0">
<font key="font" metaFont="systemThin" 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="copyright" id="j3k-9t-5tC"/>
</connections>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="2ba-9s-ZV8">
<rect key="frame" x="282" y="208" width="95" height="48"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Label" id="UGy-b9-cuI">
<font key="font" metaFont="systemThin" size="40"/>
<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="name" id="OKL-6y-FGO"/>
</connections>
</textField>
</subviews>
<constraints>
<constraint firstItem="H8T-8E-DDN" firstAttribute="top" secondItem="2na-Z2-u9Y" secondAttribute="top" constant="20" id="3I5-PH-yU3"/>
<constraint firstItem="zOn-oh-QdP" firstAttribute="leading" secondItem="eUO-Xh-gcg" secondAttribute="leading" id="9z8-TQ-exV"/>
<constraint firstItem="eUO-Xh-gcg" firstAttribute="top" secondItem="2ba-9s-ZV8" secondAttribute="bottom" constant="8" id="Ab9-it-JUm"/>
<constraint firstAttribute="trailing" secondItem="zOn-oh-QdP" secondAttribute="trailing" constant="20" id="H1w-13-zMV"/>
<constraint firstItem="zOn-oh-QdP" firstAttribute="bottom" secondItem="H8T-8E-DDN" secondAttribute="bottom" constant="-30" id="I3a-5Y-YXv"/>
<constraint firstItem="eUO-Xh-gcg" firstAttribute="leading" secondItem="2ba-9s-ZV8" secondAttribute="leading" id="QtV-Me-2JH"/>
<constraint firstAttribute="trailing" secondItem="eUO-Xh-gcg" secondAttribute="trailing" constant="20" id="ZzX-cc-IvF"/>
<constraint firstAttribute="trailing" secondItem="2ba-9s-ZV8" secondAttribute="trailing" constant="20" id="a49-qe-KTA"/>
<constraint firstItem="2ba-9s-ZV8" firstAttribute="top" secondItem="H8T-8E-DDN" secondAttribute="top" constant="20" id="hUd-bj-u1o"/>
<constraint firstItem="H8T-8E-DDN" firstAttribute="leading" secondItem="2na-Z2-u9Y" secondAttribute="leading" constant="20" id="qEC-HE-IWz"/>
<constraint firstAttribute="bottom" secondItem="H8T-8E-DDN" secondAttribute="bottom" constant="20" id="sib-85-ry4"/>
<constraint firstItem="2ba-9s-ZV8" firstAttribute="leading" secondItem="H8T-8E-DDN" secondAttribute="trailing" constant="8" id="zlY-3J-nRY"/>
</constraints>
</visualEffectView>
</subviews>
<constraints>
<constraint firstItem="2na-Z2-u9Y" firstAttribute="width" secondItem="EiT-Mj-1SZ" secondAttribute="width" id="4dA-8n-C7v"/>
<constraint firstItem="2na-Z2-u9Y" firstAttribute="centerY" secondItem="EiT-Mj-1SZ" secondAttribute="centerY" id="O55-qt-7R1"/>
<constraint firstItem="2na-Z2-u9Y" firstAttribute="centerX" secondItem="EiT-Mj-1SZ" secondAttribute="centerX" id="dSe-Gv-BQM"/>
<constraint firstItem="2na-Z2-u9Y" firstAttribute="height" secondItem="EiT-Mj-1SZ" secondAttribute="height" id="hu6-Xm-VtI"/>
</constraints>
</view>
<point key="canvasLocation" x="-53.5" y="-162"/>
</window>
</objects>
<resources>
<image name="NSApplicationIcon" width="128" height="128"/>
</resources>
</document>