~ubuntu-branches/ubuntu/wily/sflphone/wily

« back to all changes in this revision

Viewing changes to kde/src/delegates/historydelegate.cpp

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2015-01-07 14:51:16 UTC
  • mfrom: (4.3.5 sid)
  • Revision ID: package-import@ubuntu.com-20150107145116-yxnafinf4lrdvrmx
Tags: 1.4.1-0.1ubuntu1
* Merge with Debian, remaining changes:
 - Drop soprano, nepomuk build-dep
* Drop ubuntu patches, now upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
#include "../widgets/tips/ringingtip.h"
44
44
#include "klib/tipanimationwrapper.h"
45
45
#include "lib/visitors/pixmapmanipulationvisitor.h"
46
 
 
47
 
static const char* icnPath[4] = {
48
 
/* INCOMING */ ICON_HISTORY_INCOMING,
49
 
/* OUTGOING */ ICON_HISTORY_OUTGOING,
50
 
/* MISSED   */ ICON_HISTORY_MISSED  ,
51
 
/* NONE     */ ""                   ,
52
 
};
 
46
#include "implementation.h"
53
47
 
54
48
///Constant
55
49
#pragma GCC diagnostic ignored "-Wmissing-braces"
75
69
      rowCount = ConfigurationSkeleton::displayCallPeer()
76
70
      + ConfigurationSkeleton::displayCallNumber       ()
77
71
      + ConfigurationSkeleton::displayCallSecure       ()
78
 
      + ConfigurationSkeleton::displayCallCodec        ()
79
72
      + ConfigurationSkeleton::displayCallOrganisation ()
80
73
      + ConfigurationSkeleton::displayCallDepartment   ()
81
74
      + ConfigurationSkeleton::displayCallEmail        ();
103
96
 
104
97
   painter->setPen(QApplication::palette().color(QPalette::Active,(option.state & QStyle::State_Selected)?QPalette::HighlightedText:QPalette::Text));
105
98
   const Call::State currentState = (Call::State) index.data(Call::Role::CallState).toInt();
 
99
   const Call::LifeCycleState currentLifeCycleState = static_cast<Call::LifeCycleState>(index.data(Call::Role::CallLifeCycleState).toInt());
 
100
 
106
101
   if (currentState == Call::State::HOLD)
107
102
      painter->setOpacity(0.70);
108
103
 
130
125
   //Handle history
131
126
   else if (!isBookmark && (index.data(Call::Role::Historystate).toInt() != (int)Call::LegacyHistoryState::NONE || currentState != Call::State::OVER) && ConfigurationSkeleton::displayHistoryStatus()) {
132
127
      QPainter painter(&pxm);
133
 
      QPixmap status((currentState==Call::State::OVER)?icnPath[index.data(Call::Role::Historystate).toInt()]:callStateIcons[currentState]);
 
128
      QPixmap status((currentState==Call::State::OVER)?
 
129
         KDEPixmapManipulation::icnPath   [index.data(Call::Role::Missed    ).toInt()]
 
130
                                          [index.data(Call::Role::Direction2).toInt()]
 
131
            :callStateIcons[currentState]);
134
132
      if (!status.isNull()) {
135
 
         status=status.scaled(QSize(24,24));
 
133
         const int pxmHeight = option.rect.height()<24?option.rect.height()-2:24;
 
134
         status=status.scaled(QSize(pxmHeight,pxmHeight));
136
135
         painter.drawPixmap(pxm.width()-status.width(),pxm.height()-status.height(),status);
137
136
      }
138
137
   }
139
 
   if (currentState != Call::State::OVER && index.data(Call::Role::IsRecording).toBool()) {
 
138
   if (currentLifeCycleState == Call::LifeCycleState::PROGRESS && index.data(Call::Role::IsRecording).toBool()) {
140
139
      const static QPixmap record(KStandardDirs::locate("data","sflphone-client-kde/record.png"));
141
140
      time_t curTime;
142
141
      ::time(&curTime);
165
164
      if (!isBookmark) {
166
165
         painter->drawText(option.rect.x()+15+iconHeight,currentHeight,index.data(Call::Role::FormattedDate).toString());
167
166
         currentHeight +=fm.height();
168
 
         const static QPixmap* callPxm = nullptr;
169
 
         if (!callPxm)
170
 
            callPxm = new QPixmap(KStandardDirs::locate("data","sflphone-client-kde/mini/call.png"));
171
 
         painter->drawPixmap(option.rect.x()+15+iconHeight,currentHeight-12+(fm.height()-12),index.data(Call::Role::CategoryIcon).value<QPixmap>());
 
167
//          const static QPixmap* callPxm = nullptr;
 
168
//          if (!callPxm)
 
169
//             callPxm = new QPixmap(KStandardDirs::locate("data","sflphone-client-kde/mini/call.png"));
 
170
         QVariant var = index.data(Call::Role::CategoryIcon);
 
171
         if (var.type() == QVariant::Pixmap) {
 
172
            QPixmap pxm2 = var.value<QPixmap>();
 
173
            painter->drawPixmap(option.rect.x()+15+iconHeight,currentHeight-12+(fm.height()-12),pxm2);
 
174
         }
172
175
      }
173
176
 
174
177
// //       if (isTracked) {
216
219
         currentHeight +=fm.height();
217
220
      }
218
221
 
219
 
      if (ConfigurationSkeleton::displayCallCodec()) {
220
 
         painter->drawText(option.rect.x()+15+iconHeight,currentHeight,index.data(Call::Role::Codec).toString());
221
 
         currentHeight +=fm.height();
222
 
      }
223
 
 
224
222
      if (ConfigurationSkeleton::displayCallOrganisation()) {
225
223
         painter->drawText(option.rect.x()+15+iconHeight,currentHeight,index.data(Call::Role::Organisation).toString());
226
224
         currentHeight +=fm.height();
237
235
      }
238
236
   }
239
237
 
240
 
   if (!index.parent().isValid() && currentState != Call::State::RINGING && currentState != Call::State::INCOMING){
 
238
   if (!index.parent().isValid() && currentLifeCycleState == Call::LifeCycleState::PROGRESS){
241
239
      const QString length = index.data(Call::Role::Length).toString();
242
240
      const int lenLen = fm.width(length);
243
241
      if (!length.isEmpty()) {
244
 
         painter->drawText(option.rect.x()+option.rect.width()-lenLen-4,option.rect.y()+(option.rect.height()/2)+(fm.height()/4),length);
 
242
         painter->drawText(option.rect.x()+option.rect.width()-lenLen-4,option.rect.y()+(option.rect.height()/2)+(fm.height()/3),length);
245
243
      }
246
244
      DialpadDelegate::paint(painter,option,index,lenLen);
247
245
   }
294
292
   if (m_pRingingTip && m_pRingingTip->isVisible()) {
295
293
      bool found = false;
296
294
      foreach(const Call* call,CallModel::instance()->getCallList()) {
297
 
         found = (call->state() == Call::State::RINGING || call->state() == Call::State::INCOMING);
 
295
         found = (call->lifeCycleState() == Call::LifeCycleState::INITIALIZATION);
298
296
         if (found)
299
297
            break;
300
298
      }