| 1 | // For license of this file, see <project-root-folder>/LICENSE.md.cxx . . $ `<file>/src/librssguard/gui/toolbars/basetoolbar.cpp`/ |
| 2 | |
| 3 | #include "gui/toolbars/basetoolbar.h"cxx . . $ `<file>/src/librssguard/gui/toolbars/basetoolbar.h`/ |
| 4 | |
| 5 | #include "3rd-party/boolinq/boolinq.h"cxx . . $ `<file>/src/librssguard/3rd-party/boolinq/boolinq.h`/ |
| 6 | #include "definitions/definitions.h"cxx . . $ `<file>/src/librssguard/definitions/definitions.h`/ |
| 7 | #include "miscellaneous/settings.h"cxx . . $ `<file>/src/librssguard/miscellaneous/settings.h`/ |
| 8 | |
| 9 | #include <QFont> |
| 10 | #include <QPainter> |
| 11 | #include <QWidgetAction> |
| 12 | |
| 13 | BaseToolBarcxx . . $ BaseToolBar#::BaseToolBarcxx . . $ BaseToolBar#BaseToolBar(90d5708627041e22).(const QStringcxx . . $ QString#& title, QWidgetcxx . . $ QWidget#* parent) : QToolBarcxx . . $ QToolBar#(title, parent) { |
| 14 | // Update right margin of filter textbox. |
| 15 | QMarginscxx . . $ QMargins# margins = contentsMarginscxx . . $ QWidget#contentsMargins(b3d08c6b733dca3).(); |
| 16 | |
| 17 | margins.setRightcxx . . $ QMargins#setRight(f349c77f591a7878).(margins.rightcxx . . $ QMargins#right(ea6fe5115c70a13f).() + FILTER_RIGHT_MARGINcxx . . $ `src/librssguard/definitions/definitions.h:93:9`!); |
| 18 | setContentsMarginscxx . . $ QWidget#setContentsMargins(79c4c8645766fc71).(margins); |
| 19 | } |
| 20 | |
| 21 | BaseToolBarcxx . . $ BaseToolBar#::~cxx . . $ BaseToolBar#`~BaseToolBar`(ced63f7c635d850d).BaseToolBarcxx . . $ BaseToolBar#() { |
| 22 | qDebugNNcxx . . $ `src/librssguard/definitions/definitions.h:413:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). LOGSEC_GUIcxx . . $ `src/librssguard/definitions/definitions.h:174:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Destroying BaseToolBar instance."; |
| 23 | } |
| 24 | |
| 25 | QListcxx . . $ QList#<QActioncxx . . $ QAction#*> BaseBarcxx . . $ BaseBar#::extraActionscxx . . $ BaseBar#extraActions(6326ecb0baf05155).() const { |
| 26 | return {cxx . . $ QList#QList(ced63f7c635d850d).}; |
| 27 | } |
| 28 | |
| 29 | void BaseBarcxx . . $ BaseBar#::loadSavedActionscxx . . $ BaseBar#loadSavedActions(49f6e7a06ebc5aa8).() { |
| 30 | loadSpecificActionscxx . . $ BaseBar#loadSpecificActions(1c62d541ecdd9946).(convertActionscxx . . $ BaseBar#convertActions(2823155382a095dd).(savedActionscxx . . $ BaseBar#savedActions(2b25566bdf736d18).()), true); |
| 31 | } |
| 32 | |
| 33 | QActioncxx . . $ QAction#* BaseBarcxx . . $ BaseBar#::findMatchingActioncxx . . $ BaseBar#findMatchingAction(3f3eee881eed8b2b).(const QStringcxx . . $ QString#& action, const QListcxx . . $ QList#<QActioncxx . . $ QAction#*>& actions) const { |
| 34 | for (QActioncxx . . $ QAction#* act : actions) { |
| 35 | auto act_obj_name = act->objectNamecxx . . $ QObject#objectName(6ef7b6c27b00b43d).(); |
| 36 | |
| 37 | if (!act_obj_name.isEmptycxx . . $ QString#isEmpty(3482b152b9333168).() && action.startsWithcxx . . $ QString#startsWith(8cce4688c16f48f3).(act_obj_name)) { |
| 38 | return act; |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | return nullptr; |
| 43 | } |
| 44 | |
| 45 | void BaseToolBarcxx . . $ BaseToolBar#::addActionToMenucxx . . $ BaseToolBar#addActionToMenu(8891f95823878729).(QMenucxx . . $ QMenu#* menu, |
| 46 | const QIconcxx . . $ QIcon#& icon, |
| 47 | const QStringcxx . . $ QString#& title, |
| 48 | const QStringcxx . . $ QString#& tooltip_suffix, |
| 49 | const QVariantcxx . . $ QVariant#& value, |
| 50 | const QStringcxx . . $ QString#& object_name) { |
| 51 | QActioncxx . . $ QAction#* action = menu->addActioncxx . . $ QWidget#addAction(8dbc88344edea2fd).(icon, title); |
| 52 | |
| 53 | action->setToolTipcxx . . $ QAction#setToolTip(3520e46b33348bf6).(title +cxx . . $ operator+(adfbdceb504720ce). tooltip_suffix); |
| 54 | action->setCheckablecxx . . $ QAction#setCheckable(b45ddcbc8423892c).(true); |
| 55 | action->setDatacxx . . $ QAction#setData(244511558b20107a).(value); |
| 56 | action->setObjectNamecxx . . $ QObject#setObjectName(3520e46b33348bf6).(object_name); |
| 57 | } |
| 58 | |
| 59 | void BaseToolBarcxx . . $ BaseToolBar#::activateActioncxx . . $ BaseToolBar#activateAction(368f0de678a0b568).(const QStringcxx . . $ QString#& action_name, QWidgetActioncxx . . $ QWidgetAction#* widget_action) { |
| 60 | const int start = action_name.indexOfcxx . . $ QString#indexOf(7f9dda0319baab1e).('['cxx . . $ QChar#QChar(93d577a3e9528307).); |
| 61 | const int end = action_name.indexOfcxx . . $ QString#indexOf(7f9dda0319baab1e).(']'cxx . . $ QChar#QChar(93d577a3e9528307).); |
| 62 | |
| 63 | if (start != -1 && end != -1 && end == action_name.lengthcxx . . $ QString#length(6b0412d51016192f).() - 1) { |
| 64 | const QStringListcxx . . $ QStringList# menu_action_names = action_name.choppedcxx . . $ QString#chopped(32d917b74df1c30e).(1).rightcxx . . $ QString#right(769e6be952b825b0).(end - start - 1).splitcxx . . $ QString#split(4e27fcb098d1f780).(QL1Ccxx . . $ `src/librssguard/definitions/definitions.h:455:9`!(';')); |
| 65 | auto tool_btn = qobject_castcxx . . $ qobject_cast(c988cfc0ca08742e).<QToolButtoncxx . . $ QToolButton#*>(widget_action->defaultWidgetcxx . . $ QWidgetAction#defaultWidget(27f420ad5cce8994).()); |
| 66 | |
| 67 | for (QActioncxx . . $ QAction#* action : tool_btn->menucxx . . $ QToolButton#menu(ed4378587ff805df).()->actionscxx . . $ QWidget#actions(6326ecb0baf05155).()) { |
| 68 | if (menu_action_names.containscxx . . $ QListSpecialMethods#contains(89bcd3f9aa09e28b).(action->objectNamecxx . . $ QObject#objectName(6ef7b6c27b00b43d).()) && !action->isCheckedcxx . . $ QAction#isChecked(50ce9a9e25b4a850).()) { |
| 69 | action->triggercxx . . $ QAction#trigger(49f6e7a06ebc5aa8).(); |
| 70 | } |
| 71 | } |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | void BaseToolBarcxx . . $ BaseToolBar#::saveToolButtonSelectioncxx . . $ BaseToolBar#saveToolButtonSelection(7476e6c12bab527e).(const QStringcxx . . $ QString#& button_name, |
| 76 | const QStringcxx . . $ QString#& setting_name, |
| 77 | const QListcxx . . $ QList#<QActioncxx . . $ QAction#*>& actions) const { |
| 78 | QStringListcxx . . $ QStringList# action_names = savedActionscxx . . $ BaseBar#savedActions(2b25566bdf736d18).(); |
| 79 | auto opts_list = boolinqcxx . . $ boolinq/::fromcxx . . $ boolinq/from(1a44d082b2747720).(actions) |
| 80 | .selectcxx . . $ boolinq/Linq#select(a3f5bd4cd382e0ee).([](const QActioncxx . . $ QAction#* act) { |
| 81 | return act->objectNamecxx . . $ QObject#objectName(6ef7b6c27b00b43d).(); |
| 82 | }) |
| 83 | .toStdListcxx . . $ boolinq/Linq#toStdList(2989115be80c3067).(); |
| 84 | QStringListcxx . . $ QStringList# opts = FROM_STD_LISTcxx . . $ `src/librssguard/definitions/definitions.h:405:9`!(QStringList, opts_list); |
| 85 | |
| 86 | for (QStringcxx . . $ QString#& action_name : action_names) { |
| 87 | if (action_name.startsWithcxx . . $ QString#startsWith(8cce4688c16f48f3).(button_name)) { |
| 88 | action_name =cxx . . $ QString#`operator=`(4f35bf974e7f8568). button_name +cxx . . $ operator+(adfbdceb504720ce). QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("[%1]").argcxx . . $ QString#arg(ad0bca07273edcc2).(opts.joincxx . . $ QListSpecialMethods#join(227e33e1a3bf1f91).(QL1Ccxx . . $ `src/librssguard/definitions/definitions.h:455:9`!(';'))); |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->settingscxx . . $ Application#settings(951936487a2d9252).()->setValuecxx . . $ Settings#setValue(365356ede4ebaabb).(GROUPcxx . . $ `src/librssguard/miscellaneous/settings.h:32:9`!(GUI), setting_name, action_namescxx . . $ QVariant#QVariant(132dd6869045752b)..joincxx . . $ QListSpecialMethods#join(5555d9024dcf93fb).(QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!(","))); |
| 93 | } |
| 94 | |
| 95 | void BaseToolBarcxx . . $ BaseToolBar#::drawNumberOfCriteriascxx . . $ BaseToolBar#drawNumberOfCriterias(3e17fec436799122).(QToolButtoncxx . . $ QToolButton#* btn, int count) { |
| 96 | QPixmapcxx . . $ QPixmap# pxcxx . . $ QPixmap#QPixmap(3e454b8ccf442868).(128, 128); |
| 97 | px.fillcxx . . $ QPixmap#fill(129a55e114526ad3).(Qtcxx . . $ QColor#QColor(408ec4d5924bfb00).::GlobalColorcxx . . $ Qt/GlobalColor#::transparentcxx . . $ Qt/transparent.); |
| 98 | |
| 99 | QPaintercxx . . $ QPainter# pcxx . . $ QPainter#QPainter(dd2eedc069b0ab5f).(&px); |
| 100 | |
| 101 | auto fon = pcxx . . $ QFont#QFont(d0a4bd0c8524b912)..fontcxx . . $ QPainter#font(c5040538afc47120).(); |
| 102 | |
| 103 | fon.setPixelSizecxx . . $ QFont#setPixelSize(d4f767463ce0a6b3).(40); |
| 104 | p.setFontcxx . . $ QPainter#setFont(d0a4bd0c8524b912).(fon); |
| 105 | |
| 106 | p.drawPixmapcxx . . $ QPainter#drawPixmap(a20f30319626c023).(0, 0, 80, 80, btn->defaultActioncxx . . $ QToolButton#defaultAction(50f6a0536a8019cb).()->iconcxx . . $ QAction#icon(952ef71f8967d9eb).().pixmapcxx . . $ QIcon#pixmap(6ca65e964a77a341).(128, 128)); |
| 107 | p.drawTextcxx . . $ QPainter#drawText(26e93c81cbf08633).(65, 65, 50, 50, Qtcxx . . $ Qt/::AlignmentFlagcxx . . $ Qt/AlignmentFlag#::AlignCentercxx . . $ Qt/AlignCenter., QStringcxx . . $ QString#::numbercxx . . $ QString#number(f4fd9db251ca774b).(count)); |
| 108 | |
| 109 | btn->setIconcxx . . $ QAbstractButton#setIcon(71dcdac178620ed6).(pxcxx . . $ QIcon#QIcon(8887f7d25b86c3f4).); |
| 110 | } |