-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/notify when screenshot being taken (#286)
* Notify when screenshot is being taken
- Loading branch information
Showing
6 changed files
with
75 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#include "screenapi.h" | ||
#include "notificationapi.h" | ||
|
||
QDBusObjectPath ScreenAPI::screenshot(){ | ||
if(!hasPermission("screen")){ | ||
return QDBusObjectPath("/"); | ||
} | ||
qDebug() << "Taking screenshot"; | ||
auto filePath = getNextPath(); | ||
#ifdef DEBUG | ||
qDebug() << "Using path" << filePath; | ||
#endif | ||
QImage screen = copy(); | ||
QRect rect = notificationAPI->paintNotification("Taking Screenshot...", ""); | ||
EPFrameBuffer::sendUpdate(rect, EPFrameBuffer::Mono, EPFrameBuffer::PartialUpdate, true); | ||
QDBusObjectPath path("/"); | ||
if(!screen.save(filePath)){ | ||
qDebug() << "Failed to take screenshot"; | ||
}else{ | ||
path = addScreenshot(filePath)->qPath(); | ||
} | ||
QPainter painter(EPFrameBuffer::framebuffer()); | ||
painter.drawImage(rect, screen, rect); | ||
painter.end(); | ||
EPFrameBuffer::sendUpdate(rect, EPFrameBuffer::HighQualityGrayscale, EPFrameBuffer::PartialUpdate, true); | ||
return path; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters