Before font remake
This commit is contained in:
@@ -308,6 +308,7 @@ impl DictionaryState {
|
||||
}
|
||||
|
||||
fn words_list(&self) -> iced::Element<'_, DictionaryMessage> {
|
||||
let time = Instant::now();
|
||||
let mut col = Column::new().width(Length::Fill);
|
||||
|
||||
let mut range = (0..self.include_map.len()).collect::<Vec<_>>();
|
||||
@@ -389,6 +390,7 @@ impl DictionaryState {
|
||||
col = col.push(line);
|
||||
}
|
||||
|
||||
println!("Words rendering time: {:?}", time.elapsed());
|
||||
scrollable(col).height(Length::Fill).into()
|
||||
}
|
||||
|
||||
|
||||
+13
-3
@@ -31,7 +31,7 @@ use crate::Page::{Dictionary, DictionaryQuiz, History, Quiz, Randomizer, Repetit
|
||||
use crate::RootMessage::Keyboard;
|
||||
use iced::keyboard::Event;
|
||||
use iced::widget::text;
|
||||
use iced::{keyboard, Element, Program, Subscription};
|
||||
use iced::{keyboard, Element, Program, Subscription, Theme};
|
||||
use iced::{Font, Task};
|
||||
use rusqlite::Connection;
|
||||
use std::sync::{Arc, Mutex};
|
||||
@@ -40,12 +40,22 @@ use crate::history::{HistoryMessage, HistoryState};
|
||||
|
||||
const DEFAULT_SPACING: f32 = 10.0;
|
||||
|
||||
const USER_FONT: Font = Font::with_name("Noto Sans JP");
|
||||
|
||||
fn main() -> iced::Result {
|
||||
iced::application(ScreenState::boot, ScreenState::update, ScreenState::view)
|
||||
.subscription(subscription)
|
||||
.title("Kana learn app")
|
||||
.settings(iced::Settings{
|
||||
default_text_size: iced::Pixels(16.0),
|
||||
..iced::Settings::default()
|
||||
})
|
||||
.font(include_bytes!("../ibmplex.ttf"))
|
||||
.font(include_bytes!("../noto.ttf"))
|
||||
.default_font(Font::with_name("Noto Sans JP"))
|
||||
.default_font(USER_FONT)
|
||||
.scale_factor(|x| 1.5)
|
||||
|
||||
.theme(Theme::GruvboxDark)
|
||||
.run()
|
||||
}
|
||||
|
||||
@@ -124,7 +134,7 @@ impl Default for ScreenState {
|
||||
}
|
||||
}
|
||||
|
||||
fn fill_state(mut state: &mut AppState) {
|
||||
fn fill_state(state: &mut AppState) {
|
||||
let list = load_words(&state.connection);
|
||||
let sets = load_sets(&state.connection);
|
||||
let groups = load_word_groups(&state.connection);
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
use crate::lang::KanaSet;
|
||||
use crate::Page::PreviousPage;
|
||||
use crate::{NavigatedPage, Page, RootMessage, DEFAULT_SPACING};
|
||||
use crate::{NavigatedPage, Page, RootMessage, DEFAULT_SPACING, USER_FONT};
|
||||
use iced::widget::*;
|
||||
use iced::{alignment, Element, Fill, Task};
|
||||
use rand::seq::SliceRandom;
|
||||
@@ -101,7 +101,7 @@ impl QuizState {
|
||||
container(
|
||||
iced::widget::column![
|
||||
row![
|
||||
text!("{}", self.kana.to_uppercase()).size(54),
|
||||
text!("{}", self.kana.to_uppercase()).size(54).font(USER_FONT),
|
||||
text!(
|
||||
"{}",
|
||||
if self.is_help {
|
||||
|
||||
+5
-5
@@ -82,11 +82,11 @@ impl SelectorState {
|
||||
container(
|
||||
iced::widget::column![
|
||||
row![
|
||||
button("Переключить азбуки").on_press(SelectorMessage::Change),
|
||||
button("Словарь").on_press(SelectorMessage::ToDictionary),
|
||||
button("Рандомайзер").on_press(SelectorMessage::ToRandomize),
|
||||
button("Повторение").on_press(SelectorMessage::ToRepetitions),
|
||||
button("Синхронизация").on_press(SelectorMessage::ToSync)
|
||||
button("あ ↔ ア").on_press(SelectorMessage::Change),
|
||||
button("Словарь").on_press(SelectorMessage::ToDictionary).style(button::text),
|
||||
button("Рандомайзер").on_press(SelectorMessage::ToRandomize).style(button::text),
|
||||
button("Повторение").on_press(SelectorMessage::ToRepetitions).style(button::text),
|
||||
button("Синхронизация").on_press(SelectorMessage::ToSync).style(button::text)
|
||||
]
|
||||
.spacing(DEFAULT_SPACING),
|
||||
self.rows_selector(),
|
||||
|
||||
+2
-2
@@ -185,7 +185,7 @@ impl SyncState {
|
||||
)
|
||||
|
||||
.style(rounded_box),
|
||||
button("Скопировать в буффер обмена")
|
||||
button("Скопировать в буфер обмена")
|
||||
.on_press(SyncMessage::CopyKey)
|
||||
.width(Fill),
|
||||
row![
|
||||
@@ -202,7 +202,7 @@ impl SyncState {
|
||||
} else {
|
||||
column![
|
||||
button("Создать сохранение").on_press(SyncMessage::InitSync),
|
||||
button("Вставить ключ из буффера").on_press(SyncMessage::GetKey),
|
||||
button("Вставить ключ из буфера").on_press(SyncMessage::GetKey),
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user