Changeset 54831 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Mar 18, 2015 2:32:10 PM (10 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/settings/machine
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.cpp
r53397 r54831 5 5 6 6 /* 7 * Copyright (C) 2006-201 4Oracle Corporation7 * Copyright (C) 2006-2015 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 19 19 # include <precomp.h> 20 20 #else /* !VBOX_WITH_PRECOMPILED_HEADERS */ 21 22 21 /* Qt includes: */ 23 22 # include <QDir> 24 23 # include <QLineEdit> 25 26 24 /* GUI includes: */ 27 25 # include "QIWidgetValidator.h" … … 29 27 # include "UIMessageCenter.h" 30 28 # include "UIConverter.h" 31 32 29 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */ 33 34 30 35 31 UIMachineSettingsGeneral::UIMachineSettingsGeneral() 36 32 : m_fHWVirtExEnabled(false) 37 33 { 38 /* Apply UI decorations */ 39 Ui::UIMachineSettingsGeneral::setupUi (this); 40 41 /* Setup validators */ 42 m_pNameAndSystemEditor->nameEditor()->setValidator(new QRegExpValidator(QRegExp(".+"), this)); 43 44 /* Shared Clipboard mode */ 45 mCbClipboard->addItem (""); /* KClipboardMode_Disabled */ 46 mCbClipboard->addItem (""); /* KClipboardMode_HostToGuest */ 47 mCbClipboard->addItem (""); /* KClipboardMode_GuestToHost */ 48 mCbClipboard->addItem (""); /* KClipboardMode_Bidirectional */ 49 50 /* Drag'n'drop mode */ 51 mCbDragAndDrop->addItem (""); /* KDnDMode_Disabled */ 52 mCbDragAndDrop->addItem (""); /* KDnDMode_HostToGuest */ 53 mCbDragAndDrop->addItem (""); /* KDnDMode_GuestToHost */ 54 mCbDragAndDrop->addItem (""); /* KDnDMode_Bidirectional */ 55 56 #ifdef Q_WS_MAC 57 mTeDescription->setMinimumHeight (150); 58 #endif /* Q_WS_MAC */ 59 60 /* Prepare validation: */ 61 prepareValidation(); 62 63 /* Applying language settings */ 34 /* Prepare: */ 35 prepare(); 36 37 /* Translate: */ 64 38 retranslateUi(); 65 39 } … … 69 43 return m_pNameAndSystemEditor->type(); 70 44 } 45 46 bool UIMachineSettingsGeneral::is64BitOSTypeSelected() const 47 { 48 return m_pNameAndSystemEditor->type().GetIs64Bit(); 49 } 50 51 #ifdef VBOX_WITH_VIDEOHWACCEL 52 bool UIMachineSettingsGeneral::isWindowsOSTypeSelected() const 53 { 54 return m_pNameAndSystemEditor->type().GetFamilyId() == "Windows"; 55 } 56 #endif /* VBOX_WITH_VIDEOHWACCEL */ 71 57 72 58 void UIMachineSettingsGeneral::setHWVirtExEnabled(bool fEnabled) … … 83 69 } 84 70 85 bool UIMachineSettingsGeneral::is64BitOSTypeSelected() const86 {87 return m_pNameAndSystemEditor->type().GetIs64Bit();88 }89 90 #ifdef VBOX_WITH_VIDEOHWACCEL91 bool UIMachineSettingsGeneral::isWindowsOSTypeSelected() const92 {93 return m_pNameAndSystemEditor->type().GetFamilyId() == "Windows";94 }95 #endif /* VBOX_WITH_VIDEOHWACCEL */96 97 /* Load data to cache from corresponding external object(s),98 * this task COULD be performed in other than GUI thread: */99 71 void UIMachineSettingsGeneral::loadToCacheFrom(QVariant &data) 100 72 { … … 124 96 } 125 97 126 /* Load data to corresponding widgets from cache,127 * this task SHOULD be performed in GUI thread only: */128 98 void UIMachineSettingsGeneral::getFromCache() 129 99 { … … 147 117 } 148 118 149 /* Save data from corresponding widgets to cache,150 * this task SHOULD be performed in GUI thread only: */151 119 void UIMachineSettingsGeneral::putToCache() 152 120 { … … 167 135 } 168 136 169 /* Save data from cache to corresponding external object(s),170 * this task COULD be performed in other than GUI thread: */171 137 void UIMachineSettingsGeneral::saveFromCacheTo(QVariant &data) 172 138 { … … 195 161 { 196 162 m_machine.SetOSTypeId(generalData.m_strGuestOsTypeId); 197 198 163 CVirtualBox vbox = vboxGlobal().virtualBox(); 199 164 CGuestOSType newType = vbox.GetGuestOSType(generalData.m_strGuestOsTypeId); 200 165 m_machine.SetCPUProperty(KCPUPropertyType_LongMode, newType.GetIs64Bit()); 201 166 } 202 203 167 /* Advanced tab: */ 204 168 m_machine.SetSnapshotFolder(generalData.m_strSnapshotsFolder); … … 246 210 } 247 211 248 void UIMachineSettingsGeneral::setOrderAfter (QWidget *aWidget)249 { 250 /* Basic tab-order */251 setTabOrder (aWidget, mTwGeneral->focusProxy());252 setTabOrder 253 254 /* Advanced tab-order */255 setTabOrder 256 setTabOrder 257 setTabOrder 258 259 /* Description tab-order */260 setTabOrder 212 void UIMachineSettingsGeneral::setOrderAfter(QWidget *pWidget) 213 { 214 /* Basic tab-order: */ 215 setTabOrder(pWidget, mTwGeneral->focusProxy()); 216 setTabOrder(mTwGeneral->focusProxy(), m_pNameAndSystemEditor); 217 218 /* Advanced tab-order: */ 219 setTabOrder(m_pNameAndSystemEditor, mPsSnapshot); 220 setTabOrder(mPsSnapshot, mCbClipboard); 221 setTabOrder(mCbClipboard, mCbDragAndDrop); 222 223 /* Description tab-order: */ 224 setTabOrder(mCbDragAndDrop, mTeDescription); 261 225 } 262 226 263 227 void UIMachineSettingsGeneral::retranslateUi() 264 228 { 265 /* Translate uic generated strings */ 266 Ui::UIMachineSettingsGeneral::retranslateUi (this); 267 268 /* Path selector */ 269 mPsSnapshot->setWhatsThis (tr ("Holds the path where snapshots of this " 270 "virtual machine will be stored. Be aware that " 271 "snapshots can take quite a lot of disk " 272 "space.")); 273 274 /* Shared Clipboard mode */ 275 mCbClipboard->setItemText (0, gpConverter->toString (KClipboardMode_Disabled)); 276 mCbClipboard->setItemText (1, gpConverter->toString (KClipboardMode_HostToGuest)); 277 mCbClipboard->setItemText (2, gpConverter->toString (KClipboardMode_GuestToHost)); 278 mCbClipboard->setItemText (3, gpConverter->toString (KClipboardMode_Bidirectional)); 279 280 /* Drag'n'drop mode */ 281 mCbDragAndDrop->setItemText (0, gpConverter->toString (KDnDMode_Disabled)); 282 mCbDragAndDrop->setItemText (1, gpConverter->toString (KDnDMode_HostToGuest)); 283 mCbDragAndDrop->setItemText (2, gpConverter->toString (KDnDMode_GuestToHost)); 284 mCbDragAndDrop->setItemText (3, gpConverter->toString (KDnDMode_Bidirectional)); 285 } 286 287 void UIMachineSettingsGeneral::prepareValidation() 288 { 289 /* Prepare validation: */ 290 connect(m_pNameAndSystemEditor, SIGNAL(sigOsTypeChanged()), this, SLOT(revalidate())); 291 connect(m_pNameAndSystemEditor, SIGNAL(sigNameChanged(const QString&)), this, SLOT(revalidate())); 229 /* Translate uic generated strings: */ 230 Ui::UIMachineSettingsGeneral::retranslateUi(this); 231 232 /* Translate path selector: */ 233 mPsSnapshot->setWhatsThis(tr("Holds the path where snapshots of this " 234 "virtual machine will be stored. Be aware that " 235 "snapshots can take quite a lot of disk space.")); 236 /* Translate Shared Clipboard mode combo: */ 237 mCbClipboard->setItemText(0, gpConverter->toString(KClipboardMode_Disabled)); 238 mCbClipboard->setItemText(1, gpConverter->toString(KClipboardMode_HostToGuest)); 239 mCbClipboard->setItemText(2, gpConverter->toString(KClipboardMode_GuestToHost)); 240 mCbClipboard->setItemText(3, gpConverter->toString(KClipboardMode_Bidirectional)); 241 /* Translate Drag'n'drop mode combo: */ 242 mCbDragAndDrop->setItemText(0, gpConverter->toString(KDnDMode_Disabled)); 243 mCbDragAndDrop->setItemText(1, gpConverter->toString(KDnDMode_HostToGuest)); 244 mCbDragAndDrop->setItemText(2, gpConverter->toString(KDnDMode_GuestToHost)); 245 mCbDragAndDrop->setItemText(3, gpConverter->toString(KDnDMode_Bidirectional)); 246 } 247 248 void UIMachineSettingsGeneral::prepare() 249 { 250 /* Apply UI decorations: */ 251 Ui::UIMachineSettingsGeneral::setupUi(this); 252 253 /* Prepare pages: */ 254 preparePageBasic(); 255 preparePageAdvanced(); 256 preparePageDescription(); 257 } 258 259 void UIMachineSettingsGeneral::preparePageBasic() 260 { 261 /* Name and OS Type widget was created in the .ui file: */ 262 AssertPtrReturnVoid(m_pNameAndSystemEditor); 263 { 264 /* Configure Name and OS Type widget: */ 265 m_pNameAndSystemEditor->nameEditor()->setValidator(new QRegExpValidator(QRegExp(".+"), this)); 266 connect(m_pNameAndSystemEditor, SIGNAL(sigOsTypeChanged()), this, SLOT(revalidate())); 267 connect(m_pNameAndSystemEditor, SIGNAL(sigNameChanged(const QString&)), this, SLOT(revalidate())); 268 } 269 } 270 271 void UIMachineSettingsGeneral::preparePageAdvanced() 272 { 273 /* Shared Clipboard mode combo was created in the .ui file: */ 274 AssertPtrReturnVoid(mCbClipboard); 275 { 276 /* Configure Shared Clipboard mode combo: */ 277 mCbClipboard->addItem (""); /* KClipboardMode_Disabled */ 278 mCbClipboard->addItem (""); /* KClipboardMode_HostToGuest */ 279 mCbClipboard->addItem (""); /* KClipboardMode_GuestToHost */ 280 mCbClipboard->addItem (""); /* KClipboardMode_Bidirectional */ 281 } 282 /* Drag&drop mode combo was created in the .ui file: */ 283 AssertPtrReturnVoid(mCbDragAndDrop); 284 { 285 /* Configure Drag&drop mode combo: */ 286 mCbDragAndDrop->addItem (""); /* KDnDMode_Disabled */ 287 mCbDragAndDrop->addItem (""); /* KDnDMode_HostToGuest */ 288 mCbDragAndDrop->addItem (""); /* KDnDMode_GuestToHost */ 289 mCbDragAndDrop->addItem (""); /* KDnDMode_Bidirectional */ 290 } 291 } 292 293 void UIMachineSettingsGeneral::preparePageDescription() 294 { 295 /* Description text editor was created in the .ui file: */ 296 AssertPtrReturnVoid(mTeDescription); 297 { 298 /* Configure Description text editor: */ 299 #ifdef Q_WS_MAC 300 mTeDescription->setMinimum(150); 301 #endif /* Q_WS_MAC */ 302 } 292 303 } 293 304 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.h
r53397 r54831 4 4 5 5 /* 6 * Copyright (C) 2006-201 4Oracle Corporation6 * Copyright (C) 2006-2015 Oracle Corporation 7 7 * 8 8 * This file is part of VirtualBox Open Source Edition (OSE), as … … 15 15 */ 16 16 17 #ifndef __ UIMachineSettingsGeneral_h__18 #define __ UIMachineSettingsGeneral_h__17 #ifndef ___UIMachineSettingsGeneral_h___ 18 #define ___UIMachineSettingsGeneral_h___ 19 19 20 /* Localincludes: */20 /* GUI includes: */ 21 21 #include "UISettingsPage.h" 22 22 #include "UIMachineSettingsGeneral.gen.h" 23 23 24 /* Machine settings / General page / Data:*/24 /** Machine settings: General page: Data structure. */ 25 25 struct UIDataSettingsMachineGeneral 26 26 { 27 /* Default constructor:*/27 /** Constructor. */ 28 28 UIDataSettingsMachineGeneral() 29 29 : m_strName(QString()) … … 35 35 , m_strDescription(QString()) {} 36 36 37 /* Functions:*/37 /** Returns whether passed @a other is equal to this. */ 38 38 bool equal(const UIDataSettingsMachineGeneral &other) const 39 39 { … … 47 47 } 48 48 49 /* Operators:*/49 /** Operator== implementation which returns whether passed @a other is equal to this. */ 50 50 bool operator==(const UIDataSettingsMachineGeneral &other) const { return equal(other); } 51 /** Operator!= implementation which returns whether passed @a other is differs from this. */ 51 52 bool operator!=(const UIDataSettingsMachineGeneral &other) const { return !equal(other); } 52 53 53 /* Variables:*/54 /** Holds the VM name. */ 54 55 QString m_strName; 56 /** Holds the VM OS type ID. */ 55 57 QString m_strGuestOsTypeId; 58 59 /** Holds the VM snapshot folder. */ 56 60 QString m_strSnapshotsFolder; 61 /** Holds the default VM snapshot folder. */ 57 62 QString m_strSnapshotsHomeDir; 63 64 /** Holds the VM shared clipboard mode. */ 58 65 KClipboardMode m_clipboardMode; 66 /** Holds the VM drag&drop mode. */ 59 67 KDnDMode m_dndMode; 68 69 /** Holds the VM description. */ 60 70 QString m_strDescription; 61 71 }; 62 72 typedef UISettingsCache<UIDataSettingsMachineGeneral> UICacheSettingsMachineGeneral; 63 73 64 /* Machine settings / General page:*/74 /** Machine settings: General page. */ 65 75 class UIMachineSettingsGeneral : public UISettingsPageMachine, 66 public Ui::UIMachineSettingsGeneral76 public Ui::UIMachineSettingsGeneral 67 77 { 68 78 Q_OBJECT; … … 70 80 public: 71 81 82 /** Constructor. */ 72 83 UIMachineSettingsGeneral(); 73 84 85 /** Returns the VM OS type ID. */ 74 86 CGuestOSType guestOSType() const; 75 void setHWVirtExEnabled(bool fEnabled);87 /** Returns whether 64bit OS type ID is selected. */ 76 88 bool is64BitOSTypeSelected() const; 77 89 #ifdef VBOX_WITH_VIDEOHWACCEL 90 /** Returns whether Windows OS type ID is selected. */ 78 91 bool isWindowsOSTypeSelected() const; 79 92 #endif /* VBOX_WITH_VIDEOHWACCEL */ 80 93 94 /** Defines whether HW virtualization extension is enabled. */ 95 void setHWVirtExEnabled(bool fEnabled); 96 81 97 protected: 82 98 83 /* Load data to cache from corresponding external object(s),84 * this task COULD be performed in other than GUI thread:*/99 /** Loads data into the cache from the corresponding external object(s). 100 * @note This task COULD be performed in other than GUI thread. */ 85 101 void loadToCacheFrom(QVariant &data); 86 /* Load data to corresponding widgets fromcache,87 * this task SHOULD be performed in GUI thread only:*/102 /** Loads data into the corresponding widgets from the cache, 103 * @note This task SHOULD be performed in GUI thread only! */ 88 104 void getFromCache(); 89 105 90 /* Pagechanged: */106 /** Returns whether the page was changed: */ 91 107 bool changed() const { return m_cache.wasChanged(); } 92 108 93 /* Save data from corresponding widgets tocache,94 * this task SHOULD be performed in GUI thread only:*/109 /** Saves the data from the corresponding widgets into the cache, 110 * @note This task SHOULD be performed in GUI thread only! */ 95 111 void putToCache(); 96 /* Save data from cache to corresponding external object(s),97 * this task COULD be performed in other than GUI thread:*/112 /** Save data from the cache into the corresponding external object(s). 113 * @note This task COULD be performed in other than GUI thread. */ 98 114 void saveFromCacheTo(QVariant &data); 99 115 100 /* API: Validation stuff:*/116 /** Validation routine. */ 101 117 bool validate(QList<UIValidationMessage> &messages); 102 118 103 void setOrderAfter (QWidget *aWidget); 119 /** Tab-order assignment routine. */ 120 void setOrderAfter(QWidget *aWidget); 104 121 122 /** Translation routine. */ 105 123 void retranslateUi(); 106 124 107 125 private: 108 126 109 /* Helper: Prepare stuff: */ 110 void prepareValidation(); 127 /** Prepare routine. */ 128 void prepare(); 129 /** Prepare 'Basic' page routine. */ 130 void preparePageBasic(); 131 /** Prepare 'Advanced' page routine. */ 132 void preparePageAdvanced(); 133 /** Prepare 'Description' page routine. */ 134 void preparePageDescription(); 111 135 136 /** Polish routine. */ 112 137 void polishPage(); 113 138 114 /* Cache: */ 139 /** Holds the page cache. */ 140 UICacheSettingsMachineGeneral m_cache; 141 142 /** Holds whether HW virtualization extension is enabled. */ 115 143 bool m_fHWVirtExEnabled; 116 UICacheSettingsMachineGeneral m_cache;117 144 }; 118 145 119 #endif // __UIMachineSettingsGeneral_h__ 120 146 #endif / !___UIMachineSettingsGeneral_h___ */
Note:
See TracChangeset
for help on using the changeset viewer.