Changeset View
Changeset View
Standalone View
Standalone View
effects/screenshot/screenshot.h
Show First 20 Lines • Show All 80 Lines • ▼ Show 20 Line(s) | 56 | public Q_SLOTS: | |||
---|---|---|---|---|---|
81 | /** | 81 | /** | ||
82 | * Saves a screenshot of all screen into a file and returns the path to the file. | 82 | * Saves a screenshot of all screen into a file and returns the path to the file. | ||
83 | * Functionality requires hardware support, if not available a null string is returned. | 83 | * Functionality requires hardware support, if not available a null string is returned. | ||
84 | * @param captureCursor Whether to include the cursor in the image | 84 | * @param captureCursor Whether to include the cursor in the image | ||
85 | * @returns Path to stored screenshot, or null string in failure case. | 85 | * @returns Path to stored screenshot, or null string in failure case. | ||
86 | **/ | 86 | **/ | ||
87 | Q_SCRIPTABLE QString screenshotFullscreen(bool captureCursor = false); | 87 | Q_SCRIPTABLE QString screenshotFullscreen(bool captureCursor = false); | ||
88 | /** | 88 | /** | ||
89 | * Starts an interactive screenshot session. | ||||
90 | * | ||||
91 | * The user is asked to confirm that a screenshot is taken by having to actively | ||||
92 | * click and giving the possibility to cancel. | ||||
93 | * | ||||
94 | * Once the screenshot is taken it gets saved into the @p fd passed to the | ||||
95 | * method. It is intended to be used with a pipe, so that the invoking side can just | ||||
96 | * read from the pipe. The image gets written into the fd using a QDataStream. | ||||
97 | * | ||||
98 | * @param fd File descriptor into which the screenshot should be saved | ||||
99 | * @param captureCursor Whether to include the mouse cursor | ||||
100 | **/ | ||||
101 | Q_SCRIPTABLE void screenshotFullscreen(QDBusUnixFileDescriptor fd, bool captureCursor = false); | ||||
102 | /** | ||||
89 | * Saves a screenshot of the screen identified by @p screen into a file and returns the path to the file. | 103 | * Saves a screenshot of the screen identified by @p screen into a file and returns the path to the file. | ||
90 | * Functionality requires hardware support, if not available a null string is returned. | 104 | * Functionality requires hardware support, if not available a null string is returned. | ||
91 | * @param screen Number of screen as numbered by QDesktopWidget | 105 | * @param screen Number of screen as numbered by QDesktopWidget | ||
92 | * @param captureCursor Whether to include the cursor in the image | 106 | * @param captureCursor Whether to include the cursor in the image | ||
93 | * @returns Path to stored screenshot, or null string in failure case. | 107 | * @returns Path to stored screenshot, or null string in failure case. | ||
94 | **/ | 108 | **/ | ||
95 | Q_SCRIPTABLE QString screenshotScreen(int screen, bool captureCursor = false); | 109 | Q_SCRIPTABLE QString screenshotScreen(int screen, bool captureCursor = false); | ||
96 | /** | 110 | /** | ||
111 | * Starts an interactive screenshot of a screen session. | ||||
112 | * | ||||
113 | * The user is asked to select the screen to screenshot. | ||||
114 | * | ||||
115 | * Once the screenshot is taken it gets saved into the @p fd passed to the | ||||
116 | * method. It is intended to be used with a pipe, so that the invoking side can just | ||||
117 | * read from the pipe. The image gets written into the fd using a QDataStream. | ||||
118 | * | ||||
119 | * @param fd File descriptor into which the screenshot should be saved | ||||
120 | * @param captureCursor Whether to include the mouse cursor | ||||
121 | **/ | ||||
122 | Q_SCRIPTABLE void screenshotScreen(QDBusUnixFileDescriptor fd, bool captureCursor = false); | ||||
123 | /** | ||||
97 | * Saves a screenshot of the selected geometry into a file and returns the path to the file. | 124 | * Saves a screenshot of the selected geometry into a file and returns the path to the file. | ||
98 | * Functionality requires hardware support, if not available a null string is returned. | 125 | * Functionality requires hardware support, if not available a null string is returned. | ||
99 | * @param x Left upper x coord of region | 126 | * @param x Left upper x coord of region | ||
100 | * @param y Left upper y coord of region | 127 | * @param y Left upper y coord of region | ||
101 | * @param width Width of the region to screenshot | 128 | * @param width Width of the region to screenshot | ||
102 | * @param height Height of the region to screenshot | 129 | * @param height Height of the region to screenshot | ||
103 | * @param captureCursor Whether to include the cursor in the image | 130 | * @param captureCursor Whether to include the cursor in the image | ||
104 | * @returns Path to stored screenshot, or null string in failure case. | 131 | * @returns Path to stored screenshot, or null string in failure case. | ||
105 | **/ | 132 | **/ | ||
106 | Q_SCRIPTABLE QString screenshotArea(int x, int y, int width, int height, bool captureCursor = false); | 133 | Q_SCRIPTABLE QString screenshotArea(int x, int y, int width, int height, bool captureCursor = false); | ||
107 | 134 | | |||
108 | Q_SIGNALS: | 135 | Q_SIGNALS: | ||
109 | Q_SCRIPTABLE void screenshotCreated(qulonglong handle); | 136 | Q_SCRIPTABLE void screenshotCreated(qulonglong handle); | ||
110 | 137 | | |||
111 | private Q_SLOTS: | 138 | private Q_SLOTS: | ||
112 | void windowClosed( KWin::EffectWindow* w ); | 139 | void windowClosed( KWin::EffectWindow* w ); | ||
113 | 140 | | |||
114 | private: | 141 | private: | ||
115 | void grabPointerImage(QImage& snapshot, int offsetx, int offsety); | 142 | void grabPointerImage(QImage& snapshot, int offsetx, int offsety); | ||
116 | QImage blitScreenshot(const QRect &geometry); | 143 | QImage blitScreenshot(const QRect &geometry); | ||
117 | QString saveTempImage(const QImage &img); | 144 | QString saveTempImage(const QImage &img); | ||
118 | void sendReplyImage(const QImage &img); | 145 | void sendReplyImage(const QImage &img); | ||
119 | void showInfoMessage(); | 146 | enum class InfoMessageMode { | ||
147 | Window, | ||||
148 | Screen | ||||
149 | }; | ||||
150 | void showInfoMessage(InfoMessageMode mode); | ||||
120 | void hideInfoMessage(); | 151 | void hideInfoMessage(); | ||
121 | EffectWindow *m_scheduledScreenshot; | 152 | EffectWindow *m_scheduledScreenshot; | ||
122 | ScreenShotType m_type; | 153 | ScreenShotType m_type; | ||
123 | QRect m_scheduledGeometry; | 154 | QRect m_scheduledGeometry; | ||
124 | QDBusConnection m_replyConnection; | 155 | QDBusConnection m_replyConnection; | ||
125 | QDBusMessage m_replyMessage; | 156 | QDBusMessage m_replyMessage; | ||
126 | QRect m_cachedOutputGeometry; | 157 | QRect m_cachedOutputGeometry; | ||
127 | QImage m_multipleOutputsImage; | 158 | QImage m_multipleOutputsImage; | ||
Show All 16 Lines |