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
7  modify it under the terms of the GNU Lesser General Public
8  License as published by the Free Software Foundation; either
9  version 2.1 of the License, or (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 GNU
14  Lesser General Public License for more details.
15 
16  You should have received a copy of the GNU Lesser General Public
17  License along with Classified Ads; if not, write to the Free Software
18  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20 
21 #ifndef CONNECTIONLISTINGMODEL_H
22 #define CONNECTIONLISTINGMODEL_H
23 
24 #include "../mcontroller.h"
25 #include "../net/connection.h"
26 #include <QAbstractTableModel>
27 
28 class Model ;
29 
35 class ConnectionListingModel: public QAbstractTableModel {
36  Q_OBJECT
37 public:
44  QHostAddress iAddr ;
45  bool iIsInBound ;
46  unsigned long iBytesIn ;
47  unsigned long iBytesOut ;
48  time_t iOpenTime ;
51 
52  ConnectionListingModel(Model& aModel,MController& aController) ;
54 
55  virtual int rowCount(const QModelIndex & parent = QModelIndex()) const ;
60  virtual int columnCount(const QModelIndex & parent = QModelIndex()) const ;
65  virtual QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const ;
66  virtual QVariant headerData ( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const ;
67 
68 signals:
70  const QString& aExplanation) ;
71 
72 protected: // methods
76  void timerEvent(QTimerEvent *event);
77 private: // methods
78  void updateModelContents() ;
79 private: // data
82  QList<ConnectionDisplayItem> iConnections ;
83  int iTimerId ;
84 } ;
85 #endif
bool iIsInBound
Definition: connectionlistingmodel.h:45
time_t iOpenTime
Definition: connectionlistingmodel.h:48
Model-class for displaying open network connections This is the underlying data-container of the "net...
Definition: connectionlistingmodel.h:35
QList< ConnectionDisplayItem > iConnections
Definition: connectionlistingmodel.h:82
QHostAddress iAddr
Definition: connectionlistingmodel.h:44
MController & iController
Definition: connectionlistingmodel.h:81
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:38
CAErrorSituation
Definition: mcontroller.h:52
virtual int rowCount(const QModelIndex &parent=QModelIndex()) const
ConnectionListingModel(Model &aModel, MController &aController)
unsigned long iBytesOut
Definition: connectionlistingmodel.h:47
unsigned long iBytesIn
Definition: connectionlistingmodel.h:46
Model & iModel
Definition: connectionlistingmodel.h:80
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:43
Definition: connectionlistingmodel.h:43
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:48
Hash iNodeFingerPrint
Definition: connectionlistingmodel.h:49
int iTimerId
Definition: connectionlistingmodel.h:83
struct ConnectionListingModel::ConnectionDisplayItemStructure ConnectionDisplayItem