-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmainwindow.cpp
More file actions
88 lines (79 loc) · 2.36 KB
/
mainwindow.cpp
File metadata and controls
88 lines (79 loc) · 2.36 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
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "QFileDialog"
#include "QString"
#include "stealth.h"
#include <QtCore>
#include <QMessageBox>
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_pushButton_clicked()
{
QString file = QFileDialog::getOpenFileName(this, tr("Open File"), "/Users", "Wave Audio (*.wav)");
ui->EncodeIn->setText(file);
}
void MainWindow::on_pushButton_2_clicked()
{
QString file = QFileDialog::getSaveFileName(this, tr("Open File"), "/Users", "Wave Audio (*.wav)");
ui->EncodeOut->setText(file);
}
void MainWindow::on_pushButton_3_clicked()
{
Stealth s;
const char * filerrhndl = ".wav";
if (ui->EncodeIn->text().length() == 0 || ui->EncodeOut->text().length() == 0)
{
QMessageBox::information(this,"Nothing to do", "File Not Selected");
}
else if(ui->EncodeMessage->text().length() == 0)
{
QMessageBox::information(this, "No Message", "No Message entered to encode.");
}
else if(!ui->EncodeIn->text().endsWith(filerrhndl) || !ui->EncodeOut->text().endsWith(filerrhndl))
{
QMessageBox::information(this, "File Error", "Please enter wave (*.wav) files to encode message.");
}
else
{
QString in = ui->EncodeIn->text();
QString out = ui->EncodeOut->text();
QString mes = ui->EncodeMessage->text();
s.Setinput(in);
s.Setoutput(out);
s.Setmessage(mes);
int i = s.Encode();
if(i == 0)
{
QMessageBox::information(this,"Encodeing Status", "Encoding Successful.");
}
}
}
void MainWindow::on_pushButton_4_clicked()
{
QString file = QFileDialog::getOpenFileName(this, tr("Open File"), "/Users", "Wave Audio (*.wav)");
ui->DecodeFile->setText(file);
}
void MainWindow::on_pushButton_5_clicked()
{
if (ui->DecodeFile->text().length() == 0)
{
QMessageBox::information(this,"Nothing to do", "File Not Selected");
}
else if (!ui->DecodeFile->text().endsWith(".wav"))
{
QMessageBox::information(this,"File Error", "Please enter wave (*.wav) files to decode message.");
}
Stealth s;
QString in = ui->DecodeFile->text();
s.Setinput(in);
QString str = s.Decode();
ui->DecodeMessage->setText(str);
}