Classified ads
Public Slots | Signals | Public Member Functions | Private Member Functions | Private Attributes | List of all members
Controller Class Reference

Class for keeping app state. More...

#include <controller.h>

Inheritance diagram for Controller:
Inheritance graph
[legend]
Collaboration diagram for Controller:
Collaboration graph
[legend]

Public Slots

virtual void exitApp ()
 
virtual void displayAboutBox ()
 
virtual void displayFront ()
 
virtual void changeProfilePasswd ()
 
virtual void createProfile ()
 
virtual void deleteProfile ()
 
virtual void selectProfile ()
 
virtual void displaySettings ()
 
virtual void displayStatus ()
 
virtual void displaySearch ()
 
virtual void handleError (MController::CAErrorSituation aError, const QString &aExplanation)
 
void notifyOfContentReceived (const Hash &aHashOfContent, const ProtocolItemType aTypeOfReceivedContent)
 
void notifyOfContentReceived (const Hash &aHashOfContent, const Hash &aHashOfClassification, const ProtocolItemType aTypeOfReceivedContent)
 
void notifyOfContentNotReceived (const Hash &aHashOfContent, const ProtocolItemType aTypeOfNotReceivdContent)
 
virtual void storePrivateDataOfSelectedProfile (bool aPublishTrustListToo=false)
 
virtual void reStorePrivateDataOfSelectedProfile ()
 
virtual bool isContactInContactList (const Hash &aFingerPrint) const
 
virtual QString displayableNameForProfile (const Hash &aProfileFingerPrint) const
 
virtual void offerDisplayNameForProfile (const Hash &aProfileFingerPrint, const QString &aDisplayName, const bool iUpdatePersistenStorage=false)
 
virtual void displayFileInfoOnUi (const BinaryFile &aFileMetadata)
 
virtual VoiceCallEnginevoiceCallEngine ()
 
virtual MVoiceCallEnginevoiceCallEngineInterface ()
 
void sendProfileUpdateQuery (const Hash &aProfileFingerPrint, const Hash &aProfileNodeFingerPrint=KNullHash)
 
- Public Slots inherited from MController
virtual void exitApp ()=0
 
virtual void displayAboutBox ()=0
 
virtual void displayFront ()=0
 
virtual void handleError (MController::CAErrorSituation aError, const QString &aExplanation)=0
 
virtual void storePrivateDataOfSelectedProfile (bool aPublishTrustListToo=false)=0
 
virtual void reStorePrivateDataOfSelectedProfile ()=0
 
virtual bool isContactInContactList (const Hash &aFingerPrint) const =0
 
virtual QString displayableNameForProfile (const Hash &aProfileFingerPrint) const =0
 
virtual void offerDisplayNameForProfile (const Hash &aProfileFingerPrint, const QString &aDisplayName, const bool iUpdatePersistenStorage=false)=0
 
virtual void displayFileInfoOnUi (const BinaryFile &aFileMetadata)=0
 
virtual VoiceCallEnginevoiceCallEngine ()=0
 
virtual MVoiceCallEnginevoiceCallEngineInterface ()=0
 

Signals

void userProfileSelected (const Hash &aProfile)
 
void waitDialogToBeDismissed ()
 

Public Member Functions

 Controller (QApplication &app)
 
 ~Controller ()
 
virtual void startRetrievingContent (NetworkRequestExecutor::NetworkRequestQueueItem aReq, bool aIsBackgroundDl, ProtocolItemType aTypeOfExpectedObject)
 
virtual void userInterfaceAction (CAUserInterfaceRequest aRequest, const Hash &aHashConcerned=KNullHash, const Hash &aFetchFromNode=KNullHash, const QString *aAdditionalInformation=NULL)
 
virtual void hideUI ()
 
virtual void showUI ()
 
virtual void setProfileInUse (const Hash &aProfileHash)
 
virtual const HashprofileInUse ()
 
virtual void setContentKeyPasswd (QString aPasswd)
 
virtual QString contentKeyPasswd () const
 
virtual NodegetNode () const
 
virtual NetworkListenernetworkListener () const
 
virtual Modelmodel () const
 

Private Member Functions

void createMenus ()
 
int createPidFile ()
 
void deletePidFile ()
 

Private Attributes

QMainWindow * iWin
 
FrontWidgetiCurrentWidget
 
QApplication & iApp
 
QBoxLayout * iLayout
 
QMenu * iFileMenu
 
QAction * iExitAct
 
QAction * iAboutAct
 
QAction * iPwdChangeAct
 
QAction * iProfileDeleteAct
 
QAction * iProfileCreateAct
 
QAction * iProfileSelectAct
 
QAction * iDisplaySettingsAct
 
QAction * iDisplayStatusAct
 
QAction * iDisplaySearchAct
 
NodeiNode
 
ModeliModel
 
NetworkListeneriListener
 
NetworkConnectorEngineiNetEngine
 
QString iContentKeyPasswd
 
Hash iProfileHash
 
PublishingEngineiPubEngine
 
RetrievalEngineiRetrievalEngine
 
ProtocolItemType iTypeOfObjectBeingWaitedFor
 
Hash iHashOfObjectBeingWaitedFor
 
Hash iHashOfProfileCommentBeingWaitedFor
 
Hash iNodeForCommentBeingWaitedFor
 
QMap< Hash, QString > iHashDisplaynameMapping
 
VoiceCallEngineiVoiceCallEngine
 
bool iInsideDestructor
 

Additional Inherited Members

- Public Types inherited from MController
enum  CAErrorSituation {
  OwnCertNotFound, DataBaseNotMountable, BadPassword, DbTransactionError,
  ContentEncryptionError, FileOperationError
}
 
enum  CAUserInterfaceRequest {
  ViewProfileDetails, ViewCa, ViewProfileComment, DisplayProgressDialog,
  VoiceCallToNode
}
 

Detailed Description

Class for keeping app state.

C of MVC-pattern is considered here. UI events are routed via this class and this implements scheduling of events so that things happen in correct order.

Constructor & Destructor Documentation

Controller::Controller ( QApplication &  app)

constructor

Controller::~Controller ( )

Destructor

Member Function Documentation

virtual void Controller::changeProfilePasswd ( )
virtualslot

name says it all. initiates UI sequence

virtual QString Controller::contentKeyPasswd ( ) const
virtual

method for getting passwd of private content keys previously set, see method Controller::setContentKeyPasswd

Implements MController.

void Controller::createMenus ( )
private

menus here

int Controller::createPidFile ( )
private
virtual void Controller::createProfile ( )
virtualslot

Initiates UI sequence for new profile

void Controller::deletePidFile ( )
private

leave a mark to filesystem about instance

virtual void Controller::deleteProfile ( )
virtualslot

Initiates UI sequence for deleting profile

virtual QString Controller::displayableNameForProfile ( const Hash aProfileFingerPrint) const
virtualslot

method for producing a displayable version of a profile. in practice this utilitizes the contacts of the selected profile and a cache that is collected from private messages, ads, profile comments and profiles

virtual void Controller::displayAboutBox ( )
virtualslot

bragging

virtual void Controller::displayFileInfoOnUi ( const BinaryFile aFileMetadata)
virtualslot

method that puts dialog or similar on display, about a published file

virtual void Controller::displayFront ( )
virtualslot

this initializes the "normal" display

virtual void Controller::displaySearch ( )
virtualslot

Slot for displaying search dialog

virtual void Controller::displaySettings ( )
virtualslot

Slot for displaying node settings

virtual void Controller::displayStatus ( )
virtualslot

Slot for displaying network status

virtual void Controller::exitApp ( )
virtualslot

quitting

virtual Node& Controller::getNode ( ) const
virtual

Method for node ; this may be changed during startup-phase but not after that

Implements MController.

virtual void Controller::handleError ( MController::CAErrorSituation  aError,
const QString &  aExplanation 
)
virtualslot

Method for handling errors inside application.

Parameters
aErrorReason for error call, from error enum above
aExplanationNULL or human-readable description about what went wrong.
virtual void Controller::hideUI ( )
virtual

method for hiding UI

Implements MController.

virtual bool Controller::isContactInContactList ( const Hash aFingerPrint) const
virtualslot

method for checking if a profile is found from contact list of selected user

virtual Model& Controller::model ( ) const
virtual

method for getting datamodel

Implements MController.

virtual NetworkListener* Controller::networkListener ( ) const
virtual

method for network listener ; it is parent of all connections, also the outgoing

Implements MController.

void Controller::notifyOfContentNotReceived ( const Hash aHashOfContent,
const ProtocolItemType  aTypeOfNotReceivdContent 
)
slot

This is receiving slot of signals sent from retrieval engine; when we try to receive content and we do not get any, this notifies user that time-out is due

Parameters
aHashOfContentitem that was requested
aTypeOfNotReceivdContentitem type requested
void Controller::notifyOfContentReceived ( const Hash aHashOfContent,
const ProtocolItemType  aTypeOfReceivedContent 
)
slot

This is receiving slot of signals sent from actual content handlers ; when we receive new content, this method is hit, reason for this is that we may be waiting for specific content somewhere

Parameters
aHashOfContentitem that was requested
aTypeOfReceivedContentitem type requested
void Controller::notifyOfContentReceived ( const Hash aHashOfContent,
const Hash aHashOfClassification,
const ProtocolItemType  aTypeOfReceivedContent 
)
slot

This is receiving slot of signals sent from actual content handlers ; when we receive new content, this method is hit, reason for this is that we may be waiting for specific content somewhere. This overload is mostly hit by classified ads.

Parameters
aHashOfContentitem that was requested
aHashOfClassificationof item that was requested
aTypeOfReceivedContentitem type requested
virtual void Controller::offerDisplayNameForProfile ( const Hash aProfileFingerPrint,
const QString &  aDisplayName,
const bool  iUpdatePersistenStorage = false 
)
virtualslot

method for keeping profile hash<->displayname relation up to date. this is called when display names are seen in profiles, ads, private messages etc.

virtual const Hash& Controller::profileInUse ( )
virtual

method getting user profile in use.

Implements MController.

virtual void Controller::reStorePrivateDataOfSelectedProfile ( )
virtualslot

method for restoring private data of profile currently in use. shall be called after new profile is selected in frontwidget.

virtual void Controller::selectProfile ( )
virtualslot

Initiates UI sequence for selecting profile

void Controller::sendProfileUpdateQuery ( const Hash aProfileFingerPrint,
const Hash aProfileNodeFingerPrint = KNullHash 
)
slot

method for sending a poll around network regarding possible update for a profile and possible addition of comments about given profile.

datamodel should not be locked when this is called.

in practice this is called after user selects a profile to be viewed ; it could be called periodically too for selected profiles..

Parameters
aProfileFingerPrintis fingerprint of the profile concerned.
aProfileNodeFingerPrintfingerprint of node that is suspected to be the node where profile is published from. this is naturally good candidate for sending the query.
virtual void Controller::setContentKeyPasswd ( QString  aPasswd)
virtual

method for setting passwd used to open private content encryption rsa key. this password is stored in controller and is then used by content-open/sign-operations when crypto lib asks for password.

Implements MController.

virtual void Controller::setProfileInUse ( const Hash aProfileHash)
virtual

method selecting user profile in use.

Implements MController.

virtual void Controller::showUI ( )
virtual

method for showing UI

Implements MController.

virtual void Controller::startRetrievingContent ( NetworkRequestExecutor::NetworkRequestQueueItem  aReq,
bool  aIsBackgroundDl,
ProtocolItemType  aTypeOfExpectedObject 
)
virtual

method that starts actions regarding content fetch from network

Parameters
aReqspecifies the content,at least iRequestType and iRequestedItem need to be there
aIsBackgroundDlis true if the retrieval may be queued into background as a low-priority item

Implements MController.

virtual void Controller::storePrivateDataOfSelectedProfile ( bool  aPublishTrustListToo = false)
virtualslot

Method for persisting profile private data inside datamodel. Tnis is supposed to be called every time after private data changes.

lock the datamodel before calling this method

Parameters
aPublishTrustListTooif set to true, has selected profiles trust list to be updated profile data and profile published with the new trust list.
virtual void Controller::userInterfaceAction ( CAUserInterfaceRequest  aRequest,
const Hash aHashConcerned = KNullHash,
const Hash aFetchFromNode = KNullHash,
const QString *  aAdditionalInformation = NULL 
)
virtual

From MController.

Method for requesting different things to take place in UI. controller mostly routes these to FrontWidget but other actions may be in order too..

Parameters
aRequestusers orders
aHashConcernedpossible hash parameter ; can be null hash if action is not about specific hash
aFetchFromNodepossible node hash parameter ; if concerning item is not found from local storage, try to fetch it from given node ; is KNullHash, then just do fetch using normal algorithm.
aAdditionalInformationpossible explanation or other info
Returns
none

Implements MController.

void Controller::userProfileSelected ( const Hash aProfile)
signal
virtual VoiceCallEngine* Controller::voiceCallEngine ( )
virtualslot

Method for getting voice call engine, if there is any. From MController interface.

Returns
engine or null
virtual MVoiceCallEngine* Controller::voiceCallEngineInterface ( )
virtualslot

Method for getting voice call engine, if there is any. From MController interface.

Returns
engine or mockup. In normal runtime this just calls voiceCallEngine.
void Controller::waitDialogToBeDismissed ( )
signal

used for signalling possible wait dialog about dismissal

Member Data Documentation

QAction* Controller::iAboutAct
private
QApplication& Controller::iApp
private
QString Controller::iContentKeyPasswd
private
FrontWidget* Controller::iCurrentWidget
private

normally points to "frontwidget" instance

QAction* Controller::iDisplaySearchAct
private
QAction* Controller::iDisplaySettingsAct
private
QAction* Controller::iDisplayStatusAct
private
QAction* Controller::iExitAct
private
QMenu* Controller::iFileMenu
private
QMap<Hash,QString> Controller::iHashDisplaynameMapping
private

profile hash<->display_name mapping

Hash Controller::iHashOfObjectBeingWaitedFor
private

hash of object that user needs to wait.

Hash Controller::iHashOfProfileCommentBeingWaitedFor
private

hash of profile comment that user needs to wait. This is used in two-stage fetch process of profile comment where the profile may need to be retrieved first, then the comment: we store there the profile comment hash for duration of profile fetch

bool Controller::iInsideDestructor
private

Flag for destructor. If this is on, don't allocate more objects

QBoxLayout* Controller::iLayout
private
NetworkListener* Controller::iListener
private

Incoming connections handler, for ipv4

Model* Controller::iModel
private

data storage animal

NetworkConnectorEngine* Controller::iNetEngine
private

Outgoing connections handler

Node* Controller::iNode
private

our network presence object, there is single instance

Hash Controller::iNodeForCommentBeingWaitedFor
private

Node where to ask for profile comment once profile has been fetched

QAction* Controller::iProfileCreateAct
private
QAction* Controller::iProfileDeleteAct
private
Hash Controller::iProfileHash
private

passwd used to protect profile private RSA key fingerprint of profile currently in use

QAction* Controller::iProfileSelectAct
private
PublishingEngine* Controller::iPubEngine
private

Logic for handling content publish

QAction* Controller::iPwdChangeAct
private
RetrievalEngine* Controller::iRetrievalEngine
private

Logic for fetcing stuff from other nodes

ProtocolItemType Controller::iTypeOfObjectBeingWaitedFor
private

if user requests for item that we do not have, lets put a wait dialog in place and start wait for the object to appear from network. in order to properly dismiss the dialog, have here type (and later hash) of the objects that we're waiting for

VoiceCallEngine* Controller::iVoiceCallEngine
private

Currently there is support for one voice call at time

QMainWindow* Controller::iWin
private

remove mark from filesystem about instance


The documentation for this class was generated from the following file: