From 4e319102a58c6bd1a93a33d8fd595faefa928243 Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Sat, 21 Apr 2007 01:00:00 +0000 Subject: [PATCH] fixes for Qt4-version git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@475 0778d3d1-df1d-0410-868b-ea421aaaa00d --- ChangeLog | 26 +++++++++ include/audio_device.h | 6 ++- include/bb_track.h | 4 -- include/fifo_buffer.h | 24 +++++++++ include/midi_client.h | 6 ++- include/qt3support.h | 4 ++ .../ladspa_subplugin_features.cpp | 29 ++++++++-- plugins/live_tool/live_tool.cpp | 25 ++++++++- plugins/patman/patman.cpp | 18 ++++++- plugins/polyb302/polyb302.cpp | 2 +- plugins/singerbot/singerbot.cpp | 54 ++++++++++++++++--- plugins/singerbot/singerbot.h | 9 +++- src/audio/audio_jack.cpp | 24 +++++++-- src/audio/audio_sdl.cpp | 23 ++++++-- src/core/effect_select_dialog.cpp | 36 +++++++++++-- src/core/main_window.cpp | 8 +++ src/core/note_play_handle.cpp | 2 +- src/core/setup_dialog.cpp | 16 ++++-- src/core/tool.cpp | 3 ++ src/core/track.cpp | 4 -- src/core/track_container.cpp | 7 ++- src/widgets/effect_label.cpp | 3 ++ src/widgets/rack_plugin.cpp | 7 ++- src/widgets/rack_view.cpp | 11 ++-- src/widgets/tool_button.cpp | 14 +++-- 25 files changed, 308 insertions(+), 57 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0e6f15eb9..15af29080 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,31 @@ 2007-04-20 Tobias Doerffel + * plugins/ladspa_effect/ladspa_subplugin_features.cpp: + * plugins/patman/patman.cpp: + * plugins/singerbot/singerbot.h: + * plugins/singerbot/singerbot.cpp: + * plugins/live_tool/live_tool.cpp: + * plugins/polyb302/polyb302.cpp: + * include/fifo_buffer.h: + * include/bb_track.h: + * include/audio_device.h: + * include/midi_client.h: + * include/qt3support.h: + * src/audio/audio_sdl.cpp: + * src/audio/audio_jack.cpp: + * src/core/note_play_handle.cpp: + * src/core/track_container.cpp: + * src/core/tool.cpp: + * src/core/setup_dialog.cpp: + * src/core/track.cpp: + * src/core/effect_select_dialog.cpp: + * src/core/main_window.cpp: + * src/widgets/rack_plugin.cpp: + * src/widgets/tool_button.cpp: + * src/widgets/rack_view.cpp: + * src/widgets/effect_label.cpp: + fixes for Qt4-version + * plugins/midi_import/midi_import.cpp: * src/core/automation_editor.cpp: * src/core/piano_roll.cpp: diff --git a/include/audio_device.h b/include/audio_device.h index c4e72c654..c5e5f9187 100644 --- a/include/audio_device.h +++ b/include/audio_device.h @@ -111,7 +111,11 @@ public: public: setupWidget( const QString & _caption, QWidget * _parent ) : tabWidget( tabWidget::tr( "Settings for %1" ).arg( - tr( _caption ) ).toUpper(), _parent ) + tabWidget::tr( _caption +#ifndef QT3 + .toAscii() +#endif + ) ).toUpper(), _parent ) { } diff --git a/include/bb_track.h b/include/bb_track.h index 7f3146c71..5afea0084 100644 --- a/include/bb_track.h +++ b/include/bb_track.h @@ -132,11 +132,7 @@ public: } void enableAutomation( track * _track ) { -#ifndef QT3 m_disabled_tracks.removeAll( _track ); -#else - m_disabled_tracks.remove( _track ); -#endif } diff --git a/include/fifo_buffer.h b/include/fifo_buffer.h index 675c13457..7aea1292d 100644 --- a/include/fifo_buffer.h +++ b/include/fifo_buffer.h @@ -49,29 +49,53 @@ public: m_size( _size ) { m_buffer = new T[_size]; +#ifndef QT3 + m_reader_sem.acquire( _size ); +#else m_reader_sem += _size; +#endif } ~fifoBuffer() { delete[] m_buffer; +#ifndef QT3 + m_reader_sem.release( m_size ); +#else m_reader_sem -= m_size; +#endif } void write( T _element ) { +#ifndef QT3 + m_writer_sem.acquire(); +#else m_writer_sem++; +#endif m_buffer[m_writer_index++] = _element; m_writer_index %= m_size; +#ifndef QT3 + m_reader_sem.release(); +#else m_reader_sem--; +#endif } T read( void ) { +#ifndef QT3 + m_reader_sem.acquire(); +#else m_reader_sem++; +#endif T element = m_buffer[m_reader_index++]; m_reader_index %= m_size; +#ifndef QT3 + m_writer_sem.release(); +#else m_writer_sem--; +#endif return( element ); } diff --git a/include/midi_client.h b/include/midi_client.h index c6dd9ef59..5a496e31d 100644 --- a/include/midi_client.h +++ b/include/midi_client.h @@ -116,7 +116,11 @@ public: public: setupWidget( const QString & _caption, QWidget * _parent ) : tabWidget( tabWidget::tr( "Settings for %1" ).arg( - tr( _caption ) ).toUpper(), _parent ) + tr( _caption +#ifndef QT3 + .toAscii() +#endif + ) ).toUpper(), _parent ) { } diff --git a/include/qt3support.h b/include/qt3support.h index 7fb806085..8687ef92f 100644 --- a/include/qt3support.h +++ b/include/qt3support.h @@ -182,6 +182,10 @@ inline QString baseName( const QString & _file ) #define transformed xForm +// QList +#define removeAll remove + + // QGridLayout #define setColumnStretch setColStretch #define columnCount numCols diff --git a/plugins/ladspa_effect/ladspa_subplugin_features.cpp b/plugins/ladspa_effect/ladspa_subplugin_features.cpp index 17727923e..45d670b90 100644 --- a/plugins/ladspa_effect/ladspa_subplugin_features.cpp +++ b/plugins/ladspa_effect/ladspa_subplugin_features.cpp @@ -26,15 +26,17 @@ */ +#include "qt3support.h" #ifdef QT4 #include #include +#include #else -#include +#include #include #include @@ -65,24 +67,41 @@ void ladspaSubPluginFeatures::fillDescriptionWidget( QWidget * _parent, QLabel * label = new QLabel( _parent ); label->setText( QWidget::tr( "Name: " ) + lm->getName( lkey ) ); - QHBox * maker = new QHBox( _parent ); + QWidget * maker = new QWidget( _parent ); + QHBoxLayout * l = new QHBoxLayout( maker ); + l->setMargin( 0 ); + l->setSpacing( 0 ); + QLabel * maker_label = new QLabel( maker ); maker_label->setText( QWidget::tr( "Maker: " ) ); maker_label->setAlignment( Qt::AlignTop ); QLabel * maker_content = new QLabel( maker ); maker_content->setText( lm->getMaker( lkey ) ); +#ifndef QT3 + maker_content->setWordWrap( TRUE ); +#else maker_content->setAlignment( Qt::WordBreak ); - maker->setStretchFactor( maker_content, 100 ); +#endif + l->setStretchFactor( maker_content, 100 ); + + + QWidget * copyright = new QWidget( _parent ); + l = new QHBoxLayout( copyright ); + l->setMargin( 0 ); + l->setSpacing( 0 ); - QHBox * copyright = new QHBox( _parent ); copyright->setMinimumWidth( _parent->minimumWidth() ); QLabel * copyright_label = new QLabel( copyright ); copyright_label->setText( QWidget::tr( "Copyright: " ) ); copyright_label->setAlignment( Qt::AlignTop ); QLabel * copyright_content = new QLabel( copyright ); copyright_content->setText( lm->getCopyright( lkey ) ); +#ifndef QT3 + copyright_content->setWordWrap( TRUE ); +#else copyright_content->setAlignment( Qt::WordBreak ); - copyright->setStretchFactor( copyright_content, 100 ); +#endif + l->setStretchFactor( copyright_content, 100 ); QLabel * requiresRealTime = new QLabel( _parent ); requiresRealTime->setText( QWidget::tr( "Requires Real Time: " ) + diff --git a/plugins/live_tool/live_tool.cpp b/plugins/live_tool/live_tool.cpp index 48233ff06..0d6bd3675 100644 --- a/plugins/live_tool/live_tool.cpp +++ b/plugins/live_tool/live_tool.cpp @@ -23,7 +23,13 @@ */ -#ifdef QT3 +#include "qt3support.h" + +#ifndef QT3 + +#include + +#else #include @@ -71,8 +77,15 @@ plugin::descriptor live_tool_plugin_descriptor = liveTool::liveTool( mainWindow * _window ) : tool( _window, &live_tool_plugin_descriptor ) { - QPixmap background = PLUGIN_NAME::getIconPixmap( "artwork" ); + const QPixmap background = PLUGIN_NAME::getIconPixmap( "artwork" ); +#ifndef QT3 + setAutoFillBackground( TRUE ); + QPalette pal; + pal.setBrush( backgroundRole(), background ); + setPalette( pal ); +#else setPaletteBackgroundPixmap( background ); +#endif setFixedSize( background.size() ); #ifdef QT4 @@ -161,12 +174,20 @@ bool liveTool::x11Event( XEvent * _xe ) void liveTool::toggleInstrument( int _n ) { +#ifndef QT3 + if( _n > 0 && _n < engine::getBBEditor()->tracks().count() ) + { + track * t = engine::getBBEditor()->tracks().at( _n ); + t->setMuted( !t->muted() ); + } +#else bool track_exists; track * t = engine::getBBEditor()->tracks().at( _n, &track_exists ); if( track_exists ) { t->setMuted( !t->muted() ); } +#endif } diff --git a/plugins/patman/patman.cpp b/plugins/patman/patman.cpp index 055044ca7..218be652f 100644 --- a/plugins/patman/patman.cpp +++ b/plugins/patman/patman.cpp @@ -23,9 +23,12 @@ */ +#include "qt3support.h" + #ifdef QT4 #include +#include #else @@ -83,8 +86,15 @@ patmanSynth::patmanSynth( instrumentTrack * _track ) : instrument( _track, &patman_plugin_descriptor ), specialBgHandlingWidget( PLUGIN_NAME::getIconPixmap( "artwork" ) ) { +#ifndef QT3 + setAutoFillBackground( TRUE ); + QPalette pal; + pal.setBrush( backgroundRole(), + PLUGIN_NAME::getIconPixmap( "artwork" ) ); + setPalette( pal ); +#else setPaletteBackgroundPixmap( PLUGIN_NAME::getIconPixmap( "artwork" ) ); - +#endif m_openFileButton = new pixmapButton( this, NULL, NULL ); m_openFileButton->setCursor( QCursor( Qt::PointingHandCursor ) ); m_openFileButton->move( 200, 90 ); @@ -448,7 +458,11 @@ patmanSynth::load_error patmanSynth::load_patch( const QString & _filename ) { unload_current_patch(); - FILE * fd = fopen( _filename, "rb" ); + FILE * fd = fopen( _filename +#ifndef QT3 + .toAscii().constData() +#endif + , "rb" ); if( !fd ) { perror( "fopen" ); diff --git a/plugins/polyb302/polyb302.cpp b/plugins/polyb302/polyb302.cpp index 64a5c5008..5174f943d 100644 --- a/plugins/polyb302/polyb302.cpp +++ b/plugins/polyb302/polyb302.cpp @@ -577,7 +577,7 @@ void polyb302Synth::playNote( notePlayHandle * _n, bool ) void polyb302Synth::deleteNotePluginData( notePlayHandle * _n ) { handleState * hstate = (handleState *)_n->m_pluginData; - m_handleStates.remove( hstate ); + m_handleStates.removeAll( hstate ); delete hstate; } diff --git a/plugins/singerbot/singerbot.cpp b/plugins/singerbot/singerbot.cpp index 5edc2a448..a62cf5f43 100644 --- a/plugins/singerbot/singerbot.cpp +++ b/plugins/singerbot/singerbot.cpp @@ -23,6 +23,8 @@ */ +#include "qt3support.h" + #ifdef QT4 #include @@ -96,7 +98,15 @@ singerBot::singerBot( instrumentTrack * _track ) : s_thread->start(); } +#ifndef QT3 + setAutoFillBackground( TRUE ); + QPalette pal; + pal.setBrush( backgroundRole(), + PLUGIN_NAME::getIconPixmap( "artwork" ) ); + setPalette( pal ); +#else setPaletteBackgroundPixmap( PLUGIN_NAME::getIconPixmap( "artwork" ) ); +#endif QVBoxLayout * vbox = new QVBoxLayout( this ); vbox->setMargin( 10 ); @@ -106,7 +116,6 @@ singerBot::singerBot( instrumentTrack * _track ) : m_lyrics = new QTextEdit( this ); #ifdef QT4 m_lyrics->setAutoFillBackground( TRUE ); - QPalette pal; pal.setColor( m_lyrics->backgroundRole(), QColor( 64, 64, 64 ) ); m_lyrics->setPalette( pal ); #else @@ -224,8 +233,13 @@ void singerBot::lyricsChanged( void ) void singerBot::updateWords( void ) { +#ifndef QT3 + m_words = m_lyrics->toPlainText().simplified().toLower(). + split( ' ' ); +#else m_words = QStringList::split( ' ', m_lyrics->text().simplifyWhiteSpace().lower() ); +#endif m_words_dirty = FALSE; } @@ -255,7 +269,12 @@ void singerBot::createWave( notePlayHandle * _n ) / 64.0f / engine::getSongEditor()->getTempo() : 0; int word_index = _n->patternIndex() % m_words.size(); - hdata->text = m_words[word_index].ascii(); + hdata->text = m_words[word_index]. +#ifndef QT3 + toAscii().constData(); +#else + ascii(); +#endif s_thread->set_data( hdata ); s_thread->unlock_synth(); @@ -338,13 +357,19 @@ sampleBuffer * singerBot::readWave( handle_data * _hdata ) +static const int total = 1; singerBot::synThread::synThread( void ) : - m_handle_semaphore( 1 ), - m_synth_semaphore( 1 ) + m_handle_semaphore( total ), + m_synth_semaphore( total ) { - m_handle_semaphore += m_handle_semaphore.total(); - m_synth_semaphore += m_synth_semaphore.total(); +#ifndef QT3 + m_handle_semaphore.acquire( total ); + m_synth_semaphore.acquire( total ); +#else + m_handle_semaphore += total; + m_synth_semaphore += total; +#endif } @@ -352,8 +377,13 @@ singerBot::synThread::synThread( void ) : singerBot::synThread::~synThread() { - m_handle_semaphore -= m_handle_semaphore.total(); - m_synth_semaphore -= m_synth_semaphore.total(); +#ifndef QT3 + m_handle_semaphore.release( total ); + m_synth_semaphore.release( total ); +#else + m_handle_semaphore -= total; + m_synth_semaphore -= total; +#endif } @@ -384,9 +414,17 @@ void singerBot::synThread::run( void ) for( ; ; ) { +#ifndef QT3 + m_synth_semaphore.acquire(); +#else m_synth_semaphore++; +#endif text_to_wave(); +#ifndef QT3 + m_handle_semaphore.release(); +#else m_handle_semaphore--; +#endif } } diff --git a/plugins/singerbot/singerbot.h b/plugins/singerbot/singerbot.h index 280443b02..84db55fa4 100644 --- a/plugins/singerbot/singerbot.h +++ b/plugins/singerbot/singerbot.h @@ -26,7 +26,6 @@ #ifndef _SINGERBOT_H #define _SINGERBOT_H - #ifdef QT4 #include @@ -98,11 +97,19 @@ private: void unlock_synth( void ) { +#ifndef QT3 + m_synth_semaphore.release(); +#else m_synth_semaphore--; +#endif } void lock_handle( void ) { +#ifndef QT3 + m_handle_semaphore.acquire(); +#else m_handle_semaphore++; +#endif } diff --git a/src/audio/audio_jack.cpp b/src/audio/audio_jack.cpp index 8d3207dea..47b9fbf13 100644 --- a/src/audio/audio_jack.cpp +++ b/src/audio/audio_jack.cpp @@ -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( 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( 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; } diff --git a/src/audio/audio_sdl.cpp b/src/audio/audio_sdl.cpp index af12c7f94..584eb13ee 100644 --- a/src/audio/audio_sdl.cpp +++ b/src/audio/audio_sdl.cpp @@ -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; } diff --git a/src/core/effect_select_dialog.cpp b/src/core/effect_select_dialog.cpp index b31984f7c..4d5794c8a 100644 --- a/src/core/effect_select_dialog.cpp +++ b/src/core/effect_select_dialog.cpp @@ -29,8 +29,10 @@ #ifdef QT4 +#include #include #include +#include #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]; diff --git a/src/core/main_window.cpp b/src/core/main_window.cpp index 027128581..a26a1807c 100644 --- a/src/core/main_window.cpp +++ b/src/core/main_window.cpp @@ -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 } diff --git a/src/core/note_play_handle.cpp b/src/core/note_play_handle.cpp index ddf8f38c9..5b6008c97 100644 --- a/src/core/note_play_handle.cpp +++ b/src/core/note_play_handle.cpp @@ -107,7 +107,7 @@ notePlayHandle::~notePlayHandle() { if( detuning() ) { - m_instrumentTrack->m_processHandles.remove( this ); + m_instrumentTrack->m_processHandles.removeAll( this ); } if( m_pluginData != NULL ) { diff --git a/src/core/setup_dialog.cpp b/src/core/setup_dialog.cpp index a697a3198..92c81ad38 100644 --- a/src/core/setup_dialog.cpp +++ b/src/core/setup_dialog.cpp @@ -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() ) ); diff --git a/src/core/tool.cpp b/src/core/tool.cpp index 9aa4d1874..3a6517ce1 100644 --- a/src/core/tool.cpp +++ b/src/core/tool.cpp @@ -28,6 +28,9 @@ #include "tool.h" #include "main_window.h" +#ifndef QT3 +#include +#endif diff --git a/src/core/track.cpp b/src/core/track.cpp index de6fb5527..74c31cb1e 100644 --- a/src/core/track.cpp +++ b/src/core/track.cpp @@ -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 } diff --git a/src/core/track_container.cpp b/src/core/track_container.cpp index 6150d9dc4..1812a07e3 100644 --- a/src/core/track_container.cpp +++ b/src/core/track_container.cpp @@ -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 ) diff --git a/src/widgets/effect_label.cpp b/src/widgets/effect_label.cpp index 6f5532863..bf7a3b06d 100644 --- a/src/widgets/effect_label.cpp +++ b/src/widgets/effect_label.cpp @@ -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() ), diff --git a/src/widgets/rack_plugin.cpp b/src/widgets/rack_plugin.cpp index cfdd239fa..d2856aa99 100644 --- a/src/widgets/rack_plugin.cpp +++ b/src/widgets/rack_plugin.cpp @@ -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(); diff --git a/src/widgets/rack_view.cpp b/src/widgets/rack_view.cpp index 8719d2859..0b0d46424 100644 --- a/src/widgets/rack_view.cpp +++ b/src/widgets/rack_view.cpp @@ -25,9 +25,11 @@ */ +#include "qt3support.h" + #ifdef QT4 -#include +#include #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 diff --git a/src/widgets/tool_button.cpp b/src/widgets/tool_button.cpp index 2c9e301e5..fa78e7396 100644 --- a/src/widgets/tool_button.cpp +++ b/src/widgets/tool_button.cpp @@ -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 );