DatabaseSettingsWidget improvements.

Merge checkboxes with labels.
Set max. history size in MiB instead of bytes.
This commit is contained in:
Felix Geyer 2012-05-19 15:04:05 +02:00
parent fef931392f
commit f1ad94b472
2 changed files with 27 additions and 34 deletions

View File

@ -61,8 +61,9 @@ void DatabaseSettingsWidget::load(Database* db)
m_ui->historyMaxItemsSpinBox->setValue(Metadata::DefaultHistoryMaxItems);
m_ui->historyMaxItemsCheckBox->setChecked(false);
}
if (meta->historyMaxSize() > -1) {
m_ui->historyMaxSizeSpinBox->setValue(meta->historyMaxSize());
int historyMaxSizeMiB = qRound(meta->historyMaxSize() / qreal(1048576));
if (historyMaxSizeMiB > 0) {
m_ui->historyMaxSizeSpinBox->setValue(historyMaxSizeMiB);
m_ui->historyMaxSizeCheckBox->setChecked(true);
}
else {
@ -90,7 +91,7 @@ void DatabaseSettingsWidget::save()
meta->setHistoryMaxItems(-1);
}
if (m_ui->historyMaxSizeCheckBox->isChecked()) {
meta->setHistoryMaxSize(m_ui->historyMaxSizeSpinBox->value());
meta->setHistoryMaxSize(m_ui->historyMaxSizeSpinBox->value() * 1048576);
}
else {
meta->setHistoryMaxSize(-1);

View File

@ -80,25 +80,8 @@
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QCheckBox" name="recycleBinEnabledCheckBox"/>
</item>
<item row="7" column="0">
<widget class="QLabel" name="historyMaxSizeLabel">
<property name="text">
<string>History max size:</string>
</property>
</widget>
</item>
<item row="7" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QCheckBox" name="historyMaxSizeCheckBox">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="historyMaxSizeSpinBox">
<property name="sizePolicy">
@ -107,6 +90,12 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="suffix">
<string> MiB</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>2000000000</number>
</property>
@ -114,22 +103,8 @@
</item>
</layout>
</item>
<item row="6" column="0">
<widget class="QLabel" name="historyMaxItemsLabel">
<property name="text">
<string>History max items:</string>
</property>
</widget>
</item>
<item row="6" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QCheckBox" name="historyMaxItemsCheckBox">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="historyMaxItemsSpinBox">
<property name="sizePolicy">
@ -172,6 +147,23 @@
</item>
</layout>
</item>
<item row="6" column="0">
<widget class="QCheckBox" name="historyMaxItemsCheckBox">
<property name="text">
<string>Max. history items:</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QCheckBox" name="historyMaxSizeCheckBox">
<property name="text">
<string>Max. history size:</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QCheckBox" name="recycleBinEnabledCheckBox"/>
</item>
</layout>
</item>
<item>