Add a link to the about panel and refactor its code.

Link to the project website (GitHub) in the About Background Music
window, and move its code into its own class.

Also, update the copyright notices in the UI and README.
This commit is contained in:
Kyle Neideck 2016-11-13 00:06:58 +11:00
parent b0bfebedc4
commit c8f6790274
7 changed files with 226 additions and 76 deletions

View file

@ -87,6 +87,7 @@
2795973B1C982E4E00A002FB /* BGMXPCListener.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2795973A1C982E4E00A002FB /* BGMXPCListener.mm */; };
279F48771DD6D73A00768A85 /* BGMHermes.m in Sources */ = {isa = PBXBuildFile; fileRef = 279F48761DD6D73900768A85 /* BGMHermes.m */; };
27C457E61CF2BC2600A6C9A6 /* BGMAutoPauseMenuItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 27C457E51CF2BC2600A6C9A6 /* BGMAutoPauseMenuItem.m */; };
27D1D6BB1DD7226C0049E707 /* BGMAboutPanel.m in Sources */ = {isa = PBXBuildFile; fileRef = 27D1D6BA1DD7226C0049E707 /* BGMAboutPanel.m */; };
27D643BE1C9FB84C00737F6E /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 27D643BB1C9FB84C00737F6E /* Info.plist */; };
27D643C01C9FB99200737F6E /* BGMXPCHelperService.m in Sources */ = {isa = PBXBuildFile; fileRef = 27D643BA1C9FB84C00737F6E /* BGMXPCHelperService.m */; };
27D643C11C9FB99200737F6E /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 27D643BC1C9FB84C00737F6E /* main.m */; };
@ -219,6 +220,8 @@
279F48781DD6D94000768A85 /* Hermes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Hermes.h; path = "Music Players/Hermes.h"; sourceTree = "<group>"; };
27C457E41CF2BC2600A6C9A6 /* BGMAutoPauseMenuItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BGMAutoPauseMenuItem.h; sourceTree = "<group>"; };
27C457E51CF2BC2600A6C9A6 /* BGMAutoPauseMenuItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BGMAutoPauseMenuItem.m; sourceTree = "<group>"; };
27D1D6B91DD7226C0049E707 /* BGMAboutPanel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BGMAboutPanel.h; path = Preferences/BGMAboutPanel.h; sourceTree = "<group>"; };
27D1D6BA1DD7226C0049E707 /* BGMAboutPanel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = BGMAboutPanel.m; path = Preferences/BGMAboutPanel.m; sourceTree = "<group>"; };
27D643B41C9FABBD00737F6E /* BGM_Types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BGM_Types.h; path = ../SharedSource/BGM_Types.h; sourceTree = "<group>"; };
27D643B51C9FABBD00737F6E /* BGMXPCProtocols.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BGMXPCProtocols.h; path = ../SharedSource/BGMXPCProtocols.h; sourceTree = "<group>"; };
27D643B91C9FB84C00737F6E /* BGMXPCHelperService.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BGMXPCHelperService.h; path = BGMXPCHelper/BGMXPCHelperService.h; sourceTree = SOURCE_ROOT; };
@ -280,6 +283,8 @@
children = (
1C0BD0A61BF1B029004F4CF5 /* BGMPreferencesMenu.h */,
1C0BD0A71BF1B029004F4CF5 /* BGMPreferencesMenu.mm */,
27D1D6B91DD7226C0049E707 /* BGMAboutPanel.h */,
27D1D6BA1DD7226C0049E707 /* BGMAboutPanel.m */,
1C0BD0A31BF1A8E6004F4CF5 /* BGMAutoPauseMusicPrefs.h */,
1C0BD0A41BF1A8E6004F4CF5 /* BGMAutoPauseMusicPrefs.mm */,
1CE7064A1BF1EC0600BFC06D /* BGMOutputDevicePrefs.h */,
@ -758,6 +763,7 @@
1CB8B33F1BBA75EF000E2DD1 /* main.m in Sources */,
1CB8B33D1BBA75EF000E2DD1 /* AppDelegate.mm in Sources */,
271677BA1C6CBDFA0080B0A2 /* CACFNumber.cpp in Sources */,
27D1D6BB1DD7226C0049E707 /* BGMAboutPanel.m in Sources */,
27379B8A1C7C562D0084A24C /* BGMVLC.m in Sources */,
1C2336DF1BEAE10C004C1C4E /* BGMSpotify.m in Sources */,
1CED616C1C316E1A002CAFCF /* BGMAudioDeviceManager.mm in Sources */,

View file

@ -1,8 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11198.2" systemVersion="16A304a" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11542" systemVersion="16B2333a" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11198.2"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11542"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
@ -88,14 +89,14 @@
<window allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" restorable="NO" hidesOnDeactivate="YES" oneShot="NO" releasedWhenClosed="NO" showsToolbarButton="NO" visibleAtLaunch="NO" animationBehavior="default" id="Cf4-3V-gl1" customClass="NSPanel">
<windowStyleMask key="styleMask" titled="YES" closable="YES" utility="YES"/>
<windowPositionMask key="initialPositionMask" topStrut="YES"/>
<rect key="contentRect" x="248" y="350" width="748" height="293"/>
<rect key="contentRect" x="248" y="350" width="816" height="310"/>
<rect key="screenRect" x="0.0" y="0.0" width="1280" height="778"/>
<view key="contentView" id="HlB-hX-Y0Y">
<rect key="frame" x="0.0" y="0.0" width="748" height="293"/>
<rect key="frame" x="0.0" y="0.0" width="816" height="310"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="r51-dd-LGP">
<rect key="frame" x="18" y="78" width="240" height="22"/>
<rect key="frame" x="53" y="95" width="240" height="22"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="Background Music" id="Dw2-nu-eBQ">
<font key="font" size="18" name=".HelveticaNeueDeskInterface-Regular"/>
@ -104,7 +105,7 @@
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" tag="1" translatesAutoresizingMaskIntoConstraints="NO" id="ekc-h0-I43">
<rect key="frame" x="18" y="53" width="240" height="17"/>
<rect key="frame" x="53" y="70" width="240" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="Version 0.1.0" id="FDH-7l-wFf">
<font key="font" metaFont="system"/>
@ -113,7 +114,7 @@
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="L5P-Lw-aCd">
<rect key="frame" x="299" y="256" width="270" height="17"/>
<rect key="frame" x="367" y="273" width="270" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="left" title="Licensed under GPLv2 or any later version." id="ETh-En-bzX">
<font key="font" metaFont="system"/>
@ -122,20 +123,29 @@
</textFieldCell>
</textField>
<box horizontalHuggingPriority="750" fixedFrame="YES" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="Zc9-gs-X8C">
<rect key="frame" x="264" y="71" width="5" height="150"/>
<rect key="frame" x="332" y="88" width="5" height="150"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
</box>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" tag="2" translatesAutoresizingMaskIntoConstraints="NO" id="Vy4-dv-jQB">
<rect key="frame" x="18" y="28" width="240" height="17"/>
<rect key="frame" x="18" y="45" width="310" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="Copyright © 2016 Kyle Neideck" placeholderString="" id="ctF-95-uVu">
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="Copyright © 2016 Background Music contributors" placeholderString="" id="ctF-95-uVu">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" tag="3" translatesAutoresizingMaskIntoConstraints="NO" id="nx6-kQ-N8Z" customClass="BGMLinkField">
<rect key="frame" x="18" y="20" width="310" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" tag="3" title="https://github.com/kyleneideck/BackgroundMusic" placeholderString="" id="VOb-5X-o3R">
<font key="font" metaFont="system"/>
<color key="textColor" red="0.20000000000000001" green="0.40000000000000002" blue="0.59999999999999998" alpha="1" colorSpace="calibratedRGB"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<imageView wantsLayer="YES" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Tui-Hf-FLv">
<rect key="frame" x="63" y="108" width="150" height="150"/>
<rect key="frame" x="98" y="125" width="150" height="150"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<shadow key="shadow">
<color key="color" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
@ -143,7 +153,7 @@
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" animates="YES" imageScaling="proportionallyUpOrDown" image="FermataIcon" id="dBU-ZS-ZzA"/>
</imageView>
<imageView wantsLayer="YES" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="R1R-Rd-xPC">
<rect key="frame" x="63" y="108" width="150" height="150"/>
<rect key="frame" x="98" y="125" width="150" height="150"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<shadow key="shadow">
<color key="color" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
@ -151,17 +161,17 @@
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" animates="YES" imageScaling="proportionallyUpOrDown" image="FermataIcon" id="1VP-dU-RCe"/>
</imageView>
<scrollView fixedFrame="YES" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="eqz-ap-PAC">
<rect key="frame" x="301" y="28" width="427" height="220"/>
<rect key="frame" x="369" y="20" width="427" height="245"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<clipView key="contentView" ambiguous="YES" id="Cdb-RA-YK0">
<rect key="frame" x="1" y="1" width="410" height="218"/>
<autoresizingMask key="autoresizingMask"/>
<rect key="frame" x="1" y="1" width="425" height="243"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textView ambiguous="YES" editable="NO" importsGraphics="NO" usesFontPanel="YES" findStyle="panel" continuousSpellChecking="YES" allowsUndo="YES" usesRuler="YES" allowsNonContiguousLayout="YES" quoteSubstitution="YES" dashSubstitution="YES" smartInsertDelete="YES" id="LSG-PF-cl8">
<rect key="frame" x="0.0" y="0.0" width="410" height="218"/>
<rect key="frame" x="0.0" y="0.0" width="425" height="243"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<size key="minSize" width="410" height="218"/>
<size key="minSize" width="425" height="243"/>
<size key="maxSize" width="477" height="10000000"/>
<color key="insertionPointColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
</textView>
@ -173,13 +183,13 @@
<autoresizingMask key="autoresizingMask"/>
</scroller>
<scroller key="verticalScroller" verticalHuggingPriority="750" horizontal="NO" id="qCC-lY-zQ6">
<rect key="frame" x="1" y="1" width="15" height="0.0"/>
<rect key="frame" x="410" y="1" width="16" height="243"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
</scrollView>
</subviews>
</view>
<point key="canvasLocation" x="101" y="211.5"/>
<point key="canvasLocation" x="-31" y="220"/>
</window>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" setsMaxLayoutWidthAtFirstLayout="YES" id="IoN-sN-cCx">
<rect key="frame" x="0.0" y="0.0" width="471" height="180"/>

View file

@ -29,7 +29,7 @@
<key>LSUIElement</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2016 Kyle Neideck</string>
<string>Copyright © 2016 Background Music contributors</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>

View file

@ -0,0 +1,43 @@
// This file is part of Background Music.
//
// Background Music is free software: you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 2 of the
// License, or (at your option) any later version.
//
// Background Music is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Background Music. If not, see <http://www.gnu.org/licenses/>.
//
// BGMAboutPanel.h
// BGMApp
//
// Copyright © 2016 Kyle Neideck
//
// This class manages the "About Background Music" window.
//
// System Includes
#import <Cocoa/Cocoa.h>
NS_ASSUME_NONNULL_BEGIN
@interface BGMAboutPanel : NSObject
- (instancetype)initWithPanel:(NSPanel*)inAboutPanel licenseView:(NSTextView*)inLicenseView;
- (void) show;
@end
@interface BGMLinkField : NSTextField
@end
NS_ASSUME_NONNULL_END

View file

@ -0,0 +1,138 @@
// This file is part of Background Music.
//
// Background Music is free software: you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 2 of the
// License, or (at your option) any later version.
//
// Background Music is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Background Music. If not, see <http://www.gnu.org/licenses/>.
//
// BGMAboutPanel.m
// BGMApp
//
// Copyright © 2016 Kyle Neideck
//
// Self Include
#import "BGMAboutPanel.h"
// PublicUtility Includes
#undef CoreAudio_ThreadStampMessages
#define CoreAudio_ThreadStampMessages 0 // Requires C++
#include "CADebugMacros.h"
NS_ASSUME_NONNULL_BEGIN
static NSInteger const kVersionLabelTag = 1;
static NSInteger const kCopyrightLabelTag = 2;
static NSInteger const kProjectWebsiteLabelTag = 3;
@implementation BGMAboutPanel {
NSPanel* aboutPanel;
NSTextField* versionLabel;
NSTextField* copyrightLabel;
NSTextField* websiteLabel;
NSString* projectURL;
NSTextView* licenseView;
}
- (instancetype)initWithPanel:(NSPanel*)inAboutPanel licenseView:(NSTextView*)inLicenseView {
if ((self = [super init])) {
aboutPanel = inAboutPanel;
versionLabel = [[aboutPanel contentView] viewWithTag:kVersionLabelTag];
copyrightLabel = [[aboutPanel contentView] viewWithTag:kCopyrightLabelTag];
websiteLabel = [[aboutPanel contentView] viewWithTag:kProjectWebsiteLabelTag];
projectURL = websiteLabel.stringValue;
licenseView = inLicenseView;
[self initAboutPanel];
}
return self;
}
- (void) initAboutPanel {
// Set up the About Background Music window
NSBundle* bundle = [NSBundle mainBundle];
if (bundle == nil) {
NSLog(@"Background Music: BGMAboutPanel::initAboutPanel: Could not find main bundle");
} else {
// Version number label
NSString* __nullable version =
[[bundle infoDictionary] objectForKey:@"CFBundleShortVersionString"];
if (version) {
versionLabel.stringValue = [NSString stringWithFormat:@"Version %@", version];
}
// Copyright notice label
NSString* __nullable copyrightNotice =
[[bundle infoDictionary] objectForKey:@"NSHumanReadableCopyright"];
if (copyrightNotice) {
copyrightLabel.stringValue = (NSString*)copyrightNotice;
}
// Project website link label
websiteLabel.selectable = YES;
websiteLabel.allowsEditingTextAttributes = YES;
websiteLabel.attributedStringValue =
[[NSAttributedString alloc] initWithString:projectURL
attributes:@{ NSLinkAttributeName: projectURL,
NSFontAttributeName: websiteLabel.font }];
// Load the text of the license into the text view
NSString* __nullable licensePath = [bundle pathForResource:@"LICENSE" ofType:nil];
NSError* err;
NSString* __nullable licenseStr = (!licensePath ? nil :
[NSString stringWithContentsOfFile:(NSString*)licensePath
encoding:NSASCIIStringEncoding
error:&err]);
if (err || !licenseStr || [licenseStr isEqualToString:@""]) {
NSLog(@"Error loading license file: %@", err);
licenseStr = @"Error: could not open license file.";
}
licenseView.string = licenseStr;
}
}
- (void) show {
DebugMsg("BGMAboutPanel::showAboutPanel: Opening \"About Background Music\" panel");
[NSApp activateIgnoringOtherApps:YES];
[aboutPanel setIsVisible:YES];
[aboutPanel makeKeyAndOrderFront:self];
}
@end
@implementation BGMLinkField
- (void) resetCursorRects {
// Change the mouse cursor when hovering over the link. (It does change by default, but only after
// you've clicked it once.)
[self addCursorRect:self.bounds cursor:[NSCursor pointingHandCursor]];
}
@end
NS_ASSUME_NONNULL_END

View file

@ -26,6 +26,7 @@
// Local Includes
#import "BGMAutoPauseMusicPrefs.h"
#import "BGMOutputDevicePrefs.h"
#import "BGMAboutPanel.h"
NS_ASSUME_NONNULL_BEGIN
@ -34,19 +35,13 @@ NS_ASSUME_NONNULL_BEGIN
static NSInteger const kPreferencesMenuItemTag = 1;
static NSInteger const kAboutPanelMenuItemTag = 3;
static NSInteger const kAboutPanelVersionLabelTag = 1;
static NSInteger const kAboutPanelCopyrightLabelTag = 2;
@implementation BGMPreferencesMenu {
// Menu sections
BGMAutoPauseMusicPrefs* autoPauseMusicPrefs;
BGMOutputDevicePrefs* outputDevicePrefs;
// About Background Music window
NSPanel* aboutPanel;
NSTextField* aboutPanelVersionLabel;
NSTextField* aboutPanelCopyrightLabel;
NSTextView* aboutPanelLicenseView;
// The About Background Music window
BGMAboutPanel* aboutPanel;
}
- (id) initWithBGMMenu:(NSMenu*)inBGMMenu
@ -55,12 +50,6 @@ static NSInteger const kAboutPanelCopyrightLabelTag = 2;
aboutPanel:(NSPanel*)inAboutPanel
aboutPanelLicenseView:(NSTextView*)inAboutPanelLicenseView {
if ((self = [super init])) {
aboutPanel = inAboutPanel;
aboutPanelVersionLabel = [[aboutPanel contentView] viewWithTag:kAboutPanelVersionLabelTag];
aboutPanelCopyrightLabel = [[aboutPanel contentView] viewWithTag:kAboutPanelCopyrightLabelTag];
aboutPanelLicenseView = inAboutPanelLicenseView;
NSMenu* prefsMenu = [[inBGMMenu itemWithTag:kPreferencesMenuItemTag] submenu];
[prefsMenu setDelegate:self];
@ -70,54 +59,17 @@ static NSInteger const kAboutPanelCopyrightLabelTag = 2;
outputDevicePrefs = [[BGMOutputDevicePrefs alloc] initWithAudioDevices:inAudioDevices];
aboutPanel = [[BGMAboutPanel alloc] initWithPanel:inAboutPanel licenseView:inAboutPanelLicenseView];
// Set up the "About Background Music" menu item
NSMenuItem* aboutMenuItem = [prefsMenu itemWithTag:kAboutPanelMenuItemTag];
[aboutMenuItem setTarget:self];
[aboutMenuItem setAction:@selector(showAboutPanel)];
[self initAboutPanel];
[aboutMenuItem setTarget:aboutPanel];
[aboutMenuItem setAction:@selector(show)];
}
return self;
}
- (void) initAboutPanel {
// Set up the About Background Music window
NSBundle* bundle = [NSBundle mainBundle];
if (bundle == nil) {
LogWarning("Background Music: BGMPreferencesMenu::initAboutPanel: Could not find main bundle");
} else {
// Version number label
NSString* version = [[bundle infoDictionary] objectForKey:@"CFBundleShortVersionString"];
[aboutPanelVersionLabel setStringValue:[NSString stringWithFormat:@"Version %@", version]];
// Copyright notice label
NSString* copyrightNotice = [[bundle infoDictionary] objectForKey:@"NSHumanReadableCopyright"];
[aboutPanelCopyrightLabel setStringValue:copyrightNotice];
// Load the text of the license into the text view
NSString* licensePath = [bundle pathForResource:@"LICENSE" ofType:nil];
NSError* err;
NSString* licenseStr = [NSString stringWithContentsOfFile:licensePath encoding:NSASCIIStringEncoding error:&err];
if (err != nil || [licenseStr isEqualToString:@""]) {
NSLog(@"Error loading license file: %@", err);
licenseStr = @"Error: could not open license file.";
}
[aboutPanelLicenseView setString:licenseStr];
}
}
- (void) showAboutPanel {
DebugMsg("BGMPreferencesMenu::showAboutPanel: Opening \"About Background Music\" panel");
[NSApp activateIgnoringOtherApps:YES];
[aboutPanel setIsVisible:YES];
[aboutPanel makeKeyAndOrderFront:self];
}
#pragma mark NSMenuDelegate
- (void) menuNeedsUpdate:(NSMenu*)menu {

View file

@ -153,7 +153,8 @@ change the default device and then change it back again. Failing that, you might
## License
GPLv2 or later
Copyright © 2016 [Background Music contributors](https://github.com/kyleneideck/BackgroundMusic/graphs/contributors).
Licensed under [GPLv2](https://www.gnu.org/licenses/gpl-2.0.html), or any later version.
----