Skip to content

Commit

Permalink
Continued work
Browse files Browse the repository at this point in the history
  • Loading branch information
geom3trik committed Sep 5, 2024
1 parent 50018a5 commit 397b8f8
Show file tree
Hide file tree
Showing 13 changed files with 221 additions and 202 deletions.
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ version = "0.1.0"
edition = "2021"

[dependencies]
# vizia = {git = "https://github.com/vizia/vizia", branch = "skia"}
vizia = {path = "../vizia"}
vizia = {git = "https://github.com/vizia/vizia"}
# vizia = {path = "../vizia"}
rusqlite = { version = "0.32", features = ["bundled", "chrono"] }
chrono = { version = "0.4.26", features = ["serde"]}
serde = { version = "1.0.177", features = ["derive"] }
Expand All @@ -25,7 +25,7 @@ num-derive = "0.4"
image = {version = "0.25", default-features = false, features = ["png"]}
thiserror = "1.0"
rfd = "0.14"
creek = "*"
creek = {version = "1.2.2", default-features = false, features = ["decode", "decode-all"]}
rubato = "*"

[profile.dev.package."*"]
Expand Down
111 changes: 0 additions & 111 deletions config.ron

This file was deleted.

10 changes: 8 additions & 2 deletions resources/themes/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ menubutton {
corner-radius: 0px;
}

submenu {
background-color: transparent;
}

menubutton label {
width: 1s;
overflow: hidden;
Expand Down Expand Up @@ -152,7 +156,7 @@ divider {
}

popup {
background-color: #353535;
background-color: #d61515;
}

submenu.panel-menu {
Expand Down Expand Up @@ -372,6 +376,7 @@ toggle-button {
toggle-button > svg {
fill: #ebebeb;
size: 1s;
space: 4px;
}

toggle-button:checked {
Expand Down Expand Up @@ -766,13 +771,14 @@ resize-handle:disabled {
.transport-controls button {
size: 28px;
background-color: transparent;
child-space: 1s;
}

.transport-controls button:hover {
background-color: #252525;
}

.transport-controls button > svg {
.transport-controls svg {
fill: #ebebeb;
size: 20px;
}
Expand Down
7 changes: 5 additions & 2 deletions resources/translations/en-GB/strings.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ show-waveview = Show Waveview Panel
columns = Columns
restore-default-columns = Restore Default Columns
show-all-columns = Show All Columns
path = Path
name = Name
tags = Tags
duration = Duration
sample-rate = Sample Rate
Expand All @@ -42,11 +42,14 @@ size = Size
toggle-fullscreen = Toggle Fullscreen
reset-view = Reset View
help = Help
show-logs = Show Logs...
about = About...
add-tag = Add Tag...
display-mode = Display Mode
settings = Settings
general = General
user-interface = User Interface
Expand Down
16 changes: 16 additions & 0 deletions src/data/config_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ pub struct Config {
pub table_height: f32,
pub waveview_width: f32,

pub browser_visible: bool,
pub tags_visible: bool,
pub waveview_visible: bool,

pub libraries: HashSet<PathBuf>,

pub recents: Vec<PathBuf>,
Expand All @@ -29,6 +33,11 @@ impl Config {
browser_height: 500.0,
window_position: (0, 0),
window_size: (1400, 800),

browser_visible: true,
tags_visible: true,
waveview_visible: true,

..Default::default()
}
}
Expand Down Expand Up @@ -56,6 +65,10 @@ pub enum ConfigEvent {
SetTableHeight(f32),
SetBrowserHeight(f32),
SetWaveviewWidth(f32),

ToggleBrowserVisibility,
ToggleTagsVisibility,
ToggleWaveviewVisibility,
}

impl Model for Config {
Expand All @@ -68,6 +81,9 @@ impl Model for Config {
ConfigEvent::SetTableHeight(height) => self.table_height = height,
ConfigEvent::SetBrowserHeight(height) => self.browser_height = height,
ConfigEvent::SetWaveviewWidth(width) => self.waveview_width = width,
ConfigEvent::ToggleBrowserVisibility => self.browser_visible ^= true,
ConfigEvent::ToggleTagsVisibility => self.tags_visible ^= true,
ConfigEvent::ToggleWaveviewVisibility => self.waveview_visible ^= true,
})
}
}
13 changes: 10 additions & 3 deletions src/data/samples_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ use vizia::prelude::*;

#[derive(Debug, Lens, Clone, Default)]
pub struct SamplesData {
pub table_headers: Vec<String>,
pub table_headers: Vec<(String, bool)>,
pub table_rows: Vec<AudioFile>,
pub selected: Option<usize>,
}

impl SamplesData {
pub fn new() -> Self {
let headers = vec![
"Path",
"Name",
"Tags",
"Duration",
"Sample Rate",
Expand All @@ -27,7 +27,7 @@ impl SamplesData {
"",
]
.iter_mut()
.map(|v| v.to_string())
.map(|v| (v.to_string(), true))
.collect::<Vec<_>>();

Self { table_headers: headers, ..Default::default() }
Expand All @@ -40,6 +40,9 @@ pub enum SampleEvent {
Deselect,
SelectNext,
SelectPrev,
HideColumn(usize),
ShowColumn(usize),
ToggleColumn(usize),
}

impl Model for SamplesData {
Expand Down Expand Up @@ -75,6 +78,10 @@ impl Model for SamplesData {
}
}

SampleEvent::ToggleColumn(index) => {
self.table_headers[*index].1 ^= true;
}

_ => {}
});
}
Expand Down
6 changes: 4 additions & 2 deletions src/database/audio_file.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::path::PathBuf;

use vizia::prelude::*;

use super::{CollectionID, Database, DatabaseConnectionHandle, DatabaseError};
Expand Down Expand Up @@ -85,7 +87,7 @@ impl DatabaseAudioFileHandler for Database {
"SELECT id, name, collection, duration, sample_rate, bit_depth, num_channels, bpm, key, size FROM audio_files WHERE collection = (?1)",
)?;

let collections = query.query_map([parent], |row| {
let audio_files = query.query_map([parent], |row| {
Ok(AudioFile {
id: row.get(0)?,
name: row.get(1)?,
Expand All @@ -100,7 +102,7 @@ impl DatabaseAudioFileHandler for Database {
})
})?;

return Ok(collections.map(|v| v.unwrap()).collect());
return Ok(audio_files.map(|v| v.unwrap()).collect());
}
Err(DatabaseError::ConnectionClosed)
}
Expand Down
Loading

0 comments on commit 397b8f8

Please sign in to comment.