-
Notifications
You must be signed in to change notification settings - Fork 52
/
Copy pathaddfiles.cpp
46 lines (43 loc) · 1.06 KB
/
addfiles.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
#include "addfiles.h"
#include "ui_addfiles.h"
#include <QFileDialog>
#include "roomchat.h"
#include <QDebug>
#include <QTextCodec>
addfiles::addfiles(QWidget *parent) :
QDialog(parent),
ui(new Ui::addfiles)
{
ui->setupUi(this);
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("GBK"));
setWindowTitle(LOCAL("添加文件"));
connect(ui->bt_cofirm,SIGNAL(clicked()),this,SLOT(slotconfirm()));
connect(ui->bt_select,SIGNAL(clicked()),this,SLOT(slotselect()));
}
addfiles::~addfiles()
{
delete ui;
}
void addfiles::slotconfirm()
{
if(!(ui->line_path->text().isEmpty()))
{
RoomChat::GetInstance()->get_filename(ui->line_path->text());
this->close();
}
}
void addfiles::slotselect()
{
QFileDialog* fdlg = new QFileDialog(this);
fdlg -> setFileMode(QFileDialog::DirectoryOnly);
if(fdlg->exec() == QDialog::Accepted)
{
QString path = fdlg->selectedFiles()[0];
ui->line_path->setText(path);
}
delete fdlg;
}
QString addfiles::getfilename()
{
return ui->line_path->text();
}