Skip to content
Open
18 changes: 13 additions & 5 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ env.Replace( LIBS="" )
env.Replace( LIBPATH="" )

# DEBUG:
env['CXXFLAGS']+="-Wall -Werror -g -fpic"
#env['CXXFLAGS']+="-Wall -Werror -g -fpic"
# RELEASE:
env['CXXFLAGS']+="-fpic"

def CheckPKGConfig( context, pkgname, version="", all=False ):
import SCons.Util, os, string
Expand Down Expand Up @@ -60,16 +62,18 @@ def CheckPKGConfig( context, pkgname, version="", all=False ):

conf = Configure( env, custom_tests={'CheckPKGConfig' : CheckPKGConfig }, conf_dir='.cache', log_file='.cache/config.log' )
conf.CheckPKGConfig( 'QtCore', "4.2", True )
conf.CheckPKGConfig( 'QtGui', "4.2", True )
conf.CheckPKGConfig( 'QtGui', "4.2" )
conf.CheckPKGConfig( 'QtNetwork', "4.2", True )
#conf.CheckPKGConfig( 'liblo', "0", True )

env = conf.Finish()

env['PREFIX'] = ARGUMENTS.get('PREFIX', '/usr/local')

if not env.has_key('PREFIX'):
print "No Prefix set! Will assume /usr/local. To change it use 'scons PREFIX=...'"
if not ARGUMENTS.has_key('PREFIX'):
print """\
\nNo Prefix set! Will assume /usr/local. To change it use 'scons PREFIX=<path>'
Note that <ou have to use this everytime as it is not cached currently.
"""
env['PREFIX'] = '/usr/local'

env['PREFIX_BIN'] = env['PREFIX'] + "/bin"
Expand All @@ -92,7 +96,11 @@ env['QT_UICCOM'] = [
CLVar('touch ${TARGETS[2]}')]

## target processing is done in the subdirectory
<<<<<<< HEAD
env.SConscript( dirs=['libofqf','oscqlient','oscserver','qtuiobleep','talk-examples'], exports="env" )
=======
env.SConscript( dirs=['libofqf','oscqlient','oscserver'], exports="env" )
>>>>>>> 2412c7ac0514b4bd324f537fd7a716127142df68

pkgconfig = env.ScanReplace('ofqf.pc.in')
env.Install( env['PREFIX_LIB'] + '/pkgconfig', pkgconfig )
Expand Down
22 changes: 10 additions & 12 deletions libofqf/qoscserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,27 @@

#include "qoscserver.h"

#include <QtCore/QDebug>
//#include <QtCore/QDebug>
#include <QtCore/QRegExp>
#include <QtNetwork/QUdpSocket>

QOscServer::QOscServer( quint16 port, QObject* p )
: QOscBase( p )
{
qDebug() << "QOscServer::QOscServer(" << port << "," << p << ")";
qDebug() << " socket() gives" << socket();
//qDebug() << "QOscServer::QOscServer(" << port << "," << p << ")";
//qDebug() << " socket() gives" << socket();
socket()->bind( QHostAddress::Any, port );
connect( socket(), SIGNAL( readyRead() ), this, SLOT( readyRead() ) );
}
QOscServer::QOscServer( QHostAddress address, quint16 port, QObject* p )
: QOscBase( p )
{
qDebug() << "QOscServer::QOscServer(" << address << "," << port << "," << p << ")";
//qDebug() << "QOscServer::QOscServer(" << address << "," << port << "," << p << ")";
socket()->bind( address, port );
}

QOscServer::~QOscServer() {
qDebug() << "QOscServer::~QOscServer()";
//qDebug() << "QOscServer::~QOscServer()";
}

void QOscServer::registerPathObject( PathObject* p ) {
Expand All @@ -51,15 +51,12 @@ void QOscServer::unregisterPathObject( PathObject* p ) {
#define BUFFERSIZE 255

void QOscServer::readyRead() {
qDebug() << "QOscServer::readyRead()";
//qDebug() << "QOscServer::readyRead()";
while ( socket()->hasPendingDatagrams() ) {
QByteArray data( BUFFERSIZE, char( 0 ) );
//data.resize( BUFFERSIZE );
int size = socket()->readDatagram( data.data(), BUFFERSIZE );
qDebug() << " read" << size << "(" << data.size() << ") bytes:" << data;
//qDebug() << " read" << size << "(" << data.size() << ") bytes:" << data;

//for ( int i=0; i<size; ++i )
// qDebug() << i << "\t" << static_cast<quint8*>( static_cast<void*>( data.data() ) )[ i ];
QString path;
QString args;
QVariant arguments;
Expand Down Expand Up @@ -109,7 +106,7 @@ void QOscServer::readyRead() {
arguments = list;
}
}
qDebug() << "path seems to be" << path << "args are" << args << ":" << arguments;
//qDebug() << "path seems to be" << path << "args are" << args << ":" << arguments;

QMap<QString,QString> replacements;
replacements[ "!" ] = "^";
Expand All @@ -122,13 +119,14 @@ void QOscServer::readyRead() {
foreach( QString rep, replacements.keys() )
path.replace( rep, replacements[ rep ] );

qDebug() << " after transformation to OSC-RegExp path is" << path;
//qDebug() << " after transformation to OSC-RegExp path is" << path;

QRegExp exp( path );
foreach( PathObject* obj, paths ) {
if ( exp.exactMatch( obj->_path ) )
obj->signalData( arguments );
}
emit receive( path, arguments );
}
}

2 changes: 1 addition & 1 deletion libofqf/qoscserver.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class QOscServer : public QOscBase
void setSocket( QUdpSocket* ) {}

signals:
void data( QString path, QVariant data );
void receive( QString & path, QVariant & data );

private slots:
void readyRead();
Expand Down
8 changes: 7 additions & 1 deletion ofqf.pc.in
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
# This is a comment
prefix=$PREFIX # this defines a variable
<<<<<<< HEAD
exec_prefix=${PREFIX_BIN} # defining another variable in terms of the first
libdir=${PREFIX_LIB}
includedir=${PREFIX_INC}
=======
exec_prefix=${PREFIX} # defining another variable in terms of the first
libdir=${PREFIX}/lib
includedir=${PREFIX}/include/ofqf
>>>>>>> 2412c7ac0514b4bd324f537fd7a716127142df68

Name: libofqf # human-readable name
Description: Native OSC for Qt4 # human-readable description
Version: 0.1
Version: 0.1.2
URL: http://www.arnoldarts.de/drupal/?q=ofqf
Requires: QtNetwork >= 4.2 QtCore >= 4.2
#Conflicts: foobar <= 4.5
Expand Down