diff --git a/include/MainWindow.h b/include/MainWindow.h index dd4b96db6..c9fa39047 100644 --- a/include/MainWindow.h +++ b/include/MainWindow.h @@ -95,6 +95,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(); @@ -170,6 +175,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 f5c1ab046..86ba6db9d 100644 --- a/include/Plugin.h +++ b/include/Plugin.h @@ -184,6 +184,7 @@ public: protected: // create a view for the model virtual PluginView* instantiateView( QWidget* ) = 0; + void collectErrorForUI( QString err_msg ); private: diff --git a/plugins/VstEffect/VstEffect.cpp b/plugins/VstEffect/VstEffect.cpp index 718f78e00..420afb1f9 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 ); + collectErrorForUI( VstPlugin::tr( "The VST plugin %1 could not be loaded." ).arg( _plugin ) ); return; } diff --git a/plugins/sf2_player/sf2_player.cpp b/plugins/sf2_player/sf2_player.cpp index b6aefc123..bf47116f9 100644 --- a/plugins/sf2_player/sf2_player.cpp +++ b/plugins/sf2_player/sf2_player.cpp @@ -335,7 +335,8 @@ void sf2Instrument::openFile( const QString & _sf2File, bool updateTrackName ) } else { - // TODO: Couldn't load file! + collectErrorForUI( sf2Instrument::tr( "A soundfont %1 could not be loaded." ).arg( QFileInfo( _sf2File ).baseName() ) ); + // TODO: Why is the filename missing when the file does not exist? } } @@ -357,7 +358,7 @@ void sf2Instrument::openFile( const QString & _sf2File, bool updateTrackName ) if( updateTrackName || instrumentTrack()->displayName() == displayName() ) { - instrumentTrack()->setName( QFileInfo( _sf2File ).baseName() ); + instrumentTrack()->setName( QFileInfo( _sf2File ).baseName() ); } } diff --git a/plugins/vestige/vestige.cpp b/plugins/vestige/vestige.cpp index 7a165d6ac..c6c23663b 100644 --- a/plugins/vestige/vestige.cpp +++ b/plugins/vestige/vestige.cpp @@ -262,15 +262,7 @@ void vestigeInstrument::loadFile( const QString & _file ) m_pluginMutex.unlock(); closePlugin(); delete tf; - QMessageBox::information( 0, - tr( "Failed loading VST-plugin" ), - tr( "The VST-plugin %1 could not " - "be loaded for some reason.\n" - "If it runs with other VST-" - "software under Linux, please " - "contact an LMMS-developer!" - ).arg( m_pluginDLL ), - QMessageBox::Ok ); + collectErrorForUI( VstPlugin::tr( "The VST plugin %1 could not be loaded." ).arg( m_pluginDLL ) ); return; } diff --git a/src/core/Plugin.cpp b/src/core/Plugin.cpp index 2894cc412..cc992e40a 100644 --- a/src/core/Plugin.cpp +++ b/src/core/Plugin.cpp @@ -34,6 +34,7 @@ #include "ConfigManager.h" #include "DummyPlugin.h" #include "AutomatableModel.h" +#include "MainWindow.h" static PixmapLoader __dummy_loader; @@ -124,6 +125,10 @@ Plugin * Plugin::instantiate( const QString & pluginName, Model * parent, return inst; } +void Plugin::collectErrorForUI( QString err_msg ) +{ + engine::mainWindow()->collectError( err_msg ); +} diff --git a/src/core/song.cpp b/src/core/song.cpp index fb9a52f7f..55bd22db0 100644 --- a/src/core/song.cpp +++ b/src/core/song.cpp @@ -883,6 +883,7 @@ void song::loadProject( const QString & _file_name ) m_loadingProject = true; engine::projectJournal()->setJournalling( false ); + engine::mainWindow()->clearErrors(); m_fileName = _file_name; m_oldFileName = _file_name; @@ -994,6 +995,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 ec266e55d..acee0c78b 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 @@ -345,7 +346,7 @@ void MainWindow::finalize() help_menu->addSeparator(); help_menu->addAction( embed::getIconPixmap( "icon" ), tr( "About" ), - this, SLOT( aboutLMMS() ) ); + this, SLOT( aboutLMMS() ) ); // create tool-buttons toolButton * project_new = new toolButton( @@ -1159,4 +1160,40 @@ 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 718fbaefc..f74b4d947 100644 --- a/src/tracks/InstrumentTrack.cpp +++ b/src/tracks/InstrumentTrack.cpp @@ -122,7 +122,7 @@ InstrumentTrack::InstrumentTrack( TrackContainer* tc ) : connect( &m_pitchModel, SIGNAL( dataChanged() ), this, SLOT( updatePitch() ) ); connect( &m_pitchRangeModel, SIGNAL( dataChanged() ), this, SLOT( updatePitchRange() ) ); - m_effectChannelModel.setRange( 0, engine::fxMixer()->numChannels()-1, 1); + m_effectChannelModel.setRange( 0, engine::fxMixer()->numChannels()-1, 1); for( int i = 0; i < NumKeys; ++i ) { @@ -312,11 +312,11 @@ void InstrumentTrack::processInEvent( const MidiEvent& event, const MidiTime& ti } } if( event.controllerNumber() == MidiControllerAllSoundOff || - event.controllerNumber() == MidiControllerAllNotesOff || - event.controllerNumber() == MidiControllerOmniOn || - event.controllerNumber() == MidiControllerOmniOff || - event.controllerNumber() == MidiControllerMonoOn || - event.controllerNumber() == MidiControllerPolyOn ) + event.controllerNumber() == MidiControllerAllNotesOff || + event.controllerNumber() == MidiControllerOmniOn || + event.controllerNumber() == MidiControllerOmniOff || + event.controllerNumber() == MidiControllerMonoOn || + event.controllerNumber() == MidiControllerPolyOn ) { silenceAllNotes(); } @@ -795,8 +795,8 @@ Instrument * InstrumentTrack::loadInstrument( const QString & _plugin_name ) delete m_instrument; m_instrument = Instrument::instantiate( _plugin_name, this ); unlock(); - setName( m_instrument->displayName() ); + emit instrumentChanged(); return m_instrument;