VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Main/Forms
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2015-01-04 22:51:43 (GMT)
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2015-01-04 22:53:35 (GMT)
commit6a254778e2bcfe7df0b40bf8a0db37159a706315 (patch)
tree95dd89deaf84c8b0c8fd6d9ae651bbe4afc3c7cd /src/Main/Forms
parent41607d126a0a045222a5fc2fac5c9e77b40099f7 (diff)
downloadVeraCrypt-6a254778e2bcfe7df0b40bf8a0db37159a706315.zip
VeraCrypt-6a254778e2bcfe7df0b40bf8a0db37159a706315.tar.gz
Linux/MacOSX: Add wait dialog to the benchmark computation. Correct handling of wait dialog call when changing password and creating volumes.
Diffstat (limited to 'src/Main/Forms')
-rw-r--r--src/Main/Forms/BenchmarkDialog.cpp45
-rw-r--r--src/Main/Forms/BenchmarkDialog.h13
-rw-r--r--src/Main/Forms/ChangePasswordDialog.cpp3
-rw-r--r--src/Main/Forms/VolumeCreationWizard.cpp3
4 files changed, 42 insertions, 22 deletions
diff --git a/src/Main/Forms/BenchmarkDialog.cpp b/src/Main/Forms/BenchmarkDialog.cpp
index 9d744ed..faf8504 100644
--- a/src/Main/Forms/BenchmarkDialog.cpp
+++ b/src/Main/Forms/BenchmarkDialog.cpp
@@ -60,13 +60,35 @@ namespace VeraCrypt
void BenchmarkDialog::OnBenchmarkButtonClick (wxCommandEvent& event)
{
- try
- {
- list <BenchmarkResult> results;
+ list <BenchmarkResult> results;
+
+ wxBusyCursor busy;
+ Buffer buffer ((size_t) Gui->GetSelectedData <size_t> (BufferSizeChoice));
+
+ BenchmarkThreadRoutine routine(this, results, buffer);
+ Gui->ExecuteWaitThreadRoutine (this, &routine);
+
+ BenchmarkListCtrl->DeleteAllItems();
- wxBusyCursor busy;
- Buffer buffer ((size_t) Gui->GetSelectedData <size_t> (BufferSizeChoice));
+ foreach (const BenchmarkResult &result, results)
+ {
+ vector <wstring> fields (BenchmarkListCtrl->GetColumnCount());
+
+ fields[ColumnAlgorithm] = result.AlgorithmName;
+ fields[ColumnEncryption] = Gui->SpeedToString (result.EncryptionSpeed);
+ fields[ColumnDecryption] = Gui->SpeedToString (result.DecryptionSpeed);
+ fields[ColumnMean] = Gui->SpeedToString (result.MeanSpeed);
+ Gui->AppendToListCtrl (BenchmarkListCtrl, fields);
+ }
+
+ BenchmarkListCtrl->SetColumnWidth(0, wxLIST_AUTOSIZE);
+ }
+
+ void BenchmarkDialog::DoBenchmark (list<BenchmarkResult>& results, Buffer& buffer)
+ {
+ try
+ {
EncryptionAlgorithmList encryptionAlgorithms = EncryptionAlgorithm::GetAvailableAlgorithms();
foreach (shared_ptr <EncryptionAlgorithm> ea, encryptionAlgorithms)
{
@@ -135,19 +157,6 @@ namespace VeraCrypt
}
}
- BenchmarkListCtrl->DeleteAllItems();
-
- foreach (const BenchmarkResult &result, results)
- {
- vector <wstring> fields (BenchmarkListCtrl->GetColumnCount());
-
- fields[ColumnAlgorithm] = result.AlgorithmName;
- fields[ColumnEncryption] = Gui->SpeedToString (result.EncryptionSpeed);
- fields[ColumnDecryption] = Gui->SpeedToString (result.DecryptionSpeed);
- fields[ColumnMean] = Gui->SpeedToString (result.MeanSpeed);
-
- Gui->AppendToListCtrl (BenchmarkListCtrl, fields);
- }
}
catch (exception &e)
{
diff --git a/src/Main/Forms/BenchmarkDialog.h b/src/Main/Forms/BenchmarkDialog.h
index b127295..a9b42a5 100644
--- a/src/Main/Forms/BenchmarkDialog.h
+++ b/src/Main/Forms/BenchmarkDialog.h
@@ -36,7 +36,20 @@ namespace VeraCrypt
uint64 MeanSpeed;
};
+ void DoBenchmark (list<BenchmarkResult>& results, Buffer& buffer);
void OnBenchmarkButtonClick (wxCommandEvent& event);
+
+ class BenchmarkThreadRoutine : public WaitThreadRoutine
+ {
+ public:
+ BenchmarkDialog* m_pDlg;
+ list<BenchmarkResult>& m_results;
+ Buffer& m_buffer;
+ BenchmarkThreadRoutine(BenchmarkDialog* pDlg, list<BenchmarkResult>& results, Buffer& buffer)
+ : m_pDlg(pDlg), m_results(results), m_buffer(buffer) { }
+ virtual ~BenchmarkThreadRoutine() { }
+ virtual void ExecutionCode(void) { m_pDlg->DoBenchmark (m_results, m_buffer); }
+ };
};
}
diff --git a/src/Main/Forms/ChangePasswordDialog.cpp b/src/Main/Forms/ChangePasswordDialog.cpp
index 1bde4be..1889e5c 100644
--- a/src/Main/Forms/ChangePasswordDialog.cpp
+++ b/src/Main/Forms/ChangePasswordDialog.cpp
@@ -136,8 +136,7 @@ namespace VeraCrypt
ChangePasswordThreadRoutine routine(Path, Gui->GetPreferences().DefaultMountOptions.PreserveTimestamps,
CurrentPasswordPanel->GetPassword(), CurrentPasswordPanel->GetPkcs5Kdf(), CurrentPasswordPanel->GetTrueCryptMode(),CurrentPasswordPanel->GetKeyfiles(),
newPassword, newKeyfiles, NewPasswordPanel->GetPkcs5Kdf(), NewPasswordPanel->GetHeaderWipeCount());
- WaitDialog dlg(this, LangString["IDT_STATIC_MODAL_WAIT_DLG_INFO"], &routine);
- dlg.Run();
+ Gui->ExecuteWaitThreadRoutine (this, &routine);
}
switch (DialogMode)
diff --git a/src/Main/Forms/VolumeCreationWizard.cpp b/src/Main/Forms/VolumeCreationWizard.cpp
index 99231a9..bff459a 100644
--- a/src/Main/Forms/VolumeCreationWizard.cpp
+++ b/src/Main/Forms/VolumeCreationWizard.cpp
@@ -867,8 +867,7 @@ namespace VeraCrypt
Creator.reset (new VolumeCreator);
VolumeCreatorThreadRoutine routine(options, Creator);
- WaitDialog dlg(this, LangString["IDT_STATIC_MODAL_WAIT_DLG_INFO"], &routine);
- dlg.Run();
+ Gui->ExecuteWaitThreadRoutine (this, &routine);
page->SetKeyInfo (Creator->GetKeyInfo());