Plasma
backgrounddialog.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef BACKGROUNDDIALOG_H
00011 #define BACKGROUNDDIALOG_H
00012
00013 #include <QSize>
00014 #include <QTimer>
00015 #include <KDialog>
00016
00017 #include "backgroundpackage.h"
00018 #include "renderthread.h"
00019
00020 #include "ui_BackgroundDialog.h"
00021
00022 class BackgroundContainer;
00023 class ThemeModel;
00024 class BackgroundListModel;
00025 class QComboBox;
00026 class QLabel;
00027 class QListWidget;
00028 class QPushButton;
00029 class QTimeEdit;
00030 class QCheckBox;
00031 class KColorButton;
00032 class KFileDialog;
00033 class KSeparator;
00034
00035 class BackgroundDialog : public KDialog, public Ui::BackgroundDialog
00036 {
00037 Q_OBJECT
00038 public:
00039 enum BackgroundMode {
00040 kStaticBackground,
00041 kSlideshowBackground,
00042 kNoBackground
00043 };
00044
00045
00046 BackgroundDialog(const QSize &res,
00047 const KConfigGroup &config,
00048 const KConfigGroup &globalConfig,
00049 QWidget *parent = 0);
00050
00051 void reloadConfig(const KConfigGroup &config, const KConfigGroup &globalConfig);
00052 void saveConfig(KConfigGroup config, KConfigGroup globalConfig);
00053
00054 QString path() const;
00055 int mode();
00056 private:
00057
00058
00059 BackgroundListModel *m_model;
00060 ThemeModel *m_themeModel;
00061
00062
00063
00064
00065
00066
00067
00068 QLabel *m_preview;
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079 KFileDialog *m_dialog;
00080
00081 QString m_img;
00082 QSize m_res;
00083 float m_ratio;
00084
00085 QTimer m_preview_timer;
00086 QList<Background *> m_slideshowBackgrounds;
00087 int m_currentSlide;
00088
00089 QStringList m_selected;
00090
00091 RenderThread m_preview_renderer;
00092 int m_preview_token;
00093
00094
00095
00096
00097 bool setMetadata(QLabel *label,
00098 const QString &text);
00099 void setPreview(const QString &img, Background::ResizeMethod method);
00100 virtual bool contains(const QString &path) const;
00101 private slots:
00102 void update();
00103 void getNewWallpaper();
00104 void getNewThemes();
00105 void browse();
00106 void showFileDialog();
00107 void enableButtons(bool enabled);
00108
00109 void slotAddDir();
00110 void slotRemoveDir();
00111 void updateSlideshow();
00112 void updateSlideshowPreview();
00113
00114 void changeBackgroundMode(int mode);
00115 void previewRenderingDone(int token, const QImage &pix);
00116
00117 void updateScreenshot(QPersistentModelIndex index);
00118 void cleanup();
00119 void removeBackground(const QString &path);
00120 };
00121
00122 #endif // BACKGROUNDDIALOG_H