MGR: Fix "Can't load Image" messages in Simple View

svn path=/branches/boinc_core_release_6_12/; revision=23848
This commit is contained in:
Charlie Fenton 2011-07-18 08:38:22 +00:00
parent ba55160001
commit c828b82c3d
3 changed files with 27 additions and 11 deletions

View File

@ -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

View File

@ -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);

View File

@ -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<wxBitmap> *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<wxBitmap> *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() ) {