Skip to content

Commit

Permalink
- find readline on OS X (configure)
Browse files Browse the repository at this point in the history
- added VisualizationWidget to the ext project pro file
- neutered the SoQt stuff on OSX until we get it working
- added -framework Carbon and -lz to systemimpl for OS X compatibilty with Qt

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@3699 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
ericmeyers committed Oct 19, 2008
1 parent a67e34a commit 11f38e0
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 5 deletions.
24 changes: 22 additions & 2 deletions OMNotebook/3Dpkg/VisualizationWidget.cpp
Expand Up @@ -4,6 +4,7 @@ namespace IAEX {

VisualizationWidget::VisualizationWidget(QWidget *parent) : QWidget(parent)
{
#ifndef __APPLE_CC__
this->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
this->setMinimumHeight(300);
this->setMinimumWidth(500);
Expand Down Expand Up @@ -68,7 +69,7 @@ namespace IAEX {
server = new QTcpServer(this);
server->setMaxPendingConnections(500);
activeSocket = 0;

#endif

}

Expand All @@ -77,14 +78,17 @@ namespace IAEX {
}

void VisualizationWidget::sliderChanged(int val) {
#ifndef __APPLE_CC__
currentTime_ = val;
QString num;
num.setNum(currentTime_/1000.0);
label_->setText(num);
simdata_->setFrame(currentTime_/1000.0);
#endif
}

void VisualizationWidget::nextFrame() {
#ifndef __APPLE_CC__
currentTime_ += 25; // FIIIIX!
if (currentTime_ > 1000*simdata_->get_end_time()) {
currentTime_ = 0;
Expand All @@ -95,10 +99,12 @@ namespace IAEX {
label_->setText(num);
slider_->setValue(currentTime_);
simdata_->setFrame(currentTime_/1000.0);
#endif
}

void VisualizationWidget::setServerState(bool listen)
{
#ifndef __APPLE_CC__
if(listen)
{

Expand Down Expand Up @@ -141,15 +147,21 @@ namespace IAEX {
emit newMessage("Port closed");
emit serverState(false);
}
#endif
}

bool VisualizationWidget::getServerState()
{
#ifndef __APPLE_CC__
return server->isListening();
#else
return 0;
#endif
}

void VisualizationWidget::acceptConnection()
{
#ifndef __APPLE_CC__
while(server && server->hasPendingConnections())
{
if( (activeSocket && (activeSocket->state() == QAbstractSocket::UnconnectedState) || !activeSocket))
Expand All @@ -168,9 +180,11 @@ namespace IAEX {

qApp->processEvents();
}
#endif
}

void VisualizationWidget::getData() {
#ifndef __APPLE_CC__
disconnect(activeSocket, SIGNAL(readyRead()), 0, 0);
connect(activeSocket, SIGNAL(readyRead()), this, SLOT(getData()));

Expand Down Expand Up @@ -215,11 +229,13 @@ namespace IAEX {
}

connect(activeSocket, SIGNAL(readyRead()), this, SLOT(getData()));
#endif
}



void VisualizationWidget::readPtolemyDataStream() {
#ifndef __APPLE_CC__
QString tmp;
//qint32 variableCount = 0;
// qint32 packetSize = 0;
Expand Down Expand Up @@ -322,9 +338,11 @@ namespace IAEX {

if(activeSocket->state() != QAbstractSocket::ConnectedState)
ptolemyDataStreamClosed();
#endif
}

void VisualizationWidget::ptolemyDataStreamClosed() {
#ifndef __APPLE_CC__
slider_->setRange(1000*simdata_->get_start_time(), 1000*simdata_->get_end_time());
slider_->setValue(0);
//for(map<QString, VariableData*>::iterator i = variables.begin(); i != variables.end(); ++i)
Expand All @@ -336,5 +354,7 @@ namespace IAEX {
cam->viewAll(simdata_->getSceneGraph(), eviewer_->getViewportRegion());

emit newMessage("Connection closed");
}
#endif
}

}
4 changes: 4 additions & 0 deletions OMNotebook/3Dpkg/VisualizationWidget.h
Expand Up @@ -14,6 +14,7 @@
#include <QtGui/QMessageBox>
#include <QtGui/QApplication>

#ifndef __APPLE_CC__
#include <Inventor/Qt/SoQt.h>
#include <Inventor/Qt/SoQtRenderArea.h>
#include <Inventor/Qt/viewers/SoQtExaminerViewer.h>
Expand All @@ -24,6 +25,7 @@
#include <Inventor/nodes/SoSeparator.h>
#include <Inventor/nodes/SoDirectionalLight.h>
#include <Inventor/nodes/SoPerspectiveCamera.h>
#endif

#include "SimulationData.h"

Expand Down Expand Up @@ -54,8 +56,10 @@ namespace IAEX {
void ptolemyDataStreamClosed();

private:
#ifndef __APPLE_CC__
SoQtExaminerViewer *eviewer_;
SoQtRenderArea *renderarea_;
#endif
QFrame *frame_;
QSlider *slider_;
QLabel *label_;
Expand Down
3 changes: 2 additions & 1 deletion OMNotebook/Pltpkg2/compoundWidget.cpp
Expand Up @@ -89,8 +89,9 @@ CompoundWidget::CompoundWidget(QWidget* parent): QWidget(parent)
gwMain->compoundwidget = this;

//Initialize SoQT
#ifndef __APPLE_CC__
SoQt::init(this);

#endif
visWidget = new IAEX::VisualizationWidget(this);
visWidget->hide();

Expand Down
7 changes: 5 additions & 2 deletions OMNotebook/ext/ext.pro
Expand Up @@ -27,7 +27,9 @@ HEADERS += ../Pltpkg2/legendLabel.h \
../Pltpkg2/preferenceWindow.h \
../Pltpkg2/variableData.h \
../Pltpkg2/verticalLabel.h \
../Pltpkg2/variablewindow.h
../Pltpkg2/variablewindow.h \
../3Dpkg/VisualizationWidget.h


SOURCES += e.cpp \
../Pltpkg2/compoundWidget.cpp \
Expand All @@ -41,7 +43,8 @@ SOURCES += e.cpp \
../Pltpkg2/lineGroup.cpp \
../Pltpkg2/preferenceWindow.cpp \
../Pltpkg2/variableData.cpp \
../Pltpkg2/variablewindow.cpp
../Pltpkg2/variablewindow.cpp \
../3Dpkg/VisualizationWidget.cpp

FORMS += ../Pltpkg2/compoundWidget.ui\
../Pltpkg2/dataSelect.ui\
Expand Down

0 comments on commit 11f38e0

Please sign in to comment.