Merge branch 'master' of ssh://boinc.berkeley.edu/boinc-v2

This commit is contained in:
David Anderson 2014-12-08 16:33:04 -08:00
commit bfca5f9025
11 changed files with 152 additions and 8 deletions

View File

@ -37,6 +37,7 @@
#include "MainDocument.h"
#include "BOINCBaseFrame.h"
#include "BOINCBaseView.h"
#include "BOINCListCtrl.h"
#include "BOINCTaskBar.h"
#include "BOINCClientManager.h"
#include "BOINCDialupManager.h"
@ -1044,6 +1045,31 @@ void CAdvancedFrame::SaveWindowDimensions() {
}
void CAdvancedFrame::RestoreStandardListColumns() {
wxWindow* pwndNotebookPage = NULL;
CBOINCBaseView* pView = NULL;
long iIndex;
long iPageCount;
// Convert to a zero based index
iPageCount = (long)m_pNotebook->GetPageCount() - 1;
for (iIndex = 0; iIndex <= iPageCount; iIndex++) {
pwndNotebookPage = m_pNotebook->GetPage(iIndex);
wxASSERT(wxDynamicCast(pwndNotebookPage, CBOINCBaseView));
pView = wxDynamicCast(pwndNotebookPage, CBOINCBaseView);
wxASSERT(pView);
CBOINCListCtrl* listPane = pView->GetListCtrl();
if (listPane) {
listPane->SetStandardColumnOrder();
}
}
}
void CAdvancedFrame::OnSize(wxSizeEvent& event) {
SaveWindowDimensions();
event.Skip();

View File

@ -101,6 +101,7 @@ public:
bool RestoreState();
bool SaveState();
void RestoreStandardListColumns();
#ifdef __WXMAC__
void OnKeyPressed(wxKeyEvent &event);

View File

@ -315,7 +315,6 @@ bool CBOINCBaseView::OnSaveState(wxConfigBase* pConfig) {
if (!m_pListPane->OnSaveState(pConfig)) {
bReturnValue = false;
}
return bReturnValue;
}

View File

@ -124,9 +124,10 @@ public:
void ClearSavedSelections();
void ClearSelections();
void RefreshTaskPane();
#ifdef __WXMAC__
CBOINCListCtrl* GetListCtrl() { return m_pListPane; }
#ifdef __WXMAC__
void OnKeyPressed(wxKeyEvent &event);
#endif
@ -134,7 +135,8 @@ public:
int m_iSortColumn;
bool m_bReverseSort;
wxArrayString* m_aStdColNameOrder;
private:
wxArrayString m_arrSelectedKeys1; //array for remembering the current selected rows by primary key column value

View File

@ -95,10 +95,8 @@ bool CBOINCListCtrl::OnSaveState(wxConfigBase* pConfig) {
wxInt32 iIndex = 0;
wxInt32 iColumnCount = 0;
wxASSERT(pConfig);
// Retrieve the base location to store configuration information
// Should be in the following form: "/Projects/"
strBaseConfigLocation = pConfig->GetPath() + wxT("/");
@ -131,6 +129,28 @@ bool CBOINCListCtrl::OnSaveState(wxConfigBase* pConfig) {
pConfig->Write(wxT("SortColumn"), m_pParentView->m_iSortColumn);
pConfig->Write(wxT("ReverseSortOrder"), m_pParentView->m_bReverseSort);
// Save Column Order
#ifdef wxHAS_LISTCTRL_COLUMN_ORDER
wxString strColumnOrder;
wxString strBuffer;
wxArrayInt aOrder(GetColumnCount());
CBOINCBaseView* pView = (CBOINCBaseView*)GetParent();
wxASSERT(wxDynamicCast(pView, CBOINCBaseView));
aOrder = GetColumnsOrder();
strColumnOrder.Printf(wxT("%s"), pView->m_aStdColNameOrder->Item(aOrder[0]));
for (int i = 1; i < aOrder.Count(); ++i)
{
strBuffer.Printf(wxT(";%s"), pView->m_aStdColNameOrder->Item(aOrder[i]));
strColumnOrder += strBuffer;
}
pConfig->Write(wxT("ColumnOrder"), strColumnOrder);
#endif
return true;
}
@ -192,10 +212,76 @@ bool CBOINCListCtrl::OnRestoreState(wxConfigBase* pConfig) {
m_pParentView->InitSort();
}
// Restore Column Order
#ifdef wxHAS_LISTCTRL_COLUMN_ORDER
wxString strColumnOrder;
if (pConfig->Read(wxT("ColumnOrder"), &strColumnOrder)) {
SetListColumnOrder(strColumnOrder, ";");
}
#endif
return true;
}
void CBOINCListCtrl::TokenizedStringToArray(wxString tokenized, char * delimiters, wxArrayString* array) {
wxString name;
array->Clear();
wxStringTokenizer tok(tokenized, delimiters);
while (tok.HasMoreTokens())
{
name = tok.GetNextToken();
if (name.IsEmpty()) continue;
array->Add(name);
}
}
void CBOINCListCtrl::SetListColumnOrder(wxString tokenized, char * delimiters) {
#ifdef wxHAS_LISTCTRL_COLUMN_ORDER
wxArrayString orderArray;
int i, j, stdCount, orderCount;
int colCount = GetColumnCount();
wxArrayInt aOrder(colCount);
CBOINCBaseView* pView = (CBOINCBaseView*)GetParent();
wxASSERT(wxDynamicCast(pView, CBOINCBaseView));
TokenizedStringToArray(tokenized, delimiters, &orderArray);
stdCount = pView->m_aStdColNameOrder->GetCount();
wxASSERT(stdCount == colCount);
orderCount = orderArray.GetCount();
wxASSERT(orderCount == colCount); // Temporary until selective hiding implemented
for (i=0; i<orderCount; ++i) {
for (j=0; j<stdCount; ++j) {
if (orderArray[i].IsSameAs(pView->m_aStdColNameOrder->Item(j))) {
aOrder[i] = j;
}
}
}
SetColumnsOrder(aOrder);
#endif
}
void CBOINCListCtrl::SetStandardColumnOrder() {
#ifdef wxHAS_LISTCTRL_COLUMN_ORDER
int i;
int colCount = GetColumnCount();
wxArrayInt aOrder(colCount);
for (i=0; i<colCount; ++i) {
aOrder[i] = i;
}
SetColumnsOrder(aOrder);
#endif
}
void CBOINCListCtrl::SelectRow(int row, bool setSelected) {
SetItemState(row, setSelected ? wxLIST_STATE_SELECTED : 0, wxLIST_STATE_SELECTED);
}

View File

@ -74,6 +74,10 @@ public:
virtual bool OnSaveState(wxConfigBase* pConfig);
virtual bool OnRestoreState(wxConfigBase* pConfig);
void TokenizedStringToArray(wxString tokenized, char * delimiters, wxArrayString* array);
void SetListColumnOrder(wxString tokenized, char * delimiters);
void SetStandardColumnOrder();
long GetFocusedItem() { return GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_FOCUSED); }
long GetFirstSelected() { return GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); }
long GetNextSelected(int i) { return GetNextItem(i, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); }

View File

@ -34,6 +34,9 @@
#include "res/proj.xpm"
// This string must contain internal (non-localized) column names
// in standard order separated by a delimiter
static char* default_column_names = "Project;Account;Team;Done;Average;Share;Status";
#define COLUMN_PROJECT 0
#define COLUMN_ACCOUNTNAME 1
@ -220,6 +223,9 @@ CViewProjects::CViewProjects(wxNotebook* pNotebook) :
// Create Task Pane Items
m_pTaskPane->UpdateControls();
m_aStdColNameOrder = new wxArrayString;
m_pListPane->TokenizedStringToArray(default_column_names, ";", m_aStdColNameOrder);
// Create List Pane Items
m_pListPane->InsertColumn(COLUMN_PROJECT, _("Project"), wxLIST_FORMAT_LEFT, 150);
m_pListPane->InsertColumn(COLUMN_ACCOUNTNAME, _("Account"), wxLIST_FORMAT_LEFT, 80);

View File

@ -34,6 +34,10 @@
#include "res/xfer.xpm"
// This string must contain internal (non-localized) column names
// in standard order separated by a delimiter
static char* default_column_names = "Project;File;Progress;Size;Elapsed;Speed;Status";
#define COLUMN_PROJECT 0
#define COLUMN_FILE 1
#define COLUMN_PROGRESS 2
@ -183,6 +187,9 @@ CViewTransfers::CViewTransfers(wxNotebook* pNotebook) :
// Create Task Pane Items
m_pTaskPane->UpdateControls();
m_aStdColNameOrder = new wxArrayString;
m_pListPane->TokenizedStringToArray(default_column_names, ";", m_aStdColNameOrder);
// Create List Pane Items
m_pListPane->InsertColumn(COLUMN_PROJECT, _("Project"), wxLIST_FORMAT_LEFT, 125);
m_pListPane->InsertColumn(COLUMN_FILE, _("File"), wxLIST_FORMAT_LEFT, 205);

View File

@ -36,6 +36,10 @@
#include "res/result.xpm"
// This string must contain internal (non-localized) column names
// in standard order separated by a delimiter
static char* default_column_names = "Project;Progress;Status;Elapsed;Remaining;Deadline;Application;Name";
#define COLUMN_PROJECT 0
#define COLUMN_PROGRESS 1
#define COLUMN_STATUS 2
@ -233,6 +237,9 @@ CViewWork::CViewWork(wxNotebook* pNotebook) :
// Create Task Pane Items
m_pTaskPane->UpdateControls();
m_aStdColNameOrder = new wxArrayString;
m_pListPane->TokenizedStringToArray(default_column_names, ";", m_aStdColNameOrder);
// Create List Pane Items
m_pListPane->InsertColumn(COLUMN_PROJECT, _("Project"), wxLIST_FORMAT_LEFT, 125);
m_pListPane->InsertColumn(COLUMN_PROGRESS, _("Progress"), wxLIST_FORMAT_RIGHT, 60);

View File

@ -202,7 +202,7 @@ function submit_jobs(
$x .= "\n";
}
$cmd = "cd ../..; ./bin/create_work --appname $app->name --batch $batch_id --rsc_fpops_est $job->rsc_fpops_est --priority $priority --stdin";
$cmd = "cd ../..; ./bin/create_work --appname $app->name --batch $batch_id --rsc_fpops_est $job->rsc_fpops_est --priority $priority";
if ($result_template_file) {
$cmd .= " --result_template templates/$result_template_file";
}
@ -302,6 +302,7 @@ function submit_batch($r) {
if (!$ret) xml_error(-1, "BOINC server: batch->update() failed");
} else {
$batch_name = (string)($r->batch->batch_name);
$batch_name = BoincDb::escape_string($batch_name);
$batch_id = BoincBatch::insert(
"(user_id, create_time, njobs, name, app_id, logical_end_time, state) values ($user->id, $now, $njobs, '$batch_name', $app->id, $let, ".BATCH_STATE_INIT.")"
);
@ -342,6 +343,7 @@ function create_batch($r) {
list($user, $user_submit) = authenticate_user($r, $app);
$now = time();
$batch_name = (string)($r->batch->batch_name);
$batch_name = BoincDb::escape_string($batch_name);
$expire_time = (double)($r->expire_time);
$batch_id = BoincBatch::insert(
"(user_id, create_time, name, app_id, state, expire_time) values ($user->id, $now, '$batch_name', $app->id, ".BATCH_STATE_INIT.", $expire_time)"

View File

@ -1144,7 +1144,11 @@ int VBOX_VM::deregister_vm(bool delete_media) {
pMediumAttachment->get_Port(&lPort);
pMediumAttachment->get_Medium(&pMedium);
mediums.push_back(CComPtr<IMedium>(pMedium));
// If the device in question is a DVD/CD-ROM drive, the medium may have been ejected.
// If so, pMedium will be NULL.
if (pMedium) {
mediums.push_back(CComPtr<IMedium>(pMedium));
}
rc = pMachine->DetachDevice(strController, lPort, lDevice);
CHECK_ERROR(rc);