Classified ads
connectionlistingmodel.h
Go to the documentation of this file.
1 /* -*-C++-*- -*-coding: utf-8-unix;-*-
2  Classified Ads is Copyright (c) Antti Järvinen 2013.
3 
4  This file is part of Classified Ads.
5 
6  Classified Ads is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  Classified Ads is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with Classified Ads. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #ifndef CONNECTIONLISTINGMODEL_H
21 #define CONNECTIONLISTINGMODEL_H
22 
23 #include "../mcontroller.h"
24 #include "../net/connection.h"
25 #include <QAbstractTableModel>
26 
27 class Model ;
28 
34 class ConnectionListingModel: public QAbstractTableModel {
35  Q_OBJECT
36 public:
43  QHostAddress iAddr ;
44  bool iIsInBound ;
45  unsigned long iBytesIn ;
46  unsigned long iBytesOut ;
47  time_t iOpenTime ;
50 
51  ConnectionListingModel(Model& aModel,MController& aController) ;
53 
54  virtual int rowCount(const QModelIndex & parent = QModelIndex()) const ;
59  virtual int columnCount(const QModelIndex & parent = QModelIndex()) const ;
64  virtual QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const ;
65  virtual QVariant headerData ( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const ;
66 
67 signals:
69  const QString& aExplanation) ;
70 
71 protected: // methods
75  void timerEvent(QTimerEvent *event);
76 private: // methods
77  void updateModelContents() ;
78 private: // data
81  QList<ConnectionDisplayItem> iConnections ;
82  int iTimerId ;
83 } ;
84 #endif
bool iIsInBound
Definition: connectionlistingmodel.h:44
time_t iOpenTime
Definition: connectionlistingmodel.h:47
Model-class for displaying open network connections This is the underlying data-container of the "net...
Definition: connectionlistingmodel.h:34
QList< ConnectionDisplayItem > iConnections
Definition: connectionlistingmodel.h:81
QHostAddress iAddr
Definition: connectionlistingmodel.h:43
MController & iController
Definition: connectionlistingmodel.h:80
virtual QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
void timerEvent(QTimerEvent *event)
Hash is class that carries 160-bit digest.
Definition: hash.h:37
CAErrorSituation
Definition: mcontroller.h:48
virtual int rowCount(const QModelIndex &parent=QModelIndex()) const
ConnectionListingModel(Model &aModel, MController &aController)
unsigned long iBytesOut
Definition: connectionlistingmodel.h:46
unsigned long iBytesIn
Definition: connectionlistingmodel.h:45
Model & iModel
Definition: connectionlistingmodel.h:79
virtual QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
Pure-virtual interface class for controller. This is spammed across parties needing access to applica...
Definition: mcontroller.h:39
Definition: connectionlistingmodel.h:42
void error(MController::CAErrorSituation aError, const QString &aExplanation)
virtual int columnCount(const QModelIndex &parent=QModelIndex()) const
M of the MVC pattern. Handles permanent storage.
Definition: model.h:47
Hash iNodeFingerPrint
Definition: connectionlistingmodel.h:48
int iTimerId
Definition: connectionlistingmodel.h:82
struct ConnectionListingModel::ConnectionDisplayItemStructure ConnectionDisplayItem