void Slideshow::toggleSlideshow () { if (slideshowRunning) stopSlideshow (); else startSlideshow (); }
/** * Defines mouse button release event. */ void Photo_Viewer::mouseReleaseEvent(QMouseEvent *pEvent) { //if left mouse button pressed if (pEvent->button() == Qt::LeftButton) { int sizeX = pEvent->x(); //previous button pressed if (sizeX<=222) { previousImage(); } //next button pressed if (sizeX>=666) { nextImage(); } //middle section pressed if (sizeX>222 && sizeX<666) { //invert slideshow toggle if (getSlideshowToggle()==0) { setSlideshowToggle(1); } else { setSlideshowToggle(0); } if (getSlideshowToggle()==1) { startSlideshow(); } } } }
void Image::init(const KConfigGroup &config) { m_timer.stop(); if (renderingMode().name().isEmpty()) { m_mode = "SingleImage"; } else { m_mode = renderingMode().name(); } calculateGeometry(); m_delay = config.readEntry("slideTimer", 10); setResizeMethodHint((ResizeMethod)config.readEntry("wallpaperposition", (int)ScaledResize)); m_wallpaper = config.readEntry("wallpaper", QString()); if (m_wallpaper.isEmpty()) { useSingleImageDefaults(); } m_color = config.readEntry("wallpapercolor", QColor(Qt::black)); m_usersWallpapers = config.readEntry("userswallpapers", QStringList()); m_dirs = config.readEntry("slidepaths", QStringList()); if (m_dirs.isEmpty()) { m_dirs << KStandardDirs::installPath("wallpaper"); } setUsingRenderingCache(m_mode == "SingleImage"); if (m_mode == "SingleImage") { setSingleImage(); setContextualActions(QList<QAction*>()); } else { m_nextWallpaperAction = new QAction(KIcon("user-desktop"), i18n("Next Wallpaper Image"), this); connect(m_nextWallpaperAction, SIGNAL(triggered(bool)), this, SLOT(nextSlide())); m_openImageAction = new QAction(KIcon("document-open"), i18n("Open Wallpaper Image"), this); connect(m_openImageAction, SIGNAL(triggered(bool)), this, SLOT(openSlide())); QTimer::singleShot(200, this, SLOT(startSlideshow())); QList<QAction*> actions; actions.push_back(m_nextWallpaperAction); actions.push_back(m_openImageAction); setContextualActions(actions); updateWallpaperActions(); } m_animation = new QPropertyAnimation(this, "fadeValue"); m_animation->setProperty("easingCurve", QEasingCurve::InQuad); m_animation->setProperty("duration", 500); m_animation->setProperty("startValue", 0.0); m_animation->setProperty("endValue", 1.0); }