Improvements

Added new method 'makePreview'
This commit is contained in:
Valentino Orlandi 2022-08-04 21:54:23 +02:00
parent 876322c3e1
commit b68670700b
Signed by: elB4RTO
GPG Key ID: 1719E976DB2D4E71
2 changed files with 109 additions and 0 deletions

View File

@ -8,6 +8,7 @@ TextBrowser::TextBrowser()
}
// getters
bool TextBrowser::getWideLinesUsage() const
{
return this->wide_lines;
@ -65,3 +66,108 @@ void TextBrowser::setFont( const QFont& font )
{
this->font = font;
}
// preview
void TextBrowser::makePreview( QString& content )
{
content += QString("<!DOCTYPE html><html><head></head><body");
if ( this->color_scheme_id > 0 ) {
content += QString(" style=\"background:%1; color:%2\"")
.arg( this->color_scheme.at("background"),
this->color_scheme.at("text") );
}
content += ">";
if ( wide_lines == true ) {
content += "<br/>";
}
for ( int i=0; i<32; i++ ) {
content += "<p>";
content += "<b>";
if ( this->color_scheme_id > 0 ) {
content += QString("<span style=\"color:%1\">").arg( this->color_scheme.at("time") );
}
content += "2000-01-01 23:59:59";
if ( this->color_scheme_id > 0 ) {
content += "</span>";
}
content += "</b>";
content += " <b>";
if ( this->color_scheme_id > 0 ) {
content += QString("<span style=\"color:%1\">").arg( this->color_scheme.at("req_err") );
}
content += "HTTP/1.1 GET /index.php query=x";
if ( this->color_scheme_id > 0 ) {
content += "</span>";
}
content += "</b>";
content += " <b>";
if ( this->color_scheme_id > 0 ) {
content += QString("<span style=\"color:%1\">").arg( this->color_scheme.at("res_lev") );
}
content += "404</b>";
if ( this->color_scheme_id > 0 ) {
content += "</span>";
}
content += "</b>";
content += " <b>";
if ( this->color_scheme_id > 0 ) {
content += QString("<span style=\"color:%1\">").arg( this->color_scheme.at("x") );
}
content += "123 1234 1000";
if ( this->color_scheme_id > 0 ) {
content += "</span>";
}
content += "</b>";
content += " \"<b>";
if ( this->color_scheme_id > 0 ) {
content += QString("<span style=\"color:%1\">").arg( this->color_scheme.at("x") );
}
content += "http://www.referrer.site";
if ( this->color_scheme_id > 0 ) {
content += "</span>";
}
content += "</b>\"";
content += " \"<b>";
if ( this->color_scheme_id > 0 ) {
content += QString("<span style=\"color:%1\">").arg( this->color_scheme.at("x") );
}
content += "aCookie=abc123";
if ( this->color_scheme_id > 0 ) {
content += "</span>";
}
content += "</b>\"";
content += " \"<b>";
if ( this->color_scheme_id > 0 ) {
content += QString("<span style=\"color:%1\">").arg( this->color_scheme.at("ua_src") );
}
content += "UserAgent/3.0 (Details stuff) Info/123";
if ( this->color_scheme_id > 0 ) {
content += "</span>";
}
content += "</b>\"";
content += " <b>";
if ( this->color_scheme_id > 0 ) {
content += QString("<span style=\"color:%1\">").arg( this->color_scheme.at("ip") );
}
content += "192.168.1.123";
if ( this->color_scheme_id > 0 ) {
content += "</span>";
}
content += "</b>";
content += "</p>";
if ( this->wide_lines == true ) {
content += "<br/>";
}
}
content += "</body></html>";
}

View File

@ -25,6 +25,9 @@ public:
void setFontFamily( const QString& font_family );
void setFont( const QFont& font );
// preview
void makePreview( QString& content );
private:
bool wide_lines = false;
int color_scheme_id = 1;