}
virtual void Fail(pkgAcquire::ItemDesc &item) {
- [delegate_ performSelectorOnMainThread:@selector(setStatusFail) withObject:nil waitUntilDone:YES];
+ if (
+ item.Owner->Status == pkgAcquire::Item::StatIdle ||
+ item.Owner->Status == pkgAcquire::Item::StatDone
+ )
+ return;
+
+ [delegate_ setError:[NSString stringWithCString:item.Owner->ErrorText.c_str()]];
}
virtual bool Pulse(pkgAcquire *Owner) {
UITextLabel *name_;
UIRightTextLabel *version_;
UITextLabel *description_;
+ id delegate_;
}
- (void) dealloc;
-- (PackageCell *) initWithPackage:(Package *)package delegate:(id)delegate;
+- (PackageCell *) initWithDelegate:(id)delegate;
+- (void) setPackage:(Package *)package;
- (void) _setSelected:(float)fraction;
- (void) setSelected:(BOOL)selected;
[super dealloc];
}
-- (PackageCell *) initWithPackage:(Package *)package delegate:(id)delegate {
+- (PackageCell *) initWithDelegate:(id)delegate {
if ((self = [super init]) != nil) {
+ delegate_ = delegate;
+
GSFontRef bold = GSFontCreateWithName("Helvetica", kGSFontTraitBold, 22);
GSFontRef large = GSFontCreateWithName("Helvetica", kGSFontTraitNone, 16);
GSFontRef small = GSFontCreateWithName("Helvetica", kGSFontTraitNone, 14);
name_ = [[UITextLabel alloc] initWithFrame:CGRectMake(12, 7, 250, 25)];
[name_ setBackgroundColor:CGColorCreate(space, clear)];
[name_ setFont:bold];
- [name_ setText:[package name]];
version_ = [[UIRightTextLabel alloc] initWithFrame:CGRectMake(290, 7, 70, 25)];
[version_ setBackgroundColor:CGColorCreate(space, clear)];
[version_ setFont:large];
- [version_ setText:[delegate versionWithPackage:package]];
description_ = [[UITextLabel alloc] initWithFrame:CGRectMake(13, 35, 315, 20)];
[description_ setBackgroundColor:CGColorCreate(space, clear)];
[description_ setFont:small];
- [description_ setText:[package tagline]];
[self addSubview:name_];
[self addSubview:version_];
} return self;
}
+- (void) setPackage:(Package *)package {
+ [name_ setText:[package name]];
+ [version_ setText:[delegate_ versionWithPackage:package]];
+ [description_ setText:[package tagline]];
+}
+
- (void) _setSelected:(float)fraction {
CGColorSpaceRef space = CGColorSpaceCreateDeviceRGB();
UITextView *output_;
UITextLabel *status_;
id delegate_;
- UIAlertSheet *alert_;
}
- (void) dealloc;
- (void) addOutput:(NSString *)output;
- (void) _addOutput:(NSString *)output;
-
-- (void) setStatusFail;
@end
@protocol ProgressViewDelegate
- (ProgressView *) initWithFrame:(struct CGRect)frame delegate:(id)delegate {
if ((self = [super initWithFrame:frame]) != nil) {
delegate_ = delegate;
- alert_ = nil;
CGColorSpaceRef space = CGColorSpaceCreateDeviceRGB();
float black[] = {0.0, 0.0, 0.0, 1.0};
}
- (void) alertSheet:(UIAlertSheet *)sheet buttonClicked:(int)button {
- [alert_ dismiss];
- [alert_ release];
- alert_ = nil;
+ [sheet dismiss];
}
- (void) _retachThread {
];
}
-- (void) setStatusFail {
-}
-
- (void) setError:(NSString *)error {
[self
performSelectorOnMainThread:@selector(_setError:)
}
- (void) _setError:(NSString *)error {
- _assert(alert_ == nil);
-
- alert_ = [[UIAlertSheet alloc]
+ UIAlertSheet *sheet = [[[UIAlertSheet alloc]
initWithTitle:@"Package Error"
buttons:[NSArray arrayWithObjects:@"Okay", nil]
defaultButtonIndex:0
delegate:self
context:self
- ];
+ ] autorelease];
- [alert_ setBodyText:error];
- [alert_ popupAlertAnimated:YES];
+ [sheet setBodyText:error];
+ [sheet popupAlertAnimated:YES];
}
- (void) setTitle:(NSString *)title {
- (int) numberOfRowsInTable:(UITable *)table;
- (float) table:(UITable *)table heightForRow:(int)row;
-- (UITableCell *) table:(UITable *)table cellForRow:(int)row column:(UITableColumn *)col;
+- (UITableCell *) table:(UITable *)table cellForRow:(int)row column:(UITableColumn *)col reusing:(UITableCell *)reusing;
- (BOOL) table:(UITable *)table showDisclosureForRow:(int)row;
- (void) tableRowSelected:(NSNotification*)notification;
return 64;
}
-- (UITableCell *) table:(UITable *)table cellForRow:(int)row column:(UITableColumn *)col {
- return [[[PackageCell alloc] initWithPackage:[packages_ objectAtIndex:row] delegate:self] autorelease];
+- (UITableCell *) table:(UITable *)table cellForRow:(int)row column:(UITableColumn *)col reusing:(UITableCell *)reusing {
+ if (reusing == nil)
+ reusing = [[PackageCell alloc] initWithDelegate:self];
+ [(PackageCell *)reusing setPackage:[packages_ objectAtIndex:row]];
+ return reusing;
}
- (BOOL) table:(UITable *)table showDisclosureForRow:(int)row {
[table setSeparatorStyle:1];
[table addTableColumn:column];
[table setDelegate:self];
+ [table setReusesTableCells:YES];
pkgview_ = [[PackageView alloc] initWithFrame:[transition_ bounds] database:database_];
} return self;
UITransitionView *transition_;
UIButtonBar *buttonbar_;
- UIAlertSheet *alert_;
ConfirmationView *confirm_;
Database *database_;
break;
case 1:
- _assert(alert_ == nil);
-
- alert_ = [[UIAlertSheet alloc]
+ UIAlertSheet *sheet = [[[UIAlertSheet alloc]
initWithTitle:@"About Cydia Packager"
buttons:[NSArray arrayWithObjects:@"Close", nil]
defaultButtonIndex:0
delegate:self
context:self
- ];
+ ] autorelease];
- [alert_ setBodyText:
+ [sheet setBodyText:
@"Copyright (C) 2007\n"
"Jay Freeman (saurik)\n"
"saurik@saurik.com\n"
"lounger, rockabilly, tman, Wbiggs"
];
- [alert_ presentSheetFromButtonBar:buttonbar_];
+ [sheet presentSheetFromButtonBar:buttonbar_];
break;
}
}
- (void) alertSheet:(UIAlertSheet *)sheet buttonClicked:(int)button {
- [alert_ dismiss];
- [alert_ release];
- alert_ = nil;
+ [sheet dismiss];
}
- (void) buttonBarItemTapped:(id)sender {
_assert(pkgInitConfig(*_config));
_assert(pkgInitSystem(*_config, _system));
- alert_ = nil;
confirm_ = nil;
CGRect screenrect = [UIHardware fullScreenApplicationContentRect];