Changeset 49

Show
Ignore:
Timestamp:
08/14/06 22:09:30 (2 years ago)
Author:
cordney
Message:

[new] downloader: new download list according to new oszoo pages, moved list to new server
[fix] Makefile: use -lcrypto instead of full path to libcrypto
[new] credits: licenses
[new] downloader: if there is a README file with the downloaded Guest PC, open it in TextEdit? after download is finished
[fix] downloader: leave all files from the downloaded archive in qvm package
[fix] downloader: finding a folder with .img or .qcow in it's name sets it not as harddisk anymore
[fix] downloader: add support for gzip files, throw warning when archive is corrupt
[fix] downloader: downloaded progress not reset when download cancelled or started again
[fix] downloader: set Transmission revision back to 480 (official version 0.6.1), now using only stable Transmission releases
[fix] downloader: cancel download when .torrent file could not be downloaded and show error message

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/prepare.sh

    r40 r49  
    33 
    44#get/update libtransmission 
    5 svn co -r 638 svn://svn.m0k.org/Transmission/trunk/ Transmission 
     5svn co -r 480 svn://svn.m0k.org/Transmission/trunk/ Transmission 
    66cp Transmission/mk/lib.mk Transmission/libtransmission/Makefile 
    77 
  • trunk/qcontrol/Makefile

    r39 r49  
    55 
    66qemu-control$(EXESUF): cocoaControlMain.m cocoaControlController.m cocoaControlDiskImage.m cocoaControlNewPCAssistant.m cocoaControlEditPC.m cocoaControlPreferences.m cocoaControlDOServer.m cocoaDownload.m cocoaDownloadController.m QControlTableView.m 
    7         gcc -Wall -O4 -F/System/Library/Frameworks -framework Carbon -framework Cocoa ../../Transmission/libtransmission/libtransmission.a /usr/lib/libcrypto.dylib -o $@ $^ 
     7        gcc -Wall -O4 -F/System/Library/Frameworks -framework Carbon -framework Cocoa ../../Transmission/libtransmission/libtransmission.a -lcrypto -o $@ $^ 
    88 
    99clean: 
  • trunk/qcontrol/Resources/Credits.html

    r7 r49  
    3636                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Heikki L (gcc3.4.5)<BR> 
    3737                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Katios (VNC)<BR> 
    38                 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Michael F (VNC) 
    39                  
     38                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Michael F (VNC)<BR> 
     39                <BR> 
     40                <B>Licenses</B><BR> 
     41                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Q is licensed under <A HREF="http://www.gnu.org/copyleft/gpl.html">GNU GPL</A><BR> 
     42                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Q artwork is licensed under a <A HREF="http://creativecommons.org/licenses/by-nc-nd/2.5/">Creative Commons License</A> 
    4043        </BODY> 
    4144</HTML> 
  • trunk/qcontrol/Resources/English.lproj/cocoaDownload.nib/classes.nib

    r7 r49  
    1212                mainDlWindow = id;  
    1313                osTypeSelect = id;  
     14                precheckPanel = id;  
     15                precheckStatusProgressView = id;  
     16                precheckStatusTextView = id;  
    1417                statusBar = id;  
    1518                statusText = id;  
  • trunk/qcontrol/Resources/English.lproj/cocoaDownload.nib/info.nib

    r7 r49  
    44<dict> 
    55        <key>IBDocumentLocation</key> 
    6         <string>69 54 356 240 0 0 1024 746 </string> 
     6        <string>95 57 356 240 0 0 1280 778 </string> 
    77        <key>IBEditorPositions</key> 
    88        <dict> 
    99                <key>57</key> 
    10                 <string>262 388 500 247 0 0 1024 746 </string> 
     10                <string>390 414 500 247 0 0 1280 778 </string> 
    1111        </dict> 
    1212        <key>IBFramework Version</key> 
    13         <string>443.0</string> 
     13        <string>446.1</string> 
    1414        <key>IBOpenObjects</key> 
    1515        <array> 
    1616                <integer>57</integer> 
     17                <integer>105</integer> 
     18                <integer>33</integer> 
    1719                <integer>5</integer> 
    18                 <integer>33</integer> 
    1920        </array> 
    2021        <key>IBSystem Version</key> 
    21         <string>8H14</string> 
     22        <string>8J2135a</string> 
    2223</dict> 
    2324</plist> 
  • trunk/qcontrol/cocoaControlController.m

    r47 r49  
    319319{ 
    320320//    NSLog(@"cocoaControlController: cycleWindows"); 
    321      
    322321    [qdoserver guestSwitch: @"Q Control" fullscreen:NO nextGuestName:nil]; 
    323322} 
     
    751750- (BOOL) importFreeOSZooPC:(NSString *)name withPath:(NSString *)path 
    752751{ 
    753        NSMutableDictionary * thisPC = [[[NSDictionary alloc] initWithObjects:[NSArray arrayWithObjects: 
     752    NSMutableDictionary * thisPC = [[[NSDictionary alloc] initWithObjects:[NSArray arrayWithObjects: 
    754753                [[NSMutableDictionary alloc] initWithObjects:[NSArray arrayWithObjects:@"Q", @"none", [NSDate date], @"Q guest PC from FreeOSZoo", nil] forKeys:[NSArray arrayWithObjects: @"Author", @"Copyright", @"Date", @"Description", nil]], 
    755754                [[NSMutableString alloc] initWithString:@" -m 128 -net user -boot c -localtime -smb ~/Desktop/Q Shared Files/"], 
     
    768767        BOOL foundHD = NO; 
    769768        BOOL foundDir = NO; 
     769        BOOL foundReadme = NO; 
    770770        NSFileManager * manager = [NSFileManager defaultManager]; 
    771771        NSArray * dirContents = [manager directoryContentsAtPath:path]; 
    772772        NSArray * subDir; 
    773         int i,ii
     773        int i,ii,j,k
    774774        for (i=0; i<=[dirContents count]-1; i++) { 
    775                 if ([[[dirContents objectAtIndex:i] pathExtension] isEqualToString:@"img"] || [[[dirContents objectAtIndex:i] pathExtension] isEqualToString:@"qcow"]) { 
     775                if (([[[dirContents objectAtIndex:i] pathExtension] isEqualToString:@"img"] || [[[dirContents objectAtIndex:i] pathExtension] isEqualToString:@"qcow"] || [[[dirContents objectAtIndex:i] pathExtension] isEqualToString:@"dsk"]) && (![[[manager fileAttributesAtPath:[path stringByAppendingPathComponent:[dirContents objectAtIndex:i]] traverseLink:NO] objectForKey:NSFileType] isEqualTo:NSFileTypeDirectory])) { 
    776776                        foundHD = YES; 
    777777                        break; 
     
    781781                        break; 
    782782                } else { 
    783                         NSLog(@"Found no image or folder."); 
     783                        //NSLog(@"Found no image or folder."); 
    784784                } 
    785785        } 
    786786 
    787787        if(foundHD) { 
    788                 [[thisPC objectForKey:@"Arguments"] appendFormat:[NSString stringWithFormat:@" -hda %@", [dirContents objectAtIndex:i]]]; 
     788           //if we found the hd image in the root folder, we only need to append -hda file to arguments 
     789           [[thisPC objectForKey:@"Arguments"] appendFormat:[NSString stringWithFormat:@" -hda %@", [dirContents objectAtIndex:i]]]; 
    789790        } else if(foundDir) { 
    790                 subDir = [manager directoryContentsAtPath:[path stringByAppendingPathComponent:[dirContents objectAtIndex:i]]]; 
    791                 for(ii=0; i<=[subDir count]-1; ii++) { 
     791           // if we found a folder, the hd should be in it 
     792           // if hd is found, move all files in the folder to root directory and delete folder 
     793           subDir = [manager directoryContentsAtPath:[path stringByAppendingPathComponent:[dirContents objectAtIndex:i]]]; 
     794           for(ii=0; i<=[subDir count]-1; ii++) { 
    792795                        // search for .img or .qcow 
    793796                        if([[[subDir objectAtIndex:ii] pathExtension] isEqualToString:@"img"] || [[[subDir objectAtIndex:i] pathExtension] isEqualToString:@"qcow"]) { 
    794797                                //NSLog(@"found HD in subdir!"); 
    795                                 // move hd to root dir and delete the folder 
    796                                 [manager movePath:[path stringByAppendingPathComponent:[[dirContents objectAtIndex:i] stringByAppendingPathComponent:[subDir objectAtIndex:ii]]] toPath:[path stringByAppendingPathComponent:[subDir objectAtIndex:ii]] handler:nil]; 
     798                                // move all files to root dir and delete the folder 
     799                                for(j=0; j<[subDir count]; j++) { 
     800                                    [manager movePath:[path stringByAppendingPathComponent:[[dirContents objectAtIndex:i] stringByAppendingPathComponent:[subDir objectAtIndex:j]]] toPath:[path stringByAppendingPathComponent:[subDir objectAtIndex:j]] handler:nil]; 
     801                                } 
    797802                                [manager removeFileAtPath:[path stringByAppendingPathComponent:[dirContents objectAtIndex:i]] handler:nil]; 
     803                                // append hd name to arguments 
    798804                                [[thisPC objectForKey:@"Arguments"] appendFormat:[NSString stringWithFormat:@" -hda %@", [subDir objectAtIndex:ii]]]; 
    799805                                foundHD = YES; 
     
    802808                } 
    803809        } 
     810         
     811        // search for a readme file, if found, open it with TextEdit 
     812        dirContents = [manager directoryContentsAtPath:path]; 
     813        for(k=0; k<[dirContents count]; k++) { 
     814           if([[dirContents objectAtIndex:k] isEqualToString:@"README"]) { 
     815               foundReadme = YES; 
     816               break; 
     817           } 
     818    } 
     819         
    804820        /* save Configuration */ 
    805821        [self savePCConfiguration:thisPC]; 
     
    807823        /* update Table */ 
    808824        [self loadConfigurations]; 
     825         
     826        /* open Readme */ 
     827        if(foundReadme) [[NSWorkspace sharedWorkspace] openFile:[path stringByAppendingPathComponent:@"README"] withApplication:@"TextEdit.app"]; 
     828         
    809829        return foundHD; 
    810830} 
     
    14941514        } 
    14951515    } else { 
    1496         [downloader showWindow]; 
     1516        [downloader initDownloadInterface]; 
    14971517    } 
    14981518     
  • trunk/qcontrol/cocoaDownload.m

    r30 r49  
    132132    NSString * torrentPath = [[self createQVM] stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.torrent", name]]; 
    133133    // we need to temporarily save the qvm path here, cause we need it later 
    134  
     134    savePath = torrentPath; 
     135    [savePath retain]; 
     136     
    135137    NSData * torrentFile = [NSData dataWithContentsOfURL:[NSURL URLWithString:url]]; 
     138    if([torrentFile length] == 0) { 
     139        [[NSNotificationCenter defaultCenter] postNotificationName:@"DownloadDidFail" object:self userInfo:[NSDictionary dictionaryWithObject:@"Could not download bittorrent meta file. Maybe the file doesn't exist anymore or the server is down." forKey:@"ERROR_DESCRIPTION"]]; 
     140        return; 
     141    } 
    136142    [torrentFile writeToFile:torrentPath atomically:YES]; 
    137143    tStat = nil; 
     
    147153        tStat = tr_torrentStat( tHandle ); 
    148154        tInfo = tr_torrentInfo ( tHandle ); 
     155        tr_torrentRemoveSaved( tHandle ); 
    149156        // set the save path 
     157        [savePath release]; 
    150158        savePath = [[torrentPath stringByDeletingLastPathComponent] stringByAppendingPathComponent:[NSString stringWithUTF8String:tInfo[0].name]]; 
    151159        [savePath retain]; 
     
    185193        tr_torrentClose( fHandle, tHandle ); 
    186194        tr_close( fHandle ); 
     195        fHandle = nil; 
     196        tHandle = nil; 
    187197        [fTimer invalidate]; 
    188198    } 
     
    256266    tInfo = tr_torrentInfo( tHandle ); 
    257267     
    258     receivedContentLength = tStat[0].downloaded; 
     268    NSLog(@"rcvCL: %f", receivedContentLength); 
     269    receivedContentLength = tInfo[0].totalSize * tStat[0].progress; 
    259270    expectedContentLength = tInfo[0].totalSize; 
    260271    downloadRate = tStat[0].rateDownload; 
  • trunk/qcontrol/cocoaDownloadController.h

    r19 r49  
    3636    IBOutlet id statusBar; 
    3737    IBOutlet id osTypeSelect; 
     38    IBOutlet id precheckPanel; 
     39    IBOutlet id precheckStatusTextView; 
     40    IBOutlet id precheckStatusProgressView; 
    3841     
    3942    IBOutlet id detailsNSView;    
     
    5457 
    5558// interface functions 
     59- (void) initDownloadInterface; 
    5660- (void) showWindow; 
    5761- (BOOL) returnShowsDetails; // returns whether the window shows details 
     
    5963- (void) resizeBig; // show detailsTextView 
    6064- (void) showAllDownloads; 
     65- (void) prepareOSTypeSelector; 
    6166- (IBAction) showDownloadsByType:(id)sender; 
    6267- (void) showDetails:(int)row; // show details of selected free os 
  • trunk/qcontrol/cocoaDownloadController.m

    r19 r49  
    4848- (void)awakeFromNib 
    4949{ 
    50     [self showAllDownloads]; 
    51     [table setDoubleAction:@selector(startDownload:)]; 
    52     [table setDelegate:self]; 
    53     [self showWindow]; 
     50    [self initDownloadInterface]; 
    5451} 
    5552 
    5653#pragma mark - 
    5754#pragma mark Interface Functions 
     55 
     56- (void) initDownloadInterface 
     57{ 
     58    [table setDoubleAction:@selector(startDownload:)]; 
     59    //[self showWindow]; 
     60    [self showAllDownloads]; 
     61} 
    5862 
    5963- (void) showWindow 
     
    109113    // load downloadLists 
    110114    // save an original of the list so we dont have to load it again 
    111     if(downloadOriginalList == nil) { 
    112         // first call in the class 
    113         downloadOriginalList = [[[NSMutableArray alloc] init] retain]; 
    114         downloadList = [[[NSMutableArray alloc] init] retain]; 
     115    if(downloadOriginalList == nil || [downloadOriginalList count] == 0) { 
     116        // first call in the class || call again when initially list not loaded 
     117        if(downloadOriginalList == nil) { 
     118            downloadOriginalList = [[[NSMutableArray alloc] init] retain]; 
     119            downloadList = [[[NSMutableArray alloc] init] retain]; 
     120        } 
    115121         
    116122        NSArray * dlList = [self getDownloadListFromServer]; 
    117         int i; 
    118123     
    119124        // copy downloadList 
    120          if(dlList != nil) { 
    121             for(i=0; i<=[dlList count]-1; i++) { 
    122                 // copy dlList from Server 
    123                 [downloadList addObject:[dlList objectAtIndex:i]]; 
    124             } 
    125         } 
    126      
     125        if(dlList != nil) { 
     126            [downloadList addObjectsFromArray:dlList]; 
     127            [self prepareOSTypeSelector]; 
     128            [self showWindow]; 
     129        } else { 
     130            // download list is nil, spawn error message 
     131            NSLog(@"Could not load list."); 
     132            NSBeginAlertSheet(@"Cannot show Guest PCs from free.oszoo.org.",@"OK",nil,nil,[controller mainWindow],self,nil,nil,nil,@"Couldn't get the list of downloadable Guest PCs from kju-app.org."); 
     133        } 
    127134        [downloadOriginalList addObjectsFromArray:downloadList]; 
    128135    } else { 
     136        // list is still there, we dont have to download it again 
    129137        // when we call it later we only need the original list 
    130138        [downloadList removeAllObjects]; 
    131139        [downloadList addObjectsFromArray:downloadOriginalList]; 
     140        [self showWindow]; 
    132141    } 
    133142    // force table reload 
     
    137146} 
    138147 
     148- (void) prepareOSTypeSelector 
     149{ 
     150    // fill 'all' and space 
     151    [osTypeSelect removeAllItems]; 
     152    [osTypeSelect addItemWithTitle:@"All"]; 
     153    [[osTypeSelect menu] addItem:[NSMenuItem separatorItem]]; 
     154    int i,j; 
     155    BOOL found = NO; 
     156    NSMutableArray * array = [NSMutableArray arrayWithCapacity:1]; 
     157    for(i=0; i<[downloadList count]; i++) { 
     158        // if the Category is not listed yet in array add it 
     159        for(j=0; j<[array count]; j++) { 
     160            // search array 
     161            if([[array objectAtIndex:j] isEqualTo:[[downloadList objectAtIndex:i] objectForKey:@"Category"]]) { 
     162                found = YES; 
     163            } 
     164        } 
     165        if(!found) [array addObject:[[downloadList objectAtIndex:i] objectForKey:@"Category"]]; 
     166        found = NO; 
     167    } 
     168     
     169    // add to selector 
     170    for(i=0; i<[array count]; i++) { 
     171        [osTypeSelect addItemWithTitle:[array objectAtIndex:i]]; 
     172    } 
     173} 
     174 
    139175- (IBAction) showDownloadsByType:(id)sender 
    140176{ 
     177    NSLog(@"showDownloadsByType:"); 
    141178    // method for the popupbutton to select os type 
     179    NSMutableArray * array = [NSMutableArray arrayWithCapacity:1]; 
    142180    if([[osTypeSelect titleOfSelectedItem] isEqualToString:@"All"]) { 
    143         [self showAllDownloads]; 
     181        //NSLog(@"dlO: %@", downloadOriginalList); 
     182        [array addObjectsFromArray:downloadOriginalList]; 
    144183    } else { 
    145184        // be sure that we have the original downloadList here 
     
    147186        [downloadList addObjectsFromArray:downloadOriginalList]; 
    148187        int i; 
    149         NSMutableArray * array = [NSMutableArray arrayWithCapacity:1]; 
    150188        for (i=0; i<=[downloadList count]-1; i++) { 
    151189            // search for ostype and add equalling entries 
    152             if ([[[downloadList objectAtIndex:i] valueForKey:@"ostype"] isEqualTo:[osTypeSelect titleOfSelectedItem]]) { 
     190            if ([[[downloadList objectAtIndex:i] valueForKey:@"Category"] isEqualTo:[osTypeSelect titleOfSelectedItem]]) { 
    153191                [array addObject:[downloadList objectAtIndex:i]]; 
    154192            } 
    155193        } 
     194    } 
     195     
     196    // write os by found criteria/original downloads into downloadList 
     197    [downloadList removeAllObjects]; 
     198    [downloadList addObjectsFromArray:array]; 
    156199         
    157         // write os by found criteria into downloadList 
    158         [downloadList removeAllObjects]; 
    159         [downloadList addObjectsFromArray:array]; 
    160          
    161         // force table reload 
    162         [table reloadData]; 
    163         // force showDetails update 
    164         if([self returnShowsDetails]) [self showDetails:[table selectedRow]]; 
    165     } 
     200    // force table reload 
     201    [table reloadData]; 
     202    // force showDetails update 
     203    if([self returnShowsDetails]) [self showDetails:[table selectedRow]]; 
    166204} 
    167205 
     
    233271        if ([[tableColumn identifier] isEqualToString:@"name"]) { 
    234272           // return name and version  
    235            NSMutableAttributedString *attrString = [[[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat: @"%@ %@\n", [thisDownload objectForKey:@"name"], [thisDownload objectForKey:@"version"]] attributes:[NSDictionary dictionaryWithObject: [NSFont boldSystemFontOfSize:[NSFont systemFontSize]] forKey:NSFontAttributeName]] autorelease]; 
    236            [attrString appendAttributedString: [[[NSAttributedString alloc] initWithString:[NSString stringWithFormat: @"%@, %@. Download Size: %@ MB\nprovided by %@.", [thisDownload objectForKey:@"ostype"], [thisDownload objectForKey:@"installtype"], [thisDownload objectForKey:@"size"], [thisDownload objectForKey:@"author"]] attributes:[NSDictionary dictionaryWithObject:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]] forKey:NSFontAttributeName]] autorelease]]; 
     273           NSMutableAttributedString *attrString = [[[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat: @"%@ %@\n", [thisDownload objectForKey:@"Name"], [thisDownload objectForKey:@"Version"]] attributes:[NSDictionary dictionaryWithObject: [NSFont boldSystemFontOfSize:[NSFont systemFontSize]] forKey:NSFontAttributeName]] autorelease]; 
     274           [attrString appendAttributedString: [[[NSAttributedString alloc] initWithString:[NSString stringWithFormat: @"%@, %@. Download Size: %@ MB\nprovided by %@.", [thisDownload objectForKey:@"Category"], [thisDownload objectForKey:@"InstallType"], [thisDownload objectForKey:@"DownloadSize"], [thisDownload objectForKey:@"Author"]] attributes:[NSDictionary dictionaryWithObject:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]] forKey:NSFontAttributeName]] autorelease]]; 
    237275            
    238276                return attrString; 
     
    263301- (NSArray *)getDownloadListFromServer 
    264302{ 
    265     // TODO: change to arrayWithContentsOfURL: url 
    266     NSArray * downloadList = [NSArray arrayWithContentsOfURL:[NSURL URLWithString:@"http://cordney.com/q/freeoszoo.plist"]]; 
     303    // show status panel 
     304    /*[NSApp beginSheet:precheckPanel 
     305        modalForWindow:mainDlWindow 
     306        modalDelegate:nil 
     307        didEndSelector:nil 
     308        contextInfo:nil]; 
     309    [precheckPanel orderFront:self]; 
     310    //[NSApp runModalForWindow: precheckPanel]; 
     311    [precheckStatusTextView setStringValue:@"Getting list from server.."]; 
     312    [precheckStatusProgressView startAnimation:self]; 
     313    // arrayWithContentsOfURL: url 
     314    NSURLResponse * response; 
     315    NSError * error; 
     316    NSData * data = [NSURLConnection sendSynchronousRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://cordney.com/q/freeoszoo.plist"]] returningResponse:nil error:nil]; 
     317    NSArray * downloadList = [NSPropertyListSerialization propertyListFromData:data mutabilityOption:NSPropertyListMutableContainersAndLeaves format:nil errorDescription:nil]; 
     318    */ 
     319    NSArray * downloadList = [NSArray arrayWithContentsOfURL:[NSURL URLWithString:@"http://kju-app.org/data/freeoszoo.plist"]]; 
    267320    return downloadList; 
    268321} 
     322 
     323// NSURLHandleClient This informal protocol defines the interface for clients to NSURL. A client is an object loading a URL resource in the background. 
     324/* 
     325- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data 
     326{    
     327    NSLog(@"Data available.."); 
     328    //[[NSRunLoop currentRunLoop] runUntilDate:[NSDate distantPast]]; 
     329} 
     330-(void)connectionDidFinishLoading:(NSURLConnection *)connection 
     331{ 
     332    NSLog(@"Download finished"); 
     333    [precheckStatusTextView setStringValue:@"Got list from server.."]; 
     334    // todo: connectivity check freeoszoo.org 
     335    [NSApp endSheet:precheckPanel]; 
     336    //[NSApp stopModal]; 
     337    [precheckPanel orderOut:self]; 
     338    [precheckStatusTextView setStringValue:@"Loading.."]; 
     339    [precheckStatusProgressView stopAnimation:self]; 
     340    [table reloadData]; 
     341} 
     342 
     343- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error 
     344{ 
     345    NSLog(@"Download failed: %@", error); 
     346} 
     347*/ 
    269348 
    270349- (void) showDetails:(int)row 
     
    277356    // create name and version 
    278357    NSDictionary * nameAttr = [NSDictionary dictionaryWithObject:[NSFont boldSystemFontOfSize:12] forKey:NSFontAttributeName]; 
    279     NSAttributedString * detailsName = [[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@ %@", [details objectForKey:@"name"], [details objectForKey:@"version"]] attributes:nameAttr]; 
    280     NSAttributedString * detailsDesc = [[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@"\n%@", [details objectForKey:@"description"]]]; 
    281     NSAttributedString * detailsURLpre = [[NSAttributedString alloc] initWithString:@"\nWeb: "]; 
    282     NSAttributedString * detailsURL = [[NSAttributedString alloc] initWithString:[details objectForKey:@"weburl"] attributes:[NSDictionary dictionaryWithObject:[details objectForKey:@"weburl"] forKey:NSLinkAttributeName]]; 
     358    NSAttributedString * detailsName = [[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@ %@", [details objectForKey:@"Name"], [details objectForKey:@"Version"]] attributes:nameAttr]; 
     359    NSAttributedString * detailsDesc = [[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@"\n%@", [details objectForKey:@"Description"]]]; 
     360    NSAttributedString * detailsURLpre = [[NSAttributedString alloc] initWithString:@"\nMore Info: "]; 
     361    NSAttributedString * detailsURL = [[NSAttributedString alloc] initWithString:[details objectForKey:@"InfopageURL"] attributes:[NSDictionary dictionaryWithObject:[details objectForKey:@"InfopageURL"] forKey:NSLinkAttributeName]]; 
    283362    // create spacer 
    284363    NSAttributedString * spacer = [[NSAttributedString alloc] initWithString:@"\n"]; 
     
    319398        } 
    320399        if([[thisDownload objectForKey:@"version"] isEqualToString:@""]) { 
    321             [download setName:[thisDownload objectForKey:@"name"]]; 
     400            [download setName:[thisDownload objectForKey:@"Name"]]; 
    322401        } else { 
    323             [download setName:[NSString stringWithFormat:@"%@ %@", [thisDownload objectForKey:@"name"], [thisDownload objectForKey:@"version"]]]; 
    324         } 
    325         [download setURL:[thisDownload objectForKey:@"url"]]; 
     402            [download setName:[NSString stringWithFormat:@"%@ %@", [thisDownload objectForKey:@"Name"], [thisDownload objectForKey:@"Version"]]]; 
     403        } 
     404        [download setURL:[thisDownload objectForKey:@"DownloadURL"]]; 
    326405        // - monitor the download object with NSNotifications 
    327406        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(downloadDidReceiveResponse:) name:@"DownloadDidReceiveResponse" object:download]; 
     
    329408        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(downloadDidFinish:) name:@"DownloadDidFinish" object:download]; 
    330409        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(downloadDidFail:) name:@"DownloadDidFail" object:download]; 
    331                                                  
    332         [download startDownload]; 
    333          
     410                                                         
    334411        // 2. set to downloading mode 
    335412        [self disableTableView:YES]; 
     
    346423        [statusBar setIndeterminate:YES]; 
    347424        [statusBar startAnimation:self]; 
     425         
     426        [download startDownload]; 
    348427    } 
    349428} 
     
    469548- (void) downloadDidFail:(NSNotification *)aNotification 
    470549{ 
    471     // TODO: alert sheet 
    472     NSAlert *alert = [NSAlert alertWithMessageText:@"Download failed" 
    473                 defaultButton:@"OK" 
    474                 alternateButton:nil 
    475                 otherButton:nil 
    476                 informativeTextWithFormat:[[aNotification userInfo] objectForKey:@"ERROR_DESCRIPTION"]]; 
    477  
    478     [alert beginSheetModalForWindow:mainDlWindow 
    479                 modalDelegate:self 
    480                 didEndSelector:nil 
    481                 contextInfo:nil]; 
    482                  
    483     //NSLog(@"Download did fail: %@", [[aNotification userInfo] objectForKey:@"ERROR_DESCRIPTION"]); 
     550    NSLog(@"Download did fail: %@", [[aNotification userInfo] objectForKey:@"ERROR_DESCRIPTION"]); 
     551     
     552    // delete qvm 
     553    NSLog(@"savepath: %@", [download getSavePath]); 
     554    if(![[[download getSavePath] stringByDeletingLastPathComponent] isEqualTo:@""] || [[download getSavePath] stringByDeletingLastPathComponent] != nil) { 
     555        NSFileManager * manager = [NSFileManager defaultManager]; 
     556        [manager removeFileAtPath:[[download getSavePath] stringByDeletingLastPathComponent] handler:nil]; 
     557    } 
    484558     
    485559    // reset UI 
     560    [self cleanupDownload:[[download getSavePath] stringByDeletingLastPathComponent]]; 
    486561    [statusText setStringValue:@"Download failed."]; 
    487     [self cleanupDownload:[[download getSavePath] stringByDeletingLastPathComponent]]; 
     562     
    488563    [download release]; 
     564     
     565    // alert sheet 
     566    NSBeginAlertSheet(@"Download failed",@"OK",nil,nil,mainDlWindow,self,nil,nil,nil,[[aNotification userInfo] objectForKey:@"ERROR_DESCRIPTION"]); 
    489567} 
    490568 
    491569- (void) cleanupDownload:(NSString *)path 
    492 {     
     570
     571    NSLog(@"Cleaning up after download.."); 
    493572    if(statusTimer) { 
    494573        [statusTimer invalidate]; 
    495     } 
     574    }       
     575     
     576    [[NSNotificationCenter defaultCenter] removeObserver:self name:@"DownloadDidReceiveResponse" object:download]; 
     577    [[NSNotificationCenter defaultCenter] removeObserver:self name:@"DownloadDidReceiveData" object:download]; 
     578    [[NSNotificationCenter defaultCenter] removeObserver:self name:@"DownloadDidFinish" object:download]; 
     579    [[NSNotificationCenter defaultCenter] removeObserver:self name:@"DownloadDidFail" object:download]; 
    496580     
    497581    [statusBar stopAnimation:self]; 
     
    499583    [statusBar setDoubleValue:0.0]; 
    500584    [statusBar setMaxValue:100.0]; 
    501      
    502     [[NSNotificationCenter defaultCenter] removeObserver:self name:@"DownloadDidReceiveResponse" object:download]; 
    503     [[NSNotificationCenter defaultCenter] removeObserver:self name:@"DownloadDidReceiveData" object:download]; 
    504     [[NSNotificationCenter defaultCenter] removeObserver:self name:@"DownloadDidFinish" object:download]; 
    505     [[NSNotificationCenter defaultCenter] removeObserver:self name:@"DownloadDidFail" object:download]; 
    506585     
    507586    [table setDoubleAction:@selector(startDownload:)]; 
     
    525604    if([[path pathExtension] isEqualTo:@"tar"] || [[path pathExtension] isEqualTo:@"bz"] || [[path pathExtension] isEqualTo:@"bz2"] || [[path pathExtension] isEqualTo:@"gz"]) { 
    526605        [task setLaunchPath:@"/usr/bin/tar"]; 
    527         [task setArguments:[NSArray arrayWithObjects:@"-xf", path, nil]]; 
     606        NSString * fmtArgs; 
     607        if([[path pathExtension] isEqualTo:@"bz"] || [[path pathExtension] isEqualTo:@"bz2"]) { 
     608            fmtArgs = @"-xjf"; 
     609        } else if ([[path pathExtension] isEqualTo:@"gz"]) { 
     610            fmtArgs = @"-xzf"; 
     611        } else { 
     612            fmtArgs = @"-xf"; 
     613        } 
     614        [task setArguments:[NSArray arrayWithObjects:fmtArgs, path, nil]]; 
    528615        isArchive = YES; 
    529616    } else if([[path pathExtension] isEqualTo:@"zip"]) { 
     
    545632- (void)uncompressPCFinished:(NSNotification *)aNotification 
    546633{ 
     634    int status = [[aNotification object] terminationStatus]; 
     635    NSString * message;         
    547636    NSString * path = [download getSavePath]; 
    548637    NSString * name = [download getName]; 
    549     NSFileManager * manager = [NSFileManager defaultManager]; 
    550     [statusText setStringValue:@"Extracting files complete."]; 
    551     [manager removeFileAtPath:path handler:nil]; 
    552      
    553     NSString * message; 
     638     
    554639    // start import into Q 
    555640    [statusText setStringValue:@"Importing Free OS.."]; 
     
    558643    } else { 
    559644        message = @"The harddisk could not be found. Please check the settings before using your Free OS."; 
     645    } 
     646     
     647    if(status == 0) { 
     648        //NSLog(@"Task succeeded."); 
     649        // delete downloaded file, leave message unchanged 
     650        NSFileManager * manager = [NSFileManager defaultManager]; 
     651        [manager removeFileAtPath:path handler:nil]; 
     652    } else { 
     653        //NSLog(@"Task failed."); 
     654        // do not delete file, set message to failed 
     655        message = [NSString stringWithFormat:@"The files could not be extracted. The archive seems to be corrupt. You may want to try to extract it manually or report this to free.oszoo.org.\n\nPath: %@", path]; 
    560656    } 
    561657     
  • trunk/qcontrol/freeoszoo.plist

    r7 r49  
    33<plist version="1.0"> 
    44<array> 
    5     <dict> 
    6                 <key>name</key> 
     5        <dict> 
     6                <key>Author</key> 
     7                <string>Jean-Michel Pouré for FreeOSZoo</string> 
     8                <key>Category</key> 
     9                <string>Darwin</string> 
     10                <key>Description</key> 
     11                <string>Darwin is a free, open source, Unix-like operating system first released by Apple Computer in 2000. It is also the core set of components upon which Mac OS X was developed.</string> 
     12                <key>DownloadSize</key> 
     13                <string>732</string> 
     14                <key>DownloadURL</key> 
     15                <string>http://www.oszoo.org/ftp/images/darwin701-x86-20040626.tar.bz2.torrent</string> 
     16                <key>InfopageURL</key> 
     17                <string>http://www.oszoo.org/wiki/index.php/Darwin701-x86-20040626.tar.bz2</string> 
     18                <key>InstallType</key> 
     19                <string>Preconfigured</string> 
     20                <key>Name</key> 
     21                <string>Darwin</string> 
     22                <key>Torrent</key> 
     23                <integer>1</integer> 
     24                <key>Version</key> 
     25                <string>7.0.1</string> 
     26        </dict> 
     27        <dict> 
     28                <key>Author</key> 
     29                <string>Luigi Mantellini for FreeOSZoo</string> 
     30                <key>Category</key> 
     31                <string>FreeBSD</string> 
     32                <key>Description</key> 
     33                <string>FreeBSD is an advanced operating system for x86 compatible architectures. It is derived from BSD, the version of UNIX developed at the University of California, Berkeley. It is developed and maintained by a large team of individuals.</string> 
     34                <key>DownloadSize</key> 
     35                <string>160</string> 
     36                <key>DownloadURL</key> 
     37                <string>http://www.oszoo.org/ftp/images/freebsd_5.4_current.zip.torrent</string> 
     38                <key>InfopageURL</key> 
     39                <string>http://www.oszoo.org/wiki/index.php/Freebsd_5.4_current.zip</string> 
     40                <key>InstallType</key> 
     41                <string>Preconfigured</string> 
     42                <key>Name</key> 
     43                <string>FreeBSD</string> 
     44                <key>Torrent</key> 
     45                <integer>1</integer> 
     46                <key>Version</key> 
     47                <string>5.4</string> 
     48        </dict> 
     49        <dict> 
     50                <key>Author</key> 
     51                <string>Stefano Marinelli for FreeOSZoo</string> 
     52                <key>Category</key> 
     53                <string>FreeBSD</string> 
     54                <key>Description</key> 
     55                <string>FreeBSD is an advanced operating system for x86 compatible architectures. It is derived from BSD, the version of UNIX developed at the University of California, Berkeley. It is developed and maintained by a large team of individuals.</string> 
     56                <key>DownloadSize</key> 
     57                <string>236</string> 
     58                <key>DownloadURL</key> 
     59                <string>http://www.oszoo.org/ftp/images/freebsd_6_0_x86.tar.torrent</string> 
     60                <key>InfopageURL</key> 
     61                <string>http://www.oszoo.org/wiki/index.php/Freebsd_6_0_x86.tar</string> 
     62                <key>InstallType</key> 
     63                <string>Preconfigured</string> 
     64                <key>Name</key> 
     65                <string>FreeBSD</string> 
     66                <key>Torrent</key> 
     67                <integer>1</integer> 
     68                <key>Version</key> 
     69                <string>6.0</string> 
     70        </dict> 
     71        <dict> 
     72                <key>Author</key> 
     73                <string>Charles Jensen for FreeOSZoo</string> 
     74                <key>Category</key> 
     75                <string>FreeBSD</string> 
     76                <key>Description</key> 
     77                <string>FreeBSD is an advanced operating system for x86 compatible architectures. It is derived from BSD, the version of UNIX developed at the University of California, Berkeley. It is developed and maintained by a large team of individuals.</string> 
     78                <key>DownloadSize</key> 
     79                <string>503</string> 
     80                <key>DownloadURL</key> 
     81                <string>http://www.oszoo.org/ftp/images/freebsd6.1rel.qcow.img20060526.tar.torrent</string> 
     82                <key>InfopageURL</key> 
     83                <string>http://www.oszoo.org/wiki/index.php/Freebsd_6.1rel.qcow.img20060526.tar</string> 
     84                <key>InstallType</key> 
     85                <string>Preconfigured</string> 
     86                <key>Name</key> 
     87                <string>FreeBSD</string> 
     88                <key>Torrent</key> 
     89                <integer>1</integer> 
     90                <key>Version</key> 
     91                <string>6.1</string> 
     92        </dict> 
     93        <dict> 
     94                <key>Author</key> 
     95                <string>Ronald Delobel for FreeOSZoo</string> 
     96                <key>Category</key> 
     97                <string>FreeDOS</string> 
     98                <key>Description</key> 
     99                <string>FreeDOS aims to be a complete, free, 100% MS-DOS compatible operating system (mostly achieved.) Today, FreeDOS is ideal for anyone who wants to bundle a version of DOS without having to pay a royalty for use of DOS. FreeDOS will also work on old hardware, in DOS emulators, and in embedded systems. FreeDOS is also an invaluable resource for people who would like to develop their own operating system. While there are many free operating systems out there, no other free DOS-compatible operating system exists.</string> 
     100                <key>DownloadSize</key> 
     101                <string>2.3</string> 
     102                <key>DownloadURL</key> 
     103                <string>http://www.oszoo.org/ftp/images/freedos-beta9rc5.tar.tar.torrent</string> 
     104                <key>InfopageURL</key> 
     105                <string>http://www.oszoo.org/wiki/index.php/Freedos-beta9rc5.tar.tar</string> 
     106                <key>InstallType</key> 
     107                <string>Preconfigured</string> 
     108                <key>Name</key> 
     109                <string>FreeDOS</string> 
     110                <key>Torrent</key> 
     111                <integer>1</integer> 
     112                <key>Version</key> 
     113                <string>Beta9 RC5</string> 
     114        </dict> 
     115        <dict> 
     116                <key>Author</key> 
     117                <string>Simone Vellei for FreeOSZoo</string> 
     118                <key>Category</key> 
     119                <string>Linux</string> 
     120                <key>Description</key> 
     121                <string>Arch Linux is an i686-optimized linux distribution targeted at competent linux users (read: not afraid of the commandline).</string> 
     122                <key>DownloadSize</key> 
     123                <string>600</string> 
     124                <key>DownloadURL</key> 
     125                <string>http://www.oszoo.org/ftp/images/archlinux_0.7.tar.torrent</string> 
     126                <key>InfopageURL</key> 
     127                <string>http://www.oszoo.org/wiki/index.php/Archlinux_0.7.tar</string> 
     128                <key>InstallType</key> 
     129                <string>Preconfigured</string> 
     130                <key>Name</key> 
    7131                <string>ArchLinux</string> 
    8                 <key>version</key> 
     132                <key>Torrent</key> 
     133                <integer>1</integer> 
     134                <key>Version</key> 
    9135                <string>0.7</string> 
    10                 <key>ostype</key> 
    11                 <string>Linux</string> 
    12                 <key>size</key> 
    13                 <string>600</string> 
    14                 <key>author</key> 
     136        </dict> 
     137        <dict> 
     138                <key>Author</key> 
     139                <string>Charles Jensen for FreeOSZoo</string> 
     140                <key>Category</key> 
     141                <string>ArchLinux</string> 
     142                <key>Description</key> 
     143                <string>Arch Linux is an i686-optimized linux distribution targeted at competent linux users (read: not afraid of the commandline).</string> 
     144                <key>DownloadSize</key> 
     145                <string>309</string> 
     146                <key>DownloadURL</key> 
     147                <string>http://www.oszoo.org/ftp/images/arch-linux.qcow.img.20060428.tar.torrent</string> 
     148                <key>InfopageURL</key> 
     149                <string>http://www.oszoo.org/wiki/index.php/Arch-linux.qcow.img.20060428.tar</string> 
     150                <key>InstallType</key> 
     151                <string>Preconfigured</string> 
     152                <key>Name</key> 
     153                <string>ArchLinux</string> 
     154                <key>Torrent</key> 
     155                <integer>1</integer> 
     156                <key>Version</key> 
     157                <string>0.7.1</string> 
     158        </dict> 
     159        <dict> 
     160                <key>Author</key> 
    15161                <string>Simone Vellei for FreeOSZoo</string> 
    16                 <key>torrent</key> 
    17                 <integer>1</integer> 
    18                 <key>url</key> 
    19                 <string>http://www.free.oszoo.org/ftp/images/archlinux_0.7.tar.torrent</string> 
    20                 <key>installtype</key> 
    21                 <string>Preconfigured</string> 
    22                 <key>weburl</key> 
    23                 <string>http://www.archlinux.org</string> 
    24                 <key>description</key> 
    25                 <string>Arch Linux is an i686-optimized linux distribution targeted at competent linux users (read: not afraid of the commandline). Root password is 'archlinux'.</string> 
    26         </dict> 
    27         <dict> 
    28                 <key>name</key> 
     162                <key>Category</key> 
     163                <string>ArchLinux</string> 
     164                <key>Description</key> 
     165                <string>Arch Linux is an i686-optimized linux distribution targeted at competent linux users (read: not afraid of the commandline).</string> 
     166                <key>DownloadSize</key> 
     167                <string>373</string> 
     168                <key>DownloadURL</key> 
     169                <string>http://www.oszoo.org/ftp/images/archlinux_0.7.2.zip</string> 
     170                <key>InfopageURL</key> 
     171                <string>http://www.oszoo.org/wiki/index.php/Archlinux_0.7.2.zip</string> 
     172                <key>InstallType</key> 
     173                <string>Preconfigured</string> 
     174                <key>Name</key> 
     175                <string>ArchLinux</string> 
     176                <key>Torrent</key> 
     177                <integer>0</integer> 
     178                <key>Version</key> 
     179                <string>0.7.2</string> 
     180        &l