Allow title text to be set per app
This commit is contained in:
parent
6b2eb8155f
commit
51610fdc23
4 changed files with 9 additions and 8 deletions
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"app_title": "Deja-vu: Clone Tool",
|
||||
"app_title": "Deja-vu",
|
||||
"clone_app_path": "C:/Program Files/Some Clone Tool/app.exe",
|
||||
"keybindings": {
|
||||
"ScanDisks": {
|
||||
|
|
|
|||
|
|
@ -27,11 +27,15 @@ use crate::{action::Action, config::Config};
|
|||
pub struct Title {
|
||||
command_tx: Option<UnboundedSender<Action>>,
|
||||
config: Config,
|
||||
text: String,
|
||||
}
|
||||
|
||||
impl Title {
|
||||
pub fn new() -> Self {
|
||||
Self::default()
|
||||
pub fn new(text: &str) -> Self {
|
||||
Self {
|
||||
text: String::from(text),
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -56,7 +60,7 @@ impl Component for Title {
|
|||
fn draw(&mut self, frame: &mut Frame, area: Rect) -> Result<()> {
|
||||
// Title Block
|
||||
let title_text = Span::styled(
|
||||
self.config.app_title.as_str(),
|
||||
format!("{}: {}", self.config.app_title.as_str(), self.text),
|
||||
Style::default().fg(Color::LightCyan),
|
||||
);
|
||||
let title = Paragraph::new(Line::from(title_text).centered())
|
||||
|
|
|
|||
|
|
@ -20,8 +20,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]
|
||||
core = { path = "../core" }
|
||||
color-eyre = "0.6.3"
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@
|
|||
//
|
||||
// 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 core::{
|
||||
action::Action,
|
||||
|
|
@ -77,7 +76,7 @@ impl App {
|
|||
action_rx,
|
||||
action_tx,
|
||||
components: vec![
|
||||
Box::new(Title::new()),
|
||||
Box::new(Title::new("Clone Tool")),
|
||||
Box::new(FpsCounter::new()),
|
||||
Box::new(Left::new()),
|
||||
Box::new(Right::new()),
|
||||
|
|
|
|||
Loading…
Reference in a new issue