Annotation of truecrypt/main/userinterface.h, revision 1.1

1.1     ! root        1: /*
        !             2:  Copyright (c) 2008 TrueCrypt Foundation. All rights reserved.
        !             3: 
        !             4:  Governed by the TrueCrypt License 2.4 the full text of which is contained
        !             5:  in the file License.txt included in TrueCrypt binary and source code
        !             6:  distribution packages.
        !             7: */
        !             8: 
        !             9: #ifndef TC_HEADER_Main_UserInterface
        !            10: #define TC_HEADER_Main_UserInterface
        !            11: 
        !            12: #include "System.h"
        !            13: #include "Core/Core.h"
        !            14: #include "Main.h"
        !            15: #include "CommandLineInterface.h"
        !            16: #include "FavoriteVolume.h"
        !            17: #include "LanguageStrings.h"
        !            18: #include "UserPreferences.h"
        !            19: #include "UserInterfaceException.h"
        !            20: #include "UserInterfaceType.h"
        !            21: 
        !            22: namespace TrueCrypt
        !            23: {
        !            24:        class UserInterface : public wxApp
        !            25:        {
        !            26:        public:
        !            27:                virtual ~UserInterface ();
        !            28: 
        !            29:                virtual bool AskYesNo (const wxString &message, bool defaultYes = false, bool warning = false) const = 0;
        !            30:                virtual void BeginBusyState () const = 0;
        !            31:                virtual void ChangePassword (shared_ptr <VolumePath> volumePath = shared_ptr <VolumePath>(), shared_ptr <VolumePassword> password = shared_ptr <VolumePassword>(), shared_ptr <KeyfileList> keyfiles = shared_ptr <KeyfileList>(), shared_ptr <VolumePassword> newPassword = shared_ptr <VolumePassword>(), shared_ptr <KeyfileList> newKeyfiles = shared_ptr <KeyfileList>()) const = 0;
        !            32:                virtual void CloseExplorerWindows (shared_ptr <VolumeInfo> mountedVolume) const;
        !            33:                virtual void DismountAllVolumes (bool ignoreOpenFiles = false, bool interactive = true) const;
        !            34:                virtual void DismountVolume (shared_ptr <VolumeInfo> volume, bool ignoreOpenFiles = false, bool interactive = true) const;
        !            35:                virtual void DismountVolumes (VolumeInfoList volumes, bool ignoreOpenFiles = false, bool interactive = true) const;
        !            36:                virtual void DoShowError (const wxString &message) const = 0;
        !            37:                virtual void DoShowInfo (const wxString &message) const = 0;
        !            38:                virtual void DoShowString (const wxString &str) const = 0;
        !            39:                virtual void DoShowWarning (const wxString &message) const = 0;
        !            40:                virtual void EndBusyState () const = 0;
        !            41:                virtual wxString ExceptionToMessage (const exception &ex) const;
        !            42:                virtual shared_ptr <GetStringFunctor> GetAdminPasswordRequestHandler () = 0;
        !            43:                virtual const UserPreferences &GetPreferences () const { return Preferences; }
        !            44:                virtual void Init ();
        !            45:                virtual void ListMountedVolumes (const VolumeInfoList &volumes) const;
        !            46:                virtual shared_ptr <VolumeInfo> MountVolume (MountOptions &options) const;
        !            47:                virtual VolumeInfoList MountAllDeviceHostedVolumes (MountOptions &options) const;
        !            48:                virtual VolumeInfoList MountAllFavoriteVolumes (MountOptions &options) const;
        !            49:                virtual void OpenExplorerWindow (const DirectoryPath &path);
        !            50:                virtual void SetPreferences (const UserPreferences &preferences);
        !            51:                virtual void ShowError (const exception &ex) const;
        !            52:                virtual void ShowError (char *langStringId) const { DoShowError (LangString[langStringId]); }
        !            53:                virtual void ShowError (const wxString &message) const { DoShowError (message); }
        !            54:                virtual void ShowInfo (const exception &ex) const { DoShowInfo (ExceptionToMessage (ex)); }
        !            55:                virtual void ShowInfo (char *langStringId) const { DoShowInfo (LangString[langStringId]); }
        !            56:                virtual void ShowInfo (const wxString &message) const { DoShowInfo (message); }
        !            57:                virtual void ShowWarning (const exception &ex) const { DoShowWarning (ExceptionToMessage (ex)); }
        !            58:                virtual void ShowWarning (char *langStringId) const { DoShowWarning (LangString[langStringId]); }
        !            59:                virtual void ShowString (const wxString &str) const { DoShowString (str); }
        !            60:                virtual void ShowWarning (const wxString &message) const { DoShowWarning (message); }
        !            61:                virtual wxString SizeToString (uint64 size) const;
        !            62:                virtual wxString SpeedToString (uint64 speed) const;
        !            63:                virtual void Test () const;
        !            64:                virtual bool VolumeHasUnrecommendedExtension (const VolumePath &path) const;
        !            65:                virtual void Yield () const = 0;
        !            66:                virtual wxDateTime VolumeTimeToDateTime (VolumeTime volumeTime) const { return wxDateTime ((time_t) (volumeTime / 1000ULL / 1000 / 10 - 134774ULL * 24 * 3600)); }
        !            67:                virtual wxString VolumeTimeToString (VolumeTime volumeTime) const;
        !            68:                virtual wxString VolumeTypeToString (VolumeType::Enum type, VolumeProtection::Enum protection) const;
        !            69: 
        !            70:                Event PreferencesUpdatedEvent;
        !            71: 
        !            72:                struct BusyScope
        !            73:                {
        !            74:                        BusyScope (const UserInterface *userInterface) : UI (userInterface) { UI->BeginBusyState (); }
        !            75:                        ~BusyScope () { UI->EndBusyState (); }
        !            76:                        const UserInterface *UI;
        !            77:                };
        !            78: 
        !            79:        protected:
        !            80:                UserInterface ();
        !            81:                virtual bool OnExceptionInMainLoop () { throw; }
        !            82:                virtual void OnUnhandledException ();
        !            83:                virtual void OnVolumeMounted (EventArgs &args);
        !            84:                virtual void OnWarning (EventArgs &args);
        !            85:                virtual bool ProcessCommandLine ();
        !            86: 
        !            87:                virtual wxString ExceptionToString (const Exception &ex) const;
        !            88:                virtual wxString ExceptionTypeToString (const std::type_info &ex) const;
        !            89: 
        !            90:                UserPreferences Preferences;
        !            91:                UserInterfaceType::Enum InterfaceType;
        !            92: 
        !            93:        private:
        !            94:                UserInterface (const UserInterface &);
        !            95:                UserInterface &operator= (const UserInterface &);
        !            96:        };
        !            97: }
        !            98: 
        !            99: #endif // TC_HEADER_Main_UserInterface

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.