]> git.sesse.net Git - vlc/blob - modules/gui/macosx/update.m
* port of the wx-update-panel to OSX (GUI works, updating itself is not yet implement...
[vlc] / modules / gui / macosx / update.m
1 /*****************************************************************************
2  * update.m: MacOS X Check-For-Update window
3  *****************************************************************************
4  * Copyright (C) 2005 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Felix K\9fhne <fkuehne@users.sf.net>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
22  *****************************************************************************/
23
24
25 /*****************************************************************************
26  * Note: 
27  * the code used to bind with VLC's core and the download of files is heavily 
28  * based upon ../wxwidgets/updatevlc.cpp, written by Antoine Cellerier. 
29  * (he is a member of the VideoLAN team) 
30  *****************************************************************************/
31
32
33 /*****************************************************************************
34  * Preamble
35  *****************************************************************************/
36 #import "update.h"
37 #import "intf.h"
38
39 #import <vlc/vlc.h>
40 #import <vlc/intf.h>
41
42 #import "vlc_block.h"
43 #import "vlc_stream.h"
44 #import "vlc_xml.h"
45
46 #define UPDATE_VLC_OS "macosx"
47 #define UPDATE_VLC_ARCH "ppc"
48
49
50 /*****************************************************************************
51  * VLCExtended implementation
52  *****************************************************************************/
53
54 @implementation VLCUpdate
55
56 static VLCUpdate *_o_sharedInstance = nil;
57
58 + (VLCUpdate *)sharedInstance
59 {
60     return _o_sharedInstance ? _o_sharedInstance : [[self alloc] init];
61 }
62
63 - (id)init
64 {
65     if (_o_sharedInstance) {
66         [self dealloc];
67     } else {
68         _o_sharedInstance = [super init];
69     }
70
71     return _o_sharedInstance;
72 }
73
74 - (void)awakeFromNib
75 {
76     /* clean the interface */
77     [o_fld_userVersion setStringValue: [[[NSBundle mainBundle] infoDictionary] \
78         objectForKey:@"CFBundleVersion"]];
79     [o_fld_releaseNote setString: @""];
80     [o_fld_releasedOn setStringValue: @""];
81     [o_fld_size setStringValue: @""];
82     [o_fld_currentVersion setStringValue: @""];
83     
84     [self initStrings];
85 }
86
87 - (void)initStrings
88 {
89     /* translate strings to the user's language */
90     [o_btn_cancel setTitle: _NS("Cancel")];
91     [o_btn_DownloadNow setTitle: _NS("Download now")];
92     [o_btn_okay setTitle: _NS("OK")];
93     [o_lbl_currentVersion setStringValue: [_NS("Current version") \
94         stringByAppendingString: @":"]];
95     [o_lbl_releasedOn setStringValue: [_NS("Released on") \
96         stringByAppendingString: @":"]];
97     [o_lbl_size setStringValue: [_NS("Size") \
98         stringByAppendingString: @":"]];
99     [o_lbl_userVersion setStringValue: [_NS("Your version") \
100         stringByAppendingString: @":"]];
101     [o_lbl_mirror setStringValue: [_NS("Mirror") \
102         stringByAppendingString: @":"]];
103     [o_lbl_checkForUpdate setStringValue: _NS("Checking for update...")];
104 }
105
106 - (void)showUpdateWindow
107 {
108     /* show the window and check for a potential update */
109     [o_update_window center];
110     [o_update_window displayIfNeeded];
111     [o_update_window makeKeyAndOrderFront:nil];
112 }
113
114 - (IBAction)cancel:(id)sender
115 {
116     /* cancel the download and close the sheet */
117 }
118
119 - (IBAction)download:(id)sender
120 {
121     /* open the sheet and start the download */
122 }
123
124 - (IBAction)okay:(id)sender
125 {
126     /* just close the window */
127     [o_update_window close];
128 }
129
130 @end