Changeset 87247 in vbox
- Timestamp:
- Jan 14, 2021 10:00:18 AM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 142205
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/widgets
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIPortForwardingTable.cpp
r87246 r87247 439 439 440 440 /** Returns the list of port forwarding rules. */ 441 const UIPortForwardingDataList rules() const; 441 UIPortForwardingDataList rules() const; 442 /** Defines the list of port forwarding @a newRules. */ 443 void setRules(const UIPortForwardingDataList &newRules); 442 444 /** Adds empty port forwarding rule for certain @a index. */ 443 445 void addRule(const QModelIndex &index); … … 531 533 } 532 534 533 constUIPortForwardingDataList UIPortForwardingModel::rules() const535 UIPortForwardingDataList UIPortForwardingModel::rules() const 534 536 { 535 537 /* Return the cached data: */ … … 540 542 pRow->guestIp(), pRow->guestPort()); 541 543 return data; 544 } 545 546 void UIPortForwardingModel::setRules(const UIPortForwardingDataList &newRules) 547 { 548 /* Clear old data first of all: */ 549 beginRemoveRows(QModelIndex(), 0, m_dataList.size() - 1); 550 foreach (const UIPortForwardingRow *pRow, m_dataList) 551 delete pRow; 552 m_dataList.clear(); 553 endRemoveRows(); 554 555 /* Fetch incoming data: */ 556 beginInsertRows(QModelIndex(), 0, newRules.size() - 1); 557 foreach (const UIDataPortForwardingRule &rule, newRules) 558 m_dataList << new UIPortForwardingRow(qobject_cast<QITableView*>(parent()), 559 rule.name, rule.protocol, 560 rule.hostIp, rule.hostPort, 561 rule.guestIp, rule.guestPort); 562 endInsertRows(); 542 563 } 543 564 … … 769 790 } 770 791 771 constUIPortForwardingDataList UIPortForwardingTable::rules() const792 UIPortForwardingDataList UIPortForwardingTable::rules() const 772 793 { 773 794 return m_pTableModel->rules(); 795 } 796 797 void UIPortForwardingTable::setRules(const UIPortForwardingDataList &newRules) 798 { 799 m_rules = newRules; 800 m_pTableModel->setRules(m_rules); 801 sltAdjustTable(); 774 802 } 775 803 -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIPortForwardingTable.h
r87246 r87247 215 215 216 216 /** Returns the list of port forwarding rules. */ 217 const UIPortForwardingDataList rules() const; 217 UIPortForwardingDataList rules() const; 218 /** Defines the list of port forwarding @a newRules. */ 219 void setRules(const UIPortForwardingDataList &newRules); 218 220 219 221 /** Validates the table. */ … … 268 270 void prepareToolbar(); 269 271 270 /** Holds the _initial_ list of Port Forwarding rules. */271 const UIPortForwardingDataList &m_rules;272 /** Holds the list of port forwarding rules. */ 273 UIPortForwardingDataList m_rules; 272 274 273 275 /** Holds whether this table contains IPv6 rules, not IPv4. */
Note:
See TracChangeset
for help on using the changeset viewer.