bool SqlReader::getTaskDataFromDb(mysqlpp::StoreQueryResult& res){ bool gotTask=false; if(1 == res.num_rows()){ gotTask = true; mysqlpp::DateTime tmpDate = res[0]["created_at"]; if(tmpDate.compare(currentTaskDate)>0){ cout<<"Name : "<<res[0]["name"]<<endl; currentTaskDate = tmpDate; std::stringstream contextStream; contextStream<<res[0]["scene_description"]; SceneReader sr(contextStream); Context tmpContext; Task task; sr.initContext(tmpContext); for(int j=0;j<sr.getFrames();j++){ sr.getFrameContext(tmpContext, j); tmpContext.maxRayBounce = 4; task.contexts.push_back(tmpContext); } task.id = res[0]["id"]; task.subtaskWidth = res[0]["subtask_width"]; task.subtaskHeight = res[0]["subtask_height"]; task.status = res[0]["status"]; task.totalFrames = sr.getFrames(); storeFrameNumber(task.id,task.totalFrames); changeStatus(task.id,1); notify(task); } } return gotTask; }
//fnSetupButtonForPageData - this will setup the cart buttons for a given set of page //data for both fuse and user carts: void CFusicCartsDlg::fnSetupButtonForPageData(mysqlpp::StoreQueryResult &buttonData, int intCartPosistion) { for(size_t i = 0; i < buttonData.num_rows(); i++) { //firstly get the button attributes: CString strID = buttonData[i]["Cart_ID"]; CString strColourCode = buttonData[i]["Cart_Colour"]; CString strCartBtnTitle = buttonData[i]["Cart_Title"]; bool blRefreshOnClick = (bool)buttonData[i]["Cart_Refresh"]; CString strFilePath; int intRed = 0; int intGreen = 0; int intBlue = 0; double dblDuration = 0; bool blValueSet = false; //ensure that we have a valid ID: if(strID.GetLength() != 3) { CString strError; strError = "Warning: Invalid cart ID: "; strError += strID; strError += "."; MessageBox(strError, "Carts Pane", MB_OK | MB_ICONWARNING); break; } //decode the colours: if(!fnSplitColours(strColourCode, intRed, intGreen, intBlue)) { //coulndt split: CString strError; strError = "Warning: Could not decode colour sequence: "; strError += strColourCode; strError += ", for button: "; strError += strID; strError += "."; MessageBox(strError, "Carts Pane", MB_OK | MB_ICONWARNING); break; } //get rid of the first number as this denotes the page number: strID.Delete(0,1); //get the file path: strFilePath = fnGetFilePathForFileID((int)buttonData[i]["File_ID"]); //get the file duration: dblDuration = fnGetFileDurationForFileID((int)buttonData[i]["File_ID"]); //see which carts we are chaning: if(intCartPosistion == FUSECARTS) { //change fuse carts: m_mapBtnCartTop[strID]->fnSetupCartButton(strFilePath, RGB(intRed, intGreen, intBlue), strCartBtnTitle, dblDuration, blRefreshOnClick, true); } else if(intCartPosistion == USERCARTS) { //change user carts: m_mapBtnCartBottom[strID]->fnSetupCartButton(strFilePath, RGB(intRed, intGreen, intBlue), strCartBtnTitle, dblDuration, blRefreshOnClick, false); } else { //we got an unknonn number: return; } } }