Classified ads
mcontroller.h
Go to the documentation of this file.
1 /* -*-C++-*- -*-coding: utf-8-unix;-*-
2  Classified Ads is Copyright (c) Antti Järvinen 2013-2017.
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 M_CONTROLLER_H
22 #define M_CONTROLLER_H
23 #include <QObject>
24 #include "util/hash.h" // Hash
26 #include "datamodel/cadbrecord.h" // for CaDbRecord::SearchTerms
27 
28 #define CLASSIFIED_ADS_VERSION "0.11"
29 
30 class Node ;
31 class Model ;
32 class NetworkListener ;
35 class BinaryFile ;
36 class VoiceCallEngine ;
37 class MVoiceCallEngine ;
38 class TclWrapper ;
39 class QWidget ;
40 
48 class MController : public QObject {
49  Q_OBJECT
50 
51 public:
65  } ;
66 
77  } ;
78 
91  bool aIsBackgroundDl,
92  ProtocolItemType aTypeOfExpectedObject ) = 0 ;
98  virtual void startRetrievingContent( CaDbRecord::SearchTerms aSearchTerms ) = 0 ;
99 
114  virtual void userInterfaceAction ( CAUserInterfaceRequest aRequest,
115  const Hash& aHashConcerned = KNullHash,
116  const Hash& aFetchFromNode = KNullHash,
117  const QString* aAdditionalInformation = NULL ) = 0 ;
118 
119  virtual void hideUI() = 0 ;
123  virtual void showUI() = 0 ;
127  virtual void setProfileInUse(const Hash& aProfileHash) = 0 ;
131  virtual const Hash& profileInUse() = 0 ;
138  virtual void setContentKeyPasswd(QString aPasswd) = 0 ;
143  virtual QString contentKeyPasswd() const = 0;
144 
145 public slots:
146  virtual void exitApp() = 0 ;
147  virtual void displayAboutBox() = 0 ;
148  virtual void displayFront() = 0 ;
155  virtual void handleError(MController::CAErrorSituation aError,
156  const QString& aExplanation) = 0 ;
161  virtual Node& getNode() const = 0 ;
166  virtual NetworkListener *networkListener() const = 0 ;
170  virtual Model &model() const = 0 ;
178  virtual void storePrivateDataOfSelectedProfile(bool aPublishTrustListToo = false ) = 0 ;
183  virtual void reStorePrivateDataOfSelectedProfile() = 0 ;
187  virtual bool isContactInContactList(const Hash& aFingerPrint) const = 0;
188  virtual QString displayableNameForProfile(const Hash& aProfileFingerPrint) const = 0 ;
189  virtual void offerDisplayNameForProfile(const Hash& aProfileFingerPrint,
190  const QString& aDisplayName,
191  const bool iUpdatePersistenStorage=false) = 0 ;
195  virtual void displayFileInfoOnUi(const BinaryFile& aFileMetadata) = 0 ;
201  virtual VoiceCallEngine* voiceCallEngine() = 0 ;
202 
211 
216  virtual TclWrapper &tclWrapper() = 0 ;
217 
222  virtual QWidget *frontWidget() = 0 ;
241  virtual QString getFileName(bool& aSuccess,
242  bool aIsSaveFile = false ,
243  QString aSuggestedFileName = QString()) = 0 ;
244 } ;
245 #endif
246 
virtual void setProfileInUse(const Hash &aProfileHash)=0
Pure-virtual interface for voice call engine.
Definition: mvoicecallengine.h:33
virtual VoiceCallEngine * voiceCallEngine()=0
Node is a peer in network.
Definition: node.h:40
Logic for handling tasks received from other peers or from user.
Definition: netrequestexecutor.h:40
virtual void offerDisplayNameForProfile(const Hash &aProfileFingerPrint, const QString &aDisplayName, const bool iUpdatePersistenStorage=false)=0
Definition: mcontroller.h:74
virtual void userInterfaceAction(CAUserInterfaceRequest aRequest, const Hash &aHashConcerned=KNullHash, const Hash &aFetchFromNode=KNullHash, const QString *aAdditionalInformation=NULL)=0
virtual void showUI()=0
virtual QString contentKeyPasswd() const =0
virtual void displayFront()=0
CAUserInterfaceRequest
Definition: mcontroller.h:71
virtual TclWrapper & tclWrapper()=0
virtual const Hash & profileInUse()=0
Definition: mcontroller.h:62
Definition: mcontroller.h:60
Hash is class that carries 160-bit digest.
Definition: hash.h:38
CAErrorSituation
Definition: mcontroller.h:57
virtual void exitApp()=0
Definition: mcontroller.h:76
virtual void displayAboutBox()=0
Definition: mcontroller.h:73
virtual Node & getNode() const =0
virtual NetworkListener * networkListener() const =0
ProtocolItemType
Definition: protocol.h:157
Carrier-class for binary blob.
Definition: binaryfile.h:37
Definition: mcontroller.h:63
virtual void hideUI()=0
virtual Model & model() const =0
class for listening to incoming network connections.
Definition: networklistener.h:42
Pure-virtual interface class for controller. This is spammed across parties needing access to applica...
Definition: mcontroller.h:48
Definition: mcontroller.h:75
Definition: mcontroller.h:72
Hash KNullHash
virtual void displayFileInfoOnUi(const BinaryFile &aFileMetadata)=0
M of the MVC pattern. Handles permanent storage.
Definition: model.h:50
virtual QString displayableNameForProfile(const Hash &aProfileFingerPrint) const =0
Class that will initiate 1 or more network connections.
Definition: networkconnectorengine.h:45
virtual void storePrivateDataOfSelectedProfile(bool aPublishTrustListToo=false)=0
virtual void handleError(MController::CAErrorSituation aError, const QString &aExplanation)=0
Definition: mcontroller.h:64
Definition: mcontroller.h:59
virtual QString getFileName(bool &aSuccess, bool aIsSaveFile=false, QString aSuggestedFileName=QString())=0
Definition: mcontroller.h:61
Work queue item.
Definition: netrequestexecutor.h:60
Class providing TCL interpreter services.
Definition: tclWrapper.h:652
virtual void reStorePrivateDataOfSelectedProfile()=0
virtual void setContentKeyPasswd(QString aPasswd)=0
virtual MVoiceCallEngine * voiceCallEngineInterface()=0
virtual void startRetrievingContent(NetworkRequestExecutor::NetworkRequestQueueItem aReq, bool aIsBackgroundDl, ProtocolItemType aTypeOfExpectedObject)=0
Network-related logic for handling voice channel between nodes.
Definition: voicecallengine.h:54
virtual QWidget * frontWidget()=0
Definition: cadbrecord.h:40
Definition: mcontroller.h:58
virtual bool isContactInContactList(const Hash &aFingerPrint) const =0