예제 #1
0
int main(int argc, char **argv)
{
#if defined(Q_WS_X11)
#if QT_VERSION >= 0x040800
    QApplication::setAttribute(Qt::AA_X11InitThreads, true);
#else
    XInitThreads();
    QApplication::setAttribute(static_cast<Qt::ApplicationAttribute>(10), true);
#endif
#endif
    {
        QApplication app(argc, argv);
        {
            bool isOpenGL = false;
            for (int index = 1; index < argc; ++index) {
                if (strcmp(argv[index], "-opengl") == 0) {
                    isOpenGL = true;
                    break;
                }
            }

            QTestRunner runn(isOpenGL, argc, argv);
            QTimer::singleShot(0, &runn, SLOT(DropInStartup()));
            // These components must be loaded before app start
            QString componentPath(DEFAULT_COMPONENTS_PATH);
            QMozContext::GetInstance()->addComponentManifest(componentPath + QString("/components") + QString("/EmbedLiteBinComponents.manifest"));
            QMozContext::GetInstance()->addComponentManifest(componentPath + QString("/chrome") + QString("/EmbedLiteJSScripts.manifest"));
            QMozContext::GetInstance()->addComponentManifest(componentPath + QString("/chrome") + QString("/EmbedLiteOverrides.manifest"));
            QMozContext::GetInstance()->addComponentManifest(componentPath + QString("/components") + QString("/EmbedLiteJSComponents.manifest"));
            QMozContext::GetInstance()->runEmbedding();
        }
        app.quit();
    }
    return 0;
}
예제 #2
0
파일: main.cpp 프로젝트: rojkov/qtmozembed
int main(int argc, char **argv)
{
    {
        QGuiApplication app(argc, argv);
        {
            bool isOpenGL = false;
            for (int index = 1; index < argc; ++index) {
                if (strcmp(argv[index], "-opengl") == 0) {
                    isOpenGL = true;
                    break;
                }
            }

            QTestRunner runn(isOpenGL, argc, argv);
            QTimer::singleShot(0, &runn, SLOT(DropInStartup()));
            // These components must be loaded before app start
            QString componentPath(DEFAULT_COMPONENTS_PATH);
            QMozContext::GetInstance()->setCompositorInSeparateThread(true);
            QMozContext::GetInstance()->addComponentManifest(componentPath + QString("/components") + QString("/EmbedLiteBinComponents.manifest"));
            QMozContext::GetInstance()->addComponentManifest(componentPath + QString("/chrome") + QString("/EmbedLiteJSScripts.manifest"));
            QMozContext::GetInstance()->addComponentManifest(componentPath + QString("/chrome") + QString("/EmbedLiteOverrides.manifest"));
            QMozContext::GetInstance()->addComponentManifest(componentPath + QString("/components") + QString("/EmbedLiteJSComponents.manifest"));
            QMozContext::GetInstance()->runEmbedding();
        }
        app.quit();
    }
    return 0;
}