2
* Software Centre System
3
* author: Anthony Dillon
6
function SoftwareSystem($parent){
10
var maximised = false;
12
var currentApp = null;
13
var installedApps = new Array();
18
var theDescription = '';
19
var theDesctiptionImage = '';
21
this.init = function(){
23
$('#software-centre .loading-bar').hide();
24
$('#software-centre .detailed .price .progress').css('width','0');
26
$('#software-centre .control .close').click(function(){
29
$('#software-centre .control .min').click(function(){
33
$('#software-centre .control .max').click(function(){
36
$('#software-centre').css('width','800px');
37
$('#software-centre').css('height','550px');
38
$('#software-centre').removeClass('fullsize');
39
_parent.systemSettings.decreaseFullscreen();
42
$('#software-centre').css('width',$(document).width() - 70 + 'px');
43
$('#software-centre').css('height',$(document).height() - 50 + 'px');
44
$('#software-centre').addClass('fullsize');
45
_parent.systemSettings.increaseFullscreen();
50
$('#software-centre .top-panel .back').bind('click',function(){
51
if(!$(this).hasClass('disabled')){
52
$('#software-centre .home').show();
53
$('#software-centre .detailed').hide();
54
$(this).addClass('disabled');
55
$('#software-centre .top-panel .forward').removeClass('disabled');
58
$('#software-centre .top-panel .forward').bind('click',function(){
59
if(!$(this).hasClass('disabled')){
61
$(this).addClass('disabled');
65
$('#software-centre .whats-new .app-container div').click(function(){
66
currentApp = $(this).attr('class');
67
$('#software-centre .top-panel .forward').addClass('disabled');
71
this.setupTopButtons();
75
this.loadApp = function(){
77
$('#software-centre .top-panel .back').removeClass('disabled');
78
$('#software-centre .detailed .price .theprice').removeClass('installed');
79
$('#software-centre .detailed .price .button').text(_install_);
80
if(installedApps[currentApp] == true){ _this.installedApp(); }
83
thePrice = _price_free_;
84
theName = _chromium_app_;
85
theSub = _chromium_sub_;
86
theImage = '../img/software-centre/logo-chromium.png';
87
theDescription = _chromium_desc_;
88
theDesctiptionImage = '../img/software-centre/screenshot-chromium.jpg';
94
theImage = '../img/software-centre/logo-beep.png';
95
theDescription = _beep_desc_;
96
theDesctiptionImage = '../img/software-centre/screenshot-beep.jpg';
99
thePrice = _price_free_;
100
theName = _inkscape_app_;
101
theSub = _inkscape_sub_;
102
theImage = '../img/software-centre/logo-inkscape.png';
103
theDescription = _inkscape_desc_;
104
theDesctiptionImage = '../img/software-centre/screenshot-inkscape.jpg';
108
theName = _world_of_goo_app_;
109
theSub = _world_of_goo_sub_;
110
theImage = '../img/software-centre/logo-world-of-goo.png';
111
theDescription = _world_of_goo_desc_;
112
theDesctiptionImage = '../img/software-centre/screenshot-worldofgoo.jpg';
115
thePrice = _price_free_;
116
theName = _blender_app_;
117
theSub = _blender_sub_;
118
theImage = '../img/software-centre/logo-blender.png';
119
theDescription = _blender_desc_;
120
theDesctiptionImage = '../img/software-centre/screenshot-blender.jpg';
124
theName = _braid_app_;
125
theSub = _braid_sub_;
126
theImage = '../img/software-centre/logo-braid.png';
127
theDescription = _braid_desc_;
128
theDesctiptionImage = '../img/software-centre/screenshot-braid.jpg';
131
_parent.errorMessage.open();
136
$('#software-centre .detailed .title h1').text(theName);
137
$('#software-centre .detailed .title p.subheading').text(theSub);
138
$('#software-centre .detailed .title img.app-image').attr('src', theImage);
139
$('#software-centre .detailed .description').html(theDescription);
140
$('#software-centre .detailed .description-image img').attr('src',theDesctiptionImage);
141
if($('#software-centre .detailed .price .theprice').hasClass(_installed_)){
142
$('#software-centre .detailed .price .theprice').text(_installed_);
144
$('#software-centre .detailed .price .theprice').text(thePrice);
147
$('#software-centre .home').hide();
148
$('#software-centre .detailed').show();
152
this.setupInstall = function(){
153
$('#software-centre .detailed .price .button').bind('click',function(){
154
if(installedApps[currentApp] == true){
158
$('#software-centre .loading-bar').show();
159
$('#software-centre .detailed .price .theprice').text(_installing_+'…');
160
$('#software-centre .loading-bar .progress').animate({
162
}, 1500, function() {
163
_this.installedApp();
164
$('#software-centre .loading-bar').hide();
165
$('#software-centre .detailed .price .button').show();
171
this.removeApp = function(){
172
$('#software-centre .detailed .price .theprice').text(thePrice);
173
$('#software-centre .detailed .price .theprice').removeClass('installed');
174
$('#software-centre .detailed .price .theprice').css('background-image','none');
175
$('#software-centre .detailed .price .button').text(_install_);
176
_parent.systemOverlay.removeApps(theName);
177
installedApps[currentApp] = false;
180
this.installedApp = function(){
181
$('#software-centre .detailed .price .theprice').text(_installed_);
182
$('#software-centre .detailed .price .theprice').addClass('installed');
183
$('#software-centre .detailed .price .button').text(_remove_);
184
$('#software-centre .detailed .price .progress').css('width','0');
185
_parent.systemOverlay.totalApps.push({name:theName,image:theImage});
186
installedApps[currentApp] = true;
189
this.setupTopButtons = function(){
190
$('#software-centre .all-software').bind('click', function(){
191
$('#software-centre .home').show();
192
$('#software-centre .detailed').hide();
193
$('#software-centre .top-panel .back').addClass('disabled');
197
this.close = function(){
199
$('#software-centre .home').show();
200
$('#software-centre .detailed').hide();
201
if(maximised){ _parent.systemSettings.decreaseFullscreen(); }
202
$('#software-centre ').hide();
203
_parent.systemMenu.closeWindow('software');
204
$('#software-centre ').removeClass('fullsize');
206
minified = _isOpen = false;
208
if($('css3-container').length > 0){
209
$('#software-centre').prev().css('top', $('#software-centre').css('top'));
210
$('#software-centre').prev().css('left', $('#software-centre').css('left'));
215
this.min = function(){
216
if(maximised){ _parent.systemSettings.decreaseFullscreen(); }
217
$('#software-centre ').hide();
218
_parent.systemMenu.wiggle('software');
222
this.resize = function(){
223
var containerHeight = $('#software-centre').height() - ($('#software-centre .top-panel').height() + $('#software-centre .control').height() + 6);
224
var appBoxWidth = $('#software-centre').width() - ($('#software-centre .navigation').width() + 50);
225
if(maximised){ containerHeight -= 27; }
226
$('#software-centre .container').css('height',containerHeight);
227
$('#software-centre .container .whats-new').css('width',appBoxWidth);
230
this.center = function(){
231
var left = ($(document).width() / 2) - ($('#software-centre ').width() / 2);
232
var top = Math.max(24,($(document).height() / 2) - ($('#software-centre ').height() / 2));
233
$('#software-centre ').css('left',left);
234
$('#software-centre ').css('top',top);
237
this.isMaximised = function(){
241
this.open = function($app){
242
if($app != undefined){ currentApp = $app; this.loadApp(); }
245
$('#software-centre').show();
247
_parent.systemMenu.openWindow('software');
248
if($('css3-container').length > 0){
249
$('#software-centre').prev().css('top', $('#software-centre').css('top'));
250
$('#software-centre').prev().css('left', $('#software-centre').css('left'));
b'\\ No newline at end of file'