diff --git a/checkin_notes b/checkin_notes
index 16478c48e2..a9c432c161 100644
--- a/checkin_notes
+++ b/checkin_notes
@@ -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
diff --git a/client/client_types.cpp b/client/client_types.cpp
index 8f70c2b88e..dc517f6277 100644
--- a/client/client_types.cpp
+++ b/client/client_types.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;
diff --git a/client/client_types.h b/client/client_types.h
index a90a6c8268..7282df37a4 100644
--- a/client/client_types.h
+++ b/client/client_types.h
@@ -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();
};
diff --git a/client/cs_statefile.cpp b/client/cs_statefile.cpp
index 8b47828a07..8e4149945b 100644
--- a/client/cs_statefile.cpp
+++ b/client/cs_statefile.cpp
@@ -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) {
"%d\n"
"%d\n"
"%d\n"
+ "%d\n"
"%d\n"
+ "%d\n"
"%d\n"
"%s"
"%f\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?"\n":"",
new_version_check_time,
diff --git a/clientgui/BOINCTaskBar.cpp b/clientgui/BOINCTaskBar.cpp
index c7e513544e..271b701137 100644
--- a/clientgui/BOINCTaskBar.cpp
+++ b/clientgui/BOINCTaskBar.cpp
@@ -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);
}
}
}
diff --git a/clientgui/BOINCTaskBar.h b/clientgui/BOINCTaskBar.h
index 637d78b73b..3bd4d33024 100644
--- a/clientgui/BOINCTaskBar.h
+++ b/clientgui/BOINCTaskBar.h
@@ -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()
};
diff --git a/clientgui/mac/MacSysMenu.cpp b/clientgui/mac/MacSysMenu.cpp
index 5c98701783..afe926b548 100644
--- a/clientgui/mac/MacSysMenu.cpp
+++ b/clientgui/mac/MacSysMenu.cpp
@@ -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) )