mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-17 11:28:07 +00:00
Remove mosaic animations and try to fix layouts.
Use default friends list to add a contact. Use core friends list to remove a contact. Update SDK 5.2
This commit is contained in:
parent
f18ff79a9c
commit
ed3bd406d0
4 changed files with 21 additions and 83 deletions
|
|
@ -61,7 +61,9 @@ bool ContactsListModel::removeRows (int row, int count, const QModelIndex &paren
|
|||
|
||||
if (row < 0 || count < 0 || limit >= mList.count())
|
||||
return false;
|
||||
|
||||
|
||||
auto friendsList = CoreManager::getInstance()->getCore()->getFriendsLists();
|
||||
|
||||
beginRemoveRows(parent, row, limit);
|
||||
|
||||
for (int i = 0; i < count; ++i) {
|
||||
|
|
@ -70,7 +72,7 @@ bool ContactsListModel::removeRows (int row, int count, const QModelIndex &paren
|
|||
mOptimizedSearch.remove(address.toString());
|
||||
}
|
||||
|
||||
for(auto l : mLinphoneFriends)
|
||||
for(auto l : friendsList)
|
||||
l->removeFriend(contact->mLinphoneFriend);
|
||||
|
||||
emit contactRemoved(contact);
|
||||
|
|
@ -110,7 +112,16 @@ ContactModel *ContactsListModel::addContact (VcardModel *vcardModel) {
|
|||
contact = QSharedPointer<ContactModel>::create(vcardModel);
|
||||
App::getInstance()->getEngine()->setObjectOwnership(contact.get(), QQmlEngine::CppOwnership);
|
||||
|
||||
if (mLinphoneFriends.front()->addFriend(contact->mLinphoneFriend) != linphone::FriendList::Status::OK) {
|
||||
if( mLinphoneFriends.size() == 0){
|
||||
update();// Friends were not loaded correctly. Update them.
|
||||
}
|
||||
auto friendsList = CoreManager::getInstance()->getCore()->getDefaultFriendList();
|
||||
if( !friendsList){
|
||||
qWarning() << "There is no friends list available, cannot add a contact" ;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (friendsList->addFriend(contact->mLinphoneFriend) != linphone::FriendList::Status::OK) {
|
||||
qWarning() << QStringLiteral("Unable to add contact from vcard:") << vcardModel;
|
||||
return nullptr;
|
||||
}
|
||||
|
|
@ -118,7 +129,7 @@ ContactModel *ContactsListModel::addContact (VcardModel *vcardModel) {
|
|||
qInfo() << QStringLiteral("Add contact from vcard:") << contact.get() << vcardModel;
|
||||
|
||||
// Make sure new subscribe is issued.
|
||||
mLinphoneFriends.front()->updateSubscriptions();
|
||||
friendsList->updateSubscriptions();
|
||||
|
||||
emit layoutChanged();
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ ColumnLayout{
|
|||
}
|
||||
|
||||
function add(item){
|
||||
if( !grid.isLayoutWillChanged() || !transitionningTimer.running)
|
||||
if( !grid.isLayoutWillChanged())
|
||||
appendItem(item)
|
||||
else
|
||||
bufferModels.append(item)
|
||||
|
|
@ -34,7 +34,7 @@ ColumnLayout{
|
|||
}
|
||||
|
||||
function tryToAdd(item){
|
||||
if( !grid.isLayoutWillChanged() || !transitionningTimer.running) {
|
||||
if( !grid.isLayoutWillChanged()) {
|
||||
appendItem(item)
|
||||
return true
|
||||
}else
|
||||
|
|
@ -51,21 +51,7 @@ ColumnLayout{
|
|||
|
||||
property int transitionCount : 0
|
||||
property var bufferModels : ListModel{}
|
||||
property int maxTransitionTime: 250
|
||||
Timer{
|
||||
id: transitionningTimer
|
||||
running: false
|
||||
interval: maxTransitionTime + 5
|
||||
onTriggered: updateBuffers()
|
||||
}
|
||||
function startTransition(){
|
||||
transitionningTimer.restart()
|
||||
}
|
||||
function updateBuffers(){
|
||||
while(bufferModels.count > 0 && tryToAdd(bufferModels.get(0))){
|
||||
bufferModels.remove(0,1)
|
||||
}
|
||||
}
|
||||
|
||||
onWidthChanged: grid.updateLayout()
|
||||
onHeightChanged: grid.updateLayout()
|
||||
GridView{
|
||||
|
|
@ -120,63 +106,6 @@ ColumnLayout{
|
|||
interactive: false
|
||||
model: DelegateModel{}
|
||||
|
||||
//------------------- ANIMATIONS
|
||||
property Transition defaultTransition: Transition {
|
||||
SequentialAnimation {
|
||||
ScriptAction {
|
||||
script: {
|
||||
mainLayout.startTransition()
|
||||
}
|
||||
}
|
||||
ParallelAnimation {
|
||||
NumberAnimation { properties: "x,y"; duration: mainLayout.maxTransitionTime }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
add: Transition {
|
||||
SequentialAnimation {
|
||||
ScriptAction {
|
||||
script: {
|
||||
mainLayout.startTransition()
|
||||
}
|
||||
}
|
||||
ParallelAnimation {
|
||||
NumberAnimation { property: "opacity"; from: 0; duration: mainLayout.maxTransitionTime }
|
||||
NumberAnimation { properties: "x,y"; from: 0; duration: mainLayout.maxTransitionTime; easing.type: Easing.OutBounce }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
addDisplaced: defaultTransition
|
||||
displaced: defaultTransition
|
||||
move: defaultTransition
|
||||
moveDisplaced: defaultTransition
|
||||
remove: Transition {
|
||||
SequentialAnimation {
|
||||
PropertyAction { target: grid; property: "GridView.delayRemove"; value: true }
|
||||
ScriptAction {
|
||||
script: {
|
||||
mainLayout.startTransition()
|
||||
}
|
||||
}
|
||||
ParallelAnimation {
|
||||
NumberAnimation { property: "opacity"; to: 0; duration: mainLayout.maxTransitionTime }
|
||||
NumberAnimation { properties: "x,y"; to: 0; duration: mainLayout.maxTransitionTime }
|
||||
}
|
||||
PropertyAction { target: grid; property: "GridView.delayRemove"; value: false }
|
||||
}
|
||||
}
|
||||
removeDisplaced: defaultTransition
|
||||
populate:defaultTransition
|
||||
|
||||
Timer{ // if cell sizes change while adding/removing an item the animation will not end at the right position.
|
||||
id: updateLayoutDelay
|
||||
interval: mainLayout.maxTransitionTime
|
||||
onTriggered: grid.updateLayout()
|
||||
}
|
||||
onItemCountChanged: {
|
||||
updateLayoutDelay.restart()
|
||||
}
|
||||
onCountChanged: grid.updateLayout()
|
||||
}
|
||||
}
|
||||
|
|
@ -35,9 +35,7 @@ ColumnLayout {
|
|||
Component.onDestruction: {_vcard=null}// Need to set it to null because of not calling destructor if not.
|
||||
Component.onCompleted:{
|
||||
var sipAddress = contactEdit.sipAddress
|
||||
var contact = contactEdit._contact = SipAddressesModel.mapSipAddressToContact(
|
||||
sipAddress
|
||||
)
|
||||
var contact = contactEdit._contact = SipAddressesModel.mapSipAddressToContact(sipAddress)
|
||||
|
||||
if (!contact) {
|
||||
// Add a new contact.
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 2cf715cb4615c8115aa0102738bc3f28c6302765
|
||||
Subproject commit 24d4e2b33d036dc7942108cd2391793e58c29de5
|
||||
Loading…
Add table
Reference in a new issue