diff --git a/src/CipherDialog.cpp b/src/CipherDialog.cpp index 51285683..ea51731d 100644 --- a/src/CipherDialog.cpp +++ b/src/CipherDialog.cpp @@ -4,6 +4,8 @@ #include #include +#include + CipherDialog::CipherDialog(QWidget* parent, bool encrypt) : QDialog(parent), ui(new Ui::CipherDialog), @@ -12,6 +14,21 @@ CipherDialog::CipherDialog(QWidget* parent, bool encrypt) : { ui->setupUi(this); + int minimumPageSizeExponent = 9; + int maximumPageSizeExponent = 16; + int defaultPageSizeExponent = 10; + + for(int exponent = minimumPageSizeExponent; exponent <= maximumPageSizeExponent; exponent++) + { + int pageSize = static_cast(qPow(2, exponent)); + ui->comboPageSize->addItem(QLocale().toString(pageSize), pageSize); + + if (exponent == defaultPageSizeExponent) + ui->comboPageSize->setCurrentIndex(exponent - minimumPageSizeExponent); + } + + ui->comboPageSize->setMinimumWidth(ui->editPassword->width()); + if(encrypt) { ui->labelDialogDescription->setText(tr("Please set a key to encrypt the database.\nNote that if you change any of the other, optional, settings you'll need " @@ -47,7 +64,7 @@ QString CipherDialog::password() const int CipherDialog::pageSize() const { - return ui->spinPageSize->value(); + return ui->comboPageSize->itemData(ui->comboPageSize->currentIndex()).toInt(); } void CipherDialog::checkInputFields() diff --git a/src/CipherDialog.ui b/src/CipherDialog.ui index 30bdc9ec..30516d1f 100644 --- a/src/CipherDialog.ui +++ b/src/CipherDialog.ui @@ -66,17 +66,7 @@ - - - 512 - - - 65536 - - - 1024 - - + @@ -129,7 +119,7 @@ editPassword comboKeyFormat editPassword2 - spinPageSize + comboPageSize