Exemplo n.º 1
0
void UmlTransition::write_it(FileOut & out)
{
    out.indent();
    out << "<transition xmi:type=\"uml:Transition\"";
    out.id(this);

    if (!name().isEmpty() && (name() != "<transition>")) {
        out << " name=\"";
        out.quote(name());
        out << '"';
    }

    out.ref(parent(), "source");
    out.ref(target(), "target");

    if (parent() == target())
        out << " kind=\"" << ((isExternal()) ? "external" : "internal") << '"';

    out << ">\n";
    out.indent(+1);
    write_description_properties(out);

    WrapperStr trig;
    WrapperStr grd;
    WrapperStr effect;

    switch (_lang) {
    case Uml:
        trig = trigger();
        grd = guard();
        effect = activity();
        break;

    case Cpp:
        trig = cppTrigger();
        grd = cppGuard();
        effect = cppActivity();
        break;

    default: // Java
        trig = javaTrigger();
        grd = javaGuard();
        effect = javaActivity();
        break;
    }

    if (! trig.isEmpty()) {
        out.indent();
        out << "<trigger xmi:type=\"uml:Trigger\"";
        out.id_prefix(this, "TRIGGER_");
        out << " name=\"";
        out.quote(trig);
        out << "\"/>\n";
    }

    if (! grd.isEmpty()) {
        out.indent();
        out << "<guard xmi:type=\"uml:Constraint\"";
        out.id_prefix(this, "GUARD_");
        out << ">\n";
        out.indent();
        out << "\t<specification xmi:type=\"uml:OpaqueExpression\"";
        out.id_prefix(this, "GUARD_EXPR_");
        out << ">\n";
        out.indent();
        out << "\t\t<body>";
        out.quote(grd);
        out << "</body>\n";
        out.indent();
        out << "\t</specification>\n";
        out.indent();
        out << "</guard>\n";
    }

    if (! effect.isEmpty()) {
        out.indent();
        out << "<effect xmi:type=\"uml:Activity\"";
        out.id_prefix(this, "EFFECT_");
        out << ">\n";
        out.indent();
        out << "\t<body>";
        out.quote(effect);
        out << "</body>\n";
        out.indent();
        out << "</effect>\n";
    }

    out.indent(-1);
    out.indent();
    out << "</transition>\n";

    unload();
}
QAndroidPlatformIntegration::QAndroidPlatformIntegration(const QStringList &paramList)
    : m_touchDevice(0)
#ifndef QT_NO_ACCESSIBILITY
    , m_accessibility(0)
#endif
{
    Q_UNUSED(paramList);

    m_androidPlatformNativeInterface = new QAndroidPlatformNativeInterface();

    m_eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
    if (m_eglDisplay == EGL_NO_DISPLAY)
        qFatal("Could not open egl display");

    EGLint major, minor;
    if (!eglInitialize(m_eglDisplay, &major, &minor))
        qFatal("Could not initialize egl display");

    if (!eglBindAPI(EGL_OPENGL_ES_API))
        qFatal("Could not bind GL_ES API");

    m_primaryScreen = new QAndroidPlatformScreen();
    screenAdded(m_primaryScreen);
    m_primaryScreen->setPhysicalSize(QSize(m_defaultPhysicalSizeWidth, m_defaultPhysicalSizeHeight));
    m_primaryScreen->setSize(QSize(m_defaultScreenWidth, m_defaultScreenHeight));
    m_primaryScreen->setAvailableGeometry(QRect(0, 0, m_defaultGeometryWidth, m_defaultGeometryHeight));

    m_mainThread = QThread::currentThread();
    QtAndroid::setAndroidPlatformIntegration(this);

    m_androidFDB = new QAndroidPlatformFontDatabase();
    m_androidPlatformServices = new QAndroidPlatformServices();

#ifndef QT_NO_CLIPBOARD
    m_androidPlatformClipboard = new QAndroidPlatformClipboard();
#endif

    m_androidSystemLocale = new QAndroidSystemLocale;

    QJNIObjectPrivate javaActivity(QtAndroid::activity());
    if (javaActivity.isValid()) {
        QJNIObjectPrivate resources = javaActivity.callObjectMethod("getResources", "()Landroid/content/res/Resources;");
        QJNIObjectPrivate configuration = resources.callObjectMethod("getConfiguration", "()Landroid/content/res/Configuration;");

        int touchScreen = configuration.getField<jint>("touchscreen");
        if (touchScreen == QJNIObjectPrivate::getStaticField<jint>("android/content/res/Configuration", "TOUCHSCREEN_FINGER")
                || touchScreen == QJNIObjectPrivate::getStaticField<jint>("android/content/res/Configuration", "TOUCHSCREEN_STYLUS"))
        {
            m_touchDevice = new QTouchDevice;
            m_touchDevice->setType(QTouchDevice::TouchScreen);
            m_touchDevice->setCapabilities(QTouchDevice::Position
                                         | QTouchDevice::Area
                                         | QTouchDevice::Pressure
                                         | QTouchDevice::NormalizedPosition);

            QJNIObjectPrivate pm = javaActivity.callObjectMethod("getPackageManager", "()Landroid/content/pm/PackageManager;");
            Q_ASSERT(pm.isValid());
            if (pm.callMethod<jboolean>("hasSystemFeature","(Ljava/lang/String;)Z",
                                     QJNIObjectPrivate::getStaticObjectField("android/content/pm/PackageManager", "FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND", "Ljava/lang/String;").object())) {
                m_touchDevice->setMaximumTouchPoints(10);
            } else if (pm.callMethod<jboolean>("hasSystemFeature","(Ljava/lang/String;)Z",
                                            QJNIObjectPrivate::getStaticObjectField("android/content/pm/PackageManager", "FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT", "Ljava/lang/String;").object())) {
                m_touchDevice->setMaximumTouchPoints(4);
            } else if (pm.callMethod<jboolean>("hasSystemFeature","(Ljava/lang/String;)Z",
                                            QJNIObjectPrivate::getStaticObjectField("android/content/pm/PackageManager", "FEATURE_TOUCHSCREEN_MULTITOUCH", "Ljava/lang/String;").object())) {
                m_touchDevice->setMaximumTouchPoints(2);
            }
            QWindowSystemInterface::registerTouchDevice(m_touchDevice);
        }
    }
}