示例#1
0
文件: ss_app.cpp 项目: DanAurea/boinc
// index is where to start looking in job array
//
void show_jobs(unsigned int index, double alpha) {
    float x=.1, y=.7;
    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++) {
            int j = (i + index) % cc_state.results.size();
            RESULT* r = cc_state.results[j];
            if (!r->active_task) continue;
            if (r->scheduler_state != CPU_SCHED_SCHEDULED) continue;
            if (!nfound) {
                ttf_render_string(x, y, 0, TASK_INTRO_SIZE, white, "Running tasks:");
                y -= .05;
            }
            show_result(r, x, y, alpha);
            y -= .05;
            nfound++;
            if (nfound == MAX_JOBS_DISPLAY) break;
        }
    }
    if (!nfound) {
        y = .5;
        ttf_render_string(x, y, 0, TASK_NONE_SIZE, white, "No running tasks");
        char *p = 0;
        switch (cc_status.task_suspend_reason) {
        case SUSPEND_REASON_BATTERIES:
            p = "Computer is running on batteries"; break;
        case SUSPEND_REASON_USER_ACTIVE:
            p = "Computer is in use"; break;
        case SUSPEND_REASON_USER_REQ:
            p = "Computing suspended by user"; break;
        case SUSPEND_REASON_TIME_OF_DAY:
            p = "Computing suspended during this time of day"; break;
        case SUSPEND_REASON_BENCHMARKS:
            p = "Computing suspended while running benchmarks"; break;
        case SUSPEND_REASON_DISK_SIZE:
            p = "Computing suspended because no disk space"; break;
        case SUSPEND_REASON_NO_RECENT_INPUT:
            p = "Computing suspended while computer not in use"; break;
        case SUSPEND_REASON_INITIAL_DELAY:
            snprintf(buf, sizeof(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:
            p = "Computing suspended because processor usage is high"; break;
        }
        if (p) {
            y -= .1;
            ttf_render_string(x, y, 0, TASK_NONE_REASON_SIZE, white, p);
        }
    }
}
示例#2
0
文件: ss_app.cpp 项目: DanAurea/boinc
void show_no_projects() {
    float x=.2, y=.3;
    char buf[256];
    snprintf(buf, sizeof(buf), "%s is not attached to any projects.", brand_name);
    ttf_render_string(x, y, 0, ALERT_SIZE, white, buf);
    y = .25;
    snprintf(buf, sizeof(buf), "Attach to projects using %s.", brand_name);
    ttf_render_string(x, y, 0, ALERT_SIZE, white, buf);
}
示例#3
0
TTFont* TTFontMan::CreateNewFont(String_64* pFontName)
{
	TTFont *pFont = new TTFont;
	if (pFont==NULL)
		return NULL;
	if (!pFont->Initialise(pFontName))
	{
		delete pFont;
		return NULL;
	}
	return pFont;
}
示例#4
0
文件: ss_app.cpp 项目: DanAurea/boinc
void show_coords() {
    int i;
    char buf[256];
    for (i=-100; i< 101; i+=5) {
        sprintf(buf, "%d", i);
        float x = (float)i/100;
        ttf_render_string(x, 0, 0, 1000., white, buf);
    }
    for (i=-100; i< 101; i+=5) {
        sprintf(buf, "%d", i);
        float y = (float)i/100;
        ttf_render_string(0, y, 0, 1000., white, buf);
    }
}
示例#5
0
文件: ss_app.cpp 项目: DanAurea/boinc
void show_project(unsigned int index, float alpha) {
    float x=.2, y=.6;
    char buf[1024];
    ttf_render_string(x, y, 0, PROJ_INTRO_SIZE, white, "This computer is participating in");
    y -= .07;
    PROJECT *p = cc_state.projects[index];
    ttf_render_string(x, y, 0, PROJ_NAME_SIZE, white, (char*)p->project_name.c_str());
    y -= .07;
    ttf_render_string(x, y, 0, PROJ_INFO_SIZE, white, p->master_url);
    y -= .05;
    snprintf(buf, sizeof(buf), "User: %s", p->user_name.c_str());
    ttf_render_string(x, y, 0, PROJ_INFO_SIZE, white, buf);
    y -= .05;
    if (p->team_name.size()) {
        snprintf(buf, sizeof(buf), "Team: %s",  p->team_name.c_str());
        ttf_render_string(x, y, 0, PROJ_INFO_SIZE, white, buf);
        y -= .05;
    }
    snprintf(buf, sizeof(buf), "Total credit: %.0f   Average credit: %.0f", p->user_total_credit, p->user_expavg_credit);
    ttf_render_string(x, y, 0, PROJ_INFO_SIZE, white, buf);
    y -= .05;
    if (p->suspended_via_gui) {
        ttf_render_string(x, y, 0, PROJ_INFO_SIZE, white, "Suspended");
    }
}
示例#6
0
文件: ss_app.cpp 项目: DanAurea/boinc
void show_result(RESULT* r, float x, float& y, float alpha) {
    PROGRESS_2D progress;
    char buf[256];
    ttf_render_string(x, y, 0, TASK_PROJ_SIZE, white, (char*)r->project->project_name.c_str());
    y -= .02;
    float prog_pos[] = {x, y, 0};
    float prog_c[] = {.5, .4, .1, alpha/2};
    float prog_ci[] = {.1, .8, .2, alpha};
    progress.init(prog_pos, .4, -.01, -0.008, prog_c, prog_ci);
    progress.draw(r->fraction_done);
    snprintf(buf, sizeof(buf), "%.2f%% ", r->fraction_done*100);
    ttf_render_string(x+.41, y, 0, TASK_INFO_SIZE, white, buf);
    y -= .03;
    x += .05;
    snprintf(buf, sizeof(buf), "Elapsed: %.0f sec  Remaining: %.0f sec", r->elapsed_time, r->estimated_cpu_time_remaining);
    ttf_render_string(x, y, 0, TASK_INFO_SIZE, white, buf);
    y -= .03;
    snprintf(buf, sizeof(buf), "App: %s  Task: %s", r->app->user_friendly_name, r->wup->name);
    ttf_render_string(x, y, 0, TASK_INFO_SIZE, white, buf);
    y -= .03;
}
示例#7
0
文件: ss_app.cpp 项目: DanAurea/boinc
void app_graphics_init() {
    glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
    ttf_load_fonts(".");
    logo.load_image_file(logo_file);
    init_lights();
}
示例#8
0
文件: ss_app.cpp 项目: DanAurea/boinc
void show_disconnected() {
    float x=.3, y=.3;
    char buf[256];
    snprintf(buf, sizeof(buf), "%s is not running.", brand_name);
    ttf_render_string(x, y, 0, ALERT_SIZE, white, buf);
}