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

@@ -26,15 +26,17 @@
*/
#include "qt3support.h"
#ifdef QT4
#include <QtCore/QString>
#include <QtGui/QLabel>
#include <QtGui/QBoxLayout>
#else
#include <qhbox.h>
#include <qlayout.h>
#include <qlabel.h>
#include <qstring.h>
@@ -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: " ) +

View File

@@ -23,7 +23,13 @@
*/
#ifdef QT3
#include "qt3support.h"
#ifndef QT3
#include <QtGui/QKeyEvent>
#else
#include <qwhatsthis.h>
@@ -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
}

View File

@@ -23,9 +23,12 @@
*/
#include "qt3support.h"
#ifdef QT4
#include <QtGui/QFileDialog>
#include <QtGui/QDragEnterEvent>
#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" );

View File

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

View File

@@ -23,6 +23,8 @@
*/
#include "qt3support.h"
#ifdef QT4
#include <QtCore/QDir>
@@ -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
}
}

View File

@@ -26,7 +26,6 @@
#ifndef _SINGERBOT_H
#define _SINGERBOT_H
#ifdef QT4
#include <QtCore/QThread>
@@ -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
}