Beispiel #1
0
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);
}
Beispiel #2
0
PoTD::PoTD(QObject *parent, const QVariantList &args)
    : Plasma::Wallpaper(parent, args)
{
    connect(this, SIGNAL(renderCompleted(QImage)), this, SLOT(wallpaperRendered(QImage)));
    dataEngine(QLatin1String("potd"))->connectSource(QLatin1String("Providers"), this);
    setUsingRenderingCache(false);

    QAction *saveFile = KStandardAction::save(this, SLOT(getSaveFileLocation()), this);
    saveFile->setText(i18n("Save wallpaper image..."));
    saveFile->setShortcut(QKeySequence());
    setContextualActions(QList<QAction *>() << saveFile);
}