From a32b03a98dd4908d3b0d55374b72f43f9fdc0aeb Mon Sep 17 00:00:00 2001 From: Rom Walton Date: Thu, 9 Feb 2006 21:51:07 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=9432 --- checkin_notes | 11 + clientgui/BOINCDialupManager.cpp | 407 +++++++++++++++++++++++++++++++ clientgui/BOINCDialupManager.h | 66 +++++ clientgui/MainFrame.cpp | 318 +----------------------- clientgui/MainFrame.h | 8 +- clientgui/ViewProjects.cpp | 4 +- win_build/boincmgr_curl.vcproj | 6 + win_build/installerv2/BOINC.ism | Bin 205312 -> 205312 bytes 8 files changed, 506 insertions(+), 314 deletions(-) create mode 100644 clientgui/BOINCDialupManager.cpp create mode 100644 clientgui/BOINCDialupManager.h diff --git a/checkin_notes b/checkin_notes index 67ffb16197..6c98e21abb 100755 --- a/checkin_notes +++ b/checkin_notes @@ -1682,3 +1682,14 @@ Bruce 9 Feb 2006 ops/ manage_special_users.php + +Rom 9 Feb 2006 + - Integrate BOINC Manager into David's last API change. + - Breakout the dial up functionality into its own class. + - Increase the refresh rate of the list view to 1 second. + - Terminology change in the project tab. credit = work done. + + clientgui/ + BOINCDialupManager.cpp, .h (Added) + MainFrame.cpp, .h + ViewProjects.cpp diff --git a/clientgui/BOINCDialupManager.cpp b/clientgui/BOINCDialupManager.cpp new file mode 100644 index 0000000000..167942d0b1 --- /dev/null +++ b/clientgui/BOINCDialupManager.cpp @@ -0,0 +1,407 @@ +// Berkeley Open Infrastructure for Network Computing +// http://boinc.berkeley.edu +// Copyright (C) 2005 University of California +// +// This is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; +// either version 2.1 of the License, or (at your option) any later version. +// +// This software is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU Lesser General Public License for more details. +// +// To view the GNU Lesser General Public License visit +// http://www.gnu.org/copyleft/lesser.html +// or write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +#if defined(__GNUG__) && !defined(__APPLE__) +#pragma implementation "BOINCDialUpManager.h" +#endif + +#include "stdwx.h" +#include "network.h" +#include "BOINCGUIApp.h" +#include "diagnostics.h" +#include "BOINCDialUpManager.h" +#include "DlgOptions.h" +#include "DlgDialupCredentials.h" + + +CBOINCDialUpManager::CBOINCDialUpManager() { + m_pDialupManager = wxDialUpManager::Create(); + wxASSERT(m_pDialupManager->IsOk()); + + m_dtLastDialupAlertSent = wxDateTime((time_t)0); + m_dtLastDialupRequest = wxDateTime((time_t)0); + m_dtFirstDialupDisconnectEvent = wxDateTime((time_t)0); + m_bNotifyConnectionAvailable = false; + m_bConnectedSuccessfully = false; + m_bResetTimers = false; + m_bWasDialing = false; + m_iNetworkStatus = 0; + + + // Construct the default dialog title for dial-up messages + // + // %s is the application name + // i.e. 'BOINC Manager', 'GridRepublic Manager' + m_strDialogTitle.Printf( + _("%s - Network Status"), + wxGetApp().GetBrand()->GetApplicationName().c_str() + ); +} + + +CBOINCDialUpManager::~CBOINCDialUpManager() { + delete m_pDialupManager; +} + + +bool CBOINCDialUpManager::IsOk() { + return m_pDialupManager->IsOk(); +} + + +size_t CBOINCDialUpManager::GetISPNames(wxArrayString& names) { + return m_pDialupManager->GetISPNames(names); +} + + +void CBOINCDialUpManager::poll() { + + CMainDocument* pDoc = wxGetApp().GetDocument(); + CMainFrame* pFrame = wxGetApp().GetFrame(); + + bool bIsDialing = false; + bool bIsOnline = false; + bool bWantConnection = false; + bool bWantDisconnect = false; + int iNetworkStatus = 0; + long dwConnectionFlags = + NETWORK_ALIVE_LAN | NETWORK_ALIVE_WAN | NETWORK_ALIVE_AOL; + wxString strDialogMessage = wxEmptyString; + + + // We are ready to rock and roll. + if (pDoc) { + wxASSERT(wxDynamicCast(pDoc, CMainDocument)); + wxASSERT(wxDynamicCast(pFrame, CMainFrame)); + + + // cache the various states + + // The dialup manager tells us if we are still dialing or if we have + // successfully connected. IsNetworkAlive/IsOnline both report the + // success or failure of the dialup device to establish a connection + // to the outside world. + pDoc->rpc.network_status(iNetworkStatus); + bIsDialing = m_pDialupManager->IsDialing(); + bIsOnline = wxGetApp().IsNetworkAlive(&dwConnectionFlags) ? true : false; + bWantConnection = iNetworkStatus == 1 ? true : false; + bWantDisconnect = iNetworkStatus == 2 ? true : false; + + // The timers are used to keep from spamming the user with the same + // messages over each iteration of the poll loop. we only need to + // reset them during a connect event in case we randomly loose + // a connection. + if (m_bResetTimers) { + wxLogTrace(wxT("Function Status"), wxT("CBOINCDialUpManager::poll - Resetting dial-up notification timers")); + + m_bResetTimers = false; + m_dtLastDialupAlertSent = wxDateTime((time_t)0); + m_dtLastDialupRequest = wxDateTime((time_t)0); + } + + + if (!bIsOnline && !bIsDialing && !m_bWasDialing && bWantConnection) + { + wxLogTrace(wxT("Function Status"), wxT("CMainFrame::OnFrameRender - Internet connection needed")); + if (!pFrame->IsShown()) { + // BOINC Manager is hidden and displaying a dialog might interupt what they + // are doing. + NotifyNeedConnection(); + } else { + // BOINC Manager is visable and can process user input. + Connect(); + } + } else if (!bIsDialing && !m_bWasDialing) { + if (bIsOnline && bWantConnection && m_bConnectedSuccessfully && !m_bNotifyConnectionAvailable) { + wxLogTrace(wxT("Function Status"), wxT("CMainFrame::OnFrameRender - Connection Detected, notifing user of update to all projects")); + ConnectionDetected(); + } else if (bIsOnline && bWantDisconnect && m_bConnectedSuccessfully ) { + wxLogTrace(wxT("Function Status"), wxT("CMainFrame::OnFrameRender - Connection Detected, disconnect requested via the CC.")); + Disconnect(); + } + } else if (!bIsDialing && m_bWasDialing) { + wxLogTrace(wxT("Function Status"), wxT("CMainFrame::OnFrameRender - We were dialing and now we are not, detect success or failure of the connection.")); + m_bWasDialing = false; + m_bResetTimers = true; + if (bIsDialing) { + ConnectionSucceeded(); + } else { + ConnectionFailed(); + } + } else if (bIsDialing && !m_bWasDialing) { + wxLogTrace(wxT("Function Status"), wxT("CMainFrame::OnFrameRender - We are now dialing, where before we were not.")); + m_bWasDialing = true; + } + } +} + + +int CBOINCDialUpManager::NotifyNeedConnection() { + CMainFrame* pFrame = wxGetApp().GetFrame(); + wxTimeSpan tsLastDialupAlertSent; + wxString strDialogMessage = wxEmptyString; + + wxASSERT(pFrame); + wxASSERT(wxDynamicCast(pFrame, CMainFrame)); + + tsLastDialupAlertSent = wxDateTime::Now() - m_dtLastDialupAlertSent; + if (tsLastDialupAlertSent.GetSeconds() >= (pFrame->GetReminderFrequency() * 60)) { + wxLogTrace(wxT("Function Status"), wxT("CMainFrame::OnFrameRender - Manager not shown, notify instead")); + + m_dtLastDialupAlertSent = wxDateTime::Now(); + + // 1st %s is the project name + // i.e. 'BOINC', 'GridRepublic' + // 2st %s is the application name + // i.e. 'BOINC Manager', 'GridRepublic Manager' + strDialogMessage.Printf( + _("%s needs a connection to the Internet to perform some " + "maintenance, open the %s to connect up and " + "perform the needed work."), + wxGetApp().GetBrand()->GetProjectName().c_str(), + wxGetApp().GetBrand()->GetApplicationName().c_str() + ); + + pFrame->ShowAlert( + m_strDialogTitle, + strDialogMessage, + wxICON_INFORMATION, + true + ); + } + + return 0; +} + + +int CBOINCDialUpManager::Connect() { + CMainDocument* pDoc = wxGetApp().GetDocument(); + CMainFrame* pFrame = wxGetApp().GetFrame(); + wxTimeSpan tsLastDialupRequest; + int iAnswer; + wxString strConnectionName = wxEmptyString; + wxString strConnectionUsername = wxEmptyString; + wxString strConnectionPassword = wxEmptyString; + wxString strDialogMessage = wxEmptyString; + + wxASSERT(pFrame); + wxASSERT(wxDynamicCast(pFrame, CMainFrame)); + wxASSERT(pDoc); + wxASSERT(wxDynamicCast(pDoc, CMainDocument)); + + tsLastDialupRequest = wxDateTime::Now() - m_dtLastDialupRequest; + if (tsLastDialupRequest.GetSeconds() >= (pFrame->GetReminderFrequency() * 60)) { + wxLogTrace(wxT("Function Status"), wxT("CMainFrame::OnFrameRender - Begin connection process")); + + m_dtLastDialupRequest = wxDateTime::Now(); + + if(pDoc->state.global_prefs.confirm_before_connecting) { + // %s is the project name + // i.e. 'BOINC', 'GridRepublic' + strDialogMessage.Printf( + _("%s needs to connect to the network.\nMay it do so now?"), + wxGetApp().GetBrand()->GetProjectName().c_str() + ); + iAnswer = ::wxMessageBox( + strDialogMessage, + m_strDialogTitle, + wxYES_NO | wxICON_QUESTION, + pFrame + ); + } else { + // %s is the project name + // i.e. 'BOINC', 'GridRepublic' + strDialogMessage.Printf( + _("%s is connecting to the internet."), + wxGetApp().GetBrand()->GetProjectName().c_str() + ); + pFrame->ShowAlert( + m_strDialogTitle, + strDialogMessage, + wxICON_INFORMATION, + true + ); + iAnswer = wxYES; + } + + // Are we allow to connect? + if (wxYES == iAnswer) { + if (pFrame->GetDialupConnectionName().size()) { + strConnectionName = pFrame->GetDialupConnectionName(); + } + + if (pFrame->GetDialupPromptForCredentials()) { + CDlgDialupCredentials* pDlgDialupCredentials = new CDlgDialupCredentials(pFrame); + + iAnswer = pDlgDialupCredentials->ShowModal(); + if (wxID_OK == iAnswer) { + strConnectionUsername = pDlgDialupCredentials->GetUsername(); + strConnectionPassword = pDlgDialupCredentials->GetPassword(); + } + + if (pDlgDialupCredentials) { + pDlgDialupCredentials->Destroy(); + } + } + + m_bNotifyConnectionAvailable = false; + m_bConnectedSuccessfully = false; + m_pDialupManager->Dial(strConnectionName, strConnectionUsername, strConnectionPassword, true); + } + } + + return 0; +} + + +int CBOINCDialUpManager::ConnectionSucceeded() { + CMainFrame* pFrame = wxGetApp().GetFrame(); + wxString strDialogMessage = wxEmptyString; + + wxASSERT(pFrame); + wxASSERT(wxDynamicCast(pFrame, CMainFrame)); + + // %s is the project name + // i.e. 'BOINC', 'GridRepublic' + strDialogMessage.Printf( + _("%s has successfully connected to the internet."), + wxGetApp().GetBrand()->GetProjectName().c_str() + ); + pFrame->ShowAlert( + m_strDialogTitle, + strDialogMessage, + wxICON_INFORMATION, + true + ); + m_bConnectedSuccessfully = true; + + return 0; +} + + +int CBOINCDialUpManager::ConnectionFailed() { + CMainFrame* pFrame = wxGetApp().GetFrame(); + wxString strDialogMessage = wxEmptyString; + + wxASSERT(pFrame); + wxASSERT(wxDynamicCast(pFrame, CMainFrame)); + + // %s is the project name + // i.e. 'BOINC', 'GridRepublic' + strDialogMessage.Printf( + _("%s failed to connect to the internet."), + wxGetApp().GetBrand()->GetProjectName().c_str() + ); + pFrame->ShowAlert( + m_strDialogTitle, + strDialogMessage, + wxICON_ERROR, + true + ); + m_bConnectedSuccessfully = false; + + return 0; +} + + +int CBOINCDialUpManager::ConnectionDetected() { + CMainDocument* pDoc = wxGetApp().GetDocument(); + CMainFrame* pFrame = wxGetApp().GetFrame(); + wxString strDialogMessage = wxEmptyString; + + wxASSERT(pDoc); + wxASSERT(wxDynamicCast(pDoc, CMainDocument)); + wxASSERT(pFrame); + wxASSERT(wxDynamicCast(pFrame, CMainFrame)); + + m_bNotifyConnectionAvailable = true; + + // We are already online but BOINC for some reason is in a state + // where it belives it has some pending work to do, so give it + // a nudge + + // %s is the project name + // i.e. 'BOINC', 'GridRepublic' + strDialogMessage.Printf( + _("%s has detected it is now connected to the internet. " + "Updating all projects and retrying all transfers."), + wxGetApp().GetBrand()->GetProjectName().c_str() + ); + + pFrame->ShowAlert( + m_strDialogTitle, + strDialogMessage, + wxICON_INFORMATION, + true + ); + + // Signal BOINC to update all projects and transfers. + pDoc->rpc.network_available(); + + return 0; +} + + +int CBOINCDialUpManager::Disconnect() { + CMainDocument* pDoc = wxGetApp().GetDocument(); + CMainFrame* pFrame = wxGetApp().GetFrame(); + wxString strDialogMessage = wxEmptyString; + + wxASSERT(pDoc); + wxASSERT(wxDynamicCast(pDoc, CMainDocument)); + wxASSERT(pFrame); + wxASSERT(wxDynamicCast(pFrame, CMainFrame)); + + if (pDoc->state.global_prefs.hangup_if_dialed) { + wxLogTrace(wxT("Function Status"), wxT("CMainFrame::OnFrameRender - Connection Detected, Don't need the network, Hanging up.")); + if (m_pDialupManager->HangUp()) { + + // %s is the project name + // i.e. 'BOINC', 'GridRepublic' + strDialogMessage.Printf( + _("%s has successfully disconnected from the internet."), + wxGetApp().GetBrand()->GetProjectName().c_str() + ); + pFrame->ShowAlert( + m_strDialogTitle, + strDialogMessage, + wxICON_INFORMATION, + true + ); + m_bConnectedSuccessfully = false; + + } else { + + // %s is the project name + // i.e. 'BOINC', 'GridRepublic' + strDialogMessage.Printf( + _("%s failed to disconnected from the internet."), + wxGetApp().GetBrand()->GetProjectName().c_str() + ); + pFrame->ShowAlert( + m_strDialogTitle, + strDialogMessage, + wxICON_ERROR + ); + } + } + + return 0; +} + diff --git a/clientgui/BOINCDialupManager.h b/clientgui/BOINCDialupManager.h new file mode 100644 index 0000000000..c95910b573 --- /dev/null +++ b/clientgui/BOINCDialupManager.h @@ -0,0 +1,66 @@ +// Berkeley Open Infrastructure for Network Computing +// http://boinc.berkeley.edu +// Copyright (C) 2005 University of California +// +// This is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; +// either version 2.1 of the License, or (at your option) any later version. +// +// This software is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU Lesser General Public License for more details. +// +// To view the GNU Lesser General Public License visit +// http://www.gnu.org/copyleft/lesser.html +// or write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +#ifndef _BOINCDIALUPMANAGER_H_ +#define _BOINCDIALUPMANAGER_H_ + +#if defined(__GNUG__) && !defined(__APPLE__) +#pragma interface "BOINCDialUpManager.cpp" +#endif + + +class CBOINCDialUpManager : public wxObject +{ +public: + + CBOINCDialUpManager(); + ~CBOINCDialUpManager(); + + bool IsOk(); + size_t GetISPNames(wxArrayString& names); + + void poll(); + + int NotifyNeedConnection(); + int Connect(); + int ConnectionSucceeded(); + int ConnectionFailed(); + + int ConnectionDetected(); + + int Disconnect(); + + +protected: + wxDialUpManager* m_pDialupManager; + wxDateTime m_dtLastDialupAlertSent; + wxDateTime m_dtLastDialupRequest; + wxDateTime m_dtFirstDialupDisconnectEvent; + bool m_bNotifyConnectionAvailable; + bool m_bConnectedSuccessfully; + bool m_bResetTimers; + bool m_bWasDialing; + int m_iNetworkStatus; + + wxString m_strDialogTitle; +}; + + +#endif + diff --git a/clientgui/MainFrame.cpp b/clientgui/MainFrame.cpp index 7ad166c292..8312952834 100644 --- a/clientgui/MainFrame.cpp +++ b/clientgui/MainFrame.cpp @@ -27,11 +27,11 @@ #include "stdwx.h" #include "hyperlink.h" -#include "network.h" #include "BOINCGUIApp.h" #include "MainFrame.h" #include "Events.h" #include "BOINCBaseView.h" +#include "BOINCDialUpManager.h" #include "ViewProjects.h" #include "ViewWork.h" #include "ViewTransfers.h" @@ -39,7 +39,6 @@ #include "ViewStatistics.h" #include "ViewResources.h" #include "DlgAbout.h" -#include "DlgDialupCredentials.h" #include "DlgGenericMessage.h" #include "DlgOptions.h" #include "DlgSelectComputer.h" @@ -230,7 +229,7 @@ CMainFrame::CMainFrame(wxString title, wxIcon* icon) : // wxDialUpManager->IsAlwaysOnline happen quicker. m_WININET.Load(wxT("WININET")); if (m_RASAPI32.Load(wxT("RASAPI32"))) { - m_pDialupManager = wxDialUpManager::Create(); + m_pDialupManager = new CBOINCDialUpManager(); wxASSERT(m_pDialupManager->IsOk()); } else { m_pDialupManager = NULL; @@ -251,7 +250,7 @@ CMainFrame::CMainFrame(wxString title, wxIcon* icon) : m_pRefreshStateTimer->Start(300000); // Send event every 5 minutes m_pFrameRenderTimer->Start(1000); // Send event every 1 second - m_pFrameListPanelRenderTimer->Start(5000); // Send event every 5 seconds + m_pFrameListPanelRenderTimer->Start(1000); // Send event every 1 second m_pDocumentPollTimer->Start(250); // Send event every 250 milliseconds // Limit the number of times the UI can update itself to two times a second @@ -1698,315 +1697,12 @@ void CMainFrame::OnFrameRender(wxTimerEvent &event) { bAlreadyRunOnce = true; } + // Check to see if there is anything that we need to do from the + // dial up user perspective. #ifdef __WXMSW__ if (pDoc->IsConnected()) { - static wxDateTime dtLastDialupIsAlreadyOnlineCheck = wxDateTime((time_t)0); - static wxDateTime dtLastDialupAlertSent = wxDateTime((time_t)0); - static wxDateTime dtLastDialupRequest = wxDateTime((time_t)0); - static wxDateTime dtFirstDialupDisconnectEvent = wxDateTime((time_t)0); - static bool already_notified_update_all_projects = false; - static bool connected_successfully = false; - static bool reset_timers = false; - static bool was_dialing = false; - static bool is_already_online = true; - bool should_check_connection = false; - bool is_dialing = false; - bool is_online = false; - int want_network = 0; - int answer = 0; - long dwConnectionFlags = - NETWORK_ALIVE_LAN | NETWORK_ALIVE_WAN | NETWORK_ALIVE_AOL; - wxString strConnectionName = wxEmptyString; - wxString strConnectionUsername = wxEmptyString; - wxString strConnectionPassword = wxEmptyString; - wxString strBuffer = wxEmptyString; - wxTimeSpan tsLastDialupIsAlreadyOnlineCheck; - wxTimeSpan tsLastDialupAlertSent; - wxTimeSpan tsLastDialupRequest; - wxTimeSpan tsFirstDialupDisconnectEvent; - wxString strDialogTitle = wxEmptyString; - wxString strDialogMessage = wxEmptyString; - - - // Construct the default dialog title for dial-up messages - // - // %s is the application name - // i.e. 'BOINC Manager', 'GridRepublic Manager' - strDialogTitle.Printf( - _("%s - Network Status"), - wxGetApp().GetBrand()->GetApplicationName().c_str() - ); - - - if (m_pDialupManager && pDoc) { - // Update the always online flag every 60 seconds. This call is expensive - // on slow machines. - tsLastDialupIsAlreadyOnlineCheck = wxDateTime::Now() - dtLastDialupIsAlreadyOnlineCheck; - if (tsLastDialupIsAlreadyOnlineCheck.GetSeconds() > 60) { - dtLastDialupIsAlreadyOnlineCheck = wxDateTime::Now(); - is_already_online = wxGetApp().IsNetworkAlwaysOnline() ? true : false; - } - - // Are we configured to detect a network or told one already exists? - if (ID_NETWORKLAN != m_iNetworkConnectionType) { - if (ID_NETWORKDIALUP == m_iNetworkConnectionType) { - should_check_connection = true; - } - if (ID_NETWORKAUTODETECT == m_iNetworkConnectionType) { - if (!is_already_online) { - should_check_connection = true; - } - } - } - - if (should_check_connection) { - wxASSERT(wxDynamicCast(pDoc, CMainDocument)); - - // cache the various states - is_dialing = m_pDialupManager->IsDialing(); - is_online = wxGetApp().IsNetworkAlive(&dwConnectionFlags) ? true : false; - pDoc->rpc.network_query(want_network); - - wxLogTrace(wxT("Function Status"), wxT("CMainFrame::OnFrameRender - Dialup Flags")); - wxLogTrace(wxT("Function Status"), - wxT("CMainFrame::OnFrameRender - -- is_online = '%d', is_dialing = '%d', was_dialing = '%d', want_network = '%d'"), - is_online, is_dialing, was_dialing, want_network - ); - wxLogTrace(wxT("Function Status"), - wxT("CMainFrame::OnFrameRender - -- reset_timers = '%d', already_notified_update_all_projects = '%d', connected_successfully = '%d'"), - reset_timers, already_notified_update_all_projects, connected_successfully - ); - wxLogTrace(wxT("Function Status"), - wxT("CMainFrame::OnFrameRender - -- confirm_before_connecting = '%d', hangup_if_dialed = '%d'"), - pDoc->state.global_prefs.confirm_before_connecting, pDoc->state.global_prefs.hangup_if_dialed - ); - - // If we have received any connection event, then we should reset the - // dtLastDialupAlertSent and dtLastDialupRequest variables - // so that if we are disconnected without completing the user will - // be notifed in a prompt fashion. - if (reset_timers) { - wxLogTrace(wxT("Function Status"), wxT("CMainFrame::OnFrameRender - Resetting dial-up notification timers")); - - reset_timers = false; - dtLastDialupAlertSent = wxDateTime((time_t)0); - dtLastDialupRequest = wxDateTime((time_t)0); - } - - if (!is_online && !is_dialing && !was_dialing && want_network) - { - wxLogTrace(wxT("Function Status"), wxT("CMainFrame::OnFrameRender - Internet connection needed")); - if (!IsShown()) { - // BOINC Manager is hidden and displaying a dialog might interupt what they - // are doing. - tsLastDialupAlertSent = wxDateTime::Now() - dtLastDialupAlertSent; - if (tsLastDialupAlertSent.GetSeconds() >= (m_iReminderFrequency * 60)) { - wxLogTrace(wxT("Function Status"), wxT("CMainFrame::OnFrameRender - Manager not shown, notify instead")); - - dtLastDialupAlertSent = wxDateTime::Now(); - - // 1st %s is the project name - // i.e. 'BOINC', 'GridRepublic' - // 2st %s is the application name - // i.e. 'BOINC Manager', 'GridRepublic Manager' - strDialogMessage.Printf( - _("%s needs a connection to the Internet to perform some " - "maintenance, open the %s to connect up and " - "perform the needed work."), - wxGetApp().GetBrand()->GetProjectName().c_str(), - wxGetApp().GetBrand()->GetApplicationName().c_str() - ); - - ShowAlert( - strDialogTitle, - strDialogMessage, - wxICON_INFORMATION, - true - ); - } - } else { - // BOINC Manager is visable and can process user input. - tsLastDialupRequest = wxDateTime::Now() - dtLastDialupRequest; - if (tsLastDialupRequest.GetSeconds() >= (m_iReminderFrequency * 60)) { - wxLogTrace(wxT("Function Status"), wxT("CMainFrame::OnFrameRender - Begin connection process")); - - dtLastDialupRequest = wxDateTime::Now(); - - if(pDoc->state.global_prefs.confirm_before_connecting) { - // %s is the project name - // i.e. 'BOINC', 'GridRepublic' - strDialogMessage.Printf( - _("%s needs to connect to the network.\nMay it do so now?"), - wxGetApp().GetBrand()->GetProjectName().c_str() - ); - answer = ::wxMessageBox( - strDialogMessage, - strDialogTitle, - wxYES_NO | wxICON_QUESTION, - this - ); - } else { - // %s is the project name - // i.e. 'BOINC', 'GridRepublic' - strDialogMessage.Printf( - _("%s is connecting to the internet."), - wxGetApp().GetBrand()->GetProjectName().c_str() - ); - ShowAlert( - strDialogTitle, - strDialogMessage, - wxICON_INFORMATION, - true - ); - answer = wxYES; - } - - // Are we allow to connect? - if (wxYES == answer) { - if (m_strNetworkDialupConnectionName.size()) - strConnectionName = m_strNetworkDialupConnectionName; - - if (m_bNetworkDialupPromptCredentials) { - CDlgDialupCredentials* pDlgDialupCredentials = new CDlgDialupCredentials(this); - - answer = pDlgDialupCredentials->ShowModal(); - if (wxID_OK == answer) { - strConnectionUsername = pDlgDialupCredentials->GetUsername(); - strConnectionPassword = pDlgDialupCredentials->GetPassword(); - } - - if (pDlgDialupCredentials) { - pDlgDialupCredentials->Destroy(); - } - } - - already_notified_update_all_projects = false; - connected_successfully = false; - m_pDialupManager->Dial(strConnectionName, strConnectionUsername, strConnectionPassword, true); - } - } - } - } else if (!is_dialing && !was_dialing) { - if (is_online && want_network && connected_successfully && !already_notified_update_all_projects) { - wxLogTrace(wxT("Function Status"), wxT("CMainFrame::OnFrameRender - Connection Detected, notifing user of update to all projects")); - - already_notified_update_all_projects = true; - - // We are already online but BOINC for some reason is in a state - // where it belives it has some pending work to do, so give it - // a nudge - - // %s is the project name - // i.e. 'BOINC', 'GridRepublic' - strDialogMessage.Printf( - _("%s has detected it is now connected to the internet. " - "Updating all projects and retrying all transfers."), - wxGetApp().GetBrand()->GetProjectName().c_str() - ); - - ShowAlert( - strDialogTitle, - strDialogMessage, - wxICON_INFORMATION, - true - ); - - // Sleep for a couple of seconds to let the network interface finish - // initializing. - ::wxSleep(2); - - // Signal BOINC to update all projects and transfers. - pDoc->rpc.network_available(); - - } else if (is_online && !want_network && connected_successfully) { - wxLogTrace(wxT("Function Status"), wxT("CMainFrame::OnFrameRender - Connection Detected, Don't need the network, We successfully connected.")); - - // Should we disconnect now? The first time we see the disconnect event - // we should ignore it and wait for 5 seconds to see if it is really - // safe to disconnect. - if (wxDateTime((time_t)0) == dtFirstDialupDisconnectEvent) { - dtFirstDialupDisconnectEvent = wxDateTime::Now(); - } - tsFirstDialupDisconnectEvent = wxDateTime::Now() - dtFirstDialupDisconnectEvent; - if (tsFirstDialupDisconnectEvent.GetSeconds() >= 5) { - if (pDoc->state.global_prefs.hangup_if_dialed) { - wxLogTrace(wxT("Function Status"), wxT("CMainFrame::OnFrameRender - Connection Detected, Don't need the network, Hanging up.")); - if (m_pDialupManager->HangUp()) { - - // %s is the project name - // i.e. 'BOINC', 'GridRepublic' - strDialogMessage.Printf( - _("%s has successfully disconnected from the internet."), - wxGetApp().GetBrand()->GetProjectName().c_str() - ); - ShowAlert( - strDialogTitle, - strDialogMessage, - wxICON_INFORMATION, - true - ); - connected_successfully = false; - - } else { - - // %s is the project name - // i.e. 'BOINC', 'GridRepublic' - strDialogMessage.Printf( - _("%s failed to disconnected from the internet."), - wxGetApp().GetBrand()->GetProjectName().c_str() - ); - ShowAlert( - strDialogTitle, - strDialogMessage, - wxICON_ERROR - ); - - } - } - } - } - } else if (!is_dialing && was_dialing) { - wxLogTrace(wxT("Function Status"), wxT("CMainFrame::OnFrameRender - We were dialing and now we are not, detect success or failure of the connection.")); - was_dialing = false; - reset_timers = true; - if (is_online) { - - // %s is the project name - // i.e. 'BOINC', 'GridRepublic' - strDialogMessage.Printf( - _("%s has successfully connected to the internet."), - wxGetApp().GetBrand()->GetProjectName().c_str() - ); - ShowAlert( - strDialogTitle, - strDialogMessage, - wxICON_INFORMATION, - true - ); - connected_successfully = true; - - } else { - - // %s is the project name - // i.e. 'BOINC', 'GridRepublic' - strDialogMessage.Printf( - _("%s failed to connect to the internet."), - wxGetApp().GetBrand()->GetProjectName().c_str() - ); - ShowAlert( - strDialogTitle, - strDialogMessage, - wxICON_ERROR, - true - ); - connected_successfully = false; - - } - } else if (is_dialing && !was_dialing) { - wxLogTrace(wxT("Function Status"), wxT("CMainFrame::OnFrameRender - We are now dialing, where before we were not.")); - was_dialing = true; - } - } + if (m_pDialupManager) { + m_pDialupManager->poll(); } } #endif diff --git a/clientgui/MainFrame.h b/clientgui/MainFrame.h index fb7efe76a4..302ffe0559 100644 --- a/clientgui/MainFrame.h +++ b/clientgui/MainFrame.h @@ -46,6 +46,8 @@ private: }; +class CBOINCDialUpManager; + class CMainFrameEvent; class CMainFrameAlertEvent; @@ -105,6 +107,10 @@ public: void FireRefreshView(); void FireConnect(); + int GetReminderFrequency() { return m_iReminderFrequency; } + wxString GetDialupConnectionName() { return m_strNetworkDialupConnectionName; } + bool GetDialupPromptForCredentials() { return m_bNetworkDialupPromptCredentials; } + void ShowConnectionBadPasswordAlert(); void ShowConnectionFailedAlert(); void ShowNotCurrentlyConnectedAlert(); @@ -135,7 +141,7 @@ private: #ifdef __WXMSW__ wxDynamicLibrary m_WININET; wxDynamicLibrary m_RASAPI32; - wxDialUpManager* m_pDialupManager; + CBOINCDialUpManager* m_pDialupManager; #endif wxString m_strBaseTitle; diff --git a/clientgui/ViewProjects.cpp b/clientgui/ViewProjects.cpp index df57af4e49..f815dba959 100644 --- a/clientgui/ViewProjects.cpp +++ b/clientgui/ViewProjects.cpp @@ -150,8 +150,8 @@ CViewProjects::CViewProjects(wxNotebook* pNotebook) : m_pListPane->InsertColumn(COLUMN_PROJECT, _("Project"), wxLIST_FORMAT_LEFT, 150); m_pListPane->InsertColumn(COLUMN_ACCOUNTNAME, _("Account"), wxLIST_FORMAT_LEFT, 80); m_pListPane->InsertColumn(COLUMN_TEAMNAME, _("Team"), wxLIST_FORMAT_LEFT, 80); - m_pListPane->InsertColumn(COLUMN_TOTALCREDIT, _("Total credit"), wxLIST_FORMAT_RIGHT, 80); - m_pListPane->InsertColumn(COLUMN_AVGCREDIT, _("Avg. credit"), wxLIST_FORMAT_RIGHT, 80); + m_pListPane->InsertColumn(COLUMN_TOTALCREDIT, _("Work done"), wxLIST_FORMAT_RIGHT, 80); + m_pListPane->InsertColumn(COLUMN_AVGCREDIT, _("Avg. work done"), wxLIST_FORMAT_RIGHT, 80); m_pListPane->InsertColumn(COLUMN_RESOURCESHARE, _("Resource share"), wxLIST_FORMAT_CENTRE, 85); m_pListPane->InsertColumn(COLUMN_STATUS, _("Status"), wxLIST_FORMAT_LEFT, 150); diff --git a/win_build/boincmgr_curl.vcproj b/win_build/boincmgr_curl.vcproj index a38b5c6bd6..da11bba5dd 100644 --- a/win_build/boincmgr_curl.vcproj +++ b/win_build/boincmgr_curl.vcproj @@ -147,6 +147,9 @@ Name="Source Files" Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"> + + @@ -226,6 +229,9 @@ + + diff --git a/win_build/installerv2/BOINC.ism b/win_build/installerv2/BOINC.ism index 6b1f6851cb1d03c9da5c954a91a959952b9d3c4f..d5a732fe542261d90f8bf8010cf982e64fadada0 100644 GIT binary patch delta 390 zcmZoT!qaesXG0DP8$*SGyPd}7B9=Z$=8|HCO>%!37b%!9ySsR93i->tDI!2Xt=iDp z)!4w%(Mi|L)Y4Vg#N5eT*TTruP1oGb)!5P4#K6+n(WQ2CSVk8+b5g3prh>oBlONu|Da6^{&Fr_#ll>cnzCu#U+G1s zSeO-Z5;vU#GG76i$*G&({gq$F$H>AQ>Jzd}h!My!0&-Fn3bvUs{uSQl#mG^~wStMC zLy&`)V<+!+p~H+`(o83Kx5wRMTx7^xlA5wjfax#$G6^Oo=ERcJZBk5snU~2iX#h<~ z-R8#hSAAI?6U%hIMkcB0eYs5R+vSRw?#nNm#Kgj!Q>n0R8q;6>WygRD98WRHO<#M8 ziD!D>X(q|-4yTwL71&JmjP(r7w>Q3G5@wW5%FoP8j)w@vmuKdsCeA0Su)CQSNzU&Ukd;r9fW-V delta 459 zcmV;+0W|)A#0-GM46tkj24HKLkP{}eas-YUvjZOe0Rl%vv;Q9fG_wO#{R0AGWwZZR zQ4j_-E;BAMHnVnUiU*hN4FLy}2Xq;;191HV15!^?vmkWf5glT0X>Ma*H7+wQF*aX! zX>Me1cXMB9ZggdAcsMqqh6)38b0D&ipb7y7v!R*`1Opua0kf~3Q3109p#2F0c4cIu zsssTpm!IhZ7_%I%00R*=L5&``m17#p^rZNEpw*xi-{SyOpWn{KW0SI{t$PEt&5eN+kr~bJUfuzsF}DK{0{sU9VRX0u7XkqS3?NQrcOXV@Y-D9}e3S8C7`G=H0@(ut zWgumy9s(%014aV BntA{L