1
0
mirror of https://gitlab.cvh-server.de/skrause/flashcards.git synced 2025-12-12 10:01:37 +01:00

Compare commits

..

11 Commits

Author SHA1 Message Date
fca51b78a1 latest changes 2025-10-28 12:37:03 +01:00
b5830c9d13 latest changes 2025-08-08 23:01:28 +02:00
cd3ea61503 add bibliography 2025-07-03 14:53:18 +02:00
5529da02db add tooltips 2025-07-03 14:49:51 +02:00
a4ab9486a1 add dummy description 2025-07-03 14:34:38 +02:00
6cf180e4f0 update translations 2025-07-03 14:33:26 +02:00
34d68d3e51 add dummy description 2025-07-03 14:32:54 +02:00
d916767369 add empty description 2025-07-03 14:31:42 +02:00
803185de87 add missing icons, cleanup translations, fix last little issues, prepare for documentation 2025-07-03 14:22:04 +02:00
a444bdd2fb push local changes 2025-06-13 20:52:25 +02:00
ed81f378a5 push local changes 2025-06-13 20:51:53 +02:00
24 changed files with 223 additions and 154 deletions

View File

@@ -8,7 +8,7 @@ docs:
- ./Flashcards.pdf - ./Flashcards.pdf
flatpak: flatpak:
image: quay.io/gnome_infrastructure/gnome-runtime-images:gnome-48 image: quay.io/gnome_infrastructure/gnome-runtime-images:gnome-49
stage: build stage: build
variables: variables:
APP_ID: "li.sopht.Flashcards" APP_ID: "li.sopht.Flashcards"

View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

6
docs/bibliography.yml Normal file
View File

@@ -0,0 +1,6 @@
electronic:
type: Web
title: Ishkur's Guide to Electronic Music
serial-number: v2.5
author: Ishkur
url: { value: http://www.techno.org/electronic-music-guide/, date: 2020-11-30 }

View File

@@ -4,64 +4,59 @@
title: "Karteikarten-Anwendung in C mit GTK4 und Libadwaita", title: "Karteikarten-Anwendung in C mit GTK4 und Libadwaita",
subtitle: "Hardwarenahe Programmierung", subtitle: "Hardwarenahe Programmierung",
authors: ( authors: (
"Sophie Krause", (
name: "Sophie Krause",
id: "18103387"
),
), ),
profs: ( profs: (
"Prof. Dr. Gerwinski", "Prof. Dr. rer. nat. Peter Gerwinski",
), ),
logo: "BO_Logo.svg" submitted_at: none,
logo: "BO.svg"
) )
= Einleitung = Einleitung
#lorem(100) Das Projekt behandelt die Entwicklung einer typischen Anwendung für die GNOME-Desktop-Umgebung unter Linux.
Dementsprechend wird die Anwendung mit GTK4 und Libadwaita entwickelt, um ein natives Erlebnis zu erzielen.
Da GTK in C geschrieben ist, wird ebenfalls in dieser Sprache programmiert.
Als Thema der Anwendung wurde eine Karteikarten-App gewählt, da diese gut für die Entwicklung einer Desktop-Anwendung geeignet ist und ebenfalls eine Datenbank benötigt.
#pagebreak() #pagebreak()
= Konzept & Tools = Konzept & Tools
#lorem(100)
== SQLite == SQLite
#lorem(100)
== GTK4 == GTK4
#lorem(100)
== Libadwaita == Libadwaita
#lorem(100)
== Blueprint == Blueprint
#lorem(100)
#pagebreak() #pagebreak()
= Implementierung = Implementierung
#lorem(100)
== Datenbank == Datenbank
#lorem(100)
== UI == UI
#lorem(100)
=== Layout
== Logik == Logik
#lorem(100)
#pagebreak() #pagebreak()
= Buildsystem = Buildsystem
#lorem(100)
#pagebreak() #pagebreak()
= Flatpak = Flatpak
#lorem(100)
#pagebreak() #pagebreak()
= CI / CD = CI / CD
#lorem(100)
== Flatpak == Flatpak
#lorem(100)
== Dokumentation == Dokumentation
#lorem(100)
#pagebreak() #pagebreak()
= Fazit & Ausblick = Fazit & Ausblick
#lorem(100)

View File

@@ -1,8 +1,8 @@
#import "@preview/hydra:0.6.0": hydra #import "@preview/hydra:0.6.1": hydra
#let project(title: "", subtitle: "", authors: (), profs: (), logo: none, body) = { #let project(title: "", subtitle: "", authors: ((name: "", id: ""),), profs: ("",), submitted_at: none, logo: none, body) = {
// Basic properties // Basic properties
set document(author: authors, title: title) set document(author: "a", title: title)
set text(lang: "de") set text(lang: "de")
set heading(numbering: "1.1") set heading(numbering: "1.1")
@@ -27,17 +27,37 @@
set align(left) set align(left)
// Author // Author
let authors_title
if authors.len() == 1 {
authors_title = "Autor*in"
} else {
authors_title = "Autor*innen"
}
text(weight: 700, authors_title + " (Matrikelnummer):")
grid( grid(
gutter: 1em, gutter: 1em,
..authors, ..authors.map(author => author.name + " (" + author.id + ")").flatten()
) )
// Profs // Profs
let profs_title
if profs.len() == 1 {
profs_title = "Prüfer*in"
} else {
profs_title = "Prüfer*innen"
}
text(weight: 700, profs_title + ":")
grid( grid(
gutter: 1em, gutter: 1em,
..profs, ..profs,
) )
// Abgabedatum
if submitted_at != none {
text(weight: 700, "Abgabedatum: ")
text(submitted_at.display("[day].[month].[year]"))
}
// Table of contents // Table of contents
set align(left) set align(left)
set page(numbering: "I", number-align: center) set page(numbering: "I", number-align: center)
@@ -58,4 +78,7 @@
counter(page).update(1) counter(page).update(1)
set par(justify: true) set par(justify: true)
body body
pagebreak()
bibliography("bibliography.yml")
} }

View File

@@ -1,7 +1,7 @@
{ {
"id": "li.sopht.Flashcards", "id": "li.sopht.Flashcards",
"runtime": "org.gnome.Platform", "runtime": "org.gnome.Platform",
"runtime-version": "48", "runtime-version": "49",
"sdk": "org.gnome.Sdk", "sdk": "org.gnome.Sdk",
"command": "flashcards", "command": "flashcards",
"separate-locales": false, "separate-locales": false,
@@ -33,7 +33,7 @@
{ {
"type": "git", "type": "git",
"url": "https://gitlab.gnome.org/jwestman/blueprint-compiler", "url": "https://gitlab.gnome.org/jwestman/blueprint-compiler",
"tag": "v0.16.0" "tag": "v0.18.0"
} }
] ]
}, },

View File

@@ -1,4 +1,5 @@
project('flashcards', 'c', project(
'flashcards', 'c',
version : '1.0.0', version : '1.0.0',
meson_version : '>= 1.0.0', meson_version : '>= 1.0.0',
default_options : ['warning_level=2', 'c_std=gnu23'], default_options : ['warning_level=2', 'c_std=gnu23'],
@@ -6,7 +7,7 @@ project('flashcards', 'c',
flashcards_deps = [ flashcards_deps = [
dependency('gtk4'), dependency('gtk4'),
dependency('libadwaita-1', version: '>= 1.6'), dependency('libadwaita-1', version : '>= 1.7'),
dependency('sqlite3'), dependency('sqlite3'),
] ]
@@ -21,12 +22,13 @@ cc = meson.get_compiler('c')
config_h = configuration_data() config_h = configuration_data()
config_h.set_quoted('PACKAGE_VERSION', meson.project_version()) config_h.set_quoted('PACKAGE_VERSION', meson.project_version())
config_h.set_quoted('GETTEXT_PACKAGE', 'flashcards') config_h.set_quoted('GETTEXT_PACKAGE', meson.project_name())
config_h.set_quoted('LOCALEDIR', get_option('prefix') / get_option('localedir')) config_h.set_quoted('LOCALEDIR', get_option('prefix') / get_option('localedir'))
configure_file(output : 'config.h', configuration : config_h) configure_file(output : 'config.h', configuration : config_h)
add_project_arguments(['-I' + meson.project_build_root()], language : 'c') add_project_arguments(['-I' + meson.project_build_root()], language : 'c')
executable('flashcards', executable(
meson.project_name(),
sourcefiles, sourcefiles,
resources, resources,
dependencies : flashcards_deps, dependencies : flashcards_deps,

View File

@@ -1,18 +1,21 @@
# Copyright (C) 2025 Sophie Krause
#
#, fuzzy
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: flashcards\n" "Project-Id-Version: flashcards\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-04-04 09:50+0200\n" "POT-Creation-Date: 2025-07-03 14:48+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: 2025-10-06 14:36+0200\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: Sophie Krause\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: de\n"
"Language: \n" "Language: de\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
#: resources/ui/window.blp:5 resources/ui/window.blp:60 #: resources/ui/window.blp:5 resources/ui/window.blp:60
#: resources/ui/window.blp:81 resources/li.sopht.Flashcards.desktop.in:3 #: resources/ui/window.blp:81 resources/li.sopht.Flashcards.desktop.in:2
#: resources/li.sopht.Flashcards.metainfo.xml.in:7 #: resources/li.sopht.Flashcards.metainfo.xml.in:7
msgid "Flashcards" msgid "Flashcards"
msgstr "Karteikarten" msgstr "Karteikarten"
@@ -49,19 +52,35 @@ msgstr "Wähle eine Kategorie"
msgid "Add a flashcard" msgid "Add a flashcard"
msgstr "Füge eine Karteikarte hinzu" msgstr "Füge eine Karteikarte hinzu"
#: resources/ui/window.blp:136 #: resources/ui/window.blp:116
msgid "Show answer"
msgstr "Antwort zeigen"
#: resources/ui/window.blp:137
msgid "Hard" msgid "Hard"
msgstr "Schwer" msgstr "Schwer"
#: resources/ui/window.blp:142 #: resources/ui/window.blp:140
msgid "Reappears in 6 hours"
msgstr "Erscheint erneut in 6 Stunden"
#: resources/ui/window.blp:144
msgid "Medium" msgid "Medium"
msgstr "Mittel" msgstr "Mittel"
#: resources/ui/window.blp:148 #: resources/ui/window.blp:147
msgid "Reappears in 12 hours"
msgstr "Erscheint erneut in 12 Stunden"
#: resources/ui/window.blp:151
msgid "Easy" msgid "Easy"
msgstr "Einfach" msgstr "Einfach"
#: resources/ui/window.blp:166 #: resources/ui/window.blp:154
msgid "Reappears in 24 hours"
msgstr "Erscheint erneut in 24 Stunden"
#: resources/ui/window.blp:170
msgid "About Flashcards" msgid "About Flashcards"
msgstr "Über Karteikarten" msgstr "Über Karteikarten"
@@ -89,18 +108,7 @@ msgstr "Neue Karteikarte erstellen"
msgid "Answer" msgid "Answer"
msgstr "Antwort" msgstr "Antwort"
#: resources/li.sopht.Flashcards.desktop.in:9
msgid "GTK;"
msgstr ""
#: resources/li.sopht.Flashcards.metainfo.xml.in:8 #: resources/li.sopht.Flashcards.metainfo.xml.in:8
#: resources/li.sopht.Flashcards.metainfo.xml.in:10
msgid "Learn categories with flashcards!" msgid "Learn categories with flashcards!"
msgstr "Lerne Kategorien mit Karteikarten!" msgstr "Lerne Kategorien mit Karteikarten!"
#: resources/li.sopht.Flashcards.metainfo.xml.in:10
msgid "No description"
msgstr ""
#: resources/li.sopht.Flashcards.metainfo.xml.in:44
msgid "A caption"
msgstr ""

View File

@@ -1,15 +1,12 @@
# SOME DESCRIPTIVE TITLE. # Copyright (C) 2025 Sophie Krause
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the flashcards package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
# #
#, fuzzy #, fuzzy
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: flashcards\n" "Project-Id-Version: flashcards\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-04-04 09:50+0200\n" "POT-Creation-Date: 2025-07-03 14:48+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: 2025-10-06 14:36+0200\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n" "Language: \n"
@@ -18,7 +15,7 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
#: resources/ui/window.blp:5 resources/ui/window.blp:60 #: resources/ui/window.blp:5 resources/ui/window.blp:60
#: resources/ui/window.blp:81 resources/li.sopht.Flashcards.desktop.in:3 #: resources/ui/window.blp:81 resources/li.sopht.Flashcards.desktop.in:2
#: resources/li.sopht.Flashcards.metainfo.xml.in:7 #: resources/li.sopht.Flashcards.metainfo.xml.in:7
msgid "Flashcards" msgid "Flashcards"
msgstr "" msgstr ""
@@ -55,19 +52,35 @@ msgstr ""
msgid "Add a flashcard" msgid "Add a flashcard"
msgstr "" msgstr ""
#: resources/ui/window.blp:136 #: resources/ui/window.blp:116
msgid "Show answer"
msgstr ""
#: resources/ui/window.blp:137
msgid "Hard" msgid "Hard"
msgstr "" msgstr ""
#: resources/ui/window.blp:142 #: resources/ui/window.blp:140
msgid "Reappears in 6 hours"
msgstr ""
#: resources/ui/window.blp:144
msgid "Medium" msgid "Medium"
msgstr "" msgstr ""
#: resources/ui/window.blp:148 #: resources/ui/window.blp:147
msgid "Reappears in 12 hours"
msgstr ""
#: resources/ui/window.blp:151
msgid "Easy" msgid "Easy"
msgstr "" msgstr ""
#: resources/ui/window.blp:166 #: resources/ui/window.blp:154
msgid "Reappears in 24 hours"
msgstr ""
#: resources/ui/window.blp:170
msgid "About Flashcards" msgid "About Flashcards"
msgstr "" msgstr ""
@@ -95,18 +108,7 @@ msgstr ""
msgid "Answer" msgid "Answer"
msgstr "" msgstr ""
#: resources/li.sopht.Flashcards.desktop.in:9
msgid "GTK;"
msgstr ""
#: resources/li.sopht.Flashcards.metainfo.xml.in:8 #: resources/li.sopht.Flashcards.metainfo.xml.in:8
#: resources/li.sopht.Flashcards.metainfo.xml.in:10
msgid "Learn categories with flashcards!" msgid "Learn categories with flashcards!"
msgstr "" msgstr ""
#: resources/li.sopht.Flashcards.metainfo.xml.in:10
msgid "No description"
msgstr ""
#: resources/li.sopht.Flashcards.metainfo.xml.in:44
msgid "A caption"
msgstr ""

View File

@@ -6,4 +6,9 @@
<file preprocess="xml-stripblanks">create-card.ui</file> <file preprocess="xml-stripblanks">create-card.ui</file>
<file alias="appdata" compressed="true" preprocess="xml-stripblanks">li.sopht.Flashcards.metainfo.xml</file> <file alias="appdata" compressed="true" preprocess="xml-stripblanks">li.sopht.Flashcards.metainfo.xml</file>
</gresource> </gresource>
<gresource prefix="/li/sopht/flashcards/icons/scalable/actions/">
<file preprocess="xml-stripblanks">icons/hicolor/scalable/actions/add-symbolic.svg</file>
<file preprocess="xml-stripblanks">icons/hicolor/scalable/actions/delete-symbolic.svg</file>
<file preprocess="xml-stripblanks">icons/hicolor/scalable/actions/category-symbolic.svg</file>
</gresource>
</gresources> </gresources>

View File

@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" height="16px" viewBox="0 0 16 16" width="16px"><path d="m 7 1 v 6 h -6 v 2 h 6 v 6 h 2 v -6 h 6 v -2 h -6 v -6 z m 0 0" fill="#222222"/></svg>

After

Width:  |  Height:  |  Size: 222 B

View File

@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" height="16px" viewBox="0 0 16 16" width="16px"><g fill="#222222"><path d="m 6 4.5 c 0 0.828125 -0.671875 1.5 -1.5 1.5 s -1.5 -0.671875 -1.5 -1.5 s 0.671875 -1.5 1.5 -1.5 s 1.5 0.671875 1.5 1.5 z m 0 0"/><path d="m 0 7.089844 c 0 0.847656 0.335938 1.660156 0.9375 2.261718 l 5.382812 5.382813 c 0.925782 0.925781 2.433594 0.925781 3.359376 0 l 4.964843 -4.964844 c 0.976563 -0.976562 0.976563 -2.5625 0 -3.539062 l -5.417969 -5.417969 c -0.519531 -0.519531 -1.226562 -0.8125 -1.960937 -0.8125 h -3.265625 c -2.207031 0 -4 1.792969 -4 4 z m 4 -5.089844 h 3.265625 c 0.207031 0 0.402344 0.082031 0.546875 0.226562 l 5.417969 5.417969 c 0.203125 0.207031 0.203125 0.503907 0 0.710938 l -4.964844 4.964843 c -0.15625 0.15625 -0.375 0.15625 -0.53125 0 l -5.382813 -5.382812 c -0.226562 -0.226562 -0.351562 -0.53125 -0.351562 -0.847656 v -3.089844 c 0 -1.117188 0.882812 -2 2 -2 z m 0 0"/></g></svg>

After

Width:  |  Height:  |  Size: 972 B

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg height="16px" viewBox="0 0 16 16" width="16px" xmlns="http://www.w3.org/2000/svg">
<g fill="#2e3436">
<path d="m 1 3 h 14 c 0.550781 0 1 0.449219 1 1 s -0.449219 1 -1 1 h -14 c -0.550781 0 -1 -0.449219 -1 -1 s 0.449219 -1 1 -1 z m 0 0"/>
<path d="m 4 4 v -1.5 c 0 -1.386719 1.113281 -2.5 2.5 -2.5 h 2.980469 c 1.382812 0 2.5 1.113281 2.5 2.5 v 1.5 h -2 v -1.5 c 0 -0.269531 -0.230469 -0.5 -0.5 -0.5 h -2.980469 c -0.269531 0 -0.5 0.230469 -0.5 0.5 v 1.5 z m 0 0"/>
<path d="m 4 4 v 9 c 0 0.546875 0.453125 1 1 1 h 6 c 0.546875 0 1 -0.453125 1 -1 v -9 h 2 v 9 c 0 1.660156 -1.339844 3 -3 3 h -6 c -1.660156 0 -3 -1.339844 -3 -3 v -9 z m 0 0"/>
<path d="m 7 7 v 5 c 0 0.277344 -0.222656 0.5 -0.5 0.5 s -0.5 -0.222656 -0.5 -0.5 v -5 c 0 -0.277344 0.222656 -0.5 0.5 -0.5 s 0.5 0.222656 0.5 0.5 z m 0 0"/>
<path d="m 10 7 v 5 c 0 0.277344 -0.222656 0.5 -0.5 0.5 s -0.5 -0.222656 -0.5 -0.5 v -5 c 0 -0.277344 0.222656 -0.5 0.5 -0.5 s 0.5 0.222656 0.5 0.5 z m 0 0"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@@ -11,3 +11,14 @@ install_data(
symbolic_dir / ('@0@-symbolic.svg').format(application_id), symbolic_dir / ('@0@-symbolic.svg').format(application_id),
install_dir : get_option('datadir') / 'icons' / symbolic_dir install_dir : get_option('datadir') / 'icons' / symbolic_dir
) )
action_dir = 'hicolor' / 'scalable' / 'actions'
action_icons = [
action_dir / 'add-symbolic.svg',
action_dir / 'delete-symbolic.svg',
action_dir / 'category-symbolic.svg',
]
install_data(
action_icons,
install_dir : get_option('datadir') / 'icons' / action_dir
)

View File

@@ -4,6 +4,5 @@ Exec=flashcards
Icon=li.sopht.Flashcards Icon=li.sopht.Flashcards
Terminal=false Terminal=false
Type=Application Type=Application
Categories=Utility; Categories=Utility
Keywords=GTK;
StartupNotify=true StartupNotify=true

View File

@@ -7,9 +7,10 @@
<name>Flashcards</name> <name>Flashcards</name>
<summary>Learn categories with flashcards!</summary> <summary>Learn categories with flashcards!</summary>
<description> <description>
<p>No description</p> <p>Learn categories with flashcards!</p>
</description> </description>
<developer id="li.sopht"> <developer id="li.sopht">
<name translate="no">Sophie Krause</name> <name translate="no">Sophie Krause</name>
</developer> </developer>
@@ -38,13 +39,6 @@
<color type="primary" scheme_preference="dark">#993d3d</color> <color type="primary" scheme_preference="dark">#993d3d</color>
</branding> </branding>
<screenshots>
<screenshot type="default">
<image>https://example.org/example1.png</image>
<caption>A caption</caption>
</screenshot>
</screenshots>
<releases> <releases>
<release version="1.0.0" date="2025-02-18"> <release version="1.0.0" date="2025-02-18">
</release> </release>

View File

@@ -1,9 +1,12 @@
compile_schemas = find_program('glib-compile-schemas', required : false, disabler : true) compile_schemas = find_program('glib-compile-schemas', required : false, disabler : true)
test('Validate schema file', test(
'Validate schema file',
compile_schemas, compile_schemas,
args : ['--strict', '--dry-run', meson.current_source_dir()]) args : ['--strict', '--dry-run', meson.current_source_dir()]
)
install_data('li.sopht.Flashcards.gschema.xml', install_data(
'li.sopht.Flashcards.gschema.xml',
install_dir : get_option('datadir') / 'glib-2.0' / 'schemas' install_dir : get_option('datadir') / 'glib-2.0' / 'schemas'
) )
@@ -30,8 +33,10 @@ appstream_file = i18n.merge_file(
) )
appstreamcli = find_program('appstreamcli', required : false, disabler : true) appstreamcli = find_program('appstreamcli', required : false, disabler : true)
test('Validate appstream file', appstreamcli, test(
args : ['validate', '--no-net', '--explain', appstream_file]) 'Validate appstream file', appstreamcli,
args : ['validate', '--no-net', '--explain', appstream_file]
)
service_conf = configuration_data() service_conf = configuration_data()
service_conf.set('bindir', get_option('prefix') / get_option('bindir')) service_conf.set('bindir', get_option('prefix') / get_option('bindir'))
@@ -44,7 +49,8 @@ configure_file(
subdir('ui') subdir('ui')
resources = gnome.compile_resources('resources', resources = gnome.compile_resources(
'resources',
'flashcards.gresource.xml', 'flashcards.gresource.xml',
dependencies : [blueprints, appstream_file], dependencies : [blueprints, appstream_file],
c_name : 'flashcards' c_name : 'flashcards'

View File

@@ -1,4 +1,5 @@
blueprints = custom_target('blueprints', blueprints = custom_target(
'blueprints',
input : files( input : files(
'window.blp', 'window.blp',
'create-category.blp', 'create-category.blp',

View File

@@ -24,7 +24,7 @@ template $FlashcardsAppWindow : Adw.ApplicationWindow {
Adw.HeaderBar { Adw.HeaderBar {
[start] [start]
Gtk.Button { Gtk.Button {
icon-name: "list-add-symbolic"; icon-name: "add-symbolic";
clicked => $on_add_category(); clicked => $on_add_category();
tooltip-text: _("Create category"); tooltip-text: _("Create category");
} }
@@ -64,14 +64,14 @@ template $FlashcardsAppWindow : Adw.ApplicationWindow {
Adw.HeaderBar { Adw.HeaderBar {
[start] [start]
Gtk.Button add_card_button { Gtk.Button add_card_button {
icon-name: "list-add-symbolic"; icon-name: "add-symbolic";
clicked => $on_add_card(); clicked => $on_add_card();
tooltip-text: _("Add flashcard"); tooltip-text: _("Add flashcard");
visible: false; visible: false;
} }
[start] [start]
Gtk.Button delete_card_button { Gtk.Button delete_card_button {
icon-name: "user-trash-symbolic"; icon-name: "delete-symbolic";
clicked => $on_delete_card(); clicked => $on_delete_card();
tooltip-text: _("Delete flashcard"); tooltip-text: _("Delete flashcard");
visible: false; visible: false;
@@ -86,14 +86,14 @@ template $FlashcardsAppWindow : Adw.ApplicationWindow {
Adw.ViewStackPage { Adw.ViewStackPage {
child: Adw.StatusPage placeholder_category { child: Adw.StatusPage placeholder_category {
title: _("Select a category"); title: _("Select a category");
icon-name: "edit-find-symbolic"; icon-name: "category-symbolic";
}; };
} }
Adw.ViewStackPage { Adw.ViewStackPage {
child: Adw.StatusPage placeholder_card { child: Adw.StatusPage placeholder_card {
title: _("Add a flashcard"); title: _("Add a flashcard");
icon-name: "list-add-symbolic"; icon-name: "add-symbolic";
}; };
} }
@@ -113,6 +113,7 @@ template $FlashcardsAppWindow : Adw.ApplicationWindow {
styles ["card", "activatable"] styles ["card", "activatable"]
halign: center; halign: center;
clicked => $on_flip_card(); clicked => $on_flip_card();
tooltip-text: _("Show answer");
Label card_title { Label card_title {
styles ["title-4"] styles ["title-4"]
margin-top: 24; margin-top: 24;
@@ -121,7 +122,7 @@ template $FlashcardsAppWindow : Adw.ApplicationWindow {
margin-end: 48; margin-end: 48;
hexpand: true; hexpand: true;
justify: center; justify: center;
label: "Wie viele Bäume sind in einem Wald?"; label: "";
wrap: true; wrap: true;
wrap-mode: word_char; wrap-mode: word_char;
} }
@@ -136,18 +137,21 @@ template $FlashcardsAppWindow : Adw.ApplicationWindow {
label: _("Hard"); label: _("Hard");
hexpand: true; hexpand: true;
clicked => $on_answer_hard(); clicked => $on_answer_hard();
tooltip-text: _("Reappears in 6 hours");
} }
Button { Button {
styles ["pill"] styles ["pill"]
label: _("Medium"); label: _("Medium");
hexpand: true; hexpand: true;
clicked => $on_answer_medium(); clicked => $on_answer_medium();
tooltip-text: _("Reappears in 12 hours");
} }
Button { Button {
styles ["pill"] styles ["pill"]
label: _("Easy"); label: _("Easy");
hexpand: true; hexpand: true;
clicked => $on_answer_easy(); clicked => $on_answer_easy();
tooltip-text: _("Reappears in 24 hours");
} }
} }
} }

View File

@@ -69,7 +69,6 @@ database_save_category (sqlite3 *db, const char *c)
{ {
sqlite3_stmt *stmt; sqlite3_stmt *stmt;
fprintf (stdout, "%s\n", c);
int rc = sqlite3_prepare_v2 (db, "INSERT INTO categories (name) VALUES(?)", int rc = sqlite3_prepare_v2 (db, "INSERT INTO categories (name) VALUES(?)",
-1, &stmt, nullptr); -1, &stmt, nullptr);
if (rc == SQLITE_OK) if (rc == SQLITE_OK)

View File

@@ -52,7 +52,6 @@ load_categories (FlashcardsAppWindow *win)
for (guint i = 0; i < win->categories->len; i++) for (guint i = 0; i < win->categories->len; i++)
{ {
category c = g_array_index (win->categories, category, i); category c = g_array_index (win->categories, category, i);
printf ("%d: %s\n", c.id, c.name);
GtkWidget *child = gtk_list_box_row_new (); GtkWidget *child = gtk_list_box_row_new ();
GtkWidget *label = gtk_label_new (c.name); GtkWidget *label = gtk_label_new (c.name);
@@ -71,10 +70,12 @@ next_card (FlashcardsAppWindow *win)
if (win->cards->length <= 0) if (win->cards->length <= 0)
{ {
adw_view_stack_set_visible_child (win->main_view, win->placeholder_card); adw_view_stack_set_visible_child (win->main_view, win->placeholder_card);
gtk_widget_set_visible (GTK_WIDGET (win->delete_card_button), FALSE);
return; return;
} }
win->current_card = g_queue_pop_head (win->cards); win->current_card = g_queue_pop_head (win->cards);
gtk_label_set_label (win->card_title, win->current_card->title); gtk_label_set_label (win->card_title, win->current_card->title);
gtk_widget_set_visible (GTK_WIDGET (win->delete_card_button), TRUE);
} }
static void static void
@@ -82,14 +83,14 @@ load_cards (FlashcardsAppWindow *win, category c)
{ {
GArray *card_array = database_load_cards (win->db, c.id); GArray *card_array = database_load_cards (win->db, c.id);
adw_view_stack_set_visible_child (win->main_view, win->flashcard);
win->cards = g_queue_new (); win->cards = g_queue_new ();
for (guint i = 0; i < card_array->len; i++) for (guint i = 0; i < card_array->len; i++)
{ {
g_queue_push_tail (win->cards, &g_array_index (card_array, card, i)); g_queue_push_tail (win->cards, &g_array_index (card_array, card, i));
;
} }
printf ("Flashcards: %d\n", win->cards->length);
next_card (win); next_card (win);
} }
@@ -112,7 +113,6 @@ on_select_category (__attribute__ ((unused)) GtkListBox *box,
adw_view_stack_set_visible_child (win->main_view, win->flashcard); adw_view_stack_set_visible_child (win->main_view, win->flashcard);
gtk_widget_set_visible (GTK_WIDGET (win->add_card_button), TRUE); gtk_widget_set_visible (GTK_WIDGET (win->add_card_button), TRUE);
gtk_widget_set_visible (GTK_WIDGET (win->delete_card_button), TRUE);
gtk_widget_set_visible (GTK_WIDGET (win->delete_category_button), TRUE); gtk_widget_set_visible (GTK_WIDGET (win->delete_category_button), TRUE);
load_cards (win, c); load_cards (win, c);
@@ -202,7 +202,7 @@ flashcards_app_window_add_card (FlashcardsAppWindow *win, const gchar *title,
const gchar *answer) const gchar *answer)
{ {
database_save_card (win->db, win->current_category.id, title, answer); database_save_card (win->db, win->current_category.id, title, answer);
printf ("Added card\n"); load_cards (win, win->current_category);
} }
void void
@@ -217,7 +217,6 @@ static void
on_flashcards_app_window_show (GtkWidget *self, gpointer user_data) on_flashcards_app_window_show (GtkWidget *self, gpointer user_data)
{ {
FlashcardsAppWindow *win = user_data; FlashcardsAppWindow *win = user_data;
printf ("Show\n");
load_categories (win); load_categories (win);
gtk_list_box_unselect_all (win->topics); gtk_list_box_unselect_all (win->topics);

View File

@@ -1,4 +1,5 @@
sourcefiles = files('main.c', sourcefiles = files(
'main.c',
'flashcardsapp.c', 'flashcardsapp.c',
'flashcardsappwin.c', 'flashcardsappwin.c',
'create-category.c', 'create-category.c',