2008-08-06 18:36:30 +00:00
|
|
|
// This file is part of BOINC.
|
2005-01-20 23:22:22 +00:00
|
|
|
// http://boinc.berkeley.edu
|
2008-08-06 18:36:30 +00:00
|
|
|
// Copyright (C) 2008 University of California
|
2004-05-17 22:15:10 +00:00
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// 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.
|
2004-04-10 09:11:03 +00:00
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// BOINC is distributed in the hope that it will be useful,
|
2005-01-20 23:22:22 +00:00
|
|
|
// 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.
|
2004-05-17 22:15:10 +00:00
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// You should have received a copy of the GNU Lesser General Public License
|
|
|
|
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
|
2004-04-10 09:11:03 +00:00
|
|
|
|
2004-04-11 04:37:10 +00:00
|
|
|
#if defined(__GNUG__) && !defined(__APPLE__)
|
2006-06-24 05:00:57 +00:00
|
|
|
#pragma implementation "AdvancedFrame.h"
|
2004-04-11 04:37:10 +00:00
|
|
|
#endif
|
|
|
|
|
2006-01-30 13:19:32 +00:00
|
|
|
#ifdef __APPLE__
|
|
|
|
#include "mac/MacGUI.pch"
|
|
|
|
#endif
|
|
|
|
|
2004-04-10 09:11:03 +00:00
|
|
|
#include "stdwx.h"
|
2007-08-03 17:09:46 +00:00
|
|
|
#include "version.h"
|
2006-10-20 15:00:14 +00:00
|
|
|
#include "diagnostics.h"
|
2007-02-21 17:06:11 +00:00
|
|
|
#include "str_util.h"
|
2006-10-20 15:00:14 +00:00
|
|
|
#include "mfile.h"
|
|
|
|
#include "miofile.h"
|
|
|
|
#include "parse.h"
|
2010-10-13 21:02:42 +00:00
|
|
|
#include "util.h"
|
2004-04-10 20:25:27 +00:00
|
|
|
#include "BOINCGUIApp.h"
|
2004-07-13 05:56:03 +00:00
|
|
|
#include "Events.h"
|
2006-10-20 15:00:14 +00:00
|
|
|
#include "SkinManager.h"
|
|
|
|
#include "MainDocument.h"
|
2006-06-23 08:20:08 +00:00
|
|
|
#include "BOINCBaseFrame.h"
|
2004-09-21 01:30:29 +00:00
|
|
|
#include "BOINCBaseView.h"
|
2006-11-10 11:24:12 +00:00
|
|
|
#include "BOINCTaskBar.h"
|
2010-09-23 18:35:06 +00:00
|
|
|
#include "BOINCClientManager.h"
|
2006-02-16 18:26:30 +00:00
|
|
|
#include "BOINCDialupManager.h"
|
2006-10-20 15:00:14 +00:00
|
|
|
#include "AdvancedFrame.h"
|
2010-01-12 18:57:38 +00:00
|
|
|
#include "ViewNotices.h"
|
2007-05-22 16:27:27 +00:00
|
|
|
#include "ViewProjects.h"
|
|
|
|
#include "ViewWork.h"
|
|
|
|
#include "ViewTransfers.h"
|
|
|
|
#include "ViewMessages.h"
|
2005-04-21 06:04:26 +00:00
|
|
|
#include "ViewStatistics.h"
|
|
|
|
#include "ViewResources.h"
|
2004-04-10 20:25:27 +00:00
|
|
|
#include "DlgAbout.h"
|
2006-01-23 11:30:25 +00:00
|
|
|
#include "DlgOptions.h"
|
2007-01-30 15:50:16 +00:00
|
|
|
#include "DlgGenericMessage.h"
|
2009-12-19 00:49:51 +00:00
|
|
|
#include "DlgEventLog.h"
|
2005-10-03 23:14:39 +00:00
|
|
|
#include "wizardex.h"
|
|
|
|
#include "BOINCBaseWizard.h"
|
2010-08-02 16:01:09 +00:00
|
|
|
#include "WizardAttach.h"
|
2007-01-17 18:13:33 +00:00
|
|
|
#include "DlgAdvPreferences.h"
|
2004-04-10 09:11:03 +00:00
|
|
|
|
2004-10-28 07:03:06 +00:00
|
|
|
#include "res/connect.xpm"
|
|
|
|
#include "res/disconnect.xpm"
|
2004-04-10 09:11:03 +00:00
|
|
|
|
2004-04-13 00:33:40 +00:00
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
enum STATUSBARFIELDS {
|
2004-10-28 22:51:38 +00:00
|
|
|
STATUS_TEXT,
|
|
|
|
STATUS_CONNECTION_STATUS
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2005-03-10 05:07:01 +00:00
|
|
|
IMPLEMENT_DYNAMIC_CLASS(CStatusBar, wxStatusBar)
|
|
|
|
|
|
|
|
BEGIN_EVENT_TABLE(CStatusBar, wxStatusBar)
|
|
|
|
EVT_SIZE(CStatusBar::OnSize)
|
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
CStatusBar::CStatusBar() {
|
2005-03-10 05:07:01 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CStatusBar::CStatusBar - Default Constructor Function Begin"));
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CStatusBar::CStatusBar - Default Constructor Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
CStatusBar::CStatusBar(wxWindow *parent) :
|
|
|
|
wxStatusBar(parent, ID_STATUSBAR, wxST_SIZEGRIP, _T("statusBar"))
|
2005-03-10 05:07:01 +00:00
|
|
|
{
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CStatusBar::CStatusBar - Function Begin"));
|
|
|
|
|
2009-03-05 23:10:24 +00:00
|
|
|
const int widths[] = {-1, 300, 20};
|
2005-03-10 05:07:01 +00:00
|
|
|
SetFieldsCount(WXSIZEOF(widths), widths);
|
|
|
|
|
|
|
|
m_pbmpConnected = new wxStaticBitmap(this, -1, wxIcon(connect_xpm));
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(m_pbmpConnected);
|
2005-03-10 05:07:01 +00:00
|
|
|
m_pbmpConnected->Hide();
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
m_ptxtConnected = new wxStaticText(this, -1, _("Connected"), wxPoint(0, 0), wxDefaultSize, wxALIGN_LEFT);
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(m_ptxtConnected);
|
2005-03-10 05:07:01 +00:00
|
|
|
m_ptxtConnected->Hide();
|
|
|
|
|
|
|
|
m_pbmpDisconnect = new wxStaticBitmap(this, -1, wxIcon(disconnect_xpm));
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(m_pbmpDisconnect);
|
2005-03-10 05:07:01 +00:00
|
|
|
m_pbmpDisconnect->Hide();
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
m_ptxtDisconnect = new wxStaticText(this, -1, _("Disconnected"), wxPoint(0, 0), wxDefaultSize, wxALIGN_LEFT);
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(m_ptxtDisconnect);
|
2005-03-10 05:07:01 +00:00
|
|
|
m_ptxtDisconnect->Hide();
|
|
|
|
|
2009-03-05 23:10:24 +00:00
|
|
|
wxSizeEvent evt;
|
|
|
|
AddPendingEvent(evt);
|
|
|
|
|
2005-03-10 05:07:01 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CStatusBar::CStatusBar - Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CStatusBar::~CStatusBar()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
void CStatusBar::OnSize(wxSizeEvent& event) {
|
2005-03-10 05:07:01 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CStatusBar::OnSize - Function Begin"));
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
if (IsShown()) {
|
2005-03-10 05:07:01 +00:00
|
|
|
wxRect rect;
|
|
|
|
wxSize size;
|
|
|
|
|
|
|
|
GetFieldRect(STATUS_CONNECTION_STATUS, rect);
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
if (m_pbmpConnected) {
|
2005-03-10 05:07:01 +00:00
|
|
|
size = m_pbmpConnected->GetSize();
|
|
|
|
m_pbmpConnected->Move(rect.x + 1,
|
|
|
|
rect.y + (rect.height - size.y) / 2);
|
|
|
|
}
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
if (m_ptxtConnected) {
|
2005-03-10 05:07:01 +00:00
|
|
|
m_ptxtConnected->Move((rect.x + size.x) + 2,
|
|
|
|
(rect.y + (rect.height - size.y) / 2) + 1);
|
|
|
|
}
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
if (m_pbmpDisconnect) {
|
2005-03-10 05:07:01 +00:00
|
|
|
size = m_pbmpConnected->GetSize();
|
|
|
|
m_pbmpDisconnect->Move(rect.x + 1,
|
|
|
|
rect.y + (rect.height - size.y) / 2);
|
|
|
|
}
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
if (m_ptxtDisconnect) {
|
2005-03-10 05:07:01 +00:00
|
|
|
m_ptxtDisconnect->Move((rect.x + size.x) + 2,
|
|
|
|
(rect.y + (rect.height - size.y) / 2) + 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
event.Skip();
|
|
|
|
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CStatusBar::OnSize - Function End"));
|
|
|
|
}
|
|
|
|
|
2006-06-24 05:00:57 +00:00
|
|
|
IMPLEMENT_DYNAMIC_CLASS(CAdvancedFrame, CBOINCBaseFrame)
|
|
|
|
|
|
|
|
BEGIN_EVENT_TABLE (CAdvancedFrame, CBOINCBaseFrame)
|
2009-10-14 17:11:57 +00:00
|
|
|
// View
|
2010-01-12 18:57:38 +00:00
|
|
|
EVT_MENU_RANGE(ID_ADVNOTICESVIEW, ID_ADVRESOURCEUSAGEVIEW, CAdvancedFrame::OnChangeView)
|
2009-10-14 17:11:57 +00:00
|
|
|
EVT_MENU(ID_CHANGEGUI, CAdvancedFrame::OnChangeGUI)
|
|
|
|
// Tools
|
|
|
|
EVT_MENU(ID_WIZARDATTACH, CAdvancedFrame::OnWizardAttach)
|
|
|
|
EVT_MENU(ID_WIZARDUPDATE, CAdvancedFrame::OnWizardUpdate)
|
|
|
|
EVT_MENU(ID_WIZARDDETACH, CAdvancedFrame::OnWizardDetach)
|
|
|
|
// Activity
|
|
|
|
EVT_MENU_RANGE(ID_ADVACTIVITYRUNALWAYS, ID_ADVACTIVITYSUSPEND, CAdvancedFrame::OnActivitySelection)
|
2009-12-11 23:24:17 +00:00
|
|
|
EVT_MENU_RANGE(ID_ADVACTIVITYGPUALWAYS, ID_ADVACTIVITYGPUSUSPEND, CAdvancedFrame::OnGPUSelection)
|
2009-10-14 17:11:57 +00:00
|
|
|
EVT_MENU_RANGE(ID_ADVNETWORKRUNALWAYS, ID_ADVNETWORKSUSPEND, CAdvancedFrame::OnNetworkSelection)
|
|
|
|
// Advanced
|
|
|
|
EVT_MENU(ID_OPTIONS, CAdvancedFrame::OnOptions)
|
|
|
|
EVT_MENU(ID_PREFERENCES, CAdvancedFrame::OnPreferences)
|
|
|
|
EVT_MENU(ID_SELECTCOMPUTER, CAdvancedFrame::OnSelectComputer)
|
2007-01-26 16:38:44 +00:00
|
|
|
EVT_MENU(ID_SHUTDOWNCORECLIENT, CAdvancedFrame::OnClientShutdown)
|
2009-10-14 17:11:57 +00:00
|
|
|
EVT_MENU(ID_RUNBENCHMARKS, CAdvancedFrame::OnRunBenchmarks)
|
|
|
|
EVT_MENU(ID_RETRYCOMMUNICATIONS, CAdvancedFrame::OnRetryCommunications)
|
|
|
|
EVT_MENU(ID_READPREFERENCES, CAdvancedFrame::OnReadPreferences)
|
|
|
|
EVT_MENU(ID_READCONFIG, CAdvancedFrame::OnReadConfig)
|
2009-12-19 00:49:51 +00:00
|
|
|
EVT_MENU(ID_EVENTLOG, CAdvancedFrame::OnEventLog)
|
2010-10-06 11:13:07 +00:00
|
|
|
EVT_MENU(ID_LAUNCHNEWINSTANCE, CAdvancedFrame::OnLaunchNewInstance)
|
2009-10-14 17:11:57 +00:00
|
|
|
// Help
|
2007-04-03 13:14:30 +00:00
|
|
|
EVT_MENU(ID_HELPBOINC, CAdvancedFrame::OnHelpBOINC)
|
|
|
|
EVT_MENU(ID_HELPBOINCMANAGER, CAdvancedFrame::OnHelpBOINC)
|
|
|
|
EVT_MENU(ID_HELPBOINCWEBSITE, CAdvancedFrame::OnHelpBOINC)
|
2006-06-24 05:00:57 +00:00
|
|
|
EVT_MENU(wxID_ABOUT, CAdvancedFrame::OnHelpAbout)
|
2009-10-14 17:11:57 +00:00
|
|
|
EVT_HELP(wxID_ANY, CAdvancedFrame::OnHelp)
|
|
|
|
// Custom Events & Timers
|
2006-06-24 05:00:57 +00:00
|
|
|
EVT_FRAME_CONNECT(CAdvancedFrame::OnConnect)
|
2009-12-18 22:44:10 +00:00
|
|
|
EVT_FRAME_NOTIFICATION(CAdvancedFrame::OnNotification)
|
2006-06-24 05:00:57 +00:00
|
|
|
EVT_FRAME_UPDATESTATUS(CAdvancedFrame::OnUpdateStatus)
|
|
|
|
EVT_TIMER(ID_REFRESHSTATETIMER, CAdvancedFrame::OnRefreshState)
|
|
|
|
EVT_TIMER(ID_FRAMERENDERTIMER, CAdvancedFrame::OnFrameRender)
|
|
|
|
EVT_NOTEBOOK_PAGE_CHANGED(ID_FRAMENOTEBOOK, CAdvancedFrame::OnNotebookSelectionChanged)
|
2010-11-12 12:56:29 +00:00
|
|
|
EVT_SIZE(CAdvancedFrame::OnSize)
|
|
|
|
EVT_MOVE(CAdvancedFrame::OnMove)
|
2004-05-21 06:27:15 +00:00
|
|
|
END_EVENT_TABLE ()
|
2004-04-10 09:11:03 +00:00
|
|
|
|
2004-10-23 07:13:18 +00:00
|
|
|
|
2006-06-24 05:00:57 +00:00
|
|
|
CAdvancedFrame::CAdvancedFrame() {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::CAdvancedFrame - Default Constructor Function Begin"));
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::CAdvancedFrame - Default Constructor Function End"));
|
2004-04-10 09:11:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-03-09 18:02:37 +00:00
|
|
|
CAdvancedFrame::CAdvancedFrame(wxString title, wxIcon* icon, wxIcon* icon32, wxPoint position, wxSize size) :
|
|
|
|
CBOINCBaseFrame((wxFrame *)NULL, ID_ADVANCEDFRAME, title, position, size, wxDEFAULT_FRAME_STYLE)
|
2004-04-10 09:11:03 +00:00
|
|
|
{
|
2006-06-24 05:00:57 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::CAdvancedFrame - Function Begin"));
|
2004-12-03 22:06:39 +00:00
|
|
|
|
2004-04-10 09:11:03 +00:00
|
|
|
m_pMenubar = NULL;
|
|
|
|
m_pNotebook = NULL;
|
|
|
|
m_pStatusbar = NULL;
|
2005-06-29 05:21:47 +00:00
|
|
|
|
|
|
|
// Working Variables
|
2005-12-28 12:33:18 +00:00
|
|
|
m_strBaseTitle = title;
|
2004-04-10 09:11:03 +00:00
|
|
|
|
2005-06-29 05:21:47 +00:00
|
|
|
// Initialize Application
|
2008-06-23 17:54:44 +00:00
|
|
|
wxIconBundle icons;
|
|
|
|
icons.AddIcon(*icon);
|
|
|
|
icons.AddIcon(*icon32);
|
|
|
|
SetIcons(icons);
|
2004-04-10 09:11:03 +00:00
|
|
|
|
2007-05-22 16:27:27 +00:00
|
|
|
// Create UI elements
|
2010-01-13 09:30:21 +00:00
|
|
|
wxCHECK_RET(CreateMenu(), _T("Failed to create menu bar."));
|
|
|
|
wxCHECK_RET(CreateNotebook(), _T("Failed to create notebook."));
|
|
|
|
wxCHECK_RET(CreateStatusbar(), _T("Failed to create status bar."));
|
2005-06-28 15:55:59 +00:00
|
|
|
|
2009-03-12 08:02:33 +00:00
|
|
|
RestoreState();
|
2009-03-09 05:00:58 +00:00
|
|
|
|
2005-03-07 23:52:28 +00:00
|
|
|
m_pRefreshStateTimer = new wxTimer(this, ID_REFRESHSTATETIMER);
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(m_pRefreshStateTimer);
|
2009-03-06 05:29:28 +00:00
|
|
|
m_pRefreshStateTimer->Start(300000); // Send event every 5 minutes
|
2005-03-07 23:52:28 +00:00
|
|
|
|
2004-10-28 22:51:38 +00:00
|
|
|
m_pFrameRenderTimer = new wxTimer(this, ID_FRAMERENDERTIMER);
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(m_pFrameRenderTimer);
|
2009-03-09 05:00:58 +00:00
|
|
|
m_pFrameRenderTimer->Start(1000); // Send event every 1 second
|
2004-05-21 06:27:15 +00:00
|
|
|
|
2006-06-24 05:00:57 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::CAdvancedFrame - Function End"));
|
2004-04-10 09:11:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-06-24 05:00:57 +00:00
|
|
|
CAdvancedFrame::~CAdvancedFrame() {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::~CAdvancedFrame - Function Begin"));
|
2004-12-03 20:30:24 +00:00
|
|
|
|
2005-04-10 19:01:23 +00:00
|
|
|
wxASSERT(m_pRefreshStateTimer);
|
|
|
|
wxASSERT(m_pFrameRenderTimer);
|
|
|
|
wxASSERT(m_pMenubar);
|
|
|
|
wxASSERT(m_pNotebook);
|
|
|
|
wxASSERT(m_pStatusbar);
|
2004-05-21 06:27:15 +00:00
|
|
|
|
2009-03-12 08:02:33 +00:00
|
|
|
SaveState();
|
|
|
|
|
2005-03-10 05:07:01 +00:00
|
|
|
if (m_pRefreshStateTimer) {
|
|
|
|
m_pRefreshStateTimer->Stop();
|
|
|
|
delete m_pRefreshStateTimer;
|
2008-02-25 21:01:16 +00:00
|
|
|
m_pRefreshStateTimer = NULL;
|
2005-03-10 05:07:01 +00:00
|
|
|
}
|
2004-05-22 01:36:36 +00:00
|
|
|
|
2004-10-28 22:51:38 +00:00
|
|
|
if (m_pFrameRenderTimer) {
|
|
|
|
m_pFrameRenderTimer->Stop();
|
|
|
|
delete m_pFrameRenderTimer;
|
2008-02-25 21:01:16 +00:00
|
|
|
m_pFrameRenderTimer = NULL;
|
2004-10-28 22:51:38 +00:00
|
|
|
}
|
|
|
|
|
2010-10-06 16:04:22 +00:00
|
|
|
if (m_pStatusbar) {
|
2004-04-10 09:11:03 +00:00
|
|
|
wxCHECK_RET(DeleteStatusbar(), _T("Failed to delete status bar."));
|
2010-10-06 16:04:22 +00:00
|
|
|
}
|
2004-05-21 06:27:15 +00:00
|
|
|
|
2010-10-06 16:04:22 +00:00
|
|
|
if (m_pNotebook) {
|
2004-05-21 06:27:15 +00:00
|
|
|
wxCHECK_RET(DeleteNotebook(), _T("Failed to delete notebook."));
|
2010-10-06 16:04:22 +00:00
|
|
|
}
|
2004-05-21 06:27:15 +00:00
|
|
|
|
2010-10-06 16:04:22 +00:00
|
|
|
if (m_pMenubar) {
|
2004-05-21 06:27:15 +00:00
|
|
|
wxCHECK_RET(DeleteMenu(), _T("Failed to delete menu bar."));
|
2010-10-06 16:04:22 +00:00
|
|
|
}
|
2004-12-03 20:30:24 +00:00
|
|
|
|
2006-06-24 05:00:57 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::~CAdvancedFrame - Function End"));
|
2004-04-10 09:11:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-01-13 09:30:21 +00:00
|
|
|
bool CAdvancedFrame::CreateMenu() {
|
2006-06-24 05:00:57 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::CreateMenu - Function Begin"));
|
2004-12-03 20:30:24 +00:00
|
|
|
|
2006-02-02 12:32:21 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
2006-10-20 15:00:14 +00:00
|
|
|
CSkinAdvanced* pSkinAdvanced = wxGetApp().GetSkinManager()->GetAdvanced();
|
2006-02-02 12:32:21 +00:00
|
|
|
ACCT_MGR_INFO ami;
|
|
|
|
bool is_acct_mgr_detected = false;
|
2010-09-23 18:35:06 +00:00
|
|
|
bool is_boinc_started_by_manager = false;
|
2006-02-02 12:32:21 +00:00
|
|
|
wxString strMenuName;
|
|
|
|
wxString strMenuDescription;
|
|
|
|
|
|
|
|
wxASSERT(pDoc);
|
2006-10-20 15:00:14 +00:00
|
|
|
wxASSERT(pSkinAdvanced);
|
2006-02-02 12:32:21 +00:00
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
2006-10-20 15:00:14 +00:00
|
|
|
wxASSERT(wxDynamicCast(pSkinAdvanced, CSkinAdvanced));
|
2006-02-02 12:32:21 +00:00
|
|
|
|
2009-10-22 19:44:20 +00:00
|
|
|
// Account managers have a different menu arrangement
|
2010-01-13 09:30:21 +00:00
|
|
|
if (pDoc->IsConnected()) {
|
2009-10-14 17:11:57 +00:00
|
|
|
pDoc->rpc.acct_mgr_info(ami);
|
|
|
|
is_acct_mgr_detected = ami.acct_mgr_url.size() ? true : false;
|
|
|
|
}
|
2006-02-02 12:32:21 +00:00
|
|
|
|
2010-09-23 18:35:06 +00:00
|
|
|
if (pDoc->m_pClientManager->WasBOINCStartedByManager()) {
|
|
|
|
is_boinc_started_by_manager = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-04-10 09:11:03 +00:00
|
|
|
// File menu
|
|
|
|
wxMenu *menuFile = new wxMenu;
|
2004-10-24 07:38:38 +00:00
|
|
|
|
2009-10-14 17:11:57 +00:00
|
|
|
// %s is the application name
|
|
|
|
// i.e. 'BOINC Manager', 'GridRepublic Manager'
|
|
|
|
strMenuDescription.Printf(
|
|
|
|
_("Close the %s window"),
|
|
|
|
pSkinAdvanced->GetApplicationName().c_str()
|
|
|
|
);
|
2009-11-26 10:45:29 +00:00
|
|
|
strMenuName = _("&Close Window");
|
|
|
|
strMenuName += wxT("\tCtrl+W");
|
2006-08-28 08:12:39 +00:00
|
|
|
menuFile->Append(
|
2009-10-14 17:11:57 +00:00
|
|
|
ID_CLOSEWINDOW,
|
2009-11-26 10:45:29 +00:00
|
|
|
strMenuName,
|
2009-10-14 17:11:57 +00:00
|
|
|
strMenuDescription
|
2006-08-28 08:12:39 +00:00
|
|
|
);
|
|
|
|
|
2005-12-28 12:33:18 +00:00
|
|
|
// %s is the application name
|
|
|
|
// i.e. 'BOINC Manager', 'GridRepublic Manager'
|
|
|
|
strMenuDescription.Printf(
|
2009-10-14 17:11:57 +00:00
|
|
|
_("Exit %s"),
|
2006-10-20 15:00:14 +00:00
|
|
|
pSkinAdvanced->GetApplicationName().c_str()
|
2005-12-28 12:33:18 +00:00
|
|
|
);
|
2010-09-23 18:35:06 +00:00
|
|
|
if (is_boinc_started_by_manager) {
|
|
|
|
// %s is the application short name
|
|
|
|
// i.e. 'BOINC', 'GridRepublic'
|
|
|
|
strMenuName.Printf(
|
|
|
|
_("Exit %s"),
|
|
|
|
pSkinAdvanced->GetApplicationShortName().c_str()
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
// %s is the application name
|
|
|
|
// i.e. 'BOINC Manager', 'GridRepublic Manager'
|
|
|
|
strMenuName.Printf(
|
|
|
|
_("Exit %s"),
|
|
|
|
pSkinAdvanced->GetApplicationName().c_str()
|
|
|
|
);
|
|
|
|
}
|
2005-09-06 08:58:56 +00:00
|
|
|
menuFile->Append(
|
|
|
|
wxID_EXIT,
|
2010-09-23 18:35:06 +00:00
|
|
|
strMenuName,
|
2005-12-28 12:33:18 +00:00
|
|
|
strMenuDescription
|
2005-09-06 08:58:56 +00:00
|
|
|
);
|
|
|
|
|
2006-11-20 20:55:32 +00:00
|
|
|
// View menu
|
|
|
|
wxMenu *menuView = new wxMenu;
|
|
|
|
|
2009-12-18 22:44:10 +00:00
|
|
|
menuView->Append(
|
2010-01-12 18:57:38 +00:00
|
|
|
ID_ADVNOTICESVIEW,
|
|
|
|
_("&Notices\tCtrl+Shift+N"),
|
|
|
|
_("Display notices")
|
2009-12-18 22:44:10 +00:00
|
|
|
);
|
|
|
|
|
2009-10-14 17:11:57 +00:00
|
|
|
menuView->Append(
|
|
|
|
ID_ADVPROJECTSVIEW,
|
2009-11-05 18:36:37 +00:00
|
|
|
_("&Projects\tCtrl+Shift+P"),
|
2009-10-14 17:11:57 +00:00
|
|
|
_("Display projects")
|
|
|
|
);
|
|
|
|
|
|
|
|
menuView->Append(
|
|
|
|
ID_ADVTASKSVIEW,
|
2009-11-05 18:36:37 +00:00
|
|
|
_("&Tasks\tCtrl+Shift+T"),
|
2009-10-14 17:11:57 +00:00
|
|
|
_("Display tasks")
|
|
|
|
);
|
|
|
|
|
|
|
|
menuView->Append(
|
|
|
|
ID_ADVTRANSFERSVIEW,
|
2009-11-05 18:36:37 +00:00
|
|
|
_("Trans&fers\tCtrl+Shift+X"),
|
2009-10-14 17:11:57 +00:00
|
|
|
_("Display transfers")
|
|
|
|
);
|
|
|
|
|
|
|
|
menuView->Append(
|
|
|
|
ID_ADVSTATISTICSVIEW,
|
2009-11-05 18:36:37 +00:00
|
|
|
_("&Statistics\tCtrl+Shift+S"),
|
2009-10-14 17:11:57 +00:00
|
|
|
_("Display statistics")
|
|
|
|
);
|
|
|
|
|
|
|
|
menuView->Append(
|
|
|
|
ID_ADVRESOURCEUSAGEVIEW,
|
2009-11-05 18:36:37 +00:00
|
|
|
_("&Disk usage\tCtrl+Shift+D"),
|
2009-10-14 17:11:57 +00:00
|
|
|
_("Display disk usage")
|
|
|
|
);
|
|
|
|
|
|
|
|
menuView->AppendSeparator();
|
|
|
|
|
2006-11-20 20:55:32 +00:00
|
|
|
menuView->Append(
|
2009-10-14 17:11:57 +00:00
|
|
|
ID_CHANGEGUI,
|
2009-11-05 18:36:37 +00:00
|
|
|
_("Simple &View...\tCtrl+Shift+V"),
|
2009-10-14 17:11:57 +00:00
|
|
|
_("Display the simple graphical interface.")
|
2006-11-20 20:55:32 +00:00
|
|
|
);
|
2007-08-18 00:22:21 +00:00
|
|
|
|
|
|
|
// Screen too small?
|
|
|
|
if (wxGetDisplaySize().GetHeight() < 600) {
|
2009-10-14 17:11:57 +00:00
|
|
|
menuView->Enable(ID_CHANGEGUI, false);
|
2007-08-18 00:22:21 +00:00
|
|
|
}
|
2006-11-20 20:55:32 +00:00
|
|
|
|
2006-02-02 12:32:21 +00:00
|
|
|
// Tools menu
|
|
|
|
wxMenu *menuTools = new wxMenu;
|
|
|
|
|
|
|
|
if (!is_acct_mgr_detected) {
|
|
|
|
menuTools->Append(
|
2009-10-14 17:11:57 +00:00
|
|
|
ID_WIZARDATTACH,
|
2010-08-01 03:37:17 +00:00
|
|
|
_("&Add project or account manager..."),
|
2010-05-06 21:05:40 +00:00
|
|
|
_("Volunteer for any or all of 30+ projects in many areas of science")
|
2006-02-02 12:32:21 +00:00
|
|
|
);
|
|
|
|
} else {
|
2006-02-15 02:38:38 +00:00
|
|
|
strMenuName.Printf(
|
|
|
|
_("&Synchronize with %s"),
|
2006-06-14 07:14:09 +00:00
|
|
|
wxString(ami.acct_mgr_name.c_str(), wxConvUTF8).c_str()
|
2006-02-15 02:38:38 +00:00
|
|
|
);
|
|
|
|
strMenuDescription.Printf(
|
|
|
|
_("Get current settings from %s"),
|
2006-06-14 07:14:09 +00:00
|
|
|
wxString(ami.acct_mgr_name.c_str(), wxConvUTF8).c_str()
|
2006-02-15 02:38:38 +00:00
|
|
|
);
|
2006-02-02 12:32:21 +00:00
|
|
|
menuTools->Append(
|
2009-10-14 17:11:57 +00:00
|
|
|
ID_WIZARDUPDATE,
|
2006-02-15 02:38:38 +00:00
|
|
|
strMenuName,
|
|
|
|
strMenuDescription
|
2006-02-02 12:32:21 +00:00
|
|
|
);
|
2009-10-14 17:11:57 +00:00
|
|
|
menuTools->Append(
|
|
|
|
ID_WIZARDATTACH,
|
2010-08-01 03:37:17 +00:00
|
|
|
_("&Add project..."),
|
|
|
|
_("Add a project")
|
2010-01-30 22:55:19 +00:00
|
|
|
);
|
|
|
|
strMenuName.Printf(
|
|
|
|
_("S&top using %s..."),
|
|
|
|
wxString(ami.acct_mgr_name.c_str(), wxConvUTF8).c_str()
|
2009-10-14 17:11:57 +00:00
|
|
|
);
|
|
|
|
menuTools->Append(
|
|
|
|
ID_WIZARDDETACH,
|
|
|
|
strMenuName,
|
2010-01-30 22:55:19 +00:00
|
|
|
_("Remove this computer from account manager control.")
|
2009-10-14 17:11:57 +00:00
|
|
|
);
|
2006-02-02 12:32:21 +00:00
|
|
|
}
|
2010-01-30 22:55:19 +00:00
|
|
|
menuTools->Append(
|
|
|
|
ID_OPTIONS,
|
2011-10-21 12:17:10 +00:00
|
|
|
_("&Options..."),
|
2010-10-06 20:13:34 +00:00
|
|
|
_("Configure display options and proxy settings")
|
2010-01-30 22:55:19 +00:00
|
|
|
);
|
|
|
|
menuTools->Append(
|
|
|
|
ID_PREFERENCES,
|
|
|
|
_("Computing &preferences..."),
|
|
|
|
_("Configure computing preferences")
|
|
|
|
);
|
2006-02-02 12:32:21 +00:00
|
|
|
|
|
|
|
// Activity menu
|
|
|
|
wxMenu *menuActivity = new wxMenu;
|
2005-09-06 08:58:56 +00:00
|
|
|
|
2006-02-02 12:32:21 +00:00
|
|
|
menuActivity->AppendRadioItem(
|
2009-10-14 17:11:57 +00:00
|
|
|
ID_ADVACTIVITYRUNALWAYS,
|
2004-10-24 07:38:38 +00:00
|
|
|
_("&Run always"),
|
2006-02-15 22:29:06 +00:00
|
|
|
_("Allow work regardless of preferences")
|
2005-04-10 19:01:23 +00:00
|
|
|
);
|
2006-02-02 12:32:21 +00:00
|
|
|
menuActivity->AppendRadioItem(
|
2009-10-14 17:11:57 +00:00
|
|
|
ID_ADVACTIVITYRUNBASEDONPREPERENCES,
|
2004-10-24 07:38:38 +00:00
|
|
|
_("Run based on &preferences"),
|
2010-01-30 22:55:19 +00:00
|
|
|
_("Allow work according to preferences")
|
2005-04-10 19:01:23 +00:00
|
|
|
);
|
2006-02-02 12:32:21 +00:00
|
|
|
menuActivity->AppendRadioItem(
|
2009-10-14 17:11:57 +00:00
|
|
|
ID_ADVACTIVITYSUSPEND,
|
2004-10-24 07:38:38 +00:00
|
|
|
_("&Suspend"),
|
2006-02-15 00:06:39 +00:00
|
|
|
_("Stop work regardless of preferences")
|
2005-04-10 19:01:23 +00:00
|
|
|
);
|
2009-12-18 22:44:10 +00:00
|
|
|
|
2011-06-22 11:24:23 +00:00
|
|
|
if (pDoc->state.have_nvidia || pDoc->state.have_ati) {
|
2010-03-04 19:35:16 +00:00
|
|
|
|
|
|
|
#ifndef __WXGTK__
|
2009-12-11 23:24:17 +00:00
|
|
|
menuActivity->AppendSeparator();
|
2010-03-04 19:35:16 +00:00
|
|
|
#else
|
|
|
|
// for some reason, the above radio items do not display the active
|
|
|
|
// selection on linux (wxGtk library) with the separator here,
|
|
|
|
// so we add a blank disabled menu item instead
|
|
|
|
//
|
|
|
|
wxMenuItem* pItem = menuActivity->Append(
|
|
|
|
ID_MENUSEPARATOR1,
|
|
|
|
(const wxChar *) wxT(" "),
|
|
|
|
// wxEmptyString here causes a wxWidgets assertion when debugging
|
|
|
|
wxEmptyString,
|
|
|
|
wxITEM_NORMAL
|
|
|
|
// wxITEM_SEPARATOR here causes a wxWidgets assertion when debugging
|
|
|
|
);
|
|
|
|
pItem->Enable(false); // disable this menu item
|
|
|
|
#endif
|
|
|
|
|
2009-12-11 23:24:17 +00:00
|
|
|
menuActivity->AppendRadioItem(
|
|
|
|
ID_ADVACTIVITYGPUALWAYS,
|
|
|
|
_("Use GPU always"),
|
|
|
|
_("Allow GPU work regardless of preferences")
|
|
|
|
);
|
|
|
|
menuActivity->AppendRadioItem(
|
|
|
|
ID_ADVACTIVITYGPUBASEDONPREPERENCES,
|
2010-01-30 22:55:19 +00:00
|
|
|
_("Use GPU based on preferences"),
|
|
|
|
_("Allow GPU work according to preferences")
|
2009-12-11 23:24:17 +00:00
|
|
|
);
|
|
|
|
menuActivity->AppendRadioItem(
|
|
|
|
ID_ADVACTIVITYGPUSUSPEND,
|
2010-03-23 21:23:41 +00:00
|
|
|
_("Suspend GPU"),
|
2009-12-11 23:24:17 +00:00
|
|
|
_("Stop GPU work regardless of preferences")
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2010-03-04 19:35:16 +00:00
|
|
|
#ifndef __WXGTK__
|
|
|
|
menuActivity->AppendSeparator();
|
|
|
|
#else
|
|
|
|
// for some reason, the above radio items do not display the active
|
|
|
|
// selection on linux (wxGtk library) with the separator here,
|
|
|
|
// so we add a blank disabled menu item instead
|
|
|
|
//
|
|
|
|
wxMenuItem* pItem = menuActivity->Append(
|
|
|
|
ID_MENUSEPARATOR2,
|
|
|
|
(const wxChar *) wxT(" "),
|
|
|
|
// wxEmptyString here causes a wxWidgets assertion when debugging
|
|
|
|
wxEmptyString,
|
|
|
|
wxITEM_NORMAL
|
|
|
|
// wxITEM_SEPARATOR here causes a wxWidgets assertion when debugging
|
|
|
|
);
|
|
|
|
pItem->Enable(false); // disable this menu item
|
|
|
|
#endif
|
2006-08-16 02:43:47 +00:00
|
|
|
|
2006-02-02 12:32:21 +00:00
|
|
|
menuActivity->AppendRadioItem(
|
2009-10-14 17:11:57 +00:00
|
|
|
ID_ADVNETWORKRUNALWAYS,
|
2010-01-30 22:55:19 +00:00
|
|
|
_("Network activity always available"),
|
2006-02-15 22:29:06 +00:00
|
|
|
_("Allow network activity regardless of preferences")
|
2005-06-29 05:54:12 +00:00
|
|
|
);
|
2006-02-02 12:32:21 +00:00
|
|
|
menuActivity->AppendRadioItem(
|
2009-10-14 17:11:57 +00:00
|
|
|
ID_ADVNETWORKRUNBASEDONPREPERENCES,
|
2010-01-30 22:55:19 +00:00
|
|
|
_("Network activity based on preferences"),
|
|
|
|
_("Allow network activity according to preferences")
|
2005-06-29 05:54:12 +00:00
|
|
|
);
|
2006-02-02 12:32:21 +00:00
|
|
|
menuActivity->AppendRadioItem(
|
2009-10-14 17:11:57 +00:00
|
|
|
ID_ADVNETWORKSUSPEND,
|
2010-01-30 22:55:19 +00:00
|
|
|
_("Network activity suspended"),
|
2006-02-15 00:06:39 +00:00
|
|
|
_("Stop BOINC network activity")
|
2005-04-10 19:01:23 +00:00
|
|
|
);
|
2004-10-24 07:38:38 +00:00
|
|
|
|
2006-02-02 12:32:21 +00:00
|
|
|
// Advanced menu
|
2010-01-30 22:55:19 +00:00
|
|
|
|
2006-02-02 12:32:21 +00:00
|
|
|
wxMenu *menuAdvanced = new wxMenu;
|
2007-01-17 18:13:33 +00:00
|
|
|
|
2006-02-02 12:32:21 +00:00
|
|
|
// %s is the project name
|
|
|
|
// i.e. 'BOINC', 'GridRepublic'
|
|
|
|
strMenuDescription.Printf(
|
|
|
|
_("Connect to another computer running %s"),
|
2007-08-16 18:53:42 +00:00
|
|
|
pSkinAdvanced->GetApplicationShortName().c_str()
|
2006-02-02 12:32:21 +00:00
|
|
|
);
|
|
|
|
menuAdvanced->Append(
|
2009-10-14 17:11:57 +00:00
|
|
|
ID_SELECTCOMPUTER,
|
2006-02-02 12:32:21 +00:00
|
|
|
_("Select computer..."),
|
|
|
|
strMenuDescription
|
|
|
|
);
|
2007-01-26 16:38:44 +00:00
|
|
|
menuAdvanced->Append(
|
|
|
|
ID_SHUTDOWNCORECLIENT,
|
2007-03-30 03:33:57 +00:00
|
|
|
_("Shut down connected client..."),
|
2010-01-30 22:55:19 +00:00
|
|
|
_("Shut down the currently connected client")
|
2007-01-26 16:38:44 +00:00
|
|
|
);
|
2006-02-02 12:32:21 +00:00
|
|
|
menuAdvanced->Append(
|
2009-10-14 17:11:57 +00:00
|
|
|
ID_RUNBENCHMARKS,
|
2006-02-02 12:32:21 +00:00
|
|
|
_("Run CPU &benchmarks"),
|
2004-11-22 19:17:13 +00:00
|
|
|
_("Runs BOINC CPU benchmarks")
|
2005-04-10 19:01:23 +00:00
|
|
|
);
|
2006-02-02 12:32:21 +00:00
|
|
|
menuAdvanced->Append(
|
2009-10-14 17:11:57 +00:00
|
|
|
ID_RETRYCOMMUNICATIONS,
|
2010-01-30 22:55:19 +00:00
|
|
|
_("Do network communication"),
|
|
|
|
_("Do all pending network communication")
|
2005-09-22 08:46:51 +00:00
|
|
|
);
|
2006-12-17 03:16:20 +00:00
|
|
|
menuAdvanced->Append(
|
2009-10-14 17:11:57 +00:00
|
|
|
ID_READCONFIG,
|
2006-12-17 03:16:20 +00:00
|
|
|
_("Read config file"),
|
2010-01-30 22:55:19 +00:00
|
|
|
_("Read configuration info from cc_config.xml")
|
2006-12-17 03:16:20 +00:00
|
|
|
);
|
|
|
|
menuAdvanced->Append(
|
2009-10-14 17:11:57 +00:00
|
|
|
ID_READPREFERENCES,
|
2006-12-17 03:16:20 +00:00
|
|
|
_("Read local prefs file"),
|
|
|
|
_("Read preferences from global_prefs_override.xml.")
|
|
|
|
);
|
2010-10-06 11:13:07 +00:00
|
|
|
// %s is the project name
|
|
|
|
// i.e. 'BOINC', 'GridRepublic'
|
|
|
|
strMenuDescription.Printf(
|
2010-10-19 19:28:29 +00:00
|
|
|
_("Launch another instance of %s..."),
|
2010-10-06 11:13:07 +00:00
|
|
|
pSkinAdvanced->GetApplicationName().c_str()
|
|
|
|
);
|
|
|
|
strMenuName.Printf(
|
|
|
|
_("Launch another %s"),
|
|
|
|
pSkinAdvanced->GetApplicationName().c_str()
|
|
|
|
);
|
|
|
|
menuAdvanced->Append(
|
|
|
|
ID_LAUNCHNEWINSTANCE,
|
|
|
|
strMenuName,
|
|
|
|
strMenuDescription
|
|
|
|
);
|
2010-10-19 19:28:29 +00:00
|
|
|
menuAdvanced->Append(
|
|
|
|
ID_EVENTLOG,
|
|
|
|
_("Event Log...\tCtrl+Shift+E"),
|
|
|
|
_("Display diagnostic messages.")
|
|
|
|
);
|
2005-03-11 22:10:56 +00:00
|
|
|
|
2004-04-10 09:11:03 +00:00
|
|
|
|
|
|
|
// Help menu
|
|
|
|
wxMenu *menuHelp = new wxMenu;
|
2005-12-28 12:33:18 +00:00
|
|
|
|
2007-04-03 13:14:30 +00:00
|
|
|
// %s is the project name
|
|
|
|
// i.e. 'BOINC', 'GridRepublic'
|
|
|
|
strMenuName.Printf(
|
|
|
|
_("%s &help"),
|
2007-08-16 18:53:42 +00:00
|
|
|
pSkinAdvanced->GetApplicationShortName().c_str()
|
2007-04-03 13:14:30 +00:00
|
|
|
);
|
|
|
|
// %s is the project name
|
|
|
|
// i.e. 'BOINC', 'GridRepublic'
|
|
|
|
strMenuDescription.Printf(
|
|
|
|
_("Show information about %s"),
|
2007-08-16 18:53:42 +00:00
|
|
|
pSkinAdvanced->GetApplicationShortName().c_str()
|
2007-04-03 13:14:30 +00:00
|
|
|
);
|
|
|
|
menuHelp->Append(
|
|
|
|
ID_HELPBOINC,
|
|
|
|
strMenuName,
|
|
|
|
strMenuDescription
|
|
|
|
);
|
|
|
|
|
2005-12-28 12:33:18 +00:00
|
|
|
// %s is the application name
|
|
|
|
// i.e. 'BOINC Manager', 'GridRepublic Manager'
|
|
|
|
strMenuName.Printf(
|
2007-04-03 13:14:30 +00:00
|
|
|
_("&%s help"),
|
2006-10-20 15:00:14 +00:00
|
|
|
pSkinAdvanced->GetApplicationName().c_str()
|
2005-12-28 12:33:18 +00:00
|
|
|
);
|
|
|
|
// %s is the application name
|
|
|
|
// i.e. 'BOINC Manager', 'GridRepublic Manager'
|
|
|
|
strMenuDescription.Printf(
|
|
|
|
_("Show information about the %s"),
|
2006-10-20 15:00:14 +00:00
|
|
|
pSkinAdvanced->GetApplicationName().c_str()
|
2005-12-28 12:33:18 +00:00
|
|
|
);
|
2005-05-05 06:07:14 +00:00
|
|
|
menuHelp->Append(
|
|
|
|
ID_HELPBOINCMANAGER,
|
2005-12-28 12:33:18 +00:00
|
|
|
strMenuName,
|
|
|
|
strMenuDescription
|
2005-05-05 06:07:14 +00:00
|
|
|
);
|
|
|
|
|
2005-12-28 12:33:18 +00:00
|
|
|
// %s is the project name
|
|
|
|
// i.e. 'BOINC', 'GridRepublic'
|
|
|
|
strMenuName.Printf(
|
|
|
|
_("%s &website"),
|
2007-08-16 18:53:42 +00:00
|
|
|
pSkinAdvanced->GetApplicationShortName().c_str()
|
2005-12-28 12:33:18 +00:00
|
|
|
);
|
|
|
|
// %s is the application name
|
|
|
|
// i.e. 'BOINC Manager', 'GridRepublic Manager'
|
|
|
|
strMenuDescription.Printf(
|
|
|
|
_("Show information about BOINC and %s"),
|
2006-10-20 15:00:14 +00:00
|
|
|
pSkinAdvanced->GetApplicationName().c_str()
|
2005-12-28 12:33:18 +00:00
|
|
|
);
|
2005-05-05 06:07:14 +00:00
|
|
|
menuHelp->Append(
|
2007-04-03 13:14:30 +00:00
|
|
|
ID_HELPBOINCWEBSITE,
|
2005-12-28 12:33:18 +00:00
|
|
|
strMenuName,
|
|
|
|
strMenuDescription
|
2005-05-05 06:07:14 +00:00
|
|
|
);
|
|
|
|
|
2005-12-28 12:33:18 +00:00
|
|
|
// %s is the project name
|
|
|
|
// i.e. 'BOINC Manager', 'GridRepublic Manager'
|
|
|
|
strMenuName.Printf(
|
|
|
|
_("&About %s..."),
|
2006-10-20 15:00:14 +00:00
|
|
|
pSkinAdvanced->GetApplicationName().c_str()
|
2005-12-28 12:33:18 +00:00
|
|
|
);
|
2005-04-08 16:58:55 +00:00
|
|
|
menuHelp->Append(
|
2004-10-09 03:05:01 +00:00
|
|
|
wxID_ABOUT,
|
2005-12-28 12:33:18 +00:00
|
|
|
strMenuName,
|
2005-05-05 06:07:14 +00:00
|
|
|
_("Licensing and copyright information.")
|
2005-04-10 19:01:23 +00:00
|
|
|
);
|
2004-04-10 09:11:03 +00:00
|
|
|
|
|
|
|
// construct menu
|
|
|
|
m_pMenubar = new wxMenuBar;
|
2006-11-20 20:55:32 +00:00
|
|
|
m_pMenubar->Append(
|
|
|
|
menuFile,
|
|
|
|
_("&File")
|
|
|
|
);
|
|
|
|
m_pMenubar->Append(
|
|
|
|
menuView,
|
|
|
|
_("&View")
|
|
|
|
);
|
2004-10-09 03:05:01 +00:00
|
|
|
m_pMenubar->Append(
|
2006-02-02 12:32:21 +00:00
|
|
|
menuTools,
|
|
|
|
_("&Tools")
|
2005-09-06 08:58:56 +00:00
|
|
|
);
|
|
|
|
m_pMenubar->Append(
|
2006-02-02 12:32:21 +00:00
|
|
|
menuActivity,
|
|
|
|
_("&Activity")
|
2005-09-06 08:58:56 +00:00
|
|
|
);
|
|
|
|
m_pMenubar->Append(
|
2006-02-02 12:32:21 +00:00
|
|
|
menuAdvanced,
|
|
|
|
_("A&dvanced")
|
2005-04-10 19:01:23 +00:00
|
|
|
);
|
2004-10-09 03:05:01 +00:00
|
|
|
m_pMenubar->Append(
|
|
|
|
menuHelp,
|
|
|
|
_("&Help")
|
2005-04-10 19:01:23 +00:00
|
|
|
);
|
2006-02-02 12:32:21 +00:00
|
|
|
|
|
|
|
wxMenuBar* m_pOldMenubar = GetMenuBar();
|
2004-04-10 09:11:03 +00:00
|
|
|
SetMenuBar(m_pMenubar);
|
2006-02-16 11:01:57 +00:00
|
|
|
#ifdef __WXMAC__
|
|
|
|
m_pMenubar->MacInstallMenuBar();
|
2011-02-01 11:08:07 +00:00
|
|
|
MacLocalizeBOINCMenu();
|
2006-02-16 11:01:57 +00:00
|
|
|
#endif
|
2006-02-02 12:32:21 +00:00
|
|
|
if (m_pOldMenubar) {
|
|
|
|
delete m_pOldMenubar;
|
|
|
|
}
|
2006-03-31 02:30:06 +00:00
|
|
|
|
|
|
|
#ifdef __WXMAC__
|
2009-04-01 11:14:16 +00:00
|
|
|
// Enable Mac OS X's standard Preferences menu item (handled in MacSysMenu.cpp)
|
|
|
|
EnableMenuCommand(NULL, kHICommandPreferences);
|
2006-12-16 07:57:26 +00:00
|
|
|
|
|
|
|
// Set HELP key as keyboard shortcut
|
2009-04-18 11:52:48 +00:00
|
|
|
m_Shortcuts[0].Set(wxACCEL_NORMAL, WXK_HELP, ID_HELPBOINCMANAGER);
|
|
|
|
m_pAccelTable = new wxAcceleratorTable(1, m_Shortcuts);
|
2006-12-16 07:57:26 +00:00
|
|
|
SetAcceleratorTable(*m_pAccelTable);
|
2006-03-31 02:30:06 +00:00
|
|
|
#endif
|
2004-04-10 09:11:03 +00:00
|
|
|
|
2006-06-24 05:00:57 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::CreateMenu - Function End"));
|
2004-04-10 09:11:03 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-01-13 09:30:21 +00:00
|
|
|
bool CAdvancedFrame::CreateNotebook() {
|
2006-06-24 05:00:57 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::CreateNotebook - Function Begin"));
|
2004-12-03 20:30:24 +00:00
|
|
|
|
2004-04-10 09:11:03 +00:00
|
|
|
// create frame panel
|
|
|
|
wxPanel *pPanel = new wxPanel(this, -1, wxDefaultPosition, wxDefaultSize,
|
|
|
|
wxTAB_TRAVERSAL|wxCLIP_CHILDREN|wxNO_BORDER);
|
2004-12-15 23:08:18 +00:00
|
|
|
pPanel->SetAutoLayout(TRUE);
|
2004-04-10 09:11:03 +00:00
|
|
|
|
|
|
|
// initialize notebook
|
2004-10-21 14:29:59 +00:00
|
|
|
m_pNotebook = new wxNotebook(pPanel, ID_FRAMENOTEBOOK, wxDefaultPosition, wxDefaultSize,
|
2004-04-10 09:11:03 +00:00
|
|
|
wxNB_FIXEDWIDTH|wxCLIP_CHILDREN);
|
|
|
|
|
|
|
|
// layout frame panel
|
|
|
|
wxBoxSizer *pPanelSizer = new wxBoxSizer(wxVERTICAL);
|
2004-09-21 01:30:29 +00:00
|
|
|
|
2004-04-10 09:11:03 +00:00
|
|
|
pPanelSizer->Add(new wxStaticLine(pPanel, -1), 0, wxEXPAND);
|
2005-04-04 06:02:36 +00:00
|
|
|
pPanelSizer->Add(0, 5);
|
2005-04-26 04:20:35 +00:00
|
|
|
pPanelSizer->Add(m_pNotebook, 1, wxEXPAND);
|
2004-09-21 01:30:29 +00:00
|
|
|
|
2007-05-22 16:27:27 +00:00
|
|
|
// Display default views
|
|
|
|
RepopulateNotebook();
|
2004-12-15 22:11:14 +00:00
|
|
|
|
2005-04-27 06:32:40 +00:00
|
|
|
pPanel->SetSizer(pPanelSizer);
|
|
|
|
pPanel->Layout();
|
2004-12-15 22:11:14 +00:00
|
|
|
|
2009-11-25 12:43:22 +00:00
|
|
|
#ifdef __WXMAC__
|
|
|
|
//Accessibility
|
|
|
|
HIObjectSetAccessibilityIgnored((HIObjectRef)pPanel->GetHandle(), true);
|
|
|
|
#endif
|
|
|
|
|
2006-06-24 05:00:57 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::CreateNotebook - Function End"));
|
2004-04-10 09:11:03 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-05-22 16:27:27 +00:00
|
|
|
bool CAdvancedFrame::RepopulateNotebook() {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::RepopulateNotebook - Function Begin"));
|
|
|
|
|
|
|
|
DeleteNotebook();
|
|
|
|
|
|
|
|
// Create the various notebook pages
|
2010-01-12 18:57:38 +00:00
|
|
|
CreateNotebookPage(new CViewNotices(m_pNotebook));
|
2008-07-27 03:01:59 +00:00
|
|
|
CreateNotebookPage(new CViewProjects(m_pNotebook));
|
|
|
|
CreateNotebookPage(new CViewWork(m_pNotebook));
|
|
|
|
CreateNotebookPage(new CViewTransfers(m_pNotebook));
|
|
|
|
CreateNotebookPage(new CViewStatistics(m_pNotebook));
|
|
|
|
CreateNotebookPage(new CViewResources(m_pNotebook));
|
2007-05-22 16:27:27 +00:00
|
|
|
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::RepopulateNotebook - Function End"));
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-10-14 17:11:57 +00:00
|
|
|
bool CAdvancedFrame::CreateNotebookPage( CBOINCBaseView* pwndNewNotebookPage) {
|
2006-06-24 05:00:57 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::CreateNotebookPage - Function Begin"));
|
2004-12-03 20:30:24 +00:00
|
|
|
|
2009-12-18 22:44:10 +00:00
|
|
|
wxImageList* pImageList;
|
|
|
|
int iImageIndex = 0;
|
2004-04-13 00:33:40 +00:00
|
|
|
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(pwndNewNotebookPage);
|
|
|
|
wxASSERT(m_pNotebook);
|
2004-09-21 01:30:29 +00:00
|
|
|
wxASSERT(wxDynamicCast(pwndNewNotebookPage, CBOINCBaseView));
|
2004-04-10 09:11:03 +00:00
|
|
|
|
2004-04-13 00:33:40 +00:00
|
|
|
|
|
|
|
pImageList = m_pNotebook->GetImageList();
|
|
|
|
if (!pImageList) {
|
|
|
|
pImageList = new wxImageList(16, 16, true, 0);
|
|
|
|
wxASSERT(pImageList != NULL);
|
2004-04-13 02:06:27 +00:00
|
|
|
m_pNotebook->SetImageList(pImageList);
|
2004-04-13 00:33:40 +00:00
|
|
|
}
|
|
|
|
|
2006-02-01 10:58:26 +00:00
|
|
|
iImageIndex = pImageList->Add(wxBitmap(pwndNewNotebookPage->GetViewIcon()));
|
- fixes #207 - HTML entities in BOINC Manager have to be decoded
BOINC Manager can now properly decode HTML entites for the
following elements:
Projects Tab:
Project Name
User Name
Team Name
Work Tab:
Project Name
Application Name
Transfers Tab:
Project Name
Messages Tab:
Project Name
Disk Tab:
Project Name
- fixes #212 - Info in columns misaligned on switching views
- Properly restore which tab view the user left from when going
to the advanced view from the simple view
- Fix the problem that caused the manager to wait for 7 seconds
to display anything on initial startup.
- Store the various Grid/List persisted data seperately so that
the different header sizes don't cause problems.
clientgui/
AdvancedFrame.cpp
BOINCBaseView.cpp, .h
BOINCGridCtrl.cpp
ViewMessages.cpp, .h
ViewMessagesGrid.cpp, .h
ViewProjects.cpp, .h
ViewProjectsGrid.cpp, .h
ViewResources.cpp, .h
ViewStatistics.cpp, .h
ViewTransfers.cpp, .h
ViewTransfersGrid.cpp, .h
ViewWork.cpp, .h
ViewWorkGrid.cpp, .h
lib/
gui_rpc_client_ops.C
svn path=/trunk/boinc/; revision=12761
2007-05-29 05:07:35 +00:00
|
|
|
m_pNotebook->AddPage(pwndNewNotebookPage, pwndNewNotebookPage->GetViewDisplayName(), TRUE, iImageIndex);
|
2004-04-10 09:11:03 +00:00
|
|
|
|
2006-06-24 05:00:57 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::CreateNotebookPage - Function End"));
|
2004-04-10 09:11:03 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-01-13 09:30:21 +00:00
|
|
|
bool CAdvancedFrame::CreateStatusbar() {
|
2006-06-24 05:00:57 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::CreateStatusbar - Function Begin"));
|
2004-12-03 20:30:24 +00:00
|
|
|
|
2004-04-10 09:11:03 +00:00
|
|
|
if (m_pStatusbar)
|
|
|
|
return true;
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
m_pStatusbar = new CStatusBar(this);
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(m_pStatusbar);
|
2004-05-21 06:27:15 +00:00
|
|
|
|
2004-04-10 09:11:03 +00:00
|
|
|
SetStatusBar(m_pStatusbar);
|
2009-03-09 05:00:58 +00:00
|
|
|
SetStatusBarPane(0);
|
2004-04-10 09:11:03 +00:00
|
|
|
|
2006-06-24 05:00:57 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::CreateStatusbar - Function End"));
|
2004-04-10 09:11:03 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-06-24 05:00:57 +00:00
|
|
|
bool CAdvancedFrame::DeleteMenu() {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::DeleteMenu - Function Begin"));
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::DeleteMenu - Function End"));
|
2004-04-10 09:11:03 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-06-24 05:00:57 +00:00
|
|
|
bool CAdvancedFrame::DeleteNotebook() {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::DeleteNotebook - Function Begin"));
|
2004-12-03 20:30:24 +00:00
|
|
|
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(m_pNotebook);
|
2004-04-13 02:18:03 +00:00
|
|
|
|
2007-05-22 16:27:27 +00:00
|
|
|
// Delete all existing pages
|
|
|
|
m_pNotebook->DeleteAllPages();
|
2004-05-21 06:27:15 +00:00
|
|
|
|
2007-05-22 16:27:27 +00:00
|
|
|
// Delete all existing images
|
|
|
|
wxImageList* pImageList = m_pNotebook->GetImageList();
|
|
|
|
if (pImageList) {
|
|
|
|
pImageList->RemoveAll();
|
|
|
|
}
|
2004-04-13 00:33:40 +00:00
|
|
|
|
2006-06-24 05:00:57 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::DeleteNotebook - Function End"));
|
2004-04-10 09:11:03 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-06-24 05:00:57 +00:00
|
|
|
bool CAdvancedFrame::DeleteStatusbar() {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::DeleteStatusbar - Function Begin"));
|
2004-12-03 20:30:24 +00:00
|
|
|
|
2004-04-10 09:11:03 +00:00
|
|
|
if (!m_pStatusbar)
|
|
|
|
return true;
|
|
|
|
|
2004-05-21 06:27:15 +00:00
|
|
|
SetStatusBar(NULL);
|
2004-04-10 09:11:03 +00:00
|
|
|
|
|
|
|
delete m_pStatusbar;
|
|
|
|
m_pStatusbar = NULL;
|
2004-10-28 22:51:38 +00:00
|
|
|
|
2006-06-24 05:00:57 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::DeleteStatusbar - Function End"));
|
2004-04-10 09:11:03 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-06-24 05:00:57 +00:00
|
|
|
bool CAdvancedFrame::SaveState() {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::SaveState - Function Begin"));
|
2004-12-03 20:30:24 +00:00
|
|
|
|
2007-05-22 16:27:27 +00:00
|
|
|
wxString strBaseConfigLocation = wxString(wxT("/"));
|
|
|
|
wxConfigBase* pConfig = wxConfigBase::Get(FALSE);
|
|
|
|
wxWindow* pwndNotebookPage = NULL;
|
|
|
|
CBOINCBaseView* pView = NULL;
|
|
|
|
wxString strConfigLocation;
|
|
|
|
wxString strPreviousLocation;
|
|
|
|
wxString strBuffer;
|
|
|
|
int iIndex = 0;
|
|
|
|
int iItemCount = 0;
|
|
|
|
|
|
|
|
|
|
|
|
wxASSERT(pConfig);
|
|
|
|
wxASSERT(m_pNotebook);
|
|
|
|
|
2009-03-12 08:08:49 +00:00
|
|
|
CBOINCBaseFrame::SaveState();
|
2007-05-22 16:27:27 +00:00
|
|
|
|
|
|
|
// An odd case happens every once and awhile where wxWidgets looses
|
|
|
|
// the pointer to the config object, or it is cleaned up before
|
|
|
|
// the window has finished it's cleanup duty. If we detect a NULL
|
|
|
|
// pointer, return false.
|
|
|
|
if (!pConfig) return false;
|
|
|
|
|
|
|
|
//
|
|
|
|
// Save Frame State
|
|
|
|
//
|
|
|
|
pConfig->SetPath(strBaseConfigLocation);
|
|
|
|
|
2009-12-18 22:44:10 +00:00
|
|
|
// Store the latest window dimensions.
|
2009-03-12 08:08:49 +00:00
|
|
|
SaveWindowDimensions();
|
|
|
|
|
2009-12-18 22:44:10 +00:00
|
|
|
// Store the latest tab
|
|
|
|
pConfig->Write(wxT("CurrentPageV2"), m_pNotebook->GetSelection());
|
2004-05-27 06:17:58 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Save Page(s) State
|
|
|
|
//
|
2004-05-29 00:09:41 +00:00
|
|
|
|
|
|
|
// Convert to a zero based index
|
2006-07-21 08:23:26 +00:00
|
|
|
iItemCount = (int)m_pNotebook->GetPageCount() - 1;
|
2004-05-27 06:17:58 +00:00
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
for (iIndex = 0; iIndex <= iItemCount; iIndex++) {
|
2004-05-27 06:17:58 +00:00
|
|
|
pwndNotebookPage = m_pNotebook->GetPage(iIndex);
|
2004-09-21 01:30:29 +00:00
|
|
|
wxASSERT(wxDynamicCast(pwndNotebookPage, CBOINCBaseView));
|
|
|
|
|
2004-10-26 01:59:44 +00:00
|
|
|
pView = wxDynamicCast(pwndNotebookPage, CBOINCBaseView);
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(pView);
|
2004-05-27 06:17:58 +00:00
|
|
|
|
2004-10-26 01:59:44 +00:00
|
|
|
strPreviousLocation = pConfig->GetPath();
|
|
|
|
strConfigLocation = strPreviousLocation + pView->GetViewName();
|
2004-05-27 06:17:58 +00:00
|
|
|
|
2004-10-26 01:59:44 +00:00
|
|
|
pConfig->SetPath(strConfigLocation);
|
2005-04-07 07:04:50 +00:00
|
|
|
pView->FireOnSaveState(pConfig);
|
2004-10-26 01:59:44 +00:00
|
|
|
pConfig->SetPath(strPreviousLocation);
|
|
|
|
}
|
2004-05-27 06:17:58 +00:00
|
|
|
|
2009-03-12 08:08:49 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::SaveState - Function End"));
|
2004-05-27 06:17:58 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-06-24 05:00:57 +00:00
|
|
|
bool CAdvancedFrame::RestoreState() {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::RestoreState - Function Begin"));
|
2004-12-03 20:30:24 +00:00
|
|
|
|
2004-10-05 02:55:26 +00:00
|
|
|
wxString strBaseConfigLocation = wxString(wxT("/"));
|
2004-05-27 06:17:58 +00:00
|
|
|
wxConfigBase* pConfig = wxConfigBase::Get(FALSE);
|
2004-05-29 00:09:41 +00:00
|
|
|
wxWindow* pwndNotebookPage = NULL;
|
2004-10-26 01:59:44 +00:00
|
|
|
CBOINCBaseView* pView = NULL;
|
2006-06-23 08:20:08 +00:00
|
|
|
wxString strConfigLocation;
|
|
|
|
wxString strPreviousLocation;
|
|
|
|
wxString strBuffer;
|
|
|
|
wxString strValue;
|
|
|
|
long iIndex;
|
|
|
|
long iPageCount;
|
2006-04-14 03:09:24 +00:00
|
|
|
long iCurrentPage;
|
2004-05-27 06:17:58 +00:00
|
|
|
|
|
|
|
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(pConfig);
|
|
|
|
wxASSERT(m_pNotebook);
|
2004-05-27 06:17:58 +00:00
|
|
|
|
2006-06-23 08:20:08 +00:00
|
|
|
|
|
|
|
CBOINCBaseFrame::RestoreState();
|
|
|
|
|
|
|
|
|
2005-06-24 10:49:42 +00:00
|
|
|
// An odd case happens every once and awhile where wxWidgets looses
|
|
|
|
// the pointer to the config object, or it is cleaned up before
|
|
|
|
// the window has finished it's cleanup duty. If we detect a NULL
|
|
|
|
// pointer, return false.
|
|
|
|
if (!pConfig) return false;
|
2004-05-27 06:17:58 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Restore Frame State
|
|
|
|
//
|
|
|
|
pConfig->SetPath(strBaseConfigLocation);
|
|
|
|
|
2006-10-20 15:00:14 +00:00
|
|
|
if (wxGetApp().GetSkinManager()->GetAdvanced()->GetDefaultTab()) {
|
|
|
|
m_pNotebook->SetSelection(wxGetApp().GetSkinManager()->GetAdvanced()->GetDefaultTab());
|
2006-01-19 12:22:22 +00:00
|
|
|
} else {
|
2010-01-12 18:57:38 +00:00
|
|
|
pConfig->Read(wxT("CurrentPageV2"), &iCurrentPage, (ID_ADVNOTICESVIEW - ID_ADVVIEWBASE));
|
2006-01-19 12:22:22 +00:00
|
|
|
m_pNotebook->SetSelection(iCurrentPage);
|
|
|
|
}
|
2006-10-30 22:42:12 +00:00
|
|
|
|
2004-05-27 06:17:58 +00:00
|
|
|
//
|
|
|
|
// Restore Page(s) State
|
|
|
|
//
|
|
|
|
|
2004-05-29 00:09:41 +00:00
|
|
|
// Convert to a zero based index
|
2006-07-21 08:23:26 +00:00
|
|
|
iPageCount = (long)m_pNotebook->GetPageCount() - 1;
|
2004-05-27 06:17:58 +00:00
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
for (iIndex = 0; iIndex <= iPageCount; iIndex++) {
|
2004-05-27 06:17:58 +00:00
|
|
|
|
|
|
|
pwndNotebookPage = m_pNotebook->GetPage(iIndex);
|
2004-09-21 01:30:29 +00:00
|
|
|
wxASSERT(wxDynamicCast(pwndNotebookPage, CBOINCBaseView));
|
|
|
|
|
2004-10-26 01:59:44 +00:00
|
|
|
pView = wxDynamicCast(pwndNotebookPage, CBOINCBaseView);
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(pView);
|
2004-05-27 06:17:58 +00:00
|
|
|
|
2004-10-26 01:59:44 +00:00
|
|
|
strPreviousLocation = pConfig->GetPath();
|
|
|
|
strConfigLocation = strPreviousLocation + pView->GetViewName();
|
2004-05-21 06:27:15 +00:00
|
|
|
|
2004-10-26 01:59:44 +00:00
|
|
|
pConfig->SetPath(strConfigLocation);
|
2005-04-07 07:04:50 +00:00
|
|
|
pView->FireOnRestoreState(pConfig);
|
2004-10-26 01:59:44 +00:00
|
|
|
pConfig->SetPath(strPreviousLocation);
|
2004-05-21 06:27:15 +00:00
|
|
|
|
2004-10-26 01:59:44 +00:00
|
|
|
}
|
2004-05-27 06:17:58 +00:00
|
|
|
|
2009-03-12 08:08:49 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::RestoreState - Function End"));
|
2004-05-27 06:17:58 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-10-30 22:42:12 +00:00
|
|
|
void CAdvancedFrame::SaveWindowDimensions() {
|
2009-03-09 05:00:58 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::SaveWindowDimensions - Function Begin"));
|
|
|
|
|
2006-10-30 22:42:12 +00:00
|
|
|
wxString strBaseConfigLocation = wxString(wxT("/"));
|
|
|
|
wxConfigBase* pConfig = wxConfigBase::Get(FALSE);
|
|
|
|
|
|
|
|
wxASSERT(pConfig);
|
|
|
|
|
|
|
|
pConfig->SetPath(strBaseConfigLocation);
|
|
|
|
|
2010-07-22 11:50:24 +00:00
|
|
|
bool iconized = IsIconized();
|
|
|
|
pConfig->Write(wxT("WindowIconized"), iconized);
|
2006-10-30 22:42:12 +00:00
|
|
|
pConfig->Write(wxT("WindowMaximized"), IsMaximized());
|
2010-07-22 11:50:24 +00:00
|
|
|
if (!iconized) {
|
|
|
|
pConfig->Write(wxT("Width"), GetSize().GetWidth());
|
|
|
|
pConfig->Write(wxT("Height"), GetSize().GetHeight());
|
|
|
|
pConfig->Write(wxT("XPos"), GetPosition().x);
|
|
|
|
pConfig->Write(wxT("YPos"), GetPosition().y);
|
|
|
|
}
|
|
|
|
|
2009-03-09 05:00:58 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::SaveWindowDimensions - Function End"));
|
2006-10-30 22:42:12 +00:00
|
|
|
}
|
2010-11-12 12:56:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
void CAdvancedFrame::OnSize(wxSizeEvent& event) {
|
|
|
|
SaveWindowDimensions();
|
|
|
|
event.Skip();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CAdvancedFrame::OnMove(wxMoveEvent& event) {
|
|
|
|
SaveWindowDimensions();
|
|
|
|
event.Skip();
|
|
|
|
}
|
2006-10-30 22:42:12 +00:00
|
|
|
|
|
|
|
|
- client: include precompiled header in rr_sim.cpp so memory
leak detection will work.
- MGR: Have the BaseFrame call a function to determine if the
selection list should be saved instead of traversing
the application pointer. Each view just overrides the function
returning a true/false value. We don't have to worry about null
pointers and the like.
- MGR: BOINCGUIApp should never need to know how either the views
work or the document. Move the code that determines which
RPCs should be fired into each of the views. Have the document
look for it there.
- MGR: Reduce duplicate code for hiding and showing an application
- MGR: Move some Windows and Mac specific code into functions
and streamline the application startup and shutdown rountines.
- MGR: Move the event processing that was in BOINCGUIApp into the
BaseFrame.
- MGR: General cleanup.
- MGR: Doxygen comments.
- MGR: Cleanup some warnings.
client/
rr_sim.cpp
clientgui/
AdvancedFrame.cpp, .h
AsyncRPC.cpp, .h
BOINCBaseFrame.cpp, .h
BOINCBaseView.cpp, .h
BOINCClientManager.cpp
BOINCGUIApp.cpp, .h
BOINCTaskBar.cpp
MainDocument.cpp, .h
sg_BoincSimpleGUI.cpp, .h
ViewProjects.cpp, .h
ViewTransfers.cpp, .h
ViewWork.cpp, .h
WelcomePage.cpp
win_build/installerv2/
BOINC.ism
BOINCx64.ism
win_build/
sim.vcproj
svn path=/trunk/boinc/; revision=16357
2008-10-29 22:44:55 +00:00
|
|
|
int CAdvancedFrame::_GetCurrentViewPage() {
|
2009-12-22 01:22:11 +00:00
|
|
|
|
|
|
|
wxWindow* pwndNotebookPage = NULL;
|
|
|
|
CBOINCBaseView* pView = NULL;
|
|
|
|
|
|
|
|
wxASSERT(m_pNotebook);
|
|
|
|
|
|
|
|
pwndNotebookPage = m_pNotebook->GetPage(m_pNotebook->GetSelection());
|
|
|
|
wxASSERT(pwndNotebookPage);
|
|
|
|
|
|
|
|
pView = wxDynamicCast(pwndNotebookPage, CBOINCBaseView);
|
|
|
|
wxASSERT(pView);
|
|
|
|
|
2010-01-09 01:42:46 +00:00
|
|
|
return pView->GetViewCurrentViewPage();
|
- client: include precompiled header in rr_sim.cpp so memory
leak detection will work.
- MGR: Have the BaseFrame call a function to determine if the
selection list should be saved instead of traversing
the application pointer. Each view just overrides the function
returning a true/false value. We don't have to worry about null
pointers and the like.
- MGR: BOINCGUIApp should never need to know how either the views
work or the document. Move the code that determines which
RPCs should be fired into each of the views. Have the document
look for it there.
- MGR: Reduce duplicate code for hiding and showing an application
- MGR: Move some Windows and Mac specific code into functions
and streamline the application startup and shutdown rountines.
- MGR: Move the event processing that was in BOINCGUIApp into the
BaseFrame.
- MGR: General cleanup.
- MGR: Doxygen comments.
- MGR: Cleanup some warnings.
client/
rr_sim.cpp
clientgui/
AdvancedFrame.cpp, .h
AsyncRPC.cpp, .h
BOINCBaseFrame.cpp, .h
BOINCBaseView.cpp, .h
BOINCClientManager.cpp
BOINCGUIApp.cpp, .h
BOINCTaskBar.cpp
MainDocument.cpp, .h
sg_BoincSimpleGUI.cpp, .h
ViewProjects.cpp, .h
ViewTransfers.cpp, .h
ViewWork.cpp, .h
WelcomePage.cpp
win_build/installerv2/
BOINC.ism
BOINCx64.ism
win_build/
sim.vcproj
svn path=/trunk/boinc/; revision=16357
2008-10-29 22:44:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-10-14 17:11:57 +00:00
|
|
|
void CAdvancedFrame::OnChangeView(wxCommandEvent& event) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnChangeView - Function Begin"));
|
2006-02-22 20:12:53 +00:00
|
|
|
|
2009-10-14 17:11:57 +00:00
|
|
|
m_pNotebook->SetSelection(event.GetId() - ID_ADVVIEWBASE);
|
2004-12-03 20:30:24 +00:00
|
|
|
|
2009-10-14 17:11:57 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnChangeView - Function End"));
|
2004-04-10 09:11:03 +00:00
|
|
|
}
|
|
|
|
|
2004-12-03 20:30:24 +00:00
|
|
|
|
2009-10-14 17:11:57 +00:00
|
|
|
void CAdvancedFrame::OnChangeGUI(wxCommandEvent& WXUNUSED(event)) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnChangeGUI - Function Begin"));
|
2004-10-27 23:19:50 +00:00
|
|
|
|
2009-10-14 17:11:57 +00:00
|
|
|
wxGetApp().SetActiveGUI(BOINC_SIMPLEGUI, true);
|
2004-12-03 20:30:24 +00:00
|
|
|
|
2009-10-14 17:11:57 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnChangeGUI - Function End"));
|
2004-10-27 23:19:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-10-14 17:11:57 +00:00
|
|
|
void CAdvancedFrame::OnWizardAttach( wxCommandEvent& WXUNUSED(event) ) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnWizardAttach - Function Begin"));
|
2005-11-14 23:12:07 +00:00
|
|
|
|
2009-10-14 17:11:57 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
2007-01-26 16:38:44 +00:00
|
|
|
|
|
|
|
wxASSERT(pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
2007-01-30 15:50:16 +00:00
|
|
|
|
2010-10-06 20:13:34 +00:00
|
|
|
if (!pDoc->IsUserAuthorized()) {
|
2009-10-14 17:11:57 +00:00
|
|
|
return;
|
2010-10-06 20:13:34 +00:00
|
|
|
}
|
2007-01-26 16:38:44 +00:00
|
|
|
|
2009-10-14 17:11:57 +00:00
|
|
|
if (pDoc->IsConnected()) {
|
2007-01-26 16:38:44 +00:00
|
|
|
|
2009-10-14 17:11:57 +00:00
|
|
|
// Stop all timers so that the wizard is the only thing doing anything
|
|
|
|
StopTimers();
|
2007-01-26 16:38:44 +00:00
|
|
|
|
2010-08-02 16:01:09 +00:00
|
|
|
CWizardAttach* pWizard = new CWizardAttach(this);
|
2007-01-26 16:38:44 +00:00
|
|
|
|
2009-10-14 17:11:57 +00:00
|
|
|
wxString strName = wxEmptyString;
|
|
|
|
wxString strURL = wxEmptyString;
|
2010-08-02 16:01:09 +00:00
|
|
|
wxString strTeamName = wxEmptyString;
|
|
|
|
pWizard->Run( strName, strURL, strTeamName, false );
|
2006-12-17 03:16:20 +00:00
|
|
|
|
2010-10-06 20:13:34 +00:00
|
|
|
if (pWizard) {
|
2009-10-14 17:11:57 +00:00
|
|
|
pWizard->Destroy();
|
2010-10-06 20:13:34 +00:00
|
|
|
}
|
2007-01-26 16:38:44 +00:00
|
|
|
|
2009-10-14 17:11:57 +00:00
|
|
|
DeleteMenu();
|
|
|
|
CreateMenu();
|
2004-10-28 07:03:06 +00:00
|
|
|
|
2009-10-14 17:11:57 +00:00
|
|
|
// Restart timers to continue normal operations.
|
|
|
|
StartTimers();
|
2007-01-26 16:38:44 +00:00
|
|
|
|
2009-10-14 17:11:57 +00:00
|
|
|
pDoc->ForceCacheUpdate();
|
|
|
|
FireRefreshView();
|
|
|
|
} else {
|
|
|
|
ShowNotCurrentlyConnectedAlert();
|
2007-08-18 00:22:21 +00:00
|
|
|
}
|
2006-06-23 08:20:08 +00:00
|
|
|
|
2009-10-14 17:11:57 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnWizardAttach - Function End"));
|
2006-06-23 08:20:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-10-14 17:11:57 +00:00
|
|
|
void CAdvancedFrame::OnWizardUpdate(wxCommandEvent& WXUNUSED(event)) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnWizardUpdate - Function Begin"));
|
2006-02-02 12:32:21 +00:00
|
|
|
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
wxASSERT(pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
|
2006-06-22 10:10:51 +00:00
|
|
|
if (!pDoc->IsUserAuthorized())
|
2006-02-02 12:32:21 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
if (pDoc->IsConnected()) {
|
2006-12-29 16:35:33 +00:00
|
|
|
// Stop all timers so that the wizard is the only thing doing anything
|
|
|
|
StopTimers();
|
2006-02-02 12:32:21 +00:00
|
|
|
|
2010-08-02 16:01:09 +00:00
|
|
|
CWizardAttach* pWizard = new CWizardAttach(this);
|
2006-02-02 12:32:21 +00:00
|
|
|
|
2009-05-15 08:21:04 +00:00
|
|
|
pWizard->SyncToAccountManager();
|
2006-02-02 12:32:21 +00:00
|
|
|
|
|
|
|
if (pWizard)
|
|
|
|
pWizard->Destroy();
|
|
|
|
|
2006-02-14 21:41:22 +00:00
|
|
|
DeleteMenu();
|
|
|
|
CreateMenu();
|
2008-10-08 08:50:18 +00:00
|
|
|
pDoc->ForceCacheUpdate();
|
2006-02-02 12:32:21 +00:00
|
|
|
FireRefreshView();
|
2006-02-17 20:59:15 +00:00
|
|
|
ResetReminderTimers();
|
2006-02-02 12:32:21 +00:00
|
|
|
|
2006-12-29 16:35:33 +00:00
|
|
|
// Restart timers to continue normal operations.
|
|
|
|
StartTimers();
|
2006-02-02 12:32:21 +00:00
|
|
|
} else {
|
|
|
|
ShowNotCurrentlyConnectedAlert();
|
|
|
|
}
|
|
|
|
|
2009-10-14 17:11:57 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnWizardUpdate - Function End"));
|
2006-02-02 12:32:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-10-14 17:11:57 +00:00
|
|
|
void CAdvancedFrame::OnWizardDetach(wxCommandEvent& WXUNUSED(event)) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnWizardDetach - Function Begin"));
|
2006-02-02 12:32:21 +00:00
|
|
|
|
2006-02-17 19:18:24 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
2007-08-16 20:06:50 +00:00
|
|
|
CSkinAdvanced* pSkinAdvanced = wxGetApp().GetSkinManager()->GetAdvanced();
|
2006-02-17 19:18:24 +00:00
|
|
|
wxInt32 iAnswer = 0;
|
|
|
|
wxString strTitle = wxEmptyString;
|
|
|
|
wxString strMessage = wxEmptyString;
|
|
|
|
ACCT_MGR_INFO ami;
|
2006-02-02 12:32:21 +00:00
|
|
|
|
|
|
|
wxASSERT(pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
2007-08-16 20:06:50 +00:00
|
|
|
wxASSERT(pSkinAdvanced);
|
|
|
|
wxASSERT(wxDynamicCast(pSkinAdvanced, CSkinAdvanced));
|
2006-02-02 12:32:21 +00:00
|
|
|
|
2006-06-22 10:10:51 +00:00
|
|
|
if (!pDoc->IsUserAuthorized())
|
2006-02-02 12:32:21 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
if (pDoc->IsConnected()) {
|
|
|
|
|
2006-02-17 19:18:24 +00:00
|
|
|
pDoc->rpc.acct_mgr_info(ami);
|
|
|
|
|
|
|
|
strTitle.Printf(
|
2010-10-06 16:04:22 +00:00
|
|
|
_("%s - Stop using %s"),
|
2007-08-16 20:06:50 +00:00
|
|
|
pSkinAdvanced->GetApplicationName().c_str(),
|
2006-06-14 07:14:09 +00:00
|
|
|
wxString(ami.acct_mgr_name.c_str(), wxConvUTF8).c_str()
|
2006-02-17 19:18:24 +00:00
|
|
|
);
|
|
|
|
strMessage.Printf(
|
2010-10-06 16:04:22 +00:00
|
|
|
_("If you stop using %s,\nyou'll keep all your current projects,\nbut you'll have to manage projects manually.\n\nDo you want to stop using %s?"),
|
2006-06-14 07:14:09 +00:00
|
|
|
wxString(ami.acct_mgr_name.c_str(), wxConvUTF8).c_str(),
|
|
|
|
wxString(ami.acct_mgr_name.c_str(), wxConvUTF8).c_str()
|
2006-02-17 19:18:24 +00:00
|
|
|
);
|
2006-02-02 12:32:21 +00:00
|
|
|
|
2008-08-20 16:07:06 +00:00
|
|
|
iAnswer = wxGetApp().SafeMessageBox(
|
2006-02-17 19:18:24 +00:00
|
|
|
strMessage,
|
|
|
|
strTitle,
|
|
|
|
wxYES_NO | wxICON_QUESTION,
|
|
|
|
this
|
|
|
|
);
|
2006-02-02 12:32:21 +00:00
|
|
|
|
2006-02-17 19:18:24 +00:00
|
|
|
if (wxYES == iAnswer) {
|
2006-03-01 10:10:22 +00:00
|
|
|
std::string url, name, passwd;
|
2006-02-17 19:18:24 +00:00
|
|
|
pDoc->rpc.acct_mgr_rpc(
|
2006-03-01 10:10:22 +00:00
|
|
|
url.c_str(),
|
|
|
|
name.c_str(),
|
|
|
|
passwd.c_str(),
|
2006-02-17 19:18:24 +00:00
|
|
|
false
|
|
|
|
);
|
|
|
|
}
|
2006-02-02 12:32:21 +00:00
|
|
|
|
2006-02-14 21:41:22 +00:00
|
|
|
DeleteMenu();
|
|
|
|
CreateMenu();
|
2008-10-08 08:50:18 +00:00
|
|
|
pDoc->ForceCacheUpdate();
|
2006-02-02 12:32:21 +00:00
|
|
|
FireRefreshView();
|
|
|
|
|
|
|
|
} else {
|
|
|
|
ShowNotCurrentlyConnectedAlert();
|
|
|
|
}
|
|
|
|
|
2009-10-14 17:11:57 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnWizardDetach - Function End"));
|
2006-02-02 12:32:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-10-14 17:11:57 +00:00
|
|
|
void CAdvancedFrame::OnActivitySelection(wxCommandEvent& event) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnActivitySelection - Function Begin"));
|
2005-09-06 08:58:56 +00:00
|
|
|
|
2009-10-14 17:11:57 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
2005-11-26 11:17:48 +00:00
|
|
|
|
|
|
|
wxASSERT(pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
|
2010-04-01 18:39:56 +00:00
|
|
|
if (event.IsChecked()) {
|
|
|
|
switch(event.GetId()) {
|
|
|
|
case ID_ADVACTIVITYRUNALWAYS:
|
|
|
|
pDoc->SetActivityRunMode(RUN_MODE_ALWAYS, 0);
|
|
|
|
break;
|
|
|
|
case ID_ADVACTIVITYSUSPEND:
|
|
|
|
pDoc->SetActivityRunMode(RUN_MODE_NEVER, 0);
|
|
|
|
break;
|
|
|
|
case ID_ADVACTIVITYRUNBASEDONPREPERENCES:
|
|
|
|
pDoc->SetActivityRunMode(RUN_MODE_AUTO, 0);
|
|
|
|
break;
|
|
|
|
}
|
2005-11-26 11:17:48 +00:00
|
|
|
}
|
2005-09-06 08:58:56 +00:00
|
|
|
|
2009-10-14 17:11:57 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnActivitySelection - Function End"));
|
2005-03-11 22:10:56 +00:00
|
|
|
}
|
|
|
|
|
2009-12-11 23:24:17 +00:00
|
|
|
void CAdvancedFrame::OnGPUSelection(wxCommandEvent& event) {
|
2010-04-01 18:39:56 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnGPUSelection - Function Begin"));
|
|
|
|
|
2009-12-11 23:24:17 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
wxASSERT(pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
|
2010-04-01 18:39:56 +00:00
|
|
|
if (event.IsChecked()) {
|
|
|
|
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;
|
|
|
|
}
|
2009-12-11 23:24:17 +00:00
|
|
|
}
|
2010-04-01 18:39:56 +00:00
|
|
|
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnGPUSelection - Function End"));
|
2009-12-11 23:24:17 +00:00
|
|
|
}
|
|
|
|
|
2005-03-11 22:10:56 +00:00
|
|
|
|
2009-10-14 17:11:57 +00:00
|
|
|
void CAdvancedFrame::OnNetworkSelection(wxCommandEvent& event) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnNetworkSelection - Function Begin"));
|
|
|
|
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
2005-10-05 19:01:28 +00:00
|
|
|
|
|
|
|
wxASSERT(pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
|
2010-04-01 18:39:56 +00:00
|
|
|
if (event.IsChecked()) {
|
|
|
|
switch(event.GetId()) {
|
|
|
|
case ID_ADVNETWORKRUNALWAYS:
|
|
|
|
pDoc->SetNetworkRunMode(RUN_MODE_ALWAYS, 0);
|
|
|
|
break;
|
|
|
|
case ID_ADVNETWORKSUSPEND:
|
|
|
|
pDoc->SetNetworkRunMode(RUN_MODE_NEVER, 0);
|
|
|
|
break;
|
|
|
|
case ID_ADVNETWORKRUNBASEDONPREPERENCES:
|
|
|
|
pDoc->SetNetworkRunMode(RUN_MODE_AUTO, 0);
|
|
|
|
break;
|
|
|
|
}
|
2009-10-14 17:11:57 +00:00
|
|
|
}
|
2005-10-05 19:01:28 +00:00
|
|
|
|
2009-10-14 17:11:57 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnNetworkSelection - Function End"));
|
2007-01-17 18:13:33 +00:00
|
|
|
}
|
|
|
|
|
2009-10-14 17:11:57 +00:00
|
|
|
|
|
|
|
void CAdvancedFrame::OnOptions(wxCommandEvent& WXUNUSED(event)) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnOptions - Function Begin"));
|
2004-12-03 20:30:24 +00:00
|
|
|
|
2011-03-07 15:19:39 +00:00
|
|
|
CDlgOptions dlg(this);
|
|
|
|
dlg.ShowModal();
|
2004-10-25 00:56:16 +00:00
|
|
|
|
2009-10-14 17:11:57 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnOptions - Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CAdvancedFrame::OnPreferences(wxCommandEvent& WXUNUSED(event)) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnPreferences - Function Begin"));
|
|
|
|
|
|
|
|
CDlgAdvPreferences dlg(this);
|
|
|
|
dlg.ShowModal();
|
|
|
|
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnPreferences - Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CAdvancedFrame::OnSelectComputer(wxCommandEvent& WXUNUSED(event)) {
|
2010-08-11 12:18:07 +00:00
|
|
|
wxString hostName = wxEmptyString;
|
|
|
|
int portNum = GUI_RPC_PORT;
|
|
|
|
wxString password = wxEmptyString;
|
2009-10-14 17:11:57 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
long lRetVal = -1;
|
|
|
|
|
|
|
|
wxASSERT(pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
|
2010-08-11 12:18:07 +00:00
|
|
|
if (SelectComputer(hostName, portNum, password, false)) {
|
|
|
|
if (pDoc->IsComputerNameLocal(hostName)) {
|
2009-10-14 17:11:57 +00:00
|
|
|
lRetVal = pDoc->Connect(
|
|
|
|
wxT("localhost"),
|
|
|
|
GUI_RPC_PORT,
|
|
|
|
wxEmptyString,
|
|
|
|
TRUE,
|
|
|
|
TRUE
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
// Connect to the remote machine
|
|
|
|
long lPort = GUI_RPC_PORT;
|
2010-08-11 12:18:07 +00:00
|
|
|
int iPos = hostName.Find(wxT(":"));
|
2009-10-14 17:11:57 +00:00
|
|
|
if (iPos != wxNOT_FOUND) {
|
2010-08-11 12:18:07 +00:00
|
|
|
wxString sPort = hostName.substr(iPos + 1);
|
2009-10-14 17:11:57 +00:00
|
|
|
if (!sPort.ToLong(&lPort)) lPort = GUI_RPC_PORT;
|
2010-08-11 12:18:07 +00:00
|
|
|
hostName.erase(iPos);
|
2009-10-14 17:11:57 +00:00
|
|
|
}
|
|
|
|
lRetVal = pDoc->Connect(
|
2010-08-11 12:18:07 +00:00
|
|
|
hostName,
|
|
|
|
portNum,
|
|
|
|
password,
|
2009-10-14 17:11:57 +00:00
|
|
|
TRUE,
|
|
|
|
FALSE
|
|
|
|
);
|
|
|
|
}
|
|
|
|
if (lRetVal) {
|
|
|
|
ShowConnectionFailedAlert();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CAdvancedFrame::OnClientShutdown(wxCommandEvent& WXUNUSED(event)) {
|
|
|
|
wxCommandEvent evtSelectNewComputer(wxEVT_COMMAND_MENU_SELECTED, ID_SELECTCOMPUTER);
|
|
|
|
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"));
|
|
|
|
|
|
|
|
wxASSERT(pDoc);
|
|
|
|
wxASSERT(pSkinAdvanced);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
wxASSERT(wxDynamicCast(pSkinAdvanced, CSkinAdvanced));
|
|
|
|
|
|
|
|
|
|
|
|
// Stop all timers
|
|
|
|
StopTimers();
|
|
|
|
|
|
|
|
|
|
|
|
// %s is the application name
|
|
|
|
// i.e. 'BOINC Manager', 'GridRepublic Manager'
|
|
|
|
strDialogTitle.Printf(
|
2009-11-01 00:34:12 +00:00
|
|
|
_("%s - Shut down the current client..."),
|
2009-10-14 17:11:57 +00:00
|
|
|
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(
|
2009-11-01 00:34:12 +00:00
|
|
|
_("%s will shut down the current client\nand prompt you for another host to connect to."),
|
2009-10-14 17:11:57 +00:00
|
|
|
pSkinAdvanced->GetApplicationName().c_str()
|
|
|
|
);
|
|
|
|
|
|
|
|
dlg.SetTitle(strDialogTitle);
|
|
|
|
dlg.m_DialogMessage->SetLabel(strDialogMessage);
|
|
|
|
dlg.Fit();
|
|
|
|
dlg.Centre();
|
|
|
|
|
|
|
|
if (wxID_OK == dlg.ShowModal()) {
|
|
|
|
pDoc->CoreClientQuit();
|
|
|
|
pDoc->ForceDisconnect();
|
|
|
|
|
|
|
|
// Since the core cliet we were connected to just shutdown, prompt for a new one.
|
|
|
|
ProcessEvent(evtSelectNewComputer);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Restart timers
|
|
|
|
StartTimers();
|
|
|
|
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnClientShutdown - Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CAdvancedFrame::OnRunBenchmarks(wxCommandEvent& WXUNUSED(event)) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnRunBenchmarks - Function Begin"));
|
|
|
|
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
wxASSERT(m_pNotebook);
|
|
|
|
wxASSERT(pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
|
2010-11-22 20:35:47 +00:00
|
|
|
m_pNotebook->SetSelection(ID_ADVTASKSVIEW - ID_ADVVIEWBASE);
|
2009-10-14 17:11:57 +00:00
|
|
|
pDoc->RunBenchmarks();
|
|
|
|
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnRunBenchmarks - Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CAdvancedFrame::OnRetryCommunications( wxCommandEvent& WXUNUSED(event) ) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnRetryCommunications - Function Begin"));
|
|
|
|
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
wxASSERT(pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
|
|
|
|
pDoc->rpc.network_available();
|
|
|
|
|
|
|
|
FireRefreshView();
|
|
|
|
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnRetryCommunications - Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CAdvancedFrame::OnReadConfig(wxCommandEvent& WXUNUSED(event)) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnReadConfig - Function Begin"));
|
|
|
|
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
wxASSERT(pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
|
|
|
|
pDoc->rpc.read_cc_config();
|
|
|
|
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnReadConfig - Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CAdvancedFrame::OnReadPreferences(wxCommandEvent& WXUNUSED(event)) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnReadPreferences - Function Begin"));
|
|
|
|
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
wxASSERT(pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
|
|
|
|
pDoc->rpc.read_global_prefs_override();
|
|
|
|
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnReadPreferences - Function End"));
|
2004-04-11 04:12:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-12-19 00:49:51 +00:00
|
|
|
void CAdvancedFrame::OnEventLog(wxCommandEvent& WXUNUSED(event)) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnEventLog - Function Begin"));
|
|
|
|
|
2009-12-22 20:15:55 +00:00
|
|
|
wxGetApp().DisplayEventLog();
|
2009-12-19 00:49:51 +00:00
|
|
|
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnEventLog - Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-10-06 11:13:07 +00:00
|
|
|
void CAdvancedFrame::OnLaunchNewInstance(wxCommandEvent& WXUNUSED(event)) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnLaunchNewInstance - Function Begin"));
|
|
|
|
|
2010-10-13 21:02:42 +00:00
|
|
|
#ifndef __WXMAC__
|
|
|
|
#ifdef __WXMSW__
|
|
|
|
HANDLE prog;
|
|
|
|
#else
|
|
|
|
int prog;
|
|
|
|
#endif
|
|
|
|
int argc = 3;
|
2011-06-07 16:20:59 +00:00
|
|
|
char* const argv[3] = {
|
|
|
|
const_cast<char *>("boincmgr"),
|
|
|
|
const_cast<char *>("--multiple"),
|
|
|
|
const_cast<char *>("")
|
|
|
|
};
|
2010-10-13 21:02:42 +00:00
|
|
|
|
2010-10-15 18:07:32 +00:00
|
|
|
wxString strExecutable = wxGetApp().GetRootDirectory() + wxGetApp().GetExecutableName();
|
2010-10-13 21:02:42 +00:00
|
|
|
|
|
|
|
run_program(
|
|
|
|
wxGetApp().GetRootDirectory().mb_str(),
|
|
|
|
strExecutable.mb_str(),
|
|
|
|
argc,
|
|
|
|
argv,
|
|
|
|
2.0,
|
|
|
|
prog
|
|
|
|
);
|
|
|
|
#else
|
2010-10-06 11:13:07 +00:00
|
|
|
char s[512];
|
|
|
|
unsigned char procName[256];
|
|
|
|
ProcessSerialNumber myPSN;
|
|
|
|
GetCurrentProcess(&myPSN);
|
|
|
|
ProcessInfoRec pInfo;
|
|
|
|
OSStatus err;
|
|
|
|
|
|
|
|
memset(&pInfo, 0, sizeof(pInfo));
|
|
|
|
pInfo.processInfoLength = sizeof( ProcessInfoRec );
|
|
|
|
pInfo.processName = procName;
|
|
|
|
err = GetProcessInformation(&myPSN, &pInfo);
|
|
|
|
if (!err) {
|
|
|
|
procName[procName[0]+1] = '\0'; // Convert pascal string to C string
|
|
|
|
sprintf(s, "open -n \"/Applications/%s.app\" --args --multiple", procName+1);
|
|
|
|
system(s);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnLaunchNewInstance - Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-06-24 05:00:57 +00:00
|
|
|
void CAdvancedFrame::OnHelp(wxHelpEvent& event) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnHelpBOINCManager - Function Begin"));
|
2005-05-05 06:07:14 +00:00
|
|
|
|
|
|
|
if (IsShown()) {
|
2009-01-15 18:57:44 +00:00
|
|
|
wxString strURL = wxGetApp().GetSkinManager()->GetAdvanced()->GetOrganizationHelpUrl();
|
2006-12-12 01:08:16 +00:00
|
|
|
|
|
|
|
wxString wxurl;
|
2007-08-16 18:53:42 +00:00
|
|
|
wxurl.Printf(
|
|
|
|
wxT("%s?target=advanced&version=%s&controlid=%d"),
|
2009-01-15 18:57:44 +00:00
|
|
|
strURL.c_str(),
|
2007-10-29 12:41:16 +00:00
|
|
|
wxString(BOINC_VERSION_STRING, wxConvUTF8).c_str(),
|
2007-08-16 18:53:42 +00:00
|
|
|
event.GetId()
|
|
|
|
);
|
2009-12-19 05:16:41 +00:00
|
|
|
wxLaunchDefaultBrowser(wxurl);
|
2005-05-05 06:07:14 +00:00
|
|
|
}
|
|
|
|
|
2006-06-24 05:00:57 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnHelpBOINCManager - Function End"));
|
2005-05-05 06:07:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-04-03 13:14:30 +00:00
|
|
|
void CAdvancedFrame::OnHelpBOINC(wxCommandEvent& event) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnHelpBOINC - Function Begin"));
|
2005-06-17 04:53:35 +00:00
|
|
|
|
|
|
|
if (IsShown()) {
|
2009-01-15 18:57:44 +00:00
|
|
|
wxString strURL = wxGetApp().GetSkinManager()->GetAdvanced()->GetOrganizationHelpUrl();
|
2006-12-12 01:08:16 +00:00
|
|
|
|
2006-12-20 02:33:04 +00:00
|
|
|
wxString wxurl;
|
2007-04-03 13:14:30 +00:00
|
|
|
wxurl.Printf(
|
2007-08-16 18:53:42 +00:00
|
|
|
wxT("%s?target=advanced&version=%s&controlid=%d"),
|
2009-01-15 18:57:44 +00:00
|
|
|
strURL.c_str(),
|
2007-10-29 12:41:16 +00:00
|
|
|
wxString(BOINC_VERSION_STRING, wxConvUTF8).c_str(),
|
2007-04-03 13:14:30 +00:00
|
|
|
event.GetId()
|
|
|
|
);
|
2009-12-19 05:16:41 +00:00
|
|
|
wxLaunchDefaultBrowser(wxurl);
|
2005-05-05 06:07:14 +00:00
|
|
|
}
|
|
|
|
|
2007-04-03 13:14:30 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnHelpBOINC - Function End"));
|
2005-05-05 06:07:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-06-24 05:00:57 +00:00
|
|
|
void CAdvancedFrame::OnHelpAbout(wxCommandEvent& WXUNUSED(event)) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnHelpAbout - Function Begin"));
|
2004-12-03 20:30:24 +00:00
|
|
|
|
2006-11-22 09:51:59 +00:00
|
|
|
CDlgAbout dlg(this);
|
|
|
|
dlg.ShowModal();
|
2004-12-03 20:30:24 +00:00
|
|
|
|
2006-06-24 05:00:57 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnHelpAbout - Function End"));
|
2004-04-10 09:11:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-06-24 05:00:57 +00:00
|
|
|
void CAdvancedFrame::OnRefreshView(CFrameEvent& WXUNUSED(event)) {
|
2009-03-09 18:02:37 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnRefreshView - Function Begin"));
|
2006-06-23 08:20:08 +00:00
|
|
|
|
2009-03-09 18:02:37 +00:00
|
|
|
if (IsShown()) {
|
2010-07-22 20:55:39 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
2009-03-09 18:02:37 +00:00
|
|
|
CBOINCBaseView* pView = NULL;
|
|
|
|
wxTimerEvent timerEvent;
|
2010-07-22 20:55:39 +00:00
|
|
|
wxString strTabTitle = wxEmptyString;
|
|
|
|
int iCount = 0;
|
2010-07-23 15:25:39 +00:00
|
|
|
static int iLastCount = 0;
|
2006-06-23 08:20:08 +00:00
|
|
|
|
2009-03-09 18:02:37 +00:00
|
|
|
wxASSERT(m_pNotebook);
|
2010-07-22 20:55:39 +00:00
|
|
|
wxASSERT(pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
|
|
|
|
// Force update the notice tab text
|
|
|
|
pView = wxDynamicCast(m_pNotebook->GetPage(ID_ADVNOTICESVIEW - ID_ADVVIEWBASE), CBOINCBaseView);
|
|
|
|
iCount = pDoc->GetUnreadNoticeCount();
|
2010-07-23 15:25:39 +00:00
|
|
|
if (iLastCount != iCount) {
|
|
|
|
iLastCount = iCount;
|
2006-06-23 08:20:08 +00:00
|
|
|
|
2010-07-23 15:25:39 +00:00
|
|
|
if (iCount) {
|
|
|
|
strTabTitle.Printf(wxT("%s (%d)"), pView->GetViewDisplayName().c_str(), iCount);
|
|
|
|
} else {
|
|
|
|
strTabTitle = pView->GetViewDisplayName();
|
|
|
|
}
|
|
|
|
|
|
|
|
m_pNotebook->SetPageText(ID_ADVNOTICESVIEW - ID_ADVVIEWBASE, strTabTitle);
|
2011-04-19 15:26:15 +00:00
|
|
|
m_pNotebook->Layout();
|
2010-07-23 15:25:39 +00:00
|
|
|
}
|
2006-06-23 08:20:08 +00:00
|
|
|
|
2005-06-24 10:49:42 +00:00
|
|
|
|
2010-07-22 20:55:39 +00:00
|
|
|
// Update current tab contents
|
|
|
|
pView = wxDynamicCast(m_pNotebook->GetPage(m_pNotebook->GetSelection()), CBOINCBaseView);
|
2009-03-09 18:02:37 +00:00
|
|
|
pView->FireOnListRender(timerEvent);
|
2006-06-23 08:20:08 +00:00
|
|
|
}
|
2009-03-09 18:02:37 +00:00
|
|
|
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnRefreshView - Function End"));
|
2005-06-17 04:53:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-06-24 05:00:57 +00:00
|
|
|
void CAdvancedFrame::OnConnect(CFrameEvent& WXUNUSED(event)) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnConnect - Function Begin"));
|
2005-04-08 04:23:37 +00:00
|
|
|
|
2006-10-20 15:00:14 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
CSkinAdvanced* pSkinAdvanced = wxGetApp().GetSkinManager()->GetAdvanced();
|
2010-08-02 16:01:09 +00:00
|
|
|
CWizardAttach* pWizard = NULL;
|
2006-05-02 09:31:04 +00:00
|
|
|
wxString strComputer = wxEmptyString;
|
2006-03-07 21:31:07 +00:00
|
|
|
wxString strName = wxEmptyString;
|
|
|
|
wxString strURL = wxEmptyString;
|
2010-08-02 16:01:09 +00:00
|
|
|
wxString strTeamName = wxEmptyString;
|
2006-08-03 09:14:31 +00:00
|
|
|
wxString strDialogTitle = wxEmptyString;
|
|
|
|
wxString strDialogDescription = wxEmptyString;
|
2006-03-07 21:31:07 +00:00
|
|
|
bool bCachedCredentials = false;
|
|
|
|
ACCT_MGR_INFO ami;
|
|
|
|
PROJECT_INIT_STATUS pis;
|
2010-08-11 17:05:18 +00:00
|
|
|
CC_STATUS status;
|
2008-09-04 13:00:24 +00:00
|
|
|
wxWindow* pwndNotebookPage = NULL;
|
|
|
|
CBOINCBaseView* pView = NULL;
|
|
|
|
int iItemCount = 0, iIndex;
|
2009-06-14 10:27:22 +00:00
|
|
|
int wasShown = 0;
|
2004-12-03 20:30:24 +00:00
|
|
|
|
2005-04-08 16:58:55 +00:00
|
|
|
wxASSERT(m_pNotebook);
|
|
|
|
wxASSERT(pDoc);
|
2006-10-20 15:00:14 +00:00
|
|
|
wxASSERT(pSkinAdvanced);
|
2005-04-08 04:23:37 +00:00
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
2006-10-20 15:00:14 +00:00
|
|
|
wxASSERT(wxDynamicCast(pSkinAdvanced, CSkinAdvanced));
|
2004-09-25 21:33:24 +00:00
|
|
|
|
2008-09-03 23:50:34 +00:00
|
|
|
pDoc->GetCoreClientStatus(status, true);
|
2007-08-07 20:10:36 +00:00
|
|
|
|
|
|
|
// Do we need to bug out to the simple view?
|
|
|
|
if (status.simple_gui_only) {
|
|
|
|
wxGetApp().SetActiveGUI(BOINC_SIMPLEGUI, true);
|
2010-07-14 11:35:51 +00:00
|
|
|
StartTimers();
|
2008-10-28 00:02:28 +00:00
|
|
|
FireConnect();
|
2007-08-07 20:10:36 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-12-29 16:35:33 +00:00
|
|
|
// Stop all timers so that the wizard is the only thing doing anything
|
|
|
|
StopTimers();
|
2004-10-26 01:59:44 +00:00
|
|
|
|
2006-05-02 09:31:04 +00:00
|
|
|
|
|
|
|
// If we are connected to the localhost, run a really quick screensaver
|
|
|
|
// test to trigger a firewall popup.
|
|
|
|
pDoc->GetConnectedComputerName(strComputer);
|
|
|
|
if (pDoc->IsComputerNameLocal(strComputer)) {
|
|
|
|
wxGetApp().StartBOINCScreensaverTest();
|
2009-10-14 17:11:57 +00:00
|
|
|
wxGetApp().StartBOINCDefaultScreensaverTest();
|
2006-05-02 09:31:04 +00:00
|
|
|
}
|
|
|
|
|
2008-09-04 13:00:24 +00:00
|
|
|
// Clear selected rows in all tab pages when connecting to a different host
|
|
|
|
iItemCount = (int)m_pNotebook->GetPageCount() - 1;
|
|
|
|
for (iIndex = 0; iIndex <= iItemCount; iIndex++) {
|
|
|
|
pwndNotebookPage = m_pNotebook->GetPage(iIndex);
|
|
|
|
wxASSERT(wxDynamicCast(pwndNotebookPage, CBOINCBaseView));
|
|
|
|
|
|
|
|
pView = wxDynamicCast(pwndNotebookPage, CBOINCBaseView);
|
|
|
|
wxASSERT(pView);
|
|
|
|
|
|
|
|
pView->ClearSelections();
|
|
|
|
}
|
|
|
|
|
2008-09-05 07:08:05 +00:00
|
|
|
pDoc->RefreshRPCs();
|
2008-09-03 23:50:34 +00:00
|
|
|
pDoc->ForceCacheUpdate();
|
2006-05-02 09:31:04 +00:00
|
|
|
|
2008-01-16 22:10:34 +00:00
|
|
|
pDoc->rpc.get_project_init_status(pis);
|
2006-03-07 21:31:07 +00:00
|
|
|
pDoc->rpc.acct_mgr_info(ami);
|
|
|
|
if (ami.acct_mgr_url.size() && !ami.have_credentials) {
|
2009-06-14 10:27:22 +00:00
|
|
|
if (IsShown()) {
|
|
|
|
wasShown = 1;
|
|
|
|
} else {
|
2006-04-14 03:09:24 +00:00
|
|
|
Show();
|
|
|
|
}
|
|
|
|
|
2010-08-02 16:01:09 +00:00
|
|
|
pWizard = new CWizardAttach(this);
|
|
|
|
if (pWizard->SyncToAccountManager()) {
|
2009-03-06 23:03:47 +00:00
|
|
|
|
|
|
|
#if defined(__WXMSW__) || defined(__WXMAC__)
|
2009-06-14 10:27:22 +00:00
|
|
|
// If successful, hide the main window if we showed it
|
|
|
|
if (!wasShown) {
|
|
|
|
Hide();
|
|
|
|
}
|
2009-03-06 23:03:47 +00:00
|
|
|
#endif
|
2006-08-03 09:14:31 +00:00
|
|
|
|
|
|
|
// %s is the application name
|
|
|
|
// i.e. 'BOINC Manager', 'GridRepublic Manager'
|
|
|
|
strDialogTitle.Printf(
|
|
|
|
_("%s"),
|
2006-10-20 15:00:14 +00:00
|
|
|
pSkinAdvanced->GetApplicationName().c_str()
|
2006-08-03 09:14:31 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
// %s is the application name
|
|
|
|
// i.e. 'BOINC Manager', 'GridRepublic Manager'
|
|
|
|
// %s is the project name
|
|
|
|
// i.e. 'BOINC', 'GridRepublic'
|
|
|
|
strDialogDescription.Printf(
|
2010-10-06 20:13:34 +00:00
|
|
|
_("%s has successfully added %s"),
|
2006-10-20 15:00:14 +00:00
|
|
|
pSkinAdvanced->GetApplicationName().c_str(),
|
2007-08-16 18:53:42 +00:00
|
|
|
pSkinAdvanced->GetApplicationShortName().c_str()
|
2006-08-03 09:14:31 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
ShowAlert(
|
|
|
|
strDialogTitle,
|
|
|
|
strDialogDescription,
|
|
|
|
wxOK | wxICON_INFORMATION,
|
|
|
|
true
|
|
|
|
);
|
2005-09-27 09:55:54 +00:00
|
|
|
} else {
|
2009-12-18 22:44:10 +00:00
|
|
|
// If failure, display the notification tab
|
2010-01-12 18:57:38 +00:00
|
|
|
m_pNotebook->SetSelection(ID_ADVNOTICESVIEW - ID_ADVVIEWBASE);
|
2006-03-07 21:31:07 +00:00
|
|
|
}
|
2008-01-21 15:57:33 +00:00
|
|
|
} else if ((pis.url.size() || (0 >= pDoc->GetProjectCount())) && !status.disallow_attach) {
|
2006-04-14 03:09:24 +00:00
|
|
|
if (!IsShown()) {
|
|
|
|
Show();
|
|
|
|
}
|
|
|
|
|
2010-08-02 16:01:09 +00:00
|
|
|
pWizard = new CWizardAttach(this);
|
2006-03-23 01:17:07 +00:00
|
|
|
strName = wxString(pis.name.c_str(), wxConvUTF8);
|
|
|
|
strURL = wxString(pis.url.c_str(), wxConvUTF8);
|
2010-08-02 16:01:09 +00:00
|
|
|
strTeamName = wxString(pis.team_name.c_str(), wxConvUTF8);
|
2006-03-07 21:31:07 +00:00
|
|
|
bCachedCredentials = pis.url.length() && pis.has_account_key;
|
|
|
|
|
2010-08-02 16:01:09 +00:00
|
|
|
if (pWizard->Run(strName, strURL, strTeamName, bCachedCredentials)) {
|
2006-03-07 21:31:07 +00:00
|
|
|
// If successful, display the work tab
|
2010-06-02 19:08:59 +00:00
|
|
|
m_pNotebook->SetSelection(ID_ADVTASKSVIEW - ID_ADVVIEWBASE);
|
2006-03-07 21:31:07 +00:00
|
|
|
} else {
|
2010-06-02 19:08:59 +00:00
|
|
|
// If failure, display the notices tab
|
|
|
|
m_pNotebook->SetSelection(ID_ADVNOTICESVIEW - ID_ADVVIEWBASE);
|
2005-09-27 09:55:54 +00:00
|
|
|
}
|
2006-03-07 21:31:07 +00:00
|
|
|
}
|
2005-09-27 09:55:54 +00:00
|
|
|
|
2010-01-06 12:41:26 +00:00
|
|
|
// Update the menus
|
|
|
|
DeleteMenu();
|
|
|
|
CreateMenu();
|
|
|
|
#ifdef __WXMAC__
|
|
|
|
wxGetApp().GetMacSystemMenu()->BuildMenu();
|
|
|
|
#endif
|
2006-12-29 16:35:33 +00:00
|
|
|
|
|
|
|
// Restart timers to continue normal operations.
|
|
|
|
StartTimers();
|
2004-10-21 14:29:59 +00:00
|
|
|
|
- fixes #207 - HTML entities in BOINC Manager have to be decoded
BOINC Manager can now properly decode HTML entites for the
following elements:
Projects Tab:
Project Name
User Name
Team Name
Work Tab:
Project Name
Application Name
Transfers Tab:
Project Name
Messages Tab:
Project Name
Disk Tab:
Project Name
- fixes #212 - Info in columns misaligned on switching views
- Properly restore which tab view the user left from when going
to the advanced view from the simple view
- Fix the problem that caused the manager to wait for 7 seconds
to display anything on initial startup.
- Store the various Grid/List persisted data seperately so that
the different header sizes don't cause problems.
clientgui/
AdvancedFrame.cpp
BOINCBaseView.cpp, .h
BOINCGridCtrl.cpp
ViewMessages.cpp, .h
ViewMessagesGrid.cpp, .h
ViewProjects.cpp, .h
ViewProjectsGrid.cpp, .h
ViewResources.cpp, .h
ViewStatistics.cpp, .h
ViewTransfers.cpp, .h
ViewTransfersGrid.cpp, .h
ViewWork.cpp, .h
ViewWorkGrid.cpp, .h
lib/
gui_rpc_client_ops.C
svn path=/trunk/boinc/; revision=12761
2007-05-29 05:07:35 +00:00
|
|
|
|
|
|
|
// Set the correct refresh interval, then manually fire the refresh
|
|
|
|
// event to do the initial population of the view.
|
|
|
|
UpdateRefreshTimerInterval(m_pNotebook->GetSelection());
|
|
|
|
FireRefreshView();
|
|
|
|
|
|
|
|
|
2010-08-02 16:01:09 +00:00
|
|
|
if (pWizard)
|
|
|
|
pWizard->Destroy();
|
2005-08-25 22:00:39 +00:00
|
|
|
|
2006-06-24 05:00:57 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnConnect - Function End"));
|
2005-04-08 04:23:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-12-18 22:44:10 +00:00
|
|
|
void CAdvancedFrame::OnNotification(CFrameEvent& WXUNUSED(event)) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnNotification - Function Begin"));
|
|
|
|
|
2010-01-12 18:57:38 +00:00
|
|
|
m_pNotebook->SetSelection(ID_ADVNOTICESVIEW - ID_ADVVIEWBASE);
|
2009-12-18 22:44:10 +00:00
|
|
|
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnNotification - Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-06-24 05:00:57 +00:00
|
|
|
void CAdvancedFrame::OnUpdateStatus(CFrameEvent& event) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnUpdateStatus - Function Begin"));
|
2005-04-08 04:23:37 +00:00
|
|
|
|
2006-06-23 08:20:08 +00:00
|
|
|
m_pStatusbar->SetStatusText(event.m_message);
|
|
|
|
::wxSleep(0);
|
2005-04-08 04:23:37 +00:00
|
|
|
|
2006-06-24 05:00:57 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnUpdateStatus - Function End"));
|
2004-09-25 21:33:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-03-09 18:02:37 +00:00
|
|
|
void CAdvancedFrame::OnRefreshState(wxTimerEvent& WXUNUSED(event)) {
|
2009-03-09 05:00:58 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnRefreshState - Function Begin"));
|
2005-03-31 23:54:12 +00:00
|
|
|
|
2009-03-05 23:10:24 +00:00
|
|
|
// Write a snapshot of the current state to the config
|
|
|
|
// module, on Win9x systems we don't always shutdown
|
|
|
|
// in a nice way, if we are terminated by the user
|
|
|
|
// we still want the UI state to have been stored
|
|
|
|
// for their next use
|
|
|
|
SaveState();
|
2005-03-07 23:52:28 +00:00
|
|
|
|
2009-03-09 05:00:58 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnRefreshState - Function End"));
|
2005-03-07 23:52:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-03-09 18:02:37 +00:00
|
|
|
void CAdvancedFrame::OnFrameRender(wxTimerEvent& WXUNUSED(event)) {
|
2007-08-07 20:10:36 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
wxMenuBar* pMenuBar = GetMenuBar();
|
|
|
|
|
2009-03-05 23:10:24 +00:00
|
|
|
if (m_pFrameRenderTimer->IsRunning()) {
|
2005-04-07 07:04:50 +00:00
|
|
|
if (IsShown()) {
|
2005-04-27 06:55:28 +00:00
|
|
|
if (pDoc) {
|
2005-03-12 01:09:24 +00:00
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
2007-08-07 20:10:36 +00:00
|
|
|
wxASSERT(wxDynamicCast(pMenuBar, wxMenuBar));
|
2006-09-12 09:29:03 +00:00
|
|
|
wxASSERT(wxDynamicCast(m_pStatusbar, CStatusBar));
|
2005-03-09 19:15:20 +00:00
|
|
|
|
2005-03-12 01:09:24 +00:00
|
|
|
// Update the menu bar
|
2006-08-31 19:24:38 +00:00
|
|
|
CC_STATUS status;
|
|
|
|
if ((pDoc->IsConnected()) && (0 == pDoc->GetCoreClientStatus(status))) {
|
2006-09-12 09:29:03 +00:00
|
|
|
UpdateActivityModeControls(status);
|
2011-06-22 11:24:23 +00:00
|
|
|
if (pDoc->state.have_nvidia || pDoc->state.have_ati) {
|
2009-12-12 07:11:50 +00:00
|
|
|
UpdateGPUModeControls(status);
|
|
|
|
}
|
2006-09-12 09:29:03 +00:00
|
|
|
UpdateNetworkModeControls(status);
|
2007-08-07 20:10:36 +00:00
|
|
|
|
|
|
|
if (status.disallow_attach) {
|
2009-10-14 17:11:57 +00:00
|
|
|
pMenuBar->Enable(ID_WIZARDATTACH, false);
|
2007-08-07 20:10:36 +00:00
|
|
|
}
|
2005-03-12 01:09:24 +00:00
|
|
|
}
|
2005-03-09 19:15:20 +00:00
|
|
|
|
2005-03-12 01:09:24 +00:00
|
|
|
// Update the statusbar
|
2005-04-07 07:04:50 +00:00
|
|
|
if (pDoc->IsConnected() || pDoc->IsReconnecting()) {
|
2005-03-12 01:09:24 +00:00
|
|
|
m_pStatusbar->m_pbmpConnected->Show();
|
|
|
|
m_pStatusbar->m_ptxtConnected->Show();
|
|
|
|
m_pStatusbar->m_pbmpDisconnect->Hide();
|
|
|
|
m_pStatusbar->m_ptxtDisconnect->Hide();
|
|
|
|
|
|
|
|
wxString strBuffer = wxEmptyString;
|
2005-04-06 23:28:49 +00:00
|
|
|
wxString strComputerName = wxEmptyString;
|
2007-05-03 16:17:54 +00:00
|
|
|
wxString strComputerVersion = wxEmptyString;
|
2005-03-12 01:09:24 +00:00
|
|
|
wxString strStatusText = wxEmptyString;
|
|
|
|
wxString strTitle = m_strBaseTitle;
|
|
|
|
|
2007-01-19 23:45:19 +00:00
|
|
|
if (pDoc->IsReconnecting()) {
|
2005-04-07 07:04:50 +00:00
|
|
|
pDoc->GetConnectingComputerName(strComputerName);
|
2007-01-19 23:45:19 +00:00
|
|
|
} else {
|
2005-04-07 07:04:50 +00:00
|
|
|
pDoc->GetConnectedComputerName(strComputerName);
|
2007-05-03 16:17:54 +00:00
|
|
|
pDoc->GetConnectedComputerVersion(strComputerVersion);
|
2007-01-19 23:45:19 +00:00
|
|
|
}
|
2005-04-06 23:28:49 +00:00
|
|
|
|
2005-11-27 01:28:56 +00:00
|
|
|
if (pDoc->IsComputerNameLocal(strComputerName)) {
|
2010-09-23 18:35:06 +00:00
|
|
|
strTitle.Printf(wxT("%s"), m_strBaseTitle.c_str());
|
|
|
|
} else {
|
|
|
|
strTitle.Printf(_("%s - (%s)"), m_strBaseTitle.c_str(), strComputerName.c_str());
|
2005-03-12 01:09:24 +00:00
|
|
|
}
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
if (pDoc->IsReconnecting()) {
|
2005-04-06 23:28:49 +00:00
|
|
|
strStatusText.Printf(_("Connecting to %s"), strComputerName.c_str());
|
2005-04-07 07:04:50 +00:00
|
|
|
} else {
|
2007-05-03 16:17:54 +00:00
|
|
|
strStatusText.Printf(
|
|
|
|
_("Connected to %s (%s)"),
|
|
|
|
strComputerName.c_str(),
|
|
|
|
strComputerVersion.c_str()
|
|
|
|
);
|
2005-04-06 23:28:49 +00:00
|
|
|
}
|
2005-03-12 01:09:24 +00:00
|
|
|
|
2005-08-30 11:34:27 +00:00
|
|
|
// The Mac takes a huge performance hit redrawing this window,
|
2005-05-25 03:36:16 +00:00
|
|
|
// window, so don't change the text unless we really have too.
|
2008-04-17 16:18:16 +00:00
|
|
|
if (GetTitle() != strTitle) {
|
2005-08-30 11:34:27 +00:00
|
|
|
SetTitle(strTitle);
|
2008-04-17 16:18:16 +00:00
|
|
|
}
|
2009-03-09 05:00:58 +00:00
|
|
|
if (m_pStatusbar->m_ptxtConnected->GetLabel() != strStatusText) {
|
2005-05-25 03:36:16 +00:00
|
|
|
m_pStatusbar->m_ptxtConnected->SetLabel(strStatusText);
|
|
|
|
}
|
2005-04-07 07:04:50 +00:00
|
|
|
} else {
|
2005-03-12 01:09:24 +00:00
|
|
|
m_pStatusbar->m_pbmpConnected->Hide();
|
|
|
|
m_pStatusbar->m_ptxtConnected->Hide();
|
|
|
|
m_pStatusbar->m_pbmpDisconnect->Show();
|
|
|
|
m_pStatusbar->m_ptxtDisconnect->Show();
|
2005-04-08 04:23:37 +00:00
|
|
|
|
2005-08-30 11:34:27 +00:00
|
|
|
if (GetTitle() != m_strBaseTitle)
|
|
|
|
SetTitle(m_strBaseTitle);
|
2005-01-10 20:24:09 +00:00
|
|
|
}
|
2004-10-28 22:51:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2004-09-25 21:33:24 +00:00
|
|
|
|
|
|
|
|
2006-06-24 05:00:57 +00:00
|
|
|
void CAdvancedFrame::OnNotebookSelectionChanged(wxNotebookEvent& event) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnNotebookSelectionChanged - Function Begin"));
|
2004-10-21 14:29:59 +00:00
|
|
|
|
2008-11-12 09:30:22 +00:00
|
|
|
wxWindow* pwndNotebookPage = NULL;
|
|
|
|
CBOINCBaseView* pView = NULL;
|
|
|
|
int selection = event.GetSelection();
|
|
|
|
|
|
|
|
if ((-1 != selection)) {
|
|
|
|
UpdateRefreshTimerInterval(selection);
|
2008-07-29 13:06:28 +00:00
|
|
|
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
|
2008-10-08 08:50:18 +00:00
|
|
|
pDoc->RefreshRPCs();
|
2010-01-09 02:52:48 +00:00
|
|
|
pDoc->RunPeriodicRPCs(0);
|
2004-05-27 06:17:58 +00:00
|
|
|
}
|
2004-10-21 14:29:59 +00:00
|
|
|
|
2008-11-12 09:30:22 +00:00
|
|
|
pwndNotebookPage = m_pNotebook->GetPage(selection);
|
|
|
|
wxASSERT(wxDynamicCast(pwndNotebookPage, CBOINCBaseView));
|
|
|
|
|
|
|
|
pView = wxDynamicCast(pwndNotebookPage, CBOINCBaseView);
|
|
|
|
wxASSERT(pView);
|
|
|
|
|
2008-12-05 01:44:38 +00:00
|
|
|
pView->RefreshTaskPane();
|
2004-10-21 14:29:59 +00:00
|
|
|
event.Skip();
|
2004-12-03 20:30:24 +00:00
|
|
|
|
2006-06-24 05:00:57 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnNotebookSelectionChanged - Function End"));
|
2005-04-08 04:23:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-06-24 05:00:57 +00:00
|
|
|
void CAdvancedFrame::ResetReminderTimers() {
|
2006-02-18 15:56:16 +00:00
|
|
|
#ifdef __WXMSW__
|
2006-02-17 20:59:15 +00:00
|
|
|
wxASSERT(m_pDialupManager);
|
|
|
|
wxASSERT(wxDynamicCast(m_pDialupManager, CBOINCDialUpManager));
|
|
|
|
|
|
|
|
m_pDialupManager->ResetReminderTimers();
|
2006-02-18 15:56:16 +00:00
|
|
|
#endif
|
2006-02-17 20:59:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-09-12 09:29:03 +00:00
|
|
|
void CAdvancedFrame::UpdateActivityModeControls( CC_STATUS& status ) {
|
2010-04-01 18:39:56 +00:00
|
|
|
wxMenuBar* pMenuBar = GetMenuBar();
|
2006-09-12 09:29:03 +00:00
|
|
|
wxASSERT(pMenuBar);
|
|
|
|
wxASSERT(wxDynamicCast(pMenuBar, wxMenuBar));
|
|
|
|
|
2009-10-14 17:11:57 +00:00
|
|
|
if ((RUN_MODE_ALWAYS == status.task_mode) && pMenuBar->IsChecked(ID_ADVACTIVITYRUNALWAYS)) return;
|
|
|
|
if ((RUN_MODE_NEVER == status.task_mode) && pMenuBar->IsChecked(ID_ADVACTIVITYSUSPEND)) return;
|
|
|
|
if ((RUN_MODE_AUTO == status.task_mode) && pMenuBar->IsChecked(ID_ADVACTIVITYRUNBASEDONPREPERENCES)) return;
|
2006-09-12 09:29:03 +00:00
|
|
|
|
2010-04-01 18:39:56 +00:00
|
|
|
if (RUN_MODE_ALWAYS == status.task_mode) {
|
|
|
|
if (!pMenuBar->IsChecked(ID_ADVACTIVITYRUNALWAYS)) {
|
|
|
|
pMenuBar->Check(ID_ADVACTIVITYRUNALWAYS, true);
|
|
|
|
}
|
|
|
|
if (pMenuBar->IsChecked(ID_ADVACTIVITYSUSPEND)) {
|
|
|
|
pMenuBar->Check(ID_ADVACTIVITYSUSPEND, false);
|
|
|
|
}
|
|
|
|
if (pMenuBar->IsChecked(ID_ADVACTIVITYRUNBASEDONPREPERENCES)) {
|
|
|
|
pMenuBar->Check(ID_ADVACTIVITYRUNBASEDONPREPERENCES, false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (RUN_MODE_NEVER == status.task_mode) {
|
|
|
|
if (!pMenuBar->IsChecked(ID_ADVACTIVITYSUSPEND)) {
|
|
|
|
pMenuBar->Check(ID_ADVACTIVITYSUSPEND, true);
|
|
|
|
}
|
|
|
|
if (pMenuBar->IsChecked(ID_ADVACTIVITYRUNALWAYS)) {
|
|
|
|
pMenuBar->Check(ID_ADVACTIVITYRUNALWAYS, false);
|
|
|
|
}
|
|
|
|
if (pMenuBar->IsChecked(ID_ADVACTIVITYRUNBASEDONPREPERENCES)) {
|
|
|
|
pMenuBar->Check(ID_ADVACTIVITYRUNBASEDONPREPERENCES, false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (RUN_MODE_AUTO == status.task_mode) {
|
|
|
|
if (!pMenuBar->IsChecked(ID_ADVACTIVITYRUNBASEDONPREPERENCES)) {
|
|
|
|
pMenuBar->Check(ID_ADVACTIVITYRUNBASEDONPREPERENCES, true);
|
|
|
|
}
|
|
|
|
if (pMenuBar->IsChecked(ID_ADVACTIVITYRUNALWAYS)) {
|
|
|
|
pMenuBar->Check(ID_ADVACTIVITYRUNALWAYS, false);
|
|
|
|
}
|
|
|
|
if (pMenuBar->IsChecked(ID_ADVACTIVITYSUSPEND)) {
|
|
|
|
pMenuBar->Check(ID_ADVACTIVITYSUSPEND, false);
|
|
|
|
}
|
|
|
|
}
|
2006-09-12 09:29:03 +00:00
|
|
|
}
|
|
|
|
|
2009-12-11 23:24:17 +00:00
|
|
|
void CAdvancedFrame::UpdateGPUModeControls( CC_STATUS& status ) {
|
2010-04-01 18:39:56 +00:00
|
|
|
wxMenuBar* pMenuBar = GetMenuBar();
|
2009-12-11 23:24:17 +00:00
|
|
|
wxASSERT(pMenuBar);
|
|
|
|
wxASSERT(wxDynamicCast(pMenuBar, wxMenuBar));
|
|
|
|
|
2009-12-18 22:44:10 +00:00
|
|
|
// Prevent asserts on startup, the document hasn't been initialized
|
|
|
|
// and so the flags used for determining the use of a GPU are initially
|
|
|
|
// false. Later the document contains the latest information but the
|
|
|
|
// menu hasn't been updated yet, an assert happens.
|
|
|
|
if (!pMenuBar->FindItem(ID_ADVACTIVITYGPUALWAYS)) return;
|
|
|
|
if (!pMenuBar->FindItem(ID_ADVACTIVITYGPUSUSPEND)) return;
|
|
|
|
if (!pMenuBar->FindItem(ID_ADVACTIVITYGPUBASEDONPREPERENCES)) return;
|
|
|
|
|
2009-12-11 23:24:17 +00:00
|
|
|
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;
|
|
|
|
|
2010-04-01 18:39:56 +00:00
|
|
|
if (RUN_MODE_ALWAYS == status.gpu_mode) {
|
|
|
|
if (!pMenuBar->IsChecked(ID_ADVACTIVITYGPUALWAYS)) {
|
|
|
|
pMenuBar->Check(ID_ADVACTIVITYGPUALWAYS, true);
|
|
|
|
}
|
|
|
|
if (pMenuBar->IsChecked(ID_ADVACTIVITYGPUSUSPEND)) {
|
|
|
|
pMenuBar->Check(ID_ADVACTIVITYGPUSUSPEND, false);
|
|
|
|
}
|
|
|
|
if (pMenuBar->IsChecked(ID_ADVACTIVITYGPUBASEDONPREPERENCES)) {
|
|
|
|
pMenuBar->Check(ID_ADVACTIVITYGPUBASEDONPREPERENCES, false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (RUN_MODE_NEVER == status.gpu_mode) {
|
|
|
|
if (!pMenuBar->IsChecked(ID_ADVACTIVITYGPUSUSPEND)) {
|
|
|
|
pMenuBar->Check(ID_ADVACTIVITYGPUSUSPEND, true);
|
|
|
|
}
|
|
|
|
if (pMenuBar->IsChecked(ID_ADVACTIVITYGPUALWAYS)) {
|
|
|
|
pMenuBar->Check(ID_ADVACTIVITYGPUALWAYS, false);
|
|
|
|
}
|
|
|
|
if (pMenuBar->IsChecked(ID_ADVACTIVITYGPUBASEDONPREPERENCES)) {
|
|
|
|
pMenuBar->Check(ID_ADVACTIVITYGPUBASEDONPREPERENCES, false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (RUN_MODE_AUTO == status.gpu_mode) {
|
|
|
|
if (!pMenuBar->IsChecked(ID_ADVACTIVITYGPUBASEDONPREPERENCES)) {
|
|
|
|
pMenuBar->Check(ID_ADVACTIVITYGPUBASEDONPREPERENCES, true);
|
|
|
|
}
|
|
|
|
if (pMenuBar->IsChecked(ID_ADVACTIVITYGPUALWAYS)) {
|
|
|
|
pMenuBar->Check(ID_ADVACTIVITYGPUALWAYS, false);
|
|
|
|
}
|
|
|
|
if (pMenuBar->IsChecked(ID_ADVACTIVITYGPUSUSPEND)) {
|
|
|
|
pMenuBar->Check(ID_ADVACTIVITYGPUSUSPEND, false);
|
|
|
|
}
|
|
|
|
}
|
2009-12-11 23:24:17 +00:00
|
|
|
}
|
|
|
|
|
2006-09-12 09:29:03 +00:00
|
|
|
|
|
|
|
void CAdvancedFrame::UpdateNetworkModeControls( CC_STATUS& status ) {
|
2010-04-01 18:39:56 +00:00
|
|
|
wxMenuBar* pMenuBar = GetMenuBar();
|
2006-09-12 09:29:03 +00:00
|
|
|
wxASSERT(pMenuBar);
|
|
|
|
wxASSERT(wxDynamicCast(pMenuBar, wxMenuBar));
|
|
|
|
|
2009-10-14 17:11:57 +00:00
|
|
|
if ((RUN_MODE_ALWAYS == status.network_mode) && pMenuBar->IsChecked(ID_ADVNETWORKRUNALWAYS)) return;
|
|
|
|
if ((RUN_MODE_NEVER == status.network_mode) && pMenuBar->IsChecked(ID_ADVNETWORKSUSPEND)) return;
|
|
|
|
if ((RUN_MODE_AUTO == status.network_mode) && pMenuBar->IsChecked(ID_ADVNETWORKRUNBASEDONPREPERENCES)) return;
|
2006-09-12 09:29:03 +00:00
|
|
|
|
2010-04-01 18:39:56 +00:00
|
|
|
if (RUN_MODE_ALWAYS == status.network_mode) {
|
|
|
|
if (!pMenuBar->IsChecked(ID_ADVNETWORKRUNALWAYS)) {
|
|
|
|
pMenuBar->Check(ID_ADVNETWORKRUNALWAYS, true);
|
|
|
|
}
|
|
|
|
if (pMenuBar->IsChecked(ID_ADVNETWORKSUSPEND)) {
|
|
|
|
pMenuBar->Check(ID_ADVNETWORKSUSPEND, false);
|
|
|
|
}
|
|
|
|
if (pMenuBar->IsChecked(ID_ADVNETWORKRUNBASEDONPREPERENCES)) {
|
|
|
|
pMenuBar->Check(ID_ADVNETWORKRUNBASEDONPREPERENCES, false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (RUN_MODE_NEVER == status.network_mode) {
|
|
|
|
if (!pMenuBar->IsChecked(ID_ADVNETWORKSUSPEND)) {
|
|
|
|
pMenuBar->Check(ID_ADVNETWORKSUSPEND, true);
|
|
|
|
}
|
|
|
|
if (pMenuBar->IsChecked(ID_ADVNETWORKRUNALWAYS)) {
|
|
|
|
pMenuBar->Check(ID_ADVNETWORKRUNALWAYS, false);
|
|
|
|
}
|
|
|
|
if (pMenuBar->IsChecked(ID_ADVNETWORKRUNBASEDONPREPERENCES)) {
|
|
|
|
pMenuBar->Check(ID_ADVNETWORKRUNBASEDONPREPERENCES, false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (RUN_MODE_AUTO == status.network_mode) {
|
|
|
|
if (!pMenuBar->IsChecked(ID_ADVNETWORKRUNBASEDONPREPERENCES)) {
|
|
|
|
pMenuBar->Check(ID_ADVNETWORKRUNBASEDONPREPERENCES, true);
|
|
|
|
}
|
|
|
|
if (pMenuBar->IsChecked(ID_ADVNETWORKRUNALWAYS)) {
|
|
|
|
pMenuBar->Check(ID_ADVNETWORKRUNALWAYS, false);
|
|
|
|
}
|
|
|
|
if (pMenuBar->IsChecked(ID_ADVNETWORKSUSPEND)) {
|
|
|
|
pMenuBar->Check(ID_ADVNETWORKSUSPEND, false);
|
|
|
|
}
|
|
|
|
}
|
2006-09-12 09:29:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-05-22 17:20:41 +00:00
|
|
|
void CAdvancedFrame::UpdateRefreshTimerInterval( wxInt32 iCurrentNotebookPage ) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::UpdateRefreshTimerInterval - Function Begin"));
|
|
|
|
|
|
|
|
if (IsShown()) {
|
|
|
|
wxWindow* pwndNotebookPage = NULL;
|
|
|
|
CBOINCBaseView* pView = NULL;
|
2009-12-23 05:23:48 +00:00
|
|
|
CDlgEventLog* eventLog = wxGetApp().GetEventLog();
|
2007-05-22 17:20:41 +00:00
|
|
|
|
|
|
|
wxASSERT(m_pNotebook);
|
|
|
|
|
|
|
|
pwndNotebookPage = m_pNotebook->GetPage(iCurrentNotebookPage);
|
|
|
|
wxASSERT(pwndNotebookPage);
|
|
|
|
|
|
|
|
pView = wxDynamicCast(pwndNotebookPage, CBOINCBaseView);
|
|
|
|
wxASSERT(pView);
|
|
|
|
|
2008-07-28 13:09:02 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
2008-08-15 02:27:30 +00:00
|
|
|
if (m_pPeriodicRPCTimer && m_pPeriodicRPCTimer->IsRunning()) {
|
|
|
|
m_pPeriodicRPCTimer->Stop();
|
2007-05-22 17:20:41 +00:00
|
|
|
|
|
|
|
// View specific refresh rates only apply when a connection to the core
|
|
|
|
// client has been established, otherwise the refresh rate should be 1
|
|
|
|
// second.
|
|
|
|
if (pDoc) {
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
if (pDoc->IsConnected()) {
|
|
|
|
// Set new view specific refresh rate
|
2010-01-09 07:03:47 +00:00
|
|
|
m_iFrameRefreshRate = pView->GetViewRefreshRate() * 1000;
|
2009-12-23 05:23:48 +00:00
|
|
|
if (eventLog) { // Update event log every second
|
|
|
|
m_pPeriodicRPCTimer->Start(1000);
|
|
|
|
} else {
|
2010-01-09 07:03:47 +00:00
|
|
|
m_pPeriodicRPCTimer->Start(m_iFrameRefreshRate);
|
2009-12-23 05:23:48 +00:00
|
|
|
}
|
2007-05-22 17:20:41 +00:00
|
|
|
} else {
|
|
|
|
// Set view refresh rate to 1 second
|
2010-01-09 02:52:48 +00:00
|
|
|
m_iFrameRefreshRate = 1000;
|
2008-08-15 02:27:30 +00:00
|
|
|
m_pPeriodicRPCTimer->Start(1000);
|
2007-05-22 17:20:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::UpdateRefreshTimerInterval - Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-12-23 05:23:48 +00:00
|
|
|
void CAdvancedFrame::UpdateRefreshTimerInterval() {
|
|
|
|
UpdateRefreshTimerInterval(m_pNotebook->GetSelection());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-12-29 16:35:33 +00:00
|
|
|
void CAdvancedFrame::StartTimers() {
|
|
|
|
wxASSERT(m_pRefreshStateTimer);
|
|
|
|
wxASSERT(m_pFrameRenderTimer);
|
|
|
|
CBOINCBaseFrame::StartTimers();
|
|
|
|
m_pRefreshStateTimer->Start();
|
|
|
|
m_pFrameRenderTimer->Start();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CAdvancedFrame::StopTimers() {
|
|
|
|
wxASSERT(m_pRefreshStateTimer);
|
|
|
|
wxASSERT(m_pFrameRenderTimer);
|
|
|
|
CBOINCBaseFrame::StopTimers();
|
|
|
|
m_pRefreshStateTimer->Stop();
|
|
|
|
m_pFrameRenderTimer->Stop();
|
|
|
|
}
|
|
|
|
|