-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmainwindow.cpp
More file actions
96 lines (70 loc) · 2.59 KB
/
Copy pathmainwindow.cpp
File metadata and controls
96 lines (70 loc) · 2.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QFileDialog>
#include <QtDebug>
#include <QInputDialog>
#include <QProcess>
#include "thread.h"
#include "crypto.h"
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_pushButtonFile_clicked()
{
fileNameIn = QFileDialog::getOpenFileName(this, tr("Выбрать входной файл"),
"D:/Projects/QT/CourseWork/Data",
tr("*"));
/* inputFile = std::ifstream(fileName.toStdString());
if ( !inputFile.is_open() ) {
qDebug() << "Ошибка открытия файла.\n";
return;
}*/
fileNameOut = QFileDialog::getSaveFileName(this, tr("Выбрать выходной файл"),
"D:/Projects/QT/CourseWork/Data",
tr("*"));
/* outputFile = std::ofstream(fileName.toStdString());
if ( !outputFile.is_open() ) {
qDebug()<< "Ошибка открытия файла.\n";
return;
}*/
fileNameKey = QFileDialog::getOpenFileName(this, tr("Выбрать файл с ключом"),
"D:/Projects/QT/CourseWork/Data",
tr("*"));
/* keyFile = std::ifstream(fileName.toStdString());
if ( !keyFile.is_open() ) {
qDebug() << "Ошибка открытия файла.\n";
return;
}*/
}
void MainWindow::on_pushButtonEn_clicked()
{
std::string vi;
if (ui->lineEdit->text().isEmpty())
vi = "|";
vi = ui->lineEdit->text().toStdString();
ED = true;
QString mode = ui->comboBox->currentText();
Thread *thread = new Thread(fileNameIn, fileNameOut,fileNameKey,ED, mode,vi);
thread->start();
}
void MainWindow::update(double progress){
double d = progress*100;
QString temp = " Прогресс: "+ (int)d;
temp +="%";
ui->labelProgress->setText(temp);
}
void MainWindow::on_pushButtonDe_clicked()
{
std::string vi = ui->lineEdit->text().toStdString();
ED = false;
QString mode = ui->comboBox->currentText();
Thread *thread = new Thread(fileNameIn, fileNameOut,fileNameKey,ED, mode,vi);
thread->start();
}