Exemplo n.º 1
0
/** \fn     GalleryWidget::HandleImageTransition()
 *  \brief  Handles any specified effects between two
 *          images when the file loading was completed
 *  \return void
 */
void GalleryWidget::HandleImageTransition()
{
    // If the image loading is done then resume the slideshow which was
    // only paused to not to interfere with the loading process.
    ResumeSlideShow();

    // Also update the file details information in case its visible.
    if (m_infoVisible)
        ShowFileDetails();

    // Hide the status information
    // that can be displayed in the themes
    if (m_status)
        m_status->SetVisible(false);

    switch (m_transitionType)
    {
    case kFade:
        HandleFadeTransition();
        break;

    default:
        HandleNoTransition();
        break;
    }
}
Exemplo n.º 2
0
/** \fn     GalleryWidget::StartRandomSlideShow()
 *  \brief  Starts a slideshow where the images are shown randomly
 *  \return void
 */
void GalleryWidget::StartRandomSlideShow()
{
    if (!m_timer)
        return;

    StopSlideShow();
    m_slideShowType = kRandomSlideShow;
    connect(m_timer, SIGNAL(timeout()), this, SLOT(ShowRandomFile()));
    ResumeSlideShow();
}
Exemplo n.º 3
0
// ContinueCalibration is attached to a timer and called every 40 milisonds.
static int ContinueCalibration(HBROWSER_HANDLE hbrowser, HDOC_HANDLE hdoc, HELEMENT_HANDLE helem)
{	// Attached to a time by Called every 40 milisonds.
	if (timer_running)					// timer_running == 0 means we cancelled.
	{
		if (DemoCountdown)
		{
			if (!--DemoCountdown)
			{
				MainWindowHome(hbrowser, hdoc);
				timer_running = 0;
				return -1;
			}
			else
				CalibrateRearmTimer(hbrowser, helem, 0);
			return 0;
		}
		per_cent_complete += 2;
		if (per_cent_complete > 100)
		{ // Stop the animation
			ResumeSlideShow();
			UpdateCalibrationDone(hbrowser,helem, hdoc);
			if (DemoModeEnabled)
			{
				DemoCountdown = 40;
				CalibrateRearmTimer(hbrowser, helem, 0);
				timer_running = 1;
			}
			else
				timer_running = 0;
		}
		else
		{ // Continue the animation and restart the timer
			UpdateCalibrationScreen(hbrowser, helem, hdoc, per_cent_complete);
			CalibrateRearmTimer(hbrowser, helem, 0);
		}
	}
	return 0;
}
Exemplo n.º 4
0
/** \fn     GalleryWidget::keyPressEvent(QKeyEvent *)
 *  \brief  Translates the keypresses and keys bound to the
 *          plugin to specific actions within the plugin
 *  \param  event The pressed key
 *  \return True if key was used, otherwise false
 */
bool GalleryWidget::keyPressEvent(QKeyEvent *event)
{
    if (GetFocusWidget()->keyPressEvent(event))
        return true;

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

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

        if (action == "LEFT")
            ShowPrevFile();
        else if (action == "RIGHT")
            ShowNextFile();
        else if (action == "INFO")
            ShowFileDetails();
        else if (action == "MENU")
            MenuMain();
        else if (action == "PLAY")
        {
            // If no slideshow is active and the user presses the play
            // button then start a normal slideshow. But if a slideshow
            // is already running then start or pause it.
            if (m_slideShowType == kNoSlideShow)
                StartNormalSlideShow();
            else
            {
                if (m_timer->isActive())
                    PauseSlideShow();
                else
                    ResumeSlideShow();
            }
        }
        else if (action == "PAUSE")
            PauseSlideShow();
        else if (action == "STOP")
            StopSlideShow();
        else if (action == "ROTRIGHT")
        {
            m_gvh->SetFileOrientation(kFileRotateCW);
            LoadFile();
        }
        else if (action == "ROTLEFT")
        {
            m_gvh->SetFileOrientation(kFileRotateCCW);
            LoadFile();
        }
        else if (action == "FLIPHORIZONTAL")
        {
            m_gvh->SetFileOrientation(kFileFlipHorizontal);
            LoadFile();
        }
        else if (action == "FLIPVERTICAL")
        {
            m_gvh->SetFileOrientation(kFileFlipVertical);
            LoadFile();
        }
        else if (action == "ZOOMIN")
        {
            m_gvh->SetFileZoom(kFileZoomIn);
            LoadFile();
        }
        else if (action == "ZOOMOUT")
        {
            m_gvh->SetFileZoom(kFileZoomOut);
            LoadFile();
        }
        else if (action == "ESCAPE")
        {
            if (m_infoVisible)
                HideFileDetails();
            else
                handled = false;
        }
    }

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

    return handled;
}