Changeset 53328 in vbox
- Timestamp:
- Nov 14, 2014 2:02:43 PM (10 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp
r53291 r53328 1117 1117 tr("The current port forwarding rules are not valid. " 1118 1118 "Rule names should be unique.")); 1119 return false; 1120 } 1121 1122 bool UIMessageCenter::warnAboutRulesConflict(QWidget *pParent /* = 0 */) const 1123 { 1124 alert(pParent, MessageType_Error, 1125 tr("The current port forwarding rules are not valid. " 1126 "Few rules have same host ports and conflicting IP addresses.")); 1119 1127 return false; 1120 1128 } -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h
r53291 r53328 232 232 bool warnAboutIncorrectPort(QWidget *pParent = 0) const; 233 233 bool warnAboutNameShouldBeUnique(QWidget *pParent = 0) const; 234 bool warnAboutRulesConflict(QWidget *pParent = 0) const; 234 235 bool confirmCancelingPortForwardingDialog(QWidget *pParent = 0) const; 235 236 void cannotCreateSharedFolder(const CMachine &machine, const QString &strName, const QString &strPath, QWidget *pParent = 0); -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIPortForwardingTable.cpp
r53295 r53328 30 30 # include <QLineEdit> 31 31 # include <QSpinBox> 32 # include <QHostAddress> 32 33 33 34 /* GUI includes: */ … … 692 693 /* Validate table: */ 693 694 QSet<QString> usedNames; 695 QMap<int, QString> rules; 694 696 for (int i = 0; i < m_pModel->rowCount(); ++i) 695 697 { … … 705 707 else 706 708 return msgCenter().warnAboutNameShouldBeUnique(window()); 709 710 /* Make sure rules are not in conflict: */ 711 const ushort iHostPort = m_pModel->data(m_pModel->index(i, UIPortForwardingModel::UIPortForwardingDataType_HostPort), Qt::EditRole).value<PortData>().value(); 712 const QString strHostAddressNew = m_pModel->data(m_pModel->index(i, UIPortForwardingModel::UIPortForwardingDataType_HostIp), Qt::EditRole).value<IpData>(); 713 if (rules.contains(iHostPort)) 714 { 715 const QString strHostAddressOld = rules.value(iHostPort); 716 if ( strHostAddressNew == strHostAddressOld 717 || strHostAddressNew.isEmpty() || QHostAddress(strHostAddressNew).isNull() 718 || strHostAddressOld.isEmpty() || QHostAddress(strHostAddressOld).isNull()) 719 return msgCenter().warnAboutRulesConflict(window()); 720 } 721 else 722 rules[iHostPort] = strHostAddressNew; 707 723 } 708 724 /* True by default: */
Note:
See TracChangeset
for help on using the changeset viewer.