Classified ads
calistingmodel.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 CALISTINGMODEL_H
22 #define CALISTINGMODEL_H
23 
24 #include <QStandardItemModel>
25 #include "../util/hash.h"
26 #include "../mcontroller.h"
27 #include "camodel.h"
28 
29 class BinaryFile ;
30 class Model ;
31 class MController ;
35 class CAListingModel: public QObject , public ClassifiedAdsModel::CAObserver {
36  Q_OBJECT
37 public:
43  CAListingModel(const Hash& aForumToList,
44  const MModelProtocolInterface &aModel,
45  MController* aController ) ;
46  ~CAListingModel() ;
52  QStandardItemModel* theCaModel() ;
53 
58  void setClassification(const Hash& aForumToList) ;
63  virtual void newCaReceived(const CA& aNewCa) ;
68  virtual void newCaReceived(const Hash& aHashNewCa,
69  const Hash& aHashOfClassification) ;
70 
71 signals:
73  const QString& aExplanation) ;
74 private: // methods
75  bool insertCaIntoModel(const Hash& aArticleFingerPrint) ;
76 private: // data
77  QStandardItemModel iCaModel ;
87  QHash<int, QStandardItem *>* iItemAndArticleHashRelation ;
89  QStandardItem *iListingHeaderDate ;
90  QStandardItem *iListingHeaderSubject ;
91 } ;
92 #endif
bool insertCaIntoModel(const Hash &aArticleFingerPrint)
void setClassification(const Hash &aForumToList)
const MModelProtocolInterface & iModel
Definition: calistingmodel.h:79
MController * iController
Definition: calistingmodel.h:88
Hash iForumToList
Definition: calistingmodel.h:78
Hash is class that carries 160-bit digest.
Definition: hash.h:38
CAErrorSituation
Definition: mcontroller.h:52
Model-class for helping display of classified ads.
Definition: calistingmodel.h:35
virtual void newCaReceived(const CA &aNewCa)
QStandardItemModel * theCaModel()
Carrier-class for binary blob.
Definition: binaryfile.h:37
Carrier-class for classified ad.
Definition: ca.h:35
Pure-virtual interface of datamodel for message parser to use.
Definition: mmodelprotocolinterface.h:45
Pure-virtual interface class for controller. This is spammed across parties needing access to applica...
Definition: mcontroller.h:43
QHash< int, QStandardItem * > * iItemAndArticleHashRelation
Definition: calistingmodel.h:87
QStandardItemModel iCaModel
Definition: calistingmodel.h:77
M of the MVC pattern. Handles permanent storage.
Definition: model.h:48
QStandardItem * iListingHeaderDate
Definition: calistingmodel.h:89
void error(MController::CAErrorSituation aError, const QString &aExplanation)
QStandardItem * iListingHeaderSubject
Definition: calistingmodel.h:90
Definition: camodel.h:98
CAListingModel(const Hash &aForumToList, const MModelProtocolInterface &aModel, MController *aController)