Commit 9f6857ce authored by Ronan Abhamon's avatar Ronan Abhamon

feat(SettingsModel): add a video mode supports for auto answer (close #44)

parent c103e180
...@@ -1110,6 +1110,10 @@ your friend&apos;s SIP address or username.</translation> ...@@ -1110,6 +1110,10 @@ your friend&apos;s SIP address or username.</translation>
<source>autoAnswerDelayLabel</source> <source>autoAnswerDelayLabel</source>
<translation>Delay (in ms)</translation> <translation>Delay (in ms)</translation>
</message> </message>
<message>
<source>autoAnswerWithVideoLabel</source>
<translation>Auto answer (with video)</translation>
</message>
</context> </context>
<context> <context>
<name>SettingsNetwork</name> <name>SettingsNetwork</name>
......
...@@ -1108,6 +1108,10 @@ Cliquez ici : &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt; ...@@ -1108,6 +1108,10 @@ Cliquez ici : &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<source>autoAnswerDelayLabel</source> <source>autoAnswerDelayLabel</source>
<translation>Délai (en ms)</translation> <translation>Délai (en ms)</translation>
</message> </message>
<message>
<source>autoAnswerWithVideoLabel</source>
<translation>Répondre autom. (avec vidéo)</translation>
</message>
</context> </context>
<context> <context>
<name>SettingsNetwork</name> <name>SettingsNetwork</name>
......
...@@ -343,10 +343,16 @@ CallModel::CallStatus CallModel::getStatus () const { ...@@ -343,10 +343,16 @@ CallModel::CallStatus CallModel::getStatus () const {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void CallModel::acceptWithAutoAnswerDelay () { void CallModel::acceptWithAutoAnswerDelay () {
// Use auto-answer if activated and it's the only call.
CoreManager *coreManager = CoreManager::getInstance(); CoreManager *coreManager = CoreManager::getInstance();
if (coreManager->getSettingsModel()->getAutoAnswerStatus() && coreManager->getCore()->getCallsNb() == 1) SettingsModel *settingsModel = coreManager->getSettingsModel();
// Use auto-answer if activated and it's the only call.
if (settingsModel->getAutoAnswerStatus() && coreManager->getCore()->getCallsNb() == 1) {
if (mCall->getRemoteParams()->videoEnabled() && settingsModel->getAutoAnswerVideoStatus())
acceptWithVideo();
else
accept(); accept();
}
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
......
...@@ -261,6 +261,17 @@ void SettingsModel::setAutoAnswerStatus (bool status) { ...@@ -261,6 +261,17 @@ void SettingsModel::setAutoAnswerStatus (bool status) {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
bool SettingsModel::getAutoAnswerVideoStatus () const {
return !!mConfig->getInt(UI_SECTION, "auto_answer_with_video", 0);
}
void SettingsModel::setAutoAnswerVideoStatus (bool status) {
mConfig->setInt(UI_SECTION, "auto_answer_with_video", status);
emit autoAnswerVideoStatusChanged(status);
}
// -----------------------------------------------------------------------------
QString SettingsModel::getFileTransferUrl () const { QString SettingsModel::getFileTransferUrl () const {
return ::Utils::coreStringToAppString( return ::Utils::coreStringToAppString(
CoreManager::getInstance()->getCore()->getFileTransferServer() CoreManager::getInstance()->getCore()->getFileTransferServer()
......
...@@ -64,6 +64,7 @@ class SettingsModel : public QObject { ...@@ -64,6 +64,7 @@ class SettingsModel : public QObject {
// Chat & calls. ------------------------------------------------------------- // Chat & calls. -------------------------------------------------------------
Q_PROPERTY(bool autoAnswerStatus READ getAutoAnswerStatus WRITE setAutoAnswerStatus NOTIFY autoAnswerStatusChanged); Q_PROPERTY(bool autoAnswerStatus READ getAutoAnswerStatus WRITE setAutoAnswerStatus NOTIFY autoAnswerStatusChanged);
Q_PROPERTY(bool autoAnswerVideoStatus READ getAutoAnswerVideoStatus WRITE setAutoAnswerVideoStatus NOTIFY autoAnswerVideoStatusChanged);
Q_PROPERTY(int autoAnswerDelay READ getAutoAnswerDelay WRITE setAutoAnswerDelay NOTIFY autoAnswerDelayChanged); Q_PROPERTY(int autoAnswerDelay READ getAutoAnswerDelay WRITE setAutoAnswerDelay NOTIFY autoAnswerDelayChanged);
Q_PROPERTY(QString fileTransferUrl READ getFileTransferUrl WRITE setFileTransferUrl NOTIFY fileTransferUrlChanged); Q_PROPERTY(QString fileTransferUrl READ getFileTransferUrl WRITE setFileTransferUrl NOTIFY fileTransferUrlChanged);
...@@ -194,6 +195,9 @@ public: ...@@ -194,6 +195,9 @@ public:
bool getAutoAnswerStatus () const; bool getAutoAnswerStatus () const;
void setAutoAnswerStatus (bool status); void setAutoAnswerStatus (bool status);
bool getAutoAnswerVideoStatus () const;
void setAutoAnswerVideoStatus (bool status);
int getAutoAnswerDelay () const; int getAutoAnswerDelay () const;
void setAutoAnswerDelay (int delay); void setAutoAnswerDelay (int delay);
...@@ -333,6 +337,7 @@ signals: ...@@ -333,6 +337,7 @@ signals:
// Chat & calls. ------------------------------------------------------------- // Chat & calls. -------------------------------------------------------------
void autoAnswerStatusChanged (bool status); void autoAnswerStatusChanged (bool status);
void autoAnswerVideoStatusChanged (bool status);
void autoAnswerDelayChanged (int delay); void autoAnswerDelayChanged (int delay);
void fileTransferUrlChanged (const QString &url); void fileTransferUrlChanged (const QString &url);
......
...@@ -86,6 +86,19 @@ TabContainer { ...@@ -86,6 +86,19 @@ TabContainer {
} }
} }
} }
FormLine {
FormGroup {
label: qsTr('autoAnswerWithVideoLabel')
Switch {
checked: SettingsModel.autoAnswerVideoStatus
enabled: autoAnswer.checked
onClicked: SettingsModel.autoAnswerVideoStatus = !checked
}
}
}
} }
Form { Form {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment