Changeset 2973 in vbox
- Timestamp:
- Jun 1, 2007 11:45:49 AM (18 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk
r2864 r2973 92 92 ui/VBoxVMSettingsDlg.ui.h \ 93 93 ui/VBoxSharedFoldersSettings.ui.h 94 ifeq ($(BUILD_TARGET),win)95 VirtualBox_QT_MOCUIHDRS += ui/VBoxVMNetworkSettings.ui.h96 endif97 94 98 95 -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMNetworkSettings.ui
r2400 r2973 27 27 <x>0</x> 28 28 <y>0</y> 29 <width> 361</width>30 <height>3 68</height>29 <width>442</width> 30 <height>353</height> 31 31 </rect> 32 </property> 33 <property name="sizePolicy"> 34 <sizepolicy> 35 <hsizetype>5</hsizetype> 36 <vsizetype>1</vsizetype> 37 <horstretch>0</horstretch> 38 <verstretch>0</verstretch> 39 </sizepolicy> 32 40 </property> 33 41 <property name="caption"> … … 39 47 </property> 40 48 <property name="spacing"> 41 <number> 10</number>49 <number>0</number> 42 50 </property> 43 51 <widget class="QGroupBox"> … … 48 56 <sizepolicy> 49 57 <hsizetype>5</hsizetype> 50 <vsizetype> 5</vsizetype>58 <vsizetype>1</vsizetype> 51 59 <horstretch>0</horstretch> 52 60 <verstretch>0</verstretch> … … 68 76 <widget class="QLayoutWidget"> 69 77 <property name="name"> 70 <cstring>layout 121</cstring>71 </property> 72 < hbox>78 <cstring>layout345</cstring> 79 </property> 80 <grid> 73 81 <property name="name"> 74 82 <cstring>unnamed</cstring> 75 83 </property> 76 <widget class="QLayoutWidget"> 77 <property name="name"> 78 <cstring>layout35</cstring> 79 </property> 80 <vbox> 81 <property name="name"> 82 <cstring>unnamed</cstring> 83 </property> 84 <widget class="QLabel"> 85 <property name="name"> 86 <cstring>txNetworkAttachment</cstring> 87 </property> 88 <property name="sizePolicy"> 89 <sizepolicy> 90 <hsizetype>0</hsizetype> 91 <vsizetype>0</vsizetype> 92 <horstretch>0</horstretch> 93 <verstretch>0</verstretch> 94 </sizepolicy> 95 </property> 96 <property name="text"> 97 <string>&Attached to</string> 98 </property> 99 <property name="buddy" stdset="0"> 100 <cstring>cbNetworkAttachment</cstring> 101 </property> 102 </widget> 103 <widget class="QComboBox"> 104 <property name="name"> 105 <cstring>cbNetworkAttachment</cstring> 106 </property> 107 <property name="whatsThis" stdset="0"> 108 <string>Controls the way how this virtual adapter is attached to the real network of the Host OS.</string> 109 </property> 110 </widget> 111 </vbox> 112 </widget> 113 <widget class="QLayoutWidget"> 114 <property name="name"> 115 <cstring>layout11</cstring> 116 </property> 117 <vbox> 118 <property name="name"> 119 <cstring>unnamed</cstring> 120 </property> 121 <widget class="QLabel"> 122 <property name="name"> 123 <cstring>txMACAddress</cstring> 124 </property> 125 <property name="sizePolicy"> 126 <sizepolicy> 127 <hsizetype>0</hsizetype> 128 <vsizetype>0</vsizetype> 129 <horstretch>0</horstretch> 130 <verstretch>0</verstretch> 131 </sizepolicy> 132 </property> 133 <property name="text"> 134 <string>&MAC Address</string> 135 </property> 136 <property name="buddy" stdset="0"> 137 <cstring>leMACAddress</cstring> 138 </property> 139 </widget> 140 <widget class="QLineEdit"> 141 <property name="name"> 142 <cstring>leMACAddress</cstring> 143 </property> 144 <property name="frameShape"> 145 <enum>LineEditPanel</enum> 146 </property> 147 <property name="frameShadow"> 148 <enum>Sunken</enum> 149 </property> 150 <property name="whatsThis" stdset="0"> 84 <widget class="QLabel" row="1" column="0"> 85 <property name="name"> 86 <cstring>txHostInterface_WIN</cstring> 87 </property> 88 <property name="sizePolicy"> 89 <sizepolicy> 90 <hsizetype>0</hsizetype> 91 <vsizetype>5</vsizetype> 92 <horstretch>0</horstretch> 93 <verstretch>0</verstretch> 94 </sizepolicy> 95 </property> 96 <property name="text"> 97 <string>&Interface Name</string> 98 </property> 99 <property name="buddy" stdset="0"> 100 <cstring>cbHostInterfaceName</cstring> 101 </property> 102 </widget> 103 <widget class="QLineEdit" row="2" column="1"> 104 <property name="name"> 105 <cstring>leMACAddress</cstring> 106 </property> 107 <property name="sizePolicy"> 108 <sizepolicy> 109 <hsizetype>7</hsizetype> 110 <vsizetype>0</vsizetype> 111 <horstretch>0</horstretch> 112 <verstretch>0</verstretch> 113 </sizepolicy> 114 </property> 115 <property name="frameShape"> 116 <enum>LineEditPanel</enum> 117 </property> 118 <property name="frameShadow"> 119 <enum>Sunken</enum> 120 </property> 121 <property name="whatsThis" stdset="0"> 151 122 <string>Displays the MAC address of this adapter. It contains exactly 12 characters chosen from {0-9,A-F}.</string> 152 </property> 153 </widget> 154 </vbox> 155 </widget> 156 <widget class="QLayoutWidget"> 157 <property name="name"> 158 <cstring>layout12</cstring> 159 </property> 160 <vbox> 161 <property name="name"> 162 <cstring>unnamed</cstring> 163 </property> 164 <property name="spacing"> 165 <number>0</number> 166 </property> 167 <spacer> 168 <property name="name"> 169 <cstring>spacer6</cstring> 170 </property> 171 <property name="orientation"> 172 <enum>Vertical</enum> 173 </property> 174 <property name="sizeType"> 175 <enum>Minimum</enum> 176 </property> 177 <property name="sizeHint"> 178 <size> 179 <width>20</width> 180 <height>20</height> 181 </size> 182 </property> 183 </spacer> 184 <widget class="QPushButton"> 185 <property name="name"> 186 <cstring>pbGenerateMAC</cstring> 187 </property> 188 <property name="text"> 189 <string>&Generate</string> 190 </property> 191 <property name="accel"> 192 <string>Alt+G</string> 193 </property> 194 <property name="whatsThis" stdset="0"> 195 <string>Generates a new random MAC address.</string> 196 </property> 197 </widget> 198 </vbox> 199 </widget> 200 </hbox> 123 </property> 124 </widget> 125 <widget class="QComboBox" row="0" column="1" rowspan="1" colspan="2"> 126 <property name="name"> 127 <cstring>cbNetworkAttachment</cstring> 128 </property> 129 <property name="whatsThis" stdset="0"> 130 <string>Controls the way how this virtual adapter is attached to the real network of the Host OS.</string> 131 </property> 132 </widget> 133 <widget class="QToolButton" row="2" column="2"> 134 <property name="name"> 135 <cstring>pbGenerateMAC</cstring> 136 </property> 137 <property name="sizePolicy"> 138 <sizepolicy> 139 <hsizetype>5</hsizetype> 140 <vsizetype>1</vsizetype> 141 <horstretch>0</horstretch> 142 <verstretch>0</verstretch> 143 </sizepolicy> 144 </property> 145 <property name="focusPolicy"> 146 <enum>StrongFocus</enum> 147 </property> 148 <property name="text"> 149 <string>&Generate</string> 150 </property> 151 <property name="accel"> 152 <string>Alt+G</string> 153 </property> 154 <property name="whatsThis" stdset="0"> 155 <string>Generates a new random MAC address.</string> 156 </property> 157 </widget> 158 <widget class="QLabel" row="0" column="0"> 159 <property name="name"> 160 <cstring>txNetworkAttachment</cstring> 161 </property> 162 <property name="sizePolicy"> 163 <sizepolicy> 164 <hsizetype>0</hsizetype> 165 <vsizetype>0</vsizetype> 166 <horstretch>0</horstretch> 167 <verstretch>0</verstretch> 168 </sizepolicy> 169 </property> 170 <property name="text"> 171 <string>&Attached to</string> 172 </property> 173 <property name="buddy" stdset="0"> 174 <cstring>cbNetworkAttachment</cstring> 175 </property> 176 </widget> 177 <widget class="QLabel" row="2" column="0"> 178 <property name="name"> 179 <cstring>txMACAddress</cstring> 180 </property> 181 <property name="sizePolicy"> 182 <sizepolicy> 183 <hsizetype>0</hsizetype> 184 <vsizetype>0</vsizetype> 185 <horstretch>0</horstretch> 186 <verstretch>0</verstretch> 187 </sizepolicy> 188 </property> 189 <property name="text"> 190 <string>&MAC Address</string> 191 </property> 192 <property name="buddy" stdset="0"> 193 <cstring>leMACAddress</cstring> 194 </property> 195 </widget> 196 <widget class="QComboBox" row="1" column="1" rowspan="1" colspan="2"> 197 <property name="name"> 198 <cstring>cbHostInterfaceName</cstring> 199 </property> 200 <property name="whatsThis" stdset="0"> 201 <string>Displays the name of the host interface selected for this adapter.</string> 202 </property> 203 </widget> 204 </grid> 201 205 </widget> 202 206 <widget class="QCheckBox"> … … 230 234 <widget class="QLayoutWidget"> 231 235 <property name="name"> 232 <cstring>layout 33</cstring>236 <cstring>layout120</cstring> 233 237 </property> 234 238 <hbox> … … 236 240 <cstring>unnamed</cstring> 237 241 </property> 238 <property name="spacing">239 <number>0</number>240 </property>241 242 <widget class="QFrame"> 242 243 <property name="name"> 243 <cstring>frmHostInterface_ WIN</cstring>244 <cstring>frmHostInterface_X11</cstring> 244 245 </property> 245 246 <property name="frameShape"> … … 249 250 <enum>Raised</enum> 250 251 </property> 251 < grid>252 <vbox> 252 253 <property name="name"> 253 254 <cstring>unnamed</cstring> … … 256 257 <number>0</number> 257 258 </property> 258 <property name="spacing"> 259 <number>6</number> 260 </property> 261 <widget class="QLayoutWidget" row="0" column="0"> 262 <property name="name"> 263 <cstring>layout31</cstring> 264 </property> 265 <hbox> 266 <property name="name"> 267 <cstring>unnamed</cstring> 268 </property> 269 <widget class="QLabel"> 270 <property name="name"> 271 <cstring>txHostInterface_WIN</cstring> 272 </property> 273 <property name="sizePolicy"> 274 <sizepolicy> 275 <hsizetype>0</hsizetype> 276 <vsizetype>5</vsizetype> 277 <horstretch>0</horstretch> 278 <verstretch>0</verstretch> 279 </sizepolicy> 280 </property> 281 <property name="text"> 282 <string>&Interface Name</string> 283 </property> 284 <property name="buddy" stdset="0"> 285 <cstring>leHostInterfaceName</cstring> 286 </property> 287 </widget> 288 <widget class="QLineEdit"> 289 <property name="name"> 290 <cstring>leHostInterfaceName</cstring> 291 </property> 292 <property name="focusPolicy"> 293 <enum>NoFocus</enum> 294 </property> 295 <property name="readOnly"> 296 <bool>true</bool> 297 </property> 298 <property name="whatsThis" stdset="0"> 299 <string>Displays the name of the host interface selected for this adapter.</string> 300 </property> 301 </widget> 302 </hbox> 303 </widget> 304 <widget class="QListBox" row="1" column="0"> 305 <property name="name"> 306 <cstring>lbHostInterface</cstring> 259 <widget class="QLabel"> 260 <property name="name"> 261 <cstring>txHostInterface_X11</cstring> 307 262 </property> 308 263 <property name="sizePolicy"> 309 264 <sizepolicy> 310 <hsizetype> 7</hsizetype>311 <vsizetype> 7</vsizetype>265 <hsizetype>0</hsizetype> 266 <vsizetype>5</vsizetype> 312 267 <horstretch>0</horstretch> 313 268 <verstretch>0</verstretch> 314 269 </sizepolicy> 315 270 </property> 271 <property name="text"> 272 <string>&Interface Name</string> 273 </property> 274 <property name="buddy" stdset="0"> 275 <cstring>leHostInterface</cstring> 276 </property> 277 </widget> 278 <widget class="QLineEdit"> 279 <property name="name"> 280 <cstring>leHostInterface</cstring> 281 </property> 316 282 <property name="whatsThis" stdset="0"> 317 <string>Lists all available host interfaces.</string> 318 </property> 319 </widget> 320 <widget class="QLayoutWidget" row="1" column="1"> 321 <property name="name"> 322 <cstring>layout27</cstring> 323 </property> 324 <vbox> 325 <property name="name"> 326 <cstring>unnamed</cstring> 327 </property> 328 <property name="margin"> 329 <number>0</number> 330 </property> 331 <property name="spacing"> 332 <number>0</number> 333 </property> 334 <widget class="QToolButton"> 335 <property name="name"> 336 <cstring>pbHostAdd</cstring> 337 </property> 338 <property name="focusPolicy"> 339 <enum>StrongFocus</enum> 340 </property> 341 <property name="text"> 342 <string></string> 343 </property> 344 <property name="autoRaise"> 345 <bool>true</bool> 346 </property> 347 <property name="toolTip" stdset="0"> 348 <string></string> 349 </property> 350 <property name="whatsThis" stdset="0"> 351 <string>Adds a new host interface.</string> 352 </property> 353 </widget> 354 <widget class="QToolButton"> 355 <property name="name"> 356 <cstring>pbHostRemove</cstring> 357 </property> 358 <property name="focusPolicy"> 359 <enum>StrongFocus</enum> 360 </property> 361 <property name="text"> 362 <string></string> 363 </property> 364 <property name="autoRaise"> 365 <bool>true</bool> 366 </property> 367 <property name="toolTip" stdset="0"> 368 <string></string> 369 </property> 370 <property name="whatsThis" stdset="0"> 371 <string>Removes the selected host interface.</string> 372 </property> 373 </widget> 374 <spacer> 375 <property name="name"> 376 <cstring>spacer7</cstring> 377 </property> 378 <property name="orientation"> 379 <enum>Vertical</enum> 380 </property> 381 <property name="sizeType"> 382 <enum>Expanding</enum> 383 </property> 384 <property name="sizeHint"> 385 <size> 386 <width>10</width> 387 <height>10</height> 388 </size> 389 </property> 390 </spacer> 391 </vbox> 392 </widget> 393 <spacer row="0" column="1"> 394 <property name="name"> 395 <cstring>spacer11</cstring> 396 </property> 397 <property name="orientation"> 398 <enum>Horizontal</enum> 399 </property> 400 <property name="sizeType"> 401 <enum>Minimum</enum> 402 </property> 403 <property name="sizeHint"> 404 <size> 405 <width>20</width> 406 <height>20</height> 407 </size> 408 </property> 409 </spacer> 410 </grid> 283 <string>Displays the TAP interface name.</string> 284 </property> 285 </widget> 286 </vbox> 411 287 </widget> 412 <widget class="Q LayoutWidget">288 <widget class="QFrame"> 413 289 <property name="name"> 414 <cstring>layout120</cstring> 415 </property> 416 <hbox> 290 <cstring>frmTAPDescriptor</cstring> 291 </property> 292 <property name="frameShape"> 293 <enum>NoFrame</enum> 294 </property> 295 <property name="frameShadow"> 296 <enum>Raised</enum> 297 </property> 298 <vbox> 417 299 <property name="name"> 418 300 <cstring>unnamed</cstring> 419 301 </property> 420 <widget class="QFrame"> 421 <property name="name"> 422 <cstring>frmHostInterface_X11</cstring> 302 <property name="margin"> 303 <number>0</number> 304 </property> 305 <widget class="QLabel"> 306 <property name="name"> 307 <cstring>txTAPDescriptor</cstring> 308 </property> 309 <property name="sizePolicy"> 310 <sizepolicy> 311 <hsizetype>0</hsizetype> 312 <vsizetype>5</vsizetype> 313 <horstretch>0</horstretch> 314 <verstretch>0</verstretch> 315 </sizepolicy> 316 </property> 317 <property name="text"> 318 <string>&File Descriptor</string> 319 </property> 320 <property name="buddy" stdset="0"> 321 <cstring>leTAPDescriptor</cstring> 322 </property> 323 </widget> 324 <widget class="QLineEdit"> 325 <property name="name"> 326 <cstring>leTAPDescriptor</cstring> 423 327 </property> 424 328 <property name="frameShape"> 425 <enum> NoFrame</enum>329 <enum>LineEditPanel</enum> 426 330 </property> 427 331 <property name="frameShadow"> 428 <enum>Raised</enum> 429 </property> 430 <vbox> 431 <property name="name"> 432 <cstring>unnamed</cstring> 433 </property> 434 <property name="margin"> 435 <number>0</number> 436 </property> 437 <widget class="QLabel"> 438 <property name="name"> 439 <cstring>txHostInterface_X11</cstring> 440 </property> 441 <property name="sizePolicy"> 442 <sizepolicy> 443 <hsizetype>0</hsizetype> 444 <vsizetype>5</vsizetype> 445 <horstretch>0</horstretch> 446 <verstretch>0</verstretch> 447 </sizepolicy> 448 </property> 449 <property name="text"> 450 <string>&Interface Name</string> 451 </property> 452 <property name="buddy" stdset="0"> 453 <cstring>leHostInterface</cstring> 454 </property> 455 </widget> 456 <widget class="QLineEdit"> 457 <property name="name"> 458 <cstring>leHostInterface</cstring> 459 </property> 460 <property name="whatsThis" stdset="0"> 461 <string>Displays the TAP interface name.</string> 462 </property> 463 </widget> 464 </vbox> 465 </widget> 466 <widget class="QFrame"> 467 <property name="name"> 468 <cstring>frmTAPDescriptor</cstring> 469 </property> 470 <property name="frameShape"> 471 <enum>NoFrame</enum> 472 </property> 473 <property name="frameShadow"> 474 <enum>Raised</enum> 475 </property> 476 <vbox> 477 <property name="name"> 478 <cstring>unnamed</cstring> 479 </property> 480 <property name="margin"> 481 <number>0</number> 482 </property> 483 <widget class="QLabel"> 484 <property name="name"> 485 <cstring>txTAPDescriptor</cstring> 486 </property> 487 <property name="sizePolicy"> 488 <sizepolicy> 489 <hsizetype>0</hsizetype> 490 <vsizetype>5</vsizetype> 491 <horstretch>0</horstretch> 492 <verstretch>0</verstretch> 493 </sizepolicy> 494 </property> 495 <property name="text"> 496 <string>&File Descriptor</string> 497 </property> 498 <property name="buddy" stdset="0"> 499 <cstring>leTAPDescriptor</cstring> 500 </property> 501 </widget> 502 <widget class="QLineEdit"> 503 <property name="name"> 504 <cstring>leTAPDescriptor</cstring> 505 </property> 506 <property name="frameShape"> 507 <enum>LineEditPanel</enum> 508 </property> 509 <property name="frameShadow"> 510 <enum>Sunken</enum> 511 </property> 512 </widget> 513 </vbox> 514 </widget> 515 </hbox> 332 <enum>Sunken</enum> 333 </property> 334 </widget> 335 </vbox> 516 336 </widget> 517 337 </hbox> … … 739 559 <slot>pbTAPTerminate_clicked()</slot> 740 560 </connection> 741 <connection>742 <sender>pbHostAdd</sender>743 <signal>clicked()</signal>744 <receiver>VBoxVMNetworkSettings</receiver>745 <slot>hostInterfaceAdd()</slot>746 </connection>747 <connection>748 <sender>pbHostRemove</sender>749 <signal>clicked()</signal>750 <receiver>VBoxVMNetworkSettings</receiver>751 <slot>hostInterfaceRemove()</slot>752 </connection>753 <connection>754 <sender>lbHostInterface</sender>755 <signal>highlighted(QListBoxItem*)</signal>756 <receiver>VBoxVMNetworkSettings</receiver>757 <slot>lbHostInterface_highlighted(QListBoxItem*)</slot>758 </connection>759 561 </connections> 562 <tabstops> 563 <tabstop>cbNetworkAttachment</tabstop> 564 <tabstop>cbHostInterfaceName</tabstop> 565 <tabstop>leMACAddress</tabstop> 566 </tabstops> 760 567 <includes> 761 568 <include location="global" impldecl="in implementation">limits</include> … … 770 577 <variable access="private">CNetworkAdapter cadapter;</variable> 771 578 <variable access="private">QIWidgetValidator *mWalidator;</variable> 772 <variable access="private">QString mNoInterfaces;</variable>773 579 </variables> 774 <signals>775 <signal>listChanged( QWidget* )</signal>776 </signals>777 580 <slots> 778 <slot>cbNetworkAttachment_activated( const QString & string )</slot> 779 <slot>pbGenerateMAC_clicked()</slot> 780 <slot>pbTAPSetup_clicked()</slot> 781 <slot>pbTAPTerminate_clicked()</slot> 782 <slot access="protected">hostInterfaceAdd()</slot> 783 <slot access="protected">hostInterfaceRemove()</slot> 784 <slot access="protected">lbHostInterface_highlighted( QListBoxItem* item )</slot> 785 <slot access="protected">grbEnabledToggled( bool )</slot> 581 <slot access="private">grbEnabledToggled( bool )</slot> 582 <slot access="private">cbNetworkAttachment_activated( const QString & string )</slot> 583 <slot access="private">pbGenerateMAC_clicked()</slot> 584 <slot access="private">pbTAPSetup_clicked()</slot> 585 <slot access="private">pbTAPTerminate_clicked()</slot> 786 586 </slots> 787 587 <functions> 788 588 <function access="private" specifier="non virtual">init()</function> 789 <function>loadList( const QStringList & )</function> 589 <function returnType="bool">isPageValid( const QStringList & )</function> 590 <function>loadList( const QStringList &, const QString & )</function> 790 591 <function>getFromAdapter( const CNetworkAdapter & )</function> 791 592 <function>putBackToAdapter()</function> 792 593 <function>setValidator( QIWidgetValidator* )</function> 793 594 <function>revalidate()</function> 794 <function returnType="bool">isPageValid( const QStringList & )</function>795 <function access="private">selectListItem( const QString & )</function>796 595 <function access="private" returnType="bool">isInterfaceInvalid( const QStringList &, const QString & )</function> 797 596 </functions> -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMNetworkSettings.ui.h
r2420 r2973 31 31 32 32 /** 33 * QDialog class reimplementation to use for adding network interface.34 * It has one line-edit field for entering network interface's name and35 * common dialog's ok/cancel buttons.36 */37 #if defined Q_WS_WIN38 class VBoxAddNIDialog : public QDialog39 {40 Q_OBJECT41 42 public:43 44 VBoxAddNIDialog (QWidget *aParent, const QString &aIfaceName) :45 QDialog (aParent, "VBoxAddNIDialog", true /* modal */),46 mLeName (0)47 {48 setCaption (tr ("Add Host Interface"));49 QVBoxLayout *mainLayout = new QVBoxLayout (this, 10, 10, "mainLayout");50 51 /* Setup Input layout */52 QHBoxLayout *inputLayout = new QHBoxLayout (mainLayout, 10, "inputLayout");53 QLabel *lbName = new QLabel (tr ("Interface Name"), this);54 mLeName = new QLineEdit (aIfaceName, this);55 QWhatsThis::add (mLeName, tr ("Descriptive name of the new network interface"));56 inputLayout->addWidget (lbName);57 inputLayout->addWidget (mLeName);58 connect (mLeName, SIGNAL (textChanged (const QString &)),59 this, SLOT (validate()));60 61 /* Setup Button layout */62 QHBoxLayout *buttonLayout = new QHBoxLayout (mainLayout, 10, "buttonLayout");63 mBtOk = new QPushButton (tr ("&OK"), this, "mBtOk");64 QSpacerItem *spacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);65 QPushButton *btCancel = new QPushButton (tr ("Cancel"), this, "btCancel");66 connect (mBtOk, SIGNAL (clicked()), this, SLOT (accept()));67 connect (btCancel, SIGNAL (clicked()), this, SLOT (reject()));68 buttonLayout->addWidget (mBtOk);69 buttonLayout->addItem (spacer);70 buttonLayout->addWidget (btCancel);71 72 /* Validate interface name field */73 validate();74 }75 76 ~VBoxAddNIDialog() {}77 78 QString getName() { return mLeName->text(); }79 80 private slots:81 82 void validate()83 {84 mBtOk->setEnabled (!mLeName->text().isEmpty());85 }86 87 private:88 89 void showEvent (QShowEvent *aEvent)90 {91 setFixedHeight (height());92 QDialog::showEvent (aEvent);93 }94 95 QPushButton *mBtOk;96 QLineEdit *mLeName;97 };98 #endif99 100 101 /**102 33 * VBoxVMNetworkSettings class to use as network interface setup page. 103 34 */ 104 35 void VBoxVMNetworkSettings::init() 105 36 { 106 mNoInterfaces = tr ("<No suitable interfaces>");107 108 37 leMACAddress->setValidator (new QRegExpValidator (QRegExp ("[0-9,A-F]{12,12}"), this)); 109 38 … … 125 54 126 55 #if defined Q_WS_WIN 127 /* setup iconsets */ 128 pbHostAdd->setIconSet (VBoxGlobal::iconSet ("add_host_iface_16px.png", 129 "add_host_iface_disabled_16px.png")); 130 pbHostRemove->setIconSet (VBoxGlobal::iconSet ("remove_host_iface_16px.png", 131 "remove_host_iface_disabled_16px.png")); 132 /* setup languages */ 133 QToolTip::add (pbHostAdd, tr ("Add")); 134 QToolTip::add (pbHostRemove, tr ("Remove")); 135 /* setup connections */ 56 /* disable unused interface name UI */ 57 grbTAP->setHidden (true); 136 58 connect (grbEnabled, SIGNAL (toggled (bool)), 137 59 this, SLOT (grbEnabledToggled (bool))); 138 60 #else 139 61 /* disable unused interface name UI */ 140 frmHostInterface_WIN->setHidden (true); 62 txHostInterface_WIN->setHidden (true); 63 cbHostInterfaceName->setHidden (true); 141 64 /* setup iconsets */ 142 65 pbTAPSetup->setIconSet (VBoxGlobal::iconSet ("select_file_16px.png", … … 163 86 164 87 return !(type == CEnums::HostInterfaceNetworkAttachment && 165 isInterfaceInvalid (aList, leHostInterfaceName->text()));88 isInterfaceInvalid (aList, cbHostInterfaceName->currentText())); 166 89 #else 167 90 NOREF (aList); … … 170 93 } 171 94 172 void VBoxVMNetworkSettings::loadList (const QStringList &aList) 95 void VBoxVMNetworkSettings::loadList (const QStringList &aList, 96 const QString &aNillItem) 173 97 { 174 98 #if defined Q_WS_WIN 175 99 /* save current list item name */ 176 QString currentListItemName = leHostInterfaceName->text(); 100 QString currentListItemName = cbHostInterfaceName->currentText(); 101 /* clear current list */ 102 cbHostInterfaceName->clear(); 177 103 /* load current list items */ 178 lbHostInterface->clearFocus();179 lbHostInterface->clear();180 104 if (aList.count()) 181 lbHostInterface->insertStringList (aList); 105 { 106 cbHostInterfaceName->insertStringList (aList); 107 int index = aList.findIndex (currentListItemName); 108 if (index != -1) 109 cbHostInterfaceName->setCurrentItem (index); 110 } 182 111 else 183 lbHostInterface->insertItem (mNoInterfaces);184 selectListItem (currentListItemName);185 /* disable interface delete button */186 pbHostRemove->setEnabled (!aList.isEmpty());112 { 113 cbHostInterfaceName->insertItem (aNillItem); 114 cbHostInterfaceName->setCurrentItem (0); 115 } 187 116 #else 188 117 NOREF (aList); 118 NOREF (aNillItem); 189 119 #endif 190 120 } … … 211 141 212 142 #if defined Q_WS_WIN 213 selectListItem (adapter.GetHostInterface()); 143 QString name = adapter.GetHostInterface(); 144 for (int index = 0; index < cbHostInterfaceName->count(); ++ index) 145 if (cbHostInterfaceName->text (index) == name) 146 { 147 cbHostInterfaceName->setCurrentItem (index); 148 break; 149 } 150 if (cbHostInterfaceName->currentItem() == -1) 151 cbHostInterfaceName->setCurrentText (name); 214 152 #else 215 153 leHostInterface->setText (adapter.GetHostInterface()); … … 255 193 { 256 194 #if defined Q_WS_WIN 257 if (! lbHostInterface->currentText().isEmpty())258 cadapter.SetHostInterface ( lbHostInterface->currentText());195 if (!cbHostInterfaceName->currentText().isEmpty()) 196 cadapter.SetHostInterface (cbHostInterfaceName->currentText()); 259 197 #else 260 198 QString iface = leHostInterface->text(); … … 286 224 if (!aOn) 287 225 { 288 lbHostInterface->clearFocus();289 226 cbNetworkAttachment->setCurrentItem (0); 290 227 cbNetworkAttachment_activated (cbNetworkAttachment->currentText()); 291 if (lbHostInterface->selectedItem()) 292 lbHostInterface->setSelected (lbHostInterface->selectedItem(), false); 293 } 294 if (lbHostInterface->currentItem() != -1) 295 lbHostInterface->setSelected (lbHostInterface->currentItem(), aOn); 228 } 296 229 #else 297 230 NOREF (aOn); … … 299 232 } 300 233 301 void VBoxVMNetworkSettings::selectListItem (const QString &aItemName)302 {303 if (!aItemName.isEmpty())304 {305 #if defined Q_WS_WIN306 leHostInterfaceName->setText (aItemName);307 QListBoxItem* adapterNode = lbHostInterface->findItem (aItemName);308 if (adapterNode)309 {310 lbHostInterface->setCurrentItem (adapterNode);311 lbHostInterface->setSelected (adapterNode, true);312 }313 #endif314 }315 }316 317 234 void VBoxVMNetworkSettings::cbNetworkAttachment_activated (const QString &aString) 318 235 { 319 #if defined Q_WS_WIN320 236 bool enableHostIf = vboxGlobal().toNetworkAttachmentType (aString) == 321 237 CEnums::HostInterfaceNetworkAttachment; 238 #if defined Q_WS_WIN 322 239 txHostInterface_WIN->setEnabled (enableHostIf); 323 leHostInterfaceName->setEnabled (enableHostIf); 324 lbHostInterface_highlighted (lbHostInterface->selectedItem()); 325 #else 326 NOREF (aString); 327 #endif 328 } 329 330 void VBoxVMNetworkSettings::lbHostInterface_highlighted (QListBoxItem *aItem) 331 { 332 if (!aItem) return; 333 #if defined Q_WS_WIN 334 leHostInterfaceName->setText (leHostInterfaceName->isEnabled() ? 335 aItem->text() : QString::null); 336 if (!lbHostInterface->isSelected (aItem)) 337 lbHostInterface->setSelected (aItem, true); 240 cbHostInterfaceName->setEnabled (enableHostIf); 241 #else 242 grbTAP->setEnabled (enableHostIf); 338 243 #endif 339 244 } … … 382 287 leTAPTerminate->setText (selected); 383 288 } 384 385 void VBoxVMNetworkSettings::hostInterfaceAdd()386 {387 #if defined Q_WS_WIN388 389 /* allow the started helper process to make itself the foreground window */390 AllowSetForegroundWindow (ASFW_ANY);391 392 /* search for the max available interface index */393 int ifaceNumber = 0;394 QString ifaceName = tr ("VirtualBox Host Interface %1");395 QRegExp regExp (QString ("^") + ifaceName.arg ("([0-9]+)") + QString ("$"));396 for (uint index = 0; index < lbHostInterface->count(); ++ index)397 {398 QString iface = lbHostInterface->text (index);399 int pos = regExp.search (iface);400 if (pos != -1)401 ifaceNumber = regExp.cap (1).toInt() > ifaceNumber ?402 regExp.cap (1).toInt() : ifaceNumber;403 }404 405 /* creating add host interface dialog */406 VBoxAddNIDialog dlg (this, ifaceName.arg (ifaceNumber + 1));407 if (dlg.exec() != QDialog::Accepted)408 return;409 QString iName = dlg.getName();410 411 /* create interface */412 CHost host = vboxGlobal().virtualBox().GetHost();413 CHostNetworkInterface iFace;414 CProgress progress = host.CreateHostNetworkInterface (iName, iFace);415 if (host.isOk())416 {417 vboxProblem().showModalProgressDialog (progress, iName, this);418 if (progress.GetResultCode() == 0)419 {420 /* add&select newly created created interface */421 delete lbHostInterface->findItem (mNoInterfaces);422 lbHostInterface->insertItem (iName);423 selectListItem (iName);424 pbHostRemove->setEnabled (true);425 emit listChanged (this);426 }427 else428 vboxProblem().cannotCreateHostInterface (progress, iName, this);429 }430 else431 vboxProblem().cannotCreateHostInterface (host, iName, this);432 433 /* allow the started helper process to make itself the foreground window */434 AllowSetForegroundWindow (ASFW_ANY);435 436 #endif437 }438 439 void VBoxVMNetworkSettings::hostInterfaceRemove()440 {441 #if defined Q_WS_WIN442 443 /* allow the started helper process to make itself the foreground window */444 AllowSetForegroundWindow (ASFW_ANY);445 446 /* check interface name */447 QString iName = lbHostInterface->currentText();448 if (iName.isEmpty())449 return;450 451 /* asking user about deleting selected network interface */452 int delNetIface = vboxProblem().message (this, VBoxProblemReporter::Question,453 tr ("<p>Do you want to remove the selected host network interface "454 "<nobr><b>%1</b>?</nobr></p>"455 "<p><b>Note:</b> This interface may be in use by one or more "456 "network adapters of this or another VM. After it is removed, these "457 "adapters will no longer work until you correct their settings by "458 "either choosing a different interface name or a different adapter "459 "attachment type.</p>").arg (iName),460 0, /* autoConfirmId */461 QIMessageBox::Ok | QIMessageBox::Default,462 QIMessageBox::Cancel | QIMessageBox::Escape);463 if (delNetIface == QIMessageBox::Cancel)464 return;465 466 CHost host = vboxGlobal().virtualBox().GetHost();467 CHostNetworkInterface iFace = host.GetNetworkInterfaces().FindByName (iName);468 if (host.isOk())469 {470 /* delete interface */471 CProgress progress = host.RemoveHostNetworkInterface (iFace.GetId(), iFace);472 if (host.isOk())473 {474 vboxProblem().showModalProgressDialog (progress, iName, this);475 if (progress.GetResultCode() == 0)476 {477 if (lbHostInterface->count() == 1)478 {479 lbHostInterface->insertItem (mNoInterfaces);480 pbHostRemove->setEnabled (false);481 }482 delete lbHostInterface->findItem (iName);483 emit listChanged (this);484 }485 else486 vboxProblem().cannotRemoveHostInterface (progress, iFace, this);487 }488 }489 490 if (!host.isOk())491 vboxProblem().cannotRemoveHostInterface (host, iFace, this);492 #endif493 }494 495 #if defined Q_WS_WIN496 #include "VBoxVMNetworkSettings.ui.moc"497 #endif -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMSettingsDlg.ui
r2932 r2973 28 28 <y>0</y> 29 29 <width>486</width> 30 <height>4 05</height>30 <height>493</height> 31 31 </rect> 32 32 </property> … … 295 295 <number>3</number> 296 296 </property> 297 <property name="whatsThis" stdset="0"> 298 <string>Lists all available host interfaces.</string> 299 </property> 297 300 </widget> 298 301 <widget class="QLabel" row="0" column="1"> … … 1963 1966 <number>5</number> 1964 1967 </attribute> 1968 <vbox> 1969 <property name="name"> 1970 <cstring>unnamed</cstring> 1971 </property> 1972 <property name="margin"> 1973 <number>0</number> 1974 </property> 1975 <widget class="QGroupBox"> 1976 <property name="name"> 1977 <cstring>gbInterfaceList</cstring> 1978 </property> 1979 <vbox> 1980 <property name="name"> 1981 <cstring>unnamed</cstring> 1982 </property> 1983 <widget class="QLayoutWidget"> 1984 <property name="name"> 1985 <cstring>layout99</cstring> 1986 </property> 1987 <hbox> 1988 <property name="name"> 1989 <cstring>unnamed</cstring> 1990 </property> 1991 <property name="spacing"> 1992 <number>6</number> 1993 </property> 1994 <widget class="QListBox"> 1995 <property name="name"> 1996 <cstring>lbHostInterface</cstring> 1997 </property> 1998 <property name="sizePolicy"> 1999 <sizepolicy> 2000 <hsizetype>7</hsizetype> 2001 <vsizetype>7</vsizetype> 2002 <horstretch>0</horstretch> 2003 <verstretch>0</verstretch> 2004 </sizepolicy> 2005 </property> 2006 <property name="whatsThis" stdset="0"> 2007 <string>Lists all available host interfaces.</string> 2008 </property> 2009 </widget> 2010 <widget class="QLayoutWidget"> 2011 <property name="name"> 2012 <cstring>layout27</cstring> 2013 </property> 2014 <vbox> 2015 <property name="name"> 2016 <cstring>unnamed</cstring> 2017 </property> 2018 <property name="margin"> 2019 <number>0</number> 2020 </property> 2021 <property name="spacing"> 2022 <number>0</number> 2023 </property> 2024 <widget class="QToolButton"> 2025 <property name="name"> 2026 <cstring>pbHostAdd</cstring> 2027 </property> 2028 <property name="focusPolicy"> 2029 <enum>StrongFocus</enum> 2030 </property> 2031 <property name="text"> 2032 <string></string> 2033 </property> 2034 <property name="autoRaise"> 2035 <bool>true</bool> 2036 </property> 2037 <property name="toolTip" stdset="0"> 2038 <string></string> 2039 </property> 2040 <property name="whatsThis" stdset="0"> 2041 <string>Adds a new host interface.</string> 2042 </property> 2043 </widget> 2044 <widget class="QToolButton"> 2045 <property name="name"> 2046 <cstring>pbHostRemove</cstring> 2047 </property> 2048 <property name="focusPolicy"> 2049 <enum>StrongFocus</enum> 2050 </property> 2051 <property name="text"> 2052 <string></string> 2053 </property> 2054 <property name="autoRaise"> 2055 <bool>true</bool> 2056 </property> 2057 <property name="toolTip" stdset="0"> 2058 <string></string> 2059 </property> 2060 <property name="whatsThis" stdset="0"> 2061 <string>Removes the selected host interface.</string> 2062 </property> 2063 </widget> 2064 <spacer> 2065 <property name="name"> 2066 <cstring>spacer7</cstring> 2067 </property> 2068 <property name="orientation"> 2069 <enum>Vertical</enum> 2070 </property> 2071 <property name="sizeType"> 2072 <enum>Expanding</enum> 2073 </property> 2074 <property name="sizeHint"> 2075 <size> 2076 <width>10</width> 2077 <height>10</height> 2078 </size> 2079 </property> 2080 </spacer> 2081 </vbox> 2082 </widget> 2083 </hbox> 2084 </widget> 2085 </vbox> 2086 </widget> 2087 </vbox> 1965 2088 </widget> 1966 2089 <widget class="QWidget"> … … 1978 2101 <number>0</number> 1979 2102 </property> 2103 <property name="spacing"> 2104 <number>10</number> 2105 </property> 1980 2106 <widget class="QCheckBox"> 1981 2107 <property name="name"> … … 2010 2136 <property name="name"> 2011 2137 <cstring>unnamed</cstring> 2138 </property> 2139 <property name="margin"> 2140 <number>0</number> 2141 </property> 2142 <property name="spacing"> 2143 <number>0</number> 2012 2144 </property> 2013 2145 <widget class="QListView"> … … 2671 2803 <receiver>VBoxVMSettingsDlg</receiver> 2672 2804 <slot>tbUSBFilterDown_clicked()</slot> 2805 </connection> 2806 <connection> 2807 <sender>pbHostAdd</sender> 2808 <signal>clicked()</signal> 2809 <receiver>VBoxVMSettingsDlg</receiver> 2810 <slot>hostInterfaceAdd()</slot> 2811 </connection> 2812 <connection> 2813 <sender>pbHostRemove</sender> 2814 <signal>clicked()</signal> 2815 <receiver>VBoxVMSettingsDlg</receiver> 2816 <slot>hostInterfaceRemove()</slot> 2673 2817 </connection> 2674 2818 </connections> … … 2785 2929 <variable access="private">QIRichLabel *whatsThisLabel;</variable> 2786 2930 <variable access="private">BootItemsList *tblBootOrder;</variable> 2931 <variable access="private">QString mNoInterfaces;</variable> 2787 2932 <variable access="private">bool mResetFirstRunFlag;</variable> 2788 2933 </variables> … … 2820 2965 <slot>cdMediaChanged()</slot> 2821 2966 <slot>fdMediaChanged()</slot> 2822 <slot>updateInterfaces( QWidget* )</slot>2823 2967 <slot>networkPageUpdate( QWidget* )</slot> 2968 <slot>hostInterfaceAdd()</slot> 2969 <slot>hostInterfaceRemove()</slot> 2824 2970 <slot>resetFirstRunFlag()</slot> 2825 2971 </slots> … … 2834 2980 <function access="private">updateShortcuts()</function> 2835 2981 <function access="private" returnType="QString">getHdInfo( QGroupBox*, QUuid )</function> 2982 <function access="private">loadInterfacesList()</function> 2836 2983 </functions> 2837 2984 <pixmapinproject/> -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMSettingsDlg.ui.h
r2958 r2973 32 32 33 33 extern const char *GUI_FirstRun; 34 35 36 /** 37 * QDialog class reimplementation to use for adding network interface. 38 * It has one line-edit field for entering network interface's name and 39 * common dialog's ok/cancel buttons. 40 */ 41 class VBoxAddNIDialog : public QDialog 42 { 43 Q_OBJECT 44 45 public: 46 47 VBoxAddNIDialog (QWidget *aParent, const QString &aIfaceName) : 48 QDialog (aParent, "VBoxAddNIDialog", true /* modal */), 49 mLeName (0) 50 { 51 setCaption (tr ("Add Host Interface")); 52 QVBoxLayout *mainLayout = new QVBoxLayout (this, 10, 10, "mainLayout"); 53 54 /* Setup Input layout */ 55 QHBoxLayout *inputLayout = new QHBoxLayout (mainLayout, 10, "inputLayout"); 56 QLabel *lbName = new QLabel (tr ("Interface Name"), this); 57 mLeName = new QLineEdit (aIfaceName, this); 58 QWhatsThis::add (mLeName, tr ("Descriptive name of the new network interface")); 59 inputLayout->addWidget (lbName); 60 inputLayout->addWidget (mLeName); 61 connect (mLeName, SIGNAL (textChanged (const QString &)), 62 this, SLOT (validate())); 63 64 /* Setup Button layout */ 65 QHBoxLayout *buttonLayout = new QHBoxLayout (mainLayout, 10, "buttonLayout"); 66 mBtOk = new QPushButton (tr ("&OK"), this, "mBtOk"); 67 QSpacerItem *spacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum); 68 QPushButton *btCancel = new QPushButton (tr ("Cancel"), this, "btCancel"); 69 connect (mBtOk, SIGNAL (clicked()), this, SLOT (accept())); 70 connect (btCancel, SIGNAL (clicked()), this, SLOT (reject())); 71 buttonLayout->addWidget (mBtOk); 72 buttonLayout->addItem (spacer); 73 buttonLayout->addWidget (btCancel); 74 75 /* Validate interface name field */ 76 validate(); 77 } 78 79 ~VBoxAddNIDialog() {} 80 81 QString getName() { return mLeName->text(); } 82 83 private slots: 84 85 void validate() 86 { 87 mBtOk->setEnabled (!mLeName->text().isEmpty()); 88 } 89 90 private: 91 92 void showEvent (QShowEvent *aEvent) 93 { 94 setFixedHeight (height()); 95 QDialog::showEvent (aEvent); 96 } 97 98 QPushButton *mBtOk; 99 QLineEdit *mLeName; 100 }; 34 101 35 102 … … 625 692 626 693 /* Network Page */ 627 628 QVBoxLayout* pageNetworkLayout = new QVBoxLayout (pageNetwork, 0, 10, "pageNetworkLayout"); 694 #ifndef Q_WS_WIN 695 gbInterfaceList->setHidden (true); 696 #endif 697 698 /* setup tab widget */ 699 QVBoxLayout* pageNetworkLayout = static_cast<QVBoxLayout*> (pageNetwork->layout()); 629 700 tbwNetwork = new QTabWidget (pageNetwork, "tbwNetwork"); 630 pageNetworkLayout->addWidget (tbwNetwork); 701 pageNetworkLayout->insertWidget (0, tbwNetwork); 702 tbwNetwork->setSizePolicy (QSizePolicy::Minimum, QSizePolicy::Minimum); 703 mNoInterfaces = tr ("<No suitable interfaces>"); 704 /* setup iconsets */ 705 pbHostAdd->setIconSet (VBoxGlobal::iconSet ("add_host_iface_16px.png", 706 "add_host_iface_disabled_16px.png")); 707 pbHostRemove->setIconSet (VBoxGlobal::iconSet ("remove_host_iface_16px.png", 708 "remove_host_iface_disabled_16px.png")); 709 /* setup languages */ 710 QToolTip::add (pbHostAdd, tr ("Add")); 711 QToolTip::add (pbHostRemove, tr ("Remove")); 631 712 632 713 /* USB Page */ … … 774 855 /* Network Page */ 775 856 776 updateInterfaces (0);857 loadInterfacesList(); 777 858 778 859 /* … … 878 959 } 879 960 880 881 void VBoxVMSettingsDlg::updateInterfaces (QWidget *aWidget) 961 void VBoxVMSettingsDlg::loadInterfacesList() 882 962 { 883 963 #if defined Q_WS_WIN 884 /* clear list */964 /* clear inner list */ 885 965 mInterfaceList.clear(); 886 /* write a QStringList of interface names*/966 /* load current inner list */ 887 967 CHostNetworkInterfaceEnumerator en = 888 968 vboxGlobal().virtualBox().GetHost().GetNetworkInterfaces().Enumerate(); 889 969 while (en.HasMore()) 890 970 mInterfaceList += en.GetNext().GetName(); 891 if (aWidget) 892 { 893 VBoxVMNetworkSettings *set = static_cast<VBoxVMNetworkSettings*> (aWidget); 894 set->revalidate(); 895 } 896 #else 897 NOREF (aWidget); 971 /* save current list item name */ 972 QString currentListItemName = lbHostInterface->currentText(); 973 /* load current list items */ 974 lbHostInterface->clear(); 975 if (mInterfaceList.count()) 976 lbHostInterface->insertStringList (mInterfaceList); 977 else 978 lbHostInterface->insertItem (mNoInterfaces); 979 /* select current list item */ 980 int index = lbHostInterface->index ( 981 lbHostInterface->findItem (currentListItemName)); 982 if (index == -1) 983 index = 0; 984 lbHostInterface->setCurrentItem (index); 985 lbHostInterface->setSelected (index, true); 986 /* enable/disable interface delete button */ 987 pbHostRemove->setEnabled (!mInterfaceList.isEmpty()); 988 #endif 989 } 990 991 void VBoxVMSettingsDlg::hostInterfaceAdd() 992 { 993 #if defined Q_WS_WIN 994 995 /* allow the started helper process to make itself the foreground window */ 996 AllowSetForegroundWindow (ASFW_ANY); 997 998 /* search for the max available interface index */ 999 int ifaceNumber = 0; 1000 QString ifaceName = tr ("VirtualBox Host Interface %1"); 1001 QRegExp regExp (QString ("^") + ifaceName.arg ("([0-9]+)") + QString ("$")); 1002 for (uint index = 0; index < lbHostInterface->count(); ++ index) 1003 { 1004 QString iface = lbHostInterface->text (index); 1005 int pos = regExp.search (iface); 1006 if (pos != -1) 1007 ifaceNumber = regExp.cap (1).toInt() > ifaceNumber ? 1008 regExp.cap (1).toInt() : ifaceNumber; 1009 } 1010 1011 /* creating add host interface dialog */ 1012 VBoxAddNIDialog dlg (this, ifaceName.arg (++ ifaceNumber)); 1013 if (dlg.exec() != QDialog::Accepted) 1014 return; 1015 QString iName = dlg.getName(); 1016 1017 /* create interface */ 1018 CHost host = vboxGlobal().virtualBox().GetHost(); 1019 CHostNetworkInterface iFace; 1020 CProgress progress = host.CreateHostNetworkInterface (iName, iFace); 1021 if (host.isOk()) 1022 { 1023 vboxProblem().showModalProgressDialog (progress, iName, this); 1024 if (progress.GetResultCode() == 0) 1025 { 1026 /* add&select newly created interface */ 1027 delete lbHostInterface->findItem (mNoInterfaces); 1028 lbHostInterface->insertItem (iName); 1029 mInterfaceList += iName; 1030 lbHostInterface->setCurrentItem (lbHostInterface->count() - 1); 1031 lbHostInterface->setSelected (lbHostInterface->count() - 1, true); 1032 for (int index = 0; index < tbwNetwork->count(); ++ index) 1033 networkPageUpdate (tbwNetwork->page (index)); 1034 /* enable interface delete button */ 1035 pbHostRemove->setEnabled (true); 1036 } 1037 else 1038 vboxProblem().cannotCreateHostInterface (progress, iName, this); 1039 } 1040 else 1041 vboxProblem().cannotCreateHostInterface (host, iName, this); 1042 1043 /* allow the started helper process to make itself the foreground window */ 1044 AllowSetForegroundWindow (ASFW_ANY); 1045 1046 #endif 1047 } 1048 1049 void VBoxVMSettingsDlg::hostInterfaceRemove() 1050 { 1051 #if defined Q_WS_WIN 1052 1053 /* allow the started helper process to make itself the foreground window */ 1054 AllowSetForegroundWindow (ASFW_ANY); 1055 1056 /* check interface name */ 1057 QString iName = lbHostInterface->currentText(); 1058 if (iName.isEmpty()) 1059 return; 1060 1061 /* asking user about deleting selected network interface */ 1062 int delNetIface = vboxProblem().message (this, VBoxProblemReporter::Question, 1063 tr ("<p>Do you want to remove the selected host network interface " 1064 "<nobr><b>%1</b>?</nobr></p>" 1065 "<p><b>Note:</b> This interface may be in use by one or more " 1066 "network adapters of this or another VM. After it is removed, these " 1067 "adapters will no longer work until you correct their settings by " 1068 "either choosing a different interface name or a different adapter " 1069 "attachment type.</p>").arg (iName), 1070 0, /* autoConfirmId */ 1071 QIMessageBox::Ok | QIMessageBox::Default, 1072 QIMessageBox::Cancel | QIMessageBox::Escape); 1073 if (delNetIface == QIMessageBox::Cancel) 1074 return; 1075 1076 CHost host = vboxGlobal().virtualBox().GetHost(); 1077 CHostNetworkInterface iFace = host.GetNetworkInterfaces().FindByName (iName); 1078 if (host.isOk()) 1079 { 1080 /* delete interface */ 1081 CProgress progress = host.RemoveHostNetworkInterface (iFace.GetId(), iFace); 1082 if (host.isOk()) 1083 { 1084 vboxProblem().showModalProgressDialog (progress, iName, this); 1085 if (progress.GetResultCode() == 0) 1086 { 1087 if (lbHostInterface->count() == 1) 1088 { 1089 lbHostInterface->insertItem (mNoInterfaces); 1090 /* disable interface delete button */ 1091 pbHostRemove->setEnabled (false); 1092 } 1093 delete lbHostInterface->findItem (iName); 1094 lbHostInterface->setSelected (lbHostInterface->currentItem(), true); 1095 mInterfaceList.erase (mInterfaceList.find (iName)); 1096 for (int index = 0; index < tbwNetwork->count(); ++ index) 1097 networkPageUpdate (tbwNetwork->page (index)); 1098 } 1099 else 1100 vboxProblem().cannotRemoveHostInterface (progress, iFace, this); 1101 } 1102 } 1103 1104 if (!host.isOk()) 1105 vboxProblem().cannotRemoveHostInterface (host, iFace, this); 898 1106 #endif 899 1107 } … … 903 1111 if (!aWidget) return; 904 1112 #if defined Q_WS_WIN 905 updateInterfaces (0);906 1113 VBoxVMNetworkSettings *set = static_cast<VBoxVMNetworkSettings*> (aWidget); 907 set->loadList (mInterfaceList );1114 set->loadList (mInterfaceList, mNoInterfaces); 908 1115 set->revalidate(); 909 1116 #endif … … 1869 2076 { 1870 2077 VBoxVMNetworkSettings *page = new VBoxVMNetworkSettings(); 1871 page->loadList (mInterfaceList );2078 page->loadList (mInterfaceList, mNoInterfaces); 1872 2079 page->getFromAdapter (aAdapter); 1873 2080 tbwNetwork->addTab (page, QString (tr ("Adapter %1", "network")) … … 1884 2091 connect (page->cbNetworkAttachment, SIGNAL (activated (const QString &)), 1885 2092 wval, SLOT (revalidate())); 1886 1887 #if defined Q_WS_WIN1888 connect (page->lbHostInterface, SIGNAL (highlighted (QListBoxItem*)),1889 wval, SLOT (revalidate()));1890 connect (tbwNetwork, SIGNAL (currentChanged (QWidget*)),1891 this, SLOT (networkPageUpdate (QWidget*)));1892 connect (page, SIGNAL (listChanged (QWidget*)),1893 this, SLOT (updateInterfaces (QWidget*)));1894 #endif1895 1896 2093 connect (wval, SIGNAL (validityChanged (const QIWidgetValidator *)), 1897 2094 this, SLOT (enableOk (const QIWidgetValidator *)));
Note:
See TracChangeset
for help on using the changeset viewer.