-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJPEGConverter.h
36 lines (27 loc) · 876 Bytes
/
JPEGConverter.h
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
#ifndef BMPCONVERTER_H
#define BMPCONVERTER_H
#include <QByteArray>
#include <QMap>
#include <QFile>
#include <QFileInfo>
struct FileToUpload{
QByteArray byteArray;
qint32 partNumber;
QString sourceFileName;
qint64 offset;
explicit FileToUpload(): partNumber(0), sourceFileName(""), offset(0) {}
QString getFileName(){
return sourceFileName + ".part" + QString::number(partNumber) + ".jpg";
}
};
class JPEGConverter{
QByteArray tmp;
unsigned long const max_size;
QByteArray convertBytesToJPEGBytes(QByteArray const &data);
QByteArray convertJPEGBytesToBytes(QByteArray const &bmpdata);
public:
JPEGConverter(QString const &filetmp);
void encodeFile(QString const &inputFileName, FileToUpload &fileToUpload);
bool decodeFile(QString const &filename, QByteArray const &array);
};
#endif // BMPCONVERTER_H