wxWidgets 3.0 compatibility modifications

This commit is contained in:
Mounir IDRASSI 2014-06-08 00:45:49 +02:00
parent c386beb69c
commit 084a8ee85c
8 changed files with 17 additions and 17 deletions

View File

@ -36,7 +36,7 @@ namespace TrueCrypt
FilePath Application::GetConfigFilePath (const wxString &configFileName, bool createConfigDir) FilePath Application::GetConfigFilePath (const wxString &configFileName, bool createConfigDir)
{ {
wxStandardPaths stdPaths; wxStandardPaths& stdPaths = wxStandardPaths::Get();
DirectoryPath configDir; DirectoryPath configDir;
if (!Core->IsInPortableMode()) if (!Core->IsInPortableMode())
@ -61,12 +61,12 @@ namespace TrueCrypt
DirectoryPath Application::GetExecutableDirectory () DirectoryPath Application::GetExecutableDirectory ()
{ {
return wstring (wxFileName (wxStandardPaths().GetExecutablePath()).GetPath()); return wstring (wxFileName (wxStandardPaths::Get().GetExecutablePath()).GetPath());
} }
FilePath Application::GetExecutablePath () FilePath Application::GetExecutablePath ()
{ {
return wstring (wxStandardPaths().GetExecutablePath()); return wstring (wxStandardPaths::Get().GetExecutablePath());
} }
void Application::Initialize (UserInterfaceType::Enum type) void Application::Initialize (UserInterfaceType::Enum type)

View File

@ -380,7 +380,7 @@ namespace TrueCrypt
ArgQuick = parser.Found (L"quick"); ArgQuick = parser.Found (L"quick");
if (parser.Found (L"random-source", &str)) if (parser.Found (L"random-source", &str))
ArgRandomSourcePath = FilesystemPath (str); ArgRandomSourcePath = FilesystemPath (str.wc_str());
if (parser.Found (L"restore-headers")) if (parser.Found (L"restore-headers"))
{ {
@ -471,7 +471,7 @@ namespace TrueCrypt
if (param1IsFile) if (param1IsFile)
{ {
ArgFilePath.reset (new FilePath (parser.GetParam (0))); ArgFilePath.reset (new FilePath (parser.GetParam (0).wc_str()));
} }
} }
@ -524,7 +524,7 @@ namespace TrueCrypt
arr.Add (L""); arr.Add (L"");
continue; continue;
} }
arr.Last() += token.empty() ? L',' : token; arr.Last() += token.empty() ? L"," : token.wc_str();
} }
else else
arr.Add (token); arr.Add (token);
@ -562,12 +562,12 @@ namespace TrueCrypt
{ {
filteredVolumes.push_back (volume); filteredVolumes.push_back (volume);
} }
else if (wxString (volume->Path) == pathFilter.GetFullPath()) else if (wxString (wstring(volume->Path)) == pathFilter.GetFullPath())
{ {
filteredVolumes.push_back (volume); filteredVolumes.push_back (volume);
} }
else if (wxString (volume->MountPoint) == pathFilter.GetFullPath() else if (wxString (wstring(volume->MountPoint)) == pathFilter.GetFullPath()
|| (wxString (volume->MountPoint) + wxFileName::GetPathSeparator()) == pathFilter.GetFullPath()) || (wxString (wstring(volume->MountPoint)) + wxFileName::GetPathSeparator()) == pathFilter.GetFullPath())
{ {
filteredVolumes.push_back (volume); filteredVolumes.push_back (volume);
} }

View File

@ -828,7 +828,7 @@ namespace TrueCrypt
// File-hosted volumes // File-hosted volumes
if (!volume->Path.IsDevice() && !mountPoint.IsEmpty()) if (!volume->Path.IsDevice() && !mountPoint.IsEmpty())
{ {
if (wxString (volume->Path).Upper().StartsWith (wstring (mountPoint).c_str())) if (wxString (wstring(volume->Path)).Upper().StartsWith (wstring (mountPoint).c_str()))
{ {
removedVolumes.push_back (volume); removedVolumes.push_back (volume);
continue; continue;

View File

@ -16,7 +16,7 @@ namespace TrueCrypt
{ {
if (!DirectoryTextCtrl->IsEmpty()) if (!DirectoryTextCtrl->IsEmpty())
{ {
return FilesystemPath (DirectoryTextCtrl->GetValue()).IsDirectory(); return FilesystemPath (DirectoryTextCtrl->GetValue().wc_str()).IsDirectory();
} }
return false; return false;

View File

@ -18,7 +18,7 @@ namespace TrueCrypt
public: public:
SelectDirectoryWizardPage (wxPanel* parent) : SelectDirectoryWizardPageBase (parent) { } SelectDirectoryWizardPage (wxPanel* parent) : SelectDirectoryWizardPageBase (parent) { }
DirectoryPath GetDirectory () const { return DirectoryPath (DirectoryTextCtrl->GetValue()); } DirectoryPath GetDirectory () const { return DirectoryPath (DirectoryTextCtrl->GetValue().wc_str()); }
bool IsValid (); bool IsValid ();
void SetDirectory (const DirectoryPath &path) { DirectoryTextCtrl->SetValue (wstring (path)); } void SetDirectory (const DirectoryPath &path) { DirectoryTextCtrl->SetValue (wstring (path)); }
void SetMaxStaticTextWidth (int width) { InfoStaticText->Wrap (width); } void SetMaxStaticTextWidth (int width) { InfoStaticText->Wrap (width); }

View File

@ -1384,7 +1384,7 @@ namespace TrueCrypt
#else #else
L"", L"",
#endif #endif
L"", wxDD_DEFAULT_STYLE | (existingOnly ? wxDD_DIR_MUST_EXIST : 0), wxDefaultPosition, parent)); L"", wxDD_DEFAULT_STYLE | (existingOnly ? wxDD_DIR_MUST_EXIST : 0), wxDefaultPosition, parent).wc_str());
} }
FilePathList GraphicUserInterface::SelectFiles (wxWindow *parent, const wxString &caption, bool saveMode, bool allowMultiple, const list < pair <wstring, wstring> > &fileExtensions, const DirectoryPath &directory) const FilePathList GraphicUserInterface::SelectFiles (wxWindow *parent, const wxString &caption, bool saveMode, bool allowMultiple, const list < pair <wstring, wstring> > &fileExtensions, const DirectoryPath &directory) const
@ -1428,14 +1428,14 @@ namespace TrueCrypt
if (dialog.ShowModal() == wxID_OK) if (dialog.ShowModal() == wxID_OK)
{ {
if (!allowMultiple) if (!allowMultiple)
files.push_back (make_shared <FilePath> (dialog.GetPath())); files.push_back (make_shared <FilePath> (dialog.GetPath().wc_str()));
else else
{ {
wxArrayString paths; wxArrayString paths;
dialog.GetPaths (paths); dialog.GetPaths (paths);
foreach (const wxString &path, paths) foreach (const wxString &path, paths)
files.push_back (make_shared <FilePath> (path)); files.push_back (make_shared <FilePath> (path.wc_str()));
} }
} }

View File

@ -116,7 +116,7 @@ namespace TrueCrypt
for (size_t i = 0; i < length && i < VolumePassword::MaxSize; ++i) for (size_t i = 0; i < length && i < VolumePassword::MaxSize; ++i)
{ {
passwordBuf[i] = (wchar_t) passwordStr[i]; passwordBuf[i] = (wchar_t) passwordStr[i];
const_cast <wchar_t *> (passwordStr.c_str())[i] = L'X'; const_cast <wchar_t *> (passwordStr.wc_str())[i] = L'X';
} }
if (verify && verPhase) if (verify && verPhase)

View File

@ -219,7 +219,7 @@ namespace TrueCrypt
foreach_ref (const Keyfile &keyfile, DefaultKeyfiles) foreach_ref (const Keyfile &keyfile, DefaultKeyfiles)
{ {
keyfilesXml.InnerNodes.push_back (XmlNode (L"keyfile", wxString (FilesystemPath (keyfile)))); keyfilesXml.InnerNodes.push_back (XmlNode (L"keyfile", wxString (wstring(FilesystemPath (keyfile)))));
} }
XmlWriter keyfileWriter (keyfilesCfgPath); XmlWriter keyfileWriter (keyfilesCfgPath);