Added license and bumped version.
This commit is contained in:
parent
a1ffb07125
commit
7ececadd71
13 changed files with 859 additions and 8 deletions
17
src/alarm.rs
17
src/alarm.rs
|
@ -1,3 +1,20 @@
|
|||
// Copyright 2021, Shy.
|
||||
//
|
||||
// This file is part of Kitchentimer.
|
||||
//
|
||||
// Kitchentimer is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Kitchentimer is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Kitchentimer. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::clock::Clock;
|
||||
use crate::consts::{COLOR, LABEL_SIZE_LIMIT};
|
||||
use crate::layout::{Layout, Position};
|
||||
|
|
|
@ -1,3 +1,20 @@
|
|||
// Copyright 2021, Shy.
|
||||
//
|
||||
// This file is part of Kitchentimer.
|
||||
//
|
||||
// Kitchentimer is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Kitchentimer is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Kitchentimer. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
extern crate unicode_segmentation;
|
||||
|
||||
use crate::layout::Layout;
|
||||
|
|
17
src/clock.rs
17
src/clock.rs
|
@ -1,3 +1,20 @@
|
|||
// Copyright 2021, Shy.
|
||||
//
|
||||
// This file is part of Kitchentimer.
|
||||
//
|
||||
// Kitchentimer is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Kitchentimer is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Kitchentimer. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
pub mod font;
|
||||
|
||||
use crate::consts::COLOR;
|
||||
|
|
|
@ -1,3 +1,20 @@
|
|||
// Copyright 2021, Shy.
|
||||
//
|
||||
// This file is part of Kitchentimer.
|
||||
//
|
||||
// Kitchentimer is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Kitchentimer is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Kitchentimer. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
const DIGIT_HEIGHT: u16 = 5;
|
||||
|
||||
pub struct Font {
|
||||
|
|
|
@ -1,3 +1,20 @@
|
|||
// Copyright 2021, Shy.
|
||||
//
|
||||
// This file is part of Kitchentimer.
|
||||
//
|
||||
// Kitchentimer is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Kitchentimer is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Kitchentimer. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
pub const COLOR: [&dyn termion::color::Color; 6] = [
|
||||
&termion::color::LightGreen,
|
||||
&termion::color::LightYellow,
|
||||
|
|
|
@ -1,3 +1,20 @@
|
|||
// Copyright 2021, Shy.
|
||||
//
|
||||
// This file is part of Kitchentimer.
|
||||
//
|
||||
// Kitchentimer is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Kitchentimer is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Kitchentimer. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::clock::Clock;
|
||||
|
||||
pub struct Position {
|
||||
|
|
26
src/lib.rs
26
src/lib.rs
|
@ -1,3 +1,20 @@
|
|||
// Copyright 2021, Shy.
|
||||
//
|
||||
// This file is part of Kitchentimer.
|
||||
//
|
||||
// Kitchentimer is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Kitchentimer is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Kitchentimer. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
extern crate signal_hook;
|
||||
extern crate termion;
|
||||
pub mod alarm;
|
||||
|
@ -360,7 +377,10 @@ pub struct Config {
|
|||
|
||||
impl Config {
|
||||
// Parse command line arguments into "config".
|
||||
pub fn new(args: env::Args, alarm_roster: &mut AlarmRoster) -> Result<Config, String> {
|
||||
pub fn new(
|
||||
args: env::Args,
|
||||
alarm_roster: &mut AlarmRoster
|
||||
) -> Result<Config, String> {
|
||||
let mut config = Config {
|
||||
quit: false,
|
||||
fancy: false,
|
||||
|
@ -482,7 +502,9 @@ fn suspend<W: Write>(stdout: &mut RawTerminal<W>) -> Result<(), std::io::Error>
|
|||
}
|
||||
|
||||
// Set up terminal after SIGTSTP or SIGSTOP.
|
||||
fn restore_after_suspend<W: Write>(stdout: &mut RawTerminal<W>) -> Result<(), std::io::Error> {
|
||||
fn restore_after_suspend<W: Write>(
|
||||
stdout: &mut RawTerminal<W>
|
||||
) -> Result<(), std::io::Error> {
|
||||
stdout.activate_raw_mode().unwrap_or_else(|error| {
|
||||
eprintln!(
|
||||
"Failed to re-enter raw terminal mode after suspend: {}",
|
||||
|
|
17
src/main.rs
17
src/main.rs
|
@ -1,3 +1,20 @@
|
|||
// Copyright 2021, Shy.
|
||||
//
|
||||
// This file is part of Kitchentimer.
|
||||
//
|
||||
// Kitchentimer is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Kitchentimer is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Kitchentimer. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use kitchentimer::{run, AlarmRoster, Config};
|
||||
use std::{env, process};
|
||||
|
||||
|
|
24
src/tests.rs
24
src/tests.rs
|
@ -1,12 +1,30 @@
|
|||
use crate::clock::Clock;
|
||||
// Copyright 2021, Shy.
|
||||
//
|
||||
// This file is part of Kitchentimer.
|
||||
//
|
||||
// Kitchentimer is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Kitchentimer is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Kitchentimer. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::clock::{Clock, font};
|
||||
use crate::layout::Layout;
|
||||
use crate::Config;
|
||||
|
||||
fn default_config() -> Config {
|
||||
Config {
|
||||
plain: false,
|
||||
fancy: false,
|
||||
quit: false,
|
||||
command: None,
|
||||
font: &font::NORMAL,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -15,7 +33,7 @@ fn default_config() -> Config {
|
|||
fn layout_computation() {
|
||||
let config = default_config();
|
||||
let mut clock = Clock::new(&config);
|
||||
let mut layout = Layout::new(&config);
|
||||
let mut layout = Layout::new();
|
||||
|
||||
// Two segment display.
|
||||
for roster_width in &[0, 10, 20, 30, 40] {
|
||||
|
|
17
src/utils.rs
17
src/utils.rs
|
@ -1,3 +1,20 @@
|
|||
// Copyright 2021, Shy.
|
||||
//
|
||||
// This file is part of Kitchentimer.
|
||||
//
|
||||
// Kitchentimer is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Kitchentimer is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Kitchentimer. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
extern crate unicode_segmentation;
|
||||
use unicode_segmentation::UnicodeSegmentation;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue