- manager: add GPU always/auto/never menu items

svn path=/trunk/boinc/; revision=19866
This commit is contained in:
David Anderson 2009-12-11 23:24:17 +00:00
parent 8520644cf0
commit 640d3d780d
5 changed files with 106 additions and 33 deletions

View File

@ -9942,3 +9942,12 @@ David 11 Dec 2009
sched/
sched_customize.cpp,h
sched_types.h
David 11 Dec 2009
- manager: add GPU always/auto/never menu items
clientgui
AdvancedFrame.cpp,h
Events.h
lib/
daemonmgt.h

View File

@ -166,6 +166,7 @@ BEGIN_EVENT_TABLE (CAdvancedFrame, CBOINCBaseFrame)
EVT_MENU(ID_WIZARDDETACH, CAdvancedFrame::OnWizardDetach)
// Activity
EVT_MENU_RANGE(ID_ADVACTIVITYRUNALWAYS, ID_ADVACTIVITYSUSPEND, CAdvancedFrame::OnActivitySelection)
EVT_MENU_RANGE(ID_ADVACTIVITYGPUALWAYS, ID_ADVACTIVITYGPUSUSPEND, CAdvancedFrame::OnGPUSelection)
EVT_MENU_RANGE(ID_ADVNETWORKRUNALWAYS, ID_ADVNETWORKSUSPEND, CAdvancedFrame::OnNetworkSelection)
// Advanced
EVT_MENU(ID_OPTIONS, CAdvancedFrame::OnOptions)
@ -446,6 +447,25 @@ bool CAdvancedFrame::CreateMenu( bool bRPCsSafe ) {
_("&Suspend"),
_("Stop work regardless of preferences")
);
if (pDoc->state.have_cuda || pDoc->state.have_ati) {
menuActivity->AppendSeparator();
menuActivity->AppendRadioItem(
ID_ADVACTIVITYGPUALWAYS,
_("Use GPU always"),
_("Allow GPU work regardless of preferences")
);
menuActivity->AppendRadioItem(
ID_ADVACTIVITYGPUBASEDONPREPERENCES,
_("Use GPU based on &preferences"),
_("Allow GPU work according to your preferences")
);
menuActivity->AppendRadioItem(
ID_ADVACTIVITYGPUSUSPEND,
_("Use GPU never"),
_("Stop GPU work regardless of preferences")
);
}
#if defined(__WXMSW__) || defined(__WXMAC__)
menuActivity->AppendSeparator();
@ -1153,6 +1173,25 @@ void CAdvancedFrame::OnActivitySelection(wxCommandEvent& event) {
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnActivitySelection - Function End"));
}
void CAdvancedFrame::OnGPUSelection(wxCommandEvent& event) {
CMainDocument* pDoc = wxGetApp().GetDocument();
wxASSERT(pDoc);
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
switch(event.GetId()) {
case ID_ADVACTIVITYGPUALWAYS:
pDoc->SetGPURunMode(RUN_MODE_ALWAYS, 0);
break;
case ID_ADVACTIVITYGPUSUSPEND:
pDoc->SetGPURunMode(RUN_MODE_NEVER, 0);
break;
case ID_ADVACTIVITYGPUBASEDONPREPERENCES:
pDoc->SetGPURunMode(RUN_MODE_AUTO, 0);
break;
}
}
void CAdvancedFrame::OnNetworkSelection(wxCommandEvent& event) {
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnNetworkSelection - Function Begin"));
@ -1779,6 +1818,7 @@ void CAdvancedFrame::OnFrameRender(wxTimerEvent& WXUNUSED(event)) {
CC_STATUS status;
if ((pDoc->IsConnected()) && (0 == pDoc->GetCoreClientStatus(status))) {
UpdateActivityModeControls(status);
UpdateGPUModeControls(status);
UpdateNetworkModeControls(status);
if (status.disallow_attach) {
@ -1911,6 +1951,26 @@ void CAdvancedFrame::UpdateActivityModeControls( CC_STATUS& status ) {
pMenuBar->Check(ID_ADVACTIVITYRUNBASEDONPREPERENCES, true);
}
void CAdvancedFrame::UpdateGPUModeControls( CC_STATUS& status ) {
wxMenuBar* pMenuBar = GetMenuBar();
wxASSERT(pMenuBar);
wxASSERT(wxDynamicCast(pMenuBar, wxMenuBar));
if ((RUN_MODE_ALWAYS == status.gpu_mode) && pMenuBar->IsChecked(ID_ADVACTIVITYGPUALWAYS)) return;
if ((RUN_MODE_NEVER == status.gpu_mode) && pMenuBar->IsChecked(ID_ADVACTIVITYGPUSUSPEND)) return;
if ((RUN_MODE_AUTO == status.gpu_mode) && pMenuBar->IsChecked(ID_ADVACTIVITYGPUBASEDONPREPERENCES)) return;
pMenuBar->Check(ID_ADVACTIVITYGPUALWAYS, false);
pMenuBar->Check(ID_ADVACTIVITYGPUSUSPEND, false);
pMenuBar->Check(ID_ADVACTIVITYGPUBASEDONPREPERENCES, false);
if (RUN_MODE_ALWAYS == status.gpu_mode)
pMenuBar->Check(ID_ADVACTIVITYGPUALWAYS, true);
if (RUN_MODE_NEVER == status.gpu_mode)
pMenuBar->Check(ID_ADVACTIVITYGPUSUSPEND, true);
if (RUN_MODE_AUTO == status.gpu_mode)
pMenuBar->Check(ID_ADVACTIVITYGPUBASEDONPREPERENCES, true);
}
void CAdvancedFrame::UpdateNetworkModeControls( CC_STATUS& status ) {
wxMenuBar* pMenuBar = GetMenuBar();

View File

@ -76,6 +76,7 @@ public:
void OnWizardDetach( wxCommandEvent& event );
void OnActivitySelection( wxCommandEvent& event );
void OnGPUSelection( wxCommandEvent& event );
void OnNetworkSelection( wxCommandEvent& event );
void OnOptions( wxCommandEvent& event );
@ -139,6 +140,7 @@ private:
void SaveWindowDimensions();
void UpdateActivityModeControls( CC_STATUS& status );
void UpdateGPUModeControls( CC_STATUS& status );
void UpdateNetworkModeControls( CC_STATUS& status );
void UpdateRefreshTimerInterval( wxInt32 iCurrentNotebookPage );

View File

@ -70,6 +70,9 @@
#define ID_ADVNETWORKRUNALWAYS 6014
#define ID_ADVNETWORKRUNBASEDONPREPERENCES 6015
#define ID_ADVNETWORKSUSPEND 6016
#define ID_ADVACTIVITYGPUALWAYS 6017
#define ID_ADVACTIVITYGPUBASEDONPREPERENCES 6018
#define ID_ADVACTIVITYGPUSUSPEND 6019
// Advanced Menu
#define ID_OPTIONS 6017

View File

@ -1,33 +1,32 @@
// This file is part of BOINC.
// http://boinc.berkeley.edu
// Copyright (C) 2008 University of California
//
// BOINC 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 3 of the License, or (at your option) any later version.
//
// BOINC 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.
//
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
#ifndef _BOINC_DAEMONMANAGEMENT_H_
#define _BOINC_DAEMONMANAGEMENT_H_
extern bool is_daemon_installed();
extern bool is_daemon_starting();
extern bool is_daemon_running();
extern bool is_daemon_stopping();
extern bool is_daemon_stopped();
extern bool start_daemon_via_daemonctrl();
extern bool start_daemon();
extern bool stop_daemon_via_daemonctrl();
extern bool stop_daemon();
#endif
// This file is part of BOINC.
// http://boinc.berkeley.edu
// Copyright (C) 2008 University of California
//
// BOINC 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 3 of the License, or (at your option) any later version.
//
// BOINC 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.
//
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
#ifndef _BOINC_DAEMONMANAGEMENT_H_
#define _BOINC_DAEMONMANAGEMENT_H_
extern bool is_daemon_installed();
extern bool is_daemon_starting();
extern bool is_daemon_running();
extern bool is_daemon_stopping();
extern bool is_daemon_stopped();
extern bool start_daemon_via_daemonctrl();
extern bool start_daemon();
extern bool stop_daemon_via_daemonctrl();
extern bool stop_daemon();
#endif