Clean up the ROM manager a little bit more.

This commit is contained in:
Kelvin Sherlock 2020-09-03 23:34:03 -04:00
parent ebdf8b9395
commit 8b2f4c762b
3 changed files with 52 additions and 40 deletions

View File

@ -14,60 +14,47 @@
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window title="Downloads" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="F0z-JX-Cv5">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="196" y="240" width="480" height="458"/>
<window title="ROMs" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="F0z-JX-Cv5">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES"/>
<rect key="contentRect" x="196" y="240" width="400" height="500"/>
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1417"/>
<value key="minSize" type="size" width="300" height="300"/>
<view key="contentView" id="se5-gp-TjO">
<rect key="frame" x="0.0" y="0.0" width="480" height="458"/>
<rect key="frame" x="0.0" y="0.0" width="400" height="500"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="rg5-Qf-4Mw">
<rect key="frame" x="404" y="19" width="56" height="23"/>
<rect key="frame" x="324" y="19" width="56" height="23"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
<buttonCell key="cell" type="roundTextured" title="Cancel" bezelStyle="texturedRounded" alignment="center" lineBreakMode="truncatingTail" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="i6Z-OM-lqE">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
<string key="keyEquivalent">.</string>
<modifierMask key="keyEquivalentModifierMask" command="YES"/>
<connections>
<binding destination="-2" name="enabled" keyPath="self.active" id="mBP-8S-yGB"/>
</connections>
</buttonCell>
<connections>
<action selector="cancelAll:" target="-2" id="ycl-eJ-ByB"/>
</connections>
</button>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="MWc-ih-Sp1">
<rect key="frame" x="20" y="105" width="442" height="16"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" lineBreakMode="clipping" title="Downloading" id="dZt-4d-PYZ">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<connections>
<binding destination="-2" name="displayPatternValue1" keyPath="self.currentROM" id="FsR-wQ-zks">
<dictionary key="options">
<string key="NSDisplayPattern">Downloading %{value1}@</string>
</dictionary>
</binding>
</connections>
</textField>
<scrollView fixedFrame="YES" autohidesScrollers="YES" horizontalLineScroll="19" horizontalPageScroll="10" verticalLineScroll="19" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="CMD-nT-mEa">
<rect key="frame" x="0.0" y="129" width="482" height="330"/>
<rect key="frame" x="0.0" y="58" width="402" height="443"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<clipView key="contentView" ambiguous="YES" drawsBackground="NO" id="Igp-aH-flp">
<rect key="frame" x="1" y="1" width="480" height="328"/>
<rect key="frame" x="1" y="1" width="400" height="441"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView verticalHuggingPriority="750" ambiguous="YES" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" selectionHighlightStyle="none" alternatingRowBackgroundColors="YES" columnReordering="NO" columnResizing="NO" multipleSelection="NO" autosaveColumns="NO" rowSizeStyle="automatic" viewBased="YES" id="FLX-Wt-y53">
<rect key="frame" x="0.0" y="0.0" width="480" height="328"/>
<rect key="frame" x="0.0" y="0.0" width="400" height="441"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<size key="intercellSpacing" width="3" height="2"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
<tableViewGridLines key="gridStyleMask" dashed="YES"/>
<color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
<tableColumns>
<tableColumn width="477" minWidth="40" maxWidth="1000" id="5jP-bY-fhI">
<tableColumn width="397" minWidth="40" maxWidth="1000" id="5jP-bY-fhI">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
@ -81,11 +68,11 @@
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES"/>
<prototypeCellViews>
<tableCellView identifier="Cell" focusRingType="none" id="aBv-F5-XWo">
<rect key="frame" x="1" y="1" width="477" height="17"/>
<rect key="frame" x="1" y="1" width="397" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="pWm-hb-BXB">
<rect key="frame" x="0.0" y="0.0" width="477" height="17"/>
<rect key="frame" x="0.0" y="0.0" width="397" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="p71-gJ-vFV">
<font key="font" metaFont="system"/>
@ -99,11 +86,11 @@
</connections>
</tableCellView>
<tableCellView identifier="DownloadCell" focusRingType="none" id="onK-6l-2iV" customClass="DownloadTableCellView">
<rect key="frame" x="1" y="20" width="477" height="49"/>
<rect key="frame" x="1" y="20" width="397" height="49"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="A44-us-TEl">
<rect key="frame" x="25" y="28" width="451" height="17"/>
<rect key="frame" x="25" y="28" width="371" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="NSU-6I-nsG">
<font key="font" metaFont="system"/>
@ -116,7 +103,7 @@
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
</progressIndicator>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="hfu-hP-QAH">
<rect key="frame" x="25" y="3" width="451" height="17"/>
<rect key="frame" x="25" y="3" width="371" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="1cQ-Zh-q0o">
<font key="font" metaFont="system"/>
@ -152,14 +139,22 @@
<autoresizingMask key="autoresizingMask"/>
</scroller>
</scrollView>
<progressIndicator wantsLayer="YES" fixedFrame="YES" maxValue="100" style="bar" translatesAutoresizingMaskIntoConstraints="NO" id="Odp-OZ-ggl">
<rect key="frame" x="22" y="78" width="438" height="20"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Fhd-vr-Q2G">
<rect key="frame" x="20" y="19" width="124" height="23"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<buttonCell key="cell" type="roundTextured" title="Download Missing" bezelStyle="texturedRounded" alignment="center" lineBreakMode="truncatingTail" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="AKx-eg-iLS">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<binding destination="-2" name="maxValue" keyPath="self.totalCount" id="hpx-zN-odo"/>
<binding destination="-2" name="value" keyPath="self.currentCount" previousBinding="hpx-zN-odo" id="dd9-45-gfI"/>
<action selector="downloadMissing:" target="-2" id="azE-F0-5wx"/>
<binding destination="-2" name="enabled" keyPath="self.active" id="NOL-Db-hgp">
<dictionary key="options">
<string key="NSValueTransformerName">NSNegateBoolean</string>
</dictionary>
</binding>
</connections>
</progressIndicator>
</button>
</subviews>
</view>
<connections>

View File

@ -31,7 +31,7 @@
<action selector="orderFrontStandardAboutPanel:" target="-1" id="Exp-CZ-Vem"/>
</connections>
</menuItem>
<menuItem title="Download ROMs…" id="St3-qR-2Y8">
<menuItem title="Manage ROMs…" id="St3-qR-2Y8">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="downloadROMS:" target="Voe-Tx-rLC" id="jFm-nv-kRC"/>

View File

@ -202,6 +202,24 @@ enum {
//[_tableView setNeedsDisplay: YES]; // doesn't work...
}
- (IBAction)downloadMissing:(id)sender {
BOOL delta = NO;
for (DownloadItem *item in _items) {
NSURL *url = [item localURL];
id task = [item task];
if (!url && !task) {
[self downloadItem: item];
delta = YES;
}
}
if (delta) {
[self setActive: YES];
[_tableView reloadData];
}
}
- (IBAction)showInFinder:(id)sender {
DownloadItem *item = [self clickedItem];
if (!item) return;
@ -217,6 +235,7 @@ enum {
if (!item) return;
[self downloadItem: item];
[self setActive: YES];
[self redrawRow: [item index]];
}
- (IBAction)cancel:(id)sender {
@ -300,8 +319,6 @@ enum {
- (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row {
if (row == 51) { NSLog(@"viewForRow 51");}
DownloadItem *item = [_items objectAtIndex: row];
DownloadTableCellView *v = [tableView makeViewWithIdentifier: @"DownloadCell" owner: self];