user macros can be "activated" (checked)#4361
Conversation
|
1)The issue is about deactivating triggers (and maybe shortcuts).
|
src/macrobrowserui.cpp
Outdated
| checkBox=new QCheckBox(); | ||
| checkBox->setChecked(false); | ||
| auto *lblCheckBox=new QLabel(tr("Import as active macros")); |
There was a problem hiding this comment.
default is active, this has to go
src/texstudio.cpp
Outdated
| // add elements | ||
| for(const auto &m:configManager.completerConfig->userMacros) { | ||
| if (m.name == TXS_AUTO_REPLACE_QUOTE_OPEN || m.name == TXS_AUTO_REPLACE_QUOTE_CLOSE || m.document) | ||
| if (m.name == TXS_AUTO_REPLACE_QUOTE_OPEN || m.name == TXS_AUTO_REPLACE_QUOTE_CLOSE || m.document || m.checkState() != Qt::Checked) |
src/texstudio.cpp
Outdated
|
|
||
| void Texstudio::execMacro(const Macro &m, const MacroExecContext &context, bool allowWrite) | ||
| { | ||
| if (m.checkState() != Qt::Checked) return; |
There was a problem hiding this comment.
only trigger and maybe shortcut are to be deactivated
src/macrobrowserui.cpp
Outdated
| hlayout->addWidget(checkBox); | ||
| hlayout->addWidget(lblCheckBox); | ||
| hlayout->addWidget(buttonBox); | ||
| layout->addLayout(hlayout); |
c93e53e to
db19238
Compare
src/usermenudialog.cpp
Outdated
| { | ||
| QTreeWidgetItem *item = ui.treeWidget->currentItem(); | ||
| if (item==nullptr) return; | ||
| if (item==nullptr || item->checkState(0)!=Qt::Checked) return; |
There was a problem hiding this comment.
why is the "execute macro" button blocked with active/inactive macro ?
src/usermenudialog.cpp
Outdated
| } | ||
| } | ||
|
|
||
| void UserMenuDialog::checkStateChanged(QTreeWidgetItem *item) |
There was a problem hiding this comment.
not sure why the checkstate is not just queried at getMacros ?
- don't test unchecked macros for duplicate trigger with quotes macros - update shortcuts for checked macros only - counter used needs to be the same as in original (full) user macros list
5508ff5 to
d5478e1
Compare
|
and at last, there should be a tooltip on the checkboxes, so that user may know what they are deactivating |
|
ok, I was thinking about tooltips at the beginning. But I assumed this could be to much UI activity while cursor is moving. Do you have an idea regarding the latexcompleter (s. question above)? |
|
tooltips also for folder items? |
set checkState in getMacros and on exportMacros toolTips
|
thanks |
Final remarks about results from the comments:
Macros are not really deactivated when they are not checked. They are still visible in the Macro menu as well as in the side panel and can be executed from there. You can also execute them in the Macro Editor by pressing the Exec button. While the macro shortcut and trigger won't work (s. added tooltip), the abbreviation can still be used. No checkbox has been added to the macro browser (repo). Any macro downloaded from there will be "activated" (checked).
Original PR
This PR resolves #3971. I made commits (starting with class changes) for each file changed. Some commits give further details. So I hope it's easier to understand. I also added some testing.
Loading/importing macros set checked macros not having checkState element, otherwise they are checked accordingly.
When importing from macro repo you can decide what checkState they should have (s. image below).
Screenshots:
show only checked macros in side bar and menu:
Tree view in macro editor:
Macro browser (macro repo):