diff options
| author | Peter Penz <[email protected]> | 2007-02-27 20:46:21 +0000 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2007-02-27 20:46:21 +0000 |
| commit | f8dd060cadecd9f4c36b79d53dbae706dadf99f6 (patch) | |
| tree | ecc4dbc1066658782ead831fae94b6b8ccde1c36 /src/dolphiniconsview.cpp | |
| parent | 6c4e3aee2a65969d25813d9809bffca23fbe18d3 (diff) | |
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
Diffstat (limited to 'src/dolphiniconsview.cpp')
| -rw-r--r-- | src/dolphiniconsview.cpp | 39 |
1 files changed, 23 insertions, 16 deletions
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 <assert.h> #include <kdirmodel.h> @@ -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) |
