diff --git a/api/boinc_api.C b/api/boinc_api.C index c7a5c87e60..067a4e3f64 100644 --- a/api/boinc_api.C +++ b/api/boinc_api.C @@ -99,6 +99,14 @@ static MMRESULT timer_id; static BOINC_OPTIONS options; static volatile BOINC_STATUS boinc_status; +// vars related to intermediate file upload +struct UPLOAD_FILE_STATUS { + std::string name; + int status; +}; +static bool have_new_upload_file; +static std::vector upload_file_status; + static int setup_shared_mem() { if (standalone) { fprintf(stderr, "Standalone mode, so not using shared memory.\n"); @@ -170,7 +178,7 @@ static bool update_app_progress( return app_client_shm->shm->app_status.send_msg(msg_buf); } -// the following 2 functions are used when there's no graphics +// the following 2 functions are used for apps without graphics // int boinc_init() { boinc_options_defaults(options); @@ -247,10 +255,22 @@ int boinc_get_status(BOINC_STATUS& s) { return 0; } +// if we have any new trickle-ups or file upload requests, +// send a message describing them +// static void send_trickle_up_msg() { + char buf[MSG_CHANNEL_SIZE]; + strcpy(buf, ""); if (have_new_trickle_up) { - if (app_client_shm->shm->trickle_up.send_msg("\n")) { + strcat(buf, "\n"); + } + if (have_new_upload_file) { + strcat(buf, "\n"); + } + if (strlen(buf)) { + if (app_client_shm->shm->trickle_up.send_msg(buf)) { have_new_trickle_up = false; + have_new_upload_file = false; } } } @@ -409,12 +429,37 @@ static void handle_heartbeat_msg() { } } +static void handle_upload_file_status() { + char path[256], buf[256]; + std::string filename; + int status; + + relative_to_absolute("", path); + DirScanner dirscan(path); + while (dirscan.scan(filename)) { + fprintf(stderr, "scan: %s\n", filename.c_str()); + FILE* f = boinc_fopen(filename.c_str(), "r"); + if (!f) continue; + fgets(buf, 256, f); + parse_int(buf, "", status); + UPLOAD_FILE_STATUS uf; + uf.name = filename; + uf.status = status; + upload_file_status.push_back(uf); + } +} + +// handle trickle and file upload messages +// static void handle_trickle_down_msg() { char buf[MSG_CHANNEL_SIZE]; if (app_client_shm->shm->trickle_down.get_msg(buf)) { if (match_tag(buf, "")) { have_trickle_down = true; } + if (match_tag(buf, "")) { + handle_upload_file_status(); + } } } @@ -641,7 +686,6 @@ bool boinc_receive_trickle_down(char* buf, int len) { if (have_trickle_down) { relative_to_absolute("", path); DirScanner dirscan(path); - fprintf(stderr, "starting scan of %s\n", path); while (dirscan.scan(filename)) { fprintf(stderr, "scan: %s\n", filename.c_str()); if (strstr(filename.c_str(), "trickle_down")) { @@ -654,4 +698,26 @@ bool boinc_receive_trickle_down(char* buf, int len) { return false; } +int boinc_upload_file(std::string& name) { + char buf[256]; + + sprintf(buf, "boinc_ufr_%s", name.c_str()); + FILE* f = boinc_fopen(buf, "w"); + if (!f) return ERR_FOPEN; + have_new_upload_file = true; + return 0; +} + + +int boinc_upload_status(std::string& name) { + for (unsigned int i=0; i ASSERT(X) + (do not undo these - please replace everywhere) + - Destructors don't need to reset fields. + TODO: replace the OnDocGetItemText() functions + with functions that get all items at once + + api/ + boinc_api.C + client/ + app.h + app_control.C + cs_files.C + clientgui/ + BOINCBaseView.cpp + BOINCGUIApp.cpp + BOINCListCtrl.cpp + BOINCTaskBar.cpp + BOINCTaskCtrl.cpp + MainDocument.cpp,h + MainFrame.cpp + ViewMessages.cpp + ViewProjects.cpp,h + ViewResources.cpp + ViewStatistics.cpp + ViewTransfers.cpp,h + ViewWork.cpp + lib/ + gui_rpc_client.C,h + shmem.C,h + win_build/ + boinc_cli.vcproj diff --git a/client/app.h b/client/app.h index 2b73dcb586..3a06c4c42b 100644 --- a/client/app.h +++ b/client/app.h @@ -175,6 +175,7 @@ public: bool supports_graphics(); int write_app_init_file(); int move_trickle_file(); + int handle_upload_files(); int write(MIOFILE&); int parse(MIOFILE&); diff --git a/client/app_control.C b/client/app_control.C index d1e92d6c1b..3cc9150a20 100644 --- a/client/app_control.C +++ b/client/app_control.C @@ -857,11 +857,38 @@ bool ACTIVE_TASK::get_trickle_up_msg() { wup->project->sched_rpc_pending = true; } } + if (match_tag(msg_buf, "")) { + handle_upload_files(); + } found = true; } return found; } +// scan the slot director, looking for files with names +// of the form boinc_ufr_X. +// Then mark file X as being present (and uploadable) +// +int ACTIVE_TASK::handle_upload_files() { + std::string filename; + char buf[256], path[256]; + + DirScanner dirscan(slot_dir); + while (dirscan.scan(filename)) { + strcpy(buf, filename.c_str()); + if (strstr(buf, "boinc_ufr") == buf) { + char* p = buf+strlen("boinc_ufr"); + FILE_INFO* fip = gstate.lookup_file_info(result->project, p); + if (fip) { + fip->status = FILE_PRESENT; + } + sprintf(path, "%s/%s", slot_dir, buf); + boinc_delete_file(path); + } + } + return 0; +} + // check for msgs from active tasks. // Return true if any of them has changed its checkpoint_cpu_time // (since in that case we need to write state file) diff --git a/client/cs_files.C b/client/cs_files.C index 84dc829650..06b84208dc 100644 --- a/client/cs_files.C +++ b/client/cs_files.C @@ -194,7 +194,6 @@ bool CLIENT_STATE::handle_pers_file_xfers(double now) { pers_file_xfers->insert(fip->pers_file_xfer); action = true; } else if (fip->upload_when_present && fip->status == FILE_PRESENT && !fip->uploaded) { - pfx = new PERS_FILE_XFER; pfx->init(fip, true); fip->pers_file_xfer = pfx; diff --git a/clientgui/BOINCBaseView.cpp b/clientgui/BOINCBaseView.cpp index 2a8684eab0..cf3686ac10 100644 --- a/clientgui/BOINCBaseView.cpp +++ b/clientgui/BOINCBaseView.cpp @@ -39,7 +39,7 @@ CBOINCBaseView::CBOINCBaseView() {} CBOINCBaseView::CBOINCBaseView(wxNotebook* pNotebook) : wxPanel(pNotebook, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL) { - wxASSERT(NULL != pNotebook); + wxASSERT(pNotebook); m_bProcessingTaskRenderEvent = false; m_bProcessingListRenderEvent = false; @@ -59,7 +59,7 @@ CBOINCBaseView::CBOINCBaseView( wxWindowID iListWindowID, int iListWindowFlags ) : wxPanel(pNotebook, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL) { - wxASSERT(NULL != pNotebook); + wxASSERT(pNotebook); m_bProcessingTaskRenderEvent = false; m_bProcessingListRenderEvent = false; @@ -73,16 +73,16 @@ CBOINCBaseView::CBOINCBaseView( SetAutoLayout(TRUE); wxFlexGridSizer* itemFlexGridSizer = new wxFlexGridSizer(2, 0, 0); - wxASSERT(NULL != itemFlexGridSizer); + wxASSERT(itemFlexGridSizer); itemFlexGridSizer->AddGrowableRow(0); itemFlexGridSizer->AddGrowableCol(1); m_pTaskPane = new CBOINCTaskCtrl(this, iTaskWindowID, iTaskWindowFlags); - wxASSERT(NULL != m_pTaskPane); + wxASSERT(m_pTaskPane); m_pListPane = new CBOINCListCtrl(this, iListWindowID, iListWindowFlags); - wxASSERT(NULL != m_pListPane); + wxASSERT(m_pListPane); itemFlexGridSizer->Add(m_pTaskPane, 1, wxGROW|wxALL, 1); itemFlexGridSizer->Add(m_pListPane, 1, wxGROW|wxALL, 1); @@ -212,9 +212,9 @@ void CBOINCBaseView::OnListRender (wxTimerEvent& event) { bool CBOINCBaseView::OnSaveState(wxConfigBase* pConfig) { bool bReturnValue = true; - wxASSERT(NULL != pConfig); - wxASSERT(NULL != m_pTaskPane); - wxASSERT(NULL != m_pListPane); + wxASSERT(pConfig); + wxASSERT(m_pTaskPane); + wxASSERT(m_pListPane); if (!m_pTaskPane->OnSaveState(pConfig)) { bReturnValue = false; diff --git a/clientgui/BOINCGUIApp.cpp b/clientgui/BOINCGUIApp.cpp index ca232fe9ce..ef0107dae6 100644 --- a/clientgui/BOINCGUIApp.cpp +++ b/clientgui/BOINCGUIApp.cpp @@ -124,7 +124,7 @@ bool CBOINCGUIApp::OnInit() { // Initialize the configuration storage module m_pConfig = new wxConfig(GetAppName()); wxConfigBase::Set(m_pConfig); - wxASSERT(NULL != m_pConfig); + wxASSERT(m_pConfig); m_pConfig->SetPath(wxT("/")); @@ -144,7 +144,7 @@ bool CBOINCGUIApp::OnInit() { // Initialize the internationalization module m_pLocale = new wxLocale(); - wxASSERT(NULL != m_pLocale); + wxASSERT(m_pLocale); wxInt32 iSelectedLanguage = m_pConfig->Read(wxT("Language"), 0L); @@ -162,21 +162,21 @@ bool CBOINCGUIApp::OnInit() { // Initialize the main document m_pDocument = new CMainDocument(); - wxASSERT(NULL != m_pDocument); + wxASSERT(m_pDocument); m_pDocument->OnInit(); // Initialize the main gui window m_pFrame = new CMainFrame(GetAppName()); - wxASSERT(NULL != m_pFrame); + wxASSERT(m_pFrame); #ifndef NOTASKBAR // Initialize the task bar icon m_pTaskBarIcon = new CTaskBarIcon(); - wxASSERT(NULL != m_pTaskBarIcon); + wxASSERT(m_pTaskBarIcon); #ifdef __WXMAC__ m_pMacSystemMenu = new CMacSystemMenu(); - wxASSERT(NULL != m_pMacSystemMenu); + wxASSERT(m_pMacSystemMenu); #endif #endif @@ -320,7 +320,7 @@ void CBOINCGUIApp::InitSupportedLanguages() { for (iIndex = 0; iIndex <= wxLANGUAGE_USER_DEFINED; iIndex++) { liLanguage = wxLocale::GetLanguageInfo(iIndex); - if (NULL != liLanguage) { + if (liLanguage) { m_strLanguages[iIndex] = liLanguage->Description; } } diff --git a/clientgui/BOINCListCtrl.cpp b/clientgui/BOINCListCtrl.cpp index b35c76b92b..24ced7f1d4 100644 --- a/clientgui/BOINCListCtrl.cpp +++ b/clientgui/BOINCListCtrl.cpp @@ -62,7 +62,7 @@ bool CBOINCListCtrl::OnSaveState(wxConfigBase* pConfig) { wxInt32 iColumnCount = 0; - wxASSERT(NULL != pConfig); + wxASSERT(pConfig); // Retrieve the base location to store configuration information @@ -101,7 +101,7 @@ bool CBOINCListCtrl::OnRestoreState(wxConfigBase* pConfig) { wxInt32 iTempValue = 0; - wxASSERT(NULL != pConfig); + wxASSERT(pConfig); // Retrieve the base location to store configuration information @@ -136,7 +136,7 @@ bool CBOINCListCtrl::OnRestoreState(wxConfigBase* pConfig) { void CBOINCListCtrl::OnClick(wxCommandEvent& event) { - wxASSERT(NULL != m_pParentView); + wxASSERT(m_pParentView); wxASSERT(wxDynamicCast(m_pParentView, CBOINCBaseView)); wxListEvent leEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED, m_windowId); @@ -157,7 +157,7 @@ void CBOINCListCtrl::OnClick(wxCommandEvent& event) { wxString CBOINCListCtrl::OnGetItemText(long item, long column) const { - wxASSERT(NULL != m_pParentView); + wxASSERT(m_pParentView); wxASSERT(wxDynamicCast(m_pParentView, CBOINCBaseView)); return m_pParentView->FireOnListGetItemText(item, column); @@ -165,7 +165,7 @@ wxString CBOINCListCtrl::OnGetItemText(long item, long column) const { int CBOINCListCtrl::OnGetItemImage(long item) const { - wxASSERT(NULL != m_pParentView); + wxASSERT(m_pParentView); wxASSERT(wxDynamicCast(m_pParentView, CBOINCBaseView)); return m_pParentView->FireOnListGetItemImage(item); @@ -173,7 +173,7 @@ int CBOINCListCtrl::OnGetItemImage(long item) const { wxListItemAttr* CBOINCListCtrl::OnGetItemAttr(long item) const { - wxASSERT(NULL != m_pParentView); + wxASSERT(m_pParentView); wxASSERT(wxDynamicCast(m_pParentView, CBOINCBaseView)); return m_pParentView->FireOnListGetItemAttr(item); diff --git a/clientgui/BOINCTaskBar.cpp b/clientgui/BOINCTaskBar.cpp index 3d9e285bfb..708bd4d351 100644 --- a/clientgui/BOINCTaskBar.cpp +++ b/clientgui/BOINCTaskBar.cpp @@ -237,7 +237,7 @@ void CTaskBarIcon::OnMouseMove(wxTaskBarIconEvent& event) { wxInt32 iIndex = 0; CMainDocument* pDoc = wxGetApp().GetDocument(); - wxASSERT(NULL != pDoc); + wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); @@ -343,7 +343,7 @@ void CTaskBarIcon::CreateContextMenu() { wxMenu *CTaskBarIcon::BuildContextMenu() { wxMenu* menu = new wxMenu; - wxASSERT(NULL != menu); + wxASSERT(menu); #ifdef __WXMSW__ @@ -381,7 +381,7 @@ void CTaskBarIcon::AdjustMenuItems(wxMenu* menu) { wxInt32 iActivityMode = -1; wxInt32 iNetworkMode = -1; - wxASSERT(NULL != pDoc); + wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); pDoc->GetActivityRunMode(iActivityMode); diff --git a/clientgui/BOINCTaskCtrl.cpp b/clientgui/BOINCTaskCtrl.cpp index d462bb2851..7c311834bf 100644 --- a/clientgui/BOINCTaskCtrl.cpp +++ b/clientgui/BOINCTaskCtrl.cpp @@ -192,7 +192,7 @@ wxInt32 CBOINCTaskCtrl::UpdateControls() { bool CBOINCTaskCtrl::OnSaveState(wxConfigBase* pConfig) { wxString strBaseConfigLocation = wxEmptyString; - wxASSERT(NULL != pConfig); + wxASSERT(pConfig); // Retrieve the base location to store configuration information @@ -212,7 +212,7 @@ bool CBOINCTaskCtrl::OnSaveState(wxConfigBase* pConfig) { bool CBOINCTaskCtrl::OnRestoreState(wxConfigBase* pConfig) { wxString strBaseConfigLocation = wxEmptyString; - wxASSERT(NULL != pConfig); + wxASSERT(pConfig); // Retrieve the base location to store configuration information diff --git a/clientgui/MainDocument.cpp b/clientgui/MainDocument.cpp index 88adb3659a..e7ca6d93ef 100644 --- a/clientgui/MainDocument.cpp +++ b/clientgui/MainDocument.cpp @@ -45,21 +45,11 @@ CNetworkConnection::CNetworkConnection(CMainDocument* pDocument) : CNetworkConnection::~CNetworkConnection() { - m_bReconnectOnError = false; - m_bForceReconnect = false; - m_bReconnecting = false; - m_bConnected = false; - m_bConnectEvent = false; - m_bFrameShutdownDetected = true; - m_strNewComputerPassword = wxEmptyString; - m_strNewComputerName = wxEmptyString; - m_strConnectedComputerPassword = wxEmptyString; - m_strConnectedComputerName = wxEmptyString; - - m_pDocument = NULL; } +// TODO: get rid of "reconnecting" stuff + void* CNetworkConnection::Poll() { int retval; std::string strComputer; @@ -90,7 +80,7 @@ void* CNetworkConnection::Poll() { } else if (IsConnectEventSignaled() || m_bReconnectOnError) { if ((m_bForceReconnect) || (!IsConnected() && m_bReconnectOnError) - ) { + ) { wxLogTrace(wxT("Function Status"), wxT("CNetworkConnection::Poll - Resetting Document State")); m_pDocument->ResetState(); wxLogTrace(wxT("Function Status"), wxT("CNetworkConnection::Poll - Setting connection state to reconnecting")); @@ -258,6 +248,7 @@ CMainDocument::CMainDocument() { CMainDocument::~CMainDocument() { + // ??? huh? m_dtCachedNetworkRunModeTimestamp = wxDateTime::Now(); m_dtCachedActivityRunModeTimestamp = wxDateTime::Now(); m_dtCachedActivityStateTimestamp = wxDateTime::Now(); @@ -583,23 +574,6 @@ int CMainDocument::GetProjectCount() { } -int CMainDocument::GetProjectProjectName(int iIndex, wxString& strBuffer) { - PROJECT* pProject = NULL; - strBuffer = wxEmptyString; - - pProject = project(iIndex); - - if (!pProject) return 0; - - if (pProject->project_name.length() == 0) { - strBuffer = pProject->master_url.c_str(); - } else { - strBuffer = pProject->project_name.c_str(); - } - return 0; -} - - int CMainDocument::GetProjectProjectURL(int iIndex, wxString& strBuffer) { PROJECT* pProject = NULL; @@ -624,17 +598,6 @@ int CMainDocument::GetProjectAccountName(int iIndex, wxString& strBuffer) { } -int CMainDocument::GetProjectTeamName(int iIndex, wxString& strBuffer) { - PROJECT* pProject = NULL; - - pProject = project(iIndex); - - if (pProject) - strBuffer = pProject->team_name.c_str(); - - return 0; -} - int CMainDocument::GetProjectTotalCredit(int iIndex, float& fBuffer) { PROJECT* pProject = NULL; diff --git a/clientgui/MainDocument.h b/clientgui/MainDocument.h index e013779ed8..de9042cd0e 100644 --- a/clientgui/MainDocument.h +++ b/clientgui/MainDocument.h @@ -163,20 +163,19 @@ private: int CachedProjectStatusUpdate(); public: - int GetProjectCount(); - int GetProjectProjectName(int iIndex, wxString& strBuffer); - int GetProjectProjectURL(int iIndex, wxString& strBuffer); - int GetProjectAccountName(int iIndex, wxString& strBuffer); - int GetProjectTeamName(int iIndex, wxString& strBuffer); - int GetProjectTotalCredit(int iIndex, float& fBuffer); - int GetProjectAvgCredit(int iIndex, float& fBuffer); - int GetProjectResourceShare(int iIndex, float& fBuffer); - int GetProjectTotalResourceShare(int iIndex, float& fBuffer); - int GetProjectMinRPCTime(int iIndex, int& iBuffer); - int GetProjectWebsiteCount(int iIndex); - int GetProjectWebsiteName(int iProjectIndex, int iWebsiteIndex, wxString& strBuffer); - int GetProjectWebsiteDescription(int iProjectIndex, int iWebsiteIndex, wxString& strBuffer); - int GetProjectWebsiteLink(int iProjectIndex, int iWebsiteIndex, wxString& strBuffer); + PROJECT* project(int); + int GetProjectCount(); + int GetProjectProjectURL(int iIndex, wxString& strBuffer); + int GetProjectAccountName(int iIndex, wxString& strBuffer); + int GetProjectTotalCredit(int iIndex, float& fBuffer); + int GetProjectAvgCredit(int iIndex, float& fBuffer); + int GetProjectResourceShare(int iIndex, float& fBuffer); + int GetProjectTotalResourceShare(int iIndex, float& fBuffer); + int GetProjectMinRPCTime(int iIndex, int& iBuffer); + int GetProjectWebsiteCount(int iIndex); + int GetProjectWebsiteName(int iProjectIndex, int iWebsiteIndex, wxString& strBuffer); + int GetProjectWebsiteDescription(int iProjectIndex, int iWebsiteIndex, wxString& strBuffer); + int GetProjectWebsiteLink(int iProjectIndex, int iWebsiteIndex, wxString& strBuffer); bool IsProjectSuspended(int iIndex); bool IsProjectRPCPending(int iIndex); bool IsProjectAllowedToGetWork(int iIndex); @@ -191,7 +190,6 @@ public: int ProjectSuspend(int iIndex); int ProjectResume(int iIndex); - PROJECT* project(int); PROJECTS project_status; diff --git a/clientgui/MainFrame.cpp b/clientgui/MainFrame.cpp index 4c008ecc6d..1dc8d6b38b 100644 --- a/clientgui/MainFrame.cpp +++ b/clientgui/MainFrame.cpp @@ -71,19 +71,19 @@ CStatusBar::CStatusBar(wxWindow *parent) : SetFieldsCount(WXSIZEOF(widths), widths); m_pbmpConnected = new wxStaticBitmap(this, -1, wxIcon(connect_xpm)); - wxASSERT(NULL != m_pbmpConnected); + wxASSERT(m_pbmpConnected); m_pbmpConnected->Hide(); m_ptxtConnected = new wxStaticText(this, -1, _("Connected"), wxPoint(0, 0), wxDefaultSize, wxALIGN_LEFT); - wxASSERT(NULL != m_ptxtConnected); + wxASSERT(m_ptxtConnected); m_ptxtConnected->Hide(); m_pbmpDisconnect = new wxStaticBitmap(this, -1, wxIcon(disconnect_xpm)); - wxASSERT(NULL != m_pbmpDisconnect); + wxASSERT(m_pbmpDisconnect); m_pbmpDisconnect->Hide(); m_ptxtDisconnect = new wxStaticText(this, -1, _("Disconnected"), wxPoint(0, 0), wxDefaultSize, wxALIGN_LEFT); - wxASSERT(NULL != m_ptxtDisconnect); + wxASSERT(m_ptxtDisconnect); m_ptxtDisconnect->Hide(); wxLogTrace(wxT("Function Start/End"), wxT("CStatusBar::CStatusBar - Function End")); @@ -199,16 +199,16 @@ CMainFrame::CMainFrame(wxString strTitle) : m_pRefreshStateTimer = new wxTimer(this, ID_REFRESHSTATETIMER); - wxASSERT(NULL != m_pRefreshStateTimer); + wxASSERT(m_pRefreshStateTimer); m_pFrameRenderTimer = new wxTimer(this, ID_FRAMERENDERTIMER); - wxASSERT(NULL != m_pFrameRenderTimer); + wxASSERT(m_pFrameRenderTimer); m_pFrameListPanelRenderTimer = new wxTimer(this, ID_FRAMELISTRENDERTIMER); - wxASSERT(NULL != m_pFrameListPanelRenderTimer); + wxASSERT(m_pFrameListPanelRenderTimer); m_pDocumentPollTimer = new wxTimer(this, ID_DOCUMENTPOLLTIMER); - wxASSERT(NULL != m_pDocumentPollTimer); + wxASSERT(m_pDocumentPollTimer); m_pRefreshStateTimer->Start(60000); // Send event every 60 seconds m_pFrameRenderTimer->Start(1000); // Send event every 1 second @@ -282,7 +282,7 @@ bool CMainFrame::CreateMenu() { CMainDocument* pDoc = wxGetApp().GetDocument(); - wxASSERT(NULL != pDoc); + wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); // File menu @@ -443,8 +443,8 @@ bool CMainFrame::CreateNotebookPage(T pwndNewNotebookPage) { wxImageList* pImageList; int iImageIndex = 0; - wxASSERT(NULL != pwndNewNotebookPage); - wxASSERT(NULL != m_pNotebook); + wxASSERT(pwndNewNotebookPage); + wxASSERT(m_pNotebook); wxASSERT(wxDynamicCast(pwndNewNotebookPage, CBOINCBaseView)); @@ -470,7 +470,7 @@ bool CMainFrame::CreateStatusbar() { return true; m_pStatusbar = new CStatusBar(this); - wxASSERT(NULL != m_pStatusbar); + wxASSERT(m_pStatusbar); SetStatusBar(m_pStatusbar); @@ -492,11 +492,11 @@ bool CMainFrame::DeleteNotebook() { wxImageList* pImageList; - wxASSERT(NULL != m_pNotebook); + wxASSERT(m_pNotebook); pImageList = m_pNotebook->GetImageList(); - wxASSERT(NULL != pImageList); + wxASSERT(pImageList); if (pImageList) delete pImageList; @@ -574,7 +574,7 @@ bool CMainFrame::SaveState() { wxASSERT(wxDynamicCast(pwndNotebookPage, CBOINCBaseView)); pView = wxDynamicCast(pwndNotebookPage, CBOINCBaseView); - wxASSERT(NULL != pView); + wxASSERT(pView); strPreviousLocation = pConfig->GetPath(); strConfigLocation = strPreviousLocation + pView->GetViewName(); @@ -636,8 +636,8 @@ bool CMainFrame::RestoreState() { long iWidth = 0; - wxASSERT(NULL != pConfig); - wxASSERT(NULL != m_pNotebook); + wxASSERT(pConfig); + wxASSERT(m_pNotebook); // @@ -712,7 +712,7 @@ bool CMainFrame::RestoreState() { wxASSERT(wxDynamicCast(pwndNotebookPage, CBOINCBaseView)); pView = wxDynamicCast(pwndNotebookPage, CBOINCBaseView); - wxASSERT(NULL != pView); + wxASSERT(pView); strPreviousLocation = pConfig->GetPath(); strConfigLocation = strPreviousLocation + pView->GetViewName(); @@ -763,7 +763,7 @@ void CMainFrame::OnActivitySelection(wxCommandEvent& event) { CMainDocument* pDoc = wxGetApp().GetDocument(); - wxASSERT(NULL != pDoc); + wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); switch(event.GetId()) { @@ -788,7 +788,7 @@ void CMainFrame::OnNetworkSelection(wxCommandEvent& event) { CMainDocument* pDoc = wxGetApp().GetDocument(); int iCurrentNetworkMode = -1; - wxASSERT(NULL != pDoc); + wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); switch(event.GetId()) { @@ -816,8 +816,8 @@ void CMainFrame::OnRunBenchmarks(wxCommandEvent& WXUNUSED(event)) { wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::OnRunBenchmarks - Function Begin")); CMainDocument* pDoc = wxGetApp().GetDocument(); - wxASSERT(NULL != m_pNotebook); - wxASSERT(NULL != pDoc); + wxASSERT(m_pNotebook); + wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); m_pNotebook->SetSelection(ID_LIST_MESSAGESVIEW - ID_LIST_BASE); @@ -837,9 +837,9 @@ void CMainFrame::OnSelectComputer(wxCommandEvent& WXUNUSED(event)) { long lRetVal = -1; wxArrayString aComputerNames; - wxASSERT(NULL != pDoc); + wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); - wxASSERT(NULL != pDlg); + wxASSERT(pDlg); // Lets copy the template store in the system state @@ -908,9 +908,9 @@ void CMainFrame::OnToolsUpdateAccounts(wxCommandEvent& WXUNUSED(event)) wxString strPassword = wxEmptyString; - wxASSERT(NULL != pDoc); + wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); - wxASSERT(NULL != pDlg); + wxASSERT(pDlg); if (!pDoc->IsAccountManagerLoginFound()) { iAnswer = pDlg->ShowModal(); @@ -942,9 +942,9 @@ void CMainFrame::OnToolsOptions(wxCommandEvent& WXUNUSED(event)) { int iBuffer = 0; wxString strBuffer = wxEmptyString; - wxASSERT(NULL != pDoc); + wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); - wxASSERT(NULL != pDlg); + wxASSERT(pDlg); bProxyInformationConfigured = (0 == pDoc->GetProxyConfiguration()); @@ -1029,7 +1029,7 @@ void CMainFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) { wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::OnAbout - Function Begin")); CDlgAbout* pDlg = new CDlgAbout(this); - wxASSERT(NULL != pDlg); + wxASSERT(pDlg); pDlg->ShowModal(); @@ -1164,13 +1164,13 @@ void CMainFrame::OnRefreshView(CMainFrameEvent&) { CBOINCBaseView* pView = NULL; wxTimerEvent timerEvent; - wxASSERT(NULL != m_pNotebook); + wxASSERT(m_pNotebook); pwndNotebookPage = m_pNotebook->GetPage(m_pNotebook->GetSelection()); wxASSERT(pwndNotebookPage); pView = wxDynamicCast(pwndNotebookPage, CBOINCBaseView); - wxASSERT(NULL != pView); + wxASSERT(pView); pView->FireOnListRender(timerEvent); } @@ -1218,7 +1218,7 @@ void CMainFrame::OnFrameRender(wxTimerEvent &event) { wxGetApp().UpdateSystemIdleDetection(); if (IsShown()) { - if (NULL != pDoc) { + if (pDoc) { wxASSERT(wxDynamicCast(pDoc, CMainDocument)); // Update the menu bar @@ -1226,16 +1226,16 @@ void CMainFrame::OnFrameRender(wxTimerEvent &event) { int iActivityMode = -1; int iNetworkMode = -1; - wxASSERT(NULL != pMenuBar); + wxASSERT(pMenuBar); wxASSERT(wxDynamicCast(pMenuBar, wxMenuBar)); - if (NULL != pMenuBar->FindItem(ID_ACTIVITYRUNALWAYS, NULL)) + if (pMenuBar->FindItem(ID_ACTIVITYRUNALWAYS, NULL)) pMenuBar->Check(ID_ACTIVITYRUNALWAYS, false); - if (NULL != pMenuBar->FindItem(ID_ACTIVITYSUSPEND, NULL)) + if (pMenuBar->FindItem(ID_ACTIVITYSUSPEND, NULL)) pMenuBar->Check(ID_ACTIVITYSUSPEND, false); - if (NULL != pMenuBar->FindItem(ID_ACTIVITYRUNBASEDONPREPERENCES, NULL)) + if (pMenuBar->FindItem(ID_ACTIVITYRUNBASEDONPREPERENCES, NULL)) pMenuBar->Check(ID_ACTIVITYRUNBASEDONPREPERENCES, false); if ((pDoc->IsConnected()) && (0 == pDoc->GetActivityRunMode(iActivityMode))) { @@ -1249,14 +1249,14 @@ void CMainFrame::OnFrameRender(wxTimerEvent &event) { } #if 0 - if (NULL != pMenuBar->FindItem(ID_NETWORKRUNALWAYS, NULL)) + if (pMenuBar->FindItem(ID_NETWORKRUNALWAYS, NULL)) pMenuBar->Check(ID_NETWORKRUNALWAYS, false); #endif - if (NULL != pMenuBar->FindItem(ID_NETWORKSUSPEND, NULL)) + if (pMenuBar->FindItem(ID_NETWORKSUSPEND, NULL)) pMenuBar->Check(ID_NETWORKSUSPEND, false); #if 0 - if (NULL != pMenuBar->FindItem(ID_NETWORKRUNBASEDONPREPERENCES, NULL)) + if (pMenuBar->FindItem(ID_NETWORKRUNBASEDONPREPERENCES, NULL)) pMenuBar->Check(ID_NETWORKRUNBASEDONPREPERENCES, false); #endif @@ -1358,13 +1358,13 @@ void CMainFrame::OnNotebookSelectionChanged(wxNotebookEvent& event) { CBOINCBaseView* pView = NULL; wxTimerEvent timerEvent; - wxASSERT(NULL != m_pNotebook); + wxASSERT(m_pNotebook); pwndNotebookPage = m_pNotebook->GetPage(event.GetSelection()); - wxASSERT(NULL != pwndNotebookPage); + wxASSERT(pwndNotebookPage); pView = wxDynamicCast(pwndNotebookPage, CBOINCBaseView); - wxASSERT(NULL != pView); + wxASSERT(pView); FireRefreshView(); } diff --git a/clientgui/ViewMessages.cpp b/clientgui/ViewMessages.cpp index f718e5dbb0..027a0e02e7 100644 --- a/clientgui/ViewMessages.cpp +++ b/clientgui/ViewMessages.cpp @@ -137,7 +137,7 @@ void CViewMessages::OnMessagesCopyAll( wxCommandEvent& event ) { CMainFrame* pFrame = wxGetApp().GetFrame(); - wxASSERT(NULL != pFrame); + wxASSERT(pFrame); wxASSERT(wxDynamicCast(pFrame, CMainFrame)); #ifndef NOCLIPBOARD @@ -169,7 +169,7 @@ void CViewMessages::OnMessagesCopySelected( wxCommandEvent& event ) { CMainFrame* pFrame = wxGetApp().GetFrame(); - wxASSERT(NULL != pFrame); + wxASSERT(pFrame); wxASSERT(wxDynamicCast(pFrame, CMainFrame)); #ifndef NOCLIPBOARD diff --git a/clientgui/ViewProjects.cpp b/clientgui/ViewProjects.cpp index b82bcd9bb6..2a2129539b 100644 --- a/clientgui/ViewProjects.cpp +++ b/clientgui/ViewProjects.cpp @@ -56,17 +56,11 @@ CProject::CProject() { - m_strProjectName = wxEmptyString; - m_strAccountName = wxEmptyString; - m_strTeamName = wxEmptyString; - m_strTotalCredit = wxEmptyString; - m_strAVGCredit = wxEmptyString; - m_strResourceShare = wxEmptyString; - m_strStatus = wxEmptyString; } CProject::~CProject() { + // ??? NOT NEEDED m_strProjectName.Clear(); m_strAccountName.Clear(); m_strTeamName.Clear(); @@ -101,8 +95,8 @@ CViewProjects::CViewProjects(wxNotebook* pNotebook) : CTaskItemGroup* pGroup = NULL; CTaskItem* pItem = NULL; - wxASSERT(NULL != m_pTaskPane); - wxASSERT(NULL != m_pListPane); + wxASSERT(m_pTaskPane); + wxASSERT(m_pListPane); // @@ -201,12 +195,12 @@ void CViewProjects::OnProjectUpdate( wxCommandEvent& event ) { CMainDocument* pDoc = wxGetApp().GetDocument(); CMainFrame* pFrame = wxGetApp().GetFrame(); - wxASSERT(NULL != pDoc); + wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); - wxASSERT(NULL != pFrame); + wxASSERT(pFrame); wxASSERT(wxDynamicCast(pFrame, CMainFrame)); - wxASSERT(NULL != m_pTaskPane); - wxASSERT(NULL != m_pListPane); + wxASSERT(m_pTaskPane); + wxASSERT(m_pListPane); pFrame->UpdateStatusText(_("Updating project...")); pDoc->ProjectUpdate(m_pListPane->GetFirstSelected()); @@ -225,12 +219,12 @@ void CViewProjects::OnProjectSuspend( wxCommandEvent& event ) { CMainDocument* pDoc = wxGetApp().GetDocument(); CMainFrame* pFrame = wxGetApp().GetFrame(); - wxASSERT(NULL != pDoc); + wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); - wxASSERT(NULL != pFrame); + wxASSERT(pFrame); wxASSERT(wxDynamicCast(pFrame, CMainFrame)); - wxASSERT(NULL != m_pTaskPane); - wxASSERT(NULL != m_pListPane); + wxASSERT(m_pTaskPane); + wxASSERT(m_pListPane); PROJECT* project = pDoc->project(m_pListPane->GetFirstSelected()); if (project->suspended_via_gui) { @@ -256,12 +250,12 @@ void CViewProjects::OnProjectNoNewWork( wxCommandEvent& event ) { CMainDocument* pDoc = wxGetApp().GetDocument(); CMainFrame* pFrame = wxGetApp().GetFrame(); - wxASSERT(NULL != pDoc); + wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); - wxASSERT(NULL != pFrame); + wxASSERT(pFrame); wxASSERT(wxDynamicCast(pFrame, CMainFrame)); - wxASSERT(NULL != m_pTaskPane); - wxASSERT(NULL != m_pListPane); + wxASSERT(m_pTaskPane); + wxASSERT(m_pListPane); PROJECT* project = pDoc->project(m_pListPane->GetFirstSelected()); if (project->dont_request_more_work) { @@ -287,25 +281,27 @@ void CViewProjects::OnProjectReset( wxCommandEvent& event ) { wxLogTrace(wxT("Function Start/End"), wxT("CViewProjects::OnProjectReset - Function Begin")); wxInt32 iAnswer = 0; - wxString strProjectName = wxEmptyString; + std::string strProjectName; wxString strMessage = wxEmptyString; CMainDocument* pDoc = wxGetApp().GetDocument(); CMainFrame* pFrame = wxGetApp().GetFrame(); - wxASSERT(NULL != pDoc); + wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); - wxASSERT(NULL != pFrame); + wxASSERT(pFrame); wxASSERT(wxDynamicCast(pFrame, CMainFrame)); - wxASSERT(NULL != m_pTaskPane); - wxASSERT(NULL != m_pListPane); + wxASSERT(m_pTaskPane); + wxASSERT(m_pListPane); pFrame->UpdateStatusText(_("Resetting project...")); - pDoc->GetProjectProjectName(m_pListPane->GetFirstSelected(), strProjectName); + PROJECT* project = pDoc->project(m_pListPane->GetFirstSelected()); + project->get_name(strProjectName); strMessage.Printf( _("Are you sure you want to reset project '%s'?"), - strProjectName.c_str()); + strProjectName.c_str() + ); iAnswer = wxMessageBox( strMessage, @@ -331,21 +327,22 @@ void CViewProjects::OnProjectDetach( wxCommandEvent& event ) { wxLogTrace(wxT("Function Start/End"), wxT("CViewProjects::OnProjectDetach - Function Begin")); wxInt32 iAnswer = 0; - wxString strProjectName = wxEmptyString; + std::string strProjectName; wxString strMessage = wxEmptyString; CMainDocument* pDoc = wxGetApp().GetDocument(); CMainFrame* pFrame = wxGetApp().GetFrame(); - wxASSERT(NULL != pDoc); + wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); - wxASSERT(NULL != pFrame); + wxASSERT(pFrame); wxASSERT(wxDynamicCast(pFrame, CMainFrame)); - wxASSERT(NULL != m_pTaskPane); - wxASSERT(NULL != m_pListPane); + wxASSERT(m_pTaskPane); + wxASSERT(m_pListPane); pFrame->UpdateStatusText(_("Detaching from project...")); - pDoc->GetProjectProjectName(m_pListPane->GetFirstSelected(), strProjectName); + PROJECT* project = pDoc->project(m_pListPane->GetFirstSelected()); + project->get_name(strProjectName); strMessage.Printf( _("Are you sure you want to detach from project '%s'?"), @@ -379,17 +376,17 @@ void CViewProjects::OnProjectAttach( wxCommandEvent& event ) { CMainDocument* pDoc = wxGetApp().GetDocument(); CMainFrame* pFrame = wxGetApp().GetFrame(); - wxASSERT(NULL != pDoc); + wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); - wxASSERT(NULL != pFrame); + wxASSERT(pFrame); wxASSERT(wxDynamicCast(pFrame, CMainFrame)); - wxASSERT(NULL != m_pTaskPane); - wxASSERT(NULL != m_pListPane); + wxASSERT(m_pTaskPane); + wxASSERT(m_pListPane); pFrame->UpdateStatusText(_("Attaching to project...")); CDlgAttachProject* pDlg = new CDlgAttachProject(this); - wxASSERT(NULL != pDlg); + wxASSERT(pDlg); iAnswer = pDlg->ShowModal(); @@ -417,17 +414,17 @@ void CViewProjects::OnProjectWebsiteClicked( wxEvent& event ) { CMainFrame* pFrame = wxGetApp().GetFrame(); - wxASSERT(NULL != pFrame); + wxASSERT(pFrame); wxASSERT(wxDynamicCast(pFrame, CMainFrame)); - wxASSERT(NULL != m_pTaskPane); - wxASSERT(NULL != m_pListPane); + wxASSERT(m_pTaskPane); + wxASSERT(m_pListPane); pFrame->UpdateStatusText(_("Launching browser...")); int website_task_index = event.GetId() - ID_TASK_PROJECT_WEB_PROJDEF_MIN; pFrame->ExecuteBrowserLink( m_TaskGroups[1]->m_Tasks[website_task_index]->m_strWebSiteLink - ); + ); pFrame->UpdateStatusText(wxT("")); @@ -441,7 +438,7 @@ void CViewProjects::OnProjectWebsiteClicked( wxEvent& event ) { wxInt32 CViewProjects::GetDocCount() { CMainDocument* pDoc = wxGetApp().GetDocument(); - wxASSERT(NULL != pDoc); + wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); return pDoc->GetProjectCount(); @@ -482,10 +479,14 @@ wxString CViewProjects::OnListGetItemText(long item, long column) const { wxString CViewProjects::OnDocGetItemText(long item, long column) const { wxString strBuffer = wxEmptyString; + std::string foo; + CMainDocument* pDoc = wxGetApp().GetDocument(); + PROJECT* project = pDoc->project(item); switch(column) { case COLUMN_PROJECT: - FormatProjectName(item, strBuffer); + project->get_name(foo); + strBuffer = wxString(foo.c_str()); break; case COLUMN_ACCOUNTNAME: FormatAccountName(item, strBuffer); @@ -513,8 +514,8 @@ wxString CViewProjects::OnDocGetItemText(long item, long column) const { wxInt32 CViewProjects::AddCacheElement() { CProject* pItem = new CProject(); - wxASSERT(NULL != pItem); - if (NULL != pItem) { + wxASSERT(pItem); + if (pItem) { m_ProjectCache.push_back(pItem); return 0; } @@ -582,7 +583,7 @@ void CViewProjects::UpdateSelection() { PROJECT* project = NULL; CMainDocument* pDoc = wxGetApp().GetDocument(); - wxASSERT(NULL != pDoc); + wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); wxASSERT(NULL != m_pTaskPane); @@ -673,24 +674,11 @@ void CViewProjects::UpdateSelection() { } -wxInt32 CViewProjects::FormatProjectName(wxInt32 item, wxString& strBuffer) const { - CMainDocument* pDoc = wxGetApp().GetDocument(); - - wxASSERT(NULL != pDoc); - wxASSERT(wxDynamicCast(pDoc, CMainDocument)); - - strBuffer.Clear(); - - pDoc->GetProjectProjectName(item, strBuffer); - - return 0; -} - wxInt32 CViewProjects::FormatAccountName(wxInt32 item, wxString& strBuffer) const { CMainDocument* pDoc = wxGetApp().GetDocument(); - wxASSERT(NULL != pDoc); + wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); strBuffer.Clear(); @@ -704,12 +692,13 @@ wxInt32 CViewProjects::FormatAccountName(wxInt32 item, wxString& strBuffer) cons wxInt32 CViewProjects::FormatTeamName(wxInt32 item, wxString& strBuffer) const { CMainDocument* pDoc = wxGetApp().GetDocument(); - wxASSERT(NULL != pDoc); + wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); - strBuffer.Clear(); + //strBuffer.Clear(); - pDoc->GetProjectTeamName(item, strBuffer); + PROJECT* project = pDoc->project(item); + strBuffer = wxString(project->team_name.c_str()); return 0; } @@ -719,7 +708,7 @@ wxInt32 CViewProjects::FormatTotalCredit(wxInt32 item, wxString& strBuffer) cons float fBuffer; CMainDocument* pDoc = wxGetApp().GetDocument(); - wxASSERT(NULL != pDoc); + wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); strBuffer.Clear(); @@ -735,7 +724,7 @@ wxInt32 CViewProjects::FormatAVGCredit(wxInt32 item, wxString& strBuffer) const float fBuffer; CMainDocument* pDoc = wxGetApp().GetDocument(); - wxASSERT(NULL != pDoc); + wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); strBuffer.Clear(); @@ -752,7 +741,7 @@ wxInt32 CViewProjects::FormatResourceShare(wxInt32 item, wxString& strBuffer) co float fTotalResourceShareBuffer; CMainDocument* pDoc = wxGetApp().GetDocument(); - wxASSERT(NULL != pDoc); + wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); strBuffer.Clear(); @@ -769,7 +758,7 @@ wxInt32 CViewProjects::FormatStatus(wxInt32 item, wxString& strBuffer) const { wxInt32 iNextRPC; CMainDocument* pDoc = wxGetApp().GetDocument(); - wxASSERT(NULL != pDoc); + wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); strBuffer.Clear(); diff --git a/clientgui/ViewProjects.h b/clientgui/ViewProjects.h index 157a1410ad..caa460392a 100644 --- a/clientgui/ViewProjects.h +++ b/clientgui/ViewProjects.h @@ -83,7 +83,6 @@ protected: virtual void UpdateSelection(); - wxInt32 FormatProjectName( wxInt32 item, wxString& strBuffer ) const; wxInt32 FormatAccountName( wxInt32 item, wxString& strBuffer ) const; wxInt32 FormatTeamName( wxInt32 item, wxString& strBuffer ) const; wxInt32 FormatTotalCredit( wxInt32 item, wxString& strBuffer ) const; diff --git a/clientgui/ViewResources.cpp b/clientgui/ViewResources.cpp index 409ed6393d..c4ca347d4b 100644 --- a/clientgui/ViewResources.cpp +++ b/clientgui/ViewResources.cpp @@ -66,8 +66,8 @@ CViewResources::CViewResources(wxNotebook* pNotebook) : CTaskItemGroup* pGroup = NULL; CTaskItem* pItem = NULL; - wxASSERT(NULL != m_pTaskPane); - wxASSERT(NULL != m_pListPane); + wxASSERT(m_pTaskPane); + wxASSERT(m_pListPane); // // Setup View @@ -103,7 +103,7 @@ const char** CViewResources::GetViewIcon() { wxInt32 CViewResources::GetDocCount() { CMainDocument* pDoc = wxGetApp().GetDocument(); - wxASSERT(NULL != pDoc); + wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); return pDoc->GetResourceCount(); @@ -145,8 +145,8 @@ wxString CViewResources::OnDocGetItemText(long item, long column) const { wxInt32 CViewResources::AddCacheElement() { CResource* pItem = new CResource(); - wxASSERT(NULL != pItem); - if (NULL != pItem) { + wxASSERT(pItem); + if (pItem) { m_ResourceCache.push_back(pItem); return 0; } @@ -200,7 +200,7 @@ wxInt32 CViewResources::FormatProjectName(wxInt32 item, wxString& strBuffer) con { CMainDocument* pDoc = wxGetApp().GetDocument(); - wxASSERT(NULL != pDoc); + wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); strBuffer.Clear(); @@ -219,7 +219,7 @@ wxInt32 CViewResources::FormatDiskSpace(wxInt32 item, wxString& strBuffer) const double xKilo = 1024.0; CMainDocument* pDoc = wxGetApp().GetDocument(); - wxASSERT(NULL != pDoc); + wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); strBuffer.Clear(); diff --git a/clientgui/ViewStatistics.cpp b/clientgui/ViewStatistics.cpp index 0df5602277..d19b20ea06 100644 --- a/clientgui/ViewStatistics.cpp +++ b/clientgui/ViewStatistics.cpp @@ -51,11 +51,11 @@ void CPaintStatistics::OnPaint(wxPaintEvent& WXUNUSED(event)) { //Init global CMainDocument* pDoc = wxGetApp().GetDocument(); - wxASSERT(NULL != pDoc); + wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); PROJECTS *proj=&(pDoc->statistics_status); - wxASSERT(NULL != proj); + wxASSERT(proj); //Init drawing wxPaintDC dc (this); @@ -283,16 +283,16 @@ CViewStatistics::CViewStatistics(wxNotebook* pNotebook) : // Setup View // wxFlexGridSizer* itemFlexGridSizer = new wxFlexGridSizer(2, 0, 0); - wxASSERT(NULL != itemFlexGridSizer); + wxASSERT(itemFlexGridSizer); itemFlexGridSizer->AddGrowableRow(0); itemFlexGridSizer->AddGrowableCol(1); m_pTaskPane = new CBOINCTaskCtrl(this, ID_TASK_STATISTICSVIEW, DEFAULT_TASK_FLAGS); - wxASSERT(NULL != m_pTaskPane); + wxASSERT(m_pTaskPane); m_PaintStatistics = new CPaintStatistics(this, ID_LIST_STATISTICSVIEW, wxDefaultPosition, wxSize(-1, -1), 0); - wxASSERT(NULL != m_PaintStatistics); + wxASSERT(m_PaintStatistics); itemFlexGridSizer->Add(m_pTaskPane, 1, wxGROW|wxALL, 1); itemFlexGridSizer->Add(m_PaintStatistics, 1, wxGROW|wxALL, 1); @@ -355,7 +355,7 @@ void CViewStatistics::OnStatisticsUserTotal( wxCommandEvent& event ) { CMainFrame* pFrame = wxGetApp().GetFrame(); - wxASSERT(NULL != pFrame); + wxASSERT(pFrame); wxASSERT(wxDynamicCast(pFrame, CMainFrame)); pFrame->UpdateStatusText(_("Updating charts...")); @@ -376,7 +376,7 @@ void CViewStatistics::OnStatisticsUserAverage( wxCommandEvent& event ) { CMainFrame* pFrame = wxGetApp().GetFrame(); - wxASSERT(NULL != pFrame); + wxASSERT(pFrame); wxASSERT(wxDynamicCast(pFrame, CMainFrame)); pFrame->UpdateStatusText(_("Updating charts...")); @@ -397,7 +397,7 @@ void CViewStatistics::OnStatisticsHostTotal( wxCommandEvent& event ) { CMainFrame* pFrame = wxGetApp().GetFrame(); - wxASSERT(NULL != pFrame); + wxASSERT(pFrame); wxASSERT(wxDynamicCast(pFrame, CMainFrame)); pFrame->UpdateStatusText(_("Updating charts...")); @@ -418,7 +418,7 @@ void CViewStatistics::OnStatisticsHostAverage( wxCommandEvent& event ) { CMainFrame* pFrame = wxGetApp().GetFrame(); - wxASSERT(NULL != pFrame); + wxASSERT(pFrame); wxASSERT(wxDynamicCast(pFrame, CMainFrame)); pFrame->UpdateStatusText(_("Updating charts...")); @@ -437,8 +437,8 @@ void CViewStatistics::OnStatisticsHostAverage( wxCommandEvent& event ) { bool CViewStatistics::OnSaveState(wxConfigBase* pConfig) { bool bReturnValue = true; - wxASSERT(NULL != pConfig); - wxASSERT(NULL != m_pTaskPane); + wxASSERT(pConfig); + wxASSERT(m_pTaskPane); if (!m_pTaskPane->OnSaveState(pConfig)) { bReturnValue = false; @@ -463,7 +463,7 @@ bool CViewStatistics::OnRestoreState(wxConfigBase* pConfig) { void CViewStatistics::OnListRender( wxTimerEvent& event ) { CMainDocument* pDoc = wxGetApp().GetDocument(); - wxASSERT(NULL != pDoc); + wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); if (pDoc->GetStatisticsCount()) { diff --git a/clientgui/ViewTransfers.cpp b/clientgui/ViewTransfers.cpp index 3ded69c0f6..4743f29db6 100644 --- a/clientgui/ViewTransfers.cpp +++ b/clientgui/ViewTransfers.cpp @@ -88,8 +88,8 @@ CViewTransfers::CViewTransfers(wxNotebook* pNotebook) : CTaskItemGroup* pGroup = NULL; CTaskItem* pItem = NULL; - wxASSERT(NULL != m_pTaskPane); - wxASSERT(NULL != m_pListPane); + wxASSERT(m_pTaskPane); + wxASSERT(m_pListPane); // @@ -152,12 +152,12 @@ void CViewTransfers::OnTransfersRetryNow( wxCommandEvent& event ) { CMainDocument* pDoc = wxGetApp().GetDocument(); CMainFrame* pFrame = wxGetApp().GetFrame(); - wxASSERT(NULL != pDoc); + wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); - wxASSERT(NULL != pFrame); + wxASSERT(pFrame); wxASSERT(wxDynamicCast(pFrame, CMainFrame)); - wxASSERT(NULL != m_pTaskPane); - wxASSERT(NULL != m_pListPane); + wxASSERT(m_pTaskPane); + wxASSERT(m_pListPane); pFrame->UpdateStatusText(_("Retrying transfer now...")); pDoc->TransferRetryNow(m_pListPane->GetFirstSelected()); @@ -180,12 +180,12 @@ void CViewTransfers::OnTransfersAbort( wxCommandEvent& event ) { CMainDocument* pDoc = wxGetApp().GetDocument(); CMainFrame* pFrame = wxGetApp().GetFrame(); - wxASSERT(NULL != pDoc); + wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); - wxASSERT(NULL != pFrame); + wxASSERT(pFrame); wxASSERT(wxDynamicCast(pFrame, CMainFrame)); - wxASSERT(NULL != m_pTaskPane); - wxASSERT(NULL != m_pListPane); + wxASSERT(m_pTaskPane); + wxASSERT(m_pListPane); pFrame->UpdateStatusText(_("Aborting transfer...")); @@ -218,7 +218,7 @@ void CViewTransfers::OnTransfersAbort( wxCommandEvent& event ) { wxInt32 CViewTransfers::GetDocCount() { CMainDocument* pDoc = wxGetApp().GetDocument(); - wxASSERT(NULL != pDoc); + wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); return pDoc->GetTransferCount(); @@ -290,8 +290,8 @@ wxString CViewTransfers::OnDocGetItemText(long item, long column) const { wxInt32 CViewTransfers::AddCacheElement() { CTransfer* pItem = new CTransfer(); - wxASSERT(NULL != pItem); - if (NULL != pItem) { + wxASSERT(pItem); + if (pItem) { m_TransferCache.push_back(pItem); return 0; } @@ -365,7 +365,7 @@ void CViewTransfers::UpdateSelection() { wxInt32 CViewTransfers::FormatProjectName(wxInt32 item, wxString& strBuffer) const { CMainDocument* pDoc = wxGetApp().GetDocument(); - wxASSERT(NULL != pDoc); + wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); strBuffer.Clear(); @@ -379,7 +379,7 @@ wxInt32 CViewTransfers::FormatProjectName(wxInt32 item, wxString& strBuffer) con wxInt32 CViewTransfers::FormatFileName(wxInt32 item, wxString& strBuffer) const { CMainDocument* pDoc = wxGetApp().GetDocument(); - wxASSERT(NULL != pDoc); + wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); strBuffer.Clear(); @@ -395,7 +395,7 @@ wxInt32 CViewTransfers::FormatProgress(wxInt32 item, wxString& strBuffer) const float fFileSize = 0; CMainDocument* pDoc = wxGetApp().GetDocument(); - wxASSERT(NULL != pDoc); + wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); strBuffer.Clear(); @@ -422,7 +422,7 @@ wxInt32 CViewTransfers::FormatSize(wxInt32 item, wxString& strBuffer) const { double xKilo = 1024.0; CMainDocument* pDoc = wxGetApp().GetDocument(); - wxASSERT(NULL != pDoc); + wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); strBuffer.Clear(); @@ -471,7 +471,7 @@ wxInt32 CViewTransfers::FormatTime(wxInt32 item, wxString& strBuffer) const { wxTimeSpan ts; CMainDocument* pDoc = wxGetApp().GetDocument(); - wxASSERT(NULL != pDoc); + wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); strBuffer.Clear(); @@ -494,7 +494,7 @@ wxInt32 CViewTransfers::FormatSpeed(wxInt32 item, wxString& strBuffer) const { float fTransferSpeed = 0; CMainDocument* pDoc = wxGetApp().GetDocument(); - wxASSERT(NULL != pDoc); + wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); strBuffer.Clear(); @@ -518,7 +518,7 @@ wxInt32 CViewTransfers::FormatStatus(wxInt32 item, wxString& strBuffer) const { bool bActivitiesSuspended = false; bool bNetworkSuspended = false; - wxASSERT(NULL != pDoc); + wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); strBuffer.Clear(); diff --git a/clientgui/ViewTransfers.h b/clientgui/ViewTransfers.h index 7e98a3cdf4..4b6eb51765 100644 --- a/clientgui/ViewTransfers.h +++ b/clientgui/ViewTransfers.h @@ -28,8 +28,7 @@ #include "BOINCBaseView.h" -class CTransfer : public wxObject -{ +class CTransfer : public wxObject { public: CTransfer(); ~CTransfer(); @@ -44,8 +43,7 @@ public: }; -class CViewTransfers : public CBOINCBaseView -{ +class CViewTransfers : public CBOINCBaseView { DECLARE_DYNAMIC_CLASS( CViewTransfers ) public: diff --git a/clientgui/ViewWork.cpp b/clientgui/ViewWork.cpp index 7549682377..f07f8047fb 100644 --- a/clientgui/ViewWork.cpp +++ b/clientgui/ViewWork.cpp @@ -92,8 +92,8 @@ CViewWork::CViewWork(wxNotebook* pNotebook) : CTaskItemGroup* pGroup = NULL; CTaskItem* pItem = NULL; - wxASSERT(NULL != m_pTaskPane); - wxASSERT(NULL != m_pListPane); + wxASSERT(m_pTaskPane); + wxASSERT(m_pListPane); // @@ -164,12 +164,12 @@ void CViewWork::OnWorkSuspend( wxCommandEvent& event ) { CMainDocument* pDoc = wxGetApp().GetDocument(); CMainFrame* pFrame = wxGetApp().GetFrame(); - wxASSERT(NULL != pDoc); + wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); - wxASSERT(NULL != pFrame); + wxASSERT(pFrame); wxASSERT(wxDynamicCast(pFrame, CMainFrame)); - wxASSERT(NULL != m_pTaskPane); - wxASSERT(NULL != m_pListPane); + wxASSERT(m_pTaskPane); + wxASSERT(m_pListPane); RESULT* result = pDoc->result(m_pListPane->GetFirstSelected()); if (result->suspended_via_gui) { @@ -196,12 +196,12 @@ void CViewWork::OnWorkShowGraphics( wxCommandEvent& event ) { CMainDocument* pDoc = wxGetApp().GetDocument(); CMainFrame* pFrame = wxGetApp().GetFrame(); - wxASSERT(NULL != pDoc); + wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); - wxASSERT(NULL != pFrame); + wxASSERT(pFrame); wxASSERT(wxDynamicCast(pFrame, CMainFrame)); - wxASSERT(NULL != m_pTaskPane); - wxASSERT(NULL != m_pListPane); + wxASSERT(m_pTaskPane); + wxASSERT(m_pListPane); pFrame->UpdateStatusText(_("Showing graphics for result...")); @@ -257,12 +257,12 @@ void CViewWork::OnWorkAbort( wxCommandEvent& event ) { CMainDocument* pDoc = wxGetApp().GetDocument(); CMainFrame* pFrame = wxGetApp().GetFrame(); - wxASSERT(NULL != pDoc); + wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); - wxASSERT(NULL != pFrame); + wxASSERT(pFrame); wxASSERT(wxDynamicCast(pFrame, CMainFrame)); - wxASSERT(NULL != m_pTaskPane); - wxASSERT(NULL != m_pListPane); + wxASSERT(m_pTaskPane); + wxASSERT(m_pListPane); pFrame->UpdateStatusText(_("Aborting result...")); @@ -294,7 +294,7 @@ void CViewWork::OnWorkAbort( wxCommandEvent& event ) { wxInt32 CViewWork::GetDocCount() { CMainDocument* pDoc = wxGetApp().GetDocument(); - wxASSERT(NULL != pDoc); + wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); return pDoc->GetWorkCount(); @@ -372,8 +372,8 @@ wxString CViewWork::OnDocGetItemText(long item, long column) const { wxInt32 CViewWork::AddCacheElement() { CWork* pItem = new CWork(); - wxASSERT(NULL != pItem); - if (NULL != pItem) { + wxASSERT(pItem); + if (pItem) { m_WorkCache.push_back(pItem); return 0; } @@ -473,7 +473,7 @@ void CViewWork::UpdateSelection() { wxInt32 CViewWork::FormatProjectName(wxInt32 item, wxString& strBuffer) const { CMainDocument* pDoc = wxGetApp().GetDocument(); - wxASSERT(NULL != pDoc); + wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); strBuffer.Clear(); @@ -489,7 +489,7 @@ wxInt32 CViewWork::FormatApplicationName(wxInt32 item, wxString& strBuffer) cons wxString strTempName = wxEmptyString; CMainDocument* pDoc = wxGetApp().GetDocument(); - wxASSERT(NULL != pDoc); + wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); strBuffer.Clear(); @@ -509,7 +509,7 @@ wxInt32 CViewWork::FormatApplicationName(wxInt32 item, wxString& strBuffer) cons wxInt32 CViewWork::FormatName(wxInt32 item, wxString& strBuffer) const { CMainDocument* pDoc = wxGetApp().GetDocument(); - wxASSERT(NULL != pDoc); + wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); strBuffer.Clear(); @@ -528,7 +528,7 @@ wxInt32 CViewWork::FormatCPUTime(wxInt32 item, wxString& strBuffer) const { wxTimeSpan ts; CMainDocument* pDoc = wxGetApp().GetDocument(); - wxASSERT(NULL != pDoc); + wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); strBuffer.Clear(); @@ -562,7 +562,7 @@ wxInt32 CViewWork::FormatProgress(wxInt32 item, wxString& strBuffer) const { float fBuffer = 0; CMainDocument* pDoc = wxGetApp().GetDocument(); - wxASSERT(NULL != pDoc); + wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); strBuffer.Clear(); @@ -590,7 +590,7 @@ wxInt32 CViewWork::FormatTimeToCompletion(wxInt32 item, wxString& strBuffer) con wxTimeSpan ts; CMainDocument* pDoc = wxGetApp().GetDocument(); - wxASSERT(NULL != pDoc); + wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); strBuffer.Clear(); @@ -618,7 +618,7 @@ wxInt32 CViewWork::FormatReportDeadline(wxInt32 item, wxString& strBuffer) const wxDateTime dtTemp; CMainDocument* pDoc = wxGetApp().GetDocument(); - wxASSERT(NULL != pDoc); + wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); strBuffer.Clear(); @@ -639,7 +639,7 @@ wxInt32 CViewWork::FormatStatus(wxInt32 item, wxString& strBuffer) const { bool bNetworkSuspended = false; - wxASSERT(NULL != pDoc); + wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); strBuffer.Clear(); diff --git a/lib/gui_rpc_client.C b/lib/gui_rpc_client.C index 5751257f9e..a45b03f209 100644 --- a/lib/gui_rpc_client.C +++ b/lib/gui_rpc_client.C @@ -75,6 +75,13 @@ PROJECT::~PROJECT() { clear(); } +void PROJECT::get_name(std::string& s) { + if (project_name.length() == 0) { + s = master_url; + } else { + s = project_name; + } +} int PROJECT::parse(MIOFILE& in) { char buf[256]; int retval; diff --git a/lib/gui_rpc_client.h b/lib/gui_rpc_client.h index 7009f1fff7..c3521e1617 100644 --- a/lib/gui_rpc_client.h +++ b/lib/gui_rpc_client.h @@ -112,7 +112,8 @@ public: int parse(MIOFILE&); void print(); void clear(); - + void get_name(std::string&); + // statistic of the last x days std::vector statistics; }; diff --git a/lib/shmem.C b/lib/shmem.C index d8710296e4..94f0a3591f 100755 --- a/lib/shmem.C +++ b/lib/shmem.C @@ -84,7 +84,6 @@ HANDLE attach_shmem(LPCTSTR seg_name, void** pp) { return hMap; } - int detach_shmem(HANDLE hMap, void* p) { if (p) UnmapViewOfFile(p); CloseHandle(hMap); diff --git a/lib/shmem.h b/lib/shmem.h index 6760f31661..19b3cbbd0f 100755 --- a/lib/shmem.h +++ b/lib/shmem.h @@ -38,8 +38,8 @@ HANDLE create_shmem(LPCTSTR seg_name, int size, void** pp, bool disable_mapview) // HANDLE attach_shmem(LPCTSTR seg_name, void** pp); -// detach from a shared-mem segment. Once all processes have -// detached, the segment is destroyed +// detach from a shared-mem segment. +// Once all processes have detached, the segment is destroyed // int detach_shmem(HANDLE hSharedMem, void* p); diff --git a/win_build/boinc_cli.vcproj b/win_build/boinc_cli.vcproj index c6c0e7585f..6376817569 100644 --- a/win_build/boinc_cli.vcproj +++ b/win_build/boinc_cli.vcproj @@ -1110,6 +1110,9 @@ + +