Esempio n. 1
0
/**
 *  \brief Start a slideshow
 */
void GallerySlideView::Play(bool useTransition)
{
    // Start from next slide
    ShowNextSlide(useTransition);

    m_playing = true;
    if (!m_suspended)
        m_timer.start();
    if (m_uiStatus)
        SetStatus(tr("Playing"));
}
Esempio n. 2
0
/**
 *  \brief  Constructor
 *  \param  parent The screen parent
 *  \param  name The name of the screen
 */
GallerySlideView::GallerySlideView(MythScreenStack *parent, const char *name,
                                   bool editsAllowed)
    : MythScreenType(parent, name),
      m_uiImage(NULL),
      m_uiStatus(NULL),
      m_uiSlideCount(NULL), m_uiCaptionText(NULL), m_uiHideCaptions(NULL),
      m_mgr(ImageManagerFe::getInstance()),
      m_view(NULL),
      m_availableTransitions(GetMythPainter()->SupportsAnimation()),
      m_transition(m_availableTransitions.Select(
                       gCoreContext->GetNumSetting("GalleryTransitionType",
                                                   kBlendTransition))),
      m_updateTransition(),
      m_slides(),
      m_infoList(*this),
      m_slideShowTime(gCoreContext->GetNumSetting("GallerySlideShowTime", 3000)),
      m_playing(false),
      m_suspended(false),
      m_showCaptions(gCoreContext->GetNumSetting("GalleryShowSlideCaptions", true)),
      m_transitioning(false),
      m_editsAllowed(editsAllowed)
{
    // Detect when transitions finish. Queued signal to allow redraw/pulse to
    // complete before handling event.
    connect(&m_transition, SIGNAL(finished()),
            this, SLOT(TransitionComplete()), Qt::QueuedConnection);
    connect(&m_updateTransition, SIGNAL(finished()),
            this, SLOT(TransitionComplete()), Qt::QueuedConnection);

    // Seed random generator for random transitions
    qsrand(QTime::currentTime().msec());

    // Initialise slideshow timer
    m_timer.setSingleShot(true);
    m_timer.setInterval(m_slideShowTime);
    connect(&m_timer, SIGNAL(timeout()), this, SLOT(ShowNextSlide()));
}
Esempio n. 3
0
/**
 *  \brief  Handle keypresses
 *  \param  event The pressed key
 *  \return True if key was used, otherwise false
 */
bool GallerySlideView::keyPressEvent(QKeyEvent *event)
{
    if (GetFocusWidget()->keyPressEvent(event))
        return true;

    QStringList actions;
    bool handled = GetMythMainWindow()->TranslateKeyPress("Images", event, actions);

    for (int i = 0; i < actions.size() && !handled; i++)
    {
        QString action = actions[i];
        handled = true;

        if (action == "LEFT")
            ShowPrevSlide();
        else if (action == "RIGHT")
            ShowNextSlide();
        else if (action == "INFO")
            ShowInfo();
        else if (action == "MENU")
            MenuMain();
        else if (action == "PLAY")
        {
            if (m_playing)
                Stop();
            else
                Play();
        }
        else if (action == "SELECT")
            PlayVideo();
        else if (action == "STOP")
            Stop();
        else if (action == "ROTRIGHT")
            Transform(kRotateCW);
        else if (action == "ROTLEFT")
            Transform(kRotateCCW);
        else if (action == "FLIPHORIZONTAL")
            Transform(kFlipHorizontal);
        else if (action == "FLIPVERTICAL")
            Transform(kFlipVertical);
        else if (action == "ZOOMIN")
            Zoom(10);
        else if (action == "ZOOMOUT")
            Zoom(-10);
        else if (action == "FULLSIZE")
            Zoom();
        else if (action == "SCROLLUP")
            Pan(QPoint(0, 100));
        else if (action == "SCROLLDOWN")
            Pan(QPoint(0, -100));
        else if (action == "SCROLLLEFT")
            Pan(QPoint(-120, 0));
        else if (action == "SCROLLRIGHT")
            Pan(QPoint(120, 0));
        else if (action == "RECENTER")
            Pan();
        else if (action == "ESCAPE" && !GetMythMainWindow()->IsExitingToMain())
            // Exit info details, if shown
            handled = m_infoList.Hide();
        else
            handled = false;
    }

    if (!handled)
        handled = MythScreenType::keyPressEvent(event);

    return handled;
}
Esempio n. 4
0
/************************************************************************
 Function: WORD JPEGDrawCallback(void)
 
 Overview: This function is called by GOLDraw() function when the state 
 		   is in this particular demo.

 Input: none

 Output: If the function returns non-zero the draw control will be passed 
		to GOL. GOLDraw() can proceed and re-draw objects that needs 
		to be redrawn.
************************************************************************/
WORD JPEGDrawCallback(void)
{
    static DWORD    prevTick = 0;   // keeps previous value of tick	
    SHORT           item;

    MonitorDriveMedia();

    // check if media is still present, if not return to main menu
    if(mediaPresent == FALSE)
    {
        screenState = CREATE_DEMOSELECTION;
        return (1);
    }

    if(blSlideShowOn == 1)
    {

        // moves to the next item in the list when doing the slide show
        if((tick - prevTick) > blSlideShowDelay)
        {
            ShowNextSlide();
            blSlideShowDelay = JPEGSLIDESHOWDELAY;
            prevTick = tick;
        }
    }
    else
    {

        // this implements the automatic scrolling of the list box contents
        // when the up or down buttons are continuously pressed.
        if((tick - prevTick) > SLIDERSCROLLDELAY)
        {
            item = LbGetFocusedItem(pListBox);
            if(GetState(pBtnUp, BTN_PRESSED))
            {

                // redraw only the listbox when the item that is focused has changed
                LbSetFocusedItem(pListBox, LbGetFocusedItem(pListBox) - 1);
                if(item != LbGetFocusedItem(pListBox))
                {
                    SetState(pListBox, LB_DRAW_ITEMS);
                }

                SldSetPos(pSlider, SldGetPos(pSlider) + 1);
                SetState(pSlider, SLD_DRAW_THUMB);
            }

            if(GetState(pBtnDn, BTN_PRESSED))
            {
                LbSetFocusedItem(pListBox, LbGetFocusedItem(pListBox) + 1);
                if(item != LbGetFocusedItem(pListBox))
                {
                    SetState(pListBox, LB_DRAW_ITEMS);
                }

                SldSetPos(pSlider, SldGetPos(pSlider) - 1);
                SetState(pSlider, SLD_DRAW_THUMB);
            }

            prevTick = tick;
        }
    }

    return (1);
}