add button to channels window

This commit is contained in:
Rokas Puzonas 2025-02-21 02:10:23 +02:00
parent cf85b00084
commit e3588f6836

View File

@ -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;