-
Notifications
You must be signed in to change notification settings - Fork 0
/
wget.cpp
115 lines (106 loc) · 4.12 KB
/
wget.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
105
106
107
108
109
110
111
112
113
114
115
#include "wget.h"
#include "ui_wget.h"
#include <QDebug>
#include <QStandardPaths>
#include <QCoreApplication>
#include <QProcess>
#include <QMessageBox>
#include <QString>
#include <QStringList>
#include <QDir>
#include <QFileDialog>
wget::wget(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::wget)
{
ui->setupUi(this);
}
wget::~wget()
{
delete ui;
}
void wget::on_pushButton_Download_clicked()
{
ui->pushButton_Download->setEnabled(false);
if(ui->checkBox_Select_All->isChecked()){
for(int i=0; i<=9; i++){
QStringList link;
link << ui->lineEdit_IP->text()+ ui->comboBox_File_Names->itemText(i);
QProcess wget;
wget.start("C:/Windows/System32/wget.exe", link);
if(wget.waitForFinished()){
QMessageBox::information(this,"BİLGİ","İndirme Başarılı. " + ui->comboBox_File_Names->itemText(i), "Tamam");
}
else{
QMessageBox::critical(this,"DİKKAT","İndirme başarısız.","Tamam");
}
}
on_checkBox_Select_All_clicked();
}
else if(ui->checkBox_Select_File_Location->isChecked()){
QStringList link;
link << ui->lineEdit_IP->text();
QProcess wget;
wget.start("C:/Windows/System32/wget.exe", link);
if(wget.waitForFinished()){
QMessageBox::information(this,"BİLGİ","İndirme Başarılı. " + ui->lineEdit_IP->text(), "Tamam");
}
else{
QMessageBox::critical(this,"DİKKAT","İndirme başarısız.","Tamam");
}
on_checkBox_Select_File_Location_clicked();
}
else if(ui->checkBox_Select_File->isChecked()){
QStringList link;
link << ui->lineEdit_IP->text()+ ui->comboBox_File_Names->currentText();
QProcess wget;
wget.start("C:/Windows/System32/wget.exe", link);
if(wget.waitForFinished()){
QMessageBox::information(this,"BİLGİ","İndirme Başarılı. " + ui->comboBox_File_Names->currentText(), "Tamam");
}
else{
QMessageBox::critical(this,"DİKKAT","İndirme başarısız.","Tamam");
}
on_checkBox_Select_All_clicked();
}
ui->pushButton_Download->setEnabled(true);
ui->lineEdit_IP->clear();
}
void wget::on_checkBox_Select_All_clicked()
{
ui->comboBox_File_Names->clear();
ui->comboBox_File_Names->addItem("/Logs/MertSerialUpdateLogger.txt");
ui->comboBox_File_Names->addItem("/Logs/logger.txt");
ui->comboBox_File_Names->addItem("/Logs/logger2.txt");
ui->comboBox_File_Names->addItem("/Logs/logger2_port1.txt");
ui->comboBox_File_Names->addItem("/Logs/logger2_port2.txt");
ui->comboBox_File_Names->addItem("/Logs/logger2_port3.txt");
ui->comboBox_File_Names->addItem("/Logs/logger_port1.txt");
ui->comboBox_File_Names->addItem("/Logs/logger_port2.txt");
ui->comboBox_File_Names->addItem("/Logs/logger_port3.txt");
ui->comboBox_File_Names->addItem("/Logs/logger_port4.txt");
ui->label_IP->setText("Enter IP Address");
ui->lineEdit_IP->clear();
}
void wget::on_checkBox_Select_File_Location_clicked()
{
ui->label_IP->setText("Enter File Location");
ui->lineEdit_IP->clear();
ui->comboBox_File_Names->clear();
}
void wget::on_checkBox_Select_File_clicked()
{
ui->comboBox_File_Names->clear();
ui->comboBox_File_Names->addItem("/Logs/MertSerialUpdateLogger.txt");
ui->comboBox_File_Names->addItem("/Logs/logger.txt");
ui->comboBox_File_Names->addItem("/Logs/logger2.txt");
ui->comboBox_File_Names->addItem("/Logs/logger2_port1.txt");
ui->comboBox_File_Names->addItem("/Logs/logger2_port2.txt");
ui->comboBox_File_Names->addItem("/Logs/logger2_port3.txt");
ui->comboBox_File_Names->addItem("/Logs/logger_port1.txt");
ui->comboBox_File_Names->addItem("/Logs/logger_port2.txt");
ui->comboBox_File_Names->addItem("/Logs/logger_port3.txt");
ui->comboBox_File_Names->addItem("/Logs/logger_port4.txt");
ui->label_IP->setText("Enter IP Address");
ui->lineEdit_IP->clear();
}