mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-12 00:00:44 -04:00
Allow to import stickers from chat window
This commit is contained in:
parent
641964fff9
commit
e52f1282ec
7 changed files with 46 additions and 12 deletions
|
@ -37,7 +37,7 @@
|
|||
|
||||
ImageUtil::ImageUtil() {}
|
||||
|
||||
void ImageUtil::extractImage(QWidget *window, QTextCursor cursor)
|
||||
void ImageUtil::extractImage(QWidget *window, QTextCursor cursor, QString file)
|
||||
{
|
||||
cursor.movePosition(QTextCursor::Left, QTextCursor::MoveAnchor, 1);
|
||||
cursor.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor, 2);
|
||||
|
@ -52,13 +52,13 @@ void ImageUtil::extractImage(QWidget *window, QTextCursor cursor)
|
|||
QImage image = QImage::fromData(ba);
|
||||
if(!image.isNull())
|
||||
{
|
||||
QString file;
|
||||
success = true;
|
||||
if(misc::getSaveFileName(window, RshareSettings::LASTDIR_IMAGES, "Save Picture File", "Pictures (*.png *.xpm *.jpg)", file))
|
||||
if(!file.isEmpty() || misc::getSaveFileName(window, RshareSettings::LASTDIR_IMAGES, "Save Picture File", "Pictures (*.png *.xpm *.jpg)", file))
|
||||
{
|
||||
if(!image.save(file, 0, 100))
|
||||
if(!image.save(file + ".png", 0, 100))
|
||||
QMessageBox::warning(window, QApplication::translate("ImageUtil", "Save image"), QApplication::translate("ImageUtil", "Cannot save the image, invalid filename"));
|
||||
if(!image.save(file, nullptr, 100))
|
||||
if(!image.save(file + ".png", nullptr, 100))
|
||||
QMessageBox::warning(window, QApplication::translate("ImageUtil", "Save image"), QApplication::translate("ImageUtil", "Cannot save the image, invalid filename")
|
||||
+ "\n" + file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue