ample/Ample/SoftwareList.m

673 lines
18 KiB
Mathematica
Raw Normal View History

2021-03-28 22:50:55 +00:00
//
// SoftwareList.m
// Ample
//
// Created by Kelvin Sherlock on 1/30/2021.
// Copyright © 2021 Kelvin Sherlock. All rights reserved.
//
#import <Foundation/Foundation.h>
Squashed commit of the following: commit 1dd1d6d3eee928d283dafbaf4432b053dff65ac2 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Thu May 27 13:30:38 2021 -0400 0.232 rom update commit cfb7f9a4d1647c41fab3328bada0f37bdb041983 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Wed May 26 20:31:16 2021 -0400 fix resizing to prevent horizontal scrolling commit 5c393ab5a95c9e53c4ef1e0b3f2b77db93e1c29b Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Wed May 26 20:01:48 2021 -0400 esc should close the menu if visible, otherwise clear the text. commit 7da142b64280c39e216584cedb7fb14243d573f0 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:17:10 2021 -0400 show software short name unless it's ambiguous. commit 6f3b3bef5e18e78619959613e28064eb6251ce27 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:16:47 2021 -0400 cleanup some auto complete rough edges commit 4988d8b266b8b11e519bcb5aab05ad2c3ffe5c23 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:16:24 2021 -0400 fix commit 6d4bf94fd6b4850564b705ea15e91079b00346c2 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 19:13:28 2021 -0400 clean up autocomplete a little... commit 3722271e51d93599903bccc721dc1de61f0aae72 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 19:13:07 2021 -0400 move auto complete logic to SoftwareSet commit 04cc83ecbe9ee4c9100305712c47a11359327734 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 20:46:39 2021 -0400 software - keep the list name to differentiate in case of name clashes. commit 8e5b5dc7e283f760a16011308298e999110fc052 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 20:45:13 2021 -0400 Autocomplete - limit menu content width to the clip view content width. prevents horizontal scrolling. commit 356048d450447485bb33a4261018f85dac19a134 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:45:42 2021 -0400 add auto complete software list to the launch window. commit 9dc72b702c9b36d490349f291c10b98b56178567 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:44:28 2021 -0400 autocomplete control. commit 40eee83f56d957c64e0f8d927486f13165b9e120 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:39:32 2021 -0400 add filters to software list. commit cebfbaa545441f061cffafe8ca93db2377240a06 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun May 23 11:59:00 2021 -0400 add compatibility field for software list filtering.
2021-05-27 23:42:28 +00:00
#include <wctype.h>
2021-03-28 22:50:55 +00:00
Squashed commit of the following: commit 1dd1d6d3eee928d283dafbaf4432b053dff65ac2 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Thu May 27 13:30:38 2021 -0400 0.232 rom update commit cfb7f9a4d1647c41fab3328bada0f37bdb041983 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Wed May 26 20:31:16 2021 -0400 fix resizing to prevent horizontal scrolling commit 5c393ab5a95c9e53c4ef1e0b3f2b77db93e1c29b Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Wed May 26 20:01:48 2021 -0400 esc should close the menu if visible, otherwise clear the text. commit 7da142b64280c39e216584cedb7fb14243d573f0 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:17:10 2021 -0400 show software short name unless it's ambiguous. commit 6f3b3bef5e18e78619959613e28064eb6251ce27 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:16:47 2021 -0400 cleanup some auto complete rough edges commit 4988d8b266b8b11e519bcb5aab05ad2c3ffe5c23 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:16:24 2021 -0400 fix commit 6d4bf94fd6b4850564b705ea15e91079b00346c2 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 19:13:28 2021 -0400 clean up autocomplete a little... commit 3722271e51d93599903bccc721dc1de61f0aae72 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 19:13:07 2021 -0400 move auto complete logic to SoftwareSet commit 04cc83ecbe9ee4c9100305712c47a11359327734 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 20:46:39 2021 -0400 software - keep the list name to differentiate in case of name clashes. commit 8e5b5dc7e283f760a16011308298e999110fc052 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 20:45:13 2021 -0400 Autocomplete - limit menu content width to the clip view content width. prevents horizontal scrolling. commit 356048d450447485bb33a4261018f85dac19a134 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:45:42 2021 -0400 add auto complete software list to the launch window. commit 9dc72b702c9b36d490349f291c10b98b56178567 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:44:28 2021 -0400 autocomplete control. commit 40eee83f56d957c64e0f8d927486f13165b9e120 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:39:32 2021 -0400 add filters to software list. commit cebfbaa545441f061cffafe8ca93db2377240a06 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun May 23 11:59:00 2021 -0400 add compatibility field for software list filtering.
2021-05-27 23:42:28 +00:00
#include "Ample.h"
2021-03-28 22:50:55 +00:00
#import "SoftwareList.h"
@implementation Software
Squashed commit of the following: commit 1dd1d6d3eee928d283dafbaf4432b053dff65ac2 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Thu May 27 13:30:38 2021 -0400 0.232 rom update commit cfb7f9a4d1647c41fab3328bada0f37bdb041983 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Wed May 26 20:31:16 2021 -0400 fix resizing to prevent horizontal scrolling commit 5c393ab5a95c9e53c4ef1e0b3f2b77db93e1c29b Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Wed May 26 20:01:48 2021 -0400 esc should close the menu if visible, otherwise clear the text. commit 7da142b64280c39e216584cedb7fb14243d573f0 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:17:10 2021 -0400 show software short name unless it's ambiguous. commit 6f3b3bef5e18e78619959613e28064eb6251ce27 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:16:47 2021 -0400 cleanup some auto complete rough edges commit 4988d8b266b8b11e519bcb5aab05ad2c3ffe5c23 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:16:24 2021 -0400 fix commit 6d4bf94fd6b4850564b705ea15e91079b00346c2 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 19:13:28 2021 -0400 clean up autocomplete a little... commit 3722271e51d93599903bccc721dc1de61f0aae72 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 19:13:07 2021 -0400 move auto complete logic to SoftwareSet commit 04cc83ecbe9ee4c9100305712c47a11359327734 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 20:46:39 2021 -0400 software - keep the list name to differentiate in case of name clashes. commit 8e5b5dc7e283f760a16011308298e999110fc052 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 20:45:13 2021 -0400 Autocomplete - limit menu content width to the clip view content width. prevents horizontal scrolling. commit 356048d450447485bb33a4261018f85dac19a134 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:45:42 2021 -0400 add auto complete software list to the launch window. commit 9dc72b702c9b36d490349f291c10b98b56178567 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:44:28 2021 -0400 autocomplete control. commit 40eee83f56d957c64e0f8d927486f13165b9e120 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:39:32 2021 -0400 add filters to software list. commit cebfbaa545441f061cffafe8ca93db2377240a06 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun May 23 11:59:00 2021 -0400 add compatibility field for software list filtering.
2021-05-27 23:42:28 +00:00
-(BOOL)filter: (NSString *)filter {
if (!_compatibility || ![_compatibility length]) return YES;
unichar *needle;
unichar *haystack;
NSUInteger needle_length;
NSUInteger haystack_length;
BOOL ok = NO;
haystack_length = [_compatibility length];
if (!haystack_length) return YES;
needle_length = [filter length];
if (!needle_length) return NO;
if (needle_length > haystack_length) return NO;
haystack = malloc((haystack_length + 1) * sizeof(unichar));
[_compatibility getCharacters: haystack range: NSMakeRange(0, haystack_length)];
needle = malloc((needle_length + 1) * sizeof(unichar));
[filter getCharacters: needle range: NSMakeRange(0, needle_length)];
haystack[haystack_length] = 0;
needle[needle_length] = 0;
NSUInteger i = 0;
unichar c;
do {
if (!memcmp(needle, haystack + i, sizeof(unichar) * needle_length)) {
i += needle_length;
c = haystack[i];
if (c == ',' || c == 0) { ok = YES; break; }
}
do {
c = haystack[i++];
} while ( c && c != ',');
} while (c);
free(needle);
free(haystack);
return ok;
}
- (nonnull NSAttributedString *)menuAttributedTitle {
return nil;
}
- (BOOL)menuEnabled {
return YES;
}
- (BOOL)menuIsHeader {
return NO;
}
- (nonnull NSString *)menuTitle {
return _title;
}
-(NSString *)fullName {
if (![_list length]) return _name;
return [NSString stringWithFormat: @"%@:%@", _list, _name];
}
2021-03-28 22:50:55 +00:00
@end
@implementation SoftwareList
Squashed commit of the following: commit 1dd1d6d3eee928d283dafbaf4432b053dff65ac2 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Thu May 27 13:30:38 2021 -0400 0.232 rom update commit cfb7f9a4d1647c41fab3328bada0f37bdb041983 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Wed May 26 20:31:16 2021 -0400 fix resizing to prevent horizontal scrolling commit 5c393ab5a95c9e53c4ef1e0b3f2b77db93e1c29b Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Wed May 26 20:01:48 2021 -0400 esc should close the menu if visible, otherwise clear the text. commit 7da142b64280c39e216584cedb7fb14243d573f0 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:17:10 2021 -0400 show software short name unless it's ambiguous. commit 6f3b3bef5e18e78619959613e28064eb6251ce27 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:16:47 2021 -0400 cleanup some auto complete rough edges commit 4988d8b266b8b11e519bcb5aab05ad2c3ffe5c23 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:16:24 2021 -0400 fix commit 6d4bf94fd6b4850564b705ea15e91079b00346c2 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 19:13:28 2021 -0400 clean up autocomplete a little... commit 3722271e51d93599903bccc721dc1de61f0aae72 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 19:13:07 2021 -0400 move auto complete logic to SoftwareSet commit 04cc83ecbe9ee4c9100305712c47a11359327734 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 20:46:39 2021 -0400 software - keep the list name to differentiate in case of name clashes. commit 8e5b5dc7e283f760a16011308298e999110fc052 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 20:45:13 2021 -0400 Autocomplete - limit menu content width to the clip view content width. prevents horizontal scrolling. commit 356048d450447485bb33a4261018f85dac19a134 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:45:42 2021 -0400 add auto complete software list to the launch window. commit 9dc72b702c9b36d490349f291c10b98b56178567 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:44:28 2021 -0400 autocomplete control. commit 40eee83f56d957c64e0f8d927486f13165b9e120 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:39:32 2021 -0400 add filters to software list. commit cebfbaa545441f061cffafe8ca93db2377240a06 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun May 23 11:59:00 2021 -0400 add compatibility field for software list filtering.
2021-05-27 23:42:28 +00:00
-(SoftwareList *)filter: (NSString *)filter {
unichar *needle = NULL;
__block unichar *haystack = NULL;
NSUInteger needle_length = 0;
__block NSUInteger max_haystack_length = 0;
needle_length = [filter length];
if (!needle_length) return self;
needle = malloc(needle_length * sizeof(unichar) + sizeof(unichar));
[filter getCharacters: needle range: NSMakeRange(0, needle_length)];
needle[needle_length] = 0;
max_haystack_length = 127;
haystack = malloc(max_haystack_length * sizeof(unichar) + sizeof(unichar));
NSPredicate *p = [NSPredicate predicateWithBlock: ^BOOL(Software *o, NSDictionary *bindings){
NSString *s = [o compatibility];
NSUInteger length = [s length];
if (length == 0) return YES;
if (length < needle_length) return NO;
if (length > max_haystack_length) {
max_haystack_length = length;
haystack = realloc(haystack, sizeof(unichar ) * length + sizeof(unichar));
}
[s getCharacters: haystack range: NSMakeRange(0, length)];
haystack[length] = 0;
NSUInteger i = 0;
unichar c;
do {
if (!memcmp(needle, haystack + i, sizeof(unichar) * needle_length)) {
i += needle_length;
c = haystack[i];
if (c == ',' || c == 0) return YES;
}
do {
c = haystack[i++];
} while ( c && c != ',');
} while (c);
return NO;
}];
NSArray *items = [_items filteredArrayUsingPredicate: p];
free(needle);
free(haystack);
if ([items count] == [_items count]) return self;
SoftwareList *rv = [SoftwareList new];
[rv setItems: items];
[rv setName: _name];
[rv setTitle: _title];
return rv;
}
- (nonnull NSAttributedString *)menuAttributedTitle {
return nil;
}
- (BOOL)menuEnabled {
return NO;
}
- (BOOL)menuIsHeader {
return YES;
}
- (nonnull NSString *)menuTitle {
return _title;
}
2021-03-28 22:50:55 +00:00
@end
Squashed commit of the following: commit 1dd1d6d3eee928d283dafbaf4432b053dff65ac2 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Thu May 27 13:30:38 2021 -0400 0.232 rom update commit cfb7f9a4d1647c41fab3328bada0f37bdb041983 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Wed May 26 20:31:16 2021 -0400 fix resizing to prevent horizontal scrolling commit 5c393ab5a95c9e53c4ef1e0b3f2b77db93e1c29b Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Wed May 26 20:01:48 2021 -0400 esc should close the menu if visible, otherwise clear the text. commit 7da142b64280c39e216584cedb7fb14243d573f0 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:17:10 2021 -0400 show software short name unless it's ambiguous. commit 6f3b3bef5e18e78619959613e28064eb6251ce27 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:16:47 2021 -0400 cleanup some auto complete rough edges commit 4988d8b266b8b11e519bcb5aab05ad2c3ffe5c23 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:16:24 2021 -0400 fix commit 6d4bf94fd6b4850564b705ea15e91079b00346c2 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 19:13:28 2021 -0400 clean up autocomplete a little... commit 3722271e51d93599903bccc721dc1de61f0aae72 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 19:13:07 2021 -0400 move auto complete logic to SoftwareSet commit 04cc83ecbe9ee4c9100305712c47a11359327734 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 20:46:39 2021 -0400 software - keep the list name to differentiate in case of name clashes. commit 8e5b5dc7e283f760a16011308298e999110fc052 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 20:45:13 2021 -0400 Autocomplete - limit menu content width to the clip view content width. prevents horizontal scrolling. commit 356048d450447485bb33a4261018f85dac19a134 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:45:42 2021 -0400 add auto complete software list to the launch window. commit 9dc72b702c9b36d490349f291c10b98b56178567 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:44:28 2021 -0400 autocomplete control. commit 40eee83f56d957c64e0f8d927486f13165b9e120 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:39:32 2021 -0400 add filters to software list. commit cebfbaa545441f061cffafe8ca93db2377240a06 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun May 23 11:59:00 2021 -0400 add compatibility field for software list filtering.
2021-05-27 23:42:28 +00:00
2021-03-28 22:50:55 +00:00
@interface SoftwareListDelegate : NSObject<NSXMLParserDelegate> {
unsigned _state;
NSString *_name;
NSString *_description;
Squashed commit of the following: commit 1dd1d6d3eee928d283dafbaf4432b053dff65ac2 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Thu May 27 13:30:38 2021 -0400 0.232 rom update commit cfb7f9a4d1647c41fab3328bada0f37bdb041983 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Wed May 26 20:31:16 2021 -0400 fix resizing to prevent horizontal scrolling commit 5c393ab5a95c9e53c4ef1e0b3f2b77db93e1c29b Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Wed May 26 20:01:48 2021 -0400 esc should close the menu if visible, otherwise clear the text. commit 7da142b64280c39e216584cedb7fb14243d573f0 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:17:10 2021 -0400 show software short name unless it's ambiguous. commit 6f3b3bef5e18e78619959613e28064eb6251ce27 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:16:47 2021 -0400 cleanup some auto complete rough edges commit 4988d8b266b8b11e519bcb5aab05ad2c3ffe5c23 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:16:24 2021 -0400 fix commit 6d4bf94fd6b4850564b705ea15e91079b00346c2 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 19:13:28 2021 -0400 clean up autocomplete a little... commit 3722271e51d93599903bccc721dc1de61f0aae72 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 19:13:07 2021 -0400 move auto complete logic to SoftwareSet commit 04cc83ecbe9ee4c9100305712c47a11359327734 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 20:46:39 2021 -0400 software - keep the list name to differentiate in case of name clashes. commit 8e5b5dc7e283f760a16011308298e999110fc052 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 20:45:13 2021 -0400 Autocomplete - limit menu content width to the clip view content width. prevents horizontal scrolling. commit 356048d450447485bb33a4261018f85dac19a134 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:45:42 2021 -0400 add auto complete software list to the launch window. commit 9dc72b702c9b36d490349f291c10b98b56178567 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:44:28 2021 -0400 autocomplete control. commit 40eee83f56d957c64e0f8d927486f13165b9e120 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:39:32 2021 -0400 add filters to software list. commit cebfbaa545441f061cffafe8ca93db2377240a06 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun May 23 11:59:00 2021 -0400 add compatibility field for software list filtering.
2021-05-27 23:42:28 +00:00
NSString *_compatibility;
2021-03-28 22:50:55 +00:00
NSMutableArray *_array;
SoftwareList *_list;
}
-(SoftwareList *)list;
@end
@implementation SoftwareListDelegate
-(SoftwareList *)list;{
return _list;
}
-(void)parserDidStartDocument:(NSXMLParser *)parser {
_array = [NSMutableArray new];
_list = [SoftwareList new];
_state = 0;
}
/*
The parts we care about:
2021-07-11 03:34:00 +00:00
2021-03-28 22:50:55 +00:00
<softwarelist name="" description="">
<software name="">
<description>...</description>
</software>
...
</softwarelist>
*/
-(void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary<NSString *,NSString *> *)attributeDict {
if ([@"softwarelist" isEqualToString: elementName]) {
if (_state == 0b0000) {
_state = 0b0001;
NSString *name = [attributeDict objectForKey: @"name"];
NSString *description = [attributeDict objectForKey: @"description"];
if (!description) description = name;
[_list setTitle: description];
[_list setName: name];
}
return;
}
if ([@"software" isEqualToString: elementName]) {
if (_state == 0b0001) {
_name = [attributeDict objectForKey: @"name"];
_state |= 0b0010;
}
return;
}
if ([@"description" isEqualToString: elementName]) {
if (_state == 0b0011) {
_state |= 0b0100;
}
return;
}
Squashed commit of the following: commit 1dd1d6d3eee928d283dafbaf4432b053dff65ac2 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Thu May 27 13:30:38 2021 -0400 0.232 rom update commit cfb7f9a4d1647c41fab3328bada0f37bdb041983 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Wed May 26 20:31:16 2021 -0400 fix resizing to prevent horizontal scrolling commit 5c393ab5a95c9e53c4ef1e0b3f2b77db93e1c29b Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Wed May 26 20:01:48 2021 -0400 esc should close the menu if visible, otherwise clear the text. commit 7da142b64280c39e216584cedb7fb14243d573f0 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:17:10 2021 -0400 show software short name unless it's ambiguous. commit 6f3b3bef5e18e78619959613e28064eb6251ce27 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:16:47 2021 -0400 cleanup some auto complete rough edges commit 4988d8b266b8b11e519bcb5aab05ad2c3ffe5c23 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:16:24 2021 -0400 fix commit 6d4bf94fd6b4850564b705ea15e91079b00346c2 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 19:13:28 2021 -0400 clean up autocomplete a little... commit 3722271e51d93599903bccc721dc1de61f0aae72 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 19:13:07 2021 -0400 move auto complete logic to SoftwareSet commit 04cc83ecbe9ee4c9100305712c47a11359327734 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 20:46:39 2021 -0400 software - keep the list name to differentiate in case of name clashes. commit 8e5b5dc7e283f760a16011308298e999110fc052 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 20:45:13 2021 -0400 Autocomplete - limit menu content width to the clip view content width. prevents horizontal scrolling. commit 356048d450447485bb33a4261018f85dac19a134 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:45:42 2021 -0400 add auto complete software list to the launch window. commit 9dc72b702c9b36d490349f291c10b98b56178567 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:44:28 2021 -0400 autocomplete control. commit 40eee83f56d957c64e0f8d927486f13165b9e120 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:39:32 2021 -0400 add filters to software list. commit cebfbaa545441f061cffafe8ca93db2377240a06 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun May 23 11:59:00 2021 -0400 add compatibility field for software list filtering.
2021-05-27 23:42:28 +00:00
if ([@"sharedfeat" isEqualToString: elementName]) {
if ([@"compatibility" isEqualToString: [attributeDict objectForKey: @"name"]]) {
_compatibility = [attributeDict objectForKey: @"value"];
}
}
2021-03-28 22:50:55 +00:00
}
-(void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName {
if ([@"softwarelist" isEqualToString: elementName]) {
if (_state == 0b0001) {
_state = 0b0000;
}
[_array sortUsingComparator: ^NSComparisonResult(id a, id b){
NSString *aa = [(Software *)a title];
NSString *bb = [(Software *)b title];
return [aa compare: bb];
}];
[_list setItems: _array];
_array = nil;
return;
}
if ([@"software" isEqualToString: elementName]) {
if (_state == 0b0011) {
_state &= ~0b0010;
if (_name) {
if (!_description) _description = _name;
Software *s = [Software new];
[s setTitle: _description];
[s setName: _name];
Squashed commit of the following: commit 1dd1d6d3eee928d283dafbaf4432b053dff65ac2 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Thu May 27 13:30:38 2021 -0400 0.232 rom update commit cfb7f9a4d1647c41fab3328bada0f37bdb041983 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Wed May 26 20:31:16 2021 -0400 fix resizing to prevent horizontal scrolling commit 5c393ab5a95c9e53c4ef1e0b3f2b77db93e1c29b Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Wed May 26 20:01:48 2021 -0400 esc should close the menu if visible, otherwise clear the text. commit 7da142b64280c39e216584cedb7fb14243d573f0 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:17:10 2021 -0400 show software short name unless it's ambiguous. commit 6f3b3bef5e18e78619959613e28064eb6251ce27 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:16:47 2021 -0400 cleanup some auto complete rough edges commit 4988d8b266b8b11e519bcb5aab05ad2c3ffe5c23 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:16:24 2021 -0400 fix commit 6d4bf94fd6b4850564b705ea15e91079b00346c2 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 19:13:28 2021 -0400 clean up autocomplete a little... commit 3722271e51d93599903bccc721dc1de61f0aae72 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 19:13:07 2021 -0400 move auto complete logic to SoftwareSet commit 04cc83ecbe9ee4c9100305712c47a11359327734 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 20:46:39 2021 -0400 software - keep the list name to differentiate in case of name clashes. commit 8e5b5dc7e283f760a16011308298e999110fc052 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 20:45:13 2021 -0400 Autocomplete - limit menu content width to the clip view content width. prevents horizontal scrolling. commit 356048d450447485bb33a4261018f85dac19a134 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:45:42 2021 -0400 add auto complete software list to the launch window. commit 9dc72b702c9b36d490349f291c10b98b56178567 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:44:28 2021 -0400 autocomplete control. commit 40eee83f56d957c64e0f8d927486f13165b9e120 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:39:32 2021 -0400 add filters to software list. commit cebfbaa545441f061cffafe8ca93db2377240a06 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun May 23 11:59:00 2021 -0400 add compatibility field for software list filtering.
2021-05-27 23:42:28 +00:00
[s setCompatibility: _compatibility];
[s setList: [_list name]];
2021-03-28 22:50:55 +00:00
[_array addObject: s];
}
_name = nil;
_description = nil;
Squashed commit of the following: commit 1dd1d6d3eee928d283dafbaf4432b053dff65ac2 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Thu May 27 13:30:38 2021 -0400 0.232 rom update commit cfb7f9a4d1647c41fab3328bada0f37bdb041983 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Wed May 26 20:31:16 2021 -0400 fix resizing to prevent horizontal scrolling commit 5c393ab5a95c9e53c4ef1e0b3f2b77db93e1c29b Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Wed May 26 20:01:48 2021 -0400 esc should close the menu if visible, otherwise clear the text. commit 7da142b64280c39e216584cedb7fb14243d573f0 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:17:10 2021 -0400 show software short name unless it's ambiguous. commit 6f3b3bef5e18e78619959613e28064eb6251ce27 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:16:47 2021 -0400 cleanup some auto complete rough edges commit 4988d8b266b8b11e519bcb5aab05ad2c3ffe5c23 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:16:24 2021 -0400 fix commit 6d4bf94fd6b4850564b705ea15e91079b00346c2 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 19:13:28 2021 -0400 clean up autocomplete a little... commit 3722271e51d93599903bccc721dc1de61f0aae72 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 19:13:07 2021 -0400 move auto complete logic to SoftwareSet commit 04cc83ecbe9ee4c9100305712c47a11359327734 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 20:46:39 2021 -0400 software - keep the list name to differentiate in case of name clashes. commit 8e5b5dc7e283f760a16011308298e999110fc052 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 20:45:13 2021 -0400 Autocomplete - limit menu content width to the clip view content width. prevents horizontal scrolling. commit 356048d450447485bb33a4261018f85dac19a134 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:45:42 2021 -0400 add auto complete software list to the launch window. commit 9dc72b702c9b36d490349f291c10b98b56178567 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:44:28 2021 -0400 autocomplete control. commit 40eee83f56d957c64e0f8d927486f13165b9e120 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:39:32 2021 -0400 add filters to software list. commit cebfbaa545441f061cffafe8ca93db2377240a06 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun May 23 11:59:00 2021 -0400 add compatibility field for software list filtering.
2021-05-27 23:42:28 +00:00
_compatibility = nil;
2021-03-28 22:50:55 +00:00
}
return;
}
if ([@"description" isEqualToString: elementName]) {
if (_state == 0b0111) {
_state &= ~0b0100;
}
return;
}
}
-(void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string {
if (_state == 0b0111) {
if (_description) _description = [_description stringByAppendingString: string];
else _description = string;
}
}
@end
static SoftwareList *LoadSoftwareList(NSURL *url, NSError **error) {
Squashed commit of the following: commit 1dd1d6d3eee928d283dafbaf4432b053dff65ac2 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Thu May 27 13:30:38 2021 -0400 0.232 rom update commit cfb7f9a4d1647c41fab3328bada0f37bdb041983 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Wed May 26 20:31:16 2021 -0400 fix resizing to prevent horizontal scrolling commit 5c393ab5a95c9e53c4ef1e0b3f2b77db93e1c29b Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Wed May 26 20:01:48 2021 -0400 esc should close the menu if visible, otherwise clear the text. commit 7da142b64280c39e216584cedb7fb14243d573f0 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:17:10 2021 -0400 show software short name unless it's ambiguous. commit 6f3b3bef5e18e78619959613e28064eb6251ce27 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:16:47 2021 -0400 cleanup some auto complete rough edges commit 4988d8b266b8b11e519bcb5aab05ad2c3ffe5c23 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:16:24 2021 -0400 fix commit 6d4bf94fd6b4850564b705ea15e91079b00346c2 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 19:13:28 2021 -0400 clean up autocomplete a little... commit 3722271e51d93599903bccc721dc1de61f0aae72 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 19:13:07 2021 -0400 move auto complete logic to SoftwareSet commit 04cc83ecbe9ee4c9100305712c47a11359327734 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 20:46:39 2021 -0400 software - keep the list name to differentiate in case of name clashes. commit 8e5b5dc7e283f760a16011308298e999110fc052 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 20:45:13 2021 -0400 Autocomplete - limit menu content width to the clip view content width. prevents horizontal scrolling. commit 356048d450447485bb33a4261018f85dac19a134 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:45:42 2021 -0400 add auto complete software list to the launch window. commit 9dc72b702c9b36d490349f291c10b98b56178567 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:44:28 2021 -0400 autocomplete control. commit 40eee83f56d957c64e0f8d927486f13165b9e120 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:39:32 2021 -0400 add filters to software list. commit cebfbaa545441f061cffafe8ca93db2377240a06 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun May 23 11:59:00 2021 -0400 add compatibility field for software list filtering.
2021-05-27 23:42:28 +00:00
2021-03-28 22:50:55 +00:00
NSXMLParser *p = [[NSXMLParser alloc] initWithContentsOfURL: url];
SoftwareListDelegate *d = [SoftwareListDelegate new];
[p setDelegate: d];
BOOL ok = [p parse];
if (!ok) {
if (error) *error = [p parserError];
return nil;
}
return [d list];
}
NSArray<SoftwareList *> *SoftwareListForMachine(NSString *machine) {
static NSCache *cache;
if (!cache)
cache = [NSCache new];
Squashed commit of the following: commit 1dd1d6d3eee928d283dafbaf4432b053dff65ac2 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Thu May 27 13:30:38 2021 -0400 0.232 rom update commit cfb7f9a4d1647c41fab3328bada0f37bdb041983 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Wed May 26 20:31:16 2021 -0400 fix resizing to prevent horizontal scrolling commit 5c393ab5a95c9e53c4ef1e0b3f2b77db93e1c29b Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Wed May 26 20:01:48 2021 -0400 esc should close the menu if visible, otherwise clear the text. commit 7da142b64280c39e216584cedb7fb14243d573f0 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:17:10 2021 -0400 show software short name unless it's ambiguous. commit 6f3b3bef5e18e78619959613e28064eb6251ce27 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:16:47 2021 -0400 cleanup some auto complete rough edges commit 4988d8b266b8b11e519bcb5aab05ad2c3ffe5c23 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:16:24 2021 -0400 fix commit 6d4bf94fd6b4850564b705ea15e91079b00346c2 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 19:13:28 2021 -0400 clean up autocomplete a little... commit 3722271e51d93599903bccc721dc1de61f0aae72 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 19:13:07 2021 -0400 move auto complete logic to SoftwareSet commit 04cc83ecbe9ee4c9100305712c47a11359327734 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 20:46:39 2021 -0400 software - keep the list name to differentiate in case of name clashes. commit 8e5b5dc7e283f760a16011308298e999110fc052 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 20:45:13 2021 -0400 Autocomplete - limit menu content width to the clip view content width. prevents horizontal scrolling. commit 356048d450447485bb33a4261018f85dac19a134 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:45:42 2021 -0400 add auto complete software list to the launch window. commit 9dc72b702c9b36d490349f291c10b98b56178567 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:44:28 2021 -0400 autocomplete control. commit 40eee83f56d957c64e0f8d927486f13165b9e120 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:39:32 2021 -0400 add filters to software list. commit cebfbaa545441f061cffafe8ca93db2377240a06 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun May 23 11:59:00 2021 -0400 add compatibility field for software list filtering.
2021-05-27 23:42:28 +00:00
if (!machine) return nil;
2021-03-28 22:50:55 +00:00
machine = InternString(machine);
NSArray *a = [cache objectForKey: machine];
if (a) return a;
NSBundle *bundle = [NSBundle mainBundle];
NSURL *url= [bundle URLForResource: machine withExtension: @"plist"];
NSDictionary *d = [NSDictionary dictionaryWithContentsOfURL: url];
if (!d) return nil;
NSArray *list = [d objectForKey: @"software"];
NSMutableArray *tmp = [NSMutableArray new];
Squashed commit of the following: commit 1dd1d6d3eee928d283dafbaf4432b053dff65ac2 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Thu May 27 13:30:38 2021 -0400 0.232 rom update commit cfb7f9a4d1647c41fab3328bada0f37bdb041983 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Wed May 26 20:31:16 2021 -0400 fix resizing to prevent horizontal scrolling commit 5c393ab5a95c9e53c4ef1e0b3f2b77db93e1c29b Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Wed May 26 20:01:48 2021 -0400 esc should close the menu if visible, otherwise clear the text. commit 7da142b64280c39e216584cedb7fb14243d573f0 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:17:10 2021 -0400 show software short name unless it's ambiguous. commit 6f3b3bef5e18e78619959613e28064eb6251ce27 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:16:47 2021 -0400 cleanup some auto complete rough edges commit 4988d8b266b8b11e519bcb5aab05ad2c3ffe5c23 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:16:24 2021 -0400 fix commit 6d4bf94fd6b4850564b705ea15e91079b00346c2 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 19:13:28 2021 -0400 clean up autocomplete a little... commit 3722271e51d93599903bccc721dc1de61f0aae72 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 19:13:07 2021 -0400 move auto complete logic to SoftwareSet commit 04cc83ecbe9ee4c9100305712c47a11359327734 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 20:46:39 2021 -0400 software - keep the list name to differentiate in case of name clashes. commit 8e5b5dc7e283f760a16011308298e999110fc052 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 20:45:13 2021 -0400 Autocomplete - limit menu content width to the clip view content width. prevents horizontal scrolling. commit 356048d450447485bb33a4261018f85dac19a134 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:45:42 2021 -0400 add auto complete software list to the launch window. commit 9dc72b702c9b36d490349f291c10b98b56178567 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:44:28 2021 -0400 autocomplete control. commit 40eee83f56d957c64e0f8d927486f13165b9e120 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:39:32 2021 -0400 add filters to software list. commit cebfbaa545441f061cffafe8ca93db2377240a06 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun May 23 11:59:00 2021 -0400 add compatibility field for software list filtering.
2021-05-27 23:42:28 +00:00
for (NSObject *o in list) {
2021-03-28 22:50:55 +00:00
SoftwareList *sw;
NSURL *url = SupportDirectory();
Squashed commit of the following: commit 1dd1d6d3eee928d283dafbaf4432b053dff65ac2 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Thu May 27 13:30:38 2021 -0400 0.232 rom update commit cfb7f9a4d1647c41fab3328bada0f37bdb041983 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Wed May 26 20:31:16 2021 -0400 fix resizing to prevent horizontal scrolling commit 5c393ab5a95c9e53c4ef1e0b3f2b77db93e1c29b Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Wed May 26 20:01:48 2021 -0400 esc should close the menu if visible, otherwise clear the text. commit 7da142b64280c39e216584cedb7fb14243d573f0 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:17:10 2021 -0400 show software short name unless it's ambiguous. commit 6f3b3bef5e18e78619959613e28064eb6251ce27 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:16:47 2021 -0400 cleanup some auto complete rough edges commit 4988d8b266b8b11e519bcb5aab05ad2c3ffe5c23 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:16:24 2021 -0400 fix commit 6d4bf94fd6b4850564b705ea15e91079b00346c2 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 19:13:28 2021 -0400 clean up autocomplete a little... commit 3722271e51d93599903bccc721dc1de61f0aae72 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 19:13:07 2021 -0400 move auto complete logic to SoftwareSet commit 04cc83ecbe9ee4c9100305712c47a11359327734 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 20:46:39 2021 -0400 software - keep the list name to differentiate in case of name clashes. commit 8e5b5dc7e283f760a16011308298e999110fc052 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 20:45:13 2021 -0400 Autocomplete - limit menu content width to the clip view content width. prevents horizontal scrolling. commit 356048d450447485bb33a4261018f85dac19a134 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:45:42 2021 -0400 add auto complete software list to the launch window. commit 9dc72b702c9b36d490349f291c10b98b56178567 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:44:28 2021 -0400 autocomplete control. commit 40eee83f56d957c64e0f8d927486f13165b9e120 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:39:32 2021 -0400 add filters to software list. commit cebfbaa545441f061cffafe8ca93db2377240a06 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun May 23 11:59:00 2021 -0400 add compatibility field for software list filtering.
2021-05-27 23:42:28 +00:00
NSString *xml = nil;
NSString *filter = nil;
if ([o isKindOfClass: [NSString class]]) {
xml = (NSString *)o;
} else if ([o isKindOfClass: [NSDictionary class]]) {
xml = [(NSDictionary *)o objectForKey: @"name"];
filter = [(NSDictionary *)o objectForKey: @"filter"];
} else if ([o isKindOfClass: [NSArray class]]) {
// [ xml, filter ]
xml = [(NSArray *)o objectAtIndex: 0];
filter = [(NSArray *)o objectAtIndex: 1];
}
else {
2021-03-28 22:50:55 +00:00
continue;
}
Squashed commit of the following: commit 1dd1d6d3eee928d283dafbaf4432b053dff65ac2 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Thu May 27 13:30:38 2021 -0400 0.232 rom update commit cfb7f9a4d1647c41fab3328bada0f37bdb041983 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Wed May 26 20:31:16 2021 -0400 fix resizing to prevent horizontal scrolling commit 5c393ab5a95c9e53c4ef1e0b3f2b77db93e1c29b Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Wed May 26 20:01:48 2021 -0400 esc should close the menu if visible, otherwise clear the text. commit 7da142b64280c39e216584cedb7fb14243d573f0 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:17:10 2021 -0400 show software short name unless it's ambiguous. commit 6f3b3bef5e18e78619959613e28064eb6251ce27 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:16:47 2021 -0400 cleanup some auto complete rough edges commit 4988d8b266b8b11e519bcb5aab05ad2c3ffe5c23 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:16:24 2021 -0400 fix commit 6d4bf94fd6b4850564b705ea15e91079b00346c2 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 19:13:28 2021 -0400 clean up autocomplete a little... commit 3722271e51d93599903bccc721dc1de61f0aae72 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 19:13:07 2021 -0400 move auto complete logic to SoftwareSet commit 04cc83ecbe9ee4c9100305712c47a11359327734 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 20:46:39 2021 -0400 software - keep the list name to differentiate in case of name clashes. commit 8e5b5dc7e283f760a16011308298e999110fc052 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 20:45:13 2021 -0400 Autocomplete - limit menu content width to the clip view content width. prevents horizontal scrolling. commit 356048d450447485bb33a4261018f85dac19a134 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:45:42 2021 -0400 add auto complete software list to the launch window. commit 9dc72b702c9b36d490349f291c10b98b56178567 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:44:28 2021 -0400 autocomplete control. commit 40eee83f56d957c64e0f8d927486f13165b9e120 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:39:32 2021 -0400 add filters to software list. commit cebfbaa545441f061cffafe8ca93db2377240a06 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun May 23 11:59:00 2021 -0400 add compatibility field for software list filtering.
2021-05-27 23:42:28 +00:00
if (!xml) continue;
xml = InternString(xml);
sw = [cache objectForKey: xml];
if (!sw) {
url = [url URLByAppendingPathComponent: @"hash"];
url = [url URLByAppendingPathComponent: xml];
NSError *error = nil;
sw = LoadSoftwareList(url, &error);
if (error) {
NSLog(@"SoftwareListForMachine: %@ %@: %@", machine, xml, error);
continue;
}
Updates to work with 10.11 (El Capitan) and newer. There are still a couple minor UI degradations eg: mame cheat sheet, recent disk images window, auto complete window. Squashed commit of the following: commit fb115024f805da38b747fd1905573fabb7bff24e Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun May 30 18:00:13 2021 -0400 ? commit 8405f4df95ae8f5bc5dc33598dc0b3f8972b32cd Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun May 30 17:59:43 2021 -0400 tintColor not present before 10.14 commit 86a6102cee4f30cac2972259ef55fda3c32b8f9a Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun May 30 17:59:19 2021 -0400 [menu setItemArray:] apparently has problems before 10.14 commit 65227a00743fbf143c623af8a76698d57bdc4573 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun May 30 17:58:15 2021 -0400 NSCache doesn't like null objects. commit 8a4c3a4662647d5ee0b609bde9f3aaa5c0d99776 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun May 30 16:00:05 2021 -0400 organize copy bundle resources. multiple-sized png images are converted to a single tiff (with multiple sizes). This is fine BUT EL capitan grabs the first image so if the @3x image is first, it will be used. commit 44b94cdfd47117864b6529214b1c91a0c2e41327 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun May 30 15:57:37 2021 -0400 add NewSlotViewController.m to Ample Lite. commit 2fa1b7418783e48ca625ab3490e43cbff9e5619a Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun May 30 13:57:19 2021 -0400 Ample Lite was missing reference to New Slot View nib. commit 65f268e77a65f8c57019702d8f0c2b66577c5ee7 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun May 30 13:56:04 2021 -0400 based on testing, 10.11 still has public.file-url, which is kUTTypeFileURL. 10.13 added NSURLPBoardType as a synonym. commit cde123b16eb336b7695b444931b9e9bb9802d772 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun May 30 13:54:02 2021 -0400 set everything to 10.11 commit e7a670efd3298e8ce1409cde1cce559ba46879f4 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sat May 29 23:33:31 2021 -0400 script to download SDL2.Framework commit 9f38f2972ab0e38fbdaebb3e3f35281978303519 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sat May 29 22:15:32 2021 -0400 WKWebView apparently has a bug prior to 10.12 so it can't be created via a nib. commit e18aea724978b86cb0c04853649aeb613ac225ce Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sat May 29 22:14:38 2021 -0400 version checks for features not present in 10.11 commit 07dcf30f5225564ec19d1aad3856828fdeaeb0f0 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri May 28 21:30:53 2021 -0400 lower target to 10.11
2021-05-30 22:00:34 +00:00
if (sw) [cache setObject: sw forKey: xml];
Squashed commit of the following: commit 1dd1d6d3eee928d283dafbaf4432b053dff65ac2 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Thu May 27 13:30:38 2021 -0400 0.232 rom update commit cfb7f9a4d1647c41fab3328bada0f37bdb041983 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Wed May 26 20:31:16 2021 -0400 fix resizing to prevent horizontal scrolling commit 5c393ab5a95c9e53c4ef1e0b3f2b77db93e1c29b Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Wed May 26 20:01:48 2021 -0400 esc should close the menu if visible, otherwise clear the text. commit 7da142b64280c39e216584cedb7fb14243d573f0 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:17:10 2021 -0400 show software short name unless it's ambiguous. commit 6f3b3bef5e18e78619959613e28064eb6251ce27 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:16:47 2021 -0400 cleanup some auto complete rough edges commit 4988d8b266b8b11e519bcb5aab05ad2c3ffe5c23 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:16:24 2021 -0400 fix commit 6d4bf94fd6b4850564b705ea15e91079b00346c2 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 19:13:28 2021 -0400 clean up autocomplete a little... commit 3722271e51d93599903bccc721dc1de61f0aae72 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 19:13:07 2021 -0400 move auto complete logic to SoftwareSet commit 04cc83ecbe9ee4c9100305712c47a11359327734 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 20:46:39 2021 -0400 software - keep the list name to differentiate in case of name clashes. commit 8e5b5dc7e283f760a16011308298e999110fc052 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 20:45:13 2021 -0400 Autocomplete - limit menu content width to the clip view content width. prevents horizontal scrolling. commit 356048d450447485bb33a4261018f85dac19a134 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:45:42 2021 -0400 add auto complete software list to the launch window. commit 9dc72b702c9b36d490349f291c10b98b56178567 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:44:28 2021 -0400 autocomplete control. commit 40eee83f56d957c64e0f8d927486f13165b9e120 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:39:32 2021 -0400 add filters to software list. commit cebfbaa545441f061cffafe8ca93db2377240a06 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun May 23 11:59:00 2021 -0400 add compatibility field for software list filtering.
2021-05-27 23:42:28 +00:00
}
if (filter) {
sw = [sw filter: filter];
}
if (!sw) continue;
2021-03-28 22:50:55 +00:00
[tmp addObject: sw];
}
#if 0
[tmp sortUsingComparator: ^NSComparisonResult(id a, id b){
NSString *aa = [(Software *)a title];
NSString *bb = [(Software *)b title];
return [aa compare: bb];
}];
#endif
[cache setObject: tmp forKey: machine];
return tmp;
}
Squashed commit of the following: commit 1dd1d6d3eee928d283dafbaf4432b053dff65ac2 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Thu May 27 13:30:38 2021 -0400 0.232 rom update commit cfb7f9a4d1647c41fab3328bada0f37bdb041983 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Wed May 26 20:31:16 2021 -0400 fix resizing to prevent horizontal scrolling commit 5c393ab5a95c9e53c4ef1e0b3f2b77db93e1c29b Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Wed May 26 20:01:48 2021 -0400 esc should close the menu if visible, otherwise clear the text. commit 7da142b64280c39e216584cedb7fb14243d573f0 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:17:10 2021 -0400 show software short name unless it's ambiguous. commit 6f3b3bef5e18e78619959613e28064eb6251ce27 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:16:47 2021 -0400 cleanup some auto complete rough edges commit 4988d8b266b8b11e519bcb5aab05ad2c3ffe5c23 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:16:24 2021 -0400 fix commit 6d4bf94fd6b4850564b705ea15e91079b00346c2 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 19:13:28 2021 -0400 clean up autocomplete a little... commit 3722271e51d93599903bccc721dc1de61f0aae72 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 19:13:07 2021 -0400 move auto complete logic to SoftwareSet commit 04cc83ecbe9ee4c9100305712c47a11359327734 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 20:46:39 2021 -0400 software - keep the list name to differentiate in case of name clashes. commit 8e5b5dc7e283f760a16011308298e999110fc052 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 20:45:13 2021 -0400 Autocomplete - limit menu content width to the clip view content width. prevents horizontal scrolling. commit 356048d450447485bb33a4261018f85dac19a134 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:45:42 2021 -0400 add auto complete software list to the launch window. commit 9dc72b702c9b36d490349f291c10b98b56178567 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:44:28 2021 -0400 autocomplete control. commit 40eee83f56d957c64e0f8d927486f13165b9e120 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:39:32 2021 -0400 add filters to software list. commit cebfbaa545441f061cffafe8ca93db2377240a06 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun May 23 11:59:00 2021 -0400 add compatibility field for software list filtering.
2021-05-27 23:42:28 +00:00
@interface SoftwareSet () {
NSArray<SoftwareList *> *_items;
NSCountedSet *_set;
NSCache *_cache;
}
@end
@implementation SoftwareSet
-(NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state objects:(__unsafe_unretained id _Nullable [])buffer count:(NSUInteger)len {
return [_items countByEnumeratingWithState: state objects: buffer count: len];
}
-(void)buildSet {
if (_set) return;
_set = [NSCountedSet new];
for (SoftwareList *list in _items) {
for (Software *s in [list items]) {
[_set addObject: [s name]];
}
}
}
-(BOOL)nameIsUnique:(NSString *)name {
if (![name length]) return YES;
if (!_set) [self buildSet];
return [_set countForObject: name] <= 1;
}
Squashed commit of the following: commit 78c81626670fdf41fa6bdd71a4243a89a0746615 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon Jun 7 00:33:48 2021 -0400 check if software set has a particular entry. commit ef5ab6b6948dc3bbbe2947ea099fcacd08435e86 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Jun 6 22:20:34 2021 -0400 fix scroller background on recent disk images window. commit dee56fa50e87299b396b48361bd0a780aaaaa768 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Jun 6 21:26:23 2021 -0400 update cheat sheet javascript to work with 10.11 * => functions not supported * NodeList.prototype.forEach not supported. commit b00cc05413f4ebd6d6d58f96e24303008608f3a6 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Jun 6 17:10:41 2021 -0400 default full machine name for bookmark entry. commit a671cafdc98051b56b12cdd3ccd13c22f54f605a Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Jun 6 15:39:32 2021 -0400 loading a bookmark wasn't updating the media. commit 3000e0eb1b10bede3345aaab8478e9ec209f328c Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Jun 6 15:38:53 2021 -0400 bump copyright year. commit 45222dacd4aa0047fae63a9112509de57139df63 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Jun 6 13:38:23 2021 -0400 add reset w/ value for setting the item explicitely. commit cc7fde1253b71c4d8655eb4c010bbf4e61333a15 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Jun 6 13:37:48 2021 -0400 add checkboxes for bitbanger/share directory. The general idea is it's easier to toggle a checkbox than to type/retype a path. commit 5674b2d7f6b0e2f0b973197bf3493ad61bf46428 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sat Jun 5 19:11:43 2021 -0400 commentary on searches with diacritics. commit ec60634dcd9c573130dc34673b4d3fe597ea2b42 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sat Jun 5 19:11:22 2021 -0400 clean up auto-complete a little bit when setting a value directly. commit 1a182bbdab237c89d355d8294b5a4a64b785783a Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sat Jun 5 13:08:29 2021 -0400 fix text color when value is set. There are still some bugs relating to multiple copies of the value being stored. commit 49c0bc15c73446259d8cc151cf52d6058644db76 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sat Jun 5 12:09:44 2021 -0400 reset all controls first. commit 059797ad85b057e296cc707b4645f839bfccac13 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sat Jun 5 10:52:06 2021 -0400 more bookmark loading. commit e5a612d9f8e7414dd15c66dbaa540b637765eeec Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri Jun 4 23:52:38 2021 -0400 bookmark - restore the software commit f9411a1e84df7bd46e352cc5ca995b585c2a0523 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri Jun 4 23:52:25 2021 -0400 clean up software / name logic. commit f628d99e4a70d65ea8703f3c182103cd3bfea969 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri Jun 4 00:21:08 2021 -0400 load bookmark... commit 0b248e6aad16cba848f88d294a1366cea5760aa0 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri Jun 4 00:20:42 2021 -0400 stringValue can't be nil. commit 94aac38af45c3c95cb86b176393a469279c2539e Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Thu Jun 3 23:04:37 2021 -0400 add bookmark menu commit 6215a0df120b6cd97f1ffea2d2db9aaa5ae61f29 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Thu Jun 3 23:03:29 2021 -0400 slot view needs to know the machine. commit d348c15dc56d9cee01e5417435dd236e0e541902 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Thu Jun 3 23:02:58 2021 -0400 transformer to enable/disable control based on string length. commit e14336a0094af7aa84e91da69ff59ebb9e8eea9b Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Thu Jun 3 23:02:14 2021 -0400 shut up compiler warning. commit 4baf545245d8d3debf8f436b36b14cca23bf7a33 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Thu Jun 3 23:01:15 2021 -0400 bookmark manager commit 0f3e6c83075a145a456728b57a499cfa35707002 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 31 23:54:29 2021 -0400 more (untested) bookmark code commit 8fdb149eb38952b13c4a78d7a6940c43d90870f1 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 31 16:13:43 2021 -0400 start of bookmarking support. Untested. commit 787eac87f6ac13cd677630cbaf2538cecab27b1f Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 31 16:12:45 2021 -0400 shut up warnings about content clipping. maybe it's a 10.11 thing. The size was chosen by interface builder.
2021-06-07 04:34:26 +00:00
-(NSString *)nameForSoftware: (Software *)software {
if (!software) return nil;
if (!_set) [self buildSet];
NSString *name = [software name];
if ([_set countForObject: name] > 1) {
return [software fullName];
}
return name;
}
-(Software *)softwareForName: (NSString *)name {
/* name will be name or set:name */
NSString *set = nil;
NSArray *tmp = [name componentsSeparatedByString: @":"];
switch([tmp count]) {
case 1: break;
case 2:
set = [tmp objectAtIndex: 0];
name = [tmp objectAtIndex: 1];
break;
default: return nil;
}
if (_set && ![_set containsObject: name]) return nil;
for (SoftwareList *list in _items) {
if (set && ![set isEqualToString: [list name]]) continue;
for (Software *s in [list items]) {
if ([name isEqualToString: [s name]]) return s;
}
}
return nil;
}
Squashed commit of the following: commit 1dd1d6d3eee928d283dafbaf4432b053dff65ac2 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Thu May 27 13:30:38 2021 -0400 0.232 rom update commit cfb7f9a4d1647c41fab3328bada0f37bdb041983 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Wed May 26 20:31:16 2021 -0400 fix resizing to prevent horizontal scrolling commit 5c393ab5a95c9e53c4ef1e0b3f2b77db93e1c29b Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Wed May 26 20:01:48 2021 -0400 esc should close the menu if visible, otherwise clear the text. commit 7da142b64280c39e216584cedb7fb14243d573f0 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:17:10 2021 -0400 show software short name unless it's ambiguous. commit 6f3b3bef5e18e78619959613e28064eb6251ce27 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:16:47 2021 -0400 cleanup some auto complete rough edges commit 4988d8b266b8b11e519bcb5aab05ad2c3ffe5c23 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:16:24 2021 -0400 fix commit 6d4bf94fd6b4850564b705ea15e91079b00346c2 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 19:13:28 2021 -0400 clean up autocomplete a little... commit 3722271e51d93599903bccc721dc1de61f0aae72 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 19:13:07 2021 -0400 move auto complete logic to SoftwareSet commit 04cc83ecbe9ee4c9100305712c47a11359327734 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 20:46:39 2021 -0400 software - keep the list name to differentiate in case of name clashes. commit 8e5b5dc7e283f760a16011308298e999110fc052 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 20:45:13 2021 -0400 Autocomplete - limit menu content width to the clip view content width. prevents horizontal scrolling. commit 356048d450447485bb33a4261018f85dac19a134 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:45:42 2021 -0400 add auto complete software list to the launch window. commit 9dc72b702c9b36d490349f291c10b98b56178567 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:44:28 2021 -0400 autocomplete control. commit 40eee83f56d957c64e0f8d927486f13165b9e120 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:39:32 2021 -0400 add filters to software list. commit cebfbaa545441f061cffafe8ca93db2377240a06 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun May 23 11:59:00 2021 -0400 add compatibility field for software list filtering.
2021-05-27 23:42:28 +00:00
+(instancetype)softwareSetForMachine:(NSString *)machine {
static NSCache *cache;
if (!cache)
cache = [NSCache new];
if (!machine) return nil;
machine = InternString(machine);
SoftwareSet *s= [cache objectForKey: machine];
if (s) return s;
NSBundle *bundle = [NSBundle mainBundle];
NSURL *url= [bundle URLForResource: machine withExtension: @"plist"];
NSDictionary *d = [NSDictionary dictionaryWithContentsOfURL: url];
if (!d) return nil;
NSArray *list = [d objectForKey: @"software"];
NSMutableArray *tmp = [NSMutableArray new];
for (NSObject *o in list) {
SoftwareList *sw;
NSURL *url = SupportDirectory();
NSString *xml = nil;
NSString *filter = nil;
if ([o isKindOfClass: [NSString class]]) {
xml = (NSString *)o;
} else if ([o isKindOfClass: [NSDictionary class]]) {
xml = [(NSDictionary *)o objectForKey: @"name"];
filter = [(NSDictionary *)o objectForKey: @"filter"];
} else if ([o isKindOfClass: [NSArray class]]) {
// [ xml, filter ]
xml = [(NSArray *)o objectAtIndex: 0];
filter = [(NSArray *)o objectAtIndex: 1];
}
else {
continue;
}
if (!xml) continue;
xml = InternString(xml);
sw = [cache objectForKey: xml];
if (!sw) {
url = [url URLByAppendingPathComponent: @"hash"];
url = [url URLByAppendingPathComponent: xml];
NSError *error = nil;
sw = LoadSoftwareList(url, &error);
if (error) {
NSLog(@"SoftwareListForMachine: %@ %@: %@", machine, xml, error);
continue;
}
Updates to work with 10.11 (El Capitan) and newer. There are still a couple minor UI degradations eg: mame cheat sheet, recent disk images window, auto complete window. Squashed commit of the following: commit fb115024f805da38b747fd1905573fabb7bff24e Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun May 30 18:00:13 2021 -0400 ? commit 8405f4df95ae8f5bc5dc33598dc0b3f8972b32cd Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun May 30 17:59:43 2021 -0400 tintColor not present before 10.14 commit 86a6102cee4f30cac2972259ef55fda3c32b8f9a Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun May 30 17:59:19 2021 -0400 [menu setItemArray:] apparently has problems before 10.14 commit 65227a00743fbf143c623af8a76698d57bdc4573 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun May 30 17:58:15 2021 -0400 NSCache doesn't like null objects. commit 8a4c3a4662647d5ee0b609bde9f3aaa5c0d99776 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun May 30 16:00:05 2021 -0400 organize copy bundle resources. multiple-sized png images are converted to a single tiff (with multiple sizes). This is fine BUT EL capitan grabs the first image so if the @3x image is first, it will be used. commit 44b94cdfd47117864b6529214b1c91a0c2e41327 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun May 30 15:57:37 2021 -0400 add NewSlotViewController.m to Ample Lite. commit 2fa1b7418783e48ca625ab3490e43cbff9e5619a Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun May 30 13:57:19 2021 -0400 Ample Lite was missing reference to New Slot View nib. commit 65f268e77a65f8c57019702d8f0c2b66577c5ee7 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun May 30 13:56:04 2021 -0400 based on testing, 10.11 still has public.file-url, which is kUTTypeFileURL. 10.13 added NSURLPBoardType as a synonym. commit cde123b16eb336b7695b444931b9e9bb9802d772 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun May 30 13:54:02 2021 -0400 set everything to 10.11 commit e7a670efd3298e8ce1409cde1cce559ba46879f4 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sat May 29 23:33:31 2021 -0400 script to download SDL2.Framework commit 9f38f2972ab0e38fbdaebb3e3f35281978303519 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sat May 29 22:15:32 2021 -0400 WKWebView apparently has a bug prior to 10.12 so it can't be created via a nib. commit e18aea724978b86cb0c04853649aeb613ac225ce Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sat May 29 22:14:38 2021 -0400 version checks for features not present in 10.11 commit 07dcf30f5225564ec19d1aad3856828fdeaeb0f0 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri May 28 21:30:53 2021 -0400 lower target to 10.11
2021-05-30 22:00:34 +00:00
if (sw) [cache setObject: sw forKey: xml];
Squashed commit of the following: commit 1dd1d6d3eee928d283dafbaf4432b053dff65ac2 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Thu May 27 13:30:38 2021 -0400 0.232 rom update commit cfb7f9a4d1647c41fab3328bada0f37bdb041983 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Wed May 26 20:31:16 2021 -0400 fix resizing to prevent horizontal scrolling commit 5c393ab5a95c9e53c4ef1e0b3f2b77db93e1c29b Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Wed May 26 20:01:48 2021 -0400 esc should close the menu if visible, otherwise clear the text. commit 7da142b64280c39e216584cedb7fb14243d573f0 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:17:10 2021 -0400 show software short name unless it's ambiguous. commit 6f3b3bef5e18e78619959613e28064eb6251ce27 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:16:47 2021 -0400 cleanup some auto complete rough edges commit 4988d8b266b8b11e519bcb5aab05ad2c3ffe5c23 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:16:24 2021 -0400 fix commit 6d4bf94fd6b4850564b705ea15e91079b00346c2 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 19:13:28 2021 -0400 clean up autocomplete a little... commit 3722271e51d93599903bccc721dc1de61f0aae72 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 19:13:07 2021 -0400 move auto complete logic to SoftwareSet commit 04cc83ecbe9ee4c9100305712c47a11359327734 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 20:46:39 2021 -0400 software - keep the list name to differentiate in case of name clashes. commit 8e5b5dc7e283f760a16011308298e999110fc052 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 20:45:13 2021 -0400 Autocomplete - limit menu content width to the clip view content width. prevents horizontal scrolling. commit 356048d450447485bb33a4261018f85dac19a134 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:45:42 2021 -0400 add auto complete software list to the launch window. commit 9dc72b702c9b36d490349f291c10b98b56178567 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:44:28 2021 -0400 autocomplete control. commit 40eee83f56d957c64e0f8d927486f13165b9e120 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:39:32 2021 -0400 add filters to software list. commit cebfbaa545441f061cffafe8ca93db2377240a06 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun May 23 11:59:00 2021 -0400 add compatibility field for software list filtering.
2021-05-27 23:42:28 +00:00
}
if (filter) {
sw = [sw filter: filter];
}
if (!sw) continue;
[tmp addObject: sw];
}
if (![tmp count]) return nil;
s = [SoftwareSet new];
s->_items = tmp;
[cache setObject: s forKey: machine];
return s;
}
Squashed commit of the following: commit 78c81626670fdf41fa6bdd71a4243a89a0746615 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon Jun 7 00:33:48 2021 -0400 check if software set has a particular entry. commit ef5ab6b6948dc3bbbe2947ea099fcacd08435e86 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Jun 6 22:20:34 2021 -0400 fix scroller background on recent disk images window. commit dee56fa50e87299b396b48361bd0a780aaaaa768 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Jun 6 21:26:23 2021 -0400 update cheat sheet javascript to work with 10.11 * => functions not supported * NodeList.prototype.forEach not supported. commit b00cc05413f4ebd6d6d58f96e24303008608f3a6 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Jun 6 17:10:41 2021 -0400 default full machine name for bookmark entry. commit a671cafdc98051b56b12cdd3ccd13c22f54f605a Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Jun 6 15:39:32 2021 -0400 loading a bookmark wasn't updating the media. commit 3000e0eb1b10bede3345aaab8478e9ec209f328c Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Jun 6 15:38:53 2021 -0400 bump copyright year. commit 45222dacd4aa0047fae63a9112509de57139df63 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Jun 6 13:38:23 2021 -0400 add reset w/ value for setting the item explicitely. commit cc7fde1253b71c4d8655eb4c010bbf4e61333a15 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Jun 6 13:37:48 2021 -0400 add checkboxes for bitbanger/share directory. The general idea is it's easier to toggle a checkbox than to type/retype a path. commit 5674b2d7f6b0e2f0b973197bf3493ad61bf46428 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sat Jun 5 19:11:43 2021 -0400 commentary on searches with diacritics. commit ec60634dcd9c573130dc34673b4d3fe597ea2b42 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sat Jun 5 19:11:22 2021 -0400 clean up auto-complete a little bit when setting a value directly. commit 1a182bbdab237c89d355d8294b5a4a64b785783a Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sat Jun 5 13:08:29 2021 -0400 fix text color when value is set. There are still some bugs relating to multiple copies of the value being stored. commit 49c0bc15c73446259d8cc151cf52d6058644db76 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sat Jun 5 12:09:44 2021 -0400 reset all controls first. commit 059797ad85b057e296cc707b4645f839bfccac13 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sat Jun 5 10:52:06 2021 -0400 more bookmark loading. commit e5a612d9f8e7414dd15c66dbaa540b637765eeec Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri Jun 4 23:52:38 2021 -0400 bookmark - restore the software commit f9411a1e84df7bd46e352cc5ca995b585c2a0523 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri Jun 4 23:52:25 2021 -0400 clean up software / name logic. commit f628d99e4a70d65ea8703f3c182103cd3bfea969 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri Jun 4 00:21:08 2021 -0400 load bookmark... commit 0b248e6aad16cba848f88d294a1366cea5760aa0 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri Jun 4 00:20:42 2021 -0400 stringValue can't be nil. commit 94aac38af45c3c95cb86b176393a469279c2539e Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Thu Jun 3 23:04:37 2021 -0400 add bookmark menu commit 6215a0df120b6cd97f1ffea2d2db9aaa5ae61f29 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Thu Jun 3 23:03:29 2021 -0400 slot view needs to know the machine. commit d348c15dc56d9cee01e5417435dd236e0e541902 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Thu Jun 3 23:02:58 2021 -0400 transformer to enable/disable control based on string length. commit e14336a0094af7aa84e91da69ff59ebb9e8eea9b Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Thu Jun 3 23:02:14 2021 -0400 shut up compiler warning. commit 4baf545245d8d3debf8f436b36b14cca23bf7a33 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Thu Jun 3 23:01:15 2021 -0400 bookmark manager commit 0f3e6c83075a145a456728b57a499cfa35707002 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 31 23:54:29 2021 -0400 more (untested) bookmark code commit 8fdb149eb38952b13c4a78d7a6940c43d90870f1 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 31 16:13:43 2021 -0400 start of bookmarking support. Untested. commit 787eac87f6ac13cd677630cbaf2538cecab27b1f Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 31 16:12:45 2021 -0400 shut up warnings about content clipping. maybe it's a 10.11 thing. The size was chosen by interface builder.
2021-06-07 04:34:26 +00:00
-(BOOL)hasSoftware: (Software *)software {
if (_set) {
NSString *name = [software name];
if (![_set containsObject: name]) return NO;
}
NSString *slist = [software list];
for (SoftwareList *list in _items) {
if (![slist isEqualToString: [list name]]) continue;
return [[list items] containsObject: software];
}
return NO;
}
Squashed commit of the following: commit 1dd1d6d3eee928d283dafbaf4432b053dff65ac2 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Thu May 27 13:30:38 2021 -0400 0.232 rom update commit cfb7f9a4d1647c41fab3328bada0f37bdb041983 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Wed May 26 20:31:16 2021 -0400 fix resizing to prevent horizontal scrolling commit 5c393ab5a95c9e53c4ef1e0b3f2b77db93e1c29b Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Wed May 26 20:01:48 2021 -0400 esc should close the menu if visible, otherwise clear the text. commit 7da142b64280c39e216584cedb7fb14243d573f0 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:17:10 2021 -0400 show software short name unless it's ambiguous. commit 6f3b3bef5e18e78619959613e28064eb6251ce27 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:16:47 2021 -0400 cleanup some auto complete rough edges commit 4988d8b266b8b11e519bcb5aab05ad2c3ffe5c23 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:16:24 2021 -0400 fix commit 6d4bf94fd6b4850564b705ea15e91079b00346c2 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 19:13:28 2021 -0400 clean up autocomplete a little... commit 3722271e51d93599903bccc721dc1de61f0aae72 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 19:13:07 2021 -0400 move auto complete logic to SoftwareSet commit 04cc83ecbe9ee4c9100305712c47a11359327734 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 20:46:39 2021 -0400 software - keep the list name to differentiate in case of name clashes. commit 8e5b5dc7e283f760a16011308298e999110fc052 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 20:45:13 2021 -0400 Autocomplete - limit menu content width to the clip view content width. prevents horizontal scrolling. commit 356048d450447485bb33a4261018f85dac19a134 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:45:42 2021 -0400 add auto complete software list to the launch window. commit 9dc72b702c9b36d490349f291c10b98b56178567 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:44:28 2021 -0400 autocomplete control. commit 40eee83f56d957c64e0f8d927486f13165b9e120 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:39:32 2021 -0400 add filters to software list. commit cebfbaa545441f061cffafe8ca93db2377240a06 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun May 23 11:59:00 2021 -0400 add compatibility field for software list filtering.
2021-05-27 23:42:28 +00:00
- (nonnull NSArray<id<AutocompleteItem>> *)autocomplete:(AutocompleteControl *)control completionsForItem:(id<AutocompleteItem>)item {
for (SoftwareList *list in _items) {
NSArray *items = [list items];
if ([items containsObject: item]) {
return @[ list, item ];
}
}
return nil;
}
Squashed commit of the following: commit 78c81626670fdf41fa6bdd71a4243a89a0746615 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon Jun 7 00:33:48 2021 -0400 check if software set has a particular entry. commit ef5ab6b6948dc3bbbe2947ea099fcacd08435e86 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Jun 6 22:20:34 2021 -0400 fix scroller background on recent disk images window. commit dee56fa50e87299b396b48361bd0a780aaaaa768 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Jun 6 21:26:23 2021 -0400 update cheat sheet javascript to work with 10.11 * => functions not supported * NodeList.prototype.forEach not supported. commit b00cc05413f4ebd6d6d58f96e24303008608f3a6 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Jun 6 17:10:41 2021 -0400 default full machine name for bookmark entry. commit a671cafdc98051b56b12cdd3ccd13c22f54f605a Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Jun 6 15:39:32 2021 -0400 loading a bookmark wasn't updating the media. commit 3000e0eb1b10bede3345aaab8478e9ec209f328c Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Jun 6 15:38:53 2021 -0400 bump copyright year. commit 45222dacd4aa0047fae63a9112509de57139df63 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Jun 6 13:38:23 2021 -0400 add reset w/ value for setting the item explicitely. commit cc7fde1253b71c4d8655eb4c010bbf4e61333a15 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Jun 6 13:37:48 2021 -0400 add checkboxes for bitbanger/share directory. The general idea is it's easier to toggle a checkbox than to type/retype a path. commit 5674b2d7f6b0e2f0b973197bf3493ad61bf46428 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sat Jun 5 19:11:43 2021 -0400 commentary on searches with diacritics. commit ec60634dcd9c573130dc34673b4d3fe597ea2b42 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sat Jun 5 19:11:22 2021 -0400 clean up auto-complete a little bit when setting a value directly. commit 1a182bbdab237c89d355d8294b5a4a64b785783a Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sat Jun 5 13:08:29 2021 -0400 fix text color when value is set. There are still some bugs relating to multiple copies of the value being stored. commit 49c0bc15c73446259d8cc151cf52d6058644db76 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sat Jun 5 12:09:44 2021 -0400 reset all controls first. commit 059797ad85b057e296cc707b4645f839bfccac13 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sat Jun 5 10:52:06 2021 -0400 more bookmark loading. commit e5a612d9f8e7414dd15c66dbaa540b637765eeec Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri Jun 4 23:52:38 2021 -0400 bookmark - restore the software commit f9411a1e84df7bd46e352cc5ca995b585c2a0523 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri Jun 4 23:52:25 2021 -0400 clean up software / name logic. commit f628d99e4a70d65ea8703f3c182103cd3bfea969 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri Jun 4 00:21:08 2021 -0400 load bookmark... commit 0b248e6aad16cba848f88d294a1366cea5760aa0 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri Jun 4 00:20:42 2021 -0400 stringValue can't be nil. commit 94aac38af45c3c95cb86b176393a469279c2539e Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Thu Jun 3 23:04:37 2021 -0400 add bookmark menu commit 6215a0df120b6cd97f1ffea2d2db9aaa5ae61f29 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Thu Jun 3 23:03:29 2021 -0400 slot view needs to know the machine. commit d348c15dc56d9cee01e5417435dd236e0e541902 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Thu Jun 3 23:02:58 2021 -0400 transformer to enable/disable control based on string length. commit e14336a0094af7aa84e91da69ff59ebb9e8eea9b Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Thu Jun 3 23:02:14 2021 -0400 shut up compiler warning. commit 4baf545245d8d3debf8f436b36b14cca23bf7a33 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Thu Jun 3 23:01:15 2021 -0400 bookmark manager commit 0f3e6c83075a145a456728b57a499cfa35707002 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 31 23:54:29 2021 -0400 more (untested) bookmark code commit 8fdb149eb38952b13c4a78d7a6940c43d90870f1 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 31 16:13:43 2021 -0400 start of bookmarking support. Untested. commit 787eac87f6ac13cd677630cbaf2538cecab27b1f Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 31 16:12:45 2021 -0400 shut up warnings about content clipping. maybe it's a 10.11 thing. The size was chosen by interface builder.
2021-06-07 04:34:26 +00:00
// NSStringTransformStripDiacritics
// pre-process all entries to lowercase and remove diacritics (second string for search text?)
#if 0
static unichar diacritics[][2] = {
{ 0xd8, 'O' }, // Ø
{ 0xf8, 'o' }, // ø
};
#endif
Squashed commit of the following: commit 1dd1d6d3eee928d283dafbaf4432b053dff65ac2 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Thu May 27 13:30:38 2021 -0400 0.232 rom update commit cfb7f9a4d1647c41fab3328bada0f37bdb041983 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Wed May 26 20:31:16 2021 -0400 fix resizing to prevent horizontal scrolling commit 5c393ab5a95c9e53c4ef1e0b3f2b77db93e1c29b Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Wed May 26 20:01:48 2021 -0400 esc should close the menu if visible, otherwise clear the text. commit 7da142b64280c39e216584cedb7fb14243d573f0 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:17:10 2021 -0400 show software short name unless it's ambiguous. commit 6f3b3bef5e18e78619959613e28064eb6251ce27 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:16:47 2021 -0400 cleanup some auto complete rough edges commit 4988d8b266b8b11e519bcb5aab05ad2c3ffe5c23 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:16:24 2021 -0400 fix commit 6d4bf94fd6b4850564b705ea15e91079b00346c2 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 19:13:28 2021 -0400 clean up autocomplete a little... commit 3722271e51d93599903bccc721dc1de61f0aae72 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 19:13:07 2021 -0400 move auto complete logic to SoftwareSet commit 04cc83ecbe9ee4c9100305712c47a11359327734 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 20:46:39 2021 -0400 software - keep the list name to differentiate in case of name clashes. commit 8e5b5dc7e283f760a16011308298e999110fc052 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 20:45:13 2021 -0400 Autocomplete - limit menu content width to the clip view content width. prevents horizontal scrolling. commit 356048d450447485bb33a4261018f85dac19a134 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:45:42 2021 -0400 add auto complete software list to the launch window. commit 9dc72b702c9b36d490349f291c10b98b56178567 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:44:28 2021 -0400 autocomplete control. commit 40eee83f56d957c64e0f8d927486f13165b9e120 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:39:32 2021 -0400 add filters to software list. commit cebfbaa545441f061cffafe8ca93db2377240a06 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun May 23 11:59:00 2021 -0400 add compatibility field for software list filtering.
2021-05-27 23:42:28 +00:00
- (nonnull NSArray<id<AutocompleteItem>> *)autocomplete:(nonnull AutocompleteControl *)control completionsForString:(nonnull NSString *)string {
if (!_cache) {
_cache = [NSCache new];
[_cache setCountLimit: 10];
}
Squashed commit of the following: commit 78c81626670fdf41fa6bdd71a4243a89a0746615 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon Jun 7 00:33:48 2021 -0400 check if software set has a particular entry. commit ef5ab6b6948dc3bbbe2947ea099fcacd08435e86 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Jun 6 22:20:34 2021 -0400 fix scroller background on recent disk images window. commit dee56fa50e87299b396b48361bd0a780aaaaa768 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Jun 6 21:26:23 2021 -0400 update cheat sheet javascript to work with 10.11 * => functions not supported * NodeList.prototype.forEach not supported. commit b00cc05413f4ebd6d6d58f96e24303008608f3a6 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Jun 6 17:10:41 2021 -0400 default full machine name for bookmark entry. commit a671cafdc98051b56b12cdd3ccd13c22f54f605a Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Jun 6 15:39:32 2021 -0400 loading a bookmark wasn't updating the media. commit 3000e0eb1b10bede3345aaab8478e9ec209f328c Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Jun 6 15:38:53 2021 -0400 bump copyright year. commit 45222dacd4aa0047fae63a9112509de57139df63 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Jun 6 13:38:23 2021 -0400 add reset w/ value for setting the item explicitely. commit cc7fde1253b71c4d8655eb4c010bbf4e61333a15 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Jun 6 13:37:48 2021 -0400 add checkboxes for bitbanger/share directory. The general idea is it's easier to toggle a checkbox than to type/retype a path. commit 5674b2d7f6b0e2f0b973197bf3493ad61bf46428 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sat Jun 5 19:11:43 2021 -0400 commentary on searches with diacritics. commit ec60634dcd9c573130dc34673b4d3fe597ea2b42 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sat Jun 5 19:11:22 2021 -0400 clean up auto-complete a little bit when setting a value directly. commit 1a182bbdab237c89d355d8294b5a4a64b785783a Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sat Jun 5 13:08:29 2021 -0400 fix text color when value is set. There are still some bugs relating to multiple copies of the value being stored. commit 49c0bc15c73446259d8cc151cf52d6058644db76 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sat Jun 5 12:09:44 2021 -0400 reset all controls first. commit 059797ad85b057e296cc707b4645f839bfccac13 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sat Jun 5 10:52:06 2021 -0400 more bookmark loading. commit e5a612d9f8e7414dd15c66dbaa540b637765eeec Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri Jun 4 23:52:38 2021 -0400 bookmark - restore the software commit f9411a1e84df7bd46e352cc5ca995b585c2a0523 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri Jun 4 23:52:25 2021 -0400 clean up software / name logic. commit f628d99e4a70d65ea8703f3c182103cd3bfea969 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri Jun 4 00:21:08 2021 -0400 load bookmark... commit 0b248e6aad16cba848f88d294a1366cea5760aa0 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri Jun 4 00:20:42 2021 -0400 stringValue can't be nil. commit 94aac38af45c3c95cb86b176393a469279c2539e Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Thu Jun 3 23:04:37 2021 -0400 add bookmark menu commit 6215a0df120b6cd97f1ffea2d2db9aaa5ae61f29 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Thu Jun 3 23:03:29 2021 -0400 slot view needs to know the machine. commit d348c15dc56d9cee01e5417435dd236e0e541902 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Thu Jun 3 23:02:58 2021 -0400 transformer to enable/disable control based on string length. commit e14336a0094af7aa84e91da69ff59ebb9e8eea9b Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Thu Jun 3 23:02:14 2021 -0400 shut up compiler warning. commit 4baf545245d8d3debf8f436b36b14cca23bf7a33 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Thu Jun 3 23:01:15 2021 -0400 bookmark manager commit 0f3e6c83075a145a456728b57a499cfa35707002 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 31 23:54:29 2021 -0400 more (untested) bookmark code commit 8fdb149eb38952b13c4a78d7a6940c43d90870f1 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 31 16:13:43 2021 -0400 start of bookmarking support. Untested. commit 787eac87f6ac13cd677630cbaf2538cecab27b1f Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 31 16:12:45 2021 -0400 shut up warnings about content clipping. maybe it's a 10.11 thing. The size was chosen by interface builder.
2021-06-07 04:34:26 +00:00
// todo -- diacritic normalization.
// déjá vu -> deja vu
Squashed commit of the following: commit 1dd1d6d3eee928d283dafbaf4432b053dff65ac2 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Thu May 27 13:30:38 2021 -0400 0.232 rom update commit cfb7f9a4d1647c41fab3328bada0f37bdb041983 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Wed May 26 20:31:16 2021 -0400 fix resizing to prevent horizontal scrolling commit 5c393ab5a95c9e53c4ef1e0b3f2b77db93e1c29b Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Wed May 26 20:01:48 2021 -0400 esc should close the menu if visible, otherwise clear the text. commit 7da142b64280c39e216584cedb7fb14243d573f0 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:17:10 2021 -0400 show software short name unless it's ambiguous. commit 6f3b3bef5e18e78619959613e28064eb6251ce27 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:16:47 2021 -0400 cleanup some auto complete rough edges commit 4988d8b266b8b11e519bcb5aab05ad2c3ffe5c23 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:16:24 2021 -0400 fix commit 6d4bf94fd6b4850564b705ea15e91079b00346c2 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 19:13:28 2021 -0400 clean up autocomplete a little... commit 3722271e51d93599903bccc721dc1de61f0aae72 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 19:13:07 2021 -0400 move auto complete logic to SoftwareSet commit 04cc83ecbe9ee4c9100305712c47a11359327734 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 20:46:39 2021 -0400 software - keep the list name to differentiate in case of name clashes. commit 8e5b5dc7e283f760a16011308298e999110fc052 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 20:45:13 2021 -0400 Autocomplete - limit menu content width to the clip view content width. prevents horizontal scrolling. commit 356048d450447485bb33a4261018f85dac19a134 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:45:42 2021 -0400 add auto complete software list to the launch window. commit 9dc72b702c9b36d490349f291c10b98b56178567 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:44:28 2021 -0400 autocomplete control. commit 40eee83f56d957c64e0f8d927486f13165b9e120 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:39:32 2021 -0400 add filters to software list. commit cebfbaa545441f061cffafe8ca93db2377240a06 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun May 23 11:59:00 2021 -0400 add compatibility field for software list filtering.
2021-05-27 23:42:28 +00:00
enum { max_haystack_length = 256, max_needle_length = 256 };
unichar needle_data[max_needle_length];
if (!_items) return @[];
Squashed commit of the following: commit 78c81626670fdf41fa6bdd71a4243a89a0746615 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon Jun 7 00:33:48 2021 -0400 check if software set has a particular entry. commit ef5ab6b6948dc3bbbe2947ea099fcacd08435e86 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Jun 6 22:20:34 2021 -0400 fix scroller background on recent disk images window. commit dee56fa50e87299b396b48361bd0a780aaaaa768 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Jun 6 21:26:23 2021 -0400 update cheat sheet javascript to work with 10.11 * => functions not supported * NodeList.prototype.forEach not supported. commit b00cc05413f4ebd6d6d58f96e24303008608f3a6 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Jun 6 17:10:41 2021 -0400 default full machine name for bookmark entry. commit a671cafdc98051b56b12cdd3ccd13c22f54f605a Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Jun 6 15:39:32 2021 -0400 loading a bookmark wasn't updating the media. commit 3000e0eb1b10bede3345aaab8478e9ec209f328c Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Jun 6 15:38:53 2021 -0400 bump copyright year. commit 45222dacd4aa0047fae63a9112509de57139df63 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Jun 6 13:38:23 2021 -0400 add reset w/ value for setting the item explicitely. commit cc7fde1253b71c4d8655eb4c010bbf4e61333a15 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Jun 6 13:37:48 2021 -0400 add checkboxes for bitbanger/share directory. The general idea is it's easier to toggle a checkbox than to type/retype a path. commit 5674b2d7f6b0e2f0b973197bf3493ad61bf46428 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sat Jun 5 19:11:43 2021 -0400 commentary on searches with diacritics. commit ec60634dcd9c573130dc34673b4d3fe597ea2b42 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sat Jun 5 19:11:22 2021 -0400 clean up auto-complete a little bit when setting a value directly. commit 1a182bbdab237c89d355d8294b5a4a64b785783a Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sat Jun 5 13:08:29 2021 -0400 fix text color when value is set. There are still some bugs relating to multiple copies of the value being stored. commit 49c0bc15c73446259d8cc151cf52d6058644db76 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sat Jun 5 12:09:44 2021 -0400 reset all controls first. commit 059797ad85b057e296cc707b4645f839bfccac13 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sat Jun 5 10:52:06 2021 -0400 more bookmark loading. commit e5a612d9f8e7414dd15c66dbaa540b637765eeec Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri Jun 4 23:52:38 2021 -0400 bookmark - restore the software commit f9411a1e84df7bd46e352cc5ca995b585c2a0523 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri Jun 4 23:52:25 2021 -0400 clean up software / name logic. commit f628d99e4a70d65ea8703f3c182103cd3bfea969 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri Jun 4 00:21:08 2021 -0400 load bookmark... commit 0b248e6aad16cba848f88d294a1366cea5760aa0 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri Jun 4 00:20:42 2021 -0400 stringValue can't be nil. commit 94aac38af45c3c95cb86b176393a469279c2539e Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Thu Jun 3 23:04:37 2021 -0400 add bookmark menu commit 6215a0df120b6cd97f1ffea2d2db9aaa5ae61f29 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Thu Jun 3 23:03:29 2021 -0400 slot view needs to know the machine. commit d348c15dc56d9cee01e5417435dd236e0e541902 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Thu Jun 3 23:02:58 2021 -0400 transformer to enable/disable control based on string length. commit e14336a0094af7aa84e91da69ff59ebb9e8eea9b Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Thu Jun 3 23:02:14 2021 -0400 shut up compiler warning. commit 4baf545245d8d3debf8f436b36b14cca23bf7a33 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Thu Jun 3 23:01:15 2021 -0400 bookmark manager commit 0f3e6c83075a145a456728b57a499cfa35707002 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 31 23:54:29 2021 -0400 more (untested) bookmark code commit 8fdb149eb38952b13c4a78d7a6940c43d90870f1 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 31 16:13:43 2021 -0400 start of bookmarking support. Untested. commit 787eac87f6ac13cd677630cbaf2538cecab27b1f Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 31 16:12:45 2021 -0400 shut up warnings about content clipping. maybe it's a 10.11 thing. The size was chosen by interface builder.
2021-06-07 04:34:26 +00:00
//string = [string stringByApplyingTransform: NSStringTransformStripDiacritics reverse: NO];
Squashed commit of the following: commit 1dd1d6d3eee928d283dafbaf4432b053dff65ac2 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Thu May 27 13:30:38 2021 -0400 0.232 rom update commit cfb7f9a4d1647c41fab3328bada0f37bdb041983 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Wed May 26 20:31:16 2021 -0400 fix resizing to prevent horizontal scrolling commit 5c393ab5a95c9e53c4ef1e0b3f2b77db93e1c29b Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Wed May 26 20:01:48 2021 -0400 esc should close the menu if visible, otherwise clear the text. commit 7da142b64280c39e216584cedb7fb14243d573f0 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:17:10 2021 -0400 show software short name unless it's ambiguous. commit 6f3b3bef5e18e78619959613e28064eb6251ce27 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:16:47 2021 -0400 cleanup some auto complete rough edges commit 4988d8b266b8b11e519bcb5aab05ad2c3ffe5c23 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 23:16:24 2021 -0400 fix commit 6d4bf94fd6b4850564b705ea15e91079b00346c2 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 19:13:28 2021 -0400 clean up autocomplete a little... commit 3722271e51d93599903bccc721dc1de61f0aae72 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue May 25 19:13:07 2021 -0400 move auto complete logic to SoftwareSet commit 04cc83ecbe9ee4c9100305712c47a11359327734 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 20:46:39 2021 -0400 software - keep the list name to differentiate in case of name clashes. commit 8e5b5dc7e283f760a16011308298e999110fc052 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 20:45:13 2021 -0400 Autocomplete - limit menu content width to the clip view content width. prevents horizontal scrolling. commit 356048d450447485bb33a4261018f85dac19a134 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:45:42 2021 -0400 add auto complete software list to the launch window. commit 9dc72b702c9b36d490349f291c10b98b56178567 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:44:28 2021 -0400 autocomplete control. commit 40eee83f56d957c64e0f8d927486f13165b9e120 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon May 24 18:39:32 2021 -0400 add filters to software list. commit cebfbaa545441f061cffafe8ca93db2377240a06 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun May 23 11:59:00 2021 -0400 add compatibility field for software list filtering.
2021-05-27 23:42:28 +00:00
NSUInteger needle_length = [string length];
needle_length = MIN(needle_length, max_needle_length);
[string getCharacters: needle_data range: NSMakeRange(0, needle_length)];
for (NSUInteger i = 0; i < needle_length; ++i)
needle_data[i] = towlower(needle_data[i]);
string = InternString([NSString stringWithCharacters: needle_data length: needle_length]);
NSArray *a = [_cache objectForKey: string];
if (a) return a;
NSMutableArray *rv = [NSMutableArray new];
if (needle_length == 0) {
for(SoftwareList *list in _items) {
[rv addObject: list];
[rv addObjectsFromArray: [list items]];
}
[_cache setObject: rv forKey: string];
return rv;
}
//if (needle_length < 2) return nil;
const unichar *needle_data_ptr = needle_data;
NSPredicate *p = [NSPredicate predicateWithBlock: ^BOOL(Software *o, NSDictionary *bindings){
// prefix match.
unichar haystack_data[max_haystack_length];
NSString *haystack;
NSUInteger length;
haystack = [o name];
length = [haystack length];
length = MIN(length, max_haystack_length);
if (length >= needle_length) {
[haystack getCharacters: haystack_data range: NSMakeRange(0, length)];
for (NSUInteger i = 0; i < length; ++i)
haystack_data[i] = towlower(haystack_data[i]);
if (!memcmp(haystack_data, needle_data_ptr, needle_length * sizeof(unichar))) return YES;
}
haystack = [o title];
length = [haystack length];
length = MIN(length, max_haystack_length);
if (length >= needle_length) {
[haystack getCharacters: haystack_data range: NSMakeRange(0, length)];
for (NSUInteger i = 0; i < length; ++i)
haystack_data[i] = towlower(haystack_data[i]);
if (!memcmp(haystack_data, needle_data_ptr, needle_length * sizeof(unichar))) return YES;
}
return NO;
}];
for (SoftwareList *list in _items) {
NSArray *items = [list items];
NSArray *tmp = [items filteredArrayUsingPredicate: p];
// add header ... ?
if (![tmp count]) continue;
[rv addObject: list]; // header
[rv addObjectsFromArray: tmp];
}
[_cache setObject: rv forKey: string];
return rv;
}
@end