From 96974169199d347172fc5d4a2924f092d602b3de Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Sun, 30 Jun 2024 01:22:05 +0200 Subject: Linux: Make the C++ code compatible with old compilers (g++ 4.4.7 on CentOS 6) --- src/Main/Forms/PreferencesDialog.cpp | 53 ++++++++++++++++++++++++++++++--- src/Main/Forms/PreferencesDialog.h | 45 +--------------------------- src/Main/Forms/VolumeCreationWizard.cpp | 25 ++++++++-------- 3 files changed, 63 insertions(+), 60 deletions(-) (limited to 'src/Main/Forms') diff --git a/src/Main/Forms/PreferencesDialog.cpp b/src/Main/Forms/PreferencesDialog.cpp index c4d5140f..afc2871f 100644 --- a/src/Main/Forms/PreferencesDialog.cpp +++ b/src/Main/Forms/PreferencesDialog.cpp @@ -82,6 +82,51 @@ namespace VeraCrypt LanguageListBox->Append("System default"); LanguageListBox->Append("English"); + langEntries = { + {"system", L"System default"}, + {"ar", L"العربية"}, + {"be", L"Беларуская"}, + {"bg", L"Български"}, + {"ca", L"Català"}, + {"co", L"Corsu"}, + {"cs", L"Čeština"}, + {"da", L"Dansk"}, + {"de", L"Deutsch"}, + {"el", L"Ελληνικά"}, + {"en", L"English"}, + {"es", L"Español"}, + {"et", L"Eesti"}, + {"eu", L"Euskara"}, + {"fa", L"فارسي"}, + {"fi", L"Suomi"}, + {"fr", L"Français"}, + {"he", L"עברית"}, + {"hu", L"Magyar"}, + {"id", L"Bahasa Indonesia"}, + {"it", L"Italiano"}, + {"ja", L"日本語"}, + {"ka", L"ქართული"}, + {"ko", L"한국어"}, + {"lv", L"Latviešu"}, + {"nl", L"Nederlands"}, + {"nn", L"Norsk Nynorsk"}, + {"pl", L"Polski"}, + {"ro", L"Română"}, + {"ru", L"Русский"}, + {"pt-br", L"Português-Brasil"}, + {"sk", L"Slovenčina"}, + {"sl", L"Slovenščina"}, + {"sv", L"Svenska"}, + {"th", L"ภาษาไทย"}, + {"tr", L"Türkçe"}, + {"uk", L"Українська"}, + {"uz", L"Ўзбекча"}, + {"vi", L"Tiếng Việt"}, + {"zh-cn", L"简体中文"}, + {"zh-hk", L"繁體中文(香港)"}, + {"zh-tw", L"繁體中文"} + }; + if (wxDir::Exists(languagesFolder.GetName())) { size_t langCount; langCount = wxDir::GetAllFiles(languagesFolder.GetName(), &langArray, wxEmptyString, wxDIR_FILES); @@ -435,11 +480,11 @@ namespace VeraCrypt if (LanguageListBox->GetSelection() != wxNOT_FOUND) { wxString langToFind = LanguageListBox->GetString(LanguageListBox->GetSelection()); - for (const auto &each: langEntries) { - if (each.second == langToFind) { - Preferences.Language = each.first; + for (map::const_iterator each = langEntries.begin(); each != langEntries.end(); ++each) { + if (each->second == langToFind) { + Preferences.Language = each->first; #ifdef DEBUG - cout << "Lang set to: " << each.first << endl; + cout << "Lang set to: " << each->first << endl; #endif } } diff --git a/src/Main/Forms/PreferencesDialog.h b/src/Main/Forms/PreferencesDialog.h index 50e8489e..5e7f7e71 100644 --- a/src/Main/Forms/PreferencesDialog.h +++ b/src/Main/Forms/PreferencesDialog.h @@ -60,50 +60,7 @@ namespace VeraCrypt UserPreferences Preferences; bool RestoreValidatorBell; HotkeyList UnregisteredHotkeys; - map langEntries = { - {"system", L"System default"}, - {"ar", L"العربية"}, - {"be", L"Беларуская"}, - {"bg", L"Български"}, - {"ca", L"Català"}, - {"co", L"Corsu"}, - {"cs", L"Čeština"}, - {"da", L"Dansk"}, - {"de", L"Deutsch"}, - {"el", L"Ελληνικά"}, - {"en", L"English"}, - {"es", L"Español"}, - {"et", L"Eesti"}, - {"eu", L"Euskara"}, - {"fa", L"فارسي"}, - {"fi", L"Suomi"}, - {"fr", L"Français"}, - {"he", L"עברית"}, - {"hu", L"Magyar"}, - {"id", L"Bahasa Indonesia"}, - {"it", L"Italiano"}, - {"ja", L"日本語"}, - {"ka", L"ქართული"}, - {"ko", L"한국어"}, - {"lv", L"Latviešu"}, - {"nl", L"Nederlands"}, - {"nn", L"Norsk Nynorsk"}, - {"pl", L"Polski"}, - {"ro", L"Română"}, - {"ru", L"Русский"}, - {"pt-br", L"Português-Brasil"}, - {"sk", L"Slovenčina"}, - {"sl", L"Slovenščina"}, - {"sv", L"Svenska"}, - {"th", L"ภาษาไทย"}, - {"tr", L"Türkçe"}, - {"uk", L"Українська"}, - {"uz", L"Ўзбекча"}, - {"vi", L"Tiếng Việt"}, - {"zh-cn", L"简体中文"}, - {"zh-hk", L"繁體中文(香港)"}, - {"zh-tw", L"繁體中文"} - }; + map langEntries; }; } diff --git a/src/Main/Forms/VolumeCreationWizard.cpp b/src/Main/Forms/VolumeCreationWizard.cpp index 3f09e39f..311738ca 100644 --- a/src/Main/Forms/VolumeCreationWizard.cpp +++ b/src/Main/Forms/VolumeCreationWizard.cpp @@ -37,6 +37,19 @@ namespace VeraCrypt { + class OpenOuterVolumeFunctor : public Functor + { + public: + OpenOuterVolumeFunctor (const DirectoryPath &outerVolumeMountPoint) : OuterVolumeMountPoint (outerVolumeMountPoint) { } + + virtual void operator() () + { + Gui->OpenExplorerWindow (OuterVolumeMountPoint); + } + + DirectoryPath OuterVolumeMountPoint; + }; + #ifdef TC_MACOSX bool VolumeCreationWizard::ProcessEvent(wxEvent& event) @@ -338,18 +351,6 @@ namespace VeraCrypt return new InfoWizardPage (GetPageParent()); } - struct OpenOuterVolumeFunctor : public Functor - { - OpenOuterVolumeFunctor (const DirectoryPath &outerVolumeMountPoint) : OuterVolumeMountPoint (outerVolumeMountPoint) { } - - virtual void operator() () - { - Gui->OpenExplorerWindow (OuterVolumeMountPoint); - } - - DirectoryPath OuterVolumeMountPoint; - }; - InfoWizardPage *page = new InfoWizardPage (GetPageParent(), LangString["LINUX_OPEN_OUTER_VOL"], shared_ptr (new OpenOuterVolumeFunctor (MountedOuterVolume->MountPoint))); -- cgit v1.2.3