From f8dd060cadecd9f4c36b79d53dbae706dadf99f6 Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Tue, 27 Feb 2007 20:46:21 +0000 Subject: The icons view and details view don't use hardcoded (test-) values anymore, instead the settings for fonts, grid size, ... are read out. The settings dialogs itself will be reworked later if it is clear what should be configurable in which manner. At least the current settings dialog allows to play with the new capabilities we got by KFileItemDelegate, just lets see what we can improve later on... svn path=/trunk/KDE/kdebase/apps/; revision=637792 --- src/dolphiniconsview.cpp | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) (limited to 'src/dolphiniconsview.cpp') diff --git a/src/dolphiniconsview.cpp b/src/dolphiniconsview.cpp index 0f619ff30..71bf7c76f 100644 --- a/src/dolphiniconsview.cpp +++ b/src/dolphiniconsview.cpp @@ -20,6 +20,9 @@ #include "dolphiniconsview.h" #include "dolphincontroller.h" +#include "dolphinsettings.h" + +#include "dolphin_iconsmodesettings.h" #include #include @@ -32,15 +35,29 @@ DolphinIconsView::DolphinIconsView(QWidget* parent, DolphinController* controlle m_controller(controller) { assert(controller != 0); - setResizeMode(QListView::Adjust); - // TODO: read out settings - setViewMode(QListView::IconMode); - setGridSize(QSize(128, 96)); - connect(this, SIGNAL(clicked(const QModelIndex&)), controller, SLOT(triggerItem(const QModelIndex&))); + + // apply the icons mode settings to the widget + const IconsModeSettings* settings = DolphinSettings::instance().iconsModeSettings(); + assert(settings != 0); + + if (settings->arrangement() == QListView::TopToBottom) { + setViewMode(QListView::IconMode); + } + else { + setViewMode(QListView::ListMode); + } + + setGridSize(QSize(settings->gridWidth(), settings->gridHeight())); + setSpacing(settings->gridSpacing()); + + m_viewOptions = QListView::viewOptions(); + m_viewOptions.font = QFont(settings->fontFamily(), settings->fontSize()); + const int iconSize = settings->iconSize(); + m_viewOptions.decorationSize = QSize(iconSize, iconSize); } DolphinIconsView::~DolphinIconsView() @@ -49,17 +66,7 @@ DolphinIconsView::~DolphinIconsView() QStyleOptionViewItem DolphinIconsView::viewOptions() const { - return QListView::viewOptions(); - - // TODO: the view options should been read from the settings; - // the following code is just for testing... - //QStyleOptionViewItem options = QListView::viewOptions(); - //options.decorationAlignment = Qt::AlignRight; - //options.decorationPosition = QStyleOptionViewItem::Right; - //options.decorationSize = QSize(100, 100); - //options.showDecorationSelected = true; - //options.state = QStyle::State_MouseOver; - //return options; + return m_viewOptions; } void DolphinIconsView::contextMenuEvent(QContextMenuEvent* event) -- cgit v1.3