added settings with 10 themes, light mode and czech/english UI

This commit is contained in:
pepaskopec-blip 2026-09-06 22:26:57 +02:00
commit ce9e358f8d
4 changed files with 4285 additions and 3081 deletions

10
.idea/.gitignore generated vendored Normal file
View file

@ -0,0 +1,10 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Ignored default folder with query files
/queries/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View file

@ -1,6 +1,21 @@
CC = gcc
CFLAGS = -Wall -Wextra -Wno-deprecated-declarations `pkg-config --cflags gtk4`
LIBS = `pkg-config --libs gtk4` -lm
# Make sure pkg-config is found even when make runs with a minimal PATH
# (e.g. launched from an IDE such as CLion on macOS).
PKG_CONFIG ?= $(firstword $(wildcard \
$(addsuffix /pkg-config,$(subst :, ,$(PATH)) /opt/homebrew/bin /usr/local/bin)))
ifeq ($(PKG_CONFIG),)
PKG_CONFIG := pkg-config
endif
# Use $(shell ...) instead of backticks so the flags are expanded by make
# itself; IDEs that import the Makefile via a dry run then see the real
# include paths.
GTK_CFLAGS := $(shell $(PKG_CONFIG) --cflags gtk4)
GTK_LIBS := $(shell $(PKG_CONFIG) --libs gtk4)
CFLAGS = -Wall -Wextra -Wno-deprecated-declarations $(GTK_CFLAGS)
LIBS = $(GTK_LIBS) -lm
TARGET = sprechen
SRC = sprechen.c

View file

@ -5,30 +5,35 @@ A German learning application written in C using GTK 4.
## Description
Sprechen.c is an educational program designed for practicing German language
skills, aimed at high school and gymnasium students. The UI is written in Czech
and is built as a single C file (`sprechen.c`) that renders a modern,
CSS-styled GTK 4 interface with a Catppuccin Mocha dark theme.
skills, aimed at high school and gymnasium students. The UI is available in
Czech and English and is built as a single C file (`sprechen.c`) that renders a
modern, CSS-styled GTK 4 interface.
## Features
- **Welcome screen** – branded greeting with a description of the program and a
"Pokračuj" button to get started
- **Learning roadmap** – a wave-shaped "Učební plán" path with 10 units that
scrolls horizontally
continue button to get started
- **Learning roadmap** – adaptive serpentine learning path with 10 units
- each unit numbered and labeled with its topic (e.g. "Neue Freunde")
- current unit highlighted with a mauve→blue gradient and glow
- current unit highlighted with an accent gradient and glow
- completed units shown in green with a checkmark
- locked units dimmed with a lock icon
- finish flag at the end of the path
- finish node at the end of the path
- layout folds into multiple rows when the window is narrow
- **Back navigation** – themed circular back button (top-left) returns to the
welcome screen
previous screen
- **Unit 1 exercises** – "Neue Freunde" opens an interactive bubble map with 13
exercises (dialogs, sentence building, numbers, verb conjugation, greeting
sorting and more), each with German prompts and a "Zkontrolovat" check
exercises (dialogs, sentence building, multiple choice, free answers,
numbers, verb conjugation, greeting sorting and more), each with German
prompts and a check button that reveals the translations
- **Progress tracking** – completed exercises are marked green; progress is
saved to `progress/unit1.conf` and restored on startup
- **Catppuccin Mocha theme** – gradient background, rounded cards, glowing
buttons and nodes, all driven by an embedded CSS stylesheet
- **Settings** – gear icon in the top-right header opens a panel where you can
choose:
- **mode**: dark or light, as a segmented control
- **theme**: 10 palettes picked from a grid of color swatches
- **language**: Czech or English, applied instantly without a restart
- all three preferences are stored in `progress/settings.conf`
- **Keyboard quit shortcuts** – `Super/Cmd+Q` or `Alt+F4` closes the app
- Single-file C codebase, cross-platform (Linux and macOS supported)
@ -124,13 +129,15 @@ or
When launched, the application shows the welcome screen. From there:
1. Click **"Pokračuj"** to open the learning roadmap.
2. Browse the units along the path; the roadmap scrolls horizontally if the
window is too narrow.
1. Click **"Pokračuj" / "Continue"** to open the learning roadmap.
2. Browse the units along the path; the roadmap reflows into rows and scrolls
if the window is too narrow.
3. Click the **"Neue Freunde"** node to open the unit's exercise map, then pick
any bubble to start an exercise.
4. Use the **back button** in the top-left corner to return to the previous
screen.
5. Open **Nastavení / Settings** (gear icon, top-right) to switch dark/light
mode, pick a color theme, or change the interface language.
Only the first unit is currently implemented. Locked units do nothing – they
are placeholders until lessons are added. Completed exercises stay green and
@ -138,26 +145,46 @@ are saved to `progress/unit1.conf` (created next to the app on first finish).
### Keyboard shortcuts
| Shortcut | Action |
| ------------------- | --------------- |
| Shortcut | Action |
| ------------------- | ---------------- |
| `Super/Cmd` + `Q` | Quit application |
| `Alt` + `F4` | Quit application |
## Project structure
```
sprechen.c entire application (UI, navigation, path drawing, styling)
Makefile build & run targets
README.md this file
LICENSE MIT license
sprechen.c entire application (UI, navigation, themes, exercises)
Makefile build & run targets
README.md this file
LICENSE MIT license
progress/ created at runtime
unit1.conf exercise completion state
settings.conf theme, dark/light mode and language preference
```
## Theming
Colors follow the [Catppuccin Mocha](https://github.com/catppuccin/catppuccin)
palette and are applied through a CSS string embedded at the top of
`sprechen.c`. To tweak the look (colors, node glow, gradients, spacing), edit
that stylesheet and rebuild.
The app ships with ten palettes – Catppuccin, Nord, Dracula, Rose Pine, Ocean,
Gruvbox, Solarized, Everforest, Monokai and One Dark – each available in dark
and light mode. Colors are defined as theme palettes in `sprechen.c` and
applied through a generated CSS stylesheet (plus matching Cairo colors for the
roadmap rails and icons).
Change the look from the in-app settings panel, or edit the palette tables /
`build_theme_css()` in `sprechen.c` and rebuild.
## Languages
The interface can be switched between Czech and English from the settings
panel; the choice takes effect immediately and is remembered between runs.
Translations live in two tables in `sprechen.c`: `tr_ui` holds interface
strings under short keys, while `tr_content` translates the Czech meanings
shown next to the German exercise items and uses the Czech text itself as the
key. Widgets are registered with `i18n_bind()` so `apply_language()` can
retranslate them in place.
German prompts, unit names and exercise titles are learning material and stay
German in both languages.
## To-Do Plans
@ -167,14 +194,15 @@ Future enhancements planned for Sprechen.c:
- [x] Unit 1 ("Neue Freunde") – 13 interactive exercises with progress saving
- [ ] Lesson progression and unlock system for the remaining units
- [ ] Add audio pronunciation features
- [ ] Add user settings panel
- [x] Add user settings panel (theme, dark/light mode, language)
- [ ] Implement spaced repetition system for vocabulary
- [ ] Add listening and reading comprehension exercises
- [ ] Add writing practice with feedback
- [ ] Implement progress tracking and statistics
- [ ] Expand progress tracking with statistics
- [ ] Move CSS styling to an external file
- [ ] Split the UI code into multiple files
- [ ] Add internationalization support (gettext)
- [x] Add internationalization support (Czech and English)
- [ ] Add more interface languages
- [ ] Add unit testing framework
## License

2095
sprechen.c

File diff suppressed because it is too large Load diff