1 // Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef QTXFINDACTIONDIALOG_H
21 #define QTXFINDACTIONDIALOG_H
26 #include <QTreeWidget>
27 #include "SUIT_ShortcutMgr.h"
38 class QtxFoundActionTree;
41 class QTX_EXPORT QtxFindActionDialog : public QDialog
46 QtxFindActionDialog(QWidget* theParent);
47 QtxFindActionDialog(const QtxFindActionDialog&) = delete;
48 QtxFindActionDialog& operator=(const QtxFindActionDialog&) = delete;
49 virtual ~QtxFindActionDialog() = default;
51 void setActiveModuleID(const QString& theModuleID = SUIT_ShortcutMgr::ROOT_MODULE_ID);
54 void onQueryChanged(const QString& theKeyword);
55 void onSearchOptionUnavailableActionsChanged(int);
56 void onSearchOptionInactiveModulesChanged(int);
61 QLineEdit* myQueryLineEdit;
62 QCheckBox* myIncludeUnavailableActionsCB;
63 QCheckBox* myIncludeInactiveModulesCB;
64 QtxFoundActionTree* myFoundActionsTree;
66 QString myActiveModuleID;
67 SUIT_ActionSearcher myActionSearcher;
71 class QtxFoundActionTreeItem;
72 class QtxFoundActionTreeFolder;
73 class QtxFoundActionTreeAction;;
76 class QTX_EXPORT QtxFoundActionTree : public QTreeWidget
93 QtxFoundActionTree(const QtxFoundActionTree&) = delete;
94 QtxFoundActionTree& operator=(const QtxFoundActionTree&) = delete;
95 virtual ~QtxFoundActionTree() = default;
97 void updateItems(const std::map<QString, std::map<QString, SUIT_ActionSearcher::AssetsAndSearchData>>& theAssets);
100 std::pair<QtxFoundActionTreeFolder*, int> findModuleFolderItem(const QString& theModuleID) const;
103 void onItemDoubleClicked(QTreeWidgetItem* theWidgetItem, int theColIdx);
107 class QtxFoundActionTreeItem : public QTreeWidgetItem
116 QtxFoundActionTreeItem(const QString& theModuleID);
119 virtual ~QtxFoundActionTreeItem() = default;
120 virtual QtxFoundActionTreeItem::Type type() const = 0;
122 virtual void setAssets(std::shared_ptr<const SUIT_ActionAssets> theAssets, const QString& theLang) = 0;
123 QString name() const;
124 QString toolTip() const;
126 virtual QString getValue(QtxFoundActionTree::SortKey theKey) const = 0;
128 virtual bool isEnabled() const = 0;
131 const QString myModuleID;
135 class QtxFoundActionTreeFolder : public QtxFoundActionTreeItem
138 QtxFoundActionTreeFolder(const QString& theModuleID);
139 virtual ~QtxFoundActionTreeFolder() = default;
140 virtual QtxFoundActionTreeItem::Type type() const { return QtxFoundActionTreeItem::Type::Folder; };
142 virtual void setAssets(std::shared_ptr<const SUIT_ActionAssets> theAssets, const QString& theLang);
144 virtual QString getValue(QtxFoundActionTree::SortKey theKey) const;
146 virtual bool isEnabled() const;
150 class QtxFoundActionTreeAction : public QtxFoundActionTreeItem
153 QtxFoundActionTreeAction(const QString& theModuleID, const QString& theInModuleActionID);
156 static QtxFoundActionTreeAction* create(const QString& theModuleID, const QString& theInModuleActionID);
157 virtual ~QtxFoundActionTreeAction() = default;
158 virtual QtxFoundActionTreeItem::Type type() const { return QtxFoundActionTreeItem::Type::Action; };
160 virtual void setAssets(std::shared_ptr<const SUIT_ActionAssets> theAssets, const QString& theLang);
162 virtual QString getValue(QtxFoundActionTree::SortKey theKey) const;
164 virtual bool isEnabled() const;
166 void trigger() const;
168 const QString myInModuleActionID;
171 #endif // QTXFINDACTIONDIALOG_H