Debian Codegraph @

src/Gui/Dialogs/DlgActionsImp.cpp

raw
1 /***************************************************************************
2 * Copyright (c) 2004 Werner Mayer <wmayer[at]users.sourceforge.net> *
3 * *
4 * This file is part of the FreeCAD CAx development system. *
5 * *
6 * This library is free software; you can redistribute it and/or *
7 * modify it under the terms of the GNU Library General Public *
8 * License as published by the Free Software Foundation; either *
9 * version 2 of the License, or (at your option) any later version. *
10 * *
11 * This library is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU Library General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU Library General Public *
17 * License along with this library; see the file COPYING.LIB. If not, *
18 * write to the Free Software Foundation, Inc., 59 Temple Place, *
19 * Suite 330, Boston, MA 02111-1307, USA *
20 * *
21 ***************************************************************************/
22
23 #include <QDialogButtonBox>
24 #include <QDir>
25 #include <QFileDialog>
26 #include <QFileInfo>
27 #include <QHeaderView>
28 #include <QImageReader>
29 #include <QKeySequence>
30 #include <QLineEdit>
31 #include <QMessageBox>
32
33 #include "Dialogs/DlgActionsImp.h"
34 #include "ui_DlgActions.h"
35 #include "Action.h"
36 #include "Application.h"
37 #include "BitmapFactory.h"
38 #include "Command.h"
39 #include "ShortcutManager.h"
40 #include "ui_DlgChooseIcon.h"
41
42
43 using namespace Gui::Dialog;
44
45 /* TRANSLATOR Gui::Dialog::DlgCustomActionsImp */
46
47 /**
48 * Constructs a DlgCustomActionsImp which is a child of 'parent', with the
49 * name 'name' and widget flags set to 'f'
50 *
51 * The dialog will by default be modeless, unless you set 'modal' to
52 * true to construct a modal dialog.
53 */
54 DlgCustomActionsImp::DlgCustomActionsImp(QWidget* parent)
55 : CustomizeActionPage(parent)
56 , ui(new Ui_DlgCustomActions)
57 {
58 ui->setupUi(this);
59 setupConnections();
60
61 // search for all macros
62 std::string cMacroPath = App::GetApplication()
63 .GetParameterGroupByPath("User parameter:BaseApp/Preferences/Macro")
64 ->GetASCII("MacroPath", App::Application::getUserMacroDir().c_str());
65
66 QDir d(QString::fromUtf8(cMacroPath.c_str()), QLatin1String("*.FCMacro *.py"));
67 for (unsigned int i = 0; i < d.count(); i++) {
68 ui->actionMacros->insertItem(0, d[i], QVariant(false));
69 }
70
71 QString systemMacroDirStr = QString::fromStdString(App::Application::getHomePath())
72 + QStringLiteral("Macro");
73 d = QDir(systemMacroDirStr, QLatin1String("*.FCMacro *.py"));
74 if (d.exists()) {
75 for (unsigned int i = 0; i < d.count(); i++) {
76 ui->actionMacros->insertItem(0, d[i], QVariant(true));
77 }
78 }
79
80 QStringList labels;
81 labels << tr("Icons") << tr("Macros");
82 ui->actionListWidget->setHeaderLabels(labels);
83 ui->actionListWidget->header()->hide();
84 ui->actionListWidget->setIconSize(QSize(32, 32));
85 ui->actionListWidget->header()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
86
87 showActions();
88 }
89
90 /** Destroys the object and frees any allocated resources */
91 DlgCustomActionsImp::~DlgCustomActionsImp()
92 {
93 if (bChanged) {
94 MacroCommand::save();
95 }
96 }
97
98 void DlgCustomActionsImp::setupConnections()
99 {
100 // clang-format off
101 connect(ui->actionListWidget, &QTreeWidget::itemActivated,
102 this, &DlgCustomActionsImp::onActionListWidgetItemActivated);
103 connect(ui->buttonChoosePixmap, &QToolButton::clicked,
104 this, &DlgCustomActionsImp::onButtonChoosePixmapClicked);
105 connect(ui->buttonAddAction, &QPushButton::clicked,
106 this, &DlgCustomActionsImp::onButtonAddActionClicked);
107 connect(ui->buttonRemoveAction, &QPushButton::clicked,
108 this, &DlgCustomActionsImp::onButtonRemoveActionClicked);
109 connect(ui->buttonReplaceAction, &QPushButton::clicked,
110 this, &DlgCustomActionsImp::onButtonReplaceActionClicked);
111 // clang-format on
112 }
113
114 bool DlgCustomActionsImp::event(QEvent* e)
115 {
116 // clang-format off
117 bool ok = QWidget::event(e);
118
119 if (e->type() == QEvent::ParentChange || e->type() == QEvent::ParentAboutToChange)
120 {
121 QWidget* topLevel = this->parentWidget();
122 while (topLevel && !topLevel->inherits("QDialog"))
123 topLevel = topLevel->parentWidget();
124 if ( topLevel )
125 {
126 int index = topLevel->metaObject()->indexOfSignal( QMetaObject::normalizedSignature("addMacroAction(const QByteArray&)") );
127 if ( index >= 0 ) {
128 if ( e->type() == QEvent::ParentChange ) {
129 connect(this, SIGNAL(addMacroAction( const QByteArray& )),
130 topLevel, SIGNAL(addMacroAction( const QByteArray& )));
131 connect(this, SIGNAL(removeMacroAction( const QByteArray& )),
132 topLevel, SIGNAL(removeMacroAction( const QByteArray& )));
133 connect(this, SIGNAL(modifyMacroAction( const QByteArray& )),
134 topLevel, SIGNAL(modifyMacroAction( const QByteArray& )));
135 } else {
136 disconnect(this, SIGNAL(addMacroAction( const QByteArray& )),
137 topLevel, SIGNAL(addMacroAction( const QByteArray& )));
138 disconnect(this, SIGNAL(removeMacroAction( const QByteArray& )),
139 topLevel, SIGNAL(removeMacroAction( const QByteArray& )));
140 disconnect(this, SIGNAL(modifyMacroAction( const QByteArray& )),
141 topLevel, SIGNAL(modifyMacroAction( const QByteArray& )));
142 }
143 }
144 }
145 }
146 // clang-format on
147
148 return ok;
149 }
150
151 void DlgCustomActionsImp::onAddMacroAction(const QByteArray&)
152 {
153 bChanged = true;
154 }
155
156 void DlgCustomActionsImp::onRemoveMacroAction(const QByteArray& name)
157 {
158 bChanged = true;
159 ShortcutManager::instance()->reset(name.constData());
160 }
161
162 void DlgCustomActionsImp::onModifyMacroAction(const QByteArray&)
163 {
164 bChanged = true;
165 }
166
167 void DlgCustomActionsImp::showActions()
168 {
169 CommandManager& rclMan = Application::Instance->commandManager();
170 std::vector<Command*> aclCurMacros = rclMan.getGroupCommands("Macros");
171 for (const auto& aclCurMacro : aclCurMacros) {
172 auto item = new QTreeWidgetItem(ui->actionListWidget);
173 QByteArray actionName = aclCurMacro->getName();
174 item->setData(1, Qt::UserRole, actionName);
175 item->setText(1, QString::fromUtf8(aclCurMacro->getMenuText()));
176 item->setSizeHint(0, QSize(32, 32));
177 if (aclCurMacro->getPixmap()) {
178 item->setIcon(0, BitmapFactory().pixmap(aclCurMacro->getPixmap()));
179 }
180 }
181 }
182
183 void DlgCustomActionsImp::onActionListWidgetItemActivated(QTreeWidgetItem* item)
184 {
185 if (!item) {
186 return; // no valid item
187 }
188
189 // search for the command in the manager and if necessary in the temporary created ones
190 QByteArray actionName = item->data(1, Qt::UserRole).toByteArray();
191 CommandManager& rclMan = Application::Instance->commandManager();
192 Command* pCmd = rclMan.getCommandByName(actionName.constData());
193 auto pScript = dynamic_cast<MacroCommand*>(pCmd);
194
195 // if valid command
196 if (pScript) {
197 bool bFound = false;
198 QString scriptName = QString::fromUtf8(pScript->getScriptName());
199 for (int i = 0; i < ui->actionMacros->count(); i++) {
200 if (ui->actionMacros->itemText(i).startsWith(scriptName, Qt::CaseSensitive)) {
201 bFound = true;
202 ui->actionMacros->setCurrentIndex(i);
203 break;
204 }
205 }
206
207 if (!bFound) {
208 QMessageBox::critical(
209 this,
210 tr("Macro not found"),
211 tr("Could not find macro file '%1'").arg(scriptName)
212 );
213 }
214
215 // fill up labels with the command's data
216 ui->actionWhatsThis->setText(QString::fromUtf8(pScript->getWhatsThis()));
217 ui->actionMenu->setText(QString::fromUtf8(pScript->getMenuText()));
218 ui->actionToolTip->setText(QString::fromUtf8(pScript->getToolTipText()));
219 ui->actionStatus->setText(QString::fromUtf8(pScript->getStatusTip()));
220 ui->actionAccel->setKeySequence(QKeySequence(
221 ShortcutManager::instance()->getShortcut(actionName.constData(), pScript->getAccel())
222 ));
223 ui->pixmapLabel->clear();
224 m_sPixmap.clear();
225 const char* name = pScript->getPixmap();
226 if (name && std::strlen(name) > 2) {
227 QPixmap p = Gui::BitmapFactory().pixmap(pScript->getPixmap());
228 ui->pixmapLabel->setPixmap(p);
229 m_sPixmap = QString::fromUtf8(name); // can also be a path
230 }
231 }
232 }
233
234 void DlgCustomActionsImp::onButtonAddActionClicked()
235 {
236 if (ui->actionMacros->currentText().isEmpty()) {
237 QMessageBox::warning(this, tr("Empty macro"), tr("Specify the macro first"));
238 return;
239 }
240
241 if (ui->actionMenu->text().isEmpty()) {
242 QMessageBox::warning(this, tr("Empty text"), tr("Specify the menu text first"));
243 return;
244 }
245
246 // search for the command in the manager
247 CommandManager& rclMan = Application::Instance->commandManager();
248 QByteArray actionName = QString::fromStdString(rclMan.newMacroName()).toLatin1();
249 auto macro = new MacroCommand(
250 actionName,
251 ui->actionMacros->itemData(ui->actionMacros->currentIndex()).toBool()
252 );
253 rclMan.addCommand(macro);
254
255 // add new action
256 auto item = new QTreeWidgetItem(ui->actionListWidget);
257 item->setData(1, Qt::UserRole, actionName);
258 item->setText(1, ui->actionMenu->text());
259 item->setSizeHint(0, QSize(32, 32));
260 item->setIcon(0, ui->pixmapLabel->pixmap(Qt::ReturnByValue));
261
262 // Convert input text into utf8
263 if (!ui->actionWhatsThis->text().isEmpty()) {
264 macro->setWhatsThis(ui->actionWhatsThis->text().toUtf8());
265 }
266 ui->actionWhatsThis->clear();
267
268 if (!ui->actionMacros->currentText().isEmpty()) {
269 macro->setScriptName(ui->actionMacros->currentText().toUtf8());
270 }
271
272 if (!ui->actionMenu->text().isEmpty()) {
273 macro->setMenuText(ui->actionMenu->text().toUtf8());
274 }
275 ui->actionMenu->clear();
276
277 if (!ui->actionToolTip->text().isEmpty()) {
278 macro->setToolTipText(ui->actionToolTip->text().toUtf8());
279 }
280 ui->actionToolTip->clear();
281
282 if (!ui->actionStatus->text().isEmpty()) {
283 macro->setStatusTip(ui->actionStatus->text().toUtf8());
284 }
285 ui->actionStatus->clear();
286
287 if (!m_sPixmap.isEmpty()) {
288 macro->setPixmap(m_sPixmap.toLatin1());
289 }
290 ui->pixmapLabel->clear();
291 m_sPixmap.clear();
292
293 if (!ui->actionAccel->isEmpty()) {
294 QString text = ui->actionAccel->text();
295 ShortcutManager::instance()->setShortcut(actionName.constData(), text.toLatin1().constData());
296 }
297 ui->actionAccel->clear();
298
299 // emit signal to notify the container widget
300 Q_EMIT addMacroAction(actionName);
301 }
302
303 void DlgCustomActionsImp::onButtonReplaceActionClicked()
304 {
305 QTreeWidgetItem* item = ui->actionListWidget->currentItem();
306 if (!item) {
307 QMessageBox::warning(this, tr("No item selected"), tr("Select a macro item first"));
308 return;
309 }
310
311 if (ui->actionMenu->text().isEmpty()) {
312 QMessageBox::warning(this, tr("Empty text"), tr("Specify the menu text first"));
313 return;
314 }
315
316 // search for the command in the manager
317 QByteArray actionName = item->data(1, Qt::UserRole).toByteArray();
318 item->setText(1, ui->actionMenu->text());
319 CommandManager& rclMan = Application::Instance->commandManager();
320 Command* pCmd = rclMan.getCommandByName(actionName.constData());
321 auto macro = dynamic_cast<MacroCommand*>(pCmd);
322 if (!macro) {
323 return;
324 }
325
326 if (!ui->actionWhatsThis->text().isEmpty()) {
327 macro->setWhatsThis(ui->actionWhatsThis->text().toUtf8());
328 }
329 ui->actionWhatsThis->clear();
330
331 if (!ui->actionMacros->currentText().isEmpty()) {
332 macro->setScriptName(ui->actionMacros->currentText().toUtf8());
333 }
334
335 if (!ui->actionMenu->text().isEmpty()) {
336 macro->setMenuText(ui->actionMenu->text().toUtf8());
337 }
338 ui->actionMenu->clear();
339
340 if (!ui->actionToolTip->text().isEmpty()) {
341 macro->setToolTipText(ui->actionToolTip->text().toUtf8());
342 }
343 ui->actionToolTip->clear();
344
345 if (!ui->actionStatus->text().isEmpty()) {
346 macro->setStatusTip(ui->actionStatus->text().toUtf8());
347 }
348 ui->actionStatus->clear();
349
350 if (!m_sPixmap.isEmpty()) {
351 macro->setPixmap(m_sPixmap.toLatin1());
352 }
353 ui->pixmapLabel->clear();
354 m_sPixmap.clear();
355
356 if (!ui->actionAccel->isEmpty()) {
357 QString text = ui->actionAccel->text();
358 macro->setAccel(text.toLatin1());
359 }
360 ui->actionAccel->clear();
361
362 // check whether the macro is already in use
363 Action* action = macro->getAction();
364 if (action) {
365 // does all the text related stuff
366 action->setText(QString::fromUtf8(macro->getMenuText()));
367 action->setToolTip(QString::fromUtf8(macro->getToolTipText()));
368 action->setWhatsThis(QString::fromUtf8(macro->getWhatsThis()));
369 action->setStatusTip(QString::fromUtf8(macro->getStatusTip()));
370 if (macro->getPixmap()) {
371 action->setIcon(Gui::BitmapFactory().pixmap(macro->getPixmap()));
372 }
373 action->setShortcut(
374 ShortcutManager::instance()->getShortcut(actionName.constData(), macro->getAccel())
375 );
376 }
377
378 // emit signal to notify the container widget
379 Q_EMIT modifyMacroAction(actionName);
380
381 // call this at the end because it internally invokes the highlight method
382 if (macro->getPixmap()) {
383 item->setIcon(0, Gui::BitmapFactory().pixmap(macro->getPixmap()));
384 }
385 }
386
387 void DlgCustomActionsImp::onButtonRemoveActionClicked()
388 {
389 // remove item from list view
390 QTreeWidgetItem* item = ui->actionListWidget->currentItem();
391 if (!item) {
392 return;
393 }
394 int current = ui->actionListWidget->indexOfTopLevelItem(item);
395 ui->actionListWidget->takeTopLevelItem(current);
396 QByteArray actionName = item->data(1, Qt::UserRole).toByteArray();
397 delete item;
398
399 // if the command is registered in the manager just remove it
400 CommandManager& rclMan = Application::Instance->commandManager();
401 std::vector<Command*> aclCurMacros = rclMan.getGroupCommands("Macros");
402 for (auto& aclCurMacro : aclCurMacros) {
403 if (actionName == aclCurMacro->getName()) {
404 // emit signal to notify the container widget
405 Q_EMIT removeMacroAction(actionName);
406 // remove from manager and delete it immediately
407 rclMan.removeCommand(aclCurMacro);
408 break;
409 }
410 }
411 }
412
413 IconDialog::IconDialog(QWidget* parent)
414 : QDialog(parent)
415 , ui(new Ui_DlgChooseIcon)
416 {
417 ui->setupUi(this);
418 ui->listWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
419 // signals and slots connections
420 connect(ui->listWidget, &QListWidget::itemClicked, this, &IconDialog::accept);
421 connect(ui->addButton, &QPushButton::clicked, this, &IconDialog::onAddIconPath);
422
423 QListWidgetItem* item;
424 QStringList names = BitmapFactory().findIconFiles();
425 for (const auto& name : names) {
426 item = new QListWidgetItem(ui->listWidget);
427 item->setIcon(QIcon(BitmapFactory().pixmap((const char*)name.toUtf8())));
428 item->setText(QFileInfo(name).baseName());
429 item->setToolTip(name);
430 }
431 }
432
433 IconDialog::~IconDialog()
434 {
435 delete ui;
436 }
437
438 QListWidgetItem* IconDialog::currentItem() const
439 {
440 return ui->listWidget->currentItem();
441 }
442
443 void IconDialog::resizeEvent(QResizeEvent*)
444 {
445 ui->listWidget->setFlow(QListView::LeftToRight);
446 }
447
448 void IconDialog::onAddIconPath()
449 {
450 // Add the user defined paths
451 Base::Reference<ParameterGrp> group = App::GetApplication().GetParameterGroupByPath(
452 "User parameter:BaseApp/Preferences/Bitmaps"
453 );
454 std::vector<std::string> paths = group->GetASCIIs("CustomPath");
455 QStringList pathList;
456 for (const auto& path : paths) {
457 pathList << QString::fromUtf8(path.c_str());
458 }
459
460 IconFolders dlg(pathList, this);
461 dlg.setWindowTitle(tr("Icon Folders"));
462 if (dlg.exec()) {
463 QStringList paths = dlg.getPaths();
464
465 // Write to user config
466 group->Clear();
467 int index = 0;
468 for (QStringList::iterator it = paths.begin(); it != paths.end(); ++it, ++index) {
469 std::stringstream str;
470 str << "CustomPath" << index;
471 group->SetASCII(str.str().c_str(), (const char*)it->toUtf8());
472 }
473
474 QStringList search = BitmapFactory().getPaths();
475 for (auto& it : search) {
476 it = QDir::toNativeSeparators(it);
477 }
478 for (const auto& path : paths) {
479 if (search.indexOf(path) < 0) {
480 QStringList filters;
481 QList<QByteArray> formats = QImageReader::supportedImageFormats();
482 for (const auto& format : formats) {
483 filters << QStringLiteral("*.%1").arg(QString::fromLatin1(format).toLower());
484 }
485 QDir d(path);
486 d.setNameFilters(filters);
487 QFileInfoList fi = d.entryInfoList();
488 for (const auto& jt : fi) {
489 QString file = jt.absoluteFilePath();
490 auto item = new QListWidgetItem(ui->listWidget);
491 item->setIcon(QIcon(file));
492 item->setText(jt.baseName());
493 item->setToolTip(file);
494 }
495
496 BitmapFactory().addPath(path);
497 }
498 }
499 }
500 }
501
502 void DlgCustomActionsImp::onButtonChoosePixmapClicked()
503 {
504 // create a dialog showing all pixmaps
505 Gui::Dialog::IconDialog dlg(this);
506 dlg.setModal(true);
507 dlg.exec();
508
509 ui->pixmapLabel->clear();
510 m_sPixmap.clear();
511 if (dlg.result() == QDialog::Accepted) {
512 QListWidgetItem* item = dlg.currentItem();
513 if (item) {
514 m_sPixmap = item->text();
515 ui->pixmapLabel->setPixmap(item->icon().pixmap(QSize(32, 32)));
516 }
517 }
518 }
519
520 void DlgCustomActionsImp::changeEvent(QEvent* e)
521 {
522 if (e->type() == QEvent::LanguageChange) {
523 ui->retranslateUi(this);
524 ui->actionListWidget->clear();
525 showActions();
526 }
527 QWidget::changeEvent(e);
528 }
529
530 IconFolders::IconFolders(const QStringList& paths, QWidget* parent)
531 : QDialog(parent)
532 , restart(false)
533 , maxLines(10)
534 {
535 resize(600, 400);
536 auto buttonBox = new QDialogButtonBox(this);
537 buttonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
538 connect(buttonBox, &QDialogButtonBox::accepted, this, &IconFolders::accept);
539 connect(buttonBox, &QDialogButtonBox::rejected, this, &IconFolders::reject);
540
541 gridLayout = new QGridLayout();
542 auto mainLayout = new QGridLayout(this);
543 mainLayout->addLayout(gridLayout, 0, 0, 1, 1);
544
545 auto verticalSpacer = new QSpacerItem(20, 108, QSizePolicy::Minimum, QSizePolicy::Expanding);
546 mainLayout->addItem(verticalSpacer, 1, 0, 1, 1);
547 mainLayout->addWidget(buttonBox, 2, 0, 1, 1);
548
549 // Add the user defined paths
550 int numPaths = static_cast<int>(paths.size());
551 int maxRow = this->maxLines;
552 for (int row = 0; row < maxRow; row++) {
553 auto edit = new QLineEdit(this);
554 edit->setReadOnly(true);
555 gridLayout->addWidget(edit, row, 0, 1, 1);
556 auto removeButton = new QPushButton(this);
557 removeButton->setIcon(BitmapFactory().iconFromTheme("list-remove"));
558 gridLayout->addWidget(removeButton, row, 1, 1, 1);
559
560 if (row < numPaths) {
561 edit->setText(paths[row]);
562 }
563 else {
564 edit->hide();
565 removeButton->hide();
566 }
567
568 buttonMap.append(qMakePair(edit, removeButton));
569 connect(removeButton, &QPushButton::clicked, this, &IconFolders::removeFolder);
570 }
571
572 textLabel = new QLabel(this);
573 textLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
574 textLabel->setText(tr("Add or remove custom icon folders"));
575 addButton = new QPushButton(this);
576 addButton->setIcon(BitmapFactory().iconFromTheme("list-add"));
577 gridLayout->addWidget(textLabel, maxRow, 0, 1, 1);
578 gridLayout->addWidget(addButton, maxRow, 1, 1, 1);
579
580 connect(addButton, &QPushButton::clicked, this, &IconFolders::addFolder);
581 if (numPaths >= this->maxLines) {
582 addButton->setDisabled(true);
583 }
584 }
585
586 IconFolders::~IconFolders() = default;
587
588 void IconFolders::addFolder()
589 {
590 int countHidden = -1;
591 QStringList paths;
592 for (const auto& it : buttonMap) {
593 if (it.first->isHidden()) {
594 countHidden++;
595 if (countHidden == 0) {
596 QString dir = QFileDialog::getExistingDirectory(
597 this,
598 IconDialog::tr("Add icon folder"),
599 QString()
600 );
601 if (!dir.isEmpty() && paths.indexOf(dir) < 0) {
602 QLineEdit* edit = it.first;
603 edit->setVisible(true);
604 edit->setText(dir);
605 QPushButton* removeButton = it.second;
606 removeButton->setVisible(true);
607 }
608 }
609 }
610 else {
611 paths << QDir::toNativeSeparators(it.first->text());
612 }
613 }
614
615 if (countHidden <= 0) {
616 addButton->setDisabled(true);
617 }
618 }
619
620 void IconFolders::removeFolder()
621 {
622 if (!restart) {
623 restart = true;
624 QMessageBox::information(
625 this,
626 tr("Remove folder"),
627 tr("Removing a folder only takes effect after an application restart")
628 );
629 }
630
631 addButton->setEnabled(true);
632 auto remove = static_cast<QPushButton*>(sender());
633 QLineEdit* edit = nullptr;
634 for (const auto& it : buttonMap) {
635 if (it.second == remove) {
636 edit = it.first;
637 }
638 else if (edit) {
639 // move up the text of the line edits
640 edit->setText(it.first->text());
641
642 if (it.first->isVisible()) {
643 edit = it.first;
644 remove = it.second;
645 }
646 else {
647 edit->hide();
648 remove->hide();
649 break;
650 }
651 }
652 }
653 }
654
655 QStringList IconFolders::getPaths() const
656 {
657 QStringList paths;
658 for (const auto& it : buttonMap) {
659 if (!it.first->isHidden()) {
660 paths << QDir::toNativeSeparators(it.first->text());
661 }
662 else {
663 break;
664 }
665 }
666 return paths;
667 }
668
669 #include "moc_DlgActionsImp.cpp"