Added vacant Password Management Window

This commit is contained in:
amazing-username
2017-07-29 16:18:50 -05:00
parent 4d5b19cabe
commit 2074f26c4e
8 changed files with 111 additions and 64 deletions
+16 -15
View File
@@ -10,29 +10,30 @@ public:
Conversions() = default; Conversions() = default;
~Conversions()=default; ~Conversions()=default;
std::string cstringToString(char[], const int); template<typename C=char,typename S=std::string>
//char stringToChar(const string&); S cstringToString(const C[], const int);
template<typename C=char,typename S=std::string>
C stringToChar(const S&);
private: private:
}; };
template<typename C=char,typename S=std::string>
std::string Conversions::cstringToString(char tmp[], const int size) S Conversions::cstringToString(const C tmp[], const int size)
{ {
std::string tmpString{};
std::stringstream cToS{}; std::stringstream cToS{};
for (auto index =0; index!=size; ++ index) for (auto index=0; index!=size; ++index)
cToS << tmp[index]; cToS<<tmp[index];
cToS >> tmpString; std::string tmpString{};
cToS>>tmpString;
return tmpString; return tmpString;
} }
/** template<typename C=char,typename S=std::string>
char Conversions::stringToChar(const string& tmp) C Conversions::stringToChar(const S& tmp)
{ {
std::stringstream sToC{};
for (auto tmpElements:tmp)
sToC<<tmpElements;
char tmpChar{}; char tmpChar{};
stringstream sToC{}; sToC>>tmpChar;
for (auto index=0; index!=tmp.size(); ++index)
sToC << tmpChar;
sToC >> tmpChar;
return tmpChar; return tmpChar;
} }
*/
#endif #endif
-20
View File
@@ -1,20 +0,0 @@
######################################################################
# Automatically generated by qmake (3.1) Fri Mar 24 12:16:30 2017
######################################################################
TEMPLATE = app
TARGET = EncryptedMessaging
QT += core gui
QT += widgets
INCLUDEPATH += .
# Input
HEADERS += Decryption.h Encryption.h GenerateKeys.h MessagingControls.h Cryption.h KeyManagementWindow.h KeyRetrieval.h Conversions.h CommonWindow.h ViewingWindow.h
SOURCES += Decryption.cpp \
Encryption.cpp \
Cryption.cpp \
KeyManagementWindow.cpp \
KeyRetrieval.cpp \
GenerateKeys.cpp \
Main.cpp \
MessagingControls.cpp
+22 -15
View File
@@ -12,6 +12,25 @@
#include"Conversions.h" #include"Conversions.h"
KeyManagementWindow::KeyManagementWindow(QWidget* parent) : QDialog(parent) KeyManagementWindow::KeyManagementWindow(QWidget* parent) : QDialog(parent)
{
setupWindow();
connections();
}
void KeyManagementWindow::setContentsOfComboBox()
{
KeyRetrieval kr{};
std::vector<int> c{kr.codeCharacterStructure()};
for (auto index = 0u; index!=c.size(); ++index)
{
std::string ch{static_cast<char>(c[index])};
QString bl = QString::fromStdString(ch);
selectionBox.get()->addItem(bl);
}
}
void KeyManagementWindow::setupWindow()
{ {
windowWidth = 450; windowWidth = 450;
windowHeight = 450; windowHeight = 450;
@@ -54,25 +73,13 @@ KeyManagementWindow::KeyManagementWindow(QWidget* parent) : QDialog(parent)
setFixedHeight(windowHeight); setFixedHeight(windowHeight);
setWindowTitle("Key Management Window"); setWindowTitle("Key Management Window");
}
void KeyManagementWindow::connections()
{
QObject::connect(selectionBox.get(), SIGNAL(currentIndexChanged(int)), SLOT(test())); QObject::connect(selectionBox.get(), SIGNAL(currentIndexChanged(int)), SLOT(test()));
QObject::connect(generateNewKeys.get(), SIGNAL(clicked()), this, SLOT(generation())); QObject::connect(generateNewKeys.get(), SIGNAL(clicked()), this, SLOT(generation()));
QObject::connect(closeButton.get(), SIGNAL(clicked()), this, SLOT(exitApplication())); QObject::connect(closeButton.get(), SIGNAL(clicked()), this, SLOT(exitApplication()));
} }
void KeyManagementWindow::setContentsOfComboBox()
{
KeyRetrieval kr{};
std::vector<int> c{kr.codeCharacterStructure()};
for (auto index = 0u; index!=c.size(); ++index)
{
std::string ch{static_cast<char>(c[index])};
QString bl = QString::fromStdString(ch);
selectionBox.get()->addItem(bl);
}
}
void KeyManagementWindow::test() void KeyManagementWindow::test()
{ {
std::string emp{"d"}; std::string emp{"d"};
+3 -8
View File
@@ -2,11 +2,6 @@
#define KEYMANAGEMENTWINDOW_H #define KEYMANAGEMENTWINDOW_H
#include<QDialog> #include<QDialog>
#include<QVBoxLayout>
#include<QHBoxLayout>
#include<QComboBox>
#include<QLineEdit>
#include<QPushButton>
#include<memory> #include<memory>
#include"CommonWindow.h" #include"CommonWindow.h"
#include"ViewingWindow.h" #include"ViewingWindow.h"
@@ -17,13 +12,13 @@ class KeyManagementWindow : public QDialog, public CommonWindow, public ViewingW
public: public:
KeyManagementWindow(QWidget* parent = 0); KeyManagementWindow(QWidget* parent = 0);
~KeyManagementWindow() = default; ~KeyManagementWindow() = default;
void setContentsOfComboBox();
private slots: private slots:
void test(); void test();
void generation(); void generation();
void exitApplication(); void exitApplication();
private: private:
void setContentsOfComboBox();
void setupWindow();
void connections();
}; };
#endif #endif
+15 -6
View File
@@ -6,15 +6,16 @@
MainWindow::MainWindow() MainWindow::MainWindow()
{ {
windowHeight = 450; kh = unique_ptr<KeyManagementWindow>{new KeyManagementWindow};
windowWidth = 450; ph = unique_ptr<PasswordManagementWindow>{new PasswordManagementWindow};
setupMainWindow(); setupMainWindow();
} }
void MainWindow::setupMainWindow() void MainWindow::setupMainWindow()
{ {
kh = unique_ptr<KeyManagementWindow>{new KeyManagementWindow}; windowHeight = 450;
windowWidth = 450;
textForCryption = unique_ptr<QTextEdit>{new QTextEdit{}}; textForCryption = unique_ptr<QTextEdit>{new QTextEdit{}};
actionButton = unique_ptr<QPushButton>{new QPushButton(tr("encrypt"))}; actionButton = unique_ptr<QPushButton>{new QPushButton(tr("encrypt"))};
selectionBox = unique_ptr<QComboBox>{new QComboBox{}}; selectionBox = unique_ptr<QComboBox>{new QComboBox{}};
@@ -37,12 +38,10 @@ void MainWindow::setupMainWindow()
createMenus(); createMenus();
QObject::connect(closeApplication.get(), SIGNAL(triggered()), this, SLOT(exitApplication()));
QObject::connect(keyEdit.get(), SIGNAL(triggered()), this, SLOT(keyManagementWindow()));
setWindowTitle("Encryption Decryption Messaging"); setWindowTitle("Encryption Decryption Messaging");
setFixedHeight(windowHeight); setFixedHeight(windowHeight);
setFixedWidth(windowWidth); setFixedWidth(windowWidth);
connections();
} }
void MainWindow::createMenus() void MainWindow::createMenus()
{ {
@@ -54,9 +53,18 @@ void MainWindow::createMenus()
keyEdit = unique_ptr<QAction>{new QAction(new QObject(nullptr))}; keyEdit = unique_ptr<QAction>{new QAction(new QObject(nullptr))};
keyEdit.get()->setText("Key Management"); keyEdit.get()->setText("Key Management");
passwordManage = unique_ptr<QAction>{new QAction{new QObject{nullptr}}};
passwordManage.get()->setText("PasswordManagement");
fileMenu.get()->addAction(closeApplication.get()); fileMenu.get()->addAction(closeApplication.get());
editMenu.get()->addAction(keyEdit.get()); editMenu.get()->addAction(keyEdit.get());
editMenu.get()->addAction(passwordManage.get());
}
void MainWindow::connections()
{
QObject::connect(closeApplication.get(), SIGNAL(triggered()), this, SLOT(exitApplication()));
QObject::connect(keyEdit.get(), SIGNAL(triggered()), this, SLOT(keyManagementWindow()));
QObject::connect(passwordManage.get(), SIGNAL(triggered()), this, SLOT(passwordManageWindow()));
} }
@@ -89,6 +97,7 @@ void MainWindow::determineCryption()
} }
} }
void MainWindow::keyManagementWindow() { kh.get()->show(); } void MainWindow::keyManagementWindow() { kh.get()->show(); }
void MainWindow::passwordManageWindow() { ph.get()->show(); }
void MainWindow::exitApplication() { exit(0); } void MainWindow::exitApplication() { exit(0); }
+5
View File
@@ -14,6 +14,7 @@
#include<QWidget> #include<QWidget>
#include<memory> #include<memory>
#include"KeyManagementWindow.h" #include"KeyManagementWindow.h"
#include"PasswordManagementWindow.h"
#include"CommonWindow.h" #include"CommonWindow.h"
@@ -29,10 +30,12 @@ private slots:
void changeCryptionType(); void changeCryptionType();
void determineCryption(); void determineCryption();
void keyManagementWindow(); void keyManagementWindow();
void passwordManageWindow();
void exitApplication(); void exitApplication();
private: private:
void setupMainWindow(); void setupMainWindow();
void createMenus(); void createMenus();
void connections();
unique_ptr<QVBoxLayout> buttonLayout; unique_ptr<QVBoxLayout> buttonLayout;
@@ -52,8 +55,10 @@ private:
unique_ptr<QMenu> editMenu; unique_ptr<QMenu> editMenu;
unique_ptr<QAction> closeApplication; unique_ptr<QAction> closeApplication;
unique_ptr<QAction> keyEdit; unique_ptr<QAction> keyEdit;
unique_ptr<QAction> passwordManage;
unique_ptr<KeyManagementWindow> kh; unique_ptr<KeyManagementWindow> kh;
unique_ptr<PasswordManagementWindow> ph;
std::string grabCryptionText(); std::string grabCryptionText();
+35
View File
@@ -1,6 +1,41 @@
#include"PasswordManagementWindow.h" #include"PasswordManagementWindow.h"
PasswordManagementWindow::PasswordManagementWindow(QWidget* parent) : QDialog(parent) PasswordManagementWindow::PasswordManagementWindow(QWidget* parent) : QDialog(parent)
{
setupWindow();
}
void PasswordManagementWindow::setupWindow()
{
windowWidth=450;
windowHeight=450;
elementView=unique_ptr<QTableView>{new QTableView};
selectionBox=unique_ptr<QComboBox>{new QComboBox};
actionButton=unique_ptr<QPushButton>{new QPushButton{"i3"}};
crypticText=unique_ptr<QLineEdit>{new QLineEdit};
mainLayout=unique_ptr<QHBoxLayout>{new QHBoxLayout};
subLayoutOne=unique_ptr<QVBoxLayout>{new QVBoxLayout};
subLayoutTwo=unique_ptr<QVBoxLayout>{new QVBoxLayout};
subLayoutOne.get()->addWidget(elementView.get());
subLayoutTwo.get()->addWidget(selectionBox.get());
subLayoutTwo.get()->addWidget(actionButton.get());
subLayoutTwo.get()->addWidget(crypticText.get());
mainLayout.get()->addLayout(subLayoutOne.get());
mainLayout.get()->addLayout(subLayoutTwo.get());
setLayout(mainLayout.get());
setFixedWidth(windowWidth);
setFixedHeight(windowHeight);
connections();
}
void PasswordManagementWindow::connections()
{ {
} }
+15
View File
@@ -1,7 +1,22 @@
#ifndef PASSWORDMANAGEMENTWINDOW_H_ #ifndef PASSWORDMANAGEMENTWINDOW_H_
#define PASSWORDMANAGEMENTWINDOW_H_ #define PASSWORDMANAGEMENTWINDOW_H_
#include<QDialog>
#include"CommonWindow.h"
#include"ViewingWindow.h"
class PasswordManagementWindow : public QDialog, public CommonWindow, public ViewingWindow class PasswordManagementWindow : public QDialog, public CommonWindow, public ViewingWindow
{ {
Q_OBJECT
public:
PasswordManagementWindow(QWidget* parent=0);
~PasswordManagementWindow()=default;
private:
void setupWindow();
void connections();
unique_ptr<QLineEdit> passwordField;
private slots:
}; };
#endif