]> cloud.milkyroute.net Git - dolphin.git/blob - src/iconsizegroupbox.cpp
Konq popupmenu fix: we don't show the "Create new" submenu over subdirs in an iconvie...
[dolphin.git] / src / iconsizegroupbox.cpp
1 /***************************************************************************
2 * Copyright (C) 2008 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 #include "iconsizegroupbox.h"
21
22 #include <klocale.h>
23
24 #include <QGridLayout>
25 #include <QLabel>
26 #include <QSlider>
27
28 IconSizeGroupBox::IconSizeGroupBox(QWidget* parent) :
29 QGroupBox(i18nc("@title:group", "Icon Size"), parent),
30 m_defaultSizeSlider(0),
31 m_previewSizeSlider(0)
32 {
33 QLabel* defaultLabel = new QLabel(i18nc("@label:listbox", "Default:"), this);
34 m_defaultSizeSlider = new QSlider(Qt::Horizontal, this);
35 m_defaultSizeSlider->setPageStep(1);
36 m_defaultSizeSlider->setTickPosition(QSlider::TicksBelow);
37 connect(m_defaultSizeSlider, SIGNAL(sliderMoved(int)),
38 this, SIGNAL(defaultSizeChanged(int)));
39
40 QLabel* previewLabel = new QLabel(i18nc("@label:listbox", "Preview:"), this);
41 m_previewSizeSlider = new QSlider(Qt::Horizontal, this);
42 m_previewSizeSlider->setPageStep(1);
43 m_previewSizeSlider->setTickPosition(QSlider::TicksBelow);
44 connect(m_previewSizeSlider, SIGNAL(sliderMoved(int)),
45 this, SIGNAL(defaultSizeChanged(int)));
46
47 QGridLayout* layout = new QGridLayout(this);
48 layout->addWidget(defaultLabel, 0, 0, Qt::AlignRight);
49 layout->addWidget(m_defaultSizeSlider, 0, 1);
50 layout->addWidget(previewLabel, 1, 0, Qt::AlignRight);
51 layout->addWidget(m_previewSizeSlider, 1, 1);
52 }
53
54 IconSizeGroupBox::~IconSizeGroupBox()
55 {
56 }
57
58 void IconSizeGroupBox::setDefaultSizeRange(int min, int max)
59 {
60 m_defaultSizeSlider->setRange(min, max);
61 }
62
63 void IconSizeGroupBox::setPreviewSizeRange(int min, int max)
64 {
65 m_previewSizeSlider->setRange(min, max);
66 }
67
68 void IconSizeGroupBox::setDefaultSizeValue(int value)
69 {
70 m_defaultSizeSlider->setValue(value);
71 }
72
73 int IconSizeGroupBox::defaultSizeValue() const
74 {
75 return m_defaultSizeSlider->value();
76 }
77
78 void IconSizeGroupBox::setPreviewSizeValue(int value)
79 {
80 m_previewSizeSlider->setValue(value);
81 }
82
83 int IconSizeGroupBox::previewSizeValue() const
84 {
85 return m_previewSizeSlider->value();
86 }
87
88 #include "iconsizegroupbox.moc"