Fixed issue with semgentation fault occuring when application closes and when reopening keyManagement window
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
#include<QWidget>
|
||||
#include<string>
|
||||
#include<sstream>
|
||||
#include<iostream>
|
||||
#include<cstdlib>
|
||||
#include<fstream>
|
||||
#include<ios>
|
||||
@@ -17,6 +16,7 @@ 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"))};
|
||||
|
||||
vBox = unique_ptr<QVBoxLayout>{new QVBoxLayout};
|
||||
hBox = unique_ptr<QHBoxLayout>{new QHBoxLayout};
|
||||
@@ -27,6 +27,7 @@ KeyManagementWindow::KeyManagementWindow(QWidget* parent) : QDialog(parent)
|
||||
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());
|
||||
@@ -40,6 +41,7 @@ KeyManagementWindow::KeyManagementWindow(QWidget* parent) : QDialog(parent)
|
||||
|
||||
QObject::connect(comboBoxOfKeys.get(), SIGNAL(currentIndexChanged(int)), SLOT(test()));
|
||||
QObject::connect(generateNewDefaultKeys.get(), SIGNAL(clicked()), this, SLOT(generation()));
|
||||
QObject::connect(closeButton.get(), SIGNAL(clicked()), this, SLOT(exitApplication()));
|
||||
}
|
||||
|
||||
|
||||
@@ -78,3 +80,7 @@ void KeyManagementWindow::generation()
|
||||
gk.keyMove();
|
||||
gk.keyDump();
|
||||
}
|
||||
void KeyManagementWindow::exitApplication()
|
||||
{
|
||||
this->hide();
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ public:
|
||||
private slots:
|
||||
void test();
|
||||
void generation();
|
||||
void exitApplication();
|
||||
private:
|
||||
unique_ptr<QHBoxLayout> hBox;
|
||||
unique_ptr<QHBoxLayout> hBox2;
|
||||
@@ -35,6 +36,7 @@ private:
|
||||
unique_ptr<QComboBox> comboBoxOfKeys;
|
||||
unique_ptr<QLineEdit> valueOfKey;
|
||||
unique_ptr<QPushButton> generateNewDefaultKeys;
|
||||
unique_ptr<QPushButton> closeButton;
|
||||
const int windowWidth{400};
|
||||
const int windowHeight{400};
|
||||
};
|
||||
|
||||
+6
-10
@@ -1,22 +1,21 @@
|
||||
#include<QtGui>
|
||||
#include<QString>
|
||||
#include<QIcon>
|
||||
#include<iostream>
|
||||
#include<memory>
|
||||
#include"MessagingControls.h"
|
||||
#include"KeyManagementWindow.h"
|
||||
#include"Encryption.h"
|
||||
#include"Decryption.h"
|
||||
#include"KeyRetrieval.h"
|
||||
|
||||
MessagingControls::MessagingControls()
|
||||
{
|
||||
mainWindowWidth = 450;
|
||||
mainWindowHeight = 450;
|
||||
setupMainWindow();
|
||||
}
|
||||
|
||||
|
||||
void MessagingControls::setupMainWindow()
|
||||
{
|
||||
kh = unique_ptr<KeyManagementWindow>{new KeyManagementWindow};
|
||||
textForCryption = unique_ptr<QTextEdit>{new QTextEdit{}};
|
||||
cryptionButon = unique_ptr<QPushButton>{new QPushButton(tr("XO"))};
|
||||
cryptionSwitch = unique_ptr<QPushButton>{new QPushButton(tr("encrypt chosen"))};
|
||||
@@ -41,7 +40,7 @@ void MessagingControls::setupMainWindow()
|
||||
|
||||
createMenus();
|
||||
|
||||
QObject::connect(closeApplication.get(), SIGNAL(triggered()), this, SLOT(close()));
|
||||
QObject::connect(closeApplication.get(), SIGNAL(triggered()), this, SLOT(exitApplication()));
|
||||
QObject::connect(cryptionSwitch.get(), SIGNAL(clicked()), this, SLOT(changeCryptionType()));
|
||||
QObject::connect(cryptionButon.get(), SIGNAL(clicked()), this, SLOT(determineCryption()));
|
||||
QObject::connect(keyEdit.get(), SIGNAL(triggered()), this, SLOT(keyManagementWindow()));
|
||||
@@ -94,11 +93,8 @@ void MessagingControls::determineCryption()
|
||||
cryptionChoice = true;
|
||||
}
|
||||
}
|
||||
void MessagingControls::keyManagementWindow()
|
||||
{
|
||||
kh = unique_ptr<KeyManagementWindow>{new KeyManagementWindow};
|
||||
kh.get()->show();
|
||||
}
|
||||
void MessagingControls::keyManagementWindow() { kh.get()->show(); }
|
||||
void MessagingControls::exitApplication() { exit(0); }
|
||||
|
||||
|
||||
std::string MessagingControls::grabCryptionText()
|
||||
|
||||
+4
-13
@@ -13,19 +13,9 @@
|
||||
#include<QVBoxLayout>
|
||||
#include<QDockWidget>
|
||||
#include<QWidget>
|
||||
#include<QString>
|
||||
#include<memory>
|
||||
#include"KeyManagementWindow.h"
|
||||
|
||||
class QLabel;
|
||||
class QLineEdit;
|
||||
class QTextEdit;
|
||||
class QPushButton;
|
||||
class QMenuBar;
|
||||
class QMainWindow;
|
||||
class QMenu;
|
||||
class QAction;
|
||||
class QString;
|
||||
|
||||
using std::unique_ptr;
|
||||
|
||||
@@ -41,6 +31,7 @@ private slots:
|
||||
void changeCryptionType();
|
||||
void determineCryption();
|
||||
void keyManagementWindow();
|
||||
void exitApplication();
|
||||
private:
|
||||
void setupMainWindow();
|
||||
void createMenus();
|
||||
@@ -70,9 +61,9 @@ private:
|
||||
|
||||
std::string grabCryptionText();
|
||||
|
||||
int mainWindowHeight{450};
|
||||
int mainWindowWidth{550};
|
||||
int mainWindowHeight;
|
||||
int mainWindowWidth;
|
||||
|
||||
bool cryptionChoice{true};
|
||||
bool cryptionChoice;
|
||||
};
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user