mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 09:05:27 +00:00
add text/plain content support
This commit is contained in:
parent
a73bb3aea6
commit
30e3ae691a
8 changed files with 66 additions and 2 deletions
|
|
@ -120,13 +120,17 @@ void Page::update()
|
|||
|
||||
else
|
||||
{
|
||||
// @TODO exception
|
||||
content->text_plain(
|
||||
_("MIME type not supported")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
// @TODO exception
|
||||
content->text_plain(
|
||||
_("Could not open page")
|
||||
);
|
||||
}
|
||||
|
||||
socket_connection->close();
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
#include <giomm/simpleactiongroup.h>
|
||||
#include <giomm/socketclient.h>
|
||||
#include <giomm/socketconnection.h>
|
||||
#include <glibmm/i18n.h>
|
||||
#include <glibmm/refptr.h>
|
||||
#include <glibmm/regex.h>
|
||||
#include <glibmm/ustring.h>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
#include "content.hpp"
|
||||
#include "content/text/gemini.hpp"
|
||||
#include "content/text/plain.hpp"
|
||||
|
||||
using namespace app::browser::main::tab::page;
|
||||
|
||||
|
|
@ -32,6 +33,16 @@ void Content::text_gemini(
|
|||
);
|
||||
}
|
||||
|
||||
void Content::text_plain(
|
||||
const Glib::ustring & text
|
||||
) {
|
||||
update(
|
||||
new content::text::Plain(
|
||||
text
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// @TODO text_plain, picture, video, etc.
|
||||
|
||||
// Private helpers
|
||||
|
|
|
|||
|
|
@ -24,6 +24,10 @@ namespace app::browser::main::tab::page
|
|||
void text_gemini(
|
||||
const Glib::ustring & gemtext
|
||||
);
|
||||
|
||||
void text_plain(
|
||||
const Glib::ustring & text
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
21
src/app/browser/main/tab/page/content/text/plain.cpp
Normal file
21
src/app/browser/main/tab/page/content/text/plain.cpp
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#include "plain.hpp"
|
||||
|
||||
using namespace app::browser::main::tab::page::content::text;
|
||||
|
||||
Plain::Plain(
|
||||
const Glib::ustring & text
|
||||
) {
|
||||
set_wrap(
|
||||
true
|
||||
);
|
||||
|
||||
set_selectable(
|
||||
true
|
||||
);
|
||||
|
||||
set_text(
|
||||
text
|
||||
);
|
||||
}
|
||||
|
||||
Plain::~Plain() = default;
|
||||
21
src/app/browser/main/tab/page/content/text/plain.hpp
Normal file
21
src/app/browser/main/tab/page/content/text/plain.hpp
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#ifndef APP_BROWSER_MAIN_TAB_PAGE_CONTENT_TEXT_PLAIN_HPP
|
||||
#define APP_BROWSER_MAIN_TAB_PAGE_CONTENT_TEXT_PLAIN_HPP
|
||||
|
||||
#include <glibmm/ustring.h>
|
||||
#include <gtkmm/label.h>
|
||||
|
||||
namespace app::browser::main::tab::page::content::text
|
||||
{
|
||||
class Plain : public Gtk::Label
|
||||
{
|
||||
public:
|
||||
|
||||
Plain(
|
||||
const Glib::ustring & text
|
||||
);
|
||||
|
||||
~Plain();
|
||||
};
|
||||
}
|
||||
|
||||
#endif // APP_BROWSER_MAIN_TAB_PAGE_CONTENT_TEXT_PLAIN_HPP
|
||||
Loading…
Add table
Add a link
Reference in a new issue