This commit is contained in:
parent
15b5966108
commit
c886d18134
15 changed files with 2123 additions and 1563 deletions
3226
Cargo.lock
generated
3226
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
15
Cargo.toml
15
Cargo.toml
|
@ -8,7 +8,7 @@ description = "A cli presentation system"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clap = { version = "4.5.20", features = ["debug", "derive"] }
|
clap = { version = "4.5.20", features = ["debug", "derive"] }
|
||||||
libcosmic = { git = "https://github.com/pop-os/libcosmic", default-features = false, features = ["debug", "winit", "desktop", "winit_wgpu", "winit_tokio", "tokio", "rfd", "dbus-config", "a11y", "wgpu", "multi-window"] }
|
# libcosmic = { git = "https://github.com/pop-os/libcosmic", default-features = false, features = ["debug", "winit", "desktop", "winit_wgpu", "winit_tokio", "tokio", "rfd", "dbus-config", "a11y", "wgpu", "multi-window"] }
|
||||||
lexpr = "0.2.7"
|
lexpr = "0.2.7"
|
||||||
miette = { version = "7.2.0", features = ["fancy"] }
|
miette = { version = "7.2.0", features = ["fancy"] }
|
||||||
pretty_assertions = "1.4.1"
|
pretty_assertions = "1.4.1"
|
||||||
|
@ -37,12 +37,17 @@ rayon = "1.11.0"
|
||||||
# femtovg = { version = "0.16.0", features = ["wgpu"] }
|
# femtovg = { version = "0.16.0", features = ["wgpu"] }
|
||||||
# wgpu = "26.0.1"
|
# wgpu = "26.0.1"
|
||||||
# mupdf = "0.5.0"
|
# mupdf = "0.5.0"
|
||||||
# rfd = { version = "0.12.1", features = ["xdg-portal"], default-features = false }
|
rfd = { version = "0.12.1", features = ["xdg-portal"], default-features = false }
|
||||||
|
|
||||||
|
[dependencies.iced]
|
||||||
|
git = "https://github.com/iced-rs/iced"
|
||||||
|
branch = "master"
|
||||||
|
features = ["wgpu", "image", "advanced", "svg", "canvas", "hot", "debug", "lazy", "tokio"]
|
||||||
|
|
||||||
[dependencies.iced_video_player]
|
[dependencies.iced_video_player]
|
||||||
git = "https://github.com/jackpot51/iced_video_player.git"
|
git = "https://github.com/jazzfool/iced_video_player.git"
|
||||||
branch = "cosmic"
|
branch = "master"
|
||||||
features = ["wgpu"]
|
# branch = "cosmic"
|
||||||
|
|
||||||
# [profile.dev]
|
# [profile.dev]
|
||||||
# opt-level = 3
|
# opt-level = 3
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use std::mem::replace;
|
use std::mem::replace;
|
||||||
|
|
||||||
use cosmic::iced::Executor;
|
use iced::iced::Executor;
|
||||||
use miette::{miette, Result};
|
use miette::{miette, Result};
|
||||||
use sqlx::{Connection, SqliteConnection};
|
use sqlx::{Connection, SqliteConnection};
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,8 @@ use std::cmp::Ordering;
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use cosmic::iced::clipboard::mime::{AllowedMimeTypes, AsMimeTypes};
|
|
||||||
use crisp::types::{Keyword, Symbol, Value};
|
use crisp::types::{Keyword, Symbol, Value};
|
||||||
|
use iced::iced::clipboard::mime::{AllowedMimeTypes, AsMimeTypes};
|
||||||
use miette::Result;
|
use miette::Result;
|
||||||
use tracing::{debug, error};
|
use tracing::{debug, error};
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// use cosmic::dialog::ashpd::url::Url;
|
// use iced::dialog::ashpd::url::Url;
|
||||||
use crisp::types::{Keyword, Symbol, Value};
|
use crisp::types::{Keyword, Symbol, Value};
|
||||||
use iced_video_player::Video;
|
use iced_video_player::Video;
|
||||||
use miette::{miette, Result};
|
use miette::{miette, Result};
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use std::{collections::HashMap, option::Option, path::PathBuf};
|
use std::{collections::HashMap, option::Option, path::PathBuf};
|
||||||
|
|
||||||
use cosmic::iced::Executor;
|
|
||||||
use crisp::types::{Keyword, Symbol, Value};
|
use crisp::types::{Keyword, Symbol, Value};
|
||||||
|
use iced::iced::Executor;
|
||||||
use miette::{miette, IntoDiagnostic, Result};
|
use miette::{miette, IntoDiagnostic, Result};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use sqlx::{
|
use sqlx::{
|
||||||
|
|
|
@ -7,8 +7,8 @@ use super::{
|
||||||
service_items::ServiceTrait,
|
service_items::ServiceTrait,
|
||||||
slide::Slide,
|
slide::Slide,
|
||||||
};
|
};
|
||||||
use cosmic::iced::Executor;
|
|
||||||
use crisp::types::{Keyword, Symbol, Value};
|
use crisp::types::{Keyword, Symbol, Value};
|
||||||
|
use iced::iced::Executor;
|
||||||
use miette::{IntoDiagnostic, Result};
|
use miette::{IntoDiagnostic, Result};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use sqlx::{
|
use sqlx::{
|
||||||
|
|
236
src/main.rs
236
src/main.rs
|
@ -2,32 +2,25 @@ use clap::{command, Parser};
|
||||||
use core::service_items::ServiceItem;
|
use core::service_items::ServiceItem;
|
||||||
use core::slide::*;
|
use core::slide::*;
|
||||||
use core::songs::Song;
|
use core::songs::Song;
|
||||||
use cosmic::app::context_drawer::ContextDrawer;
|
|
||||||
use cosmic::app::{Core, Settings, Task};
|
|
||||||
use cosmic::iced::keyboard::{Key, Modifiers};
|
|
||||||
use cosmic::iced::window::{Mode, Position};
|
|
||||||
use cosmic::iced::{self, event, window, Length, Padding, Point};
|
|
||||||
use cosmic::iced_futures::Subscription;
|
|
||||||
use cosmic::iced_widget::{column, row};
|
|
||||||
use cosmic::widget::dnd_destination::{
|
|
||||||
dnd_destination, dnd_destination_for_data,
|
|
||||||
};
|
|
||||||
use cosmic::widget::nav_bar::nav_bar_style;
|
|
||||||
use cosmic::widget::segmented_button::Entity;
|
|
||||||
use cosmic::widget::text;
|
|
||||||
use cosmic::widget::tooltip::Position as TPosition;
|
|
||||||
use cosmic::widget::{
|
|
||||||
button, horizontal_space, nav_bar, search_input, tooltip,
|
|
||||||
vertical_space, Space,
|
|
||||||
};
|
|
||||||
use cosmic::widget::{icon, slider};
|
|
||||||
use cosmic::{executor, Application, ApplicationExt, Element};
|
|
||||||
use cosmic::{prelude::*, theme};
|
|
||||||
use cosmic::{widget::Container, Theme};
|
|
||||||
use crisp::types::Value;
|
use crisp::types::Value;
|
||||||
|
use iced::keyboard::{Key, Modifiers};
|
||||||
|
use iced::theme::{self, Palette};
|
||||||
|
use iced::widget::tooltip::Position as TPosition;
|
||||||
|
use iced::widget::{
|
||||||
|
button, horizontal_space, slider, text, tooltip, vertical_space,
|
||||||
|
Space,
|
||||||
|
};
|
||||||
|
use iced::widget::{column, row};
|
||||||
|
use iced::window::{Mode, Position};
|
||||||
|
use iced::{self, event, window, Length, Padding, Point};
|
||||||
|
use iced::{color, Subscription};
|
||||||
|
use iced::{executor, Application, Element};
|
||||||
|
use iced::{widget::Container, Theme};
|
||||||
|
use iced::{Settings, Task};
|
||||||
use lisp::parse_lisp;
|
use lisp::parse_lisp;
|
||||||
use miette::{miette, Result};
|
use miette::{miette, Result};
|
||||||
use rayon::prelude::*;
|
use rayon::prelude::*;
|
||||||
|
use std::collections::BTreeMap;
|
||||||
use std::fs::read_to_string;
|
use std::fs::read_to_string;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use tracing::{debug, level_filters::LevelFilter};
|
use tracing::{debug, level_filters::LevelFilter};
|
||||||
|
@ -86,20 +79,19 @@ fn main() -> Result<()> {
|
||||||
.is_daemon(true);
|
.is_daemon(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
cosmic::app::run::<App>(settings, args)
|
iced::daemon(move || App::init(args), App::update, App::view)
|
||||||
|
.settings(settings)
|
||||||
|
.subscription(App::subsrciption)
|
||||||
|
.theme(App::theme)
|
||||||
|
.title(App::title)
|
||||||
|
.run()
|
||||||
.map_err(|e| miette!("Invalid things... {}", e))
|
.map_err(|e| miette!("Invalid things... {}", e))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn theme(_state: &App) -> Theme {
|
|
||||||
Theme::dark()
|
|
||||||
}
|
|
||||||
|
|
||||||
struct App {
|
struct App {
|
||||||
core: Core,
|
|
||||||
nav_model: nav_bar::Model,
|
|
||||||
file: PathBuf,
|
file: PathBuf,
|
||||||
presenter: Presenter,
|
presenter: Presenter,
|
||||||
windows: Vec<window::Id>,
|
windows: BTreeMap<window::Id, Window>,
|
||||||
service: Vec<ServiceItem>,
|
service: Vec<ServiceItem>,
|
||||||
current_item: (usize, usize),
|
current_item: (usize, usize),
|
||||||
presentation_open: bool,
|
presentation_open: bool,
|
||||||
|
@ -119,7 +111,7 @@ enum Message {
|
||||||
Library(library::Message),
|
Library(library::Message),
|
||||||
SongEditor(song_editor::Message),
|
SongEditor(song_editor::Message),
|
||||||
File(PathBuf),
|
File(PathBuf),
|
||||||
DndEnter(Entity, Vec<String>),
|
DndEnter(Vec<String>),
|
||||||
DndDrop,
|
DndDrop,
|
||||||
OpenWindow,
|
OpenWindow,
|
||||||
CloseWindow(Option<window::Id>),
|
CloseWindow(Option<window::Id>),
|
||||||
|
@ -130,7 +122,7 @@ enum Message {
|
||||||
Quit,
|
Quit,
|
||||||
Key(Key, Modifiers),
|
Key(Key, Modifiers),
|
||||||
None,
|
None,
|
||||||
DndLeave(Entity),
|
DndLeave(),
|
||||||
EditorToggle(bool),
|
EditorToggle(bool),
|
||||||
SearchFocus,
|
SearchFocus,
|
||||||
ChangeServiceItem(usize),
|
ChangeServiceItem(usize),
|
||||||
|
@ -139,30 +131,42 @@ enum Message {
|
||||||
AppendServiceItem(ServiceItem),
|
AppendServiceItem(ServiceItem),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
struct Window {
|
||||||
|
title: String,
|
||||||
|
scale_input: String,
|
||||||
|
current_scale: f64,
|
||||||
|
theme: Theme,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Default for Window {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self {
|
||||||
|
title: Default::default(),
|
||||||
|
scale_input: Default::default(),
|
||||||
|
current_scale: Default::default(),
|
||||||
|
theme: App::theme(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const HEADER_SPACE: u16 = 6;
|
const HEADER_SPACE: u16 = 6;
|
||||||
|
|
||||||
impl cosmic::Application for App {
|
impl App {
|
||||||
type Executor = executor::Default;
|
|
||||||
type Flags = Cli;
|
|
||||||
type Message = Message;
|
|
||||||
const APP_ID: &'static str = "lumina";
|
const APP_ID: &'static str = "lumina";
|
||||||
fn core(&self) -> &Core {
|
fn init(input: Cli) -> (Self, Task<Self::Message>) {
|
||||||
&self.core
|
|
||||||
}
|
|
||||||
fn core_mut(&mut self) -> &mut Core {
|
|
||||||
&mut self.core
|
|
||||||
}
|
|
||||||
fn init(
|
|
||||||
core: Core,
|
|
||||||
input: Self::Flags,
|
|
||||||
) -> (Self, Task<Self::Message>) {
|
|
||||||
debug!("init");
|
debug!("init");
|
||||||
let nav_model = nav_bar::Model::default();
|
|
||||||
|
|
||||||
let mut windows = vec![];
|
|
||||||
|
|
||||||
|
let mut batch = vec![];
|
||||||
|
let mut windows = BTreeMap::new();
|
||||||
if input.ui {
|
if input.ui {
|
||||||
windows.push(core.main_window_id().unwrap());
|
let settings = window::Settings {
|
||||||
|
..Default::default()
|
||||||
|
};
|
||||||
|
let (id, open) = window::open(settings);
|
||||||
|
batch.push(open);
|
||||||
|
|
||||||
|
windows.insert(id, Window::default());
|
||||||
}
|
}
|
||||||
|
|
||||||
let items = match read_to_string(input.file) {
|
let items = match read_to_string(input.file) {
|
||||||
|
@ -202,8 +206,6 @@ impl cosmic::Application for App {
|
||||||
|
|
||||||
let mut app = App {
|
let mut app = App {
|
||||||
presenter,
|
presenter,
|
||||||
core,
|
|
||||||
nav_model,
|
|
||||||
service: items,
|
service: items,
|
||||||
file: PathBuf::default(),
|
file: PathBuf::default(),
|
||||||
windows,
|
windows,
|
||||||
|
@ -219,8 +221,6 @@ impl cosmic::Application for App {
|
||||||
library_dragged_item: None,
|
library_dragged_item: None,
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut batch = vec![];
|
|
||||||
|
|
||||||
if input.ui {
|
if input.ui {
|
||||||
debug!("main view");
|
debug!("main view");
|
||||||
batch.push(app.update_title())
|
batch.push(app.update_title())
|
||||||
|
@ -235,39 +235,34 @@ impl cosmic::Application for App {
|
||||||
(app, batch)
|
(app, batch)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Allows COSMIC to integrate with your application's [`nav_bar::Model`].
|
fn nav_bar(&self) -> Option<Element<Message>> {
|
||||||
fn nav_model(&self) -> Option<&nav_bar::Model> {
|
|
||||||
Some(&self.nav_model)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn nav_bar(&self) -> Option<Element<cosmic::Action<Message>>> {
|
|
||||||
if !self.core().nav_bar_active() {
|
if !self.core().nav_bar_active() {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
// let nav_model = self.nav_model()?;
|
// let nav_model = self.nav_model()?;
|
||||||
|
|
||||||
// let mut nav = cosmic::widget::nav_bar(nav_model, |id| {
|
// let mut nav = iced::widget::nav_bar(nav_model, |id| {
|
||||||
// cosmic::Action::Cosmic(cosmic::app::Action::NavBar(id))
|
// iced::Action::Iced(iced::app::Action::NavBar(id))
|
||||||
// })
|
// })
|
||||||
// .on_dnd_drop::<ServiceItem>(|entity, data, action| {
|
// .on_dnd_drop::<ServiceItem>(|entity, data, action| {
|
||||||
// debug!(?entity);
|
// debug!(?entity);
|
||||||
// debug!(?data);
|
// debug!(?data);
|
||||||
// debug!(?action);
|
// debug!(?action);
|
||||||
// cosmic::Action::App(Message::DndDrop)
|
// iced::Action::App(Message::DndDrop)
|
||||||
// })
|
// })
|
||||||
// .on_dnd_enter(|entity, data| {
|
// .on_dnd_enter(|entity, data| {
|
||||||
// debug!("entered");
|
// debug!("entered");
|
||||||
// cosmic::Action::App(Message::DndEnter(entity, data))
|
// iced::Action::App(Message::DndEnter(entity, data))
|
||||||
// })
|
// })
|
||||||
// .on_dnd_leave(|entity| {
|
// .on_dnd_leave(|entity| {
|
||||||
// debug!("left");
|
// debug!("left");
|
||||||
// cosmic::Action::App(Message::DndLeave(entity))
|
// iced::Action::App(Message::DndLeave(entity))
|
||||||
// })
|
// })
|
||||||
// .drag_id(DragId::new())
|
// .drag_id(DragId::new())
|
||||||
// .on_context(|id| {
|
// .on_context(|id| {
|
||||||
// cosmic::Action::Cosmic(
|
// iced::Action::Iced(
|
||||||
// cosmic::app::Action::NavBarContext(id),
|
// iced::app::Action::NavBarContext(id),
|
||||||
// )
|
// )
|
||||||
// })
|
// })
|
||||||
// .context_menu(None)
|
// .context_menu(None)
|
||||||
|
@ -301,30 +296,30 @@ impl cosmic::Application for App {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.class(cosmic::theme::style::Button::HeaderBar)
|
.class(iced::theme::style::Button::HeaderBar)
|
||||||
.padding(5)
|
.padding(5)
|
||||||
.width(Length::Fill)
|
.width(Length::Fill)
|
||||||
.on_press(cosmic::Action::App(Message::ChangeServiceItem(index)));
|
.on_press(iced::Action::App(Message::ChangeServiceItem(index)));
|
||||||
let tooltip = tooltip(button,
|
let tooltip = tooltip(button,
|
||||||
text::body(item.kind.to_string()),
|
text::body(item.kind.to_string()),
|
||||||
TPosition::Right);
|
TPosition::Right);
|
||||||
dnd_destination(tooltip, vec!["application/service-item".into()])
|
dnd_destination(tooltip, vec!["application/service-item".into()])
|
||||||
.data_received_for::<ServiceItem>( move |item| {
|
.data_received_for::<ServiceItem>( move |item| {
|
||||||
if let Some(item) = item {
|
if let Some(item) = item {
|
||||||
cosmic::Action::App(Message::AddServiceItem(index, item))
|
iced::Action::App(Message::AddServiceItem(index, item))
|
||||||
} else {
|
} else {
|
||||||
cosmic::Action::None
|
iced::Action::None
|
||||||
}
|
}
|
||||||
}).on_drop(move |x, y| {
|
}).on_drop(move |x, y| {
|
||||||
debug!(x, y);
|
debug!(x, y);
|
||||||
cosmic::Action::App(Message::AddServiceItemDrop(index))
|
iced::Action::App(Message::AddServiceItemDrop(index))
|
||||||
}).on_finish(move |mime, data, action, x, y| {
|
}).on_finish(move |mime, data, action, x, y| {
|
||||||
debug!(mime, ?data, ?action, x, y);
|
debug!(mime, ?data, ?action, x, y);
|
||||||
let Ok(item) = ServiceItem::try_from((data, mime)) else {
|
let Ok(item) = ServiceItem::try_from((data, mime)) else {
|
||||||
return cosmic::Action::None;
|
return iced::Action::None;
|
||||||
};
|
};
|
||||||
debug!(?item);
|
debug!(?item);
|
||||||
cosmic::Action::App(Message::AddServiceItem(index, item))
|
iced::Action::App(Message::AddServiceItem(index, item))
|
||||||
})
|
})
|
||||||
.into()
|
.into()
|
||||||
});
|
});
|
||||||
|
@ -339,11 +334,11 @@ impl cosmic::Application for App {
|
||||||
)
|
)
|
||||||
.data_received_for::<ServiceItem>(|item| {
|
.data_received_for::<ServiceItem>(|item| {
|
||||||
if let Some(item) = item {
|
if let Some(item) = item {
|
||||||
cosmic::Action::App(Message::AppendServiceItem(
|
iced::Action::App(Message::AppendServiceItem(
|
||||||
item,
|
item,
|
||||||
))
|
))
|
||||||
} else {
|
} else {
|
||||||
cosmic::Action::None
|
iced::Action::None
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.on_finish(
|
.on_finish(
|
||||||
|
@ -352,10 +347,10 @@ impl cosmic::Application for App {
|
||||||
let Ok(item) =
|
let Ok(item) =
|
||||||
ServiceItem::try_from((data, mime))
|
ServiceItem::try_from((data, mime))
|
||||||
else {
|
else {
|
||||||
return cosmic::Action::None;
|
return iced::Action::None;
|
||||||
};
|
};
|
||||||
debug!(?item);
|
debug!(?item);
|
||||||
cosmic::Action::App(Message::AddServiceItem(
|
iced::Action::App(Message::AddServiceItem(
|
||||||
end_index, item,
|
end_index, item,
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
@ -375,16 +370,6 @@ impl cosmic::Application for App {
|
||||||
Some(container.into())
|
Some(container.into())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Called when a navigation item is selected.
|
|
||||||
fn on_nav_select(
|
|
||||||
&mut self,
|
|
||||||
id: nav_bar::Id,
|
|
||||||
) -> Task<Self::Message> {
|
|
||||||
self.nav_model.activate(id);
|
|
||||||
// debug!(?id);
|
|
||||||
self.update_title()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn header_start(&self) -> Vec<Element<Self::Message>> {
|
fn header_start(&self) -> Vec<Element<Self::Message>> {
|
||||||
vec![]
|
vec![]
|
||||||
}
|
}
|
||||||
|
@ -429,7 +414,7 @@ impl cosmic::Application for App {
|
||||||
)
|
)
|
||||||
.spacing(5),
|
.spacing(5),
|
||||||
)
|
)
|
||||||
.class(cosmic::theme::style::Button::HeaderBar)
|
.class(iced::theme::style::Button::HeaderBar)
|
||||||
.on_press(Message::EditorToggle(
|
.on_press(Message::EditorToggle(
|
||||||
self.editor_mode.is_none(),
|
self.editor_mode.is_none(),
|
||||||
)),
|
)),
|
||||||
|
@ -454,7 +439,7 @@ impl cosmic::Application for App {
|
||||||
)
|
)
|
||||||
.spacing(5),
|
.spacing(5),
|
||||||
)
|
)
|
||||||
.class(cosmic::theme::style::Button::HeaderBar)
|
.class(iced::theme::style::Button::HeaderBar)
|
||||||
.on_press({
|
.on_press({
|
||||||
if self.presentation_open {
|
if self.presentation_open {
|
||||||
Message::CloseWindow(
|
Message::CloseWindow(
|
||||||
|
@ -483,7 +468,7 @@ impl cosmic::Application for App {
|
||||||
)
|
)
|
||||||
.spacing(5),
|
.spacing(5),
|
||||||
)
|
)
|
||||||
.class(cosmic::theme::style::Button::HeaderBar)
|
.class(iced::theme::style::Button::HeaderBar)
|
||||||
.on_press(Message::LibraryToggle),
|
.on_press(Message::LibraryToggle),
|
||||||
"Open Library",
|
"Open Library",
|
||||||
TPosition::Bottom,
|
TPosition::Bottom,
|
||||||
|
@ -556,9 +541,8 @@ impl cosmic::Application for App {
|
||||||
|
|
||||||
fn context_drawer(
|
fn context_drawer(
|
||||||
&self,
|
&self,
|
||||||
) -> Option<
|
) -> Option<iced::app::context_drawer::ContextDrawer<Self::Message>>
|
||||||
cosmic::app::context_drawer::ContextDrawer<Self::Message>,
|
{
|
||||||
> {
|
|
||||||
ContextDrawer {
|
ContextDrawer {
|
||||||
title: Some("Context".into()),
|
title: Some("Context".into()),
|
||||||
header_actions: vec![],
|
header_actions: vec![],
|
||||||
|
@ -588,9 +572,7 @@ impl cosmic::Application for App {
|
||||||
match self.song_editor.update(message) {
|
match self.song_editor.update(message) {
|
||||||
song_editor::Action::Task(task) => {
|
song_editor::Action::Task(task) => {
|
||||||
task.map(|m| {
|
task.map(|m| {
|
||||||
cosmic::Action::App(Message::SongEditor(
|
iced::Action::App(Message::SongEditor(m))
|
||||||
m,
|
|
||||||
))
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
song_editor::Action::UpdateSong(song) => {
|
song_editor::Action::UpdateSong(song) => {
|
||||||
|
@ -615,7 +597,7 @@ impl cosmic::Application for App {
|
||||||
match self.presenter.update(message) {
|
match self.presenter.update(message) {
|
||||||
presenter::Action::Task(task) => task.map(|m| {
|
presenter::Action::Task(task) => task.map(|m| {
|
||||||
// debug!("Should run future");
|
// debug!("Should run future");
|
||||||
cosmic::Action::App(Message::Present(m))
|
iced::Action::App(Message::Present(m))
|
||||||
}),
|
}),
|
||||||
presenter::Action::None => Task::none(),
|
presenter::Action::None => Task::none(),
|
||||||
presenter::Action::NextSlide => {
|
presenter::Action::NextSlide => {
|
||||||
|
@ -644,7 +626,7 @@ impl cosmic::Application for App {
|
||||||
match action {
|
match action {
|
||||||
presenter::Action::Task(task) => {
|
presenter::Action::Task(task) => {
|
||||||
tasks.push(task.map(|m| {
|
tasks.push(task.map(|m| {
|
||||||
cosmic::Action::App(
|
iced::Action::App(
|
||||||
Message::Present(m),
|
Message::Present(m),
|
||||||
)
|
)
|
||||||
}))
|
}))
|
||||||
|
@ -665,16 +647,15 @@ impl cosmic::Application for App {
|
||||||
match action {
|
match action {
|
||||||
presenter::Action::Task(
|
presenter::Action::Task(
|
||||||
task,
|
task,
|
||||||
) => {
|
) => tasks.push(task.map(
|
||||||
tasks
|
|m| {
|
||||||
.push(task.map(|m| {
|
iced::Action::App(
|
||||||
cosmic::Action::App(
|
|
||||||
Message::Present(
|
Message::Present(
|
||||||
m,
|
m,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}))
|
},
|
||||||
}
|
)),
|
||||||
_ => todo!(),
|
_ => todo!(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -703,7 +684,7 @@ impl cosmic::Application for App {
|
||||||
match action {
|
match action {
|
||||||
presenter::Action::Task(task) => {
|
presenter::Action::Task(task) => {
|
||||||
tasks.push(task.map(|m| {
|
tasks.push(task.map(|m| {
|
||||||
cosmic::Action::App(
|
iced::Action::App(
|
||||||
Message::Present(m),
|
Message::Present(m),
|
||||||
)
|
)
|
||||||
}))
|
}))
|
||||||
|
@ -739,16 +720,15 @@ impl cosmic::Application for App {
|
||||||
match action {
|
match action {
|
||||||
presenter::Action::Task(
|
presenter::Action::Task(
|
||||||
task,
|
task,
|
||||||
) => {
|
) => tasks.push(task.map(
|
||||||
tasks
|
|m| {
|
||||||
.push(task.map(|m| {
|
iced::Action::App(
|
||||||
cosmic::Action::App(
|
|
||||||
Message::Present(
|
Message::Present(
|
||||||
m,
|
m,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}))
|
},
|
||||||
}
|
)),
|
||||||
_ => todo!(),
|
_ => todo!(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -769,7 +749,7 @@ impl cosmic::Application for App {
|
||||||
}
|
}
|
||||||
library::Action::Task(task) => {
|
library::Action::Task(task) => {
|
||||||
return task.map(|message| {
|
return task.map(|message| {
|
||||||
cosmic::Action::App(Message::Library(
|
iced::Action::App(Message::Library(
|
||||||
message,
|
message,
|
||||||
))
|
))
|
||||||
});
|
});
|
||||||
|
@ -834,9 +814,7 @@ impl cosmic::Application for App {
|
||||||
);
|
);
|
||||||
|
|
||||||
spawn_window.map(|id| {
|
spawn_window.map(|id| {
|
||||||
cosmic::Action::App(Message::WindowOpened(
|
iced::Action::App(Message::WindowOpened(id, None))
|
||||||
id, None,
|
|
||||||
))
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
Message::CloseWindow(id) => {
|
Message::CloseWindow(id) => {
|
||||||
|
@ -849,7 +827,7 @@ impl cosmic::Application for App {
|
||||||
Message::WindowOpened(id, _) => {
|
Message::WindowOpened(id, _) => {
|
||||||
debug!(?id, "Window opened");
|
debug!(?id, "Window opened");
|
||||||
if self.cli_mode
|
if self.cli_mode
|
||||||
|| id > self.core.main_window_id().expect("Cosmic core seems to be missing a main window, was this started in cli mode?")
|
|| id > self.core.main_window_id().expect("Iced core seems to be missing a main window, was this started in cli mode?")
|
||||||
{
|
{
|
||||||
self.presentation_open = true;
|
self.presentation_open = true;
|
||||||
if let Some(video) = &mut self.presenter.video {
|
if let Some(video) = &mut self.presenter.video {
|
||||||
|
@ -884,7 +862,7 @@ impl cosmic::Application for App {
|
||||||
self.library_open = !self.library_open;
|
self.library_open = !self.library_open;
|
||||||
Task::none()
|
Task::none()
|
||||||
}
|
}
|
||||||
Message::Quit => cosmic::iced::exit(),
|
Message::Quit => iced::iced::exit(),
|
||||||
Message::DndEnter(entity, data) => {
|
Message::DndEnter(entity, data) => {
|
||||||
debug!(?entity);
|
debug!(?entity);
|
||||||
debug!(?data);
|
debug!(?data);
|
||||||
|
@ -1106,7 +1084,7 @@ impl cosmic::Application for App {
|
||||||
|
|
||||||
impl App
|
impl App
|
||||||
where
|
where
|
||||||
Self: cosmic::Application,
|
Self: iced::Application,
|
||||||
{
|
{
|
||||||
fn active_page_title(&self) -> &str {
|
fn active_page_title(&self) -> &str {
|
||||||
let Some(label) =
|
let Some(label) =
|
||||||
|
@ -1135,13 +1113,13 @@ where
|
||||||
self.windows.push(id);
|
self.windows.push(id);
|
||||||
_ = self.set_window_title("Lumina Presenter".to_owned(), id);
|
_ = self.set_window_title("Lumina Presenter".to_owned(), id);
|
||||||
spawn_window.map(|id| {
|
spawn_window.map(|id| {
|
||||||
cosmic::Action::App(Message::WindowOpened(id, None))
|
iced::Action::App(Message::WindowOpened(id, None))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn add_library(&mut self) -> Task<Message> {
|
fn add_library(&mut self) -> Task<Message> {
|
||||||
Task::perform(async move { Library::new().await }, |x| {
|
Task::perform(async move { Library::new().await }, |x| {
|
||||||
cosmic::Action::App(Message::AddLibrary(x))
|
iced::Action::App(Message::AddLibrary(x))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1163,7 +1141,7 @@ where
|
||||||
// |x| {
|
// |x| {
|
||||||
// let len = x.len();
|
// let len = x.len();
|
||||||
// debug!(len, "to append: ");
|
// debug!(len, "to append: ");
|
||||||
// cosmic::Action::App(Message::AppendService(x))
|
// iced::Action::App(Message::AppendService(x))
|
||||||
// },
|
// },
|
||||||
// )
|
// )
|
||||||
// }
|
// }
|
||||||
|
@ -1212,6 +1190,20 @@ where
|
||||||
_ => Task::none(),
|
_ => Task::none(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn theme() -> Theme {
|
||||||
|
Theme::custom(
|
||||||
|
"Snazzy",
|
||||||
|
Palette {
|
||||||
|
background: color!(0x282a36),
|
||||||
|
text: color!(0xe2e4e5),
|
||||||
|
primary: color!(0x57c7ff),
|
||||||
|
success: color!(0x5af78e),
|
||||||
|
warning: color!(0xff9f43),
|
||||||
|
danger: color!(0xff5c57),
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use std::ops::RangeInclusive;
|
use std::ops::RangeInclusive;
|
||||||
|
|
||||||
use cosmic::iced::Length;
|
use iced::Length;
|
||||||
|
|
||||||
struct DoubleSlider<'a, T, Message> {
|
struct DoubleSlider<'a, T, Message> {
|
||||||
range: RangeInclusive<T>,
|
range: RangeInclusive<T>,
|
||||||
|
|
|
@ -1,17 +1,14 @@
|
||||||
use cosmic::{
|
use iced::{
|
||||||
iced::{
|
advanced::widget::{tree::State, Widget},
|
||||||
alignment::Vertical, clipboard::dnd::DndAction,
|
alignment::Vertical,
|
||||||
futures::FutureExt, Background, Border, Color, Length,
|
futures::FutureExt,
|
||||||
},
|
|
||||||
iced_core::widget::tree::State,
|
|
||||||
iced_widget::{column, row as rowm, text as textm},
|
|
||||||
theme,
|
theme,
|
||||||
widget::{
|
widget::{
|
||||||
button, container, horizontal_space, icon, mouse_area,
|
button, container, horizontal_space, mouse_area, responsive,
|
||||||
responsive, row, scrollable, text, text_input, Container,
|
row, scrollable, text, text_input, Container, Space,
|
||||||
DndSource, Space, Widget,
|
|
||||||
},
|
},
|
||||||
Element, Task,
|
widget::{column, row as rowm, text as textm},
|
||||||
|
Background, Border, Color, Element, Length, Task,
|
||||||
};
|
};
|
||||||
use miette::{IntoDiagnostic, Result};
|
use miette::{IntoDiagnostic, Result};
|
||||||
use sqlx::{pool::PoolConnection, Sqlite, SqlitePool};
|
use sqlx::{pool::PoolConnection, Sqlite, SqlitePool};
|
||||||
|
@ -332,19 +329,21 @@ impl<'a> Library {
|
||||||
match self.library_hovered {
|
match self.library_hovered {
|
||||||
Some(lib) => Background::Color(
|
Some(lib) => Background::Color(
|
||||||
if lib == model.kind {
|
if lib == model.kind {
|
||||||
t.cosmic().button.hover.into()
|
t.iced().button.hover.into()
|
||||||
} else {
|
} else {
|
||||||
t.cosmic().button.base.into()
|
t.iced().button.base.into()
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
None => Background::Color(
|
None => Background::Color(
|
||||||
t.cosmic().button.base.into(),
|
t.iced().button.base.into(),
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.border(Border::default().rounded(
|
.border(
|
||||||
t.cosmic().corner_radii.radius_s,
|
Border::default().rounded(
|
||||||
))
|
t.iced().corner_radii.radius_s,
|
||||||
|
),
|
||||||
|
)
|
||||||
})
|
})
|
||||||
.center_x(Length::Fill)
|
.center_x(Length::Fill)
|
||||||
.center_y(Length::Shrink);
|
.center_y(Length::Shrink);
|
||||||
|
@ -456,12 +455,9 @@ impl<'a> Library {
|
||||||
.center_x(Length::Fill);
|
.center_x(Length::Fill);
|
||||||
let subtext = container(responsive(|size| {
|
let subtext = container(responsive(|size| {
|
||||||
let color: Color = if item.background().is_some() {
|
let color: Color = if item.background().is_some() {
|
||||||
theme::active().cosmic().accent_text_color().into()
|
theme::active().iced().accent_text_color().into()
|
||||||
} else {
|
} else {
|
||||||
theme::active()
|
theme::active().iced().destructive_text_color().into()
|
||||||
.cosmic()
|
|
||||||
.destructive_text_color()
|
|
||||||
.into()
|
|
||||||
};
|
};
|
||||||
text::body(elide_text(item.subtext(), size.width))
|
text::body(elide_text(item.subtext(), size.width))
|
||||||
.center()
|
.center()
|
||||||
|
@ -490,9 +486,9 @@ impl<'a> Library {
|
||||||
if model.kind == library
|
if model.kind == library
|
||||||
&& selected == index as i32
|
&& selected == index as i32
|
||||||
{
|
{
|
||||||
t.cosmic().accent.selected.into()
|
t.iced().accent.selected.into()
|
||||||
} else {
|
} else {
|
||||||
t.cosmic().button.base.into()
|
t.iced().button.base.into()
|
||||||
}
|
}
|
||||||
} else if let Some((library, hovered)) =
|
} else if let Some((library, hovered)) =
|
||||||
self.hovered_item
|
self.hovered_item
|
||||||
|
@ -500,17 +496,17 @@ impl<'a> Library {
|
||||||
if model.kind == library
|
if model.kind == library
|
||||||
&& hovered == index as i32
|
&& hovered == index as i32
|
||||||
{
|
{
|
||||||
t.cosmic().button.hover.into()
|
t.iced().button.hover.into()
|
||||||
} else {
|
} else {
|
||||||
t.cosmic().button.base.into()
|
t.iced().button.base.into()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
t.cosmic().button.base.into()
|
t.iced().button.base.into()
|
||||||
},
|
},
|
||||||
))
|
))
|
||||||
.border(
|
.border(
|
||||||
Border::default()
|
Border::default()
|
||||||
.rounded(t.cosmic().corner_radii.radius_m),
|
.rounded(t.iced().corner_radii.radius_m),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
.into()
|
.into()
|
||||||
|
|
|
@ -1,29 +1,25 @@
|
||||||
use miette::{IntoDiagnostic, Result};
|
use miette::{IntoDiagnostic, Result};
|
||||||
use std::{fs::File, io::BufReader, path::PathBuf, sync::Arc};
|
use std::{fs::File, io::BufReader, path::PathBuf, sync::Arc};
|
||||||
|
|
||||||
use cosmic::{
|
use iced::{
|
||||||
iced::{
|
alignment::Horizontal,
|
||||||
alignment::Horizontal,
|
border,
|
||||||
border,
|
font::{Family, Stretch, Style, Weight},
|
||||||
font::{Family, Stretch, Style, Weight},
|
widget::{
|
||||||
Background, Border, Color, ContentFit, Font, Length, Shadow,
|
container, image, mouse_area, responsive, scrollable, text,
|
||||||
Vector,
|
Column, Container, Row, Space,
|
||||||
},
|
},
|
||||||
iced_widget::{
|
widget::{
|
||||||
rich_text,
|
rich_text,
|
||||||
scrollable::{
|
scrollable::{
|
||||||
scroll_to, AbsoluteOffset, Direction, Scrollbar,
|
scroll_to, AbsoluteOffset, Direction, Scrollbar,
|
||||||
},
|
},
|
||||||
span, stack, vertical_rule,
|
span, stack, vertical_rule,
|
||||||
},
|
},
|
||||||
prelude::*,
|
Background, Border, Color, ContentFit, Font, Length, Shadow,
|
||||||
widget::{
|
Task, Vector,
|
||||||
container, image, mouse_area, responsive, scrollable, text,
|
|
||||||
Column, Container, Id, Row, Space,
|
|
||||||
},
|
|
||||||
Task,
|
|
||||||
};
|
};
|
||||||
use iced_video_player::{gst_pbutils, Position, Video, VideoPlayer};
|
use iced_video_player::{Position, Video, VideoPlayer};
|
||||||
use rodio::{Decoder, OutputStream, Sink};
|
use rodio::{Decoder, OutputStream, Sink};
|
||||||
use tracing::{debug, error, info, warn};
|
use tracing::{debug, error, info, warn};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
@ -168,7 +164,7 @@ impl Presenter {
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
scroll_id: Id::unique(),
|
scroll_id: Id::unique(),
|
||||||
current_font: cosmic::font::default(),
|
current_font: iced::font::default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -449,7 +445,7 @@ impl Presenter {
|
||||||
.style(move |t| {
|
.style(move |t| {
|
||||||
let mut style =
|
let mut style =
|
||||||
container::Style::default();
|
container::Style::default();
|
||||||
let theme = t.cosmic();
|
let theme = t.iced();
|
||||||
let hovered = self.hovered_slide
|
let hovered = self.hovered_slide
|
||||||
== Some((
|
== Some((
|
||||||
item_index,
|
item_index,
|
||||||
|
@ -504,7 +500,7 @@ impl Presenter {
|
||||||
.padding(10),
|
.padding(10),
|
||||||
)
|
)
|
||||||
.interaction(
|
.interaction(
|
||||||
cosmic::iced::mouse::Interaction::Pointer,
|
iced::iced::mouse::Interaction::Pointer,
|
||||||
)
|
)
|
||||||
.on_move(move |_| {
|
.on_move(move |_| {
|
||||||
Message::HoveredSlide(Some((
|
Message::HoveredSlide(Some((
|
||||||
|
@ -578,7 +574,7 @@ impl Presenter {
|
||||||
// Container::new(container)
|
// Container::new(container)
|
||||||
// .style(move |t| {
|
// .style(move |t| {
|
||||||
// let mut style = container::Style::default();
|
// let mut style = container::Style::default();
|
||||||
// let theme = t.cosmic();
|
// let theme = t.iced();
|
||||||
// let hovered = self.hovered_slide == slide_id;
|
// let hovered = self.hovered_slide == slide_id;
|
||||||
// style.background = Some(Background::Color(
|
// style.background = Some(Background::Color(
|
||||||
// if is_current_slide {
|
// if is_current_slide {
|
||||||
|
@ -617,7 +613,7 @@ impl Presenter {
|
||||||
// .height(100)
|
// .height(100)
|
||||||
// .padding(10),
|
// .padding(10),
|
||||||
// )
|
// )
|
||||||
// .interaction(cosmic::iced::mouse::Interaction::Pointer)
|
// .interaction(iced::iced::mouse::Interaction::Pointer)
|
||||||
// .on_move(move |_| Message::HoveredSlide(slide_id))
|
// .on_move(move |_| Message::HoveredSlide(slide_id))
|
||||||
// .on_exit(Message::HoveredSlide(-1))
|
// .on_exit(Message::HoveredSlide(-1))
|
||||||
// .on_press(Message::SlideChange(slide.clone()));
|
// .on_press(Message::SlideChange(slide.clone()));
|
||||||
|
|
|
@ -1,14 +1,12 @@
|
||||||
use std::{io, path::PathBuf};
|
use std::{io, path::PathBuf};
|
||||||
|
|
||||||
use cosmic::{
|
use iced::{
|
||||||
iced::{Color, Font, Length, Size},
|
|
||||||
prelude::*,
|
|
||||||
widget::{
|
widget::{
|
||||||
self,
|
self,
|
||||||
canvas::{self, Program, Stroke},
|
canvas::{self, Program, Stroke},
|
||||||
container, Canvas,
|
container, Canvas,
|
||||||
},
|
},
|
||||||
Renderer,
|
Color, Font, Length, Renderer, Size,
|
||||||
};
|
};
|
||||||
use tracing::debug;
|
use tracing::debug;
|
||||||
|
|
||||||
|
@ -51,14 +49,14 @@ pub enum SlideError {
|
||||||
|
|
||||||
#[derive(Debug, Default)]
|
#[derive(Debug, Default)]
|
||||||
struct EditorProgram {
|
struct EditorProgram {
|
||||||
mouse_button_pressed: Option<cosmic::iced::mouse::Button>,
|
mouse_button_pressed: Option<iced::iced::mouse::Button>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SlideEditor {
|
impl SlideEditor {
|
||||||
pub fn view<'a>(
|
pub fn view<'a>(
|
||||||
&'a self,
|
&'a self,
|
||||||
font: Font,
|
font: Font,
|
||||||
) -> cosmic::Element<'a, SlideWidget> {
|
) -> iced::Element<'a, SlideWidget> {
|
||||||
container(
|
container(
|
||||||
widget::canvas(&self.program)
|
widget::canvas(&self.program)
|
||||||
.height(Length::Fill)
|
.height(Length::Fill)
|
||||||
|
@ -68,9 +66,9 @@ impl SlideEditor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Ensure to use the `cosmic::Theme and cosmic::Renderer` here
|
/// Ensure to use the `iced::Theme and iced::Renderer` here
|
||||||
/// or else it will not compile
|
/// or else it will not compile
|
||||||
impl<'a> Program<SlideWidget, cosmic::Theme, cosmic::Renderer>
|
impl<'a> Program<SlideWidget, iced::Theme, iced::Renderer>
|
||||||
for EditorProgram
|
for EditorProgram
|
||||||
{
|
{
|
||||||
type State = ();
|
type State = ();
|
||||||
|
@ -79,9 +77,9 @@ impl<'a> Program<SlideWidget, cosmic::Theme, cosmic::Renderer>
|
||||||
&self,
|
&self,
|
||||||
state: &Self::State,
|
state: &Self::State,
|
||||||
renderer: &Renderer,
|
renderer: &Renderer,
|
||||||
theme: &cosmic::Theme,
|
theme: &iced::Theme,
|
||||||
bounds: cosmic::iced::Rectangle,
|
bounds: iced::iced::Rectangle,
|
||||||
cursor: cosmic::iced_core::mouse::Cursor,
|
cursor: iced::iced_core::mouse::Cursor,
|
||||||
) -> Vec<canvas::Geometry<Renderer>> {
|
) -> Vec<canvas::Geometry<Renderer>> {
|
||||||
// We prepare a new `Frame`
|
// We prepare a new `Frame`
|
||||||
let mut frame = canvas::Frame::new(renderer, bounds.size());
|
let mut frame = canvas::Frame::new(renderer, bounds.size());
|
||||||
|
@ -90,7 +88,7 @@ impl<'a> Program<SlideWidget, cosmic::Theme, cosmic::Renderer>
|
||||||
// We create a `Path` representing a simple circle
|
// We create a `Path` representing a simple circle
|
||||||
let circle = canvas::Path::circle(frame.center(), 50.0);
|
let circle = canvas::Path::circle(frame.center(), 50.0);
|
||||||
let border = canvas::Path::rectangle(
|
let border = canvas::Path::rectangle(
|
||||||
cosmic::iced::Point { x: 10.0, y: 10.0 },
|
iced::iced::Point { x: 10.0, y: 10.0 },
|
||||||
Size::new(frame_rect.width, frame_rect.height),
|
Size::new(frame_rect.width, frame_rect.height),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -117,18 +115,18 @@ impl<'a> Program<SlideWidget, cosmic::Theme, cosmic::Renderer>
|
||||||
&self,
|
&self,
|
||||||
_state: &mut Self::State,
|
_state: &mut Self::State,
|
||||||
event: canvas::Event,
|
event: canvas::Event,
|
||||||
bounds: cosmic::iced::Rectangle,
|
bounds: iced::iced::Rectangle,
|
||||||
_cursor: cosmic::iced_core::mouse::Cursor,
|
_cursor: iced::iced_core::mouse::Cursor,
|
||||||
) -> (canvas::event::Status, Option<SlideWidget>) {
|
) -> (canvas::event::Status, Option<SlideWidget>) {
|
||||||
match event {
|
match event {
|
||||||
canvas::Event::Mouse(event) => match event {
|
canvas::Event::Mouse(event) => match event {
|
||||||
cosmic::iced::mouse::Event::CursorEntered => {
|
iced::iced::mouse::Event::CursorEntered => {
|
||||||
debug!("cursor entered")
|
debug!("cursor entered")
|
||||||
}
|
}
|
||||||
cosmic::iced::mouse::Event::CursorLeft => {
|
iced::iced::mouse::Event::CursorLeft => {
|
||||||
debug!("cursor left")
|
debug!("cursor left")
|
||||||
}
|
}
|
||||||
cosmic::iced::mouse::Event::CursorMoved {
|
iced::iced::mouse::Event::CursorMoved {
|
||||||
position,
|
position,
|
||||||
} => {
|
} => {
|
||||||
if bounds.x < position.x
|
if bounds.x < position.x
|
||||||
|
@ -139,16 +137,16 @@ impl<'a> Program<SlideWidget, cosmic::Theme, cosmic::Renderer>
|
||||||
debug!(?position, "cursor moved");
|
debug!(?position, "cursor moved");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cosmic::iced::mouse::Event::ButtonPressed(button) => {
|
iced::iced::mouse::Event::ButtonPressed(button) => {
|
||||||
// self.mouse_button_pressed = Some(button);
|
// self.mouse_button_pressed = Some(button);
|
||||||
debug!(?button, "mouse button pressed")
|
debug!(?button, "mouse button pressed")
|
||||||
}
|
}
|
||||||
cosmic::iced::mouse::Event::ButtonReleased(
|
iced::iced::mouse::Event::ButtonReleased(button) => {
|
||||||
button,
|
debug!(?button, "mouse button released")
|
||||||
) => debug!(?button, "mouse button released"),
|
}
|
||||||
cosmic::iced::mouse::Event::WheelScrolled {
|
iced::iced::mouse::Event::WheelScrolled { delta } => {
|
||||||
delta,
|
debug!(?delta, "scroll wheel")
|
||||||
} => debug!(?delta, "scroll wheel"),
|
}
|
||||||
},
|
},
|
||||||
canvas::Event::Touch(event) => debug!("test"),
|
canvas::Event::Touch(event) => debug!("test"),
|
||||||
canvas::Event::Keyboard(event) => debug!("test"),
|
canvas::Event::Keyboard(event) => debug!("test"),
|
||||||
|
@ -159,9 +157,9 @@ impl<'a> Program<SlideWidget, cosmic::Theme, cosmic::Renderer>
|
||||||
fn mouse_interaction(
|
fn mouse_interaction(
|
||||||
&self,
|
&self,
|
||||||
_state: &Self::State,
|
_state: &Self::State,
|
||||||
_bounds: cosmic::iced::Rectangle,
|
_bounds: iced::iced::Rectangle,
|
||||||
_cursor: cosmic::iced_core::mouse::Cursor,
|
_cursor: iced::iced_core::mouse::Cursor,
|
||||||
) -> cosmic::iced_core::mouse::Interaction {
|
) -> iced::iced_core::mouse::Interaction {
|
||||||
cosmic::iced_core::mouse::Interaction::default()
|
iced::iced_core::mouse::Interaction::default()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,21 +1,17 @@
|
||||||
use std::{io, path::PathBuf};
|
use std::{io, path::PathBuf};
|
||||||
|
|
||||||
use cosmic::{
|
use dirs::font_dir;
|
||||||
dialog::file_chooser::open::Dialog,
|
use iced::{
|
||||||
iced::{
|
advanced::graphics::text::cosmic_text::fontdb,
|
||||||
font::{Family, Stretch, Style, Weight},
|
font::{Family, Stretch, Style, Weight},
|
||||||
Font, Length,
|
|
||||||
},
|
|
||||||
iced_wgpu::graphics::text::cosmic_text::fontdb,
|
|
||||||
iced_widget::row,
|
|
||||||
theme,
|
theme,
|
||||||
|
widget::row,
|
||||||
widget::{
|
widget::{
|
||||||
button, column, combo_box, container, horizontal_space, icon,
|
button, column, combo_box, container, horizontal_space,
|
||||||
scrollable, text, text_editor, text_input,
|
scrollable, text, text_editor, text_input,
|
||||||
},
|
},
|
||||||
Element, Task,
|
Element, Font, Length, Task,
|
||||||
};
|
};
|
||||||
use dirs::font_dir;
|
|
||||||
use iced_video_player::Video;
|
use iced_video_player::Video;
|
||||||
use tracing::{debug, error};
|
use tracing::{debug, error};
|
||||||
|
|
||||||
|
@ -133,7 +129,7 @@ impl SongEditor {
|
||||||
audio: PathBuf::new(),
|
audio: PathBuf::new(),
|
||||||
background: None,
|
background: None,
|
||||||
video: None,
|
video: None,
|
||||||
current_font: cosmic::font::default(),
|
current_font: iced::font::default(),
|
||||||
ccli: "8".to_owned(),
|
ccli: "8".to_owned(),
|
||||||
slide_state: SlideEditor::default(),
|
slide_state: SlideEditor::default(),
|
||||||
}
|
}
|
||||||
|
@ -283,7 +279,7 @@ impl SongEditor {
|
||||||
]
|
]
|
||||||
.into(),
|
.into(),
|
||||||
])
|
])
|
||||||
.spacing(theme::active().cosmic().space_l());
|
.spacing(theme::active().iced().space_l());
|
||||||
column.into()
|
column.into()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -317,7 +313,7 @@ impl SongEditor {
|
||||||
// .collect();
|
// .collect();
|
||||||
// scrollable(
|
// scrollable(
|
||||||
// column::with_children(slides)
|
// column::with_children(slides)
|
||||||
// .spacing(theme::active().cosmic().space_l()),
|
// .spacing(theme::active().iced().space_l()),
|
||||||
// )
|
// )
|
||||||
// .height(Length::Fill)
|
// .height(Length::Fill)
|
||||||
// .width(Length::Fill)
|
// .width(Length::Fill)
|
||||||
|
@ -401,7 +397,7 @@ order",
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.width(theme::active().cosmic().space_xxl());
|
.width(theme::active().iced().space_xxl());
|
||||||
|
|
||||||
let background_selector = button::icon(
|
let background_selector = button::icon(
|
||||||
icon::from_name("folder-pictures-symbolic").scale(2),
|
icon::from_name("folder-pictures-symbolic").scale(2),
|
||||||
|
|
|
@ -4,13 +4,10 @@ use std::{
|
||||||
};
|
};
|
||||||
|
|
||||||
use colors_transform::Rgb;
|
use colors_transform::Rgb;
|
||||||
use cosmic::{
|
use iced::{
|
||||||
iced::{
|
font::{Style, Weight},
|
||||||
font::{Style, Weight},
|
|
||||||
Length, Size,
|
|
||||||
},
|
|
||||||
prelude::*,
|
|
||||||
widget::{container, svg::Handle, Svg},
|
widget::{container, svg::Handle, Svg},
|
||||||
|
Length, Size,
|
||||||
};
|
};
|
||||||
use tracing::error;
|
use tracing::error;
|
||||||
|
|
||||||
|
@ -46,11 +43,11 @@ pub struct Font {
|
||||||
size: u8,
|
size: u8,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<cosmic::font::Font> for Font {
|
impl From<iced::font::Font> for Font {
|
||||||
fn from(value: cosmic::font::Font) -> Self {
|
fn from(value: iced::font::Font) -> Self {
|
||||||
Self {
|
Self {
|
||||||
name: match value.family {
|
name: match value.family {
|
||||||
cosmic::iced::font::Family::Name(name) => {
|
iced::iced::font::Family::Name(name) => {
|
||||||
name.to_string()
|
name.to_string()
|
||||||
}
|
}
|
||||||
_ => "Quicksand Bold".into(),
|
_ => "Quicksand Bold".into(),
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
use cosmic::iced::advanced::layout::{self, Layout};
|
|
||||||
use cosmic::iced::advanced::renderer;
|
|
||||||
use cosmic::iced::advanced::widget::{self, Widget};
|
|
||||||
use cosmic::iced::border;
|
|
||||||
use cosmic::iced::mouse;
|
|
||||||
use cosmic::iced::{Color, Element, Length, Rectangle, Size};
|
|
||||||
use femtovg::renderer::WGPURenderer;
|
use femtovg::renderer::WGPURenderer;
|
||||||
use femtovg::{Canvas, TextContext};
|
use femtovg::{Canvas, TextContext};
|
||||||
|
use iced::iced::advanced::layout::{self, Layout};
|
||||||
|
use iced::iced::advanced::renderer;
|
||||||
|
use iced::iced::advanced::widget::{self, Widget};
|
||||||
|
use iced::iced::border;
|
||||||
|
use iced::iced::mouse;
|
||||||
|
use iced::iced::{Color, Element, Length, Rectangle, Size};
|
||||||
|
|
||||||
pub struct SlideText {
|
pub struct SlideText {
|
||||||
text: String,
|
text: String,
|
||||||
|
@ -23,7 +23,7 @@ impl SlideText {
|
||||||
});
|
});
|
||||||
let surface =
|
let surface =
|
||||||
instance.create_surface(window.clone()).unwrap();
|
instance.create_surface(window.clone()).unwrap();
|
||||||
let adapter = cosmic::iced::wgpu::util::initialize_adapter_from_env_or_default(&instance, Some(&surface))
|
let adapter = iced::iced::wgpu::util::initialize_adapter_from_env_or_default(&instance, Some(&surface))
|
||||||
.await
|
.await
|
||||||
.expect("Failed to find an appropriate adapter");
|
.expect("Failed to find an appropriate adapter");
|
||||||
let (device, queue) = adapter
|
let (device, queue) = adapter
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue