-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathmainwindow.cpp
77 lines (63 loc) · 1.83 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
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
//ui->progressBar->hide();
downLoad = new DownLoad();
ui->progressBar->setValue(0);
connect(downLoad, SIGNAL(Update(QString,QString,QString,qint64,qint64))
, this, SLOT(Update(QString,QString,QString,qint64,qint64)));
url = "http://115.159.127.79/ihome/download/iot.avi";
ui->pushButton_2->setEnabled(false);
ui->pushButton_3->setEnabled(false);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_pushButton_clicked()
{
int rc = downLoad->NewDownLoad(url);
qDebug() << rc;
ui->pushButton_2->setEnabled(true);
}
void MainWindow::on_pushButton_2_clicked()
{
ui->pushButton_2->setEnabled(false);
ui->pushButton_3->setEnabled(true);
downLoad->StopDownLoad(url);
}
void MainWindow::on_pushButton_3_clicked()
{
ui->pushButton_2->setEnabled(true);
ui->pushButton_3->setEnabled(false);
downLoad->ReStartDownLoad(url);
}
void MainWindow::Update(QString url, QString time,
QString speed, qint64 recesize, qint64 totalsize)
{
ui->URL->setText(url);
ui->progressBar->setMaximum(totalsize);
ui->progressBar->setValue(recesize);
ui->Speed->setText(QString("Speed : ") + speed);
ui->Receive->setText(QString("Time : ") + time);
}
void MainWindow::on_Start2_clicked()
{
QUrl u ("http://115.159.127.79/ihome/download/PAM.tar.bz2");
int rc = downLoad->NewDownLoad(u);
qDebug() << rc;
}
void MainWindow::on_Stop2_clicked()
{
QUrl u ("http://115.159.127.79/ihome/download/PAM.tar.bz2");
downLoad->StopDownLoad(u);
}
void MainWindow::on_Continue2_clicked()
{
QUrl u ("http://115.159.127.79/ihome/download/PAM.tar.bz2");
downLoad->ReStartDownLoad(u);
}