From 16d5fa497c48b9ccd331498f36251d34c37c4487 Mon Sep 17 00:00:00 2001 From: Rom Walton Date: Tue, 30 Jan 2007 15:50:16 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=11999 --- checkin_notes | 13 +++++++++ clientgui/AdvancedFrame.cpp | 55 +++++++++++++++++++++++++++++++----- clientgui/AdvancedFrame.h | 2 ++ clientgui/BOINCBaseFrame.cpp | 21 ++++++++++---- clientgui/BOINCBaseFrame.h | 2 +- clientgui/MainDocument.cpp | 5 +++- clientgui/MainDocument.h | 1 + 7 files changed, 84 insertions(+), 15 deletions(-) diff --git a/checkin_notes b/checkin_notes index 2be0cfacd5..47f9de599d 100755 --- a/checkin_notes +++ b/checkin_notes @@ -1353,3 +1353,16 @@ David 29 Jan 2007 MainDocument.cpp ViewProjects.cpp ViewProjectsGrid.cpp + +Rom 30 Jan 2007 + - MGR: Give the user a change to abort a core client shutdown when they + select 'shutdown current client'. + - MGR: Special case the authorization error dialog when it is attempting + to use the default password, so that it also informs the user they + need to run the manager from the same directory as the CC. + + clientgui/ + AdvancedFrame.cpp, .h + BOINCBaseFrame.cpp, .h + MainDocument.cpp, .h + \ No newline at end of file diff --git a/clientgui/AdvancedFrame.cpp b/clientgui/AdvancedFrame.cpp index 018c4289ff..8eae52fe65 100644 --- a/clientgui/AdvancedFrame.cpp +++ b/clientgui/AdvancedFrame.cpp @@ -50,6 +50,7 @@ #include "DlgAbout.h" #include "DlgOptions.h" #include "DlgSelectComputer.h" +#include "DlgGenericMessage.h" #include "wizardex.h" #include "BOINCWizards.h" #include "BOINCBaseWizard.h" @@ -207,6 +208,7 @@ CAdvancedFrame::CAdvancedFrame(wxString title, wxIcon* icon) : // Working Variables m_strBaseTitle = title; + m_bDisplayShutdownClientWarning = true; // Initialize Application @@ -742,6 +744,7 @@ bool CAdvancedFrame::SaveState() { pConfig->SetPath(strBaseConfigLocation); pConfig->Write(wxT("CurrentPage"), m_pNotebook->GetSelection()); + pConfig->Write(wxT("DisplayShutdownClientWarning"), m_bDisplayShutdownClientWarning); #ifdef __WXMAC__ @@ -820,7 +823,7 @@ bool CAdvancedFrame::RestoreState() { pConfig->Read(wxT("CurrentPage"), &iCurrentPage, (ID_LIST_WORKVIEW - ID_LIST_BASE)); m_pNotebook->SetSelection(iCurrentPage); } - + pConfig->Read(wxT("DisplayShutdownClientWarning"), &m_bDisplayShutdownClientWarning, true); #ifdef __WXMAC__ RestoreWindowDimensions(); @@ -1063,21 +1066,59 @@ void CAdvancedFrame::OnSelectComputer(wxCommandEvent& WXUNUSED(event)) { void CAdvancedFrame::OnClientShutdown(wxCommandEvent& WXUNUSED(event)) { + wxCommandEvent evtSelectNewComputer(wxEVT_COMMAND_MENU_SELECTED, ID_FILESELECTCOMPUTER); + CMainDocument* pDoc = wxGetApp().GetDocument(); + CSkinAdvanced* pSkinAdvanced = wxGetApp().GetSkinManager()->GetAdvanced(); + CDlgGenericMessage dlg(this); + wxString strDialogTitle = wxEmptyString; + wxString strDialogMessage = wxEmptyString; + wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnClientShutdown - Function Begin")); - CMainDocument* pDoc = wxGetApp().GetDocument(); - wxCommandEvent evtSelectNewComputer(wxEVT_COMMAND_MENU_SELECTED, ID_FILESELECTCOMPUTER); - wxASSERT(pDoc); + wxASSERT(pSkinAdvanced); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); + wxASSERT(wxDynamicCast(pSkinAdvanced, CSkinAdvanced)); + // Stop all timers StopTimers(); - pDoc->CoreClientQuit(); - // Since the core cliet we were connected to just shutdown, prompt for a new one. - ProcessEvent(evtSelectNewComputer); + // %s is the application name + // i.e. 'BOINC Manager', 'GridRepublic Manager' + strDialogTitle.Printf( + _("Shutdown the current client..."), + pSkinAdvanced->GetApplicationName().c_str() + ); + + // 1st %s is the application name + // i.e. 'BOINC Manager', 'GridRepublic Manager' + // 2nd %s is the project name + // i.e. 'BOINC', 'GridRepublic' + strDialogMessage.Printf( + _("%s is going to shutdown the core client it is currently connected to.\n" + "NOTE: Choosing 'OK' will cause the select new computer dialog to appear \n" + "so you can attach to a different core client."), + pSkinAdvanced->GetApplicationName().c_str() + ); + + dlg.SetTitle(strDialogTitle); + dlg.m_DialogMessage->SetLabel(strDialogMessage); + dlg.Fit(); + dlg.Centre(); + + if (wxID_OK == dlg.ShowModal()) { + if (dlg.m_DialogDisableMessage->GetValue()) { + m_bDisplayShutdownClientWarning = false; + } + + pDoc->CoreClientQuit(); + + // Since the core cliet we were connected to just shutdown, prompt for a new one. + ProcessEvent(evtSelectNewComputer); + } + // Restart timers StartTimers(); diff --git a/clientgui/AdvancedFrame.h b/clientgui/AdvancedFrame.h index dd889e0492..f2456b49e5 100644 --- a/clientgui/AdvancedFrame.h +++ b/clientgui/AdvancedFrame.h @@ -104,6 +104,8 @@ private: wxNotebook* m_pNotebook; CStatusBar* m_pStatusbar; + bool m_bDisplayShutdownClientWarning; + wxString m_strBaseTitle; bool CreateMenu(); diff --git a/clientgui/BOINCBaseFrame.cpp b/clientgui/BOINCBaseFrame.cpp index 8cac813fb8..e888fd0010 100644 --- a/clientgui/BOINCBaseFrame.cpp +++ b/clientgui/BOINCBaseFrame.cpp @@ -343,7 +343,7 @@ void CBOINCBaseFrame::FireReloadSkin() { } -void CBOINCBaseFrame::ShowConnectionBadPasswordAlert() { +void CBOINCBaseFrame::ShowConnectionBadPasswordAlert( bool bUsedDefaultPassword ) { CSkinAdvanced* pSkinAdvanced = wxGetApp().GetSkinManager()->GetAdvanced(); wxString strDialogTitle = wxEmptyString; @@ -361,11 +361,20 @@ void CBOINCBaseFrame::ShowConnectionBadPasswordAlert() { pSkinAdvanced->GetApplicationName().c_str() ); - ShowAlert( - strDialogTitle, - _("The password you have provided is incorrect, please try again."), - wxOK | wxICON_ERROR - ); + if ( bUsedDefaultPassword ) { + ShowAlert( + strDialogTitle, + _("Authorization failed connecting to running client.\n" + "Make sure you start this program in the same directory as the client."), + wxOK | wxICON_ERROR + ); + } else { + ShowAlert( + strDialogTitle, + _("The password you have provided is incorrect, please try again."), + wxOK | wxICON_ERROR + ); + } wxLogTrace(wxT("Function Start/End"), wxT("CBOINCBaseFrame::ShowConnectionBadPasswordAlert - Function End")); } diff --git a/clientgui/BOINCBaseFrame.h b/clientgui/BOINCBaseFrame.h index fd3f062cc4..919e8bc920 100644 --- a/clientgui/BOINCBaseFrame.h +++ b/clientgui/BOINCBaseFrame.h @@ -69,7 +69,7 @@ public: void FireRefreshView(); void FireConnect(); void FireReloadSkin(); - void ShowConnectionBadPasswordAlert(); + void ShowConnectionBadPasswordAlert( bool bUsedDefaultPassword ); void ShowConnectionFailedAlert(); void ShowNotCurrentlyConnectedAlert(); diff --git a/clientgui/MainDocument.cpp b/clientgui/MainDocument.cpp index 3f8870a4e6..c3b136b60c 100644 --- a/clientgui/MainDocument.cpp +++ b/clientgui/MainDocument.cpp @@ -52,6 +52,7 @@ CNetworkConnection::CNetworkConnection(CMainDocument* pDocument) : m_bForceReconnect = false; m_bReconnectOnError = false; m_bNewConnection = false; + m_bUsedDefaultPassword = false; } @@ -94,6 +95,7 @@ void CNetworkConnection::Poll() { if (m_bUseDefaultPassword) { GetLocalPassword(m_strNewComputerPassword); m_bUseDefaultPassword = FALSE; + m_bUsedDefaultPassword = true; } retval = m_pDocument->rpc.authorize(m_strNewComputerPassword.mb_str()); @@ -107,6 +109,7 @@ void CNetworkConnection::Poll() { wxLogTrace(wxT("Function Status"), wxT("CNetworkConnection::Poll - RPC Authorization Failed '%d'"), retval); SetStateError(); } + m_bUsedDefaultPassword = false; } else if (ERR_RETRY != retval) { wxLogTrace(wxT("Function Status"), wxT("CNetworkConnection::Poll - RPC Connection Failed '%d'"), retval); SetStateError(); @@ -211,7 +214,7 @@ void CNetworkConnection::SetStateErrorAuthentication() { m_bConnectEvent = false; - pFrame->ShowConnectionBadPasswordAlert(); + pFrame->ShowConnectionBadPasswordAlert(m_bUsedDefaultPassword); } } diff --git a/clientgui/MainDocument.h b/clientgui/MainDocument.h index f70420798f..c216a3dcd0 100644 --- a/clientgui/MainDocument.h +++ b/clientgui/MainDocument.h @@ -61,6 +61,7 @@ private: bool m_bConnected; bool m_bReconnecting; bool m_bUseDefaultPassword; + bool m_bUsedDefaultPassword; bool m_bNewConnection; wxString m_strNewComputerName; wxString m_strNewComputerPassword;