diff --git a/resources/rssguard.qrc b/resources/rssguard.qrc index 0378fa385..85dc7bf5f 100644 --- a/resources/rssguard.qrc +++ b/resources/rssguard.qrc @@ -6,9 +6,7 @@ text/COPYING_BOOLINQ text/COPYING_GNU_GPL text/COPYING_GNU_LGPL - text/COPYING_GUMBO - text/COPYING_LITEHTML - text/COPYING_QLITEHTML + text/COPYING_QT sounds/boing.wav sounds/rooster.wav diff --git a/resources/text/COPYING_GUMBO b/resources/text/COPYING_GUMBO deleted file mode 100755 index d64569567..000000000 --- a/resources/text/COPYING_GUMBO +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/resources/text/COPYING_LITEHTML b/resources/text/COPYING_LITEHTML deleted file mode 100755 index 601e1c712..000000000 --- a/resources/text/COPYING_LITEHTML +++ /dev/null @@ -1,24 +0,0 @@ -Copyright (c) 2013, Yuri Kobets (tordex) -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - * Neither the name of the nor the - names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/resources/text/COPYING_QLITEHTML b/resources/text/COPYING_QT old mode 100755 new mode 100644 similarity index 100% rename from resources/text/COPYING_QLITEHTML rename to resources/text/COPYING_QT diff --git a/resources/text/licenses.json b/resources/text/licenses.json index 243e81cab..792634fe5 100755 --- a/resources/text/licenses.json +++ b/resources/text/licenses.json @@ -16,17 +16,7 @@ }, { "title": "GNU GPL v3.0 + Qt Company GPL Exception 1.0", - "file": "COPYING_QLITEHTML", - "components": "Qt, qlitehtml" - }, - { - "title": "3-Clause BSD License", - "file": "COPYING_LITEHTML", - "components": "litehtml" - }, - { - "title": "Apache License, Version 2.0", - "file": "COPYING_GUMBO", - "components": "Gumbo" + "file": "COPYING_QT", + "components": "Qt" } ] \ No newline at end of file diff --git a/src/librssguard/3rd-party/qlitehtml/3rdparty/GUMBO-AUTHORS.txt b/src/librssguard/3rd-party/qlitehtml/3rdparty/GUMBO-AUTHORS.txt deleted file mode 100644 index 54ec74b8b..000000000 --- a/src/librssguard/3rd-party/qlitehtml/3rdparty/GUMBO-AUTHORS.txt +++ /dev/null @@ -1,2 +0,0 @@ -Copyright 2010, 2011 Google Inc. -Copyright 2008-2009 Bjoern Hoehrmann \ No newline at end of file diff --git a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/LICENSE b/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/LICENSE deleted file mode 100644 index 601e1c712..000000000 --- a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/LICENSE +++ /dev/null @@ -1,24 +0,0 @@ -Copyright (c) 2013, Yuri Kobets (tordex) -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - * Neither the name of the nor the - names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/README.md b/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/README.md deleted file mode 100644 index c5df6b2d1..000000000 --- a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/README.md +++ /dev/null @@ -1,38 +0,0 @@ -# What is litehtml? - -**litehtml** is the lightweight HTML rendering engine with CSS2/CSS3 support. Note that **litehtml** itself does not draw any text, pictures or other graphics and that **litehtml** does not depend on any image/draw/font library. You are free to use any library to draw images, fonts and any other graphics. **litehtml** just parses HTML/CSS and places the HTML elements into the correct positions (renders HTML). To draw the HTML elements you have to implement the simple callback interface [document_container](https://github.com/litehtml/litehtml/wiki/document_container). This interface is really simple, check it out! The [document_container](https://github.com/litehtml/litehtml/wiki/document_container) implementation is required to render HTML correctly. - -# Where litehtml can be used - -**litehtml** can be used when you need to show HTML formatted text or even to create a mini-browser, but using it as a full-featured HTML engine is not recommended. Usually you don't need something like WebKit to show simple HTML tooltips or HTML-formatted text, **litehtml** is much better for these as it's more lightweight and easier to integrate into your application. - -## HTML Parser - -**litehtml** uses the [gumbo-parser](https://github.com/google/gumbo-parser) to parse HTML. Gumbo is an implementation of the HTML5 parsing algorithm implemented as a pure C99 library with no outside dependencies. It's designed to serve as a building block for other tools and libraries such as linters, validators, templating languages, and refactoring and analysis tools. - -## Compatibility - -**litehtml** is compatible with any platform suported by C++ and STL. For Windows MS Visual Studio 2013 is recommended. **litehtml** supports both UTF-8 and Unicode strings on Windows and UTF-8 strings on Linux and Haiku. - -## Support for HTML and CSS standards - -Unfortunately **litehtml** is not fully compatible with HTML/CSS standards. There is lots of work to do to make **litehtml** work as well as modern browsers. But **litehtml** supports most HTML tags and CSS properties. You can find the list of supported CSS properties in [this table](https://docs.google.com/spreadsheet/ccc?key=0AvHXl5n24PuhdHdELUdhaUl4OGlncXhDcDJuM1JpMnc&usp=sharing). For most simple usecases the HTML/CSS features supported by **litehtml** are enough. Right now **litehtml** supports even some pages with very complex HTML/CSS designs. As an example the pages created with [bootstrap framework](http://getbootstrap.com/) are usually well formatted by **litehtml**. - -## Testing litehtml - -You can [download the simple browser](http://www.litehtml.com/download.html) (**litebrowser**) to test the **litehtml** rendering engine. - -The litebrowser source codes are available on GitHub: - * [For Windows](https://github.com/litehtml/litebrowser) - * [For Linux](https://github.com/litehtml/litebrowser-linux) - * [For Haiku](https://github.com/adamfowleruk/litebrowser-haiku) - -## License - -**litehtml** is distributed under [New BSD License](https://opensource.org/licenses/BSD-3-Clause). -The **gumbo-parser** is disributed under [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0) - -## Links - - * [source code](https://github.com/litehtml/litehtml) - * [website](http://www.litehtml.com/) diff --git a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml.h b/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml.h deleted file mode 100644 index 98a24e0da..000000000 --- a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef LITEHTML_H -#define LITEHTML_H - -#include -#include -#include -#include -#include - -#endif // LITEHTML_H diff --git a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/attributes.h b/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/attributes.h deleted file mode 100644 index 98487f02e..000000000 --- a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/attributes.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef LH_ATTRIBUTES_H -#define LH_ATTRIBUTES_H - -namespace litehtml -{ - struct attr_color - { - unsigned char rgbBlue; - unsigned char rgbGreen; - unsigned char rgbRed; - unsigned char rgbAlpha; - attr_color() - { - rgbAlpha = 255; - rgbBlue = 0; - rgbGreen = 0; - rgbRed = 0; - } - }; - - struct attr_border - { - style_border border; - int width; - attr_color color; - - attr_border() - { - border = borderNone; - width = 0; - } - }; -} - -#endif // LH_ATTRIBUTES_H diff --git a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/background.h b/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/background.h deleted file mode 100644 index 35b022b3c..000000000 --- a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/background.h +++ /dev/null @@ -1,58 +0,0 @@ -#ifndef LH_BACKGROUND_H -#define LH_BACKGROUND_H - -#include "types.h" -#include "attributes.h" -#include "css_length.h" -#include "css_position.h" -#include "web_color.h" -#include "borders.h" - -namespace litehtml -{ - class background - { - public: - tstring m_image; - tstring m_baseurl; - web_color m_color; - background_attachment m_attachment; - css_position m_position; - background_repeat m_repeat; - background_box m_clip; - background_box m_origin; - css_border_radius m_radius; - - public: - background(); - background(const background& val); - ~background() = default; - - background& operator=(const background& val); - }; - - class background_paint - { - public: - tstring image; - tstring baseurl; - background_attachment attachment; - background_repeat repeat; - web_color color; - position clip_box; - position origin_box; - position border_box; - border_radiuses border_radius; - size image_size; - int position_x; - int position_y; - bool is_root; - public: - background_paint(); - background_paint(const background_paint& val); - background_paint& operator=(const background& val); - }; - -} - -#endif // LH_BACKGROUND_H diff --git a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/borders.h b/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/borders.h deleted file mode 100644 index 72618670d..000000000 --- a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/borders.h +++ /dev/null @@ -1,305 +0,0 @@ -#ifndef LH_BORDERS_H -#define LH_BORDERS_H - -#include "css_length.h" -#include "types.h" - -namespace litehtml -{ - struct css_border - { - css_length width; - border_style style; - web_color color; - - css_border() - { - style = border_style_none; - } - - css_border(const css_border& val) - { - width = val.width; - style = val.style; - color = val.color; - } - - css_border& operator=(const css_border& val) - { - width = val.width; - style = val.style; - color = val.color; - return *this; - } - }; - - struct border - { - int width; - border_style style; - web_color color; - - border() - { - width = 0; - } - border(const border& val) - { - width = val.width; - style = val.style; - color = val.color; - } - border(const css_border& val) - { - width = (int) val.width.val(); - style = val.style; - color = val.color; - } - border& operator=(const border& val) - { - width = val.width; - style = val.style; - color = val.color; - return *this; - } - border& operator=(const css_border& val) - { - width = (int) val.width.val(); - style = val.style; - color = val.color; - return *this; - } - }; - - struct border_radiuses - { - int top_left_x; - int top_left_y; - - int top_right_x; - int top_right_y; - - int bottom_right_x; - int bottom_right_y; - - int bottom_left_x; - int bottom_left_y; - - border_radiuses() - { - top_left_x = 0; - top_left_y = 0; - top_right_x = 0; - top_right_y = 0; - bottom_right_x = 0; - bottom_right_y = 0; - bottom_left_x = 0; - bottom_left_y = 0; - } - border_radiuses(const border_radiuses& val) - { - top_left_x = val.top_left_x; - top_left_y = val.top_left_y; - top_right_x = val.top_right_x; - top_right_y = val.top_right_y; - bottom_right_x = val.bottom_right_x; - bottom_right_y = val.bottom_right_y; - bottom_left_x = val.bottom_left_x; - bottom_left_y = val.bottom_left_y; - } - border_radiuses& operator = (const border_radiuses& val) - { - top_left_x = val.top_left_x; - top_left_y = val.top_left_y; - top_right_x = val.top_right_x; - top_right_y = val.top_right_y; - bottom_right_x = val.bottom_right_x; - bottom_right_y = val.bottom_right_y; - bottom_left_x = val.bottom_left_x; - bottom_left_y = val.bottom_left_y; - return *this; - } - void operator += (const margins& mg) - { - top_left_x += mg.left; - top_left_y += mg.top; - top_right_x += mg.right; - top_right_y += mg.top; - bottom_right_x += mg.right; - bottom_right_y += mg.bottom; - bottom_left_x += mg.left; - bottom_left_y += mg.bottom; - fix_values(); - } - void operator -= (const margins& mg) - { - top_left_x -= mg.left; - top_left_y -= mg.top; - top_right_x -= mg.right; - top_right_y -= mg.top; - bottom_right_x -= mg.right; - bottom_right_y -= mg.bottom; - bottom_left_x -= mg.left; - bottom_left_y -= mg.bottom; - fix_values(); - } - void fix_values() - { - if (top_left_x < 0) top_left_x = 0; - if (top_left_y < 0) top_left_y = 0; - if (top_right_x < 0) top_right_x = 0; - if (top_right_y < 0) top_right_y = 0; - if (bottom_right_x < 0) bottom_right_x = 0; - if (bottom_right_y < 0) bottom_right_y = 0; - if (bottom_left_x < 0) bottom_left_x = 0; - if (bottom_left_y < 0) bottom_left_y = 0; - } - }; - - struct css_border_radius - { - css_length top_left_x; - css_length top_left_y; - - css_length top_right_x; - css_length top_right_y; - - css_length bottom_right_x; - css_length bottom_right_y; - - css_length bottom_left_x; - css_length bottom_left_y; - - css_border_radius() - { - - } - - css_border_radius(const css_border_radius& val) - { - top_left_x = val.top_left_x; - top_left_y = val.top_left_y; - top_right_x = val.top_right_x; - top_right_y = val.top_right_y; - bottom_left_x = val.bottom_left_x; - bottom_left_y = val.bottom_left_y; - bottom_right_x = val.bottom_right_x; - bottom_right_y = val.bottom_right_y; - } - - css_border_radius& operator=(const css_border_radius& val) - { - top_left_x = val.top_left_x; - top_left_y = val.top_left_y; - top_right_x = val.top_right_x; - top_right_y = val.top_right_y; - bottom_left_x = val.bottom_left_x; - bottom_left_y = val.bottom_left_y; - bottom_right_x = val.bottom_right_x; - bottom_right_y = val.bottom_right_y; - return *this; - } - border_radiuses calc_percents(int width, int height) - { - border_radiuses ret; - ret.bottom_left_x = bottom_left_x.calc_percent(width); - ret.bottom_left_y = bottom_left_y.calc_percent(height); - ret.top_left_x = top_left_x.calc_percent(width); - ret.top_left_y = top_left_y.calc_percent(height); - ret.top_right_x = top_right_x.calc_percent(width); - ret.top_right_y = top_right_y.calc_percent(height); - ret.bottom_right_x = bottom_right_x.calc_percent(width); - ret.bottom_right_y = bottom_right_y.calc_percent(height); - return ret; - } - }; - - struct css_borders - { - css_border left; - css_border top; - css_border right; - css_border bottom; - css_border_radius radius; - - css_borders() = default; - - bool is_visible() const - { - return left.width.val() != 0 || right.width.val() != 0 || top.width.val() != 0 || bottom.width.val() != 0; - } - - css_borders(const css_borders& val) - { - left = val.left; - right = val.right; - top = val.top; - bottom = val.bottom; - radius = val.radius; - } - - css_borders& operator=(const css_borders& val) - { - left = val.left; - right = val.right; - top = val.top; - bottom = val.bottom; - radius = val.radius; - return *this; - } - }; - - struct borders - { - border left; - border top; - border right; - border bottom; - border_radiuses radius; - - borders() = default; - - borders(const borders& val) - { - left = val.left; - right = val.right; - top = val.top; - bottom = val.bottom; - radius = val.radius; - } - - borders(const css_borders& val) - { - left = val.left; - right = val.right; - top = val.top; - bottom = val.bottom; - } - - bool is_visible() const - { - return left.width != 0 || right.width != 0 || top.width != 0 || bottom.width != 0; - } - - borders& operator=(const borders& val) - { - left = val.left; - right = val.right; - top = val.top; - bottom = val.bottom; - radius = val.radius; - return *this; - } - - borders& operator=(const css_borders& val) - { - left = val.left; - right = val.right; - top = val.top; - bottom = val.bottom; - return *this; - } - }; -} - -#endif // LH_BORDERS_H diff --git a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/box.h b/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/box.h deleted file mode 100644 index 32c674e7a..000000000 --- a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/box.h +++ /dev/null @@ -1,120 +0,0 @@ -#ifndef LH_BOX_H -#define LH_BOX_H - -namespace litehtml -{ - class html_tag; - - enum box_type - { - box_block, - box_line - }; - - class box - { - public: - typedef std::unique_ptr ptr; - typedef std::vector< box::ptr > vector; - protected: - int m_box_top; - int m_box_left; - int m_box_right; - public: - box(int top, int left, int right) - { - m_box_top = top; - m_box_left = left; - m_box_right = right; - } - virtual ~box() = default; - - int bottom() const { return m_box_top + height(); } - int top() const { return m_box_top; } - int right() const { return m_box_left + width(); } - int left() const { return m_box_left; } - - virtual litehtml::box_type get_type() const = 0; - virtual int height() const = 0; - virtual int width() const = 0; - virtual void add_element(const element::ptr &el) = 0; - virtual bool can_hold(const element::ptr &el, white_space ws) const = 0; - virtual void finish(bool last_box = false) = 0; - virtual bool is_empty() const = 0; - virtual int baseline() const = 0; - virtual void get_elements(elements_vector& els) = 0; - virtual int top_margin() const = 0; - virtual int bottom_margin() const = 0; - virtual void y_shift(int shift) = 0; - virtual void new_width(int left, int right, elements_vector& els) = 0; - }; - - ////////////////////////////////////////////////////////////////////////// - - class block_box : public box - { - element::ptr m_element; - public: - block_box(int top, int left, int right) : box(top, left, right) - { - m_element = nullptr; - } - - litehtml::box_type get_type() const override; - int height() const override; - int width() const override; - void add_element(const element::ptr &el) override; - bool can_hold(const element::ptr &el, white_space ws) const override; - void finish(bool last_box = false) override; - bool is_empty() const override; - int baseline() const override; - void get_elements(elements_vector& els) override; - int top_margin() const override; - int bottom_margin() const override; - void y_shift(int shift) override; - void new_width(int left, int right, elements_vector& els) override; - }; - - ////////////////////////////////////////////////////////////////////////// - - class line_box : public box - { - elements_vector m_items; - int m_height; - int m_width; - int m_line_height; - font_metrics m_font_metrics; - int m_baseline; - text_align m_text_align; - public: - line_box(int top, int left, int right, int line_height, font_metrics& fm, text_align align) : box(top, left, right) - { - m_height = 0; - m_width = 0; - m_font_metrics = fm; - m_line_height = line_height; - m_baseline = 0; - m_text_align = align; - } - - litehtml::box_type get_type() const override; - int height() const override; - int width() const override; - void add_element(const element::ptr &el) override; - bool can_hold(const element::ptr &el, white_space ws) const override; - void finish(bool last_box = false) override; - bool is_empty() const override; - int baseline() const override; - void get_elements(elements_vector& els) override; - int top_margin() const override; - int bottom_margin() const override; - void y_shift(int shift) override; - void new_width(int left, int right, elements_vector& els) override; - - private: - bool have_last_space() const; - bool is_break_only() const; - }; -} - -#endif // LH_BOX_H diff --git a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/codepoint.h b/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/codepoint.h deleted file mode 100644 index 0bd7906b7..000000000 --- a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/codepoint.h +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (C) 2020-2021 Primate Labs Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the copyright holders nor the names of their -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#ifndef LITEHTML_CODEPOINT_H__ -#define LITEHTML_CODEPOINT_H__ - -#include - -#include "litehtml/os_types.h" - -namespace litehtml { - -bool is_ascii_codepoint(litehtml::tchar_t c); - -// Returns true if the codepoint is a reserved codepoint for URLs. -// https://datatracker.ietf.org/doc/html/rfc3986#section-2.2 -bool is_url_reserved_codepoint(litehtml::tchar_t c); - -// Returns true if the codepoint is a scheme codepoint for URLs. -// https://datatracker.ietf.org/doc/html/rfc3986#section-3.1 -bool is_url_scheme_codepoint(litehtml::tchar_t c); - -} // namespace litehtml - -#endif // LITEHTML_CODEPOINT_H__ diff --git a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/context.h b/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/context.h deleted file mode 100644 index b6450f8f5..000000000 --- a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/context.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef LH_CONTEXT_H -#define LH_CONTEXT_H - -#include "stylesheet.h" - -namespace litehtml -{ - class context - { - litehtml::css m_master_css; - public: - void load_master_stylesheet(const tchar_t* str); - litehtml::css& master_css() - { - return m_master_css; - } - }; -} - -#endif // LH_CONTEXT_H diff --git a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/css_length.h b/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/css_length.h deleted file mode 100644 index 13a3d77b7..000000000 --- a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/css_length.h +++ /dev/null @@ -1,135 +0,0 @@ -#ifndef LH_CSS_LENGTH_H -#define LH_CSS_LENGTH_H - -#include "types.h" - -namespace litehtml -{ - class css_length - { - union - { - float m_value; - int m_predef; - }; - css_units m_units; - bool m_is_predefined; - public: - css_length(); - css_length(const css_length& val); - - css_length& operator=(const css_length& val); - css_length& operator=(float val); - bool is_predefined() const; - void predef(int val); - int predef() const; - void set_value(float val, css_units units); - float val() const; - css_units units() const; - int calc_percent(int width) const; - void fromString(const tstring& str, const tstring& predefs = _t(""), int defValue = 0); - }; - - // css_length inlines - - inline css_length::css_length() - { - m_value = 0; - m_predef = 0; - m_units = css_units_none; - m_is_predefined = false; - } - - inline css_length::css_length(const css_length& val) - { - if(val.is_predefined()) - { - m_predef = val.m_predef; - } else - { - m_value = val.m_value; - } - m_units = val.m_units; - m_is_predefined = val.m_is_predefined; - } - - inline css_length& css_length::operator=(const css_length& val) - { - if(val.is_predefined()) - { - m_predef = val.m_predef; - } else - { - m_value = val.m_value; - } - m_units = val.m_units; - m_is_predefined = val.m_is_predefined; - return *this; - } - - inline css_length& css_length::operator=(float val) - { - m_value = val; - m_units = css_units_px; - m_is_predefined = false; - return *this; - } - - inline bool css_length::is_predefined() const - { - return m_is_predefined; - } - - inline void css_length::predef(int val) - { - m_predef = val; - m_is_predefined = true; - } - - inline int css_length::predef() const - { - if(m_is_predefined) - { - return m_predef; - } - return 0; - } - - inline void css_length::set_value(float val, css_units units) - { - m_value = val; - m_is_predefined = false; - m_units = units; - } - - inline float css_length::val() const - { - if(!m_is_predefined) - { - return m_value; - } - return 0; - } - - inline css_units css_length::units() const - { - return m_units; - } - - inline int css_length::calc_percent(int width) const - { - if(!is_predefined()) - { - if(units() == css_units_percentage) - { - return (int) ((double) width * (double) m_value / 100.0); - } else - { - return (int) val(); - } - } - return 0; - } -} - -#endif // LH_CSS_LENGTH_H diff --git a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/css_margins.h b/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/css_margins.h deleted file mode 100644 index def378a52..000000000 --- a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/css_margins.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef LH_CSS_MARGINS_H -#define LH_CSS_MARGINS_H - -#include "css_length.h" - -namespace litehtml -{ - struct css_margins - { - css_length left; - css_length right; - css_length top; - css_length bottom; - - css_margins() = default; - - css_margins(const css_margins& val) - { - left = val.left; - right = val.right; - top = val.top; - bottom = val.bottom; - } - - css_margins& operator=(const css_margins& val) - { - left = val.left; - right = val.right; - top = val.top; - bottom = val.bottom; - return *this; - } - }; -} - -#endif // LH_CSS_MARGINS_H diff --git a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/css_offsets.h b/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/css_offsets.h deleted file mode 100644 index abeddfb6c..000000000 --- a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/css_offsets.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef LH_CSS_OFFSETS_H -#define LH_CSS_OFFSETS_H - -#include "css_length.h" - -namespace litehtml -{ - struct css_offsets - { - css_length left; - css_length top; - css_length right; - css_length bottom; - - css_offsets() = default; - - css_offsets(const css_offsets& val) - { - left = val.left; - top = val.top; - right = val.right; - bottom = val.bottom; - } - - css_offsets& operator=(const css_offsets& val) - { - left = val.left; - top = val.top; - right = val.right; - bottom = val.bottom; - return *this; - } - }; -} - -#endif // LH_CSS_OFFSETS_H diff --git a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/css_position.h b/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/css_position.h deleted file mode 100644 index 1f884121b..000000000 --- a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/css_position.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef LH_CSS_POSITION_H -#define LH_CSS_POSITION_H - -#include "css_length.h" - -namespace litehtml -{ - struct css_position - { - css_length x; - css_length y; - css_length width; - css_length height; - - css_position() = default; - - css_position(const css_position& val) - { - x = val.x; - y = val.y; - width = val.width; - height = val.height; - } - - css_position& operator=(const css_position& val) - { - x = val.x; - y = val.y; - width = val.width; - height = val.height; - return *this; - } - }; -} - -#endif // LH_CSS_POSITION_H diff --git a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/css_selector.h b/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/css_selector.h deleted file mode 100644 index da64df091..000000000 --- a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/css_selector.h +++ /dev/null @@ -1,278 +0,0 @@ -#ifndef LH_CSS_SELECTOR_H -#define LH_CSS_SELECTOR_H - -#include "style.h" -#include "media_query.h" - -namespace litehtml -{ - ////////////////////////////////////////////////////////////////////////// - - struct selector_specificity - { - int a; - int b; - int c; - int d; - - explicit selector_specificity(int va = 0, int vb = 0, int vc = 0, int vd = 0) - { - a = va; - b = vb; - c = vc; - d = vd; - } - - void operator += (const selector_specificity& val) - { - a += val.a; - b += val.b; - c += val.c; - d += val.d; - } - - bool operator==(const selector_specificity& val) const - { - if(a == val.a && b == val.b && c == val.c && d == val.d) - { - return true; - } - return false; - } - - bool operator!=(const selector_specificity& val) const - { - if(a != val.a || b != val.b || c != val.c || d != val.d) - { - return true; - } - return false; - } - - bool operator > (const selector_specificity& val) const - { - if(a > val.a) - { - return true; - } else if(a < val.a) - { - return false; - } else - { - if(b > val.b) - { - return true; - } else if(b < val.b) - { - return false; - } else - { - if(c > val.c) - { - return true; - } else if(c < val.c) - { - return false; - } else - { - if(d > val.d) - { - return true; - } else if(d < val.d) - { - return false; - } - } - } - } - return false; - } - - bool operator >= (const selector_specificity& val) const - { - if((*this) == val) return true; - if((*this) > val) return true; - return false; - } - - bool operator <= (const selector_specificity& val) const - { - if((*this) > val) - { - return false; - } - return true; - } - - bool operator < (const selector_specificity& val) const - { - if((*this) <= val && (*this) != val) - { - return true; - } - return false; - } - - }; - - ////////////////////////////////////////////////////////////////////////// - - enum attr_select_condition - { - select_exists, - select_equal, - select_contain_str, - select_start_str, - select_end_str, - select_pseudo_class, - select_pseudo_element, - }; - - ////////////////////////////////////////////////////////////////////////// - - struct css_attribute_selector - { - typedef std::vector vector; - - tstring attribute; - tstring val; - string_vector class_val; - attr_select_condition condition; - - css_attribute_selector() - { - condition = select_exists; - } - }; - - ////////////////////////////////////////////////////////////////////////// - - class css_element_selector - { - public: - tstring m_tag; - css_attribute_selector::vector m_attrs; - public: - - void parse(const tstring& txt); - }; - - ////////////////////////////////////////////////////////////////////////// - - enum css_combinator - { - combinator_descendant, - combinator_child, - combinator_adjacent_sibling, - combinator_general_sibling - }; - - ////////////////////////////////////////////////////////////////////////// - - class css_selector - { - public: - typedef std::shared_ptr ptr; - typedef std::vector vector; - public: - selector_specificity m_specificity; - css_element_selector m_right; - css_selector::ptr m_left; - css_combinator m_combinator; - tstring m_style; - int m_order; - media_query_list::ptr m_media_query; - tstring m_baseurl; - public: - explicit css_selector(const media_query_list::ptr& media, const tstring& baseurl) - { - m_media_query = media; - m_baseurl = baseurl; - m_combinator = combinator_descendant; - m_order = 0; - } - - ~css_selector() = default; - - css_selector(const css_selector& val) - { - m_right = val.m_right; - if(val.m_left) - { - m_left = std::make_shared(*val.m_left); - } else - { - m_left = nullptr; - } - m_combinator = val.m_combinator; - m_specificity = val.m_specificity; - m_order = val.m_order; - m_media_query = val.m_media_query; - } - - bool parse(const tstring& text); - void calc_specificity(); - bool is_media_valid() const; - void add_media_to_doc(document* doc) const; - }; - - inline bool css_selector::is_media_valid() const - { - if(!m_media_query) - { - return true; - } - return m_media_query->is_used(); - } - - - ////////////////////////////////////////////////////////////////////////// - - inline bool operator > (const css_selector& v1, const css_selector& v2) - { - if(v1.m_specificity == v2.m_specificity) - { - return (v1.m_order > v2.m_order); - } - return (v1.m_specificity > v2.m_specificity); - } - - inline bool operator < (const css_selector& v1, const css_selector& v2) - { - if(v1.m_specificity == v2.m_specificity) - { - return (v1.m_order < v2.m_order); - } - return (v1.m_specificity < v2.m_specificity); - } - - inline bool operator >(const css_selector::ptr& v1, const css_selector::ptr& v2) - { - return (*v1 > *v2); - } - - inline bool operator < (const css_selector::ptr& v1, const css_selector::ptr& v2) - { - return (*v1 < *v2); - } - - ////////////////////////////////////////////////////////////////////////// - - class used_selector - { - public: - typedef std::unique_ptr ptr; - typedef std::vector vector; - - css_selector::ptr m_selector; - bool m_used; - - used_selector(const css_selector::ptr& selector, bool used) - { - m_used = used; - m_selector = selector; - } - }; -} - -#endif // LH_CSS_SELECTOR_H diff --git a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/document.h b/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/document.h deleted file mode 100644 index 1fd8dab89..000000000 --- a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/document.h +++ /dev/null @@ -1,117 +0,0 @@ -#ifndef LH_DOCUMENT_H -#define LH_DOCUMENT_H - -#include "style.h" -#include "types.h" -#include "context.h" - -namespace litehtml -{ - struct css_text - { - typedef std::vector vector; - - tstring text; - tstring baseurl; - tstring media; - - css_text() = default; - - css_text(const tchar_t* txt, const tchar_t* url, const tchar_t* media_str) - { - text = txt ? txt : _t(""); - baseurl = url ? url : _t(""); - media = media_str ? media_str : _t(""); - } - - css_text(const css_text& val) - { - text = val.text; - baseurl = val.baseurl; - media = val.media; - } - }; - - class html_tag; - - class document : public std::enable_shared_from_this - { - public: - typedef std::shared_ptr ptr; - typedef std::weak_ptr weak_ptr; - private: - std::shared_ptr m_root; - document_container* m_container; - fonts_map m_fonts; - css_text::vector m_css; - litehtml::css m_styles; - litehtml::web_color m_def_color; - litehtml::context* m_context; - litehtml::size m_size; - position::vector m_fixed_boxes; - media_query_list::vector m_media_lists; - element::ptr m_over_element; - elements_vector m_tabular_elements; - media_features m_media; - tstring m_lang; - tstring m_culture; - public: - document(litehtml::document_container* objContainer, litehtml::context* ctx); - virtual ~document(); - - litehtml::document_container* container() { return m_container; } - uint_ptr get_font(const tchar_t* name, int size, const tchar_t* weight, const tchar_t* style, const tchar_t* decoration, font_metrics* fm); - int render(int max_width, render_type rt = render_all); - void draw(uint_ptr hdc, int x, int y, const position* clip); - web_color get_def_color() { return m_def_color; } - int cvt_units(const tchar_t* str, int fontSize, bool* is_percent = nullptr) const; - int cvt_units(css_length& val, int fontSize, int size = 0) const; - int width() const; - int height() const; - void add_stylesheet(const tchar_t* str, const tchar_t* baseurl, const tchar_t* media); - bool on_mouse_over(int x, int y, int client_x, int client_y, position::vector& redraw_boxes); - bool on_lbutton_down(int x, int y, int client_x, int client_y, position::vector& redraw_boxes); - bool on_lbutton_up(int x, int y, int client_x, int client_y, position::vector& redraw_boxes); - bool on_mouse_leave(position::vector& redraw_boxes); - litehtml::element::ptr create_element(const tchar_t* tag_name, const string_map& attributes); - element::ptr root(); - void get_fixed_boxes(position::vector& fixed_boxes); - void add_fixed_box(const position& pos); - void add_media_list(const media_query_list::ptr& list); - bool media_changed(); - bool lang_changed(); - bool match_lang(const tstring & lang); - void add_tabular(const element::ptr& el); - element::const_ptr get_over_element() const { return m_over_element; } - - void append_children_from_string(element& parent, const tchar_t* str); - void append_children_from_utf8(element& parent, const char* str); - - static litehtml::document::ptr createFromString(const tchar_t* str, litehtml::document_container* objPainter, litehtml::context* ctx, litehtml::css* user_styles = nullptr); - static litehtml::document::ptr createFromUTF8(const char* str, litehtml::document_container* objPainter, litehtml::context* ctx, litehtml::css* user_styles = nullptr); - - private: - litehtml::uint_ptr add_font(const tchar_t* name, int size, const tchar_t* weight, const tchar_t* style, const tchar_t* decoration, font_metrics* fm); - - void create_node(void* gnode, elements_vector& elements, bool parseTextNode); - bool update_media_lists(const media_features& features); - void fix_tables_layout(); - void fix_table_children(element::ptr& el_ptr, style_display disp, const tchar_t* disp_str); - void fix_table_parent(element::ptr& el_ptr, style_display disp, const tchar_t* disp_str); - }; - - inline element::ptr document::root() - { - return m_root; - } - inline void document::add_tabular(const element::ptr& el) - { - m_tabular_elements.push_back(el); - } - inline bool document::match_lang(const tstring & lang) - { - return lang == m_lang || lang == m_culture; - } -} - -#endif // LH_DOCUMENT_H diff --git a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_anchor.h b/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_anchor.h deleted file mode 100644 index b33794c52..000000000 --- a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_anchor.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef LH_EL_ANCHOR_H -#define LH_EL_ANCHOR_H - -#include "html_tag.h" - -namespace litehtml -{ - class el_anchor : public html_tag - { - public: - explicit el_anchor(const std::shared_ptr& doc); - - void on_click() override; - void apply_stylesheet(const litehtml::css& stylesheet) override; - }; -} - -#endif // LH_EL_ANCHOR_H diff --git a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_base.h b/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_base.h deleted file mode 100644 index d7efb8064..000000000 --- a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_base.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef LH_EL_BASE_H -#define LH_EL_BASE_H - -#include "html_tag.h" - -namespace litehtml -{ - class el_base : public html_tag - { - public: - explicit el_base(const std::shared_ptr& doc); - - void parse_attributes() override; - }; -} - -#endif // LH_EL_BASE_H diff --git a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_before_after.h b/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_before_after.h deleted file mode 100644 index 34554c5b8..000000000 --- a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_before_after.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef LH_EL_BEFORE_AFTER_H -#define LH_EL_BEFORE_AFTER_H - -#include "html_tag.h" - -namespace litehtml -{ - class el_before_after_base : public html_tag - { - public: - el_before_after_base(const std::shared_ptr& doc, bool before); - - void add_style(const tstring& style, const tstring& baseurl) override; - void apply_stylesheet(const litehtml::css& stylesheet) override; - private: - void add_text(const tstring& txt); - void add_function(const tstring& fnc, const tstring& params); - static tstring convert_escape(const tchar_t* txt); - }; - - class el_before : public el_before_after_base - { - public: - explicit el_before(const std::shared_ptr& doc) : el_before_after_base(doc, true) - { - - } - }; - - class el_after : public el_before_after_base - { - public: - explicit el_after(const std::shared_ptr& doc) : el_before_after_base(doc, false) - { - - } - }; -} - -#endif // LH_EL_BEFORE_AFTER_H diff --git a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_body.h b/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_body.h deleted file mode 100644 index fb30e0c51..000000000 --- a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_body.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef LH_EL_BODY_H -#define LH_EL_BODY_H - -#include "html_tag.h" - -namespace litehtml -{ - class el_body : public html_tag - { - public: - explicit el_body(const std::shared_ptr& doc); - - bool is_body() const override; - }; -} - -#endif // LH_EL_BODY_H diff --git a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_break.h b/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_break.h deleted file mode 100644 index 81f38fec0..000000000 --- a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_break.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef LH_EL_BREAK_H -#define LH_EL_BREAK_H - -#include "html_tag.h" - -namespace litehtml -{ - class el_break : public html_tag - { - public: - explicit el_break(const std::shared_ptr& doc); - - bool is_break() const override; - }; -} - -#endif // LH_EL_BREAK_H diff --git a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_cdata.h b/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_cdata.h deleted file mode 100644 index a948c6201..000000000 --- a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_cdata.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef LH_EL_CDATA_H -#define LH_EL_CDATA_H - -#include "html_tag.h" - -namespace litehtml -{ - class el_cdata : public element - { - tstring m_text; - public: - explicit el_cdata(const std::shared_ptr& doc); - - void get_text(tstring& text) override; - void set_data(const tchar_t* data) override; - }; -} - -#endif // LH_EL_CDATA_H diff --git a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_comment.h b/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_comment.h deleted file mode 100644 index 543b3b80b..000000000 --- a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_comment.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef LH_EL_COMMENT_H -#define LH_EL_COMMENT_H - -#include "html_tag.h" - -namespace litehtml -{ - class el_comment : public element - { - tstring m_text; - public: - explicit el_comment(const std::shared_ptr& doc); - - bool is_comment() const override; - void get_text(tstring& text) override; - void set_data(const tchar_t* data) override; - }; -} - -#endif // LH_EL_COMMENT_H diff --git a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_div.h b/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_div.h deleted file mode 100644 index a2d031a32..000000000 --- a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_div.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef LH_EL_DIV_H -#define LH_EL_DIV_H - -#include "html_tag.h" - -namespace litehtml -{ - class el_div : public html_tag - { - public: - explicit el_div(const std::shared_ptr& doc); - - void parse_attributes() override; - }; -} - -#endif // LH_EL_DIV_H diff --git a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_font.h b/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_font.h deleted file mode 100644 index ccb894512..000000000 --- a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_font.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef LH_EL_FONT_H -#define LH_EL_FONT_H - -#include "html_tag.h" - -namespace litehtml -{ - class el_font : public html_tag - { - public: - explicit el_font(const std::shared_ptr& doc); - - void parse_attributes() override; - }; -} - -#endif // LH_EL_FONT_H diff --git a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_image.h b/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_image.h deleted file mode 100644 index fa13d3c1d..000000000 --- a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_image.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef LH_EL_IMAGE_H -#define LH_EL_IMAGE_H - -#include "html_tag.h" - -namespace litehtml -{ - - class el_image : public html_tag - { - tstring m_src; - public: - el_image(const std::shared_ptr& doc); - virtual ~el_image(void); - - virtual int line_height() const override; - virtual bool is_replaced() const override; - virtual int render(int x, int y, int max_width, bool second_pass = false) override; - virtual void parse_attributes() override; - virtual void parse_styles(bool is_reparse = false) override; - virtual void draw(uint_ptr hdc, int x, int y, const position* clip) override; - virtual void get_content_size(size& sz, int max_width) override; - private: - int calc_max_height(int image_height); - }; -} - -#endif // LH_EL_IMAGE_H diff --git a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_li.h b/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_li.h deleted file mode 100644 index 4500465bc..000000000 --- a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_li.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef LH_EL_LI_H -#define LH_EL_LI_H - -#include "html_tag.h" - -namespace litehtml -{ - class el_li : public html_tag - { - public: - explicit el_li(const std::shared_ptr& doc); - - int render(int x, int y, int max_width, bool second_pass = false) override; - - private: - bool m_index_initialized = false; - }; -} - -#endif // LH_EL_LI_H diff --git a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_link.h b/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_link.h deleted file mode 100644 index 0da3513dc..000000000 --- a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_link.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef LH_EL_LINK_H -#define LH_EL_LINK_H - -#include "html_tag.h" - -namespace litehtml -{ - class el_link : public html_tag - { - public: - explicit el_link(const std::shared_ptr& doc); - - protected: - void parse_attributes() override; - }; -} - -#endif // LH_EL_LINK_H diff --git a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_para.h b/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_para.h deleted file mode 100644 index 32ad53758..000000000 --- a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_para.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef LH_EL_PARA_H -#define LH_EL_PARA_H - -#include "html_tag.h" - -namespace litehtml -{ - class el_para : public html_tag - { - public: - explicit el_para(const std::shared_ptr& doc); - - void parse_attributes() override; - - }; -} - -#endif // LH_EL_PARA_H diff --git a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_script.h b/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_script.h deleted file mode 100644 index 66767957c..000000000 --- a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_script.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef LH_EL_SCRIPT_H -#define LH_EL_SCRIPT_H - -#include "html_tag.h" - -namespace litehtml -{ - class el_script : public element - { - tstring m_text; - public: - explicit el_script(const std::shared_ptr& doc); - - void parse_attributes() override; - bool appendChild(const ptr &el) override; - const tchar_t* get_tagName() const override; - }; -} - -#endif // LH_EL_SCRIPT_H diff --git a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_space.h b/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_space.h deleted file mode 100644 index e1c81b4f1..000000000 --- a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_space.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef LH_EL_SPACE_H -#define LH_EL_SPACE_H - -#include "html_tag.h" -#include "el_text.h" - -namespace litehtml -{ - class el_space : public el_text - { - public: - el_space(const tchar_t* text, const std::shared_ptr& doc); - - bool is_white_space() const override; - bool is_break() const override; - bool is_space() const override; - }; -} - -#endif // LH_EL_SPACE_H diff --git a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_style.h b/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_style.h deleted file mode 100644 index 630268808..000000000 --- a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_style.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef LH_EL_STYLE_H -#define LH_EL_STYLE_H - -#include "html_tag.h" - -namespace litehtml -{ - class el_style : public element - { - elements_vector m_children; - public: - explicit el_style(const std::shared_ptr& doc); - - void parse_attributes() override; - bool appendChild(const ptr &el) override; - const tchar_t* get_tagName() const override; - }; -} - -#endif // LH_EL_STYLE_H diff --git a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_table.h b/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_table.h deleted file mode 100644 index ea9752142..000000000 --- a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_table.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef LH_EL_TABLE_H -#define LH_EL_TABLE_H - -#include "html_tag.h" - -namespace litehtml -{ - struct col_info - { - int width; - bool is_auto; - }; - - - class el_table : public html_tag - { - public: - explicit el_table(const std::shared_ptr& doc); - - bool appendChild(const litehtml::element::ptr& el) override; - void parse_styles(bool is_reparse = false) override; - void parse_attributes() override; - }; -} - -#endif // LH_EL_TABLE_H diff --git a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_td.h b/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_td.h deleted file mode 100644 index 03d21c1c7..000000000 --- a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_td.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef LH_EL_TD_H -#define LH_EL_TD_H - -#include "html_tag.h" - -namespace litehtml -{ - class el_td : public html_tag - { - public: - explicit el_td(const std::shared_ptr& doc); - - void parse_attributes() override; - }; -} - -#endif // LH_EL_TD_H diff --git a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_text.h b/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_text.h deleted file mode 100644 index c53db7f7a..000000000 --- a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_text.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef LH_EL_TEXT_H -#define LH_EL_TEXT_H - -#include "html_tag.h" - -namespace litehtml -{ - class el_text : public element - { - protected: - tstring m_text; - tstring m_transformed_text; - size m_size; - text_transform m_text_transform; - bool m_use_transformed; - bool m_draw_spaces; - public: - el_text(const tchar_t* text, const std::shared_ptr& doc); - - void get_text(tstring& text) override; - const tchar_t* get_style_property(const tchar_t* name, bool inherited, const tchar_t* def = nullptr) const override; - void parse_styles(bool is_reparse) override; - int get_base_line() override; - void draw(uint_ptr hdc, int x, int y, const position* clip) override; - int line_height() const override; - uint_ptr get_font(font_metrics* fm = nullptr) override; - style_display get_display() const override; - white_space get_white_space() const override; - element_position get_element_position(css_offsets* offsets = nullptr) const override; - css_offsets get_css_offsets() const override; - - protected: - void get_content_size(size& sz, int max_width) override; - }; -} - -#endif // LH_EL_TEXT_H diff --git a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_title.h b/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_title.h deleted file mode 100644 index 201186a4a..000000000 --- a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_title.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef LH_EL_TITLE_H -#define LH_EL_TITLE_H - -#include "html_tag.h" - -namespace litehtml -{ - class el_title : public html_tag - { - public: - explicit el_title(const std::shared_ptr& doc); - - protected: - void parse_attributes() override; - }; -} - -#endif // LH_EL_TITLE_H diff --git a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_tr.h b/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_tr.h deleted file mode 100644 index 40a2f7038..000000000 --- a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/el_tr.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef LH_EL_TR_H -#define LH_EL_TR_H - -#include "html_tag.h" - -namespace litehtml -{ - class el_tr : public html_tag - { - public: - explicit el_tr(const std::shared_ptr& doc); - - void parse_attributes() override; - void get_inline_boxes(position::vector& boxes) override; - }; -} - -#endif // LH_EL_TR_H diff --git a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/element.h b/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/element.h deleted file mode 100644 index 829424395..000000000 --- a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/element.h +++ /dev/null @@ -1,408 +0,0 @@ -#ifndef LH_ELEMENT_H -#define LH_ELEMENT_H - -#include -#include "stylesheet.h" -#include "css_offsets.h" - -namespace litehtml -{ - class box; - - class element : public std::enable_shared_from_this - { - friend class block_box; - friend class line_box; - friend class html_tag; - friend class el_table; - friend class document; - public: - typedef std::shared_ptr ptr; - typedef std::shared_ptr const_ptr; - typedef std::weak_ptr weak_ptr; - protected: - std::weak_ptr m_parent; - std::weak_ptr m_doc; - litehtml::box* m_box; - elements_vector m_children; - position m_pos; - margins m_margins; - margins m_padding; - margins m_borders; - bool m_skip; - - virtual void select_all(const css_selector& selector, elements_vector& res); - public: - explicit element(const std::shared_ptr& doc); - virtual ~element() = default; - - // returns refer to m_pos member; - position& get_position(); - - int left() const; - int right() const; - int top() const; - int bottom() const; - int height() const; - int width() const; - - int content_margins_top() const; - int content_margins_bottom() const; - int content_margins_left() const; - int content_margins_right() const; - int content_margins_width() const; - int content_margins_height() const; - - int margin_top() const; - int margin_bottom() const; - int margin_left() const; - int margin_right() const; - margins get_margins() const; - - int padding_top() const; - int padding_bottom() const; - int padding_left() const; - int padding_right() const; - margins get_paddings() const; - - int border_top() const; - int border_bottom() const; - int border_left() const; - int border_right() const; - margins get_borders() const; - - bool in_normal_flow() const; - litehtml::web_color get_color(const tchar_t* prop_name, bool inherited, const litehtml::web_color& def_color = litehtml::web_color()); - bool is_inline_box() const; - position get_placement() const; - bool collapse_top_margin() const; - bool collapse_bottom_margin() const; - bool is_positioned() const; - - bool skip() const; - void skip(bool val); - bool have_parent() const; - element::ptr parent() const; - void parent(const element::ptr& par); - bool is_visible() const; - int calc_width(int defVal) const; - int get_inline_shift_left(); - int get_inline_shift_right(); - void apply_relative_shift(int parent_width); - // returns true for elements inside a table (but outside cells) that don't participate in table rendering - bool is_table_skip() const; - - std::shared_ptr get_document() const; - - virtual elements_vector select_all(const tstring& selector); - virtual elements_vector select_all(const css_selector& selector); - - virtual element::ptr select_one(const tstring& selector); - virtual element::ptr select_one(const css_selector& selector); - - virtual int render(int x, int y, int max_width, bool second_pass = false); - virtual int render_inline(const ptr &container, int max_width); - virtual int place_element(const ptr &el, int max_width); - virtual void calc_outlines( int parent_width ); - virtual void calc_auto_margins(int parent_width); - virtual void apply_vertical_align(); - virtual bool fetch_positioned(); - virtual void render_positioned(render_type rt = render_all); - - virtual bool appendChild(const ptr &el); - virtual bool removeChild(const ptr &el); - virtual void clearRecursive(); - - virtual const tchar_t* get_tagName() const; - virtual void set_tagName(const tchar_t* tag); - virtual void set_data(const tchar_t* data); - virtual element_float get_float() const; - virtual vertical_align get_vertical_align() const; - virtual element_clear get_clear() const; - virtual size_t get_children_count() const; - virtual element::ptr get_child(int idx) const; - virtual overflow get_overflow() const; - - virtual css_length get_css_left() const; - virtual css_length get_css_right() const; - virtual css_length get_css_top() const; - virtual css_length get_css_bottom() const; - virtual css_offsets get_css_offsets() const; - virtual css_length get_css_width() const; - virtual void set_css_width(css_length& w); - virtual css_length get_css_height() const; - - virtual void set_attr(const tchar_t* name, const tchar_t* val); - virtual const tchar_t* get_attr(const tchar_t* name, const tchar_t* def = nullptr) const; - virtual void apply_stylesheet(const litehtml::css& stylesheet); - virtual void refresh_styles(); - virtual bool is_white_space() const; - virtual bool is_space() const; - virtual bool is_comment() const; - virtual bool is_body() const; - virtual bool is_break() const; - virtual int get_base_line(); - virtual bool on_mouse_over(); - virtual bool on_mouse_leave(); - virtual bool on_lbutton_down(); - virtual bool on_lbutton_up(); - virtual void on_click(); - virtual bool find_styles_changes(position::vector& redraw_boxes, int x, int y); - virtual const tchar_t* get_cursor(); - virtual void init_font(); - virtual bool is_point_inside(int x, int y); - virtual bool set_pseudo_class(const tchar_t* pclass, bool add); - virtual bool set_class(const tchar_t* pclass, bool add); - virtual bool is_replaced() const; - virtual int line_height() const; - virtual white_space get_white_space() const; - virtual style_display get_display() const; - virtual visibility get_visibility() const; - virtual element_position get_element_position(css_offsets* offsets = nullptr) const; - virtual void get_inline_boxes(position::vector& boxes); - virtual void parse_styles(bool is_reparse = false); - virtual void draw(uint_ptr hdc, int x, int y, const position* clip); - virtual void draw_background( uint_ptr hdc, int x, int y, const position* clip ); - virtual const tchar_t* get_style_property(const tchar_t* name, bool inherited, const tchar_t* def = nullptr) const; - virtual uint_ptr get_font(font_metrics* fm = nullptr); - virtual int get_font_size() const; - virtual void get_text(tstring& text); - virtual void parse_attributes(); - virtual int select(const css_selector& selector, bool apply_pseudo = true); - virtual int select(const css_element_selector& selector, bool apply_pseudo = true); - virtual element::ptr find_ancestor(const css_selector& selector, bool apply_pseudo = true, bool* is_pseudo = nullptr); - virtual bool is_ancestor(const ptr &el) const; - virtual element::ptr find_adjacent_sibling(const element::ptr& el, const css_selector& selector, bool apply_pseudo = true, bool* is_pseudo = nullptr); - virtual element::ptr find_sibling(const element::ptr& el, const css_selector& selector, bool apply_pseudo = true, bool* is_pseudo = nullptr); - virtual bool is_first_child_inline(const element::ptr& el) const; - virtual bool is_last_child_inline(const element::ptr& el); - virtual bool have_inline_child() const; - virtual void get_content_size(size& sz, int max_width); - virtual void init(); - virtual bool is_floats_holder() const; - virtual int get_floats_height(element_float el_float = float_none) const; - virtual int get_left_floats_height() const; - virtual int get_right_floats_height() const; - virtual int get_line_left(int y); - virtual int get_line_right(int y, int def_right); - virtual void get_line_left_right(int y, int def_right, int& ln_left, int& ln_right); - virtual void add_float(const ptr &el, int x, int y); - virtual void update_floats(int dy, const ptr &parent); - virtual void add_positioned(const ptr &el); - virtual int find_next_line_top(int top, int width, int def_right); - virtual int get_zindex() const; - virtual void draw_stacking_context(uint_ptr hdc, int x, int y, const position* clip, bool with_positioned); - virtual void draw_children( uint_ptr hdc, int x, int y, const position* clip, draw_flag flag, int zindex ); - virtual bool is_nth_child(const element::ptr& el, int num, int off, bool of_type) const; - virtual bool is_nth_last_child(const element::ptr& el, int num, int off, bool of_type) const; - virtual bool is_only_child(const element::ptr& el, bool of_type) const; - virtual bool get_predefined_height(int& p_height) const; - virtual void calc_document_size(litehtml::size& sz, int x = 0, int y = 0); - virtual void get_redraw_box(litehtml::position& pos, int x = 0, int y = 0); - virtual void add_style(const tstring& style, const tstring& baseurl); - virtual element::ptr get_element_by_point(int x, int y, int client_x, int client_y); - virtual element::ptr get_child_by_point(int x, int y, int client_x, int client_y, draw_flag flag, int zindex); - virtual const background* get_background(bool own_only = false); - }; - - ////////////////////////////////////////////////////////////////////////// - // INLINE FUNCTIONS // - ////////////////////////////////////////////////////////////////////////// - - inline int litehtml::element::right() const - { - return left() + width(); - } - - inline int litehtml::element::left() const - { - return m_pos.left() - margin_left() - m_padding.left - m_borders.left; - } - - inline int litehtml::element::top() const - { - return m_pos.top() - margin_top() - m_padding.top - m_borders.top; - } - - inline int litehtml::element::bottom() const - { - return top() + height(); - } - - inline int litehtml::element::height() const - { - return m_pos.height + margin_top() + margin_bottom() + m_padding.height() + m_borders.height(); - } - - inline int litehtml::element::width() const - { - return m_pos.width + margin_left() + margin_right() + m_padding.width() + m_borders.width(); - } - - inline int litehtml::element::content_margins_top() const - { - return margin_top() + m_padding.top + m_borders.top; - } - - inline int litehtml::element::content_margins_bottom() const - { - return margin_bottom() + m_padding.bottom + m_borders.bottom; - } - - inline int litehtml::element::content_margins_left() const - { - return margin_left() + m_padding.left + m_borders.left; - } - - inline int litehtml::element::content_margins_right() const - { - return margin_right() + m_padding.right + m_borders.right; - } - - inline int litehtml::element::content_margins_width() const - { - return content_margins_left() + content_margins_right(); - } - - inline int litehtml::element::content_margins_height() const - { - return content_margins_top() + content_margins_bottom(); - } - - inline litehtml::margins litehtml::element::get_paddings() const - { - return m_padding; - } - - inline litehtml::margins litehtml::element::get_borders() const - { - return m_borders; - } - - inline int litehtml::element::padding_top() const - { - return m_padding.top; - } - - inline int litehtml::element::padding_bottom() const - { - return m_padding.bottom; - } - - inline int litehtml::element::padding_left() const - { - return m_padding.left; - } - - inline int litehtml::element::padding_right() const - { - return m_padding.right; - } - - inline bool litehtml::element::in_normal_flow() const - { - if(get_element_position() != element_position_absolute && get_display() != display_none) - { - return true; - } - return false; - } - - inline int litehtml::element::border_top() const - { - return m_borders.top; - } - - inline int litehtml::element::border_bottom() const - { - return m_borders.bottom; - } - - inline int litehtml::element::border_left() const - { - return m_borders.left; - } - - inline int litehtml::element::border_right() const - { - return m_borders.right; - } - - inline bool litehtml::element::skip() const - { - return m_skip; - } - - inline void litehtml::element::skip(bool val) - { - m_skip = val; - } - - inline bool litehtml::element::have_parent() const - { - return !m_parent.expired(); - } - - inline element::ptr litehtml::element::parent() const - { - return m_parent.lock(); - } - - inline void litehtml::element::parent(const element::ptr& par) - { - m_parent = par; - } - - inline int litehtml::element::margin_top() const - { - return m_margins.top; - } - - inline int litehtml::element::margin_bottom() const - { - return m_margins.bottom; - } - - inline int litehtml::element::margin_left() const - { - return m_margins.left; - } - - inline int litehtml::element::margin_right() const - { - return m_margins.right; - } - - inline litehtml::margins litehtml::element::get_margins() const - { - margins ret; - ret.left = margin_left(); - ret.right = margin_right(); - ret.top = margin_top(); - ret.bottom = margin_bottom(); - - return ret; - } - - inline bool litehtml::element::is_positioned() const - { - return (get_element_position() > element_position_static); - } - - inline bool litehtml::element::is_visible() const - { - return !(m_skip || get_display() == display_none || get_visibility() != visibility_visible); - } - - inline position& litehtml::element::get_position() - { - return m_pos; - } - - inline std::shared_ptr element::get_document() const - { - return m_doc.lock(); - } -} - -#endif // LH_ELEMENT_H diff --git a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/html.h b/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/html.h deleted file mode 100644 index 8bf9bedb3..000000000 --- a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/html.h +++ /dev/null @@ -1,117 +0,0 @@ -#ifndef LH_HTML_H -#define LH_HTML_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "os_types.h" -#include "types.h" -#include "background.h" -#include "borders.h" -#include "html_tag.h" -#include "web_color.h" -#include "media_query.h" - -namespace litehtml -{ - struct list_marker - { - tstring image; - const tchar_t* baseurl; - list_style_type marker_type; - web_color color; - position pos; - int index; - uint_ptr font; - }; - - // call back interface to draw text, images and other elements - class document_container - { - public: - virtual litehtml::uint_ptr create_font(const litehtml::tchar_t* faceName, int size, int weight, litehtml::font_style italic, unsigned int decoration, litehtml::font_metrics* fm) = 0; - virtual void delete_font(litehtml::uint_ptr hFont) = 0; - virtual int text_width(const litehtml::tchar_t* text, litehtml::uint_ptr hFont) = 0; - virtual void draw_text(litehtml::uint_ptr hdc, const litehtml::tchar_t* text, litehtml::uint_ptr hFont, litehtml::web_color color, const litehtml::position& pos) = 0; - virtual int pt_to_px(int pt) const = 0; - virtual int get_default_font_size() const = 0; - virtual const litehtml::tchar_t* get_default_font_name() const = 0; - virtual void draw_list_marker(litehtml::uint_ptr hdc, const litehtml::list_marker& marker) = 0; - virtual void load_image(const litehtml::tchar_t* src, const litehtml::tchar_t* baseurl, bool redraw_on_ready) = 0; - virtual void get_image_size(const litehtml::tchar_t* src, const litehtml::tchar_t* baseurl, litehtml::size& sz) = 0; - virtual void draw_background(litehtml::uint_ptr hdc, const litehtml::background_paint& bg) = 0; - virtual void draw_borders(litehtml::uint_ptr hdc, const litehtml::borders& borders, const litehtml::position& draw_pos, bool root) = 0; - - virtual void set_caption(const litehtml::tchar_t* caption) = 0; - virtual void set_base_url(const litehtml::tchar_t* base_url) = 0; - virtual void link(const std::shared_ptr& doc, const litehtml::element::ptr& el) = 0; - virtual void on_anchor_click(const litehtml::tchar_t* url, const litehtml::element::ptr& el) = 0; - virtual void set_cursor(const litehtml::tchar_t* cursor) = 0; - virtual void transform_text(litehtml::tstring& text, litehtml::text_transform tt) = 0; - virtual void import_css(litehtml::tstring& text, const litehtml::tstring& url, litehtml::tstring& baseurl) = 0; - virtual void set_clip(const litehtml::position& pos, const litehtml::border_radiuses& bdr_radius, bool valid_x, bool valid_y) = 0; - virtual void del_clip() = 0; - virtual void get_client_rect(litehtml::position& client) const = 0; - virtual std::shared_ptr create_element(const litehtml::tchar_t *tag_name, - const litehtml::string_map &attributes, - const std::shared_ptr &doc) = 0; - - virtual void get_media_features(litehtml::media_features& media) const = 0; - virtual void get_language(litehtml::tstring& language, litehtml::tstring & culture) const = 0; - virtual litehtml::tstring resolve_color(const litehtml::tstring& /*color*/) const { return litehtml::tstring(); } - virtual void split_text(const char* text, const std::function& on_word, const std::function& on_space); - - protected: - ~document_container() = default; - }; - - void trim(tstring &s); - void lcase(tstring &s); - int value_index(const tstring& val, const tstring& strings, int defValue = -1, tchar_t delim = _t(';')); - bool value_in_list(const tstring& val, const tstring& strings, tchar_t delim = _t(';')); - tstring::size_type find_close_bracket(const tstring &s, tstring::size_type off, tchar_t open_b = _t('('), tchar_t close_b = _t(')')); - void split_string(const tstring& str, string_vector& tokens, const tstring& delims, const tstring& delims_preserve = _t(""), const tstring& quote = _t("\"")); - void join_string(tstring& str, const string_vector& tokens, const tstring& delims); - double t_strtod(const tchar_t* string, tchar_t** endPtr); - - int t_strcasecmp(const tchar_t *s1, const tchar_t *s2); - int t_strncasecmp(const tchar_t *s1, const tchar_t *s2, size_t n); - - inline int t_isdigit(int c) - { - return (c >= '0' && c <= '9'); - } - - inline int t_tolower(int c) - { - return (c >= 'A' && c <= 'Z' ? c + 'a' - 'A' : c); - } - - inline int round_f(float val) - { - int int_val = (int) val; - if(val - int_val >= 0.5) - { - int_val++; - } - return int_val; - } - - inline int round_d(double val) - { - int int_val = (int) val; - if(val - int_val >= 0.5) - { - int_val++; - } - return int_val; - } -} - -#endif // LH_HTML_H diff --git a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/html_tag.h b/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/html_tag.h deleted file mode 100644 index 4dbe3e18f..000000000 --- a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/html_tag.h +++ /dev/null @@ -1,248 +0,0 @@ -#ifndef LH_HTML_TAG_H -#define LH_HTML_TAG_H - -#include "element.h" -#include "style.h" -#include "background.h" -#include "css_margins.h" -#include "borders.h" -#include "css_selector.h" -#include "stylesheet.h" -#include "box.h" -#include "table.h" - -namespace litehtml -{ - struct line_context - { - int calculatedTop; - int top; - int left; - int right; - - int width() const - { - return right - left; - } - void fix_top() - { - calculatedTop = top; - } - }; - - class html_tag : public element - { - friend class elements_iterator; - friend class el_table; - friend class table_grid; - friend class block_box; - friend class line_box; - public: - typedef std::shared_ptr ptr; - protected: - box::vector m_boxes; - string_vector m_class_values; - tstring m_tag; - litehtml::style m_style; - string_map m_attrs; - vertical_align m_vertical_align; - text_align m_text_align; - style_display m_display; - list_style_type m_list_style_type; - list_style_position m_list_style_position; - white_space m_white_space; - element_float m_float; - element_clear m_clear; - floated_box::vector m_floats_left; - floated_box::vector m_floats_right; - elements_vector m_positioned; - background m_bg; - element_position m_el_position; - int m_line_height; - bool m_lh_predefined; - string_vector m_pseudo_classes; - used_selector::vector m_used_styles; - - uint_ptr m_font; - int m_font_size; - font_metrics m_font_metrics; - - css_margins m_css_margins; - css_margins m_css_padding; - css_borders m_css_borders; - css_length m_css_width; - css_length m_css_height; - css_length m_css_min_width; - css_length m_css_min_height; - css_length m_css_max_width; - css_length m_css_max_height; - css_offsets m_css_offsets; - css_length m_css_text_indent; - - overflow m_overflow; - visibility m_visibility; - int m_z_index; - box_sizing m_box_sizing; - - int_int_cache m_cahe_line_left; - int_int_cache m_cahe_line_right; - - // data for table rendering - std::unique_ptr m_grid; - css_length m_css_border_spacing_x; - css_length m_css_border_spacing_y; - int m_border_spacing_x; - int m_border_spacing_y; - border_collapse m_border_collapse; - - void select_all(const css_selector& selector, elements_vector& res) override; - - public: - explicit html_tag(const std::shared_ptr& doc); - - /* render functions */ - - int render(int x, int y, int max_width, bool second_pass = false) override; - - int render_inline(const element::ptr &container, int max_width) override; - int place_element(const element::ptr &el, int max_width) override; - bool fetch_positioned() override; - void render_positioned(render_type rt = render_all) override; - - int new_box(const element::ptr &el, int max_width, line_context& line_ctx); - - int get_cleared_top(const element::ptr &el, int line_top) const; - int finish_last_box(bool end_of_render = false); - - bool appendChild(const element::ptr &el) override; - bool removeChild(const element::ptr &el) override; - void clearRecursive() override; - const tchar_t* get_tagName() const override; - void set_tagName(const tchar_t* tag) override; - void set_data(const tchar_t* data) override; - element_float get_float() const override; - vertical_align get_vertical_align() const override; - css_length get_css_left() const override; - css_length get_css_right() const override; - css_length get_css_top() const override; - css_length get_css_bottom() const override; - css_length get_css_width() const override; - css_offsets get_css_offsets() const override; - void set_css_width(css_length& w) override; - css_length get_css_height() const override; - element_clear get_clear() const override; - size_t get_children_count() const override; - element::ptr get_child(int idx) const override; - element_position get_element_position(css_offsets* offsets = nullptr) const override; - overflow get_overflow() const override; - - void set_attr(const tchar_t* name, const tchar_t* val) override; - const tchar_t* get_attr(const tchar_t* name, const tchar_t* def = nullptr) const override; - void apply_stylesheet(const litehtml::css& stylesheet) override; - void refresh_styles() override; - - bool is_white_space() const override; - bool is_body() const override; - bool is_break() const override; - int get_base_line() override; - bool on_mouse_over() override; - bool on_mouse_leave() override; - bool on_lbutton_down() override; - bool on_lbutton_up() override; - void on_click() override; - bool find_styles_changes(position::vector& redraw_boxes, int x, int y) override; - const tchar_t* get_cursor() override; - void init_font() override; - bool set_pseudo_class(const tchar_t* pclass, bool add) override; - bool set_class(const tchar_t* pclass, bool add) override; - bool is_replaced() const override; - int line_height() const override; - white_space get_white_space() const override; - style_display get_display() const override; - visibility get_visibility() const override; - void parse_styles(bool is_reparse = false) override; - void draw(uint_ptr hdc, int x, int y, const position* clip) override; - void draw_background(uint_ptr hdc, int x, int y, const position* clip) override; - - const tchar_t* get_style_property(const tchar_t* name, bool inherited, const tchar_t* def = nullptr) const override; - uint_ptr get_font(font_metrics* fm = nullptr) override; - int get_font_size() const override; - - elements_vector& children(); - void calc_outlines(int parent_width) override; - void calc_auto_margins(int parent_width) override; - - int select(const css_selector& selector, bool apply_pseudo = true) override; - int select(const css_element_selector& selector, bool apply_pseudo = true) override; - - elements_vector select_all(const tstring& selector) override; - elements_vector select_all(const css_selector& selector) override; - - element::ptr select_one(const tstring& selector) override; - element::ptr select_one(const css_selector& selector) override; - - element::ptr find_ancestor(const css_selector& selector, bool apply_pseudo = true, bool* is_pseudo = nullptr) override; - element::ptr find_adjacent_sibling(const element::ptr& el, const css_selector& selector, bool apply_pseudo = true, bool* is_pseudo = nullptr) override; - element::ptr find_sibling(const element::ptr& el, const css_selector& selector, bool apply_pseudo = true, bool* is_pseudo = nullptr) override; - void get_text(tstring& text) override; - void parse_attributes() override; - - bool is_first_child_inline(const element::ptr& el) const override; - bool is_last_child_inline(const element::ptr& el) override; - bool have_inline_child() const override; - void get_content_size(size& sz, int max_width) override; - void init() override; - void get_inline_boxes(position::vector& boxes) override; - bool is_floats_holder() const override; - int get_floats_height(element_float el_float = float_none) const override; - int get_left_floats_height() const override; - int get_right_floats_height() const override; - int get_line_left(int y) override; - int get_line_right(int y, int def_right) override; - void get_line_left_right(int y, int def_right, int& ln_left, int& ln_right) override; - void add_float(const element::ptr &el, int x, int y) override; - void update_floats(int dy, const element::ptr &parent) override; - void add_positioned(const element::ptr &el) override; - int find_next_line_top(int top, int width, int def_right) override; - void apply_vertical_align() override; - void draw_children(uint_ptr hdc, int x, int y, const position* clip, draw_flag flag, int zindex) override; - int get_zindex() const override; - void draw_stacking_context(uint_ptr hdc, int x, int y, const position* clip, bool with_positioned) override; - void calc_document_size(litehtml::size& sz, int x = 0, int y = 0) override; - void get_redraw_box(litehtml::position& pos, int x = 0, int y = 0) override; - void add_style(const tstring& style, const tstring& baseurl) override; - element::ptr get_element_by_point(int x, int y, int client_x, int client_y) override; - element::ptr get_child_by_point(int x, int y, int client_x, int client_y, draw_flag flag, int zindex) override; - - bool is_nth_child(const element::ptr& el, int num, int off, bool of_type) const override; - bool is_nth_last_child(const element::ptr& el, int num, int off, bool of_type) const override; - bool is_only_child(const element::ptr& el, bool of_type) const override; - const background* get_background(bool own_only = false) override; - - protected: - void draw_children_box(uint_ptr hdc, int x, int y, const position* clip, draw_flag flag, int zindex); - void draw_children_table(uint_ptr hdc, int x, int y, const position* clip, draw_flag flag, int zindex); - int render_box(int x, int y, int max_width, bool second_pass = false); - int render_table(int x, int y, int max_width, bool second_pass = false); - int fix_line_width(int max_width, element_float flt); - void parse_background(); - void init_background_paint( position pos, background_paint &bg_paint, const background* bg ); - void draw_list_marker( uint_ptr hdc, const position &pos ); - tstring get_list_marker_text(int index); - static void parse_nth_child_params( const tstring& param, int &num, int &off ); - void remove_before_after(); - litehtml::element::ptr get_element_before(); - litehtml::element::ptr get_element_after(); - }; - - /************************************************************************/ - /* Inline Functions */ - /************************************************************************/ - - inline elements_vector& litehtml::html_tag::children() - { - return m_children; - } -} - -#endif // LH_HTML_TAG_H diff --git a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/iterators.h b/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/iterators.h deleted file mode 100644 index 4f4ae0f89..000000000 --- a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/iterators.h +++ /dev/null @@ -1,89 +0,0 @@ -#ifndef LH_ITERATORS_H -#define LH_ITERATORS_H - -#include "types.h" - -namespace litehtml -{ - class element; - - class iterator_selector - { - public: - virtual bool select(const element::ptr& el) = 0; - - protected: - ~iterator_selector() = default; - }; - - class elements_iterator - { - private: - struct stack_item - { - int idx; - element::ptr el; - stack_item() : idx(0) - { - } - stack_item(const stack_item& val) - { - idx = val.idx; - el = val.el; - } - stack_item(stack_item&& val) - { - idx = val.idx; - el = std::move(val.el); - } - }; - - std::vector m_stack; - element::ptr m_el; - int m_idx; - iterator_selector* m_go_inside; - iterator_selector* m_select; - public: - - elements_iterator(const element::ptr& el, iterator_selector* go_inside, iterator_selector* select) - { - m_el = el; - m_idx = -1; - m_go_inside = go_inside; - m_select = select; - } - - ~elements_iterator() = default; - - element::ptr next(bool ret_parent = true); - - private: - void next_idx(); - }; - - class go_inside_inline final : public iterator_selector - { - public: - bool select(const element::ptr& el) override; - }; - - class go_inside_table final : public iterator_selector - { - public: - bool select(const element::ptr& el) override; - }; - - class table_rows_selector final : public iterator_selector - { - public: - bool select(const element::ptr& el) override; - }; - - class table_cells_selector final : public iterator_selector - { - public: - bool select(const element::ptr& el) override; - }; -} - -#endif // LH_ITERATORS_H diff --git a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/media_query.h b/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/media_query.h deleted file mode 100644 index 6a81bcb32..000000000 --- a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/media_query.h +++ /dev/null @@ -1,77 +0,0 @@ -#ifndef LH_MEDIA_QUERY_H -#define LH_MEDIA_QUERY_H - -namespace litehtml -{ - struct media_query_expression - { - typedef std::vector vector; - media_feature feature; - int val; - int val2; - bool check_as_bool; - - media_query_expression() - { - check_as_bool = false; - feature = media_feature_none; - val = 0; - val2 = 0; - } - - bool check(const media_features& features) const; - }; - - class media_query - { - public: - typedef std::shared_ptr ptr; - typedef std::vector vector; - private: - media_query_expression::vector m_expressions; - bool m_not; - media_type m_media_type; - public: - media_query(); - media_query(const media_query& val); - - static media_query::ptr create_from_string(const tstring& str, const std::shared_ptr& doc); - bool check(const media_features& features) const; - }; - - class media_query_list - { - public: - typedef std::shared_ptr ptr; - typedef std::vector vector; - private: - media_query::vector m_queries; - bool m_is_used; - public: - media_query_list(); - media_query_list(const media_query_list& val); - - static media_query_list::ptr create_from_string(const tstring& str, const std::shared_ptr& doc); - bool is_used() const; - bool apply_media_features(const media_features& features); // returns true if the m_is_used changed - }; - - inline media_query_list::media_query_list(const media_query_list& val) - { - m_is_used = val.m_is_used; - m_queries = val.m_queries; - } - - inline media_query_list::media_query_list() - { - m_is_used = false; - } - - inline bool media_query_list::is_used() const - { - return m_is_used; - } - -} - -#endif // LH_MEDIA_QUERY_H diff --git a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/num_cvt.h b/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/num_cvt.h deleted file mode 100644 index 515e46d62..000000000 --- a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/num_cvt.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef NUM_CVT_H -#define NUM_CVT_H - -#include -#include "os_types.h" - -namespace litehtml -{ - namespace num_cvt - { - litehtml::tstring to_latin_lower(int val); - litehtml::tstring to_latin_upper(int val); - litehtml::tstring to_greek_lower(int val); - litehtml::tstring to_roman_lower(int value); - litehtml::tstring to_roman_upper(int value); - } -} - -#endif // NUM_CVT_H \ No newline at end of file diff --git a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/os_types.h b/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/os_types.h deleted file mode 100644 index 6d1e5dc65..000000000 --- a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/os_types.h +++ /dev/null @@ -1,85 +0,0 @@ -#ifndef LH_OS_TYPES_H -#define LH_OS_TYPES_H - -#include -#include - -namespace litehtml -{ -#if defined( WIN32 ) || defined( _WIN32 ) || defined( WINCE ) - -// noexcept appeared since Visual Studio 2013 -#if defined(_MSC_VER) && _MSC_VER < 1900 -#define noexcept -#endif - -#ifndef LITEHTML_UTF8 - - typedef std::wstring tstring; - typedef wchar_t tchar_t; - typedef std::wstringstream tstringstream; - - #define _t(quote) L##quote - - #define t_strlen wcslen - #define t_strcmp wcscmp - #define t_strncmp wcsncmp - #define t_strtol wcstol - #define t_atoi _wtoi - #define t_itoa(value, buffer, size, radix) _itow_s(value, buffer, size, radix) - #define t_strstr wcsstr - #define t_isspace iswspace - #define t_to_string(val) std::to_wstring(val) - -#else - - typedef std::string tstring; - typedef char tchar_t; - typedef std::stringstream tstringstream; - - #define _t(quote) quote - - #define t_strlen strlen - #define t_strcmp strcmp - #define t_strncmp strncmp - #define t_strtol strtol - #define t_atoi atoi - #define t_itoa(value, buffer, size, radix) _itoa_s(value, buffer, size, radix) - #define t_strstr strstr - #define t_isspace isspace - #define t_to_string(val) std::to_string(val) - -#endif - - #ifdef _WIN64 - typedef unsigned __int64 uint_ptr; - #else - typedef unsigned int uint_ptr; - #endif - -#else - #define LITEHTML_UTF8 - - typedef std::string tstring; - typedef char tchar_t; - typedef std::uintptr_t uint_ptr; - typedef std::stringstream tstringstream; - - #define _t(quote) quote - - #define t_strlen strlen - #define t_strcmp strcmp - #define t_strncmp strncmp - - #define t_itoa(value, buffer, size, radix) snprintf(buffer, size, "%d", value) - - #define t_strtol strtol - #define t_atoi atoi - #define t_strstr strstr - #define t_isspace isspace - #define t_to_string(val) std::to_string(val) - -#endif -} - -#endif // LH_OS_TYPES_H diff --git a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/style.h b/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/style.h deleted file mode 100644 index 204614508..000000000 --- a/src/librssguard/3rd-party/qlitehtml/3rdparty/litehtml/include/litehtml/style.h +++ /dev/null @@ -1,96 +0,0 @@ -#ifndef LH_STYLE_H -#define LH_STYLE_H - -#include "attributes.h" -#include - -namespace litehtml -{ - class property_value - { - public: - tstring m_value; - bool m_important; - - property_value() - { - m_important = false; - } - property_value(const tchar_t* val, bool imp) - { - m_important = imp; - m_value = val; - } - property_value(const property_value& val) - { - m_value = val.m_value; - m_important = val.m_important; - } - - property_value& operator=(const property_value& val) - { - m_value = val.m_value; - m_important = val.m_important; - return *this; - } - }; - - typedef std::map props_map; - - class style - { - public: - typedef std::shared_ptr" - "%1" - "") - .arg(html, - qApp->skins()->currentSkin().colorForModel(SkinEnums::PaletteColors::FgInteresting).value().name()), - QUrl()}; -} - -void LiteHtmlViewer::loadMessages(const QList& messages, RootItem* root) { - auto html_messages = m_useSimpleArticleLayout ? prepareHtmlForMessage(messages, root) - : qApp->skins()->generateHtmlOfArticles(messages, root); - - setHtml(html_messages.first, html_messages.second); - emit loadingFinished(true); -} - -double LiteHtmlViewer::verticalScrollBarPosition() const { - return verticalScrollBar()->value(); -} - -void LiteHtmlViewer::setVerticalScrollBarPosition(double pos) { - verticalScrollBar()->setValue(pos); -} - -void LiteHtmlViewer::applyFont(const QFont& fon) { - QLiteHtmlWidget::setDefaultFont(fon); -} - -qreal LiteHtmlViewer::zoomFactor() const { - return QLiteHtmlWidget::zoomFactor(); -} - -void LiteHtmlViewer::setZoomFactor(qreal zoom_factor) { - if (zoom_factor == 0.0) { - QLiteHtmlWidget::setZoomFactor(MIN_ZOOM_FACTOR); - } - else { - QLiteHtmlWidget::setZoomFactor(zoom_factor); - } -} - -void LiteHtmlViewer::simpleLayoutChanged(bool activated) { - m_useSimpleArticleLayout = activated; - - qApp->settings()->setValue(GROUP(Messages), Messages::SimpleArticleLayout, activated); -} - -void LiteHtmlViewer::selectedTextChanged(bool available) { - if (!available) { - return; - } - - QString sel_text = QLiteHtmlWidget::selectedText(); - - if (!sel_text.isEmpty()) { - QGuiApplication::clipboard()->setText(sel_text, QClipboard::Mode::Selection); - } -} - -void LiteHtmlViewer::onLinkClicked(const QUrl& link) { - if ((QApplication::queryKeyboardModifiers() & Qt::KeyboardModifier::ControlModifier) > 0) { - LiteHtmlViewer* viewer = new LiteHtmlViewer(this); - emit newWindowRequested(viewer); - - viewer->setUrl(link); - } - else { - setUrl(link); - } -} - -void LiteHtmlViewer::reloadPageWithImages() { - m_reloadingWithImages = true; - - auto scroll = verticalScrollBar()->value(); - - setHtml(html(), url()); - - if (scroll > 0) { - verticalScrollBar()->setValue(scroll); - } - - m_reloadingWithImages = false; -} - -void LiteHtmlViewer::showContextMenu(const QPoint& pos, const QUrl& url) { - if (m_contextMenu.isNull()) { - m_contextMenu.reset(new QMenu("Context menu for web browser", this)); - - m_actionCopyUrl.reset(new QAction(qApp->icons()->fromTheme(QSL("edit-copy")), tr("Copy URL"), this)); - - connect(m_actionCopyUrl.data(), &QAction::triggered, this, [url]() { - QGuiApplication::clipboard()->setText(url.toString(), QClipboard::Mode::Clipboard); - }); - - m_actionCopyText.reset(new QAction(qApp->icons()->fromTheme(QSL("edit-copy")), tr("Copy selection"), this)); - - connect(m_actionCopyText.data(), &QAction::triggered, this, [this]() { - QGuiApplication::clipboard()->setText(QLiteHtmlWidget::selectedText(), QClipboard::Mode::Clipboard); - }); - - // Add option to open link in external viewe - m_actionOpenLinkExternally.reset(new QAction(qApp->icons()->fromTheme(QSL("document-open")), - tr("Open link in external browser"), - this)); - - connect(m_actionOpenLinkExternally.data(), &QAction::triggered, this, [url]() { - qApp->web()->openUrlInExternalBrowser(url.toString()); - - if (qApp->settings() - ->value(GROUP(Messages), SETTING(Messages::BringAppToFrontAfterMessageOpenedExternally)) - .toBool()) { - QTimer::singleShot(1000, qApp, []() { - qApp->mainForm()->display(); - }); - } - }); - - m_actionSimpleLayout.reset(new QAction(qApp->icons()->fromTheme(QSL("view-list-details")), - tr("Use simple article layout"), - this)); - m_actionSimpleLayout->setCheckable(true); - m_actionSimpleLayout->setChecked(m_useSimpleArticleLayout); - - m_actionReloadWithImages.reset(new QAction(qApp->icons()->fromTheme(QSL("viewimage"), QSL("view-refresh")), - tr("Reload with images"), - this)); - - connect(m_actionSimpleLayout.data(), &QAction::triggered, this, &LiteHtmlViewer::simpleLayoutChanged); - connect(m_actionReloadWithImages.data(), &QAction::triggered, this, &LiteHtmlViewer::reloadPageWithImages); - } - - m_actionCopyUrl->setEnabled(url.isValid()); - m_actionCopyText->setEnabled(!QLiteHtmlWidget::selectedText().isEmpty()); - m_actionOpenLinkExternally->setEnabled(url.isValid()); - - m_contextMenu->clear(); - m_contextMenu->addActions({m_actionCopyUrl.data(), - m_actionCopyText.data(), - m_actionOpenLinkExternally.data(), - m_actionSimpleLayout.data(), - m_actionReloadWithImages.data()}); - - if (url.isValid()) { - QFileIconProvider icon_provider; - QMenu* menu_ext_tools = new QMenu(tr("Open with external tool"), this); - auto tools = ExternalTool::toolsFromSettings(); - - menu_ext_tools->setIcon(qApp->icons()->fromTheme(QSL("document-open"))); - - for (const ExternalTool& tool : qAsConst(tools)) { - QAction* act_tool = new QAction(QFileInfo(tool.executable()).fileName(), menu_ext_tools); - - act_tool->setIcon(icon_provider.icon(QFileInfo(tool.executable()))); - act_tool->setToolTip(tool.executable()); - act_tool->setData(QVariant::fromValue(tool)); - menu_ext_tools->addAction(act_tool); - - connect(act_tool, &QAction::triggered, this, [act_tool, url]() { - act_tool->data().value().run(url.toString()); - }); - } - - if (menu_ext_tools->actions().isEmpty()) { - QAction* act_not_tools = new QAction(tr("No external tools activated")); - - act_not_tools->setEnabled(false); - menu_ext_tools->addAction(act_not_tools); - } - - m_contextMenu->addMenu(menu_ext_tools); - } - - m_contextMenu->addAction(qApp->web()->adBlock()->adBlockIcon()); - m_contextMenu->popup(mapToGlobal(pos)); -} - -BlockingResult LiteHtmlViewer::blockedWithAdblock(const QUrl& url) { - AdblockRequestInfo block_request(url); - - if (url.path().endsWith(QSL("css"))) { - block_request.setResourceType(QSL("stylesheet")); - } - else { - block_request.setResourceType(QSL("image")); - } - - auto block_result = qApp->web()->adBlock()->block(block_request); - - if (block_result.m_blocked) { - qWarningNN << LOGSEC_ADBLOCK << "Blocked request:" << QUOTE_W_SPACE_DOT(block_request.requestUrl().toString()); - return block_result; - } - else { - return block_result; - } -} - -QByteArray LiteHtmlViewer::handleResource(const QUrl& url) { - if (blockedWithAdblock(url).m_blocked) { - return {}; - } - else { - QEventLoop loop; - - connect(m_downloader.data(), &Downloader::completed, &loop, &QEventLoop::quit); - m_downloader->manipulateData(url.toString(), QNetworkAccessManager::Operation::GetOperation, {}, 5000); - - loop.exec(); - return m_downloader->lastOutputData(); - } -} - -void LiteHtmlViewer::keyPressEvent(QKeyEvent* event) { - if (event->matches(QKeySequence::StandardKey::Copy)) { - QString sel_text = QLiteHtmlWidget::selectedText(); - - if (!sel_text.isEmpty()) { - QGuiApplication::clipboard()->setText(sel_text, QClipboard::Mode::Clipboard); - } - } - - QLiteHtmlWidget::keyPressEvent(event); -} diff --git a/src/librssguard/gui/webviewers/litehtml/litehtmlviewer.h b/src/librssguard/gui/webviewers/litehtml/litehtmlviewer.h deleted file mode 100644 index 7b3d05dff..000000000 --- a/src/librssguard/gui/webviewers/litehtml/litehtmlviewer.h +++ /dev/null @@ -1,75 +0,0 @@ -// For license of this file, see /LICENSE.md. - -#ifndef LITEHTMLVIEWER_H -#define LITEHTMLVIEWER_H - -#include "3rd-party/qlitehtml/qlitehtmlwidget.h" -#include "gui/webviewers/webviewer.h" - -#include "network-web/adblock/adblockmanager.h" - -class Downloader; -class QWheelEvent; -class QMenu; - -class LiteHtmlViewer : public QLiteHtmlWidget, public WebViewer { - Q_OBJECT - Q_INTERFACES(WebViewer) - - public: - explicit LiteHtmlViewer(QWidget* parent = nullptr); - - public: - virtual void bindToBrowser(WebBrowser* browser); - virtual void findText(const QString& text, bool backwards); - virtual void setUrl(const QUrl& url); - virtual void setHtml(const QString& html, const QUrl& base_url = {}); - virtual QString html() const; - virtual QUrl url() const; - virtual void clear(); - virtual void loadMessages(const QList& messages, RootItem* root); - virtual double verticalScrollBarPosition() const; - virtual void setVerticalScrollBarPosition(double pos); - virtual void applyFont(const QFont& fon); - virtual qreal zoomFactor() const; - virtual void setZoomFactor(qreal zoom_factor); - - private slots: - void simpleLayoutChanged(bool activated); - void selectedTextChanged(bool available); - void onLinkClicked(const QUrl& link); - void reloadPageWithImages(); - void showContextMenu(const QPoint& pos, const QUrl& url); - - signals: - void pageTitleChanged(const QString& new_title); - void pageUrlChanged(const QUrl& url); - void pageIconChanged(const QIcon&); - void linkMouseHighlighted(const QUrl& url); - void loadingStarted(); - void loadingProgress(int progress); - void loadingFinished(bool success); - void newWindowRequested(WebViewer* viewer); - void closeWindowRequested(); - - protected: - virtual void keyPressEvent(QKeyEvent* event); - - private: - QPair prepareHtmlForMessage(const QList& messages, RootItem* selected_item) const; - BlockingResult blockedWithAdblock(const QUrl& url); - QByteArray handleResource(const QUrl& url); - - private: - QScopedPointer m_downloader; - QScopedPointer m_contextMenu; - QScopedPointer m_actionCopyUrl; - QScopedPointer m_actionCopyText; - QScopedPointer m_actionOpenLinkExternally; - QScopedPointer m_actionSimpleLayout; - QScopedPointer m_actionReloadWithImages; - bool m_reloadingWithImages; - bool m_useSimpleArticleLayout; -}; - -#endif // LITEHTMLVIEWER_H diff --git a/src/librssguard/gui/webviewers/qtextbrowser/textbrowserviewer.cpp b/src/librssguard/gui/webviewers/qtextbrowser/textbrowserviewer.cpp index cdcd860ad..c4e0f56b8 100644 --- a/src/librssguard/gui/webviewers/qtextbrowser/textbrowserviewer.cpp +++ b/src/librssguard/gui/webviewers/qtextbrowser/textbrowserviewer.cpp @@ -7,15 +7,18 @@ #include "miscellaneous/application.h" #include "miscellaneous/externaltool.h" #include "miscellaneous/iconfactory.h" +#include "network-web/adblock/adblockrequestinfo.h" +#include "network-web/downloader.h" +#include "network-web/networkfactory.h" #include "network-web/webfactory.h" #include #include #include -TextBrowserViewer::TextBrowserViewer(QWidget* parent) : QTextBrowser(parent) { +TextBrowserViewer::TextBrowserViewer(QWidget* parent) : QTextBrowser(parent), m_downloader(new Downloader(this)) { setAutoFillBackground(true); - setFrameShape(QFrame::Shape::StyledPanel); + setFrameShape(QFrame::Shape::NoFrame); setFrameShadow(QFrame::Shadow::Plain); setTabChangesFocus(true); setOpenLinks(false); @@ -51,10 +54,10 @@ QPair TextBrowserViewer::prepareHtmlForMessage(const QList%1
").arg(enc.m_url, enc.m_mimeType); } - QRegularExpression imgTagRegex("\\]*src\\s*=\\s*[\"\']([^\"\']*)[\"\'][^\\>]*\\>", - QRegularExpression::PatternOption::CaseInsensitiveOption | - QRegularExpression::PatternOption::InvertedGreedinessOption); - QRegularExpressionMatchIterator i = imgTagRegex.globalMatch(message.m_contents); + static QRegularExpression img_tag_rgx("\\]*src\\s*=\\s*[\"\']([^\"\']*)[\"\'][^\\>]*\\>", + QRegularExpression::PatternOption::CaseInsensitiveOption | + QRegularExpression::PatternOption::InvertedGreedinessOption); + QRegularExpressionMatchIterator i = img_tag_rgx.globalMatch(message.m_contents); QString pictures_html; while (i.hasNext()) { @@ -77,18 +80,35 @@ QPair TextBrowserViewer::prepareHtmlForMessage(const QList" - "" - "%1" - "") - .arg(html, - qApp->skins()->currentSkin().colorForModel(SkinEnums::PaletteColors::FgInteresting).value().name()), - QUrl()}; + QColor a_color = qApp->skins()->currentSkin().colorForModel(SkinEnums::PaletteColors::FgInteresting).value(); + + if (!a_color.isValid()) { + a_color = qApp->palette().color(QPalette::ColorRole::Highlight); + } + + QString base_url; + auto* feed = selected_item->getParentServiceRoot() + ->getItemFromSubTree([messages](const RootItem* it) { + return it->kind() == RootItem::Kind::Feed && it->customId() == messages.at(0).m_feedId; + }) + ->toFeed(); + + if (feed != nullptr) { + QUrl url(NetworkFactory::sanitizeUrl(feed->source())); + + if (url.isValid()) { + base_url = url.scheme() + QSL("://") + url.host(); + } + } + + return {QSL("" + "" + "%1" + "") + .arg(html, a_color.name()), + base_url}; } void TextBrowserViewer::bindToBrowser(WebBrowser* browser) { @@ -102,12 +122,7 @@ void TextBrowserViewer::bindToBrowser(WebBrowser* browser) { browser->m_actionBack->setEnabled(false); browser->m_actionForward->setEnabled(false); browser->m_actionReload->setEnabled(false); - - // TODO: When clicked "Stop", save the "Stop" state and return {} from "handleResource(...)" - // right away. browser->m_actionStop->setEnabled(false); - - // TODO: add "Open in new tab" to context menu. } void TextBrowserViewer::findText(const QString& text, bool backwards) { @@ -120,13 +135,79 @@ void TextBrowserViewer::findText(const QString& text, bool backwards) { } } -void TextBrowserViewer::setUrl(const QUrl& url) {} +BlockingResult TextBrowserViewer::blockedWithAdblock(const QUrl& url) { + AdblockRequestInfo block_request(url); + + if (url.path().endsWith(QSL("css"))) { + block_request.setResourceType(QSL("stylesheet")); + } + else { + block_request.setResourceType(QSL("image")); + } + + auto block_result = qApp->web()->adBlock()->block(block_request); + + if (block_result.m_blocked) { + qWarningNN << LOGSEC_ADBLOCK << "Blocked request:" << QUOTE_W_SPACE_DOT(block_request.requestUrl().toString()); + return block_result; + } + else { + return block_result; + } +} + +void TextBrowserViewer::setUrl(const QUrl& url) { + emit loadingStarted(); + QString html_str; + QUrl nonconst_url = url; + bool is_error = false; + auto block_result = blockedWithAdblock(url); + + if (block_result.m_blocked) { + is_error = true; + nonconst_url = QUrl::fromUserInput(QSL(INTERNAL_URL_ADBLOCKED)); + + // TODO: Zjednodušeně. + html_str = qApp->skins()->adBlockedPage(url.toString(), block_result.m_blockedByFilter); + } + else { + QEventLoop loop; + + connect(m_downloader.data(), &Downloader::completed, &loop, &QEventLoop::quit); + m_downloader->manipulateData(url.toString(), QNetworkAccessManager::Operation::GetOperation, {}, 5000); + + loop.exec(); + + const auto net_error = m_downloader->lastOutputError(); + const QString content_type = m_downloader->lastContentType().toString(); + + if (net_error != QNetworkReply::NetworkError::NoError) { + is_error = true; + // TODO: lepší hlaška. + html_str = "Error!"; + } + else { + if (content_type.startsWith(QSL("image/"))) { + html_str = QSL("").arg(nonconst_url.toString()); + } + else { + html_str = QString::fromUtf8(m_downloader->lastOutputData()); + } + } + } + + setHtml(html_str, nonconst_url); + + emit loadingFinished(!is_error); +} void TextBrowserViewer::setHtml(const QString& html, const QUrl& base_url) { m_currentUrl = base_url; QTextBrowser::setHtml(html); + setZoomFactor(m_zoomFactor); + emit pageTitleChanged(documentTitle()); emit pageUrlChanged(base_url); } @@ -144,6 +225,7 @@ void TextBrowserViewer::clear() { } void TextBrowserViewer::loadMessages(const QList& messages, RootItem* root) { + emit loadingStarted(); m_root = root; auto html_messages = prepareHtmlForMessage(messages, root); @@ -165,18 +247,22 @@ void TextBrowserViewer::applyFont(const QFont& fon) { } qreal TextBrowserViewer::zoomFactor() const { - return font().pointSize() / 12.0; + return font().pointSizeF() / 8.0; } void TextBrowserViewer::setZoomFactor(qreal zoom_factor) { + m_zoomFactor = zoom_factor; + auto fon = font(); - fon.setPointSize(fon.pointSize() * zoom_factor); + fon.setPointSizeF(8.0 * zoom_factor); + + applyFont(fon); } void TextBrowserViewer::contextMenuEvent(QContextMenuEvent* event) { event->accept(); - auto* menu = createStandardContextMenu(); + auto* menu = createStandardContextMenu(event->pos()); if (menu == nullptr) { return; @@ -214,6 +300,10 @@ void TextBrowserViewer::contextMenuEvent(QContextMenuEvent* event) { menu->addMenu(menu_ext_tools); } + connect(menu, &QMenu::aboutToHide, this, [menu] { + menu->deleteLater(); + }); + menu->popup(event->globalPos()); } @@ -223,6 +313,11 @@ void TextBrowserViewer::resizeEvent(QResizeEvent* event) { QTextBrowser::resizeEvent(event); } +void TextBrowserViewer::wheelEvent(QWheelEvent* event) { + QAbstractScrollArea::wheelEvent(event); + updateMicroFocus(); +} + void TextBrowserViewer::onAnchorClicked(const QUrl& url) { if (!url.isEmpty()) { bool open_externally_now = @@ -242,7 +337,7 @@ void TextBrowserViewer::onAnchorClicked(const QUrl& url) { QAbstractButton* btn_open = box.addButton(tr("Open in external browser"), QMessageBox::ButtonRole::ActionRole); QAbstractButton* btn_download = box.addButton(tr("Download"), QMessageBox::ButtonRole::ActionRole); QAbstractButton* btn_cancel = box.addButton(QMessageBox::StandardButton::Cancel); - bool always; + bool always = false; MsgBox::setCheckBox(&box, tr("Always open links in external browser."), &always); diff --git a/src/librssguard/gui/webviewers/qtextbrowser/textbrowserviewer.h b/src/librssguard/gui/webviewers/qtextbrowser/textbrowserviewer.h index 64b6d9664..735274916 100644 --- a/src/librssguard/gui/webviewers/qtextbrowser/textbrowserviewer.h +++ b/src/librssguard/gui/webviewers/qtextbrowser/textbrowserviewer.h @@ -7,11 +7,14 @@ #include +#include "network-web/adblock/adblockmanager.h" + #include class QContextMenuEvent; class QResizeEvent; class WebBrowser; +class Downloader; class TextBrowserViewer : public QTextBrowser, public WebViewer { Q_OBJECT @@ -41,6 +44,7 @@ class TextBrowserViewer : public QTextBrowser, public WebViewer { protected: virtual void contextMenuEvent(QContextMenuEvent* event); virtual void resizeEvent(QResizeEvent* event); + virtual void wheelEvent(QWheelEvent* event); private slots: void onAnchorClicked(const QUrl& url); @@ -57,11 +61,14 @@ class TextBrowserViewer : public QTextBrowser, public WebViewer { void closeWindowRequested(); private: + BlockingResult blockedWithAdblock(const QUrl& url); + QScopedPointer m_downloader; QPair prepareHtmlForMessage(const QList& messages, RootItem* selected_item) const; private: QUrl m_currentUrl; QPointer m_root; + qreal m_zoomFactor = 1.0; }; #endif // TEXTBROWSERVIEWER_H diff --git a/src/librssguard/miscellaneous/application.cpp b/src/librssguard/miscellaneous/application.cpp index 047ba8120..2642f06d2 100644 --- a/src/librssguard/miscellaneous/application.cpp +++ b/src/librssguard/miscellaneous/application.cpp @@ -11,7 +11,6 @@ #include "gui/feedsview.h" #include "gui/messagebox.h" #include "gui/toolbars/statusbar.h" -#include "gui/webviewers/litehtml/litehtmlviewer.h" // QLiteHtml-based web browsing. #include "gui/webviewers/qtextbrowser/textbrowserviewer.h" // QTextBrowser-based web browsing. #include "miscellaneous/feedreader.h" #include "miscellaneous/iconfactory.h" @@ -647,7 +646,6 @@ WebViewer* Application::createWebView() { #else if (forcedNoWebEngine()) { return new TextBrowserViewer(); - // return new LiteHtmlViewer(); } else { return new WebEngineViewer();