1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
|
/***************************************************************************
* Copyright (C) 2006 by Peter Penz *
* [email protected] *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#include "detailsviewsettingspage.h"
#include <qcheckbox.h>
#include <klocale.h>
#include <kdialog.h>
#include <kfontcombo.h>
#include <qspinbox.h>
#include <qlabel.h>
#include <qgrid.h>
#include <assert.h>
#include <qbuttongroup.h>
#include <qradiobutton.h>
#include <qcombobox.h>
#include <qgroupbox.h>
#include <qgroupbox.h>
#include "dolphinsettings.h"
#include "dolphindetailsviewsettings.h"
#include "dolphindetailsview.h"
DetailsViewSettingsPage::DetailsViewSettingsPage(QWidget *parent) :
QVBox(parent),
m_dateBox(0),
m_permissionsBox(0),
m_ownerBox(0),
m_groupBox(0),
m_smallIconSize(0),
m_mediumIconSize(0),
m_largeIconSize(0)
{
const int spacing = KDialog::spacingHint();
const int margin = KDialog::marginHint();
const QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
setSpacing(spacing);
setMargin(margin);
DolphinDetailsViewSettings* settings = DolphinSettings::instance().detailsView();
assert(settings != 0);
// create "Columns" properties
QGroupBox* columnsGroup = new QGroupBox(4, Qt::Vertical, i18n("Columns"), this);
columnsGroup->setSizePolicy(sizePolicy);
columnsGroup->setMargin(margin);
QHBox* visibleColumnsLayout = new QHBox(columnsGroup);
m_dateBox = new QCheckBox(i18n("Date"), visibleColumnsLayout);
m_dateBox->setChecked(settings->isColumnEnabled(DolphinDetailsView::DateColumn));
m_permissionsBox = new QCheckBox(i18n("Permissions"), visibleColumnsLayout);
m_permissionsBox->setChecked(settings->isColumnEnabled(DolphinDetailsView::PermissionsColumn));
m_ownerBox = new QCheckBox(i18n("Owner"), visibleColumnsLayout);
m_ownerBox->setChecked(settings->isColumnEnabled(DolphinDetailsView::OwnerColumn));
m_groupBox = new QCheckBox(i18n("Group"), visibleColumnsLayout);
m_groupBox->setChecked(settings->isColumnEnabled(DolphinDetailsView::GroupColumn));
// Create "Icon" properties
QButtonGroup* iconSizeGroup = new QButtonGroup(3, Qt::Horizontal, i18n("Icon Size"), this);
iconSizeGroup->setSizePolicy(sizePolicy);
iconSizeGroup->setMargin(margin);
m_smallIconSize = new QRadioButton(i18n("Small"), iconSizeGroup);
m_mediumIconSize = new QRadioButton(i18n("Medium"), iconSizeGroup);
m_largeIconSize = new QRadioButton(i18n("Large"), iconSizeGroup);
switch (settings->iconSize()) {
case KIcon::SizeLarge:
m_largeIconSize->setChecked(true);
break;
case KIcon::SizeMedium:
m_mediumIconSize->setChecked(true);
break;
case KIcon::SizeSmall:
default:
m_smallIconSize->setChecked(true);
}
//new QLabel(i18n("Icon size:"), iconGroup);
//m_iconSizeBox = new QComboBox(iconGroup);
//m_iconSizeBox->insertItem(i18n("Small"));
//m_iconSizeBox->insertItem(i18n("Medium"));
//m_iconSizeBox->insertItem(i18n("Large"));
// create "Text" properties
QGroupBox* textGroup = new QGroupBox(2, Qt::Horizontal, i18n("Text"), this);
textGroup->setSizePolicy(sizePolicy);
textGroup->setMargin(margin);
new QLabel(i18n("Font family:"), textGroup);
m_fontFamilyBox = new KFontCombo(textGroup);
m_fontFamilyBox->setCurrentFont(settings->fontFamily());
new QLabel(i18n("Font size:"), textGroup);
m_fontSizeBox = new QSpinBox(6, 99, 1, textGroup);
m_fontSizeBox->setValue(settings->fontSize());
// Add a dummy widget with no restriction regarding
// a vertical resizing. This assures that the dialog layout
// is not stretched vertically.
new QWidget(this);
}
DetailsViewSettingsPage::~DetailsViewSettingsPage()
{
}
void DetailsViewSettingsPage::applySettings()
{
DolphinDetailsViewSettings* settings = DolphinSettings::instance().detailsView();
assert(settings != 0);
settings->setColumnEnabled(DolphinDetailsView::DateColumn,
m_dateBox->isChecked());
settings->setColumnEnabled(DolphinDetailsView::PermissionsColumn,
m_permissionsBox->isChecked());
settings->setColumnEnabled(DolphinDetailsView::OwnerColumn,
m_ownerBox->isChecked());
settings->setColumnEnabled(DolphinDetailsView::GroupColumn,
m_groupBox->isChecked());
int iconSize = KIcon::SizeSmall;
if (m_mediumIconSize->isChecked()) {
iconSize = KIcon::SizeMedium;
}
else if (m_largeIconSize->isChecked()) {
iconSize = KIcon::SizeLarge;
}
settings->setIconSize(iconSize);
settings->setFontFamily(m_fontFamilyBox->currentFont());
settings->setFontSize(m_fontSizeBox->value());
}
#include "detailsviewsettingspage.moc"
|