diff --git a/KeyManagementWindow.cpp b/KeyManagementWindow.cpp index b0ad3c5..bc0bde0 100644 --- a/KeyManagementWindow.cpp +++ b/KeyManagementWindow.cpp @@ -3,7 +3,6 @@ #include #include #include -#include #include #include #include @@ -17,6 +16,7 @@ KeyManagementWindow::KeyManagementWindow(QWidget* parent) : QDialog(parent) comboBoxOfKeys = unique_ptr{new QComboBox{}}; valueOfKey = unique_ptr{new QLineEdit{}}; generateNewDefaultKeys = unique_ptr{new QPushButton(tr("Generate New Default Key"))}; + closeButton = unique_ptr{new QPushButton(tr("close"))}; vBox = unique_ptr{new QVBoxLayout}; hBox = unique_ptr{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(); +} diff --git a/KeyManagementWindow.h b/KeyManagementWindow.h index 607e4d6..a50c71d 100644 --- a/KeyManagementWindow.h +++ b/KeyManagementWindow.h @@ -28,6 +28,7 @@ public: private slots: void test(); void generation(); + void exitApplication(); private: unique_ptr hBox; unique_ptr hBox2; @@ -35,6 +36,7 @@ private: unique_ptr comboBoxOfKeys; unique_ptr valueOfKey; unique_ptr generateNewDefaultKeys; + unique_ptr closeButton; const int windowWidth{400}; const int windowHeight{400}; }; diff --git a/MessagingControls.cpp b/MessagingControls.cpp index 314928c..f3ea62f 100644 --- a/MessagingControls.cpp +++ b/MessagingControls.cpp @@ -1,22 +1,21 @@ -#include #include #include -#include -#include #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{new KeyManagementWindow}; textForCryption = unique_ptr{new QTextEdit{}}; cryptionButon = unique_ptr{new QPushButton(tr("XO"))}; cryptionSwitch = unique_ptr{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{new KeyManagementWindow}; - kh.get()->show(); -} +void MessagingControls::keyManagementWindow() { kh.get()->show(); } +void MessagingControls::exitApplication() { exit(0); } std::string MessagingControls::grabCryptionText() diff --git a/MessagingControls.h b/MessagingControls.h index f9aff75..0d01496 100644 --- a/MessagingControls.h +++ b/MessagingControls.h @@ -13,19 +13,9 @@ #include #include #include -#include #include #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