VeSTige opens correct folder (#3550)

Open correct VST folder in previously saved projects with existing VeSTige instruments.
This commit is contained in:
Karmo Rosental
2017-05-31 21:55:22 +03:00
committed by Tres Finocchiaro
parent afd22c8b74
commit 635b50bfb5
3 changed files with 11 additions and 30 deletions

View File

@@ -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 );

View File

@@ -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 );

View File

@@ -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"
@@ -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 )
@@ -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..." ),
@@ -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;
}
@@ -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 )