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