mirror of https://github.com/BOINC/boinc.git
MGR: If CPU or GPU is suspended from Activity Menu, change "Snooze" to "Resume" in system tray menu; client: always remember previous CPU and GPU activity settings
svn path=/trunk/boinc/; revision=25160
This commit is contained in:
parent
affb960712
commit
4120c8d505
|
@ -1072,3 +1072,16 @@ Charlie 26 Jan 2012
|
|||
|
||||
mac_build/
|
||||
HowToBuildBOINC_XCode.rtf
|
||||
|
||||
Charlie 27 Jan 2012
|
||||
- MGR: If CPU or GPU is suspended from Activity Menu, change "Snooze" item
|
||||
to "Resume" in system tray menu.
|
||||
- client: Always remember previous CPU and GPU activity settings.
|
||||
|
||||
client/
|
||||
client_types.cpp,h
|
||||
cs_statefile.cpp
|
||||
clientgui/
|
||||
BOINCTaskBar.cpp,.h
|
||||
mac/
|
||||
macSysMenu.cpp
|
||||
|
|
|
@ -2192,15 +2192,21 @@ void RESULT::abort_inactive(int status) {
|
|||
RUN_MODE::RUN_MODE() {
|
||||
perm_mode = 0;
|
||||
temp_mode = 0;
|
||||
prev_mode = 0;
|
||||
temp_timeout = 0;
|
||||
}
|
||||
|
||||
void RUN_MODE::set(int mode, double duration) {
|
||||
if (mode == 0) mode = RUN_MODE_AUTO;
|
||||
if (mode == RUN_MODE_RESTORE) {
|
||||
temp_timeout = 0;
|
||||
if (temp_mode == perm_mode) {
|
||||
perm_mode = prev_mode;
|
||||
}
|
||||
temp_mode = perm_mode;
|
||||
return;
|
||||
}
|
||||
prev_mode = temp_mode;
|
||||
if (duration) {
|
||||
temp_mode = mode;
|
||||
temp_timeout = gstate.now + duration;
|
||||
|
@ -2210,12 +2216,23 @@ void RUN_MODE::set(int mode, double duration) {
|
|||
perm_mode = mode;
|
||||
gstate.set_client_state_dirty("Set mode");
|
||||
}
|
||||
|
||||
// In case we read older state file with no prev_mode
|
||||
if (prev_mode == 0) prev_mode = temp_mode;
|
||||
}
|
||||
|
||||
void RUN_MODE::set_prev(int mode) {
|
||||
prev_mode = mode;
|
||||
}
|
||||
|
||||
int RUN_MODE::get_perm() {
|
||||
return perm_mode;
|
||||
}
|
||||
|
||||
int RUN_MODE::get_prev() {
|
||||
return prev_mode;
|
||||
}
|
||||
|
||||
int RUN_MODE::get_current() {
|
||||
if (temp_timeout > gstate.now) {
|
||||
return temp_mode;
|
||||
|
|
|
@ -816,10 +816,13 @@ struct RESULT {
|
|||
struct RUN_MODE {
|
||||
int perm_mode;
|
||||
int temp_mode;
|
||||
int prev_mode;
|
||||
double temp_timeout;
|
||||
RUN_MODE();
|
||||
void set(int mode, double duration);
|
||||
void set_prev(int mode);
|
||||
int get_perm();
|
||||
int get_prev();
|
||||
int get_current();
|
||||
double delay();
|
||||
};
|
||||
|
|
|
@ -446,10 +446,18 @@ int CLIENT_STATE::parse_state_file_aux(const char* fname) {
|
|||
cpu_run_mode.set(retval, 0);
|
||||
continue;
|
||||
}
|
||||
if (xp.parse_int("user_run_prev_request", retval)) {
|
||||
cpu_run_mode.set_prev(retval);
|
||||
continue;
|
||||
}
|
||||
if (xp.parse_int("user_gpu_request", retval)) {
|
||||
gpu_run_mode.set(retval, 0);
|
||||
continue;
|
||||
}
|
||||
if (xp.parse_int("user_gpu_prev_request", retval)) {
|
||||
gpu_run_mode.set_prev(retval);
|
||||
continue;
|
||||
}
|
||||
if (xp.parse_int("user_network_request", retval)) {
|
||||
network_run_mode.set(retval, 0);
|
||||
continue;
|
||||
|
@ -721,7 +729,9 @@ int CLIENT_STATE::write_state(MIOFILE& f) {
|
|||
"<core_client_minor_version>%d</core_client_minor_version>\n"
|
||||
"<core_client_release>%d</core_client_release>\n"
|
||||
"<user_run_request>%d</user_run_request>\n"
|
||||
"<user_run_prev_request>%d</user_run_prev_request>\n"
|
||||
"<user_gpu_request>%d</user_gpu_request>\n"
|
||||
"<user_gpu_prev_request>%d</user_gpu_prev_request>\n"
|
||||
"<user_network_request>%d</user_network_request>\n"
|
||||
"%s"
|
||||
"<new_version_check_time>%f</new_version_check_time>\n"
|
||||
|
@ -731,7 +741,9 @@ int CLIENT_STATE::write_state(MIOFILE& f) {
|
|||
core_client_version.minor,
|
||||
core_client_version.release,
|
||||
cpu_run_mode.get_perm(),
|
||||
cpu_run_mode.get_prev(),
|
||||
gpu_run_mode.get_perm(),
|
||||
gpu_run_mode.get_prev(),
|
||||
network_run_mode.get_perm(),
|
||||
cpu_benchmarks_pending?"<cpu_benchmarks_pending/>\n":"",
|
||||
new_version_check_time,
|
||||
|
|
|
@ -92,6 +92,7 @@ CTaskBarIcon::CTaskBarIcon(wxString title, wxIcon* icon, wxIcon* iconDisconnecte
|
|||
m_iconTaskBarNormal = *icon;
|
||||
m_iconTaskBarDisconnected = *iconDisconnected;
|
||||
m_iconTaskBarSnooze = *iconSnooze;
|
||||
m_SnoozeGPUMenuItem = NULL;
|
||||
|
||||
m_bTaskbarInitiatedShutdown = false;
|
||||
|
||||
|
@ -217,7 +218,9 @@ void CTaskBarIcon::OnSuspendResume(wxCommandEvent& WXUNUSED(event)) {
|
|||
|
||||
ResetTaskBar();
|
||||
pDoc->GetCoreClientStatus(status);
|
||||
if (status.task_mode_perm != status.task_mode) {
|
||||
if (status.task_mode_perm == RUN_MODE_NEVER) {
|
||||
pDoc->SetActivityRunMode(RUN_MODE_RESTORE, 0);
|
||||
} else if (status.task_mode_perm != status.task_mode) {
|
||||
pDoc->SetActivityRunMode(RUN_MODE_RESTORE, 0);
|
||||
} else {
|
||||
pDoc->SetActivityRunMode(RUN_MODE_NEVER, 3600);
|
||||
|
@ -234,7 +237,9 @@ void CTaskBarIcon::OnSuspendResumeGPU(wxCommandEvent& WXUNUSED(event)) {
|
|||
|
||||
ResetTaskBar();
|
||||
pDoc->GetCoreClientStatus(status);
|
||||
if (status.gpu_mode_perm != status.gpu_mode) {
|
||||
if (status.gpu_mode_perm == RUN_MODE_NEVER) {
|
||||
pDoc->SetGPURunMode(RUN_MODE_RESTORE, 0);
|
||||
} else if (status.gpu_mode_perm != status.gpu_mode) {
|
||||
pDoc->SetGPURunMode(RUN_MODE_RESTORE, 0);
|
||||
} else {
|
||||
pDoc->SetGPURunMode(RUN_MODE_NEVER, 3600);
|
||||
|
@ -496,9 +501,9 @@ wxMenu *CTaskBarIcon::BuildContextMenu() {
|
|||
|
||||
pMenu->AppendSeparator();
|
||||
|
||||
pMenu->AppendCheckItem(ID_TB_SUSPEND, _("Snooze"), wxEmptyString);
|
||||
m_SnoozeMenuItem = pMenu->AppendCheckItem(ID_TB_SUSPEND, _("Snooze"), wxEmptyString);
|
||||
if (pDoc->state.have_nvidia || pDoc->state.have_ati) {
|
||||
pMenu->AppendCheckItem(ID_TB_SUSPEND_GPU, _("Snooze GPU"), wxEmptyString);
|
||||
m_SnoozeGPUMenuItem = pMenu->AppendCheckItem(ID_TB_SUSPEND_GPU, _("Snooze GPU"), wxEmptyString);
|
||||
}
|
||||
|
||||
pMenu->AppendSeparator();
|
||||
|
@ -585,46 +590,55 @@ void CTaskBarIcon::AdjustMenuItems(wxMenu* pMenu) {
|
|||
case RUN_MODE_NEVER:
|
||||
switch (status.task_mode_perm) {
|
||||
case RUN_MODE_NEVER:
|
||||
pMenu->Check(ID_TB_SUSPEND, false);
|
||||
pMenu->Enable(ID_TB_SUSPEND, false);
|
||||
m_SnoozeMenuItem->SetItemLabel(_("Resume"));
|
||||
m_SnoozeMenuItem->Check(false);
|
||||
m_SnoozeMenuItem->Enable(true);
|
||||
break;
|
||||
default:
|
||||
pMenu->Check(ID_TB_SUSPEND, true);
|
||||
m_SnoozeMenuItem->SetItemLabel(_("Snooze"));
|
||||
m_SnoozeMenuItem->Check(true);
|
||||
if (!is_dialog_detected) {
|
||||
pMenu->Enable(ID_TB_SUSPEND, true);
|
||||
m_SnoozeMenuItem->Enable(true);
|
||||
}
|
||||
}
|
||||
if (pDoc->state.have_nvidia || pDoc->state.have_ati) {
|
||||
pMenu->Check(ID_TB_SUSPEND_GPU, false);
|
||||
pMenu->Enable(ID_TB_SUSPEND_GPU, false);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
pMenu->Check(ID_TB_SUSPEND, false);
|
||||
m_SnoozeMenuItem->SetItemLabel(_("Snooze"));
|
||||
m_SnoozeMenuItem->Check(false);
|
||||
if (!is_dialog_detected) {
|
||||
pMenu->Enable(ID_TB_SUSPEND, true);
|
||||
m_SnoozeMenuItem->Enable(true);
|
||||
}
|
||||
if (pDoc->state.have_nvidia || pDoc->state.have_ati) {
|
||||
switch (status.gpu_mode) {
|
||||
}
|
||||
|
||||
if (pDoc->state.have_nvidia || pDoc->state.have_ati) {
|
||||
switch (status.gpu_mode) {
|
||||
case RUN_MODE_NEVER:
|
||||
switch (status.gpu_mode_perm) {
|
||||
case RUN_MODE_NEVER:
|
||||
switch (status.gpu_mode_perm) {
|
||||
case RUN_MODE_NEVER:
|
||||
pMenu->Check(ID_TB_SUSPEND_GPU, false);
|
||||
pMenu->Enable(ID_TB_SUSPEND_GPU, false);
|
||||
break;
|
||||
default:
|
||||
pMenu->Check(ID_TB_SUSPEND_GPU, true);
|
||||
if (!is_dialog_detected) {
|
||||
pMenu->Enable(ID_TB_SUSPEND_GPU, true);
|
||||
}
|
||||
}
|
||||
m_SnoozeGPUMenuItem->SetItemLabel(_("Resume GPU"));
|
||||
m_SnoozeGPUMenuItem->Check(false);
|
||||
m_SnoozeGPUMenuItem->Enable(true);
|
||||
break;
|
||||
default:
|
||||
pMenu->Check(ID_TB_SUSPEND_GPU, false);
|
||||
m_SnoozeGPUMenuItem->SetItemLabel(_("Snooze GPU"));
|
||||
m_SnoozeGPUMenuItem->Check(true);
|
||||
if (!is_dialog_detected) {
|
||||
pMenu->Enable(ID_TB_SUSPEND_GPU, true);
|
||||
m_SnoozeGPUMenuItem->Enable(true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
m_SnoozeGPUMenuItem->SetItemLabel(_("Snooze GPU"));
|
||||
m_SnoozeGPUMenuItem->Check(false);
|
||||
if (!is_dialog_detected) {
|
||||
m_SnoozeGPUMenuItem->Enable(true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (pDoc->state.have_nvidia || pDoc->state.have_ati) {
|
||||
if (status.task_mode == RUN_MODE_NEVER) {
|
||||
m_SnoozeGPUMenuItem->Check(false);
|
||||
m_SnoozeGPUMenuItem->Enable(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,25 +100,27 @@ public:
|
|||
}
|
||||
#endif
|
||||
|
||||
wxIcon m_iconTaskBarNormal;
|
||||
wxIcon m_iconTaskBarDisconnected;
|
||||
wxIcon m_iconTaskBarSnooze;
|
||||
wxIcon m_iconTaskBarNormal;
|
||||
wxIcon m_iconTaskBarDisconnected;
|
||||
wxIcon m_iconTaskBarSnooze;
|
||||
|
||||
wxIcon m_iconCurrentIcon;
|
||||
wxIcon m_iconCurrentIcon;
|
||||
|
||||
bool m_bTaskbarInitiatedShutdown;
|
||||
bool m_bTaskbarInitiatedShutdown;
|
||||
|
||||
private:
|
||||
bool m_bMouseButtonPressed;
|
||||
bool m_bMouseButtonPressed;
|
||||
wxMenuItem* m_SnoozeMenuItem;
|
||||
wxMenuItem* m_SnoozeGPUMenuItem;
|
||||
|
||||
wxDateTime m_dtLastNotificationAlertExecuted;
|
||||
int m_iLastNotificationUnreadMessageCount;
|
||||
wxDateTime m_dtLastNotificationAlertExecuted;
|
||||
int m_iLastNotificationUnreadMessageCount;
|
||||
|
||||
void ResetTaskBar();
|
||||
void DisplayContextMenu();
|
||||
void ResetTaskBar();
|
||||
void DisplayContextMenu();
|
||||
|
||||
void UpdateTaskbarStatus();
|
||||
void UpdateNoticeStatus();
|
||||
void UpdateTaskbarStatus();
|
||||
void UpdateNoticeStatus();
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
|
|
@ -396,6 +396,8 @@ pascal OSStatus SysMenuEventHandler( EventHandlerCallRef inHandlerCallRef,
|
|||
{
|
||||
GetMenuItemCommandID(baseMenuRef, i, &commandID);
|
||||
SetMenuItemCommandID(sysMenuRef, i, commandID);
|
||||
GetMenuItemText(baseMenuRef, i, theMenuTitle);
|
||||
SetMenuItemText(sysMenuRef, i, theMenuTitle);
|
||||
GetItemMark(baseMenuRef, i, &markChar);
|
||||
SetItemMark(sysMenuRef, i, markChar);
|
||||
if( IsMenuItemEnabled(baseMenuRef, i) )
|
||||
|
|
Loading…
Reference in New Issue