1 /****************************************************************************
2 ** ui.h extension file, included from the uic-generated form implementation.
4 ** If you wish to add, delete or rename slots use Qt Designer which will
5 ** update this file, preserving your code. Create an init() slot in place of
6 ** a constructor, and a destroy() slot in place of a destructor.
7 *****************************************************************************/
10 Subscriber *tabSub[50];
12 Publisher *tabPub[50];
16 void MulticlipForm::init()
18 memset(tabSub,0,sizeof(tabSub));
19 memset(tabPub,0,sizeof(tabPub));
23 QTimer *timer = new QTimer(this);
24 connect( timer, SIGNAL(timeout()), SLOT(Timer()));
25 timer->start( 500, FALSE );
29 void MulticlipForm::addPublisher()
31 PublishersListBox->insertItem( QString::number(np), 0 );
38 void MulticlipForm::deletePublisher()
40 QString text=PublishersListBox->currentText();
41 if(PublishersListBox->currentItem()!=-1 && !text.isEmpty()){
43 pub=NPublisher-1-PublishersListBox->currentItem() ;
44 PublishersListBox->removeItem( PublishersListBox->currentItem() );
45 tabPub[pub]->Destroy();
47 for(int i=pub;i+1<NPublisher;i++) tabPub[i]=tabPub[i+1];
48 tabPub[NPublisher]=NULL;
54 void MulticlipForm::GotoP( )
56 QString name = QString::number(np);
58 int shap=ShapeP->currentItem();
59 int color=ColorP->currentItem();
61 tabPub[NPublisher]=new Publisher();
62 tabPub[NPublisher]->Create(name,shap,color,strength);
67 void MulticlipForm::closeEvent( QCloseEvent *e )
70 for(i=0;i<NPublisher;i++){
74 for(i=0;i<NSubscriber;i++){
81 void MulticlipForm::GotoS( )
83 QString name =QString::number(ns);
85 tabSub[NSubscriber]=new Subscriber();
86 tabSub[NSubscriber]->Create(name,
91 clYellow->isChecked());
94 void MulticlipForm::addSubscriber()
97 SubscribersListBox->insertItem( QString::number(ns), 0 );
103 void MulticlipForm::deleteSubscriber()
105 QString text=SubscribersListBox->currentText();
106 if(SubscribersListBox->currentItem()!=-1 && !text.isEmpty()){
108 pub=NSubscriber-1-SubscribersListBox->currentItem() ;
109 SubscribersListBox->removeItem( SubscribersListBox->currentItem() );
110 tabSub[pub]->Destroy();
112 for(int i=pub;i+1<NSubscriber;i++) tabSub[i]=tabSub[i+1];
113 tabSub[NSubscriber]=NULL;
120 void MulticlipForm::keyPressEvent( QKeyEvent *e )
122 if(Qt::Key_Delete==e->key() ) {
123 if( focusWidget ()==PublishersListBox)deletePublisher();
124 if( focusWidget ()==SubscribersListBox)deleteSubscriber();
130 void MulticlipForm::Timer()
133 for(i=0;i<NPublisher;i++){
134 if((tabPub[i]->m_mainFrm)->getClose()==1){
135 PublishersListBox->setCurrentItem (NPublisher-1-i);
139 for(i=0;i<NSubscriber;i++){
140 if((tabSub[i]->m_mainFrm)->getClose()==1){
141 SubscribersListBox->setCurrentItem (NSubscriber-1-i);