Exemplo n.º 1
0
void TextEdit::setupViewActions()
{
    QMenu* menu = new QMenu(tr("&View"), this);
    menuBar()->addMenu(menu);
    actionStatusBar = new QAction(tr("&StatusBar"), this);
    actionStatusBar->setStatusTip(tr("Show or hide the status bar"));
    actionStatusBar->setCheckable(true);
    actionStatusBar->setChecked(true);
    menu->addAction(actionStatusBar);
    connect(actionStatusBar, SIGNAL(triggered()), this, SLOT(hideStatusBar()));

    QMenu* menuToolBars = menu->addMenu(tr("&Toolbars"));
    actionStandardBar = new QAction(tr("Standard"), this);
    connect(actionStandardBar, SIGNAL(triggered()), this, SLOT(standardBar()));
    actionStandardBar->setCheckable(true);
    actionStandardBar->setChecked(true);
    actionStandardBar->setStatusTip(tr("Shows or hides the toolbar"));
    menuToolBars->addAction(actionStandardBar);

    actionFormattingBar = new QAction(tr("Formatting"), this);
    connect(actionFormattingBar, SIGNAL(triggered()), this, SLOT(formattingBar()));
    actionFormattingBar->setStatusTip(tr("Shows or hides the toolbar"));
    actionFormattingBar->setCheckable(true);
    actionFormattingBar->setChecked(true);
    menuToolBars->addAction(actionFormattingBar);

    menu->addSeparator();

    QActionGroup* styleActions = new QActionGroup(this);

    QAction* actionBlue = menu->addAction(tr("Office 2007 Blue"));
    actionBlue->setCheckable(true);
    actionBlue->setChecked(true);
    actionBlue->setObjectName("OS_OFFICE2007BLUE");

    QAction *actionBlack = menu->addAction(tr("Office 2007 Black"));
    actionBlack->setObjectName("OS_OFFICE2007BLACK");
    actionBlack->setCheckable(true);

    QAction* actionSilver = menu->addAction(tr("Office 2007 Silver"));
    actionSilver->setObjectName("OS_OFFICE2007SILVER");
    actionSilver->setCheckable(true);

    QAction* actionAqua = menu->addAction(tr("Office 2007 Aqua"));
    actionAqua->setObjectName("OS_OFFICE2007AQUA");
    actionAqua->setCheckable(true);

    styleActions->addAction(actionBlue);
    styleActions->addAction(actionBlack);
    styleActions->addAction(actionSilver);
    styleActions->addAction(actionAqua);
    connect( styleActions, SIGNAL(triggered(QAction*)), this, SLOT(options(QAction*)) );

    menu->addSeparator();

    QAction* actionCusomize = menu->addAction( tr("Cusomize..."));
    actionCusomize->setEnabled(false);
}
Exemplo n.º 2
0
// ----------------------------------------------------------------------------
// renderFrame Method - Takes care of drawing in the different render states
// ----------------------------------------------------------------------------
JNIEXPORT void JNICALL
Java_com_qualcomm_QCARSamples_CloudRecognition_CloudRecoRenderer_renderFrame(JNIEnv *, jobject)
{
    // Clear color and depth buffer
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    // Get the state from QCAR and mark the beginning of a rendering section
    QCAR::State state = QCAR::Renderer::getInstance().begin();

    // Explicitly render the Video Background
    QCAR::Renderer::getInstance().drawVideoBackground();

    glEnable(GL_DEPTH_TEST);
    glEnable(GL_CULL_FACE);

    if (deleteCurrentProductTexture)
    {
        // Deletes the product texture if necessary
        if (productTexture != 0)
        {
            glDeleteTextures(1, &(productTexture->mTextureID));
            delete productTexture;
            productTexture = 0;
        }

        deleteCurrentProductTexture = false;
    }

    // If the render state indicates that the texture is generated it generates
    // the OpenGL texture for start drawing the plane with the book data
    if (renderState == RS_TEXTURE_GENERATED)
    {
        generateProductTextureInOpenGL();
    }

    // Did we find any trackables this frame?
    if (state.getNumTrackableResults() > 0)
    {
        trackingStarted = true;

        // If we are already tracking something we don't need
        // to wait any frame before starting the 2D transition
        // when the target gets lost
        pthread_mutex_lock(&framesToSkipMutex);
        framesToSkipBeforeRenderingTransition = 0;
        pthread_mutex_unlock(&framesToSkipMutex);

        // Gets current trackable result
        const QCAR::TrackableResult* trackableResult = state.getTrackableResult(0);

        if (trackableResult == NULL)
        {
            return;
        }

        modelViewMatrix = QCAR::Tool::convertPose2GLMatrix(trackableResult->getPose());

        // Get the size of the ImageTarget
        QCAR::ImageTargetResult *imageResult = (QCAR::ImageTargetResult *)trackableResult;
        targetSize = imageResult->getTrackable().getSize();

        // Renders the Augmentation View with the 3D Book data Panel
        renderAugmentation(trackableResult);

    }
    else
    {
        // Manages the 3D to 2D Transition initialization
        if (!scanningMode && showAnimation3Dto2D && renderState == RS_NORMAL
                && framesToSkipBeforeRenderingTransition == 0)
        {
            startTransitionTo2D();
        }

        // Reduces the number of frames to wait before triggering
        // the transition by 1
        if( framesToSkipBeforeRenderingTransition > 0 && renderState == RS_NORMAL)
        {
            pthread_mutex_lock(&framesToSkipMutex);
            framesToSkipBeforeRenderingTransition -= 1;
            pthread_mutex_unlock(&framesToSkipMutex);
        }

    }

    // Logic for rendering Transition to 2D
    if (renderState == RS_TRANSITION_TO_2D && showAnimation3Dto2D)
    {
        renderTransitionTo2D();
    }

    // Logic for rendering Transition to 3D
    if (renderState == RS_TRANSITION_TO_3D )
    {
        renderTransitionTo3D();
    }

    // Get the tracker manager:
    QCAR::TrackerManager& trackerManager = QCAR::TrackerManager::getInstance();

    // Get the image tracker:
    QCAR::ImageTracker* imageTracker = static_cast<QCAR::ImageTracker*>(
            trackerManager.getTracker(QCAR::Tracker::IMAGE_TRACKER));

    // Get the target finder:
    QCAR::TargetFinder* finder = imageTracker->getTargetFinder();

    // Renders the current state - User process Feedback
    if (finder->isRequesting())
    {
        // Requesting State - Show Requesting text in Status Bar
        setStatusBarText("Requesting");
        showStatusBar();
    }
    else
    {
        // Hiding Status Bar
        hideStatusBar();
    }

    glDisable(GL_DEPTH_TEST);

    QCAR::Renderer::getInstance().end();

}