From: Shaun Reich Date: Mon, 2 Feb 2009 22:23:06 +0000 (+0000) Subject: A few more fixes...mostly cleanups. X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/a8d577ff2d5bfb74707538a4a50058d957164f40?ds=inline A few more fixes...mostly cleanups. *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 --- diff --git a/src/settings/previewssettingspage.cpp b/src/settings/previewssettingspage.cpp index 524ff487d..0d3263bb7 100644 --- a/src/settings/previewssettingspage.cpp +++ b/src/settings/previewssettingspage.cpp @@ -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);