- default screensaver: fix divide-by-zero; code cleanup

svn path=/trunk/boinc/; revision=24649
This commit is contained in:
David Anderson 2011-11-25 07:24:18 +00:00
parent 9279ef467e
commit f24e361034
3 changed files with 35 additions and 47 deletions

View File

@ -8670,3 +8670,9 @@ David 24 Nov 2011
ssim/
ssim.cpp
des.h
David 24 Nov 2011
- default screensaver: fix divide-by-zero; code cleanup
clientsrc/
ss_app.cpp

View File

@ -70,18 +70,15 @@ double next_connect_time = 0.0;
CC_STATE cc_state;
CC_STATUS cc_status;
// Possible values of iBrandId:
#define BOINC_BRAND_ID 0
#define GRIDREPUBLIC_BRAND_ID 1
#define PROGRESSTHRUPROCESSORS_BRAND_ID 2
#define CHARITYENGINE_BRAND_ID 3
#ifdef _GRIDREPUBLIC
static long iBrandId = GRIDREPUBLIC_BRAND_ID;
const char* brand_name = "GridRepublic";
const char* logo_file = "gridrepublic_ss_logo.jpg";
#elif defined(_CHARITYENGINE)
static long iBrandId = CHARITYENGINE_BRAND_ID;
const char* brand_name = "Charity Engine";
const char* logo_file = "CE_ss_logo.jpg"
#else
static long iBrandId = BOINC_BRAND_ID; // Default value for BOINC
const char* brand_name = "BOINC";
const char* logo_file = "boinc_logo_black.jpg";
#endif
#if 0
@ -235,32 +232,19 @@ void show_project(unsigned int index, float alpha) {
void show_disconnected() {
float x=.3, y=.3;
if (iBrandId == GRIDREPUBLIC_BRAND_ID) {
txf_render_string(.1, x, y, 0, ALERT_SIZE, white, 0, "GridRepublic is not running.");
} else if (iBrandId == CHARITYENGINE_BRAND_ID) {
txf_render_string(.1, x, y, 0, ALERT_SIZE, white, 0, "Charity Engine is not running.");
} else {
txf_render_string(.1, x, y, 0, ALERT_SIZE, white, 0, "BOINC is not running.");
}
char buf[256];
sprintf(buf, "%s is not running.", brand_name);
txf_render_string(.1, x, y, 0, ALERT_SIZE, white, 0, buf);
}
void show_no_projects() {
float x=.2, y=.3;
if (iBrandId == GRIDREPUBLIC_BRAND_ID) {
txf_render_string(.1, x, y, 0, ALERT_SIZE, white, 0, "GridRepublic is not attached to any projects.");
} else if (iBrandId == CHARITYENGINE_BRAND_ID) {
txf_render_string(.1, x, y, 0, ALERT_SIZE, white, 0, "Charity Engine is not attached to any projects.");
} else {
txf_render_string(.1, x, y, 0, ALERT_SIZE, white, 0, "BOINC is not attached to any projects.");
}
char buf[256];
sprintf(buf, "%s is not attached to any projects.", brand_name);
txf_render_string(.1, x, y, 0, ALERT_SIZE, white, 0, buf);
y = .25;
if (iBrandId == GRIDREPUBLIC_BRAND_ID) {
txf_render_string(.1, x, y, 0, ALERT_SIZE, white, 0, "Attach to projects using the GridRepublic Desktop.");
} else if (iBrandId == CHARITYENGINE_BRAND_ID) {
txf_render_string(.1, x, y, 0, ALERT_SIZE, white, 0, "Attach to projects using the Charity Engine Desktop.");
} else {
txf_render_string(.1, x, y, 0, ALERT_SIZE, white, 0, "Attach to projects using the BOINC Manager.");
}
sprintf(buf, "Attach to projects using %s.", brand_name);
txf_render_string(.1, x, y, 0, ALERT_SIZE, white, 0, buf);
}
#define MAX_JOBS_DISPLAY 4
@ -272,6 +256,7 @@ void show_jobs(unsigned int index, double alpha) {
unsigned int nfound = 0;
unsigned int i;
cc_status.task_suspend_reason &= ~SUSPEND_REASON_CPU_THROTTLE;
char buf[256];
if (!cc_status.task_suspend_reason) {
for (i=0; i<cc_state.results.size(); i++) {
@ -309,13 +294,11 @@ void show_jobs(unsigned int index, double alpha) {
case SUSPEND_REASON_NO_RECENT_INPUT:
p = "Computing suspended while computer not in use"; break;
case SUSPEND_REASON_INITIAL_DELAY:
if (iBrandId == GRIDREPUBLIC_BRAND_ID) {
p = "Computing suspended while GridRepublic is starting up"; break;
} else if (iBrandId == CHARITYENGINE_BRAND_ID) {
p = "Computing suspended while Charity Engine is starting up"; break;
} else {
p = "Computing suspended while BOINC is starting up"; break;
}
sprintf(buf,
"Computing suspended while %s is starting up", brand_name
);
p = buf;
break;
case SUSPEND_REASON_EXCLUSIVE_APP_RUNNING:
p = "Computing suspended while exclusive application running"; break;
case SUSPEND_REASON_CPU_USAGE:
@ -425,8 +408,13 @@ void app_graphics_render(int xs, int ys, double t) {
showing_project = false;
project_index++;
} else {
int n = cc_state.results.size();
if (n) {
job_index += MAX_JOBS_DISPLAY;
job_index %= cc_state.results.size();
job_index %= n;
} else {
job_index = 0;
}
showing_project = true;
}
}
@ -466,13 +454,7 @@ void app_graphics_init() {
#ifdef _WCG
logo.load_image_file("wcg.bmp");
#else
if (iBrandId == GRIDREPUBLIC_BRAND_ID) {
logo.load_image_file("gridrepublic_ss_logo.jpg");
} else if (iBrandId == CHARITYENGINE_BRAND_ID) {
logo.load_image_file("CE_ss_logo.jpg");
} else {
logo.load_image_file("boinc_logo_black.jpg");
}
logo.load_image_file(logo_file);
#endif
init_lights();
}

View File

@ -305,7 +305,7 @@ language("Polish", array(
site("http://www.boinc.org.pl/", "Team boinc.pl"),
site("http://www.boinc.prv.pl", "BOINC@Kolobrzeg"),
site("http://www.boincatpoland.org", "BOINC@Poland"),
//site("http://www.boinc.pl", "www.boinc.pl"),
site("http://boinc.pl", "BOINC Polish National Team"),
site("http://www.tomaszpawel.republika.pl/", "TomaszPawelTeam"),
site("http://www.gpuforce.oxyone.pl/", "GPU Force"),
));