Permalink
Browse files

Change page_size PRAGMA from spin box to combo box

Change the control of the page_size PRAGMA from a spin box to a combo
box in the Edit Pragma tab. This makes sure no values are entered which
aren't a power of two. The same change was done in the Cipher dialog a
while ago for the same reasons.
  • Loading branch information...
MKleusberg committed Aug 9, 2018
1 parent 8f7fc07 commit 8a07f0e6556dd9e0b1e369a897db7a05f33085a8
Showing with 45 additions and 11 deletions.
  1. +2 −2 src/MainWindow.cpp
  2. +43 −9 src/MainWindow.ui
@@ -1898,7 +1898,7 @@ void MainWindow::updatePragmaUi()
ui->spinPragmaJournalSizeLimit->setValue(pragmaValues.journal_size_limit);
ui->comboboxPragmaLockingMode->setCurrentIndex(ui->comboboxPragmaLockingMode->findText(pragmaValues.locking_mode, Qt::MatchFixedString));
ui->spinPragmaMaxPageCount->setValue(pragmaValues.max_page_count);
ui->spinPragmaPageSize->setValue(pragmaValues.page_size);
ui->comboPragmaPageSize->setCurrentIndex(ui->comboPragmaPageSize->findText(QString::number(pragmaValues.page_size), Qt::MatchFixedString));
ui->checkboxPragmaRecursiveTriggers->setChecked(pragmaValues.recursive_triggers);
ui->checkboxPragmaSecureDelete->setChecked(pragmaValues.secure_delete);
ui->comboboxPragmaSynchronous->setCurrentIndex(pragmaValues.synchronous);
@@ -1928,7 +1928,7 @@ void MainWindow::savePragmas()
db.setPragma("journal_size_limit", ui->spinPragmaJournalSizeLimit->value(), pragmaValues.journal_size_limit);
db.setPragma("locking_mode", ui->comboboxPragmaLockingMode->currentText().toUpper(), pragmaValues.locking_mode);
db.setPragma("max_page_count", ui->spinPragmaMaxPageCount->value(), pragmaValues.max_page_count);
db.setPragma("page_size", ui->spinPragmaPageSize->value(), pragmaValues.page_size);
db.setPragma("page_size", ui->comboPragmaPageSize->currentText().toInt(), pragmaValues.page_size);
db.setPragma("recursive_triggers", ui->checkboxPragmaRecursiveTriggers->isChecked(), pragmaValues.recursive_triggers);
db.setPragma("secure_delete", ui->checkboxPragmaSecureDelete->isChecked(), pragmaValues.secure_delete);
db.setPragma("synchronous", ui->comboboxPragmaSynchronous->currentIndex(), pragmaValues.synchronous);
@@ -688,18 +688,52 @@ You can drag SQL statements from an object row and drop them into other applicat
<bool>true</bool>
</property>
<property name="buddy">
<cstring>spinPragmaPageSize</cstring>
<cstring>comboPragmaPageSize</cstring>
</property>
</widget>
</item>
<item row="11" column="1">
<widget class="QSpinBox" name="spinPragmaPageSize">
<property name="minimum">
<number>512</number>
</property>
<property name="maximum">
<number>65536</number>
</property>
<widget class="QComboBox" name="comboPragmaPageSize">
<item>
<property name="text">
<string notr="true">512</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">1024</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">2048</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">4096</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">8192</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">16384</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">32768</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">65536</string>
</property>
</item>
</widget>
</item>
<item row="12" column="0">
@@ -2176,7 +2210,7 @@ You can drag SQL statements from the Schema column and drop them into the SQL ed
<tabstop>spinPragmaJournalSizeLimit</tabstop>
<tabstop>comboboxPragmaLockingMode</tabstop>
<tabstop>spinPragmaMaxPageCount</tabstop>
<tabstop>spinPragmaPageSize</tabstop>
<tabstop>comboPragmaPageSize</tabstop>
<tabstop>checkboxPragmaSecureDelete</tabstop>
<tabstop>checkboxPragmaRecursiveTriggers</tabstop>
<tabstop>comboboxPragmaSynchronous</tabstop>

0 comments on commit 8a07f0e

Please sign in to comment.