Commit b8dbdd98 authored by Ronan's avatar Ronan

feat(Settings): add an option to quit app on main window close signal

parent c4e6e50b
......@@ -233,8 +233,8 @@ foreach (line ${QRC_RESOURCES_CONTENT})
result
"${line}"
)
string(REGEX MATCH "\\.[a-z]+$" isUi ${result})
if (NOT ${isUi} STREQUAL "")
string(REGEX MATCH "\\.[a-z]+$" is_ui ${result})
if (NOT ${is_ui} STREQUAL "")
list(APPEND QML_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/${result}")
endif ()
endforeach ()
......
......@@ -1296,6 +1296,14 @@ your friend&apos;s SIP address or username.</translation>
<source>setLocaleDescription</source>
<translation>It is necessary to restart the application. Do you want to restart now?</translation>
</message>
<message>
<source>otherTitle</source>
<translation>Other</translation>
</message>
<message>
<source>exitOnCloseLabel</source>
<translation>Exit app on close window</translation>
</message>
</context>
<context>
<name>SettingsVideo</name>
......
......@@ -1294,6 +1294,14 @@ Cliquez ici : &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<source>setLocaleDescription</source>
<translation>Voulez-vous redémarrer maintenant pour prendre en compte ces modifications ?</translation>
</message>
<message>
<source>otherTitle</source>
<translation>Divers</translation>
</message>
<message>
<source>exitOnCloseLabel</source>
<translation>Quitter à la fermeture de fenêtre</translation>
</message>
</context>
<context>
<name>SettingsVideo</name>
......
......@@ -700,3 +700,14 @@ void SettingsModel::setRemoteProvisioning (const QString &remoteProvisioning) {
else
emit remoteProvisioningNotChanged(remoteProvisioning);
}
// -----------------------------------------------------------------------------
bool SettingsModel::getExitOnClose () const {
return !!mConfig->getInt(UI_SECTION, "exit_on_close", 0);
}
void SettingsModel::setExitOnClose (bool value) {
mConfig->setInt(UI_SECTION, "exit_on_close", value);
emit exitOnCloseChanged(value);
}
......@@ -118,6 +118,8 @@ class SettingsModel : public QObject {
Q_PROPERTY(QString savedVideosFolder READ getSavedVideosFolder WRITE setSavedVideosFolder NOTIFY savedVideosFolderChanged);
Q_PROPERTY(QString downloadFolder READ getDownloadFolder WRITE setDownloadFolder NOTIFY downloadFolderChanged);
Q_PROPERTY(bool exitOnClose READ getExitOnClose WRITE setExitOnClose NOTIFY exitOnCloseChanged);
public:
enum MediaEncryption {
MediaEncryptionNone = linphone::MediaEncryptionNone,
......@@ -273,6 +275,9 @@ public:
QString getRemoteProvisioning () const;
void setRemoteProvisioning (const QString &remoteProvisioning);
bool getExitOnClose () const;
void setExitOnClose (bool value);
// ---------------------------------------------------------------------------
static const std::string UI_SECTION;
......@@ -350,6 +355,8 @@ signals:
void remoteProvisioningChanged (const QString &remoteProvisioning);
void remoteProvisioningNotChanged (const QString &remoteProvisioning);
void exitOnCloseChanged (bool value);
private:
std::shared_ptr<linphone::Config> mConfig;
};
......
......@@ -18,6 +18,11 @@ function handleActiveFocusItemChanged (activeFocusItem) {
}
function handleClosing (close) {
if (Linphone.SettingsModel.exitOnClose) {
Qt.quit()
return
}
if (Qt.platform.os === 'osx') {
close.accepted = false
window.showMinimized()
......
......@@ -108,5 +108,28 @@ TabContainer {
onClicked: Logic.cleanAvatars()
}
// -------------------------------------------------------------------------
// Other.
// -------------------------------------------------------------------------
Form {
title: qsTr('otherTitle')
width: parent.width
FormLine {
FormGroup {
label: qsTr('exitOnCloseLabel')
Switch {
id: autoAnswer
checked: SettingsModel.exitOnClose
onClicked: SettingsModel.exitOnClose = !checked
}
}
}
}
}
}
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