Skip to content

Commit

Permalink
Merge pull request #53 from yunusemreyilmazz/dev
Browse files Browse the repository at this point in the history
Design Of Generation and Train Screens
  • Loading branch information
ignis-sec authored May 19, 2021
2 parents d2ba484 + de3d317 commit 047732c
Show file tree
Hide file tree
Showing 8 changed files with 372 additions and 41 deletions.
47 changes: 47 additions & 0 deletions MarkovPasswordsGUI/Generate.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#include "Generate.h"
#include <fstream>
#include <Windows.h>
#include<QFileDialog>
#include<QMessageBox>
#include<QTextStream>
#include<QDir>
#include "src/CLI.h"
// #include "../MarkovPasswords/src/markovPasswords.cpp"
#include <QtWidgets/QApplication>



Generate::Generate(QWidget* parent)
: QMainWindow(parent)
{
ui.setupUi(this);

QObject::connect(ui.pushButton, &QPushButton::clicked, this, [this] {generation(); });

/* std::random_device rd;
std::default_random_engine generator(rd());
std::uniform_int_distribution<long long unsigned> distribution(0, 0xffffFFFF);
*/
}

void Generate::generation() {
QString file_name = QFileDialog::getOpenFileName(this, "Open a File", QDir::homePath());
QFile file(file_name);

if (!file.open(QFile::ReadOnly | QFile::Text)) {
QMessageBox::warning(this, "Error", "File Not Open!");
}
QTextStream in(&file);
QString text = in.readAll();
ui.plainTextEdit->setPlainText(text);



file.close();
}

void Generate::home() {
CLI* w = new CLI;
w->show();
this->close();
}
17 changes: 17 additions & 0 deletions MarkovPasswordsGUI/Generate.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#pragma once
#include <QtWidgets/QMainWindow>
#include "ui_Generate.h"


class Generate :public QMainWindow {
Q_OBJECT
public:
Generate(QWidget* parent = Q_NULLPTR);

private:
Ui::Generate ui;

public slots:
void home();
void generation();
};
153 changes: 153 additions & 0 deletions MarkovPasswordsGUI/Generate.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Generate</class>
<widget class="QWidget" name="Generate">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1146</width>
<height>715</height>
</rect>
</property>
<property name="windowTitle">
<string>Generation</string>
</property>
<property name="styleSheet">
<string notr="true">#Generate{
background-color:#D2B4DE ;

}
QFrame{
background:rgba(0,0,0,0.8);
border-radius:15px;
}

QPushButton{
background:#03a9f4;
color:#fff;
border-radius:15px;
font-size:22px

}
QPushButton:hover{
color: #03a9f4;
background-color:#fff;
}
QLabel{
color:#03a9f4;
background:transparent;
font-size:30px;

}
QPlainTextEdit{
color:#fff;
}</string>
</property>
<widget class="QFrame" name="frame">
<property name="geometry">
<rect>
<x>150</x>
<y>70</y>
<width>831</width>
<height>531</height>
</rect>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>30</x>
<y>70</y>
<width>141</width>
<height>16</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">font-size:15px;</string>
</property>
<property name="text">
<string>File Contents:</string>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>460</x>
<y>60</y>
<width>231</width>
<height>31</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">font-size:15px;</string>
</property>
<property name="text">
<string>After Generating File Contents:</string>
</property>
</widget>
<widget class="QPlainTextEdit" name="plainTextEdit">
<property name="geometry">
<rect>
<x>10</x>
<y>90</y>
<width>371</width>
<height>361</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">color:#fff;</string>
</property>
</widget>
<widget class="QPlainTextEdit" name="plainTextEdit_2">
<property name="geometry">
<rect>
<x>430</x>
<y>90</y>
<width>371</width>
<height>361</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">color:#fff;</string>
</property>
<property name="plainText">
<string/>
</property>
</widget>
</widget>
<widget class="QPushButton" name="pushButton">
<property name="geometry">
<rect>
<x>440</x>
<y>610</y>
<width>271</width>
<height>71</height>
</rect>
</property>
<property name="text">
<string>Start Generate</string>
</property>
</widget>
<widget class="QPushButton" name="pushButton_2">
<property name="geometry">
<rect>
<x>810</x>
<y>20</y>
<width>161</width>
<height>41</height>
</rect>
</property>
<property name="text">
<string>Home</string>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>
5 changes: 5 additions & 0 deletions MarkovPasswordsGUI/MarkovPasswordsGUI.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
<QtUic Include="about.ui" />
<QtUic Include="CLI.ui" />
<QtUic Include="Comparison.ui" />
<QtUic Include="Generate.ui" />
<QtUic Include="MarkovPasswordsGUI.ui" />
<QtUic Include="menu.ui" />
<QtUic Include="Train.ui" />
Expand All @@ -107,6 +108,7 @@
<ItemGroup>
<ClCompile Include="about.cpp" />
<ClCompile Include="CLI.cpp" />
<ClCompile Include="Generate.cpp" />
<ClCompile Include="src\main.cpp" />
<ClCompile Include="src\MarkovPasswordsGUI.cpp" />
<ClCompile Include="src\menu.cpp" />
Expand All @@ -131,6 +133,9 @@
<ItemGroup>
<QtMoc Include="src\about.h" />
</ItemGroup>
<ItemGroup>
<QtMoc Include="Generate.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Condition="Exists('$(QtMsBuild)\qt.targets')">
<Import Project="$(QtMsBuild)\qt.targets" />
Expand Down
9 changes: 9 additions & 0 deletions MarkovPasswordsGUI/MarkovPasswordsGUI.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@
<ClCompile Include="Train.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Generate.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<QtMoc Include="src\MarkovPasswordsGUI.h">
Expand All @@ -84,6 +87,9 @@
<QtMoc Include="src\about.h">
<Filter>Source Files</Filter>
</QtMoc>
<QtMoc Include="Generate.h">
<Filter>Source Files</Filter>
</QtMoc>
</ItemGroup>
<ItemGroup>
<QtUic Include="menu.ui">
Expand All @@ -101,6 +107,9 @@
<QtUic Include="Train.ui">
<Filter>Resource Files</Filter>
</QtUic>
<QtUic Include="Generate.ui">
<Filter>Resource Files</Filter>
</QtUic>
</ItemGroup>
<ItemGroup>
<Image Include="views\startup.jpg">
Expand Down
45 changes: 33 additions & 12 deletions MarkovPasswordsGUI/Train.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
#include "src/Train.h"
#include <fstream>
#include <Windows.h>
#include<QFileDialog>
#include<QMessageBox>
#include<QTextStream>
#include<QDir>
#include "src/CLI.h"
// #include "../MarkovPasswords/src/markovPasswords.cpp"

#include <QtWidgets/QApplication>



Expand All @@ -10,19 +17,33 @@ Train::Train(QWidget* parent)
{
ui.setupUi(this);

QObject::connect(ui.pushButton, &QPushButton::clicked, this, [this] {open(); });
QObject::connect(ui.pushButton_2, &QPushButton::clicked, this, [this] {train(); });


QObject::connect(ui.pushButton, &QPushButton::clicked, this, [this] {train(); });
QObject::connect(ui.pushButton_2, &QPushButton::clicked, this, [this] {home(); });
/* std::random_device rd;
std::default_random_engine generator(rd());
std::uniform_int_distribution<long long unsigned> distribution(0, 0xffffFFFF);
*/
}

void Train::open() {
// Start* w = new Start;
//w->show();
//this->close();
}
void Train::train() {
/*
train codes;
*/
QString file_name = QFileDialog::getOpenFileName(this, "Open a File", QDir::homePath());
QFile file(file_name);

if (!file.open(QFile::ReadOnly | QFile::Text)) {
QMessageBox::warning(this, "Error", "File Not Open!");
}
QTextStream in(&file);
QString text = in.readAll();
ui.plainTextEdit->setPlainText(text);



file.close();
}

void Train::home() {
CLI* w = new CLI;
w->show();
this->close();
}

Loading

0 comments on commit 047732c

Please sign in to comment.