2 * Copyright (C) 2014-2016 Canonical Ltd.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18import ScreenshotDirectory 0.1
21 Captures an image of the given item and saves it in a screenshots directory.
22 It also displays a flash visual effect and camera shutter sound, as feedback
23 to the user to hint that a screenshot was taken.
32 id: screenshotDirectory
33 objectName: "screenGrabber"
38 source: "/usr/share/sounds/lomiri/camera/click/camera_click.ogg"
41 function capture(item) {
49 NumberAnimation on opacity {
65 NumberAnimation on opacity {
71 d.target.grabToImage(function(result)
73 var fileName = screenshotDirectory.makeFileName();
74 if (fileName.length === 0) {
75 console.warn("ItemGrabber: No fileName to save image to");
77 console.log("ItemGrabber: Saving image to " + fileName);
78 result.saveToFile(fileName);