added "Recently opened files"-menu, fixed several bugs & crashes, removed obsolete plugins from build

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@529 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2007-08-19 23:31:01 +00:00
parent 69dcd6bbfc
commit 4648b0e21f
21 changed files with 899 additions and 243 deletions

View File

@@ -279,8 +279,8 @@ void audioJACK::stopProcessing( void )
void audioJACK::registerPort( audioPort * _port )
{
return;
/* // make sure, port is not already registered
#ifdef AUDIO_PORT_SUPPORT
// make sure, port is not already registered
unregisterPort( _port );
const QString name[2] = { _port->name() + " L",
_port->name() + " R" } ;
@@ -296,7 +296,8 @@ void audioJACK::registerPort( audioPort * _port )
#endif
JACK_DEFAULT_AUDIO_TYPE,
JackPortIsOutput, 0 );
}*/
}
#endif
}
@@ -304,8 +305,8 @@ void audioJACK::registerPort( audioPort * _port )
void audioJACK::unregisterPort( audioPort * _port )
{
return;
/* if( m_portMap.contains( _port ) )
#ifdef AUDIO_PORT_SUPPORT
if( m_portMap.contains( _port ) )
{
for( Uint8 ch = 0; ch < DEFAULT_CHANNELS; ++ch )
{
@@ -316,7 +317,8 @@ void audioJACK::unregisterPort( audioPort * _port )
}
}
m_portMap.erase( m_portMap.find( _port ) );
}*/
}
#endif
}
@@ -324,8 +326,8 @@ void audioJACK::unregisterPort( audioPort * _port )
void audioJACK::renamePort( audioPort * _port )
{
return;
/* if( m_portMap.contains( _port ) )
#ifdef AUDIO_PORT_SUPPORT
if( m_portMap.contains( _port ) )
{
const QString name[2] = { _port->name() + " L",
_port->name() + " R" };
@@ -340,7 +342,8 @@ void audioJACK::renamePort( audioPort * _port )
#endif
) ;
}
}*/
}
#endif
}
@@ -368,12 +371,13 @@ int audioJACK::processCallback( jack_nframes_t _nframes, void * _udata )
_this->m_outputPorts[chnl], _nframes );
}
/* const Uint32 frames = tMin<Uint32>( _nframes,
getMixer()->framesPerPeriod() );
#ifdef AUDIO_PORT_SUPPORT
const Uint32 frames = tMin<Uint32>( _nframes,
_this->getMixer()->framesPerPeriod() );
for( jackPortMap::iterator it = _this->m_portMap.begin();
it != _this->m_portMap.end(); ++it )
{
for( Uint8 ch = 0; ch < DEFAULT_CHANNELS; ++ch )
for( Uint8 ch = 0; ch < _this->channels(); ++ch )
{
if( it.data().ports[ch] == NULL )
{
@@ -385,10 +389,11 @@ int audioJACK::processCallback( jack_nframes_t _nframes, void * _udata )
_nframes );
for( Uint32 frame = 0; frame < frames; ++frame )
{
buf[frame] = it.key()->firstBuffer()[ch][frame];
buf[frame] = it.key()->firstBuffer()[frame][ch];
}
}
}*/
}
#endif
jack_nframes_t done = 0;
while( done < _nframes && _this->m_stopped == FALSE )
@@ -465,7 +470,7 @@ audioJACK::setupWidget::setupWidget( QWidget * _parent ) :
audioDevice::setupWidget( audioJACK::name(), _parent )
{
QString cn = configManager::inst()->value( "audiojack", "clientname" );
if( cn == "" )
if( cn.isEmpty() )
{
cn = "lmms";
}

View File

@@ -729,6 +729,25 @@ void configManager::addPage( QWidget * _w, const QString & _title )
void configManager::addRecentlyOpenedProject( const QString & _file )
{
if( m_recentlyOpenedProjects.size() > 15 )
{
m_recentlyOpenedProjects.remove(
m_recentlyOpenedProjects.last() );
}
QStringList::iterator it;
while( ( it = m_recentlyOpenedProjects.find( _file ) ) !=
m_recentlyOpenedProjects.end() )
{
m_recentlyOpenedProjects.remove( it );
}
m_recentlyOpenedProjects.push_front( _file );
}
const QString & configManager::value( const QString & _class,
const QString & _attribute ) const
{
@@ -845,6 +864,22 @@ bool configManager::loadConfigFile( void )
}
m_settings[node.nodeName()] = attr;
}
else if( node.nodeName() == "recentfiles" )
{
m_recentlyOpenedProjects.clear();
QDomNode n = node.firstChild();
while( !n.isNull() )
{
if( n.isElement() &&
n.toElement().hasAttributes() )
{
m_recentlyOpenedProjects <<
n.toElement().
attribute( "path" );
}
n = n.nextSibling();
}
}
node = node.nextSibling();
}
@@ -965,6 +1000,17 @@ void configManager::saveConfigFile( void )
lmms_config.appendChild( n );
}
QDomElement recent_files = doc.createElement( "recentfiles" );
for( QStringList::iterator it = m_recentlyOpenedProjects.begin();
it != m_recentlyOpenedProjects.end(); ++it )
{
QDomElement n = doc.createElement( "file" );
n.setAttribute( "path", *it );
recent_files.appendChild( n );
}
lmms_config.appendChild( recent_files );
#if QT_VERSION >= 0x030100
QString xml = "<?xml version=\"1.0\"?>\n" + doc.toString( 2 );
#else

View File

@@ -27,6 +27,7 @@
#include "automation_editor.h"
#include "bb_editor.h"
#include "config_mgr.h"
#include "project_journal.h"
#include "engine.h"
#include "main_window.h"
@@ -118,6 +119,8 @@ void engine::destroy( void )
delete s_projectJournal;
s_projectJournal = NULL;
s_mainWindow = NULL;
delete configManager::inst();
}

View File

@@ -81,6 +81,7 @@
#include "tool_button.h"
#include "project_journal.h"
#include "automation_editor.h"
#include "templates.h"
#if QT_VERSION >= 0x030100
@@ -98,6 +99,7 @@ mainWindow::mainWindow( void ) :
),
m_workspace( NULL ),
m_templatesMenu( NULL ),
m_recentlyOpenedProjectsMenu( NULL ),
m_tools_menu( NULL )
{
#ifdef QT4
@@ -217,20 +219,7 @@ mainWindow::mainWindow( void ) :
mainWindow::~mainWindow()
{
/* // first make sure, there're no mixing/audio-device-threads any more
engine::getMixer()->stopProcessing();
// destroy editors with all their children
delete engine::getSongEditor();
delete engine::getBBEditor();
// destroy mixer
delete engine::getMixer();
// destroy config-manager (which automatically saves config-file)
*/
// destroy engine which will do further cleanups etc.
engine::destroy();
}
@@ -436,6 +425,10 @@ void mainWindow::finalize( void )
m_toolBarLayout->setColumnStretch( 100, 1 );
m_recentlyOpenedProjectsMenu = new QMenu( NULL );
connect( m_recentlyOpenedProjectsMenu, SIGNAL( activated( int ) ),
this, SLOT( openRecentlyOpenedProject( int ) ) );
updateRecentlyOpenedProjectsMenu();
// project-popup-menu
QMenu * project_menu = new QMenu( this );
@@ -454,6 +447,10 @@ void mainWindow::finalize( void )
this, SLOT( openProject() ),
Qt::CTRL + Qt::Key_O );
project_menu->addAction( embed::getIconPixmap( "project_open" ),
tr( "Recently opened projects" ),
m_recentlyOpenedProjectsMenu );
project_menu->addAction( embed::getIconPixmap( "project_save" ),
tr( "&Save" ),
this, SLOT( saveProject() ),
@@ -469,16 +466,11 @@ void mainWindow::finalize( void )
project_menu->insertSeparator();
#endif
project_menu->addAction( /*embed::getIconPixmap( "project_import" ),*/
tr( "Import file" ),
tr( "Import..." ),
engine::getSongEditor(),
SLOT( importProject() ) );
#ifdef QT4
project_menu->addSeparator();
#else
project_menu->insertSeparator();
#endif
project_menu->addAction( embed::getIconPixmap( "project_export" ),
tr( "E&xport" ),
tr( "E&xport..." ),
engine::getSongEditor(),
SLOT( exportProject() ),
Qt::CTRL + Qt::Key_E );
@@ -577,19 +569,6 @@ void mainWindow::finalize( void )
tr( "What's this?" ),
this, SLOT( enterWhatsThisMode() ) );
#if 0
#ifdef LADSPA_SUPPORT
#ifdef QT4
help_menu->addSeparator();
#else
help_menu->insertSeparator();
#endif
help_menu->addAction( embed::getIconPixmap( "help" ), tr( "LADSPA Plugins..." ),
this, SLOT( ladspaPluginBrowser() ) );
#endif
#endif
#ifdef QT4
help_menu->addSeparator();
#else
@@ -702,7 +681,8 @@ void mainWindow::saveWidgetState( QWidget * _w, QDomElement & _de )
void mainWindow::restoreWidgetState( QWidget * _w, const QDomElement & _de )
{
QRect r( _de.attribute( "x" ).toInt(), _de.attribute( "y" ).toInt(),
QRect r( tMax( 0, _de.attribute( "x" ).toInt() ),
tMax( 0, _de.attribute( "y" ).toInt() ),
_de.attribute( "width" ).toInt(),
_de.attribute( "height" ).toInt() );
if( !r.isNull() && _w->parentWidget() != NULL )
@@ -792,6 +772,9 @@ void mainWindow::openProject( void )
{
engine::getSongEditor()->loadProject(
ofd.selectedFiles()[0] );
configManager::inst()->addRecentlyOpenedProject(
ofd.selectedFiles()[0] );
updateRecentlyOpenedProjectsMenu();
}
}
}
@@ -799,6 +782,30 @@ void mainWindow::openProject( void )
void mainWindow::updateRecentlyOpenedProjectsMenu( void )
{
m_recentlyOpenedProjectsMenu->clear();
QStringList rup = configManager::inst()->recentlyOpenedProjects();
for( QStringList::iterator it = rup.begin(); it != rup.end(); ++it )
{
m_recentlyOpenedProjectsMenu->addAction( *it );
}
}
void mainWindow::openRecentlyOpenedProject( int _id )
{
const QString & f = m_recentlyOpenedProjectsMenu->text( _id );
engine::getSongEditor()->loadProject( f );
configManager::inst()->addRecentlyOpenedProject( f );
updateRecentlyOpenedProjectsMenu();
}
bool mainWindow::saveProject( void )
{
if( engine::getSongEditor()->projectFileName() == "" )
@@ -858,6 +865,9 @@ bool mainWindow::saveProjectAs( void )
#else
engine::getSongEditor()->saveProjectAs( sfd.selectedFile() );
#endif
configManager::inst()->addRecentlyOpenedProject(
sfd.selectedFiles()[0] );
updateRecentlyOpenedProjectsMenu();
return( TRUE );
}
return( FALSE );
@@ -896,19 +906,6 @@ void mainWindow::help( void )
#if 0
void mainWindow::ladspaPluginBrowser( void )
{
// moc for Qt 3.x doesn't recognize preprocessor directives,
// so we can't just block the whole thing out.
#ifdef LADSPA_SUPPORT
ladspaBrowser lb;
lb.exec();
#endif
}
#endif
void mainWindow::toggleBBEditorWin( void )
{
@@ -1167,8 +1164,8 @@ void mainWindow::browseHelp( void )
}
else if( pid == 0 )
{
QString url = "http://wiki.mindrules.net/doku.php?id="
+ tr( "start", "doku.php id" );
// TODO: use QDesktopService with Qt4
QString url = "http://lmms.sf.net/wiki/index.php?title=Main_Page";
execlp( "x-www-browser", "x-www-browser", url.
#ifdef QT4
toAscii().constData(),

View File

@@ -288,7 +288,7 @@ const surroundSampleFrame * mixer::renderNextBuffer( void )
// clear last audio-buffer
clearAudioBuffer( m_writeBuf, m_framesPerPeriod );
printf("---------------------------next period\n");
//printf("---------------------------next period\n");
// if( criticalXRuns() == FALSE )
{
engine::getSongEditor()->processNextBuffer();
@@ -745,7 +745,7 @@ void mixer::processBuffer( const surroundSampleFrame * _buf,
for( ch_cnt_t chnl = 0; chnl < m_audioDev->channels(); ++chnl )
{
m_writeBuf[frame][chnl] += _buf[frame][chnl];
if( m_scaleClip )
{
scaleClip( frame, chnl );

View File

@@ -68,7 +68,6 @@ journallingObject::~journallingObject()
void journallingObject::undo( void )
{
printf("undo: %d\n", id() );
if( m_journalEntries.empty() == TRUE )
{
return;
@@ -85,7 +84,6 @@ void journallingObject::undo( void )
void journallingObject::redo( void )
{
printf("undo: %d\n", id() );
if( m_journalEntries.empty() == TRUE )
{
return;

View File

@@ -537,7 +537,7 @@ void multimediaProject::upgrade( void )
{
el.setAttribute( "chord-enabled", TRUE );
el.setAttribute( "arp-enabled",
el.attribute( "arpdir" ).toInt() != 0 );
el.attribute( "arpdir" ).toInt() != 0 );
}
}
@@ -594,6 +594,24 @@ void multimediaProject::upgrade( void )
}
}
if( version < "0.3.0" )
{
QDomNodeList list = elementsByTagName( "pluckedstringsynth" );
for( int i = 0; !list.item( i ).isNull(); ++i )
{
QDomElement el = list.item( i ).toElement();
el.setTagName( "vibedstrings" );
el.setAttribute( "active0", 1 );
}
list = elementsByTagName( "lb303" );
for( int i = 0; !list.item( i ).isNull(); ++i )
{
QDomElement el = list.item( i ).toElement();
el.setTagName( "lb302" );
}
}
if( !m_head.hasAttribute( "mastervol" ) )
{
m_head.setAttribute( "mastervol", 100 );

View File

@@ -103,7 +103,6 @@ void projectJournal::journalEntryAdded( const jo_id_t _id )
m_journalEntries.push_back( _id );
m_currentJournalEntry = m_journalEntries.end();
engine::getSongEditor()->setModified();
printf("history size: %d\n", m_journalEntries.size() );
}

View File

@@ -411,13 +411,13 @@ void knob::dropEvent( QDropEvent * _de )
QString val = stringPairDrag::decodeValue( _de );
if( type == "float_value" )
{
printf("set val\n");
//printf("set val\n");
setValue( val.toFloat() );
_de->accept();
}
else if( type == "link_object" )
{
printf("link!\n");
//printf("link!\n");
knob * obj = (knob *)( val.toULong() );
linkObjects( this, obj );
obj->setValue( value() );