From 90c9c36ebf2d7f17b22e479d436b160104dfe0e7 Mon Sep 17 00:00:00 2001 From: yggverse Date: Sat, 14 Sep 2024 06:50:22 +0300 Subject: [PATCH] implement gemini source view widget --- Makefile | 1 + po/POTFILES.in | 1 + .../tab/page/content/text/gemini/source.cpp | 32 +++++++++++++++++++ .../tab/page/content/text/gemini/source.hpp | 24 ++++++++++++++ 4 files changed, 58 insertions(+) create mode 100644 src/app/browser/main/tab/page/content/text/gemini/source.cpp create mode 100644 src/app/browser/main/tab/page/content/text/gemini/source.hpp diff --git a/Makefile b/Makefile index 922276c3..4a584929 100644 --- a/Makefile +++ b/Makefile @@ -20,6 +20,7 @@ SRCS = src/app.cpp\ src/app/browser/main/tab/page/content/text.cpp\ src/app/browser/main/tab/page/content/text/gemini.cpp\ src/app/browser/main/tab/page/content/text/gemini/reader.cpp\ + src/app/browser/main/tab/page/content/text/gemini/source.cpp\ src/app/browser/main/tab/page/content/text/plain.cpp\ src/app/browser/main/tab/page/content/text/plain/reader.cpp\ src/app/browser/main/tab/page/navigation.cpp\ diff --git a/po/POTFILES.in b/po/POTFILES.in index b8c1984f..9c82f1b5 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -15,6 +15,7 @@ src/app/browser/main/tab/page/content.cpp src/app/browser/main/tab/page/content/text.cpp src/app/browser/main/tab/page/content/text/gemini.cpp src/app/browser/main/tab/page/content/text/gemini/reader.cpp +src/app/browser/main/tab/page/content/text/gemini/source.cpp src/app/browser/main/tab/page/content/text/plain.cpp src/app/browser/main/tab/page/content/text/plain/reader.cpp src/app/browser/main/tab/page/navigation.cpp diff --git a/src/app/browser/main/tab/page/content/text/gemini/source.cpp b/src/app/browser/main/tab/page/content/text/gemini/source.cpp new file mode 100644 index 00000000..b1da7d90 --- /dev/null +++ b/src/app/browser/main/tab/page/content/text/gemini/source.cpp @@ -0,0 +1,32 @@ +#include "source.hpp" + +using namespace app::browser::main::tab::page::content::text::gemini; + +Source::Source( + const Glib::ustring & GEMTEXT +) { + set_valign( + Gtk::Align::START + ); + + set_wrap( + true + ); + + set_selectable( + true + ); + + set_use_markup( + true + ); + + set_markup( + Glib::ustring::sprintf( + "%s", + Glib::Markup::escape_text( + GEMTEXT + ) + ) + ); +} \ No newline at end of file diff --git a/src/app/browser/main/tab/page/content/text/gemini/source.hpp b/src/app/browser/main/tab/page/content/text/gemini/source.hpp new file mode 100644 index 00000000..2d4948f1 --- /dev/null +++ b/src/app/browser/main/tab/page/content/text/gemini/source.hpp @@ -0,0 +1,24 @@ +#ifndef APP_BROWSER_MAIN_TAB_PAGE_CONTENT_TEXT_GEMINI_SOURCE_HPP +#define APP_BROWSER_MAIN_TAB_PAGE_CONTENT_TEXT_GEMINI_SOURCE_HPP + +#include +#include +#include +#include + +namespace app::browser::main::tab::page::content::text::gemini +{ + class Source : public Gtk::Label + { + /* + * Gemini class API + */ + public: + + Source( + const Glib::ustring & GEMTEXT + ); + }; +} + +#endif // APP_BROWSER_MAIN_TAB_PAGE_CONTENT_TEXT_GEMINI_SOURCE_HPP \ No newline at end of file