]>
cloud.milkyroute.net Git - dolphin.git/blob - src/columnviewsettingspage.cpp
6a25e7e42e5f1cac2e6f900cc1230869338771f9
1 /***************************************************************************
2 * Copyright (C) 2006 by Peter Penz <peter.penz@gmx.at> *
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. *
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. *
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 ***************************************************************************/
20 #include "columnviewsettingspage.h"
22 #include "dolphinsettings.h"
23 #include "dolphin_columnmodesettings.h"
26 #include <kfontrequester.h>
29 #include <QButtonGroup>
33 #include <QGridLayout>
35 #include <QRadioButton>
38 ColumnViewSettingsPage::ColumnViewSettingsPage(DolphinMainWindow
* mainWindow
,
41 m_mainWindow(mainWindow
),
47 const int spacing
= KDialog::spacingHint();
48 const int margin
= KDialog::marginHint();
49 const QSizePolicy
sizePolicy(QSizePolicy::Preferred
, QSizePolicy::Fixed
);
54 ColumnModeSettings
* settings
= DolphinSettings::instance().columnModeSettings();
55 Q_ASSERT(settings
!= 0);
57 // Create "Icon" properties
58 QGroupBox
* iconSizeBox
= new QGroupBox(i18n("Icon Size"), this);
59 iconSizeBox
->setSizePolicy(sizePolicy
);
61 m_smallIconSize
= new QRadioButton(i18n("Small"), this);
62 m_mediumIconSize
= new QRadioButton(i18n("Medium"), this);
63 m_largeIconSize
= new QRadioButton(i18n("Large"), this);
64 switch (settings
->iconSize()) {
65 case K3Icon::SizeLarge
:
66 m_largeIconSize
->setChecked(true);
69 case K3Icon::SizeMedium
:
70 m_mediumIconSize
->setChecked(true);
73 case K3Icon::SizeSmall
:
75 m_smallIconSize
->setChecked(true);
78 QButtonGroup
* iconSizeGroup
= new QButtonGroup(this);
79 iconSizeGroup
->addButton(m_smallIconSize
);
80 iconSizeGroup
->addButton(m_mediumIconSize
);
81 iconSizeGroup
->addButton(m_largeIconSize
);
83 QHBoxLayout
* iconSizeLayout
= new QHBoxLayout(iconSizeBox
);
84 iconSizeLayout
->addWidget(m_smallIconSize
);
85 iconSizeLayout
->addWidget(m_mediumIconSize
);
86 iconSizeLayout
->addWidget(m_largeIconSize
);
88 // create "Text" properties
89 QGroupBox
* textBox
= new QGroupBox(i18n("Text"), this);
90 textBox
->setSizePolicy(sizePolicy
);
92 QLabel
* fontLabel
= new QLabel(i18n("Font:"), textBox
);
93 m_fontRequester
= new KFontRequester(textBox
);
94 QFont
font(settings
->fontFamily(),
95 settings
->fontSize());
96 font
.setItalic(settings
->italicFont());
97 font
.setBold(settings
->boldFont());
98 m_fontRequester
->setFont(font
);
100 QHBoxLayout
* textLayout
= new QHBoxLayout(textBox
);
101 textLayout
->addWidget(fontLabel
);
102 textLayout
->addWidget(m_fontRequester
);
104 // Add a dummy widget with no restriction regarding
105 // a vertical resizing. This assures that the dialog layout
106 // is not stretched vertically.
110 ColumnViewSettingsPage::~ColumnViewSettingsPage()
114 void ColumnViewSettingsPage::applySettings()
116 ColumnModeSettings
* settings
= DolphinSettings::instance().columnModeSettings();
117 Q_ASSERT(settings
!= 0);
119 int iconSize
= K3Icon::SizeSmall
;
120 if (m_mediumIconSize
->isChecked()) {
121 iconSize
= K3Icon::SizeMedium
;
122 } else if (m_largeIconSize
->isChecked()) {
123 iconSize
= K3Icon::SizeLarge
;
125 settings
->setIconSize(iconSize
);
127 const QFont font
= m_fontRequester
->font();
128 settings
->setFontFamily(font
.family());
129 settings
->setFontSize(font
.pointSize());
130 settings
->setItalicFont(font
.italic());
131 settings
->setBoldFont(font
.bold());
134 #include "columnviewsettingspage.moc"