From e3588f68361a410363926683c7026ac0fd5563fb Mon Sep 17 00:00:00 2001 From: Rokas Puzonas Date: Fri, 21 Feb 2025 02:10:23 +0200 Subject: [PATCH] add button to channels window --- src/app.zig | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/app.zig b/src/app.zig index b984ebc..23ac0a1 100644 --- a/src/app.zig +++ b/src/app.zig @@ -913,7 +913,30 @@ fn showAddFromDeviceWindow(self: *App) !void { } } - try self.showChannelInfoPanel(hot_channel); + { + const left_panel = self.ui.newBox(UI.Key.initNil()); + left_panel.layout_axis = .Y; + left_panel.size.y = UI.Size.percent(1, 0); + left_panel.size.x = UI.Size.percent(1, 0); + self.ui.pushParent(left_panel); + defer self.ui.popParent(); + + try self.showChannelInfoPanel(hot_channel); + + const add_button = self.ui.button(.text, "Add"); + if (self.ui.signalFromBox(add_button).clicked()) { + for (self.selected_channels.constSlice()) |channel_name| { + try self.appendChannelFromDevice(channel_name); + } + + self.shown_window = .channels; + for (self.selected_channels.constSlice()) |channel| { + self.allocator.free(channel); + } + self.selected_channels.len = 0; + + } + } if (hot_channel != null) { self.last_hot_channel = hot_channel;