ROV'NET  0.2
BTS SNIR LaSalle Avignon 2020
ihmalbumphoto.cpp
Aller à la documentation de ce fichier.
1 
7 #include "ihmalbumphoto.h"
8 #include "ihmrov.h"
9 #include "campagne.h"
10 
11 IHMAlbumPhoto::IHMAlbumPhoto(IHMRov *ihmRov, QWidget *parent) : QWidget(parent), imhRov(ihmRov)
12 {
13  qDebug() << Q_FUNC_INFO;
14  photos = new QWidget();
15  layoutPhotos = new QHBoxLayout;
16  layoutAlbumPhoto = new QVBoxLayout;
17  scrollArea = new QScrollArea();
18 
19  layoutPhotos->setAlignment(Qt::AlignCenter);
20  layoutAlbumPhoto->setAlignment(Qt::AlignCenter);
21 
22  photos->setLayout(layoutAlbumPhoto);
23  scrollArea->setWidgetResizable(true);
24  scrollArea->setFrameStyle(QFrame::Panel);
25  scrollArea->setWidget(photos);
26  layoutPhotos->addWidget(scrollArea);
27 
28  setLayout(layoutPhotos);
29 
30  int width = qApp->desktop()->availableGeometry().width();
31  int height = qApp->desktop()->availableGeometry().height();
32  resize(width, height);
33  setStyleSheet("background:#202020;color:white;");
34 }
35 
37 {
38  qDebug() << Q_FUNC_INFO;
39 }
40 
42 {
43  if(albumPhoto.isEmpty())
44  {
45  QMessageBox::critical(this, "Erreur", "Listes photos vide !");
46  return;
47  }
48 
49  QFont police("", 15, 50, false);
50 
51  this->albumPhoto = albumPhoto;
52  signalMapper = new QSignalMapper(this);
53  int numeroPhoto = 0;
54  for(QVector<Photo>::iterator it = albumPhoto.begin(); it != albumPhoto.end(); ++it, numeroPhoto++)
55  {
56  QVBoxLayout *layoutPhoto = new QVBoxLayout;
57  QHBoxLayout *layoutInformationsPhotos = new QHBoxLayout;
58  QHBoxLayout *layoutPhotoAGArder = new QHBoxLayout;
59 
60  QLabel *photo = new QLabel(this);
61  photo->setPixmap((*it).image);
62 
63  QLabel *dateHeure = new QLabel((*it).dateheure.toString(), this);
64  QLabel *chemin = new QLabel((*it).cheminSauvegarde,this);
65  QCheckBox *photoGarde = new QCheckBox(this);
66  QWidget *information = new QWidget(this);
67  QLabel *photoAGarder = new QLabel("Photo à garder :", this);
68 
69  layoutPhotoAGArder->setAlignment(Qt::AlignRight);
70  information->setFixedWidth((*it).image.width());
71 
72  if(albumPhoto[numeroPhoto].aGarder)
73  photoGarde->setChecked(true);
74  else
75  photoGarde->setChecked(false);
76 
77  connect(photoGarde, SIGNAL(clicked()), signalMapper, SLOT(map()));
78  signalMapper->setMapping(photoGarde, numeroPhoto);
79 
80  layoutAlbumPhoto->addLayout(layoutPhoto);
81  layoutPhoto->addWidget(information);
82  information->setLayout(layoutInformationsPhotos);
83  layoutPhoto->addWidget(photo);
84  layoutInformationsPhotos->addWidget(dateHeure);
85  layoutInformationsPhotos->addWidget(chemin);
86  layoutInformationsPhotos->addLayout(layoutPhotoAGArder);
87  layoutPhotoAGArder->addWidget(photoAGarder);
88  layoutPhotoAGArder->addWidget(photoGarde);
89 
90  dateHeure->setFont(police);
91  chemin->setFont(police);
92  photoAGarder->setFont(police);
93  information->setStyleSheet("background-color: white");
94  dateHeure->setStyleSheet("color: black");
95  chemin->setStyleSheet("color: black");
96  photoAGarder->setStyleSheet("color: black");
97  photoGarde->setStyleSheet("color: black");
98  }
99  connect(signalMapper, SIGNAL(mapped(int)), this, SLOT(selectionnerPhoto(int)));
100 
101  this->show();
102 }
103 
104 void IHMAlbumPhoto::selectionnerPhoto(int numeroPhoto)
105 {
106  if(numeroPhoto < albumPhoto.size())
107  {
108  imhRov->getCampagne()->modifierArchivePhoto(numeroPhoto);
109  qDebug() << Q_FUNC_INFO << "numeroPhoto" << numeroPhoto << "A garder" << imhRov->getCampagne()->getAlbumPhoto()[numeroPhoto].aGarder;
110  }
111 }
Fichier qui contient la déclaration de la classe Campagne.
QVBoxLayout * layoutAlbumPhoto
Layout s&#39;agrandissant selon l&#39;ajout de nouvelle photos.
Definition: ihmalbumphoto.h:41
QSignalMapper * signalMapper
Objet de type QSignalMapper, permet d&#39;associer chaque photo de l&#39;IHMAlbumPhoto à un signal...
Definition: ihmalbumphoto.h:43
void modifierArchivePhoto(int numeroPhoto)
Modifie l&#39;état d&#39;archive de la photo correspondant au numéro passé en paramètre.
Definition: campagne.cpp:85
Fichier qui contient la déclaration de la classe IHMAlbumPhoto.
QWidget * photos
Emplacement permettant d&#39;accueillir les différentes photos.
Definition: ihmalbumphoto.h:39
IHM permettant d&#39;obtenir le flux vidéo en direct placé sur le robot et d&#39;obtenir les informations rel...
Definition: ihmrov.h:81
IHMAlbumPhoto(IHMRov *ihmRov, QWidget *parent=nullptr)
Constructeur de la classe AlbumPhoto.
Campagne * getCampagne()
Retourne l&#39;objet campagne en cours.
Definition: ihmrov.cpp:432
IHMRov * imhRov
Association avec l&#39;IHMRov.
Definition: ihmalbumphoto.h:45
QScrollArea * scrollArea
Permet une defilement pour visualiser l&#39;ensemble des photos prises durant la campagne.
Definition: ihmalbumphoto.h:42
void selectionnerPhoto(int numero)
Permet de selectionner la photo indiquer par le signalMapper.
~IHMAlbumPhoto()
Destructeur de la classe AlbumPhoto.
QVector< Photo > albumPhoto
Conteneur de photo.
Definition: ihmalbumphoto.h:44
QVector< Photo > getAlbumPhoto() const
Retourne l&#39;album photo de la campagne.
Definition: campagne.cpp:70
Fichier qui contient la déclaration de la classe IHMRov.
void ouvrirAlbumPhotos(QVector< Photo > albumPhoto)
Ouvre une nouvelle fenetre contenant la liste des photos prises en cours de mission.
La classe QWidget est la classe de base de tous les objets graphiques d&#39;interface utilisateur...
QHBoxLayout * layoutPhotos
Layout permettant d&#39;accueillir les différentes photos.
Definition: ihmalbumphoto.h:40