Esempio n. 1
0
void GameWidget::nextMove()
{
    _gameController->nextMove();
    bool gameFinished = _gameController->gameOver();
    this->updateActor();

    _lblMovementGhostCounter->setText(QString::number(_gameController->getGhostMovementCounter()));

    if(gameFinished)
    {
        QMessageBox msgBox;
        msgBox.setText("Le Pacman a été attrapé !");
        QString text = "Les ghosts ont mis ";
        text += QString("%1").arg( _gameController->getGhostMovementCounter() );
        text += " coups pour attraper le Pacman.\n";

        msgBox.setDetailedText(text);

        QPushButton *btnRestart = msgBox.addButton(tr("&Recommener"), QMessageBox::AcceptRole);
        QPushButton *btnMenu = msgBox.addButton(tr("Revenir au &menu"), QMessageBox::RejectRole);
        msgBox.exec();

        if (msgBox.clickedButton() == btnRestart)
        {
            emit restarted();
        }
        else if (msgBox.clickedButton() == btnMenu)
        {
            emit terminated();
        }
    }
}
Esempio n. 2
0
void QgsTask::cancel()
{
  if ( mOverallStatus == Complete || mOverallStatus == Terminated )
    return;

  mShouldTerminate = true;

#if QT_VERSION >= 0x050500
  //can't cancel queued tasks with qt < 5.5
  if ( mStatus == Queued || mStatus == OnHold )
  {
    // immediately terminate unstarted jobs
    terminated();
  }
#endif

  if ( mStatus == Terminated )
  {
    processSubTasksForTermination();
  }

  Q_FOREACH ( const SubTask& subTask, mSubTasks )
  {
    subTask.task->cancel();
  }
}
Esempio n. 3
0
void KviHttpRequest::slotSocketDisconnected()
{
	switch(m_eProcessingType)
	{
		case WholeFile:
			// happens always
			emit binaryData(*m_p->pBuffer);
		break;
		case Blocks:
			// an unprocessed block ?.. should never happened.. but well :D
			if(m_p->pBuffer->size() > 0)
				emit binaryData(*m_p->pBuffer);
		break;
		case Lines:
			if(m_p->pBuffer->size() > 0)
			{
				// something left in the buffer and has no trailing LF
				KviCString tmp((const char *)(m_p->pBuffer->data()),m_p->pBuffer->size());
				emit data(tmp);
			}
		break;
		case StoreToFile:
			// same as above... should never happen.. but well :D
			if(m_p->pFile && m_p->pBuffer->size() > 0)
				m_p->pFile->write((const char *)(m_p->pBuffer->data()),m_p->pBuffer->size());
		break;
		default:
			// nothing... just make gcc happy
		break;
	}
	resetInternalStatus();
	m_szLastError = __tr2qs("Success");
	emit terminated(true);
}
Esempio n. 4
0
QmitkGibbsTrackingView::QmitkGibbsTrackingView()
  : QmitkFunctionality()
  , m_Controls( 0 )
  , m_MultiWidget( NULL )
  , m_ThreadIsRunning(false)
  , m_GlobalTracker(NULL)
  , m_QBallImage(NULL)
  , m_MaskImage(NULL)
  , m_GfaImage(NULL)
  , m_GfaImageNode(NULL)
  , m_QBallImageNode(NULL)
  , m_ItkQBallImage(NULL)
  , m_FiberBundleNode(NULL)
  , m_TrackingWorker(this)
  , m_QBallSelected(false)
  , m_FibSelected(false)
  , m_Iterations(10000000)
  , m_LastStep(0)
{
  m_TrackingWorker.moveToThread(&m_TrackingThread);
  connect(&m_TrackingThread, SIGNAL(started()), this, SLOT(BeforeThread()));
  connect(&m_TrackingThread, SIGNAL(started()), &m_TrackingWorker, SLOT(run()));
  connect(&m_TrackingThread, SIGNAL(finished()), this, SLOT(AfterThread()));
  connect(&m_TrackingThread, SIGNAL(terminated()), this, SLOT(AfterThread()));
  m_TrackingTimer = new QTimer(this);
}
Esempio n. 5
0
void QgsTask::start()
{
  mStartCount++;
  Q_ASSERT( mStartCount == 1 );

  if ( mStatus != Queued )
    return;

  mStatus = Running;
  mOverallStatus = Running;
  emit statusChanged( Running );
  emit begun();

  // force initial emission of progressChanged, but respect if task has had initial progress manually set
  setProgress( mProgress );

  if ( run() )
  {
    completed();
  }
  else
  {
    terminated();
  }
}
Esempio n. 6
0
//---------------------------------------------------------------------- 
void aucDialog::connect_slots(void) {
  connect(mp_ui->browseButton, SIGNAL(clicked()), this, SLOT(select_file()));
  connect(mp_ui->installerMenu,  SIGNAL(currentIndexChanged(int)), this, SLOT(set_installer_pict()));
  connect(mp_ui->installerMenu,  SIGNAL(currentIndexChanged(int)), this, SLOT(set_installer_options()));
  connect(mp_ui->installMenu_2,  SIGNAL(currentIndexChanged(int)), this, SLOT(update_options2()));
  connect(mp_ui->installMenu_3,  SIGNAL(currentIndexChanged(int)), this, SLOT(update_options3()));
  connect(mp_ui->installCheckbox,  SIGNAL(stateChanged(int)), this, SLOT(update_options3_fromcheckbox()));
  connect(mp_ui->deviceRefreshButton, SIGNAL(clicked()), this, SLOT(populate_devices()));
  connect(mp_ui->startButton,  SIGNAL(clicked()), this, SLOT(build_installer()));
  connect(&m_thread,  SIGNAL(status(QString)), this, SLOT(status(QString)));
  connect(&m_thread,  SIGNAL(finished()), this, SLOT(enable_widgets()));
  connect(&m_thread,  SIGNAL(terminated()), this, SLOT(enable_widgets()));
  connect(&m_thread,  SIGNAL(progress(int)), this, SLOT(progress(int)));
  connect(&m_thread,  SIGNAL(maxprogress(int)), this, SLOT(maxprogress(int)));
  connect(mp_creator,  SIGNAL(status(QString)), this, SLOT(status(QString)));
  connect(mp_creator,  SIGNAL(progress(int)), this, SLOT(progress(int)));
  connect(mp_creator,  SIGNAL(maxprogress(int)), this, SLOT(maxprogress(int)));
  connect(&m_progress_thread, SIGNAL(progress(int)), this, SLOT(progress(int)));
  connect(&m_progress_thread, SIGNAL(maxprogress(int)), this, SLOT(maxprogress(int)));
  connect(&m_release_downloader, SIGNAL(progress(int)), this, SLOT(progress(int)));
  connect(&m_release_downloader, SIGNAL(maxprogress(int)), this, SLOT(maxprogress(int)));
  connect(&m_release_downloader, SIGNAL(downloadComplete(QString)), this, SLOT(download_complete(QString)));
  connect(&m_release_downloader, SIGNAL(status(QString)), this, SLOT(status(QString)));
  
}
Esempio n. 7
0
BackupDialog::BackupDialog(QWidget* parent) : QDialog(parent)
{
    ui.setupUi(this);

    m_thread = new BackupSizeThread();
    connect(m_thread, SIGNAL(finished()), this, SLOT(updateSizeInfo()));
    connect(m_thread, SIGNAL(terminated()), this, SLOT(updateSizeInfo()));

    connect(ui.buttonCancel, SIGNAL(clicked()), this, SLOT(close()));
    connect(ui.buttonCancel, SIGNAL(clicked()), m_thread, SLOT(quit()));
    connect(ui.buttonChange, SIGNAL(clicked()), this, SLOT(changeBackupPath()));
    connect(ui.buttonBackup, SIGNAL(clicked()), this, SLOT(backup()));

    ui.backupSize->setText(tr("Installation size: calculating ..."));
    m_mountpoint = RbSettings::value(RbSettings::Mountpoint).toString();

    m_backupName = RbSettings::value(RbSettings::BackupPath).toString();
    if(m_backupName.isEmpty()) {
        m_backupName = m_mountpoint;
    }
    RockboxInfo info(m_mountpoint);
    m_backupName += "/.backup/rockbox-backup-" + info.version() + ".zip";
    ui.backupLocation->setText(QDir::toNativeSeparators(m_backupName));

    m_thread->setPath(m_mountpoint + "/.rockbox");
    m_thread->start();
}
void
GerenciadorLancamento::startProcessoNativo( const QString& _processo_nome,
                                            const QStringList& _argumentos )
{
    ProcessoNativoPai*
    processo_nativo;

    if ( _processo_nome == "ps")
    {
        processo_nativo = new Ps(_argumentos, 0);
    }
    else if ( _processo_nome == "kill")
    {
        processo_nativo = new Kill(_argumentos, 0);
    }
    else if ( _processo_nome == "exit" )
    {
        exit(0);
    }

    QObject::connect( processo_nativo, SIGNAL(finished()),
                      this,SLOT(processoNativoTerminado()));

    QObject::connect( processo_nativo, SIGNAL(terminated()),
                      this,SLOT(processoNativoTerminado()));

    processo_nativo->start();
}
Esempio n. 9
0
SplashScreen::SplashScreen(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::SplashScreen)
{
    ui->setupUi(this);
    setWindowTitle("pi|game CREATOR");
    setWindowFlags(Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint);
    setAttribute(Qt::WA_TranslucentBackground);

    ssInitThread = new initThread();

    QGraphicsDropShadowEffect* ds = new QGraphicsDropShadowEffect;
    ds->setBlurRadius(4);
    ds->setXOffset(1);
    ds->setYOffset(1);
    ds->setColor(Qt::black);
    ui->splashLabel->setGraphicsEffect(ds);
    canClose = true;

    initThread* t = new initThread;
    t->splash = this;
    connect(t,SIGNAL(finished()), this, SLOT(initcomplete()));
    connect(t,SIGNAL(terminated()), this, SLOT(initcomplete()));
    connect(t,SIGNAL(messageChanged(QString)),this,SLOT(setMessage(QString)));
    t->start();
}
Esempio n. 10
0
void Widget::dozvilNaclose()
{
    disconnect(myUPS, SIGNAL(terminated()), &myThreadTimer, SLOT(start()));
    dozvilNaVyhid=1;
    myUPS->terminate();
    close();
}
Esempio n. 11
0
void CWindowMain::on_execut(const QList<CExecutObject *> &lstObj)
{
    if (!lstObj.isEmpty() && m_executThread == NULL) {

        m_executThread = new CExecutThread(this,lstObj);

        connect(m_executThread,SIGNAL(executOperation(QString)),
                m_widgetConsol,SLOT(executingOperation(QString)));

        connect(m_executThread,SIGNAL(message(QString)),
                m_widgetConsol,SLOT(messageAppend(QString)));

        connect(m_executThread,SIGNAL(started()),
                this,SIGNAL(locked()));

        connect(m_executThread,SIGNAL(timerWork(uint)),
                this,SLOT(on_timerWork(uint)));

        connect(this,SIGNAL(terminated()),
                m_executThread,SLOT(on_terminated()));

        connect(m_executThread,SIGNAL(finished()),
                this,SIGNAL(unlocked()));

        connect(m_executThread,SIGNAL(finished()),
                this,SLOT(on_finished()));

        m_executThread->start();
    }
}
Esempio n. 12
0
void HumanClientFSM::unconsumed_event(const boost::statechart::event_base &event) {
    std::string most_derived_message_type_str = "[ERROR: Unknown Event]";
    const boost::statechart::event_base* event_ptr = &event;
    if (dynamic_cast<const Disconnection*>(event_ptr))
        most_derived_message_type_str = "Disconnection";
#define EVENT_CASE(r, data, name)                                       \
    else if (dynamic_cast<const name*>(event_ptr))                      \
        most_derived_message_type_str = BOOST_PP_STRINGIZE(name);
    BOOST_PP_SEQ_FOR_EACH(EVENT_CASE, _, HUMAN_CLIENT_FSM_EVENTS)
    BOOST_PP_SEQ_FOR_EACH(EVENT_CASE, _, MESSAGE_EVENTS)
#undef EVENT_CASE

    if (terminated()) {
        ErrorLogger(FSM) << "A " << most_derived_message_type_str << " event was passed to "
            "the HumanClientFSM.  The FSM has terminated.  The event is being ignored.";
        return;
    }

    std::stringstream ss;
    ss << "[";
    for (auto leaf_state_it = state_begin(); leaf_state_it != state_end();) {
        // The following use of typeid assumes that
        // BOOST_STATECHART_USE_NATIVE_RTTI is defined
        const auto& leaf_state = *leaf_state_it;
        ss << typeid(leaf_state).name();
        ++leaf_state_it;
        if (leaf_state_it != state_end())
            ss << ", ";
    }
    ss << "]";

    ErrorLogger(FSM) << "A " << most_derived_message_type_str
                     << " event was not handled by any of these states : "
                     << ss.str() << ".  It is being ignored.";
}
Esempio n. 13
0
Widget::Widget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Widget)
{
    ui->setupUi(this);
    QTextCodec *utfcodec = QTextCodec::codecForName("UTF-8"); //qt4
    QTextCodec::setCodecForTr(utfcodec);
    QTextCodec::setCodecForCStrings(utfcodec);
dozvilNaVyhid=0;

    m_tray_icon = new QSystemTrayIcon(QIcon(":/new/emulator.png"), this);


     QAction *another_action = new QAction( "Показати/Сховати", m_tray_icon );
     another_action->setIcon(QIcon(":/new/emulator.png"));
     connect( another_action, SIGNAL(triggered()), this, SLOT(showHide()) );

     QAction *set_action = new QAction( "Налаштування", m_tray_icon );
     set_action->setIcon(QIcon(":/new/sett.png"));
     connect( set_action, SIGNAL(triggered()), this, SLOT(settigsDialog()) );


     QAction *quit_action = new QAction( "Вихід", m_tray_icon );
     quit_action->setIcon(QIcon(":/new/exit.png"));
     connect( quit_action, SIGNAL(triggered()), this, SLOT(dozvilNaclose()) );

     QMenu *tray_icon_menu = new QMenu;
     tray_icon_menu->addAction( another_action );
     tray_icon_menu->addAction( set_action );
     tray_icon_menu->addAction( quit_action );

     m_tray_icon->setContextMenu( tray_icon_menu );

     connect( m_tray_icon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(trayIconClicked(QSystemTrayIcon::ActivationReason)));

     m_tray_icon->show();

     myThreadTimer.setSingleShot(1);
     myThreadTimer.setInterval(3000);


     myUPS=new UPSMonThread(this);

    connect(myUPS, SIGNAL(vyvidDanyh(QStringList)), this, SLOT(vyvidDanyh(QStringList)));
    connect(myUPS, SIGNAL(vyvidMess(QString)), this, SLOT(vyvidPovidomlen(QString)));
    connect(myUPS, SIGNAL(vyvidBattStatus(QString)), this, SLOT(vyvidBattStatus(QString)));
    connect(myUPS, SIGNAL(terminated()), &myThreadTimer, SLOT(start()));
    connect(myUPS, SIGNAL(offcomp()), this, SLOT(dozvilNaclose()));
    connect(&myThreadTimer, SIGNAL(timeout()), this, SLOT(onTimerOut()));

    loadSett();
    myUPS->changeBatAndWaitTime(waitTime, battVal);
    myThreadTimer.start();
//    this->hide();
    QTimer::singleShot(0, this, SLOT(showHide()));

//    connect(this, SIGNAL())

}
Esempio n. 14
0
File: task.cpp Progetto: dotse/bbk
bool Task::addServer(ServerSocket *conn) {
    if (terminated()) {
        if (conn)
            delete conn;
        return false;
    }
    return supervisor->addServer(conn);
}
Esempio n. 15
0
File: task.cpp Progetto: dotse/bbk
bool Task::addConnected(SocketConnection *conn) {
    if (terminated()) {
        if (conn)
            delete conn;
        return false;
    }
    return supervisor->addConnected(conn);
}
Esempio n. 16
0
SerialMonitor::SerialMonitor(QWidget *parent) :
	QMainWindow(parent),
	ui(new Ui::SerialMonitor),
	subWindows(3),
	axesNames(3),
	baudRate(9600)
{
	ui->setupUi(this);

	//Establecemos el primer puerto encontrado como puerto de conexión
	setSerialPort(ui->menuSerialPorts->getDefaultPort());

	//El QtDesigner no la crea automáticamente
	connect(ui->menuSerialPorts, SIGNAL(portChanged(QString)), this, SLOT(setSerialPort(QString)));

	//Inicializamos los nombres de los ejes de cada curva
	axesNames[0] = (tr("x axis"));
	axesNames[1] = (tr("y axis"));
	axesNames[2] = (tr("z axis"));

	//Creamos las sub-ventanas del mdi
	subWindows[0] = new QMdiSubWindow;
	subWindows[1] = new QMdiSubWindow;
	subWindows[2] = new QMdiSubWindow;

	//Creamos las gráficas
	subWindows[0]->setWidget(new Plotter(tr("Gyroscope"), axesNames,this));
	subWindows[1]->setWidget(new Plotter(tr("Accelerometer"), axesNames,this));
	subWindows[2]->setWidget(new Plotter(tr("Magnetometer"), axesNames,this));
	//TODO: No se pueden cerrar
	//Desabilitamos cerrar, junto con minimizar y maximizar
	//subWindows[0]->setWindowFlags(Qt::CustomizeWindowHint);
	//subWindows[1]->setWindowFlags(Qt::CustomizeWindowHint);
	//subWindows[2]->setWindowFlags(Qt::CustomizeWindowHint);

	//Añadimos las gráficas al mdi y al menu
	for(int i = 0 ; i < subWindows.size() ; ++i){
		ui->mdiArea->addSubWindow(subWindows[i]);

		//Creamos la acción y la añadimos al menu
		checkableQAction *a = new checkableQAction(i, subWindows[i]->windowTitle(), this);
		a->setChecked(true);
		//Conectamos la señal de la acción
		connect(a, SIGNAL(toggledNum(int,bool)), this, SLOT(menuWindowsAction(int,bool)));
		ui->menuWindows->addAction(a);

		subWindows[i]->show();
	}

	//Conectamos las señales del hilo de Serial
	connect(&serial, SIGNAL(started()), this, SLOT(connectedSerial()));
	connect(&serial, SIGNAL(finished()), this, SLOT(disconnectedSerial()));
	connect(&serial, SIGNAL(terminated()), this, SLOT(disconnectedSerial()));
	connect(&serial, SIGNAL(readException(QString)), this, SLOT(readException(QString)));
	//Conectamos la señal de nueva trama para recoger las tramas
	qRegisterMetaType<Frame>("Frame");
	connect(&serial, SIGNAL(newFrame(Frame)), this, SLOT(newFrame(Frame)));
}
Esempio n. 17
0
void UdpListener::stop()
{
    _break = true;
    socket()->abort();
    socket()->close();
    wait();
    emit terminated();
    emit finished();
}
void MainWindow::closeEvent(QCloseEvent *)
{
    m_DataThreadTerminatedMutex.lock();
    bool bResult = connect(CDataThread::getInstance(), SIGNAL(terminated()) ,
                           this, SLOT(onWaitingForDataThreadTermination()));
    bResult = connect(CDataThread::getInstance(), SIGNAL(finished()) ,
                      this, SLOT(onWaitingForDataThreadTermination()));
    ptrDataThread = CDataThread::getInstance();
    CDataThread::getInstance()->quit();
}
Esempio n. 19
0
void KviIrcLink::start()
{
	m_eState = Connecting;
	if(m_pResolver)
		delete m_pResolver; // this should never happen

	m_pResolver = new KviIrcConnectionTargetResolver(m_pConnection);
	connect(m_pResolver, SIGNAL(terminated()), this, SLOT(resolverTerminated()));
	m_pResolver->start(m_pTarget);
}
Esempio n. 20
0
// Sets up the Unix signal notifier and register the termination signals.
Termination::Termination(QObject *parent) : QObject(parent) {
	assert(::instance == NULL);
	::instance = this;
	notifiers[0] = SignalNotifier::instance<SIGHUP>();
	notifiers[1] = SignalNotifier::instance<SIGINT>();
	notifiers[2] = SignalNotifier::instance<SIGQUIT>();
	notifiers[3] = SignalNotifier::instance<SIGTERM>();
	for (size_t i = 0; i < countof(notifiers); ++i) {
		connect(notifiers[i].get(), SIGNAL(raised()), SIGNAL(terminated()));
	}
}
Esempio n. 21
0
void WP34sFlashDialog::setVisible(bool visible)
{
	QDialog::setVisible(visible);
	if(visible && !flashStarted)
	{
		flashStarted=true;
		connect(&flash, SIGNAL(finished()), this, SLOT(onFlashThreadEnded()));
		connect(&flash, SIGNAL(terminated()), this, SLOT(onFlashThreadEnded()));
		flash.start(this);
	}
}
Esempio n. 22
0
void ProgressTask::doTestProgress(double mbps, double duration,
                                  unsigned int no_conn) {
    if (duration <= current_duration || terminated())
        return;

    current_duration = duration;

    // Don't let the speed decrease the last half second:
    if (duration < tot_duration-0.5 || mbps > current_mbps)
        current_mbps = mbps;

    if (duration >= tot_duration) {
        setResult(fValue(current_mbps));
        return;
    }

    setMessage("progress");
    log() << "task progress " << current_mbps << ' ' << duration/tot_duration;

    if (duration > tot_duration-0.35) {
        // Less than 0.35 seconds left, don't make any new requests
        // (but let existing requests keep going).
        noMoreConnections();
        current_load_size = 0;
        soon_finished = true;
        return;
    }

    // Calculate appropriate load size for subsequent requests

    //unsigned int n = getNoConnections();
    if (!no_conn)
        return;

    double time_left = tot_duration - duration;

    // We'll probably load this number of bytes during the time_left:
    double exp_bytes;
    if (speedlimit_mbps > 0.0)
        exp_bytes = std::min(speedlimit_mbps, mbps) * std::min(time_left, 0.3) / 0.000008;
    else
        exp_bytes = mbps * time_left / 0.000008;

    current_load_size = static_cast<size_t>(exp_bytes / 4.0 / no_conn);
    if (current_load_size > 40000000)
        current_load_size = 40000000;
    else if (current_load_size < 6000)
        current_load_size = 6000;

    if (speedlimit_mbps > mbps) {
        dbg_log() << "We're going too slow, wake up the passive connections";
        wakeUp();
    }
}
Esempio n. 23
0
void PackageScanner::refresh()
{
    emit progressMessage( tr( "Scanning for packages..." ));
    emit progressValue( 0 );
    mScanner = new ScannerThread( this );
    connect( mScanner, SIGNAL(finished()),
            this, SLOT(scannerDone()) );
    connect( mScanner, SIGNAL(terminated()),
            this, SLOT(scannerDone()) );
    mScanner->start();
}
Esempio n. 24
0
void MainScreen::handleSend()
{
	m_cancelled = false;
	m_mainPage->setProperty("workInProgress", true);
	m_worker = new QThread(this);

	 connect(m_worker, SIGNAL(started()), this, SLOT(doSend()));
	 connect(m_worker, SIGNAL(finished()), this, SLOT(workDone()));
	 connect(m_worker, SIGNAL(terminated()), this, SLOT(workDone()));
	 m_worker->start();
}
Esempio n. 25
0
ImageGolographicObject :: ImageGolographicObject (QObject * parent)
    : QObject (parent),
    m_ImageGol (new ImageGolographicThread (this)),
    pDialog (new QProgressDialog(tr("Creating images..."), tr("&Cancel"), 0, 0))
{
    qRegisterMetaType< VGolographic > ("VGolographic");
    connect (m_ImageGol, SIGNAL (setValue (int)), this, SLOT (setProgVal(int)) );
    connect (m_ImageGol, SIGNAL (getImagesData (const VGolographic&)), this, SLOT (loadImageData (const VGolographic&)) );
    connect (m_ImageGol, SIGNAL (finished()), this, SLOT (imageGenFinished()) );
    connect (m_ImageGol, SIGNAL (terminated()), this, SLOT (imageGenTerminated()) );
}
Esempio n. 26
0
EventProcessingBlockInOwnThread::~EventProcessingBlockInOwnThread ()
{
    QObject::disconnect(this, SIGNAL(terminated()), this, SLOT(on_terminated()));
    QObject::disconnect(this, SIGNAL(finished  ()), this, SLOT(on_finished  ()));
    QObject::disconnect(this, SIGNAL(started   ()), this, SLOT(on_started   ()));

    QObject::disconnect(this, SIGNAL(dbg_terminated(EventProcessingBlockInOwnThread*)), &debugger(), SLOT(terminated(EventProcessingBlockInOwnThread*)));
    QObject::disconnect(this, SIGNAL(dbg_finished  (EventProcessingBlockInOwnThread*)), &debugger(), SLOT(finished  (EventProcessingBlockInOwnThread*)));
    QObject::disconnect(this, SIGNAL(dbg_started   (EventProcessingBlockInOwnThread*)), &debugger(), SLOT(started   (EventProcessingBlockInOwnThread*)));

    debugger().destroyed(this);
}
Esempio n. 27
0
void QuickPhraseModel::load()
{
    QThread* thread = new QThread;
    m_parser->moveToThread(thread);
    connect(thread, SIGNAL(started()), m_parser, SLOT(run()));
    thread->start();
    connect(m_parser, SIGNAL(finished()), thread, SLOT(quit()));
    connect(thread, SIGNAL(finished()), this, SLOT(loadFinished()));
    //delete thread only when thread has really finished
    connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
    connect(thread, SIGNAL(terminated()), thread, SLOT(deleteLater()));
}
Esempio n. 28
0
    void Director::init(const Vec2i& screen)
    {
        random.seed();
        graphics::set_resolution(screen);
        script_ = GameBase::create(*this);
        script_->init(screen);

        if (terminated())
            return;

        scenegraph_.update(0);
    }
Esempio n. 29
0
void ImportGrammarWorkingPage::initializePage()
{
  completed=false;
  emit completeChanged();

  grammarImporter = new ImportGrammar(this);
  connect(grammarImporter, SIGNAL(status(QString)), this, SLOT(printStatus(QString)));
  connect(grammarImporter, SIGNAL(fileProgress(int,int)), this, SLOT(displayFileProgress(int,int)));
  connect(grammarImporter, SIGNAL(allProgress(int,int)), this, SLOT(displayWholeProgress(int,int)));
  connect(grammarImporter, SIGNAL(grammarCreated()), this, SIGNAL(grammarCreated()));
  connect(grammarImporter, SIGNAL(terminated()), this, SLOT(processCompletion()));

  bool isText = field("inputIsText").toBool();
  if (isText) {
    //bla
    QString tempFileName = KStandardDirs::locateLocal("tmp", "grammarImport/importText");

    QFile f(tempFileName);
    if (!f.open(QIODevice::WriteOnly)) {
      KMessageBox::sorry(this, i18n("Could not open temporary file."));
      return;
    }

    QByteArray textByte = field("grammarInputText").toString().toUtf8();
    f.write(textByte);
    f.close();

    grammarImporter->setFiles(QStringList() << tempFileName);
    grammarImporter->setEncoding("UTF-8");
  }
  else {

    QStringList files = field("files").toStringList();

    int index=0;
    QStringList tempFiles;
    foreach (const QString& file, files) {
      KUrl srcUrl(file);
      QString targetPath = KStandardDirs::locateLocal("tmp", "grammarImport/"+
        QString::number(index)+'_'+srcUrl.fileName());
      KIO::FileCopyJob *job = KIO::file_copy(srcUrl, targetPath, -1, KIO::Overwrite);
      if (!job->exec()) {
        job->ui()->showErrorMessage();
        continue;
      } else
      tempFiles << targetPath;
      index++;
      delete job;
    }
    grammarImporter->setFiles(tempFiles);
    grammarImporter->setEncoding(field("encoding").toString());
  }
Esempio n. 30
0
void BluetoothListener::slotProcessFinished(int ex, QProcess::ExitStatus state)
{
    switch (state) {
    case QProcess::NormalExit:
        emitMessage(tr("%1: Process %2 terminated with exit code %3.")
                    .arg(d->device).arg(d->pid).arg(ex));
        break;
    case QProcess::CrashExit:
        emitMessage(tr("%1: Process %2 crashed.").arg(d->device).arg(d->pid));
        break;
    }
    emit terminated();
}