-
Notifications
You must be signed in to change notification settings - Fork 52
/
Copy pathsendfiles.cpp
60 lines (55 loc) · 1.39 KB
/
sendfiles.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
#include "sendfiles.h"
#include "ui_sendfiles.h"
#include "qfiletrans.h"
#include "loginwindow.h"
#include "qfiletrans.h"
#include "chatwindow.h"
#include "listwindow.h"
#include <QFileDialog>
#include <QMessageBox>
#include <QFileIconProvider>
SendFiles::SendFiles(QWidget *parent) :
QDialog(parent),
ui(new Ui::SendFiles)
{
ui->setupUi(this);
Qt::WindowFlags flags=Qt::Dialog;
flags |=Qt::WindowMinimizeButtonHint;
setWindowFlags(flags);
this->setWindowTitle(LOCAL("文件发送"));
connect(ui->choose,SIGNAL(clicked()),this,SLOT(choosefile()));
connect(ui->send,SIGNAL(clicked()),this,SLOT(sendfile()));
}
//选择文件
void SendFiles::choosefile()
{
QFileDialog *fd = new QFileDialog(this);
if (fd -> exec() == QDialog::Accepted)
{
QString fn = fd->selectedFiles()[0];
_file_to_send.clear();
_file_to_send.append(fn);
setFilePath(fn);
}
}
void SendFiles::setFilePath(QString txt)
{
// QFileInfo info(txt);
// QFileIconProvider ip;
// QIcon ico = ip.icon(info);
// QPixmap pix = ico.pixmap(30,30);
// ui->label_ico->setPixmap(pix);
ui->lineEdit->setText(txt);
}
//发送 文件
void SendFiles::sendfile()
{
QString jid = tojid;
Listwindow::Instance()->setwindowsendflag(jid,true);
Loginwindow::getclient()->sendFile(jid,ui->lineEdit->text());
close();
}
SendFiles::~SendFiles()
{
delete ui;
}