Issue #1 #2 #4 are addressed in this commit. Added another window with controls for key management. Simple ASCII encryption

This commit is contained in:
amazing-username
2017-03-27 21:27:28 -05:00
parent 9894385576
commit 3f5d67e4cf
10 changed files with 194 additions and 16 deletions
+30 -3
View File
@@ -3,6 +3,8 @@
#include <iostream>
#include "MessagingControls.h"
#include "KeyManagementWindow.h"
#include "Encryption.h"
MessagingControls::MessagingControls()
{
@@ -28,10 +30,12 @@ MessagingControls::~MessagingControls()
void MessagingControls::setupMainWindow()
{
textForCryption = new QTextEdit;
textForCryption->setText("sdfs");
textForCryption->clear();
cryptionButon = new QPushButton(tr("XO"));
cryptionSwitch = new QPushButton(tr("encrypt"));
cryptionSwitch = new QPushButton(tr("encrypt chosen"));
buttonLayout = new QVBoxLayout;
@@ -55,6 +59,7 @@ void MessagingControls::setupMainWindow()
QObject::connect(closeApplication, SIGNAL(triggered()), this, SLOT(close()));
QObject::connect(cryptionSwitch, SIGNAL(clicked()), this, SLOT(changeCryptionType()));
QObject::connect(cryptionButon, SIGNAL(clicked()), this, SLOT(determineCryption()));
QObject::connect(keyEdit, SIGNAL(triggered()), this, SLOT(keyManagementWindow()));
setWindowTitle("Encryption Decryption Messaging");
setFixedHeight(mainWindowHeight);
@@ -78,12 +83,12 @@ void MessagingControls::changeCryptionType()
{
if (cryptionChoice)
{
cryptionSwitch->setText("decrypt");
cryptionSwitch->setText("decrypt chosen");
cryptionChoice = false;
}
else
{
cryptionSwitch->setText("encrypt");
cryptionSwitch->setText("encrypt chosen");
cryptionChoice = true;
}
}
@@ -91,6 +96,21 @@ void MessagingControls::determineCryption()
{
if (cryptionChoice)
{
QString content;
content = textForCryption->toPlainText();
std::string message = content.toStdString();
Encryption ec;
ec.setMessage(message);
ec.encryptMessage();
std::cout << ec.getEncryptedMessage() << std::endl;
QString messageQ = QString::fromStdString(ec.getEncryptedMessage());
textForCryption->clear();
textForCryption->setText(messageQ);
cryptionSwitch->setText("decrypt chosen");
cryptionChoice = false;
/**
* Decrypt Message
*/
@@ -110,3 +130,10 @@ void MessagingControls::determineCryption()
//std::cout << textForCryption->toPlainText() << std::endl;
}
void MessagingControls::keyManagementWindow()
{
KeyManagementWindow* kh = new KeyManagementWindow;
kh->show();
}