Skip to content

Commit

Permalink
feat: add feedback button on about window
Browse files Browse the repository at this point in the history
  • Loading branch information
louis.pontoise authored and lwouis committed Mar 10, 2020
1 parent 67f291d commit 4046136
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions alt-tab-macos/ui/preferences-window/tabs/AboutTab.swift
Original file line number Diff line number Diff line change
@@ -1,26 +1,38 @@
import Cocoa
import Foundation

class AboutTab {
class AboutTab: NSObject {
static func make() -> NSTabViewItem {
return TabViewItem.make("About", NSImage.infoName, makeView())
}

private static func makeView() -> NSGridView {
static func makeView() -> NSGridView {
let appIcon = NSImageView(image: App.shared.applicationIconImage)
appIcon.fit(80, 80)
let appText = NSStackView(views: [BoldLabel(App.name), NSTextField(wrappingLabelWithString: "Version \(App.version)")])
appIcon.fit(128, 128)
let appText = NSStackView(views: [
BoldLabel(App.name),
NSTextField(wrappingLabelWithString: "Version \(App.version)"),
HyperlinkLabel("Source code repository", App.repository),
HyperlinkLabel("Latest releases", App.repository + "/releases"),
])
appText.orientation = .vertical
appText.alignment = .left
appText.spacing = GridView.interPadding / 2
appText.views[2].topAnchor.constraint(equalTo: appText.views[1].bottomAnchor, constant: GridView.interPadding).isActive = true
let appInfo = NSStackView(views: [appIcon, appText])
appInfo.spacing = GridView.interPadding
let view = GridView.make([
[appInfo],
[HyperlinkLabel("Source code repository", App.repository)],
[HyperlinkLabel("Latest releases", App.repository + "/releases")],
[NSButton(title: "Send feedback", target: self, action: #selector(feedbackCallback))],
])
view.row(at: 1).topPadding = GridView.interPadding * 2
view.cell(atColumnIndex: 0, rowIndex: 1).xPlacement = .center
view.fit()
return view
}

@objc
static func feedbackCallback(senderControl: NSControl) {
(App.shared as! App).showFeedbackPanel()
}
}

0 comments on commit 4046136

Please sign in to comment.