SimondConnector::SimondConnector(QObject *parent) : QObject(parent), state(Unconnected), socket(new QSslSocket(this)), timeoutTimer(new QTimer(this)), response(new QDataStream(socket)), mic(new SoundInput(SOUND_CHANNELS, SOUND_SAMPLERATE, this)), passThroughSound(false) { connect(this, SIGNAL(connectionState(ConnectionState)), this, SLOT(setCurrentState(ConnectionState))); connect(socket, SIGNAL(readyRead()), this, SLOT(messageReceived())); connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(socketError())); connect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(socketError())); connect(socket, SIGNAL(connected()), this, SLOT(connectionEstablished())); connect(socket, SIGNAL(encrypted()), this, SLOT(connectionEstablished())); connect(socket, SIGNAL(disconnected()), this, SLOT(connectionLost())); connect(mic, SIGNAL(error(QString)), this, SIGNAL(error(QString))); connect(mic, SIGNAL(microphoneLevel(int,int,int)), this, SIGNAL(microphoneLevel(int,int,int))); connect(mic, SIGNAL(listening()), this, SLOT(startRecording())); connect(mic, SIGNAL(complete()), this, SLOT(commitRecording())); connect(mic, SIGNAL(readyRead()), this, SLOT(soundDataAvailable())); connect(timeoutTimer, SIGNAL(timeout()), this, SLOT(timeoutReached())); timeoutTimer->setSingleShot(true); timeoutTimer->setInterval(SOCKET_TIMEOUT); }
void AdjQueryDlg::setQuery(QString, int entry, int col, int q_cycle, int q_num, int q_start, kvoctrainExpr *exp, kvoctrainDoc *doc, const Comparison &_comp) { //type_timeout = type_to; kv_doc = doc; kv_exp = exp; q_row = entry; q_ocol = col; mw->timebar->setEnabled(Prefs::showCounter()); mw->timelabel->setEnabled(Prefs::showCounter()); comp = _comp; mw->show_all->setDefault(true); QString s; s.setNum (q_cycle); mw->progCount->setText (s); mw->lev1Field->setText (""); mw->lev2Field->setText (""); mw->lev3Field->setText (""); int sel = getRandom(3); switch (sel) { case 0: mw->lev1Field->setText (comp.l1() ); break; case 1: mw->lev2Field->setText (comp.l2() ); break; case 2: mw->lev3Field->setText (comp.l3() ); break; } mw->lev1Field->setEnabled(!comp.l1().isEmpty() ); mw->lev2Field->setEnabled(!comp.l2().isEmpty() ); mw->lev3Field->setEnabled(!comp.l3().isEmpty() ); mw->countbar->setTotalSteps(q_start); mw->countbar->setProgress(q_start - q_num + 1); int mqtime = Prefs::maxTimePer(); if (mqtime > 0) { if (qtimer == 0) { qtimer = new QTimer( this ); connect( qtimer, SIGNAL(timeout()), this, SLOT(timeoutReached()) ); } if (Prefs::queryTimeout() != Prefs::EnumQueryTimeout::NoTimeout) { timercount = mqtime; mw->timebar->setTotalSteps(timercount); mw->timebar->setProgress(timercount); qtimer->start(1000, TRUE); } else mw->timebar->setEnabled(false); } else mw->timebar->setEnabled(false); resetAllFields(); }