┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/settings/viewmodes
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2010-07-24 20:39:19 +0000
committerPeter Penz <[email protected]>2010-07-24 20:39:19 +0000
commitd93d198db6eef9186177aa5a918b300a6b749627 (patch)
treef62173c59b35860245b087bf5115d9e866c2eece /src/settings/viewmodes
parent49eb864b03b6370e403c6f048ab18d1478eab045 (diff)
Sourcecode hierarchy cleanup: Use subfolders inside the "settings" folder
svn path=/trunk/KDE/kdebase/apps/; revision=1154129
Diffstat (limited to 'src/settings/viewmodes')
-rw-r--r--src/settings/viewmodes/columnviewsettingspage.cpp159
-rw-r--r--src/settings/viewmodes/columnviewsettingspage.h66
-rw-r--r--src/settings/viewmodes/detailsviewsettingspage.cpp152
-rw-r--r--src/settings/viewmodes/detailsviewsettingspage.h60
-rw-r--r--src/settings/viewmodes/dolphinfontrequester.cpp111
-rw-r--r--src/settings/viewmodes/dolphinfontrequester.h79
-rw-r--r--src/settings/viewmodes/iconsizegroupbox.cpp119
-rw-r--r--src/settings/viewmodes/iconsizegroupbox.h66
-rw-r--r--src/settings/viewmodes/iconsviewsettingspage.cpp247
-rw-r--r--src/settings/viewmodes/iconsviewsettingspage.h87
-rw-r--r--src/settings/viewmodes/viewsettingspage.cpp84
-rw-r--r--src/settings/viewmodes/viewsettingspage.h52
-rw-r--r--src/settings/viewmodes/viewsettingspagebase.cpp31
-rw-r--r--src/settings/viewmodes/viewsettingspagebase.h55
14 files changed, 1368 insertions, 0 deletions
diff --git a/src/settings/viewmodes/columnviewsettingspage.cpp b/src/settings/viewmodes/columnviewsettingspage.cpp
new file mode 100644
index 000000000..aac28f0fd
--- /dev/null
+++ b/src/settings/viewmodes/columnviewsettingspage.cpp
@@ -0,0 +1,159 @@
+/***************************************************************************
+ * 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 "columnviewsettingspage.h"
+
+#include "dolphinfontrequester.h"
+#include <dolphin_columnmodesettings.h>
+#include "iconsizegroupbox.h"
+#include "zoomlevelinfo.h"
+
+#include <kdialog.h>
+#include <klocale.h>
+#include <kcombobox.h>
+
+#include <settings/dolphinsettings.h>
+
+#include <QButtonGroup>
+#include <QCheckBox>
+#include <QGroupBox>
+#include <QHBoxLayout>
+#include <QLabel>
+#include <QSlider>
+#include <QRadioButton>
+
+ColumnViewSettingsPage::ColumnViewSettingsPage(QWidget* parent) :
+ ViewSettingsPageBase(parent),
+ m_iconSizeGroupBox(0),
+ m_fontRequester(0),
+ m_textWidthBox(0)
+{
+ const int spacing = KDialog::spacingHint();
+ const int margin = KDialog::marginHint();
+ const QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
+
+ setSpacing(spacing);
+ setMargin(margin);
+
+ // Create "Icon" properties
+ m_iconSizeGroupBox = new IconSizeGroupBox(this);
+ m_iconSizeGroupBox->setSizePolicy(sizePolicy);
+
+ const int min = ZoomLevelInfo::minimumLevel();
+ const int max = ZoomLevelInfo::maximumLevel();
+ m_iconSizeGroupBox->setDefaultSizeRange(min, max);
+ m_iconSizeGroupBox->setPreviewSizeRange(min, max);
+
+ connect(m_iconSizeGroupBox, SIGNAL(defaultSizeChanged(int)),
+ this, SIGNAL(changed()));
+ connect(m_iconSizeGroupBox, SIGNAL(previewSizeChanged(int)),
+ this, SIGNAL(changed()));
+
+ // create "Text" properties
+ QGroupBox* textGroup = new QGroupBox(i18nc("@title:group", "Text"), this);
+ textGroup->setSizePolicy(sizePolicy);
+
+ QLabel* fontLabel = new QLabel(i18nc("@label:listbox", "Font:"), textGroup);
+ m_fontRequester = new DolphinFontRequester(textGroup);
+ connect(m_fontRequester, SIGNAL(changed()), this, SIGNAL(changed()));
+
+ QLabel* textWidthLabel = new QLabel(i18nc("@label:listbox", "Text width:"), textGroup);
+ m_textWidthBox = new KComboBox(textGroup);
+ m_textWidthBox->addItem(i18nc("@item:inlistbox Text width", "Small"));
+ m_textWidthBox->addItem(i18nc("@item:inlistbox Text width", "Medium"));
+ m_textWidthBox->addItem(i18nc("@item:inlistbox Text width", "Large"));
+ m_textWidthBox->addItem(i18nc("@item:inlistbox Text width", "Huge"));
+ connect(m_textWidthBox, SIGNAL(currentIndexChanged(int)), this, SIGNAL(changed()));
+
+ QGridLayout* textGroupLayout = new QGridLayout(textGroup);
+ textGroupLayout->addWidget(fontLabel, 0, 0, Qt::AlignRight);
+ textGroupLayout->addWidget(m_fontRequester, 0, 1);
+ textGroupLayout->addWidget(textWidthLabel, 1, 0, Qt::AlignRight);
+ textGroupLayout->addWidget(m_textWidthBox, 1, 1);
+
+ // Add a dummy widget with no restriction regarding
+ // a vertical resizing. This assures that the dialog layout
+ // is not stretched vertically.
+ new QWidget(this);
+
+ loadSettings();
+}
+
+ColumnViewSettingsPage::~ColumnViewSettingsPage()
+{
+}
+
+void ColumnViewSettingsPage::applySettings()
+{
+ ColumnModeSettings* settings = DolphinSettings::instance().columnModeSettings();
+
+ const int iconSize = ZoomLevelInfo::iconSizeForZoomLevel(m_iconSizeGroupBox->defaultSizeValue());
+ const int previewSize = ZoomLevelInfo::iconSizeForZoomLevel(m_iconSizeGroupBox->previewSizeValue());
+ settings->setIconSize(iconSize);
+ settings->setPreviewSize(previewSize);
+
+ const QFont font = m_fontRequester->font();
+ settings->setUseSystemFont(m_fontRequester->mode() == DolphinFontRequester::SystemFont);
+ settings->setFontFamily(font.family());
+ settings->setFontSize(font.pointSizeF());
+ settings->setItalicFont(font.italic());
+ settings->setFontWeight(font.weight());
+
+ const int columnWidth = BaseTextWidth + (m_textWidthBox->currentIndex() * TextInc);
+ settings->setColumnWidth(columnWidth);
+
+ settings->writeConfig();
+}
+
+void ColumnViewSettingsPage::restoreDefaults()
+{
+ ColumnModeSettings* settings = DolphinSettings::instance().columnModeSettings();
+ settings->useDefaults(true);
+ loadSettings();
+ settings->useDefaults(false);
+}
+
+void ColumnViewSettingsPage::loadSettings()
+{
+ ColumnModeSettings* settings = DolphinSettings::instance().columnModeSettings();
+
+ const QSize iconSize(settings->iconSize(), settings->iconSize());
+ const int iconSizeValue = ZoomLevelInfo::zoomLevelForIconSize(iconSize);
+ m_iconSizeGroupBox->setDefaultSizeValue(iconSizeValue);
+
+ const QSize previewSize(settings->previewSize(), settings->previewSize());
+ const int previewSizeValue = ZoomLevelInfo::zoomLevelForIconSize(previewSize);
+ m_iconSizeGroupBox->setPreviewSizeValue(previewSizeValue);
+
+ if (settings->useSystemFont()) {
+ m_fontRequester->setMode(DolphinFontRequester::SystemFont);
+ } else {
+ QFont font(settings->fontFamily(),
+ qRound(settings->fontSize()));
+ font.setItalic(settings->italicFont());
+ font.setWeight(settings->fontWeight());
+ font.setPointSizeF(settings->fontSize());
+ m_fontRequester->setMode(DolphinFontRequester::CustomFont);
+ m_fontRequester->setCustomFont(font);
+ }
+
+ m_textWidthBox->setCurrentIndex((settings->columnWidth() - BaseTextWidth) / TextInc);
+}
+
+#include "columnviewsettingspage.moc"
diff --git a/src/settings/viewmodes/columnviewsettingspage.h b/src/settings/viewmodes/columnviewsettingspage.h
new file mode 100644
index 000000000..1ef0a524e
--- /dev/null
+++ b/src/settings/viewmodes/columnviewsettingspage.h
@@ -0,0 +1,66 @@
+/***************************************************************************
+ * 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 *
+ ***************************************************************************/
+
+#ifndef COLUMNVIEWSETTINGSPAGE_H
+#define COLUMNVIEWSETTINGSPAGE_H
+
+#include "viewsettingspagebase.h"
+
+class DolphinFontRequester;
+class IconSizeGroupBox;
+class KComboBox;
+
+/**
+ * @brief Represents the page from the Dolphin Settings which allows
+ * to modify the settings for the details view.
+ */
+class ColumnViewSettingsPage : public ViewSettingsPageBase
+{
+ Q_OBJECT
+
+public:
+ ColumnViewSettingsPage(QWidget* parent);
+ virtual ~ColumnViewSettingsPage();
+
+ /**
+ * Applies the settings for the details view.
+ * The settings are persisted automatically when
+ * closing Dolphin.
+ */
+ virtual void applySettings();
+
+ /** Restores the settings to default values. */
+ virtual void restoreDefaults();
+
+private:
+ void loadSettings();
+
+private:
+ enum
+ {
+ BaseTextWidth = 200,
+ TextInc = 50
+ };
+
+ IconSizeGroupBox* m_iconSizeGroupBox;
+ DolphinFontRequester* m_fontRequester;
+ KComboBox* m_textWidthBox;
+};
+
+#endif
diff --git a/src/settings/viewmodes/detailsviewsettingspage.cpp b/src/settings/viewmodes/detailsviewsettingspage.cpp
new file mode 100644
index 000000000..67cef32fe
--- /dev/null
+++ b/src/settings/viewmodes/detailsviewsettingspage.cpp
@@ -0,0 +1,152 @@
+/***************************************************************************
+ * 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 "iconsizegroupbox.h"
+#include "dolphinfontrequester.h"
+#include "dolphin_detailsmodesettings.h"
+#include "zoomlevelinfo.h"
+
+#include <kdialog.h>
+#include <klocale.h>
+
+#include <settings/dolphinsettings.h>
+
+#include <QButtonGroup>
+#include <QCheckBox>
+#include <QComboBox>
+#include <QGroupBox>
+#include <QGridLayout>
+#include <QLabel>
+#include <QRadioButton>
+#include <QtGui/QSpinBox>
+
+DetailsViewSettingsPage::DetailsViewSettingsPage(QWidget* parent) :
+ ViewSettingsPageBase(parent),
+ m_iconSizeGroupBox(0),
+ m_fontRequester(0),
+ m_expandableFolders(0)
+{
+ const int spacing = KDialog::spacingHint();
+ const int margin = KDialog::marginHint();
+ const QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
+
+ setSpacing(spacing);
+ setMargin(margin);
+
+ // Create "Icon" properties
+ m_iconSizeGroupBox = new IconSizeGroupBox(this);
+ m_iconSizeGroupBox->setSizePolicy(sizePolicy);
+
+ const int min = ZoomLevelInfo::minimumLevel();
+ const int max = ZoomLevelInfo::maximumLevel();
+ m_iconSizeGroupBox->setDefaultSizeRange(min, max);
+ m_iconSizeGroupBox->setPreviewSizeRange(min, max);
+
+ connect(m_iconSizeGroupBox, SIGNAL(defaultSizeChanged(int)),
+ this, SIGNAL(changed()));
+ connect(m_iconSizeGroupBox, SIGNAL(previewSizeChanged(int)),
+ this, SIGNAL(changed()));
+
+ // create "Text" properties
+ QWidget* textGroup = new QGroupBox(i18nc("@title:group", "Text"), this);
+ textGroup->setSizePolicy(sizePolicy);
+
+ QLabel* fontLabel = new QLabel(i18nc("@label:listbox", "Font:"), textGroup);
+ m_fontRequester = new DolphinFontRequester(textGroup);
+ connect(m_fontRequester, SIGNAL(changed()), this, SIGNAL(changed()));
+
+ QHBoxLayout* textLayout = new QHBoxLayout(textGroup);
+ textLayout->addWidget(fontLabel, 0, Qt::AlignRight);
+ textLayout->addWidget(m_fontRequester);
+
+ // create "Expandable Folders" checkbox
+ m_expandableFolders = new QCheckBox(i18nc("@option:check", "Expandable folders"), this);
+ connect(m_expandableFolders, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
+
+ // Add a dummy widget with no restriction regarding
+ // a vertical resizing. This assures that the dialog layout
+ // is not stretched vertically.
+ new QWidget(this);
+
+ loadSettings();
+}
+
+DetailsViewSettingsPage::~DetailsViewSettingsPage()
+{
+}
+
+void DetailsViewSettingsPage::applySettings()
+{
+ DetailsModeSettings* settings = DolphinSettings::instance().detailsModeSettings();
+
+ const int iconSize = ZoomLevelInfo::iconSizeForZoomLevel(m_iconSizeGroupBox->defaultSizeValue());
+ const int previewSize = ZoomLevelInfo::iconSizeForZoomLevel(m_iconSizeGroupBox->previewSizeValue());
+ settings->setIconSize(iconSize);
+ settings->setPreviewSize(previewSize);
+
+ const QFont font = m_fontRequester->font();
+ settings->setUseSystemFont(m_fontRequester->mode() == DolphinFontRequester::SystemFont);
+ settings->setFontFamily(font.family());
+ settings->setFontSize(font.pointSizeF());
+ settings->setItalicFont(font.italic());
+ settings->setFontWeight(font.weight());
+
+ settings->setExpandableFolders(m_expandableFolders->isChecked());
+
+ settings->writeConfig();
+}
+
+void DetailsViewSettingsPage::restoreDefaults()
+{
+ DetailsModeSettings* settings = DolphinSettings::instance().detailsModeSettings();
+ settings->useDefaults(true);
+ loadSettings();
+ settings->useDefaults(false);
+}
+
+void DetailsViewSettingsPage::loadSettings()
+{
+ DetailsModeSettings* settings = DolphinSettings::instance().detailsModeSettings();
+
+ const QSize iconSize(settings->iconSize(), settings->iconSize());
+ const int iconSizeValue = ZoomLevelInfo::zoomLevelForIconSize(iconSize);
+ m_iconSizeGroupBox->setDefaultSizeValue(iconSizeValue);
+
+ const QSize previewSize(settings->previewSize(), settings->previewSize());
+ const int previewSizeValue = ZoomLevelInfo::zoomLevelForIconSize(previewSize);
+ m_iconSizeGroupBox->setPreviewSizeValue(previewSizeValue);
+
+ if (settings->useSystemFont()) {
+ m_fontRequester->setMode(DolphinFontRequester::SystemFont);
+ } else {
+ QFont font(settings->fontFamily(),
+ qRound(settings->fontSize()));
+ font.setItalic(settings->italicFont());
+ font.setWeight(settings->fontWeight());
+ font.setPointSizeF(settings->fontSize());
+ m_fontRequester->setMode(DolphinFontRequester::CustomFont);
+ m_fontRequester->setCustomFont(font);
+ }
+
+ m_expandableFolders->setChecked(settings->expandableFolders());
+}
+
+#include "detailsviewsettingspage.moc"
diff --git a/src/settings/viewmodes/detailsviewsettingspage.h b/src/settings/viewmodes/detailsviewsettingspage.h
new file mode 100644
index 000000000..a4cbdd019
--- /dev/null
+++ b/src/settings/viewmodes/detailsviewsettingspage.h
@@ -0,0 +1,60 @@
+/***************************************************************************
+ * 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 *
+ ***************************************************************************/
+
+#ifndef DETAILSVIEWSETTINGSPAGE_H
+#define DETAILSVIEWSETTINGSPAGE_H
+
+#include "viewsettingspagebase.h"
+
+class DolphinFontRequester;
+class IconSizeGroupBox;
+class QCheckBox;
+
+/**
+ * @brief Represents the page from the Dolphin Settings which allows
+ * to modify the settings for the details view.
+ */
+class DetailsViewSettingsPage : public ViewSettingsPageBase
+{
+ Q_OBJECT
+
+public:
+ DetailsViewSettingsPage(QWidget* parent);
+ virtual ~DetailsViewSettingsPage();
+
+ /**
+ * Applies the settings for the details view.
+ * The settings are persisted automatically when
+ * closing Dolphin.
+ */
+ virtual void applySettings();
+
+ /** Restores the settings to default values. */
+ virtual void restoreDefaults();
+
+private:
+ void loadSettings();
+
+private:
+ IconSizeGroupBox* m_iconSizeGroupBox;
+ DolphinFontRequester* m_fontRequester;
+ QCheckBox* m_expandableFolders;
+};
+
+#endif
diff --git a/src/settings/viewmodes/dolphinfontrequester.cpp b/src/settings/viewmodes/dolphinfontrequester.cpp
new file mode 100644
index 000000000..04c5ed586
--- /dev/null
+++ b/src/settings/viewmodes/dolphinfontrequester.cpp
@@ -0,0 +1,111 @@
+/***************************************************************************
+ * Copyright (C) 2008 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 "dolphinfontrequester.h"
+
+#include <kfontdialog.h>
+#include <kglobalsettings.h>
+#include <klocale.h>
+#include <kcombobox.h>
+
+#include <QEvent>
+#include <QPushButton>
+
+DolphinFontRequester::DolphinFontRequester(QWidget* parent) :
+ KHBox(parent),
+ m_modeCombo(0),
+ m_chooseFontButton(0),
+ m_mode(SystemFont),
+ m_customFont()
+{
+ setSpacing(KDialog::spacingHint());
+
+ m_modeCombo = new KComboBox(this);
+ m_modeCombo->addItem(i18nc("@item:inlistbox Font", "System Font"));
+ m_modeCombo->addItem(i18nc("@item:inlistbox Font", "Custom Font"));
+ connect(m_modeCombo, SIGNAL(activated(int)),
+ this, SLOT(changeMode(int)));
+
+ m_chooseFontButton = new QPushButton(i18nc("@action:button Choose font", "Choose..."), this);
+ connect(m_chooseFontButton, SIGNAL(clicked()),
+ this, SLOT(openFontDialog()));
+
+ changeMode(m_modeCombo->currentIndex());
+}
+
+DolphinFontRequester::~DolphinFontRequester()
+{
+}
+
+void DolphinFontRequester::setMode(Mode mode)
+{
+ m_mode = mode;
+ m_modeCombo->setCurrentIndex(m_mode);
+ m_modeCombo->setFont(font());
+ m_chooseFontButton->setEnabled(m_mode == CustomFont);
+}
+
+DolphinFontRequester::Mode DolphinFontRequester::mode() const
+{
+ return m_mode;
+}
+
+QFont DolphinFontRequester::font() const
+{
+ return (m_mode == CustomFont) ? m_customFont : KGlobalSettings::generalFont();
+}
+
+void DolphinFontRequester::setCustomFont(const QFont& font)
+{
+ m_customFont = font;
+}
+
+QFont DolphinFontRequester::customFont() const
+{
+ return m_customFont;
+}
+
+bool DolphinFontRequester::event(QEvent* event)
+{
+ if (event->type() == QEvent::Polish) {
+ m_modeCombo->setFont(font());
+ }
+ return KHBox::event(event);
+}
+
+void DolphinFontRequester::openFontDialog()
+{
+ QFont font = m_customFont;
+ const int result = KFontDialog::getFont(font,
+ KFontChooser::NoDisplayFlags,
+ this);
+ if (result == KFontDialog::Accepted) {
+ m_customFont = font;
+ m_modeCombo->setFont(m_customFont);
+ emit changed();
+ }
+}
+
+void DolphinFontRequester::changeMode(int index)
+{
+ setMode((index == CustomFont) ? CustomFont : SystemFont);
+ emit changed();
+}
+
+#include "dolphinfontrequester.moc"
diff --git a/src/settings/viewmodes/dolphinfontrequester.h b/src/settings/viewmodes/dolphinfontrequester.h
new file mode 100644
index 000000000..03a062b2e
--- /dev/null
+++ b/src/settings/viewmodes/dolphinfontrequester.h
@@ -0,0 +1,79 @@
+/***************************************************************************
+ * Copyright (C) 2008 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 *
+ ***************************************************************************/
+
+#ifndef DOLPHINFONTREQUESTER_H
+#define DOLPHINFONTREQUESTER_H
+
+#include <khbox.h>
+
+#include <QFont>
+
+class KComboBox;
+class QPushButton;
+
+/**
+ * @brief Allows to select between using the system font or a custom font.
+ */
+class DolphinFontRequester : public KHBox
+{
+ Q_OBJECT
+
+public:
+ enum Mode
+ {
+ SystemFont = 0,
+ CustomFont = 1
+ };
+
+ DolphinFontRequester(QWidget* parent);
+ virtual ~DolphinFontRequester();
+
+ void setMode(Mode mode);
+ Mode mode() const;
+
+ /**
+ * Returns the custom font (see DolphinFontRequester::customFont()),
+ * if the mode is \a CustomFont, otherwise the system font is
+ * returned.
+ */
+ QFont font() const;
+
+ void setCustomFont(const QFont& font);
+ QFont customFont() const;
+
+signals:
+ /** Is emitted, if the font has been changed. */
+ void changed();
+
+protected:
+ bool event(QEvent* event);
+
+private slots:
+ void openFontDialog();
+ void changeMode(int index);
+
+private:
+ KComboBox* m_modeCombo;
+ QPushButton* m_chooseFontButton;
+
+ Mode m_mode;
+ QFont m_customFont;
+};
+
+#endif
diff --git a/src/settings/viewmodes/iconsizegroupbox.cpp b/src/settings/viewmodes/iconsizegroupbox.cpp
new file mode 100644
index 000000000..d8e0e889a
--- /dev/null
+++ b/src/settings/viewmodes/iconsizegroupbox.cpp
@@ -0,0 +1,119 @@
+/***************************************************************************
+ * Copyright (C) 2008 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 "iconsizegroupbox.h"
+
+#include <klocale.h>
+
+#include <QApplication>
+#include <QGridLayout>
+#include <QHelpEvent>
+#include <QLabel>
+#include <QPoint>
+#include <QRect>
+#include <QSlider>
+
+#include "zoomlevelinfo.h"
+
+IconSizeGroupBox::IconSizeGroupBox(QWidget* parent) :
+ QGroupBox(i18nc("@title:group", "Icon Size"), parent),
+ m_defaultSizeSlider(0),
+ m_previewSizeSlider(0)
+{
+ QLabel* defaultLabel = new QLabel(i18nc("@label:listbox", "Default:"), this);
+ m_defaultSizeSlider = new QSlider(Qt::Horizontal, this);
+ m_defaultSizeSlider->setPageStep(1);
+ m_defaultSizeSlider->setTickPosition(QSlider::TicksBelow);
+ connect(m_defaultSizeSlider, SIGNAL(valueChanged(int)),
+ this, SLOT(slotDefaultSliderMoved(int)));
+
+ QLabel* previewLabel = new QLabel(i18nc("@label:listbox", "Preview:"), this);
+ m_previewSizeSlider = new QSlider(Qt::Horizontal, this);
+ m_previewSizeSlider->setPageStep(1);
+ m_previewSizeSlider->setTickPosition(QSlider::TicksBelow);
+ connect(m_previewSizeSlider, SIGNAL(valueChanged(int)),
+ this, SLOT(slotPreviewSliderMoved(int)));
+
+ QGridLayout* layout = new QGridLayout(this);
+ layout->addWidget(defaultLabel, 0, 0, Qt::AlignRight);
+ layout->addWidget(m_defaultSizeSlider, 0, 1);
+ layout->addWidget(previewLabel, 1, 0, Qt::AlignRight);
+ layout->addWidget(m_previewSizeSlider, 1, 1);
+}
+
+IconSizeGroupBox::~IconSizeGroupBox()
+{
+}
+
+void IconSizeGroupBox::setDefaultSizeRange(int min, int max)
+{
+ m_defaultSizeSlider->setRange(min, max);
+}
+
+void IconSizeGroupBox::setPreviewSizeRange(int min, int max)
+{
+ m_previewSizeSlider->setRange(min, max);
+}
+
+void IconSizeGroupBox::setDefaultSizeValue(int value)
+{
+ m_defaultSizeSlider->setValue(value);
+}
+
+int IconSizeGroupBox::defaultSizeValue() const
+{
+ return m_defaultSizeSlider->value();
+}
+
+void IconSizeGroupBox::setPreviewSizeValue(int value)
+{
+ m_previewSizeSlider->setValue(value);
+}
+
+int IconSizeGroupBox::previewSizeValue() const
+{
+ return m_previewSizeSlider->value();
+}
+
+void IconSizeGroupBox::slotDefaultSliderMoved(int value)
+{
+ showToolTip(m_defaultSizeSlider, value);
+ emit defaultSizeChanged(value);
+}
+
+void IconSizeGroupBox::slotPreviewSliderMoved(int value)
+{
+ showToolTip(m_previewSizeSlider, value);
+ emit previewSizeChanged(value);
+}
+
+void IconSizeGroupBox::showToolTip(QSlider* slider, int value)
+{
+ const int size = ZoomLevelInfo::iconSizeForZoomLevel(value);
+ slider->setToolTip(i18ncp("@info:tooltip", "Size: 1 pixel", "Size: %1 pixels", size));
+ if (!slider->isVisible()) {
+ return;
+ }
+ QPoint global = slider->rect().topLeft();
+ global.ry() += slider->height() / 2;
+ QHelpEvent toolTipEvent(QEvent::ToolTip, QPoint(0, 0), slider->mapToGlobal(global));
+ QApplication::sendEvent(slider, &toolTipEvent);
+}
+
+#include "iconsizegroupbox.moc"
diff --git a/src/settings/viewmodes/iconsizegroupbox.h b/src/settings/viewmodes/iconsizegroupbox.h
new file mode 100644
index 000000000..3ec51c3a5
--- /dev/null
+++ b/src/settings/viewmodes/iconsizegroupbox.h
@@ -0,0 +1,66 @@
+/***************************************************************************
+ * Copyright (C) 2008 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 *
+ ***************************************************************************/
+
+#ifndef ICONSIZEGROUPBOX_H
+#define ICONSIZEGROUPBOX_H
+
+#include <QGroupBox>
+
+class QSlider;
+
+/**
+ * @short Provides a group box for adjusting the icon sizes.
+ *
+ * It is possible to adjust the default icon size and the icon
+ * size when previews are used.
+ */
+class IconSizeGroupBox : public QGroupBox
+{
+ Q_OBJECT
+
+public:
+ explicit IconSizeGroupBox(QWidget* parent);
+ virtual ~IconSizeGroupBox();
+
+ void setDefaultSizeRange(int min, int max);
+ void setPreviewSizeRange(int min, int max);
+
+ void setDefaultSizeValue(int value);
+ int defaultSizeValue() const;
+
+ void setPreviewSizeValue(int value);
+ int previewSizeValue() const;
+
+signals:
+ void defaultSizeChanged(int value);
+ void previewSizeChanged(int value);
+
+private slots:
+ void slotDefaultSliderMoved(int value);
+ void slotPreviewSliderMoved(int value);
+
+private:
+ void showToolTip(QSlider* slider, int value);
+
+private:
+ QSlider* m_defaultSizeSlider;
+ QSlider* m_previewSizeSlider;
+};
+
+#endif
diff --git a/src/settings/viewmodes/iconsviewsettingspage.cpp b/src/settings/viewmodes/iconsviewsettingspage.cpp
new file mode 100644
index 000000000..059a4a846
--- /dev/null
+++ b/src/settings/viewmodes/iconsviewsettingspage.cpp
@@ -0,0 +1,247 @@
+/***************************************************************************
+ * 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 "iconsviewsettingspage.h"
+
+#include "dolphinfontrequester.h"
+#include "settings/dolphinsettings.h"
+#include "iconsizegroupbox.h"
+#include "zoomlevelinfo.h"
+
+#include "dolphin_iconsmodesettings.h"
+
+#include <kdialog.h>
+#include <kiconloader.h>
+#include <kglobalsettings.h>
+#include <klocale.h>
+#include <kcombobox.h>
+#include <KNumInput>
+
+#include <QCheckBox>
+#include <QGroupBox>
+#include <QLabel>
+#include <QListView>
+#include <QPushButton>
+#include <QGridLayout>
+#include <QVBoxLayout>
+
+IconsViewSettingsPage::IconsViewSettingsPage(QWidget* parent) :
+ ViewSettingsPageBase(parent),
+ m_iconSizeGroupBox(0),
+ m_textWidthBox(0),
+ m_fontRequester(0),
+ m_textlinesCountBox(0),
+ m_arrangementBox(0),
+ m_gridSpacingBox(0)
+{
+ const int spacing = KDialog::spacingHint();
+ const int margin = KDialog::marginHint();
+ const QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
+
+ setSpacing(spacing);
+ setMargin(margin);
+
+ // Create "Icon" properties
+ m_iconSizeGroupBox = new IconSizeGroupBox(this);
+ m_iconSizeGroupBox->setSizePolicy(sizePolicy);
+
+ const int min = ZoomLevelInfo::minimumLevel();
+ const int max = ZoomLevelInfo::maximumLevel();
+ m_iconSizeGroupBox->setDefaultSizeRange(min, max);
+ m_iconSizeGroupBox->setPreviewSizeRange(min, max);
+
+ connect(m_iconSizeGroupBox, SIGNAL(defaultSizeChanged(int)),
+ this, SIGNAL(changed()));
+ connect(m_iconSizeGroupBox, SIGNAL(previewSizeChanged(int)),
+ this, SIGNAL(changed()));
+
+ // create 'Text' group for selecting the font, the number of lines
+ // and the text width
+ QGroupBox* textGroup = new QGroupBox(i18nc("@title:group", "Text"), this);
+ textGroup->setSizePolicy(sizePolicy);
+
+ QLabel* fontLabel = new QLabel(i18nc("@label:listbox", "Font:"), textGroup);
+ m_fontRequester = new DolphinFontRequester(textGroup);
+ connect(m_fontRequester, SIGNAL(changed()), this, SIGNAL(changed()));
+
+ QLabel* textlinesCountLabel = new QLabel(i18nc("@label:textbox", "Number of lines:"), textGroup);
+ m_textlinesCountBox = new KIntSpinBox(textGroup);
+ m_textlinesCountBox->setMinimum(1);
+ m_textlinesCountBox->setMaximum(5);
+ connect(m_textlinesCountBox, SIGNAL(valueChanged(int)), this, SIGNAL(changed()));
+
+ QLabel* textWidthLabel = new QLabel(i18nc("@label:listbox", "Text width:"), textGroup);
+ m_textWidthBox = new KComboBox(textGroup);
+ m_textWidthBox->addItem(i18nc("@item:inlistbox Text width", "Small"));
+ m_textWidthBox->addItem(i18nc("@item:inlistbox Text width", "Medium"));
+ m_textWidthBox->addItem(i18nc("@item:inlistbox Text width", "Large"));
+ m_textWidthBox->addItem(i18nc("@item:inlistbox Text width", "Huge"));
+ connect(m_textWidthBox, SIGNAL(currentIndexChanged(int)), this, SIGNAL(changed()));
+
+ QGridLayout* textGroupLayout = new QGridLayout(textGroup);
+ textGroupLayout->addWidget(fontLabel, 0, 0, Qt::AlignRight);
+ textGroupLayout->addWidget(m_fontRequester, 0, 1);
+ textGroupLayout->addWidget(textlinesCountLabel, 1, 0, Qt::AlignRight);
+ textGroupLayout->addWidget(m_textlinesCountBox, 1, 1);
+ textGroupLayout->addWidget(textWidthLabel, 2, 0, Qt::AlignRight);
+ textGroupLayout->addWidget(m_textWidthBox, 2, 1);
+
+ // create the 'Grid' group for selecting the arrangement and the grid spacing
+ QGroupBox* gridGroup = new QGroupBox(i18nc("@title:group", "Grid"), this);
+ gridGroup->setSizePolicy(sizePolicy);
+
+ QLabel* arrangementLabel = new QLabel(i18nc("@label:listbox", "Arrangement:"), gridGroup);
+ m_arrangementBox = new KComboBox(gridGroup);
+ m_arrangementBox->addItem(i18nc("@item:inlistbox Arrangement", "Columns"));
+ m_arrangementBox->addItem(i18nc("@item:inlistbox Arrangement", "Rows"));
+ connect(m_arrangementBox, SIGNAL(currentIndexChanged(int)), this, SIGNAL(changed()));
+
+ QLabel* gridSpacingLabel = new QLabel(i18nc("@label:listbox", "Grid spacing:"), gridGroup);
+ m_gridSpacingBox = new KComboBox(gridGroup);
+ m_gridSpacingBox->addItem(i18nc("@item:inlistbox Grid spacing", "None"));
+ m_gridSpacingBox->addItem(i18nc("@item:inlistbox Grid spacing", "Small"));
+ m_gridSpacingBox->addItem(i18nc("@item:inlistbox Grid spacing", "Medium"));
+ m_gridSpacingBox->addItem(i18nc("@item:inlistbox Grid spacing", "Large"));
+ connect(m_gridSpacingBox, SIGNAL(currentIndexChanged(int)), this, SIGNAL(changed()));
+
+ QGridLayout* gridGroupLayout = new QGridLayout(gridGroup);
+ gridGroupLayout->addWidget(arrangementLabel, 0, 0, Qt::AlignRight);
+ gridGroupLayout->addWidget(m_arrangementBox, 0, 1);
+ gridGroupLayout->addWidget(gridSpacingLabel, 1, 0, Qt::AlignRight);
+ gridGroupLayout->addWidget(m_gridSpacingBox, 1, 1);
+
+ // Add a dummy widget with no restriction regarding
+ // a vertical resizing. This assures that the dialog layout
+ // is not stretched vertically.
+ new QWidget(this);
+
+ loadSettings();
+}
+
+IconsViewSettingsPage::~IconsViewSettingsPage()
+{
+}
+
+void IconsViewSettingsPage::applySettings()
+{
+ IconsModeSettings* settings = DolphinSettings::instance().iconsModeSettings();
+
+ const int iconSize = ZoomLevelInfo::iconSizeForZoomLevel(m_iconSizeGroupBox->defaultSizeValue());
+ const int previewSize = ZoomLevelInfo::iconSizeForZoomLevel(m_iconSizeGroupBox->previewSizeValue());
+ settings->setIconSize(iconSize);
+ settings->setPreviewSize(previewSize);
+
+ const QFont font = m_fontRequester->font();
+ const int fontHeight = QFontMetrics(font).height();
+
+ const int arrangement = (m_arrangementBox->currentIndex() == 0) ?
+ QListView::LeftToRight :
+ QListView::TopToBottom;
+ settings->setArrangement(arrangement);
+
+ const int numberOfTextlines = m_textlinesCountBox->value();
+
+ const int defaultSize = settings->iconSize();
+ int itemWidth = defaultSize;
+ int itemHeight = defaultSize;
+ const int textSizeIndex = m_textWidthBox->currentIndex();
+ if (arrangement == QListView::TopToBottom) {
+ itemWidth += TopToBottomBase + textSizeIndex * TopToBottomInc;
+ itemHeight += fontHeight * numberOfTextlines + 10;
+ } else {
+ itemWidth += LeftToRightBase + textSizeIndex * LeftToRightInc;
+ }
+
+ settings->setItemWidth(itemWidth);
+ settings->setItemHeight(itemHeight);
+
+ settings->setUseSystemFont(m_fontRequester->mode() == DolphinFontRequester::SystemFont);
+ settings->setFontFamily(font.family());
+ settings->setFontSize(font.pointSizeF());
+ settings->setItalicFont(font.italic());
+ settings->setFontWeight(font.weight());
+
+ settings->setNumberOfTextlines(numberOfTextlines);
+
+ const int index = m_gridSpacingBox->currentIndex();
+ if (index == 0) {
+ // No grid spacing
+ settings->setGridSpacing(0);
+ } else {
+ settings->setGridSpacing(GridSpacingBase + (index - 1) * GridSpacingInc);
+ }
+
+ settings->writeConfig();
+}
+
+void IconsViewSettingsPage::restoreDefaults()
+{
+ IconsModeSettings* settings = DolphinSettings::instance().iconsModeSettings();
+ settings->useDefaults(true);
+ loadSettings();
+ settings->useDefaults(false);
+}
+
+void IconsViewSettingsPage::loadSettings()
+{
+ IconsModeSettings* settings = DolphinSettings::instance().iconsModeSettings();
+
+ const QSize iconSize(settings->iconSize(), settings->iconSize());
+ const int iconSizeValue = ZoomLevelInfo::zoomLevelForIconSize(iconSize);
+ m_iconSizeGroupBox->setDefaultSizeValue(iconSizeValue);
+
+ const QSize previewSize(settings->previewSize(), settings->previewSize());
+ const int previewSizeValue = ZoomLevelInfo::zoomLevelForIconSize(previewSize);
+ m_iconSizeGroupBox->setPreviewSizeValue(previewSizeValue);
+
+ if (settings->useSystemFont()) {
+ m_fontRequester->setMode(DolphinFontRequester::SystemFont);
+ } else {
+ QFont font(settings->fontFamily(),
+ qRound(settings->fontSize()));
+ font.setItalic(settings->italicFont());
+ font.setWeight(settings->fontWeight());
+ font.setPointSizeF(settings->fontSize());
+ m_fontRequester->setMode(DolphinFontRequester::CustomFont);
+ m_fontRequester->setCustomFont(font);
+ }
+
+ m_textlinesCountBox->setValue(settings->numberOfTextlines());
+
+ const bool leftToRightArrangement = (settings->arrangement() == QListView::LeftToRight);
+ int textWidthIndex = 0;
+ const int remainingWidth = settings->itemWidth() - settings->iconSize();
+ if (leftToRightArrangement) {
+ textWidthIndex = (remainingWidth - LeftToRightBase) / LeftToRightInc;
+ } else {
+ textWidthIndex = (remainingWidth - TopToBottomBase) / TopToBottomInc;
+ }
+ // ensure that chosen index is always valid
+ textWidthIndex = qMax(textWidthIndex, 0);
+ textWidthIndex = qMin(textWidthIndex, m_textWidthBox->count() - 1);
+
+ m_textWidthBox->setCurrentIndex(textWidthIndex);
+ m_arrangementBox->setCurrentIndex(leftToRightArrangement ? 0 : 1);
+
+ const int spacing = settings->gridSpacing();
+ const int index = (spacing <= 0) ? 0 : 1 + (spacing - GridSpacingBase) / GridSpacingInc;
+ m_gridSpacingBox->setCurrentIndex(index);
+}
+
+#include "iconsviewsettingspage.moc"
diff --git a/src/settings/viewmodes/iconsviewsettingspage.h b/src/settings/viewmodes/iconsviewsettingspage.h
new file mode 100644
index 000000000..17fda4e26
--- /dev/null
+++ b/src/settings/viewmodes/iconsviewsettingspage.h
@@ -0,0 +1,87 @@
+/***************************************************************************
+ * 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 *
+ ***************************************************************************/
+
+#ifndef ICONSVIEWSETTINGSPAGE_H
+#define ICONSVIEWSETTINGSPAGE_H
+
+#include <dolphiniconsview.h>
+#include "viewsettingspagebase.h"
+
+class DolphinFontRequester;
+class IconSizeGroupBox;
+class KComboBox;
+class KIntSpinBox;
+
+/**
+ * @brief Tab page for the 'Icons Mode' settings
+ * of the Dolphin settings dialog.
+ *
+ * Allows to set:
+ * - icon size
+ * - preview size
+ * - text width
+ * - grid spacing
+ * - font
+ * - number of text lines
+ * - arrangement
+ *
+ * @see DolphinIconsViewSettings
+ */
+class IconsViewSettingsPage : public ViewSettingsPageBase
+{
+ Q_OBJECT
+
+public:
+ IconsViewSettingsPage(QWidget* parent);
+ virtual ~IconsViewSettingsPage();
+
+ /**
+ * Applies the settings for the icons view.
+ * The settings are persisted automatically when
+ * closing Dolphin.
+ */
+ virtual void applySettings();
+
+ /** Restores the settings to default values. */
+ virtual void restoreDefaults();
+
+private:
+ void loadSettings();
+
+private:
+ enum
+ {
+ GridSpacingBase = 8,
+ GridSpacingInc = 12,
+ LeftToRightBase = 128,
+ LeftToRightInc = 64,
+ TopToBottomBase = 32,
+ TopToBottomInc = 32
+ };
+
+ IconSizeGroupBox* m_iconSizeGroupBox;
+ KComboBox* m_textWidthBox;
+ DolphinFontRequester* m_fontRequester;
+ KIntSpinBox* m_textlinesCountBox;
+
+ KComboBox* m_arrangementBox;
+ KComboBox* m_gridSpacingBox;
+};
+
+#endif
diff --git a/src/settings/viewmodes/viewsettingspage.cpp b/src/settings/viewmodes/viewsettingspage.cpp
new file mode 100644
index 000000000..deb7a31bb
--- /dev/null
+++ b/src/settings/viewmodes/viewsettingspage.cpp
@@ -0,0 +1,84 @@
+/***************************************************************************
+ * Copyright (C) 2006 by Peter Penz *
+ * *
+ * 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 "viewsettingspage.h"
+
+#include "columnviewsettingspage.h"
+#include "iconsviewsettingspage.h"
+#include "detailsviewsettingspage.h"
+
+#include <QVBoxLayout>
+
+#include <kdialog.h>
+#include <klocale.h>
+#include <kiconloader.h>
+#include <ktabwidget.h>
+
+ViewSettingsPage::ViewSettingsPage(QWidget* parent) :
+ SettingsPageBase(parent),
+ m_pages()
+{
+ QVBoxLayout* topLayout = new QVBoxLayout(this);
+ topLayout->setMargin(0);
+ topLayout->setSpacing(KDialog::spacingHint());
+
+ KTabWidget* tabWidget = new KTabWidget(this);
+
+ // initialize 'Icons' tab
+ IconsViewSettingsPage* iconsPage = new IconsViewSettingsPage(tabWidget);
+ tabWidget->addTab(iconsPage, KIcon("view-list-icons"), i18nc("@title:tab", "Icons"));
+ connect(iconsPage, SIGNAL(changed()), this, SIGNAL(changed()));
+
+ // initialize 'Details' tab
+ DetailsViewSettingsPage* detailsPage = new DetailsViewSettingsPage(tabWidget);
+ tabWidget->addTab(detailsPage, KIcon("view-list-details"), i18nc("@title:tab", "Details"));
+ connect(detailsPage, SIGNAL(changed()), this, SIGNAL(changed()));
+
+ // initialize 'Column' tab
+ ColumnViewSettingsPage* columnPage = new ColumnViewSettingsPage(tabWidget);
+ tabWidget->addTab(columnPage, KIcon("view-file-columns"), i18nc("@title:tab", "Column"));
+ connect(columnPage, SIGNAL(changed()), this, SIGNAL(changed()));
+
+ m_pages.append(iconsPage);
+ m_pages.append(detailsPage);
+ m_pages.append(columnPage);
+
+ topLayout->addWidget(tabWidget, 0, 0);
+}
+
+ViewSettingsPage::~ViewSettingsPage()
+{
+}
+
+void ViewSettingsPage::applySettings()
+{
+ foreach (ViewSettingsPageBase* page, m_pages) {
+ page->applySettings();
+ }
+}
+
+void ViewSettingsPage::restoreDefaults()
+{
+ foreach (ViewSettingsPageBase* page, m_pages) {
+ page->restoreDefaults();
+ }
+}
+
+#include "viewsettingspage.moc"
diff --git a/src/settings/viewmodes/viewsettingspage.h b/src/settings/viewmodes/viewsettingspage.h
new file mode 100644
index 000000000..56e9f910d
--- /dev/null
+++ b/src/settings/viewmodes/viewsettingspage.h
@@ -0,0 +1,52 @@
+/***************************************************************************
+ * Copyright (C) 2006 by Peter Penz *
+ * *
+ * 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 *
+ ***************************************************************************/
+#ifndef VIEWSETTINGSPAGE_H
+#define VIEWSETTINGSPAGE_H
+
+#include <settings/settingspagebase.h>
+
+class ViewSettingsPageBase;
+class QWidget;
+
+/**
+ * @brief Page for the 'View' settings of the Dolphin settings dialog.
+ *
+ * The views settings allow to set the properties for the icons mode,
+ * the details mode and the column mode.
+ */
+class ViewSettingsPage : public SettingsPageBase
+{
+ Q_OBJECT
+
+public:
+ ViewSettingsPage(QWidget* parent);
+ virtual ~ViewSettingsPage();
+
+ /** @see SettingsPageBase::applySettings() */
+ virtual void applySettings();
+
+ /** @see SettingsPageBase::restoreDefaults() */
+ virtual void restoreDefaults();
+
+private:
+ QList<ViewSettingsPageBase*> m_pages;
+};
+
+#endif
diff --git a/src/settings/viewmodes/viewsettingspagebase.cpp b/src/settings/viewmodes/viewsettingspagebase.cpp
new file mode 100644
index 000000000..b610bb0f5
--- /dev/null
+++ b/src/settings/viewmodes/viewsettingspagebase.cpp
@@ -0,0 +1,31 @@
+/***************************************************************************
+ * Copyright (C) 2008 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 "viewsettingspagebase.h"
+
+ViewSettingsPageBase::ViewSettingsPageBase(QWidget* parent) :
+ KVBox(parent)
+{
+}
+
+ViewSettingsPageBase::~ViewSettingsPageBase()
+{
+}
+
+#include "viewsettingspagebase.moc"
diff --git a/src/settings/viewmodes/viewsettingspagebase.h b/src/settings/viewmodes/viewsettingspagebase.h
new file mode 100644
index 000000000..3e85e25cb
--- /dev/null
+++ b/src/settings/viewmodes/viewsettingspagebase.h
@@ -0,0 +1,55 @@
+/***************************************************************************
+ * Copyright (C) 2008 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 *
+ ***************************************************************************/
+
+#ifndef VIEWSETTINGSPAGEBASE_H
+#define VIEWSETTINGSPAGEBASE_H
+
+#include <kvbox.h>
+
+/**
+ * @brief Base class for view settings configuration pages.
+ *
+ * @see GeneralViewSettingsPage;
+ * @see IconViewSettingsPage
+ * @see DetailsViewSettingsPage
+ * @see ColumnViewSettingsPage
+ */
+class ViewSettingsPageBase : public KVBox
+{
+ Q_OBJECT
+
+public:
+ ViewSettingsPageBase(QWidget* parent);
+ virtual ~ViewSettingsPageBase();
+
+ /**
+ * Applies the settings for the view.
+ * The settings are persisted automatically when
+ * closing Dolphin.
+ */
+ virtual void applySettings() = 0;
+
+ /** Restores the settings to default values. */
+ virtual void restoreDefaults() = 0;
+
+signals:
+ void changed();
+};
+
+#endif