]> cloud.milkyroute.net Git - dolphin.git/commitdiff
A few more fixes...mostly cleanups.
authorShaun Reich <shaun.reich@kdemail.net>
Mon, 2 Feb 2009 22:23:06 +0000 (22:23 +0000)
committerShaun Reich <shaun.reich@kdemail.net>
Mon, 2 Feb 2009 22:23:06 +0000 (22:23 +0000)
*Grouped some statements that it didn't make sense to put after a certain block of code (giving the impression that it had to be after this block).
*There is no need to set the value of the QSpinBox equal to that of the slider, when loading settings... their valueChanges() signals are connected to the opposite one's slot.
*Made a now unused variable be used, it was inconsistent in this code block, two times '1' was used, but other times a var set to '1' would be used.
*Moved some blocks of code from the loadSettings() method, into the constructor, since the loadSettings() method is called more than once, so it's more resource-friendly to do it this way.

svn path=/trunk/KDE/kdebase/apps/; revision=920441

src/settings/previewssettingspage.cpp

index 524ff487d8ebd6c76f6b67d880784905a1d739d5..0d3263bb7a6238437578316938482eabea07033b 100644 (file)
@@ -57,10 +57,12 @@ PreviewsSettingsPage::PreviewsSettingsPage(QWidget* parent) :
     m_maxPreviewSize->setPageStep(10);
     m_maxPreviewSize->setSingleStep(1);
     m_maxPreviewSize->setTickPosition(QSlider::TicksBelow);
+    m_maxPreviewSize->setRange(1, 100); /* MB */
 
     m_spinBox = new QSpinBox(hBox);
     m_spinBox->setSingleStep(1);
     m_spinBox->setSuffix(" MB");
+    m_spinBox->setRange(1, 100); /* MB */
 
     connect(m_maxPreviewSize, SIGNAL(valueChanged(int)),
             m_spinBox, SLOT(setValue(int)));
@@ -113,7 +115,6 @@ void PreviewsSettingsPage::loadSettings()
 {
     const int min = 1;   // MB
     const int max = 100; // MB
-    m_maxPreviewSize->setRange(min, max);
 
     KConfigGroup globalConfig(KGlobal::config(), "PreviewSettings");
     // TODO: The default value of 5 MB must match with the default value inside
@@ -121,15 +122,12 @@ void PreviewsSettingsPage::loadSettings()
     // should be added for getting the default size?
     const int maxByteSize = globalConfig.readEntry("MaximumSize", 5 * 1024 * 1024 /* 5 MB */);
     int maxMByteSize = maxByteSize / (1024 * 1024);
-    if (maxMByteSize < 1) {
-        maxMByteSize = 1;
+    if (maxMByteSize < min) {
+        maxMByteSize = min;
     } else if (maxMByteSize > max) {
         maxMByteSize = max;
     }
-    m_spinBox->setRange(min, max);
-
     m_maxPreviewSize->setValue(maxMByteSize);
-    m_spinBox->setValue(m_maxPreviewSize->value());
 
     const bool useFileThumbnails = globalConfig.readEntry("UseFileThumbnails", true);
     m_useFileThumbnails->setChecked(useFileThumbnails);