コード例 #1
0
void ApplicationUI::onCallUpdated(const Call &call) {
	QMetaObject MetaCallTypeObject = CallType::staticMetaObject;
	QMetaEnum CallTypeEnum = MetaCallTypeObject.enumerator(
			MetaCallTypeObject.indexOfEnumerator("Type"));

	QMetaObject MetaCallStateObject = CallState::staticMetaObject;
	QMetaEnum CallStateEnum = MetaCallStateObject.enumerator(
			MetaCallStateObject.indexOfEnumerator("Type"));

	CallType::Type CurrentCallType = call.callType();
	CallState::Type CurrentCallState = call.callState();

	//qDebug() << "Call ID : " << call.callId();
	//qDebug() << "Call Type : " << CallTypeEnum.valueToKey(CurrentCallType);
	//qDebug() << "Call State : " << CallStateEnum.valueToKey(CurrentCallState);

	if (m_CallInfoTxtArea) { //Check the reference is not NULL
		//Update the GUI
		QString CallStatusStr = m_CallInfoTxtArea->text();
		CallStatusStr = CallStatusStr + "Call [ID:" + QString::number(call.callId());
		if(m_PhoneNumberTxtField){
			CallStatusStr = CallStatusStr + ",Number:" 	+ m_PhoneNumberTxtField->text();
		}
		CallStatusStr = CallStatusStr + ",Type:" 	+ CallTypeEnum.valueToKey(CurrentCallType);
		CallStatusStr = CallStatusStr + ",State:"	+ CallStateEnum.valueToKey(CurrentCallState) + "]\n";

		qDebug() << "Call Details : " << CallStatusStr;

		m_CallInfoTxtArea->setText(CallStatusStr);
	}
}
コード例 #2
0
ファイル: networkdevice.cpp プロジェクト: lampi87/guh
QString NetworkDevice::deviceStateReasonToString(const NetworkDevice::NetworkDeviceStateReason &deviceStateReason)
{
    QMetaObject metaObject = NetworkDevice::staticMetaObject;
    int enumIndex = metaObject.indexOfEnumerator(QString("NetworkDeviceStateReason").toLatin1().data());
    QMetaEnum metaEnum = metaObject.enumerator(enumIndex);
    return QString(metaEnum.valueToKey(deviceStateReason));
}
コード例 #3
0
ファイル: networkdevice.cpp プロジェクト: lampi87/guh
QString NetworkDevice::deviceTypeToString(const NetworkDevice::NetworkDeviceType &deviceType)
{
    QMetaObject metaObject = NetworkDevice::staticMetaObject;
    int enumIndex = metaObject.indexOfEnumerator(QString("NetworkDeviceType").toLatin1().data());
    QMetaEnum metaEnum = metaObject.enumerator(enumIndex);
    return QString(metaEnum.valueToKey(deviceType)).remove("NetworkDeviceType");
}
コード例 #4
0
ファイル: rpgengine.cpp プロジェクト: SaLanc/Orange-Engine
QString RPGEngine::eventName(QEvent * event)
{
  QMetaObject dataObject = event->staticMetaObject;
  int index = dataObject.indexOfEnumerator("Type");
  QMetaEnum enumData = dataObject.enumerator(index);
  return QString(enumData.valueToKey(event->type()));
}
コード例 #5
0
ファイル: JerboaPlugin.cpp プロジェクト: fredemmott/jerboa
QDebug operator<<(QDebug debug, Jerboa::Plugin::ComponentType type)
{
	const QMetaObject metaObject = Jerboa::Plugin::staticMetaObject;
	const int index = metaObject.indexOfEnumerator("ComponentType");
	const QMetaEnum enumerator = metaObject.enumerator(index);
	debug.nospace() << enumerator.valueToKey(type) << " (" << static_cast<int>(type) << ")";
	return debug.space();
}
コード例 #6
0
ファイル: rpgengine.cpp プロジェクト: SaLanc/Orange-Engine
void RPGEngine::dumpEvent(QEvent * event)
{
  QMetaObject dataObject = event->staticMetaObject;
  int index = dataObject.indexOfEnumerator("Type");
  QMetaEnum enumData = dataObject.enumerator(index);
  if(event->type() != 43)
    qDebug() << "Event: " << enumData.valueToKey(event->type()) << "\n";
}
コード例 #7
0
QList<QString> enumToKeys(const QMetaObject o, const QString& name, const QString& strip)
{
    QList<QString> list;

    int enumIndex = o.indexOfEnumerator(name.toLatin1().data());
    QMetaEnum enumerator = o.enumerator(enumIndex);

    if (enumerator.isValid()) {
        for (int i = 0; i < enumerator.keyCount(); i++) {
            QString key(enumerator.valueToKey(i));
            list.append(key.remove(strip));
        }
    }

    return list;
}
コード例 #8
0
ファイル: signaldata.cpp プロジェクト: janisozaur/inz_charter
SignalData::SignalData()
{
	qDebug() << "SignalData ctor" << this;
	connect(&mSampler, SIGNAL(dataArrived()), SLOT(fetchSamples()));
	connect(&mSampler, SIGNAL(started()), this, SIGNAL(started()));
	connect(&mSampler, SIGNAL(finished()), this, SIGNAL(finished()));
	connect(&mSampler, SIGNAL(terminated()), this, SIGNAL(finished()));
	connect(&mSampler, SIGNAL(error(QString)), this, SIGNAL(error(QString)));

	const QMetaObject metaObject = Sample::staticMetaObject;
	const QMetaEnum metaEnum = metaObject.enumerator(metaObject.indexOfEnumerator("Marker"));
	for (int i = 0; i < metaEnum.keyCount(); i++) {
		mSamples.insert((Sample::Marker)metaEnum.value(i), QVector<Sample>());
		mBoundingRects.insert((Sample::Marker)metaEnum.value(i), QRectF());
	}
}
コード例 #9
0
ファイル: tst_qeasingcurve.cpp プロジェクト: mpvader/qt
void tst_QEasingCurve::valueForProgress()
{
#if 0
    // used to generate data tables...
    QFile out;
    out.open(stdout, QIODevice::WriteOnly);
    for (int c = QEasingCurve::Linear; c < QEasingCurve::NCurveTypes - 1; ++c) {
        QEasingCurve curve((QEasingCurve::Type)c);
        QMetaObject mo = QEasingCurve::staticMetaObject;
        QString strCurve = QLatin1String(mo.enumerator(mo.indexOfEnumerator("Type")).key(c));
        QString strInputs;
        QString strOutputs;

        for (int t = 0; t <= 100; t+= 10) {
            qreal ease = curve.valueForProgress(t/qreal(100));
            strInputs += QString::fromAscii(" << %1").arg(t);
            strOutputs += " << " + fixedToString(qRound(ease*10000));
        }
        QString str = QString::fromAscii("    QTest::newRow(\"%1\") << int(QEasingCurve::%2)\n"
                                                "         << (IntList() %3)\n"
                                                "         << (RealList()%4);\n\n")
                                      .arg(strCurve)
                                      .arg(strCurve)
                                      .arg(strInputs)
                                      .arg(strOutputs);
        out.write(str.toLatin1().constData());
    }
    out.close();
    exit(1);
#else
    QFETCH(int, type);
    QFETCH(IntList, at);
    QFETCH(RealList, expected);

    QEasingCurve curve((QEasingCurve::Type)type);
    // in theory the baseline should't have an error of more than 0.00005 due to how its rounded,
    // but due to FP imprecision, we have to adjust the error a bit more.
    const qreal errorBound = 0.00006;
    for (int i = 0; i < at.count(); ++i) {
        const qreal ex = expected.at(i);
        const qreal error = qAbs(ex - curve.valueForProgress(at.at(i)/qreal(100)));
        QVERIFY(error <= errorBound);
    }
#endif
}