@@ -123,7 +123,90 @@ def worker_thread():
123123
124124 if not res .get ("status" , False ):
125125 log_info (f"RevEng.AI | AI Decompilation for function at 0x{ function_id :x} failed" )
126- self .update_text_signal .emit (self ._current_callback , f"AI Decompilation failed: { res .get ('errors' ).get ('message' )} " )
126+ self .update_text_signal .emit (self ._current_callback , from PySide6 .QtWidgets import QProgressDialog , QProgressBar , QPushButton
127+ from PySide6 .QtCore import Qt
128+
129+ def create_progress_dialog (parent , title , message ):
130+ progress = QProgressDialog (message , None , 0 , 0 , parent )
131+ progress .setWindowTitle (title )
132+ progress .setWindowModality (Qt .WindowModal )
133+ progress .setCancelButton (None )
134+ progress .setMinimumWidth (400 )
135+ progress .setMinimumHeight (100 )
136+
137+ progress_bar = progress .findChild (QProgressBar )
138+ if progress_bar :
139+ progress_bar .setMinimumWidth (250 )
140+ progress_bar .setMinimumHeight (20 )
141+
142+ progress .setStyleSheet ("""
143+ QProgressBar {
144+ border: 1px solid #cccccc;
145+ border-radius: 4px;
146+ text-align: center;
147+ background-color: #f0f0f0;
148+ min-width: 250px;
149+ min-height: 20px;
150+ }
151+ QProgressBar::chunk {
152+ background-color: #007bff;
153+ border-radius: 3px;
154+ }
155+ """ )
156+
157+ return progress
158+
159+ def create_cancellable_progress_dialog (parent , title , message , cancel_callback = None ):
160+ """Create a progress dialog with a cancel button that can stop threads"""
161+ progress = QProgressDialog (message , "Cancel" , 0 , 0 , parent )
162+ progress .setWindowTitle (title )
163+ progress .setWindowModality (Qt .WindowModal )
164+ progress .setMinimumWidth (400 )
165+ progress .setMinimumHeight (100 )
166+
167+ # Style the cancel button
168+ cancel_button = progress .findChild (QPushButton )
169+ if cancel_button :
170+ cancel_button .setStyleSheet ("""
171+ QPushButton {
172+ background-color: #dc3545;
173+ color: white;
174+ padding: 6px 12px;
175+ border-radius: 4px;
176+ border: none;
177+ min-width: 60px;
178+ }
179+ QPushButton:hover {
180+ background-color: #c82333;
181+ }
182+ QPushButton:pressed {
183+ background-color: #bd2130;
184+ }
185+ """ )
186+
187+ cancel_button .clicked .connect (cancel_callback )
188+
189+ progress_bar = progress .findChild (QProgressBar )
190+ if progress_bar :
191+ progress_bar .setMinimumWidth (250 )
192+ progress_bar .setMinimumHeight (20 )
193+
194+ progress .setStyleSheet ("""
195+ QProgressBar {
196+ border: 1px solid #cccccc;
197+ border-radius: 4px;
198+ text-align: center;
199+ background-color: #f0f0f0;
200+ min-width: 250px;
201+ min-height: 20px;
202+ }
203+ QProgressBar::chunk {
204+ background-color: #007bff;
205+ border-radius: 3px;
206+ }
207+ """ )
208+
209+ return progress f"AI Decompilation failed: { res .get ('errors' ).get ('message' )} " )
127210 self .stop ()
128211 return
129212
0 commit comments