--- /dev/null
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>FPublisher</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>FPublisher</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>389</width>
+ <height>254</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Publisher</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="MyQFrame">
+ <property name="name">
+ <cstring>view</cstring>
+ </property>
+ <property name="paletteBackgroundColor">
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout33</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QSplitter">
+ <property name="name">
+ <cstring>splitter2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>strengt</cstring>
+ </property>
+ <property name="text">
+ <string>Strength:</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>46</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </widget>
+ <widget class="QSlider">
+ <property name="name">
+ <cstring>slider</cstring>
+ </property>
+ <property name="minValue">
+ <number>1</number>
+ </property>
+ <property name="maxValue">
+ <number>5</number>
+ </property>
+ <property name="pageStep">
+ <number>10</number>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="tickmarks">
+ <enum>NoMarks</enum>
+ </property>
+ <property name="tickInterval">
+ <number>1</number>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>122</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<customwidgets>
+ <customwidget>
+ <class>MyQFrame</class>
+ <header location="global">MyQFrame.h</header>
+ <sizehint>
+ <width>-1</width>
+ <height>-1</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ </customwidget>
+</customwidgets>
+<images>
+ <image name="image0">
+ <data format="XPM.GZ" length="45">789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523250004143a55a6b2e0026630c4f</data>
+ </image>
+</images>
+<connections>
+ <connection>
+ <sender>slider</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>FPublisher</receiver>
+ <slot>strengthChanged()</slot>
+ </connection>
+</connections>
+<includes>
+ <include location="global" impldecl="in declaration">orte_api.h</include>
+ <include location="local" impldecl="in declaration">ortedemo_types.h</include>
+ <include location="local" impldecl="in implementation">FPublisher.ui.h</include>
+</includes>
+<variables>
+ <variable>int strength;</variable>
+ <variable>ORTEPublication *publisher;</variable>
+ <variable>ORTEDomain *domain;</variable>
+ <variable access="public">QTimer *timer;</variable>
+ <variable>int color;</variable>
+ <variable>int stepx;</variable>
+ <variable>int stepy;</variable>
+ <variable>int incx;</variable>
+ <variable>int incy;</variable>
+ <variable>int shape;</variable>
+ <variable>BoxType boxType;</variable>
+ <variable>QRect rect;</variable>
+</variables>
+<slots>
+ <slot access="protected">init()</slot>
+ <slot access="protected">closeEvent( QCloseEvent * e )</slot>
+ <slot>destroy()</slot>
+ <slot access="protected">Timer()</slot>
+ <slot access="protected">strengthChanged()</slot>
+</slots>
+<functions>
+ <function>initPublisher( int icolor, int istrength )</function>
+</functions>
+<pixmapinproject/>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>myqframe.h</includehint>
+</includehints>
+</UI>
--- /dev/null
+/****************************************************************************
+** ui.h extension file, included from the uic-generated form implementation.
+**
+** If you wish to add, delete or rename functions or slots use
+** Qt Designer which will update this file, preserving your code. Create an
+** init() function in place of a constructor, and a destroy() function in
+** place of a destructor.
+*****************************************************************************/
+#include <stdio.h>
+#include <stdlib.h>
+#include <qtimer.h>
+
+void FPublisher::init()
+{
+ stepx=rand()%2+1;stepy=rand()%2+1;
+ incx=incy=0;
+ while(incx==0) incx=(rand()%3-1)*stepx;
+ while(incy==0) incy=(rand()%3-1)*stepy;
+ rect.setRect(0,0,25,45);
+ ORTEInit();
+ domain=ORTEDomainAppCreate(ORTE_DEFAULT_DOMAIN,NULL,NULL,ORTE_FALSE);
+ ORTETypeRegisterBoxType(domain);
+ publisher=NULL;
+}
+
+void FPublisher::initPublisher(int icolor,int istrength)
+{
+ NtpTime persistence;
+ QString topic;
+
+ color=icolor;
+ strength=istrength;
+ boxType.color=color;
+ boxType.shape=strength;
+ timer = new QTimer(this);
+ connect( timer, SIGNAL(timeout()), SLOT(Timer()));
+ timer->start( 50, FALSE );
+ view->activateObject(0,color,strength);//color,shape
+ NtpTimeAssembFromMs(persistence, 5, 0);
+ switch(color) {
+ case 0:topic="Blue";break;
+ case 1:topic="Green";break;
+ case 2:topic="Red";break;
+ case 3:topic="Black";break;
+ case 4:topic="Yellow";break;
+ }
+ publisher=ORTEPublicationCreate(
+ domain,
+ topic,
+ "BoxType",
+ &boxType,
+ &persistence,
+ strength,
+ NULL,
+ NULL,
+ NULL);
+}
+
+void FPublisher::closeEvent( QCloseEvent *e )
+{
+ destroy();
+ e->accept();
+}
+
+void FPublisher::destroy()
+{
+ if (domain) {
+ delete timer;
+ ORTEDomainAppDestroy(domain);
+ domain=NULL;
+ }
+}
+
+void FPublisher::Timer()
+{
+ if(rect.left()<=0) incx=stepx;
+ if(rect.top()<=0) incy=stepy;
+ if((rect.right())>=view->width()) incx=-stepx;
+ if((rect.bottom())>=view->height()) incy=-stepy;
+ if(view->mousePressed==1) {
+ int tmpW=rect.width();
+ int tmpH=rect.height();
+ rect.setRect(view->mouseX-tmpW/2,view->mouseY-tmpH/2,tmpW,tmpH);
+ } else {
+ rect.moveBy(incx,incy);
+ }
+ view->setPosition(0,rect);
+ //prepare published data
+ boxType.rectangle.top_left_x=rect.left();
+ boxType.rectangle.top_left_y=rect.top();
+ boxType.rectangle.bottom_right_x=rect.right();
+ boxType.rectangle.bottom_right_y=rect.bottom();
+ ORTEPublicationSend(publisher);
+}
+
+
+void FPublisher::strengthChanged()
+{
+ ORTEPublProp pp;
+
+ if (!publisher) return;
+ ORTEPublicationPropertiesGet(publisher,&pp);
+ pp.strength=slider->value();
+ ORTEPublicationPropertiesSet(publisher,&pp);
+}
--- /dev/null
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>FSubscriber</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>FSubscriber</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>389</width>
+ <height>331</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Subscriber</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="MyQFrame" row="0" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>view</cstring>
+ </property>
+ <property name="paletteBackgroundColor">
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </property>
+ </widget>
+ <widget class="QSplitter" row="1" column="0">
+ <property name="name">
+ <cstring>splitter2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Color:</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer3_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </widget>
+ <widget class="QSplitter" row="2" column="0">
+ <property name="name">
+ <cstring>splitter3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>strengt</cstring>
+ </property>
+ <property name="text">
+ <string>Min. Separation:</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ </widget>
+ <widget class="QComboBox" row="1" column="1">
+ <property name="name">
+ <cstring>combo</cstring>
+ </property>
+ </widget>
+ <widget class="QSlider" row="2" column="1">
+ <property name="name">
+ <cstring>slider</cstring>
+ </property>
+ <property name="minValue">
+ <number>0</number>
+ </property>
+ <property name="maxValue">
+ <number>4</number>
+ </property>
+ <property name="pageStep">
+ <number>1</number>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="tickmarks">
+ <enum>NoMarks</enum>
+ </property>
+ <property name="tickInterval">
+ <number>1</number>
+ </property>
+ </widget>
+ <spacer row="1" column="2">
+ <property name="name">
+ <cstring>spacer4_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>110</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <spacer row="2" column="2">
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>100</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+</widget>
+<customwidgets>
+ <customwidget>
+ <class>MyQFrame</class>
+ <header location="global">MyQFrame.h</header>
+ <sizehint>
+ <width>-1</width>
+ <height>-1</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ </customwidget>
+</customwidgets>
+<images>
+ <image name="image0">
+ <data format="XPM.GZ" length="45">789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523250004143a55a6b2e0026630c4f</data>
+ </image>
+</images>
+<connections>
+ <connection>
+ <sender>combo</sender>
+ <signal>activated(int)</signal>
+ <receiver>FSubscriber</receiver>
+ <slot>comboActivated(int)</slot>
+ </connection>
+ <connection>
+ <sender>slider</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>FSubscriber</receiver>
+ <slot>sliderValueChanged(int)</slot>
+ </connection>
+</connections>
+<includes>
+ <include location="global" impldecl="in declaration">orte_api.h</include>
+ <include location="global" impldecl="in declaration">pthread.h</include>
+ <include location="local" impldecl="in declaration">ortedemo_types.h</include>
+ <include location="local" impldecl="in implementation">FSubscriber.ui.h</include>
+</includes>
+<variables>
+ <variable access="public">BoxType boxTypeYellow;</variable>
+ <variable access="public">BoxType boxTypeBlack;</variable>
+ <variable access="public">BoxType boxTypeRed;</variable>
+ <variable access="public">BoxType boxTypeBlue;</variable>
+ <variable access="public">BoxType boxTypeGreen;</variable>
+ <variable access="public">ORTEDomain *domain;</variable>
+ <variable>ORTESubscription *subscriberGreen;</variable>
+ <variable>ORTESubscription *subscriberBlue;</variable>
+ <variable>ORTESubscription *subscriberRed;</variable>
+ <variable>ORTESubscription *subscriberBlack;</variable>
+ <variable>ORTESubscription *subscriberYellow;</variable>
+ <variable>NtpTime msGreen;</variable>
+ <variable>NtpTime msBlue;</variable>
+ <variable>NtpTime msRed;</variable>
+ <variable>NtpTime msBlack;</variable>
+ <variable>NtpTime msYellow;</variable>
+ <variable access="public">pthread_mutex_t mutex;</variable>
+</variables>
+<slots>
+ <slot access="protected">init()</slot>
+ <slot access="protected">closeEvent( QCloseEvent * e )</slot>
+ <slot>destroy()</slot>
+ <slot>comboActivated( int )</slot>
+ <slot>sliderValueChanged( int value )</slot>
+</slots>
+<functions>
+ <function>initSubscribers( int iBlue, int iGreen, int iRed, int iBlack, int iYellow )</function>
+</functions>
+<pixmapinproject/>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>myqframe.h</includehint>
+</includehints>
+</UI>
--- /dev/null
+/****************************************************************************
+** ui.h extension file, included from the uic-generated form implementation.
+**
+** If you wish to add, delete or rename functions or slots use
+** Qt Designer which will update this file, preserving your code. Create an
+** init() function in place of a constructor, and a destroy() function in
+** place of a destructor.
+*****************************************************************************/
+#include <stdio.h>
+#include <qtimer.h>
+
+void FSubscriber::init()
+{
+ ORTEInit();
+ domain=ORTEDomainAppCreate(ORTE_DEFAULT_DOMAIN,NULL,NULL,ORTE_FALSE);
+ ORTETypeRegisterBoxType(domain);
+ subscriberBlue=subscriberGreen=subscriberRed=NULL;
+ subscriberBlack=subscriberYellow=NULL;
+ pthread_mutex_init(&mutex,NULL);
+}
+
+void FSubscriber::closeEvent( QCloseEvent *e )
+{
+ destroy();
+ e->accept();
+}
+
+void FSubscriber::destroy()
+{
+ if (domain) {
+ ORTEDomainAppDestroy(domain);
+ domain=NULL;
+ pthread_mutex_destroy(&mutex);
+ }
+}
+
+void
+recvCallBack(const ORTERecvInfo *info,void *vinstance, void *recvCallBackParam) {
+ BoxType *boxType=(BoxType*)vinstance;
+ FSubscriber *s=(FSubscriber*)recvCallBackParam;
+ QRect rect;
+
+ switch (info->status) {
+ case NEW_DATA:
+ pthread_mutex_lock(&s->mutex);
+ rect.setCoords(
+ boxType->rectangle.top_left_x,
+ boxType->rectangle.top_left_y,
+ boxType->rectangle.bottom_right_x,
+ boxType->rectangle.bottom_right_y);
+ s->view->activateObject(boxType->color,boxType->color,boxType->shape);
+ s->view->setPosition(boxType->color,rect);
+ pthread_mutex_unlock(&s->mutex);
+ break;
+ case DEADLINE:
+ if (strcmp(info->topic,"Blue")==0)
+ s->view->deactivateObject(0);
+ if (strcmp(info->topic,"Green")==0)
+ s->view->deactivateObject(1);
+ if (strcmp(info->topic,"Red")==0)
+ s->view->deactivateObject(2);
+ if (strcmp(info->topic,"Black")==0)
+ s->view->deactivateObject(3);
+ if (strcmp(info->topic,"Yellow")==0)
+ s->view->deactivateObject(4);
+ break;
+ }
+}
+
+
+void FSubscriber::initSubscribers( int iBlue, int iGreen, int iRed, int iBlack, int iYellow )
+{
+ NtpTime deadline;
+
+ NtpTimeAssembFromMs(msBlue, 0, 0);
+ NtpTimeAssembFromMs(msGreen, 0, 0);
+ NtpTimeAssembFromMs(msRed, 0, 0);
+ NtpTimeAssembFromMs(msBlack, 0, 0);
+ NtpTimeAssembFromMs(msYellow, 0, 0);
+ NtpTimeAssembFromMs(deadline, 6, 0);
+ if (iBlue) {
+ subscriberBlue=ORTESubscriptionCreate(
+ domain,
+ IMMEDIATE,
+ BEST_EFFORTS,
+ "Blue",
+ "BoxType",
+ &boxTypeBlue,
+ &deadline,
+ &msBlue,
+ recvCallBack,
+ this);
+ combo->insertItem("Blue",combo->count());
+ }
+ if (iGreen) {
+ subscriberGreen=ORTESubscriptionCreate(
+ domain,
+ IMMEDIATE,
+ BEST_EFFORTS,
+ "Green",
+ "BoxType",
+ &boxTypeGreen,
+ &deadline,
+ &msGreen,
+ recvCallBack,
+ this);
+ combo->insertItem("Green",combo->count());
+ }
+ if (iRed) {
+ subscriberRed=ORTESubscriptionCreate(
+ domain,
+ IMMEDIATE,
+ BEST_EFFORTS,
+ "Red",
+ "BoxType",
+ &boxTypeRed,
+ &deadline,
+ &msRed,
+ recvCallBack,
+ this);
+ combo->insertItem("Red",combo->count());
+ }
+ if (iBlack) {
+ subscriberBlack=ORTESubscriptionCreate(
+ domain,
+ IMMEDIATE,
+ BEST_EFFORTS,
+ "Black",
+ "BoxType",
+ &boxTypeBlack,
+ &deadline,
+ &msBlack,
+ recvCallBack,
+ this);
+ combo->insertItem("Black",combo->count());
+ }
+ if (iYellow) {
+ subscriberYellow=ORTESubscriptionCreate(
+ domain,
+ IMMEDIATE,
+ BEST_EFFORTS,
+ "Yellow",
+ "BoxType",
+ &boxTypeYellow,
+ &deadline,
+ &msYellow,
+ recvCallBack,
+ this);
+ combo->insertItem("Yellow",combo->count());
+ }
+}
+
+
+void FSubscriber::comboActivated( int )
+{
+ if (combo->currentText()==QString("Blue"))
+ slider->setValue(msBlue.seconds);
+ if (combo->currentText()==QString("Green"))
+ slider->setValue(msGreen.seconds);
+ if (combo->currentText()==QString("Red"))
+ slider->setValue(msRed.seconds);
+ if (combo->currentText()==QString("Black"))
+ slider->setValue(msBlack.seconds);
+ if (combo->currentText()==QString("Yellow"))
+ slider->setValue(msYellow.seconds);
+}
+
+
+void FSubscriber::sliderValueChanged( int value)
+{
+ NtpTime minSep;
+ ORTESubsProp sp;
+
+ NtpTimeAssembFromMs(minSep, value, 0);
+ if (combo->currentText()==QString("Blue")) {
+ msBlue=minSep;
+ ORTESubscriptionPropertiesGet(subscriberBlue,&sp);
+ sp.minimumSeparation=msBlue;
+ ORTESubscriptionPropertiesSet(subscriberBlue,&sp);
+ }
+ if (combo->currentText()==QString("Green")) {
+ msGreen=minSep;
+ ORTESubscriptionPropertiesGet(subscriberGreen,&sp);
+ sp.minimumSeparation=msGreen;
+ ORTESubscriptionPropertiesSet(subscriberGreen,&sp);
+ }
+ if (combo->currentText()==QString("Red")) {
+ msRed=minSep;
+ ORTESubscriptionPropertiesGet(subscriberRed,&sp);
+ sp.minimumSeparation=msRed;
+ ORTESubscriptionPropertiesSet(subscriberRed,&sp);
+ }
+ if (combo->currentText()==QString("Black")) {
+ msBlack=minSep;
+ ORTESubscriptionPropertiesGet(subscriberBlack,&sp);
+ sp.minimumSeparation=msBlack;
+ ORTESubscriptionPropertiesSet(subscriberBlack,&sp);
+ }
+ if (combo->currentText()==QString("Yellow")) {
+ msYellow=minSep;
+ ORTESubscriptionPropertiesGet(subscriberYellow,&sp);
+ sp.minimumSeparation=msYellow;
+ ORTESubscriptionPropertiesSet(subscriberYellow,&sp);
+ }
+}
--- /dev/null
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>MainForm</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>MainForm</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>500</width>
+ <height>325</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>ORTE demo application</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout18</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <pointsize>18</pointsize>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string><p align="center">Publishers</p></string>
+ </property>
+ </widget>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>publGroup</cstring>
+ </property>
+ <property name="title">
+ <string>Colors</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget" row="0" column="0">
+ <property name="name">
+ <cstring>layout11</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>radioButton2_2</cstring>
+ </property>
+ <property name="text">
+ <string>Blue</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>radioButton2_3</cstring>
+ </property>
+ <property name="text">
+ <string>Green</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>radioButton2_4</cstring>
+ </property>
+ <property name="text">
+ <string>Red</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>radioButton1</cstring>
+ </property>
+ <property name="text">
+ <string>Black</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>radioButton2</cstring>
+ </property>
+ <property name="text">
+ <string>Yellow</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer9</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>pubAdd</cstring>
+ </property>
+ <property name="text">
+ <string>Add</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>pubSource</cstring>
+ </property>
+ <property name="text">
+ <string>View Source</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer12_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout25</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout22</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer10</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>pixmapLabel1</cstring>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32767</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="pixmap">
+ <pixmap>ocera_logo.png</pixmap>
+ </property>
+ <property name="scaledContents">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer11</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer13</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>167</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout24</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer14</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>About</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>140</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>About</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer15</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer13_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout19</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <pointsize>18</pointsize>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string><p align="center">Subscribers</p></string>
+ </property>
+ </widget>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>subGrupColors</cstring>
+ </property>
+ <property name="title">
+ <string>Colors</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget" row="0" column="0">
+ <property name="name">
+ <cstring>layout12</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>clBlue</cstring>
+ </property>
+ <property name="text">
+ <string>Blue</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>clGreen</cstring>
+ </property>
+ <property name="text">
+ <string>Green</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>clRed</cstring>
+ </property>
+ <property name="text">
+ <string>Red</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>clBlack</cstring>
+ </property>
+ <property name="text">
+ <string>Black</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>clYellow</cstring>
+ </property>
+ <property name="text">
+ <string>Yellow</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer12</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>subAdd</cstring>
+ </property>
+ <property name="text">
+ <string>Add</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>subSource</cstring>
+ </property>
+ <property name="text">
+ <string>View Source</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ </hbox>
+</widget>
+<connections>
+ <connection>
+ <sender>About</sender>
+ <signal>clicked()</signal>
+ <receiver>MainForm</receiver>
+ <slot>about()</slot>
+ </connection>
+ <connection>
+ <sender>subSource</sender>
+ <signal>clicked()</signal>
+ <receiver>MainForm</receiver>
+ <slot>viewSubsSource()</slot>
+ </connection>
+ <connection>
+ <sender>pubAdd</sender>
+ <signal>clicked()</signal>
+ <receiver>MainForm</receiver>
+ <slot>addPublisher()</slot>
+ </connection>
+ <connection>
+ <sender>pubSource</sender>
+ <signal>clicked()</signal>
+ <receiver>MainForm</receiver>
+ <slot>viewPublSource()</slot>
+ </connection>
+ <connection>
+ <sender>subAdd</sender>
+ <signal>clicked()</signal>
+ <receiver>MainForm</receiver>
+ <slot>addSubscriber()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>radioButton1</tabstop>
+ <tabstop>radioButton2</tabstop>
+ <tabstop>pubAdd</tabstop>
+ <tabstop>pubSource</tabstop>
+ <tabstop>subAdd</tabstop>
+ <tabstop>subSource</tabstop>
+ <tabstop>clBlue</tabstop>
+ <tabstop>clGreen</tabstop>
+ <tabstop>radioButton2_2</tabstop>
+ <tabstop>radioButton2_3</tabstop>
+ <tabstop>radioButton2_4</tabstop>
+ <tabstop>About</tabstop>
+ <tabstop>clRed</tabstop>
+ <tabstop>clBlack</tabstop>
+ <tabstop>clYellow</tabstop>
+</tabstops>
+<includes>
+ <include location="local" impldecl="in implementation">MainForm.ui.h</include>
+</includes>
+<signals>
+ <signal>sigClose()</signal>
+</signals>
+<slots>
+ <slot>addPublisher()</slot>
+ <slot>addSubscriber()</slot>
+ <slot>about()</slot>
+ <slot>viewPublSource()</slot>
+ <slot>viewSubsSource()</slot>
+ <slot access="protected">closeEvent( QCloseEvent * e )</slot>
+</slots>
+<pixmapinproject/>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
--- /dev/null
+/****************************************************************************
+** ui.h extension file, included from the uic-generated form implementation.
+**
+** If you wish to add, delete or rename functions or slots use
+** Qt Designer which will update this file, preserving your code. Create an
+** init() function in place of a constructor, and a destroy() function in
+** place of a destructor.
+*****************************************************************************/
+#include <qmessagebox.h>
+#include <qapplication.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <qptrlist.h>
+#include "FPublisher.h"
+#include "FSubscriber.h"
+#include "richtext.h"
+
+
+void MainForm::addPublisher()
+{
+
+ FPublisher *fp;
+ fp = new FPublisher(this);
+ fp->initPublisher(publGroup->id(publGroup->selected()),rand()%3);
+ fp->show();
+}
+
+void MainForm::addSubscriber()
+{
+ FSubscriber *fs;
+ fs = new FSubscriber(this);
+ fs->initSubscribers(
+ clBlue->isChecked(),
+ clGreen->isChecked(),
+ clRed->isChecked(),
+ clBlack->isChecked(),
+ clYellow->isChecked());
+ fs->show();
+}
+
+void MainForm::about()
+{
+ QMessageBox::about( this, "ORTE application demo",
+ "This application demonstrates use of ORTE library\n\n"
+ "Petr Smolik (c) 2004\n"
+ "OCERA team");
+}
+
+void MainForm::viewPublSource()
+{
+ MyRichText *richtext;
+ richtext=new MyRichText;
+ richtext->resize( 450, 350 );
+ richtext->setCaption( "Publisher example" );
+ richtext->setTextPublisher();
+ richtext->show();
+}
+
+void MainForm::viewSubsSource()
+{
+ MyRichText *richtext;
+ richtext=new MyRichText;
+ richtext->resize( 450, 350 );
+ richtext->setCaption( "Subscriber example" );
+ richtext->setTextSubscriber();
+ richtext->show();
+}
+
+void MainForm::closeEvent( QCloseEvent *e )
+{
+ sigClose();
+ e->accept();
+}
+++ /dev/null
-<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
-<class>MulticlipForm</class>
-<widget class="QDialog">
- <property name="name">
- <cstring>MulticlipForm</cstring>
- </property>
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>614</width>
- <height>314</height>
- </rect>
- </property>
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>614</width>
- <height>315</height>
- </size>
- </property>
- <property name="font">
- <font>
- </font>
- </property>
- <property name="caption">
- <string>ORTE Demo</string>
- </property>
- <widget class="Line">
- <property name="name">
- <cstring>Line2_2</cstring>
- </property>
- <property name="geometry">
- <rect>
- <x>360</x>
- <y>10</y>
- <width>20</width>
- <height>300</height>
- </rect>
- </property>
- <property name="frameShape">
- <enum>VLine</enum>
- </property>
- <property name="frameShadow">
- <enum>Sunken</enum>
- </property>
- <property name="orientation">
- <enum>Vertical</enum>
- </property>
- </widget>
- <widget class="QListBox">
- <property name="name">
- <cstring>SubscribersListBox</cstring>
- </property>
- <property name="geometry">
- <rect>
- <x>390</x>
- <y>60</y>
- <width>100</width>
- <height>250</height>
- </rect>
- </property>
- </widget>
- <widget class="QButtonGroup">
- <property name="name">
- <cstring>Colors</cstring>
- </property>
- <property name="geometry">
- <rect>
- <x>500</x>
- <y>50</y>
- <width>100</width>
- <height>170</height>
- </rect>
- </property>
- <property name="title">
- <string>Colors</string>
- </property>
- <widget class="QCheckBox">
- <property name="name">
- <cstring>clGreen</cstring>
- </property>
- <property name="geometry">
- <rect>
- <x>10</x>
- <y>50</y>
- <width>80</width>
- <height>24</height>
- </rect>
- </property>
- <property name="text">
- <string>Green</string>
- </property>
- </widget>
- <widget class="QCheckBox">
- <property name="name">
- <cstring>clRed</cstring>
- </property>
- <property name="geometry">
- <rect>
- <x>10</x>
- <y>80</y>
- <width>80</width>
- <height>24</height>
- </rect>
- </property>
- <property name="text">
- <string>Red</string>
- </property>
- </widget>
- <widget class="QCheckBox">
- <property name="name">
- <cstring>clBlack</cstring>
- </property>
- <property name="geometry">
- <rect>
- <x>10</x>
- <y>110</y>
- <width>80</width>
- <height>24</height>
- </rect>
- </property>
- <property name="text">
- <string>Black</string>
- </property>
- </widget>
- <widget class="QCheckBox">
- <property name="name">
- <cstring>clYellow</cstring>
- </property>
- <property name="geometry">
- <rect>
- <x>10</x>
- <y>140</y>
- <width>80</width>
- <height>24</height>
- </rect>
- </property>
- <property name="text">
- <string>Yellow</string>
- </property>
- </widget>
- <widget class="QCheckBox">
- <property name="name">
- <cstring>clBlue</cstring>
- </property>
- <property name="geometry">
- <rect>
- <x>10</x>
- <y>20</y>
- <width>80</width>
- <height>24</height>
- </rect>
- </property>
- <property name="text">
- <string>Blue</string>
- </property>
- <property name="checked">
- <bool>false</bool>
- </property>
- </widget>
- </widget>
- <widget class="QListBox">
- <property name="name">
- <cstring>PublishersListBox</cstring>
- </property>
- <property name="geometry">
- <rect>
- <x>10</x>
- <y>55</y>
- <width>100</width>
- <height>250</height>
- </rect>
- </property>
- </widget>
- <widget class="QLabel">
- <property name="name">
- <cstring>TextLabel1_3</cstring>
- </property>
- <property name="geometry">
- <rect>
- <x>120</x>
- <y>120</y>
- <width>60</width>
- <height>20</height>
- </rect>
- </property>
- <property name="text">
- <string>Shape</string>
- </property>
- </widget>
- <widget class="QLabel">
- <property name="name">
- <cstring>TextLabel2_2</cstring>
- </property>
- <property name="geometry">
- <rect>
- <x>120</x>
- <y>60</y>
- <width>70</width>
- <height>17</height>
- </rect>
- </property>
- <property name="text">
- <string>Color</string>
- </property>
- </widget>
- <widget class="QComboBox">
- <item>
- <property name="text">
- <string>Ellipse</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Rectangle</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Triangle</string>
- </property>
- </item>
- <property name="name">
- <cstring>ShapeP</cstring>
- </property>
- <property name="geometry">
- <rect>
- <x>120</x>
- <y>140</y>
- <width>100</width>
- <height>25</height>
- </rect>
- </property>
- </widget>
- <widget class="QComboBox">
- <item>
- <property name="text">
- <string>Blue</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Green</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Red</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Black</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Yellow</string>
- </property>
- </item>
- <property name="name">
- <cstring>ColorP</cstring>
- </property>
- <property name="geometry">
- <rect>
- <x>120</x>
- <y>80</y>
- <width>100</width>
- <height>25</height>
- </rect>
- </property>
- </widget>
- <widget class="QPushButton">
- <property name="name">
- <cstring>addS</cstring>
- </property>
- <property name="geometry">
- <rect>
- <x>500</x>
- <y>250</y>
- <width>100</width>
- <height>25</height>
- </rect>
- </property>
- <property name="font">
- <font>
- </font>
- </property>
- <property name="text">
- <string>&Add</string>
- </property>
- <property name="autoDefault">
- <bool>false</bool>
- </property>
- </widget>
- <widget class="QPushButton">
- <property name="name">
- <cstring>deleteS</cstring>
- </property>
- <property name="geometry">
- <rect>
- <x>500</x>
- <y>280</y>
- <width>100</width>
- <height>25</height>
- </rect>
- </property>
- <property name="text">
- <string>&Delete</string>
- </property>
- <property name="autoDefault">
- <bool>false</bool>
- </property>
- </widget>
- <widget class="QPushButton">
- <property name="name">
- <cstring>pushButton5</cstring>
- </property>
- <property name="geometry">
- <rect>
- <x>260</x>
- <y>280</y>
- <width>90</width>
- <height>25</height>
- </rect>
- </property>
- <property name="text">
- <string>About</string>
- </property>
- </widget>
- <widget class="QPushButton">
- <property name="name">
- <cstring>deletePushButton</cstring>
- </property>
- <property name="geometry">
- <rect>
- <x>120</x>
- <y>280</y>
- <width>100</width>
- <height>25</height>
- </rect>
- </property>
- <property name="text">
- <string>&Delete</string>
- </property>
- <property name="accel">
- <string>Alt+D</string>
- </property>
- <property name="autoDefault">
- <bool>false</bool>
- </property>
- </widget>
- <widget class="QPushButton">
- <property name="name">
- <cstring>addPushButton</cstring>
- </property>
- <property name="geometry">
- <rect>
- <x>120</x>
- <y>240</y>
- <width>100</width>
- <height>25</height>
- </rect>
- </property>
- <property name="text">
- <string>&Add</string>
- </property>
- <property name="accel">
- <string>Alt+A</string>
- </property>
- <property name="autoDefault">
- <bool>false</bool>
- </property>
- </widget>
- <widget class="QLabel">
- <property name="name">
- <cstring>TextLabel2</cstring>
- </property>
- <property name="geometry">
- <rect>
- <x>10</x>
- <y>10</y>
- <width>210</width>
- <height>30</height>
- </rect>
- </property>
- <property name="sizePolicy">
- <sizepolicy>
- <hsizetype>5</hsizetype>
- <vsizetype>5</vsizetype>
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="font">
- <font>
- <pointsize>18</pointsize>
- <bold>1</bold>
- </font>
- </property>
- <property name="text">
- <string><p align="center">Publishers</p></string>
- </property>
- </widget>
- <widget class="Line">
- <property name="name">
- <cstring>Line2</cstring>
- </property>
- <property name="geometry">
- <rect>
- <x>230</x>
- <y>10</y>
- <width>20</width>
- <height>300</height>
- </rect>
- </property>
- <property name="frameShape">
- <enum>VLine</enum>
- </property>
- <property name="frameShadow">
- <enum>Sunken</enum>
- </property>
- <property name="orientation">
- <enum>Vertical</enum>
- </property>
- </widget>
- <widget class="QLabel">
- <property name="name">
- <cstring>TextLabel4</cstring>
- </property>
- <property name="geometry">
- <rect>
- <x>390</x>
- <y>10</y>
- <width>210</width>
- <height>30</height>
- </rect>
- </property>
- <property name="font">
- <font>
- <pointsize>20</pointsize>
- <bold>1</bold>
- </font>
- </property>
- <property name="text">
- <string><p align="center">Suscribers</p></string>
- </property>
- </widget>
-</widget>
-<connections>
- <connection>
- <sender>addPushButton</sender>
- <signal>clicked()</signal>
- <receiver>MulticlipForm</receiver>
- <slot>addPublisher()</slot>
- </connection>
- <connection>
- <sender>deletePushButton</sender>
- <signal>clicked()</signal>
- <receiver>MulticlipForm</receiver>
- <slot>deletePublisher()</slot>
- </connection>
- <connection>
- <sender>addS</sender>
- <signal>clicked()</signal>
- <receiver>MulticlipForm</receiver>
- <slot>addSubscriber()</slot>
- </connection>
- <connection>
- <sender>deleteS</sender>
- <signal>clicked()</signal>
- <receiver>MulticlipForm</receiver>
- <slot>deleteSubscriber()</slot>
- </connection>
-</connections>
-<includes>
- <include location="local" impldecl="in declaration">Subscriber.h</include>
- <include location="local" impldecl="in declaration">Publisher.h</include>
- <include location="global" impldecl="in implementation">qtimer.h</include>
- <include location="global" impldecl="in implementation">sys/types.h</include>
- <include location="global" impldecl="in implementation">qapplication.h</include>
- <include location="global" impldecl="in implementation">qcombobox.h</include>
- <include location="global" impldecl="in implementation">qwidget.h</include>
- <include location="global" impldecl="in implementation">qtabwidget.h</include>
- <include location="global" impldecl="in implementation">qapplication.h</include>
- <include location="global" impldecl="in implementation">qpushbutton.h</include>
- <include location="global" impldecl="in implementation">qinputdialog.h</include>
- <include location="global" impldecl="in implementation">unistd.h</include>
- <include location="global" impldecl="in implementation">signal.h</include>
- <include location="local" impldecl="in implementation">MulticlipForm.ui.h</include>
-</includes>
-<slots>
- <slot access="protected">init()</slot>
- <slot access="protected">addPublisher()</slot>
- <slot access="protected">deletePublisher()</slot>
- <slot access="protected">GotoP()</slot>
- <slot access="protected">closeEvent( QCloseEvent * e )</slot>
- <slot access="protected">GotoS()</slot>
- <slot access="protected">addSubscriber()</slot>
- <slot access="protected">deleteSubscriber()</slot>
- <slot access="protected">keyPressEvent( QKeyEvent * e )</slot>
- <slot access="protected">Timer()</slot>
-</slots>
-<pixmapinproject/>
-<layoutdefaults spacing="6" margin="11"/>
-</UI>
--- /dev/null
+/****************************************************************
+**
+** Implementation MyQFrame class
+**
+****************************************************************/
+
+#include "MyQFrame.h"
+
+MyQFrame::MyQFrame( QWidget *parent, const char *name )
+ : QFrame( parent, name )
+{
+ mousePressed=0;
+ objects[0]=objects[1]=objects[2]=objects[3]=objects[4]=0;
+}
+
+
+void MyQFrame::activateObject(int object,int color, int shape) {
+ if (object>4) return;
+ objects[object]=1;
+ switch(color) {
+ case 0:colors[object]=QColor(0,0,255);break;
+ case 1:colors[object]=QColor(0,255,0);break;
+ case 2:colors[object]=QColor(255,0,0);break;
+ case 3:colors[object]=QColor(0,0,0);break;
+ case 4:colors[object]=QColor(255,255,0);break;
+ }
+ shapes[object]=shape;
+}
+
+void MyQFrame::deactivateObject(int object) {
+ if (object>4) return;
+ objects[object]=0;
+ repaint();
+}
+
+void MyQFrame::setPosition(int object,QRect position) {
+ positions[object]=position;
+ repaint();
+}
+
+void MyQFrame::paintEvent(QPaintEvent*)
+{
+ QPainter p(this);
+
+ for(int i=0;i<5;i++) {
+ if (!objects[i]) continue;
+ p.setBrush(colors[i]);
+ p.setPen(NoPen);
+ switch(shapes[i]){
+ case 0://rectangle
+ p.drawRect(positions[i]);
+ break;
+ case 1: //ellipse
+ p.drawEllipse(positions[i]);
+ break;
+ case 2: //triangle
+ QPointArray pt(3);
+ pt.putPoints(0,3, positions[i].center().x(),positions[i].top(),
+ positions[i].right(),positions[i].bottom(),
+ positions[i].left(),positions[i].bottom());
+ p.drawPolygon(pt);
+ break;
+ }
+ QString strPos;
+ strPos="X:" + QString::number(positions[i].center().x())+" " +
+ "Y:"+QString::number(positions[i].center().y());
+ p.drawText(positions[i].left()-(70-positions[i].width())/2,positions[i].top()-1,strPos);
+ }
+
+}
+
+void MyQFrame::mouseMoveEvent(QMouseEvent *e)
+{
+ if(mousePressed==0) return;
+ mouseX=e->pos().x();
+ mouseY=e->pos().y();
+}
+
+void MyQFrame::mousePressEvent (QMouseEvent *e)
+{
+ mousePressed=1;
+ mouseX=e->pos().x();
+ mouseY=e->pos().y();
+}
+
+void MyQFrame::mouseReleaseEvent (QMouseEvent *)
+{
+ mousePressed=0;
+}
--- /dev/null
+/****************************************************************
+**
+** Definition of MyQFrame class
+**
+****************************************************************/
+
+#ifndef MYQFRAME_H
+#define MYQFRAME_H
+
+#include <qframe.h>
+#include <qrect.h>
+#include <qpainter.h>
+#include <qstring.h>
+
+class MyQFrame : public QFrame
+{
+ Q_OBJECT
+public:
+ MyQFrame( QWidget *parent=0, const char *name=0 );
+
+protected:
+ void mouseMoveEvent(QMouseEvent *e);
+ void mousePressEvent(QMouseEvent *e);
+ void mouseReleaseEvent(QMouseEvent *e);
+ void paintEvent(QPaintEvent*);
+
+public:
+ void activateObject(int object,int color, int shape);
+ void deactivateObject(int object);
+ void setPosition(int object,QRect position);
+
+protected:
+
+private:
+ int objects[5];
+ int shapes[5];
+ QColor colors[5];
+ QRect positions[5];
+
+public:
+ int mousePressed;
+ int mouseX;
+ int mouseY;
+};
+
+#endif // MyQFRAME_H
--- /dev/null
+/****************************************************************************
+** $Id: richtext.cpp,v 1.1 2004/03/17 22:46:13 smolik Exp $
+**
+** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
+**
+** This file is part of an example program for Qt. This example
+** program may be used, distributed and modified without limitation.
+**
+*****************************************************************************/
+
+#include "richtext.h"
+
+#include <qhbox.h>
+#include <qhbox.h>
+#include <qpushbutton.h>
+#include <qtextview.h>
+#include <qbrush.h>
+#include <qapplication.h>
+
+static const char* publisherExamples[] = {
+ "<b>Saying 1:</b><br>"
+ "<hr><br><br>"
+ "<big>Evil is that which one believes of others. It is a sin to believe evil "
+ "of others, but it is seldom a mistake.</big><br><br>"
+ "<center><i>-- H.L. Mencken</i></center>",
+
+ "<b>Saying 2:</b><br>"
+ "<hr><br><br>"
+ "<big>A well-used door needs no oil on its hinges.<br>"
+ "A swift-flowing steam does not grow stagnant.<br>"
+ "Neither sound nor thoughts can travel through a vacuum.<br>"
+ "Software rots if not used.<br><br>"
+ "These are great mysteries.</big><br><br>"
+ "<center><i>-- Geoffrey James, \"The Tao of Programming\"</i></center>",
+
+ 0
+};
+
+static const char* subscriberExamples[] = {
+ "<b>Example 1:</b><br>"
+ "<hr><br><br>"
+ "<big>Evil is that which one believes of others. It is a sin to believe evil "
+ "of others, but it is seldom a mistake.</big><br><br>"
+ "<center><i>-- H.L. Mencken</i></center>",
+
+ "<b>Example 2:</b><br>"
+ "<hr><br><br>"
+ "<big>A well-used door needs no oil on its hinges.<br>"
+ "A swift-flowing steam does not grow stagnant.<br>"
+ "Neither sound nor thoughts can travel through a vacuum.<br>"
+ "Software rots if not used.<br><br>"
+ "These are great mysteries.</big><br><br>"
+ "<center><i>-- Geoffrey James, \"The Tao of Programming\"</i></center>",
+
+ 0
+};
+
+
+MyRichText::MyRichText( QWidget *parent, const char *name )
+ : QVBox( parent, name )
+{
+ setMargin( 5 );
+
+ view = new QTextView( this );
+ QBrush paper;
+ paper.setPixmap( QPixmap( "marble.png" ) );
+ if ( paper.pixmap() != 0 )
+ view->setPaper( paper );
+ else
+ view->setPaper( white );
+
+ view->setMinimumSize( 450, 250 );
+
+ QHBox *buttons = new QHBox( this );
+ buttons->setMargin( 5 );
+
+ bClose = new QPushButton( "&Close", buttons );
+ bPrev = new QPushButton( "<< &Prev", buttons );
+ bNext = new QPushButton( "&Next >>", buttons );
+
+ bPrev->setEnabled( FALSE );
+
+ connect( bClose, SIGNAL(clicked()), this, SLOT(close()) );
+ connect( bPrev, SIGNAL( clicked() ), this, SLOT( prev() ) );
+ connect( bNext, SIGNAL( clicked() ), this, SLOT( next() ) );
+
+}
+
+void MyRichText::setTextPublisher()
+{
+ num = 0;
+ sayings=publisherExamples;
+ view->setText(sayings[0]);
+}
+
+
+void MyRichText::setTextSubscriber()
+{
+ num = 0;
+ sayings=subscriberExamples;
+ view->setText(sayings[0]);
+}
+
+void MyRichText::prev()
+{
+ if ( num <= 0 )
+ return;
+
+ num--;
+
+ view->setText( sayings[num] );
+
+ if ( num == 0 )
+ bPrev->setEnabled( FALSE );
+
+ bNext->setEnabled( TRUE );
+}
+
+void MyRichText::next()
+{
+ if ( !sayings[++num] )
+ return;
+
+ view->setText( sayings[num] );
+
+ if ( !sayings[num + 1] )
+ bNext->setEnabled( FALSE );
+
+ bPrev->setEnabled( TRUE );
+}
+
+
+
+
+
--- /dev/null
+/****************************************************************************
+** $Id: richtext.h,v 1.1 2004/03/17 22:46:13 smolik Exp $
+**
+** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
+**
+** This file is part of an example program for Qt. This example
+** program may be used, distributed and modified without limitation.
+**
+*****************************************************************************/
+
+#ifndef RICHTEXT_H
+#define RICHTEXT_H
+
+#include <qvbox.h>
+
+class QTextView;
+class QPushButton;
+
+class MyRichText : public QVBox
+{
+ Q_OBJECT
+
+public:
+ MyRichText( QWidget *parent = 0, const char *name = 0);
+ void setTextPublisher();
+ void setTextSubscriber();
+ const char **sayings;
+
+protected:
+ QTextView *view;
+ QPushButton *bClose, *bNext, *bPrev;
+ int num;
+
+protected slots:
+ void prev();
+ void next();
+
+};
+
+#endif