mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-02-05 16:04:15 +00:00
add text/plain content support
This commit is contained in:
parent
a73bb3aea6
commit
30e3ae691a
1
Makefile
1
Makefile
@ -15,6 +15,7 @@ SRCS = src/main.cpp\
|
|||||||
src/app/browser/main/tab/page.cpp\
|
src/app/browser/main/tab/page.cpp\
|
||||||
src/app/browser/main/tab/page/content.cpp\
|
src/app/browser/main/tab/page/content.cpp\
|
||||||
src/app/browser/main/tab/page/content/text/gemini.cpp\
|
src/app/browser/main/tab/page/content/text/gemini.cpp\
|
||||||
|
src/app/browser/main/tab/page/content/text/plain.cpp\
|
||||||
src/app/browser/main/tab/page/navbar.cpp\
|
src/app/browser/main/tab/page/navbar.cpp\
|
||||||
src/app/browser/main/tab/page/navbar/base.cpp\
|
src/app/browser/main/tab/page/navbar/base.cpp\
|
||||||
src/app/browser/main/tab/page/navbar/bookmark.cpp\
|
src/app/browser/main/tab/page/navbar/bookmark.cpp\
|
||||||
|
@ -7,6 +7,7 @@ src/app/browser/main/tab.cpp
|
|||||||
src/app/browser/main/tab/page.cpp
|
src/app/browser/main/tab/page.cpp
|
||||||
src/app/browser/main/tab/page/content.cpp
|
src/app/browser/main/tab/page/content.cpp
|
||||||
src/app/browser/main/tab/page/content/text/gemini.cpp
|
src/app/browser/main/tab/page/content/text/gemini.cpp
|
||||||
|
src/app/browser/main/tab/page/content/text/plain.cpp
|
||||||
src/app/browser/main/tab/page/navbar.cpp
|
src/app/browser/main/tab/page/navbar.cpp
|
||||||
src/app/browser/main/tab/page/navbar/base.cpp
|
src/app/browser/main/tab/page/navbar/base.cpp
|
||||||
src/app/browser/main/tab/page/navbar/bookmark.cpp
|
src/app/browser/main/tab/page/navbar/bookmark.cpp
|
||||||
|
@ -120,13 +120,17 @@ void Page::update()
|
|||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// @TODO exception
|
content->text_plain(
|
||||||
|
_("MIME type not supported")
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// @TODO exception
|
content->text_plain(
|
||||||
|
_("Could not open page")
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
socket_connection->close();
|
socket_connection->close();
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include <giomm/simpleactiongroup.h>
|
#include <giomm/simpleactiongroup.h>
|
||||||
#include <giomm/socketclient.h>
|
#include <giomm/socketclient.h>
|
||||||
#include <giomm/socketconnection.h>
|
#include <giomm/socketconnection.h>
|
||||||
|
#include <glibmm/i18n.h>
|
||||||
#include <glibmm/refptr.h>
|
#include <glibmm/refptr.h>
|
||||||
#include <glibmm/regex.h>
|
#include <glibmm/regex.h>
|
||||||
#include <glibmm/ustring.h>
|
#include <glibmm/ustring.h>
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include "content.hpp"
|
#include "content.hpp"
|
||||||
#include "content/text/gemini.hpp"
|
#include "content/text/gemini.hpp"
|
||||||
|
#include "content/text/plain.hpp"
|
||||||
|
|
||||||
using namespace app::browser::main::tab::page;
|
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.
|
// @TODO text_plain, picture, video, etc.
|
||||||
|
|
||||||
// Private helpers
|
// Private helpers
|
||||||
|
@ -24,6 +24,10 @@ namespace app::browser::main::tab::page
|
|||||||
void text_gemini(
|
void text_gemini(
|
||||||
const Glib::ustring & gemtext
|
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…
x
Reference in New Issue
Block a user