Salome HOME
[bos #40644][CEA](2024-T1) Feature search.
[modules/gui.git] / src / Qtx / QtxFeatureSearch.h
index ea68270053b1a585a2205a13431d38426f40a566..c5d3ac56bcea38f488ebe673f51c0543cd91783a 100644 (file)
 #include <functional>
 
 
+class QCheckBox;
+class QLineEdit;
+class QLabel;
+class QPushButton;
+class QtxFoundActionTree;
+
+
+class QTX_EXPORT QtxFeatureSearchDialog : public QDialog
+{
+  Q_OBJECT
+
+public:
+  QtxFeatureSearchDialog(QWidget* theParent);
+  QtxFeatureSearchDialog(const QtxFeatureSearchDialog&) = delete;
+  QtxFeatureSearchDialog& operator=(const QtxFeatureSearchDialog&) = delete;
+  virtual ~QtxFeatureSearchDialog() = default;
+
+  void setActiveModuleID(const QString& theModuleID = SUIT_ShortcutMgr::ROOT_MODULE_ID);
+
+private slots:
+  void onQueryChanged(const QString& theKeyword);
+  void onSearchOptionUnavailableActionsChanged(int);
+  void onSearchOptionInactiveModulesChanged(int);
+
+private:
+  void updateUI();
+
+  QLineEdit* myQueryLineEdit;
+  QCheckBox* myIncludeUnavailableActionsCB;
+  QCheckBox* myIncludeInactiveModulesCB;
+  QtxFoundActionTree* myFoundActionsTree;
+
+  QString myActiveModuleID;
+  SUIT_ActionSearcher myActionSearcher;
+};
+
+
 class QtxFoundActionTreeItem;
 class QtxFoundActionTreeFolder;
 class QtxFoundActionTreeAction;;
@@ -52,39 +89,18 @@ public:
     ToolTip
   };
 
-  enum class SortOrder {
-    Ascending,
-    Descending
-  };
-
   QtxFoundActionTree();
   QtxFoundActionTree(const QtxFoundActionTree&) = delete;
   QtxFoundActionTree& operator=(const QtxFoundActionTree&) = delete;
   virtual ~QtxFoundActionTree() = default;
 
-  void sort(QtxFoundActionTree::SortKey theKey, QtxFoundActionTree::SortOrder theOrder);
+  void updateItems(const std::map<QString, std::map<QString, SUIT_ActionSearcher::AssetsAndSearchData>>& theAssets);
 
 private:
-  void updateItems();
   std::pair<QtxFoundActionTreeFolder*, int> findModuleFolderItem(const QString& theModuleID) const;
 
-  std::set<QtxFoundActionTreeItem*, std::function<bool(QtxFoundActionTreeItem*, QtxFoundActionTreeItem*)>> getSortedChildren(QtxFoundActionTreeFolder* theParentItem);
-
-  void insertChild(
-    QtxFoundActionTreeFolder* theParentItem,
-    std::set<QtxFoundActionTreeItem*, std::function<bool(QtxFoundActionTreeItem*, QtxFoundActionTreeItem*)>>& theSortedChildren,
-    QtxFoundActionTreeItem* theChildItem
-  );
-
 private slots:
   void onItemDoubleClicked(QTreeWidgetItem* theWidgetItem, int theColIdx);
-
-public:
-  static const QList<std::pair<QtxFoundActionTree::SortKey, QtxFoundActionTree::SortOrder>> DEFAULT_SORT_SCHEMA;
-
-private:
-  QtxFoundActionTree::SortKey mySortKey;
-  QtxFoundActionTree::SortOrder mySortOrder;
 };
 
 
@@ -152,40 +168,4 @@ public:
   const QString myInModuleActionID;
 };
 
-
-class QCheckBox;
-class QLineEdit;
-class QLabel;
-class QPushButton;
-
-
-class QTX_EXPORT QtxFeatureSearchDialog : public QDialog
-{
-  Q_OBJECT
-
-public:
-  QtxFeatureSearchDialog(QWidget* theParent);
-  QtxFeatureSearchDialog(const QtxFeatureSearchDialog&) = delete;
-  QtxFeatureSearchDialog& operator=(const QtxFeatureSearchDialog&) = delete;
-  virtual ~QtxFeatureSearchDialog() = default;
-
-  void setActiveModuleID(const QString& theModuleID);
-
-private slots:
-  void onQueryChanged(const QString& theKeyword);
-  void onSearchOptionUnavailableActionsChanged(Qt::CheckState theState);
-  void onSearchOptionInactiveModulesChanged(Qt::CheckState theState);
-
-private:
-  void updateUI();
-
-  QLineEdit* myQueryLineEdit;
-  QCheckBox* myIncludeUnavailableActionsCB;
-  QCheckBox* myIncludeInactiveModulesCB;
-  QtxFoundActionTree* myFoundActionsTree;
-
-  QString myActiveModuleID;
-  SUIT_ActionSearcher myActionSearcher;
-};
-
 #endif // QTXFEATURESEARCH_H