Compare commits

...

2 commits

Author SHA1 Message Date
81aa7a8984
Update pe_menu title 2025-01-11 22:38:53 -08:00
da1892710f
Load title from config file 2025-01-11 22:37:07 -08:00
7 changed files with 11 additions and 11 deletions

View file

@ -1,3 +0,0 @@
export DEJA_VU_CONFIG=`pwd`/config
export DEJA_VU_DATA=`pwd`/data
export DEJA_VU_LOG_LEVEL=debug

View file

@ -21,7 +21,6 @@ edition = "2021"
license = "GPL"
version = "0.2.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]

View file

@ -1,4 +1,5 @@
{
"app_title": "Deja-vu: Clone Tool",
"clone_app_path": "C:/Program Files/Some Clone Tool/app.exe",
"keybindings": {
"ScanDisks": {

View file

@ -13,6 +13,7 @@
// You should have received a copy of the GNU General Public License
// along with Deja-vu. If not, see <https://www.gnu.org/licenses/>.
//
use std::{
env,
iter::zip,

View file

@ -56,7 +56,7 @@ impl Component for Title {
fn draw(&mut self, frame: &mut Frame, area: Rect) -> Result<()> {
// Title Block
let title_text = Span::styled(
"WizardKit: Clone Tool",
self.config.app_title.as_str(),
Style::default().fg(Color::LightCyan),
);
let title = Paragraph::new(Line::from(title_text).centered())

View file

@ -40,6 +40,8 @@ pub struct AppConfig {
#[derive(Clone, Debug, Default, Deserialize)]
pub struct Config {
#[serde(default)]
pub app_title: String,
#[serde(default)]
pub clone_app_path: PathBuf,
#[serde(default, flatten)]
@ -68,12 +70,13 @@ impl Config {
let data_dir = get_data_dir();
let config_dir = get_config_dir();
let mut builder = config::Config::builder()
.set_default("data_dir", data_dir.to_str().unwrap())?
.set_default("config_dir", config_dir.to_str().unwrap())?
.set_default("app_title", default_config.app_title.as_str())?
.set_default(
"clone_app_path",
String::from("C:\\Program Files\\Some Clone Tool\\app.exe"),
)?;
)?
.set_default("config_dir", config_dir.to_str().unwrap())?
.set_default("data_dir", data_dir.to_str().unwrap())?;
let config_files = [
("config.json5", config::FileFormat::Json5),
@ -95,7 +98,6 @@ impl Config {
if !found_config {
error!("No configuration file found. Application may not behave as expected");
}
let mut cfg: Self = builder.build()?.try_deserialize()?;
for (mode, default_bindings) in default_config.keybindings.iter() {
@ -140,7 +142,7 @@ pub fn get_config_dir() -> PathBuf {
}
fn project_directory() -> Option<ProjectDirs> {
ProjectDirs::from("com", "WizardKit", env!("CARGO_PKG_NAME"))
ProjectDirs::from("com", "Deja-vu", env!("CARGO_PKG_NAME"))
}
#[derive(Clone, Debug, Default, Deref, DerefMut)]

View file

@ -34,7 +34,7 @@ pub fn render(app: &mut App, frame: &mut Frame) {
.split(frame.size());
// Title Block
let title_text = Span::styled("WizardKit: PE Menu", Style::default().fg(Color::LightCyan));
let title_text = Span::styled("Deja-vu: PE Menu", Style::default().fg(Color::LightCyan));
let title = Paragraph::new(Line::from(title_text).centered())
.block(Block::default().borders(Borders::ALL));
frame.render_widget(title, chunks[0]);