Changeset 26:8de487772114

Show
Ignore:
Timestamp:
09/14/07 18:59:48 (1 year ago)
Author:
Nikita@Luc
Message:

add support for video

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • demo.cpp

    r24 r26  
    124124        connect(phapi.phapiwarp ,SIGNAL(appelSortant(int,QString,int)),this,SLOT(appelSortant(int,QString,int))); 
    125125 
    126         floatWidget = new FloatWidget(0,&phapi); 
     126        floatWidget = new FloatWidget(0,&phapi,xml); 
    127127        floatWidget->hide(); 
    128128        connect(floatButton,SIGNAL(clicked()),this,SLOT(showHideFloatingWidget())); 
     
    333333                        { 
    334334                                if(it.value()->status == 0) 
    335                                         tmp->setStatusIcon(":/images/check.png"); 
     335                                        tmp->setStatusIcon(":/images/call.png"); 
    336336                                else if(it.value()->status == 2) 
    337337                                        tmp->setStatusIcon(":/images/hold.png"); 
     
    364364        { 
    365365                pix = phapi.phapiwarp->mapCidPix.value(callSelected); 
     366                QRect r = label->geometry(); 
     367                r.adjust(3,3,-3,-3); 
     368                 
     369                int dx = 4; 
     370                int dy = 3; 
     371 
     372                if(xml->general.is169.toInt()) 
     373                { 
     374                        dx = 16; 
     375                        dy = 9; 
     376                } 
     377 
     378                QSize realre(dx,dy); 
     379                for(int i = 0 ; i < 2000 ; i++) 
     380                { 
     381                        if(realre.width()+dx <= r.width() &&  realre.height()+dy<= r.height()) 
     382                        { 
     383                                realre = QSize(realre.width()+dx,realre.height() +dy); 
     384                        } 
     385                        else 
     386                                continue; 
     387                } 
     388                r.setWidth(realre.width()); 
     389                r.setHeight(realre.height()); 
     390 
     391                r.moveCenter(label->geometry().center()); 
     392                painter.drawPixmap(r, pix); 
    366393        } 
    367394        else 
     395        { 
     396                pix = QPixmap(":images/pix.png"); 
     397                QRect re = pix.rect(); 
     398                re.moveCenter(label->geometry().center()); 
    368399                pix=QPixmap(":images/pix.png"); 
    369  
    370         QRect re = pix.rect(); 
    371         re.moveCenter(label->geometry().center()); 
    372         painter.drawPixmap(re , pix); 
     400                painter.drawPixmap(re, pix); 
     401        } 
    373402} 
    374403 
  • demo.h

    r24 r26  
    4040                cl = new QPushButton; 
    4141                cl->setMaximumSize(32,20); 
    42                 cl->setIcon(QIcon(":/images/delete.png")); 
     42                cl->setIcon(QIcon(":/images/end.png")); 
    4343                 
    4444                QHBoxLayout * lay = new QHBoxLayout; 
  • floatwidget.cpp

    r25 r26  
    11#include"floatwidget.h" 
    22 
    3 FloatWidget::FloatWidget(QWidget * parent , PhApiHead * _phapi
    4 :QWidget(parent),phapi(_phapi),callSelected(-1),ligneSelected(-1) 
     3FloatWidget::FloatWidget(QWidget * parent , PhApiHead * _phapi ,xmlWrapper * _xml
     4:QWidget(parent),phapi(_phapi),callSelected(-1),ligneSelected(-1),xml(_xml) 
    55{ 
    66        setWindowTitle("Milli phone"); 
     
    3838        setLayout(layV); 
    3939         
     40        connect(textEdit,SIGNAL(returnPressed()),this,SLOT(sendClicked())); 
    4041        connect(send,SIGNAL(clicked()),this,SLOT(sendClicked())); 
    4142 
     
    6465        { 
    6566                pix = phapi->phapiwarp->mapCidPix.value(callSelected); 
     67                QRect r = label->geometry(); 
     68                r.adjust(3,3,-3,-3); 
     69                 
     70                int dx = 4; 
     71                int dy = 3; 
     72 
     73                if(xml->general.is169.toInt()) 
     74                { 
     75                        dx = 16; 
     76                        dy = 9; 
     77                } 
     78 
     79                QSize realre(dx,dy); 
     80 
     81                for(int i = 0 ; i < 2000 ; i++) 
     82                { 
     83                        if(realre.width()+dx <= r.width() &&  realre.height()+dy<= r.height()) 
     84                        { 
     85                                realre = QSize(realre.width()+dx,realre.height() +dy); 
     86                        } 
     87                        else 
     88                                continue; 
     89                } 
     90                r.setWidth(realre.width()); 
     91                r.setHeight(realre.height()); 
     92 
     93                r.moveCenter(label->geometry().center()); 
     94                painter.drawPixmap(r, pix); 
    6695        } 
    6796        else 
     97        { 
     98                pix = QPixmap(":images/pix.png"); 
     99                QRect re = pix.rect(); 
     100                re.moveCenter(label->geometry().center()); 
    68101                pix=QPixmap(":images/pix.png"); 
     102                painter.drawPixmap(re, pix); 
    69103 
    70         QRect re = pix.rect(); 
    71         re.moveCenter(label->geometry().center()); 
    72         painter.drawPixmap(re , pix); 
    73  
     104        }        
    74105} 
    75106 
  • floatwidget.h

    r25 r26  
    44#include<QtGui> 
    55#include "phapihead.h" 
     6#include "xmlwrapper.h" 
    67 
    78class FloatWidget :public QWidget 
     
    1011 
    1112private: 
     13        xmlWrapper * xml; 
    1214        QMap<int,QString> map; 
    1315        QGroupBox* label; 
     
    1921        int callSelected,ligneSelected; 
    2022public: 
    21         FloatWidget(QWidget * parent = 0, PhApiHead * _phapi = 0); 
     23        FloatWidget(QWidget * parent = 0, PhApiHead * _phapi = 0,xmlWrapper * _xml = 0); 
    2224 
    2325protected: 
  • general.cpp

    r23 r26  
    88         
    99        video = new QCheckBox("Video",this); 
     10 
     11        seize9= new QCheckBox("16/9",this); 
     12        quatre3= new QCheckBox("4/3",this); 
    1013 
    1114        init = new QPushButton(this); 
     
    2023        QVBoxLayout * lay = new QVBoxLayout; 
    2124        lay->addWidget(video); 
     25        lay->addWidget(quatre3); 
     26        lay->addWidget(seize9); 
     27 
    2228        lay->addLayout(lh); 
    2329        lay->addWidget(init); 
     
    3036                video->setCheckState (Qt::Unchecked); 
    3137 
     38        if(xml->general.is169.toInt()) 
     39        { 
     40                seize9->setCheckState (Qt::Checked); 
     41                quatre3->setCheckState (Qt::Unchecked); 
     42        } 
     43        else 
     44        { 
     45                seize9->setCheckState (Qt::Unchecked); 
     46                quatre3->setCheckState (Qt::Checked); 
     47        } 
     48 
    3249        linePort->setText(xml->general.localPort); 
    3350        connect(video,SIGNAL(stateChanged ( int )),this,SLOT(stateChanged ( int ))); 
     51        connect(seize9,SIGNAL(stateChanged ( int )),this,SLOT(seize9stateChanged ( int ))); 
     52        connect(quatre3,SIGNAL(stateChanged ( int )),this,SLOT(quatre3stateChanged ( int ))); 
     53 
    3454        connect(linePort,SIGNAL(editingFinished ()),this,SLOT(editingFinished ())); 
    3555} 
  • general.h

    r23 r26  
    1111private: 
    1212        QCheckBox * video; 
     13 
     14        QCheckBox * seize9; 
     15        QCheckBox * quatre3; 
     16 
    1317        QLabel * labPort; 
    1418        QLineEdit * linePort; 
     
    3943                }        
    4044        } 
     45 
     46        void seize9stateChanged ( int state ) 
     47        { 
     48                if(state) 
     49                { 
     50                        quatre3->setCheckState(Qt::Unchecked); 
     51                        xml->general.is169 = "1"; 
     52                        xml->writeSipConf(); 
     53                } 
     54                else 
     55                { 
     56                        quatre3->setCheckState(Qt::Checked); 
     57                        xml->general.is169= "0"; 
     58                        xml->writeSipConf(); 
     59                }        
     60        } 
     61 
     62        void quatre3stateChanged ( int state ) 
     63        { 
     64                if(state) 
     65                { 
     66                        seize9->setCheckState(Qt::Unchecked); 
     67                        xml->general.is169 = "0"; 
     68                        xml->writeSipConf(); 
     69                } 
     70                else 
     71                { 
     72                        seize9->setCheckState(Qt::Checked); 
     73                        xml->general.is169= "1"; 
     74                        xml->writeSipConf(); 
     75                }        
     76        } 
    4177}; 
    4278 
  • milliphone.qrc

    r25 r26  
    2727     <file>images/inside.png</file> 
    2828     <file>images/enCom.png</file> 
     29     <file>images/call.png</file> 
     30     <file>images/conference.png</file> 
     31     <file>images/end.png</file> 
    2932 </qresource> 
    3033 </RCC> 
  • xmlwrapper.cpp

    r24 r26  
    100100                general.video = generalElt.attribute("video"); 
    101101                general.localPort = generalElt.attribute("localPort"); 
     102                general.is169= generalElt.attribute("is169"); 
    102103        } 
    103104 
     
    215216                general.video = "0"; 
    216217                general.localPort = "5060"; 
     218                 
     219                general.is169= "0"; 
    217220 
    218221                writeSipConf(); 
     
    327330        generalElt.setAttribute("video",general.video ); 
    328331        generalElt.setAttribute("localPort",general.localPort); 
     332 
     333        generalElt.setAttribute("is169",general.is169); 
    329334 
    330335        root.appendChild(generalElt); 
  • xmlwrapper.h

    r22 r26  
    9191        QString video; 
    9292 
     93        QString is169; 
     94 
    9395        QList<xmlLigne>  listLigne; 
    9496        QList<xmlContact> listContact;