diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 26e3495..be60bd5 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -15,8 +15,9 @@
-
+
+
@@ -56,7 +57,7 @@
"cidr.known.project.marker": "true",
"git-widget-placeholder": "master",
"ignore.virus.scanning.warn.message": "true",
- "last_opened_file_path": "D:/Assembly/art_of_64bit_assembly_projects",
+ "last_opened_file_path": "/home/dan/CLionProjects/bibliofile",
"node.js.detected.package.eslint": "true",
"node.js.detected.package.tslint": "true",
"node.js.selected.package.eslint": "(autodetect)",
@@ -124,7 +125,9 @@
-
+
+
+
1687972565061
@@ -154,7 +157,14 @@
1693686100048
-
+
+ 1693686989198
+
+
+
+ 1693686989198
+
+
@@ -187,7 +197,8 @@
-
+
+
diff --git a/Cargo.toml b/Cargo.toml
index 682c24b..01dc0c3 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -6,7 +6,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
+cursive = "0.20.0"
epub = "2.0.0"
scraper = "*"
-tuikit = "0.5.0"
diff --git a/src/main.rs b/src/main.rs
index e305095..1406f88 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -14,8 +14,8 @@ use epub::doc::EpubDoc; //library for navigating epubs
use std::*;
use std::path::Path;
use std::process::exit;
-use tuikit::term::{Term};
-use tuikit::prelude::*;
+use cursive::views::{Dialog, TextView};
+
//this function will determine if Bibliofile has been opened before. If it has not, it will create a library folder under /opt/bibliofile.
fn library_exists(){
@@ -53,49 +53,21 @@ fn epub_func(epub_file: &str){
assert!(doc.is_ok());
let mut doc = doc.unwrap();
- let term: Term<()> = Term::new().unwrap();
-
- let _ = term.print(1, 0, "Use the left and right button to turn the page.\nUp and down scrolls. Press escape or q to quit.");
-
let mut page_num = 1;
+ let title = doc.mdata("title");
-
-
- //If letter q pressed, closes program.
- while let Ok(ev) = term.poll_event() {
- let (width, height) = term.term_size().unwrap();
-
- match ev {
- Event::Key(Key::ESC) | Event::Key(Key::Char('q')) => break,
- Event::Key(Key::Right) => page_num = page_num + 1,
- Event::Key(Key::Left) => page_num = page_num - 1,
- _ => {}
- }
- //This is a really hacky way of doing this.
- //TODO: Remember to make a more elegant way of handling stack underflow.
- if(page_num <= 0){
doc.set_current_page(1);
page_num = 1;
let content = doc.get_current_str();
let str_content = content.unwrap();
let text = html_module::main(str_content.0);
- let _ = term.set_cursor(1, 1);
- let _ = term.print(2, 2, &text);
- let _ = term.present();
- }
- else {
- doc.set_current_page(page_num);
+ let mut siv = cursive::default();
+ siv.add_layer(Dialog::around(TextView::new(text))
+ .title(title.unwrap())
+ .button("Quit", |s| s.quit()));
+ siv.run();
- let content = doc.get_current_str();
- let str_content = content.unwrap();
- let text = html_module::main(str_content.0);
- let _ = term.set_cursor(1, 1);
-
- let _ = term.print(2, 2, &text);
- let _ = term.present();
- }
- }
}
\ No newline at end of file