Check if a call has been started on duration instead of call states.

Fix button size on main page.
Fix contact defaut view if having contacts.
Fix missing object Item on call loader.
This commit is contained in:
Julien Wadel 2024-10-17 16:55:39 +02:00
parent 1ad2170336
commit 72e4d1c81e
7 changed files with 38 additions and 31 deletions

View file

@ -112,6 +112,7 @@ CallCore::CallCore(const std::shared_ptr<linphone::Call> &call) : QObject(nullpt
mCallModel = Utils::makeQObject_ptr<CallModel>(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<linphone::Call> &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<CallCore> 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);
}
}

View file

@ -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<CallCore> create(const std::shared_ptr<linphone::Call> &call);

View file

@ -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)); \

View file

@ -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: {

View file

@ -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 {

View file

@ -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
}

View file

@ -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