Commit dacaa81b authored by Felix Paul Kühne's avatar Felix Paul Kühne

* download the updated versions through VLC and not through your default browser

* removed a crasher from interaction.m

Note: the progress-window used to show the progress is quite hacky at the moment and will be replaced through a good implementation once the interaction-core is finished.
parent e1db82bc
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* interaction.h: Mac OS X interaction dialogs * interaction.h: Mac OS X interaction dialogs
***************************************************************************** *****************************************************************************
* Copyright (C) 2005-2006 the VideoLAN team * Copyright (C) 2005-2006 the VideoLAN team
* $Id:$ * $Id$
* *
* Authors: Derk-Jan Hartman <hartman at videolan dot org> * Authors: Derk-Jan Hartman <hartman at videolan dot org>
* Felix Kühne <fkuehne at videolan dot org> * Felix Kühne <fkuehne at videolan dot org>
...@@ -225,14 +225,13 @@ ...@@ -225,14 +225,13 @@
{ {
[o_prog_bar setDoubleValue: \ [o_prog_bar setDoubleValue: \
(double)(p_dialog->pp_widgets[i]->val.f_float)]; (double)(p_dialog->pp_widgets[i]->val.f_float)];
if( [o_prog_bar doubleValue] == 100.0 ) if( [o_prog_bar doubleValue] == 100.0 )
{ {
/* we are done, let's hide */ /* we are done, let's hide */
[self hideDialog]; [self hideDialog];
return; return;
} }
[o_prog_description setStringValue: [NSString stringWithUTF8String:\
p_dialog->pp_widgets[i]->val.psz_string]];
} }
} }
} }
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
NSString * o_hashOfOurBinary; NSString * o_hashOfOurBinary;
NSString * o_urlOfBinary; NSString * o_urlOfBinary;
NSNumber * o_indexOfOurBinary;
update_t * p_u; update_t * p_u;
intf_thread_t * p_intf; intf_thread_t * p_intf;
} }
......
...@@ -76,6 +76,8 @@ static VLCUpdate *_o_sharedInstance = nil; ...@@ -76,6 +76,8 @@ static VLCUpdate *_o_sharedInstance = nil;
[o_hashOfOurBinary release]; [o_hashOfOurBinary release];
if( o_urlOfBinary ) if( o_urlOfBinary )
[o_urlOfBinary release]; [o_urlOfBinary release];
if( o_indexOfOurBinary )
[o_indexOfOurBinary release];
[super dealloc]; [super dealloc];
} }
...@@ -106,19 +108,17 @@ static VLCUpdate *_o_sharedInstance = nil; ...@@ -106,19 +108,17 @@ static VLCUpdate *_o_sharedInstance = nil;
- (IBAction)download:(id)sender - (IBAction)download:(id)sender
{ {
/* enable the following once full notification support is available /* provide a save dialogue */
* provide a save dialogue *
SEL sel = @selector(getLocationForSaving:returnCode:contextInfo:); SEL sel = @selector(getLocationForSaving:returnCode:contextInfo:);
NSSavePanel * saveFilePanel = [[NSSavePanel alloc] init]; NSSavePanel * saveFilePanel = [[NSSavePanel alloc] init];
[saveFilePanel setRequiredFileType: @"dmg"]; [saveFilePanel setRequiredFileType: @"dmg"];
[saveFilePanel setCanSelectHiddenExtension: YES]; [saveFilePanel setCanSelectHiddenExtension: YES];
[saveFilePanel setCanCreateDirectories: YES]; [saveFilePanel setCanCreateDirectories: YES];
[saveFilePanel beginSheetForDirectory:nil file:nil modalForWindow: \ [saveFilePanel beginSheetForDirectory:nil file: \
o_update_window modalDelegate:self didEndSelector:sel contextInfo:nil];*/ [[o_urlOfBinary componentsSeparatedByString:@"/"] lastObject] \
modalForWindow: o_update_window modalDelegate:self didEndSelector:sel \
/* delete this afterwards */ contextInfo:nil];
[self performDownload: @""];
} }
- (void)getLocationForSaving: (NSSavePanel *)sheet returnCode: \ - (void)getLocationForSaving: (NSSavePanel *)sheet returnCode: \
...@@ -175,9 +175,10 @@ static VLCUpdate *_o_sharedInstance = nil; ...@@ -175,9 +175,10 @@ static VLCUpdate *_o_sharedInstance = nil;
else if( p_uit->file.i_type == UPDATE_FILE_TYPE_BINARY ) else if( p_uit->file.i_type == UPDATE_FILE_TYPE_BINARY )
{ {
msg_Dbg( p_intf, "binary found, version = %s" \ msg_Dbg( p_intf, "binary found, version = %s" \
", hash=%s, size=%i", p_uit->release.psz_version, \ ", hash=%s, size=%i MB, position in release file list=%i",\
p_uit->file.psz_md5, (int)((p_uit->file.l_size \ p_uit->release.psz_version, p_uit->file.psz_md5, \
/ 1024) / 1024) ); (int)((p_uit->file.l_size / 1024) / 1024), \
p_uit->i_f);
[o_fld_currentVersionAndSize setStringValue: \ [o_fld_currentVersionAndSize setStringValue: \
[NSString stringWithFormat: \ [NSString stringWithFormat: \
@"The current release is %s (%i MB to download).", \ @"The current release is %s (%i MB to download).", \
...@@ -197,6 +198,14 @@ static VLCUpdate *_o_sharedInstance = nil; ...@@ -197,6 +198,14 @@ static VLCUpdate *_o_sharedInstance = nil;
o_hashOfOurBinary = [[NSString alloc] \ o_hashOfOurBinary = [[NSString alloc] \
initWithUTF8String: p_uit->file.psz_md5]; initWithUTF8String: p_uit->file.psz_md5];
} }
if( p_uit->i_f )
{
if( o_indexOfOurBinary )
[o_indexOfOurBinary release];
o_indexOfOurBinary = [[NSNumber alloc] \
initWithInt: p_uit->i_f];
}
} }
if( p_uit->release.i_status == UPDATE_RELEASE_STATUS_NEWER && if( p_uit->release.i_status == UPDATE_RELEASE_STATUS_NEWER &&
!releaseChecked ) !releaseChecked )
...@@ -263,34 +272,25 @@ static VLCUpdate *_o_sharedInstance = nil; ...@@ -263,34 +272,25 @@ static VLCUpdate *_o_sharedInstance = nil;
- (void)performDownload:(NSString *)path - (void)performDownload:(NSString *)path
{ {
/* enable this once notifications are completely available on OSX
update_iterator_t *p_uit = update_iterator_New( p_u ); update_iterator_t *p_uit = update_iterator_New( p_u );
if( p_uit ) if( p_uit )
{ {
update_iterator_Action( p_uit, UPDATE_MIRROR ); update_iterator_Action( p_uit, UPDATE_MIRROR );
int i_count = 0; while( update_iterator_Action( p_uit, UPDATE_FILE) != UPDATE_FAIL )
while( update_iterator_Action( p_uit, UPDATE_FILE ) != UPDATE_FAIL )
{ {
if( p_uit->file.psz_url == [o_hashOfOurBinary UTF8String] ) if( p_uit->release.i_type == UPDATE_RELEASE_TYPE_STABLE &&
break; p_uit->release.i_status == UPDATE_RELEASE_STATUS_NEWER &&
i_count += 1; p_uit->file.i_type == UPDATE_FILE_TYPE_BINARY )
{
/* that's our binary */
update_download( p_uit, (char *)[path UTF8String] );
}
} }
update_download( p_uit, (char *)[path UTF8String] );
update_iterator_Delete( p_uit ); update_iterator_Delete( p_uit );
}*/ }
/* delete the following afterwards */
msg_Dbg( p_intf, "url is %s, using default browser for download", \
[o_urlOfBinary UTF8String] );
NSURL * o_url = [NSURL URLWithString: o_urlOfBinary];
[[NSWorkspace sharedWorkspace] openURL: o_url];
[o_update_window close]; [o_update_window close];
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment