This document outlines the implementation of a tagging feature for Bibliotheca.
The database schema will be updated to support tags.
A tags table will be created to store all available tags.
CREATE TABLE IF NOT EXISTS tags (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL UNIQUE
);
A book_tags table will be created to associate tags with books.
CREATE TABLE IF NOT EXISTS book_tags (
book_id TEXT NOT NULL,
tag_id INTEGER NOT NULL,
FOREIGN KEY (book_id) REFERENCES books(id) ON DELETE CASCADE,
FOREIGN KEY (tag_id) REFERENCES tags(id) ON DELETE CASCADE,
PRIMARY KEY (book_id, tag_id)
);
The Book class in Book.hpp will be extended to include a list of tags.
class Book {
// ... existing members
std::vector<std::string> m_tags;
};
The DatabaseManager will be updated with methods to:
add_tag_to_book(book_id, tag_name)remove_tag_from_book(book_id, tag_name)get_tags_for_book(book_id)load_all_books will be updated to also load the tags for each book.A new BookDetails widget will be created. This widget will:
The BibliothecaWindow will be modified to:
BookDetails widget when a book is activated.onBookActivated method will be updated to show the BookDetails widget instead of opening the book file directly.BookDetails view.BookDetails view.