summaryrefslogtreecommitdiffstats
path: root/src/tabwidgetselectalgorithm.h
blob: 01265f3ff5d6e3373127114c55f10327be8e5c43 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
#ifndef TABWIDGETSELECTALGORITHM_H
#define TABWIDGETSELECTALGORITHM_H

#include <QTabWidget>

#include "cipherssingleton.h"
#include "tabsymmetric.h"
#include "tabasymmetric.h"
#include "tabhybrid.h"





/**
* \class TabWidgetSelectAlgorithm
* \brief Subclassed TabWidget for Algorithm-Selection.
*
* SubClass of QTabWidget with added functionality for exclusive selection of an algorithm for de/encryption,
* sorted by the kind of algorithm (NullCipher, Symmetric, Asymmetric, Hybrid)
* For each kind of algorithm, a special TabWidget has been implemented.
* \author Uwe Gogolin [Gogolin.Uwe@FH-SWF.de]
* \version 0.1
* \date 28.02.2013
*/
class TabWidgetSelectAlgorithm : public QTabWidget
{
    Q_OBJECT

public: //Methods
    /**
    * \brief Class Constructor.
    *
    * Class Constructor. Initializes the four different TabWidgets and adds them as Tabs to itself.
    * Connects the Signal "currentChanged(int)" with the Slot "oncurrentChanged_triggered(int)", which
    * after checking which is the new current Widget, sends that info via the Signal "currentTabChanged(QString)"
    * [This is needed to keep the corresponding option in the Menu up to date]
    * \param QWidget* parent The QWidget the used instance of this class is subordinated to.
    */
    TabWidgetSelectAlgorithm(QWidget *parent = 0);



public slots:
    /**
    * \brief Slot called to set Tab for NullCipher active.
    *
    * Changes the current Tab to the NullCipher-Tab.
    */
    void onNullCipher_selected();


    /**
    * \brief Slot called to set Tab for Symmetric Ciphers active.
    *
    * Changes the current Tab to the Symmetric Ciphers-Tab.
    */
    void onSymmetric_selected();


    /**
    * \brief Slot called to set Tab for Asymmetric Ciphers active.
    *
    * Changes the current Tab to the Asymmetric Ciphers-Tab.
    */
    void onAsymmetric_selected();


    /**
    * \brief Slot called to set Tab for Hybrid Ciphers active.
    *
    * Changes the current Tab to the Hybrid Ciphers-Tab.
    */
    void onHybrid_selected();



signals:
    /**
    * \brief SIGNAL to inform other Classes when another Tab becomes active.
    *
    * This Signal is used to inform other Classes when a new Tab becomes active.
    * [NOTE: Will be modified to use NameSpaceCryptEngine::CryptAlgorithm in the future]
    * \param QString currentTabName string containing the Name of the newly active Tab.
    */
    void currentTabChanged(QString currentTabName);



    /**
    * \brief SIGNAL to inform other Classes when a Cipher gets selected.
    *
    * This Signal is used to inform other Classes when a Cipher gets selected.
    * \param int cipher The Integer referencing the selected Cipher according to the Class CiphersSingleton.
    */
    void cipherChanged(int cipher);



    /**
    * \brief SIGNAL to inform other Classes when the Keylength is changed.
    *
    * This Signal is used to inform other Classes when the Keylength is changed.
    * \param int keyLength The new Keylength.
    * \param bool symmetric True if Length for Symmetric Cipher, false if for asymmetric Cipher.
    */
    void keyLengthChanged(int keyLength, bool symmetric);


private slots:
    /**
    * \brief Slot needed to get the pointer to the newly active Tab from its index.
    *
    * This slot is called when the currently active Tab changes. This Tab, however, is only referenced by index
    * by the Signal "currentChanged", which is fine for reference inside this Class.
    * For Classes outside, a better description is needed. Currently, a QString is used.
    * [NOTE: Will be modified to use NameSpaceCryptEngine::CryptAlgorithm in the future]
    * \param int index Index of the newly active Tab
    */
    void oncurrentChanged_triggered(int index);



private: //Attributes
    /**
    * \brief Pointer to the TabWidget for NullCipher.
    *
    * \attention This Tab is supposed to be empty, since there no settings for the NullCipher.
    */
    QWidget* m_nullCipher;


    /**
    * \brief Pointer to the TabWidget for Symmetric Ciphers.
    */
    QWidget* m_symmetric;


    /**
    * \brief Pointer to the TabWidget for Asymmetric Ciphers.
    */
    QWidget* m_asymmetric;


    /**
    * \brief Pointer to the TabWidget for Hybrid Ciphers.
    */
    QWidget* m_hybrid;    
};

#endif // TABWIDGETSELECTALGORITHM_H