33 QLabel , QLineEdit , QTableWidget , QTableWidgetItem ,
44 QHeaderView , QTabWidget , QWidget , QMessageBox ,
55 QCheckBox , QDoubleSpinBox , QSpinBox , QGroupBox ,
6- QSplitter , QTextEdit , QProgressBar )
7- from PySide6 .QtCore import Qt , QTimer
6+ QSplitter , QTextEdit , QProgressBar , QSlider )
7+ from PySide6 .QtCore import Qt , QTimer , QCoreApplication
88from PySide6 .QtGui import QIcon
99from revengai_bn .utils import create_progress_dialog
1010from .match_functions_thread import MatchFunctionsThread
11+ from .search_collections_thread import SearchCollectionsThread
1112import os
1213
1314class MatchFunctionsDialog (QDialog ):
@@ -53,14 +54,21 @@ def create_search_tab(self):
5354 layout = QVBoxLayout ()
5455
5556 # Search section
56- search_group = QGroupBox ("Search Collections" )
57+ #search_group = QGroupBox("Search Collections")
58+ search_group = QGroupBox ()
5759 search_layout = QVBoxLayout ()
5860
5961 # Search input
6062 search_input_layout = QHBoxLayout ()
6163 self .search_input = QLineEdit ()
62- self .search_input .setPlaceholderText ("Enter search term (e.g., 'stealc') " )
64+ self .search_input .setPlaceholderText ("Enter search term" )
6365 self .search_input .returnPressed .connect (self .search_collections )
66+ description_label = QLabel (
67+ "Search (e.g. sha_256_hash:{}, tag:{}, binary_name:{}, collection_name:{}, function_name:{}, model_name:{})"
68+ #"Search Syntax: sha_256_hash: {hash}, tag: {tag}, binary_name: {binary_name}, collection_name: {collection_name},function_name: {function_name}, model_name: {model_name}"
69+ )
70+ description_label .setWordWrap (True )
71+
6472
6573 self .search_button = QPushButton ("Search" )
6674 self .search_button .clicked .connect (self .search_collections )
@@ -70,6 +78,7 @@ def create_search_tab(self):
7078 color: white;
7179 padding: 6px 12px;
7280 border-radius: 4px;
81+
7382 }
7483 QPushButton:hover {
7584 background-color: #0056b3;
@@ -78,7 +87,9 @@ def create_search_tab(self):
7887
7988 search_input_layout .addWidget (self .search_input )
8089 search_input_layout .addWidget (self .search_button )
90+
8191 search_layout .addLayout (search_input_layout )
92+ search_layout .addWidget (description_label )
8293
8394 # Collections table
8495 self .collections_table = QTableWidget ()
@@ -94,36 +105,38 @@ def create_search_tab(self):
94105
95106 self .collections_table .setSelectionBehavior (QTableWidget .SelectRows )
96107 self .collections_table .setAlternatingRowColors (True )
108+ self .collections_table .itemSelectionChanged .connect (self .on_result_selection_changed )
97109
98110 search_layout .addWidget (self .collections_table )
99111 search_group .setLayout (search_layout )
100112 layout .addWidget (search_group )
101113
102114 # Match settings section
103- settings_group = QGroupBox ("Match Settings" )
115+ #settings_group = QGroupBox("Match Settings")
116+ settings_group = QGroupBox ()
104117 settings_layout = QVBoxLayout ()
105-
106- # Distance threshold
107- distance_layout = QHBoxLayout ()
108- distance_layout .addWidget (QLabel ("Distance Threshold :" ))
109- self .distance_spinbox = QDoubleSpinBox ()
110- self .distance_spinbox . setRange ( 0.01 , 1.0 )
111- self .distance_spinbox . setValue ( 0.1 )
112- self .distance_spinbox . setSingleStep ( 0.01 )
113- self .distance_spinbox . setDecimals ( 2 )
114- distance_layout . addWidget ( self .distance_spinbox )
115- distance_layout . addStretch ( )
116- settings_layout . addLayout ( distance_layout )
117-
118- # Max matches
119- matches_layout = QHBoxLayout ( )
120- matches_layout . addWidget ( QLabel ( "Max Matches:" ))
121- self . max_matches_spinbox = QSpinBox ()
122- self .max_matches_spinbox . setRange ( 1 , 100 )
123- self .max_matches_spinbox . setValue ( 10 )
124- matches_layout .addWidget (self .max_matches_spinbox )
125- matches_layout . addStretch ()
126- settings_layout .addLayout (matches_layout )
118+
119+ # Confidence slider
120+ confidence_layout = QHBoxLayout ()
121+ confidence_layout .addWidget (QLabel ("Confidence :" ))
122+ self .confidenceSlider = QSlider ()
123+ self .confidenceSlider . setMaximum ( 100 )
124+ self .confidenceSlider . setPageStep ( 5 )
125+ self .confidenceSlider . setSliderPosition ( 90 )
126+ self .confidenceSlider . setOrientation ( Qt . Horizontal )
127+ self .confidenceSlider . setInvertedAppearance ( False )
128+ self . confidenceSlider . setInvertedControls ( False )
129+ self . confidenceSlider . setTickPosition ( QSlider . TicksBothSides )
130+ self . confidenceSlider . setTickInterval ( 5 )
131+ self . confidenceSlider . setObjectName ( "confidenceSlider" )
132+ confidence_layout . addWidget ( self . confidenceSlider )
133+
134+ # Add confidence value label
135+ self .confidence_value_label = QLabel ( "90" )
136+ self .confidenceSlider . valueChanged . connect ( lambda value : self . confidence_value_label . setText ( str ( value )) )
137+ confidence_layout .addWidget (self .confidence_value_label )
138+
139+ settings_layout .addLayout (confidence_layout )
127140
128141 # Debug symbols checkbox
129142 self .debug_symbols_checkbox = QCheckBox ("Limit Matches to Debug Symbols" )
@@ -136,27 +149,33 @@ def create_search_tab(self):
136149 # Action buttons
137150 button_layout = QHBoxLayout ()
138151
139- self .match_button = QPushButton ("Match Functions" )
140- self .match_button .setStyleSheet ("""
141- QPushButton {
142- background-color: #28a745;
143- color: white;
144- padding: 8px 16px;
145- border-radius: 4px;
146- font-weight: bold;
147- }
148- QPushButton:hover {
149- background-color: #218838;
150- }
151- QPushButton:disabled {
152- background-color: #6c757d;
153- }
154- """ )
155- self .match_button .clicked .connect (self .start_matching )
152+ self .fetch_results_button = QPushButton ("Fetch Results" )
153+ self .fetch_data_types_button = QPushButton ("Fetch Data Types" )
154+ self .rename_selected_button = QPushButton ("Rename Selected" )
155+
156+ for button in [self .fetch_results_button , self .fetch_data_types_button , self .rename_selected_button ]:
157+ button .setStyleSheet ("""
158+ QPushButton {
159+ background-color: #6c757d;
160+ color: white;
161+ padding: 6px 12px;
162+ border-radius: 4px;
163+ }
164+ QPushButton:hover {
165+ background-color: #5a6268;
166+ }
167+ """ )
168+
169+ self .fetch_results_button .clicked .connect (self .start_matching )
170+ self .fetch_data_types_button .clicked .connect (self .start_matching )
171+ self .rename_selected_button .clicked .connect (self .start_matching )
156172
157- button_layout .addWidget (self .match_button )
173+ button_layout .addWidget (self .fetch_results_button )
174+ button_layout .addWidget (self .fetch_data_types_button )
175+ button_layout .addWidget (self .rename_selected_button )
158176 button_layout .addStretch ()
159177
178+
160179 layout .addLayout (button_layout )
161180
162181 search_widget .setLayout (layout )
@@ -222,6 +241,17 @@ def create_results_tab(self):
222241
223242 results_widget .setLayout (layout )
224243 return results_widget
244+
245+ def _search_collections (self ):
246+ log_info ("RevEng.AI | Searching collections" )
247+ self .progress = create_progress_dialog (self , "RevEng.AI Search Collections" , "Searching collections..." )
248+ search_term = self .search_input .text ().strip ()
249+ self .search_collections_thread = SearchCollectionsThread (self .match_functions , self .bv , search_term )
250+ self .search_collections_thread .finished .connect (self ._on_search_collections_finished )
251+ self .search_collections_thread .start ()
252+
253+ self .progress .show ()
254+ QCoreApplication .processEvents ()
225255
226256 def search_collections (self ):
227257 """Search for collections based on input"""
0 commit comments