]> cloud.milkyroute.net Git - dolphin.git/blob - src/iconsizedialog.h
Use Xesam ontology instead of NIE. Since Strigi uses Xesam and we have no mapping...
[dolphin.git] / src / iconsizedialog.h
1 /***************************************************************************
2 * Copyright (C) 2006 by Peter Penz <peter.penz@gmx.at> *
3 * *
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 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
18 ***************************************************************************/
19
20 #ifndef ICONSIZEDIALOG_H
21 #define ICONSIZEDIALOG_H
22
23 #include <kdialog.h>
24
25 class QSlider;
26 class PixmapViewer;
27
28 /**
29 * @brief Allows to adjust the size for icons and previews.
30 *
31 * Default usage:
32 * \code
33 * IconSizeDialog dialog(this);
34 * if (dialog.exec() == QDialog::Accepted) {
35 * const int iconSize = dialog.iconSize();
36 * const int previewSize = dialog.previewSize();
37 * // ...
38 * }
39 * \endcode
40 */
41 class IconSizeDialog : public KDialog
42 {
43 Q_OBJECT
44
45 public:
46 explicit IconSizeDialog(QWidget* parent);
47 virtual ~IconSizeDialog();
48
49 int iconSize() const
50 {
51 return m_iconSize;
52 }
53 int previewSize() const
54 {
55 return m_previewSize;
56 }
57
58 protected slots:
59 virtual void slotButtonClicked(int button);
60
61 private slots:
62 void updateIconSize(int value);
63 void updatePreviewSize(int value);
64
65 private:
66 /** Returns the icon size for the given slider value. */
67 int iconSize(int sliderValue) const;
68
69 /** Returns the slider value for the given icon size. */
70 int sliderValue(int iconSize) const;
71
72 private:
73 int m_iconSize;
74 int m_previewSize;
75
76 QSlider* m_iconSizeSlider;
77 PixmapViewer* m_iconSizeViewer;
78 QSlider* m_previewSizeSlider;
79 PixmapViewer* m_previewSizeViewer;
80 };
81
82 #endif