WelcomeDialog::WelcomeDialog(QWidget *parent) : QDialog(parent), ui(new Ui::WelcomeDialog) { ui->setupUi(this); ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); connect(ui->openContestWidget, SIGNAL(selectionChanged()), this, SLOT(selectionChanged())); connect(ui->newContestWidget, SIGNAL(informationChanged()), this, SLOT(informationChanged())); connect(ui->tabWidget, SIGNAL(currentChanged(int)), this, SLOT(tabIndexChanged(int))); connect(ui->openContestWidget, SIGNAL(rowDoubleClicked()), this, SLOT(accept())); }
NewContestWidget::NewContestWidget(QWidget *parent) : QWidget(parent), ui(new Ui::NewContestWidget) { ui->setupUi(this); connect(ui->selectButton, SIGNAL(clicked()), this, SLOT(selectContestPath())); connect(ui->savingName, SIGNAL(textChanged(QString)), this, SLOT(savingNameChanged())); connect(ui->contestTitle, SIGNAL(textChanged(QString)), this, SIGNAL(informationChanged())); connect(ui->savingName, SIGNAL(textChanged(QString)), this, SIGNAL(informationChanged())); connect(ui->contestPath, SIGNAL(textChanged(QString)), this, SIGNAL(informationChanged())); }
void testQOfonoVoiceCall() { QSignalSpy dialreg(m,SIGNAL(dialComplete(bool))); QSignalSpy dspy(m, SIGNAL(callAdded(QString))); // Dial and hangup m->dial("123",""); QTest::qWait(1000); QCOMPARE(dialreg.count(), 1); QCOMPARE(dialreg.takeFirst().at(0).toBool(),true); QCOMPARE(dspy.count(), 1); QString callid = dspy.takeFirst().at(0).toString(); QOfonoVoiceCall* call = new QOfonoVoiceCall(this); call->setVoiceCallPath(callid); QTRY_VERIFY(call->isValid()); QSignalSpy state(call, SIGNAL(stateChanged(QString))); QSignalSpy discreason(call,SIGNAL(disconnectReason(QString))); QSignalSpy hspy(call, SIGNAL(hangupComplete(bool))); QSignalSpy li (call, SIGNAL(lineIdentificationChanged(QString))); QSignalSpy name (call, SIGNAL(nameChanged(QString))); QSignalSpy info (call, SIGNAL(informationChanged(QString))); QSignalSpy mp (call, SIGNAL(multipartyChanged(bool))); QSignalSpy em (call, SIGNAL(emergencyChanged(bool))); QSignalSpy st (call, SIGNAL(startTimeChanged(QString))); QSignalSpy ic (call, SIGNAL(iconChanged(quint8))); qDebug() << "Please find a call in 'Dialing' state in phonesim window and press 'Active' button"; QTest::qWait(15000); QVERIFY(state.count()>0); QVERIFY(st.count()>0); QVERIFY(ic.count()==0); QVERIFY(em.count()==0); QVERIFY(mp.count()==0); QVERIFY(info.count()==0); QVERIFY(name.count()==0); QVERIFY(li.count()==0); QCOMPARE(call->state(),QString("active")); QCOMPARE(call->lineIdentification(),QString("123")); QCOMPARE(call->emergency(),false); QCOMPARE(call->multiparty(),false); QCOMPARE(call->name(),QString("")); QCOMPARE(call->information(),QString("")); call->hangup(); QTest::qWait(5000); QCOMPARE(hspy.count(), 1); QCOMPARE(hspy.takeFirst().at(0).toBool(),true); QCOMPARE(discreason.count(), 1); QCOMPARE(discreason.takeFirst().at(0).toString(), QString("local")); delete call; }
void StatisticsObject::setInternalScaleFactor(int internalScaleFactor) { internalScaleFactor = clip(internalScaleFactor, 1, MAX_SCALE_FACTOR); if(p_internalScaleFactor!=internalScaleFactor) { p_internalScaleFactor = internalScaleFactor; emit informationChanged(); } }
void testQOfonoVoiceCallStep2() { //Dial failure, incoming, answer and local hangup QSignalSpy callsignal(m, SIGNAL(callAdded(QString))); m->dial("199",""); QTest::qWait(8000); QCOMPARE(callsignal.count(),1); QString callid = callsignal.takeFirst().at(0).toString(); QOfonoVoiceCall* call = new QOfonoVoiceCall(this); call->setVoiceCallPath(callid); QSignalSpy state(call, SIGNAL(stateChanged(QString))); QSignalSpy time(call,SIGNAL(startTimeChanged(QString))); QSignalSpy discreason(call,SIGNAL(disconnectReason(QString))); QSignalSpy hspy(call, SIGNAL(hangupComplete(bool))); QSignalSpy aspy(call, SIGNAL(answerComplete(bool))); QSignalSpy li (call, SIGNAL(lineIdentificationChanged(QString))); QSignalSpy name (call, SIGNAL(nameChanged(QString))); QSignalSpy info (call, SIGNAL(informationChanged(QString))); QSignalSpy mp (call, SIGNAL(multipartyChanged(bool))); QSignalSpy em (call, SIGNAL(emergencyChanged(bool))); QSignalSpy ic (call, SIGNAL(iconChanged(quint8))); QTest::qWait(8000); QCOMPARE(call->state(),QString("incoming")); call->answer(); QTest::qWait(10000); QVERIFY(state.count()>0); QCOMPARE(call->lineIdentification(),QString("1234567")); //PhoneSim specific value QVERIFY(time.count()>0); QCOMPARE(aspy.count(), 1); QCOMPARE(aspy.takeFirst().at(0).toBool(),true); QVERIFY(ic.count()==0); QVERIFY(em.count()==0); QVERIFY(mp.count()==0); QVERIFY(info.count()==0); QVERIFY(name.count()==0); QVERIFY(li.count()==0); call->hangup(); QTest::qWait(5000); QCOMPARE(hspy.count(), 1); QCOMPARE(hspy.takeFirst().at(0).toBool(), true); QCOMPARE(discreason.count(), 1); QCOMPARE(discreason.takeFirst().at(0).toString(), QString("local")); delete call; }
void QOfonoVoiceCall::propertyChanged(const QString& property, const QDBusVariant& dbusvalue) { QVariant value = dbusvalue.variant(); d_ptr->properties.insert(property,value); if (property == QLatin1String("LineIdentification")) { Q_EMIT lineIdentificationChanged(value.value<QString>()); } else if (property == QLatin1String("DisconnectReason")) { Q_EMIT disconnectReason(value.value<QString>()); } else if (property == QLatin1String("Name")) { Q_EMIT nameChanged(value.value<QString>()); } else if (property == QLatin1String("State")) { Q_EMIT stateChanged(value.value<QString>()); } else if (property == QLatin1String("StartTime")) { Q_EMIT startTimeChanged(value.value<QString>()); } else if (property == QLatin1String("Information")) { Q_EMIT informationChanged(value.value<QString>()); } else if (property == QLatin1String("IncomingLine")) { Q_EMIT incomingLineChanged(value.value<QString>()); } else if (property == QLatin1String("Multiparty")) { Q_EMIT multipartyChanged(value.value<bool>()); } else if (property == QLatin1String("Icon")) { Q_EMIT iconChanged(value.value<quint8>()); } else if (property == QLatin1String("Emergency")) { Q_EMIT emergencyChanged(value.value<bool>()); } else if (property == QLatin1String("RemoteHeld")) { Q_EMIT remoteHeldChanged(value.value<bool>()); } else if (property == QLatin1String("RemoteMultiparty")) { Q_EMIT remoteMultipartyChanged(value.value<bool>()); } }
void testOfonoMultipartyCalls() { // Test for hangupMultiparty(): // 1. Dial a call // 2. Receive a call (dial "199" to trigger phonesim callback) // 3. Combine into multiparty call (2 participants) // 4. Verify createMultiparty() works as expected // 5. Put multiparty call on hold // 6. Dial a 3rd call // 7. Combine into multiparty call (3 participants) // 8. Split one call off to "private chat" // 9. Verify privateChat() works as expected // 10. Hangup multiparty call // 11. Verify hangupMultiparty() works as expected // 12. Hangup all calls QVariantList variantList; // VoiceCallManager Spy's QSignalSpy dialreg(m,SIGNAL(dialComplete(bool))); QSignalSpy dspy(m, SIGNAL(callAdded(QString))); QSignalSpy rspy(m, SIGNAL(callRemoved(QString))); QSignalSpy haspy(m, SIGNAL(hangupAllComplete(bool))); QSignalSpy haaspy(m, SIGNAL(holdAndAnswerComplete(bool))); QSignalSpy cmspy(m, SIGNAL(createMultipartyComplete(bool, QStringList))); QSignalSpy hmspy(m, SIGNAL(hangupMultipartyComplete(bool))); QSignalSpy scspy(m, SIGNAL(swapCallsComplete(bool))); QSignalSpy pcspy(m, SIGNAL(privateChatComplete(bool, QStringList))); // 1. Dial a call (outgoing) m->dial("123",""); QTest::qWait(1000); QCOMPARE(dialreg.count(), 1); QCOMPARE(dialreg.takeFirst().at(0).toBool(),true); QCOMPARE(dspy.count(), 1); QString c1id = dspy.takeFirst().at(0).toString(); QOfonoVoiceCall* c1 = new QOfonoVoiceCall(); c1->setVoiceCallPath(c1id); QSignalSpy c1state(c1, SIGNAL(stateChanged(QString))); QSignalSpy c1discreason(c1,SIGNAL(disconnectReason(QString))); QSignalSpy c1li (c1, SIGNAL(lineIdentificationChanged(QString))); QSignalSpy c1name (c1, SIGNAL(nameChanged(QString))); QSignalSpy c1info (c1, SIGNAL(informationChanged(QString))); QSignalSpy c1mp (c1, SIGNAL(multipartyChanged(bool))); QSignalSpy c1em (c1, SIGNAL(emergencyChanged(bool))); QSignalSpy c1st (c1, SIGNAL(startTimeChanged(QString))); QSignalSpy c1ic (c1, SIGNAL(iconChanged(quint8))); qDebug() << "Please find a call in 'Dialing' state in phonesim window and press 'Active' button"; QTest::qWait(15000); // - new call should have a state change, and be in "active" state QVERIFY(c1state.count()>0); QVERIFY(c1st.count()>0); QVERIFY(c1ic.count()==0); QVERIFY(c1em.count()==0); QVERIFY(c1mp.count()==0); QVERIFY(c1info.count()==0); QVERIFY(c1name.count()==0); QVERIFY(c1li.count()==0); QCOMPARE(c1->state(),QString("active")); QCOMPARE(c1->lineIdentification(),QString("123")); QCOMPARE(c1->emergency(),false); QCOMPARE(c1->multiparty(),false); QCOMPARE(c1->name(),QString("")); QCOMPARE(c1->information(),QString("")); // 2. Receive a call // - dial "199" to trigger phonesim callback m->dial("199",""); QTest::qWait(8000); QCOMPARE(dialreg.count(), 1); QCOMPARE(dialreg.takeFirst().at(0).toBool(),false); QCOMPARE(dspy.count(),1); QString c2id = dspy.takeFirst().at(0).toString(); QOfonoVoiceCall* c2 = new QOfonoVoiceCall(); c2->setVoiceCallPath(c2id); QSignalSpy c2state(c2, SIGNAL(stateChanged(QString))); QSignalSpy c2time(c2,SIGNAL(startTimeChanged(QString))); QSignalSpy c2discreason(c2,SIGNAL(disconnectReason(QString))); QSignalSpy c2li (c2, SIGNAL(lineIdentificationChanged(QString))); QSignalSpy c2name (c2, SIGNAL(nameChanged(QString))); QSignalSpy c2info (c2, SIGNAL(informationChanged(QString))); QSignalSpy c2mp (c2, SIGNAL(multipartyChanged(bool))); QSignalSpy c2em (c2, SIGNAL(emergencyChanged(bool))); QSignalSpy c2ic (c2, SIGNAL(iconChanged(quint8))); QTest::qWait(3000); QCOMPARE(c2->state(),QString("waiting")); // - accept incoming call, placing first call on hold m->holdAndAnswer(); QTest::qWait(1000); QCOMPARE(haaspy.count(),1); QCOMPARE(haaspy.takeFirst().at(0).toBool(),true); QTest::qWait(3000); // - call #1 should be in "held" state QVERIFY(c1state.count()>0); QCOMPARE(c1->state(),QString("held")); // - call #2 should be in "active" state QVERIFY(c2state.count()>0); QCOMPARE(c2->state(),QString("active")); QCOMPARE(c2->lineIdentification(),QString("1234567")); QVERIFY(c2time.count()>0); QVERIFY(c2ic.count()==0); QVERIFY(c2em.count()==0); QVERIFY(c2mp.count()==0); QVERIFY(c2info.count()==0); QVERIFY(c2name.count()==0); QVERIFY(c2li.count()==0); // 3. Combine into multiparty call (2 participants) m->createMultiparty(); QTest::qWait(1000); QCOMPARE(cmspy.count(),1); variantList = cmspy.takeFirst(); QCOMPARE(variantList.at(0).toBool(),true); QVERIFY(variantList.at(1).toStringList().length() > 0); QTest::qWait(3000); // 4. Verify createMultiparty() works as expected // - call #1 should have a stateChanged signal triggered QVERIFY(c1state.count()>0); // - both calls should have a multipartyChanged signal triggered, // be in "active" state and have multiparty property set to "true" QVERIFY(c1mp.count()>0); QVERIFY(c2mp.count()>0); QCOMPARE(c1->state(),QString("active")); QCOMPARE(c2->state(),QString("active")); QCOMPARE(c1->multiparty(),true); QCOMPARE(c2->multiparty(),true); // 5. Put multiparty call on hold m->swapCalls(); QTest::qWait(1000); QCOMPARE(scspy.count(),1); QCOMPARE(scspy.takeFirst().at(0).toBool(),true); QTest::qWait(3000); // - both calls should have a stateChanged signal triggered // and be in "held" state QVERIFY(c1state.count()>0); QVERIFY(c2state.count()>0); QCOMPARE(c1->state(),QString("held")); QCOMPARE(c2->state(),QString("held")); // 6. Dial a 3rd call m->dial("456",""); QTest::qWait(1000); QCOMPARE(dialreg.count(), 1); QCOMPARE(dialreg.takeFirst().at(0).toBool(),true); QCOMPARE(dspy.count(), 1); QString c3id = dspy.takeFirst().at(0).toString(); QOfonoVoiceCall* c3 = new QOfonoVoiceCall(); c3->setVoiceCallPath(c3id); QSignalSpy c3state(c3, SIGNAL(stateChanged(QString))); QSignalSpy c3discreason(c3,SIGNAL(disconnectReason(QString))); QSignalSpy c3li (c3, SIGNAL(lineIdentificationChanged(QString))); QSignalSpy c3name (c3, SIGNAL(nameChanged(QString))); QSignalSpy c3info (c3, SIGNAL(informationChanged(QString))); QSignalSpy c3mp (c3, SIGNAL(multipartyChanged(bool))); QSignalSpy c3em (c3, SIGNAL(emergencyChanged(bool))); QSignalSpy c3st (c3, SIGNAL(startTimeChanged(QString))); QSignalSpy c3ic (c3, SIGNAL(iconChanged(quint8))); qDebug() << "Please find a call in 'Dialing' state in phonesim window and press 'Active' button"; QTest::qWait(15000); // - 3rd call should have a state change, and be in "active" state QVERIFY(c3state.count()>0); QVERIFY(c3st.count()>0); QVERIFY(c3ic.count()==0); QVERIFY(c3em.count()==0); QVERIFY(c3mp.count()==0); QVERIFY(c3info.count()==0); QVERIFY(c3name.count()==0); QVERIFY(c3li.count()==0); QCOMPARE(c3->state(),QString("active")); QCOMPARE(c3->lineIdentification(),QString("456")); QCOMPARE(c3->emergency(),false); QCOMPARE(c3->multiparty(),false); QCOMPARE(c3->name(),QString("")); QCOMPARE(c3->information(),QString("")); // 7. Combine into multiparty call (3 participants) m->createMultiparty(); QTest::qWait(1000); QCOMPARE(cmspy.count(),1); variantList = cmspy.takeFirst(); QCOMPARE(variantList.at(0).toBool(),true); QVERIFY(variantList.at(1).toStringList().length() > 0); QTest::qWait(3000); // - calls #1 and #2 should have a stateChanged signal triggered QVERIFY(c1state.count()>0); QVERIFY(c2state.count()>0); // - all calls should have a multipartyChanged signal triggered, // be in "active" state and have multiparty property set to "true" QVERIFY(c1mp.count()>0); QVERIFY(c2mp.count()>0); QVERIFY(c3mp.count()>0); QCOMPARE(c1->state(),QString("active")); QCOMPARE(c2->state(),QString("active")); QCOMPARE(c3->state(),QString("active")); QCOMPARE(c1->multiparty(),true); QCOMPARE(c2->multiparty(),true); QCOMPARE(c3->multiparty(),true); // 8. Split call #1 off to "private chat" m->privateChat(c1id); QTest::qWait(1000); QCOMPARE(pcspy.count(),1); variantList = pcspy.takeFirst(); QCOMPARE(variantList.at(0).toBool(),true); QVERIFY(variantList.at(1).toStringList().length() > 0); QTest::qWait(3000); // 9. Verify privateChat() works as expected // - call #1 should have a multipartyChanged signal triggered, // it's multiparty property set to false and be in "active" state QVERIFY(c1mp.count()>0); QCOMPARE(c1->multiparty(),false); QCOMPARE(c1->state(),QString("active")); // - calls #2 and #3 should have a stateChanged signal triggered // and be back in "held" state QVERIFY(c2state.count()>0); QVERIFY(c3state.count()>0); QCOMPARE(c2->state(),QString("held")); QCOMPARE(c3->state(),QString("held")); // 10. Hangup multiparty call m->hangupMultiparty(); QTest::qWait(1000); QCOMPARE(hmspy.count(), 1); QCOMPARE(hmspy.takeFirst().at(0).toBool(),true); QTest::qWait(3000); // 11. Verify hangupMultiparty() works as expected // - two calls should have been removed QVERIFY(rspy.count()==2); QString r2id = rspy.takeFirst().at(0).toString(); QString r3id = rspy.takeFirst().at(0).toString(); QCOMPARE(r2id,c2id); QCOMPARE(r3id,c3id); // - call #1 should still be in "active" state QCOMPARE(c1->state(),QString("active")); // - calls #2 and #3 should have a stateChanged signal triggered // and have a disconnect reason of "local" QVERIFY(c2state.count()>0); QVERIFY(c3state.count()>0); QCOMPARE(c2discreason.count(), 1); QCOMPARE(c3discreason.count(), 1); QCOMPARE(c2discreason.takeFirst().at(0).toString(), QString("local")); QCOMPARE(c3discreason.takeFirst().at(0).toString(), QString("local")); // 12. Hangup all calls m->hangupAll(); QTest::qWait(1000); QCOMPARE(haspy.count(), 1); QCOMPARE(haspy.takeFirst().at(0).toBool(),true); QTest::qWait(3000); QCOMPARE(c1discreason.count(), 1); QCOMPARE(c1discreason.takeFirst().at(0).toString(), QString("local")); delete c1; delete c2; delete c3; }
void StatisticsObject::readFrameAndTypePositionsFromFile() { try { QFile inputFile(p_srcFilePath); if(inputFile.open(QIODevice::ReadOnly) == false) return; int lastPOC = INT_INVALID; int lastType = INT_INVALID; int numFrames = 0; qint64 nextSignalAtByte = 0; while (!inputFile.atEnd() && !p_cancelBackgroundParser) { qint64 lineStartPos = inputFile.pos(); // read one line QByteArray aLineByteArray = inputFile.readLine(); QString aLine(aLineByteArray); // get components of this line QStringList rowItemList = parseCSVLine(aLine, ';'); // ignore empty stuff if (rowItemList[0].isEmpty()) continue; // ignore headers if (rowItemList[0][0] == '%') continue; // check for POC/type information int poc = rowItemList[0].toInt(); int typeID = rowItemList[5].toInt(); if (lastType == -1 && lastPOC == -1) { // First POC/type line p_pocTypeStartList[poc][typeID] = lineStartPos; lastType = typeID; lastPOC = poc; numFrames++; p_numberFrames=numFrames; } else if (typeID != lastType && poc == lastPOC) { // we found a new type but the POC stayed the same. // This seems to be an interleaved file // Check if we already collected a start position for this type bFileSortedByPOC = true; lastType = typeID; if (p_pocTypeStartList[poc].contains(typeID)) // POC/type start position already collected continue; p_pocTypeStartList[poc][typeID] = lineStartPos; } else if (poc != lastPOC) { // We found a new POC lastPOC = poc; lastType = typeID; if (bFileSortedByPOC) { // There must not be a start position for any type with this POC already. if (p_pocTypeStartList.contains(poc)) throw "The data for each POC must be continuous in an interleaved statistics file."; } else { // There must not be a start position for this POC/type already. if (p_pocTypeStartList.contains(poc) && p_pocTypeStartList[poc].contains(typeID)) throw "The data for each typeID must be continuous in an non interleaved statistics file."; } p_pocTypeStartList[poc][typeID] = lineStartPos; // update number of frames if( poc+1 > numFrames ) { numFrames = poc+1; p_numberFrames = numFrames; p_endFrame = p_numberFrames - 1; } // Update after parsing 5Mb of the file if( lineStartPos > nextSignalAtByte ) { // Set progress text int percent = (int)((double)lineStartPos * 100 / (double)p_numBytes); p_status = QString("Parsing (") + QString::number(percent) + QString("%) ..."); emit informationChanged(); nextSignalAtByte = lineStartPos + 5000000; } } // typeID and POC stayed the same // do nothing } p_status = "OK"; emit informationChanged(); inputFile.close(); } // try catch ( const char * str ) { std::cerr << "Error while parsing meta data: " << str << '\n'; setErrorState(QString("Error while parsing meta data: ") + QString(str)); return; } catch (...) { std::cerr << "Error while parsing meta data."; setErrorState(QString("Error while parsing meta data.")); return; } return; }