Ejemplo n.º 1
0
QVariant KDEPixmapManipulation::callPhoto(Call* c, const QSize& size, bool displayPresence) {
   if (c->peerPhoneNumber()->contact()) {
      return contactPhoto(c->peerPhoneNumber()->contact(),size,displayPresence);
   }
   else
      return QPixmap(callStateIcons[c->state()]);
}
Ejemplo n.º 2
0
QList<QVariant> AddContactDialog::contactInfo()
{
    QString group = ui->cbox_group->currentText();      // 0
    QString lname = ui->edt_lastName->text();           // 1
    QString fname = ui->edt_firstName->text();          // 2
    QString nname = ui->edt_nickName->text();           // 3
    QString sex = ui->cbox_sex->currentText();          // 4
    QString age = ui->edt_age->text();                  // 5
    QString birth = ui->dedt_birthDate->text();         // 6
    QString mobile = ui->edt_telPhone->text();          // 7
    QString email = ui->edt_email->text();              // 8
    QString qq = ui->edt_qq->text();                    // 9
    QByteArray photo = contactPhoto();                  // 0
    QString weibo = ui->edt_weibo->text();              // 11
    QString website = ui->edt_website->text();          // 12

    QString job = ui->edt_job->text();              // 13
    QString officeTel = ui->edt_officeTel->text();  // 14
    QString officeAddr = ui->edt_officeAddr->text();// 15
    QString officeCode = ui->edt_officeCode->text();// 16
    QString homeTel = ui->edt_homeTel->text();      // 17
    QString homeAddr = ui->edt_homeAddr->text();    // 18
    QString homeCode = ui->edt_homeCode->text();    // 19
    QString note = ui->tedt_note->toPlainText();    // 20

    QList<QVariant> list;
    list << group << lname << fname << nname << sex << age << birth \
         << mobile << email << qq << photo << weibo << website \
         << job << officeTel << officeAddr << officeCode \
         << homeTel << homeAddr << homeCode << note;

    return list;
}
Ejemplo n.º 3
0
QVariant KDEPixmapManipulation::callPhoto(const PhoneNumber* n, const QSize& size, bool displayPresence) {
   if (n->contact()) {
      return contactPhoto(n->contact(),size,displayPresence);
   }
   else {
      bool isTracked = displayPresence && n->isTracked();
      bool isPresent = displayPresence && n->isPresent();

      return drawDefaultUserPixmap(size,isTracked,isPresent);
   }
}
Ejemplo n.º 4
0
QVariant KDEPixmapManipulation::contactPhoto(Contact* c, const QSize& size, bool displayPresence) {
   const QString hash = QString("photo2%1%2%3").arg(size.width()).arg(size.height()).arg(c->isPresent());
   QVariant preRendered = c->property(hash.toAscii());
   if (preRendered.isValid())
      return preRendered;
   else
      connect(c,SIGNAL(rebased(Contact*)),this,SLOT(clearCache()));
   const int radius = (size.height() > 35) ? 7 : 5;
   const QPixmap* pxmPtr = c->photo();
   bool isTracked = displayPresence && c->isTracked();
   bool isPresent = displayPresence && c->isPresent();
   static QColor presentBrush = KStatefulBrush( KColorScheme::Window, KColorScheme::PositiveText ).brush(QPalette::Normal).color();
   static QColor awayBrush    = KStatefulBrush( KColorScheme::Window, KColorScheme::NegativeText ).brush(QPalette::Normal).color();

   QPixmap pxm;
   if (pxmPtr) {
      QPixmap contactPhoto(pxmPtr->scaledToWidth(size.height()-6));
      pxm = QPixmap(size);
      pxm.fill(Qt::transparent);
      QPainter painter(&pxm);

      //Clear the pixmap
      painter.setCompositionMode(QPainter::CompositionMode_Clear);
      painter.fillRect(0,0,size.width(),size.height(),QBrush(Qt::white));
      painter.setCompositionMode(QPainter::CompositionMode_SourceOver);

      //Add corner radius to the Pixmap
      QRect pxRect = contactPhoto.rect();
      QBitmap mask(pxRect.size());
      QPainter customPainter(&mask);
      customPainter.setRenderHint  (QPainter::Antialiasing, true      );
      customPainter.fillRect       (pxRect                , Qt::white );
      customPainter.setBackground  (Qt::black                         );
      customPainter.setBrush       (Qt::black                         );
      customPainter.drawRoundedRect(pxRect,radius,radius);
      contactPhoto.setMask(mask);
      painter.drawPixmap(3,3,contactPhoto);
      painter.setBrush(Qt::NoBrush);
      QPen pen(QApplication::palette().color(QPalette::Disabled,QPalette::Text));
      pen.setWidth(isTracked?1:2);
      painter.setPen(pen);
      painter.setRenderHint  (QPainter::Antialiasing, true   );
      painter.drawRoundedRect(3,3,pxm.height()-6,pxm.height()-6,radius,radius);

      //Draw the glow around pixmaps
      if (isTracked) {
         if (isPresent)
            pen.setColor(presentBrush);
         else
            pen.setColor(awayBrush);
         for (int i=2;i<=7;i+=2) {
            pen.setWidth(i);
            painter.setPen(pen);
            painter.setOpacity(0.3f-(((i-2)*0.8f)/10.0f));
            painter.drawRoundedRect(3,3,pxm.height()-6,pxm.height()-6,radius,radius);
         }
      }
   }
   else {
      pxm = drawDefaultUserPixmap(size,isTracked,isPresent);
   }

   c->setProperty(hash.toAscii(),pxm);
   return pxm;
}