"Fossies" - the Fresh Open Source Software Archive

Member "src/Main/Forms/VolumeFormatOptionsWizardPage.cpp" (10 Oct 2018, 4791 Bytes) of package /windows/misc/VeraCrypt_1.23-Hotfix-2_Source.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "VolumeFormatOptionsWizardPage.cpp" see the Fossies "Dox" file reference documentation.

    1 /*
    2  Derived from source code of TrueCrypt 7.1a, which is
    3  Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
    4  by the TrueCrypt License 3.0.
    5 
    6  Modifications and additions to the original source code (contained in this file)
    7  and all other portions of this file are Copyright (c) 2013-2017 IDRIX
    8  and are governed by the Apache License 2.0 the full text of which is
    9  contained in the file License.txt included in VeraCrypt binary and source
   10  code distribution packages.
   11 */
   12 
   13 #include "System.h"
   14 #include "Main/GraphicUserInterface.h"
   15 #include "VolumeFormatOptionsWizardPage.h"
   16 
   17 namespace VeraCrypt
   18 {
   19     VolumeFormatOptionsWizardPage::VolumeFormatOptionsWizardPage (wxPanel* parent, uint64 volumeSize, uint32 sectorSize, bool enableQuickFormatButton, bool disableNoneFilesystem, bool disable32bitFilesystems)
   20         : VolumeFormatOptionsWizardPageBase (parent)
   21     {
   22         InfoStaticText->SetLabel (_(
   23             "In order to enable your operating system to mount your new volume, it has to be formatted with a filesystem. Please select a filesystem type.\n\nIf your volume is going to be hosted on a device or partition, you can use 'Quick format' to skip encryption of free space of the volume."));
   24 
   25         if (!disableNoneFilesystem)
   26             FilesystemTypeChoice->Append (LangString["NONE"],   (void *) VolumeCreationOptions::FilesystemType::None);
   27 
   28         if (!disable32bitFilesystems && volumeSize <= TC_MAX_FAT_SECTOR_COUNT * sectorSize)
   29             FilesystemTypeChoice->Append (L"FAT",           (void *) VolumeCreationOptions::FilesystemType::FAT);
   30 
   31 #ifdef TC_WINDOWS
   32         FilesystemTypeChoice->Append (L"NTFS",              (void *) VolumeCreationOptions::FilesystemType::NTFS);
   33         FilesystemTypeChoice->Append (L"exFAT",             (void *) VolumeCreationOptions::FilesystemType::exFAT);
   34 #elif defined (TC_LINUX)
   35         FilesystemTypeChoice->Append (L"Linux Ext2",        (void *) VolumeCreationOptions::FilesystemType::Ext2);
   36         FilesystemTypeChoice->Append (L"Linux Ext3",        (void *) VolumeCreationOptions::FilesystemType::Ext3);
   37         FilesystemTypeChoice->Append (L"Linux Ext4",        (void *) VolumeCreationOptions::FilesystemType::Ext4);
   38         FilesystemTypeChoice->Append (L"NTFS",              (void *) VolumeCreationOptions::FilesystemType::NTFS);
   39         FilesystemTypeChoice->Append (L"exFAT",             (void *) VolumeCreationOptions::FilesystemType::exFAT);
   40 #elif defined (TC_MACOSX)
   41         FilesystemTypeChoice->Append (L"Mac OS Extended",   (void *) VolumeCreationOptions::FilesystemType::MacOsExt);
   42         FilesystemTypeChoice->Append (L"exFAT",             (void *) VolumeCreationOptions::FilesystemType::exFAT);
   43 #elif defined (TC_FREEBSD) || defined (TC_SOLARIS)
   44         FilesystemTypeChoice->Append (L"UFS",               (void *) VolumeCreationOptions::FilesystemType::UFS);
   45 #endif
   46 
   47         if (!disable32bitFilesystems && volumeSize <= TC_MAX_FAT_SECTOR_COUNT * sectorSize)
   48             SetFilesystemType (VolumeCreationOptions::FilesystemType::FAT);
   49         else
   50             SetFilesystemType (VolumeCreationOptions::FilesystemType::GetPlatformNative());
   51 
   52         QuickFormatCheckBox->Enable (enableQuickFormatButton);
   53     }
   54 
   55     VolumeCreationOptions::FilesystemType::Enum VolumeFormatOptionsWizardPage::GetFilesystemType () const
   56     {
   57         return (VolumeCreationOptions::FilesystemType::Enum) reinterpret_cast <unsigned long long> (Gui->GetSelectedData <void> (FilesystemTypeChoice));
   58     }
   59 
   60     void VolumeFormatOptionsWizardPage::OnFilesystemTypeSelected (wxCommandEvent& event)
   61     {
   62     }
   63 
   64     void VolumeFormatOptionsWizardPage::OnQuickFormatCheckBoxClick (wxCommandEvent& event)
   65     {
   66         if (event.IsChecked())
   67         {
   68             QuickFormatCheckBox->SetValue (Gui->AskYesNo (LangString["WARN_QUICK_FORMAT"], false, true));
   69         }
   70     }
   71 
   72     void VolumeFormatOptionsWizardPage::SetFilesystemType (VolumeCreationOptions::FilesystemType::Enum type)
   73     {
   74         switch (type)
   75         {
   76         case VolumeCreationOptions::FilesystemType::None:       FilesystemTypeChoice->SetStringSelection (LangString["NONE"]); break;
   77         case VolumeCreationOptions::FilesystemType::FAT:        FilesystemTypeChoice->SetStringSelection (L"FAT"); break;
   78         case VolumeCreationOptions::FilesystemType::exFAT:      FilesystemTypeChoice->SetStringSelection (L"exFAT"); break;
   79         case VolumeCreationOptions::FilesystemType::NTFS:       FilesystemTypeChoice->SetStringSelection (L"NTFS"); break;
   80         case VolumeCreationOptions::FilesystemType::Ext2:       FilesystemTypeChoice->SetStringSelection (L"Linux Ext2"); break;
   81         case VolumeCreationOptions::FilesystemType::Ext3:       FilesystemTypeChoice->SetStringSelection (L"Linux Ext3"); break;
   82         case VolumeCreationOptions::FilesystemType::Ext4:       FilesystemTypeChoice->SetStringSelection (L"Linux Ext4"); break;
   83         case VolumeCreationOptions::FilesystemType::MacOsExt:   FilesystemTypeChoice->SetStringSelection (L"Mac OS Extended"); break;
   84         case VolumeCreationOptions::FilesystemType::UFS:        FilesystemTypeChoice->SetStringSelection (L"UFS"); break;
   85 
   86         default:
   87             throw ParameterIncorrect (SRC_POS);
   88         }
   89     }
   90 }