diff --git a/include/MainWindow.h b/include/MainWindow.h index 8a92fa5f1..a6cd74623 100644 --- a/include/MainWindow.h +++ b/include/MainWindow.h @@ -84,6 +84,11 @@ public: static void saveWidgetState( QWidget * _w, QDomElement & _de ); static void restoreWidgetState( QWidget * _w, const QDomElement & _de ); + void collectErrors( const QList* 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* m_errors; friend class engine; diff --git a/include/Plugin.h b/include/Plugin.h index 7c937dc8c..41ccd8706 100644 --- a/include/Plugin.h +++ b/include/Plugin.h @@ -178,6 +178,8 @@ public: // create a view for the model PluginView * createView( QWidget* parent ); + QList * getErrorReport(); + protected: // create a view for the model @@ -185,6 +187,9 @@ protected: private: + QList * m_errorReport; + void logError( QString err_msg ); + const Descriptor* m_descriptor; // pointer to instantiation-function in plugin diff --git a/plugins/VstEffect/VstEffect.cpp b/plugins/VstEffect/VstEffect.cpp index 8817ffb95..d17ae07d2 100644 --- a/plugins/VstEffect/VstEffect.cpp +++ b/plugins/VstEffect/VstEffect.cpp @@ -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; } diff --git a/src/core/Plugin.cpp b/src/core/Plugin.cpp index 02d725f03..491526449 100644 --- a/src/core/Plugin.cpp +++ b/src/core/Plugin.cpp @@ -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* Plugin::getErrorReport() +{ + return m_errorReport; +} + +void Plugin::logError( QString err_msg ) +{ + if ( m_errorReport == NULL ) { + m_errorReport = new QList(); + } + m_errorReport->append( err_msg ); +} diff --git a/src/core/song.cpp b/src/core/song.cpp index cfaecc285..a546c836b 100644 --- a/src/core/song.cpp +++ b/src/core/song.cpp @@ -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; diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index 3d1b707fc..b37820f20 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -189,6 +189,7 @@ MainWindow::MainWindow() : vbox->addWidget( w ); setCentralWidget( main_widget ); + m_errors = new QList(); m_updateTimer.start( 1000 / 20, this ); // 20 fps @@ -1158,4 +1159,39 @@ void MainWindow::autoSave() +void MainWindow::collectErrors(const QList* 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 ); + } +} diff --git a/src/tracks/InstrumentTrack.cpp b/src/tracks/InstrumentTrack.cpp index 37479f9ca..6060ec0cf 100644 --- a/src/tracks/InstrumentTrack.cpp +++ b/src/tracks/InstrumentTrack.cpp @@ -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();