]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/generalviewsettingspage.cpp
You need >> or either the "Your names" and "Your messages" placeholders for translato...
[dolphin.git] / src / generalviewsettingspage.cpp
index 61439d323e1eb49c1d5c68b3508b31d91bea50e0..2d815d3d20274995a083d10e901ed3ae6137c5bc 100644 (file)
@@ -25,8 +25,9 @@
 
 #include "dolphin_generalsettings.h"
 
-#include <QLabel>
+#include <QCheckBox>
 #include <QGroupBox>
+#include <QLabel>
 #include <QRadioButton>
 #include <QSlider>
 #include <QSpinBox>
@@ -45,7 +46,8 @@ GeneralViewSettingsPage::GeneralViewSettingsPage(DolphinMainWindow* mainWindow,
     m_localProps(0),
     m_globalProps(0),
     m_maxPreviewSize(0),
-    m_spinBox(0)
+    m_spinBox(0),
+    m_useFileThumbnails(0)
 {
     const int spacing = KDialog::spacingHint();
     const int margin = KDialog::marginHint();
@@ -66,10 +68,10 @@ GeneralViewSettingsPage::GeneralViewSettingsPage(DolphinMainWindow* mainWindow,
     // create 'File Previews' box
     QGroupBox* previewBox = new QGroupBox(i18nc("@title:group", "File Previews"), this);
 
-    QLabel* maxFileSize = new QLabel(i18n("Maximum file size:"), previewBox);
-
     KHBox* vBox = new KHBox(previewBox);
     vBox->setSpacing(spacing);
+
+    QLabel* maxFileSize = new QLabel(i18nc("@label:slider", "Maximum file size:"), vBox);
     m_maxPreviewSize = new QSlider(Qt::Horizontal, vBox);
 
     m_spinBox = new QSpinBox(vBox);
@@ -79,9 +81,11 @@ GeneralViewSettingsPage::GeneralViewSettingsPage(DolphinMainWindow* mainWindow,
     connect(m_spinBox, SIGNAL(valueChanged(int)),
             m_maxPreviewSize, SLOT(setValue(int)));
 
+    m_useFileThumbnails = new QCheckBox(i18n("Use thumbnails embedded in files"), previewBox);
+
     QVBoxLayout* previewBoxLayout = new QVBoxLayout(previewBox);
-    previewBoxLayout->addWidget(maxFileSize);
     previewBoxLayout->addWidget(vBox);
+    previewBoxLayout->addWidget(m_useFileThumbnails);
 
     // Add a dummy widget with no restriction regarding
     // a vertical resizing. This assures that the dialog layout
@@ -94,10 +98,6 @@ GeneralViewSettingsPage::GeneralViewSettingsPage(DolphinMainWindow* mainWindow,
 
 GeneralViewSettingsPage::~GeneralViewSettingsPage()
 {
-    GeneralSettings* settings = DolphinSettings::instance().generalSettings();
-    settings->setDefaults();
-
-    loadSettings();
 }
 
 void GeneralViewSettingsPage::applySettings()
@@ -124,6 +124,9 @@ void GeneralViewSettingsPage::applySettings()
     globalConfig.writeEntry("MaximumSize",
                             byteCount,
                             KConfigBase::Normal | KConfigBase::Global);
+    globalConfig.writeEntry("UseFileThumbnails",
+                            m_useFileThumbnails->isChecked(),
+                            KConfigBase::Normal | KConfigBase::Global);
     globalConfig.sync();
 }
 
@@ -151,19 +154,23 @@ void GeneralViewSettingsPage::loadSettings()
     m_maxPreviewSize->setTickPosition(QSlider::TicksBelow);
 
     KConfigGroup globalConfig(KGlobal::config(), "PreviewSettings");
-    const int maxByteSize = globalConfig.readEntry("MaximumSize", 1024 * 1024 /* 1 MB */);
+    const int maxByteSize = globalConfig.readEntry("MaximumSize", 5 * 1024 * 1024 /* 5 MB */);
     int maxMByteSize = maxByteSize / (1024 * 1024);
     if (maxMByteSize < 1) {
         maxMByteSize = 1;
     } else if (maxMByteSize > max) {
         maxMByteSize = max;
     }
-    m_maxPreviewSize->setValue(maxMByteSize);
 
     m_spinBox->setRange(min, max);
     m_spinBox->setSingleStep(1);
     m_spinBox->setSuffix(" MB");
+
+    m_maxPreviewSize->setValue(maxMByteSize);
     m_spinBox->setValue(m_maxPreviewSize->value());
+
+    const bool useFileThumbnails = globalConfig.readEntry("UseFileThumbnails", true);
+    m_useFileThumbnails->setChecked(useFileThumbnails);
 }
 
 #include "generalviewsettingspage.moc"