Full split of lang.rs
This commit is contained in:
1 parent
22b455a640
commit
c67663141f
17 files changed
+81
-78
No files matched your search
@@ -1,8 +1,8 @@
|
||||
use crate::data::Id;
|
||||
use crate::data_provider::words::{delete_group, delete_word, update_group, update_word};
|
||||
use crate::pages::dictionary::DictionaryMessage::*;
|
||||
use crate::pages::dictionary_quiz::DictionaryQuizState;
|
||||
use crate::pages::import::ImportState;
|
||||
use crate::lang::{WordData, WordGroup};
|
||||
use crate::navigation::Page::{Import, Word};
|
||||
use crate::navigation::{NavigatedPage, Page, RootMessage};
|
||||
use crate::styling::*;
|
||||
@@ -19,13 +19,12 @@ use iced::{Border, Color, Shadow, Task};
|
||||
use iced_core::Length::Fill;
|
||||
use parking_lot::Mutex;
|
||||
use rand::random_range;
|
||||
use std::fs;
|
||||
use std::ops::Add;
|
||||
use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
use std::time::{Duration, Instant};
|
||||
use log::info;
|
||||
use crate::app::AppState;
|
||||
use crate::data::entities::{WordData, WordGroup};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct DictionaryState {
|
||||
@@ -529,7 +528,7 @@ impl DictionaryState {
|
||||
});
|
||||
}
|
||||
|
||||
fn update_words_include(&mut self, group_id: crate::lang::Id) {
|
||||
fn update_words_include(&mut self, group_id: Id) {
|
||||
let include_tags = self
|
||||
.tag_map
|
||||
.iter()
|
||||
@@ -619,14 +618,12 @@ pub fn split_with_coma(ts: &str) -> Vec<String> {
|
||||
.collect::<Vec<String>>()
|
||||
}
|
||||
|
||||
|
||||
|
||||
#[derive(Hash, PartialEq, Eq)]
|
||||
struct WordLineState {
|
||||
is_included: bool,
|
||||
key: String,
|
||||
value: String,
|
||||
tags: String,
|
||||
id: crate::lang::Id,
|
||||
id: Id,
|
||||
index: usize,
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
use crate::navigation::RootMessage;
|
||||
use crate::pages::dictionary::split_with_coma;
|
||||
use crate::pages::dictionary_quiz::DictionaryQuizMessage::*;
|
||||
use crate::lang::WordData;
|
||||
use crate::navigation::Page::PreviousPage;
|
||||
use crate::navigation::*;
|
||||
use crate::pages::quiz::Score;
|
||||
@@ -12,6 +11,7 @@ use iced::widget::container::Style;
|
||||
use iced::widget::{Row, button, container, row, space, text, text_input};
|
||||
use iced::{Border, Element, Fill, Task, Theme, alignment};
|
||||
use rand::prelude::SliceRandom;
|
||||
use crate::data::entities::WordData;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct DictionaryQuizState {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
use crate::data_provider::history::{get_history_of_set, HistoryItem};
|
||||
use crate::lang::{WordData, INVALID_ID};
|
||||
use crate::data_provider::history::{get_history_of_set};
|
||||
use crate::navigation::*;
|
||||
use crate::styling::*;
|
||||
use chrono::Local;
|
||||
@@ -11,6 +10,8 @@ use parking_lot::Mutex;
|
||||
use std::sync::Arc;
|
||||
use HistoryMessage::Back;
|
||||
use crate::app::AppState;
|
||||
use crate::data::entities::{HistoryItem, WordData};
|
||||
use crate::data::INVALID_ID;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct HistoryState {
|
||||
@@ -47,7 +48,7 @@ impl NavigatedPage<HistoryMessage> for HistoryState {
|
||||
}
|
||||
|
||||
impl HistoryState {
|
||||
pub fn new(id: crate::lang::Id, state: Arc<Mutex<AppState>>) -> Self {
|
||||
pub fn new(id: crate::data::Id, state: Arc<Mutex<AppState>>) -> Self {
|
||||
let state = state.lock();
|
||||
let history = get_history_of_set(id).unwrap_or_default();
|
||||
let words = history
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
use crate::data_provider::import::{ImportData, ImportGroup, get_words_of_group, load_groups};
|
||||
use crate::data_provider::words::{add_group, add_words};
|
||||
use crate::pages::import::ImportMessage::*;
|
||||
use crate::lang::{WordData, WordGroup};
|
||||
use crate::data::entities::{WordData, WordGroup};
|
||||
use crate::navigation::{NavigatedPage, Page, RootMessage};
|
||||
use crate::notification::NotificationData::OpenFileError;
|
||||
use crate::notification::{NotificationData, NotificationRequest};
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
use crate::app::AppState;
|
||||
use crate::core::deck::{CardStatistics, DeckData, DeckSettings};
|
||||
use crate::core::srs::WordOpenMode;
|
||||
use crate::data::entities::WordData;
|
||||
use crate::data::Id;
|
||||
use crate::data_provider::voice::get_voice;
|
||||
use crate::lang::Id;
|
||||
use crate::lang::{ WordData};
|
||||
use crate::navigation::Page::PreviousPage;
|
||||
use crate::navigation::{KeyPressedPage, NavigatedPage, Page, RootMessage};
|
||||
use crate::notification::{NotificationData, NotificationRequest};
|
||||
@@ -10,15 +12,13 @@ use chrono::Local;
|
||||
use iced::alignment::Horizontal::Center;
|
||||
use iced::keyboard::key::Physical::Code;
|
||||
use iced::widget::text::Style;
|
||||
use iced::widget::{Column, button, column, container, row, rule, space, text, tooltip};
|
||||
use iced::{Element, Fill, Task, Theme, alignment, keyboard};
|
||||
use iced::widget::{button, column, container, row, rule, space, text, tooltip, Column};
|
||||
use iced::{alignment, keyboard, Element, Fill, Task, Theme};
|
||||
use parking_lot::Mutex;
|
||||
use rodio::MixerDeviceSink;
|
||||
use std::collections::HashSet;
|
||||
use std::sync::Arc;
|
||||
use tokio::task::spawn_blocking;
|
||||
use crate::core::deck::{CardStatistics, DeckData, DeckSettings};
|
||||
use crate::core::srs::{ WordOpenMode};
|
||||
|
||||
pub struct RepetitionState {
|
||||
state: Arc<Mutex<AppState>>,
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
use crate::data_provider::card_sets::update_deck;
|
||||
use crate::data_provider::card_stats::{add_stat_list, load_stats_of_deck};
|
||||
use crate::pages::history::HistoryState;
|
||||
use crate::lang::{Id};
|
||||
use crate::navigation::Page::{History, PreviousPage, Repetition, RepetitionSettings};
|
||||
use crate::navigation::{NavigatedPage, Page, RootMessage};
|
||||
use crate::pages::repetition::RepetitionState;
|
||||
@@ -27,6 +26,7 @@ use std::sync::Arc;
|
||||
use crate::app::AppState;
|
||||
use crate::core::deck::{CardStatistics, DeckSettings};
|
||||
use crate::core::srs::{AppendMode, OrderMode};
|
||||
use crate::data::Id;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct RepetitionsState {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
use crate::data_provider::words::{delete_word, update_word};
|
||||
use crate::lang::WordData;
|
||||
use crate::data::entities::WordData;
|
||||
use crate::navigation::Page::PreviousPage;
|
||||
use crate::navigation::{NavigatedPage, Page, RootMessage};
|
||||
use crate::styling::*;
|
||||
|
||||
Reference in new issue
Block a user