root / utilitairemainwindow.h @ a469d718
Historique | Voir | Annoter | Télécharger (5,13 ko)
1 |
/** Classe de base pour les mainwindows des logiciels AbulEdu (ryxeo-antivirus)
|
---|---|
2 |
*
|
3 |
* @see https://redmine.ryxeo.com/projects/ryxeo-antivirus
|
4 |
* @author 2013 Eric Seigne <eric.seigne@ryxeo.com
|
5 |
*
|
6 |
* @see https://redmine.ryxeo.com/projects/ryxeo/wiki/UtilitaireMainWindow
|
7 |
* @author 2012 Philippe <philippe.cadaugade@ryxeo.com>
|
8 |
*
|
9 |
* @see The GNU Public License (GPL)
|
10 |
*
|
11 |
* This program is free software; you can redistribute it and/or modify
|
12 |
* it under the terms of the GNU General Public License as published by
|
13 |
* the Free Software Foundation; either version 2 of the License, or
|
14 |
* (at your option) any later version.
|
15 |
*
|
16 |
* This program is distributed in the hope that it will be useful, but
|
17 |
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
18 |
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
19 |
* for more details.
|
20 |
*
|
21 |
* You should have received a copy of the GNU General Public License along
|
22 |
* with this program; if not, write to the Free Software Foundation, Inc.,
|
23 |
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
24 |
*/
|
25 |
|
26 |
#ifndef UTILITAIREMAINWINDOW_H
|
27 |
#define UTILITAIREMAINWINDOW_H
|
28 |
|
29 |
/* Inclusion de classes Qt */
|
30 |
#include <QMainWindow> |
31 |
#include <QDebug> |
32 |
#include <QLocalSocket> |
33 |
#include <QTcpSocket> |
34 |
#include <QAbstractSocket> |
35 |
|
36 |
#include <QFileDialog> |
37 |
|
38 |
/* Inclusion de classes AbulEdu */
|
39 |
#include "abuleduapplicationv1.h" |
40 |
|
41 |
#define max_stream_size 10000000 //this value defines the maximum files size to be scanned and should be equal to the StreamMaxLength parameter in the clamd.conf file. |
42 |
|
43 |
namespace Ui { |
44 |
class UtilitaireMainWindow; |
45 |
} |
46 |
|
47 |
class UtilitaireMainWindow : public QMainWindow |
48 |
{ |
49 |
Q_OBJECT |
50 |
|
51 |
public: |
52 |
/* Méthodes */
|
53 |
/** Constructeur */
|
54 |
explicit UtilitaireMainWindow(QWidget *parent = 0);
|
55 |
|
56 |
/** Destructeur virtuel pour cause d'objectif de polymorphisme */
|
57 |
virtual ~UtilitaireMainWindow(); |
58 |
|
59 |
protected:
|
60 |
/* Attributs */
|
61 |
/** Variable membre qui permet de contrôler l'affichage des qDebug */
|
62 |
bool m_localDebug;
|
63 |
|
64 |
/* Méthodes */
|
65 |
/** Crée dans le menu Langues de l'interface graphique une entrée pour les langues désirées
|
66 |
* Seuls l'anglais et le français sont présents au départ
|
67 |
* Quelques langues sont prêtes à ajouter, en décommentant le bloc qui leur correspond
|
68 |
* Vous pouvez ajouter d'autres langues sur le même modèle */
|
69 |
virtual void createLangMenu();
|
70 |
|
71 |
private:
|
72 |
/** Gestion de l'affichage de la fenetre pour les tablettes */
|
73 |
void showEvent ( QShowEvent * event );
|
74 |
|
75 |
/* Attributs */
|
76 |
/** Pointeur vers l'interface graphique */
|
77 |
Ui::UtilitaireMainWindow* ui; |
78 |
|
79 |
/** QTranslator destiné aux traductions Qt System */
|
80 |
QTranslator m_qtTranslator; |
81 |
|
82 |
/** QTranslator destiné aux traductions spécifiques du logiciel */
|
83 |
QTranslator m_myAppTranslator; |
84 |
|
85 |
/** Pointeur vers un l'AbulEduNetworkAccessManagerV1 de l'application, assignation dans le constructeur */
|
86 |
AbulEduNetworkAccessManagerV1 *m_nam; |
87 |
|
88 |
|
89 |
int totalfilesscanned;
|
90 |
int totalvirusfound;
|
91 |
int totalwarnings;
|
92 |
int scanninginprogress;
|
93 |
QString ClamAV_host; |
94 |
QString FileToScan; |
95 |
QStringList files_to_scan; |
96 |
QStringList::Iterator it; |
97 |
QLocalSocket *socket; |
98 |
QTcpSocket *stream_socket; |
99 |
QLineEdit *inputText; |
100 |
QString Socket_Read_Line; |
101 |
char Output_String[512]; |
102 |
const QString host;
|
103 |
int clamav_main_port;
|
104 |
int clamav_stream_port;
|
105 |
|
106 |
public slots: |
107 |
/** Affiche l'UtilitaireMainWindow après éventuellement demande d'authentification
|
108 |
* Connecté dans la méthode setMainWindow() de l'AbulEduSplashScreenV1 */
|
109 |
void slotSessionAuthenticated(bool enable); |
110 |
|
111 |
private slots: |
112 |
/** Opère le changement de langue désiré
|
113 |
* Connecté aux entrées du menu Langues */
|
114 |
void slotChangeLang();
|
115 |
|
116 |
/** Actualise le nom de la fenêtre en fonction du nom du logiciel, du nom de l'exercice et du nom de l'utilisateur */
|
117 |
void setTitle(int authStatus); |
118 |
|
119 |
/** Permet de gerer les changement d'états d'authentification sso
|
120 |
* @param code est l'entier envoyé dans le signal ssoAuthStatus(int) de l'AbulEduNetworkAccessManagerV1
|
121 |
* avec lequel ce slot est connecté */
|
122 |
void slotSSOStatusChanged(int code); |
123 |
|
124 |
/** Code à exécuter au clic sur l'entrée de menu Fichier - Ouvrir */
|
125 |
void on_action_Ouvrir_triggered();
|
126 |
|
127 |
/** Code à exécuter au clic sur l'entrée de menu "Fichier - Sauvegarder" */
|
128 |
void on_action_Sauvegarder_triggered();
|
129 |
|
130 |
/** Code à exécuter au clic sur l'entrée de menu "Fichier - Quitter" */
|
131 |
void on_actionQuitter_triggered();
|
132 |
|
133 |
/** Code à exécuter au clic sur l'entrée de menu "Utilisateur - Authentification" */
|
134 |
void on_action_Authentification_triggered();
|
135 |
|
136 |
void socketConnected();
|
137 |
void socketConnectionClosed();
|
138 |
void socketReadyRead();
|
139 |
void socketError(QAbstractSocket::SocketError e);
|
140 |
|
141 |
void Stream_socketConnected();
|
142 |
void Stream_socketConnectionClosed();
|
143 |
|
144 |
void sendStringToServer(const QString &stringtosend); |
145 |
void sendFileToServer(const QString &file_to_scan); |
146 |
void scan_next_file();
|
147 |
}; |
148 |
|
149 |
#endif // UTILITAIREMAINWINDOW_H |
150 |
|