ff3c3c9e980766ea64045916b2b8c69bc60bd05e
[profile/ivi/hfdialer.git] / src / common.h
1 /*
2  * hfdialer - Hands Free Voice Call Manager
3  * Copyright (c) 2012, Intel Corporation.
4  *
5  * This program is licensed under the terms and conditions of the
6  * Apache License, version 2.0.  The full text of the Apache License is at
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  */
10
11 #ifndef COMMON_H
12 #define COMMON_H
13
14 #ifndef WANT_DEBUG
15 #define TRACE
16 #else
17 #include <QDebug>
18 #define TRACE qDebug()<<QString("[%1] %2(): %3").arg(__FILE__).arg(__func__).arg(__LINE__);
19 #endif
20
21 /*
22  * Commonly used QRegExp expressions
23  */
24 #include <QRegExp>
25 #define MATCH_ANY(p) QRegExp(p,Qt::CaseInsensitive,QRegExp::FixedString)
26 #define MATCH_ALL QRegExp()
27
28 /*
29  * Commonly used values for MNotifications
30  */
31 #define DEFAULT_AVATAR_ICON "icon-m-content-avatar-placeholder"
32 #define NOTIFICATION_CALL_EVENT "x-nokia.call"
33
34 /*
35  * Convienence macro for showing TBD message
36  */
37 #define SHOW_TBD \
38     MainWindow *w = dynamic_cast<MainWindow *>(DialerApplication::instance()->activeApplicationWindow()); \
39     if (w) \
40        w->showTBD();
41
42 /*
43  * Convience macro for checking available dialer modes
44  */
45 #define CONFIG_KEY_TARGET_MODE "/apps/dialer/mode"
46 #define MODE_HFP_STR "hfp"
47 #define MODE_HANDSET_STR "handset"
48 #define MODE_HFP_ENABLED DC->modes().contains(MODE_HFP_STR)
49 #define MODE_HANDSET_ENABLED DC->modes().contains(MODE_HANDSET_STR)
50 QString stripLineID(QString lineid);
51
52 bool currentPageIs(int pagenum);
53
54 #include <QDateTime>
55 QDateTime qDateTimeFromOfono(const QString &val);
56
57 #endif // COMMON_H