|
|
|
@ -178,6 +178,7 @@ ChatForm::ChatForm(Friend* chatFriend)
@@ -178,6 +178,7 @@ ChatForm::ChatForm(Friend* chatFriend)
|
|
|
|
|
|
|
|
|
|
connect(msgEdit, &ChatTextEdit::enterPressed, this, &ChatForm::onSendTriggered); |
|
|
|
|
connect(msgEdit, &ChatTextEdit::textChanged, this, &ChatForm::onTextEditChanged); |
|
|
|
|
connect(msgEdit, &ChatTextEdit::pasteImage, this, &ChatForm::sendImage); |
|
|
|
|
connect(statusMessageLabel, &CroppingLabel::customContextMenuRequested, this, |
|
|
|
|
[&](const QPoint& pos) { |
|
|
|
|
if (!statusMessageLabel->text().isEmpty()) { |
|
|
|
@ -783,19 +784,19 @@ void ChatForm::doScreenshot()
@@ -783,19 +784,19 @@ void ChatForm::doScreenshot()
|
|
|
|
|
{ |
|
|
|
|
// note: grabber is self-managed and will destroy itself when done
|
|
|
|
|
ScreenshotGrabber* grabber = new ScreenshotGrabber; |
|
|
|
|
connect(grabber, &ScreenshotGrabber::screenshotTaken, this, &ChatForm::onScreenshotTaken); |
|
|
|
|
connect(grabber, &ScreenshotGrabber::screenshotTaken, this, &ChatForm::sendImage); |
|
|
|
|
grabber->showGrabber(); |
|
|
|
|
// Create dir for screenshots
|
|
|
|
|
QDir(Settings::getInstance().getAppDataDirPath()).mkpath("screenshots"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void ChatForm::onScreenshotTaken(const QPixmap& pixmap) |
|
|
|
|
void ChatForm::sendImage(const QPixmap& pixmap) |
|
|
|
|
{ |
|
|
|
|
QDir(Settings::getInstance().getAppDataDirPath()).mkpath("images"); |
|
|
|
|
|
|
|
|
|
// use ~ISO 8601 for screenshot timestamp, considering FS limitations
|
|
|
|
|
// https://en.wikipedia.org/wiki/ISO_8601
|
|
|
|
|
// Windows has to be supported, thus filename can't have `:` in it :/
|
|
|
|
|
// Format should be: `qTox_Screenshot_yyyy-MM-dd HH-mm-ss.zzz.png`
|
|
|
|
|
QString filepath = QString("%1screenshots%2qTox_Screenshot_%3.png") |
|
|
|
|
QString filepath = QString("%1images%2qTox_Image_%3.png") |
|
|
|
|
.arg(Settings::getInstance().getAppDataDirPath()) |
|
|
|
|
.arg(QDir::separator()) |
|
|
|
|
.arg(QDateTime::currentDateTime().toString("yyyy-MM-dd HH-mm-ss.zzz")); |
|
|
|
|