SFLPhoneView.h 7.17 KB
Newer Older
1
/***************************************************************************
2
 *   Copyright (C) 2009-2012 by Savoir-Faire Linux                         *
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
 *   Author : Jérémy Quentin <jeremy.quentin@savoirfairelinux.com>         *
 *            Emmanuel Lepage Vallee <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, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
Emmanuel Lepage's avatar
Emmanuel Lepage committed
20
 **************************************************************************/
21
22
23
24

#ifndef SFLPHONEVIEW_H
#define SFLPHONEVIEW_H

Emmanuel Lepage's avatar
Emmanuel Lepage committed
25
26
#include "ui_SFLPhoneView_base.h"
#include <QtGui/QWidget>
27

Emmanuel Lepage's avatar
Emmanuel Lepage committed
28
29
30
31
//Qt
class QString;
class QKeyEvent;
class QErrorMessage;
32

Emmanuel Lepage's avatar
Emmanuel Lepage committed
33
34
35
36
//SFLPhone
class AccountWizard;


37
38
39
40
41
42
43
44
45
46
/**
 * This is the main view class for sflphone-client-kde.  Most of the non-menu,
 * non-toolbar, and non-statusbar (e.g., non frame) GUI code should go
 * here.
 * As the state of the view has effects on the window,
 * it emits some signals to ask for changes that the window has
 * to treat.
 *
 * @short Main view
 * @author Jérémy Quentin <jeremy.quentin@savoirfairelinux.com>
47
 * @version 1.1.0
48
49
50
51
 */
class SFLPhoneView : public QWidget, public Ui::SFLPhone_view
{
   Q_OBJECT
52

53
private:
54
55
   AccountWizard* wizard     ;
   QErrorMessage* errorWindow;
56
57

protected:
58

59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
   /**
    * override context menu handling
    * @param event
    */
   void contextMenuEvent(QContextMenuEvent *event);

public:
   //Constructors & Destructors
   /**
    *   This constructor does not load the window as it would
    *   better wait for the parent window to connect to the signals
    *   for updating it (statusMessageChangeAsked...).
    *   You should call the loadWindow() method once
    *   you have constructed the object and connected the
    *   expected signals.
74
    * @param parent
75
76
77
    */
   SFLPhoneView(QWidget *parent);
   virtual ~SFLPhoneView();
78

79
80
   //Getters
   QErrorMessage * getErrorWindow();
81
82


Emmanuel Lepage's avatar
Emmanuel Lepage committed
83
   bool selectCallPhoneNumber(Call** call,Contact* contact);
84

85
86
87
88
89
90
91
92
93
private slots:
   /**
    *   Performs the action action on the call call, then updates window.
    *   The call object will handle the action with its "actionPerformed" method.
    *   See the documentation for more details.
    * @param call the call on which to perform the action
    * @param action the code of the action to perform
    */
   void action(Call * call, call_action action);
94

95
96
97
   /**
    *   Sets the account account to be the prior account.
    *   That means it's gonna be used when the user places a call
98
    *   if it's defined and registered, else the first registered of
99
100
101
102
    *   accountList will be used.
    * @param account the account to use prior
    */
   void setAccountFirst(Account * account);
103

104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
   /**
    *   Handles the behaviour when the user types something with
    *   the dialpad widget or his keyboard (normally it's a one char
    *   string but we use a string just in case).
    *   Adds str to the selected item if in the main window
    *   and creates a new item if no item is selected.
    *   Send DTMF if appropriate according to current item's state.
    *   Adds str to the search bar if in history or address book.
    * @param str the string sent by the user
    */
   void typeString(QString str);

   /**
    *   Handles the behaviour when the user types a backspace
    *   according to the current state (window, item selected...)
    */
   void backspace();

   /**
    *   Handles the behaviour when the user types escape
    *   according to the current state (window, item selected...)
    */
   void escape();

   /**
    *   Handles the behaviour when the user types enter
    *   according to the current state (window, item selected...)
    */
   void enter();

   /**
    * Updates the history's search bar's display according to the current
136
    * text searched.
137
138
    * If empty, hide the search bar.
    */
139
140
   void updateRecordButton   ();
   void updateVolumeButton   ();
Emmanuel Lepage's avatar
Emmanuel Lepage committed
141
142
   void updateRecordBar      (double _value = -1);
   void updateVolumeBar      (double _value = -1);
143
144
   void updateVolumeControls ();
   void updateDialpad        ();
145
   void sendMessage          ();
146

147
148


149
150
151
152
153
154
public slots:
   /**
    * Updates all the display
    * according to the settings.
    */
   void loadWindow();
155

156
   /**
157
    *   Updates the toolbar's actions' display according to the selected
158
159
160
    *   item's state.
    */
   void updateWindowCallState();
161
162


163
   void updateStatusMessage();
164
165


166
   virtual void keyPressEvent(QKeyEvent *event);
167

168
169
170
171
172
   void displayVolumeControls ( bool checked = true );
   void displayDialpad        ( bool checked = true );
   void displayMessageBox     ( bool checked = true );
   void configureSflPhone     ();
   void accountCreationWizard ();
173
174
175
176
177
178
   void accept   ();
   void refuse   ();
   void hold     ();
   void transfer ();
   void record   ();
   void mailBox  ();
Emmanuel Lepage's avatar
Emmanuel Lepage committed
179
   void paste    ();
180

181
   void on_widget_dialpad_typed(QString text);
182

Emmanuel Lepage's avatar
Emmanuel Lepage committed
183
184
185
186
   void on_slider_recVol_valueChanged ( int value    );
   void on_slider_sndVol_valueChanged ( int value    );
   void on_toolButton_recVol_clicked  ( bool checked );
   void on_toolButton_sndVol_clicked  ( bool checked );
187

188
189
190
191
   void on1_error          ( MapStringString details             );
   void on1_incomingCall   ( Call* call                          );
   void on1_voiceMailNotify( const QString &accountID, int count );
   void on1_volumeChanged  ( const QString &device, double value );
192

193
signals:
Emmanuel Lepage's avatar
Emmanuel Lepage committed
194
   ///The status need to be updated
195
   void statusMessageChangeAsked      ( const QString&  message            );
Emmanuel Lepage's avatar
Emmanuel Lepage committed
196
   ///The window title need to be updated
197
   void windowTitleChangeAsked        ( const QString&  title              );
Emmanuel Lepage's avatar
Emmanuel Lepage committed
198
   ///The toolbar need to be updated
199
   void enabledActionsChangeAsked     ( const bool*     enabledActions     );
Emmanuel Lepage's avatar
Emmanuel Lepage committed
200
   ///Toolbar/actions icons need to be changed
201
   void actionIconsChangeAsked        ( const QString*  actionIcons        );
Emmanuel Lepage's avatar
Emmanuel Lepage committed
202
   ///Action string need to be changed
203
   void actionTextsChangeAsked        ( const QString*  actionTexts        );
Emmanuel Lepage's avatar
Emmanuel Lepage committed
204
   ///Transfer state has changed
205
   void transferCheckStateChangeAsked ( bool            transferCheckState );
Emmanuel Lepage's avatar
Emmanuel Lepage committed
206
   ///Record state has changed
207
   void recordCheckStateChangeAsked   ( bool            recordCheckState   );
Emmanuel Lepage's avatar
Emmanuel Lepage committed
208
   ///When a new call is comming
209
210
211
212
   void incomingCall(const Call * call);
};

#endif // SFLPHONEVIEW_H