-
Notifications
You must be signed in to change notification settings - Fork 0
/
mainwindow.cpp
64 lines (58 loc) · 1.79 KB
/
mainwindow.cpp
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
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_exece_clicked()
{ MainWindow::setWindowTitle("Processing.");
QString filename1 = ui->fname->text();
QByteArray xcs = filename1.toLocal8Bit();
const char *filename = xcs.data();
QString str = ui->sizef->text();
bool ok;
int size = str.toInt(&ok);
int kbsize;
int x;
char cmd[1000];
FILE * diskfile;
diskfile = fopen (filename, "w");
char none[255] = " ";
kbsize = size * 13000;
for(x=1;x != 0; x++) {
if (x!=0) {
fprintf(diskfile, "0000000000000000000000000000000000000000000000000000000000000000000000000000000000\n");
}
if (x == kbsize) {
fclose(diskfile);
MainWindow::setWindowTitle("Done!");
if (ui->fmat->isChecked() == true) {
MainWindow::setWindowTitle("Formating.");
if (ui->ext3->isChecked() != true) {
ui->ext4->setChecked(true);
}
if (ui->ext4->isChecked() == true){
strcpy (cmd, "mkfs.ext4");
}else if (ui->ext3->isChecked() == true) {
strcpy(cmd, "mkfs.ext3");
}
strcat (cmd, none);
strcat (cmd, filename);
system(cmd);
MainWindow::setWindowTitle("Done!");
return void(0);
} else {
return void(0);
}
}
}
}