]> git.sesse.net Git - vlc/commitdiff
* download the updated versions through VLC and not through your default browser
authorFelix Paul Kühne <fkuehne@videolan.org>
Wed, 1 Mar 2006 21:05:47 +0000 (21:05 +0000)
committerFelix Paul Kühne <fkuehne@videolan.org>
Wed, 1 Mar 2006 21:05:47 +0000 (21:05 +0000)
* 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.

modules/gui/macosx/interaction.m
modules/gui/macosx/update.h
modules/gui/macosx/update.m

index 94387f0014be3734a0054996ce9bdc44e0cb38d5..f5128077ee254a96245b5858b9e1391be382c100 100644 (file)
@@ -2,7 +2,7 @@
  * interaction.h: Mac OS X interaction dialogs
  *****************************************************************************
  * Copyright (C) 2005-2006 the VideoLAN team
- * $Id:$
+ * $Id$
  *
  * Authors: Derk-Jan Hartman <hartman at videolan dot org>
  *          Felix Kühne <fkuehne at videolan dot org>
         {
             [o_prog_bar setDoubleValue: \
                 (double)(p_dialog->pp_widgets[i]->val.f_float)];
+
             if( [o_prog_bar doubleValue] == 100.0 )
             {
                 /* we are done, let's hide */
                 [self hideDialog];
                 return;
             }
-            [o_prog_description setStringValue: [NSString stringWithUTF8String:\
-                p_dialog->pp_widgets[i]->val.psz_string]];
         }
     }
 }
index ab47b2bb059f8e309fe69c8a7de127373ac715f7..542d767b0283afbce51bd2233430eceaeea96b9f 100644 (file)
@@ -37,6 +37,7 @@
 
     NSString * o_hashOfOurBinary;
     NSString * o_urlOfBinary;
+    NSNumber * o_indexOfOurBinary;
     update_t * p_u;
     intf_thread_t * p_intf;
 }
index a9cb81ac2441dc664ef9962b0c7706ce7cb48678..f5654d4e6d2a1153ecd7d53bacf1fcc995bb36d4 100644 (file)
@@ -76,6 +76,8 @@ static VLCUpdate *_o_sharedInstance = nil;
         [o_hashOfOurBinary release];
     if( o_urlOfBinary )
         [o_urlOfBinary release];
+    if( o_indexOfOurBinary )
+        [o_indexOfOurBinary release];
 
     [super dealloc];
 }
@@ -106,19 +108,17 @@ static VLCUpdate *_o_sharedInstance = nil;
 
 - (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:);
     NSSavePanel * saveFilePanel = [[NSSavePanel alloc] init];
     
     [saveFilePanel setRequiredFileType: @"dmg"];
     [saveFilePanel setCanSelectHiddenExtension: YES];
     [saveFilePanel setCanCreateDirectories: YES];
-    [saveFilePanel beginSheetForDirectory:nil file:nil modalForWindow: \
-        o_update_window modalDelegate:self didEndSelector:sel contextInfo:nil];*/
-
-    /* delete this afterwards */
-    [self performDownload: @""];
+    [saveFilePanel beginSheetForDirectory:nil file: \
+        [[o_urlOfBinary componentsSeparatedByString:@"/"] lastObject] \
+        modalForWindow: o_update_window modalDelegate:self didEndSelector:sel \
+        contextInfo:nil];
 }
 
 - (void)getLocationForSaving: (NSSavePanel *)sheet returnCode: \
@@ -175,9 +175,10 @@ static VLCUpdate *_o_sharedInstance = nil;
                 else if( p_uit->file.i_type == UPDATE_FILE_TYPE_BINARY )
                 {
                     msg_Dbg( p_intf, "binary found, version = %s" \
-                        ", hash=%s, size=%i", p_uit->release.psz_version, \
-                        p_uit->file.psz_md5, (int)((p_uit->file.l_size \
-                        / 1024) / 1024) );
+                        ", hash=%s, size=%i MB, position in release file list=%i",\
+                        p_uit->release.psz_version, p_uit->file.psz_md5, \
+                        (int)((p_uit->file.l_size / 1024) / 1024), \
+                        p_uit->i_f);
                     [o_fld_currentVersionAndSize setStringValue: \
                         [NSString stringWithFormat: \
                         @"The current release is %s (%i MB to download).", \
@@ -197,6 +198,14 @@ static VLCUpdate *_o_sharedInstance = nil;
                         o_hashOfOurBinary = [[NSString alloc] \
                             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 &&
                     !releaseChecked )
@@ -263,34 +272,25 @@ static VLCUpdate *_o_sharedInstance = nil;
 
 - (void)performDownload:(NSString *)path
 {
-    /* enable this once notifications are completely available on OSX 
     update_iterator_t *p_uit = update_iterator_New( p_u );
     if( p_uit )
     {
         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] )
-                break;
-            i_count += 1;
+            if( p_uit->release.i_type == UPDATE_RELEASE_TYPE_STABLE &&
+                p_uit->release.i_status == UPDATE_RELEASE_STATUS_NEWER &&
+                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 );
-    }*/
-    
-    /* 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];
 }