- MGR: Provide a way to enable/disable launching from the BOINC Manager

at startup from within the BOINC Manager itself.
    - MGR: Add a command line argument which specifies that the Manager was
        launched by the OS.
    - SCR: Remove the code that checks for the BOINC Manager shortcuts.

    clientgui/
        AdvancedFrame.cpp
        BOINCGUIApp.cpp, .h
        DlgOptions.cpp, .h
        boinc_ss.h
        boinc_ss.rc
        screensaver_win.cpp, .h

svn path=/trunk/boinc/; revision=16406
This commit is contained in:
Rom Walton 2008-11-04 09:33:03 +00:00
parent 050150beb2
commit 59d0152c9b
10 changed files with 66 additions and 181 deletions

View File

@ -9096,3 +9096,18 @@ Rom 4 Nov 2008
SkinManager.cpp
win_build/
boincmgr_curl.vcproj
Rom 4 Nov 2008
- MGR: Provide a way to enable/disable launching from the BOINC Manager
at startup from within the BOINC Manager itself.
- MGR: Add a command line argument which specifies that the Manager was
launched by the OS.
- SCR: Remove the code that checks for the BOINC Manager shortcuts.
clientgui/
AdvancedFrame.cpp
BOINCGUIApp.cpp, .h
DlgOptions.cpp, .h
boinc_ss.h
boinc_ss.rc
screensaver_win.cpp, .h

View File

@ -1495,6 +1495,7 @@ void CAdvancedFrame::OnOptionsOptions(wxCommandEvent& WXUNUSED(event)) {
dlg.m_LanguageSelectionCtrl->SetSelection(m_iSelectedLanguage);
dlg.m_ReminderFrequencyCtrl->SetValue(m_iReminderFrequency);
dlg.m_EnableBOINCManagerAutoStartCtrl->SetValue(!wxGetApp().GetBOINCMGRDisableAutoStart());
#ifdef __WXMSW__
// Connection Tab
@ -1567,6 +1568,7 @@ void CAdvancedFrame::OnOptionsOptions(wxCommandEvent& WXUNUSED(event)) {
m_iSelectedLanguage = dlg.m_LanguageSelectionCtrl->GetSelection();
m_iReminderFrequency = dlg.m_ReminderFrequencyCtrl->GetValue();
wxGetApp().SetBOINCMGRDisableAutoStart(!dlg.m_EnableBOINCManagerAutoStartCtrl->GetValue());
#ifdef __WXMSW__
// Connection Tab

View File

@ -152,6 +152,8 @@ bool CBOINCGUIApp::OnInit() {
m_strDefaultWindowStation = wxEmptyString;
m_strDefaultDesktop = wxEmptyString;
m_strDefaultDisplay = wxEmptyString;
m_bBOINCMGRAutoStarted = false;
m_iBOINCMGRDisableAutoStart = 0;
m_iShutdownCoreClient = 0;
m_iDisplayExitDialog = 1;
m_iGUISelected = BOINC_SIMPLEGUI;
@ -208,6 +210,19 @@ bool CBOINCGUIApp::OnInit() {
m_pConfig->SetPath(wxT("/"));
// Restore Application State
m_pConfig->Read(wxT("AutomaticallyShutdownClient"), &m_iShutdownCoreClient, 1L);
m_pConfig->Read(wxT("DisplayShutdownClientDialog"), &m_iDisplayExitDialog, 1L);
m_pConfig->Read(wxT("DisableAutoStart"), &m_iBOINCMGRDisableAutoStart, 0L);
m_pConfig->Read(wxT("Language"), &iSelectedLanguage, 0L);
m_pConfig->Read(wxT("GUISelection"), &m_iGUISelected, BOINC_SIMPLEGUI);
// Should we abort the BOINC Manager startup process?
if (m_bBOINCMGRAutoStarted && m_iBOINCMGRDisableAutoStart) {
return false;
}
// Detect where BOINC Manager was installed too.
DetectRootDirectory();
@ -326,15 +341,8 @@ bool CBOINCGUIApp::OnInit() {
wxASSERT(m_pSkinManager);
// Restore Application State
m_pConfig->Read(wxT("AutomaticallyShutdownClient"), &m_iShutdownCoreClient, 1L);
m_pConfig->Read(wxT("DisplayShutdownClientDialog"), &m_iDisplayExitDialog, 1L);
m_pConfig->Read(wxT("Language"), &iSelectedLanguage, 0L);
m_pConfig->Read(wxT("Skin"), &strDesiredSkinName, m_pSkinManager->GetDefaultSkinName());
m_pConfig->Read(wxT("GUISelection"), &m_iGUISelected, BOINC_SIMPLEGUI);
// Load desired manager skin
m_pConfig->Read(wxT("Skin"), &strDesiredSkinName, m_pSkinManager->GetDefaultSkinName());
m_pSkinManager->ReloadSkin(
m_pLocale,
strDesiredSkinName
@ -488,6 +496,7 @@ int CBOINCGUIApp::OnExit() {
// Save Application State
m_pConfig->Write(wxT("AutomaticallyShutdownClient"), m_iShutdownCoreClient);
m_pConfig->Write(wxT("DisplayShutdownClientDialog"), m_iDisplayExitDialog);
m_pConfig->Write(wxT("DisableAutoStart"), m_iBOINCMGRDisableAutoStart);
diagnostics_finish();
@ -501,6 +510,7 @@ int CBOINCGUIApp::OnExit() {
void CBOINCGUIApp::OnInitCmdLine(wxCmdLineParser &parser) {
wxApp::OnInitCmdLine(parser);
static const wxCmdLineEntryDesc cmdLineDesc[] = {
{ wxCMD_LINE_SWITCH, wxT("a"), wxT("autostart"), _("BOINC Manager was started by the operating system automatically")},
{ wxCMD_LINE_SWITCH, wxT("s"), wxT("systray"), _("Startup BOINC so only the system tray icon is visible")},
{ wxCMD_LINE_SWITCH, wxT("b"), wxT("boincargs"), _("Startup BOINC with these optional arguments")},
{ wxCMD_LINE_SWITCH, wxT("i"), wxT("insecure"), _("disable BOINC security users and permissions")},
@ -518,6 +528,9 @@ bool CBOINCGUIApp::OnCmdLineParsed(wxCmdLineParser &parser) {
wxApp::OnCmdLineParsed(parser);
parser.Found(wxT("boincargs"), &m_strBOINCArguments);
if (parser.Found(wxT("autostart"))) {
m_bBOINCMGRAutoStarted = true;
}
if (parser.Found(wxT("systray"))) {
m_bGUIVisible = false;
}

View File

@ -88,6 +88,8 @@ protected:
wxString m_strBOINCMGRDataDirectory;
wxString m_strBOINCArguments;
bool m_bBOINCMGRAutoStarted;
int m_iBOINCMGRDisableAutoStart;
int m_iShutdownCoreClient;
int m_iDisplayExitDialog;
@ -130,6 +132,12 @@ public:
CMacSystemMenu* GetMacSystemMenu() { return m_pMacSystemMenu; }
#endif
int GetBOINCMGRDisableAutoStart()
{ return m_iBOINCMGRDisableAutoStart; }
void SetBOINCMGRDisableAutoStart(int iDisableAutoStart)
{ m_iBOINCMGRDisableAutoStart = iDisableAutoStart; }
wxArrayString& GetSupportedLanguages() { return m_astrLanguages; }
void FireReloadSkin();

View File

@ -85,6 +85,7 @@ bool CDlgOptions::Create(wxWindow* parent, wxWindowID id, const wxString& captio
////@begin CDlgOptions member initialisation
m_LanguageSelectionCtrl = NULL;
m_ReminderFrequencyCtrl = NULL;
m_EnableBOINCManagerAutoStartCtrl = NULL;
m_DialupStaticBoxCtrl = NULL;
#if defined(__WXMSW__)
m_DialupConnectionsCtrl = NULL;
@ -149,22 +150,22 @@ void CDlgOptions::CreateControls()
wxBoxSizer* itemBoxSizer5 = new wxBoxSizer(wxVERTICAL);
itemPanel4->SetSizer(itemBoxSizer5);
wxFlexGridSizer* itemFlexGridSizer6 = new wxFlexGridSizer(2, 2, 0, 0);
wxFlexGridSizer* itemFlexGridSizer6 = new wxFlexGridSizer(3, 2, 0, 0);
itemBoxSizer5->Add(itemFlexGridSizer6, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
wxStaticText* itemStaticText7 = new wxStaticText;
itemStaticText7->Create( itemPanel4, wxID_STATIC, _("Language Selection:"), wxDefaultPosition, wxDefaultSize, 0 );
itemFlexGridSizer6->Add(itemStaticText7, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
itemFlexGridSizer6->Add(itemStaticText7, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
wxString* m_LanguageSelectionCtrlStrings = NULL;
m_LanguageSelectionCtrl = new wxComboBox;
m_LanguageSelectionCtrl->Create( itemPanel4, ID_LANGUAGESELECTION, _T(""), wxDefaultPosition, wxDefaultSize, 0, m_LanguageSelectionCtrlStrings, wxCB_READONLY );
if (ShowToolTips())
m_LanguageSelectionCtrl->SetToolTip(_("What language should the manager display by default."));
itemFlexGridSizer6->Add(m_LanguageSelectionCtrl, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
itemFlexGridSizer6->Add(m_LanguageSelectionCtrl, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
wxStaticText* itemStaticText9 = new wxStaticText;
itemStaticText9->Create( itemPanel4, wxID_STATIC, _("Reminder Frequency:"), wxDefaultPosition, wxDefaultSize, 0 );
itemFlexGridSizer6->Add(itemStaticText9, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
itemFlexGridSizer6->Add(itemStaticText9, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
m_ReminderFrequencyCtrl = new wxSlider;
m_ReminderFrequencyCtrl->Create( itemPanel4, ID_REMINDERFREQUENCY, 60, 0, 120, wxDefaultPosition,
@ -176,7 +177,18 @@ void CDlgOptions::CreateControls()
wxSL_HORIZONTAL|wxSL_LABELS);
if (ShowToolTips())
m_ReminderFrequencyCtrl->SetToolTip(_("How often, in minutes, should the manager remind you of possible connection events."));
itemFlexGridSizer6->Add(m_ReminderFrequencyCtrl, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
itemFlexGridSizer6->Add(m_ReminderFrequencyCtrl, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
wxStaticText* itemStaticText10 = new wxStaticText;
itemStaticText10->Create( itemPanel4, wxID_STATIC, _("Run BOINC Manager at startup:"), wxDefaultPosition, wxDefaultSize, 0 );
itemFlexGridSizer6->Add(itemStaticText10, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
m_EnableBOINCManagerAutoStartCtrl = new wxCheckBox;
m_EnableBOINCManagerAutoStartCtrl->Create( itemPanel4, ID_ENABLEAUTOSTART, wxT(""), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE);
if (ShowToolTips())
m_EnableBOINCManagerAutoStartCtrl->SetToolTip(_("Launch BOINC Manager when you log on."));
itemFlexGridSizer6->Add(m_EnableBOINCManagerAutoStartCtrl, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
itemNotebook3->AddPage(itemPanel4, _("General"));

View File

@ -52,6 +52,7 @@
#define ID_GENERAL 10002
#define ID_LANGUAGESELECTION 10004
#define ID_REMINDERFREQUENCY 10018
#define ID_ENABLEAUTOSTART 10031
#define ID_CONNECTONS 10019
#define ID_NETWORKAUTODETECT 10020
#define ID_NETWORKLAN 10021
@ -155,6 +156,7 @@ public:
////@begin CDlgOptions member variables
wxComboBox* m_LanguageSelectionCtrl;
wxSlider* m_ReminderFrequencyCtrl;
wxCheckBox* m_EnableBOINCManagerAutoStartCtrl;
wxStaticBoxSizer* m_DialupStaticBoxCtrl;
wxListBox* m_DialupConnectionsCtrl;
wxButton* m_DialupSetDefaultCtrl;

View File

@ -11,7 +11,6 @@
#define IDC_BLANK_TIME 1001
#define IDS_ERR_GENERIC 2100
#define IDS_ERR_BOINCNOTDETECTED 2101
#define IDS_ERR_BOINCNOTDETECTEDSTARTUP 2102
#define IDS_ERR_BOINCSUSPENDED 2103
#define IDS_ERR_BOINCNOAPPSEXECUTING 2104
#define IDS_ERR_BOINCNOAPPSEXECUTINGNOPROJECTSDETECTED 2105

View File

@ -254,8 +254,6 @@ BEGIN
IDS_ERR_GENERIC "There was an unspecified problem\nwith the GridRepublic screensaver."
IDS_ERR_BOINCNOTDETECTED
"GridRepublic is not running.\n\nPlease launch GridRepublic to display graphics."
IDS_ERR_BOINCNOTDETECTEDSTARTUP
"GridRepublic is not running.\n(Automatic Startup not detected)\n\nWe recommend running GridRepublic at startup;\nplease reinstall GridRepublic and select this option."
IDS_ERR_BOINCSUSPENDED "GridRepublic is currently suspended."
IDS_ERR_BOINCNOAPPSEXECUTING
"GridRepublic is currently idle."
@ -280,8 +278,6 @@ BEGIN
IDS_ERR_GENERIC "There was an unspecified problem\nwith the World Community Grid screensaver."
IDS_ERR_BOINCNOTDETECTED
"World Community Grid is not running.\n\nPlease launch World Community Grid\nto display graphics."
IDS_ERR_BOINCNOTDETECTEDSTARTUP
"World Community Grid is not running.\n(Automatic Startup not detected)\n\nWe recommend running World Community Grid at startup;\nplease reinstall World Community Grid and select this option."
IDS_ERR_BOINCSUSPENDED "World Community Grid is currently suspended."
IDS_ERR_BOINCNOAPPSEXECUTING
"World Community Grid is currently idle."
@ -306,8 +302,6 @@ BEGIN
IDS_ERR_GENERIC "There was an unspecified problem\nwith the BOINC screensaver."
IDS_ERR_BOINCNOTDETECTED
"BOINC is not running.\n\nPlease launch BOINC to display graphics."
IDS_ERR_BOINCNOTDETECTEDSTARTUP
"BOINC is not running.\n(Automatic Startup not detected)\n\nWe recommend running BOINC at startup;\nplease reinstall BOINC and select this option."
IDS_ERR_BOINCSUSPENDED "BOINC is currently suspended."
IDS_ERR_BOINCNOAPPSEXECUTING
"BOINC is currently idle."
@ -333,34 +327,6 @@ BEGIN
IDS_ERR_NOPREVIEW "No preview available"
END
#if defined(_GRIDREPUBLIC)
STRINGTABLE
BEGIN
IDS_DESCRIPTION "GridRepublic"
IDS_SHORTCUTNAME "GridRepublic Manager.lnk"
END
#elif defined(_WCG)
STRINGTABLE
BEGIN
IDS_DESCRIPTION "World Community Grid"
IDS_SHORTCUTNAME "World Community Grid Manager.lnk"
END
#else
STRINGTABLE
BEGIN
IDS_DESCRIPTION "BOINC"
IDS_SHORTCUTNAME "BOINC Manager.lnk"
END
#endif
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////

View File

@ -188,8 +188,6 @@ CScreensaver::CScreensaver() {
m_hGraphicsApplication = NULL;
m_bResetCoreState = TRUE;
m_QuitDataManagementProc = FALSE;
m_bBOINCConfigChecked = FALSE;
m_bBOINCStartupConfigured = FALSE;
memset(&m_running_result, 0, sizeof(m_running_result));
ZeroMemory(m_Monitors, sizeof(m_Monitors));
@ -668,121 +666,6 @@ int CScreensaver::UtilGetRegStartupStr(LPCTSTR name, LPTSTR str) {
// Determine if BOINC is configured to automatically start at logon/startup.
//
BOOL CScreensaver::IsConfigStartupBOINC() {
BOOL bRetVal;
BOOL bCheckFileExists;
TCHAR szBuffer[MAX_PATH];
TCHAR szShortcutBuffer[MAX_PATH];
HANDLE hFileHandle;
HMODULE hShell32;
MYSHGETFOLDERPATH pfnMySHGetFolderPath = NULL;
// Lets set the default value to FALSE
bRetVal = FALSE;
// Load the shortcut filename into the shortcut buffer.
LoadString(NULL, IDS_SHORTCUTNAME, szShortcutBuffer, sizeof(szShortcutBuffer)/sizeof(TCHAR));
// Attempt to link to dynamic function if it exists
hShell32 = LoadLibrary(_T("SHELL32.DLL"));
if (NULL != hShell32)
pfnMySHGetFolderPath = (MYSHGETFOLDERPATH) GetProcAddress(hShell32, _T("SHGetFolderPathA"));
// Now lets begin looking in the registry
if (ERROR_SUCCESS == UtilGetRegStartupStr(REG_STARTUP_NAME, szBuffer)) {
bRetVal = TRUE;
} else {
// It could be in the global startup group
ZeroMemory(szBuffer, sizeof(szBuffer));
bCheckFileExists = FALSE;
if (NULL != pfnMySHGetFolderPath) {
if (SUCCEEDED((pfnMySHGetFolderPath)(NULL, CSIDL_STARTUP|CSIDL_FLAG_CREATE, NULL, SHGFP_TYPE_CURRENT, szBuffer))) {
BOINCTRACE(_T("CScreensaver::IsConfigStartupBOINC: pfnMySHGetFolderPath - CSIDL_STARTUP - '%s'\n"), szBuffer);
StringCchCatN(szBuffer, sizeof(szBuffer), _T("\\"), sizeof(_T("\\"))/sizeof(TCHAR));
if (SUCCEEDED(StringCchCatN(szBuffer, sizeof(szBuffer), szShortcutBuffer, sizeof(szShortcutBuffer)/sizeof(TCHAR)))) {
BOINCTRACE(_T("CScreensaver::IsConfigStartupBOINC: Final pfnMySHGetFolderPath - CSIDL_STARTUP - '%s'\n"), szBuffer);
bCheckFileExists = TRUE;
} else {
BOINCTRACE(_T("CScreensaver::IsConfigStartupBOINC: FAILED pfnMySHGetFolderPath - CSIDL_STARTUP Append Operation\n"));
}
} else {
BOINCTRACE(_T("CScreensaver::IsConfigStartupBOINC: FAILED pfnMySHGetFolderPath - CSIDL_STARTUP\n"));
}
}
if (bCheckFileExists) {
hFileHandle = CreateFile(
szBuffer,
GENERIC_READ,
FILE_SHARE_READ,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
NULL);
if (INVALID_HANDLE_VALUE != hFileHandle) {
BOINCTRACE(_T("CScreensaver::IsConfigStartupBOINC: CreateFile returned a valid handle '%d'\n"), hFileHandle);
CloseHandle(hFileHandle);
bRetVal = TRUE;
} else {
BOINCTRACE(_T("CScreensaver::IsConfigStartupBOINC: CreateFile returned INVALID_HANDLE_VALUE - GetLastError() '%d'\n"), GetLastError());
// It could be in the global startup group
ZeroMemory(szBuffer, sizeof(szBuffer));
bCheckFileExists = FALSE;
if (NULL != pfnMySHGetFolderPath) {
if (SUCCEEDED((pfnMySHGetFolderPath)(NULL, CSIDL_COMMON_STARTUP|CSIDL_FLAG_CREATE, NULL, SHGFP_TYPE_CURRENT, szBuffer))) {
BOINCTRACE(_T("CScreensaver::IsConfigStartupBOINC: pfnMySHGetFolderPath - CSIDL_COMMON_STARTUP - '%s'\n"), szBuffer);
StringCchCatN(szBuffer, sizeof(szBuffer), _T("\\"), sizeof(_T("\\"))/sizeof(TCHAR));
if (SUCCEEDED(StringCchCatN(szBuffer, sizeof(szBuffer), szShortcutBuffer, sizeof(szShortcutBuffer)/sizeof(TCHAR)))) {
BOINCTRACE(_T("CScreensaver::IsConfigStartupBOINC: Final pfnMySHGetFolderPath - CSIDL_COMMON_STARTUP - '%s'\n"), szBuffer);
bCheckFileExists = TRUE;
} else {
BOINCTRACE(_T("CScreensaver::IsConfigStartupBOINC: FAILED pfnMySHGetFolderPath - CSIDL_COMMON_STARTUP Append Operation\n"));
}
} else {
BOINCTRACE(_T("CScreensaver::IsConfigStartupBOINC: FAILED pfnMySHGetFolderPath - CSIDL_COMMON_STARTUP\n"));
}
}
if (bCheckFileExists) {
hFileHandle = CreateFile(
szBuffer,
GENERIC_READ,
FILE_SHARE_READ,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
NULL);
if (INVALID_HANDLE_VALUE != hFileHandle) {
BOINCTRACE(_T("CScreensaver::IsConfigStartupBOINC: CreateFile returned a valid handle '%d'\n"), hFileHandle);
CloseHandle(hFileHandle);
bRetVal = TRUE;
} else {
BOINCTRACE(_T("CScreensaver::IsConfigStartupBOINC: CreateFile returned INVALID_HANDLE_VALUE - GetLastError() '%d'\n"), GetLastError());
}
}
}
}
}
// Free the dynamically linked to library
FreeLibrary(hShell32);
BOINCTRACE(_T("CScreensaver::IsConfigStartupBOINC: Returning '%d'\n"), bRetVal);
return bRetVal;
}
// Desc: Create the infrastructure for thread safe acccess to the infrastructure
// layer of the screen saver.
//
@ -1059,19 +942,9 @@ void CScreensaver::HandleRPCError()
rpc->init(NULL);
m_bResetCoreState = TRUE;
if (!m_bBOINCConfigChecked) {
m_bBOINCConfigChecked = TRUE;
m_bBOINCStartupConfigured = IsConfigStartupBOINC();
}
if ((time(0) - m_tThreadCreateTime) > 3) {
if (m_bBOINCStartupConfigured) {
SetError(TRUE, SCRAPPERR_BOINCNOTDETECTED);
} else {
SetError(TRUE, SCRAPPERR_BOINCNOTDETECTEDSTARTUP);
}
SetError(TRUE, SCRAPPERR_BOINCNOTDETECTED);
}
}

View File

@ -127,8 +127,6 @@ protected:
int UtilSetRegKey(LPCTSTR name, DWORD value);
int UtilGetRegStartupStr(LPCTSTR name, LPTSTR str);
BOOL IsConfigStartupBOINC();
BOOL CreateInfrastructureMutexes();
BOOL GetError( BOOL& bErrorMode, HRESULT& hrError, TCHAR* pszError, size_t iErrorSize );
@ -142,9 +140,6 @@ protected:
BOOL m_bErrorMode; // Whether to display an error
HRESULT m_hrError; // Error code to display
TCHAR m_szError[400]; // Error message text
BOOL m_bBOINCConfigChecked;
BOOL m_bBOINCStartupConfigured;
DWORD m_dwBlankScreen;
DWORD m_dwBlankTime;