Bavarder/src/views/window.blp

313 lines
8.1 KiB
Plaintext

using Gtk 4.0;
using Adw 1;
template $BavarderWindow : Adw.ApplicationWindow {
title: _("Bavarder");
default-width: 800;
default-height: 600;
width-request: 360;
height-request: 200;
ShortcutController {
Shortcut {
trigger: "<primary>q";
action: "action(window.close)";
}
}
Adw.ToastOverlay toast_overlay {
Adw.NavigationSplitView split_view {
max-sidebar-width: 260;
sidebar-width-fraction: 0.38;
sidebar: Adw.NavigationPage {
title: _("Bavarder");
child: Adw.ToolbarView {
[top]
Adw.HeaderBar {
[start]
Button new_chat {
icon-name: "chat-message-new-symbolic";
tooltip-text: _("New Chat");
clicked => $on_new_chat_action();
}
[end]
MenuButton menu_button {
primary: true;
menu-model: main-menu;
icon-name: "open-menu-symbolic";
tooltip-text: _("Main Menu");
}
}
content: Gtk.ScrolledWindow {
hscrollbar-policy: never;
child: Stack thread_stack {
Gtk.ListBox threads_list {
selection-mode: browse;
show-separators: false;
row-activated => $threads_row_activated_cb();
styles ["navigation-sidebar"]
}
Adw.StatusPage status_no_chat_thread {
title: _("No Chats");
icon-name: "chat-bubbles-emtpy-symbolic";
}
Adw.StatusPage status_no_thread {
icon-name: "io.github.Bavarder.Bavarder";
title: _("Bavarder");
description: _("Get started by creating a new chat or selecting one from the sidebar");
hexpand: true;
vexpand: true;
child: Gtk.Box {
orientation: vertical;
spacing: 12;
Gtk.Button {
valign: center;
halign: center;
clicked => $on_new_chat_action();
Adw.ButtonContent {
icon-name: "chat-message-new-symbolic";
tooltip-text: _("New Chat");
label: _("New Chat");
use-underline: true;
}
styles [
"suggested-action",
"pill"
]
}
};
}
};
};
};
};
content: Adw.NavigationPage message_page {
tag: "message";
title: _("Message");
child: Adw.ToolbarView {
[top]
Adw.HeaderBar {
[start]
Gtk.ToggleButton local_mode_toggle {
icon-name: 'cloud-disabled-symbolic';
toggled => $on_local_mode_toggled();
}
[title]
Adw.WindowTitle title {
title: _("Chat");
}
// [end]
// Button clear_all_button {
// icon-name: 'edit-clear-all-symbolic';
// clicked => $on_clear_all();
// visible: false;
// }
[end]
MenuButton model_selector_button {
icon-name: 'view-more-symbolic';
visible: false;
}
[end]
MenuButton provider_selector_button {
icon-name: 'view-more-symbolic';
visible: false;
}
}
[top]
Adw.Banner banner {
}
content: Overlay {
[overlay]
Button scroll_down_button {
visible: false;
styles [
"circular",
"image-button",
"osd"
]
icon-name: "go-bottom-symbolic";
halign: end;
valign: end;
margin-bottom: 6;
margin-end: 6;
clicked => $scroll_down();
}
Stack stack {
Adw.StatusPage status_no_chat {
title: _("No Messages");
description: _("Send first message to get started");
icon-name: "chat-bubbles-emtpy-symbolic";
}
Adw.StatusPage status_no_internet {
title: _("No Internet");
icon-name: "network-offline-symbolic";
}
Adw.StatusPage status_no_thread_main {
icon-name: "io.github.Bavarder.Bavarder";
title: _("Bavarder");
description: _("Get started by creating a new chat");
hexpand: true;
vexpand: true;
child: Gtk.Box {
orientation: vertical;
spacing: 12;
Gtk.Button {
valign: center;
halign: center;
clicked => $on_new_chat_action();
Adw.ButtonContent {
icon-name: "chat-message-new-symbolic";
tooltip-text: _("New Chat");
label: _("New Chat");
use-underline: true;
}
styles [
"suggested-action",
"pill"
]
}
};
}
// Message List
ScrolledWindow main {
//vexpand: true;
hscrollbar-policy: never;
//edge-overshot => $handle_edge_reached() swapped;
Adw.Clamp {
// vexpand: false;
// hexpand: true;
maximum-size: 1200;
// tightening-threshold: 550;
// margin-bottom: 4;
// margin-start: 12;
// margin-end: 12;
ListBox main_list {
margin-end: 5;
margin-start: 5;
styles [
"message-list",
"background"
]
selection-mode: none;
show-separators: false;
hexpand: true;
vexpand: false;
}
}
}
}
};
[bottom]
Gtk.Box toolbar {
orientation: vertical;
visible: true;
Gtk.Box {
orientation: horizontal;
// Button emoji_button {
// valign: end;
// icon-name: "emoji-people-symbolic";
// tooltip-text: _("Open Emoji Picker");
// halign: start;
// clicked => $on_emoji();
// }
ScrolledWindow scrolled_window {
vexpand: true;
hexpand: true;
vscrollbar-policy: external;
max-content-height: 200;
propagate-natural-height: true;
}
Button ask_button {
valign: end;
icon-name: "paper-plane-symbolic";
tooltip-text: _("Ask");
halign: end;
clicked => $on_ask();
styles ["suggested-action", "circular"]
}
}
styles ["small-pill", "toolbar" ]
}
};
};
}
}
Adw.Breakpoint {
condition ("max-width: 400sp")
setters {
split_view.collapsed: true;
}
}
Adw.Breakpoint {
condition ("max-width: 500sp")
apply => $mobile_mode_apply();
unapply => $mobile_mode_unapply();
setters {
split_view.sidebar-width-fraction: 0.33;
split_view.collapsed: true;
}
}
}
menu main-menu {
item {
label: _("Preferences");
action: "app.preferences";
}
item {
label: _("Keyboard Shortcuts");
action: "win.show-help-overlay";
}
item {
label: _("About Bavarder");
action: "app.about";
}
}