VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Main/GraphicUserInterface.cpp
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2016-05-10 22:34:27 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2016-05-10 22:34:27 +0200
commit268ef2d8e904db5068dbdc0fdc7ce3940d6452ea (patch)
treeb1afa687c97fbf5e1ba2c92c5a10479ae5f832f5 /src/Main/GraphicUserInterface.cpp
parent6d61f06a5348aebe7dbc0bf44d3e2729c20f7fd0 (diff)
parent5f47d8b6f11cdb3c4c2f43e04e5acfc6ffcb3035 (diff)
downloadVeraCrypt-268ef2d8e904db5068dbdc0fdc7ce3940d6452ea.tar.gz
VeraCrypt-268ef2d8e904db5068dbdc0fdc7ce3940d6452ea.zip
Merge pull request #61 from davidfoerster/normalize-line-terminators
Normalize line terminators
Diffstat (limited to 'src/Main/GraphicUserInterface.cpp')
-rw-r--r--src/Main/GraphicUserInterface.cpp130
1 files changed, 65 insertions, 65 deletions
diff --git a/src/Main/GraphicUserInterface.cpp b/src/Main/GraphicUserInterface.cpp
index 3526dcad..cd5c6fe9 100644
--- a/src/Main/GraphicUserInterface.cpp
+++ b/src/Main/GraphicUserInterface.cpp
@@ -3,7 +3,7 @@
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0.
- Modifications and additions to the original source code (contained in this file)
+ Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
@@ -73,7 +73,7 @@ namespace VeraCrypt
signal (SIGTERM, SIG_DFL);
#endif
}
-
+
void GraphicUserInterface::AppendToListCtrl (wxListCtrl *listCtrl, const vector <wstring> &itemFields, int imageIndex, void *itemDataPtr) const
{
InsertToListCtrl (listCtrl, listCtrl->GetItemCount(), itemFields, imageIndex, itemDataPtr);
@@ -83,7 +83,7 @@ namespace VeraCrypt
{
wxMenuItem *item = new wxMenuItem (&menu, itemId, label);
menu.Append (item);
-
+
if (handler)
handler->Connect (item->GetId(), wxEVT_COMMAND_MENU_SELECTED, handlerFunction);
@@ -110,7 +110,7 @@ namespace VeraCrypt
if (Core->GetMountedVolumes().size() < mountedVolumeCount)
OnVolumesAutoDismounted();
}
-
+
void GraphicUserInterface::BackupVolumeHeaders (shared_ptr <VolumePath> volumePath) const
{
wxWindow *parent = GetActiveWindow();
@@ -196,7 +196,7 @@ namespace VeraCrypt
options->UseBackupHeaders
);
- ExecuteWaitThreadRoutine (parent, &routine);
+ ExecuteWaitThreadRoutine (parent, &routine);
volume = routine.m_pVolume;
}
catch (PasswordException &e)
@@ -332,12 +332,12 @@ namespace VeraCrypt
wxHyperlinkCtrl *GraphicUserInterface::CreateHyperlink (wxWindow *parent, const wxString &linkUrl, const wxString &linkText) const
{
wxHyperlinkCtrl *hyperlink = new wxHyperlinkCtrl (parent, wxID_ANY, linkText, linkUrl, wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE);
-
+
wxColour color = wxSystemSettings::GetColour (wxSYS_COLOUR_WINDOWTEXT);
hyperlink->SetHoverColour (color);
hyperlink->SetNormalColour (color);
hyperlink->SetVisitedColour (color);
-
+
return hyperlink;
}
@@ -345,7 +345,7 @@ namespace VeraCrypt
{
ShowMessage (message, wxOK | wxICON_ERROR);
}
-
+
void GraphicUserInterface::DoShowInfo (const wxString &message) const
{
ShowMessage (message, wxOK | wxICON_INFORMATION);
@@ -358,13 +358,13 @@ namespace VeraCrypt
void GraphicUserInterface::DoShowWarning (const wxString &message) const
{
- ShowMessage (message, wxOK
+ ShowMessage (message, wxOK
#ifndef TC_MACOSX
| wxICON_EXCLAMATION
#endif
);
}
-
+
void GraphicUserInterface::EndInteractiveBusyState (wxWindow *window) const
{
static auto_ptr <wxCursor> arrowCursor;
@@ -438,7 +438,7 @@ namespace VeraCrypt
return shared_ptr <GetStringFunctor> (new AdminPasswordRequestHandler);
}
-
+
int GraphicUserInterface::GetCharHeight (wxWindow *window) const
{
int width;
@@ -471,9 +471,9 @@ namespace VeraCrypt
#elif defined(TC_MACOSX)
13
#else
- 10
+ 10
#endif
- * GetCharHeight (window) / 13, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL,
+ * GetCharHeight (window) / 13, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL,
#ifdef __WXGTK__
wxFONTWEIGHT_BOLD, false);
#elif defined(TC_MACOSX)
@@ -486,7 +486,7 @@ namespace VeraCrypt
list <long> GraphicUserInterface::GetListCtrlSelectedItems (wxListCtrl *listCtrl) const
{
list <long> selectedItems;
-
+
long item = -1;
while ((item = listCtrl->GetNextItem (item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED)) != -1)
selectedItems.push_back (item);
@@ -500,7 +500,7 @@ namespace VeraCrypt
item.SetId (itemIndex);
item.SetColumn (columnIndex);
item.SetText (L"");
-
+
if (!listCtrl->GetItem (item))
throw ParameterIncorrect (SRC_POS);
@@ -605,7 +605,7 @@ namespace VeraCrypt
listCtrl->SetItem (item);
}
}
-
+
bool GraphicUserInterface::IsTheOnlyTopLevelWindow (const wxWindow *window) const
{
foreach (wxWindow *w, wxTopLevelWindows)
@@ -654,7 +654,7 @@ namespace VeraCrypt
item.SetId (itemIndex);
item.SetData ((void *) nullptr);
item.SetImage (-1);
-
+
if (!listCtrl->GetItem (item))
throw ParameterIncorrect (SRC_POS);
@@ -667,7 +667,7 @@ namespace VeraCrypt
}
listCtrl->DeleteItem (itemIndex);
-
+
if (newItemIndex > listCtrl->GetItemCount() - 1)
AppendToListCtrl (listCtrl, itemFields, item.GetImage(), (void *) item.GetData());
else
@@ -688,7 +688,7 @@ namespace VeraCrypt
return VolumeInfoList();
VolumeInfoList mountedVolumes = UserInterface::MountAllDeviceHostedVolumes (options);
-
+
if (!mountedVolumes.empty())
return mountedVolumes;
}
@@ -857,7 +857,7 @@ namespace VeraCrypt
wxLogLevel logLevel = wxLog::GetLogLevel();
wxLog::SetLogLevel (wxLOG_Error);
-
+
const wxString instanceCheckerName = wxString (L".") + Application::GetName() + L"-lock-" + wxGetUserId();
SingleInstanceChecker.reset (new wxSingleInstanceChecker (instanceCheckerName));
@@ -978,7 +978,7 @@ namespace VeraCrypt
return true;
}
-
+
void GraphicUserInterface::OnLogOff ()
{
VolumeInfoList mountedVolumes = Core->GetMountedVolumes();
@@ -994,10 +994,10 @@ namespace VeraCrypt
try
{
timeOver = (wxGetLocalTimeMillis() - startTime >= 4000);
-
+
DismountVolumes (mountedVolumes, !timeOver ? false : GetPreferences().ForceAutoDismount, timeOver);
OnVolumesAutoDismounted();
-
+
break;
}
catch (UserAbort&)
@@ -1075,112 +1075,112 @@ namespace VeraCrypt
wxString GraphicUserInterface::GetHomepageLinkURL (const wxString &linkId, bool secure, const wxString &extraVars) const
{
wxString url = wxString (StringConverter::ToWide (secure ? TC_APPLINK_SECURE : TC_APPLINK));
-
- if (linkId == L"donate")
+
+ if (linkId == L"donate")
{
url = L"https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5BCXVMTTNJDCY";
}
- else if (linkId == L"main")
+ else if (linkId == L"main")
{
url = wxString (StringConverter::ToWide (TC_HOMEPAGE));
}
- else if (linkId == L"localizations")
+ else if (linkId == L"localizations")
{
url = L"https://veracrypt.codeplex.com/wikipage?title=Language%20Packs";
}
- else if (linkId == L"beginnerstutorial" || linkId == L"tutorial")
+ else if (linkId == L"beginnerstutorial" || linkId == L"tutorial")
{
url = L"https://veracrypt.codeplex.com/wikipage?title=Beginner%27s%20Tutorial";
}
- else if (linkId == L"releasenotes" || linkId == L"history")
+ else if (linkId == L"releasenotes" || linkId == L"history")
{
url = L"https://veracrypt.codeplex.com/wikipage?title=Release%20Notes";
}
- else if (linkId == L"hwacceleration")
+ else if (linkId == L"hwacceleration")
{
url = L"https://veracrypt.codeplex.com/wikipage?title=Hardware%20Acceleration";
}
- else if (linkId == L"parallelization")
+ else if (linkId == L"parallelization")
{
url = L"https://veracrypt.codeplex.com/wikipage?title=Parallelization";
}
- else if (linkId == L"help")
+ else if (linkId == L"help")
{
url = L"https://veracrypt.codeplex.com/documentation";
}
- else if (linkId == L"keyfiles")
+ else if (linkId == L"keyfiles")
{
url = L"https://veracrypt.codeplex.com/wikipage?title=Keyfiles";
}
- else if (linkId == L"introcontainer")
+ else if (linkId == L"introcontainer")
{
url = L"https://veracrypt.codeplex.com/wikipage?title=Creating%20New%20Volumes";
}
- else if (linkId == L"introsysenc")
+ else if (linkId == L"introsysenc")
{
url = L"https://veracrypt.codeplex.com/wikipage?title=System%20Encryption";
}
- else if (linkId == L"hiddensysenc")
+ else if (linkId == L"hiddensysenc")
{
url = L"https://veracrypt.codeplex.com/wikipage?title=VeraCrypt%20Hidden%20Operating%20System";
}
- else if (linkId == L"sysencprogressinfo")
+ else if (linkId == L"sysencprogressinfo")
{
url = L"https://veracrypt.codeplex.com/wikipage?title=System%20Encryption";
}
- else if (linkId == L"hiddenvolume")
+ else if (linkId == L"hiddenvolume")
{
url = L"https://veracrypt.codeplex.com/wikipage?title=Hidden%20Volume";
}
- else if (linkId == L"aes")
+ else if (linkId == L"aes")
{
url = L"https://veracrypt.codeplex.com/wikipage?title=AES";
}
- else if (linkId == L"serpent")
+ else if (linkId == L"serpent")
{
url = L"https://veracrypt.codeplex.com/wikipage?title=Serpent";
}
- else if (linkId == L"twofish")
+ else if (linkId == L"twofish")
{
url = L"https://veracrypt.codeplex.com/wikipage?title=Twofish";
}
- else if (linkId == L"cascades")
+ else if (linkId == L"cascades")
{
url = L"https://veracrypt.codeplex.com/wikipage?title=Cascades";
}
- else if (linkId == L"hashalgorithms")
+ else if (linkId == L"hashalgorithms")
{
url = L"https://veracrypt.codeplex.com/wikipage?title=Hash%20Algorithms";
}
- else if (linkId == L"isoburning")
+ else if (linkId == L"isoburning")
{
url = L"https://cdburnerxp.se/en/home";
}
- else if (linkId == L"sysfavorites")
+ else if (linkId == L"sysfavorites")
{
url = L"https://veracrypt.codeplex.com/wikipage?title=System%20Favorite%20Volumes";
}
- else if (linkId == L"favorites")
+ else if (linkId == L"favorites")
{
url = L"https://veracrypt.codeplex.com/wikipage?title=Favorite%20Volumes";
}
- else if (linkId == L"hiddenvolprotection")
+ else if (linkId == L"hiddenvolprotection")
{
url = L"https://veracrypt.codeplex.com/wikipage?title=Protection%20of%20Hidden%20Volumes";
}
- else if (linkId == L"faq")
+ else if (linkId == L"faq")
{
url = L"https://veracrypt.codeplex.com/wikipage?title=FAQ";
}
- else if (linkId == L"downloads")
+ else if (linkId == L"downloads")
{
url = L"https://veracrypt.codeplex.com/wikipage?title=Downloads";
}
- else if (linkId == L"news")
+ else if (linkId == L"news")
{
url = L"https://veracrypt.codeplex.com/wikipage?title=News";
}
- else if (linkId == L"contact")
+ else if (linkId == L"contact")
{
url = L"https://veracrypt.codeplex.com/wikipage?title=Contact";
}
@@ -1191,7 +1191,7 @@ namespace VeraCrypt
void GraphicUserInterface::OpenHomepageLink (wxWindow *parent, const wxString &linkId, const wxString &extraVars)
{
wxString url;
-
+
BeginInteractiveBusyState (parent);
wxLaunchDefaultBrowser (GetHomepageLinkURL (linkId, false, extraVars), wxBROWSER_NEW_WINDOW);
Thread::Sleep (200);
@@ -1301,7 +1301,7 @@ namespace VeraCrypt
default:
return;
}
-
+
/* force the display of the random enriching interface */
RandomNumberGenerator::SetEnrichedByUserStatus (false);
@@ -1341,7 +1341,7 @@ namespace VeraCrypt
true
);
- ExecuteWaitThreadRoutine (parent, &routine);
+ ExecuteWaitThreadRoutine (parent, &routine);
volume = routine.m_pVolume;
}
catch (PasswordException &e)
@@ -1449,7 +1449,7 @@ namespace VeraCrypt
EncryptionAlgorithmList encryptionAlgorithms = layout->GetSupportedEncryptionAlgorithms();
EncryptionModeList encryptionModes = layout->GetSupportedEncryptionModes();
- DecryptThreadRoutine decryptRoutine(layout->GetHeader(), headerBuffer, *passwordKey, options.Pim, options.Kdf, options.TrueCryptMode, keyDerivationFunctions, encryptionAlgorithms, encryptionModes);
+ DecryptThreadRoutine decryptRoutine(layout->GetHeader(), headerBuffer, *passwordKey, options.Pim, options.Kdf, options.TrueCryptMode, keyDerivationFunctions, encryptionAlgorithms, encryptionModes);
ExecuteWaitThreadRoutine (parent, &decryptRoutine);
@@ -1471,7 +1471,7 @@ namespace VeraCrypt
File volumeFile;
volumeFile.Open (*volumePath, File::OpenReadWrite, File::ShareNone, File::PreserveTimestamps);
-
+
RandomNumberGenerator::Start();
UserEnrichRandomPool (nullptr);
@@ -1497,7 +1497,7 @@ namespace VeraCrypt
ReEncryptHeaderThreadRoutine backupRoutine(newHeaderBuffer, decryptedLayout->GetHeader(), options.Password, options.Pim, options.Keyfiles);
ExecuteWaitThreadRoutine (parent, &backupRoutine);
-
+
// Write backup volume header
headerOffset = decryptedLayout->GetBackupHeaderOffset();
if (headerOffset >= 0)
@@ -1557,7 +1557,7 @@ namespace VeraCrypt
if (!fileExtensions.empty())
#endif
{
- wildcards = LangString["ALL_FILES"] +
+ wildcards = LangString["ALL_FILES"] +
#ifdef TC_WINDOWS
L" (*.*)|*.*";
#else
@@ -1595,7 +1595,7 @@ namespace VeraCrypt
return files;
}
-
+
FilePath GraphicUserInterface::SelectVolumeFile (wxWindow *parent, bool saveMode, const DirectoryPath &directory) const
{
list < pair <wstring, wstring> > extensions;
@@ -1639,14 +1639,14 @@ namespace VeraCrypt
listWidth = minListWidth;
listWidth -= GetScrollbarWidth (listCtrl, !hasVerticalScrollbar);
-
+
int col = 0;
int totalColWidth = 0;
foreach (int colWidth, columnWidthPermilles)
{
int width = listWidth * colWidth / 1000;
totalColWidth += width;
-
+
if (col == listCtrl->GetColumnCount() - 1)
width += listWidth - totalColWidth;
@@ -1712,7 +1712,7 @@ namespace VeraCrypt
{
ShowMessage (message, wxOK | wxICON_INFORMATION, true);
}
-
+
int GraphicUserInterface::ShowMessage (const wxString &message, long style, bool topMost) const
{
wxString caption = Application::GetName();
@@ -1786,7 +1786,7 @@ namespace VeraCrypt
void GraphicUserInterface::ShowWarningTopMost (const wxString &message) const
{
- ShowMessage (message, wxOK
+ ShowMessage (message, wxOK
#ifndef TC_MACOSX
| wxICON_EXCLAMATION
#endif
@@ -1810,7 +1810,7 @@ namespace VeraCrypt
foreach (wxString field, itemFields)
{
item.SetColumn (col++);
-
+
if (!listCtrl->GetItem (item))
throw ParameterIncorrect (SRC_POS);
@@ -1829,7 +1829,7 @@ namespace VeraCrypt
void GraphicUserInterface::UserEnrichRandomPool (wxWindow *parent, shared_ptr <Hash> hash) const
{
RandomNumberGenerator::Start();
-
+
if (hash)
RandomNumberGenerator::SetHash (hash);