-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimcn.cpp
More file actions
31 lines (26 loc) · 791 Bytes
/
vimcn.cpp
File metadata and controls
31 lines (26 loc) · 791 Bytes
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
#include "vimcn.h"
vimcn::vimcn(QObject *parent) : QObject(parent)
{
hu=new httpUpload();
connect(hu,SIGNAL(downloadError(QString)),this,SLOT(httpError(QString)));
connect(hu,SIGNAL(redirected(QString)),this,SLOT(httpError(QString)));
connect(hu,SIGNAL(finished()),this,SLOT(httpFinished()));
hu->init("https://img.vim-cn.com/");
}
void vimcn::upload(QString fileName)
{
QString cdh=QString("form-data; name=\"image\"; filename=\"")+fileName+QString("\"");
hu->multiPartClear();
hu->appendImg(cdh,fileName);
picLink="";
hu->doUpload();
}
void vimcn::httpFinished()
{
picLink=hu->readData();
emit uploadSucess(picLink);
}
void vimcn::httpError(QString inErrorString)
{
emit uploadError(inErrorString);
}