Changeset 94498 in vbox
- Timestamp:
- Apr 6, 2022 4:03:44 PM (2 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 6 edited
- 2 copied
-
Makefile.kmk (modified) (2 diffs)
-
src/converter/UIConverterBackend.h (modified) (2 diffs)
-
src/converter/UIConverterBackendGlobal.cpp (modified) (2 diffs)
-
src/extradata/UIExtraDataDefs.h (modified) (1 diff)
-
src/settings/editors/UIDiskEncryptionSettingsEditor.cpp (copied) (copied from trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIVRDESettingsEditor.cpp ) (7 diffs)
-
src/settings/editors/UIDiskEncryptionSettingsEditor.h (copied) (copied from trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIVRDESettingsEditor.h ) (8 diffs)
-
src/settings/machine/UIMachineSettingsGeneral.cpp (modified) (16 diffs)
-
src/settings/machine/UIMachineSettingsGeneral.h (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk
r94476 r94498 900 900 src/settings/editors/UIColorThemeEditor.h \ 901 901 src/settings/editors/UIDefaultMachineFolderEditor.h \ 902 src/settings/editors/UIDiskEncryptionSettingsEditor.h \ 902 903 src/settings/editors/UIDragAndDropEditor.h \ 903 904 src/settings/editors/UIGlobalDisplayFeaturesEditor.h \ … … 1464 1465 src/settings/editors/UIColorThemeEditor.cpp \ 1465 1466 src/settings/editors/UIDefaultMachineFolderEditor.cpp \ 1467 src/settings/editors/UIDiskEncryptionSettingsEditor.cpp \ 1466 1468 src/settings/editors/UIDragAndDropEditor.cpp \ 1467 1469 src/settings/editors/UIGlobalDisplayFeaturesEditor.cpp \ -
trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackend.h
r93408 r94498 112 112 template<> SHARED_LIBRARY_STUFF bool canConvert<DetailsElementType>(); 113 113 template<> SHARED_LIBRARY_STUFF bool canConvert<PreviewUpdateIntervalType>(); 114 template<> SHARED_LIBRARY_STUFF bool canConvert<UIDiskEncryptionCipherType>(); 114 115 template<> SHARED_LIBRARY_STUFF bool canConvert<GUIFeatureType>(); 115 116 template<> SHARED_LIBRARY_STUFF bool canConvert<GlobalSettingsPageType>(); … … 243 244 template<> SHARED_LIBRARY_STUFF int toInternalInteger(const PreviewUpdateIntervalType &previewUpdateIntervalType); 244 245 template<> SHARED_LIBRARY_STUFF PreviewUpdateIntervalType fromInternalInteger<PreviewUpdateIntervalType>(const int &iPreviewUpdateIntervalType); 246 template<> SHARED_LIBRARY_STUFF QString toInternalString(const UIDiskEncryptionCipherType &enmDiskEncryptionCipherType); 247 template<> SHARED_LIBRARY_STUFF UIDiskEncryptionCipherType fromInternalString<UIDiskEncryptionCipherType>(const QString &strDiskEncryptionCipherType); 248 template<> SHARED_LIBRARY_STUFF QString toString(const UIDiskEncryptionCipherType &enmDiskEncryptionCipherType); 249 template<> SHARED_LIBRARY_STUFF UIDiskEncryptionCipherType fromString<UIDiskEncryptionCipherType>(const QString &strDiskEncryptionCipherType); 245 250 template<> SHARED_LIBRARY_STUFF QString toInternalString(const GUIFeatureType &guiFeatureType); 246 251 template<> SHARED_LIBRARY_STUFF GUIFeatureType fromInternalString<GUIFeatureType>(const QString &strGuiFeatureType); -
trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendGlobal.cpp
r93996 r94498 67 67 template<> bool canConvert<DetailsElementType>() { return true; } 68 68 template<> bool canConvert<PreviewUpdateIntervalType>() { return true; } 69 template<> bool canConvert<UIDiskEncryptionCipherType>() { return true; } 69 70 template<> bool canConvert<GUIFeatureType>() { return true; } 70 71 template<> bool canConvert<GlobalSettingsPageType>() { return true; } … … 1956 1957 } 1957 1958 1959 /* QString <= UIDiskEncryptionCipherType: */ 1960 template<> QString toInternalString(const UIDiskEncryptionCipherType &enmDiskEncryptionCipherType) 1961 { 1962 switch (enmDiskEncryptionCipherType) 1963 { 1964 case UIDiskEncryptionCipherType_XTS256: return "AES-XTS256-PLAIN64"; 1965 case UIDiskEncryptionCipherType_XTS128: return "AES-XTS128-PLAIN64"; 1966 default: break; 1967 } 1968 return QString(); 1969 } 1970 1971 /* UIDiskEncryptionCipherType <= QString: */ 1972 template<> UIDiskEncryptionCipherType fromInternalString<UIDiskEncryptionCipherType>(const QString &strDiskEncryptionCipherType) 1973 { 1974 if (strDiskEncryptionCipherType.compare("AES-XTS256-PLAIN64", Qt::CaseInsensitive) == 0) 1975 return UIDiskEncryptionCipherType_XTS256; 1976 if (strDiskEncryptionCipherType.compare("AES-XTS128-PLAIN64", Qt::CaseInsensitive) == 0) 1977 return UIDiskEncryptionCipherType_XTS128; 1978 return UIDiskEncryptionCipherType_Unchanged; 1979 } 1980 1981 /* QString <= UIDiskEncryptionCipherType: */ 1982 template<> QString toString(const UIDiskEncryptionCipherType &enmDiskEncryptionCipherType) 1983 { 1984 switch (enmDiskEncryptionCipherType) 1985 { 1986 case UIDiskEncryptionCipherType_XTS256: return "AES-XTS256-PLAIN64"; 1987 case UIDiskEncryptionCipherType_XTS128: return "AES-XTS128-PLAIN64"; 1988 default: break; 1989 } 1990 return QApplication::translate("UICommon", "Leave Unchanged", "cipher type"); 1991 } 1992 1993 /* UIDiskEncryptionCipherType <= QString: */ 1994 template<> UIDiskEncryptionCipherType fromString<UIDiskEncryptionCipherType>(const QString &strDiskEncryptionCipherType) 1995 { 1996 if (strDiskEncryptionCipherType.compare("AES-XTS256-PLAIN64", Qt::CaseInsensitive) == 0) 1997 return UIDiskEncryptionCipherType_XTS256; 1998 if (strDiskEncryptionCipherType.compare("AES-XTS128-PLAIN64", Qt::CaseInsensitive) == 0) 1999 return UIDiskEncryptionCipherType_XTS128; 2000 return UIDiskEncryptionCipherType_Unchanged; 2001 } 2002 1958 2003 /* QString <= GUIFeatureType: */ 1959 2004 template<> QString toInternalString(const GUIFeatureType &guiFeatureType) -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h
r94005 r94498 984 984 985 985 986 /** Selector UI: Disk encryption cipher types. */ 987 enum UIDiskEncryptionCipherType 988 { 989 UIDiskEncryptionCipherType_Unchanged, 990 UIDiskEncryptionCipherType_XTS256, 991 UIDiskEncryptionCipherType_XTS128, 992 UIDiskEncryptionCipherType_Max 993 }; 994 Q_DECLARE_METATYPE(UIDiskEncryptionCipherType); 995 996 986 997 /** Runtime UI: Visual-state types. */ 987 998 enum UIVisualStateType -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIDiskEncryptionSettingsEditor.cpp
r94497 r94498 1 1 /* $Id$ */ 2 2 /** @file 3 * VBox Qt GUI - UI VRDESettingsEditor class implementation.3 * VBox Qt GUI - UIDiskEncryptionSettingsEditor class implementation. 4 4 */ 5 5 … … 25 25 /* GUI includes: */ 26 26 #include "UIConverter.h" 27 #include "UI VRDESettingsEditor.h"28 29 30 UI VRDESettingsEditor::UIVRDESettingsEditor(QWidget *pParent /* = 0 */)27 #include "UIDiskEncryptionSettingsEditor.h" 28 29 30 UIDiskEncryptionSettingsEditor::UIDiskEncryptionSettingsEditor(QWidget *pParent /* = 0 */) 31 31 : QIWithRetranslateUI<QWidget>(pParent) 32 32 , m_fFeatureEnabled(false) 33 , m_enmAuthType(KAuthType_Max) 34 , m_fMultipleConnectionsAllowed(false) 33 , m_enmCipherType(UIDiskEncryptionCipherType_Max) 35 34 , m_pCheckboxFeature(0) 36 35 , m_pWidgetSettings(0) 37 , m_pLabelPort(0) 38 , m_pEditorPort(0) 39 , m_pLabelAuthMethod(0) 40 , m_pComboAuthType(0) 41 , m_pLabelTimeout(0) 42 , m_pEditorTimeout(0) 43 , m_pLabelOptions(0) 44 , m_pCheckboxMultipleConnections(0) 36 , m_pLabelCipher(0) 37 , m_pComboCipher(0) 38 , m_pLabelEncryptionPassword(0) 39 , m_pEditorEncryptionPassword(0) 40 , m_pLabelEncryptionPasswordConfirm(0) 41 , m_pEditorEncryptionPasswordConfirm(0) 45 42 { 46 43 prepare(); 47 44 } 48 45 49 void UI VRDESettingsEditor::setFeatureEnabled(bool fEnabled)46 void UIDiskEncryptionSettingsEditor::setFeatureEnabled(bool fEnabled) 50 47 { 51 48 /* Update cached value and … … 62 59 } 63 60 64 bool UI VRDESettingsEditor::isFeatureEnabled() const61 bool UIDiskEncryptionSettingsEditor::isFeatureEnabled() const 65 62 { 66 63 return m_pCheckboxFeature ? m_pCheckboxFeature->isChecked() : m_fFeatureEnabled; 67 64 } 68 65 69 void UIVRDESettingsEditor::setVRDEOptionsAvailable(bool fAvailable) 70 { 71 if (m_pLabelOptions) 72 m_pLabelOptions->setEnabled(fAvailable); 73 if (m_pCheckboxMultipleConnections) 74 m_pCheckboxMultipleConnections->setEnabled(fAvailable); 75 } 76 77 void UIVRDESettingsEditor::setPort(const QString &strPort) 78 { 79 /* Update cached value and 80 * line-edit if value has changed: */ 81 if (m_strPort != strPort) 82 { 83 m_strPort = strPort; 84 if (m_pEditorPort) 85 m_pEditorPort->setText(m_strPort); 86 } 87 } 88 89 QString UIVRDESettingsEditor::port() const 90 { 91 return m_pEditorPort ? m_pEditorPort->text() : m_strPort; 92 } 93 94 void UIVRDESettingsEditor::setAuthType(const KAuthType &enmType) 66 void UIDiskEncryptionSettingsEditor::setCipherType(const UIDiskEncryptionCipherType &enmType) 95 67 { 96 68 /* Update cached value and 97 69 * combo if value has changed: */ 98 if (m_enmAuthType != enmType) 99 { 100 m_enmAuthType = enmType; 101 repopulateComboAuthType(); 102 } 103 } 104 105 KAuthType UIVRDESettingsEditor::authType() const 106 { 107 return m_pComboAuthType ? m_pComboAuthType->currentData().value<KAuthType>() : m_enmAuthType; 108 } 109 110 void UIVRDESettingsEditor::setTimeout(const QString &strTimeout) 111 { 112 /* Update cached value and 113 * line-edit if value has changed: */ 114 if (m_strTimeout != strTimeout) 115 { 116 m_strTimeout = strTimeout; 117 if (m_pEditorTimeout) 118 m_pEditorTimeout->setText(m_strTimeout); 119 } 120 } 121 122 QString UIVRDESettingsEditor::timeout() const 123 { 124 return m_pEditorTimeout ? m_pEditorTimeout->text() : m_strTimeout; 125 } 126 127 void UIVRDESettingsEditor::setMultipleConnectionsAllowed(bool fAllowed) 128 { 129 /* Update cached value and 130 * check-box if value has changed: */ 131 if (m_fMultipleConnectionsAllowed != fAllowed) 132 { 133 m_fMultipleConnectionsAllowed = fAllowed; 134 if (m_pCheckboxMultipleConnections) 135 m_pCheckboxMultipleConnections->setChecked(m_fMultipleConnectionsAllowed); 136 } 137 } 138 139 bool UIVRDESettingsEditor::isMultipleConnectionsAllowed() const 140 { 141 return m_pCheckboxMultipleConnections ? m_pCheckboxMultipleConnections->isChecked() : m_fMultipleConnectionsAllowed; 142 } 143 144 void UIVRDESettingsEditor::retranslateUi() 70 if (m_enmCipherType != enmType) 71 { 72 m_enmCipherType = enmType; 73 repopulateCombo(); 74 } 75 } 76 77 UIDiskEncryptionCipherType UIDiskEncryptionSettingsEditor::cipherType() const 78 { 79 return m_pComboCipher ? m_pComboCipher->currentData().value<UIDiskEncryptionCipherType>() : m_enmCipherType; 80 } 81 82 QString UIDiskEncryptionSettingsEditor::password1() const 83 { 84 return m_pEditorEncryptionPassword ? m_pEditorEncryptionPassword->text() : m_strPassword1; 85 } 86 87 QString UIDiskEncryptionSettingsEditor::password2() const 88 { 89 return m_pEditorEncryptionPasswordConfirm ? m_pEditorEncryptionPasswordConfirm->text() : m_strPassword2; 90 } 91 92 void UIDiskEncryptionSettingsEditor::retranslateUi() 145 93 { 146 94 if (m_pCheckboxFeature) 147 95 { 148 m_pCheckboxFeature->setText(tr("&Enable Server")); 149 m_pCheckboxFeature->setToolTip(tr("When checked, the VM will act as a Remote Desktop Protocol (RDP) server, allowing " 150 "remote clients to connect and operate the VM (when it is running) using a standard " 151 "RDP client.")); 152 } 153 154 if (m_pLabelPort) 155 m_pLabelPort->setText(tr("Server &Port:")); 156 if (m_pEditorPort) 157 m_pEditorPort->setToolTip(tr("Holds the VRDP Server port number. You may specify 0 (zero), to select port 3389, the " 158 "standard port for RDP.")); 159 160 if (m_pLabelAuthMethod) 161 m_pLabelAuthMethod->setText(tr("Authentication &Method:")); 162 if (m_pComboAuthType) 163 { 164 for (int iIndex = 0; iIndex < m_pComboAuthType->count(); ++iIndex) 96 m_pCheckboxFeature->setText(tr("En&able Disk Encryption")); 97 m_pCheckboxFeature->setToolTip(tr("When checked, disks attached to this virtual machine will be encrypted.")); 98 } 99 100 if (m_pLabelCipher) 101 m_pLabelCipher->setText(tr("Disk Encryption C&ipher:")); 102 if (m_pComboCipher) 103 { 104 for (int iIndex = 0; iIndex < m_pComboCipher->count(); ++iIndex) 165 105 { 166 const KAuthType enmType = m_pComboAuthType->itemData(iIndex).value<KAuthType>();167 m_pCombo AuthType->setItemText(iIndex, gpConverter->toString(enmType));106 const UIDiskEncryptionCipherType enmType = m_pComboCipher->itemData(iIndex).value<UIDiskEncryptionCipherType>(); 107 m_pComboCipher->setItemText(iIndex, gpConverter->toString(enmType)); 168 108 } 169 m_pComboAuthType->setToolTip(tr("Selects the VRDP authentication method.")); 170 } 171 172 if (m_pLabelTimeout) 173 m_pLabelTimeout->setText(tr("Authentication &Timeout:")); 174 if (m_pEditorTimeout) 175 m_pEditorTimeout->setToolTip(tr("Holds the timeout for guest authentication, in milliseconds.")); 176 177 if (m_pLabelOptions) 178 m_pLabelOptions->setText(tr("Extended Features:")); 179 if (m_pCheckboxMultipleConnections) 180 { 181 m_pCheckboxMultipleConnections->setText(tr("&Allow Multiple Connections")); 182 m_pCheckboxMultipleConnections->setToolTip(tr("When checked, multiple simultaneous connections to the VM are " 183 "permitted.")); 184 } 185 } 186 187 void UIVRDESettingsEditor::sltHandleFeatureToggled(bool fEnabled) 109 m_pComboCipher->setToolTip(tr("Holds the cipher to be used for encrypting the virtual machine disks.")); 110 } 111 112 if (m_pLabelEncryptionPassword) 113 m_pLabelEncryptionPassword->setText(tr("E&nter New Password:")); 114 if (m_pEditorEncryptionPassword) 115 m_pEditorEncryptionPassword->setToolTip(tr("Holds the encryption password for disks attached to this virtual machine.")); 116 if (m_pLabelEncryptionPasswordConfirm) 117 m_pLabelEncryptionPasswordConfirm->setText(tr("C&onfirm New Password:")); 118 if (m_pEditorEncryptionPasswordConfirm) 119 m_pEditorEncryptionPasswordConfirm->setToolTip(tr("Confirms the disk encryption password.")); 120 121 /* Translate Cipher type combo: */ 122 m_pComboCipher->setItemText(0, tr("Leave Unchanged", "cipher type")); 123 } 124 125 void UIDiskEncryptionSettingsEditor::sltHandleFeatureToggled(bool fEnabled) 188 126 { 189 127 /* Update widget availability: */ … … 192 130 193 131 /* Notify listeners: */ 194 emit sig Changed();195 } 196 197 void UI VRDESettingsEditor::prepare()132 emit sigStatusChanged(); 133 } 134 135 void UIDiskEncryptionSettingsEditor::prepare() 198 136 { 199 137 /* Prepare everything: */ … … 205 143 } 206 144 207 void UI VRDESettingsEditor::prepareWidgets()145 void UIDiskEncryptionSettingsEditor::prepareWidgets() 208 146 { 209 147 /* Prepare main layout: */ … … 228 166 if (m_pWidgetSettings) 229 167 { 230 /* Prepare 'settings'layout: */231 QGridLayout * pLayoutRemoteDisplaySettings = new QGridLayout(m_pWidgetSettings);232 if ( pLayoutRemoteDisplaySettings)168 /* Prepare encryption settings widget layout: */ 169 QGridLayout *m_pLayoutSettings = new QGridLayout(m_pWidgetSettings); 170 if (m_pLayoutSettings) 233 171 { 234 pLayoutRemoteDisplaySettings->setContentsMargins(0, 0, 0, 0); 235 pLayoutRemoteDisplaySettings->setColumnStretch(1, 1); 236 237 /* Prepare 'port' label: */ 238 m_pLabelPort = new QLabel(m_pWidgetSettings); 239 if (m_pLabelPort) 240 { 241 m_pLabelPort->setAlignment(Qt::AlignRight | Qt::AlignVCenter); 242 pLayoutRemoteDisplaySettings->addWidget(m_pLabelPort, 0, 0); 243 } 244 /* Prepare 'port' editor: */ 245 m_pEditorPort = new QLineEdit(m_pWidgetSettings); 246 if (m_pEditorPort) 247 { 248 if (m_pLabelPort) 249 m_pLabelPort->setBuddy(m_pEditorPort); 250 m_pEditorPort->setValidator(new QRegularExpressionValidator( 251 QRegularExpression("(([0-9]{1,5}(\\-[0-9]{1,5}){0,1}),)*([0-9]{1,5}(\\-[0-9]{1,5}){0,1})"), this)); 252 253 pLayoutRemoteDisplaySettings->addWidget(m_pEditorPort, 0, 1, 1, 2); 254 } 255 256 /* Prepare 'auth type' label: */ 257 m_pLabelAuthMethod = new QLabel(m_pWidgetSettings); 258 if (m_pLabelAuthMethod) 259 { 260 m_pLabelAuthMethod->setAlignment(Qt::AlignRight | Qt::AlignVCenter); 261 pLayoutRemoteDisplaySettings->addWidget(m_pLabelAuthMethod, 1, 0); 262 } 263 /* Prepare 'auth type' combo: */ 264 m_pComboAuthType = new QComboBox(m_pWidgetSettings); 265 if (m_pComboAuthType) 266 { 267 if (m_pLabelAuthMethod) 268 m_pLabelAuthMethod->setBuddy(m_pComboAuthType); 269 m_pComboAuthType->setSizeAdjustPolicy(QComboBox::AdjustToContents); 270 271 pLayoutRemoteDisplaySettings->addWidget(m_pComboAuthType, 1, 1, 1, 2); 272 } 273 274 /* Prepare 'timeout' label: */ 275 m_pLabelTimeout = new QLabel(m_pWidgetSettings); 276 if (m_pLabelTimeout) 277 { 278 m_pLabelTimeout->setAlignment(Qt::AlignRight | Qt::AlignVCenter); 279 pLayoutRemoteDisplaySettings->addWidget(m_pLabelTimeout, 2, 0); 280 } 281 /* Prepare 'timeout' editor: */ 282 m_pEditorTimeout = new QLineEdit(m_pWidgetSettings); 283 if (m_pEditorTimeout) 284 { 285 if (m_pLabelTimeout) 286 m_pLabelTimeout->setBuddy(m_pEditorTimeout); 287 m_pEditorTimeout->setValidator(new QIntValidator(this)); 288 289 pLayoutRemoteDisplaySettings->addWidget(m_pEditorTimeout, 2, 1, 1, 2); 290 } 291 292 /* Prepare 'options' label: */ 293 m_pLabelOptions = new QLabel(m_pWidgetSettings); 294 if (m_pLabelOptions) 295 { 296 m_pLabelOptions->setAlignment(Qt::AlignRight | Qt::AlignVCenter); 297 pLayoutRemoteDisplaySettings->addWidget(m_pLabelOptions, 3, 0); 298 } 299 /* Prepare 'multiple connections' check-box: */ 300 m_pCheckboxMultipleConnections = new QCheckBox(m_pWidgetSettings); 301 if (m_pCheckboxMultipleConnections) 302 pLayoutRemoteDisplaySettings->addWidget(m_pCheckboxMultipleConnections, 3, 1); 172 m_pLayoutSettings->setContentsMargins(0, 0, 0, 0); 173 174 /* Prepare encryption cipher label: */ 175 m_pLabelCipher = new QLabel(m_pWidgetSettings); 176 if (m_pLabelCipher) 177 { 178 m_pLabelCipher->setAlignment(Qt::AlignRight | Qt::AlignVCenter); 179 m_pLayoutSettings->addWidget(m_pLabelCipher, 0, 0); 180 } 181 /* Prepare encryption cipher combo: */ 182 m_pComboCipher = new QComboBox(m_pWidgetSettings); 183 if (m_pComboCipher) 184 { 185 if (m_pLabelCipher) 186 m_pLabelCipher->setBuddy(m_pComboCipher); 187 m_pLayoutSettings->addWidget(m_pComboCipher, 0, 1); 188 } 189 190 /* Prepare encryption password label: */ 191 m_pLabelEncryptionPassword = new QLabel(m_pWidgetSettings); 192 if (m_pLabelEncryptionPassword) 193 { 194 m_pLabelEncryptionPassword->setAlignment(Qt::AlignRight | Qt::AlignVCenter); 195 m_pLayoutSettings->addWidget(m_pLabelEncryptionPassword, 1, 0); 196 } 197 /* Prepare encryption password editor: */ 198 m_pEditorEncryptionPassword = new QLineEdit(m_pWidgetSettings); 199 if (m_pEditorEncryptionPassword) 200 { 201 if (m_pLabelEncryptionPassword) 202 m_pLabelEncryptionPassword->setBuddy(m_pEditorEncryptionPassword); 203 m_pEditorEncryptionPassword->setEchoMode(QLineEdit::Password); 204 205 m_pLayoutSettings->addWidget(m_pEditorEncryptionPassword, 1, 1); 206 } 207 208 /* Prepare encryption confirm password label: */ 209 m_pLabelEncryptionPasswordConfirm = new QLabel(m_pWidgetSettings); 210 if (m_pLabelEncryptionPasswordConfirm) 211 { 212 m_pLabelEncryptionPasswordConfirm->setAlignment(Qt::AlignRight | Qt::AlignVCenter); 213 m_pLayoutSettings->addWidget(m_pLabelEncryptionPasswordConfirm, 2, 0); 214 } 215 /* Prepare encryption confirm password editor: */ 216 m_pEditorEncryptionPasswordConfirm = new QLineEdit(m_pWidgetSettings); 217 if (m_pEditorEncryptionPasswordConfirm) 218 { 219 if (m_pLabelEncryptionPasswordConfirm) 220 m_pLabelEncryptionPasswordConfirm->setBuddy(m_pEditorEncryptionPasswordConfirm); 221 m_pEditorEncryptionPasswordConfirm->setEchoMode(QLineEdit::Password); 222 223 m_pLayoutSettings->addWidget(m_pEditorEncryptionPasswordConfirm, 2, 1); 224 } 303 225 } 304 226 … … 312 234 } 313 235 314 void UI VRDESettingsEditor::prepareConnections()236 void UIDiskEncryptionSettingsEditor::prepareConnections() 315 237 { 316 238 if (m_pCheckboxFeature) 317 connect(m_pCheckboxFeature, &QCheckBox::toggled, this, &UIVRDESettingsEditor::sltHandleFeatureToggled); 318 if (m_pEditorPort) 319 connect(m_pEditorPort, &QLineEdit::textChanged, this, &UIVRDESettingsEditor::sigChanged); 320 if (m_pEditorTimeout) 321 connect(m_pEditorTimeout, &QLineEdit::textChanged, this, &UIVRDESettingsEditor::sigChanged); 322 } 323 324 void UIVRDESettingsEditor::repopulateComboAuthType() 325 { 326 if (m_pComboAuthType) 239 connect(m_pCheckboxFeature, &QCheckBox::toggled, 240 this, &UIDiskEncryptionSettingsEditor::sltHandleFeatureToggled); 241 if (m_pComboCipher) 242 connect(m_pComboCipher, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), 243 this, &UIDiskEncryptionSettingsEditor::sigCipherChanged); 244 if (m_pEditorEncryptionPassword) 245 connect(m_pEditorEncryptionPassword, &QLineEdit::textEdited, 246 this, &UIDiskEncryptionSettingsEditor::sigPasswordChanged); 247 if (m_pEditorEncryptionPasswordConfirm) 248 connect(m_pEditorEncryptionPasswordConfirm, &QLineEdit::textEdited, 249 this, &UIDiskEncryptionSettingsEditor::sigPasswordChanged); 250 } 251 252 void UIDiskEncryptionSettingsEditor::repopulateCombo() 253 { 254 if (m_pComboCipher) 327 255 { 328 256 /* Clear combo first of all: */ 329 m_pCombo AuthType->clear();257 m_pComboCipher->clear(); 330 258 331 259 /// @todo get supported auth types (API not implemented), not hardcoded! 332 QVector<KAuthType> authTypes = QVector<KAuthType>() << KAuthType_Null 333 << KAuthType_External 334 << KAuthType_Guest; 260 QVector<UIDiskEncryptionCipherType> cipherTypes = 261 QVector<UIDiskEncryptionCipherType>() << UIDiskEncryptionCipherType_Unchanged 262 << UIDiskEncryptionCipherType_XTS256 263 << UIDiskEncryptionCipherType_XTS128; 335 264 336 265 /* Take into account currently cached value: */ 337 if (! authTypes.contains(m_enmAuthType))338 authTypes.prepend(m_enmAuthType);266 if (!cipherTypes.contains(m_enmCipherType)) 267 cipherTypes.prepend(m_enmCipherType); 339 268 340 269 /* Populate combo finally: */ 341 foreach (const KAuthType &enmType, authTypes)342 m_pCombo AuthType->addItem(gpConverter->toString(enmType), QVariant::fromValue(enmType));270 foreach (const UIDiskEncryptionCipherType &enmType, cipherTypes) 271 m_pComboCipher->addItem(gpConverter->toString(enmType), QVariant::fromValue(enmType)); 343 272 344 273 /* Look for proper index to choose: */ 345 const int iIndex = m_pCombo AuthType->findData(QVariant::fromValue(m_enmAuthType));274 const int iIndex = m_pComboCipher->findData(QVariant::fromValue(m_enmCipherType)); 346 275 if (iIndex != -1) 347 m_pCombo AuthType->setCurrentIndex(iIndex);348 } 349 } 276 m_pComboCipher->setCurrentIndex(iIndex); 277 } 278 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIDiskEncryptionSettingsEditor.h
r94497 r94498 1 1 /* $Id$ */ 2 2 /** @file 3 * VBox Qt GUI - UI VRDESettingsEditor class declaration.3 * VBox Qt GUI - UIDiskEncryptionSettingsEditor class declaration. 4 4 */ 5 5 … … 16 16 */ 17 17 18 #ifndef FEQT_INCLUDED_SRC_settings_editors_UI VRDESettingsEditor_h19 #define FEQT_INCLUDED_SRC_settings_editors_UI VRDESettingsEditor_h18 #ifndef FEQT_INCLUDED_SRC_settings_editors_UIDiskEncryptionSettingsEditor_h 19 #define FEQT_INCLUDED_SRC_settings_editors_UIDiskEncryptionSettingsEditor_h 20 20 #ifndef RT_WITHOUT_PRAGMA_ONCE 21 21 # pragma once … … 26 26 27 27 /* COM includes: */ 28 #include " COMEnums.h"28 #include "UIExtraDataDefs.h" 29 29 30 30 /* Forward declarations: */ … … 35 35 class QWidget; 36 36 37 /** QWidget subclass used as a VRDEsettings editor. */38 class SHARED_LIBRARY_STUFF UI VRDESettingsEditor : public QIWithRetranslateUI<QWidget>37 /** QWidget subclass used as a disk encryption settings editor. */ 38 class SHARED_LIBRARY_STUFF UIDiskEncryptionSettingsEditor : public QIWithRetranslateUI<QWidget> 39 39 { 40 40 Q_OBJECT; … … 42 42 signals: 43 43 44 /** Notify listeners about some status changed. */ 45 void sigChanged(); 44 /** Notify listeners about status changed. */ 45 void sigStatusChanged(); 46 /** Notify listeners about cipher changed. */ 47 void sigCipherChanged(); 48 /** Notify listeners about password changed. */ 49 void sigPasswordChanged(); 46 50 47 51 public: 48 52 49 53 /** Constructs editor passing @a pParent to the base-class. */ 50 UI VRDESettingsEditor(QWidget *pParent = 0);54 UIDiskEncryptionSettingsEditor(QWidget *pParent = 0); 51 55 52 56 /** Defines whether feature is @a fEnabled. */ … … 55 59 bool isFeatureEnabled() const; 56 60 57 /** Defines whether VRDE options are @a fAvailable. */ 58 void setVRDEOptionsAvailable(bool fAvailable); 61 /** Defines cipher @a enmType. */ 62 void setCipherType(const UIDiskEncryptionCipherType &enmType); 63 /** Returns cipher type. */ 64 UIDiskEncryptionCipherType cipherType() const; 59 65 60 /** Defines @a strPort. */ 61 void setPort(const QString &strPort); 62 /** Returns port. */ 63 QString port() const; 64 65 /** Defines auth @a enmType. */ 66 void setAuthType(const KAuthType &enmType); 67 /** Returns auth type. */ 68 KAuthType authType() const; 69 70 /** Defines @a strTimeout. */ 71 void setTimeout(const QString &strTimeout); 72 /** Returns timeout. */ 73 QString timeout() const; 74 75 /** Defines whether multiple connections @a fAllowed. */ 76 void setMultipleConnectionsAllowed(bool fAllowed); 77 /** Returns whether multiple connections allowed. */ 78 bool isMultipleConnectionsAllowed() const; 66 /** Returns password 1. */ 67 QString password1() const; 68 /** Returns password 2. */ 69 QString password2() const; 79 70 80 71 protected: … … 97 88 void prepareConnections(); 98 89 99 /** Repopulates auth typecombo-box. */100 void repopulateCombo AuthType();90 /** Repopulates combo-box. */ 91 void repopulateCombo(); 101 92 102 93 /** @name Values 103 94 * @{ */ 104 95 /** Holds whether feature is enabled. */ 105 bool m_fFeatureEnabled; 106 /** Holds the port. */ 107 QString m_strPort; 108 /** Holds the auth type. */ 109 KAuthType m_enmAuthType; 110 /** Holds the timeout. */ 111 QString m_strTimeout; 112 /** Returns whether multiple connections allowed. */ 113 bool m_fMultipleConnectionsAllowed; 96 bool m_fFeatureEnabled; 97 /** Holds the cipher type. */ 98 UIDiskEncryptionCipherType m_enmCipherType; 99 /** Holds the password 1. */ 100 QString m_strPassword1; 101 /** Holds the password 2. */ 102 QString m_strPassword2; 114 103 /** @} */ 115 104 … … 120 109 /** Holds the settings widget instance. */ 121 110 QWidget *m_pWidgetSettings; 122 /** Holds the port label instance. */ 123 QLabel *m_pLabelPort; 124 /** Holds the port editor instance. */ 125 QLineEdit *m_pEditorPort; 126 /** Holds the port auth method label instance. */ 127 QLabel *m_pLabelAuthMethod; 128 /** Holds the port auth method combo instance. */ 129 QComboBox *m_pComboAuthType; 130 /** Holds the timeout label instance. */ 131 QLabel *m_pLabelTimeout; 132 /** Holds the timeout editor instance. */ 133 QLineEdit *m_pEditorTimeout; 134 /** Holds the options label instance. */ 135 QLabel *m_pLabelOptions; 136 /** Holds the multiple connection check-box instance. */ 137 QCheckBox *m_pCheckboxMultipleConnections; 111 /** Holds the cipher type label instance. */ 112 QLabel *m_pLabelCipher; 113 /** Holds the cipher type combo instance. */ 114 QComboBox *m_pComboCipher; 115 /** Holds the enter password label instance. */ 116 QLabel *m_pLabelEncryptionPassword; 117 /** Holds the enter password editor instance. */ 118 QLineEdit *m_pEditorEncryptionPassword; 119 /** Holds the confirm password label instance. */ 120 QLabel *m_pLabelEncryptionPasswordConfirm; 121 /** Holds the confirm password editor instance. */ 122 QLineEdit *m_pEditorEncryptionPasswordConfirm; 138 123 /** @} */ 139 124 }; 140 125 141 #endif /* !FEQT_INCLUDED_SRC_settings_editors_UI VRDESettingsEditor_h */126 #endif /* !FEQT_INCLUDED_SRC_settings_editors_UIDiskEncryptionSettingsEditor_h */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.cpp
r94476 r94498 28 28 #include "QITabWidget.h" 29 29 #include "QIWidgetValidator.h" 30 #include "UIAddDiskEncryptionPasswordDialog.h" 30 31 #include "UICommon.h" 31 32 #include "UIConverter.h" 33 #include "UIDiskEncryptionSettingsEditor.h" 32 34 #include "UIDragAndDropEditor.h" 33 35 #include "UIErrorString.h" … … 64 66 , m_fEncryptionCipherChanged(false) 65 67 , m_fEncryptionPasswordChanged(false) 66 , m_ iEncryptionCipherIndex(-1)68 , m_enmEncryptionCipherType(UIDiskEncryptionCipherType_Max) 67 69 , m_strEncryptionPassword(QString()) 68 70 {} … … 108 110 109 111 /** Holds whether the encryption is enabled. */ 110 bool m_fEncryptionEnabled;112 bool m_fEncryptionEnabled; 111 113 /** Holds whether the encryption cipher was changed. */ 112 bool m_fEncryptionCipherChanged;114 bool m_fEncryptionCipherChanged; 113 115 /** Holds whether the encryption password was changed. */ 114 bool m_fEncryptionPasswordChanged;116 bool m_fEncryptionPasswordChanged; 115 117 /** Holds the encryption cipher index. */ 116 int m_iEncryptionCipherIndex;118 UIDiskEncryptionCipherType m_enmEncryptionCipherType; 117 119 /** Holds the encryption password. */ 118 QString m_strEncryptionPassword;120 QString m_strEncryptionPassword; 119 121 /** Holds the encrypted medium ids. */ 120 EncryptedMediumMap m_encryptedMedia;122 EncryptedMediumMap m_encryptedMedia; 121 123 /** Holds the encryption passwords. */ 122 EncryptionPasswordMap m_encryptionPasswords;124 EncryptionPasswordMap m_encryptionPasswords; 123 125 }; 124 126 … … 139 141 , m_pEditorDescription(0) 140 142 , m_pTabEncryption(0) 141 , m_pCheckBoxEncryption(0) 142 , m_pWidgetEncryptionSettings(0) 143 , m_pLabelCipher(0) 144 , m_pComboCipher(0) 145 , m_pLabelEncryptionPassword(0) 146 , m_pEditorEncryptionPassword(0) 147 , m_pLabelEncryptionPasswordConfirm(0) 148 , m_pEditorEncryptionPasswordConfirm(0) 143 , m_pEditorDiskEncryptionSettings(0) 149 144 { 150 145 prepare(); … … 244 239 oldGeneralData.m_fEncryptionPasswordChanged = false; 245 240 if (fEncryptionCipherCommon) 246 oldGeneralData.m_iEncryptionCipherIndex = m_encryptionCiphers.indexOf(strCipher); 247 if (oldGeneralData.m_iEncryptionCipherIndex == -1) 248 oldGeneralData.m_iEncryptionCipherIndex = 0; 241 oldGeneralData.m_enmEncryptionCipherType = gpConverter->fromInternalString<UIDiskEncryptionCipherType>(strCipher); 249 242 oldGeneralData.m_encryptedMedia = encryptedMedia; 250 243 … … 280 273 281 274 /* Load old 'Encryption' data from cache: */ 282 AssertPtrReturnVoid(m_pCheckBoxEncryption); 283 AssertPtrReturnVoid(m_pComboCipher); 284 m_pCheckBoxEncryption->setChecked(oldGeneralData.m_fEncryptionEnabled); 285 m_pComboCipher->setCurrentIndex(oldGeneralData.m_iEncryptionCipherIndex); 275 AssertPtrReturnVoid(m_pEditorDiskEncryptionSettings); 276 m_pEditorDiskEncryptionSettings->setFeatureEnabled(oldGeneralData.m_fEncryptionEnabled); 277 m_pEditorDiskEncryptionSettings->setCipherType(oldGeneralData.m_enmEncryptionCipherType); 286 278 m_fEncryptionCipherChanged = oldGeneralData.m_fEncryptionCipherChanged; 287 279 m_fEncryptionPasswordChanged = oldGeneralData.m_fEncryptionPasswordChanged; … … 318 310 319 311 /* Gather new 'Encryption' data: */ 320 AssertPtrReturnVoid(m_pCheckBoxEncryption); 321 AssertPtrReturnVoid(m_pComboCipher); 322 AssertPtrReturnVoid(m_pEditorEncryptionPassword); 323 newGeneralData.m_fEncryptionEnabled = m_pCheckBoxEncryption->isChecked(); 312 AssertPtrReturnVoid(m_pEditorDiskEncryptionSettings); 313 newGeneralData.m_fEncryptionEnabled = m_pEditorDiskEncryptionSettings->isFeatureEnabled(); 324 314 newGeneralData.m_fEncryptionCipherChanged = m_fEncryptionCipherChanged; 325 315 newGeneralData.m_fEncryptionPasswordChanged = m_fEncryptionPasswordChanged; 326 newGeneralData.m_ iEncryptionCipherIndex = m_pComboCipher->currentIndex();327 newGeneralData.m_strEncryptionPassword = m_pEditor EncryptionPassword->text();316 newGeneralData.m_enmEncryptionCipherType = m_pEditorDiskEncryptionSettings->cipherType(); 317 newGeneralData.m_strEncryptionPassword = m_pEditorDiskEncryptionSettings->password1(); 328 318 newGeneralData.m_encryptedMedia = m_pCache->base().m_encryptedMedia; 329 319 /* If encryption status, cipher or password is changed: */ … … 403 393 404 394 /* Encryption validation: */ 405 AssertPtrReturn(m_p CheckBoxEncryption, false);406 if (m_p CheckBoxEncryption->isChecked())395 AssertPtrReturn(m_pEditorDiskEncryptionSettings, false); 396 if (m_pEditorDiskEncryptionSettings->isFeatureEnabled()) 407 397 { 408 398 /* Encryption Extension Pack presence test: */ … … 418 408 419 409 /* Cipher should be chosen if once changed: */ 420 AssertPtrReturn(m_pComboCipher, false); 421 if (!m_pCache->base().m_fEncryptionEnabled || 422 m_fEncryptionCipherChanged) 423 { 424 if (m_pComboCipher->currentIndex() == 0) 410 if ( !m_pCache->base().m_fEncryptionEnabled 411 || m_fEncryptionCipherChanged) 412 { 413 if (m_pEditorDiskEncryptionSettings->cipherType() == UIDiskEncryptionCipherType_Unchanged) 425 414 message.second << tr("Disk encryption cipher type not specified."); 426 415 fPass = false; … … 428 417 429 418 /* Password should be entered and confirmed if once changed: */ 430 AssertPtrReturn(m_pEditorEncryptionPassword, false);431 AssertPtrReturn(m_pEditorEncryptionPasswordConfirm, false);432 419 if (!m_pCache->base().m_fEncryptionEnabled || 433 420 m_fEncryptionPasswordChanged) 434 421 { 435 if (m_pEditor EncryptionPassword->text().isEmpty())422 if (m_pEditorDiskEncryptionSettings->password1().isEmpty()) 436 423 message.second << tr("Disk encryption password empty."); 437 424 else 438 if (m_pEditor EncryptionPassword->text() !=439 m_pEditor EncryptionPasswordConfirm->text())425 if (m_pEditorDiskEncryptionSettings->password1() != 426 m_pEditorDiskEncryptionSettings->password2()) 440 427 message.second << tr("Disk encryption passwords do not match."); 441 428 fPass = false; … … 479 466 m_pTabWidget->setTabText(m_pTabWidget->indexOf(m_pTabAdvanced), tr("A&dvanced")); 480 467 m_pTabWidget->setTabText(m_pTabWidget->indexOf(m_pTabDescription), tr("D&escription")); 481 m_pCheckBoxEncryption->setToolTip(tr("When checked, disks attached to this virtual machine will be encrypted."));482 m_pCheckBoxEncryption->setText(tr("En&able Disk Encryption"));483 m_pLabelCipher->setText(tr("Disk Encryption C&ipher:"));484 m_pComboCipher->setToolTip(tr("Selects the cipher to be used for encrypting the virtual machine disks."));485 m_pLabelEncryptionPassword->setText(tr("E&nter New Password:"));486 m_pEditorEncryptionPassword->setToolTip(tr("Holds the encryption password for disks attached to this virtual machine."));487 m_pLabelEncryptionPasswordConfirm->setText(tr("C&onfirm New Password:"));488 m_pEditorEncryptionPasswordConfirm->setToolTip(tr("Confirms the disk encryption password."));489 468 m_pTabWidget->setTabText(m_pTabWidget->indexOf(m_pTabEncryption), tr("Disk Enc&ryption")); 490 491 /* Translate Cipher type combo: */492 AssertPtrReturnVoid(m_pComboCipher);493 m_pComboCipher->setItemText(0, tr("Leave Unchanged", "cipher type"));494 469 495 470 /* These editors have own labels, but we want them to be properly layouted according to each other: */ … … 524 499 525 500 /* Polish 'Encryption' availability: */ 526 AssertPtrReturnVoid(m_pCheckBoxEncryption); 527 AssertPtrReturnVoid(m_pWidgetEncryptionSettings); 528 m_pCheckBoxEncryption->setEnabled(isMachineOffline()); 529 m_pWidgetEncryptionSettings->setEnabled(isMachineOffline() && m_pCheckBoxEncryption->isChecked()); 501 AssertPtrReturnVoid(m_pEditorDiskEncryptionSettings); 502 m_pEditorDiskEncryptionSettings->setEnabled(isMachineOffline()); 503 } 504 505 void UIMachineSettingsGeneral::sltHandleEncryptionCipherChanged() 506 { 507 m_fEncryptionCipherChanged = true; 508 revalidate(); 509 } 510 511 void UIMachineSettingsGeneral::sltHandleEncryptionPasswordChanged() 512 { 513 m_fEncryptionCipherChanged = true; 514 m_fEncryptionPasswordChanged = true; 515 revalidate(); 530 516 } 531 517 … … 594 580 { 595 581 /* Prepare 'Advanced' tab layout: */ 596 Q GridLayout *pLayoutAdvanced = new QGridLayout(m_pTabAdvanced);582 QVBoxLayout *pLayoutAdvanced = new QVBoxLayout(m_pTabAdvanced); 597 583 if (pLayoutAdvanced) 598 584 { 599 pLayoutAdvanced->setColumnStretch(2, 1);600 pLayoutAdvanced->setRowStretch(3, 1);601 602 585 /* Prepare snapshot folder editor: */ 603 586 m_pEditorSnapshotFolder = new UISnapshotFolderEditor(m_pTabAdvanced); 604 587 if (m_pEditorSnapshotFolder) 605 pLayoutAdvanced->addWidget(m_pEditorSnapshotFolder , 0, 0);588 pLayoutAdvanced->addWidget(m_pEditorSnapshotFolder); 606 589 607 590 /* Prepare clipboard editor: */ 608 591 m_pEditorClipboard = new UISharedClipboardEditor(m_pTabAdvanced); 609 592 if (m_pEditorClipboard) 610 pLayoutAdvanced->addWidget(m_pEditorClipboard , 1, 0);593 pLayoutAdvanced->addWidget(m_pEditorClipboard); 611 594 612 595 /* Prepare drag&drop editor: */ 613 596 m_pEditorDragAndDrop = new UIDragAndDropEditor(m_pTabAdvanced); 614 597 if (m_pEditorDragAndDrop) 615 pLayoutAdvanced->addWidget(m_pEditorDragAndDrop, 2, 0); 598 pLayoutAdvanced->addWidget(m_pEditorDragAndDrop); 599 600 pLayoutAdvanced->addStretch(); 616 601 } 617 602 … … 650 635 { 651 636 /* Prepare 'Encryption' tab layout: */ 652 Q GridLayout *pLayoutEncryption = new QGridLayout(m_pTabEncryption);637 QVBoxLayout *pLayoutEncryption = new QVBoxLayout(m_pTabEncryption); 653 638 if (pLayoutEncryption) 654 639 { 655 pLayoutEncryption->setRowStretch(2, 1); 656 657 /* Prepare encryption check-box: */ 658 m_pCheckBoxEncryption = new QCheckBox(m_pTabEncryption); 659 if (m_pCheckBoxEncryption) 660 pLayoutEncryption->addWidget(m_pCheckBoxEncryption, 0, 0, 1, 2); 661 662 /* Prepare 20-px shifting spacer: */ 663 QSpacerItem *pSpacerItem = new QSpacerItem(20, 0, QSizePolicy::Fixed, QSizePolicy::Minimum); 664 if (pSpacerItem) 665 pLayoutEncryption->addItem(pSpacerItem, 1, 0); 666 667 /* Prepare encryption settings widget: */ 668 m_pWidgetEncryptionSettings = new QWidget(m_pTabEncryption); 669 if (m_pWidgetEncryptionSettings) 670 { 671 /* Prepare encryption settings widget layout: */ 672 QGridLayout *m_pLayoutEncryptionSettings = new QGridLayout(m_pWidgetEncryptionSettings); 673 if (m_pLayoutEncryptionSettings) 674 { 675 m_pLayoutEncryptionSettings->setContentsMargins(0, 0, 0, 0); 676 677 /* Prepare encryption cipher label: */ 678 m_pLabelCipher = new QLabel(m_pWidgetEncryptionSettings); 679 if (m_pLabelCipher) 680 { 681 m_pLabelCipher->setAlignment(Qt::AlignRight|Qt::AlignVCenter); 682 m_pLayoutEncryptionSettings->addWidget(m_pLabelCipher, 0, 0); 683 } 684 /* Prepare encryption cipher combo: */ 685 m_pComboCipher = new QComboBox(m_pWidgetEncryptionSettings); 686 if (m_pComboCipher) 687 { 688 if (m_pLabelCipher) 689 m_pLabelCipher->setBuddy(m_pComboCipher); 690 m_encryptionCiphers << QString() 691 << "AES-XTS256-PLAIN64" 692 << "AES-XTS128-PLAIN64"; 693 m_pComboCipher->addItems(m_encryptionCiphers); 694 m_pLayoutEncryptionSettings->addWidget(m_pComboCipher, 0, 1); 695 } 696 697 /* Prepare encryption password label: */ 698 m_pLabelEncryptionPassword = new QLabel(m_pWidgetEncryptionSettings); 699 if (m_pLabelEncryptionPassword) 700 { 701 m_pLabelEncryptionPassword->setAlignment(Qt::AlignRight|Qt::AlignVCenter); 702 m_pLayoutEncryptionSettings->addWidget(m_pLabelEncryptionPassword, 1, 0); 703 } 704 /* Prepare encryption password editor: */ 705 m_pEditorEncryptionPassword = new QLineEdit(m_pWidgetEncryptionSettings); 706 if (m_pEditorEncryptionPassword) 707 { 708 if (m_pLabelEncryptionPassword) 709 m_pLabelEncryptionPassword->setBuddy(m_pEditorEncryptionPassword); 710 m_pEditorEncryptionPassword->setEchoMode(QLineEdit::Password); 711 m_pLayoutEncryptionSettings->addWidget(m_pEditorEncryptionPassword, 1, 1); 712 } 713 714 /* Prepare encryption confirm password label: */ 715 m_pLabelEncryptionPasswordConfirm = new QLabel(m_pWidgetEncryptionSettings); 716 if (m_pLabelEncryptionPasswordConfirm) 717 { 718 m_pLabelEncryptionPasswordConfirm->setAlignment(Qt::AlignRight|Qt::AlignVCenter); 719 m_pLayoutEncryptionSettings->addWidget(m_pLabelEncryptionPasswordConfirm, 2, 0); 720 } 721 /* Prepare encryption confirm password editor: */ 722 m_pEditorEncryptionPasswordConfirm = new QLineEdit(m_pWidgetEncryptionSettings); 723 if (m_pEditorEncryptionPasswordConfirm) 724 { 725 if (m_pLabelEncryptionPasswordConfirm) 726 m_pLabelEncryptionPasswordConfirm->setBuddy(m_pEditorEncryptionPasswordConfirm); 727 m_pEditorEncryptionPasswordConfirm->setEchoMode(QLineEdit::Password); 728 m_pLayoutEncryptionSettings->addWidget(m_pEditorEncryptionPasswordConfirm, 2, 1); 729 } 730 } 731 732 pLayoutEncryption->addWidget(m_pWidgetEncryptionSettings, 1, 1); 733 } 640 /* Prepare disk encryption settings editor: */ 641 m_pEditorDiskEncryptionSettings = new UIDiskEncryptionSettingsEditor(m_pTabEncryption); 642 if (m_pEditorDiskEncryptionSettings) 643 pLayoutEncryption->addWidget(m_pEditorDiskEncryptionSettings); 644 645 pLayoutEncryption->addStretch(); 734 646 } 735 647 … … 747 659 748 660 /* Configure 'Encryption' connections: */ 749 connect(m_pCheckBoxEncryption, &QCheckBox::toggled, 750 m_pWidgetEncryptionSettings, &QWidget::setEnabled); 751 connect(m_pCheckBoxEncryption, &QCheckBox::toggled, 661 connect(m_pEditorDiskEncryptionSettings, &UIDiskEncryptionSettingsEditor::sigStatusChanged, 752 662 this, &UIMachineSettingsGeneral::revalidate); 753 connect(m_pComboCipher, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), 754 this, &UIMachineSettingsGeneral::sltMarkEncryptionCipherChanged); 755 connect(m_pComboCipher, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), 756 this, &UIMachineSettingsGeneral::revalidate); 757 connect(m_pEditorEncryptionPassword, &QLineEdit::textEdited, 758 this, &UIMachineSettingsGeneral::sltMarkEncryptionPasswordChanged); 759 connect(m_pEditorEncryptionPassword, &QLineEdit::textEdited, 760 this, &UIMachineSettingsGeneral::revalidate); 761 connect(m_pEditorEncryptionPasswordConfirm, &QLineEdit::textEdited, 762 this, &UIMachineSettingsGeneral::sltMarkEncryptionPasswordChanged); 763 connect(m_pEditorEncryptionPasswordConfirm, &QLineEdit::textEdited, 764 this, &UIMachineSettingsGeneral::revalidate); 663 connect(m_pEditorDiskEncryptionSettings, &UIDiskEncryptionSettingsEditor::sigCipherChanged, 664 this, &UIMachineSettingsGeneral::sltHandleEncryptionCipherChanged); 665 connect(m_pEditorDiskEncryptionSettings, &UIDiskEncryptionSettingsEditor::sigPasswordChanged, 666 this, &UIMachineSettingsGeneral::sltHandleEncryptionPasswordChanged); 765 667 } 766 668 … … 991 893 { 992 894 /* Cipher attribute changed? */ 993 QString strNewCipher; 994 if (newGeneralData.m_fEncryptionCipherChanged) 995 { 996 strNewCipher = newGeneralData.m_fEncryptionEnabled ? 997 m_encryptionCiphers.at(newGeneralData.m_iEncryptionCipherIndex) : QString(); 998 } 895 const QString strNewCipher 896 = newGeneralData.m_fEncryptionCipherChanged && newGeneralData.m_fEncryptionEnabled 897 ? gpConverter->toInternalString(newGeneralData.m_enmEncryptionCipherType) 898 : QString(); 999 899 1000 900 /* Password attribute changed? */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.h
r94476 r94498 23 23 24 24 /* GUI includes: */ 25 #include "UIAddDiskEncryptionPasswordDialog.h"26 25 #include "UISettingsPage.h" 27 26 28 27 /* Forward declarations: */ 29 class QCheckBox;30 class QComboBox;31 class QLineEdit;32 28 class QITabWidget; 29 class UIDiskEncryptionSettingsEditor; 33 30 class UIDragAndDropEditor; 34 31 class UIMachineDescriptionEditor; … … 92 89 private slots: 93 90 94 /** Marks the encryption cipher as changed. */95 void slt MarkEncryptionCipherChanged() { m_fEncryptionCipherChanged = true; }96 /** Marks the encryption cipher and password as changed. */97 void slt MarkEncryptionPasswordChanged() { m_fEncryptionCipherChanged = true; m_fEncryptionPasswordChanged = true; }91 /** Handles encryption cipher change. */ 92 void sltHandleEncryptionCipherChanged(); 93 /** Handles encryption password change. */ 94 void sltHandleEncryptionPasswordChanged(); 98 95 99 96 private: … … 139 136 bool m_fEncryptionPasswordChanged; 140 137 141 /** Holds the hard-coded encryption cipher list.142 * We are hard-coding it because there is no place we can get it from. */143 QStringList m_encryptionCiphers;144 145 138 /** Holds the page data cache instance. */ 146 139 UISettingsCacheMachineGeneral *m_pCache; … … 171 164 172 165 /** Holds the 'Encryption' tab instance. */ 173 QWidget *m_pTabEncryption; 174 /** Holds the encryption check-box instance. */ 175 QCheckBox *m_pCheckBoxEncryption; 176 /** Holds the encryption widget instance. */ 177 QWidget *m_pWidgetEncryptionSettings; 178 /** Holds the cipher label instance. */ 179 QLabel *m_pLabelCipher; 180 /** Holds the cipher combo instance. */ 181 QComboBox *m_pComboCipher; 182 /** Holds the enter password label instance. */ 183 QLabel *m_pLabelEncryptionPassword; 184 /** Holds the enter password editor instance. */ 185 QLineEdit *m_pEditorEncryptionPassword; 186 /** Holds the confirm password label instance. */ 187 QLabel *m_pLabelEncryptionPasswordConfirm; 188 /** Holds the confirm password editor instance. */ 189 QLineEdit *m_pEditorEncryptionPasswordConfirm; 166 QWidget *m_pTabEncryption; 167 /** Holds the cipher settings editor instance. */ 168 UIDiskEncryptionSettingsEditor *m_pEditorDiskEncryptionSettings; 190 169 /** @} */ 191 170 };
Note:
See TracChangeset
for help on using the changeset viewer.

