Skip to content

Commit

Permalink
VeSTige opens correct folder (LMMS#3550)
Browse files Browse the repository at this point in the history
Open correct VST folder in previously saved projects with existing VeSTige instruments.
  • Loading branch information
karmux authored and tresf committed May 31, 2017
1 parent d0f4db0 commit d53cf24
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 30 deletions.
1 change: 0 additions & 1 deletion plugins/GigPlayer/GigPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1066,7 +1066,6 @@ void GigInstrumentView::showFileDialog()
types << tr( "GIG Files (*.gig)" );
ofd.setNameFilters( types );

QString dir;
if( k->m_filename != "" )
{
QString f = SampleBuffer::tryToMakeAbsolute( k->m_filename );
Expand Down
1 change: 0 additions & 1 deletion plugins/sf2_player/sf2_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1080,7 +1080,6 @@ void sf2InstrumentView::showFileDialog()
types << tr( "SoundFont2 Files (*.sf2)" );
ofd.setNameFilters( types );

QString dir;
if( k->m_filename != "" )
{
QString f = SampleBuffer::tryToMakeAbsolute( k->m_filename );
Expand Down
39 changes: 11 additions & 28 deletions plugins/vestige/vestige.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#include "Mixer.h"
#include "GuiApplication.h"
#include "PixmapButton.h"
#include "SampleBuffer.h"
#include "StringPairDrag.h"
#include "TextFloat.h"
#include "ToolTip.h"
Expand Down Expand Up @@ -173,17 +174,6 @@ void vestigeInstrument::setParameter( void )

void vestigeInstrument::saveSettings( QDomDocument & _doc, QDomElement & _this )
{
if( QFileInfo( m_pluginDLL ).isAbsolute() )
{
QString f = QString( m_pluginDLL ).replace( QDir::separator(), '/' );
QString vd = QString( ConfigManager::inst()->vstDir() ).replace( QDir::separator(), '/' );
QString relativePath;
if( !( relativePath = f.section( vd, 1, 1 ) ).isEmpty() )
{
m_pluginDLL = relativePath;
}
}

_this.setAttribute( "plugin", m_pluginDLL );
m_pluginMutex.lock();
if( m_plugin != NULL )
Expand Down Expand Up @@ -253,8 +243,7 @@ void vestigeInstrument::loadFile( const QString & _file )
{
closePlugin();
}

m_pluginDLL = _file;
m_pluginDLL = SampleBuffer::tryToMakeRelative( _file );
TextFloat * tf = TextFloat::displayMessage(
tr( "Loading plugin" ),
tr( "Please wait while loading VST-plugin..." ),
Expand All @@ -268,6 +257,7 @@ void vestigeInstrument::loadFile( const QString & _file )
closePlugin();
delete tf;
collectErrorForUI( VstPlugin::tr( "The VST plugin %1 could not be loaded." ).arg( m_pluginDLL ) );
m_pluginDLL = "";
return;
}

Expand Down Expand Up @@ -613,29 +603,22 @@ void VestigeInstrumentView::openPlugin()
{
FileDialog ofd( NULL, tr( "Open VST-plugin" ) );

QString dir;
if( m_vi->m_pluginDLL != "" )
{
dir = QFileInfo( m_vi->m_pluginDLL ).absolutePath();
}
else
{
dir = ConfigManager::inst()->vstDir();
}
// change dir to position of previously opened file
ofd.setDirectory( dir );
ofd.setFileMode( FileDialog::ExistingFiles );

// set filters
QStringList types;
types << tr( "DLL-files (*.dll)" )
<< tr( "EXE-files (*.exe)" )
;
ofd.setNameFilters( types );

if( m_vi->m_pluginDLL != "" )
{
// select previously opened file
ofd.selectFile( QFileInfo( m_vi->m_pluginDLL ).fileName() );
QString f = SampleBuffer::tryToMakeAbsolute( m_vi->m_pluginDLL );
ofd.setDirectory( QFileInfo( f ).absolutePath() );
ofd.selectFile( QFileInfo( f ).fileName() );
}
else
{
ofd.setDirectory( ConfigManager::inst()->vstDir() );
}

if ( ofd.exec () == QDialog::Accepted )
Expand Down

0 comments on commit d53cf24

Please sign in to comment.