Classified ads
/tmp/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 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 FRONT_H
21 #define FRONT_H
22 #include <QtGui>
23 #include <QGraphicsScene>
24 #include <QGraphicsTextItem>
25 #include <QGraphicsSimpleTextItem>
26 #include "ui_frontWidget.h"
27 #include "controller.h"
29 #include "datamodel/ca.h"
31 #include "datamodel/privmsg.h"
32 #include <QHeaderView>
35 
36 class Profile ;
38 class QShortcut ;
39 class ProfileCommentModel ;
40 
41 class FrontWidget: public QWidget {
42  Q_OBJECT
43 
44 public:
45  FrontWidget(Controller* aController,QMainWindow& aParent ) ;
46  ~FrontWidget() ;
48  void showDetailsOfProfile(const Hash& aFingerPrint) ;
50  void showClassifiedAd(const CA& ca) ;
52  void showSingleCommentOfProfile(const Hash aCommentFingerPrint) ;
59  static void fillCaSelectionCombobox(QComboBox& aComboBox,
60  bool isAboutComboBox,
61  MController& aController) ;
67  static QString selectedClassification(const QComboBox& aAboutCombo,
68  const QComboBox& aRegardingCombo,
69  const QComboBox& aWhereCombo,
70  const MController& aController) ;
76  void receiveNotifyOfContentReceived(const Hash& aHashOfContent,
77  const ProtocolItemType aTypeOfReceivdContent) ;
90  void receiveNotifyOfContentReceived(const Hash& aHashOfContent,
91  const Hash& aHashOfClassificationOrDestination,
92  const ProtocolItemType aTypeOfReceivdContent) ;
96  QVariant contactDataOfSelectedProfile() ;
100  void setContactDataOfSelectedProfile(const QVariantList& aContacts) ;
105  bool isContactInContactList(const Hash& aFingerPrint) const ;
110  const Profile *selectedProfile() const {
111  return iSelectedProfile ;
112  }
113 public slots:
114  virtual void publishProfileButtonClicked() ;
115  virtual void revertProfileButtonClicked() ;
116  virtual void profileImageClicked() ;
117  virtual void profileReadersClicked() ;
118  virtual void profileEdited(const QString& aNewText) ;
119  virtual void isPrivateSettingChanged(int aState) ;
120  virtual void userProfileSelected(const Hash& aProfile) ;
121  virtual void fileToBeSharedAdded() ;
122  virtual void fileToBeSharedRemoved() ;
123  virtual void exportSharedFile() ;
124  virtual void profileSendMsgButtonClicked() ;
125  virtual void profileShowReadersButtonClicked() ;
126  virtual void profileSendCommentButtonClicked() ;
127  virtual void caTabAboutComboChanged(int aNewIndex) ;
128  virtual void caTabConcernsComboChanged(int aNewIndex) ;
129  virtual void caTabWhereComboChanged(int aNewIndex) ;
130  // slots for buttons at bottom of "classified ads" ta
131  virtual void replyToCaButtonClicked() ;
132  virtual void replyToCaToForumButtonClicked() ;
133  virtual void commentCaPosterProfile() ;
134  virtual void viewCaPosterProfile() ;
135  virtual void viewCaAttachments() ;
136  virtual void postNewClassifiedAd() ;
137  virtual void performAdsSearchClicked() ;
142  virtual void CAselectionChangedSlot(const QItemSelection &, const QItemSelection &) ;
147  virtual void privMsgselectionChangedSlot(const QItemSelection &, const QItemSelection &) ;
151  virtual void contactsSelectionChangedSlot(const QItemSelection &, const QItemSelection &) ;
152  virtual void replyToPrivMsgButtonClicked() ;
153  virtual void commentPrivMsgPosterProfile() ;
154  virtual void viewPrivMsgPosterProfile() ;
155  virtual void postNewPrivateMessage() ;
157  virtual void viewPrivMsgAttachments() ;
158  virtual void addMessageSenderToContacts() ;
159  virtual void addCaSenderToContacts() ;
160  // slots related to contacts-tab
161  virtual void addContactButtonClicked() ;
164  virtual void removeContactButtonClicked() ;
165  virtual void viewContactProfileButtonClicked() ;
166  virtual void sendMsgToContactButtonClicked() ;
167  virtual void editContactActionSelected() ;
172  virtual void ownProfileCommentselectionChangedSlot(const QItemSelection &, const QItemSelection &) ;
177  virtual void viewedProfileCommentselectionChangedSlot(const QItemSelection &, const QItemSelection &) ;
182  virtual void viewedProfileCommentDoubleClicked(const QModelIndex &aSelection) ;
187  virtual void viewedProfileCommentKeyPressed() ;
192  virtual void ownProfileCommentDoubleClicked(const QModelIndex &aSelection) ;
193 signals:
195  const QString& aExplanation) ;
197  void displayedCaChanged() ;
199  void displayedPrivMsgChanged() ;
200 private:
215  void setupClassifiedAdsTab() ;
221  void setupPrivateMessagesTab() ;
225  void setupContactsTab() ;
231  void selectClassification(QString aNameOfClassification) ;
246  ProfileCommentModel& aCommentModel,
247  const Hash& aInitialComment,
248  const Hash& aViewedProfile ) ;
249 private: // methods
250  void setCaDocumentSize() ;
251  void setPrivMsgSize() ;
252 private:
253  Ui::frontWidget ui ;
255  QMainWindow& iParent ;
268  QPushButton* iReplyToCaButton ;
269  QPushButton* iReplyToCaToForumButton ;
271  QPushButton* iNewCaButton ;
273  QPushButton* iCommentCaPosterButton ;
277  QPushButton* iViewCaAttachmentsButton ;
280  QGraphicsScene iCaScene ;
281  QGraphicsTextItem iCaText ;
283  QGraphicsSimpleTextItem iFromField ;
284  QGraphicsSimpleTextItem iSubjectField ;
285  const QPoint iArticleTopLeft ;
286  // private message tab related variables
289  QGraphicsScene iPrivMsgScene ;
290  QGraphicsTextItem iPrivMsgText ;
291  QGraphicsSimpleTextItem iPrivMsgFromField ;
292  QGraphicsSimpleTextItem iPrivMsgSubjectField ;
293  const QPoint iPrivMsgTopLeft ;
294  QPushButton* iReplyToPrivMsgButton;
295  QPushButton* iNewPrivMsgButton ;
300  // variables related to contacts-list
304  // variables related to profile-comment display
310 } ;
311 #endif
virtual void viewedProfileCommentselectionChangedSlot(const QItemSelection &, const QItemSelection &)
QAction * iAddToContactsFromCaList
Definition: FrontWidget.h:278
Definition: FrontWidget.h:41
Carrier-class for private msg inside classified ads.
Definition: privmsg.h:35
Class for keeping app state.
Definition: controller.h:42
Hash iSelectedContact
Definition: FrontWidget.h:302
virtual void viewContactProfileButtonClicked()
QMainWindow & iParent
Definition: FrontWidget.h:255
virtual void fileToBeSharedRemoved()
CA iCaOnDisplay
Definition: FrontWidget.h:282
virtual void addCaSenderToContacts()
QShortcut * iProfileListingKeyboardGrabber
Definition: FrontWidget.h:309
Hash iSelectedCommentFromOwnCommentListing
Definition: FrontWidget.h:307
void setPrivMsgSize()
QPushButton * iReplyToCaToForumButton
Definition: FrontWidget.h:269
virtual void addMessageSenderToContacts()
PrivMessage iPrivMsgOnDisplay
Definition: FrontWidget.h:288
void updateUiFromSelectedProfile()
virtual void privMsgselectionChangedSlot(const QItemSelection &, const QItemSelection &)
QGraphicsScene iCaScene
Definition: FrontWidget.h:280
ProfileCommentListingModel iViewedProfileCommentListingModel
Definition: FrontWidget.h:306
This is is part of datamodel for storing comments of user profiles.
Definition: profilecommentmodel.h:37
virtual void postNewClassifiedAd()
static void fillCaSelectionCombobox(QComboBox &aComboBox, bool isAboutComboBox, MController &aController)
virtual void caTabWhereComboChanged(int aNewIndex)
QPushButton * iViewCaPosterProfileButton
Definition: FrontWidget.h:275
void updateUiFromViewedProfile()
virtual void addContactButtonClicked()
virtual void exportSharedFile()
QPushButton * iCommentCaPosterButton
Definition: FrontWidget.h:273
virtual void profileImageClicked()
Profile * iSelectedProfile
Definition: FrontWidget.h:256
QGraphicsTextItem iCaText
Definition: FrontWidget.h:281
CAListingModel iCaListingModel
Definition: FrontWidget.h:279
QPushButton * iNewCaButton
Definition: FrontWidget.h:271
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 addContactFromContactViewButtonClicked()
void setupPrivateMessagesTab()
Hash iSelectedCommentFromViewedCommentListing
Definition: FrontWidget.h:308
virtual void caTabAboutComboChanged(int aNewIndex)
Profile * iViewedProfile
Definition: FrontWidget.h:257
QAction * iEditContactAction
Definition: FrontWidget.h:303
QGraphicsSimpleTextItem iFromField
Definition: FrontWidget.h:283
void displayedPrivMsgChanged()
void setupContactsTab()
QGraphicsTextItem iPrivMsgText
Definition: FrontWidget.h:290
PrivateMessageSearchModel iPrivMsgSearchModel
Definition: FrontWidget.h:287
QGraphicsSimpleTextItem iPrivMsgSubjectField
Definition: FrontWidget.h:292
virtual void replyToCaToForumButtonClicked()
ProtocolItemType
Definition: protocol.h:124
virtual void profileSendMsgButtonClicked()
QPushButton * iViewPrivMsgAttachmentsButton
Definition: FrontWidget.h:298
virtual void viewPrivMsgAttachments()
virtual void editContactActionSelected()
virtual void userProfileSelected(const Hash &aProfile)
virtual void commentPrivMsgPosterProfile()
QPushButton * iNewPrivMsgButton
Definition: FrontWidget.h:295
QGraphicsSimpleTextItem iSubjectField
Definition: FrontWidget.h:284
bool isContactInContactList(const Hash &aFingerPrint) const
Model-class for helping display of shared binary blobs, usually from a profile.
Definition: binaryfilelistingmodel.h:33
virtual void isPrivateSettingChanged(int aState)
QPushButton * iCommentPrivMsgPosterButton
Definition: FrontWidget.h:296
virtual void profileSendCommentButtonClicked()
QPushButton * iViewPrivMsgPosterProfileButton
Definition: FrontWidget.h:297
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:34
void receiveNotifyOfContentReceived(const Hash &aHashOfContent, const ProtocolItemType aTypeOfReceivdContent)
virtual void viewPrivMsgPosterProfile()
virtual void commentCaPosterProfile()
void displayedCaChanged()
Pure-virtual interface class for controller. This is spammed across parties needing access to applica...
Definition: mcontroller.h:39
Model-class for performing search on private messages. This is supposed to act as an underlying data-...
Definition: privmsgsearchmodel.h:35
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()
void showSingleCommentOfProfile(const Hash aCommentFingerPrint)
virtual void revertProfileButtonClicked()
ContactListingModel iContactsModel
Definition: FrontWidget.h:301
void showDetailsOfProfile(const Hash &aFingerPrint)
Ui::frontWidget ui
Definition: FrontWidget.h:253
virtual void replyToCaButtonClicked()
const QPoint iPrivMsgTopLeft
Definition: FrontWidget.h:293
virtual void performAdsSearchClicked()
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:277
const QPoint iArticleTopLeft
Definition: FrontWidget.h:285
const Profile * selectedProfile() const
Definition: FrontWidget.h:110
QPushButton * iReplyToCaButton
Definition: FrontWidget.h:268
QAction * iExportSharedFileAction
Definition: FrontWidget.h:260
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:35
void showClassifiedAd(const CA &ca)
virtual void postNewPrivateMessage()
QPushButton * iReplyToPrivMsgButton
Definition: FrontWidget.h:294
virtual void ownProfileCommentselectionChangedSlot(const QItemSelection &, const QItemSelection &)
QGraphicsScene iPrivMsgScene
Definition: FrontWidget.h:289
virtual void contactsSelectionChangedSlot(const QItemSelection &, const QItemSelection &)
void selectClassification(QString aNameOfClassification)
QVariant contactDataOfSelectedProfile()
QAction * iAddToContactsFromMsgList
Definition: FrontWidget.h:299
virtual void viewCaAttachments()
Carrier-class for user-profile data.
Definition: profile.h:36
BinaryFileListingModel * iViewedProfileFileListingModel
Definition: FrontWidget.h:267
Controller * iController
Definition: FrontWidget.h:254
ProfileCommentListingModel iSelectedProfileCommentListingModel
Definition: FrontWidget.h:305
QAction * iAddSharedFileAction
Definition: FrontWidget.h:258
virtual void caTabConcernsComboChanged(int aNewIndex)
virtual void CAselectionChangedSlot(const QItemSelection &, const QItemSelection &)
BinaryFileListingModel * iSelectedProfileFileListingModel
Definition: FrontWidget.h:264
void setupClassifiedAdsTab()
virtual void ownProfileCommentDoubleClicked(const QModelIndex &aSelection)
QAction * iRemoveSharedFileAction
Definition: FrontWidget.h:259
QGraphicsSimpleTextItem iPrivMsgFromField
Definition: FrontWidget.h:291
Model-class for performing search on comments about a profile. This is supposed to act as an underlyi...
Definition: profilecommentlistingmodel.h:35
void setUpSelectedProfileFileListingModel()