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