fixes for Qt4-version

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@475 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2007-04-21 01:00:00 +00:00
parent 4feb778ddd
commit 4e319102a5
25 changed files with 308 additions and 57 deletions

View File

@@ -58,6 +58,8 @@
static const int total = 1;
audioJACK::audioJACK( const sample_rate_t _sample_rate, bool & _success_ful,
mixer * _mixer ) :
audioDevice( _sample_rate, tLimit<int>( configManager::inst()->value(
@@ -67,7 +69,7 @@ audioJACK::audioJACK( const sample_rate_t _sample_rate, bool & _success_ful,
m_client( NULL ),
m_active( FALSE ),
// m_processCallbackMutex(),
m_stop_semaphore( 1 ),
m_stop_semaphore( total ),
m_outBuf( bufferAllocator::alloc<surroundSampleFrame>(
getMixer()->framesPerAudioBuffer() ) ),
m_framesDoneInCurBuf( 0 ),
@@ -166,7 +168,11 @@ audioJACK::audioJACK( const sample_rate_t _sample_rate, bool & _success_ful,
}
}
m_stop_semaphore += m_stop_semaphore.total();
#ifndef QT3
m_stop_semaphore.acquire( total );
#else
m_stop_semaphore += total;
#endif
_success_ful = TRUE;
@@ -177,7 +183,11 @@ audioJACK::audioJACK( const sample_rate_t _sample_rate, bool & _success_ful,
audioJACK::~audioJACK()
{
m_stop_semaphore -= m_stop_semaphore.total();
#ifndef QT3
m_stop_semaphore.release( total );
#else
m_stop_semaphore -= total;
#endif
while( m_portMap.size() )
{
@@ -261,7 +271,11 @@ void audioJACK::startProcessing( void )
void audioJACK::stopProcessing( void )
{
#ifndef QT3
m_stop_semaphore.acquire();
#else
m_stop_semaphore++;
#endif
}
@@ -414,7 +428,11 @@ int audioJACK::processCallback( jack_nframes_t _nframes, void * _udata )
if( !_this->m_framesToDoInCurBuf )
{
_this->m_stopped = TRUE;
#ifndef QT3
_this->m_stop_semaphore.release();
#else
_this->m_stop_semaphore--;
#endif
}
_this->m_framesDoneInCurBuf = 0;
}

View File

@@ -50,6 +50,7 @@
#include "templates.h"
static const int total = 1;
audioSDL::audioSDL( const sample_rate_t _sample_rate, bool & _success_ful,
mixer * _mixer ) :
@@ -58,7 +59,7 @@ audioSDL::audioSDL( const sample_rate_t _sample_rate, bool & _success_ful,
getMixer()->framesPerAudioBuffer() ) ),
m_convertedBuf_pos( 0 ),
m_convertEndian( FALSE ),
m_stop_semaphore( 1 )
m_stop_semaphore( total )
{
_success_ful = FALSE;
@@ -107,7 +108,11 @@ audioSDL::audioSDL( const sample_rate_t _sample_rate, bool & _success_ful,
}
m_convertEndian = ( m_audioHandle.format != actual.format );
m_stop_semaphore += m_stop_semaphore.total();
#ifndef QT3
m_stop_semaphore.acquire( total );
#else
m_stop_semaphore += total;
#endif
_success_ful = TRUE;
}
@@ -118,7 +123,11 @@ audioSDL::audioSDL( const sample_rate_t _sample_rate, bool & _success_ful,
audioSDL::~audioSDL()
{
stopProcessing();
m_stop_semaphore -= m_stop_semaphore.total();
#ifndef QT3
m_stop_semaphore.release( total );
#else
m_stop_semaphore -= total;
#endif
SDL_CloseAudio();
SDL_Quit();
bufferAllocator::free( m_convertedBuf );
@@ -143,7 +152,11 @@ void audioSDL::stopProcessing( void )
{
if( SDL_GetAudioStatus() == SDL_AUDIO_PLAYING )
{
#ifndef QT3
m_stop_semaphore.acquire();
#else
m_stop_semaphore++;
#endif
SDL_LockAudio();
SDL_PauseAudio( 1 );
@@ -184,7 +197,11 @@ void audioSDL::sdlAudioCallback( Uint8 * _buf, int _len )
if( !frames )
{
m_stopped = TRUE;
#ifndef QT3
m_stop_semaphore.release();
#else
m_stop_semaphore--;
#endif
memset( _buf, 0, _len );
return;
}

View File

@@ -29,8 +29,10 @@
#ifdef QT4
#include <QtGui/QGroupBox>
#include <QtGui/QLayout>
#include <QtGui/QPushButton>
#include <QtGui/QScrollArea>
#else
@@ -215,12 +217,28 @@ effectList::effectList( QWidget * _parent ) :
tr( "Description" ), this );
#endif
groupbox->setFixedHeight( 200 );
#ifdef QT3
groupbox->setInsideMargin( 2 );
QScrollView * scrollView = new QScrollView( groupbox );
scrollView->setFrameStyle( 0 );
scrollView->setMargin( 10 );
m_descriptionWidget = new QVBox( scrollView->viewport() );
scrollView->addChild( m_descriptionWidget );
#endif
QScrollArea * scrollArea = new QScrollArea( groupbox );
scrollArea->setFrameStyle( 0 );
#ifdef QT3
scrollArea->setMargin( 10 );
#endif
#ifndef QT3
m_descriptionWidget = new QWidget;
QVBoxLayout * l = new QVBoxLayout( m_descriptionWidget );
l->setMargin( 0 );
l->setSpacing( 0 );
scrollArea->setWidget( m_descriptionWidget );
m_descriptionWidget->show();
m_descriptionWidget->setFixedSize( 200, 200 );
#else
m_descriptionWidget = new QVBox( scrollArea->viewport() );
scrollArea->addChild( m_descriptionWidget );
#endif
QVBoxLayout * vboxl = new QVBoxLayout( this );
vboxl->setMargin( 0 );
@@ -247,11 +265,19 @@ effectList::~effectList()
void effectList::onHighlighted( int _pluginIndex )
{
#ifndef QT3
QLayoutItem * i;
while( ( i = m_descriptionWidget->layout() ) != 0 )
{
delete i;
}
#else
QLayoutIterator it = m_descriptionWidget->layout()->iterator();
while( it.current() )
{
it.deleteCurrent();
}
#endif
m_descriptionWidget->hide();
m_currentSelection = m_effectKeys[_pluginIndex];

View File

@@ -532,7 +532,11 @@ void mainWindow::finalize( void )
this ) );
}
}
#ifndef QT3
if( !m_tools_menu->isEmpty() )
#else
if( m_tools_menu->count() )
#endif
{
#ifdef QT4
menuBar()->addMenu( m_tools_menu )->setText( tr( "&Tools" ) );
@@ -1093,9 +1097,13 @@ void mainWindow::fillTemplatesMenu( void )
void mainWindow::showTool( int _idx )
{
#ifndef QT3
#warning TODO: Qt4-implementation
#else
tool * t = m_tools[m_tools_menu->indexOf( _idx )];
t->show();
t->setFocus();
#endif
}

View File

@@ -107,7 +107,7 @@ notePlayHandle::~notePlayHandle()
{
if( detuning() )
{
m_instrumentTrack->m_processHandles.remove( this );
m_instrumentTrack->m_processHandles.removeAll( this );
}
if( m_pluginData != NULL )
{

View File

@@ -556,7 +556,11 @@ setupDialog::setupDialog( configTabs _tab_to_open ) :
for( aswMap::iterator it = m_audioIfaceSetupWidgets.begin();
it != m_audioIfaceSetupWidgets.end(); ++it )
{
m_audioIfaceNames[tr( it.key() )] = it.key();
m_audioIfaceNames[tr( it.key()
#ifndef QT3
.toAscii()
#endif
)] = it.key();
}
for( trMap::iterator it = m_audioIfaceNames.begin();
it != m_audioIfaceNames.end(); ++it )
@@ -572,7 +576,7 @@ setupDialog::setupDialog( configTabs _tab_to_open ) :
}
#ifdef QT4
m_audioInterfaces->setCurrentIndex( m_audioInterfaces->findText(
tr( engine::getMixer()->audioDevName() ) ) );
tr( engine::getMixer()->audioDevName().toAscii() ) ) );
#else
m_audioInterfaces->setCurrentText(
tr( engine::getMixer()->audioDevName() ) );
@@ -642,7 +646,11 @@ setupDialog::setupDialog( configTabs _tab_to_open ) :
for( mswMap::iterator it = m_midiIfaceSetupWidgets.begin();
it != m_midiIfaceSetupWidgets.end(); ++it )
{
m_midiIfaceNames[tr( it.key() )] = it.key();
m_midiIfaceNames[tr( it.key()
#ifndef QT3
.toAscii()
#endif
)] = it.key();
}
for( trMap::iterator it = m_midiIfaceNames.begin();
it != m_midiIfaceNames.end(); ++it )
@@ -659,7 +667,7 @@ setupDialog::setupDialog( configTabs _tab_to_open ) :
#ifdef QT4
m_midiInterfaces->setCurrentIndex( m_midiInterfaces->findText(
tr( engine::getMixer()->midiClientName() ) ) );
tr( engine::getMixer()->midiClientName().toAscii() ) ) );
#else
m_midiInterfaces->setCurrentText(
tr( engine::getMixer()->midiClientName() ) );

View File

@@ -28,6 +28,9 @@
#include "tool.h"
#include "main_window.h"
#ifndef QT3
#include <QtGui/QIcon>
#endif

View File

@@ -1891,11 +1891,7 @@ void track::addAutomationPattern( automationPattern * _pattern )
void track::removeAutomationPattern( automationPattern * _pattern )
{
#ifndef QT3
m_automation_patterns.removeAll( _pattern );
#else
m_automation_patterns.remove( _pattern );
#endif
}

View File

@@ -345,7 +345,12 @@ void trackContainer::clearAllTracks( void )
const trackWidget * trackContainer::trackWidgetAt( const int _y ) const
{
const int abs_y = _y + m_scrollArea->contentsY();
const int abs_y = _y +
#ifndef QT3
m_scrollArea->viewport()->y();
#else
m_scrollArea->contentsY();
#endif
int y_cnt = 0;
for( trackWidgetVector::const_iterator it = m_trackWidgets.begin();
it != m_trackWidgets.end(); ++it )

View File

@@ -59,6 +59,9 @@ effectLabel::effectLabel( const QString & _initial_name, QWidget * _parent,
m_effWidget = new effectTabWidget( engine::getMainWindow()->workspace(),
m_track,
m_track->getAudioPort() );
#ifndef QT3
engine::getMainWindow()->workspace()->addWindow( m_effWidget );
#endif
m_effWidget->setFixedSize( 240, 242 );
m_effWidget->hide();
connect( m_effWidget, SIGNAL( closed() ),

View File

@@ -182,10 +182,9 @@ rackPlugin::rackPlugin( QWidget * _parent,
#endif
m_controlView = m_effect->createControlDialog( m_track );
/* engine::getMainWindow()->workspace(),
new ControlDialog(
engine::getMainWindow()->workspace(),
m_effect, m_track );*/
#ifndef QT3
engine::getMainWindow()->workspace()->addWindow( m_controlView );
#endif
connect( m_controlView, SIGNAL( closed() ),
this, SLOT( closeEffects() ) );
m_controlView->hide();

View File

@@ -25,9 +25,11 @@
*/
#include "qt3support.h"
#ifdef QT4
#include <QtGui/QMessageBox>
#include <QtGui/QApplication>
#else
@@ -48,10 +50,12 @@ rackView::rackView( QWidget * _parent, track * _track, audioPort * _port ) :
m_mainLayout = new QVBoxLayout( this );
m_mainLayout->setMargin( 0 );
m_mainLayout->setSpacing( 0 );
m_scrollArea = new QScrollArea( this );
m_scrollArea->setFixedSize( 230, 184 );
#ifdef QT4
m_scrollArea->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOn );
m_scrollArea->setPalette( QApplication::palette( m_scrollArea ) );
#else
m_scrollArea->setVScrollBarMode( QScrollArea::AlwaysOn );
#endif
@@ -74,10 +78,9 @@ void rackView::addEffect( effect * _e )
#ifdef QT4
if( !m_scrollArea->widget() )
{
QWidget * w = new QWidget( m_scrollArea->viewport() );
QVBoxLayout * vb = new QVBoxLayout( w );
w->show();
QWidget * w = new QWidget;
m_scrollArea->setWidget( w );
w->show();
}
QWidget * w = m_scrollArea->widget();
#else

View File

@@ -29,7 +29,6 @@
#include "tooltip.h"
const QColor toolButton::s_stdColor = QColor( 216, 216, 216 );
const QColor toolButton::s_hlColor = QColor( 240, 240, 240 );
@@ -44,6 +43,11 @@ toolButton::toolButton( const QPixmap & _pixmap, const QString & _tooltip,
{
#ifndef QT3
setAutoFillBackground( TRUE );
QPalette pal = palette();
pal.setColor( backgroundRole(), m_colorStandard );
pal.setColor( QPalette::Window, m_colorStandard );
pal.setColor( QPalette::Button, m_colorStandard );
setPalette( pal );
#endif
if( _receiver != NULL && _slot != NULL )
{
@@ -70,8 +74,10 @@ toolButton::~toolButton()
void toolButton::enterEvent( QEvent * )
{
#ifdef QT4
QPalette pal;
QPalette pal = palette();
pal.setColor( backgroundRole(), m_colorHighlighted );
pal.setColor( QPalette::Window, m_colorHighlighted );
pal.setColor( QPalette::Button, m_colorHighlighted );
setPalette( pal );
#else
setPaletteBackgroundColor( m_colorHighlighted );
@@ -84,8 +90,10 @@ void toolButton::enterEvent( QEvent * )
void toolButton::leaveEvent( QEvent * )
{
#ifdef QT4
QPalette pal;
QPalette pal = palette();
pal.setColor( backgroundRole(), m_colorStandard );
pal.setColor( QPalette::Window, m_colorStandard );
pal.setColor( QPalette::Button, m_colorStandard );
setPalette( pal );
#else
setPaletteBackgroundColor( m_colorStandard );