void MainWindow::sRun() { ui->textBrowser->setText(QString("")); try{ braifuck = new BF_debug_interp(this->ui->textEdit->toPlainText(), memLen, this->ui->textBrowser); } catch(std::string ex) { ui->textBrowser->setText("ERROR WRONG CODE"); return; } braifuck->start(QThread::NormalPriority); Debug->setEnabled(false); Stop->setEnabled(true); Run->setEnabled(false); connect(braifuck, SIGNAL(finished()), this, SLOT(sStop())); }
void MainWindow::sStop() { if(!(braifuck->isFinished())){ braifuck->quit(); ui->textBrowser->setText(ui->textBrowser->toPlainText()+QString("\nPROGRAM HAS BEEN STOPED")); } else { ui->textBrowser->setText(ui->textBrowser->toPlainText()+QString("\nPROGRAM ENDED SUCCESSFULLY")); disconnect(braifuck, SIGNAL(finished()), this, SLOT(sStop())); delete braifuck; } Stop->setEnabled(false); Run->setEnabled(true); Debug->setEnabled(true); nextStep->setEnabled(false); braifuck = NULL; }
void MainWindow::setSingnals() { connect(fileMenuNew, SIGNAL(triggered()), this, SLOT( sNew() )); connect(fileMenuOpen, SIGNAL(triggered()), this, SLOT( sOpen() )); connect(fileMenuSave, SIGNAL(triggered()), this, SLOT( sSave() )); connect(fileMenuQuit, SIGNAL(triggered()), qApp, SLOT(quit() )); connect(fileMenuSaveAs, SIGNAL(triggered()), this, SLOT( sSaveAs() )); connect(this->ui->send_button, SIGNAL(clicked()), this, SLOT(sSend())); //connect(przyklad, SIGNAL(triggered()), this, SLOT( sEg((QString)"przyklad") )); connect(Run, SIGNAL(triggered()), this, SLOT( sRun() )); connect(Debug, SIGNAL(triggered()), this, SLOT( sDebug() )); connect(Stop, SIGNAL(triggered()), this, SLOT( sStop() )); connect(Undo, SIGNAL(triggered()), this, SLOT( sUndo() )); connect(Redo, SIGNAL(triggered()), this, SLOT( sRedo() )); connect(Copy, SIGNAL(triggered()), this, SLOT(sCopy())); connect(Cut, SIGNAL(triggered()), this, SLOT(sCut())); connect(Paste, SIGNAL(triggered()), this, SLOT(sPaste())); connect(toC, SIGNAL(triggered()), this, SLOT(sToC())); connect(toJava, SIGNAL(triggered()), this, SLOT(sToJava())); }
void Player::onInitialize() { mController = new FPSPlayerComponent(2, "controller"); mMesh = new dt::MeshComponent("player", "", "player_mesh"); mStatus = new StatusComponent(100, 100); mCamera = new dt::CameraComponent("main_camera"); mWalkingSound = new dt::SoundComponent("walk.wav", "player_walking_sound"); mJumpingSound = new dt::SoundComponent("jump.wav", "player_jump_sound"); const Weapon* weapon = mController->getWeaponInUse(); //this->addComponent(mMesh); this->addComponent(mStatus); this->addComponent(mCamera); this->addComponent(mController); this->addComponent(mWalkingSound); this->addComponent(mJumpingSound); dt::GuiRootWindow& win = dt::GuiManager::get()->getRootWindow(); mHUDAmmo = win.addChildWidget(new dt::GuiButton("HUD_ammo")); mHUDHealth = win.addChildWidget(new dt::GuiButton("HUD_health")); mHUDClip = win.addChildWidget(new dt::GuiButton("HUD_clip")); auto screen_rect = win.getMyGUIWidget()->getAbsoluteRect(); mHUDHealth->setSize(100, 30); mHUDAmmo->setSize(100, 30); mHUDClip->setSize(100, 30); mHUDHealth->setPosition(10, screen_rect.height() - 50); mHUDAmmo->setPosition(screen_rect.width() - 110, screen_rect.height() - 90); mHUDClip->setPosition(screen_rect.width() - 110, screen_rect.height() - 50); dt::GuiManager::get()->setMouseCursorVisible(false); if(mIsControllable) mController->enable(); else mController->disable(); mWalkingSound->getSound().setLoop(true); mJumpingSound->setVolume(20); _refreshHealth(0, 100); if(weapon != nullptr) { _onWeaponChanged(weapon); } if(!QObject::connect(mController, SIGNAL(sWeaponChanged(const Weapon*)), this, SLOT(_onWeaponChanged(const Weapon*)), Qt::DirectConnection)) { dt::Logger::get().debug(QString("Failed to connect the controller's sWeaponChanged") + QString("signal with the player's _OnWeaponChanged")); } if(!QObject::connect(mController, SIGNAL(sMove()), this, SLOT(_onWalk()), Qt::DirectConnection)) { dt::Logger::get().debug(QString("Failed to connect the controller's sMove with the player's _OnWalk")); } if(!QObject::connect(mController, SIGNAL(sStop()), this, SLOT(_onStop()), Qt::DirectConnection)) { dt::Logger::get().debug(QString("Failed to connect the controller's sStop with the player's _OnStop()")); } if(!QObject::connect(mController, SIGNAL(sJump()), this, SLOT(_onJump()), Qt::DirectConnection)) { dt::Logger::get().debug(QString("Failed to connect the controller's sStop with the player's _OnStop()")); } mController->setMouseSensitivity(1); }