| 1 | // For license of this file, see <project-root-folder>/LICENSE.md.cxx . . $ `<file>/src/librssguard/services/abstract/gui/formaddeditlabel.cpp`/ |
| 2 | |
| 3 | #include "services/abstract/gui/formaddeditlabel.h"cxx . . $ `<file>/src/librssguard/services/abstract/gui/formaddeditlabel.h`/ |
| 4 | |
| 5 | #include "gui/guiutilities.h"cxx . . $ `<file>/src/librssguard/gui/guiutilities.h`/ |
| 6 | #include "miscellaneous/application.h"cxx . . $ `<file>/src/librssguard/miscellaneous/application.h`/ |
| 7 | #include "miscellaneous/iconfactory.h"cxx . . $ `<file>/src/librssguard/miscellaneous/iconfactory.h`/ |
| 8 | #include "services/abstract/label.h"cxx . . $ `<file>/src/librssguard/services/abstract/label.h`/ |
| 9 | |
| 10 | #include <QPushButton> |
| 11 | |
| 12 | FormAddEditLabelcxx . . $ FormAddEditLabel#::FormAddEditLabelcxx . . $ FormAddEditLabel#FormAddEditLabel(108f35f7aa7f3cf9).(QWidgetcxx . . $ QWidget#* parent) : QDialogcxx . . $ QDialog#QDialog(872e7b0c281abd8d).(parent), m_editableLabelcxx . . $ FormAddEditLabel#m_editableLabel.(nullptr) { |
| 13 | m_uicxx . . $ FormAddEditLabel#m_ui..setupUicxx . . $ Ui_FormAddEditLabel#setupUi(d194de0c0f68c28b).(this); |
| 14 | m_uicxx . . $ FormAddEditLabel#m_ui..m_txtNamecxx . . $ Ui_FormAddEditLabel#m_txtName.->lineEditcxx . . $ LineEditWithStatus#lineEdit(b5c214bfbaa3003e).()->setPlaceholderTextcxx . . $ QLineEdit#setPlaceholderText(3520e46b33348bf6).(trcxx . . $ FormAddEditLabel#tr(75d9f1c324b4579d).("Name for your label")); |
| 15 | |
| 16 | connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(m_uicxx . . $ FormAddEditLabel#m_ui..m_txtNamecxx . . $ Ui_FormAddEditLabel#m_txtName.->lineEditcxx . . $ LineEditWithStatus#lineEdit(b5c214bfbaa3003e).(), &QLineEditcxx . . $ QLineEdit#::textChangedcxx . . $ QLineEdit#textChanged(3520e46b33348bf6)., this, [this](const QStringcxx . . $ QString#& text) { |
| 17 | m_uicxx . . $ FormAddEditLabel#m_ui..m_buttonBoxcxx . . $ Ui_FormAddEditLabel#m_buttonBox.->buttoncxx . . $ QDialogButtonBox#button(3b1c1f83a3cc2105).(QDialogButtonBoxcxx . . $ QDialogButtonBox#::StandardButtoncxx . . $ QDialogButtonBox#StandardButton#::Okcxx . . $ QDialogButtonBox#Ok.)->setEnabledcxx . . $ QWidget#setEnabled(b45ddcbc8423892c).(!text.isEmptycxx . . $ QString#isEmpty(3482b152b9333168).()); |
| 18 | |
| 19 | if (text.isEmptycxx . . $ QString#isEmpty(3482b152b9333168).()) { |
| 20 | m_uicxx . . $ FormAddEditLabel#m_ui..m_txtNamecxx . . $ Ui_FormAddEditLabel#m_txtName.->setStatuscxx . . $ WidgetWithStatus#setStatus(e987dce66bda7b0a).(LineEditWithStatuscxx . . $ LineEditWithStatus#::StatusTypecxx . . $ WidgetWithStatus#StatusType#::Errorcxx . . $ WidgetWithStatus#StatusType#Error., trcxx . . $ FormAddEditLabel#tr(75d9f1c324b4579d).("Label's name cannot be empty.")); |
| 21 | } |
| 22 | else { |
| 23 | m_uicxx . . $ FormAddEditLabel#m_ui..m_txtNamecxx . . $ Ui_FormAddEditLabel#m_txtName.->setStatuscxx . . $ WidgetWithStatus#setStatus(e987dce66bda7b0a).(LineEditWithStatuscxx . . $ LineEditWithStatus#::StatusTypecxx . . $ WidgetWithStatus#StatusType#::Okcxx . . $ WidgetWithStatus#StatusType#Ok., trcxx . . $ FormAddEditLabel#tr(75d9f1c324b4579d).("Perfect!")); |
| 24 | } |
| 25 | }); |
| 26 | } |
| 27 | |
| 28 | Labelcxx . . $ Label#* FormAddEditLabelcxx . . $ FormAddEditLabel#::execForAddcxx . . $ FormAddEditLabel#execForAdd(d44e39ca48f6ab51).() { |
| 29 | GuiUtilitiescxx . . $ GuiUtilities#::applyDialogPropertiescxx . . $ GuiUtilities#applyDialogProperties(6e9150cdaac92159).(*this, qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->iconscxx . . $ Application#icons(d976db2a0d825b70).()->fromThemecxx . . $ IconFactory#fromTheme(e457fbbee8993f3).(QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("tag-new")), trcxx . . $ FormAddEditLabel#tr(75d9f1c324b4579d).("Create new label")); |
| 30 | |
| 31 | m_uicxx . . $ FormAddEditLabel#m_ui..m_btnColorcxx . . $ Ui_FormAddEditLabel#m_btnColor.->setRandomColorcxx . . $ ColorToolButton#setRandomColor(49f6e7a06ebc5aa8).(); |
| 32 | m_uicxx . . $ FormAddEditLabel#m_ui..m_txtNamecxx . . $ Ui_FormAddEditLabel#m_txtName.->lineEditcxx . . $ LineEditWithStatus#lineEdit(b5c214bfbaa3003e).()->setTextcxx . . $ QLineEdit#setText(3520e46b33348bf6).(trcxx . . $ FormAddEditLabel#tr(75d9f1c324b4579d).("Hot stuff")); |
| 33 | m_uicxx . . $ FormAddEditLabel#m_ui..m_txtNamecxx . . $ Ui_FormAddEditLabel#m_txtName.->setFocuscxx . . $ QWidget#setFocus(49f6e7a06ebc5aa8).(); |
| 34 | |
| 35 | auto exit_code = execcxx . . $ QDialog#exec(b126dc7c1de90089).(); |
| 36 | |
| 37 | if (exit_code == QDialogcxx . . $ QDialog#::DialogCodecxx . . $ QDialog#DialogCode#::Acceptedcxx . . $ QDialog#Accepted.) { |
| 38 | return new Labelcxx . . $ Label#Label(db702bf7f1dcf973).(m_uicxx . . $ FormAddEditLabel#m_ui..m_txtNamecxx . . $ Ui_FormAddEditLabel#m_txtName.->lineEditcxx . . $ LineEditWithStatus#lineEdit(b5c214bfbaa3003e).()->textcxx . . $ QLineEdit#text(6ef7b6c27b00b43d).(), m_uicxx . . $ FormAddEditLabel#m_ui..m_btnColorcxx . . $ Ui_FormAddEditLabel#m_btnColor.->colorcxx . . $ ColorToolButton#color(6d62b116d5d1b12f).()); |
| 39 | } |
| 40 | else { |
| 41 | return nullptr; |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | bool FormAddEditLabelcxx . . $ FormAddEditLabel#::execForEditcxx . . $ FormAddEditLabel#execForEdit(5fb5dbab007eb3d1).(Labelcxx . . $ Label#* lbl) { |
| 46 | GuiUtilitiescxx . . $ GuiUtilities#::applyDialogPropertiescxx . . $ GuiUtilities#applyDialogProperties(6e9150cdaac92159).(*this, |
| 47 | qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->iconscxx . . $ Application#icons(d976db2a0d825b70).()->fromThemecxx . . $ IconFactory#fromTheme(e457fbbee8993f3).(QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("tag-properties")), |
| 48 | trcxx . . $ FormAddEditLabel#tr(75d9f1c324b4579d).("Edit label '%1'").argcxx . . $ QString#arg(ad0bca07273edcc2).(lbl->titlecxx . . $ RootItem#title(6ef7b6c27b00b43d).())); |
| 49 | |
| 50 | m_editableLabelcxx . . $ FormAddEditLabel#m_editableLabel. = lbl; |
| 51 | m_uicxx . . $ FormAddEditLabel#m_ui..m_btnColorcxx . . $ Ui_FormAddEditLabel#m_btnColor.->setColorcxx . . $ ColorToolButton#setColor(99344d984ab291fc).(lbl->colorcxx . . $ Label#color(6d62b116d5d1b12f).()); |
| 52 | m_uicxx . . $ FormAddEditLabel#m_ui..m_txtNamecxx . . $ Ui_FormAddEditLabel#m_txtName.->lineEditcxx . . $ LineEditWithStatus#lineEdit(b5c214bfbaa3003e).()->setTextcxx . . $ QLineEdit#setText(3520e46b33348bf6).(lbl->titlecxx . . $ RootItem#title(6ef7b6c27b00b43d).()); |
| 53 | m_uicxx . . $ FormAddEditLabel#m_ui..m_txtNamecxx . . $ Ui_FormAddEditLabel#m_txtName.->setFocuscxx . . $ QWidget#setFocus(49f6e7a06ebc5aa8).(); |
| 54 | |
| 55 | auto exit_code = execcxx . . $ QDialog#exec(b126dc7c1de90089).(); |
| 56 | |
| 57 | if (exit_code == QDialogcxx . . $ QDialog#::DialogCodecxx . . $ QDialog#DialogCode#::Acceptedcxx . . $ QDialog#Accepted.) { |
| 58 | m_editableLabelcxx . . $ FormAddEditLabel#m_editableLabel.->setColorcxx . . $ Label#setColor(129a55e114526ad3).(m_uicxx . . $ FormAddEditLabel#m_ui..m_btnColorcxx . . $ Ui_FormAddEditLabel#m_btnColor.->colorcxx . . $ ColorToolButton#color(6d62b116d5d1b12f).()); |
| 59 | m_editableLabelcxx . . $ FormAddEditLabel#m_editableLabel.->setTitlecxx . . $ RootItem#setTitle(3520e46b33348bf6).(m_uicxx . . $ FormAddEditLabel#m_ui..m_txtNamecxx . . $ Ui_FormAddEditLabel#m_txtName.->lineEditcxx . . $ LineEditWithStatus#lineEdit(b5c214bfbaa3003e).()->textcxx . . $ QLineEdit#text(6ef7b6c27b00b43d).()); |
| 60 | return true; |
| 61 | } |
| 62 | else { |
| 63 | return false; |
| 64 | } |
| 65 | } |