diff --git a/clientgui/sg_BoincSimpleGUI.h b/clientgui/sg_BoincSimpleGUI.h index f1a5fb76fc..7575e2090c 100644 --- a/clientgui/sg_BoincSimpleGUI.h +++ b/clientgui/sg_BoincSimpleGUI.h @@ -44,8 +44,7 @@ public: ~CSimpleFrame(); - void OnConnect( CFrameEvent& event ); - + // Images wxImage *g_prjIcnWCG; @@ -118,15 +117,15 @@ public: //////////////////////////// wxStaticText *st9c; wxWindow *w11c; - wxStaticText *st12c; - wxStaticLine *lno14c; - wxStaticText *st15c; - wxStaticText *st16c; + wxStaticText *lblProjectName; + wxStaticLine *lnProjName; + wxStaticText *lblMyProgress; + wxStaticText *lblWrkUnitName; wxGauge *gaugeWuP1; - wxStaticText *st18c; - wxStaticText *st19c; - wxStaticText *st20c; - wxStaticText *st21c; + wxStaticText *lblElapsedTime; + wxStaticText *lblElapsedTimeValue; + wxStaticText *lblTimeRemaining; + wxStaticText *lblTimeRemainingValue; wxStaticText *st22c; wxStaticText *st23c; wxStaticText *stMyProj; @@ -147,7 +146,9 @@ public: wxBitmapButton *btnAdvancedView; wxStaticBitmap *imgBgAnim; wxStaticLine *lnMyProjBtm; + bool clientGUIInitialized; + void InitEmptyState(); void InitSimpleClient(); int LoadSkinXML(); void LoadSkinImages(); @@ -183,11 +184,18 @@ public: wxAnimationBase& GetAnimation() { return m_animation; } #endif + wxTimer* m_pFrameRenderTimer; + DECLARE_EVENT_TABLE() protected: void OnEraseBackground(wxEraseEvent& event); void OnBtnClick(wxCommandEvent& event); + void OnConnect( CFrameEvent& event ); + void OnFrameRender( wxTimerEvent& event ); + wxInt32 FormatCPUTime( RESULT* rslt, wxString& strBuffer ) const; + wxInt32 FormatTimeToCompletion( RESULT* rslt, wxString& strBuffer ) const; + void SGUITimeFormat( float fBuffer, wxString& strBuffer) const; void DrawBackImg(wxEraseEvent& event,wxWindow *win,wxBitmap & bitMap,int opz); wxPoint m_tmppoint; wxSize m_tmpsize; diff --git a/clientgui/sg_StatImageLoader.cpp b/clientgui/sg_StatImageLoader.cpp index d453db90b9..3e8cdd87bb 100644 --- a/clientgui/sg_StatImageLoader.cpp +++ b/clientgui/sg_StatImageLoader.cpp @@ -1,5 +1,5 @@ #include "stdwx.h" - +#include #include "BOINCGUIApp.h" #include "sg_StatImageLoader.h" @@ -9,9 +9,10 @@ BEGIN_EVENT_TABLE(StatImageLoader, wxWindow) EVT_LEFT_DOWN(StatImageLoader::PopUpMenu) END_EVENT_TABLE() -StatImageLoader::StatImageLoader(wxWindow* parent) : wxWindow(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNO_BORDER) +StatImageLoader::StatImageLoader(wxWindow* parent, std::string url) : wxWindow(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNO_BORDER) { appSkin = SkinClass::Instance(); + prjUrl = url; CreateMenu(); } @@ -24,68 +25,31 @@ void StatImageLoader::PopUpMenu(wxMouseEvent& event) void StatImageLoader::CreateMenu() { CMainDocument* pDoc = wxGetApp().GetDocument(); - wxASSERT(pDoc); - wxASSERT(wxDynamicCast(pDoc, CMainDocument)); - // i = project id - // j = vector of menu items - //pDoc->state.projects[0]->gui_urls[0]; + PROJECT* project = pDoc->state.lookup_project(prjUrl); + int urlCount = project->gui_urls.size(); + // create pop up menu statPopUpMenu = new wxMenu(wxSIMPLE_BORDER); + + for(int i = 0; i < urlCount; i++){ + wxMenuItem *urlItem = new wxMenuItem(statPopUpMenu, -1,wxString(project->gui_urls[i].name.c_str(), wxConvUTF8)); + #ifdef __WXMSW__ + urlItem->SetBackgroundColour(appSkin->GetAppBgCol()); + #endif + statPopUpMenu->Append(urlItem); + } // - wxMenuItem *itmTellFriend = new wxMenuItem(statPopUpMenu, -1,_T("Tell a Friend")); -#ifdef __WXMSW__ - itmTellFriend->SetBackgroundColour(appSkin->GetAppBgCol()); -#endif + /* wxBitmap *btmTellFriend = new wxBitmap(); btmTellFriend->LoadFile("skins/default/graphic/micnTellFriend.png",wxBITMAP_TYPE_PNG); itmTellFriend->SetBitmap(*btmTellFriend); - // - wxMenuItem *itmHome = new wxMenuItem(statPopUpMenu, -1,_T("Home")); -#ifdef __WXMSW__ - itmHome->SetBackgroundColour(appSkin->GetAppBgCol()); -#endif - // - wxMenuItem *itmAbout = new wxMenuItem(statPopUpMenu, -1,_T("About Us")); -#ifdef __WXMSW__ - itmAbout->SetBackgroundColour(appSkin->GetAppBgCol()); -#endif - // - wxMenuItem *itmResearch = new wxMenuItem(statPopUpMenu, -1,_T("Research")); -#ifdef __WXMSW__ - itmResearch->SetBackgroundColour(appSkin->GetAppBgCol()); -#endif - // - wxMenuItem *itmForums = new wxMenuItem(statPopUpMenu, -1,_T("Forums")); -#ifdef __WXMSW__ - itmForums->SetBackgroundColour(appSkin->GetAppBgCol()); -#endif - // - wxMenuItem *itmStatistics = new wxMenuItem(statPopUpMenu, -1,_T("Statistics")); -#ifdef __WXMSW__ - itmStatistics->SetBackgroundColour(appSkin->GetAppBgCol()); -#endif - // - wxMenuItem *itmMyGrid = new wxMenuItem(statPopUpMenu, -1,_T("My Grid")); -#ifdef __WXMSW__ - itmMyGrid->SetBackgroundColour(appSkin->GetAppBgCol()); -#endif - wxBitmap *btmMyGrid = new wxBitmap(); - btmMyGrid->LoadFile("skins/default/graphic/micnMyGrid.png",wxBITMAP_TYPE_PNG); - itmMyGrid->SetBitmap(*btmMyGrid); - // - statPopUpMenu->Append(itmTellFriend); - statPopUpMenu->Append(itmHome); - statPopUpMenu->Append(itmAbout); - statPopUpMenu->Append(itmResearch); - statPopUpMenu->Append(itmForums); - statPopUpMenu->Append(itmStatistics); - statPopUpMenu->Append(itmMyGrid); + */ } void StatImageLoader::LoadImage(const wxImage& image) { - Bitmap = wxBitmap();//delete existing bitmap since we are loading newone + Bitmap = wxBitmap();//delete existing bitmap since we are loading new one int width = image.GetWidth(); int height = image.GetHeight(); Bitmap = wxBitmap(image);