~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to plasma/generic/wallpapers/image/image.h

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
  Copyright (c) 2007 Paolo Capriotti <p.capriotti@gmail.com>
 
3
  Copyright (c) 2008 by Petri Damsten <damu@iki.fi>
 
4
 
 
5
  This program is free software; you can redistribute it and/or modify
 
6
  it under the terms of the GNU General Public License as published by
 
7
  the Free Software Foundation; either version 2 of the License, or
 
8
  (at your option) any later version.
 
9
*/
 
10
 
 
11
#ifndef IMAGE_HEADER
 
12
#define IMAGE_HEADER
 
13
 
 
14
#include <QTimer>
 
15
#include <QPixmap>
 
16
#include <QStringList>
 
17
 
 
18
#include <Plasma/Wallpaper>
 
19
#include <Plasma/Package>
 
20
 
 
21
#include "ui_imageconfig.h"
 
22
#include "ui_slideshowconfig.h"
 
23
 
 
24
class QPropertyAnimation;
 
25
 
 
26
class KDirWatch;
 
27
class KFileDialog;
 
28
class KJob;
 
29
 
 
30
namespace KNS3 {
 
31
    class DownloadDialog;
 
32
}
 
33
 
 
34
class BackgroundListModel;
 
35
 
 
36
class Image : public Plasma::Wallpaper
 
37
{
 
38
    Q_OBJECT
 
39
    Q_PROPERTY(qreal fadeValue READ fadeValue WRITE setFadeValue)
 
40
 
 
41
    public:
 
42
        Image(QObject* parent, const QVariantList& args);
 
43
        ~Image();
 
44
 
 
45
        virtual void save(KConfigGroup &config);
 
46
        virtual void paint(QPainter* painter, const QRectF& exposedRect);
 
47
        virtual QWidget* createConfigurationInterface(QWidget* parent);
 
48
        void updateScreenshot(QPersistentModelIndex index);
 
49
        qreal fadeValue() const;
 
50
 
 
51
    signals:
 
52
        void settingsChanged(bool);
 
53
 
 
54
    protected slots:
 
55
        void removeWallpaper(QString name);
 
56
        void timeChanged(const QTime& time);
 
57
        void positioningChanged(int index);
 
58
        void addDir();
 
59
        void removeDir();
 
60
        void getNewWallpaper();
 
61
        void colorChanged(const QColor& color);
 
62
        void pictureChanged(const QModelIndex &);
 
63
        void wallpaperBrowseCompleted();
 
64
        void nextSlide();
 
65
        /**
 
66
         * Open the current slide in the default image application
 
67
         */
 
68
        void openSlide();
 
69
        void updateBackground(const QImage &img);
 
70
        void showFileDialog();
 
71
        void setFadeValue(qreal value);
 
72
        void configWidgetDestroyed();
 
73
        void startSlideshow();
 
74
        void modified();
 
75
        void fileDialogFinished();
 
76
        void addUrl(const KUrl &url, bool setAsCurrent);
 
77
        void addUrls(const KUrl::List &urls);
 
78
        void setWallpaper(const QString &path);
 
79
        void setWallpaperRetrieved(KJob *job);
 
80
        void addWallpaperRetrieved(KJob *job);
 
81
        void newStuffFinished();
 
82
        void setConfigurationInterfaceModel();
 
83
        void updateDirs();
 
84
        void addDirFromSelectionDialog();
 
85
        void systemCheckBoxToggled(bool);
 
86
        void downloadedCheckBoxToggled(bool);
 
87
        void imageFileAltered(const QString &path);
 
88
        void backgroundsFound(const QStringList &paths, const QString &token);
 
89
 
 
90
    protected:
 
91
        void init(const KConfigGroup &config);
 
92
        void renderWallpaper(const QString& image = QString());
 
93
        void suspendStartup(bool suspend); // for ksmserver
 
94
        void calculateGeometry();
 
95
        void setSingleImage();
 
96
        void updateWallpaperActions();
 
97
        void useSingleImageDefaults();
 
98
 
 
99
    private:
 
100
        static bool s_startupResumed;
 
101
        static bool s_startupSuspended;
 
102
 
 
103
        int m_delay;
 
104
        Plasma::Wallpaper::ResizeMethod m_resizeMethod;
 
105
        QStringList m_dirs;
 
106
        QString m_wallpaper;
 
107
        QColor m_color;
 
108
        QStringList m_usersWallpapers;
 
109
        KDirWatch *m_fileWatch;
 
110
 
 
111
        QWidget* m_configWidget;
 
112
        Ui::ImageConfig m_uiImage;
 
113
        Ui::SlideshowConfig m_uiSlideshow;
 
114
        QString m_mode;
 
115
        Plasma::Package *m_wallpaperPackage;
 
116
        QStringList m_slideshowBackgrounds;
 
117
        QTimer m_timer;
 
118
        QPixmap m_pixmap;
 
119
        QPixmap m_oldPixmap;
 
120
        QPixmap m_oldFadedPixmap;
 
121
        int m_currentSlide;
 
122
        qreal m_fadeValue;
 
123
        QPropertyAnimation *m_animation;
 
124
        BackgroundListModel *m_model;
 
125
        KFileDialog *m_dialog;
 
126
        QSize m_size;
 
127
        QString m_img;
 
128
        QDateTime m_previousModified;
 
129
        bool m_randomize;
 
130
        QWeakPointer<KNS3::DownloadDialog> m_newStuffDialog;
 
131
        QString m_findToken;
 
132
 
 
133
        QAction* m_nextWallpaperAction;
 
134
        QAction* m_openImageAction;
 
135
};
 
136
 
 
137
#endif