SnapmaticPicture: add eXtendMode
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
c0a3e08527
commit
1b6cb511be
2 changed files with 11 additions and 5 deletions
|
@ -171,7 +171,7 @@ bool SnapmaticPicture::readingPictureFromFile(const QString &fileName, bool cach
|
|||
}
|
||||
}
|
||||
|
||||
bool SnapmaticPicture::setImage(const QImage &picture)
|
||||
bool SnapmaticPicture::setImage(const QImage &picture, bool eXtendMode)
|
||||
{
|
||||
quint32 jpegPicStreamLength = p_ragePhoto.photoBuffer();
|
||||
QByteArray picByteArray;
|
||||
|
@ -184,10 +184,16 @@ bool SnapmaticPicture::setImage(const QImage &picture)
|
|||
saveSuccess = picture.save(&picStreamT, "JPEG", comLvl);
|
||||
picStreamT.close();
|
||||
if (saveSuccess) {
|
||||
if (static_cast<quint32>(picByteArrayT.length()) > jpegPicStreamLength) {
|
||||
quint32 size = picByteArrayT.length();
|
||||
if (size > jpegPicStreamLength) {
|
||||
if (!eXtendMode) {
|
||||
comLvl--;
|
||||
saveSuccess = false;
|
||||
}
|
||||
else {
|
||||
p_ragePhoto.setPhotoBuffer(size, true);
|
||||
}
|
||||
}
|
||||
else {
|
||||
picByteArray = picByteArrayT;
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ public:
|
|||
QString getOriginalPictureFileName();
|
||||
QString getOriginalPictureFilePath();
|
||||
int getContentMaxLength();
|
||||
bool setImage(const QImage &picture);
|
||||
bool setImage(const QImage &picture, bool eXtendMode = false);
|
||||
bool setPictureTitl(const QString &newTitle); // Please use setPictureTitle instead
|
||||
bool setPictureStream(const QByteArray &streamArray);
|
||||
void updateStrings();
|
||||
|
|
Loading…
Reference in a new issue