//! \brief Creates Talkfiles. //! //! \param logger A pointer to a Loggerobject bool TalkFileCreator::createTalkFiles() { m_abort = false; QString errStr; emit logItem(tr("Starting Talk file generation for folder %1") .arg(m_dir.dirName()), LOGINFO); emit logProgress(0,0); QCoreApplication::processEvents(); // read in Maps of paths - file/dirnames emit logItem(tr("Reading Filelist..."),LOGINFO); if(createTalkList(m_dir) == false) { emit logItem(tr("Talk file creation aborted"),LOGERROR); doAbort(); return false; } QCoreApplication::processEvents(); // generate entries { TalkGenerator generator(this); // no string corrections yet: do not set language for TalkGenerator. connect(&generator,SIGNAL(done(bool)),this,SIGNAL(done(bool))); connect(&generator,SIGNAL(logItem(QString,int)),this,SIGNAL(logItem(QString,int))); connect(&generator,SIGNAL(logProgress(int,int)),this,SIGNAL(logProgress(int,int))); connect(this,SIGNAL(aborted()),&generator,SLOT(abort())); if(generator.process(&m_talkList) == TalkGenerator::eERROR) { doAbort(); return false; } } // Copying talk files emit logItem(tr("Copying Talkfiles..."),LOGINFO); if(copyTalkFiles(&errStr) == false) { emit logItem(errStr,LOGERROR); doAbort(); return false; } // Deleting left overs if( !cleanup()) return false; emit logItem(tr("Finished creating Talk files"),LOGOK); emit logProgress(1,1); emit done(false); return true; }
void ThreadOperation::abort() { doAbort(); aborted = true; waitingThread->operation = NULL; Scheduler::setThreadRunning(waitingThread); }
void CPlay::eval () { game->draw (); if (game->isLevelComplete()) { doExitLevel(); return; } // // eval game when EVAL_INTERVAL has elapsed. // this ensures the game plays at the same speed // on all machines. // bool evaled = false; while (adjustedEvalTime >= CGame::EVAL_INTERVAL) { adjustedEvalTime -= CGame::EVAL_INTERVAL; evaled = true; game->eval (lmbExists); if (CGameDevice::MOUSE_RMB) rmbExists = true; else if (rmbExists) { doPause (); return; } if (isKeyPressed (CGameDevice::ESC, esc)) { doAbort (); return; } } if (evaled) adjustedEvalTime = 0; // discard remaining time for smooth motion }
void Task::abort() { if (!m_abortFlag) { m_abortFlag = true; doAbort(); } }
void CPause::eval () { game->draw (); menu.draw (); menu.input (); if (CGameDevice::MOUSE_RMB) rmbExists = true; else if (rmbExists) { doPlay (true); return; } if (isKeyPressed (CGameDevice::ESC, esc)) doAbort (); }
LoadingDialog::LoadingDialog(QWidget *parent) : QDialog(parent) { //Modal = true; setWindowTitle("Loading Route..."); iconArea = new QLabel(); iconArea->setObjectName("iconArea"); iconArea->setFrameStyle(QFrame::StyledPanel); iconArea->setMinimumSize(QSize(210, 210)); iconArea->setPixmap(QPixmap(":/RWMapMaker/Resources/MapMakerPersp-ico.png")); iconArea->setAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop); logText = new QLabel(); logText->setObjectName("logText"); logText->setFrameStyle(QFrame::StyledPanel); logText->setMinimumSize(QSize(240, 192)); logText->setMaximumSize(QSize(480, 240)); logText->setAlignment(Qt::AlignLeft|Qt::AlignTop); logText->setWordWrap(true); cancelButton = new QPushButton(); cancelButton->setObjectName("cancelButton"); cancelButton->setText("Abort"); cancelButton->setShortcut(QKeySequence("Esc")); cancelButton->setMinimumSize(QSize(48, 12)); connect(cancelButton, SIGNAL(clicked()), this, SLOT(doAbort())); progressBar = new QProgressBar(); progressBar->setObjectName("progressBar"); progressBar->setFormat("%v (%p%)"); progressBar->setAlignment(Qt::AlignCenter); row1Layout = new QHBoxLayout(); row1Layout->setObjectName("row1Layout"); row1Layout->setSpacing(12); row1Layout->addWidget(iconArea); row1Layout->addWidget(logText); row2Layout = new QHBoxLayout(); row2Layout->setObjectName("row2Layout"); row2Layout->setSpacing(12); row2Layout->addWidget(this->cancelButton); row2Layout->addStretch(1); col1Layout = new QVBoxLayout(); col1Layout->setObjectName("col1Layout"); col1Layout->setSpacing(12); col1Layout->setContentsMargins(QMargins(10,10,10,5)); col1Layout->addLayout(this->row1Layout); col1Layout->addWidget(this->progressBar); col1Layout->addLayout(this->row2Layout); setLayout(col1Layout); }
//============================================================================= // METHOD : SPELLcontroller::executeCommand() //============================================================================= void SPELLcontroller::executeCommand( const ExecutorCommand& cmd ) { // If a (repeatable) command is being executed, discard this one if (isCommandPending() && (cmd.id != CMD_ABORT) && (cmd.id != CMD_FINISH) && (cmd.id != CMD_INTERRUPT) && (cmd.id != CMD_PAUSE) && (cmd.id != CMD_CLOSE)) { LOG_WARN("Discarding command " + cmd.id); return; } LOG_INFO("Now executing command " + cmd.id); startCommandProcessing(); if (cmd.id == CMD_ABORT) { doAbort(); } else if (cmd.id == CMD_FINISH) { doFinish(); } else if (cmd.id == CMD_ACTION) { doUserAction(); } else if (cmd.id == CMD_STEP) { doStep( false ); } else if (cmd.id == CMD_STEP_OVER) { doStep( true ); } else if (cmd.id == CMD_RUN) { doPlay(); } else if (cmd.id == CMD_SKIP) { doSkip(); } else if (cmd.id == CMD_GOTO) { if (cmd.earg == "line") { DEBUG("[C] Processing go-to-line " + cmd.arg); try { int line = STRI(cmd.arg); doGoto( line ); } catch(...) {}; } else if (cmd.earg == "label") { DEBUG("[C] Processing go-to-label " + cmd.arg); doGoto( cmd.arg ); } else { SPELLexecutor::instance().getCIF().error("Unable to process Go-To command, no target information", LanguageConstants::SCOPE_SYS ); } } else if (cmd.id == CMD_PAUSE) { doPause(); } else if (cmd.id == CMD_INTERRUPT) { doInterrupt(); } else if (cmd.id == CMD_SCRIPT) { /** \todo determine when to override */ doScript(cmd.arg,false); } else if (cmd.id == CMD_CLOSE) { m_recover = false; m_reload = false; doClose(); } else if (cmd.id == CMD_RELOAD) { doReload(); } else if (cmd.id == CMD_RECOVER) { doRecover(); } else { LOG_ERROR("[C] UNRECOGNISED COMMAND: " + cmd.id) } m_mailbox.commandProcessed(); // The command has finished, release the dispatcher setCommandFinished(); DEBUG("[C] Command execution finished " + cmd.id); //TEMPORARILY DISABLED: it creates deadlocks. // notifyCommandToCore( cmd.id ); }