コード例 #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
QDebug operator<<(QDebug debug, const PacketType& type) {
    QMetaObject metaObject = PacketTypeEnum::staticMetaObject;
    QMetaEnum metaEnum = metaObject.enumerator(metaObject.enumeratorOffset());
    QString typeName = metaEnum.valueToKey((int) type);

    debug.nospace().noquote() << (uint8_t) type << " (" << typeName << ")";
    return debug.space();
}
コード例 #6
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();
}
コード例 #7
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";
}
コード例 #8
0
    void JSObjectProxy::addBindingsEnum( KJS::ExecState *exec, KJS::Object &object ) {
        QMetaObject * mo = obj->metaObject();
        QStrList enumList = mo->enumeratorNames( true );

        for ( QStrListIterator iter( enumList ); iter.current(); ++iter ) {

            const QMetaEnum *me = mo->enumerator( iter.current(), true );
            for ( uint i = 0 ; i < me->count ; i++ ) {
                QCString key( ( me->items ) [ i ].key );
                int val = ( me->items ) [ i ].value;
                object.put( exec, key.data(), KJS::Number( val ), KJS::ReadOnly );
            }
        }
    }
コード例 #9
0
QString RemoteArchiveModel::networkErrorToString(QNetworkReply::NetworkError error)
{
    QString errorValue;
    QMetaObject meta = QNetworkReply::staticMetaObject;
    for (int i = 0; i < meta.enumeratorCount(); ++i) {
        QMetaEnum m = meta.enumerator(i);
        if (m.name() == QLatin1String("NetworkError"))
        {
            errorValue = QLatin1String(m.valueToKey(error));
            break;
        }
    }
    
    return errorValue;
}
コード例 #10
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;
}
コード例 #11
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());
	}
}
コード例 #12
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
}
コード例 #13
0
 //! Displays a QMessageBox with the connection error
 void NameFinderWidget::displayError(QNetworkReply::NetworkError error)
 {
     QMessageBox errorBox;
     errorBox.setIcon(QMessageBox::Critical);
     errorBox.setWindowTitle(tr("Error!"));
     if (error == QNetworkReply::AuthenticationRequiredError) {
         errorBox.setText(tr("Name finder service requires authentication."));
     } else {
         QMetaObject meta = QNetworkReply::staticMetaObject;
         for (int i=0; i < meta.enumeratorCount(); ++i) {
             QMetaEnum m = meta.enumerator(i);
             if (m.name() == QLatin1String("NetworkError")) {
                 errorBox.setText(QLatin1String(m.valueToKey(error)));
                 break;
             }
         }
     }
     errorBox.exec();
     emit done();
 }
コード例 #14
0
/*!\internal
 */
void QMetaObject::resolveProperty( QMetaProperty* prop )
{
    QMetaObject* super = superclass;
    while ( super ) {
	const QMetaProperty* p = super->property( prop->n );
	if( p ) {
	    if ( qstrcmp( prop->type(), p->type() ) != 0 ) {
#if defined(CHECK_STATE)
		qWarning( "QMetaObject::resolveProperty: Attempt to override property type: %s %s::%s clashes with %s %s::%s", p->type(), super->className(), p->name(), prop->type(), className(), prop->name() );
#endif
	    }
	    if ( prop->get == 0 ) {
		if ( p->get != 0 ) {
		    prop->get = p->get;
		    prop->gspec = p->gspec;
		}
	    }
	    if ( prop->set == 0 ) {
		if ( p->set != 0 ) {
		    prop->set = p->set;
		    prop->sspec = p->sspec;
		}
	    }

	    if ( prop->testFlags( QMetaProperty::UnresolvedStored ) )
	    {
		if ( !p->testFlags( QMetaProperty::UnresolvedStored ) )
		{
		    prop->clearFlags( QMetaProperty::UnresolvedStored );
		    if ( p->testFlags( QMetaProperty::NotStored ) )
			prop->setFlags( QMetaProperty::NotStored );
		    prop->store = p->store;
		}
	    }
	    if ( prop->testFlags( QMetaProperty::UnresolvedDesignable ) )
	    {
		if ( !p->testFlags( QMetaProperty::UnresolvedDesignable ) )
		{
		    prop->clearFlags( QMetaProperty::UnresolvedDesignable );
		    if ( p->testFlags( QMetaProperty::NotDesignable ) )
			prop->setFlags( QMetaProperty::NotDesignable );
		}
	    }
	}
	if ( prop->testFlags( QMetaProperty::UnresolvedEnum | QMetaProperty::UnresolvedSet | QMetaProperty::UnresolvedEnumOrSet ) ) {
	    QMetaEnum* e = super->enumerator( prop->t);
	    if ( e && e->set ) {
		if ( !prop->testFlags( QMetaProperty::UnresolvedSet | QMetaProperty::UnresolvedEnumOrSet ) ) {
#if defined(CHECK_STATE)
		    qWarning("QMetaObject::resolveProperty: The property %s %s::%s assumed that '%s' was listed in Q_ENUMS, but it was listed in Q_SETS", prop->type(), className(), prop->name(), prop->type() );
#endif
		}
		prop->enumData = e;
		prop->clearFlags( QMetaProperty::UnresolvedEnum );
	    }
	    else if ( e && !e->set ) {
		if ( !prop->testFlags( QMetaProperty::UnresolvedEnum | QMetaProperty::UnresolvedEnumOrSet ) ) {
#if defined(CHECK_STATE)
		    qWarning("QMetaObject::resolveProperty: The property %s %s::%s assumed that '%s' was listed in Q_SETS, but it was listed in Q_ENUMS", prop->type(), className(), prop->name(), prop->type() );
#endif
		}
		prop->enumData = e;
		prop->clearFlags( QMetaProperty::UnresolvedEnum );
	    }
	}
	super = super->superclass;
    }

    if ( !prop->isValid() ) {
#if defined(CHECK_STATE)
	qWarning("QMetaObject::resolveProperty: Could not resolve property %s::%s. Property not available.", className(), prop->name() );
#endif
    }
}
コード例 #15
0
QString AsemanQtTools::exportItem(const QString &module, int major, int minor, const QString &component, bool store)
{
    QString result;
    aseman_qt_tools_indexCache << component;

    QMetaObject meta = T::staticMetaObject;
    QString inherits = fixType(meta.superClass()? meta.superClass()->className() : "");
    bool isModel = component.toLower().contains("model");

    result += QString("# %1\n\n").arg(component);

    QString headers;
    headers += QString(" * [Component details](#component-details)\n");

    QString details = QString("\n### Component details:\n\n");
    details += QString("|Detail|Value|\n"
                       "|------|-----|\n");
    details += QString("|%1|%2 %3.%4|\n").arg("Import").arg(module).arg(major).arg(minor);
    details += QString("|%1|<font color='#074885'>%2</font>|\n").arg("Component").arg(component);
    details += QString("|%1|<font color='#074885'>%2</font>|\n").arg("C++ class").arg(meta.className());
    details += QString("|%1|<font color='#074885'>%2</font>|\n").arg("Inherits").arg(inherits);
    details += QString("|%1|<font color='#074885'>%2</font>|\n").arg("Model").arg(isModel?"Yes":"No");

    QString resultProperties;
    QStringList propertiesSignals;
    for(int i=0; i<meta.propertyCount(); i++)
    {
        QMetaProperty property = meta.property(i);
        const QString &propertyName = property.name();
        const QString &propertyType = fixType(property.typeName());
        propertiesSignals << property.notifySignal().name();

        QString text = QString("* <font color='#074885'><b>%1</b></font>: %2").arg(propertyName).arg(propertyType);
        if(!property.isWritable())
            text += " (readOnly)";

        text += "\n";
        if(meta.propertyOffset()<=i)
            resultProperties += text;
    }

    QString enumResults;
    for(int i=meta.enumeratorOffset(); i<meta.enumeratorCount(); i++)
    {
        QMetaEnum enumerator = meta.enumerator(i);
        const QString &enumName = enumerator.name();

        enumResults += QString("\n##### %1\n\n").arg(enumName);
        enumResults += QString("|Key|Value|\n"
                               "|---|-----|\n");

        for(int j=0; j<enumerator.keyCount(); j++)
            enumResults += QString("|%1|%2|\n").arg(enumerator.key(j)).arg(enumerator.value(j));
    }

    QString resultSlots;
    QString resultSignals;
    for(int i=meta.methodOffset(); i<meta.methodCount(); i++)
    {
        QMetaMethod method = meta.method(i);
        if(method.access() != QMetaMethod::Public)
            continue;

        const QString &methodName = method.name();
        if(propertiesSignals.contains(methodName))
            continue;

        const QString &methodType = fixType(method.typeName());

        QString args;
        const QList<QByteArray> &paramNames = method.parameterNames();
        const QList<QByteArray> &paramTypes = method.parameterTypes();
        for(int j=0; j<paramNames.count(); j++)
        {
            if(j != 0)
                args += ", ";

            args += fixType(paramTypes[j]) + " " + paramNames[j];
        }

        QString text = QString(" * %1 <font color='#074885'><b>%2</b></font>(%3)\n").arg(methodType).arg(methodName).arg(args);
        switch(static_cast<int>(method.methodType()))
        {
        case QMetaMethod::Slot:
            resultSlots += text;
            break;
        case QMetaMethod::Signal:
            resultSignals += text;
            break;
        }
    }

    if(!resultProperties.isEmpty())
    {
        headers += QString(" * [Normal Properties](#normal-properties)\n");
        resultProperties = QString("\n### Normal Properties\n\n") + resultProperties;
    }
    if(!enumResults.isEmpty())
    {
        headers += QString(" * [Enumerator](#enumerator)\n");
        enumResults = QString("\n### Enumerator\n\n") + enumResults;
    }
    if(!resultSlots.isEmpty())
    {
        headers += QString(" * [Methods](#methods)\n");
        resultSlots = QString("\n### Methods\n\n") + resultSlots;
    }
    if(!resultSignals.isEmpty())
    {
        headers += QString(" * [Signals](#signals)\n");
        resultSignals = QString("\n### Signals\n\n") + resultSignals;
    }
    if(isModel)
        headers += QString(" * [Roles](#roles)\n");

    result += headers + "\n";
    result += details + "\n";
    result += resultProperties + "\n";
    result += resultSlots + "\n";
    result += resultSignals + "\n";
    result += enumResults + "\n";

    if(!store)
        return result;

    QString path = aseman_qt_tools_destination + "/" + component.toLower() + ".md";
    QFile file(path);
    if(!file.open(QFile::WriteOnly))
        return result;

    file.write(result.toUtf8());
    file.close();
    return result;
}