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

View file

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

View file

@ -37,13 +37,6 @@ public:
AccountModel(const std::shared_ptr<linphone::Account> &account, QObject *parent = nullptr); AccountModel(const std::shared_ptr<linphone::Account> &account, QObject *parent = nullptr);
~AccountModel(); ~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(); void onDefaultAccountChanged();
std::string getConfigAccountUiSection(); std::string getConfigAccountUiSection();
@ -103,6 +96,14 @@ signals:
void voicemailCountChanged(int count); void voicemailCountChanged(int count);
private: 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 // UserData
static void setUserData(const std::shared_ptr<linphone::Account> &account, std::shared_ptr<AccountUserData> &data); 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); 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.preferredWidth: mainItem.icon.width
Layout.preferredHeight: mainItem.icon.height Layout.preferredHeight: mainItem.icon.height
} }
ButtonText{ ButtonText {
Layout.fillHeight: true
horizontalAlignment: Text.AlignLeft horizontalAlignment: Text.AlignLeft
} }
Item{ Item{

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -175,14 +175,14 @@ FocusScope {
bottomPadding: 11 * DefaultStyle.dp bottomPadding: 11 * DefaultStyle.dp
leftPadding: 20 * DefaultStyle.dp leftPadding: 20 * DefaultStyle.dp
rightPadding: 20 * DefaultStyle.dp rightPadding: 20 * DefaultStyle.dp
icon.source: AppIcons.newItemIconSource icon.source: mainItem.newItemIconSource
icon.width: 24 * DefaultStyle.dp icon.width: 24 * DefaultStyle.dp
icon.height: 24 * DefaultStyle.dp icon.height: 24 * DefaultStyle.dp
contentImageColor: DefaultStyle.grey_0 contentImageColor: DefaultStyle.grey_0
text: mainItem.noItemButtonText text: mainItem.noItemButtonText
textSize: 18 * DefaultStyle.dp textSize: 18 * DefaultStyle.dp
textWeight: 600 * DefaultStyle.dp textWeight: 600 * DefaultStyle.dp
spacing: 8 * DefaultStyle.dp
onPressed: mainItem.noItemButtonPressed() onPressed: mainItem.noItemButtonPressed()
} }
Item { Item {

View file

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

View file

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