Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linphone-desktop
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
linphone-desktop
Commits
95473668
Commit
95473668
authored
Jun 23, 2017
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(SettingsAdvanced): send logs in progress
parent
830b95e8
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
162 additions
and
16 deletions
+162
-16
en.ts
assets/languages/en.ts
+12
-0
fr.ts
assets/languages/fr.ts
+12
-0
App.cpp
src/app/App.cpp
+1
-1
Logger.cpp
src/app/logger/Logger.cpp
+6
-2
Logger.hpp
src/app/logger/Logger.hpp
+3
-1
CoreHandlers.cpp
src/components/core/CoreHandlers.cpp
+20
-4
CoreHandlers.hpp
src/components/core/CoreHandlers.hpp
+16
-3
CoreManager.cpp
src/components/core/CoreManager.cpp
+25
-2
CoreManager.hpp
src/components/core/CoreManager.hpp
+4
-0
SettingsModel.cpp
src/components/settings/SettingsModel.cpp
+17
-0
SettingsModel.hpp
src/components/settings/SettingsModel.hpp
+6
-0
SettingsAdvanced.qml
ui/views/App/Settings/SettingsAdvanced.qml
+40
-3
No files found.
assets/languages/en.ts
View file @
95473668
...
...
@@ -985,6 +985,18 @@ your friend's SIP address or username.</translation>
<
source
>
logsUploadUrlLabel
<
/source
>
<
translation
>
Logs
upload
server
url
<
/translation
>
<
/message
>
<
message
>
<
source
>
logsUploadFailed
<
/source
>
<
translation
>
Failed
to
upload
logs
.
<
/translation
>
<
/message
>
<
message
>
<
source
>
logsEnabledLabel
<
/source
>
<
translation
>
Logs
enabled
<
/translation
>
<
/message
>
<
message
>
<
source
>
cleanLogs
<
/source
>
<
translation
>
CLEAN
LOGS
<
/translation
>
<
/message
>
<
/context
>
<
context
>
<
name
>
SettingsAudio
<
/name
>
...
...
assets/languages/fr.ts
View file @
95473668
...
...
@@ -983,6 +983,18 @@ Cliquez ici : <a href="%1">%1</a>
<
source
>
logsUploadUrlLabel
<
/source
>
<
translation
>
Url
du
serveur
de
logs
<
/translation
>
<
/message
>
<
message
>
<
source
>
logsUploadFailed
<
/source
>
<
translation
>
L
&
apos
;
envoi
des
logs
a
é
chou
é
.
&
gt
;
<
/translation
>
<
/message
>
<
message
>
<
source
>
logsEnabledLabel
<
/source
>
<
translation
>
Logs
activ
é
s
.
<
/translation
>
<
/message
>
<
message
>
<
source
>
cleanLogs
<
/source
>
<
translation
>
SUPPRIMER
LOGS
<
/translation
>
<
/message
>
<
/context
>
<
context
>
<
name
>
SettingsAudio
<
/name
>
...
...
src/app/App.cpp
View file @
95473668
...
...
@@ -86,7 +86,7 @@ App::App (int &argc, char *argv[]) : SingleApplication(argc, argv, true, Mode::U
// Initialize logger.
shared_ptr
<
linphone
::
Config
>
config
=
::
getConfigIfExists
(
*
mParser
);
Logger
::
init
(
SettingsModel
::
getLogsFolder
(
config
));
Logger
::
init
(
SettingsModel
::
getLogsFolder
(
config
)
,
SettingsModel
::
getLogsEnabled
(
config
)
);
if
(
mParser
->
isSet
(
"verbose"
))
Logger
::
getInstance
()
->
setVerbose
(
true
);
...
...
src/app/logger/Logger.cpp
View file @
95473668
...
...
@@ -155,7 +155,11 @@ void Logger::log (QtMsgType type, const QMessageLogContext &context, const QStri
// -----------------------------------------------------------------------------
void
Logger
::
init
(
const
QString
&
folder
)
{
void
Logger
::
enable
(
bool
status
)
{
linphone_core_enable_log_collection
(
status
?
LinphoneLogCollectionEnabled
:
LinphoneLogCollectionDisabled
);
}
void
Logger
::
init
(
const
QString
&
folder
,
bool
enabled
)
{
Q_ASSERT
(
!
folder
.
isEmpty
());
if
(
mInstance
)
...
...
@@ -173,5 +177,5 @@ void Logger::init (const QString &folder) {
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
(
LinphoneLogCollectionE
nabled
);
mInstance
->
enable
(
e
nabled
);
}
src/app/logger/Logger.hpp
View file @
95473668
...
...
@@ -39,7 +39,9 @@ public:
mVerbose
=
verbose
;
}
static
void
init
(
const
QString
&
folder
);
void
enable
(
bool
status
);
static
void
init
(
const
QString
&
folder
,
bool
enabled
);
static
Logger
*
getInstance
()
{
return
mInstance
;
...
...
src/components/core/CoreHandlers.cpp
View file @
95473668
...
...
@@ -98,6 +98,14 @@ void CoreHandlers::onCallStateChanged (
App
::
getInstance
()
->
getNotifier
()
->
notifyReceivedCall
(
call
);
}
void
CoreHandlers
::
onCallStatsUpdated
(
const
shared_ptr
<
linphone
::
Core
>
&
,
const
shared_ptr
<
linphone
::
Call
>
&
call
,
const
shared_ptr
<
const
linphone
::
CallStats
>
&
stats
)
{
call
->
getData
<
CallModel
>
(
"call-model"
).
updateStats
(
stats
);
}
void
CoreHandlers
::
onGlobalStateChanged
(
const
shared_ptr
<
linphone
::
Core
>
&
,
linphone
::
GlobalState
gstate
,
...
...
@@ -114,12 +122,20 @@ void CoreHandlers::onGlobalStateChanged (
}
}
void
CoreHandlers
::
on
CallStatsUpdat
ed
(
void
CoreHandlers
::
on
LogCollectionUploadStateChang
ed
(
const
shared_ptr
<
linphone
::
Core
>
&
,
const
shared_ptr
<
linphone
::
Call
>
&
call
,
const
s
hared_ptr
<
const
linphone
::
CallStats
>
&
stats
linphone
::
CoreLogCollectionUploadState
state
,
const
s
tring
&
)
{
call
->
getData
<
CallModel
>
(
"call-model"
).
updateStats
(
stats
);
emit
logsUploadStateChanged
(
state
);
}
void
CoreHandlers
::
onLogCollectionUploadProgressIndication
(
const
shared_ptr
<
linphone
::
Core
>
&
,
size_t
,
size_t
)
{
// TODO;
}
void
CoreHandlers
::
onMessageReceived
(
...
...
src/components/core/CoreHandlers.hpp
View file @
95473668
...
...
@@ -46,6 +46,7 @@ signals:
void
callTransferFailed
(
const
std
::
shared_ptr
<
linphone
::
Call
>
&
call
);
void
callTransferSucceeded
(
const
std
::
shared_ptr
<
linphone
::
Call
>
&
call
);
void
coreStarted
();
void
logsUploadStateChanged
(
linphone
::
CoreLogCollectionUploadState
state
);
void
messageReceived
(
const
std
::
shared_ptr
<
linphone
::
ChatMessage
>
&
message
);
void
presenceReceived
(
const
QString
&
sipAddress
,
const
std
::
shared_ptr
<
const
linphone
::
PresenceModel
>
&
presenceModel
);
void
registrationStateChanged
(
const
std
::
shared_ptr
<
linphone
::
ProxyConfig
>
&
proxyConfig
,
linphone
::
RegistrationState
state
);
...
...
@@ -71,16 +72,28 @@ private:
const
std
::
string
&
message
)
override
;
void
onCallStatsUpdated
(
const
std
::
shared_ptr
<
linphone
::
Core
>
&
core
,
const
std
::
shared_ptr
<
linphone
::
Call
>
&
call
,
const
std
::
shared_ptr
<
const
linphone
::
CallStats
>
&
stats
)
override
;
void
onGlobalStateChanged
(
const
std
::
shared_ptr
<
linphone
::
Core
>
&
core
,
linphone
::
GlobalState
gstate
,
const
std
::
string
&
message
)
override
;
void
on
CallStatsUpdat
ed
(
void
on
LogCollectionUploadStateChang
ed
(
const
std
::
shared_ptr
<
linphone
::
Core
>
&
core
,
const
std
::
shared_ptr
<
linphone
::
Call
>
&
call
,
const
std
::
shared_ptr
<
const
linphone
::
CallStats
>
&
stats
linphone
::
CoreLogCollectionUploadState
state
,
const
std
::
string
&
info
)
override
;
void
onLogCollectionUploadProgressIndication
(
const
std
::
shared_ptr
<
linphone
::
Core
>
&
lc
,
size_t
offset
,
size_t
total
)
override
;
void
onMessageReceived
(
...
...
src/components/core/CoreManager.cpp
View file @
95473668
...
...
@@ -40,7 +40,8 @@ using namespace std;
CoreManager
*
CoreManager
::
mInstance
=
nullptr
;
CoreManager
::
CoreManager
(
QObject
*
parent
,
const
QString
&
configPath
)
:
QObject
(
parent
),
mHandlers
(
make_shared
<
CoreHandlers
>
(
this
))
{
CoreManager
::
CoreManager
(
QObject
*
parent
,
const
QString
&
configPath
)
:
QObject
(
parent
),
mHandlers
(
make_shared
<
CoreHandlers
>
(
this
))
{
mPromiseBuild
=
QtConcurrent
::
run
(
this
,
&
CoreManager
::
createLinphoneCore
,
configPath
);
QObject
::
connect
(
&
mPromiseWatcher
,
&
QFutureWatcher
<
void
>::
finished
,
this
,
[]
{
...
...
@@ -50,7 +51,9 @@ CoreManager::CoreManager (QObject *parent, const QString &configPath) : QObject(
emit
mInstance
->
coreCreated
();
});
QObject
::
connect
(
mHandlers
.
get
(),
&
CoreHandlers
::
coreStarted
,
this
,
[]
{
CoreHandlers
*
coreHandlers
=
mHandlers
.
get
();
QObject
::
connect
(
coreHandlers
,
&
CoreHandlers
::
coreStarted
,
this
,
[]
{
mInstance
->
mCallsListModel
=
new
CallsListModel
(
mInstance
);
mInstance
->
mContactsListModel
=
new
ContactsListModel
(
mInstance
);
mInstance
->
mSipAddressesModel
=
new
SipAddressesModel
(
mInstance
);
...
...
@@ -60,6 +63,11 @@ CoreManager::CoreManager (QObject *parent, const QString &configPath) : QObject(
emit
mInstance
->
coreStarted
();
});
QObject
::
connect
(
coreHandlers
,
&
CoreHandlers
::
logsUploadStateChanged
,
this
,
&
CoreManager
::
handleLogsUploadStateChanged
);
mPromiseWatcher
.
setFuture
(
mPromiseBuild
);
}
...
...
@@ -190,6 +198,21 @@ void CoreManager::iterate () {
// -----------------------------------------------------------------------------
void
CoreManager
::
handleLogsUploadStateChanged
(
linphone
::
CoreLogCollectionUploadState
state
)
{
switch
(
state
)
{
case
linphone
:
:
CoreLogCollectionUploadStateInProgress
:
break
;
case
linphone
:
:
CoreLogCollectionUploadStateDelivered
:
emit
logsUploaded
(
true
);
break
;
case
linphone
:
:
CoreLogCollectionUploadStateNotDelivered
:
emit
logsUploaded
(
false
);
break
;
}
}
// -----------------------------------------------------------------------------
QString
CoreManager
::
getDownloadUrl
()
{
return
QStringLiteral
(
DOWNLOAD_URL
);
}
src/components/core/CoreManager.hpp
View file @
95473668
...
...
@@ -125,6 +125,8 @@ signals:
void
coreCreated
();
void
coreStarted
();
void
logsUploaded
(
bool
success
);
private:
CoreManager
(
QObject
*
parent
,
const
QString
&
configPath
);
...
...
@@ -138,6 +140,8 @@ private:
void
iterate
();
void
handleLogsUploadStateChanged
(
linphone
::
CoreLogCollectionUploadState
state
);
static
QString
getDownloadUrl
();
std
::
shared_ptr
<
linphone
::
Core
>
mCore
;
...
...
src/components/settings/SettingsModel.cpp
View file @
95473668
...
...
@@ -22,6 +22,7 @@
#include <QDir>
#include "../../app/logger/Logger.hpp"
#include "../../app/paths/Paths.hpp"
#include "../../utils/Utils.hpp"
#include "../core/CoreManager.hpp"
...
...
@@ -746,8 +747,24 @@ void SettingsModel::setLogsUploadUrl (const QString &url) {
// -----------------------------------------------------------------------------
bool
SettingsModel
::
getLogsEnabled
()
const
{
return
getLogsEnabled
(
mConfig
);
}
void
SettingsModel
::
setLogsEnabled
(
bool
status
)
{
mConfig
->
setInt
(
UI_SECTION
,
"logs_enabled"
,
status
);
Logger
::
getInstance
()
->
enable
(
status
);
emit
logsEnabledChanged
(
status
);
}
// ---------------------------------------------------------------------------
QString
SettingsModel
::
getLogsFolder
(
const
shared_ptr
<
linphone
::
Config
>
&
config
)
{
return
::
Utils
::
coreStringToAppString
(
config
->
getString
(
UI_SECTION
,
"logs_folder"
,
Paths
::
getLogsDirPath
())
);
}
bool
SettingsModel
::
getLogsEnabled
(
const
std
::
shared_ptr
<
linphone
::
Config
>
&
config
)
{
return
config
->
getInt
(
UI_SECTION
,
"logs_enabled"
,
false
);
}
src/components/settings/SettingsModel.hpp
View file @
95473668
...
...
@@ -124,6 +124,7 @@ class SettingsModel : public QObject {
Q_PROPERTY
(
QString
logsFolder
READ
getLogsFolder
WRITE
setLogsFolder
NOTIFY
logsFolderChanged
);
Q_PROPERTY
(
QString
logsUploadUrl
READ
getLogsUploadUrl
WRITE
setLogsUploadUrl
NOTIFY
logsUploadUrlChanged
);
Q_PROPERTY
(
bool
logsEnabled
READ
getLogsEnabled
WRITE
setLogsEnabled
NOTIFY
logsEnabledChanged
);
public:
enum
MediaEncryption
{
...
...
@@ -291,9 +292,13 @@ public:
QString
getLogsUploadUrl
()
const
;
void
setLogsUploadUrl
(
const
QString
&
url
);
bool
getLogsEnabled
()
const
;
void
setLogsEnabled
(
bool
status
);
// ---------------------------------------------------------------------------
static
QString
getLogsFolder
(
const
std
::
shared_ptr
<
linphone
::
Config
>
&
config
);
static
bool
getLogsEnabled
(
const
std
::
shared_ptr
<
linphone
::
Config
>
&
config
);
static
const
std
::
string
UI_SECTION
;
...
...
@@ -376,6 +381,7 @@ signals:
void
logsFolderChanged
(
const
QString
&
folder
);
void
logsUploadUrlChanged
(
const
QString
&
url
);
void
logsEnabledChanged
(
bool
status
);
private:
std
::
shared_ptr
<
linphone
::
Config
>
mConfig
;
...
...
ui/views/App/Settings/SettingsAdvanced.qml
View file @
95473668
...
...
@@ -38,6 +38,7 @@ TabContainer {
label
:
qsTr
(
'
logsUploadUrlLabel
'
)
TextField
{
readOnly
:
true
text
:
SettingsModel
.
logsUploadUrl
onEditingFinished
:
SettingsModel
.
logsUploadUrl
=
text
...
...
@@ -45,14 +46,50 @@ TabContainer {
}
}
FormLine
{
FormGroup
{
label
:
qsTr
(
'
logsEnabledLabel
'
)
Switch
{
checked
:
SettingsModel
.
logsEnabled
onClicked
:
SettingsModel
.
logsEnabled
=
!
checked
}
}
}
FormEmptyLine
{}
}
TextButtonB
{
Row
{
anchors.right
:
parent
.
right
text
:
qsTr
(
'
sendLogs
'
)
spacing
:
5
TextButtonB
{
text
:
qsTr
(
'
cleanLogs
'
)
onClicked
:
CoreManager
.
cleanLogs
()
}
TextButtonB
{
enabled
:
!
sendLogsBlock
.
loading
text
:
qsTr
(
'
sendLogs
'
)
onClicked
:
sendLogsBlock
.
execute
()
}
}
onClicked
:
CoreManager
.
sendLogs
()
RequestBlock
{
id
:
sendLogsBlock
action
:
CoreManager
.
sendLogs
width
:
parent
.
width
Connections
{
target
:
CoreManager
onLogsUploaded
:
sendLogsBlock
.
stop
(
success
?
''
:
qsTr
(
'
logsUploadFailed
'
))
}
}
// -------------------------------------------------------------------------
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment