mirror of https://github.com/BOINC/boinc.git
*** empty log message ***
svn path=/trunk/boinc/; revision=10615
This commit is contained in:
parent
52e3352c1f
commit
3d6666104f
|
@ -48,7 +48,10 @@ IMPLEMENT_DYNAMIC_CLASS(CSimpleFrame, CBOINCBaseFrame)
|
|||
|
||||
enum{
|
||||
BTN_SHOW_GRAPHICS = 24000,
|
||||
BTN_COLLAPSE = 24100,
|
||||
BTN_COLLAPSE = 24050,
|
||||
GAUGE_MAIN_PROGRESS = 24100,
|
||||
LBL_ELAPSED_TIME = 24101,
|
||||
LBL_REMAINING_TIME = 24102,
|
||||
};
|
||||
|
||||
BEGIN_EVENT_TABLE(CSimpleFrame, CBOINCBaseFrame)
|
||||
|
@ -181,8 +184,9 @@ void CSimpleFrame::OnFrameRender(wxTimerEvent &event) {
|
|||
//Update();
|
||||
clientGUIInitialized = true;
|
||||
Show(true);
|
||||
}//else check for changes in the interface
|
||||
|
||||
}else{ //check for changes in the interface
|
||||
UpdateClientGUI();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -254,9 +258,9 @@ void CSimpleFrame::InitSimpleClient()
|
|||
}
|
||||
///////////////////////Build Tab Page///////////////////////////////
|
||||
//Prj Icon
|
||||
w_iconPT1=new wxWindow(wTab,-1,SetwxPoint(2,2),SetwxSize(22,22));
|
||||
i_prjIcnPT1 = new ImageLoader(w_iconPT1);
|
||||
i_prjIcnPT1->LoadImage(g_prjIcnWCG);
|
||||
w_iconPI=new wxWindow(wTab,-1,SetwxPoint(2,2),SetwxSize(22,22));
|
||||
i_prjIcnPI = new ImageLoader(w_iconPI);
|
||||
i_prjIcnPI->LoadImage(g_prjIcn);
|
||||
//Project Name
|
||||
lblProjectName=new wxStaticText(wTab,-1,wxT(""),SetwxPoint(25,2),SetwxSize(289,18),wxST_NO_AUTORESIZE);
|
||||
lblProjectName->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
|
||||
|
@ -272,11 +276,11 @@ void CSimpleFrame::InitSimpleClient()
|
|||
lblMyProgress->SetLabel(wxT("My Progress:"));
|
||||
lblMyProgress->SetFont(wxFont(10,74,90,92,0,wxT("Tahoma")));
|
||||
//Main Gauge
|
||||
gaugeWuP1=new wxGauge(wTab,-1,100,SetwxPoint(15,60),SetwxSize(340,30),wxGA_SMOOTH);
|
||||
gaugeWuP1->SetForegroundColour(appSkin->GetGaugeFgCol());
|
||||
gaugeWuP1->SetBackgroundColour(appSkin->GetGaugeBgCol());
|
||||
gaugeWuP1->SetValue(floor(result->fraction_done * 100000)/1000);
|
||||
//Work Unit Name
|
||||
gaugeWUMain=new wxGauge(wTab,GAUGE_MAIN_PROGRESS,100,SetwxPoint(15,60),SetwxSize(340,30),wxGA_SMOOTH);
|
||||
gaugeWUMain->SetForegroundColour(appSkin->GetGaugeFgCol());
|
||||
gaugeWUMain->SetBackgroundColour(appSkin->GetGaugeBgCol());
|
||||
gaugeWUMain->SetValue(floor(result->fraction_done * 100000)/1000);
|
||||
//Work Unit Name
|
||||
lblWrkUnitName=new wxStaticText(wTab,-1,wxT(""),SetwxPoint(110,34),SetwxSize(250,13),wxST_NO_AUTORESIZE);
|
||||
lblWrkUnitName->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
|
||||
lblWrkUnitName->SetLabel(wxString(result->name.c_str(),wxConvUTF8));
|
||||
|
@ -287,7 +291,7 @@ void CSimpleFrame::InitSimpleClient()
|
|||
lblElapsedTime->SetFont(wxFont(10,74,90,90,0,wxT("Tahoma")));
|
||||
//Elapsed time Value
|
||||
wxString strBuffer = wxEmptyString;
|
||||
lblElapsedTimeValue=new wxStaticText(wTab,-1,wxT(""),SetwxPoint(102,97),SetwxSize(364,18),wxST_NO_AUTORESIZE);
|
||||
lblElapsedTimeValue=new wxStaticText(wTab,LBL_ELAPSED_TIME,wxT(""),SetwxPoint(102,97),SetwxSize(364,18),wxST_NO_AUTORESIZE);
|
||||
lblElapsedTimeValue->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
|
||||
FormatCPUTime(result, strBuffer);
|
||||
lblElapsedTimeValue->SetLabel(strBuffer);
|
||||
|
@ -298,7 +302,7 @@ void CSimpleFrame::InitSimpleClient()
|
|||
lblTimeRemaining->SetLabel(wxT("Time remaining:"));
|
||||
lblTimeRemaining->SetFont(wxFont(10,74,90,90,0,wxT("Tahoma")));
|
||||
//Time Remaining Value
|
||||
lblTimeRemainingValue=new wxStaticText(wTab,-1,wxT(""),SetwxPoint(115,119),SetwxSize(200,18),wxST_NO_AUTORESIZE);
|
||||
lblTimeRemainingValue=new wxStaticText(wTab,LBL_REMAINING_TIME,wxT(""),SetwxPoint(115,119),SetwxSize(200,18),wxST_NO_AUTORESIZE);
|
||||
lblTimeRemainingValue->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
|
||||
FormatTimeToCompletion(result, strBuffer);
|
||||
lblTimeRemainingValue->SetLabel(strBuffer);
|
||||
|
@ -339,6 +343,8 @@ void CSimpleFrame::InitSimpleClient()
|
|||
wxMessageBox(_T("Sorry, this animation was not a valid animated GIF."));
|
||||
}
|
||||
|
||||
// push page into the vector
|
||||
m_windows.push_back(wTab);
|
||||
}
|
||||
|
||||
wrkUnitNB->SetSelection(0);
|
||||
|
@ -425,6 +431,28 @@ void CSimpleFrame::InitSimpleClient()
|
|||
|
||||
Refresh();
|
||||
}
|
||||
void CSimpleFrame::UpdateClientGUI(){
|
||||
|
||||
CMainDocument* pDoc = wxGetApp().GetDocument();
|
||||
//update GUI
|
||||
int resultCnt = pDoc->results.results.size();
|
||||
wxString strBuffer = wxEmptyString;
|
||||
|
||||
for(int i = 0; i < resultCnt; i++){
|
||||
RESULT* result = pDoc->results.results[i];
|
||||
//Elapsed time Value
|
||||
FormatCPUTime(result, strBuffer);
|
||||
wxWindow *currTab = m_windows[i];
|
||||
wxStaticText *stET = wxDynamicCast(currTab->FindWindowById(LBL_ELAPSED_TIME), wxStaticText);
|
||||
// currTab->FindWindowById(LBL_ELAPSED_TIME)->SetLabel(strBuffer);
|
||||
stET->SetLabel(strBuffer);
|
||||
stET->Update();
|
||||
//currTab->Refresh();
|
||||
}
|
||||
//gaugeWUMain->SetValue(floor(result->fraction_done * 100000)/1000);
|
||||
//Refresh();
|
||||
}
|
||||
|
||||
void CSimpleFrame::initAfter(){
|
||||
//add your code here
|
||||
//Centre();
|
||||
|
@ -437,7 +465,7 @@ void CSimpleFrame::LoadSkinImages(){
|
|||
|
||||
fileImgBuf[0].LoadFile(dirPref + appSkin->GetAppBg(),wxBITMAP_TYPE_BMP);
|
||||
// prj icons will be removed
|
||||
g_prjIcnWCG = new wxImage(dirPref + appSkin->GetIcnPrjWCG(), wxBITMAP_TYPE_PNG);
|
||||
g_prjIcn = new wxImage(dirPref + appSkin->GetIcnPrjWCG(), wxBITMAP_TYPE_PNG);
|
||||
g_prjIcnPDRC = new wxImage(dirPref + appSkin->GetIcnPrjPRED(), wxBITMAP_TYPE_PNG);
|
||||
// work unit icons
|
||||
g_icoSleepWU = new wxImage(dirPref + appSkin->GetIcnSleepingWkUnit(), wxBITMAP_TYPE_PNG);
|
||||
|
@ -752,8 +780,8 @@ void CSimpleFrame::ReskinAppGUI(){
|
|||
btnExpand->SetBitmapLabel(btmpExp);
|
||||
btnExpand->SetBitmapSelected(btmpExpClick);
|
||||
//gauges
|
||||
gaugeWuP1->SetForegroundColour(appSkin->GetGaugeFgCol());
|
||||
gaugeWuP1->SetBackgroundColour(appSkin->GetGaugeBgCol());
|
||||
gaugeWUMain->SetForegroundColour(appSkin->GetGaugeFgCol());
|
||||
gaugeWUMain->SetBackgroundColour(appSkin->GetGaugeBgCol());
|
||||
btnExpand->SetBackgroundColour(appSkin->GetAppBgCol());
|
||||
btnCollapse->SetBackgroundColour(appSkin->GetAppBgCol());
|
||||
btnArwLeft->SetBackgroundColour(appSkin->GetAppBgCol());
|
||||
|
|
|
@ -47,13 +47,13 @@ public:
|
|||
|
||||
|
||||
// Images
|
||||
wxImage *g_prjIcnWCG;
|
||||
wxImage *g_prjIcn;
|
||||
wxImage *g_prjIcnPDRC;
|
||||
wxImage *g_icoSleepWU;
|
||||
wxImage *g_icoWorkWU;
|
||||
//
|
||||
ImageLoader *i_prjIcnPT1;
|
||||
wxWindow *w_iconPT1;
|
||||
ImageLoader *i_prjIcnPI;
|
||||
wxWindow *w_iconPI;
|
||||
//
|
||||
ImageLoader *i_prjIcnP1;
|
||||
wxWindow *w_iconP1;
|
||||
|
@ -61,8 +61,7 @@ public:
|
|||
ImageLoader *i_prjIcnP2;
|
||||
wxWindow *w_iconP2;
|
||||
// Flat Neotebook
|
||||
wxWindow *wTab1;
|
||||
wxWindow *wTab2;
|
||||
std::vector<wxWindow*> m_windows; // vector of all window tabs created for notebook
|
||||
wxFlatNotebookImageList m_ImageList;
|
||||
wxFlatNotebook *wrkUnitNB;
|
||||
//wxBitmap const sleepWUico;
|
||||
|
@ -126,7 +125,7 @@ public:
|
|||
wxStaticLine *lnProjName;
|
||||
wxStaticText *lblMyProgress;
|
||||
wxStaticText *lblWrkUnitName;
|
||||
wxGauge *gaugeWuP1;
|
||||
wxGauge *gaugeWUMain;
|
||||
wxStaticText *lblElapsedTime;
|
||||
wxStaticText *lblElapsedTimeValue;
|
||||
wxStaticText *lblTimeRemaining;
|
||||
|
@ -155,6 +154,7 @@ public:
|
|||
|
||||
void InitEmptyState();
|
||||
void InitSimpleClient();
|
||||
void UpdateClientGUI();
|
||||
int LoadSkinXML();
|
||||
void LoadSkinImages();
|
||||
void ReskinAppGUI();
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
enum{
|
||||
WEBSITE_URL_MENU_ID = 34500,
|
||||
WEBSITE_URL_MENU_ID_REMOVE_PROJECT = 34550,
|
||||
};
|
||||
|
||||
|
||||
|
@ -13,6 +14,7 @@ BEGIN_EVENT_TABLE(StatImageLoader, wxWindow)
|
|||
EVT_PAINT(StatImageLoader::OnPaint)
|
||||
EVT_LEFT_DOWN(StatImageLoader::PopUpMenu)
|
||||
EVT_MENU(WEBSITE_URL_MENU_ID,StatImageLoader::OnMenuLinkClicked)
|
||||
EVT_MENU(WEBSITE_URL_MENU_ID_REMOVE_PROJECT,StatImageLoader::OnMenuLinkClicked)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
StatImageLoader::StatImageLoader(wxWindow* parent, std::string url) : wxWindow(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNO_BORDER)
|
||||
|
@ -49,6 +51,20 @@ void StatImageLoader::CreateMenu()
|
|||
|
||||
statPopUpMenu->Append(urlItem);
|
||||
}
|
||||
|
||||
statPopUpMenu->AppendSeparator();
|
||||
wxMenuItemList menuList = statPopUpMenu->GetMenuItems();
|
||||
//wxMenuItem* separ = statPopUpMenu->FindItemByPosition(i);
|
||||
#ifdef __WXMSW__
|
||||
menuList[statPopUpMenu->GetMenuItemCount()-1]->SetBackgroundColour(wxColour("RED"));
|
||||
#endif
|
||||
|
||||
wxMenuItem *urlItem = new wxMenuItem(statPopUpMenu, WEBSITE_URL_MENU_ID_REMOVE_PROJECT,wxT("Remove Project"));
|
||||
#ifdef __WXMSW__
|
||||
urlItem->SetBackgroundColour(appSkin->GetAppBgCol());
|
||||
#endif
|
||||
Connect( WEBSITE_URL_MENU_ID_REMOVE_PROJECT, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(StatImageLoader::OnMenuLinkClicked) );
|
||||
statPopUpMenu->Append(urlItem);
|
||||
//
|
||||
/*
|
||||
wxBitmap *btmTellFriend = new wxBitmap();
|
||||
|
@ -58,21 +74,24 @@ void StatImageLoader::CreateMenu()
|
|||
}
|
||||
void StatImageLoader::OnMenuLinkClicked(wxCommandEvent& event)
|
||||
{
|
||||
wxObject *m_wxBtnObj = event.GetEventObject();
|
||||
int menuIDevt = event.GetId();
|
||||
int menuId = menuIDevt - WEBSITE_URL_MENU_ID;
|
||||
|
||||
CMainDocument* pDoc = wxGetApp().GetDocument();
|
||||
wxASSERT(pDoc);
|
||||
wxObject *m_wxBtnObj = event.GetEventObject();
|
||||
int menuIDevt = event.GetId();
|
||||
|
||||
PROJECT* project = pDoc->state.lookup_project(prjUrl);
|
||||
project->gui_urls[menuId].name.c_str();
|
||||
if(menuIDevt == WEBSITE_URL_MENU_ID_REMOVE_PROJECT){
|
||||
//call detach project function
|
||||
}else{
|
||||
int menuId = menuIDevt - WEBSITE_URL_MENU_ID;
|
||||
PROJECT* project = pDoc->state.lookup_project(prjUrl);
|
||||
project->gui_urls[menuId].name.c_str();
|
||||
|
||||
CBOINCBaseFrame* pFrame = wxDynamicCast(m_parent->GetParent(),CBOINCBaseFrame);
|
||||
wxASSERT(pFrame);
|
||||
wxASSERT(wxDynamicCast(pFrame, CBOINCBaseFrame));
|
||||
pFrame->ExecuteBrowserLink(project->gui_urls[menuId].url.c_str());
|
||||
int re = 4;
|
||||
CBOINCBaseFrame* pFrame = wxDynamicCast(m_parent->GetParent(),CBOINCBaseFrame);
|
||||
wxASSERT(pFrame);
|
||||
wxASSERT(wxDynamicCast(pFrame, CBOINCBaseFrame));
|
||||
pFrame->ExecuteBrowserLink(project->gui_urls[menuId].url.c_str());
|
||||
int re = 4;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue