Classified ads
/tmp/classified-ads/classified_ads/FrontWidget.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 FRONT_H
22 #define FRONT_H
23 #include <QtGui>
24 #include <QGraphicsScene>
25 #include <QGraphicsTextItem>
26 #include <QGraphicsSimpleTextItem>
27 #include "ui_frontWidget.h"
28 #include "controller.h"
30 #include "datamodel/ca.h"
32 #include "datamodel/privmsg.h"
33 #include <QHeaderView>
36 #include "net/voicecallengine.h" // for VoiceCallEngine::CallState
37 
38 class Profile ;
40 class QShortcut ;
41 class ProfileCommentModel ;
42 
43 class FrontWidget: public QWidget {
44  Q_OBJECT
45 
46 public:
47  FrontWidget(Controller* aController,QMainWindow& aParent ) ;
48  ~FrontWidget() ;
50  void showDetailsOfProfile(const Hash& aFingerPrint) ;
52  void showClassifiedAd(const CA& ca) ;
54  void showSingleCommentOfProfile(const Hash aCommentFingerPrint) ;
61  static void fillCaSelectionCombobox(QComboBox& aComboBox,
62  bool isAboutComboBox,
63  MController& aController) ;
69  static QString selectedClassification(const QComboBox& aAboutCombo,
70  const QComboBox& aRegardingCombo,
71  const QComboBox& aWhereCombo,
72  const MController& aController) ;
78  void receiveNotifyOfContentReceived(const Hash& aHashOfContent,
79  const ProtocolItemType aTypeOfReceivdContent) ;
92  void receiveNotifyOfContentReceived(const Hash& aHashOfContent,
93  const Hash& aHashOfClassificationOrDestination,
94  const ProtocolItemType aTypeOfReceivdContent) ;
98  QVariant contactDataOfSelectedProfile() ;
102  QList<Hash> trustListOfSelectedProfile() const ;
106  void setContactDataOfSelectedProfile(const QVariantList& aContacts) ;
111  bool isContactInContactList(const Hash& aFingerPrint) const ;
117  return iSelectedProfile ;
118  }
123  void openBinaryFile(const Hash& aFingerPrint,
124  bool aUseViewedProfileNodeAsNetreqDest = false ) ;
125 public slots:
126  virtual void publishProfileButtonClicked() ;
127  virtual void revertProfileButtonClicked() ;
128  virtual void profileImageClicked() ;
129  virtual void profileReadersClicked() ;
130  virtual void profileEdited(const QString& aNewText) ;
131  virtual void isPrivateSettingChanged(int aState) ;
132  virtual void userProfileSelected(const Hash& aProfile) ;
133  virtual void fileToBeSharedAdded() ;
134  virtual void fileToBeSharedRemoved() ;
135  virtual void exportSharedFile() ;
136  virtual void viewSharedFileInfo() ;
137  virtual void copySharedFileHash() ;
138  virtual void editNewSharedFile() ;
139  virtual void profileSendMsgButtonClicked() ;
140  virtual void profileShowReadersButtonClicked() ;
141  virtual void profileSendCommentButtonClicked() ;
142  virtual void caTabAboutComboChanged(int aNewIndex) ;
143  virtual void caTabConcernsComboChanged(int aNewIndex) ;
144  virtual void caTabWhereComboChanged(int aNewIndex) ;
145  // slots for buttons at bottom of "classified ads" ta
146  virtual void replyToCaButtonClicked() ;
147  virtual void replyToCaToForumButtonClicked() ;
148  virtual void commentCaPosterProfile() ;
149  virtual void viewCaPosterProfile() ;
150  virtual void viewCaAttachments() ;
151  virtual void postNewClassifiedAd() ;
152  virtual void performAdsSearchClicked() ;
157  virtual void CAselectionChangedSlot(const QItemSelection &, const QItemSelection &) ;
162  virtual void privMsgselectionChangedSlot(const QItemSelection &, const QItemSelection &) ;
166  virtual void contactsSelectionChangedSlot(const QItemSelection &, const QItemSelection &) ;
167  virtual void replyToPrivMsgButtonClicked() ;
168  virtual void commentPrivMsgPosterProfile() ;
169  virtual void viewPrivMsgPosterProfile() ;
170  virtual void postNewPrivateMessage() ;
172  virtual void viewPrivMsgAttachments() ;
173  virtual void addMessageSenderToContacts() ;
174  virtual void addCaSenderToContacts() ;
175  // slots related to contacts-tab
176  virtual void addContactButtonClicked() ;
179  virtual void removeContactButtonClicked() ;
180  virtual void viewContactProfileButtonClicked() ;
181  virtual void sendMsgToContactButtonClicked() ;
182  virtual void editContactActionSelected() ;
187  virtual void ownProfileCommentselectionChangedSlot(const QItemSelection &, const QItemSelection &) ;
192  virtual void viewedProfileCommentselectionChangedSlot(const QItemSelection &, const QItemSelection &) ;
197  virtual void viewedProfileCommentDoubleClicked(const QModelIndex &aSelection) ;
202  virtual void viewedProfileCommentKeyPressed() ;
207  virtual void ownProfileCommentDoubleClicked(const QModelIndex &aSelection) ;
211  virtual void linkActivated ( const QString &aLink ) ;
216  virtual void ownBinaryFileSelectionChangedSlot(const QModelIndex &aItem, const QModelIndex &aPreviousItem) ;
221  virtual void viewedBinaryFileSelectionChangedSlot(const QModelIndex &aItem, const QModelIndex &aPreviousItem) ;
235  const Hash aHashOfAttemptedNode );
240  void voiceCallButtonPressed() ;
245  void callStateChanged(quint32 aCallId,
246  VoiceCallEngine::CallState aState) ;
247 signals:
249  const QString& aExplanation) ;
251  void displayedCaChanged() ;
253  void displayedPrivMsgChanged() ;
254 private:
269  void setupClassifiedAdsTab() ;
275  void setupPrivateMessagesTab() ;
279  void setupContactsTab() ;
285  void selectClassification(QString aNameOfClassification) ;
300  ProfileCommentModel& aCommentModel,
301  const Hash& aInitialComment,
302  const Hash& aViewedProfile ) ;
303 private: // methods
304  void setCaDocumentSize() ;
305  void setPrivMsgSize() ;
306  void doShowFileMetadata(const Hash& aBinaryFileFingerPrint) ;
307  void setVoiceCallButtonStatus() ;
308 private:
309  Ui::frontWidget ui ;
311  QMainWindow& iParent ;
327  QPushButton* iReplyToCaButton ;
328  QPushButton* iReplyToCaToForumButton ;
330  QPushButton* iNewCaButton ;
332  QPushButton* iCommentCaPosterButton ;
339  QGraphicsScene iCaScene ;
340  QGraphicsTextItem iCaText ;
342  QGraphicsSimpleTextItem iFromField ;
343  QGraphicsSimpleTextItem iSubjectField ;
344  const QPoint iArticleTopLeft ;
345  // private message tab related variables
348  QGraphicsScene iPrivMsgScene ;
349  QGraphicsTextItem iPrivMsgText ;
350  QGraphicsSimpleTextItem iPrivMsgFromField ;
351  QGraphicsSimpleTextItem iPrivMsgSubjectField ;
352  const QPoint iPrivMsgTopLeft ;
353  QPushButton* iReplyToPrivMsgButton;
354  QPushButton* iNewPrivMsgButton ;
359  // variables related to contacts-list
363  // variables related to profile-comment display
380 } ;
381 #endif
virtual void viewedProfileCommentselectionChangedSlot(const QItemSelection &, const QItemSelection &)
QAction * iAddToContactsFromCaList
Definition: FrontWidget.h:337
Definition: FrontWidget.h:43
QList< Hash > trustListOfSelectedProfile() const
Carrier-class for private msg inside classified ads.
Definition: privmsg.h:36
Class for keeping app state.
Definition: controller.h:76
Hash iSelectedContact
Definition: FrontWidget.h:361
virtual void viewContactProfileButtonClicked()
QMainWindow & iParent
Definition: FrontWidget.h:311
void updateFileSelectionActions()
virtual void fileToBeSharedRemoved()
CA iCaOnDisplay
Definition: FrontWidget.h:341
virtual void addCaSenderToContacts()
QShortcut * iProfileListingKeyboardGrabber
Definition: FrontWidget.h:368
Hash iSelectedCommentFromOwnCommentListing
Definition: FrontWidget.h:366
void voiceCallButtonPressed()
void setPrivMsgSize()
QPushButton * iReplyToCaToForumButton
Definition: FrontWidget.h:328
virtual void addMessageSenderToContacts()
PrivMessage iPrivMsgOnDisplay
Definition: FrontWidget.h:347
void updateUiFromSelectedProfile()
void doShowFileMetadata(const Hash &aBinaryFileFingerPrint)
virtual void privMsgselectionChangedSlot(const QItemSelection &, const QItemSelection &)
QGraphicsScene iCaScene
Definition: FrontWidget.h:339
ProfileCommentListingModel iViewedProfileCommentListingModel
Definition: FrontWidget.h:365
This is is part of datamodel for storing comments of user profiles.
Definition: profilecommentmodel.h:38
virtual void postNewClassifiedAd()
void nodeConnectionAttemptStatus(Connection::ConnectionState aStatus, const Hash aHashOfAttemptedNode)
static void fillCaSelectionCombobox(QComboBox &aComboBox, bool isAboutComboBox, MController &aController)
QAction * iEditNewSharedFileAction
Definition: FrontWidget.h:319
virtual void caTabWhereComboChanged(int aNewIndex)
QPushButton * iViewCaPosterProfileButton
Definition: FrontWidget.h:334
virtual void copySharedFileHash()
void updateUiFromViewedProfile()
virtual void addContactButtonClicked()
virtual void exportSharedFile()
QPushButton * iCommentCaPosterButton
Definition: FrontWidget.h:332
virtual void profileImageClicked()
Profile * iSelectedProfile
Definition: FrontWidget.h:312
QGraphicsTextItem iCaText
Definition: FrontWidget.h:340
CAListingModel iCaListingModel
Definition: FrontWidget.h:338
QPushButton * iNewCaButton
Definition: FrontWidget.h:330
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 addContactFromContactViewButtonClicked()
void setupPrivateMessagesTab()
Hash iSelectedCommentFromViewedCommentListing
Definition: FrontWidget.h:367
virtual void caTabAboutComboChanged(int aNewIndex)
Profile * iViewedProfile
Definition: FrontWidget.h:313
QAction * iEditContactAction
Definition: FrontWidget.h:362
QGraphicsSimpleTextItem iFromField
Definition: FrontWidget.h:342
void displayedPrivMsgChanged()
void setupContactsTab()
QGraphicsTextItem iPrivMsgText
Definition: FrontWidget.h:349
PrivateMessageSearchModel iPrivMsgSearchModel
Definition: FrontWidget.h:346
ConnectionState
Definition: connection.h:47
QGraphicsSimpleTextItem iPrivMsgSubjectField
Definition: FrontWidget.h:351
virtual void replyToCaToForumButtonClicked()
ProtocolItemType
Definition: protocol.h:150
virtual void profileSendMsgButtonClicked()
QPushButton * iViewPrivMsgAttachmentsButton
Definition: FrontWidget.h:357
virtual void viewPrivMsgAttachments()
virtual void editContactActionSelected()
virtual void userProfileSelected(const Hash &aProfile)
virtual void commentPrivMsgPosterProfile()
QPushButton * iNewPrivMsgButton
Definition: FrontWidget.h:354
QGraphicsSimpleTextItem iSubjectField
Definition: FrontWidget.h:343
bool isContactInContactList(const Hash &aFingerPrint) const
Model-class for helping display of shared binary blobs, usually from a profile.
Definition: binaryfilelistingmodel.h:34
Hash iSelectedOwnBinaryFile
Definition: FrontWidget.h:374
virtual void isPrivateSettingChanged(int aState)
QPushButton * iCommentPrivMsgPosterButton
Definition: FrontWidget.h:355
virtual void profileSendCommentButtonClicked()
QPushButton * iViewPrivMsgPosterProfileButton
Definition: FrontWidget.h:356
virtual void profileEdited(const QString &aNewText)
void activateProfileCommentDisplay(ProfileCommentListingModel *aListingModel, ProfileCommentModel &aCommentModel, const Hash &aInitialComment, const Hash &aViewedProfile)
Carrier-class for classified ad.
Definition: ca.h:35
void receiveNotifyOfContentReceived(const Hash &aHashOfContent, const ProtocolItemType aTypeOfReceivdContent)
virtual void viewPrivMsgPosterProfile()
virtual void commentCaPosterProfile()
Profile * selectedProfile() const
Definition: FrontWidget.h:116
void displayedCaChanged()
Pure-virtual interface class for controller. This is spammed across parties needing access to applica...
Definition: mcontroller.h:43
Model-class for performing search on private messages. This is supposed to act as an underlying data-...
Definition: privmsgsearchmodel.h:36
virtual void removeContactButtonClicked()
void setContactDataOfSelectedProfile(const QVariantList &aContacts)
void error(MController::CAErrorSituation aError, const QString &aExplanation)
virtual void replyToPrivMsgButtonClicked()
virtual void profileReadersClicked()
virtual void profileShowReadersButtonClicked()
Hash iSelectedViewedProfileBinaryfile
Definition: FrontWidget.h:379
void showSingleCommentOfProfile(const Hash aCommentFingerPrint)
virtual void revertProfileButtonClicked()
ContactListingModel iContactsModel
Definition: FrontWidget.h:360
void showDetailsOfProfile(const Hash &aFingerPrint)
Ui::frontWidget ui
Definition: FrontWidget.h:309
virtual void replyToCaButtonClicked()
CallState
Definition: mvoicecallengine.h:38
const QPoint iPrivMsgTopLeft
Definition: FrontWidget.h:352
virtual void performAdsSearchClicked()
virtual void ownBinaryFileSelectionChangedSlot(const QModelIndex &aItem, const QModelIndex &aPreviousItem)
virtual void viewCaPosterProfile()
virtual void viewedProfileCommentDoubleClicked(const QModelIndex &aSelection)
static QString selectedClassification(const QComboBox &aAboutCombo, const QComboBox &aRegardingCombo, const QComboBox &aWhereCombo, const MController &aController)
QPushButton * iViewCaAttachmentsButton
Definition: FrontWidget.h:336
const QPoint iArticleTopLeft
Definition: FrontWidget.h:344
void callStateChanged(quint32 aCallId, VoiceCallEngine::CallState aState)
QPushButton * iReplyToCaButton
Definition: FrontWidget.h:327
QAction * iExportSharedFileAction
Definition: FrontWidget.h:316
virtual void viewSharedFileInfo()
virtual void publishProfileButtonClicked()
FrontWidget(Controller *aController, QMainWindow &aParent)
virtual void fileToBeSharedAdded()
virtual void viewedProfileCommentKeyPressed()
void setCaDocumentSize()
virtual void sendMsgToContactButtonClicked()
Model-class for performing search on contact-list contacts This is supposed to act as an underlying d...
Definition: contactlistingmodel.h:36
void openBinaryFile(const Hash &aFingerPrint, bool aUseViewedProfileNodeAsNetreqDest=false)
void showClassifiedAd(const CA &ca)
QAction * iViewSharedFileInfoAction
Definition: FrontWidget.h:317
virtual void postNewPrivateMessage()
QPushButton * iReplyToPrivMsgButton
Definition: FrontWidget.h:353
virtual void ownProfileCommentselectionChangedSlot(const QItemSelection &, const QItemSelection &)
QGraphicsScene iPrivMsgScene
Definition: FrontWidget.h:348
virtual void linkActivated(const QString &aLink)
virtual void contactsSelectionChangedSlot(const QItemSelection &, const QItemSelection &)
void selectClassification(QString aNameOfClassification)
bool iWindowSizeAdjusted
Definition: FrontWidget.h:369
QVariant contactDataOfSelectedProfile()
QAction * iCopySharedFileHashAction
Definition: FrontWidget.h:318
QAction * iAddToContactsFromMsgList
Definition: FrontWidget.h:358
virtual void viewCaAttachments()
virtual void viewedBinaryFileSelectionChangedSlot(const QModelIndex &aItem, const QModelIndex &aPreviousItem)
Carrier-class for user-profile data.
Definition: profile.h:37
BinaryFileListingModel * iViewedProfileFileListingModel
Definition: FrontWidget.h:326
Controller * iController
Definition: FrontWidget.h:310
void setVoiceCallButtonStatus()
ProfileCommentListingModel iSelectedProfileCommentListingModel
Definition: FrontWidget.h:364
QAction * iAddSharedFileAction
Definition: FrontWidget.h:314
virtual void caTabConcernsComboChanged(int aNewIndex)
virtual void CAselectionChangedSlot(const QItemSelection &, const QItemSelection &)
BinaryFileListingModel * iSelectedProfileFileListingModel
Definition: FrontWidget.h:323
void setupClassifiedAdsTab()
virtual void ownProfileCommentDoubleClicked(const QModelIndex &aSelection)
virtual void editNewSharedFile()
QAction * iRemoveSharedFileAction
Definition: FrontWidget.h:315
QGraphicsSimpleTextItem iPrivMsgFromField
Definition: FrontWidget.h:350
Model-class for performing search on comments about a profile. This is supposed to act as an underlyi...
Definition: profilecommentlistingmodel.h:36
void setUpSelectedProfileFileListingModel()