From c828b82c3d24e2da9337c24578829521f4804d68 Mon Sep 17 00:00:00 2001 From: Charlie Fenton Date: Mon, 18 Jul 2011 08:38:22 +0000 Subject: [PATCH] MGR: Fix "Can't load Image" messages in Simple View svn path=/branches/boinc_core_release_6_12/; revision=23848 --- checkin_notes | 7 +++++++ clientgui/sg_StatImageLoader.cpp | 26 ++++++++++++++++---------- clientgui/sg_ViewTabPage.cpp | 5 ++++- 3 files changed, 27 insertions(+), 11 deletions(-) diff --git a/checkin_notes b/checkin_notes index e7a262505f..80a07aad5d 100644 --- a/checkin_notes +++ b/checkin_notes @@ -10013,3 +10013,10 @@ Charlie 8 July 2011 BOINCTaskBar.cpp mac/ MacSysMenu.cpp, .h + +Charlie 18 July 11 + - MGR: Fix "Can't load Image" messages in Simple View. + + clientgui/ + sg_StatImageLoader.cpp + sg_ViewTabPage.cpp diff --git a/clientgui/sg_StatImageLoader.cpp b/clientgui/sg_StatImageLoader.cpp index d14ebf3157..066834b296 100644 --- a/clientgui/sg_StatImageLoader.cpp +++ b/clientgui/sg_StatImageLoader.cpp @@ -33,6 +33,7 @@ #include "sg_StatImageLoader.h" #include "sg_ProjectsComponent.h" #include "app_ipc.h" +#include "filesys.h" enum{ WEBSITE_URL_MENU_ID = 34500, @@ -229,15 +230,19 @@ void StatImageLoader::LoadImage() { CSkinSimple* pSkinSimple = wxGetApp().GetSkinManager()->GetSimple(); char defaultIcnPath[256]; - if(boinc_resolve_filename(GetProjectIconLoc().c_str(), defaultIcnPath, sizeof(defaultIcnPath)) == 0){ - wxBitmap* btmpStatIcn = new wxBitmap(); - if ( btmpStatIcn->LoadFile(wxString(defaultIcnPath,wxConvUTF8), wxBITMAP_TYPE_ANY) ) { - LoadStatIcon(*btmpStatIcn); - } else { - LoadStatIcon(*pSkinSimple->GetProjectImage()->GetBitmap()); - } - delete btmpStatIcn; - }else{ + if(boinc_resolve_filename(GetProjectIconLoc().c_str(), defaultIcnPath, sizeof(defaultIcnPath)) == 0) { + if (boinc_file_exists(defaultIcnPath)) { + wxBitmap* btmpStatIcn = new wxBitmap(); + if ( btmpStatIcn->LoadFile(wxString(defaultIcnPath,wxConvUTF8), wxBITMAP_TYPE_ANY) ) { + LoadStatIcon(*btmpStatIcn); + } else { + LoadStatIcon(*pSkinSimple->GetProjectImage()->GetBitmap()); + } + delete btmpStatIcn; + }else{ + LoadStatIcon(*pSkinSimple->GetProjectImage()->GetBitmap()); + } + }else{ LoadStatIcon(*pSkinSimple->GetProjectImage()->GetBitmap()); } } @@ -246,7 +251,8 @@ void StatImageLoader::LoadImage() { void StatImageLoader::ReloadProjectSpecificIcon() { char defaultIcnPath[256]; // Only update if it is project specific is found - if(boinc_resolve_filename(GetProjectIconLoc().c_str(), defaultIcnPath, sizeof(defaultIcnPath)) == 0){ + if(boinc_resolve_filename(GetProjectIconLoc().c_str(), defaultIcnPath, sizeof(defaultIcnPath)) == 0) { + if (! boinc_file_exists(defaultIcnPath)) return; wxBitmap* btmpStatIcn = new wxBitmap(); if ( btmpStatIcn->LoadFile(wxString(defaultIcnPath,wxConvUTF8), wxBITMAP_TYPE_ANY) ) { LoadStatIcon(*btmpStatIcn); diff --git a/clientgui/sg_ViewTabPage.cpp b/clientgui/sg_ViewTabPage.cpp index 0181d0cf20..fe4e275bf4 100644 --- a/clientgui/sg_ViewTabPage.cpp +++ b/clientgui/sg_ViewTabPage.cpp @@ -36,6 +36,7 @@ #include "sg_ImageLoader.h" #include "sg_ViewTabPage.h" #include "app_ipc.h" +#include "filesys.h" IMPLEMENT_DYNAMIC_CLASS(CViewTabPage, wxPanel) @@ -200,6 +201,7 @@ void CViewTabPage::LoadSlideShow(std::vector *vSlideShow) { for(int i=0; i<99; i++) { sprintf(file, "%s/slideshow_%s_%02d", urlDirectory, result->app->name, i); if(boinc_resolve_filename(file, resolvedFile, sizeof(resolvedFile)) == 0){ + if (!boinc_file_exists(resolvedFile)) continue; btmpSlideShow = new wxBitmap(); if ( btmpSlideShow->LoadFile(wxString(resolvedFile,wxConvUTF8), wxBITMAP_TYPE_ANY) ) { if (btmpSlideShow->Ok() ) { @@ -214,7 +216,8 @@ void CViewTabPage::LoadSlideShow(std::vector *vSlideShow) { if ( vSlideShow->size() == 0 ) { for(int i=0; i<99; i++) { sprintf(file, "%s/slideshow_%02d", urlDirectory, i); - if(boinc_resolve_filename(file, resolvedFile, sizeof(resolvedFile)) == 0){ + if(boinc_resolve_filename(file, resolvedFile, sizeof(resolvedFile)) == 0) { + if (!boinc_file_exists(resolvedFile)) continue; btmpSlideShow = new wxBitmap(); if ( btmpSlideShow->LoadFile(wxString(resolvedFile,wxConvUTF8), wxBITMAP_TYPE_ANY) ) { if (btmpSlideShow->Ok() ) {