Merge lp:~elementary-apps/eidete/fix-for-freya into lp:eidete
- fix-for-freya
- Merge into trunk
Proposed by
Tom Beckmann
Status: | Merged | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Approved by: | PerfectCarl | ||||||||||||||||
Approved revision: | 207 | ||||||||||||||||
Merged at revision: | 176 | ||||||||||||||||
Proposed branch: | lp:~elementary-apps/eidete/fix-for-freya | ||||||||||||||||
Merge into: | lp:eidete | ||||||||||||||||
Diff against target: |
1635 lines (+700/-415) 9 files modified
CMakeLists.txt (+32/-8) README (+22/-0) po/eidete.pot (+87/-72) src/Widgets/end_dialog.vala (+192/-76) src/Widgets/keyview.vala (+177/-167) src/Widgets/selectionarea.vala (+14/-11) src/eidete.vala (+136/-67) src/keycapture.c (+6/-0) src/videobin_uploader.vala (+34/-14) |
||||||||||||||||
To merge this branch: | bzr merge lp:~elementary-apps/eidete/fix-for-freya | ||||||||||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PerfectCarl (community) | Approve | ||
Review via email:
|
Commit message
Make eidete work for elementary freya:
- port it to gstreamer 1.0
- fix contractors
- fix video-bin (though videobin.org doesn't support webm files anymore)
- update styling
- update pot
- fix misc issues
Note: the project is still compatible with gstreamer 0.10 and luna (see makefile for more info)
Description of the change
Make eidete work for elementary freya: fixing issues and port it to gstreamer 1.0.
The project is still compatible with gstreamer 0.10 (see makefile for more info)
(this is a more public (in terms of access rights) copy of the original 314 compatibility branch)
To post a comment you must log in.
- 205. By Tom Beckmann
-
fix a bunch of compiler warnings
- 206. By PerfectCarl
-
Fix the pause windows
- 207. By PerfectCarl
-
Fix size issues
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'CMakeLists.txt' |
2 | --- CMakeLists.txt 2014-05-29 17:06:50 +0000 |
3 | +++ CMakeLists.txt 2015-01-04 16:20:24 +0000 |
4 | @@ -16,20 +16,44 @@ |
5 | set (PKGDATADIR "${DATADIR}/eidete") |
6 | set (GETTEXT_PACKAGE "eidete") |
7 | set (RELEASE_NAME "Feature rich and functional.") |
8 | -set (VERSION "0.1") |
9 | +set (VERSION "0.2") |
10 | set (VERSION_INFO "Release") |
11 | set (CMAKE_C_FLAGS "-ggdb") |
12 | set (PREFIX ${CMAKE_INSTALL_PREFIX}) |
13 | set (DOLLAR "$") |
14 | |
15 | +# Comment this out to enable C compiler warnings |
16 | +add_definitions (-w) |
17 | + |
18 | list (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) |
19 | |
20 | +# Building for GStreamer 1.0 by default |
21 | +# Uncomment the following line to build for GStreamer 0.10 |
22 | +# set (USE_GSTREAMER_0_10 "TRUE") |
23 | + |
24 | +if(DEFINED USE_GSTREAMER_0_10) |
25 | + message ("-- Building eidete for GStreamer 0.10") |
26 | + set(EXTRA_DEFINITIONS -DGSTREAMER_0_10_IS_DEFINED) |
27 | + add_definitions(${EXTRA_DEFINITIONS}) |
28 | + set(GST_PACKAGES gstreamer-interfaces-0.10 gstreamer-0.10 gstreamer-pbutils-0.10) |
29 | +else () |
30 | + message ("-- Building eidete for GStreamer 1.0") |
31 | + set(GST_PACKAGES gstreamer-1.0 gstreamer-pbutils-1.0) |
32 | +endif () |
33 | + |
34 | configure_file (${CMAKE_SOURCE_DIR}/src/Config.vala.cmake ${CMAKE_BINARY_DIR}/src/Config.vala) |
35 | -add_definitions(-DGETTEXT_PACKAGE=\"${GETTEXT_PACKAGE}\" -DWNCK_I_KNOW_THIS_IS_UNSTABLE `pkg-config --cflags --libs gstreamer-interfaces-0.10`) |
36 | +add_definitions(-DGETTEXT_PACKAGE=\"${GETTEXT_PACKAGE}\" -DWNCK_I_KNOW_THIS_IS_UNSTABLE) |
37 | |
38 | find_package(PkgConfig) |
39 | -pkg_check_modules(DEPS REQUIRED gtk+-3.0>=3.10 libwnck-3.0 gstreamer-interfaces-0.10 gstreamer-0.10 gstreamer-pbutils-0.10 granite xtst gdk-x11-3.0 x11) |
40 | +pkg_check_modules(DEPS REQUIRED gtk+-3.0>=3.10 |
41 | + libwnck-3.0 |
42 | + granite |
43 | + xtst |
44 | + gdk-x11-3.0 |
45 | + x11 |
46 | + ${GST_PACKAGES}) |
47 | |
48 | +# TEST |
49 | add_definitions(${DEPS_CFLAGS}) |
50 | |
51 | link_libraries(${DEPS_LIBRARIES}) |
52 | @@ -40,6 +64,7 @@ |
53 | ensure_vala_version("0.16.0" MINIMUM) |
54 | |
55 | include(ValaPrecompile) |
56 | + |
57 | vala_precompile(VALA_C |
58 | src/eidete.vala |
59 | src/Widgets/countdown.vala |
60 | @@ -51,15 +76,14 @@ |
61 | PACKAGES |
62 | granite |
63 | gtk+-3.0 |
64 | - gstreamer-0.10 |
65 | - gstreamer-pbutils-0.10 |
66 | - gstreamer-interfaces-0.10 |
67 | + ${GST_PACKAGES} |
68 | libwnck-3.0 |
69 | gdk-x11-3.0 |
70 | OPTIONS |
71 | - -X -lXtst |
72 | + --enable-experimental |
73 | --thread |
74 | --vapidir=${CMAKE_CURRENT_SOURCE_DIR}/vapi/ |
75 | + ${EXTRA_DEFINITIONS} |
76 | ) |
77 | |
78 | vala_precompile(VALA_C_VIDEOBIN |
79 | @@ -79,4 +103,4 @@ |
80 | install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/eidete.desktop DESTINATION share/applications) |
81 | install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/eidete.svg DESTINATION share/icons/hicolor/48x48/apps) |
82 | install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/videobin.svg DESTINATION share/icons/hicolor/48x48/apps) |
83 | -install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/videobin.contract DESTINATION ${CMAKE_INSTALL_PREFIX}/share/contractor) |
84 | \ No newline at end of file |
85 | +install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/videobin.contract DESTINATION ${CMAKE_INSTALL_PREFIX}/share/contractor) |
86 | |
87 | === added file 'README' |
88 | --- README 1970-01-01 00:00:00 +0000 |
89 | +++ README 2015-01-04 16:20:24 +0000 |
90 | @@ -0,0 +1,22 @@ |
91 | +## Introduction |
92 | + |
93 | +A simple screencasting app for the elementary project |
94 | + |
95 | +Current Features |
96 | +- encoding to webm |
97 | +- selection of the area to be recorded |
98 | +- display of the pressed keys |
99 | +- audio recording |
100 | + |
101 | +For more information go to: https://launchpad.net/eidete |
102 | + |
103 | +## How to build |
104 | +Install dependencies |
105 | + sudo apt-get build-dep eidete |
106 | +OR |
107 | + sudo apt-get build-dep granite-demo |
108 | + sudo apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev |
109 | + |
110 | + mkdir build && cd build |
111 | + cmake -DCMAKE_INSTALL_PREFIX=/usr ../ |
112 | + make |
113 | |
114 | === modified file 'po/eidete.pot' |
115 | --- po/eidete.pot 2013-05-17 20:02:58 +0000 |
116 | +++ po/eidete.pot 2015-01-04 16:20:24 +0000 |
117 | @@ -8,7 +8,7 @@ |
118 | msgstr "" |
119 | "Project-Id-Version: PACKAGE VERSION\n" |
120 | "Report-Msgid-Bugs-To: \n" |
121 | -"POT-Creation-Date: 2013-05-17 23:02+0300\n" |
122 | +"POT-Creation-Date: 2015-01-04 12:47+0100\n" |
123 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
124 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
125 | "Language-Team: LANGUAGE <LL@li.org>\n" |
126 | @@ -17,183 +17,198 @@ |
127 | "Content-Type: text/plain; charset=CHARSET\n" |
128 | "Content-Transfer-Encoding: 8bit\n" |
129 | |
130 | -#: /home/kristjan/translations/po/../src/desktop_launcher.vala:5 |
131 | -msgid "Record screencasts" |
132 | -msgstr "" |
133 | - |
134 | -#: /home/kristjan/translations/po/../src/desktop_launcher.vala:6 |
135 | -msgid "Screencaster" |
136 | -msgstr "" |
137 | - |
138 | -#: /home/kristjan/translations/po/../src/videobin_uploader.vala:45 |
139 | -msgid "Upload" |
140 | -msgstr "" |
141 | - |
142 | -#: /home/kristjan/translations/po/../src/savedialog.vala:8 |
143 | -#: /home/kristjan/translations/po/../src/Widgets/end_dialog.vala:28 |
144 | -#: /home/kristjan/translations/po/../src/Widgets/end_dialog.vala:64 |
145 | -#: /home/kristjan/translations/po/../src/Widgets/end_dialog.vala:100 |
146 | -msgid "Save" |
147 | -msgstr "" |
148 | - |
149 | -#: /home/kristjan/translations/po/../src/eidete.vala:138 |
150 | +#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:140 |
151 | msgid "Monitor" |
152 | msgstr "" |
153 | |
154 | -#: /home/kristjan/translations/po/../src/eidete.vala:158 |
155 | +#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:160 |
156 | msgid "Fullscreen" |
157 | msgstr "" |
158 | |
159 | -#: /home/kristjan/translations/po/../src/eidete.vala:159 |
160 | +#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:161 |
161 | msgid "Custom" |
162 | msgstr "" |
163 | |
164 | -#: /home/kristjan/translations/po/../src/eidete.vala:170 |
165 | +#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:172 |
166 | msgid "Default" |
167 | msgstr "" |
168 | |
169 | -#: /home/kristjan/translations/po/../src/eidete.vala:179 |
170 | +#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:181 |
171 | msgid "Sound" |
172 | msgstr "" |
173 | |
174 | -#: /home/kristjan/translations/po/../src/eidete.vala:182 |
175 | +#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:184 |
176 | msgid "Video" |
177 | msgstr "" |
178 | |
179 | -#: /home/kristjan/translations/po/../src/eidete.vala:185 |
180 | +#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:187 |
181 | msgid "Keyboard" |
182 | msgstr "" |
183 | |
184 | -#: /home/kristjan/translations/po/../src/eidete.vala:188 |
185 | +#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:190 |
186 | msgid "Mouse" |
187 | msgstr "" |
188 | |
189 | -#: /home/kristjan/translations/po/../src/eidete.vala:191 |
190 | +#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:193 |
191 | msgid "Start Recording" |
192 | msgstr "" |
193 | |
194 | -#: /home/kristjan/translations/po/../src/eidete.vala:197 |
195 | +#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:199 |
196 | msgid "About" |
197 | msgstr "" |
198 | |
199 | -#: /home/kristjan/translations/po/../src/eidete.vala:210 |
200 | +#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:212 |
201 | msgid "Record Computer Sounds" |
202 | msgstr "" |
203 | |
204 | -#: /home/kristjan/translations/po/../src/eidete.vala:212 |
205 | +#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:214 |
206 | msgid "Record from Microphone" |
207 | msgstr "" |
208 | |
209 | -#: /home/kristjan/translations/po/../src/eidete.vala:215 |
210 | +#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:217 |
211 | msgid "Record from Monitor" |
212 | msgstr "" |
213 | |
214 | -#: /home/kristjan/translations/po/../src/eidete.vala:217 |
215 | +#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:219 |
216 | msgid "Recording Area" |
217 | msgstr "" |
218 | |
219 | -#: /home/kristjan/translations/po/../src/eidete.vala:219 |
220 | +#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:221 |
221 | msgid "Width" |
222 | msgstr "" |
223 | |
224 | -#: /home/kristjan/translations/po/../src/eidete.vala:221 |
225 | +#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:223 |
226 | msgid "Height" |
227 | msgstr "" |
228 | |
229 | -#: /home/kristjan/translations/po/../src/eidete.vala:245 |
230 | +#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:247 |
231 | msgid "Pressed keys on screen" |
232 | msgstr "" |
233 | |
234 | -#: /home/kristjan/translations/po/../src/eidete.vala:248 |
235 | +#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:250 |
236 | msgid "Mouse clicks on screen" |
237 | msgstr "" |
238 | |
239 | -#: /home/kristjan/translations/po/../src/eidete.vala:250 |
240 | +#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:252 |
241 | msgid "Circle around the cursor" |
242 | msgstr "" |
243 | |
244 | -#: /home/kristjan/translations/po/../src/eidete.vala:256 |
245 | +#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:258 |
246 | msgid "Behavior" |
247 | msgstr "" |
248 | |
249 | -#: /home/kristjan/translations/po/../src/eidete.vala:257 |
250 | +#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:259 |
251 | msgid "Appearance" |
252 | msgstr "" |
253 | |
254 | -#: /home/kristjan/translations/po/../src/eidete.vala:449 |
255 | -#: /home/kristjan/translations/po/../src/eidete.vala:456 |
256 | -#: /home/kristjan/translations/po/../src/eidete.vala:641 |
257 | +#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:461 |
258 | +#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:682 |
259 | msgid "Recording paused" |
260 | msgstr "" |
261 | |
262 | -#: /home/kristjan/translations/po/../src/eidete.vala:459 |
263 | +#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:464 |
264 | msgid "You can continue or finish the recording now" |
265 | msgstr "" |
266 | |
267 | -#: /home/kristjan/translations/po/../src/eidete.vala:468 |
268 | +#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:473 |
269 | msgid "Continue" |
270 | msgstr "" |
271 | |
272 | -#: /home/kristjan/translations/po/../src/eidete.vala:469 |
273 | +#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:474 |
274 | msgid "Continue recording" |
275 | msgstr "" |
276 | |
277 | -#: /home/kristjan/translations/po/../src/eidete.vala:472 |
278 | +#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:477 |
279 | msgid "Finish" |
280 | msgstr "" |
281 | |
282 | -#: /home/kristjan/translations/po/../src/eidete.vala:473 |
283 | +#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:478 |
284 | msgid "Stop the recording and save the file" |
285 | msgstr "" |
286 | |
287 | -#: /home/kristjan/translations/po/../src/eidete.vala:476 |
288 | +#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:481 |
289 | +#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/Widgets/end_dialog.vala:50 |
290 | msgid "Cancel" |
291 | msgstr "" |
292 | |
293 | -#: /home/kristjan/translations/po/../src/eidete.vala:477 |
294 | +#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:482 |
295 | msgid "Cancel the recording without saving the file" |
296 | msgstr "" |
297 | |
298 | -#: /home/kristjan/translations/po/../src/eidete.vala:651 |
299 | +#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:690 |
300 | msgid "Pause recording" |
301 | msgstr "" |
302 | |
303 | -#: /home/kristjan/translations/po/../src/eidete.vala:671 |
304 | +#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:719 |
305 | msgid "Pause Recording" |
306 | msgstr "" |
307 | |
308 | -#: /home/kristjan/translations/po/../src/eidete.vala:672 |
309 | +#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:720 |
310 | msgid "Finish Recording" |
311 | msgstr "" |
312 | |
313 | -#: /home/kristjan/translations/po/../src/Widgets/end_dialog.vala:24 |
314 | +#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/desktop_launcher.vala:5 |
315 | +msgid "Record screencasts" |
316 | +msgstr "" |
317 | + |
318 | +#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/desktop_launcher.vala:6 |
319 | +msgid "Screencaster" |
320 | +msgstr "" |
321 | + |
322 | +#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/Widgets/end_dialog.vala:40 |
323 | msgid "Recording complete" |
324 | msgstr "" |
325 | |
326 | -#: /home/kristjan/translations/po/../src/Widgets/end_dialog.vala:33 |
327 | -msgid "Don't save" |
328 | -msgstr "" |
329 | - |
330 | -#: /home/kristjan/translations/po/../src/Widgets/end_dialog.vala:62 |
331 | -msgid "Could not contact Contractor. Click the Save button to save the file." |
332 | -msgstr "" |
333 | - |
334 | -#: /home/kristjan/translations/po/../src/Widgets/keyview.vala:48 |
335 | +#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/Widgets/end_dialog.vala:44 |
336 | +#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/Widgets/end_dialog.vala:107 |
337 | +#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/Widgets/end_dialog.vala:146 |
338 | +#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/Widgets/end_dialog.vala:226 |
339 | +msgid "Save" |
340 | +msgstr "" |
341 | + |
342 | +#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/Widgets/end_dialog.vala:144 |
343 | +#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/Widgets/end_dialog.vala:224 |
344 | +msgid "Could not contact Contractor." |
345 | +msgstr "" |
346 | + |
347 | +#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/Widgets/end_dialog.vala:214 |
348 | +msgid "Save file" |
349 | +msgstr "" |
350 | + |
351 | +#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/Widgets/end_dialog.vala:216 |
352 | +msgid "Execute" |
353 | +msgstr "" |
354 | + |
355 | +#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/Widgets/countdown.vala:27 |
356 | +msgid "Recording starts in" |
357 | +msgstr "" |
358 | + |
359 | +#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/Widgets/countdown.vala:34 |
360 | +msgid "Focus Eidete to stop recording" |
361 | +msgstr "" |
362 | + |
363 | +#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/Widgets/keyview.vala:48 |
364 | msgid "Left" |
365 | msgstr "" |
366 | |
367 | -#: /home/kristjan/translations/po/../src/Widgets/keyview.vala:51 |
368 | +#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/Widgets/keyview.vala:51 |
369 | msgid "Middle" |
370 | msgstr "" |
371 | |
372 | -#: /home/kristjan/translations/po/../src/Widgets/keyview.vala:54 |
373 | +#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/Widgets/keyview.vala:54 |
374 | msgid "Right" |
375 | msgstr "" |
376 | |
377 | -#: /home/kristjan/translations/po/../src/Widgets/countdown.vala:27 |
378 | -msgid "Recording starts in" |
379 | -msgstr "" |
380 | - |
381 | -#: /home/kristjan/translations/po/../src/Widgets/countdown.vala:34 |
382 | -msgid "Focus Eidete to stop recording" |
383 | +#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/videobin_uploader.vala:41 |
384 | +#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/videobin_uploader.vala:43 |
385 | +#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/videobin_uploader.vala:45 |
386 | +msgid "Optional" |
387 | +msgstr "" |
388 | + |
389 | +#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/videobin_uploader.vala:48 |
390 | +msgid "Upload" |
391 | +msgstr "" |
392 | + |
393 | +#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/videobin_uploader.vala:57 |
394 | +msgid "Your email address for relocating your videos" |
395 | msgstr "" |
396 | |
397 | === modified file 'src/Widgets/end_dialog.vala' |
398 | --- src/Widgets/end_dialog.vala 2013-05-15 15:57:25 +0000 |
399 | +++ src/Widgets/end_dialog.vala 2015-01-04 16:20:24 +0000 |
400 | @@ -1,122 +1,238 @@ |
401 | using Gtk; |
402 | |
403 | - |
404 | namespace Eidete.Widgets { |
405 | |
406 | - private bool contractor; |
407 | + public class EndDialog : Dialog { |
408 | |
409 | - public class EndDialog : Window { |
410 | + private bool contractor; |
411 | + |
412 | + private EideteApp app ; |
413 | + private Button export ; |
414 | + private Grid grid; |
415 | + private ListStore list ; |
416 | + private TreeView treeview ; |
417 | + private File source ; |
418 | + |
419 | public EndDialog (EideteApp app){ |
420 | - this.set_default_size (400, 200); |
421 | + this.app = app ; |
422 | + //build_ui () ; |
423 | + this.window_position = WindowPosition.CENTER_ON_PARENT; |
424 | + } |
425 | |
426 | + private void build_ui () { |
427 | + this.get_header_bar ().get_style_context ().remove_class ("header-bar"); |
428 | + this.set_default_size (600, 600); |
429 | this.set_application (app); |
430 | - |
431 | + |
432 | if (app.selectionarea != null) |
433 | - app.selectionarea.destroy (); |
434 | + app.selectionarea.destroy (); |
435 | if (app.keyview != null) |
436 | - app.keyview.destroy (); |
437 | - this.window_position = WindowPosition.CENTER; |
438 | + app.keyview.destroy (); |
439 | + |
440 | this.icon_name = "eidete"; |
441 | |
442 | - var grid = new Grid (); |
443 | + grid = new Grid (); |
444 | grid.margin = 12; |
445 | |
446 | + var content = (Gtk.Box) this.get_content_area () ; |
447 | var title = new Label ("<span size='30000'>"+_("Recording complete")+"</span>"); |
448 | title.use_markup = true; |
449 | title.halign = Align.START; |
450 | |
451 | - var export = new Button.with_label (_("Save")); |
452 | + export = new Button.with_label (_("Save")); |
453 | export.image = new Image.from_stock (Stock.SAVE, IconSize.BUTTON); |
454 | export.can_default = true; |
455 | + export.get_style_context ().add_class ("suggested-action"); |
456 | this.set_default (export); |
457 | |
458 | - var cancel = new Button.with_label (_("Don't save")); |
459 | + var cancel = new Button.with_label (_("Cancel")); |
460 | cancel.image = new Image.from_stock (Stock.DELETE, IconSize.BUTTON); |
461 | - cancel.halign = Align.END; |
462 | + cancel.margin_end = 6; |
463 | |
464 | var bbox = new ButtonBox (Orientation.HORIZONTAL); |
465 | + bbox.homogeneous = true; |
466 | bbox.pack_end (cancel, false, true, 0); |
467 | bbox.pack_end (export, false, true, 0); |
468 | bbox.layout_style = ButtonBoxStyle.END; |
469 | |
470 | - //contractor |
471 | - var list = new ListStore (2, typeof (Gdk.Pixbuf), typeof (string)); |
472 | - var t = new TreeView.with_model (list); |
473 | - t.headers_visible = false; |
474 | - t.hexpand = true; |
475 | + |
476 | + list = new ListStore (2, typeof (Gdk.Pixbuf), typeof (string)); |
477 | + treeview = new TreeView.with_model (list); |
478 | + treeview.headers_visible = false; |
479 | + treeview.hexpand = true; |
480 | + treeview.set_activate_on_single_click (false) ; |
481 | + treeview.row_activated.connect ( on_contract_executed) ; |
482 | |
483 | var cell1 = new CellRendererPixbuf (); |
484 | cell1.set_padding (5, 15); |
485 | - t.insert_column_with_attributes (-1, "", cell1, "pixbuf", 0); |
486 | + treeview.insert_column_with_attributes (-1, "", cell1, "pixbuf", 0); |
487 | var cell2 = new CellRendererText (); |
488 | cell2.set_padding (2, 15); |
489 | - t.insert_column_with_attributes (-1, "", cell2, "markup", 1); |
490 | - |
491 | - |
492 | - var c = Granite.Services.Contractor.get_contract (app.settings.destination, "video"); |
493 | - if (c == null || c.length <= 1){ |
494 | - warning ("You should install and/or run contractor"); |
495 | - contractor = false; |
496 | - var info = new InfoBar (); |
497 | - info.message_type = MessageType.WARNING; |
498 | - info.pack_start (new Label (_("Could not contact Contractor. Click the Save button to save the file."))); |
499 | - grid.attach (info, 0, 3, 2, 1); |
500 | - export.label = _("Save"); |
501 | - }else{ |
502 | - contractor = true; |
503 | - for (var i=0;i<c.length; i++){ |
504 | - TreeIter it; |
505 | - list.append (out it); |
506 | - Gdk.Pixbuf icon = null; |
507 | - try{ |
508 | - icon = IconTheme.get_default ().load_icon (c[i].lookup ("IconName"), 32, 0); |
509 | - }catch (Error e){warning (e.message);} |
510 | - list.set (it, 0, icon, 1, |
511 | - "<b>"+c[i].lookup ("Name")+"</b>\n"+c[i].lookup ("Description")); |
512 | - } |
513 | - t.set_cursor (new TreePath.from_string ("0"), null, false); |
514 | - } |
515 | - |
516 | + treeview.insert_column_with_attributes (-1, "", cell2, "markup", 1); |
517 | + |
518 | + //contractor |
519 | + load_contracts () ; |
520 | + |
521 | + var scrolled = new Gtk.ScrolledWindow (null, null); |
522 | + scrolled.vexpand = true; |
523 | + scrolled.add (treeview); |
524 | + |
525 | grid.attach (title, 0, 0, 2, 1); |
526 | grid.attach (new Label (""), 0, 2, 1, 1); |
527 | - grid.attach (t, 0, 4, 1, 1); |
528 | + grid.attach (scrolled, 0, 4, 1, 1); |
529 | grid.attach (new Label (""), 0, 5, 1, 1); |
530 | grid.attach (bbox, 0, 6, 1, 1); |
531 | - |
532 | + source = File.new_for_path (app.settings.destination); |
533 | + |
534 | if (contractor){ |
535 | - export.clicked.connect ( () => { |
536 | - TreePath path; |
537 | - t.get_cursor (out path, null); |
538 | - try{ |
539 | - Process.spawn_command_line_async (c[int.parse (path.to_string ())].lookup ("Exec")); |
540 | - }catch (Error e){ |
541 | - print(e.message); |
542 | - } |
543 | - this.destroy (); |
544 | - }); |
545 | + export.clicked.connect (on_contract_executed) ; |
546 | } else { |
547 | - export.clicked.connect ( () => { |
548 | - var source = File.new_for_path (app.settings.destination); |
549 | - var file = new FileChooserDialog (_("Save"), null, FileChooserAction.SAVE, Stock.OK, ResponseType.OK); |
550 | - file.set_current_name (source.get_basename ()); |
551 | - file.do_overwrite_confirmation = true; |
552 | - var res = file.run (); |
553 | - if (res == ResponseType.OK){ |
554 | - var destination = File.new_for_path (file.get_filename ()); |
555 | - try{ |
556 | - source.copy (destination, FileCopyFlags.OVERWRITE); |
557 | - }catch (GLib.Error e){stderr.printf ("Error: %s\n", e.message);} |
558 | - |
559 | - file.destroy (); |
560 | - this.destroy (); |
561 | - }else{ |
562 | - file.destroy (); |
563 | - } |
564 | - }); |
565 | + export.clicked.connect ( () => { |
566 | + save_file () ; |
567 | + this.destroy (); |
568 | + }); |
569 | } |
570 | cancel.clicked.connect ( () => {this.destroy ();}); |
571 | |
572 | - this.add (grid); |
573 | + content.add (grid); |
574 | + } |
575 | + |
576 | + public void display () { |
577 | + build_ui () ; |
578 | + show_all () ; |
579 | + } |
580 | + |
581 | + private void on_contract_executed () { |
582 | + TreePath path; |
583 | + treeview.get_cursor (out path, null); |
584 | + int index = int.parse (path.to_string ()) ; |
585 | + execute_command (index) ; |
586 | + this.destroy (); |
587 | + } |
588 | + |
589 | + private void save_file () { |
590 | + var dialog = new FileChooserDialog (_("Save"), null, FileChooserAction.SAVE, Stock.OK, ResponseType.OK); |
591 | + dialog.set_current_name (source.get_basename ()); |
592 | + var videos_folder = Environment.get_user_special_dir(UserDirectory.VIDEOS); |
593 | + dialog.set_current_folder (videos_folder); |
594 | + dialog.do_overwrite_confirmation = true; |
595 | + var res = dialog.run (); |
596 | + if (res == ResponseType.OK){ |
597 | + var destination = File.new_for_path (dialog.get_filename ()); |
598 | + try{ |
599 | + source.copy (destination, FileCopyFlags.OVERWRITE); |
600 | + }catch (GLib.Error e){ |
601 | + stderr.printf ("Error: %s\n", e.message); |
602 | + } |
603 | + } |
604 | + dialog.destroy (); |
605 | + } |
606 | + // Using deprecated Contractor API. Necesserary to maintain luna compatibility |
607 | +#if false |
608 | + private void execute_command_deprecated (int index) { |
609 | + string cmd = contracts_dep[index].lookup ("Exec") ; |
610 | + try{ |
611 | + Process.spawn_command_line_async (cmd); |
612 | + }catch (Error e){ |
613 | + print(e.message); |
614 | + } |
615 | + } |
616 | + |
617 | + private HashTable<string,string>[] contracts_dep ; |
618 | + |
619 | + private void load_contracts_deprecated () { |
620 | + // CARL deprecated Contractor API |
621 | + contracts_dep = Granite.Services.Contractor.get_contract (app.settings.destination, "video"); |
622 | + if (contracts_dep == null || contracts_dep.length <= 1){ |
623 | + warning ("You should install and/or run contractor"); |
624 | + contractor = false; |
625 | + var info = new InfoBar (); |
626 | + info.message_type = MessageType.WARNING; |
627 | + info.pack_start (new Label (_("Could not contact Contractor."))); |
628 | + grid.attach (info, 0, 3, 2, 1); |
629 | + export.label = _("Save"); |
630 | + }else{ |
631 | + contractor = true; |
632 | + for (var i=0;i<contracts_dep.length; i++){ |
633 | + TreeIter it; |
634 | + list.append (out it); |
635 | + Gdk.Pixbuf icon = null; |
636 | + try{ |
637 | + icon = IconTheme.get_default ().load_icon (contracts_dep[i].lookup ("IconName"), 32, 0); |
638 | + }catch (Error e){ |
639 | + warning (e.message); |
640 | + } |
641 | + list.set (it, 0, icon, 1, |
642 | + "<b>"+contracts_dep[i].lookup ("Name")+"</b>\n"+contracts_dep[i].lookup ("Description")); |
643 | + } |
644 | + treeview.set_cursor (new TreePath.from_string ("0"), null, false); |
645 | + } |
646 | + } |
647 | +#endif |
648 | + private Gee.List<Granite.Services.Contract> contracts ; |
649 | + private int contracts_size = 0 ; |
650 | + |
651 | + private void execute_command (int index) { |
652 | + if( index == 0) |
653 | + save_file () ; |
654 | + else { |
655 | + var contract = contracts.@get (index-1) ; |
656 | + try{ |
657 | + contract.execute_with_file (source) ; |
658 | + }catch (Error e){ |
659 | + warning (e.message); |
660 | + } |
661 | + } |
662 | + |
663 | + } |
664 | + |
665 | + private void load_contracts () { |
666 | + contracts_size = 0 ; |
667 | + try{ |
668 | + contracts = Granite.Services.ContractorProxy.get_contracts_by_mime ("video"); |
669 | + }catch (Error e){ |
670 | + warning (e.message); |
671 | + } |
672 | + if (contracts != null){ |
673 | + |
674 | + contractor = true; |
675 | + foreach( var contract in contracts ) { |
676 | + TreeIter it; |
677 | + list.append (out it); |
678 | + Gdk.Pixbuf icon = null; |
679 | + try{ |
680 | + icon = IconTheme.get_default ().load_icon (contract.get_icon ().to_string (), 32, 0); |
681 | + |
682 | + }catch (Error e){ |
683 | + warning (e.message); |
684 | + } |
685 | + list.set (it, 0, icon, 1, |
686 | + "<b>"+contract.get_display_name ()+"</b>\n"+contract.get_description ()); |
687 | + contracts_size ++ ; |
688 | + } |
689 | + TreeIter it; |
690 | + list.insert (out it, 0); |
691 | + Gdk.Pixbuf icon = null; |
692 | + try{ |
693 | + icon = IconTheme.get_default ().load_icon ("document-save", 32, 0); |
694 | + }catch (Error e){ |
695 | + warning (e.message); |
696 | + } |
697 | + list.set (it, 0, icon, 1, |
698 | + "<b>"+_("Save file")+"</b>\n"+("Save the file onto a disk")); |
699 | + treeview.set_cursor (new TreePath.from_string ("0"), null, false); |
700 | + export.label = _("Execute"); |
701 | + } |
702 | + if( contracts_size == 0 ) |
703 | + { |
704 | + warning ("You should install and/or run contractor"); |
705 | + contractor = false; |
706 | + var info = new InfoBar (); |
707 | + info.message_type = MessageType.WARNING; |
708 | + info.pack_start (new Label (_("Could not contact Contractor."))); |
709 | + grid.attach (info, 0, 3, 2, 1); |
710 | + export.label = _("Save"); |
711 | + } |
712 | } |
713 | } |
714 | } |
715 | |
716 | === modified file 'src/Widgets/keyview.vala' |
717 | --- src/Widgets/keyview.vala 2013-05-17 01:00:15 +0000 |
718 | +++ src/Widgets/keyview.vala 2015-01-04 16:20:24 +0000 |
719 | @@ -243,7 +243,10 @@ |
720 | if (mouse_circle) { |
721 | this.circle = new YellowCircle (mouse_circle_color); |
722 | this.captured_move.connect ( (x, y) => { |
723 | - this.circle.move (x, y); |
724 | + Idle.add (() => { |
725 | + this.circle.move (x, y); |
726 | + return false; |
727 | + }); |
728 | //debug ("Moved to %i, %i\n", x, y); |
729 | }); |
730 | } |
731 | @@ -257,175 +260,182 @@ |
732 | |
733 | if (keyboard) |
734 | this.captured.connect ( (keyvalue, released) => { |
735 | - if (released){ |
736 | - switch (keyvalue){ |
737 | - case "Control_L": |
738 | - case "Control_R": |
739 | - this.ctrl = false; |
740 | - this.queue_draw (); |
741 | - break; |
742 | - case "Shift_L": |
743 | - case "Shift_R": |
744 | - this.shift = false; |
745 | - this.queue_draw (); |
746 | - break; |
747 | - case "Alt_L": |
748 | - case "Alt_R": |
749 | - this.alt = false; |
750 | - this.queue_draw (); |
751 | - break; |
752 | - case "Super_L": |
753 | - case "Super_R": |
754 | - this.super = false; |
755 | - this.queue_draw (); |
756 | - return; |
757 | - case "ISO_Level3_Shift": |
758 | - this.iso_level3_shift = false; |
759 | - this.queue_draw (); |
760 | - return; |
761 | - } |
762 | - }else{ |
763 | - string res = keyvalue; |
764 | - switch (res){ |
765 | - case "Control_L": |
766 | - case "Control_R": |
767 | - this.ctrl = true; |
768 | - this.queue_draw (); |
769 | - return; |
770 | - case "Shift_L": |
771 | - case "Shift_R": |
772 | - this.shift = true; |
773 | - this.queue_draw (); |
774 | - return; |
775 | - case "Alt_L": |
776 | - case "Alt_R": |
777 | - this.alt = true; |
778 | - this.queue_draw (); |
779 | - return; |
780 | - case "Super_L": |
781 | - case "Super_R": |
782 | - this.super = true; |
783 | - this.queue_draw (); |
784 | - return; |
785 | - case "ISO_Level3_Shift": |
786 | - this.iso_level3_shift = true; |
787 | - this.queue_draw (); |
788 | - return; |
789 | - case "Escape": |
790 | - res = "Esc"; break; |
791 | - case "Return": |
792 | - res = "⏎"; break; |
793 | - case "Delete": |
794 | - res = "Del"; break; |
795 | - case "Insert": |
796 | - res = "Ins"; break; |
797 | - case "comma": |
798 | - res = ","; break; |
799 | - case "period": |
800 | - res = "."; break; |
801 | - case "minus": |
802 | - res = "-"; break; |
803 | - case "plus": |
804 | - res = "+"; break; |
805 | - case "Tab": |
806 | - res = "Tab"; break; |
807 | - case "BackSpace": |
808 | - res = "⌫"; break; |
809 | - case "Left": |
810 | - res = "◄"; break; |
811 | - case "Right": |
812 | - res = "►"; break; |
813 | - case "Up": |
814 | - res = "▲"; break; |
815 | - case "Down": |
816 | - res = "▼"; break; |
817 | - case "space": |
818 | - res = " "; break; |
819 | - case "backslash": |
820 | - res = "\\"; break; |
821 | - case "bracketleft": |
822 | - res = "["; break; |
823 | - case "bracketright": |
824 | - res = "]"; break; |
825 | - case "braceleft": |
826 | - res = "{"; break; |
827 | - case "braceright": |
828 | - res = "}"; break; |
829 | - case "apostrophe": |
830 | - res = "'"; break; |
831 | - case "asciitilde": |
832 | - res = "~"; break; |
833 | - case "grave": |
834 | - res = "`"; break; |
835 | - case "bar": |
836 | - res = "|"; break; |
837 | - case "ampersand": |
838 | - res = "&"; break; |
839 | - case "parenleft": |
840 | - res = "("; break; |
841 | - case "parenright": |
842 | - res = ")"; break; |
843 | - case "less": |
844 | - res = "<"; break; |
845 | - case "greater": |
846 | - res = ">"; break; |
847 | - case "equal": |
848 | - res = "="; break; |
849 | - case "exclam": |
850 | - res = "!"; break; |
851 | - case "quotedbl": |
852 | - res = "\""; break; |
853 | - case "numbersign": |
854 | - res = "\""; break; |
855 | - case "dollar": |
856 | - res = "$"; break; |
857 | - case "slash": |
858 | - res = "/"; break; |
859 | - case "asterisk": |
860 | - res = "*"; break; |
861 | - case "colon": |
862 | - res = ":"; break; |
863 | - case "semicolon": |
864 | - res = ";"; break; |
865 | - case "underscore": |
866 | - res = "_"; break; |
867 | - case "Next": |
868 | - res = "Pg▲"; break; |
869 | - case "Prior": |
870 | - res = "Pg▼"; break; |
871 | - case "asciicircum": |
872 | - res = "^"; break; |
873 | - case "at": |
874 | - res = "@"; break; |
875 | - case "question": |
876 | - res = "?"; break; |
877 | - default: |
878 | - if (keyvalue.length > 9) |
879 | - res = keyvalue.substring (0, 9); |
880 | - break; |
881 | - } |
882 | - |
883 | - if ((!keys.is_empty ()) && |
884 | - (keys.peek_head ().key == res) && |
885 | - (keys.peek_head ().ctrl == ctrl) && |
886 | - (keys.peek_head ().shift == shift) && |
887 | - (keys.peek_head ().alt == alt) && |
888 | - (keys.peek_head ().iso_level3_shift == iso_level3_shift)){ |
889 | - keys.peek_head ().count ++; |
890 | - this.queue_draw (); |
891 | - }else{ |
892 | - var key = new Key (res, ctrl, shift, alt, super, iso_level3_shift); |
893 | - if (!released){ |
894 | - keys.push_head (key); |
895 | - if (keys.length+2 > (screen_h / key_size)) |
896 | - keys.pop_tail (); |
897 | - this.queue_draw (); |
898 | - } |
899 | - } |
900 | - } |
901 | + Idle.add (() => { |
902 | + handle_key_event (keyvalue, released); |
903 | + return false; |
904 | + }); |
905 | }); |
906 | } |
907 | |
908 | + void handle_key_event (string keyvalue, bool released) { |
909 | + if (released){ |
910 | + switch (keyvalue){ |
911 | + case "Control_L": |
912 | + case "Control_R": |
913 | + this.ctrl = false; |
914 | + this.queue_draw (); |
915 | + break; |
916 | + case "Shift_L": |
917 | + case "Shift_R": |
918 | + this.shift = false; |
919 | + this.queue_draw (); |
920 | + break; |
921 | + case "Alt_L": |
922 | + case "Alt_R": |
923 | + this.alt = false; |
924 | + this.queue_draw (); |
925 | + break; |
926 | + case "Super_L": |
927 | + case "Super_R": |
928 | + this.super = false; |
929 | + this.queue_draw (); |
930 | + return; |
931 | + case "ISO_Level3_Shift": |
932 | + this.iso_level3_shift = false; |
933 | + this.queue_draw (); |
934 | + return; |
935 | + } |
936 | + }else{ |
937 | + string res = keyvalue; |
938 | + switch (res){ |
939 | + case "Control_L": |
940 | + case "Control_R": |
941 | + this.ctrl = true; |
942 | + this.queue_draw (); |
943 | + return; |
944 | + case "Shift_L": |
945 | + case "Shift_R": |
946 | + this.shift = true; |
947 | + this.queue_draw (); |
948 | + return; |
949 | + case "Alt_L": |
950 | + case "Alt_R": |
951 | + this.alt = true; |
952 | + this.queue_draw (); |
953 | + return; |
954 | + case "Super_L": |
955 | + case "Super_R": |
956 | + this.super = true; |
957 | + this.queue_draw (); |
958 | + return; |
959 | + case "ISO_Level3_Shift": |
960 | + this.iso_level3_shift = true; |
961 | + this.queue_draw (); |
962 | + return; |
963 | + case "Escape": |
964 | + res = "Esc"; break; |
965 | + case "Return": |
966 | + res = "⏎"; break; |
967 | + case "Delete": |
968 | + res = "Del"; break; |
969 | + case "Insert": |
970 | + res = "Ins"; break; |
971 | + case "comma": |
972 | + res = ","; break; |
973 | + case "period": |
974 | + res = "."; break; |
975 | + case "minus": |
976 | + res = "-"; break; |
977 | + case "plus": |
978 | + res = "+"; break; |
979 | + case "Tab": |
980 | + res = "Tab"; break; |
981 | + case "BackSpace": |
982 | + res = "⌫"; break; |
983 | + case "Left": |
984 | + res = "◄"; break; |
985 | + case "Right": |
986 | + res = "►"; break; |
987 | + case "Up": |
988 | + res = "▲"; break; |
989 | + case "Down": |
990 | + res = "▼"; break; |
991 | + case "space": |
992 | + res = " "; break; |
993 | + case "backslash": |
994 | + res = "\\"; break; |
995 | + case "bracketleft": |
996 | + res = "["; break; |
997 | + case "bracketright": |
998 | + res = "]"; break; |
999 | + case "braceleft": |
1000 | + res = "{"; break; |
1001 | + case "braceright": |
1002 | + res = "}"; break; |
1003 | + case "apostrophe": |
1004 | + res = "'"; break; |
1005 | + case "asciitilde": |
1006 | + res = "~"; break; |
1007 | + case "grave": |
1008 | + res = "`"; break; |
1009 | + case "bar": |
1010 | + res = "|"; break; |
1011 | + case "ampersand": |
1012 | + res = "&"; break; |
1013 | + case "parenleft": |
1014 | + res = "("; break; |
1015 | + case "parenright": |
1016 | + res = ")"; break; |
1017 | + case "less": |
1018 | + res = "<"; break; |
1019 | + case "greater": |
1020 | + res = ">"; break; |
1021 | + case "equal": |
1022 | + res = "="; break; |
1023 | + case "exclam": |
1024 | + res = "!"; break; |
1025 | + case "quotedbl": |
1026 | + res = "\""; break; |
1027 | + case "numbersign": |
1028 | + res = "\""; break; |
1029 | + case "dollar": |
1030 | + res = "$"; break; |
1031 | + case "slash": |
1032 | + res = "/"; break; |
1033 | + case "asterisk": |
1034 | + res = "*"; break; |
1035 | + case "colon": |
1036 | + res = ":"; break; |
1037 | + case "semicolon": |
1038 | + res = ";"; break; |
1039 | + case "underscore": |
1040 | + res = "_"; break; |
1041 | + case "Next": |
1042 | + res = "Pg▲"; break; |
1043 | + case "Prior": |
1044 | + res = "Pg▼"; break; |
1045 | + case "asciicircum": |
1046 | + res = "^"; break; |
1047 | + case "at": |
1048 | + res = "@"; break; |
1049 | + case "question": |
1050 | + res = "?"; break; |
1051 | + default: |
1052 | + if (keyvalue.length > 9) |
1053 | + res = keyvalue.substring (0, 9); |
1054 | + break; |
1055 | + } |
1056 | + |
1057 | + if ((!keys.is_empty ()) && |
1058 | + (keys.peek_head ().key == res) && |
1059 | + (keys.peek_head ().ctrl == ctrl) && |
1060 | + (keys.peek_head ().shift == shift) && |
1061 | + (keys.peek_head ().alt == alt) && |
1062 | + (keys.peek_head ().iso_level3_shift == iso_level3_shift)){ |
1063 | + keys.peek_head ().count ++; |
1064 | + this.queue_draw (); |
1065 | + }else{ |
1066 | + var key = new Key (res, ctrl, shift, alt, super, iso_level3_shift); |
1067 | + if (!released){ |
1068 | + keys.push_head (key); |
1069 | + if (keys.length+2 > (screen_h / key_size)) |
1070 | + keys.pop_tail (); |
1071 | + this.queue_draw (); |
1072 | + } |
1073 | + } |
1074 | + } |
1075 | + } |
1076 | + |
1077 | public void capture (){ |
1078 | try{ |
1079 | Thread.create<void*> (this.intercept_key_thread, true); |
1080 | |
1081 | === modified file 'src/Widgets/selectionarea.vala' |
1082 | --- src/Widgets/selectionarea.vala 2012-04-04 00:02:38 +0000 |
1083 | +++ src/Widgets/selectionarea.vala 2015-01-04 16:20:24 +0000 |
1084 | @@ -42,38 +42,41 @@ |
1085 | }); |
1086 | |
1087 | this.configure_event.connect ((e) => { |
1088 | + var screen_width = Gdk.Screen.width (); |
1089 | + var screen_height = Gdk.Screen.height (); |
1090 | + |
1091 | // check if coordinates are out of the screen and check |
1092 | // if coordinate + width/height is out of the screen, then |
1093 | // adjust coordinates to keep width and height (and aspect |
1094 | // ratio) intact |
1095 | - if( e.x < 0 || e.x > e.window.get_screen().width() ) { |
1096 | + if( e.x < 0 || e.x > screen_width ) { |
1097 | x = 0; |
1098 | - } else if( e.x + e.width > e.window.get_screen().width() |
1099 | - && e.width < e.window.get_screen().width() ) { |
1100 | - x = e.window.get_screen().width() - e.width; |
1101 | + } else if( e.x + e.width > screen_width |
1102 | + && e.width < screen_width ) { |
1103 | + x = screen_width - e.width; |
1104 | } else { |
1105 | x = e.x; |
1106 | } |
1107 | |
1108 | if( e.y < 0 ) { |
1109 | y = 0; |
1110 | - } else if( e.y + e.height >= e.window.get_screen().height() |
1111 | - && e.height < e.window.get_screen().height() ) { |
1112 | - y = e.window.get_screen().height() - e.height - 1; |
1113 | + } else if( e.y + e.height >= screen_height |
1114 | + && e.height < screen_height ) { |
1115 | + y = screen_height - e.height - 1; |
1116 | } else { |
1117 | y = e.y; |
1118 | } |
1119 | |
1120 | // just in case an edge is still outside of the screen |
1121 | // we'll modify the width/height if thats the case |
1122 | - if( x + e.width > e.window.get_screen().width() ) { |
1123 | - w = e.window.get_screen().width() - x; |
1124 | + if( x + e.width > screen_width ) { |
1125 | + w = screen_width - x; |
1126 | } else { |
1127 | w = e.width; |
1128 | } |
1129 | |
1130 | - if( y + e.height > e.window.get_screen().height() ) { |
1131 | - h = e.window.get_screen().height() - y; |
1132 | + if( y + e.height > screen_height ) { |
1133 | + h = screen_height - y; |
1134 | } else { |
1135 | h = e.height; |
1136 | } |
1137 | |
1138 | === modified file 'src/eidete.vala' |
1139 | --- src/eidete.vala 2014-05-29 17:08:23 +0000 |
1140 | +++ src/eidete.vala 2015-01-04 16:20:24 +0000 |
1141 | @@ -1,4 +1,3 @@ |
1142 | -//valac --pkg gtk+-3.0 --pkg gstreamer-0.10 --pkg gstreamer-pbutils-0.10 --pkg granite screencast.vala |
1143 | |
1144 | using Gst; |
1145 | using Granite; |
1146 | @@ -81,9 +80,10 @@ |
1147 | public Window main_window; |
1148 | public Eidete.Widgets.KeyView keyview; |
1149 | public Eidete.Widgets.SelectionArea selectionarea; |
1150 | - public Granite.Widgets.StaticNotebook tabs; |
1151 | - public Grid pause_grid; |
1152 | - public Image pause_icon; |
1153 | + private Gtk.Stack tabs; |
1154 | + private Grid pause_grid; |
1155 | + private Gtk.Grid main_box ; |
1156 | + private Gtk.StackSwitcher stack_switcher ; |
1157 | public Wnck.Window win; |
1158 | public Gdk.Screen screen; |
1159 | public Gdk.Rectangle monitor_rec; |
1160 | @@ -93,8 +93,8 @@ |
1161 | public bool recording; |
1162 | public bool typing_size; |
1163 | |
1164 | - public Gst.Bin videobin; |
1165 | - public Gst.Bin audiobin; |
1166 | + public Gst.Bin videobin; |
1167 | + public Gst.Bin audiobin; |
1168 | |
1169 | public EideteApp (){ |
1170 | } |
1171 | @@ -125,12 +125,7 @@ |
1172 | UI |
1173 | */ |
1174 | |
1175 | - tabs = new Granite.Widgets.StaticNotebook (false); |
1176 | - tabs.margin = 12; |
1177 | - |
1178 | - pause_icon = new Image.from_icon_name ("media-playback-pause", IconSize.DIALOG); |
1179 | - pause_icon.pixel_size = 64; |
1180 | - |
1181 | + tabs = new Gtk.Stack (); |
1182 | |
1183 | var grid = new Grid (); |
1184 | grid.column_spacing = 12; |
1185 | @@ -140,6 +135,7 @@ |
1186 | var monitors_combo = new ComboBoxText (); |
1187 | monitors_combo.hexpand = true; |
1188 | for (var i=0;i<Gdk.Screen.get_default ().get_n_monitors (); i++) |
1189 | + // TODO proper translation here |
1190 | monitors_combo.append (i.to_string (), _("Monitor")+" "+(i+1).to_string ()); |
1191 | monitors_combo.active = 0; |
1192 | if (Gdk.Screen.get_default ().get_n_monitors () == 1) |
1193 | @@ -148,12 +144,10 @@ |
1194 | var width = new SpinButton.with_range (50, Gdk.Screen.get_default ().get_width (), 1); |
1195 | width.max_length = 4; |
1196 | width.margin_left = 1; |
1197 | - width.margin_right = -4; |
1198 | |
1199 | var height = new SpinButton.with_range (50, Gdk.Screen.get_default ().get_height (), 1); |
1200 | height.max_length = 4; |
1201 | height.margin_left = 1; |
1202 | - height.margin_right = -4; |
1203 | width.set_sensitive (false); |
1204 | height.set_sensitive (false); |
1205 | width.halign = Align.START; |
1206 | @@ -181,23 +175,24 @@ |
1207 | audio_box.pack_start (use_audio, false, true, 0); |
1208 | audio_box.pack_start (audio_source, true, true, 0); |
1209 | |
1210 | - var sound = new LLabel.markup ("<b>"+_("Sound")+":"+"</b>"); |
1211 | + var sound = new LLabel.markup ("<b>"+_("Sound")+"</b>"); |
1212 | sound.margin_top = 18; |
1213 | |
1214 | - var video = new LLabel.markup ("<b>"+_("Video")+":"+"</b>"); |
1215 | + var video = new LLabel.markup ("<b>"+_("Video")+"</b>"); |
1216 | video.margin_top = 12; |
1217 | |
1218 | - var keyboard = new LLabel.markup ("<b>"+_("Keyboard")+":"+"</b>"); |
1219 | + var keyboard = new LLabel.markup ("<b>"+_("Keyboard")+"</b>"); |
1220 | keyboard.margin_top = 18; |
1221 | |
1222 | - var mouse = new LLabel.markup ("<b>"+_("Mouse")+":"+"</b>"); |
1223 | + var mouse = new LLabel.markup ("<b>"+_("Mouse")+"</b>"); |
1224 | mouse.margin_top = 12; |
1225 | |
1226 | var start_bt = new Button.with_label (_("Start Recording")); |
1227 | start_bt.can_default = true; |
1228 | start_bt.get_style_context ().add_class ("noundo"); |
1229 | - |
1230 | - var cancel_bt = new Button.from_stock (Stock.CANCEL); |
1231 | + start_bt.get_style_context ().add_class ("suggested-action"); |
1232 | + |
1233 | + var cancel_bt = new Button.with_label (_("Cancel")); |
1234 | |
1235 | var about_bt = new Button.with_label (_("About")); |
1236 | about_bt.image = new Image.from_stock (Stock.ABOUT, IconSize.BUTTON); |
1237 | @@ -212,7 +207,7 @@ |
1238 | this.main_window.set_default (start_bt); |
1239 | |
1240 | grid.attach ((sound), 0, 0, 1, 1); |
1241 | - grid.attach (new LLabel.right (_("Record Computer Sounds")), 0, 1, 1, 1); |
1242 | + grid.attach (new LLabel.right (_("Record Computer Sounds")+":"), 0, 1, 1, 1); |
1243 | grid.attach (use_comp_sounds, 1, 1, 1, 1); |
1244 | grid.attach (new LLabel.right (_("Record from Microphone")+":"), 0, 2, 1, 1); |
1245 | grid.attach (audio_box, 1, 2, 1, 1); |
1246 | @@ -258,10 +253,24 @@ |
1247 | grid2.row_spacing = 6; |
1248 | grid2.hexpand = true; |
1249 | |
1250 | - tabs.append_page (grid, new Label (_("Behavior"))); |
1251 | - tabs.append_page (grid2, new Label (_("Appearance"))); |
1252 | - |
1253 | - this.main_window.add (tabs); |
1254 | + tabs.add_titled (grid, "behavior", _("Behavior")); |
1255 | + tabs.add_titled (grid2, "apperance", _("Appearance")); |
1256 | + |
1257 | + main_box = new Gtk.Grid (); |
1258 | + stack_switcher = new Gtk.StackSwitcher (); |
1259 | + stack_switcher.stack = tabs; |
1260 | + stack_switcher.halign = Gtk.Align.CENTER; |
1261 | + build_pause_ui () ; |
1262 | + pause_grid.show_all(); |
1263 | + pause_grid.hide(); |
1264 | + pause_grid.no_show_all = true; |
1265 | + main_box.attach (stack_switcher, 0, 0, 1, 1); |
1266 | + main_box.attach (tabs, 0, 1, 1, 1); |
1267 | + main_box.attach (pause_grid, 0, 2, 1, 1); |
1268 | + main_box.margin = 12; |
1269 | + |
1270 | + this.main_window.add (main_box); |
1271 | + |
1272 | this.main_window.show_all (); |
1273 | this.main_window.present (); |
1274 | |
1275 | @@ -353,11 +362,7 @@ |
1276 | settings.audio = false; |
1277 | use_audio.toggled.connect ( () => { |
1278 | settings.audio = use_audio.active; |
1279 | - if (use_audio.active){ |
1280 | - audio_source.set_sensitive (true); |
1281 | - }else{ |
1282 | - audio_source.set_sensitive (false); |
1283 | - } |
1284 | + audio_source.set_sensitive (use_audio.active); |
1285 | }); |
1286 | |
1287 | |
1288 | @@ -433,6 +438,12 @@ |
1289 | |
1290 | Granite.Services.Logger.initialize ("Eidete"); |
1291 | Granite.Services.Logger.DisplayLevel = Granite.Services.LogLevel.DEBUG; |
1292 | + uint major ; |
1293 | + uint minor ; |
1294 | + uint micro ; |
1295 | + uint nano ; |
1296 | + Gst.version (out major, out minor, out micro, out nano) ; |
1297 | + message ("GStreamer version: %u.%u.%u.%u", major, minor, micro, nano ) ; |
1298 | } |
1299 | |
1300 | public override void activate (){ |
1301 | @@ -451,7 +462,7 @@ |
1302 | |
1303 | pause_grid = new Grid (); |
1304 | pause_grid.margin = 12; |
1305 | - this.main_window.title = _("Recording paused"); |
1306 | + //this.main_window.title = _("Recording paused"); |
1307 | |
1308 | |
1309 | var img_text_grid = new Grid (); |
1310 | @@ -477,6 +488,7 @@ |
1311 | var stop_bt = new Button.with_label (_("Finish")); |
1312 | stop_bt.set_tooltip_text (_("Stop the recording and save the file")); |
1313 | stop_bt.image = new Image.from_stock (Stock.APPLY, IconSize.BUTTON); |
1314 | + stop_bt.get_style_context ().add_class ("suggested-action"); |
1315 | |
1316 | var cancel_bt = new Button.with_label (_("Cancel")); |
1317 | cancel_bt.set_tooltip_text (_("Cancel the recording without saving the file")); |
1318 | @@ -539,15 +551,25 @@ |
1319 | } |
1320 | |
1321 | pipeline = new Pipeline ("screencast-pipe"); |
1322 | + |
1323 | + #if GSTREAMER_0_10_IS_DEFINED |
1324 | dynamic Element muxer = ElementFactory.make ("webmmux", "mux"); |
1325 | dynamic Element sink = ElementFactory.make ("filesink", "sink"); |
1326 | - |
1327 | + #else |
1328 | + var muxer = ElementFactory.make ("webmmux", "mux"); |
1329 | + var sink = ElementFactory.make ("filesink", "sink"); |
1330 | + #endif |
1331 | //video bin |
1332 | this.videobin = new Gst.Bin ("video"); |
1333 | try { |
1334 | - videobin = (Gst.Bin)parse_bin_from_description ( |
1335 | - "ximagesrc name=\"videosrc\" ! video/x-raw-rgb, framerate=15/1 ! |
1336 | - ffmpegcolorspace ! vp8enc name=\"encoder\" ! queue", true); |
1337 | + #if GSTREAMER_0_10_IS_DEFINED |
1338 | + videobin = (Gst.Bin)parse_bin_from_description ( |
1339 | + "ximagesrc name=\"videosrc\" ! video/x-raw-rgb, framerate=15/1 ! |
1340 | + ffmpegcolorspace ! vp8enc name=\"encoder\" ! queue", true); |
1341 | + #else |
1342 | + videobin = (Gst.Bin)parse_bin_from_description ( |
1343 | + "ximagesrc name=\"videosrc\" ! video/x-raw, framerate=24/1 ! videoconvert ! vp8enc name=\"encoder\" ! queue", true); |
1344 | + #endif |
1345 | }catch (Error e){ stderr.printf ("Error: %s\n", e.message);} |
1346 | |
1347 | //audio bin |
1348 | @@ -564,19 +586,32 @@ |
1349 | }catch (Error e){warning (e.message);} |
1350 | |
1351 | //configure |
1352 | + assert( sink != null ) ; |
1353 | sink.set ("location", settings.destination); |
1354 | - videobin.get_by_name ("videosrc").set ("startx", this.settings.sx); |
1355 | - videobin.get_by_name ("videosrc").set ("starty", this.settings.sy); |
1356 | - videobin.get_by_name ("videosrc").set ("endx", this.settings.ex); |
1357 | - videobin.get_by_name ("videosrc").set ("endy", this.settings.ey); |
1358 | - videobin.get_by_name ("videosrc").set ("use-damage", false); |
1359 | - videobin.get_by_name ("videosrc").set ("screen-num", this.settings.monitor); |
1360 | + var src = videobin.get_by_name ("videosrc") ; |
1361 | + assert (src != null) ; |
1362 | + src.set ("startx", this.settings.sx); |
1363 | + src.set ("starty", this.settings.sy); |
1364 | + src.set ("endx", this.settings.ex); |
1365 | + src.set ("endy", this.settings.ey); |
1366 | + src.set ("use-damage", false); |
1367 | + src.set ("screen-num", this.settings.monitor); |
1368 | |
1369 | //videobin.get_by_name ("encoder").set ("mode", 1); |
1370 | - videobin.get_by_name ("encoder").set ("quality", 8.0); |
1371 | - videobin.get_by_name ("encoder").set ("speed", 6); |
1372 | - videobin.get_by_name ("encoder").set ("max-keyframe-distance", 150); |
1373 | - videobin.get_by_name ("encoder").set ("threads", int.parse (cores.substring (2))); |
1374 | + var encoder = videobin.get_by_name ("encoder") ; |
1375 | + assert (encoder != null) ; |
1376 | + #if GSTREAMER_0_10_IS_DEFINED |
1377 | + encoder.set ("quality", 8.0); |
1378 | + encoder.set ("speed", 6); |
1379 | + encoder.set ("max-keyframe-distance", 150); |
1380 | + #else |
1381 | + // From these values see https://mail.gnome.org/archives/commits-list/2012-September/msg08183.html |
1382 | + encoder.set ("min_quantizer", 13); |
1383 | + encoder.set ("max_quantizer", 13); |
1384 | + encoder.set ("cpu-used", 5); |
1385 | + encoder.set ("deadline", 1000000); |
1386 | + #endif |
1387 | + encoder.set ("threads", int.parse (cores.substring (2))); |
1388 | |
1389 | |
1390 | if (pipeline==null||muxer==null||sink==null||videobin==null||audiobin==null){ |
1391 | @@ -589,14 +624,28 @@ |
1392 | pipeline.add_many (videobin, muxer, sink); |
1393 | |
1394 | |
1395 | - videobin.get_static_pad ("src").link(muxer.get_request_pad ("video_%d")); |
1396 | - if (settings.audio) |
1397 | - audiobin.get_static_pad ("src").link(muxer.get_request_pad ("audio_%d")); |
1398 | - |
1399 | + var video_pad = videobin.get_static_pad ("src") ; |
1400 | + assert (video_pad != null ) ; |
1401 | + #if GSTREAMER_0_10_IS_DEFINED |
1402 | + var m = muxer.get_request_pad ("video_%d") ; |
1403 | + #else |
1404 | + var m = muxer.get_request_pad ("video_%u") ; |
1405 | + #endif |
1406 | + assert (m != null ) ; |
1407 | + video_pad.link(m); |
1408 | + if (settings.audio){ |
1409 | + #if GSTREAMER_0_10_IS_DEFINED |
1410 | + audiobin.get_static_pad ("src").link (muxer.get_request_pad ("audio_%d")); |
1411 | + #else |
1412 | + audiobin.get_static_pad ("src").link (muxer.get_request_pad ("audio_%u")); |
1413 | + #endif |
1414 | + } |
1415 | muxer.link (sink); |
1416 | - |
1417 | - pipeline.get_bus ().add_watch (bus_message_cb); |
1418 | - |
1419 | + #if GSTREAMER_0_10_IS_DEFINED |
1420 | + pipeline.get_bus ().add_watch (bus_message_cb); |
1421 | + #else |
1422 | + pipeline.get_bus ().add_watch (Priority.DEFAULT, bus_message_cb); |
1423 | + #endif |
1424 | pipeline.set_state (State.READY); |
1425 | |
1426 | if (selectionarea != null) |
1427 | @@ -620,7 +669,10 @@ |
1428 | case Gst.MessageType.ERROR: |
1429 | GLib.Error err; string debug; |
1430 | msg.parse_error (out err, out debug); |
1431 | - stderr.printf ("Error: %s\n", err.message); |
1432 | + |
1433 | + display_error ("Eidete encountered a gstreamer error while recording, creating a screencast is not possible:\n%s\n\n[%s]" |
1434 | + .printf (err.message, debug), true); |
1435 | + stderr.printf ("Error: %s\n", debug); |
1436 | pipeline.set_state (State.NULL); |
1437 | break; |
1438 | case Gst.MessageType.EOS: |
1439 | @@ -629,7 +681,7 @@ |
1440 | this.recording = false; |
1441 | |
1442 | var end = new Eidete.Widgets.EndDialog (this); |
1443 | - end.show_all (); |
1444 | + end.display (); |
1445 | this.main_window.destroy (); |
1446 | |
1447 | break; |
1448 | @@ -644,26 +696,43 @@ |
1449 | |
1450 | if (to_normal){ |
1451 | this.main_window.title = _("Recording paused"); |
1452 | - this.main_window.remove (pause_icon); |
1453 | - if (pause_grid == null) |
1454 | - this.build_pause_ui (); |
1455 | - this.main_window.add (pause_grid); |
1456 | + tabs.hide () ; |
1457 | + stack_switcher.hide () ; |
1458 | + pause_grid.show () ; |
1459 | this.main_window.icon_name = "eidete"; |
1460 | this.app_icon = "eidete"; |
1461 | - this.main_window.show_all (); |
1462 | - this.main_window.resize (1, 1); |
1463 | + |
1464 | }else{ |
1465 | this.main_window.title = _("Pause recording"); |
1466 | - if (this.main_window.get_child () == tabs) |
1467 | - this.main_window.remove (tabs); |
1468 | - else |
1469 | - this.main_window.remove (pause_grid); |
1470 | - this.main_window.add (pause_icon); |
1471 | + if (tabs.visible) { |
1472 | + tabs.hide () ; |
1473 | + stack_switcher.hide () ; |
1474 | + pause_grid.show () ; |
1475 | + } |
1476 | this.main_window.icon_name = "media-playback-pause"; |
1477 | this.app_icon = "media-playback-pause"; |
1478 | - this.main_window.show_all (); |
1479 | + |
1480 | } |
1481 | } |
1482 | + |
1483 | + /** |
1484 | + * Displays an error dialog with the given message to the user |
1485 | + * |
1486 | + * @param error The message to display |
1487 | + * @param fatal Quit eidete after the user dismissed the dialog |
1488 | + */ |
1489 | + private void display_error (string error, bool fatal) { |
1490 | + var dialog = new Gtk.MessageDialog (main_window, Gtk.DialogFlags.MODAL, |
1491 | + Gtk.MessageType.ERROR, Gtk.ButtonsType.OK, error); |
1492 | + dialog.show_all (); |
1493 | + dialog.response.connect (() => { |
1494 | + dialog.destroy (); |
1495 | + |
1496 | + if (fatal) |
1497 | + main_window.destroy (); |
1498 | + }); |
1499 | + dialog.run (); |
1500 | + } |
1501 | } |
1502 | } |
1503 | |
1504 | @@ -692,4 +761,4 @@ |
1505 | eidete = new Eidete.EideteApp (); |
1506 | |
1507 | return eidete.run (args); |
1508 | -} |
1509 | \ No newline at end of file |
1510 | +} |
1511 | |
1512 | === modified file 'src/keycapture.c' |
1513 | --- src/keycapture.c 2012-04-04 00:02:38 +0000 |
1514 | +++ src/keycapture.c 2015-01-04 16:20:24 +0000 |
1515 | @@ -4,8 +4,12 @@ |
1516 | #include <X11/Xlib.h> |
1517 | #include <X11/XKBlib.h> |
1518 | #include <X11/extensions/record.h> //libxtst-dev, Xtst |
1519 | +#ifdef GSTREAMER_0_10_IS_DEFINED |
1520 | #include <gstreamer-0.10/gst/gst.h> |
1521 | #include <gstreamer-0.10/gst/gstinterface.h> |
1522 | +#else |
1523 | +#include <gstreamer-1.0/gst/gst.h> |
1524 | +#endif |
1525 | /* |
1526 | GList *list_devices (){ |
1527 | GstElement *pulsesrc = gst_element_factory_make ("pulsesrc", "src"); |
1528 | @@ -47,6 +51,8 @@ |
1529 | default: |
1530 | break; |
1531 | } |
1532 | + |
1533 | + XRecordFreeData (d); |
1534 | } |
1535 | |
1536 | void* intercept_key_thread (void *data) { |
1537 | |
1538 | === modified file 'src/videobin_uploader.vala' |
1539 | --- src/videobin_uploader.vala 2012-01-03 12:54:48 +0000 |
1540 | +++ src/videobin_uploader.vala 2015-01-04 16:20:24 +0000 |
1541 | @@ -27,7 +27,7 @@ |
1542 | } |
1543 | |
1544 | |
1545 | - public Uploader (string file){ |
1546 | + public Uploader (File file){ |
1547 | this.title = "Upload to videobin.org"; |
1548 | this.set_default_size (300, 1); |
1549 | this.window_position = WindowPosition.CENTER; |
1550 | @@ -38,21 +38,26 @@ |
1551 | grid.row_spacing = 5; |
1552 | |
1553 | var title = new Entry (); |
1554 | + title.placeholder_text = _("Optional") ; |
1555 | var description = new Entry (); |
1556 | + description.placeholder_text = _("Optional") ; |
1557 | var email = new Entry (); |
1558 | + email.placeholder_text = _("Optional") ; |
1559 | var img = new Image.from_icon_name ("videobin", IconSize.DIALOG); |
1560 | |
1561 | - var upload = new Button.with_label (_("Upload")); |
1562 | + var upload_button = new Button.with_label (_("Upload")); |
1563 | + upload_button.get_style_context ().add_class ("suggested-action"); |
1564 | var cancel = new Button.from_stock (Stock.CANCEL); |
1565 | + cancel.margin_end = 6; |
1566 | |
1567 | var bbox = new Box (Orientation.HORIZONTAL, 0); |
1568 | - bbox.pack_end (upload, false, true, 0); |
1569 | + bbox.pack_end (upload_button, false, true, 0); |
1570 | bbox.pack_end (cancel, false, true, 0); |
1571 | |
1572 | - email.set_tooltip_text ("Your email address for relocating your videos"); |
1573 | - upload.image = new Image.from_icon_name ("mail-reply-sender", IconSize.BUTTON); |
1574 | - upload.can_default = true; |
1575 | - this.set_default (upload); |
1576 | + email.set_tooltip_text (_("Your email address for relocating your videos")); |
1577 | + upload_button.image = new Image.from_icon_name ("mail-reply-sender", IconSize.BUTTON); |
1578 | + upload_button.can_default = true; |
1579 | + this.set_default (upload_button); |
1580 | |
1581 | grid.attach (img, 0, 0, 1, 2); |
1582 | grid.attach (new LLabel ("Title"), 1, 0, 1, 1); |
1583 | @@ -68,9 +73,12 @@ |
1584 | |
1585 | cancel.clicked.connect (Gtk.main_quit); |
1586 | |
1587 | - upload.clicked.connect ( () => { |
1588 | + upload_button.clicked.connect ( () => { |
1589 | string url; |
1590 | - string command = "curl -F\"api=1\" -F\"videoFile=@"+file+"\" "; |
1591 | + string path = file.get_path() ; |
1592 | + if( path.has_prefix ("'") && path.has_suffix ("'")) |
1593 | + path = path.substring (1, path.length-2) ; |
1594 | + string command = "curl -F\"api=1\" -F\"videoFile=@"+path+"\" "; |
1595 | if (email.text != "") |
1596 | command += "-F\"email="+email.text+"\" "; |
1597 | if (title.text != "") |
1598 | @@ -78,11 +86,15 @@ |
1599 | if (description.text != "") |
1600 | command += "-F\"description="+description.text+"\" "; |
1601 | command += "http://videobin.org/add"; |
1602 | - |
1603 | try{ |
1604 | Process.spawn_command_line_sync (command, out url); |
1605 | }catch (Error e){error (e.message);} |
1606 | try{ |
1607 | + if( url == null || url == "" ) |
1608 | + { |
1609 | + warning( "The upload has failed. Command: %s", command) ; |
1610 | + } |
1611 | + else |
1612 | Process.spawn_command_line_async ("sensible-browser "+url); |
1613 | }catch (Error e){error (e.message);} |
1614 | Gtk.main_quit (); |
1615 | @@ -93,9 +105,17 @@ |
1616 | |
1617 | public static void main (string [] args){ |
1618 | Gtk.init (ref args); |
1619 | - var file = File.new_for_uri (args[1]); |
1620 | - var u = new Uploader (file.get_path ()); |
1621 | - u.show_all (); |
1622 | - Gtk.main (); |
1623 | + if( args.length<=1) |
1624 | + { |
1625 | + warning ("You must provide a valid file path" ) ; |
1626 | + } |
1627 | + else |
1628 | + { |
1629 | + var path = args[1] ; |
1630 | + var file = File.new_for_path (path); |
1631 | + var dialog = new Uploader (file); |
1632 | + dialog.show_all (); |
1633 | + Gtk.main (); |
1634 | + } |
1635 | } |
1636 |
Approved