]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/iconsviewsettingspage.cpp
Jippie: file previews are generated again! Thanks to Fredrik for giving me a hint...
[dolphin.git] / src / iconsviewsettingspage.cpp
index 3433e8532187117eda68819d700ee46bb583df55..743ca936b7a2c363dd72a2a3fbe32173d937d545 100644 (file)
 #include <klocale.h>
 #include <kvbox.h>
 
+#include <QListView>
+
 #define GRID_SPACING_BASE 8
-#define GRID_SPACING_INC 12
+#define GRID_SPACING_INC 24
 
 IconsViewSettingsPage::IconsViewSettingsPage(DolphinMainWindow* mainWindow,
                                              QWidget* parent) :
@@ -148,7 +150,7 @@ IconsViewSettingsPage::IconsViewSettingsPage(DolphinMainWindow* mainWindow,
     gridGroup->setSizePolicy(sizePolicy);
     gridGroup->setMargin(margin);
 
-    const bool leftToRightArrangement = (settings->arrangement() == "LeftToRight");
+    const bool leftToRightArrangement = (settings->arrangement() == QListView::LeftToRight);
     new QLabel(i18n("Arrangement:"), gridGroup);
     m_arrangementBox = new QComboBox(gridGroup);
     m_arrangementBox->addItem(i18n("Left to right"));
@@ -182,9 +184,7 @@ void IconsViewSettingsPage::applySettings()
     const int defaultSize = iconSize(m_iconSizeSlider->value());
     settings->setIconSize(defaultSize);
 
-    int previewSize = //(m_mode == DolphinIconsView::Previews) ?
-                      //iconSize(m_previewSizeSlider->value()) :
-                      defaultSize;
+    int previewSize = iconSize(m_previewSizeSlider->value());
     if (previewSize < defaultSize) {
         // assure that the preview size is never smaller than the icon size
         previewSize = defaultSize;
@@ -193,11 +193,26 @@ void IconsViewSettingsPage::applySettings()
 
     const int fontSize = m_fontSizeBox->value();
 
-    QString arrangement = (m_arrangementBox->currentIndex() == 0) ?
-                          "LeftToRight" :
-                          "TopToBottom";
+    const int arrangement = (m_arrangementBox->currentIndex() == 0) ?
+                            QListView::LeftToRight :
+                            QListView::TopToBottom;
+
     settings->setArrangement(arrangement);
-    //DolphinSettings::instance().calculateGridSize(m_textWidthBox->currentIndex());
+
+    // TODO: this is just a very rough testing code to calculate the grid
+    // width and height
+    int gridWidth = defaultSize;
+    int gridHeight = defaultSize;
+    if (arrangement == QListView::TopToBottom) {
+        gridWidth += 96;
+        gridHeight += 64;
+    }
+    else {
+        gridWidth += 256;
+    }
+
+    settings->setGridWidth(gridWidth);
+    settings->setGridHeight(gridHeight);
 
     settings->setFontFamily(m_fontFamilyBox->currentFont().family());
     settings->setFontSize(fontSize);