Classified ads
profilereaderslistingmodel.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 PROFILEREADERLISTINGMODEL_H
21 #define PROFILEREADERLISTINGMODEL_H
22 
23 #include <QAbstractTableModel>
24 #include "../util/hash.h"
25 #include "../mcontroller.h"
26 
27 class Profile ;
28 class Model ;
32 class ProfileReadersListingModel: public QAbstractTableModel {
33  Q_OBJECT
34 public:
43  void addReader(const Hash& aFingerPrint) ;
49  void removeReader(const Hash& aFingerPrint) ;
50 
54  QString profileDisplayNameByFingerPrint(const Hash& aFingerPrint) ;
55 
60  virtual int rowCount(const QModelIndex & parent = QModelIndex()) const ;
65  virtual int columnCount ( const QModelIndex & parent = QModelIndex() ) const ;
70  virtual QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const ;
71  virtual QVariant headerData(int aSection, Qt::Orientation orientation, int role) const ;
72 signals:
74  const QString& aExplanation) ;
75 private: // methods
76  void updateReaderDataInArray( const Hash& aFingerPrint,bool aEmit ) ;
77 private: // data
79  QList<QPair<Hash,QString> > iNamesAndFingerPrints ;
80 } ;
81 #endif
virtual int rowCount(const QModelIndex &parent=QModelIndex()) const
QString profileDisplayNameByFingerPrint(const Hash &aFingerPrint)
Hash is class that carries 160-bit digest.
Definition: hash.h:37
CAErrorSituation
Definition: mcontroller.h:48
Model-class for helping display of readers of a profile.
Definition: profilereaderslistingmodel.h:32
void updateReaderDataInArray(const Hash &aFingerPrint, bool aEmit)
QList< QPair< Hash, QString > > iNamesAndFingerPrints
Definition: profilereaderslistingmodel.h:79
virtual int columnCount(const QModelIndex &parent=QModelIndex()) const
void addReader(const Hash &aFingerPrint)
M of the MVC pattern. Handles permanent storage.
Definition: model.h:47
void error(MController::CAErrorSituation aError, const QString &aExplanation)
Profile & iProfile
Definition: profilereaderslistingmodel.h:78
void removeReader(const Hash &aFingerPrint)
virtual QVariant headerData(int aSection, Qt::Orientation orientation, int role) const
Carrier-class for user-profile data.
Definition: profile.h:36
virtual QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
ProfileReadersListingModel(Profile &aProfile)