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
30d8de51
Commit
30d8de51
authored
Jan 06, 2017
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(app): account settings & settings in progress.
parent
3415e100
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
87 additions
and
49 deletions
+87
-49
App.cpp
tests/src/app/App.cpp
+8
-0
Presence.hpp
tests/src/components/presence/Presence.hpp
+1
-0
AccountSettingsModel.cpp
tests/src/components/settings/AccountSettingsModel.cpp
+29
-21
AccountSettingsModel.hpp
tests/src/components/settings/AccountSettingsModel.hpp
+8
-19
SettingsModel.cpp
tests/src/components/settings/SettingsModel.cpp
+20
-3
SettingsModel.hpp
tests/src/components/settings/SettingsModel.hpp
+13
-2
AccountStatus.qml
tests/ui/modules/Linphone/Account/AccountStatus.qml
+5
-3
MainWindow.qml
tests/ui/views/App/MainWindow/MainWindow.qml
+3
-1
No files found.
tests/src/app/App.cpp
View file @
30d8de51
...
...
@@ -9,6 +9,7 @@
#include "../components/contacts/ContactsListProxyModel.hpp"
#include "../components/core/CoreManager.hpp"
#include "../components/settings/AccountSettingsModel.hpp"
#include "../components/settings/SettingsModel.hpp"
#include "../components/timeline/TimelineModel.hpp"
#include "../components/smart-search-bar/SmartSearchBarModel.hpp"
...
...
@@ -143,6 +144,13 @@ void App::registerTypes () {
}
);
qmlRegisterSingletonType
<
SettingsModel
>
(
"Linphone"
,
1
,
0
,
"SettingsModel"
,
[](
QQmlEngine
*
,
QJSEngine
*
)
->
QObject
*
{
return
new
SettingsModel
();
}
);
qmlRegisterSingletonType
<
TimelineModel
>
(
"Linphone"
,
1
,
0
,
"TimelineModel"
,
[](
QQmlEngine
*
,
QJSEngine
*
)
->
QObject
*
{
...
...
tests/src/components/presence/Presence.hpp
View file @
30d8de51
#ifndef PRESENCE_H_
#define PRESENCE_H_
#include <linphone++/linphone.hh>
#include <QObject>
// =============================================================================
...
...
tests/src/components/settings/AccountSettingsModel.cpp
View file @
30d8de51
#include <QtDebug>
#include "../../utils.hpp"
#include "../core/CoreManager.hpp"
#include "AccountSettingsModel.hpp"
// ===================================================================
// ===================================================================
==========
AccountSettingsModel
::
AccountSettingsModel
(
QObject
*
parent
)
:
QObject
(
parent
)
{}
AccountSettingsModel
::
AccountSettingsModel
(
QObject
*
parent
)
:
QObject
(
parent
)
{
m_default_proxy
=
CoreManager
::
getInstance
()
->
getCore
()
->
getDefaultProxyConfig
();
}
QString
AccountSettingsModel
::
getUsername
()
const
{
return
"Edward Miller "
;
shared_ptr
<
linphone
::
Address
>
address
=
getDefaultSipAddress
();
const
string
&
display_name
=
address
->
getDisplayName
();
return
::
Utils
::
linphoneStringToQString
(
display_name
.
empty
()
?
address
->
getUsername
()
:
display_name
);
}
void
AccountSettingsModel
::
setUsername
(
const
QString
&
username
)
{
// NOTHING TODO.
(
void
)
username
;
shared_ptr
<
linphone
::
Address
>
address
=
getDefaultSipAddress
();
if
(
address
->
setDisplayName
(
::
Utils
::
qStringToLinphoneString
(
username
)))
qWarning
()
<<
QStringLiteral
(
"Unable to set displayName on sip address: `%1`."
)
.
arg
(
::
Utils
::
linphoneStringToQString
(
address
->
asStringUriOnly
()));
emit
accountUpdated
();
}
Presence
::
PresenceLevel
AccountSettingsModel
::
getPresenceLevel
()
const
{
...
...
@@ -23,22 +39,14 @@ Presence::PresenceStatus AccountSettingsModel::getPresenceStatus () const {
}
QString
AccountSettingsModel
::
getSipAddress
()
const
{
return
QString
(
"e.miller@sip-linphone.org"
);
}
bool
AccountSettingsModel
::
getAutoAnswerStatus
()
const
{
return
true
;
return
::
Utils
::
linphoneStringToQString
(
getDefaultSipAddress
()
->
asStringUriOnly
());
}
// TODO: TMP
/*
shared_ptr<linphone::ProxyConfig> cfg = m_core->getDefaultProxyConfig();
shared_ptr<linphone::Address> address = cfg->getIdentityAddress();
shared_ptr<linphone::AuthInfo> auth_info = m_core->findAuthInfo("", address->getUsername(), cfg->getDomain());
// -----------------------------------------------------------------------------
if (auth_info)
qDebug() << "OK";
else
qDebug() << "FAIL";
shared_ptr
<
linphone
::
Address
>
AccountSettingsModel
::
getDefaultSipAddress
()
const
{
if
(
m_default_proxy
)
return
m_default_proxy
->
getIdentityAddress
();
*/
return
CoreManager
::
getInstance
()
->
getCore
()
->
getPrimaryContactParsed
();
}
tests/src/components/settings/AccountSettingsModel.hpp
View file @
30d8de51
...
...
@@ -10,18 +10,8 @@
class
AccountSettingsModel
:
public
QObject
{
Q_OBJECT
;
Q_PROPERTY
(
QString
username
READ
getUsername
// WRITE setUsername
CONSTANT
// TODO: TMP
);
Q_PROPERTY
(
QString
sipAddress
READ
getSipAddress
CONSTANT
);
Q_PROPERTY
(
QString
username
READ
getUsername
WRITE
setUsername
NOTIFY
accountUpdated
);
Q_PROPERTY
(
QString
sipAddress
READ
getSipAddress
NOTIFY
accountUpdated
);
Q_PROPERTY
(
Presence
::
PresenceLevel
presenceLevel
...
...
@@ -35,15 +25,12 @@ class AccountSettingsModel : public QObject {
CONSTANT
);
Q_PROPERTY
(
bool
autoAnswerStatus
READ
getAutoAnswerStatus
CONSTANT
);
public:
AccountSettingsModel
(
QObject
*
parent
=
Q_NULLPTR
);
signals:
void
accountUpdated
();
private:
QString
getUsername
()
const
;
void
setUsername
(
const
QString
&
username
);
...
...
@@ -53,7 +40,9 @@ private:
QString
getSipAddress
()
const
;
bool
getAutoAnswerStatus
()
const
;
std
::
shared_ptr
<
linphone
::
Address
>
getDefaultSipAddress
()
const
;
std
::
shared_ptr
<
linphone
::
ProxyConfig
>
m_default_proxy
;
};
#endif // ACCOUNT_SETTINGS_MODEL_H_
tests/src/components/settings/SettingsModel.cpp
View file @
30d8de51
#include "../core/CoreManager.hpp"
#include "SettingsModel.hpp"
// ===================================================================
using
namespace
std
;
// =============================================================================
const
string
SettingsModel
::
UI_SECTION
(
"ui"
);
SettingsModel
::
SettingsModel
(
QObject
*
parent
)
:
QObject
(
parent
)
{
// TODO: Uncomment when `getConfig` will be available.
// m_config = CoreManager::getInstance()->getCore()->getConfig();
}
bool
SettingsModel
::
getAutoAnswerStatus
()
const
{
return
true
;
// TODO: See above.
return
!!
m_config
->
getInt
(
UI_SECTION
,
"auto_answer"
,
0
);
}
SettingsModel
::
SettingsModel
(
QObject
*
parent
)
:
QObject
(
parent
)
{
bool
SettingsModel
::
setAutoAnswerStatus
(
bool
status
)
{
m_config
->
setInt
(
UI_SECTION
,
"auto_answer"
,
status
);
emit
autoAnswerStatusChanged
(
status
);
}
tests/src/components/settings/SettingsModel.hpp
View file @
30d8de51
#ifndef SETTINGS_MODEL_H_
#define SETTINGS_MODEL_H_
#include <linphone++/linphone.hh>
#include <QObject>
#include "AccountSettingsModel.hpp"
// ===================================================================
// ===================================================================
==========
class
SettingsModel
:
public
QObject
{
Q_OBJECT
;
Q_PROPERTY
(
bool
autoAnswerStatus
READ
getAutoAnswerStatus
WRITE
setAutoAnswerStatus
NOTIFY
autoAnswerStatusChanged
);
public:
SettingsModel
(
QObject
*
parent
=
Q_NULLPTR
);
signals:
void
autoAnswerStatusChanged
(
bool
status
);
private:
QList
<
AccountSettingsModel
*>
accountsSettings
;
bool
getAutoAnswerStatus
()
const
;
bool
setAutoAnswerStatus
(
bool
status
);
std
::
shared_ptr
<
linphone
::
Config
>
m_config
;
static
const
std
::
string
UI_SECTION
;
};
#endif // SETTINGS_MODEL_H_
tests/ui/modules/Linphone/Account/AccountStatus.qml
View file @
30d8de51
...
...
@@ -11,6 +11,8 @@ Item {
// ---------------------------------------------------------------------------
property
var
account
signal
clicked
// ---------------------------------------------------------------------------
...
...
@@ -29,7 +31,7 @@ Item {
Layout.preferredHeight
:
AccountStatusStyle
.
presenceLevel
.
size
Layout.preferredWidth
:
AccountStatusStyle
.
presenceLevel
.
size
icon
:
'
chevron
'
level
:
AccountSettingsModel
.
presenceLevel
level
:
account
.
presenceLevel
}
Text
{
...
...
@@ -39,7 +41,7 @@ Item {
elide
:
Text
.
ElideRight
font.bold
:
true
font.pointSize
:
AccountStatusStyle
.
username
.
fontSize
text
:
AccountSettingsModel
.
username
text
:
account
.
username
verticalAlignment
:
Text
.
AlignBottom
}
}
...
...
@@ -49,7 +51,7 @@ Item {
elide
:
Text
.
ElideRight
font.pointSize
:
AccountStatusStyle
.
sipAddress
.
fontSize
height
:
parent
.
height
/
2
text
:
AccountSettingsModel
.
sipAddress
text
:
account
.
sipAddress
verticalAlignment
:
Text
.
AlignTop
width
:
parent
.
width
}
...
...
tests/ui/views/App/MainWindow/MainWindow.qml
View file @
30d8de51
...
...
@@ -113,6 +113,8 @@ ApplicationWindow {
Layout.fillHeight
:
parent
.
height
Layout.preferredWidth
:
MainWindowStyle
.
accountStatus
.
width
account
:
AccountSettingsModel
onClicked
:
Utils
.
openWindow
(
'
ManageAccounts
'
,
window
)
}
...
...
@@ -120,7 +122,7 @@ ApplicationWindow {
width
:
MainWindowStyle
.
autoAnswerStatus
.
width
Icon
{
icon
:
Account
SettingsModel
.
autoAnswerStatus
icon
:
SettingsModel
.
autoAnswerStatus
?
'
auto_answer
'
:
''
iconSize
:
MainWindowStyle
.
autoAnswerStatus
.
iconSize
...
...
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