Redirecting project's purpose into password encryption. Need to separate declaration from implementation

This commit is contained in:
amazing-username
2017-07-27 12:04:10 -05:00
parent 41c53fe8e9
commit 4d5b19cabe
8 changed files with 89 additions and 80 deletions
+38 -22
View File
@@ -1,4 +1,3 @@
#include<QtWidgets>
#include<QString>
#include<QWidget>
#include<string>
@@ -10,37 +9,54 @@
#include"Encryption.h"
#include"GenerateKeys.h"
#include"KeyRetrieval.h"
#include"Conversions.h"
KeyManagementWindow::KeyManagementWindow(QWidget* parent) : QDialog(parent)
{
comboBoxOfKeys = unique_ptr<QComboBox>{new QComboBox{}};
valueOfKey = unique_ptr<QLineEdit>{new QLineEdit{}};
generateNewDefaultKeys = unique_ptr<QPushButton>{new QPushButton(tr("Generate New Default Key"))};
closeButton = unique_ptr<QPushButton>{new QPushButton(tr("close"))};
windowWidth = 450;
windowHeight = 450;
elementView = unique_ptr<QTableView>{new QTableView};
selectionBox = unique_ptr<QComboBox>{new QComboBox{}};
generateNewKeys = unique_ptr<QPushButton>{new QPushButton(tr("Generate New Default Key"))};
closeButton = unique_ptr<QPushButton>{new QPushButton(tr("close"))};
actionButton = unique_ptr<QPushButton>{new QPushButton};
mainLayout = unique_ptr<QHBoxLayout>{new QHBoxLayout};
subLayoutOne = unique_ptr<QVBoxLayout>{new QVBoxLayout};
subLayoutTwo = unique_ptr<QVBoxLayout>{new QVBoxLayout};
subLayoutGoonOne = unique_ptr<QVBoxLayout>{new QVBoxLayout};
subLayoutGoonTwo = unique_ptr<QVBoxLayout>{new QVBoxLayout};
subLayoutOne.get()->addWidget(elementView.get());
subLayoutGoonOne.get()->addWidget(selectionBox.get());
subLayoutGoonOne.get()->addWidget(actionButton.get());
subLayoutGoonTwo.get()->addWidget(generateNewKeys.get());
subLayoutGoonTwo.get()->addWidget(closeButton.get());
subLayoutTwo.get()->addLayout(subLayoutGoonOne.get());
subLayoutTwo.get()->addLayout(subLayoutGoonTwo.get());
mainLayout.get()->addLayout(subLayoutOne.get());
mainLayout.get()->addLayout(subLayoutTwo.get());
vBox = unique_ptr<QVBoxLayout>{new QVBoxLayout};
hBox = unique_ptr<QHBoxLayout>{new QHBoxLayout};
hBox2 = unique_ptr<QHBoxLayout>{new QHBoxLayout};
setContentsOfComboBox();
hBox.get()->addWidget(comboBoxOfKeys.get());
hBox.get()->addWidget(valueOfKey.get());
hBox2.get()->addWidget(generateNewDefaultKeys.get());
hBox2.get()->addWidget(closeButton.get());
vBox.get()->addLayout(hBox.get());
vBox.get()->addLayout(hBox2.get());
setLayout(vBox.get());
setLayout(mainLayout.get());
setFixedWidth(windowWidth);
setFixedHeight(windowHeight);
setWindowTitle("Key Management Window");
QObject::connect(comboBoxOfKeys.get(), SIGNAL(currentIndexChanged(int)), SLOT(test()));
QObject::connect(generateNewDefaultKeys.get(), SIGNAL(clicked()), this, SLOT(generation()));
QObject::connect(selectionBox.get(), SIGNAL(currentIndexChanged(int)), SLOT(test()));
QObject::connect(generateNewKeys.get(), SIGNAL(clicked()), this, SLOT(generation()));
QObject::connect(closeButton.get(), SIGNAL(clicked()), this, SLOT(exitApplication()));
}
@@ -54,7 +70,7 @@ void KeyManagementWindow::setContentsOfComboBox()
{
std::string ch{static_cast<char>(c[index])};
QString bl = QString::fromStdString(ch);
comboBoxOfKeys.get()->addItem(bl);
selectionBox.get()->addItem(bl);
}
}
void KeyManagementWindow::test()
@@ -62,7 +78,7 @@ void KeyManagementWindow::test()
std::string emp{"d"};
Encryption ec{emp};
std::map<char, std::string> encrypted{ec.encryptedCharactersStructure()};
QString bo{comboBoxOfKeys.get()->currentText()};
QString bo{selectionBox.get()->currentText()};
std::string k{bo.toStdString()};
char f{};
@@ -72,7 +88,7 @@ void KeyManagementWindow::test()
std::string value{encrypted[f]};
QString v{QString::fromStdString(value)};
valueOfKey.get()->setText(v);
//valueOfKey.get()->setText(v);
}
void KeyManagementWindow::generation()
{