| 1 | // For license of this file, see <project-root-folder>/LICENSE.md.cxx . . $ `<file>/src/librssguard/gui/reusable/helpspoiler.cpp`/ |
| 2 | |
| 3 | #include "gui/reusable/helpspoiler.h"cxx . . $ `<file>/src/librssguard/gui/reusable/helpspoiler.h`/ |
| 4 | |
| 5 | #include "definitions/definitions.h"cxx . . $ `<file>/src/librssguard/definitions/definitions.h`/ |
| 6 | #include "gui/reusable/plaintoolbutton.h"cxx . . $ `<file>/src/librssguard/gui/reusable/plaintoolbutton.h`/ |
| 7 | #include "miscellaneous/application.h"cxx . . $ `<file>/src/librssguard/miscellaneous/application.h`/ |
| 8 | #include "miscellaneous/iconfactory.h"cxx . . $ `<file>/src/librssguard/miscellaneous/iconfactory.h`/ |
| 9 | #include "network-web/webfactory.h"cxx . . $ `<file>/src/librssguard/network-web/webfactory.h`/ |
| 10 | |
| 11 | #include <QGridLayout> |
| 12 | #include <QParallelAnimationGroup> |
| 13 | #include <QPropertyAnimation> |
| 14 | #include <QScrollArea> |
| 15 | #include <QTextBrowser> |
| 16 | #include <QToolButton> |
| 17 | |
| 18 | HelpSpoilercxx . . $ HelpSpoiler#::HelpSpoilercxx . . $ HelpSpoiler#HelpSpoiler(108f35f7aa7f3cf9).(QWidgetcxx . . $ QWidget#* parent) |
| 19 | : QWidgetcxx . . $ QWidget#QWidget(872e7b0c281abd8d).(parent), m_btnTogglecxx . . $ HelpSpoiler#m_btnToggle.(new QToolButtoncxx . . $ QToolButton#QToolButton(108f35f7aa7f3cf9).(this)), m_contentcxx . . $ HelpSpoiler#m_content.(new QScrollAreacxx . . $ QScrollArea#QScrollArea(108f35f7aa7f3cf9).(this)), |
| 20 | m_animationcxx . . $ HelpSpoiler#m_animation.(new QParallelAnimationGroupcxx . . $ QParallelAnimationGroup#QParallelAnimationGroup(749de1b6ae65bddd).(this)), m_layoutcxx . . $ HelpSpoiler#m_layout.(new QGridLayoutcxx . . $ QGridLayout#QGridLayout(108f35f7aa7f3cf9).(this)), m_textcxx . . $ HelpSpoiler#m_text.(new QTextBrowsercxx . . $ QTextBrowser#QTextBrowser(108f35f7aa7f3cf9).(this)), |
| 21 | m_btnHelpcxx . . $ HelpSpoiler#m_btnHelp.(new PlainToolButtoncxx . . $ PlainToolButton#PlainToolButton(108f35f7aa7f3cf9).(this)) { |
| 22 | m_btnTogglecxx . . $ HelpSpoiler#m_btnToggle.->setStyleSheetcxx . . $ QWidget#setStyleSheet(3520e46b33348bf6).(QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("QToolButton { border: none; }")); |
| 23 | m_btnTogglecxx . . $ HelpSpoiler#m_btnToggle.->setToolButtonStylecxx . . $ QToolButton#setToolButtonStyle(8088b2ce57f6b5f3).(Qtcxx . . $ Qt/::ToolButtonStylecxx . . $ Qt/ToolButtonStyle#::ToolButtonTextBesideIconcxx . . $ Qt/ToolButtonTextBesideIcon.); |
| 24 | m_btnTogglecxx . . $ HelpSpoiler#m_btnToggle.->setArrowTypecxx . . $ QToolButton#setArrowType(5f3d65a399efd42e).(Qtcxx . . $ Qt/::ArrowTypecxx . . $ Qt/ArrowType#::RightArrowcxx . . $ Qt/RightArrow.); |
| 25 | m_btnTogglecxx . . $ HelpSpoiler#m_btnToggle.->setTextcxx . . $ QAbstractButton#setText(3520e46b33348bf6).(trcxx . . $ HelpSpoiler#tr(75d9f1c324b4579d).("View more information on this")); |
| 26 | m_btnTogglecxx . . $ HelpSpoiler#m_btnToggle.->setCheckablecxx . . $ QAbstractButton#setCheckable(b45ddcbc8423892c).(true); |
| 27 | m_btnTogglecxx . . $ HelpSpoiler#m_btnToggle.->setCheckedcxx . . $ QAbstractButton#setChecked(b45ddcbc8423892c).(false); |
| 28 | |
| 29 | m_contentcxx . . $ HelpSpoiler#m_content.->setStyleSheetcxx . . $ QWidget#setStyleSheet(3520e46b33348bf6).(QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("QScrollArea { border: 1px solid %1; }").argcxx . . $ QString#arg(ad0bca07273edcc2).(palettecxx . . $ QWidget#palette(a7bd6a16d2c88209).().windowTextcxx . . $ QPalette#windowText(e14a554c07951b96).().colorcxx . . $ QBrush#color(a1044652a6e0ddd).().namecxx . . $ QColor#name(f2bb36c0a1d70d89).())); |
| 30 | m_contentcxx . . $ HelpSpoiler#m_content.->setSizePolicycxx . . $ QWidget#setSizePolicy(457db7fe1842b3dc).(QSizePolicycxx . . $ QSizePolicy#::Policycxx . . $ QSizePolicy#Policy#::Expandingcxx . . $ QSizePolicy#Expanding., QSizePolicycxx . . $ QSizePolicy#::Policycxx . . $ QSizePolicy#Policy#::Fixedcxx . . $ QSizePolicy#Fixed.); |
| 31 | m_contentcxx . . $ HelpSpoiler#m_content.->setMaximumHeightcxx . . $ QWidget#setMaximumHeight(d4f767463ce0a6b3).(0); |
| 32 | m_contentcxx . . $ HelpSpoiler#m_content.->setMinimumHeightcxx . . $ QWidget#setMinimumHeight(d4f767463ce0a6b3).(0); |
| 33 | m_contentcxx . . $ HelpSpoiler#m_content.->setContentsMarginscxx . . $ QWidget#setContentsMargins(79c4c8645766fc71).({cxx . . $ QMargins#QMargins(2261ffe5112eab06).0, 0, 0, 0}); |
| 34 | |
| 35 | m_animationcxx . . $ HelpSpoiler#m_animation.->addAnimationcxx . . $ QAnimationGroup#addAnimation(37185230c1d39640).(new QPropertyAnimationcxx . . $ QPropertyAnimation#(this, QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("minimumHeight").toLocal8Bitcxx . . $ QString#toLocal8Bit(7c2073558a834e49).())); |
| 36 | m_animationcxx . . $ HelpSpoiler#m_animation.->addAnimationcxx . . $ QAnimationGroup#addAnimation(37185230c1d39640).(new QPropertyAnimationcxx . . $ QPropertyAnimation#(this, QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("maximumHeight").toLocal8Bitcxx . . $ QString#toLocal8Bit(7c2073558a834e49).())); |
| 37 | m_animationcxx . . $ HelpSpoiler#m_animation.->addAnimationcxx . . $ QAnimationGroup#addAnimation(37185230c1d39640).(new QPropertyAnimationcxx . . $ QPropertyAnimation#(m_contentcxx . . $ HelpSpoiler#m_content., QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("maximumHeight").toLocal8Bitcxx . . $ QString#toLocal8Bit(7c2073558a834e49).())); |
| 38 | |
| 39 | // Don't waste space. |
| 40 | m_layoutcxx . . $ HelpSpoiler#m_layout.->setHorizontalSpacingcxx . . $ QGridLayout#setHorizontalSpacing(d4f767463ce0a6b3).(0); |
| 41 | m_layoutcxx . . $ HelpSpoiler#m_layout.->setVerticalSpacingcxx . . $ QGridLayout#setVerticalSpacing(d4f767463ce0a6b3).(0); |
| 42 | m_layoutcxx . . $ HelpSpoiler#m_layout.->setContentsMarginscxx . . $ QLayout#setContentsMargins(748afa4755bc9595).(0, 0, 0, 0); |
| 43 | |
| 44 | m_btnHelpcxx . . $ HelpSpoiler#m_btnHelp.->setPaddingcxx . . $ PlainToolButton#setPadding(d4f767463ce0a6b3).(0); |
| 45 | |
| 46 | m_layoutcxx . . $ HelpSpoiler#m_layout.->addWidgetcxx . . $ QGridLayout#addWidget(17d1465fab362e2d).(m_btnHelpcxx . . $ HelpSpoiler#m_btnHelp., 0, 0); |
| 47 | m_layoutcxx . . $ HelpSpoiler#m_layout.->addWidgetcxx . . $ QGridLayout#addWidget(389f296663d8b53).(m_btnTogglecxx . . $ HelpSpoiler#m_btnToggle., 0, 1, 1, 1, Qtcxx . . $ QFlags#QFlags(93d577a3e9528307).::AlignmentFlagcxx . . $ Qt/AlignmentFlag#::AlignLeftcxx . . $ Qt/AlignLeft.); |
| 48 | m_layoutcxx . . $ HelpSpoiler#m_layout.->addWidgetcxx . . $ QGridLayout#addWidget(389f296663d8b53).(m_contentcxx . . $ HelpSpoiler#m_content., 1, 0, 1, 2); |
| 49 | |
| 50 | connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(m_textcxx . . $ HelpSpoiler#m_text., &QTextBrowsercxx . . $ QTextBrowser#::anchorClickedcxx . . $ QTextBrowser#anchorClicked(37355d2f77053a23)., this, &HelpSpoilercxx . . $ HelpSpoiler#::onAnchorClickedcxx . . $ HelpSpoiler#onAnchorClicked(37355d2f77053a23).); |
| 51 | |
| 52 | connectcxx . . $ QObject#connect(93770ac28d6bf547).(m_btnTogglecxx . . $ HelpSpoiler#m_btnToggle., &QToolButtoncxx . . $ QToolButton#::clickedcxx . . $ QAbstractButton#clicked(b45ddcbc8423892c)., [this](const bool checked) { |
| 53 | const auto collapsed_height = m_btnHelpcxx . . $ HelpSpoiler#m_btnHelp.->heightcxx . . $ QWidget#height(455f465bc33b4cdf).(); |
| 54 | auto content_height = m_textcxx . . $ HelpSpoiler#m_text.->documentcxx . . $ QTextEdit#document(f21741221844491e).()->sizecxx . . $ QTextDocument#size(6c9504dc925659fb).().heightcxx . . $ QSizeF#height(d8440c0a87ad7443).() + 22; |
| 55 | |
| 56 | for (int i = 0; i < m_animationcxx . . $ HelpSpoiler#m_animation.->animationCountcxx . . $ QAnimationGroup#animationCount(455f465bc33b4cdf).() - 1; i++) { |
| 57 | QPropertyAnimationcxx . . $ QPropertyAnimation#* spoiler_animation = static_cast<QPropertyAnimationcxx . . $ QPropertyAnimation#*>(m_animationcxx . . $ HelpSpoiler#m_animation.->animationAtcxx . . $ QAnimationGroup#animationAt(47db85344c80f955).(i)); |
| 58 | |
| 59 | spoiler_animation->setDurationcxx . . $ QVariantAnimation#setDuration(d4f767463ce0a6b3).(100); |
| 60 | spoiler_animation->setStartValuecxx . . $ QVariantAnimation#setStartValue(244511558b20107a).(collapsed_heightcxx . . $ QVariant#QVariant(f349c77f591a7878).); |
| 61 | spoiler_animation->setEndValuecxx . . $ QVariantAnimation#setEndValue(244511558b20107a).(collapsed_heightcxx . . $ QVariant#QVariant(4cbbf9c7388e6885). + content_height); |
| 62 | } |
| 63 | |
| 64 | QPropertyAnimationcxx . . $ QPropertyAnimation#* content_animation = |
| 65 | static_cast<QPropertyAnimationcxx . . $ QPropertyAnimation#*>(m_animationcxx . . $ HelpSpoiler#m_animation.->animationAtcxx . . $ QAnimationGroup#animationAt(47db85344c80f955).(m_animationcxx . . $ HelpSpoiler#m_animation.->animationCountcxx . . $ QAnimationGroup#animationCount(455f465bc33b4cdf).() - 1)); |
| 66 | |
| 67 | content_animation->setDurationcxx . . $ QVariantAnimation#setDuration(d4f767463ce0a6b3).(100); |
| 68 | content_animation->setStartValuecxx . . $ QVariantAnimation#setStartValue(244511558b20107a).(0cxx . . $ QVariant#QVariant(f349c77f591a7878).); |
| 69 | content_animation->setEndValuecxx . . $ QVariantAnimation#setEndValue(244511558b20107a).(content_heightcxx . . $ QVariant#QVariant(4cbbf9c7388e6885).); |
| 70 | |
| 71 | m_btnTogglecxx . . $ HelpSpoiler#m_btnToggle.->setArrowTypecxx . . $ QToolButton#setArrowType(5f3d65a399efd42e).(checked ? Qtcxx . . $ Qt/::ArrowTypecxx . . $ Qt/ArrowType#::DownArrowcxx . . $ Qt/DownArrow. : Qtcxx . . $ Qt/::ArrowTypecxx . . $ Qt/ArrowType#::RightArrowcxx . . $ Qt/RightArrow.); |
| 72 | m_animationcxx . . $ HelpSpoiler#m_animation.->setDirectioncxx . . $ QAbstractAnimation#setDirection(20b6460f3c866bf5).(checked ? QAbstractAnimationcxx . . $ QAbstractAnimation#::Directioncxx . . $ QAbstractAnimation#Direction#::Forwardcxx . . $ QAbstractAnimation#Forward. |
| 73 | : QAbstractAnimationcxx . . $ QAbstractAnimation#::Directioncxx . . $ QAbstractAnimation#Direction#::Backwardcxx . . $ QAbstractAnimation#Backward.); |
| 74 | m_animationcxx . . $ HelpSpoiler#m_animation.->startcxx . . $ QAbstractAnimation#start(64d3ffc9cc98549b).(); |
| 75 | }); |
| 76 | |
| 77 | m_textcxx . . $ HelpSpoiler#m_text.->viewportcxx . . $ QAbstractScrollArea#viewport(27f420ad5cce8994).()->setAutoFillBackgroundcxx . . $ QWidget#setAutoFillBackground(b45ddcbc8423892c).(false); |
| 78 | m_textcxx . . $ HelpSpoiler#m_text.->setFrameShapecxx . . $ QFrame#setFrameShape(58426e538cd37cb).(QFramecxx . . $ QFrame#::Shapecxx . . $ QFrame#Shape#::NoFramecxx . . $ QFrame#NoFrame.); |
| 79 | m_textcxx . . $ HelpSpoiler#m_text.->setOpenLinkscxx . . $ QTextBrowser#setOpenLinks(b45ddcbc8423892c).(false); |
| 80 | m_textcxx . . $ HelpSpoiler#m_text.->setOpenExternalLinkscxx . . $ QTextBrowser#setOpenExternalLinks(b45ddcbc8423892c).(false); |
| 81 | m_textcxx . . $ HelpSpoiler#m_text.->setVerticalScrollBarPolicycxx . . $ QAbstractScrollArea#setVerticalScrollBarPolicy(ec1b3becc657ee30).(Qtcxx . . $ Qt/::ScrollBarPolicycxx . . $ Qt/ScrollBarPolicy#::ScrollBarAlwaysOffcxx . . $ Qt/ScrollBarAlwaysOff.); |
| 82 | m_textcxx . . $ HelpSpoiler#m_text.->setHorizontalScrollBarPolicycxx . . $ QAbstractScrollArea#setHorizontalScrollBarPolicy(ec1b3becc657ee30).(Qtcxx . . $ Qt/::ScrollBarPolicycxx . . $ Qt/ScrollBarPolicy#::ScrollBarAlwaysOffcxx . . $ Qt/ScrollBarAlwaysOff.); |
| 83 | m_textcxx . . $ HelpSpoiler#m_text.->setWordWrapModecxx . . $ QTextEdit#setWordWrapMode(3f929c8d13a78d0c).(QTextOptioncxx . . $ QTextOption#::WrapModecxx . . $ QTextOption#WrapMode#::WordWrapcxx . . $ QTextOption#WordWrap.); |
| 84 | |
| 85 | auto* content_layout = new QVBoxLayoutcxx . . $ QVBoxLayout#(m_contentcxx . . $ HelpSpoiler#m_content.); |
| 86 | |
| 87 | content_layout->addWidgetcxx . . $ QBoxLayout#addWidget(d39963fa34d6acb).(m_textcxx . . $ HelpSpoiler#m_text., 1); |
| 88 | } |
| 89 | |
| 90 | void HelpSpoilercxx . . $ HelpSpoiler#::setHelpTextcxx . . $ HelpSpoiler#setHelpText(6cbc7f707216ade4).(const QStringcxx . . $ QString#& title, const QStringcxx . . $ QString#& text, bool is_warning, bool force_html) { |
| 91 | m_btnTogglecxx . . $ HelpSpoiler#m_btnToggle.->setTextcxx . . $ QAbstractButton#setText(3520e46b33348bf6).(title); |
| 92 | setHelpTextcxx . . $ HelpSpoiler#setHelpText(5f6801bd00533ebd).(text, is_warning); |
| 93 | } |
| 94 | |
| 95 | void HelpSpoilercxx . . $ HelpSpoiler#::setHelpTextcxx . . $ HelpSpoiler#setHelpText(5f6801bd00533ebd).(const QStringcxx . . $ QString#& text, bool is_warning, bool force_html) { |
| 96 | if (force_html) { |
| 97 | m_textcxx . . $ HelpSpoiler#m_text.->setHtmlcxx . . $ QTextEdit#setHtml(3520e46b33348bf6).(text); |
| 98 | } |
| 99 | else { |
| 100 | m_textcxx . . $ HelpSpoiler#m_text.->setTextcxx . . $ QTextEdit#setText(3520e46b33348bf6).(text); |
| 101 | } |
| 102 | |
| 103 | m_btnHelpcxx . . $ HelpSpoiler#m_btnHelp.->setIconcxx . . $ QAbstractButton#setIcon(71dcdac178620ed6).(is_warning ? qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->iconscxx . . $ Application#icons(d976db2a0d825b70).()->fromThemecxx . . $ IconFactory#fromTheme(e457fbbee8993f3).(QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("dialog-warning")) |
| 104 | : qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->iconscxx . . $ Application#icons(d976db2a0d825b70).()->fromThemecxx . . $ IconFactory#fromTheme(e457fbbee8993f3).(QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("dialog-question"))); |
| 105 | |
| 106 | m_textcxx . . $ HelpSpoiler#m_text.->documentcxx . . $ QTextEdit#document(f21741221844491e).()->setDocumentMargincxx . . $ QTextDocument#setDocumentMargin(ba8836b59fb42830).(0); |
| 107 | } |
| 108 | |
| 109 | void HelpSpoilercxx . . $ HelpSpoiler#::onAnchorClickedcxx . . $ HelpSpoiler#onAnchorClicked(37355d2f77053a23).(const QUrlcxx . . $ QUrl#& url) { |
| 110 | qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->webcxx . . $ Application#web(ad68e16c93841931).()->openUrlInExternalBrowsercxx . . $ WebFactory#openUrlInExternalBrowser(dd54f9efb9153ea5).(urlcxx . . $ QUrl#QUrl(ea1f3831e370f1cb)..toStringcxx . . $ QUrl#toString(632475ebea3355f1).()); |
| 111 | } |