mirror of
https://github.com/arabianq/pipewire-soundpad.git
synced 2026-04-27 22:11:22 +00:00
new app::run function
This commit is contained in:
+25
-1
@@ -1,4 +1,4 @@
|
||||
use eframe::{CreationContext, Frame};
|
||||
use eframe::{CreationContext, Frame, NativeOptions};
|
||||
use egui::{
|
||||
Button, CentralPanel, ComboBox, Context, Label, ScrollArea, Separator, Slider, TextEdit, Ui,
|
||||
Vec2,
|
||||
@@ -455,3 +455,27 @@ impl eframe::App for App {
|
||||
CentralPanel::default().show(ctx, |ui| self.upd(ui, ctx, frame));
|
||||
}
|
||||
}
|
||||
|
||||
pub fn run() -> Result<(), eframe::Error> {
|
||||
let options = NativeOptions {
|
||||
vsync: true,
|
||||
centered: true,
|
||||
hardware_acceleration: eframe::HardwareAcceleration::Preferred,
|
||||
|
||||
viewport: egui::ViewportBuilder::default()
|
||||
.with_app_id("ru.arabianq.pwsp")
|
||||
.with_inner_size(Vec2::new(800.0, 600.0))
|
||||
.with_min_inner_size(Vec2::new(400.0, 400.0)),
|
||||
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
eframe::run_native(
|
||||
"PipeWire SoundPad",
|
||||
options,
|
||||
Box::new(|cc| {
|
||||
egui_material_icons::initialize(&cc.egui_ctx);
|
||||
Ok(Box::new(App::new(cc)))
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
+1
-19
@@ -1,28 +1,10 @@
|
||||
use eframe::NativeOptions;
|
||||
use egui::Vec2;
|
||||
use std::fs;
|
||||
use std::fs::create_dir;
|
||||
|
||||
mod app;
|
||||
|
||||
fn main() -> Result<(), eframe::Error> {
|
||||
create_dirs();
|
||||
|
||||
let mut options = NativeOptions {
|
||||
..Default::default()
|
||||
};
|
||||
options.viewport.min_inner_size = Some(Vec2::new(400.0, 400.0));
|
||||
options.vsync = true;
|
||||
options.hardware_acceleration = eframe::HardwareAcceleration::Preferred;
|
||||
|
||||
eframe::run_native(
|
||||
"PipeWire SoundPad",
|
||||
options,
|
||||
Box::new(|cc| {
|
||||
egui_material_icons::initialize(&cc.egui_ctx);
|
||||
Ok(Box::new(app::App::new(cc)))
|
||||
}),
|
||||
)
|
||||
app::run()
|
||||
}
|
||||
|
||||
fn create_dirs() {
|
||||
|
||||
Reference in New Issue
Block a user