(trunk) replace the tr_metainfo_builder.isSingleFile and tr_info.isMultifile fields an 'isFolder' bool in both structs.
This makes the variable naming more uniform. It also clarifies the information we're really trying to convey -- previously, isSingleFile was false whenever the torrent held a directory tree, even if there was only a single file in the tree. Sync the Mac OS X client's use to match the libtransmission variable names.
This commit is contained in:
parent
db8a589ec4
commit
e40a7d5359
|
@ -126,7 +126,7 @@ tr_metaInfoBuilderCreate (const char * topFileArg)
|
|||
{
|
||||
struct stat sb;
|
||||
stat (topFile, &sb);
|
||||
ret->isSingleFile = !S_ISDIR (sb.st_mode);
|
||||
ret->isFolder = S_ISDIR (sb.st_mode);
|
||||
}
|
||||
|
||||
/* build a list of files containing topFile and,
|
||||
|
@ -334,11 +334,7 @@ makeInfoDict (tr_variant * dict,
|
|||
|
||||
tr_variantDictReserve (dict, 5);
|
||||
|
||||
if (builder->isSingleFile)
|
||||
{
|
||||
tr_variantDictAddInt (dict, TR_KEY_length, builder->files[0].size);
|
||||
}
|
||||
else /* root node is a directory */
|
||||
if (builder->isFolder) /* root node is a directory */
|
||||
{
|
||||
uint32_t i;
|
||||
tr_variant * list = tr_variantDictAddList (dict, TR_KEY_files,
|
||||
|
@ -351,6 +347,10 @@ makeInfoDict (tr_variant * dict,
|
|||
getFileInfo (builder->top, &builder->files[i], length, pathVal);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
tr_variantDictAddInt (dict, TR_KEY_length, builder->files[0].size);
|
||||
}
|
||||
|
||||
base = tr_basename (builder->top);
|
||||
tr_variantDictAddStr (dict, TR_KEY_name, base);
|
||||
|
|
|
@ -45,7 +45,7 @@ typedef struct tr_metainfo_builder
|
|||
uint32_t fileCount;
|
||||
uint32_t pieceSize;
|
||||
uint32_t pieceCount;
|
||||
bool isSingleFile;
|
||||
bool isFolder;
|
||||
|
||||
/**
|
||||
*** These are set inside tr_makeMetaInfo ()
|
||||
|
|
|
@ -1836,7 +1836,7 @@ struct tr_info
|
|||
|
||||
/* Flags */
|
||||
bool isPrivate;
|
||||
bool isMultifile;
|
||||
bool isFolder;
|
||||
};
|
||||
|
||||
static inline bool tr_torrentHasMetadata (const tr_torrent * tor)
|
||||
|
|
|
@ -953,7 +953,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
|
|||
|
||||
//determine to show the options window
|
||||
const BOOL showWindow = type == ADD_SHOW_OPTIONS || ([fDefaults boolForKey: @"DownloadAsk"]
|
||||
&& (info.isMultifile || ![fDefaults boolForKey: @"DownloadAskMulti"])
|
||||
&& (info.isFolder || ![fDefaults boolForKey: @"DownloadAskMulti"])
|
||||
&& (type != ADD_AUTO || ![fDefaults boolForKey: @"DownloadAskManual"]));
|
||||
tr_metainfoFree(&info);
|
||||
|
||||
|
|
|
@ -150,7 +150,7 @@
|
|||
[fNameField setStringValue: name];
|
||||
[fNameField setToolTip: [fPath path]];
|
||||
|
||||
const BOOL multifile = !fInfo->isSingleFile;
|
||||
const BOOL multifile = fInfo->isFolder;
|
||||
|
||||
NSImage * icon = [[NSWorkspace sharedWorkspace] iconForFileType: multifile
|
||||
? NSFileTypeForHFSTypeCode(kGenericFolderIcon) : [fPath pathExtension]];
|
||||
|
|
|
@ -110,7 +110,7 @@
|
|||
if (count == 1)
|
||||
{
|
||||
name = [NSString stringWithUTF8String: info.name];
|
||||
folder = info.isMultifile;
|
||||
folder = info.isFolder;
|
||||
}
|
||||
}
|
||||
tr_metainfoFree(&info);
|
||||
|
|
|
@ -60,13 +60,13 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview,
|
|||
NSMutableDictionary * allImgProps = [NSMutableDictionary dictionary];
|
||||
|
||||
NSString * name = [NSString stringWithUTF8String: inf.name];
|
||||
NSString * fileTypeString = inf.isMultifile ? NSFileTypeForHFSTypeCode(kGenericFolderIcon) : [name pathExtension];
|
||||
NSString * fileTypeString = inf.isFolder ? NSFileTypeForHFSTypeCode(kGenericFolderIcon) : [name pathExtension];
|
||||
|
||||
const NSUInteger width = 32;
|
||||
[htmlString appendFormat: @"<h2><img class=\"icon\" src=\"%@\" width=\"%ld\" height=\"%ld\" />%@</h2>", generateIconData(fileTypeString, width, allImgProps), width, width, name];
|
||||
|
||||
NSString * fileSizeString = [NSString stringForFileSize: inf.totalSize];
|
||||
if (inf.isMultifile)
|
||||
if (inf.isFolder)
|
||||
{
|
||||
NSString * fileCountString;
|
||||
if (inf.fileCount == 1)
|
||||
|
@ -132,7 +132,7 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview,
|
|||
[lists addObject: listSection];
|
||||
}
|
||||
|
||||
if (inf.isMultifile)
|
||||
if (inf.isFolder)
|
||||
{
|
||||
NSMutableString * listSection = [NSMutableString string];
|
||||
[listSection appendString: @"<table>"];
|
||||
|
|
|
@ -642,7 +642,7 @@ int trashDataFile(const char * filename)
|
|||
|
||||
- (BOOL) isFolder
|
||||
{
|
||||
return fInfo->isMultifile;
|
||||
return fInfo->isFolder;
|
||||
}
|
||||
|
||||
- (uint64_t) size
|
||||
|
|
Loading…
Reference in New Issue