~ubuntu-branches/ubuntu/saucy/sflphone/saucy

« back to all changes in this revision

Viewing changes to sflphone-common/src/preferences.h

  • Committer: Bazaar Package Importer
  • Author(s): Francois Marier
  • Date: 2010-12-24 16:33:55 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20101224163355-tkvvikqxbrbav6up
Tags: 0.9.11-1
* New upstream release
* Add new build dependencies on libwebkit-dev and libyaml-dev

* Bump Standards-Version up to 3.9.1
* Bump debhelper compatibility to 8
* Patch another typo in the upstream code (lintian notice)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *  Copyright (C) 2004, 2005, 2006, 2009, 2008, 2009, 2010 Savoir-Faire Linux Inc.
 
3
 *  Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com>
 
4
 *
 
5
 *  This program is free software; you can redistribute it and/or modify
 
6
 *  it under the terms of the GNU General Public License as published by
 
7
 *  the Free Software Foundation; either version 3 of the License, or
 
8
 *  (at your option) any later version.
 
9
 *
 
10
 *  This program 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
 
13
 *  GNU 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, write to the Free Software
 
17
 *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
18
 *
 
19
 *  Additional permission under GNU GPL version 3 section 7:
 
20
 *
 
21
 *  If you modify this program, or any covered work, by linking or
 
22
 *  combining it with the OpenSSL project's OpenSSL library (or a
 
23
 *  modified version of that library), containing parts covered by the
 
24
 *  terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
 
25
 *  grants you additional permission to convey the resulting work.
 
26
 *  Corresponding Source for a non-source form of such a combination
 
27
 *  shall include the source code for the parts of OpenSSL used as well
 
28
 *  as that of the covered work.
 
29
 */
 
30
 
 
31
#ifndef __PREFERENCE_H__
 
32
#define __PREFERENCE_H__
 
33
 
 
34
#include "config/serializable.h"
 
35
 
 
36
// general preferences
 
37
const Conf::Key orderKey ("order");                         // :        1234/2345/
 
38
const Conf::Key audioApiKey ("audioApi");                   // :        0
 
39
const Conf::Key historyLimitKey ("historyLimit");           // :        30
 
40
const Conf::Key historyMaxCallsKey ("historyMaxCalls");     // :        20
 
41
const Conf::Key notifyMailsKey ("notifyMails");             // :        false
 
42
const Conf::Key zoneToneChoiceKey ("zoneToneChoice");       // :        North America
 
43
const Conf::Key registrationExpireKey ("registrationExpire");// :       180
 
44
const Conf::Key portNumKey ("portNum");                     // :        5060
 
45
const Conf::Key searchBarDisplayKey ("searchBarDisplay");   // :        true
 
46
const Conf::Key zeroConfenableKey ("zeroConfenable");       // :        false
 
47
const Conf::Key md5HashKey ("md5Hash");                     // :        false
 
48
 
 
49
// voip preferences
 
50
const Conf::Key playDtmfKey ("playDtmf"); // true                    true
 
51
const Conf::Key playTonesKey ("playTones"); // true
 
52
const Conf::Key pulseLengthKey ("pulseLength"); //=250
 
53
const Conf::Key symmetricRtpKey ("symmetric");// =true
 
54
const Conf::Key zidFileKey ("zidFile");// =sfl.zid
 
55
 
 
56
// addressbook preferences
 
57
const Conf::Key photoKey ("photo");//           false
 
58
const Conf::Key enabledKey ("enabled");//               true
 
59
const Conf::Key listKey ("list");//             1243608768.30329.0@emilou-desktop/1243456917.15690.23@emilou-desktop/
 
60
const Conf::Key maxResultsKey ("maxResults");//         25
 
61
const Conf::Key businessKey ("business");//             true
 
62
const Conf::Key homeKey ("home");//             false
 
63
const Conf::Key mobileKey ("mobile");//         false
 
64
 
 
65
// hooks preferences
 
66
const Conf::Key iax2EnabledKey ("iax2Enabled");// :             false
 
67
const Conf::Key numberAddPrefixKey ("numberAddPrefix");//:      false
 
68
const Conf::Key numberEnabledKey ("numberEnabled"); //: false
 
69
const Conf::Key sipEnabledKey ("sipEnabled"); //:               false
 
70
const Conf::Key urlCommandKey ("urlCommand"); //:               x-www-browser
 
71
const Conf::Key urlSipFieldKey ("urlSipField"); //:             X-sflphone-url
 
72
 
 
73
// audio preferences
 
74
const Conf::Key alsamapKey ("alsa");
 
75
const Conf::Key pulsemapKey ("pulse");
 
76
const Conf::Key cardinKey ("cardIn");// : 0
 
77
const Conf::Key cardoutKey ("cardOut");// 0
 
78
const Conf::Key cardringKey ("cardRing");// : 0
 
79
const Conf::Key framesizeKey ("frameSize");// : 20
 
80
const Conf::Key pluginKey ("plugin"); //: default
 
81
const Conf::Key smplrateKey ("smplRate");//: 44100
 
82
const Conf::Key devicePlaybackKey ("devicePlayback");//:
 
83
const Conf::Key deviceRecordKey ("deviceRecord");// :
 
84
const Conf::Key deviceRingtoneKey ("deviceRingtone");// :
 
85
const Conf::Key recordpathKey ("recordPath");//: /home/msavard/Bureau
 
86
const Conf::Key volumemicKey ("volumeMic");//:  100
 
87
const Conf::Key volumespkrKey ("volumeSpkr");//: 100
 
88
const Conf::Key noiseReduceKey ("noiseReduce");
 
89
 
 
90
// shortcut preferences
 
91
const Conf::Key hangupShortKey ("hangUp");
 
92
const Conf::Key pickupShortKey ("pickUp");
 
93
const Conf::Key popupShortKey ("popupWindow");
 
94
const Conf::Key toggleHoldShortKey ("toggleHold");
 
95
const Conf::Key togglePickupHangupShortKey ("togglePickupHangup");
 
96
 
 
97
 
 
98
class Preferences : public Serializable
 
99
{
 
100
 
 
101
    public:
 
102
 
 
103
        Preferences();
 
104
 
 
105
        ~Preferences();
 
106
 
 
107
        virtual void serialize (Conf::YamlEmitter *emitter);
 
108
 
 
109
        virtual void unserialize (Conf::MappingNode *map);
 
110
 
 
111
 
 
112
        std::string getAccountOrder (void) {
 
113
            return _accountOrder;
 
114
        }
 
115
        void setAccountOrder (std::string ord) {
 
116
            _accountOrder = ord;
 
117
        }
 
118
 
 
119
        int getAudioApi (void) {
 
120
            return _audioApi;
 
121
        }
 
122
        void setAudioApi (int api) {
 
123
            _audioApi = api;
 
124
        }
 
125
 
 
126
        int getHistoryLimit (void) {
 
127
            return _historyLimit;
 
128
        }
 
129
        void setHistoryLimit (int lim) {
 
130
            _historyLimit = lim;
 
131
        }
 
132
 
 
133
        int getHistoryMaxCalls (void) {
 
134
            return _historyMaxCalls;
 
135
        }
 
136
        void setHistoryMaxCalls (int max) {
 
137
            _historyMaxCalls = max;
 
138
        }
 
139
 
 
140
        bool getNotifyMails (void) {
 
141
            return _notifyMails;
 
142
        }
 
143
        void setNotifyMails (bool mails) {
 
144
            _notifyMails = mails;
 
145
        }
 
146
 
 
147
        std::string getZoneToneChoice (void) {
 
148
            return _zoneToneChoice;
 
149
        }
 
150
        void setZoneToneChoice (std::string str) {
 
151
            _zoneToneChoice = str;
 
152
        }
 
153
 
 
154
        int getRegistrationExpire (void) {
 
155
            return _registrationExpire;
 
156
        }
 
157
        void setRegistrationExpire (int exp) {
 
158
            _registrationExpire = exp;
 
159
        }
 
160
 
 
161
        int getPortNum (void) {
 
162
            return _portNum;
 
163
        }
 
164
        void setPortNum (int port) {
 
165
            _portNum = port;
 
166
        }
 
167
 
 
168
        bool getSearchBarDisplay (void) {
 
169
            return _searchBarDisplay;
 
170
        }
 
171
        void setSearchBarDisplay (bool search) {
 
172
            _searchBarDisplay = search;
 
173
        }
 
174
 
 
175
        bool getZeroConfenable (void) {
 
176
            return _zeroConfenable;
 
177
        }
 
178
        void setZeroConfenable (bool enable) {
 
179
            _zeroConfenable = enable;
 
180
        }
 
181
 
 
182
        bool getMd5Hash (void) {
 
183
            return _md5Hash;
 
184
        }
 
185
        void setMd5Hash (bool md5) {
 
186
            _md5Hash = md5;
 
187
        }
 
188
 
 
189
    private:
 
190
 
 
191
        // account order
 
192
        std::string _accountOrder;
 
193
 
 
194
        int _audioApi;
 
195
        int _historyLimit;
 
196
        int _historyMaxCalls;
 
197
        bool _notifyMails;
 
198
        std::string _zoneToneChoice;
 
199
        int _registrationExpire;
 
200
        int _portNum;
 
201
        bool _searchBarDisplay;
 
202
        bool _zeroConfenable;
 
203
        bool _md5Hash;
 
204
 
 
205
};
 
206
 
 
207
 
 
208
class VoipPreference : public Serializable
 
209
{
 
210
 
 
211
    public:
 
212
 
 
213
        VoipPreference();
 
214
 
 
215
        ~VoipPreference();
 
216
 
 
217
        virtual void serialize (Conf::YamlEmitter *emitter);
 
218
 
 
219
        virtual void unserialize (Conf::MappingNode *map);
 
220
 
 
221
        bool getPlayDtmf (void) {
 
222
            return _playDtmf;
 
223
        }
 
224
        void setPlayDtmf (bool dtmf) {
 
225
            _playDtmf = dtmf;
 
226
        }
 
227
 
 
228
        bool getPlayTones (void) {
 
229
            return _playTones;
 
230
        }
 
231
        void setPlayTones (bool tone) {
 
232
            _playTones = tone;
 
233
        }
 
234
 
 
235
        int getPulseLength (void) {
 
236
            return _pulseLength;
 
237
        }
 
238
        void setPulseLength (int length) {
 
239
            _pulseLength = length;
 
240
        }
 
241
 
 
242
        bool getSymmetricRtp (void) {
 
243
            return _symmetricRtp;
 
244
        }
 
245
        void setSymmetricRtp (bool sym) {
 
246
            _symmetricRtp = sym;
 
247
        }
 
248
 
 
249
        std::string getZidFile (void) {
 
250
            return _zidFile;
 
251
        }
 
252
        void setZidFile (std::string file) {
 
253
            _zidFile = file;
 
254
        }
 
255
 
 
256
    private:
 
257
 
 
258
        bool _playDtmf;
 
259
        bool _playTones;
 
260
        int _pulseLength;
 
261
        bool _symmetricRtp;
 
262
        std::string _zidFile;
 
263
 
 
264
};
 
265
 
 
266
class AddressbookPreference : public Serializable
 
267
{
 
268
 
 
269
    public:
 
270
 
 
271
        AddressbookPreference();
 
272
 
 
273
        ~AddressbookPreference();
 
274
 
 
275
        virtual void serialize (Conf::YamlEmitter *emitter);
 
276
 
 
277
        virtual void unserialize (Conf::MappingNode *map);
 
278
 
 
279
        bool getPhoto (void) {
 
280
            return _photo;
 
281
        }
 
282
        void setPhoto (bool p) {
 
283
            _photo = p;
 
284
        }
 
285
 
 
286
        bool getEnabled (void) {
 
287
            return _enabled;
 
288
        }
 
289
        void setEnabled (bool e) {
 
290
            _enabled = e;
 
291
        }
 
292
 
 
293
        std::string getList (void) {
 
294
            return _list;
 
295
        }
 
296
        void setList (std::string l) {
 
297
            _list = l;
 
298
        }
 
299
 
 
300
        int getMaxResults (void) {
 
301
            return _maxResults;
 
302
        }
 
303
        void setMaxResults (int r) {
 
304
            _maxResults = r;
 
305
        }
 
306
 
 
307
        bool getBusiness (void) {
 
308
            return _business;
 
309
        }
 
310
        void setBusiness (bool b) {
 
311
            _business = b;
 
312
        }
 
313
 
 
314
        bool getHome (void) {
 
315
            return _home;
 
316
        }
 
317
        void setHone (bool h) {
 
318
            _home = h;
 
319
        }
 
320
 
 
321
        bool getMobile (void) {
 
322
            return _mobile;
 
323
        }
 
324
        void setMobile (bool m) {
 
325
            _mobile = m;
 
326
        }
 
327
 
 
328
    private:
 
329
 
 
330
        bool _photo;
 
331
        bool _enabled;
 
332
        std::string _list;
 
333
        int _maxResults;
 
334
        bool _business;
 
335
        bool _home;
 
336
        bool _mobile;
 
337
 
 
338
};
 
339
 
 
340
 
 
341
class HookPreference : public Serializable
 
342
{
 
343
 
 
344
    public:
 
345
 
 
346
        HookPreference();
 
347
 
 
348
        ~HookPreference();
 
349
 
 
350
        virtual void serialize (Conf::YamlEmitter *emitter);
 
351
 
 
352
        virtual void unserialize (Conf::MappingNode *map);
 
353
 
 
354
        bool getIax2Enabled (void) {
 
355
            return _iax2Enabled;
 
356
        }
 
357
        void setIax2Enabled (bool i) {
 
358
            _iax2Enabled = i;
 
359
        }
 
360
 
 
361
        std::string getNumberAddPrefix (void) {
 
362
            return _numberAddPrefix;
 
363
        }
 
364
        void setNumberAddPrefix (std::string n) {
 
365
            _numberAddPrefix = n;
 
366
        }
 
367
 
 
368
        bool getNumberEnabled (void) {
 
369
            return _numberEnabled;
 
370
        }
 
371
        void setNumberEnabled (bool n) {
 
372
            _numberEnabled = n;
 
373
        }
 
374
 
 
375
        bool getSipEnabled (void) {
 
376
            return _sipEnabled;
 
377
        }
 
378
        void setSipEnabled (bool s) {
 
379
            _sipEnabled = s;
 
380
        }
 
381
 
 
382
        std::string getUrlCommand (void) {
 
383
            return _urlCommand;
 
384
        }
 
385
        void setUrlCommand (std::string u) {
 
386
            _urlCommand = u;
 
387
        }
 
388
 
 
389
        std::string getUrlSipField (void) {
 
390
            return _urlSipField;
 
391
        }
 
392
        void setUrlSipField (std::string u) {
 
393
            _urlSipField = u;
 
394
        }
 
395
 
 
396
    private:
 
397
 
 
398
        bool _iax2Enabled;// :          false
 
399
        std::string _numberAddPrefix;//:        false
 
400
        bool _numberEnabled; //:        false
 
401
        bool _sipEnabled; //:           false
 
402
        std::string _urlCommand; //:            x-www-browser
 
403
        std::string _urlSipField; //:           X-sflphone-url
 
404
 
 
405
};
 
406
 
 
407
 
 
408
class AudioPreference : public Serializable
 
409
{
 
410
 
 
411
    public:
 
412
 
 
413
        AudioPreference();
 
414
 
 
415
        ~AudioPreference();
 
416
 
 
417
        virtual void serialize (Conf::YamlEmitter *emitter);
 
418
 
 
419
        virtual void unserialize (Conf::MappingNode *map);
 
420
 
 
421
        // alsa preference
 
422
        int getCardin (void) {
 
423
            return _cardin;
 
424
        }
 
425
        void setCardin (int c) {
 
426
            _cardin = c;
 
427
        }
 
428
 
 
429
        int getCardout (void) {
 
430
            return _cardout;
 
431
        }
 
432
        void setCardout (int c) {
 
433
            _cardout = c;
 
434
        }
 
435
 
 
436
        int getCardring (void) {
 
437
            return _cardring;
 
438
        }
 
439
        void setCardring (int c) {
 
440
            _cardring = c;
 
441
        }
 
442
 
 
443
        int getFramesize (void) {
 
444
            return _framesize;
 
445
        }
 
446
        void setFramesize (int f) {
 
447
            _framesize = f;
 
448
        }
 
449
 
 
450
        std::string getPlugin (void) {
 
451
            return _plugin;
 
452
        }
 
453
        void setPlugin (std::string p) {
 
454
            _plugin = p;
 
455
        }
 
456
 
 
457
        int getSmplrate (void) {
 
458
            return _smplrate;
 
459
        }
 
460
        void setSmplrate (int r) {
 
461
            _smplrate = r;
 
462
        }
 
463
 
 
464
        //pulseaudio preference
 
465
        std::string getDevicePlayback (void) {
 
466
            return _devicePlayback;
 
467
        }
 
468
        void setDevicePlayback (std::string p) {
 
469
            _devicePlayback = p;
 
470
        }
 
471
 
 
472
        std::string getDeviceRecord (void) {
 
473
            return _deviceRecord;
 
474
        }
 
475
        void setDeviceRecord (std::string r) {
 
476
            _deviceRecord = r;
 
477
        }
 
478
 
 
479
        std::string getDeviceRingtone (void) {
 
480
            return _deviceRingtone;
 
481
        }
 
482
        void setDeviceRingtone (std::string r) {
 
483
            _deviceRingtone = r;
 
484
        }
 
485
 
 
486
        // general preference
 
487
        std::string getRecordpath (void) {
 
488
            return _recordpath;
 
489
        }
 
490
        void setRecordpath (std::string r) {
 
491
            _recordpath = r;
 
492
        }
 
493
 
 
494
        int getVolumemic (void) {
 
495
            return _volumemic;
 
496
        }
 
497
        void setVolumemic (int m) {
 
498
            _volumemic = m;
 
499
        }
 
500
 
 
501
        int getVolumespkr (void) {
 
502
            return _volumespkr;
 
503
        }
 
504
        void setVolumespkr (int s) {
 
505
            _volumespkr = s;
 
506
        }
 
507
 
 
508
        bool getNoiseReduce (void) {
 
509
            return _noisereduce;
 
510
        }
 
511
 
 
512
        void setNoiseReduce (bool noise) {
 
513
            _noisereduce = noise;
 
514
        }
 
515
 
 
516
    private:
 
517
 
 
518
        // alsa preference
 
519
        int _cardin; // 0
 
520
        int _cardout; // 0
 
521
        int _cardring;// 0
 
522
        int _framesize; // 20
 
523
        std::string _plugin; // default
 
524
        int _smplrate;// 44100
 
525
 
 
526
        //pulseaudio preference
 
527
        std::string _devicePlayback;//:
 
528
        std::string _deviceRecord; //:
 
529
        std::string _deviceRingtone; //:
 
530
 
 
531
        // general preference
 
532
        std::string _recordpath; //: /home/msavard/Bureau
 
533
        int _volumemic; //:  100
 
534
        int _volumespkr; //: 100
 
535
 
 
536
        bool _noisereduce;
 
537
};
 
538
 
 
539
 
 
540
class ShortcutPreferences : public Serializable
 
541
{
 
542
 
 
543
    public:
 
544
 
 
545
        ShortcutPreferences();
 
546
 
 
547
        ~ShortcutPreferences();
 
548
 
 
549
        virtual void serialize (Conf::YamlEmitter *emitter);
 
550
 
 
551
        virtual void unserialize (Conf::MappingNode *map);
 
552
 
 
553
        void setShortcuts (std::map<std::string, std::string> shortcut);
 
554
        std::map<std::string, std::string> getShortcuts (void);
 
555
 
 
556
        std::string getHangup (void) {
 
557
            return _hangup;
 
558
        }
 
559
        void setHangup (std::string hangup) {
 
560
            _hangup = hangup;
 
561
        }
 
562
 
 
563
        std::string getPickup (void) {
 
564
            return _pickup;
 
565
        }
 
566
        void setPickup (std::string pickup) {
 
567
            _pickup = pickup;
 
568
        }
 
569
 
 
570
        std::string getPopup (void) {
 
571
            return _popup;
 
572
        }
 
573
        void setPopup (std::string popup) {
 
574
            _popup = popup;
 
575
        }
 
576
 
 
577
        std::string getToggleHold (void) {
 
578
            return _toggleHold;
 
579
        }
 
580
        void setToggleHold (std::string hold) {
 
581
            _toggleHold = hold;
 
582
        }
 
583
 
 
584
        std::string getTogglePickupHangup (void) {
 
585
            return _togglePickupHangup;
 
586
        }
 
587
        void setTogglePickupHangup (std::string toggle) {
 
588
            _togglePickupHangup = toggle;
 
589
        }
 
590
 
 
591
    private:
 
592
 
 
593
        std::string _hangup;
 
594
        std::string _pickup;
 
595
        std::string _popup;
 
596
        std::string _toggleHold;
 
597
        std::string _togglePickupHangup;
 
598
 
 
599
};
 
600
 
 
601
#endif