summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLubos Dolezel <lubos@dolezel.info>2015-06-08 23:53:43 +0200
committerLubos Dolezel <lubos@dolezel.info>2015-06-08 23:54:33 +0200
commita12e6ec5597528fe77cbbdd9ac42308c3147f7d5 (patch)
treeddd98b192a0624c9f53dd55542ae0ab2bc90defd
parentb777beb72c0b5877039da813c29a76b472a40842 (diff)
downloadtwinkle-a12e6ec5597528fe77cbbdd9ac42308c3147f7d5.tar
twinkle-a12e6ec5597528fe77cbbdd9ac42308c3147f7d5.tar.gz
twinkle-a12e6ec5597528fe77cbbdd9ac42308c3147f7d5.tar.lz
twinkle-a12e6ec5597528fe77cbbdd9ac42308c3147f7d5.tar.xz
twinkle-a12e6ec5597528fe77cbbdd9ac42308c3147f7d5.zip
Added OSD with mute and hangup buttons (resolves #10)
-rw-r--r--CMakeLists.txt14
-rw-r--r--src/gui/CMakeLists.txt9
-rw-r--r--src/gui/icons.qrc5
-rw-r--r--src/gui/images/osd_hangup.pngbin0 -> 1263 bytes
-rw-r--r--src/gui/images/osd_mic_off.pngbin0 -> 901 bytes
-rw-r--r--src/gui/images/osd_mic_on.pngbin0 -> 658 bytes
-rw-r--r--src/gui/mphoneform.cpp99
-rw-r--r--src/gui/mphoneform.h9
-rw-r--r--src/gui/osd.cpp97
-rw-r--r--src/gui/osd.h52
-rw-r--r--src/gui/qml/ImageButton.qml28
-rw-r--r--src/gui/qml/osd.qml94
-rw-r--r--src/gui/qml/qml.qrc6
-rw-r--r--src/gui/syssettingsform.cpp3
-rw-r--r--src/gui/syssettingsform.ui23
-rw-r--r--src/sys_settings.cpp15
-rw-r--r--src/sys_settings.h3
17 files changed, 437 insertions, 20 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 769c440..5057333 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -34,17 +34,19 @@ find_package(Ccrtp REQUIRED)
find_package(Ucommon REQUIRED)
if (WITH_QT4)
- find_package(Qt4 REQUIRED COMPONENTS QTGUI)
+ find_package(Qt4 REQUIRED COMPONENTS QTGUI QTDECLARATIVE)
include_directories(${QT_QT3SUPPORT_INCLUDE_DIR}
- ${QT_QTCORE_INCLUDE_DIR} ${QT_QTGUI_INCLUDE_DIR} ${QT_INCLUDE_DIR})
+ ${QT_QTCORE_INCLUDE_DIR} ${QT_QTGUI_INCLUDE_DIR}
+ ${QT_QTDECLARATIVE_INCLUDE_DIR} ${QT_INCLUDE_DIR})
elseif (WITH_QT5)
-
find_package(Qt5Widgets REQUIRED)
find_package(Qt5LinguistTools REQUIRED)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
- include_directories(${Qt5Widgets_INCLUDES})
- add_definitions(${Qt5Widgets_DEFINITIONS})
+ find_package(Qt5Quick REQUIRED)
+ find_package(Qt5Declarative REQUIRED)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS} ${Qt5Declarative_EXECUTABLE_COMPILE_FLAGS}")
+ include_directories(${Qt5Widgets_INCLUDES} ${Qt5Declarative_INCLUDES})
+ add_definitions(${Qt5Widgets_DEFINITIONS} ${Qt5Declarative_DEFINITIONS})
endif (WITH_QT4)
include_directories(${LIBXML2_INCLUDE_DIR})
diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt
index fdb3697..b75d7c8 100644
--- a/src/gui/CMakeLists.txt
+++ b/src/gui/CMakeLists.txt
@@ -46,13 +46,13 @@ qt4_wrap_ui(
${twinkle_ui_SRC}
)
-qt4_add_resources(twinkle_QRC icons.qrc)
+qt4_add_resources(twinkle_QRC icons.qrc qml/qml.qrc)
qt4_add_translation(twinkle_LANG
${twinkle_lang_SRC}
)
-set(qt_LIBS Qt4::QtGui)
+set(qt_LIBS Qt4::QtGui Qt4::QtDeclarative)
elseif (WITH_QT5)
@@ -61,13 +61,13 @@ qt5_wrap_ui(
${twinkle_ui_SRC}
)
-qt5_add_resources(twinkle_QRC icons.qrc)
+qt5_add_resources(twinkle_QRC icons.qrc qml/qml.qrc)
qt5_add_translation(twinkle_LANG
${twinkle_lang_SRC}
)
-set(qt_LIBS Qt5::Widgets)
+set(qt_LIBS Qt5::Widgets Qt5::Quick Qt5::Declarative)
endif (WITH_QT4)
set(CMAKE_AUTOMOC ON)
@@ -108,6 +108,7 @@ set(TWINKLE_GUI-SRCS
twinkleapplication.cpp
yesnodialog.cpp
textbrowsernoautolink.cpp
+ osd.cpp
$<TARGET_OBJECTS:libtwinkle>
$<TARGET_OBJECTS:libtwinkle-audio>
diff --git a/src/gui/icons.qrc b/src/gui/icons.qrc
index 151f01b..11ca260 100644
--- a/src/gui/icons.qrc
+++ b/src/gui/icons.qrc
@@ -1,4 +1,4 @@
-<RCC version="1.0">
+<RCC>
<qresource prefix="/icons">
<file>images/answer-disabled.png</file>
<file>images/answer.png</file>
@@ -161,5 +161,8 @@
<file>images/1leftarrow-yellow.png</file>
<file>images/1rightarrow.png</file>
<file>images/1uparrow.png</file>
+ <file>images/osd_hangup.png</file>
+ <file>images/osd_mic_off.png</file>
+ <file>images/osd_mic_on.png</file>
</qresource>
</RCC>
diff --git a/src/gui/images/osd_hangup.png b/src/gui/images/osd_hangup.png
new file mode 100644
index 0000000..0c9e89a
--- /dev/null
+++ b/src/gui/images/osd_hangup.png
Binary files differ
diff --git a/src/gui/images/osd_mic_off.png b/src/gui/images/osd_mic_off.png
new file mode 100644
index 0000000..54f0d7f
--- /dev/null
+++ b/src/gui/images/osd_mic_off.png
Binary files differ
diff --git a/src/gui/images/osd_mic_on.png b/src/gui/images/osd_mic_on.png
new file mode 100644
index 0000000..5eafe8a
--- /dev/null
+++ b/src/gui/images/osd_mic_on.png
Binary files differ
diff --git a/src/gui/mphoneform.cpp b/src/gui/mphoneform.cpp
index 96a3519..e761f6f 100644
--- a/src/gui/mphoneform.cpp
+++ b/src/gui/mphoneform.cpp
@@ -31,6 +31,7 @@
#include <QMouseEvent>
#include <QCloseEvent>
#include <QKeyEvent>
+#include <QtDebug>
#include <QEvent>
#include <QFrame>
#include "../audits/memman.h"
@@ -38,6 +39,7 @@
#include <QTextEdit>
#include <QCheckBox>
#include <QApplication>
+#include <QDesktopWidget>
#include "gui.h"
#include <QPixmap>
#include <QIcon>
@@ -54,6 +56,7 @@
#include <QValidator>
#include "buddyform.h"
#include "diamondcardprofileform.h"
+#include "osd.h"
// Time (s) that the conversation timer of a line should stay visible after
@@ -165,6 +168,13 @@ void MphoneForm::init()
//from2Label->setPaletteBackgroundColor(paletteBackgroundColor());
//to2Label->setPaletteBackgroundColor(paletteBackgroundColor());
//subject2Label->setPaletteBackgroundColor(paletteBackgroundColor());
+
+ QDesktopWidget* desktop = QApplication::desktop();
+ osdWindow = new OSD(this);
+
+ osdWindow->move(desktop->width() - osdWindow->width() - 10, 10);
+ connect(osdWindow, SIGNAL(hangupClicked()), this, SLOT(phoneBye()));
+ connect(osdWindow, SIGNAL(muteClicked()), this, SLOT(osdMuteClicked()));
// A QComboBox accepts a new line through copy/paste.
QRegExp rxNoNewLine("[^\\n\\r]*");
@@ -412,6 +422,7 @@ void MphoneForm::showLineTimer(int line)
unsigned long duration = t.tv_sec - cr.time_answer;
timerLabel->setText(timer2str(duration).c_str());
+ updateOSD();
}
void MphoneForm::showLineTimer1()
@@ -723,6 +734,8 @@ void MphoneForm::updateState()
{
actionLine2->setChecked(true);
}
+
+ updateOSD();
switch(line_substate) {
case LSSUB_IDLE:
@@ -3200,3 +3213,89 @@ void MphoneForm::sysTrayIconClicked(QSystemTrayIcon::ActivationReason reason)
activateWindow();
}
}
+
+bool MphoneForm::event(QEvent * event)
+{
+ if (event->type() == QEvent::WindowActivate || event->type() == QEvent::WindowDeactivate)
+ osdWindow->setVisible(shouldDisplayOSD());
+
+ return QMainWindow::event(event);
+}
+
+bool MphoneForm::shouldDisplayOSD()
+{
+ if (QApplication::activeWindow() == this)
+ return false;
+
+ t_line_substate ss;
+
+ ss = phone->get_line_substate(phone->get_active_line());
+
+ switch (ss)
+ {
+ case LSSUB_ANSWERING:
+ case LSSUB_ESTABLISHED:
+ case LSSUB_OUTGOING_PROGRESS:
+ break;
+ default:
+ return false;
+ }
+
+ if (!sys_config->get_gui_show_call_osd())
+ return false;
+
+ return true;
+}
+
+void MphoneForm::updateOSD()
+{
+ t_line_substate ss;
+ int line;
+ bool osdDisplayed;
+ struct timeval t;
+ unsigned long duration;
+ t_user *user_config;
+ t_call_record cr;
+
+ osdDisplayed = shouldDisplayOSD();
+ osdWindow->setVisible(osdDisplayed);
+
+ line = phone->get_active_line();
+ ss = phone->get_line_substate(line);
+ user_config = phone->get_line_user(line);
+
+ cr = phone->get_call_hist(line);
+
+ if (ss == LSSUB_ESTABLISHED)
+ {
+ // Calculate duration of call
+ gettimeofday(&t, nullptr);
+ duration = t.tv_sec - cr.time_answer;
+
+ osdWindow->setTime(QString::fromStdString(timer2str(duration)));
+ osdWindow->setMuted(phone->is_line_muted(line));
+ }
+ else
+ {
+ osdWindow->setTime(lineSubstate2str(line));
+ }
+
+ if (ss != LSSUB_IDLE && user_config != nullptr)
+ {
+ std::string address;
+
+ address = (cr.direction == t_call_record::DIR_IN ?
+ ui->format_sip_address(user_config,
+ cr.from_display, cr.from_uri) :
+ ui->format_sip_address(user_config,
+ cr.to_display, cr.to_uri));
+
+ osdWindow->setCaller(QString::fromStdString(address));
+ }
+}
+
+void MphoneForm::osdMuteClicked()
+{
+ ((t_gui *)ui)->action_mute(!phone->is_line_muted(phone->get_active_line()));
+ updateState();
+}
diff --git a/src/gui/mphoneform.h b/src/gui/mphoneform.h
index 14e490f..27be790 100644
--- a/src/gui/mphoneform.h
+++ b/src/gui/mphoneform.h
@@ -26,6 +26,8 @@
class t_phone;
extern t_phone *phone;
+class OSD;
+
class MphoneForm : public QMainWindow, public Ui::MphoneForm
{
Q_OBJECT
@@ -41,6 +43,7 @@ public:
bool getViewCompactLineStatus();
protected:
virtual void closeEvent( QCloseEvent * e ) override;
+ virtual bool event(QEvent * event) override;
public slots:
void fileExit();
void display( const QString & s );
@@ -169,9 +172,13 @@ public slots:
void whatsThis();
void sysTrayIconClicked(QSystemTrayIcon::ActivationReason);
+ void osdMuteClicked();
+
private:
void init();
void destroy();
+ bool shouldDisplayOSD();
+ void updateOSD();
QString lineSubstate2str( int line );
private:
@@ -202,7 +209,7 @@ private:
QMenu *buddyListPopupMenu;
QMenu *changeAvailabilityPopupMenu;
bool viewBuddyList;
-
+ OSD *osdWindow;
};
#endif
diff --git a/src/gui/osd.cpp b/src/gui/osd.cpp
new file mode 100644
index 0000000..1c0ee34
--- /dev/null
+++ b/src/gui/osd.cpp
@@ -0,0 +1,97 @@
+#include "osd.h"
+#include <QtDebug>
+
+#if 0 //QT_VERSION >= 0x050000
+# include <QQuickView>
+# include <QQmlContext>
+# include <QQuickItem>
+#else
+# include <QDeclarativeView>
+# include <QDeclarativeContext>
+# include <QDeclarativeItem>
+#endif
+
+OSD::OSD(QObject* parent)
+ : QObject(parent)
+{
+ m_view = new OSD_VIEWCLASS;
+ // Qt5 QQuickView: setFlags()
+ m_view->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | Qt::ToolTip);
+
+ m_view->rootContext()->setContextProperty("viewerWidget", m_view);
+ m_view->setSource(QUrl("qrc:/qml/osd.qml"));
+
+ QObject* buttonHangup;
+ buttonHangup = m_view->rootObject()->findChild<QObject*>("hangup");
+
+ connect(buttonHangup, SIGNAL(clicked()), this, SLOT(onHangupClicked()));
+
+ m_caller = m_view->rootObject()->findChild<QML_ITEMTYPE*>("callerName");
+ m_time = m_view->rootObject()->findChild<QML_ITEMTYPE*>("callTime");
+ m_mute = m_view->rootObject()->findChild<QML_ITEMTYPE*>("mute");
+
+ connect(m_mute, SIGNAL(clicked()), this, SLOT(onMuteClicked()));
+}
+
+OSD::~OSD()
+{
+ delete m_view;
+}
+
+void OSD::onHangupClicked()
+{
+ emit hangupClicked();
+}
+
+void OSD::onMuteClicked()
+{
+ emit muteClicked();
+}
+
+void OSD::setMuted(bool muted)
+{
+ QString path;
+
+ if (muted)
+ path = "qrc:/icons/images/osd_mic_off.png";
+ else
+ path = "qrc:/icons/images/osd_mic_on.png";
+
+ m_mute->setProperty("image", path);
+}
+
+void OSD::setCaller(const QString& text)
+{
+ m_caller->setProperty("text", text);
+}
+
+void OSD::setTime(const QString& timeText)
+{
+ m_time->setProperty("text", timeText);
+}
+
+void OSD::move(int x, int y)
+{
+ // Qt5 QQuickView: setPosition
+ m_view->move(x, y);
+}
+
+void OSD::show()
+{
+ m_view->show();
+}
+
+void OSD::hide()
+{
+ m_view->hide();
+}
+
+int OSD::width() const
+{
+ return m_view->width();
+}
+
+int OSD::height() const
+{
+ return m_view->height();
+}
diff --git a/src/gui/osd.h b/src/gui/osd.h
new file mode 100644
index 0000000..3d26468
--- /dev/null
+++ b/src/gui/osd.h
@@ -0,0 +1,52 @@
+#ifndef OSD_H
+#define OSD_H
+#include <QObject>
+#include <QString>
+#if 0 //QT_VERSION >= 0x050000
+# define OSD_VIEWCLASS QQuickView
+# define QML_ITEMTYPE QQuickItem
+#else
+# define OSD_VIEWCLASS QDeclarativeView
+# define QML_ITEMTYPE QDeclarativeItem
+#endif
+
+// Must use forward declaration, otherwise build fails
+// due to double QMetaTypeID<QAction*> definition (wtf).
+// Hence I also cannot inherit from OSD_VIEWCLASS...
+class OSD_VIEWCLASS;
+class QML_ITEMTYPE;
+
+class OSD : public QObject
+{
+ Q_OBJECT
+public:
+ OSD(QObject* parent = 0);
+ ~OSD();
+
+ void setCaller(const QString& text);
+ void setTime(const QString& timeText);
+ void setMuted(bool muted);
+
+ void move(int x, int y);
+ void show();
+ void hide();
+ int width() const;
+ int height() const;
+ void setVisible(bool v) { if (v) show(); else hide(); }
+
+public slots:
+ void onHangupClicked();
+ void onMuteClicked();
+
+signals:
+ void hangupClicked();
+ void muteClicked();
+
+private:
+ OSD_VIEWCLASS* m_view;
+ QML_ITEMTYPE* m_caller;
+ QML_ITEMTYPE* m_time;
+ QML_ITEMTYPE* m_mute;
+};
+
+#endif // OSD_H
diff --git a/src/gui/qml/ImageButton.qml b/src/gui/qml/ImageButton.qml
new file mode 100644
index 0000000..3d76fa7
--- /dev/null
+++ b/src/gui/qml/ImageButton.qml
@@ -0,0 +1,28 @@
+import QtQuick 1.1
+
+Rectangle {
+
+ property alias image: img.source
+ signal clicked
+
+ color: "transparent"
+ z: 2
+
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ onClicked: parent.clicked()
+ }
+
+ Image {
+ id: img
+ smooth: true
+ anchors.fill: parent
+ }
+
+ states: State {
+ name: "pressed"; when: mouseArea.pressed
+ PropertyChanges { target: img; anchors.topMargin: 2; anchors.bottomMargin: -2 }
+ }
+}
+
diff --git a/src/gui/qml/osd.qml b/src/gui/qml/osd.qml
new file mode 100644
index 0000000..cfbf85e
--- /dev/null
+++ b/src/gui/qml/osd.qml
@@ -0,0 +1,94 @@
+import QtQuick 1.1
+
+Rectangle {
+ id: rectangle1
+ width: 310
+ height: 55
+ color: "black"
+
+ Image {
+ id: image1
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 5
+ anchors.top: parent.top
+ anchors.topMargin: 5
+ anchors.left: parent.left
+ anchors.leftMargin: 5
+ source: "qrc:/icons/images/twinkle48.png"
+ width: height
+ }
+
+ ImageButton {
+ id: hangup
+ objectName: "hangup"
+ x: 262
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 15
+ anchors.top: parent.top
+ anchors.topMargin: 15
+ anchors.right: parent.right
+ anchors.rightMargin: 10
+ width: height
+ image: "qrc:/icons/images/osd_hangup.png"
+ }
+
+ ImageButton {
+ id: mute
+ objectName: "mute"
+ x: 222
+ width: height
+ image: "qrc:/icons/images/osd_mic_on.png"
+ anchors.bottomMargin: 15
+ anchors.topMargin: 15
+ anchors.top: parent.top
+ anchors.bottom: parent.bottom
+ anchors.rightMargin: 14
+ anchors.right: hangup.left
+ }
+
+ Text {
+ id: callerName
+ objectName: "callerName"
+ x: 56
+ y: 5
+ width: 158
+ height: 21
+ text: "Caller name"
+ clip: true
+ verticalAlignment: Text.AlignVCenter
+ font.bold: true
+ font.pixelSize: 12
+ color: "white"
+ }
+
+ Text {
+ id: callTime
+ objectName: "callTime"
+ x: 56
+ y: 27
+ width: 158
+ height: 20
+ text: "Time"
+ clip: true
+ verticalAlignment: Text.AlignVCenter
+ font.pixelSize: 12
+ color: "white"
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ property variant previousPosition
+ onPressed: {
+ previousPosition = Qt.point(mouseX, mouseY)
+ }
+ onPositionChanged: {
+ if (pressedButtons == Qt.LeftButton) {
+ var dx = mouseX - previousPosition.x
+ var dy = mouseY - previousPosition.y
+ viewerWidget.pos = Qt.point(viewerWidget.pos.x + dx,
+ viewerWidget.pos.y + dy)
+ }
+ }
+ }
+}
+
diff --git a/src/gui/qml/qml.qrc b/src/gui/qml/qml.qrc
new file mode 100644
index 0000000..95e8f77
--- /dev/null
+++ b/src/gui/qml/qml.qrc
@@ -0,0 +1,6 @@
+<RCC>
+ <qresource prefix="/qml">
+ <file>ImageButton.qml</file>
+ <file>osd.qml</file>
+ </qresource>
+</RCC>
diff --git a/src/gui/syssettingsform.cpp b/src/gui/syssettingsform.cpp
index 51c411d..c0a79d5 100644
--- a/src/gui/syssettingsform.cpp
+++ b/src/gui/syssettingsform.cpp
@@ -278,6 +278,8 @@ void SysSettingsForm::populate()
// Startup settings
startHiddenCheckBox->setChecked(sys_config->get_start_hidden());
+
+ osdCheckBox->setChecked(sys_config->get_gui_show_call_osd());
QStringList profiles;
if (!SelectProfileForm::getUserProfiles(profiles, msg)) {
@@ -373,6 +375,7 @@ void SysSettingsForm::validate()
// General
sys_config->set_gui_use_systray(guiUseSystrayCheckBox->isChecked());
sys_config->set_gui_hide_on_close(guiHideCheckBox->isChecked());
+ sys_config->set_gui_show_call_osd(osdCheckBox->isChecked());
// Auto show on incoming call
sys_config->set_gui_auto_show_incoming(autoShowCheckBox->isChecked());
diff --git a/src/gui/syssettingsform.ui b/src/gui/syssettingsform.ui
index 3c4784a..a792f81 100644
--- a/src/gui/syssettingsform.ui
+++ b/src/gui/syssettingsform.ui
@@ -709,8 +709,8 @@ If before answering a call, the microphone or speaker appears to be invalid, a w
</layout>
</widget>
<widget class="QWidget" name="pageGeneral">
- <layout class="QVBoxLayout">
- <item>
+ <layout class="QGridLayout" name="gridLayout_3">
+ <item row="0" column="0">
<widget class="QLabel" name="generalTitleTextLabel">
<property name="font">
<font>
@@ -731,7 +731,7 @@ If before answering a call, the microphone or speaker appears to be invalid, a w
</property>
</widget>
</item>
- <item>
+ <item row="1" column="0">
<widget class="QGroupBox" name="systrayGroupBox">
<property name="title">
<string>System tray</string>
@@ -766,7 +766,7 @@ If before answering a call, the microphone or speaker appears to be invalid, a w
</layout>
</widget>
</item>
- <item>
+ <item row="2" column="0">
<widget class="QGroupBox" name="startupGroupBox">
<property name="title">
<string>Startup</string>
@@ -801,7 +801,7 @@ If before answering a call, the microphone or speaker appears to be invalid, a w
</layout>
</widget>
</item>
- <item>
+ <item row="3" column="0">
<widget class="QGroupBox" name="srvGroupBox">
<property name="title">
<string>Services</string>
@@ -836,7 +836,14 @@ If before answering a call, the microphone or speaker appears to be invalid, a w
</layout>
</widget>
</item>
- <item>
+ <item row="4" column="0">
+ <widget class="QCheckBox" name="osdCheckBox">
+ <property name="text">
+ <string>Enable in-call OSD</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="0">
<layout class="QHBoxLayout">
<item>
<widget class="QLabel" name="histSizeTextLabel">
@@ -882,7 +889,7 @@ If before answering a call, the microphone or speaker appears to be invalid, a w
</item>
</layout>
</item>
- <item>
+ <item row="6" column="0">
<layout class="QHBoxLayout">
<item>
<widget class="QCheckBox" name="autoShowCheckBox">
@@ -935,7 +942,7 @@ If before answering a call, the microphone or speaker appears to be invalid, a w
</item>
</layout>
</item>
- <item>
+ <item row="7" column="0">
<layout class="QHBoxLayout">
<item>
<widget class="QLabel" name="browserTextLabel">
diff --git a/src/sys_settings.cpp b/src/sys_settings.cpp
index cebd5c4..abca6e0 100644
--- a/src/sys_settings.cpp
+++ b/src/sys_settings.cpp
@@ -76,6 +76,7 @@ using namespace utils;
#define FLD_GUI_AUTO_SHOW_INCOMING "gui_auto_show_incoming"
#define FLD_GUI_AUTO_SHOW_TIMEOUT "gui_auto_show_timeout"
#define FLD_GUI_BROWSER_CMD "gui_browser_cmd"
+#define FLD_GUI_SHOW_CALL_OSD "gui_show_call_osd"
// Address book settings
#define FLD_AB_SHOW_SIP_ONLY "ab_show_sip_only"
@@ -254,6 +255,7 @@ t_sys_settings::t_sys_settings() {
gui_hide_on_close = true;
gui_auto_show_incoming = false;
gui_auto_show_timeout = 10;
+ gui_show_call_osd = true;
ab_show_sip_only = false;
ab_lookup_name = true;
@@ -634,6 +636,10 @@ bool t_sys_settings::get_show_buddy_list(void) const {
return result;
}
+bool t_sys_settings::get_gui_show_call_osd() const {
+ return gui_show_call_osd;
+}
+
string t_sys_settings::get_ui_session_id(void) const {
t_mutex_guard guard(mtx_sys);
return ui_session_id;
@@ -967,6 +973,12 @@ void t_sys_settings::set_warn_hide_user(bool b) {
warn_hide_user = b;
}
+void t_sys_settings::set_gui_show_call_osd(bool b) {
+ // Using mutexes in primitive type getters/setters doesn't make any sense.
+ // TODO: remove t_mutex_guard from other getters/setters like this one.
+ gui_show_call_osd = b;
+}
+
void t_sys_settings::set_mime_shared_database(const string &filename) {
t_mutex_guard guard(mtx_sys);
mime_shared_database = filename;
@@ -1565,6 +1577,8 @@ bool t_sys_settings::read_config(string &error_msg) {
gui_auto_show_timeout = atoi(value.c_str());
} else if (parameter == FLD_GUI_BROWSER_CMD) {
gui_browser_cmd = value;
+ } else if (parameter == FLD_GUI_SHOW_CALL_OSD) {
+ gui_show_call_osd = yesno2bool(value);
} else if (parameter == FLD_AB_SHOW_SIP_ONLY) {
ab_show_sip_only = yesno2bool(value);
} else if (parameter == FLD_AB_LOOKUP_NAME) {
@@ -1704,6 +1718,7 @@ bool t_sys_settings::write_config(string &error_msg) {
config << FLD_GUI_AUTO_SHOW_INCOMING << '=' << bool2yesno(gui_auto_show_incoming) << endl;
config << FLD_GUI_AUTO_SHOW_TIMEOUT << '=' << gui_auto_show_timeout << endl;
config << FLD_GUI_BROWSER_CMD << '=' << gui_browser_cmd << endl;
+ config << FLD_GUI_SHOW_CALL_OSD << '=' << bool2yesno(gui_show_call_osd) << endl;
config << endl;
// Write address book settings
diff --git a/src/sys_settings.h b/src/sys_settings.h
index 0a5f288..b6a6b93 100644
--- a/src/sys_settings.h
+++ b/src/sys_settings.h
@@ -151,6 +151,7 @@ private:
/** Show main window on incoming call after a few seconds */
bool gui_auto_show_incoming;
int gui_auto_show_timeout;
+ bool gui_show_call_osd;
/** Command to start an internet browser */
string gui_browser_cmd;
@@ -294,6 +295,7 @@ public:
bool get_gui_auto_show_incoming(void) const;
int get_gui_auto_show_timeout(void) const;
string get_gui_browser_cmd(void) const;
+ bool get_gui_show_call_osd() const;
bool get_ab_show_sip_only(void) const;
bool get_ab_lookup_name(void) const;
bool get_ab_override_display(void) const;
@@ -349,6 +351,7 @@ public:
void set_gui_auto_show_incoming(bool b);
void set_gui_auto_show_timeout(int timeout);
void set_gui_browser_cmd(const string &s);
+ void set_gui_show_call_osd(bool b);
void set_ab_show_sip_only(bool b);
void set_ab_lookup_name(bool b);
void set_ab_override_display(bool b);