diff --git a/Linphone/core/call/CallCore.cpp b/Linphone/core/call/CallCore.cpp index 3a223f66d..7ede440d2 100644 --- a/Linphone/core/call/CallCore.cpp +++ b/Linphone/core/call/CallCore.cpp @@ -112,6 +112,7 @@ CallCore::CallCore(const std::shared_ptr &call) : QObject(nullpt mCallModel = Utils::makeQObject_ptr(call); mCallModel->setSelf(mCallModel); mDuration = call->getDuration(); + mIsStarted = mDuration > 0; mMicrophoneMuted = call->getMicrophoneMuted(); mSpeakerMuted = call->getSpeakerMuted(); auto videoDirection = call->getCurrentParams()->getVideoDirection(); @@ -130,6 +131,7 @@ CallCore::CallCore(const std::shared_ptr &call) : QObject(nullpt if (mRemoteName.isEmpty()) mRemoteName = ToolModel::getDisplayName(mRemoteAddress); mLocalAddress = Utils::coreStringToAppString(call->getCallLog()->getLocalAddress()->asStringUriOnly()); mStatus = LinphoneEnums::fromLinphone(call->getCallLog()->getStatus()); + mTransferState = LinphoneEnums::fromLinphone(call->getTransferState()); mLocalToken = Utils::coreStringToAppString(mCallModel->getLocalAtuhenticationToken()); mRemoteTokens = mCallModel->getRemoteAtuhenticationTokens(); @@ -459,6 +461,8 @@ void CallCore::setSelf(QSharedPointer me) { }); } +DEFINE_GET_SET_API(CallCore, bool, isStarted, IsStarted) + QString CallCore::getRemoteName() const { return mRemoteName; } @@ -524,6 +528,7 @@ int CallCore::getDuration() const { void CallCore::setDuration(int duration) { if (mDuration != duration) { mDuration = duration; + setIsStarted(mDuration > 0); emit durationChanged(mDuration); } } diff --git a/Linphone/core/call/CallCore.hpp b/Linphone/core/call/CallCore.hpp index bf6ea9b83..6d92b4e9b 100644 --- a/Linphone/core/call/CallCore.hpp +++ b/Linphone/core/call/CallCore.hpp @@ -137,6 +137,8 @@ class CallCore : public QObject, public AbstractObject { Q_PROPERTY(AudioStats audioStats READ getAudioStats WRITE setAudioStats NOTIFY audioStatsChanged) Q_PROPERTY(VideoStats videoStats READ getVideoStats WRITE setVideoStats NOTIFY videoStatsChanged) + DECLARE_GUI_GETSET(bool, isStarted, IsStarted) + public: // Should be call from model Thread. Will be automatically in App thread after initialization static QSharedPointer create(const std::shared_ptr &call); diff --git a/Linphone/tool/AbstractObject.hpp b/Linphone/tool/AbstractObject.hpp index 3010d0fa8..abd112694 100644 --- a/Linphone/tool/AbstractObject.hpp +++ b/Linphone/tool/AbstractObject.hpp @@ -79,6 +79,13 @@ public: Q_SIGNAL void x##Changed(); \ type m##X; +#define DECLARE_GUI_GETSET(type, x, X) \ + Q_PROPERTY(type x READ get##X WRITE set##X NOTIFY x##Changed) \ + void set##X(type data); \ + type get##X() const; \ + Q_SIGNAL void x##Changed(); \ + type m##X; + #define DECLARE_CORE_GET(type, x, X) \ Q_PROPERTY(type x MEMBER m##X NOTIFY x##Changed) \ Q_SIGNAL void x##Changed(); \ @@ -143,6 +150,17 @@ public: void set##X(type data); \ Q_SIGNAL void x##Changed(type x); +#define DEFINE_GET_SET_API(Class, type, x, X) \ + type Class::get##X() const { \ + return m##X; \ + } \ + void Class::set##X(type data) { \ + if (get##X() != data) { \ + m##X = data; \ + emit x##Changed(); \ + } \ + } + #define DEFINE_GETSET(Class, type, x, X, ownerNotNull) \ type Class::get##X() const { \ mustBeInLinphoneThread(log().arg(Q_FUNC_INFO)); \ diff --git a/Linphone/view/Control/Container/Call/CallLayout.qml b/Linphone/view/Control/Container/Call/CallLayout.qml index c3825ac58..30a5fa877 100644 --- a/Linphone/view/Control/Container/Call/CallLayout.qml +++ b/Linphone/view/Control/Container/Call/CallLayout.qml @@ -14,9 +14,8 @@ Item { property CallGui call property ConferenceGui conference: call && call.core.conference property bool callTerminatedByUser: false - property bool callStarted: false + property bool callStarted: call?.core.isStarted readonly property var callState: call && call.core.state || undefined - onCallStateChanged: if (callState === LinphoneEnums.CallState.Connected) callStarted = true property int conferenceLayout: call && call.core.conferenceVideoLayout || 0 // property int participantDeviceCount: conference ? conference.core.participantDeviceCount : -1 // onParticipantDeviceCountChanged: { diff --git a/Linphone/view/Page/Main/AbstractMainPage.qml b/Linphone/view/Page/Main/AbstractMainPage.qml index fed432407..0083602f5 100644 --- a/Linphone/view/Page/Main/AbstractMainPage.qml +++ b/Linphone/view/Page/Main/AbstractMainPage.qml @@ -175,26 +175,14 @@ FocusScope { bottomPadding: 11 * DefaultStyle.dp leftPadding: 20 * DefaultStyle.dp rightPadding: 20 * DefaultStyle.dp - contentItem: RowLayout { - Layout.alignment: Qt.AlignVCenter - EffectImage { - colorizationColor: DefaultStyle.grey_0 - imageSource: mainItem.newItemIconSource - width: 24 * DefaultStyle.dp - height: 24 * DefaultStyle.dp - fillMode: Image.PreserveAspectFit - } - Text { - text: mainItem.noItemButtonText - wrapMode: Text.WordWrap - color: DefaultStyle.grey_0 - font { - weight: 600 * DefaultStyle.dp - pixelSize: 18 * DefaultStyle.dp - family: DefaultStyle.defaultFont - } - } - } + icon.source: AppIcons.newItemIconSource + icon.width: 24 * DefaultStyle.dp + icon.height: 24 * DefaultStyle.dp + contentImageColor: DefaultStyle.grey_0 + text: mainItem.noItemButtonText + textSize: 18 * DefaultStyle.dp + textWeight: 600 * DefaultStyle.dp + onPressed: mainItem.noItemButtonPressed() } Item { diff --git a/Linphone/view/Page/Main/Contact/ContactPage.qml b/Linphone/view/Page/Main/Contact/ContactPage.qml index 4e49a4434..bc62d76fa 100644 --- a/Linphone/view/Page/Main/Contact/ContactPage.qml +++ b/Linphone/view/Page/Main/Contact/ContactPage.qml @@ -51,14 +51,9 @@ AbstractMainPage { } // rightPanelStackView.initialItem: contactDetail - Binding { - mainItem.showDefaultItem: false - when: rightPanelStackView.currentItem - restoreMode: Binding.RestoreBinding - } - - showDefaultItem: contactList.model.sourceModel.count === 0 - + + showDefaultItem: rightPanelStackView.depth == 0 && contactList.count == 0 + MagicSearchProxy { id: allFriends } diff --git a/Linphone/view/Page/Window/Call/CallsWindow.qml b/Linphone/view/Page/Window/Call/CallsWindow.qml index 51bd561c7..e15f263f3 100644 --- a/Linphone/view/Page/Window/Call/CallsWindow.qml +++ b/Linphone/view/Page/Window/Call/CallsWindow.qml @@ -1358,9 +1358,9 @@ AbstractWindow { Component { id: inCallItem Loader{ + property string objectName: "inCallItem" asynchronous: true sourceComponent: Item { - property string objectName: "inCallItem" CallLayout{ anchors.fill: parent anchors.leftMargin: 20 * DefaultStyle.dp