Make a branch to make krunner Good Enough For Aaron™.
[kdebase/uwolfer.git] / workspace / plasma / containments / desktop / backgrounddialog.h
blob67f1c85e4feb42cc2eea36e07280ef2d56db1988
1 /*
2 Copyright (c) 2007 Paolo Capriotti <p.capriotti@gmail.com>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8 */
10 #ifndef BACKGROUNDDIALOG_H
11 #define BACKGROUNDDIALOG_H
13 #include <QSize>
14 #include <QTimer>
15 #include <KDialog>
17 #include "backgroundpackage.h"
18 #include "renderthread.h"
20 #include "ui_BackgroundDialog.h"
22 class BackgroundContainer;
23 class ThemeModel;
24 class BackgroundListModel;
25 class QComboBox;
26 class QLabel;
27 class QListWidget;
28 class QPushButton;
29 class QTimeEdit;
30 class QCheckBox;
31 class KColorButton;
32 class KFileDialog;
33 class KSeparator;
35 class BackgroundDialog : public KDialog, public Ui::BackgroundDialog
37 Q_OBJECT
38 public:
39 enum BackgroundMode {
40 kStaticBackground,
41 kSlideshowBackground,
42 kNoBackground
45 // FIXME seems that we're leaking, make a distructor
46 BackgroundDialog(const QSize &res,
47 const KConfigGroup &config,
48 const KConfigGroup &globalConfig,
49 QWidget *parent = 0);
51 void reloadConfig(const KConfigGroup &config, const KConfigGroup &globalConfig);
52 void saveConfig(KConfigGroup config, KConfigGroup globalConfig);
54 QString path() const;
55 int mode();
56 private:
57 //QComboBox *m_mode;
58 //QComboBox *m_view;
59 BackgroundListModel *m_model;
60 ThemeModel *m_themeModel;
62 //QLabel *m_authorLabel;
63 //QLabel *m_emailLabel;
64 //QLabel *m_licenseLabel;
65 //QLabel *m_authorLine;
66 //QLabel *m_emailLine;
67 //QLabel *m_licenseLine;
68 QLabel *m_preview;
70 //QPushButton *m_newStuff;
72 //QComboBox *m_resizeMethod;
73 //KColorButton *m_color;
75 //QListWidget *m_dirlist;
76 //QPushButton *m_addDir;
77 //QPushButton *m_removeDir;
78 //QTimeEdit *m_slideshowDelay;
79 KFileDialog *m_dialog;
81 QString m_img;
82 QSize m_res;
83 float m_ratio;
85 QTimer m_preview_timer;
86 QList<Background *> m_slideshowBackgrounds;
87 int m_currentSlide;
89 QStringList m_selected;
91 RenderThread m_preview_renderer;
92 int m_preview_token;
94 //QCheckBox *m_alignToGrid;
95 //QCheckBox *m_showIcons;
97 bool setMetadata(QLabel *label,
98 const QString &text);
99 void setPreview(const QString &img, Background::ResizeMethod method);
100 virtual bool contains(const QString &path) const;
101 private slots:
102 void update();
103 void getNewStuff();
104 void browse();
105 void showFileDialog();
106 void enableButtons(bool enabled);
108 void slotAddDir();
109 void slotRemoveDir();
110 void updateSlideshow();
111 void updateSlideshowPreview();
113 void changeBackgroundMode(int mode);
114 void previewRenderingDone(int token, const QImage &pix);
116 void updateScreenshot(QPersistentModelIndex index);
117 void cleanup();
118 void removeBackground(const QString &path);
121 #endif // BACKGROUNDDIALOG_H