summaryrefslogtreecommitdiffstats
path: root/src/tabwidgetselectalgorithm.cpp
blob: a3d85af217f887d870596a5dc26fcbb8ac2d14f9 (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
#include "tabwidgetselectalgorithm.h"

TabWidgetSelectAlgorithm::TabWidgetSelectAlgorithm(QWidget *parent) :
    QTabWidget(parent)
{
    //Create the Widgets for Algorithm-Selection
    m_nullCipher = new QWidget(this);
    m_symmetric  = new TabSymmetric(this);
    m_asymmetric = new TabAsymmetric(this);
    m_hybrid     = new TabHybrid(this);

    //Add those Widgets as Tabs
    addTab(m_nullCipher, "NullCipher");
    addTab(m_symmetric,  "Symmetric");
    addTab(m_asymmetric, "Asymmetric");
    addTab(m_hybrid,     "Hybrid");


    connect( this, SIGNAL(currentChanged(int)),
             this,  SLOT(oncurrentChanged_triggered(int)));

    //Send Selection from SubTabs on: Ciphers
    connect( m_symmetric,     SIGNAL(cipherChanged(int)),
             this,            SIGNAL(cipherChanged(int)) );
    connect( m_asymmetric,    SIGNAL(cipherChanged(int)),
             this,            SIGNAL(cipherChanged(int)) );
    connect( m_hybrid,        SIGNAL(cipherChanged(int)),
             this,            SIGNAL(cipherChanged(int)) );

    //Send Selection from SubTabs on: KeyLength
    connect( m_symmetric,     SIGNAL(keyLengthChanged(int, bool)),
             this,            SIGNAL(keyLengthChanged(int,bool)));
    connect( m_asymmetric,    SIGNAL(keyLengthChanged(int, bool)),
             this,            SIGNAL(keyLengthChanged(int,bool)));
    connect( m_hybrid,        SIGNAL(keyLengthChanged(int, bool)),
             this,            SIGNAL(keyLengthChanged(int,bool)));
}



//public slots:
void TabWidgetSelectAlgorithm::onNullCipher_selected()
{
    setCurrentWidget(m_nullCipher);
}

void TabWidgetSelectAlgorithm::onSymmetric_selected()
{
    setCurrentWidget(m_symmetric);
}

void TabWidgetSelectAlgorithm::onAsymmetric_selected()
{
    setCurrentWidget(m_asymmetric);
}

void TabWidgetSelectAlgorithm::onHybrid_selected()
{
    setCurrentWidget(m_hybrid);
}




// private slots:
void TabWidgetSelectAlgorithm::oncurrentChanged_triggered(int index)
{
    QString tabName;

    if(      currentWidget() == m_nullCipher )
        tabName = "NullCipher";
    else if( currentWidget() == m_symmetric )
        tabName = "Symmetric";
    else if( currentWidget() == m_asymmetric )
        tabName = "Asymmetric";
    else if( currentWidget() == m_hybrid )
        tabName = "Hybrid";

    emit (currentTabChanged( tabName ));
}