Skip to content

Commit

Permalink
v2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Ehrhart authored and Matthew Ehrhart committed Apr 18, 2022
1 parent c2afa1b commit e12707b
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 48 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "minty"
version = "0.1.1"
version = "2.0.0"
edition = "2021"
authors = ["mjehrhart <https://github.com/mjehrhart>"]
license = "MIT"
Expand Down
64 changes: 36 additions & 28 deletions src/app/controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ pub struct Application {
pub image_run: RetainedImage,
pub image_timer: RetainedImage,
pub image: RetainedImage,
pub image2: RetainedImage,
pub image_delete: RetainedImage,
//
pub sort_by: [String; 3],
pub sort_by_index: usize,
Expand Down Expand Up @@ -116,27 +116,27 @@ impl Application {
fuzzy_search: String::from(""),
//
image_checkbox_audios: RetainedImage::from_image_bytes(
"Checkbox1",
"Audio_Checkbox",
include_bytes!("../../resources/unchecked.png"),
)
.unwrap(),
image_checkbox_documents: RetainedImage::from_image_bytes(
"Checkbox1",
"Document_Checkbox",
include_bytes!("../../resources/checked.png"),
)
.unwrap(),
image_checkbox_images: RetainedImage::from_image_bytes(
"Checkbox1",
"Image_Checkbox",
include_bytes!("../../resources/unchecked.png"),
)
.unwrap(),
image_checkbox_others: RetainedImage::from_image_bytes(
"Checkbox1",
"Other_Checkbox",
include_bytes!("../../resources/unchecked.png"),
)
.unwrap(),
image_checkbox_videos: RetainedImage::from_image_bytes(
"Checkbox1",
"Video_Checkbox",
include_bytes!("../../resources/unchecked.png"),
)
.unwrap(),
Expand All @@ -147,28 +147,28 @@ impl Application {
)
.unwrap(),
image_run: RetainedImage::from_image_bytes(
"Filter",
"Run",
include_bytes!("../../resources/play.png"),
)
.unwrap(),
image_directory: RetainedImage::from_image_bytes(
"Filter",
"Directory",
include_bytes!("../../resources/folder.png"),
)
.unwrap(),
image_timer: RetainedImage::from_image_bytes(
"Filter",
"Time",
include_bytes!("../../resources/chronometer.png"),
)
.unwrap(),
image: RetainedImage::from_image_bytes(
"Filter",
"Audio",
include_bytes!("../../resources/checked.png"),
)
.unwrap(),
image2: RetainedImage::from_svg_bytes(
"Settings",
include_bytes!("../../resources/settings.svg"),
image_delete: RetainedImage::from_image_bytes(
"Delete",
include_bytes!("../../resources/delete-3.png"),
)
.unwrap(),
}
Expand Down Expand Up @@ -225,13 +225,19 @@ impl epi::App for Application {
egui::TopBottomPanel::bottom("bottom_sub_panel")
.frame(frame_style_1)
.show(ctx, |ui| {
// BUTTON DELETE ROW

// BUTTON DELETE ROW
let image_size = self.image_delete.size_vec2();
let image_button = egui::ImageButton::new(
self.image_delete.texture_id(ctx),
[image_size.x / 32., image_size.y / 32.],
)
.frame(true);

ui.add_visible_ui(self.show_delete_button, |ui| {

if ui
.add(egui::Button::new(
egui::RichText::new("Delete Below").color(egui::Color32::LIGHT_RED), //.monospace(),
))
.add(image_button)
.clicked()
{
// EVENT DELETE ITEMS
Expand Down Expand Up @@ -280,16 +286,18 @@ impl epi::App for Application {
for item in self.finder.data_set.iter() {
let (k, v) = item;

// BUG HERE
let dt = DupeTable {
name: v[0].name.to_string(),
count: v.len().try_into().unwrap(),
checksum: k.to_string(),
list: v.to_vec(),
file_type: v[0].file_type,
visible: true,
};
self.dupe_table.push(dt);
if v.len() > 0 {
// BUG HERE
let dt = DupeTable {
name: v[0].name.to_string(),
count: v.len().try_into().unwrap(),
checksum: k.to_string(),
list: v.to_vec(),
file_type: v[0].file_type,
visible: true,
};
self.dupe_table.push(dt);
}
}

// Clear staging before loading it
Expand Down Expand Up @@ -432,7 +440,7 @@ impl epi::App for Application {
}

fn on_exit(&mut self) {
println!("exiting...")
// DO Nothing
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/app/pager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::enums::enums;

impl Application {
//
pub fn pager(&mut self, ui: &mut egui::Ui, ctx: &egui::Context) {
pub fn pager(&mut self, ui: &mut egui::Ui ) {
egui::Grid::new("grid_pager_main")
.spacing(egui::Vec2::new(0.0, 0.0))
.show(ui, |ui| {
Expand Down
2 changes: 1 addition & 1 deletion src/app/table_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ impl Application {
egui::TopBottomPanel::bottom("bottom_sub_panel_pager")
.frame(frame_style_1)
.show(ctx, |ui| {
self::Application::pager(self, ui, ctx);
self::Application::pager(self, ui );
ui.add_space(5.0);
});
}
Expand Down
26 changes: 10 additions & 16 deletions src/app/top_panel.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
use std::net::ToSocketAddrs;

use egui::Color32;
use egui::Color32;
use fuzzy_matcher::skim::SkimMatcherV2;
use fuzzy_matcher::FuzzyMatcher;

Expand Down Expand Up @@ -164,23 +162,19 @@ impl Application {

if self.dupe_table.len() > pager_size {
let quot = self.dupe_table.len() / pager_size;
let rem = self.dupe_table.len() % pager_size;
// println!("quot {}", quot);
// println!("rem {}", rem);
//let rem = self.dupe_table.len() % pager_size;

for i in 0..quot {
let y = (i + 1) * pager_size;
let x = y - pager_size;

//println!("[x..y]: [{}..{}]", x, y);

let v = self.dupe_table[x..y].to_vec();
self.staging.push(v.clone());
}
//rem
{
let y = quot * pager_size;
let x = y - rem;

//println!("![x..y]: [{}..{}]", x, y);
let y = quot * pager_size;

let v = self.dupe_table[y..].to_vec();
self.staging.push(v);
}
Expand Down Expand Up @@ -254,7 +248,7 @@ impl Application {

if self.dupe_table.len() > pager_size {
let quot = self.dupe_table.len() / pager_size;
let rem = self.dupe_table.len() % pager_size;
//let rem = self.dupe_table.len() % pager_size;

for i in 0..quot {
let y = (i + 1) * pager_size;
Expand All @@ -266,7 +260,7 @@ impl Application {
//rem
{
let y = quot * pager_size;
let x = y - rem;

let v = self.dupe_table[y..].to_vec();
self.staging.push(v);
}
Expand All @@ -290,7 +284,7 @@ impl Application {
);

if response.changed() {
println!("something has changed in fuzzy search");
// DO Nothing
}

if response.lost_focus() && ui.input().key_pressed(egui::Key::Enter) {
Expand All @@ -302,7 +296,7 @@ impl Application {
matcher.fuzzy_match(&collection.name, &self.fuzzy_search);

match res {
Some(a) => {
Some(_) => {
collection.visible = true;
}
None => {
Expand Down

0 comments on commit e12707b

Please sign in to comment.