From f3d6f33a3ca173e2fc57f1d8679d25b0ac1c6a15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Bri=C3=A8re?= Date: Fri, 17 Aug 2018 21:35:23 -0400 Subject: Add configuration option to disable incoming call popup window Closes #126 --- src/gui/mphoneform.cpp | 3 ++- src/gui/syssettingsform.cpp | 6 ++++++ src/gui/syssettingsform.ui | 15 ++++++++++++++- src/sys_settings.cpp | 15 +++++++++++++++ src/sys_settings.h | 5 +++++ 5 files changed, 42 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gui/mphoneform.cpp b/src/gui/mphoneform.cpp index 6c447a8..d2a7b59 100644 --- a/src/gui/mphoneform.cpp +++ b/src/gui/mphoneform.cpp @@ -810,7 +810,8 @@ void MphoneForm::updateState() name = cr.from_uri.encode_no_params_hdrs(false); incomingCallPopup->setCallerName(QString::fromStdString(name)); - showIncomingCallPopup = true; + if (sys_config->get_gui_show_incoming_popup()) + showIncomingCallPopup = true; break; } diff --git a/src/gui/syssettingsform.cpp b/src/gui/syssettingsform.cpp index 355df59..aa9bb7d 100644 --- a/src/gui/syssettingsform.cpp +++ b/src/gui/syssettingsform.cpp @@ -268,6 +268,9 @@ void SysSettingsForm::populate() // Call history histSizeSpinBox->setValue(sys_config->get_ch_max_size()); + // Show popup on incoming call + incomingPopupCheckBox->setChecked(sys_config->get_gui_show_incoming_popup()); + // Auto show on incoming call autoShowCheckBox->setChecked(sys_config->get_gui_auto_show_incoming()); autoShowTimeoutSpinBox->setValue(sys_config->get_gui_auto_show_timeout()); @@ -377,6 +380,9 @@ void SysSettingsForm::validate() sys_config->set_gui_hide_on_close(guiHideCheckBox->isChecked()); sys_config->set_gui_show_call_osd(osdCheckBox->isChecked()); + // Show popup on incoming call + sys_config->set_gui_show_incoming_popup(incomingPopupCheckBox->isChecked()); + // Auto show on incoming call sys_config->set_gui_auto_show_incoming(autoShowCheckBox->isChecked()); sys_config->set_gui_auto_show_timeout(autoShowTimeoutSpinBox->value()); diff --git a/src/gui/syssettingsform.ui b/src/gui/syssettingsform.ui index a792f81..d9e5262 100644 --- a/src/gui/syssettingsform.ui +++ b/src/gui/syssettingsform.ui @@ -890,6 +890,19 @@ If before answering a call, the microphone or speaker appears to be invalid, a w + + + Display a popup window with "Answer" and "Reject" buttons on an incoming call. + + + Show &popup window on incoming call + + + Alt+P + + + + @@ -942,7 +955,7 @@ If before answering a call, the microphone or speaker appears to be invalid, a w - + diff --git a/src/sys_settings.cpp b/src/sys_settings.cpp index bb07539..f87af3e 100644 --- a/src/sys_settings.cpp +++ b/src/sys_settings.cpp @@ -72,6 +72,7 @@ using namespace utils; // GUI settings #define FLD_GUI_USE_SYSTRAY "gui_use_systray" #define FLD_GUI_HIDE_ON_CLOSE "gui_hide_on_close" +#define FLD_GUI_SHOW_INCOMING_POPUP "gui_show_incoming_popup" #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" @@ -252,6 +253,7 @@ t_sys_settings::t_sys_settings() { gui_use_systray = true; gui_hide_on_close = true; + gui_show_incoming_popup = true; gui_auto_show_incoming = false; gui_auto_show_timeout = 10; gui_show_call_osd = true; @@ -401,6 +403,11 @@ bool t_sys_settings::get_gui_use_systray(void) const { return gui_use_systray; } +bool t_sys_settings::get_gui_show_incoming_popup(void) const { + t_mutex_guard guard(mtx_sys); + return gui_show_incoming_popup; +} + bool t_sys_settings::get_gui_auto_show_incoming(void) const { t_mutex_guard guard(mtx_sys); return gui_auto_show_incoming; @@ -755,6 +762,11 @@ void t_sys_settings::set_gui_hide_on_close(bool b) { gui_hide_on_close = b; } +void t_sys_settings::set_gui_show_incoming_popup(bool b) { + t_mutex_guard guard(mtx_sys); + gui_show_incoming_popup = b; +} + void t_sys_settings::set_gui_auto_show_incoming(bool b) { t_mutex_guard guard(mtx_sys); gui_auto_show_incoming = b; @@ -1579,6 +1591,8 @@ bool t_sys_settings::read_config(string &error_msg) { gui_use_systray = yesno2bool(value); } else if (parameter == FLD_GUI_HIDE_ON_CLOSE) { gui_hide_on_close = yesno2bool(value); + } else if (parameter == FLD_GUI_SHOW_INCOMING_POPUP) { + gui_show_incoming_popup = yesno2bool(value); } else if (parameter == FLD_GUI_AUTO_SHOW_INCOMING) { gui_auto_show_incoming = yesno2bool(value); } else if (parameter == FLD_GUI_AUTO_SHOW_TIMEOUT) { @@ -1723,6 +1737,7 @@ bool t_sys_settings::write_config(string &error_msg) { config << "# GUI\n"; config << FLD_GUI_USE_SYSTRAY << '=' << bool2yesno(gui_use_systray) << endl; config << FLD_GUI_HIDE_ON_CLOSE << '=' << bool2yesno(gui_hide_on_close) << endl; + config << FLD_GUI_SHOW_INCOMING_POPUP << '=' << bool2yesno(gui_show_incoming_popup) << endl; 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; diff --git a/src/sys_settings.h b/src/sys_settings.h index 232c4f9..906af5e 100644 --- a/src/sys_settings.h +++ b/src/sys_settings.h @@ -147,6 +147,9 @@ private: bool gui_use_systray; bool gui_hide_on_close; + /** Show popup on incoming call */ + bool gui_show_incoming_popup; + /** Show main window on incoming call after a few seconds */ bool gui_auto_show_incoming; int gui_auto_show_timeout; @@ -291,6 +294,7 @@ public: bool get_log_show_debug(void) const; bool get_gui_use_systray(void) const; bool get_gui_hide_on_close(void) const; + bool get_gui_show_incoming_popup(void) const; bool get_gui_auto_show_incoming(void) const; int get_gui_auto_show_timeout(void) const; string get_gui_browser_cmd(void) const; @@ -347,6 +351,7 @@ public: void set_log_show_debug(bool b); void set_gui_use_systray(bool b); void set_gui_hide_on_close(bool b); + void set_gui_show_incoming_popup(bool b); void set_gui_auto_show_incoming(bool b); void set_gui_auto_show_timeout(int timeout); void set_gui_browser_cmd(const string &s); -- cgit v1.2.3