Qt4-compat fixes

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@385 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Javier Serrano Polo
2006-09-03 20:10:16 +00:00
parent b1f31a036f
commit 784dcbc7a5
23 changed files with 291 additions and 105 deletions

View File

@@ -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

View File

@@ -37,8 +37,6 @@
#include <QtGui/QWidget>
#include <QtGui/QPushButton>
#include <QtGui/QLayout>
#include <QtGui/QScrollView>
#include <QtGui/QVBox>
#else

View File

@@ -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;

View File

@@ -31,8 +31,8 @@
#include <QtGui/QWidget>
#include <QtGui/QLayout>
#include <QtGui/QScrollView>
#include <QtGui/QVBox>
#include <QtGui/QScrollArea>
#include <QtGui/QVBoxLayout>
#else
@@ -82,7 +82,7 @@ private:
vvector<rackPlugin *> m_rackInserts;
QVBoxLayout * m_mainLayout;
QScrollView * m_scrollView;
QScrollArea * m_scrollArea;
track * m_track;
audioPort * m_port;

View File

@@ -515,7 +515,7 @@ protected:
private:
trackContainer * m_trackContainer;
trackWidget * m_trackWidget;
QPtrList<automationPattern> m_automation_patterns;
vlist<automationPattern *> m_automation_patterns;
} ;

View File

@@ -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
}

View File

@@ -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

View File

@@ -35,6 +35,7 @@
#include <Qt/QtXml>
#include <QtGui/QMenu>
#include <QtGui/QToolButton>
#include <QtGui/QCloseEvent>
#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 ) ),

View File

@@ -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 )
{

View File

@@ -39,6 +39,8 @@
#include <qlayout.h>
#include <qtable.h>
#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 );

View File

@@ -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

View File

@@ -99,9 +99,10 @@ note::~note()
{
if( m_detuning )
{
if( m_detuning->data().toInt() )
knob::autoObj * o = dynamic_cast<knob::autoObj *>( 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<knob::autoObj *>( 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<knob::autoObj *>( 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" );

View File

@@ -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;
}

View File

@@ -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

View File

@@ -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++;
}

View File

@@ -35,6 +35,7 @@
#else
#include <qdom.h>
#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<Sint32>( 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"

View File

@@ -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 );

View File

@@ -35,6 +35,10 @@
#include "rename_dialog.h"
#include "main_window.h"
#ifndef QT3
#include <QtGui/QMouseEvent>
#endif
effectLabel::effectLabel( const QString & _initial_name,
QWidget * _parent,

View File

@@ -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 )
{

View File

@@ -28,7 +28,7 @@
#ifdef QT4
#include <QTCore/QString>
#include <QtCore/QString>
#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 ) ) );

View File

@@ -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(

View File

@@ -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<rackPlugin *>::iterator loc = NULL;
for( vvector<rackPlugin *>::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<rackPlugin *>::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<rackPlugin *>::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++;
}
}

View File

@@ -37,6 +37,7 @@
#include <QtGui/QApplication>
#include <QtGui/QInputDialog>
#include <QtGui/QMouseEvent>
#else