~noskcaj/ubuntu/saucy/sflphone/merge-1.2.3-2

« back to all changes in this revision

Viewing changes to kde/src/widgets/tips/dialpadtip.cpp

  • Committer: Jackson Doak
  • Date: 2013-07-10 21:04:46 UTC
  • mfrom: (20.1.3 sid)
  • Revision ID: noskcaj@ubuntu.com-20130710210446-y8f587vza807icr9
Properly merged from upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/****************************************************************************
 
2
 *   Copyright (C) 2012-2013 by Savoir-Faire Linux                          *
 
3
 *   Author : Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com> *
 
4
 *                                                                          *
 
5
 *   This library is free software; you can redistribute it and/or          *
 
6
 *   modify it under the terms of the GNU Lesser General Public             *
 
7
 *   License as published by the Free Software Foundation; either           *
 
8
 *   version 2.1 of the License, or (at your option) any later version.     *
 
9
 *                                                                          *
 
10
 *   This library is distributed in the hope that it will be useful,        *
 
11
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of         *
 
12
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU      *
 
13
 *   Lesser General Public License for more details.                        *
 
14
 *                                                                          *
 
15
 *   You should have received a copy of the GNU General Public License      *
 
16
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.  *
 
17
 ***************************************************************************/
 
18
#include "dialpadtip.h"
 
19
 
 
20
//Qt
 
21
#include <QtSvg/QSvgRenderer>
 
22
#include <QtGui/QPainter>
 
23
#include <QtGui/QFontMetrics>
 
24
#include <QtCore/QFile>
 
25
 
 
26
//KDE
 
27
#include <KDebug>
 
28
#include <KLocale>
 
29
#include <KStandardDirs>
 
30
 
 
31
///Constructor
 
32
DialPadTip::DialPadTip(QWidget* parent) : Tip(i18n("Use the dialpad below or start typing a number. Press enter or double click on the call to launch the call. Press escape or \"Hang Up\" to end the call."),parent)
 
33
 
 
34
{
 
35
   loadSvg(KStandardDirs::locate("data", "sflphone-client-kde/tips/keyboard.svg"));
 
36
}
 
37
 
 
38
///Destructor
 
39
DialPadTip::~DialPadTip()
 
40
{
 
41
}
 
42
 
 
43
QRect DialPadTip::getDecorationRect()
 
44
{
 
45
   return QRect(0,0,m_CurrentSize.width()-2*m_Padding,60);
 
46
}
 
47
 
 
48
void DialPadTip::paintDecorations(QPainter& p, const QRect& textRect)
 
49
{
 
50
   if (!m_pR)
 
51
      m_pR = new QSvgRenderer(m_OriginalFile);
 
52
   m_pR->render(&p,QRect(m_CurrentRect.width() - m_Padding - 50*2.59143327842 - 10 ,textRect.y()+textRect.height() + 10,50*2.59143327842,50));
 
53
}