Commit 73cb7a2c authored by Ronan's avatar Ronan

feat(Settings): add an option to automatically record calls

parent d4b5066e
...@@ -1243,6 +1243,10 @@ Server URL ist nicht konfiguriert.</translation> ...@@ -1243,6 +1243,10 @@ Server URL ist nicht konfiguriert.</translation>
<source>showTelKeypadAutomaticallyLabel</source> <source>showTelKeypadAutomaticallyLabel</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>automaticallyRecordCallsLabel</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>SettingsNetwork</name> <name>SettingsNetwork</name>
......
...@@ -1248,6 +1248,10 @@ your friend&apos;s SIP address or username.</translation> ...@@ -1248,6 +1248,10 @@ your friend&apos;s SIP address or username.</translation>
<source>showTelKeypadAutomaticallyLabel</source> <source>showTelKeypadAutomaticallyLabel</source>
<translation>Show telephone keypad automatically</translation> <translation>Show telephone keypad automatically</translation>
</message> </message>
<message>
<source>automaticallyRecordCallsLabel</source>
<translation>Automatically record calls</translation>
</message>
</context> </context>
<context> <context>
<name>SettingsNetwork</name> <name>SettingsNetwork</name>
......
...@@ -1246,6 +1246,10 @@ Cliquez ici : &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt; ...@@ -1246,6 +1246,10 @@ Cliquez ici : &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<source>showTelKeypadAutomaticallyLabel</source> <source>showTelKeypadAutomaticallyLabel</source>
<translation>Afficher le clavier tél. automatiquement</translation> <translation>Afficher le clavier tél. automatiquement</translation>
</message> </message>
<message>
<source>automaticallyRecordCallsLabel</source>
<translation>Enregister auto. les appels</translation>
</message>
</context> </context>
<context> <context>
<name>SettingsNetwork</name> <name>SettingsNetwork</name>
......
...@@ -1243,6 +1243,10 @@ ...@@ -1243,6 +1243,10 @@
<source>showTelKeypadAutomaticallyLabel</source> <source>showTelKeypadAutomaticallyLabel</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>automaticallyRecordCallsLabel</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>SettingsNetwork</name> <name>SettingsNetwork</name>
......
...@@ -1245,6 +1245,10 @@ Tiesiog, įveskite savo draugo SIP adresą ar naudotojo vardą.</translation> ...@@ -1245,6 +1245,10 @@ Tiesiog, įveskite savo draugo SIP adresą ar naudotojo vardą.</translation>
<source>showTelKeypadAutomaticallyLabel</source> <source>showTelKeypadAutomaticallyLabel</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>automaticallyRecordCallsLabel</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>SettingsNetwork</name> <name>SettingsNetwork</name>
......
...@@ -1248,6 +1248,10 @@ o endereço SIP ou nome de usuário do seu amigo.</translation> ...@@ -1248,6 +1248,10 @@ o endereço SIP ou nome de usuário do seu amigo.</translation>
<source>showTelKeypadAutomaticallyLabel</source> <source>showTelKeypadAutomaticallyLabel</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>automaticallyRecordCallsLabel</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>SettingsNetwork</name> <name>SettingsNetwork</name>
......
...@@ -1246,6 +1246,10 @@ ...@@ -1246,6 +1246,10 @@
<source>showTelKeypadAutomaticallyLabel</source> <source>showTelKeypadAutomaticallyLabel</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>automaticallyRecordCallsLabel</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>SettingsNetwork</name> <name>SettingsNetwork</name>
......
...@@ -1245,6 +1245,10 @@ Klicka här: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt; ...@@ -1245,6 +1245,10 @@ Klicka här: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<source>showTelKeypadAutomaticallyLabel</source> <source>showTelKeypadAutomaticallyLabel</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>automaticallyRecordCallsLabel</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>SettingsNetwork</name> <name>SettingsNetwork</name>
......
...@@ -1245,6 +1245,10 @@ arkadaşınızın SIP adresini veya kullanıcı adını girin.</translation> ...@@ -1245,6 +1245,10 @@ arkadaşınızın SIP adresini veya kullanıcı adını girin.</translation>
<source>showTelKeypadAutomaticallyLabel</source> <source>showTelKeypadAutomaticallyLabel</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>automaticallyRecordCallsLabel</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>SettingsNetwork</name> <name>SettingsNetwork</name>
......
...@@ -90,7 +90,7 @@ QString CallModel::getSipAddress () const { ...@@ -90,7 +90,7 @@ QString CallModel::getSipAddress () const {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void CallModel::setRecordFile (shared_ptr<linphone::CallParams> &callParams) { void CallModel::setRecordFile (const shared_ptr<linphone::CallParams> &callParams) {
callParams->setRecordFile( callParams->setRecordFile(
Utils::appStringToCoreString( Utils::appStringToCoreString(
QStringLiteral("%1%2.mkv") QStringLiteral("%1%2.mkv")
...@@ -273,13 +273,18 @@ void CallModel::handleCallStateChanged (const shared_ptr<linphone::Call> &call, ...@@ -273,13 +273,18 @@ void CallModel::handleCallStateChanged (const shared_ptr<linphone::Call> &call,
case linphone::CallStateEnd: case linphone::CallStateEnd:
setCallErrorFromReason(call->getReason()); setCallErrorFromReason(call->getReason());
stopAutoAnswerTimer(); stopAutoAnswerTimer();
stopRecording();
mPausedByRemote = false; mPausedByRemote = false;
break; break;
case linphone::CallStateStreamsRunning:
if (!mWasConnected && CoreManager::getInstance()->getSettingsModel()->getAutomaticallyRecordCalls()) {
startRecording();
mWasConnected = true;
} UTILS_NO_BREAK;
case linphone::CallStateConnected: case linphone::CallStateConnected:
case linphone::CallStateRefered: case linphone::CallStateRefered:
case linphone::CallStateReleased: case linphone::CallStateReleased:
case linphone::CallStateStreamsRunning:
mPausedByRemote = false; mPausedByRemote = false;
break; break;
......
...@@ -97,7 +97,7 @@ public: ...@@ -97,7 +97,7 @@ public:
return mIsInConference; return mIsInConference;
} }
static void setRecordFile (std::shared_ptr<linphone::CallParams> &callParams); static void setRecordFile (const std::shared_ptr<linphone::CallParams> &callParams);
void updateStats (const std::shared_ptr<const linphone::CallStats> &callStats); void updateStats (const std::shared_ptr<const linphone::CallStats> &callStats);
void notifyCameraFirstFrameReceived (unsigned int width, unsigned int height); void notifyCameraFirstFrameReceived (unsigned int width, unsigned int height);
...@@ -202,6 +202,8 @@ private: ...@@ -202,6 +202,8 @@ private:
bool mPausedByUser = false; bool mPausedByUser = false;
bool mRecording = false; bool mRecording = false;
bool mWasConnected = false;
bool mNotifyCameraFirstFrameReceived = true; bool mNotifyCameraFirstFrameReceived = true;
QString mCallError; QString mCallError;
......
...@@ -387,6 +387,17 @@ void SettingsModel::setCallRecorderEnabled (bool status) { ...@@ -387,6 +387,17 @@ void SettingsModel::setCallRecorderEnabled (bool status) {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
bool SettingsModel::getAutomaticallyRecordCalls () const {
return !!mConfig->getInt(UiSection, "automatically_record_calls", 0);
}
void SettingsModel::setAutomaticallyRecordCalls (bool status) {
mConfig->setInt(UiSection, "automatically_record_calls", status);
emit automaticallyRecordCallsChanged(status);
}
// -----------------------------------------------------------------------------
bool SettingsModel::getMuteMicrophoneEnabled () const { bool SettingsModel::getMuteMicrophoneEnabled () const {
return !!mConfig->getInt(UiSection, "mute_microphone_enabled", 1); return !!mConfig->getInt(UiSection, "mute_microphone_enabled", 1);
} }
......
...@@ -87,6 +87,7 @@ class SettingsModel : public QObject { ...@@ -87,6 +87,7 @@ class SettingsModel : public QObject {
Q_PROPERTY(bool outgoingCallsEnabled READ getOutgoingCallsEnabled WRITE setOutgoingCallsEnabled NOTIFY outgoingCallsEnabledChanged); Q_PROPERTY(bool outgoingCallsEnabled READ getOutgoingCallsEnabled WRITE setOutgoingCallsEnabled NOTIFY outgoingCallsEnabledChanged);
Q_PROPERTY(bool callRecorderEnabled READ getCallRecorderEnabled WRITE setCallRecorderEnabled NOTIFY callRecorderEnabledChanged); Q_PROPERTY(bool callRecorderEnabled READ getCallRecorderEnabled WRITE setCallRecorderEnabled NOTIFY callRecorderEnabledChanged);
Q_PROPERTY(bool automaticallyRecordCalls READ getAutomaticallyRecordCalls WRITE setAutomaticallyRecordCalls NOTIFY automaticallyRecordCallsChanged);
Q_PROPERTY(bool muteMicrophoneEnabled READ getMuteMicrophoneEnabled WRITE setMuteMicrophoneEnabled NOTIFY muteMicrophoneEnabledChanged); Q_PROPERTY(bool muteMicrophoneEnabled READ getMuteMicrophoneEnabled WRITE setMuteMicrophoneEnabled NOTIFY muteMicrophoneEnabledChanged);
...@@ -271,6 +272,9 @@ public: ...@@ -271,6 +272,9 @@ public:
bool getCallRecorderEnabled () const; bool getCallRecorderEnabled () const;
void setCallRecorderEnabled (bool status); void setCallRecorderEnabled (bool status);
bool getAutomaticallyRecordCalls () const;
void setAutomaticallyRecordCalls (bool status);
bool getMuteMicrophoneEnabled () const; bool getMuteMicrophoneEnabled () const;
void setMuteMicrophoneEnabled (bool status); void setMuteMicrophoneEnabled (bool status);
...@@ -460,6 +464,7 @@ signals: ...@@ -460,6 +464,7 @@ signals:
void outgoingCallsEnabledChanged (bool status); void outgoingCallsEnabledChanged (bool status);
void callRecorderEnabledChanged (bool status); void callRecorderEnabledChanged (bool status);
void automaticallyRecordCallsChanged (bool status);
void muteMicrophoneEnabledChanged (bool status); void muteMicrophoneEnabledChanged (bool status);
......
...@@ -150,6 +150,20 @@ TabContainer { ...@@ -150,6 +150,20 @@ TabContainer {
} }
} }
} }
FormLine {
visible: SettingsModel.callRecorderEnabled || SettingsModel.developerSettingsEnabled
FormGroup {
label: qsTr('automaticallyRecordCallsLabel')
Switch {
checked: SettingsModel.automaticallyRecordCalls
onClicked: SettingsModel.automaticallyRecordCalls = !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