dynamic tempo, online help, filter directories
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@469 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
* file_browser.cpp - implementation of the project-, preset- and
|
||||
* sample-file-browser
|
||||
*
|
||||
* Copyright (c) 2004-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -160,7 +160,7 @@ void fileBrowser::reloadTree( void )
|
||||
void fileBrowser::addItems( const QString & _path )
|
||||
{
|
||||
QDir cdir( _path );
|
||||
QStringList files = cdir.entryList( QDir::NoFilter, QDir::Name );
|
||||
QStringList files = cdir.entryList( QDir::Files, QDir::Name );
|
||||
|
||||
// TODO: after dropping qt3-support we can use QStringList's iterator
|
||||
// which makes it possible to travel through the list in reverse
|
||||
@@ -169,9 +169,7 @@ void fileBrowser::addItems( const QString & _path )
|
||||
for( csize i = 0; i < files.size(); ++i )
|
||||
{
|
||||
QString cur_file = files[files.size() - i - 1];
|
||||
if( cur_file[0] != '.' &&
|
||||
QFileInfo( _path + QDir::separator() +
|
||||
cur_file ).isDir() == FALSE
|
||||
if( cur_file[0] != '.'
|
||||
#ifdef QT4
|
||||
// TBD
|
||||
#else
|
||||
@@ -185,12 +183,13 @@ void fileBrowser::addItems( const QString & _path )
|
||||
}
|
||||
}
|
||||
|
||||
files = cdir.entryList( QDir::Dirs, QDir::Name );
|
||||
for( csize i = 0; i < files.size(); ++i )
|
||||
{
|
||||
QString cur_file = files[files.size() - i - 1];
|
||||
if( cur_file[0] != '.' &&
|
||||
QFileInfo( _path + QDir::separator() +
|
||||
cur_file ).isDir() )
|
||||
isDirWithContent( _path + QDir::separator() + cur_file,
|
||||
m_filter ) )
|
||||
{
|
||||
QListViewItem * item = m_l->findItem( cur_file, 0 );
|
||||
if( item == NULL )
|
||||
@@ -210,6 +209,44 @@ void fileBrowser::addItems( const QString & _path )
|
||||
|
||||
|
||||
|
||||
bool fileBrowser::isDirWithContent( const QString & _path,
|
||||
const QString & _filter )
|
||||
{
|
||||
QDir cdir( _path );
|
||||
QStringList files = cdir.entryList( QDir::Files, QDir::Unsorted );
|
||||
for( QStringList::iterator it = files.begin(); it != files.end(); ++it )
|
||||
{
|
||||
QString cur_file = *it;
|
||||
if( cur_file[0] != '.'
|
||||
#ifdef QT4
|
||||
// TBD
|
||||
#else
|
||||
&& QDir::match( _filter, cur_file.lower() )
|
||||
#endif
|
||||
)
|
||||
{
|
||||
return( TRUE );
|
||||
}
|
||||
}
|
||||
|
||||
files = cdir.entryList( QDir::Dirs, QDir::Unsorted );
|
||||
for( QStringList::iterator it = files.begin(); it != files.end(); ++it )
|
||||
{
|
||||
QString cur_file = *it;
|
||||
if( cur_file[0] != '.' &&
|
||||
isDirWithContent( _path + QDir::separator() + cur_file,
|
||||
_filter ) )
|
||||
{
|
||||
return( TRUE );
|
||||
}
|
||||
}
|
||||
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void fileBrowser::keyPressEvent( QKeyEvent * _ke )
|
||||
{
|
||||
if( _ke->key() == Qt::Key_F5 )
|
||||
@@ -740,41 +777,34 @@ bool directory::addItems( const QString & _path )
|
||||
|
||||
bool added_something = FALSE;
|
||||
|
||||
QStringList files = thisDir.entryList( QDir::NoFilter, QDir::Name );
|
||||
QStringList files = thisDir.entryList( QDir::Files, QDir::Name );
|
||||
for( csize i = 0; i < files.size(); ++i )
|
||||
{
|
||||
QString cur_file = files[files.size() - i - 1];
|
||||
if( cur_file[0] != '.'
|
||||
#ifdef QT4
|
||||
if( cur_file[0] != '.' && !QFileInfo(
|
||||
thisDir.absolutePath() + QDir::separator() +
|
||||
cur_file ).isDir() &&
|
||||
thisDir.match( m_filter, cur_file.toLower() )
|
||||
/*QDir::match( FILE_FILTER, cur_file )*/ )
|
||||
&& thisDir.match( m_filter, cur_file.toLower() )
|
||||
#else
|
||||
if( cur_file[0] != '.' && !QFileInfo(
|
||||
thisDir.absPath() + QDir::separator() +
|
||||
cur_file ).isDir() &&
|
||||
thisDir.match( m_filter, cur_file.lower() )
|
||||
/*QDir::match( FILE_FILTER, cur_file )*/ )
|
||||
&& thisDir.match( m_filter, cur_file.lower() )
|
||||
#endif
|
||||
/*QDir::match( FILE_FILTER, cur_file )*/ )
|
||||
{
|
||||
(void) new fileItem( this, cur_file, _path );
|
||||
added_something = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
files = thisDir.entryList( QDir::Dirs, QDir::Name );
|
||||
for( csize i = 0; i < files.size(); ++i )
|
||||
{
|
||||
QString cur_file = files[files.size() - i - 1];
|
||||
if( cur_file[0] != '.' && fileBrowser::isDirWithContent(
|
||||
#ifdef QT4
|
||||
if( cur_file[0] != '.' && QFileInfo(
|
||||
thisDir.absolutePath() + QDir::separator() +
|
||||
cur_file ).isDir() )
|
||||
#else
|
||||
if( cur_file[0] != '.' && QFileInfo(
|
||||
thisDir.absPath() + QDir::separator() +
|
||||
cur_file ).isDir() )
|
||||
#endif
|
||||
cur_file, m_filter ) )
|
||||
{
|
||||
new directory( this, cur_file, _path, m_filter );
|
||||
added_something = TRUE;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* main.cpp - just main.cpp which is starting up app...
|
||||
*
|
||||
* Copyright (c) 2004-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -101,7 +101,7 @@ int main( int argc, char * * argv )
|
||||
QString( app.argv()[i] ) == "-v" )
|
||||
{
|
||||
printf( "\nLinux MultiMedia Studio %s\n\n"
|
||||
"Copyright (c) 2004-2006 Tobias Doerffel and others.\n\n"
|
||||
"Copyright (c) 2004-2007 Tobias Doerffel and others.\n\n"
|
||||
"This program is free software; you can redistribute it and/or\n"
|
||||
"modify it under the terms of the GNU General Public\n"
|
||||
"License as published by the Free Software Foundation; either\n"
|
||||
@@ -115,7 +115,7 @@ int main( int argc, char * * argv )
|
||||
QString( app.argv()[i] ) == "-h" ) )
|
||||
{
|
||||
printf( "\nLinux MultiMedia Studio %s\n"
|
||||
"Copyright (c) 2004-2006 Tobias Doerffel and others.\n\n"
|
||||
"Copyright (c) 2004-2007 Tobias Doerffel and others.\n\n"
|
||||
"usage: lmms [ -r <file_to_render> [ -o <format> ] [ -h ] "
|
||||
"[ <file_to_load> ]\n"
|
||||
"-r, --render render given file.\n"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* main_window.cpp - implementation of LMMS-main-window
|
||||
*
|
||||
* Copyright (c) 2004-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -550,8 +550,18 @@ void mainWindow::finalize( void )
|
||||
#else
|
||||
menuBar()->insertItem( tr( "&Help" ), help_menu );
|
||||
#endif
|
||||
help_menu->addAction( embed::getIconPixmap( "help" ), tr( "Help" ),
|
||||
if( have_www_browser() )
|
||||
{
|
||||
help_menu->addAction( embed::getIconPixmap( "help" ),
|
||||
tr( "Online help" ),
|
||||
this, SLOT( browseHelp() ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
help_menu->addAction( embed::getIconPixmap( "help" ),
|
||||
tr( "Help" ),
|
||||
this, SLOT( help() ) );
|
||||
}
|
||||
help_menu->addAction( embed::getIconPixmap( "whatsthis" ),
|
||||
tr( "What's this?" ),
|
||||
this, SLOT( enterWhatsThisMode() ) );
|
||||
@@ -1089,6 +1099,41 @@ void mainWindow::showTool( int _idx )
|
||||
|
||||
|
||||
|
||||
bool mainWindow::have_www_browser( void )
|
||||
{
|
||||
int ret = system( "which x-www-browser > /dev/null" );
|
||||
return( WIFEXITED( ret ) && WEXITSTATUS( ret ) == EXIT_SUCCESS );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void mainWindow::browseHelp( void )
|
||||
{
|
||||
pid_t pid = fork();
|
||||
if( pid == -1 )
|
||||
{
|
||||
perror( "fork" );
|
||||
}
|
||||
else if( pid == 0 )
|
||||
{
|
||||
QString url = "http://wiki.mindrules.net/doku.php?id="
|
||||
+ tr( "start", "doku.php id" );
|
||||
execlp( "x-www-browser", "x-www-browser", url.
|
||||
#ifdef QT4
|
||||
toAscii().constData(),
|
||||
#else
|
||||
ascii(),
|
||||
#endif
|
||||
NULL );
|
||||
perror( "execlp" );
|
||||
exit( EXIT_FAILURE );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef QT4
|
||||
#undef addSeparator
|
||||
#endif
|
||||
|
||||
@@ -58,10 +58,11 @@ notePlayHandle::notePlayHandle( instrumentTrack * _it,
|
||||
m_baseNote( TRUE ),
|
||||
m_arpNote( _arp_note ),
|
||||
m_muted( FALSE ),
|
||||
m_bbTrack( NULL )
|
||||
m_bbTrack( NULL ),
|
||||
#if SINGERBOT_SUPPORT
|
||||
, m_patternIndex( 0 )
|
||||
m_patternIndex( 0 ),
|
||||
#endif
|
||||
m_orig_bpm( _it->eng()->getSongEditor()->getTempo() )
|
||||
{
|
||||
setDetuning( _n.detuning() );
|
||||
if( detuning() )
|
||||
@@ -320,6 +321,7 @@ void notePlayHandle::setFrames( const f_cnt_t _frames )
|
||||
{
|
||||
m_frames = m_instrumentTrack->beatLen( this );
|
||||
}
|
||||
m_orig_frames = m_frames;
|
||||
}
|
||||
|
||||
|
||||
@@ -437,6 +439,23 @@ void notePlayHandle::processMidiTime( const midiTime & _time )
|
||||
|
||||
|
||||
|
||||
void notePlayHandle::resize( const bpm_t _new_bpm )
|
||||
{
|
||||
double completed = m_totalFramesPlayed / (double)m_frames;
|
||||
double new_frames = m_orig_frames * m_orig_bpm / (double)_new_bpm;
|
||||
m_frames = (f_cnt_t)new_frames;
|
||||
m_totalFramesPlayed = (f_cnt_t)( completed * new_frames );
|
||||
|
||||
for( notePlayHandleVector::iterator it = m_subNotes.begin();
|
||||
it != m_subNotes.end(); ++it )
|
||||
{
|
||||
( *it )->resize( _new_bpm );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#include "note_play_handle.moc"
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* song_editor.cpp - basic window for editing song
|
||||
*
|
||||
* Copyright (c) 2004-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -79,6 +79,7 @@
|
||||
#include "instrument_track.h"
|
||||
#include "mmp.h"
|
||||
#include "midi_client.h"
|
||||
#include "note_play_handle.h"
|
||||
#include "timeline.h"
|
||||
#include "pattern.h"
|
||||
#include "piano_roll.h"
|
||||
@@ -755,6 +756,17 @@ void songEditor::zoomingChanged( const QString & _zfac )
|
||||
|
||||
void songEditor::setTempo( int _new_bpm )
|
||||
{
|
||||
playHandleVector & phv = eng()->getMixer()->playHandles();
|
||||
for( playHandleVector::iterator it = phv.begin(); it != phv.end();
|
||||
++it )
|
||||
{
|
||||
notePlayHandle * nph = dynamic_cast<notePlayHandle *>( *it );
|
||||
if( nph && !nph->released() )
|
||||
{
|
||||
nph->resize( _new_bpm );
|
||||
}
|
||||
}
|
||||
|
||||
m_bpmSpinBox->setInitValue( _new_bpm );
|
||||
eng()->updateFramesPerTact64th();
|
||||
emit tempoChanged( _new_bpm );
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* This file is partly based on the knob-widget of the Qwt Widget Library by
|
||||
* Josef Wilgen.
|
||||
*
|
||||
* Copyright (c) 2004-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -95,12 +95,12 @@ knob::knob( int _knob_num, QWidget * _parent, const QString & _name,
|
||||
autoObj( _engine, _track ),
|
||||
m_mouseOffset( 0.0f ),
|
||||
m_buttonPressed( FALSE ),
|
||||
m_angle( 0.0f ),
|
||||
m_knobNum( _knob_num ),
|
||||
m_hintTextBeforeValue( "" ),
|
||||
m_hintTextAfterValue( "" ),
|
||||
m_label( "" ),
|
||||
m_initValue( 0.0f )
|
||||
m_initValue( 0.0f ),
|
||||
m_angle( 0.0f ),
|
||||
m_knobNum( _knob_num ),
|
||||
m_label( "" )
|
||||
{
|
||||
if( s_textFloat == NULL )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user