mirror of https://github.com/BOINC/boinc.git
MGR: Fix "Can't load Image" messages in Simple View; allow gaps in slide show file numbering; reload images if new project files downloaded
svn path=/trunk/boinc/; revision=23849
This commit is contained in:
parent
bb63eba187
commit
02d0303133
|
@ -4149,3 +4149,11 @@ David 14 July 2011
|
||||||
|
|
||||||
client/
|
client/
|
||||||
cpu_sched.cpp
|
cpu_sched.cpp
|
||||||
|
|
||||||
|
Charlie 18 July 11
|
||||||
|
- MGR: Fix "Can't load Image" messages in Simple View; allow gaps in slide
|
||||||
|
show file numbering; reload images if new project files downloaded.
|
||||||
|
|
||||||
|
clientgui/
|
||||||
|
sg_ProjectPanel.cpp, .h
|
||||||
|
sg_TaskPanel.cpp, .h
|
||||||
|
|
|
@ -401,6 +401,7 @@ void CSimpleProjectPanel::UpdateProjectList() {
|
||||||
if ( !found ) {
|
if ( !found ) {
|
||||||
selData = new ProjectSelectionData;
|
selData = new ProjectSelectionData;
|
||||||
strncpy(selData->project_url, project->master_url, sizeof(selData->project_url));
|
strncpy(selData->project_url, project->master_url, sizeof(selData->project_url));
|
||||||
|
selData->project_files_downloaded_time = 0.0;
|
||||||
wxBitmap* projectBM = GetProjectSpecificBitmap(selData->project_url);
|
wxBitmap* projectBM = GetProjectSpecificBitmap(selData->project_url);
|
||||||
wxString projname(project->project_name.c_str(), wxConvUTF8);
|
wxString projname(project->project_name.c_str(), wxConvUTF8);
|
||||||
m_ProjectSelectionCtrl->Append(projname, *projectBM, (void*)selData);
|
m_ProjectSelectionCtrl->Append(projname, *projectBM, (void*)selData);
|
||||||
|
@ -427,11 +428,12 @@ void CSimpleProjectPanel::UpdateProjectList() {
|
||||||
// Check to see if we need to reload the project icon
|
// Check to see if we need to reload the project icon
|
||||||
ctrlCount = m_ProjectSelectionCtrl->GetCount();
|
ctrlCount = m_ProjectSelectionCtrl->GetCount();
|
||||||
for(j=0; j<ctrlCount; j++) {
|
for(j=0; j<ctrlCount; j++) {
|
||||||
ctrl_url = ((ProjectSelectionData*)m_ProjectSelectionCtrl->GetClientData(j))->project_url;
|
selData = (ProjectSelectionData*)m_ProjectSelectionCtrl->GetClientData(j);
|
||||||
|
ctrl_url = selData->project_url;
|
||||||
project = pDoc->state.lookup_project(ctrl_url);
|
project = pDoc->state.lookup_project(ctrl_url);
|
||||||
if ( project->project_files_downloaded_time > m_Project_files_downloaded_time ) {
|
if ( project->project_files_downloaded_time > selData->project_files_downloaded_time ) {
|
||||||
wxBitmap* projectBM = GetProjectSpecificBitmap(ctrl_url);
|
wxBitmap* projectBM = GetProjectSpecificBitmap(ctrl_url);
|
||||||
m_Project_files_downloaded_time = project->project_files_downloaded_time;
|
selData->project_files_downloaded_time = project->project_files_downloaded_time;
|
||||||
m_ProjectSelectionCtrl->SetItemBitmap(j, *projectBM);
|
m_ProjectSelectionCtrl->SetItemBitmap(j, *projectBM);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char project_url[256];
|
char project_url[256];
|
||||||
|
double project_files_downloaded_time;
|
||||||
} ProjectSelectionData;
|
} ProjectSelectionData;
|
||||||
|
|
||||||
|
|
||||||
|
@ -78,7 +79,6 @@ class CSimpleProjectPanel : public CSimplePanelBase
|
||||||
wxString m_sTotalWorkDoneString;
|
wxString m_sTotalWorkDoneString;
|
||||||
int m_UsingAccountManager;
|
int m_UsingAccountManager;
|
||||||
char m_CurrentSelectedProjectURL[256];
|
char m_CurrentSelectedProjectURL[256];
|
||||||
double m_Project_files_downloaded_time;
|
|
||||||
double m_Project_last_rpc_time;
|
double m_Project_last_rpc_time;
|
||||||
wxString m_sAddProjectToolTip;
|
wxString m_sAddProjectToolTip;
|
||||||
wxString m_sSynchronizeToolTip;
|
wxString m_sSynchronizeToolTip;
|
||||||
|
|
|
@ -81,14 +81,15 @@ void CSlideShowPanel::OnSlideShowTimer(wxTimerEvent& WXUNUSED(event)) {
|
||||||
|
|
||||||
|
|
||||||
void CSlideShowPanel::AdvanceSlideShow(bool changeSlide) {
|
void CSlideShowPanel::AdvanceSlideShow(bool changeSlide) {
|
||||||
char fileName[1024], resolvedFileName[1024];
|
|
||||||
double xRatio, yRatio, ratio;
|
double xRatio, yRatio, ratio;
|
||||||
TaskSelectionData* selData = ((CSimpleTaskPanel*)GetParent())->GetTaskSelectionData();
|
TaskSelectionData* selData = ((CSimpleTaskPanel*)GetParent())->GetTaskSelectionData();
|
||||||
if (selData == NULL) return;
|
if (selData == NULL) return;
|
||||||
|
|
||||||
if ((selData->numSlides <= 0) && m_bCurrentSlideIsDefault) return;
|
int numSlides = selData->slideShowFileNames.size();
|
||||||
|
|
||||||
if (selData->numSlides <= 0) {
|
if (numSlides <= 0) {
|
||||||
|
if (m_bCurrentSlideIsDefault) return;
|
||||||
|
|
||||||
CSkinSimple* pSkinSimple = wxGetApp().GetSkinManager()->GetSimple();
|
CSkinSimple* pSkinSimple = wxGetApp().GetSkinManager()->GetSimple();
|
||||||
wxASSERT(pSkinSimple);
|
wxASSERT(pSkinSimple);
|
||||||
wxASSERT(wxDynamicCast(pSkinSimple, CSkinSimple));
|
wxASSERT(wxDynamicCast(pSkinSimple, CSkinSimple));
|
||||||
|
@ -101,7 +102,7 @@ void CSlideShowPanel::AdvanceSlideShow(bool changeSlide) {
|
||||||
// TODO: Should we allow slide show to advance if task is not running?
|
// TODO: Should we allow slide show to advance if task is not running?
|
||||||
if (selData->dotColor == greenDot) { // Advance only if running
|
if (selData->dotColor == greenDot) { // Advance only if running
|
||||||
if (changeSlide) {
|
if (changeSlide) {
|
||||||
if (++(selData->lastSlideShown) >= selData->numSlides) {
|
if (++(selData->lastSlideShown) >= numSlides) {
|
||||||
selData->lastSlideShown = 0;
|
selData->lastSlideShown = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -110,13 +111,11 @@ void CSlideShowPanel::AdvanceSlideShow(bool changeSlide) {
|
||||||
selData->lastSlideShown = 0;
|
selData->lastSlideShown = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(fileName, "%s%02d", selData->slide_show_filename_prefix, selData->lastSlideShown);
|
wxBitmap *bm = new wxBitmap();
|
||||||
if (boinc_resolve_filename(fileName, resolvedFileName, sizeof(resolvedFileName)) == 0) {
|
bm->LoadFile(selData->slideShowFileNames[selData->lastSlideShown], wxBITMAP_TYPE_ANY);
|
||||||
wxBitmap *bm = new wxBitmap();
|
m_SlideBitmap = *bm;
|
||||||
bm->LoadFile(wxString(resolvedFileName,wxConvUTF8), wxBITMAP_TYPE_ANY);
|
delete bm;
|
||||||
m_SlideBitmap = *bm;
|
|
||||||
delete bm;
|
|
||||||
}
|
|
||||||
if (m_SlideBitmap.Ok()) {
|
if (m_SlideBitmap.Ok()) {
|
||||||
m_bCurrentSlideIsDefault = false;
|
m_bCurrentSlideIsDefault = false;
|
||||||
}
|
}
|
||||||
|
@ -341,6 +340,7 @@ CSimpleTaskPanel::~CSimpleTaskPanel()
|
||||||
int count = m_TaskSelectionCtrl->GetCount();
|
int count = m_TaskSelectionCtrl->GetCount();
|
||||||
for(int j = count-1; j >=0; --j) {
|
for(int j = count-1; j >=0; --j) {
|
||||||
selData = (TaskSelectionData*)m_TaskSelectionCtrl->GetClientData(j);
|
selData = (TaskSelectionData*)m_TaskSelectionCtrl->GetClientData(j);
|
||||||
|
selData->slideShowFileNames.Clear();
|
||||||
delete selData;
|
delete selData;
|
||||||
m_TaskSelectionCtrl->SetClientData(j, NULL);
|
m_TaskSelectionCtrl->SetClientData(j, NULL);
|
||||||
}
|
}
|
||||||
|
@ -655,16 +655,58 @@ wxString CSimpleTaskPanel::FormatTime(float fBuffer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CSimpleTaskPanel::UpdateTaskSelectionList() {
|
void CSimpleTaskPanel::FindSlideShowFiles(TaskSelectionData *selData) {
|
||||||
int i, j, count, numSlides, newColor;
|
|
||||||
TaskSelectionData *selData;
|
|
||||||
RESULT* result;
|
|
||||||
RESULT* ctrlResult;
|
|
||||||
RESULT* state_result;
|
RESULT* state_result;
|
||||||
std::vector<bool>is_alive;
|
|
||||||
char urlDirectory[1024];
|
char urlDirectory[1024];
|
||||||
char fileName[1024];
|
char fileName[1024];
|
||||||
char resolvedFileName[1024];
|
char resolvedFileName[1024];
|
||||||
|
int j;
|
||||||
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
||||||
|
wxASSERT(pDoc);
|
||||||
|
|
||||||
|
|
||||||
|
selData->slideShowFileNames.Clear();
|
||||||
|
state_result = pDoc->state.lookup_result(selData->result->project_url, selData->result->name);
|
||||||
|
if (!state_result) {
|
||||||
|
pDoc->ForceCacheUpdate();
|
||||||
|
state_result = pDoc->state.lookup_result(selData->result->project_url, selData->result->name);
|
||||||
|
}
|
||||||
|
if (state_result) {
|
||||||
|
url_to_project_dir(state_result->project->master_url, urlDirectory);
|
||||||
|
for(j=0; j<99; ++j) {
|
||||||
|
sprintf(fileName, "%s/slideshow_%s_%02d", urlDirectory, state_result->app->name, j);
|
||||||
|
if(boinc_resolve_filename(fileName, resolvedFileName, sizeof(resolvedFileName)) == 0) {
|
||||||
|
if (boinc_file_exists(resolvedFileName)) {
|
||||||
|
selData->slideShowFileNames.Add(wxString(resolvedFileName,wxConvUTF8));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( selData->slideShowFileNames.size() == 0 ) {
|
||||||
|
for(j=0; j<99; ++j) {
|
||||||
|
sprintf(fileName, "%s/slideshow_%02d", urlDirectory, j);
|
||||||
|
if(boinc_resolve_filename(fileName, resolvedFileName, sizeof(resolvedFileName)) == 0) {
|
||||||
|
if (boinc_file_exists(resolvedFileName)) {
|
||||||
|
selData->slideShowFileNames.Add(wxString(resolvedFileName,wxConvUTF8));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
selData->lastSlideShown = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CSimpleTaskPanel::UpdateTaskSelectionList() {
|
||||||
|
int i, j, count, newColor;
|
||||||
|
TaskSelectionData *selData;
|
||||||
|
RESULT* result;
|
||||||
|
RESULT* ctrlResult;
|
||||||
|
std::vector<bool>is_alive;
|
||||||
CMainDocument* pDoc = wxGetApp().GetDocument();
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
||||||
wxASSERT(pDoc);
|
wxASSERT(pDoc);
|
||||||
|
|
||||||
|
@ -678,11 +720,15 @@ void CSimpleTaskPanel::UpdateTaskSelectionList() {
|
||||||
// First update existing entries and add new ones
|
// First update existing entries and add new ones
|
||||||
for(int i = 0; i < (int) pDoc->results.results.size(); i++) {
|
for(int i = 0; i < (int) pDoc->results.results.size(); i++) {
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
||||||
result = pDoc->result(i);
|
result = pDoc->result(i);
|
||||||
// only check tasks that are active
|
// only check tasks that are active
|
||||||
if ( result == NULL || !result->active_task ) {
|
if ( result == NULL || !result->active_task ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PROJECT* project = pDoc->state.lookup_project(result->project_url);
|
||||||
|
|
||||||
// loop through the items already in Task Selection Control to find this result
|
// loop through the items already in Task Selection Control to find this result
|
||||||
for(j = 0; j < count; ++j) {
|
for(j = 0; j < count; ++j) {
|
||||||
selData = (TaskSelectionData*)m_TaskSelectionCtrl->GetClientData(j);
|
selData = (TaskSelectionData*)m_TaskSelectionCtrl->GetClientData(j);
|
||||||
|
@ -692,12 +738,16 @@ void CSimpleTaskPanel::UpdateTaskSelectionList() {
|
||||||
selData->result = result;
|
selData->result = result;
|
||||||
found = true;
|
found = true;
|
||||||
is_alive.at(j) = true;
|
is_alive.at(j) = true;
|
||||||
|
if ( project && (project->project_files_downloaded_time > selData->project_files_downloaded_time) ) {
|
||||||
|
FindSlideShowFiles(selData);
|
||||||
|
selData->project_files_downloaded_time = project->project_files_downloaded_time;
|
||||||
|
}
|
||||||
break; // skip out of this loop
|
break; // skip out of this loop
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if it isn't currently one of the tabs then we have a new one! lets add it
|
// if it isn't currently one of the tabs then we have a new one! lets add it
|
||||||
if ( !found ) {
|
if (!found) {
|
||||||
#if SELECTBYRESULTNAME
|
#if SELECTBYRESULTNAME
|
||||||
wxString resname(result->name, wxConvUTF8);
|
wxString resname(result->name, wxConvUTF8);
|
||||||
#else
|
#else
|
||||||
|
@ -709,54 +759,19 @@ void CSimpleTaskPanel::UpdateTaskSelectionList() {
|
||||||
strncpy(selData->result_name, result->name, sizeof(selData->result_name));
|
strncpy(selData->result_name, result->name, sizeof(selData->result_name));
|
||||||
strncpy(selData->project_url, result->project_url, sizeof(selData->project_url));
|
strncpy(selData->project_url, result->project_url, sizeof(selData->project_url));
|
||||||
selData->dotColor = -1;
|
selData->dotColor = -1;
|
||||||
selData->slide_show_filename_prefix[0] = '\0';
|
FindSlideShowFiles(selData);
|
||||||
numSlides = 0;
|
if (project) {
|
||||||
state_result = pDoc->state.lookup_result(result->project_url, result->name);
|
selData->project_files_downloaded_time = project->project_files_downloaded_time;
|
||||||
if (!state_result) {
|
|
||||||
pDoc->ForceCacheUpdate();
|
|
||||||
state_result = pDoc->state.lookup_result(result->project_url, result->name);
|
|
||||||
}
|
}
|
||||||
if (state_result) {
|
|
||||||
url_to_project_dir(state_result->project->master_url, urlDirectory);
|
|
||||||
for(j=0; j<99; ++j) {
|
|
||||||
sprintf(fileName, "%s/slideshow_%s_%02d", urlDirectory, state_result->app->name, j);
|
|
||||||
if(boinc_resolve_filename(fileName, resolvedFileName, sizeof(resolvedFileName)) == 0) {
|
|
||||||
if (boinc_file_exists(resolvedFileName)) {
|
|
||||||
numSlides = j+1;
|
|
||||||
} else {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (numSlides > 0) {
|
|
||||||
sprintf(selData->slide_show_filename_prefix, "%s/slideshow_%s_", urlDirectory, state_result->app->name);
|
|
||||||
} else {
|
|
||||||
for(j=0; j<99; ++j) {
|
|
||||||
sprintf(fileName, "%s/slideshow_%02d", urlDirectory, j);
|
|
||||||
if(boinc_resolve_filename(fileName, resolvedFileName, sizeof(resolvedFileName)) == 0) {
|
|
||||||
if (boinc_file_exists(resolvedFileName)) {
|
|
||||||
numSlides = j+1;
|
|
||||||
} else {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (numSlides > 0) {
|
|
||||||
sprintf(selData->slide_show_filename_prefix, "%s/slideshow_", urlDirectory);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
selData->numSlides = numSlides;
|
|
||||||
selData->lastSlideShown = -1;
|
|
||||||
|
|
||||||
m_TaskSelectionCtrl->Append(resname, wxNullBitmap, (void*)selData);
|
m_TaskSelectionCtrl->Append(resname, wxNullBitmap, (void*)selData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check items in descending order so deletion won't change indexes of items yet to be checked
|
// Check items in descending order so deletion won't change indexes of items yet to be checked
|
||||||
for(j = count-1; j >=0; --j) {
|
for(j = count-1; j >=0; --j) {
|
||||||
if(! is_alive.at(j)) {
|
if(! is_alive.at(j)) {
|
||||||
selData = (TaskSelectionData*)m_TaskSelectionCtrl->GetClientData(j);
|
selData = (TaskSelectionData*)m_TaskSelectionCtrl->GetClientData(j);
|
||||||
|
selData->slideShowFileNames.Clear();
|
||||||
delete selData;
|
delete selData;
|
||||||
m_TaskSelectionCtrl->Delete(j);
|
m_TaskSelectionCtrl->Delete(j);
|
||||||
if (j == m_CurrentTaskSelection) {
|
if (j == m_CurrentTaskSelection) {
|
||||||
|
|
|
@ -29,9 +29,9 @@ typedef struct {
|
||||||
char result_name[256];
|
char result_name[256];
|
||||||
char project_url[256];
|
char project_url[256];
|
||||||
int dotColor;
|
int dotColor;
|
||||||
char slide_show_filename_prefix[1024];
|
wxArrayString slideShowFileNames;
|
||||||
int numSlides;
|
|
||||||
int lastSlideShown;
|
int lastSlideShown;
|
||||||
|
double project_files_downloaded_time;
|
||||||
} TaskSelectionData;
|
} TaskSelectionData;
|
||||||
|
|
||||||
|
|
||||||
|
@ -96,6 +96,7 @@ class CSimpleTaskPanel : public CSimplePanelBase
|
||||||
wxString GetTimeRemainingString(double f);
|
wxString GetTimeRemainingString(double f);
|
||||||
wxString GetStatusString(RESULT* result);
|
wxString GetStatusString(RESULT* result);
|
||||||
wxString FormatTime(float fBuffer);
|
wxString FormatTime(float fBuffer);
|
||||||
|
void FindSlideShowFiles(TaskSelectionData *selData);
|
||||||
void UpdateTaskSelectionList();
|
void UpdateTaskSelectionList();
|
||||||
bool isRunning(RESULT* result);
|
bool isRunning(RESULT* result);
|
||||||
bool DownloadingResults();
|
bool DownloadingResults();
|
||||||
|
|
Loading…
Reference in New Issue