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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/***************************************************************************
 *   Copyright (C) 2012-2013 by Savoir-Faire Linux                         *
 *   Author : Emmanuel Lepage Valle <emmanuel.lepage@savoirfairelinux.com >*
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 3 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>. *
 **************************************************************************/
#ifndef CALL_VIEW_OVERLAY_H
#define CALL_VIEW_OVERLAY_H

//Qt
#include <QtGui/QToolButton>

//Base
#include <QtGui/QWidget>
#include <QtCore/QHash>
#include "lib/sflphone_const.h"

//Qt
class QSvgRenderer;
class QToolButton;

//KDE

//SFLPhone
class ExtendedAction;

class ObserverToolButton : public QToolButton
{
   Q_OBJECT
public:
   explicit ObserverToolButton(QWidget* parent = nullptr) : QToolButton(parent){}
public Q_SLOTS:
   void setNewText(const QString& text) {
      setText(text);
   }
};

enum ActionButton {
   PICKUP   = 0,
   HOLD     = 1,
   UNHOLD   = 2,
   HANGUP   = 3,
   MUTE     = 4,
   TRANSFER = 5,
   RECORD   = 6,
   REFUSE   = 7,
};

class CallViewOverlayToolbar : public QWidget
{
   Q_OBJECT
public:
   explicit CallViewOverlayToolbar(QWidget* parent = nullptr);

private:
   //Attributes
   QSvgRenderer* m_pRightRender;
   QSvgRenderer* m_pLeftRender ;

   //Buttons
   ObserverToolButton* m_pHold    ;
   ObserverToolButton* m_pUnhold  ;
   ObserverToolButton* m_pMute    ;
   ObserverToolButton* m_pPickup  ;
   ObserverToolButton* m_pHangup  ;
   ObserverToolButton* m_pTransfer;
   ObserverToolButton* m_pRecord  ;
   ObserverToolButton* m_pRefuse  ;

   QHash<int,ObserverToolButton*> m_hButtons;

   //Helpers
   ObserverToolButton* createButton(ExtendedAction* action);

public Q_SLOTS:
   void updateState(call_state state);

protected:
   void resizeEvent( QResizeEvent* event);
   void paintEvent ( QPaintEvent*  event);
   void hideEvent  ( QHideEvent*   event);
   void showEvent  ( QShowEvent*   event);

Q_SIGNALS:
   void visibilityChanged(bool);

};

#endif