Feed icons! '/favicon.ico' download, storage and display.
This commit is contained in:
@@ -33,4 +33,5 @@
|
||||
- (NSArray<FeedArticle*>*)sortedArticles;
|
||||
- (int)markAllItemsRead;
|
||||
- (int)markAllItemsUnread;
|
||||
- (NSImage*)iconImage16;
|
||||
@end
|
||||
|
||||
@@ -21,11 +21,14 @@
|
||||
// SOFTWARE.
|
||||
|
||||
#import "Feed+Ext.h"
|
||||
#import "Constants.h"
|
||||
#import "DrawImage.h"
|
||||
#import "FeedMeta+Ext.h"
|
||||
#import "FeedGroup+Ext.h"
|
||||
#import "FeedIcon+CoreDataClass.h"
|
||||
#import "FeedArticle+CoreDataClass.h"
|
||||
#import "Constants.h"
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import <RSXML/RSXML.h>
|
||||
|
||||
@implementation Feed (Ext)
|
||||
@@ -214,4 +217,19 @@
|
||||
return newCount - oldCount;
|
||||
}
|
||||
|
||||
/**
|
||||
@return Return @c 16x16px image. Either from core data storage or generated default RSS icon.
|
||||
*/
|
||||
- (NSImage*)iconImage16 {
|
||||
NSData *imgData = self.icon.icon;
|
||||
if (imgData) {
|
||||
return [[NSImage alloc] initWithData:imgData];
|
||||
} else {
|
||||
static NSImage *defaultRSSIcon;
|
||||
if (!defaultRSSIcon)
|
||||
defaultRSSIcon = [RSSIcon iconWithSize:16];
|
||||
return defaultRSSIcon;
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -33,6 +33,7 @@ typedef NS_ENUM(int16_t, FeedGroupType) {
|
||||
|
||||
+ (instancetype)newGroup:(FeedGroupType)type inContext:(NSManagedObjectContext*)context;
|
||||
- (void)setName:(NSString*)name andRefreshString:(NSString*)refreshStr;
|
||||
- (NSImage*)groupIconImage16;
|
||||
// Handle children and parents
|
||||
- (NSString*)indexPathString;
|
||||
- (NSMutableArray<FeedGroup*>*)allParents;
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
#import "FeedMeta+Ext.h"
|
||||
#import "Feed+Ext.h"
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@implementation FeedGroup (Ext)
|
||||
/// Enum tpye getter see @c FeedGroupType
|
||||
- (FeedGroupType)typ { return (FeedGroupType)self.type; }
|
||||
@@ -46,6 +48,16 @@
|
||||
if (![self.refreshStr isEqualToString:refreshStr]) self.refreshStr = refreshStr;
|
||||
}
|
||||
|
||||
/// @return Return static @c 16x16px NSImageNameFolder image.
|
||||
- (NSImage*)groupIconImage16 {
|
||||
static NSImage *groupIcon;
|
||||
if (!groupIcon) {
|
||||
groupIcon = [NSImage imageNamed:NSImageNameFolder];
|
||||
groupIcon.size = NSMakeSize(16, 16);
|
||||
}
|
||||
return groupIcon;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Handle Children And Parents -
|
||||
|
||||
|
||||
Reference in New Issue
Block a user