Rename browser_rows/RowColor to Color

This commit is contained in:
RumovZ 2021-03-20 17:31:16 +01:00
parent b86d683f17
commit 04ae6f727b
2 changed files with 19 additions and 19 deletions

View File

@ -31,16 +31,16 @@ impl From<browser_rows::Cell> for pb::browser_row::Cell {
}
}
impl From<browser_rows::RowColor> for i32 {
fn from(color: browser_rows::RowColor) -> Self {
impl From<browser_rows::Color> for i32 {
fn from(color: browser_rows::Color) -> Self {
match color {
browser_rows::RowColor::Default => pb::browser_row::Color::Default as i32,
browser_rows::RowColor::Marked => pb::browser_row::Color::Marked as i32,
browser_rows::RowColor::Suspended => pb::browser_row::Color::Suspended as i32,
browser_rows::RowColor::FlagRed => pb::browser_row::Color::FlagRed as i32,
browser_rows::RowColor::FlagOrange => pb::browser_row::Color::FlagOrange as i32,
browser_rows::RowColor::FlagGreen => pb::browser_row::Color::FlagGreen as i32,
browser_rows::RowColor::FlagBlue => pb::browser_row::Color::FlagBlue as i32,
browser_rows::Color::Default => pb::browser_row::Color::Default as i32,
browser_rows::Color::Marked => pb::browser_row::Color::Marked as i32,
browser_rows::Color::Suspended => pb::browser_row::Color::Suspended as i32,
browser_rows::Color::FlagRed => pb::browser_row::Color::FlagRed as i32,
browser_rows::Color::FlagOrange => pb::browser_row::Color::FlagOrange as i32,
browser_rows::Color::FlagGreen => pb::browser_row::Color::FlagGreen as i32,
browser_rows::Color::FlagBlue => pb::browser_row::Color::FlagBlue as i32,
}
}
}

View File

@ -23,7 +23,7 @@ use crate::{
#[derive(Debug, PartialEq)]
pub struct Row {
pub cells: Vec<Cell>,
pub color: RowColor,
pub color: Color,
pub font: Font,
}
@ -34,7 +34,7 @@ pub struct Cell {
}
#[derive(Debug, PartialEq)]
pub enum RowColor {
pub enum Color {
Default,
Marked,
Suspended,
@ -296,12 +296,12 @@ fn get_is_rtl(column: &str, context: &RowContext) -> bool {
}
}
fn get_row_color(context: &RowContext) -> RowColor {
fn get_row_color(context: &RowContext) -> Color {
match context.card.flags {
1 => RowColor::FlagRed,
2 => RowColor::FlagOrange,
3 => RowColor::FlagGreen,
4 => RowColor::FlagBlue,
1 => Color::FlagRed,
2 => Color::FlagOrange,
3 => Color::FlagGreen,
4 => Color::FlagBlue,
_ => {
if context
.note
@ -309,11 +309,11 @@ fn get_row_color(context: &RowContext) -> RowColor {
.iter()
.any(|tag| tag.eq_ignore_ascii_case("marked"))
{
RowColor::Marked
Color::Marked
} else if context.card.queue == CardQueue::Suspended {
RowColor::Suspended
Color::Suspended
} else {
RowColor::Default
Color::Default
}
}
}