/* Purpose: To remove a component according to user input * Pre: Current layer exists, * stringstream with x position and y position * Post: Removes component at given position * Author: Matthew James Harrison ******************************************************************************/ void removeComponent(Layer &layer, StartingList &startingList, stringstream &ss) { string data = ""; int xPos = -1; int yPos = -1; /* Get command data */ xPos = readNumber(ss); yPos = readNumber(ss); /* If no junk data */ if (!hasJunk(ss)) { /* If type and position are valid */ if (isPosition(layer, xPos, yPos)) { removeComponent(layer, startingList, xPos, yPos); } else { displayMessage(MSG_INV_REMOVE); } } else { displayMessage(MSG_INV_REMOVE); } }
int CIMEAppDlg::loadProject(string& project) { m_ShapeRecognizer.unloadModelData(); if(FAILURE == m_ShapeRecognizer.loadModelData(project)) { displayMessage(L"Fail to load project!"); return FAILURE; } string mapFile; m_IsMappingFileFound = false; mapFile = m_lipiRoot + PROJECTS_PATH_STRING + project + PROFILE_PATH_STRING + MAPPING_PATH_STRING; if(FAILURE == loadMapping(mapFile)) { displayMessage(L"Mapping file not found!"); } string strTitle("Lipi Demo : "); strTitle += project.c_str(); TCHAR title[MAX_PATH]={0}; mbstowcs(title,strTitle.c_str(),MAX_PATH); this->SetWindowTextW(title); displayMessage(L" "); return SUCCESS; }
/* * Translate the MIDI message buffer to a Serial Device Command * */ QString Bridge::translateMIDItoSerialCommand(QByteArray &buf) { // uint8_t msg = buf[0]; // uint8_t tag = msg & TAG_MASK; // uint8_t channel = msg & CHANNEL_MASK; // const char *desc= 0; int controlnumber = buf[1]; int controlvalue = buf[2]; emit displayMessage(applyTimeStamp(QString("Buffer 1 is: %1").arg((int) buf[1]))); emit displayMessage(applyTimeStamp(QString("Buffer 2 is: %1").arg((int) buf[2]))); QString translatedcommand; // Work out what we have if (controlnumber == 9 && controlvalue > 64 ) { translatedcommand = "ZZSB;"; } if (controlnumber == 9 && controlvalue < 64) { translatedcommand = "ZZSA;"; } // Format the output and return return translatedcommand; }
void Bridge::onStatusByte(uint8_t byte) { if(byte == MSG_SYSEX_END && bufferStartsWith(MSG_SYSEX_START)) { this->msg_data.append(byte); // bookends of a complete SysEx message sendMidiMessage(); return; } if(this->data_expected > 0) { emit displayMessage(applyTimeStamp(QString("Warning: got a status byte when we were expecting %1 more data bytes, sending possibly incomplete MIDI message 0x%2").arg(this->data_expected).arg((uint8_t)this->msg_data[0], 0, 16))); sendMidiMessage(); } if(is_voice_msg(byte)) this->running_status = byte; if(is_syscommon_msg(byte)) this->running_status = 0; this->data_expected = get_data_length(byte); if(this->data_expected == UNKNOWN_MIDI) { emit displayMessage(applyTimeStamp(QString("Warning: got unexpected status byte %1").arg((uint8_t)byte,0,16))); this->data_expected = 0; } this->msg_data.clear(); this->msg_data.append(byte); }
void changePlaybackSpeed(int ratioDiff) { float ratio = (float)pow(2.0, ratioDiff); float speed = getPlaybackSpeed() * ratio; if (speed < 0) { speed = 0; } openni::Status rc = setPlaybackSpeed(speed); if (rc == openni::STATUS_OK) { if (speed == 0) { displayMessage("Playback speed set to fastest"); } else { displayMessage("Playback speed set to x%.2f", speed); } } else if ((rc == openni::STATUS_NOT_IMPLEMENTED) || (rc == openni::STATUS_NOT_SUPPORTED) || (rc == openni::STATUS_BAD_PARAMETER)) { displayError("Playback speed is not supported"); } else { displayError("Error setting playback speed:\n%s", openni::OpenNI::getExtendedError()); } }
void TeenAgentEngine::processObject() { if (dst_object == NULL) return; Resources *res = Resources::instance(); switch (action) { case kActionExamine: { if (trySelectedObject()) break; byte *dcall = res->dseg.ptr(0xb5ce); dcall = res->dseg.ptr(READ_LE_UINT16(dcall + scene->getId() * 2 - 2)); dcall += 2 * dst_object->id - 2; uint16 callback = READ_LE_UINT16(dcall); if (callback == 0 || !processCallback(callback)) displayMessage(dst_object->description); } break; case kActionUse: { if (trySelectedObject()) break; byte *dcall = res->dseg.ptr(0xb89c); dcall = res->dseg.ptr(READ_LE_UINT16(dcall + scene->getId() * 2 - 2)); dcall += 2 * dst_object->id - 2; uint16 callback = READ_LE_UINT16(dcall); if (!processCallback(callback)) displayMessage(dst_object->description); } break; case kActionNone: break; } }
void nextCameraType(void) { int i; int current_cam_type = getSettingi("camType"); int new_cam_type = (current_cam_type + 1) % CAM_COUNT; setSettingi("camType", new_cam_type); /* update the cached setting */ gSettingsCache.camType = new_cam_type; for (i = 0; i < game->players; i++) { if (game->player[i].ai->active == AI_HUMAN) { initCamera(game->player[i].camera, game->player[i].data, new_cam_type); } } if (getSettingi("debug_output")) { switch (new_cam_type) { case 0 : displayMessage(TO_CONSOLE, "[camera] Circling Camera"); break; case 1 : displayMessage(TO_CONSOLE, "[camera] Behind Camera"); break; case 2 : displayMessage(TO_CONSOLE, "[camera] Cockpit Camera"); break; case 3 : displayMessage(TO_CONSOLE, "[camera] Mouse Camera"); break; } } }
void TetraStuffingDialog::generateTetras() { QTime t; t.start(); QGLTetraMesh* tMesh_ = _viewer->tMesh; if (tMesh_ == NULL) { emit displayMessage(QString("ERROR! No surface mesh loaded..."), 5000); return; } const std::vector<Triangle>& tris = tMesh_->GetTriangleTopology()->GetTriangles(); const std::vector<Vec3f>& verts = tMesh_->GetTriangleTopology()->GetVertices(); if (tMesh_->GetSurface() == NULL) { emit displayMessage(QString("ERROR! No surface mesh loaded..."), 5000); return; } SofaTetraStuffing* sts = new SofaTetraStuffing(); emit displayMessage(QString("Generating tetra mesh..."), 1000); sts->GenerateFromSurface(tris, verts, m_ui->tetraSizeSpinBox->value(), m_ui->alphaShortSpinBox->value(), m_ui->alphaLongSpinBox->value(), m_ui->snapToPointsCheckBox->isChecked(), m_ui->splitTetrasCheckBox->isChecked()); emit displayMessage(QString("Updating visual mesh..."), 2000); tMesh_->UpdateTetraMesh(sts->GetTetraVertices(), sts->GetTetras()); std::stringstream ss; ss<<"Generated tetrahedral mesh in "<<t.elapsed()<<"ms. Tetras: "<<sts->GetTetras().size()<<"; Vertices: "<<sts->GetTetraVertices().size(); std::string stdMSG = ss.str(); emit notifyDone(QString::fromStdString(stdMSG), 10000); delete sts; }
void MainWindow::apply(){ // Display error message if text field is empty if(ui->txtFilePath->text().isEmpty()) { displayMessage(WE_ERROR, WE_EMPTY_FILE); return; } // Display error message if file doesn't exist QFile f(ui->txtFilePath->text()); if(!f.exists()) { displayMessage(WE_ERROR, WE_FILE_DOESNT_EXIST); return; } // Open the game file and write the value from slider FileWriter fw(ui->txtFilePath->text().toStdString().c_str()); int power = ui->sldPower->value(); // Display error message if update failed or success message otherwise if(fw.setPower(power) != FW_ERROR) { displayMessage(WE_INFO, WE_FILE_UPDATED); ui->btnApply->setEnabled(false); } else { displayMessage(WE_ERROR, WE_UNKNOWN_ERROR); } }
void CIMEAppDlg::OnTimer(UINT_PTR nIDEvent) { if(nIDEvent == IDT_RECOGNIZE_TIMER) { KillTimer(IDT_RECOGNIZE_TIMER); if(m_IsProjectLoaded) { displayMessage(L"Recognizing"); recognizeStrokes(); } else { displayMessage(L"Please load project..."); } InvalidateRect(LPCRECT(&m_DrawAreaRect),TRUE); m_PrevPenPoint.x = 0; m_PrevPenPoint.y = 0; m_PenPointsVec.clear(); m_penstrokes.clear(); displayMessage(L""); } CDialog::OnTimer(nIDEvent); }
void FreeEMS_Loader::openFile() { QSettings loaderSettings(settingsFile, QSettings::IniFormat); loadDirectory = loaderSettings.value("lastDirectory").toString(); QFileDialog fileDialog; fileDialog.setViewMode(QFileDialog::Detail); fileDialog.restoreGeometry(loaderSettings.value("lastOpenDialogGeo").toByteArray()); QString qSNum; loadFileName = fileDialog.getOpenFileName(this, tr("Load s19 file"), loadDirectory, tr("s19 (*.s19)")); loaderSettings.setValue("lastOpenDialogGeo", fileDialog.saveGeometry()); if (loadFileName.isNull()) { displayMessage(MESSAGE_ERROR, "no file selected"); return; } else{ loaderSettings.setValue("lastDirectory", loadFileName); loaderComms->setLoadFilename(loadFileName); displayMessage(MESSAGE_INFO,"Attempting to parse " + loadFileName); loaderComms->parseFile(); if(loaderComms->numLoadableRecords() == 0){ displayMessage(MESSAGE_ERROR, "no load-able records parsed"); }else if(loaderComms->numBadSums()){ displayMessage(MESSAGE_ERROR, "there are " + qSNum.setNum(loaderComms->numBadSums(), 10) + " records with bad checksums or lengths , loading will be disabled"); } else { displayMessage(MESSAGE_INFO,"found " + qSNum.setNum(loaderComms->numLoadableRecords(), 10) +" load-able records in file"); ui.pushLoad->setEnabled(true); m_fileLoaded = true; } } }
////////////////////////////////////////////////////////////////////////////// /// /// Read the input stream /// ////////////////////////////////////////////////////////////////////////////// void controller::readInputStream(unsigned char* ptr) { int position; sanitize(ptr, &position); bool isOverflow = false; // Validate input stream while (!isValidCommand(ptr) || isDividedByZeroDetected(ptr)) { // Prevent to have a string with no operation or with invalid operands if (isLFDetected(ptr) && (!isOperationDetected(ptr) || !isOperand1Detected(ptr) || !isOperand2Detected(ptr))) { sanitize(ptr, &position); displayMessage((char*) "Invalid input string\n"); isOverflow = false; } if (isDividedByZeroDetected(ptr)) { sanitize(ptr, &position); displayMessage((char*) "Division by zero detected\n"); isOverflow = false; } ptr[position++] = (unsigned char) readInput(); // Loop in array if (position == 20) { sanitize(ptr, &position); if (!isOverflow) displayMessage((char*) "String too long, try again\n"); isOverflow = true; } } }
void toggleCMOSAutoLoops(int ) { if (g_colorStream.getCameraSettings() == NULL) { displayMessage("Color stream doesn't support camera settings"); return; } toggleImageAutoExposure(0); toggleImageAutoWhiteBalance(0); displayMessage ("CMOS Auto Loops: %s", g_colorStream.getCameraSettings()->getAutoExposureEnabled()?"On":"Off"); }
void seekFrame(int nDiff) { XnStatus nRetVal = XN_STATUS_OK; if (isPlayerOn()) { const XnChar* strNodeName = NULL; if (g_pPrimary != NULL) { strNodeName = g_pPrimary->GetName(); } else if (g_Depth.IsValid()) { strNodeName = g_Depth.GetName(); } else if (g_Image.IsValid()) { strNodeName = g_Image.GetName(); } else if (g_IR.IsValid()) { strNodeName = g_IR.GetName(); } else if (g_Audio.IsValid()) { strNodeName = g_Audio.GetName(); } nRetVal = g_Player.SeekToFrame(strNodeName, nDiff, XN_PLAYER_SEEK_CUR); if (nRetVal != XN_STATUS_OK) { displayMessage("Failed to seek: %s", xnGetStatusString(nRetVal)); return; } XnUInt32 nFrame = 0; XnUInt32 nNumFrames = 0; nRetVal = g_Player.TellFrame(strNodeName, nFrame); if (nRetVal != XN_STATUS_OK) { displayMessage("Failed to tell frame: %s", xnGetStatusString(nRetVal)); return; } nRetVal = g_Player.GetNumFrames(strNodeName, nNumFrames); if (nRetVal != XN_STATUS_OK) { displayMessage("Failed to get number of frames: %s", xnGetStatusString(nRetVal)); return; } displayMessage("Seeked %s to frame %u/%u", strNodeName, nFrame, nNumFrames); } }
void CBranch_patcherDlg::OnDoPatch() { UpdateData( true ); if ( SaveDiff ) { // Save the diff from the richedit saveFile( TEMP_DIFF_FILE ); } // Apply the patch CString patchCmdLine, concatOutput, delPatchErrors; patchCmdLine.Format( "%spatch.exe -c -p%u --verbose < %s > %s 2> %s", PatchExeDir, CvsDiffDirLevel, TEMP_DIFF_FILE, PATCH_RESULT, PATCH_ERRORS ); // needs patch.exe in the path concatOutput.Format( "copy %s+%s %s", PATCH_RESULT, PATCH_ERRORS, PATCH_RESULT ); delPatchErrors.Format( "del %s", PATCH_ERRORS ); CString text; text.Format( "Patch diff to directory %s?\n\nCommand (choose No to copy it into the clipboard):\n%s", m_DestDir, patchCmdLine ); int result; if ( (result = ::MessageBox( m_hWnd, text, "Confirmation", MB_YESNOCANCEL | MB_ICONQUESTION )) == IDYES ) { if ( _chdir( m_DestDir ) == 0 ) { system( patchCmdLine ); system( concatOutput ); system( delPatchErrors ); displayFile( PATCH_RESULT ); SaveDiff = false; m_Display->LineScroll( 0 ); if ( (m_Display->GetLineCount() == 0) || (m_Display->GetLineCount() == 1 && m_Display->LineLength(0)<2) ) { CString s; s.Format( "Nothing was patched.\r\nIf this is not the expected result:\r\n- check if the good patch.exe is in %s\r\n- check if %s exists (generated by previous diff)\r\n- check if C:\\ has enough free space and access rights to write a file.", TEMP_DIFF_FILE ); displayMessage( s ); } else { m_Filename = PATCH_RESULT + ":"; UpdateData( false ); } } else { displayMessage( "Target directory not found" ); } } else if ( result == IDNO ) { SendTextToClipboard( patchCmdLine ); } }
void CIMEAppDlg::recognizeStrokes(void) { displayMessage(L"Recognizing..."); if(0 != m_PenPointsVec.size()) { vector<CString> topchoices; vector<LTKShapeRecoResult> resultSet; if( FAILURE == m_ShapeRecognizer.recognize(m_penstrokes,MAX_CHOICE,resultSet)) { displayMessage(L"Wrong gesture!"); return; } vector<CString> topChoices; if(m_IsMappingFileFound) getChoices(resultSet,topChoices); else { int iIndex = 0; for(vector<LTKShapeRecoResult>::iterator t = resultSet.begin(); t < resultSet.end() && iIndex < MAX_CHOICE; t++,iIndex++) { CString displayValue; displayValue.Format(L"%d",(*t).getShapeId()); m_DisplayChoice[iIndex].SetWindowTextW(displayValue); UpdateData(false); } topChoices.clear(); } if(topChoices.size() != 0) { for(int i=0;i<MAX_CHOICE && i< (int)topChoices.size();i++) { long choice=0; if(topChoices[i].Find(L"0X") != -1 || topChoices[i].Find(L"0x") != -1) { choice = (long)_tcstol(topChoices[i].GetBuffer(topChoices[i].GetLength()),NULL,16); } else { topChoices[i].Trim(L" "); choice = (long)topChoices[i].GetAt(0); } displayChoice(m_DisplayChoice[i].m_hWnd,(TCHAR)choice); } } displayMessage(L" "); } }
void ColorPickerWidget::slotGetAverageColor() { disconnect(m_grabRectFrame, SIGNAL(getColor()), this, SLOT(slotGetAverageColor())); m_grabRect = m_grabRect.normalized(); int numPixel = m_grabRect.width() * m_grabRect.height(); int sumR = 0; int sumG = 0; int sumB = 0; // only show message for larger rects because of the overhead displayMessage creates if (numPixel > 40000) emit displayMessage(i18n("Requesting color information..."), 0); /* Only getting the image once for the whole rect results in a vast speed improvement. */ #ifdef Q_WS_X11 Window root = RootWindow(QX11Info::display(), QX11Info::appScreen()); m_image = XGetImage(QX11Info::display(), root, m_grabRect.x(), m_grabRect.y(), m_grabRect.width(), m_grabRect.height(), -1, ZPixmap); #else QWidget *desktop = QApplication::desktop(); m_image = QPixmap::grabWindow(desktop->winId(), m_grabRect.x(), m_grabRect.y(), m_grabRect.width(), m_grabRect.height()).toImage(); #endif for (int x = 0; x < m_grabRect.width(); ++x) { for (int y = 0; y < m_grabRect.height(); ++y) { QColor color = grabColor(QPoint(x, y), false); sumR += color.red(); sumG += color.green(); sumB += color.blue(); } // Warning: slows things down, so don't do it for every pixel (the inner for loop) if (numPixel > 40000) emit displayMessage(i18n("Requesting color information..."), (int)(x * m_grabRect.height() / (qreal)numPixel * 100)); } #ifdef Q_WS_X11 XDestroyImage(m_image); m_image = NULL; #endif if (numPixel > 40000) emit displayMessage(i18n("Calculated average color for rectangle."), -1); emit colorPicked(QColor(sumR / numPixel, sumG / numPixel, sumB / numPixel)); emit disableCurrentFilter(false); }
void FreeEMS_Loader::connect() { if (m_loaderState == STATE_WORKING) { abort(); } else { if (ui.comboBaud->currentText().compare("115200") || ui.comboDataBits->currentText().compare("8") || ui.comboParity->currentText().compare("NONE") || ui.comboStopBits->currentText().compare("1")) { displayMessage(MESSAGE_INFO, "Warning you are not using default COM port settings"); displayMessage(MESSAGE_INFO, "Defaults are 115200, 8, NONE, 1"); } loaderComms->setupPort(ui.comboDevice->currentText(), ui.comboBaud->currentText().toUInt(), ui.comboStopBits->currentText().toUInt(), ui.comboDataBits->currentText().toUInt(), ui.comboParity->currentText()); } }
void FreeEMS_Loader::load() { connect(); QSettings loaderSettings(settingsFile, QSettings::IniFormat); _numBurnsPerformed++; loaderSettings.setValue("numBurnsPerformed", _numBurnsPerformed); QDate date = QDate::currentDate(); QTime time = QTime::currentTime(); // QFileDialog fileDialog; // fileDialog.setViewMode(QFileDialog::Detail); // // if (!fileArg) //if no file was specified from the cmdline open browser // { // //loadFileName = QFileDialog::getOpenFileName(this, tr("Load s19 file"), loadDirectory, tr("s19 (*.s19)")); // loadFileName = fileDialog.getOpenFileName(this, tr("Load s19 file"), loadDirectory, tr("s19 (*.s19)")); // } if (!m_fileLoaded) { displayMessage(MESSAGE_INFO, "s19 records have not been loaded or there was a problem parsing the input file"); return; } if (ui.chkVerify->isChecked()) { loaderComms->verifyLastWrite = true; //todo make set function } else { loaderComms->verifyLastWrite = false; //todo make set function } QString name = loadFileName.section('/', -1); // ripFileName = QDir::currentPath(); // ripFileName += "/saved/"; if (!QDir(m_autoRipDirectory).exists(m_autoRipDirectory)) QDir(m_autoRipDirectory).mkpath(m_autoRipDirectory); m_autoRipDirectory += date.toString("MM-dd-yyyy-"); m_autoRipDirectory += time.toString("H-m-s-"); m_autoRipDirectory += "replaced-with-"; m_autoRipDirectory += name; if(ui.chkRip->isChecked()){ displayMessage(MESSAGE_INFO, "Ripping as '" + m_autoRipDirectory + "'"); } loaderComms->setLoadFilename(loadFileName); loaderComms->setRipFilename(m_autoRipDirectory); if (ui.chkRip->isChecked()) { loaderComms->setAction("RIP"); loaderComms->setAction("LOAD"); loaderComms->start(); } else { loaderComms->setAction("LOAD"); loaderComms->start(); } }
void MainWindow::onValueChanged() { if(bridge) { bridge->deleteLater(); QThread::yieldCurrentThread(); // Try and get any signals from the bridge sent sooner not later QCoreApplication::processEvents(); bridge = NULL; } Settings::setLastMidiIn(ui->cmbMidiIn->currentText()); Settings::setLastMidiOut(ui->cmbMidiOut->currentText()); Settings::setLastSerialPort(ui->cmbSerial->currentText()); if(!ui->chk_on->isChecked() || ( ui->cmbSerial->currentIndex() == 0 && ui->cmbMidiIn->currentIndex() == 0 && ui->cmbMidiOut->currentIndex() == 0 )) { return; } ui->lst_debug->clear(); int midiIn =ui->cmbMidiIn->currentIndex()-1; int midiOut = ui->cmbMidiOut->currentIndex()-1; ui->lst_debug->addItem("Starting MIDI<->Serial Bridge..."); bridge = new Bridge(); connect(bridge, SIGNAL(debugMessage(QString)), SLOT(onDebugMessage(QString))); connect(bridge, SIGNAL(displayMessage(QString)), SLOT(onDisplayMessage(QString))); connect(bridge, SIGNAL(midiReceived()), ui->led_midiin, SLOT(blinkOn())); connect(bridge, SIGNAL(midiSent()), ui->led_midiout, SLOT(blinkOn())); connect(bridge, SIGNAL(serialTraffic()), ui->led_serial, SLOT(blinkOn())); bridge->attach(ui->cmbSerial->itemData(ui->cmbSerial->currentIndex()).toString(), Settings::getPortSettings(), midiIn, midiOut, workerThread); }
void HlpFlightPlannerApp::mapToolChanged( QgsMapTool *newTool, QgsMapTool *oldTool ) { if ( oldTool ) { disconnect( oldTool, SIGNAL( displayMessage( QString ) ), this, SLOT( displayMapToolMessage( QString ) ) ); disconnect( oldTool, SIGNAL( displayMessage( QString, QgsMessageBar::MessageLevel ) ), this, SLOT( displayMapToolMessage( QString, QgsMessageBar::MessageLevel ) ) ); disconnect( oldTool, SIGNAL( removeMessage() ), this, SLOT( removeMapToolMessage() ) ); } if ( newTool ) { connect( newTool, SIGNAL( displayMessage( QString ) ), this, SLOT( displayMapToolMessage( QString ) ) ); connect( newTool, SIGNAL( displayMessage( QString, QgsMessageBar::MessageLevel ) ), this, SLOT( displayMapToolMessage( QString, QgsMessageBar::MessageLevel ) ) ); connect( newTool, SIGNAL( removeMessage() ), this, SLOT( removeMapToolMessage() ) ); } }
void AbstractFriendsManagementState::treatRequests() { try { const auto& requests{_context.client->getFriendshipRequests()}; if(requests.empty()) displayMessage("You have no incoming request"); else for(const auto& request : requests) treatIndividualRequest(request); } catch(std::runtime_error& e) { displayMessage(e.what()); } }
void FreeEMS_Loader::rip() { connect(); QSettings loaderSettings(settingsFile, QSettings::IniFormat); QString loadRipDirectory = loaderSettings.value("lastRipDirectory").toString(); ui.chkRip->setEnabled(0); QFileDialog fileDialog(this, "Save s19 as"); fileDialog.setNameFilter("s19 Files (*.s19)"); fileDialog.setDirectory(loadRipDirectory); fileDialog.setDefaultSuffix("s19"); fileDialog.setViewMode(QFileDialog::Detail); fileDialog.setFileMode(QFileDialog::AnyFile); fileDialog.setAcceptMode(QFileDialog::AcceptSave); fileDialog.exec(); ripFileName = fileDialog.selectedFiles().first(); if(!ripFileName.endsWith(".s19")) { displayMessage(MESSAGE_INFO, "no rip file name specified"); return; } qDebug() << "Ripping flash as " << ripFileName; ripFileName = fileDialog.selectedFiles().first(); loaderSettings.setValue("lastRipDirectory", ripFileName); loaderComms->setRipFilename(ripFileName); loaderComms->setAction("RIP"); if (ui.chkRipSMCode->isChecked()) { loaderComms->ripSMCode(true); } else { loaderComms->ripSMCode(false); } loaderComms->start(); }
void captureSingleFrame(int) { int num = findUniqueFileName(); XnChar csColorFileName[XN_FILE_MAX_PATH]; XnChar csDepthFileName[XN_FILE_MAX_PATH]; XnChar csIRFileName[XN_FILE_MAX_PATH]; getColorFileName(num, csColorFileName); getDepthFileName(num, csDepthFileName); getIRFileName(num, csIRFileName); openni::VideoFrameRef& colorFrame = getColorFrame(); if (colorFrame.isValid()) { xnOSSaveFile(csColorFileName, colorFrame.getData(), colorFrame.getDataSize()); } openni::VideoFrameRef& depthFrame = getDepthFrame(); if (depthFrame.isValid()) { xnOSSaveFile(csDepthFileName, depthFrame.getData(), depthFrame.getDataSize()); } openni::VideoFrameRef& irFrame = getIRFrame(); if (irFrame.isValid()) { xnOSSaveFile(csIRFileName, irFrame.getData(), irFrame.getDataSize()); } g_Capture.nCapturedFrameUniqueID = num + 1; displayMessage("Frames saved with ID %d", num); }
void FreeEMS_Loader::updateGUIState() { switch (m_loaderState) { case STATE_WORKING: ui.pushAbort->setEnabled(true); ui.pushLoad->setEnabled(false); ui.pushRip->setEnabled(false); ui.pushErase->setEnabled(false); ui.chkRip->setEnabled(false); ui.chkVerify->setEnabled(false); ui.pushOpenFile->setEnabled(false); break; case STATE_LOAD_COMPLETE: m_fileLoaded = false; // force user to reopoen or select new file case STATE_STANDING_BY: //same as connected except actions are cleared loaderComms->setAction("NONE"); //This may need a mutex ui.progressBar->setValue(0); ui.pushRip->setEnabled(true); ui.pushErase->setEnabled(true); ui.chkRip->setEnabled(true); ui.chkVerify->setEnabled(true); ui.pushOpenFile->setEnabled(true); ui.pushAbort->setEnabled(false); if(m_fileLoaded == true) { ui.pushLoad->setEnabled(true); }else { ui.pushLoad->setEnabled(false); } break; default: displayMessage(MESSAGE_ERROR, "INVALID STATE REQUESTED, THIS IS A BUG"); break; } }
/* Purpose: To add a component according to user input * Pre: Current layer exists, * stringstream with component type, x position, and y position * Post: Adds component of given type at given position * Author: Matthew James Harrison ******************************************************************************/ void addComponent(Layer &layer, StartingList &startingList, stringstream &ss) { string data = ""; ComponentType type = EMPTY; int xPos = -1; int yPos = -1; /* Get command data */ type = readComponentType(ss); xPos = readNumber(ss); yPos = readNumber(ss); /* If no junk data */ if (!hasJunk(ss)) { /* If type and position are valid */ if (isPosition(layer, xPos, yPos) && type != EMPTY) { addComponent(layer, startingList, type, xPos, yPos); } else { displayMessage(MSG_INV_ADD); } } }
/* Purpose: To clear all components from the current layer * Pre: Current layer exists * List of starting positions * Stringstream from user input * Post: Displays grid on the screen * Author: Matthew James Harrison ******************************************************************************/ void clear(Layer &layer, StartingList &startingList, stringstream &ss) { int currentLayer = 0; int height = 0; int width = 0; currentLayer = layer.getCurrentLayer(); height = layer.get(currentLayer)->getHeight(); width = layer.get(currentLayer)->getWidth(); /* If no junk data */ if (!hasJunk(ss)) { /* Traverse each row */ for (int i = 0; i < height; i++) { /* Traverse each column of current row */ for (int j = 0; j < width; j++) { removeComponent(layer, startingList, j, i); } } } else { displayMessage(MSG_INV_COMMAND); } }
void MainWindow::connectToHost() { client = new AnonymousClient(this); connect(client, SIGNAL(sslErrors(QList<QSslError>)), SLOT(sslErrors(QList<QSslError>))); connect(client, SIGNAL(messageAvailable(QString)), SLOT(displayMessage(QString))); connect(client, SIGNAL(debugAvailable(QString)), debugConsole, SLOT(displayDebug(QString))); connect(client, SIGNAL(setPhase0()), SLOT(phase0())); connect(client, SIGNAL(setPhase1()), SLOT(phase1())); connect(client, SIGNAL(disconnected()), SLOT(disconnectFromhost())); connectButton->setEnabled(false); disconnectButton->setEnabled(true); displayMessage(tr("Connecting...")); client->connectToHostEncrypted(settings->value("HostAddress", "localhost").toString(), settings->value("port", 9001).toInt()); }
void setPlaybackSpeed(int ratioDiff) { if (g_Player.IsValid()) { XnDouble dNewSpeed = g_Player.GetPlaybackSpeed() * pow(2.0, (XnDouble)ratioDiff); XnStatus nRetVal = g_Player.SetPlaybackSpeed(dNewSpeed); if (nRetVal != XN_STATUS_OK) { displayMessage("Failed to set playback speed: %s", xnGetStatusString(nRetVal)); } } else { displayMessage("Can't set playback speed - input is not a recording!"); } }
void toggleStream(Generator& generator, XnProductionNodeType type, bool* bIsOn) { XnStatus nRetVal = XN_STATUS_OK; if (!generator.IsValid()) { createStream(generator, type); } if (!generator.IsValid()) { // failed creating the stream return; } if (generator.IsGenerating()) { generator.StopGenerating(); } else { nRetVal = generator.StartGenerating(); if (nRetVal != XN_STATUS_OK) { displayMessage("Failed to turn on %s: %s", generator.GetInfo().GetInstanceName(), xnGetStatusString(nRetVal)); return; } } *bIsOn = (generator.IsGenerating() == TRUE); }