mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 09:05:27 +00:00
implement title detection by content type provider
This commit is contained in:
parent
5e88040bf0
commit
f31dc84fe6
9 changed files with 83 additions and 9 deletions
|
|
@ -4,19 +4,26 @@
|
|||
using namespace app::browser::main::tab::page::content::text;
|
||||
|
||||
Gemini::Gemini(
|
||||
const Glib::ustring & GEMTEXT
|
||||
const Glib::ustring & GEMTEXT,
|
||||
Glib::ustring & title
|
||||
) : Gtk::Viewport( // add scrolled window features to childs
|
||||
NULL,
|
||||
NULL
|
||||
) {
|
||||
// Init components
|
||||
auto geminiReader = Gtk::make_managed<gemini::Reader>(
|
||||
GEMTEXT
|
||||
);
|
||||
|
||||
// Grab title
|
||||
title = geminiReader->get_title();
|
||||
|
||||
// Init widget
|
||||
set_scroll_to_focus(
|
||||
false
|
||||
);
|
||||
|
||||
set_child(
|
||||
* Gtk::make_managed<gemini::Reader>(
|
||||
GEMTEXT
|
||||
)
|
||||
* geminiReader
|
||||
);
|
||||
}
|
||||
|
|
@ -8,10 +8,14 @@ namespace app::browser::main::tab::page::content::text
|
|||
{
|
||||
class Gemini : public Gtk::Viewport
|
||||
{
|
||||
/*
|
||||
* Gemini class API
|
||||
*/
|
||||
public:
|
||||
|
||||
Gemini(
|
||||
const Glib::ustring & GEMTEXT
|
||||
const Glib::ustring & GEMTEXT,
|
||||
Glib::ustring & title
|
||||
);
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,6 +52,12 @@ Reader::Reader(
|
|||
);
|
||||
}
|
||||
|
||||
// Getters
|
||||
Glib::ustring Reader::get_title()
|
||||
{
|
||||
return title;
|
||||
}
|
||||
|
||||
// Match tools
|
||||
bool Reader::Line::Match::header(
|
||||
const Glib::ustring & GEMTEXT,
|
||||
|
|
@ -152,6 +158,11 @@ Glib::ustring Reader::make(
|
|||
)
|
||||
);
|
||||
|
||||
if (title.empty())
|
||||
{
|
||||
title = header;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -62,18 +62,26 @@ namespace app::browser::main::tab::page::content::text::gemini
|
|||
);
|
||||
};
|
||||
|
||||
static Glib::ustring make(
|
||||
Glib::ustring make(
|
||||
const Glib::ustring & GEMTEXT
|
||||
);
|
||||
|
||||
/*
|
||||
* Gemini class API
|
||||
* Private members
|
||||
*/
|
||||
Glib::ustring title;
|
||||
|
||||
/*
|
||||
* Reader class API
|
||||
*/
|
||||
public:
|
||||
|
||||
Reader(
|
||||
const Glib::ustring & GEMTEXT
|
||||
);
|
||||
|
||||
// Getters
|
||||
Glib::ustring get_title();
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue