- Timestamp:
- Aug 10, 2010 1:08:56 PM (14 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 4 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk
r30868 r31533 276 276 src/extensions/QITabWidget.h \ 277 277 src/extensions/QIToolButton.h \ 278 src/extensions/QITableView.h \ 278 279 src/extensions/QITreeView.h \ 279 280 src/extensions/QITreeWidget.h \ … … 296 297 src/settings/vm/VBoxVMSettingsAudio.h \ 297 298 src/settings/vm/VBoxVMSettingsNetwork.h \ 299 src/settings/vm/VBoxVMSettingsPortForwardingDlg.h \ 298 300 src/settings/vm/VBoxVMSettingsSerial.h \ 299 301 src/settings/vm/VBoxVMSettingsParallel.h \ … … 370 372 src/extensions/QISplitter.cpp \ 371 373 src/selector/UIVMDesktop.cpp \ 374 src/settings/vm/VBoxVMSettingsPortForwardingDlg.cpp \ 372 375 src/runtime/UIActionsPool.cpp \ 373 376 src/runtime/UIIndicatorsPool.cpp \ … … 429 432 src/extensions/QIStateIndicator.cpp \ 430 433 src/extensions/QIStatusBar.cpp \ 434 src/extensions/QITableView.cpp \ 431 435 src/extensions/QITreeView.cpp \ 432 436 src/extensions/QITreeWidget.cpp \ … … 448 452 src/settings/vm/VBoxVMSettingsAudio.cpp \ 449 453 src/settings/vm/VBoxVMSettingsNetwork.cpp \ 454 src/settings/vm/VBoxVMSettingsPortForwardingDlg.cpp \ 450 455 src/settings/vm/VBoxVMSettingsSerial.cpp \ 451 456 src/settings/vm/VBoxVMSettingsParallel.cpp \ -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
r31320 r31533 2783 2783 tr ("VDE Adapter", "NetworkAttachmentType"); 2784 2784 #endif 2785 2786 mNATProtocolTypes [KNATProtocol_UDP] = 2787 tr ("UDP", "NATProtocolType"); 2788 mNATProtocolTypes [KNATProtocol_TCP] = 2789 tr ("TCP", "NATProtocolType"); 2785 2790 2786 2791 mClipboardTypes [KClipboardMode_Disabled] = -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h
r31319 r31533 469 469 } 470 470 471 QString toString (KNATProtocol t) const 472 { 473 AssertMsg (!mNATProtocolTypes.value (t).isNull(), ("No text for %d", t)); 474 return mNATProtocolTypes.value (t); 475 } 476 477 KNATProtocol toNATProtocolType (const QString &s) const 478 { 479 QULongStringHash::const_iterator it = 480 qFind (mNATProtocolTypes.begin(), mNATProtocolTypes.end(), s); 481 AssertMsg (it != mNATProtocolTypes.end(), ("No value for {%s}", 482 s.toLatin1().constData())); 483 return KNATProtocol (it.key()); 484 } 485 471 486 QString toString (KUSBDeviceState aState) const 472 487 { … … 784 799 QULongStringHash mNetworkAdapterTypes; 785 800 QULongStringHash mNetworkAttachmentTypes; 801 QULongStringHash mNATProtocolTypes; 786 802 QULongStringHash mClipboardTypes; 787 803 QULongStringHash mStorageControllerTypes; -
trunk/src/VBox/Frontends/VirtualBox/src/settings/vm/VBoxVMSettingsNetwork.cpp
r29972 r31533 57 57 connect (mAbsAdvanced, SIGNAL (clicked()), this, SLOT (toggleAdvanced())); 58 58 connect (mTbMAC, SIGNAL (clicked()), this, SLOT (generateMac())); 59 connect (mPbPortForwarding, SIGNAL (clicked()), this, SLOT (sltOpenPortsForwadringDlg())); 59 60 60 61 #ifdef Q_WS_MAC … … 120 121 mLeMAC->setText (mAdapter.GetMACAddress()); 121 122 mCbCableConnected->setChecked (mAdapter.GetCableConnected()); 123 124 /* Load port forwarding rules: */ 125 QVector<QString> redirects = mAdapter.GetNatDriver().GetRedirects(); 126 for (int i = 0; i < redirects.size(); ++i) 127 { 128 QStringList redirectData = redirects[i].split(','); 129 AssertMsg(redirectData.size() == 6, ("Redirect rule should be composed of 6 parts!\n")); 130 mPortForwardingRules << UIPortForwardingData(redirectData[0], 131 (KNATProtocol)redirectData[1].toUInt(), 132 redirectData[2], 133 redirectData[3].toUInt(), 134 redirectData[4], 135 redirectData[5].toUInt()); 136 } 122 137 } 123 138 … … 165 180 mAdapter.SetMACAddress (mLeMAC->text().isEmpty() ? QString::null : mLeMAC->text()); 166 181 mAdapter.SetCableConnected (mCbCableConnected->isChecked()); 182 183 /* Save port forwarding rules: */ 184 QVector<QString> redirects = mAdapter.GetNatDriver().GetRedirects(); 185 for (int i = 0; i < redirects.size(); ++i) 186 mAdapter.GetNatDriver().RemoveRedirect(redirects[i].section(',', 0, 0)); 187 for (int i = 0; i < mPortForwardingRules.size(); ++i) 188 { 189 UIPortForwardingData redirectData = mPortForwardingRules[i]; 190 mAdapter.GetNatDriver().AddRedirect(redirectData.name, redirectData.protocol, 191 redirectData.hostIp, redirectData.hostPort, 192 redirectData.guestIp, redirectData.guestPort); 193 } 167 194 } 168 195 … … 236 263 setTabOrder (mLeMAC, mTbMAC); 237 264 setTabOrder (mTbMAC, mCbCableConnected); 238 return mCbCableConnected; 265 setTabOrder (mCbCableConnected, mPbPortForwarding); 266 return mPbPortForwarding; 239 267 } 240 268 … … 414 442 updateAlternativeName(); 415 443 444 /* Update Forwarding rules button availability: */ 445 mPbPortForwarding->setEnabled(attachmentType() == KNetworkAttachmentType_NAT); 446 416 447 /* Unblocking signals as content is changed already */ 417 448 mCbAdapterName->blockSignals (false); … … 488 519 mTbMAC->setVisible (mAbsAdvanced->isExpanded()); 489 520 mCbCableConnected->setVisible (mAbsAdvanced->isExpanded()); 521 mPbPortForwarding->setVisible (mAbsAdvanced->isExpanded()); 490 522 } 491 523 … … 494 526 mAdapter.SetMACAddress (QString::null); 495 527 mLeMAC->setText (mAdapter.GetMACAddress()); 528 } 529 530 void VBoxVMSettingsNetwork::sltOpenPortsForwadringDlg() 531 { 532 VBoxVMSettingsPortForwardingDlg dlg(this, mPortForwardingRules); 533 if (dlg.exec() == QDialog::Accepted) 534 mPortForwardingRules = dlg.rules(); 496 535 } 497 536 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/vm/VBoxVMSettingsNetwork.h
r29972 r31533 24 24 #include "VBoxSettingsPage.h" 25 25 #include "VBoxVMSettingsNetwork.gen.h" 26 #include "VBoxVMSettingsPortForwardingDlg.h" 26 27 27 28 /* VBox Forwardes */ … … 62 63 void toggleAdvanced(); 63 64 void generateMac(); 65 void sltOpenPortsForwadringDlg(); 64 66 65 67 private: … … 80 82 bool mPolished; 81 83 bool mDisableStaticControls; 84 UIPortForwardingDataList mPortForwardingRules; 82 85 }; 83 86 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/vm/VBoxVMSettingsNetwork.ui
r28800 r31533 217 217 </widget> 218 218 </item> 219 <item row="6" column="0" colspan="4"> 219 <item row="6" column="1"> 220 <widget class="QPushButton" name="mPbPortForwarding"> 221 <property name="whatsThis"> 222 <string>Opens dialog to manage port forwarding rules.</string> 223 </property> 224 <property name="text"> 225 <string>&Port Forwarding</string> 226 </property> 227 </widget> 228 </item> 229 <item row="7" column="0" colspan="4"> 220 230 <spacer name="verticalSpacer"> 221 231 <property name="orientation">
Note:
See TracChangeset
for help on using the changeset viewer.