@@ -273,14 +273,55 @@ void GUI_Main::dropEvent(QDropEvent *Event)
273273 for (size_t Pos=0 ; Pos<Cores.size (); Pos++)
274274 C->Menu_File_Import_Core (Cores[Pos].To_UTF8 ());
275275 C->StdOut (" Importing Core file, finished" );
276- // Showing
277- if (C->Text_stderr_Updated_Get ())
276+
277+ // Showing errors
278+ string Errors=C->Text_stderr_Last_Get ();
279+ if (!Errors.empty ())
278280 {
279- Menu_View_Output_stderr->setChecked (true );
280- View_Refresh (View_Output_stderr);
281+ QDialog ErrorDialog (this );
282+ ErrorDialog.setWindowTitle (" BWF MetaEdit" );
283+ ErrorDialog.setWindowIcon (QIcon (" :/Image/Logo/Logo.png" ));
284+ ErrorDialog.setModal (true );
285+
286+ // Calculate maximum width based on screen size
287+ QScreen* Screen=QApplication::screenAt (mapToGlobal (QPoint (0 , 0 )));
288+ int MaxWidth=Screen?(Screen->availableGeometry ().width ()*2 /3 ):800 ; // Default to 800 if no screen
289+ int MaxHeight=Screen?(Screen->availableGeometry ().height ()*2 /4 ):600 ; // Default to 600 if no screen
290+
291+ QVBoxLayout* Layout=new QVBoxLayout (&ErrorDialog);
292+
293+ // Message
294+ QString Message=QString (" The following error(s) have occurred during the import operation:" );
295+ QLabel *MessageLabel=new QLabel (Message, &ErrorDialog);
296+ Layout->addWidget (MessageLabel);
297+
298+ // Error text
299+ QTextEdit *ErrorTextEdit = new QTextEdit (&ErrorDialog);
300+ ErrorTextEdit->setReadOnly (true );
301+ ErrorTextEdit->setFontFamily (" Monospace" );
302+ ErrorTextEdit->setLineWrapMode (QTextEdit::NoWrap);
303+ ErrorTextEdit->setPlainText (QString::fromStdString (Errors));
304+ Layout->addWidget (ErrorTextEdit);
305+
306+ // Close button
307+ QHBoxLayout* ButtonLayout=new QHBoxLayout;
308+ ButtonLayout->addStretch (1 );
309+ QPushButton *CloseButton=new QPushButton (" &Close" , &ErrorDialog);
310+ QObject::connect (CloseButton, &QPushButton::clicked, &ErrorDialog, &QDialog::close);
311+ ButtonLayout->addWidget (CloseButton);
312+ Layout->addLayout (ButtonLayout);
313+
314+ // Size dialog
315+ QFontMetrics FontMetrics (ErrorTextEdit->font ());
316+ QRect BoundingRect = FontMetrics.boundingRect (QString ().fromStdString (C->Text_stderr .str ()));
317+ int Width=min (MaxWidth, BoundingRect.width ()+150 );
318+ int Height=min (MaxHeight, BoundingRect.height ()+150 ); // Add some padding and space for buttons
319+ ErrorDialog.resize (Width, Height);
320+
321+ ErrorDialog.exec ();
281322 }
282- else
283- View_Refresh ();
323+
324+ View_Refresh ();
284325 }
285326
286327 if (Files.size ())
0 commit comments