/** * @brief MainWindow::on_updateButton_clicked */ void MainWindow::on_updateButton_clicked() { currentAction = GIT; if (usePass) { executePass("git pull"); } else { executeWrapper(gitExecutable, "pull"); } }
/** * @brief MainWindow::on_updateButton_clicked */ void MainWindow::on_updateButton_clicked() { ui->statusBar->showMessage(tr("Updating password-store"), 2000); currentAction = GIT; if (usePass) { executePass("git pull"); } else { executeWrapper(gitExecutable, "pull"); } }
/** * @brief MainWindow::on_treeView_clicked * @param index */ void MainWindow::on_treeView_clicked(const QModelIndex &index) { currentAction = GPG; if (model.fileInfo(index).isFile()){ QString passFile = model.filePath(index); if (usePass) { passFile.replace(".gpg", ""); passFile.replace(passStore, ""); executePass(passFile); } else { executeWrapper(gpgExecutable , "--no-tty -dq " + passFile); } } }
/** * @brief MainWindow::on_treeView_clicked * @param index */ void MainWindow::on_treeView_clicked(const QModelIndex &index) { currentAction = GPG; QString filePath = model.filePath(proxyModel.mapToSource(index)); QString passFile = filePath; passFile.replace(QRegExp("\\.gpg$"), ""); passFile.replace(QRegExp("^" + passStore), ""); if (model.fileInfo(proxyModel.mapToSource(index)).isFile()){ if (usePass) { executePass(passFile); } else { executeWrapper(gpgExecutable , "--no-tty -dq " + filePath); } } }
void teamState::updateState() // updates the state of the object { // exit(0); //conversion *convert = conversion::Instance(); boost::shared_ptr<conversion> convert = conversion::Instance(); //gameEngine *gameE = gameEngine::Instance(); boost::shared_ptr<gameEngine> gameE = gameEngine::Instance(); //gameState *gameS = gameState::Instance(); boost::shared_ptr<gameState> gameS = gameState::Instance(); boost::shared_ptr<physicsEngine> physEngine = physicsEngine::Instance(); jumpBalls jumpBall = gameS->getJumpBall(); size_t activeBBallInstance = gameS->getActiveBBallInstance(); // logMsg("Updating team state " +convert->toString(teamNumber)); if (gameS->getBasketballInstancesCreated() && playerInstancesCreated) { std::vector<basketballs> basketballInstance = gameS->getBasketballInstance(); // exit(0); // checks whether to execute offense or defense logic if (offense == true && defense == false) { offenseInstance->setExecute(true); defenseInstance->setExecute(false); if (offenseInstance->getTeamType() != teamType) // sets type of team for offense { offenseInstance->setTeamType(teamType); } } else if (defense == true && offense == false) { offenseInstance->setExecute(false); defenseInstance->setExecute(true); if (defenseInstance->getTeamType() != teamType) // sets type of team for defense { defenseInstance->setTeamType(teamType); } } else { } if (gameS->getTipOffComplete()) { // exit(0); // logMsg("Team with ball == " +convert->toString(gameS->getTeamWithBall())); // logMsg("Player with ball == " +convert->toString(playerWithBall)); if (gameS->getTeamWithBall() == teamType) // checks if the team has the basketball { logMsg("tipoffcomplete playerWithBallInstance == " +convert->toString(playerWithBallInstance)); size_t x = 0; size_t instanceWithBall = -1; while (x < activePlayerInstance.size()) { if (activePlayerInstance[x].getPlayerID() == playerWithBallID) { instanceWithBall = x; break; } ++x; } if (!activePlayerInstance[instanceWithBall].getPassBall()) // checks if the player with ball is passing it. { // exit(0); } else if (activePlayerInstance[instanceWithBall].getPassBall()) { logMsg("Calculating Pass"); // exit(0); if (!playerInstance[instanceWithBall].getPassCalculated()) { // exit(0); Ogre::Vector3 bballPos; Ogre::Vector3 playerPos; activePlayerInstance[instanceWithBall].calculatePass(); //sets the basketball Height; bballPos = basketballInstance[activeBBallInstance].getNode()->getPosition(); playerPos = activePlayerInstance[instanceWithBall].getNode()->getPosition(); bballPos[1] = playerPos[1]; basketballInstance[activeBBallInstance].getNode()->setPosition(bballPos); } else if (activePlayerInstance[playerWithBallInstance].getPassCalculated()) { // exit(0); executePass(); if (physEngine->getPassCollision()) // checks if ball has collided with player being passed to. { // exit(0); activePlayerInstance[instanceWithBall].setPassBall(false); // player is no longer passing the ball playerWithBallInstance = activePlayerInstance[instanceWithBall].getPassToPlayer(); // playerWithBall has changed if (humanControlled) { humanPlayer = instanceWithBall; } physEngine->setPassCollision(false); // resets the pass collision state } else { } } } // logMsg("Player with ball == " +convert->toString(playerWithBall)); // logMsg("Player with ball's name: " +activePlayerInstance[playerWithBall].getPlayerName()); // logMsg("Player with ball's current position: " +convert->toString(activePlayerInstance[playerWithBall].getNode()->getPosition())); } } logMsg("Team type = " +convert->toString(teamType)); logMsg("Human player = " +convert->toString(humanPlayer)); updatePlayerStates(); //updatePlayerMovements(); // updates movement of player objects //updatePlayerDirections(); // updates the direction the players are facing // exit(0); /* if (physEngine->getPlayerPhysicsSetup()) // makes sure player physics are setup before modifying physics positions { updatePositions(); // exit(0); } else { } */ // logMsg("Team == " +toString(teamType)); // exit(0); } else { } // exit(0); if (gameS->getTipOffComplete()) { logMsg("tipOff Complete!"); // exit(0); if (gameS->getTeamWithBall() == teamType) { offenseInstance->updateState(teamType); // updates the state of the offenseInstance object } else { defenseInstance->updateState(teamType); // updates the state of the defenseInstance object } } else { } // logMsg("team state updated = " +convert->toString(teamType)); }