mirror of https://github.com/BOINC/boinc.git
*** empty log message ***
svn path=/trunk/boinc/; revision=10720
This commit is contained in:
parent
ffbb8bcf35
commit
9a36c80c58
|
@ -283,7 +283,7 @@ void CSimpleFrame::InitSimpleClient()
|
||||||
std::string index = " ";
|
std::string index = " ";
|
||||||
//index += i;
|
//index += i;
|
||||||
friendlyName += wxString(index.c_str(), wxConvUTF8 );
|
friendlyName += wxString(index.c_str(), wxConvUTF8 );
|
||||||
CViewTabPage *wTab = new CViewTabPage(wrkUnitNB,i,resState->name);
|
CViewTabPage *wTab = new CViewTabPage(wrkUnitNB,i,resState->name,resState->project_url);
|
||||||
wrkUnitNB->AddPage(wTab, friendlyName, true);
|
wrkUnitNB->AddPage(wTab, friendlyName, true);
|
||||||
if(result->active_task_state == 1){
|
if(result->active_task_state == 1){
|
||||||
wrkUnitNB->SetPageImageIndex(i, 0); // this is working process
|
wrkUnitNB->SetPageImageIndex(i, 0); // this is working process
|
||||||
|
|
|
@ -49,6 +49,8 @@ CProjectsComponent::CProjectsComponent(CSimpleFrame* parent,wxPoint coord) :
|
||||||
{
|
{
|
||||||
wxASSERT(parent);
|
wxASSERT(parent);
|
||||||
m_maxNumOfIcons = 6; // max number of icons in component
|
m_maxNumOfIcons = 6; // max number of icons in component
|
||||||
|
m_rightIndex = 0;
|
||||||
|
m_leftIndex = 0;
|
||||||
LoadSkinImages();
|
LoadSkinImages();
|
||||||
CreateComponent();
|
CreateComponent();
|
||||||
|
|
||||||
|
@ -86,12 +88,11 @@ void CProjectsComponent::CreateComponent()
|
||||||
SetBackgroundColour(appSkin->GetAppBgCol());
|
SetBackgroundColour(appSkin->GetAppBgCol());
|
||||||
/////////////// ICONS /////////////////////
|
/////////////// ICONS /////////////////////
|
||||||
CMainDocument* pDoc = wxGetApp().GetDocument();
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
||||||
m_projCnt = pDoc->state.projects.size();
|
m_projCnt = (int)pDoc->state.projects.size();
|
||||||
std::string projectIconName = "stat_icon";
|
projectIconName = "stat_icon";
|
||||||
char filePath[256];
|
defaultIcnPath[256];
|
||||||
// url of project directory
|
// url of project directory
|
||||||
char urlDirectory[256];
|
urlDirectory[256];
|
||||||
std::string dirProjectGraphic;
|
|
||||||
|
|
||||||
for(int j = 0; j < m_projCnt; j++){
|
for(int j = 0; j < m_projCnt; j++){
|
||||||
PROJECT* project = pDoc->state.projects[j];
|
PROJECT* project = pDoc->state.projects[j];
|
||||||
|
@ -100,15 +101,17 @@ void CProjectsComponent::CreateComponent()
|
||||||
toolTipTxt = wxString(project->project_name.c_str(), wxConvUTF8 ) +wxT(". User ") + wxString(project->user_name.c_str(), wxConvUTF8) + wxT(" has ") + userCredit + wxT(" points.");
|
toolTipTxt = wxString(project->project_name.c_str(), wxConvUTF8 ) +wxT(". User ") + wxString(project->user_name.c_str(), wxConvUTF8) + wxT(" has ") + userCredit + wxT(" points.");
|
||||||
if(j < m_maxNumOfIcons){
|
if(j < m_maxNumOfIcons){
|
||||||
// Project button
|
// Project button
|
||||||
wxWindow *w_statW = new wxWindow(this,-1,wxPoint(29 + 52*j,3),wxSize(52,52));
|
//wxWindow *w_statW = new wxWindow(this,-1,wxPoint(29 + 52*j,3),wxSize(52,52));
|
||||||
wxToolTip *statToolTip = new wxToolTip(toolTipTxt);
|
wxToolTip *statToolTip = new wxToolTip(toolTipTxt);
|
||||||
StatImageLoader *i_statW = new StatImageLoader(w_statW,project->master_url,j);
|
StatImageLoader *i_statW = new StatImageLoader(this,project->master_url,j);
|
||||||
|
i_statW->Move(wxPoint(29 + 52*j,3));
|
||||||
|
|
||||||
// resolve the proj image
|
// resolve the proj image
|
||||||
url_to_project_dir((char*)project->master_url.c_str() ,urlDirectory);
|
url_to_project_dir((char*)project->master_url.c_str() ,urlDirectory);
|
||||||
dirProjectGraphic = (std::string)urlDirectory + "/" + projectIconName;
|
dirProjectGraphic = (std::string)urlDirectory + "/" + projectIconName;
|
||||||
//load stat icon
|
//load stat icon
|
||||||
if(boinc_resolve_filename(dirProjectGraphic.c_str(), filePath, sizeof(filePath)) == 0){
|
if(boinc_resolve_filename(dirProjectGraphic.c_str(), defaultIcnPath, sizeof(defaultIcnPath)) == 0){
|
||||||
g_statIcn = new wxImage(filePath, wxBITMAP_TYPE_PNG);
|
g_statIcn = new wxImage(defaultIcnPath, wxBITMAP_TYPE_PNG);
|
||||||
i_statW->LoadImage(g_statIcn);
|
i_statW->LoadImage(g_statIcn);
|
||||||
}else{
|
}else{
|
||||||
i_statW->LoadImage(g_statIcnDefault);
|
i_statW->LoadImage(g_statIcnDefault);
|
||||||
|
@ -118,6 +121,8 @@ void CProjectsComponent::CreateComponent()
|
||||||
|
|
||||||
// push icon in the vector
|
// push icon in the vector
|
||||||
m_statProjects.push_back(i_statW);
|
m_statProjects.push_back(i_statW);
|
||||||
|
//increment left index
|
||||||
|
m_leftIndex ++;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -158,40 +163,106 @@ void CProjectsComponent::OnBtnClick(wxCommandEvent& event){ //init function
|
||||||
wxObject *m_wxBtnObj = event.GetEventObject();
|
wxObject *m_wxBtnObj = event.GetEventObject();
|
||||||
|
|
||||||
if(m_wxBtnObj==btnArwLeft){
|
if(m_wxBtnObj==btnArwLeft){
|
||||||
btnArwLeft->Refresh();
|
//delete proj icon at position max number - 1(5)
|
||||||
}else if(m_wxBtnObj==btnArwRight){
|
delete m_statProjects.at(m_maxNumOfIcons-1);
|
||||||
delete m_statProjects.at(0);//delete proj icon at position 1(0)
|
//remove last element from vector
|
||||||
CMainDocument* pDoc = wxGetApp().GetDocument();
|
m_statProjects.pop_back();
|
||||||
//PROJECT* project = pDoc->state.projects[m];
|
//shift icons right
|
||||||
// shift icons to the left
|
for(int m = 0; m < (int)m_statProjects.size(); m++){
|
||||||
for(int m = 0; m < m_statProjects.size(); m++){
|
|
||||||
StatImageLoader *i_statWShifting = m_statProjects.at(m);
|
StatImageLoader *i_statWShifting = m_statProjects.at(m);
|
||||||
|
wxPoint currPoint = i_statWShifting->GetPosition();
|
||||||
|
i_statWShifting->Move(wxPoint(29 + 52*(m+1),3));
|
||||||
|
}
|
||||||
|
|
||||||
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
||||||
|
|
||||||
|
if(m_rightIndex-1 >= 0){
|
||||||
|
PROJECT* project = pDoc->state.projects.at(m_rightIndex-1);
|
||||||
|
userCredit.Printf(wxT("%0.2f"), project->user_total_credit);
|
||||||
|
toolTipTxt = wxString(project->project_name.c_str(), wxConvUTF8 ) +wxT(". User ") + wxString(project->user_name.c_str(), wxConvUTF8) + wxT(" has ") + userCredit + wxT(" points.");
|
||||||
|
wxToolTip *statToolTip = new wxToolTip(toolTipTxt);
|
||||||
|
StatImageLoader *i_statW = new StatImageLoader(this,project->master_url,m_leftIndex+1);
|
||||||
|
i_statW->Move(wxPoint(29,3));
|
||||||
|
// resolve the proj image
|
||||||
|
url_to_project_dir((char*)project->master_url.c_str() ,urlDirectory);
|
||||||
|
dirProjectGraphic = (std::string)urlDirectory + "/" + projectIconName;
|
||||||
|
if(boinc_resolve_filename(dirProjectGraphic.c_str(), defaultIcnPath, sizeof(defaultIcnPath)) == 0){
|
||||||
|
g_statIcn = new wxImage(defaultIcnPath, wxBITMAP_TYPE_PNG);
|
||||||
|
i_statW->LoadImage(g_statIcn);
|
||||||
|
}else{
|
||||||
|
i_statW->LoadImage(g_statIcnDefault);
|
||||||
|
}
|
||||||
|
|
||||||
|
i_statW->SetToolTip(statToolTip);
|
||||||
|
|
||||||
|
// push icon in the vector
|
||||||
|
m_statProjects.insert(m_statProjects.begin(),i_statW);
|
||||||
|
for(int m = 0; m < (int)m_statProjects.size(); m++){
|
||||||
|
StatImageLoader *i_statWShifting = m_statProjects.at(m);
|
||||||
|
wxPoint currPoint = i_statWShifting->GetPosition();
|
||||||
|
}
|
||||||
|
//increment left index
|
||||||
|
m_leftIndex --;
|
||||||
|
//increment right index
|
||||||
|
m_rightIndex --;
|
||||||
|
//now show left button
|
||||||
|
btnArwRight->Show(true);
|
||||||
|
|
||||||
|
}
|
||||||
|
//hide right arrow if we got to the end of the list
|
||||||
|
if(m_rightIndex <= 0){
|
||||||
|
btnArwLeft->Show(false);
|
||||||
|
}
|
||||||
|
btnArwLeft->Refresh();
|
||||||
|
|
||||||
|
}else if(m_wxBtnObj==btnArwRight){
|
||||||
|
//delete proj icon at position 1(0)
|
||||||
|
delete m_statProjects.at(0);
|
||||||
|
//shift the vector
|
||||||
|
m_statProjects.assign(m_statProjects.begin()+1,m_statProjects.end());
|
||||||
|
//shift icons left
|
||||||
|
for(int m = 0; m < (int)m_statProjects.size(); m++){
|
||||||
|
StatImageLoader *i_statWShifting = m_statProjects.at(m);
|
||||||
|
wxPoint currPoint = i_statWShifting->GetPosition();
|
||||||
i_statWShifting->Move(wxPoint(29 + 52*m,3));
|
i_statWShifting->Move(wxPoint(29 + 52*m,3));
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
//user credit text
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
||||||
userCredit.Printf(wxT("%0.2f"), project->user_total_credit);
|
//update project count
|
||||||
toolTipTxt = wxString(project->project_name.c_str(), wxConvUTF8 ) +wxT(". User ") + wxString(project->user_name.c_str(), wxConvUTF8) + wxT(" has ") + userCredit + wxT(" points.");
|
m_projCnt = (int)pDoc->state.projects.size();
|
||||||
// Project button
|
if(m_leftIndex+1 <= m_projCnt){
|
||||||
wxWindow *w_statW = new wxWindow(this,-1,wxPoint(29 + 52*j,3),wxSize(52,52));
|
PROJECT* project = pDoc->state.projects.at(m_leftIndex);
|
||||||
wxToolTip *statToolTip = new wxToolTip(toolTipTxt);
|
userCredit.Printf(wxT("%0.2f"), project->user_total_credit);
|
||||||
StatImageLoader *i_statW = new StatImageLoader(w_statW,project->master_url,j);
|
toolTipTxt = wxString(project->project_name.c_str(), wxConvUTF8 ) +wxT(". User ") + wxString(project->user_name.c_str(), wxConvUTF8) + wxT(" has ") + userCredit + wxT(" points.");
|
||||||
// resolve the proj image
|
wxToolTip *statToolTip = new wxToolTip(toolTipTxt);
|
||||||
url_to_project_dir((char*)project->master_url.c_str() ,urlDirectory);
|
StatImageLoader *i_statW = new StatImageLoader(this,project->master_url,m_leftIndex+1);
|
||||||
dirProjectGraphic = (std::string)urlDirectory + "/" + projectIconName;
|
i_statW->Move(wxPoint(29 + 52*(m_maxNumOfIcons-1),3));
|
||||||
//load stat icon
|
// resolve the proj image
|
||||||
if(boinc_resolve_filename(dirProjectGraphic.c_str(), filePath, sizeof(filePath)) == 0){
|
url_to_project_dir((char*)project->master_url.c_str() ,urlDirectory);
|
||||||
g_statIcn = new wxImage(filePath, wxBITMAP_TYPE_PNG);
|
dirProjectGraphic = (std::string)urlDirectory + "/" + projectIconName;
|
||||||
i_statW->LoadImage(g_statIcn);
|
if(boinc_resolve_filename(dirProjectGraphic.c_str(), defaultIcnPath, sizeof(defaultIcnPath)) == 0){
|
||||||
}else{
|
g_statIcn = new wxImage(defaultIcnPath, wxBITMAP_TYPE_PNG);
|
||||||
i_statW->LoadImage(g_statIcnDefault);
|
i_statW->LoadImage(g_statIcn);
|
||||||
|
}else{
|
||||||
|
i_statW->LoadImage(g_statIcnDefault);
|
||||||
|
}
|
||||||
|
|
||||||
|
i_statW->SetToolTip(statToolTip);
|
||||||
|
|
||||||
|
// push icon in the vector
|
||||||
|
m_statProjects.push_back(i_statW);
|
||||||
|
//increment left index
|
||||||
|
m_leftIndex ++;
|
||||||
|
//increment right index
|
||||||
|
m_rightIndex ++;
|
||||||
|
//now show left button
|
||||||
|
btnArwLeft->Show(true);
|
||||||
|
|
||||||
|
}
|
||||||
|
//hide right arrow if we got to the end of the list
|
||||||
|
if(m_leftIndex >= m_projCnt){
|
||||||
|
btnArwRight->Show(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
i_statW->SetToolTip(statToolTip);
|
|
||||||
|
|
||||||
// push icon in the vector
|
|
||||||
m_statProjects.push_back(i_statW);
|
|
||||||
*/
|
|
||||||
btnArwRight->Refresh();
|
btnArwRight->Refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -33,6 +33,10 @@ public:
|
||||||
|
|
||||||
//Skin Class
|
//Skin Class
|
||||||
SkinClass *appSkin;
|
SkinClass *appSkin;
|
||||||
|
char defaultIcnPath[256];
|
||||||
|
char urlDirectory[256];
|
||||||
|
std::string dirProjectGraphic;
|
||||||
|
std::string projectIconName;
|
||||||
// projects vector
|
// projects vector
|
||||||
std::vector<StatImageLoader*> m_statProjects; // vector of all project icons created for GUI
|
std::vector<StatImageLoader*> m_statProjects; // vector of all project icons created for GUI
|
||||||
wxImage *g_statIcn;
|
wxImage *g_statIcn;
|
||||||
|
@ -67,6 +71,8 @@ public:
|
||||||
protected:
|
protected:
|
||||||
int m_maxNumOfIcons;
|
int m_maxNumOfIcons;
|
||||||
int m_projCnt;
|
int m_projCnt;
|
||||||
|
int m_leftIndex;
|
||||||
|
int m_rightIndex;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ BEGIN_EVENT_TABLE(StatImageLoader, wxWindow)
|
||||||
EVT_MENU(WEBSITE_URL_MENU_ID_REMOVE_PROJECT,StatImageLoader::OnMenuLinkClicked)
|
EVT_MENU(WEBSITE_URL_MENU_ID_REMOVE_PROJECT,StatImageLoader::OnMenuLinkClicked)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
StatImageLoader::StatImageLoader(wxWindow* parent, std::string url,int index) : wxWindow(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNO_BORDER)
|
StatImageLoader::StatImageLoader(wxWindow* parent, std::string url,int index) : wxWindow(parent, wxID_ANY, wxDefaultPosition, wxSize(52,52), wxNO_BORDER)
|
||||||
{
|
{
|
||||||
m_parent = parent;
|
m_parent = parent;
|
||||||
m_prjUrl = url;
|
m_prjUrl = url;
|
||||||
|
|
|
@ -44,12 +44,13 @@ END_EVENT_TABLE()
|
||||||
|
|
||||||
CViewTabPage::CViewTabPage() {}
|
CViewTabPage::CViewTabPage() {}
|
||||||
|
|
||||||
CViewTabPage::CViewTabPage(wxFlatNotebook* parent,int index,std::string name) :
|
CViewTabPage::CViewTabPage(wxFlatNotebook* parent,int index,std::string name,std::string url) :
|
||||||
wxPanel(parent, -1, wxDefaultPosition, wxSize(370,330), wxNO_BORDER)
|
wxPanel(parent, -1, wxDefaultPosition, wxSize(370,330), wxNO_BORDER)
|
||||||
{
|
{
|
||||||
wxASSERT(parent);
|
wxASSERT(parent);
|
||||||
m_tabIndex = index;
|
m_tabIndex = index;
|
||||||
m_name = name;
|
m_name = name;
|
||||||
|
m_prjUrl = url;
|
||||||
LoadSkinImages();
|
LoadSkinImages();
|
||||||
|
|
||||||
CreatePage();
|
CreatePage();
|
||||||
|
@ -314,17 +315,15 @@ void CViewTabPage::OnWorkShowGraphics() {
|
||||||
iAnswer = wxYES;
|
iAnswer = wxYES;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (wxYES == iAnswer) {
|
if (wxYES == iAnswer) {
|
||||||
/*
|
pDoc->WorkShowGraphics(
|
||||||
int x = 3;
|
m_prjUrl,
|
||||||
pDoc->WorkShowGraphics(
|
m_name,
|
||||||
m_tabIndex,
|
MODE_WINDOW,
|
||||||
MODE_WINDOW,
|
std::string((const char*)wxGetApp().m_strDefaultWindowStation.mb_str()),
|
||||||
wxGetApp().m_strDefaultWindowStation,
|
std::string((const char*)wxGetApp().m_strDefaultDesktop.mb_str()),
|
||||||
wxGetApp().m_strDefaultDesktop,
|
std::string((const char*)wxGetApp().m_strDefaultDisplay.mb_str())
|
||||||
wxGetApp().m_strDefaultDisplay
|
);
|
||||||
);
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//pFrame->FireRefreshView();
|
//pFrame->FireRefreshView();
|
||||||
|
|
|
@ -78,7 +78,7 @@ public:
|
||||||
|
|
||||||
CViewTabPage();
|
CViewTabPage();
|
||||||
CViewTabPage(
|
CViewTabPage(
|
||||||
wxFlatNotebook* parent, int index, std::string name
|
wxFlatNotebook* parent, int index, std::string name,std::string url
|
||||||
);
|
);
|
||||||
~CViewTabPage();
|
~CViewTabPage();
|
||||||
|
|
||||||
|
@ -103,6 +103,7 @@ protected:
|
||||||
int m_tabIndex;
|
int m_tabIndex;
|
||||||
//tab identifier
|
//tab identifier
|
||||||
std::string m_name;
|
std::string m_name;
|
||||||
|
std::string m_prjUrl;
|
||||||
|
|
||||||
wxInt32 FormatCPUTime( RESULT* rslt, wxString& strBuffer ) const;
|
wxInt32 FormatCPUTime( RESULT* rslt, wxString& strBuffer ) const;
|
||||||
wxInt32 FormatTimeToCompletion( RESULT* rslt, wxString& strBuffer ) const;
|
wxInt32 FormatTimeToCompletion( RESULT* rslt, wxString& strBuffer ) const;
|
||||||
|
|
Loading…
Reference in New Issue