avoid calling connected account
ui right panel
enter shortcut connection
non modal zrtp popup
clear magic search bar when action clicked
multicall : use call locale address for sticker instead of default account
This commit is contained in:
Gaelle Braud 2024-05-07 16:11:58 +02:00
parent 552f7acb46
commit bd5015742a
13 changed files with 66 additions and 15 deletions

View file

@ -99,9 +99,22 @@ void AccountList::setDefaultAccount(QSharedPointer<AccountCore> account) {
emit defaultAccountChanged();
}
}
AccountGui *AccountList::findAccountByAddress(const QString &address) {
for (auto &item : mList) {
if (auto isAccount = item.objectCast<AccountCore>()) {
if (isAccount->getIdentityAddress() == address) {
return new AccountGui(isAccount);
}
}
}
return nullptr;
}
bool AccountList::getHaveAccount() const {
return mHaveAccount;
}
void AccountList::setHaveAccount(bool haveAccount) {
if (mHaveAccount != haveAccount) {
mHaveAccount = haveAccount;

View file

@ -43,6 +43,7 @@ public:
AccountGui *getDefaultAccount() const;
QSharedPointer<AccountCore> getDefaultAccountCore() const;
void setDefaultAccount(QSharedPointer<AccountCore> account);
AccountGui *findAccountByAddress(const QString &address);
bool getHaveAccount() const;
void setHaveAccount(bool haveAccount);

View file

@ -61,6 +61,10 @@ void AccountProxy::resetDefaultAccount() {
emit this->defaultAccountChanged(); // Warn the UI
}
AccountGui *AccountProxy::findAccountByAddress(const QString &address) {
return dynamic_cast<AccountList *>(sourceModel())->findAccountByAddress(address);
}
bool AccountProxy::getHaveAccount() const {
return dynamic_cast<AccountList *>(sourceModel())->getHaveAccount();
}

View file

@ -44,6 +44,7 @@ public:
AccountGui *getDefaultAccount(); // Get a new object from List or give the stored one.
void setDefaultAccount(AccountGui *account); // TODO
void resetDefaultAccount(); // Reset the default account to let UI build its new object if needed.
Q_INVOKABLE AccountGui *findAccountByAddress(const QString &address);
bool getHaveAccount() const;

View file

@ -113,6 +113,13 @@ bool ToolModel::createCall(const QString &sipAddress,
}
return false;
}
for (auto &account : core->getAccountList()) {
if (account->getContactAddress()->weakEqual(address)) {
*errorMessage = "The calling address is a connected account.";
lDebug() << "[" + QString(gClassName) + "]" + *errorMessage;
return false;
}
}
std::shared_ptr<linphone::CallParams> params = core->createCallParams(nullptr);
CallModel::activateLocalVideo(params, nullptr, localVideoEnabled);

View file

@ -179,6 +179,7 @@ AppWindow {
ZrtpTokenAuthenticationDialog {
id: zrtpValidation
call: mainWindow.call
modal: false
}
Popup {
id: waitingPopup
@ -520,6 +521,10 @@ AppWindow {
Layout.fillWidth: true
Layout.maximumHeight: rightPanel.height
visible: callList.contentHeight > 0
leftPadding: 17 * DefaultStyle.dp
rightPadding: 17 * DefaultStyle.dp
topPadding: 16 * DefaultStyle.dp
bottomPadding: 16 * DefaultStyle.dp
contentItem: ListView {
id: callList
@ -537,8 +542,6 @@ AppWindow {
RowLayout {
id: delegateContent
anchors.fill: parent
anchors.leftMargin: 10 * DefaultStyle.dp
anchors.rightMargin: 10 * DefaultStyle.dp
spacing: 0
Avatar {
id: delegateAvatar
@ -550,6 +553,7 @@ AppWindow {
id: delegateName
property var remoteAddress: UtilsCpp.getDisplayName(modelData.core.peerAddress)
text: remoteAddress ? remoteAddress.value : ""
Layout.leftMargin: 8 * DefaultStyle.dp
Connections {
target: modelData.core
}
@ -560,6 +564,7 @@ AppWindow {
}
Text {
id: callStateText
Layout.rightMargin: 2 * DefaultStyle.dp
text: modelData.core.state === LinphoneEnums.CallState.Paused
|| modelData.core.state === LinphoneEnums.CallState.PausedByRemote
? qsTr("Appel en pause") : qsTr("Appel en cours")
@ -568,7 +573,6 @@ AppWindow {
id: listCallOptionsButton
Layout.preferredWidth: 24 * DefaultStyle.dp
Layout.preferredHeight: 24 * DefaultStyle.dp
Layout.alignment: Qt.AlignRight
popup.contentItem: ColumnLayout {
spacing: 0

View file

@ -219,7 +219,7 @@ Item {
}
Text {
id: sipAddr
text: UtilsCpp.generateLinphoneSipAddress(magicSearchBar.text)
text: magicSearchBar.text
}
}
Item {
@ -236,6 +236,7 @@ Item {
}
onClicked: {
UtilsCpp.createCall(sipAddr.text)
magicSearchBar.clearText()
}
}
Button {
@ -246,7 +247,10 @@ Item {
anchors.fill: parent
source: AppIcons.videoCamera
}
onClicked: UtilsCpp.createCall(sipAddr.text, {'localVideoEnabled':true})
onClicked: {
UtilsCpp.createCall(sipAddr.text, {'localVideoEnabled':true})
magicSearchBar.clearText()
}
}
}
Button {
@ -275,6 +279,7 @@ Item {
}
onClicked: {
mainItem.createContact(magicSearchBar.text, sipAddr.text)
magicSearchBar.clearText()
listPopup.close()
}
}

View file

@ -32,7 +32,7 @@ RowLayout {
AccountProxy{
id: accounts
}
account: accounts.defaultAccount
account: accounts.findAccountByAddress(mainItem.localAddress)
}
RowLayout {
Layout.alignment: Qt.AlignHCenter

View file

@ -72,12 +72,13 @@ ColumnLayout {
Layout.topMargin: 7 * DefaultStyle.dp
spacing: 29 * DefaultStyle.dp
Button {
id: connectionButton
leftPadding: 20 * DefaultStyle.dp
rightPadding: 20 * DefaultStyle.dp
topPadding: 11 * DefaultStyle.dp
bottomPadding: 11 * DefaultStyle.dp
contentItem: StackLayout {
id: connectionButton
id: connectionButtonContent
currentIndex: 0
Text {
text: qsTr("Connexion")
@ -100,15 +101,16 @@ ColumnLayout {
target: LoginPageCpp
onRegistrationStateChanged: {
if (LoginPageCpp.registrationState != LinphoneEnums.RegistrationState.Progress) {
connectionButton.currentIndex = 0
connectionButtonContent.currentIndex = 0
}
}
onErrorMessageChanged: {
connectionButton.currentIndex = 0
connectionButtonContent.currentIndex = 0
}
}
}
onClicked: {
function trigger() {
username.errorMessage = ""
password.errorMessage = ""
errorText.text = ""
@ -121,8 +123,14 @@ ColumnLayout {
return
}
LoginPageCpp.login(usernameEdit.text, passwordEdit.text)
connectionButton.currentIndex = 1
connectionButtonContent.currentIndex = 1
}
Shortcut {
sequences: ["Return", "Enter"]
onActivated: connectionButton.trigger()
}
onPressed: connectionButton.trigger()
}
Button {
background: Item {

View file

@ -19,6 +19,10 @@ Rectangle {
onVisibleChanged: if (!visible && numericPad) numericPad.close()
function clearText() {
textField.text = ""
}
Connections {
enabled: numericPad != undefined
target: numericPad ? numericPad : null

View file

@ -14,6 +14,11 @@ Item{
property alias call: allDevices.currentCall
property ConferenceGui conference: call && call.core.conference || null
property var callState: call && call.core.state || undefined
property string localAddress: call && call.conference
? call.conference.core.me.core.sipAddress
: call.core.localAddress
|| ""
onLocalAddressChanged: console.log("======== local addr changed", localAddress)
property ParticipantDeviceProxy participantDevices : ParticipantDeviceProxy {
id: allDevices
@ -80,11 +85,10 @@ Item{
anchors.bottom: mainItem.bottom
anchors.rightMargin: 20 * DefaultStyle.dp
anchors.bottomMargin: 10 * DefaultStyle.dp
//participantDevice: allDevices.me
videoEnabled: preview.visible && mainItem.call && mainItem.call.core.localVideoEnabled
onVideoEnabledChanged: console.log("P : " +videoEnabled + " / " +visible +" / " +mainItem.call)
property AccountProxy accounts: AccountProxy{id: accountProxy}
account: accountProxy.defaultAccount
account: accountProxy.findAccountByAddress(mainItem.localAddress)
call: mainItem.call
displayAll: false
displayPresence: false

View file

@ -40,7 +40,7 @@ Mosaic {
anchors.fill: parent
qmlName: 'G_'+index
call: !grid.call.core.isConference ? grid.call : null
account: index == 0 ? accountProxy.defaultAccount : null
account: index == 0 ? accountProxy.findAccountByAddress(mainItem.localAddress) : null
displayAll: false
bigBottomAddress: true
displayPresence: false

View file

@ -512,7 +512,7 @@ AbstractMainPage {
id: contactDetail
visible: mainItem.selectedRowHistoryGui != undefined
property var contactObj: UtilsCpp.findFriendByAddress(contactAddress)
contact: contactObj ? contactObj.value : null
contact: contactObj && contactObj.value || null
contactAddress: mainItem.selectedRowHistoryGui && mainItem.selectedRowHistoryGui.core.remoteAddress || ""
contactName: mainItem.selectedRowHistoryGui ? mainItem.selectedRowHistoryGui.core.displayName : ""
anchors.top: rightPanelStackView.top