#include <NodeModel.h> [code]
Inherits QAbstractTableModel.
Inheritance diagram for NodeModel:


For building our GUI we are heavily using the Qt's Model/View Framework. It enables us to program the data representation and the way it is displayed to the user (almost) completely independantly.
Our NodeModel represents a list of nodes for each of which a nuber of properties are stored. This model can be visualized by any of the standard Qt view classes (QTableView, QTreeView).
Definition at line 48 of file NodeModel.h.
Public Types | |
| enum | Status { Connecting, Handshaking, Connected, Disconnecting, Disconnected } |
| Status of a node. More... | |
| enum | Type { Undetermined, Peer, Ultrapeer, Leaf } |
| Type of a node. More... | |
Public Slots | |
| void | nodeConnecting (Connection *, NodeAddress) |
| Adds a new node to the list. | |
| void | setHandshaking (Connection *) |
| void | setConnected (Connection *, NodeInfo) |
| void | setDisconnected (QObject *) |
Public Member Functions | |
| NodeModel () | |
| Constructor. | |
| ~NodeModel () | |
| int | rowCount (const QModelIndex &parent=QModelIndex()) const |
| int | columnCount (const QModelIndex &parent=QModelIndex()) const |
| QVariant | data (const QModelIndex &index, int role=Qt::DisplayRole) const |
| QVariant | headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const |
Private Types | |
| typedef QList< NodeData * > | NodeInfos |
| enum | Constants { ModelRefreshInterval = 1000, AddressIndex = 0, PortIndex, DurationIndex, TypeIndex, ServentIndex, ColumnCount } |
| Some constants. More... | |
Private Slots | |
| void | refreshModel () |
| Refreshes the whole model. | |
Private Member Functions | |
| bool | setNodeStatus (ConnectionId id, Status status) |
| Sets the node's status. | |
| bool | setNodeType (ConnectionId id, Type type) |
| Sets the node's type. | |
| bool | setNodeServent (ConnectionId id, const QString &servent) |
| Sets the node's servent name/version. | |
| bool | setNodePort (ConnectionId id, quint16 port) |
| Sets the node's port. | |
| bool | nodeDisconnected (ConnectionId id) |
| Removes a node from the list. | |
| int | nodeIndex (ConnectionId id) |
| Returns the row index of the node with id. | |
Private Attributes | |
| NodeInfos | nodeInfos |
| The list of node info fields. | |
| QTimer | updateTimer |
| View update timer. | |
| QSignalMapper | mapper |
Classes | |
| struct | NodeData |
| The struct storing all node info fields. More... | |
|
|
Definition at line 139 of file NodeModel.h. |
|
|
Some constants.
Definition at line 109 of file NodeModel.h. |
|
|
Status of a node.
Definition at line 55 of file NodeModel.h. |
|
|
Type of a node.
Definition at line 72 of file NodeModel.h. |
|
|
Constructor.
Definition at line 31 of file NodeModel.cpp. |
|
|
Definition at line 42 of file NodeModel.cpp. |
|
|
Definition at line 70 of file NodeModel.cpp. |
|
||||||||||||
|
Definition at line 75 of file NodeModel.cpp. |
|
||||||||||||||||
|
Definition at line 114 of file NodeModel.cpp. |
|
||||||||||||
|
Adds a new node to the list.
|
|
|
Removes a node from the list.
Definition at line 178 of file NodeModel.cpp. |
|
|
Returns the row index of the node with id.
Definition at line 50 of file NodeModel.cpp. |
|
|
Refreshes the whole model.
Definition at line 60 of file NodeModel.cpp. |
|
|
Definition at line 65 of file NodeModel.cpp. |
|
||||||||||||
|
|
|
|
Definition at line 173 of file NodeModel.cpp. |
|
|
|
|
||||||||||||
|
Sets the node's port.
Definition at line 239 of file NodeModel.cpp. |
|
||||||||||||
|
Sets the node's servent name/version.
Definition at line 228 of file NodeModel.cpp. |
|
||||||||||||
|
Sets the node's status. Sets the status of the node with id. If the status set is Status::Connected, then NodeInfo::startDateTime for the node is set to the current time and the duration field will show the duration of the established connection.
Definition at line 202 of file NodeModel.cpp. |
|
||||||||||||
|
Sets the node's type.
Definition at line 217 of file NodeModel.cpp. |
|
|
Definition at line 145 of file NodeModel.h. |
|
|
The list of node info fields.
Definition at line 143 of file NodeModel.h. |
|
|
View update timer.
Definition at line 144 of file NodeModel.h. |