feature: paste image in chat #51

Merged
blue merged 3 commits from shunf4/squawk:feat/paste_img into messageFeed 3 months ago
shunf4 commented 3 months ago

Add feature: paste image in chat (context menu/Ctrl-V).

This PR is based on #50. The changes for this PR is at the lastest commit.

Add feature: paste image in chat (context menu/Ctrl-V). This PR is based on #50. The changes for this PR is at the lastest commit.
shunf4 added 17 commits 3 months ago
blue reviewed 3 months ago
m_ui->messageEditor->installEventFilter(&ker);
QAction* pasteImageAction = new QAction(tr("Paste Image"), this);
blue commented 3 months ago
Poster
Owner

Do you mind if we better move it to initialization block? Cuz, since you declare here that variable again as QAction* it might be even considered like another variable rather than that one declared as a property...

Do you mind if we better move it to initialization block? Cuz, since you declare here that variable again as QAction* it might be even considered like another variable rather than that one declared as a property...
Poster

How about this change? 52551c1ce0

How about this change? https://git.macaw.me/blue/squawk/commit/52551c1ce0be0a223e388d339389b7a55b159b6c
blue commented 3 months ago
Poster
Owner

That's good, thank you!

That's good, thank you!
blue marked this conversation as resolved
blue reviewed 3 months ago
if (image.isNull()) {
return;
}
QTemporaryFile *tempFile = new QTemporaryFile(QDir::tempPath() + QStringLiteral("/squawk_img_attach_XXXXXX.png"), QApplication::instance());
blue commented 3 months ago
Poster
Owner

Interestring solution...
I actually was thinking of it, but was more into may be saving it into downloads folder, for the next time. Like this way at somepoint the image is not going to be accesible, so, we're going to be forced to download it to see it.
Dunno, i really have mixed feelings about my way, what do you think?

Interestring solution... I actually was thinking of it, but was more into may be saving it into downloads folder, for the next time. Like this way at somepoint the image is not going to be accesible, so, we're going to be forced to download it to see it. Dunno, i really have mixed feelings about my way, what do you think?
Poster

I agree with you. Placing the pasted image into downloads folder is better.

Or putting it to temp folder, then moving it to downloads folder if it is sent successfully?

I agree with you. Placing the pasted image into downloads folder is better. Or putting it to temp folder, then moving it to downloads folder if it is sent successfully?
blue commented 3 months ago
Poster
Owner

Yeah, that would do! But if you will move the image on successfull send you're going to need to update the path to the image in databases after the image is moved, I hope I've done that handler...

Yeah, that would do! But if you will move the image on successfull send you're going to need to update the path to the image in databases after the image is moved, I hope I've done that handler...
Poster

Done in 39f2f3d975 .

The file is copied (rather than moved) because it might still be used by QImageReader in message preview widget.

Done in https://git.macaw.me/blue/squawk/commit/39f2f3d975a1ce38144ef1992506416a934e5005 . The file is copied (rather than moved) because it might still be used by `QImageReader` in message preview widget.
shunf4 added 1 commit 3 months ago
shunf4 added 1 commit 3 months ago
blue merged commit 893ff53aa8 into messageFeed 3 months ago
The pull request has been merged as 893ff53aa8.
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

This pull request currently doesn't have any dependencies.

Loading…
There is no content yet.