From cbc28bd4fe5e1170952d87d80f5e752bf63bd940 Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Sun, 4 Jan 2015 00:54:24 +0100 Subject: Linux/MacOSX: change cascade encryption naming format in the UI as it was done on Windows. --- src/Main/Forms/BenchmarkDialog.cpp | 2 +- src/Main/Forms/EncryptionOptionsWizardPage.cpp | 4 ++-- src/Main/Forms/EncryptionTestDialog.cpp | 2 +- src/Main/TextUserInterface.cpp | 2 +- src/Volume/EncryptionAlgorithm.cpp | 18 ++++++++++++++++-- src/Volume/EncryptionAlgorithm.h | 2 +- 6 files changed, 22 insertions(+), 8 deletions(-) diff --git a/src/Main/Forms/BenchmarkDialog.cpp b/src/Main/Forms/BenchmarkDialog.cpp index fd51aa65..9d744ed8 100644 --- a/src/Main/Forms/BenchmarkDialog.cpp +++ b/src/Main/Forms/BenchmarkDialog.cpp @@ -73,7 +73,7 @@ namespace VeraCrypt if (!ea->IsDeprecated()) { BenchmarkResult result; - result.AlgorithmName = ea->GetName(); + result.AlgorithmName = ea->GetName(true); Buffer key (ea->GetKeySize()); ea->SetKey (key); diff --git a/src/Main/Forms/EncryptionOptionsWizardPage.cpp b/src/Main/Forms/EncryptionOptionsWizardPage.cpp index c05ee5b2..f75c8642 100644 --- a/src/Main/Forms/EncryptionOptionsWizardPage.cpp +++ b/src/Main/Forms/EncryptionOptionsWizardPage.cpp @@ -24,7 +24,7 @@ namespace VeraCrypt foreach (shared_ptr ea, EncryptionAlgorithms) { if (!ea->IsDeprecated()) - EncryptionAlgorithmChoice->Append (ea->GetName(), ea.get()); + EncryptionAlgorithmChoice->Append (ea->GetName(true), ea.get()); } EncryptionAlgorithmChoice->Select (0); @@ -124,7 +124,7 @@ namespace VeraCrypt { if (algorithm) { - EncryptionAlgorithmChoice->SetStringSelection (algorithm->GetName()); + EncryptionAlgorithmChoice->SetStringSelection (algorithm->GetName(true)); OnEncryptionAlgorithmSelected (); } } diff --git a/src/Main/Forms/EncryptionTestDialog.cpp b/src/Main/Forms/EncryptionTestDialog.cpp index ab27826d..fdfa598b 100644 --- a/src/Main/Forms/EncryptionTestDialog.cpp +++ b/src/Main/Forms/EncryptionTestDialog.cpp @@ -21,7 +21,7 @@ namespace VeraCrypt foreach (shared_ptr ea, EncryptionAlgorithms) { if (!ea->IsDeprecated()) - EncryptionAlgorithmChoice->Append (ea->GetName(), ea.get()); + EncryptionAlgorithmChoice->Append (ea->GetName(true), ea.get()); } EncryptionAlgorithmChoice->Select (0); diff --git a/src/Main/TextUserInterface.cpp b/src/Main/TextUserInterface.cpp index 62fdc235..c1b17b2b 100644 --- a/src/Main/TextUserInterface.cpp +++ b/src/Main/TextUserInterface.cpp @@ -664,7 +664,7 @@ namespace VeraCrypt { if (!ea->IsDeprecated()) { - ShowString (StringFormatter (L" {0}) {1}\n", (uint32) encryptionAlgorithms.size() + 1, ea->GetName())); + ShowString (StringFormatter (L" {0}) {1}\n", (uint32) encryptionAlgorithms.size() + 1, ea->GetName(true))); encryptionAlgorithms.push_back (ea); } } diff --git a/src/Volume/EncryptionAlgorithm.cpp b/src/Volume/EncryptionAlgorithm.cpp index 3d854ae5..71bf332c 100644 --- a/src/Volume/EncryptionAlgorithm.cpp +++ b/src/Volume/EncryptionAlgorithm.cpp @@ -125,19 +125,33 @@ namespace VeraCrypt return Mode; } - wstring EncryptionAlgorithm::GetName () const + wstring EncryptionAlgorithm::GetName (bool forGuiDisplay) const { if (Ciphers.size() < 1) throw NotInitialized (SRC_POS); wstring name; + int depth = 0; foreach_reverse_ref (const Cipher &c, Ciphers) { if (name.empty()) name = c.GetName(); else - name += wstring (L"-") + c.GetName(); + { + depth++; + if (forGuiDisplay) + name += wstring (L"("); + else + name += wstring (L"-"); + name += c.GetName(); + } + } + + if (forGuiDisplay && depth) + { + for (int i = 0; i < depth; i++) + name += wstring(L")"); } return name; diff --git a/src/Volume/EncryptionAlgorithm.h b/src/Volume/EncryptionAlgorithm.h index 5a5666fe..4eebba4f 100644 --- a/src/Volume/EncryptionAlgorithm.h +++ b/src/Volume/EncryptionAlgorithm.h @@ -37,7 +37,7 @@ namespace VeraCrypt static size_t GetLargestKeySize (const EncryptionAlgorithmList &algorithms); virtual size_t GetKeySize () const; virtual shared_ptr GetMode () const; - virtual wstring GetName () const; + virtual wstring GetName (bool forGuiDisplay = false) const; bool IsDeprecated () const { return Deprecated; } virtual bool IsModeSupported (const EncryptionMode &mode) const; virtual bool IsModeSupported (const shared_ptr mode) const; -- cgit v1.2.3