Changeset 94445 in vbox
- Timestamp:
- Apr 1, 2022 5:19:37 PM (3 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 5 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk
r94436 r94445 908 908 src/settings/editors/UIMachineAudioFeaturesEditor.h \ 909 909 src/settings/editors/UIMachineDisplayScreenFeaturesEditor.h \ 910 src/settings/editors/UIMachineDescriptionEditor.h \ 910 911 src/settings/editors/UIMaximumGuestScreenSizeEditor.h \ 911 912 src/settings/editors/UIMonitorCountEditor.h \ … … 1468 1469 src/settings/editors/UIMachineAudioFeaturesEditor.cpp \ 1469 1470 src/settings/editors/UIMachineDisplayScreenFeaturesEditor.cpp \ 1471 src/settings/editors/UIMachineDescriptionEditor.cpp \ 1470 1472 src/settings/editors/UIMaximumGuestScreenSizeEditor.cpp \ 1471 1473 src/settings/editors/UIMonitorCountEditor.cpp \ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIMachineDescriptionEditor.cpp
r94444 r94445 1 1 /* $Id$ */ 2 2 /** @file 3 * VBox Qt GUI - UI AutoCaptureKeyboardEditor class implementation.3 * VBox Qt GUI - UIMachineDescriptionEditor class implementation. 4 4 */ 5 5 … … 17 17 18 18 /* Qt includes: */ 19 #include <QCheckBox> 20 #include <QGridLayout> 21 #include <QLabel> 19 #include <QTextEdit> 20 #include <QVBoxLayout> 22 21 23 22 /* GUI includes: */ 24 #include "UI AutoCaptureKeyboardEditor.h"23 #include "UIMachineDescriptionEditor.h" 25 24 26 25 27 UI AutoCaptureKeyboardEditor::UIAutoCaptureKeyboardEditor(QWidget *pParent /* = 0 */)26 UIMachineDescriptionEditor::UIMachineDescriptionEditor(QWidget *pParent /* = 0 */) 28 27 : QIWithRetranslateUI<QWidget>(pParent) 29 , m_fValue(false) 30 , m_pLabel(0) 31 , m_pCheckBox(0) 28 , m_pTextEdit(0) 32 29 { 33 30 prepare(); 34 31 } 35 32 36 void UI AutoCaptureKeyboardEditor::setValue(bool fValue)33 void UIMachineDescriptionEditor::setValue(const QString &strValue) 37 34 { 38 35 /* Update cached value and 39 * check-boxif value has changed: */40 if (m_ fValue != fValue)36 * text-edit if value has changed: */ 37 if (m_strValue != strValue) 41 38 { 42 m_ fValue = fValue;43 if (m_p CheckBox)44 m_p CheckBox->setCheckState(m_fValue ? Qt::Checked : Qt::Unchecked);39 m_strValue = strValue; 40 if (m_pTextEdit) 41 m_pTextEdit->setPlainText(strValue); 45 42 } 46 43 } 47 44 48 bool UIAutoCaptureKeyboardEditor::value() const45 QString UIMachineDescriptionEditor::value() const 49 46 { 50 return m_p CheckBox ? m_pCheckBox->checkState() == Qt::Checked : m_fValue;47 return m_pTextEdit ? m_pTextEdit->toPlainText() : m_strValue; 51 48 } 52 49 53 void UI AutoCaptureKeyboardEditor::retranslateUi()50 void UIMachineDescriptionEditor::retranslateUi() 54 51 { 55 if (m_pLabel) 56 m_pLabel->setText(tr("Extended Features:")); 57 if (m_pCheckBox) 58 { 59 m_pCheckBox->setText(tr("&Auto Capture Keyboard")); 60 m_pCheckBox->setToolTip(tr("When checked, the keyboard is automatically captured every time the VM window is " 61 "activated. When the keyboard is captured, all keystrokes (including system ones like " 62 "Alt-Tab) are directed to the VM.")); 63 } 52 if (m_pTextEdit) 53 m_pTextEdit->setToolTip(tr("Holds the description of the virtual machine. The description field is useful " 54 "for commenting on configuration details of the installed guest OS.")); 64 55 } 65 56 66 void UI AutoCaptureKeyboardEditor::prepare()57 void UIMachineDescriptionEditor::prepare() 67 58 { 68 59 /* Prepare main layout: */ 69 Q GridLayout *pLayout = new QGridLayout(this);60 QVBoxLayout *pLayout = new QVBoxLayout(this); 70 61 if (pLayout) 71 62 { 72 63 pLayout->setContentsMargins(0, 0, 0, 0); 73 pLayout->setColumnStretch(1, 1);74 64 75 /* Prepare label: */ 76 m_pLabel = new QLabel(this); 77 if (m_pLabel) 78 pLayout->addWidget(m_pLabel, 0, 0); 79 /* Prepare check-box: */ 80 m_pCheckBox = new QCheckBox(this); 81 if (m_pCheckBox) 82 pLayout->addWidget(m_pCheckBox, 0, 1); 65 /* Prepare text-edit: */ 66 m_pTextEdit = new QTextEdit(this); 67 if (m_pTextEdit) 68 { 69 setFocusProxy(m_pTextEdit); 70 m_pTextEdit->setAcceptRichText(false); 71 #ifdef VBOX_WS_MAC 72 m_pTextEdit->setMinimumHeight(150); 73 #endif 74 75 pLayout->addWidget(m_pTextEdit); 76 } 83 77 } 84 78 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIMachineDescriptionEditor.h
r94444 r94445 1 1 /* $Id$ */ 2 2 /** @file 3 * VBox Qt GUI - UI AutoCaptureKeyboardEditor class declaration.3 * VBox Qt GUI - UIMachineDescriptionEditor class declaration. 4 4 */ 5 5 … … 16 16 */ 17 17 18 #ifndef FEQT_INCLUDED_SRC_settings_editors_UI AutoCaptureKeyboardEditor_h19 #define FEQT_INCLUDED_SRC_settings_editors_UI AutoCaptureKeyboardEditor_h18 #ifndef FEQT_INCLUDED_SRC_settings_editors_UIMachineDescriptionEditor_h 19 #define FEQT_INCLUDED_SRC_settings_editors_UIMachineDescriptionEditor_h 20 20 #ifndef RT_WITHOUT_PRAGMA_ONCE 21 21 # pragma once … … 26 26 27 27 /* Forward declarations: */ 28 class QCheckBox; 29 class QLabel; 28 class QTextEdit; 30 29 31 /** QWidget subclass used as an auto capture keyboardeditor. */32 class SHARED_LIBRARY_STUFF UI AutoCaptureKeyboardEditor : public QIWithRetranslateUI<QWidget>30 /** QWidget subclass used as machine description editor. */ 31 class SHARED_LIBRARY_STUFF UIMachineDescriptionEditor : public QIWithRetranslateUI<QWidget> 33 32 { 34 33 Q_OBJECT; … … 37 36 38 37 /** Constructs editor passing @a pParent to the base-class. */ 39 UI AutoCaptureKeyboardEditor(QWidget *pParent = 0);38 UIMachineDescriptionEditor(QWidget *pParent = 0); 40 39 41 /** Defines editor @a fValue. */42 void setValue( bool fValue);40 /** Defines editor @a strValue. */ 41 void setValue(const QString &strValue); 43 42 /** Returns editor value. */ 44 boolvalue() const;43 QString value() const; 45 44 46 45 protected: … … 55 54 56 55 /** Holds the value to be set. */ 57 bool m_fValue;56 QString m_strValue; 58 57 59 /** Holds the label instance. */60 QLabel *m_pLabel;61 58 /** Holds the check-box instance. */ 62 Q CheckBox *m_pCheckBox;59 QTextEdit *m_pTextEdit; 63 60 }; 64 61 65 #endif /* !FEQT_INCLUDED_SRC_settings_editors_UI AutoCaptureKeyboardEditor_h */62 #endif /* !FEQT_INCLUDED_SRC_settings_editors_UIMachineDescriptionEditor_h */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UINameAndSystemEditor.cpp
r94030 r94445 20 20 #include <QGridLayout> 21 21 #include <QLabel> 22 #include <QRegularExpressionValidator>23 22 #include <QVBoxLayout> 24 23 … … 264 263 } 265 264 266 void UINameAndSystemEditor::setNameFieldValidator(const QString &strValidator)267 {268 if (!m_pEditorName)269 return;270 m_pEditorName->setValidator(new QRegularExpressionValidator(QRegularExpression(strValidator), this));271 }272 273 265 void UINameAndSystemEditor::markNameEditor(bool fError) 274 266 { -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UINameAndSystemEditor.h
r94395 r94445 123 123 /** Returns the VM OS type. */ 124 124 CGuestOSType type() const; 125 126 /** Defines the name-field @a strValidator. */127 void setNameFieldValidator(const QString &strValidator);128 125 129 126 /** Passes the @p fError to QILineEdit::mark(bool) effectively marking it for error. */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.cpp
r94333 r94445 32 32 #include "UIErrorString.h" 33 33 #include "UIFilePathSelector.h" 34 #include "UIMachineDescriptionEditor.h" 34 35 #include "UIMachineSettingsGeneral.h" 35 36 #include "UIModalWindowManager.h" … … 148 149 , m_pEditorEncryptionPasswordConfirm(0) 149 150 { 150 /* Prepare: */151 151 prepare(); 152 152 } … … 154 154 UIMachineSettingsGeneral::~UIMachineSettingsGeneral() 155 155 { 156 /* Cleanup: */157 156 cleanup(); 158 157 } … … 286 285 /* Load old 'Description' data from cache: */ 287 286 AssertPtrReturnVoid(m_pEditorDescription); 288 m_pEditorDescription->set PlainText(oldGeneralData.m_strDescription);287 m_pEditorDescription->setValue(oldGeneralData.m_strDescription); 289 288 290 289 /* Load old 'Encryption' data from cache: */ … … 323 322 /* Gather new 'Description' data: */ 324 323 AssertPtrReturnVoid(m_pEditorDescription); 325 newGeneralData.m_strDescription = m_pEditorDescription-> toPlainText().isEmpty() ?326 QString() : m_pEditorDescription-> toPlainText();324 newGeneralData.m_strDescription = m_pEditorDescription->value().isEmpty() ? 325 QString() : m_pEditorDescription->value(); 327 326 328 327 /* Gather new 'Encryption' data: */ … … 494 493 "This feature requires Guest Additions to be installed in the guest OS.")); 495 494 m_pTabWidget->setTabText(m_pTabWidget->indexOf(m_pTabAdvanced), tr("A&dvanced")); 496 m_pEditorDescription->setToolTip(tr("Holds the description of the virtual machine. The description field is useful for "497 "commenting on configuration details of the installed guest OS."));498 495 m_pTabWidget->setTabText(m_pTabWidget->indexOf(m_pTabDescription), tr("D&escription")); 499 496 m_pCheckBoxEncryption->setToolTip(tr("When checked, disks attached to this virtual machine will be encrypted.")); … … 614 611 m_pEditorNameAndSystem = new UINameAndSystemEditor(m_pTabBasic); 615 612 if (m_pEditorNameAndSystem) 616 {617 m_pEditorNameAndSystem->setNameFieldValidator(".+");618 613 pLayoutBasic->addWidget(m_pEditorNameAndSystem); 619 } 620 621 /* Add vertical strech: */ 614 622 615 pLayoutBasic->addStretch(); 623 616 } … … 704 697 { 705 698 /* Prepare description editor: */ 706 m_pEditorDescription = new QTextEdit(m_pTabDescription);699 m_pEditorDescription = new UIMachineDescriptionEditor(m_pTabDescription); 707 700 if (m_pEditorDescription) 708 701 { 709 702 m_pEditorDescription->setObjectName(QStringLiteral("m_pEditorDescription")); 710 m_pEditorDescription->setAcceptRichText(false);711 #ifdef VBOX_WS_MAC712 m_pEditorDescription->setMinimumHeight(150);713 #endif714 715 703 pLayoutDescription->addWidget(m_pEditorDescription); 716 704 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.h
r94333 r94445 30 30 class QComboBox; 31 31 class QLineEdit; 32 class QTextEdit;33 32 class QITabWidget; 33 class UIMachineDescriptionEditor; 34 34 class UINameAndSystemEditor; 35 35 … … 176 176 177 177 /** Holds the 'Description' tab instance. */ 178 QWidget *m_pTabDescription;178 QWidget *m_pTabDescription; 179 179 /** Holds the description editor instance. */ 180 QTextEdit*m_pEditorDescription;180 UIMachineDescriptionEditor *m_pEditorDescription; 181 181 182 182 /** Holds the 'Encryption' tab instance. */
Note:
See TracChangeset
for help on using the changeset viewer.