From 784dcbc7a50cc77b73ce584a969220172eb4f770 Mon Sep 17 00:00:00 2001 From: Javier Serrano Polo Date: Sun, 3 Sep 2006 20:10:16 +0000 Subject: [PATCH] Qt4-compat fixes git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@385 0778d3d1-df1d-0410-868b-ea421aaaa00d --- acinclude.m4 | 1 + include/effect_tab_widget.h | 2 - include/qt3support.h | 5 +- include/rack_view.h | 6 +-- include/track.h | 2 +- src/audio/audio_device.cpp | 5 ++ src/core/automation_editor.cpp | 52 ++++++++++++++------ src/core/effect_tab_widget.cpp | 3 +- src/core/envelope_and_lfo_widget.cpp | 8 ++- src/core/ladspa_port_dialog.cpp | 55 +++++++++++++++++++-- src/core/name_label.cpp | 13 ++++- src/core/note.cpp | 13 +++-- src/core/piano_roll.cpp | 25 +++++++--- src/lib/ladspa_2_lmms.cpp | 33 ++++++++----- src/lib/ladspa_manager.cpp | 6 +-- src/tracks/automation_pattern.cpp | 11 +++-- src/tracks/instrument_track.cpp | 28 +++++++---- src/widgets/effect_label.cpp | 4 ++ src/widgets/ladspa_control.cpp | 12 ++++- src/widgets/ladspa_description.cpp | 24 +++++++-- src/widgets/rack_plugin.cpp | 14 +++--- src/widgets/rack_view.cpp | 73 ++++++++++++++++++++-------- src/widgets/volume_knob.cpp | 1 + 23 files changed, 291 insertions(+), 105 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index 40ee2cea2..e13af0202 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -157,6 +157,7 @@ case "${host}" in if test "$QT_MAJOR" = "4" ; then QT_IS_MT="yes" QT_LIB="-lQtCore -lQtGui -lQtXml -lQt3Support" + MOC="$MOC -DLADSPA_SUPPORT" else QT_CXXFLAGS="-DQT3 $QT_CXXFLAGS" if test "x`ls $QTDIR/lib/libqt-mt.* 2> /dev/null`" != x ; then diff --git a/include/effect_tab_widget.h b/include/effect_tab_widget.h index 9d4d62569..a62d7302a 100644 --- a/include/effect_tab_widget.h +++ b/include/effect_tab_widget.h @@ -37,8 +37,6 @@ #include #include #include -#include -#include #else diff --git a/include/qt3support.h b/include/qt3support.h index 8941d08db..7fb806085 100644 --- a/include/qt3support.h +++ b/include/qt3support.h @@ -78,6 +78,7 @@ inline QString baseName( const QString & _file ) #define vstack QValueStack #define vvector QValueVector +#define qSort qHeapSort #define QMenu QPopupMenu #define QAbstractButton QButton @@ -149,7 +150,6 @@ inline QString baseName( const QString & _file ) #define toLower lower #define toUpper upper - // QTextEdit #define setLineWrapMode setWordWrap #define setPlainText setText @@ -199,7 +199,8 @@ inline QString baseName( const QString & _file ) // Qt-namespace #define ShiftModifier ShiftButton #define ControlModifier ControlButton - +#define Alignment AlignmentFlags +#define TextWordWrap WordBreak typedef unsigned int csize; diff --git a/include/rack_view.h b/include/rack_view.h index f9cac168e..29dfcc6d9 100644 --- a/include/rack_view.h +++ b/include/rack_view.h @@ -31,8 +31,8 @@ #include #include -#include -#include +#include +#include #else @@ -82,7 +82,7 @@ private: vvector m_rackInserts; QVBoxLayout * m_mainLayout; - QScrollView * m_scrollView; + QScrollArea * m_scrollArea; track * m_track; audioPort * m_port; diff --git a/include/track.h b/include/track.h index 6158c578c..22da09d57 100644 --- a/include/track.h +++ b/include/track.h @@ -515,7 +515,7 @@ protected: private: trackContainer * m_trackContainer; trackWidget * m_trackWidget; - QPtrList m_automation_patterns; + vlist m_automation_patterns; } ; diff --git a/src/audio/audio_device.cpp b/src/audio/audio_device.cpp index fe126b6bd..8d320d223 100644 --- a/src/audio/audio_device.cpp +++ b/src/audio/audio_device.cpp @@ -71,10 +71,15 @@ audioDevice::~audioDevice() src_delete( m_srcState ); #endif bufferAllocator::free( m_buffer ); +#ifdef QT3 if( m_devMutex.locked() ) { unlock(); } +#else + m_devMutex.tryLock(); + unlock(); +#endif } diff --git a/src/core/automation_editor.cpp b/src/core/automation_editor.cpp index 9fef89f37..385afa2bb 100644 --- a/src/core/automation_editor.cpp +++ b/src/core/automation_editor.cpp @@ -77,6 +77,10 @@ #include "bb_editor.h" #include "piano_roll.h" +#ifdef QT3 +#define value data +#endif + QPixmap * automationEditor::s_toolDraw = NULL; QPixmap * automationEditor::s_toolErase = NULL; @@ -439,7 +443,7 @@ void automationEditor::setCurrentPattern( automationPattern * _new_pattern ) for( timeMap::iterator it = time_map.begin(); it != time_map.end(); ++it ) { - central_key += it.data(); + central_key += it.value(); ++total_values; } @@ -519,8 +523,8 @@ void automationEditor::updatePaintPixmap( void ) // print value numbers int font_height = p.fontMetrics().height(); - AlignmentFlags text_flags = - (AlignmentFlags)( AlignRight | AlignVCenter ); + Qt::Alignment text_flags = + (Qt::Alignment)( Qt::AlignRight | Qt::AlignVCenter ); if( m_pattern ) { @@ -621,7 +625,7 @@ void automationEditor::updatePaintPixmap( void ) p.setPen( pen ); p.drawLine( VALUES_WIDTH, grid_bottom, width(), grid_bottom ); - pen.setStyle( DotLine ); + pen.setStyle( Qt::DotLine ); p.setPen( pen ); float y_delta = ( grid_bottom - TOP_MARGIN ) / 8.0f; for( int i = 1; i < 8; ++i ) @@ -679,7 +683,7 @@ void automationEditor::updatePaintPixmap( void ) { Sint32 len_tact_64th = 4; - const int level = it.data(); + const int level = it.value(); Sint32 pos_tact_64th = it.key(); @@ -777,7 +781,7 @@ void automationEditor::updatePaintPixmap( void ) p.setPen( QColor( 0, 255, 0 ) ); p.drawText( VALUES_WIDTH + 20, TOP_MARGIN + 40, width() - VALUES_WIDTH - 20 - SCROLLBAR_SIZE, - grid_height - 40, WordBreak, + grid_height - 40, Qt::TextWordWrap, tr( "Please open an automation pattern with " "the context menu of a control!" ) ); } @@ -851,6 +855,9 @@ void automationEditor::enterEvent( QEvent * _e ) +#ifdef QT3 +#undef value +#endif void automationEditor::keyPressEvent( QKeyEvent * _ke ) { @@ -1000,6 +1007,9 @@ void automationEditor::keyPressEvent( QKeyEvent * _ke ) } } +#ifdef QT3 +#define value data +#endif @@ -1056,7 +1066,7 @@ void automationEditor::mousePressEvent( QMouseEvent * _me ) if( pos_tact_64th >= it.key() && len > 0 && pos_tact_64th <= it.key() + len && - it.data() == level ) + it.value() == level ) { break; } @@ -1259,7 +1269,7 @@ void automationEditor::mouseMoveEvent( QMouseEvent * _me ) pos_tact_64th <= it.key() + //TODO: Add constant 4 && - it.data() == level ) + it.value() == level ) { break; } @@ -1457,8 +1467,9 @@ void automationEditor::mouseMoveEvent( QMouseEvent * _me ) value_tact_64th ); new_selValuesForMove[ m_pattern->putValue( new_value_pos, - it.data() + level_diff, FALSE )] - = it.data() + level_diff; + it.value () + level_diff, + FALSE )] + = it.value() + level_diff; } m_selValuesForMove = new_selValuesForMove; @@ -1524,6 +1535,7 @@ void automationEditor::mouseMoveEvent( QMouseEvent * _me ) QCursor::setPos( mapToGlobal( QPoint( _me->x(), height() - SCROLLBAR_SIZE ) ) ); +#undef value m_topBottomScroll->setValue( m_topBottomScroll->value() + 1 ); level = m_bottom_level; @@ -1536,7 +1548,9 @@ void automationEditor::mouseMoveEvent( QMouseEvent * _me ) m_topBottomScroll->value() - 1 ); level = m_top_level; } - +#ifdef QT3 +#define value data +#endif m_selectedLevels = level - m_selectStartLevel; if( level <= m_selectStartLevel ) { @@ -1648,6 +1662,9 @@ void automationEditor::resizeEvent( QResizeEvent * ) +#ifdef QT3 +#undef value +#endif void automationEditor::wheelEvent( QWheelEvent * _we ) { @@ -1683,6 +1700,9 @@ void automationEditor::wheelEvent( QWheelEvent * _we ) _we->delta() / 30 ); } } +#ifdef QT3 +#define value data +#endif @@ -1884,7 +1904,7 @@ void automationEditor::selectAll( void ) //TODO: Add constant Uint32 len_tact_64th = 4; - const int level = it.data(); + const int level = it.value(); Uint32 pos_tact_64th = it.key(); if( level <= m_selectStartLevel || first_time ) @@ -1950,7 +1970,7 @@ void automationEditor::getSelectedValues( timeMap & _selected_values ) //TODO: Add constant Sint32 len_tact_64th = 4; - int level = it.data(); + int level = it.value(); Sint32 pos_tact_64th = it.key(); if( level > sel_level_start && level <= sel_level_end && @@ -1979,7 +1999,7 @@ void automationEditor::copySelectedValues( void ) for( timeMap::iterator it = selected_values.begin(); it != selected_values.end(); ++it ) { - m_valuesToCopy[it.key()] = it.data(); + m_valuesToCopy[it.key()] = it.value(); } textFloat::displayMessage( tr( "Values copied" ), tr( "All selected values were copied to the " @@ -2013,7 +2033,7 @@ void automationEditor::cutSelectedValues( void ) for( timeMap::iterator it = selected_values.begin(); it != selected_values.end(); ++it ) { - m_valuesToCopy[it.key()] = it.data(); + m_valuesToCopy[it.key()] = it.value(); m_pattern->removeValue( it.key() ); } } @@ -2038,7 +2058,7 @@ void automationEditor::pasteValues( void ) it != m_valuesToCopy.end(); ++it ) { m_pattern->putValue( it.key() + m_currentPosition, - it.data() ); + it.value() ); } // we only have to do the following lines if we pasted at diff --git a/src/core/effect_tab_widget.cpp b/src/core/effect_tab_widget.cpp index 15597074b..4df9eb323 100644 --- a/src/core/effect_tab_widget.cpp +++ b/src/core/effect_tab_widget.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #else @@ -101,7 +102,7 @@ void effectTabWidget::setupWidget( void ) m_rack = new rackView( m_effectsGroupBox, eng(), m_track, m_port ); m_rack->move( 6, 22 ); - m_addButton = new QPushButton( m_effectsGroupBox, "Add Effect" ); + m_addButton = new QPushButton( m_effectsGroupBox/*, "Add Effect"*/ ); m_addButton->setText( tr( "Add" ) ); m_addButton->move( 75, 210 ); connect( m_addButton, SIGNAL( clicked( void ) ), diff --git a/src/core/envelope_and_lfo_widget.cpp b/src/core/envelope_and_lfo_widget.cpp index 58dd44616..847e82250 100644 --- a/src/core/envelope_and_lfo_widget.cpp +++ b/src/core/envelope_and_lfo_widget.cpp @@ -125,7 +125,13 @@ envelopeAndLFOWidget::envelopeAndLFOWidget( float _value_for_zero_amount, m_lfoShapeData( NULL ), m_userWave( eng() ), m_lfoShape( SIN ), - m_busyMutex( TRUE ) + m_busyMutex( +#ifdef QT3 + TRUE +#else + QMutex::Recursive +#endif + ) { if( s_envGraph == NULL ) { diff --git a/src/core/ladspa_port_dialog.cpp b/src/core/ladspa_port_dialog.cpp index 4aafe4cf2..052e057e3 100644 --- a/src/core/ladspa_port_dialog.cpp +++ b/src/core/ladspa_port_dialog.cpp @@ -39,6 +39,8 @@ #include #include +#define QTableWidget QTable + #endif #include "ladspa_port_dialog.h" @@ -65,7 +67,7 @@ ladspaPortDialog::ladspaPortDialog( const ladspa_key_t & _key, Uint16 pc = m_ladspa->getPortCount( m_key ); - QTable * display = new QTable( pc, 7, settings ); + QTableWidget * display = new QTableWidget( pc, 7, settings ); QStringList ports; ports.append( tr( "Name" ) ); @@ -81,41 +83,74 @@ ladspaPortDialog::ladspaPortDialog( const ladspa_key_t & _key, { port_nums.append( QString::number( row ) ); Uint8 col = 0; +#ifdef QT3 display->setText( row, col, m_ladspa->getPortName( m_key, row ) ); +#else + display->item( row, col )->setText( m_ladspa->getPortName( + m_key, row ) ); +#endif col++; if( m_ladspa->isPortAudio( m_key, row ) ) { +#ifdef QT3 display->setText( row, col, tr( "Audio" ) ); +#else + display->item( row, col )->setText( tr( "Audio" ) ); +#endif } else { +#ifdef QT3 display->setText( row, col, tr( "Control" ) ); +#else + display->item( row, col )->setText( tr( "Control" ) ); +#endif } col++; if( m_ladspa->isPortInput( m_key, row ) ) { +#ifdef QT3 display->setText( row, col, tr( "Input" ) ); +#else + display->item( row, col )->setText( tr( "Input" ) ); +#endif } else { +#ifdef QT3 display->setText( row, col, tr( "Output" ) ); +#else + display->item( row, col )->setText( tr( "Output" ) ); +#endif } col++; if( m_ladspa->isPortToggled( m_key, row ) ) { +#ifdef QT3 display->setText( row, col, tr( "Toggled" ) ); +#else + display->item( row, col )->setText( tr( "Toggled" ) ); +#endif } else if( m_ladspa->isInteger( m_key, row ) ) { +#ifdef QT3 display->setText( row, col, tr( "Integer" ) ); +#else + display->item( row, col )->setText( tr( "Integer" ) ); +#endif } else { +#ifdef QT3 display->setText( row, col, tr( "Float" ) ); +#else + display->item( row, col )->setText( tr( "Float" ) ); +#endif } col++; @@ -182,30 +217,44 @@ ladspaPortDialog::ladspaPortDialog( const ladspa_key_t & _key, { range = ""; } +#ifdef QT3 display->setText( row, col, range ); +#else + display->item( row, col )->setText( range ); +#endif col++; if( m_ladspa->isLogarithmic( m_key, row ) ) { +#ifdef QT3 display->setText( row, col, tr( "Yes" ) ); +#else + display->item( row, col )->setText( tr( "Yes" ) ); +#endif } col++; if( m_ladspa->areHintsSampleRateDependent( m_key, row ) ) { +#ifdef QT3 display->setText( row, col, tr( "Yes" ) ); +#else + display->item( row, col )->setText( tr( "Yes" ) ); +#endif } col++; } - + +#ifdef QT3 display->setColumnLabels( ports ); display->setRowLabels( port_nums ); display->setReadOnly( true ); - + for(Uint8 col = 0; col < ports.count(); col++ ) { display->adjustColumn( col ); } +#endif vlayout->addWidget( settings ); diff --git a/src/core/name_label.cpp b/src/core/name_label.cpp index 7085190eb..cea2b832d 100644 --- a/src/core/name_label.cpp +++ b/src/core/name_label.cpp @@ -147,9 +147,18 @@ void nameLabel::selectPixmap( void ) ofd.selectFile( QFileInfo( m_pixmapFile ).fileName() ); } - if ( ofd.exec () == QDialog::Accepted ) + if ( ofd.exec () == QDialog::Accepted +#ifndef QT3 + && !ofd.selectedFiles().isEmpty() +#endif + ) { - QString pf = ofd.selectedFile(); + QString pf = ofd. +#ifdef QT3 + selectedFile(); +#else + selectedFiles()[0]; +#endif if( !QFileInfo( pf ).isRelative() ) { #if QT_VERSION >= 0x030100 diff --git a/src/core/note.cpp b/src/core/note.cpp index c20792a54..d9fec800b 100644 --- a/src/core/note.cpp +++ b/src/core/note.cpp @@ -99,9 +99,10 @@ note::~note() { if( m_detuning ) { - if( m_detuning->data().toInt() ) + knob::autoObj * o = dynamic_cast( m_detuning ); + if( o->data().toInt() ) { - m_detuning->setData( m_detuning->data().toInt() - 1 ); + o->setData( o->data().toInt() - 1 ); } else { @@ -302,7 +303,8 @@ void note::setDetuning( knob * _detuning ) m_detuning = _detuning; if( m_detuning ) { - m_detuning->setData( m_detuning->data().toInt() + 1 ); + knob::autoObj * o = dynamic_cast( m_detuning ); + o->setData( o->data().toInt() + 1 ); } } @@ -324,9 +326,10 @@ void note::createDetuning( void ) void note::detachCurrentDetuning( void ) { - if( m_detuning->data().toInt() ) + knob::autoObj * o = dynamic_cast( m_detuning ); + if( o->data().toInt() ) { - m_detuning->setData( m_detuning->data().toInt() - 1 ); + o->setData( o->data().toInt() - 1 ); QDomDocument doc; QDomElement parent = doc.createElement( "clone" ); diff --git a/src/core/piano_roll.cpp b/src/core/piano_roll.cpp index 92d294e02..016e6b69d 100644 --- a/src/core/piano_roll.cpp +++ b/src/core/piano_roll.cpp @@ -1164,12 +1164,17 @@ void pianoRoll::keyPressEvent( QKeyEvent * _ke ) m_timeLine->updatePosition(); break; - case Key_Control: + case Qt::Key_Control: if( mouseOverNote() ) { m_editMode = OPEN; +#ifndef QT3 + QApplication::changeOverrideCursor( + QCursor( Qt::ArrowCursor ) ); +#else QApplication::setOverrideCursor( - QCursor( ArrowCursor ), TRUE ); + QCursor( Qt::ArrowCursor ), TRUE ); +#endif update(); } @@ -1191,7 +1196,7 @@ void pianoRoll::keyReleaseEvent( QKeyEvent * _ke ) } switch( _ke->key() ) { - case Key_Control: + case Qt::Key_Control: if( m_editMode == OPEN ) { m_editMode = DRAW; @@ -1626,7 +1631,7 @@ void pianoRoll::mouseMoveEvent( QMouseEvent * _me ) } else if( #ifdef QT4 - _me->buttons() == NoButton + _me->buttons() == Qt::NoButton #else ( _me->state() == NoButton || _me->state() == ControlButton ) @@ -1665,11 +1670,17 @@ void pianoRoll::mouseMoveEvent( QMouseEvent * _me ) // no note?? if( it != notes.end() ) { - if( _me->modifiers() & ControlModifier ) + if( _me->modifiers() & Qt::ControlModifier ) { m_editMode = OPEN; +#ifndef QT3 + QApplication::changeOverrideCursor( + QCursor( Qt::ArrowCursor ) ); +#else QApplication::setOverrideCursor( - QCursor( ArrowCursor ), TRUE ); + QCursor( Qt::ArrowCursor ), + TRUE ); +#endif } // cursor at the "tail" of the note? else if( ( *it )->length() > 0 && @@ -1894,7 +1905,7 @@ void pianoRoll::mouseMoveEvent( QMouseEvent * _me ) m_moveStartKey = key_num; } else if( m_editMode == OPEN && !( mouseOverNote() - && _me->modifiers() & ControlModifier ) ) + && _me->modifiers() & Qt::ControlModifier ) ) { m_editMode = DRAW; } diff --git a/src/lib/ladspa_2_lmms.cpp b/src/lib/ladspa_2_lmms.cpp index f0d25a731..803093758 100644 --- a/src/lib/ladspa_2_lmms.cpp +++ b/src/lib/ladspa_2_lmms.cpp @@ -30,7 +30,10 @@ #include "ladspa_2_lmms.h" - +#ifdef QT3 +#define indexOf find +#endif + ladspa2LMMS::ladspa2LMMS( engine * _engine ): ladspaManager( _engine ) { @@ -93,25 +96,30 @@ QString ladspa2LMMS::getShortName( const ladspa_key_t & _key ) { QString name = getName( _key ); - if( name.find( "(" ) > 0 ) + if( name.indexOf( "(" ) > 0 ) { - name = name.left( name.find( "(" ) ); + name = name.left( name.indexOf( "(" ) ); } - if( name.find( " - " ) > 0 ) + if( name.indexOf( " - " ) > 0 ) { - name = name.left( name.find( " - " ) ); + name = name.left( name.indexOf( " - " ) ); } - if( name.find( " " ) > 0 ) + if( name.indexOf( " " ) > 0 ) { - name = name.left( name.find( " " ) ); + name = name.left( name.indexOf( " " ) ); } - if( name.find( " with ", 0, FALSE ) > 0 ) +#ifndef QT3 + Qt::CaseSensitivity cs = Qt::CaseInsensitive; +#else + bool cs = FALSE; +#endif + if( name.indexOf( " with ", 0, cs ) > 0 ) { - name = name.left( name.find( " with ", 0, FALSE ) ); + name = name.left( name.indexOf( " with ", 0, cs ) ); } - if( name.find( ",", 0, FALSE ) > 0 ) + if( name.indexOf( ",", 0, cs ) > 0 ) { - name = name.left( name.find( ",", 0, FALSE ) ); + name = name.left( name.indexOf( ",", 0, cs ) ); } if( name.length() > 40 ) { @@ -130,6 +138,9 @@ QString ladspa2LMMS::getShortName( const ladspa_key_t & _key ) return( name ); } + +#undef indexOf + #endif #endif diff --git a/src/lib/ladspa_manager.cpp b/src/lib/ladspa_manager.cpp index dee844c7a..c40a62afa 100644 --- a/src/lib/ladspa_manager.cpp +++ b/src/lib/ladspa_manager.cpp @@ -127,7 +127,7 @@ ladspaManager::ladspaManager( engine * _engine ) { m_sortedPlugins.append( qMakePair( getName( *it ), *it ) ); } - qHeapSort( m_sortedPlugins ); + qSort( m_sortedPlugins ); } @@ -214,7 +214,7 @@ Uint16 FASTCALL ladspaManager::getPluginInputs( { QString name = QString( _descriptor->PortNames[port] ); - if( name.upper().contains( "IN" ) ) + if( name.toUpper().contains( "IN" ) ) { inputs++; } @@ -240,7 +240,7 @@ Uint16 FASTCALL ladspaManager::getPluginOutputs( { QString name = QString( _descriptor->PortNames[port] ); - if( name.upper().contains( "OUT" ) ) + if( name.toUpper().contains( "OUT" ) ) { outputs++; } diff --git a/src/tracks/automation_pattern.cpp b/src/tracks/automation_pattern.cpp index b08d22bd4..1e6d0f184 100644 --- a/src/tracks/automation_pattern.cpp +++ b/src/tracks/automation_pattern.cpp @@ -35,6 +35,7 @@ #else #include +#define value data #endif @@ -80,7 +81,7 @@ automationPattern::automationPattern( const automationPattern & _pat_to_copy ) : for( timeMap::const_iterator it = _pat_to_copy.m_time_map.begin(); it != _pat_to_copy.m_time_map.end(); ++it ) { - m_time_map[it.key()] = it.data(); + m_time_map[it.key()] = it.value(); } init(); @@ -99,7 +100,7 @@ automationPattern::automationPattern( const automationPattern & _pat_to_copy, for( timeMap::const_iterator it = _pat_to_copy.m_time_map.begin(); it != _pat_to_copy.m_time_map.end(); ++it ) { - m_time_map[it.key()] = it.data(); + m_time_map[it.key()] = it.value(); } init(); @@ -217,7 +218,7 @@ void automationPattern::saveSettings( QDomDocument & _doc, QDomElement & _this ) QDomElement element = _doc.createElement( "time" ); element.setAttribute( "pos", static_cast( it.key() ) ); element.setAttribute( "value", m_object->levelToLabel( - it.data() ) ); + it.value() ) ); _this.appendChild( element ); } } @@ -278,12 +279,12 @@ void automationPattern::processMidiTime( const midiTime & _time ) timeMap::iterator it = m_time_map.find( _time ); if( it != m_time_map.end() ) { - m_object->setLevel( it.data() ); + m_object->setLevel( it.value() ); } } - +#undef value #include "automation_pattern.moc" diff --git a/src/tracks/instrument_track.cpp b/src/tracks/instrument_track.cpp index 776336baa..33c7d6c2f 100644 --- a/src/tracks/instrument_track.cpp +++ b/src/tracks/instrument_track.cpp @@ -331,22 +331,30 @@ instrumentTrack::instrumentTrack( trackContainer * _tc ) : vlayout->addWidget( m_pianoWidget ); #ifdef QT4 - m_midiInputAction = m_tswMidiMenu->addMenu( - m_midiWidget->m_readablePorts ); - m_midiOutputAction = m_tswMidiMenu->addMenu( - m_midiWidget->m_writeablePorts ); - m_midiInputAction->setText( tr( "MIDI input" ) ); - m_midiOutputAction->setText( tr( "MIDI output" ) ); - if( m_midiWidget->m_readablePorts == NULL ) + if( m_midiWidget->m_readablePorts ) { + m_midiInputAction = m_tswMidiMenu->addMenu( + m_midiWidget->m_readablePorts ); + } + else + { + m_midiInputAction = m_tswMidiMenu->addAction( "" ); connect( m_midiInputAction, SIGNAL( changed() ), this, SLOT( midiInSelected() ) ); } - if( m_midiWidget->m_writeablePorts == NULL ) + if( m_midiWidget->m_writeablePorts ) { - connect( m_midiOutputAction, SIGNAL( changed() ), this, - SLOT( midiOutSelected() ) ); + m_midiOutputAction = m_tswMidiMenu->addMenu( + m_midiWidget->m_writeablePorts ); } + else + { + m_midiOutputAction = m_tswMidiMenu->addAction( "" ); + connect( m_midiOutputAction, SIGNAL( changed() ), this, + SLOT( midiOutSelected() ) ); + } + m_midiInputAction->setText( tr( "MIDI input" ) ); + m_midiOutputAction->setText( tr( "MIDI output" ) ); #else m_midiInputID = m_tswMidiMenu->insertItem( tr( "MIDI input" ), m_midiWidget->m_readablePorts ); diff --git a/src/widgets/effect_label.cpp b/src/widgets/effect_label.cpp index ec7c5ce47..75f555fcf 100644 --- a/src/widgets/effect_label.cpp +++ b/src/widgets/effect_label.cpp @@ -35,6 +35,10 @@ #include "rename_dialog.h" #include "main_window.h" +#ifndef QT3 +#include +#endif + effectLabel::effectLabel( const QString & _initial_name, QWidget * _parent, diff --git a/src/widgets/ladspa_control.cpp b/src/widgets/ladspa_control.cpp index 4af1511e7..df213902e 100644 --- a/src/widgets/ladspa_control.cpp +++ b/src/widgets/ladspa_control.cpp @@ -49,7 +49,11 @@ ladspaControl::ladspaControl( QWidget * _parent, engine * _engine, track * _track, bool _link) : - QWidget( _parent, "ladspaControl" ), + QWidget( _parent +#ifdef QT3 + , "ladspaControl" +#endif + ), journallingObject( _engine ), m_port( _port ), m_track( _track ), @@ -57,7 +61,11 @@ ladspaControl::ladspaControl( QWidget * _parent, m_toggle( NULL ), m_knob( NULL ) { - m_layout = new QHBoxLayout( this, 0, 0, "ladspaControlLayout" ); + m_layout = new QHBoxLayout( this +#ifdef QT3 + , 0, 0, "ladspaControlLayout" +#endif + ); if( _link ) { diff --git a/src/widgets/ladspa_description.cpp b/src/widgets/ladspa_description.cpp index 8a79b4c2e..a5788c98c 100644 --- a/src/widgets/ladspa_description.cpp +++ b/src/widgets/ladspa_description.cpp @@ -28,7 +28,7 @@ #ifdef QT4 -#include +#include #else @@ -43,12 +43,20 @@ pluginDescription::pluginDescription( QWidget * _parent, engine * _engine ): - QWidget( _parent, "pluginDescription" ), + QWidget( _parent +#ifdef QT3 + , "pluginDescription" +#endif + ), m_ladspaManager( _engine->getLADSPAManager() ) { m_boxer = new QVBoxLayout( this ); +#ifndef QT3 + m_grouper = new QGroupBox( tr( "Description" ), this ); +#else m_grouper = new QGroupBox( 9, Qt::Vertical, tr( "Description" ), this ); +#endif m_label = new QLabel( m_grouper ); m_label->setText( tr( "Label:" ) ); @@ -135,13 +143,21 @@ void pluginDescription::onHighlighted( const ladspa_key_t & _key ) ladspaDescription::ladspaDescription( QWidget * _parent, engine * _engine, pluginType _type ): - QWidget( _parent, "ladspaDescription" ) + QWidget( _parent +#ifdef QT3 + , "ladspaDescription" +#endif + ) { m_ladspaManager = _engine->getLADSPAManager(); setMinimumWidth( 200 ); m_boxer = new QVBoxLayout( this ); +#ifndef QT3 + m_grouper = new QGroupBox( tr( "Plugins" ), this ); +#else m_grouper = new QGroupBox( 1, Qt::Vertical, tr( "Plugins" ), this ); +#endif l_sortable_plugin_t plugins; switch( _type ) @@ -181,7 +197,7 @@ ladspaDescription::ladspaDescription( QWidget * _parent, } } - m_pluginList = new QListBox( m_grouper ); + m_pluginList = new Q3ListBox( m_grouper ); m_pluginList->insertStringList( m_pluginNames ); connect( m_pluginList, SIGNAL( highlighted( int ) ), SLOT( onHighlighted( int ) ) ); diff --git a/src/widgets/rack_plugin.cpp b/src/widgets/rack_plugin.cpp index fcb93a091..51c37c652 100644 --- a/src/widgets/rack_plugin.cpp +++ b/src/widgets/rack_plugin.cpp @@ -69,7 +69,7 @@ rackPlugin::rackPlugin( QWidget * _parent, track * _track, engine * _engine, audioPort * _port ) : - QWidget( _parent, "rackPlugin" ), + QWidget( _parent ), journallingObject( _engine ), m_track( _track ), m_port( _port ), @@ -163,8 +163,7 @@ rackPlugin::rackPlugin( QWidget * _parent, "The Gate knob controls the signal level that is considered to be 'silence' " "while deciding when to stop processing signals." ) ); - m_editButton = new QPushButton( this, "Controls" ); - m_editButton->setText( tr( "Controls" ) ); + m_editButton = new QPushButton( tr( "Controls" ), this ); QFont f = m_editButton->font(); m_editButton->setFont( pointSize<7>( f ) ); m_editButton->setGeometry( 140, 14, 50, 20 ); @@ -179,15 +178,14 @@ rackPlugin::rackPlugin( QWidget * _parent, m_label->setFont( pointSize<7>( f ) ); m_label->setGeometry( 5, 44, 195, 10 ); - QPixmap back = QPixmap( bg.convertToImage().copy( 5, 44, - 195, 10 ) ); #ifdef QT4 m_label->setAutoFillBackground( TRUE ); - QPalette pal; - pal.setBrush( backgroundRole(), back ); + pal.setBrush( backgroundRole(), QPixmap::fromImage( + bg.toImage().copy( 5, 44, 195, 10 ) ) ); m_label->setPalette( pal ); #else - m_label->setErasePixmap( back ); + m_label->setErasePixmap( QPixmap( bg.convertToImage().copy( 5, 44, + 195, 10 ) ) ); #endif m_controlView = new ladspaControlDialog( diff --git a/src/widgets/rack_view.cpp b/src/widgets/rack_view.cpp index 9eb99bdbd..0b278a777 100644 --- a/src/widgets/rack_view.cpp +++ b/src/widgets/rack_view.cpp @@ -45,7 +45,7 @@ rackView::rackView( QWidget * _parent, engine * _engine, track * _track, audioPort * _port ): - QWidget( _parent, "rackView" ), + QWidget( _parent ), journallingObject( _engine ), m_track( _track ), m_port( _port ), @@ -54,10 +54,15 @@ rackView::rackView( QWidget * _parent, setFixedSize( 230, 184 ); m_mainLayout = new QVBoxLayout( this ); - m_scrollView = new QScrollView( this ); - m_scrollView->setFixedSize( 230, 184 ); - m_scrollView->setVScrollBarMode( QScrollView::AlwaysOn ); - m_mainLayout->addWidget( m_scrollView ); + m_mainLayout->setMargin( 0 ); + m_scrollArea = new QScrollArea( this ); + m_scrollArea->setFixedSize( 230, 184 ); +#ifdef QT4 + m_scrollArea->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOn ); +#else + m_scrollArea->setVScrollBarMode( QScrollArea::AlwaysOn ); +#endif + m_mainLayout->addWidget( m_scrollArea ); m_lastY = 0; } @@ -73,7 +78,19 @@ rackView::~rackView() void rackView::addPlugin( ladspa_key_t _key ) { - rackPlugin * plugin = new rackPlugin( m_scrollView->viewport(), +#ifdef QT4 + if( !m_scrollArea->widget() ) + { + QWidget * w = new QWidget( m_scrollArea->viewport() ); + QVBoxLayout * vb = new QVBoxLayout( w ); + w->show(); + m_scrollArea->setWidget( w ); + } + QWidget * w = m_scrollArea->widget(); +#else + QWidget * w = m_scrollArea->viewport(); +#endif + rackPlugin * plugin = new rackPlugin( w, _key, m_track, eng(), m_port ); connect( plugin, SIGNAL( moveUp( rackPlugin * ) ), this, SLOT( moveUp( rackPlugin * ) ) ); @@ -81,11 +98,19 @@ void rackView::addPlugin( ladspa_key_t _key ) this, SLOT( moveDown( rackPlugin * ) ) ); connect( plugin, SIGNAL( deletePlugin( rackPlugin * ) ), this, SLOT( deletePlugin( rackPlugin * ) ) ); - m_scrollView->addChild( plugin ); - m_scrollView->moveChild( plugin, 0, m_lastY ); +#ifndef QT3 + plugin->move( 0, m_lastY ); +#else + m_scrollArea->addChild( plugin ); + m_scrollArea->moveChild( plugin, 0, m_lastY ); +#endif plugin->show(); m_lastY += plugin->height(); - m_scrollView->resizeContents( 210, m_lastY ); +#ifdef QT4 + m_scrollArea->widget()->setFixedSize( 210, m_lastY ); +#else + m_scrollArea->resizeContents( 210, m_lastY ); +#endif m_rackInserts.append( plugin ); } @@ -101,7 +126,7 @@ void rackView::moveUp( rackPlugin * _plugin ) m_rackInserts.begin(); it != m_rackInserts.end(); it++, i++ ) { - if( (*it) == _plugin ) + if( *it == _plugin ) { break; } @@ -129,7 +154,7 @@ void rackView::moveDown( rackPlugin * _plugin ) m_rackInserts.begin(); it != m_rackInserts.end(); it++, i++ ) { - if( (*it) == _plugin ) + if( *it == _plugin ) { break; } @@ -150,14 +175,16 @@ void rackView::moveDown( rackPlugin * _plugin ) void rackView::deletePlugin( rackPlugin * _plugin ) { m_port->getEffects()->deleteEffect( _plugin->getEffect() ); - - m_scrollView->removeChild( _plugin ); + +#ifdef QT3 + m_scrollArea->removeChild( _plugin ); +#endif vvector::iterator loc = NULL; for( vvector::iterator it = m_rackInserts.begin(); it != m_rackInserts.end(); it++ ) { - if( (*it) == _plugin ) + if( *it == _plugin ) { loc = it; break; @@ -181,10 +208,18 @@ void rackView::redraw() for( vvector::iterator it = m_rackInserts.begin(); it != m_rackInserts.end(); it++ ) { - m_scrollView->moveChild( (*it), 0, m_lastY ); - m_lastY += (*it)->height(); +#ifdef QT4 + ( *it )->move( 0, m_lastY ); +#else + m_scrollArea->moveChild( *it, 0, m_lastY ); +#endif + m_lastY += ( *it )->height(); } - m_scrollView->resizeContents( 210, m_lastY ); +#ifdef QT4 + m_scrollArea->widget()->setFixedSize( 210, m_lastY ); +#else + m_scrollArea->resizeContents( 210, m_lastY ); +#endif } @@ -198,7 +233,7 @@ void FASTCALL rackView::saveSettings( QDomDocument & _doc, for( vvector::iterator it = m_rackInserts.begin(); it != m_rackInserts.end(); it++ ) { - ladspa_key_t key = (*it)->getKey(); + ladspa_key_t key = ( *it )->getKey(); _this.setAttribute( "label" + QString::number(num), key.first ); _this.setAttribute( "lib" + QString::number(num), key.second ); @@ -206,7 +241,7 @@ void FASTCALL rackView::saveSettings( QDomDocument & _doc, m_ladspa->getName( key ) ); _this.setAttribute( "maker" + QString::number(num), m_ladspa->getMaker( key ) ); - (*it)->saveState( _doc, _this ); + ( *it )->saveState( _doc, _this ); num++; } } diff --git a/src/widgets/volume_knob.cpp b/src/widgets/volume_knob.cpp index 6c3fd90b4..f135b23c4 100644 --- a/src/widgets/volume_knob.cpp +++ b/src/widgets/volume_knob.cpp @@ -37,6 +37,7 @@ #include #include +#include #else