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

« back to all changes in this revision

Viewing changes to kde/src/klib/tip.cpp

  • Committer: Package Import Robot
  • Author(s): Mark Purcell
  • Date: 2014-01-28 18:23:36 UTC
  • mfrom: (1.1.11)
  • mto: This revision was merged to the branch mainline in revision 24.
  • Revision ID: package-import@ubuntu.com-20140128182336-3xenud1kbnwmf3mz
* New upstream release 
  - Fixes "New Upstream Release" (Closes: #735846)
  - Fixes "Ringtone does not stop" (Closes: #727164)
  - Fixes "[sflphone-kde] crash on startup" (Closes: #718178)
  - Fixes "sflphone GUI crashes when call is hung up" (Closes: #736583)
* Build-Depends: ensure GnuTLS 2.6
  - libucommon-dev (>= 6.0.7-1.1), libccrtp-dev (>= 2.0.6-3)
  - Fixes "FTBFS Build-Depends libgnutls{26,28}-dev" (Closes: #722040)
* Fix "boost 1.49 is going away" unversioned Build-Depends: (Closes: #736746)
* Add Build-Depends: libsndfile-dev, nepomuk-core-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/****************************************************************************
2
 
 *   Copyright (C) 2012-2013 by Savoir-Faire Linux                          *
 
2
 *   Copyright (C) 2012-2014 by Savoir-Faire Linux                          *
3
3
 *   Author : Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com> *
4
4
 *                                                                          *
5
5
 *   This library is free software; you can redistribute it and/or          *
33
33
///Constructor
34
34
Tip::Tip(const QString& text, QWidget* parent) : QObject(parent),m_OriginalText(text),m_Position(TipPosition::Bottom),m_IsMaxSize(false),m_pR(nullptr),
35
35
m_OriginalPalette(QApplication::palette()),m_AnimationIn(TipAnimation::TranslationTop),m_AnimationOut(TipAnimation::TranslationTop),m_pFont(nullptr),
36
 
m_IsVisible(false),m_TimeOut(0),m_HasBg(true),m_HasText(true),m_Padding(15)
 
36
m_IsVisible(false),m_TimeOut(0),m_HasBg(true),m_HasText(true),m_Padding(15),m_MaxWidth(350)
37
37
{
38
38
}
39
39
 
54
54
      m_CurrentRect.setHeight(m_Padding);
55
55
 
56
56
      //One 1000px wide line is not so useful, this may change later (variable)
57
 
      if (m_CurrentRect.width() > MAX_WIDTH) {
58
 
         m_CurrentRect.setWidth( MAX_WIDTH );
 
57
      if (m_CurrentRect.width() > m_MaxWidth) {
 
58
         m_CurrentRect.setWidth( m_MaxWidth );
59
59
      }
60
60
 
61
61
      //Get area required to display the text
68
68
         m_CurrentRect.setWidth(decoRect.x() + decoRect.width()+2*m_Padding);
69
69
 
70
70
      //Create the background image
71
 
      m_CurrentImage = QImage(QSize(m_CurrentRect.width(),m_CurrentRect.height()),QImage::Format_RGB888);
72
 
      m_CurrentImage.fill(m_OriginalPalette.base().color().rgb() );
 
71
      m_CurrentImage = QImage(QSize(m_CurrentRect.width(),m_CurrentRect.height()),QImage::Format_ARGB32);
73
72
      QPainter p(&m_CurrentImage);
 
73
      p.setCompositionMode(QPainter::CompositionMode_Clear);
 
74
      p.fillRect(m_CurrentImage.rect(),QBrush(Qt::white));
 
75
      p.setCompositionMode(QPainter::CompositionMode_SourceOver);
74
76
      p.setRenderHint(QPainter::Antialiasing, true);
75
77
      p.setFont(font());
76
78
 
82
84
         p.drawRoundedRect(QRect(0,0,m_CurrentRect.width(),m_CurrentRect.height()),10,10);
83
85
      }
84
86
 
85
 
      //Draw the wrapped text in textRectS
86
 
      p.drawText(textRect,Qt::TextWordWrap|Qt::AlignJustify,m_OriginalText);
 
87
      if (hasText()) {
 
88
         //Draw the wrapped text in textRectS
 
89
         p.drawText(textRect,Qt::TextWordWrap|Qt::AlignJustify,m_OriginalText);
 
90
      }
87
91
 
88
92
 
89
93
      //If the widget is subclassed, this would allow decorations to be added like images
144
148
      m_OriginalFile = file.readAll();
145
149
      m_OriginalFile.replace("BACKGROUD_COLOR_ROLE",brightOrDarkBase()?"#000000":"#ffffff");
146
150
      m_OriginalFile.replace("BASE_ROLE_COLOR",m_OriginalPalette.base().color().name().toAscii());
 
151
      file.close();
147
152
   }
148
153
   return m_OriginalFile;
149
154
}