added capability to collect multiple errormessages and display them at once
This commit is contained in:
@@ -84,6 +84,11 @@ public:
|
||||
static void saveWidgetState( QWidget * _w, QDomElement & _de );
|
||||
static void restoreWidgetState( QWidget * _w, const QDomElement & _de );
|
||||
|
||||
void collectErrors( const QList<QString>* errors );
|
||||
void collectError( const QString error );
|
||||
void clearErrors();
|
||||
void showErrors( const QString reason );
|
||||
|
||||
|
||||
public slots:
|
||||
void resetWindowTitle();
|
||||
@@ -159,6 +164,7 @@ private:
|
||||
QBasicTimer m_updateTimer;
|
||||
QTimer m_autoSaveTimer;
|
||||
|
||||
QList<QString>* m_errors;
|
||||
|
||||
friend class engine;
|
||||
|
||||
|
||||
@@ -178,6 +178,8 @@ public:
|
||||
// create a view for the model
|
||||
PluginView * createView( QWidget* parent );
|
||||
|
||||
QList<QString> * getErrorReport();
|
||||
|
||||
|
||||
protected:
|
||||
// create a view for the model
|
||||
@@ -185,6 +187,9 @@ protected:
|
||||
|
||||
|
||||
private:
|
||||
QList<QString> * m_errorReport;
|
||||
void logError( QString err_msg );
|
||||
|
||||
const Descriptor* m_descriptor;
|
||||
|
||||
// pointer to instantiation-function in plugin
|
||||
|
||||
@@ -135,10 +135,7 @@ void VstEffect::openPlugin( const QString & _plugin )
|
||||
m_pluginMutex.unlock();
|
||||
closePlugin();
|
||||
delete tf;
|
||||
QMessageBox::information( NULL,
|
||||
VstPlugin::tr( "Failed loading VST plugin" ),
|
||||
VstPlugin::tr( "The VST plugin %1 could not be loaded for some reason." ).arg( _plugin ),
|
||||
QMessageBox::Ok );
|
||||
logError( VstPlugin::tr( "The VST plugin %1 could not be loaded." ) );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -62,6 +62,7 @@ Plugin::Plugin( const Descriptor * _descriptor, Model * parent ) :
|
||||
{
|
||||
m_descriptor = &dummy_plugin_descriptor;
|
||||
}
|
||||
m_errorReport = NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -124,6 +125,18 @@ Plugin * Plugin::instantiate( const QString & pluginName, Model * parent,
|
||||
return inst;
|
||||
}
|
||||
|
||||
QList<QString>* Plugin::getErrorReport()
|
||||
{
|
||||
return m_errorReport;
|
||||
}
|
||||
|
||||
void Plugin::logError( QString err_msg )
|
||||
{
|
||||
if ( m_errorReport == NULL ) {
|
||||
m_errorReport = new QList<QString>();
|
||||
}
|
||||
m_errorReport->append( err_msg );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -885,6 +885,7 @@ void song::loadProject( const QString & _file_name )
|
||||
clearProject();
|
||||
|
||||
engine::projectJournal()->setJournalling( false );
|
||||
engine::mainWindow()->clearErrors();
|
||||
|
||||
m_fileName = _file_name;
|
||||
m_oldFileName = _file_name;
|
||||
@@ -995,6 +996,8 @@ void song::loadProject( const QString & _file_name )
|
||||
|
||||
emit projectLoaded();
|
||||
|
||||
engine::mainWindow()->showErrors( tr( "The following errors occured while loading: " ) );
|
||||
|
||||
m_loadingProject = false;
|
||||
m_modified = false;
|
||||
|
||||
|
||||
@@ -189,6 +189,7 @@ MainWindow::MainWindow() :
|
||||
vbox->addWidget( w );
|
||||
setCentralWidget( main_widget );
|
||||
|
||||
m_errors = new QList<QString>();
|
||||
|
||||
m_updateTimer.start( 1000 / 20, this ); // 20 fps
|
||||
|
||||
@@ -1158,4 +1159,39 @@ void MainWindow::autoSave()
|
||||
|
||||
|
||||
|
||||
void MainWindow::collectErrors(const QList<QString>* errors )
|
||||
{
|
||||
m_errors->append( *errors );
|
||||
}
|
||||
|
||||
|
||||
|
||||
void MainWindow::collectError( const QString error )
|
||||
{
|
||||
m_errors->append( error );
|
||||
}
|
||||
|
||||
|
||||
|
||||
void MainWindow::clearErrors()
|
||||
{
|
||||
m_errors->clear();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void MainWindow::showErrors( const QString message )
|
||||
{ if ( m_errors->length() != 0 )
|
||||
{ QString* errors = new QString();
|
||||
for ( int i = 0 ; i < m_errors->length() ; i++ )
|
||||
{
|
||||
errors->append( m_errors->value( i ) + "\n" );
|
||||
}
|
||||
errors->prepend( "\n\n" );
|
||||
errors->prepend( message );
|
||||
QMessageBox::warning( NULL,
|
||||
"LMMS Error report",
|
||||
*errors,
|
||||
QMessageBox::Ok );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -821,6 +821,9 @@ Instrument * InstrumentTrack::loadInstrument( const QString & _plugin_name )
|
||||
m_instrument = Instrument::instantiate( _plugin_name, this );
|
||||
unlock();
|
||||
|
||||
if ( m_instrument->getErrorReport() != NULL )
|
||||
engine::mainWindow()->collectErrors( m_instrument->getErrorReport() );
|
||||
|
||||
setName( m_instrument->displayName() );
|
||||
emit instrumentChanged();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user