Add contrast slider

Signed-off-by: Vasiliy Doylov <nekocwd@mainlining.org>
This commit is contained in:
Vasiliy Doylov 2025-04-06 00:50:22 +03:00
parent 27f4590b8f
commit 2c08ae1195
Signed by: NekoCWD
GPG key ID: B7BE22D44474A582
9 changed files with 40 additions and 1 deletions

View file

@ -20,6 +20,7 @@
<schema id="io.gitlab.nekocwd.pipetap" path="/io/gitlab/nekocwd/pipetap/">
<child name="main-controls-pos" schema="io.gitlab.nekocwd.pipetap.adjustments"></child>
<child name="exp-pos" schema="io.gitlab.nekocwd.pipetap.adjustments"></child>
<child name="contrast-pos" schema="io.gitlab.nekocwd.pipetap.adjustments"></child>
<child name="focus-pos" schema="io.gitlab.nekocwd.pipetap.adjustments"></child>
<key name='is-uninitialised' type='b'>
<default>true</default>

View file

@ -22,6 +22,7 @@ public class PipeTap.Application : Adw.Application {
public Settings settings;
public Ui.SliderOverlay exposure;
public Ui.SliderOverlay focus;
public Ui.SliderOverlay contrast;
public Ui.MainBar main_bar;
public string device { get; set; }
@ -58,6 +59,8 @@ public class PipeTap.Application : Adw.Application {
exposure = new Ui.SliderOverlay (this, Logic.Ctrl.CtrlType.Exposure, Logic.Ctrl.CtrlType.ExposureEnable, "exp", "camera-iso-symbolic");
if (focus == null)
focus = new Ui.SliderOverlay (this, Logic.Ctrl.CtrlType.Focus, Logic.Ctrl.CtrlType.AutoFocusEnable, "focus", "camera-focus-symbolic");
if (contrast == null)
contrast = new Ui.SliderOverlay (this, Logic.Ctrl.CtrlType.Contrast, Logic.Ctrl.CtrlType.ContrastEnable, "contrast", "color-symbolic");
if (main_bar == null)
main_bar = new Ui.MainBar (this);
@ -103,6 +106,13 @@ public class PipeTap.Application : Adw.Application {
settings.set_int ("margin-right", 10);
settings.set_int ("margin-left", -1);
settings.set_int ("margin-top", 65);
settings.set_int ("margin-bottom", 180);
settings.apply ();
settings = this.settings.get_child ("contrast-pos");
settings.set_int ("orientation", 1);
settings.set_int ("margin-right", 10);
settings.set_int ("margin-left", 10);
settings.set_int ("margin-top", -1);
settings.set_int ("margin-bottom", 110);
settings.apply ();
settings = this.settings.get_child ("focus-pos");
@ -110,7 +120,7 @@ public class PipeTap.Application : Adw.Application {
settings.set_int ("margin-right", -1);
settings.set_int ("margin-left", 10);
settings.set_int ("margin-top", 65);
settings.set_int ("margin-bottom", 110);
settings.set_int ("margin-bottom", 180);
settings.apply ();
this.settings.apply ();
}

View file

@ -23,6 +23,15 @@ template $PipeTapUiMainBar: $PipeTapUiFloatingWindow {
]
}
Gtk.ToggleButton contrast {
icon-name: "color-symbolic";
tooltip-text: _("Contrast");
styles [
"flat",
]
}
Gtk.ToggleButton exposure {
icon-name: "camera-iso-symbolic";
tooltip-text: _("Exposure");

View file

@ -3,18 +3,23 @@ public class PipeTap.Ui.MainBar : PipeTap.Ui.FloatingWindow {
[GtkChild]
private unowned Gtk.ToggleButton exposure;
[GtkChild]
private unowned Gtk.ToggleButton contrast;
[GtkChild]
private new unowned Gtk.ToggleButton focus;
public MainBar (PipeTap.Application app) {
base (app, "main-controls");
exposure.bind_property ("active", app.exposure, "visible", BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL);
contrast.bind_property ("active", app.contrast, "visible", BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL);
focus.bind_property ("active", app.focus, "visible", BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL);
app.exposure.bind_property ("is_available", exposure, "sensitive", GLib.BindingFlags.SYNC_CREATE);
app.contrast.bind_property ("is_available", contrast, "sensitive", GLib.BindingFlags.SYNC_CREATE);
app.focus.bind_property ("is_available", focus, "sensitive", GLib.BindingFlags.SYNC_CREATE);
notify["visible"].connect (() => {
if (visible == true)
return;
app.exposure.visible = false;
app.contrast.visible = false;
app.focus.visible = false;
});
}

View file

@ -5,6 +5,7 @@ public class PipeTap.Ui.Settings : Adw.PreferencesDialog {
overlays.title = _("Overlays");
overlays.add(make_group_for("Main bar", "main-controls-pos"));
overlays.add(make_group_for("Exposure bar", "exp-pos"));
overlays.add(make_group_for("Contrast bar", "contrast-pos"));
overlays.add(make_group_for("Focus bar", "focus-pos"));
add(overlays);
}

View file

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" height="16px" viewBox="0 0 16 16" width="16px"><g fill="#222222"><path d="m 8.089844 0.015625 c -2.203125 0 -4 1.796875 -4 4 s 1.796875 4 4 4 c 2.199218 0 4 -1.796875 4 -4 s -1.800782 -4 -4 -4 z m 0 1.972656 c 1.121094 -0.003906 2.027344 0.90625 2.027344 2.027344 s -0.90625 2.03125 -2.027344 2.027344 c -1.121094 0.003906 -2.03125 -0.90625 -2.027344 -2.027344 c -0.003906 -1.121094 0.90625 -2.03125 2.027344 -2.027344 z m 3.90625 5.011719 c -1.96875 0.003906 -3.644532 1.433594 -3.949219 3.378906 c -0.320313 -1.90625 -1.980469 -3.363281 -3.972656 -3.363281 c -2.222657 0 -4.0312502 1.8125 -4.0312502 4.03125 s 1.8085932 4.03125 4.0312502 4.03125 c 2.007812 0 3.683593 -1.484375 3.984375 -3.414063 c 0.320312 1.921876 1.984375 3.332032 3.9375 3.335938 c 2.207031 0 3.996094 -1.792969 3.996094 -4 s -1.789063 -4 -3.996094 -4 z m -7.921875 2.003906 c 1.128906 -0.003906 2.042969 0.914063 2.042969 2.042969 s -0.914063 2.046875 -2.042969 2.042969 c -1.132813 0.003906 -2.046875 -0.914063 -2.042969 -2.042969 c -0.003906 -1.128906 0.910156 -2.046875 2.042969 -2.042969 z m 0 0"/><path d="m 6.902344 11 c 0 1.554688 -1.261719 2.8125 -2.8125 2.8125 c -1.554688 0 -2.8125 -1.257812 -2.8125 -2.8125 s 1.257812 -2.8125 2.8125 -2.8125 c 1.550781 0 2.8125 1.257812 2.8125 2.8125 z m 0 0" fill-opacity="0.501961"/></g></svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

View file

@ -6,6 +6,7 @@ namespace PipeTap.Logic {
Exposure,
ExposureEnable,
Contrast,
ContrastEnable,
Focus,
AutoFocusEnable,
}

View file

@ -145,6 +145,15 @@ namespace PipeTap.Logic.WirePlumber {
var ctrl = new Ctrl(Logic.Ctrl.CtrlType.ExposureEnable, node, id, type, 0, 1, 1);
found_ctrls.append(ctrl);
break;
case "Contrast":
if (type != "float") {
warning("Wrong type");
break;
}
message("Found Contrast");
var ctrl = new Ctrl(Logic.Ctrl.CtrlType.Contrast, node, id, type, 0, 2, 1);
found_ctrls.append(ctrl);
break;
default:
message("Unknown ctrl %s of %s", description, type);
break;

View file

@ -17,5 +17,6 @@
<file preprocess="xml-stripblanks" alias="camera-iso-symbolic.svg">icons/camera-iso-symbolic.svg</file>
<file preprocess="xml-stripblanks" alias="camera-focus-symbolic.svg">icons/camera-focus-symbolic.svg</file>
<file preprocess="xml-stripblanks" alias="angled-arrows-symbolic.svg">icons/angled-arrows-symbolic.svg</file>
<file preprocess="xml-stripblanks" alias="color-symbolic.svg">icons/color-symbolic.svg</file>
</gresource>
</gresources>