Add images to account table view

This commit is contained in:
Maurice Parker 2019-05-01 06:49:50 -05:00
parent 4bc7611721
commit a845a96274
10 changed files with 65 additions and 26 deletions

View File

@ -25,4 +25,11 @@ struct AppImages {
static var timelineStar: RSImage! = {
return RSImage(named: .timelineStar)
}()
static var accountLocal: RSImage! = {
let image = RSImage(named: "accountLocal")
image?.isTemplate = true
return image
}()
}

View File

@ -283,14 +283,19 @@
</textFieldCell>
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<tableCellView identifier="Cell" id="ZA5-gH-T6I">
<tableCellView identifier="Cell" id="h2e-5a-qNO">
<rect key="frame" x="1" y="1" width="116" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="2hE-gk-uTf">
<rect key="frame" x="0.0" y="0.0" width="116" height="17"/>
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="27f-p8-Wnt">
<rect key="frame" x="3" y="0.0" width="17" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="NSActionTemplate" id="lKA-xK-bHU"/>
</imageView>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" allowsExpansionToolTips="YES" translatesAutoresizingMaskIntoConstraints="NO" id="hR2-bm-0wE">
<rect key="frame" x="25" y="0.0" width="91" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="tMr-Ok-LFl">
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="CcS-BO-sdv">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
@ -298,7 +303,8 @@
</textField>
</subviews>
<connections>
<outlet property="textField" destination="2hE-gk-uTf" id="OeM-bv-DDy"/>
<outlet property="imageView" destination="27f-p8-Wnt" id="isa-a7-64p"/>
<outlet property="textField" destination="hR2-bm-0wE" id="g2q-ln-SHx"/>
</connections>
</tableCellView>
</prototypeCellViews>
@ -398,6 +404,7 @@
</scene>
</scenes>
<resources>
<image name="NSActionTemplate" width="14" height="14"/>
<image name="NSAddTemplate" width="11" height="11"/>
<image name="NSRemoveTemplate" width="11" height="11"/>
</resources>

View File

@ -5,7 +5,7 @@
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="LocalAccountPreferencesViewController" customModule="NetNewsWire" customModuleProvider="target">
<customObject id="-2" userLabel="File's Owner" customClass="AccountDetailViewController" customModule="NetNewsWire" customModuleProvider="target">
<connections>
<outlet property="nameTextField" destination="TT0-Kf-YTC" id="oMG-jn-Qn0"/>
<outlet property="typeLabel" destination="XYX-iz-hnq" id="SKM-et-3h3"/>

View File

@ -9,7 +9,7 @@
import AppKit
import Account
final class LocalAccountPreferencesViewController: NSViewController, NSTextFieldDelegate {
final class AccountDetailViewController: NSViewController, NSTextFieldDelegate {
@IBOutlet weak var typeLabel: NSTextField!
@IBOutlet weak var nameTextField: NSTextField!
@ -17,7 +17,7 @@ final class LocalAccountPreferencesViewController: NSViewController, NSTextField
private weak var account: Account?
init(account: Account) {
super.init(nibName: "LocalAccount", bundle: nil)
super.init(nibName: "AccountDetail", bundle: nil)
self.account = account
}

View File

@ -58,7 +58,16 @@ extension AccountsPreferencesViewController: NSTableViewDelegate {
func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? {
if let cell = tableView.makeView(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: "Cell"), owner: nil) as? NSTableCellView {
cell.textField?.stringValue = sortedAccounts[row].nameForDisplay
let account = sortedAccounts[row]
cell.textField?.stringValue = account.nameForDisplay
switch account.type {
case .onMyMac:
cell.imageView?.image = AppImages.accountLocal
case .feedbin:
cell.imageView?.image = NSImage(named: "accountFeedbin")
default:
break
}
return cell
}
return nil
@ -73,7 +82,7 @@ extension AccountsPreferencesViewController: NSTableViewDelegate {
let account = sortedAccounts[selectedRow]
let controller = LocalAccountPreferencesViewController(account: account)
let controller = AccountDetailViewController(account: account)
addChild(controller)
controller.view.translatesAutoresizingMaskIntoConstraints = false
detailView.addSubview(controller.view)

View File

@ -0,0 +1,12 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "accountFeedbin.pdf"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@ -0,0 +1,12 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "accountLocal.pdf"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@ -112,6 +112,7 @@
51EF0F7C2277919E0050506E /* TimelineNumberOfLinesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51EF0F7B2277919E0050506E /* TimelineNumberOfLinesViewController.swift */; };
51EF0F7E2277A57D0050506E /* MasterTimelineAccessibilityCellLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51EF0F7D2277A57D0050506E /* MasterTimelineAccessibilityCellLayout.swift */; };
51EF0F802277A8330050506E /* MasterTimelineCellLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51EF0F7F2277A8330050506E /* MasterTimelineCellLayout.swift */; };
51EF0F8C2279BEEB0050506E /* AccountDetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51EF0F8B2279BEEB0050506E /* AccountDetailViewController.swift */; };
51F85BE5227217D000C787DC /* RefreshIntervalViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51F85BDB2272162F00C787DC /* RefreshIntervalViewController.swift */; };
51F85BE7227245FC00C787DC /* AboutViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51F85BE6227245FC00C787DC /* AboutViewController.swift */; };
51F85BEB22724CB600C787DC /* About.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 51F85BEA22724CB600C787DC /* About.rtf */; };
@ -238,8 +239,7 @@
84C9FC7A22629E1200D921D6 /* AccountsTableViewBackgroundView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84C9FC7022629E1200D921D6 /* AccountsTableViewBackgroundView.swift */; };
84C9FC7B22629E1200D921D6 /* AccountsControlsBackgroundView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84C9FC7122629E1200D921D6 /* AccountsControlsBackgroundView.swift */; };
84C9FC7C22629E1200D921D6 /* AccountsPreferencesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84C9FC7222629E1200D921D6 /* AccountsPreferencesViewController.swift */; };
84C9FC7D22629E1200D921D6 /* LocalAccount.xib in Resources */ = {isa = PBXBuildFile; fileRef = 84C9FC7422629E1200D921D6 /* LocalAccount.xib */; };
84C9FC7E22629E1200D921D6 /* LocalAccountPreferencesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84C9FC7522629E1200D921D6 /* LocalAccountPreferencesViewController.swift */; };
84C9FC7D22629E1200D921D6 /* AccountDetail.xib in Resources */ = {isa = PBXBuildFile; fileRef = 84C9FC7422629E1200D921D6 /* AccountDetail.xib */; };
84C9FC8222629E4800D921D6 /* Preferences.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 84C9FC8022629E4800D921D6 /* Preferences.storyboard */; };
84C9FC8C22629E8F00D921D6 /* KeyboardShortcuts.html in Resources */ = {isa = PBXBuildFile; fileRef = 84C9FC8722629E8F00D921D6 /* KeyboardShortcuts.html */; };
84C9FC8D22629E8F00D921D6 /* EvergreenLarge.png in Resources */ = {isa = PBXBuildFile; fileRef = 84C9FC8822629E8F00D921D6 /* EvergreenLarge.png */; };
@ -672,6 +672,7 @@
51EF0F7B2277919E0050506E /* TimelineNumberOfLinesViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimelineNumberOfLinesViewController.swift; sourceTree = "<group>"; };
51EF0F7D2277A57D0050506E /* MasterTimelineAccessibilityCellLayout.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MasterTimelineAccessibilityCellLayout.swift; sourceTree = "<group>"; };
51EF0F7F2277A8330050506E /* MasterTimelineCellLayout.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MasterTimelineCellLayout.swift; sourceTree = "<group>"; };
51EF0F8B2279BEEB0050506E /* AccountDetailViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AccountDetailViewController.swift; sourceTree = "<group>"; };
51F85BDB2272162F00C787DC /* RefreshIntervalViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RefreshIntervalViewController.swift; sourceTree = "<group>"; };
51F85BE6227245FC00C787DC /* AboutViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AboutViewController.swift; sourceTree = "<group>"; };
51F85BEA22724CB600C787DC /* About.rtf */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; path = About.rtf; sourceTree = "<group>"; };
@ -805,8 +806,7 @@
84C9FC7022629E1200D921D6 /* AccountsTableViewBackgroundView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AccountsTableViewBackgroundView.swift; sourceTree = "<group>"; };
84C9FC7122629E1200D921D6 /* AccountsControlsBackgroundView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AccountsControlsBackgroundView.swift; sourceTree = "<group>"; };
84C9FC7222629E1200D921D6 /* AccountsPreferencesViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AccountsPreferencesViewController.swift; sourceTree = "<group>"; };
84C9FC7422629E1200D921D6 /* LocalAccount.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = LocalAccount.xib; sourceTree = "<group>"; };
84C9FC7522629E1200D921D6 /* LocalAccountPreferencesViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LocalAccountPreferencesViewController.swift; sourceTree = "<group>"; };
84C9FC7422629E1200D921D6 /* AccountDetail.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = AccountDetail.xib; sourceTree = "<group>"; };
84C9FC8122629E4800D921D6 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Mac/Base.lproj/Preferences.storyboard; sourceTree = SOURCE_ROOT; };
84C9FC8722629E8F00D921D6 /* KeyboardShortcuts.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = KeyboardShortcuts.html; sourceTree = "<group>"; };
84C9FC8822629E8F00D921D6 /* EvergreenLarge.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = EvergreenLarge.png; sourceTree = "<group>"; };
@ -1559,20 +1559,12 @@
84C9FC7022629E1200D921D6 /* AccountsTableViewBackgroundView.swift */,
84C9FC7122629E1200D921D6 /* AccountsControlsBackgroundView.swift */,
84C9FC7222629E1200D921D6 /* AccountsPreferencesViewController.swift */,
84C9FC7322629E1200D921D6 /* Local */,
84C9FC7422629E1200D921D6 /* AccountDetail.xib */,
51EF0F8B2279BEEB0050506E /* AccountDetailViewController.swift */,
);
path = Accounts;
sourceTree = "<group>";
};
84C9FC7322629E1200D921D6 /* Local */ = {
isa = PBXGroup;
children = (
84C9FC7422629E1200D921D6 /* LocalAccount.xib */,
84C9FC7522629E1200D921D6 /* LocalAccountPreferencesViewController.swift */,
);
path = Local;
sourceTree = "<group>";
};
84C9FC8322629E8F00D921D6 /* Resources */ = {
isa = PBXGroup;
children = (
@ -2162,7 +2154,7 @@
848362FF2262A30E00DA1D35 /* template.html in Resources */,
848363082262A3DD00DA1D35 /* Main.storyboard in Resources */,
84C9FC8F22629E8F00D921D6 /* NetNewsWire.sdef in Resources */,
84C9FC7D22629E1200D921D6 /* LocalAccount.xib in Resources */,
84C9FC7D22629E1200D921D6 /* AccountDetail.xib in Resources */,
84C9FC8C22629E8F00D921D6 /* KeyboardShortcuts.html in Resources */,
844B5B691FEA20DF00C7C76A /* SidebarKeyboardShortcuts.plist in Resources */,
84A3EE5F223B667F00557320 /* DefaultFeeds.opml in Resources */,
@ -2388,7 +2380,6 @@
849A97791ED9EC04007D329B /* TimelineStringFormatter.swift in Sources */,
84E185C3203BB12600F69BFA /* MultilineTextFieldSizer.swift in Sources */,
8477ACBE22238E9500DF7F37 /* SearchFeedDelegate.swift in Sources */,
84C9FC7E22629E1200D921D6 /* LocalAccountPreferencesViewController.swift in Sources */,
8472058120142E8900AD578B /* FeedInspectorViewController.swift in Sources */,
84AD1EAA2031617300BC20B7 /* FolderPasteboardWriter.swift in Sources */,
84AD1EBC2032AF5C00BC20B7 /* SidebarOutlineDataSource.swift in Sources */,
@ -2407,6 +2398,7 @@
84F2D5381FC22FCC00998D64 /* TodayFeedDelegate.swift in Sources */,
841ABA5E20145E9200980E11 /* FolderInspectorViewController.swift in Sources */,
845213231FCA5B11003B6E93 /* ImageDownloader.swift in Sources */,
51EF0F8C2279BEEB0050506E /* AccountDetailViewController.swift in Sources */,
849A97431ED9EAA9007D329B /* AddFolderWindowController.swift in Sources */,
8405DDA522168C62008CE1BF /* TimelineContainerViewController.swift in Sources */,
844B5B671FEA18E300C7C76A /* MainWIndowKeyboardHandler.swift in Sources */,