control-center: add color management pane
This commit is contained in:
parent
ba044793dc
commit
6f103eac88
4 changed files with 54 additions and 3 deletions
|
|
@ -1,6 +1,9 @@
|
|||
use {
|
||||
crate::{
|
||||
control_center::{cc_compositor::CompositorPane, cc_idle::IdlePane},
|
||||
control_center::{
|
||||
cc_color_management::ColorManagementPane, cc_compositor::CompositorPane,
|
||||
cc_idle::IdlePane,
|
||||
},
|
||||
egui_adapter::egui_platform::{
|
||||
EggError, EggWindow, EggWindowOwner,
|
||||
icons::{ICON_CLOSE, ICON_DRAG_INDICATOR, ICON_INFO},
|
||||
|
|
@ -30,6 +33,7 @@ use {
|
|||
thiserror::Error,
|
||||
};
|
||||
|
||||
mod cc_color_management;
|
||||
mod cc_compositor;
|
||||
mod cc_idle;
|
||||
mod cc_sidebar;
|
||||
|
|
@ -67,6 +71,7 @@ bitflags! {
|
|||
ControlCenterInterest: u32;
|
||||
CCI_COMPOSITOR,
|
||||
CCI_IDLE,
|
||||
CCI_COLOR_MANAGEMENT,
|
||||
}
|
||||
|
||||
pub struct ControlCenter {
|
||||
|
|
@ -109,6 +114,7 @@ struct PaneState {
|
|||
enum PaneType {
|
||||
Compositor(CompositorPane),
|
||||
Idle(IdlePane),
|
||||
ColorManagement(ColorManagementPane),
|
||||
}
|
||||
|
||||
struct CcBehavior<'a> {
|
||||
|
|
@ -129,6 +135,7 @@ impl Pane {
|
|||
match &self.ty {
|
||||
PaneType::Compositor(v) => v.title(res),
|
||||
PaneType::Idle(v) => v.title(res),
|
||||
PaneType::ColorManagement(v) => v.title(res),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -136,6 +143,7 @@ impl Pane {
|
|||
match &mut self.ty {
|
||||
PaneType::Compositor(p) => p.show(ui),
|
||||
PaneType::Idle(p) => p.show(ui),
|
||||
PaneType::ColorManagement(p) => p.show(ui),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -145,6 +153,7 @@ impl PaneType {
|
|||
match self {
|
||||
PaneType::Compositor(_) => CCI_COMPOSITOR,
|
||||
PaneType::Idle(_) => CCI_IDLE,
|
||||
PaneType::ColorManagement(_) => CCI_COLOR_MANAGEMENT,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -497,7 +506,6 @@ fn bool_ui<R>(
|
|||
});
|
||||
}
|
||||
|
||||
#[expect(dead_code)]
|
||||
fn read_only_bool(ui: &mut Ui, name: &str, old: bool) {
|
||||
read_only_bool_ui(ui, name, |_| (), old);
|
||||
}
|
||||
|
|
|
|||
36
src/control_center/cc_color_management.rs
Normal file
36
src/control_center/cc_color_management.rs
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
use {
|
||||
crate::{
|
||||
control_center::{ControlCenterInner, bool, grid, read_only_bool},
|
||||
state::State,
|
||||
},
|
||||
egui::Ui,
|
||||
std::rc::Rc,
|
||||
};
|
||||
|
||||
pub struct ColorManagementPane {
|
||||
state: Rc<State>,
|
||||
}
|
||||
|
||||
impl ControlCenterInner {
|
||||
pub fn create_color_management_pane(self: &Rc<Self>) -> ColorManagementPane {
|
||||
ColorManagementPane {
|
||||
state: self.state.clone(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ColorManagementPane {
|
||||
pub fn title(&self, res: &mut String) {
|
||||
res.push_str("Color Management");
|
||||
}
|
||||
|
||||
pub fn show(&mut self, ui: &mut Ui) {
|
||||
let s = &self.state;
|
||||
grid(ui, "settings", |ui| {
|
||||
bool(ui, "Enabled", s.color_management_enabled.get(), |b| {
|
||||
s.set_color_management_enabled(b);
|
||||
});
|
||||
read_only_bool(ui, "Available", s.color_management_available());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -10,6 +10,7 @@ use {
|
|||
enum PaneName {
|
||||
Compositor,
|
||||
Idle,
|
||||
ColorManagement,
|
||||
}
|
||||
|
||||
impl PaneName {
|
||||
|
|
@ -17,6 +18,7 @@ impl PaneName {
|
|||
match self {
|
||||
PaneName::Compositor => "Compositor",
|
||||
PaneName::Idle => "Idle",
|
||||
PaneName::ColorManagement => "Color Management",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -45,6 +47,9 @@ impl ControlCenterInner {
|
|||
PaneType::Compositor(self.create_compositor_pane())
|
||||
}
|
||||
PaneName::Idle => PaneType::Idle(self.create_idle_pane()),
|
||||
PaneName::ColorManagement => {
|
||||
PaneType::ColorManagement(self.create_color_management_pane())
|
||||
}
|
||||
};
|
||||
self.open(tree, ty);
|
||||
ui.ctx().request_repaint();
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ use {
|
|||
cmm::{cmm_description::ColorDescription, cmm_manager::ColorManager},
|
||||
compositor::{LIBEI_SOCKET, LogLevel},
|
||||
config::ConfigProxy,
|
||||
control_center::{CCI_COMPOSITOR, CCI_IDLE, ControlCenters},
|
||||
control_center::{CCI_COLOR_MANAGEMENT, CCI_COMPOSITOR, CCI_IDLE, ControlCenters},
|
||||
copy_device::CopyDeviceRegistry,
|
||||
cpu_worker::CpuWorker,
|
||||
criteria::{clm::ClMatcherManager, tlm::TlMatcherManager},
|
||||
|
|
@ -766,6 +766,7 @@ impl State {
|
|||
}
|
||||
|
||||
self.expose_new_singletons();
|
||||
self.trigger_cci(CCI_COLOR_MANAGEMENT);
|
||||
}
|
||||
|
||||
fn reload_cursors(&self) {
|
||||
|
|
@ -1716,6 +1717,7 @@ impl State {
|
|||
pub fn set_color_management_enabled(&self, enabled: bool) {
|
||||
self.color_management_enabled.set(enabled);
|
||||
self.expose_new_singletons();
|
||||
self.trigger_cci(CCI_COLOR_MANAGEMENT);
|
||||
}
|
||||
|
||||
pub fn set_primary_selection_enabled(&self, enabled: bool) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue