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();
|
quint32 jpegPicStreamLength = p_ragePhoto.photoBuffer();
|
||||||
QByteArray picByteArray;
|
QByteArray picByteArray;
|
||||||
|
@ -184,10 +184,16 @@ bool SnapmaticPicture::setImage(const QImage &picture)
|
||||||
saveSuccess = picture.save(&picStreamT, "JPEG", comLvl);
|
saveSuccess = picture.save(&picStreamT, "JPEG", comLvl);
|
||||||
picStreamT.close();
|
picStreamT.close();
|
||||||
if (saveSuccess) {
|
if (saveSuccess) {
|
||||||
if (static_cast<quint32>(picByteArrayT.length()) > jpegPicStreamLength) {
|
quint32 size = picByteArrayT.length();
|
||||||
|
if (size > jpegPicStreamLength) {
|
||||||
|
if (!eXtendMode) {
|
||||||
comLvl--;
|
comLvl--;
|
||||||
saveSuccess = false;
|
saveSuccess = false;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
p_ragePhoto.setPhotoBuffer(size, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
picByteArray = picByteArrayT;
|
picByteArray = picByteArrayT;
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,7 @@ public:
|
||||||
QString getOriginalPictureFileName();
|
QString getOriginalPictureFileName();
|
||||||
QString getOriginalPictureFilePath();
|
QString getOriginalPictureFilePath();
|
||||||
int getContentMaxLength();
|
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 setPictureTitl(const QString &newTitle); // Please use setPictureTitle instead
|
||||||
bool setPictureStream(const QByteArray &streamArray);
|
bool setPictureStream(const QByteArray &streamArray);
|
||||||
void updateStrings();
|
void updateStrings();
|
||||||
|
|
Loading…
Reference in a new issue