Fix empty lists ui

ui fixes

fix crash participantCore

fix account name on init

fix #LINQT-1366

fix #LINQT-1380

try to fix #LINQT-1379 (new call : crash when ending the call before remote answers)
This commit is contained in:
Gaelle Braud 2024-10-31 09:57:43 +01:00
parent f527556eb9
commit 2bf3071b96
12 changed files with 62 additions and 38 deletions

View file

@ -42,8 +42,8 @@ AccountCore::AccountCore(const std::shared_ptr<linphone::Account> &account) : QO
// Init data
auto address = account->getContactAddress();
mContactAddress = address ? Utils::coreStringToAppString(account->getContactAddress()->asStringUriOnly()) : "";
auto params = account->getParams();
auto identityAddress = params->getIdentityAddress();
auto params = account->getParams()->clone();
auto identityAddress = params->getIdentityAddress()->clone();
mIdentityAddress = identityAddress ? Utils::coreStringToAppString(identityAddress->asStringUriOnly()) : "";
mPictureUri = Utils::coreStringToAppString(params->getPictureUri());
mRegistrationState = LinphoneEnums::fromLinphone(account->getState());
@ -53,6 +53,9 @@ AccountCore::AccountCore(const std::shared_ptr<linphone::Account> &account) : QO
mDisplayName = Utils::coreStringToAppString(identityAddress->getDisplayName());
if (mDisplayName.isEmpty()) {
mDisplayName = ToolModel::getDisplayName(mIdentityAddress);
identityAddress->setDisplayName(Utils::appStringToCoreString(mDisplayName));
params->setIdentityAddress(identityAddress);
account->setParams(params);
}
mRegisterEnabled = params->registerEnabled();
mMwiServerAddress =

View file

@ -61,7 +61,6 @@ ParticipantCore::ParticipantCore(const std::shared_ptr<linphone::Participant> &p
mParticipantDevices.append(map);
}
} else mIsMe = false;
connect(this, &ParticipantCore::sipAddressChanged, this, &ParticipantCore::updateIsMe);
}
ParticipantCore::~ParticipantCore() {
@ -74,6 +73,7 @@ void ParticipantCore::setSelf(QSharedPointer<ParticipantCore> me) {
mParticipantConnection->makeConnectToCore(&ParticipantCore::lStartInvitation, [this](const int &secs) {
QTimer::singleShot(secs * 1000, this, &ParticipantCore::onEndOfInvitation);
});
connect(this, &ParticipantCore::sipAddressChanged, this, &ParticipantCore::updateIsMe);
}
int ParticipantCore::getSecurityLevel() const {

View file

@ -37,13 +37,6 @@ public:
AccountModel(const std::shared_ptr<linphone::Account> &account, QObject *parent = nullptr);
~AccountModel();
virtual void onRegistrationStateChanged(const std::shared_ptr<linphone::Account> &account,
linphone::RegistrationState state,
const std::string &message) override;
virtual void
onMessageWaitingIndicationChanged(const std::shared_ptr<linphone::Account> &account,
const std::shared_ptr<const linphone::MessageWaitingIndication> &mwi) override;
void onDefaultAccountChanged();
std::string getConfigAccountUiSection();
@ -103,6 +96,14 @@ signals:
void voicemailCountChanged(int count);
private:
/**Linphone **/
virtual void onRegistrationStateChanged(const std::shared_ptr<linphone::Account> &account,
linphone::RegistrationState state,
const std::string &message) override;
virtual void
onMessageWaitingIndicationChanged(const std::shared_ptr<linphone::Account> &account,
const std::shared_ptr<const linphone::MessageWaitingIndication> &mwi) override;
// UserData
static void setUserData(const std::shared_ptr<linphone::Account> &account, std::shared_ptr<AccountUserData> &data);
static std::shared_ptr<AccountUserData> getUserData(const std::shared_ptr<linphone::Account> &account);

View file

@ -141,8 +141,7 @@ Control.Button {
Layout.preferredWidth: mainItem.icon.width
Layout.preferredHeight: mainItem.icon.height
}
ButtonText{
Layout.fillHeight: true
ButtonText {
horizontalAlignment: Text.AlignLeft
}
Item{

View file

@ -15,7 +15,7 @@ Item {
property ConferenceGui conference: call && call.core.conference
property bool callTerminatedByUser: false
property bool callStarted: call?.core.isStarted
readonly property var callState: call && call.core.state || undefined
readonly property var callState: call? call.core.state : undefined
property int conferenceLayout: call && call.core.conferenceVideoLayout || 0
// property int participantDeviceCount: conference ? conference.core.participantDeviceCount : -1
// onParticipantDeviceCountChanged: {
@ -40,14 +40,14 @@ Item {
anchors.top: parent.top
anchors.topMargin: 25 * DefaultStyle.dp
z: 1
visible: callState === LinphoneEnums.CallState.End || callState === LinphoneEnums.CallState.Error || callState === LinphoneEnums.CallState.Released
visible: mainItem.callState === LinphoneEnums.CallState.End || mainItem.callState === LinphoneEnums.CallState.Error || mainItem.callState === LinphoneEnums.CallState.Released
text: mainItem.conference
? qsTr("Vous avez quitté la conférence")
: mainItem.callStarted
? mainItem.callTerminatedByUser
? qsTr("Vous avez terminé l'appel")
: qsTr("Votre correspondant a terminé l'appel")
: call && call.core.lastErrorMessage || ""
: mainItem.callTerminatedByUser
? qsTr("Vous avez terminé l'appel")
: mainItem.callStarted
? qsTr("Votre correspondant a terminé l'appel")
: call && call.core.lastErrorMessage || ""
color: DefaultStyle.grey_0
font {
pixelSize: 22 * DefaultStyle.dp

View file

@ -9,21 +9,26 @@ import Linphone
import UtilsCpp
import SettingsCpp
Rectangle{
Control.Control{
id: mainItem
padding: 10 * DefaultStyle.dp
property AccountGui account
property color backgroundColor: DefaultStyle.grey_0
signal avatarClicked()
signal backgroundClicked()
signal edit()
height: 45 * DefaultStyle.dp
MouseArea{
anchors.fill: parent
onClicked: mainItem.backgroundClicked()
background: Rectangle {
radius: 10 * DefaultStyle.dp
color: mainItem.backgroundColor
MouseArea{
id: mouseArea
anchors.fill: parent
onClicked: mainItem.backgroundClicked()
}
}
RowLayout{
anchors.fill: parent
contentItem: RowLayout{
spacing: 0
RowLayout {
spacing: 10 * DefaultStyle.dp

View file

@ -16,27 +16,27 @@ ColumnLayout{
Text {
id: topTextItem
Layout.fillHeight: true
Layout.fillWidth: true
verticalAlignment: (bottomTextItem.visible?Text.AlignBottom:Text.AlignVCenter)
visible: text != ''
visible: text != ""
font.weight: 400 * DefaultStyle.dp
font.pixelSize: 14 * DefaultStyle.dp
color: DefaultStyle.main2_700
text: mainItem.topText
width: mainItem.width
Layout.preferredWidth: mainItem.width
wrapMode: Text.WrapAnywhere
maximumLineCount: 1
}
Text {
id: bottomTextItem
Layout.fillHeight: true
Layout.fillWidth: true
verticalAlignment: (topTextItem.visible?Text.AlignTop:Text.AlignVCenter)
visible: text != ''
font.weight: 300 * DefaultStyle.dp
font.pixelSize: 12 * DefaultStyle.dp
color: DefaultStyle.main2_400
text: mainItem.bottomText
Layout.preferredWidth: mainItem.width
maximumLineCount: 1
wrapMode: Text.WrapAnywhere
}

View file

@ -160,6 +160,7 @@ FocusScope{
searchBarText: searchbar.text
sourceFlags: LinphoneEnums.MagicSearchSource.All
multiSelectionEnabled: true
displayNameCapitalization: false
onContactAddedToSelection: (address) => {
contactList.addContactToSelection(address)
participantList.positionViewAtEnd()

View file

@ -21,6 +21,7 @@ Rectangle {
property var imageSource
property string title
property string text
property bool enableMouseArea: false
signal contentClicked()
EffectImage {
Layout.preferredWidth: 32 * DefaultStyle.dp
@ -55,6 +56,7 @@ Rectangle {
}
MouseArea {
id: privateMouseArea
enabled: line.enableMouseArea
anchors.fill: parent
hoverEnabled: true
cursorShape: containsMouse ? Qt.PointingHandCursor : Qt.ArrowCursor
@ -80,6 +82,7 @@ Rectangle {
imageSource: AppIcons.detective
title: qsTr("Politique de confidentialité")
text: qsTr("Visiter notre potilique de confidentialité")
enableMouseArea: true
onContentClicked: Qt.openUrlExternally(ConstantsCpp.PrivatePolicyUrl)
}
AboutLine {

View file

@ -175,14 +175,14 @@ FocusScope {
bottomPadding: 11 * DefaultStyle.dp
leftPadding: 20 * DefaultStyle.dp
rightPadding: 20 * DefaultStyle.dp
icon.source: AppIcons.newItemIconSource
icon.source: mainItem.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
spacing: 8 * DefaultStyle.dp
onPressed: mainItem.noItemButtonPressed()
}
Item {

View file

@ -12,9 +12,9 @@ Item {
id: mainItem
width: 517 * DefaultStyle.dp
readonly property int topPadding: 23 * DefaultStyle.dp
readonly property int bottomPadding: 23 * DefaultStyle.dp
readonly property int leftPadding: 32 * DefaultStyle.dp
readonly property int rightPadding: 32 * DefaultStyle.dp
readonly property int bottomPadding: 18 * DefaultStyle.dp
readonly property int leftPadding: 24 * DefaultStyle.dp
readonly property int rightPadding: 24 * DefaultStyle.dp
readonly property int spacing: 16 * DefaultStyle.dp
property AccountProxy accountProxy
@ -37,14 +37,25 @@ Item {
Layout.preferredHeight: contentHeight
Layout.fillWidth: true
spacing: mainItem.spacing
model: AppCpp.accounts
model: AccountProxy {
sourceModel: AppCpp.accounts
}
delegate: Contact{
id: contactItem
width: list.width
account: modelData
onAvatarClicked: fileDialog.open()
onBackgroundClicked: modelData.core.lSetDefaultAccount()
onBackgroundClicked: {
list.currentIndex = index
modelData.core.lSetDefaultAccount()
}
onEdit: editAccount(modelData)
hoverEnabled: true
backgroundColor: list.currentIndex === index
? DefaultStyle.grey_200
: hovered
? DefaultStyle.main2_100
: DefaultStyle.grey_0
FileDialog {
id: fileDialog
currentFolder: StandardPaths.standardLocations(StandardPaths.PicturesLocation)[0]

View file

@ -55,7 +55,7 @@ AbstractMainPage {
onNoItemButtonPressed: goToNewCall()
showDefaultItem: listStackView.currentItem && listStackView.currentItem.listView && listStackView.currentItem.listView.count === 0 && listStackView.currentItem.listView.model.sourceModel.count === 0 || false
showDefaultItem: listStackView.currentItem && listStackView.currentItem.listView && listStackView.currentItem.listView.count === 0
function goToNewCall() {
if (listStackView.currentItem && listStackView.currentItem.objectName != "newCallItem") listStackView.push(newCallItem)
@ -199,6 +199,7 @@ AbstractMainPage {
id: historyListItem
FocusScope{
objectName: "historyListItem"
property var listView: historyListView
Control.StackView.onActivated: titleLoader.sourceComponent = historyListTitle
ColumnLayout {
anchors.fill: parent