mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-29 17:59:21 +00:00
feat(Settings): add a advanced entry and a logs folder selector
This commit is contained in:
parent
f9c4eb1266
commit
485a9f3e75
10 changed files with 134 additions and 12 deletions
|
|
@ -967,6 +967,17 @@ your friend's SIP address or username.</translation>
|
|||
<translation>Offline</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>SettingsAdvanced</name>
|
||||
<message>
|
||||
<source>logsTitle</source>
|
||||
<translation>Logs</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>logsFolderLabel</source>
|
||||
<translation>Logs folder</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>SettingsAudio</name>
|
||||
<message>
|
||||
|
|
@ -1389,6 +1400,10 @@ your friend's SIP address or username.</translation>
|
|||
<source>validButton</source>
|
||||
<translation>OK</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>uiAdvanced</source>
|
||||
<translation>Advanced</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>SmartSearchBar</name>
|
||||
|
|
|
|||
|
|
@ -965,6 +965,17 @@ Cliquez ici : <a href="%1">%1</a>
|
|||
<translation>Hors-ligne</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>SettingsAdvanced</name>
|
||||
<message>
|
||||
<source>logsTitle</source>
|
||||
<translation>Logs</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>logsFolderLabel</source>
|
||||
<translation>Dossier des logs</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>SettingsAudio</name>
|
||||
<message>
|
||||
|
|
@ -1387,6 +1398,10 @@ Cliquez ici : <a href="%1">%1</a>
|
|||
<source>validButton</source>
|
||||
<translation>OK</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>uiAdvanced</source>
|
||||
<translation>Avancé</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>SmartSearchBar</name>
|
||||
|
|
|
|||
|
|
@ -403,6 +403,7 @@
|
|||
<file>ui/views/App/Main/MainWindow.js</file>
|
||||
<file>ui/views/App/Main/MainWindowMenuBar.qml</file>
|
||||
<file>ui/views/App/Main/MainWindow.qml</file>
|
||||
<file>ui/views/App/Settings/SettingsAdvanced.qml</file>
|
||||
<file>ui/views/App/Settings/SettingsAudio.qml</file>
|
||||
<file>ui/views/App/Settings/SettingsCallsChat.qml</file>
|
||||
<file>ui/views/App/Settings/SettingsNetwork.qml</file>
|
||||
|
|
|
|||
|
|
@ -84,10 +84,9 @@ App::App (int &argc, char *argv[]) : SingleApplication(argc, argv, true, Mode::U
|
|||
createParser();
|
||||
mParser->process(*this);
|
||||
|
||||
// Initialize logger. (Do not do this before this point because the
|
||||
// application has to be created for the logs to be put in the correct
|
||||
// directory.)
|
||||
Logger::init();
|
||||
// Initialize logger.
|
||||
shared_ptr<linphone::Config> config = ::getConfigIfExists(*mParser);
|
||||
Logger::init(SettingsModel::getLogsFolder(config));
|
||||
if (mParser->isSet("verbose"))
|
||||
Logger::getInstance()->setVerbose(true);
|
||||
|
||||
|
|
@ -97,7 +96,7 @@ App::App (int &argc, char *argv[]) : SingleApplication(argc, argv, true, Mode::U
|
|||
|
||||
// Init locale.
|
||||
mTranslator = new DefaultTranslator(this);
|
||||
initLocale(::getConfigIfExists(*mParser));
|
||||
initLocale(config);
|
||||
|
||||
if (mParser->isSet("help")) {
|
||||
createParser();
|
||||
|
|
|
|||
|
|
@ -155,7 +155,9 @@ void Logger::log (QtMsgType type, const QMessageLogContext &context, const QStri
|
|||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void Logger::init () {
|
||||
void Logger::init (const QString &folder) {
|
||||
Q_ASSERT(!folder.isEmpty());
|
||||
|
||||
if (mInstance)
|
||||
return;
|
||||
mInstance = new Logger();
|
||||
|
|
@ -168,7 +170,8 @@ void Logger::init () {
|
|||
::linphoneLog(domain, type, fmt, args);
|
||||
});
|
||||
|
||||
linphone_core_set_log_collection_path(Paths::getLogsDirPath().c_str());
|
||||
linphone_core_set_log_collection_path(::Utils::appStringToCoreString(folder).c_str());
|
||||
|
||||
linphone_core_set_log_collection_max_file_size(MAX_LOGS_COLLECTION_SIZE);
|
||||
linphone_core_enable_log_collection(LinphoneLogCollectionEnabled);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ public:
|
|||
mVerbose = verbose;
|
||||
}
|
||||
|
||||
static void init ();
|
||||
static void init (const QString &folder);
|
||||
|
||||
static Logger *getInstance () {
|
||||
return mInstance;
|
||||
|
|
|
|||
|
|
@ -636,7 +636,7 @@ void SettingsModel::setDscpVideo (int dscp) {
|
|||
}
|
||||
|
||||
// =============================================================================
|
||||
// Misc.
|
||||
// UI.
|
||||
// =============================================================================
|
||||
|
||||
QString SettingsModel::getSavedScreenshotsFolder () const {
|
||||
|
|
@ -711,3 +711,27 @@ void SettingsModel::setExitOnClose (bool value) {
|
|||
mConfig->setInt(UI_SECTION, "exit_on_close", value);
|
||||
emit exitOnCloseChanged(value);
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// Advanced.
|
||||
// =============================================================================
|
||||
|
||||
QString SettingsModel::getLogsFolder () const {
|
||||
return getLogsFolder(mConfig);
|
||||
}
|
||||
|
||||
void SettingsModel::setLogsFolder (const QString &folder) {
|
||||
// Do not update path in linphone core.
|
||||
// Just update the config file.
|
||||
mConfig->setString(UI_SECTION, "logs_folder", ::Utils::appStringToCoreString(folder));
|
||||
|
||||
emit logsFolderChanged(folder);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
QString SettingsModel::getLogsFolder (const shared_ptr<linphone::Config> &config) {
|
||||
return ::Utils::coreStringToAppString(
|
||||
config->getString(UI_SECTION, "logs_folder", Paths::getLogsDirPath())
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ class SettingsModel : public QObject {
|
|||
Q_PROPERTY(int dscpAudio READ getDscpAudio WRITE setDscpAudio NOTIFY dscpAudioChanged);
|
||||
Q_PROPERTY(int dscpVideo READ getDscpVideo WRITE setDscpVideo NOTIFY dscpVideoChanged);
|
||||
|
||||
// Misc. ---------------------------------------------------------------------
|
||||
// UI. -----------------------------------------------------------------------
|
||||
|
||||
Q_PROPERTY(QString remoteProvisioning READ getRemoteProvisioning WRITE setRemoteProvisioning NOTIFY remoteProvisioningChanged);
|
||||
|
||||
|
|
@ -120,6 +120,10 @@ class SettingsModel : public QObject {
|
|||
|
||||
Q_PROPERTY(bool exitOnClose READ getExitOnClose WRITE setExitOnClose NOTIFY exitOnCloseChanged);
|
||||
|
||||
// Advanced. -----------------------------------------------------------------
|
||||
|
||||
Q_PROPERTY(QString logsFolder READ getLogsFolder WRITE setLogsFolder NOTIFY logsFolderChanged);
|
||||
|
||||
public:
|
||||
enum MediaEncryption {
|
||||
MediaEncryptionNone = linphone::MediaEncryptionNone,
|
||||
|
|
@ -261,7 +265,7 @@ public:
|
|||
int getDscpVideo () const;
|
||||
void setDscpVideo (int dscp);
|
||||
|
||||
// Misc. ---------------------------------------------------------------------
|
||||
// UI. -----------------------------------------------------------------------
|
||||
|
||||
QString getSavedScreenshotsFolder () const;
|
||||
void setSavedScreenshotsFolder (const QString &folder);
|
||||
|
|
@ -280,6 +284,13 @@ public:
|
|||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
QString getLogsFolder () const;
|
||||
void setLogsFolder (const QString &folder);
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
static QString getLogsFolder (const std::shared_ptr<linphone::Config> &config);
|
||||
|
||||
static const std::string UI_SECTION;
|
||||
|
||||
// ===========================================================================
|
||||
|
|
@ -346,7 +357,7 @@ signals:
|
|||
void dscpAudioChanged (int dscp);
|
||||
void dscpVideoChanged (int dscp);
|
||||
|
||||
// Misc. ---------------------------------------------------------------------
|
||||
// UI. -----------------------------------------------------------------------
|
||||
|
||||
void savedScreenshotsFolderChanged (const QString &folder);
|
||||
void savedVideosFolderChanged (const QString &folder);
|
||||
|
|
@ -357,6 +368,10 @@ signals:
|
|||
|
||||
void exitOnCloseChanged (bool value);
|
||||
|
||||
// Advanced. -----------------------------------------------------------------
|
||||
|
||||
void logsFolderChanged (const QString &folder);
|
||||
|
||||
private:
|
||||
std::shared_ptr<linphone::Config> mConfig;
|
||||
};
|
||||
|
|
|
|||
43
ui/views/App/Settings/SettingsAdvanced.qml
Normal file
43
ui/views/App/Settings/SettingsAdvanced.qml
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
import QtQuick 2.7
|
||||
|
||||
import Common 1.0
|
||||
import Linphone 1.0
|
||||
|
||||
import App.Styles 1.0
|
||||
|
||||
// =============================================================================
|
||||
|
||||
TabContainer {
|
||||
Column {
|
||||
spacing: SettingsWindowStyle.forms.spacing
|
||||
width: parent.width
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Logs.
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
Form {
|
||||
title: qsTr('logsTitle')
|
||||
width: parent.width
|
||||
|
||||
FormLine {
|
||||
FormGroup {
|
||||
label: qsTr('logsFolderLabel')
|
||||
|
||||
FileChooserButton {
|
||||
selectedFile: SettingsModel.logsFolder
|
||||
selectFolder: true
|
||||
|
||||
onAccepted: SettingsModel.logsFolder = selectedFile
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Internal features.
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
// Nothing for the moment.
|
||||
}
|
||||
}
|
||||
|
|
@ -84,6 +84,12 @@ ApplicationWindow {
|
|||
text: qsTr('uiTab')
|
||||
width: implicitWidth
|
||||
}
|
||||
|
||||
TabButton {
|
||||
icon: 'settings_advanced'
|
||||
text: qsTr('uiAdvanced')
|
||||
width: implicitWidth
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
|
|
@ -110,6 +116,7 @@ ApplicationWindow {
|
|||
SettingsCallsChat {}
|
||||
SettingsNetwork {}
|
||||
SettingsUi {}
|
||||
SettingsAdvanced {}
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue