prefs.js 43 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184
  1. /*
  2. Copyright (C) 2013 Borsato Ivano
  3. The JavaScript code in this page is free software: you can
  4. redistribute it and/or modify it under the terms of the GNU
  5. General Public License (GNU GPL) as published by the Free Software
  6. Foundation, either version 3 of the License, or (at your option)
  7. any later version. The code is distributed WITHOUT ANY WARRANTY;
  8. without even the implied warranty of MERCHANTABILITY or FITNESS
  9. FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
  10. */
  11. 'use strict';
  12. import GIRepository from 'gi://GIRepository';
  13. GIRepository.Repository.prepend_search_path('/usr/lib64/gnome-shell');
  14. GIRepository.Repository.prepend_library_path('/usr/lib64/gnome-shell');
  15. import Adw from 'gi://Adw';
  16. import GObject from 'gi://GObject';
  17. import Gio from 'gi://Gio';
  18. import Gtk from 'gi://Gtk';
  19. import Gdk from 'gi://Gdk';
  20. import Pango from 'gi://Pango';
  21. import {ExtensionPreferences, gettext as _} from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js';
  22. import * as Lib from './convenience.js';
  23. import * as UtilWebcam from './utilwebcam.js';
  24. import * as UtilGSP from './utilgsp.js';
  25. import * as Settings from './settings.js';
  26. import * as UtilExeCmd from './utilexecmd.js';
  27. const EasyScreenCastSettingsWidget = GObject.registerClass({
  28. GTypeName: 'EasyScreenCast_SettingsWidget',
  29. }, class EasyScreenCastSettingsWidget extends Gtk.Box {
  30. /**
  31. * @param {ExtensionPreferences} prefs the prefs instance
  32. */
  33. constructor(prefs) {
  34. super();
  35. this._prefs = prefs;
  36. this._settings = new Settings.Settings(this._prefs.getSettings());
  37. Lib.setDebugEnabled(this._settings.getOption('b', Settings.VERBOSE_DEBUG_SETTING_KEY));
  38. this.CtrlExe = new UtilExeCmd.ExecuteStuff(this);
  39. this.CtrlWebcam = new UtilWebcam.HelperWebcam(_('Unspecified webcam'));
  40. let cssProvider = new Gtk.CssProvider();
  41. cssProvider.load_from_path(`${prefs.path}/prefs.css`);
  42. Gtk.StyleContext.add_provider_for_display(
  43. Gdk.Display.get_default(),
  44. cssProvider,
  45. Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
  46. // creates the ui builder and add the main resource file
  47. let uiFilePath = `${this._prefs.path}/Options_UI.glade`;
  48. let builder = new Gtk.Builder();
  49. builder.set_translation_domain(this._prefs.metadata['gettext-domain']);
  50. if (builder.add_from_file(uiFilePath) === 0) {
  51. Lib.TalkativeLog(`-^-could not load the ui file: ${uiFilePath}`);
  52. let label = new Gtk.Label({
  53. label: _('Could not load the preferences UI file'),
  54. vexpand: true,
  55. });
  56. this.append(label);
  57. } else {
  58. Lib.TalkativeLog(`-^-UI file receive and load: ${uiFilePath}`);
  59. // gets the interesting builder objects
  60. let refBoxMainContainer = builder.get_object('Main_Container');
  61. this.append(refBoxMainContainer);
  62. // setup tab options
  63. this._initTabOptions(this, builder, this._settings._settings);
  64. // setup tab quality
  65. this._initTabQuality(this, builder, this._settings._settings);
  66. // setup tab webcam
  67. this._initTabWebcam(this, builder, this._settings._settings);
  68. // setup tab file
  69. this._initTabFile(this, builder, this._settings._settings);
  70. // setup tab support
  71. this._initTabSupport(this, builder, this._settings._settings);
  72. // setup tab info
  73. this._initTabInfo(this, builder);
  74. // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  75. // update GSP area
  76. this._setStateGSP(
  77. !this._settings.getOption('b', Settings.ACTIVE_CUSTOM_GSP_SETTING_KEY)
  78. );
  79. // update list view
  80. this._updateRowShortcut(
  81. this._settings.getOption('as', Settings.SHORTCUT_KEY_SETTING_KEY)[0]
  82. );
  83. // update webcam widget state
  84. this._updateStateWebcamOptions();
  85. // connect keywebcam signal
  86. this._settings._settings.connect(
  87. `changed::${Settings.DEVICE_INDEX_WEBCAM_SETTING_KEY}`,
  88. () => {
  89. Lib.TalkativeLog('-^-webcam device changed');
  90. this._updateStateWebcamOptions();
  91. }
  92. );
  93. }
  94. }
  95. /**
  96. * @param {EasyScreenCastSettingsWidget} ctx the prefs/settings widget
  97. * @param {Gtk.Builder} gtkDB the builder that loaded the UI glade file
  98. * @param {Gio.Settings} tmpS the current settings
  99. * @private
  100. */
  101. _initTabOptions(ctx, gtkDB, tmpS) {
  102. // implements show timer option
  103. let refSwitchShowNotifyAlert = gtkDB.get_object('swt_ShowNotifyAlert');
  104. tmpS.bind(
  105. Settings.SHOW_NOTIFY_ALERT_SETTING_KEY,
  106. refSwitchShowNotifyAlert,
  107. 'active',
  108. Gio.SettingsBindFlags.DEFAULT
  109. );
  110. // implements show area option
  111. let refSwitchShowAreaRec = gtkDB.get_object('swt_ShowAreaRec');
  112. tmpS.bind(
  113. Settings.SHOW_AREA_REC_SETTING_KEY,
  114. refSwitchShowAreaRec,
  115. 'active',
  116. Gio.SettingsBindFlags.DEFAULT
  117. );
  118. // implements show indicator option
  119. let refComboboxIndicatorsRec = gtkDB.get_object('cbt_StatusIndicatorsRec');
  120. tmpS.bind(
  121. Settings.STATUS_INDICATORS_SETTING_KEY,
  122. refComboboxIndicatorsRec,
  123. 'active',
  124. Gio.SettingsBindFlags.DEFAULT
  125. );
  126. // implements draw cursor option
  127. let refSwitchDrawCursorRec = gtkDB.get_object('swt_DrawCursorRec');
  128. tmpS.bind(
  129. Settings.DRAW_CURSOR_SETTING_KEY,
  130. refSwitchDrawCursorRec,
  131. 'active',
  132. Gio.SettingsBindFlags.DEFAULT
  133. );
  134. // implements enable keybinding option
  135. let refSwitchEnableShortcut = gtkDB.get_object('swt_KeyShortcut');
  136. tmpS.bind(
  137. Settings.ACTIVE_SHORTCUT_SETTING_KEY,
  138. refSwitchEnableShortcut,
  139. 'active',
  140. Gio.SettingsBindFlags.DEFAULT
  141. );
  142. // implements selecting alternative key combo
  143. let refTreeviewShortcut = gtkDB.get_object('treeview_KeyShortcut');
  144. refTreeviewShortcut.set_sensitive(true);
  145. ctx.Ref_liststore_Shortcut = gtkDB.get_object('liststore_KeyShortcut');
  146. ctx.Iter_ShortcutRow = ctx.Ref_liststore_Shortcut.append();
  147. let renderer = new Gtk.CellRendererAccel({
  148. editable: true,
  149. });
  150. renderer.connect(
  151. 'accel-edited',
  152. (_0, _1, key, mods, _2) => {
  153. Lib.TalkativeLog(`-^-edited key accel: key=${key} mods=${mods}`);
  154. let accel = Gtk.accelerator_name(key, mods);
  155. ctx._updateRowShortcut(accel);
  156. this._settings.setOption(Settings.SHORTCUT_KEY_SETTING_KEY, [accel]);
  157. }
  158. );
  159. renderer.connect('accel-cleared', () => {
  160. Lib.TalkativeLog('-^-cleared key accel');
  161. ctx._updateRowShortcut(null);
  162. this._settings.setOption(Settings.SHORTCUT_KEY_SETTING_KEY, []);
  163. });
  164. let column = new Gtk.TreeViewColumn();
  165. column.pack_start(renderer, true);
  166. column.add_attribute(
  167. renderer,
  168. 'accel-key',
  169. Settings.SHORTCUT_COLUMN_KEY
  170. );
  171. column.add_attribute(
  172. renderer,
  173. 'accel-mods',
  174. Settings.SHORTCUT_COLUMN_MODS
  175. );
  176. refTreeviewShortcut.append_column(column);
  177. // implements post execute command
  178. let refSwitchExecutePostCmd = gtkDB.get_object('swt_executepostcmd');
  179. tmpS.bind(
  180. Settings.ACTIVE_POST_CMD_SETTING_KEY,
  181. refSwitchExecutePostCmd,
  182. 'active',
  183. Gio.SettingsBindFlags.DEFAULT
  184. );
  185. let refTexteditPostCmd = gtkDB.get_object('txe_postcmd');
  186. tmpS.bind(
  187. Settings.POST_CMD_SETTING_KEY,
  188. refTexteditPostCmd,
  189. 'text',
  190. Gio.SettingsBindFlags.DEFAULT
  191. );
  192. // implements pre execute command
  193. let refSwitchExecutePreCmd = gtkDB.get_object('swt_executeprecmd');
  194. tmpS.bind(
  195. Settings.ACTIVE_PRE_CMD_SETTING_KEY,
  196. refSwitchExecutePreCmd,
  197. 'active',
  198. Gio.SettingsBindFlags.DEFAULT
  199. );
  200. let refTexteditPreCmd = gtkDB.get_object('txe_precmd');
  201. tmpS.bind(
  202. Settings.PRE_CMD_SETTING_KEY,
  203. refTexteditPreCmd,
  204. 'text',
  205. Gio.SettingsBindFlags.DEFAULT
  206. );
  207. }
  208. /**
  209. * @param {EasyScreenCastSettingsWidget} ctx the prefs/settings widget
  210. * @param {Gtk.Builder} gtkDB the builder that loaded the UI glade file
  211. * @param {Gio.Settings} tmpS the current settings
  212. * @private
  213. */
  214. _initTabQuality(ctx, gtkDB, tmpS) {
  215. // implements FPS option
  216. let refSpinnerFrameRateRec = gtkDB.get_object('spb_FrameRateRec');
  217. // Create an adjustment to use for the second spinbutton
  218. let adjustment1 = new Gtk.Adjustment({
  219. value: 30,
  220. lower: 1,
  221. upper: 666,
  222. step_increment: 1,
  223. page_increment: 10,
  224. });
  225. refSpinnerFrameRateRec.configure(adjustment1, 10, 0);
  226. tmpS.bind(
  227. Settings.FPS_SETTING_KEY,
  228. refSpinnerFrameRateRec,
  229. 'value',
  230. Gio.SettingsBindFlags.DEFAULT
  231. );
  232. // implements command string rec option
  233. let refTexteditPipeline = gtkDB.get_object('txe_CommandStringRec');
  234. let refBufferPipeline = refTexteditPipeline.get_buffer();
  235. tmpS.bind(
  236. Settings.PIPELINE_REC_SETTING_KEY,
  237. refBufferPipeline,
  238. 'text',
  239. Gio.SettingsBindFlags.DEFAULT
  240. );
  241. // implements label description GSP
  242. let refLabelDescGSP = gtkDB.get_object('lbl_GSP_Description');
  243. refLabelDescGSP.set_text(
  244. UtilGSP.getDescr(
  245. this._settings.getOption('i', Settings.QUALITY_SETTING_KEY),
  246. this._settings.getOption('i', Settings.FILE_CONTAINER_SETTING_KEY)
  247. )
  248. );
  249. // update label description when container selection changed
  250. this._settings._settings.connect(`changed::${Settings.FILE_CONTAINER_SETTING_KEY}`, () => {
  251. Lib.TalkativeLog('-^- new setting for file container, update gps description');
  252. refLabelDescGSP.set_text(
  253. UtilGSP.getDescr(
  254. this._settings.getOption('i', Settings.QUALITY_SETTING_KEY),
  255. this._settings.getOption('i', Settings.FILE_CONTAINER_SETTING_KEY)
  256. )
  257. );
  258. });
  259. // implements quality scale option
  260. let refScaleQuality = gtkDB.get_object('scl_Quality');
  261. refScaleQuality.set_valign(Gtk.Align.START);
  262. let adjustment2 = new Gtk.Adjustment({
  263. value: 1,
  264. lower: 0,
  265. upper: 3,
  266. step_increment: 1,
  267. page_increment: 1,
  268. });
  269. refScaleQuality.set_adjustment(adjustment2);
  270. refScaleQuality.set_digits(1);
  271. let ind = 0;
  272. for (; ind < 4; ind++)
  273. refScaleQuality.add_mark(ind, Gtk.PositionType.BOTTOM, '');
  274. refScaleQuality.set_value(
  275. this._settings.getOption('i', Settings.QUALITY_SETTING_KEY)
  276. );
  277. let oldQualityValue = refScaleQuality.get_value();
  278. refScaleQuality.connect('value-changed', self => {
  279. // not logging by default - it's too much
  280. // Lib.TalkativeLog(`-^-value quality changed : ${self.get_value()}`);
  281. // round the value
  282. let roundTmp = parseInt(self.get_value().toFixed(0));
  283. // not logging by default - it's too much
  284. // Lib.TalkativeLog(`-^-value quality fixed : ${roundTmp}`);
  285. self.set_value(roundTmp);
  286. // only update labels for real changes
  287. if (oldQualityValue !== roundTmp) {
  288. oldQualityValue = roundTmp;
  289. this._settings.setOption(Settings.QUALITY_SETTING_KEY, roundTmp);
  290. // update label descr GSP
  291. refLabelDescGSP.set_text(
  292. UtilGSP.getDescr(
  293. roundTmp,
  294. this._settings.getOption('i', Settings.FILE_CONTAINER_SETTING_KEY)
  295. )
  296. );
  297. // update fps
  298. this._settings.setOption(
  299. Settings.FPS_SETTING_KEY,
  300. UtilGSP.getFps(
  301. roundTmp,
  302. this._settings.getOption('i', Settings.FILE_CONTAINER_SETTING_KEY)
  303. )
  304. );
  305. }
  306. });
  307. // implements image for scale widget
  308. let refImagePerformance = gtkDB.get_object('img_Performance');
  309. refImagePerformance.set_from_file(Lib.getImagePath(this._prefs.dir, 'Icon_Performance.svg'));
  310. let refImageQuality = gtkDB.get_object('img_Quality');
  311. refImageQuality.set_from_file(Lib.getImagePath(this._prefs.dir, 'Icon_Quality.svg'));
  312. // implements custom GSPipeline option
  313. let refSwitchCustomGSP = gtkDB.get_object('swt_EnableCustomGSP');
  314. tmpS.bind(
  315. Settings.ACTIVE_CUSTOM_GSP_SETTING_KEY,
  316. refSwitchCustomGSP,
  317. 'active',
  318. Gio.SettingsBindFlags.DEFAULT
  319. );
  320. refSwitchCustomGSP.connect('state-set', () => {
  321. // update GSP text area
  322. ctx._setStateGSP(this._settings.getOption('b', Settings.ACTIVE_CUSTOM_GSP_SETTING_KEY));
  323. });
  324. ctx.Ref_stack_Quality = gtkDB.get_object('stk_Quality');
  325. }
  326. /**
  327. * @param {EasyScreenCastSettingsWidget} ctx the prefs/settings widget
  328. * @param {Gtk.Builder} gtkDB the builder that loaded the UI glade file
  329. * @param {Gio.Settings} tmpS the current settings
  330. * @private
  331. */
  332. _initTabWebcam(ctx, gtkDB, tmpS) {
  333. // implements webcam quality option: Type: GtkListStore
  334. ctx.Ref_ListStore_QualityWebCam = gtkDB.get_object(
  335. 'liststore_QualityWebCam'
  336. );
  337. let refTreeViewQualityWebCam = gtkDB.get_object(
  338. 'treeview_QualityWebam'
  339. );
  340. // create column data
  341. let capsColumn = new Gtk.TreeViewColumn({
  342. title: _('WebCam Caps'),
  343. });
  344. let normalColumn = new Gtk.CellRendererText();
  345. capsColumn.pack_start(normalColumn, true);
  346. capsColumn.add_attribute(normalColumn, 'text', 0);
  347. // insert caps column into treeview
  348. refTreeViewQualityWebCam.insert_column(capsColumn, 0);
  349. // setup selection liststore
  350. let capsSelection = refTreeViewQualityWebCam.get_selection();
  351. // connect selection signal
  352. capsSelection.connect('changed', self => {
  353. let [isSelected,, iter] = self.get_selected();
  354. if (isSelected) {
  355. let Caps = ctx.Ref_ListStore_QualityWebCam.get_value(iter, 0);
  356. Lib.TalkativeLog(`-^-treeview row selected : ${Caps}`);
  357. this._settings.setOption(Settings.QUALITY_WEBCAM_SETTING_KEY, Caps);
  358. // update label webcam caps
  359. ctx.Ref_Label_WebCamCaps.set_ellipsize(Pango.EllipsizeMode.END);
  360. ctx.Ref_Label_WebCamCaps.set_text(Caps);
  361. }
  362. });
  363. // fill combobox with quality option webcam
  364. ctx._updateWebCamCaps(this._settings.getOption('i', Settings.DEVICE_INDEX_WEBCAM_SETTING_KEY));
  365. // implements webcam corner position option
  366. let refComboboxCornerWebCam = gtkDB.get_object('cbt_WebCamCorner');
  367. tmpS.bind(
  368. Settings.CORNER_POSITION_WEBCAM_SETTING_KEY,
  369. refComboboxCornerWebCam,
  370. 'active',
  371. Gio.SettingsBindFlags.DEFAULT
  372. );
  373. // implements webcam margin x position option
  374. let refSpinnerMarginXWebCam = gtkDB.get_object('spb_WebCamMarginX');
  375. let adjustmentMarginX = new Gtk.Adjustment({
  376. value: 0,
  377. lower: 0,
  378. upper: 10000,
  379. step_increment: 1,
  380. page_increment: 10,
  381. });
  382. refSpinnerMarginXWebCam.configure(adjustmentMarginX, 10, 0);
  383. tmpS.bind(
  384. Settings.MARGIN_X_WEBCAM_SETTING_KEY,
  385. refSpinnerMarginXWebCam,
  386. 'value',
  387. Gio.SettingsBindFlags.DEFAULT
  388. );
  389. // implements webcam margin y position option
  390. let refSpinnerMarginYWebCam = gtkDB.get_object('spb_WebCamMarginY');
  391. let adjustmentMarginY = new Gtk.Adjustment({
  392. value: 0,
  393. lower: 0,
  394. upper: 10000,
  395. step_increment: 1,
  396. page_increment: 10,
  397. });
  398. refSpinnerMarginYWebCam.configure(adjustmentMarginY, 10, 0);
  399. tmpS.bind(
  400. Settings.MARGIN_Y_WEBCAM_SETTING_KEY,
  401. refSpinnerMarginYWebCam,
  402. 'value',
  403. Gio.SettingsBindFlags.DEFAULT
  404. );
  405. // implements webcam aplha channel option
  406. let refSpinnerAlphaWebCam = gtkDB.get_object('spb_WebCamAlpha');
  407. let adjustmentAlpha = new Gtk.Adjustment({
  408. value: 0.01,
  409. lower: 0.0,
  410. upper: 1.0,
  411. step_increment: 0.05,
  412. page_increment: 0.25,
  413. });
  414. refSpinnerAlphaWebCam.configure(adjustmentAlpha, 0.25, 2);
  415. tmpS.bind(
  416. Settings.ALPHA_CHANNEL_WEBCAM_SETTING_KEY,
  417. refSpinnerAlphaWebCam,
  418. 'value',
  419. Gio.SettingsBindFlags.DEFAULT
  420. );
  421. // implements webcam type unit dimension option
  422. let refComboboxTypeUnitWebCam = gtkDB.get_object('cbt_WebCamUnitMeasure');
  423. tmpS.bind(
  424. Settings.TYPE_UNIT_WEBCAM_SETTING_KEY,
  425. refComboboxTypeUnitWebCam,
  426. 'active',
  427. Gio.SettingsBindFlags.DEFAULT
  428. );
  429. // implements webcam width option
  430. let refSpinnerWidthWebCam = gtkDB.get_object('spb_WebCamWidth');
  431. let adjustmentWidth = new Gtk.Adjustment({
  432. value: 20,
  433. lower: 0,
  434. upper: 10000,
  435. step_increment: 1,
  436. page_increment: 10,
  437. });
  438. refSpinnerWidthWebCam.configure(adjustmentWidth, 10, 0);
  439. tmpS.bind(
  440. Settings.WIDTH_WEBCAM_SETTING_KEY,
  441. refSpinnerWidthWebCam,
  442. 'value',
  443. Gio.SettingsBindFlags.DEFAULT
  444. );
  445. // implements webcam heigth option
  446. let refSpinnerHeightWebCam = gtkDB.get_object('spb_WebCamHeight');
  447. let adjustmentHeight = new Gtk.Adjustment({
  448. value: 10,
  449. lower: 0,
  450. upper: 10000,
  451. step_increment: 1,
  452. page_increment: 10,
  453. });
  454. refSpinnerHeightWebCam.configure(adjustmentHeight, 10, 0);
  455. tmpS.bind(
  456. Settings.HEIGHT_WEBCAM_SETTING_KEY,
  457. refSpinnerHeightWebCam,
  458. 'value',
  459. Gio.SettingsBindFlags.DEFAULT
  460. );
  461. // implements webcam stack menu chooser
  462. ctx.Ref_StackSwitcher_WebCam = gtkDB.get_object('sts_Webcam');
  463. // implements webcam stack obj
  464. ctx.Ref_StackObj_WebCam = gtkDB.get_object('stk_Webcam');
  465. // implements webcam stack menu chooser
  466. ctx.Ref_Label_WebCam = gtkDB.get_object('lbl_Webcam');
  467. // implements webcam caps stack menu chooser
  468. ctx.Ref_Label_WebCamCaps = gtkDB.get_object('lbl_WebcamCaps');
  469. }
  470. /**
  471. * @param {EasyScreenCastSettingsWidget} ctx the prefs/settings widget
  472. * @param {Gtk.Builder} gtkDB the builder that loaded the UI glade file
  473. * @param {Gio.Settings} tmpS the current settings
  474. * @private
  475. */
  476. _initTabFile(ctx, gtkDB, tmpS) {
  477. // implements file name string rec option
  478. let refTexteditFileName = gtkDB.get_object('txe_FileNameRec');
  479. tmpS.bind(
  480. Settings.FILE_NAME_SETTING_KEY,
  481. refTexteditFileName,
  482. 'text',
  483. Gio.SettingsBindFlags.DEFAULT
  484. );
  485. // implements file container option
  486. let refComboboxContainer = gtkDB.get_object('cbt_FileContainer');
  487. tmpS.bind(
  488. Settings.FILE_CONTAINER_SETTING_KEY,
  489. refComboboxContainer,
  490. 'active',
  491. Gio.SettingsBindFlags.DEFAULT
  492. );
  493. // implements file container resolution
  494. let refStackFileResolution = gtkDB.get_object('stk_FileResolution');
  495. // implements file resolution preset spinner
  496. let refComboboxResolution = gtkDB.get_object('cbt_FileResolution');
  497. tmpS.bind(
  498. Settings.FILE_RESOLUTION_TYPE_SETTING_KEY,
  499. refComboboxResolution,
  500. 'active',
  501. Gio.SettingsBindFlags.DEFAULT
  502. );
  503. // intercept combobox res changed and update width/height value
  504. refComboboxResolution.connect('changed', self => {
  505. var activeRes = self.active;
  506. Lib.TalkativeLog(`-^-preset combobox changed: ${activeRes}`);
  507. if (activeRes >= 0 && activeRes < 15) {
  508. var [h, w] = ctx._getResolutionPreset(activeRes);
  509. // update width/height
  510. this._settings.setOption(Settings.FILE_RESOLUTION_HEIGHT_SETTING_KEY, h);
  511. this._settings.setOption(Settings.FILE_RESOLUTION_WIDTH_SETTING_KEY, w);
  512. Lib.TalkativeLog(`-^-Res changed h: ${h} w: ${w}`);
  513. }
  514. });
  515. // load file resolution pref and upadte UI
  516. var tmpRes = this._settings.getOption('i', Settings.FILE_RESOLUTION_TYPE_SETTING_KEY);
  517. if (tmpRes < 0)
  518. refStackFileResolution.set_visible_child_name('native');
  519. else if (tmpRes === 999)
  520. refStackFileResolution.set_visible_child_name('custom');
  521. else
  522. refStackFileResolution.set_visible_child_name('preset');
  523. // setup event on stack switcher
  524. refStackFileResolution.connect('notify::visible-child-name', () => {
  525. Lib.TalkativeLog('-^-stack_FR event grab');
  526. var page = refStackFileResolution.get_visible_child_name();
  527. Lib.TalkativeLog(`-^-active page -> ${page}`);
  528. if (page === 'native') {
  529. // set option to -1
  530. this._settings.setOption(Settings.FILE_RESOLUTION_TYPE_SETTING_KEY, -1);
  531. } else if (page === 'preset') {
  532. // set option to fullHD 16:9
  533. this._settings.setOption(Settings.FILE_RESOLUTION_TYPE_SETTING_KEY, 8);
  534. } else if (page === 'custom') {
  535. // set option to 99
  536. this._settings.setOption(Settings.FILE_RESOLUTION_TYPE_SETTING_KEY, 999);
  537. } else {
  538. Lib.TalkativeLog('-^-page error');
  539. }
  540. });
  541. // implements file width option
  542. let refSpinnerWidthRes = gtkDB.get_object('spb_ResWidth');
  543. let adjustmentResWidth = new Gtk.Adjustment({
  544. value: 640,
  545. lower: 640,
  546. upper: 3840,
  547. step_increment: 1,
  548. page_increment: 100,
  549. });
  550. refSpinnerWidthRes.configure(adjustmentResWidth, 10, 0);
  551. tmpS.bind(
  552. Settings.FILE_RESOLUTION_WIDTH_SETTING_KEY,
  553. refSpinnerWidthRes,
  554. 'value',
  555. Gio.SettingsBindFlags.DEFAULT
  556. );
  557. // implements file heigth option
  558. let refSpinnerHeightRes = gtkDB.get_object('spb_ResHeight');
  559. let adjustmentResHeight = new Gtk.Adjustment({
  560. value: 480,
  561. lower: 480,
  562. upper: 2160,
  563. step_increment: 1,
  564. page_increment: 100,
  565. });
  566. refSpinnerHeightRes.configure(adjustmentResHeight, 10, 0);
  567. tmpS.bind(
  568. Settings.FILE_RESOLUTION_HEIGHT_SETTING_KEY,
  569. refSpinnerHeightRes,
  570. 'value',
  571. Gio.SettingsBindFlags.DEFAULT
  572. );
  573. // implements keep aspect ratio check box
  574. let refCheckboxKeepAspectRatio = gtkDB.get_object('chb_FileResolution_kar');
  575. tmpS.bind(
  576. Settings.FILE_RESOLUTION_KAR_SETTING_KEY,
  577. refCheckboxKeepAspectRatio,
  578. 'active',
  579. Gio.SettingsBindFlags.DEFAULT
  580. );
  581. // implements resolution width scale option
  582. let refScaleWidthRes = gtkDB.get_object('scl_ResWidth');
  583. refScaleWidthRes.set_valign(Gtk.Align.START);
  584. refScaleWidthRes.set_adjustment(adjustmentResWidth);
  585. refScaleWidthRes.set_digits(0);
  586. refScaleWidthRes.set_value(this._settings.getOption('i', Settings.FILE_RESOLUTION_WIDTH_SETTING_KEY));
  587. // implements resolution height scale option
  588. let refScaleHeightRes = gtkDB.get_object('scl_ResHeight');
  589. refScaleHeightRes.set_valign(Gtk.Align.START);
  590. refScaleHeightRes.set_adjustment(adjustmentResHeight);
  591. refScaleHeightRes.set_digits(0);
  592. refScaleHeightRes.set_value(this._settings.getOption('i', Settings.FILE_RESOLUTION_HEIGHT_SETTING_KEY));
  593. // add marks on width/height file resolution
  594. let ind = 0;
  595. for (; ind < 13; ind++) {
  596. var [h, w] = ctx._getResolutionPreset(ind);
  597. refScaleWidthRes.add_mark(w, Gtk.PositionType.BOTTOM, '');
  598. refScaleHeightRes.add_mark(h, Gtk.PositionType.BOTTOM, '');
  599. }
  600. // implements file folder string rec option
  601. let refFilechooserFileFolder = gtkDB.get_object('fcb_FilePathRec');
  602. // check state initial value
  603. var tmpFolder = this._settings.getOption('s', Settings.FILE_FOLDER_SETTING_KEY);
  604. Lib.TalkativeLog(`-^-folder for screencast: ${tmpFolder}`);
  605. if (tmpFolder === '' || tmpFolder === null || tmpFolder === undefined) {
  606. let result = null;
  607. ctx.CtrlExe.Execute(
  608. 'xdg-user-dir VIDEOS',
  609. true,
  610. (success, out) => {
  611. Lib.TalkativeLog(`-^-CALLBACK sync S: ${success} out: ${out}`);
  612. if (success && out !== '' && out !== undefined)
  613. result = out.replace(/(\n)/g, '');
  614. },
  615. null
  616. );
  617. if (result !== null) {
  618. Lib.TalkativeLog(`-^-xdg-user video: ${result}`);
  619. tmpFolder = result;
  620. } else {
  621. Lib.TalkativeLog('-^-NOT SET xdg-user video');
  622. ctx.CtrlExe.Execute(
  623. '/usr/bin/sh -c "echo $HOME"',
  624. true,
  625. (success, out) => {
  626. Lib.TalkativeLog(`-^-CALLBACK sync S: ${success} out: ${out}`);
  627. if (success && out !== '' && out !== undefined)
  628. tmpFolder = out.replace(/(\n)/g, '');
  629. },
  630. null
  631. );
  632. }
  633. // connect keywebcam signal
  634. this._settings._settings.connect(
  635. `changed::${Settings.DEVICE_INDEX_WEBCAM_SETTING_KEY}`,
  636. () => {
  637. Lib.TalkativeLog('-^-webcam device changed');
  638. this._refreshWebcamOptions();
  639. }
  640. );
  641. }
  642. refFilechooserFileFolder.set_label(`Selected: ${tmpFolder}`);
  643. refFilechooserFileFolder.connect('clicked', () => {
  644. Lib.TalkativeLog('-^- file chooser button clicked...');
  645. let dialog = new Gtk.FileChooserNative({
  646. 'title': 'Select folder',
  647. 'transient-for': refFilechooserFileFolder.get_root(),
  648. 'action': Gtk.FileChooserAction.SELECT_FOLDER,
  649. 'accept-label': 'Ok',
  650. 'cancel-label': 'Cancel',
  651. });
  652. dialog.connect('response', (self, response) => {
  653. if (response === Gtk.ResponseType.ACCEPT) {
  654. var tmpPathFolder = self.get_file().get_path();
  655. Lib.TalkativeLog(`-^-file path get from widget : ${tmpPathFolder}`);
  656. this._settings.setOption(
  657. Settings.FILE_FOLDER_SETTING_KEY,
  658. tmpPathFolder
  659. );
  660. refFilechooserFileFolder.set_label(`Selected: ${tmpPathFolder}`);
  661. }
  662. ctx.fileChooserDialog = null;
  663. });
  664. dialog.show();
  665. ctx.fileChooserDialog = dialog; // keep a reference to the dialog alive
  666. });
  667. }
  668. /**
  669. * @param {EasyScreenCastSettingsWidget} ctx the prefs/settings widget
  670. * @param {Gtk.Builder} gtkDB the builder that loaded the UI glade file
  671. * @param {Gio.Settings} tmpS the current settings
  672. * @private
  673. */
  674. _initTabSupport(ctx, gtkDB, tmpS) {
  675. // implements textentry log
  676. let refTextViewEscLog = gtkDB.get_object('txe_ContainerLog');
  677. let refBufferLog = refTextViewEscLog.get_buffer();
  678. // implements verbose debug option
  679. let refSwitchVerboseDebug = gtkDB.get_object('swt_VerboseDebug');
  680. tmpS.bind(
  681. Settings.VERBOSE_DEBUG_SETTING_KEY,
  682. refSwitchVerboseDebug,
  683. 'active',
  684. Gio.SettingsBindFlags.DEFAULT
  685. );
  686. this._settings._settings.connect(
  687. `changed::${Settings.VERBOSE_DEBUG_SETTING_KEY}`,
  688. () => {
  689. Lib.setDebugEnabled(this._settings.getOption('b', Settings.VERBOSE_DEBUG_SETTING_KEY));
  690. }
  691. );
  692. refSwitchVerboseDebug.connect('state-set', self => {
  693. // update log display widgets
  694. refTextViewEscLog.sensistive = self.active;
  695. refComboboxLogChooser.sensitive = self.active;
  696. });
  697. // implements file resolution preset spinner
  698. let refComboboxLogChooser = gtkDB.get_object('cbt_LogChooser');
  699. // intercept combobox res changed and update width/height value
  700. refComboboxLogChooser.connect('changed', self => {
  701. const activeLog = self.active;
  702. Lib.TalkativeLog(`-^-log combobox changed: ${activeLog}`);
  703. switch (activeLog) {
  704. case 0:
  705. // clear buffer
  706. refBufferLog.delete(
  707. refBufferLog.get_start_iter(),
  708. refBufferLog.get_end_iter()
  709. );
  710. ctx.CtrlExe.Execute(
  711. 'journalctl --since "15 min ago" --output=cat --no-pager',
  712. false,
  713. success => {
  714. Lib.TalkativeLog(`-^-CALLBACK async S= ${success}`);
  715. },
  716. line => {
  717. let esc = line.indexOf('[ESC]');
  718. if (
  719. line !== '' &&
  720. line !== undefined &&
  721. esc !== -1
  722. ) {
  723. line += '\n';
  724. refBufferLog.insert(
  725. refBufferLog.get_end_iter(),
  726. line,
  727. line.length
  728. );
  729. }
  730. }
  731. );
  732. break;
  733. case 1:
  734. // clear buffer
  735. refBufferLog.delete(
  736. refBufferLog.get_start_iter(),
  737. refBufferLog.get_end_iter()
  738. );
  739. ctx.CtrlExe.Execute(
  740. 'journalctl --since "15 min ago" --output=cat --no-pager',
  741. false,
  742. success => {
  743. Lib.TalkativeLog(`-^-CALLBACK async S= ${success}`);
  744. if (success) {
  745. if (refBufferLog.get_line_count() > 0) {
  746. let strNOgsp = _(
  747. 'No Gstreamer pipeline found'
  748. );
  749. refBufferLog.insert(
  750. refBufferLog.get_end_iter(),
  751. strNOgsp,
  752. strNOgsp.length
  753. );
  754. }
  755. }
  756. },
  757. line => {
  758. let esc = line.indexOf('-§-final GSP :');
  759. if (
  760. line !== '' &&
  761. line !== undefined &&
  762. esc !== -1
  763. ) {
  764. line += '\n';
  765. refBufferLog.insert(
  766. refBufferLog.get_end_iter(),
  767. line,
  768. line.length
  769. );
  770. }
  771. }
  772. );
  773. break;
  774. case 2:
  775. // clear buffer
  776. refBufferLog.delete(
  777. refBufferLog.get_start_iter(),
  778. refBufferLog.get_end_iter()
  779. );
  780. ctx.CtrlExe.Execute(
  781. 'journalctl /usr/bin/gnome-shell --since "15 min ago" --output=cat --no-pager',
  782. false,
  783. success => {
  784. Lib.TalkativeLog(`-^-CALLBACK async S= ${success}`);
  785. },
  786. line => {
  787. if (line !== '' && line !== undefined) {
  788. line += '\n';
  789. refBufferLog.insert(
  790. refBufferLog.get_end_iter(),
  791. line,
  792. line.length
  793. );
  794. }
  795. }
  796. );
  797. break;
  798. default:
  799. break;
  800. }
  801. });
  802. // update state of get log
  803. refComboboxLogChooser.sensistive = this._settings.getOption('b', Settings.VERBOSE_DEBUG_SETTING_KEY);
  804. // implements default button action
  805. let refButtonSetDefaultSettings = gtkDB.get_object('btn_DefaultOption');
  806. refButtonSetDefaultSettings.connect('clicked', () =>
  807. ctx._setDefaultsettings()
  808. );
  809. }
  810. /**
  811. * @param {EasyScreenCastSettingsWidget} ctx the prefs/settings widget
  812. * @param {Gtk.Builder} gtkDB the builder that loaded the UI glade file
  813. * @private
  814. */
  815. _initTabInfo(ctx, gtkDB) {
  816. // implements info img extension
  817. let refImageEsc = gtkDB.get_object('img_ESC');
  818. refImageEsc.set_from_file(Lib.getImagePath(this._prefs.dir, 'Icon_Info.png'));
  819. // implements info version label
  820. let refLabelVersion = gtkDB.get_object('lbl_Version');
  821. refLabelVersion.set_markup(`${_('Version: ')}<span color="blue">${this._prefs.metadata.version}</span> (${Lib.getFullVersion()})`);
  822. }
  823. /**
  824. * @param {number} device device index
  825. * @private
  826. */
  827. _updateWebCamCaps(device) {
  828. Lib.TalkativeLog(`-^-webcam device index: ${device}`);
  829. if (device > 0) {
  830. this._initializeWebcamHelper();
  831. var listCaps = this.CtrlWebcam.getListCapsDevice(device - 1);
  832. Lib.TalkativeLog(`-^-webcam caps: ${listCaps.length}`);
  833. if (listCaps !== null && listCaps !== undefined) {
  834. this.Ref_ListStore_QualityWebCam.clear();
  835. for (var index in listCaps) {
  836. this.Ref_ListStore_QualityWebCam.set(
  837. this.Ref_ListStore_QualityWebCam.append(),
  838. [0],
  839. [listCaps[index]]
  840. );
  841. }
  842. } else {
  843. Lib.TalkativeLog('-^-NO List Caps Webcam');
  844. this.Ref_ListStore_QualityWebCam.clear();
  845. this._settings.setOption(Settings.QUALITY_WEBCAM_SETTING_KEY, '');
  846. }
  847. } else {
  848. Lib.TalkativeLog('-^-NO Webcam recording');
  849. this.Ref_ListStore_QualityWebCam.clear();
  850. this._settings.setOption(Settings.QUALITY_WEBCAM_SETTING_KEY, '');
  851. }
  852. }
  853. /**
  854. * Refreshes the webcam settings.
  855. *
  856. * @private
  857. */
  858. _refreshWebcamOptions() {
  859. Lib.TalkativeLog('-^-refresh webcam options');
  860. this._initializeWebcamHelper();
  861. // fill combobox with quality option webcam
  862. this._updateWebCamCaps(this._settings.getOption('i', Settings.DEVICE_INDEX_WEBCAM_SETTING_KEY));
  863. // update webcam widget state
  864. this._updateStateWebcamOptions();
  865. }
  866. /**
  867. * Initializes this.CtrlWebcam if it is null.
  868. *
  869. * @private
  870. */
  871. _initializeWebcamHelper() {
  872. if (this.CtrlWebcam === null)
  873. this.CtrlWebcam = new UtilWebcam.HelperWebcam(_('Unspecified webcam'));
  874. }
  875. /**
  876. * @param {string} accel accelerator string parsable by Gtk.accelerator_parse, e.g. "&lt;Super&gt;E"
  877. * @private
  878. */
  879. _updateRowShortcut(accel) {
  880. Lib.TalkativeLog(`-^-update row combo key accel: ${accel}`);
  881. let [key, mods] = [0, 0];
  882. if (accel !== null && accel !== undefined) {
  883. let ok;
  884. [ok, key, mods] = Gtk.accelerator_parse(accel);
  885. if (ok !== true) {
  886. Lib.TalkativeLog('-^-couldn\'t parse accel');
  887. key = 0;
  888. mods = 0;
  889. }
  890. }
  891. Lib.TalkativeLog(`-^-key: ${key} mods: ${mods}`);
  892. this.Ref_liststore_Shortcut.set(
  893. this.Iter_ShortcutRow,
  894. [Settings.SHORTCUT_COLUMN_KEY, Settings.SHORTCUT_COLUMN_MODS],
  895. [key, mods]
  896. );
  897. }
  898. /**
  899. * @param {boolean} active custom or not custom GStream pipeline
  900. * @private
  901. */
  902. _setStateGSP(active) {
  903. // update GSP text area
  904. if (!active) {
  905. Lib.TalkativeLog('-^-custom GSP');
  906. this.Ref_stack_Quality.set_visible_child_name('pg_Custom');
  907. } else {
  908. Lib.TalkativeLog('-^-NOT custom GSP');
  909. this.Ref_stack_Quality.set_visible_child_name('pg_Preset');
  910. var audio = false;
  911. if (this._settings.getOption('i', Settings.INPUT_AUDIO_SOURCE_SETTING_KEY) > 0)
  912. audio = true;
  913. this._settings.setOption(
  914. Settings.PIPELINE_REC_SETTING_KEY,
  915. Settings.getGSPstd(audio)
  916. );
  917. }
  918. }
  919. /**
  920. * @private
  921. */
  922. _updateStateWebcamOptions() {
  923. Lib.TalkativeLog('-^-update webcam option widgets');
  924. var tmpDev = this._settings.getOption(
  925. 'i',
  926. Settings.DEVICE_INDEX_WEBCAM_SETTING_KEY
  927. );
  928. this._updateWebCamCaps(tmpDev);
  929. if (tmpDev > 0) {
  930. var arrDev = this.CtrlWebcam.getNameDevices();
  931. this.Ref_Label_WebCam.set_text(arrDev[tmpDev - 1]);
  932. // setup label webcam caps
  933. var tmpCaps = this._settings.getOption(
  934. 's',
  935. Settings.QUALITY_WEBCAM_SETTING_KEY
  936. );
  937. if (tmpCaps === '') {
  938. this.Ref_Label_WebCamCaps.use_markup = true;
  939. this.Ref_Label_WebCamCaps.set_markup(
  940. _(
  941. '<span foreground="red">No Caps selected, please select one from the caps list</span>'
  942. )
  943. );
  944. } else {
  945. this.Ref_Label_WebCamCaps.set_text(tmpCaps);
  946. }
  947. // webcam recording show widget
  948. this.Ref_StackSwitcher_WebCam.set_sensitive(true);
  949. this.Ref_StackObj_WebCam.set_sensitive(true);
  950. } else {
  951. this.Ref_Label_WebCam.set_text(_('No webcam device selected'));
  952. // setup label webcam caps
  953. this.Ref_Label_WebCamCaps.set_text(_('-'));
  954. // webcam NOT recording hide widget
  955. this.Ref_StackSwitcher_WebCam.set_sensitive(false);
  956. this.Ref_StackObj_WebCam.set_sensitive(false);
  957. }
  958. }
  959. /**
  960. * @param {number} index index of the predefined resolutions
  961. * @returns {Array}
  962. * @private
  963. */
  964. _getResolutionPreset(index) {
  965. var arrRes = [
  966. [480, 640],
  967. [480, 854],
  968. [600, 800],
  969. [720, 960],
  970. [720, 1280],
  971. [768, 1024],
  972. [768, 1366],
  973. [1024, 1280],
  974. [1080, 1920],
  975. [1200, 1600],
  976. [1440, 2560],
  977. [2048, 2560],
  978. [2160, 3840],
  979. ];
  980. if (index >= 0 && index < arrRes.length)
  981. return arrRes[index];
  982. else
  983. return null;
  984. }
  985. /**
  986. * function to restore default value of the settings
  987. *
  988. * @private
  989. */
  990. _setDefaultsettings() {
  991. Lib.TalkativeLog('-^-restore default option');
  992. this._settings.setOption(Settings.SHOW_NOTIFY_ALERT_SETTING_KEY, true);
  993. this._settings.setOption(Settings.SHOW_AREA_REC_SETTING_KEY, false);
  994. this._settings.setOption(Settings.STATUS_INDICATORS_SETTING_KEY, 1);
  995. this._settings.setOption(Settings.DRAW_CURSOR_SETTING_KEY, true);
  996. this._settings.setOption(Settings.VERBOSE_DEBUG_SETTING_KEY, false);
  997. this._settings.setOption(Settings.ACTIVE_CUSTOM_GSP_SETTING_KEY, false);
  998. this._settings.setOption(Settings.FPS_SETTING_KEY, 30);
  999. this._settings.setOption(Settings.X_POS_SETTING_KEY, 0);
  1000. this._settings.setOption(Settings.Y_POS_SETTING_KEY, 0);
  1001. this._settings.setOption(Settings.WIDTH_SETTING_KEY, 600);
  1002. this._settings.setOption(Settings.HEIGHT_SETTING_KEY, 400);
  1003. this._settings.setOption(Settings.FILE_NAME_SETTING_KEY, 'Screencast_%d_%t');
  1004. this._settings.setOption(Settings.FILE_FOLDER_SETTING_KEY, '');
  1005. this._settings.setOption(Settings.ACTIVE_POST_CMD_SETTING_KEY, false);
  1006. this._settings.setOption(Settings.ACTIVE_PRE_CMD_SETTING_KEY, false);
  1007. this._settings.setOption(Settings.POST_CMD_SETTING_KEY, 'xdg-open _fpath &');
  1008. this._settings.setOption(Settings.INPUT_AUDIO_SOURCE_SETTING_KEY, 0);
  1009. this._settings.setOption(Settings.DEVICE_INDEX_WEBCAM_SETTING_KEY, 0);
  1010. this._settings.setOption(Settings.DEVICE_WEBCAM_SETTING_KEY, '');
  1011. this._settings.setOption(Settings.TIME_DELAY_SETTING_KEY, 0);
  1012. this._settings.setOption(Settings.FILE_CONTAINER_SETTING_KEY, 0);
  1013. this._settings.setOption(Settings.FILE_RESOLUTION_TYPE_SETTING_KEY, -1);
  1014. this._settings.setOption(Settings.QUALITY_SETTING_KEY, 1);
  1015. this._settings.setOption(Settings.QUALITY_WEBCAM_SETTING_KEY, '');
  1016. this._settings.setOption(Settings.WIDTH_WEBCAM_SETTING_KEY, 20);
  1017. this._settings.setOption(Settings.HEIGHT_WEBCAM_SETTING_KEY, 10);
  1018. this._settings.setOption(Settings.TYPE_UNIT_WEBCAM_SETTING_KEY, 0);
  1019. this._settings.setOption(Settings.MARGIN_X_WEBCAM_SETTING_KEY, 0);
  1020. this._settings.setOption(Settings.MARGIN_Y_WEBCAM_SETTING_KEY, 0);
  1021. this._settings.setOption(Settings.ALPHA_CHANNEL_WEBCAM_SETTING_KEY, 0.75);
  1022. this._settings.setOption(Settings.CORNER_POSITION_WEBCAM_SETTING_KEY, 0);
  1023. }
  1024. });
  1025. export default class EasyScreenCastPreferences extends ExtensionPreferences {
  1026. /**
  1027. * @param {Adw.PreferencesWindow} window preferences window?
  1028. * @returns {EasyScreenCastSettingsWidget}
  1029. */
  1030. fillPreferencesWindow(window) {
  1031. window._settings = this.getSettings();
  1032. Lib.TalkativeLog('-^-Init pref widget');
  1033. const page = new Adw.PreferencesPage();
  1034. const group = new Adw.PreferencesGroup({
  1035. title: _('EasyScreenCast'),
  1036. });
  1037. page.add(group);
  1038. const widget = new EasyScreenCastSettingsWidget(this);
  1039. group.add(widget);
  1040. window.add(page);
  1041. }
  1042. }