-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmainwindow.cpp
114 lines (79 loc) · 2.23 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
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
97
98
99
100
101
102
103
104
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "ly8pid.h"
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_pushButton_read_log_file_clicked()
{
LY8PID ID;
unsigned int id;
ID.Open_log_file();
id = ID.get_ID();
QString s = QString::number(id);
ui->lcdnumber_log_file->display(s);
}
void MainWindow::on_pushButton_read_elf_file_clicked()
{
LY8PID ID;
unsigned int id;
ID.Open_elf_File();
id = ID.get_ID_elf();
QString s = QString::number(id);
ui->lcdNumber_elf_file->display(s);
}
void MainWindow::on_pushButton_add_number_clicked()
{
LY8PID ID;
QMessageBox msgBox;
ID.Save_log_File();
unsigned int id;
QString string_id;
if (ui->Manual_Number_checkBox->isChecked())
{
string_id = ui->Manualk_Number_lineEdit->text();
id = string_id.toUInt();
if (id < 400000 || id > 499999)
{
msgBox.setWindowTitle("LY8PID");
msgBox.setIcon(QMessageBox::Information);
msgBox.setText("Niedozwolony numer ( tylko 400000 do 499999");
msgBox.exec();
}
QString s = QString::number(id);
ui->lcdNumber_elf_file->display(s);
ID.Set_Manual_Filename(id);
qDebug() << string_id;
qDebug() << id;
}
else
ID.Open_log_file();
id = ID.get_ID();
QString s = QString::number(id);
qDebug() << id;
ui->lcdnumber_log_file->display(s);
ui->statusbar->showMessage("Numer kolejny nadany!", 1000);
}
void MainWindow::on_actionOpen_Log_File_triggered()
{
LY8PID ID;
QString filename = QFileDialog::getOpenFileName(this, "Open log file","", "*.log");
ID.Set_FileNameLog(filename);
ui->lineEdit_log_file->setText(filename);
ui->statusbar->showMessage("Plik log Wczytany", 3000);
}
void MainWindow::on_actionOpen_Elf_File_triggered()
{
LY8PID ID;
QString filename = QFileDialog::getOpenFileName(this, "Open elf file", "", "*.elf");
ID.Set_FileNAme(filename);
ui->lineEdit_elf_file->setText(filename);
ui->statusbar->showMessage("Plik elf Wczytany", 3000);
}