From 9c3fa640ae90b2c657a45c7d5d8c4f919cf5292d Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Mon, 30 Jun 2008 19:57:42 +0000 Subject: [PATCH] ask whether to create working-directory if it does not exist git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1241 0778d3d1-df1d-0410-868b-ea421aaaa00d --- ChangeLog | 3 ++ src/core/config_mgr.cpp | 76 ++++++++++++----------------------------- 2 files changed, 25 insertions(+), 54 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5eaf35eea..1fa8725e7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2008-06-30 Tobias Doerffel + * src/core/config_mgr.cpp: + ask whether to create working-directory if it does not exist + * src/core/fx_mixer.cpp: reset mute-model in fxMixer::clear() diff --git a/src/core/config_mgr.cpp b/src/core/config_mgr.cpp index 94a03130b..41cc4cd9d 100644 --- a/src/core/config_mgr.cpp +++ b/src/core/config_mgr.cpp @@ -75,20 +75,6 @@ configManager::~configManager() -/*void configManager::openWorkingDir( void ) -{ - QString new_dir = QFileDialog::getExistingDirectory( this, - tr( "Choose LMMS working directory" ), - m_workingDir ); - if( new_dir != QString::null ) - { - m_wdLineEdit->setText( new_dir ); - } -}*/ - - - - void configManager::setWorkingDir( const QString & _wd ) { m_workingDir = _wd; @@ -138,43 +124,6 @@ void configManager::setSTKDir( const QString & _fd ) -/* -void configManager::accept( void ) -{ - if( m_workingDir.right( 1 ) != "/" ) - { - m_workingDir += '/'; - } - if( !QDir( m_workingDir ).exists() ) - { - if( QMessageBox::question - ( 0, tr( "Directory not existing" ), - tr( "The directory you " - "specified does not " - "exist. Create it?" ), - QMessageBox::Yes, QMessageBox::No ) - == QMessageBox::Yes ) - { - QDir().mkpath( m_workingDir ); - } - else - { - switchPage( m_pageWorkingDir ); - return; - } - } - - QDir().mkpath( userProjectsDir() ); - QDir().mkpath( userSamplesDir() ); - QDir().mkpath( userPresetsDir() ); - - saveConfigFile(); - - QDialog::accept(); -} -*/ - - void configManager::addRecentlyOpenedProject( const QString & _file ) { @@ -334,14 +283,33 @@ bool configManager::loadConfigFile( void ) #ifdef LMMS_LMMS_HAVE_STK_H if( m_stkDir == "" ) -{ - m_stkDir = "/usr/share/stk/rawwaves/"; -} + { + m_stkDir = "/usr/share/stk/rawwaves/"; + } #endif QDir::setSearchPaths( "resources", QStringList() << artworkDir() << defaultArtworkDir() ); + if( !QDir( m_workingDir ).exists() ) + { + if( QMessageBox::question( 0, + mainWindow::tr( "Working directory" ), + mainWindow::tr( "The LMMS working directory %1 does not " + "exist. Create it now? You can change the directory " + "later via Edit -> Settings." ).arg( m_workingDir ), + QMessageBox::Yes, QMessageBox::No ) == + QMessageBox::Yes ) + { + QDir().mkpath( m_workingDir ); + } + } + if( QDir( m_workingDir ).exists() ) + { + QDir().mkpath( userProjectsDir() ); + QDir().mkpath( userSamplesDir() ); + QDir().mkpath( userPresetsDir() ); + } return( TRUE ); }