*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
m_maxPreviewSize->setPageStep(10);
m_maxPreviewSize->setSingleStep(1);
m_maxPreviewSize->setTickPosition(QSlider::TicksBelow);
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 = 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)));
connect(m_maxPreviewSize, SIGNAL(valueChanged(int)),
m_spinBox, SLOT(setValue(int)));
{
const int min = 1; // MB
const int max = 100; // MB
{
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
KConfigGroup globalConfig(KGlobal::config(), "PreviewSettings");
// TODO: The default value of 5 MB must match with the default value inside
// should be added for getting the default size?
const int maxByteSize = globalConfig.readEntry("MaximumSize", 5 * 1024 * 1024 /* 5 MB */);
int maxMByteSize = maxByteSize / (1024 * 1024);
// 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;
}
} else if (maxMByteSize > max) {
maxMByteSize = max;
}
- m_spinBox->setRange(min, max);
-
m_maxPreviewSize->setValue(maxMByteSize);
m_maxPreviewSize->setValue(maxMByteSize);
- m_spinBox->setValue(m_maxPreviewSize->value());
const bool useFileThumbnails = globalConfig.readEntry("UseFileThumbnails", true);
m_useFileThumbnails->setChecked(useFileThumbnails);
const bool useFileThumbnails = globalConfig.readEntry("UseFileThumbnails", true);
m_useFileThumbnails->setChecked(useFileThumbnails);